Author: leo
Date: Wed Mar  8 05:36:37 2006
New Revision: 11823

Modified:
   trunk/include/parrot/sub.h
   trunk/src/global.c
   trunk/src/pmc/namespace.pmc
   trunk/src/pmc/sub.pmc

Log:
Namespaces 10 - extend parrot_sub_t with namespace_stash

* namespace is a string or key and frozen with the Sub PMC
* namespace_stash is/will be the actual resulting NameSpace PMC


Modified: trunk/include/parrot/sub.h
==============================================================================
--- trunk/include/parrot/sub.h  (original)
+++ trunk/include/parrot/sub.h  Wed Mar  8 05:36:37 2006
@@ -58,7 +58,11 @@
     size_t   end_offs;
 
     INTVAL   HLL_id;            /* see src/hll.c XXX or per segment? */
-    PMC      *namespace;       /* where this Sub is in */
+    PMC      *namespace;        /* where this Sub is in - this is either
+                                   a String or a [Key] and describes
+                                   the relative path in the NameSpace  
+                                */
+    PMC      *namespace_stash;  /* the actual hash, HLL::namespace */
     STRING   *name;             /* name of the sub */
     PMC      *multi_signature;  /* list of types for MMD */
     INTVAL   n_regs_used[4];   /* INSP in PBC */
@@ -83,7 +87,11 @@
     size_t   end_offs;
 
     INTVAL   HLL_id;            /* see src/hll.c XXX or per segment? */
-    PMC      *namespace;       /* where this Sub is in */
+    PMC      *namespace;        /* where this Sub is in - this is either
+                                   a String or a [Key] and describes
+                                   the relative path in the NameSpace  
+                                */
+    PMC      *namespace_stash;  /* the actual hash, HLL::namespace */
     STRING   *name;             /* name of the sub */
     PMC      *multi_signature;  /* list of types for MMD */
     INTVAL   n_regs_used[4];   /* INSP in PBC */

Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c  (original)
+++ trunk/src/global.c  Wed Mar  8 05:36:37 2006
@@ -317,6 +317,7 @@
      */
     if (PMC_IS_NULL(namespace)) {
 global_ns:
+        /* XXX store relative - not absolute */
         Parrot_store_global(interpreter, NULL, sub_name, sub_pmc);
     }
     else {
@@ -362,6 +363,7 @@
                     globals = stash;
                 }
                 VTABLE_set_pmc_keyed_str(interpreter, stash, sub_name, 
sub_pmc);
+                PMC_sub(sub_pmc)->namespace_stash = stash;
                 break;
             default:
                 internal_exception(1, "Unhandled namespace constant");

Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc (original)
+++ trunk/src/pmc/namespace.pmc Wed Mar  8 05:36:37 2006
@@ -80,7 +80,7 @@
                 if (!key_next(INTERP, key))
                     break;
             default:
-                assert("not yet" != NULL);
+                assert("not yet" == NULL);
         }
     }
 

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc       (original)
+++ trunk/src/pmc/sub.pmc       Wed Mar  8 05:36:37 2006
@@ -544,6 +544,8 @@
 Return the namespace PMC or Undef. The namespace PMC is either a
 String PMC or a Key PMC for a nested namespace.
 
+TODO return C<namespace_stash> instead.
+
 =item C<METHOD INTVAL __get_regs_used(char *kind)>
 
 Return amount of used registers for register kinds "I", "S", "P", "N".

Reply via email to