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