7 pbool fl_autohighlight;
8 pbool fl_compileonstart;
12 char parameters[16384];
13 char progssrcname[256];
14 char progssrcdir[256];
16 int qccpersisthunk = 1;
17 void GoToDefinition(char *name)
22 char *strip; //trim whitespace (for convieniance).
23 while (*name <= ' ' && *name)
25 for (strip = name + strlen(name)-1; *strip; strip++)
29 else //got some part of a word
33 if (!globalstable.numbuckets)
35 GUI_DialogPrint("Not found", "You need to compile first.");
40 def = QCC_PR_GetDef(NULL, name, NULL, false, 0, false);
44 if (def->type->type == ev_function && def->constant)
46 fnc = &functions[((int *)qcc_pr_globals)[def->ofs]];
47 if (fnc->first_statement>=0 && fnc->s_file)
49 EditFile(fnc->s_file+strings, statement_linenums[fnc->first_statement]);
54 GUI_DialogPrint("Not found", "Global definition of var was not specified.");
56 EditFile(def->s_file+strings, def->s_line-1);
59 GUI_DialogPrint("Not found", "Global instance of var was not found.");
65 //this function takes the windows specified commandline and strips out all the options menu items.
66 void GUI_ParseCommandLine(char *args)
73 while (*args <= ' ' && *args)
76 for (next = args; *next>' '; next++)
79 strncpy(parameters+paramlen, args, next-args);
80 parameters[paramlen+next-args] = '\0';
81 l = strlen(parameters+paramlen)+1;
83 if (!strnicmp(parameters+paramlen, "-O", 2) || !strnicmp(parameters+paramlen, "/O", 2))
85 if (parameters[paramlen+2])
87 if (parameters[paramlen+2] >= '0' && parameters[paramlen+2] <= '3')
89 p = parameters[paramlen+2]-'0';
90 for (l = 0; optimisations[l].enabled; l++)
92 if (optimisations[l].optimisationlevel<=p)
93 optimisations[l].flags |= FLAG_SETINGUI;
95 optimisations[l].flags &= ~FLAG_SETINGUI;
98 else if (!strncmp(parameters+paramlen+2, "no-", 3))
100 if (parameters[paramlen+5])
102 for (p = 0; optimisations[p].enabled; p++)
103 if ((*optimisations[p].abbrev && !strcmp(parameters+paramlen+5, optimisations[p].abbrev)) || !strcmp(parameters+paramlen+5, optimisations[p].fullname))
105 optimisations[p].flags &= ~FLAG_SETINGUI;
109 if (!optimisations[p].enabled)
111 parameters[paramlen+next-args] = ' ';
118 for (p = 0; optimisations[p].enabled; p++)
119 if ((*optimisations[p].abbrev && !strcmp(parameters+paramlen+2, optimisations[p].abbrev)) || !strcmp(parameters+paramlen+2, optimisations[p].fullname))
121 optimisations[p].flags |= FLAG_SETINGUI;
125 if (!optimisations[p].enabled)
127 parameters[paramlen+next-args] = ' ';
134 else if (!strnicmp(parameters+paramlen, "-Fno-kce", 8) || !strnicmp(parameters+paramlen, "/Fno-kce", 8)) //keywords stuph
136 fl_nokeywords_coexist = true;
138 else if (!strnicmp(parameters+paramlen, "-Fkce", 5) || !strnicmp(parameters+paramlen, "/Fkce", 5))
140 fl_nokeywords_coexist = false;
142 else if (!strnicmp(parameters+paramlen, "-Facc", 5) || !strnicmp(parameters+paramlen, "/Facc", 5))
146 else if (!strnicmp(parameters+paramlen, "-autoproto", 10) || !strnicmp(parameters+paramlen, "/autoproto", 10))
148 fl_autoprototype = true;
151 else if (!strnicmp(parameters+paramlen, "-showall", 8) || !strnicmp(parameters+paramlen, "/showall", 8))
155 else if (!strnicmp(parameters+paramlen, "-ah", 3) || !strnicmp(parameters+paramlen, "/ah", 3))
157 fl_autohighlight = true;
159 else if (!strnicmp(parameters+paramlen, "-ac", 3) || !strnicmp(parameters+paramlen, "/ac", 3))
161 fl_compileonstart = true;
163 else if (!strnicmp(parameters+paramlen, "-log", 4) || !strnicmp(parameters+paramlen, "/log", 4))
167 else if (!strnicmp(parameters+paramlen, "-srcfile", 8) || !strnicmp(parameters+paramlen, "/srcfile", 8))
173 while (*next != ' ' && *next)
174 progssrcname[l++] = *next++;
177 else if (!strnicmp(parameters+paramlen, "-T", 2) || !strnicmp(parameters+paramlen, "/T", 2)) //the target
179 if (!strnicmp(parameters+paramlen+2, "h2", 2))
186 parameters[paramlen+next-args] = ' ';
192 parameters[paramlen+next-args] = ' ';
199 parameters[paramlen-1] = '\0';
204 void GUI_SetDefaultOpts(void)
207 for (i = 0; compiler_flag[i].enabled; i++) //enabled is a pointer
209 if (compiler_flag[i].flags & FLAG_ASDEFAULT)
210 compiler_flag[i].flags |= FLAG_SETINGUI;
212 compiler_flag[i].flags &= ~FLAG_SETINGUI;
214 for (i = 0; optimisations[i].enabled; i++) //enabled is a pointer
216 if (optimisations[i].flags & FLAG_ASDEFAULT)
217 optimisations[i].flags |= FLAG_SETINGUI;
219 optimisations[i].flags &= ~FLAG_SETINGUI;
223 void GUI_RevealOptions(void)
226 for (i = 0; compiler_flag[i].enabled; i++) //enabled is a pointer
228 if (fl_showall && compiler_flag[i].flags & FLAG_HIDDENINGUI)
229 compiler_flag[i].flags &= ~FLAG_HIDDENINGUI;
231 for (i = 0; optimisations[i].enabled; i++) //enabled is a pointer
233 if (fl_showall && optimisations[i].flags & FLAG_HIDDENINGUI)
234 optimisations[i].flags &= ~FLAG_HIDDENINGUI;
236 if (optimisations[i].flags & FLAG_HIDDENINGUI) //hidden optimisations are disabled as default
237 optimisations[i].optimisationlevel = 4;
244 int GUI_BuildParms(char *args, char **argv)
246 static char param[2048];
258 while (*args <= ' '&& *args)
261 for (next = args; *next>' '; next++)
263 strncpy(param+paramlen, args, next-args);
264 param[paramlen+next-args] = '\0';
265 argv[argc++] = param+paramlen;
266 paramlen += strlen(param+paramlen)+1;
273 strcpy(param+paramlen, "-Th2");
274 argv[argc++] = param+paramlen;
275 paramlen += strlen(param+paramlen)+1;
278 for (i = 0; optimisations[i].enabled; i++) //enabled is a pointer
280 if (optimisations[i].flags & FLAG_SETINGUI)
281 sprintf(param+paramlen, "-O%s", optimisations[i].abbrev);
283 sprintf(param+paramlen, "-Ono-%s", optimisations[i].abbrev);
284 argv[argc++] = param+paramlen;
285 paramlen += strlen(param+paramlen)+1;
288 for (i = 0; compiler_flag[i].enabled; i++) //enabled is a pointer
290 if (compiler_flag[i].flags & FLAG_SETINGUI)
291 sprintf(param+paramlen, "-F%s", compiler_flag[i].abbrev);
293 sprintf(param+paramlen, "-Fno-%s", compiler_flag[i].abbrev);
294 argv[argc++] = param+paramlen;
295 paramlen += strlen(param+paramlen)+1;
301 while (*args <= ' '&& *args)
304 for (next = args; *next>' '; next++)
306 strncpy(param+paramlen, args, next-args);
307 param[paramlen+next-args] = '\0';
308 argv[argc++] = param+paramlen;
309 paramlen += strlen(param+paramlen)+1;
315 argv[argc++] = "-srcfile";
316 argv[argc++] = progssrcname;
320 argv[argc++] = "-src";
321 argv[argc++] = progssrcdir;