Commit graph

69 commits

Author SHA1 Message Date
Bill Currie
cd8035319d PR_GetString should have been returning const char *. now does 2003-11-21 21:34:53 +00:00
Bill Currie
5f5662a063 PF_VarString return a plain char * and make it easier to add "at load" init
functions
2003-11-20 07:46:56 +00:00
Bill Currie
84ea81a770 fix E_POINTER and E_FUNCTION 2003-09-12 23:12:21 +00:00
Bill Currie
b50d283b28 make sel_get_uid and class_get_instance_method work 2003-08-23 22:16:42 +00:00
Bill Currie
0806fc33dd debugging improvements. opcodes now sport an optional format specifier for
printing their args (default is "%Ga, %Gb, %gc") and PR_ValueString will
try to print what a pointer points to
2003-07-30 22:24:16 +00:00
Bill Currie
cb6bf2e2ae minor house-keeping 2003-07-15 16:34:43 +00:00
Bill Currie
f7d806e8d5 can now handle > vector sized parameters 2003-04-22 20:11:16 +00:00
Bill Currie
e732cf591d remove all references to OFS_* from the C code. only the macros in progs.h
use them now
2003-04-22 18:20:15 +00:00
Bill Currie
eb099ae0d3 make qf gcc 3.3 clean 2003-04-17 00:01:48 +00:00
Bill Currie
71a60717d9 make pr_source_path a ; separated list of dirs and make it controllable in
qfprogs
2003-03-12 22:31:44 +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
836c469737 sys.[ch]:
handle SIGFPE and allow the registered signal handler to do recovery
	rather than bail
progs.h, pr_exec.c, pr_load.c:
	if pr_faultchecks is 1 (0 is default), handle division by 0 gracefully
	by loading the maximum representable number into the answer
	Closes: #58
the rest:
	kill the SIGFPE stuff
2002-11-13 19:26:44 +00:00
Bill Currie
aa36b85ba6 add PR_StringValid and PR_EdictValid to check the validity of progs string
and entity values without crashing.
2002-10-29 05:07:10 +00:00
Bill Currie
80e85226b9 pr_xstatement now always reflects the currently executing statement making
debugging easier in the event of a segfault
2002-10-22 15:07:54 +00:00
Bill Currie
1f0b6e84a5 change pr_obj_msgSend and pr_obj_msgSend_super so they either call builtin
methods directly or setup the progs struct for a normal function call to
call a progs method rather than recursively calling PR_ExecuteProgram. This
will reduce method call overhead (both cpu and stack usage), fix the loss
of tracing when calling a method and makes it possible to break out of the
progs engine simply if threaded progs are ever implemented.
2002-10-15 18:53:33 +00:00
Bill Currie
eec3b7d8bc fix missed header commit 2002-09-14 07:51:53 +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
de22355371 use P_* for params and R_* for return values in builtins code 2002-07-24 21:42:33 +00:00
Bill Currie
0b1d1ade73 qfprogs can now read the debug data 2002-06-11 17:24:37 +00:00
Bill Currie
ef57625355 move pr_type_t 2002-06-07 20:56:54 +00:00
Bill Currie
55fcead77c look for the .this field but don't complain if not found 2002-05-31 17:21:38 +00:00
Bill Currie
a7b5b56a2c implement Z_Realloc, PR_Zone_Realloc and pr_obj_realloc 2002-05-29 20:58:53 +00:00
Bill Currie
33e055209e Semi-major (more than minor:) progs convenience macro cleanup. There will
be more to come.
2002-05-22 22:35:37 +00:00
Bill Currie
dc3f106faf define G_POINTER convenince macro. null progs pointers will be null in C
redefine G_STRUCT to use G_POINTER
2002-05-22 21:50:24 +00:00
Bill Currie
9820c5d45a start working in the obj runtime. any and all functions named ".ctor" will
be run in the order found.
2002-05-21 21:29:49 +00:00
Bill Currie
c76f7d88ce fix an API snafu (oops:) 2002-01-30 08:09:53 +00:00
Bill Currie
c66bc5a6eb whitespace 2002-01-30 06:29:32 +00:00
Bill Currie
8561dfa93a basic resource management system for the VM 2002-01-30 06:21:20 +00:00
Bill Currie
0ea713eda4 redo the progs loader to allocate all the memory needed for progs in one
shot, allowing for caller specified alloc and edicts and zone memory sizes.
(progs + edicts + zone).
2002-01-29 20:53:44 +00:00
Bill Currie
21b6e68a8c break out the non-edict code into sensible locations 2002-01-28 17:15:36 +00:00
Bill Currie
68637eea9e start implementing dynamic memory for progs 2002-01-23 22:35:48 +00:00
Bill Currie
14ac3acc17 add a builtin (gametype) for detecting the, well, game type (ie, netquake
or quakeworld) which just returns the apprproate string. the single player
menu is now acessable in nq but not qw :)
2002-01-20 03:09:03 +00:00
Bill Currie
6af9a5d8e6 make the builtins an array of pointers so the hash table doesn't get royally
screwed up
2002-01-19 03:31:51 +00:00
Bill Currie
ac71d101d2 menu code now gets initialized (menu_init in the progs). 2002-01-18 22:02:59 +00:00
Bill Currie
bb96a5b736 first use of client side QuakeC :) (and having more than one progs instance
seems to work, too). The menu code gets loaded, but is currently otherwise
unused as of yet.
2002-01-18 19:19:33 +00:00
Bill Currie
3dafbebf10 fix up #0 builtin functions at runtime. not done automaticly (need to call
PR_RelocateBuiltins) and fix a bug with profiling and unlimited execution
counts
2001-12-14 08:15:04 +00:00
Bill Currie
b03a1bee42 ok, structures seem to generate correct code now 2001-12-08 08:19:48 +00:00
Bill Currie
12a0a10d33 more alpha portability fixes 2001-11-29 19:35:25 +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
5bf5278c2b pr_comp.h:
- new opcodes for pointers
progs.h:
	- prototype PR_Check_Opcodes
pr_edict.c:
	- move the static bounds checking to PR_Check_Opcodes in pr_opcode.c
pr_exec.c:
	- vector instruction cleanup
	- temporarily nuke bounds checking from storep.*
	- move base of address results from pr->edicts to pr->pr_globals
	- implement new pointer related instructions
	- nuke proposed global pointer instructions (not flexible enough)
pr_opcode.c:
	- add new pointer instuctions
	- re-implement static bounds/invalid opcode checking. no more multiple
	  case statements to keep track of.
2001-11-02 22:41:11 +00:00
Bill Currie
78a3e398d5 * taniwha gets medieval on extern 2001-10-28 04:23:37 +00:00
Bill Currie
3a366f4f7e break out the backtrace code from PR_RunError into PR_DumpState and use
PR_DumpState instead of PR_RunError in seg_fault_handler so we get both a
progs trace /and/ a core file (ulimit allowing)
2001-10-08 03:46:44 +00:00
Adam Olsen
07b0d91900 - add a NUM_FOR_BAD_EDICT function, which doesn't care if it's a bad
value
- switch some prints over NUM_FOR_BAD_EDICT
- change NUM_FOR_EDICT to call PR_RunError on error, instead of
  PR_Error.  That was it prints out a backtrace.

(I did it in reverse order ;)
2001-09-23 01:29:52 +00:00
Bill Currie
3edd4550d2 heh, nor do we need PROGHEADER_CRC 2001-08-27 21:13:00 +00:00
Adam Olsen
36786400ad Doh, need this header change to compile. 2001-08-26 10:13:03 +00:00
Adam Olsen
17ba7ef92f - move alot of the builtins to libQFgamecode_builtins
- move the init into qw and nq
2001-08-22 03:24:25 +00:00
Adam Olsen
1314c89b6c - add libs/gamecode/builtins subdir, with libQFgamecode_builtins.la
- add .gitignore files
- fix building :)
2001-08-21 22:34:20 +00:00
Bill Currie
07a09e0812 statement printing now infers the type of a def from the instruction where
possible, thus allowing anonymous defs to print their contents.
2001-08-13 23:49:04 +00:00
Bill Currie
2a6830d2d8 revised dynamic string handling. allows for `bounds checking' 2001-08-13 20:01:37 +00:00