3 open(OC, ">opcode.h") || die "Can't create opcode.h: $!\n";
12 ($key, $name, $check, $flags, $args) = split(/\t+/, $_, 5);
15 $check{$key} = $check;
17 $flags{$key} = $flags;
25 #define pp_i_preinc pp_preinc
26 #define pp_i_predec pp_predec
27 #define pp_i_postinc pp_postinc
28 #define pp_i_postdec pp_postdec
33 print "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
35 print "\t", &tab(3,"OP_max"), "\n";
37 print "\n#define MAXO ", scalar @ops, "\n\n";
45 EXT char *op_name[] = {
49 print qq(\t"$name{$_}",\n);
58 # Emit function declarations.
60 for (sort keys %ckname) {
61 print "OP *\t", &tab(3,$_),"_((OP* op));\n";
67 print "OP *\t", &tab(3, "pp_\L$_"), "_((void));\n";
70 # Emit ppcode switch array.
75 EXT OP * (*ppaddr[])();
77 EXT OP * (*ppaddr[])() = {
90 # Emit check routines.
94 EXT OP * (*check[])();
96 EXT OP * (*check[])() = {
100 print "\t", &tab(3, "$check{$_},"), "/* \L$_ */\n";
109 # Emit allowed argument types.
125 R, 7, # scalar reference
131 $argsum |= 1 if $flags =~ /m/; # needs stack mark
132 $argsum |= 2 if $flags =~ /f/; # fold constants
133 $argsum |= 4 if $flags =~ /s/; # always produces scalar
134 $argsum |= 8 if $flags =~ /t/; # needs target scalar
135 $argsum |= 16 if $flags =~ /i/; # always produces integer
136 $argsum |= 32 if $flags =~ /I/; # has corresponding int op
137 $argsum |= 64 if $flags =~ /d/; # danger, unknown side effects
138 $argsum |= 128 if $flags =~ /u/; # defaults to $_
140 for $arg (split(' ',$args{$_})) {
141 $argnum = ($arg =~ s/\?//) ? 8 : 0;
142 $argnum += $argnum{$arg};
143 $argsum += $argnum * $mul;
146 $argsum = sprintf("0x%08x", $argsum);
147 print "\t", &tab(3, "$argsum,"), "/* \L$_ */\n";
155 ###########################################################################
158 $t .= "\t" x ($l - (length($t) + 1) / 8);
161 ###########################################################################
166 null null operation ck_null 0
168 scalar scalar ck_fun s S
172 pushmark pushmark ck_null s
173 wantarray wantarray ck_null is
175 const constant item ck_svconst s
177 gvsv scalar variable ck_null ds
178 gv glob value ck_null ds
179 padsv private variable ck_null ds
180 padav private array ck_null d
181 padhv private hash ck_null d
182 padany private something ck_null d
184 pushre push regexp ck_null 0
186 # References and stuff.
188 rv2gv ref-to-glob cast ck_rvconst ds
189 sv2len scalar value length ck_null ist
190 rv2sv scalar deref ck_rvconst ds
191 av2arylen array length ck_null is
192 rv2cv subroutine deref ck_rvconst d
193 anoncode anonymous subroutine ck_null 0
194 refgen reference constructor ck_spair m L
195 srefgen scalar ref constructor ck_null fs S
196 ref reference-type operator ck_fun stu S?
197 bless bless ck_fun s S S?
201 backtick backticks ck_null t
202 glob glob ck_glob t S S
203 readline <HANDLE> ck_null t
204 rcatline append I/O operator ck_null t
206 # Bindable operators.
208 regcmaybe regexp comp once ck_fun s S
209 regcomp regexp compilation ck_null s S
210 match pattern match ck_match d
211 subst substitution ck_null dis S
212 substcont substitution cont ck_null dis
213 trans character translation ck_null is S
217 sassign scalar assignment ck_null s
218 aassign list assignment ck_null t L L
220 chop chop ck_spair mts L
221 schop scalar chop ck_null stu S?
222 chomp safe chop ck_spair mts L
223 schomp scalar safe chop ck_null stu S?
224 defined defined operator ck_rfun isu S?
225 undef undef operator ck_lfun s S?
226 study study ck_fun stu S?
227 pos match position ck_lfun stu S?
229 preinc preincrement ck_lfun dIs S
230 i_preinc integer preincrement ck_lfun dis S
231 predec predecrement ck_lfun dIs S
232 i_predec integer predecrement ck_lfun dis S
233 postinc postincrement ck_lfun dIst S
234 i_postinc integer postincrement ck_lfun dist S
235 postdec postdecrement ck_lfun dIst S
236 i_postdec integer postdecrement ck_lfun dist S
238 # Ordinary operators.
240 pow exponentiation ck_null fst S S
242 multiply multiplication ck_null Ifst S S
243 i_multiply integer multiplication ck_null ifst S S
244 divide division ck_null Ifst S S
245 i_divide integer division ck_null ifst S S
246 modulo modulus ck_null Iifst S S
247 i_modulo integer modulus ck_null ifst S S
248 repeat repeat ck_repeat mt L S
250 add addition ck_null Ifst S S
251 i_add integer addition ck_null ifst S S
252 subtract subtraction ck_null Ifst S S
253 i_subtract integer subtraction ck_null ifst S S
254 concat concatenation ck_concat fst S S
255 stringify string ck_fun fst S
257 left_shift left bitshift ck_null ifst S S
258 right_shift right bitshift ck_null ifst S S
260 lt numeric lt ck_null Iifs S S
261 i_lt integer lt ck_null ifs S S
262 gt numeric gt ck_null Iifs S S
263 i_gt integer gt ck_null ifs S S
264 le numeric le ck_null Iifs S S
265 i_le integer le ck_null ifs S S
266 ge numeric ge ck_null Iifs S S
267 i_ge integer ge ck_null ifs S S
268 eq numeric eq ck_null Iifs S S
269 i_eq integer eq ck_null ifs S S
270 ne numeric ne ck_null Iifs S S
271 i_ne integer ne ck_null ifs S S
272 ncmp spaceship operator ck_null Iifst S S
273 i_ncmp integer spaceship ck_null ifst S S
275 slt string lt ck_null ifs S S
276 sgt string gt ck_null ifs S S
277 sle string le ck_null ifs S S
278 sge string ge ck_null ifs S S
279 seq string eq ck_null ifs S S
280 sne string ne ck_null ifs S S
281 scmp string comparison ck_null ifst S S
283 bit_and bitwise and ck_null fst S S
284 bit_xor bitwise xor ck_null fst S S
285 bit_or bitwise or ck_null fst S S
287 negate negate ck_null Ifst S
288 i_negate integer negate ck_null ifst S
289 not not ck_null ifs S
290 complement 1's complement ck_null fst S
292 # High falutin' math.
294 atan2 atan2 ck_fun fst S S
295 sin sin ck_fun fstu S?
296 cos cos ck_fun fstu S?
297 rand rand ck_fun st S?
298 srand srand ck_fun s S?
299 exp exp ck_fun fstu S?
300 log log ck_fun fstu S?
301 sqrt sqrt ck_fun fstu S?
303 int int ck_fun fstu S?
304 hex hex ck_fun istu S?
305 oct oct ck_fun istu S?
306 abs abs ck_fun fstu S?
310 length length ck_lengthconst istu S?
311 substr substr ck_fun st S S S?
312 vec vec ck_fun ist S S S
314 index index ck_index ist S S S?
315 rindex rindex ck_index ist S S S?
317 sprintf sprintf ck_fun mst S L
318 formline formline ck_formline ms S L
319 ord ord ck_fun ifstu S?
320 chr chr ck_fun fstu S?
321 crypt crypt ck_fun fst S S
322 ucfirst upper case first ck_fun fst S
323 lcfirst lower case first ck_fun fst S
324 uc upper case ck_fun fst S
325 lc lower case ck_fun fst S
326 quotemeta quote metachars ck_fun fst S
330 rv2av array deref ck_rvconst dt
331 aelemfast known array element ck_null s A S
332 aelem array element ck_null s A S
333 aslice array slice ck_null m A L
335 # Associative arrays.
338 values values ck_fun t H
340 delete delete ck_delete s S
341 exists exists operator ck_delete is S
342 rv2hv associative array deref ck_rvconst dt
343 helem associative array elem ck_null s H S
344 hslice associative array slice ck_null m H L
346 # Explosives and implosives.
348 unpack unpack ck_fun 0 S S
349 pack pack ck_fun mst S L
350 split split ck_split t S S S
351 join join ck_fun mst S L
355 list list ck_null m L
356 lslice list slice ck_null 0 H L L
357 anonlist anonymous list ck_fun ms L
358 anonhash anonymous hash ck_fun ms L
360 splice splice ck_fun m A S? S? L
361 push push ck_fun imst A L
363 shift shift ck_shift s A
364 unshift unshift ck_fun imst A L
365 sort sort ck_sort m C? L
366 reverse reverse ck_fun mt L
368 grepstart grep ck_grep dm C L
369 grepwhile grep iterator ck_null dt
371 mapstart map ck_grep dm C L
372 mapwhile map iterator ck_null dt
376 range flipflop ck_null 0 S S
377 flip range (or flip) ck_null 0 S S
378 flop range (or flop) ck_null 0
382 and logical and ck_null 0
383 or logical or ck_null 0
384 xor logical xor ck_null fs S S
385 cond_expr conditional expression ck_null d
386 andassign logical and assignment ck_null s
387 orassign logical or assignment ck_null s
389 method method lookup ck_null d
390 entersub subroutine entry ck_subr dmt L
391 leavesub subroutine exit ck_null 0
392 caller caller ck_fun t S?
393 warn warn ck_fun imst L
394 die die ck_fun dimst L
395 reset reset ck_fun is S?
397 lineseq line sequence ck_null 0
398 nextstate next statement ck_null s
399 dbstate debug next statement ck_null s
400 unstack unstack ck_null s
401 enter block entry ck_null 0
402 leave block exit ck_null 0
403 scope block ck_null 0
404 enteriter foreach loop entry ck_null d
405 iter foreach loop iterator ck_null 0
406 enterloop loop entry ck_null d
407 leaveloop loop exit ck_null 0
408 return return ck_null dm L
414 exit exit ck_fun ds S?
416 #nswitch numeric switch ck_null d
417 #cswitch character switch ck_null d
421 open open ck_fun ist F S?
422 close close ck_fun is F?
423 pipe_op pipe ck_fun is F F
425 fileno fileno ck_fun ist F
426 umask umask ck_fun ist S?
427 binmode binmode ck_fun s F
429 tie tie ck_fun idms R S L
430 untie untie ck_fun is R
431 dbmopen dbmopen ck_fun is H S S
432 dbmclose dbmclose ck_fun is H
434 sselect select system call ck_select t S S S S
435 select select ck_select st F?
437 getc getc ck_eof st F?
438 read read ck_fun imst F R S S?
439 enterwrite write ck_fun dis F?
440 leavewrite write exit ck_null 0
442 prtf printf ck_listiob ims F? L
443 print print ck_listiob ims F? L
445 sysread sysread ck_fun imst F R S S?
446 syswrite syswrite ck_fun imst F S S S?
448 send send ck_fun imst F S S S?
449 recv recv ck_fun imst F R S S
452 tell tell ck_fun st F?
453 seek seek ck_fun s F S S
454 truncate truncate ck_trunc is S S
456 fcntl fcntl ck_fun st F S S
457 ioctl ioctl ck_fun st F S S
458 flock flock ck_fun ist F S
462 socket socket ck_fun is F S S S
463 sockpair socketpair ck_fun is F F S S S
465 bind bind ck_fun is F S
466 connect connect ck_fun is F S
467 listen listen ck_fun is F S
468 accept accept ck_fun ist F F
469 shutdown shutdown ck_fun ist F S
471 gsockopt getsockopt ck_fun is F S S
472 ssockopt setsockopt ck_fun is F S S S
474 getsockname getsockname ck_fun is F
475 getpeername getpeername ck_fun is F
479 lstat lstat ck_ftst u F
480 stat stat ck_ftst u F
481 ftrread -R ck_ftst isu F
482 ftrwrite -W ck_ftst isu F
483 ftrexec -X ck_ftst isu F
484 fteread -r ck_ftst isu F
485 ftewrite -w ck_ftst isu F
486 fteexec -x ck_ftst isu F
487 ftis -e ck_ftst isu F
488 fteowned -O ck_ftst isu F
489 ftrowned -o ck_ftst isu F
490 ftzero -z ck_ftst isu F
491 ftsize -s ck_ftst istu F
492 ftmtime -M ck_ftst stu F
493 ftatime -A ck_ftst stu F
494 ftctime -C ck_ftst stu F
495 ftsock -S ck_ftst isu F
496 ftchr -c ck_ftst isu F
497 ftblk -b ck_ftst isu F
498 ftfile -f ck_ftst isu F
499 ftdir -d ck_ftst isu F
500 ftpipe -p ck_ftst isu F
501 ftlink -l ck_ftst isu F
502 ftsuid -u ck_ftst isu F
503 ftsgid -g ck_ftst isu F
504 ftsvtx -k ck_ftst isu F
505 fttty -t ck_ftst is F
506 fttext -T ck_ftst isu F
507 ftbinary -B ck_ftst isu F
511 chdir chdir ck_fun ist S?
512 chown chown ck_fun imst L
513 chroot chroot ck_fun istu S?
514 unlink unlink ck_fun imstu L
515 chmod chmod ck_fun imst L
516 utime utime ck_fun imst L
517 rename rename ck_fun ist S S
518 link link ck_fun ist S S
519 symlink symlink ck_fun ist S S
520 readlink readlink ck_fun stu S?
521 mkdir mkdir ck_fun ist S S
522 rmdir rmdir ck_fun istu S?
526 open_dir opendir ck_fun is F S
527 readdir readdir ck_fun 0 F
528 telldir telldir ck_fun st F
529 seekdir seekdir ck_fun s F S
530 rewinddir rewinddir ck_fun s F
531 closedir closedir ck_fun is F
535 fork fork ck_null ist
536 wait wait ck_null ist
537 waitpid waitpid ck_fun ist S S
538 system system ck_exec imst S? L
539 exec exec ck_exec dimst S? L
540 kill kill ck_fun dimst L
541 getppid getppid ck_null ist
542 getpgrp getpgrp ck_fun ist S?
543 setpgrp setpgrp ck_fun ist S? S?
544 getpriority getpriority ck_fun ist S S
545 setpriority setpriority ck_fun ist S S S
549 time time ck_null ist
551 localtime localtime ck_fun t S?
552 gmtime gmtime ck_fun t S?
553 alarm alarm ck_fun istu S?
554 sleep sleep ck_fun ist S?
558 shmget shmget ck_fun imst S S S
559 shmctl shmctl ck_fun imst S S S
560 shmread shmread ck_fun imst S S S S
561 shmwrite shmwrite ck_fun imst S S S S
565 msgget msgget ck_fun imst S S
566 msgctl msgctl ck_fun imst S S S
567 msgsnd msgsnd ck_fun imst S S S
568 msgrcv msgrcv ck_fun imst S S S S S
572 semget semget ck_fun imst S S S
573 semctl semctl ck_fun imst S S S S
574 semop semop ck_fun imst S S
578 require require ck_require du S?
579 dofile do 'file' ck_fun d S
580 entereval eval string ck_eval d S
581 leaveeval eval exit ck_null 0 S
582 #evalonce eval constant string ck_null d S
583 entertry eval block ck_null 0
584 leavetry eval block exit ck_null 0
588 ghbyname gethostbyname ck_fun 0 S
589 ghbyaddr gethostbyaddr ck_fun 0 S S
590 ghostent gethostent ck_null 0
591 gnbyname getnetbyname ck_fun 0 S
592 gnbyaddr getnetbyaddr ck_fun 0 S S
593 gnetent getnetent ck_null 0
594 gpbyname getprotobyname ck_fun 0 S
595 gpbynumber getprotobynumber ck_fun 0 S
596 gprotoent getprotoent ck_null 0
597 gsbyname getservbyname ck_fun 0 S S
598 gsbyport getservbyport ck_fun 0 S S
599 gservent getservent ck_null 0
600 shostent sethostent ck_fun is S
601 snetent setnetent ck_fun is S
602 sprotoent setprotoent ck_fun is S
603 sservent setservent ck_fun is S
604 ehostent endhostent ck_null is
605 enetent endnetent ck_null is
606 eprotoent endprotoent ck_null is
607 eservent endservent ck_null is
608 gpwnam getpwnam ck_fun 0 S
609 gpwuid getpwuid ck_fun 0 S
610 gpwent getpwent ck_null 0
611 spwent setpwent ck_null is
612 epwent endpwent ck_null is
613 ggrnam getgrnam ck_fun 0 S
614 ggrgid getgrgid ck_fun 0 S
615 ggrent getgrent ck_null 0
616 sgrent setgrent ck_null is
617 egrent endgrent ck_null is
618 getlogin getlogin ck_null st
622 syscall syscall ck_fun imst S L