struct string_cst *sc1 = sc;
C_df_dlb(sc->sc_dlb);
- str_cst(sc->sc_value, sc->sc_len);
+ str_cst(sc->sc_value, sc->sc_len, 1); /* string in rom */
sc = sc->next;
+ free(sc1->sc_value);
free_string_cst(sc1);
}
}
+/* flush_strings() is called from program.g after each external definition */
+flush_strings() {
+ if (str_list) {
+ def_strings(str_list);
+ str_list = 0;
+ }
+}
+
end_code()
{
/* end_code() performs the actions to be taken when closing
/* floating point used */
C_ms_flt();
}
- def_strings(str_list);
- str_list = 0;
C_ms_src((int)(LineNumber - 2), FileName);
C_close();
}
extern struct string_cst *str_list;
-/* ALLOCDEF "string_cst" 10 */
+/* ALLOCDEF "string_cst" 5 */
#define LVAL 0
#define RVAL 1
SkipToNewLine();
LineNumber = l; /* the number of the next input line */
- if (t == STRING) /* is there a filespecifier? */
+ if (t == STRING) { /* is there a filespecifier? */
+ extern char *source; /* defined in main.c */
+
+ if (FileName != source) { /* source points into argv */
+ free(FileName);
+ }
FileName = tk.tk_bts;
+ }
}
*to++ = *from++;
}
free(ex->SG_VALUE);
- str_cst(s, length);
+ str_cst(s, length, 0); /* a string, but not in rom */
free(s);
}
/* As long as some parts of the pipeline cannot handle very long string
constants, string constants are written out in chunks
*/
-str_cst(str, len)
+str_cst(str, len, inrom)
register char *str;
register int len;
+ int inrom;
{
int chunksize = ((127 + (int) word_size) / (int) word_size) * (int) word_size;
while (len > chunksize) {
- C_con_scon(str, (arith) chunksize);
+ if (inrom)
+ C_rom_scon(str, (arith) chunksize);
+ else C_con_scon(str, (arith) chunksize);
len -= chunksize;
str += chunksize;
}
- C_con_scon(str, (arith) len);
+ if (inrom)
+ C_rom_scon(str, (arith) len);
+ else C_con_scon(str, (arith) len);
}
#ifndef NOBITFIELD
}
function(&Ds, &Dc)
]
- {remove_declarator(&Dc);}
+ {remove_declarator(&Dc); flush_strings(); }
;
non_function(register struct decspecs *ds; register struct declarator *dc;)
if (parens && ch != ')') error(") missing");
if (!parens || ch != ')') UnGetChar();
add2repl(repl, (id && id->id_macro) ? '1' : '0');
+ add2repl(repl, ' ');
}
newarg(args)