Bill Currie
0bd0f783b2
Update def offsets with their final locations.
2011-03-04 23:37:46 +09:00
Bill Currie
6d02555ca9
Reorganize the offset calculations.
...
keep the offset calculations separate from the data transfers for better
clarity in what is happening.
2011-03-04 23:31:09 +09:00
Bill Currie
e62163e569
Nuke any invalidated relocs.
2011-03-04 21:46:19 +09:00
Bill Currie
2565e0db32
Update reloc targets when linking.
2011-03-04 21:29:47 +09:00
Bill Currie
bc78b84869
Set the target of string relocs to the string index.
2011-03-04 21:29:10 +09:00
Bill Currie
7fb22bd1e4
Make D_STRING() more useful and add D_GETSTR()
2011-03-04 21:28:12 +09:00
Bill Currie
e04f6266b1
Nuke def_list from defref_t.
...
It didn't work :/.
2011-03-04 20:40:01 +09:00
Bill Currie
5a552d8841
Add the null function.
2011-03-04 20:29:40 +09:00
Bill Currie
368a3826be
Redo the offset and size calculations for qfo_to_progs().
2011-03-04 20:14:02 +09:00
Bill Currie
cd12a78f93
Replace some accidentally deleted code.
...
Forgot to commit it the first time round, then rebase messed me up and I
didn't notice until after pushing. *sigh*
2011-03-04 19:02:47 +09:00
Bill Currie
72fae608e5
Write the function start address to the progs file.
...
Oops:P
2011-03-04 18:46:28 +09:00
Bill Currie
2211a807d4
Do not relocate builtin functions.
2011-03-04 18:46:25 +09:00
Bill Currie
d6d8b5b49d
Generate the debug symbol file.
2011-03-04 18:46:05 +09:00
Bill Currie
9a96febdf5
Fix the hordes of bogus defs.
...
They were caused by unused external defs, so not processing unused externs
in the first place is the simplest solution.
2011-03-04 14:51:09 +09:00
Bill Currie
7b7f4c70e0
Correct non-external def processing.
2011-03-04 14:33:03 +09:00
Bill Currie
c5dac6d1d1
Transfer the type encoding.
...
oops
2011-03-04 14:29:22 +09:00
Bill Currie
d0b4546383
qfprogs isn't yet fully functional...
2011-03-04 13:54:29 +09:00
Bill Currie
2992d66f87
Simplify the tag used for anonymous structs etc.
...
Hopefully two files with the same file name won't have anonymous stucts on
the same line.
2011-03-04 13:52:32 +09:00
Bill Currie
e525727a24
Add a null type descriptor to the linker output.
2011-03-04 11:38:33 +09:00
Bill Currie
3a828ca5c2
Ensure work spaces are always connected to their data.
2011-03-04 11:18:56 +09:00
Bill Currie
45c3dd67a8
Some test updates.
2011-03-04 08:27:26 +09:00
Bill Currie
4192ef835c
Delay initialization of obj_module_t as long as possible.
...
This keeps the type descriptor out of progs that never use any
Objective-QC features.
2011-03-04 08:25:50 +09:00
Bill Currie
c99f3aba0e
Add the new header files for make dist.
2011-03-04 00:11:13 +09:00
Bill Currie
fd24524e13
More tests.
...
I really need to sort out some test automation.
2011-03-03 22:32:22 +09:00
Bill Currie
ee9045c377
Emit code for jump tables.
...
With this, the entirety of the ruamoko tree builds (though the progs will
be broken in various ways: mostly unrelocated references).
2011-03-03 19:09:00 +09:00
Bill Currie
a281033920
Alais the jump table's array to an integer.
...
As per the previous commit, I'm not sure this is the right thing to do, but
it works for now.
2011-03-03 19:07:37 +09:00
Bill Currie
4324486ae6
Give - unary expressions special treatment.
...
The progs engine has no neg instruction, so need to implement -val as
nil - val
2011-03-03 18:13:30 +09:00
Bill Currie
f9e177efd6
Obtain the label to be removed from the correct place.
...
This fixes the undetected dead block after "if return else return".
2011-03-03 17:50:46 +09:00
Bill Currie
ed901bd48f
Drop unused labels rather than adding them to the statement block.
...
However, even unused labels create a new statement block if necessary.
2011-03-03 17:35:06 +09:00
Bill Currie
b5e7e666e9
Fix some missed branch/goto expression changes.
2011-03-03 17:33:53 +09:00
Bill Currie
c5ecc170b6
Give labels a usage count to detect unused labels.
2011-03-03 15:28:49 +09:00
Bill Currie
90640614ef
Compare symbols using the right method.
...
That fixme was right :)
2011-03-03 15:02:26 +09:00
Bill Currie
610d775bd1
Treat void values as the largest type.
...
This fixes passing nil through a structure return value.
2011-03-03 14:56:21 +09:00
Bill Currie
bad5fddec4
Fix overloaded function resolution.
...
Update the expression symbol pointer, not just the symbol name.
2011-03-03 14:44:48 +09:00
Bill Currie
fff4fc693e
Fix value hashing and comparison in switch expressions.
2011-03-03 14:02:18 +09:00
Bill Currie
74e6b13aee
Use alias expressions where possible when testing an expression.
2011-03-03 13:47:28 +09:00
Bill Currie
d937172243
Create and use alias operands for alias expressions.
...
This avoids the alias expression modifying the operand used in other
expressions.
2011-03-03 13:46:07 +09:00
Bill Currie
022fde666f
Implement unary expression statements.
2011-03-03 13:10:07 +09:00
Bill Currie
45de7327dc
Implement alias expressions (finally).
...
Alias expressions are like cast expressions, but never do any conversions.
2011-03-03 11:06:10 +09:00
Bill Currie
848994323e
Support enums in expressions that support scalar types.
2011-03-03 10:36:43 +09:00
Bill Currie
c12211d8bb
Support enum results for boolean expressions.
...
eg enum BOOL x = a && b;
2011-03-02 22:46:55 +09:00
Bill Currie
c06dd776d2
Fix expression initializers for arrays and structs.
2011-03-02 22:28:17 +09:00
Bill Currie
76f912c7a1
Fix function typedefs.
2011-03-02 22:23:24 +09:00
Bill Currie
aa4ed00090
Fix the message type used to check arguments.
2011-03-02 22:13:16 +09:00
Bill Currie
4a99f8dcbd
Write the linker output to progs.dat.
...
There is much breakage, but qfcc now produces a progs.dat from either
progs.src or object files. Better yet, the progs.src result is passed
through the linker, removing much duplicate code.
2011-03-02 20:51:00 +09:00
Bill Currie
29985efcef
Expose some linker functions to the rest of the compiler.
...
They proved to be useful for cleaning up the final compilation stages.
2011-03-02 20:48:55 +09:00
Bill Currie
8cdd28f534
Use qfo_to_progs() for dumping qfo data.
...
Yay, less duplicate code, and better yet, qfo_to_progs gets some much
needed testing :).
2011-03-02 19:08:11 +09:00
Bill Currie
ecb995a8f7
Rewrite qfo_to_progs() to go direct from qfo to progs.dat.
...
Relocs and debug info is currently broken.
2011-03-02 19:06:43 +09:00
Bill Currie
824d8bfc3c
Remove some now unnecessary functions.
2011-03-02 14:21:20 +09:00
Bill Currie
065d3e0dd7
Partial linking for a single qfo file now seems to work.
2011-03-02 14:03:41 +09:00
Bill Currie
bfeece3255
Fix the bogus declarations of obj_msgSend and obj_msgSend_super.
2011-03-02 12:35:10 +09:00
Bill Currie
fda46a4aca
Handle the special defs.
2011-03-02 12:26:53 +09:00
Bill Currie
330e76a9ac
Set the correct storage class for struct and enum specifiers.
2011-03-02 11:29:08 +09:00
Bill Currie
54317965cc
Handle relocs.
...
With this, the building of the work qfo seems to be almost finished, just
the special defs to go. Next step will be to stitch all the parts of the
work qfo into a real qfo.
However, still have to fix the relocs for the type descriptors, but they
are not critical to the linker's functioning.
2011-03-02 11:16:35 +09:00
Bill Currie
8669dc373f
Add some documentation.
2011-03-02 11:13:44 +09:00
Bill Currie
65bd215058
Minor rearrangements.
2011-03-01 15:35:14 +09:00
Bill Currie
2cb1c74718
More progress on the linker.
...
Need to finish up defs and handle relocs, and then take care of special
defs (@self etc), but things are getting very close.
2011-03-01 15:18:47 +09:00
Bill Currie
9f126ed805
Add some quick type access macros.
2011-03-01 15:18:12 +09:00
Bill Currie
b584a22d6b
Fix external function declarations.
...
Use spec.storage rather than current_storage.
2011-03-01 11:08:33 +09:00
Bill Currie
cce6838e16
Ensure .ctor is declared static.
2011-03-01 11:08:32 +09:00
Bill Currie
c36919aae7
Fix verbosity and diagnostic messages.
2011-03-01 11:08:32 +09:00
Bill Currie
cfff2b1037
Add defs from near and far data spaces.
2011-03-01 10:52:27 +09:00
Bill Currie
21558864b9
Make defrefs a little more stupid.
...
Stupid code does little well :P
I forgot that spaces get realloced, and I don't remember why I had the def
list pointer separate anyway.
2011-03-01 09:19:04 +09:00
Bill Currie
1416b996d3
Ensure the type space pointer is cleared with each object file.
2011-03-01 09:18:09 +09:00
Bill Currie
30272968c9
Update the def's type pointer.
2011-03-01 09:17:32 +09:00
Bill Currie
1837518d05
Split the space processing into two passes.
...
This allows strings and types to be handled before code and data.
2011-03-01 08:48:58 +09:00
Bill Currie
eb11a19ed4
Split the type processing into two passes.
...
This allows all duplicate types to be "merged" before adding any new
types, thus avoiding any accidental duplication caused by possible
differences in order between defs and the type descriptors.
2011-03-01 08:46:02 +09:00
Bill Currie
05e6f00e72
Initialize the new type def.
...
Oops :P
2011-03-01 08:16:14 +09:00
Bill Currie
3761cddca6
Finally, some real progress on the linker.
...
There is still much to be done, but this seems to be a workable approach.
2011-02-28 23:18:07 +09:00
Bill Currie
bad7078797
Don't set the space defs pointer if there are no defs.
2011-02-28 23:16:59 +09:00
Bill Currie
5d9fbc2d6d
Set the space ids to the destination space.
...
This is mostly redundant, but it allows qfo spaces to get out of order
without breaking everything.
2011-02-28 23:16:19 +09:00
Bill Currie
b544196c21
Change ptrfld to fldptr for consistency with type.h.
2011-02-28 23:12:32 +09:00
Bill Currie
8b661bbb89
Rename qfo_reloc_t's def to target and correct its usage.
2011-02-27 11:37:24 +09:00
Bill Currie
c8f1b5b1f0
Fix the missing type encoding for structures.
...
There should be a better way (probably by doing the encoding as needed
rather than in chain_type), but this seems to work for now.
2011-02-27 00:39:40 +09:00
Bill Currie
438d14d852
More or less fix qfprogs when dumping info from qfo files.
...
Relocations are still broken, but everything seems to be working and
qfprogs now seems to be generally usable.
2011-02-27 00:36:45 +09:00
Bill Currie
4f6d18a328
Encode the basic type for functions, fields and pointers.
...
Very important for distinguishing them from other types.
2011-02-27 00:33:16 +09:00
Bill Currie
55043310fc
Fix the QFO_POINTER macro
2011-02-27 00:31:52 +09:00
Bill Currie
9cf63dbbdf
Clean up the create of the obj_module_s structure.
2011-02-26 22:06:22 +09:00
Bill Currie
cbfbc0b01a
Ensure type_ClassPtr is chained before it is used.
2011-02-26 22:05:53 +09:00
Bill Currie
a7ae71efad
Fix some type encoding problems found using qfprogs.
2011-02-25 15:59:23 +09:00
Bill Currie
58ac212b54
Fix qfo function dumping.
2011-02-25 13:37:23 +09:00
Bill Currie
2b3436beed
Fix qfo reloc dumping.
2011-02-25 13:29:09 +09:00
Bill Currie
f43eda63fe
Fix qfo global dumping.
2011-02-25 09:39:07 +09:00
Bill Currie
65c7d421c6
Update the qfo access macros for the new format.
2011-02-25 09:38:22 +09:00
Bill Currie
f362e74f98
Update the header.
2011-02-24 15:24:35 +09:00
Bill Currie
a106c1fb51
Add a field for loose relocation records.
...
Loose relocation records are those that are not bound to a def or a
function.
2011-02-24 15:21:06 +09:00
Bill Currie
8f1e2c143a
Clean up some fixmes.
2011-02-24 14:08:42 +09:00
Bill Currie
c10a551c84
Rename new_defspace() and defspace_new_loc().
2011-02-24 13:07:36 +09:00
Bill Currie
88cd37a3e2
Header update for the renamed files.
2011-02-24 13:00:19 +09:00
Bill Currie
5efeb7ebf8
Rename some files that have been bugging me.
2011-02-24 12:59:18 +09:00
Bill Currie
66b255afbf
First stage of the linker rewrite.
...
Strings, code and data spaces are "merged". Various offsets are updated.
Still to do:
o Merge reloc, def, function and line data.
o Merge type data.
o Update def and function type pointers.
o Resolve external defs and check for duplicate defs.
o Perform relocations.
o anything else I've forgotten :)
2011-02-24 12:18:35 +09:00
Bill Currie
74497f00e1
Read qfo object files :)
2011-02-23 18:10:38 +09:00
Bill Currie
33810e9c91
Write out object files in the new format.
2011-02-23 15:05:33 +09:00
Bill Currie
1f7c39b918
Chain @va_list's type.
...
Oops :P
2011-02-23 14:49:00 +09:00
Bill Currie
a1ea492889
Remove some redundant fields from qfo objects.
2011-02-23 10:40:35 +09:00
Bill Currie
c585a17db9
Give type data a null pointer.
...
Pointers to the void type descriptor looked just like null pointers and
that was terribly confusing. Avoid that confusion by pre-allocating a
small amount of data in order to reserve space for a null descriptor.
2011-02-23 08:08:26 +09:00
Bill Currie
e68e6d0858
Create defs for entity fields in the entity space.
2011-02-22 15:43:15 +09:00
Bill Currie
e1158a83f0
Begin work on rewriting obj_file.c for the new format.
2011-02-22 15:42:49 +09:00
Bill Currie
64cf07351f
Encode types to string and qfo representation on creation.
2011-02-22 13:36:16 +09:00
Bill Currie
a07cd17f38
Update TODO.
...
Remove old entries and add some new ones.
2011-02-22 12:23:00 +09:00
Bill Currie
b50b392746
Fix field def allocation for function fields.
...
Assignment of nil to a field function is permitted, but trying to use one
as a builtin or as a normal function is treated as an error.
.void (float y) func; OK
.void (float y) bi = #0 ; error
.void (float y) ni = nil; OK
.void (float y) co = { }; error
2011-02-22 12:07:31 +09:00
Bill Currie
7d1f2c4ef3
Fix field def allocation for non-function fields.
2011-02-22 10:43:35 +09:00
Bill Currie
ecbb904d6b
More docs and clearer types.
2011-02-22 09:23:04 +09:00
Bill Currie
b7c6c4af5d
Better variable naming in init_elements().
2011-02-22 09:22:04 +09:00
Bill Currie
497db3ac81
Fix the return symbol extraction when appending a return statement.
...
The code is still icky, though :P
2011-02-22 09:20:52 +09:00
Bill Currie
4fd6bdae6f
Allow nil to be assigned to field variables.
...
Note, this is the field variable itself, not the field in the entity.
eg:
.integer x = nil;
2011-02-22 09:19:01 +09:00
Bill Currie
87b240f469
Use special treatment for .float ()foo; functions.
...
The parser wants to treat .float () foo; as a function returning a float
field, but qcc treats it as a field holding a function variable.
Fortuantely, field types are always "simple" (ie, at worst, just more
field type wrappers around the non-field type), so all that's needed to
obtain qcc grammar is to reach into the field type layers and do the
function type calculation based on the non-field type found there.
2011-02-22 08:54:01 +09:00
Bill Currie
96c6b31c66
Update qfo version and correct some comments and types.
2011-02-21 18:24:34 +09:00
Bill Currie
4c11304c8d
Documentation tweaks.
2011-02-21 08:41:03 +09:00
Bill Currie
bffc1dd239
Clean up objective-qc type encoding.
...
Structures etc now never encode the fields as well (I might revert that
at some time). Type parsing has been removed: it has proven unnecessary
and overly complicated, and the new qfo encoding should be more useful.
2011-02-18 20:51:04 +09:00
Bill Currie
41523852cd
Cleaner def and string emittion for types.
...
Use local defines for emitting defs and strings as everything goes to the
same locations.
2011-02-18 12:44:11 +09:00
Bill Currie
7251bc91fa
Enhanced type encoding.
...
This creates a compact representation of types as seen by qfcc. This is
intended mainly for debuggers.
2011-02-18 09:06:05 +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
bceb98e5a4
Create structures for new qfo format.
...
This breaks a lot of existing code, so that code has been commented out
for now.
2011-02-17 15:02:09 +09:00
Bill Currie
9c9a71f1af
Allow defs to specify use of offset relocations.
...
Access to struct fields in near data can be done using only one operand,
but offset relocs need to be used. However, as not all defs want offset
relocs, a flag has been added to the def struct.
2011-02-15 22:55:15 +09:00
Bill Currie
d04865884f
Set the method's function pointer.
2011-02-15 22:27:13 +09:00
Bill Currie
3721b2edca
Method lists are made of methods, not integers :P
2011-02-15 22:26:44 +09:00
Bill Currie
c068138d91
More addresses in hex.
2011-02-15 22:26:09 +09:00
Bill Currie
814e36d3c8
Correct an error message and tidy some code.
2011-02-15 22:25:40 +09:00
Bill Currie
4336fc2c73
Move method function defs into the far data space.
...
As they are never referenced directly by instructions, there's no need for
them to be in the near data space, taking precious def locations.
2011-02-15 15:33:18 +09:00
Bill Currie
5252d72856
Correct the type for _OBJ_SELECTOR_TABLE.
2011-02-15 15:33:12 +09:00
Bill Currie
b3da6ef3d4
Allow zero size arrays to match sized arrays of the same type.
...
This allows externally declared arrays to not specify a size.
2011-02-15 12:08:03 +09:00
Bill Currie
b2d4aee61e
Reimplement selector expressions to work with far data.
...
They currently execute a lea instruction every method call, but the
optimizer should take care of that once its written.
2011-02-15 10:48:05 +09:00
Bill Currie
6bd63f811f
Preserve any relocs when converting a def from extern to otherwise.
2011-02-15 10:47:16 +09:00
Bill Currie
62456dc1e9
Yet another test.
2011-02-15 09:48:10 +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
d162838299
Resurrect constant_expr().
2011-02-15 09:28:27 +09:00
Bill Currie
bc882ddc3c
Fix the parser side of aggregate initializers.
2011-02-14 23:31:37 +09:00
Bill Currie
09af401f0c
Reset current_func at the end of each function.
2011-02-14 23:10:46 +09:00
Bill Currie
5fa349927f
Preserve the ivars inheritance chain across build_struct().
...
build_struct() unlinks the structure symbol table from its parent, but
that breaks the ivar inheritance chain.
2011-02-14 23:10:46 +09:00
Bill Currie
5707888fcf
Fix some error-recovery segfaults.
2011-02-14 23:10:46 +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
b3d5789377
More tests.
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
ee866ae3a6
Enable the small struct optimization.
...
For now, anyway. It would probably be much better to handle this sort of
thing in the optimizer stage.
2011-02-14 23:10:45 +09:00
Bill Currie
bcaf3687c5
Fix loading structs into params via an offset pointer.
...
For certain values of "fix" :/. The code is ugly, but it does the right
thing: calculate the effect address and use the resulting pointer in a
move instruction.
2011-02-14 23:10:45 +09:00
Bill Currie
352be1f8bd
Handle null string pointers.
2011-02-14 23:10:45 +09:00
Bill Currie
e10d561459
Treat small structs as integers (disabled).
...
This is more to stash away a potential optimization. I need to fix the
real problem first.
2011-02-14 23:10:45 +09:00
Bill Currie
6b29568fa9
Set the source file and line when copying an expression.
...
This fixes the crazy line numbers in the debug info.
2011-02-14 23:10:45 +09:00
Bill Currie
fc18ebd923
Add the source line number to most node labels.
2011-02-14 23:10:45 +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
11485556e5
Quote expression names to avoid problems with null pointers.
2011-02-14 23:10:45 +09:00
Bill Currie
c139099294
Put another bandaid on the type creation system.
...
It seems that building types is very fragile: all too easy to fix things
in one place and break something somewhere else. I guess the type system
will need a comlete rewrite at some stage.
2011-02-14 23:10:45 +09:00
Bill Currie
e3325b199e
More tests.
2011-02-14 23:10:45 +09:00
Bill Currie
e0d61705b4
And fix build_struct for built-in struct types.
...
The previous fix broke builtin structs (eg, @param). Calling find_type()
for built-in structs has proven to be a bad idea :)
2011-02-13 21:07:22 +09:00
Bill Currie
a19b7ec8f9
Make struct decls actually work.
...
find_type() does type comparisons based on tag name for struct/union/enum
but when it returns the previous tag (eg, from "struct foo;") the returned
type has a null symtab pointer, so setting the symtab pointer in the type
before calling find_type() only throws away the symtab. Thus, since
find_type() doesn't check the symtab pointer when comparing the types, set
the symtab pointer after calling find_type().
2011-02-13 20:56:12 +09:00
Bill Currie
acced90101
Create the symbol for the struct as early as possible.
2011-02-13 20:55:33 +09:00
Bill Currie
b545f72f93
Report errors for incomplete types and missing fields.
2011-02-13 20:23:08 +09:00
Bill Currie
c336aaeb80
Handle incomplete types gracefully.
2011-02-13 19:26:20 +09:00
Bill Currie
ed3f98eab4
qwaq related compile fixes for the new function syntax rules.
2011-02-13 19:07:30 +09:00
Bill Currie
ef32d1fb6d
Save away some of my tests.
2011-02-13 19:02:39 +09:00
Bill Currie
976ff8a6bb
Allow cast expressions to be lvalues.
...
These really need to be alias expressions rather than cast expressions
so the two can be separated as cast expressions should not be lvalues.
2011-02-13 17:54:15 +09:00
Bill Currie
fa742ceed6
Handle @self and @this correctly.
2011-02-13 17:52:19 +09:00
Bill Currie
547f361bd3
Allow (void) qc-style functions.
2011-02-13 17:37:11 +09:00
Bill Currie
d75c35ba30
Allow qc style function params.
...
Due to ambiguities in the grammar, qc-style function params and c-style
function params had to be completely separated. This means that qc-style
functions can not use pointers and must use qc-style function declarations
for parameters, and c-style functions must use c-style param declarations.
While this rule is tedious for converting the Ruamoko library, it does
actually make for a more consistent language.
2011-02-13 17:07:14 +09:00
Bill Currie
8a314e9e87
Class pointers need to be directly addressable.
2011-02-13 16:05:50 +09:00
Bill Currie
0b5565396b
Add a class type to symbols and rework the CLASS_NAME handling.
...
This fixes the problem with [Array alloc] producing a warning about Class
not repsonding to -alloc.
2011-02-13 16:05:09 +09:00
Bill Currie
3f690eacb1
Fix another double insertion of a symbol.
2011-02-13 15:28:49 +09:00
Bill Currie
127a1c8772
Fix the creation of enum values.
2011-02-13 15:19:55 +09:00
Bill Currie
f24de89a2a
Handle type-modified constants.
...
The fix for pointers broke constants (particularly, enums). Oops.
2011-02-13 14:13:32 +09:00
Bill Currie
fa6b8d773c
Correctly emit class and category symtab references.
2011-02-13 13:21:00 +09:00
Bill Currie
c4f364fd37
Emit pointers properly.
...
Rename ReuseConstant to emit_value and use emit_value to emit any non-short
constant. This fixes the null pointer in the call to __obj_exec_class.
2011-02-13 10:09:42 +09:00
Bill Currie
1bcf434b20
Move _OBJ_MODULE to the far data space.
2011-02-12 23:00:04 +09:00
Bill Currie
d42a379924
Dump the contents of a pointer def.
2011-02-12 22:59:29 +09:00
Bill Currie
eede83dea1
Avoid crashing when a null class pointer is found.
2011-02-12 22:58:50 +09:00
Bill Currie
3505de6868
Point the near and far data spaced into the merged data space.
...
This lets the relocations work on the final data without having to adjust
their locations.
2011-02-12 22:35:44 +09:00
Bill Currie
181596f5bf
Make relocation records store the space of the relocation.
...
The space is meaningless for op_* relocations as they are always in the
code space, but def_* relocations need to know which space holds the
location to be adjusted.
2011-02-12 22:34:38 +09:00
Bill Currie
cfdc2e5d6b
Complete the documentation for relocations.
...
This covers only in-memory storage of relocation records, not object file
relocations.
2011-02-12 15:55:58 +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
75d90d2f00
Propogate the specifiers through external_decl_list.
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
5f3c1872b9
Put class and category reference/name symbols in the symbol table.
...
This fixes the undefined defs in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
179c1f7058
Support move statements (structure copy).
2011-02-11 22:29:57 +09:00
Bill Currie
e19f7e3521
Sort out the parameters for QC style functions :)
2011-02-11 22:29:57 +09:00
Bill Currie
370f0b97ed
Produce cleaner output for a = b op c.
2011-02-11 22:29:57 +09:00
Bill Currie
d93d8d7d46
Remove the dirty hack used for accessing params and the return value.
...
Instead of using the equivalent of *(float*)&.return, now use the
equivalent of (float).return. No conversion is done in the "cast".
NOTE: this sort of cast should be separated from normal casts.
2011-02-11 22:29:38 +09:00
Bill Currie
f5412c2b20
Remove a fixme.
2011-02-11 22:29:38 +09:00
Bill Currie
c185fbb782
Set the type of the super structure to the correct type.
2011-02-11 22:29:38 +09:00
Bill Currie
7d2a95ee40
Mark a few problem spots.
2011-02-11 22:29:37 +09:00
Bill Currie
a1d4d4bae1
Handle block expressions in is_indirect().
2011-02-11 22:29:30 +09:00
Bill Currie
b01f960db9
Disable the subgraphs for now.
...
They tend to make large trees difficult to read. I might re-enable them
when I've gotten a better handle on dot.
2011-02-10 15:11:08 +09:00
Bill Currie
2617f9e3ed
Update for the new syntax.
...
With this, qwaq will compile once I sort out the parameters for QC style
functions, and some non-executable warnings. However, as those are
compiler problems, this should be the final qwaq related commit.
2011-02-10 14:58:59 +09:00
Bill Currie
c3a991e555
Support nil in initializers.
2011-02-10 14:51:52 +09:00
Bill Currie
5a7650e54a
Fix a missing return.
...
Yay, I've wanted this feature in qfcc for many years :).
2011-02-10 14:47:24 +09:00
Bill Currie
adeef4a4eb
Copy named expressions.
...
Since expressions can be modified, making DAGs this early causes
corruption of the expression tree.
2011-02-10 14:43:49 +09:00
Bill Currie
6f625e426f
Use the correct type when deferencing an offset pointer.
2011-02-10 14:26:12 +09:00
Bill Currie
1099ca086c
Dump the offending expression and statement for a bad instruction.
2011-02-10 14:25:09 +09:00
Bill Currie
4a41d97afc
Angle brackets and html :P
2011-02-10 14:24:31 +09:00
Bill Currie
01a7af17e5
Beat __obj_exec_class into submission.
2011-02-10 00:15:19 +09:00
Bill Currie
006c16807d
Add the statement for based loads.
...
Oops :P
2011-02-09 22:40:16 +09:00
Bill Currie
a43946abf3
Give short values special treatment.
...
As a short value fits directly into a statement, it needs a fake def that
holds its value in the def's offset in order for the value to be written to
the statement.
2011-02-09 22:13:43 +09:00
Bill Currie
c7adde8709
Fix some case&paste errors.
2011-02-09 22:04:54 +09:00
Bill Currie
1b8edc07c9
Adjust the offsets of ivars in derived classes.
...
As ivar structs are not independent, their starting offset is not
necessarily zero (almost never will be for derived classes).
2011-02-09 22:02:52 +09:00
Bill Currie
d66a441867
Write out the far data space as well as the near.
...
This causes the Objective-QC structs to be emitted now that they havve been
moved to the far data space. Relocs are broken, though.
2011-02-09 21:45:29 +09:00
Bill Currie
244d969ae3
Ensure any tail bytes in the strings data are zeroed.
2011-02-09 18:32:37 +09:00
Bill Currie
2d5d8eda5a
Save the caller's address when creating new relocations.
2011-02-09 17:16:49 +09:00
Bill Currie
29c1f7ac03
Use the correct type object in emit_struct().
2011-02-09 17:15:29 +09:00
Bill Currie
59a683d39e
Protect the name passed into emit_struct().
...
The name passed into emit_struct is sometimes created via va(), but the
struct creation code also uses va. This makes a mess of names.
2011-02-09 17:12:47 +09:00
Bill Currie
3e1b034aaf
Use EMIT_DEF correctly.
2011-02-09 15:58:32 +09:00
Bill Currie
e75295b00c
Make normal C style functions generate code.
2011-02-09 10:25:23 +09:00
Bill Currie
68cdc904f5
Give temporary variables unique names.
2011-02-09 10:04:55 +09:00
Bill Currie
681ded9375
Fix debug line number information.
2011-02-09 09:59:43 +09:00
Bill Currie
5eff00fdeb
Fix debug information.
2011-02-09 08:47:01 +09:00
Bill Currie
71c05bd899
Update for the new syntax.
...
This one compiles to progs even :) (though it looks broken).
2011-02-08 22:39:42 +09:00
Bill Currie
81125cff3a
Creation of .ctor now mostly works.
...
There seems to be problems with the actual code generation using incorrect
addresses, but a very simple test file compiles successfully.
2011-02-08 22:38:34 +09:00
Bill Currie
1647b1e61d
Check for the correct type in emit_symtab_cat_def_cnt().
2011-02-08 22:31:09 +09:00
Bill Currie
9b52c590f8
Do not try to emit anything when there are no selector references.
2011-02-08 22:28:32 +09:00
Bill Currie
da14c95bb8
Initialize current_symtab in class_init() when necessary.
...
If an objective-qc symbol is the first token to be read, class_init() is
called before the parser gets a chance to perform the initialization
action. However, class_init() setting current_symtab if the first
objective-qc symbol is seen in a function body would be bad.
2011-02-08 22:26:35 +09:00
Bill Currie
c01f742b7b
Fix some Class vs ClassPtr confusion.
2011-02-08 18:25:23 +09:00
Bill Currie
0d5ab6600d
Store the source expression in a statement.
...
This makes problem reporting more informative.
2011-02-08 18:18:34 +09:00
Bill Currie
faab931ffc
Fix assignment of id to class pointers.
2011-02-08 17:12:01 +09:00
Bill Currie
6643c5dd98
Fix messages to super.
2011-02-08 17:09:27 +09:00
Bill Currie
505e141633
Ensure the class symbol is in the symbol table.
2011-02-08 17:08:58 +09:00
Bill Currie
93a5808659
Support direct struct/union field access.
2011-02-08 14:48:26 +09:00
Bill Currie
3c849b970b
Handle union access now that they're detected properly.
2011-02-08 14:45:48 +09:00
Bill Currie
204a267b6a
Print the def name for a pointer expr when known.
2011-02-08 14:43:57 +09:00
Bill Currie
3b080fcbb0
Fix an uninitialized variable.
2011-02-08 13:27:37 +09:00
Bill Currie
2594be8b1b
Fix a type-o ;)
2011-02-08 13:26:49 +09:00
Bill Currie
8c6fc6fb03
Fix a double insertion of a symbol.
2011-02-08 08:44:08 +09:00
Bill Currie
daa88d8f1c
Fix a type clash warning I'd failed to notice.
2011-02-08 08:23:25 +09:00
Bill Currie
35d53d0d77
Fix typedefs and class names once and for all.
...
I suspect Holub did them that way as a teaching exercise :P
2011-02-08 08:20:32 +09:00
Bill Currie
7e2173f268
Remove some old code.
2011-02-08 08:16:36 +09:00
Bill Currie
d6b10c99aa
Most, if not all, of the fixes needed to get qwaq building.
...
This is pretty much just changing [] to * and moving [N] to the other side
of the variable name.
2011-02-07 22:16:16 +09:00
Bill Currie
92799650c0
Implement struct field access via a pointer.
2011-02-07 22:15:10 +09:00
Bill Currie
7a1a9e3f2d
Better handling of the current storage for function scopes.
2011-02-07 22:11:22 +09:00
Bill Currie
ff70177041
Fix type handling for local variables.
2011-02-07 21:38:58 +09:00
Bill Currie
952a02eb23
Make print_type() output a newline.
2011-02-07 21:31:37 +09:00
Bill Currie
a28ac636a7
Make local declarations support C syntax.
2011-02-07 21:29:04 +09:00
Bill Currie
da4ec3d47c
Allow typedefs and classes in structs.
2011-02-07 20:55:13 +09:00
Bill Currie
aefd2a27d5
Make type handling in the grammar more consistent.
2011-02-07 20:54:49 +09:00
Bill Currie
3c64ae7b66
Fix overzealous type merging.
...
Use the type name instead of the symbol table for comparing
struct/union/enum types.
2011-02-07 20:48:01 +09:00
Bill Currie
265a244ba2
Set the symbol type for structs etc as soon as the tag is created.
...
Tags (struct/union/enum) are always types.
2011-02-07 15:30:49 +09:00
Bill Currie
65a07ada1c
Implement offset dereferences.
2011-02-07 14:56:29 +09:00
Bill Currie
d2b464053c
Fix assignment sub-expressions.
2011-02-07 14:43:07 +09:00
Bill Currie
6fa5bbe473
Support constant folding on enums.
2011-02-07 11:31:23 +09:00
Bill Currie
d549e5c6b5
Allow enums to be tested.
2011-02-07 11:30:56 +09:00
Bill Currie
ef2ad46f7a
Convert complex types to a suitable low-level type.
...
This takes care of moving structures etc around.
2011-02-07 10:55:09 +09:00
Bill Currie
b629c12b31
Do not change the type of the return operand.
...
Doing so made a mess of returning expressions. It was probably a holdover
from before getting instructions with void operand types working.
2011-02-07 10:21:54 +09:00
Bill Currie
829fb33e92
Fix converting nil to a pointer type.
2011-02-07 10:10:48 +09:00
Bill Currie
b8127f7543
Do not segfault when printing a pointer value with a bogus type
2011-02-07 09:57:26 +09:00
Bill Currie
28ba4b5712
Correct a comment.
2011-02-07 09:56:33 +09:00
Bill Currie
d564e6f017
Clean out the old debug prints from emit_function()
2011-02-07 08:46:12 +09:00
Bill Currie
76034861c9
Implement direct ivar access in methods.
...
A warning needs to be generated for access to ivars in a class method, but
it seems to work (unable to check due to other errors).
2011-02-07 08:32:52 +09:00
Bill Currie
3025e04ac5
Partially resurrect field_expr()
...
For now, only entity.field and ivar access via a pointer have been
implemented. The rest will come later as needed.
2011-02-07 08:30:28 +09:00
Bill Currie
1d108a8cec
Support emitting symbolic constants.
2011-02-06 20:08:54 +09:00
Bill Currie
e4ac92b5f2
Auto-cast between enums and the default type.
2011-02-06 20:08:16 +09:00
Bill Currie
6b7a81f5a7
Run find_type() early on enums and structs.
2011-02-06 20:07:19 +09:00
Bill Currie
d54a96e68a
Make enum values visible.
...
Put them in the current symbol table as well as the enum symbol table. The
latter is really just for keeping track of what values are in the enum.
2011-02-06 20:06:09 +09:00
Bill Currie
2860a8b28b
enum too is a scalar.
2011-02-06 20:01:55 +09:00
Bill Currie
f2c272f0b8
Make adding a symbol to multiple tables an internal error.
2011-02-06 20:00:14 +09:00
Bill Currie
d7cdf8077b
Rename id_ivars to object_ivars.
2011-02-06 15:41:15 +09:00
Bill Currie
c3c693e9c7
Correct construction of type_id.
2011-02-06 15:36:21 +09:00
Bill Currie
e27f3fd7c3
Copy the method's params into the method symbol.
2011-02-06 15:14:42 +09:00
Bill Currie
00bba1eb3a
Fix creation of uninitialized global variables.
2011-02-06 14:37:25 +09:00
Bill Currie
59d3dc6ae0
Check early for assignment of a class pointer to id.
2011-02-06 14:35:17 +09:00
Bill Currie
2f7b892452
Fix passing messages to classes.
...
Rename class_pointer_def() to class_pointer_symbol() and use it when a
class name is used as the receiver of a message.
2011-02-06 14:34:40 +09:00
Bill Currie
67957a14df
Bring back convert_name(), but siimplified.
...
It is now mainly for converting __FILE__ etc, handling expression symbols,
and checking for undefined identifiers.
2011-02-06 14:29:14 +09:00
Bill Currie
d03fdc5e67
Correctly calculate the size of the ivars of a class.
...
Need to include the size of the super class ivars.
2011-02-05 00:04:35 +09:00
Bill Currie
690ae1cb57
Fix send_message().
2011-02-04 23:49:25 +09:00
Bill Currie
29fbc3b073
Struct and ivar declarations now seem to work.
...
However, not bit-fields.
2011-02-04 23:48:58 +09:00
Bill Currie
1f6abb2cce
Minor cleanups to message_expr().
...
Fix for class names no longer being pointers to the class.
2011-02-04 23:22:51 +09:00
Bill Currie
eff3957487
Resurrect the address expression code for arrays etc.
...
This fixes selector finding.
2011-02-04 23:20:37 +09:00
Bill Currie
c542e1a453
Possibly fix normal methods.
2011-02-04 22:31:23 +09:00
Bill Currie
d9446c5eb0
Fix builtin methods.
2011-02-04 22:31:22 +09:00
Bill Currie
d0ecbb38b8
Copy the spec bits and storage class for QC functions.
2011-02-04 15:25:21 +09:00
Bill Currie
f721144ca5
Rewrite emit_ivars to use emit_structure.
...
The old code was broken anyway :) (it was segfaulting).
2011-02-04 15:11:47 +09:00
Bill Currie
acb3c0da11
Fix class initialization.
2011-02-04 14:29:47 +09:00
Bill Currie
04b86fcdb7
Move the Objective-QC structs from type.c to class.c
2011-02-04 12:07:32 +09:00
Bill Currie
7b22bfba63
Better Objective-QC keyword detection.
...
Use a flag in the keyword struct rather than checking for "@" in the
keyword. This catches such keywords as "id" and "Protocol" as well.
2011-02-04 08:38:58 +09:00
Bill Currie
993bee4f59
Do not count unimplemented methods.
...
The method emitter skips unimplemented methods, so counting them when
figuring out how many methods to emit leads to a segfault.
2011-02-04 08:26:16 +09:00
Bill Currie
e04ed72afa
Increment the index when emitting array elements.
...
Oops :)
2011-02-04 08:25:27 +09:00
Bill Currie
d7853682af
Fix conversion of nil to a real type.
2011-02-03 21:37:15 +09:00
Bill Currie
f44a26e268
Fix type chaining when dealing with decls.
2011-02-03 21:32:58 +09:00
Bill Currie
54c8a10fe4
Don't trip over incomplete structs (again:P)
2011-02-03 21:31:14 +09:00
Bill Currie
12d8658ece
Create a typedef for obj_module_t.
2011-02-03 18:05:46 +09:00
Bill Currie
b07392b818
Allow ivars to use C syntax declarations.
2011-02-03 18:04:41 +09:00
Bill Currie
dc6296e9b1
Allow ivars to use typedefs and other classes.
2011-02-03 18:03:37 +09:00
Bill Currie
2203903bb2
Temporarily splice the class's ivar chain into the symbol table.
...
The root class's ivar symbol table needs to be connected to the global
symbol table while building the current class's ivar symbol table. This
allows access to other classes and typedefs.
2011-02-03 18:02:49 +09:00
Bill Currie
79df3d2cca
Put newly created classes into the symbol table.
2011-02-03 17:28:49 +09:00
Bill Currie
564b7b9968
Use abstract_decl instead of type wherever a generic type is needed.
2011-02-03 10:53:59 +09:00
Bill Currie
a208aed6ef
Fix a segfault when encoding incomplete structs.
2011-02-03 10:52:42 +09:00
Bill Currie
22ccd41164
Give struct types a name.
...
Use the struct/union's name (minus "tag ") for the type name.
2011-02-03 10:52:12 +09:00
Bill Currie
d12cdca758
Functions and enums now seem to be working properly.
...
find_type now operates recursively (depth-first) so built up typechains
work as expected.
@overload is treated as a specifier (directly as a storage class, similaar
to typedef).
2011-02-03 10:48:12 +09:00
Bill Currie
52799a4e1c
Must merge specifiers :P
2011-02-02 22:59:08 +09:00
Bill Currie
4420a7125e
Ensure structs get added to the symbol table.
2011-02-02 22:53:53 +09:00
Bill Currie
a4eaa2a89b
Allow typedefed types and classes in parameters.
2011-02-02 21:58:53 +09:00
Bill Currie
aeecdc84dc
Get typedef working.
2011-02-02 21:58:11 +09:00
Bill Currie
cca829aa6b
Remove a stray semicolon from the grammar.
2011-02-02 21:57:41 +09:00
Bill Currie
400abe7fce
Allow freeing of typechains.
2011-02-02 15:15:24 +09:00
Bill Currie
1fe031e8cb
Build C style var/func/abs decl types from the outside in.
...
QuakeC style are built from the inside out.
2011-02-02 15:15:04 +09:00
Bill Currie
7fb8c8247e
Don't do a find_type on the parsed function.
...
This is needed for C style declarations, but breaks QuakeC style. The fix
is to do the find_type once the return type has been filled in.
2011-02-02 15:08:59 +09:00
Bill Currie
1452da676d
Allow types to be built from the outside in.
...
This is required for C style decl processing.
2011-02-02 15:07:44 +09:00
Bill Currie
ac91e9376b
The big type-system rewrite. Horribly broken :)
...
While broken, it is good enough to compile modulo.r.
This gives qfcc C's type system with QC specifics bolted on top (rather
than trying to cram C's type system into QC's). Pointers and arrays now
use C syntax and semantics (though I think there's a lot of breakage in
there at the moment). Functions themselves are still dual mode: both QC
style and C style are available.
2011-02-01 21:23:03 +09:00
Bill Currie
d11d128c96
Avoid segfaulting on errors.
2011-02-01 21:18:39 +09:00
Bill Currie
80ce179bc2
Scan the param list for problems with void.
2011-02-01 21:18:08 +09:00
Bill Currie
c53001800a
Create a struct for representing specifiers.
...
The specifiers are yet to come (next few commits), but this will be
necessary when they do.
2011-02-01 21:15:51 +09:00
Bill Currie
917c5f08b0
Make a var representing the default type.
...
The default type for vars is integer for ruamoko and float for v6 qc.
2011-02-01 21:12:02 +09:00
Bill Currie
54c14eb899
Add "return" to pascal.
...
I'm still not sure I'll keep it, but it's useful for testing.
2011-01-30 22:16:59 +09:00
Bill Currie
e7424e1496
Don't segfault on bare return statements.
...
I will probably need to do something about the required operand for v6
progs, but this will do for now.
2011-01-30 21:43:56 +09:00
Bill Currie
440a13b649
Untwist params' knickers for pascal, too.
2011-01-30 21:42:10 +09:00
Bill Currie
861ab93274
Don't type-check against the wrong type :P
2011-01-29 09:56:08 +09:00
Bill Currie
afc6605739
Don't set the space for external defs.
2011-01-29 09:55:14 +09:00
Bill Currie
d80a3413e5
Fix a segfault when freeing locations.
...
When chasing linked lists with a double pointer, must check the first
dereference and not the pointer itself.
2011-01-29 09:54:47 +09:00
Bill Currie
e1226bd3f1
Quaternions aren't vectors :P
2011-01-28 21:57:04 +09:00
Bill Currie
2cce903cc9
Set the default storage class for local vars.
2011-01-28 21:56:17 +09:00
Bill Currie
bc7d42d176
Immediate constants now work, though still not shared.
2011-01-28 21:39:01 +09:00
Bill Currie
3c95667b79
Print data contents for most simple types.
2011-01-28 21:21:29 +09:00
Bill Currie
4476074021
Print more addresses as hex.
2011-01-28 18:03:26 +09:00
Bill Currie
4837e0bd18
Fix most of the FIXMEs in qfcc.c.
...
Functions and defs seem to be relocated correctly. Constants are very
broken, however.
2011-01-28 15:17:30 +09:00
Bill Currie
834417b8c8
Add "debug" diagnotic printing, and use it.
...
Debug diagnostics are silent for verbosity levels less than 1.
2011-01-28 13:28:45 +09:00
Bill Currie
a37bdd9fb5
Free removed sblocks.
2011-01-28 13:23:20 +09:00
Bill Currie
80424f6ad5
Ensure functions are always properly terminated.
...
Control that reaches the end of a function must see a return statement.
2011-01-28 13:14:30 +09:00
Bill Currie
9159daf99d
Do simple unreachable block analysis and dead block removal.
2011-01-28 11:45:04 +09:00
Bill Currie
90a2738459
Add the label to the block to which it refers.
2011-01-28 11:41:53 +09:00
Bill Currie
c158b14286
Remove the labels list from the pr struct.
...
I'm not sure they were ever needed.
2011-01-28 11:40:25 +09:00
Bill Currie
4738c767a2
Fix branch label handling.
...
Conditional branches and goto now go to the correct location.
2011-01-27 21:11:32 +09:00
Bill Currie
95b17d9fd4
Rename add_statement_ref to add_statement_def_ref.
2011-01-27 21:10:37 +09:00
Bill Currie
bd78b8a7ee
Enable more end-of-compilation code.
2011-01-27 15:44:12 +09:00
Bill Currie
cdea1d07aa
Produce code for progs.src mode.
...
Separate compilation will take fixing object files.
The generated code is broken due to various relocation fixups being
broken, and float immediates seem to be badly broken.
Debug information is broken too.
2011-01-27 15:44:11 +09:00
Bill Currie
c7bbd40df6
Give special treatment to opcodes that have void operand types.
2011-01-27 15:44:11 +09:00
Bill Currie
71b5decbe8
Get assignments to .return working.
...
I really do not like the mechanism I currently use for handling pointer
derefences vs pointer assignments, but this will have to do for now until
I can get qfcc producing code again.
2011-01-27 15:44:11 +09:00
Bill Currie
56106892c8
The & operator produces a pointer, not void.
2011-01-27 15:44:10 +09:00
Bill Currie
1c3cc571f1
Pascal variables need defs too.
2011-01-27 15:44:10 +09:00
Bill Currie
f532fbc6df
Convert all integer operands to float for v6 progs.
...
Converting only opc is no longer enough.
2011-01-27 15:43:59 +09:00
Bill Currie
1ed1efbdfb
Implement the ROTL macro correctly.
...
Bit rotation requires unsigned ints.
2011-01-27 15:43:50 +09:00
Bill Currie
a6e65488ec
Remove the "test" parameter from test_expr.
...
The parameter became redundant at some stage.
2011-01-27 08:31:51 +09:00
Bill Currie
f7d60397fb
Set the type for zer_def used by labels.
2011-01-26 22:43:59 +09:00
Bill Currie
36c99a8da1
Get function def creation working again.
2011-01-26 14:48:22 +09:00
Bill Currie
5231e8e9f8
Handle .zero, .return and .param* properly.
2011-01-26 08:01:24 +09:00
Bill Currie
4966120e3b
Untwist param's knickers.
2011-01-25 20:21:41 +09:00
Bill Currie
6ce3c5a59a
Get statments being emitted to the code segment.
...
The first function seems to work fine, but there's a problems with the
scope of params causing params to get their knickers in a twist (tangled
linked list).
2011-01-25 15:46:48 +09:00
Bill Currie
fd3b594ca5
Move label relocs to the relevant statement block.
2011-01-25 15:45:31 +09:00
Bill Currie
849d013f5e
Allocate space for function parameters.
2011-01-25 15:43:57 +09:00
Bill Currie
f45919df09
Need alias defs after all.
2011-01-25 15:42:26 +09:00
Bill Currie
a648f043de
Give functions their own defspace.
...
The defspace is propogated through the function's sub-scopes.
2011-01-25 12:34:45 +09:00
Bill Currie
27c5139612
Give defspaces some backing memory.
...
I'm not sure I want all defspaces to have backing memory, but this will do
for now.
2011-01-25 12:16:13 +09:00
Bill Currie
34ffce50fa
Ensure current_symtab gets set at the start of parsing.
...
current_symtab must be set even if the first thing encountered is a syntax
error.
2011-01-25 12:16:13 +09:00
Bill Currie
69b889756d
Fix a misplaced !
2011-01-25 12:16:13 +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
30701980bc
Get QC cfunctions and defs working.
2011-01-25 12:16:13 +09:00
Bill Currie
ade2e92ea4
Fix the immediate breakage in immediate handling.
2011-01-25 09:08:11 +09:00
Bill Currie
7e914b8c53
Fix copyright headers.
...
Add forgotten templates and fill in the information in places I had
forgotten. I hope I got the dates right (timezone issues).
2011-01-25 09:01:37 +09:00
Bill Currie
49b7c2d527
Document make_symbol
2011-01-25 09:01:37 +09:00
Bill Currie
0624408317
Move the diagnostic functions into their own file.
2011-01-24 21:54:57 +09:00
Bill Currie
d618e51dc8
Move save_string and make_string into strpool
...
Might not be the perfect place, but at least they're strongly related.
2011-01-24 21:32:48 +09:00
Bill Currie
483cbeba03
Fix a few FIXMEs.
2011-01-24 21:13:37 +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
ce02fe8660
Fix the order of paramenters in the tree output.
...
Also get call nodes looking a little better.
2011-01-23 12:59:30 +09:00
Bill Currie
a79b6f0a6c
Partially implement casts.
2011-01-23 11:53:08 +09:00
Bill Currie
bf626c9e00
Fix some simple fixmes
2011-01-23 11:13:56 +09:00
Bill Currie
20b14af024
Add "is_math" type check and use for unary +/-.
2011-01-23 11:12:58 +09:00
Bill Currie
341f370662
Rename is_math() to is_math_op().
2011-01-23 11:12:05 +09:00
Bill Currie
dea6771d92
Create type_nil for passing nil into ...
2011-01-22 16:41:31 +09:00
Bill Currie
4ac80c2932
Get qfcc running again.
...
It segs when it tries to link, but that's because a real object file has
not been created yet. However, I can get my tree and flow diagrams :)
2011-01-22 15:52:57 +09:00
Bill Currie
55d3d17807
Add a missing break.
...
"return" falling through to "goto" was bad news :)
2011-01-22 15:52:01 +09:00
Bill Currie
d5f669af7a
Nuke temp reference counting.
...
The whole reason for this crazy developement branch :)
2011-01-22 11:40:53 +09:00
Bill Currie
3b462e16cf
Produce flow diagrams of the basic blocks.
2011-01-22 11:40:53 +09:00
Bill Currie
246778b5de
Use function pointer tables instead of switch.
...
This seems to be better for complicated code. switch seems to be better
suited for relatively simple code.
2011-01-22 11:40:53 +09:00
Bill Currie
2f09efe547
Break out print_expr into its own file.
2011-01-21 20:31:40 +09:00
Bill Currie
bcb2667b73
Possibly get vector calls working.
2011-01-21 19:40:46 +09:00
Bill Currie
52b561f7cb
Nuke bind expressions.
...
Since I'm planning on implementing CSE and other optimizations, they're
rather redundant (and I'm having trouble getting them to work).
2011-01-21 19:07:58 +09:00
Bill Currie
0d01930056
Link a bool to its block rather than the block's head.
...
This makes the flow make a little more sense.
2011-01-21 18:50:17 +09:00
Bill Currie
977c48d728
Make operator type overrides clear.
2011-01-21 15:57:53 +09:00
Bill Currie
aec9f256a7
Get calls mostly working.
...
Bind seems to be broken, but parameters seem to be being set correctly.
2011-01-21 15:54:53 +09:00
Bill Currie
5c5fa67e43
Minor tweaks of the expression tree output.
2011-01-21 15:34:42 +09:00
Bill Currie
96fae582e3
Implement bind expressions.
2011-01-21 11:27:40 +09:00
Bill Currie
4a24393d8d
Temp expressions now use operands instead of defs.
2011-01-21 11:26:43 +09:00
Bill Currie
2998e578fb
Get very basic deref assignments working.
...
More complicated expressions will not work yet.
2011-01-21 10:59:16 +09:00
Bill Currie
ff6e2584da
Handle block sub-expressions that produce results.
2011-01-21 10:57:47 +09:00
Bill Currie
16e013ff5d
Allow the operand to override the symbol's type.
2011-01-21 10:56:32 +09:00
Bill Currie
3f2793ef72
Get a lot of statements being generated.
2011-01-20 23:26:13 +09:00
Bill Currie
e45ea4b2ae
Move the statement printing near the top of the file.
2011-01-20 18:07:24 +09:00
Bill Currie
35b7278967
Re-disable the next-edge constraints.
...
This gives a flatter layout.
2011-01-20 15:36:10 +09:00
Bill Currie
08e387ebac
Slight improvement to branch instruction nodes/labels.
2011-01-20 15:33:13 +09:00
Bill Currie
f8cc347dce
Print expressions as dot files.
...
While the resulting images can be a little confusing, they're much easier
to read than my cryptic postfix notation.
2011-01-20 15:23:19 +09:00
Bill Currie
0594609b3a
Get the label from the right expression.
2011-01-19 22:25:43 +09:00
Bill Currie
5deda9c9b9
Clean out ex_def as ex_symbol replaces it.
2011-01-19 22:25:04 +09:00
Bill Currie
b5424bca7d
Start work on getting expressions converted to internal statements.
2011-01-19 15:47:45 +09:00
Bill Currie
cac2e04b18
Avoid namespace issues with dstatements.
2011-01-19 11:35:34 +09:00
Bill Currie
f2ef24d0cc
Make symbols use the new value struct for constants.
2011-01-19 11:09:54 +09:00
Bill Currie
e08efe036b
Move the constant expression values into their own struct.
2011-01-19 08:43:24 +09:00
Bill Currie
ff6e1b4d6c
Get functions attempting to generate code.
...
However, the statements are only printed as expressions.
2011-01-19 08:38:09 +09:00
Bill Currie
87ce9f5333
Get basic function creation working.
...
Even more FIXMEs, but the pascal parser can now create functions. The
function records even get emitted.
2011-01-18 12:47:13 +09:00
Bill Currie
8fb1b49a9d
Add support for function symbols.
2011-01-18 10:46:42 +09:00
Bill Currie
b186173d18
Fix a segfault in structure finalization.
2011-01-18 08:59:44 +09:00
Bill Currie
21c0c960ae
Initialize data before types.
...
This is needed for string data. It might be better to init saved strings
separately, but this works for now.
2011-01-18 08:58:43 +09:00
Bill Currie
3fe7a7250a
Handle unnamed structures in make_structure.
...
Symbols may not have null names.
2011-01-18 08:56:47 +09:00
Bill Currie
b76a5c5284
Add my QuakePascal test program.
...
Trivial as it is...
2011-01-17 22:44:58 +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
d3a98af783
Make internal_error globally available.
2011-01-17 22:34:41 +09:00
Bill Currie
537b930ba6
Add new_symbol_type to ease creation of typed symbols.
...
This is inteded for code generation functions that need to create
variables and structures.
2011-01-17 12:04:41 +09:00
Bill Currie
ffea505678
Cleanup QC's constant handling based on QP.
2011-01-14 12:10:28 +09:00
Bill Currie
c38ea0b1bc
Correct the spelling of "nil".
2011-01-14 12:07:40 +09:00
Bill Currie
c0b8d0febe
Test __PRETTY_FUNCTION__ in methods, too.
2011-01-13 16:34:25 +09:00
Bill Currie
c4d19e6ebc
Get __PRETTY_FUNCTION__ working for overloaded functions.
2011-01-13 16:22:27 +09:00
Bill Currie
0c9522b1ca
Fix overloaded functions.
2011-01-13 16:21:31 +09:00
Bill Currie
b4dd1b0a89
Add some diagnostic variables.
...
__PRETTY_FUNCTION__ __FUNCTION__ __LINE__ and __FILE__
2011-01-13 15:30:46 +09:00
Bill Currie
fb8b3d1211
Rework the lexer and parser to use symbols instead of defs.
...
Currently parses the test program just fine, but code generation is very
very broken.
2011-01-13 14:58:16 +09:00
Bill Currie
8f71986306
Add symbol expressions (like def expressions).
...
They will eventually replace def expressions. Currently quite broken.
2011-01-13 14:54:24 +09:00
Bill Currie
008f4e1929
Don't return .return in advanced mode.
2011-01-13 14:50:25 +09:00
Bill Currie
5b8725ca66
Rewrite the symbol (table) management in light of actual usage.
2011-01-13 14:48:38 +09:00
Bill Currie
ac14db7b1b
Create a function to ease param list building.
...
This is especially useful for QuakePascal, but it will mean I'll be able to
get rid of the parameter reversals in Ruamoko later on.
2011-01-13 14:45:53 +09:00
Bill Currie
258c896e4d
Create a function to build if/else blocks.
2011-01-13 14:33:16 +09:00
Bill Currie
638f4445cc
More return code cleanup.
...
Don't use the true void return in traditional mode.
Prefer the true void return over "done" at the end of functions.
Don't emit the above if the last emitted statement is a return and there is
no label at the end of the function.
2011-01-13 00:46:46 +09:00
Bill Currie
3c9991364b
Add a "void return" instruction.
...
I got fed up with always having to explicty return something.
2011-01-13 00:29:56 +09:00
Bill Currie
9ce9b70484
Add variadic functions.
...
Already extending QuakePascal, and many basics aren't there yet :P
2011-01-12 23:39:59 +09:00
Bill Currie
02b3dde83b
Make QuakePascal programs runnable.
...
Generate a mini-main function (".main", to avoid namespace pollution) that
calls the function named by "program", and make qwaq check for ".main" as
well as "main". If both are present, ".main" will take priority.
2011-01-12 23:39:22 +09:00
Bill Currie
332b7da127
Minor header cleanup.
2011-01-12 23:34:15 +09:00
Bill Currie
96ba4605fa
Fix the micro-optimization that avoided emitting x = x
...
The check was broken by alias defs. If a def is aliased, the alias must be
checked.
2011-01-12 23:33:51 +09:00
Bill Currie
c787923c99
Forgot to remove that print_expr.
2011-01-11 12:11:54 +09:00
Bill Currie
08bf7e24de
Produce nicer code for post-op.
...
The temp notice is still there for arrays (that's caused by issues in
constfold.c, not easily fixilbe), but it's harmless and correct (and nice)
code is much more important.
2011-01-11 12:07:48 +09:00
Bill Currie
ad787ae98a
Set the expression type to the correct value for addresses.
2011-01-11 12:06:40 +09:00
Bill Currie
21d7c78eb7
Allow deep copying of expression trees.
...
Certain expression types (eg labels) are created fresh.
2011-01-11 12:05:29 +09:00
Bill Currie
c73ac30e3f
Turns out decrementing the users was very very bad.
2011-01-11 10:56:36 +09:00
Bill Currie
4af5dad424
More math identities.
...
I forgot about 0 for multiplication and division. Detects division by zero.
2011-01-11 08:49:43 +09:00
Bill Currie
5b43fc1de3
Improve interaction between temps and const_folding.
...
Unfortunately, this seems to overdo the decrementing, so it could be
dangerous, but the ruamoko directory builds properly.
2011-01-11 08:47:52 +09:00
Bill Currie
abe471110c
Make inc/dec_users return the the expression.
...
Just for convenience.
2011-01-11 08:44:43 +09:00
Bill Currie
18ae178eaf
Make new_vector_expr and new_quaternion_expr const-correct.
2011-01-11 08:43:34 +09:00
Bill Currie
4da2657bfe
Fix most of the notice spam (hacky).
...
The implementation and declaration of OP_DONE disagree (not sure what to do
about it yet), so give it special treatment when emitting.
2011-01-11 08:07:04 +09:00
Bill Currie
ded741430b
Add some missing static declarations.
2011-01-10 13:23:39 +09:00
Bill Currie
5f70e27613
Quaternions use quaternion_val, not vector_val :P
2011-01-10 13:23:12 +09:00
Bill Currie
cd38bd71fa
Swap the order of scale and base for calculating the array index.
...
fold_constants doesn't like dags very much, but it can do the right thing
if the expressions are in the right order. This is merely a workaround
until I get to work on the code generator itself.
2011-01-10 12:26:11 +09:00
Bill Currie
5864c198cc
Property list tests are working.
2011-01-10 12:26:11 +09:00
Bill Currie
d327c860cb
Get messages working again.
2011-01-10 12:26:11 +09:00
Bill Currie
cb0bc7229a
Resurect the debugging messages in rua_obj.c
...
Yet another debug flag: SYS_RUA_OBJ
2011-01-10 12:26:10 +09:00
Bill Currie
aac8185e4e
Print some addresses in hex.
2011-01-10 12:25:31 +09:00
Bill Currie
6ebee4ad0e
Get the type of Method right.
...
It's a direct structure rather than a pointer.
2011-01-10 12:25:31 +09:00
Bill Currie
ba27db6b93
Use some math identities to eliminate operations on non-constants.
2011-01-10 12:25:31 +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
c69ac1f56f
Don't segfault when build_builtin_function detects an error.
2011-01-10 12:25:31 +09:00
Bill Currie
806d9110a2
Support both (* *) and // style comments.
2011-01-10 12:25:31 +09:00
Bill Currie
a17e73c863
Generate code.
...
It's now time to work on the revamp of the symbols, trees, etc.
2011-01-10 12:25:31 +09:00
Bill Currie
e34f7caeb0
Use op instead of integer_val for ADDOP etc.
2011-01-10 12:25:31 +09:00
Bill Currie
edaa6235e7
Get functions/procedures emitted.
...
No actual code is emitted, though.
2011-01-10 12:25:31 +09:00
Bill Currie
74016573b4
Need frame grabbing after all.
2011-01-10 12:25:31 +09:00
Bill Currie
129a36064f
Fix a typo that broke procedure declarations.
2011-01-10 12:25:31 +09:00
Bill Currie
7971b0868e
Break out the begin_function code into its own function.
2011-01-10 12:25:31 +09:00
Bill Currie
c5d0acf0fa
Allow arrays to have ranges (not fully implmented)
2011-01-10 12:25:31 +09:00
Bill Currie
25c36a51a8
-f and -F were reversed in the usage.
2011-01-10 12:25:31 +09:00
Bill Currie
fed82466cc
The first stages of Quake-Pascal.
...
At present, this parses a subset of the pascal language with a few type
extensions. There is already work on the type system.
2011-01-10 12:25:31 +09:00
Bill Currie
ae4ca52661
Make function.h more independent.
2011-01-10 12:25:31 +09:00
Bill Currie
66ac56063f
Break out the frame macro code from qc-lex.l
2011-01-10 12:25:31 +09:00
Bill Currie
a09f02db1a
Break out the debug and string functions from qc-lex.l.
2011-01-10 12:25:30 +09:00
Bill Currie
695f71eeb6
Get clost to the look I wanted for symtab_flat_copy's graph.
2011-01-10 12:25:30 +09:00
Bill Currie
782a4c9a8d
New symbol table code.
2011-01-10 12:25:30 +09:00
Jeff Teunissen
dfbbda37af
New tool: qflmp
...
Stupid little lump tool, converts from lmp to pcx and back.
qflmp -h for help.
2011-01-09 04:33:51 -05:00
Bill Currie
fbdbcfada4
Remove deprecated @argc and @argv
2011-01-05 13:10:57 +09:00
Bill Currie
a27ea057c4
Add a test for calling class methods.
2011-01-03 18:11:46 +09:00
Bill Currie
02f78e46f8
More expression docs.
2011-01-03 16:25:59 +09:00
Bill Currie
5627e43465
Use the method's selector rather than its def name in error messages.
2011-01-03 16:25:29 +09:00
Bill Currie
a1f36a9944
Make new_function take a def rather than a name.
...
Moves into new_function some code that should have been there in the first
place.
2011-01-03 16:25:29 +09:00
Bill Currie
4c69a97ac7
Allow normal declarations within a class implementation.
...
I had always been under the assumption that such was illegal in
Objective-C, but after working on Forge, I now know otherwise.
2011-01-03 16:25:29 +09:00
Bill Currie
dc5bafb8fb
Minimal error recovery.
...
No more bailing on the first syntax error. While the recovery is not
perfect (things can get right twisted), qfcc will now continue parsing
after a syntax error.
2011-01-03 16:25:29 +09:00
Bill Currie
a4635d79e8
Slightly more informative error locations.
...
Inside a class or protocol definition is not "at top level" ;)
2011-01-03 16:25:29 +09:00
Bill Currie
530e8fae34
Rework class_type_t to be more useful.
...
This allows current_class to refer to procols as well (for error
reporting).
2011-01-03 16:25:29 +09:00
Bill Currie
f738ef5dba
Remove redundant RETURN statement rule.
...
The same effect can be achieved with one rule using opt_expr.
2011-01-03 16:19:28 +09:00
Bill Currie
58042719e5
A little more documentation for expressions.
2011-01-03 16:19:28 +09:00
Bill Currie
7946fec523
More cString cleanups.
...
I don't know that fileSystemRepresentation is any better than cString for
general usage (due to wchar on windows).
2010-12-28 07:42:08 +09:00
Bill Currie
d29e8deb0a
Use Qprintf for writing maps, and fileSystemRepresentation to get the path.
2010-12-27 23:18:43 +09:00
Bill Currie
97e8ab7f3a
A bunch more NSString and NSFileManager usage.
...
It does make for cleaner could, though it would have been nice if NSData
was null terminated :P
2010-12-26 22:33:04 +09:00
Bill Currie
8e13a8327d
Use NSFileManager methods instead of access().
...
This even fixes a bug where an inaccessible bspSound was being opened.
2010-12-26 21:07:55 +09:00
Bill Currie
f105fbd6a0
Use NS* classes for QUAKED directory scanning.
...
The scanning of actual files is still done using normal C strings, but now
everything up to (but not including) opening the file is handled by *step.
2010-12-26 20:45:01 +09:00
Bill Currie
232c67640c
Get the QUAKED text for nullclass right.
...
? is not a character that's lexed out by the script class.
This fixes the segfault when loading a map when no entities are defined
(ie, the mod's source code could not be found for QUAKED).
2010-12-26 19:06:39 +09:00
Jeff Teunissen
8653f9d9a7
Add a man page for zpak
...
It's lame, but so is zpak :)
2010-12-24 16:23:52 -05:00
Bill Currie
526f132517
Minor tweaks.
2010-12-24 20:08:24 +09:00
Bill Currie
22072ee606
Update for the new qfcc headers/libs location.
2010-12-24 20:07:40 +09:00
Bill Currie
1a767849ab
Sort the options in the switch.
...
Should make finding them a little easier.
2010-12-24 17:35:33 +09:00
Bill Currie
d6b3d4891a
Finally, help output for qfprogs.
...
Nothing great, but better than nothing.
2010-12-24 17:33:57 +09:00
Bill Currie
f4d8b82115
Rearrange the options into alpha order.
2010-12-24 17:08:48 +09:00
Bill Currie
51b98ee758
Correct some errors.
2010-12-24 11:07:47 +09:00
Bill Currie
33e9fbba32
Win32 packaging improvements.
2010-12-24 10:41:09 +09:00
Bill Currie
a57717e2ab
Update my release script.
2010-12-24 09:51:07 +09:00
Bill Currie
28740bb57f
Add unsigned integer constant support.
2010-12-23 19:32:28 +09:00
Bill Currie
7934e29473
Fix up my big build script.
2010-12-23 16:51:02 +09:00
Bill Currie
32f7cd8b22
Get HTTP support (libcurl) working with mingw.
2010-12-23 13:18:43 +09:00
Bill Currie
2229c7557d
Update cross-build scripts.
...
They're hard-coded for my current setup, but easy to fix.
2010-12-23 11:45:08 +09:00
Bill Currie
de04e1b602
Lots of win32 (mingw cross) build fixes.
...
HTTP (curl) support is missing, but everything else builds.
2010-12-23 11:40:16 +09:00
Bill Currie
6c631c6d5d
Start documenting qfcc.
2010-12-19 11:35:18 +09:00
Bill Currie
52e844ee48
Produce slightly better v6 modulo code for complex inputs.
...
I'm having problems with temp defs, but I imagine this code is rarely used
so I won't worry about it for now. It will, however, make a good test case
for when I rework emit.c after I do some reading.
2010-12-19 11:23:33 +09:00
Bill Currie
b90833d86f
v6 modulo test
2010-12-19 11:19:23 +09:00
Bill Currie
fa08e4afb7
Print users info when dumping statements.
2010-12-19 11:16:04 +09:00
Bill Currie
f5706f9c44
Make control of expression dumping less of a hassle.
2010-12-19 11:15:13 +09:00
Bill Currie
d981968208
v6 modulo implementation now produces good code.
...
At least for simple inputs, anyway. That needs to be tested next.
2010-12-18 22:21:55 +09:00
Bill Currie
00e50c0ad3
Rewrite the v6 modulo implementation.
...
While trying to understand bind expressions, I discovered that the v6
modulo code was incorrect. This version is correct but uses one too many
temps. That's next.
2010-12-18 22:21:55 +09:00
Bill Currie
8197d34eda
Objective-C warnings documentation from gcc.
2010-12-16 20:12:24 +09:00
Bill Currie
699799bfc8
Don't warn when adding a new method to an implementation.
...
Methods defined in the implementation but not declared in the interface are
just fine.
2010-12-16 20:04:08 +09:00
Bill Currie
eace5b3c81
Get message checking working properly.
2010-12-16 16:41:16 +09:00
Bill Currie
a87ba3d0ea
Fix qwaq for the recent Array(Private) tweaks.
2010-12-13 19:10:05 +09:00
Bill Currie
4481ba9b0d
Allow explicit references to classes and categories.
...
Use "@reference ClassName;" or "@reference ClassName(CategoryName);" to
create a refence to the class or category, forcing the defining object file
to be linked into the program when the object file is part of a library.
2010-12-12 20:27:56 +09:00
Bill Currie
2c84ae4898
Don't let casting in constfold increment users.
...
This fixes Deek's temp notice. No new notices have shown up, so this should
be the correct fix. The constant folding code no longer calls cast_expr
directly, but rather uses an internal wrapper that decrements users after
cast_expr increments it, resulting in a no-op.
2010-12-12 15:37:26 +09:00
Bill Currie
d470094a55
Flip the nodes when flipping the plane.
2010-12-10 18:13:48 +09:00
Bill Currie
9ba70884c5
Prefer positive Z axis for 45 degree canonical planes.
2010-12-10 17:17:30 +09:00
Bill Currie
ba2a5838fd
Normalize the clip plane before adding it to the bsp.
2010-12-10 17:17:30 +09:00
Bill Currie
a0828ddd06
Clean up bsp limits.
...
Delete all bogus bsp limits, fixing the code that depended on them.
Document those limits that are dictated by the format.
2010-12-07 17:58:09 +09:00
Bill Currie
478ef21de0
Add some view opacity.
2010-11-28 15:31:40 +09:00
Bill Currie
83dc8c2a7a
Remove some unused files.
2010-11-28 15:31:40 +09:00
Bill Currie
0e8d6d896f
Do a bit of comment cleanup.
2010-11-28 15:31:40 +09:00
Bill Currie
ff41feb76e
Allow entity copying too.
2010-11-28 15:31:40 +09:00
Bill Currie
cb970bddce
Can now copy brushes.
...
Implement SetBrush's copyWithZone:
2010-11-28 15:31:40 +09:00
Jeff Teunissen
74d959ec64
Cope gracefully with wadfiles we can't handle
...
This is a weird little diff. We're doing a lot of gymnastics here so that
we don't have to crash (killing any loaded unsaved work!) when we find a
wadfile we don't know how to deal with.
2010-11-28 15:31:40 +09:00
Bill Currie
6702f04b46
Fix key resetting.
...
Make sure we don't add a new key-pair when the key already exists, and if
the existing value has the same pointer as the "new" value, do nothing.
2010-11-28 15:31:40 +09:00
Bill Currie
ff94a0f76a
Can now select textures.
2010-11-28 15:31:39 +09:00
Jeff Teunissen
47117f1762
return the actual string
...
Oops. I returned a text field instead of the string in it. :)
2010-11-28 15:31:39 +09:00
Jeff Teunissen
877067de61
Export the base directory of the open project
...
Project -baseDirectoryPath returns the absolute path to the directory from
which the .qpr file was loaded.
2010-11-28 15:31:39 +09:00
Bill Currie
22885a48ad
Correctly initialize the path variables.
...
Use the current project file, not the default.
2010-11-28 15:31:39 +09:00
Jeff Teunissen
0d0e7bfe18
TexturePalette.m: microscopic update
...
remove a bogus comment, clarify a printf call, add parens around a ternary
test.
2010-11-28 15:31:39 +09:00
Jeff Teunissen
ba508fa3e0
TexturePalette: Prevent NULL dereference
...
Keep the app from crashing on a wad that doesn't have any palette at all.
2010-11-28 15:31:39 +09:00
Bill Currie
d75f5f3f79
Fix brush selection.
...
The great cleanup caused a few vital returns to disappear (they probably
went to the same place a lot of my lego did).
2010-11-28 15:31:39 +09:00
Bill Currie
946a06b264
Don't crash if the palette entry is not first.
...
Instead, swap the palette entry and the first entry (only in memory).
2010-11-28 15:31:39 +09:00
Bill Currie
78a816dbdf
Correct miptex byte-count scaling factor.
2010-11-28 15:31:39 +09:00
Bill Currie
1928780af6
Support Quests' map format.
...
This is mostly because I have a few maps in this format.
2010-11-28 15:31:39 +09:00
Bill Currie
ae1d5245ad
Got the value/key backwards.
2010-11-28 15:31:39 +09:00
Bill Currie
c2644699a4
Even more conversions to NSString
2010-11-28 15:31:39 +09:00
Bill Currie
12d79ba28d
More conversions to NSString
2010-11-28 15:31:39 +09:00
Bill Currie
fd000b880d
Do a lot of conversions to NSString.
2010-11-28 15:31:38 +09:00
Bill Currie
2ac2f5fab5
Change path_projectinfo to NSString.
2010-11-28 15:31:38 +09:00
Bill Currie
1180a54d67
It seems I forgot to commit this with the plist changes.
2010-11-28 15:31:38 +09:00
Bill Currie
b28ba46448
Fix wad loading when loading the map.
...
This broke with the fix for the entity inspector.
2010-11-28 15:31:38 +09:00
Bill Currie
da2c87f964
Use QF's property lists for the project file.
2010-11-28 15:31:38 +09:00
Bill Currie
24fad619d1
First step in cleaning up Dict.
2010-11-28 15:31:38 +09:00
Bill Currie
5c0fb3ecd3
Correct an error message.
2010-11-28 15:31:38 +09:00
Bill Currie
6c96402403
Get the button icons set properly.
...
There are still issues with the way gorm does things, but this works for
now.
2010-11-28 15:31:38 +09:00
Jeff Teunissen
602564075d
install images into Resources
...
Install the button icons into the app when we make it.
2010-11-28 15:31:38 +09:00
Jeff Teunissen
edf5f6e018
find $GNUSTEP_MAKEFILES
...
Enable locating the GNUstep makefiles using the various schemes available
(in order of reliability), eventually reaching a hardcoded default.
2010-11-28 15:31:38 +09:00
Jeff Teunissen
0e5cd14829
tactical whitespace bomb
...
Add return-type information to all methods, split up lines properly where
I could find them, and ran the whole thing through uncrustify. Looks purty
now. :)
2010-11-28 15:31:38 +09:00
Jeff Teunissen
a4eec40843
Remove -read:/-write from Storage
...
Apparently GS doesn't do TypedStream any more...
2010-11-28 15:31:38 +09:00
Jeff Teunissen
cdc79ae6f8
Add type information, don't return self most of the time
...
Start "modernizing" the code base; old code is based heavily in the
Smalltalk style, where everything that doesn't return a different object
returns self. This can be useful, but it isn't what is usually done these
days. Also, add type information (which didn't exist in "the old days" --
an object was an "id", not a "Foo *") to help with debugging.
2010-11-28 15:31:38 +09:00
Jeff Teunissen
7dc5d26480
SetBrush: signed/unsigned fix
2010-11-28 15:31:37 +09:00
Jeff Teunissen
dbab1545e5
Comment an #if 0
...
Looks like John Carmack was going to implement "reference" .qpr directories,
where they would contain a reference to the "real" base path, but never got
it finished. Make a note in the source to explain the "dead" code.
2010-11-28 15:31:37 +09:00
Jeff Teunissen
4d63d20663
signed/unsigned and some const-correctness
2010-11-28 15:31:37 +09:00
Bill Currie
646422d683
Get the timing right when setting the wad file in worldspawn.
2010-11-28 15:31:37 +09:00
Bill Currie
939605309f
Do error checking when trying to load a wad file.
2010-11-28 15:31:37 +09:00
Bill Currie
997df6c310
Char buffer audit.
...
Get rid of most static char buffers. The few remaining are either in file
structs or messy code that needs further analysis.
2010-11-28 15:31:37 +09:00
Bill Currie
1b7be81f11
Do a const-correct run.
2010-11-28 15:31:37 +09:00
Bill Currie
62c73b300e
Fix the tangled mess of entity connections.
...
What was the person who wrote valueForQKey thinking? Make the function
const-correct and bubble the changes through the code.
2010-11-28 15:31:37 +09:00
Bill Currie
3574668fe3
Connect the region filtering switch.
...
Region filtering now seems to work. Also added a tool tip.
2010-11-28 15:31:37 +09:00
Bill Currie
d8773fddb1
Get the entity flags switches into the right initial stage.
2010-11-28 15:31:37 +09:00
Bill Currie
68190bd431
Echo the output to stdout as well as the output box.
2010-11-28 15:31:37 +09:00
Bill Currie
1aae3c8174
Get the inspector button displaying properly.
2010-11-28 15:31:37 +09:00
Bill Currie
bb3ea99806
Fix texture names.
2010-11-28 15:31:36 +09:00
Bill Currie
dcc4187a8c
Get the timing write for when to restore the rects.
2010-11-28 15:31:36 +09:00
Bill Currie
9cc66c3de1
A bit more code cleanup.
2010-11-28 15:31:36 +09:00
Bill Currie
1e6cdb4bb8
Replace PS*instance.
...
It's a little flakey (doesn't always do the right thing), but it's a good
start. I'd like to do much smaller rectangles, and get the timing right.
2010-11-28 15:31:36 +09:00
Bill Currie
73a82342db
Get the inspector button mostly working thanks to Deek's help.
2010-11-28 15:31:36 +09:00
Bill Currie
7c3e6b8bdc
Rectirect Sys_Printf's output to the command output box.
2010-11-28 15:31:36 +09:00
Bill Currie
3a6e5ea179
Fix a string comparision mistake.
...
This snuck in with the parser changes.
2010-11-28 15:31:36 +09:00
Bill Currie
4ed7290d9f
Fix an uninitizized variable.
2010-11-28 15:31:36 +09:00