Commit Graph

924 Commits

Author SHA1 Message Date
Bill Currie e2d1a0f7d2 [ruamoko] Tag object memory with the class name
This makes it a lot easier to see what's leaking.
2020-03-31 16:43:10 +09:00
Bill Currie 4cef9792f4 [util] Make hash-tables semi-thread-safe
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie eb386826d3 [util] Fix some missed signal calls
*sigh*
2020-03-23 15:28:12 +09:00
Bill Currie 4a61ff0d35 [util] Switch to using sigaction for signal handling
This allows for much more consistent semantics when dealing with
signals.
2020-03-23 15:15:39 +09:00
Bill Currie 4dbf280012 [util] Add a means to open a gap in a text buffer
for loading files into the buffer.
2020-03-22 20:19:25 +09:00
Bill Currie 88b4046632 [util] Pass a data pointer to shutdown functions
And clean up the mess.
2020-03-22 00:57:54 +09:00
Bill Currie d2f03e8a64 [util] Fix darray test for gcc purity 2020-03-20 12:59:25 +09:00
Bill Currie 966bd267c5 Add a set of macros for dynamic arrays
Includes docs and test cases.
2020-03-20 12:59:25 +09:00
Bill Currie 0cbe438ac1 [util] Make va slight robust against chained use
va now cycles through a set of four dstrings rather than using just the
one. This allows for some simple chaining of va usage.
2020-03-17 15:05:58 +09:00
Bill Currie 75f4cebf0e Clean up after removal of uint32.h
I guess I forgot to check for its usage in header files, and the fact that
it didn't get cleaned out from being installed hid the error.
2020-02-29 16:11:07 +09:00
Bill Currie ddd007e2d5 [dstring] Return the string instead of printed size
Other than consistency with printf(), I'm not sure why we went with the
printed size as the return value; returning the resultant strings makes
much more sense as dsprintf() (etc) can then be used as a safe va()
2020-02-26 19:00:19 +09:00
Bill Currie 42713cad8b Make script much friendlier to use
It now simply sets an error message pointer and returns false if there's
an error.
2020-02-26 09:39:03 +09:00
Bill Currie 3720956d88 Speed up two of the three deletion cases
The initial code was pretty much a port of the code in the editor I
wrote 25 years ago. Either I didn't think of the optimization back then,
or I tried to implement it, failed, and figured it wasn't worth it
(despite using it on a 386dx33). However, I noticed it now and it was
easy enough to get working, and it's always good to not do something
that's not needed.
2020-02-24 18:52:46 +09:00
Bill Currie f7493fe8fb Add a buffer-gap text buffer
This should be good for text editing and working with text files in
general.
2020-02-24 17:30:33 +09:00
Bill Currie c3c55f0bcc Fix some source formatting 2020-02-23 19:05:43 +09:00
Bill Currie f8b1a3a89f Return the previous sys print callbacks
This allows for temporary overrides.
2020-02-23 11:41:19 +09:00
Bill Currie c727f6a130 Rewrite QuatMultVec to be faster
Could be faster still using SSE, but that's another project.
2019-07-06 14:45:40 +09:00
Bill Currie f58c2fef5a Switch QF's quaterions from wxyz to xyzw.
After messing with SIMD stuff for a little, I think I now understand why
the industry went with xyzw instead of the mathematical wxyz. Anyway, this
will make for less pain in the future (assuming I got everything).
2018-10-12 14:33:55 +09:00
Bill Currie 6f28ab2a68 Add basic quaternion multiplication tests. 2018-10-09 12:44:46 +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 db3df6f8a7 Fix a bunch of dead increments. 2018-09-09 11:12:04 +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 f75ff2d269 Fix some null argument issues. 2018-09-07 22:30:44 +09:00
Bill Currie 8fd5be0ee0 Fix a pile of sizeof goofs.
While scan-build wasn't what I was looking for, it has proven useful
anyway: many of the sizeof errors were just noise, but a few were actual
bugs (allocating too much or too little memory).
2018-09-07 20:00:57 +09:00
Bill Currie 575a67b2a1 mat4 test case fixes.
The tests cases themselves were buggy.
2018-08-26 15:06:08 +09:00
Bill Currie 4f58429137 Fix an unhealthy pile of gcc 8 warnings.
While some of the warnings were merely annoying, some where actual bugs or
unearthed bugs in related code.
2018-08-20 00:05:00 +09:00
Bill Currie 0de0eb2fc7 Fix a bunch of bit-rot. 2018-06-08 13:21:30 +09:00
Bill Currie 546e333a3c Allow Sys_Error to be hooked.
This makes debugging builtins that wrap normal functions a little easier by
giving a progs dump when such an error occurs.
2016-01-03 23:04:00 +09:00
Bill Currie 735fcf68d5 Clean up usage of va_copy.
AC_TYPE_VA_LIST is no longer necessary, and the code is easier to read.
2016-01-03 21:16:23 +09:00
Bill Currie 2cbb7cb0c8 Remove a redundant va_start/va_end pair.
Found while checking how many places use va_copy.
2016-01-03 18:38:41 +09:00
Bill Currie 946561ba44 Don't bail out prematurely when searching for files.
This fixes the problem of not finding files without a .gz extension when
gzip support is enabled (most of my quake data is compressed, so it took a
while for me to notice the problem).
2014-01-29 16:13:24 +09:00
Bill Currie 8bea6a66ca Create _QFS_VOpenFile and QFS_VOpenFile.
_QFS_VOpenFile is actually _QFS_FOpenFile reimplemented to take vpath start
and end parameters so the search can be limited. QFS_VOpenFile,
_QFS_FOpenFile, and QFS_FOpenFile are all wrappers for _QFS_VOpenFile.
2014-01-28 16:22:05 +09:00
Bill Currie 3efb0c538f Separate file search from loading.
QFS_LoadFile (and its wrappers) now  take a file handle rather than a
path. This will make vpath usage a little cleaner to implement.
2014-01-28 16:22:05 +09:00
Bill Currie 83c47aacef Remove the stack loading from QFS_LoadFile. 2014-01-28 16:22:05 +09:00
Bill Currie a561477274 Nuke QFS_LoadStackFile().
It was used in only one place and is really not necessary (these days,
anyway).
2014-01-28 16:22:05 +09:00
Bill Currie 25a060f369 Remove the foundname param from _QFS_FOpenFile.
It's now obsolete with qfs_foundfile.
2014-01-28 16:22:05 +09:00
Bill Currie 576c73cf7c Replace qfs_file_from_pak with qfs_foundfile.
This exposes the found name, vpath and in_pak status.
2014-01-28 16:22:05 +09:00
Bill Currie e5148493db Prepend qfs_ to file_from_pak.
A little better name-spacing.
2014-01-28 16:22:05 +09:00
Bill Currie 82ded3fbe5 Fix some bitrot resulting from a rebase. 2014-01-28 16:22:05 +09:00
Bill Currie 5560696a65 Fix some unused variables. 2014-01-28 16:22:05 +09:00
Bill Currie 4b18501b00 Fix an uninitialized variable. 2014-01-28 16:22:05 +09:00
Bill Currie 40206904ba Reimplement _QFS_FOpenFile using QFS_FindFile's internals.
_QFS_FOpenFile does a full search, however.
2014-01-28 16:22:05 +09:00
Bill Currie 6b87ddbb7c Add QFS_FindFile.
QFS_FindFile's search can be constrained to begin or end at a certain
vpath.
2014-01-28 16:22:04 +09:00
Bill Currie 8bc2f7f6df Print the vpath name when dumping the paths. 2014-01-28 16:22:04 +09:00
Bill Currie 098821e35d Fix QFS_FilelistFill to work with vpaths. 2014-01-28 16:22:04 +09:00
Bill Currie f05c7179c3 Split up the search paths into vpath chunks.
A vpath is the union of all locations searched for a file in a single
gamedir (eg, shadows, id1 etc). This is a necessary step to preventing
problems like id1/maps/start.lit being used for shadows/maps/start.bsp.

However, QFS_FilelistFill still needs to be reworked as it does not compile
yet (testing was done with a gutted QFS_FilelistFill).
2014-01-28 16:22:04 +09:00
Bill Currie 6910c50a43 Clean up the #ifdef mess in _QFS_FOpenFile
With proper initialization, only the one chunk of #ifdefs is needed. Now
the code is much easier to read.
2014-01-28 16:22:04 +09:00
Bill Currie 550f1ae788 Fix some bitrot.
Just updating for the changes to the ALLOC/FREE macros.
2014-01-28 16:22:03 +09:00
Bill Currie 3b56f0e3bf Advance src with next_line.
This fixes the double counting of the \n at the end of the chunk separator
line.
2014-01-28 16:22:03 +09:00
Bill Currie d1848a93c8 Add tests for chunk line numbers.
Which happen to find errors :P
2014-01-28 16:22:03 +09:00