summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <>2001-04-15 03:27:30 +0000
committerPixel <>2001-04-15 03:27:30 +0000
commit9e44b6dca12c57022d66bd1fe7e9b50c3d741389 (patch)
tree2de7e6bc1319651403b12fd9341ff3be4c0aca8a
parentba6d5b2571acd4010c929901b490bcd836c4ca3c (diff)
Compilo
-rw-r--r--lib/assembler.c86
-rw-r--r--lib/hash.c2
-rw-r--r--lib/meta.c2
-rw-r--r--po/ProjetArchi.pot57
-rw-r--r--po/cat-id-tbl.c108
5 files changed, 177 insertions, 78 deletions
diff --git a/lib/assembler.c b/lib/assembler.c
index 513a6be..34ee48a 100644
--- a/lib/assembler.c
+++ b/lib/assembler.c
@@ -969,6 +969,7 @@ static void evaluate(expression_t * e)
t = (expression_t *) Emalloc(sizeof(expression_t));
t->e_type = t->e_subtype = E_VALUE;
t->avalue = 0;
+ t->pattern = NULL;
t->next = t->child = NULL;
t->prev = e->child;
e->child->next = t;
@@ -986,6 +987,7 @@ void act_pile(int o)
int i, nbargs;
e = Emalloc(sizeof(expression_t));
+ e->pattern = NULL;
e->op = o;
e->avalue = 0;
e->symbol = NULL;
@@ -1133,7 +1135,7 @@ static void super_pattern(pattern_t * patterns, expression_t * e)
if (e->e_subtype == E_OPERATION) {
if (((e->op == OP_DIRECT) && (e->child->e_subtype == E_VALUE))
|| ((e->op == OP_DECAL)
- && (e->child->next->e_subtype = E_VALUE))) {
+ && (e->child->next->e_subtype == E_VALUE))) {
e->pattern = patterns;
e->index = i;
}
@@ -1322,6 +1324,7 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e)
t->e_type = t->e_subtype = E_VALUE;
t->avalue = e->index;
t->symbol = NULL;
+ t->pattern = NULL;
InsererVarDansTab(it, CreerElement(m->name, t));
free(t);
}
@@ -1346,6 +1349,7 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e)
}
pushdword(tv, e->child);
} else {
+ exception(1, _("Logical error in meta language"));
}
}
m = n;
@@ -1362,6 +1366,8 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e)
t = (expression_t *) Emalloc(sizeof(expression_t));
t->next = t->child = t->prev = t->father = NULL;
t->e_type = t->e_subtype = E_VALUE;
+ t->pattern = NULL;
+
if (e->child->next->e_subtype == E_PATTERN) {
t->avalue = e->child->next->index;
} else {
@@ -1392,6 +1398,7 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e)
t->e_type = t->e_subtype = E_VALUE;
t->avalue = e->child->index;
t->symbol = NULL;
+ t->pattern = NULL;
InsererVarDansTab(it, CreerElement(m->name, t));
free(t);
}
@@ -1401,11 +1408,49 @@ static void evaluate_pattern(_TableauVariable * it, expression_t * e)
}
}
+static int evaluate_field(_TableauVariable it, char * field, field_t * fields) {
+ int i, r, e, n;
+ char trouve;
+ expression_t * t;
+
+ for (fields = fields->next; fields; fields = fields->next) {
+ if (!strcmp(field + 1, fields->name)) {
+ break;
+ }
+ }
+
+ if (!(fields)) {
+ exception(1, _("Unknow field in metalanguage"));
+ }
+
+ r = 0;
+ n = 0;
+
+ for (i = 0; i < fields->nbr; i++) {
+ t = (expression_t *) NomVarToVar(fields->names[i], it, &trouve);
+ e = 0;
+ if (trouve) {
+ if (t->e_subtype == E_VALUE) {
+ exception(1, _("Can't evaluate directly expression"));
+ }
+ e = t->avalue;
+ }
+ n = fields->sizes[i];
+ if ((e & (n - 1)) != e) {
+ exception(1, _("Value too large for field"));
+ }
+ r = (r << n) | e;
+ }
+
+ return r;
+}
+
void asm_eol(void)
{
instruct_t *instr;
expression_t *t;
int i;
+ char trouve;
bytestream_t *pi;
_TableauVariable it;
@@ -1424,6 +1469,7 @@ void asm_eol(void)
fprintf(stderr, "Fin de ligne sur:\n");
debug_print_expression(e_line);
+ fprintf(stderr, "-----\n");
e_current = e_line;
/* Est-ce que le premier mot est un label terminant par ':' ? */
@@ -1448,6 +1494,7 @@ void asm_eol(void)
}
}
+
switch (e_current->e_subtype) {
case E_INTERNAL:
switch (e_current->op) {
@@ -1533,6 +1580,7 @@ void asm_eol(void)
t->e_type = t->e_subtype = E_VALUE;
t->avalue = e_current->index;
t->child = t->next = NULL;
+ t->pattern = NULL;
InsererVarDansTab(&it, CreerElement(instr->names[i], t));
free(t);
evaluate_pattern(&it, e_current);
@@ -1548,13 +1596,43 @@ void asm_eol(void)
e_current = e_line;
}
- fprintf(stderr, "Variables explicites:\n");
+ for (i = 0; i < instr->nbimplicit; i++) {
+ switch(instr->itypes[i]) {
+ case 0: /* type direct */
+ t = (expression_t *) NomVarToVar(instr->istrings[i], it, &trouve);
+ if (!trouve) {
+ exception(1, _("Syntax error in meta language"));
+ }
+ InsererVarDansTab(&it, CreerElement(instr->implicits[i], t));
+ break;
+ case 1: /* type prédéfinit */
+ t = (expression_t *) Emalloc(sizeof(expression_t));
+ t->e_type = t->e_subtype = E_VALUE;
+ if (instr->istrings[i][0] != 'F') {
+ exception(1, _("Logical error in meta language"));
+ }
+ t->avalue = evaluate_field(it, instr->istrings[i], fields);;
+ t->child = t->next = NULL;
+ t->pattern = NULL;
+ InsererVarDansTab(&it, CreerElement(instr->implicits[i], t));
+ break;
+ case 2: /* type valeur */
+ t = (expression_t *) Emalloc(sizeof(expression_t));
+ t->e_type = t->e_subtype = E_VALUE;
+ t->avalue = instr->ivalues[i];
+ t->child = t->next = NULL;
+ t->pattern = NULL;
+ InsererVarDansTab(&it, CreerElement(instr->implicits[i], t));
+ break;
+ }
+ }
+
+ fprintf(stderr, "Variables\n");
AfficheTableau(it);
+ pushdword(evaluate_field(it, "FI", fields), NULL);
DetruitTab(&it);
-
-
break;
default:
exception(1, _("Unknow instruction"));
diff --git a/lib/hash.c b/lib/hash.c
index bd406c8..6d890f7 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -140,7 +140,7 @@ _TypeVariable NomVarToVar(char *Nom, _TableauVariable t, char *trouve)
void AfficheListe(_ListeChaine l)
{
while (l != NULL) {
- printf("%s\n", l->Elem.NomVar);
+ fprintf(stderr, "%s\n", l->Elem.NomVar);
l = l->Suivant;
}
}
diff --git a/lib/meta.c b/lib/meta.c
index 0bc6f48..be13434 100644
--- a/lib/meta.c
+++ b/lib/meta.c
@@ -617,7 +617,7 @@ void main(void)
instruct->istrings[i]);
break;
case 1:
- fprintf(stderr, " + %s <= %i (type prédéfinit)\n", instruct->implicits[i],
+ fprintf(stderr, " + %s <= %s (type prédéfinit)\n", instruct->implicits[i],
instruct->istrings[i]);
break;
case 2:
diff --git a/po/ProjetArchi.pot b/po/ProjetArchi.pot
index 3c84869..8dcaa2c 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-15 04:18+0200\n"
+"POT-Creation-Date: 2001-04-15 05:17+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"
@@ -107,79 +107,96 @@ msgstr ""
msgid "Expression too complex"
msgstr ""
-#: lib/assembler.c:997
+#: lib/assembler.c:999
msgid "Something wrong, nested operator called..."
msgstr ""
-#: lib/assembler.c:1068
+#: lib/assembler.c:1070
msgid "Something wrong, lparenthesis operator called..."
msgstr ""
-#: lib/assembler.c:1071
+#: lib/assembler.c:1073
msgid "Something wrong, should never got here..."
msgstr ""
-#: lib/assembler.c:1238
+#: lib/assembler.c:1240
msgid "Unknow predefined string into the meta language"
msgstr ""
-#: lib/assembler.c:1295
+#: lib/assembler.c:1297
msgid "Pattern not matching..."
msgstr ""
-#: lib/assembler.c:1306 lib/assembler.c:1337 lib/assembler.c:1524
-#: lib/assembler.c:1541
+#: lib/assembler.c:1308 lib/assembler.c:1340 lib/assembler.c:1571
+#: lib/assembler.c:1589
msgid "Unknow constant type in the meta language"
msgstr ""
-#: lib/assembler.c:1318 lib/assembler.c:1360 lib/assembler.c:1388
+#: lib/assembler.c:1320 lib/assembler.c:1364 lib/assembler.c:1394
msgid ""
"Error in the metalanguage (pattern should be here if not a constant type)"
msgstr ""
-#: lib/assembler.c:1374 lib/assembler.c:1382
+#: lib/assembler.c:1352 lib/assembler.c:1380 lib/assembler.c:1388
+#: lib/assembler.c:1612
msgid "Logical error in meta language"
msgstr ""
-#: lib/assembler.c:1446 lib/assembler.c:1560
+#: lib/assembler.c:1423
+msgid "Unknow field in metalanguage"
+msgstr ""
+
+#: lib/assembler.c:1434
+msgid "Can't evaluate directly expression"
+msgstr ""
+
+#: lib/assembler.c:1440
+msgid "Value too large for field"
+msgstr ""
+
+#: lib/assembler.c:1492 lib/assembler.c:1638
msgid "Unknow instruction"
msgstr ""
-#: lib/assembler.c:1473
+#: lib/assembler.c:1520
msgid "Bad constant for an immediate value"
msgstr ""
-#: lib/assembler.c:1490
+#: lib/assembler.c:1537
msgid "Bad constant for a string"
msgstr ""
-#: lib/assembler.c:1498
+#: lib/assembler.c:1545
msgid "You can only have an instruction into a .text segment"
msgstr ""
-#: lib/assembler.c:1501
+#: lib/assembler.c:1548
msgid "Unmatched instruction"
msgstr ""
-#: lib/assembler.c:1598
+#: lib/assembler.c:1604
+msgid "Syntax error in meta language"
+msgstr ""
+
+#: lib/assembler.c:1676
msgid "Loading file"
msgstr ""
-#: lib/assembler.c:1599 lib/meta.c:516
+#: lib/assembler.c:1677 lib/meta.c:516
#, c-format
msgid "Opening file '%s'"
msgstr ""
-#: lib/assembler.c:1607 lib/meta.c:524
+#: lib/assembler.c:1685 lib/meta.c:524
msgid "Reading file"
msgstr ""
-#: lib/assembler.c:1609 lib/meta.c:526
+#: lib/assembler.c:1687 lib/meta.c:526
#, c-format
msgid "Reading line %i"
msgstr ""
-#: lib/assembler.c:1618
+#: lib/assembler.c:1696
#, c-format
msgid "Summering line %s"
msgstr ""
diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c
index f351e39..ba5b5b4 100644
--- a/po/cat-id-tbl.c
+++ b/po/cat-id-tbl.c
@@ -39,69 +39,73 @@ const struct _msg_ent _msg_tbl[] = {
{"\
Error in the metalanguage (pattern should be here if not a constant type)", 30},
{"Logical error in meta language", 31},
- {"Unknow instruction", 32},
- {"Bad constant for an immediate value", 33},
- {"Bad constant for a string", 34},
- {"You can only have an instruction into a .text segment", 35},
- {"Unmatched instruction", 36},
- {"Loading file", 37},
- {"Opening file '%s'", 38},
- {"Reading file", 39},
- {"Reading line %i", 40},
- {"Summering line %s", 41},
- {"Internal error into hashing", 42},
- {"Read line '%s'", 43},
- {"Analysing word '%s'", 44},
- {"Missing operator ':'", 45},
- {"Invalid number.", 46},
- {"Expecting ';' for field separator.", 47},
- {"Expecting ',' for field separator.", 48},
- {"Identifier incorrect.", 49},
- {"Error: Expecting a . after a =", 50},
- {"Extra parameters for field 'p'.", 51},
- {"Unexpected char at end of line.", 52},
- {"Expecting operator '=' for field 'p'.", 53},
- {"Error: character . expected.", 54},
- {"= expected after an implicit name", 55},
- {"Identifier incorrect", 56},
- {"expecting ; as field separator", 57},
- {"Loading meta file", 58},
- {"Meta parser init failed.", 59},
- {"Too many nested operators in expression.\n", 60},
- {"Too many nested functions calls in expression.\n", 61},
- {"Invalid unary operator", 62},
- {"Invalid binary operator", 63},
- {"Parse error: too much left parenthesis", 64},
- {"Parse error: too much right parenthesis", 65},
- {"Parse error: enclosure mismatch", 66},
- {"Invalid character", 67},
- {"Out of memory.", 68},
- {"Too much error contexts during pushcontext().", 69},
- {"Error context empty, but popcontext() called.", 70},
- {"FPU not implemented", 71},
+ {"Unknow field in metalanguage", 32},
+ {"Can't evaluate directly expression", 33},
+ {"Value too large for field", 34},
+ {"Unknow instruction", 35},
+ {"Bad constant for an immediate value", 36},
+ {"Bad constant for a string", 37},
+ {"You can only have an instruction into a .text segment", 38},
+ {"Unmatched instruction", 39},
+ {"Syntax error in meta language", 40},
+ {"Loading file", 41},
+ {"Opening file '%s'", 42},
+ {"Reading file", 43},
+ {"Reading line %i", 44},
+ {"Summering line %s", 45},
+ {"Internal error into hashing", 46},
+ {"Read line '%s'", 47},
+ {"Analysing word '%s'", 48},
+ {"Missing operator ':'", 49},
+ {"Invalid number.", 50},
+ {"Expecting ';' for field separator.", 51},
+ {"Expecting ',' for field separator.", 52},
+ {"Identifier incorrect.", 53},
+ {"Error: Expecting a . after a =", 54},
+ {"Extra parameters for field 'p'.", 55},
+ {"Unexpected char at end of line.", 56},
+ {"Expecting operator '=' for field 'p'.", 57},
+ {"Error: character . expected.", 58},
+ {"= expected after an implicit name", 59},
+ {"Identifier incorrect", 60},
+ {"expecting ; as field separator", 61},
+ {"Loading meta file", 62},
+ {"Meta parser init failed.", 63},
+ {"Too many nested operators in expression.\n", 64},
+ {"Too many nested functions calls in expression.\n", 65},
+ {"Invalid unary operator", 66},
+ {"Invalid binary operator", 67},
+ {"Parse error: too much left parenthesis", 68},
+ {"Parse error: too much right parenthesis", 69},
+ {"Parse error: enclosure mismatch", 70},
+ {"Invalid character", 71},
+ {"Out of memory.", 72},
+ {"Too much error contexts during pushcontext().", 73},
+ {"Error context empty, but popcontext() called.", 74},
+ {"FPU not implemented", 75},
{"\
Assembler\n\
-\n", 72},
- {" o Initialising the meta engine... ", 73},
+\n", 76},
+ {" o Initialising the meta engine... ", 77},
{"\
Done!\n\
- o Meta language loading... ", 74},
- {"Meta language loading failed.", 75},
+ o Meta language loading... ", 78},
+ {"Meta language loading failed.", 79},
{"\
Done!\n\
- o Initialising the assembler core...", 76},
- {"Assembler core init failed.", 77},
- {" Done!\n", 78},
- {"Signal received: segfault", 79},
+ o Initialising the assembler core...", 80},
+ {"Assembler core init failed.", 81},
+ {" Done!\n", 82},
+ {"Signal received: segfault", 83},
{"\
\n\
Performing initialisation...\n\
-\n", 80},
+\n", 84},
{"\
\n\
Performing shutdown...\n\
-\n", 81},
- {"Exitting, bye!\n", 82},
+\n", 85},
+ {"Exitting, bye!\n", 86},
};
-int _msg_tbl_length = 82;
+int _msg_tbl_length = 86;