From 3e197c954e400e025fa1a43d661a5f55307135e5 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 16 Feb 2020 14:39:40 +0100 Subject: [PATCH] remove all the remains of quote() and strip() that had been used to modify the eigths bit of a character or string. The functions had been switched off some time ago. We now need all bits of a char for extended ascii or utf8 --- src/frontend/breakp2.c | 1 - src/frontend/com_alias.c | 1 - src/frontend/com_chdir.c | 1 - src/frontend/com_compose.c | 2 -- src/frontend/com_display.c | 1 - src/frontend/com_echo.c | 1 - src/frontend/com_setscale.c | 1 - src/frontend/com_strcmp.c | 1 - src/frontend/control.c | 3 -- src/frontend/cpitf.c | 3 -- src/frontend/inpcom.c | 6 ---- src/frontend/newcoms.c | 1 - src/frontend/parser/lexical.c | 17 +++++------ src/frontend/postcoms.c | 1 - src/frontend/quote.c | 55 ++-------------------------------- src/frontend/resource.c | 1 - src/frontend/streams.c | 1 - src/frontend/variable.c | 3 -- src/include/ngspice/cpextern.h | 5 ---- src/include/ngspice/wordlist.h | 15 ---------- src/main.c | 4 +-- src/misc/wlist.c | 2 +- visualc/vngspice.vcxproj | 1 - 23 files changed, 12 insertions(+), 115 deletions(-) diff --git a/src/frontend/breakp2.c b/src/frontend/breakp2.c index 14c2d7f4b..56cc9f463 100644 --- a/src/frontend/breakp2.c +++ b/src/frontend/breakp2.c @@ -12,7 +12,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "ngspice/ftedefs.h" #include "ngspice/dvec.h" #include "ngspice/ftedebug.h" -#include "quote.h" #include "breakp2.h" diff --git a/src/frontend/com_alias.c b/src/frontend/com_alias.c index c1d06cc13..d417b703c 100644 --- a/src/frontend/com_alias.c +++ b/src/frontend/com_alias.c @@ -152,7 +152,6 @@ cp_setalias(char *word, wordlist *wlist) al->al_name = copy(word); al->al_text = wl_copy(wlist); - cp_striplist(al->al_text); /* We can afford to not worry about the bits, because before the * keyword lookup is done the alias is evaluated. Make everything * file completion, just in case... */ diff --git a/src/frontend/com_chdir.c b/src/frontend/com_chdir.c index 4beee8860..a8cf8d83e 100644 --- a/src/frontend/com_chdir.c +++ b/src/frontend/com_chdir.c @@ -11,7 +11,6 @@ #endif #include "com_chdir.h" -#include "quote.h" #include "ngspice/cpextern.h" diff --git a/src/frontend/com_compose.c b/src/frontend/com_compose.c index 4c80a8170..099e68c8b 100644 --- a/src/frontend/com_compose.c +++ b/src/frontend/com_compose.c @@ -11,8 +11,6 @@ #include "ngspice/fteext.h" #include "ngspice/cpextern.h" #include "ngspice/randnumb.h" - -#include "quote.h" #include "com_compose.h" #include "completion.h" diff --git a/src/frontend/com_display.c b/src/frontend/com_display.c index 37fa68251..1fef086a7 100644 --- a/src/frontend/com_display.c +++ b/src/frontend/com_display.c @@ -5,7 +5,6 @@ #include "ngspice/cpextern.h" #include "com_display.h" -#include "quote.h" #include "variable.h" #include "plotting/plotting.h" #include "plotting/pvec.h" diff --git a/src/frontend/com_echo.c b/src/frontend/com_echo.c index 28c030f55..75d411130 100644 --- a/src/frontend/com_echo.c +++ b/src/frontend/com_echo.c @@ -7,7 +7,6 @@ #include "ngspice/bool.h" #include "com_echo.h" -#include "quote.h" #include "ngspice/cpextern.h" diff --git a/src/frontend/com_setscale.c b/src/frontend/com_setscale.c index fb0d00297..024bb043d 100644 --- a/src/frontend/com_setscale.c +++ b/src/frontend/com_setscale.c @@ -3,7 +3,6 @@ #include "ngspice/dvec.h" #include "com_setscale.h" -#include "quote.h" #include "ngspice/cpextern.h" #include "vectors.h" #include "plotting/plotting.h" diff --git a/src/frontend/com_strcmp.c b/src/frontend/com_strcmp.c index 5d259cda8..014a8025a 100644 --- a/src/frontend/com_strcmp.c +++ b/src/frontend/com_strcmp.c @@ -4,7 +4,6 @@ #include "ngspice/wordlist.h" #include "com_strcmp.h" -#include "quote.h" #include "variable.h" diff --git a/src/frontend/control.c b/src/frontend/control.c index e322df45f..157a43b75 100644 --- a/src/frontend/control.c +++ b/src/frontend/control.c @@ -192,9 +192,6 @@ docommand(wordlist *wlist) return; } - /* Get rid of all the 8th bits now... */ - cp_striplist(wlist); - s = wlist->wl_word; /* Look for the command in the command list. */ diff --git a/src/frontend/cpitf.c b/src/frontend/cpitf.c index 246012c66..f4d984097 100644 --- a/src/frontend/cpitf.c +++ b/src/frontend/cpitf.c @@ -262,7 +262,6 @@ ft_cpinit(void) { wordlist *wl; wl = cp_doglob(cp_lexer(buf)); - cp_striplist(wl); com_set(wl); wl_free(wl); } @@ -339,8 +338,6 @@ cp_istrue(wordlist *wl) return FALSE; /* backquote '`' substitution */ wl = cp_bquote(wl); - /* strip bit number eight */ - cp_striplist(wl); /* parse the condition */ names = ft_getpnames(wl, TRUE); diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 64d40ba44..d4f440f7d 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1364,7 +1364,6 @@ static char *inp_pathresolve(const char *name) switch (v->va_type) { case CP_STRING: - cp_wstrip(v->va_string); rc_ds = ds_cat_printf(&ds, "%s%s%s", v->va_string, DIR_PATHSEP, name); break; @@ -2431,11 +2430,6 @@ void inp_casefix(char *string) } if (string) while (*string) { -#ifdef HAS_ASCII - /* ((*string) & 0177): mask off all but the first seven bits, - * 0177: octal */ - *string = (char) strip(*string); -#endif if (*string == '"') { *string++ = ' '; while (*string && *string != '"') diff --git a/src/frontend/newcoms.c b/src/frontend/newcoms.c index 34ee8370d..21723a2b9 100644 --- a/src/frontend/newcoms.c +++ b/src/frontend/newcoms.c @@ -14,7 +14,6 @@ Copyright 1992 Regents of the University of California. All rights reserved. #include "ngspice/stringskip.h" #include "newcoms.h" -#include "quote.h" /* diff --git a/src/frontend/parser/lexical.c b/src/frontend/parser/lexical.c index cd970ea3a..ee961a1b2 100644 --- a/src/frontend/parser/lexical.c +++ b/src/frontend/parser/lexical.c @@ -200,13 +200,10 @@ nloop: if (c != EOF) numeofs = 0; - if (c != EOF) /* Don't need to do this really. */ - c = strip(c); - /* if '\' or '^', add following character to linebuf */ if ((c == '\\' && DIR_TERM != '\\') || (c == '\026') /* ^V */ ) { - c = quote(cp_readchar(&string, cp_inp_cur)); - push(&linebuf, strip(c)); + c = cp_readchar(&string, cp_inp_cur); + push(&linebuf, c); } /* if reading from fcn backeval() for backquote subst. */ @@ -265,7 +262,7 @@ nloop: { if ((c == '\n') || (c == EOF) || (c == ESCAPE)) goto gotchar; - push(&buf, quote(c)); + push(&buf, c); push(&linebuf, c); } push(&linebuf, '\''); @@ -285,7 +282,7 @@ nloop: if (c == '\\') { push(&linebuf, c); c = cp_readchar(&string, cp_inp_cur); - push(&buf, quote(c)); + push(&buf, c); push(&linebuf, c); } else { push(&buf, c); @@ -459,15 +456,15 @@ prompt(void) s = "-> "; while (*s) { - switch (strip(*s)) { + switch (*s) { case '!': fprintf(cp_out, "%d", cp_event); break; case '\\': if (s[1]) - (void) putc(strip(*++s), cp_out); + (void) putc((*++s), cp_out); default: - (void) putc(strip(*s), cp_out); + (void) putc((*s), cp_out); } s++; } diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index 0484fcd4a..0f628424c 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -19,7 +19,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "completion.h" #include "postcoms.h" -#include "quote.h" #include "variable.h" #include "parser/complete.h" /* va: throwaway */ #include "plotting/plotting.h" diff --git a/src/frontend/quote.c b/src/frontend/quote.c index 3403d1e96..ffa9ff58c 100644 --- a/src/frontend/quote.c +++ b/src/frontend/quote.c @@ -3,52 +3,14 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group **********/ -/* - * - * Various things for quoting words. If this is not ascii, quote and - * strip are no-ops, so '' and \ quoting won't work. To fix this, sell - * your IBM machine and buy a vax. - */ #include #include "ngspice/ngspice.h" #include "ngspice/cpdefs.h" -#include "quote.h" -/* Strip all the 8th bits from a string (destructively). */ - -void -cp_wstrip(char *str) -{ - char c, d; - - if (str) - while ((c = *str) != '\0') { /* assign and test */ - d = (char) strip(c); - if (c != d) - *str = d; - str++; - } -} - - -/* Quote all characters in a word. */ - -void -cp_quoteword(char *str) -{ - if (str) - while (*str) { - *str = (char) quote(*str); - str++; - } -} - - -/* Print a word (strip the word first). */ - +/* Print a word */ void cp_printword(char *string, FILE *fp) { @@ -56,23 +18,10 @@ cp_printword(char *string, FILE *fp) if (string) for (s = string; *s; s++) - (void) putc((strip(*s)), fp); + (void) putc((*s), fp); } -/* (Destructively) strip all the words in a wlist. */ - -void -cp_striplist(wordlist *wlist) -{ - wordlist *wl; - - for (wl = wlist; wl; wl = wl->wl_next) - cp_wstrip(wl->wl_word); -} - - - /* Create a copy of the input string removing the enclosing quotes, * if they are present */ char * diff --git a/src/frontend/resource.c b/src/frontend/resource.c index 608b7ee44..37d07b6c1 100644 --- a/src/frontend/resource.c +++ b/src/frontend/resource.c @@ -16,7 +16,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "ngspice/ftedefs.h" #include "circuits.h" -#include "quote.h" #include "resource.h" #include "variable.h" #include "ngspice/cktdefs.h" diff --git a/src/frontend/streams.c b/src/frontend/streams.c index e49a91a9b..c728526a5 100644 --- a/src/frontend/streams.c +++ b/src/frontend/streams.c @@ -10,7 +10,6 @@ #include "variable.h" #include "terminal.h" -#include "quote.h" #include "ngspice/cpextern.h" #include "streams.h" diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 0f0818ef4..a1027f192 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -15,7 +15,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "circuits.h" #include "com_history.h" -#include "quote.h" #include "ngspice/cpextern.h" #include "variable.h" @@ -728,7 +727,6 @@ cp_getvar(char *name, enum cp_types type, void *retval, size_t rsize) break; case CP_STRING: { /* Gotta be careful to have room. */ char *s = cp_unquote(v->va_string); - cp_wstrip(s); if (strlen(s) > rsize) { fprintf(stderr, "Warning: string length for variable %s is limited to %zu chars\n", v->va_name, rsize); /* limit the string length */ @@ -902,7 +900,6 @@ wordlist *vareval(/* NOT const */ char *string) /* usage of vfree: variable v has to be freed only if created by cp_enqvar()! */ - cp_wstrip(string); if ((s = strchr(string, '[')) != NULL) { *s = '\0'; range = s + 1; diff --git a/src/include/ngspice/cpextern.h b/src/include/ngspice/cpextern.h index 8d18caf34..539ea9c9f 100644 --- a/src/include/ngspice/cpextern.h +++ b/src/include/ngspice/cpextern.h @@ -134,11 +134,6 @@ extern void out_send(char *string); /* quote.c */ extern char *cp_unquote(const char *string); -extern void cp_quoteword(char *str); -extern void cp_striplist(wordlist *wlist); -extern void cp_wstrip(char *str); - - /* unixcom.c */ diff --git a/src/include/ngspice/wordlist.h b/src/include/ngspice/wordlist.h index 713ef26a2..2978d0482 100644 --- a/src/include/ngspice/wordlist.h +++ b/src/include/ngspice/wordlist.h @@ -34,19 +34,4 @@ void wl_sort(wordlist *wl); wordlist * wl_splice(wordlist *elt, wordlist *list); - - - -#ifdef QUOTE_CHAR -/* For quoting individual characters. '' strings are all quoted, but - * `` and "" strings are maintained as single words with the quotes - * around them. Note that this won't work on non-ascii machines. */ -#define quote(c) ((c) | 0200) -#define strip(c) ((c) & 0177) -#else -#define quote(c) (c) -#define strip(c) (c) -#endif - - #endif diff --git a/src/main.c b/src/main.c index eaebb7843..9f133033d 100644 --- a/src/main.c +++ b/src/main.c @@ -544,14 +544,14 @@ prompt(void) s = "->"; while (*s) { - char c = (char) strip(*s++); + char c = (char) (*s++); switch (c) { case '!': p += sprintf(p, "%d", where_history() + 1); break; case '\\': if (*s) - c = (char) strip(*s++); + c = (char) (*s++); default: *p++ = c; break; diff --git a/src/misc/wlist.c b/src/misc/wlist.c index e94fa93b3..f6d9e2592 100644 --- a/src/misc/wlist.c +++ b/src/misc/wlist.c @@ -82,7 +82,7 @@ printword(const char *string, FILE *fp) { if (string) { while (*string) { - putc(strip(*string++), fp); + putc((*string++), fp); } } } diff --git a/visualc/vngspice.vcxproj b/visualc/vngspice.vcxproj index 99a98c4da..1719a68d5 100644 --- a/visualc/vngspice.vcxproj +++ b/visualc/vngspice.vcxproj @@ -906,7 +906,6 @@ -