end of the function LoadScriptFile ============================================================================ Parameter: - Returns: - Changes Globals: - ============================================================================
| 1400 | // Changes Globals: - |
| 1401 | //============================================================================ |
| 1402 | script_t *LoadScriptMemory(char *ptr, int length, char *name) |
| 1403 | { |
| 1404 | void *buffer; |
| 1405 | script_t *script; |
| 1406 | |
| 1407 | buffer = GetClearedMemory(sizeof(script_t) + length + 1); |
| 1408 | script = (script_t *) buffer; |
| 1409 | Com_Memset(script, 0, sizeof(script_t)); |
| 1410 | Q_strncpyz(script->filename, name, sizeof(script->filename)); |
| 1411 | script->buffer = (char *) buffer + sizeof(script_t); |
| 1412 | script->buffer[length] = 0; |
| 1413 | script->length = length; |
| 1414 | //pointer in script buffer |
| 1415 | script->script_p = script->buffer; |
| 1416 | //pointer in script buffer before reading token |
| 1417 | script->lastscript_p = script->buffer; |
| 1418 | //pointer to end of script buffer |
| 1419 | script->end_p = &script->buffer[length]; |
| 1420 | //set if there's a token available in script->token |
| 1421 | script->tokenavailable = 0; |
| 1422 | // |
| 1423 | script->line = 1; |
| 1424 | script->lastline = 1; |
| 1425 | // |
| 1426 | SetScriptPunctuations(script, NULL); |
| 1427 | // |
| 1428 | Com_Memcpy(script->buffer, ptr, length); |
| 1429 | // |
| 1430 | return script; |
| 1431 | } //end of the function LoadScriptMemory |
| 1432 | //============================================================================ |
| 1433 | // |
| 1434 | // Parameter: - |
no test coverage detected