From abcaa3e6698bdd7b97b3a2efc4b171f29c7d7945 Mon Sep 17 00:00:00 2001 From: eck Date: Fri, 5 Jan 1990 09:28:54 +0000 Subject: [PATCH] changed UnGetChar() to ChPushBack() in domacro.c --- lang/cem/cemcom.ansi/domacro.c | 8 ++++---- lang/cem/cpp.ansi/domacro.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index f6b5270ad..abc73e6f1 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -336,7 +336,8 @@ do_define() /* read the replacement text if there is any */ ch = skipspaces(ch,0); /* find first character of the text */ ASSERT(ch != EOI); - UnGetChar(); + /* UngetChar() is not right when replacement starts with a '/' */ + ChPushBack(ch); repl_text = get_text((nformals > 0) ? formals : 0, &length); macro_def(id, repl_text, nformals, length, NOFLAG); LineNumber++; @@ -626,11 +627,10 @@ get_text(formals, length) c = GetChar(); if (c == '*') { skipcomment(); - if(blank++) add2repl(repl, ' '); + if (!blank++) add2repl(repl, ' '); c = GetChar(); continue; - } - else add2repl(repl, '/'); + } else add2repl(repl, '/'); } else if (formals && (class(c) == STIDF || class(c) == STELL)) { char id_buf[IDFSIZE + 1]; diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index 012b93669..38f1c5bff 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -347,7 +347,8 @@ do_define() /* read the replacement text if there is any */ ch = skipspaces(ch,0); /* find first character of the text */ assert(ch != EOI); - UnGetChar(); + /* UngetChar() is not right when replacement starts with a '/' */ + ChPushBack(ch); repl_text = get_text((nformals > 0) ? formals : 0, &length); macro_def(str2idf(str, 0), repl_text, nformals, length, NOFLAG); LineNumber++;