diff --git a/CHANGELOG.org b/CHANGELOG.org
index a92ae98..2115009 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -31,6 +31,9 @@ Added second knight-posix test
Added third knight-posix test
Added fourth knight-posix test
Added fifth knight-posix test
+Added sixth knight-posix test
+Added seventh knight-posix test
+Added working HEAP/malloc to knight-posix
** Changed
Converted M2-Planet to use GNU style error message
diff --git a/cc_core.c b/cc_core.c
index 7b531f8..cf5327f 100644
--- a/cc_core.c
+++ b/cc_core.c
@@ -43,7 +43,8 @@ int Address_of;
char* parse_string(char* string);
int escape_lookup(char* c);
char* numerate_number(int a);
-
+int numerate_string(char *a);
+char* number_to_hex(int a, int bytes);
struct token_list* emit(char *s, struct token_list* head)
{
@@ -303,10 +304,28 @@ void primary_expr_char()
void primary_expr_number()
{
- if(1 == Architecture) emit_out("LOADI R0 ");
- else if(2 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
- emit_out(global_token->s);
- emit_out("\n");
+ if(1 == Architecture)
+ {
+ int size = numerate_string(global_token->s);
+ if((32768 > size) && (size > -32768))
+ {
+ emit_out("LOADI R0 ");
+ emit_out(global_token->s);
+ emit_out("\n");
+ }
+ else
+ {
+ emit_out("LOADR R0 4\nJUMP 4\n'");
+ emit_out(number_to_hex(size, 4));
+ emit_out("'\n");
+ }
+ }
+ else if(2 == Architecture)
+ {
+ emit_out("LOAD_IMMEDIATE_eax %");
+ emit_out(global_token->s);
+ emit_out("\n");
+ }
global_token = global_token->next;
}
@@ -1055,7 +1074,7 @@ void recursive_statement()
struct token_list* i;
for(i = function->locals; frame != i; i = i->next)
{
- if(1 == Architecture) emit_out("POPR R1 R15\t@ _recursive_statement_locals\n");
+ if(1 == Architecture) emit_out("POPR R1 R15\t# _recursive_statement_locals\n");
else if(2 == Architecture) emit_out( "POP_ebx\t# _recursive_statement_locals\n");
}
}
diff --git a/functions/number_pack.c b/functions/number_pack.c
new file mode 100644
index 0000000..82061fe
--- /dev/null
+++ b/functions/number_pack.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2016 Jeremiah Orians
+ * This file is part of M2-Planet.
+ *
+ * M2-Planet is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * M2-Planet is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with M2-Planet. If not, see .
+ */
+
+#include
+#include
+#include
+// void* calloc(int count, int size);
+void file_print(char* s, FILE* f);
+int hex2char(int c);
+
+char* number_to_hex(int a, int bytes)
+{
+ char* result = calloc(1 + (bytes << 1), sizeof(char));
+ int i = 0;
+
+ int divisor = (bytes << 3);
+
+ /* Simply collect numbers until divisor is gone */
+ while(0 != divisor)
+ {
+ divisor = divisor - 4;
+ result[i] = hex2char((a >> divisor) & 0xF);
+ i = i + 1;
+ }
+
+ return result;
+}
diff --git a/makefile b/makefile
index 745c985..76cc133 100644
--- a/makefile
+++ b/makefile
@@ -68,15 +68,18 @@ test: test00-knight-posix-binary \
test03-knight-posix-binary \
test04-knight-posix-binary \
test05-knight-posix-binary \
+ test06-knight-posix-binary \
+ test07-knight-posix-binary \
+ test08-knight-posix-binary \
test00-x86-binary \
test01-x86-binary \
test02-x86-binary \
test03-x86-binary \
test04-x86-binary \
test05-x86-binary \
- test06-binary \
- test07-binary \
- test08-binary \
+ test06-x86-binary \
+ test07-x86-binary \
+ test08-x86-binary \
test09-binary \
test10-binary \
test11-binary \
@@ -115,6 +118,15 @@ test04-knight-posix-binary: M2-Planet | results
test05-knight-posix-binary: M2-Planet | results
test/test05/hello-knight-posix.sh
+test06-knight-posix-binary: M2-Planet | results
+ test/test06/hello-knight-posix.sh
+
+test07-knight-posix-binary: M2-Planet | results
+ test/test07/hello-knight-posix.sh
+
+test08-knight-posix-binary: M2-Planet | results
+ test/test08/hello-knight-posix.sh
+
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh
@@ -133,14 +145,14 @@ test04-x86-binary: M2-Planet | results
test05-x86-binary: M2-Planet | results
test/test05/hello-x86.sh
-test06-binary: M2-Planet | results
- test/test06/hello.sh
+test06-x86-binary: M2-Planet | results
+ test/test06/hello-x86.sh
-test07-binary: M2-Planet | results
- test/test07/hello.sh
+test07-x86-binary: M2-Planet | results
+ test/test07/hello-x86.sh
-test08-binary: M2-Planet | results
- test/test08/hello.sh
+test08-x86-binary: M2-Planet | results
+ test/test08/hello-x86.sh
test09-binary: M2-Planet | results
test/test09/hello.sh
diff --git a/test/common_knight/functions/malloc.c b/test/common_knight/functions/malloc.c
new file mode 100644
index 0000000..628d939
--- /dev/null
+++ b/test/common_knight/functions/malloc.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2016 Jeremiah Orians
+ * This file is part of M2-Planet.
+ *
+ * M2-Planet is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * M2-Planet is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with M2-Planet. If not, see .
+ */
+
+void* malloc(int size)
+{
+ asm("LOAD R0 R14 0"
+ "ADDU R0 R12 R0"
+ "SWAP R0 R12");
+}
diff --git a/test/common_knight/libc-core.M1 b/test/common_knight/libc-core.M1
index ed9ff7b..81e4c90 100644
--- a/test/common_knight/libc-core.M1
+++ b/test/common_knight/libc-core.M1
@@ -15,7 +15,7 @@
## along with M2-Planet. If not, see .
:_start
-
+ LOADR32 R12 @HEAP ; Setup HEAP pointer
LOADUI R15 $ELF_end ; Setup Stack pointer
COPY R14 R15 ; Protect esp
@@ -26,4 +26,5 @@
HALT ; Simply halt for now
;; Our default heap pointer
+:HEAP
'00080000'
\ No newline at end of file
diff --git a/functions/malloc.c b/test/common_x86/functions/malloc.c
similarity index 100%
rename from functions/malloc.c
rename to test/common_x86/functions/malloc.c
diff --git a/test/test.answers b/test/test.answers
index f27d701..b87cf69 100644
--- a/test/test.answers
+++ b/test/test.answers
@@ -1,21 +1,24 @@
-96dcb1cde9bc98c736fb33146982215f4509ae8539475e513e9cef326c78cbda test/results/test00-knight-posix-binary
+9386b893f5d31a130103618131b4bf89c40d8c8aa99d216bd30cc7dc62deeb47 test/results/test00-knight-posix-binary
c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary
-fab674644b9519e8ec39e254e6b13fe5eccb9f861f7d9e7d2f736d40875b7546 test/results/test01-knight-posix-binary
+97d784284844e01d28beb37c0d04a97b3f1b2835c7b7e0b169e1a6e78d6c6c9a test/results/test01-knight-posix-binary
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
-d1788ab10ad9d16488eac547664f59b1a0d4684da90240eecc1de3dceac7de78 test/results/test02-knight-posix-binary
+0add4a5a2e1a2a1e3806f72523f682364c7c65f5c1efbdf1f11af916b6afc5a0 test/results/test02-knight-posix-binary
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
-e7e27666bbac654863302365ace7696b220bbb4f989eb3ee76966e09076d5fdd test/results/test03-knight-posix-binary
+d29f0a2580efa4c47b47a7ff24d5295920ac0d410cd9480639072b6635c585e9 test/results/test03-knight-posix-binary
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary
-f46d7e681d9022be3e2df0063826302b708f35f682942f16fb247e22dee70137 test/results/test04-knight-posix-binary
+2831709595712268889e1737ec7728cf29385567b736a3dcc35fb7b97773b79f test/results/test04-knight-posix-binary
b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-x86-binary
-5efe707d92f6bea63be31605f38ac9caff6509b10f4461c3df9e34332dc550f7 test/results/test05-knight-posix-binary
+78921a43d41d6c62cab2552d3f13f353a9fd5beee5be702417e47a15d95e169d test/results/test05-knight-posix-binary
b5b76320ccda887a30b0bbefc2a5c302c8f2aa3c398d92ef3a79526690b25d6f test/results/test05-x86-binary
-663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-binary
-a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-binary
-f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-binary
+3f415979cca69519a8298535380ec707f9cbdc2f2635df1e3abc8bc492b6203d test/results/test06-knight-posix-binary
+663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-x86-binary
+3befa4e52965fb52186379c36fc6f6d897902dd4427e7f6ba2cc4e99cc969c49 test/results/test07-knight-posix-binary
+a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-x86-binary
+08bc1fb86c1df73b21e0b68e76572a33477f8943abdd16433d00ef231195bd22 test/results/test08-knight-posix-binary
+f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-binary
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-binary
-70429b4c78f8a712c5bf2de9d7cbfac06fafedc0635b58f0b6319906f3549ab0 test/results/test100-binary
+9a0edc49d1078ffc7ed2578e50198e9e7695c2f26151a3d6e76bab7f2db6872c test/results/test100-binary
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-binary
f98ab8e4bb35580e0dde96126d7a56aff66bda208d02c8d89390b40d6cff591c test/results/test12-binary
5051ffca2615144419f8ec1a5d4999486ae81e7781428f59e47e866af97cef92 test/results/test13-binary
diff --git a/test/test06/hello-knight-posix.sh b/test/test06/hello-knight-posix.sh
new file mode 100755
index 0000000..fa1b200
--- /dev/null
+++ b/test/test06/hello-knight-posix.sh
@@ -0,0 +1,43 @@
+#! /bin/sh
+## Copyright (C) 2017 Jeremiah Orians
+## This file is part of M2-Planet.
+##
+## M2-Planet is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## M2-Planet is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with M2-Planet. If not, see .
+
+set -ex
+# Build the test
+bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
+ -f test/test06/for.c \
+ -o test/test06/for.M1 || exit 1
+
+# Macro assemble with libc written in M1-Macro
+M1 -f test/common_knight/knight_defs.M1 \
+ -f test/common_knight/libc-core.M1 \
+ -f test/test06/for.M1 \
+ --BigEndian \
+ --architecture knight-posix \
+ -o test/test06/for.hex2 || exit 2
+
+# Resolve all linkages
+hex2 -f test/common_knight/ELF-knight.hex2 -f test/test06/for.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test06-knight-posix-binary --exec_enable || exit 3
+
+# Ensure binary works if host machine supports test
+if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
+then
+ # Verify that the resulting file works
+ ./test/results/test06-knight-posix-binary >| test/test06/proof || exit 4
+ out=$(sha256sum -c test/test06/proof.answer)
+ [ "$out" = "test/test06/proof: OK" ] || exit 5
+fi
+exit 0
diff --git a/test/test06/hello.sh b/test/test06/hello-x86.sh
similarity index 92%
rename from test/test06/hello.sh
rename to test/test06/hello-x86.sh
index 45e4588..905c296 100755
--- a/test/test06/hello.sh
+++ b/test/test06/hello-x86.sh
@@ -30,13 +30,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test06/for.hex2 || exit 2
# Resolve all linkages
-hex2 -f test/common_x86/ELF-i386.hex2 -f test/test06/for.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test06-binary --exec_enable || exit 3
+hex2 -f test/common_x86/ELF-i386.hex2 -f test/test06/for.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test06-x86-binary --exec_enable || exit 3
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
then
# Verify that the resulting file works
- ./test/results/test06-binary >| test/test06/proof || exit 4
+ ./test/results/test06-x86-binary >| test/test06/proof || exit 4
out=$(sha256sum -c test/test06/proof.answer)
[ "$out" = "test/test06/proof: OK" ] || exit 5
fi
diff --git a/test/test07/hello-knight-posix.sh b/test/test07/hello-knight-posix.sh
new file mode 100755
index 0000000..1b2e25e
--- /dev/null
+++ b/test/test07/hello-knight-posix.sh
@@ -0,0 +1,44 @@
+#! /bin/sh
+## Copyright (C) 2017 Jeremiah Orians
+## This file is part of M2-Planet.
+##
+## M2-Planet is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## M2-Planet is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with M2-Planet. If not, see .
+
+set -ex
+# Build the test
+bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
+ -f test/common_knight/functions/exit.c \
+ -f test/test07/do.c \
+ -o test/test07/do.M1 || exit 1
+
+# Macro assemble with libc written in M1-Macro
+M1 -f test/common_knight/knight_defs.M1 \
+ -f test/common_knight/libc-core.M1 \
+ -f test/test07/do.M1 \
+ --BigEndian \
+ --architecture knight-posix \
+ -o test/test07/do.hex2 || exit 2
+
+# Resolve all linkages
+hex2 -f test/common_knight/ELF-knight.hex2 -f test/test07/do.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test07-knight-posix-binary --exec_enable || exit 3
+
+# Ensure binary works if host machine supports test
+if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight" ]
+then
+ # Verify that the resulting file works
+ ./test/results/test07-knight-posix-binary >| test/test07/proof || exit 4
+ out=$(sha256sum -c test/test07/proof.answer)
+ [ "$out" = "test/test07/proof: OK" ] || exit 5
+fi
+exit 0
diff --git a/test/test07/hello.sh b/test/test07/hello-x86.sh
similarity index 93%
rename from test/test07/hello.sh
rename to test/test07/hello-x86.sh
index c514b50..ed5edfb 100755
--- a/test/test07/hello.sh
+++ b/test/test07/hello-x86.sh
@@ -31,13 +31,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test07/do.hex2 || exit 2
# Resolve all linkages
-hex2 -f test/common_x86/ELF-i386.hex2 -f test/test07/do.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test07-binary --exec_enable || exit 3
+hex2 -f test/common_x86/ELF-i386.hex2 -f test/test07/do.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test07-x86-binary --exec_enable || exit 3
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
then
# Verify that the resulting file works
- ./test/results/test07-binary >| test/test07/proof || exit 4
+ ./test/results/test07-x86-binary >| test/test07/proof || exit 4
out=$(sha256sum -c test/test07/proof.answer)
[ "$out" = "test/test07/proof: OK" ] || exit 5
fi
diff --git a/test/test08/hello-knight-posix.sh b/test/test08/hello-knight-posix.sh
new file mode 100755
index 0000000..2375571
--- /dev/null
+++ b/test/test08/hello-knight-posix.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+## Copyright (C) 2017 Jeremiah Orians
+## This file is part of M2-Planet.
+##
+## M2-Planet is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## M2-Planet is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with M2-Planet. If not, see .
+
+set -x
+# Build the test
+bin/M2-Planet --architecture knight-posix -f test/common_knight/functions/putchar.c \
+ -f test/common_knight/functions/exit.c \
+ -f test/common_knight/functions/malloc.c \
+ -f test/test08/struct.c \
+ -o test/test08/struct.M1 || exit 1
+
+# Macro assemble with libc written in M1-Macro
+M1 -f test/common_knight/knight_defs.M1 \
+ -f test/common_knight/libc-core.M1 \
+ -f test/test08/struct.M1 \
+ --BigEndian \
+ --architecture knight-posix \
+ -o test/test08/struct.hex2 || exit 2
+
+# Resolve all linkages
+hex2 -f test/common_knight/ELF-knight.hex2 -f test/test08/struct.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x00 -o test/results/test08-knight-posix-binary --exec_enable || exit 3
+
+# Ensure binary works if host machine supports test
+if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
+then
+ # Verify that the compiled program returns the correct result
+ out=$(./test/results/test08-knight-posix-binary 2>&1 )
+ [ 16 = $? ] || exit 4
+ [ "$out" = "35419896642975313541989657891634" ] || exit 5
+fi
+exit 0
diff --git a/test/test08/hello.sh b/test/test08/hello-x86.sh
similarity index 91%
rename from test/test08/hello.sh
rename to test/test08/hello-x86.sh
index d21ca0b..35456e8 100755
--- a/test/test08/hello.sh
+++ b/test/test08/hello-x86.sh
@@ -19,7 +19,7 @@ set -x
# Build the test
bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
-f test/common_x86/functions/exit.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f test/test08/struct.c \
-o test/test08/struct.M1 || exit 1
@@ -32,13 +32,13 @@ M1 -f test/common_x86/x86_defs.M1 \
-o test/test08/struct.hex2 || exit 2
# Resolve all linkages
-hex2 -f test/common_x86/ELF-i386.hex2 -f test/test08/struct.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test08-binary --exec_enable || exit 3
+hex2 -f test/common_x86/ELF-i386.hex2 -f test/test08/struct.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test08-x86-binary --exec_enable || exit 3
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
then
# Verify that the compiled program returns the correct result
- out=$(./test/results/test08-binary 2>&1 )
+ out=$(./test/results/test08-x86-binary 2>&1 )
[ 16 = $? ] || exit 4
[ "$out" = "35419896642975313541989657891634" ] || exit 5
fi
diff --git a/test/test10/hello.sh b/test/test10/hello.sh
index b4102aa..874ff87 100755
--- a/test/test10/hello.sh
+++ b/test/test10/hello.sh
@@ -19,7 +19,7 @@ set -x
# Build the test
bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
-f test/common_x86/functions/exit.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f test/test10/nested_struct.c \
-o test/test10/nested_struct.M1 || exit 1
diff --git a/test/test100/hello.sh b/test/test100/hello.sh
index e329108..a079d02 100755
--- a/test/test100/hello.sh
+++ b/test/test100/hello.sh
@@ -20,13 +20,14 @@ set -ex
if [ -f bin/M2-Planet ]
then
./bin/M2-Planet --architecture x86 -f functions/file.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
+ -f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
@@ -40,13 +41,14 @@ elif [ -f bin/M2-Planet-seed ]
then
[ ! -f test/results ] && mkdir test/results
./bin/M2-Planet-seed --architecture x86 -f functions/file.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
+ -f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
@@ -65,6 +67,7 @@ ${CC} ${CFLAGS} \
functions/in_set.c \
functions/numerate_number.c \
functions/file_print.c \
+ functions/number_pack.c \
functions/string.c \
cc_reader.c \
cc_strings.c \
@@ -76,13 +79,14 @@ ${CC} ${CFLAGS} \
-o bin/M2-Planet-gcc
./bin/M2-Planet-gcc --architecture x86 -f functions/file.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
+ -f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
@@ -120,13 +124,14 @@ if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
then
# Verify that the resulting file works
./test/results/test100-binary --architecture x86 -f functions/file.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
-f functions/match.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f functions/file_print.c \
+ -f functions/number_pack.c \
-f functions/string.c \
-f cc.h \
-f cc_reader.c \
diff --git a/test/test100/proof.answer b/test/test100/proof.answer
index 30c62e9..b1215a5 100644
--- a/test/test100/proof.answer
+++ b/test/test100/proof.answer
@@ -1 +1 @@
-6fdd455d135bb0d3ba048db2d9b41c469a5a8b695cf739f0916c8ec8e95dd637 test/test100/proof
+956e610f595e53333bd961775a8f10fc9529e8a1dfb330886014a77c90914555 test/test100/proof
diff --git a/test/test17/hello.sh b/test/test17/hello.sh
index b66bd75..44d2982 100755
--- a/test/test17/hello.sh
+++ b/test/test17/hello.sh
@@ -17,7 +17,7 @@
set -ex
# Build the test
-bin/M2-Planet --architecture x86 -f functions/malloc.c \
+bin/M2-Planet --architecture x86 -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/putchar.c \
-f test/test17/memset.c \
diff --git a/test/test18/hello.sh b/test/test18/hello.sh
index 038a5a0..ce8e2f3 100755
--- a/test/test18/hello.sh
+++ b/test/test18/hello.sh
@@ -18,7 +18,7 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f functions/file.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/test18/math.c \
-o test/test18/math.M1 || exit 1
diff --git a/test/test19/hello.sh b/test/test19/hello.sh
index a6b5b20..ad366a3 100755
--- a/test/test19/hello.sh
+++ b/test/test19/hello.sh
@@ -18,7 +18,7 @@
set -ex
# Build the test
bin/M2-Planet --architecture x86 -f functions/file.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f test/common_x86/functions/exit.c \
-f functions/match.c \
diff --git a/test/test20/hello.sh b/test/test20/hello.sh
index d85cb9c..cf2feff 100755
--- a/test/test20/hello.sh
+++ b/test/test20/hello.sh
@@ -19,7 +19,7 @@ set -x
# Build the test
bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
-f test/common_x86/functions/exit.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f test/test20/struct.c \
-o test/test20/struct.M1 || exit 1
diff --git a/test/test21/hello.sh b/test/test21/hello.sh
index d2502f4..826ec28 100755
--- a/test/test21/hello.sh
+++ b/test/test21/hello.sh
@@ -20,7 +20,7 @@ set -x
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f functions/file_print.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f test/test21/blood-elf.c \
diff --git a/test/test22/hello.sh b/test/test22/hello.sh
index 789503a..79218bb 100755
--- a/test/test22/hello.sh
+++ b/test/test22/hello.sh
@@ -20,7 +20,7 @@ set -x
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f functions/file_print.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f functions/in_set.c \
diff --git a/test/test23/hello.sh b/test/test23/hello.sh
index 9e4680c..882ca18 100755
--- a/test/test23/hello.sh
+++ b/test/test23/hello.sh
@@ -20,7 +20,7 @@ set -x
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f functions/file_print.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f functions/in_set.c \
diff --git a/test/test24/hello.sh b/test/test24/hello.sh
index d524949..a679024 100755
--- a/test/test24/hello.sh
+++ b/test/test24/hello.sh
@@ -20,7 +20,7 @@ set -x
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f functions/file_print.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/uname.c \
-f functions/match.c \
diff --git a/test/test25/hello.sh b/test/test25/hello.sh
index 5ab6552..1887528 100755
--- a/test/test25/hello.sh
+++ b/test/test25/hello.sh
@@ -20,7 +20,7 @@ set -x
./bin/M2-Planet --architecture x86 -f test/common_x86/functions/exit.c \
-f functions/file.c \
-f functions/file_print.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/match.c \
-f functions/in_set.c \
diff --git a/test/test26/hello.sh b/test/test26/hello.sh
index 68a757d..eb587af 100755
--- a/test/test26/hello.sh
+++ b/test/test26/hello.sh
@@ -18,7 +18,7 @@
set -x
# Build the test
./bin/M2-Planet --architecture x86 -f test/test26/lisp.h \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f functions/calloc.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
diff --git a/test/test99/hello.sh b/test/test99/hello.sh
index d62789f..001a4a7 100755
--- a/test/test99/hello.sh
+++ b/test/test99/hello.sh
@@ -20,7 +20,7 @@ set -ex
bin/M2-Planet --architecture x86 -f test/common_x86/functions/putchar.c \
-f functions/getchar.c \
-f test/common_x86/functions/exit.c \
- -f functions/malloc.c \
+ -f test/common_x86/functions/malloc.c \
-f test/test99/cc500.c \
-o test/test99/cc0.M1 || exit 1