Author: petdance
Date: Tue Jun 12 12:16:21 2007
New Revision: 18957

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

Log:
headerized charset.c

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in  (original)
+++ trunk/config/gen/makefiles/root.in  Tue Jun 12 12:16:21 2007
@@ -1829,6 +1829,7 @@
 
 # Slowing working my way up to having everything headerized in 
$(HEADERIZER_O_FILES)
 HEADERIZER_O_FILES = \
+    src/charset.o \
     src/datatypes.o \
     src/byteorder.o \
     src/exceptions.o \

Modified: trunk/include/parrot/charset.h
==============================================================================
--- trunk/include/parrot/charset.h      (original)
+++ trunk/include/parrot/charset.h      Tue Jun 12 12:16:21 2007
@@ -1,5 +1,5 @@
 /* charset.h
- *  Copyright (C) 2004, The Perl Foundation.
+ *  Copyright (C) 2004-2007, The Perl Foundation.
  *  SVN Info
  *     $Id$
  *  Overview:
@@ -75,25 +75,76 @@
 typedef STRING *(*charset_string_from_codepoint_t)(Interp *, UINTVAL 
codepoint);
 typedef size_t (*charset_compute_hash_t)(Interp *, STRING *, size_t seed);
 
-PARROT_API CHARSET *Parrot_new_charset(Interp *);
-PARROT_API CHARSET *Parrot_load_charset(Interp *, const char *charsetname);
-PARROT_API CHARSET *Parrot_find_charset(Interp *, const char *charsetname);
-PARROT_API INTVAL Parrot_register_charset(Interp *, const char *charsetname, 
CHARSET *charset);
-PARROT_API INTVAL Parrot_make_default_charset(Interp *, const char 
*charsetname, CHARSET *charset);
-PARROT_API CHARSET *Parrot_default_charset(Interp *);
 typedef STRING* (*charset_converter_t)(Interp *, STRING *src, STRING *dst);
-PARROT_API charset_converter_t Parrot_find_charset_converter(Interp *, CHARSET 
*lhs, CHARSET *rhs);
-PARROT_API void Parrot_register_charset_converter(Interp *,
-        CHARSET *lhs, CHARSET *rhs, charset_converter_t func);
-
-PARROT_API void Parrot_charsets_encodings_init(Interp *);
-PARROT_API void Parrot_charsets_encodings_deinit(Interp *);
-
-PARROT_API INTVAL Parrot_charset_number(Interp *, STRING *charsetname);
-PARROT_API STRING* Parrot_charset_name(Interp *, INTVAL);
-PARROT_API const char* Parrot_charset_c_name(Interp *, INTVAL);
-PARROT_API INTVAL Parrot_charset_number_of_str(Interp *, STRING *src);
-PARROT_API CHARSET* Parrot_get_charset(Interp *, INTVAL number_of_charset);
+
+/* HEADERIZER BEGIN: src/charset.c */
+
+PARROT_API const char * Parrot_charset_c_name( Interp *interp,
+    INTVAL number_of_charset );
+
+PARROT_API STRING* Parrot_charset_name( Interp *interp,
+    INTVAL number_of_charset )
+        __attribute__warn_unused_result__;
+
+PARROT_API INTVAL Parrot_charset_number_of_str( Interp *interp,
+    STRING *src /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__warn_unused_result__;
+
+PARROT_API void Parrot_charsets_encodings_deinit( Interp *interp );
+PARROT_API void Parrot_charsets_encodings_init( Interp *interp /*NN*/ )
+        __attribute__nonnull__(1);
+
+PARROT_API CHARSET * Parrot_default_charset( Interp *interp )
+        __attribute__warn_unused_result__;
+
+PARROT_API CHARSET * Parrot_find_charset( Interp *interp,
+    const char *charsetname /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__warn_unused_result__;
+
+PARROT_API charset_converter_t Parrot_find_charset_converter( Interp *interp,
+    CHARSET *lhs /*NN*/,
+    CHARSET *rhs /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__warn_unused_result__;
+
+PARROT_API CHARSET* Parrot_get_charset( Interp *interp,
+    INTVAL number_of_charset );
+
+PARROT_API CHARSET * Parrot_load_charset( Interp *interp,
+    const char *charsetname /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__warn_unused_result__
+        __attribute__noreturn__;
+
+PARROT_API INTVAL Parrot_make_default_charset( Interp *interp,
+    const char *charsetname,
+    CHARSET *charset /*NN*/ )
+        __attribute__nonnull__(3);
+
+PARROT_API CHARSET * Parrot_new_charset( Interp *interp )
+        __attribute__malloc__
+        __attribute__warn_unused_result__;
+
+PARROT_API INTVAL Parrot_register_charset( Interp *interp,
+    const char *charsetname /*NN*/,
+    CHARSET *charset /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__warn_unused_result__;
+
+PARROT_API void Parrot_register_charset_converter( Interp *interp,
+    CHARSET *lhs /*NN*/,
+    CHARSET *rhs /*NN*/,
+    charset_converter_t func /*NN*/ )
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4);
+
+INTVAL Parrot_charset_number( Interp *interp, STRING *charsetname );
+/* HEADERIZER END: src/charset.c */
 
 struct _charset {
     const char *name;

Modified: trunk/src/charset.c
==============================================================================
--- trunk/src/charset.c (original)
+++ trunk/src/charset.c Tue Jun 12 12:16:21 2007
@@ -29,6 +29,8 @@
 #include "charset/iso-8859-1.h"
 #include "charset/unicode.h"
 
+/* HEADER: include/parrot/charset.h */
+
 CHARSET *Parrot_iso_8859_1_charset_ptr;
 CHARSET *Parrot_binary_charset_ptr;
 CHARSET *Parrot_default_charset_ptr;
@@ -59,12 +61,15 @@
 static All_charsets *all_charsets;
 
 
+PARROT_API
 CHARSET *
 Parrot_new_charset(Interp *interp)
+    /* MALLOC, WARN_UNUSED */
 {
     return mem_allocate_typed(CHARSET);
 }
 
+PARROT_API
 void
 Parrot_charsets_encodings_deinit(Interp *interp)
 {
@@ -82,8 +87,10 @@
     parrot_deinit_encodings(interp);
 }
 
+PARROT_API
 CHARSET *
-Parrot_find_charset(Interp *interp, const char *charsetname)
+Parrot_find_charset(Interp *interp, const char *charsetname /*NN*/)
+    /* WARN_UNUSED */
 {
     int i;
     const int n = all_charsets->n_charsets;
@@ -96,8 +103,10 @@
     return NULL;
 }
 
+PARROT_API
 CHARSET *
-Parrot_load_charset(Interp *interp, const char *charsetname)
+Parrot_load_charset(Interp *interp, const char *charsetname /*NN*/)
+    /* WARN_UNUSED, NORETURN */
 {
     internal_exception(UNIMPLEMENTED, "Can't load charsets yet");
     return NULL;
@@ -105,20 +114,16 @@
 
 /*
 
-=item C<INTVAL Parrot_charset_number(Interp *, STRING *charsetname)>
+FUNCDC: Parrot_charset_number
 
 Return the number of the charset or -1 if not found.
 
-=item C<INTVAL Parrot_charset_number_of_str(Interp *, const STRING *src)>
-
-Return the number of the charset of the given string or -1 if not found.
-
-=cut
-
 */
 
+PARROT_API
 INTVAL
 Parrot_charset_number(Interp *interp, STRING *charsetname)
+    /* WARN_UNUSED */
 {
     int i;
     const int n = all_charsets->n_charsets;
@@ -130,8 +135,18 @@
     return -1;
 }
 
+/*
+
+FUNCDOC: Parrot_charset_number_of_str
+
+Return the number of the charset of the given string or -1 if not found.
+
+*/
+
+PARROT_API
 INTVAL
-Parrot_charset_number_of_str(Interp *interp, STRING *src)
+Parrot_charset_number_of_str(Interp *interp, STRING *src /*NN*/)
+    /* WARN_UNUSED */
 {
     int i;
     const int n = all_charsets->n_charsets;
@@ -143,14 +158,17 @@
     return -1;
 }
 
+PARROT_API
 STRING*
 Parrot_charset_name(Interp *interp, INTVAL number_of_charset)
+    /* WARN_UNUSED */
 {
     if (number_of_charset >= all_charsets->n_charsets)
         return NULL;
     return all_charsets->set[number_of_charset].name;
 }
 
+PARROT_API
 CHARSET*
 Parrot_get_charset(Interp *interp, INTVAL number_of_charset)
 {
@@ -159,6 +177,7 @@
     return all_charsets->set[number_of_charset].charset;
 }
 
+PARROT_API
 const char *
 Parrot_charset_c_name(Interp *interp, INTVAL number_of_charset)
 {
@@ -168,8 +187,8 @@
 }
 
 static INTVAL
-register_charset(Interp *interp, const char *charsetname,
-        CHARSET *charset)
+register_charset(Interp *interp, const char *charsetname /*NN*/,
+        CHARSET *charset /*NN*/)
 {
     const int n = all_charsets->n_charsets;
     int i;
@@ -214,9 +233,11 @@
             charset_cvt_ascii_to_iso_8859_1);
 }
 
+PARROT_API
 INTVAL
-Parrot_register_charset(Interp *interp, const char *charsetname,
-        CHARSET *charset)
+Parrot_register_charset(Interp *interp, const char *charsetname /*NN*/,
+        CHARSET *charset /*NN*/)
+    /* WARN_UNUSED */
 {
     if (!all_charsets) {
         all_charsets = mem_allocate_typed(All_charsets);
@@ -245,8 +266,9 @@
     return 0;
 }
 
+PARROT_API
 void
-Parrot_charsets_encodings_init(Interp *interp)
+Parrot_charsets_encodings_init(Interp *interp /*NN*/)
 {
     /* the order is crucial here:
      * 1) encodings, default = fixed_8
@@ -272,23 +294,28 @@
     register_static_converters(interp);
 }
 
+PARROT_API
 INTVAL
 Parrot_make_default_charset(Interp *interp, const char *charsetname,
-        CHARSET *charset)
+        CHARSET *charset /*NN*/)
 {
     Parrot_default_charset_ptr = charset;
     return 1;
 }
 
+PARROT_API
 CHARSET *
 Parrot_default_charset(Interp *interp)
+    /* WARN_UNUSED */
 {
     return Parrot_default_charset_ptr;
 }
 
 
+PARROT_API
 charset_converter_t
-Parrot_find_charset_converter(Interp *interp, CHARSET *lhs, CHARSET *rhs)
+Parrot_find_charset_converter(Interp *interp, CHARSET *lhs /*NN*/, CHARSET 
*rhs /*NN*/)
+    /* WARN_UNUSED */
 {
     int i;
     const int n = all_charsets->n_charsets;
@@ -308,9 +335,10 @@
     return NULL;
 }
 
+PARROT_API
 void
 Parrot_register_charset_converter(Interp *interp,
-        CHARSET *lhs, CHARSET *rhs, charset_converter_t func)
+        CHARSET *lhs /*NN*/, CHARSET *rhs /*NN*/, charset_converter_t func 
/*NN*/)
 {
     const int n = all_charsets->n_charsets;
     int i;

Reply via email to