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((ARGSproto));\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
158 scalar null operation ck_null s
162 pushmark pushmark ck_null s
163 wantarray wantarray ck_null is
165 word bare word ck_null s
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
172 pushre push regexp ck_null 0
174 # References and stuff.
176 rv2gv ref-to-glob cast ck_rvconst ds
177 sv2len scalar value length ck_null ist
178 rv2sv ref-to-scalar cast ck_rvconst ds
179 av2arylen array length ck_null is
180 rv2cv subroutine reference ck_rvconst d
181 refgen backslash reference ck_null fst L
182 ref reference-type operator ck_fun st S
183 bless bless ck_fun s S
187 backtick backticks ck_null t
189 readline <HANDLE> ck_null t
190 rcatline append I/O operator ck_null t
192 # Bindable operators.
194 regcomp regexp compilation ck_null s S
195 match pattern match ck_match d
196 subst substitution ck_null dis S
197 substcont substitution cont ck_null dis
198 trans character translation ck_null is S
202 sassign scalar assignment ck_null s
203 aassign list assignment ck_null t L L
205 schop scalar chop ck_null t
206 chop chop ck_chop mt L
207 defined defined operator ck_lfun is S?
208 undef undef operator ck_lfun s S?
209 study study ck_fun st S?
211 preinc preincrement ck_lfun s S
212 predec predecrement ck_lfun s S
213 postinc postincrement ck_lfun st S
214 postdec postdecrement ck_lfun st S
216 # Ordinary operators.
218 pow exponentiation ck_null fst S S
220 multiply multiplication ck_null fst S S
221 divide division ck_null fst S S
222 modulo modulus ck_null ifst S S
223 repeat repeat ck_repeat mt L S
225 add addition ck_null Ifst S S
226 intadd integer addition ck_null ifst S S
227 subtract subtraction ck_null fst S S
228 concat concatenation ck_concat fst S S
230 left_shift left bitshift ck_null ifst S S
231 right_shift right bitshift ck_null ifst S S
233 lt numeric lt ck_null ifs S S
234 gt numeric gt ck_null ifs S S
235 le numeric le ck_null ifs S S
236 ge numeric ge ck_null ifs S S
237 eq numeric eq ck_null ifs S S
238 ne numeric ne ck_null ifs S S
239 ncmp spaceship ck_null ifst S S
241 slt string lt ck_null ifs S S
242 sgt string gt ck_null ifs S S
243 sle string le ck_null ifs S S
244 sge string ge ck_null ifs S S
245 seq string eq ck_null ifs S S
246 sne string ne ck_null ifs S S
247 scmp string comparison ck_null ifst S S
249 bit_and bit and ck_null fst S S
250 xor xor ck_null fst S S
251 bit_or bit or ck_null fst S S
253 negate negate ck_null fst S
254 not not ck_null ifs S
255 complement 1's complement ck_null fst S
257 # High falutin' math.
259 atan2 atan2 ck_fun fst S S
260 sin sin ck_fun fst S?
261 cos cos ck_fun fst S?
262 rand rand ck_fun st S?
263 srand srand ck_fun s S?
264 exp exp ck_fun fst S?
265 log log ck_fun fst S?
266 sqrt sqrt ck_fun fst S?
268 int int ck_fun fst S?
269 hex hex ck_fun ist S?
270 oct oct ck_fun ist S?
274 length length ck_lengthconst ist S
275 substr substr ck_fun st S S S?
276 vec vec ck_fun ist S S S
278 index index ck_index ist S S S?
279 rindex rindex ck_index ist S S S?
281 sprintf sprintf ck_fun mst S L
282 formline formline ck_formline ms S L
283 ord ord ck_fun ifst S?
284 crypt crypt ck_fun fst S S
285 ucfirst upper case first ck_fun ft S
286 lcfirst lower case first ck_fun ft S
287 uc upper case ck_fun ft S
288 lc lower case ck_fun ft S
292 rv2av array deref ck_rvconst dt
293 aelemfast known array element ck_null s A S
294 aelem array element ck_aelem s A S
295 aslice array slice ck_null m A L
297 # Associative arrays.
300 values values ck_fun t H
302 delete delete ck_null s H S
303 rv2hv associative array deref ck_rvconst dt
304 helem associative array elem ck_null s H S
305 hslice associative array slice ck_null m H L
307 # Explosives and implosives.
309 unpack unpack ck_fun 0 S S
310 pack pack ck_fun mst S L
311 split split ck_split t S S S
312 join join ck_fun mst S L
316 list list ck_null m L
317 lslice list slice ck_null 0 H L L
318 anonlist anonymous list ck_null m L
319 anonhash anonymous hash ck_null m L
321 splice splice ck_fun m A S S? L
322 push push ck_fun imst A L
324 shift shift ck_shift s A
325 unshift unshift ck_fun imst A L
326 sort sort ck_sort m C? L
327 reverse reverse ck_fun mt L
329 grepstart grep ck_grep dm C L
330 grepwhile grep iterator ck_null dt
334 range flipflop ck_null 0 S S
335 flip range (or flip) ck_null 0 S S
336 flop range (or flop) ck_null 0
340 and logical and ck_null 0
341 or logical or ck_null 0
342 cond_expr conditional expression ck_null 0
343 andassign logical and assignment ck_null s
344 orassign logical or assignment ck_null s
346 method method lookup ck_null dt
347 entersubr subroutine entry ck_subr dm L
348 leavesubr subroutine exit ck_null 0
349 caller caller ck_fun t S?
350 warn warn ck_fun imst L
351 die die ck_fun dimst L
352 reset reset ck_fun is S?
354 lineseq line sequence ck_null 0
355 curcop next statement ck_null s
356 unstack unstack ck_null s
357 enter block entry ck_null 0
358 leave block exit ck_null 0
359 enteriter foreach loop entry ck_null d
360 iter foreach loop iterator ck_null 0
361 enterloop loop entry ck_null d
362 leaveloop loop exit ck_null s
363 return return ck_fun dm L
369 exit exit ck_fun ds S?
371 nswitch numeric switch ck_null d
372 cswitch character switch ck_null d
376 open open ck_fun ist F S?
377 close close ck_fun is F?
378 pipe_op pipe ck_fun is F F
380 fileno fileno ck_fun ist F
381 umask umask ck_fun ist S?
382 binmode binmode ck_fun s F
384 dbmopen dbmopen ck_fun ist H S S
385 dbmclose dbmclose ck_fun is H
387 sselect select system call ck_select t S S S S
388 select select ck_select st F?
390 getc getc ck_eof st F?
391 read read ck_fun imst F R S S?
392 enterwrite write ck_fun dis F?
393 leavewrite write exit ck_null 0
395 prtf prtf ck_listiob ims F? L
396 print print ck_listiob ims F? L
398 sysread sysread ck_fun imst F R S S?
399 syswrite syswrite ck_fun imst F S S S?
401 send send ck_fun imst F S S S?
402 recv recv ck_fun imst F R S S
405 tell tell ck_fun st F?
406 seek seek ck_fun s F S S
407 truncate truncate ck_trunc is S S
409 fcntl fcntl ck_fun st F S S
410 ioctl ioctl ck_fun st F S S
411 flock flock ck_fun ist F S
415 socket socket ck_fun is F S S S
416 sockpair socketpair ck_fun is F F S S S
418 bind bind ck_fun is F S
419 connect connect ck_fun is F S
420 listen listen ck_fun is F S
421 accept accept ck_fun ist F F
422 shutdown shutdown ck_fun ist F S
424 gsockopt getsockopt ck_fun is F S S
425 ssockopt setsockopt ck_fun is F S S S
427 getsockname getsockname ck_fun is F
428 getpeername getpeername ck_fun is F
432 lstat lstat ck_ftst 0 F
433 stat stat ck_ftst 0 F
434 ftrread -R ck_ftst is F
435 ftrwrite -W ck_ftst is F
436 ftrexec -X ck_ftst is F
437 fteread -r ck_ftst is F
438 ftewrite -w ck_ftst is F
439 fteexec -x ck_ftst is F
441 fteowned -O ck_ftst is F
442 ftrowned -o ck_ftst is F
443 ftzero -z ck_ftst is F
444 ftsize -s ck_ftst ist F
445 ftmtime -M ck_ftst st F
446 ftatime -A ck_ftst st F
447 ftctime -C ck_ftst st F
448 ftsock -S ck_ftst is F
449 ftchr -c ck_ftst is F
450 ftblk -b ck_ftst is F
451 ftfile -f ck_ftst is F
452 ftdir -d ck_ftst is F
453 ftpipe -p ck_ftst is F
454 ftlink -l ck_ftst is F
455 ftsuid -u ck_ftst is F
456 ftsgid -g ck_ftst is F
457 ftsvtx -k ck_ftst is F
458 fttty -t ck_ftst is F
459 fttext -T ck_ftst is F
460 ftbinary -B ck_ftst is F
464 chdir chdir ck_fun ist S?
465 chown chown ck_fun imst L
466 chroot chroot ck_fun ist S?
467 unlink unlink ck_fun imst L
468 chmod chmod ck_fun imst L
469 utime utime ck_fun imst L
470 rename rename ck_fun ist S S
471 link link ck_fun ist S S
472 symlink symlink ck_fun ist S S
473 readlink readlink ck_fun st S?
474 mkdir mkdir ck_fun ist S S
475 rmdir rmdir ck_fun ist S?
479 open_dir opendir ck_fun is F S
480 readdir readdir ck_fun 0 F
481 telldir telldir ck_fun st F
482 seekdir seekdir ck_fun s F S
483 rewinddir rewinddir ck_fun s F
484 closedir closedir ck_fun is F
488 fork fork ck_null ist
489 wait wait ck_null ist
490 waitpid waitpid ck_fun ist S S
491 system system ck_exec imst S? L
492 exec exec ck_exec dimst S? L
493 kill kill ck_fun dimst L
494 getppid getppid ck_null ist
495 getpgrp getpgrp ck_fun ist S?
496 setpgrp setpgrp ck_fun ist S S
497 getpriority getpriority ck_fun ist S S
498 setpriority setpriority ck_fun ist S S S
502 time time ck_null ist
504 localtime localtime ck_fun t S?
505 gmtime gmtime ck_fun t S?
506 alarm alarm ck_fun ist S?
507 sleep sleep ck_fun ist S?
511 shmget shmget ck_fun imst S S S
512 shmctl shmctl ck_fun imst S S S
513 shmread shmread ck_fun imst S S S S
514 shmwrite shmwrite ck_fun ist S S S S
518 msgget msgget ck_fun imst S S
519 msgctl msgctl ck_fun imst S S S
520 msgsnd msgsnd ck_fun imst S S S
521 msgrcv msgrcv ck_fun imst S S S S S
525 semget semget ck_fun imst S S S
526 semctl semctl ck_fun imst S S S S
527 semop semop ck_fun imst S S S
531 require require ck_fun d S
532 dofile do 'file' ck_fun d S
533 entereval eval string ck_eval d S
534 leaveeval eval exit ck_null 0 S
535 evalonce eval constant string ck_null d S
536 entertry eval block ck_null 0
537 leavetry eval block exit ck_null 0
541 ghbyname gethostbyname ck_fun 0 S
542 ghbyaddr gethostbyaddr ck_fun 0 S S
543 ghostent gethostent ck_null 0
544 gnbyname getnetbyname ck_fun 0 S
545 gnbyaddr getnetbyaddr ck_fun 0 S S
546 gnetent getnetent ck_null 0
547 gpbyname getprotobyname ck_fun 0 S
548 gpbynumber getprotobynumber ck_fun 0 S
549 gprotoent getprotoent ck_null 0
550 gsbyname getservbyname ck_fun 0 S S
551 gsbyport getservbyport ck_fun 0 S S
552 gservent getservent ck_null 0
553 shostent sethostent ck_fun ist S
554 snetent setnetent ck_fun ist S
555 sprotoent setprotoent ck_fun ist S
556 sservent setservent ck_fun ist S
557 ehostent endhostent ck_null ist
558 enetent endnetent ck_null ist
559 eprotoent endprotoent ck_null ist
560 eservent endservent ck_null ist
561 gpwnam getpwnam ck_fun 0 S
562 gpwuid getpwuid ck_fun 0 S
563 gpwent getpwent ck_null 0
564 spwent setpwent ck_null ist
565 epwent endpwent ck_null ist
566 ggrnam getgrnam ck_fun 0 S
567 ggrgid getgrgid ck_fun 0 S
568 ggrent getgrent ck_null 0
569 sgrent setgrent ck_null ist
570 egrent endgrent ck_null ist
571 getlogin getlogin ck_null st
575 syscall syscall ck_fun ist S L