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
This commit is contained in:
Holger Vogt 2020-02-16 14:39:40 +01:00
parent e595347819
commit 3e197c954e
23 changed files with 12 additions and 115 deletions

View File

@ -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"

View File

@ -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... */

View File

@ -11,7 +11,6 @@
#endif
#include "com_chdir.h"
#include "quote.h"
#include "ngspice/cpextern.h"

View File

@ -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"

View File

@ -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"

View File

@ -7,7 +7,6 @@
#include "ngspice/bool.h"
#include "com_echo.h"
#include "quote.h"
#include "ngspice/cpextern.h"

View File

@ -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"

View File

@ -4,7 +4,6 @@
#include "ngspice/wordlist.h"
#include "com_strcmp.h"
#include "quote.h"
#include "variable.h"

View File

@ -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. */

View File

@ -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);

View File

@ -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 != '"')

View File

@ -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"
/*

View File

@ -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++;
}

View File

@ -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"

View File

@ -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 <string.h>
#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 *

View File

@ -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"

View File

@ -10,7 +10,6 @@
#include "variable.h"
#include "terminal.h"
#include "quote.h"
#include "ngspice/cpextern.h"
#include "streams.h"

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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;

View File

@ -82,7 +82,7 @@ printword(const char *string, FILE *fp)
{
if (string) {
while (*string) {
putc(strip(*string++), fp);
putc((*string++), fp);
}
}
}

View File

@ -906,7 +906,6 @@
<ClInclude Include="..\src\frontend\points.h" />
<ClInclude Include="..\src\frontend\postcoms.h" />
<ClInclude Include="..\src\frontend\postsc.h" />
<ClInclude Include="..\src\frontend\quote.h" />
<ClInclude Include="..\src\frontend\rawfile.h" />
<ClInclude Include="..\src\frontend\resource.h" />
<ClInclude Include="..\src\frontend\runcoms.h" />