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