diff options
-rw-r--r-- | include/assembler.h | 2 | ||||
-rw-r--r-- | include/parser.h | 1 | ||||
-rw-r--r-- | po/ProjetArchi.pot | 169 | ||||
-rw-r--r-- | po/cat-id-tbl.c | 133 | ||||
-rw-r--r-- | src/compilo.c | 18 |
5 files changed, 214 insertions, 109 deletions
diff --git a/include/assembler.h b/include/assembler.h index 1092561..2f3fc7a 100644 --- a/include/assembler.h +++ b/include/assembler.h @@ -4,6 +4,8 @@ int assembler_init(void); void assembler_flush(void); void asm_eol(void); +void asm_eof(void); +int process_file(char *); void push_pile(char *); void act_pile(int); diff --git a/include/parser.h b/include/parser.h index f045464..f6d56ba 100644 --- a/include/parser.h +++ b/include/parser.h @@ -12,6 +12,7 @@ enum { OP_MOINS_UNARY, OP_DIV, OP_MUL, + OP_MOD, OP_LPAREN, OP_FUNC_CALL, OP_DECAL, diff --git a/po/ProjetArchi.pot b/po/ProjetArchi.pot index 0d55380..574e0d7 100644 --- a/po/ProjetArchi.pot +++ b/po/ProjetArchi.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2001-04-12 16:49+0200\n" +"POT-Creation-Date: 2001-04-15 03:08+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,6 +14,10 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" +#: lib/hash.c:14 +msgid "Internal error into hashing" +msgstr "" + #: lib/meta.c:79 #, c-format msgid "Read line '%s'" @@ -78,183 +82,260 @@ msgstr "" msgid "expecting ; as field separator" msgstr "" -#: lib/meta.c:558 src/compilo.c:19 +#: lib/meta.c:515 +msgid "Loading meta file" +msgstr "" + +#: lib/assembler.c:1600 lib/meta.c:516 +#, c-format +msgid "Opening file '%s'" +msgstr "" + +#: lib/assembler.c:1608 lib/meta.c:524 +msgid "Reading file" +msgstr "" + +#: lib/assembler.c:1610 lib/meta.c:526 +#, c-format +msgid "Reading line %i" +msgstr "" + +#: lib/meta.c:558 src/compilo.c:22 msgid "Meta parser init failed." msgstr "" -#: lib/parser.c:95 +#: lib/parser.c:96 msgid "Too many nested operators in expression.\n" msgstr "" -#: lib/parser.c:126 +#: lib/parser.c:127 msgid "Too many nested functions calls in expression.\n" msgstr "" -#: lib/parser.c:201 +#: lib/parser.c:202 msgid "Invalid unary operator" msgstr "" -#: lib/parser.c:203 +#: lib/parser.c:204 msgid "Invalid binary operator" msgstr "" -#: lib/parser.c:227 +#: lib/parser.c:228 msgid "Parse error: too much left parenthesis" msgstr "" -#: lib/parser.c:237 lib/parser.c:257 +#: lib/parser.c:238 lib/parser.c:258 msgid "Parse error: too much right parenthesis" msgstr "" -#: lib/parser.c:242 lib/parser.c:262 +#: lib/parser.c:243 lib/parser.c:263 msgid "Parse error: enclosure mismatch" msgstr "" -#: lib/parser.c:278 +#: lib/parser.c:279 msgid "Invalid character" msgstr "" -#: lib/assembler.c:191 +#: lib/assembler.c:167 +msgid "You have to be into the .text or the .data segment to define a value." +msgstr "" + +#: lib/assembler.c:190 +msgid "Label already defined" +msgstr "" + +#: lib/assembler.c:253 +msgid "You can't have the startpoint elsewhere than the .text segment" +msgstr "" + +#: lib/assembler.c:394 msgid "Not a valid . directive" msgstr "" -#: lib/assembler.c:220 +#: lib/assembler.c:423 msgid "Not a valid # directive" msgstr "" #. Cas des directives . -#: lib/assembler.c:228 +#: lib/assembler.c:431 msgid "Error: extra parameters to a . directive." msgstr "" -#: lib/assembler.c:322 +#: lib/assembler.c:534 msgid "Too much arguments to #undef" msgstr "" -#: lib/assembler.c:326 +#: lib/assembler.c:538 msgid "Defined symbol not found." msgstr "" -#: lib/assembler.c:332 +#: lib/assembler.c:544 msgid "Too much arguments to #include" msgstr "" -#: lib/assembler.c:334 +#: lib/assembler.c:546 #, c-format msgid "Including file at line %i" msgstr "" -#: lib/assembler.c:385 +#: lib/assembler.c:599 lib/assembler.c:605 msgid "Zero divide." msgstr "" -#: lib/assembler.c:398 lib/assembler.c:405 +#: lib/assembler.c:618 lib/assembler.c:625 msgid "Error: unable to compute the immediate value" msgstr "" -#: lib/assembler.c:414 +#: lib/assembler.c:634 msgid "Function unknow" msgstr "" -#: lib/assembler.c:421 +#: lib/assembler.c:641 msgid "Addresses addition not allowed" msgstr "" -#: lib/assembler.c:425 +#: lib/assembler.c:645 msgid "You can only use the decal operator on labels" msgstr "" -#: lib/assembler.c:430 lib/assembler.c:433 lib/assembler.c:454 +#: lib/assembler.c:650 lib/assembler.c:653 lib/assembler.c:684 msgid "Address operation invalid" msgstr "" -#: lib/assembler.c:436 lib/assembler.c:458 +#: lib/assembler.c:656 lib/assembler.c:688 msgid "Addresses operations not allowed" msgstr "" -#: lib/assembler.c:439 lib/assembler.c:551 lib/assembler.c:588 -#: lib/assembler.c:662 +#: lib/assembler.c:659 lib/assembler.c:781 lib/assembler.c:818 +#: lib/assembler.c:892 msgid "Expression too complex or invalid" msgstr "" -#: lib/assembler.c:462 lib/assembler.c:475 lib/assembler.c:528 -#: lib/assembler.c:540 lib/assembler.c:577 +#: lib/assembler.c:692 lib/assembler.c:705 lib/assembler.c:758 +#: lib/assembler.c:770 lib/assembler.c:807 msgid "Address type not supported" msgstr "" -#: lib/assembler.c:544 +#: lib/assembler.c:774 msgid "Address addition not supported" msgstr "" -#: lib/assembler.c:581 lib/assembler.c:633 +#: lib/assembler.c:811 lib/assembler.c:863 msgid "Expression invalid" msgstr "" #. Bon si l'on est ici, c'est pas bon signe non plus... -#: lib/assembler.c:706 lib/assembler.c:713 +#: lib/assembler.c:936 msgid "Expression too complex" msgstr "" -#: lib/assembler.c:751 +#: lib/assembler.c:997 msgid "Something wrong, nested operator called..." msgstr "" -#: lib/assembler.c:819 +#: lib/assembler.c:1068 msgid "Something wrong, lparenthesis operator called..." msgstr "" -#: lib/assembler.c:822 +#: lib/assembler.c:1071 msgid "Something wrong, should never got here..." msgstr "" -#: src/compilo.c:12 +#: lib/assembler.c:1238 +msgid "Unknow predefined string into the meta language" +msgstr "" + +#: lib/assembler.c:1294 lib/assembler.c:1355 lib/assembler.c:1390 +#: lib/assembler.c:1395 lib/assembler.c:1402 +msgid "Pattern not matching..." +msgstr "" + +#: lib/assembler.c:1449 lib/assembler.c:1561 +msgid "Unknow instruction" +msgstr "" + +#: lib/assembler.c:1476 +msgid "Bad constant for an immediate value" +msgstr "" + +#: lib/assembler.c:1493 +msgid "Bad constant for a string" +msgstr "" + +#: lib/assembler.c:1501 +msgid "You can only have an instruction into a .text segment" +msgstr "" + +#: lib/assembler.c:1504 +msgid "Unmatched instruction" +msgstr "" + +#: lib/assembler.c:1527 lib/assembler.c:1547 +msgid "Unknow constant type in the meta language" +msgstr "" + +#: lib/assembler.c:1599 +msgid "Loading file" +msgstr "" + +#: lib/assembler.c:1619 +#, c-format +msgid "Summering line %s" +msgstr "" + +#: src/compilo.c:15 msgid "" "Assembler\n" "\n" msgstr "" -#: src/compilo.c:16 +#: src/compilo.c:19 msgid " o Initialising the meta engine... " msgstr "" -#: src/compilo.c:22 +#: src/compilo.c:25 msgid "" " Done!\n" " o Meta language loading... " msgstr "" -#: src/compilo.c:25 +#: src/compilo.c:28 msgid "Meta language loading failed." msgstr "" -#: src/compilo.c:28 +#: src/compilo.c:31 msgid "" " Done!\n" " o Initialising the assembler core..." msgstr "" -#: src/compilo.c:31 +#: src/compilo.c:34 msgid "Assembler core init failed." msgstr "" -#: src/compilo.c:34 +#: src/compilo.c:37 msgid " Done!\n" msgstr "" -#: src/compilo.c:45 +#: src/compilo.c:46 +msgid "Signal received: segfault" +msgstr "" + +#. signal(SIGSEGV, segfaulthand); +#: src/compilo.c:54 msgid "" "\n" "Performing initialisation...\n" "\n" msgstr "" -#: src/compilo.c:57 +#: src/compilo.c:59 msgid "" "\n" "Performing shutdown...\n" "\n" msgstr "" -#: src/compilo.c:60 +#: src/compilo.c:62 msgid "Exitting, bye!\n" msgstr "" diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index fceae3e..e9facc5 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -8,74 +8,93 @@ const struct _msg_ent _msg_tbl[] = { {"", 1}, - {"Read line '%s'", 2}, - {"Analysing word '%s'", 3}, - {"Missing operator ':'", 4}, - {"Invalid number.", 5}, - {"Expecting ';' for field separator.", 6}, - {"Expecting ',' for field separator.", 7}, - {"Identifier incorrect.", 8}, - {"Error: Expecting a . after a =", 9}, - {"Extra parameters for field 'p'.", 10}, - {"Unexpected char at end of line.", 11}, - {"Expecting operator '=' for field 'p'.", 12}, - {"Error: character . expected.", 13}, - {"= expected after an implicit name", 14}, - {"Identifier incorrect", 15}, - {"expecting ; as field separator", 16}, - {"Meta parser init failed.", 17}, - {"Too many nested operators in expression.\n", 18}, - {"Too many nested functions calls in expression.\n", 19}, - {"Invalid unary operator", 20}, - {"Invalid binary operator", 21}, - {"Parse error: too much left parenthesis", 22}, - {"Parse error: too much right parenthesis", 23}, - {"Parse error: enclosure mismatch", 24}, - {"Invalid character", 25}, - {"Not a valid . directive", 26}, - {"Not a valid # directive", 27}, - {"Error: extra parameters to a . directive.", 28}, - {"Too much arguments to #undef", 29}, - {"Defined symbol not found.", 30}, - {"Too much arguments to #include", 31}, - {"Including file at line %i", 32}, - {"Zero divide.", 33}, - {"Error: unable to compute the immediate value", 34}, - {"Function unknow", 35}, - {"Addresses addition not allowed", 36}, - {"You can only use the decal operator on labels", 37}, - {"Address operation invalid", 38}, - {"Addresses operations not allowed", 39}, - {"Expression too complex or invalid", 40}, - {"Address type not supported", 41}, - {"Address addition not supported", 42}, - {"Expression invalid", 43}, - {"Expression too complex", 44}, - {"Something wrong, nested operator called...", 45}, - {"Something wrong, lparenthesis operator called...", 46}, - {"Something wrong, should never got here...", 47}, + {"Internal error into hashing", 2}, + {"Read line '%s'", 3}, + {"Analysing word '%s'", 4}, + {"Missing operator ':'", 5}, + {"Invalid number.", 6}, + {"Expecting ';' for field separator.", 7}, + {"Expecting ',' for field separator.", 8}, + {"Identifier incorrect.", 9}, + {"Error: Expecting a . after a =", 10}, + {"Extra parameters for field 'p'.", 11}, + {"Unexpected char at end of line.", 12}, + {"Expecting operator '=' for field 'p'.", 13}, + {"Error: character . expected.", 14}, + {"= expected after an implicit name", 15}, + {"Identifier incorrect", 16}, + {"expecting ; as field separator", 17}, + {"Loading meta file", 18}, + {"Opening file '%s'", 19}, + {"Reading file", 20}, + {"Reading line %i", 21}, + {"Meta parser init failed.", 22}, + {"Too many nested operators in expression.\n", 23}, + {"Too many nested functions calls in expression.\n", 24}, + {"Invalid unary operator", 25}, + {"Invalid binary operator", 26}, + {"Parse error: too much left parenthesis", 27}, + {"Parse error: too much right parenthesis", 28}, + {"Parse error: enclosure mismatch", 29}, + {"Invalid character", 30}, + {"You have to be into the .text or the .data segment to define a value.", 31}, + {"Label already defined", 32}, + {"You can't have the startpoint elsewhere than the .text segment", 33}, + {"Not a valid . directive", 34}, + {"Not a valid # directive", 35}, + {"Error: extra parameters to a . directive.", 36}, + {"Too much arguments to #undef", 37}, + {"Defined symbol not found.", 38}, + {"Too much arguments to #include", 39}, + {"Including file at line %i", 40}, + {"Zero divide.", 41}, + {"Error: unable to compute the immediate value", 42}, + {"Function unknow", 43}, + {"Addresses addition not allowed", 44}, + {"You can only use the decal operator on labels", 45}, + {"Address operation invalid", 46}, + {"Addresses operations not allowed", 47}, + {"Expression too complex or invalid", 48}, + {"Address type not supported", 49}, + {"Address addition not supported", 50}, + {"Expression invalid", 51}, + {"Expression too complex", 52}, + {"Something wrong, nested operator called...", 53}, + {"Something wrong, lparenthesis operator called...", 54}, + {"Something wrong, should never got here...", 55}, + {"Unknow predefined string into the meta language", 56}, + {"Pattern not matching...", 57}, + {"Unknow instruction", 58}, + {"Bad constant for an immediate value", 59}, + {"Bad constant for a string", 60}, + {"You can only have an instruction into a .text segment", 61}, + {"Unmatched instruction", 62}, + {"Unknow constant type in the meta language", 63}, + {"Loading file", 64}, + {"Summering line %s", 65}, {"\ Assembler\n\ -\n", 48}, - {" o Initialising the meta engine... ", 49}, +\n", 66}, + {" o Initialising the meta engine... ", 67}, {"\ Done!\n\ - o Meta language loading... ", 50}, - {"Meta language loading failed.", 51}, + o Meta language loading... ", 68}, + {"Meta language loading failed.", 69}, {"\ Done!\n\ - o Initialising the assembler core...", 52}, - {"Assembler core init failed.", 53}, - {" Done!\n", 54}, + o Initialising the assembler core...", 70}, + {"Assembler core init failed.", 71}, + {" Done!\n", 72}, + {"Signal received: segfault", 73}, {"\ \n\ Performing initialisation...\n\ -\n", 55}, +\n", 74}, {"\ \n\ Performing shutdown...\n\ -\n", 56}, - {"Exitting, bye!\n", 57}, +\n", 75}, + {"Exitting, bye!\n", 76}, }; -int _msg_tbl_length = 57; +int _msg_tbl_length = 76; diff --git a/src/compilo.c b/src/compilo.c index ccacb32..f7440fb 100644 --- a/src/compilo.c +++ b/src/compilo.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <signal.h> #include "config.h" #include "exceptions.h" #include "meta.h" @@ -8,6 +9,8 @@ #include "hash.h" #include "assembler.h" +typedef void (*sighandler_t)(int); + void invite(void) { fprintf(stderr, _("Assembler\n\n")); } @@ -39,20 +42,19 @@ void flush_all(void) { meta_flush(); } +void segfaulthand(int i) { + exception(1, _("Signal received: segfault")); +} + int main(void) { invite(); + +/* signal(SIGSEGV, segfaulthand);*/ fprintf(stderr, _("\nPerforming initialisation...\n\n")); init_all(); - parse_line("MoV R12, R31 ; petit test."); - asm_eol(); - - parse_line("MOV R12, Label[R23]"); - asm_eol(); - - parse_line("MOV R31, [Label + 12 + R12]"); - asm_eol(); + process_file("progtest.asm"); fprintf(stderr, _("\nPerforming shutdown...\n\n")); flush_all(); |