Skip to content

Commit

Permalink
Fixed stdin,stdout and stderr Andy++ pointed out
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariano Wahlmann committed Dec 6, 2010
1 parent f0bd1e1 commit aef7ea1
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/embed/api.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ Parrot_api_add_dynext_search_path(Parrot_PMC interp_pmc,


/* /*
=item C<Parrot_Int Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int =item C<Parrot_Int Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int in, Parrot_Int out,
stdin, Parrot_Int stdout, Parrot_Int stderr)> Parrot_Int err)>
Set the std file descriptors for the embedded interpreter. Any file descriptor Set the std file descriptors for the embedded interpreter. Any file descriptor
passed as argument and set to C<PIO_INVALID_HANDLE> is ignored. passed as argument and set to C<PIO_INVALID_HANDLE> is ignored.
Expand All @@ -395,28 +395,28 @@ passed as argument and set to C<PIO_INVALID_HANDLE> is ignored.


PARROT_API PARROT_API
Parrot_Int Parrot_Int
Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int stdin, Parrot_api_set_stdhandles(Parrot_PMC interp_pmc, Parrot_Int in,
Parrot_Int stdout, Parrot_Int stderr) Parrot_Int out, Parrot_Int err)
{ {
//ASSERT_ARGS(Parrot_api_set_stdhandles) //ASSERT_ARGS(Parrot_api_set_stdhandles)
EMBED_API_CALLIN(interp_pmc, interp) EMBED_API_CALLIN(interp_pmc, interp)
void *dummy; void *dummy;


if(PIO_INVALID_HANDLE != (PIOHANDLE)stdin) { if(PIO_INVALID_HANDLE != (PIOHANDLE)in) {
PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle); PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)stdin); Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)in);
dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDIN_FILENO,pmc); dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDIN_FILENO,pmc);
} }


if(PIO_INVALID_HANDLE != (PIOHANDLE)stdout) { if(PIO_INVALID_HANDLE != (PIOHANDLE)out) {
PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle); PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)stdout); Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)out);
dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDOUT_FILENO,pmc); dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDOUT_FILENO,pmc);
} }


if(PIO_INVALID_HANDLE != (PIOHANDLE)stderr) { if(PIO_INVALID_HANDLE != (PIOHANDLE)err) {
PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle); PMC * const pmc = Parrot_pmc_new(interp, enum_class_FileHandle);
Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)stderr); Parrot_io_set_os_handle(interp, pmc, (PIOHANDLE)err);
dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDERR_FILENO,pmc); dummy = (void *)Parrot_io_stdhandle(interp,PIO_STDERR_FILENO,pmc);
} }


Expand Down Expand Up @@ -474,8 +474,7 @@ interpreter.


PARROT_API PARROT_API
Parrot_Int Parrot_Int
Parrot_api_load_language(ARGIN(Parrot_PMC interp_pmc), Parrot_api_load_language(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String *lang))
ARGIN(Parrot_String *lang))
{ {
ASSERT_ARGS(Parrot_api_load_language) ASSERT_ARGS(Parrot_api_load_language)
EMBED_API_CALLIN(interp_pmc, interp) EMBED_API_CALLIN(interp_pmc, interp)
Expand All @@ -497,7 +496,7 @@ Parrot_api_load_language(ARGIN(Parrot_PMC interp_pmc),
PARROT_API PARROT_API
Parrot_Int Parrot_Int
Parrot_api_get_compiler(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String *type), Parrot_api_get_compiler(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String *type),
ARGOUT(PMC **compiler)) ARGOUT(PMC **compiler))
{ {
ASSERT_ARGS(Parrot_api_get_compiler) ASSERT_ARGS(Parrot_api_get_compiler)
EMBED_API_CALLIN(interp_pmc, interp) EMBED_API_CALLIN(interp_pmc, interp)
Expand All @@ -519,7 +518,7 @@ Parrot_api_get_compiler(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String *type)
PARROT_API PARROT_API
Parrot_Int Parrot_Int
Parrot_api_set_compiler(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String *type), Parrot_api_set_compiler(ARGIN(Parrot_PMC interp_pmc), ARGIN(Parrot_String *type),
ARGIN(PMC *compiler)) ARGIN(PMC *compiler))
{ {
ASSERT_ARGS(Parrot_api_set_compiler) ASSERT_ARGS(Parrot_api_set_compiler)
EMBED_API_CALLIN(interp_pmc, interp) EMBED_API_CALLIN(interp_pmc, interp)
Expand Down

0 comments on commit aef7ea1

Please sign in to comment.