Permalink
Browse files

some fixes so libparrot builds with g++

  • Loading branch information...
1 parent 6be2b4a commit 73f662d65ef1081c7d3bbe341124db6dea75b8a8 @Whiteknight Whiteknight committed Dec 5, 2010
Showing with 20 additions and 18 deletions.
  1. +1 −1 compilers/imcc/main.c
  2. +1 −1 include/parrot/api.h
  3. +3 −3 src/embed/api.c
  4. +2 −2 src/embed/pmc.c
  5. +3 −3 src/embed/strings.c
  6. +10 −8 src/main.c
View
@@ -641,7 +641,7 @@ 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);
+ Interp * interp = (Interp *)VTABLE_get_pointer(NULL, interp_pmc);
return imcc_run(interp, sourcefile, argc, argv, pbcpmc);
}
View
@@ -84,7 +84,7 @@ PARROT_API
Parrot_Int Parrot_api_build_argv_array(
Parrot_PMC interp_pmc,
Parrot_Int argc,
- ARGIN(char ** argv),
+ ARGIN(const char ** argv),
ARGOUT(Parrot_PMC * args))
__attribute__nonnull__(3)
__attribute__nonnull__(4)
View
@@ -30,7 +30,7 @@ Parrot_api_get_result(Parrot_PMC interp_pmc, ARGOUT(Parrot_Int *is_error),
EMBED_API_CALLIN(interp_pmc, interp)
*exit_code = interp->exit_code;
*exception = interp->final_exception;
- if (PMC_IS_NULL(exception)) {
+ if (PMC_IS_NULL(*exception)) {
*is_error = 0;
*errmsg = STRINGNULL;
}
@@ -284,7 +284,7 @@ Parrot_api_run_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
VTABLE_set_pmc_keyed_int(interp, interp->iglobals, IGLOBALS_ARGV_LIST, mainargs);
- Parrot_ext_call(interp, main_sub, "P->", mainargs);
+ Parrot_pcc_invoke_sub_from_c_args(interp, main_sub, "P->", mainargs);
EMBED_API_CALLOUT(interp_pmc, interp)
}
@@ -306,7 +306,7 @@ Parrot_api_disassemble_bytecode(Parrot_PMC interp_pmc, Parrot_PMC pbc,
PARROT_API
Parrot_Int
Parrot_api_build_argv_array(Parrot_PMC interp_pmc, Parrot_Int argc,
- ARGIN(char ** argv), ARGOUT(Parrot_PMC * args))
+ ARGIN(const char ** argv), ARGOUT(Parrot_PMC * args))
{
//ASSERT_ARGS(Parrot_api_build_argv_array)
EMBED_API_CALLIN(interp_pmc, interp)
View
@@ -22,8 +22,8 @@ Parrot_api_pmc_deserialize_bytes(Parrot_PMC interp_pmc,
ARGOUT(Parrot_PMC * pmc))
{
EMBED_API_CALLIN(interp_pmc, interp)
- STRING * const fpmc_str = Parrot_str_new_init(interp, fpmc, length,
- Parrot_binary_encoding_ptr, PObj_external_FLAG);
+ STRING * const fpmc_str = Parrot_str_new_init(interp, (const char *)fpmc,
+ length, Parrot_binary_encoding_ptr, PObj_external_FLAG);
PMC * const config = Parrot_thaw(interp, fpmc_str);
Parrot_set_config_hash_pmc(interp, config);
EMBED_API_CALLOUT(interp_pmc, interp);
View
@@ -22,8 +22,8 @@ Parrot_Int
Parrot_api_string_free_exported_ascii(Parrot_PMC interp_pmc, ARGIN(char * const str))
{
EMBED_API_CALLIN(interp_pmc, interp);
- if(!STRING_IS_NULL(str))
- Parrot_str_free_cstring(str);
+ if(str != NULL)
+ Parrot_str_free_cstring(str);
EMBED_API_CALLOUT(interp_pmc, interp);
}
@@ -42,7 +42,7 @@ Parrot_Int
Parrot_api_string_import_binary(Parrot_PMC interp_pmc, ARGIN(const unsigned char *bytes), Parrot_Int length, ARGOUT(Parrot_String *out))
{
EMBED_API_CALLIN(interp_pmc, interp);
- *out = Parrot_str_new(interp, bytes, length);
+ *out = Parrot_str_new(interp, (const char *)bytes, length);
EMBED_API_CALLOUT(interp_pmc, interp);
}
View
@@ -24,6 +24,8 @@ Start Parrot
#include "parrot/longopt.h"
#include "parrot/api.h"
+extern int Parrot_set_config_hash(Parrot_PMC interp_pmc);
+
/* HEADERIZER HFILE: none */
/* HEADERIZER BEGIN: static */
@@ -213,7 +215,7 @@ PARROT_PURE_FUNCTION
static int
is_all_digits(ARGIN(const char *s))
{
- ASSERT_ARGS(is_all_digits);
+ //ASSERT_ARGS(is_all_digits);
for (; *s; ++s)
if (!isdigit((unsigned char)*s))
return 0;
@@ -236,7 +238,7 @@ PARROT_PURE_FUNCTION
static int
is_all_hex_digits(ARGIN(const char *s))
{
- ASSERT_ARGS(is_all_hex_digits);
+ //ASSERT_ARGS(is_all_hex_digits);
for (; *s; ++s)
if (!isxdigit(*s))
return 0;
@@ -256,7 +258,7 @@ Outputs usage error message.
static void
usage(ARGMOD(FILE *fp))
{
- ASSERT_ARGS(usage)
+ //ASSERT_ARGS(usage)
fprintf(fp,
"parrot -[acEGhprtvVwy.] [-d [FLAGS]] [-D [FLAGS]]"
"[-O [level]] [-R runcore] [-o FILE] <file>\n");
@@ -275,7 +277,7 @@ Print out list of debugging flag values.
static void
help_debug(void)
{
- ASSERT_ARGS(help_debug)
+ //ASSERT_ARGS(help_debug)
/* split printf for C89 compliance on string length */
printf(
"--imcc-debug -d [Flags] ...\n"
@@ -320,7 +322,7 @@ Print out "help" list of options.
static void
help(void)
{
- ASSERT_ARGS(help)
+ //ASSERT_ARGS(help)
/* split printf for C89 compliance on string length */
printf(
"parrot [Options] <file>\n"
@@ -427,7 +429,7 @@ Print out parrot version number.
static void
Parrot_version(void)
{
- ASSERT_ARGS(Parrot_version)
+ //ASSERT_ARGS(Parrot_version)
printf("This is Parrot version " PARROT_VERSION);
printf(" built for " PARROT_ARCHNAME ".\n");
printf("Copyright (C) 2001-2010, Parrot Foundation.\n\
@@ -454,7 +456,7 @@ Parse minimal subset of args required for initializing interpreter.
static void
parseflags_minimal(ARGMOD(Parrot_Init_Args * initargs), int argc, ARGIN(const char *argv[]))
{
- ASSERT_ARGS(parseflags_minimal)
+ //ASSERT_ARGS(parseflags_minimal)
int pos = 0;
@@ -553,7 +555,7 @@ parseflags(Parrot_PMC interp,
ARGOUT(int *pgm_argc), ARGOUT(const char ***pgm_argv),
ARGMOD(const char **core), ARGMOD(Parrot_Int *trace))
{
- ASSERT_ARGS(parseflags)
+ //ASSERT_ARGS(parseflags)
struct longopt_opt_info opt = LONGOPT_OPT_INFO_INIT;
int status;
int result = 1;

0 comments on commit 73f662d

Please sign in to comment.