Bill Currie
07e6baf32f
[qfcc] Support { } as nil in nested initializers
...
Did top-level earlier, but forgot to add support for deeper nestings.
2020-03-06 20:32:37 +09:00
Bill Currie
9b269c2f8e
[qfcc] Fix mangled method parameters
...
Method parameters (ie, extra parameters without selector names) were
getting reversed during function type construction.
2020-03-06 17:37:58 +09:00
Bill Currie
94e35b5f57
[qfcc] Clean up error messages around superclass
2020-03-05 21:10:15 +09:00
Bill Currie
1bf56b28ac
[qfcc] Warn when messaging a forward-declared class
...
But only once.
2020-03-05 15:39:34 +09:00
Bill Currie
efcbbbb641
[qfcc] Catch use of missing superclass interfaces
2020-03-05 08:50:29 +09:00
Bill Currie
896c14f33a
[qfcc] Support anonymous structs in ivars
...
Missed this earlier.
2020-03-05 08:47:21 +09:00
Bill Currie
269a8a558a
[qfcc] Allow bare enum and named struct declarations
...
Got a little overzealous there
2020-03-04 18:39:41 +09:00
Bill Currie
f532780dbe
[qfcc] Treat opaque structs as not anonymous
...
I don't know why the segfault happened where it did, but
forward-declared structs certainly can't be used as anonymous structs.
2020-03-04 18:38:04 +09:00
Bill Currie
7a2335e9f4
[qfcc] Catch useless specifiers in function scope
2020-03-04 18:07:10 +09:00
Bill Currie
4c82114547
[qfcc] Catch several useless specifier expressions
2020-03-04 17:40:49 +09:00
Bill Currie
597890dda1
[qfcc] Catch duplicate field definitions
2020-03-04 16:32:04 +09:00
Bill Currie
e298904dc0
[qfcc] Implement anonymous structs and unions
...
For struct/union scope
2020-03-04 16:31:28 +09:00
Bill Currie
b186332da0
[qfcc] Make initialization of external vars an error
2020-03-03 17:33:56 +09:00
Bill Currie
16223098e5
[qfcc] Fix ivar visibility
...
It was broken by the big rewrite and I forgot to fix it.
2020-03-03 10:42:05 +09:00
Bill Currie
e33d83fc9e
[qfcc] Accept "struct foo; struct foo { ... };"
...
That is, do not treat structure definition after declaration to be a
redefinition.
2020-03-02 20:16:29 +09:00
Bill Currie
0db617719e
[qfcc] Improve error messages for bad qc builtins
...
While global quakec functions could not be initialized to another
function, the error messages were rather obscure.
2020-03-02 13:47:46 +09:00
Bill Currie
254bf29bd4
[qfcc] Handle protocol forward declarations
2020-03-01 19:37:40 +09:00
Bill Currie
caa297b756
[qfcc] Remove type alias encoding
...
It proved to be too fragile in its current implementation. It broke
pointers to incomplete structs and switch enum checking, and getting it
to work for other things was overly invasive. I still want the encoding,
but need to come up with something more robust.a
2020-03-01 16:13:18 +09:00
Bill Currie
b4aebc120e
[qfcc] Treat { } as nil for initializing compound types
2020-02-27 20:30:39 +09:00
Bill Currie
7c9072aebf
[qfcc] Create struct fields for "type typename"
...
Such declarations were being lost, thus in the following, the id field
never got added:
typedef struct qwaq_mevent_s {
int id;
int x, y, z;
int buttons;
} qwaq_mevent_t;
2020-02-27 17:50:11 +09:00
Bill Currie
dbbb8a1396
[qfcc] Fix syntax error for id as a field name
...
event.e.mouse.id produced a syntax error, which is contrary to
Objective-C.
2020-02-27 17:43:39 +09:00
Bill Currie
9610788dea
Fix some more type aliasing issues
...
Getting there... (I knew this would be a big job)
2020-02-19 21:41:46 +09:00
Bill Currie
a5aba6c8ac
Implement type aliasing
...
The separate types are in the file, but there are multiple issues
2020-02-19 21:41:46 +09:00
Bill Currie
7a315b4a89
Fix storage class for for-loop declarations
...
Getting "i redeclared" when i was declared in a for loop in two
different functions was a tad unexpected.
2020-02-19 21:41:46 +09:00
Bill Currie
ee228504aa
Fix self-referenced enum declarations
...
eg:
typedef enum foo {
bar = 1,
baz = bar,
} foo;
2020-02-19 02:35:09 +09:00
Bill Currie
9d2d33fa50
Implement %% (true modulo) support in qfcc
...
However, it's not quite working yet
2020-02-16 11:57:58 +09:00
Bill Currie
ef4ad52239
Make binary_expr fold constants
...
This is where constant folding should have happened all along. While
unary_expr should fold constants too, it seems to already try to do so
and it's a bit much of a mess to clean up right now.
2019-06-10 00:36:13 +09:00
Bill Currie
e849c2d1ce
Mark block expr result as rvalue when used as one
...
At least for return. There may be other cases that need it, but this
fixes comma-expr.r (minus int->float promotion issues).
2019-06-09 19:29:21 +09:00
Bill Currie
7fce68649a
Implement comma expressions
...
Doesn't quite work (attempt to suppress warning for return a = 3, 5;
failed).
2019-06-09 16:56:20 +09:00
Bill Currie
689d1ad3ec
Remove some debug prints
2019-06-09 16:45:01 +09:00
Bill Currie
ec89149b29
Build for loop decl inits correctly
...
The multiple expressions are chained together and evaluate in left to
right order.
2019-06-09 13:54:03 +09:00
Bill Currie
5bd3c8c985
Allow variable declarations in for loops
...
Matches C, C++ and C#
2019-06-08 21:52:17 +09:00
Bill Currie
be4c3a82a2
Detect redefinitions of structs and unions
...
While the redefinition was being detected, it was misreported as the tag
being wrong, and on the wrong line, too.
2019-06-08 19:25:25 +09:00
Bill Currie
4ef4a7e955
Start work on simple names in symbol tables
...
I don't remember what the goal was (stopped working on it eight months
ago), but some possibilities include:
- better handling of nil (have trouble with assigning into struts)
- automatic forward declarations ala C# and jai (I was watching vids
about jai at the time)
- something for pascal
- simply that the default symbol type should not be var (in which case,
goal accomplished)
2019-06-06 07:01:44 +09:00
Bill Currie
ff5c1cd4c2
Clean up redundant type parameter to initialize_def.
2018-10-15 22:11:20 +09:00
Bill Currie
3295370328
Expose and use field_expr().
...
This may cause problems later on, but it is needed for the binary_expr()
cleanup.
2013-09-27 23:15:57 +09:00
Bill Currie
7a7a685105
Add support for actual vector expressions.
...
Currently, they can represent either vectors or quaternions, and the
quaternions can be in either [s, v] form or [w, x, y, z] form.
Many things will not actual work yet as the vector expression needs to be
converted into the appropriate form for assigning the elements to the
components of the "vector" type.
2013-09-27 23:15:57 +09:00
Bill Currie
a6cdc8735a
Start implementing vec = [x,y,z].
...
This is a nice feature found in fteqcc (also a bit of a challenge from
Spike). Getting bison to accept the new expression required rewriting the
state expression grammar, so this is mostly for the state expression. A
test to ensure the state expression doesn't break is included.
2013-09-27 23:15:56 +09:00
Bill Currie
cef2136050
Implement "not" logic for while and do-while.
...
This goes towards complementing the "if not" logic extension. I need to
check if fteqcc supports "not" with "while" (the version I have access to
at the moment does not), and also whether it would be good to support
"not" with "for", and if so, what form the syntax should take.
2013-06-26 23:04:35 +09:00
Bill Currie
8d34d33055
Implement "if not (foo)" syntax.
...
It is syntactic sugar for if (!(foo)), but is useful for avoiding
inconsistencies between such things as if (string) and if (!string), even
though qcc can't parse if not (string). It also makes for easier to read
code when the logic in the condition is complex.
2013-06-26 23:02:55 +09:00
Bill Currie
46d2959908
Delay calling find_type for enums.
...
As find_type encodes the type too, calling find_type before the enumerators
have been created causes the type encoding to lose the enumerators.
2013-01-17 20:55:25 +09:00
Bill Currie
76a69d9a53
Implement fteqcc's "nosave" specifier.
...
Of course, it's "@nosave" for traditional progs, but that's only a define
away.
2013-01-07 14:35:34 +09:00
Bill Currie
1e3154ecd5
Do not always reset current_storage.
...
resetting current_storage in external_def_list's empty rule breaks the
block storage scopes (extern { ... } etc);
2012-12-25 13:43:52 +09:00
Bill Currie
a778d45ebf
Drop non-function symbols returned from function_symbol.
...
In such situations, everything is a mess from earlier errors.
2012-12-23 14:25:09 +09:00
Bill Currie
996b2734a4
Reset current_class in the top-level error rules.
...
This fixes a weird internal error after a parse error in an ivar
declaration.
2012-12-23 05:57:13 +09:00
Bill Currie
ff4b232d92
Reset current_storage when resetting current_symtab.
...
This helps prevent an internal error caused by ealier errors.
2012-12-22 20:04:11 +09:00
Bill Currie
7d928047ae
Remove support for break as an identifier.
...
I never really liked it, but I have a better solution in the pipe-line.
2012-12-22 16:29:43 +09:00
Bill Currie
6d6f231bd2
Fix mangling of types when attaching protocols.
...
The protocol attachment test was in the wrong place, and there were some
typos in compare_protocols and procollist_find_protocol.
2012-12-20 13:12:05 +09:00
Bill Currie
3af031c33d
Move the rest of the obj specific stuff into class.c.
...
This gives better hiding of implementation details.
2012-12-20 10:10:41 +09:00
Bill Currie
f181772a76
Attach protocolrefs to class types.
...
The protocolrefs (as protocollist_t) are attached to the type as a
qualifier.
2012-12-20 10:10:41 +09:00