[svn:parrot] r39805 - in branches/io_cleanups: . compilers/imcc compilers/pct/src/PCT config/auto config/auto/sizes config/gen config/gen/makefiles docs/book/draft docs/dev docs/pdds docs/project docs/user/pir examples/languages/abc examples/languages/squaak examples/opengl examples/tutorial include/parrot lib/Parrot/Pmc2c ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math runtime/parrot/library/OpenGL src src/call src/gc src/interp src/jit/i386 src/pmc src/runcore src/string/charset t/compilers/imcc/syn t/compilers/tge t/dynpmc t/oo t/op t/src t/steps tools/dev tools/util
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat Jun 27 01:33:15 UTC 2009
Author: whiteknight
Date: Sat Jun 27 01:33:11 2009
New Revision: 39805
URL: https://trac.parrot.org/parrot/changeset/39805
Log:
[io_cleanups] merge from trunk r39664:39804. This introduces errors in t/op/io.t that I havent resolved yet
Added:
branches/io_cleanups/examples/opengl/math.pir
- copied unchanged from r39804, trunk/examples/opengl/math.pir
branches/io_cleanups/runtime/parrot/library/OpenGL/ (props changed)
- copied from r39804, trunk/runtime/parrot/library/OpenGL/
Replaced:
branches/io_cleanups/runtime/parrot/library/OpenGL/Math.pir
- copied unchanged from r39804, trunk/runtime/parrot/library/OpenGL/Math.pir
Modified:
branches/io_cleanups/ (props changed)
branches/io_cleanups/MANIFEST
branches/io_cleanups/MANIFEST.SKIP
branches/io_cleanups/PLATFORMS
branches/io_cleanups/compilers/imcc/imc.c
branches/io_cleanups/compilers/imcc/imc.h
branches/io_cleanups/compilers/imcc/imcc.l
branches/io_cleanups/compilers/imcc/imcc.y
branches/io_cleanups/compilers/imcc/imclexer.c
branches/io_cleanups/compilers/imcc/imcparser.c
branches/io_cleanups/compilers/imcc/instructions.c
branches/io_cleanups/compilers/imcc/main.c
branches/io_cleanups/compilers/imcc/optimizer.c
branches/io_cleanups/compilers/imcc/parser_util.c
branches/io_cleanups/compilers/imcc/pbc.c
branches/io_cleanups/compilers/imcc/pcc.c
branches/io_cleanups/compilers/imcc/reg_alloc.c
branches/io_cleanups/compilers/imcc/symreg.c
branches/io_cleanups/compilers/pct/src/PCT/Dumper.pir
branches/io_cleanups/config/auto/icu.pm
branches/io_cleanups/config/auto/sizes/intval_maxmin_c.in (props changed)
branches/io_cleanups/config/gen/crypto.pm
branches/io_cleanups/config/gen/makefiles/root.in
branches/io_cleanups/config/gen/opengl.pm
branches/io_cleanups/docs/book/draft/README (props changed)
branches/io_cleanups/docs/book/draft/appa_glossary.pod (props changed)
branches/io_cleanups/docs/book/draft/appb_patch_submission.pod (props changed)
branches/io_cleanups/docs/book/draft/appc_command_line_options.pod (props changed)
branches/io_cleanups/docs/book/draft/appd_build_options.pod (props changed)
branches/io_cleanups/docs/book/draft/appe_source_code.pod (props changed)
branches/io_cleanups/docs/book/draft/ch01_introduction.pod (props changed)
branches/io_cleanups/docs/book/draft/ch02_getting_started.pod (props changed)
branches/io_cleanups/docs/book/draft/ch03_pir.pod (props changed)
branches/io_cleanups/docs/book/draft/ch04_compiler_tools.pod (props changed)
branches/io_cleanups/docs/book/draft/ch05_pge.pod (props changed)
branches/io_cleanups/docs/book/draft/ch06_nqp.pod (props changed)
branches/io_cleanups/docs/book/draft/ch07_dynpmcs.pod (props changed)
branches/io_cleanups/docs/book/draft/ch08_dynops.pod (props changed)
branches/io_cleanups/docs/book/draft/ch10_opcode_reference.pod (props changed)
branches/io_cleanups/docs/book/draft/ch11_directive_reference.pod (props changed)
branches/io_cleanups/docs/book/draft/ch12_operator_reference.pod (props changed)
branches/io_cleanups/docs/book/draft/chXX_hlls.pod (props changed)
branches/io_cleanups/docs/book/draft/chXX_library.pod (props changed)
branches/io_cleanups/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
branches/io_cleanups/docs/dev/c_functions.pod (props changed)
branches/io_cleanups/docs/pdds/pdd27_multiple_dispatch.pod
branches/io_cleanups/docs/pdds/pdd30_install.pod (props changed)
branches/io_cleanups/docs/project/release_manager_guide.pod
branches/io_cleanups/docs/user/pir/objects.pod
branches/io_cleanups/docs/user/pir/pmcs.pod
branches/io_cleanups/examples/languages/abc/ (props changed)
branches/io_cleanups/examples/languages/squaak/ (props changed)
branches/io_cleanups/examples/tutorial/01_temp_var.pir
branches/io_cleanups/examples/tutorial/02_local_var.pir
branches/io_cleanups/examples/tutorial/03_temp_var_basic_pmcs.pir
branches/io_cleanups/examples/tutorial/24_string_ops_clone.pir
branches/io_cleanups/examples/tutorial/30_arrays_basic.pir
branches/io_cleanups/examples/tutorial/32_array_ops_sprintf.pir
branches/io_cleanups/examples/tutorial/33_hashes.pir
branches/io_cleanups/examples/tutorial/34_multikey.pir
branches/io_cleanups/examples/tutorial/40_file_ops.pir
branches/io_cleanups/examples/tutorial/55_iterator.pir
branches/io_cleanups/examples/tutorial/56_defined.pir
branches/io_cleanups/examples/tutorial/57_exists.pir
branches/io_cleanups/examples/tutorial/61_namespaces.pir
branches/io_cleanups/examples/tutorial/70_class_object.pir
branches/io_cleanups/examples/tutorial/81_continuation.pir
branches/io_cleanups/include/parrot/call.h (props changed)
branches/io_cleanups/include/parrot/gc_api.h (props changed)
branches/io_cleanups/include/parrot/key.h
branches/io_cleanups/include/parrot/memory.h
branches/io_cleanups/include/parrot/runcore_api.h (props changed)
branches/io_cleanups/include/parrot/runcore_trace.h (props changed)
branches/io_cleanups/include/parrot/stacks.h
branches/io_cleanups/include/parrot/sub.h
branches/io_cleanups/lib/Parrot/Pmc2c/Attribute.pm
branches/io_cleanups/lib/Parrot/Pmc2c/PMCEmitter.pm
branches/io_cleanups/ports/cpan/pause_guide.pod (props changed)
branches/io_cleanups/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
branches/io_cleanups/ports/debian/libparrot-dev.install.in (props changed)
branches/io_cleanups/ports/debian/libparrot.install.in (props changed)
branches/io_cleanups/ports/debian/parrot-doc.install.in (props changed)
branches/io_cleanups/ports/debian/parrot.install.in (props changed)
branches/io_cleanups/ports/fedora/parrot.spec.fedora (props changed)
branches/io_cleanups/ports/mandriva/parrot.spec.mandriva (props changed)
branches/io_cleanups/ports/suse/parrot.spec.suse (props changed)
branches/io_cleanups/runtime/parrot/languages/ (props changed)
branches/io_cleanups/runtime/parrot/library/Math/Rand.pir (props changed)
branches/io_cleanups/runtime/parrot/library/OpenGL.pir
branches/io_cleanups/src/call/ops.c (props changed)
branches/io_cleanups/src/call/pcc.c (props changed)
branches/io_cleanups/src/gc/alloc_memory.c (contents, props changed)
branches/io_cleanups/src/gc/alloc_register.c (props changed)
branches/io_cleanups/src/gc/alloc_resources.c (props changed)
branches/io_cleanups/src/gc/api.c (contents, props changed)
branches/io_cleanups/src/gc/generational_ms.c (props changed)
branches/io_cleanups/src/gc/incremental_ms.c (props changed)
branches/io_cleanups/src/gc/malloc.c (props changed)
branches/io_cleanups/src/gc/malloc_trace.c (props changed)
branches/io_cleanups/src/gc/mark_sweep.c (props changed)
branches/io_cleanups/src/gc/system.c (props changed)
branches/io_cleanups/src/interp/inter_cb.c (props changed)
branches/io_cleanups/src/interp/inter_create.c (contents, props changed)
branches/io_cleanups/src/interp/inter_misc.c (props changed)
branches/io_cleanups/src/jit/i386/jit_defs.c
branches/io_cleanups/src/key.c
branches/io_cleanups/src/library.c
branches/io_cleanups/src/packfile.c
branches/io_cleanups/src/parrot_debugger.c
branches/io_cleanups/src/pbc_merge.c
branches/io_cleanups/src/pmc.c
branches/io_cleanups/src/pmc/multisub.pmc
branches/io_cleanups/src/pmc/parrotinterpreter.pmc
branches/io_cleanups/src/pmc/parrotrunningthread.pmc
branches/io_cleanups/src/pmc/parrotthread.pmc
branches/io_cleanups/src/pmc/stringhandle.pmc
branches/io_cleanups/src/runcore/cores.c (props changed)
branches/io_cleanups/src/runcore/main.c (props changed)
branches/io_cleanups/src/runcore/trace.c (props changed)
branches/io_cleanups/src/stacks.c
branches/io_cleanups/src/string/charset/unicode.c
branches/io_cleanups/t/compilers/imcc/syn/regressions.t
branches/io_cleanups/t/compilers/tge/NoneGrammar.tg (props changed)
branches/io_cleanups/t/dynpmc/pair.t (props changed)
branches/io_cleanups/t/oo/metamodel.t
branches/io_cleanups/t/oo/root_new.t (props changed)
branches/io_cleanups/t/op/ifunless.t
branches/io_cleanups/t/op/io.t
branches/io_cleanups/t/src/embed.t (props changed)
branches/io_cleanups/t/steps/auto_icu-01.t
branches/io_cleanups/tools/dev/branch_status.pl
branches/io_cleanups/tools/dev/fetch_languages.pl (props changed)
branches/io_cleanups/tools/dev/mk_gitignore.pl (props changed)
branches/io_cleanups/tools/util/perlcritic-cage.conf (props changed)
Modified: branches/io_cleanups/MANIFEST
==============================================================================
--- branches/io_cleanups/MANIFEST Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/MANIFEST Sat Jun 27 01:33:11 2009 (r39805)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun 18 02:01:14 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Jun 22 04:12:02 2009 UT
#
# See below for documentation on the format of this file.
#
@@ -725,6 +725,7 @@
examples/nci/xlibtest.p6 [examples]
examples/nci/xlibtest.pir [examples]
examples/nci/xlibtest.rb [examples]
+examples/opengl/math.pir [examples]
examples/opengl/shapes.p6 [examples]
examples/opengl/shapes.pir [examples]
examples/opengl/static-triangle.p6 [examples]
@@ -1172,6 +1173,7 @@
runtime/parrot/library/NCI/Utils.pir [library]
runtime/parrot/library/NCI/call_toolkit_init.pir [library]
runtime/parrot/library/OpenGL.pir [library]
+runtime/parrot/library/OpenGL/Math.pir [library]
runtime/parrot/library/P6object.pir [library]
runtime/parrot/library/PCT/README []doc
runtime/parrot/library/PGE/Dumper.pir [library]
Modified: branches/io_cleanups/MANIFEST.SKIP
==============================================================================
--- branches/io_cleanups/MANIFEST.SKIP Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/MANIFEST.SKIP Sat Jun 27 01:33:11 2009 (r39805)
@@ -1,6 +1,6 @@
# ex: set ro:
# $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Jun 14 12:49:12 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun 25 20:34:12 2009 UT
#
# This file should contain a transcript of the svn:ignore properties
# of the directories in the Parrot subversion repository. (Needed for
@@ -578,6 +578,9 @@
# generated from svn:ignore of 'runtime/parrot/library/NCI/'
^runtime/parrot/library/NCI/.*\.pbc$
^runtime/parrot/library/NCI/.*\.pbc/
+# generated from svn:ignore of 'runtime/parrot/library/OpenGL/'
+^runtime/parrot/library/OpenGL/.*\.pbc$
+^runtime/parrot/library/OpenGL/.*\.pbc/
# generated from svn:ignore of 'runtime/parrot/library/PCT/'
^runtime/parrot/library/PCT/.*\.pbc$
^runtime/parrot/library/PCT/.*\.pbc/
Modified: branches/io_cleanups/PLATFORMS
==============================================================================
--- branches/io_cleanups/PLATFORMS Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/PLATFORMS Sat Jun 27 01:33:11 2009 (r39805)
@@ -39,6 +39,7 @@
dragonfly2.2.0-i386-gcc-4.1.2 4 Y Y - Y Y Y Y ? 20090427
freebsd-x86-gcc-4.2.1 4 Y Y Y ? ? Y Y Y 20090415
freebsd-amd64-gcc-4.2.1 8 Y - - ? ? Y Y Y 20090419
+linux-amd64-clang-r73854 8 ? ? = Y Y Y/4 Y/1 ? 20090622
linux-ppc-gcc3.4.5 Y Y Y ? ? Y Y ? 20080519
linux-s390x-gcc4.1.2 B4 ? - - Y Y Y Y/2 ? 20080908
linux-x86_64-gcc4.1.2 8 Y - - Y Y Y Y ? 20080220
@@ -93,6 +94,8 @@
--ccflags='-m64' --ldflags='-m64' --linkflags='-m64'
*2 http://rt.perl.org/rt3/Ticket/Display.html?id=60926
*3 failures in 'make examples_tests' (part of 'make fulltest')
+*4 compiles with --ccflags=-U__APPLE_CC__ --without-gmp
+ See http://lists.parrot.org/pipermail/parrot-dev/2009-June/002407.html
The following configurations are also working on x86/linux (and possibly
other platforms):
Modified: branches/io_cleanups/compilers/imcc/imc.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/imc.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/imc.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -143,6 +143,11 @@
clear_globals(interp);
mem_sys_free(IMCC_INFO(interp)->ghash.data);
IMCC_INFO(interp)->ghash.data = NULL;
+
+ if (IMCC_INFO(interp)->state) {
+ free(IMCC_INFO(interp)->state->file);
+ IMCC_INFO(interp)->state->file = NULL;
+ }
}
Modified: branches/io_cleanups/compilers/imcc/imc.h
==============================================================================
--- branches/io_cleanups/compilers/imcc/imc.h Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/imc.h Sat Jun 27 01:33:11 2009 (r39805)
@@ -527,7 +527,6 @@
Interp *interp;
char *file;
FILE *handle;
- int file_needs_free; /* is *file malloced? */
int line;
int pasm_file; /* pasm_file mode of this frame */
};
Modified: branches/io_cleanups/compilers/imcc/imcc.l
==============================================================================
--- branches/io_cleanups/compilers/imcc/imcc.l Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/imcc.l Sat Jun 27 01:33:11 2009 (r39805)
@@ -96,7 +96,7 @@
#define DUP_AND_RET(valp, token) \
do { \
- if (valp) (valp)->s = str_dup(yytext); \
+ if (valp) (valp)->s = mem_sys_strdup(yytext); \
return (token); \
} while (0)
@@ -104,7 +104,7 @@
do { \
if (valp) { \
mem_sys_free((valp)->s); \
- (valp)->s = str_dup(yytext); \
+ (valp)->s = mem_sys_strdup(yytext); \
return (token); \
} \
} while (0)
@@ -171,7 +171,7 @@
}
<heredoc1>.*{EOL} {
- IMCC_INFO(interp)->frames->heredoc_rest = str_dup(yytext);
+ IMCC_INFO(interp)->frames->heredoc_rest = mem_sys_strdup(yytext);
BEGIN(heredoc2);
}
@@ -231,9 +231,8 @@
yy_pop_state(yyscanner);
yy_push_state(cmt3, yyscanner);
- IMCC_INFO(interp)->frames->s.file = str_dup(yytext);
- IMCC_INFO(interp)->frames->s.file_needs_free = 1;
- IMCC_INFO(interp)->cur_unit->file = str_dup(yytext);
+ IMCC_INFO(interp)->frames->s.file = mem_sys_strdup(yytext);
+ IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(yytext);
return FILECOMMENT;
}
@@ -460,7 +459,7 @@
if (c != STRINGC)
return c;
- /* STRINGCs have a str_dup()ed valp->s */
+ /* STRINGCs have a mem_sys_strdup()ed valp->s */
mem_sys_free(valp->s);
YYCHOP();
include_file(interp, yytext + 1, yyscanner);
@@ -517,7 +516,7 @@
YYCHOP();
if (valp)
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
return LABEL;
}
@@ -540,7 +539,7 @@
<*>{OCT} DUP_AND_RET(valp, INTC);
<*>{BIGINT} {
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
/* trailing 'L' */
valp->s[strlen(valp->s) - 1] = '\0';
@@ -550,7 +549,7 @@
}
<*>{STRINGCONSTANT} {
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
/* RT #42382 delete quotes, -> emit, pbc */
return STRINGC;
@@ -563,7 +562,7 @@
off newline and quote. */
if (IMCC_INFO(interp)->frames->heredoc_rest)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "nested heredoc not supported");
- IMCC_INFO(interp)->heredoc_end = str_dup(yytext + 3);
+ IMCC_INFO(interp)->heredoc_end = mem_sys_strdup(yytext + 3);
IMCC_INFO(interp)->heredoc_end[strlen(IMCC_INFO(interp)->heredoc_end) - 1] = 0;
if (!strlen(IMCC_INFO(interp)->heredoc_end))
@@ -586,7 +585,7 @@
<*>{UNICODE} {
/* charset:"..." */
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
/* this is actually not unicode but a string with a charset */
return USTRINGC;
@@ -635,7 +634,7 @@
"'%s' is only a valid register name in PASM mode", yytext);
if (valp)
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
return REG;
}
@@ -664,7 +663,7 @@
}
}
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
return (!pesky_global__is_def && is_op(interp, valp->s) ? PARROT_OP : IDENTIFIER);
}
@@ -788,13 +787,8 @@
if (IMCC_INFO(interp)->frames) {
tmp->s.pasm_file = IMCC_INFO(interp)->frames->s.pasm_file;
-
- if (IMCC_INFO(interp)->frames->s.file_needs_free)
- tmp->s.file = str_dup(IMCC_INFO(interp)->frames->s.file);
- else
- tmp->s.file = IMCC_INFO(interp)->frames->s.file;
-
- tmp->s.file_needs_free = IMCC_INFO(interp)->frames->s.file_needs_free;
+ if (IMCC_INFO(interp)->frames->s.file)
+ tmp->s.file = mem_sys_strdup(IMCC_INFO(interp)->frames->s.file);
}
tmp->s.interp = interp;
@@ -833,13 +827,7 @@
} else
ret = frame->s.line;
- /* RT #42383 if frame->s.file was allocated free it */
- /* Update: This should do it! */
- if (frame->s.file_needs_free) {
- DECL_CONST_CAST;
- mem_sys_free(PARROT_const_cast(char *,frame->s.file));
- frame->s.file_needs_free = 0;
- }
+ mem_sys_free(frame->s.file);
mem_sys_free(frame);
if (buffer != NULL)
@@ -866,7 +854,7 @@
if (*p == '\0')
break;
- /* free any str_dup()ed strings */
+ /* free any mem_sys_strdup()ed strings */
if (yytext)
mem_sys_free(valp->s);
} while (*p != '\0');
@@ -924,7 +912,7 @@
{
YYSTYPE val;
size_t len = 0;
- char *current = str_dup("");
+ char *current = mem_sys_strdup("");
yyguts_t *yyg = (yyguts_t *)yyscanner;
int c = yylex_skip(&val, interp, " \n", yyscanner);
@@ -946,7 +934,7 @@
MAX_PARAM, macro_name);
params->name[params->num_param++] = current;
- current = str_dup("");
+ current = mem_sys_strdup("");
len = 0;
if (val.s)
@@ -1121,7 +1109,7 @@
else
memset(&m->params, 0, sizeof (params_t));
- m->expansion = str_dup(expansion);
+ m->expansion = mem_sys_strdup(expansion);
m->line = start_line;
}
@@ -1162,12 +1150,10 @@
/* remember macro name for error reporting
* first free any filename allocated in new_frame() */
- if (frame->s.file && frame->s.file_needs_free)
+ if (frame->s.file)
mem_sys_free(frame->s.file);
- /* RT #42384 check that all the .file text is malloced / freed */
- frame->s.file = str_dup(name);
- frame->s.file_needs_free = 1;
+ frame->s.file = mem_sys_strdup(name);
/* whitespace can be safely ignored */
do {
@@ -1196,7 +1182,7 @@
BEGIN(start_cond);
if (frame->expansion.num_param == 0 && m->params.num_param == 1) {
- frame->expansion.name[0] = str_dup("");
+ frame->expansion.name[0] = mem_sys_strdup("");
frame->expansion.num_param = 1;
}
@@ -1215,7 +1201,7 @@
const char * const s = find_macro_param(interp, current + 1);
if (s) {
- frame->expansion.name[i] = str_dup(s);
+ frame->expansion.name[i] = mem_sys_strdup(s);
mem_sys_free(current);
}
@@ -1238,6 +1224,7 @@
IMCC_INFO(interp)->line = m->line;
scan_string(frame, m->expansion, yyscanner);
+
return 1;
}
@@ -1254,12 +1241,16 @@
char *ext;
FILE *file;
- if (!s || !(file = fopen(s, "r")))
+ if (!s || !(file = fopen(s, "r"))) {
+ if (frame->s.file)
+ mem_sys_free(frame->s.file);
IMCC_fataly(interp, EXCEPTION_EXTERNAL_ERROR, strerror(errno));
+ }
+ if (frame->s.file)
+ mem_sys_free(frame->s.file);
mem_sys_free(s);
- frame->s.file = file_name;
- frame->s.file_needs_free = 0;
+ frame->s.file = mem_sys_strdup(file_name);
frame->s.handle = file;
ext = strrchr(file_name, '.');
@@ -1432,17 +1423,16 @@
set_filename(PARROT_INTERP, char * const filename)
{
IMCC_INFO(interp)->frames->s.file = filename;
- IMCC_INFO(interp)->frames->s.file_needs_free = 1;
/* in case .line is used outside a .sub, then this
* can't be done; hence the check.
- * The str_dup() is done, as the original #line implementation
+ * The mem_sys_strdup() is done, as the original #line implementation
* duplicated the string twice as well; one for the
* frames->s.file and one for cur_unit->file.
- * During the parse, the STRINGC is already str_dup()ed once.
+ * During the parse, the STRINGC is already mem_sys_strdup()ed once.
*/
if (IMCC_INFO(interp)->cur_unit)
- IMCC_INFO(interp)->cur_unit->file = str_dup(filename);
+ IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(filename);
}
/* Functions to set and get yyin, as we can't decorate it for export
Modified: branches/io_cleanups/compilers/imcc/imcc.y
==============================================================================
--- branches/io_cleanups/compilers/imcc/imcc.y Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/imcc.y Sat Jun 27 01:33:11 2009 (r39805)
@@ -42,45 +42,49 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void add_pcc_named_arg(PARROT_INTERP,
+static void add_pcc_named_arg(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
-static void add_pcc_named_arg_var(PARROT_INTERP,
+static void add_pcc_named_arg_var(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
-static void add_pcc_named_param(PARROT_INTERP,
+static void add_pcc_named_param(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
-static void add_pcc_named_result(PARROT_INTERP,
+static void add_pcc_named_result(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
static void add_pcc_named_return(PARROT_INTERP,
ARGMOD(SymReg *cur_call),
@@ -239,23 +243,19 @@
FUNC_MODIFIES(*name);
#define ASSERT_ARGS_add_pcc_named_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_arg_var __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_param __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_result __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_return __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -437,11 +437,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- name = str_dup(constant + 1);
+ name = mem_sys_strdup(constant + 1);
name[strlen(name) - 1] = 0;
}
else {
- name = str_dup(constant);
+ name = mem_sys_strdup(constant);
}
switch (type_enum) {
@@ -487,7 +487,7 @@
SymReg *r[3];
char *const_name;
const int ascii = (*constant == '\'' || *constant == '"');
- char *unquoted_name = str_dup(name + 1);
+ char *unquoted_name = mem_sys_strdup(name + 1);
size_t name_length = strlen(unquoted_name) - 1;
unquoted_name[name_length] = 0;
@@ -504,11 +504,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- const_name = str_dup(constant + 1);
+ const_name = mem_sys_strdup(constant + 1);
const_name[strlen(const_name) - 1] = 0;
}
else {
- const_name = str_dup(constant);
+ const_name = mem_sys_strdup(constant);
}
if ((strncmp(unquoted_name, "Sub", name_length) == 0)
@@ -759,7 +759,7 @@
ASSERT_ARGS(mk_sub_address_fromc)
/* name is a quoted sub name */
SymReg *r;
- char *name_copy = str_dup(name + 1);
+ char *name_copy = mem_sys_strdup(name + 1);
name_copy[strlen(name_copy) - 1] = 0;
r = mk_sub_address(interp, name_copy);
@@ -875,17 +875,17 @@
/*
-=item C<static void add_pcc_named_arg(PARROT_INTERP, SymReg *cur_call, SymReg
-*name, SymReg *value)>
+=item C<static void add_pcc_named_arg(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_arg(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+add_pcc_named_arg(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_arg)
name->type |= VT_NAMED;
@@ -896,16 +896,16 @@
/*
-=item C<static void add_pcc_named_arg_var(PARROT_INTERP, SymReg *cur_call,
-SymReg *name, SymReg *value)>
+=item C<static void add_pcc_named_arg_var(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_arg_var(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name), ARGIN(SymReg *value))
+add_pcc_named_arg_var(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name), ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_arg_var)
name->type |= VT_NAMED;
@@ -915,17 +915,17 @@
/*
-=item C<static void add_pcc_named_result(PARROT_INTERP, SymReg *cur_call, SymReg
-*name, SymReg *value)>
+=item C<static void add_pcc_named_result(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_result(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+add_pcc_named_result(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_result)
name->type |= VT_NAMED;
@@ -936,17 +936,17 @@
/*
-=item C<static void add_pcc_named_param(PARROT_INTERP, SymReg *cur_call, SymReg
-*name, SymReg *value)>
+=item C<static void add_pcc_named_param(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_param(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+add_pcc_named_param(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_param)
name->type |= VT_NAMED;
@@ -1269,6 +1269,7 @@
IMCC_INFO(interp)->cur_unit,
mk_sub_label(interp, $4));
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = $3;
+ mem_sys_free($4);
}
| PNULL var
{
@@ -1348,7 +1349,7 @@
{
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = $5;
if (!IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid) {
- IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = str_dup(
+ IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = mem_sys_strdup(
IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->name);
}
}
@@ -1362,7 +1363,7 @@
| sub_params sub_param '\n'
{
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_param(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_param(IMCC_INFO(interp)->cur_call,
IMCC_INFO(interp)->adv_named_id, $2);
IMCC_INFO(interp)->adv_named_id = NULL;
}
@@ -1657,7 +1658,7 @@
RESULT target paramtype_list { $$ = $2; $$->type |= $3; }
| LOCAL { pesky_global__is_def=1; } type id_list_id
{
- IdList *l = $4;
+ IdList * const l = $4;
SymReg *ignored;
if (l->unique_reg)
ignored = mk_ident_ur(interp, l->id, $3);
@@ -1968,7 +1969,7 @@
classname:
IDENTIFIER
{
- /* there'd normally be a str_dup() here, but the lexer already
+ /* there'd normally be a mem_sys_strdup() here, but the lexer already
* copied the string, so it's safe to use directly */
if ((IMCC_INFO(interp)->cur_pmc_type = pmc_type(interp,
Parrot_str_new(interp, $1, 0))) <= 0) {
@@ -2113,7 +2114,7 @@
| target DOT sub_label_op
{
/* disallow bareword method names; SREG name constants are fine */
- char *name = $3->name;
+ const char * const name = $3->name;
if (!($3->type & VTREG)) {
if (*name != '\'' || *name != '\"')
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -2155,7 +2156,7 @@
{
$$ = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -2165,7 +2166,7 @@
{
$$ = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -2174,19 +2175,19 @@
| arglist COMMA STRINGC ADV_ARROW var
{
$$ = 0;
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
mk_const(interp, $3, 'S'), $5);
mem_sys_free($3);
}
| var ADV_ARROW var
{
$$ = 0;
- add_pcc_named_arg_var(interp, IMCC_INFO(interp)->cur_call, $1, $3);
+ add_pcc_named_arg_var(IMCC_INFO(interp)->cur_call, $1, $3);
}
| STRINGC ADV_ARROW var
{
$$ = 0;
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
mk_const(interp, $1, 'S'), $3);
mem_sys_free($1);
}
@@ -2219,7 +2220,7 @@
{
$$ = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $3);
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -2227,7 +2228,7 @@
}
| targetlist COMMA STRINGC ADV_ARROW target
{
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call,
mk_const(interp, $3, 'S'), $5);
mem_sys_free($3);
}
@@ -2235,7 +2236,7 @@
{
$$ = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, $1);
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -2243,7 +2244,7 @@
}
| STRINGC ADV_ARROW target
{
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, mk_const(interp, $1, 'S'), $3);
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call, mk_const(interp, $1, 'S'), $3);
mem_sys_free($1);
}
| /* empty */ { $$ = 0; }
Modified: branches/io_cleanups/compilers/imcc/imclexer.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/imclexer.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/imclexer.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -2464,7 +2464,7 @@
#define DUP_AND_RET(valp, token) \
do { \
- if (valp) (valp)->s = str_dup(yytext); \
+ if (valp) (valp)->s = mem_sys_strdup(yytext); \
return (token); \
} while (0)
@@ -2472,7 +2472,7 @@
do { \
if (valp) { \
mem_sys_free((valp)->s); \
- (valp)->s = str_dup(yytext); \
+ (valp)->s = mem_sys_strdup(yytext); \
return (token); \
} \
} while (0)
@@ -2836,7 +2836,7 @@
YY_RULE_SETUP
#line 173 "compilers/imcc/imcc.l"
{
- IMCC_INFO(interp)->frames->heredoc_rest = str_dup(yytext);
+ IMCC_INFO(interp)->frames->heredoc_rest = mem_sys_strdup(yytext);
BEGIN(heredoc2);
}
YY_BREAK
@@ -2907,16 +2907,15 @@
yy_pop_state(yyscanner);
yy_push_state(cmt3, yyscanner);
- IMCC_INFO(interp)->frames->s.file = str_dup(yytext);
- IMCC_INFO(interp)->frames->s.file_needs_free = 1;
- IMCC_INFO(interp)->cur_unit->file = str_dup(yytext);
+ IMCC_INFO(interp)->frames->s.file = mem_sys_strdup(yytext);
+ IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(yytext);
return FILECOMMENT;
}
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 241 "compilers/imcc/imcc.l"
+#line 240 "compilers/imcc/imcc.l"
{
yy_pop_state(yyscanner);
yy_push_state(cmt4, yyscanner);
@@ -2924,17 +2923,17 @@
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 246 "compilers/imcc/imcc.l"
+#line 245 "compilers/imcc/imcc.l"
{ yy_push_state(cmt2, yyscanner); }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 248 "compilers/imcc/imcc.l"
+#line 247 "compilers/imcc/imcc.l"
{ yy_push_state(cmt1, yyscanner); }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 250 "compilers/imcc/imcc.l"
+#line 249 "compilers/imcc/imcc.l"
{
IMCC_INFO(interp)->line = atoi(yytext);
yy_pop_state(yyscanner);
@@ -2945,7 +2944,7 @@
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
-#line 257 "compilers/imcc/imcc.l"
+#line 256 "compilers/imcc/imcc.l"
{
yy_pop_state(yyscanner);
IMCC_INFO(interp)->line++;
@@ -2954,7 +2953,7 @@
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 262 "compilers/imcc/imcc.l"
+#line 261 "compilers/imcc/imcc.l"
{
if (IMCC_INFO(interp)->expect_pasm == 2)
BEGIN(INITIAL);
@@ -2967,7 +2966,7 @@
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 272 "compilers/imcc/imcc.l"
+#line 271 "compilers/imcc/imcc.l"
{
yy_push_state(cmt5, yyscanner);
}
@@ -2975,7 +2974,7 @@
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
-#line 276 "compilers/imcc/imcc.l"
+#line 275 "compilers/imcc/imcc.l"
{
if (IMCC_INFO(interp)->expect_pasm == 2)
BEGIN(INITIAL);
@@ -2991,7 +2990,7 @@
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
-#line 289 "compilers/imcc/imcc.l"
+#line 288 "compilers/imcc/imcc.l"
{
/* this is a stand-alone =cut, but we're
* not in POD mode, so just ignore.
@@ -3000,7 +2999,7 @@
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 295 "compilers/imcc/imcc.l"
+#line 294 "compilers/imcc/imcc.l"
{
IMCC_INFO(interp)->in_pod = 1;
yy_push_state(pod, yyscanner);
@@ -3009,7 +3008,7 @@
case 15:
/* rule 15 can match eol */
YY_RULE_SETUP
-#line 300 "compilers/imcc/imcc.l"
+#line 299 "compilers/imcc/imcc.l"
{
IMCC_INFO(interp)->in_pod = 0;
yy_pop_state(yyscanner);
@@ -3018,473 +3017,473 @@
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 306 "compilers/imcc/imcc.l"
+#line 305 "compilers/imcc/imcc.l"
{ /*ignore*/ }
YY_BREAK
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
-#line 308 "compilers/imcc/imcc.l"
+#line 307 "compilers/imcc/imcc.l"
{ IMCC_INFO(interp)->line++; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 310 "compilers/imcc/imcc.l"
+#line 309 "compilers/imcc/imcc.l"
return TK_LINE;
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 311 "compilers/imcc/imcc.l"
+#line 310 "compilers/imcc/imcc.l"
return TK_FILE;
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 312 "compilers/imcc/imcc.l"
+#line 311 "compilers/imcc/imcc.l"
return ANNOTATE;
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 313 "compilers/imcc/imcc.l"
+#line 312 "compilers/imcc/imcc.l"
return LEXICAL;
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 314 "compilers/imcc/imcc.l"
+#line 313 "compilers/imcc/imcc.l"
return ARG;
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 315 "compilers/imcc/imcc.l"
+#line 314 "compilers/imcc/imcc.l"
return SUB;
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 316 "compilers/imcc/imcc.l"
+#line 315 "compilers/imcc/imcc.l"
return ESUB;
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 317 "compilers/imcc/imcc.l"
+#line 316 "compilers/imcc/imcc.l"
return PCC_BEGIN;
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 318 "compilers/imcc/imcc.l"
+#line 317 "compilers/imcc/imcc.l"
return PCC_END;
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 319 "compilers/imcc/imcc.l"
+#line 318 "compilers/imcc/imcc.l"
return PCC_CALL;
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 320 "compilers/imcc/imcc.l"
+#line 319 "compilers/imcc/imcc.l"
return NCI_CALL;
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 321 "compilers/imcc/imcc.l"
+#line 320 "compilers/imcc/imcc.l"
return METH_CALL;
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 322 "compilers/imcc/imcc.l"
+#line 321 "compilers/imcc/imcc.l"
return INVOCANT;
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 323 "compilers/imcc/imcc.l"
+#line 322 "compilers/imcc/imcc.l"
return PCC_SUB;
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 324 "compilers/imcc/imcc.l"
+#line 323 "compilers/imcc/imcc.l"
return PCC_BEGIN_RETURN;
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 325 "compilers/imcc/imcc.l"
+#line 324 "compilers/imcc/imcc.l"
return PCC_END_RETURN;
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 326 "compilers/imcc/imcc.l"
+#line 325 "compilers/imcc/imcc.l"
return PCC_BEGIN_YIELD;
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 327 "compilers/imcc/imcc.l"
+#line 326 "compilers/imcc/imcc.l"
return PCC_END_YIELD;
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 329 "compilers/imcc/imcc.l"
+#line 328 "compilers/imcc/imcc.l"
return METHOD;
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 330 "compilers/imcc/imcc.l"
+#line 329 "compilers/imcc/imcc.l"
return MULTI;
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 331 "compilers/imcc/imcc.l"
+#line 330 "compilers/imcc/imcc.l"
return MAIN;
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 332 "compilers/imcc/imcc.l"
+#line 331 "compilers/imcc/imcc.l"
return LOAD;
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 333 "compilers/imcc/imcc.l"
+#line 332 "compilers/imcc/imcc.l"
return INIT;
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 334 "compilers/imcc/imcc.l"
+#line 333 "compilers/imcc/imcc.l"
return IMMEDIATE;
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 335 "compilers/imcc/imcc.l"
+#line 334 "compilers/imcc/imcc.l"
return POSTCOMP;
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 336 "compilers/imcc/imcc.l"
+#line 335 "compilers/imcc/imcc.l"
return ANON;
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 337 "compilers/imcc/imcc.l"
+#line 336 "compilers/imcc/imcc.l"
return OUTER;
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 338 "compilers/imcc/imcc.l"
+#line 337 "compilers/imcc/imcc.l"
return NEED_LEX;
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 339 "compilers/imcc/imcc.l"
+#line 338 "compilers/imcc/imcc.l"
return VTABLE_METHOD;
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 340 "compilers/imcc/imcc.l"
+#line 339 "compilers/imcc/imcc.l"
return NS_ENTRY;
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 341 "compilers/imcc/imcc.l"
+#line 340 "compilers/imcc/imcc.l"
return UNIQUE_REG;
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 342 "compilers/imcc/imcc.l"
+#line 341 "compilers/imcc/imcc.l"
return SUB_INSTANCE_OF;
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 343 "compilers/imcc/imcc.l"
+#line 342 "compilers/imcc/imcc.l"
return SUBID;
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 345 "compilers/imcc/imcc.l"
+#line 344 "compilers/imcc/imcc.l"
return RESULT;
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 346 "compilers/imcc/imcc.l"
+#line 345 "compilers/imcc/imcc.l"
return GET_RESULTS;
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 347 "compilers/imcc/imcc.l"
+#line 346 "compilers/imcc/imcc.l"
return YIELDT;
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 348 "compilers/imcc/imcc.l"
+#line 347 "compilers/imcc/imcc.l"
return SET_YIELD;
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 349 "compilers/imcc/imcc.l"
+#line 348 "compilers/imcc/imcc.l"
return RETURN;
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 350 "compilers/imcc/imcc.l"
+#line 349 "compilers/imcc/imcc.l"
return SET_RETURN;
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 351 "compilers/imcc/imcc.l"
+#line 350 "compilers/imcc/imcc.l"
return TAILCALL;
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 352 "compilers/imcc/imcc.l"
+#line 351 "compilers/imcc/imcc.l"
return LOADLIB;
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 354 "compilers/imcc/imcc.l"
+#line 353 "compilers/imcc/imcc.l"
return ADV_FLAT;
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 355 "compilers/imcc/imcc.l"
+#line 354 "compilers/imcc/imcc.l"
return ADV_SLURPY;
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 356 "compilers/imcc/imcc.l"
+#line 355 "compilers/imcc/imcc.l"
return ADV_OPTIONAL;
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 357 "compilers/imcc/imcc.l"
+#line 356 "compilers/imcc/imcc.l"
return ADV_OPT_FLAG;
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 358 "compilers/imcc/imcc.l"
+#line 357 "compilers/imcc/imcc.l"
return ADV_NAMED;
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 359 "compilers/imcc/imcc.l"
+#line 358 "compilers/imcc/imcc.l"
return ADV_ARROW;
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 360 "compilers/imcc/imcc.l"
+#line 359 "compilers/imcc/imcc.l"
return ADV_INVOCANT;
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 362 "compilers/imcc/imcc.l"
+#line 361 "compilers/imcc/imcc.l"
return NAMESPACE;
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 363 "compilers/imcc/imcc.l"
+#line 362 "compilers/imcc/imcc.l"
return HLL;
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 365 "compilers/imcc/imcc.l"
+#line 364 "compilers/imcc/imcc.l"
return LOCAL;
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 366 "compilers/imcc/imcc.l"
+#line 365 "compilers/imcc/imcc.l"
return CONST;
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 367 "compilers/imcc/imcc.l"
+#line 366 "compilers/imcc/imcc.l"
return GLOBAL_CONST;
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 368 "compilers/imcc/imcc.l"
+#line 367 "compilers/imcc/imcc.l"
return PARAM;
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 369 "compilers/imcc/imcc.l"
+#line 368 "compilers/imcc/imcc.l"
return GOTO;
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 370 "compilers/imcc/imcc.l"
+#line 369 "compilers/imcc/imcc.l"
return IF;
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 371 "compilers/imcc/imcc.l"
+#line 370 "compilers/imcc/imcc.l"
return UNLESS;
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 372 "compilers/imcc/imcc.l"
+#line 371 "compilers/imcc/imcc.l"
return PNULL;
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 373 "compilers/imcc/imcc.l"
+#line 372 "compilers/imcc/imcc.l"
return INTV;
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 374 "compilers/imcc/imcc.l"
+#line 373 "compilers/imcc/imcc.l"
return FLOATV;
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 376 "compilers/imcc/imcc.l"
+#line 375 "compilers/imcc/imcc.l"
return PMCV;
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 377 "compilers/imcc/imcc.l"
+#line 376 "compilers/imcc/imcc.l"
return STRINGV;
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 378 "compilers/imcc/imcc.l"
+#line 377 "compilers/imcc/imcc.l"
return SHIFT_LEFT;
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 379 "compilers/imcc/imcc.l"
+#line 378 "compilers/imcc/imcc.l"
return SHIFT_RIGHT;
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 380 "compilers/imcc/imcc.l"
+#line 379 "compilers/imcc/imcc.l"
return SHIFT_RIGHT_U;
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 381 "compilers/imcc/imcc.l"
+#line 380 "compilers/imcc/imcc.l"
return LOG_AND;
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 382 "compilers/imcc/imcc.l"
+#line 381 "compilers/imcc/imcc.l"
return LOG_OR;
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 383 "compilers/imcc/imcc.l"
+#line 382 "compilers/imcc/imcc.l"
return LOG_XOR;
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 384 "compilers/imcc/imcc.l"
+#line 383 "compilers/imcc/imcc.l"
return RELOP_LT;
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 385 "compilers/imcc/imcc.l"
+#line 384 "compilers/imcc/imcc.l"
return RELOP_LTE;
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 386 "compilers/imcc/imcc.l"
+#line 385 "compilers/imcc/imcc.l"
return RELOP_GT;
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 387 "compilers/imcc/imcc.l"
+#line 386 "compilers/imcc/imcc.l"
return RELOP_GTE;
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 388 "compilers/imcc/imcc.l"
+#line 387 "compilers/imcc/imcc.l"
return RELOP_EQ;
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 389 "compilers/imcc/imcc.l"
+#line 388 "compilers/imcc/imcc.l"
return RELOP_NE;
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 390 "compilers/imcc/imcc.l"
+#line 389 "compilers/imcc/imcc.l"
return POW;
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 392 "compilers/imcc/imcc.l"
+#line 391 "compilers/imcc/imcc.l"
return CONCAT;
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 393 "compilers/imcc/imcc.l"
+#line 392 "compilers/imcc/imcc.l"
return DOT;
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 395 "compilers/imcc/imcc.l"
+#line 394 "compilers/imcc/imcc.l"
return PLUS_ASSIGN;
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 396 "compilers/imcc/imcc.l"
+#line 395 "compilers/imcc/imcc.l"
return MINUS_ASSIGN;
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 397 "compilers/imcc/imcc.l"
+#line 396 "compilers/imcc/imcc.l"
return MUL_ASSIGN;
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 398 "compilers/imcc/imcc.l"
+#line 397 "compilers/imcc/imcc.l"
return DIV_ASSIGN;
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 399 "compilers/imcc/imcc.l"
+#line 398 "compilers/imcc/imcc.l"
return MOD_ASSIGN;
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 400 "compilers/imcc/imcc.l"
+#line 399 "compilers/imcc/imcc.l"
return FDIV;
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 401 "compilers/imcc/imcc.l"
+#line 400 "compilers/imcc/imcc.l"
return FDIV_ASSIGN;
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 402 "compilers/imcc/imcc.l"
+#line 401 "compilers/imcc/imcc.l"
return BAND_ASSIGN;
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 403 "compilers/imcc/imcc.l"
+#line 402 "compilers/imcc/imcc.l"
return BOR_ASSIGN;
YY_BREAK
case 104:
YY_RULE_SETUP
-#line 404 "compilers/imcc/imcc.l"
+#line 403 "compilers/imcc/imcc.l"
return BXOR_ASSIGN;
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 405 "compilers/imcc/imcc.l"
+#line 404 "compilers/imcc/imcc.l"
return SHR_ASSIGN;
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 406 "compilers/imcc/imcc.l"
+#line 405 "compilers/imcc/imcc.l"
return SHL_ASSIGN;
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 407 "compilers/imcc/imcc.l"
+#line 406 "compilers/imcc/imcc.l"
return SHR_U_ASSIGN;
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 408 "compilers/imcc/imcc.l"
+#line 407 "compilers/imcc/imcc.l"
return CONCAT_ASSIGN;
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 410 "compilers/imcc/imcc.l"
+#line 409 "compilers/imcc/imcc.l"
{
char *macro_name = NULL;
int start_cond = YY_START;
@@ -3530,21 +3529,21 @@
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 453 "compilers/imcc/imcc.l"
+#line 452 "compilers/imcc/imcc.l"
{
return read_macro(valp, interp, yyscanner);
}
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 457 "compilers/imcc/imcc.l"
+#line 456 "compilers/imcc/imcc.l"
{
const int c = yylex(valp,yyscanner,interp);
if (c != STRINGC)
return c;
- /* STRINGCs have a str_dup()ed valp->s */
+ /* STRINGCs have a mem_sys_strdup()ed valp->s */
mem_sys_free(valp->s);
YYCHOP();
include_file(interp, yytext + 1, yyscanner);
@@ -3552,7 +3551,7 @@
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 469 "compilers/imcc/imcc.l"
+#line 468 "compilers/imcc/imcc.l"
{
if (valp) {
char *label;
@@ -3577,7 +3576,7 @@
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 491 "compilers/imcc/imcc.l"
+#line 490 "compilers/imcc/imcc.l"
{
if (valp) {
@@ -3602,25 +3601,25 @@
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 513 "compilers/imcc/imcc.l"
+#line 512 "compilers/imcc/imcc.l"
return COMMA;
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 515 "compilers/imcc/imcc.l"
+#line 514 "compilers/imcc/imcc.l"
{
/* trim last ':' */
YYCHOP();
if (valp)
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
return LABEL;
}
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 525 "compilers/imcc/imcc.l"
+#line 524 "compilers/imcc/imcc.l"
{
char * const macro_name = yytext + 1;
@@ -3632,34 +3631,34 @@
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 536 "compilers/imcc/imcc.l"
+#line 535 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, FLOATC);
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 537 "compilers/imcc/imcc.l"
+#line 536 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 538 "compilers/imcc/imcc.l"
+#line 537 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 539 "compilers/imcc/imcc.l"
+#line 538 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 540 "compilers/imcc/imcc.l"
+#line 539 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 542 "compilers/imcc/imcc.l"
+#line 541 "compilers/imcc/imcc.l"
{
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
/* trailing 'L' */
valp->s[strlen(valp->s) - 1] = '\0';
@@ -3670,9 +3669,9 @@
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 552 "compilers/imcc/imcc.l"
+#line 551 "compilers/imcc/imcc.l"
{
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
/* RT #42382 delete quotes, -> emit, pbc */
return STRINGC;
@@ -3680,7 +3679,7 @@
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 559 "compilers/imcc/imcc.l"
+#line 558 "compilers/imcc/imcc.l"
{
macro_frame_t *frame;
@@ -3688,7 +3687,7 @@
off newline and quote. */
if (IMCC_INFO(interp)->frames->heredoc_rest)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "nested heredoc not supported");
- IMCC_INFO(interp)->heredoc_end = str_dup(yytext + 3);
+ IMCC_INFO(interp)->heredoc_end = mem_sys_strdup(yytext + 3);
IMCC_INFO(interp)->heredoc_end[strlen(IMCC_INFO(interp)->heredoc_end) - 1] = 0;
if (!strlen(IMCC_INFO(interp)->heredoc_end))
@@ -3711,10 +3710,10 @@
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 587 "compilers/imcc/imcc.l"
+#line 586 "compilers/imcc/imcc.l"
{
/* charset:"..." */
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
/* this is actually not unicode but a string with a charset */
return USTRINGC;
@@ -3722,7 +3721,7 @@
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 595 "compilers/imcc/imcc.l"
+#line 594 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3733,7 +3732,7 @@
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 603 "compilers/imcc/imcc.l"
+#line 602 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3744,7 +3743,7 @@
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 611 "compilers/imcc/imcc.l"
+#line 610 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3755,7 +3754,7 @@
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 619 "compilers/imcc/imcc.l"
+#line 618 "compilers/imcc/imcc.l"
{
if (valp) (valp)->s = yytext;
if (IMCC_INFO(interp)->state->pasm_file)
@@ -3766,7 +3765,7 @@
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 627 "compilers/imcc/imcc.l"
+#line 626 "compilers/imcc/imcc.l"
{
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
"'%s' is not a valid register name", yytext);
@@ -3774,21 +3773,21 @@
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 632 "compilers/imcc/imcc.l"
+#line 631 "compilers/imcc/imcc.l"
{
if (IMCC_INFO(interp)->state->pasm_file == 0)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
"'%s' is only a valid register name in PASM mode", yytext);
if (valp)
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
return REG;
}
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 643 "compilers/imcc/imcc.l"
+#line 642 "compilers/imcc/imcc.l"
{
if (!pesky_global__is_def) {
SymReg *r = find_sym(interp, yytext);
@@ -3813,25 +3812,25 @@
}
}
- valp->s = str_dup(yytext);
+ valp->s = mem_sys_strdup(yytext);
return (!pesky_global__is_def && is_op(interp, valp->s) ? PARROT_OP : IDENTIFIER);
}
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 672 "compilers/imcc/imcc.l"
+#line 671 "compilers/imcc/imcc.l"
/* skip */;
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 674 "compilers/imcc/imcc.l"
+#line 673 "compilers/imcc/imcc.l"
{
/* catch all except for state macro */
return yytext[0];
}
YY_BREAK
case YY_STATE_EOF(emit):
-#line 679 "compilers/imcc/imcc.l"
+#line 678 "compilers/imcc/imcc.l"
{
BEGIN(INITIAL);
@@ -3844,18 +3843,18 @@
}
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 690 "compilers/imcc/imcc.l"
+#line 689 "compilers/imcc/imcc.l"
yyterminate();
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 692 "compilers/imcc/imcc.l"
+#line 691 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, ENDM);
YY_BREAK
case 136:
/* rule 136 can match eol */
YY_RULE_SETUP
-#line 694 "compilers/imcc/imcc.l"
+#line 693 "compilers/imcc/imcc.l"
{
IMCC_INFO(interp)->line++;
DUP_AND_RET(valp, '\n');
@@ -3863,12 +3862,12 @@
YY_BREAK
case 137:
YY_RULE_SETUP
-#line 699 "compilers/imcc/imcc.l"
+#line 698 "compilers/imcc/imcc.l"
return LABEL;
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 701 "compilers/imcc/imcc.l"
+#line 700 "compilers/imcc/imcc.l"
{
if (yylex(valp,yyscanner,interp) != LABEL)
@@ -3895,7 +3894,7 @@
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 725 "compilers/imcc/imcc.l"
+#line 724 "compilers/imcc/imcc.l"
{
if (valp) {
const size_t len = strlen(IMCC_INFO(interp)->cur_macro_name) + yyleng + 12;
@@ -3914,49 +3913,49 @@
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 741 "compilers/imcc/imcc.l"
+#line 740 "compilers/imcc/imcc.l"
/* skip leading ws */;
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 742 "compilers/imcc/imcc.l"
+#line 741 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, ' ');
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 743 "compilers/imcc/imcc.l"
+#line 742 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, REG);
YY_BREAK
case 143:
YY_RULE_SETUP
-#line 744 "compilers/imcc/imcc.l"
+#line 743 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, REG);
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 745 "compilers/imcc/imcc.l"
+#line 744 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, IDENTIFIER);
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 746 "compilers/imcc/imcc.l"
+#line 745 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, MACRO);
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 747 "compilers/imcc/imcc.l"
+#line 746 "compilers/imcc/imcc.l"
DUP_AND_RET(valp, yytext[0]);
YY_BREAK
case YY_STATE_EOF(macro):
-#line 748 "compilers/imcc/imcc.l"
+#line 747 "compilers/imcc/imcc.l"
yyterminate();
YY_BREAK
case 147:
YY_RULE_SETUP
-#line 750 "compilers/imcc/imcc.l"
+#line 749 "compilers/imcc/imcc.l"
ECHO;
YY_BREAK
-#line 3960 "compilers/imcc/imclexer.c"
+#line 3959 "compilers/imcc/imclexer.c"
case YY_STATE_EOF(pod):
case YY_STATE_EOF(cmt1):
case YY_STATE_EOF(cmt2):
@@ -5158,7 +5157,7 @@
#define YYTABLES_NAME "yytables"
-#line 750 "compilers/imcc/imcc.l"
+#line 749 "compilers/imcc/imcc.l"
@@ -5201,13 +5200,8 @@
if (IMCC_INFO(interp)->frames) {
tmp->s.pasm_file = IMCC_INFO(interp)->frames->s.pasm_file;
-
- if (IMCC_INFO(interp)->frames->s.file_needs_free)
- tmp->s.file = str_dup(IMCC_INFO(interp)->frames->s.file);
- else
- tmp->s.file = IMCC_INFO(interp)->frames->s.file;
-
- tmp->s.file_needs_free = IMCC_INFO(interp)->frames->s.file_needs_free;
+ if (IMCC_INFO(interp)->frames->s.file)
+ tmp->s.file = mem_sys_strdup(IMCC_INFO(interp)->frames->s.file);
}
tmp->s.interp = interp;
@@ -5246,13 +5240,7 @@
} else
ret = frame->s.line;
- /* RT #42383 if frame->s.file was allocated free it */
- /* Update: This should do it! */
- if (frame->s.file_needs_free) {
- DECL_CONST_CAST;
- mem_sys_free(PARROT_const_cast(char *,frame->s.file));
- frame->s.file_needs_free = 0;
- }
+ mem_sys_free(frame->s.file);
mem_sys_free(frame);
if (buffer != NULL)
@@ -5279,7 +5267,7 @@
if (*p == '\0')
break;
- /* free any str_dup()ed strings */
+ /* free any mem_sys_strdup()ed strings */
if (yytext)
mem_sys_free(valp->s);
} while (*p != '\0');
@@ -5337,7 +5325,7 @@
{
YYSTYPE val;
size_t len = 0;
- char *current = str_dup("");
+ char *current = mem_sys_strdup("");
yyguts_t *yyg = (yyguts_t *)yyscanner;
int c = yylex_skip(&val, interp, " \n", yyscanner);
@@ -5359,7 +5347,7 @@
MAX_PARAM, macro_name);
params->name[params->num_param++] = current;
- current = str_dup("");
+ current = mem_sys_strdup("");
len = 0;
if (val.s)
@@ -5534,7 +5522,7 @@
else
memset(&m->params, 0, sizeof (params_t));
- m->expansion = str_dup(expansion);
+ m->expansion = mem_sys_strdup(expansion);
m->line = start_line;
}
@@ -5575,12 +5563,10 @@
/* remember macro name for error reporting
* first free any filename allocated in new_frame() */
- if (frame->s.file && frame->s.file_needs_free)
+ if (frame->s.file)
mem_sys_free(frame->s.file);
- /* RT #42384 check that all the .file text is malloced / freed */
- frame->s.file = str_dup(name);
- frame->s.file_needs_free = 1;
+ frame->s.file = mem_sys_strdup(name);
/* whitespace can be safely ignored */
do {
@@ -5609,7 +5595,7 @@
BEGIN(start_cond);
if (frame->expansion.num_param == 0 && m->params.num_param == 1) {
- frame->expansion.name[0] = str_dup("");
+ frame->expansion.name[0] = mem_sys_strdup("");
frame->expansion.num_param = 1;
}
@@ -5628,7 +5614,7 @@
const char * const s = find_macro_param(interp, current + 1);
if (s) {
- frame->expansion.name[i] = str_dup(s);
+ frame->expansion.name[i] = mem_sys_strdup(s);
mem_sys_free(current);
}
@@ -5651,6 +5637,7 @@
IMCC_INFO(interp)->line = m->line;
scan_string(frame, m->expansion, yyscanner);
+
return 1;
}
@@ -5667,12 +5654,16 @@
char *ext;
FILE *file;
- if (!s || !(file = fopen(s, "r")))
+ if (!s || !(file = fopen(s, "r"))) {
+ if (frame->s.file)
+ mem_sys_free(frame->s.file);
IMCC_fataly(interp, EXCEPTION_EXTERNAL_ERROR, strerror(errno));
+ }
+ if (frame->s.file)
+ mem_sys_free(frame->s.file);
mem_sys_free(s);
- frame->s.file = file_name;
- frame->s.file_needs_free = 0;
+ frame->s.file = mem_sys_strdup(file_name);
frame->s.handle = file;
ext = strrchr(file_name, '.');
@@ -5843,17 +5834,16 @@
set_filename(PARROT_INTERP, char * const filename)
{
IMCC_INFO(interp)->frames->s.file = filename;
- IMCC_INFO(interp)->frames->s.file_needs_free = 1;
/* in case .line is used outside a .sub, then this
* can't be done; hence the check.
- * The str_dup() is done, as the original #line implementation
+ * The mem_sys_strdup() is done, as the original #line implementation
* duplicated the string twice as well; one for the
* frames->s.file and one for cur_unit->file.
- * During the parse, the STRINGC is already str_dup()ed once.
+ * During the parse, the STRINGC is already mem_sys_strdup()ed once.
*/
if (IMCC_INFO(interp)->cur_unit)
- IMCC_INFO(interp)->cur_unit->file = str_dup(filename);
+ IMCC_INFO(interp)->cur_unit->file = mem_sys_strdup(filename);
}
/* Functions to set and get yyin, as we can't decorate it for export
Modified: branches/io_cleanups/compilers/imcc/imcparser.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/imcparser.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/imcparser.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -366,45 +366,49 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void add_pcc_named_arg(PARROT_INTERP,
+static void add_pcc_named_arg(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
-static void add_pcc_named_arg_var(PARROT_INTERP,
+static void add_pcc_named_arg_var(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
-static void add_pcc_named_param(PARROT_INTERP,
+static void add_pcc_named_param(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
-static void add_pcc_named_result(PARROT_INTERP,
+static void add_pcc_named_result(
ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cur_call);
+ FUNC_MODIFIES(*cur_call)
+ FUNC_MODIFIES(*name)
+ FUNC_MODIFIES(*value);
static void add_pcc_named_return(PARROT_INTERP,
ARGMOD(SymReg *cur_call),
@@ -563,23 +567,19 @@
FUNC_MODIFIES(*name);
#define ASSERT_ARGS_add_pcc_named_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_arg_var __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_param __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_result __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(cur_call) \
+ PARROT_ASSERT_ARG(cur_call) \
|| PARROT_ASSERT_ARG(name) \
|| PARROT_ASSERT_ARG(value)
#define ASSERT_ARGS_add_pcc_named_return __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -761,11 +761,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- name = str_dup(constant + 1);
+ name = mem_sys_strdup(constant + 1);
name[strlen(name) - 1] = 0;
}
else {
- name = str_dup(constant);
+ name = mem_sys_strdup(constant);
}
switch (type_enum) {
@@ -811,7 +811,7 @@
SymReg *r[3];
char *const_name;
const int ascii = (*constant == '\'' || *constant == '"');
- char *unquoted_name = str_dup(name + 1);
+ char *unquoted_name = mem_sys_strdup(name + 1);
size_t name_length = strlen(unquoted_name) - 1;
unquoted_name[name_length] = 0;
@@ -828,11 +828,11 @@
r[0] = left;
if (ascii) {
/* strip delimiters */
- const_name = str_dup(constant + 1);
+ const_name = mem_sys_strdup(constant + 1);
const_name[strlen(const_name) - 1] = 0;
}
else {
- const_name = str_dup(constant);
+ const_name = mem_sys_strdup(constant);
}
if ((strncmp(unquoted_name, "Sub", name_length) == 0)
@@ -1083,7 +1083,7 @@
ASSERT_ARGS(mk_sub_address_fromc)
/* name is a quoted sub name */
SymReg *r;
- char *name_copy = str_dup(name + 1);
+ char *name_copy = mem_sys_strdup(name + 1);
name_copy[strlen(name_copy) - 1] = 0;
r = mk_sub_address(interp, name_copy);
@@ -1199,17 +1199,17 @@
/*
-=item C<static void add_pcc_named_arg(PARROT_INTERP, SymReg *cur_call, SymReg
-*name, SymReg *value)>
+=item C<static void add_pcc_named_arg(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_arg(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+add_pcc_named_arg(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_arg)
name->type |= VT_NAMED;
@@ -1220,16 +1220,16 @@
/*
-=item C<static void add_pcc_named_arg_var(PARROT_INTERP, SymReg *cur_call,
-SymReg *name, SymReg *value)>
+=item C<static void add_pcc_named_arg_var(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_arg_var(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name), ARGIN(SymReg *value))
+add_pcc_named_arg_var(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name), ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_arg_var)
name->type |= VT_NAMED;
@@ -1239,17 +1239,17 @@
/*
-=item C<static void add_pcc_named_result(PARROT_INTERP, SymReg *cur_call, SymReg
-*name, SymReg *value)>
+=item C<static void add_pcc_named_result(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_result(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+add_pcc_named_result(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_result)
name->type |= VT_NAMED;
@@ -1260,17 +1260,17 @@
/*
-=item C<static void add_pcc_named_param(PARROT_INTERP, SymReg *cur_call, SymReg
-*name, SymReg *value)>
+=item C<static void add_pcc_named_param(SymReg *cur_call, SymReg *name, SymReg
+*value)>
=cut
*/
static void
-add_pcc_named_param(PARROT_INTERP, ARGMOD(SymReg *cur_call),
- ARGIN(SymReg *name),
- ARGIN(SymReg *value))
+add_pcc_named_param(ARGMOD(SymReg *cur_call),
+ ARGMOD(SymReg *name),
+ ARGMOD(SymReg *value))
{
ASSERT_ARGS(add_pcc_named_param)
name->type |= VT_NAMED;
@@ -1823,36 +1823,36 @@
1154, 1155, 1156, 1160, 1161, 1170, 1176, 1184, 1196, 1209,
1209, 1218, 1218, 1225, 1225, 1234, 1235, 1239, 1240, 1244,
1245, 1246, 1247, 1248, 1249, 1250, 1253, 1253, 1262, 1261,
- 1273, 1277, 1286, 1290, 1294, 1294, 1306, 1308, 1312, 1327,
- 1335, 1340, 1344, 1348, 1339, 1360, 1361, 1362, 1375, 1375,
- 1379, 1393, 1397, 1403, 1412, 1418, 1427, 1433, 1442, 1448,
- 1457, 1465, 1470, 1481, 1484, 1489, 1497, 1498, 1499, 1500,
- 1501, 1512, 1523, 1526, 1528, 1533, 1532, 1565, 1566, 1570,
- 1571, 1575, 1576, 1580, 1581, 1585, 1586, 1587, 1588, 1589,
- 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1602,
- 1607, 1611, 1616, 1620, 1624, 1629, 1638, 1639, 1643, 1648,
- 1649, 1657, 1658, 1658, 1673, 1674, 1678, 1679, 1680, 1681,
- 1682, 1683, 1684, 1689, 1689, 1692, 1700, 1700, 1706, 1707,
- 1712, 1720, 1721, 1726, 1734, 1738, 1743, 1742, 1755, 1756,
- 1760, 1761, 1771, 1776, 1786, 1795, 1796, 1808, 1812, 1814,
- 1815, 1816, 1817, 1818, 1822, 1823, 1827, 1828, 1832, 1843,
- 1844, 1855, 1862, 1871, 1881, 1882, 1887, 1888, 1889, 1889,
- 1905, 1911, 1917, 1917, 1924, 1925, 1925, 1931, 1937, 1941,
- 1953, 1954, 1955, 1956, 1957, 1958, 1962, 1963, 1964, 1965,
- 1969, 1982, 1984, 1986, 1988, 1990, 1995, 1998, 2005, 2004,
- 2013, 2014, 2015, 2016, 2024, 2025, 2026, 2030, 2031, 2032,
- 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042,
- 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052,
- 2058, 2057, 2069, 2076, 2077, 2078, 2079, 2080, 2081, 2082,
- 2083, 2084, 2085, 2086, 2087, 2088, 2093, 2104, 2105, 2106,
- 2107, 2113, 2127, 2133, 2139, 2145, 2144, 2153, 2154, 2164,
- 2174, 2181, 2186, 2196, 2200, 2201, 2205, 2206, 2209, 2210,
- 2214, 2218, 2228, 2234, 2244, 2249, 2253, 2254, 2258, 2262,
- 2266, 2273, 2277, 2281, 2288, 2289, 2293, 2294, 2295, 2296,
- 2297, 2298, 2302, 2303, 2307, 2308, 2312, 2313, 2317, 2318,
- 2325, 2332, 2333, 2334, 2338, 2339, 2343, 2344, 2348, 2349,
- 2353, 2354, 2358, 2358, 2371, 2371, 2384, 2385, 2393, 2402,
- 2403, 2404, 2405, 2406, 2410, 2411, 2412, 2413
+ 1274, 1278, 1287, 1291, 1295, 1295, 1307, 1309, 1313, 1328,
+ 1336, 1341, 1345, 1349, 1340, 1361, 1362, 1363, 1376, 1376,
+ 1380, 1394, 1398, 1404, 1413, 1419, 1428, 1434, 1443, 1449,
+ 1458, 1466, 1471, 1482, 1485, 1490, 1498, 1499, 1500, 1501,
+ 1502, 1513, 1524, 1527, 1529, 1534, 1533, 1566, 1567, 1571,
+ 1572, 1576, 1577, 1581, 1582, 1586, 1587, 1588, 1589, 1590,
+ 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1603,
+ 1608, 1612, 1617, 1621, 1625, 1630, 1639, 1640, 1644, 1649,
+ 1650, 1658, 1659, 1659, 1674, 1675, 1679, 1680, 1681, 1682,
+ 1683, 1684, 1685, 1690, 1690, 1693, 1701, 1701, 1707, 1708,
+ 1713, 1721, 1722, 1727, 1735, 1739, 1744, 1743, 1756, 1757,
+ 1761, 1762, 1772, 1777, 1787, 1796, 1797, 1809, 1813, 1815,
+ 1816, 1817, 1818, 1819, 1823, 1824, 1828, 1829, 1833, 1844,
+ 1845, 1856, 1863, 1872, 1882, 1883, 1888, 1889, 1890, 1890,
+ 1906, 1912, 1918, 1918, 1925, 1926, 1926, 1932, 1938, 1942,
+ 1954, 1955, 1956, 1957, 1958, 1959, 1963, 1964, 1965, 1966,
+ 1970, 1983, 1985, 1987, 1989, 1991, 1996, 1999, 2006, 2005,
+ 2014, 2015, 2016, 2017, 2025, 2026, 2027, 2031, 2032, 2033,
+ 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043,
+ 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053,
+ 2059, 2058, 2070, 2077, 2078, 2079, 2080, 2081, 2082, 2083,
+ 2084, 2085, 2086, 2087, 2088, 2089, 2094, 2105, 2106, 2107,
+ 2108, 2114, 2128, 2134, 2140, 2146, 2145, 2154, 2155, 2165,
+ 2175, 2182, 2187, 2197, 2201, 2202, 2206, 2207, 2210, 2211,
+ 2215, 2219, 2229, 2235, 2245, 2250, 2254, 2255, 2259, 2263,
+ 2267, 2274, 2278, 2282, 2289, 2290, 2294, 2295, 2296, 2297,
+ 2298, 2299, 2303, 2304, 2308, 2309, 2313, 2314, 2318, 2319,
+ 2326, 2333, 2334, 2335, 2339, 2340, 2344, 2345, 2349, 2350,
+ 2354, 2355, 2359, 2359, 2372, 2372, 2385, 2386, 2394, 2403,
+ 2404, 2405, 2406, 2407, 2411, 2412, 2413, 2414
};
#endif
@@ -3411,18 +3411,19 @@
IMCC_INFO(interp)->cur_unit,
mk_sub_label(interp, (yyvsp[(4) - (4)].s)));
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(3) - (4)].t);
+ mem_sys_free((yyvsp[(4) - (4)].s));
}
break;
case 40:
-#line 1274 "compilers/imcc/imcc.y"
+#line 1275 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr));
}
break;
case 41:
-#line 1278 "compilers/imcc/imcc.y"
+#line 1279 "compilers/imcc/imcc.y"
{
SymReg *r = mk_pasm_reg(interp, (yyvsp[(4) - (4)].s));
SymReg *n = mk_const(interp, (yyvsp[(2) - (4)].s), 'S');
@@ -3434,17 +3435,17 @@
break;
case 42:
-#line 1286 "compilers/imcc/imcc.y"
+#line 1287 "compilers/imcc/imcc.y"
{ (yyval.i) = 0;}
break;
case 44:
-#line 1294 "compilers/imcc/imcc.y"
+#line 1295 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); }
break;
case 45:
-#line 1297 "compilers/imcc/imcc.y"
+#line 1298 "compilers/imcc/imcc.y"
{
/* if (optimizer_level & OPT_PASM)
imc_compile_unit(interp, IMCC_INFO(interp)->cur_unit);
@@ -3455,7 +3456,7 @@
break;
case 48:
-#line 1313 "compilers/imcc/imcc.y"
+#line 1314 "compilers/imcc/imcc.y"
{
int re_open = 0;
(yyval.i) = 0;
@@ -3470,7 +3471,7 @@
break;
case 49:
-#line 1328 "compilers/imcc/imcc.y"
+#line 1329 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->in_slice)
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -3481,55 +3482,55 @@
break;
case 50:
-#line 1335 "compilers/imcc/imcc.y"
+#line 1336 "compilers/imcc/imcc.y"
{ (yyval.sr) = NULL; }
break;
case 51:
-#line 1340 "compilers/imcc/imcc.y"
+#line 1341 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PCCSUB);
}
break;
case 52:
-#line 1344 "compilers/imcc/imcc.y"
+#line 1345 "compilers/imcc/imcc.y"
{
iSUBROUTINE(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (3)].sr));
}
break;
case 53:
-#line 1348 "compilers/imcc/imcc.y"
+#line 1349 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(5) - (6)].t);
if (!IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid) {
- IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = str_dup(
+ IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = mem_sys_strdup(
IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->name);
}
}
break;
case 54:
-#line 1356 "compilers/imcc/imcc.y"
+#line 1357 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 55:
-#line 1360 "compilers/imcc/imcc.y"
+#line 1361 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 56:
-#line 1361 "compilers/imcc/imcc.y"
+#line 1362 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 57:
-#line 1363 "compilers/imcc/imcc.y"
+#line 1364 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_param(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_param(IMCC_INFO(interp)->cur_call,
IMCC_INFO(interp)->adv_named_id, (yyvsp[(2) - (3)].sr));
IMCC_INFO(interp)->adv_named_id = NULL;
}
@@ -3539,17 +3540,17 @@
break;
case 58:
-#line 1375 "compilers/imcc/imcc.y"
+#line 1376 "compilers/imcc/imcc.y"
{ pesky_global__is_def=1; }
break;
case 59:
-#line 1375 "compilers/imcc/imcc.y"
+#line 1376 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(3) - (3)].sr); pesky_global__is_def=0; }
break;
case 60:
-#line 1380 "compilers/imcc/imcc.y"
+#line 1381 "compilers/imcc/imcc.y"
{
if ((yyvsp[(3) - (3)].t) & VT_UNIQUE_REG)
(yyval.sr) = mk_ident_ur(interp, (yyvsp[(2) - (3)].s), (yyvsp[(1) - (3)].t));
@@ -3561,12 +3562,12 @@
break;
case 61:
-#line 1393 "compilers/imcc/imcc.y"
+#line 1394 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 62:
-#line 1398 "compilers/imcc/imcc.y"
+#line 1399 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->outer = mk_sub_address_fromc(interp, (yyvsp[(3) - (4)].s));
@@ -3575,7 +3576,7 @@
break;
case 63:
-#line 1404 "compilers/imcc/imcc.y"
+#line 1405 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->outer = mk_const(interp, (yyvsp[(3) - (4)].s), 'S');
@@ -3584,7 +3585,7 @@
break;
case 64:
-#line 1413 "compilers/imcc/imcc.y"
+#line 1414 "compilers/imcc/imcc.y"
{
(yyval.t) = P_VTABLE;
IMCC_INFO(interp)->cur_unit->vtable_name = NULL;
@@ -3593,7 +3594,7 @@
break;
case 65:
-#line 1419 "compilers/imcc/imcc.y"
+#line 1420 "compilers/imcc/imcc.y"
{
(yyval.t) = P_VTABLE;
IMCC_INFO(interp)->cur_unit->vtable_name = (yyvsp[(3) - (4)].s);
@@ -3602,7 +3603,7 @@
break;
case 66:
-#line 1428 "compilers/imcc/imcc.y"
+#line 1429 "compilers/imcc/imcc.y"
{
(yyval.t) = P_METHOD;
IMCC_INFO(interp)->cur_unit->method_name = NULL;
@@ -3611,7 +3612,7 @@
break;
case 67:
-#line 1434 "compilers/imcc/imcc.y"
+#line 1435 "compilers/imcc/imcc.y"
{
(yyval.t) = P_METHOD;
IMCC_INFO(interp)->cur_unit->method_name = (yyvsp[(3) - (4)].s);
@@ -3620,7 +3621,7 @@
break;
case 68:
-#line 1443 "compilers/imcc/imcc.y"
+#line 1444 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->ns_entry_name = NULL;
@@ -3629,7 +3630,7 @@
break;
case 69:
-#line 1449 "compilers/imcc/imcc.y"
+#line 1450 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->ns_entry_name = (yyvsp[(3) - (4)].s);
@@ -3638,7 +3639,7 @@
break;
case 70:
-#line 1458 "compilers/imcc/imcc.y"
+#line 1459 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->instance_of = (yyvsp[(3) - (4)].s);
@@ -3646,7 +3647,7 @@
break;
case 71:
-#line 1466 "compilers/imcc/imcc.y"
+#line 1467 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->subid = NULL;
@@ -3654,7 +3655,7 @@
break;
case 72:
-#line 1471 "compilers/imcc/imcc.y"
+#line 1472 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
IMCC_INFO(interp)->cur_unit->subid = mk_const(interp, (yyvsp[(3) - (4)].s), 'S');
@@ -3664,14 +3665,14 @@
break;
case 73:
-#line 1481 "compilers/imcc/imcc.y"
+#line 1482 "compilers/imcc/imcc.y"
{
add_pcc_multi(IMCC_INFO(interp)->cur_call, NULL);
}
break;
case 74:
-#line 1485 "compilers/imcc/imcc.y"
+#line 1486 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
add_pcc_multi(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr));
@@ -3679,7 +3680,7 @@
break;
case 75:
-#line 1490 "compilers/imcc/imcc.y"
+#line 1491 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
add_pcc_multi(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr));
@@ -3687,27 +3688,27 @@
break;
case 76:
-#line 1497 "compilers/imcc/imcc.y"
+#line 1498 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "INTVAL", 'S'); }
break;
case 77:
-#line 1498 "compilers/imcc/imcc.y"
+#line 1499 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); }
break;
case 78:
-#line 1499 "compilers/imcc/imcc.y"
+#line 1500 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "PMC", 'S'); }
break;
case 79:
-#line 1500 "compilers/imcc/imcc.y"
+#line 1501 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "STRING", 'S'); }
break;
case 80:
-#line 1502 "compilers/imcc/imcc.y"
+#line 1503 "compilers/imcc/imcc.y"
{
SymReg *r;
if (strcmp((yyvsp[(1) - (1)].s), "_") != 0)
@@ -3721,7 +3722,7 @@
break;
case 81:
-#line 1513 "compilers/imcc/imcc.y"
+#line 1514 "compilers/imcc/imcc.y"
{
SymReg *r;
if (strcmp((yyvsp[(1) - (1)].s), "_") != 0)
@@ -3735,12 +3736,12 @@
break;
case 82:
-#line 1523 "compilers/imcc/imcc.y"
+#line 1524 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); }
break;
case 85:
-#line 1533 "compilers/imcc/imcc.y"
+#line 1534 "compilers/imcc/imcc.y"
{
char name[128];
SymReg *r, *r1;
@@ -3767,82 +3768,82 @@
break;
case 86:
-#line 1561 "compilers/imcc/imcc.y"
+#line 1562 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 87:
-#line 1565 "compilers/imcc/imcc.y"
+#line 1566 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; }
break;
case 88:
-#line 1566 "compilers/imcc/imcc.y"
+#line 1567 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; }
break;
case 89:
-#line 1570 "compilers/imcc/imcc.y"
+#line 1571 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; }
break;
case 90:
-#line 1571 "compilers/imcc/imcc.y"
+#line 1572 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); }
break;
case 91:
-#line 1575 "compilers/imcc/imcc.y"
+#line 1576 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 93:
-#line 1580 "compilers/imcc/imcc.y"
+#line 1581 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (1)].t); }
break;
case 94:
-#line 1581 "compilers/imcc/imcc.y"
+#line 1582 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 95:
-#line 1585 "compilers/imcc/imcc.y"
+#line 1586 "compilers/imcc/imcc.y"
{ (yyval.t) = P_LOAD; }
break;
case 96:
-#line 1586 "compilers/imcc/imcc.y"
+#line 1587 "compilers/imcc/imcc.y"
{ (yyval.t) = P_INIT; }
break;
case 97:
-#line 1587 "compilers/imcc/imcc.y"
+#line 1588 "compilers/imcc/imcc.y"
{ (yyval.t) = P_MAIN; }
break;
case 98:
-#line 1588 "compilers/imcc/imcc.y"
+#line 1589 "compilers/imcc/imcc.y"
{ (yyval.t) = P_IMMEDIATE; }
break;
case 99:
-#line 1589 "compilers/imcc/imcc.y"
+#line 1590 "compilers/imcc/imcc.y"
{ (yyval.t) = P_POSTCOMP; }
break;
case 100:
-#line 1590 "compilers/imcc/imcc.y"
+#line 1591 "compilers/imcc/imcc.y"
{ (yyval.t) = P_ANON; }
break;
case 101:
-#line 1591 "compilers/imcc/imcc.y"
+#line 1592 "compilers/imcc/imcc.y"
{ (yyval.t) = P_NEED_LEX; }
break;
case 109:
-#line 1603 "compilers/imcc/imcc.y"
+#line 1604 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr));
@@ -3850,14 +3851,14 @@
break;
case 110:
-#line 1608 "compilers/imcc/imcc.y"
+#line 1609 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
}
break;
case 111:
-#line 1612 "compilers/imcc/imcc.y"
+#line 1613 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
IMCC_INFO(interp)->cur_call->pcc_sub->flags |= isNCI;
@@ -3865,21 +3866,21 @@
break;
case 112:
-#line 1617 "compilers/imcc/imcc.y"
+#line 1618 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
}
break;
case 113:
-#line 1621 "compilers/imcc/imcc.y"
+#line 1622 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (3)].s), 'S'));
}
break;
case 114:
-#line 1625 "compilers/imcc/imcc.y"
+#line 1626 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr));
@@ -3887,7 +3888,7 @@
break;
case 115:
-#line 1630 "compilers/imcc/imcc.y"
+#line 1631 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (5)].s), 'S'));
add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr));
@@ -3895,27 +3896,27 @@
break;
case 116:
-#line 1638 "compilers/imcc/imcc.y"
+#line 1639 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 117:
-#line 1639 "compilers/imcc/imcc.y"
+#line 1640 "compilers/imcc/imcc.y"
{ add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); }
break;
case 118:
-#line 1643 "compilers/imcc/imcc.y"
+#line 1644 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (2)].sr); }
break;
case 119:
-#line 1648 "compilers/imcc/imcc.y"
+#line 1649 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 120:
-#line 1650 "compilers/imcc/imcc.y"
+#line 1651 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3923,19 +3924,19 @@
break;
case 121:
-#line 1657 "compilers/imcc/imcc.y"
+#line 1658 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 122:
-#line 1658 "compilers/imcc/imcc.y"
+#line 1659 "compilers/imcc/imcc.y"
{ pesky_global__is_def=1; }
break;
case 123:
-#line 1659 "compilers/imcc/imcc.y"
+#line 1660 "compilers/imcc/imcc.y"
{
- IdList *l = (yyvsp[(4) - (4)].idlist);
+ IdList * const l = (yyvsp[(4) - (4)].idlist);
SymReg *ignored;
if (l->unique_reg)
ignored = mk_ident_ur(interp, l->id, (yyvsp[(3) - (4)].t));
@@ -3948,62 +3949,62 @@
break;
case 124:
-#line 1673 "compilers/imcc/imcc.y"
+#line 1674 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 125:
-#line 1674 "compilers/imcc/imcc.y"
+#line 1675 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 126:
-#line 1678 "compilers/imcc/imcc.y"
+#line 1679 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_FLAT; }
break;
case 127:
-#line 1679 "compilers/imcc/imcc.y"
+#line 1680 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_OPTIONAL; }
break;
case 128:
-#line 1680 "compilers/imcc/imcc.y"
+#line 1681 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_OPT_FLAG; }
break;
case 129:
-#line 1681 "compilers/imcc/imcc.y"
+#line 1682 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_NAMED; }
break;
case 130:
-#line 1682 "compilers/imcc/imcc.y"
+#line 1683 "compilers/imcc/imcc.y"
{ adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); }
break;
case 131:
-#line 1683 "compilers/imcc/imcc.y"
+#line 1684 "compilers/imcc/imcc.y"
{ adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); }
break;
case 132:
-#line 1684 "compilers/imcc/imcc.y"
+#line 1685 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_UNIQUE_REG; }
break;
case 133:
-#line 1689 "compilers/imcc/imcc.y"
+#line 1690 "compilers/imcc/imcc.y"
{ begin_return_or_yield(interp, 0); }
break;
case 134:
-#line 1691 "compilers/imcc/imcc.y"
+#line 1692 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
break;
case 135:
-#line 1693 "compilers/imcc/imcc.y"
+#line 1694 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->asm_state = AsmDefault;
(yyval.i) = 0;
@@ -4011,22 +4012,22 @@
break;
case 136:
-#line 1700 "compilers/imcc/imcc.y"
+#line 1701 "compilers/imcc/imcc.y"
{ begin_return_or_yield(interp, 1); }
break;
case 137:
-#line 1702 "compilers/imcc/imcc.y"
+#line 1703 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
break;
case 138:
-#line 1706 "compilers/imcc/imcc.y"
+#line 1707 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 139:
-#line 1708 "compilers/imcc/imcc.y"
+#line 1709 "compilers/imcc/imcc.y"
{
if ((yyvsp[(1) - (2)].sr))
add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr));
@@ -4034,7 +4035,7 @@
break;
case 140:
-#line 1713 "compilers/imcc/imcc.y"
+#line 1714 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr));
@@ -4042,12 +4043,12 @@
break;
case 141:
-#line 1720 "compilers/imcc/imcc.y"
+#line 1721 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 142:
-#line 1722 "compilers/imcc/imcc.y"
+#line 1723 "compilers/imcc/imcc.y"
{
if ((yyvsp[(1) - (2)].sr))
add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr));
@@ -4055,7 +4056,7 @@
break;
case 143:
-#line 1727 "compilers/imcc/imcc.y"
+#line 1728 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr));
@@ -4063,17 +4064,17 @@
break;
case 144:
-#line 1734 "compilers/imcc/imcc.y"
+#line 1735 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 145:
-#line 1738 "compilers/imcc/imcc.y"
+#line 1739 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 146:
-#line 1743 "compilers/imcc/imcc.y"
+#line 1744 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->asm_state == AsmDefault)
begin_return_or_yield(interp, (yyvsp[(1) - (2)].t));
@@ -4081,7 +4082,7 @@
break;
case 147:
-#line 1748 "compilers/imcc/imcc.y"
+#line 1749 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->asm_state = AsmDefault;
(yyval.t) = 0;
@@ -4089,22 +4090,22 @@
break;
case 148:
-#line 1755 "compilers/imcc/imcc.y"
+#line 1756 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 149:
-#line 1756 "compilers/imcc/imcc.y"
+#line 1757 "compilers/imcc/imcc.y"
{ (yyval.t) = 1; }
break;
case 150:
-#line 1760 "compilers/imcc/imcc.y"
+#line 1761 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 151:
-#line 1762 "compilers/imcc/imcc.y"
+#line 1763 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return,
@@ -4117,7 +4118,7 @@
break;
case 152:
-#line 1772 "compilers/imcc/imcc.y"
+#line 1773 "compilers/imcc/imcc.y"
{
SymReg *name = mk_const(interp, (yyvsp[(1) - (3)].s), 'S');
add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return, name, (yyvsp[(3) - (3)].sr));
@@ -4125,7 +4126,7 @@
break;
case 153:
-#line 1777 "compilers/imcc/imcc.y"
+#line 1778 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return,
@@ -4138,7 +4139,7 @@
break;
case 154:
-#line 1787 "compilers/imcc/imcc.y"
+#line 1788 "compilers/imcc/imcc.y"
{
SymReg *name = mk_const(interp, (yyvsp[(3) - (5)].s), 'S');
add_pcc_named_return(interp, IMCC_INFO(interp)->sr_return, name, (yyvsp[(5) - (5)].sr));
@@ -4146,47 +4147,47 @@
break;
case 157:
-#line 1808 "compilers/imcc/imcc.y"
+#line 1809 "compilers/imcc/imcc.y"
{ clear_state(interp); }
break;
case 158:
-#line 1813 "compilers/imcc/imcc.y"
+#line 1814 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); }
break;
case 159:
-#line 1814 "compilers/imcc/imcc.y"
+#line 1815 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 160:
-#line 1815 "compilers/imcc/imcc.y"
+#line 1816 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 161:
-#line 1816 "compilers/imcc/imcc.y"
+#line 1817 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 162:
-#line 1817 "compilers/imcc/imcc.y"
+#line 1818 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 163:
-#line 1818 "compilers/imcc/imcc.y"
+#line 1819 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 164:
-#line 1822 "compilers/imcc/imcc.y"
+#line 1823 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; }
break;
case 168:
-#line 1833 "compilers/imcc/imcc.y"
+#line 1834 "compilers/imcc/imcc.y"
{
Instruction *i = iLABEL(interp, IMCC_INFO(interp)->cur_unit, mk_local_label(interp, (yyvsp[(1) - (1)].s)));
mem_sys_free((yyvsp[(1) - (1)].s));
@@ -4195,12 +4196,12 @@
break;
case 169:
-#line 1843 "compilers/imcc/imcc.y"
+#line 1844 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); }
break;
case 170:
-#line 1845 "compilers/imcc/imcc.y"
+#line 1846 "compilers/imcc/imcc.y"
{
if (yynerrs >= PARROT_MAX_RECOVER_ERRORS) {
IMCC_warning(interp, "Too many errors. Correct some first.\n");
@@ -4211,7 +4212,7 @@
break;
case 171:
-#line 1856 "compilers/imcc/imcc.y"
+#line 1857 "compilers/imcc/imcc.y"
{
IdList* l = (yyvsp[(1) - (1)].idlist);
l->next = NULL;
@@ -4220,7 +4221,7 @@
break;
case 172:
-#line 1863 "compilers/imcc/imcc.y"
+#line 1864 "compilers/imcc/imcc.y"
{
IdList* l = (yyvsp[(3) - (3)].idlist);
l->next = (yyvsp[(1) - (3)].idlist);
@@ -4229,7 +4230,7 @@
break;
case 173:
-#line 1872 "compilers/imcc/imcc.y"
+#line 1873 "compilers/imcc/imcc.y"
{
IdList* const l = mem_allocate_n_zeroed_typed(1, IdList);
l->id = (yyvsp[(1) - (2)].s);
@@ -4239,22 +4240,22 @@
break;
case 174:
-#line 1881 "compilers/imcc/imcc.y"
+#line 1882 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 175:
-#line 1882 "compilers/imcc/imcc.y"
+#line 1883 "compilers/imcc/imcc.y"
{ (yyval.t) = 1; }
break;
case 178:
-#line 1889 "compilers/imcc/imcc.y"
+#line 1890 "compilers/imcc/imcc.y"
{ pesky_global__is_def=1; }
break;
case 179:
-#line 1890 "compilers/imcc/imcc.y"
+#line 1891 "compilers/imcc/imcc.y"
{
IdList *l = (yyvsp[(4) - (4)].idlist);
while (l) {
@@ -4273,7 +4274,7 @@
break;
case 180:
-#line 1906 "compilers/imcc/imcc.y"
+#line 1907 "compilers/imcc/imcc.y"
{
SymReg *n = mk_const(interp, (yyvsp[(2) - (4)].s), 'S');
set_lexical(interp, (yyvsp[(4) - (4)].sr), n); (yyval.i) = 0;
@@ -4282,7 +4283,7 @@
break;
case 181:
-#line 1912 "compilers/imcc/imcc.y"
+#line 1913 "compilers/imcc/imcc.y"
{
SymReg *n = mk_const(interp, (yyvsp[(2) - (4)].s), 'U');
set_lexical(interp, (yyvsp[(4) - (4)].sr), n); (yyval.i) = 0;
@@ -4291,12 +4292,12 @@
break;
case 182:
-#line 1917 "compilers/imcc/imcc.y"
+#line 1918 "compilers/imcc/imcc.y"
{ pesky_global__is_def=1; }
break;
case 183:
-#line 1918 "compilers/imcc/imcc.y"
+#line 1919 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 0);
pesky_global__is_def=0;
@@ -4305,12 +4306,12 @@
break;
case 185:
-#line 1925 "compilers/imcc/imcc.y"
+#line 1926 "compilers/imcc/imcc.y"
{ pesky_global__is_def=1; }
break;
case 186:
-#line 1926 "compilers/imcc/imcc.y"
+#line 1927 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
pesky_global__is_def=0;
@@ -4319,7 +4320,7 @@
break;
case 187:
-#line 1932 "compilers/imcc/imcc.y"
+#line 1933 "compilers/imcc/imcc.y"
{
(yyval.i) = NULL;
IMCC_INFO(interp)->cur_call->pcc_sub->flags |= isTAIL_CALL;
@@ -4328,14 +4329,14 @@
break;
case 188:
-#line 1938 "compilers/imcc/imcc.y"
+#line 1939 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "branch", 1, (yyvsp[(2) - (2)].sr));
}
break;
case 189:
-#line 1942 "compilers/imcc/imcc.y"
+#line 1943 "compilers/imcc/imcc.y"
{
(yyval.i) = INS(interp,
IMCC_INFO(interp)->cur_unit,
@@ -4350,49 +4351,49 @@
break;
case 190:
-#line 1953 "compilers/imcc/imcc.y"
+#line 1954 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); }
break;
case 191:
-#line 1954 "compilers/imcc/imcc.y"
+#line 1955 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 192:
-#line 1955 "compilers/imcc/imcc.y"
+#line 1956 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 195:
-#line 1958 "compilers/imcc/imcc.y"
+#line 1959 "compilers/imcc/imcc.y"
{ (yyval.i) = 0;}
break;
case 196:
-#line 1962 "compilers/imcc/imcc.y"
+#line 1963 "compilers/imcc/imcc.y"
{ (yyval.t) = 'I'; }
break;
case 197:
-#line 1963 "compilers/imcc/imcc.y"
+#line 1964 "compilers/imcc/imcc.y"
{ (yyval.t) = 'N'; }
break;
case 198:
-#line 1964 "compilers/imcc/imcc.y"
+#line 1965 "compilers/imcc/imcc.y"
{ (yyval.t) = 'S'; }
break;
case 199:
-#line 1965 "compilers/imcc/imcc.y"
+#line 1966 "compilers/imcc/imcc.y"
{ (yyval.t) = 'P'; }
break;
case 200:
-#line 1970 "compilers/imcc/imcc.y"
+#line 1971 "compilers/imcc/imcc.y"
{
- /* there'd normally be a str_dup() here, but the lexer already
+ /* there'd normally be a mem_sys_strdup() here, but the lexer already
* copied the string, so it's safe to use directly */
if ((IMCC_INFO(interp)->cur_pmc_type = pmc_type(interp,
Parrot_str_new(interp, (yyvsp[(1) - (1)].s), 0))) <= 0) {
@@ -4403,37 +4404,37 @@
break;
case 201:
-#line 1983 "compilers/imcc/imcc.y"
+#line 1984 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "set", 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); }
break;
case 202:
-#line 1985 "compilers/imcc/imcc.y"
+#line 1986 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (4)].s), 2, (yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].sr)); }
break;
case 203:
-#line 1987 "compilers/imcc/imcc.y"
+#line 1988 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(4) - (5)].s), 3, (yyvsp[(1) - (5)].sr), (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); }
break;
case 204:
-#line 1989 "compilers/imcc/imcc.y"
+#line 1990 "compilers/imcc/imcc.y"
{ (yyval.i) = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(5) - (6)].sr)); }
break;
case 205:
-#line 1991 "compilers/imcc/imcc.y"
+#line 1992 "compilers/imcc/imcc.y"
{ (yyval.i) = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(6) - (6)].sr)); }
break;
case 206:
-#line 1996 "compilers/imcc/imcc.y"
+#line 1997 "compilers/imcc/imcc.y"
{ (yyval.i) = iNEW(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (7)].sr), (yyvsp[(4) - (7)].s), (yyvsp[(6) - (7)].sr), 1); }
break;
case 207:
-#line 1999 "compilers/imcc/imcc.y"
+#line 2000 "compilers/imcc/imcc.y"
{
add_pcc_result((yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr));
IMCC_INFO(interp)->cur_call = NULL;
@@ -4442,14 +4443,14 @@
break;
case 208:
-#line 2005 "compilers/imcc/imcc.y"
+#line 2006 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
}
break;
case 209:
-#line 2009 "compilers/imcc/imcc.y"
+#line 2010 "compilers/imcc/imcc.y"
{
IMCC_itcall_sub(interp, (yyvsp[(6) - (9)].sr));
IMCC_INFO(interp)->cur_call = NULL;
@@ -4457,144 +4458,144 @@
break;
case 213:
-#line 2017 "compilers/imcc/imcc.y"
+#line 2018 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(1) - (3)].sr));
}
break;
case 214:
-#line 2024 "compilers/imcc/imcc.y"
+#line 2025 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"not"; }
break;
case 215:
-#line 2025 "compilers/imcc/imcc.y"
+#line 2026 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bnot"; }
break;
case 216:
-#line 2026 "compilers/imcc/imcc.y"
+#line 2027 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"neg"; }
break;
case 217:
-#line 2030 "compilers/imcc/imcc.y"
+#line 2031 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"sub"; }
break;
case 218:
-#line 2031 "compilers/imcc/imcc.y"
+#line 2032 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"add"; }
break;
case 219:
-#line 2032 "compilers/imcc/imcc.y"
+#line 2033 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mul"; }
break;
case 220:
-#line 2033 "compilers/imcc/imcc.y"
+#line 2034 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"div"; }
break;
case 221:
-#line 2034 "compilers/imcc/imcc.y"
+#line 2035 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mod"; }
break;
case 222:
-#line 2035 "compilers/imcc/imcc.y"
+#line 2036 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"fdiv"; }
break;
case 223:
-#line 2036 "compilers/imcc/imcc.y"
+#line 2037 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"pow"; }
break;
case 224:
-#line 2037 "compilers/imcc/imcc.y"
+#line 2038 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"concat"; }
break;
case 225:
-#line 2038 "compilers/imcc/imcc.y"
+#line 2039 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"iseq"; }
break;
case 226:
-#line 2039 "compilers/imcc/imcc.y"
+#line 2040 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isne"; }
break;
case 227:
-#line 2040 "compilers/imcc/imcc.y"
+#line 2041 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isgt"; }
break;
case 228:
-#line 2041 "compilers/imcc/imcc.y"
+#line 2042 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isge"; }
break;
case 229:
-#line 2042 "compilers/imcc/imcc.y"
+#line 2043 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"islt"; }
break;
case 230:
-#line 2043 "compilers/imcc/imcc.y"
+#line 2044 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isle"; }
break;
case 231:
-#line 2044 "compilers/imcc/imcc.y"
+#line 2045 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shl"; }
break;
case 232:
-#line 2045 "compilers/imcc/imcc.y"
+#line 2046 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shr"; }
break;
case 233:
-#line 2046 "compilers/imcc/imcc.y"
+#line 2047 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lsr"; }
break;
case 234:
-#line 2047 "compilers/imcc/imcc.y"
+#line 2048 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"and"; }
break;
case 235:
-#line 2048 "compilers/imcc/imcc.y"
+#line 2049 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"or"; }
break;
case 236:
-#line 2049 "compilers/imcc/imcc.y"
+#line 2050 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"xor"; }
break;
case 237:
-#line 2050 "compilers/imcc/imcc.y"
+#line 2051 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"band"; }
break;
case 238:
-#line 2051 "compilers/imcc/imcc.y"
+#line 2052 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bor"; }
break;
case 239:
-#line 2052 "compilers/imcc/imcc.y"
+#line 2053 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bxor"; }
break;
case 240:
-#line 2058 "compilers/imcc/imcc.y"
+#line 2059 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
(yyval.i)->type &= ~ITCALL;
@@ -4603,84 +4604,84 @@
break;
case 241:
-#line 2063 "compilers/imcc/imcc.y"
+#line 2064 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 242:
-#line 2070 "compilers/imcc/imcc.y"
+#line 2071 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(2) - (3)].s), 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr));
}
break;
case 243:
-#line 2076 "compilers/imcc/imcc.y"
+#line 2077 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"add"; }
break;
case 244:
-#line 2077 "compilers/imcc/imcc.y"
+#line 2078 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"sub"; }
break;
case 245:
-#line 2078 "compilers/imcc/imcc.y"
+#line 2079 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mul"; }
break;
case 246:
-#line 2079 "compilers/imcc/imcc.y"
+#line 2080 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"div"; }
break;
case 247:
-#line 2080 "compilers/imcc/imcc.y"
+#line 2081 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mod"; }
break;
case 248:
-#line 2081 "compilers/imcc/imcc.y"
+#line 2082 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"fdiv"; }
break;
case 249:
-#line 2082 "compilers/imcc/imcc.y"
+#line 2083 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"concat"; }
break;
case 250:
-#line 2083 "compilers/imcc/imcc.y"
+#line 2084 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"band"; }
break;
case 251:
-#line 2084 "compilers/imcc/imcc.y"
+#line 2085 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bor"; }
break;
case 252:
-#line 2085 "compilers/imcc/imcc.y"
+#line 2086 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bxor"; }
break;
case 253:
-#line 2086 "compilers/imcc/imcc.y"
+#line 2087 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shr"; }
break;
case 254:
-#line 2087 "compilers/imcc/imcc.y"
+#line 2088 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shl"; }
break;
case 255:
-#line 2088 "compilers/imcc/imcc.y"
+#line 2089 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lsr"; }
break;
case 256:
-#line 2094 "compilers/imcc/imcc.y"
+#line 2095 "compilers/imcc/imcc.y"
{
(yyval.i) = func_ins(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].s),
IMCC_INFO(interp) -> regs,
@@ -4691,22 +4692,22 @@
break;
case 257:
-#line 2104 "compilers/imcc/imcc.y"
+#line 2105 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 258:
-#line 2105 "compilers/imcc/imcc.y"
+#line 2106 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 259:
-#line 2106 "compilers/imcc/imcc.y"
+#line 2107 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 260:
-#line 2108 "compilers/imcc/imcc.y"
+#line 2109 "compilers/imcc/imcc.y"
{
(yyval.sr) = (yyvsp[(1) - (1)].sr);
if ((yyvsp[(1) - (1)].sr)->set != 'P')
@@ -4715,10 +4716,10 @@
break;
case 261:
-#line 2114 "compilers/imcc/imcc.y"
+#line 2115 "compilers/imcc/imcc.y"
{
/* disallow bareword method names; SREG name constants are fine */
- char *name = (yyvsp[(3) - (3)].sr)->name;
+ const char * const name = (yyvsp[(3) - (3)].sr)->name;
if (!((yyvsp[(3) - (3)].sr)->type & VTREG)) {
if (*name != '\'' || *name != '\"')
IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR,
@@ -4732,7 +4733,7 @@
break;
case 262:
-#line 2128 "compilers/imcc/imcc.y"
+#line 2129 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
(yyval.sr) = mk_const(interp, (yyvsp[(3) - (3)].s), 'U');
@@ -4741,7 +4742,7 @@
break;
case 263:
-#line 2134 "compilers/imcc/imcc.y"
+#line 2135 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
(yyval.sr) = mk_const(interp, (yyvsp[(3) - (3)].s), 'S');
@@ -4750,12 +4751,12 @@
break;
case 264:
-#line 2139 "compilers/imcc/imcc.y"
+#line 2140 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); }
break;
case 265:
-#line 2145 "compilers/imcc/imcc.y"
+#line 2146 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
IMCC_itcall_sub(interp, (yyvsp[(1) - (1)].sr));
@@ -4763,21 +4764,21 @@
break;
case 266:
-#line 2149 "compilers/imcc/imcc.y"
+#line 2150 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (5)].i); }
break;
case 267:
-#line 2153 "compilers/imcc/imcc.y"
+#line 2154 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 268:
-#line 2155 "compilers/imcc/imcc.y"
+#line 2156 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -4786,11 +4787,11 @@
break;
case 269:
-#line 2165 "compilers/imcc/imcc.y"
+#line 2166 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -4799,79 +4800,79 @@
break;
case 270:
-#line 2175 "compilers/imcc/imcc.y"
+#line 2176 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr));
mem_sys_free((yyvsp[(3) - (5)].s));
}
break;
case 271:
-#line 2182 "compilers/imcc/imcc.y"
+#line 2183 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
- add_pcc_named_arg_var(interp, IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr));
+ add_pcc_named_arg_var(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr));
}
break;
case 272:
-#line 2187 "compilers/imcc/imcc.y"
+#line 2188 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
- add_pcc_named_arg(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_arg(IMCC_INFO(interp)->cur_call,
mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
mem_sys_free((yyvsp[(1) - (3)].s));
}
break;
case 273:
-#line 2196 "compilers/imcc/imcc.y"
+#line 2197 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
break;
case 274:
-#line 2200 "compilers/imcc/imcc.y"
+#line 2201 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 275:
-#line 2201 "compilers/imcc/imcc.y"
+#line 2202 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 276:
-#line 2205 "compilers/imcc/imcc.y"
+#line 2206 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_FLAT; }
break;
case 277:
-#line 2206 "compilers/imcc/imcc.y"
+#line 2207 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_NAMED; }
break;
case 278:
-#line 2209 "compilers/imcc/imcc.y"
+#line 2210 "compilers/imcc/imcc.y"
{ adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
break;
case 279:
-#line 2210 "compilers/imcc/imcc.y"
+#line 2211 "compilers/imcc/imcc.y"
{ adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
break;
case 280:
-#line 2214 "compilers/imcc/imcc.y"
+#line 2215 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
break;
case 281:
-#line 2219 "compilers/imcc/imcc.y"
+#line 2220 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(3) - (3)].sr));
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -4880,20 +4881,20 @@
break;
case 282:
-#line 2229 "compilers/imcc/imcc.y"
+#line 2230 "compilers/imcc/imcc.y"
{
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call,
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call,
mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr));
mem_sys_free((yyvsp[(3) - (5)].s));
}
break;
case 283:
-#line 2235 "compilers/imcc/imcc.y"
+#line 2236 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
if (IMCC_INFO(interp)->adv_named_id) {
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call, IMCC_INFO(interp)->adv_named_id, (yyvsp[(1) - (1)].sr));
IMCC_INFO(interp)->adv_named_id = NULL;
}
else
@@ -4902,132 +4903,132 @@
break;
case 284:
-#line 2245 "compilers/imcc/imcc.y"
+#line 2246 "compilers/imcc/imcc.y"
{
- add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
+ add_pcc_named_result(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
mem_sys_free((yyvsp[(1) - (3)].s));
}
break;
case 285:
-#line 2249 "compilers/imcc/imcc.y"
+#line 2250 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 286:
-#line 2253 "compilers/imcc/imcc.y"
+#line 2254 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 287:
-#line 2254 "compilers/imcc/imcc.y"
+#line 2255 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 288:
-#line 2259 "compilers/imcc/imcc.y"
+#line 2260 "compilers/imcc/imcc.y"
{
(yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, inv_op((yyvsp[(3) - (6)].s)), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr));
}
break;
case 289:
-#line 2263 "compilers/imcc/imcc.y"
+#line 2264 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr));
}
break;
case 290:
-#line 2267 "compilers/imcc/imcc.y"
+#line 2268 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
}
break;
case 291:
-#line 2274 "compilers/imcc/imcc.y"
+#line 2275 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
}
break;
case 292:
-#line 2278 "compilers/imcc/imcc.y"
+#line 2279 "compilers/imcc/imcc.y"
{
(yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr));
}
break;
case 293:
-#line 2282 "compilers/imcc/imcc.y"
+#line 2283 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr));
}
break;
case 294:
-#line 2288 "compilers/imcc/imcc.y"
+#line 2289 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 295:
-#line 2289 "compilers/imcc/imcc.y"
+#line 2290 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 296:
-#line 2293 "compilers/imcc/imcc.y"
+#line 2294 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"eq"; }
break;
case 297:
-#line 2294 "compilers/imcc/imcc.y"
+#line 2295 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"ne"; }
break;
case 298:
-#line 2295 "compilers/imcc/imcc.y"
+#line 2296 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"gt"; }
break;
case 299:
-#line 2296 "compilers/imcc/imcc.y"
+#line 2297 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"ge"; }
break;
case 300:
-#line 2297 "compilers/imcc/imcc.y"
+#line 2298 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lt"; }
break;
case 301:
-#line 2298 "compilers/imcc/imcc.y"
+#line 2299 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"le"; }
break;
case 304:
-#line 2307 "compilers/imcc/imcc.y"
+#line 2308 "compilers/imcc/imcc.y"
{ (yyval.sr) = NULL; }
break;
case 305:
-#line 2308 "compilers/imcc/imcc.y"
+#line 2309 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (1)].sr); }
break;
case 306:
-#line 2312 "compilers/imcc/imcc.y"
+#line 2313 "compilers/imcc/imcc.y"
{ (yyval.sr) = IMCC_INFO(interp)->regs[0]; }
break;
case 308:
-#line 2317 "compilers/imcc/imcc.y"
+#line 2318 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); }
break;
case 309:
-#line 2319 "compilers/imcc/imcc.y"
+#line 2320 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (4)].sr);
IMCC_INFO(interp) -> keyvec |= KEY_BIT(IMCC_INFO(interp)->nargs);
@@ -5037,7 +5038,7 @@
break;
case 310:
-#line 2326 "compilers/imcc/imcc.y"
+#line 2327 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(2) - (3)].sr);
(yyval.sr) = (yyvsp[(2) - (3)].sr);
@@ -5045,37 +5046,37 @@
break;
case 312:
-#line 2333 "compilers/imcc/imcc.y"
+#line 2334 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 313:
-#line 2334 "compilers/imcc/imcc.y"
+#line 2335 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 314:
-#line 2338 "compilers/imcc/imcc.y"
+#line 2339 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 315:
-#line 2339 "compilers/imcc/imcc.y"
+#line 2340 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 316:
-#line 2343 "compilers/imcc/imcc.y"
+#line 2344 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 317:
-#line 2344 "compilers/imcc/imcc.y"
+#line 2345 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 322:
-#line 2358 "compilers/imcc/imcc.y"
+#line 2359 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
IMCC_INFO(interp)->in_slice = 0;
@@ -5083,7 +5084,7 @@
break;
case 323:
-#line 2363 "compilers/imcc/imcc.y"
+#line 2364 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
IMCC_INFO(interp)->nkeys,
@@ -5092,7 +5093,7 @@
break;
case 324:
-#line 2371 "compilers/imcc/imcc.y"
+#line 2372 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
IMCC_INFO(interp)->in_slice = 0;
@@ -5100,7 +5101,7 @@
break;
case 325:
-#line 2376 "compilers/imcc/imcc.y"
+#line 2377 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
IMCC_INFO(interp)->nkeys,
@@ -5109,12 +5110,12 @@
break;
case 326:
-#line 2384 "compilers/imcc/imcc.y"
+#line 2385 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); }
break;
case 327:
-#line 2386 "compilers/imcc/imcc.y"
+#line 2387 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr);
(yyval.sr) = IMCC_INFO(interp)->keys[0];
@@ -5122,7 +5123,7 @@
break;
case 328:
-#line 2394 "compilers/imcc/imcc.y"
+#line 2395 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->in_slice)
(yyvsp[(1) - (1)].sr)->type |= VT_START_SLICE | VT_END_SLICE;
@@ -5131,53 +5132,53 @@
break;
case 329:
-#line 2402 "compilers/imcc/imcc.y"
+#line 2403 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); }
break;
case 330:
-#line 2403 "compilers/imcc/imcc.y"
+#line 2404 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); }
break;
case 331:
-#line 2404 "compilers/imcc/imcc.y"
+#line 2405 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); }
break;
case 332:
-#line 2405 "compilers/imcc/imcc.y"
+#line 2406 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); }
break;
case 333:
-#line 2406 "compilers/imcc/imcc.y"
+#line 2407 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_pasm_reg(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 334:
-#line 2410 "compilers/imcc/imcc.y"
+#line 2411 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 335:
-#line 2411 "compilers/imcc/imcc.y"
+#line 2412 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 336:
-#line 2412 "compilers/imcc/imcc.y"
+#line 2413 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 337:
-#line 2413 "compilers/imcc/imcc.y"
+#line 2414 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
/* Line 1267 of yacc.c. */
-#line 5170 "compilers/imcc/imcparser.c"
+#line 5171 "compilers/imcc/imcparser.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5391,7 +5392,7 @@
}
-#line 2419 "compilers/imcc/imcc.y"
+#line 2420 "compilers/imcc/imcc.y"
/* I need this prototype somewhere... */
Modified: branches/io_cleanups/compilers/imcc/instructions.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/instructions.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/instructions.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -103,8 +103,8 @@
(Instruction*)mem_sys_allocate_zeroed(sizeof (Instruction) + reg_space);
int i;
- ins->opname = str_dup(op);
- ins->format = str_dup(fmt);
+ ins->opname = mem_sys_strdup(op);
+ ins->format = mem_sys_strdup(fmt);
ins->symreg_count = n;
for (i = 0; i < n; i++)
Modified: branches/io_cleanups/compilers/imcc/main.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/main.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/main.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -955,7 +955,7 @@
Parrot_pbc_load(interp, pf);
IMCC_push_parser_state(interp);
- IMCC_INFO(interp)->state->file = strdup(sourcefile);
+ IMCC_INFO(interp)->state->file = mem_sys_strdup(sourcefile);
emit_open(interp, per_pbc, per_pbc ? NULL : (void*)output_file);
Modified: branches/io_cleanups/compilers/imcc/optimizer.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/optimizer.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/optimizer.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -368,7 +368,7 @@
last->opnum = tmp->opnum;
last->opsize = tmp->opsize;
free(last->opname);
- last->opname = str_dup(tmp->opname);
+ last->opname = mem_sys_strdup(tmp->opname);
free_ins(tmp);
/* delete branch */
Modified: branches/io_cleanups/compilers/imcc/parser_util.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/parser_util.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/parser_util.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -677,7 +677,7 @@
IMCC_INFO(interp)->state->next = NULL;
IMCC_INFO(interp)->state->pasm_file = pasm_file;
- IMCC_INFO(interp)->state->file = name;
+ IMCC_INFO(interp)->state->file = mem_sys_strdup(name);
IMCC_INFO(interp)->expect_pasm = 0;
compile_string(interp, s, yyscanner);
@@ -941,7 +941,7 @@
IMCC_push_parser_state(interp);
{
/* Store a copy, in order to know how to free it later */
- char *copyname = strdup(fullname);
+ char *copyname = mem_sys_strdup(fullname);
IMCC_INFO(interp)->state->file = copyname;
ext = strrchr(copyname, '.');
}
Modified: branches/io_cleanups/compilers/imcc/pbc.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/pbc.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/pbc.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -1348,7 +1348,7 @@
ns_const = ns->color;
if (real_name) {
- char * const p = str_dup(real_name + 1);
+ char * const p = mem_sys_strdup(real_name + 1);
free(r->name);
r->name = p;
}
@@ -1394,7 +1394,7 @@
unit->subid = r;
else {
/* trim the quotes */
- unit->subid->name = str_dup(unit->subid->name + 1);
+ unit->subid->name = mem_sys_strdup(unit->subid->name + 1);
unit->subid->name[strlen(unit->subid->name) - 1] = 0;
/* create string constant for it. */
@@ -1809,6 +1809,9 @@
STRING *s;
PMC *p;
+ if (PMC_IS_NULL(_class))
+ IMCC_fatal(interp, 1, "make_pmc_const: no such pmc");
+
if (*r->name == '"')
s = Parrot_str_unescape(interp, r->name + 1, '"', NULL);
Modified: branches/io_cleanups/compilers/imcc/pcc.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/pcc.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/pcc.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -743,6 +743,9 @@
SymReg * const sub = ins->symregs[0];
+ PARROT_ASSERT(sub);
+ PARROT_ASSERT(sub->pcc_sub);
+
if (ins->type & ITRESULT) {
const int n = sub->pcc_sub->nret;
ins = pcc_get_args(interp, unit, ins, "get_results", n,
@@ -767,6 +770,11 @@
if (ins->type & ITCALL) {
SymReg * const the_sub = sub->pcc_sub->sub;
+ /* If this condition is true the generator must haven't be called,
+ * but check it as a last resort.
+ * See also TT #737 */
+ if (the_sub == NULL)
+ IMCC_fatal(interp, 1, "expand_pcc_sub_call: no such sub");
if (!meth_call && (the_sub->type & VTADDRESS)) {
/* sub->pcc_sub->sub is an actual subroutine name, not a variable */
Modified: branches/io_cleanups/compilers/imcc/reg_alloc.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/reg_alloc.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/reg_alloc.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -72,7 +72,7 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*r);
-static int first_avail(
+static unsigned int first_avail(
ARGIN(const IMC_Unit *unit),
int reg_set,
ARGOUT_NULLOK(Set **avail))
@@ -1110,7 +1110,7 @@
/*
-=item C<static int first_avail(const IMC_Unit *unit, int reg_set, Set **avail)>
+=item C<static unsigned int first_avail(const IMC_Unit *unit, int reg_set, Set **avail)>
find first available register of the given reg_set
@@ -1118,7 +1118,7 @@
*/
-static int
+static unsigned int
first_avail(ARGIN(const IMC_Unit *unit), int reg_set, ARGOUT_NULLOK(Set **avail))
{
ASSERT_ARGS(first_avail)
@@ -1188,10 +1188,10 @@
&& r->color == -1
&& (r->usage & usage)
&& r->use_count) {
- Set *avail = sets[j];
- int first_reg = avail
- ? set_first_zero(avail)
- : first_avail(unit, (int)r->set, &avail);
+ Set *avail = sets[j];
+ unsigned int first_reg = avail
+ ? set_first_zero(avail)
+ : first_avail(unit, (int)r->set, &avail);
set_add(avail, first_reg);
r->color = first_reg++;
Modified: branches/io_cleanups/compilers/imcc/symreg.c
==============================================================================
--- branches/io_cleanups/compilers/imcc/symreg.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/imcc/symreg.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -145,7 +145,7 @@
Namespace * const ns = mem_allocate_zeroed_typed(Namespace);
ns->parent = pesky_global__namespace;
- ns->name = str_dup(name);
+ ns->name = mem_sys_strdup(name);
pesky_global__namespace = ns;
}
@@ -267,7 +267,7 @@
r = mem_allocate_zeroed_typed(SymReg);
r->set = t;
r->type = VTREG;
- r->name = str_dup(name);
+ r->name = mem_sys_strdup(name);
r->color = -1;
r->want_regno = -1;
@@ -619,7 +619,7 @@
return result;
}
- return str_dup(name);
+ return mem_sys_strdup(name);
}
@@ -722,7 +722,7 @@
r[0] = left;
/* strip delimiters */
- name = str_dup(rhs->name + 1);
+ name = mem_sys_strdup(rhs->name + 1);
len = strlen(name);
name[len - 1] = '\0';
@@ -920,7 +920,7 @@
if (!IMCC_INFO(interp)->cur_namespace
|| (l = strlen(IMCC_INFO(interp)->cur_namespace->name)) <= 2)
- return str_dup(name);
+ return mem_sys_strdup(name);
/* TODO keyed syntax */
len = strlen(name) + l + 4;
@@ -967,7 +967,7 @@
if (uniq == U_add_all) {
r = mem_allocate_zeroed_typed(SymReg);
r->type = VTADDRESS;
- r->name = str_dup(name);
+ r->name = mem_sys_strdup(name);
_store_symreg(hsh, r);
}
else {
@@ -1150,7 +1150,7 @@
ASSERT_ARGS(dup_sym)
SymReg * const new_sym = mem_allocate_zeroed_typed(SymReg);
STRUCT_COPY(new_sym, r);
- new_sym->name = str_dup(r->name);
+ new_sym->name = mem_sys_strdup(r->name);
if (r->nextkey)
new_sym->nextkey = dup_sym(r->nextkey);
Modified: branches/io_cleanups/compilers/pct/src/PCT/Dumper.pir
==============================================================================
--- branches/io_cleanups/compilers/pct/src/PCT/Dumper.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/compilers/pct/src/PCT/Dumper.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -8,7 +8,8 @@
=head1 DESCRIPTION
This file implements a dumper that attempts to output PAST,
-Match, and Capture objects in a YAML-compatible format.
+Match, and Capture objects in a format that can be easily
+consumed by syntax highlighters (such as Padre).
Yes, the code is probably much uglier and convoluted than
it should be. No, I'm not proud of it, but it works for now.
Modified: branches/io_cleanups/config/auto/icu.pm
==============================================================================
--- branches/io_cleanups/config/auto/icu.pm Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/config/auto/icu.pm Sat Jun 27 01:33:11 2009 (r39805)
@@ -394,10 +394,20 @@
}
}
else {
+ my $icuheaders = $arg->{icuheaders};
+
+ my $icuflags;
+ if ($icuheaders =~ /\s/) {
+ $icuflags = "-I \"$arg->{icuheaders}\"";
+ }
+ else {
+ $icuflags = "-I $arg->{icuheaders}";
+ }
+
if ($arg->{verbose}) {
- print "Adding -I $arg->{icuheaders} to ccflags for icu headers.\n";
+ print "Adding $icuflags to ccflags for icu headers.\n";
}
- $conf->data->add( ' ', ccflags => "-I $arg->{icuheaders}" );
+ $conf->data->add( ' ', ccflags => $icuflags );
}
}
Modified: branches/io_cleanups/config/gen/crypto.pm
==============================================================================
--- branches/io_cleanups/config/gen/crypto.pm Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/config/gen/crypto.pm Sat Jun 27 01:33:11 2009 (r39805)
@@ -95,6 +95,7 @@
$conf->genfile( $self->{digest_pmc_template} => "src/dynpmc/${file}.pmc" );
$conf->genfile( $self->{digest_t_template} => "t/dynpmc/${file}.t" );
}
+ $conf->cc_clean();
return 1;
}
Modified: branches/io_cleanups/config/gen/makefiles/root.in
==============================================================================
--- branches/io_cleanups/config/gen/makefiles/root.in Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/config/gen/makefiles/root.in Sat Jun 27 01:33:11 2009 (r39805)
@@ -262,6 +262,7 @@
$(LIBRARY_DIR)/ncurses.pbc \
#IF(has_opengl): $(LIBRARY_DIR)/OpenGL.pbc \
#IF(has_opengl): $(LIBRARY_DIR)/OpenGL_funcs.pbc \
+#IF(has_opengl): $(LIBRARY_DIR)/OpenGL/Math.pbc \
$(LIBRARY_DIR)/P6object.pbc \
$(LIBRARY_DIR)/parrotlib.pbc \
$(LIBRARY_DIR)/pcore.pbc \
Modified: branches/io_cleanups/config/gen/opengl.pm
==============================================================================
--- branches/io_cleanups/config/gen/opengl.pm Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/config/gen/opengl.pm Sat Jun 27 01:33:11 2009 (r39805)
@@ -325,6 +325,9 @@
'SetPixelFormat',
# Can't handle longlong until RT 53406 is done
+ 'glBufferAddressRangeNV',
+ 'glUniformui64NV',
+ 'glProgramUniformui64NV',
'glPresentFrameKeyedNV',
'glPresentFrameDualFillNV',
'glXSwapBuffersMscOML',
Modified: branches/io_cleanups/docs/pdds/pdd27_multiple_dispatch.pod
==============================================================================
--- branches/io_cleanups/docs/pdds/pdd27_multiple_dispatch.pod Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/docs/pdds/pdd27_multiple_dispatch.pod Sat Jun 27 01:33:11 2009 (r39805)
@@ -105,7 +105,7 @@
matching, for a passed in signature. The signature passed in is an array of
PMCs, and the types are extracted from the types of the array elements.
-=item get_pmc_keyed_string
+=item get_pmc_keyed_str
Return an array of matching candidates, sorted from best matching to worst
matching, for a passed in signature. The signature passed in is a simple type
Modified: branches/io_cleanups/docs/project/release_manager_guide.pod
==============================================================================
--- branches/io_cleanups/docs/project/release_manager_guide.pod Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/docs/project/release_manager_guide.pod Sat Jun 27 01:33:11 2009 (r39805)
@@ -33,8 +33,8 @@
For example, you could select a name from
L<http://en.wikipedia.org/wiki/List_of_parrots>.
-Set up your account on L<http://www.parrot.org/> and ask one of Allison, Jerry,
-Jeff, Will, or chromatic to bestow you story-creating powers.
+Set up your account on L<http://www.parrot.org/> and ask an existing release
+manager to provide you with admin privileges if you don't already have them.
=item 1.
@@ -230,14 +230,13 @@
=item 10.
-Update the website. You will need an account on L<http://www.parrot.org>.
+Update the website. You will need an account with administrative rights
+on L<http://www.parrot.org>.
=over 4
=item a
-At this step, the "editor" privilege is needed, "poster" is not enough.
-
Add a new page for the release announcement with "Create content" -> "Story".
There's some additional stuff needed at the top of the page; use one of the
old announcements as a guide.
@@ -265,8 +264,6 @@
=item e
-At this step, the "admin" privilege is needed.
-
Under "Administer" -> "Site building" -> "URL Redirects", change the URL for
"release/current" to the FTP directory for the new release (for example,
F<ftp://ftp.parrot.org/pub/parrot/releases/devel/0.8.1>). Also update
Modified: branches/io_cleanups/docs/user/pir/objects.pod
==============================================================================
--- branches/io_cleanups/docs/user/pir/objects.pod Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/docs/user/pir/objects.pod Sat Jun 27 01:33:11 2009 (r39805)
@@ -383,7 +383,7 @@
.sub getname :method
$P0 = getattribute self, "name"
- print $P0
+ .return($P0)
.end
.sub speak :method
Modified: branches/io_cleanups/docs/user/pir/pmcs.pod
==============================================================================
--- branches/io_cleanups/docs/user/pir/pmcs.pod Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/docs/user/pir/pmcs.pod Sat Jun 27 01:33:11 2009 (r39805)
@@ -21,17 +21,18 @@
String register number 15). Parrot programs consist of lines of
text where each line contains one opcode and its arguments.
-Each subroutine will have as many registers
-available as necessary; a simple subroutine will only need
-a few whereas complex subroutines with many calculations will
-need a larger number of registers. This is a fundamental
-difference from the original design of Parrot, in which there
-were 32 registers for each of the built-in types (int, num,
-pmc, string).
-PIR also provides for a more "natural" syntax for opcodes.
-Rather than saying C<set $I1, 0> to assign a zero to the $I1
-register, you may say instead C<$I1 = 0>.
-PIR also provides syntax for easily creating named variables
+Each subroutine will have as many registers available of each basic type
+(int, num, string, and pmc) as necessary; a simple subroutine will only
+need a few whereas complex subroutines with many calculations will need
+a larger number of registers. This is a fundamental difference from
+hardware CPUs (and the original design of Parrot), in which there are a
+fixed number of registers.
+
+PIR also provides for a more "natural" syntax for opcodes than
+the standard assembly language C<op arg, arg> format.
+Rather than writing C<set $I1, 0> to assign a zero to the $I1
+register, you may instead write C<$I1 = 0>.
+PIR also provides easy syntax for creating named variables
and constants, subroutines, passing parameters to subroutines,
accessing parameters by name, etc.
@@ -39,14 +40,12 @@
=head2 What's a PMC?
-Integers, strings, and arbitrary floating point numbers are
-common data types in most programming languages, but what's
-a PMC? PMC stands for "Polymorphic Container". PMCs are how
-Parrot handles more complicated structures and behaviors
-(hence the magic :) Some examples of PMC usage would be for
-arrays, hashes, data structures, objects, etc. Anything that
-can't be expressed using just integers, floating point
-numbers and strings can be expressed with a PMC.
+Integers, strings, and floating point numbers are common data types in
+most programming languages, but what's a PMC? PMC stands for
+"I<P>olyI<M>orphic I<C>ontainer". PMCs are how Parrot handles more
+complicated structures and behaviors, such as arrays, hashes, and
+objects. anything that can't be expressed using just integers,
+floating point numbers and strings can be expressed with a PMC.
Parrot comes with many types of PMC that encapsulate common,
useful behavior.
@@ -63,8 +62,8 @@
Hash A generic, resizable hash
Random Obtain a random number
String Similar to a string register but in PMC form
- Integer Similar to an integer register but in PMC form
- Float Similar to a number register but in PMC form
+ Integer Similar to an int register but in PMC form
+ Float Similar to a num register but in PMC form
Exception The standard exception mechanism
Timer A timer of course :)
Copied: branches/io_cleanups/examples/opengl/math.pir (from r39804, trunk/examples/opengl/math.pir)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/io_cleanups/examples/opengl/math.pir Sat Jun 27 01:33:11 2009 (r39805, copy of r39804, trunk/examples/opengl/math.pir)
@@ -0,0 +1,99 @@
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+=head1 TITLE
+
+math.pir - Demo OpenGL::Math module
+
+=head1 SYNOPSIS
+
+ $ cd parrot-home
+ $ ./parrot examples/opengl/math.pir
+
+=head1 DESCRIPTION
+
+NOTE: THIS IS JUST A STUB WHILE OpenGL::Math IS BEING DEVELOPED. IT WILL BE
+ FILLED OUT LATER.
+
+This is a simple demo of functionality available from the C<OpenGL::Math>
+Parrot module.
+
+=cut
+
+.sub main :main
+ # Load OpenGL::Math and data dumping debug module
+ load_bytecode 'OpenGL/Math.pbc'
+ load_bytecode 'dumper.pbc'
+
+ # Create some sample data
+ .local pmc vec1, vec2
+ (vec1, vec2) = make_test_vectors()
+
+ # Run a few simple tests
+ sanity(vec1, vec2)
+ normalize(vec1)
+.end
+
+.sub make_test_vectors
+ # Test some basics
+ $P0 = new 'FixedFloatArray'
+ $P0 = 4
+ $P0[0] = 0.5
+ $P0[1] = 1.0
+ $P0[2] = 2.0
+ $P0[3] = 4.0
+
+ $P1 = new 'FixedFloatArray'
+ $P1 = 4
+ $P1[0] = 1.0
+ $P1[1] = 2.0
+ $P1[2] = 3.0
+ $P1[3] = 4.0
+
+ .local pmc Vec4
+ Vec4 = get_class ['OpenGL';'Math';'Vec4']
+
+ $P2 = new Vec4
+ $P2.'set_vals'($P0)
+
+ $P3 = Vec4.'new'('vals' => $P1)
+
+ .return ($P2, $P3)
+.end
+
+.sub sanity
+ .param pmc vec1
+ .param pmc vec2
+
+ .local pmc vec3
+ vec3 = vec1.'mul'(vec2)
+
+ say "\nvec1 * vec2 => vec3"
+ _dumper(vec1, 'vec1')
+ _dumper(vec2, 'vec2')
+ _dumper(vec3, 'vec3')
+
+ .local pmc scaled
+ scaled = vec1.'mul_num'(3)
+
+ say "\nvector * 3 => scaled"
+ _dumper(vec1, 'vector')
+ _dumper(scaled, 'scaled')
+.end
+
+.sub normalize
+ .param pmc vector
+
+ .local pmc normalized
+ normalized = vector.'normalize'()
+
+ say "\nnormalize(vector) => normalized"
+ _dumper(vector, 'vector')
+ _dumper(normalized, 'normalized')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/io_cleanups/examples/tutorial/01_temp_var.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/01_temp_var.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/01_temp_var.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -23,7 +23,7 @@
$S5 = "Hello" # set temp string var to "Hello"
- $P0 = new 'String'
+ $P0 = new ['String']
$P0 = "Ford" # set temp PMC var to "Ford"
say $I0
Modified: branches/io_cleanups/examples/tutorial/02_local_var.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/02_local_var.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/02_local_var.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -36,7 +36,7 @@
print "\n"
.local pmc player
- player = new 'String'
+ player = new ['String']
player = "Ford" # set temp PMC var to "Ford"
print player
print "\n"
Modified: branches/io_cleanups/examples/tutorial/03_temp_var_basic_pmcs.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/03_temp_var_basic_pmcs.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/03_temp_var_basic_pmcs.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -18,15 +18,15 @@
=cut
.sub main :main
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = 42
say $P0
- $P1 = new 'Float'
+ $P1 = new ['Float']
$P1 = 6.35
say $P1
- $P2 = new 'ResizableStringArray'
+ $P2 = new ['ResizableStringArray']
$P2[0] = "Foo"
$P2[1] = "Bar"
$P2[2] = "Baz"
Modified: branches/io_cleanups/examples/tutorial/24_string_ops_clone.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/24_string_ops_clone.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/24_string_ops_clone.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -14,7 +14,7 @@
.sub main :main
.local pmc firstname
- firstname = new 'String'
+ firstname = new ['String']
firstname = "Ford"
say firstname
Modified: branches/io_cleanups/examples/tutorial/30_arrays_basic.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/30_arrays_basic.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/30_arrays_basic.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -18,7 +18,7 @@
.sub main :main
.local pmc myarray
- myarray = new 'ResizableStringArray'
+ myarray = new ['ResizableStringArray']
myarray[0] = "Foo"
push myarray, "Bar"
Modified: branches/io_cleanups/examples/tutorial/32_array_ops_sprintf.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/32_array_ops_sprintf.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/32_array_ops_sprintf.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -14,13 +14,13 @@
.sub main :main
.local pmc myarray
- myarray = new 'ResizablePMCArray'
+ myarray = new ['ResizablePMCArray']
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = 42
push myarray, $P0
- $P1 = new 'Float'
+ $P1 = new ['Float']
$P1 = 10.5
push myarray, $P1
Modified: branches/io_cleanups/examples/tutorial/33_hashes.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/33_hashes.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/33_hashes.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -22,7 +22,7 @@
.sub main :main
.local pmc myhash
- myhash = new 'Hash'
+ myhash = new ['Hash']
myhash['foo'] = 5
myhash['bar'] = "Hello"
Modified: branches/io_cleanups/examples/tutorial/34_multikey.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/34_multikey.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/34_multikey.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -17,8 +17,8 @@
.sub main :main
.local pmc myhash, innerarray
- myhash = new 'Hash'
- innerarray = new 'ResizableIntegerArray'
+ myhash = new ['Hash']
+ innerarray = new ['ResizableIntegerArray']
$I0 = 2
innerarray[2] = 42
Modified: branches/io_cleanups/examples/tutorial/40_file_ops.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/40_file_ops.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/40_file_ops.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -20,7 +20,7 @@
close filein
# Be nice and remove the temporary file we created.
- $P1 = new 'OS'
+ $P1 = new ['OS']
$P1.'rm'('40_file_ops_data.txt')
.end
Modified: branches/io_cleanups/examples/tutorial/55_iterator.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/55_iterator.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/55_iterator.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -21,7 +21,7 @@
myarray = split " ", "foo bar baz boz"
- iter = new 'Iterator', myarray
+ iter = new ['Iterator'], myarray
iter_loop:
unless iter goto iter_end
Modified: branches/io_cleanups/examples/tutorial/56_defined.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/56_defined.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/56_defined.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -15,7 +15,7 @@
.sub main :main
- $P1 = new 'String'
+ $P1 = new ['String']
$I0 = defined $P1
if $I0 goto defined_P1
say "$P1 is undefined"
@@ -32,7 +32,7 @@
=cut
end_defined_P1:
- $P3 = new 'Undef'
+ $P3 = new ['Undef']
$I0 = defined $P3
if $I0 goto defined_P3
say "$P3 is undefined"
Modified: branches/io_cleanups/examples/tutorial/57_exists.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/57_exists.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/57_exists.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -23,10 +23,10 @@
# set up an array with two elements
.local pmc my_array
- my_array = new 'ResizablePMCArray'
- $P0 = new 'String'
+ my_array = new ['ResizablePMCArray']
+ $P0 = new ['String']
$P0 = "Hello"
- $P1 = new 'Undef'
+ $P1 = new ['Undef']
push my_array, $P0
push my_array, $P1
Modified: branches/io_cleanups/examples/tutorial/61_namespaces.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/61_namespaces.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/61_namespaces.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -20,7 +20,7 @@
.sub main :main
- $P0 = new 'String'
+ $P0 = new ['String']
$P0 = "Hello"
set_global ["Different"; "Namespace"], "foo", $P0
Modified: branches/io_cleanups/examples/tutorial/70_class_object.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/70_class_object.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/70_class_object.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -37,7 +37,7 @@
addattribute myclass, 'bar'
addattribute myclass, 'baz'
- myobj = new 'Foo'
+ myobj = new ['Foo']
myobj.'set_bar'("Hello")
myobj.'set_baz'(5)
@@ -61,7 +61,7 @@
.sub set_bar :method
.param string value
- $P0 = new 'String'
+ $P0 = new ['String']
$P0 = value
setattribute self, "bar", $P0
.end
@@ -74,7 +74,7 @@
.sub set_baz :method
.param int value
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = value
setattribute self, "baz", $P0
.end
Modified: branches/io_cleanups/examples/tutorial/81_continuation.pir
==============================================================================
--- branches/io_cleanups/examples/tutorial/81_continuation.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/examples/tutorial/81_continuation.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -15,7 +15,7 @@
.sub main :main
.local pmc cont
- cont = new 'Continuation'
+ cont = new ['Continuation']
set_addr cont, continued
test_call(4, cont)
Modified: branches/io_cleanups/include/parrot/key.h
==============================================================================
--- branches/io_cleanups/include/parrot/key.h Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/include/parrot/key.h Sat Jun 27 01:33:11 2009 (r39805)
@@ -167,7 +167,7 @@
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
STRING * key_string(PARROT_INTERP, ARGIN(PMC *key))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
Modified: branches/io_cleanups/include/parrot/memory.h
==============================================================================
--- branches/io_cleanups/include/parrot/memory.h Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/include/parrot/memory.h Sat Jun 27 01:33:11 2009 (r39805)
@@ -70,6 +70,12 @@
size_t size,
size_t old_size);
+PARROT_EXPORT
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+char * mem_sys_strdup(ARGIN(const char *src))
+ __attribute__nonnull__(1);
+
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
void * mem__internal_allocate(
@@ -116,6 +122,8 @@
#define ASSERT_ARGS_mem_sys_free __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_mem_sys_realloc __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_mem_sys_realloc_zeroed __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
+#define ASSERT_ARGS_mem_sys_strdup __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(src)
#define ASSERT_ARGS_mem__internal_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(file)
#define ASSERT_ARGS_mem__internal_allocate_zeroed __attribute__unused__ int _ASSERT_ARGS_CHECK = \
Modified: branches/io_cleanups/include/parrot/stacks.h
==============================================================================
--- branches/io_cleanups/include/parrot/stacks.h Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/include/parrot/stacks.h Sat Jun 27 01:33:11 2009 (r39805)
@@ -37,7 +37,7 @@
/* #define STACK_ITEMSIZE(chunk) PObj_buflen(chunk) */
-typedef void (*Stack_cleanup_method)(Interp*, Stack_Entry_t *);
+typedef void (*Stack_cleanup_method)(PARROT_INTERP, ARGIN(struct Stack_Entry *));
#define STACK_CLEANUP_NULL ((Stack_cleanup_method)NULLfunc)
Modified: branches/io_cleanups/include/parrot/sub.h
==============================================================================
--- branches/io_cleanups/include/parrot/sub.h Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/include/parrot/sub.h Sat Jun 27 01:33:11 2009 (r39805)
@@ -169,9 +169,10 @@
#define PMC_get_sub(interp, pmc, sub) \
do { \
- if ((pmc)->vtable->base_type == enum_class_Sub || \
- (pmc)->vtable->base_type == enum_class_Coroutine || \
- (pmc)->vtable->base_type == enum_class_Eval) \
+ const INTVAL type = (pmc)->vtable->base_type; \
+ if (type == enum_class_Sub || \
+ type == enum_class_Coroutine || \
+ type == enum_class_Eval) \
{\
GETATTR_Sub_sub((interp), (pmc), (sub)); \
} \
Modified: branches/io_cleanups/lib/Parrot/Pmc2c/Attribute.pm
==============================================================================
--- branches/io_cleanups/lib/Parrot/Pmc2c/Attribute.pm Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/lib/Parrot/Pmc2c/Attribute.pm Sat Jun 27 01:33:11 2009 (r39805)
@@ -145,7 +145,7 @@
$decl .= <<"EOA";
PMC * const attr_value = VTABLE_get_attr_str(interp, \\
pmc, Parrot_str_new_constant(interp, "$attrname")); \\
- (dest) = (PMC_IS_NULL(attr_value) ? (STRING *) 0: VTABLE_get_string(interp, attr_value)); \\
+ (dest) = (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \\
EOA
}
elsif ($attrtype =~ $isptrtopmc) {
Modified: branches/io_cleanups/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- branches/io_cleanups/lib/Parrot/Pmc2c/PMCEmitter.pm Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/lib/Parrot/Pmc2c/PMCEmitter.pm Sat Jun 27 01:33:11 2009 (r39805)
@@ -688,10 +688,6 @@
if (vt->ro_variant_vtable)
vt->ro_variant_vtable->mro = vt->mro;
-
-EOC
-
- $cout .= <<"EOC";
}
/* set up MRO and _namespace */
@@ -702,22 +698,12 @@
foreach my $method ( @{ $self->{methods} } ) {
next unless $method->type eq Parrot::Pmc2c::Method::NON_VTABLE;
- my $proto = proto( $method->return_type, $method->parameters );
my $method_name = $method->name;
- my $symbol_name =
- defined $method->symbol ? $method->symbol : $method->name;
+ my $symbol_name = $method->symbol;
- if ( exists $method->{PCCMETHOD} ) {
- $cout .= <<"EOC";
+ $cout .= <<"EOC";
register_raw_nci_method_in_ns(interp, entry, F2DPTR(Parrot_${classname}_${method_name}), CONST_STRING_GEN(interp, "$symbol_name"));
EOC
- }
- else {
- $cout .= <<"EOC";
- register_nci_method(interp, entry,
- F2DPTR(Parrot_${classname}_${method_name}), "$symbol_name", "$proto");
-EOC
- }
if ( $method->{attrs}{write} ) {
$cout .= <<"EOC";
Parrot_mark_method_writes(interp, entry, "$symbol_name");
@@ -726,12 +712,14 @@
}
# include any class specific init code from the .pmc file
- $cout .= <<"EOC" if $class_init_code;
+ if ($class_init_code) {
+ $cout .= <<"EOC";
/* class_init */
{
$class_init_code
}
EOC
+ }
$cout .= <<"EOC";
{
@@ -830,7 +818,7 @@
my $export = $self->is_dynamic ? 'PARROT_DYNEXT_EXPORT ' : 'PARROT_EXPORT';
if ($classname ne 'default') {
- for my $dp (@{ $self->direct_parents}) {
+ for my $dp (reverse @{ $self->direct_parents}) {
$get_mro .= " mro = Parrot_${dp}_get_mro(interp, mro);\n"
unless $dp eq 'default';
}
@@ -871,7 +859,7 @@
my $export = $self->is_dynamic ? 'PARROT_DYNEXT_EXPORT ' : 'PARROT_EXPORT';
if ($classname ne 'default') {
- for my $dp (@{ $self->direct_parents}) {
+ for my $dp (reverse @{ $self->direct_parents}) {
$get_isa .= " isa = Parrot_${dp}_get_isa(interp, isa);\n"
unless $dp eq 'default';
}
@@ -907,17 +895,24 @@
my $cout = "";
my $classname = $self->name;
+ my @other_parents = reverse @{ $self->direct_parents };
+ my $first_parent = shift @other_parents;
my $get_vtable = '';
- foreach my $parent_name ( reverse ($self->name, @{ $self->parents }) ) {
- if ($parent_name eq 'default') {
- $get_vtable .= " vt = Parrot_default_get_vtable(interp);\n";
- }
- else {
- $get_vtable .= " Parrot_${parent_name}_update_vtable(vt);\n";
- }
+
+ if ($first_parent eq 'default') {
+ $get_vtable .= " vt = Parrot_default_get_vtable(interp);\n";
+ }
+ else {
+ $get_vtable .= " vt = Parrot_${first_parent}_get_vtable(interp);\n";
+ }
+
+ foreach my $parent_name ( @other_parents) {
+ $get_vtable .= " Parrot_${parent_name}_update_vtable(vt);\n";
}
+ $get_vtable .= " Parrot_${classname}_update_vtable(vt);\n";
+
$cout .= <<"EOC";
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
@@ -931,15 +926,20 @@
EOC
my $get_extra_vtable = '';
- foreach my $parent_name ( reverse ($self->name, @{ $self->parents }) ) {
- if ($parent_name eq 'default') {
- $get_extra_vtable .= " vt = Parrot_default_ro_get_vtable(interp);\n";
- }
- else {
- $get_extra_vtable .= " Parrot_${parent_name}_ro_update_vtable(vt);\n";
- }
+
+ if ($first_parent eq 'default') {
+ $get_extra_vtable .= " vt = Parrot_default_ro_get_vtable(interp);\n";
+ }
+ else {
+ $get_extra_vtable .= " vt = Parrot_${first_parent}_ro_get_vtable(interp);\n";
}
+ foreach my $parent_name ( @other_parents ) {
+ $get_extra_vtable .= " Parrot_${parent_name}_ro_update_vtable(vt);\n";
+ }
+
+ $get_extra_vtable .= " Parrot_${classname}_ro_update_vtable(vt);\n";
+
$cout .= <<"EOC";
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
@@ -1020,7 +1020,7 @@
1;
}
-# Generate signle case for switch VTABLE
+# Generate single case for switch VTABLE
sub generate_single_case {
my ($self, $vt_method_name, $multi) = @_;
Modified: branches/io_cleanups/runtime/parrot/library/OpenGL.pir
==============================================================================
--- branches/io_cleanups/runtime/parrot/library/OpenGL.pir Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/runtime/parrot/library/OpenGL.pir Sat Jun 27 01:33:11 2009 (r39805)
@@ -108,6 +108,9 @@
.local pmc libnames
libnames = new 'ResizableStringArray'
+ # The following line brought to you by proprietary driver packages
+ # that don't update the libGL.so symlink properly, causing FAIL
+ push libnames, 'libGL.so.1'
push libnames, 'libGL'
push libnames, 'opengl32'
push libnames, '/System/Library/Frameworks/OpenGL.framework/OpenGL'
Copied: branches/io_cleanups/runtime/parrot/library/OpenGL/Math.pir (from r39804, trunk/runtime/parrot/library/OpenGL/Math.pir)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/io_cleanups/runtime/parrot/library/OpenGL/Math.pir Sat Jun 27 01:33:11 2009 (r39805, copy of r39804, trunk/runtime/parrot/library/OpenGL/Math.pir)
@@ -0,0 +1,549 @@
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+OpenGL;Math - Parrot extension for linear algebra following OpenGL conventions
+
+=head1 SYNOPSIS
+
+For more examples, look in F<examples/opengl/>, starting with
+F<examples/opengl/math.pir>.
+
+ # During init ...
+ load_bytecode 'OpenGL/Math.pbc'
+
+ # Later ...
+ XXX - NEED CODE HERE
+
+=head1 DESCRIPTION
+
+NOTE: THIS IS A WORK IN PROGRESS, AND SHOULD NOT BE CONSIDERED USABLE YET.
+
+Any 3D API has to pick certain conventions for handling of vectors and
+matrices, such as the handedness of the default coordinate systems,
+whether matrices are packed in column-major or row-major order, and
+so forth.
+
+This module implements the basic operations of linear algebra according
+to the conventions chosen by OpenGL, and attempts to do so efficiently
+within the bounds set by a pure PIR implementation. It also provides
+efficient packing and unpacking of matrix and vector elements so that
+users need not directly understand the vagaries of OpenGL NCI structures.
+
+Finally, it is a primary goal that users of this module should not need to
+provide any hand-written versions of standard OpenGL matrix manipulations.
+Thus, methods are provided to perform rotations, translations, projections,
+etc.
+
+=cut
+
+.namespace ['OpenGL';'Math']
+
+=head2 OpenGL;Math
+
+The OpenGL;Math class/namespace handles the necessary housekeeping to make
+everything else work smoothly.
+
+=head3 Initialization
+
+The initialization routines are mostly for internal use only. They
+include:
+
+=over 4
+
+=cut
+
+=item _opengl_math_init()
+
+At module load time, calls the other initialization routines in the proper
+order.
+
+=cut
+
+.sub _opengl_math_init :load
+ _create_classes()
+.end
+
+=item _create_classes()
+
+Creates Parrot classes to match each of the OpenGL;Math namespaces, and
+sets up their attributes.
+
+=cut
+
+.sub _create_classes
+ .local pmc Vec4
+ Vec4 = newclass ['OpenGL';'Math';'Vec4']
+ addattribute Vec4, 'vals'
+.end
+
+=back
+
+=cut
+
+
+.namespace ['OpenGL';'Math';'Vec4']
+
+=head2 OpenGL;Math;Vec4
+
+=head3 Instantiation
+
+=over 4
+
+=item Vec4 vec4 = new Vec4
+
+Create a new object representing a four-element vector. You will need
+to set the initial values using the C<set_vals()> method.
+
+=item Vec4 vec4 = Vec4.'new'('vals' => vals)
+
+Create a new object representing a four-element vector, setting the
+initial values to the array PMC C<vals>.
+
+=back
+
+
+=head3 Accessors
+
+=over 4
+
+=item pmc vals = vector.get_vals()
+
+Return a four element array representing the current vector value.
+
+=cut
+
+.sub get_vals :method
+ $P0 = getattribute self, 'vals'
+ .return($P0)
+.end
+
+=item vector.set_vals(pmc vals)
+
+Set the current vector value to a four element array.
+
+=cut
+.sub set_vals :method
+ .param pmc vals
+
+ $I0 = vals
+ unless $I0 == 4 goto wrong_vector_length
+
+ setattribute self, 'vals', vals
+ .return()
+
+ wrong_vector_length:
+ $S0 = 'Input vector is wrong length ('
+ $S1 = $I0
+ $S0 .= $S1
+ $S0 .= ')'
+ die $S0
+.end
+
+=back
+
+
+=head3 Elementwise Operations
+
+=cut
+
+# Standard header for vec4-vec4 binop methods
+.macro vec4_extract_self_plus_vec_arg
+ .param pmc vec2
+
+ .local pmc v1, v2
+ v1 = getattribute self, 'vals'
+ v2 = getattribute vec2, 'vals'
+
+ $N10 = v1[0]
+ $N11 = v1[1]
+ $N12 = v1[2]
+ $N13 = v1[3]
+
+ $N20 = v2[0]
+ $N21 = v2[1]
+ $N22 = v2[2]
+ $N23 = v2[3]
+.endm
+
+# Standard header for vec3-vec3 binop methods
+.macro vec3_extract_self_plus_vec_arg
+ .param pmc vec2
+
+ .local pmc v1, v2
+ v1 = getattribute self, 'vals'
+ v2 = getattribute vec2, 'vals'
+
+ $N10 = v1[0]
+ $N11 = v1[1]
+ $N12 = v1[2]
+
+ $N20 = v2[0]
+ $N21 = v2[1]
+ $N22 = v2[2]
+.endm
+
+# Standard header for vec4-num binop methods
+.macro vec4_extract_self_plus_num_arg
+ .param num N
+
+ .local pmc v1
+ v1 = getattribute self, 'vals'
+
+ $N10 = v1[0]
+ $N11 = v1[1]
+ $N12 = v1[2]
+ $N13 = v1[3]
+.endm
+
+# Standard header for vec3-num binop methods
+.macro vec3_extract_self_plus_num_arg
+ .param num N
+
+ .local pmc v1
+ v1 = getattribute self, 'vals'
+
+ $N10 = v1[0]
+ $N11 = v1[1]
+ $N12 = v1[2]
+.endm
+
+# Standard footer for binop methods returning a vec4
+.macro vec4_return_new_result
+ .local pmc v3
+ v3 = new 'FixedFloatArray'
+ v3 = 4
+
+ v3[0] = $N30
+ v3[1] = $N31
+ v3[2] = $N32
+ v3[3] = $N33
+
+ .local pmc result
+ $P0 = typeof self
+ result = new $P0
+ setattribute result, 'vals', v3
+
+ .return(result)
+.endm
+
+# Standard footer for binop methods returning a vec4 = (vec3, w)
+.macro vec4_return_new_result_with_w(w)
+ .local pmc v3
+ v3 = new 'FixedFloatArray'
+ v3 = 4
+
+ v3[0] = $N30
+ v3[1] = $N31
+ v3[2] = $N32
+ v3[3] = .w
+
+ .local pmc result
+ $P0 = typeof self
+ result = new $P0
+ setattribute result, 'vals', v3
+
+ .return(result)
+.endm
+
+# A standard elementwise vec4 binop (vec4 op vec4 --> vec4)
+.macro vec4_vec4_vec4_binop(name, op)
+.sub .name :method
+ .vec4_extract_self_plus_vec_arg
+
+ $N30 = $N10 .op $N20
+ $N31 = $N11 .op $N21
+ $N32 = $N12 .op $N22
+ $N33 = $N13 .op $N23
+
+ .vec4_return_new_result
+.end
+.endm
+
+
+# A standard elementwise vec4-num binop (vec4 op num --> vec4)
+.macro vec4_num_vec4_binop(name, op)
+.sub .name :method
+ .vec4_extract_self_plus_num_arg
+
+ $N30 = $N10 .op N
+ $N31 = $N11 .op N
+ $N32 = $N12 .op N
+ $N33 = $N13 .op N
+
+ .vec4_return_new_result
+.end
+.endm
+
+
+=over 4
+
+=item Vec4 result = vec1.add(Vec4 vec2)
+
+=item Vec4 result = vec1.sub(Vec4 vec2)
+
+=item Vec4 result = vec1.mul(Vec4 vec2)
+
+=item Vec4 result = vec1.div(Vec4 vec2)
+
+=item Vec4 result = vec1.mod(Vec4 vec2)
+
+Calculate the elementwise addition, subtraction, multiplication, division,
+or modulus (C<vec1 [ + - * / % ] vec2>) and return a new C<Vec4> vector
+C<result>. No attempt is made in C<div> and C<mod> to prevent division by
+zero, XXX - SO WHAT HAPPENS?
+
+=cut
+
+.vec4_vec4_vec4_binop(add, +)
+
+.vec4_vec4_vec4_binop(sub, -)
+
+.vec4_vec4_vec4_binop(mul, *)
+
+.vec4_vec4_vec4_binop(div, /)
+
+.vec4_vec4_vec4_binop(mod, %)
+
+
+=item Vec4 result = vector.add_num(num N)
+
+=item Vec4 result = vector.sub_num(num N)
+
+=item Vec4 result = vector.mul_num(num N)
+
+=item Vec4 result = vector.div_num(num N)
+
+=item Vec4 result = vector.mod_num(num N)
+
+Calculate the elementwise addition, subtraction, multiplication, division,
+or modulus (C<vector [ + - * / % ] N>) and return a new C<Vec4> vector
+C<result>. No attempt is made in C<div_num> and C<mod_num> to prevent
+division by zero, XXX - SO WHAT HAPPENS?
+
+=cut
+
+.vec4_num_vec4_binop(add_num, +)
+
+.vec4_num_vec4_binop(sub_num, -)
+
+.vec4_num_vec4_binop(mul_num, *)
+
+.vec4_num_vec4_binop(div_num, /)
+
+.vec4_num_vec4_binop(mod_num, %)
+
+
+=back
+
+
+=head3 Other Operations
+
+=over 4
+
+=item Vec4 cp = vec1.cross(Vec4 vec2)
+
+Calculate the cross product C<vec1 cross vec2> (using only the first three
+elements of each vector), and return the result as a new C<Vec4> whose
+first three elements are the cross product and whose last element is 1.0.
+
+=cut
+
+.sub cross :method
+ .vec3_extract_self_plus_vec_arg
+
+ $N0 = $N11 * $N22
+ $N1 = $N21 * $N12
+ $N30 = $N0 - $N1
+
+ $N2 = $N20 * $N12
+ $N3 = $N10 * $N22
+ $N31 = $N2 - $N3
+
+ $N4 = $N10 * $N21
+ $N5 = $N20 * $N11
+ $N32 = $N4 - $N5
+
+ .vec4_return_new_result_with_w(1.0)
+.end
+
+
+=item num dp = vec1.dot(Vec4 vec2)
+
+Calculate the dot product C<vec1 dot vec2> and return the result as a num.
+
+=cut
+
+.sub dot :method
+ .vec4_extract_self_plus_vec_arg
+
+ $N30 = $N10 * $N20
+ $N31 = $N11 * $N21
+ $N32 = $N12 * $N22
+ $N33 = $N13 * $N23
+
+ .local num result
+ result = $N30 + $N31
+ result += $N32
+ result += $N33
+
+ .return(result)
+.end
+
+
+=item num dp3 = vec1.dot3(Vec4 vec2)
+
+Calculate the dot product C<vec1 dot vec2>, considering only the first
+three elements of each vector, and return the result as a num.
+
+=cut
+
+.sub dot3 :method
+ .vec3_extract_self_plus_vec_arg
+
+ $N30 = $N10 * $N20
+ $N31 = $N11 * $N21
+ $N32 = $N12 * $N22
+
+ .local num result
+ result = $N30 + $N31
+ result += $N32
+
+ .return(result)
+.end
+
+
+=item num len = vector.length()
+
+Calculate the length of C<vector> as C<sqrt(vector dot vector)>, and return
+the result as a num.
+
+=cut
+
+.sub length :method
+ $N0 = self.'dot'(self)
+ $N1 = sqrt $N0
+
+ .return($N1)
+.end
+
+
+=item num len3 = vector.length3()
+
+Calculate the length of C<vector> as C<sqrt(vector dot3 vector)> (thus
+considering only the first three elements), and return the result as a num.
+
+=cut
+
+.sub length3 :method
+ $N0 = self.'dot3'(self)
+ $N1 = sqrt $N0
+
+ .return($N1)
+.end
+
+
+=item Vec4 result = vector.normalize()
+
+Calculate a normalized version of C<vector> as C<vector / length(vector)>,
+returning the result as a new C<Vec4>.
+
+=cut
+
+.sub normalize :method
+ $N0 = self.'length'()
+ $P0 = self.'div_num'($N0)
+
+ .return($P0)
+.end
+
+=item num dist = vec1.distance(vec2)
+
+Treat two vectors C<vec1> and C<vec2> as points and determine the distance
+between them as C<length(vec1 - vec2)>, returning the result as a num.
+
+=cut
+
+.sub distance :method
+ .param pmc vec2
+
+ $P0 = self.'sub'(vec2)
+ $N0 = $P0.'length'()
+
+ .return($N0)
+.end
+
+
+=item num dist3 = vec1.distance3(vec2)
+
+Treat two vectors C<vec1> and C<vec2> as points and determine the distance
+between them as C<length3(vec1 - vec2)> (thus considering only the first
+three elements), and returning the result as a num.
+
+=cut
+
+.sub distance3 :method
+ .param pmc vec2
+
+ $P0 = self.'sub'(vec2)
+ $N0 = $P0.'length3'()
+
+ .return($N0)
+.end
+
+=back
+
+
+
+=head3 Miscellaneous Methods
+
+=over 4
+
+=item __dump(pmc dumper, str label)
+
+Callback function for Parrot's C<Data::Dumper> clone.
+
+=cut
+
+.sub __dump :method
+ .param pmc dumper
+ .param string label
+
+ $P0 = getattribute self, 'vals'
+
+ print '[ '
+ $I0 = 0
+ dump_loop:
+ $S0 = $P0[$I0]
+ print $S0
+ inc $I0
+ if $I0 >= 4 goto dump_loop_end
+ print ', '
+ goto dump_loop
+ dump_loop_end:
+ print ' ]'
+.end
+
+=back
+
+
+=head1 ROADMAP
+
+Over time, the API provided by this module will grow to incorporate
+related low-level operations, such as quaternion ops. However, it will
+B<not> include high level components such as particle systems and physics
+simulations. These are properly the domain of other modules that use
+this one, or NCI wrappers for libraries such as ODE (L<http://www.ode.org/>)
+and Bullet (L<http://www.bulletphysics.com/wordpress/>).
+
+In order to allow the greatest audience of users, this module will track
+the evolving experimental API for HLL access to PIR modules.
+
+=cut
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/io_cleanups/src/gc/alloc_memory.c
==============================================================================
--- branches/io_cleanups/src/gc/alloc_memory.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/gc/alloc_memory.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -343,6 +343,32 @@
/*
+=item C<char * mem_sys_strdup(const char *src)>
+
+Copy a C string to a new block of memory allocated with mem_sys_allocate,
+that can be later deallocated with mem_sys_free.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+char *
+mem_sys_strdup(ARGIN(const char *src))
+{
+ ASSERT_ARGS(mem_sys_strdup)
+
+ size_t l = strlen(src);
+ char *result = (char *)mem_sys_allocate(l + 1);
+ memcpy(result, src, l);
+ result[l] = '\0';
+ return result;
+}
+
+/*
+
=back
=cut
Modified: branches/io_cleanups/src/gc/api.c
==============================================================================
--- branches/io_cleanups/src/gc/api.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/gc/api.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -325,7 +325,8 @@
{
ASSERT_ARGS(Parrot_gc_add_pmc_ext)
Small_Object_Pool * const pool = interp->arena_base->pmc_ext_pool;
- pmc->pmc_ext = (PMC_EXT *)pool->get_free_object(interp, pool);
+ if (!pmc->pmc_ext)
+ pmc->pmc_ext = (PMC_EXT *)pool->get_free_object(interp, pool);
if (!pmc->pmc_ext)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
"Parrot VM: PMC_EXT allocation failed!\n");
@@ -362,17 +363,16 @@
Arenas * const arena_base = interp->arena_base;
Small_Object_Pool * const ext_pool = arena_base->pmc_ext_pool;
+ if (!p->pmc_ext)
+ return;
+
if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) {
MUTEX_DESTROY(PMC_sync(p)->pmc_lock);
mem_internal_free(PMC_sync(p));
PMC_sync(p) = NULL;
}
-
- if (p->pmc_ext) {
- ext_pool->add_free_object(interp, ext_pool, p->pmc_ext);
- ext_pool->num_free_objects++;
- }
-
+ ext_pool->add_free_object(interp, ext_pool, p->pmc_ext);
+ ext_pool->num_free_objects++;
p->pmc_ext = NULL;
}
@@ -394,6 +394,9 @@
ASSERT_ARGS(Parrot_gc_add_pmc_sync)
if (!PObj_is_PMC_EXT_TEST(pmc))
Parrot_gc_add_pmc_ext(interp, pmc);
+ if (PMC_sync(pmc))
+ /* This mutex already exists, leave it alone. */
+ return;
PMC_sync(pmc) = mem_allocate_typed(Sync);
if (!PMC_sync(pmc))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
Modified: branches/io_cleanups/src/interp/inter_create.c
==============================================================================
--- branches/io_cleanups/src/interp/inter_create.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/interp/inter_create.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -466,6 +466,7 @@
interp->thread_data = NULL;
}
+ parrot_free_vtables(interp);
mem_sys_free(interp);
}
}
Modified: branches/io_cleanups/src/jit/i386/jit_defs.c
==============================================================================
--- branches/io_cleanups/src/jit/i386/jit_defs.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/jit/i386/jit_defs.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -2277,13 +2277,13 @@
case 'b': /* buffer (void*) pass PObj_bufstart(SReg) */
emitm_call_cfunc(pc, get_nci_S);
emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
- (size_t) &PObj_bufstart((STRING *) 0));
+ (size_t) &PObj_bufstart((STRING *) NULL));
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, args_offset);
break;
case 'B': /* buffer (void**) pass &PObj_bufstart(SReg) */
emitm_call_cfunc(pc, get_nci_S);
emitm_lea_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
- (size_t) &PObj_bufstart((STRING *) 0));
+ (size_t) &PObj_bufstart((STRING *) NULL));
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, args_offset);
break;
case 'S':
Modified: branches/io_cleanups/src/key.c
==============================================================================
--- branches/io_cleanups/src/key.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/key.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -440,13 +440,11 @@
*/
PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
+PARROT_CAN_RETURN_NULL
STRING *
key_string(PARROT_INTERP, ARGIN(PMC *key))
{
ASSERT_ARGS(key_string)
- INTVAL int_key;
- FLOATVAL num_key;
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
/* remember to COW strings instead of returning them directly */
@@ -460,6 +458,7 @@
}
case KEY_string_FLAG | KEY_register_FLAG:
{
+ INTVAL int_key;
STRING *s;
GETATTR_Key_int_key(interp, key, int_key);
s = REG_STR(interp, int_key);
@@ -469,25 +468,36 @@
}
case KEY_pmc_FLAG | KEY_register_FLAG:
{
+ INTVAL int_key;
PMC *reg;
GETATTR_Key_int_key(interp, key, int_key);
reg = REG_PMC(interp, int_key);
return VTABLE_get_string(interp, reg);
}
case KEY_integer_FLAG:
+ {
+ INTVAL int_key;
GETATTR_Key_int_key(interp, key, int_key);
return Parrot_str_from_int(interp, int_key);
+ }
case KEY_integer_FLAG | KEY_register_FLAG:
+ {
+ INTVAL int_key;
GETATTR_Key_int_key(interp, key, int_key);
return Parrot_str_from_int(interp, REG_INT(interp, int_key));
-
+ }
case KEY_number_FLAG:
+ {
+ FLOATVAL num_key;
GETATTR_Key_num_key(interp, key, num_key);
return Parrot_str_from_num(interp, num_key);
+ }
case KEY_number_FLAG | KEY_register_FLAG:
+ {
+ INTVAL int_key;
GETATTR_Key_int_key(interp, key, int_key);
return Parrot_str_from_num(interp, REG_NUM(interp, int_key));
-
+ }
default:
case KEY_pmc_FLAG:
return VTABLE_get_string(interp, key);
@@ -607,11 +617,13 @@
{
ASSERT_ARGS(key_mark)
const UINTVAL flags = PObj_get_FLAGS(key) & KEY_type_FLAGS;
- PMC *next_key;
- STRING *str_key;
if (flags == KEY_string_FLAG) {
+ STRING *str_key;
GETATTR_Key_str_key(interp, key, str_key);
+
+ /* XXX str_key can be NULL from GETATTR_Key_str_key, */
+ /* so shouldn't be marked. */
Parrot_gc_mark_PObj_alive(interp, (PObj *)str_key);
}
@@ -620,13 +632,13 @@
* the bucket_index and not the next key component
* Note to self: shoot whoever thought this was a good idea.
*/
- if (flags == KEY_hash_iterator_FLAGS)
- return;
-
- /* if iteration hasn't started, above flag isn't set yet */
- GETATTR_Key_next_key(interp, key, next_key);
- if (next_key && (void *)next_key != (void *)INITBucketIndex)
- Parrot_gc_mark_PObj_alive(interp, (PObj *)next_key);
+ if (flags != KEY_hash_iterator_FLAGS) {
+ PMC *next_key;
+ /* if iteration hasn't started, above flag isn't set yet */
+ GETATTR_Key_next_key(interp, key, next_key);
+ if (next_key && (void *)next_key != (void *)INITBucketIndex)
+ Parrot_gc_mark_PObj_alive(interp, (PObj *)next_key);
+ }
}
@@ -657,7 +669,7 @@
INTVAL int_key;
STRING *str_key;
- for (;key;) {
+ while (key != NULL) {
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
Modified: branches/io_cleanups/src/library.c
==============================================================================
--- branches/io_cleanups/src/library.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/library.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -788,7 +788,7 @@
char * const env = Parrot_getenv("PARROT_RUNTIME", &free_it);
if (env)
- return free_it ? env : str_dup(env);
+ return free_it ? env : mem_sys_strdup(env);
else {
PMC * const config_hash =
VTABLE_get_pmc_keyed_int(interp, interp->iglobals, (INTVAL) IGLOBALS_CONFIG_HASH);
@@ -799,7 +799,7 @@
return Parrot_str_to_cstring(interp, s);
}
else
- return str_dup(".");
+ return mem_sys_strdup(".");
}
}
Modified: branches/io_cleanups/src/packfile.c
==============================================================================
--- branches/io_cleanups/src/packfile.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/packfile.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -2388,7 +2388,7 @@
self->size = 0;
self->data = NULL;
self->id = 0;
- self->name = str_dup(name);
+ self->name = mem_sys_strdup(name);
}
@@ -2733,7 +2733,7 @@
}
/* find seg e.g. CODE_DB => CODE and attach it */
- code_name = str_dup(debug->base.name);
+ code_name = mem_sys_strdup(debug->base.name);
str_len = strlen(code_name);
code_name[str_len - 3] = '\0';
code = (PackFile_ByteCode *)PackFile_find_segment(interp,
@@ -3509,7 +3509,7 @@
self->fixups[i] = mem_allocate_typed(PackFile_FixupEntry);
self->fixups[i]->type = type;
- self->fixups[i]->name = str_dup(label);
+ self->fixups[i]->name = mem_sys_strdup(label);
self->fixups[i]->offset = offs;
self->fixups[i]->seg = self->code;
}
@@ -4310,7 +4310,7 @@
}
/* Need to associate this segment with the applicable code segment. */
- code_name = str_dup(self->base.name);
+ code_name = mem_sys_strdup(self->base.name);
str_len = strlen(code_name);
code_name[str_len - 4] = '\0';
code = (PackFile_ByteCode *)PackFile_find_segment(interp,
Modified: branches/io_cleanups/src/parrot_debugger.c
==============================================================================
--- branches/io_cleanups/src/parrot_debugger.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/parrot_debugger.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -184,7 +184,7 @@
Parrot_pbc_load(interp, pf);
IMCC_push_parser_state(interp);
- IMCC_INFO(interp)->state->file = strdup(filename);
+ IMCC_INFO(interp)->state->file = mem_sys_strdup(filename);
if (!(imc_yyin_set(fopen(filename, "r"), yyscanner))) {
IMCC_fatal_standalone(interp, EXCEPTION_PIO_ERROR,
Modified: branches/io_cleanups/src/pbc_merge.c
==============================================================================
--- branches/io_cleanups/src/pbc_merge.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pbc_merge.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -378,7 +378,7 @@
/* Stash produced bytecode. */
bc_seg->base.data = bc;
bc_seg->base.size = cursor;
- bc_seg->base.name = str_dup("MERGED");
+ bc_seg->base.name = mem_sys_strdup("MERGED");
return bc_seg;
}
Modified: branches/io_cleanups/src/pmc.c
==============================================================================
--- branches/io_cleanups/src/pmc.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pmc.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -298,16 +298,12 @@
/* Do we need one? */
if (flags & VTABLE_PMC_NEEDS_EXT) {
/* If we need an ext area, go allocate one */
- if (!has_ext)
- Parrot_gc_add_pmc_ext(interp, pmc);
+ Parrot_gc_add_pmc_ext(interp, pmc);
newflags |= PObj_is_PMC_EXT_FLAG;
- PARROT_ASSERT(pmc->pmc_ext != NULL);
PARROT_ASSERT((newflags & PObj_is_PMC_EXT_FLAG) != 0);
}
else {
- if (has_ext)
- Parrot_gc_free_pmc_ext(interp, pmc);
- pmc->pmc_ext = NULL;
+ Parrot_gc_free_pmc_ext(interp, pmc);
PMC_data(pmc) = NULL;
newflags &= ~PObj_is_PMC_EXT_FLAG;
PARROT_ASSERT((newflags & PObj_is_PMC_EXT_FLAG) == 0);
@@ -752,13 +748,9 @@
interp->vtables[type]->pmc_class = _class;
}
else {
- if (PObj_is_PMC_EXT_TEST(_class))
- Parrot_gc_free_pmc_ext(interp, _class);
-
+ Parrot_gc_free_pmc_ext(interp, _class);
gc_flag_CLEAR(is_special_PMC, _class);
-
PObj_is_PMC_shared_CLEAR(_class);
-
interp->vtables[type]->pmc_class = _class;
}
Modified: branches/io_cleanups/src/pmc/multisub.pmc
==============================================================================
--- branches/io_cleanups/src/pmc/multisub.pmc Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pmc/multisub.pmc Sat Jun 27 01:33:11 2009 (r39805)
@@ -84,7 +84,7 @@
return SUPER(key);
}
- VTABLE PMC *get_pmc_keyed_string(STRING *s) {
+ VTABLE PMC *get_pmc_keyed_str(STRING *s) {
PMC * const sub = Parrot_mmd_sort_manhattan(INTERP, SELF);
if (PMC_IS_NULL(sub))
Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable methods.\n");
Modified: branches/io_cleanups/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/io_cleanups/src/pmc/parrotinterpreter.pmc Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pmc/parrotinterpreter.pmc Sat Jun 27 01:33:11 2009 (r39805)
@@ -242,8 +242,8 @@
PMC_data(SELF) = attrs;
create_interp(SELF, INTERP);
PARROT_ASSERT(attrs->interp);
- PObj_active_destroy_SET(SELF);
}
+ PObj_active_destroy_SET(SELF);
}
/*
Modified: branches/io_cleanups/src/pmc/parrotrunningthread.pmc
==============================================================================
--- branches/io_cleanups/src/pmc/parrotrunningthread.pmc Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pmc/parrotrunningthread.pmc Sat Jun 27 01:33:11 2009 (r39805)
@@ -50,6 +50,7 @@
mem_allocate_zeroed_typed(Parrot_ParrotRunningThread_attributes);
attrs->tid = -1;
PMC_data(SELF) = attrs;
+ PObj_active_destroy_SET(SELF);
}
/*
Modified: branches/io_cleanups/src/pmc/parrotthread.pmc
==============================================================================
--- branches/io_cleanups/src/pmc/parrotthread.pmc Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pmc/parrotthread.pmc Sat Jun 27 01:33:11 2009 (r39805)
@@ -70,7 +70,6 @@
pmc_reuse(interp, thread, enum_class_ParrotRunningThread, 0);
- PObj_active_destroy_CLEAR(thread);
PObj_custom_mark_CLEAR(thread);
VTABLE_set_integer_native(interp, thread, tid);
Modified: branches/io_cleanups/src/pmc/stringhandle.pmc
==============================================================================
--- branches/io_cleanups/src/pmc/stringhandle.pmc Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/pmc/stringhandle.pmc Sat Jun 27 01:33:11 2009 (r39805)
@@ -220,7 +220,7 @@
SET_ATTR_mode(INTERP, SELF, open_mode);
}
- Parrot_io_open(INTERP, SELF, filename, open_mode);
+ SELF = Parrot_io_open(INTERP, SELF, filename, open_mode);
RETURN(PMC *SELF);
}
Modified: branches/io_cleanups/src/stacks.c
==============================================================================
--- branches/io_cleanups/src/stacks.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/stacks.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -335,8 +335,8 @@
ARGOUT_NULLOK(void *where), Stack_entry_type type)
{
ASSERT_ARGS(stack_pop)
- Stack_Chunk_t *cur_chunk = *stack_p;
- Stack_Entry_t * const entry =
+ Stack_Chunk_t * const cur_chunk = *stack_p;
+ Stack_Entry_t * const entry =
(Stack_Entry_t *)stack_prepare_pop(interp, stack_p);
/* Types of 0 mean we don't care */
Modified: branches/io_cleanups/src/string/charset/unicode.c
==============================================================================
--- branches/io_cleanups/src/string/charset/unicode.c Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/src/string/charset/unicode.c Sat Jun 27 01:33:11 2009 (r39805)
@@ -417,11 +417,18 @@
{
ASSERT_ARGS(upcase)
#if PARROT_HAS_ICU
-
UErrorCode err;
int dest_len, src_len, needed;
+#endif
if (src->bufused == src->strlen
+ && src->encoding == Parrot_utf8_encoding_ptr) {
+ Parrot_ascii_charset_ptr->downcase(interp, src);
+ return;
+ }
+
+#if PARROT_HAS_ICU
+ if (src->bufused == src->strlen
&& src->encoding == Parrot_utf8_encoding_ptr) {
Parrot_ascii_charset_ptr->upcase(interp, src);
return;
@@ -510,17 +517,18 @@
downcase(PARROT_INTERP, ARGIN(STRING *src))
{
ASSERT_ARGS(downcase)
+#if PARROT_HAS_ICU
+ UErrorCode err;
+ int dest_len, src_len;
+#endif
+
if (src->bufused == src->strlen
- && src->encoding == Parrot_utf8_encoding_ptr) {
+ && src->encoding == Parrot_utf8_encoding_ptr) {
Parrot_ascii_charset_ptr->downcase(interp, src);
return;
}
- else {
-#if PARROT_HAS_ICU
-
- UErrorCode err;
- int dest_len, src_len;
+#if PARROT_HAS_ICU
src = Parrot_utf16_encoding_ptr->to_encoding(interp, src, NULL);
/*
U_CAPI int32_t U_EXPORT2
@@ -554,7 +562,6 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LIBRARY_ERROR,
"no ICU lib loaded");
#endif
- }
}
Modified: branches/io_cleanups/t/compilers/imcc/syn/regressions.t
==============================================================================
--- branches/io_cleanups/t/compilers/imcc/syn/regressions.t Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/t/compilers/imcc/syn/regressions.t Sat Jun 27 01:33:11 2009 (r39805)
@@ -6,7 +6,7 @@
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 14;
+use Parrot::Test tests => 15;
pir_error_output_like( <<'CODE', <<'OUT', 'invalid get_results syntax');
.sub main :main
@@ -191,6 +191,15 @@
OUT
}
+
+pir_error_output_like( <<'CODE', <<'OUT', 'No segfault from syntax error, RT #60172');
+.sub 'main'
+ ($S0) = 'blah'(:pir_only=>1)
+.end
+CODE
+/syntax error.+unexpected/
+OUT
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Modified: branches/io_cleanups/t/oo/metamodel.t
==============================================================================
--- branches/io_cleanups/t/oo/metamodel.t Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/t/oo/metamodel.t Sat Jun 27 01:33:11 2009 (r39805)
@@ -1,4 +1,4 @@
-#!./parrot
+#!parrot
# Copyright (C) 2007-2008, Parrot Foundation.
# $Id$
Modified: branches/io_cleanups/t/op/ifunless.t
==============================================================================
--- branches/io_cleanups/t/op/ifunless.t Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/t/op/ifunless.t Sat Jun 27 01:33:11 2009 (r39805)
@@ -1,13 +1,7 @@
-#!perl
+#!parrot
# Copyright (C) 2001-2005, Parrot Foundation.
# $Id$
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More;
-use Parrot::Test tests => 6;
-
=head1 NAME
t/op/ifunless.t - If/Unless
@@ -22,181 +16,203 @@
=cut
-pasm_output_is( <<CODE, <<OUTPUT, "if_i_ic" );
- set I0, 2147483647
- set I1, -2147483648
- set I2, 0
-
- if I0, ONE
- branch ERROR
- print "bad\\n"
-
-ONE:
- print "ok 1\\n"
- if I1, TWO
- branch ERROR
- print "bad\\n"
-
-TWO:
- print "ok 2\\n"
- if I2, ERROR
- branch THREE
- print "bad\\n"
-
-THREE:
- print "ok 3\\n"
- end
-
-ERROR:
- print "bad\\n"
- end
-CODE
-ok 1
-ok 2
-ok 3
-OUTPUT
-
-pasm_output_is( <<CODE, <<OUTPUT, "if_n_ic" );
- set N0, 0.1
- set N1, -0.1
- set N2, 0.0
-
- if N0, ONE
- branch ERROR
- print "bad\\n"
-
-ONE:
- print "ok 1\\n"
- if N1, TWO
- branch ERROR
- print "bad\\n"
-
-TWO:
- print "ok 2\\n"
- if N2, ERROR
- branch THREE
- print "bad\\n"
-
-THREE:
- print "ok 3\\n"
- end
-
-ERROR:
- print "bad\\n"
- end
-CODE
-ok 1
-ok 2
-ok 3
-OUTPUT
-
-pasm_output_is( <<CODE, <<OUTPUT, "if_s_ic" );
- set S0, "Hello World"
- set S1, ""
-
- if S0, ONE
- branch ERROR
- print "bad\\n"
-
-ONE:
- print "ok 1\\n"
- if S1, ERROR
- branch TWO
- print "bad\\n"
-
-TWO:
- print "ok 2\\n"
- end
-
-ERROR:
- print "bad\\n"
- end
-CODE
-ok 1
-ok 2
-OUTPUT
-
-pasm_output_is( <<CODE, <<OUTPUT, "unless_i_ic" );
- set I0, 0
- set I1, -2147483648
-
- unless I0, ONE
- branch ERROR
- print "bad\\n"
-
-ONE:
- print "ok 1\\n"
- unless I1, ERROR
- branch TWO
- print "bad\\n"
-
-TWO:
- print "ok 2\\n"
- end
-
-ERROR:
- print "bad\\n"
- end
-CODE
-ok 1
-ok 2
-OUTPUT
-
-pasm_output_is( <<CODE, <<OUTPUT, "unless_n_ic" );
- set N0, 0.0
- set N1, -0.1
-
- unless N0, ONE
- branch ERROR
- print "bad\\n"
-
-ONE:
- print "ok 1\\n"
- unless N1, ERROR
- branch TWO
- print "bad\\n"
-
-TWO:
- print "ok 2\\n"
- end
-
-ERROR:
- print "bad\\n"
- end
-CODE
-ok 1
-ok 2
-OUTPUT
-
-pasm_output_is( <<CODE, <<OUTPUT, "unless_s_ic" );
- set S1, "Hello World"
- set S0, ""
-
- unless S0, ONE
- branch ERROR
- print "bad\\n"
-
-ONE:
- print "ok 1\\n"
- unless S1, ERROR
- branch TWO
- print "bad\\n"
-
-TWO:
- print "ok 2\\n"
- end
-
-ERROR:
- print "bad\\n"
- end
-CODE
-ok 1
-ok 2
-OUTPUT
+.const int TESTS = 14
+
+.sub 'test' :main
+ .include 'test_more.pir'
+
+ plan(TESTS)
+
+ if_i_ic_positive()
+ if_i_ic_negative()
+ if_i_ic_zero()
+ if_n_ic_positive()
+ if_n_ic_negative()
+ if_n_ic_zero()
+ if_s_ic_helloworld()
+ if_s_ic_empty()
+
+ unless_i_ic_zero()
+ unless_i_ic_negative()
+ unless_n_ic_zero()
+ unless_n_ic_negative()
+ unless_s_ic_empty()
+ unless_s_ic_helloworld()
+
+.end
+
+.sub 'if_i_ic_positive'
+ $I0 = 2147483647
+
+ $I1 = 0
+ if $I0 goto if_i_ic_positive_ok
+ goto if_i_ic_positive_end
+
+ if_i_ic_positive_ok:
+ $I1 = 1
+ if_i_ic_positive_end:
+ ok($I1, "if_i_ic with a positive integer")
+.end
+
+.sub 'if_i_ic_negative'
+ $I0 = -2147483647
+
+ $I1 = 0
+ if $I0 goto if_i_ic_negative_ok
+ goto if_i_ic_negative_end
+
+ if_i_ic_negative_ok:
+ $I1 = 1
+ if_i_ic_negative_end:
+ ok($I1, "if_i_ic with a negative integer")
+.end
+
+.sub 'if_i_ic_zero'
+ $I0 = 0
+
+ $I1 = 0
+ if $I0 goto if_i_ic_zero_end
+ $I1 = 1
+
+ if_i_ic_zero_end:
+ ok($I1, "if_i_ic with integer zero")
+.end
+
+.sub 'if_n_ic_positive'
+ $N0 = 0.1
+
+ $I1 = 0
+ if $N0 goto if_n_ic_positive_ok
+ goto if_n_ic_positive_end
+
+ if_n_ic_positive_ok:
+ $I1 = 1
+ if_n_ic_positive_end:
+ ok($I1, "if_n_ic with a positive float")
+.end
+
+.sub 'if_n_ic_negative'
+ $N0 = -0.1
+
+ $I1 = 0
+ if $N0 goto if_n_ic_negative_ok
+ goto if_n_ic_negative_end
+
+ if_n_ic_negative_ok:
+ $I1 = 1
+ if_n_ic_negative_end:
+ ok($I1, "if_n_ic with a negative float")
+.end
+
+.sub 'if_n_ic_zero'
+ $N0 = 0.0
+
+ $I1 = 0
+ if $N0 goto if_n_ic_zero_end
+ $I1 = 1
+
+ if_n_ic_zero_end:
+ ok($I1, "if_n_ic with float zero")
+.end
+
+.sub 'if_s_ic_helloworld'
+ $S0 = "Hello World"
+
+ $I1 = 0
+ if $S0 goto if_s_ic_helloworld_ok
+ goto if_s_ic_helloworld_end
+
+ if_s_ic_helloworld_ok:
+ $I1 = 1
+ if_s_ic_helloworld_end:
+ ok($I1, "if_s_ic with a non-empty string")
+.end
+
+.sub 'if_s_ic_empty'
+ $S0 = ''
+
+ $I1 = 0
+ if $S0 goto if_s_ic_empty_end
+ $I1 = 1
+
+ if_s_ic_empty_end:
+ ok($I1, "if_n_ic with the empty string")
+.end
+
+.sub 'unless_i_ic_zero'
+ $I0 = 0
+
+ $I1 = 0
+ unless $I0 goto unless_i_ic_zero_ok
+ goto unless_i_ic_zero_end
+
+ unless_i_ic_zero_ok:
+ $I1 = 1
+ unless_i_ic_zero_end:
+ ok($I1, "unless_i_ic with integer zero")
+.end
+
+.sub 'unless_i_ic_negative'
+ $I0 = -2147483648
+
+ $I1 = 0
+ unless $I0 goto unless_i_ic_negative_end
+ $I1 = 1
+
+ unless_i_ic_negative_end:
+ ok($I1, "unless_i_ic with a negative integer")
+.end
+
+.sub 'unless_n_ic_zero'
+ $N0 = 0.0
+
+ $I1 = 0
+ unless $N0 goto unless_n_ic_zero_ok
+ goto unless_n_ic_zero_end
+
+ unless_n_ic_zero_ok:
+ $I1 = 1
+ unless_n_ic_zero_end:
+ ok($I1, "unless_n_ic with float zero")
+.end
+
+.sub 'unless_n_ic_negative'
+ $N0 = -0.1
+
+ $I1 = 0
+ unless $N0 goto unless_n_ic_negative_end
+ $I1 = 1
+
+ unless_n_ic_negative_end:
+ ok($I1, "unless_n_ic with a negative float")
+.end
+
+.sub 'unless_s_ic_empty'
+ $S0 = ''
+
+ $I1 = 0
+ unless $S0 goto unless_s_ic_empty_ok
+ goto unless_s_ic_empty_end
+
+ unless_s_ic_empty_ok:
+ $I1 = 1
+ unless_s_ic_empty_end:
+ ok($I1, "unless_s_ic with the empty string")
+.end
+
+.sub 'unless_s_ic_helloworld'
+ $S0 = "Hello World"
+
+ $I1 = 0
+ unless $S0 goto unless_s_ic_helloworld_end
+ $I1 = 1
+
+ unless_s_ic_helloworld_end:
+ ok($I1, "unless_s_ic with a non-empty string")
+.end
# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
+# mode: pir
# fill-column: 100
# End:
-# vim: expandtab shiftwidth=4:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/io_cleanups/t/op/io.t
==============================================================================
--- branches/io_cleanups/t/op/io.t Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/t/op/io.t Sat Jun 27 01:33:11 2009 (r39805)
@@ -1,14 +1,7 @@
-#!perl
+#!parrot
# Copyright (C) 2008, Parrot Foundation.
# $Id$
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-
-use Test::More;
-use Parrot::Test tests => 4;
-
=head1 NAME
t/op/io.t - Testing io opcodes
@@ -23,120 +16,135 @@
=cut
-pir_output_is( <<'CODE', <<'OUTPUT', 'open with null filename' );
-.sub main
- push_eh failed
+.const int TESTS = 4
+
+.sub 'main' :main
+ .include 'test_more.pir'
+
+ plan(TESTS)
+
+ open_null_filename()
+ open_null_mode()
+ open_pipe_for_reading()
+ open_pipe_for_writing()
+.end
+
+.sub 'open_null_filename'
+ push_eh open_null_filename_failed
$P0 = open $S0, '<'
- say 'never'
- goto finish
-failed:
- say 'Catched'
-finish:
-.end
-CODE
-Catched
-OUTPUT
-
-pir_output_is( <<'CODE', <<'OUTPUT', 'open with null mode' );
-.sub main
- push_eh failed
+ nok(1, 'open with null filename')
+ .return ()
+
+ open_null_filename_failed:
+ ok(1, 'open with null filename')
+.end
+
+.sub 'open_null_mode'
+ push_eh open_null_mode_failed
$P0 = open 'some_name', $S0
- say 'never'
- goto finish
-failed:
- say 'Catched'
-finish:
-.end
-CODE
-Catched
-OUTPUT
-
-TODO: {
-#local $TODO = 'Unimplemented in this platform, TT #661' unless $^O =~ /linux|darwin|MSWin32/;
-local $TODO = "Pipes are being redone";
-
-pir_output_like( <<'CODE', <<'OUTPUT', 'open pipe for reading' );
-.include 'iglobals.pasm'
-
-.sub testreadpipe :main
- .local pmc interp
- interp = getinterp
- .local pmc conf
- conf = interp[.IGLOBALS_CONFIG_HASH]
- .local string command
- command = conf['build_dir']
- .local string aux
- aux = conf['slash']
- command .= aux
- aux = conf['test_prog']
- command .= aux
- aux = conf['exe']
- command .= aux
- command .= ' -V'
-
- .local pmc pipe
- pipe = open command, 'rp'
- unless pipe goto failed
- .local string line
-nextline:
- line = readline pipe
- print line
- if pipe goto nextline
- .return()
-failed:
- say 'FAILED'
-.end
-CODE
-/This is Parrot.*/
-OUTPUT
-
-}
-
-TODO: {
-#local $TODO = 'Unimplemented in this platform, TT #661' unless $^O =~ /linux|darwin|MSWin32/;
-local $TODO = "Pipes are being redone";
-
-pir_output_is( <<'CODE', <<'OUTPUT', 'open pipe for writing' );
-.include 'iglobals.pasm'
-
-.sub testwritepipe :main
- .local pmc interp
- interp = getinterp
- .local pmc conf
- conf = interp[.IGLOBALS_CONFIG_HASH]
- .local string command
- command = conf['build_dir']
- .local string aux
- aux = conf['slash']
- command .= aux
- .local string filename
- filename .= command
- filename .= 'examples/pasm/cat.pasm'
- aux = conf['test_prog']
- command .= aux
- aux = conf['exe']
- command .= aux
- command .= ' '
- command .= filename
-
- .local pmc pipe
- pipe = open command, 'wp'
- unless pipe goto failed
- pipe.'puts'("Hello, pipe!\n")
- close pipe
- .return()
-failed:
- say 'FAILED'
-.end
-CODE
-Hello, pipe!
-OUTPUT
+ nok(1, 'open with null mode')
+ .return ()
+
+ open_null_mode_failed:
+ ok(1, 'open with null mode')
+.end
-}
+.sub 'tt661_todo_test'
+ # Checks whether the platform is linux, MSWin32, darwin: on other
+ # platforms, the following tests are todo'ed.
+ $S0 = sysinfo 4
+ if $S0 == 'linux' goto tt661_ok
+ if $S0 == 'MSWin32' goto tt661_ok
+ if $S0 == 'darwin' goto tt661_ok
+
+ .return (0)
+
+ tt661_ok:
+ .return(1)
+.end
+
+.sub 'open_pipe_for_reading'
+ $I0 = tt661_todo_test()
+ unless $I0 goto open_pipe_for_reading_todoed
+
+ .include 'iglobals.pasm'
+
+ .local pmc interp
+ interp = getinterp
+
+ .local pmc conf
+ conf = interp[.IGLOBALS_CONFIG_HASH]
+
+ .local string command
+ command = conf['build_dir']
+
+ .local string aux
+ aux = conf['slash']
+ command .= aux
+ aux = conf['test_prog']
+ command .= aux
+ aux = conf['exe']
+ command .= aux
+ command .= ' -V'
+
+ .local pmc pipe
+ pipe = open command, 'rp'
+ unless pipe goto open_pipe_for_reading_failed
+ .local string line
+ line = readline pipe
+ like('This is Parrot', ":s This is Parrot", 'open pipe for reading')
+ .return()
+
+ open_pipe_for_reading_failed:
+ nok(1, 'open pipe for reading')
+ .return ()
+
+ open_pipe_for_reading_todoed:
+ todo(1, 'Unimplemented in this platform, TT #661')
+.end
+
+.sub 'open_pipe_for_writing'
+ .include 'iglobals.pasm'
+
+ .local pmc interp
+ interp = getinterp
+
+ .local pmc conf
+ conf = interp[.IGLOBALS_CONFIG_HASH]
+
+ .local string command
+ command = conf['build_dir']
+
+ .local string aux
+ aux = conf['slash']
+ command .= aux
+ .local string filename
+ filename .= command
+ filename .= 'examples/pasm/cat.pasm'
+ aux = conf['test_prog']
+ command .= aux
+ aux = conf['exe']
+ command .= aux
+ command .= ' '
+ command .= filename
+
+ .local pmc pipe
+ pipe = open command, 'wp'
+ unless pipe goto open_pipe_for_writing_failed
+ pipe.'puts'("ok - open pipe for writing\n")
+ close pipe
+ .return()
+
+ open_pipe_for_writing_failed:
+ nok(1, 'open pipe for writing')
+ .return ()
+
+ open_pipe_for_writing_todoed:
+ todo(1, 'Unimplemented in this platform, TT #661')
+.end
# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
+# mode: pir
# fill-column: 100
# End:
-# vim: expandtab shiftwidth=4:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/io_cleanups/t/steps/auto_icu-01.t
==============================================================================
--- branches/io_cleanups/t/steps/auto_icu-01.t Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/t/steps/auto_icu-01.t Sat Jun 27 01:33:11 2009 (r39805)
@@ -403,13 +403,27 @@
\$stderr,
);
- like($stdout, qr/Adding -I $icuheaders to ccflags for icu headers/,
- "Got expected verbose output");
+ if ($icuheaders =~ /\s/) {
+ like($stdout, qr/Adding -I \"\Q$icuheaders\E\" to ccflags for icu headers/,
+ "Got expected verbose output");
+ }
+ else {
+ like($stdout, qr/Adding -I \Q$icuheaders\E to ccflags for icu headers/,
+ "Got expected verbose output");
+ }
+}
+if ($icuheaders =~ /\s/) {
+ like($conf->data->get( 'ccflags' ),
+ qr/-I \"\Q$icuheaders\E\"/,
+ "ccflags augmented as expected"
+ );
+}
+else {
+ like($conf->data->get( 'ccflags' ),
+ qr/-I \Q$icuheaders\E/,
+ "ccflags augmented as expected"
+ );
}
-like($conf->data->get( 'ccflags'),
- qr/-I $icuheaders/,
- "ccflags augmented as expected"
-);
$conf->data->set( ccflags => $status ); # re-set for next test
{
@@ -430,10 +444,19 @@
ok(! $stdout, "No verbose output, as expected");
}
-like($conf->data->get( 'ccflags'),
- qr/-I $icuheaders/,
- "ccflags augmented as expected"
-);
+
+if ($icuheaders =~ /\s/) {
+ like($conf->data->get( 'ccflags'),
+ qr/-I \"\Q$icuheaders\E\"/,
+ "ccflags augmented as expected"
+ );
+}
+else {
+ like($conf->data->get( 'ccflags'),
+ qr/-I \Q$icuheaders\E/,
+ "ccflags augmented as expected"
+ );
+}
$conf->data->set( ccflags => $status ); # re-set for next test
########## _set_no_configure_with_icu() ##########
@@ -652,7 +675,7 @@
"Got expected verbose output re --ldflags");
like($stdout, qr/icushared: captured/s,
"Got expected verbose output re icushared");
- like($stdout, qr/For icushared, found $icushared and $without/s,
+ like($stdout, qr/For icushared, found \Q$icushared\E and $without/s,
"Got expected verbose output re icushared");
like($stdout, qr/Trying $icuconfig with '--prefix'/s,
"Got expected verbose output re --prefix");
Modified: branches/io_cleanups/tools/dev/branch_status.pl
==============================================================================
--- branches/io_cleanups/tools/dev/branch_status.pl Fri Jun 26 21:30:44 2009 (r39804)
+++ branches/io_cleanups/tools/dev/branch_status.pl Sat Jun 27 01:33:11 2009 (r39805)
@@ -53,11 +53,8 @@
$newest->atts->{revision};
my $created_date = $oldest->first_child('date')->xml_text;
my $updated_date = $newest->first_child('date')->xml_text;
- my $author_txt;
- if (scalar keys %authors == 1) {
- $author_txt = $creator;
- }
- else {
+ my $author_txt = '';
+ if (scalar keys %authors != 1) {
my @counts;
foreach my $author (sort {$authors{$b} <=> $authors{$a}} keys %authors) {
push @counts, "$author [$authors{$author}]";
@@ -81,8 +78,11 @@
$revisions,
'| creator: {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<} |',
$creator,
+($author_txt ne '') ?
+(
'| authors: {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<} |',
$author_txt,
+): (),
'| created on: {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<} |',
$created_date,
'| updated on: {<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<} |',
More information about the parrot-commits
mailing list