QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Typedefs

typedef int pr_load_func_t (progs_t *pr)
 Type of functions that are called at progs load. More...
 

Functions

void PR_AddLoadFinishFunc (progs_t *pr, pr_load_func_t *func)
 Register a secondary function to be called after the progs code has been loaded. More...
 
void PR_AddLoadFunc (progs_t *pr, pr_load_func_t *func)
 Register a primary function to be called after the progs code has been loaded. More...
 
void PR_BoundsCheck (progs_t *pr, int addr, etype_t type)
 
void PR_BoundsCheckSize (progs_t *pr, pointer_t addr, unsigned size)
 
int PR_Check_Opcodes (progs_t *pr)
 Validate the opcodes and statement addresses in the progs. More...
 
void PR_LoadProgs (progs_t *pr, const char *progsname, int max_edicts, int zone)
 Convenience wrapper for PR_LoadProgsFile() and PR_RunLoadFuncs(). More...
 
void PR_LoadProgsFile (progs_t *pr, struct QFile_s *file, int size, int max_edicts, int zone)
 Initialize a progs_t VM struct from an already open file. More...
 
int PR_RunLoadFuncs (progs_t *pr)
 Run all load functions. More...
 

Detailed Description

Typedef Documentation

typedef int pr_load_func_t(progs_t *pr)

Type of functions that are called at progs load.

Parameters
prpointer to progs_t VM struct
Returns
true for success, false for failure

Function Documentation

void PR_AddLoadFinishFunc ( progs_t pr,
pr_load_func_t func 
)

Register a secondary function to be called after the progs code has been loaded.

These functions will be forgotten after each load. They will be called in reverse order of being registered.

Parameters
prpointer to progs_t VM struct
funcfunction to call
void PR_AddLoadFunc ( progs_t pr,
pr_load_func_t func 
)

Register a primary function to be called after the progs code has been loaded.

These functions are remembered across progs loads. They will be called in order of registration.

Parameters
prpointer to progs_t VM struct
funcfunction to call
void PR_BoundsCheck ( progs_t pr,
int  addr,
etype_t  type 
)
void PR_BoundsCheckSize ( progs_t pr,
pointer_t  addr,
unsigned  size 
)
int PR_Check_Opcodes ( progs_t pr)

Validate the opcodes and statement addresses in the progs.

This is an internal load function.

Parameters
prpointer to progs_t VM struct
Returns
true for success, false for failure
Todo:
should this be elsewhere?
void PR_LoadProgs ( progs_t pr,
const char *  progsname,
int  max_edicts,
int  zone 
)

Convenience wrapper for PR_LoadProgsFile() and PR_RunLoadFuncs().

Searches for the specified file in the Quake filesystem.

Parameters
prpointer to progs_t VM struct
progsnamename of the file to load as progs data
max_edictsnumber of entities to allocate space for
zoneminimum size of dynamic memory to allocate space for
void PR_LoadProgsFile ( progs_t pr,
struct QFile_s *  file,
int  size,
int  max_edicts,
int  zone 
)

Initialize a progs_t VM struct from an already open file.

Parameters
prpointer to progs_t VM struct
filehandle of file to read progs data from
sizebytes of file to read
max_edictsnumber of entities to allocate space for
zoneminimum size of dynamic memory to allocate space for dynamic memory (bytes).
Note
All runtime strings (permanent or temporary) are allocated from the VM's dynamic memory space, so be sure zone is of sufficient size. So far, 1MB has proven more than sufficient for Quakeword, even when using Ruamoko objects.
int PR_RunLoadFuncs ( progs_t pr)

Run all load functions.

Any load function returning false will abort the load operation.

Parameters
prpointer to progs_t VM struct
Returns
true for success, false for failure

Calls the first set of internal load functions followed by the supplied symbol resolution function, if any (progs_t::resolve), the second set of internal load functions. After that, any primary load functions are called in order of registration followed by any .ctor functions in the progs, then any secondary load functions the primary load functions registered in reverse order of registration.