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

Function fxIsCanonicalIndex

xs/sources/xsAll.c:258–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258txBoolean fxIsCanonicalIndex(txMachine* the, txID id)
259{
260 txSlot* key = fxGetKey(the, id);
261 if (key->flag & XS_DONT_ENUM_FLAG) {
262 txString string = key->value.key.string;
263 char buffer[256], c;
264 txNumber number;
265 c = c_read8(string);
266 if (('+' != c) && ('-' != c) && ('.' != c) && ('I' != c) && ('N' != c) && !(('0' <= c) && ('9' >= c)))
267 return 0;
268 number = fxStringToNumber(the, string, 1);
269 if (number == -0)
270 return 1;
271 fxNumberToString(the, number, buffer, sizeof(buffer), 0, 0);
272 if (!c_strcmp(string, buffer)) {
273 return 1;
274 }
275 }
276 return 0;
277}
278
279int fxStringGetter(void* theStream)
280{

Calls 3

fxGetKeyFunction · 0.85
fxStringToNumberFunction · 0.85
fxNumberToStringFunction · 0.85

Tested by

no test coverage detected