Permalink
Browse files

fix some file references and run headerizer to see my work so far

  • Loading branch information...
Whiteknight committed Nov 11, 2010
1 parent b90d959 commit 3f8ed92a08fb33f05c9623d57cec2b0f75fc9744
Showing with 186 additions and 21 deletions.
  1. +3 −3 compilers/imcc/main.c
  2. +1 −1 config/gen/makefiles/root.in
  3. +159 −2 include/parrot/api.h
  4. +6 −0 include/parrot/gc_api.h
  5. +8 −4 src/embed/api.c
  6. +9 −11 src/main.c
View
@@ -44,7 +44,7 @@ extern int yydebug;
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void compile_to_bytecode(PARROT_INTERP,
+static PackFile * compile_to_bytecode(PARROT_INTERP,
ARGIN(const char * const sourcefile),
ARGIN_NULLOK(const char * const output_file),
ARGIN(yyscan_t yyscanner))
@@ -523,7 +523,7 @@ determine_output_file_type(PARROT_INTERP, ARGIN(const char *output_file))
/*
-=item C<static void compile_to_bytecode(PARROT_INTERP, const char * const
+=item C<static PackFile * compile_to_bytecode(PARROT_INTERP, const char * const
sourcefile, const char * const output_file, yyscan_t yyscanner)>
Compile source code into bytecode (or die trying).
@@ -588,7 +588,7 @@ compile_to_bytecode(PARROT_INTERP,
/*
=item C<int imcc_run(PARROT_INTERP, const char *sourcefile, int argc, const char
-**argv)>
+**argv, PMC **pbcpmc)>
Entry point of IMCC, as invoked by Parrot's main function.
Compile source code (if required), write bytecode file (if required)
@@ -453,7 +453,7 @@ INTERP_O_FILES = \
src/debug$(O) \
src/dynext$(O) \
src/embed$(O) \
- src/embed_api$(O) \
+ src/embed/api$(O) \
src/string/encoding$(O) \
src/exceptions$(O) \
src/exit$(O) \
View
@@ -19,8 +19,165 @@ typedef struct _Parrot_Init_Args {
INTVAL hash_seed;
} Parrot_Init_Args;
-/* HEADERIZER BEGIN src/embed_api.c */
+/* HEADERIZER BEGIN: src/embed/api.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-/* HEADERIZER END src/embed_api.c */
+PARROT_API
+INTVAL Parrot_api_build_argv_array(
+ ARGMOD(PMC *interp_pmc),
+ INTVAL argc,
+ ARGIN(char **argv),
+ ARGOUT(PMC **args))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*interp_pmc)
+ FUNC_MODIFIES(*args);
+
+PARROT_API
+INTVAL Parrot_api_destroy_interpreter(ARGIN(PMC *interp_pmc))
+ __attribute__nonnull__(1);
+
+PARROT_API
+INTVAL Parrot_api_exit_interpreter(ARGIN(PMC *interp_pmc))
+ __attribute__nonnull__(1);
+
+PARROT_API
+INTVAL Parrot_api_load_bytecode_file(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(const char *filename),
+ ARGOUT(PMC **pbc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*interp_pmc)
+ FUNC_MODIFIES(*pbc);
+
+PARROT_API
+PARROT_CANNOT_RETURN_NULL
+PARROT_MALLOC
+INTVAL Parrot_api_make_interpreter(
+ ARGIN_NULLOK(PMC *parent),
+ INTVAL flags,
+ ARGIN_NULLOK(Parrot_Init_Args *args),
+ ARGOUT(PMC **interp))
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*interp);
+
+PARROT_API
+INTVAL Parrot_api_run_bytecode(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(PMC *pbc),
+ ARGIN(PMC *mainargs))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*interp_pmc);
+
+PARROT_API
+INTVAL Parrot_api_set_executable_name(
+ ARGIN(PMC *interp_pmc),
+ ARGIN(Parrot_String) name)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_API
+INTVAL Parrot_api_set_output_file(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(const char * filename))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*interp_pmc);
+
+PARROT_API
+INTVAL Parrot_api_set_runcore(
+ ARGIN(PMC *interp_pmc),
+ Parrot_Run_core_t core,
+ Parrot_Uint trace)
+ __attribute__nonnull__(1);
+
+PARROT_API
+INTVAL Parrot_api_set_stdhandles(
+ ARGIN(PMC *interp_pmc),
+ INTVAL stdin,
+ INTVAL stdout,
+ INTVAL stderr)
+ __attribute__nonnull__(1);
+
+PARROT_API
+INTVAL Parrot_api_set_warnings(ARGMOD(PMC *interp_pmc), INTVAL flags)
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*interp_pmc);
+
+PARROT_API
+INTVAL Parrt_api_add_dynext_search_path(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(const char *path))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*interp_pmc);
+
+PARROT_API
+INTVAL Parrt_api_add_include_search_path(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(const char *path))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*interp_pmc);
+
+PARROT_API
+INTVAL Parrt_api_add_library_search_path(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(const char *path))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*interp_pmc);
+
+#define ASSERT_ARGS_Parrot_api_build_argv_array __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(argv) \
+ , PARROT_ASSERT_ARG(args))
+#define ASSERT_ARGS_Parrot_api_destroy_interpreter \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc))
+#define ASSERT_ARGS_Parrot_api_exit_interpreter __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc))
+#define ASSERT_ARGS_Parrot_api_load_bytecode_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(filename) \
+ , PARROT_ASSERT_ARG(pbc))
+#define ASSERT_ARGS_Parrot_api_make_interpreter __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_api_run_bytecode __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(pbc) \
+ , PARROT_ASSERT_ARG(mainargs))
+#define ASSERT_ARGS_Parrot_api_set_executable_name \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(Parrot_String))
+#define ASSERT_ARGS_Parrot_api_set_output_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(filename))
+#define ASSERT_ARGS_Parrot_api_set_runcore __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc))
+#define ASSERT_ARGS_Parrot_api_set_stdhandles __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc))
+#define ASSERT_ARGS_Parrot_api_set_warnings __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc))
+#define ASSERT_ARGS_Parrt_api_add_dynext_search_path \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(path))
+#define ASSERT_ARGS_Parrt_api_add_include_search_path \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(path))
+#define ASSERT_ARGS_Parrt_api_add_library_search_path \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(path))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/embed/api.c */
#endif /* PARROT_API_H_GUARD */
View
@@ -134,6 +134,10 @@ PARROT_CANNOT_RETURN_NULL
void Parrot_gc_free_memory_chunk(PARROT_INTERP, ARGIN_NULLOK(void *data))
__attribute__nonnull__(1);
+PARROT_EXPORT
+INTVAL Parrot_gc_get_system_id(PARROT_INTERP, const char *name)
+ __attribute__nonnull__(1);
+
PARROT_EXPORT
void Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
__attribute__nonnull__(1)
@@ -344,6 +348,8 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP)
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_get_system_id __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_mark_PMC_alive_fun __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_mark_PObj_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
View
@@ -1,6 +1,8 @@
#include "parrot/parrot.h"
#include "parrot/api.h"
+/* HEADERIZER HFILE: include/parrot/api.h */
+
#define GET_RAW_INTERP(p) ((Parrot_ParrotInterpreter_attributes)(p)->data)->interp;
#define EMBED_API_CALLIN(p, i) \
jmp_buf _env; \
@@ -92,8 +94,8 @@ Parrot_api_set_executable_name(ARGIN(PMC *interp_pmc), ARGIN(Parrot_String) name
EMBED_API_CALLOUT(interp_pmc, interp);
}
-// TODO: Consider merging _destroy_interpreter and _exit_interpreter.
-// it doesn't make sense to call one without calling the other
+/* TODO: Consider merging _destroy_interpreter and _exit_interpreter.
+ it doesn't make sense to call one without calling the other */
PARROT_API
INTVAL
@@ -117,7 +119,8 @@ Parrot_api_exit_interpreter(ARGIN(PMC *interp_pmc))
/*
-=item C<int Parrot_api_load_bytecode_file(PARROT_INTERP, const char *filename)>
+=item C<PARROT_API INTVAL Parrot_api_load_bytecode_file(PMC *interp_pmc, const
+char *filename, PMC **pbc)>
Load a bytecode file and return a bytecode PMC.
@@ -230,7 +233,8 @@ Parrt_api_add_dynext_search_path(ARGMOD(PMC *interp_pmc), ARGIN(const char *path
/*
-=item C<int Parrot_api_set_stdhandles(PARROT_INTERP, INTVAL stdin, INTVAL stdout, INTVAL stderr)>
+=item C<PARROT_API INTVAL Parrot_api_set_stdhandles(PMC *interp_pmc, INTVAL
+stdin, INTVAL stdout, INTVAL stderr)>
Set the std file descriptors for the embedded interpreter. Any file descriptor
passed as argument and set to C<PIO_INVALID_HANDLE> is ignored.
View
@@ -40,14 +40,14 @@ static int is_all_hex_digits(ARGIN(const char *s))
static void Parrot_version(void);
PARROT_CAN_RETURN_NULL
-static const char * parseflags(PARROT_INTERP,
+static const char * parseflags(
+ PMC *interp,
int argc,
ARGIN(const char *argv[]),
ARGOUT(int *pgm_argc),
ARGOUT(const char ***pgm_argv),
ARGMOD(Parrot_Run_core_t *core),
ARGMOD(Parrot_trace_flags *trace))
- __attribute__nonnull__(1)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
__attribute__nonnull__(5)
@@ -58,10 +58,10 @@ static const char * parseflags(PARROT_INTERP,
FUNC_MODIFIES(*core)
FUNC_MODIFIES(*trace);
-static void parseflags_minimal(PARROT_INTERP,
+static void parseflags_minimal(
+ Parrot_Init_Args *initargs,
int argc,
ARGIN(const char *argv[]))
- __attribute__nonnull__(1)
__attribute__nonnull__(3);
static void usage(ARGMOD(FILE *fp))
@@ -76,15 +76,13 @@ static void usage(ARGMOD(FILE *fp))
PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_Parrot_version __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_parseflags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(argv) \
+ PARROT_ASSERT_ARG(argv) \
, PARROT_ASSERT_ARG(pgm_argc) \
, PARROT_ASSERT_ARG(pgm_argv) \
, PARROT_ASSERT_ARG(core) \
, PARROT_ASSERT_ARG(trace))
#define ASSERT_ARGS_parseflags_minimal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(argv))
+ PARROT_ASSERT_ARG(argv))
#define ASSERT_ARGS_usage __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(fp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
@@ -354,8 +352,8 @@ included in the Parrot source tree.\n\n");
/*
-=item C<static void parseflags_minimal(PARROT_INTERP, int argc, const char
-*argv[])>
+=item C<static void parseflags_minimal(Parrot_Init_Args *initargs, int argc,
+const char *argv[])>
Parse minimal subset of args required for initializing interpreter.
@@ -447,7 +445,7 @@ parseflags_minimal(Parrot_Init_Args *initargs, int argc, ARGIN(const char *argv[
/*
-=item C<static const char * parseflags(PARROT_INTERP, int argc, const char
+=item C<static const char * parseflags(PMC *interp, int argc, const char
*argv[], int *pgm_argc, const char ***pgm_argv, Parrot_Run_core_t *core,
Parrot_trace_flags *trace)>

0 comments on commit 3f8ed92

Please sign in to comment.