[svn:parrot] r41681 - trunk/compilers/pirc/src

kjs at svn.parrot.org kjs at svn.parrot.org
Sun Oct 4 11:07:09 UTC 2009


Author: kjs
Date: Sun Oct  4 11:07:09 2009
New Revision: 41681
URL: https://trac.parrot.org/parrot/changeset/41681

Log:
[pirc] add STRING * variants to all data structures that currently use C strings (char *) as preparation of making PIRC STRING-aware

Modified:
   trunk/compilers/pirc/src/bcgen.h
   trunk/compilers/pirc/src/pir.l
   trunk/compilers/pirc/src/pircompunit.h
   trunk/compilers/pirc/src/pirlexer.c

Modified: trunk/compilers/pirc/src/bcgen.h
==============================================================================
--- trunk/compilers/pirc/src/bcgen.h	Sun Oct  4 11:03:18 2009	(r41680)
+++ trunk/compilers/pirc/src/bcgen.h	Sun Oct  4 11:07:09 2009	(r41681)
@@ -50,6 +50,7 @@
  */
 typedef struct lexical {
     char const     *name;     /* name of this lexical */
+    STRING         *name1;
     int            *color;    /* register assigned to the lexical */
     struct lexical *next;
 
@@ -61,11 +62,17 @@
  */
 typedef struct sub_info {
     char const    *subname;
+    STRING        *subname1;
     char const    *methodname;
+    STRING        *methodname1;
     char const    *nsentry;
+    STRING        *nsentry1;
     char const    *subid;
+    STRING        *subid1;
     char const    *outersub;
+    STRING        *outersub1;
     char const    *instanceof;
+    STRING        *instanceof1;
     int            vtable_index;
     unsigned       regs_used[4];
     int            startoffset;

Modified: trunk/compilers/pirc/src/pir.l
==============================================================================
--- trunk/compilers/pirc/src/pir.l	Sun Oct  4 11:03:18 2009	(r41680)
+++ trunk/compilers/pirc/src/pir.l	Sun Oct  4 11:07:09 2009	(r41681)
@@ -519,7 +519,7 @@
 "$I"{DIGIT}+      { yylval->ival = atoi(yytext + 2); return TK_IREG; }
 
 {IDENT}":"        { /* make the label Id available in the parser. remove the ":" first. */
-                    lexer_state * const lexer = yget_extra(yyscanner);
+                    lexer_state * const lexer = yyget_extra(yyscanner);
                     STRING *str = Parrot_str_new(lexer->interp, yytext, yyleng - 1);
                     lexer->sval = str;
                     

Modified: trunk/compilers/pirc/src/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/src/pircompunit.h	Sun Oct  4 11:03:18 2009	(r41680)
+++ trunk/compilers/pirc/src/pircompunit.h	Sun Oct  4 11:07:09 2009	(r41681)
@@ -161,6 +161,7 @@
 /* represent a .const or .globalconst declaration */
 typedef struct constdecl {
     char const   *name;         /* name of the .const/.globalconst */
+    STRING       *name1;
     int           global;       /* flag to indicate whether it's a .globalconst or .const */
     value_type    type;         /* selector for the value union "val" */
     value         val;          /* the value of this .const/.globalconst */
@@ -188,6 +189,7 @@
     int         offset;        /* the offset that is used as the operand. */
     char const *name;          /* name of the label that is 
                                   (perhaps conditionally) being jumped to */
+    STRING     *name1;                                  
 
 } label;
 
@@ -206,6 +208,7 @@
         struct target  *t;
         constant       *c;
         char const     *id;
+        STRING         *id1;
         struct key     *k;
         struct label   *l;
 
@@ -247,6 +250,7 @@
     struct syminfo *info;           /* pointer to symbol/pir_reg's information */
     target_flag     flags;          /* flags like :slurpy etc. */
     char const     *alias;          /* if this is a named parameter, this is the alias */
+    STRING         *alias1;
     struct key     *key;            /* the key of this target, i.e. $P0[$P1], $P1 is key. */
 
     struct target  *next;
@@ -264,6 +268,7 @@
     expression      *value; /* the value of this argument */
     int              flags; /* :flat or :named, if specified */
     char const      *alias; /* value of the :named flag */
+    STRING          *alias1;
 
     struct argument *next;  /* points to the next argument */
 
@@ -296,7 +301,9 @@
 typedef struct instruction {
     unsigned            offset;       /* sequence number of this instruction */
     char         const *label;        /* label of this instruction */
+    STRING             *label1;
     char         const *opname;       /* name of the instruction, such as "print" and "set" */
+    STRING             *opname1;
     expression         *operands;     /* operands like "$I0" and "42" in "set $I0, 42" */
     int                 oplabelbits;  /* bits indicating which operands are labels */
     struct op_info_t   *opinfo;       /* pointer to the op_info containing this op's meta data */
@@ -316,6 +323,7 @@
 typedef struct bucket {
     union bucket_union {
         char const          *str;
+        STRING              *pstr;
         struct symbol       *sym;
         struct local_label  *loc;
         struct global_label *glob;
@@ -346,6 +354,7 @@
 typedef struct annotation {
     opcode_t     offset;
     char const  *key;      /* key of annotation */
+    STRING      *key1;
     constant    *value;    /* value of annotation */
 
     struct annotation *next; /* next annotation; annotations are stored in a list */

Modified: trunk/compilers/pirc/src/pirlexer.c
==============================================================================
--- trunk/compilers/pirc/src/pirlexer.c	Sun Oct  4 11:03:18 2009	(r41680)
+++ trunk/compilers/pirc/src/pirlexer.c	Sun Oct  4 11:07:09 2009	(r41681)
@@ -2726,7 +2726,7 @@
 YY_RULE_SETUP
 #line 521 "pir.l"
 { /* make the label Id available in the parser. remove the ":" first. */
-                    lexer_state * const lexer = yget_extra(yyscanner);
+                    lexer_state * const lexer = yypirget_extra(yyscanner);
                     STRING *str = Parrot_str_new(lexer->interp, yytext, yyleng - 1);
                     lexer->sval = str;
                     


More information about the parrot-commits mailing list