summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compilo.c62
-rw-r--r--src/linker.c52
-rw-r--r--src/simul.c122
3 files changed, 118 insertions, 118 deletions
diff --git a/src/compilo.c b/src/compilo.c
index f2c4c98..0fa17eb 100644
--- a/src/compilo.c
+++ b/src/compilo.c
@@ -13,69 +13,69 @@ typedef void (*sighandler_t) (int);
void invite(void)
{
- fprintf(stderr, _("Assembler v1.0\n\n"));
+ fprintf(stderr, _("Assembler v1.0\n\n"));
}
void usage(void)
{
- fprintf(stderr, _("Usage: compilo program.asm objet.out\n"));
- exit(0);
+ fprintf(stderr, _("Usage: compilo program.asm objet.out\n"));
+ exit(0);
}
void init_all(void)
{
- fprintf(stderr, _(" o Initialising the meta engine... "));
+ fprintf(stderr, _(" o Initialising the meta engine... "));
- if (meta_init()) {
- exception(1, _("Meta parser init failed."));
- }
+ if (meta_init()) {
+ exception(1, _("Meta parser init failed."));
+ }
- fprintf(stderr, _(" Done!\n o Meta language loading... "));
+ fprintf(stderr, _(" Done!\n o Meta language loading... "));
- if (meta_load("instructions.txt")) {
- exception(1, _("Meta language loading failed."));
- }
+ if (meta_load("instructions.txt")) {
+ exception(1, _("Meta language loading failed."));
+ }
- fprintf(stderr, _(" Done!\n o Initialising the assembler core..."));
+ fprintf(stderr, _(" Done!\n o Initialising the assembler core..."));
- if (assembler_init()) {
- exception(1, _("Assembler core init failed."));
- }
+ if (assembler_init()) {
+ exception(1, _("Assembler core init failed."));
+ }
- fprintf(stderr, _(" Done!\n"));
+ fprintf(stderr, _(" Done!\n"));
}
void flush_all(void)
{
- assembler_flush();
- meta_flush();
+ assembler_flush();
+ meta_flush();
}
void segfaulthand(int i)
{
- exception(1, _("Signal received: segfault"));
+ exception(1, _("Signal received: segfault"));
}
int main(int argc, char **argv)
{
- invite();
+ invite();
#ifndef DEBUG
- signal(SIGSEGV, segfaulthand);
+ signal(SIGSEGV, segfaulthand);
#endif
- if (argc != 3)
- usage();
+ if (argc != 3)
+ usage();
- fprintf(stderr, _("\nPerforming initialisation...\n\n"));
- init_all();
+ fprintf(stderr, _("\nPerforming initialisation...\n\n"));
+ init_all();
- assemble_file(argv[1], argv[2]);
+ assemble_file(argv[1], argv[2]);
- fprintf(stderr, _("\nPerforming shutdown...\n\n"));
- flush_all();
+ fprintf(stderr, _("\nPerforming shutdown...\n\n"));
+ flush_all();
- signal(SIGSEGV, NULL);
+ signal(SIGSEGV, NULL);
- fprintf(stderr, _("Exitting, bye!\n"));
- return 0;
+ fprintf(stderr, _("Exitting, bye!\n"));
+ return 0;
}
diff --git a/src/linker.c b/src/linker.c
index 727f76f..17e2ffb 100644
--- a/src/linker.c
+++ b/src/linker.c
@@ -10,61 +10,61 @@ typedef void (*sighandler_t) (int);
void invite(void)
{
- fprintf(stderr, _("Linker v1.0\n\n"));
+ fprintf(stderr, _("Linker v1.0\n\n"));
}
void usage(void)
{
- fprintf(stderr, _("Usage: linker obj1 [obj2 [obj3 [...]]] binary\n"));
- exit(0);
+ fprintf(stderr, _("Usage: linker obj1 [obj2 [obj3 [...]]] binary\n"));
+ exit(0);
}
void init_all(int n)
{
- fprintf(stderr, _(" o Initialising the linker... "));
+ fprintf(stderr, _(" o Initialising the linker... "));
- init(n);
- fprintf(stderr, _(" Done!\n"));
+ init(n);
+ fprintf(stderr, _(" Done!\n"));
}
void flush_all(void)
{
- flush();
+ flush();
}
void segfaulthand(int i)
{
- exception(1, _("Signal received: segfault"));
+ exception(1, _("Signal received: segfault"));
}
int main(int argc, char **argv)
{
- int i;
+ int i;
- invite();
+ invite();
- signal(SIGSEGV, segfaulthand);
+ signal(SIGSEGV, segfaulthand);
- if (argc < 3)
- usage();
+ if (argc < 3)
+ usage();
- fprintf(stderr, _("\nPerforming initialisation...\n\n"));
- init_all(argc - 2);
+ fprintf(stderr, _("\nPerforming initialisation...\n\n"));
+ init_all(argc - 2);
- fprintf(stderr, _("Linking files...\n"));
+ fprintf(stderr, _("Linking files...\n"));
- for (i = 1; i < argc - 1; i++) {
- addfile(argv[i]);
- }
+ for (i = 1; i < argc - 1; i++) {
+ addfile(argv[i]);
+ }
- fprintf(stderr, _("Generating output file...\n"));
- dumpfile(argv[i]);
+ fprintf(stderr, _("Generating output file...\n"));
+ dumpfile(argv[i]);
- fprintf(stderr, _("\nPerforming shutdown...\n\n"));
- flush_all();
+ fprintf(stderr, _("\nPerforming shutdown...\n\n"));
+ flush_all();
- signal(SIGSEGV, NULL);
+ signal(SIGSEGV, NULL);
- fprintf(stderr, _("Exitting, bye!\n"));
- return 0;
+ fprintf(stderr, _("Exitting, bye!\n"));
+ return 0;
}
diff --git a/src/simul.c b/src/simul.c
index 19de608..3701ea1 100644
--- a/src/simul.c
+++ b/src/simul.c
@@ -13,106 +13,106 @@ typedef void (*sighandler_t) (int);
void invite(void)
{
- fprintf(stderr, _("Simul v1.0\n\n"));
+ fprintf(stderr, _("Simul v1.0\n\n"));
}
void usage(void)
{
- fprintf(stderr, _("Usage: linker [-s] [-d] binary\n"));
- exit(0);
+ fprintf(stderr, _("Usage: linker [-s] [-d] binary\n"));
+ exit(0);
}
void init_all(void)
{
- fprintf(stderr, _(" o Initialising the simulator... "));
+ fprintf(stderr, _(" o Initialising the simulator... "));
- Initialisation();
- fprintf(stderr, _(" Done!\n"));
+ Initialisation();
+ fprintf(stderr, _(" Done!\n"));
}
void flush_all(void)
{
- Flush();
+ Flush();
}
void segfaulthand(int i)
{
- exception(1, _("Signal received: segfault"));
+ exception(1, _("Signal received: segfault"));
}
void ctrlbreakhand(int i)
{
- debug = 1;
+ debug = 1;
}
char *readargs(int argc, char **argv)
{
- char *r = NULL;
-
- argc--;
- argv++;
-
- Rapide = 1;
-
- while (argc) {
- if (**argv == '-') {
- switch ((*argv)[1]) {
- case 's':
- Rapide = 0;
- break;
- case 'd':
- debug = 1;
- break;
- default:
- usage();
- }
- } else {
- if (r) {
- usage();
- }
- r = *argv;
- }
- argv++;
- argc--;
- }
-
- if (!r) {
+ char *r = NULL;
+
+ argc--;
+ argv++;
+
+ Rapide = 1;
+
+ while (argc) {
+ if (**argv == '-') {
+ switch ((*argv)[1]) {
+ case 's':
+ Rapide = 0;
+ break;
+ case 'd':
+ debug = 1;
+ break;
+ default:
+ usage();
+ }
+ } else {
+ if (r) {
usage();
+ }
+ r = *argv;
}
- return r;
+ argv++;
+ argc--;
+ }
+
+ if (!r) {
+ usage();
+ }
+ return r;
}
int main(int argc, char **argv)
{
- int i;
- char *nom;
+ int i;
+ char *nom;
- invite();
+ invite();
- nom = readargs(argc, argv);
+ nom = readargs(argc, argv);
- signal(SIGSEGV, segfaulthand);
- signal(SIGINT, ctrlbreakhand);
+ signal(SIGSEGV, segfaulthand);
+ signal(SIGINT, ctrlbreakhand);
- fprintf(stderr, _("\nPerforming initialisation...\n\n"));
- init_all();
+ fprintf(stderr, _("\nPerforming initialisation...\n\n"));
+ init_all();
- pushcontext(_("Beginning simulation"));
+ pushcontext(_("Beginning simulation"));
- openterm();
- initterm();
- clearterm();
- ChargeBinaire(nom);
- clearterm();
+ openterm();
+ initterm();
+ clearterm();
+ ChargeBinaire(nom);
+ clearterm();
- popcontext();
+ popcontext();
- fprintf(stderr, _("\nPerforming shutdown...\n\n"));
- flush_all();
+ fprintf(stderr, _("\nPerforming shutdown...\n\n"));
+ flush_all();
- signal(SIGSEGV, NULL);
- signal(SIGINT, NULL);
+ signal(SIGSEGV, NULL);
+ signal(SIGINT, NULL);
- fprintf(stderr, _("Exitting, bye!\n"));
- return 0;
+ fprintf(stderr, _("Exitting, bye!\n"));
+ return 0;
}