Author: kjs
Date: Sun Dec 28 13:19:59 2008
New Revision: 34519
Modified:
trunk/compilers/pirc/new/bcgen.c
trunk/compilers/pirc/new/main.c
trunk/compilers/pirc/new/piremit.c
Log:
[pirc] fix a small bug; the output options is a bit messy.
+ implement add_const_key.
+ start of build_key, but imcc's version very complex to copy from.
Modified: trunk/compilers/pirc/new/bcgen.c
==============================================================================
--- trunk/compilers/pirc/new/bcgen.c (original)
+++ trunk/compilers/pirc/new/bcgen.c Sun Dec 28 13:19:59 2008
@@ -189,14 +189,17 @@
add_key_const(bytecode * const bc, PMC *key)>
Add a key constant to the constants list.
-XXX Implement this.
=cut
*/
int
add_key_const(bytecode * const bc, PMC *key) {
- return 0;
+ int index = new_const(bc);
+ PackFile_Constant *constant =
bc->interp->code->const_table->constants[index];
+ constant->type = PFC_KEY;
+ constant->u.key = key;
+ return index;
}
Modified: trunk/compilers/pirc/new/main.c
==============================================================================
--- trunk/compilers/pirc/new/main.c (original)
+++ trunk/compilers/pirc/new/main.c Sun Dec 28 13:19:59 2008
@@ -498,7 +498,7 @@
}
parse_file(flexdebug, file, filename, flags, 0, macrosize, outputfile);
-
+ fprintf(stderr, "done\n");
}
#endif
Modified: trunk/compilers/pirc/new/piremit.c
==============================================================================
--- trunk/compilers/pirc/new/piremit.c (original)
+++ trunk/compilers/pirc/new/piremit.c Sun Dec 28 13:19:59 2008
@@ -286,6 +286,8 @@
/* set iterator to first item */
subroutine *subiter = lexer->subs->next;
+ /* XXX for now this works */
+ lexer->outfile = stderr;
do {
@@ -382,10 +384,12 @@
/* set iterator to first item */
subroutine *subiter = lexer->subs->next;
- if (outfile)
+ if (outfile) {
lexer->outfile = fopen(outfile, "w");
- else
+ }
+ else {
lexer->outfile = stdout;
+ }
do {
@@ -496,6 +500,11 @@
}
+static void
+build_key(lexer_state * const lexer, key * const k) {
+
+}
+
/*
=item C<static void
@@ -576,6 +585,10 @@
iter = iter->next;
}
while (iter != sub->statements->next);
+
+ if (TEST_FLAG(sub->flags, SUB_FLAG_IMMEDIATE)) {
+ PackFile_fixup_subs(lexer->interp, PBC_IMMEDIATE, NULL);
+ }
}
/*