diff --git a/src/variable.cpp b/src/variable.cpp index 05c55ec7c6..37e47465cb 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -804,6 +804,19 @@ int Variable::internalstyle(int ivar) return 0; } +/* ---------------------------------------------------------------------- + return 1 if variable is INDEX or WORLD or STRING or SCALARFILE, 0 if not + this is used to discriminate between variables that return a pointer to + the stored string and others that do evaluations or return numbers. +------------------------------------------------------------------------- */ + +int Variable::stringstyle(int ivar) +{ + if (style[ivar] == INDEX || style[ivar] == WORLD + || style[ivar] == STRING || style[ivar] == SCALARFILE) return 1; + return 0; +} + /* ---------------------------------------------------------------------- return ptr to the data text associated with a variable if INDEX or WORLD or UNIVERSE or STRING or SCALARFILE, diff --git a/src/variable.h b/src/variable.h index c24706430d..a54b4d01d5 100644 --- a/src/variable.h +++ b/src/variable.h @@ -38,6 +38,7 @@ class Variable : protected Pointers { int vectorstyle(int); char *pythonstyle(char *, char *); int internalstyle(int); + int stringstyle(int); char *retrieve(char *); double compute_equal(int);