Author: petdance
Date: Sun Jun 17 08:23:33 2007
New Revision: 19064
Modified:
trunk/config/gen/makefiles/root.in
trunk/include/parrot/longopt.h
trunk/include/parrot/misc.h
trunk/src/longopt.c
trunk/src/misc.c
Log:
headerized misc.c and longopt.c
Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in (original)
+++ trunk/config/gen/makefiles/root.in Sun Jun 17 08:23:33 2007
@@ -1859,6 +1859,8 @@
src/key.o \
src/library.o \
src/list.o \
+ src/longopt.o \
+ src/misc.o \
src/mmd.o \
src/objects.o \
src/packdump.o \
Modified: trunk/include/parrot/longopt.h
==============================================================================
--- trunk/include/parrot/longopt.h (original)
+++ trunk/include/parrot/longopt.h Sun Jun 17 08:23:33 2007
@@ -44,6 +44,19 @@
#define LONGOPT_OPT_INFO_INIT { 1, 0, NULL, NULL, NULL }
+/* HEADERIZER BEGIN: src/longopt.c */
+
+PARROT_API int longopt_get( Interp *interp /*NN*/,
+ int argc,
+ char* argv[] /*NN*/,
+ const struct longopt_opt_decl options[] /*NN*/,
+ struct longopt_opt_info* info_buf /*NN*/ )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5);
+
+/* HEADERIZER END: src/longopt.c */
PARROT_API int longopt_get(Parrot_Interp, int argc, char* argv[],
const struct longopt_opt_decl options[],
struct longopt_opt_info* info_buf);
Modified: trunk/include/parrot/misc.h
==============================================================================
--- trunk/include/parrot/misc.h (original)
+++ trunk/include/parrot/misc.h Sun Jun 17 08:23:33 2007
@@ -88,6 +88,7 @@
/* HEADERIZER END: src/utils.c */
+
/*
* IMCC API
*/
@@ -99,31 +100,64 @@
PMC * IMCC_compile_pasm_s(Parrot_Interp interp, const char *s,
STRING **error_message);
-/*
- * misc.c
- */
-
-PARROT_API STRING *Parrot_vsprintf_s(Interp *, STRING *pat, va_list);
-
-PARROT_API STRING *Parrot_vsprintf_c(Interp *, const char *pat, va_list);
-
-PARROT_API void Parrot_vsprintf(Interp *, char *targ, const char *pat,
- va_list);
-
-PARROT_API void Parrot_vsnprintf(Interp *, char *targ, size_t len,
- const char *pat, va_list);
-
-PARROT_API STRING *Parrot_sprintf_s(Interp *, STRING *pat, ...);
-
-PARROT_API STRING *Parrot_sprintf_c(Interp *, const char *pat, ...);
-PARROT_API void Parrot_sprintf(Interp *, char *targ, const char *pat, ...);
+/* HEADERIZER BEGIN: src/misc.c */
-PARROT_API void Parrot_snprintf(Interp *, char *targ, size_t len,
- const char *pat, ...);
+PARROT_API STRING * Parrot_psprintf( Interp *interp /*NN*/,
+ STRING *pat /*NN*/,
+ PMC *ary /*NN*/ )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__warn_unused_result__;
+
+PARROT_API void Parrot_snprintf( Interp *interp /*NN*/,
+ char *targ /*NN*/,
+ size_t len,
+ const char *pat /*NN*/,
+ ... )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4);
+
+PARROT_API STRING * Parrot_sprintf_c( Interp *interp /*NN*/,
+ const char *pat /*NN*/,
+ ... )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__warn_unused_result__;
+
+PARROT_API STRING * Parrot_sprintf_s( Interp *interp /*NN*/,
+ STRING *pat /*NN*/,
+ ... )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__warn_unused_result__;
+
+PARROT_API void Parrot_vsnprintf( Interp *interp /*NN*/,
+ char *targ /*NN*/,
+ size_t len,
+ const char *pat /*NN*/,
+ va_list args )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4);
+
+PARROT_API STRING * Parrot_vsprintf_c( Interp *interp /*NN*/,
+ const char *pat /*NN*/,
+ va_list args )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__warn_unused_result__;
+
+PARROT_API STRING * Parrot_vsprintf_s( Interp *interp /*NN*/,
+ STRING *pat /*NN*/,
+ va_list args )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__warn_unused_result__;
-PARROT_API STRING *Parrot_psprintf(Interp *interp, STRING *pat,
- PMC * ary);
+/* HEADERIZER END: src/misc.c */
#ifdef IN_SPF_SYSTEM
Modified: trunk/src/longopt.c
==============================================================================
--- trunk/src/longopt.c (original)
+++ trunk/src/longopt.c Sun Jun 17 08:23:33 2007
@@ -12,15 +12,13 @@
=head2 Functions
-=over 4
-
-=cut
-
*/
#include "parrot/parrot.h"
#include "parrot/longopt.h"
+/* HEADER: include/parrot/longopt.h */
+
static int longopt_get_longopt(Parrot_Interp, int argc, char* argv[],
const struct longopt_opt_decl options[],
struct longopt_opt_info* info_buf);
@@ -33,10 +31,7 @@
/*
-=item C<int
-longopt_get(Parrot_Interp interp, int argc, char* argv[],
- const struct longopt_opt_decl options[],
- struct longopt_opt_info* info_buf)>
+FUNCDOC: longopt_get
Gets long or short options, specified in C<options[]> (see
F<docs/dev/longopt.dev>).
@@ -49,14 +44,13 @@
Any other value is a valid option identifier.
-=cut
-
*/
+PARROT_API
int
-longopt_get(Parrot_Interp interp, int argc, char* argv[],
- const struct longopt_opt_decl options[],
- struct longopt_opt_info* info_buf)
+longopt_get(Interp *interp /*NN*/, int argc, char* argv[] /*NN*/,
+ const struct longopt_opt_decl options[] /*NN*/,
+ struct longopt_opt_info* info_buf /*NN*/)
{
const int dex = info_buf->opt_index;
@@ -89,10 +83,7 @@
/*
-=item C<static int
-longopt_get_longopt(Parrot_Interp interp, int argc, char* argv[],
- const struct longopt_opt_decl options[],
- struct longopt_opt_info* info_buf)>
+FUNCDOC: longopt_get_longopt
Find the option identifier of a long option.
@@ -101,13 +92,11 @@
C<argv[info_buf->opt_index]> is guaranteed to have at least three
characters and start with C<-->.
-=cut
-
*/
static int
-longopt_get_longopt(Parrot_Interp interp, int argc, char* argv[],
- const struct longopt_opt_decl options[],
+longopt_get_longopt(Interp *interp /*NN*/, int argc, char* argv[] /*NN*/,
+ const struct longopt_opt_decl options[] /*NN*/,
struct longopt_opt_info* info_buf)
{
const int dex = info_buf->opt_index;
@@ -185,10 +174,7 @@
/*
-=item C<static int
-longopt_get_shortopt(Parrot_Interp interp, int argc, char* argv[],
- const struct longopt_opt_decl options[],
- struct longopt_opt_info* info_buf)>
+FUNCDOC: longopt_get_shortopt
Find the option identifier of the next short option.
@@ -198,14 +184,12 @@
C<< argv[info_buf->opt_index] >> is guaranteed to be at least two
characters long and start with a dash.
-=cut
-
*/
static int
-longopt_get_shortopt(Parrot_Interp interp, int argc, char* argv[],
- const struct longopt_opt_decl options[],
- struct longopt_opt_info* info_buf)
+longopt_get_shortopt(Interp *interp /*NN*/, int argc, char* argv[] /*NN*/,
+ const struct longopt_opt_decl options[] /*NN*/,
+ struct longopt_opt_info* info_buf /*NN*/)
{
const int dex = info_buf->opt_index;
const struct longopt_opt_decl* dptr;
@@ -279,14 +263,10 @@
/*
-=back
-
=head1 SEE ALSO
F<include/parrot/longopt.h> and F<docs/dev/longopt.dev>.
-=cut
-
*/
Modified: trunk/src/misc.c
==============================================================================
--- trunk/src/misc.c (original)
+++ trunk/src/misc.c Sun Jun 17 08:23:33 2007
@@ -36,31 +36,28 @@
=back
-=over 4
-
-=cut
-
*/
#define IN_SPF_SYSTEM
#include "parrot/parrot.h"
+/* HEADER: include/parrot/misc.h */
+
/*
-=item C<STRING *
-Parrot_vsprintf_s(Interp *interp, STRING *pat, va_list args)>
+FUNCDOC: Parrot_vsprintf_s
Almost all the other sprintf variants in this file are implemented in
terms of this function (see C<Parrot_psprintf()> for the exception). It
in turn calls C<Parrot_sprintf_format()> (see F<src/spf_render.c>).
-=cut
-
*/
+PARROT_API
STRING *
-Parrot_vsprintf_s(Interp *interp, STRING *pat, va_list args)
+Parrot_vsprintf_s(Interp *interp /*NN*/, STRING *pat /*NN*/, va_list args)
+ /* WARN_UNUSED */
{
SPRINTF_OBJ obj = va_core;
obj.data = PARROT_VA_TO_VAPTR(args);
@@ -70,19 +67,16 @@
/*
-=item C<STRING *
-Parrot_vsprintf_c(Interp *interp, const char *pat,
- va_list args)>
+FUNCDOC: Parrot_vsprintf_c
C string version of C<Parrot_vsprintf_s()>.
-=cut
-
*/
+PARROT_API
STRING *
-Parrot_vsprintf_c(Interp *interp, const char *pat,
- va_list args)
+Parrot_vsprintf_c(Interp *interp /*NN*/, const char *pat /*NN*/, va_list args)
+ /* WARN_UNUSED */
{
STRING * const realpat = string_make(interp, pat, strlen(pat),
NULL, PObj_external_FLAG);
@@ -94,20 +88,17 @@
/*
-=item C<void
-Parrot_vsnprintf(Interp *interp, char *targ,
- size_t len, const char *pat, va_list args)>
+FUNCDOC: Parrot_vsnprintf
Similar to C<Parrot_vsprintf()> but with an option to specify the length
(C<len>) of the returned C string.
-=cut
-
*/
+PARROT_API
void
-Parrot_vsnprintf(Interp *interp, char *targ,
- size_t len, const char *pat, va_list args)
+Parrot_vsnprintf(Interp *interp /*NN*/, char *targ /*NN*/,
+ size_t len, const char *pat /*NN*/, va_list args)
{
if (len == 0)
return;
@@ -128,17 +119,16 @@
/*
-=item C<STRING *
-Parrot_sprintf_s(Interp *interp, STRING *pat, ...)>
+FUNCDOC: Parrot_sprintf_s
Calls C<Parrot_vsprintf_s()> with the C<va_list> obtained from C<...>.
-=cut
-
*/
+PARROT_API
STRING *
-Parrot_sprintf_s(Interp *interp, STRING *pat, ...)
+Parrot_sprintf_s(Interp *interp /*NN*/, STRING *pat /*NN*/, ...)
+ /* WARN_UNUSED */
{
STRING *ret;
va_list args;
@@ -154,17 +144,16 @@
/*
-=item C<STRING *
-Parrot_sprintf_c(Interp *interp, const char *pat, ...)>
+FUNCDOC: Parrot_sprintf_c
C string version of C<Parrot_sprintf_s()>.
-=cut
-
*/
+PARROT_API
STRING *
-Parrot_sprintf_c(Interp *interp, const char *pat, ...)
+Parrot_sprintf_c(Interp *interp /*NN*/, const char *pat /*NN*/, ...)
+ /* WARN_UNUSED */
{
STRING *ret;
va_list args;
@@ -180,20 +169,17 @@
/*
-=item C<void
-Parrot_snprintf(Interp *interp, char *targ, size_t len,
- const char *pat, ...)>
+FUNCDOC: Parrot_snprintf
Similar to C<Parrot_sprintf()> but with an option to specify the length
(C<len>) of the returned C string.
-=cut
-
*/
+PARROT_API
void
-Parrot_snprintf(Interp *interp, char *targ, size_t len,
- const char *pat, ...)
+Parrot_snprintf(Interp *interp /*NN*/, char *targ /*NN*/, size_t len,
+ const char *pat /*NN*/, ...)
{
va_list args;
@@ -206,18 +192,17 @@
/*
-=item C<STRING *
-Parrot_psprintf(Interp *interp, STRING *pat, PMC *ary)>
+FUNCDOC: Parrot_psprintf
Calls C<Parrot_sprintf_format()> with the insertion arguments in an
C<Array> PMC.
-=cut
-
*/
+PARROT_API
STRING *
-Parrot_psprintf(Interp *interp, STRING *pat, PMC *ary)
+Parrot_psprintf(Interp *interp /*NN*/, STRING *pat /*NN*/, PMC *ary /*NN*/)
+ /* WARN_UNUSED */
{
SPRINTF_OBJ obj = pmc_core;
obj.data = ary;
@@ -227,8 +212,6 @@
/*
-=back
-
=head1 SEE ALSO
F<src/misc.h>, F<src/spf_vtable.c>, F<src/spf_render.c>.
@@ -239,8 +222,6 @@
completely within this file. When the file grew to be nearly 1,000
lines long, I split it into three. --BD
-=cut
-
*/