summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixlib/mix_parser.c19
-rw-r--r--mixlib/mix_scanner.l4
-rw-r--r--mixlib/xmix_parser.h6
-rw-r--r--po/ca.po2
4 files changed, 24 insertions, 7 deletions
diff --git a/mixlib/mix_parser.c b/mixlib/mix_parser.c
index 74317ac..36d5b3a 100644
--- a/mixlib/mix_parser.c
+++ b/mixlib/mix_parser.c
@@ -192,12 +192,14 @@ undef_warning_ (gpointer symbol, gpointer value, gpointer data)
}
static void
-update_future_refs_ (mix_parser_t *parser, const gchar *name)
+update_future_refs_value_ (mix_parser_t *parser, const gchar *name,
+ mix_short_t value)
{
GSList *list = NULL;
gpointer key;
g_assert (parser != NULL && name != NULL);
+ printf ("Updating future %s\n", name);
if ( g_hash_table_lookup_extended (parser->future_refs, name, &key,
(gpointer *)&list) )
@@ -209,7 +211,7 @@ update_future_refs_ (mix_parser_t *parser, const gchar *name)
node =
(ins_node_ *)g_tree_lookup (parser->ins_table,tmp->data);
g_assert (node);
- mix_word_set_address (node->ins, parser->loc_count);
+ mix_word_set_address (node->ins, value);
g_tree_insert (parser->ins_table, tmp->data, (gpointer)node);
tmp = g_slist_next (tmp);
}
@@ -219,6 +221,9 @@ update_future_refs_ (mix_parser_t *parser, const gchar *name)
}
}
+#define update_future_refs_(parser,name) \
+ update_future_refs_value_(parser, name, (parser)->loc_count);
+
static void
update_ls_ (gpointer symbol, gpointer value, gpointer parser)
{ /* add an instruction on current location and update refs to it */
@@ -392,14 +397,20 @@ mix_parser_err_t
mix_parser_define_symbol_here (mix_parser_t *parser, const gchar *name)
{
mix_word_t value = mix_short_to_word_fast (parser->loc_count);
-
+ return mix_parser_define_symbol_value (parser, name, value);
+}
+
+mix_parser_err_t
+mix_parser_define_symbol_value (mix_parser_t *parser, const gchar *name,
+ mix_word_t value)
+{
g_assert (parser != NULL && name != NULL);
switch (mix_symbol_table_add (parser->symbol_table, name, value))
{
case MIX_SYM_OK:
if ( parser->status == MIX_PERR_NOCOMP )
- update_future_refs_ (parser, name);
+ update_future_refs_value_ (parser, name, value);
return MIX_PERR_OK;
case MIX_SYM_LONG: return MIX_PERR_LONG_SYMBOL;
case MIX_SYM_DUP: return MIX_PERR_DUP_SYMBOL;
diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l
index f740d10..b1d4a13 100644
--- a/mixlib/mix_scanner.l
+++ b/mixlib/mix_scanner.l
@@ -176,7 +176,7 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
BEGIN (OP);
}
{flocsymbol}|{blocsymbol} RETURN_ERROR (MIX_PERR_UNEX_LOC, yytext);
- {symbol}/{ws}+EQU { /* store symbol name for future definition */
+ {symbol}/({ws}+EQU) { /* store symbol name for future definition */
symbol = g_strdup (yytext);
if ( symbol == NULL ) {
mix_parser_log_error (parser, MIX_PERR_INTERNAL, lineno, NULL, FALSE);
@@ -263,7 +263,7 @@ wexpr {expr}({fpart})?(,{expr}({fpart})?)*
gint def;
if ( symbol == NULL ) RETURN_ERROR (MIX_PERR_MIS_SYM, NULL);
value = mix_word_new (atol (yytext));
- def = mix_symbol_table_add (parser->symbol_table, symbol, value);
+ def = mix_parser_define_symbol_value (parser, symbol, value);
if ( def == MIX_SYM_DUP ) RETURN_ERROR (MIX_PERR_DUP_SYMBOL, symbol);
if ( def == MIX_SYM_LONG ) RETURN_ERROR (MIX_PERR_LONG_SYMBOL, symbol);
++lineno;
diff --git a/mixlib/xmix_parser.h b/mixlib/xmix_parser.h
index fee385c..bbcd108 100644
--- a/mixlib/xmix_parser.h
+++ b/mixlib/xmix_parser.h
@@ -57,6 +57,12 @@ typedef struct ins_node_
/* functions to manipulate mix_parser_t during compilation */
/* symbol table */
+/* Define a new symbol with given value
+ * and update previously set refs to this symbol
+ */
+extern mix_parser_err_t
+mix_parser_define_symbol_value (mix_parser_t *parser, const gchar *name,
+ mix_word_t value);
/* Define a new symbol with value equal to the current loc_count
* and update previously set refs to this symbol
diff --git a/po/ca.po b/po/ca.po
index 32631da..1f787a7 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: mdk 0.1\n"
-"POT-Creation-Date: 2000-10-23 00:07+0200\n"
+"POT-Creation-Date: 2000-11-02 00:16+0100\n"
"PO-Revision-Date: 2000-02-28 01:37+01:00\n"
"Last-Translator: jose antonio ortega ruiz <jaortega@retemail.es>\n"
"Language-Team: jose antonio ortega ruiz <jaortega@retemail.es>\n"