Commit Graph

373 Commits

Author SHA1 Message Date
Bill Currie a9a169e820 make the more relevant parts of qfs available to progs. bi_file.c will
eventually be moving into bi_qfs.c
2003-02-28 05:35:27 +00:00
Bill Currie 93834f2694 better source line tracking 2003-02-24 16:01:52 +00:00
Bill Currie 38d5c8c41a better line search algorithm (not perfect yet, though) 2003-02-24 03:34:11 +00:00
Bill Currie 5c3892cbb2 make sure the string is valid before attempting to print it 2003-02-24 03:07:26 +00:00
Bill Currie 72e5221f06 minor debugging tweaks 2003-02-21 15:09:02 +00:00
Bill Currie 152538bf90 zap the Cmd_Return stuff as that's dead and burried 2003-02-20 20:33:03 +00:00
Bill Currie b6a3bc8d1c try to give line numbers in the traceback 2003-02-19 06:26:49 +00:00
Bill Currie 851d203916 work towards a more secure qfs 2003-02-14 22:36:10 +00:00
Bill Currie 6a687f5e45 rename all the globals in quakefs.[ch] to be QFS_* or qfs_* 2003-02-14 19:46:07 +00:00
Bill Currie fd7636137d implement a proper (and optionally secure) QFile interace for ruamoko. 2003-02-14 18:17:17 +00:00
Bill Currie 8a9cd78072 fix up a couple of error cases (and catch them!) 2003-01-29 20:32:44 +00:00
Bill Currie 1342533234 make the PF_Find search field error more informative 2003-01-20 21:28:36 +00:00
Bill Currie 761a7546dd re-arrange things so __attribute__ and __builtin_expect are properly
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +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 d78f34e795 fix some spelling errors 2002-11-20 21:21:22 +00:00
Bill Currie 06df342655 fix a stray ; 2002-11-15 14:56:57 +00:00
Bill Currie d1199f23da get categories working in the runtime :) 2002-11-14 20:42:48 +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
Brian Koropoff b40400d59c Moved GIB into libs/gib and made util no longer depend on it. Cleaned up
some cruft from a previous incarnation of GIB.
2002-11-09 07:13:52 +00:00
Bill Currie d46b37f940 use COM_CompressPath 2002-11-08 03:35:22 +00:00
Bill Currie ec0273e3dc do a pre and post pass for maps/mapname.cfg and use maps_default.cfg if
maps/mapname.cfg doesn't exist.
2002-11-08 02:43:04 +00:00
Bill Currie ca4b3acd6c big protototype cleanup. Now, except for a few cases, all non-static
prototypes are in headers files.
2002-11-05 19:12:51 +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 012cc58eb4 move the debug related stuff from pr_exec.c to pr_debug.c 2002-10-23 20:42:02 +00:00
Bill Currie 3a3da6a1c4 nuke PR_InitEdicts as it's redundant and only used in the tools due to
forgetting to remove it
2002-10-23 15:55:38 +00:00
Bill Currie a4a5bb2d72 split out the parsing code 2002-10-23 04:57:08 +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 6203d450eb resture pr_xstatement on return from PR_ExecuteProgram so recursive calls
don't mangle things with the new semantics of builtin calls
2002-10-22 02:51:57 +00:00
Bill Currie aad04efe25 move the correct amount of bytes (I keep forgetting the * 4 :P) 2002-10-21 16:38:45 +00:00
Bill Currie 4810046f39 copy the correct number of bytes 2002-10-17 19:33:06 +00:00
Bill Currie 4da662eb47 implement pr_obj_msg_sendv 2002-10-16 22:17:26 +00:00
Bill Currie be4b8096d4 two new instructions: move and movep: basicly memmove. qfcc support coming
as soon as I get it working :)
2002-10-16 06:44:41 +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
Jeff Teunissen 575689296a Tidy up progs dump output, and do some whitespace. 2002-10-08 19:46:42 +00:00
Bill Currie eec3b7d8bc fix missed header commit 2002-09-14 07:51:53 +00:00
Jeff Teunissen e551c1f22b New dump format for progs. It looks like assembly code. setting pr_debug to 2
or higher adds more debug information.
2002-09-14 07:00:40 +00:00
Bill Currie bf53f43e13 make PR_break do a backtrace instead of crashing the server 2002-09-07 06:48:15 +00:00
Bill Currie 246ab0009c Change Con_ClearTyping to take a save flag that will cause the current line
(if not empty) to be saved in the inputline history.

Clear the input (but put in history) of say or say team when pressing escape.

Don't say or say_team if the text is empty.
2002-08-28 16:02:43 +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 8c82a54ac7 fix a 0 byte allocation 2002-08-26 00:30:31 +00:00
Bill Currie 09d89a3214 move bi_keys from csqc to pr_keys in targets allowing the server to link
with libQFcsqc (need a new name:P)
2002-08-21 02:25:51 +00:00
Bill Currie 5009213564 Move the signal handling code from video/targets/* to sys.c (I'm leaving
the SDL target files for Despair since he's working on the currently). Also
make progs segfault handling much more robust (and general: sigill etc too:)
2002-08-20 23:04:57 +00:00
Bill Currie d328e18de2 implement the "new" inputline api making it possible to pull the Draw_*
functions out of bi_inputline.c. now somebody can be insane enough to
implement a qc controled console for the server ;) (more importantly, one
step closer to being able to have the server link with libQFcsqc (hah!))
2002-08-20 21:19:53 +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 2b1fd8e8c0 fix the menu keybinding not working bug 2002-08-19 02:48:38 +00:00
Bill Currie c1c6c05cf5 pr_obj.c:
delay class fixups so order doesn't matter
class.c:
	write out the class and category diffs properly
2002-08-16 22:53:37 +00:00
Bill Currie c1f5659977 bi_inputline.c:
add InputLine_SetUserData
pr_resolve.c:
	report the correct missing symbol (self instead of time)
2002-08-16 21:52:37 +00:00
Bill Currie 8adad57941 Make the cbuf api use a supplied cbuf rather than allocating its own. Kills
a FIXME and (Closes: #32)
2002-08-14 18:45:09 +00:00
Brian Koropoff cf48363c6e More of GIB done: builtins, functions, various cleanups, math, etc. 2002-08-03 06:04:00 +00:00
Bill Currie 2ce0f2ded2 we now require modern autoconf (2.52+), automake (1.6+) and libtool (1.4+).
This gives us a bunch more flexibility. plugins no longer have the "lib"
prefix or the version suffix, they're now installed in
$fs_sharepath/QFplugins,, builds should take much less time (in general,
only one of pic or non-pic versions are build), bins and libs can have
individual CFLAGS
2002-08-01 19:49:10 +00:00
Brian Koropoff 439f9838d3 Whoops, missed some stuff that needed to be in idparse.h 2002-07-31 22:13:15 +00:00
Brian Koropoff a93b221272 Split off the old console parser into idparse.[ch] and prepared the cbuf
struct and support functions for GIB mark III.

Oh yeah, I'm back.
2002-07-31 22:03:53 +00:00
Bill Currie ad6e025a91 take cmd.[ch] back to basics. the gib code is temporarily gone pending
renovations. cmd_source handling is a little hacky in nq, but it's working.
2002-07-31 05:19:03 +00:00
Bill Currie 46ee46fdc6 dead code removal 2002-07-30 04:55:33 +00:00
Bill Currie 587ac5670b using R_FLOAT for setting individual fields of the return vector ain't so
good a thing to do.
2002-07-25 14:58:02 +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
Ragnvald Maartmann-Moe IV 227da6afba Change pr_boundscheck default to 0. *grmbl* 2002-07-21 23:35:36 +00:00
Bill Currie bff6291bfb don't need to force developer now 2002-07-16 22:06:52 +00:00
Bill Currie ac1392eb74 object.r:
define __obj_exec_class, obj_msgSend and obj_msgSend_super for the way
	qfcc now handles these defs
pr_edict.c:
	PR_ValueString now checks that the function is valid before trying to
	print its name.
class.c:
	__obj_exec_class is now extern
linker.c:
	fix more mangled relocs
method.c:
	obj_msgSend and obj_msgSend_super are now extern
qfcc.c:
	fixes so obj_module_t doesn't get zapped
type.c:
	fixes so obj_module_t doesn't get zapped
2002-07-16 19:03:56 +00:00
Bill Currie 35d224f1da a little more info and force developer on for now 2002-07-16 15:39:49 +00:00
Bill Currie 34fa421638 whitespace 2002-07-13 03:41:33 +00:00
Bill Currie 717127e0d8 don't print ! on uninitialized global defs that are the correct type for
the instruction
2002-06-17 05:31:08 +00:00
Bill Currie 2264c28310 pr_strings:
remove a bogus 0x which caused confusion in an error message
def.c:
	vector fields still need an extra 3 globals for their component fields
2002-06-16 05:24:58 +00:00
Bill Currie 88fc0be127 arrays are /almost/ working again 2002-06-12 22:37:18 +00:00
Bill Currie 0b1d1ade73 qfprogs can now read the debug data 2002-06-11 17:24:37 +00:00
Bill Currie a4b06b1074 blah, enums and switch... (at least gcc 3.1 is warning about that again:) 2002-06-09 16:31:08 +00:00
Bill Currie 5c943d4ca9 this should speed up progs a little bit 2002-06-07 19:41:13 +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 a8e177652a initialize the meta class super class pointer correctly 2002-05-31 14:58:42 +00:00
Bill Currie 2ee3aec19b reverse the order of linking 2002-05-31 06:52:48 +00:00
Bill Currie ea3c6995fd actually /use/ method_list.method_next and chain the class methods onto the
instance methods for root classes.
2002-05-31 06:01:47 +00:00
Brian Koropoff d85a238af2 Modified cmd.c to prepare for more file access functions and changed
the bind system to keep a restricted flag on binds to prevent the
server from executing restricted commands by binding them to keys.
2002-05-31 05:38:06 +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 ea36fceec5 fix a few missed initializations 2002-05-22 21:45:15 +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 018b3ae536 more runtime implementation 2002-05-22 19:02:26 +00:00
Bill Currie 43e609241c initial stab at supporting most of the obj runtime 2002-05-22 17:32:44 +00:00
Bill Currie 33daf1e724 provide temporary stubs for most of Object's methods 2002-05-21 23:39:21 +00:00
Bill Currie 3815d4be7e blah, unitialized variable 2002-05-21 22:27:41 +00:00
Bill Currie 05c8cad2d1 grr, really should make compat.h include string[s].h
also, partially implement the messaging functions
2002-05-21 22:13:05 +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 a8c3fa8ffc correct the function names in PR_EnterFunction and PR_LeaveFunction 2002-05-21 21:14:32 +00:00
Bill Currie f78f921285 search for `.self' before `self' 2002-05-18 00:49:16 +00:00
Bill Currie 057aa61bd3 `document' the type sizes 2002-05-17 16:44:47 +00:00
Bill Currie 8f0661f5be correct the copyright year 2002-05-14 23:07:38 +00:00
Bill Currie 44dcf74627 strip the \n from all(?) of the Sys_Error calls (Sys_Error itself will be
adding \n).
2002-05-14 06:12:29 +00:00
Bill Currie 91779b04f7 new tool: qfprogs. currently only disassembles progs, but the idea is for it
to become a progs oriented nm, objdump etc
2002-05-13 19:37:36 +00:00
Brian Koropoff 3fffa26fb4 Added thread support to GIB and cleaned up escape characters yet again.
With any luck it should actually work this time.  Added the getimpulse
command so that GIB scripts can check if an impulse command is pending
before sending their own.  Fixed all the memory leaks I could find.
QuakeC and GIB seem to be clean except for maybe one or two sneaky leaks
I can't track down.
2002-05-11 00:36:12 +00:00
Bill Currie 73e6cf062c implement type encoding 2002-05-10 23:19:57 +00:00
Bill Currie 403af77038 give qc access to Cmd_Return 2002-04-14 01:25:24 +00:00
Bill Currie 8220ddd83d and the command api to csqc and use it to bind menu_load and menu_save. F2
and F3 now work in nq :)
2002-04-12 17:19:49 +00:00
Bill Currie 47a94ed6af clear out the string hash resources completely 2002-04-09 16:21:27 +00:00
Bill Currie 8588d2d1cd fix a silly braino in the resources code that was causing the resource
structs to not get linked into the chain
2002-04-09 16:06:05 +00:00
Bill Currie 9dd7deb798 better catching of invalid inputline pointers 2002-04-09 15:29:48 +00:00
Brian Koropoff 388ff7b597 Some bug fixes and memory leak fixes. Local variables break randomly,
probably due to my misuse of hash tables.  Anyone have any ideas?
2002-03-20 22:57:26 +00:00
Robin Redeker 18082533d5 Fixed some memory problems in my string-hashes. 2002-03-19 18:08:07 +00:00
Robin Redeker 489bc7291a Playermenu working now fine.
Added some api-functions to complete playermenu.
(Playermenu isn't still finished)
2002-03-19 17:07:56 +00:00
Robin Redeker adca50e52b Did further working on the menu code.
Added a _unfinished_ Player options-submenu, for setting
the name, top-/bottomcolor.
Added Draw_Fill and such to the progs api.
Added some comments.
2002-03-16 20:22:01 +00:00
Robin Redeker 757556022b 1. general menu code cleanup
2. added lots of comments to my menu code
3. wrote a string hash api (key -> value assignment list)
Hm, nothing else afaik. ;)
2002-03-16 15:52:17 +00:00
Bill Currie f0609f04f3 forgot about the need for the proto itself 2002-03-12 17:44:45 +00:00
Bill Currie adbb59c5dd fix missing prototype for fnmatch on some systems 2002-03-12 17:36:17 +00:00
Bill Currie d5fe4e3130 make file open a little more secure 2002-03-11 19:01:13 +00:00
Bill Currie 9ea013888b eliminate GetEdictFieldValue, mostly merge SV_AddGravity, and clean up
some whitespace in sv_phys.c
2002-02-25 07:44:17 +00:00
Bill Currie b5c2c0e14e clean up a fixme. this doesn't fix serplord's out-of-bounds problem, but
that's because his qc compiler is doing weird stuff.
2002-02-11 19:36:36 +00:00
Robin Redeker 67d53f4e56 Added some QC-API functions: String_Cut, String_Len, Key_CountBindings. 2002-02-02 09:38:19 +00:00
Robin Redeker fa575a3475 Added a start for the QC-Keys-API 2002-01-31 21:08:45 +00:00
Bill Currie 681950cf26 print [val] for pointers 2002-01-30 22:14:13 +00:00
Bill Currie 40e987c071 provide InputLine_SetWidth so the drawn width can be set 2002-01-30 21:25:00 +00:00
Bill Currie 6d63d1d55b implement comparisons and not for pointers 2002-01-30 21:20:12 +00:00
Bill Currie e1abe4c44b finalize the crc of the progs file 2002-01-30 21:13:57 +00:00
Bill Currie 7ef4426775 inputline api `done'. now just to get it working 2002-01-30 08:41:18 +00:00
Bill Currie ee3f51f13b "" to <> for system headers 2002-01-30 08:34:44 +00:00
Bill Currie c76f7d88ce fix an API snafu (oops:) 2002-01-30 08:09:53 +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 08210bc93f fix an accidental double byteswap that broke progs for big-endian machines 2002-01-24 04:43:47 +00:00
Bill Currie 85588c8fcb start implementing the api for input lines and clean up a couple csqc
prototype issues.
2002-01-23 22:37:44 +00:00
Bill Currie 68637eea9e start implementing dynamic memory for progs 2002-01-23 22:35:48 +00:00
Bill Currie 16cc0c22c9 forgot to implement store.p 2002-01-23 22:33:22 +00:00
Bill Currie d5fb0f5a68 fix some .. path compression bugs 2002-01-21 17:36:22 +00:00
Bill Currie 9833b7009d oops, forgot to remove the debug code 2002-01-21 16:48:08 +00:00
Bill Currie f3efed94e5 .0 isn't valid for integer formats 2002-01-21 16:47:50 +00:00
Bill Currie 5b0e6dc342 add file and string modules to csqc. the file nodule is rather parnoid
about the path it's handed (need to get even more paranoid, though). the
string module just has char replacement so far. Add Draw_CenterPic to
r_progs.c, but this will only last till qpic_t is supported in qc.
the load menu almost works: just need to add key handling and fix a bug in
PF_sprintf
2002-01-21 07:24:51 +00:00
Bill Currie 1168f1aa86 libQFcsqc (I'm not adverse to renaming it) is born. so far, only provides
Cbuf builtins.
2002-01-20 04:09:36 +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 7def88668a fix a goof with the progs loader for the server interface 2002-01-18 23:53: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 d69762facd integer() and float() casts seem to work 2002-01-17 19:32:04 +00:00
Bill Currie 9d59d953bd more cleanups 2002-01-12 05:32:21 +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 8ddce20949 pr_*: add storep.p so pointers can be stored into entities
emit.c: convert & (address) to . in unary .
        rewrite emit_assign_expr
expr.c: remove debug code and make unary . less agressive on address calcs
        also convert & (address) to . for lvals
2001-12-12 20:35:58 +00:00
Bill Currie f9149a0d6c finally get around to renaming type_name to pr_type_name 2001-12-12 17:15:09 +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 d344aea51f store.p so pointers can be moved around 2001-12-08 21:43:44 +00:00
Bill Currie 00b2a45ecd change the operator for "address" from "." to "&" so load.p can be implement.
this makes it so pointers in entities work.
2001-12-08 20:17:20 +00:00
Bill Currie b03a1bee42 ok, structures seem to generate correct code now 2001-12-08 08:19:48 +00:00
Bill Currie 028f8a116d immidiate indexed pointer access and some whitespace + reorg 2001-12-07 20:07:38 +00:00
Bill Currie c130d38c6c fix more bugs caused by the Hunk_TempAlloc changes and do some more jump
prediction fixes for msg_t and sizebuf_t
2001-12-03 22:11:21 +00:00
Bill Currie 12a0a10d33 more alpha portability fixes 2001-11-29 19:35:25 +00:00
Bill Currie 67fde0c492 remove some debug code I accidently committed 2001-11-26 17:25:16 +00:00
Bill Currie 712aecb1a2 use the Hash_*Element functions for opcodes to avoid the silliness of trying
to use strings for numeric keys
2001-11-20 18:54:15 +00:00
Bill Currie 8d208ac3aa make float != 0 tests work on alpha for when the value is actually an integer
(works fine on intel, but on alpha the denormals either produce an exception
or true zero: not quite desirable:)
2001-11-19 17:51:31 +00:00
Bill Currie 9d0320cc89 various portability improvements 2001-11-18 23:40:01 +00:00
Bill Currie cda6923ffa this seems to be all that's needed to make progs 64 bit clean (minus issues
with sizeof (int) != 4, but that's not the case on alpha)
2001-11-17 04:32:00 +00:00
Bill Currie cc66577f1c fixes for building on alpha (linux) 2001-11-16 01:09:17 +00:00
Bill Currie 598c82352f fix printing of op_c for storeb 2001-11-15 19:36:40 +00:00