From 8eaac6ced389d1b8347fe5b9b001343b6bc2aa9b Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 4 May 2005 14:45:00 +0000 Subject: [PATCH] Small bug fixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@983 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/Makefile | 5 +++-- engine/qclib/comprout.c | 2 +- engine/qclib/qcc_pr_comp.c | 14 ++++++++++++-- engine/qclib/qcc_pr_lex.c | 23 ++++++++++++++++------- engine/qclib/qccgui.c | 2 +- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/engine/qclib/Makefile b/engine/qclib/Makefile index ac8b489f1..1f4f7b1db 100644 --- a/engine/qclib/Makefile +++ b/engine/qclib/Makefile @@ -2,7 +2,8 @@ QCC_OBJS=qccmain.o qcc_cmdlib.o qcc_pr_comp.o qcc_pr_lex.o comprout.o hash.o qcd GTKGUI_OBJS=qcc_gtk.o qccguistuff.c CC=gcc -Wall -DQCCONLY -DO_CC=$(CC) $(BASE_CFLAGS) -DUSEGUI -o $@ -c $< $(CFLAGS) `pkg-config --cflags gtk+-2.0` + +DO_CC=$(CC) $(BASE_CFLAGS) -DUSEGUI -o $@ -c $< $(CFLAGS) all: qcc @@ -44,7 +45,7 @@ qccguistuff.o: qccguistuff.c qcc.h $(DO_CC) qcc_gtk.o: qcc_gtk.c qcc.h - $(DO_CC) + $(DO_CC) `pkg-config --cflags gtk+-2.0` gtkgui: $(QCC_OBJS) $(GTKGUI_OBJS) $(CC) $(BASE_CFLAGS) -DQCCONLY -DUSEGUI -o fteqccgui.bin -O3 $(GTKGUI_OBJS) $(QCC_OBJS) `pkg-config --libs gtk+-2.0` \ No newline at end of file diff --git a/engine/qclib/comprout.c b/engine/qclib/comprout.c index 76af56919..f22dbb50c 100644 --- a/engine/qclib/comprout.c +++ b/engine/qclib/comprout.c @@ -56,7 +56,7 @@ pbool PreCompile(void) { qccClearHunk(); strcpy(qcc_gamedir, ""); - qcchunk = malloc(qcchunksize=32*1024*1024); + qcchunk = malloc(qcchunksize=64*1024*1024); qccalloced=0; return !!qcchunk; diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 969cc3302..a87ddaecc 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -1081,7 +1081,7 @@ static void QCC_RemapLockedTemps(int firststatement, int laststatement) t = functemps; while(t) { - if (t->scope) + if (t->scope || opt_locals_marshalling) { QCC_RemapLockedTemp(t, firststatement, laststatement); t->scope = NULL; @@ -6009,7 +6009,12 @@ void QCC_Marshal_Locals(int first, int laststatement) unsigned int newofs; if (!opt_overlaptemps) //clear these after each function. we arn't overlapping them so why do we need to keep track of them? + { + temp_t *t; + for (t = functemps; t; t = t->next) + QCC_FreeOffset(t->ofs, t->size); functemps = NULL; + } if (!pr.localvars) //nothing to marshal { @@ -6053,6 +6058,9 @@ void QCC_Marshal_Locals(int first, int laststatement) if (local->constant) continue; + if (((int*)qcc_pr_globals)[local->ofs]) + QCC_PR_ParseError(ERR_INTERNAL, "Marshall of a set value"); + newofs -= local->type->size*local->arraysize; if (local->arraysize>1) newofs--; @@ -6787,6 +6795,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, char *name, QCC_def_t *scope, int a case ev_integer: case ev_struct: case ev_union: + case ev_variant: //for lack of any better alternative sprintf(newname, "%s%s.%s", name, array, parttype->name); QCC_PR_DummyDef(parttype, newname, scope, 1, ofs + type->size*a + parttype->ofs, false); break; @@ -7109,6 +7118,7 @@ QCC_def_t *QCC_PR_DummyFieldDef(QCC_type_t *type, char *name, QCC_def_t *scope, case ev_field: case ev_pointer: case ev_integer: + case ev_variant: if (*name) sprintf(newname, "%s%s.%s", name, array, parttype->name); else @@ -7458,7 +7468,7 @@ void QCC_PR_ParseDefs (char *classname) else if (QCC_PR_CheckKeyword(keyword_const, "const")) isconstant = true; else if (QCC_PR_CheckKeyword(keyword_var, "var")) - isvar = false; + isvar = true; else if (QCC_PR_CheckKeyword(keyword_noref, "noref")) noref=true; else if (QCC_PR_CheckKeyword(keyword_nosave, "nosave")) diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index c865a72f5..242dc9fd7 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -525,7 +525,8 @@ pbool QCC_PR_Precompiler(void) } } else if (!strncmp(directive, "include", 7)) - { + { + int rellen; char sm; pr_file_p=directive+7; @@ -555,17 +556,27 @@ pbool QCC_PR_Precompiler(void) } } + rellen = a; + pr_file_p++; for (;a<1023;a++) { - if (*pr_file_p == sm) + if (*pr_file_p == sm || !*pr_file_p) break; msg[a] = *pr_file_p++; } msg[a] = '\0'; - printf("Including: %s\n", msg); - QCC_Include(msg); + a = 0; + if (externs->FileSize(msg)<0) + { + if (externs->FileSize(msg+rellen)>=0) + a = rellen; + + } + + printf("Including: %s\n", msg+a); + QCC_Include(msg+a); pr_file_p++; @@ -1529,7 +1540,7 @@ pbool QCC_PR_SimpleGetToken (void) } i = 0; - while ( (c = *pr_file_p) > ' ' && c != ',' && c != ';' && c != ')' && c != '(') + while ( (c = *pr_file_p) > ' ' && c != ',' && c != ';' && c != ')' && c != '(' && c != ']' && (c != '.' || pr_file_p[1] != '.')) { pr_token[i] = c; i++; @@ -2786,8 +2797,6 @@ QCC_type_t *QCC_PR_ParseFunctionTypeReacc (int newtype, QCC_type_t *returntype) char argname[64]; int definenames = !recursivefunctiontype; - pbool usesvariants = false; - recursivefunctiontype++; ftype = QCC_PR_NewType(type_function->name, ev_function); diff --git a/engine/qclib/qccgui.c b/engine/qclib/qccgui.c index 14b182b44..3ca542e6c 100644 --- a/engine/qclib/qccgui.c +++ b/engine/qclib/qccgui.c @@ -1597,7 +1597,7 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message, i.pszText = itemtext; i.cchTextMax = sizeof(itemtext)-1; if (!TreeView_GetItem(projecttree, &i)) - return; + return 0; strcpy(filename, i.pszText); while(item) {