MCPcopy Create free account
hub / github.com/JACoders/OpenJK / LoadScriptMemory

Function LoadScriptMemory

codemp/botlib/l_script.cpp:1402–1431  ·  view source on GitHub ↗

end of the function LoadScriptFile ============================================================================ Parameter: - Returns: - Changes Globals: - ============================================================================

Source from the content-addressed store, hash-verified

1400// Changes Globals: -
1401//============================================================================
1402script_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: -

Callers 3

PC_DefineFromStringFunction · 0.85
LoadSourceMemoryFunction · 0.85
AAS_ParseBSPEntitiesFunction · 0.85

Calls 3

GetClearedMemoryFunction · 0.85
Q_strncpyzFunction · 0.85
SetScriptPunctuationsFunction · 0.85

Tested by

no test coverage detected