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