Commit graph

422 commits

Author SHA1 Message Date
Bill Currie
23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
f781e9078c Correct some typos in error messages. 2012-05-06 18:43:18 +09:00
Bill Currie
78a9ba2557 Make expression alias chains not-a-bug.
The common cause seems to be casting a cast (very common, and I'm not sure
just realiasing the expression would be right). It does't cause any harm
(particularly, it doesn't trigger alias def chains), so I won't worry about
it.
2012-05-03 13:57:31 +09:00
Bill Currie
ec98e3e206 Mark alias def chains as a bug. 2012-05-03 13:27:30 +09:00
Bill Currie
bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Jeff Teunissen
6ead583195 Ruamoko: Implement infinity.
The special token __INFINITY__, like __FILE__ and friends, will expand to
a floating-point expression containing a value the C compiler considers
infinite. Obviously, this assumes that the system has relatively modern
float hardware -- but if it doesn't, having Ruamoko be able to represent
float infinity is the least of your problems. :)
2011-12-14 12:20:10 -05:00
Bill Currie
fd6e341e06 Clean up cast_expr() a little bit. 2011-04-10 00:29:27 +09:00
Bill Currie
57ed603658 Extract values from constant defs. 2011-04-09 12:42:41 +09:00
Bill Currie
55cc0f9206 Bring back the unsigned type (PROGS version bump)
This is only low-level support (the unsigned keyword still does not work),
but sufficient to make switch statements using jump tables work.
2011-04-09 10:07:47 +09:00
Bill Currie
237f11c472 Fix cast expressions.
Casting between ints and floats needs special treatment to get the
conversion operator, but other casts need to be aliases.
2011-04-08 13:55:26 +09:00
Bill Currie
c4a398850a Fix defs as constants for vectors and quaternions. 2011-04-04 21:31:59 +09:00
Bill Currie
2c9c1bd968 Ensure defs for @self and @this are generated. 2011-04-03 13:00:48 +09:00
Bill Currie
8e18c76bde Make initialized variables defs rather than immediate constants. 2011-03-30 19:58:09 +09:00
Bill Currie
f1d9570dc8 Fix constant value type handling.
Rename immediate.[ch] to value.[ch] and clean up the mess.

Add convert_value() to convert the type of a value (only scalar types).
2011-03-22 12:24:39 +09:00
Bill Currie
899af3119b Use the correct type when generating a move expression. 2011-03-10 19:30:21 +09:00
Bill Currie
39278ba8cc Explicitly select between direct and indirect moves. 2011-03-09 10:30:57 +09:00
Bill Currie
f66e20db17 Set the dereferenced type in the field value. 2011-03-08 19:29:36 +09:00
Bill Currie
7198be5726 Treat entities a bit like structures in field_expr ().
Look in the entity field symbol table for the field before looking in the
normal symbol table. This allows entity fields to be accessed even when
the current scope has symbol of the same name. However, checking the
normal symbol table where there is no such field allows for field
variables when I get around to implementing them.
2011-03-08 19:28:11 +09:00
Bill Currie
c069bafad8 Support casting from enum to float. 2011-03-07 14:04:05 +09:00
Bill Currie
0b3d0011c5 Implement vector and quaternion component access. 2011-03-07 10:02:20 +09:00
Bill Currie
f0e47f2334 Clean up some code duplication. 2011-03-07 10:01:21 +09:00
Bill Currie
a6f222106e Fix taking the address of normal variables.
Treat them the same as structure variables.
2011-03-07 09:58:51 +09:00
Bill Currie
3c1784d46c Fold constants on both sides of = to ensure correct expression types. 2011-03-07 08:33:30 +09:00
Bill Currie
b49d90e769 Do not lose the block expression when taking its address. 2011-03-06 16:32:51 +09:00
Bill Currie
c78d15b331 Support taking the address of block expressions that have a result. 2011-03-06 16:05:38 +09:00
Bill Currie
993d05b3d3 Support taking the address of alias expressions.
Taking the address of an alias expression undoes the alias but uses the
aliased type.
2011-03-06 15:58:49 +09:00
Bill Currie
b7aa2f6786 Support access to struct fields in a structure in an entity. 2011-03-06 15:39:27 +09:00
Bill Currie
417d1b4442 Fix structure copy into and out of entities. 2011-03-06 13:19:20 +09:00
Bill Currie
8cfa80b5d4 Implement think expressions. 2011-03-05 18:01:37 +09:00
Bill Currie
a3c1f339fc Gracefully handle undefined symbols in entity field expressions. 2011-03-05 17:22:04 +09:00
Bill Currie
bbedbf5c9c Add the .return etc symbols to the symbol table.
This puts their defs into the object file.
2011-03-05 08:37:51 +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
74e6b13aee Use alias expressions where possible when testing an expression. 2011-03-03 13:47:28 +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
c12211d8bb Support enum results for boolean expressions.
eg enum BOOL x = a && b;
2011-03-02 22:46:55 +09:00
Bill Currie
aa4ed00090 Fix the message type used to check arguments. 2011-03-02 22:13:16 +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
5252d72856 Correct the type for _OBJ_SELECTOR_TABLE. 2011-02-15 15:33:12 +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
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
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
b545f72f93 Report errors for incomplete types and missing fields. 2011-02-13 20:23:08 +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
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
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