Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Attempt to compile perl6 source
  • Loading branch information
leto committed Jun 10, 2010
1 parent 63ac82d commit dc6ad7d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plparrot.c
Expand Up @@ -179,6 +179,8 @@ PG_FUNCTION_INFO_V1(plperl6u_call_handler);
static Datum
plperl6_func_handler(PG_FUNCTION_ARGS)
{
Parrot_PMC func_pmc, func_args, result, tmp_pmc;
Parrot_String err;
Datum retval, procsrc_datum;
Form_pg_proc procstruct;
HeapTuple proctup;
Expand Down Expand Up @@ -219,6 +221,20 @@ plperl6_func_handler(PG_FUNCTION_ARGS)

elog(NOTICE,"perl6_src = %s", perl6_src );

Parrot_compreg(interp,create_string_const("perl6"));
elog(NOTICE,"registered compiler");
func_pmc = Parrot_compile_string(interp, create_string_const("perl6"), perl6_src, &err);
elog(NOTICE,"compiled a perl6 string");
if (!Parrot_str_is_null(interp, err)) {
tmp = Parrot_str_to_cstring(interp, err);
errmsg = pstrdup(tmp);
Parrot_str_free_cstring(tmp);
elog(ERROR, "Error compiling perl6 function: %s", errmsg);
}

free(perl6_src);


return retval;
}
static Datum
Expand Down Expand Up @@ -398,6 +414,8 @@ plperl6_call_handler(PG_FUNCTION_ARGS)
{
Datum retval = 0;
TriggerData *tdata;

interp = p6_interp;
PG_TRY();
{
if (CALLED_AS_TRIGGER(fcinfo)) {
Expand All @@ -412,6 +430,7 @@ plperl6_call_handler(PG_FUNCTION_ARGS)
PG_RE_THROW();
}
PG_END_TRY();
interp = trusted_interp;
return retval;
}

Expand Down

0 comments on commit dc6ad7d

Please sign in to comment.