Commit Graph

1146 Commits

Author SHA1 Message Date
Ionen Wolkens 881add2c51
Add GNU-stack notes to assembly files
Prevents GCC from assuming an executable stack is needed.

Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
2021-06-13 10:12:03 -04:00
Bill Currie 36df16eefc [util] Fix incorrect type in test-mat3
Fixes make check for gcc-11
2021-06-13 15:00:57 +09:00
Bill Currie 24fd443ef3 [ui] Move txtbuffer and vrect tests to libs/ui
Fixes make check
2021-06-13 14:29:46 +09:00
Bill Currie 813497a1aa [ui] Create library for UI support code
Currently this has text buffer, input line, vrect and view code.
2021-06-12 22:50:51 +09:00
Bill Currie 713862c511 [util] Fix format issue in set test
I guess I hadn't done a "make check" on 64-bit since getting windows
builds to work.
2021-06-01 19:11:51 +09:00
Bill Currie bcc5686606 [util] Add fuzzy and reentrant bsearch
Fuzzy bsearch is useful for finding an entry in a prefix sum array
(value is >= ele[0], < ele[1]), and the reentrant version is good when
data needs to be passed to the compare function. Adapted from the code
used in pr_resolve.
2021-06-01 18:53:53 +09:00
Bill Currie 0293167bd2 [util] Get simd tests working for emulated simd
A bit of a mess for optimized vs unoptimized, but the tests acknowledge
the differences in precision while checking that the code produces the
right results allowing for that precision.
2021-06-01 18:53:53 +09:00
Bill Currie ef9b04ba83 [util] Get tests working with sse2
It seems that i686 code generation is all over the place reguarding sse2
vs fp, with the resulting differences in carried precision. I'm not sure
I'm happy with the situation, but at least it's being tested to a
certain extent. Not sure if this broke basic (no sse) i686 tests.
2021-06-01 18:53:53 +09:00
Bill Currie 778c07e91f [util] Get vectors working for non-SSE archs
GCC does a fairly nice job of producing code for vector types when the
hardware doesn't support SIMD, but it seems to break certain math
optimization rules due to excess precision (?). Still, it works well
enough for the core engine, but may not be well suited to the tools.
However, so far, only qfvis uses vector types (and it's not tested yet),
and tools should probably be used on suitable machines anyway (not
forces, of course).
2021-06-01 18:53:53 +09:00
Bill Currie a461c09586 [util] Make cmem consistent on 32 and 64 bit systems
I don't know that the cache line size is 64 bytes on 32 bit systems, but
it should be ok to assume that 64-byte alignment behaves well on systems
with smaller cache lines so long as they are powers of two. This does
mean there is some waste on 32-bit systems, but it should be fairly
minimal (32 bytes per memblock, which manages page sized regions).
2021-06-01 18:53:52 +09:00
Bill Currie 9dca47c0e1 Make the set tests word size agnostic. 2021-06-01 18:53:52 +09:00
Bill Currie 1e9329ccf6 [nq,qw] Stop wring to config.cfg
QF now uses its own configuration file (quakeforge.cfg for now) rather
than overwriting config.cfg so that people trying out QF in their normal
quake installs don't trash their config.cfg for other quake clients. If
quakeforge.cfg is present, all other config files are ignored except
that quake.rc is scanned for a startdemos command and that is executed.
2021-04-12 22:09:09 +09:00
Bill Currie f596eacf0c [util] Add message short and long poke functions
Both big and little endian.
2021-04-04 15:56:14 +09:00
Bill Currie 972b0f8a70 [util] Make sizebuf and msg sizes unisgned
And clean up the mess.
2021-04-04 15:53:53 +09:00
Bill Currie 9a2f82bbc6 [util] Add big-endian short msg read/write
And improve the generated code for MSG_ReadShort

I suspect gcc didn't like all the excess pointer dereferences and so
couldn't assume that the bytes were being read sequentially.
2021-04-04 15:19:38 +09:00
Bill Currie afd7b38551 [util] Add big-endian long msg read/write
And improve the generated code as well (ie, use a code sequence that gcc
recognizes and optimizes to a single 32-bit read and a byte-swap).

nq uses big-endian for its packet headers (arg, though it is consistent
with IP, it's not with the rest of quake).
2021-04-04 15:11:09 +09:00
Bill Currie 7864bb0ba6 [util] Use a clearer parameter name for SZ_Alloc 2021-04-04 14:09:02 +09:00
Bill Currie 39103cc8a3 [sw] Fix some 32-bit assembly issues
I'm not sure that the mismatch between refdef_t and the assembly defines
was a problem (many fields unused), but the main problem was due to
execute permission on the pages: one chunk of asm was in the data
section, and the patched code was not marked as being executable (due to
such a thing not existing when quake was written).
2021-04-02 22:17:32 +09:00
Bill Currie 9ded490806 [util] Add Sys_PageSize
Eliminate that particular problem once and for all.
2021-04-01 18:20:56 +09:00
Bill Currie 73a610508c [util] Fix cmem for windows
I had quite messed up the page size (oops), and missed the fact that
_aligned_free is to be used with _aligned_malloc rather than just free.
2021-04-01 18:00:59 +09:00
Bill Currie 5f93c115ff [util] Make developer flag names easier to manage
They're now an enum, and the flag part of the name is all lowercase, but
now the flag definitions and names list will never get out of sync.
2021-03-29 22:38:47 +09:00
Bill Currie 6fea5f5e1a [build] Add -Wformat-non-literal option
While this caused some trouble for pr_strings and configurable strftime
(evil hacks abound), it's the result of discovering an ancient (from
maybe as early as 2004, definitely before 2012) bug in qwaq's printing
that somehow got past months of trial-by-fire testing (origin understood
thanks to the warning finding it).
2021-03-29 17:27:06 +09:00
Bill Currie a754dbca37 [util] Make va return const char *
And clean up the resulting mess.

I don't know why it wasn't doing so, but it certainly should have been.
2021-03-29 17:24:30 +09:00
Bill Currie 00aa584506 [util] Add re-entrant set_as_string
Makes it easier to debug set-related code in multi-threaded code.
2021-03-28 20:25:57 +09:00
Bill Currie b6ab832ed4 [simd] Add vabsf and some more tests 2021-03-28 19:49:43 +09:00
Bill Currie 29e029c792 [util] Add float a simd version of the SEB
And its support functions. I can't tell if it's any faster (mtwist_rand
is a significant chunk of the benchmark timings, oops), but it's nice to
have.
2021-03-27 23:38:10 +09:00
Bill Currie 88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie c4a0f3cc73 [util] Fix a string handling bug
Good grief, they still exist :(
2021-03-27 20:06:40 +09:00
Bill Currie 99f0cde080 [util] Add strndup and reentrant quicksort
Needed for portability.
2021-03-27 20:03:39 +09:00
Bill Currie a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie 7c788a6e7a [util] Use size_t for dstring length params
While not overly wrong, unsigned is not really appropriate.
2021-03-27 19:08:18 +09:00
Bill Currie 0167456b21 [util] Loosen up SEB relative epsilon a little
1e-8 is a little too tight, the normal was 4.5x the computed epsilon.
Going to 1e-6 still keeps things tight.
2021-03-27 15:04:13 +09:00
Bill Currie 5d9bf32d3c Merge branch 'vulkan' 2021-03-23 12:31:58 +09:00
Bill Currie cc4167668c Fix a pile of leaks and uninit errors
Still "some" more to go: a pile to do with transforms and temporary
entities, and a nasty one with host_cbuf. There's also all the static
block-alloc lists :/
2021-03-21 19:56:17 +09:00
Bill Currie a3c1b2e992 [util] Rename qfplist.[ch]
The name is a hold-over from before the current quakeforge tree and the
QF include directory.
2021-03-21 16:13:03 +09:00
Bill Currie 6e0cc59e8f [util] Make wad lump failure a soft error
Can't recover from an error if the program is swept out from underneath
you.
2021-03-21 11:36:18 +09:00
Bill Currie 0ace799b27 [util] Support commands with a data parameter
Useful for avoiding a pile of wrapper functions that merely pass on
command-specific data to the actual implementation. Used to clean up the
wrappers in nq and qw cl_input.c
2021-03-20 03:56:16 +09:00
Bill Currie 693225a16f [util] Add a fixme for a comment
The code itself is fine, but the comment is rubbish because it's
confusing, though essentially correct.
2021-03-10 18:05:12 +09:00
Bill Currie 4a97bc3ba5 [util] Create simd quaternion to matrix function
This seems to be pretty close to as fast as it gets (might be able to do
better with some shuffles of the negation constants instead of loading
separate constants).
2021-03-04 17:45:10 +09:00
Bill Currie e3762d8f38 [util] Make plist mostly null-safe
The main purpose is to allow fluent-style:
    const char *targetname = PL_String (PL_ObjectForKey (entity, "targetname"));
    if (targetname && !PL_ObjectForKey (targets, targetname)) {
        PL_D_AddObject (targets, targetname, entity);
    }

[note: the above is iffy due to ownership of entity, but the code from
which the above comes works around the issue]
2021-03-03 18:01:35 +09:00
Bill Currie 45c0255643 [util] Add simd 4x4 matrix functions
Currently just add, subtract, multiply (m m and m v).
2021-03-03 16:34:16 +09:00
Bill Currie 407ea15e35 [util] Fix some test bitrot 2021-03-02 15:05:19 +09:00
Bill Currie 4eb07220cd [util] Make plists more const-correct 2021-02-25 11:55:25 +09:00
Bill Currie 0cd2ece38e [util] Correct element order for vector expressions 2021-02-23 14:37:13 +09:00
Bill Currie 4bda49d798 [util] Correct the lex priority for int constants
The actual need to specify unsigned int constant is a bit of a pain, but
not being able to do so due to lex priority errors is even more of a
pain.
2021-02-17 13:29:53 +09:00
Bill Currie 55104ac430 [util] Allow "any type" results for cexpr
Setting the result type cexpr_exprval tells cexpr to simply return whoe
exprval object rather than the referenced value, thus allowing the
caller to check the type when the expression is context sensitive.
2021-02-09 19:30:30 +09:00
Bill Currie 35f12c36ff [util] Catch some more cexpr errors 2021-02-09 19:29:48 +09:00
Bill Currie 5535d1f8e6 [util] Keep track of plist dictionary key order
The order in which keys are added to the dictionary object is
maintained. Adding a key after removing an old key adds the new key to
the end of the list rather than reusing the old key's spot.
2021-02-09 17:03:33 +09:00
Bill Currie 0dcd946063 [util] Add plist parser for dictionary -> array
PL_ParseLabeledArray works the same way as PL_ParseArray, but instead
takes a dictionary object. The keys of the items are ignored, and the
order is not preserved (at this stage), but this is a cleaner solution
to getting an array of objects when the definitions of those objects
need to be accessible by name as well.
2021-02-09 15:24:28 +09:00
Bill Currie 14e4fd9f6a [util] Pass context to the plist array/symtab parser allocator 2021-02-09 15:01:55 +09:00
Bill Currie a408fd40da [util] Make plist more const-correct 2021-02-09 14:56:48 +09:00
Bill Currie 8664a5b969 [util] Enable parser debugging for cexpr
Not actually turned on in the code, but cexpr_yydebug is present.
2021-02-09 10:02:04 +09:00
Bill Currie dfa7af03c6 [util] Plug a thread-safety hole in plists 2021-02-09 09:57:07 +09:00
Bill Currie e929dca300 [util] Auto-cast plist string items
The casting uses a recursive call to the expression parser, so the
expressions are type-checked automatically.
2021-02-04 22:37:20 +09:00
Bill Currie d2536e584f [util] Add plist support to cexpr
This allows plist objects to be accessed directly from cexpr expressions
using struct.field syntax for dictionary objects and array[index] syntax
for array objects.
2021-02-04 16:58:13 +09:00
Bill Currie 5d1d85f72e [util] Resurrect Hunk_Print and fix some errors
It turned out that Hunk_HighAlloc was not creating a hunk header
(ancient bug by me), and I cleaned up a bunch of name-size issues, along
the way.
2021-02-03 13:21:08 +09:00
Bill Currie 0bfb60775e [util] Ensure hunk allocs are cache alligned
This doesn't seem to make much difference in the vulkan renderer, but it
certainly doesn't hurt.
2021-02-03 13:19:19 +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 12ec6c5c29 [util] Add eol to plist parse errors
I suspect it got lost when I made the error message a string item.
2021-01-26 20:45:07 +09:00
Bill Currie 8224169394 [util] Make plist parse errors a little more useful
Particularly the "unexpected character" ones.
2021-01-23 18:56:15 +09:00
Bill Currie 0622a24380 [util] Support size_t constants
Much like 1u and 1l, 1z is for size_t.
2021-01-20 01:24:32 +09:00
Bill Currie fd07169a80 [util] Support casts from int/uint to size_t
I don't want to do implicit down casts (size_t to uint) but I needed to
be able to reference swapchain array size.
2021-01-10 15:27:39 +09:00
Bill Currie a35eec3877 [util] Fail gracefully when no symtab is present 2021-01-10 15:02:24 +09:00
Bill Currie 16334158bd [util] Support struct pointer accesses in cexpr 2021-01-10 01:51:07 +09:00
Bill Currie 0c1699fdbb Fix a pile of double semicolons 2021-01-09 20:42:23 +09:00
Bill Currie 0da99bc59c [util] Add promotion from float to int to cexpr
I won't go the other way nor will I add double to float.
2021-01-05 23:41:13 +09:00
Bill Currie b493e6ac32 [util] Expose plist type check support functions 2021-01-05 23:39:52 +09:00
Bill Currie a45f8f98b6 [util] Make exprctx hashlinks double pointer
The way I wound up using the field meant that exprctx should not "own"
the hashlinks chain, but rather just point to it. This fixes the nasty
access errors I had.
2021-01-05 19:55:17 +09:00
Bill Currie 5b842da394 [util] Fix types for double and float constants 2021-01-04 00:23:48 +09:00
Bill Currie 55445a25f2 [util] Add some tests for the new cexpr work 2021-01-04 00:23:48 +09:00
Bill Currie 619fe15367 [util] Add vector swizzles to cexpr
That turned out to be a lot easier than expected: needed only 4 ifs per
vector "type" (xyzw vs rgba) instead of 340.
2021-01-04 00:23:48 +09:00
Bill Currie 4562e0b876 [util] Implement more of cexpr
This adds unary, vector and function expressions.
2021-01-04 00:23:48 +09:00
Bill Currie 81300f89f8 [util] Allow multiple types for pl fields
I want to be able to use name references, but that requires string
items, so anything that would normally be dictionary or array (or
binary, even) would also need to accept string. This seemed to be the
cleanest solution. Any custom parser would then need to check the type
and act appropriately, but any inappropriate types have already been
pre-filtered by the standard parsers.
2021-01-02 14:02:33 +09:00
Bill Currie eb52d366c8 [util] Add q-v and v-q multiplication to cexpr 2021-01-02 12:10:58 +09:00
Bill Currie 015cee7b6f [util] Add vector-quaternion shortcut functions
Care needs to be taken to ensure the right function is used with the
right arguments, but with these, the need to use qconj(d|f) for a
one-off inverse rotation is removed.
2021-01-02 10:44:45 +09:00
Bill Currie 7bf90e5f4a [util] Sort out implementation issues for simd 2021-01-02 09:55:59 +09:00
Bill Currie 1fd02322f4 [util] Clean up some minor issues in cmem
I forgot to remove the noinline attribute and do a check with
optimization (to catch the "pure" recommendation).
2021-01-01 22:29:31 +09:00
Bill Currie efdbd59909 [util] Fix handling of sline's list 'pointer'
I forgot to right-shift the value so offsets were becoming 0 or 8
instead of 0-15. This fixes the management of small objects. It turns
out that after this fix, qfvis's problems were caused by fragmentation
in the windings. Need to revisit line allocation and use POT-specialized
pools.
2020-12-30 18:20:11 +09:00
Bill Currie 9090c53519 [util] Add failing sub-line allocator tests
I think the sub-line allocator falling over is the final source of
qfvis's leaks. It certainly causes a mess of the sub-lines. But having
some tests to get working sure beats scratching my head over qfvis :)
2020-12-30 18:20:11 +09:00
Bill Currie d12abc5132 [util] Relink grown free line block
This fixes one source of memory leaks, but it seems some are still
lurking as qfvis still leaks like a sieve.
2020-12-30 18:20:11 +09:00
Bill Currie 73544f0790 [util] Split cmem's free cache-line over size bins
They're binned by powers of two (with in between sizes going to the
smaller bin should I make cache-line allocations NPOT (which I think
might be worthwhile). However, there seems to still be a bug somewhere
causing a nasty leak as now my hacked qfvis consumes 40G in less than a
minute.
2020-12-30 18:20:11 +09:00
Bill Currie 4039075f41 [util] Use a linked list of free cache lines
The idea is to not search through blocks for an available allocation.
While the goal was to speed up allocation of cache lines of varying
cluster sizes, it's not enough due to fragmentation.
2020-12-30 18:20:11 +09:00
Bill Currie 3125009a7c [util] Add vector and quaternion types to cexpr
Although there's no distinction between the two at the C level, I think
it's probably best to separate them in a scripting language.
2020-12-30 18:20:11 +09:00
Bill Currie 1ddd57b09e [util] Add qconj, vtrunc, vceil and vfloor functions
I had forgotten these rather critical functions. Both double and float
versions are included.
2020-12-30 18:20:11 +09:00
Bill Currie 03fcb530c7 [util] Make quat test failure prints clearer 2020-12-30 18:20:11 +09:00
Bill Currie 09a10f80e1 [util] Add basic SIMD implemented vector functions
They take advantage of gcc's vector_size attribute and so only cross,
dot, qmul, qvmul and qrot (create rotation quaternion from two vectors)
are needed at this stage as basic (per-component) math is supported
natively by gcc.

The provided functions work on horizontal (array-of-structs) data, ie a
vec4d_t or vec4f_t represents a single vector, or traditional vector
layout. Vertical layout (struct-of-arrays) does not need any special
functions as the regular math can be used to operate on four vectors at
a time.

Functions are provided for loading a vec4 from a vec3 (4th element set
to 0) and storing a vec4 into a vec3 (discarding the 4th element).

With this, QF will require AVX2 support (needed for vec4d_t). Without
support for doubles, SSE is possible, but may not be worthwhile for
horizontal data.

Fused-multiply-add is NOT used because it alters the results between
unoptimized and optimized code, resulting in -mfma really meaning
-mfast-math-anyway. I really do not want to have to debug issues that
occur only in optimized code.
2020-12-30 18:20:11 +09:00
Bill Currie 4f8a06ddd3 [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-28 18:58:51 +09:00
Bill Currie d824db68a5 [util] Zero plist symtabl object memory 2020-12-25 00:28:26 +09:00
Bill Currie fefb32bf13 [util] Add a PL dictionary to hash table parser 2020-12-24 16:06:34 +09:00
Bill Currie cb2bdb0224 [util] Rename PL_ParseDictionary to PL_ParseStruct
Struct is far more appropriate for its function, and I need to parse a
dictionary into a hash table.
2020-12-24 13:33:37 +09:00
Bill Currie 5b0da2b14c [util] Add an int to uint cast for cexpr 2020-12-24 09:57:24 +09:00
Bill Currie 5864b553ef [util] Add accessors for binary plist objects 2020-12-23 14:07:30 +09:00
Bill Currie 91c5baa708 [util] Add size_t support to cexpr 2020-12-23 14:06:20 +09:00
Bill Currie 79f22ffebf [util] Propagate cexpr errors back to the caller
Not much point in error detection when it's ignored.
2020-12-21 20:15:43 +09:00
Bill Currie 4649294a27 [util] Fix inferred binary operator type checking
The problem is that I needed to support dynamic types on operators (for
bit-field enums), had things working, but a bad edit messed things up
and I had to rebuild that bit of code. Missed one bit :P
2020-12-21 14:47:15 +09:00
Bill Currie f3682638d4 [util] Add a mini expression parser
It is capable of parsing single expressions with fairly simple
operations. It current supports ints, enums, cvars and (external) data
structs. It is also thread-safe (in theory, needs proper testing) and
the memory it uses can be mass-freed.
2020-12-21 14:22:42 +09:00
Bill Currie 591667c36d [util] Add a context parameter to the plist parsers
Not used by the dict/array parsers themselves, but is passed on to any
value parser callbacks for their own use.
2020-12-21 14:22:42 +09:00
Bill Currie ebcef5c8a4 [util] Deal with gcc optimizing out isnan checks
This occurs because of -ffast-math, but I need to investigate how much
of an impact disabling it has on QF's performance.
2020-12-21 14:14:38 +09:00
Bill Currie ab04a1915e [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-21 14:14:29 +09:00
Bill Currie af814ff9a8 [util] Add a cache-line aligned memory allocator
This was inspired by
Hoard: A Scalable Memory Allocator
  for Multithreaded Applications

 Emery D. Berger, Kathryn S. McKinley, Robert D. Blumofe, Paul R.
 Wilson,

It's not anywhere near the same implementation, but it did take a few
basic concepts. The idea is twofold:
1) A pool of memory from which blocks can be allocated and then freed
en-mass and is fairly efficient for small (4-16 byte) blocks
2) Tread safety for use with the Vulkan renderer (and any other
multi-threaded tasks).

However, based on the Hoard paper, small allocations are cache-line
aligned. On top of that, larger allocations are page aligned.

I suspect it would help qfvis somewhat if I ever get around to tweaking
qfvis to use cmem.
2020-12-21 14:14:29 +09:00
Bill Currie 62f3e1f428 [util] Calculate quaternion to rotate between two vectors
The calculation fails (produces NaN) if the vectors are anti-parallel,
but works for all other combinations. I came up with this implementation
when I discovered Unity's Quaternion.FromToRotation could did not work
with very small angles. This implementation will produce a usable
quaternion below 0.00255 degrees (though it will be slightly larger than
unit). Unity's failed such that I could see KSP's skybox snap while it
rotated around my test vessel.
2020-12-21 14:14:10 +09:00
Bill Currie e991c44232 [util] Make a minor improvement to QuatMultVec
Switch from using addition to multiplication for doubling the value.

Also, fix lib/util/test Makemodule to actually work (too much c&p
coding).
2020-12-21 14:13:57 +09:00
Bill Currie fdcdbefc05 [sizebuf] Add function to dump contents of a buffer
The usual 8-bit hex + chars (with chars wrapped into 7-bits) with
addresses block.
2020-08-17 13:07:44 +09:00
Bill Currie 9f4f63796b [util] Fix some unitialized vars
Not sure how they got past gcc. Maybe a bug in 9.3.0?
2020-07-17 00:23:09 +09:00
Bill Currie 2b23e01d9a [util] Make PL_Type and PL_Line const-correct 2020-07-17 00:22:47 +09:00
Bill Currie 16c6818612 [util] Set parsed array size correctly
The array has to be allocated using byte elements and thus the size of
the array is the number of bytes, but it needs to be the actual number
of elements in the array. Problem caused by not knowing the actual type
(and C not having type variables anyway).
2020-07-16 22:14:19 +09:00
Bill Currie 26cd93f788 [util] Expose PL_Message
It's far to useful elsewhere.
2020-07-16 22:14:19 +09:00
Bill Currie ef33adac56 [util] Make PL_String const correct 2020-07-16 22:14:19 +09:00
Bill Currie 72f583f16f [util] Fix some plist object parsing errors
Forgot to break after finding the field when parsing a dictionary
object, and use the correct parser for array objects.
2020-07-16 22:14:19 +09:00
Bill Currie c6a8829a52 [util] Add code to parse a plist array to an array 2020-07-14 12:05:34 +09:00
Bill Currie 8bd5f4f201 [util] Add code to parse a dictionary to a struct
PL_ParseDictionary itself does only one level, but it takes care of the
key-field mappings and property list item type checking leaving the
actual parsing to a helper specified by the field. That helper is free
to call PL_ParseDictionary recursively.
2020-07-05 16:53:35 +09:00
Bill Currie f6ea9e4d87 [util] Store source line in plist items
The first line of the parsed item is stored and can be retrieved using
PL_Line. Line numbers not stored for dictionary keys yet. Will be 0 for
any items generated by code rather than parsed from a file or string.
2020-07-01 21:47:09 +09:00
Bill Currie 86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +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 7ae047654b [util] Rework SEB affine/convex testing
When I ported SEB to python, I discovered that I apparently didn't
really understand the paper's description of the end condition and the
usage of the affine and convex sets for center testing. This cleans up
the test and makes SEB more correct for the cases that have less than 4
supporting points (especially when there are less than 4 points total).
2020-06-21 17:07:54 +09:00
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 1a7add3f6d Merge branch 'master' into vulkan 2020-03-20 13:04:41 +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 79719babda [util] Fix darray test for gcc purity 2020-03-20 12:56:09 +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 0cb04dc490 Add a set of macros for dynamic arrays
Includes docs and test cases.
2020-02-17 16:17:21 +09:00
Bill Currie e37aba364a Correct an apparent typo
Black makes much more sense than Slack, especially if the text is from a
quake mod (no idea where, though).
2020-02-17 12:58:23 +09:00
Bill Currie e164002050 Make QuatToMat faster and more accurate
The better accuracy is for specific cases (90 degree rotations around a
main axis: the matrix element for that axis is now 1 instead of
0.99999994). The speedup comes from doing fewer additions (multiply
seems to be faster than add for fp, at least in this situation).
2019-07-23 08:52:15 +09:00
Bill Currie 452eb5a83d Preserve parsed cvar values when string is same
Fixes parsed developer flags on the command line getting reset.
2019-07-09 20:16:08 +09:00
Bill Currie 8c238d3def Parse developer flag names when cvar is set
So much easier to remember "vulkan" instead of which power of two it
is.
2019-07-09 20:14:57 +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