MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / isString

Method isString

ij/src/main/java/ij/macro/Interpreter.java:1233–1257  ·  view source on GitHub ↗
(int pcLoc)

Source from the content-addressed store, hash-verified

1231
1232 // Returns true if the token at the specified location is a string
1233 boolean isString(int pcLoc) {
1234 int tok = pgm.code[pcLoc];
1235 if ((tok&0xff)==VARIABLE_FUNCTION) {
1236 int address = tok>>TOK_SHIFT;
1237 int type = pgm.table[address].type;
1238 int token2 = pgm.code[pcLoc+2];
1239 String name = pgm.table[token2>>TOK_SHIFT].str;
1240 if (Functions.isStringFunction(name,type))
1241 return true;
1242 }
1243 if ((tok&TOK_MASK)!=WORD)
1244 return false;
1245 Variable v = lookupVariable(tok>>TOK_SHIFT);
1246 if (v==null)
1247 return false;
1248 if (pgm.code[pcLoc+1]=='[') {
1249 Variable[] array = v.getArray();
1250 if (array!=null && array.length>0)
1251 return array[0].getType()==Variable.STRING;
1252 }
1253 int type = v.getType();
1254 if (type==Variable.STRING && (pgm.code[pcLoc+1]&0xff)=='.' && (pgm.code[pcLoc+2]&0xff)!=STRING_FUNCTION)
1255 return false;
1256 return type==Variable.STRING;
1257 }
1258
1259 double compareStrings(String s1, String s2, int op) {
1260 int result;

Callers 5

doReturnMethod · 0.95
getExpressionTypeMethod · 0.95
getBooleanExpressionMethod · 0.95
getStringTermMethod · 0.95
isStringArgMethod · 0.45

Calls 5

isStringFunctionMethod · 0.95
lookupVariableMethod · 0.95
getArrayMethod · 0.95
getTypeMethod · 0.95
getTypeMethod · 0.65

Tested by

no test coverage detected