Author: petdance
Date: Tue Jun  5 13:52:32 2007
New Revision: 18829

Modified:
   trunk/config/gen/makefiles/root.in
   trunk/include/parrot/key.h
   trunk/include/parrot/objects.h
   trunk/src/key.c

Log:
key.c is now headerized

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in  (original)
+++ trunk/config/gen/makefiles/root.in  Tue Jun  5 13:52:32 2007
@@ -1836,7 +1836,9 @@
                src/stacks.o \
                src/stack_common.o \
                src/mmd.o \
-               src/objects.o
+               src/objects.o \
+               src/key.o \
+
 
 ###############################################################################
 #

Modified: trunk/include/parrot/key.h
==============================================================================
--- trunk/include/parrot/key.h  (original)
+++ trunk/include/parrot/key.h  Tue Jun  5 13:52:32 2007
@@ -1,9 +1,9 @@
 /* key.h
- *  Copyright (C) 2001-2004, The Perl Foundation.
+ *  Copyright (C) 2001-2007, The Perl Foundation.
  *  SVN Info
  *     $Id$
  *  Overview:
- *     This is the api header for the pmc subsystem
+ *     This is the API header for the pmc subsystem
  *  Data Structure and Algorithms:
  *  History:
  *  Notes:
@@ -36,32 +36,69 @@
 
 } KEY_flags;
 
-PARROT_API PMC *key_new(Interp *interp);
-PARROT_API PMC *key_new_integer(Interp *interp, INTVAL value);
-PARROT_API PMC *key_new_number(Interp *interp, FLOATVAL value);
-PARROT_API PMC *key_new_string(Interp *interp, STRING *value);
-PARROT_API PMC *key_new_cstring(Interp *interp, const char *value);
-PARROT_API PMC *key_new_pmc(Interp *interp, PMC *value);
-
-PARROT_API void key_set_integer(Interp *interp, PMC *key, INTVAL value);
-PARROT_API void key_set_number(Interp *interp, PMC *key, FLOATVAL value);
-PARROT_API void key_set_register(Interp *interp, PMC *key, INTVAL value,
-        INTVAL flag);
-PARROT_API void key_set_string(Interp *interp, PMC *key, STRING *value);
-PARROT_API void key_set_pmc(Interp *interp, PMC *key, PMC *value);
-
-PARROT_API INTVAL key_type(Interp *interp, PMC *key);
-PARROT_API INTVAL key_integer(Interp *interp, PMC *key);
-PARROT_API FLOATVAL key_number(Interp *interp, PMC *key);
-PARROT_API STRING *key_string(Interp *interp, PMC *key);
-PARROT_API PMC *key_pmc(Interp *interp, PMC *key);
-PARROT_API PMC *key_next(Interp *interp, PMC *key);
+/* HEADERIZER BEGIN: src/key.c */
 
-PARROT_API PMC *key_append(Interp *interp, PMC *key1, PMC *key2);
+PARROT_API PMC * key_append( Interp *interp,
+    PMC *key1 /*NN*/,
+    PMC *key2 /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
+
+PARROT_API INTVAL key_integer( Interp *interp, PMC *key /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API void key_mark( Interp *interp, PMC *key /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API PMC * key_new( Interp *interp );
+PARROT_API PMC * key_new_cstring( Interp *interp,
+    const char *value /*NULLOK*/ );
+
+PARROT_API PMC * key_new_integer( Interp *interp, INTVAL value );
+PARROT_API PMC * key_new_number( Interp *interp, FLOATVAL value );
+PARROT_API PMC * key_new_pmc( Interp *interp, PMC *value );
+PARROT_API PMC * key_new_string( Interp *interp, STRING *value );
+PARROT_API PMC * key_next( Interp *interp, PMC *key /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API FLOATVAL key_number( Interp *interp, PMC *key /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API PMC * key_pmc( Interp *interp, PMC *key /*NN*/ )
+        __attribute__nonnull__(2);
+
+PARROT_API void key_set_integer( Interp *interp,
+    PMC *key /*NN*/,
+    INTVAL value )
+        __attribute__nonnull__(2);
+
+PARROT_API void key_set_number( Interp *interp,
+    PMC *key /*NN*/,
+    FLOATVAL value )
+        __attribute__nonnull__(2);
+
+PARROT_API void key_set_pmc( Interp *interp, PMC *key /*NN*/, PMC *value )
+        __attribute__nonnull__(2);
+
+PARROT_API void key_set_register( Interp *interp,
+    PMC *key /*NN*/,
+    INTVAL value,
+    INTVAL flag )
+        __attribute__nonnull__(2);
+
+PARROT_API void key_set_string( Interp *interp,
+    PMC *key /*NN*/,
+    STRING *value )
+        __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*/ )
+        __attribute__nonnull__(2);
 
-PARROT_API void key_mark(Interp *interp, PMC *key);
+PARROT_API INTVAL key_type( Interp *interp, PMC *key /*NN*/ )
+        __attribute__nonnull__(2);
 
-PARROT_API STRING *key_set_to_string(Interp *interpreter, PMC *key);
+/* HEADERIZER END: src/key.c */
 
 #endif /* PARROT_KEY_H_GUARD */
 

Modified: trunk/include/parrot/objects.h
==============================================================================
--- trunk/include/parrot/objects.h      (original)
+++ trunk/include/parrot/objects.h      Tue Jun  5 13:52:32 2007
@@ -75,8 +75,9 @@
         __attribute__nonnull__(3);
 
 PARROT_API PMC* Parrot_find_vtable_meth( Interp *interp,
-    PMC *pmc,
-    STRING *meth );
+    PMC *pmc /*NN*/,
+    STRING *meth )
+        __attribute__nonnull__(2);
 
 PARROT_API PMC * Parrot_get_attrib_by_num( Interp *interp,
     PMC *object,
@@ -141,7 +142,7 @@
 
 PARROT_API PMC * Parrot_single_subclass( Interp *interp,
     PMC *base_class,
-    PMC *name );
+    PMC *name /*NULLOK*/ );
 
 void destroy_object_cache( Interp *interp );
 void mark_object_cache( Interp *interp );

Modified: trunk/src/key.c
==============================================================================
--- trunk/src/key.c     (original)
+++ trunk/src/key.c     Tue Jun  5 13:52:32 2007
@@ -12,25 +12,21 @@
 
 =head2 Functions
 
-=over 4
-
-=cut
-
 */
 
 #include "parrot/parrot.h"
+#include "parrot/key.h"
 
-/*
+/* HEADER: include/parrot/key.h */
 
-=item C<PMC *
-key_new(Interp *interp)>
+/*
 
+FUNCDOC: key_new
 Returns a new C<Key> PMC.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
 key_new(Interp *interp)
 {
@@ -41,15 +37,12 @@
 
 /*
 
-=item C<PMC *
-key_new_integer(Interp *interp, INTVAL value)>
-
+FUNCDOC: key_new_integer
 Returns a new integer C<Key> PMC with value C<value>.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
 key_new_integer(Interp *interp, INTVAL value)
 {
@@ -63,15 +56,12 @@
 
 /*
 
-=item C<PMC *
-key_new_number(Interp *interp, FLOATVAL value)>
-
+FUNCDOC: key_new_number
 Returns a new number C<Key> PMC with value C<value>.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
 key_new_number(Interp *interp, FLOATVAL value)
 {
@@ -85,15 +75,12 @@
 
 /*
 
-=item C<PMC *
-key_new_string(Interp *interp, STRING *value)>
-
+FUNCDOC:
 Returns a new string C<Key> PMC with value C<value>.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
 key_new_string(Interp *interp, STRING *value)
 {
@@ -107,18 +94,15 @@
 
 /*
 
-=item C<PMC *
-key_new_cstring(Interp *interp, const char *value)>
-
+FUNCDOC:
 Returns a new string C<Key> PMC with value C<value> converted to a
 C<STRING>.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
-key_new_cstring(Interp *interp, const char *value)
+key_new_cstring(Interp *interp, const char *value /*NULLOK*/)
 {
     return key_new_string(interp,
             string_from_cstring(interp, value, 0));
@@ -126,15 +110,12 @@
 
 /*
 
-=item C<PMC *
-key_new_pmc(Interp *interp, PMC *value)>
-
+FUNCDOC:
 Returns a new PMC C<Key> PMC with value C<value>.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
 key_new_pmc(Interp *interp, PMC *value)
 {
@@ -149,17 +130,14 @@
 
 /*
 
-=item C<void
-key_set_integer(Interp *interp, PMC *key, INTVAL value)>
-
+FUNCDOC:
 Set the integer C<value> in C<key>.
 
-=cut
-
 */
 
+PARROT_API
 void
-key_set_integer(Interp *interp, PMC *key, INTVAL value)
+key_set_integer(Interp *interp, PMC *key /*NN*/, INTVAL value)
 {
     PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
     PObj_get_FLAGS(key) |= KEY_integer_FLAG;
@@ -170,18 +148,14 @@
 
 /*
 
-=item C<void
-key_set_register(Interp *interp, PMC *key, INTVAL value,
-                 INTVAL flag)>
-
+FUNCDOC:
 Set the register C<value> in C<key>.
 
-=cut
-
 */
 
+PARROT_API
 void
-key_set_register(Interp *interp, PMC *key, INTVAL value,
+key_set_register(Interp *interp, PMC *key /*NN*/, INTVAL value,
                  INTVAL flag)
 {
     PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
@@ -193,17 +167,14 @@
 
 /*
 
-=item C<void
-key_set_number(Interp *interp, PMC *key, FLOATVAL value)>
-
+FUNCDOC:
 Set the number C<value> in C<key>.
 
-=cut
-
 */
 
+PARROT_API
 void
-key_set_number(Interp *interp, PMC *key, FLOATVAL value)
+key_set_number(Interp *interp, PMC *key /*NN*/, FLOATVAL value)
 {
     PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
     PObj_get_FLAGS(key) |= KEY_number_FLAG;
@@ -214,17 +185,14 @@
 
 /*
 
-=item C<void
-key_set_string(Interp *interp, PMC *key, STRING *value)>
-
+FUNCDOC:
 Set the string C<value> in C<key>.
 
-=cut
-
 */
 
+PARROT_API
 void
-key_set_string(Interp *interp, PMC *key, STRING *value)
+key_set_string(Interp *interp, PMC *key /*NN*/, STRING *value)
 {
     PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
     PObj_get_FLAGS(key) |= KEY_string_FLAG;
@@ -235,17 +203,14 @@
 
 /*
 
-=item C<void
-key_set_pmc(Interp *interp, PMC *key, PMC *value)>
-
+FUNCDOC: key_set_pmc
 Set the PMC C<value> in C<key>.
 
-=cut
-
 */
 
+PARROT_API
 void
-key_set_pmc(Interp *interp, PMC *key, PMC *value)
+key_set_pmc(Interp *interp, PMC *key /*NN*/, PMC *value)
 {
     PObj_get_FLAGS(key) &= ~KEY_type_FLAGS;
     PObj_get_FLAGS(key) |= KEY_pmc_FLAG;
@@ -261,36 +226,22 @@
 
 /*
 
-=item C<INTVAL
-key_type(Interp *interp, PMC *key)>
-
+FUNCDOC: key_type
 Returns the type of C<key>.
 
-=cut
-
 */
 
+PARROT_API
 INTVAL
-key_type(Interp *interp, PMC *key)
+key_type(Interp *interp, PMC *key /*NN*/)
 {
     return (PObj_get_FLAGS(key) & KEY_type_FLAGS) & ~KEY_register_FLAG;
 }
 
-/*
-
-=item C<INTVAL
-key_integer(Interp *interp, PMC *key)>
-
-=cut
-
-*/
-
+PARROT_API
 INTVAL
-key_integer(Interp *interp, PMC *key)
+key_integer(Interp *interp, PMC *key /*NN*/)
 {
-    PMC *reg;
-    STRING *s_reg;
-
     switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
     case KEY_hash_iterator_FLAGS:
     case KEY_integer_FLAG:
@@ -298,33 +249,27 @@
     case KEY_integer_FLAG | KEY_register_FLAG:
         return REG_INT(PMC_int_val(key));
     case KEY_pmc_FLAG | KEY_register_FLAG:
-        reg = REG_PMC(PMC_int_val(key));
+        {
+        PMC * const reg = REG_PMC(PMC_int_val(key));
         return VTABLE_get_integer(interp, reg);
+        }
     case KEY_string_FLAG:
         return string_to_int(interp, PMC_str_val(key));
     case KEY_string_FLAG | KEY_register_FLAG:
-        s_reg = REG_STR(PMC_int_val(key));
+        {
+        STRING * const s_reg = REG_STR(PMC_int_val(key));
         return string_to_int(interp, s_reg);
+        }
     default:
         /* TODO check for slice_FLAGs */
         return VTABLE_get_integer(interp, key);
     }
 }
 
-/*
-
-=item C<FLOATVAL
-key_number(Interp *interp, PMC *key)>
-
-=cut
-
-*/
-
+PARROT_API
 FLOATVAL
-key_number(Interp *interp, PMC *key)
+key_number(Interp *interp, PMC *key /*NN*/)
 {
-    PMC *reg;
-
     switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
     case KEY_number_FLAG:
         return PMC_num_val(key);
@@ -334,28 +279,20 @@
         return VTABLE_get_number(interp, key);
                                                  /*  PMC_pmc_val(key)); */
     case KEY_pmc_FLAG | KEY_register_FLAG:
-        reg = REG_PMC(PMC_int_val(key));
+        {
+        PMC * const reg = REG_PMC(PMC_int_val(key));
         return VTABLE_get_number(interp, reg);
+        }
     default:
         internal_exception(INVALID_OPERATION, "Key not a number!\n");
         return 0;
     }
 }
 
-/*
-
-=item C<STRING *
-key_string(Interp *interp, PMC *key)>
-
-=cut
-
-*/
-
+PARROT_API
 STRING *
-key_string(Interp *interp, PMC *key)
+key_string(Interp *interp, PMC *key /*NN*/)
 {
-    PMC *reg;
-
     switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
     case KEY_string_FLAG:
         return PMC_str_val(key);
@@ -363,8 +300,10 @@
         return REG_STR(PMC_int_val(key));
                                                    /*   PMC_pmc_val(key)); */
     case KEY_pmc_FLAG | KEY_register_FLAG:
-        reg = REG_PMC(PMC_int_val(key));
+        {
+        PMC * const reg = REG_PMC(PMC_int_val(key));
         return VTABLE_get_string(interp, reg);
+        }
     case KEY_integer_FLAG:
         return string_from_int(interp, PMC_int_val(key));
     case KEY_integer_FLAG | KEY_register_FLAG:
@@ -377,18 +316,15 @@
 
 /*
 
-=item C<PMC *
-key_pmc(Interp *interp, PMC *key)>
-
+FUNCDOC: key_pmc
 These functions return the integer/number/string/PMC values of C<key> if
 possible. Otherwise they throws an exceptions.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
-key_pmc(Interp *interp, PMC *key)
+key_pmc(Interp *interp, PMC *key /*NN*/)
 {
     switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
     case KEY_pmc_FLAG | KEY_register_FLAG:
@@ -400,17 +336,14 @@
 
 /*
 
-=item C<PMC *
-key_next(Interp *interp, PMC *key)>
-
+FUNCDOC: key_next
 Returns the next key if C<key> is in a sequence of linked keys.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
-key_next(Interp *interp, PMC *key)
+key_next(Interp *interp, PMC *key /*NN*/)
 {
     if (!key->pmc_ext)
         return NULL;
@@ -419,9 +352,7 @@
 
 /*
 
-=item C<PMC *
-key_append(Interp *interp, PMC *key1, PMC *key2)>
-
+FUNCDOC: key_append
 Appends C<key2> to C<key1>.
 
 Note that if C<key1> is not the last key in a sequence linked keys then
@@ -429,12 +360,11 @@
 
 Returns C<key1>.
 
-=cut
-
 */
 
+PARROT_API
 PMC *
-key_append(Interp *interp, PMC *key1, PMC *key2)
+key_append(Interp *interp, PMC *key1 /*NN*/, PMC *key2 /*NN*/)
 {
     PMC *tail = key1;
 
@@ -449,17 +379,14 @@
 
 /*
 
-=item C<void
-key_mark(Interp *interp, PMC *key)>
-
+FUNCDOC: key_mark
 Marks C<key> as live.
 
-=cut
-
 */
 
+PARROT_API
 void
-key_mark(Interp *interp, PMC *key)
+key_mark(Interp *interp, PMC *key /*NN*/)
 {
     const UINTVAL flags = PObj_get_FLAGS(key) & KEY_type_FLAGS;
 
@@ -478,17 +405,9 @@
 
 }
 
-/*
-
-=item C<STRING *
-key_set_to_string(Interp *interpreter, PMC *key)>
-
-=cut
-
-*/
-
+PARROT_API
 STRING *
-key_set_to_string(Interp *interp, PMC *key)
+key_set_to_string(Interp *interp, PMC *key /*NULLOK*/)
 {
     STRING * const semicolon = string_from_cstring(interp, " ; ", 3);
     STRING * const quote = string_from_cstring(interp, "'", 1);
@@ -535,8 +454,6 @@
 
 /*
 
-=back
-
 =head1 SEE ALSO
 
 F<include/parrot/key.h>.

Reply via email to