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
0d5ab6600d
Store the source expression in a statement.
...
This makes problem reporting more informative.
2011-02-08 18:18:34 +09:00
Bill Currie
3c849b970b
Handle union access now that they're detected properly.
2011-02-08 14:45:48 +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
28ba4b5712
Correct a comment.
2011-02-07 09:56:33 +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
2860a8b28b
enum too is a scalar.
2011-02-06 20:01:55 +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
d9446c5eb0
Fix builtin methods.
2011-02-04 22:31:22 +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
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
400abe7fce
Allow freeing of typechains.
2011-02-02 15:15:24 +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
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
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
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
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
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
36c99a8da1
Get function def creation working again.
2011-01-26 14:48:22 +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
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
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
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
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
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
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
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
4a24393d8d
Temp expressions now use operands instead of defs.
2011-01-21 11:26:43 +09:00
Bill Currie
16e013ff5d
Allow the operand to override the symbol's type.
2011-01-21 10:56:32 +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
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
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
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
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
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
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
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
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
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
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
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
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
58042719e5
A little more documentation for expressions.
2011-01-03 16:19:28 +09:00
Bill Currie
6c631c6d5d
Start documenting qfcc.
2010-12-19 11:35:18 +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
67beaf4487
Nil is a constant, so allow it in global initializers.
2010-11-24 17:01:18 +09:00
Bill Currie
d045045693
get the grouping right
2010-08-11 23:42:14 +00:00
Bill Currie
f04bc64ef1
clean up a bunch of doxygen warnings
2010-08-11 23:41:30 +00:00
Bill Currie
0dfff8fd58
ignore stuff
2010-08-07 10:42:09 +00:00
Bill Currie
56d01ce267
found an uncontrollable warning
2010-02-20 12:01:49 +00:00
Bill Currie
997102fea8
audit the usage of "only"
...
There are still a few iffy places (notably around certain prepositions), but
the relevant sentences are now much easier to read.
2010-01-13 06:42:26 +00:00
Bill Currie
ae4fc3147d
allow '*pointer' expressions
2010-01-13 06:31:41 +00:00
Bill Currie
ccb8faf6ef
produce a warning for the likes of "x - x & y"
2010-01-13 06:26:18 +00:00
Bill Currie
40fefff847
fix incorrect users for temps resulting from casting the result of ?:
...
There are probably other situations, but I'll fix them as they show up.
2010-01-13 06:25:06 +00:00
Bill Currie
c3f47efb07
add --qccx-escapes to resolve the conflicts in escape sequences and document the escape sequences supported by qfcc.
2009-12-25 07:59:25 +00:00
Bill Currie
9ac15436d9
More docs.
...
Enhance qfprogs qfo debugging.
Make sure functions marked as extern don't emit anything. Fixes the segfault
when building klik.
2008-08-01 13:54:24 +00:00
Bill Currie
23e3fc0cb8
document most of obj_file.h (and a few other doc tweaks)
2008-08-01 00:47:38 +00:00
Bill Currie
a376e6f86d
make control of progdefs.h generation saner
2007-04-28 05:40:22 +00:00
Bill Currie
2e6ecd97c8
d'oh
2007-04-10 13:01:45 +00:00
Bill Currie
52d178b3be
Add a code generation option, "local-merging", to control qfcc's merging of local variable blocks into one block. Defaults to on for advanced mode and off for traditional.
2007-04-10 13:00:21 +00:00
Bill Currie
e53e9944b6
spew a lot of guff about relocs
2007-04-09 13:33:59 +00:00
Bill Currie
a9678f1c06
dump globals direct from qfo
2007-04-09 07:47:51 +00:00
Bill Currie
9509d0fd5e
make qfo files typesize safe
2007-04-07 12:35:03 +00:00
Bill Currie
f6924f35e5
report the line of the previous declaration of the function
2007-04-06 12:02:34 +00:00
Bill Currie
04765083aa
really warn only once for each uninitialized variable
2007-04-06 08:56:37 +00:00
Bill Currie
72af804b31
nested include reporting
2007-03-31 15:27:36 +00:00
Bill Currie
1925bef0c1
fix a bunch of bugs with single-cpp processing when not keeping temps
2006-08-20 06:20:30 +00:00
Bill Currie
130e6c1a3f
fix some intermediate file issues
2006-05-24 14:50:24 +00:00
Bill Currie
f7df6fea17
instead of having cpp args in progs.src, potentially breaking some mods, generate progs.i as a series of #includes and then compile everything in one pass
2006-05-24 14:35:39 +00:00
Bill Currie
8f097ce3dd
fix a couple of typoes
2006-05-24 12:58:31 +00:00
Bill Currie
66cabb587f
add the vector-calls "optimisation" from fteqcc. makes it possible to
...
compile the version of frogbot with waypoints for almost 300 maps.
2005-06-10 07:31:25 +00:00
Bill Currie
501180aaac
gcc-4.0 fixes. even found some bugs :) (names /not/ mangled this time)
2005-06-08 06:35:48 +00:00
Bill Currie
66257e3a88
run in fear, function overloading is here
...
This is an imperfect revision of history.
2004-11-13 11:50:00 +00:00
Bill Currie
4d044bfea4
make entity.vector.x work properly by making relative field offset work. also don't emit a field def for the resulting immediate
...
This is an imperfect revision of history.
2004-11-12 10:49:00 +00:00
Bill Currie
64cc8c60d2
compile time protocol support seems to be complete now. fortunatly, protocols had never been written out so the corrections to the protocol related stuctures do not need a progs version bump. runtime protocol support hasn't been fully tested yet.
...
+load runtime support seems to be working.
This is an imperfect revision of history.
2004-11-11 00:34:00 +00:00
Bill Currie
b35561504c
do proper selector registration. unfortunatly, I discovered I'd created pr_method_t incorrectly and so had to bump the progs version again
...
This is an imperfect revision of history.
2004-11-10 05:37:00 +00:00
Bill Currie
b46cff08aa
handle param name changes between prototype and declaration gracefully
...
This is an imperfect revision of history.
2004-11-02 23:54:00 +00:00
Bill Currie
fff41d664a
detect re-declaring identifiers as different types (typedef, enum, var, etc)
...
This is an imperfect revision of history.
2004-11-02 07:02:00 +00:00
Bill Currie
14900bb82e
fast-float code option (defaults to on). kills almost 3000 statements from
...
prozac
2004-04-27 20:24:37 +00:00
Bill Currie
7b28c555ba
quaternion field access now works
2004-04-09 04:12:44 +00:00
Bill Currie
0e47ee96f8
spelling fixes
2004-04-08 18:53:46 +00:00
Bill Currie
fc2413ff72
more quaternion work (should be working, haven't come up with tests yet)
2004-04-08 03:32:14 +00:00
Bill Currie
f1c9a8d24b
remove a mostly unused field
2004-02-21 05:58:01 +00:00
Bill Currie
14e8bfe94b
auto-init for uninitialized locals in traditional mode as requested by
...
Grievre
2004-02-21 05:52:05 +00:00
Bill Currie
0360859a0f
all warnings (except for @self and self) are now fully controllable
2004-02-17 00:39:21 +00:00
Bill Currie
c3f41e3e69
new opcode: state.f. same as state, but takes a 3rd float operand to
...
specify the step for calculating nextthink. accessed using
[frame, think, step] (state is [frame, think])
2004-02-11 01:43:33 +00:00
Bill Currie
1fc517f7db
C style functions can now (optionally) be used (void foo ();)
2004-02-11 00:36:34 +00:00
Bill Currie
892e80938b
that made a royal mess :(
2004-02-04 04:49:46 +00:00
Bill Currie
b2474a2b97
better auto-conversion of function parameters (ugh, this is getting messy
...
:( )
2004-02-04 04:33:08 +00:00
Bill Currie
4f9a24d94d
and another one
2004-02-03 03:38:51 +00:00
Bill Currie
16e4964a31
fix a couple struct forward ref issues
2004-01-30 07:16:48 +00:00
Bill Currie
d3018dd79b
move qfprogs in with qfcc (it's going to need to share code)
2004-01-28 05:23:43 +00:00
Bill Currie
51b0a66ac7
better constant folding with auto-conversion between scalar types (might
...
make that optional for non-constants)
2004-01-25 08:55:03 +00:00
Bill Currie
72ae59f882
short circuit logic can now be controlled (see man page)
2003-10-22 08:27:38 +00:00
Bill Currie
945006494f
short circuit logic for && and || (as per C). forces standard precedence
...
(ie, breaks --traditional) when enabled (no choice at the moment, next fix)
2003-10-22 08:05:17 +00:00
Bill Currie
9027648721
kill -t for --traditional, add --advanced, default to --traditional for
...
progs.src mode and --advanced otherwise
2003-09-20 04:13:32 +00:00
Bill Currie
11538d4745
access arrays in structs more efficiently (especially when using constant
...
indeces)
2003-09-02 17:41:16 +00:00
Bill Currie
385a90e8fb
correct pr_symtab_t to include the pointer to the array of selectors used
...
in the module. Unfortunatly, this requires a version bump on both qfo and
progs files due to the changes structure layout.
2003-08-23 06:15:19 +00:00
Bill Currie
b38486d405
make rel_def_op work properly
2003-08-22 19:48:14 +00:00
Bill Currie
204243fe95
better message type checking
2003-08-22 05:26:47 +00:00
Bill Currie
11c7c27f70
better relocations: pointers to structure members now work
2003-08-21 02:21:30 +00:00
Bill Currie
7d830ffc1f
make @defs work properly and don't do uninitialized checks on structs
2003-08-20 19:58:41 +00:00
Bill Currie
dd9ab1e050
get unsigned mostly working
2003-08-01 21:20:04 +00:00
Bill Currie
1b5bf9d176
make methods showing up only in the implementation work when overiding an
...
inherited method
2003-08-01 05:08:15 +00:00
Bill Currie
6ecb707257
revamp the struct system so "struct foo;" does the right thing (ala C)
2003-07-30 04:11:45 +00:00
Bill Currie
5e6b25c917
add interface-check warning option. defaults off
2003-07-29 18:31:12 +00:00
Bill Currie
5b9b11241b
make method lookup work with id
2003-07-29 17:38:29 +00:00
Bill Currie
be6a7ae715
d'oh
2003-07-27 21:33:05 +00:00
Bill Currie
5962900e25
allow rel_def_op relocs to point just past the end of the code. needed for
...
jump tables.
2003-07-24 17:51:24 +00:00
Bill Currie
778cd78c35
fix some namespace issues with names both being a field and an ivar
2003-07-23 18:28:31 +00:00
Bill Currie
dedb2fa6bf
get [super ...] working correctly
2003-05-15 05:58:31 +00:00
Bill Currie
b6b5089ccc
add a "nosave" flag to defs making it easier to make defs that don't get
...
saved automaticly
2003-04-25 17:00:22 +00:00
Bill Currie
f7d806e8d5
can now handle > vector sized parameters
2003-04-22 20:11:16 +00:00
Bill Currie
2f6fc5d80c
general revamp so params and the return value use proper defs rather than
...
hardcoded locations. this will allow use of quaternions in the future.
2003-04-22 15:29:32 +00:00
Bill Currie
eb099ae0d3
make qf gcc 3.3 clean
2003-04-17 00:01:48 +00:00