| 202 | }; |
| 203 | |
| 204 | void fx_parseURL(txMachine* the) |
| 205 | { |
| 206 | txStringStream _src; |
| 207 | txStringStream* src = &_src; |
| 208 | txStringStream _dst; |
| 209 | txStringStream* dst = &_dst; |
| 210 | |
| 211 | txInteger override = 0; |
| 212 | txInteger overrideSchemeIndex = -1; |
| 213 | txBoolean overrideSpecial = 0; |
| 214 | |
| 215 | txSlot* base = C_NULL; |
| 216 | txInteger baseSchemeIndex = -1; |
| 217 | txBoolean baseSpecial = 0; |
| 218 | |
| 219 | txSlot* result = C_NULL; |
| 220 | txInteger schemeIndex = -1; |
| 221 | txBoolean special = 0; |
| 222 | |
| 223 | txInteger atOffset = -1; |
| 224 | txInteger colonOffset = -1; |
| 225 | txInteger hostOffset = -1; |
| 226 | txSize tmp; |
| 227 | txBoolean insideBracket = 0; |
| 228 | |
| 229 | txIndex length; |
| 230 | txInteger c; |
| 231 | txNumber port; |
| 232 | |
| 233 | fxVars(the, 3); |
| 234 | src->slot = mxArgv(0); |
| 235 | src->offset = 0; |
| 236 | src->size = mxStringLength(fxToString(the, mxArgv(0))); |
| 237 | mxVarv(0)->value.string = fxNewChunk(the, mx_parseURLBufferSize); |
| 238 | mxVarv(0)->kind = XS_STRING_KIND; |
| 239 | dst->slot = mxVarv(0); |
| 240 | dst->slot->value.string[0] = 0; |
| 241 | dst->offset = 0; |
| 242 | dst->size = mx_parseURLBufferSize; |
| 243 | |
| 244 | if (mxArgc > 2) { |
| 245 | *mxResult = *mxArgv(1); |
| 246 | result = mxResult; |
| 247 | |
| 248 | override = fxToInteger(the, mxArgv(2)); |
| 249 | mxPushSlot(result); |
| 250 | mxGetID(xsID_scheme); |
| 251 | overrideSchemeIndex = fx_parseURLSpecialScheme(the, the->stack->value.string); |
| 252 | mxPop(); |
| 253 | overrideSpecial = overrideSchemeIndex >= 0; |
| 254 | |
| 255 | if (override == SCHEME_STATE) { |
| 256 | goto XS_URL_SCHEME_START; |
| 257 | } |
| 258 | schemeIndex = overrideSchemeIndex; |
| 259 | special = overrideSpecial; |
| 260 | if (override == USERNAME_STATE) { |
| 261 | if ((schemeIndex == 0) || fx_parseURLIsPartEmpty(the, result, xsID_host)) |
nothing calls this directly
no test coverage detected