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