cvsuser 02/11/10 03:16:16
Modified: include/parrot parrot.h
. interpreter.c
Log:
SET_NULL macros
Revision Changes Path
1.55 +16 -1 parrot/include/parrot/parrot.h
Index: parrot.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/parrot.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -w -r1.54 -r1.55
--- parrot.h 8 Nov 2002 05:18:42 -0000 1.54
+++ parrot.h 10 Nov 2002 11:16:12 -0000 1.55
@@ -1,7 +1,7 @@
/* parrot.h
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: parrot.h,v 1.54 2002/11/08 05:18:42 josh Exp $
+ * $Id: parrot.h,v 1.55 2002/11/10 11:16:12 leo Exp $
* Overview:
* General header file includes for the parrot interpreter
* Data Structure and Algorithms:
@@ -77,6 +77,21 @@
typedef struct PMC PMC;
typedef void STRING_FUNCS;
typedef void BIGNUM;
+
+/* weird architectures might need this, s. C-FAQ 5.17
+ *
+ * the SET_NULL macros are only for system, where a NULL pointer
+ * isn't represented by zeroes, so don't use these, for resetting
+ * non-null pointers
+ */
+
+#ifdef HAS_NON_ZERO_NULL
+# define SET_NULL(x) x = NULL
+# define SET_NULL_P(x, s) x = (s)NULL
+#else
+# define SET_NULL(x)
+# define SET_NULL_P(x, s)
+#endif
/* Casting between pointers and integers: If pointers and integers
are the same size, then direct casting is fine. If pointers and
1.114 +21 -1 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -w -r1.113 -r1.114
--- interpreter.c 9 Nov 2002 11:09:38 -0000 1.113
+++ interpreter.c 10 Nov 2002 11:16:16 -0000 1.114
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: interpreter.c,v 1.113 2002/11/09 11:09:38 leo Exp $
+ * $Id: interpreter.c,v 1.114 2002/11/10 11:16:16 leo Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -468,6 +468,21 @@
interpreter->ctx.num_reg_base->free = FRAMES_PER_NUM_REG_CHUNK;
interpreter->ctx.string_reg_base->free = FRAMES_PER_STR_REG_CHUNK;
interpreter->ctx.pmc_reg_base->free = FRAMES_PER_PMC_REG_CHUNK;
+ /* the SET_NULL macros are only for system, where a NULL pointer
+ * isn't represented by zeroes, so don't use these, for resetting
+ * non-null pointers
+ */
+ SET_NULL(interpreter->ctx.int_reg_base->next);
+ SET_NULL(interpreter->ctx.int_reg_base->prev);
+ SET_NULL(interpreter->ctx.num_reg_base->next);
+ SET_NULL(interpreter->ctx.num_reg_base->prev);
+ SET_NULL(interpreter->ctx.string_reg_base->next);
+ SET_NULL(interpreter->ctx.string_reg_base->prev);
+ SET_NULL(interpreter->ctx.pmc_reg_base->next);
+ SET_NULL(interpreter->ctx.pmc_reg_base->prev);
+
+ Parrot_clear_s(interpreter);
+ Parrot_clear_p(interpreter);
/* Stack for lexical pads */
interpreter->ctx.pad_stack = new_stack(interpreter);
@@ -497,7 +512,12 @@
interpreter->current_package =
string_make(interpreter, "(unknown package)", 18, NULL, 0, NULL);;
+ SET_NULL(interpreter->piodata);
PIO_init(interpreter);
+
+ SET_NULL_P(interpreter->code, struct PackFile *);
+ SET_NULL_P(interpreter->profile, ProfData *);
+ SET_NULL_P(interpreter->predref_code, void **);
/* Done. Return and be done with it */