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