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

Function fx_serializeURL

modules/data/url/url.c:1503–1710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1501}
1502
1503void fx_serializeURL(txMachine* the)
1504{
1505 txSlot* parts;
1506 txInteger schemeIndex;
1507 txIndex length;
1508 txInteger override = 0;
1509 txSlot* result;
1510
1511 fxVars(the, 3);
1512 result = mxResult;
1513 fxCopyStringC(the, result, "");
1514
1515 parts = mxArgv(0);
1516
1517 mxPushSlot(parts);
1518 mxGetID(xsID_scheme);
1519 schemeIndex = fx_parseURLSpecialScheme(the, the->stack->value.string);
1520 mxPop();
1521
1522 mxPushSlot(parts);
1523 mxGetID(mxID(_length));
1524 length = (txIndex)fxToLength(the, the->stack);
1525 mxPop();
1526
1527 if (mxArgc > 1) {
1528 override = fxToInteger(the, mxArgv(1));
1529 if (override == SCHEME_STATE) {
1530 goto XS_URL_SCHEME;
1531 }
1532 if (override == USERNAME_STATE) {
1533 goto XS_URL_USERNAME;
1534 }
1535 if (override == PASSWORD_STATE) {
1536 goto XS_URL_PASSWORD;
1537 }
1538 if (override == HOST_PORT_STATE) {
1539 goto XS_URL_HOST;
1540 }
1541 if (override == HOST_STATE) {
1542 goto XS_URL_HOST;
1543 }
1544 if (override == PORT_STATE) {
1545 goto XS_URL_PORT;
1546 }
1547 if (override == PATH_STATE) {
1548 goto XS_URL_PATH;
1549 }
1550 if (override == QUERY_STATE) {
1551 goto XS_URL_QUERY;
1552 }
1553 if (override == FRAGMENT_STATE) {
1554 goto XS_URL_FRAGMENT;
1555 }
1556 if (override == ORIGIN_STATE) {
1557 goto XS_URL_ORIGIN;
1558 }
1559 goto XS_URL_END;
1560 }

Callers

nothing calls this directly

Calls 7

fxVarsFunction · 0.85
fxCopyStringCFunction · 0.85
fx_parseURLSpecialSchemeFunction · 0.85
fxToLengthFunction · 0.85
fxToIntegerFunction · 0.85
fxConcatStringFunction · 0.85
fxConcatStringCFunction · 0.85

Tested by

no test coverage detected