enable or diable checking of vectors,

disable for plotting, otherwise 'vs' will lead to error
This commit is contained in:
Holger Vogt 2021-07-12 18:00:49 +02:00
parent d2fca55f33
commit f4d3ba869c
3 changed files with 9 additions and 14 deletions

View File

@ -777,7 +777,7 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
* node is a dummy node. * node is a dummy node.
*/ */
names = ft_getpnames_quotes(wl->wl_next); names = ft_getpnames_quotes(wl->wl_next, FALSE);
if (names == (struct pnode*)NULL) { if (names == (struct pnode*)NULL) {
goto quit1; goto quit1;
} }

View File

@ -67,7 +67,7 @@ static bool is_all_digits(char* tstr)
automatically place "" around, like V("2p"). Returns the parse tree. Multiple automatically place "" around, like V("2p"). Returns the parse tree. Multiple
v() may occur in a row. v() may occur in a row.
*/ */
struct pnode* ft_getpnames_quotes(wordlist* wl) struct pnode* ft_getpnames_quotes(wordlist* wl, bool check)
{ {
struct pnode* names = NULL; struct pnode* names = NULL;
char* sz = wl_flatten(wl); char* sz = wl_flatten(wl);
@ -77,7 +77,7 @@ struct pnode* ft_getpnames_quotes(wordlist* wl)
char* nsz = tmpstr = stripWhiteSpacesInsideParens(sz); char* nsz = tmpstr = stripWhiteSpacesInsideParens(sz);
DS_CREATE(ds1, 100); DS_CREATE(ds1, 100);
/* put double quotes around tokens which start with math or number chars */ /* put double quotes around tokens which start with math or number chars */
while (tmpstr[2] != '\0') { while (*tmpstr != '\0') {
/*check if we have v(something) at the beginning after arithchar or space */ /*check if we have v(something) at the beginning after arithchar or space */
if (tmpstr[0] == 'v' && tmpstr[1] == '(' && (nsz == tmpstr || isspace_c(tmpstr[-1]) || is_arith_char(tmpstr[-1]))) { if (tmpstr[0] == 'v' && tmpstr[1] == '(' && (nsz == tmpstr || isspace_c(tmpstr[-1]) || is_arith_char(tmpstr[-1]))) {
char* tmpstr2, * partoken2 = NULL; char* tmpstr2, * partoken2 = NULL;
@ -132,19 +132,14 @@ struct pnode* ft_getpnames_quotes(wordlist* wl)
cadd(&ds1, *tmpstr); cadd(&ds1, *tmpstr);
tmpstr++; tmpstr++;
} }
/* compensate for tmpstr[2] != '\0' */
cadd(&ds1, *tmpstr);
tmpstr++;
cadd(&ds1, *tmpstr);
char* newline = ds_get_buf(&ds1); char* newline = ds_get_buf(&ds1);
names = ft_getpnames_from_string(newline, TRUE); names = ft_getpnames_from_string(newline, check);
ds_free(&ds1); ds_free(&ds1);
tfree(nsz); tfree(nsz);
} }
else { else {
names = ft_getpnames_from_string(sz, TRUE); names = ft_getpnames_from_string(sz, check);
} }
tfree(sz); tfree(sz);
return names; return names;
@ -250,7 +245,7 @@ com_print(wordlist *wl)
ngood = 0; ngood = 0;
names = ft_getpnames_quotes(wl); names = ft_getpnames_quotes(wl, TRUE);
for (pn = names; pn; pn = pn->pn_next) { for (pn = names; pn; pn = pn->pn_next) {
if ((v = ft_evaluate(pn)) == NULL) if ((v = ft_evaluate(pn)) == NULL)
@ -565,9 +560,9 @@ com_write(wordlist *wl)
We offer plain writing of the vectors. This enables node names containing +, -, / etc. */ We offer plain writing of the vectors. This enables node names containing +, -, / etc. */
if (!plainwrite) { if (!plainwrite) {
if (wl) if (wl)
names = ft_getpnames_quotes(wl); names = ft_getpnames_quotes(wl, TRUE);
else else
names = ft_getpnames_quotes(&all); names = ft_getpnames_quotes(&all, TRUE);
if (names == NULL) { if (names == NULL) {
return; return;

View File

@ -287,7 +287,7 @@ extern double *ft_minmax(struct dvec *v, bool real);
extern void ft_graf(struct dvec *v, struct dvec *xs, bool nostart); extern void ft_graf(struct dvec *v, struct dvec *xs, bool nostart);
/* postcoms.c */ /* postcoms.c */
extern struct pnode *ft_getpnames_quotes(wordlist *wl); extern struct pnode *ft_getpnames_quotes(wordlist *wl, bool check);
/* rawfile.c */ /* rawfile.c */
extern int raw_prec; extern int raw_prec;