[svn:parrot] r37185 - in trunk: . config/gen/makefiles lib/Parrot/Ops2c src src/pmc

cotto at svn.parrot.org cotto at svn.parrot.org
Sun Mar 8 00:11:28 UTC 2009


Author: cotto
Date: Sun Mar  8 00:11:26 2009
New Revision: 37185
URL: https://trac.parrot.org/parrot/changeset/37185

Log:
[PMC] finish converting the ParrotLibrary PMC to ATTRs, this time without
breaking the build

Modified:
   trunk/MANIFEST.generated
   trunk/config/gen/makefiles/root.in
   trunk/lib/Parrot/Ops2c/Utils.pm
   trunk/src/dynext.c
   trunk/src/interpreter.c
   trunk/src/pmc/parrotlibrary.pmc

Modified: trunk/MANIFEST.generated
==============================================================================
--- trunk/MANIFEST.generated	Sat Mar  7 21:11:05 2009	(r37184)
+++ trunk/MANIFEST.generated	Sun Mar  8 00:11:26 2009	(r37185)
@@ -278,6 +278,7 @@
 src/pmc/pmc_integer.h                             [devel]include
 src/pmc/pmc_multisub.h                            [devel]include
 src/pmc/pmc_object.h                              [devel]include
+src/pmc/pmc_parrotlibrary.h                       [devel]include
 src/pmc/pmc_resizablepmcarray.h                   [devel]include
 src/pmc/pmc_scalar.h                              [devel]include
 src/pmc/pmc_string.h                              [devel]include

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Sat Mar  7 21:11:05 2009	(r37184)
+++ trunk/config/gen/makefiles/root.in	Sun Mar  8 00:11:26 2009	(r37185)
@@ -1094,7 +1094,8 @@
 
 $(SRC_DIR)/longopt$(O) : $(GENERAL_H_FILES)
 
-$(SRC_DIR)/dynext$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dynext.str
+$(SRC_DIR)/dynext$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dynext.str \
+	$(SRC_DIR)/pmc/pmc_parrotlibrary.h
 
 $(SRC_DIR)/exceptions$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exceptions.str \
 	$(SRC_DIR)/pmc/pmc_continuation.h
@@ -1106,7 +1107,8 @@
 $(SRC_DIR)/extend$(O) : $(GENERAL_H_FILES) $(INC_DIR)/extend.h \
 	$(SRC_DIR)/pmc/pmc_sub.h
 
-$(SRC_DIR)/interpreter$(O) : $(SRC_DIR)/interpreter.c $(GENERAL_H_FILES)
+$(SRC_DIR)/interpreter$(O) : $(SRC_DIR)/interpreter.c $(GENERAL_H_FILES) \
+	$(SRC_DIR)/pmc/pmc_parrotlibrary.h
 
 $(SRC_DIR)/call/pcc$(O) : $(SRC_DIR)/call/pcc.c $(GENERAL_H_FILES) \
 	$(SRC_DIR)/call/pcc.str $(SRC_DIR)/pmc/pmc_fixedintegerarray.h \

Modified: trunk/lib/Parrot/Ops2c/Utils.pm
==============================================================================
--- trunk/lib/Parrot/Ops2c/Utils.pm	Sat Mar  7 21:11:05 2009	(r37184)
+++ trunk/lib/Parrot/Ops2c/Utils.pm	Sun Mar  8 00:11:26 2009	(r37185)
@@ -550,6 +550,7 @@
     print $fh $self->{preamble};
     print $fh <<END_C;
 #include "$self->{include}"
+#include "../pmc/pmc_parrotlibrary.h"
 
 $self->{defines}
 
@@ -1062,7 +1063,7 @@
 $load_func(PARROT_INTERP)
 {
     PMC *const lib      = pmc_new(interp, enum_class_ParrotLibrary);
-    PMC_struct_val(lib) = (void *) $self->{init_func};
+    ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = $self->{init_func};
     dynop_register(interp, lib);
     return lib;
 }

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c	Sat Mar  7 21:11:05 2009	(r37184)
+++ trunk/src/dynext.c	Sun Mar  8 00:11:26 2009	(r37185)
@@ -21,6 +21,7 @@
 #include "parrot/parrot.h"
 #include "parrot/dynext.h"
 #include "dynext.str"
+#include "pmc/pmc_parrotlibrary.h"
 
 /* HEADERIZER HFILE: include/parrot/dynext.h */
 
@@ -420,7 +421,7 @@
         /* we could set a private flag in the PMC header too
          * but currently only ops files have struct_val set */
 
-        if (PMC_struct_val(lib_pmc))
+        if (((Parrot_ParrotLibrary_attributes *)PMC_data(lib_pmc))->oplib_init)
             type = CONST_STRING(interp, "Ops");
         else
             type = CONST_STRING(interp, "PMC");

Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c	Sat Mar  7 21:11:05 2009	(r37184)
+++ trunk/src/interpreter.c	Sun Mar  8 00:11:26 2009	(r37185)
@@ -47,6 +47,7 @@
 #  include "parrot/oplib/core_ops_cgp.h"
 #endif
 #include "parrot/dynext.h"
+#include "pmc/pmc_parrotlibrary.h"
 
 
 /* HEADERIZER HFILE: none */
@@ -470,7 +471,8 @@
 get_dynamic_op_lib_init(SHIM_INTERP, ARGIN(const PMC *lib))
 {
     ASSERT_ARGS(get_dynamic_op_lib_init)
-    return (oplib_init_f)D2FPTR(PMC_struct_val(lib));
+    return (oplib_init_f)D2FPTR(
+            ((Parrot_ParrotLibrary_attributes *)PMC_data(lib))->oplib_init);
 }
 
 

Modified: trunk/src/pmc/parrotlibrary.pmc
==============================================================================
--- trunk/src/pmc/parrotlibrary.pmc	Sat Mar  7 21:11:05 2009	(r37184)
+++ trunk/src/pmc/parrotlibrary.pmc	Sun Mar  8 00:11:26 2009	(r37185)
@@ -10,10 +10,6 @@
 
 Class for holding info about a dynamic library.
 
-     PMC data
-     PMC_struct_val(SELF)   oplib init function
-     PMC_data(SELF)         DLL handle
-
 Properties:
 
     _filename               full path/file of lib
@@ -35,9 +31,11 @@
 #include "parrot/parrot.h"
 
 #define PMC_dlhandle(x) ((Parrot_ParrotLibrary_attributes*)PMC_data(x))->dl_handle
+#define PMC_oplib_init(x) ((Parrot_ParrotLibrary_attributes*)PMC_data(x))->oplib_init
 
 pmclass ParrotLibrary need_ext provides library {
-    ATTR void * dl_handle;
+    ATTR void * dl_handle;  /* DLL handle */
+    ATTR void * oplib_init; /* oplib init function */
 
 /*
 
@@ -54,7 +52,6 @@
             mem_allocate_zeroed_typed(Parrot_ParrotLibrary_attributes);
         PMC_data(SELF) = attrs;
         PObj_active_destroy_SET(SELF);
-        PMC_struct_val(SELF) = NULL;
     }
 
 /*
@@ -87,7 +84,7 @@
 
     VTABLE PMC *clone() {
         PMC *dest            = pmc_new(INTERP, SELF->vtable->base_type);
-        PMC_struct_val(dest) = PMC_struct_val(SELF);
+        PMC_oplib_init(dest) = PMC_oplib_init(SELF);
         PMC_dlhandle(dest)   = PMC_dlhandle(SELF);
 
         if (PMC_metadata(SELF))


More information about the parrot-commits mailing list