MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxStringToIndex

Function fxStringToIndex

xs/sources/xsCommon.c:1297–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1295}
1296
1297txFlag fxStringToIndex(void* the, txString theString, txIndex* theIndex)
1298{
1299 char buffer[256], c;
1300 txNumber number;
1301 txIndex integer;
1302 txNumber check;
1303
1304 c = c_read8(theString);
1305 if (('+' != c) && ('-' != c) && ('.' != c) && !(('0' <= c) && ('9' >= c)))
1306 return 0;
1307 number = fxStringToNumber(the, theString, 1);
1308 integer = (txIndex)number;
1309 check = integer;
1310 if ((number == check) && (integer < 4294967295u)) {
1311 fxNumberToString(the, number, buffer, sizeof(buffer), 0, 0);
1312 if (!c_strcmp(theString, buffer)) {
1313 *theIndex = integer;
1314 return 1;
1315 }
1316 }
1317 return 0;
1318}
1319
1320const txString gxIDStrings[XS_ID_COUNT] = {
1321 "@",

Callers 6

fxRunIDFunction · 0.85
fxAtFunction · 0.85
fxPropertyNameFunction · 0.85
fxObjectBindingFunction · 0.85
fxParseJSONObjectFunction · 0.85
fxToJSONKeysFunction · 0.85

Calls 2

fxStringToNumberFunction · 0.85
fxNumberToStringFunction · 0.85

Tested by

no test coverage detected