Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into native_pbc
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Aug 29, 2012
2 parents 02feb07 + 40d3f64 commit 60f0615
Show file tree
Hide file tree
Showing 50 changed files with 6,912 additions and 3,206 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,6 +1,10 @@
2012-09-18 release 4.8.0
- Core
+ Prevent interpreter from dying twice
+ Complete rewrite of the IO system, including new unified IO PMC
semantics.
+ The Integer and Float PMCs now have a get_pointer vtable which is
needed when using NCI to bind to Fortran libraries such as LAPACK
- Community
+ Updated the vms port on a YAPC::EU hackathon with vaxman and mvorl.

Expand Down
7 changes: 5 additions & 2 deletions MANIFEST
Expand Up @@ -1246,10 +1246,13 @@ src/interp/api.c []
src/interp/inter_cb.c []
src/io/api.c []
src/io/buffer.c []
src/io/core.c []
src/io/filehandle.c []
src/io/io_private.h []
src/io/socket_api.c []
src/io/pipe.c []
src/io/socket.c []
src/io/stringhandle.c []
src/io/userhandle.c []
src/io/utilities.c []
src/key.c []
src/libnci_test.def []
src/library.c []
Expand Down
4 changes: 3 additions & 1 deletion compilers/imcc/debug.c
Expand Up @@ -253,6 +253,8 @@ dump_instructions(ARGMOD(imc_info_t * imcc), ARGIN(const IMC_Unit *unit))
ASSERT_ARGS(dump_instructions)
const Instruction *ins;
int pc;
const PIOHANDLE pstderr =
Parrot_io_internal_std_os_handle(imcc->interp, PIO_STDERR_FILENO);

Parrot_io_eprintf(imcc->interp,
"\nDumping the instructions status:"
Expand All @@ -275,7 +277,7 @@ dump_instructions(ARGMOD(imc_info_t * imcc), ARGIN(const IMC_Unit *unit))
}

Parrot_io_eprintf(imcc->interp, "%s\n", ins->opname);
ins_print(imcc, PIO_STDHANDLE(imcc->interp, PIO_STDERR_FILENO), ins);
ins_print(imcc, pstderr, ins);
pc += ins->opsize;
}

Expand Down
14 changes: 7 additions & 7 deletions compilers/imcc/imcc.l
Expand Up @@ -86,7 +86,7 @@ static int handle_identifier(ARGMOD(imc_info_t *imcc), YYSTYPE *valp, ARGIN(cons
} while (0)

#define YY_INPUT(buf, result, max_size) \
(result) = PIO_READ((Interp *)yyextra->interp, (PIOHANDLE)yyin, (buf), (max_size))
(result) = Parrot_io_internal_read((Interp *)yyextra->interp, (PIOHANDLE)yyin, (buf), (max_size))

%}

Expand Down Expand Up @@ -1193,7 +1193,7 @@ include_file(ARGMOD(imc_info_t *imcc), ARGIN(STRING *file_name), void *yyscanner
PIOHANDLE file;

if (STRING_IS_NULL(s)
|| (file = PIO_OPEN(imcc->interp, s, PIO_F_READ)) == PIO_INVALID_HANDLE) {
|| (file = Parrot_io_internal_open(imcc->interp, s, PIO_F_READ)) == PIO_INVALID_HANDLE) {
IMCC_fataly(imcc, EXCEPTION_EXTERNAL_ERROR,
"No such file or directory '%Ss'", file_name);
}
Expand Down Expand Up @@ -1258,7 +1258,7 @@ pop_parser_state(ARGMOD(imc_info_t *imcc), void *yyscanner)
if (tmp) {
int l;
if (tmp->s.handle != PIO_INVALID_HANDLE)
PIO_CLOSE(imcc->interp, tmp->s.handle);
Parrot_io_internal_close(imcc->interp, tmp->s.handle);

imcc->frames =
(macro_frame_t *)imcc->frames->s.next;
Expand Down Expand Up @@ -1288,23 +1288,23 @@ determine_input_file_type(ARGMOD(imc_info_t * imcc), ARGIN(STRING *sourcefile))

if (STRING_length(sourcefile) == 1
&& STRING_ord(imcc->interp, sourcefile, 0) == '-') {
handle = PIO_STDHANDLE(imcc->interp, PIO_STDIN_FILENO);
handle = Parrot_io_internal_std_os_handle(imcc->interp, PIO_STDIN_FILENO);

if ((FILE *)handle == NULL) {
/*
* We have to dup the handle because the stdin fd is 0 on UNIX and
* lex would think it's a NULL FILE pointer and reset it to the
* stdin FILE pointer.
*/
handle = Parrot_io_dup(imcc->interp, handle);
handle = Parrot_io_internal_dup(imcc->interp, handle);
}
}
else {
if (Parrot_file_stat_intval(imcc->interp, sourcefile, STAT_ISDIR))
Parrot_ex_throw_from_c_args(imcc->interp, NULL, EXCEPTION_EXTERNAL_ERROR,
"imcc_compile_file: '%Ss' is a directory\n", sourcefile);

handle = PIO_OPEN(imcc->interp, sourcefile, PIO_F_READ);
handle = Parrot_io_internal_open(imcc->interp, sourcefile, PIO_F_READ);
if (handle == PIO_INVALID_HANDLE)
IMCC_fatal_standalone(imcc, EXCEPTION_EXTERNAL_ERROR,
"Error reading source file %Ss.\n",
Expand Down Expand Up @@ -1345,7 +1345,7 @@ imcc_cleanup_input(ARGMOD(imc_info_t * imcc), PIOHANDLE file,
ARGIN(char *source_c), int is_file)
{
if (is_file)
PIO_CLOSE(imcc->interp, file);
Parrot_io_internal_close(imcc->interp, file);

Parrot_str_free_cstring(source_c);
}
Expand Down
14 changes: 7 additions & 7 deletions compilers/imcc/imclexer.c
Expand Up @@ -1783,7 +1783,7 @@ static int handle_identifier(ARGMOD(imc_info_t *imcc), YYSTYPE *valp, ARGIN(cons
} while (0)

#define YY_INPUT(buf, result, max_size) \
(result) = PIO_READ((Interp *)yyextra->interp, (PIOHANDLE)yyin, (buf), (max_size))
(result) = Parrot_io_internal_read((Interp *)yyextra->interp, (PIOHANDLE)yyin, (buf), (max_size))



Expand Down Expand Up @@ -4937,7 +4937,7 @@ include_file(ARGMOD(imc_info_t *imcc), ARGIN(STRING *file_name), void *yyscanner
PIOHANDLE file;

if (STRING_IS_NULL(s)
|| (file = PIO_OPEN(imcc->interp, s, PIO_F_READ)) == PIO_INVALID_HANDLE) {
|| (file = Parrot_io_internal_open(imcc->interp, s, PIO_F_READ)) == PIO_INVALID_HANDLE) {
IMCC_fataly(imcc, EXCEPTION_EXTERNAL_ERROR,
"No such file or directory '%Ss'", file_name);
}
Expand Down Expand Up @@ -5001,7 +5001,7 @@ pop_parser_state(ARGMOD(imc_info_t *imcc), void *yyscanner)
if (tmp) {
int l;
if (tmp->s.handle != PIO_INVALID_HANDLE)
PIO_CLOSE(imcc->interp, tmp->s.handle);
Parrot_io_internal_close(imcc->interp, tmp->s.handle);

imcc->frames =
(macro_frame_t *)imcc->frames->s.next;
Expand Down Expand Up @@ -5031,23 +5031,23 @@ determine_input_file_type(ARGMOD(imc_info_t * imcc), ARGIN(STRING *sourcefile))

if (STRING_length(sourcefile) == 1
&& STRING_ord(imcc->interp, sourcefile, 0) == '-') {
handle = PIO_STDHANDLE(imcc->interp, PIO_STDIN_FILENO);
handle = Parrot_io_internal_std_os_handle(imcc->interp, PIO_STDIN_FILENO);

if ((FILE *)handle == NULL) {
/*
* We have to dup the handle because the stdin fd is 0 on UNIX and
* lex would think it's a NULL FILE pointer and reset it to the
* stdin FILE pointer.
*/
handle = Parrot_io_dup(imcc->interp, handle);
handle = Parrot_io_internal_dup(imcc->interp, handle);
}
}
else {
if (Parrot_file_stat_intval(imcc->interp, sourcefile, STAT_ISDIR))
Parrot_ex_throw_from_c_args(imcc->interp, NULL, EXCEPTION_EXTERNAL_ERROR,
"imcc_compile_file: '%Ss' is a directory\n", sourcefile);

handle = PIO_OPEN(imcc->interp, sourcefile, PIO_F_READ);
handle = Parrot_io_internal_open(imcc->interp, sourcefile, PIO_F_READ);
if (handle == PIO_INVALID_HANDLE)
IMCC_fatal_standalone(imcc, EXCEPTION_EXTERNAL_ERROR,
"Error reading source file %Ss.\n",
Expand Down Expand Up @@ -5086,7 +5086,7 @@ imcc_cleanup_input(ARGMOD(imc_info_t * imcc), PIOHANDLE file,
ARGIN(char *source_c), int is_file)
{
if (is_file)
PIO_CLOSE(imcc->interp, file);
Parrot_io_internal_close(imcc->interp, file);

Parrot_str_free_cstring(source_c);
}
Expand Down
32 changes: 27 additions & 5 deletions config/gen/makefiles/root.in
Expand Up @@ -435,11 +435,14 @@ ENCODING_O_FILES = \
src/string/encoding/ucs4$(O)

IO_O_FILES = \
src/io/core$(O) \
src/io/api$(O) \
src/io/buffer$(O) \
src/io/filehandle$(O) \
src/io/socket_api$(O)
src/io/socket$(O) \
src/io/stringhandle$(O) \
src/io/pipe$(O) \
src/io/userhandle$(O) \
src/io/utilities$(O) \

INTERP_O_FILES = \
src/string/api$(O) \
Expand Down Expand Up @@ -1041,15 +1044,32 @@ src/events$(O) : \
src/alarm$(O) : $(PARROT_H_HEADERS) src/alarm.c \
$(INC_DIR)/alarm.h

src/io/core$(O) : $(PARROT_H_HEADERS) src/io/io_private.h src/io/core.c
src/io/utilities$(O) : $(PARROT_H_HEADERS) src/io/io_private.h src/io/utilities.c

src/io/socket_api$(O) : \
src/io/socket$(O) : \
$(PARROT_H_HEADERS) \
src/io/io_private.h \
src/io/api.str \
$(INC_PMC_DIR)/pmc_socket.h \
$(INC_PMC_DIR)/pmc_sockaddr.h \
src/io/socket_api.c
src/io/socket.c

src/io/stringhandle$(O) : \
$(PARROT_H_HEADERS) \
src/io/io_private.h \
$(INC_PMC_DIR)/pmc_stringhandle.h \
src/io/stringhandle.c

src/io/pipe$(O) : \
$(PARROT_H_HEADERS) \
src/io/io_private.h \
$(INC_PMC_DIR)/pmc_filehandle.h \
src/io/pipe.c

src/io/userhandle$(O) : \
$(PARROT_H_HEADERS) \
src/io/io_private.h \
src/io/userhandle.c

O_FILES = \
$(INTERP_O_FILES) \
Expand Down Expand Up @@ -1640,9 +1660,11 @@ src/io/api$(O) : \
src/io/io_private.h \
src/io/api.c \
src/io/api.str \
$(INC_PMC_DIR)/pmc_handle.h \
$(INC_PMC_DIR)/pmc_filehandle.h \
$(INC_PMC_DIR)/pmc_stringhandle.h \
$(INC_PMC_DIR)/pmc_socket.h \
$(INC_PMC_DIR)/pmc_sockaddr.h \
$(INC_PMC_DIR)/pmc_bytebuffer.h \
$(EXTEND_HEADERS)

Expand Down
4 changes: 2 additions & 2 deletions ext/winxed/compiler.pir
Expand Up @@ -25759,7 +25759,7 @@
goto __label_7
__label_6: # else
$P1.'close'()
$P5 = $P1.'read'(0)
$P5 = $P1.'readall'()
null $S1
if_null $P5, __label_8
set $S1, $P5
Expand Down Expand Up @@ -25811,7 +25811,7 @@
goto __label_4
__label_3: # else
$P1.'close'()
.tailcall $P1.'read'(0)
.tailcall $P1.'readall'()
__label_4: # endif

.end # __private_geninclude
Expand Down

0 comments on commit 60f0615

Please sign in to comment.