diff options
| author | jaortega <jaortega> | 2000-11-18 12:04:24 +0000 | 
|---|---|---|
| committer | jaortega <jaortega> | 2000-11-18 12:04:24 +0000 | 
| commit | cf46fd449bd2b7a6ff41ac174c46af5ac41eb509 (patch) | |
| tree | 275e408fb2835b6b461a327c8af30d0fdf2f8675 | |
| parent | c70563a847c233deb4ba407c7c52a7ee430e26bc (diff) | |
| download | mdk-cf46fd449bd2b7a6ff41ac174c46af5ac41eb509.tar.gz mdk-cf46fd449bd2b7a6ff41ac174c46af5ac41eb509.tar.bz2 | |
fixed 3H ORIG 3B problem (samples/stress{1,2}.mixal)
| -rw-r--r-- | mixlib/mix_parser.c | 7 | ||||
| -rw-r--r-- | mixlib/mix_scanner.l | 43 | ||||
| -rw-r--r-- | mixlib/xmix_parser.h | 7 | ||||
| -rw-r--r-- | po/ca.po | 20 | 
4 files changed, 54 insertions, 23 deletions
| diff --git a/mixlib/mix_parser.c b/mixlib/mix_parser.c index 82dd692..1b876ad 100644 --- a/mixlib/mix_parser.c +++ b/mixlib/mix_parser.c @@ -442,7 +442,8 @@ mix_parser_set_future_ref (mix_parser_t *parser, const gchar *name)  /* Redefine the value of a local symbol as the current loc_count */  void -mix_parser_manage_local_symbol (mix_parser_t *parser, const gchar *name) +mix_parser_manage_local_symbol (mix_parser_t *parser, const gchar *name, +				mix_short_t value)  {    gchar ref[3];    ref[2] = 0; @@ -459,10 +460,10 @@ mix_parser_manage_local_symbol (mix_parser_t *parser, const gchar *name)        ref[0] = name[0];        ref[1] = 'F';        if ( parser->status == MIX_PERR_NOCOMP )  -	update_future_refs_ (parser, ref); +	update_future_refs_value_ (parser, ref, value);        ref[1] = 'B';        mix_symbol_table_insert (parser->symbol_table, ref,  -			       mix_short_to_word_fast (parser->loc_count)); +			       mix_short_to_word_fast (value));        break;      default:        return; diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l index c6ed5d8..c5529da 100644 --- a/mixlib/mix_scanner.l +++ b/mixlib/mix_scanner.l @@ -37,20 +37,28 @@         g_free (symbol);				\         symbol = NULL;				\       }						\ +    if (lsymbol != NULL)			\ +     {						\ +       g_free (lsymbol);			\ +       lsymbol = NULL;				\ +     }                       			\    } while (FALSE) -#define NEXT()				\ -  do {						\ -    parser->loc_count++;			\ -    RESET ();					\ -    ++lineno;					\ -    BEGIN (INITIAL);				\ +#define NEXT()						\ +  do {							\ +    if (lsymbol != NULL)				\ +       mix_parser_manage_local_symbol (parser,lsymbol,  \ +				       loc);    	\ +    parser->loc_count++;				\ +    RESET ();						\ +    ++lineno;						\ +    BEGIN (INITIAL);					\    } while (FALSE)  #define ADD_INS()				\    do {						\      mix_parser_add_ins (parser, &ins, lineno);	\ -    NEXT ();	               			\ +    NEXT ();					\    } while (FALSE)  #define ADD_RAW(value)				\ @@ -140,7 +148,8 @@ wexpr   {expr}({fpart})?(,{expr}({fpart})?)*    gboolean nof = FALSE, is_fp = FALSE, end = FALSE, lsf = FALSE;    mix_word_t expr_val = MIX_WORD_ZERO, wexpr_val = MIX_WORD_ZERO,    wexpr_val_tmp = MIX_WORD_ZERO; -  gchar *symbol = NULL; +  gchar *symbol = NULL, *lsymbol = NULL; +  mix_address_t loc = MIX_SHORT_ZERO;    guint lineno = 1;    mix_ins_fill_from_id (ins, mix_NOP);		    ins.address = 0;				 @@ -172,9 +181,25 @@ wexpr   {expr}({fpart})?(,{expr}({fpart})?)*  <LOC>{    {ws}+	BEGIN (OP); /* LOC field is empty */    {locsymbol} { /* manage local symbol */ -    mix_parser_manage_local_symbol (parser,yytext); +    loc = get_ploc_ (parser); +    lsymbol = g_strdup (yytext); +    if ( lsymbol == NULL ) { +      mix_parser_log_error (parser, MIX_PERR_INTERNAL, lineno, NULL, FALSE); +      return MIX_PERR_INTERNAL; +    }      BEGIN (OP);    } +  {locsymbol}/({ws}+EQU) {/* local symbol with value */ +    loc = get_ploc_ (parser); +    symbol = g_strdup (yytext); +    lsymbol = g_strdup (yytext); +    if ( symbol == NULL || lsymbol == NULL) { +      mix_parser_log_error (parser, MIX_PERR_INTERNAL, lineno, NULL, FALSE); +      return MIX_PERR_INTERNAL; +    } +    symbol[1] = 'B'; /* this will be referred as nB afterwards */ +    BEGIN (OP); +  }        {flocsymbol}|{blocsymbol} RETURN_ERROR (MIX_PERR_UNEX_LOC, yytext);    {symbol}/({ws}+EQU) { /* store symbol name for future definition */      symbol = g_strdup (yytext); diff --git a/mixlib/xmix_parser.h b/mixlib/xmix_parser.h index bbcd108..2584be7 100644 --- a/mixlib/xmix_parser.h +++ b/mixlib/xmix_parser.h @@ -56,6 +56,10 @@ typedef struct ins_node_  /* functions to manipulate mix_parser_t during compilation */ + +/* access loc counter */ +#define get_ploc_(parser) ((parser)->loc_count) +  /* symbol table */  /* Define a new symbol with given value    * and update previously set refs to this symbol  @@ -76,7 +80,8 @@ mix_parser_set_future_ref(mix_parser_t *parser, const gchar *name);  /* Redefine the value of a local symbol as the current loc_count */  extern void -mix_parser_manage_local_symbol(mix_parser_t *parser, const gchar *name); +mix_parser_manage_local_symbol(mix_parser_t *parser, const gchar *name, +			       mix_short_t value);  /* Literal strings symbols */  extern void @@ -4,7 +4,7 @@  msgid ""  msgstr ""  "Project-Id-Version: mdk 0.1\n" -"POT-Creation-Date: 2000-11-02 00:16+0100\n" +"POT-Creation-Date: 2000-11-13 23:11+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" @@ -440,12 +440,12 @@ msgstr ""  msgid "No system resources"  msgstr "no hi ha recursos al sistema" -#: mixlib/mix_parser.c:324 +#: mixlib/mix_parser.c:333  #, c-format  msgid "\t%s\t(line %d)\n"  msgstr "        %s      (línia %d)\n" -#: mixlib/mix_parser.c:343 +#: mixlib/mix_parser.c:352  #, c-format  msgid ""  "*** %s%s: compilation summary ***\n" @@ -454,11 +454,11 @@ msgstr ""  "*** %s%s: resum de la compilació\n"  "\n" -#: mixlib/mix_parser.c:346 +#: mixlib/mix_parser.c:355  msgid "*** Address / Compiled word / Symbolic rep / Source file line\n"  msgstr "*** Adreça / Paraula compilada / Repr. simbólica / Núm. línia\n" -#: mixlib/mix_parser.c:350 +#: mixlib/mix_parser.c:359  #, c-format  msgid ""  "\n" @@ -467,7 +467,7 @@ msgstr ""  "\n"  "*** Adreça d'inici: %d\n" -#: mixlib/mix_parser.c:352 +#: mixlib/mix_parser.c:361  msgid ""  "\n"  "*** Symbol table\n" @@ -475,7 +475,7 @@ msgstr ""  "\n"  "*** Taula de símbols\n" -#: mixlib/mix_parser.c:354 +#: mixlib/mix_parser.c:363  msgid ""  "\n"  "*** End of summary ***\n" @@ -483,15 +483,15 @@ msgstr ""  "\n"  "*** Fi del resum ***\n" -#: mixlib/mix_parser.c:484 +#: mixlib/mix_parser.c:499  msgid "Unable to allocate memory"  msgstr "Memòria dinàmica insuficient" -#: mixlib/mix_parser.c:512 +#: mixlib/mix_parser.c:527  msgid "warning"  msgstr "advertència" -#: mixlib/mix_parser.c:512 +#: mixlib/mix_parser.c:527  msgid "error"  msgstr "error" | 
