1 | #!/usr/bin/perl
|
---|
2 | BEGIN {
|
---|
3 | # Get function prototypes
|
---|
4 | require 'regen_lib.pl';
|
---|
5 | }
|
---|
6 |
|
---|
7 | $opcode_new = 'opcode.h-new';
|
---|
8 | $opname_new = 'opnames.h-new';
|
---|
9 | open(OC, ">$opcode_new") || die "Can't create $opcode_new: $!\n";
|
---|
10 | binmode OC;
|
---|
11 | open(ON, ">$opname_new") || die "Can't create $opname_new: $!\n";
|
---|
12 | binmode ON;
|
---|
13 | select OC;
|
---|
14 |
|
---|
15 | # Read data.
|
---|
16 |
|
---|
17 | while (<DATA>) {
|
---|
18 | chop;
|
---|
19 | next unless $_;
|
---|
20 | next if /^#/;
|
---|
21 | ($key, $desc, $check, $flags, $args) = split(/\t+/, $_, 5);
|
---|
22 |
|
---|
23 | warn qq[Description "$desc" duplicates $seen{$desc}\n] if $seen{$desc};
|
---|
24 | die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
|
---|
25 | $seen{$desc} = qq[description of opcode "$key"];
|
---|
26 | $seen{$key} = qq[opcode "$key"];
|
---|
27 |
|
---|
28 | push(@ops, $key);
|
---|
29 | $desc{$key} = $desc;
|
---|
30 | $check{$key} = $check;
|
---|
31 | $ckname{$check}++;
|
---|
32 | $flags{$key} = $flags;
|
---|
33 | $args{$key} = $args;
|
---|
34 | }
|
---|
35 |
|
---|
36 | # Emit defines.
|
---|
37 |
|
---|
38 | $i = 0;
|
---|
39 | print <<"END";
|
---|
40 | /* -*- buffer-read-only: t -*-
|
---|
41 | *
|
---|
42 | * opcode.h
|
---|
43 | *
|
---|
44 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
---|
45 | * 2000, 2001, 2002, 2003, 2004, 2005, 2006 by Larry Wall and others
|
---|
46 | *
|
---|
47 | * You may distribute under the terms of either the GNU General Public
|
---|
48 | * License or the Artistic License, as specified in the README file.
|
---|
49 | *
|
---|
50 | * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
|
---|
51 | * This file is built by opcode.pl from its data. Any changes made here
|
---|
52 | * will be lost!
|
---|
53 | */
|
---|
54 |
|
---|
55 | #define Perl_pp_i_preinc Perl_pp_preinc
|
---|
56 | #define Perl_pp_i_predec Perl_pp_predec
|
---|
57 | #define Perl_pp_i_postinc Perl_pp_postinc
|
---|
58 | #define Perl_pp_i_postdec Perl_pp_postdec
|
---|
59 |
|
---|
60 | END
|
---|
61 |
|
---|
62 | print ON <<"END";
|
---|
63 | /* -*- buffer-read-only: t -*-
|
---|
64 | *
|
---|
65 | * opnames.h
|
---|
66 | *
|
---|
67 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
---|
68 | * by Larry Wall and others
|
---|
69 | *
|
---|
70 | * You may distribute under the terms of either the GNU General Public
|
---|
71 | * License or the Artistic License, as specified in the README file.
|
---|
72 | *
|
---|
73 | *
|
---|
74 | * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
|
---|
75 | * This file is built by opcode.pl from its data. Any changes made here
|
---|
76 | * will be lost!
|
---|
77 | */
|
---|
78 |
|
---|
79 | typedef enum opcode {
|
---|
80 | END
|
---|
81 |
|
---|
82 | for (@ops) {
|
---|
83 | print ON "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
|
---|
84 | }
|
---|
85 | print ON "\t", &tab(3,"OP_max"), "\n";
|
---|
86 | print ON "} opcode;\n";
|
---|
87 | print ON "\n#define MAXO ", scalar @ops, "\n";
|
---|
88 | print ON "#define OP_phoney_INPUT_ONLY -1\n";
|
---|
89 | print ON "#define OP_phoney_OUTPUT_ONLY -2\n\n";
|
---|
90 |
|
---|
91 | # Emit op names and descriptions.
|
---|
92 |
|
---|
93 | print <<END;
|
---|
94 |
|
---|
95 | START_EXTERN_C
|
---|
96 |
|
---|
97 |
|
---|
98 | #define OP_NAME(o) ((o)->op_type == OP_CUSTOM ? custom_op_name(o) : \\
|
---|
99 | PL_op_name[(o)->op_type])
|
---|
100 | #define OP_DESC(o) ((o)->op_type == OP_CUSTOM ? custom_op_desc(o) : \\
|
---|
101 | PL_op_desc[(o)->op_type])
|
---|
102 |
|
---|
103 | #ifndef DOINIT
|
---|
104 | EXT char *PL_op_name[];
|
---|
105 | #else
|
---|
106 | EXT char *PL_op_name[] = {
|
---|
107 | END
|
---|
108 |
|
---|
109 | for (@ops) {
|
---|
110 | print qq(\t"$_",\n);
|
---|
111 | }
|
---|
112 |
|
---|
113 | print <<END;
|
---|
114 | };
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | END
|
---|
118 |
|
---|
119 | print <<END;
|
---|
120 | #ifndef DOINIT
|
---|
121 | EXT char *PL_op_desc[];
|
---|
122 | #else
|
---|
123 | EXT char *PL_op_desc[] = {
|
---|
124 | END
|
---|
125 |
|
---|
126 | for (@ops) {
|
---|
127 | my($safe_desc) = $desc{$_};
|
---|
128 |
|
---|
129 | # Have to escape double quotes and escape characters.
|
---|
130 | $safe_desc =~ s/(^|[^\\])([\\"])/$1\\$2/g;
|
---|
131 |
|
---|
132 | print qq(\t"$safe_desc",\n);
|
---|
133 | }
|
---|
134 |
|
---|
135 | print <<END;
|
---|
136 | };
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | END_EXTERN_C
|
---|
140 |
|
---|
141 | END
|
---|
142 |
|
---|
143 | # Emit function declarations.
|
---|
144 |
|
---|
145 | #for (sort keys %ckname) {
|
---|
146 | # print "OP *\t", &tab(3,$_),"(pTHX_ OP* o);\n";
|
---|
147 | #}
|
---|
148 | #
|
---|
149 | #print "\n";
|
---|
150 | #
|
---|
151 | #for (@ops) {
|
---|
152 | # print "OP *\t", &tab(3, "pp_$_"), "(pTHX);\n";
|
---|
153 | #}
|
---|
154 |
|
---|
155 | # Emit ppcode switch array.
|
---|
156 |
|
---|
157 | print <<END;
|
---|
158 |
|
---|
159 | START_EXTERN_C
|
---|
160 |
|
---|
161 | #ifndef DOINIT
|
---|
162 | EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX);
|
---|
163 | #else
|
---|
164 | EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX) = {
|
---|
165 | END
|
---|
166 |
|
---|
167 | for (@ops) {
|
---|
168 | print "\tMEMBER_TO_FPTR(Perl_pp_$_),\n" unless $_ eq "custom";
|
---|
169 | }
|
---|
170 |
|
---|
171 | print <<END;
|
---|
172 | };
|
---|
173 | #endif
|
---|
174 |
|
---|
175 | END
|
---|
176 |
|
---|
177 | # Emit check routines.
|
---|
178 |
|
---|
179 | print <<END;
|
---|
180 | #ifndef DOINIT
|
---|
181 | EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op);
|
---|
182 | #else
|
---|
183 | EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op) = {
|
---|
184 | END
|
---|
185 |
|
---|
186 | for (@ops) {
|
---|
187 | print "\t", &tab(3, "MEMBER_TO_FPTR(Perl_$check{$_}),"), "\t/* $_ */\n";
|
---|
188 | }
|
---|
189 |
|
---|
190 | print <<END;
|
---|
191 | };
|
---|
192 | #endif
|
---|
193 |
|
---|
194 | END
|
---|
195 |
|
---|
196 | # Emit allowed argument types.
|
---|
197 |
|
---|
198 | print <<END;
|
---|
199 | #ifndef DOINIT
|
---|
200 | EXT U32 PL_opargs[];
|
---|
201 | #else
|
---|
202 | EXT U32 PL_opargs[] = {
|
---|
203 | END
|
---|
204 |
|
---|
205 | %argnum = (
|
---|
206 | S, 1, # scalar
|
---|
207 | L, 2, # list
|
---|
208 | A, 3, # array value
|
---|
209 | H, 4, # hash value
|
---|
210 | C, 5, # code value
|
---|
211 | F, 6, # file value
|
---|
212 | R, 7, # scalar reference
|
---|
213 | );
|
---|
214 |
|
---|
215 | %opclass = (
|
---|
216 | '0', 0, # baseop
|
---|
217 | '1', 1, # unop
|
---|
218 | '2', 2, # binop
|
---|
219 | '|', 3, # logop
|
---|
220 | '@', 4, # listop
|
---|
221 | '/', 5, # pmop
|
---|
222 | '$', 6, # svop_or_padop
|
---|
223 | '#', 7, # padop
|
---|
224 | '"', 8, # pvop_or_svop
|
---|
225 | '{', 9, # loop
|
---|
226 | ';', 10, # cop
|
---|
227 | '%', 11, # baseop_or_unop
|
---|
228 | '-', 12, # filestatop
|
---|
229 | '}', 13, # loopexop
|
---|
230 | );
|
---|
231 |
|
---|
232 | my %OP_IS_SOCKET;
|
---|
233 | my %OP_IS_FILETEST;
|
---|
234 |
|
---|
235 | for (@ops) {
|
---|
236 | $argsum = 0;
|
---|
237 | $flags = $flags{$_};
|
---|
238 | $argsum |= 1 if $flags =~ /m/; # needs stack mark
|
---|
239 | $argsum |= 2 if $flags =~ /f/; # fold constants
|
---|
240 | $argsum |= 4 if $flags =~ /s/; # always produces scalar
|
---|
241 | $argsum |= 8 if $flags =~ /t/; # needs target scalar
|
---|
242 | $argsum |= (8|256) if $flags =~ /T/; # ... which may be lexical
|
---|
243 | $argsum |= 16 if $flags =~ /i/; # always produces integer
|
---|
244 | $argsum |= 32 if $flags =~ /I/; # has corresponding int op
|
---|
245 | $argsum |= 64 if $flags =~ /d/; # danger, unknown side effects
|
---|
246 | $argsum |= 128 if $flags =~ /u/; # defaults to $_
|
---|
247 | $flags =~ /([\W\d_])/ or die qq[Opcode "$_" has no class indicator];
|
---|
248 | $argsum |= $opclass{$1} << 9;
|
---|
249 | $mul = 0x2000; # 2 ^ OASHIFT
|
---|
250 | for $arg (split(' ',$args{$_})) {
|
---|
251 | if ($arg =~ /^F/) {
|
---|
252 | $OP_IS_SOCKET{$_} = 1 if $arg =~ s/s//;
|
---|
253 | $OP_IS_FILETEST{$_} = 1 if $arg =~ s/-//;
|
---|
254 | }
|
---|
255 | $argnum = ($arg =~ s/\?//) ? 8 : 0;
|
---|
256 | die "op = $_, arg = $arg\n" unless length($arg) == 1;
|
---|
257 | $argnum += $argnum{$arg};
|
---|
258 | warn "# Conflicting bit 32 for '$_'.\n"
|
---|
259 | if $argnum & 8 and $mul == 0x10000000;
|
---|
260 | $argsum += $argnum * $mul;
|
---|
261 | $mul <<= 4;
|
---|
262 | }
|
---|
263 | $argsum = sprintf("0x%08x", $argsum);
|
---|
264 | print "\t", &tab(3, "$argsum,"), "/* $_ */\n";
|
---|
265 | }
|
---|
266 |
|
---|
267 | print <<END;
|
---|
268 | };
|
---|
269 | #endif
|
---|
270 |
|
---|
271 | END_EXTERN_C
|
---|
272 | END
|
---|
273 |
|
---|
274 | if (keys %OP_IS_SOCKET) {
|
---|
275 | print ON "\n#define OP_IS_SOCKET(op) \\\n\t(";
|
---|
276 | print ON join(" || \\\n\t ",
|
---|
277 | map { "(op) == OP_" . uc() } sort keys %OP_IS_SOCKET);
|
---|
278 | print ON ")\n\n";
|
---|
279 | }
|
---|
280 |
|
---|
281 | if (keys %OP_IS_FILETEST) {
|
---|
282 | print ON "\n#define OP_IS_FILETEST(op) \\\n\t(";
|
---|
283 | print ON join(" || \\\n\t ",
|
---|
284 | map { "(op) == OP_" . uc() } sort keys %OP_IS_FILETEST);
|
---|
285 | print ON ")\n\n";
|
---|
286 | }
|
---|
287 |
|
---|
288 | print OC "/* ex: set ro: */\n";
|
---|
289 | print ON "/* ex: set ro: */\n";
|
---|
290 |
|
---|
291 | close OC or die "Error closing opcode.h: $!";
|
---|
292 | close ON or die "Error closing opnames.h: $!";
|
---|
293 |
|
---|
294 | foreach ('opcode.h', 'opnames.h') {
|
---|
295 | safer_rename_silent $_, "$_-old";
|
---|
296 | }
|
---|
297 | safer_rename $opcode_new, 'opcode.h';
|
---|
298 | safer_rename $opname_new, 'opnames.h';
|
---|
299 |
|
---|
300 | $pp_proto_new = 'pp_proto.h-new';
|
---|
301 | $pp_sym_new = 'pp.sym-new';
|
---|
302 |
|
---|
303 | open PP, ">$pp_proto_new" or die "Error creating $pp_proto_new: $!";
|
---|
304 | binmode PP;
|
---|
305 | open PPSYM, ">$pp_sym_new" or die "Error creating $pp_sym_new: $!";
|
---|
306 | binmode PPSYM;
|
---|
307 |
|
---|
308 | print PP <<"END";
|
---|
309 | /* -*- buffer-read-only: t -*-
|
---|
310 | !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
|
---|
311 | This file is built by opcode.pl from its data. Any changes made here
|
---|
312 | will be lost!
|
---|
313 | */
|
---|
314 |
|
---|
315 | END
|
---|
316 |
|
---|
317 | print PPSYM <<"END";
|
---|
318 | # -*- buffer-read-only: t -*-
|
---|
319 | #
|
---|
320 | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
|
---|
321 | # This file is built by opcode.pl from its data. Any changes made here
|
---|
322 | # will be lost!
|
---|
323 | #
|
---|
324 |
|
---|
325 | END
|
---|
326 |
|
---|
327 |
|
---|
328 | for (sort keys %ckname) {
|
---|
329 | print PP "PERL_CKDEF(Perl_$_)\n";
|
---|
330 | print PPSYM "Perl_$_\n";
|
---|
331 | #OP *\t", &tab(3,$_),"(OP* o);\n";
|
---|
332 | }
|
---|
333 |
|
---|
334 | print PP "\n\n";
|
---|
335 |
|
---|
336 | for (@ops) {
|
---|
337 | next if /^i_(pre|post)(inc|dec)$/;
|
---|
338 | next if /^custom$/;
|
---|
339 | print PP "PERL_PPDEF(Perl_pp_$_)\n";
|
---|
340 | print PPSYM "Perl_pp_$_\n";
|
---|
341 | }
|
---|
342 | print PP "\n/* ex: set ro: */\n";
|
---|
343 | print PPSYM "\n# ex: set ro:\n";
|
---|
344 |
|
---|
345 | close PP or die "Error closing pp_proto.h: $!";
|
---|
346 | close PPSYM or die "Error closing pp.sym: $!";
|
---|
347 |
|
---|
348 | foreach ('pp_proto.h', 'pp.sym') {
|
---|
349 | safer_rename_silent $_, "$_-old";
|
---|
350 | }
|
---|
351 | safer_rename $pp_proto_new, 'pp_proto.h';
|
---|
352 | safer_rename $pp_sym_new, 'pp.sym';
|
---|
353 |
|
---|
354 | END {
|
---|
355 | foreach ('opcode.h', 'opnames.h', 'pp_proto.h', 'pp.sym') {
|
---|
356 | 1 while unlink "$_-old";
|
---|
357 | }
|
---|
358 | }
|
---|
359 |
|
---|
360 | ###########################################################################
|
---|
361 | sub tab {
|
---|
362 | local($l, $t) = @_;
|
---|
363 | $t .= "\t" x ($l - (length($t) + 1) / 8);
|
---|
364 | $t;
|
---|
365 | }
|
---|
366 | ###########################################################################
|
---|
367 |
|
---|
368 | # Some comments about 'T' opcode classifier:
|
---|
369 |
|
---|
370 | # Safe to set if the ppcode uses:
|
---|
371 | # tryAMAGICbin, tryAMAGICun, SETn, SETi, SETu, PUSHn, PUSHTARG, SETTARG,
|
---|
372 | # SETs(TARG), XPUSHn, XPUSHu,
|
---|
373 |
|
---|
374 | # Unsafe to set if the ppcode uses dTARG or [X]RETPUSH[YES|NO|UNDEF]
|
---|
375 |
|
---|
376 | # lt and friends do SETs (including ncmp, but not scmp)
|
---|
377 |
|
---|
378 | # Additional mode of failure: the opcode can modify TARG before it "used"
|
---|
379 | # all the arguments (or may call an external function which does the same).
|
---|
380 | # If the target coincides with one of the arguments ==> kaboom.
|
---|
381 |
|
---|
382 | # pp.c pos substr each not OK (RETPUSHUNDEF)
|
---|
383 | # substr vec also not OK due to LV to target (are they???)
|
---|
384 | # ref not OK (RETPUSHNO)
|
---|
385 | # trans not OK (dTARG; TARG = sv_newmortal();)
|
---|
386 | # ucfirst etc not OK: TMP arg processed inplace
|
---|
387 | # quotemeta not OK (unsafe when TARG == arg)
|
---|
388 | # each repeat not OK too due to list context
|
---|
389 | # pack split - unknown whether they are safe
|
---|
390 | # sprintf: is calling do_sprintf(TARG,...) which can act on TARG
|
---|
391 | # before other args are processed.
|
---|
392 |
|
---|
393 | # Suspicious wrt "additional mode of failure" (and only it):
|
---|
394 | # schop, chop, postinc/dec, bit_and etc, negate, complement.
|
---|
395 |
|
---|
396 | # Also suspicious: 4-arg substr, sprintf, uc/lc (POK_only), reverse, pack.
|
---|
397 |
|
---|
398 | # substr/vec: doing TAINT_off()???
|
---|
399 |
|
---|
400 | # pp_hot.c
|
---|
401 | # readline - unknown whether it is safe
|
---|
402 | # match subst not OK (dTARG)
|
---|
403 | # grepwhile not OK (not always setting)
|
---|
404 | # join not OK (unsafe when TARG == arg)
|
---|
405 |
|
---|
406 | # Suspicious wrt "additional mode of failure": concat (dealt with
|
---|
407 | # in ck_sassign()), join (same).
|
---|
408 |
|
---|
409 | # pp_ctl.c
|
---|
410 | # mapwhile flip caller not OK (not always setting)
|
---|
411 |
|
---|
412 | # pp_sys.c
|
---|
413 | # backtick glob warn die not OK (not always setting)
|
---|
414 | # warn not OK (RETPUSHYES)
|
---|
415 | # open fileno getc sysread syswrite ioctl accept shutdown
|
---|
416 | # ftsize(etc) readlink telldir fork alarm getlogin not OK (RETPUSHUNDEF)
|
---|
417 | # umask select not OK (XPUSHs(&PL_sv_undef);)
|
---|
418 | # fileno getc sysread syswrite tell not OK (meth("FILENO" "GETC"))
|
---|
419 | # sselect shm* sem* msg* syscall - unknown whether they are safe
|
---|
420 | # gmtime not OK (list context)
|
---|
421 |
|
---|
422 | # Suspicious wrt "additional mode of failure": warn, die, select.
|
---|
423 |
|
---|
424 | __END__
|
---|
425 |
|
---|
426 | # New ops always go at the end, just before 'custom'
|
---|
427 |
|
---|
428 | # A recapitulation of the format of this file:
|
---|
429 | # The file consists of five columns: the name of the op, an English
|
---|
430 | # description, the name of the "check" routine used to optimize this
|
---|
431 | # operation, some flags, and a description of the operands.
|
---|
432 |
|
---|
433 | # The flags consist of options followed by a mandatory op class signifier
|
---|
434 |
|
---|
435 | # The classes are:
|
---|
436 | # baseop - 0 unop - 1 binop - 2
|
---|
437 | # logop - | listop - @ pmop - /
|
---|
438 | # padop/svop - $ padop - # (unused) loop - {
|
---|
439 | # baseop/unop - % loopexop - } filestatop - -
|
---|
440 | # pvop/svop - " cop - ;
|
---|
441 |
|
---|
442 | # Other options are:
|
---|
443 | # needs stack mark - m
|
---|
444 | # needs constant folding - f
|
---|
445 | # produces a scalar - s
|
---|
446 | # produces an integer - i
|
---|
447 | # needs a target - t
|
---|
448 | # target can be in a pad - T
|
---|
449 | # has a corresponding integer version - I
|
---|
450 | # has side effects - d
|
---|
451 | # uses $_ if no argument given - u
|
---|
452 |
|
---|
453 | # Values for the operands are:
|
---|
454 | # scalar - S list - L array - A
|
---|
455 | # hash - H sub (CV) - C file - F
|
---|
456 | # socket - Fs filetest - F- reference - R
|
---|
457 | # "?" denotes an optional operand.
|
---|
458 |
|
---|
459 | # Nothing.
|
---|
460 |
|
---|
461 | null null operation ck_null 0
|
---|
462 | stub stub ck_null 0
|
---|
463 | scalar scalar ck_fun s% S
|
---|
464 |
|
---|
465 | # Pushy stuff.
|
---|
466 |
|
---|
467 | pushmark pushmark ck_null s0
|
---|
468 | wantarray wantarray ck_null is0
|
---|
469 |
|
---|
470 | const constant item ck_svconst s$
|
---|
471 |
|
---|
472 | gvsv scalar variable ck_null ds$
|
---|
473 | gv glob value ck_null ds$
|
---|
474 | gelem glob elem ck_null d2 S S
|
---|
475 | padsv private variable ck_null ds0
|
---|
476 | padav private array ck_null d0
|
---|
477 | padhv private hash ck_null d0
|
---|
478 | padany private value ck_null d0
|
---|
479 |
|
---|
480 | pushre push regexp ck_null d/
|
---|
481 |
|
---|
482 | # References and stuff.
|
---|
483 |
|
---|
484 | rv2gv ref-to-glob cast ck_rvconst ds1
|
---|
485 | rv2sv scalar dereference ck_rvconst ds1
|
---|
486 | av2arylen array length ck_null is1
|
---|
487 | rv2cv subroutine dereference ck_rvconst d1
|
---|
488 | anoncode anonymous subroutine ck_anoncode $
|
---|
489 | prototype subroutine prototype ck_null s% S
|
---|
490 | refgen reference constructor ck_spair m1 L
|
---|
491 | srefgen single ref constructor ck_null fs1 S
|
---|
492 | ref reference-type operator ck_fun stu% S?
|
---|
493 | bless bless ck_fun s@ S S?
|
---|
494 |
|
---|
495 | # Pushy I/O.
|
---|
496 |
|
---|
497 | backtick quoted execution (``, qx) ck_open t%
|
---|
498 | # glob defaults its first arg to $_
|
---|
499 | glob glob ck_glob t@ S?
|
---|
500 | readline <HANDLE> ck_null t% F?
|
---|
501 | rcatline append I/O operator ck_null t$
|
---|
502 |
|
---|
503 | # Bindable operators.
|
---|
504 |
|
---|
505 | regcmaybe regexp internal guard ck_fun s1 S
|
---|
506 | regcreset regexp internal reset ck_fun s1 S
|
---|
507 | regcomp regexp compilation ck_null s| S
|
---|
508 | match pattern match (m//) ck_match d/
|
---|
509 | qr pattern quote (qr//) ck_match s/
|
---|
510 | subst substitution (s///) ck_null dis/ S
|
---|
511 | substcont substitution iterator ck_null dis|
|
---|
512 | trans transliteration (tr///) ck_null is" S
|
---|
513 |
|
---|
514 | # Lvalue operators.
|
---|
515 | # sassign is special-cased for op class
|
---|
516 |
|
---|
517 | sassign scalar assignment ck_sassign s0
|
---|
518 | aassign list assignment ck_null t2 L L
|
---|
519 |
|
---|
520 | chop chop ck_spair mts% L
|
---|
521 | schop scalar chop ck_null stu% S?
|
---|
522 | chomp chomp ck_spair mTs% L
|
---|
523 | schomp scalar chomp ck_null sTu% S?
|
---|
524 | defined defined operator ck_defined isu% S?
|
---|
525 | undef undef operator ck_lfun s% S?
|
---|
526 | study study ck_fun su% S?
|
---|
527 | pos match position ck_lfun stu% S?
|
---|
528 |
|
---|
529 | preinc preincrement (++) ck_lfun dIs1 S
|
---|
530 | i_preinc integer preincrement (++) ck_lfun dis1 S
|
---|
531 | predec predecrement (--) ck_lfun dIs1 S
|
---|
532 | i_predec integer predecrement (--) ck_lfun dis1 S
|
---|
533 | postinc postincrement (++) ck_lfun dIst1 S
|
---|
534 | i_postinc integer postincrement (++) ck_lfun disT1 S
|
---|
535 | postdec postdecrement (--) ck_lfun dIst1 S
|
---|
536 | i_postdec integer postdecrement (--) ck_lfun disT1 S
|
---|
537 |
|
---|
538 | # Ordinary operators.
|
---|
539 |
|
---|
540 | pow exponentiation (**) ck_null fsT2 S S
|
---|
541 |
|
---|
542 | multiply multiplication (*) ck_null IfsT2 S S
|
---|
543 | i_multiply integer multiplication (*) ck_null ifsT2 S S
|
---|
544 | divide division (/) ck_null IfsT2 S S
|
---|
545 | i_divide integer division (/) ck_null ifsT2 S S
|
---|
546 | modulo modulus (%) ck_null IifsT2 S S
|
---|
547 | i_modulo integer modulus (%) ck_null ifsT2 S S
|
---|
548 | repeat repeat (x) ck_repeat mt2 L S
|
---|
549 |
|
---|
550 | add addition (+) ck_null IfsT2 S S
|
---|
551 | i_add integer addition (+) ck_null ifsT2 S S
|
---|
552 | subtract subtraction (-) ck_null IfsT2 S S
|
---|
553 | i_subtract integer subtraction (-) ck_null ifsT2 S S
|
---|
554 | concat concatenation (.) or string ck_concat fsT2 S S
|
---|
555 | stringify string ck_fun fsT@ S
|
---|
556 |
|
---|
557 | left_shift left bitshift (<<) ck_bitop fsT2 S S
|
---|
558 | right_shift right bitshift (>>) ck_bitop fsT2 S S
|
---|
559 |
|
---|
560 | lt numeric lt (<) ck_null Iifs2 S S
|
---|
561 | i_lt integer lt (<) ck_null ifs2 S S
|
---|
562 | gt numeric gt (>) ck_null Iifs2 S S
|
---|
563 | i_gt integer gt (>) ck_null ifs2 S S
|
---|
564 | le numeric le (<=) ck_null Iifs2 S S
|
---|
565 | i_le integer le (<=) ck_null ifs2 S S
|
---|
566 | ge numeric ge (>=) ck_null Iifs2 S S
|
---|
567 | i_ge integer ge (>=) ck_null ifs2 S S
|
---|
568 | eq numeric eq (==) ck_null Iifs2 S S
|
---|
569 | i_eq integer eq (==) ck_null ifs2 S S
|
---|
570 | ne numeric ne (!=) ck_null Iifs2 S S
|
---|
571 | i_ne integer ne (!=) ck_null ifs2 S S
|
---|
572 | ncmp numeric comparison (<=>) ck_null Iifst2 S S
|
---|
573 | i_ncmp integer comparison (<=>) ck_null ifst2 S S
|
---|
574 |
|
---|
575 | slt string lt ck_null ifs2 S S
|
---|
576 | sgt string gt ck_null ifs2 S S
|
---|
577 | sle string le ck_null ifs2 S S
|
---|
578 | sge string ge ck_null ifs2 S S
|
---|
579 | seq string eq ck_null ifs2 S S
|
---|
580 | sne string ne ck_null ifs2 S S
|
---|
581 | scmp string comparison (cmp) ck_null ifst2 S S
|
---|
582 |
|
---|
583 | bit_and bitwise and (&) ck_bitop fst2 S S
|
---|
584 | bit_xor bitwise xor (^) ck_bitop fst2 S S
|
---|
585 | bit_or bitwise or (|) ck_bitop fst2 S S
|
---|
586 |
|
---|
587 | negate negation (-) ck_null Ifst1 S
|
---|
588 | i_negate integer negation (-) ck_null ifsT1 S
|
---|
589 | not not ck_null ifs1 S
|
---|
590 | complement 1's complement (~) ck_bitop fst1 S
|
---|
591 |
|
---|
592 | # High falutin' math.
|
---|
593 |
|
---|
594 | atan2 atan2 ck_fun fsT@ S S
|
---|
595 | sin sin ck_fun fsTu% S?
|
---|
596 | cos cos ck_fun fsTu% S?
|
---|
597 | rand rand ck_fun sT% S?
|
---|
598 | srand srand ck_fun s% S?
|
---|
599 | exp exp ck_fun fsTu% S?
|
---|
600 | log log ck_fun fsTu% S?
|
---|
601 | sqrt sqrt ck_fun fsTu% S?
|
---|
602 |
|
---|
603 | # Lowbrow math.
|
---|
604 |
|
---|
605 | int int ck_fun fsTu% S?
|
---|
606 | hex hex ck_fun fsTu% S?
|
---|
607 | oct oct ck_fun fsTu% S?
|
---|
608 | abs abs ck_fun fsTu% S?
|
---|
609 |
|
---|
610 | # String stuff.
|
---|
611 |
|
---|
612 | length length ck_lengthconst isTu% S?
|
---|
613 | substr substr ck_substr st@ S S S? S?
|
---|
614 | vec vec ck_fun ist@ S S S
|
---|
615 |
|
---|
616 | index index ck_index isT@ S S S?
|
---|
617 | rindex rindex ck_index isT@ S S S?
|
---|
618 |
|
---|
619 | sprintf sprintf ck_fun mst@ S L
|
---|
620 | formline formline ck_fun ms@ S L
|
---|
621 | ord ord ck_fun ifsTu% S?
|
---|
622 | chr chr ck_fun fsTu% S?
|
---|
623 | crypt crypt ck_fun fsT@ S S
|
---|
624 | ucfirst ucfirst ck_fun fstu% S?
|
---|
625 | lcfirst lcfirst ck_fun fstu% S?
|
---|
626 | uc uc ck_fun fstu% S?
|
---|
627 | lc lc ck_fun fstu% S?
|
---|
628 | quotemeta quotemeta ck_fun fstu% S?
|
---|
629 |
|
---|
630 | # Arrays.
|
---|
631 |
|
---|
632 | rv2av array dereference ck_rvconst dt1
|
---|
633 | aelemfast constant array element ck_null s$ A S
|
---|
634 | aelem array element ck_null s2 A S
|
---|
635 | aslice array slice ck_null m@ A L
|
---|
636 |
|
---|
637 | # Hashes.
|
---|
638 |
|
---|
639 | each each ck_fun % H
|
---|
640 | values values ck_fun t% H
|
---|
641 | keys keys ck_fun t% H
|
---|
642 | delete delete ck_delete % S
|
---|
643 | exists exists ck_exists is% S
|
---|
644 | rv2hv hash dereference ck_rvconst dt1
|
---|
645 | helem hash element ck_null s2@ H S
|
---|
646 | hslice hash slice ck_null m@ H L
|
---|
647 |
|
---|
648 | # Explosives and implosives.
|
---|
649 |
|
---|
650 | unpack unpack ck_fun @ S S
|
---|
651 | pack pack ck_fun mst@ S L
|
---|
652 | split split ck_split t@ S S S
|
---|
653 | join join or string ck_join mst@ S L
|
---|
654 |
|
---|
655 | # List operators.
|
---|
656 |
|
---|
657 | list list ck_null m@ L
|
---|
658 | lslice list slice ck_null 2 H L L
|
---|
659 | anonlist anonymous list ([]) ck_fun ms@ L
|
---|
660 | anonhash anonymous hash ({}) ck_fun ms@ L
|
---|
661 |
|
---|
662 | splice splice ck_fun m@ A S? S? L
|
---|
663 | push push ck_fun imsT@ A L
|
---|
664 | pop pop ck_shift s% A?
|
---|
665 | shift shift ck_shift s% A?
|
---|
666 | unshift unshift ck_fun imsT@ A L
|
---|
667 | sort sort ck_sort m@ C? L
|
---|
668 | reverse reverse ck_fun mt@ L
|
---|
669 |
|
---|
670 | grepstart grep ck_grep dm@ C L
|
---|
671 | grepwhile grep iterator ck_null dt|
|
---|
672 |
|
---|
673 | mapstart map ck_grep dm@ C L
|
---|
674 | mapwhile map iterator ck_null dt|
|
---|
675 |
|
---|
676 | # Range stuff.
|
---|
677 |
|
---|
678 | range flipflop ck_null | S S
|
---|
679 | flip range (or flip) ck_null 1 S S
|
---|
680 | flop range (or flop) ck_null 1
|
---|
681 |
|
---|
682 | # Control.
|
---|
683 |
|
---|
684 | and logical and (&&) ck_null |
|
---|
685 | or logical or (||) ck_null |
|
---|
686 | xor logical xor ck_null fs2 S S
|
---|
687 | cond_expr conditional expression ck_null d|
|
---|
688 | andassign logical and assignment (&&=) ck_null s|
|
---|
689 | orassign logical or assignment (||=) ck_null s|
|
---|
690 |
|
---|
691 | method method lookup ck_method d1
|
---|
692 | entersub subroutine entry ck_subr dmt1 L
|
---|
693 | leavesub subroutine exit ck_null 1
|
---|
694 | leavesublv lvalue subroutine return ck_null 1
|
---|
695 | caller caller ck_fun t% S?
|
---|
696 | warn warn ck_fun imst@ L
|
---|
697 | die die ck_die dimst@ L
|
---|
698 | reset symbol reset ck_fun is% S?
|
---|
699 |
|
---|
700 | lineseq line sequence ck_null @
|
---|
701 | nextstate next statement ck_null s;
|
---|
702 | dbstate debug next statement ck_null s;
|
---|
703 | unstack iteration finalizer ck_null s0
|
---|
704 | enter block entry ck_null 0
|
---|
705 | leave block exit ck_null @
|
---|
706 | scope block ck_null @
|
---|
707 | enteriter foreach loop entry ck_null d{
|
---|
708 | iter foreach loop iterator ck_null 0
|
---|
709 | enterloop loop entry ck_null d{
|
---|
710 | leaveloop loop exit ck_null 2
|
---|
711 | return return ck_return dm@ L
|
---|
712 | last last ck_null ds}
|
---|
713 | next next ck_null ds}
|
---|
714 | redo redo ck_null ds}
|
---|
715 | dump dump ck_null ds}
|
---|
716 | goto goto ck_null ds}
|
---|
717 | exit exit ck_exit ds% S?
|
---|
718 | # continued below
|
---|
719 |
|
---|
720 | #nswitch numeric switch ck_null d
|
---|
721 | #cswitch character switch ck_null d
|
---|
722 |
|
---|
723 | # I/O.
|
---|
724 |
|
---|
725 | open open ck_open ismt@ F S? L
|
---|
726 | close close ck_fun is% F?
|
---|
727 | pipe_op pipe ck_fun is@ F F
|
---|
728 |
|
---|
729 | fileno fileno ck_fun ist% F
|
---|
730 | umask umask ck_fun ist% S?
|
---|
731 | binmode binmode ck_fun s@ F S?
|
---|
732 |
|
---|
733 | tie tie ck_fun idms@ R S L
|
---|
734 | untie untie ck_fun is% R
|
---|
735 | tied tied ck_fun s% R
|
---|
736 | dbmopen dbmopen ck_fun is@ H S S
|
---|
737 | dbmclose dbmclose ck_fun is% H
|
---|
738 |
|
---|
739 | sselect select system call ck_select t@ S S S S
|
---|
740 | select select ck_select st@ F?
|
---|
741 |
|
---|
742 | getc getc ck_eof st% F?
|
---|
743 | read read ck_fun imst@ F R S S?
|
---|
744 | enterwrite write ck_fun dis% F?
|
---|
745 | leavewrite write exit ck_null 1
|
---|
746 |
|
---|
747 | prtf printf ck_listiob ims@ F? L
|
---|
748 | print print ck_listiob ims@ F? L
|
---|
749 |
|
---|
750 | sysopen sysopen ck_fun s@ F S S S?
|
---|
751 | sysseek sysseek ck_fun s@ F S S
|
---|
752 | sysread sysread ck_fun imst@ F R S S?
|
---|
753 | syswrite syswrite ck_fun imst@ F S S? S?
|
---|
754 |
|
---|
755 | send send ck_fun imst@ Fs S S S?
|
---|
756 | recv recv ck_fun imst@ Fs R S S
|
---|
757 |
|
---|
758 | eof eof ck_eof is% F?
|
---|
759 | tell tell ck_fun st% F?
|
---|
760 | seek seek ck_fun s@ F S S
|
---|
761 | # truncate really behaves as if it had both "S S" and "F S"
|
---|
762 | truncate truncate ck_trunc is@ S S
|
---|
763 |
|
---|
764 | fcntl fcntl ck_fun st@ F S S
|
---|
765 | ioctl ioctl ck_fun st@ F S S
|
---|
766 | flock flock ck_fun isT@ F S
|
---|
767 |
|
---|
768 | # Sockets.
|
---|
769 |
|
---|
770 | socket socket ck_fun is@ Fs S S S
|
---|
771 | sockpair socketpair ck_fun is@ Fs Fs S S S
|
---|
772 |
|
---|
773 | bind bind ck_fun is@ Fs S
|
---|
774 | connect connect ck_fun is@ Fs S
|
---|
775 | listen listen ck_fun is@ Fs S
|
---|
776 | accept accept ck_fun ist@ Fs Fs
|
---|
777 | shutdown shutdown ck_fun ist@ Fs S
|
---|
778 |
|
---|
779 | gsockopt getsockopt ck_fun is@ Fs S S
|
---|
780 | ssockopt setsockopt ck_fun is@ Fs S S S
|
---|
781 |
|
---|
782 | getsockname getsockname ck_fun is% Fs
|
---|
783 | getpeername getpeername ck_fun is% Fs
|
---|
784 |
|
---|
785 | # Stat calls.
|
---|
786 |
|
---|
787 | lstat lstat ck_ftst u- F
|
---|
788 | stat stat ck_ftst u- F
|
---|
789 | ftrread -R ck_ftst isu- F-
|
---|
790 | ftrwrite -W ck_ftst isu- F-
|
---|
791 | ftrexec -X ck_ftst isu- F-
|
---|
792 | fteread -r ck_ftst isu- F-
|
---|
793 | ftewrite -w ck_ftst isu- F-
|
---|
794 | fteexec -x ck_ftst isu- F-
|
---|
795 | ftis -e ck_ftst isu- F-
|
---|
796 | fteowned -o ck_ftst isu- F-
|
---|
797 | ftrowned -O ck_ftst isu- F-
|
---|
798 | ftzero -z ck_ftst isu- F-
|
---|
799 | ftsize -s ck_ftst istu- F-
|
---|
800 | ftmtime -M ck_ftst stu- F-
|
---|
801 | ftatime -A ck_ftst stu- F-
|
---|
802 | ftctime -C ck_ftst stu- F-
|
---|
803 | ftsock -S ck_ftst isu- F-
|
---|
804 | ftchr -c ck_ftst isu- F-
|
---|
805 | ftblk -b ck_ftst isu- F-
|
---|
806 | ftfile -f ck_ftst isu- F-
|
---|
807 | ftdir -d ck_ftst isu- F-
|
---|
808 | ftpipe -p ck_ftst isu- F-
|
---|
809 | ftlink -l ck_ftst isu- F-
|
---|
810 | ftsuid -u ck_ftst isu- F-
|
---|
811 | ftsgid -g ck_ftst isu- F-
|
---|
812 | ftsvtx -k ck_ftst isu- F-
|
---|
813 | fttty -t ck_ftst is- F-
|
---|
814 | fttext -T ck_ftst isu- F-
|
---|
815 | ftbinary -B ck_ftst isu- F-
|
---|
816 |
|
---|
817 | # File calls.
|
---|
818 |
|
---|
819 | chdir chdir ck_fun isT% S?
|
---|
820 | chown chown ck_fun imsT@ L
|
---|
821 | chroot chroot ck_fun isTu% S?
|
---|
822 | unlink unlink ck_fun imsTu@ L
|
---|
823 | chmod chmod ck_fun imsT@ L
|
---|
824 | utime utime ck_fun imsT@ L
|
---|
825 | rename rename ck_fun isT@ S S
|
---|
826 | link link ck_fun isT@ S S
|
---|
827 | symlink symlink ck_fun isT@ S S
|
---|
828 | readlink readlink ck_fun stu% S?
|
---|
829 | mkdir mkdir ck_fun isT@ S S?
|
---|
830 | rmdir rmdir ck_fun isTu% S?
|
---|
831 |
|
---|
832 | # Directory calls.
|
---|
833 |
|
---|
834 | open_dir opendir ck_fun is@ F S
|
---|
835 | readdir readdir ck_fun % F
|
---|
836 | telldir telldir ck_fun st% F
|
---|
837 | seekdir seekdir ck_fun s@ F S
|
---|
838 | rewinddir rewinddir ck_fun s% F
|
---|
839 | closedir closedir ck_fun is% F
|
---|
840 |
|
---|
841 | # Process control.
|
---|
842 |
|
---|
843 | fork fork ck_null ist0
|
---|
844 | wait wait ck_null isT0
|
---|
845 | waitpid waitpid ck_fun isT@ S S
|
---|
846 | system system ck_exec imsT@ S? L
|
---|
847 | exec exec ck_exec dimsT@ S? L
|
---|
848 | kill kill ck_fun dimsT@ L
|
---|
849 | getppid getppid ck_null isT0
|
---|
850 | getpgrp getpgrp ck_fun isT% S?
|
---|
851 | setpgrp setpgrp ck_fun isT@ S? S?
|
---|
852 | getpriority getpriority ck_fun isT@ S S
|
---|
853 | setpriority setpriority ck_fun isT@ S S S
|
---|
854 |
|
---|
855 | # Time calls.
|
---|
856 |
|
---|
857 | # NOTE: MacOS patches the 'i' of time() away later when the interpreter
|
---|
858 | # is created because in MacOS time() is already returning times > 2**31-1,
|
---|
859 | # that is, non-integers.
|
---|
860 |
|
---|
861 | time time ck_null isT0
|
---|
862 | tms times ck_null 0
|
---|
863 | localtime localtime ck_fun t% S?
|
---|
864 | gmtime gmtime ck_fun t% S?
|
---|
865 | alarm alarm ck_fun istu% S?
|
---|
866 | sleep sleep ck_fun isT% S?
|
---|
867 |
|
---|
868 | # Shared memory.
|
---|
869 |
|
---|
870 | shmget shmget ck_fun imst@ S S S
|
---|
871 | shmctl shmctl ck_fun imst@ S S S
|
---|
872 | shmread shmread ck_fun imst@ S S S S
|
---|
873 | shmwrite shmwrite ck_fun imst@ S S S S
|
---|
874 |
|
---|
875 | # Message passing.
|
---|
876 |
|
---|
877 | msgget msgget ck_fun imst@ S S
|
---|
878 | msgctl msgctl ck_fun imst@ S S S
|
---|
879 | msgsnd msgsnd ck_fun imst@ S S S
|
---|
880 | msgrcv msgrcv ck_fun imst@ S S S S S
|
---|
881 |
|
---|
882 | # Semaphores.
|
---|
883 |
|
---|
884 | semget semget ck_fun imst@ S S S
|
---|
885 | semctl semctl ck_fun imst@ S S S S
|
---|
886 | semop semop ck_fun imst@ S S
|
---|
887 |
|
---|
888 | # Eval.
|
---|
889 |
|
---|
890 | require require ck_require du% S?
|
---|
891 | dofile do "file" ck_fun d1 S
|
---|
892 | entereval eval "string" ck_eval d% S
|
---|
893 | leaveeval eval "string" exit ck_null 1 S
|
---|
894 | #evalonce eval constant string ck_null d1 S
|
---|
895 | entertry eval {block} ck_null |
|
---|
896 | leavetry eval {block} exit ck_null @
|
---|
897 |
|
---|
898 | # Get system info.
|
---|
899 |
|
---|
900 | ghbyname gethostbyname ck_fun % S
|
---|
901 | ghbyaddr gethostbyaddr ck_fun @ S S
|
---|
902 | ghostent gethostent ck_null 0
|
---|
903 | gnbyname getnetbyname ck_fun % S
|
---|
904 | gnbyaddr getnetbyaddr ck_fun @ S S
|
---|
905 | gnetent getnetent ck_null 0
|
---|
906 | gpbyname getprotobyname ck_fun % S
|
---|
907 | gpbynumber getprotobynumber ck_fun @ S
|
---|
908 | gprotoent getprotoent ck_null 0
|
---|
909 | gsbyname getservbyname ck_fun @ S S
|
---|
910 | gsbyport getservbyport ck_fun @ S S
|
---|
911 | gservent getservent ck_null 0
|
---|
912 | shostent sethostent ck_fun is% S
|
---|
913 | snetent setnetent ck_fun is% S
|
---|
914 | sprotoent setprotoent ck_fun is% S
|
---|
915 | sservent setservent ck_fun is% S
|
---|
916 | ehostent endhostent ck_null is0
|
---|
917 | enetent endnetent ck_null is0
|
---|
918 | eprotoent endprotoent ck_null is0
|
---|
919 | eservent endservent ck_null is0
|
---|
920 | gpwnam getpwnam ck_fun % S
|
---|
921 | gpwuid getpwuid ck_fun % S
|
---|
922 | gpwent getpwent ck_null 0
|
---|
923 | spwent setpwent ck_null is0
|
---|
924 | epwent endpwent ck_null is0
|
---|
925 | ggrnam getgrnam ck_fun % S
|
---|
926 | ggrgid getgrgid ck_fun % S
|
---|
927 | ggrent getgrent ck_null 0
|
---|
928 | sgrent setgrent ck_null is0
|
---|
929 | egrent endgrent ck_null is0
|
---|
930 | getlogin getlogin ck_null st0
|
---|
931 |
|
---|
932 | # Miscellaneous.
|
---|
933 |
|
---|
934 | syscall syscall ck_fun imst@ S L
|
---|
935 |
|
---|
936 | # For multi-threading
|
---|
937 | lock lock ck_rfun s% R
|
---|
938 | threadsv per-thread value ck_null ds0
|
---|
939 |
|
---|
940 | # Control (contd.)
|
---|
941 | setstate set statement info ck_null s;
|
---|
942 | method_named method with known name ck_null d$
|
---|
943 |
|
---|
944 | # Add new ops before this, the custom operator.
|
---|
945 |
|
---|
946 | custom unknown custom operator ck_null 0
|
---|