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