This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Undo #4055 (related to #4079).
[perl5.git] / opcode.pl
1 #!/usr/bin/perl
2
3 unlink "opcode.h", "opnames.h";
4 open(OC, ">opcode.h") || die "Can't create opcode.h: $!\n";
5 open(ON, ">opnames.h") || die "Can't create opnames.h: $!\n";
6 select OC;
7
8 # Read data.
9
10 while (<DATA>) {
11     chop;
12     next unless $_;
13     next if /^#/;
14     ($key, $desc, $check, $flags, $args) = split(/\t+/, $_, 5);
15
16     warn qq[Description "$desc" duplicates $seen{$desc}\n] if $seen{$desc};
17     die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
18     $seen{$desc} = qq[description of opcode "$key"];
19     $seen{$key} = qq[opcode "$key"];
20
21     push(@ops, $key);
22     $desc{$key} = $desc;
23     $check{$key} = $check;
24     $ckname{$check}++;
25     $flags{$key} = $flags;
26     $args{$key} = $args;
27 }
28
29 # Emit defines.
30
31 $i = 0;
32 print <<"END";
33 /* !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!! 
34    This file is built by opcode.pl from its data.  Any changes made here
35    will be lost!
36 */
37
38 #define Perl_pp_i_preinc Perl_pp_preinc
39 #define Perl_pp_i_predec Perl_pp_predec
40 #define Perl_pp_i_postinc Perl_pp_postinc
41 #define Perl_pp_i_postdec Perl_pp_postdec
42
43 END
44
45 print ON <<"END";
46 /* !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!! 
47    This file is built by opcode.pl from its data.  Any changes made here
48    will be lost!
49 */
50
51 typedef enum opcode {
52 END
53
54 for (@ops) {
55     print ON "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
56 }
57 print ON "\t", &tab(3,"OP_max"), "\n";
58 print ON "} opcode;\n";
59 print ON "\n#define MAXO ", scalar @ops, "\n\n"; 
60
61 # Emit op names and descriptions.
62
63 print <<END;
64
65 START_EXTERN_C
66
67 #ifndef DOINIT
68 EXT char *PL_op_name[];
69 #else
70 EXT char *PL_op_name[] = {
71 END
72
73 for (@ops) {
74     print qq(\t"$_",\n);
75 }
76
77 print <<END;
78 };
79 #endif
80
81 END
82
83 print <<END;
84 #ifndef DOINIT
85 EXT char *PL_op_desc[];
86 #else
87 EXT char *PL_op_desc[] = {
88 END
89
90 for (@ops) {
91     print qq(\t"$desc{$_}",\n);
92 }
93
94 print <<END;
95 };
96 #endif
97
98 END_EXTERN_C
99
100 END
101
102 # Emit function declarations.
103
104 #for (sort keys %ckname) {
105 #    print "OP *\t", &tab(3,$_),"(pTHX_ OP* o);\n";
106 #}
107 #
108 #print "\n";
109 #
110 #for (@ops) {
111 #    print "OP *\t", &tab(3, "pp_$_"), "(pTHX);\n";
112 #}
113
114 # Emit ppcode switch array.
115
116 print <<END;
117
118 START_EXTERN_C
119
120 #ifndef DOINIT
121 EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX);
122 #else
123 EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX) = {
124 END
125
126 for (@ops) {
127     print "\tPerl_pp_$_,\n";
128 }
129
130 print <<END;
131 };
132 #endif
133
134 END
135
136 # Emit check routines.
137
138 print <<END;
139 #ifndef DOINIT
140 EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op);
141 #else
142 EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op) = {
143 END
144
145 for (@ops) {
146     print "\t", &tab(3, "Perl_$check{$_},"), "/* $_ */\n";
147 }
148
149 print <<END;
150 };
151 #endif
152
153 END
154
155 # Emit allowed argument types.
156
157 print <<END;
158 #ifndef DOINIT
159 EXT U32 PL_opargs[];
160 #else
161 EXT U32 PL_opargs[] = {
162 END
163
164 %argnum = (
165     S,  1,              # scalar
166     L,  2,              # list
167     A,  3,              # array value
168     H,  4,              # hash value
169     C,  5,              # code value
170     F,  6,              # file value
171     R,  7,              # scalar reference
172 );
173
174 %opclass = (
175     '0',  0,            # baseop
176     '1',  1,            # unop
177     '2',  2,            # binop
178     '|',  3,            # logop
179     '@',  4,            # listop
180     '/',  5,            # pmop
181     '$',  6,            # svop
182     '*',  7,            # gvop
183     '"',  8,            # pvop_or_svop
184     '{',  9,            # loop
185     ';',  10,           # cop
186     '%',  11,           # baseop_or_unop
187     '-',  12,           # filestatop
188     '}',  13,           # loopexop
189 );
190
191 for (@ops) {
192     $argsum = 0;
193     $flags = $flags{$_};
194     $argsum |= 1 if $flags =~ /m/;              # needs stack mark
195     $argsum |= 2 if $flags =~ /f/;              # fold constants
196     $argsum |= 4 if $flags =~ /s/;              # always produces scalar
197     $argsum |= 8 if $flags =~ /t/;              # needs target scalar
198     $argsum |= (8|256) if $flags =~ /T/;        # ... which may be lexical
199     $argsum |= 16 if $flags =~ /i/;             # always produces integer
200     $argsum |= 32 if $flags =~ /I/;             # has corresponding int op
201     $argsum |= 64 if $flags =~ /d/;             # danger, unknown side effects
202     $argsum |= 128 if $flags =~ /u/;            # defaults to $_
203
204     $flags =~ /([\W\d_])/ or die qq[Opcode "$_" has no class indicator];
205     $argsum |= $opclass{$1} << 9;
206     $mul = 0x2000;                              # 2 ^ OASHIFT
207     for $arg (split(' ',$args{$_})) {
208         $argnum = ($arg =~ s/\?//) ? 8 : 0;
209         $argnum += $argnum{$arg};
210         warn "# Conflicting bit 32 for '$_'.\n"
211             if $argnum & 8 and $mul == 0x10000000;
212         $argsum += $argnum * $mul;
213         $mul <<= 4;
214     }
215     $argsum = sprintf("0x%08x", $argsum);
216     print "\t", &tab(3, "$argsum,"), "/* $_ */\n";
217 }
218
219 print <<END;
220 };
221 #endif
222
223 END_EXTERN_C
224 END
225
226 close OC or die "Error closing opcode.h: $!";
227 close ON or die "Error closing opnames.h: $!";
228
229 unlink "pp_proto.h";
230 unlink "pp.sym";
231 open PP, '>pp_proto.h' or die "Error creating pp_proto.h: $!";
232 open PPSYM, '>pp.sym' or die "Error creating pp.sym: $!";
233
234 print PP <<"END";
235 /* !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!! 
236    This file is built by opcode.pl from its data.  Any changes made here
237    will be lost!
238 */
239
240 END
241
242 print PPSYM <<"END";
243 #
244 # !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!! 
245 #   This file is built by opcode.pl from its data.  Any changes made here
246 #   will be lost!
247 #
248
249 END
250
251
252 for (sort keys %ckname) {
253     print PP "PERL_CKDEF(Perl_$_)\n";
254     print PPSYM "Perl_$_\n";
255 #OP *\t", &tab(3,$_),"(OP* o);\n";
256 }
257
258 print PP "\n\n";
259
260 for (@ops) {
261     next if /^i_(pre|post)(inc|dec)$/;
262     print PP "PERL_PPDEF(Perl_pp_$_)\n";
263     print PPSYM "Perl_pp_$_\n";
264 }
265
266 close PP or die "Error closing pp_proto.h: $!";
267 close PPSYM or die "Error closing pp.sym: $!";
268
269 ###########################################################################
270 sub tab {
271     local($l, $t) = @_;
272     $t .= "\t" x ($l - (length($t) + 1) / 8);
273     $t;
274 }
275 ###########################################################################
276
277 # Some comments about 'T' opcode classifier:
278
279 # Safe to set if the ppcode uses:
280 #       tryAMAGICbin, tryAMAGICun, SETn, SETi, SETu, PUSHn, PUSHTARG, SETTARG,
281 #       SETs(TARG), XPUSHn, XPUSHu,
282
283 # Unsafe to set if the ppcode uses dTARG or [X]RETPUSH[YES|NO|UNDEF]
284
285 # lt and friends do SETs (including ncmp, but not scmp)
286
287 # pp.c  pos substr each not OK (RETPUSHUNDEF)
288 #       substr vec also not OK due to LV to target (are they???)
289 #       ref not OK (RETPUSHNO)
290 #       trans not OK (dTARG; TARG = sv_newmortal();)
291 #       ucfirst etc not OK: TMP arg processed inplace
292 #       each repeat not OK too due to array context
293 #       pack split - unknown whether they are safe
294
295 # pp_hot.c
296 #       readline - unknown whether it is safe
297 #       match subst not OK (dTARG)
298 #       grepwhile not OK (not always setting)
299
300 # pp_ctl.c
301 #       mapwhile flip caller not OK (not always setting)
302
303 # pp_sys.c
304 #       backtick glob warn die not OK (not always setting)
305 #       warn not OK (RETPUSHYES)
306 #       open fileno getc sysread syswrite ioctl accept shutdown
307 #        ftsize(etc) readlink telldir fork alarm getlogin not OK (RETPUSHUNDEF)
308 #       umask select not OK (XPUSHs(&PL_sv_undef);)
309 #       fileno getc sysread syswrite tell not OK (meth("FILENO" "GETC"))
310 #       sselect shm* sem* msg* syscall - unknown whether they are safe
311 #       gmtime not OK (list context)
312
313 __END__
314
315 # New ops always go at the very end
316
317 # Nothing.
318
319 null            null operation          ck_null         0       
320 stub            stub                    ck_null         0
321 scalar          scalar                  ck_fun          s%      S
322
323 # Pushy stuff.
324
325 pushmark        pushmark                ck_null         s0      
326 wantarray       wantarray               ck_null         is0     
327
328 const           constant item           ck_svconst      s$      
329
330 gvsv            scalar variable         ck_null         ds*     
331 gv              glob value              ck_null         ds*     
332 gelem           glob elem               ck_null         d2      S S
333 padsv           private variable        ck_null         ds0
334 padav           private array           ck_null         d0
335 padhv           private hash            ck_null         d0
336 padany          private something       ck_null         d0
337
338 pushre          push regexp             ck_null         d/
339
340 # References and stuff.
341
342 rv2gv           ref-to-glob cast        ck_rvconst      ds1     
343 rv2sv           scalar deref            ck_rvconst      ds1     
344 av2arylen       array length            ck_null         is1     
345 rv2cv           subroutine deref        ck_rvconst      d1
346 anoncode        anonymous subroutine    ck_anoncode     $       
347 prototype       subroutine prototype    ck_null         s%      S
348 refgen          reference constructor   ck_spair        m1      L
349 srefgen         single ref constructor  ck_null         fs1     S
350 ref             reference-type operator ck_fun          stu%    S?
351 bless           bless                   ck_fun          s@      S S?
352
353 # Pushy I/O.
354
355 backtick        backticks               ck_null         t%      
356 # glob defaults its first arg to $_
357 glob            glob                    ck_glob         t@      S? S?
358 readline        <HANDLE>                ck_null         t%      
359 rcatline        append I/O operator     ck_null         t%      
360
361 # Bindable operators.
362
363 regcmaybe       regexp comp once        ck_fun          s1      S
364 regcreset       regexp reset interpolation flag ck_fun          s1      S
365 regcomp         regexp compilation      ck_null         s|      S
366 match           pattern match           ck_match        d/
367 qr              pattern quote           ck_match        s/
368 subst           substitution            ck_null         dis/    S
369 substcont       substitution cont       ck_null         dis|    
370 trans           character translation   ck_null         is"     S
371
372 # Lvalue operators.
373 # sassign is special-cased for op class
374
375 sassign         scalar assignment       ck_sassign      s0
376 aassign         list assignment         ck_null         t2      L L
377
378 chop            chop                    ck_spair        mTs%    L
379 schop           scalar chop             ck_null         sTu%    S?
380 chomp           safe chop               ck_spair        mTs%    L
381 schomp          scalar safe chop        ck_null         sTu%    S?
382 defined         defined operator        ck_defined      isu%    S?
383 undef           undef operator          ck_lfun         s%      S?
384 study           study                   ck_fun          su%     S?
385 pos             match position          ck_lfun         stu%    S?
386
387 preinc          preincrement            ck_lfun         dIs1    S
388 i_preinc        integer preincrement    ck_lfun         dis1    S
389 predec          predecrement            ck_lfun         dIs1    S
390 i_predec        integer predecrement    ck_lfun         dis1    S
391 postinc         postincrement           ck_lfun         dIsT1   S
392 i_postinc       integer postincrement   ck_lfun         disT1   S
393 postdec         postdecrement           ck_lfun         dIsT1   S
394 i_postdec       integer postdecrement   ck_lfun         disT1   S
395
396 # Ordinary operators.
397
398 pow             exponentiation          ck_null         fsT2    S S
399
400 multiply        multiplication          ck_null         IfsT2   S S
401 i_multiply      integer multiplication  ck_null         ifsT2   S S
402 divide          division                ck_null         IfsT2   S S
403 i_divide        integer division        ck_null         ifsT2   S S
404 modulo          modulus                 ck_null         IifsT2  S S
405 i_modulo        integer modulus         ck_null         ifsT2   S S
406 repeat          repeat                  ck_repeat       mt2     L S
407
408 add             addition                ck_null         IfsT2   S S
409 i_add           integer addition        ck_null         ifsT2   S S
410 subtract        subtraction             ck_null         IfsT2   S S
411 i_subtract      integer subtraction     ck_null         ifsT2   S S
412 concat          concatenation           ck_concat       fsT2    S S
413 stringify       string                  ck_fun          fsT@    S
414
415 left_shift      left bitshift           ck_bitop        fsT2    S S
416 right_shift     right bitshift          ck_bitop        fsT2    S S
417
418 lt              numeric lt              ck_null         Iifs2   S S
419 i_lt            integer lt              ck_null         ifs2    S S
420 gt              numeric gt              ck_null         Iifs2   S S
421 i_gt            integer gt              ck_null         ifs2    S S
422 le              numeric le              ck_null         Iifs2   S S
423 i_le            integer le              ck_null         ifs2    S S
424 ge              numeric ge              ck_null         Iifs2   S S
425 i_ge            integer ge              ck_null         ifs2    S S
426 eq              numeric eq              ck_null         Iifs2   S S
427 i_eq            integer eq              ck_null         ifs2    S S
428 ne              numeric ne              ck_null         Iifs2   S S
429 i_ne            integer ne              ck_null         ifs2    S S
430 ncmp            spaceship operator      ck_null         Iifst2  S S
431 i_ncmp          integer spaceship       ck_null         ifst2   S S
432
433 slt             string lt               ck_scmp         ifs2    S S
434 sgt             string gt               ck_scmp         ifs2    S S
435 sle             string le               ck_scmp         ifs2    S S
436 sge             string ge               ck_scmp         ifs2    S S
437 seq             string eq               ck_null         ifs2    S S
438 sne             string ne               ck_null         ifs2    S S
439 scmp            string comparison       ck_scmp         ifst2   S S
440
441 bit_and         bitwise and             ck_bitop        fsT2    S S
442 bit_xor         bitwise xor             ck_bitop        fsT2    S S
443 bit_or          bitwise or              ck_bitop        fsT2    S S
444
445 negate          negate                  ck_null         IfsT1   S
446 i_negate        integer negate          ck_null         ifsT1   S
447 not             not                     ck_null         ifs1    S
448 complement      1's complement          ck_bitop        fsT1    S
449
450 # High falutin' math.
451
452 atan2           atan2                   ck_fun          fsT@    S S
453 sin             sin                     ck_fun          fsTu%   S?
454 cos             cos                     ck_fun          fsTu%   S?
455 rand            rand                    ck_fun          sT%     S?
456 srand           srand                   ck_fun          s%      S?
457 exp             exp                     ck_fun          fsTu%   S?
458 log             log                     ck_fun          fsTu%   S?
459 sqrt            sqrt                    ck_fun          fsTu%   S?
460
461 # Lowbrow math.
462
463 int             int                     ck_fun          fsTu%   S?
464 hex             hex                     ck_fun          fsTu%   S?
465 oct             oct                     ck_fun          fsTu%   S?
466 abs             abs                     ck_fun          fsTu%   S?
467
468 # String stuff.
469
470 length          length                  ck_lengthconst  isTu%   S?
471 substr          substr                  ck_fun          st@     S S S? S?
472 vec             vec                     ck_fun          ist@    S S S
473
474 index           index                   ck_index        isT@    S S S?
475 rindex          rindex                  ck_index        isT@    S S S?
476
477 sprintf         sprintf                 ck_fun_locale   mfsT@   S L
478 formline        formline                ck_fun          ms@     S L
479 ord             ord                     ck_fun          ifsTu%  S?
480 chr             chr                     ck_fun          fsTu%   S?
481 crypt           crypt                   ck_fun          fsT@    S S
482 ucfirst         upper case first        ck_fun_locale   fstu%   S?
483 lcfirst         lower case first        ck_fun_locale   fstu%   S?
484 uc              upper case              ck_fun_locale   fstu%   S?
485 lc              lower case              ck_fun_locale   fstu%   S?
486 quotemeta       quote metachars         ck_fun          fsTu%   S?
487
488 # Arrays.
489
490 rv2av           array deref             ck_rvconst      dt1     
491 aelemfast       known array element     ck_null         s*      A S
492 aelem           array element           ck_null         s2      A S
493 aslice          array slice             ck_null         m@      A L
494
495 # Hashes.
496
497 each            each                    ck_fun          %       H
498 values          values                  ck_fun          t%      H
499 keys            keys                    ck_fun          t%      H
500 delete          delete                  ck_delete       %       S
501 exists          exists operator         ck_exists       is%     S
502 rv2hv           hash deref              ck_rvconst      dt1     
503 helem           hash elem               ck_null         s2@     H S
504 hslice          hash slice              ck_null         m@      H L
505
506 # Explosives and implosives.
507
508 unpack          unpack                  ck_fun          @       S S
509 pack            pack                    ck_fun          mst@    S L
510 split           split                   ck_split        t@      S S S
511 join            join                    ck_fun          msT@    S L
512
513 # List operators.
514
515 list            list                    ck_null         m@      L
516 lslice          list slice              ck_null         2       H L L
517 anonlist        anonymous list          ck_fun          ms@     L
518 anonhash        anonymous hash          ck_fun          ms@     L
519
520 splice          splice                  ck_fun          m@      A S? S? L
521 push            push                    ck_fun          imsT@   A L
522 pop             pop                     ck_shift        s%      A
523 shift           shift                   ck_shift        s%      A
524 unshift         unshift                 ck_fun          imsT@   A L
525 sort            sort                    ck_sort         m@      C? L
526 reverse         reverse                 ck_fun          mt@     L
527
528 grepstart       grep                    ck_grep         dm@     C L
529 grepwhile       grep iterator           ck_null         dt|     
530
531 mapstart        map                     ck_grep         dm@     C L
532 mapwhile        map iterator            ck_null         dt|
533
534 # Range stuff.
535
536 range           flipflop                ck_null         |       S S
537 flip            range (or flip)         ck_null         1       S S
538 flop            range (or flop)         ck_null         1
539
540 # Control.
541
542 and             logical and             ck_null         |       
543 or              logical or              ck_null         |       
544 xor             logical xor             ck_null         fs2     S S     
545 cond_expr       conditional expression  ck_null         d|      
546 andassign       logical and assignment  ck_null         s|      
547 orassign        logical or assignment   ck_null         s|      
548
549 method          method lookup           ck_method       d1
550 entersub        subroutine entry        ck_subr         dmt1    L
551 leavesub        subroutine exit         ck_null         1       
552 caller          caller                  ck_fun          t%      S?
553 warn            warn                    ck_fun          imst@   L
554 die             die                     ck_fun          dimst@  L
555 reset           reset                   ck_fun          is%     S?
556
557 lineseq         line sequence           ck_null         @       
558 nextstate       next statement          ck_null         s;      
559 dbstate         debug next statement    ck_null         s;      
560 unstack         iteration finalizer     ck_null         s0
561 enter           block entry             ck_null         0       
562 leave           block exit              ck_null         @       
563 scope           block                   ck_null         @       
564 enteriter       foreach loop entry      ck_null         d{      
565 iter            foreach loop iterator   ck_null         0       
566 enterloop       loop entry              ck_null         d{      
567 leaveloop       loop exit               ck_null         2       
568 return          return                  ck_null         dm@     L
569 last            last                    ck_null         ds}     
570 next            next                    ck_null         ds}     
571 redo            redo                    ck_null         ds}     
572 dump            dump                    ck_null         ds}     
573 goto            goto                    ck_null         ds}     
574 exit            exit                    ck_fun          ds%     S?
575 # continued below
576
577 #nswitch                numeric switch          ck_null         d       
578 #cswitch                character switch        ck_null         d       
579
580 # I/O.
581
582 open            open                    ck_fun          ist@    F S? S?
583 close           close                   ck_fun          is%     F?
584 pipe_op         pipe                    ck_fun          is@     F F
585
586 fileno          fileno                  ck_fun          ist%    F
587 umask           umask                   ck_fun          ist%    S?
588 binmode         binmode                 ck_fun          s%      F
589
590 tie             tie                     ck_fun          idms@   R S L
591 untie           untie                   ck_fun          is%     R
592 tied            tied                    ck_fun          s%      R
593 dbmopen         dbmopen                 ck_fun          is@     H S S
594 dbmclose        dbmclose                ck_fun          is%     H
595
596 sselect         select system call      ck_select       t@      S S S S
597 select          select                  ck_select       st@     F?
598
599 getc            getc                    ck_eof          st%     F?
600 read            read                    ck_fun          imst@   F R S S?
601 enterwrite      write                   ck_fun          dis%    F?
602 leavewrite      write exit              ck_null         1       
603
604 prtf            printf                  ck_listiob      ims@    F? L
605 print           print                   ck_listiob      ims@    F? L
606
607 sysopen         sysopen                 ck_fun          s@      F S S S?
608 sysseek         sysseek                 ck_fun          s@      F S S
609 sysread         sysread                 ck_fun          imst@   F R S S?
610 syswrite        syswrite                ck_fun          imst@   F S S? S?
611
612 send            send                    ck_fun          imst@   F S S S?
613 recv            recv                    ck_fun          imst@   F R S S
614
615 eof             eof                     ck_eof          is%     F?
616 tell            tell                    ck_fun          st%     F?
617 seek            seek                    ck_fun          s@      F S S
618 # truncate really behaves as if it had both "S S" and "F S"
619 truncate        truncate                ck_trunc        is@     S S
620
621 fcntl           fcntl                   ck_fun          st@     F S S
622 ioctl           ioctl                   ck_fun          st@     F S S
623 flock           flock                   ck_fun          isT@    F S
624
625 # Sockets.
626
627 socket          socket                  ck_fun          is@     F S S S
628 sockpair        socketpair              ck_fun          is@     F F S S S
629
630 bind            bind                    ck_fun          is@     F S
631 connect         connect                 ck_fun          is@     F S
632 listen          listen                  ck_fun          is@     F S
633 accept          accept                  ck_fun          ist@    F F
634 shutdown        shutdown                ck_fun          ist@    F S
635
636 gsockopt        getsockopt              ck_fun          is@     F S S
637 ssockopt        setsockopt              ck_fun          is@     F S S S
638
639 getsockname     getsockname             ck_fun          is%     F
640 getpeername     getpeername             ck_fun          is%     F
641
642 # Stat calls.
643
644 lstat           lstat                   ck_ftst         u-      F
645 stat            stat                    ck_ftst         u-      F
646 ftrread         -R                      ck_ftst         isu-    F
647 ftrwrite        -W                      ck_ftst         isu-    F
648 ftrexec         -X                      ck_ftst         isu-    F
649 fteread         -r                      ck_ftst         isu-    F
650 ftewrite        -w                      ck_ftst         isu-    F
651 fteexec         -x                      ck_ftst         isu-    F
652 ftis            -e                      ck_ftst         isu-    F
653 fteowned        -O                      ck_ftst         isu-    F
654 ftrowned        -o                      ck_ftst         isu-    F
655 ftzero          -z                      ck_ftst         isu-    F
656 ftsize          -s                      ck_ftst         istu-   F
657 ftmtime         -M                      ck_ftst         stu-    F
658 ftatime         -A                      ck_ftst         stu-    F
659 ftctime         -C                      ck_ftst         stu-    F
660 ftsock          -S                      ck_ftst         isu-    F
661 ftchr           -c                      ck_ftst         isu-    F
662 ftblk           -b                      ck_ftst         isu-    F
663 ftfile          -f                      ck_ftst         isu-    F
664 ftdir           -d                      ck_ftst         isu-    F
665 ftpipe          -p                      ck_ftst         isu-    F
666 ftlink          -l                      ck_ftst         isu-    F
667 ftsuid          -u                      ck_ftst         isu-    F
668 ftsgid          -g                      ck_ftst         isu-    F
669 ftsvtx          -k                      ck_ftst         isu-    F
670 fttty           -t                      ck_ftst         is-     F
671 fttext          -T                      ck_ftst         isu-    F
672 ftbinary        -B                      ck_ftst         isu-    F
673
674 # File calls.
675
676 chdir           chdir                   ck_fun          isT%    S?
677 chown           chown                   ck_fun          imsT@   L
678 chroot          chroot                  ck_fun          isTu%   S?
679 unlink          unlink                  ck_fun          imsTu@  L
680 chmod           chmod                   ck_fun          imsT@   L
681 utime           utime                   ck_fun          imsT@   L
682 rename          rename                  ck_fun          isT@    S S
683 link            link                    ck_fun          isT@    S S
684 symlink         symlink                 ck_fun          isT@    S S
685 readlink        readlink                ck_fun          stu%    S?
686 mkdir           mkdir                   ck_fun          isT@    S S
687 rmdir           rmdir                   ck_fun          isTu%   S?
688
689 # Directory calls.
690
691 open_dir        opendir                 ck_fun          is@     F S
692 readdir         readdir                 ck_fun          %       F
693 telldir         telldir                 ck_fun          st%     F
694 seekdir         seekdir                 ck_fun          s@      F S
695 rewinddir       rewinddir               ck_fun          s%      F
696 closedir        closedir                ck_fun          is%     F
697
698 # Process control.
699
700 fork            fork                    ck_null         ist0    
701 wait            wait                    ck_null         isT0    
702 waitpid         waitpid                 ck_fun          isT@    S S
703 system          system                  ck_exec         imsT@   S? L
704 exec            exec                    ck_exec         dimsT@  S? L
705 kill            kill                    ck_fun          dimsT@  L
706 getppid         getppid                 ck_null         isT0    
707 getpgrp         getpgrp                 ck_fun          isT%    S?
708 setpgrp         setpgrp                 ck_fun          isT@    S? S?
709 getpriority     getpriority             ck_fun          isT@    S S
710 setpriority     setpriority             ck_fun          isT@    S S S
711
712 # Time calls.
713
714 time            time                    ck_null         isT0    
715 tms             times                   ck_null         0       
716 localtime       localtime               ck_fun          t%      S?
717 gmtime          gmtime                  ck_fun          t%      S?
718 alarm           alarm                   ck_fun          istu%   S?
719 sleep           sleep                   ck_fun          isT%    S?
720
721 # Shared memory.
722
723 shmget          shmget                  ck_fun          imst@   S S S
724 shmctl          shmctl                  ck_fun          imst@   S S S
725 shmread         shmread                 ck_fun          imst@   S S S S
726 shmwrite        shmwrite                ck_fun          imst@   S S S S
727
728 # Message passing.
729
730 msgget          msgget                  ck_fun          imst@   S S
731 msgctl          msgctl                  ck_fun          imst@   S S S
732 msgsnd          msgsnd                  ck_fun          imst@   S S S
733 msgrcv          msgrcv                  ck_fun          imst@   S S S S S
734
735 # Semaphores.
736
737 semget          semget                  ck_fun          imst@   S S S
738 semctl          semctl                  ck_fun          imst@   S S S S
739 semop           semop                   ck_fun          imst@   S S
740
741 # Eval.
742
743 require         require                 ck_require      du%     S?
744 dofile          do 'file'               ck_fun          d1      S
745 entereval       eval string             ck_eval         d%      S
746 leaveeval       eval exit               ck_null         1       S
747 #evalonce       eval constant string    ck_null         d1      S
748 entertry        eval block              ck_null         |       
749 leavetry        eval block exit         ck_null         @       
750
751 # Get system info.
752
753 ghbyname        gethostbyname           ck_fun          %       S
754 ghbyaddr        gethostbyaddr           ck_fun          @       S S
755 ghostent        gethostent              ck_null         0       
756 gnbyname        getnetbyname            ck_fun          %       S
757 gnbyaddr        getnetbyaddr            ck_fun          @       S S
758 gnetent         getnetent               ck_null         0       
759 gpbyname        getprotobyname          ck_fun          %       S
760 gpbynumber      getprotobynumber        ck_fun          @       S
761 gprotoent       getprotoent             ck_null         0       
762 gsbyname        getservbyname           ck_fun          @       S S
763 gsbyport        getservbyport           ck_fun          @       S S
764 gservent        getservent              ck_null         0       
765 shostent        sethostent              ck_fun          is%     S
766 snetent         setnetent               ck_fun          is%     S
767 sprotoent       setprotoent             ck_fun          is%     S
768 sservent        setservent              ck_fun          is%     S
769 ehostent        endhostent              ck_null         is0     
770 enetent         endnetent               ck_null         is0     
771 eprotoent       endprotoent             ck_null         is0     
772 eservent        endservent              ck_null         is0     
773 gpwnam          getpwnam                ck_fun          %       S
774 gpwuid          getpwuid                ck_fun          %       S
775 gpwent          getpwent                ck_null         0       
776 spwent          setpwent                ck_null         is0     
777 epwent          endpwent                ck_null         is0     
778 ggrnam          getgrnam                ck_fun          %       S
779 ggrgid          getgrgid                ck_fun          %       S
780 ggrent          getgrent                ck_null         0       
781 sgrent          setgrent                ck_null         is0     
782 egrent          endgrent                ck_null         is0     
783 getlogin        getlogin                ck_null         st0     
784
785 # Miscellaneous.
786
787 syscall         syscall                 ck_fun          imst@   S L
788
789 # For multi-threading
790 lock            lock                    ck_rfun         s%      S
791 threadsv        per-thread variable     ck_null         ds0
792
793 # Control (contd.)
794 setstate        set statement info      ck_null         s;
795 method_named    method with known name  ck_null         d$