minimal build clean up and M1-macro enhancements
This commit is contained in:
parent
482858ae7c
commit
0bb6758a10
|
@ -34,6 +34,7 @@ Added support bitwise xor
|
|||
Added Blood-elf test
|
||||
Added Hex2_linker test
|
||||
Added M1-macro test
|
||||
Added prototypes to allow functions to be independently built
|
||||
|
||||
** Changed
|
||||
Improving Documentation to help new programmers get functional
|
||||
|
@ -41,6 +42,7 @@ Cleaned up numerate_number to make it more general purpose
|
|||
Enabled stand alone builds of calloc
|
||||
Unified bitwise operations
|
||||
Made string.c more independent
|
||||
Created a M1-macro stub file to simplify independent builds
|
||||
|
||||
** Fixed
|
||||
Minor cleanup and removal of unneeded whitespace
|
||||
|
@ -53,6 +55,7 @@ fixed "\"" bug in string output generation
|
|||
|
||||
** Removed
|
||||
Removed need for memset in numerate_number
|
||||
Removed minimal build target as it no longer serves a purpose
|
||||
|
||||
* 0.1 - 2018-02-23
|
||||
** Added
|
||||
|
|
42
cc-minimal.c
42
cc-minimal.c
|
@ -1,42 +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"
|
||||
/* The core functions */
|
||||
void initialize_types();
|
||||
struct token_list* read_all_tokens(FILE* a, struct token_list* current);
|
||||
struct token_list* reverse_list(struct token_list* head);
|
||||
struct token_list* program(struct token_list* out);
|
||||
void recursive_output(struct token_list* i, FILE* out);
|
||||
|
||||
/* Our essential organizer */
|
||||
int main()
|
||||
{
|
||||
initialize_types();
|
||||
FILE* input = fopen("input.c", "r");
|
||||
global_token = reverse_list(read_all_tokens(input, NULL));
|
||||
struct token_list* output_list = program(NULL);
|
||||
FILE* output = fopen("input.M1", "w");
|
||||
file_print("\n# Core program\n\n", output);
|
||||
recursive_output(output_list, output);
|
||||
file_print("\n# Program global variables\n\n", output);
|
||||
recursive_output(globals_list, output);
|
||||
file_print("\n# Program strings\n\n", output);
|
||||
recursive_output(strings_list, output);
|
||||
fclose(output);
|
||||
return 0;
|
||||
}
|
3
makefile
3
makefile
|
@ -21,9 +21,6 @@ M2-Planet-gcc: cc_reader.c cc_strings.c cc_core.c cc.c cc_types.c cc.h | bin
|
|||
cc.h \
|
||||
-o bin/M2-Planet-gcc
|
||||
|
||||
M2-Planet-minimal: cc_reader.c cc_strings.c cc_core.c cc-minimal.c cc_types.c cc.h | bin
|
||||
$(CC) $(CFLAGS) cc_reader.c cc_strings.c cc_core.c cc-minimal.c cc_types.c cc.h -o bin/M2-Planet-minimal
|
||||
|
||||
M2-Planet: M2-Planet-gcc | bin results
|
||||
./test/test100/hello.sh
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* along with stage0. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include<stdio.h>
|
||||
// void fputc(char s, FILE* f);
|
||||
|
||||
void file_print(char* s, FILE* f)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include<stdlib.h>
|
||||
#define MAX_STRING 4096
|
||||
//CONSTANT MAX_STRING 4096
|
||||
// void* calloc(int count, int size);
|
||||
|
||||
char* copy_string(char* target, char* source)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* -*- c-file-style: "linux";indent-tabs-mode:t -*- */
|
||||
/* Copyright (C) 2016 Jeremiah Orians
|
||||
* Copyright (C) 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
CONSTANT NULL 0
|
||||
CONSTANT stdout 1
|
||||
CONSTANT stderr 2
|
||||
CONSTANT EXIT_SUCCESS 0
|
||||
CONSTANT EXIT_FAILURE 1
|
||||
void* calloc(int count, int size);
|
||||
void exit(int value);
|
||||
int fgetc(FILE* f);
|
||||
void fputc(char s, FILE* f);
|
||||
FILE* fopen(char* filename, char* mode);
|
Loading…
Reference in New Issue