Author: petdance
Date: Fri Jun 15 14:22:33 2007
New Revision: 19025

Modified:
   trunk/config/gen/makefiles/root.in
   trunk/include/parrot/dod.h
   trunk/include/parrot/hll.h
   trunk/include/parrot/interpreter.h
   trunk/include/parrot/key.h
   trunk/include/parrot/string_funcs.h
   trunk/src/gc/gc_gms.c
   trunk/src/gc/gc_ims.c
   trunk/src/global.c
   trunk/src/key.c
   trunk/src/string.c
   trunk/tools/build/vtable_extend.pl

Log:
headerized src/extend.c, src/gc/gc_gms.c, src/gc/gc_ims.c and src/global.c 
(sort of)

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in  (original)
+++ trunk/config/gen/makefiles/root.in  Fri Jun 15 14:22:33 2007
@@ -1834,19 +1834,22 @@
     src/core_pmcs.o \
     src/cpu_dep.o \
     src/datatypes.o \
-    src/datatypes.o \
     src/debug.o \
     src/dynext.o \
     src/encoding.o \
     src/events.o \
     src/exceptions.o \
     src/exit.o \
+    src/extend.o \
     src/fingerprint.o \
     src/gc/dod.o \
+    src/gc/gc_gms.o \
+    src/gc/gc_ims.o \
     src/gc/memory.o \
     src/gc/register.o \
     src/gc/resources.o \
     src/gc/smallobject.o \
+    src/global.o \
     src/global_setup.o \
     src/hash.o \
     src/headers.o \

Modified: trunk/include/parrot/dod.h
==============================================================================
--- trunk/include/parrot/dod.h  (original)
+++ trunk/include/parrot/dod.h  Fri Jun 15 14:22:33 2007
@@ -115,11 +115,36 @@
 
 
 /* GC subsystem init functions */
-PARROT_API void parrot_gc_gms_pobject_lives(Interp *interp, PObj *obj);
-PARROT_API void Parrot_gc_ims_init(Interp *interp);
-PARROT_API void Parrot_gc_gms_init(Interp *interp);
+/* HEADERIZER BEGIN: src/gc/gc_gms.c */
+
+PARROT_API void Parrot_gc_gms_init( Interp* interp /*NN*/ )
+        __attribute__nonnull__(1);
+
+PARROT_API void parrot_gc_gms_pobject_lives( Interp* interp /*NN*/,
+    PObj *obj /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void parrot_gc_gms_wb( Interp *interp, PMC *agg, void *old, void *new /*NN*/ )
+        __attribute__nonnull__(4);
+
+void parrot_gc_gms_wb_key( Interp *interp,
+    PMC *agg,
+    void *old,
+    void *old_key,
+    void *new,
+    void *new_key );
+
+/* HEADERIZER END: src/gc/gc_gms.c */
+
+/* HEADERIZER BEGIN: src/gc/gc_ims.c */
+
+PARROT_API void Parrot_dod_ims_wb( Interp* interp, PMC *agg, PMC *_new );
+PARROT_API void Parrot_gc_ims_init( Interp* interp /*NN*/ )
+        __attribute__nonnull__(1);
+
+/* HEADERIZER END: src/gc/gc_ims.c */
 
-PARROT_API void Parrot_dod_ims_wb(Interp*, PMC *, PMC *);
 /*
  * write barrier
  */
@@ -165,10 +190,6 @@
         parrot_gc_gms_wb_key(interp, agg, old, old_key, new, new_key); \
 } while (0)
 
-void parrot_gc_gms_wb(Interp *, PMC *agg, void *old, void *new);
-void parrot_gc_gms_wb_key(Interp *, PMC *agg,
-        void *old, void *old_key, void *new, void *new_key);
-
 #endif
 
 #endif /* PARROT_DOD_H_GUARD */

Modified: trunk/include/parrot/hll.h
==============================================================================
--- trunk/include/parrot/hll.h  (original)
+++ trunk/include/parrot/hll.h  Fri Jun 15 14:22:33 2007
@@ -1,5 +1,5 @@
 /* hll.h
- *  Copyright (C) 2005, The Perl Foundation.
+ *  Copyright (C) 2005-2007, The Perl Foundation.
  *  SVN Info
  *     $Id$
  *  Overview:

Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h  (original)
+++ trunk/include/parrot/interpreter.h  Fri Jun 15 14:22:33 2007
@@ -552,6 +552,8 @@
 
 void Parrot_setup_event_func_ptrs(Parrot_Interp interp);
 
+PARROT_API void disable_event_checking(Interp *interp /*NN*/);
+PARROT_API void enable_event_checking(Interp *interp /*NN*/);
 #else
 
 struct Parrot_Interp_;

Modified: trunk/include/parrot/key.h
==============================================================================
--- trunk/include/parrot/key.h  (original)
+++ trunk/include/parrot/key.h  Fri Jun 15 14:22:33 2007
@@ -92,7 +92,8 @@
         __attribute__nonnull__(2);
 
 PARROT_API STRING * key_set_to_string( Interp *interp, PMC *key /*NULLOK*/ );
-PARROT_API STRING * key_string( Interp *interp, PMC *key /*NN*/ )
+PARROT_API STRING * key_string( Interp *interp /*NN*/, PMC *key /*NN*/ )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
 PARROT_API INTVAL key_type( Interp *interp, PMC *key /*NN*/ )

Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Fri Jun 15 14:22:33 2007
@@ -176,7 +176,9 @@
     const UINTVAL len )
         __attribute__warn_unused_result__;
 
-PARROT_API STRING * string_from_int( Interp *interp, INTVAL i );
+PARROT_API STRING * string_from_int( Interp *interp /*NN*/, INTVAL i )
+        __attribute__nonnull__(1);
+
 PARROT_API STRING * string_from_num( Interp *interp, FLOATVAL f );
 PARROT_API STRING * string_grow( Interp * interp,
     STRING *s /*NN*/,

Modified: trunk/src/gc/gc_gms.c
==============================================================================
--- trunk/src/gc/gc_gms.c       (original)
+++ trunk/src/gc/gc_gms.c       Fri Jun 15 14:22:33 2007
@@ -108,9 +108,12 @@
 
 */
 
-#include <parrot/parrot.h>
+#include "parrot/parrot.h"
+#include "parrot/dod.h"
 #include <assert.h>
 
+/* HEADER: include/parrot/dod.h */
+
 #if PARROT_GC_GMS
 
 /*
@@ -214,7 +217,7 @@
 */
 
 static void
-parrot_gc_gms_deinit(Interp* interp)
+parrot_gc_gms_deinit(Interp* interp /*NN*/)
 {
     Arenas * const arena_base = interp->arena_base;
 
@@ -226,7 +229,7 @@
 }
 
 static void
-gc_gms_pool_init(Interp *interp, Small_Object_Pool *pool)
+gc_gms_pool_init(Interp *interp, Small_Object_Pool *pool /*NN*/)
 {
     pool->add_free_object = gc_gms_add_free_object;
     pool->get_free_object = gc_gms_get_free_object;
@@ -240,8 +243,9 @@
     pool->object_size += sizeof (Gc_gms_hdr);
 }
 
+PARROT_API
 void
-Parrot_gc_gms_init(Interp* interp)
+Parrot_gc_gms_init(Interp* interp /*NN*/)
 {
     Arenas * const arena_base = interp->arena_base;
 
@@ -526,7 +530,7 @@
 */
 
 static Gc_gms_gen *
-gc_gms_find_gen(Interp *interp, Gc_gms_hdr *h, UINTVAL gen_no)
+gc_gms_find_gen(Interp *interp, Gc_gms_hdr *h /*NN*/, UINTVAL gen_no)
 {
     Gc_gms_gen *gen;
     Small_Object_Pool * const pool = h->gen->pool;
@@ -550,7 +554,7 @@
 }
 
 static void
-gc_gms_promote(Interp *interp, Gc_gms_hdr *h, UINTVAL gen_no)
+gc_gms_promote(Interp *interp, Gc_gms_hdr *h /*NN*/, UINTVAL gen_no)
 {
     Gc_gms_gen *gen;
     Gc_gms_hdr *prev, *next;
@@ -587,9 +591,9 @@
 }
 
 static void
-gc_gms_store_hdr_list(Interp *interp, Gc_gms_hdr_list *l, Gc_gms_hdr *h)
+gc_gms_store_hdr_list(Interp *interp, Gc_gms_hdr_list *l /*NN*/, Gc_gms_hdr *h)
 {
-    Gc_gms_hdr_store *s = l->last;
+    Gc_gms_hdr_store * const s = l->last;
 
     /* if it's not created or if it's full allocate new store */
     if (!s || s->ptr == &s->store[GC_GMS_STORE_SIZE]) {
@@ -622,7 +626,7 @@
 }
 
 static void
-gc_gms_store_igp(Interp *interp, Gc_gms_hdr *h)
+gc_gms_store_igp(Interp *interp, Gc_gms_hdr *h /*NN*/)
 {
     Gc_gms_gen * const gen = h->gen;
     Gc_gms_hdr_list * const igp = &gen->igp;
@@ -639,7 +643,7 @@
 }
 
 void
-parrot_gc_gms_wb(Interp *interp, PMC *agg, void *old, void *new)
+parrot_gc_gms_wb(Interp *interp, PMC *agg, void *old, void *new /*NN*/)
 {
     Gc_gms_hdr * const nh = PObj_to_GMSH(new);
     Gc_gms_hdr * const ah = PObj_to_GMSH(agg);

Modified: trunk/src/gc/gc_ims.c
==============================================================================
--- trunk/src/gc/gc_ims.c       (original)
+++ trunk/src/gc/gc_ims.c       Fri Jun 15 14:22:33 2007
@@ -334,8 +334,11 @@
 */
 
 #include "parrot/parrot.h"
+#include "parrot/dod.h"
 #include <assert.h>
 
+/* HEADER: include/parrot/dod.h */
+
 /*
  * size of one arena
  */
@@ -521,8 +524,9 @@
 
 */
 
+PARROT_API
 void
-Parrot_gc_ims_init(Interp* interp)
+Parrot_gc_ims_init(Interp* interp /*NN*/)
 {
     Arenas * const arena_base = interp->arena_base;
 
@@ -926,7 +930,7 @@
 
 #define DOD_IMS_GREY_NEW 1
 
-
+PARROT_API
 void
 Parrot_dod_ims_wb(Interp* interp, PMC *agg, PMC *_new)
 {

Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c  (original)
+++ trunk/src/global.c  Fri Jun 15 14:22:33 2007
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2004, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
 $Id$
 
 =head1 NAME
@@ -23,6 +23,8 @@
 #include "parrot/parrot.h"
 #include "global.str"
 
+/* HEADER: none */ /* XXX It's really include/parrot/global.h, but not yet */
+
 #define DEBUG_GLOBAL 0
 
 /*
@@ -34,8 +36,9 @@
 /* flags for internal_ns_keyed */
 #define INTERN_NS_CREAT 1       /* I'm a fan of the classics */
 
-static PMC * internal_ns_keyed(Interp *interp, PMC *base_ns, PMC *pmc_key,
-                               STRING *str_key, int flags)
+static PMC *
+internal_ns_keyed(Interp *interp, PMC *base_ns, PMC *pmc_key,
+                               STRING *str_key /*NULLOK*/, int flags)
 {
     PMC *ns, *sub_ns;
     INTVAL i, n;
@@ -85,9 +88,8 @@
                 return PMCNULL;
             VTABLE_set_pmc_keyed_str(interp, ns, part, sub_ns);
         }
-
         ns = sub_ns;
-    }
+    } /* for */
 
     return ns;
 }
@@ -125,30 +127,33 @@
 
 */
 
-
+PARROT_API
 PMC *
-Parrot_get_namespace_keyed(Interp *interp, PMC *base_ns, PMC *pmc_key)
+Parrot_get_namespace_keyed(Interp *interp /*NN*/, PMC *base_ns, PMC *pmc_key)
 {
     return internal_ns_keyed(interp, base_ns,
                              pmc_key, NULL, 0);
 }
 
+PARROT_API
 PMC *
-Parrot_get_namespace_keyed_str(Interp *interp, PMC *base_ns, STRING *str_key)
+Parrot_get_namespace_keyed_str(Interp *interp /*NN*/, PMC *base_ns, STRING 
*str_key)
 {
     return internal_ns_keyed(interp, base_ns,
                              PMCNULL, str_key, 0);
 }
 
+PARROT_API
 PMC *
-Parrot_make_namespace_keyed(Interp *interp, PMC *base_ns, PMC *pmc_key)
+Parrot_make_namespace_keyed(Interp *interp /*NN*/, PMC *base_ns, PMC *pmc_key)
 {
     return internal_ns_keyed(interp, base_ns,
                              pmc_key, NULL, INTERN_NS_CREAT);
 }
 
+PARROT_API
 PMC *
-Parrot_make_namespace_keyed_str(Interp *interp, PMC *base_ns, STRING *str_key)
+Parrot_make_namespace_keyed_str(Interp *interp /*NN*/, PMC *base_ns, STRING 
*str_key)
 {
     return internal_ns_keyed(interp, base_ns,
                              NULL, str_key, INTERN_NS_CREAT);
@@ -177,9 +182,9 @@
 
 */
 
-
+PARROT_API
 PMC *
-Parrot_make_namespace_autobase(Interp *interp, PMC *key)
+Parrot_make_namespace_autobase(Interp *interp /*NN*/, PMC *key)
 {
     PMC *base_ns;
     if (VTABLE_isa(interp, key, string_from_const_cstring(interp, "String", 
0)))
@@ -190,8 +195,9 @@
     return Parrot_make_namespace_keyed(interp, base_ns, key);
 }
 
+PARROT_API
 PMC *
-Parrot_get_namespace_autobase(Interp *interp, PMC *key)
+Parrot_get_namespace_autobase(Interp *interp /*NN*/, PMC *key)
 {
     PMC *base_ns;
     if (VTABLE_isa(interp, key, string_from_const_cstring(interp, "String", 
0)))
@@ -222,8 +228,21 @@
 
 */
 
+
+/*
+ * {get,set}_global.
+ *
+ * Parrot_get_global allows a null namespace without throwing an exception; it
+ * simply returns PMCNULL in that case.
+ *
+ * NOTE: At present the use of the {get,set}_global functions is mandatory due 
to the
+ *       wacky namespace typing of the default Parrot namespace.  Eventually 
it will be
+ *       safe to just use the standard hash interface (if desired).
+ */
+
+PARROT_API
 PMC *
-Parrot_get_global(Interp *interp, PMC *ns, STRING *globalname)
+Parrot_get_global(Interp *interp, PMC *ns /*NULLOK*/, STRING *globalname)
 {
     if (PMC_IS_NULL(ns))
         return PMCNULL;
@@ -231,6 +250,7 @@
     return (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
 }
 
+PARROT_API
 void
 Parrot_set_global(Interp *interp, PMC *ns, STRING *globalname, PMC *val)
 {
@@ -273,8 +293,9 @@
 
 */
 
+PARROT_API
 PMC *
-Parrot_find_global_n(Interp *interp, PMC *ns, STRING *globalname)
+Parrot_find_global_n(Interp *interp, PMC *ns /*NULLOK*/, STRING *globalname)
 {
     PMC *res;
 
@@ -299,13 +320,15 @@
     return PMC_IS_NULL(res) ? NULL : res;
 }
 
+PARROT_API
 PMC *
-Parrot_find_global_cur(Interp *interp, STRING *globalname)
+Parrot_find_global_cur(Interp *interp /*NN*/, STRING *globalname)
 {
     PMC * const ns = CONTEXT(interp->ctx)->current_namespace;
     return Parrot_find_global_n(interp, ns, globalname);
 }
 
+PARROT_API
 PMC *
 Parrot_find_global_k(Interp *interp, PMC *pmc_key, STRING *globalname)
 {
@@ -316,6 +339,7 @@
     return Parrot_find_global_n(interp, ns, globalname);
 }
 
+PARROT_API
 PMC *
 Parrot_find_global_s(Interp *inter, STRING *str_key, STRING *globalname)
 {
@@ -353,8 +377,9 @@
 
 */
 
+PARROT_API
 void
-Parrot_store_global_n(Interp *interp, PMC *ns,
+Parrot_store_global_n(Interp *interp /*NN*/, PMC *ns /*NULLOK*/,
                       STRING *globalname, PMC *val)
 {
 #if DEBUG_GLOBAL
@@ -368,8 +393,9 @@
     VTABLE_set_pmc_keyed_str(interp, ns, globalname, val);
 }
 
+PARROT_API
 void
-Parrot_store_global_cur(Interp *interp, STRING *globalname, PMC *val)
+Parrot_store_global_cur(Interp *interp /*NN*/, STRING *globalname, PMC *val)
 {
     Parrot_store_global_n(interp,
                           CONTEXT(interp->ctx)->current_namespace,
@@ -378,8 +404,9 @@
     /* FIXME - method cache invalidation should occur */
 }
 
+PARROT_API
 void
-Parrot_store_global_k(Interp *interp, PMC *pmc_key,
+Parrot_store_global_k(Interp *interp /*NN*/, PMC *pmc_key /*NN*/,
                       STRING *globalname, PMC *val)
 {
     PMC *ns;
@@ -404,13 +431,12 @@
     /* FIXME - method cache invalidation should occur */
 }
 
+PARROT_API
 void
-Parrot_store_global_s(Interp *inter, STRING *str_key,
+Parrot_store_global_s(Interp *inter /*NN*/, STRING *str_key,
                       STRING *globalname, PMC *val)
 {
-    PMC *ns;
-
-    ns = Parrot_make_namespace_keyed_str(inter,
+    PMC * const ns = Parrot_make_namespace_keyed_str(inter,
                                          Parrot_get_ctx_HLL_namespace(inter),
                                          str_key);
 
@@ -435,7 +461,7 @@
 
 PMC *
 Parrot_find_global_op(Interp *interp, PMC *ns,
-                      STRING *globalname, void *next)
+                      STRING *globalname /*NN*/, void *next)
 {
     PMC *res;
 
@@ -466,8 +492,9 @@
 
 */
 
+PARROT_API
 PMC *
-Parrot_find_name_op(Interp *interp, STRING *name, void *next)
+Parrot_find_name_op(Interp *interp /*NN*/, STRING *name, void *next)
 {
     parrot_context_t * const ctx = CONTEXT(interp->ctx);
     PMC *g, *lex_pad;
@@ -540,10 +567,12 @@
     string_cstring_free(c_meth);
 }
 
+PARROT_API
 void
 Parrot_store_sub_in_namespace(Interp *interp /*NN*/, PMC *sub)
 {
-    INTVAL cur_id = CONTEXT(interp->ctx)->current_HLL;
+    const INTVAL cur_id = CONTEXT(interp->ctx)->current_HLL;
+
     PMC *ns;
     /* PF structures aren't fully constructed yet */
     Parrot_block_DOD(interp);
@@ -560,15 +589,14 @@
         store_sub_in_multi(interp, sub, ns);
     /* store other subs (as long as they're not :anon) */
     else if (!(PObj_get_FLAGS(sub) & SUB_FLAG_PF_ANON)) {
-        STRING *name   = PMC_sub(sub)->name;
-        PMC    *nsname = PMC_sub(sub)->namespace_name;
+        STRING * const name   = PMC_sub(sub)->name;
+        PMC    * const nsname = PMC_sub(sub)->namespace_name;
 
         Parrot_store_global_n(interp, ns, name, sub);
 
         /* TEMPORARY HACK - cache invalidation should be a namespace function 
*/
-        if (!PMC_IS_NULL(nsname))
-        {
-            STRING *nsname_s = VTABLE_get_string(interp, nsname);
+        if (!PMC_IS_NULL(nsname)) {
+            STRING * const nsname_s = VTABLE_get_string(interp, nsname);
             Parrot_invalidate_method_cache(interp, nsname_s, name);
         }
     }
@@ -577,6 +605,7 @@
     CONTEXT(interp->ctx)->current_HLL = cur_id;
     Parrot_unblock_DOD(interp);
 }
+
 /*
 
 =back

Modified: trunk/src/key.c
==============================================================================
--- trunk/src/key.c     (original)
+++ trunk/src/key.c     Fri Jun 15 14:22:33 2007
@@ -291,7 +291,7 @@
 
 PARROT_API
 STRING *
-key_string(Interp *interp, PMC *key /*NN*/)
+key_string(Interp *interp /*NN*/, PMC *key /*NN*/)
 {
     switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
     case KEY_string_FLAG:

Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c  (original)
+++ trunk/src/string.c  Fri Jun 15 14:22:33 2007
@@ -1869,7 +1869,7 @@
 
 PARROT_API
 STRING *
-string_from_int(Interp *interp, INTVAL i)
+string_from_int(Interp *interp /*NN*/, INTVAL i)
 {
     char buf[128];
     return int_to_str(interp, buf, i, 10);

Modified: trunk/tools/build/vtable_extend.pl
==============================================================================
--- trunk/tools/build/vtable_extend.pl  (original)
+++ trunk/tools/build/vtable_extend.pl  Fri Jun 15 14:22:33 2007
@@ -120,6 +120,8 @@
 #include "parrot/parrot.h"
 #include "parrot/extend.h"
 
+/* HEADER: none */ /* XXX Ideally the headerizer can run on this file as well. 
*/
+
 EOF
 
 print $OUT $funcs;

Reply via email to