Commit Graph

485 Commits

Author SHA1 Message Date
Bill Currie 72af804b31 nested include reporting 2007-03-31 15:27:36 +00:00
Bill Currie 1925bef0c1 fix a bunch of bugs with single-cpp processing when not keeping temps 2006-08-20 06:20:30 +00:00
Bill Currie 130e6c1a3f fix some intermediate file issues 2006-05-24 14:50:24 +00:00
Bill Currie f7df6fea17 instead of having cpp args in progs.src, potentially breaking some mods, generate progs.i as a series of #includes and then compile everything in one pass 2006-05-24 14:35:39 +00:00
Bill Currie 8f097ce3dd fix a couple of typoes 2006-05-24 12:58:31 +00:00
Bill Currie 66cabb587f add the vector-calls "optimisation" from fteqcc. makes it possible to
compile the version of frogbot with waypoints for almost 300 maps.
2005-06-10 07:31:25 +00:00
Bill Currie 501180aaac gcc-4.0 fixes. even found some bugs :) (names /not/ mangled this time) 2005-06-08 06:35:48 +00:00
Bill Currie 66257e3a88 run in fear, function overloading is here
This is an imperfect revision of history.
2004-11-13 11:50:00 +00:00
Bill Currie 4d044bfea4 make entity.vector.x work properly by making relative field offset work. also don't emit a field def for the resulting immediate
This is an imperfect revision of history.
2004-11-12 10:49:00 +00:00
Bill Currie 64cc8c60d2 compile time protocol support seems to be complete now. fortunatly, protocols had never been written out so the corrections to the protocol related stuctures do not need a progs version bump. runtime protocol support hasn't been fully tested yet.
+load runtime support seems to be working.

This is an imperfect revision of history.
2004-11-11 00:34:00 +00:00
Bill Currie b35561504c do proper selector registration. unfortunatly, I discovered I'd created pr_method_t incorrectly and so had to bump the progs version again
This is an imperfect revision of history.
2004-11-10 05:37:00 +00:00
Bill Currie b46cff08aa handle param name changes between prototype and declaration gracefully
This is an imperfect revision of history.
2004-11-02 23:54:00 +00:00
Bill Currie fff41d664a detect re-declaring identifiers as different types (typedef, enum, var, etc)
This is an imperfect revision of history.
2004-11-02 07:02:00 +00:00
Bill Currie 14900bb82e fast-float code option (defaults to on). kills almost 3000 statements from
prozac
2004-04-27 20:24:37 +00:00
Bill Currie 7b28c555ba quaternion field access now works 2004-04-09 04:12:44 +00:00
Bill Currie 0e47ee96f8 spelling fixes 2004-04-08 18:53:46 +00:00
Bill Currie fc2413ff72 more quaternion work (should be working, haven't come up with tests yet) 2004-04-08 03:32:14 +00:00
Bill Currie f1c9a8d24b remove a mostly unused field 2004-02-21 05:58:01 +00:00
Bill Currie 14e8bfe94b auto-init for uninitialized locals in traditional mode as requested by
Grievre
2004-02-21 05:52:05 +00:00
Bill Currie 0360859a0f all warnings (except for @self and self) are now fully controllable 2004-02-17 00:39:21 +00:00
Bill Currie c3f41e3e69 new opcode: state.f. same as state, but takes a 3rd float operand to
specify the step for calculating nextthink. accessed using
[frame, think, step] (state is [frame, think])
2004-02-11 01:43:33 +00:00
Bill Currie 1fc517f7db C style functions can now (optionally) be used (void foo ();) 2004-02-11 00:36:34 +00:00
Bill Currie 892e80938b that made a royal mess :( 2004-02-04 04:49:46 +00:00
Bill Currie b2474a2b97 better auto-conversion of function parameters (ugh, this is getting messy
:( )
2004-02-04 04:33:08 +00:00
Bill Currie 4f9a24d94d and another one 2004-02-03 03:38:51 +00:00
Bill Currie 16e4964a31 fix a couple struct forward ref issues 2004-01-30 07:16:48 +00:00
Bill Currie d3018dd79b move qfprogs in with qfcc (it's going to need to share code) 2004-01-28 05:23:43 +00:00
Bill Currie 51b0a66ac7 better constant folding with auto-conversion between scalar types (might
make that optional for non-constants)
2004-01-25 08:55:03 +00:00
Bill Currie 72ae59f882 short circuit logic can now be controlled (see man page) 2003-10-22 08:27:38 +00:00
Bill Currie 945006494f short circuit logic for && and || (as per C). forces standard precedence
(ie, breaks --traditional) when enabled (no choice at the moment, next fix)
2003-10-22 08:05:17 +00:00
Bill Currie 9027648721 kill -t for --traditional, add --advanced, default to --traditional for
progs.src mode and --advanced otherwise
2003-09-20 04:13:32 +00:00
Bill Currie 11538d4745 access arrays in structs more efficiently (especially when using constant
indeces)
2003-09-02 17:41:16 +00:00
Bill Currie 385a90e8fb correct pr_symtab_t to include the pointer to the array of selectors used
in the module. Unfortunatly, this requires a version bump on both qfo and
progs files due to the changes structure layout.
2003-08-23 06:15:19 +00:00
Bill Currie b38486d405 make rel_def_op work properly 2003-08-22 19:48:14 +00:00
Bill Currie 204243fe95 better message type checking 2003-08-22 05:26:47 +00:00
Bill Currie 11c7c27f70 better relocations: pointers to structure members now work 2003-08-21 02:21:30 +00:00
Bill Currie 7d830ffc1f make @defs work properly and don't do uninitialized checks on structs 2003-08-20 19:58:41 +00:00
Bill Currie dd9ab1e050 get unsigned mostly working 2003-08-01 21:20:04 +00:00
Bill Currie 1b5bf9d176 make methods showing up only in the implementation work when overiding an
inherited method
2003-08-01 05:08:15 +00:00
Bill Currie 6ecb707257 revamp the struct system so "struct foo;" does the right thing (ala C) 2003-07-30 04:11:45 +00:00
Bill Currie 5e6b25c917 add interface-check warning option. defaults off 2003-07-29 18:31:12 +00:00
Bill Currie 5b9b11241b make method lookup work with id 2003-07-29 17:38:29 +00:00
Bill Currie be6a7ae715 d'oh 2003-07-27 21:33:05 +00:00
Bill Currie 5962900e25 allow rel_def_op relocs to point just past the end of the code. needed for
jump tables.
2003-07-24 17:51:24 +00:00
Bill Currie 778cd78c35 fix some namespace issues with names both being a field and an ivar 2003-07-23 18:28:31 +00:00
Bill Currie dedb2fa6bf get [super ...] working correctly 2003-05-15 05:58:31 +00:00
Bill Currie b6b5089ccc add a "nosave" flag to defs making it easier to make defs that don't get
saved automaticly
2003-04-25 17:00:22 +00:00
Bill Currie f7d806e8d5 can now handle > vector sized parameters 2003-04-22 20:11:16 +00:00
Bill Currie 2f6fc5d80c general revamp so params and the return value use proper defs rather than
hardcoded locations. this will allow use of quaternions in the future.
2003-04-22 15:29:32 +00:00
Bill Currie eb099ae0d3 make qf gcc 3.3 clean 2003-04-17 00:01:48 +00:00
Bill Currie ef762e21eb allow initialized globals (since they're constant) to be used in most places
constants are required (switch, initializing globals, enums)
2003-02-28 04:54:07 +00:00
Bill Currie 382f13f7ce fix a decl mismatch 2003-02-26 05:01:18 +00:00
Bill Currie 2ba8e871f3 convert \ to / in paths in windows 2003-02-24 21:51:08 +00:00
Bill Currie 44285ba5de speed up qfo writing by about 12.5:1 (for large object files, anyway) by
making compression optional (compressed qfo files will still be handled
transparently)
2003-02-23 23:43:43 +00:00
Bill Currie 71196fedf6 make gcc more anal about prototypes, string constants and function
visibility (ie, global functions must have a prototype)
2003-01-06 18:28:13 +00:00
Bill Currie 3c215ce13f getting closer to working categories 2002-11-14 18:17:43 +00:00
Bill Currie da334413b8 re-write category handling so it has a better chance of working (category
using code now compiles)
2002-11-12 19:52:43 +00:00
Bill Currie 7f69f593d3 configure.ac:
define default include and lib paths for qfcc
ruamoko:
	{cl_menu,game}/Makefile.am:
		conform to the new qfcc library linking rules
	lib/Makefile.am:
		install the libs to ${prefix}/lib/ruamoko
qfcc:
	linker.[ch]:
		support path searching for -llib and make linker_add_lib search for
		libfoo.a for -lfoo in the paths, or just a single dir search for the
		libname otherwise.
	options.c:
		support -L libpath and setup the default include and lib paths
		also change most strdup calls to save_string
	qfcc.c:
		check for foo.a as well as -lfoo when deciding whether the file is
		an object file or lib file.
2002-11-01 18:05:12 +00:00
Bill Currie b3671874bf make dist fix 2002-10-30 15:54:17 +00:00
Bill Currie 912db0336e clean out the cmdlib crap from quakefs.c and nuke qfcc's last dependency
on cmdlib.h (and nuke qfcc's cmdlib.h itself:)
2002-10-30 02:31:29 +00:00
Bill Currie 567b905590 copyright block work 2002-10-22 14:53:18 +00:00
Bill Currie 7bb6dd7197 make chained structure assignments (mostly) work. found a bug in the
handling of pointer immediates which needs fixing before this will work in
general
2002-10-20 02:35:12 +00:00
Bill Currie 7542a2457f replace @argc and @argv with @args.count and @args.list. @args is of type
@va_list making it possible (though not yet: need to implement structure
copy) to pass ... params around.
2002-10-16 02:28:08 +00:00
Bill Currie 27effb5075 make struct_t and enum_t globally visible, re-do how enum info is stored
and make it possible to create a structure using a pre-existing type
2002-10-16 02:05:39 +00:00
Bill Currie 6af57049d5 make pointers work a bit better 2002-10-16 02:04:06 +00:00
Bill Currie a20bb946f6 type.[ch]:
provide a vector structure def so vector.[xyz] can be implemented
def.c:
	record the return address in get_temp to aid debugging
2002-10-08 22:35:37 +00:00
Bill Currie 412db7e27d "for example" is more appropriate than "that is" 2002-09-16 15:42:11 +00:00
Bill Currie 324b89696a create new_*_expr functions for all basic expression types except ex_poitner
and use them instead of new_expr and setting the fields each time. Serious
code cleanup :)
2002-09-11 16:21:26 +00:00
Bill Currie ec47e08e1c go back to using QFile, quakeio.h and quakefs.h 2002-08-27 07:16:28 +00:00
Bill Currie 5d51e0151e bah, forgot the header changes :P 2002-08-20 21:16:50 +00:00
Bill Currie b99a72e876 pr_obj.c:
call obj_find_message with super instead of class when doing a super
	lookup
client_menu.[ch]:
	use the InputLine object instead of directly using the api
InputLine.r:
	builint functions are = #0, not = 0 :P
function.[ch]:
	provide copy_params
method.[ch]
	provide copy_keywordargs
expr.c:
	call inc_users for the parm temp if it's a bind expression
	revers a copy of the selector when building the selector name so the
	selector doesn't get mangled
qc-parse.y:
	catch erronous func = const inintializers (should be func = #const)
2002-08-20 02:09:34 +00:00
Bill Currie a94bdb199f @sizeof (foo) should work now 2002-08-18 04:08:02 +00:00
Bill Currie 36ca7b55bd fix several problems caused by insufficient error checking and some double
Qclose calls
2002-08-15 18:53:03 +00:00
Bill Currie 53b257c918 preprocessising fixes, including detecting when to stop at the preprocessing
stage.
2002-08-13 22:02:07 +00:00
Bill Currie c86d7f2009 forgot this 2002-07-31 17:00:19 +00:00
Bill Currie c2a7564d55 implement -l, but -L isn't supported yet and the full lib name must be given 2002-07-21 07:12:17 +00:00
Bill Currie b0d568d85f local defs for debug info now work 2002-07-17 15:40:08 +00:00
Bill Currie 34da93f251 get line numbers working on link and fix a bug in the creation of aux
functions
2002-07-17 14:19:30 +00:00
Bill Currie 678a45cfe2 entity fields seem to work. I guess this means separate compilation is now
useful :)
2002-07-16 21:59:47 +00:00
Bill Currie b9a237b13d rename qfo_function_t to qfo_func_t and similar for other qfo *function* in
obj_file.[ch]
2002-07-15 21:37:52 +00:00
Bill Currie 06390e10e6 more relocs fixups. my little OO hello world progs works now :) 2002-07-14 03:41:13 +00:00
Bill Currie e550ad670a more linking fixes, including seting up relocations. not quite working yet 2002-07-13 06:09:03 +00:00
Bill Currie 24d473c386 more linking fixes 2002-07-12 06:17:24 +00:00
Bill Currie ce8f071b7c implement partial linking (doesn't work any better than full, though :P) 2002-07-12 04:50:31 +00:00
Bill Currie 0f5f68623f it's as broken as all-get-out, but object files can now be linked 2002-07-11 22:38:23 +00:00
Bill Currie a9899087d3 fix a bunch of silly bugs and get the linked output written (hangs, though) 2002-07-11 21:04:09 +00:00
Bill Currie 4d1dbc8cc1 re-write qfo writing from progs, make qfo creation easier, (mostly) finish
the linker. now for testing :)
2002-07-11 20:17:26 +00:00
Bill Currie 4b83c6592c fix RUP so it actually works. only works with powers of two now, though 2002-07-11 20:16:03 +00:00
Bill Currie bc5beea311 getting closer to being able to link 2002-07-11 17:06:15 +00:00
Bill Currie 2df43ef941 make data handling a little easier 2002-07-11 15:42:20 +00:00
Bill Currie 2cb6138f2b fix a silly segfault and make statement allocation saner 2002-07-08 20:31:59 +00:00
Bill Currie c1894db59f split the emit stuf out of expr.h into emit.h 2002-07-08 18:53:07 +00:00
Bill Currie 24e242ed35 move the type strings into their own string pool so the progs strings don't
get cluttered
2002-07-08 05:26:50 +00:00
Bill Currie 598edb26fd parse a type back from its encoding (some info will be lost) 2002-07-08 05:10:05 +00:00
Bill Currie c50923fa6f expr_t forward declaration fix 2002-07-08 05:07:18 +00:00
Bill Currie 4c8e157db2 nuke pr.statement_linenums as it was redundant and the info never used anyway 2002-07-08 03:05:44 +00:00
Bill Currie 8a402381e6 redo how progs strings are stored so multiple pools can exist 2002-07-05 20:02:10 +00:00
Bill Currie 576feacbf0 correct copyright year 2002-07-05 17:02:39 +00:00
Bill Currie 46bad45c7a move s_file, pr_source_line and pr_error_count into pr, make the linker
errors more meaningful, and fix a blasted string.h issue (damn old gcc;P)
2002-07-03 21:32:03 +00:00
Bill Currie 102eab0d84 linker.[ch]:
start working on the linker.
class.[ch]:
	redo class defs so the pointer works (needs relocs still)
obj_file.h:
	add prototype for read_obj_file, QFO_* data access macros and include
	pr_debug.h
type.[ch]:
	separate type system initialisation and recording of the standard types
	so find_type works properly in multiple compilation
def.c:
	don't mark static defs as initialized
expr.c:
	proper class pointer def stuff
immediate.c:
	clean out dead vars/code
obj_file.c:
	allocate space for the line info and bail if the file can't be opened.
qfcc.c:
	register the standard types for each compile pass and start linking the
	files
2002-07-03 20:16:32 +00:00
Bill Currie 66aa36b73f start implementing storage classes (extern, static, etc) 2002-06-28 17:59:32 +00:00
Bill Currie 8415db2d84 clear out the hash tables for compiling multiple object files 2002-06-28 16:00:01 +00:00
Bill Currie 001571e25a various memory saving tricks. seems to have not broken anything 2002-06-27 22:48:28 +00:00
Bill Currie be50d0e15a sometimes, gcc 2.95 can be such a pain 2002-06-27 15:13:43 +00:00
Ragnvald Maartmann-Moe IV c963f300e6 Add include for string.h. Needs to be done more portably, but I'm too tired. 2002-06-26 23:01:25 +00:00
Bill Currie 26dce371d9 clean up type allocation a little and also reloc allocation 2002-06-26 22:10:59 +00:00
Bill Currie 78a626066e get command line parsing working in an appropriate manner for separate
compilation
2002-06-25 21:36:10 +00:00
Bill Currie ecdb5a5cb4 allow the output file to be specified on the command line 2002-06-24 22:53:21 +00:00
Bill Currie 4d496a2cd6 more endianess corrections and read/write line numbers 2002-06-24 22:36:04 +00:00
Bill Currie f77bb44df3 load a qfo back into memory. next step is to figure out linking 2002-06-22 05:10:34 +00:00
Bill Currie 9fee1d07dd initial work on actually writing .qfo files. seems to work, but only test.qfo
is ever writtin :)
2002-06-21 20:46:56 +00:00
Bill Currie f8dee80355 add unions 2002-06-20 20:28:01 +00:00
Bill Currie f8e4215ba9 implement compiler "notices": potentially important information that isn't
really a warning (unless requested) and can be silenced.
2002-06-20 19:29:06 +00:00
Bill Currie f90f78990a ok, I'm happy with this now (bit fields anent' so great for portable file
formats:/)
2002-06-18 21:00:41 +00:00
Bill Currie 8263d3bd85 start working on the format for the object files 2002-06-17 05:29:20 +00:00
Bill Currie 37d3fecd5d remove an unneeded field 2002-06-17 05:28:43 +00:00
Bill Currie e774943f24 va.[ch]:
new va function: nva which returns a strduped buffer
expr.c options.c:
	use nva instead of strdup (va (...
struct.c type.c:
	make type encoding work properly for structs
2002-06-13 16:39:33 +00:00
Bill Currie 331df31f6a get the function number early so things don't get mixed up when new functions
get created while parsing a function
2002-06-11 06:54:32 +00:00
Bill Currie f7d8c2968f better global (and other space) def re-use 2002-06-10 23:14:32 +00:00
Bill Currie 1f67ea412d add a global flag to def_t to make checking easier
rename pr.globals to pr.near_data and add pr.far_data
2002-06-10 20:54:22 +00:00
Bill Currie 58782333a9 give scopes types (static, params, locals for now) 2002-06-09 05:19:13 +00:00
Bill Currie 1e57351be1 there, no more PR_* functions or pr_* files :) 2002-06-09 04:30:02 +00:00
Bill Currie 943c2eefb3 redo def allocation to come from configurable `spaces' (locals, globals, far
globals, etc).
2002-06-09 03:57:20 +00:00
Bill Currie 1cc91e9f10 add reloc.h 2002-06-08 21:12:14 +00:00
Bill Currie 541f7ed1b8 some def stuff shuffling 2002-06-07 21:17:51 +00:00
Bill Currie 0477b43f80 get rid of PR_GetArray: it's redundant 2002-06-07 18:14:39 +00:00
Bill Currie 00a54ad918 redo relocations 2002-06-07 17:29:30 +00:00
Bill Currie 8aa98c0d20 fix several silly mistakes 2002-06-06 21:51:47 +00:00
Bill Currie f31705380f call malloc a little less often 2002-06-05 21:13:29 +00:00
Bill Currie e17604f9c2 remove all arbitrary limits except for globals. they'll need a little more
work. Once they're done, it should take quite a big mod to crash qfcc due
to too many strings/statements/etc :)
2002-06-05 17:12:55 +00:00
Bill Currie c58a4c59b7 forgot to move the prototypes 2002-06-04 21:54:47 +00:00
Bill Currie 69605d0b19 even more cleanup 2002-06-04 21:23:39 +00:00
Bill Currie 06bddd3ee6 more cleanup 2002-06-04 18:44:03 +00:00
Bill Currie 77d244220b more qfcc cleanup. split out some functions and kill some dead code 2002-06-04 05:25:37 +00:00
Bill Currie 328b591aa0 some qfcc.c cleanup 2002-06-04 04:36:57 +00:00
Bill Currie 7b993f97d2 more cleanups 2002-06-01 05:30:16 +00:00
Bill Currie c4d0c574ee clean up qfcc.h a bit 2002-06-01 05:06:19 +00:00
Bill Currie 8f2d1fa2d9 more cmdlib cleanup 2002-06-01 04:41:25 +00:00
Bill Currie b3adadc347 @this will provide an id field named ".this" (ie, .id .this (if .this would
parse in the first place:))
also kill build_type now that a field_type function is available in type.c
2002-05-31 16:58:42 +00:00
Bill Currie 6fbf011073 rpm building fixes 2002-05-27 20:28:10 +00:00
Bill Currie 34ec521198 vararg functions can now be imlemented in qc using @argc (number of params
passed through ...) and @argv (array of vectors, one for each ... param)
2002-05-22 20:43:29 +00:00
Bill Currie 3967f5cf95 type.h:
*type_method to type_Method
emit.c:
	support casting between pointers
expr.c:
	support casting between pointers
method.c:
	correct the type for _cmd
	type_method to type_Method.aux_type
qc-lex.l:
	Method type is a poniter to a method
qc-parse.y:
	support , args to messages (not fully implemented yet)
type.c:
	*type_method to type_Method and make type_Method a pointer to a method
2002-05-22 05:03:36 +00:00
Bill Currie a1fe5efd27 initialize class_Class.super_class iff @keywords are seen (ie, compiling
obj code).
2002-05-22 01:39:07 +00:00
Bill Currie 9f06f89d57 write out the module data needed for the obj runtime 2002-05-21 21:28:40 +00:00
Bill Currie e11e2f3718 SELF -> @self (looks better (IMO:)) and make sure the .self def gets
generatoed and used when @self is seen
2002-05-18 00:30:14 +00:00
Bill Currie 451bfbddfe fix a snafu with current_class and get ivar access working properly (cross
fingers:)
2002-05-17 19:35:26 +00:00
Bill Currie b1d1159ae2 allow methods to be builtins 2002-05-17 18:35:54 +00:00
Bill Currie ef9f9cda2f pr_obj.h:
define the class info stuff
expr.h pr_def.c:
	fix a FIXME
class.c expr.c type.c:
	make id ev_pointer.ev_object rather than ev_pointer.ev_class
2002-05-17 17:37:44 +00:00
Bill Currie 6965642030 get ivars working better (need to get rid of self.) and [super ...] now
works.
2002-05-17 06:20:27 +00:00
Bill Currie 7cdbef2b11 make class_def return a correct def 2002-05-16 22:33:11 +00:00
Bill Currie 779174cb33 get object pointer assignmets working and some static typing as well 2002-05-16 20:20:23 +00:00
Bill Currie 73f4cb4c03 it seems object info emition works (needs more testing) 2002-05-15 23:24:19 +00:00
Bill Currie 308fa78fc6 lots of obj work 2002-05-15 19:10:23 +00:00
Bill Currie 9b516ff84f mild namespace cleanup 2002-05-11 03:37:36 +00:00
Bill Currie 73e6cf062c implement type encoding 2002-05-10 23:19:57 +00:00
Bill Currie 2cd716176a more progress 2002-05-10 00:00:23 +00:00
Bill Currie f2b8dc7e7e more progress 2002-05-09 20:12:28 +00:00
Bill Currie 55e54bd9f9 move the type and def externs to type.h 2002-05-09 17:11:14 +00:00
Bill Currie 961d84e569 clean up of qfcc.h and shuffle around the predefined types 2002-05-09 06:34:48 +00:00
Bill Currie 1b875c8b06 work on getting obj expressions going 2002-05-08 23:12:49 +00:00
Bill Currie 7f47447492 getting closer to emiting ObjQC code 2002-05-08 21:24:24 +00:00
Bill Currie de86019d4b reverse the param order before building the function type and type check
varargs functions with specified params.
2002-05-08 17:33:28 +00:00
Bill Currie b226d24b52 rework the param parsing to make selectors easier to handle 2002-05-08 05:15:19 +00:00
Bill Currie 54fb180fad expr.h:
__attribute__((const)) has rather nasty results when it's not true
expr.c:
	fix up some mis-timed ex_error checks
2002-05-02 05:03:57 +00:00
Bill Currie 05788e55e5 don't generate useless expression warnings when that expression was caused
by an error
2002-05-01 22:08:59 +00:00
Bill Currie a9f3814c86 forgot to remove scope.h 2002-05-01 21:48:23 +00:00
Bill Currie 962dc8e46e rewrite the type and def parsing to allow more flexible types 2002-05-01 21:35:39 +00:00
Bill Currie 03ab75704f -p N or --strip-path N will strip up to N leading path elements for a
source file's path.
2002-04-10 19:52:48 +00:00
Bill Currie 80723fdec7 o don't ice when ex_name or ex_nil expressions show up in emit_expr.
instead, treat as useless epxression.
 o  mark rvalue expressions as such
 o  increment the users of a managed temp def when in an rvalue expr
2002-02-21 20:34:04 +00:00
Bill Currie d1fcfd1939 Implement --traditional so qfcc can be a nicer qcc. This disables several
keywords (quaternion integer function for break continue switch case default
NIL struct enum typedef) and converts some errors to warnings (assignment to
constants, insufficient function arguments, return; from non-void function,
anal function `pointer' type checks)
2002-02-18 06:23:59 +00:00
Bill Currie 49ef391664 make dist fix
----------------------------------------------------------------------
2002-02-16 05:15:24 +00:00
Bill Currie b4000200e3 move the getopt files from qfcc/source to libs/util, link qw-master against
libQFutil and enable the option parsting in qw-master for win32.
2002-02-12 17:44:41 +00:00
Bill Currie cb0db8b8d1 disable debug putout and allow the cpp command line to be specified. 2002-02-05 19:35:45 +00:00
Bill Currie 6a393d175e implement typedef 2002-01-23 20:50:25 +00:00
Bill Currie 3f958ae29b more make dist fixes 2002-01-22 18:04:03 +00:00
Bill Currie ecd539cbd3 some make dist fixes 2002-01-22 17:17:18 +00:00
Bill Currie f1f2dd713d generate progdefs.h only for v6only
generate files.dat only if -F or --files is given on the command line
2002-01-21 23:30:54 +00:00
Bill Currie f2d097c013 resolve the case value before checking its type 2002-01-21 19:18:41 +00:00
Bill Currie 64c5983742 enum support 2002-01-21 19:03:29 +00:00
Bill Currie cef918df83 get array initialisation worrking 2002-01-18 08:26:37 +00:00
Bill Currie d69762facd integer() and float() casts seem to work 2002-01-17 19:32:04 +00:00
Bill Currie 7227ab4363 qfcc.c:
add -P,--progs-src so you can specify the name of the progs.src file
rest:
	add/use print_type
2002-01-17 08:19:53 +00:00
Jeff Teunissen 9f6dcec9dd --save-temps support for qfcc. It'll leave files with the same filenames
they're generated from, with the exception that they will have an
extension of .p. Obviously, depends on cpp support.
2002-01-05 19:13:20 +00:00
Bill Currie 718a64343b more old-code cleanup. move PR_LexString into make_string 2002-01-04 18:27:01 +00:00
Forest Hale 184ff4a216 made qfcc compile again, by renaming com_token to qfcc_com_token so it does not conflict with QFutil 2002-01-04 11:12:52 +00:00
Bill Currie 112f74a357 make integer constant division warnings optional 2001-12-12 22:00:42 +00:00
Bill Currie 6d65fe853d spontaneous temp defs need to have their users incremented when an
assignment is part of a sub expression
2001-12-12 21:29:04 +00:00
Bill Currie cc34e5954f lots of work on better array/pointer/struct handline. doesn't quite work yet 2001-12-12 08:39:47 +00:00
Bill Currie 835468bcfb beginnings of breaking out the type code 2001-12-11 19:58:12 +00:00
Bill Currie e976211faf header block fixes 2001-12-08 20:40:50 +00:00
Bill Currie a184199146 get arrays of structures working 2001-12-08 17:36:58 +00:00
Bill Currie b03a1bee42 ok, structures seem to generate correct code now 2001-12-08 08:19:48 +00:00
Bill Currie 3293c5e85f beginnings of structure code. committed because cvs diff doesn't work on
new files
2001-12-08 00:09:11 +00:00
Bill Currie 1767ad435f use the new immediate indeces to make small array indeces not use a global 2001-12-07 20:10:30 +00:00
Bill Currie 40d47e91cb win32 portability fixes 2001-11-15 03:54:35 +00:00
Bill Currie 7d9266a3f0 beginnings of array support. no array initialization yet and foo[i] = bar is
broken.
2001-11-15 00:46:36 +00:00
Bill Currie ad5deea582 missed this in the cleanup 2001-11-13 23:14:59 +00:00
Bill Currie 4291f9c711 create new_bind_expr and more tweeks to temp def ref counting 2001-11-13 18:49:27 +00:00
Bill Currie f2f8e096f3 qfcc.h:
o	add a "freed" marker to def_t to prevent double freeing of
		temp def offsets
emit.c:
	o	break out the bind code into emit_bind_expr (doesn't /really/
		emit code, but still:)
	o	make bind work with disparate types (forces def_t->freed 1)
pr_def.c:
	o	mark array pointers as initialized and constant.
	o	don't free the offset for already freed temp defs
pr_imm.c
	o	fix a bug in uinteger support
	o	support disparate types for immediates
switch:
	o	fix a bug where gt.i was being used instead of gt.ui
	o	remove some debug code
2001-11-13 18:11:19 +00:00
Bill Currie 07b59d2f07 pr_comp.h:
o	add OP_JUMPB
	o	OP_JUMPB renumberd some opcodes, so up PROG_VERSION
pr_edict.c:
	o	make the version error reporting more informative
pr_exec.c:
	o	implement OP_JUMPB (goto *(ptr + index))
pr_opcode.c: (libs/gamecode/engine)
	o	add OP_JUMPB to the table
expr.h:
	o	ex_uinteger support
	o	some const correctness
	o	prototype new_label_expr
qfcc.h:
	o	uinteger ussport
	o	add pointers for op_jump and op_jumpb
	o	prototype PR_GetArray
emit.c:
	o	general uinteger support
	o	new reference/reloc type 3: absolute statement address
	o	jumpb support (binary goto)
expr.c:
	o	uinteger support
	o	break the label name creation out of new_label_expr into
		new_label_name
	o	some const correctness
pr_def.c:
	o	add PR_GetArray to allocate an array in global space
	o	factor out some code common to PR_GetDef and PR_GetArray that would
		otherwise be duplicated
pr_imm.c:
	o	some const correctness
	o	uinteger support
pr_lex.c:
	o	uinteger support
pr_opcode.c: (tools/qfcc/source)
	o	support jump and jumpb
switch.c:
	o	rewrite the binary search code to support ranges.
2001-11-13 08:58:54 +00:00
Bill Currie d27cd9cc21 s/type_size/pr_type_size/
remove the redundant type_size from qfcc
2001-11-12 23:56:46 +00:00
Bill Currie 928d343295 pr_comp.h:
o	add ev_uniteger to the types enum
	o	add opcodes for ifbe, ifb, ifae, ifa, jump, lt.ui, gt.ui, le.ui, ge.ui
progs.h:
	o	add uinteger accessors
pr_exec.c:
	o	implement ifbe, ifb, ifae, ifa, jump, lt.ui, gt.ui, le.ui, ge.ui
pr_opcode.c:
	o	add opcodes for ifbe, ifb, ifae, ifa, jump, lt.ui, gt.ui, le.ui, ge.ui
expr.h:
	o	prototype inc_users
qfcc.h:
	o	add externs for op_ifbe, op_ifb, op_ifae and op_ifa
emit.c:
	o	don't bother emiting an assignment to a temp def that's only used once
		(ie, it's never read, only written to)
	o	support the new if* instructions
expr.c:
	o	support the new if* insructions
	o	dectect expression loops in append_expr
	o	support unsigned integers
	o	re-work temp def usage counting
pr_def.c
	o	debugging for temp def usage counts
pr_opcode.c:
	o	support the new if* instructions
qc-parse.y:
	o	provide defines for IFBE IFB IFAE IFA
switch.c:
	o	do binary searches for strings, floats and ints if there are more than
		8 cases in a switch. Strings need more testing.
2001-11-09 00:58:16 +00:00
Bill Currie 09f19fd9c9 remove some redundant data 2001-10-28 04:42:44 +00:00
Bill Currie 3f45a8305c *taniwha inflicts more carnage on extern 2001-10-28 04:29:30 +00:00
Jeff Teunissen 274ff6e59a Add getopt.h to the dist, just in case. 2001-10-26 23:54:20 +00:00
Bill Currie 5eba9f155e clean up some duplicate symbols 2001-10-26 17:49:23 +00:00
Bill Currie d8e6bf9cb6 fix the verbosity levels to what they were
--no-cpp is now cpp or no-cpp in code
add cpp to code_options_t
2001-10-26 16:04:38 +00:00
Jeff Teunissen 89c7e0df1a qfcc: getopt support. Yes, it exists, and it works, and it's fun! :) 2001-10-26 08:14:05 +00:00
Jeff Teunissen 581411e9e2 qfcc: Preparation for getopt. 2001-10-26 06:43:56 +00:00
Timothy C. McGrath 04e4da654a Changes taniwha did to make qfcc work with statically compiled libs.
This is what was bugging me all night long with qfcc ><;;

Tim McGrath (Misty-chan)
2001-10-26 02:32:40 +00:00
Bill Currie f8a41cb1bc completely nuke the concept of "priority" from opcodes and use get_op_string
in emit_sub_expr instead of a redundant switch.
2001-10-25 17:48:35 +00:00
Bill Currie f029687ff0 switch statement. could do with lots of improvements, but this should be a
good start.
2001-10-25 06:41:52 +00:00
Bill Currie 09405469f6 throw PR_BeginCompilation's arguments out the nearest airlock 2001-10-24 22:53:27 +00:00
Bill Currie 6553c81a41 proper scoping for QC ala C. 2001-10-24 06:39:49 +00:00
Bill Currie 5ca785e7e8 uninitialized variable detection. not perfect (lots of false negatives, but
fewer than before;) but prozac isn't giving any false positives.
2001-10-18 20:05:26 +00:00
Bill Currie 96e4e1a232 the beginning of unititialized var detection. first victim: functions.
--undefined-function-warning is now --no-undefined-function-warning and
the default is to detect called but undefined functions.
2001-10-18 17:41:22 +00:00
Bill Currie 952f029e6d rename def_t.initialized to def_t.constant 2001-10-18 17:15:05 +00:00
Bill Currie 79ac85b54f type checking now works much better and there is now a NIL builtin constant
which can be assigned (/only/) to anything.
2001-10-17 07:45:37 +00:00
Ragnvald Maartmann-Moe IV 2080ae7db6 Fix stamp ignorance. 2001-10-05 19:42:17 +00:00
Bill Currie dcb51dc586 expr.h:
get_type and extract_type prototypes and add extern for type_names
emit.c:
	use extract_type instead of get_type
expr.c:
	get_type now returns the type pointer rather than the qc type enum.
	extract_type uses get_type to return the qc type enum.
	make type_names global
	use get_type instead of ex_expr/ex_def to cover more cases
	clean up function call/return processing as a result of get_type
pr_opcode.c:
	use opcode_priority_type_table_ab when var_c is null and a minor
	cleanup in PR_Opcode_Find
2001-10-02 18:55:52 +00:00
Bill Currie 7aec6e253a unused local variable detection 2001-09-22 23:41:47 +00:00
Bill Currie ea451ab02d Remove unnecessary temps from function return values. This has one
*/CRITICAL/* implication: DO NOT /EVER/ RELY ON EVALUATION ORDER. This
isn't /really/ that bad: evaluation order will be consistent for similar
expressions, but for (eg) foo() + bar()*2, bar will be called first.
2001-08-24 21:47:52 +00:00
Bill Currie 4c48851096 fix a buffer overflow in new_label_expr
use reference counting for temp defs and call PR_FreeTempDefs at the end
of emit_sub_expr as well as emit_expr.
fix a (relatively harmless) bug in type processesing of foo.bar =
2001-08-22 21:55:01 +00:00
Bill Currie cf4ca286f0 implement pre and post increment operators (++ and --) 2001-08-20 06:22:28 +00:00
Bill Currie 248de6858d hopefully take care of freebsd 2001-08-11 21:46:02 +00:00
Bill Currie c2d3d8f3ab temp def expressions and ?:
seems to work :)
2001-08-11 21:15:24 +00:00
Adam Olsen 6414897dae got a few new operators for qc :)
<< >> % which all act like their C counterparts
+= -= *= /= &= ^= |= <<= >>= %= which just expand into the obvious,
also like the C versions.
2001-08-10 16:17:00 +00:00
Adam Olsen c218ede288 Add support for checkfunction, which is a builtin that searches for
another builtin by name, and returns it.

Soon I'll change all our new builtins to by allocated dynamically, as
well as changing the number checkfunction uses, and happily break
everything that uses them :D
2001-08-04 09:11:50 +00:00
Bill Currie 28b1598e7e break the emit_* functions out of expr.c into emit.c 2001-07-26 05:15:34 +00:00
Bill Currie 620063628c typecheck values for [frame, think] on thost functions and fix some misplaced
immediate defs
2001-07-24 23:53:35 +00:00
Bill Currie 9ad075b02e make if/while/for use test_expr, make test_expr fix the new exp line/file,
fix some string const issues
2001-07-24 22:30:31 +00:00
Bill Currie b8874cab1c function return checking 2001-07-23 02:27:46 +00:00
Bill Currie c248372e20 Initial integer type support. qfcc /is/ partially broken when it comes to
integer constants and float function args/return values.

pr_comp.h:
	o  add the integer opcodes to pr_opcode_e
pr_edict.c:
	o  add "quaternion" and "integer" to type_name[]
	o  support quatnernion and integers types when printing values
	o  support the integer opcodes when bounds checking
pr_exec.c
	o  enable the integer opcodes
pr_opcode:
	o  add the integer opcodes to the opcode table
	o  logical operators all result in an integer rather than a value
expr.h:
	o  rename int_val to integer_val
qfcc.h:
	o  kill another magic number
expr.c:
	o  move the opcode to string conversion out of type_mismatch and into
	   get_op_string
	o  rename int_val to integer_val
	o  general integer type support.
	o  generate an internal comipiler error for null opcodes rather than
	   segging.
pr_imm.c:
	o  rename int_val to integer_val
	o  support integer constants, converting to float when needed.
pr_lex.c:
	o  magic number death and support quaternions and integers in type_size[]
qc-lex.l
	o  rename int_val to integer_val
	o  support quaternion and integer type keywords
qc-parse.y:
	o  rename int_val to integer_val
	o  use binary_expr instead of new_binary_expr for local initialized
	   variables
builtins.c:
	o  rename int_val to integer_val
	o  fix most (all?) of the INT related FIXMEs
defs.qc:
	o  use integer instead of float where it makes sense
main.c:
	o  read_result is now integer rather than float
main.qc:
	o  float -> integer where appropriate
	o  new test for int const to float arg
2001-07-23 01:31:22 +00:00
Bill Currie 55ac55c7ac rename ev_int and ex_int to ev_integer and ex_integer. create type_integer
and def_integer (do I need that?), clean up and or coment on XXX and FIXME
2001-07-22 06:59:12 +00:00
Bill Currie 10ad8bebbd Make files.dat actually useful. I really dislike the hardcoding, but it /is/
useful. Also, fix a bug in PrecacheModel where it was checking MAX_SOUNDS and
numsounds instead of models.
2001-07-18 17:23:42 +00:00
Bill Currie 098305d649 fix (expr_type1 && expr_type2). this involed type completing expressions :/ 2001-07-18 06:37:14 +00:00
Bill Currie 2818d720c2 move the full info opcocde table from qfcc to gamecode (<KURGON>There can be
only one!</KURGON>:) and use the table in PR_PrintStatement. This means that
qfcc now links against libQFgamecode as well as libQFutil
2001-07-14 02:34:16 +00:00
Bill Currie ae9ee57666 change the type of opcode->type to etype_t, clean up the resulting mess, and
rename all of the opcodes to (eg) mul.f instead of MUL_F
2001-07-14 01:52:05 +00:00
Bill Currie 64e50e1ebd Basic debug info generation, just line numbers and local defs for each
function.
2001-07-14 01:15:40 +00:00
Bill Currie eae97539c2 beginnings of debug info for progs 2001-07-13 06:08:50 +00:00
Bill Currie b1f264b203 using qfpreqcc is now vewy vewy qwiet ('e's 'unting wabbits) 2001-07-03 21:17:02 +00:00
Bill Currie 05db0ed9d0 more format attributes 2001-07-03 20:56:01 +00:00
Bill Currie 1edf1e0b39 format checking for error and warning + needed fixes
try to give name of object when calling non-function
2001-07-03 20:53:49 +00:00
Bill Currie f2bb7ace41 add an option (--warn=error) to treat warnings as errors 2001-06-28 23:15:10 +00:00
Bill Currie 6dfee9968b /much/ better error handling 2001-06-28 21:26:40 +00:00
Bill Currie 0271afbb10 warn about the dangers of (!foo & bar) 2001-06-28 15:20:31 +00:00
Bill Currie 50ae388caa initialisations now seem to work, including cows (mooOOoo:) 2001-06-26 22:43:28 +00:00
Bill Currie d783a024b3 record an expression's line number and file and sort of handle state
expressions
2001-06-26 16:23:21 +00:00
Bill Currie c1753046a9 start on actually generating code. doesn't work yet (getting a weird type
redeclaration error and not all expressions are handled yet).
2001-06-26 07:21:20 +00:00
Bill Currie e99796c4cf new expression type: ex_block. forms a linked list of expressions for fast
appending and ease of manipulation.
2001-06-26 03:33:01 +00:00