#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
/* PL_maxo shouldn't differ from MAXO but leave room anyway (see BOOT:) */
/* XXX op_named_bits and opset_all are never freed */
typedef struct {
int x_opcode_debug;
} my_cxt_t;
/* Initialise our private op_named_bits HV.
* It is first loaded with the name and number of each perl operator.
* Then the builtin tags :none and :all are added.
* Opcode.pm loads the standard optags from __DATA__
* XXX leak-alert: data allocated here is never freed, call this
* at most once
*/
static void
{
int i;
char **op_names;
char *bitmap;
op_named_bits = newHV();
op_names = get_op_names();
for(i=0; i < PL_maxo; ++i) {
}
while(i-- > 0)
bitmap[i] = (char)0xFF;
/* Take care to set the right number of bits in the last byte */
}
/* Store a new tag definition. Always a mask.
* The tag must not already be defined.
* SV *mask is copied not referenced.
*/
static void
{
if (!len)
SvREADONLY_on(*svp);
}
* Note that we return the actual entry for speed.
* Always sv_mortalcopy() if returing it to user code.
*/
static SV *
{
if (!len)
if (!fatal)
return Nullsv;
if (*opname == ':')
}
return *svp;
}
static SV *
{
if (old_opset) {
}
else {
(void)SvPOK_only(opset);
}
/* not mortalised here */
return opset;
}
static int
{
}
return !err;
}
static void
{
if (opcode_debug >= 2)
warn("set_opset_bits bit %2d (off=%d, bit=%d) %s %s\n",
if (on)
else
}
if (opcode_debug >= 2)
if (on)
else
}
else
croak("panic: invalid bitspec for \"%s\" (type %u)",
}
static void
{
int i,j;
char *bitmask;
int myopcode = 0;
if (!PL_op_mask) /* caller must ensure PL_op_mask exists */
croak("Can't add to uninitialised PL_op_mask");
/* OPCODES ALREADY MASKED ARE NEVER UNMASKED. See opmask_addlocal() */
for (i=0; i < opset_len; i++) {
if (!bits) { /* optimise for sparse masks */
myopcode += 8;
continue;
}
}
}
static void
{
char *orig_op_mask = PL_op_mask;
/* XXX casting to an ordinary function ptr from a member function ptr
* is disallowed by Borland
*/
if (opcode_debug >= 2)
PL_op_mask = &op_mask_buf[0];
if (orig_op_mask)
else
}
BOOT:
{
if (opcode_debug >= 1)
}
void
char * Package
}
void
char * Package
char op_mask_buf[OP_MASK_BUF_SIZE];
/* the assignment to global defstash changes our sense of 'main' */
/* defstash must itself contain a main:: so we'll add that now */
/* take care with the ref counts (was cause of long standing bug) */
/* XXX I'm still not sure if this is right, GV_ADDWARN should warn! */
SPAGAIN; /* for the PUTBACK added by xsubpp */
int
int fatal
CODE:
void
CODE:
{
char *bitmap;
while(len-- > 0)
/* take care of extra bits beyond PL_maxo in last byte */
if (PL_maxo & 07)
}
void
int desc
{
int i, j, myopcode;
if ( bits & (1 << j) )
}
}
}
void
opset(...)
CODE:
int i;
char *bitmap;
for (i = 0; i < items; i++) {
char *opname;
on = 1;
opname = "(opset)";
}
else {
}
}
void
permit_only(safe, ...)
permit = 1
deny_only = 2
deny = 3
CODE:
int i, on;
croak("Not a Safe object");
if (ONLY_THESE) /* *_only = new mask, else edit current */
else
for (i = 1; i < items; i++) {
opname = "(opset)";
}
/* invert if op has ! prefix (only one allowed) */
}
}
void
opdesc(...)
int i, myopcode;
char **op_desc = get_op_descs();
/* copy args to a scratch area since we may push output values onto */
/* the stack faster than we read values off it if masks are used. */
for (i = 0; i < items; i++) {
}
int b, j;
myopcode = 0;
for (b=0; b < opset_len; b++) {
if (bits & (1 << j))
}
}
else
croak("panic: invalid bitspec for \"%s\" (type %u)",
}
void
CODE:
void
CODE:
void
CODE:
void
if (!PL_op_mask)
CODE:
void
opcodes()
}
else {
}
void
opmask()
CODE:
if (PL_op_mask) {
int myopcode;
if (PL_op_mask[myopcode])
}
}