Minor reorganization

This commit is contained in:
Jeremiah Orians 2018-08-20 20:41:37 -04:00
parent 36d4632446
commit 951d259339
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
46 changed files with 173 additions and 200 deletions

View File

@ -28,6 +28,8 @@ Converted weird_string collection into a simpler form
Inlined 2 small stubs as breaking them out wouldn't help implementation Inlined 2 small stubs as breaking them out wouldn't help implementation
Reordered conditionals for easier implementation and reduced operations Reordered conditionals for easier implementation and reduced operations
Broke out OUT and FUNCTION to silence a single GCC warning Broke out OUT and FUNCTION to silence a single GCC warning
Moved required_match and line_error into cc_core.c and removed required_match.c
Relocated contents of test/functions to functions
** Fixed ** Fixed
Fixed detection of locals to screen out all non-primitive name space collisions Fixed detection of locals to screen out all non-primitive name space collisions

View File

@ -41,8 +41,9 @@ struct type* last_type;
char* parse_string(char* string); char* parse_string(char* string);
int escape_lookup(char* c); int escape_lookup(char* c);
char* numerate_number(int a); char* numerate_number(int a);
void require_match(char* message, char* required);
void line_error();
struct token_list* emit(char *s, struct token_list* head) struct token_list* emit(char *s, struct token_list* head)
{ {
@ -54,7 +55,7 @@ struct token_list* emit(char *s, struct token_list* head)
void emit_out(char* s) void emit_out(char* s)
{ {
out = emit(s, out); out = emit(s, out);
} }
struct token_list* uniqueID(char* s, struct token_list* l, char* num) struct token_list* uniqueID(char* s, struct token_list* l, char* num)
@ -68,13 +69,9 @@ struct token_list* uniqueID(char* s, struct token_list* l, char* num)
void uniqueID_out(char* s, char* num) void uniqueID_out(char* s, char* num)
{ {
emit_out(s); out = uniqueID(s, out, num);
emit_out("_");
emit_out(num);
emit_out("\n");
} }
struct token_list* sym_declare(char *s, struct type* t, struct token_list* list) struct token_list* sym_declare(char *s, struct type* t, struct token_list* list)
{ {
struct token_list* a = calloc(1, sizeof(struct token_list)); struct token_list* a = calloc(1, sizeof(struct token_list));
@ -94,6 +91,25 @@ struct token_list* sym_lookup(char *s, struct token_list* symbol_list)
return NULL; return NULL;
} }
void line_error()
{
file_print("In file: ", stderr);
file_print(global_token->filename, stderr);
file_print(" On line: ", stderr);
file_print(numerate_number(global_token->linenumber), stderr);
}
void require_match(char* message, char* required)
{
if(!match(global_token->s, required))
{
file_print(message, stderr);
line_error();
exit(EXIT_FAILURE);
}
global_token = global_token->next;
}
void expression(); void expression();
void function_call(char* s, int bool) void function_call(char* s, int bool)
{ {
@ -162,7 +178,10 @@ void variable_load(struct token_list* a)
emit_out("LOAD_BASE_ADDRESS_eax %"); emit_out("LOAD_BASE_ADDRESS_eax %");
emit_out(numerate_number(a->depth)); emit_out(numerate_number(a->depth));
emit_out("\n"); emit_out("\n");
if(!match("=", global_token->s) && !match("char**", a->type->name)) emit_out("LOAD_INTEGER\n"); if(match("=", global_token->s)) return;
if(match("char**", a->type->name)) return;
emit_out("LOAD_INTEGER\n");
} }
void function_load(struct token_list* a) void function_load(struct token_list* a)
@ -209,6 +228,7 @@ void primary_expr_failure()
void primary_expr_string() void primary_expr_string()
{ {
char* number_string = numerate_number(current_count); char* number_string = numerate_number(current_count);
current_count = current_count + 1;
emit_out("LOAD_IMMEDIATE_eax &STRING_"); emit_out("LOAD_IMMEDIATE_eax &STRING_");
uniqueID_out(function->s, number_string); uniqueID_out(function->s, number_string);
@ -219,21 +239,12 @@ void primary_expr_string()
/* Parse the string */ /* Parse the string */
strings_list = emit(parse_string(global_token->s), strings_list); strings_list = emit(parse_string(global_token->s), strings_list);
global_token = global_token->next; global_token = global_token->next;
current_count = current_count + 1;
} }
void primary_expr_char() void primary_expr_char()
{ {
emit_out("LOAD_IMMEDIATE_eax %"); emit_out("LOAD_IMMEDIATE_eax %");
if('\\' == global_token->s[1]) emit_out(numerate_number(escape_lookup(global_token->s + 1)));
{
emit_out(numerate_number(escape_lookup(global_token->s + 1)));
}
else
{
emit_out(numerate_number(global_token->s[1]));
}
emit_out("\n"); emit_out("\n");
global_token = global_token->next; global_token = global_token->next;
} }
@ -1099,9 +1110,10 @@ new_type:
if (NULL == global_token) return out; if (NULL == global_token) return out;
if(match("CONSTANT", global_token->s)) if(match("CONSTANT", global_token->s))
{ {
global_constant_list = sym_declare(global_token->next->s, NULL, global_constant_list); global_token = global_token->next;
global_constant_list->arguments = global_token->next->next; global_constant_list = sym_declare(global_token->s, NULL, global_constant_list);
global_token = global_token->next->next->next; global_constant_list->arguments = global_token->next;
global_token = global_token->next->next;
} }
else else
{ {

View File

@ -1,37 +0,0 @@
/* Copyright (C) 2016 Jeremiah Orians
* This file is part of stage0.
*
* stage0 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.
*
* stage0 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 stage0. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../cc.h"
char* numerate_number(int a);
void line_error()
{
file_print("In file: ", stderr);
file_print(global_token->filename, stderr);
file_print(" On line: ", stderr);
file_print(numerate_number(global_token->linenumber), stderr);
}
void require_match(char* message, char* required)
{
if(!match(global_token->s, required))
{
file_print(message, stderr);
line_error();
exit(EXIT_FAILURE);
}
global_token = global_token->next;
}

View File

@ -8,11 +8,10 @@ CFLAGS=-D_GNU_SOURCE -O0 -std=c99 -ggdb
M2-Planet-gcc: cc_reader.c cc_strings.c cc_core.c cc.c cc_types.c cc.h | bin M2-Planet-gcc: cc_reader.c cc_strings.c cc_core.c cc.c cc_types.c cc.h | bin
$(CC) $(CFLAGS) \ $(CC) $(CFLAGS) \
test/functions/match.c \ functions/match.c \
test/functions/numerate_number.c \ functions/numerate_number.c \
test/functions/file_print.c \ functions/file_print.c \
test/functions/string.c \ functions/string.c \
functions/require_match.c \
cc_reader.c \ cc_reader.c \
cc_strings.c \ cc_strings.c \
cc_types.c \ cc_types.c \

View File

@ -9,7 +9,7 @@ b45fae655b7f848b28ebdb8eb2e30ae789fbcf7920bc315395d53986bb1adae4 test/results/t
d511db73158a9544a5b5f828a79751e3de8a04b81c143fd0c146fc22c938aa9f test/results/test08-binary d511db73158a9544a5b5f828a79751e3de8a04b81c143fd0c146fc22c938aa9f test/results/test08-binary
907e1808f2e2b15ac72ebf13898b15c678e68ebd43d673dcd0f408d907e7962f test/results/test09-binary 907e1808f2e2b15ac72ebf13898b15c678e68ebd43d673dcd0f408d907e7962f test/results/test09-binary
ef179cd359ba1d61d45089e314cd4ac2069c8dc4dd7494d7c766344ea3c8cf88 test/results/test10-binary ef179cd359ba1d61d45089e314cd4ac2069c8dc4dd7494d7c766344ea3c8cf88 test/results/test10-binary
0c76566ec86a381af8f2a1eb38bcb48d7dcaeaaa2bb03599b0b3043ad546e657 test/results/test100-binary bf1d76df4d3e701c420e031910ca0da3f390fb3b6d198a0b93349bdbc285adb7 test/results/test100-binary
5aaf399fe706d4a8c85c121c75ada29a65c293b57c98e8999961a2ef0bab0d62 test/results/test11-binary 5aaf399fe706d4a8c85c121c75ada29a65c293b57c98e8999961a2ef0bab0d62 test/results/test11-binary
4f8111e73e07255ae203963438c82ea8bcff7474e1594b52b426c58a03cb30eb test/results/test12-binary 4f8111e73e07255ae203963438c82ea8bcff7474e1594b52b426c58a03cb30eb test/results/test12-binary
dd74dabfdce8657ff440c1eef531cbf67a64854f2020d4d6bcb65c9cc2d199cb test/results/test13-binary dd74dabfdce8657ff440c1eef531cbf67a64854f2020d4d6bcb65c9cc2d199cb test/results/test13-binary

View File

@ -6,7 +6,7 @@ bin/M2-Planet -f test/test00/return.c \
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test00/return.M1 \ -f test/test00/return.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test01/library_call.c \ -f test/test01/library_call.c \
-o test/test01/library_call.M1 || exit 1 -o test/test01/library_call.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test01/library_call.M1 \ -f test/test01/library_call.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test02/if.c \ -f test/test02/if.c \
-o test/test02/if.M1 || exit 1 -o test/test02/if.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test02/if.M1 \ -f test/test02/if.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test03/constant.c \ -f test/test03/constant.c \
-o test/test03/constant.M1 || exit 1 -o test/test03/constant.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test03/constant.M1 \ -f test/test03/constant.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test04/call.c \ -f test/test04/call.c \
-o test/test04/call.M1 || exit 1 -o test/test04/call.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test04/call.M1 \ -f test/test04/call.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test05/string.c \ -f test/test05/string.c \
-o test/test05/string.M1 || exit 1 -o test/test05/string.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test05/string.M1 \ -f test/test05/string.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,13 +1,13 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/test06/for.c \ -f test/test06/for.c \
-o test/test06/for.M1 || exit 1 -o test/test06/for.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test06/for.M1 \ -f test/test06/for.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test07/do.c \ -f test/test07/do.c \
-o test/test07/do.M1 || exit 1 -o test/test07/do.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test07/do.M1 \ -f test/test07/do.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,15 +1,15 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/test08/struct.c \ -f test/test08/struct.c \
-o test/test08/struct.M1 || exit 1 -o test/test08/struct.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test08/struct.M1 \ -f test/test08/struct.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test09/goto.c \ -f test/test09/goto.c \
-o test/test09/goto.M1 || exit 1 -o test/test09/goto.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test09/goto.M1 \ -f test/test09/goto.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,15 +1,15 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/test10/nested_struct.c \ -f test/test10/nested_struct.c \
-o test/test10/nested_struct.M1 || exit 1 -o test/test10/nested_struct.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test10/nested_struct.M1 \ -f test/test10/nested_struct.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -3,36 +3,34 @@ set -ex
# Build the test # Build the test
if [ -f bin/M2-Planet ] if [ -f bin/M2-Planet ]
then then
./bin/M2-Planet -f test/functions/file.c \ ./bin/M2-Planet -f functions/file.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/functions/numerate_number.c \ -f functions/numerate_number.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/string.c \ -f functions/string.c \
-f cc.h \ -f cc.h \
-f cc_reader.c \ -f cc_reader.c \
-f cc_strings.c \ -f cc_strings.c \
-f cc_types.c \ -f cc_types.c \
-f functions/require_match.c \
-f cc_core.c \ -f cc_core.c \
-f cc.c \ -f cc.c \
-o test/test100/cc.M1 || exit 1 -o test/test100/cc.M1 || exit 1
else else
./bin/M2-Planet-gcc -f test/functions/file.c \ ./bin/M2-Planet-gcc -f functions/file.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/functions/numerate_number.c \ -f functions/numerate_number.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/string.c \ -f functions/string.c \
-f cc.h \ -f cc.h \
-f cc_reader.c \ -f cc_reader.c \
-f cc_strings.c \ -f cc_strings.c \
-f cc_types.c \ -f cc_types.c \
-f functions/require_match.c \
-f cc_core.c \ -f cc_core.c \
-f cc.c \ -f cc.c \
-o test/test100/cc.M1 || exit 1 -o test/test100/cc.M1 || exit 1
@ -40,7 +38,7 @@ fi
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test100/cc.M1 \ -f test/test100/cc.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \
@ -53,19 +51,18 @@ hex2 -f test/common_x86/ELF-i386.hex2 -f test/test100/cc.hex2 --LittleEndian --A
if [ "$(get_machine)" = "x86_64" ] if [ "$(get_machine)" = "x86_64" ]
then then
# Verify that the resulting file works # Verify that the resulting file works
./test/results/test100-binary -f test/functions/file.c \ ./test/results/test100-binary -f functions/file.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/functions/numerate_number.c \ -f functions/numerate_number.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/string.c \ -f functions/string.c \
-f cc.h \ -f cc.h \
-f cc_reader.c \ -f cc_reader.c \
-f cc_strings.c \ -f cc_strings.c \
-f cc_types.c \ -f cc_types.c \
-f functions/require_match.c \
-f cc_core.c \ -f cc_core.c \
-f cc.c \ -f cc.c \
-o test/test100/proof || exit 4 -o test/test100/proof || exit 4

View File

@ -1 +1 @@
51c04355c67377e568bb99ee66dce3318a2ac8f9f0b1d86c9021f6f46a2ea5bf test/test100/proof 3243a9d889030bcdb2d8f7dfde62c41a3d5bd2bdf944328c2eccf1d9a3a7592e test/test100/proof

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test11/break-do.c \ -f test/test11/break-do.c \
-o test/test11/break-do.M1 || exit 1 -o test/test11/break-do.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test11/break-do.M1 \ -f test/test11/break-do.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test12/break-for.c \ -f test/test12/break-for.c \
-o test/test12/break-for.M1 || exit 1 -o test/test12/break-for.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test12/break-for.M1 \ -f test/test12/break-for.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/test13/break-while.c \ -f test/test13/break-while.c \
-o test/test13/break-while.M1 || exit 1 -o test/test13/break-while.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test13/break-while.M1 \ -f test/test13/break-while.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,13 +1,13 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/test14/basic_args.c \ -f test/test14/basic_args.c \
-o test/test14/basic_args.M1 || exit 1 -o test/test14/basic_args.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test14/basic_args.M1 \ -f test/test14/basic_args.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/file.c \ bin/M2-Planet -f functions/file.c \
-f test/functions/putchar.c \ -f functions/putchar.c \
-f test/test15/file_read.c \ -f test/test15/file_read.c \
-o test/test15/file_read.M1 || exit 1 -o test/test15/file_read.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test15/file_read.M1 \ -f test/test15/file_read.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/file.c \ bin/M2-Planet -f functions/file.c \
-f test/functions/putchar.c \ -f functions/putchar.c \
-f test/test16/file_write.c \ -f test/test16/file_write.c \
-o test/test16/file_write.M1 || exit 1 -o test/test16/file_write.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test16/file_write.M1 \ -f test/test16/file_write.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,15 +1,15 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/malloc.c \ bin/M2-Planet -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/putchar.c \ -f functions/putchar.c \
-f test/test17/memset.c \ -f test/test17/memset.c \
-o test/test17/memset.M1 || exit 1 -o test/test17/memset.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test17/memset.M1 \ -f test/test17/memset.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,15 +1,15 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/file.c \ bin/M2-Planet -f functions/file.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/test18/math.c \ -f test/test18/math.c \
-o test/test18/math.M1 || exit 1 -o test/test18/math.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test18/math.M1 \ -f test/test18/math.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,18 +1,18 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/file.c \ bin/M2-Planet -f functions/file.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/functions/numerate_number.c \ -f functions/numerate_number.c \
-f test/test19/getopt.c \ -f test/test19/getopt.c \
-o test/test19/getopt.M1 || exit 1 -o test/test19/getopt.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test19/getopt.M1 \ -f test/test19/getopt.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,15 +1,15 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/test20/struct.c \ -f test/test20/struct.c \
-o test/test20/struct.M1 || exit 1 -o test/test20/struct.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test20/struct.M1 \ -f test/test20/struct.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,12 +1,12 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
./bin/M2-Planet -f test/functions/exit.c \ ./bin/M2-Planet -f functions/exit.c \
-f test/functions/file.c \ -f functions/file.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/test21/blood-elf.c \ -f test/test21/blood-elf.c \
--debug \ --debug \
-o test/test21/blood-elf.M1 || exit 1 -o test/test21/blood-elf.M1 || exit 1
@ -17,7 +17,7 @@ blood-elf -f test/test21/blood-elf.M1 \
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test21/blood-elf.M1 \ -f test/test21/blood-elf.M1 \
-f test/test21/blood-elf-footer.M1 \ -f test/test21/blood-elf-footer.M1 \
--LittleEndian \ --LittleEndian \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
./bin/M2-Planet -f test/functions/exit.c \ ./bin/M2-Planet -f functions/exit.c \
-f test/functions/file.c \ -f functions/file.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/functions/numerate_number.c \ -f functions/numerate_number.c \
-f test/functions/stat.c \ -f functions/stat.c \
-f test/test22/hex2_linker.c \ -f test/test22/hex2_linker.c \
--debug \ --debug \
-o test/test22/hex2_linker.M1 || exit 1 -o test/test22/hex2_linker.M1 || exit 1
@ -19,7 +19,7 @@ blood-elf -f test/test22/hex2_linker.M1 \
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test22/hex2_linker.M1 \ -f test/test22/hex2_linker.M1 \
-f test/test22/hex2_linker-footer.M1 \ -f test/test22/hex2_linker-footer.M1 \
--LittleEndian \ --LittleEndian \

View File

@ -1,14 +1,14 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
./bin/M2-Planet -f test/functions/exit.c \ ./bin/M2-Planet -f functions/exit.c \
-f test/functions/file.c \ -f functions/file.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/match.c \ -f functions/match.c \
-f test/functions/numerate_number.c \ -f functions/numerate_number.c \
-f test/functions/string.c \ -f functions/string.c \
-f test/test23/M1-macro.c \ -f test/test23/M1-macro.c \
--debug \ --debug \
-o test/test23/M1-macro.M1 || exit 1 -o test/test23/M1-macro.M1 || exit 1
@ -19,7 +19,7 @@ blood-elf -f test/test23/M1-macro.M1 \
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test23/M1-macro.M1 \ -f test/test23/M1-macro.M1 \
-f test/test23/M1-macro-footer.M1 \ -f test/test23/M1-macro-footer.M1 \
--LittleEndian \ --LittleEndian \
@ -46,7 +46,7 @@ then
# Verify that the resulting file works # Verify that the resulting file works
./test/results/test23-binary -f \ ./test/results/test23-binary -f \
test/common_x86/x86_defs.M1 \ test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test21/test.M1 \ -f test/test21/test.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \

View File

@ -1,12 +1,12 @@
#! /bin/sh #! /bin/sh
set -x set -x
# Build the test # Build the test
./bin/M2-Planet -f test/functions/exit.c \ ./bin/M2-Planet -f functions/exit.c \
-f test/functions/file.c \ -f functions/file.c \
-f test/functions/file_print.c \ -f functions/file_print.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/functions/calloc.c \ -f functions/calloc.c \
-f test/functions/uname.c \ -f functions/uname.c \
-f test/test24/get_machine.c \ -f test/test24/get_machine.c \
--debug \ --debug \
-o test/test24/get_machine.M1 || exit 1 -o test/test24/get_machine.M1 || exit 1
@ -17,7 +17,7 @@ blood-elf -f test/test24/get_machine.M1 \
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test24/get_machine.M1 \ -f test/test24/get_machine.M1 \
-f test/test24/get_machine-footer.M1 \ -f test/test24/get_machine-footer.M1 \
--LittleEndian \ --LittleEndian \

View File

@ -1,16 +1,16 @@
#! /bin/sh #! /bin/sh
set -ex set -ex
# Build the test # Build the test
bin/M2-Planet -f test/functions/putchar.c \ bin/M2-Planet -f functions/putchar.c \
-f test/functions/getchar.c \ -f functions/getchar.c \
-f test/functions/exit.c \ -f functions/exit.c \
-f test/functions/malloc.c \ -f functions/malloc.c \
-f test/test99/cc500.c \ -f test/test99/cc500.c \
-o test/test99/cc0.M1 || exit 1 -o test/test99/cc0.M1 || exit 1
# Macro assemble with libc written in M1-Macro # Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \ M1 -f test/common_x86/x86_defs.M1 \
-f test/functions/libc-core.M1 \ -f functions/libc-core.M1 \
-f test/test99/cc0.M1 \ -f test/test99/cc0.M1 \
--LittleEndian \ --LittleEndian \
--Architecture 1 \ --Architecture 1 \