diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compilo.c | 39 | ||||
-rw-r--r-- | src/linker.c | 37 | ||||
-rw-r--r-- | src/simul.c | 5 |
3 files changed, 47 insertions, 34 deletions
diff --git a/src/compilo.c b/src/compilo.c index 61ea761..d63fb66 100644 --- a/src/compilo.c +++ b/src/compilo.c @@ -9,18 +9,21 @@ #include "hash.h" #include "assembler.h" -typedef void (*sighandler_t)(int); +typedef void (*sighandler_t) (int); -void invite(void) { +void invite(void) +{ fprintf(stderr, _("Assembler v1.0\n\n")); } -void usage(void) { +void usage(void) +{ fprintf(stderr, _("Usage: compilo program.asm objet.out\n")); exit(0); } -void init_all(void) { +void init_all(void) +{ fprintf(stderr, _(" o Initialising the meta engine... ")); if (meta_init()) { @@ -32,40 +35,44 @@ void init_all(void) { if (meta_load("instructions.txt")) { exception(1, _("Meta language loading failed.")); } - + fprintf(stderr, _(" Done!\n o Initialising the assembler core...")); - + if (assembler_init()) { exception(1, _("Assembler core init failed.")); } - + fprintf(stderr, _(" Done!\n")); } -void flush_all(void) { +void flush_all(void) +{ assembler_flush(); meta_flush(); } -void segfaulthand(int i) { +void segfaulthand(int i) +{ exception(1, _("Signal received: segfault")); } -int main(int argc, char ** argv) { +int main(int argc, char **argv) +{ invite(); - + /* signal(SIGSEGV, segfaulthand); */ - - if (argc != 3) usage(); + + if (argc != 3) + usage(); fprintf(stderr, _("\nPerforming initialisation...\n\n")); init_all(); assemble_file(argv[1], argv[2]); - + fprintf(stderr, _("\nPerforming shutdown...\n\n")); flush_all(); - + fprintf(stderr, _("Exitting, bye!\n")); - return 0; + return 0; } diff --git a/src/linker.c b/src/linker.c index 61301de..ba1583c 100644 --- a/src/linker.c +++ b/src/linker.c @@ -6,56 +6,63 @@ #include "exceptions.h" #include "linker.h" -typedef void (*sighandler_t)(int); +typedef void (*sighandler_t) (int); -void invite(void) { +void invite(void) +{ fprintf(stderr, _("Linker v1.0\n\n")); } -void usage(void) { +void usage(void) +{ fprintf(stderr, _("Usage: linker obj1 [obj2 [obj3 [...]]] binary\n")); exit(0); } -void init_all(int n) { +void init_all(int n) +{ fprintf(stderr, _(" o Initialising the linker... ")); init(n); fprintf(stderr, _(" Done!\n")); } -void flush_all(void) { +void flush_all(void) +{ flush(); } -void segfaulthand(int i) { +void segfaulthand(int i) +{ exception(1, _("Signal received: segfault")); } -int main(int argc, char ** argv) { +int main(int argc, char **argv) +{ int i; invite(); - + signal(SIGSEGV, segfaulthand); - - if (argc < 3) usage(); + + if (argc < 3) + usage(); fprintf(stderr, _("\nPerforming initialisation...\n\n")); init_all(argc - 2); - + fprintf(stderr, _("Linking files...\n")); - + for (i = 1; i < argc - 1; i++) { addfile(argv[i]); } - + fprintf(stderr, _("Generating output file...\n")); dumpfile(argv[i]); fprintf(stderr, _("\nPerforming shutdown...\n\n")); flush_all(); - + fprintf(stderr, _("Exitting, bye!\n")); - return 0; + return 0; } diff --git a/src/simul.c b/src/simul.c index 10593bf..11dd9d8 100644 --- a/src/simul.c +++ b/src/simul.c @@ -13,9 +13,8 @@ int main(void) { - Debogueur(); + Debogueur(); // Initialisation(); // Traitement(); - return (0); + return (0); } -
\ No newline at end of file |