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