summaryrefslogtreecommitdiffstats
path: root/src/interp.c
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-02-25 17:01:37 -0300
committerAndrés <andmarti@gmail.com>2021-02-25 17:01:37 -0300
commit281b870c316c4cb7540fe354584c4a93a5a78565 (patch)
tree00b54f082b606e1621c402b5b9384965b01d4d2a /src/interp.c
parent2e4e2b5cfd753b29d4bb448fd2d882df0e61710e (diff)
work on issue 497
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/interp.c b/src/interp.c
index 3a1de25..afb977d 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -1272,8 +1272,12 @@ double eval(register struct ent * ent, register struct enode * e) {
case MYCOL:
if (ent && getVertex(graph, ent, 0) == NULL) GraphAddVertex(graph, ent);
return ((double) (gmycol + coloffset));
- case LASTROW: return ((double) maxrow);
- case LASTCOL: return ((double) maxcol);
+ case LASTROW:
+ if (ent && getVertex(graph, ent, 0) == NULL) GraphAddVertex(graph, ent);
+ return ((double) maxrow);
+ case LASTCOL:
+ if (ent && getVertex(graph, ent, 0) == NULL) GraphAddVertex(graph, ent);
+ return ((double) maxcol);
case ERR_:
cellerror = CELLERROR;
if (ent && getVertex(graph, ent, 0) == NULL) GraphAddVertex(graph, ent);
@@ -1773,8 +1777,10 @@ char * seval(register struct ent * ent, register struct enode * se) {
case SUBSTR: return (dosubstr(seval(ent, se->e.o.left),
(int) eval(NULL, se->e.o.right->e.o.left) - 1,
(int) eval(NULL, se->e.o.right->e.o.right) - 1));
- case COLTOA: return (strcpy(scxmalloc( (size_t) 10),
- coltoa((int) eval(NULL, se->e.o.left))));
+ case COLTOA:
+ if (ent && getVertex(graph, ent, 0) == NULL) GraphAddVertex(graph, ent);
+ return (strcpy(scxmalloc( (size_t) 10),
+ coltoa((int) eval(NULL, se->e.o.left))));
case CHR: return (strcpy(scxmalloc( (size_t) 10), dochr(eval(NULL, se->e.o.left))));
case FILENAME: {
int n = eval(NULL, se->e.o.left);