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