Commit graph

3971 commits

Author SHA1 Message Date
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
4bd5bf310b Do not use GT, GTEQ, or NEQ operators in the AST.
- Since the VM doesn't directly support the GT, GTEQ, and NEQ comparisons,
  don't use them in the trees either. Instead, wrap them as LTEQ, LT, and
  EQEQ inside a BoolNot operator.
2013-10-02 23:28:06 -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
1948642758 Add Printf extension %H
- This conversion has behavior similar to %g: It automatically behaves like
  %f or %e based on the number of output characters. However, unlike %g,
  this decision is also based on what will produce the smallest string
  without truncating the output. The precision field (the * in %.*f) is
  ignored. Converting a double to text with %H and then back to a double
  should be lossless.
2013-09-25 20:46:45 -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
743b05189e Give the parser knowledge of constants for unary - and +
- Since the tokenizer never gives the parser negative numbers but always a
  unary minus followed by a positive number, it seems reasonable to make
  the parser smart enough to turn these into negative constants without
  generating extra tree nodes.
- And since we're doing it for unary -, we might as well do it for unary +
  as well and avoid extra nodes when we know we don't need them.
2013-09-12 22:22:43 -05:00
Randy Heit
2a1414ad66 Use labels in autogenerated enum value expressions
- For an enum like this:
    enum { value1 = SOME_NUM*2, value2 };
  Generate an increment expression for value2 of the form
    (add (id value1) 1)
  and not
    (add (* SOME_NUM 2) 1)
2013-09-12 22:06:57 -05:00
Randy Heit
af8e0f2ba6 Represent enumerations as constant definitions
- Instead of representating enumeration values with a special node type,
  use the same ZCC_ConstantDef nodes that const_def produces. These are
  created at the same scope as the ZCC_Enum, rather than being contained
  entirely within it. To mark the end of enums for a single instance of
  ZCC_Enum, a ZCC_EnumTerminator node is now appended to the chain of
  ZCC_ConstantDefs.
2013-09-12 22:00:49 -05:00
Randy Heit
d5fa550118 Make ZCC_TreeNode::AppendSibling() work with lists
- Previously, you could only append lone nodes to ZCC_TreeNode lists.
  Now you can append one list to another.
2013-09-12 22:00:49 -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
33e835b58d Accept name constants in the grammar 2013-09-10 21:56:13 -05:00
Randy Heit
b6e525d935 Add missing closing " for string constants in AST dumps 2013-09-10 21:50:27 -05:00
Randy Heit
52d5e74e7e Mark unsigned constants in AST dumps.
- Add the u suffix to unsigned integer constants printed in AST dumps.
2013-09-10 21:48:15 -05:00
Randy Heit
1b4851224e Let the grammar accept unsigned integer constants 2013-09-10 21:44:32 -05:00
Randy Heit
33344201fa Let the scanner returned unsigned integers
- The scanner already recognized the u suffix for unsigned integers, but
  otherwise ignored it. Return it as a proper token.
2013-09-10 21:40:05 -05:00
Randy Heit
aec6aff7a8 Don't accept l as a suffix for floating point numbers in the scanner
- We're never going to support long doubles, so don't pretend.
2013-09-10 21:30:33 -05:00
Randy Heit
6545c48e07 Accept constant definitions at global scope 2013-09-10 21:25:50 -05:00
Randy Heit
3044fdd0a9 Use %f instead of %g in AST dumps
- To ensure that floating point constants are identifiable as floating
  point, FLispString::AddFloat() now prints them with %f.
2013-09-10 21:24:32 -05:00
Randy Heit
61666e1515 Consolidate constant expression nodes into a single type
- Instead of having ZCC_ExprString, ZCC_ExprInt, and ZCC_ExprFloat,
  just use a single ZCC_ExprConstant. It should simplify type
  promotion and constant folding in the future.
2013-09-10 21:10:48 -05:00
Randy Heit
f9f8d1e79b Add a type field for ZCC expressions.
- Constants can fill out the type field right away. Other expressions will need
  to wait until a later pass, after names have been resolved, so they get
  initialized to NULL.
2013-09-10 20:50:21 -05:00
Randy Heit
6584819d01 Use PType for typing things in PSymbolConst. 2013-09-07 20:35:46 -05:00
Christoph Oelckers
251cdacf26 Merge branch 'master' into scripting
Conflicts:
	src/g_shared/a_randomspawner.cpp
	src/g_strife/a_strifeweapons.cpp
	src/thingdef/thingdef_parse.cpp
	wadsrc/static/actors/constants.txt
2013-09-03 09:01:28 +02:00
Christoph Oelckers
18386e4b23 Merge branch 'maint' 2013-09-03 08:44:52 +02:00
Christoph Oelckers
11c026ee84 - fixed: displaying sprites on the automap ignored both the actor's scale and translation. 2013-09-03 08:34:55 +02:00
Christoph Oelckers
75dd5503cf - fixed: Cost strings for dialogues must not be added in the dialogue parser but while displaying the message to properly handle stringtable entries. 2013-09-03 08:24:47 +02:00
Christoph Oelckers
4ed27c22fd Merge branch 'master' of https://github.com/MazterQyou/zdoom 2013-09-03 07:59:37 +02:00
Alex Qyoun-ae
b6baeecd9a Fixed compilation with LLVM compilers 2013-09-03 03:49:39 +04:00
Christoph Oelckers
ba2a07fb26 - removed all uses of single precision floats from FraggleScript code. 2013-09-02 09:08:47 +02:00
Randy Heit
267030c759 Merge branch 'maint' 2013-08-30 23:13:32 -05:00
Randy Heit
260ce62175 Don't abort for TEXTUREx lumps that define textures with no patches
- A texture defined in TEXTUREx without any patches isn't necessarily an
  error, so accept. This also means they shouldn't be used for determining
  if a TEXTURE directory belongs to Strife instead of Doom.
2013-08-30 23:10:20 -05:00
Randy Heit
b0371e1804 Don't abort when merely checking if a non-map is a map
- When P_OpenMapData() is called by P_CheckMapData(), we don't actually
  care if any required lumps are missing. This just means it isn't a valid
  map, so don't abort with I_Error().
2013-08-30 22:38:57 -05:00
Randy Heit
33ee8f9fef Merge branch 'maint' 2013-08-29 22:27:49 -05:00
Randy Heit
a4fcbf5e06 Merge branch 'master' of github.com:rheit/zdoom 2013-08-29 22:27:27 -05:00
Randy Heit
0f0d9da839 Reset FirstFreeEntry in ACSStringPool::ReadStrings()
- Fixed: When an ACS string pool was read from a savegame, FirstFreeEntry
  would not be updatedt, except by the Clear() function. This left FirstFreeEntry
  at 0, which meant the next string added to the pool would always go in
  slot 0, whether it was free or not.
2013-08-29 22:22:30 -05:00
Randy Heit
7143ae49e1 Fixed: CheckPlayerCamera not sync safe
-  If a player is spying through another player, CheckPlayerCamera will
   return the TID of the player you are "spying", but as coopspy isn't a
   net command, this wont be reflected by all nodes. So to fix this,
   CheckPlayerCamera now returns -1 if a player's camera is that of any
   player at all. (thanks edward850)
2013-08-29 21:45:37 -05:00
Randy Heit
aac0de3e48 Fixed: Make A_SetTics work with weapons.
- When A_SetTics is called from a weapon, we need to set the tics for the
  psprite instead of the actor itself.
2013-08-29 21:40:01 -05:00
Randy Heit
28e5cc536a Add some awareness of short file names
- Added I_GetLongPathName(). It wraps the Win32 API's GetLongPathName().
  DArgs::CollectFiles() now calls this for every argument it processes, so
  any arguments passed using short file names will be converted to long
  file names. This is mainly of interest so that savegames will never
  record the short file name, which can change based on what else is in
  the directory.
2013-08-29 21:24:05 -05:00
Randy Heit
2823ea5de3 Annote AST nodes with source information 2013-08-28 22:59:03 -05:00
Randy Heit
5e0e74a47d Fix incorrect comment 2013-08-28 22:35:29 -05:00
Christoph Oelckers
9c2454eacc Merge branch 'maint' 2013-08-28 11:20:53 +02:00
Christoph Oelckers
26c381224c - removed unused constants in p_map.cpp. 2013-08-28 11:16:30 +02:00
Christoph Oelckers
f8899f98fc - fixed: The secret counter was not incremented for items that had the UDMF COUNTSECRET flag set. 2013-08-28 11:14:48 +02:00
Braden Obrzut
0a16e9a256 - Fixed uninitialized variable in A_AlertMonsters. 2013-08-27 20:42:35 -04:00
Braden Obrzut
0fb37ca5f1 Merge branch 'maint' 2013-08-27 20:41:10 -04:00
Braden Obrzut
5079d6c505 - Fixed: clang 32-bit compile (I hear it still doesn't run though).
- Applied edward's patch to remove boolean increment.
2013-08-27 20:28:38 -04:00
Randy Heit
6e018d0c07 Merge branch 'maint' 2013-08-25 17:34:20 -05:00
Edoardo Prezioso
7b5084df44 Shut up warnings from the customized DUMB code. 2013-08-25 17:33:48 -05:00
Edoardo Prezioso
ded1715625 - Merge DUMB commit d31fb2084659b64d07eb0644d9bacfd67059d066 to zdoom.
Fixed C++11 compilation error on Mac OS X
2013-08-25 17:33:36 -05:00
Randy Heit
064710422b Accept empty struct and enum definitions (useless as they may be) 2013-08-24 20:32:59 -05:00
Randy Heit
80daf736ec Accept enums and structs defined at global scope 2013-08-24 20:28:26 -05:00