op.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* op.h
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
* 2000, 2001, 2002, 2003, 2004, by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
/*
* The fields of BASEOP are:
* op_next Pointer to next ppcode to execute after this one.
* (Top level pre-grafted op points to first op,
* but this is replaced when op is grafted in, when
* this op will point to the real next op, and the new
* parent takes over role of remembering starting op.)
* op_ppaddr Pointer to current ppcode's function.
* op_type The type of the operation.
* op_flags Flags common to all operations. See OPf_* below.
* op_private Flags peculiar to a particular operation (BUT,
* by default, set to the number of children until
* the operation is privatized by a check routine,
* which may or may not check number of children).
*/
#ifdef DEBUGGING_OPS
#else
#endif
#ifdef BASEOP_DEFINITION
#define BASEOP BASEOP_DEFINITION
#else
#define BASEOP \
OP* op_sibling; \
#endif
dfl)
/*
=head1 "Gimme" Values
=for apidoc Amn|U32|GIMME_V
The XSUB-writer's equivalent to Perl's C<wantarray>. Returns C<G_VOID>,
C<G_SCALAR> or C<G_ARRAY> for void, scalar or list context,
respectively.
=for apidoc Amn|U32|GIMME
A backward-compatible version of C<GIMME_V> which can only return
C<G_SCALAR> or C<G_ARRAY>; in a void context, it returns C<G_SCALAR>.
Deprecated. Use C<GIMME_V> instead.
=cut
*/
/* Public flags */
/* (Or block needs explicit scope entry.) */
/* (Return container, not containee). */
/* On local LVAL, don't init local value. */
/* On OP_SORT, subroutine is inlined. */
/* On OP_NOT, inversion was implicit. */
/* On OP_LEAVE, don't restore curpm. */
/* On truncate, we truncate filehandle */
/* On control verbs, we saw no label */
/* On flipflop, we saw ... instead of .. */
/* On UNOPs, saw bare parens, e.g. eof(). */
/* On OP_ENTERSUB || OP_NULL, saw a "do". */
/* On OP_EXISTS, treat av as av, not avhv. */
/* On OP_(ENTER|LEAVE)EVAL, don't clear $@ */
/* On OP_ENTERITER, loop var is per-thread */
/* On pushre, re is /\s+/ imp. by split " " */
/* On regcomp, "use re 'eval'" was in scope */
/* On OP_READLINE, was <$filehandle> */
/* On RV2[SG]V, don't create GV--in defined()*/
/* On OP_DBSTATE, indicates breakpoint
* (runtime property) */
/* On OP_AELEMFAST, indiciates pad var */
/* old names; don't use in new code, but don't break them, either */
#define OPf_LIST OPf_WANT_LIST
#define GIMME \
? G_ARRAY \
: G_SCALAR) \
: dowantarray())
/* NOTE: OP_NEXTSTATE, OP_DBSTATE, and OP_SETSTATE (i.e. COPs) carry lower
* bits of PL_hints in op_private */
/* Private for lvalues */
/* Private for OP_LEAVE, OP_LEAVESUB, OP_LEAVESUBLV and OP_LEAVEWRITE */
/* Private for OP_AASSIGN */
/* Private for OP_SASSIGN */
/* Private for OP_MATCH and OP_SUBST{,CONST} */
/* Private for OP_TRANS */
#define OPpTRANS_FROM_UTF 1
#define OPpTRANS_TO_UTF 2
#define OPpTRANS_SQUASH 8
#define OPpTRANS_DELETE 16
#define OPpTRANS_COMPLEMENT 32
#define OPpTRANS_GROWS 64
/* Private for OP_REPEAT */
/* Private for OP_RV2GV, OP_RV2SV, OP_AELEM, OP_HELEM, OP_PADSV */
/* OP_ENTERSUB only */
/* OP_RV2CV only */
/* OP_GV only */
/* OP_?ELEM only */
/* OP_RV2?V, OP_GVSV, OP_ENTERITER only */
/* OP_RV2[AH]V, OP_PAD[AH]V, OP_[AH]ELEM */
/* for OP_RV2?V, lower bits carry hints (currently only HINT_STRICT_REFS) */
/* Private for OPs with TARGLEX */
/* (lower bits may carry MAXARG) */
/* Private for OP_CONST */
/* Private for OP_LIST */
/* Private for OP_DELETE */
/* Private for OP_EXISTS */
/* Private for OP_SORT */
/* Private for OP_THREADSV */
/* Private for OP_OPEN and OP_BACKTICK */
/* Private for OP_EXIT, HUSH also for OP_DIE */
/* Private of OP_FTXXX */
#define OP_IS_FILETEST_ACCESS(op) \
struct op {
};
struct unop {
};
struct binop {
};
struct logop {
};
struct listop {
};
struct pmop {
OP * op_pmreplroot;
OP * op_pmreplstart;
#ifdef USE_ITHREADS
#else
#endif
#ifdef USE_ITHREADS
char * op_pmstashpv;
#else
HV * op_pmstash;
#endif
};
#ifdef USE_ITHREADS
#define PM_SETRE(o,r) STMT_START { SV* sv = PL_regex_pad[(o)->op_pmoffset]; sv_setiv(sv, PTR2IV(r)); } STMT_END
#else
#define PM_GETRE(o) ((o)->op_pmregexp)
#define PM_SETRE(o,r) ((o)->op_pmregexp = (r))
#define PM_GETRE_SAFE PM_GETRE
#define PM_SETRE_SAFE PM_SETRE
#endif
#define PMdf_DYN_UTF8 0x08
/* mask of bits stored in regexp->reganch */
#ifdef USE_ITHREADS
# define PmopSTASHPV(o) ((o)->op_pmstashpv)
# define PmopSTASH(o) (PmopSTASHPV(o) \
#else
# define PmopSTASH(o) ((o)->op_pmstash)
/* op_pmstash is not refcounted */
# define PmopSTASH_free(o)
#endif
struct svop {
};
struct padop {
};
struct pvop {
char * op_pv;
};
struct loop {
};
#ifdef USE_ITHREADS
# define IS_PADCONST(v) (v && SvREADONLY(v))
#else
# define IS_PADCONST(v) FALSE
#endif
/* Lowest byte-and-a-bit of PL_opargs */
#define OA_MARK 1
#define OA_FOLDCONST 2
#define OA_RETSCALAR 4
#define OA_TARGET 8
#define OA_RETINTEGER 16
#define OA_OTHERINT 32
#define OA_DANGEROUS 64
#define OA_DEFGV 128
#define OA_TARGLEX 256
/* The next 4 bits encode op class information */
#define OCSHIFT 9
#define OASHIFT 13
/* Remaining nybbles of PL_opargs */
#define OA_SCALAR 1
#define OA_LIST 2
#define OA_AVREF 3
#define OA_HVREF 4
#define OA_CVREF 5
#define OA_FILEREF 6
#define OA_SCALARREF 7
#define OA_OPTIONAL 8
#ifdef USE_ITHREADS
#else
# define OP_REFCNT_INIT NOOP
# define OP_REFCNT_LOCK NOOP
# define OP_REFCNT_UNLOCK NOOP
# define OP_REFCNT_TERM NOOP
#endif
#define OpREFCNT_set(o,n) ((o)->op_targ = (n))
#define OpREFCNT_dec(o) (--(o)->op_targ)
/* flags used by Perl_load_module() */
#define PERL_LOADMOD_DENY 0x1
#define PERL_LOADMOD_NOIMPORT 0x2
#define PERL_LOADMOD_IMPORT_OPS 0x4
#ifdef USE_REENTRANT_API
#include "reentr.h"
#endif
#if defined(PL_OP_SLAB_ALLOC)
#else
#endif