Bill Currie
66dd3ef070
Make a bunch of count things positive-only
...
This fixes a pile of FIXMEs, because some things should never be
negative.
2020-02-25 21:23:13 +09:00
Bill Currie
282132958f
Relocate local def type encodings in debug load
...
For technical reasons (programmer laziness), qfcc does not fix up local
def type encodings when writing the debug symbols file (type encoding
location not readily accessible).
2020-02-25 20:46:01 +09:00
Bill Currie
4bc36836a1
Correct the type of an aux function's return type
...
It was made to be the address of the type encoding long ago.
2020-02-25 20:17:20 +09:00
Bill Currie
89e83d7d73
Move the debug info out of progs_t
...
The debug subsystem now uses the resources system to ensure it cleans
up, and its data is now semi-private. Unfortunately, PR_LoadDebug had to
remain public for qfprogs because using PR_RunLoadFuncs would cause
builtin resolution to complain.
2020-02-25 20:07:29 +09:00
Bill Currie
ca6fe0730b
Fix qfcc test harness tracing
...
Just a consequence of progs execution state being initialized properly.
2020-02-25 19:02:24 +09:00
Bill Currie
6739f5df4d
Fix an out-by-one error
...
Noticed while sorting out pr_argc
2020-02-25 17:39:34 +09:00
Bill Currie
a55b9544ac
Improve handling of pr_argc
...
It is now set to 0 when progs are loaded and every time
PR_ExecuteProgram() returns. This takes care of the default case, but
when setting parameters, pr_argc needs to be set correctly in case a
vararg function is called.
2020-02-25 17:36:29 +09:00
Bill Currie
e3953be8f8
Ensure execution state is initialized on progs load
2020-02-25 15:25:10 +09:00
Bill Currie
61d7f4f9c4
Dump locals stack when dumping main stack
...
Any shutdown functions in progs will need locals too.
2020-02-25 15:18:15 +09:00
Bill Currie
6a4ef598ab
Allow progs num_edicts and reserved_edicts to be null
...
Really, while there are edict related instructions, edict support should
probably not be in the VM itself.
2020-02-25 15:00:33 +09:00
Bill Currie
6e56c9a4aa
Ensure edict_parse is reset on progs load
...
A server switching from a game that sets edict_parse to one that does
not could go badly when it comes time to loading a level.
2020-02-25 14:40:03 +09:00
Bill Currie
9bb68f2d8c
Allow nested use of PR_SaveParams()
...
PR_SaveParams() is required for implementing the +initialize diversion
used by Objective-QuakeC because builtins do not have local def spaces
(of course, a normal stack calling convention would help). However, it
is entirely possible for a call to +initialize to trigger another call
to +initialize, thus the need for stacking parameter stashes. As a
bonus, this implementation cleans up some fields in progs_t.
2020-02-25 14:30:26 +09:00
Bill Currie
99c818adcc
Ensure progs zone is always set on load
2020-02-25 00:25:24 +09:00
Bill Currie
256dee98a1
Make progs string resources management private
...
Strangely enough, using the progs resources system. This is a step
towards having progs that can be reset properly, or even dynamically
created VMs.
2020-02-25 00:23:08 +09:00
Bill Currie
1cfac0f11a
Resolve local def type encodings
...
They need to be resolved at load-time.
2020-02-25 00:12:02 +09:00
Bill Currie
c51c9edd9d
Fix incorrect encoding of local defs
2020-02-25 00:11:01 +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
a30433fa9e
Make header protection consistent
...
And delete a couple of useless files.
2020-02-24 12:21:20 +09:00
Bill Currie
7406e0308e
Fix some warnings picked up in an optimized build
2020-02-24 11:28:43 +09:00
Bill Currie
c43b9681eb
Keep structure members aligned
2020-02-24 08:43:32 +09:00
Bill Currie
2adcad7c84
Allow non-short-circuited logic to work
2020-02-24 02:25:28 +09:00
Bill Currie
ac32bbca40
Improve code for short-circuited float logic
2020-02-24 02:14:44 +09:00
Bill Currie
9c26d12f95
Cast rather than alias for testing constants
...
Fixes ICE in do { ... } while (1);
2020-02-24 02:13:23 +09:00
Bill Currie
55e53211e2
Generate default type expressions for folded booleans
2020-02-24 02:11:31 +09:00
Bill Currie
d6752c254c
Move short-circuit boolean code to its own file
2020-02-24 01:20:24 +09:00
Bill Currie
0bf7ec07b7
Make debug output verbosity 2
...
and internal diagnostic sources level 1.
2020-02-24 00:22:13 +09:00
Bill Currie
11365024d2
Fix writing of frames files when not requested
...
I forgot to check for the option for separate compilation.
2020-02-24 00:07:48 +09:00
Bill Currie
27ae5ccfce
Fix ICE after incomplete type error
...
Attempting to define a variable with an incomplete type is an error, and
results in a default size 1 of allocated, but I forgot to set default
alignment when implementing alignment.
2020-02-24 00:07:39 +09:00
Bill Currie
f387b9aa47
Propagate implicit for negating double constants
2020-02-23 23:41:12 +09:00
Bill Currie
dda045bf96
Do lazy computation of def sizes from type encodings
...
The size is calculated when needed and cached.
2020-02-23 23:29:58 +09:00
Bill Currie
5374798ef9
Fix order of operations for implicit casts
2020-02-23 23:18:31 +09:00
Bill Currie
05f6ddbb13
Print promoted warnings as errors
...
This makes it much easier to see why a compilation failed when only
warnings are visible.
2020-02-23 23:10:56 +09:00
Bill Currie
526c27cf03
Handle implicit casts for double/float comparisons
2020-02-23 23:10:10 +09:00
Bill Currie
607fd2e30e
Allow constant initialized globals in advanced code
...
Use -C const-initializers to enable (or no-const-initializers to disable
in traditional/extended code).
2020-02-23 22:51:00 +09:00
Bill Currie
e23aa40994
Implicitly cast unadorned floating point constants
...
Floating point constants without f or d adornments will automatically
cast, without warnings, to the type appropriate to the rest of the
expression.
2020-02-23 22:28:54 +09:00
Bill Currie
14cde99d6e
White space
...
of the worst sort.
2020-02-23 22:27:07 +09:00
Bill Currie
e6f243323e
Fix type of class in qfo type encodings
2020-02-23 22:26:09 +09:00
Bill Currie
23573953a7
Change pr_type_size to pr_ushort_t
2020-02-23 22:25:08 +09:00
Bill Currie
7efefceee2
Fix a comment
2020-02-23 22:21:25 +09:00
Bill Currie
ea3af84baa
Fix ICE when const-folding doubles
...
I really need to rework that system.
2020-02-23 20:49:56 +09:00
Bill Currie
2a39208069
Set void alignment to 1
...
qcc allowed void variables.
2020-02-23 20:48:43 +09:00
Bill Currie
c9fca9c98a
Fix another inside-out type utility function
2020-02-23 20:48:12 +09:00
Bill Currie
c3c55f0bcc
Fix some source formatting
2020-02-23 19:05:43 +09:00
Bill Currie
d0dc0e15fb
Handle alias types in debug prints
2020-02-23 19:02:16 +09:00
Bill Currie
b173c35eb4
Rework progs debug to use the type encodings
...
It's only a start: the output is, if anything, slightly worse than
before, but it does have the basics going.
2020-02-23 19:01:59 +09:00
Bill Currie
4b7ecdf74a
Make PR_Init take an instance to initialize
...
This allows internal sub-systems to do per-instance initializations
without other engine systems having to know about them.
2020-02-23 18:32:16 +09:00
Bill Currie
6009d1d023
Fix qfo strings dumping
2020-02-23 15:08:31 +09:00
Bill Currie
b0157e5095
Fix qfo field dumping
2020-02-23 14:56:50 +09:00
Bill Currie
81293d98dd
Fix qfo line info dumping
...
The addition of xdef data has made qfo_to_progs unusable in qfprogs,
resulting in various invalid memory accesses. It always was an ugly hack
anyway, so this is the first step to proper qfo support in qfprogs.
2020-02-23 14:44:25 +09:00