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