X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FOpcode%2FOpcode.pm;h=6c4e8e575a5a09290c9546810008d1c34d5d68fe;hb=bd5cf8491554ab1313db72afbf9e7bc1debe967c;hp=1675d469b199777d0e6516ee10880527a0e4ed2b;hpb=7a57407b1288d76f6c818932590e11ca30c87d6f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 1675d46..6c4e8e5 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -1,18 +1,20 @@ package Opcode; -require 5.002; +use 5.006_001; -use vars qw($VERSION @ISA @EXPORT_OK); +use strict; -$VERSION = "1.01"; +our($VERSION, $XS_VERSION, @ISA, @EXPORT_OK); + +$VERSION = "1.05"; +$XS_VERSION = "1.03"; -use strict; use Carp; use Exporter (); -use DynaLoader (); -@ISA = qw(Exporter DynaLoader); +use XSLoader (); BEGIN { + @ISA = qw(Exporter); @EXPORT_OK = qw( opset ops_to_opset opset_to_ops opset_to_hex invert_opset @@ -22,15 +24,16 @@ BEGIN { ); } +sub opset (;@); +sub opset_to_hex ($); +sub opdump (;$); use subs @EXPORT_OK; -bootstrap Opcode $VERSION; +XSLoader::load 'Opcode', $XS_VERSION; _init_optags(); - -*ops_to_opset = \&opset; # alias for old name - +sub ops_to_opset { opset @_ } # alias for old name sub opset_to_hex ($) { return "(invalid opset)" unless verify_opset($_[0]); @@ -128,7 +131,7 @@ Your mileage will vary. If in any doubt B. =head1 Operator Names and Operator Lists The canonical list of operator names is the contents of the array -op_name defined and initialised in file F of the Perl +PL_op_name defined and initialised in file F of the Perl source distribution (and installed into the perl library). Each operator has both a terse name (its opname) and a more verbose or @@ -150,7 +153,7 @@ like gv2cv, i_ncmp and ftsvtx. =item an operator tag name (optag) Operator tags can be used to refer to groups (or sets) of operators. -Tag names always being with a colon. The Opcode module defines several +Tag names always begin with a colon. The Opcode module defines several optags and the user can define others using the define_optag function. =item a negated opname or optag @@ -161,7 +164,7 @@ accumulated set of ops at that point. =item an operator set (opset) -An I as a binary string of approximately 43 bytes which holds a +An I as a binary string of approximately 44 bytes which holds a set or zero or more operators. The opset and opset_to_ops functions can be used to convert from @@ -183,7 +186,7 @@ tags and sets. All are available for export by the package. =item opcodes In a scalar context opcodes returns the number of opcodes in this -version of perl (around 340 for perl5.002). +version of perl (around 350 for perl-5.7.0). In a list context it returns a list of all the operator names. (Not yet implemented, use @names = opset_to_ops(full_opset).) @@ -324,17 +327,17 @@ invert_opset function. ucfirst lcfirst uc lc quotemeta trans chop schop chomp schomp - match split + match split qr list lslice splice push pop shift unshift reverse - cond_expr flip flop andassign orassign and or xor + cond_expr flip flop andassign orassign dorassign and or dor xor - warn die lineseq nextstate unstack scope enter leave + warn die lineseq nextstate scope enter leave setstate rv2cv anoncode prototype - entersub leavesub return method -- XXX loops via recursion? + entersub leavesub leavesublv return method method_named -- XXX loops via recursion? leaveeval -- needed for Safe to operate, is safe without entereval @@ -363,7 +366,7 @@ used to implement a resource attack (e.g., consume all available CPU time). grepstart grepwhile mapstart mapwhile enteriter iter - enterloop leaveloop + enterloop leaveloop unstack last next redo goto @@ -378,7 +381,9 @@ such as open would need to be enabled. formline enterwrite leavewrite - print sysread syswrite send recv eof tell seek + print sysread syswrite send recv + + eof tell seek sysseek readdir telldir seekdir rewinddir @@ -394,7 +399,7 @@ These are a hotchpotch of opcodes still waiting to be considered bless -- could be used to change ownership of objects (reblessing) - pushre regcmaybe regcomp subst substcont + pushre regcmaybe regcreset regcomp subst substcont sprintf prtf -- can core dump @@ -410,6 +415,8 @@ These are a hotchpotch of opcodes still waiting to be considered entertry leavetry -- can be used to 'hide' fatal errors + custom -- where should this go + =item :base_math These ops are not included in :base_core because of the risk of them being @@ -423,12 +430,18 @@ beyond the scope of the compartment. rand srand +=item :base_thread + +These ops are related to multi-threading. + + lock threadsv + =item :default A handy tag name for a I default set of ops. (The current ops allowed are unstable while development continues. It will change.) - :base_core :base_mem :base_loop :base_io :base_orig + :base_core :base_mem :base_loop :base_io :base_orig :base_thread If safety matters to you (and why else would you be using the Opcode module?) then you should not rely on the definition of this, or indeed any other, optag! @@ -559,7 +572,7 @@ Originally designed and implemented by Malcolm Beattie, mbeattie@sable.ox.ac.uk as part of Safe version 1. Split out from Safe module version 1, named opcode tags and other -changes added by Tim Bunce EFE. +changes added by Tim Bunce. =cut