summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--configure.in1
-rw-r--r--mixlib/mix_parser.c1
-rw-r--r--mixlib/mix_scanner.l14
-rw-r--r--mixlib/testsuite/Makefile.am2
-rw-r--r--mixlib/testsuite/mix_parser_t.c31
-rw-r--r--samples/Makefile.am5
-rw-r--r--samples/isains.mixal (renamed from samples/isamixinstruction.mixal)0
l---------samples/mixasm1
l---------samples/mixvm1
-rw-r--r--samples/tests/.arch-inventory2
-rw-r--r--samples/tests/Makefile.am17
-rw-r--r--samples/tests/ldan.mixal1
-rw-r--r--samples/tests/stress2.mixal8
14 files changed, 49 insertions, 39 deletions
diff --git a/Makefile.am b/Makefile.am
index cfd46d1..0e4eb97 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -11,7 +11,7 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EXTRA_DIST = config.rpath ABOUT-NLS intltool-extract.in intltool-merge.in \
- intltool-update.in
+ intltool-update.in ChangeLog.1 ChangeLog.2
SUBDIRS = po intl doc lib mixlib mixguile mixutils mixgtk misc samples
distclean-local:
diff --git a/configure.in b/configure.in
index ca9f007..93eb082 100644
--- a/configure.in
+++ b/configure.in
@@ -140,6 +140,7 @@ mixgtk/Makefile
lib/Makefile
misc/Makefile
samples/Makefile
+samples/tests/Makefile
po/Makefile.in
intl/Makefile
)
diff --git a/mixlib/mix_parser.c b/mixlib/mix_parser.c
index 0dfcf81..a00886f 100644
--- a/mixlib/mix_parser.c
+++ b/mixlib/mix_parser.c
@@ -118,6 +118,7 @@ mix_parser_new (const gchar *in_file)
MIX_SRC_DEFEXT);
if ( f == NULL ) return NULL;
+
result = g_new (mix_parser_t, 1);
result->symbol_table = mix_symbol_table_new ();
result->ls_table = mix_symbol_table_new ();
diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l
index 1ad8eaa..db76057 100644
--- a/mixlib/mix_scanner.l
+++ b/mixlib/mix_scanner.l
@@ -168,7 +168,7 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
yy_flex_debug = getenv("FLEX_DEBUG");
#endif
yyin = mix_file_to_FILE (parser->in_file);
-
+ yyrestart (yyin);
%}
@@ -180,13 +180,19 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
<INITIAL>{
^\*.* /* eat comments */
. {
- if ( end ) return parser->status;
+ if (end)
+ {
+ return parser->status;
+ }
yyless (0);
BEGIN (LOC);
}
\n {
++lineno;
- if ( end ) return parser->status;
+ if (end)
+ {
+ return parser->status;
+ }
}
}
@@ -342,6 +348,8 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
parser->end = parser->loc_count;
end = TRUE;
if ( parser->status == MIX_PERR_NOCOMP ) parser->status = MIX_PERR_OK;
+ RESET ();
+ BEGIN (INITIAL);
return parser->status;
}
}
diff --git a/mixlib/testsuite/Makefile.am b/mixlib/testsuite/Makefile.am
index e297988..349a320 100644
--- a/mixlib/testsuite/Makefile.am
+++ b/mixlib/testsuite/Makefile.am
@@ -17,7 +17,7 @@ LDADD = $(top_builddir)/mixlib/libmix.a
check_PROGRAMS = mixtypest mixinstest mixvminstest mixparsertest mixdevtest mixevaltest
TESTS = $(check_PROGRAMS)
-MIXAL_FILES= "\"primes\",\"isamixinstruction\",\"tests/bt\",\"tests/cbp\",\"tests/ldan\",\"tests/stress0\",\"hello\",\"echo\","
+MIXAL_FILES= "\"tests/bt\",\"tests/cbp\",\"tests/stress0\",\"tests/stress1\",\"tests/stress2\",\"tests/stress4\",\"tests/stress5\",\"tests/stress6\",\"tests/ldan\",\"tests/lockonw\",\"tests/negwrite\",\"hello\",\"echo\",\"primes\",\"isains\""
AM_CFLAGS = -DMIX_TEST_MIXAL_FILES=$(MIXAL_FILES) -DMIX_TEST_SAMPLES_DIR="\"$(top_srcdir)/samples\""
diff --git a/mixlib/testsuite/mix_parser_t.c b/mixlib/testsuite/mix_parser_t.c
index 4008309..80f2cd1 100644
--- a/mixlib/testsuite/mix_parser_t.c
+++ b/mixlib/testsuite/mix_parser_t.c
@@ -20,9 +20,9 @@
*/
+#include <mix_parser.h>
#include <stdlib.h>
-#include <mix_parser.h>
/* Define VERBOSE_TEST if you want to get prints of the test */
/* #define VERBOSE_TEST */
@@ -36,13 +36,12 @@ static const size_t FILE_NO_ = sizeof(FILES_)/sizeof(FILES_[0]);
static void
test_code_ (const gchar *name)
{
-
mix_code_file_t *code;
mix_parser_err_t err;
+
gchar *real_name = g_strdup_printf ("%s/%s", MIX_TEST_SAMPLES_DIR, name);
- g_print (real_name);
- g_print ("\n");
+ gchar *code_name = g_path_get_basename (name);
mix_parser_t *parser = mix_parser_new (real_name);
@@ -58,32 +57,14 @@ test_code_ (const gchar *name)
g_assert (err == MIX_PERR_OK);
- err = mix_parser_write_code (parser, real_name, FALSE);
- code = mix_code_file_new_read (real_name);
+ err = mix_parser_write_code (parser, code_name, FALSE);
+ code = mix_code_file_new_read (code_name);
g_assert (code);
-#ifdef VERBOSE_TEST
- g_message ("%s: Version: %d.%d", name, mix_code_file_major_version (code),
- mix_code_file_minor_version (code));
-
- mix_short_print (mix_code_file_get_start_addr (code), "Start address: ");
- g_print ("\n");
-
- mix_ins_desc_t ins;
- while (mix_code_file_get_ins (code, &ins))
- {
- mix_ins_t i;
- mix_word_to_ins_uncheck (ins.ins, i);
- mix_short_print (ins.address, "addr: ");
- g_print (" : ");
- mix_ins_print (&i);
- g_print ("\n");
- }
-#endif
-
mix_parser_delete (parser);
mix_code_file_delete (code);
g_free (real_name);
+ g_free (code_name);
}
int
diff --git a/samples/Makefile.am b/samples/Makefile.am
index 0e4575f..7ec030a 100644
--- a/samples/Makefile.am
+++ b/samples/Makefile.am
@@ -10,6 +10,7 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+SUBDIRS = tests
-EXTRA_DIST = primes.result hello.mixal primes.mixal echo.mixal\
- permutations.mixal permutations.cardrd \ No newline at end of file
+EXTRA_DIST = primes.result hello.mixal primes.mixal echo.mixal \
+ permutations.mixal permutations.cardrd isains.mixal
diff --git a/samples/isamixinstruction.mixal b/samples/isains.mixal
index b1d7f2d..b1d7f2d 100644
--- a/samples/isamixinstruction.mixal
+++ b/samples/isains.mixal
diff --git a/samples/mixasm b/samples/mixasm
deleted file mode 120000
index db38217..0000000
--- a/samples/mixasm
+++ /dev/null
@@ -1 +0,0 @@
-../mixutils/mixasm \ No newline at end of file
diff --git a/samples/mixvm b/samples/mixvm
deleted file mode 120000
index bdb6e79..0000000
--- a/samples/mixvm
+++ /dev/null
@@ -1 +0,0 @@
-../mixutils/mixvm \ No newline at end of file
diff --git a/samples/tests/.arch-inventory b/samples/tests/.arch-inventory
new file mode 100644
index 0000000..1ac182e
--- /dev/null
+++ b/samples/tests/.arch-inventory
@@ -0,0 +1,2 @@
+junk (\.mix)$
+junk (\.mls)$
diff --git a/samples/tests/Makefile.am b/samples/tests/Makefile.am
new file mode 100644
index 0000000..b75454c
--- /dev/null
+++ b/samples/tests/Makefile.am
@@ -0,0 +1,17 @@
+## Process this file with automake to produce Makefile.in
+
+# Copyright (C) 2006 by Free Software Foundation, Inc.
+
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+EXTRA_DIST = bt.mixal cbp.mixal ldan.mixal lockonw.mixal negwrite.mixal \
+ stress0.mixal stress1.mixal stress2.mixal stress4.mixal \
+ stress5.mixal stress6.mixal
+
diff --git a/samples/tests/ldan.mixal b/samples/tests/ldan.mixal
index d15c6a3..24a066f 100644
--- a/samples/tests/ldan.mixal
+++ b/samples/tests/ldan.mixal
@@ -3,3 +3,4 @@ BEGIN LDAN VAR(1:5)
LDXN VAR(1:5)
HLT
END BEGIN
+
diff --git a/samples/tests/stress2.mixal b/samples/tests/stress2.mixal
index 0c4d7d6..ccfca81 100644
--- a/samples/tests/stress2.mixal
+++ b/samples/tests/stress2.mixal
@@ -1,7 +1,7 @@
- ORIG 1999
-ST NOP
-SYM EQU SYM+1
+ ORIG 1999
+ST NOP
+SYM EQU ST+1
SYM2 CON SYM2+1
SYM3 ORIG SYM3+2
- HLT
+ HLT
SYM4 END SYM4+1