diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom.ansi/arith.c index 9190c081c..7d6368c9a 100644 --- a/lang/cem/cemcom.ansi/arith.c +++ b/lang/cem/cemcom.ansi/arith.c @@ -31,6 +31,7 @@ extern char *symbol2str(); extern char options[]; extern arith flt_flt2arith(); +extern label code_string(); arithbalance(e1p, oper, e2p) /* 3.1.2.5 */ register struct expr **e1p, **e2p; @@ -464,9 +465,9 @@ string2pointer(ex) /* The expression, which must be a string constant, is converted to a pointer to the string-containing area. */ - label lbl = data_label(); + label lbl; - code_string(ex->SG_VALUE, ex->SG_LEN, lbl); + lbl = code_string(ex->SG_VALUE, ex->SG_LEN); ex->ex_class = Value; ex->VL_CLASS = Label; ex->VL_LBL = lbl; diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index 03205cd4b..af3f973a6 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -105,12 +105,13 @@ init_code(dst_file) struct string_cst *str_list = 0; -code_string(val, len, dlb) +label +code_string(val, len) char *val; int len; - label dlb; { register struct string_cst *sc = new_string_cst(); + label lbl = data_label(); C_ina_dlb(dlb); sc->next = str_list; @@ -118,6 +119,7 @@ code_string(val, len, dlb) sc->sc_value = val; sc->sc_len = len; sc->sc_dlb = dlb; + return dlb; } def_strings(sc) diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index ad49b6ce3..86826575b 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -308,14 +308,23 @@ actual(repl) register int ch = 0; register int level = 0, nostashraw = 0; int lastch; + static int Unstacked_missed; while (1) { lastch = ch; ch = GetChar(); + if (nostashraw + && nostashraw >= Unstacked_missed) { + nostashraw -= Unstacked_missed; + Unstacked_missed = 0; + } if (Unstacked) { nostashraw -= Unstacked; - if (nostashraw < 0) nostashraw = 0; + if (nostashraw < 0) { + Unstacked_missed = -nostashraw; + nostashraw = 0; + } EnableMacros(); } if (class(ch) == STIDF || class(ch) == STELL) {