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