Commit graph

85 commits

Author SHA1 Message Date
Randy Heit
1e7cce5a2c Add missing NewPointer() function 2015-03-14 22:04:53 -05:00
Randy Heit
2adf5782b9 Return propertype conversion routes larger than 1
- Fixed: PType::FindConversion() gave all but the source type a distance of
  0, so it only ever returned just one step of a route that requires more
  than one step.
2013-10-30 20:52:46 -05:00
Randy Heit
e7616ec0bd Add D-style properties to the numeric types
- This is stuff like min and max for integral types and infinity and nan
  for floating point types.
2013-10-29 22:06:03 -05:00
Randy Heit
fe21ceec56 Add a constructor to PSymbolTable that takes a parent table as input 2013-10-29 22:05:56 -05:00
Randy Heit
e696fff0be Capitalize some names that weren't before.
- Since this caused several duplicate names to creep in, try to be more
  consistant abount name capitalization.
2013-10-29 22:05:49 -05:00
Randy Heit
82c22459dc Give all types a symbol table, not just structs and derivatives 2013-10-29 22:05:25 -05:00
Randy Heit
b227a2f508 Add the basic types to the global symbol table 2013-10-29 22:05:16 -05:00
Randy Heit
c7e817dfb9 Added type conversion search routines
- PType::FindConversion() can find a path to convert one type to another.
  This is completely generic and can handle any number of conversion
  functions.
2013-10-23 22:39:51 -05:00
Randy Heit
a0dbcb5d5b Add TRUE and FALSE terminals to the zcc grammar
- I can't believe I completely forgot to let the parser handle true and
  false literals.
- Consolidate all the %include blocks in zcc-parse.lemon into a single
  one, because Lemon all of a sudden decided it didn't like me having more
  than one in the grammar file.
- Added a PBool type to represent boolean values with.
2013-09-28 21:16:44 -05:00
Randy Heit
0fb9f98a96 Add void and error types; rejigger pointer types
- Added TypeVoid for statements, which produce no type.
- Added TypeError for expressions whose arguments are incompatible.
- Pointers now derive from PBasicType instead of PInt. Since they have their own register sets in the VM, this seems to make more sense than treating them as integers.
2013-09-20 21:10:20 -05:00
Randy Heit
2ab3974752 Add a PSymbolConstString class
- Constants can be strings, but the existing PSymbolConst couldn't handle
  them. The old PSymbolConst is now PSymbolConstNumeric, and the new
  PSymbolConst is a now a baseclass for it and PSymbolConstString.
2013-09-10 22:01:00 -05:00
Randy Heit
2f7183b937 Use PField instead of PSymbolVariable for DECORATE expressions
- The type systems used by PField and FxExpression are completely
  incompatible, but I think I got the differences taken care of as far
  as ParseNativeVariable(), ParseUserVariable(), and FxClassMember are
  concerned.
- Support for declaring native bool variables has been removed for the time
  being. It wasn't used anyway.
- Removed PSymbolVariable.
2013-08-23 22:02:51 -05:00
Randy Heit
0d1973a659 Make PStruct::AddField() check for duplicates
- PStruct::AddField() now checks the symbol table for a symbol of the same
  name before adding a new field. If the name is in use, it returns NULL.
2013-08-23 21:56:18 -05:00
Randy Heit
27ddaad7ca Set PStatePointer's TypeTableType in PType::StaticInit()
- It was forgotten about earlier.
2013-08-23 21:54:35 -05:00
Randy Heit
263b160905 Add PFixed and PArray types
- These are types that are stored as integers but otherwise handled as floating point values.
2013-08-23 21:53:54 -05:00
Randy Heit
b5d37348f6 Add code generation simplification methods to PType
- To assist with using PType with DECORATE expression code generation,
  added GetStoreOp(), GetLoadOp(), and GetRegType() to PType.
2013-08-23 21:52:04 -05:00
Randy Heit
2ec3cbddb9 Mark PType's GetValueInt method as const 2013-08-23 21:50:33 -05:00
Randy Heit
4cf0ef7e3f Minor PField changes.
- Rename FieldOffset and FieldType so they no longer have the "Field" prefix
- Add a Flags field.
2013-08-21 22:38:05 -05:00
Randy Heit
e50c00c856 Add generic integer setters and getters for PInt and PFloat types 2013-08-21 22:36:46 -05:00
Randy Heit
cf87d0f1e9 Use PFunction instead of PSymbolActionFunction in DECORATE parser 2013-08-14 22:00:16 -05:00
Randy Heit
aba691ad72 Implement NewClassPointer() 2013-08-14 21:59:10 -05:00
Randy Heit
ed1c22186f Add PStatePointer type 2013-08-14 21:53:03 -05:00
Randy Heit
973b0f5c56 Change PFunction's superclass from PNamedType to PSymbol 2013-08-10 20:17:55 -05:00
Randy Heit
6575499f37 Added basic implementation for PField.
- I don't know why this didn't give me trouble before, but I needed to add IMPLEMENT_CLASS for PField.
2013-08-10 20:17:29 -05:00
Randy Heit
3e46e6376c Added NewPrototype() function 2013-08-10 20:06:54 -05:00
Randy Heit
f18c7b8959 Make FType::Hash work for PPrototype
- For Prototypes, Hash is passed the address of two TArrays. If we blindly
  hash those without checking their contents, then we can forget about
  ever finding any matching prototypes in the type table. (Not that I
  remember why I wanted them to be unique, but I'm sure I must have had my
  reasons.)
2013-08-10 20:05:42 -05:00
Randy Heit
93cbdd37a5 PArray's size should take alignment into account. 2013-08-08 22:27:40 -05:00
Randy Heit
6c1f3a1396 Added PStruct::AddField() 2013-08-08 22:27:40 -05:00
Randy Heit
7e24f6b00c - Added NewStruct() function. 2013-08-08 22:27:39 -05:00
Randy Heit
0ec33191aa - Added NewEnum() function. 2013-08-08 22:27:39 -05:00
Randy Heit
12a312b6b4 - Fixed: NewArray returned the element type, not the array type. 2013-08-08 22:27:38 -05:00
Randy Heit
dbaf72772b Move the symbol table from PClass to PStruct. 2013-08-08 22:27:38 -05:00
Randy Heit
7171281507 - Compatibility fix: Classes redefined in DECORATE should cause the newer one to replace the
older one in the type table.

SVN r3913 (scripting)
2012-10-27 02:04:35 +00:00
Randy Heit
38d7b7d203 - Fixed errors and warnings when compiling with GCC. (Unfortunately, the VC++ debug builds
become ungodly slow when using mods with complex DECORATE. The GCC debug builds run just
  fine, however. Hopefully this is something that can be fixed later with an assembly-optimized
  version of the main VM loop, because I don't relish the thought of being stuck with GDB
  for debugging.)
- Fixed: The ACS_Named* action specials were erroneously defined as taking strings instead of
  names.
- Fixed: Copy-paste error caused FxMultiNameState::Emit to generate code that called
  DecoNameToClass instead of DecoFindMultiNameState.
- Updated FxActionSpecialCall::Emit for named script specials.
- Fixed inverted asserts for FxMinusSign::Emit and FxUnaryNotBitwise::Emit.


SVN r3893 (scripting)
2012-10-18 03:19:27 +00:00
Randy Heit
c043627cc1 - Some abstract syntax tree creation stuff. (Plus some tentative type creation stuff that made
me realize I would be better off creating a type-agnostic AST for the entire input instead
  of trying to tentatively create types before they're seen.)

SVN r2354 (scripting)
2010-06-06 04:15:28 +00:00
Randy Heit
50d126e78b - Clear the TypeTable on shutdown so that the objects in it can be collected.
SVN r2301 (scripting)
2010-04-24 03:10:58 +00:00
Randy Heit
dde5e1928f - Make TypeTable a GC root.
- Instantiate some basic types.

SVN r2298 (scripting)
2010-04-22 04:12:42 +00:00
Randy Heit
ee55e0319f - Standardized use of PClassActor::AllActorClasses for iterating over all classes of actors
instead of PClass::m_Types (now PClass::AllClasses).
- Removed ClassIndex from PClass. It was only needed by FArchive, and maps take care of the
  problem just as well.
- Moved PClass into a larger type system (which is likely to change some/lots once I try and actually use it and have a better feel for what I need from it).

SVN r2281 (scripting)
2010-04-16 02:57:51 +00:00
Randy Heit
ef3c020c8c - Actually, I think this is proper now.
SVN r2260 (scripting)
2010-03-31 02:44:22 +00:00
Randy Heit
cc2ed53c49 - Fix wrong size calculation for PSymbolTable::MarkSymbols().
SVN r2259 (scripting)
2010-03-31 02:43:55 +00:00
Randy Heit
d87d2c731f - Use a map for symbol tables instead of an array.
SVN r2258 (scripting)
2010-03-30 04:11:16 +00:00
Randy Heit
604b5ef673 - Removed the old meta data system. All meta data is now stored in subclasses of PClass. This
should simplify scripting, since it means that meta fields can be treated (mostly) the same as
  normal fields.

SVN r2242 (scripting)
2010-03-25 20:38:00 +00:00
Randy Heit
f88f601230 - Removed the third parameter from dumpclasses when it was restricted it to Actors, because
I have no idea what that was all about.
- Got rid of FActorInfo and merged it into a new PClassActor.

SVN r2240 (scripting)
2010-03-24 02:49:37 +00:00
Randy Heit
913555aa4e - Synced the scripting branch with trunk.
SVN r2166 (scripting)
2010-02-17 04:46:11 +00:00
Christoph Oelckers
6ec30761c6 - Added Boom's stairbuilding fix when one step couldn't be built due to an active thinker in the sector.
This is compatibility optioned with COMPAT_STAIRINDEX. Also added a compatibility setting for 
  Eternal Doom MAP25 which relies on Doom's original broken behavior.
- added a few sanity checks for duplicate actor names in DECORATE. ZDoom will now print more warnings
  and all crash cases should be properly handled but since this is still an error this will not work
  properly in all circumstances. For example, if you have a duplicate name all classes that inherit
  from the original definition will not survive a savegame if they reference a state belonging to that
  class at the point of saving.
- Print 'tried to register class more than once' in red to highlight it.
- fixed: actors may not replace themselves.

SVN r2158 (trunk)
2010-02-13 08:56:08 +00:00
Randy Heit
739e684549 - Converted all action functions be directly callable by the VM (though they are not yet
usable).

SVN r2154 (scripting)
2010-02-12 06:04:57 +00:00
Randy Heit
19b23f2cf3 - Removed the Actor uservar array and replaced it with user-defined variables.
A_SetUserVar/SetUserVariable/GetUserVariable now take a variable name
  instead of an array index. A_SetUserArray/SetUserArray/GetUserArray
  have been added to access elements in user-defined arrays.


SVN r1933 (trunk)
2009-10-25 02:19:51 +00:00
Randy Heit
1a442742f7 - Sync with trunk.
SVN r1872 (scripting)
2009-09-23 00:24:47 +00:00
Randy Heit
1eb7912bd8 - Make the autosegs read-only.
- Derive PClass from dobject.cpp. This has one major ramification: Since the PClass
  is not allocated until runtime, you cannot initialize any static/global data
  structures with pointers to PClasses using RUNTIME_CLASS. Attempting to do so
  will just initialize with a NULL pointer. Instead, you can initialize using
  the address of the pointer returned by RUNTIME_CLASS and dereference that. By
  the time you have an opportunity to dereference it, it will no longer be NULL.
- Sync CmakeLists.txt.
- Random fixes for problems GCC spotted.

SVN r1852 (scripting)
2009-09-17 01:36:14 +00:00
Randy Heit
fefc306a54 - Make PClass derive from DObject so that it can participate in garbage collection.
- Import VM.

SVN r1841 (scripting)
2009-09-16 01:39:44 +00:00