Bill Currie
cc24e2e67e
Initialize global string vars correctly.
...
Ouch, I'd fixed that for arrays, but not normal vars.
2012-11-09 12:23:04 +09:00
Bill Currie
9095e1eabc
Rework build_switch to use initialize_def.
...
This required support for label reference expressions, whose purpose is to
represent the address of a label.
2012-11-09 12:22:34 +09:00
Bill Currie
ec98e3e206
Mark alias def chains as a bug.
2012-05-03 13:27:30 +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
2de7733b6a
Fix initialized variable type handling.
...
Same problem as initialized constants :P
2011-03-30 21:21:38 +09:00
Bill Currie
8e18c76bde
Make initialized variables defs rather than immediate constants.
2011-03-30 19:58:09 +09:00
Bill Currie
7dbd2ec172
Allow field aliasing.
...
Initializing a field variable to another field will set the new field to
point to the same location. No type checking is done.
eg:
.SEL thinkMethod = think;
2011-03-30 09:33:47 +09:00
Bill Currie
8d3508cf20
Allocate space for temp defs using size rather than type.
...
Statement operands throw away the high level type information, so store
type size in the operand and use this size for allocating space for temps
rather than using the low-level type.
2011-03-23 21:32:14 +09:00
Bill Currie
d4be914019
Fix initialized vector variables.
...
The whole initialized variable system is wonky, but it will do for now.
2011-03-22 15:10:06 +09:00
Bill Currie
7dbd5f656c
Fix traditional vector component access.
2011-03-22 13:05:42 +09:00
Bill Currie
f1d9570dc8
Fix constant value type handling.
...
Rename immediate.[ch] to value.[ch] and clean up the mess.
Add convert_value() to convert the type of a value (only scalar types).
2011-03-22 12:24:39 +09:00
Bill Currie
0c0f4360da
Make field defs "nosave".
...
The engine treats fielddefs with DEF_SAVEGLOBAL set as bogus.
2011-03-21 17:06:45 +09:00
Bill Currie
2464a89d37
Preserve relocs across def churning.
...
Freeing then re-allocating a def to change its storage from external is
really not the right way to do it, but for now this fixes the loss of the
relocs. With this, the menus seem to work :)
2011-03-09 10:52:29 +09:00
Bill Currie
7c770b75c5
Do not creat field defs for local storage.
...
This prevents field params and local vars from messing up the real field
defs.
2011-03-08 19:56:02 +09:00
Bill Currie
7649549de6
Handle external field declarations.
2011-03-07 17:23:52 +09:00
Bill Currie
49e446b637
Make field defs global.
...
It turns out that field defs need to be global after all, so use separate
field def tables in the linker.
2011-03-07 14:45:50 +09:00
Bill Currie
29cac0fe3a
Optionally create *_[xyz] symbols for accessing vector components.
...
"vector-components" in code options controls this feature. The default is
off for advanced code and on for traditional code. Disabling
vector-components prevents the comonent names polluting the namespace and
reduces the number of globals needed for vector fields if the components
of that field are never used.
2011-03-07 10:21:40 +09:00
Bill Currie
8712d30d1a
Make entity field defs static.
...
Entity field defs need to be static in order to avoid clashing with their
field variables.
2011-03-06 15:41:15 +09:00
Bill Currie
fe3d228658
Maintain a symbol table for entity fields.
2011-03-06 15:38:19 +09:00
Bill Currie
7209c61912
Fix initializing local float variables with an integer constant.
...
Run the assignment expression through fold_constants to handle any
necessary conversions and error checking.
2011-03-05 17:23:58 +09:00
Bill Currie
cfefd79e07
Fix the source of bogus string relocs.
...
Nested aggregate initializers were corrupting themselves.
2011-03-05 09:21:12 +09:00
Bill Currie
c06dd776d2
Fix expression initializers for arrays and structs.
2011-03-02 22:28:17 +09:00
Bill Currie
c10a551c84
Rename new_defspace() and defspace_new_loc().
2011-02-24 13:07:36 +09:00
Bill Currie
e68e6d0858
Create defs for entity fields in the entity space.
2011-02-22 15:43:15 +09:00
Bill Currie
7d1f2c4ef3
Fix field def allocation for non-function fields.
2011-02-22 10:43:35 +09:00
Bill Currie
b7c6c4af5d
Better variable naming in init_elements().
2011-02-22 09:22:04 +09:00
Bill Currie
0f0ed3dae2
Allow null types in defs again.
...
However, only at the lowest level. This is needed for my type encoding.
2011-02-18 09:04:33 +09:00
Bill Currie
4e86b28b59
Use the def type rather than expression type to select the init method.
...
Local defs may be initialized with non-constant expressions, which
includes function calls. Both function calls and aggregate initializers
use block expressions.
2011-02-15 09:38:44 +09:00
Bill Currie
19f6faf0ad
Fix aggregate initializers.
...
Initializing arrays and structs seems to be working.
2011-02-15 09:30:37 +09:00
Bill Currie
f1fccb19dd
Allow same-type re-declarations of uninitialized variables.
...
This is especially important for declaring variables that were previously
declared external.
2011-02-14 23:10:46 +09:00
Bill Currie
23b01be214
Handle invalid initializers gracefully.
2011-02-14 23:10:46 +09:00
Bill Currie
4c63a0bad6
Generate a warning when creating a var with no type.
...
This makes the internal error in new_def() non-functional, but the warning
will catch the bug and there's no harm in leaving the test in new_def().
2011-02-14 23:10:46 +09:00
Bill Currie
3e5989463f
Update the def_tail when removing the last def from the space.
2011-02-14 23:10:45 +09:00
Bill Currie
c336aaeb80
Handle incomplete types gracefully.
2011-02-13 19:26:20 +09:00
Bill Currie
8c01497936
Give __obj_exec_class a sterner beating.
...
When linking a def into a defspace, ensure it can be removed. This fixes
the missing __obj_exec_class def in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
0efc759f2d
Catch attempts to create a def with a null type.
2011-02-11 22:29:57 +09:00
Bill Currie
c3a991e555
Support nil in initializers.
2011-02-10 14:51:52 +09:00
Bill Currie
01a7af17e5
Beat __obj_exec_class into submission.
2011-02-10 00:15:19 +09:00
Bill Currie
afc6605739
Don't set the space for external defs.
2011-01-29 09:55:14 +09:00
Bill Currie
f45919df09
Need alias defs after all.
2011-01-25 15:42:26 +09:00
Bill Currie
726f293d0d
Allocate space for defs and handle basic initializations.
...
Block initializers (arrays and structs) are still broken.
2011-01-25 12:16:13 +09:00
Bill Currie
0624408317
Move the diagnostic functions into their own file.
2011-01-24 21:54:57 +09:00
Bill Currie
afc5b2827d
Simplify def handling, use far data.
...
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.
Also, start using far data for ObjQC structures.
The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00
Bill Currie
4a24393d8d
Temp expressions now use operands instead of defs.
2011-01-21 11:26:43 +09:00
Bill Currie
ea3895805b
Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
...
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.
emit.c has been gutted in the spirit of "throw one away".
There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
Bill Currie
85de101aa3
Break out the defspace code.
...
This also makes some improvements to the free block handling code.
2011-01-17 22:34:41 +09:00
Bill Currie
75ec6bf244
Clean out some unnecessary types from the progs engine and clean up the mess.
...
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
fac98536f0
make sure def->space points to the space the def's location is allocated from to ensure that freeing the location works properly (fixes the bogus address triggered by prozaccoop: thanks, phrosty)
2010-02-22 13:11:41 +00:00
Bill Currie
d558444b77
make temp def problems a little easier to understand
...
o set return_address whenever a temp def is requested, no only when it is
actually created.
o make the notices about temp reference counting problems a little more
readable and include the name of the temp
2010-01-13 06:24:29 +00:00
Bill Currie
680bc22697
better error reporting for redefines
2007-05-13 09:02:51 +00:00