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