Created
June 16, 2010 18:01
-
-
Save atrodo/441044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "parrot/embed.h" | |
#include "parrot/extend.h" | |
Parrot_String create_string(Parrot_Interp interp, const char *name) | |
{ | |
return Parrot_new_string(interp, name, strlen(name), (const char *) NULL, 0) | |
; | |
} | |
void Parrot_set_config_hash(); | |
/* | |
*/ | |
int main(int argc, const char **argv) | |
{ | |
Parrot_Interp interp; | |
Parrot_set_config_hash(); | |
interp = Parrot_new(NULL); | |
Parrot_Int typenum = Parrot_PMC_typenum(interp, "Hash"); | |
Parrot_PMC r = Parrot_PMC_new(interp, typenum); | |
char *sa = " .sub \"\" :anon\n .param string hll\n .param string code\n $P0 = compreg hll\n unless_null $P0, compile\n load_language \"nqprx\"\n $P0 = compreg \"NQP-rx\"\n say $P0\n compile:\n trace 0\n $P1 = $P0.\"compile\"(code)\n .return ($P1)\n .end\n"; | |
Parrot_String compiler = create_string(interp, "PIR"); | |
Parrot_String errstr; | |
Parrot_PMC code = Parrot_compile_string( interp, compiler, sa, &errstr); | |
Parrot_ext_call(interp, code, "SS->P", create_string(interp, "nqp"), create_string(interp, "say(\"Hello World!\");"), &code); | |
Parrot_printf(interp, "Before Parrot_PMC_set_pmc_keyed_str\n"); | |
Parrot_PMC_set_pmc_keyed_str(interp, r, create_string(interp, "exec"), code) | |
; | |
Parrot_printf(interp, "After Parrot_PMC_set_pmc_keyed_str\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{atrodo@parrot}> gcc -o bug -I/home/atrodo/draak/parrot/embed/include/2.5.0-devel -L/home/atrodo/draak/parrot/embed/lib -lparrot -lnsl -ldl -lm -lcrypt -lutil -lpthread -lrt embed/lib/2.5.0-devel/parrot_config.o bug.c | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
After Parrot_PMC_set_pmc_keyed_str | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
set_pmc_keyed_str() not implemented in class 'Continuation' | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
After Parrot_PMC_set_pmc_keyed_str | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
set_pmc_keyed_str() not implemented in class 'Continuation' | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
set_pmc_keyed_str() not implemented in class 'ResizablePMCArray' | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
set_pmc_keyed_str() not implemented in class 'String' | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
set_pmc_keyed_str() not implemented in class 'String' | |
{atrodo@parrot}> ./bug | |
NQP::Compiler() | |
Before Parrot_PMC_set_pmc_keyed_str | |
After Parrot_PMC_set_pmc_keyed_str | |
{atrodo@parrot}> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment