the big dso visibility patch :). Sure, we have to have unique names for static builds, but with controlled visibitly we should get faster program loads (although this isn't C++, so it's not as bad) and complex plugins are cleaner.

This commit is contained in:
Bill Currie 2007-03-10 12:00:59 +00:00 committed by Jeff Teunissen
parent 58523becc7
commit 99c0954b47
130 changed files with 762 additions and 722 deletions

View file

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS= foreign
AM_CFLAGS= @PREFER_PIC@
CFLAGS+= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include
lib_LTLIBRARIES= libQFgamecode_builtins.la

View file

@ -186,7 +186,7 @@ static builtin_t builtins[] = {
{0}
};
void
VISIBLE void
GIB_Progs_Init (progs_t *pr)
{
bi_gib_resources_t *res = malloc (sizeof (bi_gib_resources_t));

View file

@ -223,7 +223,7 @@ static builtin_t builtins[] = {
{0}
};
void
VISIBLE void
InputLine_Progs_Init (progs_t *pr)
{
il_resources_t *res = malloc (sizeof (il_resources_t));
@ -234,7 +234,7 @@ InputLine_Progs_Init (progs_t *pr)
PR_RegisterBuiltins (pr, builtins);
}
void
VISIBLE void
InputLine_Progs_SetDraw (progs_t *pr, void (*draw)(inputline_t *))
{
il_resources_t *res = PR_Resources_Find (pr, "InputLine");

View file

@ -58,11 +58,11 @@ static U void (*const gib_progs_init)(progs_t *) = GIB_Progs_Init;
static U void (*const inputline_progs_init)(progs_t *) = InputLine_Progs_Init;
#undef U
const char *pr_gametype = "";
VISIBLE const char *pr_gametype = "";
/* BUILT-IN FUNCTIONS */
char *
VISIBLE char *
PF_VarString (progs_t *pr, int first)
{
char *out;
@ -662,7 +662,7 @@ static builtin_t builtins[] = {
{0}
};
void
VISIBLE void
PR_Cmds_Init (progs_t *pr)
{
PR_RegisterBuiltins (pr, builtins);

View file

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS= foreign
AM_CFLAGS= @PREFER_PIC@
CFLAGS+= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include
lib_LTLIBRARIES= libQFgamecode.la

View file

@ -89,7 +89,7 @@ builtin_next (progs_t *pr)
return pr->bi_next++;
}
void
VISIBLE void
PR_RegisterBuiltins (progs_t *pr, builtin_t *builtins)
{
builtin_t *bi;
@ -130,7 +130,7 @@ PR_RegisterBuiltins (progs_t *pr, builtin_t *builtins)
}
}
builtin_t *
VISIBLE builtin_t *
PR_FindBuiltin (progs_t *pr, const char *name)
{
return (builtin_t *) Hash_Find (pr->builtin_hash, name);
@ -158,7 +158,7 @@ bi_no_function (progs_t *pr)
PR_RunError (pr, "Bad builtin called: %s = #%d", bi_name, ind);
}
int
VISIBLE int
PR_RelocateBuiltins (progs_t *pr)
{
int i, ind;

View file

@ -183,7 +183,7 @@ PR_Load_Source_File (progs_t *pr, const char *fname)
return f;
}
int
VISIBLE int
PR_LoadDebug (progs_t *pr)
{
char *sym_path;
@ -398,7 +398,7 @@ PR_Get_Local_Def (progs_t *pr, int offs)
return 0;
}
void
VISIBLE void
PR_DumpState (progs_t *pr)
{
if (pr->pr_xfunction) {
@ -594,7 +594,7 @@ global_string (progs_t *pr, int ofs, etype_t type, int contents)
return line->str;
}
void
VISIBLE void
PR_PrintStatement (progs_t * pr, dstatement_t *s, int contents)
{
int addr = s - pr->pr_statements;
@ -746,7 +746,7 @@ PR_StackTrace (progs_t *pr)
dump_frame (pr, pr->pr_stack + i);
}
void
VISIBLE void
PR_Profile (progs_t * pr)
{
int max, num, i;
@ -778,7 +778,7 @@ PR_Profile (progs_t * pr)
For debugging
*/
void
VISIBLE void
ED_Print (progs_t *pr, edict_t *ed)
{
int type, l;

View file

@ -61,7 +61,7 @@ static __attribute__ ((used)) const char rcsid[] =
Sets everything to NULL
*/
void
VISIBLE void
ED_ClearEdict (progs_t *pr, edict_t *e, int val)
{
unsigned int i;
@ -83,7 +83,7 @@ ED_ClearEdict (progs_t *pr, edict_t *e, int val)
instead of being removed and recreated, which can cause interpolated
angles and bad trails.
*/
edict_t *
VISIBLE edict_t *
ED_Alloc (progs_t *pr)
{
int i;
@ -123,7 +123,7 @@ ED_Alloc (progs_t *pr)
Marks the edict as free
FIXME: walk all entities and NULL out references to this entity
*/
void
VISIBLE void
ED_Free (progs_t *pr, edict_t *ed)
{
if (pr->unlink)
@ -146,7 +146,7 @@ ED_Free (progs_t *pr, edict_t *ed)
void
VISIBLE void
ED_PrintNum (progs_t *pr, int ent)
{
ED_Print (pr, EDICT_NUM (pr, ent));
@ -157,7 +157,7 @@ ED_PrintNum (progs_t *pr, int ent)
For debugging, prints all the entities in the current server
*/
void
VISIBLE void
ED_PrintEdicts (progs_t *pr, const char *fieldval)
{
int i;
@ -187,7 +187,7 @@ ED_PrintEdicts (progs_t *pr, const char *fieldval)
For debugging
*/
void
VISIBLE void
ED_Count (progs_t *pr)
{
int i;

View file

@ -55,7 +55,7 @@ static __attribute__ ((used)) const char rcsid[] =
Aborts the currently executing function
*/
void
VISIBLE void
PR_RunError (progs_t * pr, const char *error, ...)
{
dstring_t *string = dstring_new ();
@ -75,7 +75,7 @@ PR_RunError (progs_t * pr, const char *error, ...)
PR_Error (pr, "Program error: %s", string->str);
}
inline void
VISIBLE inline void
PR_PushFrame (progs_t *pr)
{
prstack_t *frame;
@ -93,7 +93,7 @@ PR_PushFrame (progs_t *pr)
pr->pr_xfunction = 0;
}
inline void
VISIBLE inline void
PR_PopFrame (progs_t *pr)
{
prstack_t *frame;
@ -276,7 +276,7 @@ signal_hook (int sig, void *data)
return 0;
}
int
VISIBLE int
PR_CallFunction (progs_t *pr, func_t fnum)
{
dfunction_t *f;
@ -299,7 +299,7 @@ PR_CallFunction (progs_t *pr, func_t fnum)
The interpretation main loop
*/
void
VISIBLE void
PR_ExecuteProgram (progs_t * pr, func_t fnum)
{
int exitdepth, profile, startprofile;

View file

@ -99,7 +99,7 @@ free_progs_mem (progs_t *pr, void *mem)
{
}
void
VISIBLE void
PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone)
{
unsigned i;
@ -269,7 +269,7 @@ PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone)
((int *) pr->pr_globals)[i] = LittleLong (((int *) pr->pr_globals)[i]);
}
void
VISIBLE void
PR_AddLoadFunc (progs_t *pr, int (*func)(progs_t *))
{
if (pr->num_load_funcs == pr->max_load_funcs) {
@ -283,7 +283,7 @@ PR_AddLoadFunc (progs_t *pr, int (*func)(progs_t *))
pr->load_funcs[pr->num_load_funcs++] = func;
}
void
VISIBLE void
PR_AddLoadFinishFunc (progs_t *pr, int (*func)(progs_t *))
{
if (pr->num_load_finish_funcs == pr->max_load_finish_funcs) {
@ -335,7 +335,7 @@ run_load_funcs (progs_t *pr, int (**load_funcs)(progs_t *))
return 1;
}
int
VISIBLE int
PR_RunLoadFuncs (progs_t *pr)
{
int i;
@ -371,7 +371,7 @@ PR_RunLoadFuncs (progs_t *pr)
/*
PR_LoadProgs
*/
void
VISIBLE void
PR_LoadProgs (progs_t *pr, const char *progsname, int edicts, int zone)
{
QFile *file;
@ -389,7 +389,7 @@ PR_LoadProgs (progs_t *pr, const char *progsname, int edicts, int zone)
PR_Error (pr, "unable to load %s", progsname);
}
void
VISIBLE void
PR_Init_Cvars (void)
{
pr_boundscheck =
@ -405,14 +405,14 @@ PR_Init_Cvars (void)
PR_Debug_Init_Cvars ();
}
void
VISIBLE void
PR_Init (void)
{
PR_Opcode_Init ();
PR_Debug_Init ();
}
void
VISIBLE void
PR_Error (progs_t *pr, const char *error, ...)
{
va_list argptr;

View file

@ -48,7 +48,7 @@ static __attribute__ ((used)) const char rcsid[] =
hashtab_t *opcode_table;
int pr_type_size[ev_type_count] = {
VISIBLE int pr_type_size[ev_type_count] = {
1, // ev_void
1, // ev_string
1, // ev_float
@ -68,7 +68,7 @@ int pr_type_size[ev_type_count] = {
0, // ev_array variable
};
const char *pr_type_name[ev_type_count] = {
VISIBLE const char *pr_type_name[ev_type_count] = {
"void",
"string",
"float",
@ -98,7 +98,7 @@ const char *pr_type_name[ev_type_count] = {
// a operand a
// b operand b
// c operand c
opcode_t pr_opcodes[] = {
VISIBLE opcode_t pr_opcodes[] = {
{"<DONE>", "done", OP_DONE, false,
ev_entity, ev_field, ev_void,
PROG_ID_VERSION,
@ -1168,7 +1168,7 @@ PR_Opcode (short opcode)
return Hash_FindElement (opcode_table, &op);
}
void
VISIBLE void
PR_Opcode_Init (void)
{
opcode_t *op;

View file

@ -108,7 +108,7 @@ PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val)
return line;
}
plitem_t *
VISIBLE plitem_t *
ED_EntityDict (progs_t *pr, edict_t *ed)
{
plitem_t *entity = PL_NewDictionary ();
@ -150,7 +150,7 @@ ED_EntityDict (progs_t *pr, edict_t *ed)
FIXME: need to tag constants, doesn't really work
*/
plitem_t *
VISIBLE plitem_t *
ED_GlobalsDict (progs_t *pr)
{
plitem_t *globals = PL_NewDictionary ();
@ -209,7 +209,7 @@ ED_NewString (progs_t *pr, const char *string)
Can parse either fields or globals
returns false if error
*/
qboolean
VISIBLE qboolean
ED_ParseEpair (progs_t *pr, pr_type_t *base, ddef_t *key, const char *s)
{
int i;
@ -286,7 +286,7 @@ ED_ParseEpair (progs_t *pr, pr_type_t *base, ddef_t *key, const char *s)
to call ED_CallSpawnFunctions () to let the objects initialize themselves.
*/
plitem_t *
VISIBLE plitem_t *
ED_ConvertToPlist (progs_t *pr, script_t *script)
{
plitem_t *plist = PL_NewArray ();
@ -335,7 +335,7 @@ ED_ConvertToPlist (progs_t *pr, script_t *script)
}
void
VISIBLE void
ED_InitGlobals (progs_t *pr, plitem_t *globals)
{
ddef_t *global;
@ -360,7 +360,7 @@ ED_InitGlobals (progs_t *pr, plitem_t *globals)
PL_Free (keys);
}
void
VISIBLE void
ED_InitEntity (progs_t *pr, plitem_t *entity, edict_t *ent)
{
ddef_t *field;
@ -439,7 +439,7 @@ ED_SpawnEntities (progs_t *pr, plitem_t *entity_list)
}
}
void
VISIBLE void
ED_LoadFromFile (progs_t *pr, const char *data)
{
script_t *script;
@ -471,7 +471,7 @@ ED_LoadFromFile (progs_t *pr, const char *data)
}
}
void
VISIBLE void
ED_EntityParseFunction (progs_t *pr)
{
pr->edict_parse = P_FUNCTION (pr, 0);

View file

@ -69,7 +69,7 @@ PR_GlobalAtOfs (progs_t * pr, int ofs)
return NULL;
}
ddef_t *
VISIBLE ddef_t *
PR_FieldAtOfs (progs_t * pr, int ofs)
{
ddef_t *def;
@ -83,25 +83,25 @@ PR_FieldAtOfs (progs_t * pr, int ofs)
return NULL;
}
ddef_t *
VISIBLE ddef_t *
PR_FindField (progs_t * pr, const char *name)
{
return Hash_Find (pr->field_hash, name);
}
ddef_t *
VISIBLE ddef_t *
PR_FindGlobal (progs_t * pr, const char *name)
{
return Hash_Find (pr->global_hash, name);
}
dfunction_t *
VISIBLE dfunction_t *
PR_FindFunction (progs_t * pr, const char *name)
{
return Hash_Find (pr->function_hash, name);
}
void
VISIBLE void
PR_Undefined (progs_t *pr, const char *type, const char *name)
{
PR_Error (pr, "undefined %s %s", type, name);

View file

@ -53,7 +53,7 @@ resource_get_key (void *r, void *unused)
return ((pr_resource_t *)r)->name;
}
void
VISIBLE void
PR_Resources_Init (progs_t *pr)
{
pr->resource_hash = Hash_NewTable (1021, resource_get_key, 0, 0);
@ -70,7 +70,7 @@ PR_Resources_Clear (progs_t *pr)
}
}
void
VISIBLE void
PR_Resources_Register (progs_t *pr, const char *name, void *data,
void (*clear)(progs_t *, void *))
{
@ -85,7 +85,7 @@ PR_Resources_Register (progs_t *pr, const char *name, void *data,
Hash_Add (pr->resource_hash, res);
}
void *
VISIBLE void *
PR_Resources_Find (progs_t *pr, const char *name)
{
pr_resource_t *res = Hash_Find (pr->resource_hash, name);

View file

@ -187,7 +187,7 @@ strref_free (void *_sr, void *_pr)
}
}
int
VISIBLE int
PR_LoadStrings (progs_t *pr)
{
char *end = pr->pr_strings + pr->progs->numstrings;
@ -281,13 +281,13 @@ get_string (progs_t *pr, int num)
}
}
qboolean
VISIBLE qboolean
PR_StringValid (progs_t *pr, int num)
{
return get_string (pr, num) != 0;
}
const char *
VISIBLE const char *
PR_GetString (progs_t *pr, int num)
{
const char *str;
@ -298,7 +298,7 @@ PR_GetString (progs_t *pr, int num)
PR_RunError (pr, "Invalid string offset %d", num);
}
dstring_t *
VISIBLE dstring_t *
PR_GetMutableString (progs_t *pr, int num)
{
strref_t *ref = get_strref (pr, num);
@ -330,7 +330,7 @@ pr_strdup (progs_t *pr, const char *s)
return new;
}
int
VISIBLE int
PR_SetString (progs_t *pr, const char *s)
{
strref_t *sr;
@ -360,7 +360,7 @@ PR_ClearReturnStrings (progs_t *pr)
}
}
int
VISIBLE int
PR_SetReturnString (progs_t *pr, const char *s)
{
strref_t *sr;
@ -415,7 +415,7 @@ PR_CatStrings (progs_t *pr, const char *a, const char *b)
return pr_settempstring (pr, c);
}
int
VISIBLE int
PR_SetTempString (progs_t *pr, const char *s)
{
strref_t *sr;
@ -430,7 +430,7 @@ PR_SetTempString (progs_t *pr, const char *s)
return pr_settempstring (pr, pr_strdup (pr, s));
}
int
VISIBLE int
PR_SetDynamicString (progs_t *pr, const char *s)
{
strref_t *sr;
@ -469,7 +469,7 @@ PR_MakeTempString (progs_t *pr, int str)
pr->pr_xtstr = sr;
}
int
VISIBLE int
PR_NewMutableString (progs_t *pr)
{
strref_t *sr = new_string_ref (pr);
@ -478,7 +478,7 @@ PR_NewMutableString (progs_t *pr)
return string_index (pr, sr);
}
void
VISIBLE void
PR_FreeString (progs_t *pr, int str)
{
strref_t *sr = get_strref (pr, str);
@ -636,7 +636,7 @@ free_fmt_item (fmt_item_t *fi)
#undef P_var
#define P_var(p,n,t) (args[n]->t##_var)
void
VISIBLE void
PR_Sprintf (progs_t *pr, dstring_t *result, const char *name,
const char *format, int count, pr_type_t **args)
{

View file

@ -54,19 +54,19 @@ PR_Zone_Init (progs_t *pr)
Z_ClearZone (pr->zone, pr->zone_size);
}
void
VISIBLE void
PR_Zone_Free (progs_t *pr, void *ptr)
{
Z_Free (pr->zone, ptr);
}
void *
VISIBLE void *
PR_Zone_Malloc (progs_t *pr, int size)
{
return Z_Malloc (pr->zone, size);
}
void *
VISIBLE void *
PR_Zone_Realloc (progs_t *pr, void *ptr, int size)
{
return Z_Realloc (pr->zone, ptr, size);