Permalink
Browse files

many more fixes. We build main.c now but fail in some of the alternat…

…e front-ends, like pbc_disassemble, that also expect longopt
  • Loading branch information...
1 parent c1ab56e commit f41cf98f7b84a1396815de385063c978ff5fcb10 @Whiteknight Whiteknight committed Nov 18, 2010
Showing with 308 additions and 192 deletions.
  1. +8 −0 compilers/imcc/main.c
  2. +3 −5 config/gen/makefiles/root.in
  3. +106 −44 include/parrot/api.h
  4. +3 −6 include/parrot/longopt.h
  5. +0 −1 include/parrot/parrot.h
  6. +73 −36 src/embed/api.c
  7. +0 −9 src/embed/embed_private.h
  8. +15 −4 src/embed/strings.c
  9. +22 −28 src/longopt.c
  10. +78 −59 src/main.c
@@ -585,6 +585,14 @@ compile_to_bytecode(PARROT_INTERP,
return pf;
}
+int
+imcc_run_api(ARGMOD(PMC * interp_pmc), ARGIN(const char *sourcefile), int argc,
+ ARGIN(const char **argv), ARGOUT(PMC **pbcpmc))
+{
+ Interp * interp = VTABLE_get_pointer(NULL, interp_pmc);
+ return imcc_run(interp, sourcefile, argc, argv, pbcpmc);
+}
+
/*
=item C<int imcc_run(PARROT_INTERP, const char *sourcefile, int argc, const char
@@ -390,7 +390,6 @@ PARROT_H_HEADERS = \
$(INC_DIR)/nci.h \
$(INC_DIR)/thread.h \
$(INC_DIR)/scheduler.h \
- $(INC_DIR)/longopt.h \
$(INC_DIR)/oo.h \
$(INC_DIR)/vtables.h \
$(INC_DIR)/multidispatch.h \
@@ -484,7 +483,6 @@ INTERP_O_FILES = \
src/key$(O) \
src/library$(O) \
src/list$(O) \
- src/longopt$(O) \
src/misc$(O) \
src/multidispatch$(O) \
src/namespace$(O) \
@@ -855,11 +853,11 @@ runtime/parrot/include/config.fpmc : myconfig config_lib.pir \
runtime/parrot/include/datatypes.pasm $(MINIPARROT)
$(MINIPARROT) -Iruntime/parrot/include config_lib.pir > $@
-$(PARROT) : src/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
- src/parrot_config$(O) \
+$(PARROT) : src/main$(O) include/parrot/api.h include/parrot/longopt.h $(LIBPARROT) \
+ src/parrot_config$(O) src/longopt$(O) \
$(MINIPARROT)
$(LINK) @ld_out@$@ \
- src/main$(O) src/parrot_config$(O) \
+ src/main$(O) src/parrot_config$(O) src/longopt$(O) \
@rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC)
#IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1
View
@@ -12,8 +12,6 @@
#include "parrot/compiler.h"
#include "parrot/config.h"
#include "parrot/core_types.h"
-#include "parrot/runcore_api.h"
-#include "parrot/gc_api.h"
#define PARROT_API PARROT_EXPORT
@@ -56,6 +54,30 @@ typedef struct _Parrot_Init_Args {
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_API
+Parrot_Int Parrot_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
+Parrot_Int Parrot_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
+Parrot_Int Parrot_api_add_library_search_path(
+ ARGMOD(PMC *interp_pmc),
+ ARGIN(const char *path))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*interp_pmc);
+
+PARROT_API
Parrot_Int Parrot_api_build_argv_array(
ARGMOD(PMC *interp_pmc),
Parrot_Int argc,
@@ -80,11 +102,30 @@ Parrot_Int Parrot_api_destroy_interpreter(ARGIN(PMC *interp_pmc))
__attribute__nonnull__(1);
PARROT_API
-Parrot_Int Parrot_api_flag(ARGMOD(PMC *interp_pmc), Parrot_Int flags, Parrot_Int set)
+Parrot_Int Parrot_api_flag(
+ ARGMOD(PMC *interp_pmc),
+ Parrot_Int flags,
+ Parrot_Int set)
__attribute__nonnull__(1)
FUNC_MODIFIES(*interp_pmc);
PARROT_API
+Parrot_Int Parrot_api_get_last_error(
+ ARGMOD(PMC * interp_pmc),
+ ARGOUT(Parrot_String ** errmsg))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(* interp_pmc)
+ FUNC_MODIFIES(* errmsg);
+
+PARROT_API
+Parrot_Int Parrot_api_get_runtime_path(
+ Parrot_PMC interp_pmc,
+ ARGOUT(Parrot_String *runtime))
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*runtime);
+
+PARROT_API
Parrot_Int Parrot_api_load_bytecode_file(
ARGMOD(PMC *interp_pmc),
ARGIN(const char *filename),
@@ -96,8 +137,6 @@ Parrot_Int Parrot_api_load_bytecode_file(
FUNC_MODIFIES(*pbc);
PARROT_API
-PARROT_CANNOT_RETURN_NULL
-PARROT_MALLOC
Parrot_Int Parrot_api_make_interpreter(
ARGIN_NULLOK(PMC *parent),
Parrot_Int flags,
@@ -127,15 +166,14 @@ Parrot_Int Parrot_api_set_executable_name(
PARROT_API
Parrot_Int Parrot_api_set_output_file(
ARGMOD(PMC *interp_pmc),
- ARGIN(const char * filename))
+ ARGIN_NULLOK(const char * filename))
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
FUNC_MODIFIES(*interp_pmc);
PARROT_API
Parrot_Int Parrot_api_set_runcore(
ARGIN(PMC *interp_pmc),
- Parrot_Run_core_t core,
+ const char * corename,
Parrot_UInt trace)
__attribute__nonnull__(1);
@@ -148,34 +186,24 @@ Parrot_Int Parrot_api_set_stdhandles(
__attribute__nonnull__(1);
PARROT_API
-Parrot_Int Parrot_api_set_warnings(ARGMOD(PMC *interp_pmc), Parrot_Int flags)
- __attribute__nonnull__(1)
- FUNC_MODIFIES(*interp_pmc);
-
-PARROT_API
-Parrot_Int Parrt_api_add_dynext_search_path(
+Parrot_Int Parrot_api_set_warnings(
ARGMOD(PMC *interp_pmc),
- ARGIN(const char *path))
+ Parrot_Int flags)
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*interp_pmc);
-
-PARROT_API
-Parrot_Int 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
-Parrot_Int 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_add_dynext_search_path \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(path))
+#define ASSERT_ARGS_Parrot_api_add_include_search_path \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(path))
+#define ASSERT_ARGS_Parrot_api_add_library_search_path \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(path))
#define ASSERT_ARGS_Parrot_api_build_argv_array __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp_pmc) \
, PARROT_ASSERT_ARG(argv) \
@@ -187,6 +215,11 @@ Parrot_Int Parrt_api_add_library_search_path(
PARROT_ASSERT_ARG(interp_pmc))
#define ASSERT_ARGS_Parrot_api_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp_pmc))
+#define ASSERT_ARGS_Parrot_api_get_last_error __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp_pmc) \
+ , PARROT_ASSERT_ARG(errmsg))
+#define ASSERT_ARGS_Parrot_api_get_runtime_path __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(runtime))
#define ASSERT_ARGS_Parrot_api_load_bytecode_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp_pmc) \
, PARROT_ASSERT_ARG(filename) \
@@ -202,27 +235,56 @@ Parrot_Int Parrt_api_add_library_search_path(
PARROT_ASSERT_ARG(interp_pmc) \
, PARROT_ASSERT_ARG(name))
#define ASSERT_ARGS_Parrot_api_set_output_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp_pmc) \
- , PARROT_ASSERT_ARG(filename))
+ PARROT_ASSERT_ARG(interp_pmc))
#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 \
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/embed/api.c */
+
+/* HEADERIZER BEGIN: src/embed/strings.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_API
+Parrot_Int Parrot_api_string_export_ascii(
+ Parrot_PMC interp_pmc,
+ ARGIN(Parrot_String string),
+ ARGOUT(char ** strout))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(* strout);
+
+PARROT_API
+Parrot_Int Parrot_api_string_free_exported_ascii(
+ Parrot_PMC interp_pmc,
+ ARGIN(char * const str))
+ __attribute__nonnull__(2);
+
+PARROT_API
+Parrot_Int Parrot_api_string_import_ascii(
+ Parrot_PMC interp_pmc,
+ ARGIN(const char * str),
+ ARGOUT(Parrot_String * out))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(* out);
+
+#define ASSERT_ARGS_Parrot_api_string_export_ascii \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp_pmc) \
- , PARROT_ASSERT_ARG(path))
-#define ASSERT_ARGS_Parrt_api_add_include_search_path \
+ PARROT_ASSERT_ARG(string) \
+ , PARROT_ASSERT_ARG(strout))
+#define ASSERT_ARGS_Parrot_api_string_free_exported_ascii \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp_pmc) \
- , PARROT_ASSERT_ARG(path))
-#define ASSERT_ARGS_Parrt_api_add_library_search_path \
+ PARROT_ASSERT_ARG(str))
+#define ASSERT_ARGS_Parrot_api_string_import_ascii \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp_pmc) \
- , PARROT_ASSERT_ARG(path))
+ PARROT_ASSERT_ARG(str) \
+ , PARROT_ASSERT_ARG(out))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-/* HEADERIZER END: src/embed/api.c */
+/* HEADERIZER END: src/embed/strings.c */
#endif /* PARROT_API_H_GUARD */
+
@@ -7,6 +7,8 @@
#ifndef PARROT_LONGOPT_H_GUARD
#define PARROT_LONGOPT_H_GUARD
+#include "parrot/api.h"
+
/* I use a char* here because this needs to be easily statically
* initialized, and because the interpreter is probably not running
* yet.
@@ -49,9 +51,7 @@ struct longopt_opt_info {
/* HEADERIZER BEGIN: src/longopt.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-int longopt_get(PARROT_INTERP,
+int longopt_get(Parrot_PMC interp_pmc,
int argc,
ARGIN(const char* argv[]),
ARGIN(const struct longopt_opt_decl options[]),
@@ -62,9 +62,6 @@ int longopt_get(PARROT_INTERP,
__attribute__nonnull__(5)
FUNC_MODIFIES(* info_buf);
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_CONST_FUNCTION
const struct longopt_opt_decl * Parrot_cmd_options(void);
#define ASSERT_ARGS_longopt_get __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -276,7 +276,6 @@ typedef struct PackFile_ByteCode PackFile_ByteCode;
#include "parrot/nci.h"
#include "parrot/thread.h"
#include "parrot/scheduler.h"
-#include "parrot/longopt.h"
#include "parrot/oo.h"
#include "parrot/vtables.h"
#include "parrot/multidispatch.h"
Oops, something went wrong. Retry.

0 comments on commit f41cf98

Please sign in to comment.