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
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
0872961269
Do a little bit of cleanup.
2012-12-04 12:48:52 +09:00
Bill Currie
5725c5124c
Rename the storage_class_t enum values.
...
With the intoduction of the statement type enum came a prefix clash. As
"st" makes sense for "statement type", I decided that "storage class"
should be "sc". Although there haven't been any problems as of yet, I
decided it would be a good idea to clean up the clash now. It also helps
avoid confusion (I was a bit surprised after working with st_assign etc to
be reminded of st_extern etc).
2012-12-02 10:11:30 +09:00
Bill Currie
28ce35f1c1
Make values independent objects.
...
values are now uniquely allocated (for the current object file). With
this, constants in dags will work.
2012-11-15 13:44:06 +09:00
Bill Currie
23a38738fc
Massive whitespace cleanup.
...
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
bc1b483525
Nuke the rcsid stuff.
...
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
9b62c8c126
Rename ty_type_e to ty_meta_e and type_t.ty to type_t.meta
2011-03-22 16:06:47 +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
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
c12211d8bb
Support enum results for boolean expressions.
...
eg enum BOOL x = a && b;
2011-03-02 22:46:55 +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
814e36d3c8
Correct an error message and tidy some code.
2011-02-15 22:25:40 +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
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
127a1c8772
Fix the creation of enum values.
2011-02-13 15:19:55 +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
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
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
e04ed72afa
Increment the index when emitting array elements.
...
Oops :)
2011-02-04 08:25:27 +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
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
0624408317
Move the diagnostic functions into their own file.
2011-01-24 21:54:57 +09:00
Bill Currie
afc5b2827d
Simplify def handling, use far data.
...
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.
Also, start using far data for ObjQC structures.
The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00
Bill Currie
5deda9c9b9
Clean out ex_def as ex_symbol replaces it.
2011-01-19 22:25:04 +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
b186173d18
Fix a segfault in structure finalization.
2011-01-18 08:59:44 +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
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
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
a623fb53a7
Proper support for empty structs and unions.
...
They now have a single private, void, unnamed member, resulting in a size of
1 word. This makes empty structs useful for typed opaque handles.
2010-11-24 17:01:17 +09:00
Bill Currie
07b61aa23f
missed \0-9 for the gold numbers from qccx
2010-01-13 06:22:01 +00:00
Bill Currie
3fb03fc2be
hah, should have been using __attribute__((used)) all that time (rather
...
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
efb52dc9f9
don't seg on null field names
2004-02-13 23:08:22 +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
24f4bcfebf
initialize the new field properly
2003-08-01 02:43:51 +00:00
Bill Currie
9f0d4cc746
must use save_string when source of string is unknown :P
2003-07-31 06:14:26 +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
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
761a7546dd
re-arrange things so __attribute__ and __builtin_expect are properly
...
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie
567b905590
copyright block work
2002-10-22 14:53:18 +00:00
Bill Currie
27effb5075
make struct_t and enum_t globally visible, re-do how enum info is stored
...
and make it possible to create a structure using a pre-existing type
2002-10-16 02:05:39 +00:00
Bill Currie
4d69deb205
class.c:
...
use the correct type when creating the class def
struct.c:
save the name
2002-07-16 04:37:51 +00:00
Bill Currie
e550ad670a
more linking fixes, including seting up relocations. not quite working yet
2002-07-13 06:09:03 +00:00
Bill Currie
c0880a94a9
print the name of the duplicate struct
2002-07-13 03:20:17 +00:00