[svn:parrot] r37924 - in trunk: compilers/pirc/src config/gen/makefiles

coke at svn.parrot.org coke at svn.parrot.org
Mon Apr 6 17:11:18 UTC 2009


Author: coke
Date: Mon Apr  6 17:11:17 2009
New Revision: 37924
URL: https://trac.parrot.org/parrot/changeset/37924

Log:
[cage] headerize compilers/pirc/src/pircapi
Infinoid++

Modified:
   trunk/compilers/pirc/src/pircapi.c
   trunk/compilers/pirc/src/pircapi.h
   trunk/config/gen/makefiles/root.in

Modified: trunk/compilers/pirc/src/pircapi.c
==============================================================================
--- trunk/compilers/pirc/src/pircapi.c	Mon Apr  6 15:02:01 2009	(r37923)
+++ trunk/compilers/pirc/src/pircapi.c	Mon Apr  6 17:11:17 2009	(r37924)
@@ -12,6 +12,12 @@
 #include "pirlexer.h"
 #include "pircapi.h"
 
+/* HEADERIZER HFILE: compilers/pirc/src/pircapi.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+
+
 /*
 
 =head1 DESCRIPTION
@@ -36,8 +42,7 @@
 
 /*
 
-=item C<FILE *
-open_file(char const * const filename, char const * const mode)>
+=item C<FILE * open_file(char const * const filename, char const * const mode)>
 
 Function to open the file given by C<filename>, in the mode given by C<mode>
 Microsoft visual studio provides a "safer" variant of fopen(); this
@@ -46,8 +51,12 @@
 =cut
 
 */
+
+PARROT_CAN_RETURN_NULL
 FILE *
-open_file(char const * const filename, char const * const mode) {
+open_file(ARGIN(char const * const filename), ARGIN(char const * const mode))
+{
+    ASSERT_ARGS(open_file)
     FILE *fp = NULL;
 
 #ifdef _MSC_VER
@@ -58,9 +67,13 @@
     return fp;
 }
 
-
 /*
 
+=item C<void parse_file(PARROT_INTERP, int flexdebug, FILE *infile, char * const
+filename, int flags, int thr_id, unsigned macro_size, char * const outputfile)>
+
+=cut
+
 This will be the proper declaration after testing for thread-safety:
 
 void parse_file(int flexdebug, FILE *infile, char * const filename, int flags,
@@ -71,9 +84,12 @@
 
 
 void
-parse_file(PARROT_INTERP, int flexdebug, FILE *infile, char * const filename, int flags,
-           int thr_id, unsigned macro_size, char * const outputfile)
+parse_file(PARROT_INTERP, int flexdebug, ARGIN(FILE *infile),
+           ARGIN(char * const filename), int flags,
+           int thr_id, unsigned macro_size,
+           ARGMOD_NULLOK(char * const outputfile))
 {
+    ASSERT_ARGS(parse_file)
     yyscan_t     yyscanner;
     lexer_state *lexer     = NULL;
 
@@ -152,11 +168,18 @@
 
 /*
 
+=item C<void parse_string(PARROT_INTERP, char *pirstring, int flags, int
+pasminput, unsigned macro_size)>
+
 Parse a PIR string.
 
+=cut
+
 */
 void
-parse_string(PARROT_INTERP, char *pirstring, int flags, int pasminput, unsigned macro_size) {
+parse_string(PARROT_INTERP, ARGIN(char *pirstring), int flags, int pasminput,
+    unsigned macro_size)
+{
     yyscan_t            yyscanner;
     lexer_state        *lexer = NULL;
     char                name[64];
@@ -231,15 +254,26 @@
 
 }
 
+/*
 
+=item C<PackFile_ByteCode * pirc_compile_file(PARROT_INTERP, const char
+*filename, STRING **error_message)>
 
-PARROT_CANNOT_RETURN_NULL
+=cut
+
+*/
+
+PARROT_CAN_RETURN_NULL
 PackFile_ByteCode *
-pirc_compile_file(PARROT_INTERP, const char *filename, STRING **error_message) {
+pirc_compile_file(SHIM_INTERP, SHIM(const char *filename),
+    SHIM(STRING **error_message))
+{
+    ASSERT_ARGS(pirc_compile_file)
     return NULL;
 }
 
 
+/* HEADERIZER END: static */
 
 
 /*

Modified: trunk/compilers/pirc/src/pircapi.h
==============================================================================
--- trunk/compilers/pirc/src/pircapi.h	Mon Apr  6 15:02:01 2009	(r37923)
+++ trunk/compilers/pirc/src/pircapi.h	Mon Apr  6 17:11:17 2009	(r37924)
@@ -8,16 +8,55 @@
 
 #include <stdio.h>
 
-FILE * open_file(char const * const filename, char const * const mode);
+/* HEADERIZER BEGIN: compilers/pirc/src/pircapi.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-void parse_string(PARROT_INTERP, char *pirstring, int flags, int pasminput, unsigned macro_size);
-
-void parse_file(PARROT_INTERP, int flexdebug, FILE *infile, char * const filename, int flags,
-                int thr_id, unsigned macro_size, char * const outputfile);
-
-
-
-PackFile_ByteCode *pirc_compile_file(PARROT_INTERP, const char *filename, STRING **error_message);
+PARROT_CAN_RETURN_NULL
+FILE * open_file(
+    ARGIN(char const * const filename),
+    ARGIN(char const * const mode))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+void parse_file(PARROT_INTERP,
+    int flexdebug,
+    ARGIN(FILE *infile),
+    ARGIN(char * const filename),
+    int flags,
+    int thr_id,
+    unsigned macro_size,
+    ARGMOD_NULLOK(char * const outputfile))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(* const outputfile);
+
+void parse_string(PARROT_INTERP,
+    ARGIN(char *pirstring),
+    int flags,
+    int pasminput,
+    unsigned macro_size)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_CAN_RETURN_NULL
+PackFile_ByteCode * pirc_compile_file(SHIM_INTERP,
+    SHIM(const char *filename),
+    SHIM(STRING **error_message));
+
+#define ASSERT_ARGS_open_file __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(filename) \
+    || PARROT_ASSERT_ARG(mode)
+#define ASSERT_ARGS_parse_file __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp) \
+    || PARROT_ASSERT_ARG(infile) \
+    || PARROT_ASSERT_ARG(filename)
+#define ASSERT_ARGS_parse_string __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp) \
+    || PARROT_ASSERT_ARG(pirstring)
+#define ASSERT_ARGS_pirc_compile_file __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+/* HEADERIZER END: compilers/pirc/src/pircapi.c */
 
 #endif /* PARROT_PIR_PIRCAPI_H_GUARD */
 

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Mon Apr  6 15:02:01 2009	(r37923)
+++ trunk/config/gen/makefiles/root.in	Mon Apr  6 17:11:17 2009	(r37924)
@@ -347,7 +347,8 @@
 
 # these are private to the PIRC subsystem
 PIRC_O_FILES := \
-    $(PIRC_DIR)/bcgen$(O)
+    $(PIRC_DIR)/bcgen$(O) \
+    $(PIRC_DIR)/pircapi$(O)
 
 # generated list of header files
 GENERAL_H_FILES   := $(NONGEN_HEADERS) $(GEN_HEADERS) @TEMP_cg_h@


More information about the parrot-commits mailing list