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