Commit graph

62 commits

Author SHA1 Message Date
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
Bill Currie
66aa36b73f start implementing storage classes (extern, static, etc) 2002-06-28 17:59:32 +00:00
Bill Currie
8415db2d84 clear out the hash tables for compiling multiple object files 2002-06-28 16:00:01 +00:00
Bill Currie
001571e25a various memory saving tricks. seems to have not broken anything 2002-06-27 22:48:28 +00:00
Bill Currie
26dce371d9 clean up type allocation a little and also reloc allocation 2002-06-26 22:10:59 +00:00
Bill Currie
f8dee80355 add unions 2002-06-20 20:28:01 +00:00
Bill Currie
e774943f24 va.[ch]:
new va function: nva which returns a strduped buffer
expr.c options.c:
	use nva instead of strdup (va (...
struct.c type.c:
	make type encoding work properly for structs
2002-06-13 16:39:33 +00:00
Bill Currie
1e57351be1 there, no more PR_* functions or pr_* files :) 2002-06-09 04:30:02 +00:00
Bill Currie
943c2eefb3 redo def allocation to come from configurable `spaces' (locals, globals, far
globals, etc).
2002-06-09 03:57:20 +00:00
Bill Currie
e17604f9c2 remove all arbitrary limits except for globals. they'll need a little more
work. Once they're done, it should take quite a big mod to crash qfcc due
to too many strings/statements/etc :)
2002-06-05 17:12:55 +00:00
Bill Currie
69605d0b19 even more cleanup 2002-06-04 21:23:39 +00:00
Bill Currie
06bddd3ee6 more cleanup 2002-06-04 18:44:03 +00:00
Bill Currie
7b993f97d2 more cleanups 2002-06-01 05:30:16 +00:00