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