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;
24 print "typedef enum {\n";
26 print "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
29 print "\n#define MAXO ", scalar @ops, "\n\n";
35 extern char *op_name[];
41 print qq(\t"$name{$_}",\n);
50 # Emit function declarations.
52 for (sort keys %ckname) {
53 print "OP *\t", &tab(3,$_),"P((OP* op));\n";
59 print "OP *\t", &tab(3, "pp_\L$_"), "P((void));\n";
62 # Emit ppcode switch array.
67 extern OP * (*ppaddr[])();
69 OP * (*ppaddr[])() = {
82 # Emit check routines.
86 extern OP * (*check[])();
92 print "\t", &tab(3, "$check{$_},"), "/* \L$_ */\n";
101 # Emit allowed argument types.
117 R, 7, # scalar reference
123 $argsum |= 1 if $flags =~ /m/; # needs stack mark
124 $argsum |= 2 if $flags =~ /f/; # fold constants
125 $argsum |= 4 if $flags =~ /s/; # always produces scalar
126 $argsum |= 8 if $flags =~ /t/; # needs target scalar
127 $argsum |= 16 if $flags =~ /i/; # always produces integer
128 $argsum |= 32 if $flags =~ /I/; # has corresponding int op
129 $argsum |= 64 if $flags =~ /d/; # danger, unknown side effects
131 for $arg (split(' ',$args{$_})) {
132 $argnum = ($arg =~ s/\?//) ? 8 : 0;
133 $argnum += $argnum{$arg};
134 $argsum += $argnum * $mul;
137 $argsum = sprintf("0x%08x", $argsum);
138 print "\t", &tab(3, "$argsum,"), "/* \L$_ */\n";
146 ###########################################################################
149 $t .= "\t" x ($l - (length($t) + 1) / 8);
152 ###########################################################################
157 null null operation ck_null 0
159 scalar scalar ck_fun s S
163 pushmark pushmark ck_null s
164 wantarray wantarray ck_null is
166 const constant item ck_null s
167 interp interpreted string ck_null 0
169 gvsv scalar variable ck_null ds
170 gv glob value ck_null ds
171 padsv private variable ck_null 0
172 padav private array ck_null 0
173 padhv private hash ck_null 0
175 pushre push regexp ck_null 0
177 # References and stuff.
179 rv2gv ref-to-glob cast ck_rvconst ds
180 sv2len scalar value length ck_null ist
181 rv2sv ref-to-scalar cast ck_rvconst ds
182 av2arylen array length ck_null is
183 rv2cv subroutine reference ck_rvconst d
184 refgen backslash reference ck_null fst L
185 ref reference-type operator ck_fun st S?
186 bless bless ck_fun s S S?
190 backtick backticks ck_null t
192 readline <HANDLE> ck_null t
193 rcatline append I/O operator ck_null t
195 # Bindable operators.
197 regcmaybe regexp comp once ck_fun s S
198 regcomp regexp compilation ck_null s S
199 match pattern match ck_match d
200 subst substitution ck_null dis S
201 substcont substitution cont ck_null dis
202 trans character translation ck_null is S
206 sassign scalar assignment ck_null s
207 aassign list assignment ck_null t L L
209 schop scalar chop ck_null t
210 chop chop ck_chop mt L
211 defined defined operator ck_lfun is S?
212 undef undef operator ck_lfun s S?
213 study study ck_fun st S?
215 preinc preincrement ck_lfun s S
216 predec predecrement ck_lfun s S
217 postinc postincrement ck_lfun st S
218 postdec postdecrement ck_lfun st S
220 # Ordinary operators.
222 pow exponentiation ck_null fst S S
224 multiply multiplication ck_null fst S S
225 divide division ck_null fst S S
226 modulo modulus ck_null ifst S S
227 repeat repeat ck_repeat mt L S
229 add addition ck_null Ifst S S
230 intadd integer addition ck_null ifst S S
231 subtract subtraction ck_null fst S S
232 concat concatenation ck_concat fst S S
234 left_shift left bitshift ck_null ifst S S
235 right_shift right bitshift ck_null ifst S S
237 lt numeric lt ck_null ifs S S
238 gt numeric gt ck_null ifs S S
239 le numeric le ck_null ifs S S
240 ge numeric ge ck_null ifs S S
241 eq numeric eq ck_null ifs S S
242 ne numeric ne ck_null ifs S S
243 ncmp spaceship ck_null ifst S S
245 slt string lt ck_null ifs S S
246 sgt string gt ck_null ifs S S
247 sle string le ck_null ifs S S
248 sge string ge ck_null ifs S S
249 seq string eq ck_null ifs S S
250 sne string ne ck_null ifs S S
251 scmp string comparison ck_null ifst S S
253 bit_and bit and ck_null fst S S
254 xor xor ck_null fst S S
255 bit_or bit or ck_null fst S S
257 negate negate ck_null fst S
258 not not ck_null ifs S
259 complement 1's complement ck_null fst S
261 # High falutin' math.
263 atan2 atan2 ck_fun fst S S
264 sin sin ck_fun fst S?
265 cos cos ck_fun fst S?
266 rand rand ck_fun st S?
267 srand srand ck_fun s S?
268 exp exp ck_fun fst S?
269 log log ck_fun fst S?
270 sqrt sqrt ck_fun fst S?
272 int int ck_fun fst S?
273 hex hex ck_fun ist S?
274 oct oct ck_fun ist S?
275 abs abs ck_fun fst S?
279 length length ck_lengthconst ist S
280 substr substr ck_fun st S S S?
281 vec vec ck_fun ist S S S
283 index index ck_index ist S S S?
284 rindex rindex ck_index ist S S S?
286 sprintf sprintf ck_fun mst S L
287 formline formline ck_formline ms S L
288 ord ord ck_fun ifst S?
289 chr chr ck_fun fst S?
290 crypt crypt ck_fun fst S S
291 ucfirst upper case first ck_fun ft S
292 lcfirst lower case first ck_fun ft S
293 uc upper case ck_fun ft S
294 lc lower case ck_fun ft S
298 rv2av array deref ck_rvconst dt
299 aelemfast known array element ck_null s A S
300 aelem array element ck_aelem s A S
301 aslice array slice ck_null m A L
303 # Associative arrays.
306 values values ck_fun t H
308 delete delete ck_null s H S
309 rv2hv associative array deref ck_rvconst dt
310 helem associative array elem ck_null s H S
311 hslice associative array slice ck_null m H L
313 # Explosives and implosives.
315 unpack unpack ck_fun 0 S S
316 pack pack ck_fun mst S L
317 split split ck_split t S S S
318 join join ck_fun mst S L
322 list list ck_null m L
323 lslice list slice ck_null 0 H L L
324 anonlist anonymous list ck_null m L
325 anonhash anonymous hash ck_null m L
327 splice splice ck_fun m A S S? L
328 push push ck_fun imst A L
330 shift shift ck_shift s A
331 unshift unshift ck_fun imst A L
332 sort sort ck_sort m C? L
333 reverse reverse ck_fun mt L
335 grepstart grep ck_grep dm C L
336 grepwhile grep iterator ck_null dt
340 range flipflop ck_null 0 S S
341 flip range (or flip) ck_null 0 S S
342 flop range (or flop) ck_null 0
346 and logical and ck_null 0
347 or logical or ck_null 0
348 cond_expr conditional expression ck_null 0
349 andassign logical and assignment ck_null s
350 orassign logical or assignment ck_null s
352 method method lookup ck_null d
353 entersubr subroutine entry ck_subr dm L
354 leavesubr subroutine exit ck_null 0
355 caller caller ck_fun t S?
356 warn warn ck_fun imst L
357 die die ck_fun dimst L
358 reset reset ck_fun is S?
360 lineseq line sequence ck_null 0
361 nextstate next statement ck_null s
362 dbstate debug next statement ck_null s
363 unstack unstack ck_null s
364 enter block entry ck_null 0
365 leave block exit ck_null 0
366 scope block ck_null 0
367 enteriter foreach loop entry ck_null d
368 iter foreach loop iterator ck_null 0
369 enterloop loop entry ck_null d
370 leaveloop loop exit ck_null s
371 return return ck_fun dm L
377 exit exit ck_fun ds S?
379 nswitch numeric switch ck_null d
380 cswitch character switch ck_null d
384 open open ck_fun ist F S?
385 close close ck_fun is F?
386 pipe_op pipe ck_fun is F F
388 fileno fileno ck_fun ist F
389 umask umask ck_fun ist S?
390 binmode binmode ck_fun s F
392 tie tie ck_fun idms R S L
393 untie untie ck_fun is R
394 dbmopen dbmopen ck_fun is H S S
395 dbmclose dbmclose ck_fun is H
397 sselect select system call ck_select t S S S S
398 select select ck_select st F?
400 getc getc ck_eof st F?
401 read read ck_fun imst F R S S?
402 enterwrite write ck_fun dis F?
403 leavewrite write exit ck_null 0
405 prtf printf ck_listiob ims F? L
406 print print ck_listiob ims F? L
408 sysread sysread ck_fun imst F R S S?
409 syswrite syswrite ck_fun imst F S S S?
411 send send ck_fun imst F S S S?
412 recv recv ck_fun imst F R S S
415 tell tell ck_fun st F?
416 seek seek ck_fun s F S S
417 truncate truncate ck_trunc is S S
419 fcntl fcntl ck_fun st F S S
420 ioctl ioctl ck_fun st F S S
421 flock flock ck_fun ist F S
425 socket socket ck_fun is F S S S
426 sockpair socketpair ck_fun is F F S S S
428 bind bind ck_fun is F S
429 connect connect ck_fun is F S
430 listen listen ck_fun is F S
431 accept accept ck_fun ist F F
432 shutdown shutdown ck_fun ist F S
434 gsockopt getsockopt ck_fun is F S S
435 ssockopt setsockopt ck_fun is F S S S
437 getsockname getsockname ck_fun is F
438 getpeername getpeername ck_fun is F
442 lstat lstat ck_ftst 0 F
443 stat stat ck_ftst 0 F
444 ftrread -R ck_ftst is F
445 ftrwrite -W ck_ftst is F
446 ftrexec -X ck_ftst is F
447 fteread -r ck_ftst is F
448 ftewrite -w ck_ftst is F
449 fteexec -x ck_ftst is F
451 fteowned -O ck_ftst is F
452 ftrowned -o ck_ftst is F
453 ftzero -z ck_ftst is F
454 ftsize -s ck_ftst ist F
455 ftmtime -M ck_ftst st F
456 ftatime -A ck_ftst st F
457 ftctime -C ck_ftst st F
458 ftsock -S ck_ftst is F
459 ftchr -c ck_ftst is F
460 ftblk -b ck_ftst is F
461 ftfile -f ck_ftst is F
462 ftdir -d ck_ftst is F
463 ftpipe -p ck_ftst is F
464 ftlink -l ck_ftst is F
465 ftsuid -u ck_ftst is F
466 ftsgid -g ck_ftst is F
467 ftsvtx -k ck_ftst is F
468 fttty -t ck_ftst is F
469 fttext -T ck_ftst is F
470 ftbinary -B ck_ftst is F
474 chdir chdir ck_fun ist S?
475 chown chown ck_fun imst L
476 chroot chroot ck_fun ist S?
477 unlink unlink ck_fun imst L
478 chmod chmod ck_fun imst L
479 utime utime ck_fun imst L
480 rename rename ck_fun ist S S
481 link link ck_fun ist S S
482 symlink symlink ck_fun ist S S
483 readlink readlink ck_fun st S?
484 mkdir mkdir ck_fun ist S S
485 rmdir rmdir ck_fun ist S?
489 open_dir opendir ck_fun is F S
490 readdir readdir ck_fun 0 F
491 telldir telldir ck_fun st F
492 seekdir seekdir ck_fun s F S
493 rewinddir rewinddir ck_fun s F
494 closedir closedir ck_fun is F
498 fork fork ck_null ist
499 wait wait ck_null ist
500 waitpid waitpid ck_fun ist S S
501 system system ck_exec imst S? L
502 exec exec ck_exec dimst S? L
503 kill kill ck_fun dimst L
504 getppid getppid ck_null ist
505 getpgrp getpgrp ck_fun ist S?
506 setpgrp setpgrp ck_fun ist S S
507 getpriority getpriority ck_fun ist S S
508 setpriority setpriority ck_fun ist S S S
512 time time ck_null ist
514 localtime localtime ck_fun t S?
515 gmtime gmtime ck_fun t S?
516 alarm alarm ck_fun ist S?
517 sleep sleep ck_fun ist S?
521 shmget shmget ck_fun imst S S S
522 shmctl shmctl ck_fun imst S S S
523 shmread shmread ck_fun imst S S S S
524 shmwrite shmwrite ck_fun ist S S S S
528 msgget msgget ck_fun imst S S
529 msgctl msgctl ck_fun imst S S S
530 msgsnd msgsnd ck_fun imst S S S
531 msgrcv msgrcv ck_fun imst S S S S S
535 semget semget ck_fun imst S S S
536 semctl semctl ck_fun imst S S S S
537 semop semop ck_fun imst S S S
541 require require ck_fun d S
542 dofile do 'file' ck_fun d S
543 entereval eval string ck_eval d S
544 leaveeval eval exit ck_null 0 S
545 evalonce eval constant string ck_null d S
546 entertry eval block ck_null 0
547 leavetry eval block exit ck_null 0
551 ghbyname gethostbyname ck_fun 0 S
552 ghbyaddr gethostbyaddr ck_fun 0 S S
553 ghostent gethostent ck_null 0
554 gnbyname getnetbyname ck_fun 0 S
555 gnbyaddr getnetbyaddr ck_fun 0 S S
556 gnetent getnetent ck_null 0
557 gpbyname getprotobyname ck_fun 0 S
558 gpbynumber getprotobynumber ck_fun 0 S
559 gprotoent getprotoent ck_null 0
560 gsbyname getservbyname ck_fun 0 S S
561 gsbyport getservbyport ck_fun 0 S S
562 gservent getservent ck_null 0
563 shostent sethostent ck_fun is S
564 snetent setnetent ck_fun is S
565 sprotoent setprotoent ck_fun is S
566 sservent setservent ck_fun is S
567 ehostent endhostent ck_null is
568 enetent endnetent ck_null is
569 eprotoent endprotoent ck_null is
570 eservent endservent ck_null is
571 gpwnam getpwnam ck_fun 0 S
572 gpwuid getpwuid ck_fun 0 S
573 gpwent getpwent ck_null 0
574 spwent setpwent ck_null ist
575 epwent endpwent ck_null ist
576 ggrnam getgrnam ck_fun 0 S
577 ggrgid getgrgid ck_fun 0 S
578 ggrent getgrent ck_null 0
579 sgrent setgrent ck_null ist
580 egrent endgrent ck_null ist
581 getlogin getlogin ck_null st
585 syscall syscall ck_fun ist S L