void PRVM_ED_ClearEdict (prvm_edict_t *e);
void PRVM_PrintFunctionStatements (const char *name);
-void PRVM_ED_Print(prvm_edict_t *ed);
+void PRVM_ED_Print(prvm_edict_t *ed, const char *wildcard_fieldname);
void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed);
const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent);
void PRVM_Init_Exec(void);
void PRVM_ED_PrintEdicts_f (void);
-void PRVM_ED_PrintNum (int ent);
+void PRVM_ED_PrintNum (int ent, const char *wildcard_fieldname);
const char *PRVM_GetString(int num);
int PRVM_SetEngineString(const char *s);
if (prog->globaloffsets.self >= 0)
{
ed = PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict);
- PRVM_ED_Print(ed);
+ PRVM_ED_Print(ed, NULL);
}
PRVM_ERROR ("%s: Program error in function %s:\n%s\nTip: read above for entity information\n", PRVM_NAME, PRVM_GetString(prog->xfunction->s_name), string);
if (prog->globaloffsets.self >= 0)
{
ed = PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict);
- PRVM_ED_Print(ed);
+ PRVM_ED_Print(ed, NULL);
PRVM_ED_Free (ed);
}
{
VM_SAFEPARMCOUNT(1,VM_eprint);
- PRVM_ED_PrintNum (PRVM_G_EDICTNUM(OFS_PARM0));
+ PRVM_ED_PrintNum (PRVM_G_EDICTNUM(OFS_PARM0), NULL);
}
/*
*/
// LordHavoc: optimized this to print out much more quickly (tempstring)
// LordHavoc: changed to print out every 4096 characters (incase there are a lot of fields to print)
-void PRVM_ED_Print(prvm_edict_t *ed)
+void PRVM_ED_Print(prvm_edict_t *ed, const char *wildcard_fieldname)
{
size_t l;
ddef_t *d;
if (name[strlen(name)-2] == '_')
continue; // skip _x, _y, _z vars
+ // Check Field Name Wildcard
+ if(wildcard_fieldname)
+ if( !matchpattern(name, wildcard_fieldname, 1) )
+ // Didn't match; skip
+ continue;
+
v = (int *)((char *)ed->fields.vp + d->ofs*4);
// if the value is still all 0, skip the field
FS_Print(f, "}\n");
}
-void PRVM_ED_PrintNum (int ent)
+void PRVM_ED_PrintNum (int ent, const char *wildcard_fieldname)
{
- PRVM_ED_Print(PRVM_EDICT_NUM(ent));
+ PRVM_ED_Print(PRVM_EDICT_NUM(ent), wildcard_fieldname);
}
/*
void PRVM_ED_PrintEdicts_f (void)
{
int i;
+ const char *wildcard_fieldname;
- if(Cmd_Argc() != 2)
+ if(Cmd_Argc() < 2 || Cmd_Argc() > 3)
{
- Con_Print("prvm_edicts <program name>\n");
+ Con_Print("prvm_edicts <program name> <optional field name wildcard>\n");
return;
}
if(!PRVM_SetProgFromString(Cmd_Argv(1)))
return;
+ if( Cmd_Argc() == 3)
+ wildcard_fieldname = Cmd_Argv(2);
+ else
+ wildcard_fieldname = NULL;
+
Con_Printf("%s: %i entities\n", PRVM_NAME, prog->num_edicts);
for (i=0 ; i<prog->num_edicts ; i++)
- PRVM_ED_PrintNum (i);
+ PRVM_ED_PrintNum (i, wildcard_fieldname);
PRVM_End;
}
void PRVM_ED_PrintEdict_f (void)
{
int i;
+ const char *wildcard_fieldname;
- if(Cmd_Argc() != 3)
+ if(Cmd_Argc() < 3 || Cmd_Argc() > 4)
{
- Con_Print("prvm_edict <program name> <edict number>\n");
+ Con_Print("prvm_edict <program name> <edict number> <optional field name wildcard>\n");
return;
}
PRVM_End;
return;
}
- PRVM_ED_PrintNum (i);
+ if( Cmd_Argc() == 4)
+ // Optional Wildcard Provided
+ wildcard_fieldname = Cmd_Argv(3);
+ else
+ // Use All
+ wildcard_fieldname = NULL;
+ PRVM_ED_PrintNum (i, wildcard_fieldname);
PRVM_End;
}
if (!handle)
{
Con_Print("No classname for:\n");
- PRVM_ED_Print(ent);
+ PRVM_ED_Print(ent, NULL);
PRVM_ED_Free (ent);
continue;
}
if (developer.integer) // don't confuse non-developers with errors
{
Con_Print("No spawn function for:\n");
- PRVM_ED_Print(ent);
+ PRVM_ED_Print(ent, NULL);
}
PRVM_ED_Free (ent);
continue;
void PRVM_Globals_f (void)
{
int i;
+ const char *wildcard;
+ int numculled;
+ numculled = 0;
// TODO
/*if (!sv.active)
{
Con_Print("no progs loaded\n");
return;
}*/
- if(Cmd_Argc () != 2)
+ if(Cmd_Argc () < 2 || Cmd_Argc() > 3)
{
- Con_Print("prvm_globals <program name>\n");
+ Con_Print("prvm_globals <program name> <optional name wildcard>\n");
return;
}
if(!PRVM_SetProgFromString (Cmd_Argv (1)))
return;
+ if( Cmd_Argc() == 3)
+ wildcard = Cmd_Argv(2);
+ else
+ wildcard = NULL;
+
Con_Printf("%s :", PRVM_NAME);
for (i = 0;i < prog->progs->numglobaldefs;i++)
+ {
+ if(wildcard)
+ if( !matchpattern( PRVM_GetString(prog->globaldefs[i].s_name), wildcard, 1) )
+ {
+ numculled++;
+ continue;
+ }
Con_Printf("%s\n", PRVM_GetString(prog->globaldefs[i].s_name));
- Con_Printf("%i global variables, totalling %i bytes\n", prog->progs->numglobals, prog->progs->numglobals * 4);
+ }
+ Con_Printf("%i global variables, %i culled, totalling %i bytes\n", prog->progs->numglobals, numculled, prog->progs->numglobals * 4);
PRVM_End;
}