Author: petdance
Date: Thu Jun 14 18:10:51 2007
New Revision: 19011
Modified:
trunk/config/gen/makefiles/root.in
trunk/include/parrot/builtin.h
trunk/include/parrot/string_funcs.h
trunk/src/builtin.c
trunk/src/string.c
Log:
headerized builtin.c
Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in (original)
+++ trunk/config/gen/makefiles/root.in Thu Jun 14 18:10:51 2007
@@ -1822,13 +1822,13 @@
HEADERIZER_O_FILES = \
$(INTERP_O_FILES) \
- $(CLASS_O_FILES) \
# Slowing working my way up to having everything headerized in
$(HEADERIZER_O_FILES)
HEADERIZER_O_FILES = \
$(CHARSET_O_FILES) \
$(ENCODING_O_FILES) \
$(IO_O_FILES) \
+ src/builtin.o \
src/byteorder.o \
src/charset.o \
src/datatypes.o \
Modified: trunk/include/parrot/builtin.h
==============================================================================
--- trunk/include/parrot/builtin.h (original)
+++ trunk/include/parrot/builtin.h Thu Jun 14 18:10:51 2007
@@ -1,9 +1,9 @@
/* builtin.h
- * Copyright (C) 2005, The Perl Foundation.
+ * Copyright (C) 2005-2007, The Perl Foundation.
* SVN Info
* $Id$
* Overview:
- * This is the api header for builtins.
+ * This is the API header for builtins.
* Data Structure and Algorithms:
* History:
* Notes:
@@ -15,6 +15,26 @@
#include "parrot/compiler.h"
+/* HEADERIZER BEGIN: src/builtin.c */
+
+const char * Parrot_builtin_get_c_namespace( Interp *interp, int bi );
+int Parrot_builtin_is_class_method( Interp *interp, int bi );
+int Parrot_builtin_is_void( Interp *interp, int bi );
+PMC* Parrot_find_builtin( Interp *interp, STRING *func /*NN*/ )
+ __attribute__nonnull__(2)
+ __attribute__warn_unused_result__;
+
+void Parrot_init_builtins( Interp *interp /*NN*/ )
+ __attribute__nonnull__(1);
+
+int Parrot_is_builtin( Interp *interp,
+ const char *func /*NN*/,
+ const char *sig )
+ __attribute__nonnull__(2)
+ __attribute__warn_unused_result__;
+
+/* HEADERIZER END: src/builtin.c */
+
void Parrot_init_builtins(Interp *interp);
int Parrot_is_builtin(Interp *interp, const char *func, const char *sig)
__attribute__nonnull__(2);
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Thu Jun 14 18:10:51 2007
@@ -21,7 +21,9 @@
/* HEADERIZER BEGIN: src/string.c */
-PARROT_API STRING * const_string( Interp *interp, const char *buffer /*NN*/ )
+PARROT_API STRING * const_string( Interp *interp /*NN*/,
+ const char *buffer /*NN*/ )
+ __attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_API STRING * int_to_str( Interp *interp /*NN*/,
@@ -212,12 +214,13 @@
UINTVAL flags )
__attribute__nonnull__(1);
-PARROT_API STRING * string_make_direct( Interp *interp,
+PARROT_API STRING * string_make_direct( Interp *interp /*NN*/,
const char *buffer /*NULLOK*/,
UINTVAL len,
ENCODING *encoding /*NN*/,
CHARSET *charset /*NN*/,
UINTVAL flags )
+ __attribute__nonnull__(1)
__attribute__nonnull__(4)
__attribute__nonnull__(5);
Modified: trunk/src/builtin.c
==============================================================================
--- trunk/src/builtin.c (original)
+++ trunk/src/builtin.c Thu Jun 14 18:10:51 2007
@@ -12,10 +12,6 @@
=head2 Functions
-=over 4
-
-=cut
-
*/
#include "parrot/parrot.h"
@@ -23,6 +19,8 @@
#include "builtin.str"
#include <assert.h>
+/* HEADER: include/parrot/builtin.h */
+
typedef struct _builtin {
const char *c_name; /* short name 'cos' */
@@ -84,24 +82,22 @@
/*
-=item C<void Parrot_init_builtins(Interp *)>
+FUNCDOC: Parrot_init_builtins
Initialize the builtins structure.
-=item C<int Parrot_is_builtin(Interp *, char *func, char *sig)>
+FUNCDOC: Parrot_is_builtin
Return the index of the builtin or -1 on failure.
-=item C<PMC* Parrot_find_builtin(Interp *, STRING *func)>
+FUNCDOC: Parrot_find_builtin
Return the NCI PMC of the builtin or NULL.
-=cut
-
*/
void
-Parrot_init_builtins(Interp *interp)
+Parrot_init_builtins(Interp *interp /*NN*/)
{
size_t i;
char buffer[128];
@@ -164,11 +160,10 @@
int low = 0;
int high = N_BUILTINS - 1;
- /* binary search */
- while (low <= high)
- {
- int i = (low + high) / 2;
- int cmp = string_compare(interp, func, builtins[i].meth_name);
+ /* binary search */ /* XXX isn't there a standard C func for this? */
+ while (low <= high) {
+ const int i = (low + high) / 2;
+ const int cmp = string_compare(interp, func, builtins[i].meth_name);
if (!cmp)
return i;
@@ -214,7 +209,8 @@
}
int
-Parrot_is_builtin(Interp *interp, const char *func, const char *sig)
+Parrot_is_builtin(Interp *interp, const char *func /*NN*/, const char *sig)
+ /* WARN_UNUSED */
{
int bi, i, pass;
@@ -241,7 +237,8 @@
}
PMC*
-Parrot_find_builtin(Interp *interp, STRING *func)
+Parrot_find_builtin(Interp *interp, STRING *func /*NN*/)
+ /* WARN_UNUSED */
{
const int i = find_builtin_s(interp, func);
if (i < 0)
@@ -277,14 +274,10 @@
/*
-=back
-
=head1 SEE ALSO
F<ops/math.ops>
-=cut
-
*/
/*
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Thu Jun 14 18:10:51 2007
@@ -557,7 +557,7 @@
PARROT_API
STRING *
-const_string(Interp *interp, const char *buffer /*NN*/)
+const_string(Interp *interp /*NN*/, const char *buffer /*NN*/)
{
/* TODO cache the strings */
return string_make_direct(interp, buffer, strlen(buffer),
@@ -615,7 +615,7 @@
PARROT_API
STRING *
-string_make_direct(Interp *interp, const char *buffer /*NULLOK*/, UINTVAL len,
+string_make_direct(Interp *interp /*NN*/, const char *buffer /*NULLOK*/,
UINTVAL len,
ENCODING *encoding /*NN*/, CHARSET *charset /*NN*/, UINTVAL flags)
{
STRING * const s = new_string_header(interp, flags);