Author: petdance
Date: Sat Jun  9 19:00:13 2007
New Revision: 18902

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

Log:
consted and headerized the byte order functions

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in  (original)
+++ trunk/config/gen/makefiles/root.in  Sat Jun  9 19:00:13 2007
@@ -1829,6 +1829,7 @@
 # Slowing working my way up to having everything headerized in 
$(HEADERIZER_O_FILES)
 HEADERIZER_O_FILES = \
     src/datatypes.o \
+    src/byteorder.o \
     src/gc/dod.o \
     src/gc/memory.o \
     src/gc/register.o \

Modified: trunk/include/parrot/packfile.h
==============================================================================
--- trunk/include/parrot/packfile.h     (original)
+++ trunk/include/parrot/packfile.h     Sat Jun  9 19:00:13 2007
@@ -11,7 +11,7 @@
 #ifndef PARROT_PACKFILE_H_GUARD
 #define PARROT_PACKFILE_H_GUARD
 
-#include <parrot/parrot.h>
+#include "parrot/parrot.h"
 
 #define PF_NCONST(pf)  ((pf)->const_table->const_count)
 #define PF_CONST(pf,i) ((pf)->const_table->constants[(i)])
@@ -413,20 +413,64 @@
 ** Byte Ordering Functions (byteorder.c)
 */
 
-INTVAL fetch_iv_le(INTVAL w);
-INTVAL fetch_iv_be(INTVAL w);
-opcode_t fetch_op_be(opcode_t w);
-opcode_t fetch_op_le(opcode_t w);
-void fetch_buf_be_4(unsigned char * rb, unsigned char * b);
-void fetch_buf_le_4(unsigned char * rb, unsigned char * b);
-void fetch_buf_be_8(unsigned char * rb, unsigned char * b);
-void fetch_buf_le_8(unsigned char * rb, unsigned char * b);
-void fetch_buf_le_12(unsigned char * rb, unsigned char * b);
-void fetch_buf_be_12(unsigned char * rb, unsigned char * b);
-void fetch_buf_le_16(unsigned char * rb, unsigned char * b);
-void fetch_buf_be_16(unsigned char * rb, unsigned char * b);
+/* HEADERIZER BEGIN: src/byteorder.c */
 
+void fetch_buf_be_12(
+    unsigned char *rb /*NN*/,
+    const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void fetch_buf_be_16(
+    unsigned char *rb /*NN*/,
+    const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void fetch_buf_be_4( unsigned char *rb /*NN*/, const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void fetch_buf_be_8( unsigned char *rb /*NN*/, const unsigned char *b )
+        __attribute__nonnull__(1);
+
+void fetch_buf_le_12(
+    unsigned char *rb /*NN*/,
+    const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void fetch_buf_le_16(
+    unsigned char *rb /*NN*/,
+    const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void fetch_buf_le_4( unsigned char *rb /*NN*/, const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void fetch_buf_le_8( unsigned char *rb /*NN*/, const unsigned char *b /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+INTVAL fetch_iv_be( INTVAL w )
+        __attribute__const__
+        __attribute__warn_unused_result__;
+
+INTVAL fetch_iv_le( INTVAL w )
+        __attribute__const__
+        __attribute__warn_unused_result__;
+
+opcode_t fetch_op_be( opcode_t w )
+        __attribute__const__
+        __attribute__warn_unused_result__;
+
+opcode_t fetch_op_le( opcode_t w )
+        __attribute__const__
+        __attribute__warn_unused_result__;
 
+/* HEADERIZER END: src/byteorder.c */
 
 #endif /* PARROT_PACKFILE_H_GUARD */
 

Modified: trunk/src/byteorder.c
==============================================================================
--- trunk/src/byteorder.c       (original)
+++ trunk/src/byteorder.c       Sat Jun  9 19:00:13 2007
@@ -19,28 +19,26 @@
 
 Configure will have checked for supported word sizes.
 
-=over 4
-
-=cut
-
 */
 
 #include "parrot/parrot.h"
+#include "parrot/packfile.h"
+
+/* HEADER: include/parrot/packfile.h */
 
 /*
 
-=item C<INTVAL fetch_iv_le(INTVAL w)>
+FUNCDOC: fetch_iv_le
 
 This function converts a 4 or 8 byte C<INTVAL> into little endian
 format. If the native format is already little endian, then no
 conversion is done.
 
-=cut
-
 */
 
 INTVAL
 fetch_iv_le(INTVAL w)
+    /* CONST,WARN_UNUSED */
 {
 #if !PARROT_BIGENDIAN
     return w;
@@ -65,17 +63,16 @@
 
 /*
 
-=item C<INTVAL fetch_iv_be(INTVAL w)>
+FUNCDOC: fetch_iv_be
 
 This function converts a 4 or 8 byte C<INTVAL> into big endian format.
 If the native format is already big endian, then no conversion is done.
 
-=cut
-
 */
 
 INTVAL
 fetch_iv_be(INTVAL w)
+    /* CONST, WARN_UNUSED */
 {
 #if PARROT_BIGENDIAN
     return w;
@@ -99,18 +96,15 @@
 
 /*
 
-=item C<opcode_t fetch_op_be(opcode_t w)>
-
-=item C<opcode_t fetch_op_le(opcode_t w)>
+FUNCDOC: fetch_op_be
 
-Same as above for C<opcode_t>.
-
-=cut
+Same as C<fetch_iv_be> for opcode_t
 
 */
 
 opcode_t
 fetch_op_be(opcode_t w)
+    /* CONST, WARN_UNUSED */
 {
 #if PARROT_BIGENDIAN
     return w;
@@ -134,8 +128,17 @@
 #endif
 }
 
+/*
+
+FUNCDOC: fetch_op_le
+
+Same as C<fetch_iv_le> for opcode_t
+
+*/
+
 opcode_t
 fetch_op_le(opcode_t w)
+    /* CONST, WARN_UNUSED */
 {
 #if !PARROT_BIGENDIAN
     return w;
@@ -161,32 +164,14 @@
 
 /*
 
-=item C<void fetch_buf_be_4(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_le_4(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_be_8(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_le_8(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_le_12(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_be_12(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_le_16(unsigned char *rb, unsigned char *b)>
-
-=item C<void fetch_buf_be_16(unsigned char *rb, unsigned char *b)>
-
 Unrolled routines for swapping various sizes from 32-128 bits. These
 should only be used if alignment is unknown or we are pulling something
 out of a padded buffer.
 
-=cut
-
 */
 
 void
-fetch_buf_be_4(unsigned char *rb, unsigned char *b)
+fetch_buf_be_4(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if PARROT_BIGENDIAN
     memcpy(rb, b, 4);
@@ -199,7 +184,7 @@
 }
 
 void
-fetch_buf_le_4(unsigned char *rb, unsigned char *b)
+fetch_buf_le_4(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if !PARROT_BIGENDIAN
     memcpy(rb, b, 4);
@@ -212,7 +197,7 @@
 }
 
 void
-fetch_buf_be_8(unsigned char *rb, unsigned char *b)
+fetch_buf_be_8(unsigned char *rb /*NN*/, const unsigned char *b)
 {
 #if PARROT_BIGENDIAN
     memcpy(rb, b, 8);
@@ -229,7 +214,7 @@
 }
 
 void
-fetch_buf_le_8(unsigned char *rb, unsigned char *b)
+fetch_buf_le_8(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if !PARROT_BIGENDIAN
     memcpy(rb, b, 8);
@@ -246,7 +231,7 @@
 }
 
 void
-fetch_buf_le_12(unsigned char *rb, unsigned char *b)
+fetch_buf_le_12(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if !PARROT_BIGENDIAN
     memcpy(rb, b, 12);
@@ -267,7 +252,7 @@
 }
 
 void
-fetch_buf_be_12(unsigned char *rb, unsigned char *b)
+fetch_buf_be_12(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if PARROT_BIGENDIAN
     memcpy(rb, b, 12);
@@ -288,7 +273,7 @@
 }
 
 void
-fetch_buf_le_16(unsigned char *rb, unsigned char *b)
+fetch_buf_le_16(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if !PARROT_BIGENDIAN
     memcpy(rb, b, 16);
@@ -313,7 +298,7 @@
 }
 
 void
-fetch_buf_be_16(unsigned char *rb, unsigned char *b)
+fetch_buf_be_16(unsigned char *rb /*NN*/, const unsigned char *b /*NN*/)
 {
 #if PARROT_BIGENDIAN
     memcpy(rb, b, 16);
@@ -339,13 +324,9 @@
 
 /*
 
-=back
-
 =head1 HISTORY
 
-Initial version by Melvin on 2002/05/1
-
-=cut
+Initial version by Melvin on 2002/05/01
 
 */
 

Reply via email to