3 open(OC, ">opcode.h") || die "Can't create opcode.h: $!\n";
12 ($key, $desc, $check, $flags, $args) = split(/\t+/, $_, 5);
14 warn qq[Description "$desc" duplicates $seen{$desc}\n] if $seen{$desc};
15 die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
16 $seen{$desc} = qq[description of opcode "$key"];
17 $seen{$key} = qq[opcode "$key"];
21 $check{$key} = $check;
23 $flags{$key} = $flags;
31 #define pp_i_preinc pp_preinc
32 #define pp_i_predec pp_predec
33 #define pp_i_postinc pp_postinc
34 #define pp_i_postdec pp_postdec
39 print "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
41 print "\t", &tab(3,"OP_max"), "\n";
43 print "\n#define MAXO ", scalar @ops, "\n\n";
45 # Emit op names and descriptions.
51 EXT char *op_name[] = {
68 EXT char *op_desc[] = {
72 print qq(\t"$desc{$_}",\n);
81 # Emit function declarations.
83 for (sort keys %ckname) {
84 print "OP *\t", &tab(3,$_),"_((OP* op));\n";
90 print "OP *\t", &tab(3, "pp_\L$_"), "_((void));\n";
93 # Emit ppcode switch array.
98 EXT OP * (*ppaddr[])();
100 EXT OP * (*ppaddr[])() = {
104 print "\tpp_\L$_,\n";
113 # Emit check routines.
117 EXT OP * (*check[])();
119 EXT OP * (*check[])() = {
123 print "\t", &tab(3, "$check{$_},"), "/* \L$_ */\n";
132 # Emit allowed argument types.
148 R, 7, # scalar reference
154 $argsum |= 1 if $flags =~ /m/; # needs stack mark
155 $argsum |= 2 if $flags =~ /f/; # fold constants
156 $argsum |= 4 if $flags =~ /s/; # always produces scalar
157 $argsum |= 8 if $flags =~ /t/; # needs target scalar
158 $argsum |= 16 if $flags =~ /i/; # always produces integer
159 $argsum |= 32 if $flags =~ /I/; # has corresponding int op
160 $argsum |= 64 if $flags =~ /d/; # danger, unknown side effects
161 $argsum |= 128 if $flags =~ /u/; # defaults to $_
163 for $arg (split(' ',$args{$_})) {
164 $argnum = ($arg =~ s/\?//) ? 8 : 0;
165 $argnum += $argnum{$arg};
166 $argsum += $argnum * $mul;
169 $argsum = sprintf("0x%08x", $argsum);
170 print "\t", &tab(3, "$argsum,"), "/* \L$_ */\n";
178 ###########################################################################
181 $t .= "\t" x ($l - (length($t) + 1) / 8);
184 ###########################################################################
189 null null operation ck_null 0
191 scalar scalar ck_fun s S
195 pushmark pushmark ck_null s
196 wantarray wantarray ck_null is
198 const constant item ck_svconst s
200 gvsv scalar variable ck_null ds
201 gv glob value ck_null ds
202 gelem glob elem ck_null d S S
203 padsv private variable ck_null ds
204 padav private array ck_null d
205 padhv private hash ck_null d
206 padany private something ck_null d
208 pushre push regexp ck_null 0
210 # References and stuff.
212 rv2gv ref-to-glob cast ck_rvconst ds
213 rv2sv scalar deref ck_rvconst ds
214 av2arylen array length ck_null is
215 rv2cv subroutine deref ck_rvconst d
216 anoncode anonymous subroutine ck_null 0
217 prototype subroutine prototype ck_null s S
218 refgen reference constructor ck_spair m L
219 srefgen scalar ref constructor ck_null fs S
220 ref reference-type operator ck_fun stu S?
221 bless bless ck_fun s S S?
225 backtick backticks ck_null t
226 glob glob ck_glob t S S
227 readline <HANDLE> ck_null t
228 rcatline append I/O operator ck_null t
230 # Bindable operators.
232 regcmaybe regexp comp once ck_fun s S
233 regcomp regexp compilation ck_null s S
234 match pattern match ck_match d
235 subst substitution ck_null dis S
236 substcont substitution cont ck_null dis
237 trans character translation ck_null is S
241 sassign scalar assignment ck_null s
242 aassign list assignment ck_null t L L
244 chop chop ck_spair mts L
245 schop scalar chop ck_null stu S?
246 chomp safe chop ck_spair mts L
247 schomp scalar safe chop ck_null stu S?
248 defined defined operator ck_rfun isu S?
249 undef undef operator ck_lfun s S?
250 study study ck_fun su S?
251 pos match position ck_lfun stu S?
253 preinc preincrement ck_lfun dIs S
254 i_preinc integer preincrement ck_lfun dis S
255 predec predecrement ck_lfun dIs S
256 i_predec integer predecrement ck_lfun dis S
257 postinc postincrement ck_lfun dIst S
258 i_postinc integer postincrement ck_lfun dist S
259 postdec postdecrement ck_lfun dIst S
260 i_postdec integer postdecrement ck_lfun dist S
262 # Ordinary operators.
264 pow exponentiation ck_null fst S S
266 multiply multiplication ck_null Ifst S S
267 i_multiply integer multiplication ck_null ifst S S
268 divide division ck_null Ifst S S
269 i_divide integer division ck_null ifst S S
270 modulo modulus ck_null Iifst S S
271 i_modulo integer modulus ck_null ifst S S
272 repeat repeat ck_repeat mt L S
274 add addition ck_null Ifst S S
275 i_add integer addition ck_null ifst S S
276 subtract subtraction ck_null Ifst S S
277 i_subtract integer subtraction ck_null ifst S S
278 concat concatenation ck_concat fst S S
279 stringify string ck_fun fst S
281 left_shift left bitshift ck_null ifst S S
282 right_shift right bitshift ck_null ifst S S
284 lt numeric lt ck_null Iifs S S
285 i_lt integer lt ck_null ifs S S
286 gt numeric gt ck_null Iifs S S
287 i_gt integer gt ck_null ifs S S
288 le numeric le ck_null Iifs S S
289 i_le integer le ck_null ifs S S
290 ge numeric ge ck_null Iifs S S
291 i_ge integer ge ck_null ifs S S
292 eq numeric eq ck_null Iifs S S
293 i_eq integer eq ck_null ifs S S
294 ne numeric ne ck_null Iifs S S
295 i_ne integer ne ck_null ifs S S
296 ncmp spaceship operator ck_null Iifst S S
297 i_ncmp integer spaceship ck_null ifst S S
299 slt string lt ck_null ifs S S
300 sgt string gt ck_null ifs S S
301 sle string le ck_null ifs S S
302 sge string ge ck_null ifs S S
303 seq string eq ck_null ifs S S
304 sne string ne ck_null ifs S S
305 scmp string comparison ck_null ifst S S
307 bit_and bitwise and ck_null fst S S
308 bit_xor bitwise xor ck_null fst S S
309 bit_or bitwise or ck_null fst S S
311 negate negate ck_null Ifst S
312 i_negate integer negate ck_null ifst S
313 not not ck_null ifs S
314 complement 1's complement ck_null fst S
316 # High falutin' math.
318 atan2 atan2 ck_fun fst S S
319 sin sin ck_fun fstu S?
320 cos cos ck_fun fstu S?
321 rand rand ck_fun st S?
322 srand srand ck_fun s S?
323 exp exp ck_fun fstu S?
324 log log ck_fun fstu S?
325 sqrt sqrt ck_fun fstu S?
327 int int ck_fun fstu S?
328 hex hex ck_fun istu S?
329 oct oct ck_fun istu S?
330 abs abs ck_fun fstu S?
334 length length ck_lengthconst istu S?
335 substr substr ck_fun st S S S?
336 vec vec ck_fun ist S S S
338 index index ck_index ist S S S?
339 rindex rindex ck_index ist S S S?
341 sprintf sprintf ck_fun mst S L
342 formline formline ck_formline ms S L
343 ord ord ck_fun ifstu S?
344 chr chr ck_fun fstu S?
345 crypt crypt ck_fun fst S S
346 ucfirst upper case first ck_fun fst S
347 lcfirst lower case first ck_fun fst S
348 uc upper case ck_fun fst S
349 lc lower case ck_fun fst S
350 quotemeta quote metachars ck_fun fst S
354 rv2av array deref ck_rvconst dt
355 aelemfast known array element ck_null s A S
356 aelem array element ck_null s A S
357 aslice array slice ck_null m A L
359 # Associative arrays.
362 values values ck_fun t H
364 delete delete ck_delete s S
365 exists exists operator ck_delete is S
366 rv2hv associative array deref ck_rvconst dt
367 helem associative array elem ck_null s H S
368 hslice associative array slice ck_null m H L
370 # Explosives and implosives.
372 unpack unpack ck_fun 0 S S
373 pack pack ck_fun mst S L
374 split split ck_split t S S S
375 join join ck_fun mst S L
379 list list ck_null m L
380 lslice list slice ck_null 0 H L L
381 anonlist anonymous list ck_fun ms L
382 anonhash anonymous hash ck_fun ms L
384 splice splice ck_fun m A S? S? L
385 push push ck_fun imst A L
387 shift shift ck_shift s A
388 unshift unshift ck_fun imst A L
389 sort sort ck_sort m C? L
390 reverse reverse ck_fun mt L
392 grepstart grep ck_grep dm C L
393 grepwhile grep iterator ck_null dt
395 mapstart map ck_grep dm C L
396 mapwhile map iterator ck_null dt
400 range flipflop ck_null 0 S S
401 flip range (or flip) ck_null 0 S S
402 flop range (or flop) ck_null 0
406 and logical and ck_null 0
407 or logical or ck_null 0
408 xor logical xor ck_null fs S S
409 cond_expr conditional expression ck_null d
410 andassign logical and assignment ck_null s
411 orassign logical or assignment ck_null s
413 method method lookup ck_null d
414 entersub subroutine entry ck_subr dmt L
415 leavesub subroutine exit ck_null 0
416 caller caller ck_fun t S?
417 warn warn ck_fun imst L
418 die die ck_fun dimst L
419 reset reset ck_fun is S?
421 lineseq line sequence ck_null 0
422 nextstate next statement ck_null s
423 dbstate debug next statement ck_null s
424 unstack unstack ck_null s
425 enter block entry ck_null 0
426 leave block exit ck_null 0
427 scope block ck_null 0
428 enteriter foreach loop entry ck_null d
429 iter foreach loop iterator ck_null 0
430 enterloop loop entry ck_null d
431 leaveloop loop exit ck_null 0
432 return return ck_null dm L
438 exit exit ck_fun ds S?
440 #nswitch numeric switch ck_null d
441 #cswitch character switch ck_null d
445 open open ck_fun ist F S?
446 close close ck_fun is F?
447 pipe_op pipe ck_fun is F F
449 fileno fileno ck_fun ist F
450 umask umask ck_fun ist S?
451 binmode binmode ck_fun s F
453 tie tie ck_fun idms R S L
454 untie untie ck_fun is R
456 dbmopen dbmopen ck_fun is H S S
457 dbmclose dbmclose ck_fun is H
459 sselect select system call ck_select t S S S S
460 select select ck_select st F?
462 getc getc ck_eof st F?
463 read read ck_fun imst F R S S?
464 enterwrite write ck_fun dis F?
465 leavewrite write exit ck_null 0
467 prtf printf ck_listiob ims F? L
468 print print ck_listiob ims F? L
470 sysopen sysopen ck_fun s F S S S?
471 sysread sysread ck_fun imst F R S S?
472 syswrite syswrite ck_fun imst F S S S?
474 send send ck_fun imst F S S S?
475 recv recv ck_fun imst F R S S
478 tell tell ck_fun st F?
479 seek seek ck_fun s F S S
480 truncate truncate ck_trunc is F S
482 fcntl fcntl ck_fun st F S S
483 ioctl ioctl ck_fun st F S S
484 flock flock ck_fun ist F S
488 socket socket ck_fun is F S S S
489 sockpair socketpair ck_fun is F F S S S
491 bind bind ck_fun is F S
492 connect connect ck_fun is F S
493 listen listen ck_fun is F S
494 accept accept ck_fun ist F F
495 shutdown shutdown ck_fun ist F S
497 gsockopt getsockopt ck_fun is F S S
498 ssockopt setsockopt ck_fun is F S S S
500 getsockname getsockname ck_fun is F
501 getpeername getpeername ck_fun is F
505 lstat lstat ck_ftst u F
506 stat stat ck_ftst u F
507 ftrread -R ck_ftst isu F
508 ftrwrite -W ck_ftst isu F
509 ftrexec -X ck_ftst isu F
510 fteread -r ck_ftst isu F
511 ftewrite -w ck_ftst isu F
512 fteexec -x ck_ftst isu F
513 ftis -e ck_ftst isu F
514 fteowned -O ck_ftst isu F
515 ftrowned -o ck_ftst isu F
516 ftzero -z ck_ftst isu F
517 ftsize -s ck_ftst istu F
518 ftmtime -M ck_ftst stu F
519 ftatime -A ck_ftst stu F
520 ftctime -C ck_ftst stu F
521 ftsock -S ck_ftst isu F
522 ftchr -c ck_ftst isu F
523 ftblk -b ck_ftst isu F
524 ftfile -f ck_ftst isu F
525 ftdir -d ck_ftst isu F
526 ftpipe -p ck_ftst isu F
527 ftlink -l ck_ftst isu F
528 ftsuid -u ck_ftst isu F
529 ftsgid -g ck_ftst isu F
530 ftsvtx -k ck_ftst isu F
531 fttty -t ck_ftst is F
532 fttext -T ck_ftst isu F
533 ftbinary -B ck_ftst isu F
537 chdir chdir ck_fun ist S?
538 chown chown ck_fun imst L
539 chroot chroot ck_fun istu S?
540 unlink unlink ck_fun imstu L
541 chmod chmod ck_fun imst L
542 utime utime ck_fun imst L
543 rename rename ck_fun ist S S
544 link link ck_fun ist S S
545 symlink symlink ck_fun ist S S
546 readlink readlink ck_fun stu S?
547 mkdir mkdir ck_fun ist S S
548 rmdir rmdir ck_fun istu S?
552 open_dir opendir ck_fun is F S
553 readdir readdir ck_fun 0 F
554 telldir telldir ck_fun st F
555 seekdir seekdir ck_fun s F S
556 rewinddir rewinddir ck_fun s F
557 closedir closedir ck_fun is F
561 fork fork ck_null ist
562 wait wait ck_null ist
563 waitpid waitpid ck_fun ist S S
564 system system ck_exec imst S? L
565 exec exec ck_exec dimst S? L
566 kill kill ck_fun dimst L
567 getppid getppid ck_null ist
568 getpgrp getpgrp ck_fun ist S?
569 setpgrp setpgrp ck_fun ist S? S?
570 getpriority getpriority ck_fun ist S S
571 setpriority setpriority ck_fun ist S S S
575 time time ck_null ist
577 localtime localtime ck_fun t S?
578 gmtime gmtime ck_fun t S?
579 alarm alarm ck_fun istu S?
580 sleep sleep ck_fun ist S?
584 shmget shmget ck_fun imst S S S
585 shmctl shmctl ck_fun imst S S S
586 shmread shmread ck_fun imst S S S S
587 shmwrite shmwrite ck_fun imst S S S S
591 msgget msgget ck_fun imst S S
592 msgctl msgctl ck_fun imst S S S
593 msgsnd msgsnd ck_fun imst S S S
594 msgrcv msgrcv ck_fun imst S S S S S
598 semget semget ck_fun imst S S S
599 semctl semctl ck_fun imst S S S S
600 semop semop ck_fun imst S S
604 require require ck_require du S?
605 dofile do 'file' ck_fun d S
606 entereval eval string ck_eval d S
607 leaveeval eval exit ck_null 0 S
608 #evalonce eval constant string ck_null d S
609 entertry eval block ck_null 0
610 leavetry eval block exit ck_null 0
614 ghbyname gethostbyname ck_fun 0 S
615 ghbyaddr gethostbyaddr ck_fun 0 S S
616 ghostent gethostent ck_null 0
617 gnbyname getnetbyname ck_fun 0 S
618 gnbyaddr getnetbyaddr ck_fun 0 S S
619 gnetent getnetent ck_null 0
620 gpbyname getprotobyname ck_fun 0 S
621 gpbynumber getprotobynumber ck_fun 0 S
622 gprotoent getprotoent ck_null 0
623 gsbyname getservbyname ck_fun 0 S S
624 gsbyport getservbyport ck_fun 0 S S
625 gservent getservent ck_null 0
626 shostent sethostent ck_fun is S
627 snetent setnetent ck_fun is S
628 sprotoent setprotoent ck_fun is S
629 sservent setservent ck_fun is S
630 ehostent endhostent ck_null is
631 enetent endnetent ck_null is
632 eprotoent endprotoent ck_null is
633 eservent endservent ck_null is
634 gpwnam getpwnam ck_fun 0 S
635 gpwuid getpwuid ck_fun 0 S
636 gpwent getpwent ck_null 0
637 spwent setpwent ck_null is
638 epwent endpwent ck_null is
639 ggrnam getgrnam ck_fun 0 S
640 ggrgid getgrgid ck_fun 0 S
641 ggrent getgrent ck_null 0
642 sgrent setgrent ck_null is
643 egrent endgrent ck_null is
644 getlogin getlogin ck_null st
648 syscall syscall ck_fun imst S L