develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34569 - trunk/compilers/pirc/new

From:
kjs
Date:
December 29, 2008 05:26
Subject:
[svn:parrot] r34569 - trunk/compilers/pirc/new
Message ID:
20081229132637.6C87DCB9FA@x12.develooper.com
Author: kjs
Date: Mon Dec 29 05:26:36 2008
New Revision: 34569

Modified:
   trunk/compilers/pirc/new/bcgen.c
   trunk/compilers/pirc/new/pir.y
   trunk/compilers/pirc/new/pircompunit.c
   trunk/compilers/pirc/new/pircompunit.h
   trunk/compilers/pirc/new/pirparser.c

Log:
[pirc] prefix sub_flags with "PIRC", to prevent collisions with libparrot.

Modified: trunk/compilers/pirc/new/bcgen.c
==============================================================================
--- trunk/compilers/pirc/new/bcgen.c	(original)
+++ trunk/compilers/pirc/new/bcgen.c	Mon Dec 29 05:26:36 2008
@@ -423,6 +423,7 @@
     multi_type * iter;
     PMC        * multi_signature;
 
+    /* cancel if there's no :multi flag */
     if (type_count == 0)
         return NULL;
 

Modified: trunk/compilers/pirc/new/pir.y
==============================================================================
--- trunk/compilers/pirc/new/pir.y	(original)
+++ trunk/compilers/pirc/new/pir.y	Mon Dec 29 05:26:36 2008
@@ -706,21 +706,21 @@
                   ;
 
 sub_flag          : ":anon"
-                         { set_sub_flag(lexer, SUB_FLAG_ANON);}
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_ANON);}
                   | ":init"
-                         { set_sub_flag(lexer, SUB_FLAG_INIT); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_INIT); }
                   | ":load"
-                         { set_sub_flag(lexer, SUB_FLAG_LOAD); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_LOAD); }
                   | ":main"
-                         { set_sub_flag(lexer, SUB_FLAG_MAIN); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_MAIN); }
                   | ":lex"
-                         { set_sub_flag(lexer, SUB_FLAG_LEX); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_LEX); }
                   | ":postcomp"
-                         { set_sub_flag(lexer, SUB_FLAG_POSTCOMP); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_POSTCOMP); }
                   | ":immediate"
-                         { set_sub_flag(lexer, SUB_FLAG_IMMEDIATE); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_IMMEDIATE); }
                   | ":multi" multi_type_list
-                         { set_sub_flag(lexer, SUB_FLAG_MULTI); }
+                         { set_sub_flag(lexer, PIRC_SUB_FLAG_MULTI); }
                   | ":outer" '(' sub_id ')'
                          { set_sub_outer(lexer, $3); }
                   | ":method" opt_paren_string

Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c	(original)
+++ trunk/compilers/pirc/new/pircompunit.c	Mon Dec 29 05:26:36 2008
@@ -124,7 +124,7 @@
 void
 set_sub_outer(lexer_state * const lexer, char const * const outersub) {
     CURRENT_SUB(lexer)->outer_sub = outersub;
-    SET_FLAG(lexer->subs->flags, SUB_FLAG_OUTER);
+    SET_FLAG(lexer->subs->flags, PIRC_SUB_FLAG_HAS_OUTER);
 }
 
 
@@ -208,7 +208,7 @@
                    "'%s' is not a vtable method but was used with :vtable flag", vtablename);
     else {
         CURRENT_SUB(lexer)->info.vtable_index = vtable_index;
-        SET_FLAG(lexer->subs->flags, SUB_FLAG_VTABLE);
+        SET_FLAG(lexer->subs->flags, PIRC_SUB_FLAG_VTABLE);
     }
 }
 
@@ -225,7 +225,7 @@
 void
 set_sub_subid(lexer_state * const lexer, char const * const subid) {
     CURRENT_SUB(lexer)->info.subid = subid;
-    SET_FLAG(lexer->subs->flags, SUB_FLAG_SUBID);
+    SET_FLAG(lexer->subs->flags, PIRC_SUB_FLAG_SUBID);
 }
 
 /*
@@ -246,7 +246,7 @@
     else /* :method without a value defaults to the subname. */
         CURRENT_SUB(lexer)->methodname = CURRENT_SUB(lexer)->info.subname;
 
-    SET_FLAG(lexer->subs->flags, SUB_FLAG_METHOD);
+    SET_FLAG(lexer->subs->flags, PIRC_SUB_FLAG_METHOD);
 }
 
 /*
@@ -299,7 +299,7 @@
     SET_FLAG(CURRENT_SUB(lexer)->flags, flag);
 
     /* if the sub is a method or a :vtable method, then also add a "self" parameter */
-    if (TEST_FLAG(flag, (SUB_FLAG_VTABLE | SUB_FLAG_METHOD)))
+    if (TEST_FLAG(flag, (PIRC_SUB_FLAG_VTABLE | PIRC_SUB_FLAG_METHOD)))
         add_param(lexer, PMC_TYPE, "self");
 }
 
@@ -2758,7 +2758,7 @@
 static void
 emit_sub_epilogue(lexer_state * const lexer) {
 
-    if (TEST_FLAG(lexer->subs->flags, SUB_FLAG_MAIN))
+    if (TEST_FLAG(lexer->subs->flags, PIRC_SUB_FLAG_MAIN))
         new_sub_instr(lexer, PARROT_OP_end, "end", 0);
     else {
         /* default sub epilogue; no return values, hence 0 */
@@ -2821,7 +2821,7 @@
 
     /* store the subroutine in the bytecode constant table. */
     sub_const_table_index = add_sub_pmc(lexer->bc, &CURRENT_SUB(lexer)->info,
-                                        TEST_FLAG(CURRENT_SUB(lexer)->flags, SUB_FLAG_LEX));
+                                        TEST_FLAG(CURRENT_SUB(lexer)->flags, PIRC_SUB_FLAG_LEX));
 
     /* store the sub PMC index in the constant table with the global label,
      * so that invoking ops can find this index.

Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h	(original)
+++ trunk/compilers/pirc/new/pircompunit.h	Mon Dec 29 05:26:36 2008
@@ -71,21 +71,21 @@
 
 /* sub flags */
 typedef enum sub_flags {
-    SUB_FLAG_METHOD     = 1 << 0,  /* the sub is a method */
-    SUB_FLAG_INIT       = 1 << 1,  /* the sub is run before :main when starting up */
-    SUB_FLAG_LOAD       = 1 << 2,  /* the sub is run when the bytecode is loaded */
-    SUB_FLAG_OUTER      = 1 << 3,  /* the sub is lexically nested */
-    SUB_FLAG_MAIN       = 1 << 4,  /* execution of the program will start at this sub */
-    SUB_FLAG_ANON       = 1 << 5,  /* this sub is shy and will not be stored in the global
-                                      namespace */
-    SUB_FLAG_POSTCOMP   = 1 << 6,  /* this sub will be executed after compilation */
-    SUB_FLAG_IMMEDIATE  = 1 << 7,  /* similar to POSTCOMP above; check out PDD19 for difference */
-    SUB_FLAG_VTABLE     = 1 << 8,  /* this sub overrides a vtable method */
-    SUB_FLAG_LEX        = 1 << 9,  /* this sub needs a LexPad */
-    SUB_FLAG_MULTI      = 1 << 10, /* this sub is a multi method/sub */
-    SUB_FLAG_SUBID      = 1 << 11, /* this sub has a namespace-unaware identifier
-                                      XXX this flag needed? XXX */
-    SUB_FLAG_INSTANCEOF = 1 << 12  /* this sub has an :instanceof flag. XXX document this XXX */
+    PIRC_SUB_FLAG_METHOD     = 1 << 0,  /* the sub is a method */
+    PIRC_SUB_FLAG_INIT       = 1 << 1,  /* the sub is run before :main when starting up */
+    PIRC_SUB_FLAG_LOAD       = 1 << 2,  /* the sub is run when the bytecode is loaded */
+    PIRC_SUB_FLAG_HAS_OUTER  = 1 << 3,  /* the sub is lexically nested */
+    PIRC_SUB_FLAG_IS_OUTER   = 1 << 4,  /* the sub contains lexically nested subs. */
+    PIRC_SUB_FLAG_MAIN       = 1 << 5,  /* execution of the program will start at this sub */
+    PIRC_SUB_FLAG_ANON       = 1 << 6,  /* this sub is shy and will not be stored in the global
+                                           namespace */
+    PIRC_SUB_FLAG_POSTCOMP   = 1 << 7,  /* this sub will be executed after compilation */
+    PIRC_SUB_FLAG_IMMEDIATE  = 1 << 8,  /* similar to POSTCOMP above; check PDD19 for difference */
+    PIRC_SUB_FLAG_VTABLE     = 1 << 9,  /* this sub overrides a vtable method */
+    PIRC_SUB_FLAG_LEX        = 1 << 10, /* this sub needs a LexPad */
+    PIRC_SUB_FLAG_MULTI      = 1 << 11, /* this sub is a multi method/sub */
+    PIRC_SUB_FLAG_SUBID      = 1 << 12, /* this sub has a namespace-unaware identifier */
+    PIRC_SUB_FLAG_INSTANCEOF = 1 << 13  /* this sub has an :instanceof flag. XXX document this */
 
 } sub_flag;
 

Modified: trunk/compilers/pirc/new/pirparser.c
==============================================================================
--- trunk/compilers/pirc/new/pirparser.c	(original)
+++ trunk/compilers/pirc/new/pirparser.c	Mon Dec 29 05:26:36 2008
@@ -2713,42 +2713,42 @@
 
   case 56:
 #line 709 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_ANON);;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_ANON);;}
     break;
 
   case 57:
 #line 711 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_INIT); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_INIT); ;}
     break;
 
   case 58:
 #line 713 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_LOAD); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_LOAD); ;}
     break;
 
   case 59:
 #line 715 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_MAIN); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_MAIN); ;}
     break;
 
   case 60:
 #line 717 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_LEX); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_LEX); ;}
     break;
 
   case 61:
 #line 719 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_POSTCOMP); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_POSTCOMP); ;}
     break;
 
   case 62:
 #line 721 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_IMMEDIATE); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_IMMEDIATE); ;}
     break;
 
   case 63:
 #line 723 "pir.y"
-    { set_sub_flag(lexer, SUB_FLAG_MULTI); ;}
+    { set_sub_flag(lexer, PIRC_SUB_FLAG_MULTI); ;}
     break;
 
   case 64:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About