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