Skip to content

Commit

Permalink
Defined Parrot_api_hbdb_run_code()
Browse files Browse the repository at this point in the history
  • Loading branch information
soh-cah-toa committed Jun 11, 2011
1 parent 58a5126 commit 503cce8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
7 changes: 7 additions & 0 deletions frontend/hbdb/main.c
Expand Up @@ -152,10 +152,17 @@ main(int argc, const char *argv[])
}

/* Run bytecode */
if (!Parrot_api_hbdb_run_code(interp, argc, argv)) {
Parrot_api_destroy_interpreter(interp);
fail(interp);
}

/*
if (!Parrot_api_run_bytecode(interp, pbc, NULL)) {
Parrot_api_destroy_interpreter(interp);
fail(interp);
}
*/

Parrot_api_destroy_interpreter(interp);
return (0);
Expand Down
9 changes: 9 additions & 0 deletions include/parrot/api.h
Expand Up @@ -354,11 +354,20 @@ Parrot_Int Parrot_api_hbdb_get_line_number(
PARROT_API
Parrot_Int Parrot_api_hbdb_init(Parrot_PMC interp_pmc);

PARROT_API
Parrot_Int Parrot_api_hbdb_run_code(
Parrot_PMC interp_pmc,
int argc,
ARGIN(const char *argv[]))
__attribute__nonnull__(3);

#define ASSERT_ARGS_Parrot_api_hbdb_get_command __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_api_hbdb_get_line_number \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(context_pmc))
#define ASSERT_ARGS_Parrot_api_hbdb_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_api_hbdb_run_code __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(argv))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/embed/hbdb.c */

Expand Down
7 changes: 7 additions & 0 deletions include/parrot/hbdb.h
Expand Up @@ -147,6 +147,10 @@ INTVAL hbdb_get_line_number(PARROT_INTERP, ARGIN(PMC *context_pmc))
void hbdb_init(PARROT_INTERP)
__attribute__nonnull__(1);

void hbdb_run_code(PARROT_INTERP, int argc, ARGIN(const char *argv[]))
__attribute__nonnull__(1)
__attribute__nonnull__(3);

#define ASSERT_ARGS_hbdb_cmd_break __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(hbdb) \
, PARROT_ASSERT_ARG(command))
Expand All @@ -160,6 +164,9 @@ void hbdb_init(PARROT_INTERP)
, PARROT_ASSERT_ARG(context_pmc))
#define ASSERT_ARGS_hbdb_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_hbdb_run_code __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(argv))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/hbdb.c */

Expand Down
23 changes: 23 additions & 0 deletions src/embed/hbdb.c
Expand Up @@ -100,6 +100,29 @@ Parrot_api_hbdb_init(Parrot_PMC interp_pmc)

/*
=item C<Parrot_Int Parrot_api_hbdb_run_code(Parrot_PMC interp_pmc, int argc,
const char *argv[])>
Wrapper function for C<hbdb_run_code()>. Begins the main runloop by executing the code in the
file specified on the command-line.
=cut
*/

PARROT_API
Parrot_Int
Parrot_api_hbdb_run_code(Parrot_PMC interp_pmc, int argc, ARGIN(const char *argv[]))
{
EMBED_API_CALLIN(interp_pmc, interp)

hbdb_run_code(interp, argc, argv);

EMBED_API_CALLOUT(interp_pmc, interp)
}

/*
=back
=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion src/hbdb.c
Expand Up @@ -271,7 +271,7 @@ Begins the main runloop by executing the code in the file specified on the comma
*/

void
hbdb_run_code(PARROT_INTERP, int argc, const char *argv[])
hbdb_run_code(PARROT_INTERP, int argc, ARGIN(const char *argv[]))
{
ASSERT_ARGS(hbdb_run_code)

Expand Down

0 comments on commit 503cce8

Please sign in to comment.