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_svconst 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
174 padany private something ck_null 0
176 pushre push regexp ck_null 0
178 # References and stuff.
180 rv2gv ref-to-glob cast ck_rvconst ds
181 sv2len scalar value length ck_null ist
182 rv2sv ref-to-scalar cast ck_rvconst ds
183 av2arylen array length ck_null is
184 rv2cv subroutine reference ck_rvconst d
185 refgen reference constructor ck_null fst L
186 ref reference-type operator ck_fun st S?
187 bless bless ck_fun s S S?
191 backtick backticks ck_null t
193 readline <HANDLE> ck_null t
194 rcatline append I/O operator ck_null t
196 # Bindable operators.
198 regcmaybe regexp comp once ck_fun s S
199 regcomp regexp compilation ck_null s S
200 match pattern match ck_match d
201 subst substitution ck_null dis S
202 substcont substitution cont ck_null dis
203 trans character translation ck_null is S
207 sassign scalar assignment ck_null s
208 aassign list assignment ck_null t L L
210 schop scalar chop ck_null t
211 chop chop ck_chop mt L
212 defined defined operator ck_rfun is S?
213 undef undef operator ck_lfun s S?
214 study study ck_fun st S?
216 preinc preincrement ck_lfun s S
217 predec predecrement ck_lfun s S
218 postinc postincrement ck_lfun st S
219 postdec postdecrement ck_lfun st S
221 # Ordinary operators.
223 pow exponentiation ck_null fst S S
225 multiply multiplication ck_null fst S S
226 divide division ck_null fst S S
227 modulo modulus ck_null ifst S S
228 repeat repeat ck_repeat mt L S
230 add addition ck_null Ifst S S
231 intadd integer addition ck_null ifst S S
232 subtract subtraction ck_null fst S S
233 concat concatenation ck_concat fst S S
235 left_shift left bitshift ck_null ifst S S
236 right_shift right bitshift ck_null ifst S S
238 lt numeric lt ck_null ifs S S
239 gt numeric gt ck_null ifs S S
240 le numeric le ck_null ifs S S
241 ge numeric ge ck_null ifs S S
242 eq numeric eq ck_null ifs S S
243 ne numeric ne ck_null ifs S S
244 ncmp spaceship ck_null ifst S S
246 slt string lt ck_null ifs S S
247 sgt string gt ck_null ifs S S
248 sle string le ck_null ifs S S
249 sge string ge ck_null ifs S S
250 seq string eq ck_null ifs S S
251 sne string ne ck_null ifs S S
252 scmp string comparison ck_null ifst S S
254 bit_and bit and ck_null fst S S
255 xor xor ck_null fst S S
256 bit_or bit or ck_null fst S S
258 negate negate ck_null fst S
259 not not ck_null ifs S
260 complement 1's complement ck_null fst S
262 # High falutin' math.
264 atan2 atan2 ck_fun fst S S
265 sin sin ck_fun fst S?
266 cos cos ck_fun fst S?
267 rand rand ck_fun st S?
268 srand srand ck_fun s S?
269 exp exp ck_fun fst S?
270 log log ck_fun fst S?
271 sqrt sqrt ck_fun fst S?
273 int int ck_fun fst S?
274 hex hex ck_fun ist S?
275 oct oct ck_fun ist S?
276 abs abs ck_fun fst S?
280 length length ck_lengthconst ist S
281 substr substr ck_fun st S S S?
282 vec vec ck_fun ist S S S
284 index index ck_index ist S S S?
285 rindex rindex ck_index ist S S S?
287 sprintf sprintf ck_fun mst S L
288 formline formline ck_formline ms S L
289 ord ord ck_fun ifst S?
290 chr chr ck_fun fst S?
291 crypt crypt ck_fun fst S S
292 ucfirst upper case first ck_fun ft S
293 lcfirst lower case first ck_fun ft S
294 uc upper case ck_fun ft S
295 lc lower case ck_fun ft S
299 rv2av array deref ck_rvconst dt
300 aelemfast known array element ck_null s A S
301 aelem array element ck_null s A S
302 aslice array slice ck_null m A L
304 # Associative arrays.
307 values values ck_fun t H
309 delete delete ck_null s H S
310 rv2hv associative array deref ck_rvconst dt
311 helem associative array elem ck_null s H S
312 hslice associative array slice ck_null m H L
314 # Explosives and implosives.
316 unpack unpack ck_fun 0 S S
317 pack pack ck_fun mst S L
318 split split ck_split t S S S
319 join join ck_fun mst S L
323 list list ck_null m L
324 lslice list slice ck_null 0 H L L
325 anonlist anonymous list ck_null m L
326 anonhash anonymous hash ck_null m L
328 splice splice ck_fun m A S S? L
329 push push ck_fun imst A L
331 shift shift ck_shift s A
332 unshift unshift ck_fun imst A L
333 sort sort ck_sort m C? L
334 reverse reverse ck_fun mt L
336 grepstart grep ck_grep dm C L
337 grepwhile grep iterator ck_null dt
341 range flipflop ck_null 0 S S
342 flip range (or flip) ck_null 0 S S
343 flop range (or flop) ck_null 0
347 and logical and ck_null 0
348 or logical or ck_null 0
349 cond_expr conditional expression ck_null 0
350 andassign logical and assignment ck_null s
351 orassign logical or assignment ck_null s
353 method method lookup ck_null d
354 entersubr subroutine entry ck_subr dm L
355 leavesubr subroutine exit ck_null 0
356 caller caller ck_fun t S?
357 warn warn ck_fun imst L
358 die die ck_fun dimst L
359 reset reset ck_fun is S?
361 lineseq line sequence ck_null 0
362 nextstate next statement ck_null s
363 dbstate debug next statement ck_null s
364 unstack unstack ck_null s
365 enter block entry ck_null 0
366 leave block exit ck_null 0
367 scope block ck_null 0
368 enteriter foreach loop entry ck_null d
369 iter foreach loop iterator ck_null 0
370 enterloop loop entry ck_null d
371 leaveloop loop exit ck_null s
372 return return ck_fun dm L
378 exit exit ck_fun ds S?
380 nswitch numeric switch ck_null d
381 cswitch character switch ck_null d
385 open open ck_fun ist F S?
386 close close ck_fun is F?
387 pipe_op pipe ck_fun is F F
389 fileno fileno ck_fun ist F
390 umask umask ck_fun ist S?
391 binmode binmode ck_fun s F
393 tie tie ck_fun idms R S L
394 untie untie ck_fun is R
395 dbmopen dbmopen ck_fun is H S S
396 dbmclose dbmclose ck_fun is H
398 sselect select system call ck_select t S S S S
399 select select ck_select st F?
401 getc getc ck_eof st F?
402 read read ck_fun imst F R S S?
403 enterwrite write ck_fun dis F?
404 leavewrite write exit ck_null 0
406 prtf printf ck_listiob ims F? L
407 print print ck_listiob ims F? L
409 sysread sysread ck_fun imst F R S S?
410 syswrite syswrite ck_fun imst F S S S?
412 send send ck_fun imst F S S S?
413 recv recv ck_fun imst F R S S
416 tell tell ck_fun st F?
417 seek seek ck_fun s F S S
418 truncate truncate ck_trunc is S S
420 fcntl fcntl ck_fun st F S S
421 ioctl ioctl ck_fun st F S S
422 flock flock ck_fun ist F S
426 socket socket ck_fun is F S S S
427 sockpair socketpair ck_fun is F F S S S
429 bind bind ck_fun is F S
430 connect connect ck_fun is F S
431 listen listen ck_fun is F S
432 accept accept ck_fun ist F F
433 shutdown shutdown ck_fun ist F S
435 gsockopt getsockopt ck_fun is F S S
436 ssockopt setsockopt ck_fun is F S S S
438 getsockname getsockname ck_fun is F
439 getpeername getpeername ck_fun is F
443 lstat lstat ck_ftst 0 F
444 stat stat ck_ftst 0 F
445 ftrread -R ck_ftst is F
446 ftrwrite -W ck_ftst is F
447 ftrexec -X ck_ftst is F
448 fteread -r ck_ftst is F
449 ftewrite -w ck_ftst is F
450 fteexec -x ck_ftst is F
452 fteowned -O ck_ftst is F
453 ftrowned -o ck_ftst is F
454 ftzero -z ck_ftst is F
455 ftsize -s ck_ftst ist F
456 ftmtime -M ck_ftst st F
457 ftatime -A ck_ftst st F
458 ftctime -C ck_ftst st F
459 ftsock -S ck_ftst is F
460 ftchr -c ck_ftst is F
461 ftblk -b ck_ftst is F
462 ftfile -f ck_ftst is F
463 ftdir -d ck_ftst is F
464 ftpipe -p ck_ftst is F
465 ftlink -l ck_ftst is F
466 ftsuid -u ck_ftst is F
467 ftsgid -g ck_ftst is F
468 ftsvtx -k ck_ftst is F
469 fttty -t ck_ftst is F
470 fttext -T ck_ftst is F
471 ftbinary -B ck_ftst is F
475 chdir chdir ck_fun ist S?
476 chown chown ck_fun imst L
477 chroot chroot ck_fun ist S?
478 unlink unlink ck_fun imst L
479 chmod chmod ck_fun imst L
480 utime utime ck_fun imst L
481 rename rename ck_fun ist S S
482 link link ck_fun ist S S
483 symlink symlink ck_fun ist S S
484 readlink readlink ck_fun st S?
485 mkdir mkdir ck_fun ist S S
486 rmdir rmdir ck_fun ist S?
490 open_dir opendir ck_fun is F S
491 readdir readdir ck_fun 0 F
492 telldir telldir ck_fun st F
493 seekdir seekdir ck_fun s F S
494 rewinddir rewinddir ck_fun s F
495 closedir closedir ck_fun is F
499 fork fork ck_null ist
500 wait wait ck_null ist
501 waitpid waitpid ck_fun ist S S
502 system system ck_exec imst S? L
503 exec exec ck_exec dimst S? L
504 kill kill ck_fun dimst L
505 getppid getppid ck_null ist
506 getpgrp getpgrp ck_fun ist S?
507 setpgrp setpgrp ck_fun ist S S
508 getpriority getpriority ck_fun ist S S
509 setpriority setpriority ck_fun ist S S S
513 time time ck_null ist
515 localtime localtime ck_fun t S?
516 gmtime gmtime ck_fun t S?
517 alarm alarm ck_fun ist S?
518 sleep sleep ck_fun ist S?
522 shmget shmget ck_fun imst S S S
523 shmctl shmctl ck_fun imst S S S
524 shmread shmread ck_fun imst S S S S
525 shmwrite shmwrite ck_fun ist S S S S
529 msgget msgget ck_fun imst S S
530 msgctl msgctl ck_fun imst S S S
531 msgsnd msgsnd ck_fun imst S S S
532 msgrcv msgrcv ck_fun imst S S S S S
536 semget semget ck_fun imst S S S
537 semctl semctl ck_fun imst S S S S
538 semop semop ck_fun imst S S S
542 require require ck_require d S?
543 dofile do 'file' ck_fun d S
544 entereval eval string ck_eval d S
545 leaveeval eval exit ck_null 0 S
546 evalonce eval constant string ck_null d S
547 entertry eval block ck_null 0
548 leavetry eval block exit ck_null 0
552 ghbyname gethostbyname ck_fun 0 S
553 ghbyaddr gethostbyaddr ck_fun 0 S S
554 ghostent gethostent ck_null 0
555 gnbyname getnetbyname ck_fun 0 S
556 gnbyaddr getnetbyaddr ck_fun 0 S S
557 gnetent getnetent ck_null 0
558 gpbyname getprotobyname ck_fun 0 S
559 gpbynumber getprotobynumber ck_fun 0 S
560 gprotoent getprotoent ck_null 0
561 gsbyname getservbyname ck_fun 0 S S
562 gsbyport getservbyport ck_fun 0 S S
563 gservent getservent ck_null 0
564 shostent sethostent ck_fun is S
565 snetent setnetent ck_fun is S
566 sprotoent setprotoent ck_fun is S
567 sservent setservent ck_fun is S
568 ehostent endhostent ck_null is
569 enetent endnetent ck_null is
570 eprotoent endprotoent ck_null is
571 eservent endservent ck_null is
572 gpwnam getpwnam ck_fun 0 S
573 gpwuid getpwuid ck_fun 0 S
574 gpwent getpwent ck_null 0
575 spwent setpwent ck_null ist
576 epwent endpwent ck_null ist
577 ggrnam getgrnam ck_fun 0 S
578 ggrgid getgrgid ck_fun 0 S
579 ggrent getgrent ck_null 0
580 sgrent setgrent ck_null ist
581 egrent endgrent ck_null ist
582 getlogin getlogin ck_null st
586 syscall syscall ck_fun ist S L