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