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