Three quick things:
1) INTVALs and opcode_t > longs will now be even more suspect than what 
they were beforehand.  
2) Feel free to bicker with names.  I don't think we've come to *any* sort 
of agreement with these, although we really, really, need to.
3) I forget the third thing.
4) But I thought of a fourth.
5) I've now remembered the third thing: IIRC, ANSI C states that enums will 
fit within the smallest type (int or greater) that can hold the values. Is 
that actually correct, and does it state whether unsigned is preferred to 
signed for non-negative enums? 
6) Since I'm no longer constrained by "three" or "quick", I'm going size_t 
happy for a lot of memory-related storage.  (That's good.  No sense wasting 
the size or performance of an UINTVAL for strange values of UINTVAL.)  I'm 
also using it in a couple other internal things (like the GC stat counters, 
seen here).  Size and performance, again, and unpromotable to a bigint, so we
know that we (theoretically) will wrap.  However, size_t isn't the best 
choice for the type.  (Not that there's anything wrong with size_t, just 
that it shouldn't be called size_t.)  Any thoughts?  I was thinking of just 
doing unsigned int, because, IIRC, int is usually the natural word size, and 
will be most efficient.  Thoughts?
7) I forgot what the fourth thing I thought of was while writing down the 
others.  Sorry.


Index: core.ops
===================================================================
RCS file: /home/perlcvs/parrot/core.ops,v
retrieving revision 1.100
diff -u -r1.100 core.ops
--- core.ops    4 Mar 2002 03:01:00 -0000       1.100
+++ core.ops    6 Mar 2002 03:48:50 -0000
@@ -2488,7 +2488,7 @@
 op newinterp(out PMC, in INT) {
   struct Parrot_Interp *new_interp;
   struct PMC *new_pmc;
-  new_interp = make_interpreter($2);
+  new_interp = make_interpreter((Interp_flags)$2);
   new_pmc = new_pmc_header(interpreter);
   new_pmc->data = new_interp;
   new_pmc->vtable = YOU_LOSE_VTABLE;
Index: embed.c
===================================================================
RCS file: /home/perlcvs/parrot/embed.c,v
retrieving revision 1.14
diff -u -r1.14 embed.c
--- embed.c     4 Mar 2002 02:51:01 -0000       1.14
+++ embed.c     6 Mar 2002 03:48:51 -0000
@@ -24,7 +24,7 @@
         world_inited=1;
         init_world();
     }
-    return make_interpreter(0);
+    return make_interpreter(NO_FLAGS);
 }
 
 void
Index: exceptions.c
===================================================================
RCS file: /home/perlcvs/parrot/exceptions.c,v
retrieving revision 1.4
diff -u -r1.4 exceptions.c
--- exceptions.c        5 Mar 2002 04:21:30 -0000       1.4
+++ exceptions.c        6 Mar 2002 03:48:51 -0000
@@ -49,7 +49,7 @@
 Architecture: " PARROT_ARCHNAME    "\n\
 JIT Capable : %s\n\
 \n\
-Interp Flags: 0x%lx\n\
+Interp Flags: 0x%x\n\
 Exceptions  : (missing from core)\n\
 \n\
 Dumping core...\n\
Index: interpreter.c
===================================================================
RCS file: /home/perlcvs/parrot/interpreter.c,v
retrieving revision 1.75
diff -u -r1.75 interpreter.c
--- interpreter.c       5 Mar 2002 04:21:30 -0000       1.75
+++ interpreter.c       6 Mar 2002 03:48:52 -0000
@@ -474,7 +474,7 @@
  *  Create the Parrot interpreter.  Allocate memory and clear the registers.
  */
 struct Parrot_Interp *
-make_interpreter(INTVAL flags)
+make_interpreter(Interp_flags flags)
 {
     struct Parrot_Interp *interpreter;
     /* Get an empty interpreter from system memory */
Index: pbc2c.pl
===================================================================
RCS file: /home/perlcvs/parrot/pbc2c.pl,v
retrieving revision 1.18
diff -u -r1.18 pbc2c.pl
--- pbc2c.pl    16 Feb 2002 04:38:14 -0000      1.18
+++ pbc2c.pl    6 Mar 2002 03:48:53 -0000
@@ -222,7 +222,7 @@
     init_world();
   
     run_native = run_compiled;
-    interpreter = make_interpreter(0);
+    interpreter = make_interpreter(NO_FLAGS);
     pf          = PackFile_new();
 
     if( !PackFile_unpack(interpreter, pf, program_code,
Index: pdump.c
===================================================================
RCS file: /home/perlcvs/parrot/pdump.c,v
retrieving revision 1.12
diff -u -r1.12 pdump.c
--- pdump.c     5 Mar 2002 05:30:17 -0000       1.12
+++ pdump.c     6 Mar 2002 03:48:53 -0000
@@ -20,7 +20,7 @@
     opcode_t *packed;
     size_t packed_size;
     struct PackFile *pf;
-    struct Parrot_Interp *interpreter = make_interpreter(0);
+    struct Parrot_Interp *interpreter = make_interpreter(NO_FLAGS);
 
     if (argc != 2) {
         fprintf(stderr, "pdump: usage: pdump FILE\n");
@@ -39,7 +39,7 @@
 
     init_world();
 
-    interpreter = make_interpreter(0);
+    interpreter = make_interpreter(NO_FLAGS);
 
     packed_size = file_stat.st_size;
 
Index: include/parrot/interpreter.h
===================================================================
RCS file: /home/perlcvs/parrot/include/parrot/interpreter.h,v
retrieving revision 1.33
diff -u -r1.33 interpreter.h
--- include/parrot/interpreter.h        5 Mar 2002 17:39:10 -0000       1.33
+++ include/parrot/interpreter.h        6 Mar 2002 03:48:54 -0000
@@ -13,6 +13,19 @@
 #if !defined(PARROT_INTERPRETER_H_GUARD)
 #define PARROT_INTERPRETER_H_GUARD
 
+/* These should be visible to embedders. */
+
+/* General flags */
+typedef enum {
+    NO_FLAGS             = 0x00,
+    PARROT_DEBUG_FLAG    = 0x01,  /* We're debugging */
+    PARROT_TRACE_FLAG    = 0x02,  /* We're tracing execution */
+    PARROT_BOUNDS_FLAG   = 0x04,  /* We're tracking byte code bounds */
+    PARROT_PROFILE_FLAG  = 0x08,  /* We're gathering profile information */
+    PARROT_PREDEREF_FLAG = 0x10,  /* We're using the prederef runops */
+    PARROT_JIT_FLAG      = 0x20,  /* We're using the jit runops */
+} Interp_flags;
+
 #if defined(PARROT_IN_CORE)
 
 #include "parrot/register.h"
@@ -32,7 +45,7 @@
 #endif
 
 typedef struct ProfData {
-    INTVAL numcalls;
+    UINTVAL numcalls;
     FLOATVAL time;
 } ProfData;
 
@@ -61,9 +74,9 @@
                                          * arena */
     void *piodata;                      /* interpreter's IO system */
 
-    op_lib_t *op_lib;          /* Opcode library */
-    UINTVAL op_count;          /* The number of ops */
-    op_info_t *op_info_table;  /* Opcode info table (name, nargs, arg 
types) */
+    op_lib_t  *op_lib;                  /* Opcode library */
+    size_t     op_count;                /* The number of ops */
+    op_info_t *op_info_table; /* Opcode info table (name, nargs, arg types) 
*/
 
     op_func_t *op_func_table;
 
@@ -71,7 +84,7 @@
     str_func_t *string_funcs;
 #endif
 
-    INTVAL flags;               /* Various interpreter flags that
+    Interp_flags flags;         /* Various interpreter flags that
                                  * signal that runops should do
                                  * something */
 
@@ -86,33 +99,33 @@
 
     struct PackFile *code;      /* The code we are executing */
     void **prederef_code;       /* The predereferenced code */
-    INTVAL current_line;        /* Which line we're executing in the
+    size_t current_line;        /* Which line we're executing in the
                                  * source */
     void *current_file;         /* The file we're currently in */
     void *current_package;      /* The package we're currently in */
 
     /* Some counters for the garbage collector.xs */
-    UINTVAL dod_runs;           /* Number of times we've
+    size_t  dod_runs;           /* Number of times we've
                                  * done a DOD sweep */
-    UINTVAL collect_runs;       /* Number of times we've
+    size_t  collect_runs;       /* Number of times we've
                                  * done a memory compaction
                                  */
-    UINTVAL mem_allocs_since_last_collect;      /* The number of memory
+    size_t  mem_allocs_since_last_collect;      /* The number of memory
                                                  * allocations from the
                                                  * system since the last
                                                  * compaction run */
-    UINTVAL header_allocs_since_last_collect;   /* The number of header
+    size_t  header_allocs_since_last_collect;   /* The number of header
                                                  * allocs from the
                                                  * system since the last
                                                  * DOD run */
-    UINTVAL active_PMCs;        /* The number of live PMCs */
-    UINTVAL active_Buffers;     /* The number of live
+    size_t  active_PMCs;        /* The number of live PMCs */
+    size_t  active_Buffers;     /* The number of live
                                  * Buffers */
-    UINTVAL total_PMCs;         /* The total number of PMCs
+    size_t  total_PMCs;         /* The total number of PMCs
                                  * allocated */
-    UINTVAL total_Buffers;      /* The total number of
+    size_t  total_Buffers;      /* The total number of
                                  * buffers allocated */
-    UINTVAL memory_allocated;   /* The total amount of
+    size_t  memory_allocated;   /* The total amount of
                                  * allocatable memory
                                  * allocated. Doesn't count
                                  * memory for headers or
@@ -123,7 +136,7 @@
 #define PCONST(i) PF_CONST(interpreter->code, (i))
 #define PNCONST   PF_NCONST(interpreter->code)
 
-struct Parrot_Interp *make_interpreter(INTVAL);
+struct Parrot_Interp *make_interpreter(Interp_flags);
 
 #if 0
 void runops_generic();
@@ -135,19 +148,9 @@
                                   opcode_t * cur_opcode,
                                   opcode_t * start_code);
 
-#endif
-
-/* These should be visible to embedders. */
+#endif   /* Parrot core */
 
-/* General flags */
-#define PARROT_DEBUG_FLAG    0x01  /* We're debugging */
-#define PARROT_TRACE_FLAG    0x02  /* We're tracing execution */
-#define PARROT_BOUNDS_FLAG   0x04  /* We're tracking byte code bounds */
-#define PARROT_PROFILE_FLAG  0x08  /* We're gathering profile information */
-#define PARROT_PREDEREF_FLAG 0x10  /* We're using the prederef runops */
-#define PARROT_JIT_FLAG      0x20  /* We're using the jit runops */
-
-#endif
+#endif   /* header guard */
 
 /*
  * Local variables:



-- 
Bryan C. Warnock
[EMAIL PROTECTED]

Reply via email to