From: Nicholas Clark Date: Tue, 7 Mar 2006 23:24:55 +0000 (+0000) Subject: Some of the MAD structures in headers, plus PL_madskills and PL_xmlfp, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=598921a7d8d43baa942b750d26a55dadca2c13d5;p=p5sagit%2Fp5-mst-13.2.git Some of the MAD structures in headers, plus PL_madskills and PL_xmlfp, and default definitions for the 2 variables. (Which will save a lot of conditional complilation, by instead letting the C compiler optimiser remove dead code.) p4raw-id: //depot/perl@27408 --- diff --git a/XSUB.h b/XSUB.h index 9f881a2..a137c42 100644 --- a/XSUB.h +++ b/XSUB.h @@ -398,6 +398,12 @@ Rethrows a previously caught exception. See L. #endif #include "perlapi.h" +#ifndef PERL_MAD +# undef PL_madskills +# undef PL_xmlfp +# define PL_madskills 0 +# define PL_xmlfp 0 +#endif #if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_GET_CONTEXT) && !defined(PERL_CORE) # undef aTHX diff --git a/embedvar.h b/embedvar.h index 022dce8..1827ad3 100644 --- a/embedvar.h +++ b/embedvar.h @@ -298,6 +298,7 @@ #define PL_linestr (vTHX->Ilinestr) #define PL_localpatches (vTHX->Ilocalpatches) #define PL_lockhook (vTHX->Ilockhook) +#define PL_madskills (vTHX->Imadskills) #define PL_main_cv (vTHX->Imain_cv) #define PL_main_root (vTHX->Imain_root) #define PL_main_start (vTHX->Imain_start) @@ -434,6 +435,7 @@ #define PL_uudmap (vTHX->Iuudmap) #define PL_warnhook (vTHX->Iwarnhook) #define PL_widesyscalls (vTHX->Iwidesyscalls) +#define PL_xmlfp (vTHX->Ixmlfp) #define PL_yycharp (vTHX->Iyycharp) #define PL_yylvalp (vTHX->Iyylvalp) @@ -579,6 +581,7 @@ #define PL_Ilinestr PL_linestr #define PL_Ilocalpatches PL_localpatches #define PL_Ilockhook PL_lockhook +#define PL_Imadskills PL_madskills #define PL_Imain_cv PL_main_cv #define PL_Imain_root PL_main_root #define PL_Imain_start PL_main_start @@ -715,6 +718,7 @@ #define PL_Iuudmap PL_uudmap #define PL_Iwarnhook PL_warnhook #define PL_Iwidesyscalls PL_widesyscalls +#define PL_Ixmlfp PL_xmlfp #define PL_Iyycharp PL_yycharp #define PL_Iyylvalp PL_yylvalp diff --git a/intrpvar.h b/intrpvar.h index 76be01d..7db6b73 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -439,6 +439,12 @@ PERLVAR(Ireentrant_buffer, REENTR*) /* here we store the _r buffers */ PERLVARI(Isavebegin, bool, FALSE) /* save BEGINs for compiler */ +#ifdef PERL_MAD +PERLVARI(Imadskills, bool, FALSE) /* preserve all syntactic info */ + /* (MAD = Misc Attribute Decoration) */ +PERLVARI(Ixmlfp, PerlIO *,NULL) +#endif + PERLVAR(Icustom_op_names, HV*) /* Names of user defined ops */ PERLVAR(Icustom_op_descs, HV*) /* Descriptions of user defined ops */ diff --git a/op.h b/op.h index cbf86a0..e38c578 100644 --- a/op.h +++ b/op.h @@ -36,6 +36,12 @@ #define OPCODE U16 #endif +#ifdef PERL_MAD +# define MADPROP_IN_BASEOP MADPROP* op_madprop; +#else +# define MADPROP_IN_BASEOP +#endif + #ifdef BASEOP_DEFINITION #define BASEOP BASEOP_DEFINITION #else @@ -43,6 +49,7 @@ OP* op_next; \ OP* op_sibling; \ OP* (CPERLscope(*op_ppaddr))(pTHX); \ + MADPROP_IN_BASEOP \ PADOFFSET op_targ; \ unsigned op_type:9; \ unsigned op_opt:1; \ @@ -549,3 +556,25 @@ struct loop { (var = (OP*)safemalloc(size), memzero(var, size)) #define FreeOp(p) Safefree(p) #endif + +#ifdef PERL_MAD +# define MAD_NULL 1 +# define MAD_PV 2 +# define MAD_OP 3 +# define MAD_SV 4 + +struct madprop { + MADPROP* mad_next; + void *mad_val; + U32 mad_vlen; +/* short mad_count; */ + char mad_key; + char mad_type; +}; + +struct token { + I32 tk_type; + YYSTYPE tk_lval; + MADPROP* tk_mad; +}; +#endif diff --git a/perl.h b/perl.h index 565ad63..51a16ad 100644 --- a/perl.h +++ b/perl.h @@ -2141,6 +2141,11 @@ struct RExC_state_t; typedef MEM_SIZE STRLEN; +#ifdef PERL_MAD +typedef struct token TOKEN; +typedef struct madprop MADPROP; +typedef struct nexttoken NEXTTOKE; +#endif typedef struct op OP; typedef struct cop COP; typedef struct unop UNOP; @@ -3062,6 +3067,23 @@ typedef struct crypt_data { /* straight from /usr/include/crypt.h */ # define USE_HASH_SEED #endif +/* Win32 defines a type 'WORD' in windef.h. This conflicts with the enumerator + * 'WORD' defined in perly.h. The yytokentype enum is only a debugging aid, so + * it's not really needed. + */ +#if defined(WIN32) +# define YYTOKENTYPE +#endif +#include "perly.h" + +#ifdef PERL_MAD +struct nexttoken { + YYSTYPE next_val; /* value of next token, if any */ + I32 next_type; /* type of next token */ + MADPROP *next_mad; /* everything else about that token */ +}; +#endif + #include "regexp.h" #include "sv.h" #include "util.h" @@ -4080,15 +4102,6 @@ END_EXTERN_C #endif #endif -/* Win32 defines a type 'WORD' in windef.h. This conflicts with the enumerator - * 'WORD' defined in perly.h. The yytokentype enum is only a debugging aid, so - * it's not really needed. - */ -#if defined(WIN32) -# define YYTOKENTYPE -#endif -#include "perly.h" - #define LEX_NOTPARSING 11 /* borrowed from toke.c */ typedef enum { @@ -4321,6 +4334,12 @@ struct tempsym; /* defined in pp_pack.c */ #if !defined(PERL_FOR_X2P) # include "embedvar.h" #endif +#ifndef PERL_MAD +# undef PL_madskills +# undef PL_xmlfp +# define PL_madskills 0 +# define PL_xmlfp 0 +#endif /* Now include all the 'global' variables * If we don't have threads or multiple interpreters diff --git a/perlapi.h b/perlapi.h index fa28363..ae4d932 100644 --- a/perlapi.h +++ b/perlapi.h @@ -394,6 +394,8 @@ END_EXTERN_C #define PL_localpatches (*Perl_Ilocalpatches_ptr(aTHX)) #undef PL_lockhook #define PL_lockhook (*Perl_Ilockhook_ptr(aTHX)) +#undef PL_madskills +#define PL_madskills (*Perl_Imadskills_ptr(aTHX)) #undef PL_main_cv #define PL_main_cv (*Perl_Imain_cv_ptr(aTHX)) #undef PL_main_root @@ -666,6 +668,8 @@ END_EXTERN_C #define PL_warnhook (*Perl_Iwarnhook_ptr(aTHX)) #undef PL_widesyscalls #define PL_widesyscalls (*Perl_Iwidesyscalls_ptr(aTHX)) +#undef PL_xmlfp +#define PL_xmlfp (*Perl_Ixmlfp_ptr(aTHX)) #undef PL_yycharp #define PL_yycharp (*Perl_Iyycharp_ptr(aTHX)) #undef PL_yylvalp