Commit Graph

60 Commits

Author SHA1 Message Date
Bill Currie 12c84046f3 [cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.

As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.

The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).

While not used yet (partly due to working out the design), cvars can
have a validation function.

Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.

nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-24 19:15:22 +09:00
Bill Currie 38319d01b2 Fix some null pointer shenanigans
clang doesn't like anything but a bare 0 as null (and in some of the
cases, it was quite right: '\0' should not be treated as a null
pointer). And the crashers were just for paranoia and probably aren't
needed any more (kept for now, though).
2022-03-31 00:25:22 +09:00
Bill Currie 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie 6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie 34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie 59e85b7d5e Fix a pile of dead assignments.
Some were actual bugs!
2018-09-08 22:23:57 +09:00
Bill Currie 0de0eb2fc7 Fix a bunch of bit-rot. 2018-06-08 13:21:30 +09:00
Bill Currie 9250eb83bf Yet more char index issues.
Should be getting near the end of these as qfcc tries to link in my hacked
up tree :)
2012-08-18 21:42:49 +09:00
Bill Currie 23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie a51e888a1b Nuke MAX_OSPATH and clean up the mess. 2010-08-25 13:31:08 +09:00
Bill Currie d66934942d nuke Con_Printf and Con_DPrintf and use Sys_* instead 2007-11-06 10:17:14 +00:00
Bill Currie 3fb03fc2be hah, should have been using __attribute__((used)) all that time (rather
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie a409ea4a74 spawn code complete 2005-05-08 08:04:50 +00:00
Bill Currie c2c3a62956 nuke Qexpand_squiggle. instead, expand ~ to $HOME on qfs initialization and
cache the value.

don't call Qopen directly in the engine. instead call QFS_Open (generic) or
QFS_WOpen (write only, zip flag).

rework QFS_NextFilename to use a dstring (avoiding a potential buffer
overflow), support 10000 files and work from the top-level fs_userpath
directory. adjust QFS_WriteFile and QFS_WriteBuffers etc to suit.

make sw32 screenshots actually get written.

hopefully everything gets written to the right places :)
2003-05-23 17:17:01 +00:00
Bill Currie eb099ae0d3 make qf gcc 3.3 clean 2003-04-17 00:01:48 +00:00
Ragnvald Maartmann-Moe IV 5fb8aa07f3 Code style, people. Love it or leave it! 2003-03-21 21:25:44 +00:00
Bill Currie d93fceea38 fix a snafu in SVC_DirectConnect related to info strings, make
Info_ParseString take (and pass on to Info_SetValueForStarKey) a flags arg
and simplify the flags handing in Info_SetValueForStarKey.
2003-02-19 17:39:21 +00:00
Bill Currie f4fdbeee4d make the low level network code and packet logging less incentuous 2003-02-10 21:41:22 +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 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 9f7c669370 various win32 compile fixes for the latest mingw (not fully working due to
LPCWAVEFORMATEX)
2002-10-11 20:47:17 +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 b5783866ad fix model_t issues for solaris (now that I know which headers cause the
problem...:)
2002-08-09 02:44:23 +00:00
Bill Currie 1354975692 clean out some unneeded includes and fix up model_t for sun (again:P) 2002-08-08 22:24:02 +00:00
Ragnvald Maartmann-Moe IV 1478dcd9c9 Prune dead code. 2002-07-02 21:37:22 +00:00
Ragnvald Maartmann-Moe IV 3900c75cbb Spelling correction in printf. 2002-06-17 05:40:56 +00:00
Bill Currie 6a5bbf6f0a memory allocation checking cleanup 2002-05-14 06:37:28 +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 9d0320cc89 various portability improvements 2001-11-18 23:40:01 +00:00
Bill Currie 54ddb94132 urk, I forgot Info_ParseString uses Hunk_TempAlloc :/ 2001-11-05 17:19:26 +00:00
Bill Currie 6c2145f9b5 make work with the new info api and fix what looks to be a malloc bug 2001-11-05 17:09:27 +00:00
Bill Currie dcd9b0040e rewrite the info strings to use hash tables instead of a static string.
This required changes to the api (info_t instead of char *) but should be
a net gain in speed (not a lot, admittedly: it was pretty fast to begin
with, but this paves the way for some other changes I have in mind).
2001-11-04 07:50:39 +00:00
Adam Olsen 3bba5398ba - audit malloc usage. now everything checks the return value :) 2001-10-24 22:50:06 +00:00
Bill Currie b1f4a778f9 the rcsid commit from hell }:> 2001-09-28 06:26:31 +00:00
Bill Currie e9cf5b4eba include sys/types.h for freebsd 2001-09-07 04:41:13 +00:00
Adam Olsen 4deed9245a - Add CACHE_WRITE_{,UN}LOCK macros, and calls to them in Cache_*. No
effect until other things are done.
- Make Qalloc treat no callback as a failed callback
- Add a Qstrdup
- Fix a memory leak in cl_slists.c
2001-08-29 09:14:18 +00:00
Ragnvald Maartmann-Moe IV ade99607cc header/whitespace sweep continues. 2001-08-28 23:05:45 +00:00
Bill Currie b3d20d834a fix for compiling under freebsd. thank's, stu 2001-08-07 17:43:49 +00:00
Bill Currie 1c9e1b176f fear the mighty const correct patch 2001-07-15 07:04:17 +00:00
Chris Ison 3456b5f479 part 1 of slist fixup, added ping and game filtering, also fixed some potential bugs. flame me later 2001-06-17 08:14:22 +00:00
Chris Ison a3d2d83e18 fixed master list to the 7 (known) working master 2001-06-12 23:53:58 +00:00
Chris Ison 3526371ff0 oops, forgot to remove debug code 2001-06-12 12:34:59 +00:00
Chris Ison 75fe232052 Sorted server list, sl_sortby 0 = by name, sl_sortby 1 = by ping 2001-06-12 12:31:01 +00:00
Chris Ison 5b16c38974 quick bug fix for slist update seg 2001-06-09 15:42:22 +00:00
Chris Ison 8d3247ff00 added set server name after refresh, and fixed slist update not resetting the list 2001-06-09 15:24:42 +00:00
Chris Ison 12ae6750af moved slist stuff out of cl_main.c and into cl_slist.c, enabled getting server list from master servers. to switch between servers.txt list (default) and list of servers from master servers use slist switch 2001-06-09 09:12:24 +00:00
Bill Currie 6bf58ab1af no header includes cvar.h now 2001-05-31 03:41:35 +00:00
Joseph Carter 05adfd0e53 quakefs.h -> vfs.h
quakeio.h -> vfile.h

More diff reduction between trunk and my VFS code.  Also took the time to
put some headers in order and fix a few #include's pointed out by moving
things around a bit.
2001-05-30 04:34:06 +00:00