diff options
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 41 |
1 files changed, 35 insertions, 6 deletions
@@ -10,8 +10,13 @@ struct cop { BASEOP char * cop_label; /* label for this construct */ +#ifdef USE_ITHREADS + char * cop_stashpv; /* package line was compiled in */ + char * cop_file; /* file name the following line # is from */ +#else HV * cop_stash; /* package line was compiled in */ GV * cop_filegv; /* file the following line # is from */ +#endif U32 cop_seq; /* parse sequence number */ I32 cop_arybase; /* array base this line was compiled with */ line_t cop_line; /* line # of this command */ @@ -20,13 +25,37 @@ struct cop { #define Nullcop Null(COP*) -#define CopFILEGV(c) (c)->cop_filegv -#define CopFILEGV_set(c,gv) ((c)->cop_filegv = gv) -#define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) -#define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) -#define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) +#ifdef USE_ITHREADS +# define CopFILE(c) ((c)->cop_file) +# define CopFILEGV(c) (CopFILE(c) \ + ? gv_fetchfile(CopFILE(c)) : Nullgv) +# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) /* XXX */ +# define CopFILESV(c) (CopFILE(c) \ + ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) +# define CopFILEAV(c) (CopFILE(c) \ + ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) +# define CopSTASHPV(c) ((c)->cop_stashpv) +# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = savepv(pv)) /* XXX */ +# define CopSTASH(c) (CopSTASHPV(c) \ + ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) +# define CopSTASH_set(c,hv) CopSTASHPV_set(c, HvNAME(hv)) +#else +# define CopFILEGV(c) ((c)->cop_filegv) +# define CopFILEGV_set(c,gv) ((c)->cop_filegv = gv) +# define CopFILE_set(c,pv) ((c)->cop_filegv = gv_fetchfile(pv)) +# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) +# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) +# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) +# define CopSTASH(c) ((c)->cop_stash) +# define CopSTASH_set(c,hv) ((c)->cop_stash = hv) +# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) +# define CopSTASHPV_set(c,pv) CopSTASH_set(c, gv_stashpv(pv,GV_ADD)) +#endif /* USE_ITHREADS */ + #define CopLINE(c) ((c)->cop_line) -#define CopLINE_set(c,l) ((c)->cop_line = (l)) +#define CopLINE_inc(c) (++CopLINE(c)) +#define CopLINE_dec(c) (--CopLINE(c)) +#define CopLINE_set(c,l) (CopLINE(c) = (l)) /* * Here we have some enormously heavy (or at least ponderous) wizardry. |