mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-23 20:32:43 +00:00
ecf8930ed2
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@41 fc73d0e0-1445-4013-8a0c-d673dee63da5
44 lines
910 B
C
44 lines
910 B
C
#include "qcc.h"
|
|
#include "gui.h"
|
|
|
|
void GoToDefinition(char *name)
|
|
{
|
|
QCC_def_t *def;
|
|
QCC_dfunction_t *fnc;
|
|
|
|
char *strip; //trim whitespace (for convieniance).
|
|
while (*name <= ' ' && *name)
|
|
name++;
|
|
for (strip = name + strlen(name)-1; *strip; strip++)
|
|
{
|
|
if (*strip <= ' ')
|
|
*strip = '\0';
|
|
else //got some part of a word
|
|
break;
|
|
}
|
|
|
|
if (!globalstable.numbuckets)
|
|
{
|
|
MessageBox(NULL, "You need to compile first.", "Not found", 0);
|
|
return;
|
|
}
|
|
|
|
|
|
def = QCC_PR_GetDef(NULL, name, NULL, false, 0);
|
|
|
|
if (def)
|
|
{
|
|
if (def->type->type == ev_function && def->constant)
|
|
{
|
|
fnc = &functions[((int *)qcc_pr_globals)[def->ofs]];
|
|
if (fnc->first_statement>=0)
|
|
{
|
|
EditFile(fnc->s_file+strings, statement_linenums[fnc->first_statement]);
|
|
return;
|
|
}
|
|
}
|
|
EditFile(def->s_file+strings, def->s_line-1);
|
|
}
|
|
else
|
|
MessageBox(NULL, "Global instance of var was not found", "Not found", 0);
|
|
}
|