diff --git a/.gitignore b/.gitignore index e198328787..44373e05fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,52 @@ +# makepanda directories /built*/ /thirdparty/ /targetroot/ /dstroot/ + +# Core dumps core core.* vgcore.* + +# Editor files/directories *.save *.save.1 +*.sublime-workspace +.vscode/ + +# Temporary build files +/_vfsimporter.* +*.pdb +*.obj +*.o +*.gch +*.pch + +# Produced installer/executables +/*.exe +/*.deb +/*.rpm +/*.app +/*.pkg +/*.dmg +/*.whl + +# CMake +/build/ +CMakeCache.txt +CMakeFiles/ +CMakeScripts/ +Makefile +cmake_install.cmake +install_manifest.txt +CTestTestfile.cmake + +# Windows +Thumbs.db +ehthumbs.db + +# Python +__pycache__ +*.pyc +*.pyo diff --git a/.travis.yml b/.travis.yml index 6c6a399e23..c8176d293b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false matrix: include: - compiler: gcc - env: PYTHONV=python2.7 FLAGS= + env: PYTHONV=python2.7 FLAGS=--optimize=4 - compiler: clang env: PYTHONV=python3 FLAGS=--installer - compiler: clang diff --git a/contrib/.gitignore b/contrib/.gitignore deleted file mode 100644 index aa93cd250a..0000000000 --- a/contrib/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.pyc -*.pyo -/__init__.py -# These are files that are generated within the source tree by the -# ppremake system. -Makefile -pp.dep -/built/ -Opt?-* diff --git a/contrib/src/ai/aiBehaviors.h b/contrib/src/ai/aiBehaviors.h index 3c11b5e7a8..6a20876db8 100644 --- a/contrib/src/ai/aiBehaviors.h +++ b/contrib/src/ai/aiBehaviors.h @@ -11,10 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - #ifndef _AIBEHAVIORS_H #define _AIBEHAVIORS_H diff --git a/contrib/src/ai/aiCharacter.h b/contrib/src/ai/aiCharacter.h index 5d2b2c1d51..9fd0833a99 100644 --- a/contrib/src/ai/aiCharacter.h +++ b/contrib/src/ai/aiCharacter.h @@ -11,11 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - - #ifndef _AICHARACTER_H #define _AICHARACTER_H diff --git a/contrib/src/ai/aiGlobals.h b/contrib/src/ai/aiGlobals.h index 749cb9ec21..1d8e8a9c41 100644 --- a/contrib/src/ai/aiGlobals.h +++ b/contrib/src/ai/aiGlobals.h @@ -11,10 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - #ifndef _AI_GLOBALS_H #define _AI_GLOBALS_H diff --git a/contrib/src/ai/aiWorld.h b/contrib/src/ai/aiWorld.h index 95115355ba..f85e1dc584 100644 --- a/contrib/src/ai/aiWorld.h +++ b/contrib/src/ai/aiWorld.h @@ -11,11 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - - #ifndef _AIWORLD_H #define _AIWORLD_H diff --git a/contrib/src/ai/obstacleAvoidance.cxx b/contrib/src/ai/obstacleAvoidance.cxx index 7160baa096..faf8a1ff05 100644 --- a/contrib/src/ai/obstacleAvoidance.cxx +++ b/contrib/src/ai/obstacleAvoidance.cxx @@ -34,7 +34,7 @@ obstacle_detection() { CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere(); LVecBase3 avoidance(0.0, 0.0, 0.0); double distance = 0x7fff ; - double expanded_radius; + double expanded_radius = 0; LVecBase3 to_obstacle; LVecBase3 prev_avoidance; for(unsigned int i = 0; i < _ai_char->_world->_obstacles.size(); ++i) { @@ -89,8 +89,8 @@ do_obstacle_avoidance() { CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere(); PT(BoundingVolume) np_bounds = _ai_char->get_node_path().get_bounds(); CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere(); - double distance_needed = offset.length() - bsphere->get_radius() - np_sphere->get_radius(); - if((obstacle_detection())) { + + if (obstacle_detection()) { LVecBase3 direction = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); direction.normalize(); float forward_component = offset.dot(direction); diff --git a/contrib/src/panda3dtoolsgui/.gitignore b/contrib/src/panda3dtoolsgui/.gitignore deleted file mode 100644 index 2247d5f95a..0000000000 --- a/contrib/src/panda3dtoolsgui/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/dist diff --git a/direct/.gitignore b/direct/.gitignore deleted file mode 100644 index aa93cd250a..0000000000 --- a/direct/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.pyc -*.pyo -/__init__.py -# These are files that are generated within the source tree by the -# ppremake system. -Makefile -pp.dep -/built/ -Opt?-* diff --git a/direct/src/configfiles/.gitignore b/direct/src/configfiles/.gitignore deleted file mode 100644 index 4c7cd7cd38..0000000000 --- a/direct/src/configfiles/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/40_direct.prc diff --git a/direct/src/dcparser/.gitignore b/direct/src/dcparser/.gitignore deleted file mode 100644 index b33ad73fcd..0000000000 --- a/direct/src/dcparser/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/dcLexer.cxx -/dcParser.cxx -/dcParser.h diff --git a/direct/src/dcparser/dcArrayParameter.h b/direct/src/dcparser/dcArrayParameter.h index fa9e6e925a..10a8f022c2 100644 --- a/direct/src/dcparser/dcArrayParameter.h +++ b/direct/src/dcparser/dcArrayParameter.h @@ -23,7 +23,7 @@ * parameter type accepts an arbitrary (or possibly fixed) number of nested * fields, all of which are of the same type. */ -class EXPCL_DIRECT DCArrayParameter : public DCParameter { +class DCArrayParameter : public DCParameter { public: DCArrayParameter(DCParameter *element_type, const DCUnsignedIntRange &size = DCUnsignedIntRange()); diff --git a/direct/src/dcparser/dcAtomicField.h b/direct/src/dcparser/dcAtomicField.h index b03d8ed290..c002ecf15a 100644 --- a/direct/src/dcparser/dcAtomicField.h +++ b/direct/src/dcparser/dcAtomicField.h @@ -27,7 +27,7 @@ * This defines an interface to the Distributed Class, and is always * implemented as a remote procedure method. */ -class EXPCL_DIRECT DCAtomicField : public DCField { +class DCAtomicField : public DCField { public: DCAtomicField(const string &name, DCClass *dclass, bool bogus_field); virtual ~DCAtomicField(); diff --git a/direct/src/dcparser/dcClass.h b/direct/src/dcparser/dcClass.h index dac46a3dff..699d953498 100644 --- a/direct/src/dcparser/dcClass.h +++ b/direct/src/dcparser/dcClass.h @@ -41,7 +41,7 @@ class DCParameter; /** * Defines a particular DistributedClass as read from an input .dc file. */ -class EXPCL_DIRECT DCClass : public DCDeclaration { +class DCClass : public DCDeclaration { public: DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class); diff --git a/direct/src/dcparser/dcClassParameter.h b/direct/src/dcparser/dcClassParameter.h index 913ed20a6e..e846d48f88 100644 --- a/direct/src/dcparser/dcClassParameter.h +++ b/direct/src/dcparser/dcClassParameter.h @@ -23,7 +23,7 @@ class DCClass; * This represents a class (or struct) object used as a parameter itself. * This means that all the fields of the class get packed into the message. */ -class EXPCL_DIRECT DCClassParameter : public DCParameter { +class DCClassParameter : public DCParameter { public: DCClassParameter(const DCClass *dclass); DCClassParameter(const DCClassParameter ©); diff --git a/direct/src/dcparser/dcDeclaration.h b/direct/src/dcparser/dcDeclaration.h index ced47b3737..218473aef4 100644 --- a/direct/src/dcparser/dcDeclaration.h +++ b/direct/src/dcparser/dcDeclaration.h @@ -26,7 +26,7 @@ class DCSwitch; * only purpose is so that classes and typedefs can be stored in one list * together so they can be ordered correctly on output. */ -class EXPCL_DIRECT DCDeclaration { +class DCDeclaration { public: virtual ~DCDeclaration(); diff --git a/direct/src/dcparser/dcField.h b/direct/src/dcparser/dcField.h index 2bf2b5e840..e7f2dbcd3c 100644 --- a/direct/src/dcparser/dcField.h +++ b/direct/src/dcparser/dcField.h @@ -34,7 +34,7 @@ class HashGenerator; /** * A single field of a Distributed Class, either atomic or molecular. */ -class EXPCL_DIRECT DCField : public DCPackerInterface, public DCKeywordList { +class DCField : public DCPackerInterface, public DCKeywordList { public: DCField(); DCField(const string &name, DCClass *dclass); diff --git a/direct/src/dcparser/dcFile.h b/direct/src/dcparser/dcFile.h index ec3f431aa7..8ad67e1ace 100644 --- a/direct/src/dcparser/dcFile.h +++ b/direct/src/dcparser/dcFile.h @@ -29,7 +29,7 @@ class DCDeclaration; * Represents the complete list of Distributed Class descriptions as read from * a .dc file. */ -class EXPCL_DIRECT DCFile { +class DCFile { PUBLISHED: DCFile(); ~DCFile(); diff --git a/direct/src/dcparser/dcKeyword.h b/direct/src/dcparser/dcKeyword.h index aa074c6f37..76c212c093 100644 --- a/direct/src/dcparser/dcKeyword.h +++ b/direct/src/dcparser/dcKeyword.h @@ -25,7 +25,7 @@ class HashGenerator; * define a communication property associated with a field, for instance * "broadcast" or "airecv". */ -class EXPCL_DIRECT DCKeyword : public DCDeclaration { +class DCKeyword : public DCDeclaration { public: DCKeyword(const string &name, int historical_flag = ~0); virtual ~DCKeyword(); diff --git a/direct/src/dcparser/dcKeywordList.h b/direct/src/dcparser/dcKeywordList.h index b5e35b3247..ada61ffaa0 100644 --- a/direct/src/dcparser/dcKeywordList.h +++ b/direct/src/dcparser/dcKeywordList.h @@ -23,7 +23,7 @@ class HashGenerator; * This is a list of keywords (see DCKeyword) that may be set on a particular * field. */ -class EXPCL_DIRECT DCKeywordList { +class DCKeywordList { public: DCKeywordList(); DCKeywordList(const DCKeywordList ©); diff --git a/direct/src/dcparser/dcMolecularField.h b/direct/src/dcparser/dcMolecularField.h index 8b2d056bdd..6d532a1b23 100644 --- a/direct/src/dcparser/dcMolecularField.h +++ b/direct/src/dcparser/dcMolecularField.h @@ -25,7 +25,7 @@ class DCParameter; * This represents a combination of two or more related atomic fields, that * will often be treated as a unit. */ -class EXPCL_DIRECT DCMolecularField : public DCField { +class DCMolecularField : public DCField { public: DCMolecularField(const string &name, DCClass *dclass); diff --git a/direct/src/dcparser/dcPackData.h b/direct/src/dcparser/dcPackData.h index 9d19548591..99cd0abbd5 100644 --- a/direct/src/dcparser/dcPackData.h +++ b/direct/src/dcparser/dcPackData.h @@ -19,7 +19,7 @@ /** * This is a block of data that receives the results of DCPacker. */ -class EXPCL_DIRECT DCPackData { +class DCPackData { PUBLISHED: INLINE DCPackData(); INLINE ~DCPackData(); diff --git a/direct/src/dcparser/dcPacker.h b/direct/src/dcparser/dcPacker.h index 049429e0ec..380d40600c 100644 --- a/direct/src/dcparser/dcPacker.h +++ b/direct/src/dcparser/dcPacker.h @@ -31,7 +31,7 @@ class DCSwitchParameter; * See also direct/src/doc/dcPacker.txt for a more complete description and * examples of using this class. */ -class EXPCL_DIRECT DCPacker { +class DCPacker { PUBLISHED: DCPacker(); ~DCPacker(); @@ -216,7 +216,7 @@ private: const DCPackerCatalog *_catalog; const DCPackerCatalog::LiveCatalog *_live_catalog; - class EXPCL_DIRECT StackElement { + class StackElement { public: // As an optimization, we implement operator new and delete here to // minimize allocation overhead during push() and pop(). diff --git a/direct/src/dcparser/dcPackerCatalog.h b/direct/src/dcparser/dcPackerCatalog.h index 70c75e2d1a..71469d6744 100644 --- a/direct/src/dcparser/dcPackerCatalog.h +++ b/direct/src/dcparser/dcPackerCatalog.h @@ -26,7 +26,7 @@ class DCSwitchParameter; * requested from a particular field; its ownership is retained by the field * so it must not be deleted. */ -class EXPCL_DIRECT DCPackerCatalog { +class DCPackerCatalog { private: DCPackerCatalog(const DCPackerInterface *root); DCPackerCatalog(const DCPackerCatalog ©); diff --git a/direct/src/dcparser/dcPackerInterface.h b/direct/src/dcparser/dcPackerInterface.h index eca03d3257..42284ac54f 100644 --- a/direct/src/dcparser/dcPackerInterface.h +++ b/direct/src/dcparser/dcPackerInterface.h @@ -64,7 +64,7 @@ END_PUBLISH * Normally these methods are called only by the DCPacker object; the user * wouldn't normally call these directly. */ -class EXPCL_DIRECT DCPackerInterface { +class DCPackerInterface { public: DCPackerInterface(const string &name = string()); DCPackerInterface(const DCPackerInterface ©); diff --git a/direct/src/dcparser/dcParameter.h b/direct/src/dcparser/dcParameter.h index d8765f4d54..6c8ae910a6 100644 --- a/direct/src/dcparser/dcParameter.h +++ b/direct/src/dcparser/dcParameter.h @@ -32,7 +32,7 @@ class HashGenerator; * This may also be a typedef reference to another type, which has the same * properties as the referenced type, but a different name. */ -class EXPCL_DIRECT DCParameter : public DCField { +class DCParameter : public DCField { protected: DCParameter(); DCParameter(const DCParameter ©); diff --git a/direct/src/dcparser/dcSimpleParameter.h b/direct/src/dcparser/dcSimpleParameter.h index 747950939a..5e2e39c498 100644 --- a/direct/src/dcparser/dcSimpleParameter.h +++ b/direct/src/dcparser/dcSimpleParameter.h @@ -25,7 +25,7 @@ * divisor, which is meaningful only for the numeric type elements (and * represents a fixed-point numeric convention). */ -class EXPCL_DIRECT DCSimpleParameter : public DCParameter { +class DCSimpleParameter : public DCParameter { public: DCSimpleParameter(DCSubatomicType type, unsigned int divisor = 1); DCSimpleParameter(const DCSimpleParameter ©); diff --git a/direct/src/dcparser/dcSwitch.h b/direct/src/dcparser/dcSwitch.h index 355edd2403..77eefdbb6f 100644 --- a/direct/src/dcparser/dcSwitch.h +++ b/direct/src/dcparser/dcSwitch.h @@ -27,7 +27,7 @@ class DCField; * and represents two or more alternative unpacking schemes based on the first * field read. */ -class EXPCL_DIRECT DCSwitch : public DCDeclaration { +class DCSwitch : public DCDeclaration { public: DCSwitch(const string &name, DCField *key_parameter); virtual ~DCSwitch(); diff --git a/direct/src/dcparser/dcSwitchParameter.h b/direct/src/dcparser/dcSwitchParameter.h index 4456cfd6a5..0303af620f 100644 --- a/direct/src/dcparser/dcSwitchParameter.h +++ b/direct/src/dcparser/dcSwitchParameter.h @@ -23,7 +23,7 @@ class DCSwitch; * This represents a switch object used as a parameter itself, which packs the * appropriate fields of the switch into the message. */ -class EXPCL_DIRECT DCSwitchParameter : public DCParameter { +class DCSwitchParameter : public DCParameter { public: DCSwitchParameter(const DCSwitch *dswitch); DCSwitchParameter(const DCSwitchParameter ©); diff --git a/direct/src/dcparser/dcTypedef.h b/direct/src/dcparser/dcTypedef.h index 515df985af..62797fc8ff 100644 --- a/direct/src/dcparser/dcTypedef.h +++ b/direct/src/dcparser/dcTypedef.h @@ -23,7 +23,7 @@ class DCParameter; * This represents a single typedef declaration in the dc file. It assigns a * particular type to a new name, just like a C typedef. */ -class EXPCL_DIRECT DCTypedef : public DCDeclaration { +class DCTypedef : public DCDeclaration { public: DCTypedef(DCParameter *parameter, bool implicit = false); DCTypedef(const string &name); diff --git a/direct/src/distributed/DistributedObjectGlobalUD.py b/direct/src/distributed/DistributedObjectGlobalUD.py index b8f84b472e..34cfa3a213 100755 --- a/direct/src/distributed/DistributedObjectGlobalUD.py +++ b/direct/src/distributed/DistributedObjectGlobalUD.py @@ -26,11 +26,7 @@ class DistributedObjectGlobalUD(DistributedObjectUD): def execCommand(self, command, mwMgrId, avId, zoneId): text = str(self.__execMessage(command))[:config.GetInt("ai-debug-length",300)] - - dclass = uber.air.dclassesByName.get("PiratesMagicWordManagerAI") - dg = dclass.aiFormatUpdate( - "setMagicWordResponse", mwMgrId, (1<<32)+avId, uber.air.ourChannel, [text]) - uber.air.send(dg) + self.notify.info(text) def __execMessage(self, message): if not self.ExecNamespace: diff --git a/direct/src/distributed/cConnectionRepository.cxx b/direct/src/distributed/cConnectionRepository.cxx index 4f6145c99e..16bff97d9b 100644 --- a/direct/src/distributed/cConnectionRepository.cxx +++ b/direct/src/distributed/cConnectionRepository.cxx @@ -402,8 +402,28 @@ send_datagram(const Datagram &dg) { } #ifdef WANT_NATIVE_NET - if(_native) - return _bdc.SendMessage(dg); + if (_native) { + bool result = _bdc.SendMessage(dg); + if (!result && _bdc.IsConnected()) { +#ifdef HAVE_PYTHON + ostringstream s; + +#if PY_VERSION_HEX >= 0x03030000 + PyObject *exc_type = PyExc_ConnectionError; +#else + PyObject *exc_type = PyExc_OSError; +#endif + + s << endl << "Error sending message: " << endl; + dg.dump_hex(s); + s << "Message data: " << dg.get_data() << endl; + + string message = s.str(); + PyErr_SetString(exc_type, message.c_str()); +#endif + } + return result; + } #endif #ifdef HAVE_NET diff --git a/direct/src/extensions_native/.gitignore b/direct/src/extensions_native/.gitignore deleted file mode 100644 index 7115252bdf..0000000000 --- a/direct/src/extensions_native/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/extensions_darwin.py diff --git a/direct/src/gui/.gitignore b/direct/src/gui/.gitignore deleted file mode 100644 index d894ce83ae..0000000000 --- a/direct/src/gui/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/NL* -/Nested* diff --git a/direct/src/gui/DirectScrolledList.py b/direct/src/gui/DirectScrolledList.py index 58d981950b..d17023d545 100644 --- a/direct/src/gui/DirectScrolledList.py +++ b/direct/src/gui/DirectScrolledList.py @@ -20,7 +20,7 @@ class DirectScrolledListItem(DirectButton): def __init__(self, parent=None, **kw): assert self.notify.debugStateCall(self) - self.parent = parent + self._parent = parent if "command" in kw: self.nextCommand = kw.get("command") del kw["command"] @@ -28,7 +28,7 @@ class DirectScrolledListItem(DirectButton): self.nextCommandExtraArgs = kw.get("extraArgs") del kw["extraArgs"] optiondefs = ( - ('parent', self.parent, None), + ('parent', self._parent, None), ('command', self.select, None), ) # Merge keyword options with default options @@ -39,7 +39,7 @@ class DirectScrolledListItem(DirectButton): def select(self): assert self.notify.debugStateCall(self) self.nextCommand(*self.nextCommandExtraArgs) - self.parent.selectListItem(self) + self._parent.selectListItem(self) class DirectScrolledList(DirectFrame): diff --git a/direct/src/p3d/.gitignore b/direct/src/p3d/.gitignore deleted file mode 100644 index 1beed8d581..0000000000 --- a/direct/src/p3d/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/_vfsimporter.exp -/_vfsimporter.lib -/_vfsimporter.pyd -/_vfsimporter.pyd.manifest -/packp3d -/ppackage -/ppatcher -/vc90.pdb diff --git a/direct/src/p3d/FileSpec.py b/direct/src/p3d/FileSpec.py index f6ca6b93d0..ddd1dafd6e 100644 --- a/direct/src/p3d/FileSpec.py +++ b/direct/src/p3d/FileSpec.py @@ -33,7 +33,7 @@ class FileSpec: if st is None: st = os.stat(pathname.toOsSpecific()) self.size = st.st_size - self.timestamp = st.st_mtime + self.timestamp = int(st.st_mtime) self.readHash(pathname) @@ -124,7 +124,7 @@ class FileSpec: self.__correctHash(packageDir, pathname, st, notify) return False - if st.st_mtime == self.timestamp: + if int(st.st_mtime) == self.timestamp: # If the size is right and the timestamp is right, the # file passes. if notify: @@ -198,7 +198,7 @@ class FileSpec: # The hash is OK. If the timestamp is wrong, change it back # to what we expect it to be, so we can quick-verify it # successfully next time. - if st.st_mtime != self.timestamp: + if int(st.st_mtime) != self.timestamp: self.__updateTimestamp(pathname, st) return True @@ -219,7 +219,7 @@ class FileSpec: if notify: notify.info("Correcting timestamp of %s to %d (%s)" % ( self.filename, st.st_mtime, time.asctime(time.localtime(st.st_mtime)))) - self.timestamp = st.st_mtime + self.timestamp = int(st.st_mtime) def checkHash(self, packageDir, pathname, st): """ Returns true if the file has the expected md5 hash, false diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index ccb8589d8c..784055b771 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -1848,7 +1848,7 @@ class Packager: def addEggFile(self, file): # Precompile egg files to bam's. - np = self.packager.loader.loadModel(file.filename) + np = self.packager.loader.loadModel(file.filename, self.packager.loaderOptions) if not np: raise Exception('Could not read egg file %s' % (file.filename)) @@ -1862,6 +1862,8 @@ class Packager: if not bamFile.openRead(file.filename): raise Exception('Could not read bam file %s' % (file.filename)) + bamFile.getReader().setLoaderOptions(self.packager.loaderOptions) + if not bamFile.resolve(): raise Exception('Could not resolve bam file %s' % (file.filename)) @@ -2492,6 +2494,14 @@ class Packager: self.sfxManagerList = None self.musicManager = None + # These options will be used when loading models and textures. By + # default we don't load textures beyond the header and don't store + # models in the RAM cache in order to conserve on memory usage. + opts = LoaderOptions() + opts.setFlags(opts.getFlags() | LoaderOptions.LFNoRamCache) + opts.setTextureFlags(opts.getTextureFlags() & ~LoaderOptions.TFPreload) + self.loaderOptions = opts + # This is filled in during readPackageDef(). self.packageList = [] diff --git a/direct/src/p3d/panda3d.pdef b/direct/src/p3d/panda3d.pdef index 5a993a1ada..860c0b4671 100644 --- a/direct/src/p3d/panda3d.pdef +++ b/direct/src/p3d/panda3d.pdef @@ -56,6 +56,9 @@ class panda3d(package): 'direct.stdpy.*', 'direct.task.*') + # Keep these modules for backward compatibility. + module('pandac.PandaModules', 'pandac.extension_native_helpers') + module('panda3d.core', 'panda3d.direct', 'panda3d.fx', @@ -462,6 +465,8 @@ class packp3d(p3d): mainModule('direct.p3d.packp3d') + file('packp3d.prc', extract = True, text = "preload-textures false") + class ppackage(p3d): # As above, a packaging utility. This is the fully-general ppackage @@ -475,6 +480,8 @@ class ppackage(p3d): mainModule('direct.p3d.ppackage') + file('ppackage.prc', extract = True, text = "preload-textures false") + class ppatcher(p3d): # A handy utility to go along with ppackage. This builds diff --git a/direct/src/plugin/.gitignore b/direct/src/plugin/.gitignore deleted file mode 100644 index 5378eb8cad..0000000000 --- a/direct/src/plugin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/p3d_plugin_config.h diff --git a/direct/src/plugin/p3dCInstance.h b/direct/src/plugin/p3dCInstance.h index 40708f7d0c..8d0ebc29c2 100644 --- a/direct/src/plugin/p3dCInstance.h +++ b/direct/src/plugin/p3dCInstance.h @@ -21,8 +21,6 @@ #include "get_tinyxml.h" #include "windowHandle.h" -#include - class P3DSession; /** diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index 65ed9104f7..46a194e289 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -1421,6 +1421,17 @@ create_runtime_environment() { } } +#ifndef _WIN32 + // If we're running from the console, make sure that terminating the parent + // process will cause the child process to terminate as well. + if (_console_environment) { + struct sigaction ignore; + memset(&ignore, 0, sizeof(ignore)); + ignore.sa_handler = SIG_IGN; + sigaction(SIGINT, &ignore, NULL); + } +#endif + _created_runtime_environment = true; } diff --git a/direct/src/plugin_activex/.gitignore b/direct/src/plugin_activex/.gitignore deleted file mode 100644 index 3d1f71fddb..0000000000 --- a/direct/src/plugin_activex/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/P3DActiveX.rc diff --git a/direct/src/plugin_npapi/.gitignore b/direct/src/plugin_npapi/.gitignore deleted file mode 100644 index 71d90c1dd6..0000000000 --- a/direct/src/plugin_npapi/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/nppanda3d.rc diff --git a/direct/src/plugin_standalone/.gitignore b/direct/src/plugin_standalone/.gitignore deleted file mode 100644 index 47368b4867..0000000000 --- a/direct/src/plugin_standalone/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/p3d_plugin_config.h -/panda3d.rc diff --git a/direct/src/showbase/BufferViewer.py b/direct/src/showbase/BufferViewer.py index b1a2f39593..c2a7f86049 100644 --- a/direct/src/showbase/BufferViewer.py +++ b/direct/src/showbase/BufferViewer.py @@ -278,6 +278,15 @@ class BufferViewer(DirectObject): self.analyzeTextureSet(self.exclude, exclude) self.analyzeTextureSet(self.include, include) + # Use a custom sampler when applying the textures. This fixes + # wrap issues and prevents depth compare on shadow maps. + sampler = SamplerState() + sampler.setWrapU(SamplerState.WM_clamp) + sampler.setWrapV(SamplerState.WM_clamp) + sampler.setWrapW(SamplerState.WM_clamp) + sampler.setMinfilter(SamplerState.FT_linear) + sampler.setMagfilter(SamplerState.FT_nearest) + # Generate a list of cards and the corresponding windows. cards = [] wins = [] @@ -290,7 +299,7 @@ class BufferViewer(DirectObject): for face in range(6): self.cardmaker.setUvRangeCube(face) card = NodePath(self.cardmaker.generate()) - card.setTexture(tex) + card.setTexture(tex, sampler) cards.append(card) elif (tex.getTextureType() == Texture.TT2dTextureArray): for layer in range(tex.getZSize()): @@ -301,11 +310,11 @@ class BufferViewer(DirectObject): # the fixed-function pipeline, so we need to # enable the shader generator to view them. card.setShaderAuto() - card.setTexture(tex) + card.setTexture(tex, sampler) cards.append(card) else: card = win.getTextureCard() - card.setTexture(tex) + card.setTexture(tex, sampler) cards.append(card) wins.append(win) exclude[tex] = 1 diff --git a/direct/src/showbase/Loader.py b/direct/src/showbase/Loader.py index 5aca6c4042..9edde2a9b7 100644 --- a/direct/src/showbase/Loader.py +++ b/direct/src/showbase/Loader.py @@ -28,7 +28,7 @@ class Loader(DirectObject): self.extraArgs = extraArgs self.numRemaining = numObjects self.cancelled = False - self.requests = {} + self.requests = set() def gotObject(self, index, object): self.objects[index] = object @@ -45,6 +45,8 @@ class Loader(DirectObject): self.base = base self.loader = PandaLoader.getGlobalPtr() + self.__requests = {} + self.hook = "async_loader_%s" % (Loader.loaderIndex) Loader.loaderIndex += 1 self.accept(self.hook, self.__gotAsyncObject) @@ -116,7 +118,7 @@ class Loader(DirectObject): """ assert Loader.notify.debug("Loading model: %s" % (modelPath)) - if loaderOptions == None: + if loaderOptions is None: loaderOptions = LoaderOptions() else: loaderOptions = LoaderOptions(loaderOptions) @@ -156,7 +158,7 @@ class Loader(DirectObject): result = [] for modelPath in modelList: node = self.loader.loadSync(Filename(modelPath), loaderOptions) - if (node != None): + if node is not None: nodePath = NodePath(node) else: nodePath = None @@ -179,16 +181,16 @@ class Loader(DirectObject): # callback (passing it the models on the parameter list). cb = Loader.Callback(len(modelList), gotList, callback, extraArgs) - i=0 + i = 0 for modelPath in modelList: request = self.loader.makeAsyncRequest(Filename(modelPath), loaderOptions) if priority is not None: request.setPriority(priority) request.setDoneEvent(self.hook) - request.setPythonObject((cb, i)) - i+=1 self.loader.loadAsync(request) - cb.requests[request] = True + cb.requests.add(request) + self.__requests[request] = (cb, i) + i += 1 return cb def cancelRequest(self, cb): @@ -200,6 +202,7 @@ class Loader(DirectObject): cb.cancelled = True for request in cb.requests: self.loader.remove(request) + del self.__requests[request] cb.requests = None def isRequestPending(self, cb): @@ -273,7 +276,7 @@ class Loader(DirectObject): # to resolve it for us. options = LoaderOptions(LoaderOptions.LFSearch | LoaderOptions.LFNoDiskCache | LoaderOptions.LFCacheOnly) modelNode = self.loader.loadSync(Filename(model), options) - if modelNode == None: + if modelNode is None: # Model not found. assert Loader.notify.debug("Unloading model not loaded: %s" % (model)) return @@ -293,7 +296,7 @@ class Loader(DirectObject): a callback is used, the model is saved asynchronously, and the true/false status is passed to the callback function. """ - if loaderOptions == None: + if loaderOptions is None: loaderOptions = LoaderOptions() else: loaderOptions = LoaderOptions(loaderOptions) @@ -342,16 +345,16 @@ class Loader(DirectObject): # callback (passing it the models on the parameter list). cb = Loader.Callback(len(modelList), gotList, callback, extraArgs) - i=0 + i = 0 for modelPath, node in modelList: request = self.loader.makeAsyncSaveRequest(Filename(modelPath), loaderOptions, node) if priority is not None: request.setPriority(priority) request.setDoneEvent(self.hook) - request.setPythonObject((cb, i)) - i+=1 self.loader.saveAsync(request) - cb.requests[request] = True + cb.requests.add(request) + self.__requests[request] = (cb, i) + i += 1 return cb @@ -496,7 +499,7 @@ class Loader(DirectObject): phaseChecker(modelPath, loaderOptions) font = FontPool.loadFont(modelPath) - if font == None: + if font is None: if not okMissing: message = 'Could not load font file: %s' % (modelPath) raise IOError(message) @@ -506,21 +509,21 @@ class Loader(DirectObject): # The following properties may only be set for dynamic fonts. if hasattr(font, "setPointSize"): - if pointSize != None: + if pointSize is not None: font.setPointSize(pointSize) - if pixelsPerUnit != None: + if pixelsPerUnit is not None: font.setPixelsPerUnit(pixelsPerUnit) - if scaleFactor != None: + if scaleFactor is not None: font.setScaleFactor(scaleFactor) - if textureMargin != None: + if textureMargin is not None: font.setTextureMargin(textureMargin) - if polyMargin != None: + if polyMargin is not None: font.setPolyMargin(polyMargin) - if minFilter != None: + if minFilter is not None: font.setMinfilter(minFilter) - if magFilter != None: + if magFilter is not None: font.setMagfilter(magFilter) - if anisotropicDegree != None: + if anisotropicDegree is not None: font.setAnisotropicDegree(anisotropicDegree) if color: font.setFg(color) @@ -577,10 +580,10 @@ class Loader(DirectObject): the texture and the number of expected mipmap images. If minfilter or magfilter is not None, they should be a symbol - like Texture.FTLinear or Texture.FTNearest. (minfilter may be - further one of the Mipmap filter type symbols.) These specify - the filter mode that will automatically be applied to the - texture when it is loaded. Note that this setting may + like SamplerState.FTLinear or SamplerState.FTNearest. (minfilter + may be further one of the Mipmap filter type symbols.) These + specify the filter mode that will automatically be applied to + the texture when it is loaded. Note that this setting may override the texture's existing settings, even if it has already been loaded. See egg-texture-cards for a more robust way to apply per-texture filter types and settings. @@ -596,7 +599,7 @@ class Loader(DirectObject): left image and '1' for the right image. Larger numbers are also allowed if you need more than two views. """ - if loaderOptions == None: + if loaderOptions is None: loaderOptions = LoaderOptions() else: loaderOptions = LoaderOptions(loaderOptions) @@ -657,7 +660,7 @@ class Loader(DirectObject): numbered 8 - 15 will be part of the right eye view. """ assert Loader.notify.debug("Loading 3-D texture: %s" % (texturePattern)) - if loaderOptions == None: + if loaderOptions is None: loaderOptions = LoaderOptions() else: loaderOptions = LoaderOptions(loaderOptions) @@ -684,6 +687,63 @@ class Loader(DirectObject): return texture + def load2DTextureArray(self, texturePattern, readMipmaps = False, okMissing = False, + minfilter = None, magfilter = None, anisotropicDegree = None, + loaderOptions = None, multiview = None, numViews = 2): + """ + texturePattern is a string that contains a sequence of one or + more hash characters ('#'), which will be filled in with the + z-height number. Returns a 2-D Texture array object, suitable + for rendering array of textures. + + okMissing should be True to indicate the method should return + None if the texture file is not found. If it is False, the + method will raise an exception if the texture file is not + found or cannot be loaded. + + If readMipmaps is True, then the filename string must contain + two sequences of hash characters; the first group is filled in + with the z-height number, and the second group with the mipmap + index number. + + If multiview is true, it indicates to load a multiview or + stereo texture. In this case, numViews should also be + specified (the default is 2), and the sequence of texture + images will be divided into numViews views. The total + z-height will be (numImages / numViews). For instance, if you + read 16 images with numViews = 2, then you have created a + stereo multiview image, with z = 8. In this example, images + numbered 0 - 7 will be part of the left eye view, and images + numbered 8 - 15 will be part of the right eye view. + """ + assert Loader.notify.debug("Loading 2-D texture array: %s" % (texturePattern)) + if loaderOptions is None: + loaderOptions = LoaderOptions() + else: + loaderOptions = LoaderOptions(loaderOptions) + if multiview is not None: + flags = loaderOptions.getTextureFlags() + if multiview: + flags |= LoaderOptions.TFMultiview + else: + flags &= ~LoaderOptions.TFMultiview + loaderOptions.setTextureFlags(flags) + loaderOptions.setTextureNumViews(numViews) + + texture = TexturePool.load2dTextureArray(texturePattern, readMipmaps, loaderOptions) + if not texture and not okMissing: + message = 'Could not load 2-D texture array: %s' % (texturePattern) + raise IOError(message) + + if minfilter is not None: + texture.setMinfilter(minfilter) + if magfilter is not None: + texture.setMagfilter(magfilter) + if anisotropicDegree is not None: + texture.setAnisotropicDegree(anisotropicDegree) + + return texture + def loadCubeMap(self, texturePattern, readMipmaps = False, okMissing = False, minfilter = None, magfilter = None, anisotropicDegree = None, loaderOptions = None, multiview = None): @@ -711,7 +771,7 @@ class Loader(DirectObject): and each six images will define a new view. """ assert Loader.notify.debug("Loading cube map: %s" % (texturePattern)) - if loaderOptions == None: + if loaderOptions is None: loaderOptions = LoaderOptions() else: loaderOptions = LoaderOptions(loaderOptions) @@ -821,13 +881,12 @@ class Loader(DirectObject): # callback (passing it the sounds on the parameter list). cb = Loader.Callback(len(soundList), gotList, callback, extraArgs) - for i in range(len(soundList)): - soundPath = soundList[i] + for i, soundPath in enumerate(soundList): request = AudioLoadRequest(manager, soundPath, positional) request.setDoneEvent(self.hook) - request.setPythonObject((cb, i)) self.loader.loadAsync(request) - cb.requests[request] = True + cb.requests.add(request) + self.__requests[request] = (cb, i) return cb def unloadSfx(self, sfx): @@ -852,7 +911,7 @@ class Loader(DirectObject): return shader def unloadShader(self, shaderPath): - if (shaderPath != None): + if shaderPath is not None: ShaderPool.releaseShader(shaderPath) def asyncFlattenStrong(self, model, inPlace = True, @@ -886,14 +945,14 @@ class Loader(DirectObject): gotList = True cb = Loader.Callback(len(modelList), gotList, callback, extraArgs) - i=0 + i = 0 for model in modelList: request = ModelFlattenRequest(model.node()) request.setDoneEvent(self.hook) - request.setPythonObject((cb, i)) - i+=1 self.loader.loadAsync(request) - cb.requests[request] = True + cb.requests.add(request) + self.__requests[request] = (cb, i) + i += 1 return cb def __asyncFlattenDone(self, models, @@ -907,7 +966,7 @@ class Loader(DirectObject): orig = origModelList[i].node() flat = models[i].node() orig.copyAllProperties(flat) - orig.replaceNode(flat) + flat.replaceNode(orig) if callback: if gotList: @@ -921,16 +980,23 @@ class Loader(DirectObject): of loaded objects, and call the appropriate callback when it's time.""" - cb, i = request.getPythonObject() - if cb.cancelled: + if request not in self.__requests: return - del cb.requests[request] + cb, i = self.__requests[request] + if cb.cancelled: + # Shouldn't be here. + del self.__requests[request] + return + + cb.requests.discard(request) + if not cb.requests: + del self.__requests[request] object = None if hasattr(request, "getModel"): node = request.getModel() - if (node != None): + if node is not None: object = NodePath(node) elif hasattr(request, "getSound"): diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index afa289f8a8..2d43dba169 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -127,10 +127,6 @@ class ShowBase(DirectObject.DirectObject): ## just before Python is about to shut down. self.finalExitCallbacks = [] - Task.TaskManager.taskTimerVerbose = self.config.GetBool('task-timer-verbose', 0) - Task.TaskManager.extendedExceptions = self.config.GetBool('extended-exceptions', 0) - Task.TaskManager.pStatsTasks = self.config.GetBool('pstats-tasks', 0) - # Set up the TaskManager to reset the PStats clock back # whenever we resume from a pause. This callback function is # a little hacky, but we can't call it directly from within diff --git a/direct/src/showutil/.gitignore b/direct/src/showutil/.gitignore deleted file mode 100644 index 88b7659778..0000000000 --- a/direct/src/showutil/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/runp3d diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index d75a79b56b..c734c56101 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -984,7 +984,10 @@ class Freezer: try: self.__loadModule(mdef) except ImportError as ex: - print("Unknown module: %s (%s)" % (mdef.moduleName, str(ex))) + message = "Unknown module: %s" % (mdef.moduleName) + if str(ex) != "No module named " + str(mdef.moduleName): + message += " (%s)" % (ex) + print(message) # Also attempt to import any implicit modules. If any of # these fail to import, we don't really care. diff --git a/direct/src/stdpy/thread.py b/direct/src/stdpy/thread.py index d10a47fb54..05090e65d8 100644 --- a/direct/src/stdpy/thread.py +++ b/direct/src/stdpy/thread.py @@ -102,7 +102,7 @@ def start_new_thread(function, args, kwargs = {}, name = None): name = 'PythonThread-%s' % (threadId) thread = core.PythonThread(threadFunc, [threadId], name, name) - thread.setPythonData(threadId) + thread.setPythonIndex(threadId) _threads[threadId] = (thread, {}, None) thread.start(core.TPNormal, False) @@ -121,7 +121,7 @@ def _add_thread(thread, wrapper): threadId = _nextThreadId _nextThreadId += 1 - thread.setPythonData(threadId) + thread.setPythonIndex(threadId) _threads[threadId] = (thread, {}, wrapper) return threadId @@ -133,8 +133,8 @@ def _get_thread_wrapper(thread, wrapperClass): is not one, creates an instance of the indicated wrapperClass instead. """ - threadId = thread.getPythonData() - if threadId is None: + threadId = thread.getPythonIndex() + if threadId == -1: # The thread has never been assigned a threadId. Go assign one. global _nextThreadId @@ -143,7 +143,7 @@ def _get_thread_wrapper(thread, wrapperClass): threadId = _nextThreadId _nextThreadId += 1 - thread.setPythonData(threadId) + thread.setPythonIndex(threadId) wrapper = wrapperClass(thread, threadId) _threads[threadId] = (thread, {}, wrapper) return wrapper @@ -169,8 +169,8 @@ def _get_thread_locals(thread, i): """ Returns the locals dictionary for the indicated thread. If there is not one, creates an empty dictionary. """ - threadId = thread.getPythonData() - if threadId is None: + threadId = thread.getPythonIndex() + if threadId == -1: # The thread has never been assigned a threadId. Go assign one. global _nextThreadId @@ -179,7 +179,7 @@ def _get_thread_locals(thread, i): threadId = _nextThreadId _nextThreadId += 1 - thread.setPythonData(threadId) + thread.setPythonIndex(threadId) locals = {} _threads[threadId] = (thread, locals, None) return locals.setdefault(i, {}) @@ -205,9 +205,9 @@ def _remove_thread_id(threadId): _threadsLock.acquire() try: thread, locals, wrapper = _threads[threadId] - assert thread.getPythonData() == threadId + assert thread.getPythonIndex() == threadId del _threads[threadId] - thread.setPythonData(None) + thread.setPythonIndex(-1) finally: _threadsLock.release() diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 300be02f71..215b240d16 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -102,7 +102,10 @@ Task.DtoolClassDict['loop'] = staticmethod(loop) class TaskManager: notify = directNotify.newCategory("TaskManager") - extendedExceptions = False + taskTimerVerbose = ConfigVariableBool('task-timer-verbose', False) + extendedExceptions = ConfigVariableBool('extended-exceptions', False) + pStatsTasks = ConfigVariableBool('pstats-tasks', False) + MaxEpochSpeed = 1.0/30.0 def __init__(self): diff --git a/dmodels/.gitignore b/dmodels/.gitignore deleted file mode 100644 index 33857b21a5..0000000000 --- a/dmodels/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -*.egg -*.pt -/built/ -Makefile -bams/ -optchar/ -pal_egg/ diff --git a/dmodels/src/.gitignore b/dmodels/src/.gitignore deleted file mode 100644 index 0bb7dfac95..0000000000 --- a/dmodels/src/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/*.buildings -/game_options.txt -/prefixstrip -/retarget/ -/textures.boo -/topstrip/ diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 3a02861ab3..b7462a97d6 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -6,6 +6,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix crash using wx/tkinter on Mac as long as want-wx/tk is set * Fix loading models from 'models' package with models/ prefix * Fix random crashes in task system +* Fix various race conditions causing threading issues * Fix memory leaks in BulletTriangleMesh * Fix loading old models with MovingPart * Improve performance of CPU vertex animation somewhat @@ -17,6 +18,36 @@ This issue fixes several bugs that were still found in 1.9.2. * Improve performance of texture load and store operations * Fix crashes with pbuffers on Intel cards on Windows * Support for Autodesk Maya 2016.5 +* Add shadow-depth-bits config var to control shadow map depth +* Fix cull issue when rendering cube map (or any multi-lens setup) +* Fix crash rendering with the same camera to different contexts +* Fix compile error when making static build with DX9 renderer +* Fix assertion when using aux render targets in DX9 +* Work around Cg bug generating invalid ASM for saturated tex loads +* Fix issues with certain Cg shader inputs in DX9 +* Support uint8 index buffers in DX9 +* Fix occasional frame lag when loading a big model asynchronously +* Fix interrogate parsing issue with "const static" +* Add back missing libp3pystub.a to Mac OS X SDK +* Fix RAM caching of 2D texture arrays +* Fix Ctrl+C interrupt propagation to runtime applications +* Support for InvSphere, Box and Tube solids in bam2egg +* Preserve "intangible" and "level" collide flags in bam2egg +* Add normalized() method to vectors +* asyncFlattenStrong with inPlace=True caused node to disappear +* Fix asyncFlattenStrong called on nodes without parent +* Fix is_playing() check when playing an animation backwards +* Windows installer no longer clears %PATH% if longer than 1024 chars +* Fix inoperative -tbn/-tbnall/-tbnauto options in egg-optchar +* Fix tinydisplay texture errors on shutdown +* Fix mipmap filtering issues in tinydisplay renderer +* Fix exception when creating intervals before ShowBase is started +* Fix rare X11 .ico cursor bug; also now supports PNG-compressed icons +* Add keyword argument support to make() methods such as Shader.make() +* Fix compilation errors with Bullet 2.84 +* Fix exception when trying to pickle NodePathCollection objects +* Fix error when trying to raise vectors to a power +* GLSL: fix error when legacy matrix generator inputs are mat3 ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/dtool/.gitignore b/dtool/.gitignore deleted file mode 100644 index d306650d5e..0000000000 --- a/dtool/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/dtool_config.h -# These are files that are generated within the source tree by the -# ppremake system. -Makefile -pp.dep -/built/ -Opt?-* diff --git a/dtool/src/cppparser/.gitignore b/dtool/src/cppparser/.gitignore deleted file mode 100644 index 541962b7c1..0000000000 --- a/dtool/src/cppparser/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/cppBison.cxx -/cppBison.h diff --git a/dtool/src/cppparser/cppArrayType.cxx b/dtool/src/cppparser/cppArrayType.cxx index ac891e259f..ce861c1d69 100644 --- a/dtool/src/cppparser/cppArrayType.cxx +++ b/dtool/src/cppparser/cppArrayType.cxx @@ -13,6 +13,7 @@ #include "cppArrayType.h" #include "cppExpression.h" +#include "cppPointerType.h" /** * @@ -63,6 +64,14 @@ is_tbd() const { return _element_type->is_tbd(); } +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPArrayType:: +is_standard_layout() const { + return _element_type->is_standard_layout(); +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -76,7 +85,7 @@ is_trivial() const { */ bool CPPArrayType:: is_default_constructible() const { - return _element_type->is_default_constructible(); + return _bounds != NULL && _element_type->is_default_constructible(); } /** diff --git a/dtool/src/cppparser/cppArrayType.h b/dtool/src/cppparser/cppArrayType.h index 4633e95aa4..9e2489be72 100644 --- a/dtool/src/cppparser/cppArrayType.h +++ b/dtool/src/cppparser/cppArrayType.h @@ -38,6 +38,7 @@ public: virtual CPPType *resolve_type(CPPScope *current_scope, CPPScope *global_scope); virtual bool is_tbd() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; diff --git a/dtool/src/cppparser/cppBison.cxx.prebuilt b/dtool/src/cppparser/cppBison.cxx.prebuilt index 697bc6c30a..877a9636e1 100644 --- a/dtool/src/cppparser/cppBison.cxx.prebuilt +++ b/dtool/src/cppparser/cppBison.cxx.prebuilt @@ -306,120 +306,138 @@ extern int cppyydebug; CUSTOM_LITERAL = 264, IDENTIFIER = 265, TYPENAME_IDENTIFIER = 266, - SCOPING = 267, - TYPEDEFNAME = 268, - ELLIPSIS = 269, - OROR = 270, - ANDAND = 271, - EQCOMPARE = 272, - NECOMPARE = 273, - LECOMPARE = 274, - GECOMPARE = 275, - LSHIFT = 276, - RSHIFT = 277, - POINTSAT_STAR = 278, - DOT_STAR = 279, - UNARY = 280, - UNARY_NOT = 281, - UNARY_NEGATE = 282, - UNARY_MINUS = 283, - UNARY_PLUS = 284, - UNARY_STAR = 285, - UNARY_REF = 286, - POINTSAT = 287, - SCOPE = 288, - PLUSPLUS = 289, - MINUSMINUS = 290, - TIMESEQUAL = 291, - DIVIDEEQUAL = 292, - MODEQUAL = 293, - PLUSEQUAL = 294, - MINUSEQUAL = 295, - OREQUAL = 296, - ANDEQUAL = 297, - XOREQUAL = 298, - LSHIFTEQUAL = 299, - RSHIFTEQUAL = 300, - KW_ALIGNAS = 301, - KW_ALIGNOF = 302, - KW_AUTO = 303, - KW_BEGIN_PUBLISH = 304, - KW_BLOCKING = 305, - KW_BOOL = 306, - KW_CATCH = 307, - KW_CHAR = 308, - KW_CHAR16_T = 309, - KW_CHAR32_T = 310, - KW_CLASS = 311, - KW_CONST = 312, - KW_CONSTEXPR = 313, - KW_CONST_CAST = 314, - KW_DECLTYPE = 315, - KW_DEFAULT = 316, - KW_DELETE = 317, - KW_DOUBLE = 318, - KW_DYNAMIC_CAST = 319, - KW_ELSE = 320, - KW_END_PUBLISH = 321, - KW_ENUM = 322, - KW_EXTENSION = 323, - KW_EXTERN = 324, - KW_EXPLICIT = 325, - KW_PUBLISHED = 326, - KW_FALSE = 327, - KW_FINAL = 328, - KW_FLOAT = 329, - KW_FRIEND = 330, - KW_FOR = 331, - KW_GOTO = 332, - KW_IF = 333, - KW_INLINE = 334, - KW_INT = 335, - KW_LONG = 336, - KW_MAKE_MAP_PROPERTY = 337, - KW_MAKE_PROPERTY = 338, - KW_MAKE_PROPERTY2 = 339, - KW_MAKE_SEQ = 340, - KW_MAKE_SEQ_PROPERTY = 341, - KW_MUTABLE = 342, - KW_NAMESPACE = 343, - KW_NEW = 344, - KW_NOEXCEPT = 345, - KW_NULLPTR = 346, - KW_OPERATOR = 347, - KW_OVERRIDE = 348, - KW_PRIVATE = 349, - KW_PROTECTED = 350, - KW_PUBLIC = 351, - KW_REGISTER = 352, - KW_REINTERPRET_CAST = 353, - KW_RETURN = 354, - KW_SHORT = 355, - KW_SIGNED = 356, - KW_SIZEOF = 357, - KW_STATIC = 358, - KW_STATIC_ASSERT = 359, - KW_STATIC_CAST = 360, - KW_STRUCT = 361, - KW_TEMPLATE = 362, - KW_THREAD_LOCAL = 363, - KW_THROW = 364, - KW_TRUE = 365, - KW_TRY = 366, - KW_TYPEDEF = 367, - KW_TYPEID = 368, - KW_TYPENAME = 369, - KW_UNION = 370, - KW_UNSIGNED = 371, - KW_USING = 372, - KW_VIRTUAL = 373, - KW_VOID = 374, - KW_VOLATILE = 375, - KW_WCHAR_T = 376, - KW_WHILE = 377, - START_CPP = 378, - START_CONST_EXPR = 379, - START_TYPE = 380 + TYPEPACK_IDENTIFIER = 267, + SCOPING = 268, + TYPEDEFNAME = 269, + ELLIPSIS = 270, + OROR = 271, + ANDAND = 272, + EQCOMPARE = 273, + NECOMPARE = 274, + LECOMPARE = 275, + GECOMPARE = 276, + LSHIFT = 277, + RSHIFT = 278, + POINTSAT_STAR = 279, + DOT_STAR = 280, + UNARY = 281, + UNARY_NOT = 282, + UNARY_NEGATE = 283, + UNARY_MINUS = 284, + UNARY_PLUS = 285, + UNARY_STAR = 286, + UNARY_REF = 287, + POINTSAT = 288, + SCOPE = 289, + PLUSPLUS = 290, + MINUSMINUS = 291, + TIMESEQUAL = 292, + DIVIDEEQUAL = 293, + MODEQUAL = 294, + PLUSEQUAL = 295, + MINUSEQUAL = 296, + OREQUAL = 297, + ANDEQUAL = 298, + XOREQUAL = 299, + LSHIFTEQUAL = 300, + RSHIFTEQUAL = 301, + KW_ALIGNAS = 302, + KW_ALIGNOF = 303, + KW_AUTO = 304, + KW_BEGIN_PUBLISH = 305, + KW_BLOCKING = 306, + KW_BOOL = 307, + KW_CATCH = 308, + KW_CHAR = 309, + KW_CHAR16_T = 310, + KW_CHAR32_T = 311, + KW_CLASS = 312, + KW_CONST = 313, + KW_CONSTEXPR = 314, + KW_CONST_CAST = 315, + KW_DECLTYPE = 316, + KW_DEFAULT = 317, + KW_DELETE = 318, + KW_DOUBLE = 319, + KW_DYNAMIC_CAST = 320, + KW_ELSE = 321, + KW_END_PUBLISH = 322, + KW_ENUM = 323, + KW_EXTENSION = 324, + KW_EXTERN = 325, + KW_EXPLICIT = 326, + KW_PUBLISHED = 327, + KW_FALSE = 328, + KW_FINAL = 329, + KW_FLOAT = 330, + KW_FRIEND = 331, + KW_FOR = 332, + KW_GOTO = 333, + KW_HAS_VIRTUAL_DESTRUCTOR = 334, + KW_IF = 335, + KW_INLINE = 336, + KW_INT = 337, + KW_IS_ABSTRACT = 338, + KW_IS_BASE_OF = 339, + KW_IS_CLASS = 340, + KW_IS_CONSTRUCTIBLE = 341, + KW_IS_CONVERTIBLE_TO = 342, + KW_IS_DESTRUCTIBLE = 343, + KW_IS_EMPTY = 344, + KW_IS_ENUM = 345, + KW_IS_FINAL = 346, + KW_IS_FUNDAMENTAL = 347, + KW_IS_POD = 348, + KW_IS_POLYMORPHIC = 349, + KW_IS_STANDARD_LAYOUT = 350, + KW_IS_TRIVIAL = 351, + KW_IS_UNION = 352, + KW_LONG = 353, + KW_MAKE_MAP_PROPERTY = 354, + KW_MAKE_PROPERTY = 355, + KW_MAKE_PROPERTY2 = 356, + KW_MAKE_SEQ = 357, + KW_MAKE_SEQ_PROPERTY = 358, + KW_MUTABLE = 359, + KW_NAMESPACE = 360, + KW_NEW = 361, + KW_NOEXCEPT = 362, + KW_NULLPTR = 363, + KW_OPERATOR = 364, + KW_OVERRIDE = 365, + KW_PRIVATE = 366, + KW_PROTECTED = 367, + KW_PUBLIC = 368, + KW_REGISTER = 369, + KW_REINTERPRET_CAST = 370, + KW_RETURN = 371, + KW_SHORT = 372, + KW_SIGNED = 373, + KW_SIZEOF = 374, + KW_STATIC = 375, + KW_STATIC_ASSERT = 376, + KW_STATIC_CAST = 377, + KW_STRUCT = 378, + KW_TEMPLATE = 379, + KW_THREAD_LOCAL = 380, + KW_THROW = 381, + KW_TRUE = 382, + KW_TRY = 383, + KW_TYPEDEF = 384, + KW_TYPEID = 385, + KW_TYPENAME = 386, + KW_UNDERLYING_TYPE = 387, + KW_UNION = 388, + KW_UNSIGNED = 389, + KW_USING = 390, + KW_VIRTUAL = 391, + KW_VOID = 392, + KW_VOLATILE = 393, + KW_WCHAR_T = 394, + KW_WHILE = 395, + START_CPP = 396, + START_CONST_EXPR = 397, + START_TYPE = 398 }; #endif /* Tokens. */ @@ -432,120 +450,138 @@ extern int cppyydebug; #define CUSTOM_LITERAL 264 #define IDENTIFIER 265 #define TYPENAME_IDENTIFIER 266 -#define SCOPING 267 -#define TYPEDEFNAME 268 -#define ELLIPSIS 269 -#define OROR 270 -#define ANDAND 271 -#define EQCOMPARE 272 -#define NECOMPARE 273 -#define LECOMPARE 274 -#define GECOMPARE 275 -#define LSHIFT 276 -#define RSHIFT 277 -#define POINTSAT_STAR 278 -#define DOT_STAR 279 -#define UNARY 280 -#define UNARY_NOT 281 -#define UNARY_NEGATE 282 -#define UNARY_MINUS 283 -#define UNARY_PLUS 284 -#define UNARY_STAR 285 -#define UNARY_REF 286 -#define POINTSAT 287 -#define SCOPE 288 -#define PLUSPLUS 289 -#define MINUSMINUS 290 -#define TIMESEQUAL 291 -#define DIVIDEEQUAL 292 -#define MODEQUAL 293 -#define PLUSEQUAL 294 -#define MINUSEQUAL 295 -#define OREQUAL 296 -#define ANDEQUAL 297 -#define XOREQUAL 298 -#define LSHIFTEQUAL 299 -#define RSHIFTEQUAL 300 -#define KW_ALIGNAS 301 -#define KW_ALIGNOF 302 -#define KW_AUTO 303 -#define KW_BEGIN_PUBLISH 304 -#define KW_BLOCKING 305 -#define KW_BOOL 306 -#define KW_CATCH 307 -#define KW_CHAR 308 -#define KW_CHAR16_T 309 -#define KW_CHAR32_T 310 -#define KW_CLASS 311 -#define KW_CONST 312 -#define KW_CONSTEXPR 313 -#define KW_CONST_CAST 314 -#define KW_DECLTYPE 315 -#define KW_DEFAULT 316 -#define KW_DELETE 317 -#define KW_DOUBLE 318 -#define KW_DYNAMIC_CAST 319 -#define KW_ELSE 320 -#define KW_END_PUBLISH 321 -#define KW_ENUM 322 -#define KW_EXTENSION 323 -#define KW_EXTERN 324 -#define KW_EXPLICIT 325 -#define KW_PUBLISHED 326 -#define KW_FALSE 327 -#define KW_FINAL 328 -#define KW_FLOAT 329 -#define KW_FRIEND 330 -#define KW_FOR 331 -#define KW_GOTO 332 -#define KW_IF 333 -#define KW_INLINE 334 -#define KW_INT 335 -#define KW_LONG 336 -#define KW_MAKE_MAP_PROPERTY 337 -#define KW_MAKE_PROPERTY 338 -#define KW_MAKE_PROPERTY2 339 -#define KW_MAKE_SEQ 340 -#define KW_MAKE_SEQ_PROPERTY 341 -#define KW_MUTABLE 342 -#define KW_NAMESPACE 343 -#define KW_NEW 344 -#define KW_NOEXCEPT 345 -#define KW_NULLPTR 346 -#define KW_OPERATOR 347 -#define KW_OVERRIDE 348 -#define KW_PRIVATE 349 -#define KW_PROTECTED 350 -#define KW_PUBLIC 351 -#define KW_REGISTER 352 -#define KW_REINTERPRET_CAST 353 -#define KW_RETURN 354 -#define KW_SHORT 355 -#define KW_SIGNED 356 -#define KW_SIZEOF 357 -#define KW_STATIC 358 -#define KW_STATIC_ASSERT 359 -#define KW_STATIC_CAST 360 -#define KW_STRUCT 361 -#define KW_TEMPLATE 362 -#define KW_THREAD_LOCAL 363 -#define KW_THROW 364 -#define KW_TRUE 365 -#define KW_TRY 366 -#define KW_TYPEDEF 367 -#define KW_TYPEID 368 -#define KW_TYPENAME 369 -#define KW_UNION 370 -#define KW_UNSIGNED 371 -#define KW_USING 372 -#define KW_VIRTUAL 373 -#define KW_VOID 374 -#define KW_VOLATILE 375 -#define KW_WCHAR_T 376 -#define KW_WHILE 377 -#define START_CPP 378 -#define START_CONST_EXPR 379 -#define START_TYPE 380 +#define TYPEPACK_IDENTIFIER 267 +#define SCOPING 268 +#define TYPEDEFNAME 269 +#define ELLIPSIS 270 +#define OROR 271 +#define ANDAND 272 +#define EQCOMPARE 273 +#define NECOMPARE 274 +#define LECOMPARE 275 +#define GECOMPARE 276 +#define LSHIFT 277 +#define RSHIFT 278 +#define POINTSAT_STAR 279 +#define DOT_STAR 280 +#define UNARY 281 +#define UNARY_NOT 282 +#define UNARY_NEGATE 283 +#define UNARY_MINUS 284 +#define UNARY_PLUS 285 +#define UNARY_STAR 286 +#define UNARY_REF 287 +#define POINTSAT 288 +#define SCOPE 289 +#define PLUSPLUS 290 +#define MINUSMINUS 291 +#define TIMESEQUAL 292 +#define DIVIDEEQUAL 293 +#define MODEQUAL 294 +#define PLUSEQUAL 295 +#define MINUSEQUAL 296 +#define OREQUAL 297 +#define ANDEQUAL 298 +#define XOREQUAL 299 +#define LSHIFTEQUAL 300 +#define RSHIFTEQUAL 301 +#define KW_ALIGNAS 302 +#define KW_ALIGNOF 303 +#define KW_AUTO 304 +#define KW_BEGIN_PUBLISH 305 +#define KW_BLOCKING 306 +#define KW_BOOL 307 +#define KW_CATCH 308 +#define KW_CHAR 309 +#define KW_CHAR16_T 310 +#define KW_CHAR32_T 311 +#define KW_CLASS 312 +#define KW_CONST 313 +#define KW_CONSTEXPR 314 +#define KW_CONST_CAST 315 +#define KW_DECLTYPE 316 +#define KW_DEFAULT 317 +#define KW_DELETE 318 +#define KW_DOUBLE 319 +#define KW_DYNAMIC_CAST 320 +#define KW_ELSE 321 +#define KW_END_PUBLISH 322 +#define KW_ENUM 323 +#define KW_EXTENSION 324 +#define KW_EXTERN 325 +#define KW_EXPLICIT 326 +#define KW_PUBLISHED 327 +#define KW_FALSE 328 +#define KW_FINAL 329 +#define KW_FLOAT 330 +#define KW_FRIEND 331 +#define KW_FOR 332 +#define KW_GOTO 333 +#define KW_HAS_VIRTUAL_DESTRUCTOR 334 +#define KW_IF 335 +#define KW_INLINE 336 +#define KW_INT 337 +#define KW_IS_ABSTRACT 338 +#define KW_IS_BASE_OF 339 +#define KW_IS_CLASS 340 +#define KW_IS_CONSTRUCTIBLE 341 +#define KW_IS_CONVERTIBLE_TO 342 +#define KW_IS_DESTRUCTIBLE 343 +#define KW_IS_EMPTY 344 +#define KW_IS_ENUM 345 +#define KW_IS_FINAL 346 +#define KW_IS_FUNDAMENTAL 347 +#define KW_IS_POD 348 +#define KW_IS_POLYMORPHIC 349 +#define KW_IS_STANDARD_LAYOUT 350 +#define KW_IS_TRIVIAL 351 +#define KW_IS_UNION 352 +#define KW_LONG 353 +#define KW_MAKE_MAP_PROPERTY 354 +#define KW_MAKE_PROPERTY 355 +#define KW_MAKE_PROPERTY2 356 +#define KW_MAKE_SEQ 357 +#define KW_MAKE_SEQ_PROPERTY 358 +#define KW_MUTABLE 359 +#define KW_NAMESPACE 360 +#define KW_NEW 361 +#define KW_NOEXCEPT 362 +#define KW_NULLPTR 363 +#define KW_OPERATOR 364 +#define KW_OVERRIDE 365 +#define KW_PRIVATE 366 +#define KW_PROTECTED 367 +#define KW_PUBLIC 368 +#define KW_REGISTER 369 +#define KW_REINTERPRET_CAST 370 +#define KW_RETURN 371 +#define KW_SHORT 372 +#define KW_SIGNED 373 +#define KW_SIZEOF 374 +#define KW_STATIC 375 +#define KW_STATIC_ASSERT 376 +#define KW_STATIC_CAST 377 +#define KW_STRUCT 378 +#define KW_TEMPLATE 379 +#define KW_THREAD_LOCAL 380 +#define KW_THROW 381 +#define KW_TRUE 382 +#define KW_TRY 383 +#define KW_TYPEDEF 384 +#define KW_TYPEID 385 +#define KW_TYPENAME 386 +#define KW_UNDERLYING_TYPE 387 +#define KW_UNION 388 +#define KW_UNSIGNED 389 +#define KW_USING 390 +#define KW_VIRTUAL 391 +#define KW_VOID 392 +#define KW_VOLATILE 393 +#define KW_WCHAR_T 394 +#define KW_WHILE 395 +#define START_CPP 396 +#define START_CONST_EXPR 397 +#define START_TYPE 398 /* Value type. */ @@ -571,7 +607,7 @@ int cppyyparse (void); /* Copy the second part of user declarations. */ -#line 575 "built/tmp/cppBison.yxx.c" /* yacc.c:358 */ +#line 611 "built/tmp/cppBison.yxx.c" /* yacc.c:358 */ #ifdef short # undef short @@ -813,23 +849,23 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 85 +#define YYFINAL 104 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 5523 +#define YYLAST 6206 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 150 +#define YYNTOKENS 168 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 109 +#define YYNNTS 107 /* YYNRULES -- Number of rules. */ -#define YYNRULES 680 +#define YYNRULES 733 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 1339 +#define YYNSTATES 1482 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 380 +#define YYMAXUTOK 398 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -841,16 +877,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 149, 2, 2, 2, 141, 134, 2, - 144, 146, 139, 137, 127, 138, 143, 140, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 129, 128, - 135, 130, 136, 131, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 167, 2, 2, 2, 159, 152, 2, + 162, 164, 157, 155, 145, 156, 161, 158, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 147, 146, + 153, 148, 154, 149, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 145, 2, 148, 133, 2, 2, 2, 2, 2, + 2, 163, 2, 166, 151, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 126, 132, 147, 142, 2, 2, 2, + 2, 2, 2, 144, 150, 165, 160, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -876,82 +912,88 @@ static const yytype_uint8 yytranslate[] = 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125 + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 424, 424, 425, 429, 436, 437, 438, 442, 443, - 447, 451, 464, 463, 475, 476, 477, 478, 479, 480, - 481, 494, 503, 507, 515, 519, 523, 534, 555, 585, - 602, 630, 667, 689, 722, 744, 755, 769, 768, 783, - 787, 791, 802, 806, 810, 814, 818, 822, 826, 830, - 834, 838, 842, 846, 854, 855, 859, 860, 864, 868, - 877, 885, 893, 898, 897, 913, 912, 934, 942, 953, - 962, 976, 975, 991, 990, 1005, 1020, 1026, 1035, 1042, - 1055, 1054, 1079, 1078, 1106, 1105, 1136, 1135, 1154, 1153, - 1174, 1173, 1205, 1204, 1230, 1243, 1247, 1251, 1255, 1259, - 1263, 1268, 1272, 1283, 1287, 1291, 1295, 1299, 1303, 1307, - 1311, 1315, 1319, 1323, 1327, 1331, 1335, 1339, 1343, 1347, - 1351, 1355, 1359, 1363, 1367, 1371, 1375, 1379, 1383, 1387, - 1391, 1395, 1399, 1403, 1407, 1411, 1415, 1419, 1423, 1427, - 1431, 1435, 1442, 1443, 1448, 1447, 1455, 1459, 1460, 1464, - 1470, 1479, 1483, 1487, 1491, 1495, 1501, 1511, 1515, 1520, - 1532, 1536, 1550, 1565, 1570, 1575, 1580, 1585, 1590, 1595, - 1600, 1606, 1605, 1627, 1637, 1647, 1651, 1655, 1664, 1668, - 1673, 1677, 1682, 1690, 1695, 1703, 1707, 1712, 1716, 1721, - 1729, 1734, 1742, 1746, 1753, 1757, 1764, 1768, 1772, 1776, - 1780, 1787, 1791, 1795, 1799, 1803, 1807, 1814, 1815, 1816, - 1820, 1823, 1824, 1825, 1829, 1834, 1840, 1846, 1857, 1861, - 1871, 1875, 1879, 1884, 1889, 1894, 1899, 1904, 1909, 1917, - 1921, 1925, 1930, 1935, 1940, 1945, 1950, 1955, 1960, 1966, - 1974, 1978, 1983, 1988, 1993, 1998, 2003, 2008, 2016, 2020, - 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2061, 2068, 2075, - 2085, 2089, 2097, 2101, 2105, 2109, 2113, 2129, 2145, 2154, - 2161, 2165, 2173, 2177, 2181, 2185, 2189, 2205, 2221, 2239, - 2248, 2255, 2259, 2267, 2271, 2287, 2303, 2312, 2319, 2323, - 2331, 2335, 2344, 2343, 2368, 2367, 2397, 2398, 2405, 2406, - 2410, 2411, 2415, 2419, 2423, 2427, 2431, 2435, 2439, 2443, - 2447, 2451, 2458, 2466, 2470, 2474, 2479, 2487, 2491, 2498, - 2499, 2504, 2511, 2512, 2517, 2525, 2529, 2533, 2540, 2544, - 2548, 2556, 2555, 2578, 2577, 2600, 2601, 2605, 2611, 2618, - 2627, 2628, 2629, 2633, 2637, 2641, 2645, 2649, 2653, 2658, - 2663, 2668, 2673, 2677, 2682, 2691, 2696, 2704, 2708, 2712, - 2720, 2730, 2730, 2740, 2741, 2745, 2746, 2747, 2748, 2749, - 2750, 2751, 2752, 2753, 2754, 2755, 2755, 2755, 2756, 2756, - 2756, 2756, 2757, 2757, 2757, 2757, 2757, 2758, 2758, 2758, - 2759, 2759, 2759, 2759, 2759, 2760, 2760, 2760, 2760, 2760, - 2761, 2761, 2761, 2761, 2761, 2762, 2762, 2762, 2762, 2762, - 2763, 2763, 2763, 2763, 2764, 2764, 2764, 2764, 2764, 2765, - 2765, 2765, 2765, 2765, 2766, 2766, 2766, 2766, 2766, 2766, - 2767, 2767, 2767, 2767, 2767, 2768, 2768, 2768, 2768, 2769, - 2769, 2769, 2769, 2770, 2770, 2770, 2770, 2770, 2771, 2771, - 2771, 2772, 2772, 2772, 2772, 2772, 2773, 2773, 2773, 2773, - 2773, 2774, 2774, 2774, 2774, 2774, 2777, 2777, 2777, 2777, - 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2778, 2778, 2778, - 2778, 2778, 2778, 2778, 2778, 2778, 2778, 2779, 2779, 2783, - 2787, 2794, 2798, 2805, 2809, 2816, 2820, 2824, 2828, 2832, - 2836, 2840, 2844, 2848, 2852, 2856, 2860, 2864, 2868, 2872, - 2876, 2880, 2884, 2888, 2892, 2896, 2900, 2904, 2908, 2912, - 2916, 2920, 2924, 2928, 2932, 2936, 2940, 2944, 2948, 2952, - 2956, 2960, 2968, 2972, 2976, 2980, 2984, 2988, 2992, 3002, - 3008, 3014, 3020, 3026, 3032, 3038, 3045, 3052, 3059, 3066, - 3072, 3078, 3082, 3086, 3090, 3094, 3105, 3116, 3120, 3124, - 3128, 3132, 3136, 3140, 3144, 3148, 3152, 3156, 3160, 3164, - 3168, 3172, 3176, 3180, 3184, 3188, 3192, 3196, 3200, 3204, - 3208, 3212, 3216, 3220, 3224, 3228, 3232, 3236, 3243, 3247, - 3251, 3255, 3259, 3263, 3267, 3271, 3275, 3281, 3287, 3291, - 3295, 3309, 3313, 3317, 3321, 3325, 3329, 3333, 3337, 3341, - 3345, 3349, 3360, 3371, 3375, 3379, 3383, 3387, 3391, 3395, - 3399, 3403, 3407, 3411, 3415, 3419, 3423, 3427, 3431, 3435, - 3439, 3443, 3447, 3451, 3455, 3459, 3463, 3467, 3471, 3475, - 3479, 3483, 3487, 3494, 3498, 3502, 3506, 3510, 3514, 3518, - 3522, 3526, 3532, 3538, 3546, 3547, 3548, 3552, 3553, 3554, - 3555, 3559, 3567, 3575, 3603, 3607, 3611, 3615, 3619, 3625, - 3629, 3633, 3637, 3648, 3652, 3656, 3664, 3668, 3672, 3678, - 3689 + 0, 442, 442, 443, 447, 454, 455, 456, 460, 461, + 465, 469, 473, 486, 485, 497, 498, 499, 500, 501, + 502, 503, 516, 525, 529, 537, 541, 545, 556, 577, + 607, 624, 652, 689, 711, 744, 766, 777, 791, 790, + 805, 809, 814, 818, 829, 833, 837, 841, 845, 849, + 853, 857, 861, 865, 869, 873, 881, 882, 886, 887, + 892, 891, 907, 916, 924, 932, 940, 951, 967, 966, + 981, 996, 1005, 1020, 1019, 1044, 1043, 1071, 1070, 1101, + 1100, 1119, 1118, 1139, 1138, 1170, 1169, 1195, 1208, 1212, + 1216, 1220, 1224, 1228, 1232, 1236, 1240, 1245, 1249, 1253, + 1264, 1268, 1272, 1276, 1280, 1284, 1288, 1292, 1296, 1300, + 1304, 1308, 1312, 1316, 1320, 1324, 1328, 1332, 1336, 1340, + 1344, 1348, 1352, 1356, 1360, 1364, 1368, 1372, 1376, 1380, + 1384, 1388, 1392, 1396, 1400, 1404, 1408, 1412, 1416, 1423, + 1424, 1429, 1428, 1436, 1440, 1441, 1445, 1451, 1460, 1461, + 1465, 1469, 1473, 1477, 1483, 1489, 1495, 1502, 1507, 1516, + 1520, 1525, 1533, 1545, 1549, 1563, 1578, 1583, 1588, 1593, + 1598, 1603, 1608, 1613, 1619, 1618, 1640, 1650, 1660, 1664, + 1668, 1677, 1681, 1686, 1690, 1695, 1703, 1708, 1716, 1720, + 1725, 1729, 1734, 1742, 1747, 1755, 1759, 1766, 1770, 1777, + 1781, 1785, 1789, 1793, 1800, 1804, 1808, 1812, 1816, 1820, + 1827, 1828, 1829, 1833, 1836, 1837, 1838, 1842, 1847, 1853, + 1859, 1864, 1870, 1876, 1887, 1891, 1901, 1905, 1909, 1914, + 1919, 1924, 1929, 1934, 1939, 1947, 1951, 1955, 1960, 1965, + 1970, 1975, 1980, 1985, 1990, 1996, 2004, 2009, 2014, 2019, + 2024, 2029, 2034, 2039, 2044, 2049, 2055, 2063, 2067, 2072, + 2077, 2082, 2087, 2092, 2097, 2102, 2107, 2115, 2119, 2124, + 2129, 2134, 2139, 2144, 2149, 2154, 2159, 2164, 2170, 2177, + 2184, 2194, 2198, 2206, 2210, 2214, 2218, 2222, 2238, 2254, + 2263, 2273, 2280, 2291, 2295, 2303, 2307, 2311, 2315, 2319, + 2335, 2351, 2369, 2378, 2388, 2395, 2399, 2407, 2411, 2427, + 2443, 2452, 2462, 2469, 2473, 2481, 2485, 2490, 2494, 2503, + 2502, 2527, 2526, 2556, 2557, 2564, 2565, 2569, 2570, 2574, + 2578, 2582, 2586, 2590, 2594, 2598, 2602, 2606, 2610, 2617, + 2625, 2629, 2633, 2638, 2646, 2650, 2657, 2658, 2663, 2670, + 2671, 2676, 2684, 2688, 2692, 2699, 2703, 2707, 2715, 2714, + 2737, 2736, 2759, 2760, 2764, 2770, 2777, 2786, 2787, 2788, + 2792, 2796, 2800, 2804, 2808, 2812, 2817, 2822, 2827, 2832, + 2836, 2841, 2850, 2855, 2863, 2867, 2871, 2879, 2889, 2889, + 2899, 2900, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, + 2912, 2913, 2914, 2915, 2915, 2915, 2916, 2916, 2916, 2916, + 2917, 2917, 2917, 2917, 2917, 2918, 2918, 2918, 2919, 2919, + 2919, 2919, 2919, 2920, 2920, 2920, 2920, 2920, 2921, 2921, + 2921, 2921, 2921, 2922, 2922, 2922, 2922, 2922, 2923, 2923, + 2923, 2923, 2924, 2924, 2924, 2924, 2924, 2925, 2925, 2925, + 2925, 2925, 2926, 2926, 2926, 2926, 2926, 2926, 2927, 2927, + 2927, 2927, 2927, 2928, 2928, 2928, 2928, 2929, 2929, 2929, + 2929, 2930, 2930, 2930, 2930, 2930, 2931, 2931, 2931, 2931, + 2932, 2932, 2932, 2932, 2932, 2933, 2933, 2933, 2933, 2934, + 2934, 2934, 2934, 2934, 2935, 2935, 2938, 2938, 2938, 2938, + 2938, 2938, 2938, 2938, 2938, 2938, 2938, 2939, 2939, 2939, + 2939, 2939, 2939, 2939, 2939, 2939, 2939, 2940, 2940, 2944, + 2948, 2955, 2959, 2966, 2970, 2977, 2981, 2985, 2989, 2993, + 2997, 3001, 3005, 3009, 3013, 3017, 3021, 3025, 3029, 3033, + 3037, 3041, 3045, 3049, 3053, 3057, 3061, 3065, 3069, 3073, + 3077, 3081, 3085, 3089, 3093, 3097, 3101, 3105, 3109, 3113, + 3117, 3121, 3125, 3133, 3137, 3141, 3145, 3149, 3153, 3157, + 3167, 3173, 3179, 3185, 3191, 3197, 3203, 3210, 3217, 3224, + 3231, 3237, 3243, 3247, 3251, 3255, 3259, 3263, 3274, 3285, + 3289, 3293, 3297, 3301, 3305, 3309, 3313, 3317, 3321, 3325, + 3329, 3333, 3337, 3341, 3345, 3349, 3353, 3357, 3361, 3365, + 3369, 3373, 3377, 3381, 3385, 3389, 3393, 3397, 3401, 3405, + 3412, 3416, 3420, 3424, 3428, 3432, 3436, 3440, 3444, 3450, + 3456, 3460, 3464, 3468, 3472, 3476, 3480, 3484, 3488, 3492, + 3496, 3500, 3504, 3508, 3512, 3516, 3520, 3524, 3528, 3532, + 3546, 3550, 3554, 3558, 3562, 3566, 3570, 3574, 3578, 3582, + 3586, 3590, 3601, 3612, 3616, 3620, 3624, 3628, 3632, 3636, + 3640, 3644, 3648, 3652, 3656, 3660, 3664, 3668, 3672, 3676, + 3680, 3684, 3688, 3692, 3696, 3700, 3704, 3708, 3712, 3716, + 3720, 3724, 3728, 3735, 3739, 3743, 3747, 3751, 3755, 3759, + 3763, 3767, 3773, 3779, 3787, 3788, 3789, 3793, 3794, 3795, + 3796, 3800, 3808, 3816, 3820, 3850, 3854, 3858, 3862, 3866, + 3870, 3876, 3880, 3884, 3888, 3899, 3903, 3907, 3911, 3919, + 3923, 3927, 3933, 3944 }; #endif @@ -962,20 +1004,25 @@ static const char *const yytname[] = { "$end", "error", "$undefined", "REAL", "INTEGER", "CHAR_TOK", "SIMPLE_STRING", "SIMPLE_IDENTIFIER", "STRING_LITERAL", "CUSTOM_LITERAL", - "IDENTIFIER", "TYPENAME_IDENTIFIER", "SCOPING", "TYPEDEFNAME", - "ELLIPSIS", "OROR", "ANDAND", "EQCOMPARE", "NECOMPARE", "LECOMPARE", - "GECOMPARE", "LSHIFT", "RSHIFT", "POINTSAT_STAR", "DOT_STAR", "UNARY", - "UNARY_NOT", "UNARY_NEGATE", "UNARY_MINUS", "UNARY_PLUS", "UNARY_STAR", - "UNARY_REF", "POINTSAT", "SCOPE", "PLUSPLUS", "MINUSMINUS", "TIMESEQUAL", - "DIVIDEEQUAL", "MODEQUAL", "PLUSEQUAL", "MINUSEQUAL", "OREQUAL", - "ANDEQUAL", "XOREQUAL", "LSHIFTEQUAL", "RSHIFTEQUAL", "KW_ALIGNAS", - "KW_ALIGNOF", "KW_AUTO", "KW_BEGIN_PUBLISH", "KW_BLOCKING", "KW_BOOL", - "KW_CATCH", "KW_CHAR", "KW_CHAR16_T", "KW_CHAR32_T", "KW_CLASS", - "KW_CONST", "KW_CONSTEXPR", "KW_CONST_CAST", "KW_DECLTYPE", "KW_DEFAULT", - "KW_DELETE", "KW_DOUBLE", "KW_DYNAMIC_CAST", "KW_ELSE", "KW_END_PUBLISH", - "KW_ENUM", "KW_EXTENSION", "KW_EXTERN", "KW_EXPLICIT", "KW_PUBLISHED", - "KW_FALSE", "KW_FINAL", "KW_FLOAT", "KW_FRIEND", "KW_FOR", "KW_GOTO", - "KW_IF", "KW_INLINE", "KW_INT", "KW_LONG", "KW_MAKE_MAP_PROPERTY", + "IDENTIFIER", "TYPENAME_IDENTIFIER", "TYPEPACK_IDENTIFIER", "SCOPING", + "TYPEDEFNAME", "ELLIPSIS", "OROR", "ANDAND", "EQCOMPARE", "NECOMPARE", + "LECOMPARE", "GECOMPARE", "LSHIFT", "RSHIFT", "POINTSAT_STAR", + "DOT_STAR", "UNARY", "UNARY_NOT", "UNARY_NEGATE", "UNARY_MINUS", + "UNARY_PLUS", "UNARY_STAR", "UNARY_REF", "POINTSAT", "SCOPE", "PLUSPLUS", + "MINUSMINUS", "TIMESEQUAL", "DIVIDEEQUAL", "MODEQUAL", "PLUSEQUAL", + "MINUSEQUAL", "OREQUAL", "ANDEQUAL", "XOREQUAL", "LSHIFTEQUAL", + "RSHIFTEQUAL", "KW_ALIGNAS", "KW_ALIGNOF", "KW_AUTO", "KW_BEGIN_PUBLISH", + "KW_BLOCKING", "KW_BOOL", "KW_CATCH", "KW_CHAR", "KW_CHAR16_T", + "KW_CHAR32_T", "KW_CLASS", "KW_CONST", "KW_CONSTEXPR", "KW_CONST_CAST", + "KW_DECLTYPE", "KW_DEFAULT", "KW_DELETE", "KW_DOUBLE", "KW_DYNAMIC_CAST", + "KW_ELSE", "KW_END_PUBLISH", "KW_ENUM", "KW_EXTENSION", "KW_EXTERN", + "KW_EXPLICIT", "KW_PUBLISHED", "KW_FALSE", "KW_FINAL", "KW_FLOAT", + "KW_FRIEND", "KW_FOR", "KW_GOTO", "KW_HAS_VIRTUAL_DESTRUCTOR", "KW_IF", + "KW_INLINE", "KW_INT", "KW_IS_ABSTRACT", "KW_IS_BASE_OF", "KW_IS_CLASS", + "KW_IS_CONSTRUCTIBLE", "KW_IS_CONVERTIBLE_TO", "KW_IS_DESTRUCTIBLE", + "KW_IS_EMPTY", "KW_IS_ENUM", "KW_IS_FINAL", "KW_IS_FUNDAMENTAL", + "KW_IS_POD", "KW_IS_POLYMORPHIC", "KW_IS_STANDARD_LAYOUT", + "KW_IS_TRIVIAL", "KW_IS_UNION", "KW_LONG", "KW_MAKE_MAP_PROPERTY", "KW_MAKE_PROPERTY", "KW_MAKE_PROPERTY2", "KW_MAKE_SEQ", "KW_MAKE_SEQ_PROPERTY", "KW_MUTABLE", "KW_NAMESPACE", "KW_NEW", "KW_NOEXCEPT", "KW_NULLPTR", "KW_OPERATOR", "KW_OVERRIDE", "KW_PRIVATE", @@ -983,24 +1030,23 @@ static const char *const yytname[] = "KW_RETURN", "KW_SHORT", "KW_SIGNED", "KW_SIZEOF", "KW_STATIC", "KW_STATIC_ASSERT", "KW_STATIC_CAST", "KW_STRUCT", "KW_TEMPLATE", "KW_THREAD_LOCAL", "KW_THROW", "KW_TRUE", "KW_TRY", "KW_TYPEDEF", - "KW_TYPEID", "KW_TYPENAME", "KW_UNION", "KW_UNSIGNED", "KW_USING", - "KW_VIRTUAL", "KW_VOID", "KW_VOLATILE", "KW_WCHAR_T", "KW_WHILE", - "START_CPP", "START_CONST_EXPR", "START_TYPE", "'{'", "','", "';'", - "':'", "'='", "'?'", "'|'", "'^'", "'&'", "'<'", "'>'", "'+'", "'-'", - "'*'", "'/'", "'%'", "'~'", "'.'", "'('", "'['", "')'", "'}'", "']'", - "'!'", "$accept", "grammar", "cpp", "constructor_inits", - "constructor_init", "extern_c", "$@1", "declaration", - "friend_declaration", "$@2", "storage_class", "attribute_specifiers", - "attribute_specifier", "type_like_declaration", - "multiple_var_declaration", "$@3", "$@4", - "multiple_instance_identifiers", "multiple_const_instance_identifiers", - "typedef_declaration", "$@5", "$@6", "typedef_instance_identifiers", - "typedef_const_instance_identifiers", "constructor_prototype", "$@7", - "$@8", "function_prototype", "$@9", "$@10", "$@11", "$@12", "$@13", + "KW_TYPEID", "KW_TYPENAME", "KW_UNDERLYING_TYPE", "KW_UNION", + "KW_UNSIGNED", "KW_USING", "KW_VIRTUAL", "KW_VOID", "KW_VOLATILE", + "KW_WCHAR_T", "KW_WHILE", "START_CPP", "START_CONST_EXPR", "START_TYPE", + "'{'", "','", "';'", "':'", "'='", "'?'", "'|'", "'^'", "'&'", "'<'", + "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "'.'", "'('", "'['", + "')'", "'}'", "']'", "'!'", "$accept", "grammar", "cpp", + "constructor_inits", "constructor_init", "extern_c", "$@1", + "declaration", "friend_declaration", "$@2", "storage_class", + "attribute_specifiers", "attribute_specifier", "type_like_declaration", + "$@3", "multiple_instance_identifiers", "typedef_declaration", "$@4", + "typedef_instance_identifiers", "constructor_prototype", "$@5", "$@6", + "function_prototype", "$@7", "$@8", "$@9", "$@10", "$@11", "function_post", "function_operator", "more_template_declaration", - "template_declaration", "$@14", "template_formal_parameters", - "template_nonempty_formal_parameters", "template_formal_parameter", - "template_formal_parameter_type", "instance_identifier", "$@15", + "template_declaration", "$@12", "template_formal_parameters", + "template_nonempty_formal_parameters", "typename_keyword", + "template_formal_parameter", "template_formal_parameter_type", + "instance_identifier", "$@13", "instance_identifier_and_maybe_trailing_return_type", "maybe_trailing_return_type", "function_parameter_list", "function_parameters", "formal_parameter_list", "formal_parameters", @@ -1009,14 +1055,15 @@ static const char *const yytname[] = "maybe_initialize_or_function_body", "structure_init", "structure_init_body", "function_parameter", "formal_parameter", "not_paren_formal_parameter_identifier", "formal_parameter_identifier", - "not_paren_empty_instance_identifier", "empty_instance_identifier", - "type", "type_decl", "predefined_type", "var_type_decl", "full_type", - "anonymous_struct", "$@16", "named_struct", "$@17", "maybe_final", - "maybe_class_derivation", "class_derivation", "base_specification", - "enum", "enum_decl", "enum_element_type", "enum_body_trailing_comma", - "enum_body", "enum_keyword", "struct_keyword", "namespace_declaration", - "$@18", "$@19", "using_declaration", "simple_type", "simple_int_type", - "simple_float_type", "simple_void_type", "code", "$@20", "code_block", + "parameter_pack_identifier", "not_paren_empty_instance_identifier", + "empty_instance_identifier", "type", "type_pack", "type_decl", + "predefined_type", "var_type_decl", "full_type", "anonymous_struct", + "$@14", "named_struct", "$@15", "maybe_final", "maybe_class_derivation", + "class_derivation", "base_specification", "enum", "enum_decl", + "enum_element_type", "enum_body_trailing_comma", "enum_body", + "enum_keyword", "struct_keyword", "namespace_declaration", "$@16", + "$@17", "using_declaration", "simple_type", "simple_int_type", + "simple_float_type", "simple_void_type", "code", "$@18", "code_block", "element", "optional_const_expr", "optional_const_expr_comma", "const_expr_comma", "no_angle_bracket_const_expr", "const_expr", "const_operand", "formal_const_expr", "formal_const_operand", @@ -1042,18 +1089,20 @@ static const yytype_uint16 yytoknum[] = 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 123, 44, 59, 58, - 61, 63, 124, 94, 38, 60, 62, 43, 45, 42, - 47, 37, 126, 46, 40, 91, 41, 125, 93, 33 + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 123, 44, 59, 58, 61, 63, + 124, 94, 38, 60, 62, 43, 45, 42, 47, 37, + 126, 46, 40, 91, 41, 125, 93, 33 }; # endif -#define YYPACT_NINF -703 +#define YYPACT_NINF -868 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-703))) + (!!((Yystate) == (-868))) -#define YYTABLE_NINF -676 +#define YYTABLE_NINF -729 #define yytable_value_is_error(Yytable_value) \ 0 @@ -1062,140 +1111,155 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 362, -703, 2822, 4474, 57, 3018, -703, -703, -703, -703, - -703, -703, -703, -703, -118, -82, -78, -69, -61, -41, - -13, -30, -4, -703, -703, -18, -2, 1, 4682, -703, - -703, 23, 59, 73, 89, 133, -703, 141, 188, 199, - 2822, 2822, 2822, 2822, 2822, 1432, 585, 2822, 3762, -703, - 189, -703, -703, -703, -703, -703, -703, -703, 4704, 213, - -703, -20, -703, -703, 1983, 2722, 2722, -703, 1244, -703, - 2722, -703, -703, 62, -703, -703, -703, -703, 66, 48, - 959, -703, -703, -703, -703, -703, -703, 5378, 5378, -703, - 5378, 892, 5378, 160, -703, 5335, 225, 227, 233, 251, - 5378, 2255, 191, 269, 272, 5378, 5378, 263, 5263, 5378, - 5378, 2691, 5378, 5378, -703, 63, -703, -703, -703, 3269, - -703, -703, -703, -703, -703, -703, 2822, 4474, 2822, 2822, - 2822, 2822, 4474, 2822, 4474, 2822, 2822, 2822, -703, -703, - 278, 1244, 289, 1244, 1244, -703, 4474, 2822, 2822, 4474, - 4474, 1432, 2822, 2822, 79, 79, 79, 79, 79, -118, - -78, -69, -61, -41, -30, -18, -2, 2511, 2380, 2608, - 2625, 199, 309, -83, 3762, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, 1244, 310, 332, -703, -703, - 79, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, - 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, - 2822, 2822, 2252, 2822, -703, -703, 62, 2822, -703, -703, - -703, 2722, -703, -703, -703, -703, -703, 322, 145, 62, - 62, 145, 145, 4033, 321, -703, 324, -703, -703, -703, - -703, 1115, 342, 27, 64, 87, -703, -703, -703, 5378, - -703, -703, -703, 5378, -703, -703, -703, 5231, 2349, -703, - 1244, 1244, 1244, 1244, -703, -703, 363, -703, -703, -703, - -703, -703, 2822, 3300, -703, 346, -703, 3376, -703, 1244, - 115, -703, -703, 1244, 300, 348, -703, 2943, 349, 4546, - 1244, -703, 1244, 350, 148, 370, -703, -703, -703, -703, - 900, 959, -703, 344, 381, -703, 351, 378, 383, 384, - 385, 396, 388, 399, 392, 397, 398, 2822, -703, 2822, - -703, -703, 413, 406, 407, 409, 425, 416, 3483, 417, - 418, 2822, 2822, -703, -703, -24, 585, 935, 3983, 1311, - 1311, 117, 117, 729, 729, -703, 3672, 4123, 4039, 1275, - 117, 117, 167, 167, 79, 79, 79, -703, -703, -36, - 1126, -703, 3504, 145, 441, 145, 145, 145, 145, 145, - 364, -703, 321, -703, 321, -703, 364, 364, -703, 145, - 4603, 4452, 145, 145, 435, 37, -703, 623, -703, 2822, - 1244, 436, -703, -703, -703, -703, 1115, -703, 509, -703, - -703, -703, 458, 466, 467, 470, 477, 4839, -703, 3443, - 4236, 295, 464, 2943, 148, -703, -703, 481, -703, 4474, - 468, 485, 471, -703, 20, -703, -703, -703, 2822, 4704, - 403, -703, -703, 474, -703, -703, 1244, -9, -703, -703, - -703, 1553, -703, -703, 529, -703, 491, -703, -703, -703, - -703, -703, -703, -703, 479, -703, 480, -703, -703, -703, - 3522, 482, 483, -703, -703, -703, 486, -703, -703, -703, - -703, 79, 3762, -703, 4308, 932, -703, -703, 2822, -703, - -703, -703, 364, 145, 364, 364, 364, 364, 364, 2822, - -58, 4704, 623, -703, 26, 35, 572, -703, 4380, 492, - 623, 623, 623, 623, 623, 623, -21, -703, -703, 484, - 3762, -703, -34, -703, 510, 4895, -703, 511, -703, 4951, - -703, 631, 633, 634, 637, -703, -703, 355, 523, -703, - -703, 1244, 2467, 1244, 516, 530, -703, 623, -703, -703, - 20, -703, -703, 529, -703, 528, 512, 1244, 2014, 4308, - 522, 529, 4308, 529, 3540, 403, 533, 403, 403, 403, - 403, 403, 95, -703, -703, 5007, -703, 520, -703, 210, - -703, -71, 546, 547, 537, 548, 549, 2366, 3707, 550, - 529, 529, 3133, 529, 529, 529, 529, -703, 138, 308, - -703, 1115, 2822, 2822, -703, -703, 2822, 2822, 539, 4625, - -703, -703, -703, -703, 543, 564, -703, 3762, 364, 544, - 552, 623, -21, 555, 556, 932, -703, -703, 623, 557, - 557, 557, 557, 557, 265, 2822, 2822, -703, -703, 558, - -703, 2822, -703, 4125, 568, 574, -703, -703, -703, -23, - 577, 579, 584, 5063, 41, -703, 582, 623, 587, 5309, - 4236, 44, 529, -703, 308, -703, 5378, -703, -703, -703, - -703, -703, -703, -703, 601, 586, 611, -703, -703, 4682, - -703, -703, 612, 605, 615, -703, 609, 2822, 2822, 2822, - 2822, 1432, 2822, 610, 78, -703, -703, 3804, -703, 189, - -703, 613, 529, 367, 614, -703, 308, -703, 273, 403, - 618, 618, 618, 618, 618, -703, 2822, -703, 4308, -703, - 1867, -703, -703, 1244, 2822, 2822, -703, -703, -703, -703, - -703, 2366, 619, 638, 3762, -703, -703, 529, 301, 301, - 748, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, 622, 621, -703, - -703, 301, 301, 301, 373, 766, -703, 2822, -703, 1553, - 645, -703, 510, 17, 80, 98, 142, 572, 4682, 62, - 369, -703, -703, 4308, -21, -703, 4308, 4308, -703, 557, - 629, 3762, 627, 3726, 4743, 4759, 4798, 1244, 426, -703, - 1244, -703, -703, -703, 4125, 5119, 767, 650, 769, 772, - 773, -703, 657, 4474, 44, 4474, -703, -703, -703, -703, - 2936, -703, -703, -703, 308, 660, -703, -703, 4474, 4474, - 4474, 647, 4474, 4474, 4474, 1432, 79, 79, 79, 79, - 654, 144, 79, -703, -703, 2133, 2822, 2822, 2822, 2822, - 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2822, - 2822, 2822, 2822, 2822, 2822, 2822, 2822, 2480, 2822, 572, - 382, 661, 572, 674, -703, -703, 618, 4308, 656, 662, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, - -703, -703, -703, -703, -703, 659, -703, 663, 665, 667, - -703, 2594, 301, -703, -703, -703, -703, -703, 2014, 668, - 3707, 529, -703, -703, -703, -703, 932, 62, -703, -703, - 669, 670, 682, -703, 688, 689, 4308, -703, -703, 3147, - -703, 3147, -703, 3147, -703, -703, 3147, 3147, 3147, -703, - 5175, -703, -703, 154, -703, 175, 691, 176, -703, -703, - -703, -703, 694, 697, 705, 707, 699, 709, 2936, 2936, - 2936, 2936, 2936, 1432, 2936, 3935, -703, 720, -703, 529, - 706, 715, 717, 2822, 721, 719, 739, 730, 3575, 2822, - -703, -703, -703, 935, 3983, 1311, 1311, 117, 117, 729, - 729, -703, 3744, 4123, 4039, 1275, 117, 117, 167, 167, - 79, 79, 79, -703, -703, 196, 2034, 283, 733, -703, - 283, 529, 4308, 736, -703, 572, 1720, -703, -703, -703, - -703, 2366, 3762, 738, -703, -703, 753, -703, -703, -703, - 572, 572, 572, 741, -703, -703, -703, -703, -703, -703, - -703, 875, 760, 879, 764, 765, 884, 768, 4474, 4474, - 4474, 4474, 4474, 4474, 205, 205, 205, 205, 205, 749, - 198, 205, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, - 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, 2936, - 2936, 2708, 2822, 529, -703, -703, 771, 774, 751, 775, - -703, 777, -703, -703, 79, 2822, -703, -703, -703, 4308, - -703, 763, 572, 283, -703, 761, 572, -703, 932, 932, - 932, 572, 770, -703, 785, -703, -703, 200, -703, 795, - 781, 807, 809, 802, 813, 2936, -703, 1567, 3965, 3088, - 3088, 462, 462, 762, 762, -703, 3893, 2266, 4139, 4168, - 686, 686, 205, 205, 205, -703, -703, 201, 3164, -703, - 2822, 2822, -703, 2822, 2822, 3762, 4308, 812, 572, 283, - -703, 283, 816, -703, -703, -703, 283, 837, 903, 956, - 847, -703, 832, 833, 834, -703, 836, 205, 2936, -703, - -703, 206, 245, 247, 248, 835, 572, 283, -703, -703, - 838, 841, -703, 2822, 2822, 2822, 2822, 3935, -703, -703, - -703, -703, 572, 932, 854, 855, 256, 257, 258, 262, - 932, -703, -703, -703, -703, -703, -703, -703, -703 + 347, -868, 2997, 4826, 28, 3474, -868, -868, -868, -868, + -868, -868, -868, -868, -138, -102, -81, -45, -31, -27, + 9, 23, 52, -868, -868, 66, 89, 100, 114, 117, + 123, 131, 134, 144, 172, 199, 210, 213, 239, 243, + 252, 254, 266, 274, 5078, -868, -868, 60, 292, 293, + 7, 164, -868, 304, 305, 308, 2997, 2997, 2997, 2997, + 2997, 2040, 1052, 2997, 2753, -868, 185, -868, -868, -868, + -868, -868, -868, -868, -868, 4939, 310, -868, 27, -868, + -868, 1717, 4467, 4467, -868, 2604, 311, -868, 4467, -868, + -868, 16, 16, -868, -868, -868, -868, 334, 276, 464, + -868, -868, -868, -868, -868, -868, 5981, 5981, 5981, -868, + 5981, 3092, 5981, 152, -868, 5972, 317, 321, 329, 332, + 5981, 2208, 357, 358, 360, 5981, 5981, 336, 5884, 5981, + 5981, 2823, 5981, 5981, -868, 345, -868, -868, -868, 3672, + -868, -868, -868, -868, -868, 2997, 4826, 2997, 2997, 2997, + 2997, 4826, 2997, 4826, 2997, 4826, 2997, 4826, 4826, 4826, + 4826, 4826, 4826, 4826, 4826, 4826, 4826, 4826, 4826, 4826, + 4826, 4826, 2997, -868, -868, 353, 2604, 355, 370, 2604, + 2604, -868, 4826, 2997, 2997, 372, 4826, 4826, 2040, 2997, + 2997, 73, 73, 73, 73, 73, -138, -81, -45, -31, + -27, 23, 66, 100, 6011, 4837, 5211, 6044, 308, 373, + -93, 2753, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, 2604, 356, 374, -868, -868, 73, 2997, + 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, + 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, + 2337, 2997, -868, -868, 16, 16, 2997, -868, -868, -868, + 4467, -868, -868, -868, -868, 4826, -868, 379, 560, 354, + 16, 16, 354, 354, 4375, 377, -868, 378, -868, -868, + -868, -868, -868, -868, 3578, 400, -26, -10, 33, 130, + -868, -868, -868, 5981, -868, -868, -868, -868, 5981, -868, + -868, -868, 5858, 2295, -868, 2604, 2604, 2604, 2604, -868, + -868, 406, -868, -868, -868, -868, -868, 2997, 3763, -868, + 396, -868, 3803, -868, 2604, 83, -868, -868, 2604, 338, + 389, -868, 390, 4968, 2604, 391, -868, 2604, -6, 314, + 409, -868, -868, -868, -868, 2065, 464, -868, 394, 414, + -868, 397, 398, 399, 401, 403, 425, 404, 426, 419, + 428, 429, 430, 415, 432, -82, 452, 434, 436, 437, + 441, 442, 445, 446, 453, 455, 458, 466, 2997, -868, + 4826, 2997, -868, -868, 477, 468, 473, 2604, 475, 487, + 478, 3948, 481, 482, 2997, 2997, -868, -868, 486, 1052, + 1325, 4243, 3013, 3013, 1096, 1096, 579, 579, -868, 4038, + 1056, 4259, 3516, 1096, 1096, 233, 233, 73, 73, 73, + -868, -868, -79, 1807, -868, -868, 3966, 492, 354, 498, + 493, 2604, 354, 354, 354, 354, 354, 502, -868, 377, + -868, 377, -868, 502, 502, -868, 354, 4850, 4737, 354, + 354, 503, 31, -868, 821, 85, -868, 2997, 2604, 501, + -868, -868, -868, -868, 3578, -868, 595, -868, -868, -868, + 530, 531, 532, 534, 537, 5354, -868, 1433, 4571, 315, + 513, 314, -868, -868, 539, -868, 4826, 520, 546, 533, + -868, 4, 2997, 5164, 247, -868, 4826, -868, 541, -868, + -868, 2604, -22, -868, -868, -868, 2205, -868, -868, 371, + -868, 557, -868, -868, -868, -868, -868, -868, -868, 544, + -868, 545, -868, -868, -868, -868, 4826, -868, 4826, -868, + 4826, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, 3984, 529, 548, 547, -868, -868, 549, -868, + 552, -868, -868, -868, -868, 73, 2753, 4619, 3321, -868, + -868, 2997, -868, -868, -868, -868, 502, 354, -868, 502, + 502, 502, 502, 502, 2997, -68, 4939, 821, 85, -868, + 34, 75, -868, -868, 4708, 551, 821, 821, 821, 821, + 821, 821, -44, -868, -868, 553, 2604, 85, 85, 85, + 85, 85, 85, -18, 554, 2753, -868, -40, -868, 578, + 5426, -868, 581, -868, 5498, -868, 715, 716, 719, 720, + -868, -868, 405, 593, -868, -868, -868, -868, 3877, -868, + 590, 601, 2472, -868, 647, -868, -868, 4, -868, 371, + -868, 602, 583, 2604, 3129, 4619, 603, 371, 4619, 4002, + 247, 604, 247, 247, 247, 247, 247, 93, -868, -868, + 599, 5570, -868, 582, -868, 179, -868, -61, 613, 618, + 610, 620, 621, 2469, 2225, 624, 371, 371, 3605, 371, + 371, 371, 371, -868, 151, 351, -868, 3578, 2997, 2997, + 614, 619, 623, -868, -868, -868, 2997, -868, 2997, 631, + -868, 5054, -868, -868, -868, -868, -868, 622, -868, -868, + 638, -868, 2753, 502, 636, 635, 821, 85, -44, -18, + 641, 644, 3321, -868, -868, 821, 645, 645, 645, 645, + 645, 262, 2997, 2997, -868, -868, 85, -868, 648, 648, + 648, 648, 648, 275, 2997, -868, 649, -868, 2997, -868, + 5194, 672, 673, -868, -868, -868, -67, 676, 677, 681, + 5642, 15, -868, 647, 5944, 4571, 2604, 669, 666, 647, + 647, 647, 647, 647, 647, 39, 648, -868, 351, -868, + 5981, -868, -868, -868, -868, -868, -868, -868, 667, 675, + 682, -868, -868, 5078, -868, -868, 688, 10, 691, -868, + 683, 2997, 2997, 2997, 2997, 2040, 2997, 685, 36, -868, + -868, 4204, -868, 185, -868, 686, 371, 202, 689, -868, + 284, 247, 684, 684, 684, 684, 684, -868, 2997, -868, + -868, 4619, -868, 1873, -868, -868, 2604, 2997, 2997, -868, + -868, -868, -868, -868, 2469, 687, 701, 2753, -868, -868, + 371, 288, 288, 844, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + 692, 693, -868, -868, 288, 288, 288, 350, 854, -868, + 2997, -868, 2205, 718, -868, 578, -42, -12, -868, -868, + -868, 51, 58, -868, 5078, 16, 678, -868, -868, 4619, + -44, -18, -868, -868, 4619, 4619, -868, 645, 698, 2753, + 700, 648, 702, 703, 2489, 5245, 5264, 5278, 2604, 413, + -868, 2604, -868, 852, -868, 5194, 5714, 858, 725, 862, + 863, 864, -868, 729, 39, 648, -868, -868, -868, -868, + -868, 4826, 647, 3404, -868, -868, 735, -868, -868, 4826, + 4826, 4826, 723, 4826, 724, 4826, 4826, 2040, 73, 73, + 73, 73, 717, 82, 73, -868, -868, 3267, 2997, 2997, + 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, + 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2997, 2601, + 2997, -868, 367, 726, -868, -868, 684, 4619, 721, 727, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, + -868, -868, -868, -868, -868, -868, -868, -868, 728, -868, + 731, 733, 736, -868, 2733, 288, -868, -868, -868, -868, + -868, 3129, 732, 2225, 371, -868, -868, -868, -868, 3321, + 16, -868, -868, 11, 738, 740, -868, -868, 741, 742, + 4619, -868, 4619, -868, -868, 4456, -868, 4456, -868, 4456, + -868, -868, 4456, 4456, 4456, -868, -868, 5786, -868, -868, + 116, -868, 137, 751, 138, -868, -868, -868, 730, 737, + 763, 768, 24, 769, 3404, 3404, 3404, 3404, 3404, 2040, + 3404, 3685, -868, 371, 762, 773, 774, 2997, 775, 2604, + 766, 778, 770, 4020, 2997, -868, -868, -868, 1325, 4243, + 3013, 3013, 1096, 1096, 579, 579, -868, 4186, 1056, 4259, + 3516, 1096, 1096, 233, 233, 73, 73, 73, -868, -868, + 139, 3287, 2124, 771, -868, 2124, 4619, 772, -868, -868, + 1596, -868, -868, 867, -868, 2469, 2753, 780, -868, -868, + 794, -868, 783, -868, -868, -868, -868, -868, 784, 786, + -868, -868, -868, -868, -868, -868, -868, 942, 808, 946, + 814, 817, 954, 819, 4826, 4826, 4826, 4826, 804, 4826, + 4826, 87, 87, 87, 87, 87, 803, 146, 87, 3404, + 3404, 3404, 3404, 3404, 3404, 3404, 3404, 3404, 3404, 3404, + 3404, 3404, 3404, 3404, 3404, 3404, 3404, 3404, 2865, 2997, + -868, -868, 812, 813, 806, 815, 818, -868, 822, -868, + -868, 73, 2997, -868, -868, -868, 4619, 824, -868, 2124, + -868, -868, 816, -868, -868, -868, 3321, 3321, 3321, -868, + -868, 825, -868, 840, -868, -868, 155, -868, 829, 832, + 841, 842, 2604, 830, 845, 3404, -868, 3201, 4290, 1525, + 1525, 1338, 1338, 1374, 1374, -868, 4222, 4441, 4457, 4482, + 975, 975, 87, 87, 87, -868, -868, 171, 3927, 2997, + 2997, -868, 2997, -868, 2997, 2753, 4619, 837, -868, 2124, + -868, 2124, 838, -868, -868, -868, 2124, 2124, 856, 994, + 995, 860, -868, 849, 850, 853, 855, -868, 861, 87, + 3404, -868, -868, 214, 215, 223, 229, 868, -868, 2124, + -868, -868, 870, 872, -868, 2997, 2997, 2997, -868, 2997, + 3685, -868, -868, -868, -868, -868, 3321, 871, 874, 244, + 255, 257, 258, 3321, -868, -868, -868, -868, -868, -868, + -868, -868 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1203,172 +1267,187 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 680, 0, 0, 0, 680, 5, 592, 588, 591, - 676, 677, 594, 595, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 590, 596, 0, 0, 0, 0, 598, - 597, 0, 0, 0, 0, 0, 589, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 680, 0, 3, 532, - 593, 261, 269, 343, 344, 346, 347, 328, 0, 0, - 358, 325, 357, 352, 349, 348, 351, 329, 0, 330, - 350, 360, 345, 680, 4, 263, 264, 265, 0, 314, - 0, 260, 340, 341, 342, 1, 20, 680, 680, 21, - 680, 680, 680, 0, 37, 680, 0, 0, 0, 0, - 680, 0, 0, 0, 0, 680, 680, 0, 680, 680, - 680, 0, 680, 680, 6, 0, 16, 7, 18, 0, - 14, 58, 15, 17, 62, 39, 680, 0, 680, 680, - 680, 680, 0, 680, 0, 680, 680, 680, 282, 287, - 0, 0, 553, 0, 0, 281, 0, 680, 680, 0, - 0, 0, 680, 680, 562, 560, 559, 561, 558, 261, - 343, 344, 346, 347, 358, 357, 352, 349, 348, 351, - 350, 345, 0, 0, 493, 664, 665, 666, 669, 667, - 671, 670, 668, 672, 658, 657, 0, 655, 660, 654, - 557, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 733, 0, 0, 0, 733, 5, 624, 620, 623, + 729, 730, 626, 627, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 622, 628, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 678, 679, 680, 0, 326, 327, - 359, 349, 354, 353, 356, 262, 355, 0, 680, 680, - 680, 680, 680, 680, 0, 290, 248, 680, 673, 674, - 675, 0, 316, 664, 665, 667, 292, 266, 294, 680, - 50, 49, 51, 680, 40, 45, 22, 680, 0, 43, - 0, 0, 0, 0, 48, 680, 0, 25, 24, 23, - 46, 42, 0, 0, 146, 0, 52, 0, 19, 0, - 0, 44, 47, 0, 289, 271, 280, 0, 0, 0, - 0, 12, 0, 0, 0, 288, 63, 273, 274, 275, - 314, 0, 270, 0, 492, 491, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 283, 680, - 285, 284, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 587, 659, 680, 680, 571, 572, 573, - 574, 575, 576, 579, 580, 586, 0, 568, 569, 570, - 577, 578, 566, 567, 563, 564, 565, 585, 584, 0, - 0, 291, 0, 680, 0, 680, 680, 680, 680, 680, - 253, 240, 0, 249, 0, 250, 252, 251, 179, 680, - 0, 0, 680, 680, 0, 180, 183, 680, 178, 680, - 322, 0, 319, 318, 313, 317, 0, 680, 680, 41, - 38, 680, 0, 0, 0, 0, 0, 680, 331, 0, - 680, 289, 271, 0, 0, 288, 71, 0, 337, 0, - 0, 54, 56, 80, 82, 289, 271, 65, 0, 0, - 680, 272, 680, 0, 361, 196, 0, 0, 60, 361, - 201, 0, 61, 59, 0, 278, 316, 276, 538, 552, - 544, 540, 542, 543, 0, 550, 0, 549, 539, 546, - 0, 0, 0, 545, 548, 551, 0, 555, 556, 547, - 541, 533, 494, 96, 680, 680, 95, 656, 0, 583, - 582, 268, 254, 680, 245, 241, 242, 244, 243, 680, - 0, 0, 680, 217, 0, 0, 680, 182, 0, 0, - 680, 680, 680, 680, 680, 680, 680, 230, 229, 0, - 490, 489, 323, 312, 267, 680, 297, 680, 296, 680, - 333, 0, 0, 0, 0, 335, 680, 0, 0, 158, - 159, 0, 0, 0, 0, 148, 149, 680, 157, 147, - 0, 73, 75, 0, 339, 0, 0, 0, 680, 680, - 0, 0, 680, 0, 0, 680, 0, 680, 680, 680, - 680, 680, 0, 221, 220, 680, 84, 0, 680, 0, - 8, 0, 0, 0, 0, 0, 0, 680, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 64, 680, 680, - 160, 0, 0, 0, 286, 554, 0, 0, 0, 0, - 98, 100, 97, 99, 0, 0, 175, 581, 246, 0, - 0, 680, 680, 0, 0, 680, 181, 184, 680, 235, - 231, 232, 234, 233, 0, 0, 680, 214, 194, 255, - 320, 0, 293, 0, 0, 299, 298, 336, 680, 0, - 0, 0, 0, 680, 0, 36, 151, 680, 153, 680, - 0, 680, 0, 72, 680, 338, 680, 55, 647, 643, - 646, 649, 650, 186, 0, 0, 0, 645, 651, 0, - 653, 652, 0, 0, 0, 644, 0, 0, 0, 0, - 0, 0, 0, 0, 187, 218, 190, 219, 601, 648, - 185, 0, 0, 0, 0, 66, 680, 279, 0, 680, - 226, 222, 223, 225, 224, 90, 680, 13, 680, 197, - 362, 363, 361, 0, 680, 680, 199, 200, 202, 204, - 205, 680, 0, 208, 210, 207, 203, 0, 167, 163, - 0, 113, 114, 115, 116, 117, 118, 121, 122, 137, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 141, 140, 124, 123, 110, 112, 111, 119, - 120, 108, 109, 105, 106, 107, 104, 0, 0, 103, - 161, 164, 166, 165, 0, 0, 171, 680, 173, 0, - 0, 67, 277, 0, 0, 0, 0, 680, 0, 680, - 0, 361, 247, 680, 680, 215, 680, 680, 256, 236, - 239, 195, 0, 324, 671, 0, 670, 0, 0, 300, - 0, 302, 661, 680, 0, 680, 0, 0, 0, 0, - 0, 332, 0, 0, 680, 0, 142, 145, 143, 150, - 0, 155, 192, 74, 680, 0, 76, 53, 0, 0, - 0, 609, 0, 0, 0, 0, 617, 616, 615, 614, - 0, 0, 613, 57, 189, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 630, 629, 0, 0, 0, + 0, 0, 621, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 733, 0, 3, 563, 625, 282, 292, 291, + 370, 371, 373, 374, 355, 0, 0, 385, 352, 384, + 379, 376, 375, 378, 356, 0, 0, 357, 377, 387, + 372, 733, 733, 4, 284, 285, 286, 0, 341, 0, + 281, 367, 368, 369, 1, 21, 733, 733, 733, 22, + 733, 733, 733, 0, 38, 733, 0, 0, 0, 0, + 733, 0, 0, 0, 0, 733, 733, 0, 733, 733, + 733, 0, 733, 733, 6, 0, 17, 7, 19, 0, + 15, 16, 18, 65, 40, 733, 0, 733, 733, 733, + 733, 0, 733, 0, 733, 0, 733, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 680, - 0, 0, 680, 0, 69, 92, 227, 680, 0, 0, - 365, 366, 370, 367, 374, 368, 369, 371, 372, 373, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 440, 421, 422, 423, - 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, - 434, 435, 436, 437, 438, 439, 441, 442, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 680, 482, 483, 484, 475, 487, 471, 472, 470, - 477, 478, 466, 467, 468, 469, 476, 474, 481, 479, - 485, 480, 486, 473, 364, 0, 9, 0, 0, 0, - 206, 209, 168, 162, 139, 138, 170, 174, 680, 0, - 195, 0, 536, 535, 537, 534, 680, 680, 176, 101, - 0, 0, 0, 216, 0, 0, 680, 237, 321, 0, - 305, 0, 304, 0, 303, 663, 0, 0, 0, 662, - 680, 301, 334, 0, 26, 0, 0, 0, 35, 152, - 156, 154, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 193, 495, 0, 78, 0, - 0, 0, 0, 680, 0, 0, 0, 0, 0, 0, - 642, 188, 191, 626, 627, 628, 629, 630, 631, 634, - 635, 641, 0, 623, 624, 625, 632, 633, 621, 622, - 618, 619, 620, 640, 639, 0, 0, 81, 0, 86, - 83, 0, 680, 0, 228, 680, 0, 198, 11, 10, - 211, 680, 212, 0, 169, 68, 0, 177, 102, 599, - 680, 680, 680, 0, 311, 310, 309, 308, 307, 306, - 295, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 508, 506, 505, 507, 504, 0, - 0, 503, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 733, 306, 312, 0, 0, 0, 585, 0, + 0, 305, 0, 733, 733, 0, 0, 0, 0, 733, + 733, 594, 592, 591, 593, 590, 282, 370, 371, 373, + 374, 385, 384, 379, 376, 375, 378, 377, 372, 0, + 0, 523, 715, 716, 717, 718, 721, 719, 723, 722, + 720, 724, 708, 707, 0, 705, 710, 704, 589, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 608, 0, 0, 0, 0, - 607, 0, 611, 612, 602, 0, 638, 637, 88, 680, - 70, 0, 680, 85, 488, 0, 680, 361, 680, 680, - 680, 680, 0, 27, 0, 32, 34, 0, 29, 0, - 0, 0, 0, 0, 0, 0, 531, 517, 518, 519, - 520, 521, 522, 523, 524, 530, 0, 514, 515, 516, - 512, 513, 509, 510, 511, 529, 528, 0, 0, 79, - 0, 0, 610, 0, 0, 636, 680, 0, 680, 91, - 213, 172, 0, 259, 258, 257, 238, 0, 0, 0, - 0, 502, 0, 0, 0, 501, 0, 496, 0, 527, - 526, 0, 0, 0, 0, 0, 680, 93, 600, 28, - 0, 0, 30, 0, 0, 0, 0, 525, 605, 604, - 606, 603, 680, 680, 0, 0, 0, 0, 0, 0, - 680, 87, 33, 31, 499, 498, 500, 497, 89 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 731, 732, 733, 733, 0, 353, 354, 386, + 376, 381, 380, 383, 283, 0, 382, 0, 268, 733, + 733, 733, 733, 733, 733, 0, 315, 267, 317, 733, + 725, 726, 727, 728, 0, 343, 715, 716, 717, 719, + 319, 287, 321, 733, 52, 41, 51, 53, 733, 42, + 47, 23, 733, 0, 45, 0, 0, 0, 0, 50, + 733, 0, 26, 25, 24, 48, 44, 0, 0, 143, + 0, 54, 0, 20, 0, 0, 46, 49, 0, 314, + 294, 304, 0, 0, 0, 0, 13, 0, 0, 0, + 313, 60, 296, 297, 298, 341, 0, 293, 0, 522, + 521, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 307, + 0, 733, 309, 308, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 619, 709, 733, 733, + 603, 604, 605, 606, 607, 608, 611, 612, 618, 0, + 600, 601, 602, 609, 610, 598, 599, 595, 596, 597, + 617, 616, 0, 0, 316, 318, 0, 0, 733, 269, + 0, 258, 733, 733, 733, 733, 733, 274, 257, 0, + 270, 0, 271, 273, 272, 182, 733, 0, 0, 733, + 733, 0, 183, 186, 733, 0, 181, 733, 349, 0, + 346, 345, 340, 344, 0, 733, 733, 43, 39, 733, + 0, 0, 0, 0, 0, 733, 358, 0, 733, 314, + 294, 0, 313, 68, 0, 364, 0, 0, 56, 58, + 73, 75, 0, 0, 733, 295, 0, 733, 0, 388, + 199, 0, 0, 63, 388, 204, 0, 64, 62, 0, + 301, 343, 299, 569, 584, 575, 571, 573, 574, 0, + 581, 0, 580, 633, 570, 634, 0, 636, 0, 637, + 0, 640, 641, 642, 643, 644, 645, 646, 647, 648, + 649, 577, 0, 0, 0, 0, 576, 579, 0, 582, + 0, 587, 588, 578, 572, 564, 524, 733, 733, 88, + 706, 0, 615, 614, 289, 290, 275, 733, 259, 264, + 260, 261, 263, 262, 733, 0, 0, 733, 0, 223, + 0, 0, 733, 185, 0, 0, 733, 733, 733, 733, + 733, 733, 733, 236, 235, 0, 246, 0, 0, 0, + 0, 0, 0, 733, 0, 520, 519, 350, 339, 288, + 733, 324, 733, 323, 733, 360, 0, 0, 0, 0, + 362, 733, 0, 0, 160, 161, 162, 148, 0, 149, + 0, 145, 150, 146, 733, 159, 144, 0, 70, 0, + 366, 0, 0, 0, 733, 733, 0, 0, 733, 0, + 733, 0, 733, 733, 733, 733, 733, 0, 227, 226, + 0, 733, 77, 0, 733, 0, 8, 0, 0, 0, + 0, 0, 0, 733, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 61, 733, 733, 163, 0, 0, 0, + 0, 0, 0, 310, 311, 586, 0, 583, 0, 0, + 95, 0, 89, 92, 96, 91, 93, 0, 90, 94, + 0, 178, 613, 265, 0, 0, 733, 0, 733, 733, + 0, 0, 733, 184, 187, 733, 241, 237, 238, 240, + 239, 0, 0, 733, 217, 197, 0, 247, 252, 248, + 249, 251, 250, 0, 733, 220, 276, 347, 0, 320, + 0, 0, 326, 325, 363, 733, 0, 0, 0, 0, + 733, 0, 37, 733, 733, 0, 153, 151, 0, 733, + 733, 733, 733, 733, 733, 733, 157, 69, 733, 365, + 733, 57, 697, 693, 696, 699, 700, 189, 0, 0, + 0, 695, 701, 0, 703, 702, 0, 0, 0, 694, + 0, 0, 0, 0, 0, 0, 0, 0, 190, 224, + 193, 225, 650, 698, 188, 0, 0, 0, 0, 302, + 0, 733, 232, 228, 229, 231, 230, 83, 733, 303, + 14, 733, 200, 389, 390, 388, 0, 733, 733, 202, + 203, 205, 207, 208, 733, 0, 211, 213, 210, 206, + 0, 170, 166, 0, 110, 111, 112, 113, 114, 115, + 118, 119, 134, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 138, 137, 121, 120, 107, + 109, 108, 116, 117, 105, 106, 102, 103, 104, 101, + 0, 0, 100, 164, 167, 169, 168, 0, 0, 174, + 733, 176, 0, 0, 66, 300, 0, 0, 635, 638, + 639, 0, 0, 733, 0, 733, 0, 388, 266, 733, + 733, 733, 218, 221, 733, 733, 277, 242, 245, 198, + 0, 253, 256, 0, 351, 723, 0, 722, 0, 0, + 327, 0, 329, 711, 733, 0, 733, 0, 0, 0, + 0, 0, 359, 0, 733, 158, 139, 142, 140, 147, + 154, 0, 733, 0, 155, 195, 0, 71, 55, 0, + 0, 0, 659, 0, 0, 0, 0, 0, 667, 666, + 665, 664, 0, 0, 663, 59, 192, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 733, 0, 0, 733, 85, 233, 733, 0, 0, + 392, 393, 397, 394, 402, 395, 396, 398, 399, 400, + 401, 403, 404, 405, 406, 407, 408, 409, 410, 411, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, + 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, + 442, 443, 444, 445, 446, 447, 448, 468, 449, 450, + 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, + 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, + 492, 493, 494, 495, 733, 512, 513, 514, 505, 517, + 501, 502, 500, 507, 508, 496, 497, 498, 499, 506, + 504, 511, 509, 515, 510, 516, 503, 391, 0, 9, + 0, 0, 0, 209, 212, 171, 165, 136, 135, 173, + 177, 733, 0, 198, 0, 567, 566, 568, 565, 733, + 733, 179, 97, 0, 0, 0, 219, 222, 0, 0, + 733, 243, 733, 254, 348, 0, 332, 0, 331, 0, + 330, 713, 0, 0, 0, 712, 714, 733, 328, 361, + 0, 27, 0, 0, 0, 36, 156, 152, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 196, 525, 0, 0, 0, 0, 733, 0, 0, + 0, 0, 0, 0, 0, 692, 191, 194, 676, 677, + 678, 679, 680, 681, 684, 685, 691, 0, 673, 674, + 675, 682, 683, 671, 672, 668, 669, 670, 690, 689, + 0, 0, 74, 0, 79, 76, 733, 0, 234, 733, + 0, 201, 12, 10, 214, 733, 215, 0, 172, 67, + 0, 180, 0, 98, 631, 733, 733, 733, 0, 0, + 338, 337, 336, 335, 334, 333, 322, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 539, 537, 536, 538, 535, 0, 0, 534, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 72, 658, 0, 0, 0, 0, 0, 656, 0, 661, + 662, 651, 0, 688, 687, 81, 733, 0, 733, 78, + 518, 11, 0, 733, 388, 99, 733, 733, 733, 733, + 733, 0, 28, 0, 33, 35, 0, 30, 0, 0, + 0, 0, 0, 0, 0, 0, 562, 548, 549, 550, + 551, 552, 553, 554, 555, 561, 0, 545, 546, 547, + 543, 544, 540, 541, 542, 560, 559, 0, 0, 0, + 0, 660, 0, 657, 0, 686, 733, 0, 733, 84, + 216, 175, 0, 280, 279, 278, 244, 255, 0, 0, + 0, 0, 533, 0, 0, 0, 0, 531, 0, 526, + 0, 558, 557, 0, 0, 0, 0, 0, 733, 86, + 632, 29, 0, 0, 31, 0, 0, 0, 532, 0, + 556, 654, 653, 655, 652, 733, 733, 0, 0, 0, + 0, 0, 0, 733, 80, 34, 32, 529, 528, 530, + 527, 82 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -703, -703, -222, -703, 279, -703, -703, 734, -703, -703, - -11, 450, -703, -99, -703, -703, -703, -33, -132, -703, - -703, -703, -87, -197, -703, -703, -703, 731, -703, -703, - -703, -703, -703, -442, -703, -703, 358, -703, -703, -703, - 361, 489, -516, -703, -512, -559, -467, -703, -15, -703, - 190, -541, -703, -377, -702, -703, -380, 161, -309, -206, - 85, -191, -42, -95, -579, -227, 16, -104, -703, -89, - -703, -703, -703, -703, 203, -73, -703, -356, -703, -703, - -14, -7, -703, -703, -703, -703, 14, 51, -703, -703, - -437, -703, 24, -703, -472, -125, -27, -260, 531, 277, - -703, -703, 687, -703, -698, 803, 811, -514, -1 + -868, -868, -245, -868, 178, -868, -868, 722, -868, -868, + -53, 375, -868, -124, -868, -142, -868, -868, -192, -868, + -868, -868, 734, -868, -868, -868, -868, -868, -493, -868, + -868, 294, -868, -868, -868, -868, 273, 412, -553, -868, + -628, -666, -100, -868, -101, -868, 103, -511, -868, -466, + -838, -868, -445, 72, -540, -147, -442, 756, -54, -41, + -30, 739, -682, 746, 884, -104, -868, -97, -868, -868, + -868, -868, 124, -92, -868, -444, -868, -868, -14, 55, + -868, -868, -868, -868, -7, 5, -868, -868, -502, -868, + -51, -868, -538, -140, -60, 188, 107, 104, -868, -868, + 694, -868, -867, 634, 652, -617, -1 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 4, 5, 569, 570, 116, 432, 117, 118, 257, - 119, 420, 421, 120, 121, 444, 553, 587, 695, 278, - 543, 652, 653, 833, 293, 549, 552, 294, 708, 1219, - 1276, 887, 1132, 475, 770, 827, 122, 275, 534, 535, - 536, 537, 588, 1028, 589, 605, 384, 385, 683, 684, - 831, 627, 438, 442, 722, 723, 386, 686, 562, 506, - 234, 235, 73, 415, 142, 296, 74, 75, 397, 76, - 398, 517, 634, 635, 809, 77, 78, 394, 390, 391, - 79, 80, 123, 526, 638, 124, 81, 82, 83, 84, - 567, 568, 710, 1014, 509, 303, 304, 1085, 174, 49, - 687, 688, 186, 187, 811, 812, 590, 50, 125 + -1, 4, 5, 665, 666, 136, 497, 137, 138, 302, + 139, 487, 488, 140, 509, 683, 323, 639, 777, 338, + 645, 648, 339, 831, 1356, 1416, 1017, 1266, 558, 893, + 957, 141, 320, 630, 631, 632, 633, 634, 684, 1161, + 685, 710, 451, 452, 807, 808, 964, 734, 503, 507, + 845, 846, 453, 810, 657, 726, 738, 275, 276, 91, + 92, 340, 178, 341, 93, 94, 465, 95, 466, 612, + 751, 752, 940, 96, 97, 462, 458, 459, 98, 99, + 142, 621, 755, 143, 100, 101, 102, 103, 663, 664, + 833, 1147, 604, 348, 349, 1221, 211, 65, 811, 812, + 224, 225, 942, 943, 593, 66, 144 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1376,1372 +1455,1531 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 6, 493, 574, 307, 308, 309, 310, 598, 312, 274, - 314, 315, 316, 644, 143, 297, 216, 609, 173, 1019, - 789, 144, 323, 324, 295, 361, 126, 329, 330, 778, - 298, 654, 550, 473, 689, 693, 218, 542, 373, 375, - 514, 696, 145, 407, 332, 189, 299, 214, 780, 215, - 416, 497, 572, 573, 615, 714, 798, 85, 238, 239, - 427, 172, 127, 333, 728, 729, 128, 771, 772, 773, - 774, 795, 236, 715, 227, 129, 250, 251, 228, 252, - 254, 255, 691, 130, 259, 694, 219, 489, 610, 264, - 841, 332, 854, 630, 270, 271, 631, 273, 276, 277, - -673, 281, 282, 131, 816, 300, 1050, 1052, 1054, 625, - 479, 199, 301, 835, 133, 222, 223, 224, 617, 229, - 474, 226, 132, 817, 626, 305, 135, 305, 305, 305, - 305, 134, 305, 302, 305, 305, 305, -674, 197, 198, - 834, 240, 136, 306, 332, 137, 305, 305, 311, 199, - 313, 305, 305, -673, 802, 883, -673, 364, 146, 551, - -675, 365, 322, 1032, 498, 325, 326, 327, 685, 297, - 599, 489, 613, 297, 830, 515, 880, 241, 295, 519, - 489, 614, 230, 297, 298, 359, 541, 822, 298, 626, - -674, 387, 237, -674, 461, 214, 231, 215, 298, 199, - 299, 232, 366, 147, 299, 855, 233, 332, 283, 1037, - 565, 1022, 781, -675, 299, 236, -675, 148, 222, 223, - 224, 226, 211, 212, 213, 332, 1033, 371, 236, 236, - 371, 371, 388, 149, 888, 782, 392, 1190, 259, 705, - 706, 889, 399, 418, 1034, 419, 698, 430, 700, 701, - 702, 703, 704, 1043, 206, 207, 208, 209, 210, 300, - 211, 212, 213, 300, 6, 367, 301, 775, 150, 332, - 301, 332, 222, 300, 439, 1015, 440, 836, 441, 368, - 301, 1161, 776, 777, 369, 151, 612, 302, 1035, 256, - 1100, 302, 395, 1087, 619, 620, 621, 622, 623, 624, - 1162, 302, 1163, 1166, 643, 1029, 208, 209, 210, 297, - 211, 212, 213, 370, 372, 374, 376, 377, 305, 884, - 267, 1164, 1167, 332, 298, 332, 1042, 1289, 332, 1044, - 1045, 651, 152, 332, 476, 189, 712, 713, 492, 387, - 299, 689, 1216, 153, 1246, 1036, 1290, 1299, 1200, 1201, - 1202, 1154, 1318, 1155, 1041, 1156, 600, 217, 1157, 1158, - 1159, 10, 371, 11, 371, 371, 371, 371, 371, 260, - 601, 261, 332, 602, 332, 332, 603, 262, 371, 175, - 176, 371, 371, 332, 332, 332, 508, 555, 511, 332, - 886, 1319, 604, 1320, 1321, 263, 6, 518, 268, 300, - 6, 269, 1334, 1335, 1336, 794, 301, 272, 1337, 539, - 626, 800, 799, 238, 239, 556, 815, 885, 706, 557, - 1133, -94, 317, -94, 538, -94, -94, 302, -94, 564, - -94, 6, 387, 319, 439, 545, 440, 1127, 779, 1225, - 1130, 824, 177, 178, 423, 776, 777, 395, 482, 611, - 484, 485, 486, 487, 488, 331, 387, 1088, 335, 336, - 558, 363, 179, 180, 490, 181, 389, 494, 495, -240, - 182, 396, 183, 388, 606, 685, 434, 1146, 435, 436, - 437, 410, 371, 1188, 1189, 1, 2, 3, 511, 408, - 448, 508, 424, 428, 1190, 476, 240, 449, 443, 508, - 508, 508, 508, 508, 508, 628, 387, 387, 332, 489, - 387, 776, 777, 881, 689, 1039, 636, 776, 777, 1026, - 1056, 1057, 1058, 559, 450, 6, 776, 777, 1128, 451, - 452, 453, 454, 48, 455, 456, 508, 560, 457, 238, - 239, 579, 561, 458, 459, 580, 538, 690, 388, 462, - 826, 388, 463, 464, 564, 465, 564, 564, 564, 564, - 564, 466, 467, 469, 470, 783, 784, 711, 608, 785, - 786, 154, 155, 156, 157, 158, 725, 654, 190, 1153, - 483, 496, 516, 513, 520, 143, 581, 606, 628, 1017, - 1018, 1060, 144, 521, 522, 175, 176, 523, 1038, 1195, - 1196, 1197, 1198, 1199, 524, 1200, 1201, 1202, 540, 544, - 508, 628, 547, 145, 606, 548, 546, 508, 566, 696, - 591, 582, 240, 592, 593, 511, 810, 596, 595, 473, - 597, 618, 629, 238, 239, 499, -315, 6, 273, 500, - 633, 639, 395, 640, 641, 837, 508, 642, 685, 583, - 832, 645, 649, 628, 851, 143, 655, 650, 177, 178, - 656, 692, 144, 584, 538, 1221, 387, 709, 585, 1283, - 1284, 1285, 699, 586, 716, 717, 719, 720, 179, 180, - 501, 181, 328, 145, 718, 787, 182, 790, 183, 727, - 791, 834, 792, 1223, 813, 628, 793, 850, 564, 796, - 797, 814, 626, -247, 818, 511, 819, 388, 1228, 1229, - 1230, 820, 823, 305, 305, 184, 240, 825, 1190, 185, - 725, 839, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 502, 360, 838, 840, 842, 362, 843, - 844, 387, 1277, 845, 387, 387, 853, 503, 1023, 879, - 882, 199, 504, 706, 1331, 1021, 1020, 505, 1024, 1025, - 1027, 1338, 1031, 1046, 143, 1047, 511, 1063, 1064, 1065, - 1279, 144, 1066, 1067, 1281, 1068, 476, 1089, 236, 1286, - 1282, 1093, 388, 628, 1190, 388, 388, 810, 810, 810, - 1099, 1131, 145, 409, 1134, 1129, 1137, 810, 1135, 1305, - 1138, 1139, 6, 387, 1140, 1148, 1144, 1149, 1174, 1175, - 1176, 1177, 1178, 832, 1181, 1197, 1198, 1199, 1150, 1200, - 1201, 1202, 1169, 628, 1151, 1152, 1307, 1165, 1168, 1069, - 1170, 1071, 1171, 1172, 1173, 387, 1147, 1203, 460, 188, - 1125, 1206, 1205, 1207, 1090, 1091, 1092, 1209, 1094, 1095, - 1096, 1097, 471, 472, 1323, 1210, 206, 207, 208, 209, - 210, 225, 211, 212, 213, 1211, 1212, 1218, 476, 1227, - 1330, 476, 1222, 247, 1226, 1232, 388, 1231, 1233, 1234, - 242, 248, 1235, 1236, 1237, 1245, 1238, 1272, 253, 1195, - 1196, 1197, 1198, 1199, 266, 1200, 1201, 1202, 1280, 1278, - 243, 244, 1288, 1310, 280, 1270, 1287, 1292, 1271, 1273, - 510, 1274, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, - 1255, 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, - 1265, 1291, 87, 1293, 318, 1294, 320, 321, 1295, 1296, - 88, 192, 193, 194, 195, 196, 197, 198, 1306, 554, - 90, 91, 92, 1308, 599, 1309, 1311, 199, 1208, 243, - 244, 249, 578, 177, 178, 1312, 1313, 1314, 1315, 100, - 1316, 1322, 1332, 1333, 1324, 1297, 387, 1325, 334, 105, - 711, 400, 1016, 245, 180, 106, 181, 657, 1145, 1220, - 109, 182, 1204, 183, 387, 600, 1269, 828, 414, 607, - 112, 829, 113, 1143, 1070, 1136, 1102, 1061, 0, 601, - 510, 647, 602, 477, 0, 603, 0, 690, 0, 241, - 0, 0, 177, 178, 0, 606, 236, 115, 1317, 0, - 0, 604, 810, 0, 810, 388, 810, 0, 0, 810, - 810, 810, 245, 180, 0, 181, 1180, 0, 0, 0, - 182, 402, 183, 403, 404, 405, 406, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 0, 211, 212, - 213, 0, 417, 0, 0, 246, 422, 0, 0, 0, - 387, 0, 305, 431, 0, 433, 0, 0, 0, 1179, - 0, 0, 0, 445, 447, 0, 0, 1086, 724, 0, - 0, 446, 248, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 393, 0, 0, 0, - 0, 388, 0, 0, 476, 0, 0, 0, 0, 188, - 725, 191, 192, 193, 194, 195, 196, 197, 198, 476, - 476, 476, 0, 0, 0, 0, 801, 510, 199, 0, - 0, 0, 803, 0, 0, 0, 53, 0, 54, 55, - 56, 0, 0, 0, 1267, 0, 0, 387, 0, 0, - 0, 0, 0, 0, 1239, 1240, 1241, 1242, 1243, 1244, - 0, 0, 0, 512, 0, 63, 221, 0, 507, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 846, 847, - 848, 849, 0, 852, 0, 65, 66, 0, 388, 0, - 0, 476, 0, 0, 0, 476, 0, 606, 606, 606, - 476, 70, 0, 0, 387, 0, 72, 510, 0, 571, - 0, 563, 0, 1301, 1302, 0, 1303, 1304, 0, 0, - 0, 0, 724, 0, 175, 176, 0, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 0, 211, - 212, 213, 0, 0, 480, 388, 0, 476, 0, 0, - 0, 0, 0, 0, 0, 0, 1326, 1327, 1328, 1329, - 0, 0, 193, 194, 195, 196, 197, 198, 0, 0, - 0, 0, 0, 507, 0, 476, 0, 199, 510, 0, - 1030, 507, 507, 507, 507, 507, 507, 177, 178, 0, - 0, 476, 606, 0, 0, 0, 0, 0, 0, 606, - 195, 196, 197, 198, 646, 0, 648, 179, 180, 0, - 181, 0, 0, 199, 0, 182, 0, 183, 507, 0, - 422, 0, 0, 0, 0, 1086, 1086, 1086, 1086, 1086, - 0, 1086, 0, 0, 0, 0, 563, 0, 563, 563, - 563, 563, 563, 0, 0, 0, 1098, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1103, 1104, 1105, - 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, - 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 0, 1126, - 204, 205, 206, 207, 208, 209, 210, 0, 211, 212, - 213, 0, 507, 0, 0, 0, 0, 0, 0, 507, - 0, 0, 0, 0, 0, 7, 8, 9, 10, 0, - 11, 12, 13, 159, 0, 0, 204, 205, 206, 207, - 208, 209, 210, 0, 211, 212, 213, 0, 507, 1086, - 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, - 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 0, 15, - 52, 0, 0, 160, 0, 161, 162, 163, 57, 58, - 0, 20, 59, 0, 0, 164, 22, 0, 0, 61, - 0, 0, 0, 0, 23, 24, 165, 0, 0, 0, - 563, 0, 166, 167, 0, 0, 571, 0, 0, 0, - 0, 28, 1086, 29, 0, 30, 0, 0, 0, 0, - 31, 0, 168, 169, 34, 0, 0, 35, 67, 0, - 0, 0, 36, 0, 0, 37, 68, 69, 170, 0, - 0, 71, 1142, 171, 0, 0, 7, 8, 9, 10, - 0, 11, 12, 13, 14, 0, 40, 0, 0, 41, - 42, 43, 0, 0, 44, 1086, 45, 46, 0, 0, - 0, 47, 0, 1183, 1184, 1185, 1186, 1187, 1188, 1189, - 0, 0, 0, 1040, 0, 0, 0, 0, 0, 1190, - 15, 0, 0, 0, 16, 0, 17, 18, 19, 0, - 1055, 0, 20, 1059, 575, 576, 21, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 24, 25, 0, 0, - 1214, 0, 0, 26, 27, 0, 0, 0, 0, 0, - 0, 0, 28, 0, 29, 0, 30, 0, 0, 0, - 0, 31, 0, 32, 33, 34, 0, 0, 35, 0, - 0, 0, 0, 36, 0, 0, 37, 0, 0, 38, - 0, 0, 724, 0, 39, 0, 0, 0, 0, 577, - 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, - 41, 42, 43, 0, 0, 44, 0, 45, 46, 1192, - 1193, 1194, 47, 0, 1195, 1196, 1197, 1198, 1199, 0, - 1200, 1201, 1202, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 890, 891, 892, 893, 894, 895, 896, - 897, 898, 899, 1268, 900, 901, 902, 903, 904, 905, - 906, 907, 908, 909, 910, 0, 1275, 0, 0, 0, - 0, 0, 911, 912, 913, 914, 915, 916, 917, 918, - 919, 920, 921, 922, 923, 924, 925, 926, 927, 0, - 0, 928, 929, 930, 931, 932, 933, 934, 935, 936, - 937, 938, 939, 940, 941, 942, 0, 943, 0, 944, - 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, - 955, 956, 0, 0, 0, 0, 0, 957, 958, 959, - 0, 960, 961, 962, 963, 964, 965, 966, 967, 968, - 969, 970, 971, 972, 973, 974, 975, 0, 976, 977, - 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, - 988, 989, 990, 0, 0, 0, 991, 992, 993, 994, - 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, - 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1224, 1012, 1013, - 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, - 0, 900, 901, 902, 903, 904, 905, 906, 907, 908, - 909, 910, 0, 0, 0, 0, 0, 0, 0, 911, - 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, - 922, 923, 924, 925, 926, 927, 0, 0, 928, 929, - 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, - 940, 941, 942, 0, 943, 0, 944, 945, 946, 947, - 948, 949, 950, 951, 952, 953, 954, 955, 956, 0, - 0, 0, 0, 0, 957, 958, 959, 0, 960, 961, - 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, - 972, 973, 974, 975, 0, 976, 977, 978, 979, 980, - 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, - 0, 0, 0, 991, 992, 993, 994, 995, 996, 997, - 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, - 1008, 1009, 1010, 1011, 0, 1012, 1013, 658, 659, 660, - 10, 0, 11, 661, 662, 51, 0, 0, 663, 0, - 0, 0, 0, 0, 53, 0, 54, 55, 56, 0, - 0, 0, 0, 0, 0, 0, 220, 0, 0, 191, - 192, 193, 194, 195, 196, 197, 198, 0, 0, 0, - 0, 664, 52, 63, 221, 53, 199, 54, 55, 56, - 57, 380, 0, 665, 59, 0, 0, 60, 666, 0, - 0, 61, 0, 65, 66, 0, 667, 668, 62, 0, - 0, 0, 0, 0, 63, 64, 0, 0, 0, 70, - 0, 0, 0, 669, 72, 670, 0, 671, 0, 0, - 0, 381, 672, 0, 65, 66, 673, 0, 0, 674, - 67, 0, 0, 0, 675, 0, 0, 676, 68, 69, - 70, 0, 0, 71, 0, 72, 658, 659, 660, 10, - 0, 11, 661, 662, 51, 0, 0, 1101, 677, 0, - 0, 678, 679, 0, 0, 0, 680, 0, 681, 0, - 0, 0, 0, 682, 0, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 0, 211, 212, 213, - 664, 52, 1217, 0, 53, 0, 54, 55, 56, 57, - 380, 0, 665, 59, 0, 0, 60, 666, 0, 0, - 61, 0, 0, 0, 0, 667, 668, 62, 0, 0, - 0, 0, 0, 63, 64, 0, 0, 0, 0, 0, - 0, 0, 669, 0, 670, 0, 671, 0, 0, 0, - 381, 672, 0, 65, 66, 673, 0, 0, 674, 67, - 0, 0, 0, 675, 0, 0, 676, 68, 69, 70, - 0, 0, 71, 0, 72, 7, 8, 9, 10, 0, - 11, 12, 13, 14, 0, 175, 176, 677, 0, 0, - 678, 679, 0, 0, 0, 680, 0, 681, 0, 0, - 0, 0, 682, 1184, 1185, 1186, 1187, 1188, 1189, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1190, 15, - 0, 0, 0, 16, 0, 17, 18, 19, 0, 0, + 6, 210, 670, 579, 319, 761, 1152, 352, 353, 354, + 355, 778, 357, 603, 359, 638, 361, 646, 901, 915, + 609, 252, 185, 253, 145, 974, 1282, 813, 104, 267, + 179, 268, 377, 269, 254, 342, 714, 181, 278, 1308, + 668, 669, 343, 385, 386, 255, 583, 344, -725, 392, + 393, 986, 395, 294, 295, 296, 926, 297, 299, 300, + 146, 227, 304, 528, -726, 475, 395, 309, 1186, 1188, + 1190, 396, 315, 316, 270, 318, 321, 322, 947, 326, + 327, 147, 529, 837, 257, 562, 261, 262, 263, 722, + 277, 277, 745, 266, 817, 574, 715, 948, 595, 180, + 596, 838, 597, 395, 732, 747, 237, -727, 748, 64, + 820, 972, 822, 823, 824, 825, 826, 148, -725, 733, + 1327, -725, 1165, 851, 852, 345, 894, 895, 896, 897, + 732, 149, 347, 395, -726, 150, 719, -726, 499, 724, + 500, 501, 502, 598, 350, 744, 350, 350, 350, 350, + 258, 350, 1166, 350, 271, 350, 739, 740, 741, 742, + 743, 647, 151, 191, 192, 193, 194, 195, 272, 186, + 228, 350, 975, 273, 903, 1283, 584, -727, 274, 953, + -727, 987, 350, 350, 701, 152, 1309, 963, 350, 350, + 422, 252, 776, 253, 346, 930, 395, 574, 720, 809, + 424, 425, 733, 395, -728, 153, 933, 922, 923, 261, + 262, 263, 266, 182, 342, 1167, 440, 442, 342, 904, + 610, 343, 1168, 599, 614, 343, 344, 395, 154, 485, + 344, 486, 1170, 454, 249, 250, 251, 600, 574, 721, + 304, 544, 601, 905, 455, 467, 1235, 602, 1337, 1338, + 1339, 155, 661, 277, 277, 827, 828, 280, 281, 282, + 651, 1297, 156, 1012, 652, 261, 237, 966, 438, 277, + 277, 438, 438, 456, -728, 921, 157, -728, 460, 158, + 1298, 1016, 1299, 1302, 395, 159, 280, 281, 282, 463, + 1018, 395, 494, 160, 931, 391, 161, 1155, 898, 301, + 1430, 1300, 1303, 1353, 345, 653, 162, 592, 345, 6, + 1386, 347, 967, 899, 900, 347, 395, 187, 1290, 1431, + 1291, 955, 1292, 835, 836, 1293, 1294, 1295, 739, 740, + 741, 742, 743, 1148, 163, 1441, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 283, 423, 395, + 395, 164, 1162, 426, 899, 900, 1013, 430, 395, 431, + 813, 432, 165, 346, 395, 166, 760, 346, 1461, 1462, + 350, 280, 281, 282, 675, 654, 283, 1463, 676, 395, + 246, 247, 248, 1464, 249, 250, 251, 559, 227, 655, + 395, 167, 395, 395, 656, 168, 577, 454, 1477, 1176, + 1177, 10, 433, 11, 169, 1174, 170, 578, 455, 1478, + 1169, 1479, 1480, 284, 477, 733, 928, 438, 171, 677, + 718, 438, 438, 438, 438, 438, 172, 1362, 744, 932, + 727, 728, 729, 730, 731, 438, 1015, 828, 438, 438, + 899, 900, 650, 594, 183, 184, 606, 699, 504, -87, + 505, -87, 506, -87, 6, 613, 188, 189, 6, 463, + 190, 635, 256, 265, 286, 287, 288, 636, 279, 305, + 678, 283, -87, 306, -87, 542, -87, 775, 1, 2, + 3, 307, 434, 659, 308, 504, 6, 505, 317, 902, + 490, 555, 556, 1280, 312, 313, 435, 314, 328, 679, + 946, 436, 899, 900, 1159, 378, 454, 380, 1262, 399, + 931, 1265, 398, 680, 1192, 1193, 1194, 455, 681, 899, + 900, 1263, 381, 682, 387, 716, 428, 394, 215, 216, + 457, -257, 809, 454, 813, 815, 717, 464, 818, 478, + 476, 491, 492, 496, 455, 508, 456, 711, 513, 395, + 526, 514, 515, 516, 605, 517, 438, 518, 520, 920, + 212, 213, 214, 606, 289, 218, 594, 219, 927, 519, + 521, 559, 220, 522, 221, 594, 594, 594, 594, 594, + 594, 735, 523, 524, 525, 778, 527, 530, 531, 649, + 532, 533, 735, 454, 454, 534, 535, 454, 290, 536, + 537, 753, 237, 674, 455, 455, 954, 538, 455, 539, + 6, 635, 540, 727, 728, 729, 730, 731, 906, 907, + 541, 545, 546, 594, 215, 216, 911, 547, 912, 549, + 956, 550, 551, 814, 456, 553, 554, 456, 557, 659, + 567, 659, 659, 659, 659, 659, 565, 280, 281, 282, + 768, -259, 596, 834, 769, 574, 608, 582, 712, 611, + 217, 218, 848, 219, 615, 637, 616, 617, 220, 618, + 221, 605, 619, 711, 735, 640, 642, 179, 212, 213, + 214, 643, 463, 694, 181, 644, 226, 1150, 1151, 1197, + 1423, 1424, 1425, 662, 687, 770, 688, 689, 725, 696, + 736, 318, 695, 697, 698, 594, 809, 735, 735, 264, + 746, 711, -342, -258, 594, 756, 757, 968, 750, 758, + 759, 1019, 606, 291, 244, 245, 246, 247, 248, 762, + 249, 250, 251, 606, 764, 983, 765, 832, 779, 780, + 285, 292, 215, 216, 6, 311, 180, 283, 635, 839, + 816, 821, 594, 829, 840, 325, 842, 843, 594, 594, + 594, 594, 594, 594, 965, 841, 1359, 735, 908, 179, + 847, 850, 917, 909, 916, 771, 181, 910, 217, 218, + 454, 219, 1366, 1367, 1368, 913, 220, 919, 221, 772, + 1474, 455, 918, 924, 773, 941, 925, 1481, 733, 774, + 379, 744, -266, 382, 383, 927, 944, 961, 945, 1175, + 659, 949, 950, 962, 1178, 1179, 951, 606, 970, 969, + 456, 280, 281, 282, 585, 971, 350, 350, 586, 929, + 605, 973, 1172, 848, 976, 977, 1154, 828, 180, 985, + 1011, 605, 1153, 1014, 1156, 934, 1157, 397, 1160, 1158, + 1180, 1171, 1422, 1164, 1182, 1419, 1181, 1196, 1200, 1183, + 1421, 1201, 1202, 1203, 1204, 1205, 1426, 1427, 454, 587, + 1223, 1234, 1361, 454, 454, 1227, 1229, 1268, 1264, 455, + 1305, 1269, 1304, 1271, 455, 455, 1272, 1273, 1278, 606, + 179, 1274, 429, 1284, 1285, 1286, 1287, 181, 978, 979, + 980, 981, 559, 984, 277, 1301, 1306, 1267, 456, 735, + 735, 1307, 1310, 456, 456, 1449, 1341, 1342, 1343, 1345, + 1347, 283, 1348, 1355, 1349, 605, 1358, 470, 1364, 471, + 472, 473, 474, 6, 1363, 209, 454, 1365, 1369, 1260, + 1370, 847, 1371, 965, 1372, 1466, 1373, 455, 484, 588, + 1374, 594, 489, 1375, 1376, 1377, 1382, 1385, 495, 180, + 1411, 498, 1473, 589, 1409, 1410, 454, 1412, 590, 510, + 512, 1420, 1413, 591, 1414, 1429, 1433, 455, 1418, 1428, + 941, 941, 941, 1432, 1437, 1434, 1435, 511, 292, 1438, + 941, 1448, 1451, 1450, 1452, 1453, 1454, 605, 1327, 1163, + 559, 1455, 1456, 559, 1149, 1457, 456, 1475, 781, 1458, + 1476, 548, 1279, 1459, 468, 437, 439, 441, 443, 444, + 351, 1340, 1465, 226, 1467, 356, 1468, 358, 959, 360, + 763, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 481, 1206, 958, 1237, + 1277, 482, 212, 213, 214, 568, 384, 1222, 483, 1198, + 388, 389, 390, 1270, 231, 232, 233, 234, 235, 236, + 1288, 0, 1289, 0, 1233, 0, 0, 1344, 0, 237, + 0, 0, 607, 560, 0, 1238, 1239, 1240, 1241, 1242, + 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, + 1253, 1254, 1255, 1256, 1257, 1258, 1281, 1261, 235, 236, + 454, 0, 0, 834, 0, 0, 215, 216, 0, 237, + 0, 455, 1334, 1335, 1336, 667, 1337, 1338, 1339, 454, + 0, 454, 0, 0, 0, 0, 658, 0, 0, 427, + 455, 0, 455, 0, 0, 0, 0, 0, 0, 1317, + 814, 686, 217, 218, 0, 219, 1357, 0, 711, 277, + 220, 0, 221, 0, 0, 0, 0, 0, 0, 456, + 0, 456, 0, 0, 566, 0, 0, 0, 569, 570, + 571, 572, 573, 0, 0, 0, 0, 0, 0, 0, + 222, 0, 575, 0, 223, 580, 581, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 0, 249, 250, 251, + 0, 0, 0, 0, 0, 454, 350, 0, 0, 0, + 737, 0, 0, 0, 0, 0, 455, 0, 0, 0, + 941, 0, 941, 0, 941, 0, 0, 941, 941, 941, + 0, 244, 245, 246, 247, 248, 1417, 249, 250, 251, + 0, 1276, 0, 0, 543, 456, 767, 0, 559, 0, + 0, 0, 0, 0, 848, 0, 0, 489, 1407, 0, + 0, 0, 0, 0, 559, 559, 559, 0, 0, 0, + 0, 686, 0, 0, 0, 0, 0, 0, 0, 686, + 0, 0, 658, 0, 658, 658, 658, 658, 658, 0, + 0, 0, 0, 0, 0, 454, 1447, 0, 1222, 1222, + 1222, 1222, 1222, 713, 1222, 0, 455, 0, 686, 686, + 0, 686, 686, 686, 686, 0, 0, 0, 0, 0, + 0, 1351, 230, 231, 232, 233, 234, 235, 236, 1443, + 1444, 0, 1445, 0, 1446, 456, 0, 559, 237, 0, + 1325, 1326, 559, 0, 0, 711, 711, 711, 559, 559, + 641, 1327, 0, 0, 0, 454, 0, 0, 0, 0, + 660, 0, 847, 0, 0, 0, 455, 0, 0, 0, + 0, 0, 0, 0, 0, 1469, 1470, 1471, 0, 1472, + 960, 0, 1311, 1312, 1313, 1314, 1315, 1327, 1318, 0, + 690, 0, 691, 0, 692, 456, 0, 559, 0, 0, + 0, 0, 0, 1222, 1222, 1222, 1222, 1222, 1222, 1222, + 1222, 1222, 1222, 1222, 1222, 1222, 1222, 1222, 1222, 1222, + 1222, 1222, 0, 0, 0, 0, 1408, 559, 0, 229, + 230, 231, 232, 233, 234, 235, 236, 0, 0, 1415, + 0, 0, 0, 0, 559, 711, 237, 0, 686, 0, + 667, 0, 711, 658, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 0, 249, 250, 251, 1222, + 0, 0, 0, 1332, 1333, 1334, 1335, 1336, 0, 1337, + 1338, 1339, 686, 0, 0, 0, 0, 1387, 1388, 1389, + 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, + 1400, 1401, 1402, 1403, 1404, 1405, 0, 0, 0, 1332, + 1333, 1334, 1335, 1336, 0, 1337, 1338, 1339, 0, 0, + 0, 0, 0, 0, 1222, 1323, 1324, 1325, 1326, 0, + 1173, 0, 0, 0, 0, 0, 0, 0, 1327, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1191, 1439, 0, 1195, 0, 0, 622, 0, + 0, 0, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 0, 249, 250, 251, 623, 0, 1020, + 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, + 0, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, + 1040, 1041, 0, 0, 0, 0, 0, 0, 1460, 1042, + 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, + 1053, 1054, 1055, 1056, 1057, 1058, 0, 0, 1059, 1060, + 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, + 1071, 1072, 1073, 0, 1074, 0, 1075, 1076, 1077, 1078, + 1079, 1080, 1081, 1082, 1083, 0, 1084, 1085, 1086, 0, + 1332, 1333, 1334, 1335, 1336, 0, 1337, 1338, 1339, 982, + 0, 0, 0, 0, 1087, 0, 0, 0, 0, 0, + 1088, 1089, 1090, 0, 1091, 1092, 1093, 1094, 1095, 1096, + 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, + 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, + 1117, 1118, 1119, 1120, 1121, 1122, 1123, 0, 0, 0, + 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, + 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, + 1144, 1360, 1145, 1146, 0, 0, 0, 0, 0, 70, + 0, 71, 72, 73, 0, 0, 0, 0, 0, 0, + 0, 259, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 260, 686, 0, 0, 0, + 0, 0, 0, 229, 230, 231, 232, 233, 234, 235, + 236, 0, 0, 0, 82, 83, 0, 0, 0, 0, + 237, 0, 0, 0, 0, 1207, 0, 0, 0, 0, + 0, 88, 0, 1224, 1225, 1226, 90, 1228, 0, 1230, + 1231, 1232, 0, 1346, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 686, 1020, 1021, 1022, 1023, + 1024, 1025, 1026, 1027, 1028, 1029, 1030, 0, 1031, 1032, + 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 0, + 0, 0, 0, 0, 0, 0, 1042, 1043, 1044, 1045, + 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, + 1056, 1057, 1058, 0, 0, 1059, 1060, 1061, 1062, 1063, + 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, + 0, 1074, 0, 1075, 1076, 1077, 1078, 1079, 1080, 1081, + 1082, 1083, 0, 1084, 1085, 1086, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 0, 249, 250, + 251, 1087, 0, 563, 0, 0, 0, 1088, 1089, 1090, + 0, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, + 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, + 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, + 1120, 1121, 1122, 1123, 0, 0, 1436, 1124, 1125, 1126, + 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, + 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 0, 1145, + 1146, 0, 0, 7, 8, 9, 10, 0, 11, 12, + 13, 196, 68, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 286, 287, 288, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 69, + 0, 0, 197, 0, 198, 199, 200, 74, 75, 0, + 20, 76, 0, 1316, 201, 22, 0, 0, 78, 0, + 0, 0, 0, 23, 24, 202, 0, 0, 0, 26, + 0, 0, 203, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 204, 215, + 216, 700, 0, 0, 0, 0, 44, 0, 45, 0, + 46, 0, 0, 0, 0, 47, 0, 205, 206, 50, + 0, 0, 51, 84, 0, 0, 0, 52, 0, 0, + 53, 85, 86, 87, 207, 289, 218, 89, 219, 208, + 0, 0, 702, 220, 0, 221, 0, 0, 1378, 1379, + 1380, 1381, 56, 1383, 1384, 57, 58, 59, 703, 0, + 60, 0, 61, 62, 0, 0, 0, 63, 7, 8, + 9, 10, 284, 11, 12, 13, 14, 0, 212, 213, + 214, 0, 0, 0, 0, 0, 0, 0, 704, 0, + 0, 705, 0, 0, 706, 0, 0, 0, 0, 0, + 0, 229, 230, 231, 232, 233, 234, 235, 236, 0, + 707, 0, 0, 15, 0, 0, 0, 16, 237, 17, + 18, 19, 708, 0, 0, 20, 0, 671, 672, 21, + 22, 0, 0, 0, 0, 0, 709, 0, 23, 24, + 25, 0, 215, 216, 26, 0, 0, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 0, 212, 213, 214, 0, 0, + 0, 44, 0, 45, 0, 46, 0, 0, 217, 218, + 47, 219, 48, 49, 50, 0, 220, 51, 221, 0, + 0, 0, 52, 0, 0, 53, 0, 0, 0, 54, + 7, 8, 9, 10, 55, 11, 12, 13, 14, 673, + 0, 0, 310, 0, 0, 0, 0, 56, 0, 0, + 57, 58, 59, 0, 0, 60, 0, 61, 62, 215, + 216, 849, 63, 0, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 15, 249, 250, 251, 16, + 0, 17, 18, 19, 0, 0, 0, 20, 0, 0, + 0, 21, 22, 0, 0, 217, 218, 0, 219, 0, + 23, 24, 25, 220, 0, 221, 26, 0, 0, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 0, 0, 0, 469, + 0, 0, 0, 44, 0, 45, 0, 46, 0, 0, + 0, 0, 47, 0, 48, 49, 50, 0, 0, 51, + 0, 0, 0, 0, 52, 0, 0, 53, 0, 0, + 0, 54, 7, 8, 9, 10, 55, 11, 12, 13, + 14, 0, 212, 213, 214, 0, 0, 766, 0, 56, + 0, 0, 57, 58, 59, 0, 0, 60, 0, 61, + 62, 421, 0, 0, 63, 229, 230, 231, 232, 233, + 234, 235, 236, 0, 0, 0, 0, 15, 0, 0, + 0, 16, 237, 17, 18, 19, 0, 0, 0, 20, + 0, 0, 0, 21, 22, 0, 0, 0, 0, 0, + 0, 0, 23, 24, 25, 0, 215, 216, 26, 0, + 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 0, 0, + 0, 0, 0, 0, 0, 44, 0, 45, 0, 46, + 0, 0, 217, 218, 47, 219, 48, 49, 50, 0, + 220, 51, 221, 0, 0, 0, 52, 0, 0, 53, + 0, 0, 0, 54, 7, 8, 9, 10, 55, 11, + 12, 13, 14, 844, 212, 213, 214, 0, 0, 0, + 0, 56, 0, 0, 57, 58, 59, 0, 0, 60, + 0, 61, 62, 0, 1184, 0, 63, 0, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 15, + 249, 250, 251, 16, 0, 17, 18, 19, 0, 0, 0, 20, 0, 0, 0, 21, 22, 0, 0, 0, - 0, 0, 0, 0, 23, 24, 25, 0, 177, 178, - 0, 0, 26, 27, 0, 0, 0, 0, 0, 0, - 0, 28, 0, 29, 0, 30, 0, 0, 179, 180, - 31, 181, 32, 33, 34, 0, 182, 35, 183, 175, - 176, 0, 36, 0, 0, 37, 0, 0, 38, 7, - 8, 9, 10, 39, 11, 12, 13, 14, 0, 0, - 0, 265, 0, 0, 0, 0, 40, 0, 0, 41, - 42, 43, 0, 0, 44, 0, 45, 46, 358, 1193, - 1194, 47, 0, 1195, 1196, 1197, 1198, 1199, 0, 1200, - 1201, 1202, 0, 15, 0, 0, 0, 16, 0, 17, - 18, 19, 177, 178, 0, 20, 0, 0, 0, 21, - 22, 53, 0, 54, 55, 56, 0, 0, 23, 24, - 25, 0, 179, 180, 0, 181, 26, 27, 0, 0, - 182, 0, 183, 0, 0, 28, 0, 29, 0, 30, - 63, 221, 0, 0, 31, 0, 32, 33, 34, 0, - 0, 35, 0, 0, 0, 401, 36, 529, 530, 37, - 65, 66, 38, 7, 8, 9, 10, 39, 11, 12, - 13, 14, 721, 0, 0, 0, 70, 0, 0, 0, - 40, 72, 0, 41, 42, 43, 0, 0, 44, 0, - 45, 46, 0, 0, 0, 47, 0, 0, 53, 0, - 54, 55, 56, 0, 147, 0, 0, 15, 0, 0, - 60, 16, 0, 17, 18, 19, 0, 0, 0, 20, - 0, 62, 0, 21, 22, 0, 0, 63, 64, 0, - 0, 0, 23, 24, 25, 0, 0, 0, 0, 0, - 26, 27, 53, 0, 54, 55, 56, 65, 66, 28, - 0, 29, 0, 30, 220, 0, 0, 0, 31, 0, - 32, 33, 34, 70, 0, 35, 71, 0, 72, 0, - 36, 63, 221, 37, 0, 0, 38, 7, 8, 9, - 10, 39, 11, 12, 13, 14, 0, 0, 0, 0, - 0, 65, 66, 0, 40, 0, 0, 41, 42, 43, - 0, 0, 44, 0, 45, 46, 1124, 70, 0, 47, - 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 0, 0, 0, 16, 0, 17, 18, 19, - 0, 0, 0, 20, 0, 137, 0, 21, 22, 53, - 0, 54, 55, 56, 0, 0, 23, 24, 25, 0, - 0, 0, 0, 0, 26, 27, 53, 0, 54, 55, - 56, 0, 0, 28, 0, 29, 0, 30, 63, 221, - 0, 0, 31, 0, 32, 33, 34, 0, 0, 35, - 0, 175, 176, 0, 36, 63, 221, 37, 65, 66, - 38, 7, 8, 9, 10, 39, 11, 12, 13, 14, - 1141, 0, 0, 0, 70, 65, 66, 0, 40, 72, - 0, 41, 42, 43, 0, 0, 44, 0, 45, 46, - 0, 70, 0, 47, 0, 0, 72, 0, 0, 0, - 0, 0, 148, 0, 0, 15, 0, 0, 0, 16, - 0, 17, 18, 19, 177, 178, 0, 20, 0, 152, - 0, 21, 22, 53, 0, 54, 55, 56, 0, 279, - 23, 24, 25, 0, 179, 180, 0, 181, 26, 27, - 0, 0, 182, 0, 183, 0, 0, 28, 0, 29, - 0, 30, 63, 221, 0, 0, 31, 0, 32, 33, - 34, 0, 0, 35, 0, 0, 0, 0, 36, 0, - 0, 37, 65, 66, 38, 7, 8, 9, 10, 39, - 11, 12, 13, 14, 0, 0, 0, 0, 70, 0, - 0, 0, 40, 72, 0, 41, 42, 43, 0, 0, - 44, 0, 45, 46, 1266, 0, 0, 47, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 16, 0, 17, 18, 19, 0, 0, - 0, 20, 0, 0, 0, 21, 22, 0, 0, 0, - 0, 0, 0, 0, 23, 24, 25, 0, 0, 0, - 0, 0, 26, 27, 0, 0, 0, 0, 0, 0, - 0, 28, 0, 29, 0, 30, 0, 0, 0, 0, - 31, 0, 32, 33, 34, 0, 0, 35, 0, 0, - 0, 0, 36, 0, 0, 37, 0, 0, 38, 7, - 8, 9, 10, 39, 11, 12, 13, 0, 0, 0, - 0, 0, 0, 425, 426, 0, 40, 0, 0, 41, - 42, 43, 0, 0, 44, 0, 45, 46, 0, 0, - 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1072, 0, 0, 0, 0, 0, 0, - 0, 286, 0, 0, 53, 1073, 54, 55, 56, 57, - 1074, 0, 0, 288, 0, 0, 60, 0, 23, 24, - 61, 0, 0, 0, 0, 0, 0, 62, -2, 0, - 0, 0, 0, 63, 64, 0, 0, 29, 0, 30, - 0, 0, 0, 0, 1075, 0, 0, 0, 1076, 0, - 0, 1077, 0, 65, 66, 0, 36, 0, 0, 67, - 0, 0, 0, 0, 0, 0, 0, 290, 69, 70, - 0, 0, 71, 0, 72, 0, 0, 86, 87, 0, - 1078, 0, 0, 1079, 1080, 1081, 88, 0, 1082, 0, - 1083, 46, 0, 0, 89, 1084, 90, 91, 92, 93, - 0, 0, 0, 94, 0, 0, 0, 95, 0, 0, - 0, 96, 97, 98, 99, 100, 101, 1186, 1187, 1188, - 1189, 0, 102, 103, 104, 105, 0, 0, 0, 0, - 1190, 106, 107, 0, 0, 108, 109, 0, 0, 0, - 110, 0, 0, 0, 0, 111, 112, 0, 113, 730, - 0, 0, 0, 0, 0, 0, 114, 0, 731, 732, - 733, 734, 735, 736, 737, 738, 0, 175, 176, 0, - 0, 0, 0, 115, 0, 739, 0, 740, 741, 742, - 743, 744, 745, 746, 747, 748, 749, 750, 751, 191, - 192, 193, 194, 195, 196, 197, 198, 0, 0, 0, - 0, 0, 0, 0, 0, 752, 199, 0, 0, 0, - 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 24, 25, 0, 215, 216, + 26, 0, 0, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 0, 0, 0, 0, 0, 0, 0, 44, 0, 45, + 0, 46, 0, 0, 217, 218, 47, 219, 48, 49, + 50, 0, 220, 51, 221, 0, 0, 0, 52, 0, + 0, 53, 0, 0, 0, 54, 7, 8, 9, 10, + 55, 11, 12, 13, 14, 0, 0, 0, 0, 0, + 0, 0, 0, 56, 0, 0, 57, 58, 59, 0, + 0, 60, 0, 61, 62, 1259, 0, 0, 63, 229, + 230, 231, 232, 233, 234, 235, 236, 0, 0, 0, + 0, 15, 0, 0, 0, 16, 237, 17, 18, 19, + 0, 0, 0, 20, 0, 0, 0, 21, 22, 0, + 0, 0, 0, 0, 0, 0, 23, 24, 25, 0, + 0, 0, 26, 0, 0, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 0, 212, 213, 214, 0, 0, 0, 44, + 0, 45, 0, 46, 0, 0, 0, 0, 47, 0, + 48, 49, 50, 0, 0, 51, 0, 0, 0, 0, + 52, 0, 0, 53, 0, 0, 0, 54, 7, 8, + 9, 10, 55, 11, 12, 13, 14, 1275, 0, 0, + 0, 0, 0, 0, 0, 56, 0, 0, 57, 58, + 59, 0, 0, 60, 0, 61, 62, 215, 216, 0, + 63, 0, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 15, 249, 250, 251, 16, 0, 17, + 18, 19, 0, 0, 0, 20, 0, 0, 324, 21, + 22, 0, 0, 217, 218, 0, 219, 0, 23, 24, + 25, 220, 0, 221, 26, 0, 0, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 0, 0, 0, 0, 0, 0, + 0, 44, 0, 45, 0, 46, 0, 0, 0, 0, + 47, 0, 48, 49, 50, 0, 0, 51, 0, 0, + 0, 0, 52, 0, 0, 53, 0, 0, 0, 54, + 7, 8, 9, 10, 55, 11, 12, 13, 14, 0, + 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, + 57, 58, 59, 0, 0, 60, 0, 61, 62, 1406, + 0, 0, 63, 233, 234, 235, 236, 0, 0, 0, + 0, 0, 0, 0, 0, 15, 237, 0, 0, 16, + 0, 17, 18, 19, 0, 0, 0, 20, 0, 0, + 0, 21, 22, 0, 0, 0, 0, 0, 0, 0, + 23, 24, 25, 0, 0, 0, 26, 0, 0, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 0, 0, 298, 0, + 0, 0, 0, 44, 0, 45, 0, 46, 0, 0, + 0, 0, 47, 0, 48, 49, 50, 0, 0, 51, + 0, 0, 0, 0, 52, 0, 0, 53, 0, 0, + 0, 54, 782, 783, 784, 10, 55, 11, 785, 786, + 67, 68, 0, 106, 787, 0, 0, 0, 0, 56, + 107, 108, 57, 58, 59, 0, 0, 60, 0, 61, + 62, 110, 111, 112, 63, 0, 242, 243, 244, 245, + 246, 247, 248, 293, 249, 250, 251, 788, 69, 0, + 0, 70, 0, 71, 72, 73, 74, 447, 0, 789, + 76, 0, 0, 77, 790, 0, 120, 78, 0, 0, + 0, 0, 791, 792, 79, 0, 125, 0, 0, 0, + 0, 80, 126, 0, 0, 0, 0, 129, 1320, 1321, + 1322, 1323, 1324, 1325, 1326, 0, 0, 81, 132, 0, + 133, 0, 0, 0, 1327, 793, 0, 794, 0, 795, + 0, 0, 0, 448, 796, 0, 82, 83, 797, 0, + 0, 798, 84, 0, 0, 135, 799, 0, 0, 800, + 85, 86, 87, 88, 0, 0, 89, 0, 90, 0, + 782, 783, 784, 10, 0, 11, 785, 786, 67, 68, + 0, 801, 1236, 0, 802, 803, 0, 0, 0, 804, + 0, 805, 0, 0, 0, 0, 806, 0, 0, 0, + 0, 0, 0, 229, 230, 231, 232, 233, 234, 235, + 236, 0, 0, 0, 0, 788, 69, 0, 0, 70, + 237, 71, 72, 73, 74, 447, 0, 789, 76, 0, + 0, 77, 790, 0, 0, 78, 0, 0, 700, 0, + 791, 792, 79, 0, 0, 0, 0, 0, 0, 80, + 0, 1329, 1330, 1331, 701, 0, 1332, 1333, 1334, 1335, + 1336, 0, 1337, 1338, 1339, 81, 0, 0, 0, 0, + 0, 0, 0, 793, 0, 794, 0, 795, 0, 702, + 0, 448, 796, 0, 82, 83, 797, 0, 0, 798, + 84, 0, 0, 0, 799, 703, 0, 800, 85, 86, + 87, 88, 0, 0, 89, 0, 90, 7, 8, 9, + 10, 0, 11, 12, 13, 0, 0, 0, 0, 801, + 0, 0, 802, 803, 0, 704, 0, 804, 705, 805, + 0, 706, 0, 0, 806, 0, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 707, 249, 250, + 251, 0, 1208, 1354, 0, 0, 0, 0, 0, 708, + 0, 0, 0, 0, 1209, 0, 0, 0, 0, 1210, + 0, 0, 0, 709, -2, 0, 0, 23, 24, 0, + 0, 0, 0, 26, 0, 0, 0, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 45, 0, 46, 0, 0, 0, 0, 1211, + 0, 0, 0, 1212, 105, 106, 1213, 0, 0, 0, + 0, 52, 107, 108, 231, 232, 233, 234, 235, 236, + 0, 109, 0, 110, 111, 112, 113, 0, 0, 237, + 114, 0, 0, 0, 0, 115, 1214, 0, 0, 1215, + 1216, 1217, 0, 0, 1218, 0, 1219, 62, 0, 0, + 0, 1220, 0, 0, 116, 117, 118, 119, 120, 121, + 0, 0, 0, 0, 0, 122, 123, 124, 125, 461, + 0, 0, 0, 0, 126, 127, 0, 0, 128, 129, + 0, 0, 0, 130, 0, 0, 0, 0, 0, 131, + 132, 853, 133, 0, 0, 0, 0, 0, 0, 0, + 134, 854, 855, 856, 857, 858, 859, 860, 861, 0, + 70, 0, 71, 72, 73, 0, 0, 135, 862, 0, + 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, + 873, 874, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 0, 0, 875, 242, + 243, 244, 245, 246, 247, 248, 260, 249, 250, 251, + 0, 0, 329, 330, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, 83, 0, 0, 0, + 0, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, 0, + 0, 876, 88, 0, 0, 0, 0, 90, 1327, 0, + 0, 331, 0, 0, 70, 0, 71, 72, 73, 74, + 0, 0, 0, 332, 0, 0, 77, 0, 0, 0, + 78, 0, 0, 0, 0, 0, 0, 79, 0, 0, + 877, 0, 0, 878, 80, 879, 880, 881, 882, 883, + 884, 885, 886, 887, 888, 889, 0, 890, 891, 0, + 81, 0, 892, 329, 330, 0, 0, 0, 0, 0, + 0, 333, 0, 0, 0, 0, 0, 0, 0, 82, + 83, 0, 0, 0, 0, 84, 0, 0, 0, 0, + 0, 0, 0, 334, 335, 87, 88, 0, 0, 89, + 0, 90, 331, 479, 480, 70, 336, 71, 72, 73, + 74, 0, 0, 0, 332, 0, 0, 77, 0, 0, + 0, 78, 337, 0, 1328, 1329, 1330, 1331, 79, 0, + 1332, 1333, 1334, 1335, 1336, 80, 1337, 1338, 1339, 0, + 0, 0, 331, 0, 0, 70, 0, 71, 72, 73, + 74, 81, 0, 0, 332, 0, 0, 77, 0, 0, + 0, 78, 333, 0, 0, 0, 0, 0, 79, 0, + 82, 83, 0, 0, 0, 80, 84, 624, 625, 626, + 0, 0, 0, 0, 334, 335, 87, 88, 0, 0, + 89, 81, 90, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 333, 0, 0, 0, 0, 0, 0, 0, + 82, 83, 0, 337, 0, 0, 84, 0, 0, 70, + 0, 71, 72, 73, 334, 335, 87, 88, 0, 0, + 89, 77, 90, 229, 230, 231, 232, 233, 234, 235, + 236, 0, 79, 0, 0, 0, 0, 0, 0, 80, + 237, 0, 0, 337, 229, 230, 231, 232, 233, 234, + 235, 236, 0, 0, 0, 81, 0, 0, 0, 0, + 0, 237, 229, 230, 231, 232, 233, 234, 235, 236, + 0, 0, 0, 0, 82, 83, 0, 0, 0, 237, + 229, 230, 231, 232, 233, 234, 235, 236, 0, 0, + 0, 88, 0, 0, 89, 0, 90, 237, 229, 230, + 231, 232, 233, 234, 235, 236, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 237, 229, 230, 231, 232, + 233, 234, 235, 236, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 237, 229, 230, 231, 232, 233, 234, + 235, 236, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 237, 0, 0, 0, 0, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 0, 249, 250, + 251, 0, 0, 1442, 0, 0, 0, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 249, + 250, 251, 552, 0, 0, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 0, 249, 250, 251, + 564, 0, 0, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 0, 249, 250, 251, 693, 0, + 0, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 0, 249, 250, 251, 819, 0, 0, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 0, 249, 250, 251, 1350, 561, 0, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 249, + 250, 251, 229, 230, 231, 232, 233, 234, 235, 236, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 237, + 988, 989, 990, 991, 992, 993, 994, 995, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 996, 1319, 1320, + 1321, 1322, 1323, 1324, 1325, 1326, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1327, 0, 0, 0, 0, + 0, 231, 232, 233, 234, 235, 236, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 237, 231, 232, 233, + 234, 235, 236, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 237, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1321, 1322, + 1323, 1324, 1325, 1326, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1327, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1352, 0, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 0, 249, 250, 251, + 0, 0, 0, 997, 998, 999, 1000, 1001, 1002, 1003, + 1004, 1005, 1006, 1007, 0, 1008, 1009, 1010, 0, 1440, + 0, 1328, 1329, 1330, 1331, 0, 0, 1332, 1333, 1334, + 1335, 1336, 0, 1337, 1338, 1339, 67, 68, 0, 0, + 445, 0, 446, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 0, 249, 250, 251, 0, 0, 0, + 0, 241, 242, 243, 244, 245, 246, 247, 248, 0, + 249, 250, 251, 0, 69, 0, 0, 70, 0, 71, + 72, 73, 74, 447, 0, 0, 76, 0, 0, 77, + 1329, 1330, 1331, 78, 0, 1332, 1333, 1334, 1335, 1336, + 79, 1337, 1338, 1339, 0, 0, 0, 80, 0, 1321, + 1322, 1323, 1324, 1325, 1326, 0, 212, 213, 214, 0, + 0, 0, 0, 81, 1327, 1321, 1322, 1323, 1324, 1325, + 1326, 0, 0, 0, 0, 0, 0, 0, 0, 448, + 1327, 0, 82, 83, 0, 0, 0, 0, 84, 0, + 1321, 1322, 1323, 1324, 1325, 1326, 85, 86, 87, 88, + 0, 0, 89, 74, 90, 1327, 0, 0, 0, 70, + 0, 71, 72, 73, 0, 0, 0, 449, 0, 0, + 215, 216, 450, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 177, 178, 753, 0, 0, 1195, 1196, 1197, 1198, 1199, - 0, 1200, 1201, 1202, 0, 0, 0, 0, 0, 0, - 179, 180, 0, 181, 0, 0, 0, 0, 182, 0, - 183, 0, 0, 67, 0, 0, 0, 0, 0, 0, - 754, 807, 69, 755, 0, 756, 757, 758, 759, 760, - 761, 762, 763, 764, 765, 766, 0, 767, 768, 284, - 285, 0, 769, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 0, 211, 212, 213, - 284, 285, 1300, 0, 0, 0, 0, 286, 0, 0, - 53, 0, 54, 55, 56, 57, 287, 0, 0, 288, - 0, 0, 60, 0, 0, 0, 61, 0, 0, 0, - 0, 0, 0, 62, 0, 0, 0, 0, 286, 63, - 64, 53, 0, 54, 55, 56, 57, 287, 0, 0, - 288, 289, 0, 60, 0, 0, 0, 61, 0, 65, - 66, 0, 0, 0, 62, 67, 0, 0, 0, 0, - 63, 64, 0, 290, 69, 70, 411, 412, 71, 0, - 72, 0, 289, 0, 0, 291, 0, 0, 0, 0, - 65, 66, 0, 0, 0, 0, 67, 0, 0, 0, - 0, 292, 0, 0, 290, 69, 70, 0, 0, 71, - 0, 72, 0, 0, 286, 0, 0, 53, 0, 54, - 55, 56, 57, 413, 0, 0, 288, 0, 0, 60, - 0, 0, 292, 61, 0, 0, 0, 0, 0, 0, - 62, 0, 0, 0, 0, 0, 63, 64, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 0, 289, 0, - 0, 0, 0, 0, 0, 199, 65, 66, 0, 0, - 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, - 290, 69, 70, 0, 0, 71, 0, 72, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 199, 0, 0, 292, 191, - 192, 193, 194, 195, 196, 197, 198, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 199, 191, 192, 193, - 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 199, 191, 192, 193, 194, 195, - 196, 197, 198, 0, 0, 0, 0, 0, 0, 0, - 527, 0, 199, 0, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 0, 211, 212, 213, 528, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 199, 0, 0, - 0, 0, 0, 0, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 0, 211, 212, 213, 468, - 0, 0, 0, 0, 0, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 0, 211, 212, 213, - 481, 0, 0, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 0, 211, 212, 213, 594, 0, - 0, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 0, 211, 212, 213, 697, 191, 192, 193, - 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 199, 0, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 0, 211, 212, - 213, 1213, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 199, - 0, 191, 192, 193, 194, 195, 196, 197, 198, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 199, 191, - 192, 193, 194, 195, 196, 197, 198, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 199, 191, 192, 193, - 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 199, 0, 0, 0, 0, 0, - 0, 478, 0, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 0, 211, 212, 213, 0, 856, - 857, 858, 859, 860, 861, 862, 863, 0, 0, 0, - 0, 0, 0, 0, 0, 726, 864, 0, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 0, - 211, 212, 213, 1048, 0, 0, 0, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 0, 211, - 212, 213, 0, 1215, 0, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 0, 211, 212, 213, - 0, 0, 0, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 0, 211, 212, 213, 1182, 1183, - 1184, 1185, 1186, 1187, 1188, 1189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1190, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 865, 866, 867, 868, 869, - 870, 871, 872, 873, 874, 875, 0, 876, 877, 878, - 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1190, 0, 0, + 0, 0, 0, 0, 0, 260, 217, 218, 0, 219, + 0, 0, 0, 0, 220, 0, 221, 0, 0, 84, + 0, 624, 625, 626, 82, 83, 0, 938, 0, 87, + 0, 0, 1330, 1331, 0, 0, 1332, 1333, 1334, 1335, + 1336, 88, 1337, 1338, 1339, 0, 90, 0, 0, 1331, + 0, 0, 1332, 1333, 1334, 1335, 1336, 0, 1337, 1338, + 1339, 0, 0, 70, 0, 71, 72, 73, 627, 628, + 67, 68, 0, 0, 445, 77, 0, 1332, 1333, 1334, + 1335, 1336, 0, 1337, 1338, 1339, 79, 0, 0, 0, + 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 69, 81, + 0, 70, 0, 71, 72, 73, 74, 447, 0, 0, + 76, 0, 0, 77, 0, 0, 0, 78, 82, 83, + 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, + 0, 80, 629, 0, 0, 88, 0, 0, 89, 0, + 90, 0, 0, 0, 0, 0, 0, 81, 0, 67, + 68, 0, 0, 723, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 448, 0, 0, 82, 83, 0, 0, + 0, 0, 84, 0, 0, 0, 0, 0, 67, 68, + 85, 86, 87, 88, 0, 0, 89, 69, 90, 0, + 70, 0, 71, 72, 73, 74, 447, 0, 0, 76, + 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, + 0, 0, 0, 79, 0, 0, 69, 0, 0, 70, + 80, 71, 72, 73, 74, 447, 0, 0, 76, 0, + 0, 77, 0, 0, 0, 78, 81, 0, 0, 0, + 0, 0, 79, 0, 0, 0, 0, 0, 0, 80, + 0, 0, 448, 0, 0, 82, 83, 0, 0, 0, + 0, 84, 0, 0, 0, 81, 0, 67, 68, 85, + 86, 87, 88, 0, 0, 89, 0, 90, 0, 0, + 0, 448, 0, 0, 82, 83, 0, 0, 0, 0, + 84, 67, 68, 0, 0, 0, 0, 0, 85, 86, + 87, 88, 0, 0, 89, 69, 90, 0, 70, 0, + 71, 72, 73, 74, 75, 0, 0, 76, 0, 70, + 77, 71, 72, 73, 78, 0, 0, 0, 0, 69, + 0, 79, 70, 0, 71, 72, 73, 74, 80, 0, + 0, 76, 0, 0, 77, 0, 0, 0, 78, 80, + 0, 0, 0, 0, 81, 79, 0, 0, 0, 0, + 0, 0, 80, 0, 0, 260, 0, 0, 0, 0, + 0, 0, 0, 82, 83, 0, 0, 0, 81, 84, + 67, 68, 0, 0, 82, 83, 0, 85, 86, 87, + 88, 0, 0, 89, 576, 90, 0, 82, 83, 0, + 0, 88, 0, 84, 0, 0, 90, 0, 0, 67, + 0, 85, 86, 87, 88, 0, 0, 89, 69, 90, + 0, 70, 0, 71, 72, 73, 74, 0, 0, 183, + 76, 0, 0, 77, 0, 0, 0, 78, 0, 0, + 0, 0, 0, 0, 79, 0, 0, 69, 0, 0, + 70, 80, 71, 72, 73, 74, 493, 0, 0, 76, + 0, 0, 77, 0, 0, 0, 78, 81, 0, 0, + 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 82, 83, 0, 0, + 0, 0, 84, 0, 0, 173, 81, 0, 0, 0, + 85, 86, 87, 88, 0, 0, 89, 0, 90, 0, + 0, 0, 0, 0, 0, 82, 83, 0, 0, 173, + 0, 84, 0, 0, 0, 0, 0, 0, 0, 85, + 86, 87, 88, 174, 0, 89, 70, 90, 71, 72, + 73, 74, 914, 0, 0, 175, 0, 0, 77, 0, + 0, 0, 78, 0, 0, 0, 0, 174, 0, 79, + 70, 0, 71, 72, 73, 74, 80, 0, 0, 175, + 0, 0, 77, 0, 0, 0, 78, 0, 0, 0, + 0, 0, 81, 79, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 82, 83, 0, 0, 67, 81, 84, 0, 0, + 0, 0, 0, 0, 0, 176, 177, 87, 88, 0, + 0, 89, 0, 90, 0, 82, 83, 0, 0, 0, + 0, 84, 0, 0, 212, 213, 214, 0, 0, 176, + 177, 87, 88, 69, 0, 89, 70, 90, 71, 72, + 73, 74, 0, 0, 0, 76, 0, 0, 77, 0, + 0, 0, 78, 0, 0, 0, 0, 0, 0, 79, + 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, + 0, 74, 0, 0, 0, 212, 213, 214, 0, 0, + 0, 0, 81, 70, 0, 71, 72, 73, 215, 216, + 0, 0, 0, 0, 212, 213, 214, 0, 0, 0, + 0, 82, 83, 0, 0, 0, 0, 84, 212, 213, + 214, 0, 0, 80, 0, 85, 86, 87, 88, 0, + 0, 89, 74, 90, 217, 935, 936, 937, 0, 260, + 0, 0, 220, 0, 221, 0, 0, 84, 0, 215, + 216, 74, 0, 0, 0, 938, 0, 87, 82, 83, + 939, 0, 0, 0, 0, 74, 0, 0, 215, 216, + 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, + 90, 0, 215, 216, 0, 217, 218, 0, 219, 0, + 0, 0, 0, 220, 0, 221, 0, 0, 84, 0, + 0, 0, 0, 184, 217, 218, 938, 219, 87, 0, + 0, 1185, 220, 0, 221, 0, 0, 84, 217, 218, + 0, 219, 0, 0, 0, 938, 220, 87, 221, 0, + 1187, 84, 0, 0, 105, 106, 0, 0, 0, 938, + 0, 87, 107, 108, 1189, 0, 0, 0, 0, 0, + 0, 109, 0, 110, 111, 112, 113, 0, 0, 0, + 114, 0, 0, 0, 0, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1184, 1185, 1186, 1187, 1188, 1189, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1190, 0, 0, - 193, 194, 195, 196, 197, 198, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 199, 0, 0, 0, 0, - 0, 0, 1298, 0, 1191, 1192, 1193, 1194, 0, 0, - 1195, 1196, 1197, 1198, 1199, 0, 1200, 1201, 1202, 0, - 0, 0, 0, 0, 51, 0, 0, 378, 0, 379, - 0, 0, 0, 0, 0, 0, 193, 194, 195, 196, - 197, 198, 0, 0, 0, 0, 1191, 1192, 1193, 1194, - 0, 199, 1195, 1196, 1197, 1198, 1199, 0, 1200, 1201, - 1202, 52, 0, 0, 53, 0, 54, 55, 56, 57, - 380, 0, 0, 59, 0, 0, 60, 1192, 1193, 1194, - 61, 0, 1195, 1196, 1197, 1198, 1199, 62, 1200, 1201, - 1202, 0, 0, 63, 64, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 0, 211, 212, 213, 0, - 381, 0, 0, 65, 66, 175, 176, 0, 0, 67, - 193, 194, 195, 196, 197, 198, 0, 68, 69, 70, - 0, 0, 71, 0, 72, 199, 1184, 1185, 1186, 1187, - 1188, 1189, 0, 0, 0, 0, 0, 382, 0, 0, - 0, 1190, 383, 203, 204, 205, 206, 207, 208, 209, - 210, 57, 211, 212, 213, 1184, 1185, 1186, 1187, 1188, - 1189, 0, 0, 0, 0, 0, 0, 0, 177, 178, - 1190, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 179, 804, - 805, 806, 0, 0, 0, 0, 182, 0, 183, 0, - 0, 67, 0, 0, 0, 0, 0, 0, 0, 807, - 69, 0, 0, 808, 0, 0, 529, 530, 0, 0, - 0, 0, 0, 0, 0, 0, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 0, 211, 212, 213, 0, - 0, 0, 0, 1194, 0, 0, 1195, 1196, 1197, 1198, - 1199, 0, 1200, 1201, 1202, 0, 0, 53, 0, 54, - 55, 56, 531, 532, 0, 0, 0, 0, 0, 60, - 0, 0, 0, 0, 0, 1195, 1196, 1197, 1198, 1199, - 62, 1200, 1201, 1202, 0, 0, 63, 64, 0, 51, - 0, 0, 378, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 65, 66, 0, 0, + 0, 0, 0, 0, 116, 117, 118, 119, 120, 121, + 0, 0, 0, 0, 0, 122, 123, 124, 125, 0, + 0, 0, 0, 0, 126, 127, 105, 106, 128, 129, + 0, 0, 0, 130, 107, 108, 0, 0, 0, 131, + 132, 0, 133, 109, 0, 110, 111, 112, 113, 0, + 134, 0, 114, 0, 0, 0, 0, 115, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 135, 0, 620, + 0, 0, 0, 0, 0, 0, 116, 117, 118, 119, + 120, 121, 0, 0, 0, 0, 0, 122, 123, 124, + 125, 0, 0, 0, 0, 0, 126, 127, 105, 106, + 128, 129, 0, 0, 0, 130, 107, 108, 0, 0, + 0, 131, 132, 0, 133, 109, 0, 110, 111, 112, + 113, 0, 134, 0, 114, 0, 0, 0, 0, 115, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 135, + 0, 749, 0, 0, 0, 0, 0, 0, 116, 117, + 118, 119, 120, 121, 0, 0, 0, 0, 0, 122, + 123, 124, 125, 0, 0, 0, 0, 0, 126, 127, + 105, 106, 128, 129, 0, 0, 0, 130, 107, 108, + 0, 0, 0, 131, 132, 0, 133, 109, 0, 110, + 111, 112, 113, 0, 134, 0, 114, 0, 0, 0, + 0, 115, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 135, 0, 754, 0, 0, 0, 0, 0, 0, + 116, 117, 118, 119, 120, 121, 0, 0, 0, 0, + 0, 122, 123, 124, 125, 0, 0, 0, 0, 0, + 126, 127, 105, 106, 128, 129, 0, 0, 0, 130, + 107, 108, 0, 0, 0, 131, 132, 0, 133, 109, + 0, 110, 111, 112, 113, 0, 134, 0, 114, 0, + 0, 0, 0, 115, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 135, 0, 830, 0, 0, 0, 0, + 0, 0, 116, 117, 118, 119, 120, 121, 0, 0, + 0, 0, 0, 122, 123, 124, 125, 0, 0, 0, + 0, 0, 126, 127, 105, 106, 128, 129, 0, 0, + 0, 130, 107, 108, 0, 0, 0, 131, 132, 0, + 133, 109, 0, 110, 111, 112, 113, 0, 134, 0, + 114, 0, 0, 0, 0, 115, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 135, 0, 952, 0, 0, + 0, 0, 0, 0, 116, 117, 118, 119, 120, 121, + 0, 0, 0, 0, 0, 122, 123, 124, 125, 0, + 0, 0, 0, 0, 126, 127, 105, 106, 128, 129, + 0, 0, 0, 130, 107, 108, 0, 0, 0, 131, + 132, 0, 133, 109, 0, 110, 111, 112, 113, 0, + 134, 0, 114, 0, 0, 0, 0, 115, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 135, 0, 1199, + 0, 0, 0, 0, 0, 0, 116, 117, 118, 119, + 120, 121, 0, 0, 0, 0, 0, 122, 123, 124, + 125, 0, 0, 0, 0, 0, 126, 127, 105, 106, + 128, 129, 0, 0, 0, 130, 107, 108, 0, 0, + 0, 131, 132, 0, 133, 109, 0, 110, 111, 112, + 113, 0, 134, 0, 114, 106, 0, 0, 0, 115, + 0, 0, 107, 108, 0, 0, 0, 0, 0, 135, + 0, 1296, 0, 110, 111, 112, 0, 0, 116, 117, + 118, 119, 120, 121, 0, 293, 0, 0, 0, 122, + 123, 124, 125, 0, 0, 0, 0, 0, 126, 127, + 0, 0, 128, 129, 0, 0, 0, 130, 120, 0, + 0, 0, 0, 131, 132, 106, 133, 0, 125, 0, + 0, 0, 107, 108, 126, 0, 0, 0, 0, 129, + 0, 0, 0, 110, 111, 112, 0, 0, 0, 131, + 132, 135, 133, 106, 0, 293, 0, 0, 0, 0, + 107, 108, 106, 0, 0, 0, 0, -141, 0, 107, + 108, 110, 111, 112, 0, 0, 0, 135, 120, 0, + 110, 111, 112, 293, 0, 0, 0, 0, 125, 0, + 0, 0, 293, 70, 126, 71, 72, 73, 128, 129, + 0, 0, 0, 0, 0, 259, 120, 303, 0, 131, + 132, 0, 133, 0, 0, 120, 125, 0, 0, 0, + 0, 0, 126, 80, 0, 125, 70, 129, 71, 72, + 73, 126, 0, 0, 0, 0, 129, 135, 132, 260, + 133, 0, 0, 0, 0, 0, 0, 132, 0, 133, + 0, 0, 0, 0, 0, 0, 80, 0, 82, 83, + 0, 0, 0, 0, 0, 135, 0, 0, 0, 0, + 0, 0, 260, 0, 135, 88, 0, 0, 0, 0, + 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 82, 83, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 172, 0, 0, 0, 0, 88, 0, + 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 533, 0, 70, 0, 0, 71, 52, 72, 0, 53, - 0, 54, 55, 56, 57, 380, 0, 0, 59, 0, - 0, 60, 0, 0, 0, 61, 0, 0, 0, 0, - 0, 0, 62, 0, 0, 0, 0, 0, 63, 64, - 0, 51, 0, 0, 616, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 381, 0, 0, 65, 66, - 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, - 0, 0, 68, 69, 70, 0, 0, 71, 52, 72, - 0, 53, 0, 54, 55, 56, 57, 380, 0, 0, - 59, 0, 0, 60, 0, 0, 0, 61, 0, 0, - 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, - 63, 64, 0, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 381, 0, 0, - 65, 66, 0, 0, 0, 51, 67, 0, 0, 0, - 0, 0, 0, 0, 68, 69, 70, 0, 0, 71, - 52, 72, 0, 53, 0, 54, 55, 56, 57, 380, - 0, 0, 59, 0, 0, 60, 0, 0, 0, 61, - 0, 0, 52, 0, 0, 53, 62, 54, 55, 56, - 57, 58, 63, 64, 59, 0, 0, 60, 0, 0, - 0, 61, 0, 0, 0, 0, 0, 0, 62, 381, - 0, 0, 65, 66, 63, 64, 0, 51, 67, 0, - 0, 0, 0, 0, 0, 0, 68, 69, 70, 0, - 0, 71, 0, 72, 65, 66, 0, 0, 0, 0, - 67, 0, 0, 0, 0, 0, 0, 0, 68, 69, - 70, 0, 0, 71, 52, 72, 0, 53, 0, 54, - 55, 56, 57, 429, 0, 0, 59, 0, 0, 60, - 0, 0, 0, 61, 51, 0, 0, 0, 0, 0, - 62, 0, 0, 0, 0, 0, 63, 64, 0, 0, - 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 65, 66, 0, 0, - 0, 52, 67, 0, 53, 0, 54, 55, 56, 57, - 68, 69, 70, 59, 0, 71, 60, 72, 0, 0, - 61, 0, 0, 139, 0, 0, 53, 62, 54, 55, - 56, 57, 788, 63, 64, 140, 0, 0, 60, 0, - 0, 0, 61, 138, 0, 0, 0, 0, 0, 62, - 491, 0, 0, 65, 66, 63, 64, 0, 0, 67, - 0, 0, 0, 0, 0, 51, 0, 68, 69, 70, - 0, 0, 71, 0, 72, 65, 66, 0, 0, 0, - 139, 67, 0, 53, 0, 54, 55, 56, 57, 141, - 69, 70, 140, 0, 71, 60, 72, 0, 0, 61, - 0, 0, 52, 175, 176, 53, 62, 54, 55, 56, - 57, 0, 63, 64, 59, 0, 0, 60, 0, 175, - 176, 61, 0, 0, 0, 0, 0, 0, 62, 0, - 0, 0, 65, 66, 63, 64, 0, 0, 67, 0, - 0, 0, 0, 0, 0, 0, 141, 69, 70, 57, - 0, 71, 0, 72, 65, 66, 0, 0, 175, 176, - 67, 0, 0, 0, 0, 57, 177, 178, 68, 69, - 70, 0, 0, 71, 0, 72, 0, 0, 0, 0, - 0, 0, 177, 178, 0, 0, 179, 180, 0, 181, - 0, 0, 0, 0, 182, 0, 183, 0, 0, 67, - 0, 0, 179, 180, 57, 181, 0, 807, 69, 0, - 182, 1049, 183, 0, 0, 67, 0, 0, 0, 0, - 0, 177, 178, 807, 69, 0, 0, 1051, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 86, 87, - 0, 179, 180, 0, 181, 0, 0, 88, 0, 182, - 0, 183, 0, 0, 67, 89, 0, 90, 91, 92, - 93, 0, 807, 69, 94, 0, 1053, 0, 95, 0, - 0, 0, 96, 97, 98, 99, 100, 101, 0, 0, - 0, 0, 0, 102, 103, 104, 105, 0, 0, 0, - 0, 0, 106, 107, 86, 87, 108, 109, 0, 0, - 0, 110, 0, 88, 0, 0, 111, 112, 0, 113, - 0, 89, 0, 90, 91, 92, 93, 114, 0, 0, - 94, 0, 0, 0, 95, 0, 0, 0, 96, 97, - 98, 99, 100, 101, 115, 0, 525, 0, 0, 102, - 103, 104, 105, 0, 0, 0, 0, 0, 106, 107, - 86, 87, 108, 109, 0, 0, 0, 110, 0, 88, - 0, 0, 111, 112, 0, 113, 0, 89, 0, 90, - 91, 92, 93, 114, 0, 0, 94, 0, 0, 0, - 95, 0, 0, 0, 96, 97, 98, 99, 100, 101, - 115, 0, 632, 0, 0, 102, 103, 104, 105, 0, - 0, 0, 0, 0, 106, 107, 86, 87, 108, 109, - 0, 0, 0, 110, 0, 88, 0, 0, 111, 112, - 0, 113, 0, 89, 0, 90, 91, 92, 93, 114, - 0, 0, 94, 0, 0, 0, 95, 0, 0, 0, - 96, 97, 98, 99, 100, 101, 115, 0, 637, 0, - 0, 102, 103, 104, 105, 0, 0, 0, 0, 0, - 106, 107, 86, 87, 108, 109, 0, 0, 0, 110, - 0, 88, 0, 0, 111, 112, 0, 113, 0, 89, - 0, 90, 91, 92, 93, 114, 0, 0, 94, 0, - 0, 0, 95, 0, 0, 0, 96, 97, 98, 99, - 100, 101, 115, 0, 707, 0, 0, 102, 103, 104, - 105, 0, 0, 0, 0, 0, 106, 107, 86, 87, - 108, 109, 0, 0, 0, 110, 0, 88, 0, 0, - 111, 112, 0, 113, 0, 89, 0, 90, 91, 92, - 93, 114, 0, 0, 94, 0, 0, 0, 95, 0, - 0, 0, 96, 97, 98, 99, 100, 101, 115, 0, - 821, 0, 0, 102, 103, 104, 105, 0, 0, 0, - 0, 0, 106, 107, 86, 87, 108, 109, 0, 0, - 0, 110, 0, 88, 0, 0, 111, 112, 0, 113, - 0, 89, 0, 90, 91, 92, 93, 114, 0, 0, - 94, 0, 0, 0, 95, 0, 0, 0, 96, 97, - 98, 99, 100, 101, 115, 0, 1062, 0, 0, 102, - 103, 104, 105, 0, 0, 0, 0, 0, 106, 107, - 86, 87, 108, 109, 0, 0, 0, 110, 0, 88, - 0, 0, 111, 112, 0, 113, 0, 89, 0, 90, - 91, 92, 93, 114, 0, 0, 94, 0, 0, 0, - 95, 0, 0, 87, 96, 97, 98, 99, 100, 101, - 115, 88, 1160, 0, 0, 102, 103, 104, 105, 0, - 0, 90, 91, 92, 106, 107, 0, 0, 108, 109, - 0, 0, 249, 110, 0, 0, 0, 0, 111, 112, - 100, 113, 0, 0, 0, 0, 0, 0, 0, 87, - 105, 0, 0, 0, 0, 0, 106, 88, 0, 0, - 0, 109, 0, 0, 0, 0, 115, 90, 91, 92, - 111, 112, 0, 113, 0, 87, 0, 0, 249, 0, - 0, 0, 0, 88, 0, 0, 100, 0, -144, 0, - 0, 0, 0, 90, 91, 92, 105, 0, 115, 0, - 0, 0, 106, 0, 249, 0, 108, 109, 0, 0, - 0, 0, 100, 258, 0, 0, 111, 112, 87, 113, - 0, 0, 105, 0, 0, 0, 88, 0, 106, 0, - 0, 0, 0, 109, 0, 0, 90, 91, 92, 0, - 0, 0, 0, 112, 115, 113, 0, 249, 0, 0, - 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 105, 0, 0, 0, 0, - 115, 106, 0, 0, 0, 0, 109, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 112, 0, 113, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 115 + 0, 0, 0, 0, 0, 0, 189 }; static const yytype_int16 yycheck[] = { - 1, 381, 439, 128, 129, 130, 131, 474, 133, 108, - 135, 136, 137, 527, 28, 119, 58, 489, 45, 721, - 599, 28, 147, 148, 119, 216, 144, 152, 153, 588, - 119, 543, 12, 57, 548, 551, 56, 414, 229, 230, - 396, 553, 28, 265, 127, 46, 119, 6, 589, 8, - 277, 14, 61, 62, 496, 126, 615, 0, 10, 11, - 287, 45, 144, 146, 580, 581, 144, 583, 584, 585, - 586, 612, 73, 144, 12, 144, 87, 88, 16, 90, - 91, 92, 549, 144, 95, 552, 106, 145, 146, 100, - 669, 127, 14, 127, 105, 106, 130, 108, 109, 110, - 73, 112, 113, 144, 127, 119, 804, 805, 806, 130, - 146, 32, 119, 654, 144, 64, 65, 66, 498, 57, - 144, 70, 135, 146, 145, 126, 144, 128, 129, 130, - 131, 135, 133, 119, 135, 136, 137, 73, 21, 22, - 652, 93, 144, 127, 127, 144, 147, 148, 132, 32, - 134, 152, 153, 126, 626, 696, 129, 12, 135, 139, - 73, 16, 146, 146, 127, 149, 150, 151, 548, 273, - 32, 145, 146, 277, 130, 397, 692, 129, 273, 401, - 145, 146, 120, 287, 273, 212, 413, 146, 277, 145, - 126, 233, 126, 129, 319, 6, 134, 8, 287, 32, - 273, 139, 57, 144, 277, 127, 144, 127, 145, 788, - 432, 727, 589, 126, 287, 216, 129, 144, 167, 168, - 169, 170, 143, 144, 145, 127, 146, 228, 229, 230, - 231, 232, 233, 144, 706, 591, 237, 32, 249, 144, - 145, 708, 253, 128, 146, 130, 555, 289, 557, 558, - 559, 560, 561, 794, 137, 138, 139, 140, 141, 273, - 143, 144, 145, 277, 265, 120, 273, 129, 135, 127, - 277, 127, 221, 287, 126, 712, 128, 654, 130, 134, - 287, 127, 144, 145, 139, 144, 492, 273, 146, 129, - 146, 277, 241, 834, 500, 501, 502, 503, 504, 505, - 146, 287, 127, 127, 526, 777, 139, 140, 141, 413, - 143, 144, 145, 228, 229, 230, 231, 232, 319, 696, - 129, 146, 146, 127, 413, 127, 793, 127, 127, 796, - 797, 537, 144, 127, 335, 336, 126, 127, 380, 381, - 413, 855, 146, 144, 146, 787, 146, 146, 143, 144, - 145, 1049, 146, 1051, 791, 1053, 73, 144, 1056, 1057, - 1058, 6, 363, 8, 365, 366, 367, 368, 369, 144, - 87, 144, 127, 90, 127, 127, 93, 144, 379, 10, - 11, 382, 383, 127, 127, 127, 387, 429, 389, 127, - 699, 146, 109, 146, 146, 144, 397, 398, 129, 413, - 401, 129, 146, 146, 146, 611, 413, 144, 146, 410, - 145, 146, 618, 10, 11, 12, 638, 144, 145, 16, - 887, 126, 144, 128, 410, 130, 126, 413, 128, 430, - 130, 432, 474, 144, 126, 419, 128, 879, 130, 1141, - 882, 647, 73, 74, 144, 144, 145, 396, 363, 491, - 365, 366, 367, 368, 369, 146, 498, 834, 148, 127, - 57, 139, 93, 94, 379, 96, 145, 382, 383, 145, - 101, 129, 103, 474, 475, 855, 126, 1036, 128, 129, - 130, 135, 483, 21, 22, 123, 124, 125, 489, 126, - 146, 492, 144, 144, 32, 496, 93, 146, 128, 500, - 501, 502, 503, 504, 505, 506, 548, 549, 127, 145, - 552, 144, 145, 146, 1028, 146, 517, 144, 145, 146, - 94, 95, 96, 120, 146, 526, 144, 145, 146, 146, - 146, 146, 136, 2, 146, 136, 537, 134, 146, 10, - 11, 12, 139, 146, 146, 16, 532, 548, 549, 136, - 649, 552, 146, 146, 555, 146, 557, 558, 559, 560, - 561, 136, 146, 146, 146, 592, 593, 568, 483, 596, - 597, 40, 41, 42, 43, 44, 577, 1089, 47, 1046, - 139, 146, 73, 147, 126, 599, 57, 588, 589, 714, - 715, 813, 599, 127, 127, 10, 11, 127, 789, 137, - 138, 139, 140, 141, 127, 143, 144, 145, 144, 128, - 611, 612, 127, 599, 615, 144, 148, 618, 144, 1131, - 129, 92, 93, 144, 144, 626, 633, 144, 146, 57, - 144, 139, 148, 10, 11, 12, 126, 638, 649, 16, - 129, 10, 591, 10, 10, 656, 647, 10, 1028, 120, - 651, 128, 136, 654, 681, 669, 128, 127, 73, 74, - 148, 139, 669, 134, 650, 1132, 708, 147, 139, 1228, - 1229, 1230, 139, 144, 128, 128, 128, 128, 93, 94, - 57, 96, 151, 669, 147, 146, 101, 144, 103, 139, - 126, 1203, 148, 1135, 126, 696, 144, 681, 699, 144, - 144, 127, 145, 145, 127, 706, 127, 708, 1150, 1151, - 1152, 127, 130, 714, 715, 130, 93, 130, 32, 134, - 721, 135, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 120, 213, 144, 135, 135, 217, 144, - 135, 793, 1219, 144, 796, 797, 146, 134, 10, 146, - 146, 32, 139, 145, 1323, 127, 147, 144, 146, 148, - 4, 1330, 127, 144, 788, 148, 777, 10, 128, 10, - 1222, 788, 10, 10, 1226, 128, 787, 127, 789, 1231, - 1227, 144, 793, 794, 32, 796, 797, 804, 805, 806, - 146, 127, 788, 272, 148, 144, 147, 814, 146, 1276, - 147, 146, 813, 855, 147, 146, 148, 147, 1078, 1079, - 1080, 1081, 1082, 824, 1084, 139, 140, 141, 146, 143, - 144, 145, 135, 834, 146, 146, 1278, 146, 144, 823, - 135, 825, 135, 144, 135, 887, 1037, 127, 317, 46, - 877, 136, 146, 136, 838, 839, 840, 136, 842, 843, - 844, 845, 331, 332, 1306, 146, 137, 138, 139, 140, - 141, 68, 143, 144, 145, 136, 146, 144, 879, 126, - 1322, 882, 146, 80, 146, 10, 887, 146, 128, 10, - 79, 80, 128, 128, 10, 146, 128, 146, 6, 137, - 138, 139, 140, 141, 101, 143, 144, 145, 147, 146, - 10, 11, 127, 10, 111, 144, 146, 136, 144, 144, - 389, 144, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, - 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, - 1200, 146, 50, 136, 141, 136, 143, 144, 146, 136, - 58, 16, 17, 18, 19, 20, 21, 22, 146, 428, - 68, 69, 70, 147, 32, 128, 10, 32, 1093, 10, - 11, 79, 441, 73, 74, 128, 144, 144, 144, 87, - 144, 146, 128, 128, 146, 1245, 1028, 146, 185, 97, - 991, 257, 713, 93, 94, 103, 96, 547, 1031, 1131, - 108, 101, 1089, 103, 1046, 73, 1203, 649, 277, 478, - 118, 650, 120, 1028, 824, 991, 855, 814, -1, 87, - 489, 532, 90, 336, -1, 93, -1, 1028, -1, 129, - -1, -1, 73, 74, -1, 1036, 1037, 145, 1298, -1, - -1, 109, 1049, -1, 1051, 1046, 1053, -1, -1, 1056, - 1057, 1058, 93, 94, -1, 96, 1083, -1, -1, -1, - 101, 258, 103, 260, 261, 262, 263, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, -1, 143, 144, - 145, -1, 279, -1, -1, 126, 283, -1, -1, -1, - 1132, -1, 1093, 290, -1, 292, -1, -1, -1, 1083, - -1, -1, -1, 300, 301, -1, -1, 830, 577, -1, - -1, 300, 301, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, - -1, 1132, -1, -1, 1135, -1, -1, -1, -1, 336, - 1141, 15, 16, 17, 18, 19, 20, 21, 22, 1150, - 1151, 1152, -1, -1, -1, -1, 625, 626, 32, -1, - -1, -1, 631, -1, -1, -1, 51, -1, 53, 54, - 55, -1, -1, -1, 1201, -1, -1, 1219, -1, -1, - -1, -1, -1, -1, 1168, 1169, 1170, 1171, 1172, 1173, - -1, -1, -1, 390, -1, 80, 81, -1, 387, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 677, 678, - 679, 680, -1, 682, -1, 100, 101, -1, 1219, -1, - -1, 1222, -1, -1, -1, 1226, -1, 1228, 1229, 1230, - 1231, 116, -1, -1, 1276, -1, 121, 706, -1, 436, - -1, 430, -1, 1270, 1271, -1, 1273, 1274, -1, -1, - -1, -1, 721, -1, 10, 11, -1, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, -1, 143, - 144, 145, -1, -1, 148, 1276, -1, 1278, -1, -1, - -1, -1, -1, -1, -1, -1, 1313, 1314, 1315, 1316, - -1, -1, 17, 18, 19, 20, 21, 22, -1, -1, - -1, -1, -1, 492, -1, 1306, -1, 32, 777, -1, - 779, 500, 501, 502, 503, 504, 505, 73, 74, -1, - -1, 1322, 1323, -1, -1, -1, -1, -1, -1, 1330, - 19, 20, 21, 22, 531, -1, 533, 93, 94, -1, - 96, -1, -1, 32, -1, 101, -1, 103, 537, -1, - 547, -1, -1, -1, -1, 1078, 1079, 1080, 1081, 1082, - -1, 1084, -1, -1, -1, -1, 555, -1, 557, 558, - 559, 560, 561, -1, -1, -1, 845, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 856, 857, 858, - 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, - 869, 870, 871, 872, 873, 874, 875, 876, -1, 878, - 135, 136, 137, 138, 139, 140, 141, -1, 143, 144, - 145, -1, 611, -1, -1, -1, -1, -1, -1, 618, - -1, -1, -1, -1, -1, 3, 4, 5, 6, -1, - 8, 9, 10, 11, -1, -1, 135, 136, 137, 138, - 139, 140, 141, -1, 143, 144, 145, -1, 647, 1182, - 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, - 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, -1, 47, - 48, -1, -1, 51, -1, 53, 54, 55, 56, 57, - -1, 59, 60, -1, -1, 63, 64, -1, -1, 67, - -1, -1, -1, -1, 72, 73, 74, -1, -1, -1, - 699, -1, 80, 81, -1, -1, 713, -1, -1, -1, - -1, 89, 1245, 91, -1, 93, -1, -1, -1, -1, - 98, -1, 100, 101, 102, -1, -1, 105, 106, -1, - -1, -1, 110, -1, -1, 113, 114, 115, 116, -1, - -1, 119, 1021, 121, -1, -1, 3, 4, 5, 6, - -1, 8, 9, 10, 11, -1, 134, -1, -1, 137, - 138, 139, -1, -1, 142, 1298, 144, 145, -1, -1, - -1, 149, -1, 16, 17, 18, 19, 20, 21, 22, - -1, -1, -1, 790, -1, -1, -1, -1, -1, 32, - 47, -1, -1, -1, 51, -1, 53, 54, 55, -1, - 807, -1, 59, 810, 61, 62, 63, 64, -1, -1, - -1, -1, -1, -1, -1, 72, 73, 74, -1, -1, - 1099, -1, -1, 80, 81, -1, -1, -1, -1, -1, - -1, -1, 89, -1, 91, -1, 93, -1, -1, -1, - -1, 98, -1, 100, 101, 102, -1, -1, 105, -1, - -1, -1, -1, 110, -1, -1, 113, -1, -1, 116, - -1, -1, 1141, -1, 121, -1, -1, -1, -1, 126, - -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, - 137, 138, 139, -1, -1, 142, -1, 144, 145, 132, - 133, 134, 149, -1, 137, 138, 139, 140, 141, -1, - 143, 144, 145, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 1202, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, -1, 1215, -1, -1, -1, - -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, -1, - -1, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, -1, 67, -1, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, -1, -1, -1, -1, -1, 87, 88, 89, - -1, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, -1, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, -1, -1, -1, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - -1, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, -1, -1, -1, -1, -1, -1, -1, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, -1, -1, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, -1, 67, -1, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, -1, - -1, -1, -1, -1, 87, 88, 89, -1, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, -1, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - -1, -1, -1, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, -1, 148, 149, 3, 4, 5, - 6, -1, 8, 9, 10, 11, -1, -1, 14, -1, - -1, -1, -1, -1, 51, -1, 53, 54, 55, -1, - -1, -1, -1, -1, -1, -1, 63, -1, -1, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, 47, 48, 80, 81, 51, 32, 53, 54, 55, - 56, 57, -1, 59, 60, -1, -1, 63, 64, -1, - -1, 67, -1, 100, 101, -1, 72, 73, 74, -1, - -1, -1, -1, -1, 80, 81, -1, -1, -1, 116, - -1, -1, -1, 89, 121, 91, -1, 93, -1, -1, - -1, 97, 98, -1, 100, 101, 102, -1, -1, 105, - 106, -1, -1, -1, 110, -1, -1, 113, 114, 115, - 116, -1, -1, 119, -1, 121, 3, 4, 5, 6, - -1, 8, 9, 10, 11, -1, -1, 14, 134, -1, - -1, 137, 138, -1, -1, -1, 142, -1, 144, -1, - -1, -1, -1, 149, -1, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, -1, 143, 144, 145, - 47, 48, 148, -1, 51, -1, 53, 54, 55, 56, - 57, -1, 59, 60, -1, -1, 63, 64, -1, -1, - 67, -1, -1, -1, -1, 72, 73, 74, -1, -1, - -1, -1, -1, 80, 81, -1, -1, -1, -1, -1, - -1, -1, 89, -1, 91, -1, 93, -1, -1, -1, - 97, 98, -1, 100, 101, 102, -1, -1, 105, 106, - -1, -1, -1, 110, -1, -1, 113, 114, 115, 116, - -1, -1, 119, -1, 121, 3, 4, 5, 6, -1, - 8, 9, 10, 11, -1, 10, 11, 134, -1, -1, - 137, 138, -1, -1, -1, 142, -1, 144, -1, -1, - -1, -1, 149, 17, 18, 19, 20, 21, 22, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 32, 47, - -1, -1, -1, 51, -1, 53, 54, 55, -1, -1, - -1, 59, -1, -1, -1, 63, 64, -1, -1, -1, - -1, -1, -1, -1, 72, 73, 74, -1, 73, 74, - -1, -1, 80, 81, -1, -1, -1, -1, -1, -1, - -1, 89, -1, 91, -1, 93, -1, -1, 93, 94, - 98, 96, 100, 101, 102, -1, 101, 105, 103, 10, - 11, -1, 110, -1, -1, 113, -1, -1, 116, 3, - 4, 5, 6, 121, 8, 9, 10, 11, -1, -1, - -1, 126, -1, -1, -1, -1, 134, -1, -1, 137, - 138, 139, -1, -1, 142, -1, 144, 145, 146, 133, - 134, 149, -1, 137, 138, 139, 140, 141, -1, 143, - 144, 145, -1, 47, -1, -1, -1, 51, -1, 53, - 54, 55, 73, 74, -1, 59, -1, -1, -1, 63, - 64, 51, -1, 53, 54, 55, -1, -1, 72, 73, - 74, -1, 93, 94, -1, 96, 80, 81, -1, -1, - 101, -1, 103, -1, -1, 89, -1, 91, -1, 93, - 80, 81, -1, -1, 98, -1, 100, 101, 102, -1, - -1, 105, -1, -1, -1, 126, 110, 10, 11, 113, - 100, 101, 116, 3, 4, 5, 6, 121, 8, 9, - 10, 11, 126, -1, -1, -1, 116, -1, -1, -1, - 134, 121, -1, 137, 138, 139, -1, -1, 142, -1, - 144, 145, -1, -1, -1, 149, -1, -1, 51, -1, - 53, 54, 55, -1, 144, -1, -1, 47, -1, -1, - 63, 51, -1, 53, 54, 55, -1, -1, -1, 59, - -1, 74, -1, 63, 64, -1, -1, 80, 81, -1, - -1, -1, 72, 73, 74, -1, -1, -1, -1, -1, - 80, 81, 51, -1, 53, 54, 55, 100, 101, 89, - -1, 91, -1, 93, 63, -1, -1, -1, 98, -1, - 100, 101, 102, 116, -1, 105, 119, -1, 121, -1, - 110, 80, 81, 113, -1, -1, 116, 3, 4, 5, - 6, 121, 8, 9, 10, 11, -1, -1, -1, -1, - -1, 100, 101, -1, 134, -1, -1, 137, 138, 139, - -1, -1, 142, -1, 144, 145, 146, 116, -1, 149, - -1, -1, 121, -1, -1, -1, -1, -1, -1, -1, - -1, 47, -1, -1, -1, 51, -1, 53, 54, 55, - -1, -1, -1, 59, -1, 144, -1, 63, 64, 51, - -1, 53, 54, 55, -1, -1, 72, 73, 74, -1, - -1, -1, -1, -1, 80, 81, 51, -1, 53, 54, - 55, -1, -1, 89, -1, 91, -1, 93, 80, 81, - -1, -1, 98, -1, 100, 101, 102, -1, -1, 105, - -1, 10, 11, -1, 110, 80, 81, 113, 100, 101, - 116, 3, 4, 5, 6, 121, 8, 9, 10, 11, - 126, -1, -1, -1, 116, 100, 101, -1, 134, 121, - -1, 137, 138, 139, -1, -1, 142, -1, 144, 145, - -1, 116, -1, 149, -1, -1, 121, -1, -1, -1, - -1, -1, 144, -1, -1, 47, -1, -1, -1, 51, - -1, 53, 54, 55, 73, 74, -1, 59, -1, 144, - -1, 63, 64, 51, -1, 53, 54, 55, -1, 88, - 72, 73, 74, -1, 93, 94, -1, 96, 80, 81, - -1, -1, 101, -1, 103, -1, -1, 89, -1, 91, - -1, 93, 80, 81, -1, -1, 98, -1, 100, 101, - 102, -1, -1, 105, -1, -1, -1, -1, 110, -1, - -1, 113, 100, 101, 116, 3, 4, 5, 6, 121, - 8, 9, 10, 11, -1, -1, -1, -1, 116, -1, - -1, -1, 134, 121, -1, 137, 138, 139, -1, -1, - 142, -1, 144, 145, 146, -1, -1, 149, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, - -1, -1, -1, 51, -1, 53, 54, 55, -1, -1, - -1, 59, -1, -1, -1, 63, 64, -1, -1, -1, - -1, -1, -1, -1, 72, 73, 74, -1, -1, -1, - -1, -1, 80, 81, -1, -1, -1, -1, -1, -1, - -1, 89, -1, 91, -1, 93, -1, -1, -1, -1, - 98, -1, 100, 101, 102, -1, -1, 105, -1, -1, - -1, -1, 110, -1, -1, 113, -1, -1, 116, 3, - 4, 5, 6, 121, 8, 9, 10, -1, -1, -1, - -1, -1, -1, 10, 11, -1, 134, -1, -1, 137, - 138, 139, -1, -1, 142, -1, 144, 145, -1, -1, - -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, - -1, 48, -1, -1, 51, 59, 53, 54, 55, 56, - 64, -1, -1, 60, -1, -1, 63, -1, 72, 73, - 67, -1, -1, -1, -1, -1, -1, 74, 0, -1, - -1, -1, -1, 80, 81, -1, -1, 91, -1, 93, - -1, -1, -1, -1, 98, -1, -1, -1, 102, -1, - -1, 105, -1, 100, 101, -1, 110, -1, -1, 106, - -1, -1, -1, -1, -1, -1, -1, 114, 115, 116, - -1, -1, 119, -1, 121, -1, -1, 49, 50, -1, - 134, -1, -1, 137, 138, 139, 58, -1, 142, -1, - 144, 145, -1, -1, 66, 149, 68, 69, 70, 71, - -1, -1, -1, 75, -1, -1, -1, 79, -1, -1, - -1, 83, 84, 85, 86, 87, 88, 19, 20, 21, - 22, -1, 94, 95, 96, 97, -1, -1, -1, -1, - 32, 103, 104, -1, -1, 107, 108, -1, -1, -1, - 112, -1, -1, -1, -1, 117, 118, -1, 120, 6, - -1, -1, -1, -1, -1, -1, 128, -1, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 10, 11, -1, - -1, -1, -1, 145, -1, 32, -1, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, 62, 32, -1, -1, -1, - -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, + 1, 61, 504, 448, 128, 622, 844, 147, 148, 149, + 150, 639, 152, 455, 154, 481, 156, 13, 684, 701, + 464, 6, 15, 8, 162, 15, 15, 644, 0, 13, + 44, 15, 172, 17, 75, 139, 574, 44, 92, 15, + 62, 63, 139, 183, 184, 75, 15, 139, 74, 189, + 190, 15, 145, 106, 107, 108, 722, 110, 111, 112, + 162, 62, 115, 145, 74, 310, 145, 120, 935, 936, + 937, 164, 125, 126, 58, 128, 129, 130, 145, 132, + 133, 162, 164, 144, 57, 164, 81, 82, 83, 582, + 91, 92, 603, 88, 647, 163, 164, 164, 13, 44, + 15, 162, 17, 145, 148, 145, 33, 74, 148, 2, + 650, 793, 652, 653, 654, 655, 656, 162, 144, 163, + 33, 147, 164, 676, 677, 139, 679, 680, 681, 682, + 148, 162, 139, 145, 144, 162, 578, 147, 144, 584, + 146, 147, 148, 58, 145, 163, 147, 148, 149, 150, + 123, 152, 164, 154, 138, 156, 598, 599, 600, 601, + 602, 157, 153, 56, 57, 58, 59, 60, 152, 162, + 63, 172, 162, 157, 685, 164, 145, 144, 162, 164, + 147, 145, 183, 184, 33, 162, 162, 148, 189, 190, + 250, 6, 634, 8, 139, 733, 145, 163, 164, 644, + 254, 255, 163, 145, 74, 153, 744, 718, 719, 204, + 205, 206, 207, 153, 318, 164, 270, 271, 322, 685, + 465, 318, 164, 138, 469, 322, 318, 145, 162, 146, + 322, 148, 914, 274, 161, 162, 163, 152, 163, 164, + 293, 381, 157, 687, 274, 298, 164, 162, 161, 162, + 163, 162, 497, 254, 255, 162, 163, 10, 11, 12, + 13, 145, 162, 816, 17, 260, 33, 778, 269, 270, + 271, 272, 273, 274, 144, 717, 162, 147, 279, 162, + 164, 821, 145, 145, 145, 162, 10, 11, 12, 284, + 828, 145, 333, 162, 736, 188, 162, 850, 147, 147, + 145, 164, 164, 164, 318, 58, 162, 454, 322, 310, + 164, 318, 778, 162, 163, 322, 145, 153, 1185, 164, + 1187, 763, 1189, 144, 145, 1192, 1193, 1194, 770, 771, + 772, 773, 774, 835, 162, 164, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 110, 251, 145, + 145, 162, 900, 256, 162, 163, 164, 13, 145, 15, + 987, 17, 162, 318, 145, 162, 621, 322, 164, 164, + 381, 10, 11, 12, 13, 138, 110, 164, 17, 145, + 157, 158, 159, 164, 161, 162, 163, 398, 399, 152, + 145, 162, 145, 145, 157, 162, 447, 448, 164, 920, + 921, 6, 58, 8, 162, 917, 162, 447, 448, 164, + 913, 164, 164, 147, 317, 163, 164, 428, 162, 58, + 577, 432, 433, 434, 435, 436, 162, 1275, 163, 164, + 587, 588, 589, 590, 591, 446, 162, 163, 449, 450, + 162, 163, 493, 454, 162, 162, 457, 557, 144, 144, + 146, 146, 148, 148, 465, 466, 162, 162, 469, 464, + 162, 478, 162, 162, 10, 11, 12, 478, 144, 162, + 109, 110, 144, 162, 146, 378, 148, 634, 141, 142, + 143, 162, 138, 494, 162, 144, 497, 146, 162, 148, + 162, 394, 395, 1169, 147, 147, 152, 147, 163, 138, + 755, 157, 162, 163, 164, 162, 557, 162, 1011, 145, + 962, 1014, 166, 152, 111, 112, 113, 557, 157, 162, + 163, 164, 162, 162, 162, 576, 157, 164, 74, 75, + 163, 163, 987, 584, 1161, 645, 576, 147, 648, 153, + 144, 162, 162, 162, 584, 146, 557, 558, 164, 145, + 145, 164, 164, 164, 457, 164, 567, 164, 164, 716, + 10, 11, 12, 574, 110, 111, 577, 113, 725, 154, + 154, 582, 118, 164, 120, 586, 587, 588, 589, 590, + 591, 592, 164, 164, 164, 1223, 164, 145, 164, 492, + 164, 164, 603, 644, 645, 164, 164, 648, 144, 164, + 164, 612, 33, 506, 644, 645, 763, 164, 648, 164, + 621, 628, 164, 770, 771, 772, 773, 774, 688, 689, + 164, 154, 164, 634, 74, 75, 696, 164, 698, 164, + 764, 154, 164, 644, 645, 164, 164, 648, 162, 650, + 157, 652, 653, 654, 655, 656, 164, 10, 11, 12, + 13, 163, 15, 664, 17, 163, 165, 164, 561, 74, + 110, 111, 673, 113, 144, 162, 145, 145, 118, 145, + 120, 574, 145, 684, 685, 146, 166, 701, 10, 11, + 12, 145, 687, 164, 701, 162, 62, 837, 838, 944, + 1366, 1367, 1368, 162, 147, 58, 162, 162, 157, 162, + 157, 764, 164, 164, 162, 716, 1161, 718, 719, 85, + 166, 722, 144, 163, 725, 10, 10, 780, 147, 10, + 10, 831, 733, 99, 155, 156, 157, 158, 159, 146, + 161, 162, 163, 744, 154, 805, 145, 165, 146, 166, + 98, 99, 74, 75, 755, 121, 701, 110, 765, 146, + 157, 157, 763, 164, 146, 131, 146, 146, 769, 770, + 771, 772, 773, 774, 775, 165, 1269, 778, 164, 793, + 673, 157, 144, 164, 162, 138, 793, 164, 110, 111, + 831, 113, 1285, 1286, 1287, 164, 118, 162, 120, 152, + 1466, 831, 166, 162, 157, 750, 162, 1473, 163, 162, + 176, 163, 163, 179, 180, 962, 144, 148, 145, 919, + 821, 145, 145, 157, 924, 925, 145, 828, 153, 162, + 831, 10, 11, 12, 13, 153, 837, 838, 17, 732, + 733, 153, 164, 844, 153, 162, 145, 163, 793, 164, + 164, 744, 165, 164, 10, 748, 164, 223, 4, 166, + 162, 915, 1364, 145, 162, 1358, 166, 15, 10, 166, + 1363, 146, 10, 10, 10, 146, 1369, 1370, 919, 58, + 145, 164, 15, 924, 925, 162, 162, 166, 162, 919, + 153, 164, 162, 165, 924, 925, 165, 164, 166, 900, + 914, 165, 268, 165, 164, 164, 164, 914, 801, 802, + 803, 804, 913, 806, 915, 164, 153, 1017, 919, 920, + 921, 153, 153, 924, 925, 1418, 164, 154, 154, 154, + 164, 110, 154, 162, 164, 828, 164, 303, 144, 305, + 306, 307, 308, 944, 164, 61, 987, 164, 164, 1009, + 164, 844, 10, 954, 146, 1448, 10, 987, 324, 138, + 146, 962, 328, 146, 10, 146, 162, 164, 334, 914, + 164, 337, 1465, 152, 162, 162, 1017, 162, 157, 345, + 346, 165, 164, 162, 162, 145, 154, 1017, 164, 164, + 935, 936, 937, 164, 164, 154, 154, 345, 346, 154, + 945, 164, 146, 165, 10, 10, 146, 900, 33, 902, + 1011, 162, 162, 1014, 836, 162, 1017, 146, 643, 164, + 146, 387, 1164, 162, 302, 269, 270, 271, 272, 273, + 146, 1223, 164, 399, 164, 151, 164, 153, 765, 155, + 628, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 322, 954, 764, 987, + 1161, 322, 10, 11, 12, 431, 182, 963, 322, 945, + 186, 187, 188, 1124, 18, 19, 20, 21, 22, 23, + 1180, -1, 1182, -1, 977, -1, -1, 1227, -1, 33, + -1, -1, 458, 399, -1, 988, 989, 990, 991, 992, + 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, + 1003, 1004, 1005, 1006, 1007, 1008, 1170, 1010, 22, 23, + 1161, -1, -1, 1124, -1, -1, 74, 75, -1, 33, + -1, 1161, 157, 158, 159, 501, 161, 162, 163, 1180, + -1, 1182, -1, -1, -1, -1, 494, -1, -1, 265, + 1180, -1, 1182, -1, -1, -1, -1, -1, -1, 1219, + 1161, 509, 110, 111, -1, 113, 1266, -1, 1169, 1170, + 118, -1, 120, -1, -1, -1, -1, -1, -1, 1180, + -1, 1182, -1, -1, 428, -1, -1, -1, 432, 433, + 434, 435, 436, -1, -1, -1, -1, -1, -1, -1, + 148, -1, 446, -1, 152, 449, 450, 151, 152, 153, + 154, 155, 156, 157, 158, 159, -1, 161, 162, 163, + -1, -1, -1, -1, -1, 1266, 1227, -1, -1, -1, + 596, -1, -1, -1, -1, -1, 1266, -1, -1, -1, + 1185, -1, 1187, -1, 1189, -1, -1, 1192, 1193, 1194, + -1, 155, 156, 157, 158, 159, 1356, 161, 162, 163, + -1, 1154, -1, -1, 380, 1266, 632, -1, 1269, -1, + -1, -1, -1, -1, 1275, -1, -1, 643, 1338, -1, + -1, -1, -1, -1, 1285, 1286, 1287, -1, -1, -1, + -1, 639, -1, -1, -1, -1, -1, -1, -1, 647, + -1, -1, 650, -1, 652, 653, 654, 655, 656, -1, + -1, -1, -1, -1, -1, 1356, 1416, -1, 1214, 1215, + 1216, 1217, 1218, 567, 1220, -1, 1356, -1, 676, 677, + -1, 679, 680, 681, 682, -1, -1, -1, -1, -1, + -1, 1234, 17, 18, 19, 20, 21, 22, 23, 1409, + 1410, -1, 1412, -1, 1414, 1356, -1, 1358, 33, -1, + 22, 23, 1363, -1, -1, 1366, 1367, 1368, 1369, 1370, + 486, 33, -1, -1, -1, 1416, -1, -1, -1, -1, + 496, -1, 1275, -1, -1, -1, 1416, -1, -1, -1, + -1, -1, -1, -1, -1, 1455, 1456, 1457, -1, 1459, + 766, -1, 1214, 1215, 1216, 1217, 1218, 33, 1220, -1, + 526, -1, 528, -1, 530, 1416, -1, 1418, -1, -1, + -1, -1, -1, 1319, 1320, 1321, 1322, 1323, 1324, 1325, + 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, + 1336, 1337, -1, -1, -1, -1, 1339, 1448, -1, 16, + 17, 18, 19, 20, 21, 22, 23, -1, -1, 1352, + -1, -1, -1, -1, 1465, 1466, 33, -1, 816, -1, + 836, -1, 1473, 821, -1, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, -1, 161, 162, 163, 1385, + -1, -1, -1, 155, 156, 157, 158, 159, -1, 161, + 162, 163, 850, -1, -1, -1, -1, 1319, 1320, 1321, + 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, 1330, 1331, + 1332, 1333, 1334, 1335, 1336, 1337, -1, -1, -1, 155, + 156, 157, 158, 159, -1, 161, 162, 163, -1, -1, + -1, -1, -1, -1, 1440, 20, 21, 22, 23, -1, + 916, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 73, 74, 89, -1, -1, 137, 138, 139, 140, 141, - -1, 143, 144, 145, -1, -1, -1, -1, -1, -1, - 93, 94, -1, 96, -1, -1, -1, -1, 101, -1, - 103, -1, -1, 106, -1, -1, -1, -1, -1, -1, - 127, 114, 115, 130, -1, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, -1, 144, 145, 10, - 11, -1, 149, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, -1, 143, 144, 145, - 10, 11, 148, -1, -1, -1, -1, 48, -1, -1, - 51, -1, 53, 54, 55, 56, 57, -1, -1, 60, - -1, -1, 63, -1, -1, -1, 67, -1, -1, -1, - -1, -1, -1, 74, -1, -1, -1, -1, 48, 80, - 81, 51, -1, 53, 54, 55, 56, 57, -1, -1, - 60, 92, -1, 63, -1, -1, -1, 67, -1, 100, - 101, -1, -1, -1, 74, 106, -1, -1, -1, -1, - 80, 81, -1, 114, 115, 116, 10, 11, 119, -1, - 121, -1, 92, -1, -1, 126, -1, -1, -1, -1, - 100, 101, -1, -1, -1, -1, 106, -1, -1, -1, - -1, 142, -1, -1, 114, 115, 116, -1, -1, 119, - -1, 121, -1, -1, 48, -1, -1, 51, -1, 53, - 54, 55, 56, 57, -1, -1, 60, -1, -1, 63, - -1, -1, 142, 67, -1, -1, -1, -1, -1, -1, - 74, -1, -1, -1, -1, -1, 80, 81, 15, 16, - 17, 18, 19, 20, 21, 22, -1, -1, 92, -1, - -1, -1, -1, -1, -1, 32, 100, 101, -1, -1, - -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, - 114, 115, 116, -1, -1, 119, -1, 121, 15, 16, - 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 32, -1, -1, 142, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 32, 15, 16, 17, - 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, 15, 16, 17, 18, 19, - 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, - 127, -1, 32, -1, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, -1, 143, 144, 145, 146, - 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, - -1, -1, -1, -1, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, -1, 143, 144, 145, 146, - -1, -1, -1, -1, -1, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, -1, 143, 144, 145, - 146, -1, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, -1, 143, 144, 145, 146, -1, - -1, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, -1, 143, 144, 145, 146, 15, 16, 17, - 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, -1, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, -1, 143, 144, - 145, 146, 15, 16, 17, 18, 19, 20, 21, 22, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, - -1, 15, 16, 17, 18, 19, 20, 21, 22, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 32, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 32, 15, 16, 17, - 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, - -1, 129, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, -1, 143, 144, 145, -1, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, 128, 32, -1, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, -1, - 143, 144, 145, 127, -1, -1, -1, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, -1, 143, - 144, 145, -1, 129, -1, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, -1, 143, 144, 145, - -1, -1, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, -1, 143, 144, 145, 15, 16, - 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, -1, 143, 144, 145, - 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, + -1, -1, 938, 1385, -1, 941, -1, -1, 145, -1, + -1, -1, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, -1, 161, 162, 163, 164, -1, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + -1, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, -1, -1, -1, -1, -1, -1, 1440, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, -1, -1, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, -1, 70, 71, 72, 73, + 74, 75, 76, 77, 78, -1, 80, 81, 82, -1, + 155, 156, 157, 158, 159, -1, 161, 162, 163, 805, + -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, + 104, 105, 106, -1, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, -1, -1, -1, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, -1, -1, -1, -1, -1, 52, + -1, 54, 55, 56, -1, -1, -1, -1, -1, -1, + -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 17, 18, 19, 20, 21, 22, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, - 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, - -1, -1, 129, -1, 131, 132, 133, 134, -1, -1, - 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, - -1, -1, -1, -1, 11, -1, -1, 14, -1, 16, - -1, -1, -1, -1, -1, -1, 17, 18, 19, 20, - 21, 22, -1, -1, -1, -1, 131, 132, 133, 134, - -1, 32, 137, 138, 139, 140, 141, -1, 143, 144, - 145, 48, -1, -1, 51, -1, 53, 54, 55, 56, - 57, -1, -1, 60, -1, -1, 63, 132, 133, 134, - 67, -1, 137, 138, 139, 140, 141, 74, 143, 144, - 145, -1, -1, 80, 81, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, - 97, -1, -1, 100, 101, 10, 11, -1, -1, 106, - 17, 18, 19, 20, 21, 22, -1, 114, 115, 116, - -1, -1, 119, -1, 121, 32, 17, 18, 19, 20, - 21, 22, -1, -1, -1, -1, -1, 134, -1, -1, - -1, 32, 139, 134, 135, 136, 137, 138, 139, 140, - 141, 56, 143, 144, 145, 17, 18, 19, 20, 21, - 22, -1, -1, -1, -1, -1, -1, -1, 73, 74, - 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, - 95, 96, -1, -1, -1, -1, 101, -1, 103, -1, - -1, 106, -1, -1, -1, -1, -1, -1, -1, 114, - 115, -1, -1, 118, -1, -1, 10, 11, -1, -1, - -1, -1, -1, -1, -1, -1, 133, 134, 135, 136, - 137, 138, 139, 140, 141, -1, 143, 144, 145, -1, - -1, -1, -1, 134, -1, -1, 137, 138, 139, 140, - 141, -1, 143, 144, 145, -1, -1, 51, -1, 53, - 54, 55, 56, 57, -1, -1, -1, -1, -1, 63, - -1, -1, -1, -1, -1, 137, 138, 139, 140, 141, - 74, 143, 144, 145, -1, -1, 80, 81, -1, 11, - -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 100, 101, -1, -1, + -1, -1, -1, -1, -1, 98, 1164, -1, -1, -1, + -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, + 23, -1, -1, -1, 117, 118, -1, -1, -1, -1, + 33, -1, -1, -1, -1, 961, -1, -1, -1, -1, + -1, 134, -1, 969, 970, 971, 139, 973, -1, 975, + 976, 977, -1, 1229, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1223, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, -1, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, + -1, -1, -1, -1, -1, -1, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, -1, -1, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + -1, 68, -1, 70, 71, 72, 73, 74, 75, 76, + 77, 78, -1, 80, 81, 82, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, -1, 161, 162, + 163, 98, -1, 166, -1, -1, -1, 104, 105, 106, + -1, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, -1, -1, 1382, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, -1, 166, + 167, -1, -1, 3, 4, 5, 6, -1, 8, 9, + 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 114, -1, 116, -1, -1, 119, 48, 121, -1, 51, - -1, 53, 54, 55, 56, 57, -1, -1, 60, -1, - -1, 63, -1, -1, -1, 67, -1, -1, -1, -1, - -1, -1, 74, -1, -1, -1, -1, -1, 80, 81, - -1, 11, -1, -1, 14, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 97, -1, -1, 100, 101, - -1, -1, -1, -1, 106, -1, -1, -1, -1, -1, - -1, -1, 114, 115, 116, -1, -1, 119, 48, 121, - -1, 51, -1, 53, 54, 55, 56, 57, -1, -1, - 60, -1, -1, 63, -1, -1, -1, 67, -1, -1, - -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, - 80, 81, -1, 11, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, - 100, 101, -1, -1, -1, 11, 106, -1, -1, -1, - -1, -1, -1, -1, 114, 115, 116, -1, -1, 119, - 48, 121, -1, 51, -1, 53, 54, 55, 56, 57, - -1, -1, 60, -1, -1, 63, -1, -1, -1, 67, - -1, -1, 48, -1, -1, 51, 74, 53, 54, 55, - 56, 57, 80, 81, 60, -1, -1, 63, -1, -1, - -1, 67, -1, -1, -1, -1, -1, -1, 74, 97, - -1, -1, 100, 101, 80, 81, -1, 11, 106, -1, - -1, -1, -1, -1, -1, -1, 114, 115, 116, -1, - -1, 119, -1, 121, 100, 101, -1, -1, -1, -1, - 106, -1, -1, -1, -1, -1, -1, -1, 114, 115, - 116, -1, -1, 119, 48, 121, -1, 51, -1, 53, - 54, 55, 56, 57, -1, -1, 60, -1, -1, 63, - -1, -1, -1, 67, 11, -1, -1, -1, -1, -1, - 74, -1, -1, -1, -1, -1, 80, 81, -1, -1, - -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 100, 101, -1, -1, - -1, 48, 106, -1, 51, -1, 53, 54, 55, 56, - 114, 115, 116, 60, -1, 119, 63, 121, -1, -1, - 67, -1, -1, 48, -1, -1, 51, 74, 53, 54, - 55, 56, 57, 80, 81, 60, -1, -1, 63, -1, - -1, -1, 67, 11, -1, -1, -1, -1, -1, 74, - 97, -1, -1, 100, 101, 80, 81, -1, -1, 106, - -1, -1, -1, -1, -1, 11, -1, 114, 115, 116, - -1, -1, 119, -1, 121, 100, 101, -1, -1, -1, - 48, 106, -1, 51, -1, 53, 54, 55, 56, 114, - 115, 116, 60, -1, 119, 63, 121, -1, -1, 67, - -1, -1, 48, 10, 11, 51, 74, 53, 54, 55, - 56, -1, 80, 81, 60, -1, -1, 63, -1, 10, - 11, 67, -1, -1, -1, -1, -1, -1, 74, -1, - -1, -1, 100, 101, 80, 81, -1, -1, 106, -1, - -1, -1, -1, -1, -1, -1, 114, 115, 116, 56, - -1, 119, -1, 121, 100, 101, -1, -1, 10, 11, - 106, -1, -1, -1, -1, 56, 73, 74, 114, 115, - 116, -1, -1, 119, -1, 121, -1, -1, -1, -1, - -1, -1, 73, 74, -1, -1, 93, 94, -1, 96, - -1, -1, -1, -1, 101, -1, 103, -1, -1, 106, - -1, -1, 93, 94, 56, 96, -1, 114, 115, -1, - 101, 118, 103, -1, -1, 106, -1, -1, -1, -1, - -1, 73, 74, 114, 115, -1, -1, 118, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 49, 50, - -1, 93, 94, -1, 96, -1, -1, 58, -1, 101, - -1, 103, -1, -1, 106, 66, -1, 68, 69, 70, - 71, -1, 114, 115, 75, -1, 118, -1, 79, -1, - -1, -1, 83, 84, 85, 86, 87, 88, -1, -1, - -1, -1, -1, 94, 95, 96, 97, -1, -1, -1, - -1, -1, 103, 104, 49, 50, 107, 108, -1, -1, - -1, 112, -1, 58, -1, -1, 117, 118, -1, 120, - -1, 66, -1, 68, 69, 70, 71, 128, -1, -1, - 75, -1, -1, -1, 79, -1, -1, -1, 83, 84, - 85, 86, 87, 88, 145, -1, 147, -1, -1, 94, - 95, 96, 97, -1, -1, -1, -1, -1, 103, 104, - 49, 50, 107, 108, -1, -1, -1, 112, -1, 58, - -1, -1, 117, 118, -1, 120, -1, 66, -1, 68, - 69, 70, 71, 128, -1, -1, 75, -1, -1, -1, - 79, -1, -1, -1, 83, 84, 85, 86, 87, 88, - 145, -1, 147, -1, -1, 94, 95, 96, 97, -1, - -1, -1, -1, -1, 103, 104, 49, 50, 107, 108, - -1, -1, -1, 112, -1, 58, -1, -1, 117, 118, - -1, 120, -1, 66, -1, 68, 69, 70, 71, 128, - -1, -1, 75, -1, -1, -1, 79, -1, -1, -1, - 83, 84, 85, 86, 87, 88, 145, -1, 147, -1, - -1, 94, 95, 96, 97, -1, -1, -1, -1, -1, - 103, 104, 49, 50, 107, 108, -1, -1, -1, 112, - -1, 58, -1, -1, 117, 118, -1, 120, -1, 66, - -1, 68, 69, 70, 71, 128, -1, -1, 75, -1, - -1, -1, 79, -1, -1, -1, 83, 84, 85, 86, - 87, 88, 145, -1, 147, -1, -1, 94, 95, 96, - 97, -1, -1, -1, -1, -1, 103, 104, 49, 50, - 107, 108, -1, -1, -1, 112, -1, 58, -1, -1, - 117, 118, -1, 120, -1, 66, -1, 68, 69, 70, - 71, 128, -1, -1, 75, -1, -1, -1, 79, -1, - -1, -1, 83, 84, 85, 86, 87, 88, 145, -1, - 147, -1, -1, 94, 95, 96, 97, -1, -1, -1, - -1, -1, 103, 104, 49, 50, 107, 108, -1, -1, - -1, 112, -1, 58, -1, -1, 117, 118, -1, 120, - -1, 66, -1, 68, 69, 70, 71, 128, -1, -1, - 75, -1, -1, -1, 79, -1, -1, -1, 83, 84, - 85, 86, 87, 88, 145, -1, 147, -1, -1, 94, - 95, 96, 97, -1, -1, -1, -1, -1, 103, 104, - 49, 50, 107, 108, -1, -1, -1, 112, -1, 58, - -1, -1, 117, 118, -1, 120, -1, 66, -1, 68, - 69, 70, 71, 128, -1, -1, 75, -1, -1, -1, - 79, -1, -1, 50, 83, 84, 85, 86, 87, 88, - 145, 58, 147, -1, -1, 94, 95, 96, 97, -1, - -1, 68, 69, 70, 103, 104, -1, -1, 107, 108, - -1, -1, 79, 112, -1, -1, -1, -1, 117, 118, - 87, 120, -1, -1, -1, -1, -1, -1, -1, 50, - 97, -1, -1, -1, -1, -1, 103, 58, -1, -1, - -1, 108, -1, -1, -1, -1, 145, 68, 69, 70, - 117, 118, -1, 120, -1, 50, -1, -1, 79, -1, - -1, -1, -1, 58, -1, -1, 87, -1, 135, -1, - -1, -1, -1, 68, 69, 70, 97, -1, 145, -1, - -1, -1, 103, -1, 79, -1, 107, 108, -1, -1, - -1, -1, 87, 88, -1, -1, 117, 118, 50, 120, - -1, -1, 97, -1, -1, -1, 58, -1, 103, -1, - -1, -1, -1, 108, -1, -1, 68, 69, 70, -1, - -1, -1, -1, 118, 145, 120, -1, 79, -1, -1, - -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, - 145, 103, -1, -1, -1, -1, 108, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 118, -1, 120, -1, + -1, -1, -1, -1, -1, 10, 11, 12, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 48, 49, + -1, -1, 52, -1, 54, 55, 56, 57, 58, -1, + 60, 61, -1, 1219, 64, 65, -1, -1, 68, -1, + -1, -1, -1, 73, 74, 75, -1, -1, -1, 79, + -1, -1, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 74, + 75, 17, -1, -1, -1, -1, 106, -1, 108, -1, + 110, -1, -1, -1, -1, 115, -1, 117, 118, 119, + -1, -1, 122, 123, -1, -1, -1, 127, -1, -1, + 130, 131, 132, 133, 134, 110, 111, 137, 113, 139, + -1, -1, 58, 118, -1, 120, -1, -1, 1304, 1305, + 1306, 1307, 152, 1309, 1310, 155, 156, 157, 74, -1, + 160, -1, 162, 163, -1, -1, -1, 167, 3, 4, + 5, 6, 147, 8, 9, 10, 11, -1, 10, 11, + 12, -1, -1, -1, -1, -1, -1, -1, 104, -1, + -1, 107, -1, -1, 110, -1, -1, -1, -1, -1, + -1, 16, 17, 18, 19, 20, 21, 22, 23, -1, + 126, -1, -1, 48, -1, -1, -1, 52, 33, 54, + 55, 56, 138, -1, -1, 60, -1, 62, 63, 64, + 65, -1, -1, -1, -1, -1, 152, -1, 73, 74, + 75, -1, 74, 75, 79, -1, -1, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, -1, 10, 11, 12, -1, -1, + -1, 106, -1, 108, -1, 110, -1, -1, 110, 111, + 115, 113, 117, 118, 119, -1, 118, 122, 120, -1, + -1, -1, 127, -1, -1, 130, -1, -1, -1, 134, + 3, 4, 5, 6, 139, 8, 9, 10, 11, 144, + -1, -1, 144, -1, -1, -1, -1, 152, -1, -1, + 155, 156, 157, -1, -1, 160, -1, 162, 163, 74, + 75, 146, 167, -1, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 48, 161, 162, 163, 52, + -1, 54, 55, 56, -1, -1, -1, 60, -1, -1, + -1, 64, 65, -1, -1, 110, 111, -1, 113, -1, + 73, 74, 75, 118, -1, 120, 79, -1, -1, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, -1, -1, -1, 144, + -1, -1, -1, 106, -1, 108, -1, 110, -1, -1, + -1, -1, 115, -1, 117, 118, 119, -1, -1, 122, + -1, -1, -1, -1, 127, -1, -1, 130, -1, -1, + -1, 134, 3, 4, 5, 6, 139, 8, 9, 10, + 11, -1, 10, 11, 12, -1, -1, 15, -1, 152, + -1, -1, 155, 156, 157, -1, -1, 160, -1, 162, + 163, 164, -1, -1, 167, 16, 17, 18, 19, 20, + 21, 22, 23, -1, -1, -1, -1, 48, -1, -1, + -1, 52, 33, 54, 55, 56, -1, -1, -1, 60, + -1, -1, -1, 64, 65, -1, -1, -1, -1, -1, + -1, -1, 73, 74, 75, -1, 74, 75, 79, -1, + -1, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, -1, -1, + -1, -1, -1, -1, -1, 106, -1, 108, -1, 110, + -1, -1, 110, 111, 115, 113, 117, 118, 119, -1, + 118, 122, 120, -1, -1, -1, 127, -1, -1, 130, + -1, -1, -1, 134, 3, 4, 5, 6, 139, 8, + 9, 10, 11, 144, 10, 11, 12, -1, -1, -1, + -1, 152, -1, -1, 155, 156, 157, -1, -1, 160, + -1, 162, 163, -1, 145, -1, 167, -1, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 48, + 161, 162, 163, 52, -1, 54, 55, 56, -1, -1, + -1, 60, -1, -1, -1, 64, 65, -1, -1, -1, + -1, -1, -1, -1, 73, 74, 75, -1, 74, 75, + 79, -1, -1, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + -1, -1, -1, -1, -1, -1, -1, 106, -1, 108, + -1, 110, -1, -1, 110, 111, 115, 113, 117, 118, + 119, -1, 118, 122, 120, -1, -1, -1, 127, -1, + -1, 130, -1, -1, -1, 134, 3, 4, 5, 6, + 139, 8, 9, 10, 11, -1, -1, -1, -1, -1, + -1, -1, -1, 152, -1, -1, 155, 156, 157, -1, + -1, 160, -1, 162, 163, 164, -1, -1, 167, 16, + 17, 18, 19, 20, 21, 22, 23, -1, -1, -1, + -1, 48, -1, -1, -1, 52, 33, 54, 55, 56, + -1, -1, -1, 60, -1, -1, -1, 64, 65, -1, + -1, -1, -1, -1, -1, -1, 73, 74, 75, -1, + -1, -1, 79, -1, -1, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, -1, 10, 11, 12, -1, -1, -1, 106, + -1, 108, -1, 110, -1, -1, -1, -1, 115, -1, + 117, 118, 119, -1, -1, 122, -1, -1, -1, -1, + 127, -1, -1, 130, -1, -1, -1, 134, 3, 4, + 5, 6, 139, 8, 9, 10, 11, 144, -1, -1, + -1, -1, -1, -1, -1, 152, -1, -1, 155, 156, + 157, -1, -1, 160, -1, 162, 163, 74, 75, -1, + 167, -1, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 48, 161, 162, 163, 52, -1, 54, + 55, 56, -1, -1, -1, 60, -1, -1, 105, 64, + 65, -1, -1, 110, 111, -1, 113, -1, 73, 74, + 75, 118, -1, 120, 79, -1, -1, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, -1, -1, -1, -1, -1, -1, + -1, 106, -1, 108, -1, 110, -1, -1, -1, -1, + 115, -1, 117, 118, 119, -1, -1, 122, -1, -1, + -1, -1, 127, -1, -1, 130, -1, -1, -1, 134, + 3, 4, 5, 6, 139, 8, 9, 10, 11, -1, + -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, + 155, 156, 157, -1, -1, 160, -1, 162, 163, 164, + -1, -1, 167, 20, 21, 22, 23, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 33, -1, -1, 52, + -1, 54, 55, 56, -1, -1, -1, 60, -1, -1, + -1, 64, 65, -1, -1, -1, -1, -1, -1, -1, + 73, 74, 75, -1, -1, -1, 79, -1, -1, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, -1, -1, 6, -1, + -1, -1, -1, 106, -1, 108, -1, 110, -1, -1, + -1, -1, 115, -1, 117, 118, 119, -1, -1, 122, + -1, -1, -1, -1, 127, -1, -1, 130, -1, -1, + -1, 134, 3, 4, 5, 6, 139, 8, 9, 10, + 11, 12, -1, 51, 15, -1, -1, -1, -1, 152, + 58, 59, 155, 156, 157, -1, -1, 160, -1, 162, + 163, 69, 70, 71, 167, -1, 153, 154, 155, 156, + 157, 158, 159, 81, 161, 162, 163, 48, 49, -1, + -1, 52, -1, 54, 55, 56, 57, 58, -1, 60, + 61, -1, -1, 64, 65, -1, 104, 68, -1, -1, + -1, -1, 73, 74, 75, -1, 114, -1, -1, -1, + -1, 82, 120, -1, -1, -1, -1, 125, 17, 18, + 19, 20, 21, 22, 23, -1, -1, 98, 136, -1, + 138, -1, -1, -1, 33, 106, -1, 108, -1, 110, + -1, -1, -1, 114, 115, -1, 117, 118, 119, -1, + -1, 122, 123, -1, -1, 163, 127, -1, -1, 130, + 131, 132, 133, 134, -1, -1, 137, -1, 139, -1, + 3, 4, 5, 6, -1, 8, 9, 10, 11, 12, + -1, 152, 15, -1, 155, 156, -1, -1, -1, 160, + -1, 162, -1, -1, -1, -1, 167, -1, -1, -1, + -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, + 23, -1, -1, -1, -1, 48, 49, -1, -1, 52, + 33, 54, 55, 56, 57, 58, -1, 60, 61, -1, + -1, 64, 65, -1, -1, 68, -1, -1, 17, -1, + 73, 74, 75, -1, -1, -1, -1, -1, -1, 82, + -1, 150, 151, 152, 33, -1, 155, 156, 157, 158, + 159, -1, 161, 162, 163, 98, -1, -1, -1, -1, + -1, -1, -1, 106, -1, 108, -1, 110, -1, 58, + -1, 114, 115, -1, 117, 118, 119, -1, -1, 122, + 123, -1, -1, -1, 127, 74, -1, 130, 131, 132, + 133, 134, -1, -1, 137, -1, 139, 3, 4, 5, + 6, -1, 8, 9, 10, -1, -1, -1, -1, 152, + -1, -1, 155, 156, -1, 104, -1, 160, 107, 162, + -1, 110, -1, -1, 167, -1, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 126, 161, 162, + 163, -1, 48, 166, -1, -1, -1, -1, -1, 138, + -1, -1, -1, -1, 60, -1, -1, -1, -1, 65, + -1, -1, -1, 152, 0, -1, -1, 73, 74, -1, + -1, -1, -1, 79, -1, -1, -1, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 108, -1, 110, -1, -1, -1, -1, 115, + -1, -1, -1, 119, 50, 51, 122, -1, -1, -1, + -1, 127, 58, 59, 18, 19, 20, 21, 22, 23, + -1, 67, -1, 69, 70, 71, 72, -1, -1, 33, + 76, -1, -1, -1, -1, 81, 152, -1, -1, 155, + 156, 157, -1, -1, 160, -1, 162, 163, -1, -1, + -1, 167, -1, -1, 100, 101, 102, 103, 104, 105, + -1, -1, -1, -1, -1, 111, 112, 113, 114, 11, + -1, -1, -1, -1, 120, 121, -1, -1, 124, 125, + -1, -1, -1, 129, -1, -1, -1, -1, -1, 135, + 136, 6, 138, -1, -1, -1, -1, -1, -1, -1, + 146, 16, 17, 18, 19, 20, 21, 22, 23, -1, + 52, -1, 54, 55, 56, -1, -1, 163, 33, -1, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, -1, -1, -1, -1, -1, -1, -1, -1, + 82, -1, -1, -1, -1, -1, -1, -1, 63, 153, + 154, 155, 156, 157, 158, 159, 98, 161, 162, 163, + -1, -1, 10, 11, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 117, 118, -1, -1, -1, + -1, 16, 17, 18, 19, 20, 21, 22, 23, -1, + -1, 106, 134, -1, -1, -1, -1, 139, 33, -1, + -1, 49, -1, -1, 52, -1, 54, 55, 56, 57, + -1, -1, -1, 61, -1, -1, 64, -1, -1, -1, + 68, -1, -1, -1, -1, -1, -1, 75, -1, -1, + 145, -1, -1, 148, 82, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, -1, 162, 163, -1, + 98, -1, 167, 10, 11, -1, -1, -1, -1, -1, + -1, 109, -1, -1, -1, -1, -1, -1, -1, 117, + 118, -1, -1, -1, -1, 123, -1, -1, -1, -1, + -1, -1, -1, 131, 132, 133, 134, -1, -1, 137, + -1, 139, 49, 10, 11, 52, 144, 54, 55, 56, + 57, -1, -1, -1, 61, -1, -1, 64, -1, -1, + -1, 68, 160, -1, 149, 150, 151, 152, 75, -1, + 155, 156, 157, 158, 159, 82, 161, 162, 163, -1, + -1, -1, 49, -1, -1, 52, -1, 54, 55, 56, + 57, 98, -1, -1, 61, -1, -1, 64, -1, -1, + -1, 68, 109, -1, -1, -1, -1, -1, 75, -1, + 117, 118, -1, -1, -1, 82, 123, 10, 11, 12, + -1, -1, -1, -1, 131, 132, 133, 134, -1, -1, + 137, 98, 139, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, + 117, 118, -1, 160, -1, -1, 123, -1, -1, 52, + -1, 54, 55, 56, 131, 132, 133, 134, -1, -1, + 137, 64, 139, 16, 17, 18, 19, 20, 21, 22, + 23, -1, 75, -1, -1, -1, -1, -1, -1, 82, + 33, -1, -1, 160, 16, 17, 18, 19, 20, 21, + 22, 23, -1, -1, -1, 98, -1, -1, -1, -1, + -1, 33, 16, 17, 18, 19, 20, 21, 22, 23, + -1, -1, -1, -1, 117, 118, -1, -1, -1, 33, + 16, 17, 18, 19, 20, 21, 22, 23, -1, -1, + -1, 134, -1, -1, 137, -1, 139, 33, 16, 17, + 18, 19, 20, 21, 22, 23, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 33, 16, 17, 18, 19, + 20, 21, 22, 23, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, 16, 17, 18, 19, 20, 21, + 22, 23, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 33, -1, -1, -1, -1, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, -1, 161, 162, + 163, -1, -1, 166, -1, -1, -1, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, -1, 161, + 162, 163, 164, -1, -1, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, -1, 161, 162, 163, + 164, -1, -1, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, -1, 161, 162, 163, 164, -1, + -1, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, -1, 161, 162, 163, 164, -1, -1, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + -1, 161, 162, 163, 164, 147, -1, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, -1, 161, + 162, 163, 16, 17, 18, 19, 20, 21, 22, 23, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, + 16, 17, 18, 19, 20, 21, 22, 23, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 33, 16, 17, + 18, 19, 20, 21, 22, 23, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, 18, 19, 20, 21, 22, 23, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 33, 18, 19, 20, + 21, 22, 23, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 18, 19, + 20, 21, 22, 23, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 147, -1, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, -1, 161, 162, 163, + -1, -1, -1, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, -1, 161, 162, 163, -1, 147, + -1, 149, 150, 151, 152, -1, -1, 155, 156, 157, + 158, 159, -1, 161, 162, 163, 11, 12, -1, -1, + 15, -1, 17, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, -1, 161, 162, 163, -1, -1, -1, + -1, 152, 153, 154, 155, 156, 157, 158, 159, -1, + 161, 162, 163, -1, 49, -1, -1, 52, -1, 54, + 55, 56, 57, 58, -1, -1, 61, -1, -1, 64, + 150, 151, 152, 68, -1, 155, 156, 157, 158, 159, + 75, 161, 162, 163, -1, -1, -1, 82, -1, 18, + 19, 20, 21, 22, 23, -1, 10, 11, 12, -1, + -1, -1, -1, 98, 33, 18, 19, 20, 21, 22, + 23, -1, -1, -1, -1, -1, -1, -1, -1, 114, + 33, -1, 117, 118, -1, -1, -1, -1, 123, -1, + 18, 19, 20, 21, 22, 23, 131, 132, 133, 134, + -1, -1, 137, 57, 139, 33, -1, -1, -1, 52, + -1, 54, 55, 56, -1, -1, -1, 152, -1, -1, + 74, 75, 157, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 98, 110, 111, -1, 113, + -1, -1, -1, -1, 118, -1, 120, -1, -1, 123, + -1, 10, 11, 12, 117, 118, -1, 131, -1, 133, + -1, -1, 151, 152, -1, -1, 155, 156, 157, 158, + 159, 134, 161, 162, 163, -1, 139, -1, -1, 152, + -1, -1, 155, 156, 157, 158, 159, -1, 161, 162, + 163, -1, -1, 52, -1, 54, 55, 56, 57, 58, + 11, 12, -1, -1, 15, 64, -1, 155, 156, 157, + 158, 159, -1, 161, 162, 163, 75, -1, -1, -1, + -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 49, 98, + -1, 52, -1, 54, 55, 56, 57, 58, -1, -1, + 61, -1, -1, 64, -1, -1, -1, 68, 117, 118, + -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, + -1, 82, 131, -1, -1, 134, -1, -1, 137, -1, + 139, -1, -1, -1, -1, -1, -1, 98, -1, 11, + 12, -1, -1, 15, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 114, -1, -1, 117, 118, -1, -1, + -1, -1, 123, -1, -1, -1, -1, -1, 11, 12, + 131, 132, 133, 134, -1, -1, 137, 49, 139, -1, + 52, -1, 54, 55, 56, 57, 58, -1, -1, 61, + -1, -1, 64, -1, -1, -1, 68, -1, -1, -1, + -1, -1, -1, 75, -1, -1, 49, -1, -1, 52, + 82, 54, 55, 56, 57, 58, -1, -1, 61, -1, + -1, 64, -1, -1, -1, 68, 98, -1, -1, -1, + -1, -1, 75, -1, -1, -1, -1, -1, -1, 82, + -1, -1, 114, -1, -1, 117, 118, -1, -1, -1, + -1, 123, -1, -1, -1, 98, -1, 11, 12, 131, + 132, 133, 134, -1, -1, 137, -1, 139, -1, -1, + -1, 114, -1, -1, 117, 118, -1, -1, -1, -1, + 123, 11, 12, -1, -1, -1, -1, -1, 131, 132, + 133, 134, -1, -1, 137, 49, 139, -1, 52, -1, + 54, 55, 56, 57, 58, -1, -1, 61, -1, 52, + 64, 54, 55, 56, 68, -1, -1, -1, -1, 49, + -1, 75, 52, -1, 54, 55, 56, 57, 82, -1, + -1, 61, -1, -1, 64, -1, -1, -1, 68, 82, + -1, -1, -1, -1, 98, 75, -1, -1, -1, -1, + -1, -1, 82, -1, -1, 98, -1, -1, -1, -1, + -1, -1, -1, 117, 118, -1, -1, -1, 98, 123, + 11, 12, -1, -1, 117, 118, -1, 131, 132, 133, + 134, -1, -1, 137, 114, 139, -1, 117, 118, -1, + -1, 134, -1, 123, -1, -1, 139, -1, -1, 11, + -1, 131, 132, 133, 134, -1, -1, 137, 49, 139, + -1, 52, -1, 54, 55, 56, 57, -1, -1, 162, + 61, -1, -1, 64, -1, -1, -1, 68, -1, -1, + -1, -1, -1, -1, 75, -1, -1, 49, -1, -1, + 52, 82, 54, 55, 56, 57, 58, -1, -1, 61, + -1, -1, 64, -1, -1, -1, 68, 98, -1, -1, + -1, -1, -1, 75, -1, -1, -1, -1, -1, -1, + 82, -1, -1, -1, -1, -1, 117, 118, -1, -1, + -1, -1, 123, -1, -1, 11, 98, -1, -1, -1, + 131, 132, 133, 134, -1, -1, 137, -1, 139, -1, + -1, -1, -1, -1, -1, 117, 118, -1, -1, 11, + -1, 123, -1, -1, -1, -1, -1, -1, -1, 131, + 132, 133, 134, 49, -1, 137, 52, 139, 54, 55, + 56, 57, 58, -1, -1, 61, -1, -1, 64, -1, + -1, -1, 68, -1, -1, -1, -1, 49, -1, 75, + 52, -1, 54, 55, 56, 57, 82, -1, -1, 61, + -1, -1, 64, -1, -1, -1, 68, -1, -1, -1, + -1, -1, 98, 75, -1, -1, -1, -1, -1, -1, + 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 117, 118, -1, -1, 11, 98, 123, -1, -1, + -1, -1, -1, -1, -1, 131, 132, 133, 134, -1, + -1, 137, -1, 139, -1, 117, 118, -1, -1, -1, + -1, 123, -1, -1, 10, 11, 12, -1, -1, 131, + 132, 133, 134, 49, -1, 137, 52, 139, 54, 55, + 56, 57, -1, -1, -1, 61, -1, -1, 64, -1, + -1, -1, 68, -1, -1, -1, -1, -1, -1, 75, + -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, + -1, 57, -1, -1, -1, 10, 11, 12, -1, -1, + -1, -1, 98, 52, -1, 54, 55, 56, 74, 75, + -1, -1, -1, -1, 10, 11, 12, -1, -1, -1, + -1, 117, 118, -1, -1, -1, -1, 123, 10, 11, + 12, -1, -1, 82, -1, 131, 132, 133, 134, -1, + -1, 137, 57, 139, 110, 111, 112, 113, -1, 98, + -1, -1, 118, -1, 120, -1, -1, 123, -1, 74, + 75, 57, -1, -1, -1, 131, -1, 133, 117, 118, + 136, -1, -1, -1, -1, 57, -1, -1, 74, 75, + -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, + 139, -1, 74, 75, -1, 110, 111, -1, 113, -1, + -1, -1, -1, 118, -1, 120, -1, -1, 123, -1, + -1, -1, -1, 162, 110, 111, 131, 113, 133, -1, + -1, 136, 118, -1, 120, -1, -1, 123, 110, 111, + -1, 113, -1, -1, -1, 131, 118, 133, 120, -1, + 136, 123, -1, -1, 50, 51, -1, -1, -1, 131, + -1, 133, 58, 59, 136, -1, -1, -1, -1, -1, + -1, 67, -1, 69, 70, 71, 72, -1, -1, -1, + 76, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 145 + -1, -1, -1, -1, 100, 101, 102, 103, 104, 105, + -1, -1, -1, -1, -1, 111, 112, 113, 114, -1, + -1, -1, -1, -1, 120, 121, 50, 51, 124, 125, + -1, -1, -1, 129, 58, 59, -1, -1, -1, 135, + 136, -1, 138, 67, -1, 69, 70, 71, 72, -1, + 146, -1, 76, -1, -1, -1, -1, 81, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 163, -1, 165, + -1, -1, -1, -1, -1, -1, 100, 101, 102, 103, + 104, 105, -1, -1, -1, -1, -1, 111, 112, 113, + 114, -1, -1, -1, -1, -1, 120, 121, 50, 51, + 124, 125, -1, -1, -1, 129, 58, 59, -1, -1, + -1, 135, 136, -1, 138, 67, -1, 69, 70, 71, + 72, -1, 146, -1, 76, -1, -1, -1, -1, 81, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, + -1, 165, -1, -1, -1, -1, -1, -1, 100, 101, + 102, 103, 104, 105, -1, -1, -1, -1, -1, 111, + 112, 113, 114, -1, -1, -1, -1, -1, 120, 121, + 50, 51, 124, 125, -1, -1, -1, 129, 58, 59, + -1, -1, -1, 135, 136, -1, 138, 67, -1, 69, + 70, 71, 72, -1, 146, -1, 76, -1, -1, -1, + -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 163, -1, 165, -1, -1, -1, -1, -1, -1, + 100, 101, 102, 103, 104, 105, -1, -1, -1, -1, + -1, 111, 112, 113, 114, -1, -1, -1, -1, -1, + 120, 121, 50, 51, 124, 125, -1, -1, -1, 129, + 58, 59, -1, -1, -1, 135, 136, -1, 138, 67, + -1, 69, 70, 71, 72, -1, 146, -1, 76, -1, + -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 163, -1, 165, -1, -1, -1, -1, + -1, -1, 100, 101, 102, 103, 104, 105, -1, -1, + -1, -1, -1, 111, 112, 113, 114, -1, -1, -1, + -1, -1, 120, 121, 50, 51, 124, 125, -1, -1, + -1, 129, 58, 59, -1, -1, -1, 135, 136, -1, + 138, 67, -1, 69, 70, 71, 72, -1, 146, -1, + 76, -1, -1, -1, -1, 81, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 163, -1, 165, -1, -1, + -1, -1, -1, -1, 100, 101, 102, 103, 104, 105, + -1, -1, -1, -1, -1, 111, 112, 113, 114, -1, + -1, -1, -1, -1, 120, 121, 50, 51, 124, 125, + -1, -1, -1, 129, 58, 59, -1, -1, -1, 135, + 136, -1, 138, 67, -1, 69, 70, 71, 72, -1, + 146, -1, 76, -1, -1, -1, -1, 81, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 163, -1, 165, + -1, -1, -1, -1, -1, -1, 100, 101, 102, 103, + 104, 105, -1, -1, -1, -1, -1, 111, 112, 113, + 114, -1, -1, -1, -1, -1, 120, 121, 50, 51, + 124, 125, -1, -1, -1, 129, 58, 59, -1, -1, + -1, 135, 136, -1, 138, 67, -1, 69, 70, 71, + 72, -1, 146, -1, 76, 51, -1, -1, -1, 81, + -1, -1, 58, 59, -1, -1, -1, -1, -1, 163, + -1, 165, -1, 69, 70, 71, -1, -1, 100, 101, + 102, 103, 104, 105, -1, 81, -1, -1, -1, 111, + 112, 113, 114, -1, -1, -1, -1, -1, 120, 121, + -1, -1, 124, 125, -1, -1, -1, 129, 104, -1, + -1, -1, -1, 135, 136, 51, 138, -1, 114, -1, + -1, -1, 58, 59, 120, -1, -1, -1, -1, 125, + -1, -1, -1, 69, 70, 71, -1, -1, -1, 135, + 136, 163, 138, 51, -1, 81, -1, -1, -1, -1, + 58, 59, 51, -1, -1, -1, -1, 153, -1, 58, + 59, 69, 70, 71, -1, -1, -1, 163, 104, -1, + 69, 70, 71, 81, -1, -1, -1, -1, 114, -1, + -1, -1, 81, 52, 120, 54, 55, 56, 124, 125, + -1, -1, -1, -1, -1, 64, 104, 105, -1, 135, + 136, -1, 138, -1, -1, 104, 114, -1, -1, -1, + -1, -1, 120, 82, -1, 114, 52, 125, 54, 55, + 56, 120, -1, -1, -1, -1, 125, 163, 136, 98, + 138, -1, -1, -1, -1, -1, -1, 136, -1, 138, + -1, -1, -1, -1, -1, -1, 82, -1, 117, 118, + -1, -1, -1, -1, -1, 163, -1, -1, -1, -1, + -1, -1, 98, -1, 163, 134, -1, -1, -1, -1, + 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 117, 118, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 162, -1, -1, -1, -1, 134, -1, + -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 162 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 123, 124, 125, 151, 152, 258, 3, 4, 5, - 6, 8, 9, 10, 11, 47, 51, 53, 54, 55, - 59, 63, 64, 72, 73, 74, 80, 81, 89, 91, - 93, 98, 100, 101, 102, 105, 110, 113, 116, 121, - 134, 137, 138, 139, 142, 144, 145, 149, 248, 249, - 257, 11, 48, 51, 53, 54, 55, 56, 57, 60, - 63, 67, 74, 80, 81, 100, 101, 106, 114, 115, - 116, 119, 121, 212, 216, 217, 219, 225, 226, 230, - 231, 236, 237, 238, 239, 0, 49, 50, 58, 66, - 68, 69, 70, 71, 75, 79, 83, 84, 85, 86, - 87, 88, 94, 95, 96, 97, 103, 104, 107, 108, - 112, 117, 118, 120, 128, 145, 155, 157, 158, 160, - 163, 164, 186, 232, 235, 258, 144, 144, 144, 144, - 144, 144, 135, 144, 135, 144, 144, 144, 11, 48, - 60, 114, 214, 230, 231, 236, 135, 144, 144, 144, - 135, 144, 144, 144, 248, 248, 248, 248, 248, 11, - 51, 53, 54, 55, 63, 74, 80, 81, 100, 101, - 116, 121, 216, 246, 248, 10, 11, 73, 74, 93, - 94, 96, 101, 103, 130, 134, 252, 253, 255, 258, - 248, 15, 16, 17, 18, 19, 20, 21, 22, 32, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 143, 144, 145, 6, 8, 212, 144, 56, 106, - 63, 81, 237, 237, 237, 255, 237, 12, 16, 57, - 120, 134, 139, 144, 210, 211, 258, 126, 10, 11, - 93, 129, 256, 10, 11, 93, 126, 255, 256, 79, - 160, 160, 160, 6, 160, 160, 129, 159, 88, 160, - 144, 144, 144, 144, 160, 126, 255, 129, 129, 129, - 160, 160, 144, 160, 163, 187, 160, 160, 169, 88, - 255, 160, 160, 145, 10, 11, 48, 57, 60, 92, - 114, 126, 142, 174, 177, 213, 215, 217, 219, 225, - 230, 231, 236, 245, 246, 258, 216, 245, 245, 245, - 245, 216, 245, 216, 245, 245, 245, 144, 255, 144, - 255, 255, 216, 245, 245, 216, 216, 216, 248, 245, - 245, 146, 127, 146, 255, 148, 127, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 146, 246, - 248, 211, 248, 139, 12, 16, 57, 120, 134, 139, - 210, 258, 210, 211, 210, 211, 210, 210, 14, 16, - 57, 97, 134, 139, 196, 197, 206, 212, 258, 145, - 228, 229, 258, 11, 227, 237, 129, 218, 220, 160, - 157, 126, 255, 255, 255, 255, 255, 152, 126, 248, - 135, 10, 11, 57, 177, 213, 215, 255, 128, 130, - 161, 162, 255, 144, 144, 10, 11, 215, 144, 57, - 212, 255, 156, 255, 126, 128, 129, 130, 202, 126, - 128, 130, 203, 128, 165, 255, 256, 255, 146, 146, - 146, 146, 146, 146, 136, 146, 136, 146, 146, 146, - 248, 245, 136, 146, 146, 146, 136, 146, 146, 146, - 146, 248, 248, 57, 144, 183, 258, 252, 129, 146, - 148, 146, 210, 139, 210, 210, 210, 210, 210, 145, - 210, 97, 212, 206, 210, 210, 146, 14, 127, 12, - 16, 57, 120, 134, 139, 144, 209, 256, 258, 244, - 248, 258, 255, 147, 227, 152, 73, 221, 258, 152, - 126, 127, 127, 127, 127, 147, 233, 127, 146, 10, - 11, 56, 57, 114, 188, 189, 190, 191, 236, 258, - 144, 215, 203, 170, 128, 216, 148, 127, 144, 175, - 12, 139, 176, 166, 248, 212, 12, 16, 57, 120, - 134, 139, 208, 256, 258, 152, 144, 240, 241, 153, - 154, 255, 61, 62, 240, 61, 62, 126, 248, 12, - 16, 57, 92, 120, 134, 139, 144, 167, 192, 194, - 256, 129, 144, 144, 146, 146, 144, 144, 196, 32, - 73, 87, 90, 93, 109, 195, 258, 248, 210, 244, - 146, 212, 209, 146, 146, 183, 14, 206, 139, 209, - 209, 209, 209, 209, 209, 130, 145, 201, 258, 148, - 127, 130, 147, 129, 222, 223, 258, 147, 234, 10, - 10, 10, 10, 152, 257, 128, 255, 191, 255, 136, - 127, 209, 171, 172, 194, 128, 148, 161, 3, 4, - 5, 9, 10, 14, 47, 59, 64, 72, 73, 89, - 91, 93, 98, 102, 105, 110, 113, 134, 137, 138, - 142, 144, 149, 198, 199, 206, 207, 250, 251, 257, - 258, 196, 139, 192, 196, 168, 194, 146, 208, 139, - 208, 208, 208, 208, 208, 144, 145, 147, 178, 147, - 242, 258, 126, 127, 126, 144, 128, 128, 147, 128, - 128, 126, 204, 205, 248, 258, 128, 139, 192, 192, - 6, 15, 16, 17, 18, 19, 20, 21, 22, 32, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 62, 89, 127, 130, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 144, 145, 149, - 184, 192, 192, 192, 192, 129, 144, 145, 195, 130, - 201, 203, 227, 246, 246, 246, 246, 146, 57, 214, - 144, 126, 148, 144, 209, 201, 144, 144, 195, 209, - 146, 248, 244, 248, 94, 95, 96, 114, 118, 224, - 231, 254, 255, 126, 127, 152, 127, 146, 127, 127, - 127, 147, 146, 130, 209, 130, 163, 185, 186, 190, - 130, 200, 258, 173, 194, 201, 203, 160, 144, 135, - 135, 214, 135, 144, 135, 144, 248, 248, 248, 248, - 216, 246, 248, 146, 14, 127, 15, 16, 17, 18, - 19, 20, 21, 22, 32, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 143, 144, 145, 146, - 192, 146, 146, 201, 203, 144, 208, 181, 244, 196, + 0, 141, 142, 143, 169, 170, 274, 3, 4, 5, + 6, 8, 9, 10, 11, 48, 52, 54, 55, 56, + 60, 64, 65, 73, 74, 75, 79, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 106, 108, 110, 115, 117, 118, + 119, 122, 127, 130, 134, 139, 152, 155, 156, 157, + 160, 162, 163, 167, 264, 265, 273, 11, 12, 49, + 52, 54, 55, 56, 57, 58, 61, 64, 68, 75, + 82, 98, 117, 118, 123, 131, 132, 133, 134, 137, + 139, 227, 228, 232, 233, 235, 241, 242, 246, 247, + 252, 253, 254, 255, 0, 50, 51, 58, 59, 67, + 69, 70, 71, 72, 76, 81, 100, 101, 102, 103, + 104, 105, 111, 112, 113, 114, 120, 121, 124, 125, + 129, 135, 136, 138, 146, 163, 173, 175, 176, 178, + 181, 199, 248, 251, 274, 162, 162, 162, 162, 162, + 162, 153, 162, 153, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 11, 49, 61, 131, 132, 230, 246, + 247, 252, 153, 162, 162, 15, 162, 153, 162, 162, + 162, 264, 264, 264, 264, 264, 11, 52, 54, 55, + 56, 64, 75, 82, 98, 117, 118, 134, 139, 232, + 262, 264, 10, 11, 12, 74, 75, 110, 111, 113, + 118, 120, 148, 152, 268, 269, 271, 274, 264, 16, + 17, 18, 19, 20, 21, 22, 23, 33, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 161, + 162, 163, 6, 8, 227, 228, 162, 57, 123, 64, + 98, 253, 253, 253, 271, 162, 253, 13, 15, 17, + 58, 138, 152, 157, 162, 225, 226, 274, 226, 144, + 10, 11, 12, 110, 147, 272, 10, 11, 12, 110, + 144, 271, 272, 81, 178, 178, 178, 178, 6, 178, + 178, 147, 177, 105, 178, 162, 162, 162, 162, 178, + 144, 271, 147, 147, 147, 178, 178, 162, 178, 181, + 200, 178, 178, 184, 105, 271, 178, 178, 163, 10, + 11, 49, 61, 109, 131, 132, 144, 160, 187, 190, + 229, 231, 233, 235, 241, 246, 247, 252, 261, 262, + 274, 232, 261, 261, 261, 261, 232, 261, 232, 261, + 232, 261, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 261, 162, 271, + 162, 162, 271, 271, 232, 261, 261, 162, 232, 232, + 232, 264, 261, 261, 164, 145, 164, 271, 166, 145, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 164, 262, 264, 226, 226, 264, 232, 157, 271, + 13, 15, 17, 58, 138, 152, 157, 225, 274, 225, + 226, 225, 226, 225, 225, 15, 17, 58, 114, 152, + 157, 210, 211, 220, 227, 228, 274, 163, 244, 245, + 274, 11, 243, 253, 147, 234, 236, 178, 175, 144, + 271, 271, 271, 271, 271, 170, 144, 264, 153, 10, + 11, 190, 229, 231, 271, 146, 148, 179, 180, 271, + 162, 162, 162, 58, 227, 271, 162, 174, 271, 144, + 146, 147, 148, 216, 144, 146, 148, 217, 146, 182, + 271, 272, 271, 164, 164, 164, 164, 164, 164, 154, + 164, 154, 164, 164, 164, 164, 145, 164, 145, 164, + 145, 164, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 264, 232, 261, 154, 164, 164, 271, 164, + 154, 164, 164, 164, 164, 264, 264, 162, 196, 274, + 268, 147, 164, 166, 164, 164, 225, 157, 271, 225, + 225, 225, 225, 225, 163, 225, 114, 227, 228, 220, + 225, 225, 164, 15, 145, 13, 17, 58, 138, 152, + 157, 162, 223, 272, 274, 13, 15, 17, 58, 138, + 152, 157, 162, 224, 260, 264, 274, 271, 165, 243, + 170, 74, 237, 274, 170, 144, 145, 145, 145, 145, + 165, 249, 145, 164, 10, 11, 12, 57, 58, 131, + 201, 202, 203, 204, 205, 252, 274, 162, 217, 185, + 146, 232, 166, 145, 162, 188, 13, 157, 189, 264, + 227, 13, 17, 58, 138, 152, 157, 222, 272, 274, + 232, 170, 162, 256, 257, 171, 172, 271, 62, 63, + 256, 62, 63, 144, 264, 13, 17, 58, 109, 138, + 152, 157, 162, 183, 206, 208, 272, 147, 162, 162, + 232, 232, 232, 164, 164, 164, 162, 164, 162, 210, + 17, 33, 58, 74, 104, 107, 110, 126, 138, 152, + 209, 274, 264, 225, 260, 164, 227, 228, 223, 224, + 164, 164, 196, 15, 220, 157, 223, 223, 223, 223, + 223, 223, 148, 163, 215, 274, 157, 271, 224, 224, + 224, 224, 224, 224, 163, 215, 166, 145, 148, 165, + 147, 238, 239, 274, 165, 250, 10, 10, 10, 10, + 170, 273, 146, 205, 154, 145, 15, 271, 13, 17, + 58, 138, 152, 157, 162, 223, 224, 186, 208, 146, + 166, 179, 3, 4, 5, 9, 10, 15, 48, 60, + 65, 73, 74, 106, 108, 110, 115, 119, 122, 127, + 130, 152, 155, 156, 160, 162, 167, 212, 213, 220, + 221, 266, 267, 273, 274, 210, 157, 206, 210, 164, + 222, 157, 222, 222, 222, 222, 222, 162, 163, 164, + 165, 191, 165, 258, 274, 144, 145, 144, 162, 146, + 146, 165, 146, 146, 144, 218, 219, 264, 274, 146, + 157, 206, 206, 6, 16, 17, 18, 19, 20, 21, + 22, 23, 33, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 63, 106, 145, 148, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 162, 163, 167, 197, 206, 206, 206, 206, 147, 162, + 163, 209, 148, 215, 217, 243, 262, 262, 164, 164, + 164, 262, 262, 164, 58, 230, 162, 144, 166, 162, + 223, 224, 215, 215, 162, 162, 209, 223, 164, 264, + 260, 224, 164, 260, 264, 111, 112, 113, 131, 136, + 240, 247, 270, 271, 144, 145, 170, 145, 164, 145, + 145, 145, 165, 164, 223, 224, 181, 198, 199, 204, + 271, 148, 157, 148, 214, 274, 215, 217, 178, 162, + 153, 153, 230, 153, 15, 162, 153, 162, 264, 264, + 264, 264, 232, 262, 264, 164, 15, 145, 16, 17, + 18, 19, 20, 21, 22, 23, 33, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 161, 162, + 163, 164, 206, 164, 164, 162, 222, 194, 260, 210, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 51, 52, + 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 67, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 87, 88, 89, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 148, 149, 243, 240, 154, 245, 245, 204, - 147, 127, 192, 10, 146, 148, 146, 4, 193, 244, - 248, 127, 146, 146, 146, 146, 183, 214, 211, 146, - 255, 240, 196, 201, 196, 196, 144, 148, 127, 118, - 254, 118, 254, 118, 254, 255, 94, 95, 96, 255, - 152, 224, 147, 10, 128, 10, 10, 10, 128, 216, - 200, 216, 47, 59, 64, 98, 102, 105, 134, 137, - 138, 139, 142, 144, 149, 247, 249, 201, 203, 127, - 216, 216, 216, 144, 216, 216, 216, 216, 248, 146, - 146, 14, 207, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 146, 246, 248, 183, 146, 144, - 183, 127, 182, 196, 148, 146, 242, 147, 147, 146, - 147, 126, 248, 198, 148, 167, 195, 211, 146, 147, - 146, 146, 146, 196, 254, 254, 254, 254, 254, 254, - 147, 127, 146, 127, 146, 146, 127, 146, 144, 135, - 135, 135, 144, 135, 247, 247, 247, 247, 247, 216, - 246, 247, 15, 16, 17, 18, 19, 20, 21, 22, - 32, 131, 132, 133, 134, 137, 138, 139, 140, 141, - 143, 144, 145, 127, 172, 146, 136, 136, 245, 136, - 146, 136, 146, 146, 248, 129, 146, 148, 144, 179, - 168, 196, 146, 183, 147, 204, 146, 126, 183, 183, - 183, 146, 10, 128, 10, 128, 128, 10, 128, 216, - 216, 216, 216, 216, 216, 146, 146, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 146, 246, 248, 173, - 144, 144, 146, 144, 144, 248, 180, 196, 146, 183, - 147, 183, 240, 195, 195, 195, 183, 146, 127, 127, - 146, 146, 136, 136, 136, 146, 136, 247, 129, 146, - 148, 246, 246, 246, 246, 196, 146, 183, 147, 128, - 10, 10, 128, 144, 144, 144, 144, 247, 146, 146, - 146, 146, 146, 183, 146, 146, 246, 246, 246, 246, - 183, 195, 128, 128, 146, 146, 146, 146, 195 + 63, 64, 65, 66, 68, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 80, 81, 82, 98, 104, 105, + 106, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 166, 167, 259, 256, 172, + 261, 261, 218, 165, 145, 206, 10, 164, 166, 164, + 4, 207, 260, 264, 145, 164, 164, 164, 164, 196, + 230, 226, 164, 271, 256, 210, 215, 215, 210, 210, + 162, 166, 162, 166, 145, 136, 270, 136, 270, 136, + 270, 271, 111, 112, 113, 271, 15, 170, 240, 165, + 10, 146, 10, 10, 10, 146, 214, 232, 48, 60, + 65, 115, 119, 122, 152, 155, 156, 157, 160, 162, + 167, 263, 265, 145, 232, 232, 232, 162, 232, 162, + 232, 232, 232, 264, 164, 164, 15, 221, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 164, + 262, 264, 196, 164, 162, 196, 195, 210, 166, 164, + 258, 165, 165, 164, 165, 144, 264, 212, 166, 183, + 209, 226, 15, 164, 165, 164, 164, 164, 210, 210, + 270, 270, 270, 270, 270, 270, 165, 145, 164, 145, + 164, 164, 145, 164, 162, 153, 153, 153, 15, 162, + 153, 263, 263, 263, 263, 263, 232, 262, 263, 16, + 17, 18, 19, 20, 21, 22, 23, 33, 149, 150, + 151, 152, 155, 156, 157, 158, 159, 161, 162, 163, + 186, 164, 154, 154, 261, 154, 271, 164, 154, 164, + 164, 264, 147, 164, 166, 162, 192, 210, 164, 196, + 165, 15, 218, 164, 144, 164, 196, 196, 196, 164, + 164, 10, 146, 10, 146, 146, 10, 146, 232, 232, + 232, 232, 162, 232, 232, 164, 164, 263, 263, 263, + 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, + 263, 263, 263, 263, 263, 263, 164, 262, 264, 162, + 162, 164, 162, 164, 162, 264, 193, 210, 164, 196, + 165, 196, 256, 209, 209, 209, 196, 196, 164, 145, + 145, 164, 164, 154, 154, 154, 271, 164, 154, 263, + 147, 164, 166, 262, 262, 262, 262, 210, 164, 196, + 165, 146, 10, 10, 146, 162, 162, 162, 164, 162, + 263, 164, 164, 164, 164, 164, 196, 164, 164, 262, + 262, 262, 262, 196, 209, 146, 146, 164, 164, 164, + 164, 209 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 150, 151, 151, 151, 152, 152, 152, 153, 153, - 154, 154, 156, 155, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 159, 158, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 161, 161, 162, 162, 163, 163, - 163, 163, 163, 165, 164, 166, 164, 167, 167, 168, - 168, 170, 169, 171, 169, 169, 172, 172, 173, 173, - 175, 174, 176, 174, 178, 177, 179, 177, 180, 177, - 181, 177, 182, 177, 177, 183, 183, 183, 183, 183, - 183, 183, 183, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 185, 185, 187, 186, 186, 188, 188, 189, - 189, 190, 190, 190, 190, 190, 190, 191, 191, 191, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 193, 192, 194, 194, 195, 195, 195, 196, 196, - 196, 196, 196, 197, 197, 198, 198, 198, 198, 198, - 199, 199, 200, 200, 201, 201, 202, 202, 202, 202, - 202, 203, 203, 203, 203, 203, 203, 204, 204, 204, - 205, 205, 205, 205, 206, 206, 206, 206, 207, 207, - 208, 208, 208, 208, 208, 208, 208, 208, 208, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 210, 210, 210, 210, 210, 210, 210, 210, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, - 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, - 213, 214, 214, 214, 214, 214, 214, 214, 215, 215, - 216, 216, 218, 217, 220, 219, 221, 221, 222, 222, - 223, 223, 224, 224, 224, 224, 224, 224, 224, 224, - 224, 224, 225, 226, 226, 226, 226, 227, 227, 228, - 228, 228, 229, 229, 229, 230, 230, 230, 231, 231, - 231, 233, 232, 234, 232, 232, 232, 235, 235, 235, - 236, 236, 236, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 238, 238, 238, - 239, 241, 240, 242, 242, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 244, - 244, 245, 245, 246, 246, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, - 249, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 251, 251, 251, 251, 251, 251, 251, - 251, 251, 251, 251, 252, 252, 252, 253, 253, 253, - 253, 254, 254, 254, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 256, 256, 256, 257, 257, 257, 257, - 258 + 0, 168, 169, 169, 169, 170, 170, 170, 171, 171, + 172, 172, 172, 174, 173, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 177, 176, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 178, 178, 178, 179, 179, 180, 180, + 182, 181, 181, 181, 181, 181, 183, 183, 185, 184, + 184, 186, 186, 188, 187, 189, 187, 191, 190, 192, + 190, 193, 190, 194, 190, 195, 190, 190, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 198, + 198, 200, 199, 199, 201, 201, 202, 202, 203, 203, + 204, 204, 204, 204, 204, 204, 204, 204, 204, 205, + 205, 205, 205, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 207, 206, 208, 208, 209, 209, + 209, 210, 210, 210, 210, 210, 211, 211, 212, 212, + 212, 212, 212, 213, 213, 214, 214, 215, 215, 216, + 216, 216, 216, 216, 217, 217, 217, 217, 217, 217, + 218, 218, 218, 219, 219, 219, 219, 220, 220, 220, + 220, 220, 220, 220, 221, 221, 222, 222, 222, 222, + 222, 222, 222, 222, 222, 223, 223, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 224, 224, 224, 224, + 224, 224, 224, 224, 224, 224, 224, 225, 225, 225, + 225, 225, 225, 225, 225, 225, 225, 226, 226, 226, + 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, + 226, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 228, 229, 229, 229, 229, 229, 229, 229, + 229, 229, 229, 229, 229, 230, 230, 230, 230, 230, + 230, 230, 230, 231, 231, 232, 232, 232, 232, 234, + 233, 236, 235, 237, 237, 238, 238, 239, 239, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 241, + 242, 242, 242, 242, 243, 243, 244, 244, 244, 245, + 245, 245, 246, 246, 246, 247, 247, 247, 249, 248, + 250, 248, 248, 248, 251, 251, 251, 252, 252, 252, + 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, + 253, 253, 253, 253, 254, 254, 254, 255, 257, 256, + 258, 258, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 260, + 260, 261, 261, 262, 262, 263, 263, 263, 263, 263, + 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, + 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, + 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, + 263, 263, 263, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, + 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, + 266, 266, 266, 267, 267, 267, 267, 267, 267, 267, + 267, 267, 267, 267, 268, 268, 268, 269, 269, 269, + 269, 270, 270, 270, 270, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 272, 272, 272, 272, 273, + 273, 273, 273, 274 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 2, 2, 2, 1, 2, 2, 1, 3, - 4, 4, 0, 5, 1, 1, 1, 1, 1, 2, - 1, 1, 2, 2, 2, 2, 7, 9, 11, 9, - 11, 13, 9, 13, 9, 7, 5, 0, 3, 1, - 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 6, 1, 3, 1, 4, 1, 3, - 3, 3, 1, 0, 4, 0, 5, 2, 4, 2, - 4, 0, 4, 0, 5, 3, 2, 4, 2, 4, - 0, 6, 0, 6, 0, 7, 0, 11, 0, 12, - 0, 8, 0, 9, 1, 1, 1, 2, 2, 2, - 2, 4, 5, 1, 1, 1, 1, 1, 1, 1, + 4, 5, 4, 0, 5, 1, 1, 1, 1, 1, + 2, 1, 1, 2, 2, 2, 2, 7, 9, 11, + 9, 11, 13, 9, 13, 9, 7, 5, 0, 3, + 1, 2, 2, 3, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 6, 1, 3, 1, 4, + 0, 4, 3, 3, 3, 1, 2, 4, 0, 4, + 3, 2, 4, 0, 6, 0, 6, 0, 7, 0, + 11, 0, 12, 0, 8, 0, 9, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 1, 0, 6, 2, 1, 1, 1, - 3, 2, 4, 2, 4, 3, 4, 1, 1, 1, - 1, 2, 3, 2, 2, 2, 2, 2, 3, 4, - 3, 0, 6, 2, 3, 1, 3, 4, 1, 1, - 1, 3, 2, 1, 3, 1, 1, 1, 3, 2, - 1, 3, 1, 2, 1, 2, 1, 3, 5, 3, - 3, 1, 3, 3, 3, 3, 4, 1, 1, 2, - 1, 3, 3, 5, 3, 4, 5, 2, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 3, 4, 1, - 1, 2, 2, 2, 2, 2, 3, 4, 7, 3, - 1, 2, 2, 2, 2, 2, 3, 4, 1, 2, - 2, 2, 2, 2, 3, 4, 5, 9, 9, 9, - 1, 1, 2, 1, 1, 1, 2, 4, 4, 1, - 1, 1, 2, 1, 1, 1, 2, 4, 2, 4, - 1, 1, 1, 2, 2, 2, 4, 1, 1, 1, - 2, 3, 0, 5, 0, 8, 1, 1, 1, 1, - 2, 3, 1, 2, 2, 2, 3, 3, 3, 3, - 3, 3, 4, 3, 1, 4, 2, 1, 1, 1, - 3, 5, 1, 2, 4, 1, 2, 2, 1, 1, - 1, 0, 6, 0, 7, 4, 5, 3, 5, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, - 1, 0, 2, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, + 1, 0, 6, 2, 1, 1, 1, 3, 1, 1, + 1, 2, 4, 2, 3, 3, 4, 2, 3, 1, + 1, 1, 1, 1, 2, 3, 2, 2, 2, 2, + 2, 3, 4, 3, 0, 6, 2, 3, 1, 3, + 4, 1, 1, 1, 3, 2, 1, 3, 1, 1, + 1, 3, 2, 1, 3, 1, 2, 1, 2, 1, + 3, 5, 3, 3, 1, 3, 3, 3, 3, 4, + 1, 1, 2, 1, 3, 3, 5, 3, 4, 5, + 3, 4, 5, 2, 1, 1, 1, 1, 2, 2, + 2, 2, 2, 3, 4, 1, 1, 2, 2, 2, + 2, 2, 3, 4, 7, 3, 1, 2, 2, 2, + 2, 2, 2, 3, 4, 7, 3, 1, 1, 2, + 2, 2, 2, 2, 2, 3, 4, 1, 1, 2, + 2, 2, 2, 2, 2, 3, 4, 5, 9, 9, + 9, 1, 1, 2, 1, 1, 1, 2, 4, 4, + 4, 1, 1, 1, 1, 2, 1, 1, 1, 2, + 4, 2, 4, 4, 1, 1, 1, 2, 2, 2, + 4, 4, 1, 1, 1, 2, 3, 2, 3, 0, + 5, 0, 8, 1, 1, 1, 1, 2, 3, 1, + 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, + 3, 1, 4, 2, 1, 1, 1, 3, 5, 1, + 2, 4, 1, 2, 2, 1, 1, 1, 0, 6, + 0, 7, 4, 5, 3, 5, 4, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 1, 2, 1, 0, 2, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -2755,25 +2993,27 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, 4, 7, 7, 7, - 7, 4, 4, 2, 2, 2, 2, 2, 2, 3, + 7, 4, 5, 4, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, - 3, 3, 1, 4, 7, 7, 7, 7, 4, 4, + 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, + 3, 3, 3, 1, 4, 7, 7, 7, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 2, 5, 4, 4, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 5, 4, 2, 5, 4, 4, 2, + 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 5, 4, 4, 3, 3, 3, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, - 11, 1, 4, 7, 7, 7, 7, 4, 4, 2, + 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 8, 11, 4, 4, 6, 4, 4, 6, 6, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 4, 7, 7, 7, 7, 4, 5, 4, 2, 5, 4, 4, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 2, - 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 0 + 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 0 }; @@ -3549,56 +3789,64 @@ yyreduce: switch (yyn) { case 3: -#line 426 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 444 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_expr = (yyvsp[0].u.expr); } -#line 3557 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3797 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 4: -#line 430 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 448 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_type = (yyvsp[0].u.type); } -#line 3565 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3805 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 10: -#line 448 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 466 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { delete (yyvsp[-1].u.expr); } -#line 3573 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3813 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 11: -#line 452 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 470 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - delete (yyvsp[-1].u.expr); + delete (yyvsp[-2].u.expr); } -#line 3581 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3821 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 12: -#line 464 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 474 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + delete (yyvsp[-1].u.expr); +} +#line 3829 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 13: +#line 486 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_storage_class((current_storage_class & ~CPPInstance::SC_c_binding) | ((yyvsp[-1].u.integer) & CPPInstance::SC_c_binding)); } -#line 3590 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3838 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 13: -#line 469 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 14: +#line 491 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_storage_class(); } -#line 3598 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3846 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 20: -#line 482 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 21: +#line 504 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if (publish_nest_level != 0) { yyerror("Unclosed __begin_publish", publish_loc); @@ -3611,11 +3859,11 @@ yyreduce: publish_nest_level++; current_scope->set_current_vis(V_published); } -#line 3615 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3863 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 21: -#line 495 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 22: +#line 517 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if (publish_nest_level != 1) { yyerror("Unmatched __end_publish", (yylsp[0])); @@ -3624,19 +3872,19 @@ yyreduce: } publish_nest_level = 0; } -#line 3628 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 22: -#line 504 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - current_scope->set_current_vis(V_published); -} -#line 3636 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3876 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 23: -#line 508 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 526 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + current_scope->set_current_vis(V_published); +} +#line 3884 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 24: +#line 530 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if (publish_nest_level > 0) { current_scope->set_current_vis(V_published); @@ -3644,27 +3892,27 @@ yyreduce: current_scope->set_current_vis(V_public); } } -#line 3648 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 24: -#line 516 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - current_scope->set_current_vis(V_protected); -} -#line 3656 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3896 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 25: -#line 520 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 538 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - current_scope->set_current_vis(V_private); + current_scope->set_current_vis(V_protected); } -#line 3664 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3904 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 26: -#line 524 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 542 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + current_scope->set_current_vis(V_private); +} +#line 3912 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 27: +#line 546 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *getter = (yyvsp[-2].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); @@ -3675,11 +3923,11 @@ yyreduce: CPPMakeProperty *make_property = new CPPMakeProperty((yyvsp[-4].u.identifier), getter->as_function_group(), NULL, current_scope, (yylsp[-6]).file); current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-6])); } -#line 3679 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3927 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 27: -#line 535 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 28: +#line 557 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *getter = (yyvsp[-4].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3700,11 +3948,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-8])); } } -#line 3704 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3952 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 28: -#line 556 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 29: +#line 578 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *getter = (yyvsp[-6].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3734,11 +3982,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-10])); } } -#line 3738 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 3986 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 29: -#line 586 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 30: +#line 608 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *length_getter = (yyvsp[-4].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3755,11 +4003,11 @@ yyreduce: make_property->_length_function = length_getter->as_function_group(); current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-8])); } -#line 3759 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4007 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 30: -#line 603 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 31: +#line 625 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *length_getter = (yyvsp[-6].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3787,11 +4035,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-10])); } } -#line 3791 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4039 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 31: -#line 631 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 32: +#line 653 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *length_getter = (yyvsp[-8].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3828,11 +4076,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-12])); } } -#line 3832 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4080 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 32: -#line 668 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 33: +#line 690 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *hasser = (yyvsp[-4].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (hasser == (CPPDeclaration *)NULL || hasser->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3854,11 +4102,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-8])); } } -#line 3858 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4106 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 33: -#line 690 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 34: +#line 712 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *hasser = (yyvsp[-8].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (hasser == (CPPDeclaration *)NULL || hasser->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3891,11 +4139,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-12])); } } -#line 3895 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4143 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 34: -#line 723 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 35: +#line 745 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *length_getter = (yyvsp[-4].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) { @@ -3917,11 +4165,11 @@ yyreduce: current_scope->add_declaration(make_seq, global_scope, current_lexer, (yylsp[-8])); } } -#line 3921 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4169 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 35: -#line 745 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 36: +#line 767 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPExpression::Result result = (yyvsp[-4].u.expr)->evaluate(); if (result._type == CPPExpression::RT_error) { @@ -3932,11 +4180,11 @@ yyreduce: yywarning("static_assert failed: " + str.str(), (yylsp[-4])); } } -#line 3936 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4184 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 36: -#line 756 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 37: +#line 778 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // This alternative version of static_assert was introduced in C++17. CPPExpression::Result result = (yyvsp[-2].u.expr)->evaluate(); @@ -3946,46 +4194,55 @@ yyreduce: yywarning("static_assert failed", (yylsp[-2])); } } -#line 3950 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4198 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 37: -#line 769 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 38: +#line 791 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPScope *new_scope = new CPPScope(current_scope, CPPNameComponent("temp"), V_public); push_scope(new_scope); } -#line 3960 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4208 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 38: -#line 775 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 39: +#line 797 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { delete current_scope; pop_scope(); } -#line 3969 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 39: -#line 784 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.integer) = 0; -} -#line 3977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4217 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 40: -#line 788 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 806 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extern; + (yyval.u.integer) = 0; } -#line 3985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4225 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 41: -#line 792 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 810 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + // This isn't really a storage class, but it helps with parsing. + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_const; +} +#line 4234 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 42: +#line 815 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extern; +} +#line 4242 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 43: +#line 819 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extern; if ((yyvsp[-1].str) == "C") { @@ -3996,116 +4253,131 @@ yyreduce: yywarning("Ignoring unknown linkage type \"" + (yyvsp[-1].str) + "\"", (yylsp[-1])); } } -#line 4000 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 42: -#line 803 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_static; -} -#line 4008 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 43: -#line 807 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_inline; -} -#line 4016 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4257 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 44: -#line 811 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 830 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_virtual; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_static; } -#line 4024 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4265 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 45: -#line 815 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 834 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_explicit; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_inline; } -#line 4032 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4273 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 46: -#line 819 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 838 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_register; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_virtual; } -#line 4040 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4281 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 47: -#line 823 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 842 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_volatile; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_explicit; } -#line 4048 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4289 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 48: -#line 827 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 846 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_mutable; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_register; } -#line 4056 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4297 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 49: -#line 831 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 850 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_constexpr; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_volatile; } -#line 4064 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4305 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 50: -#line 835 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 854 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_blocking; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_mutable; } -#line 4072 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4313 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 51: -#line 839 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 858 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extension; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_constexpr; } -#line 4080 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4321 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 52: -#line 843 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 862 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_thread_local; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_blocking; } -#line 4088 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4329 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 53: -#line 847 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 866 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extension; +} +#line 4337 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 54: +#line 870 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_thread_local; +} +#line 4345 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 55: +#line 874 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // Ignore attribute specifiers for now. (yyval.u.integer) = (yyvsp[0].u.integer); } -#line 4097 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4354 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 58: -#line 865 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 60: +#line 892 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - /* multiple_var_declaration adds itself to the scope. */ + // We don't need to push/pop type, because we can't nest + // type_like_declaration. + if ((yyvsp[0].u.decl)->as_type_declaration()) { + current_type = (yyvsp[0].u.decl)->as_type_declaration()->_type; + } else { + current_type = (yyvsp[0].u.decl)->as_type(); + } + push_storage_class((yyvsp[-1].u.integer)); } -#line 4105 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4369 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 59: -#line 869 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 61: +#line 903 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + pop_storage_class(); +} +#line 4377 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 62: +#line 908 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // We don't really care about the storage class here. In fact, it's // not actually legal to define a class or struct using a particular @@ -4114,131 +4386,65 @@ yyreduce: current_scope->add_declaration((yyvsp[-1].u.decl), global_scope, current_lexer, (yylsp[-1])); } -#line 4118 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 60: -#line 878 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - if ((yyvsp[-1].u.instance) != (CPPInstance *)NULL) { - (yyvsp[-1].u.instance)->_storage_class |= (current_storage_class | (yyvsp[-2].u.integer)); - current_scope->add_declaration((yyvsp[-1].u.instance), global_scope, current_lexer, (yylsp[-1])); - (yyvsp[-1].u.instance)->set_initializer((yyvsp[0].u.expr)); - } -} -#line 4130 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 61: -#line 886 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - if ((yyvsp[-1].u.instance) != (CPPInstance *)NULL) { - (yyvsp[-1].u.instance)->_storage_class |= (current_storage_class | (yyvsp[-2].u.integer)); - current_scope->add_declaration((yyvsp[-1].u.instance), global_scope, current_lexer, (yylsp[-1])); - (yyvsp[-1].u.instance)->set_initializer((yyvsp[0].u.expr)); - } -} -#line 4142 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4390 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 63: -#line 898 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 917 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - // We don't need to push/pop type, because we can't nest - // multiple_var_declarations. - if ((yyvsp[0].u.decl)->as_type_declaration()) { - current_type = (yyvsp[0].u.decl)->as_type_declaration()->_type; - } else { - current_type = (yyvsp[0].u.decl)->as_type(); + if ((yyvsp[-1].u.instance) != (CPPInstance *)NULL) { + (yyvsp[-1].u.instance)->_storage_class |= (current_storage_class | (yyvsp[-2].u.integer)); + current_scope->add_declaration((yyvsp[-1].u.instance), global_scope, current_lexer, (yylsp[-1])); + (yyvsp[-1].u.instance)->set_initializer((yyvsp[0].u.expr)); } - push_storage_class((yyvsp[-1].u.integer)); } -#line 4157 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4402 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 64: -#line 909 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 925 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - pop_storage_class(); -} -#line 4165 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 65: -#line 913 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - // We don't need to push/pop type, because we can't nest - // multiple_var_declarations. - if ((yyvsp[0].u.decl)->as_type_declaration()) { - current_type = (yyvsp[0].u.decl)->as_type_declaration()->_type; - } else { - current_type = (yyvsp[0].u.decl)->as_type(); + if ((yyvsp[-1].u.instance) != (CPPInstance *)NULL) { + (yyvsp[-1].u.instance)->_storage_class |= (current_storage_class | (yyvsp[-2].u.integer)); + current_scope->add_declaration((yyvsp[-1].u.instance), global_scope, current_lexer, (yylsp[-1])); + (yyvsp[-1].u.instance)->set_initializer((yyvsp[0].u.expr)); } - push_storage_class((yyvsp[-2].u.integer)); } -#line 4180 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4414 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 66: -#line 924 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 941 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - pop_storage_class(); + if (current_storage_class & CPPInstance::SC_const) { + (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); + } + CPPInstance *inst = new CPPInstance(current_type, (yyvsp[-1].u.inst_ident), + current_storage_class, + (yylsp[-1]).file); + inst->set_initializer((yyvsp[0].u.expr)); + current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-1])); } -#line 4188 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4429 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 67: -#line 935 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 952 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - CPPInstance *inst = new CPPInstance(current_type, (yyvsp[-1].u.inst_ident), + if (current_storage_class & CPPInstance::SC_const) { + (yyvsp[-3].u.inst_ident)->add_modifier(IIT_const); + } + CPPInstance *inst = new CPPInstance(current_type, (yyvsp[-3].u.inst_ident), current_storage_class, - (yylsp[-1]).file); - inst->set_initializer((yyvsp[0].u.expr)); - current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-1])); + (yylsp[-3]).file); + inst->set_initializer((yyvsp[-2].u.expr)); + current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-3])); } -#line 4200 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4444 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 68: -#line 943 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - CPPInstance *inst = new CPPInstance(current_type, (yyvsp[-3].u.inst_ident), - current_storage_class, - (yylsp[-3]).file); - inst->set_initializer((yyvsp[-2].u.expr)); - current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-3])); -} -#line 4212 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 69: -#line 954 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); - CPPInstance *inst = new CPPInstance(current_type, (yyvsp[-1].u.inst_ident), - current_storage_class, - (yylsp[-1]).file); - inst->set_initializer((yyvsp[0].u.expr)); - current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-1])); -} -#line 4225 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 70: -#line 963 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyvsp[-3].u.inst_ident)->add_modifier(IIT_const); - CPPInstance *inst = new CPPInstance(current_type, (yyvsp[-3].u.inst_ident), - current_storage_class, - (yylsp[-3]).file); - inst->set_initializer((yyvsp[-2].u.expr)); - current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-3])); -} -#line 4238 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 71: -#line 976 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 967 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -4249,42 +4455,19 @@ yyreduce: } push_storage_class((yyvsp[-1].u.integer)); } -#line 4253 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4459 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 72: -#line 987 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 69: +#line 978 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_storage_class(); } -#line 4261 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4467 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 73: -#line 991 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - // We don't need to push/pop type, because we can't nest - // multiple_var_declarations. - if ((yyvsp[0].u.decl)->as_type_declaration()) { - current_type = (yyvsp[0].u.decl)->as_type_declaration()->_type; - } else { - current_type = (yyvsp[0].u.decl)->as_type(); - } - push_storage_class((yyvsp[-2].u.integer)); -} -#line 4276 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 74: -#line 1002 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - pop_storage_class(); -} -#line 4284 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 75: -#line 1006 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 70: +#line 982 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if ((yyvsp[-1].u.instance) != (CPPDeclaration *)NULL) { CPPInstance *inst = (yyvsp[-1].u.instance)->as_instance(); @@ -4296,61 +4479,45 @@ yyreduce: } } } -#line 4300 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4483 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 76: -#line 1021 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 71: +#line 997 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { + if (current_storage_class & CPPInstance::SC_const) { + (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); + } CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, (yyvsp[-1].u.inst_ident), current_scope, (yylsp[-1]).file); current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, (yylsp[-1])); } -#line 4310 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4496 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 77: -#line 1027 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 72: +#line 1006 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { + if (current_storage_class & CPPInstance::SC_const) { + (yyvsp[-3].u.inst_ident)->add_modifier(IIT_const); + } CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, (yyvsp[-3].u.inst_ident), current_scope, (yylsp[-3]).file); current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, (yylsp[-3])); } -#line 4320 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4509 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 78: -#line 1036 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); - CPPType *target_type = current_type; - CPPTypedefType *typedef_type = new CPPTypedefType(target_type, (yyvsp[-1].u.inst_ident), current_scope, (yylsp[-1]).file); - current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, (yylsp[-1])); -} -#line 4331 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 79: -#line 1043 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyvsp[-3].u.inst_ident)->add_modifier(IIT_const); - CPPType *target_type = current_type; - CPPTypedefType *typedef_type = new CPPTypedefType(target_type, (yyvsp[-3].u.inst_ident), current_scope, (yylsp[-3]).file); - current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, (yylsp[-3])); -} -#line 4342 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 80: -#line 1055 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 73: +#line 1020 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); } -#line 4350 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4517 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 81: -#line 1059 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 74: +#line 1024 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type; if ((yyvsp[-5].u.identifier)->get_simple_name() == current_scope->get_simple_name() || @@ -4370,19 +4537,19 @@ yyreduce: (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-5]).file); } -#line 4374 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4541 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 82: -#line 1079 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 75: +#line 1044 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); } -#line 4382 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4549 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 83: -#line 1083 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 76: +#line 1048 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); CPPType *type; @@ -4400,19 +4567,19 @@ yyreduce: (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-5]).file); } -#line 4404 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4571 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 84: -#line 1106 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 77: +#line 1071 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); } -#line 4412 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4579 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 85: -#line 1110 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 78: +#line 1075 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); if ((yyvsp[-5].u.identifier)->is_scoped()) { @@ -4431,19 +4598,19 @@ yyreduce: (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-5]).file); } } -#line 4435 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4602 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 86: -#line 1136 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 79: +#line 1101 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_scope((yyvsp[-2].u.inst_ident)->get_scope(current_scope, global_scope)); } -#line 4443 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4610 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 87: -#line 1140 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 80: +#line 1105 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); CPPType *type = (yyvsp[-10].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); @@ -4457,19 +4624,19 @@ yyreduce: ii->add_func_modifier((yyvsp[-3].u.param_list), (yyvsp[-1].u.integer)); (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-10]).file); } -#line 4461 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4628 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 88: -#line 1154 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 81: +#line 1119 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_scope((yyvsp[-2].u.inst_ident)->get_scope(current_scope, global_scope)); } -#line 4469 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4636 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 89: -#line 1158 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 82: +#line 1123 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); CPPType *type = (yyvsp[-11].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); @@ -4483,21 +4650,21 @@ yyreduce: ii->add_func_modifier((yyvsp[-3].u.param_list), (yyvsp[-1].u.integer)); (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-11]).file); } -#line 4487 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4654 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 90: -#line 1174 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 83: +#line 1139 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if ((yyvsp[-3].u.identifier) != NULL) { push_scope((yyvsp[-3].u.identifier)->get_scope(current_scope, global_scope)); } } -#line 4497 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4664 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 91: -#line 1180 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 84: +#line 1145 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if ((yyvsp[-7].u.identifier) != NULL) { pop_scope(); @@ -4522,21 +4689,21 @@ yyreduce: (yyval.u.instance) = CPPInstance::make_typecast_function (new CPPInstance((yyvsp[-6].u.type), (yyvsp[-5].u.inst_ident), 0, (yylsp[-5]).file), ident, (yyvsp[-2].u.param_list), (yyvsp[0].u.integer)); } -#line 4526 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4693 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 92: -#line 1205 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 85: +#line 1170 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if ((yyvsp[-4].u.identifier) != NULL) { push_scope((yyvsp[-4].u.identifier)->get_scope(current_scope, global_scope)); } } -#line 4536 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4703 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 93: -#line 1211 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 86: +#line 1176 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if ((yyvsp[-8].u.identifier) != NULL) { pop_scope(); @@ -4552,11 +4719,11 @@ yyreduce: (yyval.u.instance) = CPPInstance::make_typecast_function (new CPPInstance((yyvsp[-6].u.type), (yyvsp[-5].u.inst_ident), 0, (yylsp[-5]).file), ident, (yyvsp[-2].u.param_list), (yyvsp[0].u.integer)); } -#line 4556 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4723 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 94: -#line 1231 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 87: +#line 1196 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPDeclaration *decl = (yyvsp[0].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); @@ -4566,494 +4733,557 @@ yyreduce: (yyval.u.instance) = (CPPInstance *)NULL; } } -#line 4570 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4737 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 88: +#line 1209 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = 0; +} +#line 4745 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 89: +#line 1213 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_const_method; +} +#line 4753 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 90: +#line 1217 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_volatile_method; +} +#line 4761 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 91: +#line 1221 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_noexcept; +} +#line 4769 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 92: +#line 1225 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_final; +} +#line 4777 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 93: +#line 1229 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_override; +} +#line 4785 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 94: +#line 1233 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_lvalue_method; +} +#line 4793 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 95: -#line 1244 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1237 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = 0; + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_rvalue_method; } -#line 4578 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4801 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 96: -#line 1248 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1241 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_const_method; + // Used for lambdas, currently ignored. + (yyval.u.integer) = (yyvsp[-1].u.integer); } -#line 4586 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4810 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 97: -#line 1252 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1246 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_noexcept; + (yyval.u.integer) = (yyvsp[-3].u.integer); } -#line 4594 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4818 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 98: -#line 1256 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1250 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_final; + (yyval.u.integer) = (yyvsp[-4].u.integer); } -#line 4602 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4826 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 99: -#line 1260 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1254 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_override; + (yyval.u.integer) = (yyvsp[-5].u.integer); } -#line 4610 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4834 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 100: -#line 1264 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1265 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - // Used for lambdas, currently ignored. - (yyval.u.integer) = 0; + (yyval.str) = "!"; } -#line 4619 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4842 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 101: #line 1269 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[-3].u.integer); + (yyval.str) = "~"; } -#line 4627 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4850 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 102: #line 1273 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[-4].u.integer); + (yyval.str) = "*"; } -#line 4635 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4858 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 103: -#line 1284 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.str) = "!"; -} -#line 4643 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 104: -#line 1288 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.str) = "~"; -} -#line 4651 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 105: -#line 1292 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.str) = "*"; -} -#line 4659 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 106: -#line 1296 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1277 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "/"; } -#line 4667 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4866 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 107: -#line 1300 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 104: +#line 1281 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "%"; } -#line 4675 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4874 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 108: -#line 1304 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 105: +#line 1285 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "+"; } -#line 4683 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4882 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 109: -#line 1308 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 106: +#line 1289 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "-"; } -#line 4691 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4890 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 110: -#line 1312 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 107: +#line 1293 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "|"; } -#line 4699 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4898 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 111: -#line 1316 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 108: +#line 1297 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "&"; } -#line 4707 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4906 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 112: -#line 1320 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 109: +#line 1301 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "^"; } -#line 4715 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4914 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 113: -#line 1324 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 110: +#line 1305 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "||"; } -#line 4723 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4922 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 114: -#line 1328 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 111: +#line 1309 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "&&"; } -#line 4731 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4930 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 115: -#line 1332 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 112: +#line 1313 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "=="; } -#line 4739 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4938 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 116: -#line 1336 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 113: +#line 1317 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "!="; } -#line 4747 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4946 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 117: -#line 1340 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 114: +#line 1321 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "<="; } -#line 4755 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4954 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 118: -#line 1344 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 115: +#line 1325 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = ">="; } -#line 4763 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4962 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 119: -#line 1348 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 116: +#line 1329 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "<"; } -#line 4771 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4970 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 120: -#line 1352 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 117: +#line 1333 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = ">"; } -#line 4779 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4978 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 121: -#line 1356 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 118: +#line 1337 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "<<"; } -#line 4787 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4986 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 122: -#line 1360 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 119: +#line 1341 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = ">>"; } -#line 4795 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4994 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 123: -#line 1364 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 120: +#line 1345 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "="; } -#line 4803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5002 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 124: -#line 1368 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 121: +#line 1349 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = ","; } -#line 4811 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5010 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 125: -#line 1372 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 122: +#line 1353 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "++"; } -#line 4819 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5018 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 126: -#line 1376 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 123: +#line 1357 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "--"; } -#line 4827 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5026 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 127: -#line 1380 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 124: +#line 1361 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "*="; } -#line 4835 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5034 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 128: -#line 1384 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 125: +#line 1365 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "/="; } -#line 4843 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5042 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 129: -#line 1388 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 126: +#line 1369 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "%="; } -#line 4851 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5050 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 130: -#line 1392 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 127: +#line 1373 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "+="; } -#line 4859 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5058 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 131: -#line 1396 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 128: +#line 1377 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "-="; } -#line 4867 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5066 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 132: -#line 1400 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 129: +#line 1381 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "|="; } -#line 4875 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5074 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 133: -#line 1404 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 130: +#line 1385 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "&="; } -#line 4883 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5082 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 134: -#line 1408 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 131: +#line 1389 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "^="; } -#line 4891 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5090 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 135: -#line 1412 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 132: +#line 1393 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "<<="; } -#line 4899 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5098 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 136: -#line 1416 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 133: +#line 1397 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = ">>="; } -#line 4907 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5106 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 137: -#line 1420 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 134: +#line 1401 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "->"; } -#line 4915 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5114 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 138: -#line 1424 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 135: +#line 1405 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "[]"; } -#line 4923 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5122 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 139: -#line 1428 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 136: +#line 1409 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "()"; } -#line 4931 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5130 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 140: -#line 1432 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 137: +#line 1413 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "new"; } -#line 4939 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5138 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 141: -#line 1436 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 138: +#line 1417 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.str) = "delete"; } -#line 4947 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5146 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 144: -#line 1448 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 141: +#line 1429 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { push_scope(new CPPTemplateScope(current_scope)); } -#line 4955 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5154 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 145: -#line 1452 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 142: +#line 1433 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); } -#line 4963 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5162 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 149: -#line 1465 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 146: +#line 1446 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPTemplateScope *ts = current_scope->as_template_scope(); assert(ts != NULL); ts->add_template_parameter((yyvsp[0].u.decl)); } -#line 4973 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5172 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 147: +#line 1452 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPTemplateScope *ts = current_scope->as_template_scope(); + assert(ts != NULL); + ts->add_template_parameter((yyvsp[0].u.decl)); +} +#line 5182 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 150: -#line 1471 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1466 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - CPPTemplateScope *ts = current_scope->as_template_scope(); - assert(ts != NULL); - ts->add_template_parameter((yyvsp[0].u.decl)); + (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((CPPIdentifier *)NULL)); } -#line 4983 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5190 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 151: -#line 1480 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1470 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[0].u.identifier))); } -#line 4991 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5198 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 152: -#line 1484 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1474 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[-2].u.identifier), (yyvsp[0].u.type))); } -#line 4999 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5206 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 153: -#line 1488 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1478 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[0].u.identifier))); + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((CPPIdentifier *)NULL); + ctp->_packed = true; + (yyval.u.decl) = CPPType::new_type(ctp); } -#line 5007 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5216 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 154: -#line 1492 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1484 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[-2].u.identifier), (yyvsp[0].u.type))); + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((yyvsp[0].u.identifier)); + ctp->_packed = true; + (yyval.u.decl) = CPPType::new_type(ctp); } -#line 5015 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5226 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 155: -#line 1496 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1490 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPInstance *inst = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-1]).file); inst->set_initializer((yyvsp[0].u.expr)); (yyval.u.decl) = inst; } -#line 5025 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5236 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 156: -#line 1502 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1496 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-1]).file); inst->set_initializer((yyvsp[0].u.expr)); (yyval.u.decl) = inst; } -#line 5036 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5247 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 157: -#line 1512 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1503 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.type) = CPPType::new_type((yyvsp[0].u.simple_type)); + CPPInstance *inst = new CPPInstance((yyvsp[-1].u.type), (yyvsp[0].u.inst_ident), 0, (yylsp[0]).file); + (yyval.u.decl) = inst; } -#line 5044 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5256 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 158: -#line 1516 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1508 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyvsp[0].u.inst_ident)->add_modifier(IIT_const); + CPPInstance *inst = new CPPInstance((yyvsp[-1].u.type), (yyvsp[0].u.inst_ident), 0, (yylsp[0]).file); + (yyval.u.decl) = inst; +} +#line 5266 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 159: +#line 1517 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.type) = CPPType::new_type((yyvsp[0].u.simple_type)); +} +#line 5274 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 160: +#line 1521 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { yywarning("Not a type: " + (yyvsp[0].u.identifier)->get_fully_scoped_name(), (yylsp[0])); (yyval.u.type) = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); } -#line 5053 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5283 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 159: -#line 1521 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 161: +#line 1526 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.type) == NULL) { @@ -5061,19 +5291,31 @@ yyreduce: } assert((yyval.u.type) != NULL); } -#line 5065 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5295 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 160: -#line 1533 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 162: +#line 1534 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.type) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); + if ((yyval.u.type) == NULL) { + yyerror(string("internal error resolving type ") + (yyvsp[0].u.identifier)->get_fully_scoped_name(), (yylsp[0])); + } + assert((yyval.u.type) != NULL); +} +#line 5307 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 163: +#line 1546 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); } -#line 5073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5315 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 161: -#line 1537 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 164: +#line 1550 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // For an operator function. We implement this simply by building a // ficticious name for the function; in other respects it's just @@ -5087,11 +5329,11 @@ yyreduce: (yyval.u.inst_ident) = new CPPInstanceIdentifier(ident); } -#line 5091 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5333 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 162: -#line 1551 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 165: +#line 1564 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // A C++11 literal operator. if (!(yyvsp[-1].str).empty()) { @@ -5106,91 +5348,100 @@ yyreduce: (yyval.u.inst_ident) = new CPPInstanceIdentifier(ident); } -#line 5110 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5352 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 163: -#line 1566 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 166: +#line 1579 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); } -#line 5119 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5361 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 164: -#line 1571 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 167: +#line 1584 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); } -#line 5128 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5370 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 165: -#line 1576 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 168: +#line 1589 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); } -#line 5137 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5379 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 166: -#line 1581 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 169: +#line 1594 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); } -#line 5146 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5388 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 167: -#line 1586 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 170: +#line 1599 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); } -#line 5155 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5397 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 168: -#line 1591 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 171: +#line 1604 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); } -#line 5164 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5406 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 169: -#line 1596 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 172: +#line 1609 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); } -#line 5173 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5415 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 170: -#line 1601 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 173: +#line 1614 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-1].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); } -#line 5182 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5424 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 171: -#line 1606 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 174: +#line 1619 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - push_scope((yyvsp[-1].u.inst_ident)->get_scope(current_scope, global_scope)); + // Create a scope for this function (in case it is a function) + CPPScope *scope = new CPPScope((yyvsp[-1].u.inst_ident)->get_scope(current_scope, global_scope), + CPPNameComponent(""), V_private); + + // It still needs to be able to pick up any template arguments, if this is + // a definition for a method template. Add a fake "using" declaration to + // accomplish this. + scope->_using.insert(current_scope); + + push_scope(scope); } -#line 5190 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5432 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 172: -#line 1610 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 175: +#line 1623 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); (yyval.u.inst_ident) = (yyvsp[-5].u.inst_ident); @@ -5204,11 +5455,11 @@ yyreduce: (yyval.u.inst_ident)->add_func_modifier((yyvsp[-2].u.param_list), (yyvsp[0].u.integer)); } } -#line 5208 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5450 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 173: -#line 1628 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 176: +#line 1641 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // This is handled a bit awkwardly right now. Ideally it'd be wrapped // up in the instance_identifier rule, but then more needs to happen in @@ -5218,721 +5469,886 @@ yyreduce: } (yyval.u.inst_ident) = (yyvsp[-1].u.inst_ident); } -#line 5222 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5464 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 174: -#line 1638 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 177: +#line 1651 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // Bitfield definition. (yyvsp[-2].u.inst_ident)->_bit_width = (yyvsp[0].u.integer); (yyval.u.inst_ident) = (yyvsp[-2].u.inst_ident); } -#line 5232 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5474 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 175: -#line 1648 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 178: +#line 1661 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = NULL; } -#line 5240 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5482 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 176: -#line 1652 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 179: +#line 1665 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[0].u.inst_ident)->unroll_type((yyvsp[-1].u.type)); } -#line 5248 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5490 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 177: -#line 1656 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 180: +#line 1669 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyvsp[0].u.inst_ident)->add_modifier(IIT_const); (yyval.u.type) = (yyvsp[0].u.inst_ident)->unroll_type((yyvsp[-1].u.type)); } -#line 5257 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 178: -#line 1665 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; -} -#line 5265 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 179: -#line 1669 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; - (yyval.u.param_list)->_includes_ellipsis = true; -} -#line 5274 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 180: -#line 1674 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = (yyvsp[0].u.param_list); -} -#line 5282 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5499 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 181: #line 1678 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.param_list) = (yyvsp[-2].u.param_list); - (yyval.u.param_list)->_includes_ellipsis = true; + (yyval.u.param_list) = new CPPParameterList; } -#line 5291 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5507 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 182: -#line 1683 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1682 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = new CPPParameterList; + (yyval.u.param_list)->_includes_ellipsis = true; +} +#line 5516 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 183: +#line 1687 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = (yyvsp[0].u.param_list); +} +#line 5524 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 184: +#line 1691 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = (yyvsp[-2].u.param_list); + (yyval.u.param_list)->_includes_ellipsis = true; +} +#line 5533 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 185: +#line 1696 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.param_list) = (yyvsp[-1].u.param_list); (yyval.u.param_list)->_includes_ellipsis = true; } -#line 5300 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5542 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 183: -#line 1691 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 186: +#line 1704 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.param_list) = new CPPParameterList; (yyval.u.param_list)->_parameters.push_back((yyvsp[0].u.instance)); } -#line 5309 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5551 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 184: -#line 1696 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 187: +#line 1709 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.param_list) = (yyvsp[-2].u.param_list); (yyval.u.param_list)->_parameters.push_back((yyvsp[0].u.instance)); } -#line 5318 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 185: -#line 1704 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; -} -#line 5326 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 186: -#line 1708 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; - (yyval.u.param_list)->_includes_ellipsis = true; -} -#line 5335 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 187: -#line 1713 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = (yyvsp[0].u.param_list); -} -#line 5343 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5560 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 188: #line 1717 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.param_list) = (yyvsp[-2].u.param_list); - (yyval.u.param_list)->_includes_ellipsis = true; + (yyval.u.param_list) = new CPPParameterList; } -#line 5352 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5568 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 189: -#line 1722 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1721 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = new CPPParameterList; + (yyval.u.param_list)->_includes_ellipsis = true; +} +#line 5577 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 190: +#line 1726 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = (yyvsp[0].u.param_list); +} +#line 5585 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 191: +#line 1730 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = (yyvsp[-2].u.param_list); + (yyval.u.param_list)->_includes_ellipsis = true; +} +#line 5594 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 192: +#line 1735 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.param_list) = (yyvsp[-1].u.param_list); (yyval.u.param_list)->_includes_ellipsis = true; } -#line 5361 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5603 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 190: -#line 1730 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 193: +#line 1743 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.param_list) = new CPPParameterList; (yyval.u.param_list)->_parameters.push_back((yyvsp[0].u.instance)); } -#line 5370 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5612 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 191: -#line 1735 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 194: +#line 1748 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.param_list) = (yyvsp[-2].u.param_list); (yyval.u.param_list)->_parameters.push_back((yyvsp[0].u.instance)); } -#line 5379 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 192: -#line 1743 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 5387 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 193: -#line 1747 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 5395 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 194: -#line 1754 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 5403 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5621 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 195: -#line 1758 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1756 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (yyvsp[0].u.expr); + (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5411 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5629 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 196: -#line 1765 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1760 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 5419 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5637 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 197: -#line 1769 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1767 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5427 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5645 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 198: -#line 1773 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1771 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 5435 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5653 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 199: -#line 1777 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1778 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_default()); + (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5443 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5661 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 200: -#line 1781 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1782 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_delete()); + (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5451 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5669 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 201: -#line 1788 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1786 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5459 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5677 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 202: -#line 1792 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 5467 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 203: -#line 1796 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 5475 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 204: -#line 1800 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1790 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::get_default()); } -#line 5483 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5685 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 205: -#line 1804 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 203: +#line 1794 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::get_delete()); } -#line 5491 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5693 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 206: -#line 1808 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 204: +#line 1801 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5499 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5701 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 210: + case 205: +#line 1805 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 5709 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 206: +#line 1809 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[-1].u.expr); +} +#line 5717 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 207: +#line 1813 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::get_default()); +} +#line 5725 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 208: +#line 1817 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::get_delete()); +} +#line 5733 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 209: #line 1821 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { + (yyval.u.expr) = (CPPExpression *)NULL; } -#line 5506 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5741 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 214: -#line 1830 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 213: +#line 1834 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { +} +#line 5748 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 217: +#line 1843 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.instance) = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-1]).file); (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); } -#line 5515 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5757 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 215: -#line 1835 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 218: +#line 1848 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); (yyval.u.instance) = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-1]).file); (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); } -#line 5525 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5767 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 216: -#line 1841 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 219: +#line 1854 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); (yyval.u.instance) = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-2]).file); (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); } -#line 5535 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5777 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 217: -#line 1847 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 220: +#line 1860 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.instance) = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-1]).file); + (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); +} +#line 5786 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 221: +#line 1865 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); + (yyval.u.instance) = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-1]).file); + (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); +} +#line 5796 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 222: +#line 1871 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); + (yyval.u.instance) = new CPPInstance((yyvsp[-2].u.type), (yyvsp[-1].u.inst_ident), 0, (yylsp[-2]).file); + (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); +} +#line 5806 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 223: +#line 1877 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.instance) = (yyvsp[0].u.instance); } -#line 5543 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5814 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 218: -#line 1858 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 224: +#line 1888 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.instance) = (yyvsp[0].u.instance); } -#line 5551 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5822 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 219: -#line 1862 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 225: +#line 1892 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_parameter)); (yyval.u.instance) = new CPPInstance(type, "expr"); (yyval.u.instance)->set_initializer((yyvsp[0].u.expr)); } -#line 5562 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 220: -#line 1872 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5570 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 221: -#line 1876 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); -} -#line 5578 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 222: -#line 1880 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_const); -} -#line 5587 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 223: -#line 1885 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_volatile); -} -#line 5596 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 224: -#line 1890 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_pointer); -} -#line 5605 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 225: -#line 1895 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_reference); -} -#line 5614 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5833 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 226: -#line 1900 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1902 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } -#line 5623 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5841 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 227: -#line 1905 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1906 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); + (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); } -#line 5632 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5849 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 228: #line 1910 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); - (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); -} -#line 5641 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 229: -#line 1918 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5649 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 230: -#line 1922 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); -} -#line 5657 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 231: -#line 1926 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); } -#line 5666 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5858 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 232: -#line 1931 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 229: +#line 1915 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); } -#line 5675 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5867 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 233: -#line 1936 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 230: +#line 1920 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); } -#line 5684 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5876 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 234: -#line 1941 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 231: +#line 1925 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); } -#line 5693 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5885 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 235: -#line 1946 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 232: +#line 1930 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); } -#line 5702 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5894 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 236: -#line 1951 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 233: +#line 1935 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); } -#line 5711 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 234: +#line 1940 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); + (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); +} +#line 5912 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 235: +#line 1948 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); +} +#line 5920 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 236: +#line 1952 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); +} +#line 5928 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 237: #line 1956 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); - (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_const); } -#line 5720 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5937 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 238: #line 1961 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_volatile); +} +#line 5946 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 239: +#line 1966 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_pointer); +} +#line 5955 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 240: +#line 1971 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_reference); +} +#line 5964 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 241: +#line 1976 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); +} +#line 5973 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 242: +#line 1981 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); +} +#line 5982 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 243: +#line 1986 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); + (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); +} +#line 5991 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 244: +#line 1991 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { (yyval.u.inst_ident) = (yyvsp[-5].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); (yyval.u.inst_ident)->add_func_modifier((yyvsp[-2].u.param_list), (yyvsp[0].u.integer)); } -#line 5730 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6001 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 239: -#line 1967 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 245: +#line 1997 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-1].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); } -#line 5739 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 240: -#line 1975 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5747 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 241: -#line 1979 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_const); -} -#line 5756 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 242: -#line 1984 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_volatile); -} -#line 5765 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 243: -#line 1989 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_pointer); -} -#line 5774 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 244: -#line 1994 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_reference); -} -#line 5783 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 245: -#line 1999 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); -} -#line 5792 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6010 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 246: -#line 2004 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2005 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); - (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + (yyval.u.inst_ident)->_packed = true; } -#line 5801 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6019 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 247: -#line 2009 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2010 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); - (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); + (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); + (yyval.u.inst_ident)->_packed = true; } -#line 5810 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6028 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 248: -#line 2017 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5818 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 249: -#line 2021 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2015 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); } -#line 5827 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 250: -#line 2026 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 249: +#line 2020 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); } -#line 5836 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6046 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 251: -#line 2031 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 250: +#line 2025 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); } -#line 5845 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6055 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 252: -#line 2036 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 251: +#line 2030 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); } -#line 5854 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6064 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 253: -#line 2041 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 252: +#line 2035 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); } -#line 5863 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 254: -#line 2046 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 253: +#line 2040 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); } -#line 5872 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6082 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 255: -#line 2051 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 254: +#line 2045 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); } -#line 5881 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6091 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 255: +#line 2050 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[-5].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_paren); + (yyval.u.inst_ident)->add_func_modifier((yyvsp[-2].u.param_list), (yyvsp[0].u.integer)); +} +#line 6101 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 256: #line 2056 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { + (yyval.u.inst_ident) = (yyvsp[-1].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_paren); +} +#line 6110 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 257: +#line 2064 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); +} +#line 6118 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 258: +#line 2068 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + (yyval.u.inst_ident)->_packed = true; +} +#line 6127 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 259: +#line 2073 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); + (yyval.u.inst_ident)->_packed = true; +} +#line 6136 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 260: +#line 2078 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_const); +} +#line 6145 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 261: +#line 2083 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_volatile); +} +#line 6154 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 262: +#line 2088 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_pointer); +} +#line 6163 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 263: +#line 2093 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_reference); +} +#line 6172 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 264: +#line 2098 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); +} +#line 6181 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 265: +#line 2103 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); +} +#line 6190 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 266: +#line 2108 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); + (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); +} +#line 6199 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 267: +#line 2116 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); +} +#line 6207 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 268: +#line 2120 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + (yyval.u.inst_ident)->_packed = true; +} +#line 6216 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 269: +#line 2125 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); + (yyval.u.inst_ident)->_packed = true; +} +#line 6225 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 270: +#line 2130 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_const); +} +#line 6234 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 271: +#line 2135 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_volatile); +} +#line 6243 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 272: +#line 2140 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_pointer); +} +#line 6252 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 273: +#line 2145 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_reference); +} +#line 6261 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 274: +#line 2150 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); +} +#line 6270 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 275: +#line 2155 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[0].u.inst_ident); + (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[-2].u.identifier)); +} +#line 6279 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 276: +#line 2160 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = (yyvsp[-3].u.inst_ident); + (yyval.u.inst_ident)->add_array_modifier((yyvsp[-1].u.expr)); +} +#line 6288 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 277: +#line 2165 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); (yyval.u.inst_ident)->add_modifier(IIT_paren); (yyval.u.inst_ident)->add_func_modifier((yyvsp[-3].u.param_list), (yyvsp[-1].u.integer), (yyvsp[0].u.type)); } -#line 5891 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6298 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 257: -#line 2062 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 278: +#line 2171 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-6].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); (yyval.u.inst_ident)->add_modifier(IIT_paren); (yyval.u.inst_ident)->add_func_modifier((yyvsp[-3].u.param_list), (yyvsp[-1].u.integer), (yyvsp[0].u.type)); } -#line 5902 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6309 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 258: -#line 2069 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 279: +#line 2178 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-6].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); (yyval.u.inst_ident)->add_modifier(IIT_paren); (yyval.u.inst_ident)->add_func_modifier((yyvsp[-3].u.param_list), (yyvsp[-1].u.integer), (yyvsp[0].u.type)); } -#line 5913 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6320 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 259: -#line 2076 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 280: +#line 2185 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.inst_ident) = (yyvsp[-6].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); (yyval.u.inst_ident)->add_modifier(IIT_paren); (yyval.u.inst_ident)->add_func_modifier((yyvsp[-3].u.param_list), (yyvsp[-1].u.integer), (yyvsp[0].u.type)); } -#line 5924 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6331 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 260: -#line 2086 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 281: +#line 2195 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type((yyvsp[0].u.simple_type)); } -#line 5932 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6339 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 261: -#line 2090 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 282: +#line 2199 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.type) == NULL) { @@ -5940,43 +6356,43 @@ yyreduce: } assert((yyval.u.type) != NULL); } -#line 5944 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6351 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 262: -#line 2098 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 283: +#line 2207 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type(new CPPTBDType((yyvsp[0].u.identifier))); } -#line 5952 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6359 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 263: -#line 2102 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 284: +#line 2211 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type((yyvsp[0].u.struct_type)); } -#line 5960 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6367 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 264: -#line 2106 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 285: +#line 2215 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type((yyvsp[0].u.struct_type)); } -#line 5968 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6375 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 265: -#line 2110 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 286: +#line 2219 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type((yyvsp[0].u.enum_type)); } -#line 5976 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6383 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 266: -#line 2114 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 287: +#line 2223 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5992,11 +6408,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 5996 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6403 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 267: -#line 2130 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 288: +#line 2239 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[-2].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -6012,11 +6428,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 6016 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6423 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 268: -#line 2146 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 289: +#line 2255 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[-1].u.expr)->determine_type(); if ((yyval.u.type) == (CPPType *)NULL) { @@ -6025,27 +6441,53 @@ yyreduce: yyerror("could not determine type of " + str.str(), (yylsp[-1])); } } -#line 6029 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6436 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 269: -#line 2155 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 290: +#line 2264 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPEnumType *enum_type = (yyvsp[-1].u.type)->as_enum_type(); + if (enum_type == NULL) { + yyerror("an enumeration type is required", (yylsp[-1])); + (yyval.u.type) = (yyvsp[-1].u.type); + } else { + (yyval.u.type) = enum_type->get_underlying_type(); + } +} +#line 6450 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 291: +#line 2274 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_auto)); } -#line 6037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6458 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 270: -#line 2162 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 292: +#line 2281 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.type) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); + if ((yyval.u.type) == NULL) { + yyerror(string("internal error resolving type ") + (yyvsp[0].u.identifier)->get_fully_scoped_name(), (yylsp[0])); + } + assert((yyval.u.type) != NULL); +} +#line 6470 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 293: +#line 2292 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = CPPType::new_type((yyvsp[0].u.simple_type)); } -#line 6045 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6478 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 271: -#line 2166 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 294: +#line 2296 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.decl) == NULL) { @@ -6053,43 +6495,43 @@ yyreduce: } assert((yyval.u.decl) != NULL); } -#line 6057 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6490 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 272: -#line 2174 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 295: +#line 2304 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = CPPType::new_type(new CPPTBDType((yyvsp[0].u.identifier))); } -#line 6065 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6498 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 273: -#line 2178 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 296: +#line 2308 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = CPPType::new_type((yyvsp[0].u.struct_type)); } -#line 6073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6506 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 274: -#line 2182 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 297: +#line 2312 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = new CPPTypeDeclaration(CPPType::new_type((yyvsp[0].u.struct_type))); } -#line 6081 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6514 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 275: -#line 2186 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 298: +#line 2316 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = new CPPTypeDeclaration(CPPType::new_type((yyvsp[0].u.enum_type))); } -#line 6089 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6522 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 276: -#line 2190 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 299: +#line 2320 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -6105,11 +6547,11 @@ yyreduce: (yyval.u.decl) = et; } } -#line 6109 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6542 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 277: -#line 2206 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 300: +#line 2336 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[-2].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -6125,11 +6567,11 @@ yyreduce: (yyval.u.decl) = et; } } -#line 6129 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6562 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 278: -#line 2222 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 301: +#line 2352 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { yywarning(string("C++ does not permit forward declaration of untyped enum ") + (yyvsp[0].u.identifier)->get_fully_scoped_name(), (yylsp[-1])); @@ -6147,11 +6589,11 @@ yyreduce: (yyval.u.decl) = et; } } -#line 6151 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6584 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 279: -#line 2240 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 302: +#line 2370 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = (yyvsp[-1].u.expr)->determine_type(); if ((yyval.u.decl) == (CPPType *)NULL) { @@ -6160,27 +6602,41 @@ yyreduce: yyerror("could not determine type of " + str.str(), (yylsp[-1])); } } -#line 6164 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6597 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 280: -#line 2249 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 303: +#line 2379 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPEnumType *enum_type = (yyvsp[-1].u.type)->as_enum_type(); + if (enum_type == NULL) { + yyerror("an enumeration type is required", (yylsp[-1])); + (yyval.u.decl) = (yyvsp[-1].u.type); + } else { + (yyval.u.decl) = enum_type->get_underlying_type(); + } +} +#line 6611 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 304: +#line 2389 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_auto)); } -#line 6172 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6619 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 281: -#line 2256 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 305: +#line 2396 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type((yyvsp[0].u.simple_type)); } -#line 6180 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6627 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 282: -#line 2260 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 306: +#line 2400 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.type) == NULL) { @@ -6188,19 +6644,19 @@ yyreduce: } assert((yyval.u.type) != NULL); } -#line 6192 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6639 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 283: -#line 2268 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 307: +#line 2408 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type(new CPPTBDType((yyvsp[0].u.identifier))); } -#line 6200 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6647 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 284: -#line 2272 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 308: +#line 2412 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -6216,11 +6672,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 6220 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6667 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 285: -#line 2288 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 309: +#line 2428 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -6236,11 +6692,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 6240 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6687 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 286: -#line 2304 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 310: +#line 2444 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[-1].u.expr)->determine_type(); if ((yyval.u.type) == (CPPType *)NULL) { @@ -6249,54 +6705,85 @@ yyreduce: yyerror("could not determine type of " + str.str(), (yylsp[-1])); } } -#line 6253 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6700 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 287: -#line 2313 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 311: +#line 2453 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPEnumType *enum_type = (yyvsp[-1].u.type)->as_enum_type(); + if (enum_type == NULL) { + yyerror("an enumeration type is required", (yylsp[-1])); + (yyval.u.type) = (yyvsp[-1].u.type); + } else { + (yyval.u.type) = enum_type->get_underlying_type(); + } +} +#line 6714 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 312: +#line 2463 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_auto)); } -#line 6261 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6722 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 288: -#line 2320 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 313: +#line 2470 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.decl) = (yyvsp[0].u.decl); } -#line 6269 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6730 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 289: -#line 2324 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 314: +#line 2474 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { yyerror(string("unknown type '") + (yyvsp[0].u.identifier)->get_fully_scoped_name() + "'", (yylsp[0])); (yyval.u.decl) = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); } -#line 6279 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6740 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 290: -#line 2332 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 315: +#line 2482 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[0].u.inst_ident)->unroll_type((yyvsp[-1].u.type)); } -#line 6287 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6748 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 291: -#line 2336 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 316: +#line 2486 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyvsp[0].u.inst_ident)->add_modifier(IIT_const); (yyval.u.type) = (yyvsp[0].u.inst_ident)->unroll_type((yyvsp[-1].u.type)); } -#line 6296 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6757 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 292: -#line 2344 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 317: +#line 2491 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.type) = (yyvsp[0].u.inst_ident)->unroll_type((yyvsp[-1].u.type)); +} +#line 6765 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 318: +#line 2495 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyvsp[0].u.inst_ident)->add_modifier(IIT_const); + (yyval.u.type) = (yyvsp[0].u.inst_ident)->unroll_type((yyvsp[-1].u.type)); +} +#line 6774 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 319: +#line 2503 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPVisibility starting_vis = ((yyvsp[-1].u.extension_enum) == CPPExtensionType::T_class) ? V_private : V_public; @@ -6310,22 +6797,22 @@ yyreduce: push_scope(new_scope); push_struct(st); } -#line 6314 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6792 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 293: -#line 2358 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 320: +#line 2517 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.struct_type) = current_struct; current_struct->_incomplete = false; pop_struct(); pop_scope(); } -#line 6325 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 294: -#line 2368 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 321: +#line 2527 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPVisibility starting_vis = ((yyvsp[-1].u.extension_enum) == CPPExtensionType::T_class) ? V_private : V_public; @@ -6345,253 +6832,253 @@ yyreduce: push_scope(new_scope); push_struct(st); } -#line 6349 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6827 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 295: -#line 2388 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 322: +#line 2547 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.struct_type) = current_struct; current_struct->_incomplete = false; pop_struct(); pop_scope(); } -#line 6360 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6838 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 297: -#line 2399 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 324: +#line 2558 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->_final = true; } -#line 6368 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6846 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 302: -#line 2416 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 329: +#line 2575 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_unknown, false); } -#line 6376 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6854 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 303: -#line 2420 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 330: +#line 2579 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_public, false); } -#line 6384 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6862 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 304: -#line 2424 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 331: +#line 2583 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_protected, false); } -#line 6392 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6870 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 305: -#line 2428 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 332: +#line 2587 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_private, false); } -#line 6400 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6878 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 306: -#line 2432 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 333: +#line 2591 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_public, true); } -#line 6408 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6886 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 307: -#line 2436 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 334: +#line 2595 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_protected, true); } -#line 6416 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6894 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 308: -#line 2440 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 335: +#line 2599 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_private, true); } -#line 6424 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6902 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 309: -#line 2444 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 336: +#line 2603 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_public, true); } -#line 6432 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6910 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 310: -#line 2448 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 337: +#line 2607 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_protected, true); } -#line 6440 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6918 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 311: -#line 2452 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 338: +#line 2611 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_struct->append_derivation((yyvsp[0].u.type), V_private, true); } -#line 6448 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6926 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 312: -#line 2459 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 339: +#line 2618 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.enum_type) = current_enum; current_enum = NULL; } -#line 6457 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6935 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 313: -#line 2467 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 340: +#line 2626 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_enum = new CPPEnumType((yyvsp[-2].u.extension_enum), NULL, (yyvsp[0].u.type), current_scope, NULL, (yylsp[-2]).file); } -#line 6465 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6943 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 314: -#line 2471 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 341: +#line 2630 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_enum = new CPPEnumType((yyvsp[0].u.extension_enum), NULL, current_scope, NULL, (yylsp[0]).file); } -#line 6473 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6951 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 315: -#line 2475 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 342: +#line 2634 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPScope *new_scope = new CPPScope(current_scope, (yyvsp[-2].u.identifier)->_names.back(), V_public); current_enum = new CPPEnumType((yyvsp[-3].u.extension_enum), (yyvsp[-2].u.identifier), (yyvsp[0].u.type), current_scope, new_scope, (yylsp[-3]).file); } -#line 6482 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6960 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 316: -#line 2480 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 343: +#line 2639 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPScope *new_scope = new CPPScope(current_scope, (yyvsp[0].u.identifier)->_names.back(), V_public); current_enum = new CPPEnumType((yyvsp[-1].u.extension_enum), (yyvsp[0].u.identifier), current_scope, new_scope, (yylsp[-1]).file); } -#line 6491 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6969 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 317: -#line 2488 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 344: +#line 2647 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type((yyvsp[0].u.simple_type)); } -#line 6499 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 318: -#line 2492 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 345: +#line 2651 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); } -#line 6507 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 320: -#line 2500 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 347: +#line 2659 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { assert(current_enum != NULL); current_enum->add_element((yyvsp[-1].u.identifier)->get_simple_name(), NULL, current_lexer, (yylsp[-1])); } -#line 6516 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6994 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 321: -#line 2505 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 348: +#line 2664 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { assert(current_enum != NULL); current_enum->add_element((yyvsp[-3].u.identifier)->get_simple_name(), (yyvsp[-1].u.expr), current_lexer, (yylsp[-3])); } -#line 6525 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7003 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 323: -#line 2513 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 350: +#line 2672 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { assert(current_enum != NULL); current_enum->add_element((yyvsp[0].u.identifier)->get_simple_name(), NULL, current_lexer, (yylsp[0])); } -#line 6534 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7012 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 324: -#line 2518 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 351: +#line 2677 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { assert(current_enum != NULL); current_enum->add_element((yyvsp[-2].u.identifier)->get_simple_name(), (yyvsp[0].u.expr), current_lexer, (yylsp[-2])); } -#line 6543 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7021 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 325: -#line 2526 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 352: +#line 2685 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.extension_enum) = CPPExtensionType::T_enum; } -#line 6551 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7029 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 326: -#line 2530 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 353: +#line 2689 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.extension_enum) = CPPExtensionType::T_enum_class; } -#line 6559 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 327: -#line 2534 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 354: +#line 2693 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.extension_enum) = CPPExtensionType::T_enum_struct; } -#line 6567 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7045 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 328: -#line 2541 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 355: +#line 2700 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.extension_enum) = CPPExtensionType::T_class; } -#line 6575 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7053 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 329: -#line 2545 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 356: +#line 2704 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.extension_enum) = CPPExtensionType::T_struct; } -#line 6583 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7061 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 330: -#line 2549 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 357: +#line 2708 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.extension_enum) = CPPExtensionType::T_union; } -#line 6591 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7069 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 331: -#line 2556 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 358: +#line 2715 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPScope *scope = (yyvsp[-1].u.identifier)->find_scope(current_scope, global_scope, current_lexer); if (scope == NULL) { @@ -6609,19 +7096,19 @@ yyreduce: current_scope->define_namespace(nspace); push_scope(scope); } -#line 6613 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7091 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 332: -#line 2574 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 359: +#line 2733 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); } -#line 6621 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7099 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 333: -#line 2578 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 360: +#line 2737 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPScope *scope = (yyvsp[-1].u.identifier)->find_scope(current_scope, global_scope, current_lexer); if (scope == NULL) { @@ -6640,143 +7127,143 @@ yyreduce: current_scope->define_namespace(nspace); push_scope(scope); } -#line 6644 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7122 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 334: -#line 2597 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 361: +#line 2756 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); } -#line 6652 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7130 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 337: -#line 2606 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 364: +#line 2765 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPUsing *using_decl = new CPPUsing((yyvsp[-1].u.identifier), false, (yylsp[-2]).file); current_scope->add_declaration(using_decl, global_scope, current_lexer, (yylsp[-2])); current_scope->add_using(using_decl, global_scope, current_lexer); } -#line 6662 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7140 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 338: -#line 2612 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 365: +#line 2771 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // This is really just an alternative way to declare a typedef. CPPTypedefType *typedef_type = new CPPTypedefType((yyvsp[-1].u.type), (yyvsp[-3].u.identifier), current_scope); typedef_type->_using = true; current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, (yylsp[-4])); } -#line 6673 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7151 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 339: -#line 2619 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 366: +#line 2778 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPUsing *using_decl = new CPPUsing((yyvsp[-1].u.identifier), true, (yylsp[-3]).file); current_scope->add_declaration(using_decl, global_scope, current_lexer, (yylsp[-3])); current_scope->add_using(using_decl, global_scope, current_lexer); } -#line 6683 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7161 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 343: -#line 2634 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 370: +#line 2793 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_bool); } -#line 6691 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7169 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 344: -#line 2638 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 371: +#line 2797 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_char); } -#line 6699 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7177 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 345: -#line 2642 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 372: +#line 2801 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_wchar_t); } -#line 6707 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7185 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 346: -#line 2646 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 373: +#line 2805 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_char16_t); } -#line 6715 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7193 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 347: -#line 2650 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 374: +#line 2809 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_char32_t); } -#line 6723 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7201 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 348: -#line 2654 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 375: +#line 2813 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_short); } -#line 6732 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7210 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 349: -#line 2659 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 376: +#line 2818 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_long); } -#line 6741 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7219 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 350: -#line 2664 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 377: +#line 2823 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_unsigned); } -#line 6750 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7228 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 351: -#line 2669 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 378: +#line 2828 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_signed); } -#line 6759 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7237 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 352: -#line 2674 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 379: +#line 2833 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int); } -#line 6767 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7245 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 353: -#line 2678 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 380: +#line 2837 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = (yyvsp[0].u.simple_type); (yyval.u.simple_type)->_flags |= CPPSimpleType::F_short; } -#line 6776 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7254 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 354: -#line 2683 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 381: +#line 2842 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = (yyvsp[0].u.simple_type); if ((yyval.u.simple_type)->_flags & CPPSimpleType::F_long) { @@ -6785,477 +7272,485 @@ yyreduce: (yyval.u.simple_type)->_flags |= CPPSimpleType::F_long; } } -#line 6789 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7267 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 355: -#line 2692 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 382: +#line 2851 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = (yyvsp[0].u.simple_type); (yyval.u.simple_type)->_flags |= CPPSimpleType::F_unsigned; } -#line 6798 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7276 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 356: -#line 2697 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 383: +#line 2856 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = (yyvsp[0].u.simple_type); (yyval.u.simple_type)->_flags |= CPPSimpleType::F_signed; } -#line 6807 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7285 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 357: -#line 2705 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 384: +#line 2864 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_float); } -#line 6815 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7293 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 358: -#line 2709 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 385: +#line 2868 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_double); } -#line 6823 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7301 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 359: -#line 2713 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 386: +#line 2872 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_double, CPPSimpleType::F_long); } -#line 6832 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7310 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 360: -#line 2721 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 387: +#line 2880 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_void); } -#line 6840 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7318 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 361: -#line 2730 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 388: +#line 2889 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_lexer->_resolve_identifiers = false; } -#line 6848 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7326 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 362: -#line 2734 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 389: +#line 2893 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { current_lexer->_resolve_identifiers = true; } -#line 6856 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 465: -#line 2775 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { -} -#line 6863 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 489: -#line 2784 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 6871 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 490: -#line 2788 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6879 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 491: -#line 2795 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 6887 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 492: -#line 2799 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6895 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 493: -#line 2806 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 494: -#line 2810 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(',', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6911 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7334 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 495: -#line 2817 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2936 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 6919 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 496: -#line 2821 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); -} -#line 6927 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 497: -#line 2825 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_static_cast)); -} -#line 6935 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 498: -#line 2829 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_dynamic_cast)); -} -#line 6943 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 499: -#line 2833 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_const_cast)); -} -#line 6951 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 500: -#line 2837 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_reinterpret_cast)); -} -#line 6959 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 501: -#line 2841 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); -} -#line 6967 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 502: -#line 2845 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); -} -#line 6975 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 503: -#line 2849 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); -} -#line 6983 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 504: -#line 2853 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); -} -#line 6991 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 505: -#line 2857 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); -} -#line 6999 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 506: -#line 2861 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); -} -#line 7007 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 507: -#line 2865 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[0].u.expr)); -} -#line 7015 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 508: -#line 2869 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); -} -#line 7023 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 509: -#line 2873 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7031 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 510: -#line 2877 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7039 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 511: -#line 2881 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7047 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 512: -#line 2885 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7055 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 513: -#line 2889 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7063 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 514: -#line 2893 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7071 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 515: -#line 2897 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7079 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 516: -#line 2901 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7087 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 517: -#line 2905 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7095 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 518: -#line 2909 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7103 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7341 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 519: -#line 2913 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2945 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); + (yyval.u.expr) = (CPPExpression *)NULL; } -#line 7111 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7349 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 520: -#line 2917 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7119 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 521: -#line 2921 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7127 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 522: -#line 2925 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7135 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 523: -#line 2929 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7143 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 524: -#line 2933 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7151 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 525: -#line 2937 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('?', (yyvsp[-4].u.expr), (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7159 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 526: -#line 2941 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7167 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 527: -#line 2945 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7175 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 528: #line 2949 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); -} -#line 7183 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 529: -#line 2953 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7191 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 530: -#line 2957 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7199 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 531: -#line 2961 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 7207 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 532: -#line 2969 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 7215 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7357 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 533: -#line 2973 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 521: +#line 2956 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 7365 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 522: +#line 2960 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 7373 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 523: +#line 2967 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 7381 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 524: +#line 2971 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(',', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7389 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 525: +#line 2978 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 7397 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 526: +#line 2982 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); } -#line 7223 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7405 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 534: -#line 2977 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 527: +#line 2986 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_static_cast)); } -#line 7231 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7413 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 535: -#line 2981 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 528: +#line 2990 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_dynamic_cast)); } -#line 7239 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7421 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 536: -#line 2985 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 529: +#line 2994 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_const_cast)); } -#line 7247 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7429 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 537: -#line 2989 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 530: +#line 2998 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_reinterpret_cast)); } -#line 7255 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7437 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 531: +#line 3002 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); +} +#line 7445 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 532: +#line 3006 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_ellipsis_func((yyvsp[-1].u.identifier))); +} +#line 7453 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 533: +#line 3010 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); +} +#line 7461 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 534: +#line 3014 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); +} +#line 7469 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 535: +#line 3018 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); +} +#line 7477 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 536: +#line 3022 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); +} +#line 7485 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 537: +#line 3026 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); +} +#line 7493 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 538: -#line 2993 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 3030 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[0].u.expr)); +} +#line 7501 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 539: +#line 3034 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); +} +#line 7509 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 540: +#line 3038 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7517 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 541: +#line 3042 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7525 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 542: +#line 3046 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7533 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 543: +#line 3050 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7541 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 544: +#line 3054 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7549 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 545: +#line 3058 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7557 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 546: +#line 3062 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7565 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 547: +#line 3066 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7573 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 548: +#line 3070 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7581 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 549: +#line 3074 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7589 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 550: +#line 3078 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7597 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 551: +#line 3082 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7605 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 552: +#line 3086 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7613 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 553: +#line 3090 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7621 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 554: +#line 3094 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7629 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 555: +#line 3098 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7637 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 556: +#line 3102 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('?', (yyvsp[-4].u.expr), (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7645 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 557: +#line 3106 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); +} +#line 7653 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 558: +#line 3110 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); +} +#line 7661 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 559: +#line 3114 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); +} +#line 7669 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 560: +#line 3118 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7677 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 561: +#line 3122 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 7685 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 562: +#line 3126 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[-1].u.expr); +} +#line 7693 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 563: +#line 3134 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 7701 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 564: +#line 3138 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); +} +#line 7709 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 565: +#line 3142 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_static_cast)); +} +#line 7717 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 566: +#line 3146 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_dynamic_cast)); +} +#line 7725 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 567: +#line 3150 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_const_cast)); +} +#line 7733 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 568: +#line 3154 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_reinterpret_cast)); +} +#line 7741 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 569: +#line 3158 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // A constructor call. CPPType *type = (yyvsp[-3].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); @@ -7265,633 +7760,175 @@ yyreduce: assert(type != NULL); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7269 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7755 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 539: -#line 3003 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 570: +#line 3168 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7279 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7765 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 540: -#line 3009 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 571: +#line 3174 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7289 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7775 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 541: -#line 3015 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 572: +#line 3180 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_wchar_t)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7299 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7785 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 542: -#line 3021 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 573: +#line 3186 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char16_t)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7309 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7795 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 543: -#line 3027 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 574: +#line 3192 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char32_t)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7319 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7805 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 544: -#line 3033 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 575: +#line 3198 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_bool)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7329 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7815 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 545: -#line 3039 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 576: +#line 3204 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_short)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7340 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7826 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 546: -#line 3046 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 577: +#line 3211 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_long)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7351 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7837 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 547: -#line 3053 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 578: +#line 3218 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_unsigned)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7362 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7848 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 548: -#line 3060 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 579: +#line 3225 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_signed)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7373 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7859 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 549: -#line 3067 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 580: +#line 3232 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_float)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7383 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7869 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 550: -#line 3073 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 581: +#line 3238 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_double)); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7393 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 551: -#line 3079 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); -} -#line 7401 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 552: -#line 3083 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); -} -#line 7409 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 553: -#line 3087 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[0].u.type))); -} -#line 7417 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 554: -#line 3091 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[-3].u.type), (yyvsp[-1].u.expr))); -} -#line 7425 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 555: -#line 3095 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - CPPIdentifier ident(""); - ident.add_name("std"); - ident.add_name("type_info"); - CPPType *std_type_info = ident.find_type(current_scope, global_scope, false, current_lexer); - if (!std_type_info) { - yywarning("cannot use typeid before including ", (yylsp[-3])); - } - (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.type), std_type_info)); -} -#line 7440 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 556: -#line 3106 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - CPPIdentifier ident(""); - ident.add_name("std"); - ident.add_name("type_info"); - CPPType *std_type_info = ident.find_type(current_scope, global_scope, false, current_lexer); - if (!std_type_info) { - yywarning("cannot use typeid before including ", (yylsp[-3])); - } - (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.expr), std_type_info)); -} -#line 7455 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 557: -#line 3117 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); -} -#line 7463 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 558: -#line 3121 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); -} -#line 7471 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 559: -#line 3125 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); -} -#line 7479 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 560: -#line 3129 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); -} -#line 7487 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 561: -#line 3133 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[0].u.expr)); -} -#line 7495 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 562: -#line 3137 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); -} -#line 7503 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 563: -#line 3141 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7511 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 564: -#line 3145 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7519 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 565: -#line 3149 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7527 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 566: -#line 3153 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7535 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 567: -#line 3157 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7543 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 568: -#line 3161 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7551 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 569: -#line 3165 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7559 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 570: -#line 3169 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7567 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 571: -#line 3173 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7575 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 572: -#line 3177 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7583 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 573: -#line 3181 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7591 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 574: -#line 3185 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7599 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 575: -#line 3189 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7607 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 576: -#line 3193 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7615 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 577: -#line 3197 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('<', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7623 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 578: -#line 3201 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('>', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7631 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 579: -#line 3205 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7639 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 580: -#line 3209 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7647 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 581: -#line 3213 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('?', (yyvsp[-4].u.expr), (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7655 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7879 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 582: -#line 3217 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7663 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 583: -#line 3221 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7671 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 584: -#line 3225 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); -} -#line 7679 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 585: -#line 3229 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7687 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 586: -#line 3233 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7695 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 587: -#line 3237 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 7703 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 588: #line 3244 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); -} -#line 7711 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 589: -#line 3248 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(true); -} -#line 7719 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 590: -#line 3252 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(false); -} -#line 7727 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 591: -#line 3256 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); -} -#line 7735 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 592: -#line 3260 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.real)); -} -#line 7743 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 593: -#line 3264 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 7751 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 594: -#line 3268 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 7759 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 595: -#line 3272 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.identifier), current_scope, global_scope, current_lexer); -} -#line 7767 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 596: -#line 3276 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - // A variable named "final". C++11 explicitly permits this. - CPPIdentifier *ident = new CPPIdentifier("final", (yylsp[0])); - (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); -} -#line 7777 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 597: -#line 3282 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - // A variable named "override". C++11 explicitly permits this. - CPPIdentifier *ident = new CPPIdentifier("override", (yylsp[0])); - (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); -} -#line 7787 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 598: -#line 3288 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); -} -#line 7795 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 599: -#line 3292 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = NULL; -} -#line 7803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 600: -#line 3296 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = NULL; -} -#line 7811 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 601: -#line 3310 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 7819 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 602: -#line 3314 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); -} -#line 7827 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 603: -#line 3318 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_static_cast)); -} -#line 7835 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 604: -#line 3322 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_dynamic_cast)); -} -#line 7843 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 605: -#line 3326 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_const_cast)); -} -#line 7851 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 606: -#line 3330 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_reinterpret_cast)); -} -#line 7859 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 607: -#line 3334 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); } -#line 7867 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7887 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 608: -#line 3338 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 583: +#line 3248 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_ellipsis_func((yyvsp[-1].u.identifier))); +} +#line 7895 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 584: +#line 3252 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); } -#line 7875 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 609: -#line 3342 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 585: +#line 3256 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[0].u.type))); } -#line 7883 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7911 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 610: -#line 3346 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 586: +#line 3260 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[-3].u.type), (yyvsp[-1].u.expr))); } -#line 7891 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7919 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 611: -#line 3350 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 587: +#line 3264 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPIdentifier ident(""); ident.add_name("std"); @@ -7902,11 +7939,11 @@ yyreduce: } (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.type), std_type_info)); } -#line 7906 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7934 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 612: -#line 3361 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 588: +#line 3275 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPIdentifier ident(""); ident.add_name("std"); @@ -7917,343 +7954,953 @@ yyreduce: } (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.expr), std_type_info)); } -#line 7921 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7949 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 613: -#line 3372 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 589: +#line 3286 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); } -#line 7929 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7957 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 614: -#line 3376 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 590: +#line 3290 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); } -#line 7937 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7965 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 615: -#line 3380 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 591: +#line 3294 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); } -#line 7945 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7973 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 616: -#line 3384 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 592: +#line 3298 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); } -#line 7953 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7981 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 617: -#line 3388 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 593: +#line 3302 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[0].u.expr)); +} +#line 7989 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 594: +#line 3306 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); } -#line 7961 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7997 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 618: -#line 3392 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 595: +#line 3310 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 7969 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8005 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 619: -#line 3396 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 596: +#line 3314 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 7977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8013 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 620: -#line 3400 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 597: +#line 3318 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 7985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8021 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 621: -#line 3404 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 598: +#line 3322 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 7993 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8029 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 622: -#line 3408 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 599: +#line 3326 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8001 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 623: -#line 3412 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 600: +#line 3330 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8009 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8045 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 624: -#line 3416 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 601: +#line 3334 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8017 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8053 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 625: -#line 3420 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 602: +#line 3338 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8025 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8061 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 626: -#line 3424 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 603: +#line 3342 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8033 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8069 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 627: -#line 3428 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 604: +#line 3346 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8041 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8077 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 628: -#line 3432 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 605: +#line 3350 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8049 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8085 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 629: -#line 3436 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 606: +#line 3354 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8057 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8093 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 630: -#line 3440 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 607: +#line 3358 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8065 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8101 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 631: -#line 3444 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 608: +#line 3362 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8109 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 632: -#line 3448 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 609: +#line 3366 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('<', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8081 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8117 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 633: -#line 3452 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 610: +#line 3370 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('>', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8089 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8125 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 634: -#line 3456 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 611: +#line 3374 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8097 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8133 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 635: -#line 3460 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 612: +#line 3378 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8105 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8141 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 636: -#line 3464 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 613: +#line 3382 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('?', (yyvsp[-4].u.expr), (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8113 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8149 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 637: -#line 3468 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 614: +#line 3386 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); } -#line 8121 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8157 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 638: -#line 3472 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 615: +#line 3390 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); } -#line 8129 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8165 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 639: -#line 3476 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 616: +#line 3394 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); } -#line 8137 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8173 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 640: -#line 3480 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 617: +#line 3398 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8145 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8181 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 641: -#line 3484 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 618: +#line 3402 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); } -#line 8153 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8189 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 642: -#line 3488 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 619: +#line 3406 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (yyvsp[-1].u.expr); } -#line 8161 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8197 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 643: -#line 3495 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 620: +#line 3413 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); } -#line 8169 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8205 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 644: -#line 3499 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 621: +#line 3417 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(true); } -#line 8177 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8213 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 645: -#line 3503 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 622: +#line 3421 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(false); } -#line 8185 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8221 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 646: -#line 3507 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 623: +#line 3425 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); } -#line 8193 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8229 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 647: -#line 3511 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 624: +#line 3429 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression((yyvsp[0].u.real)); } -#line 8201 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8237 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 648: -#line 3515 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 625: +#line 3433 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 8209 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 649: -#line 3519 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 8217 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 650: -#line 3523 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.identifier), current_scope, global_scope, current_lexer); -} -#line 8225 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 651: -#line 3527 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - // A variable named "final". C++11 explicitly permits this. - CPPIdentifier *ident = new CPPIdentifier("final", (yylsp[0])); - (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); -} -#line 8235 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 652: -#line 3533 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - // A variable named "override". C++11 explicitly permits this. - CPPIdentifier *ident = new CPPIdentifier("override", (yylsp[0])); - (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); -} #line 8245 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 653: -#line 3539 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 626: +#line 3437 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); + (yyval.u.expr) = (yyvsp[0].u.expr); } #line 8253 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; + case 627: +#line 3441 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.identifier), current_scope, global_scope, current_lexer); +} +#line 8261 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 628: +#line 3445 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + // A variable named "final". C++11 explicitly permits this. + CPPIdentifier *ident = new CPPIdentifier("final", (yylsp[0])); + (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); +} +#line 8271 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 629: +#line 3451 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + // A variable named "override". C++11 explicitly permits this. + CPPIdentifier *ident = new CPPIdentifier("override", (yylsp[0])); + (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); +} +#line 8281 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 630: +#line 3457 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); +} +#line 8289 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 631: +#line 3461 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = NULL; +} +#line 8297 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 632: +#line 3465 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = NULL; +} +#line 8305 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 633: +#line 3469 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_HAS_VIRTUAL_DESTRUCTOR, (yyvsp[-1].u.type))); +} +#line 8313 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 634: +#line 3473 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_ABSTRACT, (yyvsp[-1].u.type))); +} +#line 8321 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 635: +#line 3477 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_CLASS, (yyvsp[-3].u.type), (yyvsp[-1].u.type))); +} +#line 8329 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 636: +#line 3481 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_CLASS, (yyvsp[-1].u.type))); +} +#line 8337 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 637: +#line 3485 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_CONSTRUCTIBLE, (yyvsp[-1].u.type))); +} +#line 8345 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 638: +#line 3489 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_CONSTRUCTIBLE, (yyvsp[-3].u.type), (yyvsp[-1].u.type))); +} +#line 8353 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 639: +#line 3493 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_CONVERTIBLE_TO, (yyvsp[-3].u.type), (yyvsp[-1].u.type))); +} +#line 8361 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 640: +#line 3497 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_DESTRUCTIBLE, (yyvsp[-1].u.type))); +} +#line 8369 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 641: +#line 3501 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_EMPTY, (yyvsp[-1].u.type))); +} +#line 8377 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 642: +#line 3505 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_ENUM, (yyvsp[-1].u.type))); +} +#line 8385 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 643: +#line 3509 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_FINAL, (yyvsp[-1].u.type))); +} +#line 8393 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 644: +#line 3513 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_FUNDAMENTAL, (yyvsp[-1].u.type))); +} +#line 8401 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 645: +#line 3517 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_POD, (yyvsp[-1].u.type))); +} +#line 8409 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 646: +#line 3521 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_POLYMORPHIC, (yyvsp[-1].u.type))); +} +#line 8417 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 647: +#line 3525 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_STANDARD_LAYOUT, (yyvsp[-1].u.type))); +} +#line 8425 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 648: +#line 3529 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_TRIVIAL, (yyvsp[-1].u.type))); +} +#line 8433 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 649: +#line 3533 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::type_trait(KW_IS_UNION, (yyvsp[-1].u.type))); +} +#line 8441 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 650: +#line 3547 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 8449 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 651: +#line 3551 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); +} +#line 8457 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 652: +#line 3555 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_static_cast)); +} +#line 8465 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 653: +#line 3559 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_dynamic_cast)); +} +#line 8473 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 654: +#line 3563 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_const_cast)); +} +#line 8481 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 655: +#line 3567 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_reinterpret_cast)); +} +#line 8489 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 656: +#line 3571 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); +} +#line 8497 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 657: +#line 3575 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_ellipsis_func((yyvsp[-1].u.identifier))); +} +#line 8505 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 658: +#line 3579 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); +} +#line 8513 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 659: +#line 3583 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[0].u.type))); +} +#line 8521 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 660: +#line 3587 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[-3].u.type), (yyvsp[-1].u.expr))); +} +#line 8529 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + case 661: -#line 3560 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 3591 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPIdentifier ident(""); + ident.add_name("std"); + ident.add_name("type_info"); + CPPType *std_type_info = ident.find_type(current_scope, global_scope, false, current_lexer); + if (!std_type_info) { + yywarning("cannot use typeid before including ", (yylsp[-3])); + } + (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.type), std_type_info)); +} +#line 8544 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 662: +#line 3602 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPIdentifier ident(""); + ident.add_name("std"); + ident.add_name("type_info"); + CPPType *std_type_info = ident.find_type(current_scope, global_scope, false, current_lexer); + if (!std_type_info) { + yywarning("cannot use typeid before including ", (yylsp[-3])); + } + (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.expr), std_type_info)); +} +#line 8559 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 663: +#line 3613 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); +} +#line 8567 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 664: +#line 3617 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); +} +#line 8575 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 665: +#line 3621 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); +} +#line 8583 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 666: +#line 3625 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); +} +#line 8591 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 667: +#line 3629 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); +} +#line 8599 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 668: +#line 3633 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8607 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 669: +#line 3637 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8615 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 670: +#line 3641 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8623 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 671: +#line 3645 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8631 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 672: +#line 3649 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8639 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 673: +#line 3653 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8647 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 674: +#line 3657 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8655 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 675: +#line 3661 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8663 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 676: +#line 3665 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8671 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 677: +#line 3669 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8679 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 678: +#line 3673 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8687 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 679: +#line 3677 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8695 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 680: +#line 3681 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8703 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 681: +#line 3685 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8711 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 682: +#line 3689 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('<', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8719 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 683: +#line 3693 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('>', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8727 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 684: +#line 3697 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8735 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 685: +#line 3701 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8743 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 686: +#line 3705 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('?', (yyvsp[-4].u.expr), (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8751 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 687: +#line 3709 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); +} +#line 8759 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 688: +#line 3713 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); +} +#line 8767 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 689: +#line 3717 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); +} +#line 8775 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 690: +#line 3721 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8783 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 691: +#line 3725 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); +} +#line 8791 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 692: +#line 3729 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[-1].u.expr); +} +#line 8799 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 693: +#line 3736 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); +} +#line 8807 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 694: +#line 3740 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(true); +} +#line 8815 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 695: +#line 3744 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(false); +} +#line 8823 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 696: +#line 3748 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); +} +#line 8831 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 697: +#line 3752 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.real)); +} +#line 8839 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 698: +#line 3756 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 8847 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 699: +#line 3760 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 8855 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 700: +#line 3764 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.identifier), current_scope, global_scope, current_lexer); +} +#line 8863 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 701: +#line 3768 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + // A variable named "final". C++11 explicitly permits this. + CPPIdentifier *ident = new CPPIdentifier("final", (yylsp[0])); + (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); +} +#line 8873 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 702: +#line 3774 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + // A variable named "override". C++11 explicitly permits this. + CPPIdentifier *ident = new CPPIdentifier("override", (yylsp[0])); + (yyval.u.expr) = new CPPExpression(ident, current_scope, global_scope, current_lexer); +} +#line 8883 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 703: +#line 3780 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); +} +#line 8891 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 711: +#line 3801 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, true); if (type == NULL) { @@ -8261,11 +8908,11 @@ yyreduce: } (yyval.u.type) = type; } -#line 8265 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 662: -#line 3568 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 712: +#line 3809 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { CPPType *type = (yyvsp[0].u.identifier)->find_type(current_scope, global_scope, true, current_lexer); if (type == NULL) { @@ -8273,143 +8920,169 @@ yyreduce: } (yyval.u.type) = type; } -#line 8277 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8915 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 663: -#line 3576 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 713: +#line 3817 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.type) = CPPType::new_type(new CPPTBDType((yyvsp[0].u.identifier))); } -#line 8285 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8923 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 664: -#line 3604 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 714: +#line 3821 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((yyvsp[-1].u.identifier)); + ctp->_packed = true; + (yyval.u.type) = CPPType::new_type(ctp); +} +#line 8933 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 715: +#line 3851 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = (yyvsp[0].u.identifier); } -#line 8293 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8941 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 665: -#line 3608 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 716: +#line 3855 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = (yyvsp[0].u.identifier); } -#line 8301 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8949 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 666: -#line 3612 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 717: +#line 3859 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.identifier) = (yyvsp[0].u.identifier); +} +#line 8957 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 718: +#line 3863 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("final", (yylsp[0])); } -#line 8309 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8965 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 667: -#line 3616 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 719: +#line 3867 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("override", (yylsp[0])); } -#line 8317 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8973 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 668: -#line 3620 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 720: +#line 3871 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // This is not a keyword in Python, so it is useful to be able to use this // in MAKE_PROPERTY definitions, etc. (yyval.u.identifier) = new CPPIdentifier("signed", (yylsp[0])); } -#line 8327 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8983 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 669: -#line 3626 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 721: +#line 3877 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("float", (yylsp[0])); } -#line 8335 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8991 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 670: -#line 3630 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 722: +#line 3881 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("public", (yylsp[0])); } -#line 8343 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8999 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 671: -#line 3634 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 723: +#line 3885 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("private", (yylsp[0])); } -#line 8351 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9007 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 672: -#line 3638 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 724: +#line 3889 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("static", (yylsp[0])); } -#line 8359 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9015 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 673: -#line 3649 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 725: +#line 3900 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = (yyvsp[0].u.identifier); } -#line 8367 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9023 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 674: -#line 3653 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 726: +#line 3904 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = (yyvsp[0].u.identifier); } -#line 8375 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9031 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 675: -#line 3657 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 727: +#line 3908 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.identifier) = (yyvsp[0].u.identifier); +} +#line 9039 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 728: +#line 3912 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.identifier) = new CPPIdentifier("override", (yylsp[0])); } -#line 8383 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9047 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 676: -#line 3665 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 729: +#line 3920 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression((yyvsp[0].str)); } -#line 8391 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9055 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 677: -#line 3669 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 730: +#line 3924 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 8399 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9063 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 678: -#line 3673 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 731: +#line 3928 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // The right string takes on the literal type of the left. (yyval.u.expr) = (yyvsp[-1].u.expr); (yyval.u.expr)->_str += (yyvsp[0].str); } -#line 8409 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 679: -#line 3679 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 732: +#line 3934 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // We have to check that the two literal types match up. (yyval.u.expr) = (yyvsp[-1].u.expr); @@ -8418,11 +9091,11 @@ yyreduce: } (yyval.u.expr)->_str += (yyvsp[0].u.expr)->_str; } -#line 8422 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9086 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; -#line 8426 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9090 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/dtool/src/cppparser/cppBison.h.prebuilt b/dtool/src/cppparser/cppBison.h.prebuilt index 412b128300..223bfdf123 100644 --- a/dtool/src/cppparser/cppBison.h.prebuilt +++ b/dtool/src/cppparser/cppBison.h.prebuilt @@ -54,120 +54,138 @@ extern int cppyydebug; CUSTOM_LITERAL = 264, IDENTIFIER = 265, TYPENAME_IDENTIFIER = 266, - SCOPING = 267, - TYPEDEFNAME = 268, - ELLIPSIS = 269, - OROR = 270, - ANDAND = 271, - EQCOMPARE = 272, - NECOMPARE = 273, - LECOMPARE = 274, - GECOMPARE = 275, - LSHIFT = 276, - RSHIFT = 277, - POINTSAT_STAR = 278, - DOT_STAR = 279, - UNARY = 280, - UNARY_NOT = 281, - UNARY_NEGATE = 282, - UNARY_MINUS = 283, - UNARY_PLUS = 284, - UNARY_STAR = 285, - UNARY_REF = 286, - POINTSAT = 287, - SCOPE = 288, - PLUSPLUS = 289, - MINUSMINUS = 290, - TIMESEQUAL = 291, - DIVIDEEQUAL = 292, - MODEQUAL = 293, - PLUSEQUAL = 294, - MINUSEQUAL = 295, - OREQUAL = 296, - ANDEQUAL = 297, - XOREQUAL = 298, - LSHIFTEQUAL = 299, - RSHIFTEQUAL = 300, - KW_ALIGNAS = 301, - KW_ALIGNOF = 302, - KW_AUTO = 303, - KW_BEGIN_PUBLISH = 304, - KW_BLOCKING = 305, - KW_BOOL = 306, - KW_CATCH = 307, - KW_CHAR = 308, - KW_CHAR16_T = 309, - KW_CHAR32_T = 310, - KW_CLASS = 311, - KW_CONST = 312, - KW_CONSTEXPR = 313, - KW_CONST_CAST = 314, - KW_DECLTYPE = 315, - KW_DEFAULT = 316, - KW_DELETE = 317, - KW_DOUBLE = 318, - KW_DYNAMIC_CAST = 319, - KW_ELSE = 320, - KW_END_PUBLISH = 321, - KW_ENUM = 322, - KW_EXTENSION = 323, - KW_EXTERN = 324, - KW_EXPLICIT = 325, - KW_PUBLISHED = 326, - KW_FALSE = 327, - KW_FINAL = 328, - KW_FLOAT = 329, - KW_FRIEND = 330, - KW_FOR = 331, - KW_GOTO = 332, - KW_IF = 333, - KW_INLINE = 334, - KW_INT = 335, - KW_LONG = 336, - KW_MAKE_MAP_PROPERTY = 337, - KW_MAKE_PROPERTY = 338, - KW_MAKE_PROPERTY2 = 339, - KW_MAKE_SEQ = 340, - KW_MAKE_SEQ_PROPERTY = 341, - KW_MUTABLE = 342, - KW_NAMESPACE = 343, - KW_NEW = 344, - KW_NOEXCEPT = 345, - KW_NULLPTR = 346, - KW_OPERATOR = 347, - KW_OVERRIDE = 348, - KW_PRIVATE = 349, - KW_PROTECTED = 350, - KW_PUBLIC = 351, - KW_REGISTER = 352, - KW_REINTERPRET_CAST = 353, - KW_RETURN = 354, - KW_SHORT = 355, - KW_SIGNED = 356, - KW_SIZEOF = 357, - KW_STATIC = 358, - KW_STATIC_ASSERT = 359, - KW_STATIC_CAST = 360, - KW_STRUCT = 361, - KW_TEMPLATE = 362, - KW_THREAD_LOCAL = 363, - KW_THROW = 364, - KW_TRUE = 365, - KW_TRY = 366, - KW_TYPEDEF = 367, - KW_TYPEID = 368, - KW_TYPENAME = 369, - KW_UNION = 370, - KW_UNSIGNED = 371, - KW_USING = 372, - KW_VIRTUAL = 373, - KW_VOID = 374, - KW_VOLATILE = 375, - KW_WCHAR_T = 376, - KW_WHILE = 377, - START_CPP = 378, - START_CONST_EXPR = 379, - START_TYPE = 380 + TYPEPACK_IDENTIFIER = 267, + SCOPING = 268, + TYPEDEFNAME = 269, + ELLIPSIS = 270, + OROR = 271, + ANDAND = 272, + EQCOMPARE = 273, + NECOMPARE = 274, + LECOMPARE = 275, + GECOMPARE = 276, + LSHIFT = 277, + RSHIFT = 278, + POINTSAT_STAR = 279, + DOT_STAR = 280, + UNARY = 281, + UNARY_NOT = 282, + UNARY_NEGATE = 283, + UNARY_MINUS = 284, + UNARY_PLUS = 285, + UNARY_STAR = 286, + UNARY_REF = 287, + POINTSAT = 288, + SCOPE = 289, + PLUSPLUS = 290, + MINUSMINUS = 291, + TIMESEQUAL = 292, + DIVIDEEQUAL = 293, + MODEQUAL = 294, + PLUSEQUAL = 295, + MINUSEQUAL = 296, + OREQUAL = 297, + ANDEQUAL = 298, + XOREQUAL = 299, + LSHIFTEQUAL = 300, + RSHIFTEQUAL = 301, + KW_ALIGNAS = 302, + KW_ALIGNOF = 303, + KW_AUTO = 304, + KW_BEGIN_PUBLISH = 305, + KW_BLOCKING = 306, + KW_BOOL = 307, + KW_CATCH = 308, + KW_CHAR = 309, + KW_CHAR16_T = 310, + KW_CHAR32_T = 311, + KW_CLASS = 312, + KW_CONST = 313, + KW_CONSTEXPR = 314, + KW_CONST_CAST = 315, + KW_DECLTYPE = 316, + KW_DEFAULT = 317, + KW_DELETE = 318, + KW_DOUBLE = 319, + KW_DYNAMIC_CAST = 320, + KW_ELSE = 321, + KW_END_PUBLISH = 322, + KW_ENUM = 323, + KW_EXTENSION = 324, + KW_EXTERN = 325, + KW_EXPLICIT = 326, + KW_PUBLISHED = 327, + KW_FALSE = 328, + KW_FINAL = 329, + KW_FLOAT = 330, + KW_FRIEND = 331, + KW_FOR = 332, + KW_GOTO = 333, + KW_HAS_VIRTUAL_DESTRUCTOR = 334, + KW_IF = 335, + KW_INLINE = 336, + KW_INT = 337, + KW_IS_ABSTRACT = 338, + KW_IS_BASE_OF = 339, + KW_IS_CLASS = 340, + KW_IS_CONSTRUCTIBLE = 341, + KW_IS_CONVERTIBLE_TO = 342, + KW_IS_DESTRUCTIBLE = 343, + KW_IS_EMPTY = 344, + KW_IS_ENUM = 345, + KW_IS_FINAL = 346, + KW_IS_FUNDAMENTAL = 347, + KW_IS_POD = 348, + KW_IS_POLYMORPHIC = 349, + KW_IS_STANDARD_LAYOUT = 350, + KW_IS_TRIVIAL = 351, + KW_IS_UNION = 352, + KW_LONG = 353, + KW_MAKE_MAP_PROPERTY = 354, + KW_MAKE_PROPERTY = 355, + KW_MAKE_PROPERTY2 = 356, + KW_MAKE_SEQ = 357, + KW_MAKE_SEQ_PROPERTY = 358, + KW_MUTABLE = 359, + KW_NAMESPACE = 360, + KW_NEW = 361, + KW_NOEXCEPT = 362, + KW_NULLPTR = 363, + KW_OPERATOR = 364, + KW_OVERRIDE = 365, + KW_PRIVATE = 366, + KW_PROTECTED = 367, + KW_PUBLIC = 368, + KW_REGISTER = 369, + KW_REINTERPRET_CAST = 370, + KW_RETURN = 371, + KW_SHORT = 372, + KW_SIGNED = 373, + KW_SIZEOF = 374, + KW_STATIC = 375, + KW_STATIC_ASSERT = 376, + KW_STATIC_CAST = 377, + KW_STRUCT = 378, + KW_TEMPLATE = 379, + KW_THREAD_LOCAL = 380, + KW_THROW = 381, + KW_TRUE = 382, + KW_TRY = 383, + KW_TYPEDEF = 384, + KW_TYPEID = 385, + KW_TYPENAME = 386, + KW_UNDERLYING_TYPE = 387, + KW_UNION = 388, + KW_UNSIGNED = 389, + KW_USING = 390, + KW_VIRTUAL = 391, + KW_VOID = 392, + KW_VOLATILE = 393, + KW_WCHAR_T = 394, + KW_WHILE = 395, + START_CPP = 396, + START_CONST_EXPR = 397, + START_TYPE = 398 }; #endif /* Tokens. */ @@ -180,120 +198,138 @@ extern int cppyydebug; #define CUSTOM_LITERAL 264 #define IDENTIFIER 265 #define TYPENAME_IDENTIFIER 266 -#define SCOPING 267 -#define TYPEDEFNAME 268 -#define ELLIPSIS 269 -#define OROR 270 -#define ANDAND 271 -#define EQCOMPARE 272 -#define NECOMPARE 273 -#define LECOMPARE 274 -#define GECOMPARE 275 -#define LSHIFT 276 -#define RSHIFT 277 -#define POINTSAT_STAR 278 -#define DOT_STAR 279 -#define UNARY 280 -#define UNARY_NOT 281 -#define UNARY_NEGATE 282 -#define UNARY_MINUS 283 -#define UNARY_PLUS 284 -#define UNARY_STAR 285 -#define UNARY_REF 286 -#define POINTSAT 287 -#define SCOPE 288 -#define PLUSPLUS 289 -#define MINUSMINUS 290 -#define TIMESEQUAL 291 -#define DIVIDEEQUAL 292 -#define MODEQUAL 293 -#define PLUSEQUAL 294 -#define MINUSEQUAL 295 -#define OREQUAL 296 -#define ANDEQUAL 297 -#define XOREQUAL 298 -#define LSHIFTEQUAL 299 -#define RSHIFTEQUAL 300 -#define KW_ALIGNAS 301 -#define KW_ALIGNOF 302 -#define KW_AUTO 303 -#define KW_BEGIN_PUBLISH 304 -#define KW_BLOCKING 305 -#define KW_BOOL 306 -#define KW_CATCH 307 -#define KW_CHAR 308 -#define KW_CHAR16_T 309 -#define KW_CHAR32_T 310 -#define KW_CLASS 311 -#define KW_CONST 312 -#define KW_CONSTEXPR 313 -#define KW_CONST_CAST 314 -#define KW_DECLTYPE 315 -#define KW_DEFAULT 316 -#define KW_DELETE 317 -#define KW_DOUBLE 318 -#define KW_DYNAMIC_CAST 319 -#define KW_ELSE 320 -#define KW_END_PUBLISH 321 -#define KW_ENUM 322 -#define KW_EXTENSION 323 -#define KW_EXTERN 324 -#define KW_EXPLICIT 325 -#define KW_PUBLISHED 326 -#define KW_FALSE 327 -#define KW_FINAL 328 -#define KW_FLOAT 329 -#define KW_FRIEND 330 -#define KW_FOR 331 -#define KW_GOTO 332 -#define KW_IF 333 -#define KW_INLINE 334 -#define KW_INT 335 -#define KW_LONG 336 -#define KW_MAKE_MAP_PROPERTY 337 -#define KW_MAKE_PROPERTY 338 -#define KW_MAKE_PROPERTY2 339 -#define KW_MAKE_SEQ 340 -#define KW_MAKE_SEQ_PROPERTY 341 -#define KW_MUTABLE 342 -#define KW_NAMESPACE 343 -#define KW_NEW 344 -#define KW_NOEXCEPT 345 -#define KW_NULLPTR 346 -#define KW_OPERATOR 347 -#define KW_OVERRIDE 348 -#define KW_PRIVATE 349 -#define KW_PROTECTED 350 -#define KW_PUBLIC 351 -#define KW_REGISTER 352 -#define KW_REINTERPRET_CAST 353 -#define KW_RETURN 354 -#define KW_SHORT 355 -#define KW_SIGNED 356 -#define KW_SIZEOF 357 -#define KW_STATIC 358 -#define KW_STATIC_ASSERT 359 -#define KW_STATIC_CAST 360 -#define KW_STRUCT 361 -#define KW_TEMPLATE 362 -#define KW_THREAD_LOCAL 363 -#define KW_THROW 364 -#define KW_TRUE 365 -#define KW_TRY 366 -#define KW_TYPEDEF 367 -#define KW_TYPEID 368 -#define KW_TYPENAME 369 -#define KW_UNION 370 -#define KW_UNSIGNED 371 -#define KW_USING 372 -#define KW_VIRTUAL 373 -#define KW_VOID 374 -#define KW_VOLATILE 375 -#define KW_WCHAR_T 376 -#define KW_WHILE 377 -#define START_CPP 378 -#define START_CONST_EXPR 379 -#define START_TYPE 380 +#define TYPEPACK_IDENTIFIER 267 +#define SCOPING 268 +#define TYPEDEFNAME 269 +#define ELLIPSIS 270 +#define OROR 271 +#define ANDAND 272 +#define EQCOMPARE 273 +#define NECOMPARE 274 +#define LECOMPARE 275 +#define GECOMPARE 276 +#define LSHIFT 277 +#define RSHIFT 278 +#define POINTSAT_STAR 279 +#define DOT_STAR 280 +#define UNARY 281 +#define UNARY_NOT 282 +#define UNARY_NEGATE 283 +#define UNARY_MINUS 284 +#define UNARY_PLUS 285 +#define UNARY_STAR 286 +#define UNARY_REF 287 +#define POINTSAT 288 +#define SCOPE 289 +#define PLUSPLUS 290 +#define MINUSMINUS 291 +#define TIMESEQUAL 292 +#define DIVIDEEQUAL 293 +#define MODEQUAL 294 +#define PLUSEQUAL 295 +#define MINUSEQUAL 296 +#define OREQUAL 297 +#define ANDEQUAL 298 +#define XOREQUAL 299 +#define LSHIFTEQUAL 300 +#define RSHIFTEQUAL 301 +#define KW_ALIGNAS 302 +#define KW_ALIGNOF 303 +#define KW_AUTO 304 +#define KW_BEGIN_PUBLISH 305 +#define KW_BLOCKING 306 +#define KW_BOOL 307 +#define KW_CATCH 308 +#define KW_CHAR 309 +#define KW_CHAR16_T 310 +#define KW_CHAR32_T 311 +#define KW_CLASS 312 +#define KW_CONST 313 +#define KW_CONSTEXPR 314 +#define KW_CONST_CAST 315 +#define KW_DECLTYPE 316 +#define KW_DEFAULT 317 +#define KW_DELETE 318 +#define KW_DOUBLE 319 +#define KW_DYNAMIC_CAST 320 +#define KW_ELSE 321 +#define KW_END_PUBLISH 322 +#define KW_ENUM 323 +#define KW_EXTENSION 324 +#define KW_EXTERN 325 +#define KW_EXPLICIT 326 +#define KW_PUBLISHED 327 +#define KW_FALSE 328 +#define KW_FINAL 329 +#define KW_FLOAT 330 +#define KW_FRIEND 331 +#define KW_FOR 332 +#define KW_GOTO 333 +#define KW_HAS_VIRTUAL_DESTRUCTOR 334 +#define KW_IF 335 +#define KW_INLINE 336 +#define KW_INT 337 +#define KW_IS_ABSTRACT 338 +#define KW_IS_BASE_OF 339 +#define KW_IS_CLASS 340 +#define KW_IS_CONSTRUCTIBLE 341 +#define KW_IS_CONVERTIBLE_TO 342 +#define KW_IS_DESTRUCTIBLE 343 +#define KW_IS_EMPTY 344 +#define KW_IS_ENUM 345 +#define KW_IS_FINAL 346 +#define KW_IS_FUNDAMENTAL 347 +#define KW_IS_POD 348 +#define KW_IS_POLYMORPHIC 349 +#define KW_IS_STANDARD_LAYOUT 350 +#define KW_IS_TRIVIAL 351 +#define KW_IS_UNION 352 +#define KW_LONG 353 +#define KW_MAKE_MAP_PROPERTY 354 +#define KW_MAKE_PROPERTY 355 +#define KW_MAKE_PROPERTY2 356 +#define KW_MAKE_SEQ 357 +#define KW_MAKE_SEQ_PROPERTY 358 +#define KW_MUTABLE 359 +#define KW_NAMESPACE 360 +#define KW_NEW 361 +#define KW_NOEXCEPT 362 +#define KW_NULLPTR 363 +#define KW_OPERATOR 364 +#define KW_OVERRIDE 365 +#define KW_PRIVATE 366 +#define KW_PROTECTED 367 +#define KW_PUBLIC 368 +#define KW_REGISTER 369 +#define KW_REINTERPRET_CAST 370 +#define KW_RETURN 371 +#define KW_SHORT 372 +#define KW_SIGNED 373 +#define KW_SIZEOF 374 +#define KW_STATIC 375 +#define KW_STATIC_ASSERT 376 +#define KW_STATIC_CAST 377 +#define KW_STRUCT 378 +#define KW_TEMPLATE 379 +#define KW_THREAD_LOCAL 380 +#define KW_THROW 381 +#define KW_TRUE 382 +#define KW_TRY 383 +#define KW_TYPEDEF 384 +#define KW_TYPEID 385 +#define KW_TYPENAME 386 +#define KW_UNDERLYING_TYPE 387 +#define KW_UNION 388 +#define KW_UNSIGNED 389 +#define KW_USING 390 +#define KW_VIRTUAL 391 +#define KW_VOID 392 +#define KW_VOLATILE 393 +#define KW_WCHAR_T 394 +#define KW_WHILE 395 +#define START_CPP 396 +#define START_CONST_EXPR 397 +#define START_TYPE 398 /* Value type. */ diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index b8600975b8..04cdb53a4b 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -212,7 +212,7 @@ pop_struct() { %token CHAR_TOK %token SIMPLE_STRING SIMPLE_IDENTIFIER %token STRING_LITERAL CUSTOM_LITERAL -%token IDENTIFIER TYPENAME_IDENTIFIER SCOPING +%token IDENTIFIER TYPENAME_IDENTIFIER TYPEPACK_IDENTIFIER SCOPING %token TYPEDEFNAME %token ELLIPSIS @@ -280,9 +280,25 @@ pop_struct() { %token KW_FRIEND %token KW_FOR %token KW_GOTO +%token KW_HAS_VIRTUAL_DESTRUCTOR %token KW_IF %token KW_INLINE %token KW_INT +%token KW_IS_ABSTRACT +%token KW_IS_BASE_OF +%token KW_IS_CLASS +%token KW_IS_CONSTRUCTIBLE +%token KW_IS_CONVERTIBLE_TO +%token KW_IS_DESTRUCTIBLE +%token KW_IS_EMPTY +%token KW_IS_ENUM +%token KW_IS_FINAL +%token KW_IS_FUNDAMENTAL +%token KW_IS_POD +%token KW_IS_POLYMORPHIC +%token KW_IS_STANDARD_LAYOUT +%token KW_IS_TRIVIAL +%token KW_IS_UNION %token KW_LONG %token KW_MAKE_MAP_PROPERTY %token KW_MAKE_PROPERTY @@ -317,6 +333,7 @@ pop_struct() { %token KW_TYPEDEF %token KW_TYPEID %token KW_TYPENAME +%token KW_UNDERLYING_TYPE %token KW_UNION %token KW_UNSIGNED %token KW_USING @@ -354,9 +371,10 @@ pop_struct() { %type formal_parameter %type not_paren_formal_parameter_identifier %type formal_parameter_identifier +%type parameter_pack_identifier %type not_paren_empty_instance_identifier %type empty_instance_identifier -%type type +%type type type_pack %type type_decl %type var_type_decl %type predefined_type @@ -447,6 +465,10 @@ constructor_init: name '(' optional_const_expr_comma ')' { delete $3; +} + | name '(' optional_const_expr_comma ')' ELLIPSIS +{ + delete $3; } | name '{' optional_const_expr_comma '}' { @@ -783,6 +805,11 @@ storage_class: empty { $$ = 0; +} + | KW_CONST storage_class +{ + // This isn't really a storage class, but it helps with parsing. + $$ = $2 | (int)CPPInstance::SC_const; } | KW_EXTERN storage_class { @@ -861,10 +888,22 @@ attribute_specifier: ; type_like_declaration: - multiple_var_declaration + storage_class var_type_decl { - /* multiple_var_declaration adds itself to the scope. */ + // We don't need to push/pop type, because we can't nest + // type_like_declaration. + if ($2->as_type_declaration()) { + current_type = $2->as_type_declaration()->_type; + } else { + current_type = $2->as_type(); + } + push_storage_class($1); } + multiple_instance_identifiers +{ + pop_storage_class(); +} + | storage_class type_decl ';' { // We don't really care about the storage class here. In fact, it's @@ -891,39 +930,6 @@ type_like_declaration: } } | using_declaration - ; - -multiple_var_declaration: - storage_class var_type_decl -{ - // We don't need to push/pop type, because we can't nest - // multiple_var_declarations. - if ($2->as_type_declaration()) { - current_type = $2->as_type_declaration()->_type; - } else { - current_type = $2->as_type(); - } - push_storage_class($1); -} - multiple_instance_identifiers -{ - pop_storage_class(); -} - | storage_class KW_CONST var_type_decl -{ - // We don't need to push/pop type, because we can't nest - // multiple_var_declarations. - if ($3->as_type_declaration()) { - current_type = $3->as_type_declaration()->_type; - } else { - current_type = $3->as_type(); - } - push_storage_class($1); -} - multiple_const_instance_identifiers -{ - pop_storage_class(); -} /* We don't need to include a rule for variables that point to functions, because we get those from the function_prototype @@ -933,6 +939,9 @@ multiple_var_declaration: multiple_instance_identifiers: instance_identifier_and_maybe_trailing_return_type maybe_initialize_or_function_body { + if (current_storage_class & CPPInstance::SC_const) { + $1->add_modifier(IIT_const); + } CPPInstance *inst = new CPPInstance(current_type, $1, current_storage_class, @1.file); @@ -941,27 +950,9 @@ multiple_instance_identifiers: } | instance_identifier_and_maybe_trailing_return_type maybe_initialize ',' multiple_instance_identifiers { - CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); - inst->set_initializer($2); - current_scope->add_declaration(inst, global_scope, current_lexer, @1); -} - ; - -multiple_const_instance_identifiers: - instance_identifier_and_maybe_trailing_return_type maybe_initialize_or_function_body -{ - $1->add_modifier(IIT_const); - CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); - inst->set_initializer($2); - current_scope->add_declaration(inst, global_scope, current_lexer, @1); -} - | instance_identifier_and_maybe_trailing_return_type maybe_initialize ',' multiple_const_instance_identifiers -{ - $1->add_modifier(IIT_const); + if (current_storage_class & CPPInstance::SC_const) { + $1->add_modifier(IIT_const); + } CPPInstance *inst = new CPPInstance(current_type, $1, current_storage_class, @1.file); @@ -986,21 +977,6 @@ typedef_declaration: typedef_instance_identifiers { pop_storage_class(); -} - | storage_class KW_CONST var_type_decl -{ - // We don't need to push/pop type, because we can't nest - // multiple_var_declarations. - if ($3->as_type_declaration()) { - current_type = $3->as_type_declaration()->_type; - } else { - current_type = $3->as_type(); - } - push_storage_class($1); -} - typedef_const_instance_identifiers -{ - pop_storage_class(); } | storage_class function_prototype maybe_initialize_or_function_body { @@ -1019,29 +995,18 @@ typedef_declaration: typedef_instance_identifiers: instance_identifier_and_maybe_trailing_return_type maybe_initialize_or_function_body { + if (current_storage_class & CPPInstance::SC_const) { + $1->add_modifier(IIT_const); + } CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); } | instance_identifier_and_maybe_trailing_return_type maybe_initialize ',' typedef_instance_identifiers { - CPPType *target_type = current_type; - CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); - current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); -} - ; - -typedef_const_instance_identifiers: - instance_identifier_and_maybe_trailing_return_type maybe_initialize_or_function_body -{ - $1->add_modifier(IIT_const); - CPPType *target_type = current_type; - CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); - current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); -} - | instance_identifier_and_maybe_trailing_return_type maybe_initialize ',' typedef_const_instance_identifiers -{ - $1->add_modifier(IIT_const); + if (current_storage_class & CPPInstance::SC_const) { + $1->add_modifier(IIT_const); + } CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file); current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1); @@ -1244,26 +1209,38 @@ function_post: { $$ = 0; } - | KW_CONST + | function_post KW_CONST { - $$ = (int)CPPFunctionType::F_const_method; + $$ = $1 | (int)CPPFunctionType::F_const_method; +} + | function_post KW_VOLATILE +{ + $$ = $1 | (int)CPPFunctionType::F_volatile_method; } | function_post KW_NOEXCEPT { - $$ = (int)CPPFunctionType::F_noexcept; + $$ = $1 | (int)CPPFunctionType::F_noexcept; } | function_post KW_FINAL { - $$ = (int)CPPFunctionType::F_final; + $$ = $1 | (int)CPPFunctionType::F_final; } | function_post KW_OVERRIDE { - $$ = (int)CPPFunctionType::F_override; + $$ = $1 | (int)CPPFunctionType::F_override; +} + | function_post '&' +{ + $$ = $1 | (int)CPPFunctionType::F_lvalue_method; +} + | function_post ANDAND +{ + $$ = $1 | (int)CPPFunctionType::F_rvalue_method; } | function_post KW_MUTABLE { // Used for lambdas, currently ignored. - $$ = 0; + $$ = $1; } | function_post KW_THROW '(' ')' { @@ -1272,6 +1249,10 @@ function_post: | function_post KW_THROW '(' name ')' { $$ = $1; +} + | function_post KW_THROW '(' name ELLIPSIS ')' +{ + $$ = $1; } /* | function_post '[' '[' attribute_specifiers ']' ']' { @@ -1475,22 +1456,35 @@ template_nonempty_formal_parameters: } ; +typename_keyword: + KW_CLASS + | KW_TYPENAME + ; + template_formal_parameter: - KW_CLASS name + typename_keyword +{ + $$ = CPPType::new_type(new CPPClassTemplateParameter((CPPIdentifier *)NULL)); +} + | typename_keyword name { $$ = CPPType::new_type(new CPPClassTemplateParameter($2)); } - | KW_CLASS name '=' full_type + | typename_keyword name '=' full_type { $$ = CPPType::new_type(new CPPClassTemplateParameter($2, $4)); } - | KW_TYPENAME name + | typename_keyword ELLIPSIS { - $$ = CPPType::new_type(new CPPClassTemplateParameter($2)); + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((CPPIdentifier *)NULL); + ctp->_packed = true; + $$ = CPPType::new_type(ctp); } - | KW_TYPENAME name '=' full_type + | typename_keyword ELLIPSIS name { - $$ = CPPType::new_type(new CPPClassTemplateParameter($2, $4)); + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter($3); + ctp->_packed = true; + $$ = CPPType::new_type(ctp); } | template_formal_parameter_type formal_parameter_identifier template_parameter_maybe_initialize { @@ -1504,6 +1498,17 @@ template_formal_parameter: CPPInstance *inst = new CPPInstance($2, $3, 0, @3.file); inst->set_initializer($4); $$ = inst; +} + | template_formal_parameter_type parameter_pack_identifier +{ + CPPInstance *inst = new CPPInstance($1, $2, 0, @2.file); + $$ = inst; +} + | KW_CONST template_formal_parameter_type parameter_pack_identifier +{ + $3->add_modifier(IIT_const); + CPPInstance *inst = new CPPInstance($2, $3, 0, @3.file); + $$ = inst; } ; @@ -1524,6 +1529,14 @@ template_formal_parameter_type: yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1); } assert($$ != NULL); +} + | TYPEPACK_IDENTIFIER +{ + $$ = $1->find_type(current_scope, global_scope, false, current_lexer); + if ($$ == NULL) { + yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1); + } + assert($$ != NULL); } ; @@ -1604,7 +1617,16 @@ instance_identifier: } | instance_identifier '(' { - push_scope($1->get_scope(current_scope, global_scope)); + // Create a scope for this function (in case it is a function) + CPPScope *scope = new CPPScope($1->get_scope(current_scope, global_scope), + CPPNameComponent(""), V_private); + + // It still needs to be able to pick up any template arguments, if this is + // a definition for a method template. Add a fake "using" declaration to + // accomplish this. + scope->_using.insert(current_scope); + + push_scope(scope); } formal_parameter_list ')' function_post { @@ -1842,6 +1864,23 @@ function_parameter: $4->add_modifier(IIT_const); $$ = new CPPInstance($3, $4, 0, @3.file); $$->set_initializer($5); +} + | type_pack parameter_pack_identifier maybe_initialize +{ + $$ = new CPPInstance($1, $2, 0, @2.file); + $$->set_initializer($3); +} + | KW_CONST type_pack parameter_pack_identifier maybe_initialize +{ + $3->add_modifier(IIT_const); + $$ = new CPPInstance($2, $3, 0, @3.file); + $$->set_initializer($4); +} + | KW_CONST KW_REGISTER type_pack parameter_pack_identifier maybe_initialize +{ + $4->add_modifier(IIT_const); + $$ = new CPPInstance($3, $4, 0, @3.file); + $$->set_initializer($5); } | KW_REGISTER function_parameter { @@ -1970,10 +2009,79 @@ formal_parameter_identifier: } ; +parameter_pack_identifier: + ELLIPSIS +{ + $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + $$->_packed = true; +} + | ELLIPSIS name +{ + $$ = new CPPInstanceIdentifier($2); + $$->_packed = true; +} + | KW_CONST parameter_pack_identifier %prec UNARY +{ + $$ = $2; + $$->add_modifier(IIT_const); +} + | KW_VOLATILE parameter_pack_identifier %prec UNARY +{ + $$ = $2; + $$->add_modifier(IIT_volatile); +} + | '*' parameter_pack_identifier %prec UNARY +{ + $$ = $2; + $$->add_modifier(IIT_pointer); +} + | '&' parameter_pack_identifier %prec UNARY +{ + $$ = $2; + $$->add_modifier(IIT_reference); +} + | ANDAND parameter_pack_identifier %prec UNARY +{ + $$ = $2; + $$->add_modifier(IIT_rvalue_reference); +} + | SCOPING '*' parameter_pack_identifier %prec UNARY +{ + $$ = $3; + $$->add_scoped_pointer_modifier($1); +} + | parameter_pack_identifier '[' optional_const_expr ']' +{ + $$ = $1; + $$->add_array_modifier($3); +} + | '(' parameter_pack_identifier ')' '(' function_parameter_list ')' function_post +{ + $$ = $2; + $$->add_modifier(IIT_paren); + $$->add_func_modifier($5, $7); +} + | '(' parameter_pack_identifier ')' +{ + $$ = $2; + $$->add_modifier(IIT_paren); +} + ; + not_paren_empty_instance_identifier: empty { $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); +} + | ELLIPSIS +{ + $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + $$->_packed = true; +} + | ELLIPSIS name +{ + $$ = new CPPInstanceIdentifier($2); + $$->_packed = true; } | KW_CONST not_paren_empty_instance_identifier %prec UNARY { @@ -2016,6 +2124,16 @@ empty_instance_identifier: empty { $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); +} + | ELLIPSIS +{ + $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + $$->_packed = true; +} + | ELLIPSIS name +{ + $$ = new CPPInstanceIdentifier($2); + $$->_packed = true; } | KW_CONST empty_instance_identifier %prec UNARY { @@ -2150,6 +2268,16 @@ type: str << *$3; yyerror("could not determine type of " + str.str(), @3); } +} + | KW_UNDERLYING_TYPE '(' full_type ')' +{ + CPPEnumType *enum_type = $3->as_enum_type(); + if (enum_type == NULL) { + yyerror("an enumeration type is required", @3); + $$ = $3; + } else { + $$ = enum_type->get_underlying_type(); + } } | KW_AUTO { @@ -2157,6 +2285,17 @@ type: } ; +type_pack: + TYPEPACK_IDENTIFIER +{ + $$ = $1->find_type(current_scope, global_scope, false, current_lexer); + if ($$ == NULL) { + yyerror(string("internal error resolving type ") + $1->get_fully_scoped_name(), @1); + } + assert($$ != NULL); +} + ; + type_decl: simple_type { @@ -2244,6 +2383,16 @@ type_decl: str << *$3; yyerror("could not determine type of " + str.str(), @3); } +} + | KW_UNDERLYING_TYPE '(' full_type ')' +{ + CPPEnumType *enum_type = $3->as_enum_type(); + if (enum_type == NULL) { + yyerror("an enumeration type is required", @3); + $$ = $3; + } else { + $$ = enum_type->get_underlying_type(); + } } | KW_AUTO { @@ -2308,6 +2457,16 @@ predefined_type: str << *$3; yyerror("could not determine type of " + str.str(), @3); } +} + | KW_UNDERLYING_TYPE '(' full_type ')' +{ + CPPEnumType *enum_type = $3->as_enum_type(); + if (enum_type == NULL) { + yyerror("an enumeration type is required", @3); + $$ = $3; + } else { + $$ = enum_type->get_underlying_type(); + } } | KW_AUTO { @@ -2336,6 +2495,15 @@ full_type: { $3->add_modifier(IIT_const); $$ = $3->unroll_type($2); +} + | type_pack empty_instance_identifier +{ + $$ = $2->unroll_type($1); +} + | KW_CONST type_pack empty_instance_identifier +{ + $3->add_modifier(IIT_const); + $$ = $3->unroll_type($2); } ; @@ -2750,6 +2918,7 @@ element: | CHAR_TOK | IDENTIFIER | TYPENAME_IDENTIFIER + | TYPEPACK_IDENTIFIER | SCOPING | SIMPLE_IDENTIFIER | ELLIPSIS | OROR | ANDAND @@ -2768,10 +2937,11 @@ element: | KW_OPERATOR | KW_OVERRIDE | KW_PRIVATE | KW_PROTECTED | KW_PUBLIC | KW_PUBLISHED | KW_REGISTER | KW_REINTERPRET_CAST | KW_RETURN | KW_SHORT | KW_SIGNED | KW_SIZEOF | KW_STATIC - | KW_STATIC_ASSERT | KW_STATIC_CAST | KW_STRUCT + | KW_STATIC_ASSERT | KW_STATIC_CAST | KW_STRUCT | KW_TEMPLATE | KW_THREAD_LOCAL | KW_THROW | KW_TRUE | KW_TRY | KW_TYPEDEF - | KW_TYPEID | KW_TYPENAME | KW_UNION | KW_UNSIGNED | KW_USING - | KW_VIRTUAL | KW_VOID | KW_VOLATILE | KW_WCHAR_T | KW_WHILE + | KW_TYPEID | KW_TYPENAME | KW_UNDERLYING_TYPE | KW_UNION + | KW_UNSIGNED | KW_USING | KW_VIRTUAL | KW_VOID | KW_VOLATILE + | KW_WCHAR_T | KW_WHILE { } | '+' | '-' | '*' | '/' | '&' | '|' | '^' | '!' | '~' | '=' | '%' @@ -2840,6 +3010,10 @@ no_angle_bracket_const_expr: | KW_SIZEOF '(' full_type ')' %prec UNARY { $$ = new CPPExpression(CPPExpression::sizeof_func($3)); +} + | KW_SIZEOF ELLIPSIS '(' name ')' %prec UNARY +{ + $$ = new CPPExpression(CPPExpression::sizeof_ellipsis_func($4)); } | KW_ALIGNOF '(' full_type ')' %prec UNARY { @@ -3078,6 +3252,10 @@ const_expr: | KW_SIZEOF '(' full_type ')' %prec UNARY { $$ = new CPPExpression(CPPExpression::sizeof_func($3)); +} + | KW_SIZEOF ELLIPSIS '(' name ')' %prec UNARY +{ + $$ = new CPPExpression(CPPExpression::sizeof_ellipsis_func($4)); } | KW_ALIGNOF '(' full_type ')' %prec UNARY { @@ -3295,6 +3473,74 @@ const_operand: | '[' capture_list ']' '(' function_parameter_list ')' function_post maybe_trailing_return_type '{' code '}' { $$ = NULL; +} + | KW_HAS_VIRTUAL_DESTRUCTOR '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_HAS_VIRTUAL_DESTRUCTOR, $3)); +} + | KW_IS_ABSTRACT '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_ABSTRACT, $3)); +} + | KW_IS_BASE_OF '(' full_type ',' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_CLASS, $3, $5)); +} + | KW_IS_CLASS '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_CLASS, $3)); +} + | KW_IS_CONSTRUCTIBLE '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_CONSTRUCTIBLE, $3)); +} + | KW_IS_CONSTRUCTIBLE '(' full_type ',' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_CONSTRUCTIBLE, $3, $5)); +} + | KW_IS_CONVERTIBLE_TO '(' full_type ',' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_CONVERTIBLE_TO, $3, $5)); +} + | KW_IS_DESTRUCTIBLE '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_DESTRUCTIBLE, $3)); +} + | KW_IS_EMPTY '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_EMPTY, $3)); +} + | KW_IS_ENUM '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_ENUM, $3)); +} + | KW_IS_FINAL '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_FINAL, $3)); +} + | KW_IS_FUNDAMENTAL '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_FUNDAMENTAL, $3)); +} + | KW_IS_POD '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_POD, $3)); +} + | KW_IS_POLYMORPHIC '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_POLYMORPHIC, $3)); +} + | KW_IS_STANDARD_LAYOUT '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_STANDARD_LAYOUT, $3)); +} + | KW_IS_TRIVIAL '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_TRIVIAL, $3)); +} + | KW_IS_UNION '(' full_type ')' +{ + $$ = new CPPExpression(CPPExpression::type_trait(KW_IS_UNION, $3)); } ; @@ -3333,6 +3579,10 @@ formal_const_expr: | KW_SIZEOF '(' full_type ')' %prec UNARY { $$ = new CPPExpression(CPPExpression::sizeof_func($3)); +} + | KW_SIZEOF ELLIPSIS '(' name ')' %prec UNARY +{ + $$ = new CPPExpression(CPPExpression::sizeof_ellipsis_func($4)); } | KW_ALIGNOF '(' full_type ')' %prec UNARY { @@ -3575,6 +3825,12 @@ class_derivation_name: | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); +} + | name ELLIPSIS +{ + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter($1); + ctp->_packed = true; + $$ = CPPType::new_type(ctp); } ; @@ -3607,6 +3863,10 @@ name: | TYPENAME_IDENTIFIER { $$ = $1; +} + | TYPEPACK_IDENTIFIER +{ + $$ = $1; } | KW_FINAL { @@ -3652,6 +3912,10 @@ name_no_final: | TYPENAME_IDENTIFIER { $$ = $1; +} + | TYPEPACK_IDENTIFIER +{ + $$ = $1; } | KW_OVERRIDE { diff --git a/dtool/src/cppparser/cppClassTemplateParameter.cxx b/dtool/src/cppparser/cppClassTemplateParameter.cxx index 1c39532be5..7ed9a94faf 100644 --- a/dtool/src/cppparser/cppClassTemplateParameter.cxx +++ b/dtool/src/cppparser/cppClassTemplateParameter.cxx @@ -21,7 +21,8 @@ CPPClassTemplateParameter:: CPPClassTemplateParameter(CPPIdentifier *ident, CPPType *default_type) : CPPType(CPPFile()), _ident(ident), - _default_type(default_type) + _default_type(default_type), + _packed(false) { } @@ -41,8 +42,14 @@ is_fully_specified() const { void CPPClassTemplateParameter:: output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (complete) { - out << "class "; - _ident->output(out, scope); + out << "class"; + if (_packed) { + out << "..."; + } + if (_ident != NULL) { + out << " "; + _ident->output(out, scope); + } if (_default_type) { out << " = "; _default_type->output(out, indent_level, scope, false); @@ -82,6 +89,14 @@ is_equal(const CPPDeclaration *other) const { return false; } + if (_packed != ot->_packed) { + return false; + } + + if (_ident == NULL || ot->_ident == NULL) { + return _ident == ot->_ident; + } + return *_ident == *ot->_ident; } @@ -99,5 +114,13 @@ is_less(const CPPDeclaration *other) const { return _default_type < ot->_default_type; } + if (_packed != ot->_packed) { + return _packed < ot->_packed; + } + + if (_ident == NULL || ot->_ident == NULL) { + return _ident < ot->_ident; + } + return *_ident < *ot->_ident; } diff --git a/dtool/src/cppparser/cppClassTemplateParameter.h b/dtool/src/cppparser/cppClassTemplateParameter.h index 89923bd067..d936ca01ea 100644 --- a/dtool/src/cppparser/cppClassTemplateParameter.h +++ b/dtool/src/cppparser/cppClassTemplateParameter.h @@ -37,6 +37,7 @@ public: CPPIdentifier *_ident; CPPType *_default_type; + bool _packed; protected: virtual bool is_equal(const CPPDeclaration *other) const; diff --git a/dtool/src/cppparser/cppConstType.cxx b/dtool/src/cppparser/cppConstType.cxx index da5c0d18fe..f1851b5233 100644 --- a/dtool/src/cppparser/cppConstType.cxx +++ b/dtool/src/cppparser/cppConstType.cxx @@ -86,6 +86,22 @@ is_tbd() const { return _wrapped_around->is_tbd(); } +/** + * Returns true if the type is considered a fundamental type. + */ +bool CPPConstType:: +is_fundamental() const { + return _wrapped_around->is_fundamental(); +} + +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPConstType:: +is_standard_layout() const { + return _wrapped_around->is_standard_layout(); +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -94,12 +110,20 @@ is_trivial() const { return _wrapped_around->is_trivial(); } +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPConstType:: +is_constructible(const CPPType *given_type) const { + return _wrapped_around->is_constructible(given_type); +} + /** * Returns true if the type is default-constructible. */ bool CPPConstType:: is_default_constructible() const { - return false; + return _wrapped_around->is_default_constructible(); } /** @@ -110,6 +134,23 @@ is_copy_constructible() const { return _wrapped_around->is_copy_constructible(); } +/** + * Returns true if the type is destructible. + */ +bool CPPConstType:: +is_destructible() const { + return _wrapped_around->is_destructible(); +} + +/** + * Returns true if variables of this type may be implicitly converted to + * the other type. + */ +bool CPPConstType:: +is_convertible_to(const CPPType *other) const { + return _wrapped_around->is_convertible_to(other); +} + /** * This is a little more forgiving than is_equal(): it returns true if the * types appear to be referring to the same thing, even if they may have diff --git a/dtool/src/cppparser/cppConstType.h b/dtool/src/cppparser/cppConstType.h index dbc3e166d4..ef0943ca13 100644 --- a/dtool/src/cppparser/cppConstType.h +++ b/dtool/src/cppparser/cppConstType.h @@ -36,9 +36,14 @@ public: CPPScope *global_scope); virtual bool is_tbd() const; + virtual bool is_fundamental() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; + virtual bool is_destructible() const; + virtual bool is_convertible_to(const CPPType *other) const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, diff --git a/dtool/src/cppparser/cppDeclaration.cxx b/dtool/src/cppparser/cppDeclaration.cxx index d2399c0fbb..76f72c43e0 100644 --- a/dtool/src/cppparser/cppDeclaration.cxx +++ b/dtool/src/cppparser/cppDeclaration.cxx @@ -41,8 +41,13 @@ CPPDeclaration(const CPPDeclaration ©) : /** * */ -CPPDeclaration:: -~CPPDeclaration() { +CPPDeclaration &CPPDeclaration:: +operator = (const CPPDeclaration ©) { + _vis = copy._vis; + _template_scope = copy._template_scope; + _file = copy._file; + _leading_comment = copy._leading_comment; + return *this; } /** @@ -124,6 +129,7 @@ CPPDeclaration *CPPDeclaration:: substitute_decl(SubstDecl &subst, CPPScope *, CPPScope *) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { + assert((*si).second != NULL); return (*si).second; } return this; diff --git a/dtool/src/cppparser/cppDeclaration.h b/dtool/src/cppparser/cppDeclaration.h index f1ce96820f..a06baa3123 100644 --- a/dtool/src/cppparser/cppDeclaration.h +++ b/dtool/src/cppparser/cppDeclaration.h @@ -89,7 +89,9 @@ public: CPPDeclaration(const CPPFile &file); CPPDeclaration(const CPPDeclaration ©); - virtual ~CPPDeclaration(); + virtual ~CPPDeclaration() {}; + + CPPDeclaration &operator = (const CPPDeclaration ©); bool operator == (const CPPDeclaration &other) const; bool operator != (const CPPDeclaration &other) const; @@ -139,6 +141,73 @@ public: virtual CPPMakeProperty *as_make_property(); virtual CPPMakeSeq *as_make_seq(); + inline const CPPInstance *as_instance() const { + return ((CPPDeclaration *)this)->as_instance(); + } + inline const CPPClassTemplateParameter *as_class_template_parameter() const { + return ((CPPDeclaration *)this)->as_class_template_parameter(); + } + inline const CPPTypedefType *as_typedef_type() const { + return ((CPPDeclaration *)this)->as_typedef_type(); + } + inline const CPPTypeDeclaration *as_type_declaration() const { + return ((CPPDeclaration *)this)->as_type_declaration(); + } + inline const CPPExpression *as_expression() const { + return ((CPPDeclaration *)this)->as_expression(); + } + inline const CPPType *as_type() const { + return ((CPPDeclaration *)this)->as_type(); + } + inline const CPPNamespace *as_namespace() const { + return ((CPPDeclaration *)this)->as_namespace(); + } + inline const CPPUsing *as_using() const { + return ((CPPDeclaration *)this)->as_using(); + } + inline const CPPSimpleType *as_simple_type() const { + return ((CPPDeclaration *)this)->as_simple_type(); + } + inline const CPPPointerType *as_pointer_type() const { + return ((CPPDeclaration *)this)->as_pointer_type(); + } + inline const CPPReferenceType *as_reference_type() const { + return ((CPPDeclaration *)this)->as_reference_type(); + } + inline const CPPArrayType *as_array_type() const { + return ((CPPDeclaration *)this)->as_array_type(); + } + inline const CPPConstType *as_const_type() const { + return ((CPPDeclaration *)this)->as_const_type(); + } + inline const CPPFunctionType *as_function_type() const { + return ((CPPDeclaration *)this)->as_function_type(); + } + inline const CPPFunctionGroup *as_function_group() const { + return ((CPPDeclaration *)this)->as_function_group(); + } + inline const CPPExtensionType *as_extension_type() const { + return ((CPPDeclaration *)this)->as_extension_type(); + } + inline const CPPStructType *as_struct_type() const { + return ((CPPDeclaration *)this)->as_struct_type(); + } + inline const CPPEnumType *as_enum_type() const { + return ((CPPDeclaration *)this)->as_enum_type(); + } + inline const CPPTBDType *as_tbd_type() const { + return ((CPPDeclaration *)this)->as_tbd_type(); + } + inline const CPPTypeProxy *as_type_proxy() const { + return ((CPPDeclaration *)this)->as_type_proxy(); + } + inline const CPPMakeProperty *as_make_property() const { + return ((CPPDeclaration *)this)->as_make_property(); + } + inline const CPPMakeSeq *as_make_seq() const { + return ((CPPDeclaration *)this)->as_make_seq(); + } + CPPVisibility _vis; CPPTemplateScope *_template_scope; CPPFile _file; diff --git a/dtool/src/cppparser/cppExpression.cxx b/dtool/src/cppparser/cppExpression.cxx index 7ef5ec85fb..f185514de4 100644 --- a/dtool/src/cppparser/cppExpression.cxx +++ b/dtool/src/cppparser/cppExpression.cxx @@ -24,6 +24,7 @@ #include "cppInstance.h" #include "cppFunctionGroup.h" #include "cppFunctionType.h" +#include "cppStructType.h" #include "cppBison.h" #include "pdtoa.h" @@ -389,6 +390,19 @@ typeid_op(CPPExpression *op1, CPPType *std_type_info) { return expr; } +/** + * Creates an expression that returns a particular type trait. + */ +CPPExpression CPPExpression:: +type_trait(int trait, CPPType *type, CPPType *arg) { + CPPExpression expr(0); + expr._type = T_type_trait; + expr._u._type_trait._trait = trait; + expr._u._type_trait._type = type; + expr._u._type_trait._arg = arg; + return expr; +} + /** * */ @@ -401,6 +415,17 @@ sizeof_func(CPPType *type) { return expr; } +/** + * + */ +CPPExpression CPPExpression:: +sizeof_ellipsis_func(CPPIdentifier *ident) { + CPPExpression expr(0); + expr._type = T_sizeof_ellipsis; + expr._u._ident = ident; + return expr; +} + /** * */ @@ -492,13 +517,6 @@ get_delete() { return expr; } -/** - * - */ -CPPExpression:: -~CPPExpression() { -} - /** * */ @@ -579,6 +597,7 @@ evaluate() const { case T_new: case T_default_new: case T_sizeof: + case T_sizeof_ellipsis: return Result(); case T_alignof: @@ -801,6 +820,95 @@ evaluate() const { case T_typeid_expr: return Result(); + case T_type_trait: + switch (_u._type_trait._trait) { + case KW_HAS_VIRTUAL_DESTRUCTOR: + { + CPPStructType *struct_type = _u._type_trait._type->as_struct_type(); + return Result(struct_type != NULL && struct_type->has_virtual_destructor()); + } + + case KW_IS_ABSTRACT: + { + CPPStructType *struct_type = _u._type_trait._type->as_struct_type(); + return Result(struct_type != NULL && struct_type->is_abstract()); + } + + case KW_IS_BASE_OF: + { + CPPStructType *struct_type1 = _u._type_trait._type->as_struct_type(); + CPPStructType *struct_type2 = _u._type_trait._arg->as_struct_type(); + return Result(struct_type1 != NULL && struct_type2 != NULL && struct_type1->is_base_of(struct_type2)); + } + + case KW_IS_CLASS: + { + CPPExtensionType *ext_type = _u._type_trait._type->as_extension_type(); + return Result(ext_type != NULL && ( + ext_type->_type == CPPExtensionType::T_class || + ext_type->_type == CPPExtensionType::T_struct)); + } + + case KW_IS_CONSTRUCTIBLE: + if (_u._type_trait._arg == NULL) { + return Result(_u._type_trait._type->is_default_constructible()); + } else { + return Result(_u._type_trait._type->is_constructible(_u._type_trait._arg)); + } + + case KW_IS_CONVERTIBLE_TO: + assert(_u._type_trait._arg != NULL); + return Result(_u._type_trait._type->is_convertible_to(_u._type_trait._arg)); + + case KW_IS_DESTRUCTIBLE: + return Result(_u._type_trait._type->is_destructible()); + + case KW_IS_EMPTY: + { + CPPStructType *struct_type = _u._type_trait._type->as_struct_type(); + return Result(struct_type != NULL && struct_type->is_empty()); + } + + case KW_IS_ENUM: + return Result(_u._type_trait._type->is_enum()); + + case KW_IS_FINAL: + { + CPPStructType *struct_type = _u._type_trait._type->as_struct_type(); + return Result(struct_type != NULL && struct_type->is_final()); + } + + case KW_IS_FUNDAMENTAL: + return Result(_u._type_trait._type->is_fundamental()); + + case KW_IS_POD: + return Result(_u._type_trait._type->is_trivial() && + _u._type_trait._type->is_standard_layout()); + + case KW_IS_POLYMORPHIC: + { + CPPStructType *struct_type = _u._type_trait._type->as_struct_type(); + return Result(struct_type != NULL && struct_type->is_polymorphic()); + } + + case KW_IS_STANDARD_LAYOUT: + return Result(_u._type_trait._type->is_standard_layout()); + + case KW_IS_TRIVIAL: + return Result(_u._type_trait._type->is_trivial()); + + case KW_IS_UNION: + { + CPPExtensionType *ext_type = _u._type_trait._type->as_extension_type(); + return Result(ext_type != NULL && + ext_type->_type == CPPExtensionType::T_union); + } + + default: + cerr << "**unexpected type trait**\n"; + abort(); + } + default: cerr << "**invalid operand**\n"; abort(); @@ -916,6 +1024,7 @@ determine_type() const { return CPPType::new_type(new CPPPointerType(_u._typecast._to)); case T_sizeof: + case T_sizeof_ellipsis: case T_alignof: // Note: this should actually be size_t, but that is defined as a typedef // in parser-inc. We could try to resolve it, but that's hacky. Eh, it's @@ -1057,6 +1166,9 @@ determine_type() const { case T_typeid_expr: return _u._typeid._std_type_info; + case T_type_trait: + return bool_type; + default: cerr << "**invalid operand**\n"; abort(); @@ -1113,6 +1225,9 @@ is_fully_specified() const { case T_alignof: return _u._typecast._to->is_fully_specified(); + case T_sizeof_ellipsis: + return _u._ident->is_fully_specified(); + case T_trinary_operation: if (!_u._op._op3->is_fully_specified()) { return false; @@ -1141,6 +1256,9 @@ is_fully_specified() const { case T_typeid_expr: return _u._typeid._expr->is_fully_specified(); + case T_type_trait: + return _u._type_trait._type->is_fully_specified(); + default: return true; } @@ -1276,6 +1394,13 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, any_changed = any_changed || (rep->_u._typeid._expr != _u._typeid._expr); break; + case T_type_trait: + rep->_u._type_trait._type = + _u._type_trait._type->substitute_decl(subst, current_scope, global_scope) + ->as_type(); + any_changed = any_changed || (rep->_u._type_trait._type != _u._type_trait._type); + break; + default: break; } @@ -1350,6 +1475,9 @@ is_tbd() const { case T_typeid_expr: return _u._typeid._expr->is_tbd(); + case T_type_trait: + return _u._type_trait._type->is_tbd(); + default: return false; } @@ -1541,6 +1669,12 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { out << ")"; break; + case T_sizeof_ellipsis: + out << "sizeof...("; + _u._ident->output(out, scope); + out << ")"; + break; + case T_alignof: out << "alignof("; _u._typecast._to->output(out, indent_level, scope, false); @@ -1753,6 +1887,65 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { out << "delete"; break; + case T_type_trait: + switch (_u._type_trait._trait) { + case KW_HAS_VIRTUAL_DESTRUCTOR: + out << "__has_virtual_destructor"; + break; + case KW_IS_ABSTRACT: + out << "__is_abstract"; + break; + case KW_IS_BASE_OF: + out << "__is_base_of"; + break; + case KW_IS_CLASS: + out << "__is_class"; + break; + case KW_IS_CONSTRUCTIBLE: + out << "__is_constructible"; + break; + case KW_IS_CONVERTIBLE_TO: + out << "__is_convertible_to"; + break; + case KW_IS_DESTRUCTIBLE: + out << "__is_destructible"; + break; + case KW_IS_EMPTY: + out << "__is_empty"; + break; + case KW_IS_ENUM: + out << "__is_enum"; + break; + case KW_IS_FINAL: + out << "__is_final"; + break; + case KW_IS_FUNDAMENTAL: + out << "__is_fundamental"; + break; + case KW_IS_POD: + out << "__is_pod"; + break; + case KW_IS_POLYMORPHIC: + out << "__is_polymorphic"; + break; + case KW_IS_STANDARD_LAYOUT: + out << "__is_standard_layout"; + break; + case KW_IS_TRIVIAL: + out << "__is_trivial"; + break; + case KW_IS_UNION: + out << "__is_union"; + break; + default: + out << (evaluate().as_boolean() ? "true" : "false"); + return; + } + out << '('; + _u._type_trait._type->output(out, indent_level, scope, false); + out << ')'; + break; + default: out << "(** invalid operand type " << (int)_type << " **)"; } @@ -1864,6 +2057,7 @@ is_equal(const CPPDeclaration *other) const { return _u._fgroup == ot->_u._fgroup; case T_unknown_ident: + case T_sizeof_ellipsis: return *_u._ident == *ot->_u._ident; case T_typecast: @@ -1907,6 +2101,10 @@ is_equal(const CPPDeclaration *other) const { case T_typeid_expr: return _u._typeid._expr == ot->_u._typeid._expr; + case T_type_trait: + return _u._type_trait._trait == ot->_u._type_trait._trait && + _u._type_trait._type == ot->_u._type_trait._type; + default: cerr << "(** invalid operand type " << (int)_type << " **)"; } @@ -1954,6 +2152,7 @@ is_less(const CPPDeclaration *other) const { return *_u._fgroup < *ot->_u._fgroup; case T_unknown_ident: + case T_sizeof_ellipsis: return *_u._ident < *ot->_u._ident; case T_typecast: @@ -2007,6 +2206,12 @@ is_less(const CPPDeclaration *other) const { case T_typeid_expr: return *_u._typeid._expr < *ot->_u._typeid._expr; + case T_type_trait: + if (_u._type_trait._trait != ot->_u._type_trait._trait) { + return _u._type_trait._trait < ot->_u._type_trait._trait; + } + return *_u._type_trait._type < *ot->_u._type_trait._type; + default: cerr << "(** invalid operand type " << (int)_type << " **)"; } diff --git a/dtool/src/cppparser/cppExpression.h b/dtool/src/cppparser/cppExpression.h index 71df065fd9..c3483ef3e9 100644 --- a/dtool/src/cppparser/cppExpression.h +++ b/dtool/src/cppparser/cppExpression.h @@ -51,6 +51,7 @@ public: T_new, T_default_new, T_sizeof, + T_sizeof_ellipsis, T_alignof, T_unary_operation, T_binary_operation, @@ -59,6 +60,7 @@ public: T_raw_literal, T_typeid_type, T_typeid_expr, + T_type_trait, // These are used when parsing =default and =delete methods. T_default, @@ -81,7 +83,9 @@ public: static CPPExpression new_op(CPPType *type, CPPExpression *op1 = NULL); static CPPExpression typeid_op(CPPType *type, CPPType *std_type_info); static CPPExpression typeid_op(CPPExpression *op1, CPPType *std_type_info); + static CPPExpression type_trait(int trait, CPPType *type, CPPType *arg = NULL); static CPPExpression sizeof_func(CPPType *type); + static CPPExpression sizeof_ellipsis_func(CPPIdentifier *ident); static CPPExpression alignof_func(CPPType *type); static CPPExpression literal(unsigned long long value, CPPInstance *lit_op); @@ -93,8 +97,6 @@ public: static const CPPExpression &get_default(); static const CPPExpression &get_delete(); - ~CPPExpression(); - enum ResultType { RT_integer, RT_real, @@ -170,6 +172,11 @@ public: CPPInstance *_operator; CPPExpression *_value; } _literal; + struct { + int _trait; + CPPType *_type; + CPPType *_arg; + } _type_trait; } _u; protected: diff --git a/dtool/src/cppparser/cppExtensionType.cxx b/dtool/src/cppparser/cppExtensionType.cxx index 36bdd307fe..8a0676883d 100644 --- a/dtool/src/cppparser/cppExtensionType.cxx +++ b/dtool/src/cppparser/cppExtensionType.cxx @@ -87,12 +87,32 @@ is_tbd() const { return false; } +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPExtensionType:: +is_standard_layout() const { + return (_type == T_enum || _type == T_enum_class || _type == T_enum_struct); +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ bool CPPExtensionType:: is_trivial() const { - return (_type == T_enum); + return (_type == T_enum || _type == T_enum_class || _type == T_enum_struct); +} + +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPExtensionType:: +is_constructible(const CPPType *given_type) const { + if (_type == T_enum || _type == T_enum_class || _type == T_enum_struct) { + const CPPExtensionType *other = ((CPPType *)given_type)->remove_reference()->remove_const()->as_extension_type(); + return other != NULL && is_equal(other); + } + return false; } /** @@ -100,7 +120,7 @@ is_trivial() const { */ bool CPPExtensionType:: is_default_constructible() const { - return (_type == T_enum); + return (_type == T_enum || _type == T_enum_class || _type == T_enum_struct); } /** @@ -108,7 +128,7 @@ is_default_constructible() const { */ bool CPPExtensionType:: is_copy_constructible() const { - return (_type == T_enum); + return (_type == T_enum || _type == T_enum_class || _type == T_enum_struct); } /** diff --git a/dtool/src/cppparser/cppExtensionType.h b/dtool/src/cppparser/cppExtensionType.h index e60aeb9f21..7f7bf15abf 100644 --- a/dtool/src/cppparser/cppExtensionType.h +++ b/dtool/src/cppparser/cppExtensionType.h @@ -47,7 +47,9 @@ public: virtual bool is_incomplete() const; virtual bool is_tbd() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; diff --git a/dtool/src/cppparser/cppFile.h b/dtool/src/cppparser/cppFile.h index b284758615..f3644fce3c 100644 --- a/dtool/src/cppparser/cppFile.h +++ b/dtool/src/cppparser/cppFile.h @@ -55,7 +55,7 @@ public: Filename _filename; Filename _filename_as_referenced; - Source _source; + mutable Source _source; mutable bool _pragma_once; }; diff --git a/dtool/src/cppparser/cppFunctionType.cxx b/dtool/src/cppparser/cppFunctionType.cxx index 3232fc56fa..371b714c2d 100644 --- a/dtool/src/cppparser/cppFunctionType.cxx +++ b/dtool/src/cppparser/cppFunctionType.cxx @@ -89,9 +89,11 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, } CPPFunctionType *rep = new CPPFunctionType(*this); - rep->_return_type = - _return_type->substitute_decl(subst, current_scope, global_scope) - ->as_type(); + if (_return_type != NULL) { + rep->_return_type = + _return_type->substitute_decl(subst, current_scope, global_scope) + ->as_type(); + } rep->_parameters = _parameters->substitute_decl(subst, current_scope, global_scope); @@ -265,6 +267,9 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, if (_flags & F_const_method) { out << " const"; } + if (_flags & F_volatile_method) { + out << " volatile"; + } if (_flags & F_noexcept) { out << " noexcept"; } diff --git a/dtool/src/cppparser/cppFunctionType.h b/dtool/src/cppparser/cppFunctionType.h index 6618c625fe..f08de51e45 100644 --- a/dtool/src/cppparser/cppFunctionType.h +++ b/dtool/src/cppparser/cppFunctionType.h @@ -40,6 +40,9 @@ public: F_trailing_return_type = 0x800, F_final = 0x1000, F_override = 0x2000, + F_volatile_method = 0x4000, + F_lvalue_method = 0x8000, + F_rvalue_method = 0x10000, }; CPPFunctionType(CPPType *return_type, CPPParameterList *parameters, diff --git a/dtool/src/cppparser/cppInstance.cxx b/dtool/src/cppparser/cppInstance.cxx index ce01da78e4..86768af511 100644 --- a/dtool/src/cppparser/cppInstance.cxx +++ b/dtool/src/cppparser/cppInstance.cxx @@ -82,6 +82,10 @@ CPPInstance(CPPType *type, CPPInstanceIdentifier *ii, int storage_class, // anyway. } + if (ii->_packed) { + _storage_class |= SC_parameter_pack; + } + delete ii; } @@ -353,11 +357,7 @@ check_for_constructor(CPPScope *current_scope, CPPScope *global_scope) { CPPReferenceType *ref_type = param_type->as_reference_type(); if (ref_type != NULL) { - param_type = ref_type->_pointing_at; - - if (param_type->get_subtype() == CPPDeclaration::ST_const) { - param_type = param_type->as_const_type()->_wrapped_around; - } + param_type = ref_type->_pointing_at->remove_cv(); if (class_name == param_type->get_simple_name()) { if (ref_type->_value_category == CPPReferenceType::VC_rvalue) { @@ -563,6 +563,9 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete, if (_ident != NULL) { name = _ident->get_local_name(scope); } + if (_storage_class & SC_parameter_pack) { + name = "..." + name; + } if (_type->as_function_type()) { _type->as_function_type()-> diff --git a/dtool/src/cppparser/cppInstance.h b/dtool/src/cppparser/cppInstance.h index 5e6459fbda..675ba83507 100644 --- a/dtool/src/cppparser/cppInstance.h +++ b/dtool/src/cppparser/cppInstance.h @@ -64,6 +64,13 @@ public: SC_deleted = 0x8000, SC_thread_local = 0x10000, + + // This isn't really a storage class. It's only used temporarily by the + // parser, to make parsing specifier sequences a bit easier. + SC_const = 0x20000, + + // Used to indicate that this is a parameter pack. + SC_parameter_pack = 0x40000, }; CPPInstance(CPPType *type, const string &name, int storage_class = 0); diff --git a/dtool/src/cppparser/cppInstanceIdentifier.cxx b/dtool/src/cppparser/cppInstanceIdentifier.cxx index 96f14e27ce..fe723f552d 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.cxx +++ b/dtool/src/cppparser/cppInstanceIdentifier.cxx @@ -26,12 +26,11 @@ */ CPPInstanceIdentifier::Modifier:: Modifier(CPPInstanceIdentifierType type) : - _type(type) -{ - _func_params = NULL; - _func_flags = 0; - _scoping = NULL; - _expr = NULL; + _type(type), + _func_params(NULL), + _func_flags(0), + _scoping(NULL), + _expr(NULL) { } /** @@ -83,7 +82,8 @@ initializer_type(CPPParameterList *params) { CPPInstanceIdentifier:: CPPInstanceIdentifier(CPPIdentifier *ident) : _ident(ident), - _bit_width(-1) { + _bit_width(-1), + _packed(false) { } /** diff --git a/dtool/src/cppparser/cppInstanceIdentifier.h b/dtool/src/cppparser/cppInstanceIdentifier.h index a96086a2ee..8433b30313 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.h +++ b/dtool/src/cppparser/cppInstanceIdentifier.h @@ -88,8 +88,12 @@ public: typedef vector Modifiers; Modifiers _modifiers; + // If not -1, indicates a bitfield int _bit_width; + // Indicates a parameter pack + bool _packed; + private: CPPType * r_unroll_type(CPPType *start_type, Modifiers::const_iterator mi); diff --git a/dtool/src/cppparser/cppManifest.cxx b/dtool/src/cppparser/cppManifest.cxx index 18a747d241..bb8f315c39 100644 --- a/dtool/src/cppparser/cppManifest.cxx +++ b/dtool/src/cppparser/cppManifest.cxx @@ -370,10 +370,8 @@ save_expansion(const string &exp, const vector_string ¶meter_names) { // Is this identifier one of our parameters? int pnum = -1; - bool va_args = false; if (ident == "__VA_ARGS__") { - va_args = true; // C99-style variadics, ie. #define macro(...) __VA_ARGS__ pnum = _variadic_param; diff --git a/dtool/src/cppparser/cppParser.cxx b/dtool/src/cppparser/cppParser.cxx index 29874cb559..4b27a87d6d 100644 --- a/dtool/src/cppparser/cppParser.cxx +++ b/dtool/src/cppparser/cppParser.cxx @@ -45,7 +45,20 @@ is_fully_specified() const { */ bool CPPParser:: parse_file(const Filename &filename) { - if (!init_cpp(CPPFile(filename, filename, CPPFile::S_local))) { + Filename canonical(filename); + canonical.make_canonical(); + + CPPFile file(canonical, filename, CPPFile::S_local); + + // Don't read it if we included it before and it had #pragma once. + ParsedFiles::iterator it = _parsed_files.find(file); + if (it != _parsed_files.end() && it->_pragma_once) { + // But mark it as local. + it->_source = CPPFile::S_local; + return true; + } + + if (!init_cpp(file)) { cerr << "Unable to read " << filename << "\n"; return false; } diff --git a/dtool/src/cppparser/cppPointerType.cxx b/dtool/src/cppparser/cppPointerType.cxx index 59734ed575..6fac65a6b1 100644 --- a/dtool/src/cppparser/cppPointerType.cxx +++ b/dtool/src/cppparser/cppPointerType.cxx @@ -14,6 +14,9 @@ #include "cppPointerType.h" #include "cppFunctionType.h" #include "cppIdentifier.h" +#include "cppArrayType.h" +#include "cppStructType.h" +#include "cppSimpleType.h" /** * @@ -88,6 +91,14 @@ is_tbd() const { return _pointing_at->is_tbd(); } +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPPointerType:: +is_standard_layout() const { + return true; +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -96,6 +107,60 @@ is_trivial() const { return true; } +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPPointerType:: +is_constructible(const CPPType *given_type) const { + given_type = ((CPPType *)given_type)->remove_reference()->remove_cv(); + + // Can convert from compatible pointer or array type. + CPPType *other_target; + switch (given_type->get_subtype()) { + case ST_array: + other_target = given_type->as_array_type()->_element_type; + break; + + case ST_pointer: + other_target = given_type->as_pointer_type()->_pointing_at; + break; + + case ST_simple: + // Can initialize from nullptr. + return given_type->as_simple_type()->_type == CPPSimpleType::T_nullptr; + + default: + return false; + } + + // Can't convert const to non-const pointer. + if (other_target->is_const() && !_pointing_at->is_const()) { + return false; + } + + // Are we pointing to the same type? That's always OK. + const CPPType *a = _pointing_at->remove_cv(); + const CPPType *b = other_target->remove_cv(); + if (a == b || *a == *b) { + return true; + } + + // Can initialize void pointer with any pointer. + const CPPSimpleType *simple_type = a->as_simple_type(); + if (simple_type != NULL) { + return simple_type->_type == CPPSimpleType::T_void; + } + + // Can initialize from derived class pointer. + const CPPStructType *a_struct = a->as_struct_type(); + const CPPStructType *b_struct = b->as_struct_type(); + if (a_struct != NULL && b_struct != NULL) { + return a_struct->is_base_of(b_struct); + } + + return false; +} + /** * Returns true if the type is default-constructible. */ diff --git a/dtool/src/cppparser/cppPointerType.h b/dtool/src/cppparser/cppPointerType.h index 2bb0fea0c1..41aed4876b 100644 --- a/dtool/src/cppparser/cppPointerType.h +++ b/dtool/src/cppparser/cppPointerType.h @@ -36,7 +36,9 @@ public: CPPScope *global_scope); virtual bool is_tbd() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *other) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; virtual bool is_equivalent(const CPPType &other) const; diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 24116a240a..5df779fc1d 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -18,6 +18,7 @@ #include "cppIdentifier.h" #include "cppTemplateScope.h" #include "cppTemplateParameterList.h" +#include "cppClassTemplateParameter.h" #include "cppConstType.h" #include "cppFunctionGroup.h" #include "cppFunctionType.h" @@ -416,7 +417,14 @@ get_next_token0() { int token_type = IDENTIFIER; CPPDeclaration *decl = ident->find_symbol(current_scope, global_scope); if (decl != NULL && decl->as_type() != NULL) { - token_type = TYPENAME_IDENTIFIER; + // We need to see type pack template parameters as a different type of + // identifier to resolve a parser ambiguity. + CPPClassTemplateParameter *ctp = decl->as_class_template_parameter(); + if (ctp && ctp->_packed) { + token_type = TYPEPACK_IDENTIFIER; + } else { + token_type = TYPENAME_IDENTIFIER; + } } _last_token_loc = loc; @@ -806,7 +814,7 @@ expand_manifests(const string &input_expr, bool expand_undefined, Manifests::const_iterator mi = _manifests.find(ident); if (mi != _manifests.end()) { const CPPManifest *manifest = (*mi).second; - expand_manifest_inline(expr, q, p, (*mi).second); + expand_manifest_inline(expr, q, p, manifest); manifest_found = true; } else if (expand_undefined && ident != "true" && ident != "false") { @@ -951,7 +959,7 @@ internal_get_next_token() { case ',': if (_paren_nesting <= 0) { _state = S_end_nested; - return CPPToken::eof(); + return CPPToken(0, loc); } break; @@ -959,7 +967,7 @@ internal_get_next_token() { if (_paren_nesting <= 0) { _parsing_template_params = false; _state = S_end_nested; - return CPPToken::eof(); + return CPPToken(0, loc); } } } @@ -1192,8 +1200,6 @@ skip_c_comment(int c) { } else { CPPFile first_file = get_file(); - int first_line_number = get_line_number(); - int first_col_number = get_col_number() - 2; while (c != EOF) { if (c == '*') { @@ -1641,7 +1647,7 @@ handle_include_directive(const string &args, const YYLTYPE &loc) { _last_c = '\0'; // If it was explicitly named on the command-line, mark it S_local. - filename.make_absolute(); + filename.make_canonical(); if (_explicit_files.count(filename)) { source = CPPFile::S_local; } @@ -1816,8 +1822,9 @@ get_identifier(int c) { type = CPPExpression::T_u16string; } else if (name == "U") { type = CPPExpression::T_u32string; + } else { + type = CPPExpression::T_string; } - get(); string str = scan_quoted(c); @@ -2452,11 +2459,27 @@ check_keyword(const string &name) { if (name == "friend") return KW_FRIEND; if (name == "for") return KW_FOR; if (name == "goto") return KW_GOTO; + if (name == "__has_virtual_destructor") return KW_HAS_VIRTUAL_DESTRUCTOR; if (name == "if") return KW_IF; if (name == "inline") return KW_INLINE; if (name == "__inline") return KW_INLINE; if (name == "__inline__") return KW_INLINE; if (name == "int") return KW_INT; + if (name == "__is_abstract") return KW_IS_ABSTRACT; + if (name == "__is_base_of") return KW_IS_BASE_OF; + if (name == "__is_class") return KW_IS_CLASS; + if (name == "__is_constructible") return KW_IS_CONSTRUCTIBLE; + if (name == "__is_convertible_to") return KW_IS_CONVERTIBLE_TO; + if (name == "__is_destructible") return KW_IS_DESTRUCTIBLE; + if (name == "__is_empty") return KW_IS_EMPTY; + if (name == "__is_enum") return KW_IS_ENUM; + if (name == "__is_final") return KW_IS_FINAL; + if (name == "__is_fundamental") return KW_IS_FUNDAMENTAL; + if (name == "__is_pod") return KW_IS_POD; + if (name == "__is_polymorphic") return KW_IS_POLYMORPHIC; + if (name == "__is_standard_layout") return KW_IS_STANDARD_LAYOUT; + if (name == "__is_trivial") return KW_IS_TRIVIAL; + if (name == "__is_union") return KW_IS_UNION; if (name == "long") return KW_LONG; if (name == "__make_map_property") return KW_MAKE_MAP_PROPERTY; if (name == "__make_property") return KW_MAKE_PROPERTY; @@ -2491,6 +2514,7 @@ check_keyword(const string &name) { if (name == "typedef") return KW_TYPEDEF; if (name == "typeid") return KW_TYPEID; if (name == "typename") return KW_TYPENAME; + if (name == "__underlying_type") return KW_UNDERLYING_TYPE; if (name == "union") return KW_UNION; if (name == "unsigned") return KW_UNSIGNED; if (name == "using") return KW_USING; @@ -2752,7 +2776,7 @@ nested_parse_template_instantiation(CPPTemplateScope *scope) { _parsing_template_params = true; CPPToken token = internal_get_next_token(); - if (token._token == '>') { + if (token._token == '>' || token._token == 0) { _parsing_template_params = false; } else { _saved_tokens.push_back(token); @@ -2761,36 +2785,53 @@ nested_parse_template_instantiation(CPPTemplateScope *scope) { CPPTemplateParameterList *actual_params = new CPPTemplateParameterList; for (pi = formal_params._parameters.begin(); - pi != formal_params._parameters.end() && _parsing_template_params; - ++pi) { + pi != formal_params._parameters.end() && _parsing_template_params;) { CPPToken token = peek_next_token(); YYLTYPE loc = token._lloc; CPPDeclaration *decl = (*pi); - if (decl->as_type()) { + CPPClassTemplateParameter *param = decl->as_class_template_parameter(); + CPPInstance *inst = decl->as_instance(); + if (param) { // Parse a typename template parameter. _saved_tokens.push_back(CPPToken(START_TYPE)); CPPType *type = ::parse_type(this, current_scope, global_scope); if (type == NULL) { loc.last_line = get_line_number(); loc.last_column = get_col_number() - 1; - warning("Invalid type", loc); + warning("invalid type", loc); skip_to_end_nested(); type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); } actual_params->_parameters.push_back(type); - } else { + + // If this is a variadic template, keep reading using this parameter. + if (!param->_packed) { + ++pi; + } + } else if (inst) { // Parse a constant expression template parameter. _saved_tokens.push_back(CPPToken(START_CONST_EXPR)); CPPExpression *expr = parse_const_expr(this, current_scope, global_scope); if (expr == NULL) { loc.last_line = get_line_number(); loc.last_column = get_col_number() - 1; - warning("Invalid expression", loc); + warning("invalid expression", loc); skip_to_end_nested(); expr = new CPPExpression(0); } actual_params->_parameters.push_back(expr); + + // If this is a variadic template, keep reading using this parameter. + if ((inst->_storage_class & CPPInstance::SC_parameter_pack) == 0) { + ++pi; + } + } else { + loc.last_line = get_line_number(); + loc.last_column = get_col_number() - 1; + warning("invalid template parameter", loc); + skip_to_end_nested(); + ++pi; } _state = S_nested; diff --git a/dtool/src/cppparser/cppReferenceType.cxx b/dtool/src/cppparser/cppReferenceType.cxx index edb29a91e2..bbb1f1a50e 100644 --- a/dtool/src/cppparser/cppReferenceType.cxx +++ b/dtool/src/cppparser/cppReferenceType.cxx @@ -12,6 +12,8 @@ */ #include "cppReferenceType.h" +#include "cppTypedefType.h" +#include "cppStructType.h" /** * @@ -87,6 +89,14 @@ is_tbd() const { return _pointing_at->is_tbd(); } +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPReferenceType:: +is_standard_layout() const { + return false; +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -95,6 +105,67 @@ is_trivial() const { return false; } +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPReferenceType:: +is_constructible(const CPPType *given_type) const { + const CPPType *a; + const CPPType *b; + + CPPReferenceType *ref_type = ((CPPType *)given_type)->as_reference_type(); + if (ref_type != NULL) { + if (ref_type->_value_category == VC_rvalue) { + return is_constructible(ref_type->_pointing_at); + } + + if (_value_category == VC_rvalue) { + // Can never initialize an rvalue ref from an lvalue ref. + return false; + } + + if (!_pointing_at->is_const()) { + // Cannot initialize a non-const reference using a const one. + if (ref_type->_pointing_at->is_const()) { + return false; + } + } + + a = _pointing_at->remove_cv(); + b = ref_type->_pointing_at->remove_cv(); + + } else { + // Initializing using an rvalue. + if (!_pointing_at->is_const()) { + // Cannot initialize a non-const reference using a const one. + if (given_type->is_const()) { + return false; + } + + // Cannot initalise a non-const lvalue reference with an rvalue ref. + if (_value_category == VC_lvalue) { + return false; + } + } + + a = _pointing_at->remove_cv(); + b = ((CPPType *)given_type)->remove_cv(); + } + + if (a == b || *a == *b) { + return true; + } + + // Can initialize from derived class pointer. + const CPPStructType *a_struct = a->as_struct_type(); + const CPPStructType *b_struct = b->as_struct_type(); + if (a_struct != NULL && b_struct != NULL) { + return a_struct->is_base_of(b_struct); + } + + return false; +} + /** * Returns true if the type is default-constructible. */ @@ -111,6 +182,14 @@ is_copy_constructible() const { return (_value_category == VC_lvalue); } +/** + * Returns true if the type is destructible. + */ +bool CPPReferenceType:: +is_destructible() const { + return false; +} + /** * This is a little more forgiving than is_equal(): it returns true if the * types appear to be referring to the same thing, even if they may have diff --git a/dtool/src/cppparser/cppReferenceType.h b/dtool/src/cppparser/cppReferenceType.h index 96b898ce2b..89feba8d2c 100644 --- a/dtool/src/cppparser/cppReferenceType.h +++ b/dtool/src/cppparser/cppReferenceType.h @@ -42,9 +42,12 @@ public: CPPScope *global_scope); virtual bool is_tbd() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; + virtual bool is_destructible() const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, diff --git a/dtool/src/cppparser/cppScope.cxx b/dtool/src/cppparser/cppScope.cxx index 9945a1a72d..a873cfa3cf 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -27,8 +27,8 @@ #include "cppPreprocessor.h" #include "cppTemplateScope.h" #include "cppClassTemplateParameter.h" -#include "cppConstType.h" #include "cppFunctionType.h" +#include "cppConstType.h" #include "cppUsing.h" #include "cppBisonDefs.h" #include "indent.h" diff --git a/dtool/src/cppparser/cppScope.h b/dtool/src/cppparser/cppScope.h index 75eaa53c6a..dc8c7e0295 100644 --- a/dtool/src/cppparser/cppScope.h +++ b/dtool/src/cppparser/cppScope.h @@ -139,11 +139,12 @@ public: Templates _templates; CPPNameComponent _name; + typedef set Using; + Using _using; + protected: CPPScope *_parent_scope; CPPStructType *_struct_type; - typedef set Using; - Using _using; CPPVisibility _current_vis; private: diff --git a/dtool/src/cppparser/cppSimpleType.cxx b/dtool/src/cppparser/cppSimpleType.cxx index 8c9b323945..82d7735bdc 100644 --- a/dtool/src/cppparser/cppSimpleType.cxx +++ b/dtool/src/cppparser/cppSimpleType.cxx @@ -34,6 +34,30 @@ is_tbd() const { return (_type == T_unknown); } +/** + * Returns true if the type is a boolean, floating point or integral type. + */ +bool CPPSimpleType:: +is_arithmetic() const { + return (_type > T_unknown && _type < T_void); +} + +/** + * Returns true if the type is considered a fundamental type. + */ +bool CPPSimpleType:: +is_fundamental() const { + return (_type != T_unknown && _type != T_parameter && _type != T_auto); +} + +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPSimpleType:: +is_standard_layout() const { + return (_type != T_unknown && _type != T_parameter && _type != T_auto); +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -42,6 +66,27 @@ is_trivial() const { return true; } +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPSimpleType:: +is_constructible(const CPPType *given_type) const { + given_type = ((CPPType *)given_type)->remove_reference()->remove_cv(); + + const CPPSimpleType *simple_type = given_type->as_simple_type(); + if (simple_type == NULL) { + return given_type->is_enum() && is_arithmetic(); + } else if (_type == T_nullptr) { + return simple_type->_type == T_nullptr; + } else if (_type == T_bool) { + return simple_type->is_arithmetic() || simple_type->_type == T_nullptr; + } else if (is_arithmetic()) { + return simple_type->is_arithmetic(); + } else { + return false; + } +} + /** * Returns true if the type is default-constructible. */ @@ -58,6 +103,14 @@ is_copy_constructible() const { return (_type != T_void); } +/** + * Returns true if the type is destructible. + */ +bool CPPSimpleType:: +is_destructible() const { + return (_type != T_void); +} + /** * Returns true if the type is a special parameter expression type. * diff --git a/dtool/src/cppparser/cppSimpleType.h b/dtool/src/cppparser/cppSimpleType.h index 12ee96857f..8adb254a1b 100644 --- a/dtool/src/cppparser/cppSimpleType.h +++ b/dtool/src/cppparser/cppSimpleType.h @@ -19,7 +19,7 @@ #include "cppType.h" /** - * + * Represents a C++ fundamental type. */ class CPPSimpleType : public CPPType { public: @@ -40,12 +40,11 @@ public: // nullptr_t, which is a typedef of decltype(nullptr). T_nullptr, -/* - * T_parameter is a special type which is assigned to expressions that are - * discovered where a formal parameter was expected. This is a special case - * for handling cases like this: int foo(0); which really means the same thing - * as: int foo = 0; but it initially looks like a function prototype. - */ + // T_parameter is a special type which is assigned to expressions that are + // discovered where a formal parameter was expected. This is a special + // case for handling cases like this: int foo(0); which really means the + // same thing as: int foo = 0; but it initially looks like a function + // prototype. T_parameter, // T_auto is also a special type that corresponds to the "auto" keyword @@ -69,9 +68,14 @@ public: int _flags; virtual bool is_tbd() const; + bool is_arithmetic() const; + virtual bool is_fundamental() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; + virtual bool is_destructible() const; virtual bool is_parameter_expr() const; virtual string get_preferred_name() const; diff --git a/dtool/src/cppparser/cppStructType.cxx b/dtool/src/cppparser/cppStructType.cxx index 49eee9c436..73712c66ad 100644 --- a/dtool/src/cppparser/cppStructType.cxx +++ b/dtool/src/cppparser/cppStructType.cxx @@ -13,6 +13,7 @@ #include "cppStructType.h" #include "cppTypedefType.h" +#include "cppReferenceType.h" #include "cppScope.h" #include "cppTypeProxy.h" #include "cppTemplateScope.h" @@ -126,16 +127,154 @@ is_abstract() const { return !funcs.empty(); } +/** + * Returns true if this struct declaration is a base class of the other given + * class, or the same class. + */ +bool CPPStructType:: +is_base_of(const CPPStructType *other) const { + if (this == other) { + return true; + } + Derivation::const_iterator di; + for (di = other->_derivation.begin(); di != other->_derivation.end(); ++di) { + const CPPStructType *base = (*di)._base->as_struct_type(); + if (base != NULL && is_base_of(base)) { + return true; + } + } + return false; +} + +/** + * Returns true if this struct declaration defines no non-static data members + * other than bit-fields of size 0, no virtual functions, no virtual base + * classes, and no non-empty base classes, and is not a union. + */ +bool CPPStructType:: +is_empty() const { + if (_type == T_union) { + return false; + } + + if (check_virtual()) { + return false; + } + + // Make sure all base classes are empty and non-virtual. + Derivation::const_iterator di; + for (di = _derivation.begin(); di != _derivation.end(); ++di) { + CPPStructType *base = (*di)._base->as_struct_type(); + if ((*di)._is_virtual || (base != NULL && !base->is_empty())) { + return false; + } + } + + // Make sure there are no non-static data members. + CPPScope::Variables::const_iterator vi; + for (vi = _scope->_variables.begin(); vi != _scope->_variables.end(); ++vi) { + CPPInstance *instance = (*vi).second; + assert(instance != NULL); + + if (instance->_storage_class & CPPInstance::SC_static) { + // Static members don't count. + continue; + } + + // Only members with a bit width of 0 are okay. + if (instance->_bit_width != 0) { + return false; + } + } + + return true; +} + +/** + * Returns true if this class or any of its base classes have virtual methods. + */ +bool CPPStructType:: +is_polymorphic() const { + if (_type == T_union) { + return false; + } + return check_virtual(); +} + +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPStructType:: +is_standard_layout() const { + assert(_scope != NULL); + + CPPVisibility member_vis = V_unknown; + + // Make sure all data members have the same vis and are standard layout. + CPPScope::Variables::const_iterator vi; + for (vi = _scope->_variables.begin(); vi != _scope->_variables.end(); ++vi) { + CPPInstance *instance = (*vi).second; + assert(instance != NULL); + + if (instance->_storage_class & CPPInstance::SC_static) { + // Static members don't count. + continue; + } + + // Finally, check if the data member itself is standard layout. + assert(instance->_type != NULL); + if (!instance->_type->is_standard_layout()) { + return false; + } + + if (member_vis == V_unknown) { + // The first non-static data member may not be a base class. + CPPStructType *struct_type = instance->_type->remove_cv()->as_struct_type(); + if (struct_type != NULL && struct_type->is_base_of(this)) { + return false; + } + member_vis = instance->_vis; + + } else if (member_vis != instance->_vis) { + // All members need to have the same access control. + return false; + } + } + + // Make sure all base classes are standard-layout and non-virtual. + Derivation::const_iterator di; + for (di = _derivation.begin(); di != _derivation.end(); ++di) { + CPPStructType *base = (*di)._base->as_struct_type(); + if ((*di)._is_virtual) { + return false; + } + + // If this class had instance members, all base classes need to be empty. + if (member_vis != V_unknown) { + if (!base->is_empty()) { + return false; + } + } else { + if (!base->is_standard_layout()) { + return false; + } + } + } + + // Make sure we have no virtual functions. + return !check_virtual(); +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ bool CPPStructType:: is_trivial() const { - // Make sure all base classes are trivial. + // Make sure all base classes are trivial and non-virtual. Derivation::const_iterator di; for (di = _derivation.begin(); di != _derivation.end(); ++di) { CPPStructType *base = (*di)._base->as_struct_type(); - if (base != NULL && !base->is_trivial()) { + if ((*di)._is_virtual || (base != NULL && !base->is_trivial())) { return false; } } @@ -166,7 +305,7 @@ is_trivial() const { } } - // Now look for functions that are virtual or condestructors. + // Now look for functions that are virtual or con/destructors. bool is_default_constructible = true; CPPScope::Functions::const_iterator fi; for (fi = _scope->_functions.begin(); fi != _scope->_functions.end(); ++fi) { @@ -193,8 +332,8 @@ is_trivial() const { if (ftype->_flags & (CPPFunctionType::F_destructor | CPPFunctionType::F_move_constructor | CPPFunctionType::F_copy_constructor)) { - // User-provided destructors and copymove constructors are not trivial - // unless they are defaulted (and not virtual). + // User-provided destructors and copy/move constructors are not + // trivial unless they are defaulted (and not virtual). return false; } @@ -220,6 +359,62 @@ is_trivial() const { return is_default_constructible; } +/** + * Returns true if the type can be constructed using the given argument. + * This implementation is rudimentary, as it does not attempt to follow all of + * the implicit type conversion rules, but it is still useful. + */ +bool CPPStructType:: +is_constructible(const CPPType *given_type) const { + // Does the type match the copy constructor or move constructor? + CPPType *base_type = ((CPPType *)given_type)->remove_reference(); + if (is_equivalent(*base_type->remove_cv())) { + const CPPReferenceType *ref_type = given_type->as_reference_type(); + if (ref_type == NULL || + ref_type->_value_category == CPPReferenceType::VC_rvalue) { + return is_move_constructible(V_public); + } else { + return is_copy_constructible(V_public); + } + } + + // Check for a different constructor. + CPPFunctionGroup *fgroup = get_constructor(); + if (fgroup != (CPPFunctionGroup *)NULL) { + CPPFunctionGroup::Instances::const_iterator ii; + for (ii = fgroup->_instances.begin(); + ii != fgroup->_instances.end(); + ++ii) { + CPPInstance *inst = (*ii); + assert(inst->_type != (CPPType *)NULL); + + CPPFunctionType *ftype = inst->_type->as_function_type(); + assert(ftype != (CPPFunctionType *)NULL); + + CPPParameterList *params = ftype->_parameters; + if (params->_parameters.size() == 1 && !params->_includes_ellipsis) { + CPPType *param_type = params->_parameters[0]->_type->remove_reference(); + + if (!param_type->is_const() && base_type->is_const()) { + // Can't pass a const object to a function taking a non-const. + continue; + } + + // It's deleted, anyhow. + if ((inst->_storage_class & CPPInstance::SC_deleted) != 0) { + continue; + } + + if (param_type->is_equivalent(*base_type)) { + return true; + } + } + } + } + + return false; +} + /** * Returns true if the type is default-constructible. */ @@ -236,6 +431,14 @@ is_copy_constructible() const { return is_copy_constructible(V_public); } +/** + * Returns true if the type is destructible. + */ +bool CPPStructType:: +is_destructible() const { + return is_destructible(V_public); +} + /** * Returns true if the type is default-constructible. */ @@ -399,6 +602,139 @@ is_copy_constructible(CPPVisibility min_vis) const { return true; } +/** + * Returns true if the type is move-constructible. + */ +bool CPPStructType:: +is_move_constructible(CPPVisibility min_vis) const { + CPPInstance *constructor = get_move_constructor(); + if (constructor != (CPPInstance *)NULL) { + // It has a user-declared move constructor. + if (constructor->_vis > min_vis) { + // Inaccessible move constructor. + return false; + } + + if (constructor->_storage_class & CPPInstance::SC_deleted) { + // It is deleted. + return false; + } + + return true; + } + + return is_copy_constructible(min_vis); +} + +/** + * Returns true if the type is destructible. + */ +bool CPPStructType:: +is_destructible(CPPVisibility min_vis) const { + // Do we have an explicit destructor? + CPPInstance *destructor = get_destructor(); + if (destructor != (CPPInstance *)NULL) { + if (destructor->_vis > min_vis) { + // Yes, but it's inaccessible. + return false; + } + + if (destructor->_storage_class & CPPInstance::SC_deleted) { + // Yes, but it's explicitly been deleted. + return false; + } + + return true; + } + + // Make sure all base classes are destructible. + Derivation::const_iterator di; + for (di = _derivation.begin(); di != _derivation.end(); ++di) { + CPPStructType *base = (*di)._base->as_struct_type(); + if (base != NULL && !base->is_destructible(V_protected)) { + return false; + } + } + + assert(_scope != NULL); + + // Make sure all members are destructible. + CPPScope::Variables::const_iterator vi; + for (vi = _scope->_variables.begin(); vi != _scope->_variables.end(); ++vi) { + CPPInstance *instance = (*vi).second; + assert(instance != NULL); + + if (instance->_storage_class & CPPInstance::SC_static) { + // Static members don't count. + continue; + } + + // If the data member is not destructible, no go. + assert(instance->_type != NULL); + if (!instance->_type->is_destructible()) { + return false; + } + } + + return true; +} + +/** + * Returns true if variables of this type may be implicitly converted to + * the other type. + */ +bool CPPStructType:: +is_convertible_to(const CPPType *other) const { + if (CPPType::is_convertible_to(other)) { + return true; + } + + // Check all typecast operators to see whether we can cast to a type that is + // convertible to the other type. + CPPScope::Functions::const_iterator fi; + for (fi = _scope->_functions.begin(); fi != _scope->_functions.end(); ++fi) { + CPPFunctionGroup *fgroup = (*fi).second; + + CPPFunctionGroup::Instances::const_iterator ii; + for (ii = fgroup->_instances.begin(); ii != fgroup->_instances.end(); ++ii) { + CPPInstance *inst = (*ii); + + if (inst->_storage_class & (CPPInstance::SC_deleted | CPPInstance::SC_static | CPPInstance::SC_explicit)) { + // Exclude static/deleted/explicit methods. + continue; + } + + // Also, the instance needs to be publicly visible. + if (inst->_vis > V_public) { + continue; + } + + assert(inst->_type != (CPPType *)NULL); + CPPFunctionType *ftype = inst->_type->as_function_type(); + assert(ftype != (CPPFunctionType *)NULL); + + if (ftype->_return_type != NULL && + (ftype->_flags & CPPFunctionType::F_operator_typecast) != 0) { + // Yes, this is a typecast operator. Test using the return type. + if (ftype->_return_type->is_convertible_to(other)) { + return true; + } + } + } + } + + // Check whether any of the base classes are convertible. + Derivation::const_iterator di; + for (di = _derivation.begin(); di != _derivation.end(); ++di) { + CPPStructType *base = (*di)._base->as_struct_type(); + if (base != NULL && (*di)._vis <= V_public && !base->is_convertible_to(other)) { + return true; + } + } + + return false; +} + /** * Ensures all functions are correctly marked with the "virtual" flag if they * are truly virtual by virtue of inheritance, rather than simply being @@ -420,6 +756,30 @@ check_virtual() const { return !funcs.empty(); } +/** + * Returns true if this class, or any of its base classes, has a virtual + * destructor. + */ +bool CPPStructType:: +has_virtual_destructor() const { + CPPInstance *destructor = get_destructor(); + if (destructor != NULL) { + if (destructor->_storage_class & CPPInstance::SC_virtual) { + return true; + } + } + + Derivation::const_iterator di; + for (di = _derivation.begin(); di != _derivation.end(); ++di) { + CPPStructType *base = (*di)._base->as_struct_type(); + if (base != NULL && base->has_virtual_destructor()) { + return true; + } + } + + return false; +} + /** * Returns true if this declaration is an actual, factual declaration, or * false if some part of the declaration depends on a template parameter which @@ -459,7 +819,7 @@ get_constructor() const { /** * Returns the default constructor defined for the struct type, or NULL if - * there is none. + * there is no user-declared constructor that takes 0 arguments. */ CPPInstance *CPPStructType:: get_default_constructor() const { @@ -490,7 +850,7 @@ get_default_constructor() const { /** * Returns the copy constructor defined for the struct type, or NULL if no - * copy constructor exists. + * user-declared copy constructor exists. */ CPPInstance *CPPStructType:: get_copy_constructor() const { @@ -519,7 +879,7 @@ get_copy_constructor() const { /** * Returns the move constructor defined for the struct type, or NULL if no - * move constructor exists. + * user-declared move constructor exists. */ CPPInstance *CPPStructType:: get_move_constructor() const { @@ -548,7 +908,7 @@ get_move_constructor() const { /** * Returns the destructor defined for the struct type, if any, or NULL if no - * destructor is found. + * user-declared destructor is found. */ CPPInstance *CPPStructType:: get_destructor() const { diff --git a/dtool/src/cppparser/cppStructType.h b/dtool/src/cppparser/cppStructType.h index 46c7a428b3..585c7476b2 100644 --- a/dtool/src/cppparser/cppStructType.h +++ b/dtool/src/cppparser/cppStructType.h @@ -44,14 +44,26 @@ public: CPPScope *get_scope() const; bool is_abstract() const; + bool is_base_of(const CPPStructType *other) const; + bool is_empty() const; + bool is_polymorphic() const; bool check_virtual() const; + bool has_virtual_destructor() const; virtual bool is_fully_specified() const; virtual bool is_incomplete() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *arg_type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; + virtual bool is_destructible() const; bool is_default_constructible(CPPVisibility min_vis) const; bool is_copy_constructible(CPPVisibility min_vis) const; + bool is_move_constructible(CPPVisibility min_vis) const; + bool is_destructible(CPPVisibility min_vis) const; + virtual bool is_convertible_to(const CPPType *other) const; + + inline bool is_final() const { return _final; } CPPFunctionGroup *get_constructor() const; CPPInstance *get_default_constructor() const; diff --git a/dtool/src/cppparser/cppTemplateScope.cxx b/dtool/src/cppparser/cppTemplateScope.cxx index 50618b026d..2960718205 100644 --- a/dtool/src/cppparser/cppTemplateScope.cxx +++ b/dtool/src/cppparser/cppTemplateScope.cxx @@ -97,8 +97,10 @@ add_template_parameter(CPPDeclaration *param) { CPPClassTemplateParameter *cl = param->as_class_template_parameter(); if (cl != NULL) { // Create an implicit typedef for this class parameter. - string name = cl->_ident->get_local_name(); - _types[name] = cl; + if (cl->_ident != NULL) { + string name = cl->_ident->get_local_name(); + _types[name] = cl; + } } CPPInstance *inst = param->as_instance(); diff --git a/dtool/src/cppparser/cppToken.cxx b/dtool/src/cppparser/cppToken.cxx index b6f03d8d49..025590113a 100644 --- a/dtool/src/cppparser/cppToken.cxx +++ b/dtool/src/cppparser/cppToken.cxx @@ -40,7 +40,7 @@ CPPToken(int token, int line_number, int col_number, */ CPPToken:: CPPToken(int token, const YYLTYPE &loc, const string &str, const YYSTYPE &val) : - _token(token), _lloc(loc), _lval(val) + _token(token), _lval(val), _lloc(loc) { _lval.str = str; } diff --git a/dtool/src/cppparser/cppType.cxx b/dtool/src/cppparser/cppType.cxx index e6430e6b45..801c571add 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -12,7 +12,12 @@ */ #include "cppType.h" +#include "cppConstType.h" +#include "cppPointerType.h" +#include "cppReferenceType.h" +#include "cppStructType.h" #include "cppTypedefType.h" +#include "cppExtensionType.h" #include CPPType::Types CPPType::_types; @@ -57,6 +62,22 @@ is_tbd() const { return false; } +/** + * Returns true if the type is considered a fundamental type. + */ +bool CPPType:: +is_fundamental() const { + return false; +} + +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPType:: +is_standard_layout() const { + return false; +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -65,6 +86,14 @@ is_trivial() const { return false; } +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPType:: +is_constructible(const CPPType *given_type) const { + return false; +} + /** * Returns true if the type is default-constructible. */ @@ -81,6 +110,14 @@ is_copy_constructible() const { return false; } +/** + * Returns true if the type is destructible. + */ +bool CPPType:: +is_destructible() const { + return !is_incomplete(); +} + /** * Returns true if the type is a special parameter expression type. * @@ -92,6 +129,136 @@ is_parameter_expr() const { return false; } +/** + * Returns true if this is an enum type, or a typedef to an enum type. + */ +bool CPPType:: +is_enum() const { + const CPPTypedefType *td_type = as_typedef_type(); + if (td_type != NULL) { + return td_type->_type->is_enum(); + } + const CPPExtensionType *ext_type = as_extension_type(); + if (ext_type != NULL) { + return ext_type->_type == CPPExtensionType::T_enum || + ext_type->_type == CPPExtensionType::T_enum_struct || + ext_type->_type == CPPExtensionType::T_enum_class; + } + return false; +} + +/** + * Returns true if this is a const type, or a typedef to a const type. + */ +bool CPPType:: +is_const() const { + const CPPTypedefType *td_type = as_typedef_type(); + if (td_type != NULL) { + return td_type->_type->is_const(); + } + return get_subtype() == ST_const; +} + +/** + * Returns true if this is a reference type, or a typedef to a reference type. + */ +bool CPPType:: +is_reference() const { + const CPPTypedefType *td_type = as_typedef_type(); + if (td_type != NULL) { + return td_type->_type->is_reference(); + } + return get_subtype() == ST_reference; +} + +/** + * Returns true if this is an unqualified or cv-qualified pointer type, or a + * typedef to one. + */ +bool CPPType:: +is_pointer() const { + const CPPTypedefType *td_type = as_typedef_type(); + if (td_type != NULL) { + return td_type->_type->is_pointer(); + } + const CPPConstType *const_type = as_const_type(); + if (const_type != NULL) { + return const_type->_wrapped_around->is_pointer(); + } + return get_subtype() == ST_pointer; +} + +/** + * Returns the type with any const qualifier stripped off. Will follow + * typedefs, but only if necessary. + */ +CPPType *CPPType:: +remove_const() { + const CPPTypedefType *td_type = as_typedef_type(); + if (td_type != NULL) { + CPPType *unwrapped = td_type->_type->remove_const(); + if (unwrapped != td_type->_type) { + return unwrapped; + } else { + return this; + } + } + const CPPConstType *const_type = as_const_type(); + if (const_type != NULL) { + return const_type->_wrapped_around->remove_const(); + } + return this; +} + +/** + * Returns the type with any reference stripped off. + */ +CPPType *CPPType:: +remove_reference() { + const CPPTypedefType *td_type = as_typedef_type(); + if (td_type != NULL) { + CPPType *unwrapped = td_type->_type->remove_reference(); + if (unwrapped != td_type->_type) { + return unwrapped; + } else { + return this; + } + } + const CPPReferenceType *ref_type = as_reference_type(); + if (ref_type != NULL) { + return ref_type->_pointing_at; + } + return this; +} + +/** + * Returns the type with any pointer and cv-qualifiers stripped off. + */ +CPPType *CPPType:: +remove_pointer() { + switch (get_subtype()) { + case ST_typedef: + { + const CPPTypedefType *td_type = as_typedef_type(); + CPPType *unwrapped = td_type->_type->remove_pointer(); + if (unwrapped != td_type->_type) { + return unwrapped; + } else { + return this; + } + } + + case ST_pointer: + return ((const CPPPointerType *)this)->_pointing_at; + + case ST_const: + return ((const CPPConstType *)this)->_wrapped_around->remove_pointer(); + + default: + return this; + } +} + /** * Returns true if the type has even been typedef'ed and therefore has a * simple name available to stand for it. Extension types are all implicitly @@ -229,6 +396,14 @@ is_equivalent(const CPPType &other) const { return is_equal(&other); } +/** + * Returns true if variables of this type may be implicitly converted to + * the other type. + */ +bool CPPType:: +is_convertible_to(const CPPType *other) const { + return other->is_constructible(this); +} /** * Formats a C++-looking line that defines an instance of the given type, with diff --git a/dtool/src/cppparser/cppType.h b/dtool/src/cppparser/cppType.h index 298eaf179c..c709c475d6 100644 --- a/dtool/src/cppparser/cppType.h +++ b/dtool/src/cppparser/cppType.h @@ -45,11 +45,27 @@ public: CPPScope *global_scope); virtual bool is_tbd() const; + virtual bool is_fundamental() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; + virtual bool is_destructible() const; virtual bool is_parameter_expr() const; + // Convenience methods. + bool is_enum() const; + bool is_const() const; + bool is_reference() const; + bool is_pointer() const; + + CPPType *remove_const(); + inline CPPType *remove_volatile() { return this; } + inline CPPType *remove_cv() { return remove_const(); }; + CPPType *remove_reference(); + CPPType *remove_pointer(); + bool has_typedef_name() const; string get_typedef_name(CPPScope *scope = NULL) const; @@ -61,6 +77,7 @@ public: string get_alt_name(int n) const; virtual bool is_incomplete() const; + virtual bool is_convertible_to(const CPPType *other) const; virtual bool is_equivalent(const CPPType &other) const; void output_instance(ostream &out, const string &name, diff --git a/dtool/src/cppparser/cppTypedefType.cxx b/dtool/src/cppparser/cppTypedefType.cxx index aaede09529..61c569760e 100644 --- a/dtool/src/cppparser/cppTypedefType.cxx +++ b/dtool/src/cppparser/cppTypedefType.cxx @@ -157,6 +157,22 @@ is_tbd() const { return _type->is_tbd(); } +/** + * Returns true if the type is considered a fundamental type. + */ +bool CPPTypedefType:: +is_fundamental() const { + return _type->is_fundamental(); +} + +/** + * Returns true if the type is considered a standard layout type. + */ +bool CPPTypedefType:: +is_standard_layout() const { + return _type->is_standard_layout(); +} + /** * Returns true if the type is considered a Plain Old Data (POD) type. */ @@ -165,6 +181,14 @@ is_trivial() const { return _type->is_trivial(); } +/** + * Returns true if the type can be constructed using the given argument. + */ +bool CPPTypedefType:: +is_constructible(const CPPType *given_type) const { + return _type->is_constructible(given_type); +} + /** * Returns true if the type is default-constructible. */ @@ -181,6 +205,14 @@ is_copy_constructible() const { return _type->is_copy_constructible(); } +/** + * Returns true if the type is destructible. + */ +bool CPPTypedefType:: +is_destructible() const { + return _type->is_destructible(); +} + /** * Returns true if this declaration is an actual, factual declaration, or * false if some part of the declaration depends on a template parameter which @@ -300,6 +332,15 @@ resolve_type(CPPScope *current_scope, CPPScope *global_scope) { return this; } +/** + * Returns true if variables of this type may be implicitly converted to + * the other type. + */ +bool CPPTypedefType:: +is_convertible_to(const CPPType *other) const { + return _type->is_convertible_to(other); +} + /** * This is a little more forgiving than is_equal(): it returns true if the * types appear to be referring to the same thing, even if they may have diff --git a/dtool/src/cppparser/cppTypedefType.h b/dtool/src/cppparser/cppTypedefType.h index 2eae58cc68..280033738d 100644 --- a/dtool/src/cppparser/cppTypedefType.h +++ b/dtool/src/cppparser/cppTypedefType.h @@ -42,9 +42,13 @@ public: virtual bool is_incomplete() const; virtual bool is_tbd() const; + virtual bool is_fundamental() const; + virtual bool is_standard_layout() const; virtual bool is_trivial() const; + virtual bool is_constructible(const CPPType *type) const; virtual bool is_default_constructible() const; virtual bool is_copy_constructible() const; + virtual bool is_destructible() const; virtual bool is_fully_specified() const; @@ -60,6 +64,7 @@ public: virtual CPPType *resolve_type(CPPScope *current_scope, CPPScope *global_scope); + virtual bool is_convertible_to(const CPPType *other) const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index 7ec1cb6f04..712e7172e4 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -70,23 +70,25 @@ #else // #pragma message("VC 6.0") #endif +#endif /* WIN32_VC */ + +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif // Use NODEFAULT to optimize a switch() stmt to tell MSVC to automatically go // to the final untested case after it has failed all the other cases (i.e. // 'assume at least one of the cases is always true') #ifdef _DEBUG -# define NODEFAULT default: assert(0); +#define NODEFAULT default: assert(0); break; +#elif defined(_MSC_VER) +#define NODEFAULT default: __assume(0); // special VC keyword +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || __has_builtin(__builtin_unreachable) +#define NODEFAULT default: __builtin_unreachable(); #else -# define NODEFAULT default: __assume(0); // special VC keyword +#define NODEFAULT #endif -#else /* if !WIN32_VC */ -#ifdef _DEBUG -# define NODEFAULT default: assert(0); -#else -# define NODEFAULT -#endif -#endif /* WIN32_VC */ /* include win32 defns for everything up to WinServer2003, and assume diff --git a/dtool/src/dtoolbase/typeRegistry.cxx b/dtool/src/dtoolbase/typeRegistry.cxx index 99ac09be10..7349d20dd4 100644 --- a/dtool/src/dtoolbase/typeRegistry.cxx +++ b/dtool/src/dtoolbase/typeRegistry.cxx @@ -341,6 +341,8 @@ get_root_class(int n) { TypeHandle handle; if (n >= 0 && n < (int)_root_classes.size()) { handle = _root_classes[n]->_handle; + } else { + handle = TypeHandle::none(); } _lock->release(); @@ -380,6 +382,8 @@ get_parent_class(TypeHandle child, int index) const { assert(rnode != (TypeRegistryNode *)NULL); if (index >= 0 && index < (int)rnode->_parent_classes.size()) { handle = rnode->_parent_classes[index]->_handle; + } else { + handle = TypeHandle::none(); } _lock->release(); return handle; @@ -415,6 +419,8 @@ get_child_class(TypeHandle child, int index) const { assert(rnode != (TypeRegistryNode *)NULL); if (index >= 0 && index < (int)rnode->_child_classes.size()) { handle = rnode->_child_classes[index]->_handle; + } else { + handle = TypeHandle::none(); } _lock->release(); return handle; diff --git a/dtool/src/dtoolutil/.gitignore b/dtool/src/dtoolutil/.gitignore deleted file mode 100644 index 3ffa6ad966..0000000000 --- a/dtool/src/dtoolutil/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/checkPandaVersion.cxx -/checkPandaVersion.h -/pandaVersion.h diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx index ca78c0a551..037d421469 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx @@ -323,7 +323,7 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) { // Posix case. { off_t li = lseek(_fd, off, SEEK_END); - if (li == (size_t)-1) { + if (li == (off_t)-1) { return -1; } new_pos = (size_t)li; diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index a60da64576..6659a310db 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -859,6 +859,11 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak _flags |= F_coerce_constructor; } + if (_args_type == InterfaceMaker::AT_varargs) { + // Of course methods named "make" can still take kwargs. + _args_type = InterfaceMaker::AT_keyword_args; + } + } else if (fname == "operator /") { if (_has_this && _parameters.size() == 2 && TypeManager::is_float(_parameters[1]._remap->get_new_type())) { diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 5d18fca7be..d4eea3fdff 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -1259,9 +1259,16 @@ write_module_support(ostream &out, ostream *out_h, InterrogateModuleDef *def) { if (is_cpp_type_legal(object->_itype._cpptype) && isExportThisRun(object->_itype._cpptype)) { string class_name = make_safe_name(object->_itype.get_scoped_name()); - bool is_typed = HasAGetClassTypeFunction(object->_itype._cpptype); + bool is_typed = has_get_class_type_function(object->_itype._cpptype); if (is_typed) { + if (has_init_type_function(object->_itype._cpptype)) { + // Call the init_type function. This isn't necessary for all + // types as many of them are automatically initialized at static + // init type, but for some extension classes it's useful. + out << " " << object->_itype._cpptype->get_local_name(&parser) + << "::init_type();\n"; + } out << " Dtool_" << class_name << "._type = " << object->_itype._cpptype->get_local_name(&parser) << "::get_class_type();\n" @@ -1291,7 +1298,7 @@ write_module_support(ostream &out, ostream *out_h, InterrogateModuleDef *def) { string class_name = (*ii)->get_local_name(&parser); string safe_name = make_safe_name(class_name); - if (HasAGetClassTypeFunction(*ii)) { + if (has_get_class_type_function(*ii)) { out << " Dtool_Ptr_" << safe_name << " = LookupRuntimeTypedClass(" << class_name << "::get_class_type());\n"; } else { out << " Dtool_Ptr_" << safe_name << " = LookupNamedClass(\"" << class_name << "\");\n"; @@ -1541,7 +1548,7 @@ write_module_class(ostream &out, Object *obj) { std::string export_class_name = classNameFromCppName(obj->_itype.get_name(), false); bool is_runtime_typed = IsPandaTypedObject(obj->_itype._cpptype->as_struct_type()); - if (!is_runtime_typed && HasAGetClassTypeFunction(obj->_itype._cpptype)) { + if (!is_runtime_typed && has_get_class_type_function(obj->_itype._cpptype)) { is_runtime_typed = true; } @@ -2337,7 +2344,7 @@ write_module_class(ostream &out, Object *obj) { string expected_params; - out << " if (arg2 != (PyObject *)NULL) {\n"; + out << " if (arg2 != (PyObject *)NULL && arg2 != Py_None) {\n"; out << " PyObject *args = PyTuple_Pack(2, arg, arg2);\n"; write_function_forset(out, two_param_remaps, 2, 2, expected_params, 4, true, true, AT_varargs, RF_pyobject | RF_err_null | RF_decref_args, true); @@ -4196,7 +4203,7 @@ write_function_forset(ostream &out, return; } - FunctionRemap *remap; + FunctionRemap *remap = NULL; std::set::iterator sii; bool all_nonconst = false; @@ -7010,7 +7017,7 @@ DoesInheritFromIsClass(const CPPStructType *inclass, const std::string &name) { */ bool InterfaceMakerPythonNative:: -HasAGetClassTypeFunction(CPPType *type) { +has_get_class_type_function(CPPType *type) { while (type->get_subtype() == CPPDeclaration::ST_typedef) { type = type->as_typedef_type()->_type; } @@ -7025,6 +7032,43 @@ HasAGetClassTypeFunction(CPPType *type) { return scope->_functions.find("get_class_type") != scope->_functions.end(); } +/** + * + */ +bool InterfaceMakerPythonNative:: +has_init_type_function(CPPType *type) { + while (type->get_subtype() == CPPDeclaration::ST_typedef) { + type = type->as_typedef_type()->_type; + } + + CPPStructType *struct_type = type->as_struct_type(); + if (struct_type == NULL) { + return false; + } + + CPPScope *scope = struct_type->get_scope(); + CPPScope::Functions::const_iterator it = scope->_functions.find("init_type"); + if (it == scope->_functions.end()) { + return false; + } + const CPPFunctionGroup *group = it->second; + + CPPFunctionGroup::Instances::const_iterator ii; + for (ii = group->_instances.begin(); ii != group->_instances.end(); ++ii) { + const CPPInstance *cppinst = *ii; + const CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); + + if (cppfunc != NULL && + cppfunc->_parameters != NULL && + cppfunc->_parameters->_parameters.size() == 0 && + (cppinst->_storage_class & CPPInstance::SC_static) != 0) { + return true; + } + } + + return false; +} + /** * Returns -1 if the class does not define write() (and therefore cannot * support a __str__ function). diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.h b/dtool/src/interrogate/interfaceMakerPythonNative.h index a571e3323f..8f66fcf3b0 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.h +++ b/dtool/src/interrogate/interfaceMakerPythonNative.h @@ -201,7 +201,8 @@ public: bool DoesInheritFromIsClass(const CPPStructType * inclass, const std::string &name); bool IsPandaTypedObject(CPPStructType * inclass) { return DoesInheritFromIsClass(inclass,"TypedObject"); }; void write_python_instance(ostream &out, int indent_level, const std::string &return_expr, bool owns_memory, const InterrogateType &itype, bool is_const); - bool HasAGetClassTypeFunction(CPPType *type); + bool has_get_class_type_function(CPPType *type); + bool has_init_type_function(CPPType *type); int NeedsAStrFunction(const InterrogateType &itype_class); int NeedsAReprFunction(const InterrogateType &itype_class); bool NeedsARichCompareFunction(const InterrogateType &itype_class); diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index 86d2ae9a6e..206132bb31 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -19,7 +19,6 @@ #include "pnotify.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" -#include "pystub.h" #include CPPParser parser; @@ -306,9 +305,6 @@ predefine_macro(CPPParser& parser, const string& inoption) { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - preprocess_argv(argc, argv); string command_line; int i; diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 342ffdd4b9..83f36c533b 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1851,9 +1851,9 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP } // The getter must either take no arguments, or all defaults. - if (ftype->_parameters->_parameters.size() == (int)is_seq || - (ftype->_parameters->_parameters.size() > (int)is_seq && - ftype->_parameters->_parameters[(int)is_seq]->_initializer != NULL)) { + if (ftype->_parameters->_parameters.size() == (size_t)is_seq || + (ftype->_parameters->_parameters.size() > (size_t)is_seq && + ftype->_parameters->_parameters[(size_t)is_seq]->_initializer != NULL)) { // If this is a sequence getter, it must take an index argument. if (is_seq && !TypeManager::is_integer(ftype->_parameters->_parameters[0]->_type)) { continue; @@ -1909,7 +1909,7 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) { CPPInstance *function = (*fi); CPPFunctionType *ftype = function->_type->as_function_type(); - if (ftype != NULL && ftype->_parameters->_parameters.size() == (int)is_seq) { + if (ftype != NULL && ftype->_parameters->_parameters.size() == (size_t)is_seq) { deleter = function; break; } @@ -2401,7 +2401,7 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, cpptype = TypeManager::resolve_type(cpptype)->as_struct_type(); assert(cpptype != (CPPStructType *)NULL); - bool has_virt_methods = cpptype->check_virtual(); + bool has_virt_methods = cpptype->is_polymorphic(); switch (cpptype->_type) { case CPPExtensionType::T_class: @@ -2501,7 +2501,7 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, // (For many compilers, this does not require a pointer change.) generate_casts = true; - } else if (has_virt_methods && (base_type->as_struct_type() == (CPPStructType *)NULL || !base_type->as_struct_type()->check_virtual())) { + } else if (has_virt_methods && (base_type->as_struct_type() == (CPPStructType *)NULL || !base_type->as_struct_type()->is_polymorphic())) { // Finally, if this class has virtual methods, but its parent // doesn't, then we have to upcast (because this class will require // space for a virtual function table pointer, while the parent @@ -2651,7 +2651,11 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, } } - if ((itype._flags & InterrogateType::F_inherited_destructor) != 0) { + if (!cpptype->is_destructible()) { + // There's no way to destruct the type. + itype._destructor = 0; + + } else if ((itype._flags & InterrogateType::F_inherited_destructor) != 0) { // If we have inherited our virtual destructor from our base class, go // ahead and assign the same function index. assert(!itype._derivations.empty()); diff --git a/dtool/src/interrogate/interrogate_module.cxx b/dtool/src/interrogate/interrogate_module.cxx index 9a8cff85bf..8e397d8b9e 100644 --- a/dtool/src/interrogate/interrogate_module.cxx +++ b/dtool/src/interrogate/interrogate_module.cxx @@ -19,7 +19,6 @@ #include "interrogate_interface.h" #include "interrogate_request.h" #include "load_dso.h" -#include "pystub.h" #include "pnotify.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" @@ -380,9 +379,6 @@ int main(int argc, char *argv[]) { extern int optind; int flag; - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - preprocess_argv(argc, argv); flag = getopt_long_only(argc, argv, short_options, long_options, NULL); while (flag != EOF) { diff --git a/dtool/src/interrogate/typeManager.cxx b/dtool/src/interrogate/typeManager.cxx index 7c9b6582a3..db5b07f58a 100644 --- a/dtool/src/interrogate/typeManager.cxx +++ b/dtool/src/interrogate/typeManager.cxx @@ -41,7 +41,7 @@ resolve_type(CPPType *type, CPPScope *scope) { scope = &parser; } - CPPType *orig_type = type; + //CPPType *orig_type = type; type = type->resolve_type(scope, &parser); string name = type->get_local_name(&parser); if (name.empty()) { @@ -1740,7 +1740,8 @@ is_Py_buffer(CPPType *type) { case CPPDeclaration::ST_extension: case CPPDeclaration::ST_struct: - return (type->get_local_name(&parser) == "Py_buffer"); + return (type->get_local_name(&parser) == "Py_buffer" || + type->get_local_name(&parser) == "bufferinfo"); case CPPDeclaration::ST_typedef: return is_Py_buffer(type->as_typedef_type()->_type); diff --git a/dtool/src/interrogatedb/py_panda.I b/dtool/src/interrogatedb/py_panda.I index 3b171f14c7..0a06358beb 100644 --- a/dtool/src/interrogatedb/py_panda.I +++ b/dtool/src/interrogatedb/py_panda.I @@ -107,7 +107,15 @@ ALWAYS_INLINE PyObject *Dtool_WrapValue(long long value) { } ALWAYS_INLINE PyObject *Dtool_WrapValue(unsigned long long value) { + // size_t is sometimes defined as unsigned long long, and we want to map + // that to int in Python 2 so it can be returned from a __len__. +#if PY_MAJOR_VERSION >= 3 return PyLong_FromUnsignedLongLong(value); +#else + return (value > LONG_MAX) + ? PyLong_FromUnsignedLongLong(value) + : PyInt_FromLong((long)value); +#endif } ALWAYS_INLINE PyObject *Dtool_WrapValue(bool value) { diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index 953b4700d1..9fe9916573 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -816,6 +816,7 @@ PyObject *DTOOL_PyObject_RichCompare(PyObject *v1, PyObject *v2, int op) { int cmpval = DTOOL_PyObject_Compare(v1, v2); bool result; switch (op) { + NODEFAULT case Py_LT: result = (cmpval < 0); break; @@ -833,6 +834,7 @@ PyObject *DTOOL_PyObject_RichCompare(PyObject *v1, PyObject *v2, int op) { break; case Py_GE: result = (cmpval >= 0); + break; } return PyBool_FromLong(result); } diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index 8491c7529f..f5e77e0dbb 100644 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -219,9 +219,10 @@ static PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyOb } // The following used to be in the above macro, but it doesn't seem to be -// necessary as tp_alloc memsets the object to 0. ((Dtool_PyInstDef -// *)self)->_ptr_to_object = NULL;\ ((Dtool_PyInstDef *)self)->_memory_rules = -// false;\ ((Dtool_PyInstDef *)self)->_is_const = false;\ +// necessary as tp_alloc memsets the object to 0. +// ((Dtool_PyInstDef *)self)->_ptr_to_object = NULL; +// ((Dtool_PyInstDef *)self)->_memory_rules = false; +// ((Dtool_PyInstDef *)self)->_is_const = false; // Delete functions.. #ifdef NDEBUG diff --git a/dtool/src/parser-inc/Python.h b/dtool/src/parser-inc/Python.h index b687f1b5cb..ddd660072d 100644 --- a/dtool/src/parser-inc/Python.h +++ b/dtool/src/parser-inc/Python.h @@ -30,7 +30,7 @@ typedef struct {} PyUnicodeObject; class PyThreadState; typedef int Py_ssize_t; -struct Py_buffer; +typedef struct bufferinfo Py_buffer; // We need to define these accurately since interrogate may want to // write these out to default value assignments. diff --git a/dtool/src/parser-inc/functional b/dtool/src/parser-inc/functional new file mode 100644 index 0000000000..4d09ed13bf --- /dev/null +++ b/dtool/src/parser-inc/functional @@ -0,0 +1,153 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file functional + * @author tobspr + * @date 2016-11-01 + */ + +// This file, and all the other files in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef FUNCTIONAL_H +#define FUNCTIONAL_H + +#include + +namespace std { + + // base (deprecated): + template struct unary_function; + template struct binary_function; + + // reference_wrapper: + template class reference_wrapper; + + // arithmetic operations: + template struct plus; + template struct minus; + template struct multiplies; + template struct divides; + template struct modulus; + template struct negate; + + // comparisons: + template struct equal_to; + template struct not_equal_to; + template struct greater; + template struct less; + template struct greater_equal; + template struct less_equal; + + // logical operations: + template struct logical_and; + template struct logical_or; + template struct logical_not; + + // bitwise operations: + template struct bit_and; + template struct bit_or; + template struct bit_xor; + + // negators: + template class unary_negate; + template class binary_negate; + + // bind: + template struct is_bind_expression; + template struct is_placeholder; + + namespace placeholders { + // M is the implementation-defined number of placeholders + // (8 should be enough for interrogate) + extern char _1; + extern char _2; + extern char _3; + extern char _4; + extern char _5; + extern char _6; + extern char _7; + extern char _8; + } + + // binders (deprecated): + template class binder1st; + template class binder2nd; + + // adaptors (deprecated): + template class pointer_to_unary_function; + template + class pointer_to_binary_function; + + // adaptors (deprecated): + template class mem_fun_t; + template class mem_fun1_t; + template class mem_fun_ref_t; + template class mem_fun1_ref_t; + template class const_mem_fun_t; + template class const_mem_fun1_t; + template class const_mem_fun_ref_t; + template class const_mem_fun1_ref_t; + + + // polymorphic function wrappers: + class bad_function_call; + + // hash function base template: + template struct hash; + + // Hash function specializations + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template <> struct hash; + template struct hash; + + template class reference_wrapper { + public : + // types + typedef T type; + typedef void result_type; // not always defined + typedef void argument_type; // not always defined + typedef void first_argument_type; // not always defined + typedef void second_argument_type; // not always defined + }; + + template struct is_bind_expression {}; + // : integral_constant {}; + + class bad_function_call : public std::exception {}; + + // template class function; // undefined + + template< class R, class... ArgTypes > + class function { + public: + typedef R result_type; + }; + +} + + +#endif diff --git a/dtool/src/parser-inc/initializer_list b/dtool/src/parser-inc/initializer_list new file mode 100644 index 0000000000..57a3f7f6c1 --- /dev/null +++ b/dtool/src/parser-inc/initializer_list @@ -0,0 +1,34 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file initializer_list + * @author tobspr + * @date 2016-11-01 + */ + +// This file, and all the other files in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef INITIALIZER_LIST_H +#define INITIALIZER_LIST_H + +#include + +namespace std { + template class initializer_list { + public: + typedef E value_type; + typedef const E& reference; + typedef const E& const_reference; + typedef size_t size_type; + typedef const E* iterator; + typedef const E* const_iterator; + }; +} diff --git a/dtool/src/parser-inc/memory b/dtool/src/parser-inc/memory index 1f76249963..30a54d006a 100644 --- a/dtool/src/parser-inc/memory +++ b/dtool/src/parser-inc/memory @@ -1,16 +1,15 @@ -// Filename: allocator -// Created by: drose (12May00) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file memory + * @author tobspr + * @date 2016-11-01 + */ // This file, and all the other files in this directory, aren't // intended to be compiled--they're just parsed by CPPParser (and @@ -21,6 +20,8 @@ #define ALLOCATOR_H #include +#include + #ifdef GCC_STYLE_ALLOCATOR @@ -33,16 +34,155 @@ public: #else // GCC_STYLE_ALLOCATOR namespace std { - template - class allocator { - public: - typedef Type *pointer; - typedef const Type *const_pointer; - typedef size_t size_type; - pointer allocate(size_type n, allocator::const_pointer hint = 0); - void deallocate(pointer p, size_type n); - }; + // pointer traits + template struct pointer_traits; + template struct pointer_traits; + + // pointer safety + enum class pointer_safety { relaxed, preferred, strict }; + + // allocator argument tag + struct allocator_arg_t { }; + constexpr allocator_arg_t allocator_arg = allocator_arg_t(); + + // uses_allocator + template struct uses_allocator; + + // allocator traits + template struct allocator_traits; + + // the default allocator: + template class allocator; + template <> class allocator; + + // raw storage iterator: + template class raw_storage_iterator; + + // class template unique_ptr: + template class default_delete; + template class default_delete; + template > class unique_ptr; + template class unique_ptr; + // class bad_weak_ptr: + class bad_weak_ptr; + + // class template shared_ptr: + template class shared_ptr; + // class template weak_ptr: + template class weak_ptr; + + // class template owner_less: + template class owner_less; + + // class template enable_shared_from_this: + template class enable_shared_from_this; + + // hash support + template struct hash; + template struct hash >; + template struct hash >; + + // auto_ptr (deprecated) + template class auto_ptr; + + template struct pointer_traits { + typedef Ptr pointer; + typedef Ptr element_type; + typedef ptrdiff_t difference_type; + + template using rebind = U; + }; + + template struct pointer_traits { + typedef T* pointer; + typedef T element_type; + typedef ptrdiff_t difference_type; + + template using rebind = U*; + }; + + + template struct allocator_traits { + typedef Alloc allocator_type; + + typedef typename Alloc::value_type value_type; + + typedef void* pointer; + typedef const void* const_pointer; + typedef void* void_pointer; + typedef const void* const_void_pointer; + + typedef std::ptrdiff_t difference_type; + typedef size_t size_type; + + struct propagate_on_container_copy_assignment; + struct propagate_on_container_move_assignment; + struct propagate_on_container_swap; + struct is_always_equal; + + template using rebind_alloc = size_t; + template using rebind_traits = allocator_traits >; + }; + + template class allocator; + // specialize for void: + template <> class allocator { + public: + typedef void* pointer; + typedef const void* const_pointer; + // reference-to-void members are impossible. + typedef void value_type; + template struct rebind { typedef allocator other; }; + }; + template class allocator { + public: + struct true_type_; // do not depend on type_traits header + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef T value_type; + template struct rebind { typedef allocator other; }; + typedef true_type_ propagate_on_container_move_assignment; + typedef true_type_ is_always_equal; + + }; + + template + class raw_storage_iterator + : public iterator { + public: + }; + + + template struct default_delete {}; + + template struct default_delete {}; + + // unique_ptr for single objects + template > class unique_ptr { + public: + typedef T* pointer; + typedef T element_type; + typedef D deleter_type; + }; + + class bad_weak_ptr: public std::exception {}; + + template class shared_ptr { + public: + typedef T element_type; + }; + + template class weak_ptr { + public: + typedef T element_type; + }; + + template class enable_shared_from_this {}; } #endif // GCC_STYLE_ALLOCATOR diff --git a/dtool/src/parser-inc/stdint.h b/dtool/src/parser-inc/stdint.h index 44729cbe17..6e67b9ed9d 100644 --- a/dtool/src/parser-inc/stdint.h +++ b/dtool/src/parser-inc/stdint.h @@ -20,25 +20,45 @@ #define __WORDSIZE 32 #endif -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int int64_t; +using intmax_t = long long int; +using uintmax_t = unsigned long long int; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; +using int8_t = signed char; +using int16_t = short int; +using int32_t = int; +using int64_t = long long int; -typedef long long int intmax_t; -typedef unsigned long long int uintmax_t; +using uint8_t = unsigned char; +using uint16_t = unsigned short int; +using uint32_t = unsigned int; +using uint64_t = unsigned long long int; + +using int_least8_t = int8_t; +using int_least16_t = int16_t; +using int_least32_t = int32_t; +using int_least64_t = int64_t; + +using uint_least8_t = uint8_t; +using uint_least16_t = uint16_t; +using uint_least32_t = uint32_t; +using uint_least64_t = uint64_t; + +using int_fast8_t = int8_t; +using int_fast16_t = int16_t; +using int_fast32_t = int32_t; +using int_fast64_t = int64_t; + +using uint_fast8_t = uint8_t; +using uint_fast16_t = uint16_t; +using uint_fast32_t = uint32_t; +using uint_fast64_t = uint64_t; #if __WORDSIZE == 64 -typedef int64_t intptr_t; -typedef uint64_t uintptr_t; +using intptr_t = int64_t; +using uintptr_t = uint64_t; #else -typedef int32_t intptr_t; -typedef uint32_t uintptr_t; +using intptr_t = int32_t; +using uintptr_t = uint32_t; #endif #endif diff --git a/dtool/src/parser-inc/stdtypedefs.h b/dtool/src/parser-inc/stdtypedefs.h index 5a92caaff7..a14a140d2f 100644 --- a/dtool/src/parser-inc/stdtypedefs.h +++ b/dtool/src/parser-inc/stdtypedefs.h @@ -39,6 +39,8 @@ inline namespace std { #endif } +struct timeval; + #ifdef __cplusplus #define NULL 0L #else diff --git a/dtool/src/parser-inc/type_traits b/dtool/src/parser-inc/type_traits new file mode 100644 index 0000000000..7e55b03fbc --- /dev/null +++ b/dtool/src/parser-inc/type_traits @@ -0,0 +1,96 @@ +#pragma once + +#include + +namespace std { + template + struct integral_constant { + static constexpr T value = v; + typedef T value_type; + constexpr operator value_type() const noexcept { return value; } + constexpr value_type operator()() const noexcept { return value; } + }; + + typedef integral_constant true_type; + typedef integral_constant false_type; + + template + struct is_same : std::false_type {}; + + template + struct is_same : std::true_type {}; + + template + struct is_void : std::false_type {}; + + template<> + struct is_void : std::true_type {}; + + template + struct is_enum : integral_constant {}; + + template + struct is_union : integral_constant {}; + + template + struct is_class : integral_constant {}; + + template + struct is_fundamental : integral_constant {}; + + template + struct is_compound : integral_constant {}; + + template + struct is_trivial : integral_constant {}; + + template + struct is_standard_layout : integral_constant {}; + + template + struct is_pod : integral_constant {}; + + template + struct is_empty : integral_constant {}; + + template + struct is_polymorphic : integral_constant {}; + + template + struct is_abstract : integral_constant {}; + + template + struct is_final : integral_constant {}; + + template + struct is_default_constructible : integral_constant {}; + + template + struct is_copy_constructible : integral_constant {}; + + template + struct is_move_constructible : integral_constant {}; + + template + struct is_destructible : integral_constant {}; + + template + struct has_virtual_destructor : integral_constant {}; + + template + struct alignment_of : std::integral_constant {}; + + template + struct is_base_of : integral_constant {}; + + template + struct is_convertible : integral_constant {}; + + template struct add_cv { typedef const volatile T type; }; + template struct add_const { typedef const T type; }; + template struct add_volatile { typedef volatile T type; }; + + template struct add_lvalue_reference { typedef T &type; }; + template struct add_rvalue_reference { typedef T &&type; }; + template struct add_pointer { typedef T *type; }; +} diff --git a/dtool/src/parser-inc/unordered_map b/dtool/src/parser-inc/unordered_map new file mode 100644 index 0000000000..e3c6220d35 --- /dev/null +++ b/dtool/src/parser-inc/unordered_map @@ -0,0 +1,84 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file unordered_map + * @author tobspr + * @date 2016-11-01 + */ + +// This file, and all the other files in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef UNORDERED_MAP_H +#define UNORDERED_MAP_H + +#include +#include +#include +#include +#include + +namespace std { + + template , + class Pred = std::equal_to, + class Allocator = std::allocator > > + class unordered_map + { + public: + // types + typedef Key key_type; + typedef Key value_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Allocator allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; + class iterator; + class const_iterator; + class local_iterator; + class const_local_iterator; + }; + + template , + class Pred = std::equal_to, + class Allocator = std::allocator > > + class unordered_multimap + { + public: + // types + typedef Key key_type; + typedef Key value_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Allocator allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; + class iterator; + class const_iterator; + class local_iterator; + class const_local_iterator; + }; + +} // namespace std + +#endif diff --git a/dtool/src/parser-inc/unordered_set b/dtool/src/parser-inc/unordered_set new file mode 100644 index 0000000000..766161d12b --- /dev/null +++ b/dtool/src/parser-inc/unordered_set @@ -0,0 +1,83 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file unordered_set + * @author tobspr + * @date 2016-11-01 + */ + +// This file, and all the other files in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef UNORDERED_SET_H +#define UNORDERED_SET_H + +#include +#include +#include +#include +#include + +namespace std { + + template , + class Pred = std::equal_to, + class Allocator = std::allocator > + class unordered_set + { + public: + // types + typedef Key key_type; + typedef Key value_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Allocator allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; + + class iterator; + class const_iterator; + class local_iterator; + class const_local_iterator; + }; + + template , + class Pred = std::equal_to, + class Allocator = std::allocator > + class unordered_multiset + { + public: + // types + typedef Key key_type; + typedef Key value_type; + typedef Hash hasher; + typedef Pred key_equal; + typedef Allocator allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; + class iterator; + class const_iterator; + class local_iterator; + class const_local_iterator; + }; + +} // namespace std + +#endif diff --git a/dtool/src/parser-inc/xmmintrin.h b/dtool/src/parser-inc/xmmintrin.h new file mode 100644 index 0000000000..eb127708a8 --- /dev/null +++ b/dtool/src/parser-inc/xmmintrin.h @@ -0,0 +1 @@ +struct __m128; diff --git a/dtool/src/prc/.gitignore b/dtool/src/prc/.gitignore deleted file mode 100644 index dd7e0cdd0c..0000000000 --- a/dtool/src/prc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/prc_parameters.h diff --git a/dtool/src/prc/configPage.cxx b/dtool/src/prc/configPage.cxx index ab65fdcd73..981caadf87 100644 --- a/dtool/src/prc/configPage.cxx +++ b/dtool/src/prc/configPage.cxx @@ -129,11 +129,7 @@ read_prc(istream &in) { #ifdef HAVE_OPENSSL // Set up the evp context for verifying the signature, if we find one. -#ifdef SSL_097 _md_ctx = EVP_MD_CTX_create(); -#else - _md_ctx = new EVP_MD_CTX; -#endif EVP_VerifyInit((EVP_MD_CTX *)_md_ctx, EVP_sha1()); #endif // HAVE_OPENSSL @@ -208,11 +204,7 @@ read_prc(istream &in) { << "invalid signature found in " << get_name() << "\n"; } } -#ifdef SSL_097 EVP_MD_CTX_destroy((EVP_MD_CTX *)_md_ctx); -#else - delete (EVP_MD_CTX *)_md_ctx; -#endif #endif // HAVE_OPENSSL bool failed = (in.fail() && !in.eof()); diff --git a/dtool/src/prc/configVariableFilename.cxx b/dtool/src/prc/configVariableFilename.cxx index dc82a88f45..3939199148 100644 --- a/dtool/src/prc/configVariableFilename.cxx +++ b/dtool/src/prc/configVariableFilename.cxx @@ -19,16 +19,28 @@ */ void ConfigVariableFilename:: reload_cache() { - nassertv(_core != (ConfigVariableCore *)NULL); - mark_cache_valid(_local_modified); + // NB. MSVC doesn't guarantee that this mutex is initialized in a + // thread-safe manner. But chances are that the first time this is called + // is at static init time, when there is no risk of data races. + static MutexImpl lock; + lock.acquire(); - const ConfigDeclaration *decl = _core->get_declaration(0); - const ConfigPage *page = decl->get_page(); + // We check again for cache validity since another thread may have beaten + // us to the punch while we were waiting for the lock. + if (!is_cache_valid(_local_modified)) { + nassertv(_core != (ConfigVariableCore *)NULL); - Filename page_filename(page->get_name()); - Filename page_dirname = page_filename.get_dirname(); - ExecutionEnvironment::shadow_environment_variable("THIS_PRC_DIR", page_dirname.to_os_specific()); + const ConfigDeclaration *decl = _core->get_declaration(0); + const ConfigPage *page = decl->get_page(); - _cache = Filename::expand_from(decl->get_string_value()); - ExecutionEnvironment::clear_shadow("THIS_PRC_DIR"); + Filename page_filename(page->get_name()); + Filename page_dirname = page_filename.get_dirname(); + ExecutionEnvironment::shadow_environment_variable("THIS_PRC_DIR", page_dirname.to_os_specific()); + + _cache = Filename::expand_from(decl->get_string_value()); + ExecutionEnvironment::clear_shadow("THIS_PRC_DIR"); + + mark_cache_valid(_local_modified); + } + lock.release(); } diff --git a/dtool/src/prc/configVariableString.I b/dtool/src/prc/configVariableString.I index b3b88b90fe..1adbbe6797 100644 --- a/dtool/src/prc/configVariableString.I +++ b/dtool/src/prc/configVariableString.I @@ -127,8 +127,7 @@ INLINE const string &ConfigVariableString:: get_value() const { TAU_PROFILE("const string &ConfigVariableString::get_value() const", " ", TAU_USER); if (!is_cache_valid(_local_modified)) { - mark_cache_valid(((ConfigVariableString *)this)->_local_modified); - ((ConfigVariableString *)this)->_cache = get_string_value(); + ((ConfigVariableString *)this)->reload_cache(); } return _cache; } diff --git a/dtool/src/prc/configVariableString.cxx b/dtool/src/prc/configVariableString.cxx index 125c8841a9..3dcaaf6deb 100644 --- a/dtool/src/prc/configVariableString.cxx +++ b/dtool/src/prc/configVariableString.cxx @@ -12,3 +12,24 @@ */ #include "configVariableString.h" + +/** + * Refreshes the variable's cached value. + */ +void ConfigVariableString:: +reload_cache() { + // NB. MSVC doesn't guarantee that this mutex is initialized in a + // thread-safe manner. But chances are that the first time this is called + // is at static init time, when there is no risk of data races. + static MutexImpl lock; + lock.acquire(); + + // We check again for cache validity since another thread may have beaten + // us to the punch while we were waiting for the lock. + if (!is_cache_valid(_local_modified)) { + _cache = get_string_value(); + mark_cache_valid(_local_modified); + } + + lock.release(); +} diff --git a/dtool/src/prc/configVariableString.h b/dtool/src/prc/configVariableString.h index 08709e1ac1..1592e0b836 100644 --- a/dtool/src/prc/configVariableString.h +++ b/dtool/src/prc/configVariableString.h @@ -49,6 +49,9 @@ PUBLISHED: INLINE string get_word(size_t n) const; INLINE void set_word(size_t n, const string &value); +private: + void reload_cache(); + private: AtomicAdjust::Integer _local_modified; string _cache; diff --git a/dtool/src/prckeys/signPrcFile_src.cxx b/dtool/src/prckeys/signPrcFile_src.cxx index 6ff6b1d4c6..0d9f58cfa4 100644 --- a/dtool/src/prckeys/signPrcFile_src.cxx +++ b/dtool/src/prckeys/signPrcFile_src.cxx @@ -179,13 +179,7 @@ sign_prc(Filename filename, bool no_comments, EVP_PKEY *pkey) { } data += strm.str(); - EVP_MD_CTX *md_ctx; - -#ifdef SSL_097 - md_ctx = EVP_MD_CTX_create(); -#else - md_ctx = new EVP_MD_CTX; -#endif + EVP_MD_CTX *md_ctx = EVP_MD_CTX_create(); EVP_SignInit(md_ctx, EVP_sha1()); EVP_SignUpdate(md_ctx, data.data(), data.size()); @@ -199,11 +193,7 @@ sign_prc(Filename filename, bool no_comments, EVP_PKEY *pkey) { } assert(sig_size <= max_size); -#ifdef SSL_097 EVP_MD_CTX_destroy(md_ctx); -#else - delete md_ctx; -#endif // Now open the file in write mode and rewrite it with the new signature. pofstream out; diff --git a/dtool/src/test_interrogate/test_interrogate.cxx b/dtool/src/test_interrogate/test_interrogate.cxx index f715a6f366..f9aa7c1ab4 100644 --- a/dtool/src/test_interrogate/test_interrogate.cxx +++ b/dtool/src/test_interrogate/test_interrogate.cxx @@ -17,7 +17,6 @@ #include "interrogate_request.h" #include "load_dso.h" #include "filename.h" -#include "pystub.h" #include "panda_getopt.h" #include "preprocess_argv.h" diff --git a/makepanda/.gitignore b/makepanda/.gitignore deleted file mode 100644 index c3667923e0..0000000000 --- a/makepanda/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.pyc -*.pyo diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index e5fcf2164c..d14cb44da9 100755 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -31,6 +31,7 @@ SetCompressor ${COMPRESSOR} !include "Sections.nsh" !include "WinMessages.nsh" !include "WordFunc.nsh" +!include "x64.nsh" !define MUI_WELCOMEFINISHPAGE_BITMAP "panda-install.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "panda-install.bmp" @@ -42,7 +43,7 @@ SetCompressor ${COMPRESSOR} !define MUI_FINISHPAGE_RUN_TEXT "Visit the Panda3D Manual" !insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "../doc/LICENSE" +!insertmacro MUI_PAGE_LICENSE "${SOURCE}/doc/LICENSE" !insertmacro MUI_PAGE_DIRECTORY !define MUI_PAGE_CUSTOMFUNCTION_LEAVE ConfirmPythonSelection @@ -61,7 +62,7 @@ SetCompressor ${COMPRESSOR} ShowInstDetails hide ShowUninstDetails hide -LicenseData "${LICENSE}" +LicenseData "${SOURCE}/doc/LICENSE" InstType "Full (Recommended)" InstType "Minimal" @@ -120,6 +121,14 @@ Function runFunction ExecShell "open" "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" FunctionEnd +Function .onInit + ${If} ${REGVIEW} = 64 + ${AndIfNot} ${RunningX64} + MessageBox MB_OK|MB_ICONEXCLAMATION "You are attempting to install the 64-bit version of Panda3D on a 32-bit version of Windows. Please download and install the 32-bit version of Panda3D instead." + Abort + ${EndIf} +FunctionEnd + SectionGroup "Panda3D Libraries" Section "Core Libraries" SecCore SectionIn 1 2 RO @@ -134,12 +143,22 @@ SectionGroup "Panda3D Libraries" SetOutPath "$INSTDIR" File "${BUILT}\LICENSE" File /r /x CVS "${BUILT}\ReleaseNotes" - SetOutPath $INSTDIR\bin - File /r /x libpandagl.dll /x libpandadx9.dll /x cgD3D*.dll /x python*.dll /x libpandaode.dll /x libp3fmod_audio.dll /x fmodex*.dll /x libp3ffmpeg.dll /x av*.dll /x postproc*.dll /x swscale*.dll /x swresample*.dll /x NxCharacter*.dll /x cudart*.dll /x PhysX*.dll /x libpandaphysx.dll /x libp3rocket.dll /x boost_python*.dll /x Rocket*.dll /x _rocket*.pyd /x libpandabullet.dll /x OpenAL32.dll /x *_oal.dll /x libp3openal_audio.dll "${BUILT}\bin\*.dll" - File /nonfatal /r "${BUILT}\bin\Microsoft.*.manifest" + SetOutPath $INSTDIR\etc File /r "${BUILT}\etc\*" + SetOutPath $INSTDIR\bin + File /r /x api-ms-win-*.dll /x ucrtbase.dll /x libpandagl.dll /x libpandadx9.dll /x cgD3D*.dll /x python*.dll /x libpandaode.dll /x libp3fmod_audio.dll /x fmodex*.dll /x libp3ffmpeg.dll /x av*.dll /x postproc*.dll /x swscale*.dll /x swresample*.dll /x NxCharacter*.dll /x cudart*.dll /x PhysX*.dll /x libpandaphysx.dll /x libp3rocket.dll /x boost_python*.dll /x Rocket*.dll /x _rocket*.pyd /x libpandabullet.dll /x OpenAL32.dll /x *_oal.dll /x libp3openal_audio.dll "${BUILT}\bin\*.dll" + File /nonfatal /r "${BUILT}\bin\Microsoft.*.manifest" + + ; Before Windows 10, we need these stubs for the UCRT as well. + ReadRegDWORD $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentMajorVersionNumber" + ${If} $0 < 10 + ClearErrors + File /nonfatal /r "${BUILT}\bin\api-ms-win-*.dll" + File /nonfatal "${BUILT}\bin\ucrtbase.dll" + ${Endif} + SetDetailsPrint both DetailPrint "Installing models..." SetDetailsPrint listonly @@ -259,6 +278,26 @@ Section "Tools and utilities" SecTools File /nonfatal /r "${BUILT}\bin\*.p3d" SetOutPath "$INSTDIR\NSIS" File /r /x CVS "${NSISDIR}\*" + + WriteRegStr HKCU "Software\Classes\Panda3D.Model" "" "Panda3D model/animation" + WriteRegStr HKCU "Software\Classes\Panda3D.Model\DefaultIcon" "" "$INSTDIR\bin\pview.exe" + WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell" "" "open" + WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"' + WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress" "" "Compress to .pz" + WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress\command" "" '"$INSTDIR\bin\pzip.exe" "%1"' + + WriteRegStr HKCU "Software\Classes\Panda3D.Compressed" "" "Compressed file" + WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" "" "$INSTDIR\bin\pzip.exe" + WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell" "" "open" + WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"' + WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress" "" "Decompress" + WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress\command" "" '"$INSTDIR\bin\punzip.exe" "%1"' + + WriteRegStr HKCU "Software\Classes\Panda3D.Multifile" "" "Panda3D Multifile" + WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" "" "$INSTDIR\bin\multify.exe" + WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell" "" "open" + WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract" "" "Extract here" + WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract\command" "" '"$INSTDIR\bin\multify.exe" -xf "%1"' SectionEnd SectionGroup "Python support" @@ -369,7 +408,7 @@ SectionGroup "Python support" File /nonfatal "${BUILT}\bin\python*.dll" SetOutPath "$INSTDIR\python" - File /r "${BUILT}\python\*" + File /r /x *.pdb "${BUILT}\python\*" SetDetailsPrint both DetailPrint "Adding registry keys for Python..." @@ -593,6 +632,36 @@ Section -post SetOutPath $INSTDIR CreateShortcut "$SMPROGRAMS\${TITLE}\Uninstall ${TITLE}.lnk" "$INSTDIR\uninst.exe" "" + SetDetailsPrint both + DetailPrint "Registering file type associations..." + SetDetailsPrint listonly + + ; Even though we need the runtime to run these, we might as well tell + ; Windows what this kind of file is. + WriteRegStr HKCU "Software\Classes\.p3d" "" "Panda3D applet" + WriteRegStr HKCU "Software\Classes\.p3d" "Content Type" "application/x-panda3d" + WriteRegStr HKCU "Software\Classes\.p3d" "PerceivedType" "application" + + ; Register various model files + WriteRegStr HKCU "Software\Classes\.egg" "" "Panda3D.Model" + WriteRegStr HKCU "Software\Classes\.egg" "Content Type" "application/x-egg" + WriteRegStr HKCU "Software\Classes\.egg" "PerceivedType" "gamemedia" + WriteRegStr HKCU "Software\Classes\.bam" "" "Panda3D.Model" + WriteRegStr HKCU "Software\Classes\.bam" "Content Type" "application/x-bam" + WriteRegStr HKCU "Software\Classes\.bam" "PerceivedType" "gamemedia" + WriteRegStr HKCU "Software\Classes\.pz" "" "Panda3D.Compressed" + WriteRegStr HKCU "Software\Classes\.pz" "PerceivedType" "compressed" + WriteRegStr HKCU "Software\Classes\.mf" "" "Panda3D.Multifile" + WriteRegStr HKCU "Software\Classes\.mf" "PerceivedType" "compressed" + WriteRegStr HKCU "Software\Classes\.prc" "" "inifile" + WriteRegStr HKCU "Software\Classes\.prc" "Content Type" "text/plain" + WriteRegStr HKCU "Software\Classes\.prc" "PerceivedType" "text" + + ; For convenience, if nobody registered .pyd, we will. + ReadRegStr $0 HKCR "Software\Classes\.pyd" "" + StrCmp $0 "" 0 +2 + WriteRegStr HKCU "Software\Classes\.pyd" "" "dllfile" + SetDetailsPrint both DetailPrint "Adding directories to system PATH..." SetDetailsPrint listonly @@ -604,11 +673,7 @@ Section -post Call RemoveFromPath Push "$INSTDIR\bin" Call RemoveFromPath - Push "$INSTDIR\python" - Call AddToPath - Push "$INSTDIR\python\Scripts" - Call AddToPath - Push "$INSTDIR\bin" + Push "$INSTDIR\python;$INSTDIR\python\Scripts;$INSTDIR\bin" Call AddToPath # This is needed for the environment variable changes to take effect. @@ -632,15 +697,28 @@ Section Uninstall DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" + ReadRegStr $0 HKCU "Software\Classes\Panda3D.Model\DefaultIcon" "" + StrCmp $0 "$INSTDIR\bin\pview.exe" 0 +3 + DeleteRegKey HKCU "Software\Classes\Panda3D.Model\DefaultIcon" + DeleteRegKey HKCU "Software\Classes\Panda3D.Model\shell" + + ReadRegStr $0 HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" "" + StrCmp $0 "$INSTDIR\bin\pzip.exe" 0 +3 + DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" + DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\shell" + + ReadRegStr $0 HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" "" + StrCmp $0 "$INSTDIR\bin\multify.exe" 0 +3 + DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" + DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\shell" + ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" "" - StrCmp $0 "$INSTDIR\python" 0 SkipUnRegHKLM + StrCmp $0 "$INSTDIR\python" 0 +2 DeleteRegKey HKLM "Software\Python\PythonCore\${PYVER}" - SkipUnRegHKLM: ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\InstallPath" "" - StrCmp $0 "$INSTDIR\python" 0 SkipUnRegHKCU + StrCmp $0 "$INSTDIR\python" 0 +2 DeleteRegKey HKCU "Software\Python\PythonCore\${PYVER}" - SkipUnRegHKCU: SetDetailsPrint both DetailPrint "Deleting files..." @@ -706,9 +784,13 @@ SectionEnd !endif !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools) !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings} $(DESC_SecPyBindings) - !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython) + !ifdef HAVE_PYTHON + !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython) + !endif !insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs) - !insertmacro MUI_DESCRIPTION_TEXT ${SecSamples} $(DESC_SecSamples) + !ifdef HAVE_SAMPLES + !insertmacro MUI_DESCRIPTION_TEXT ${SecSamples} $(DESC_SecSamples) + !endif !ifdef HAVE_MAX_PLUGINS !insertmacro MUI_DESCRIPTION_TEXT ${SecMaxPlugins} $(DESC_SecMaxPlugins) !endif @@ -884,15 +966,16 @@ Function AddToPath Goto AddToPath_done AddToPath_NT: + ClearErrors ReadRegStr $1 HKCU "Environment" "PATH" - Call IsUserAdmin - Pop $3 - ; If this is an Admin user, use the System env. variable instead of the user's env. variable - StrCmp $3 1 0 +2 - ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" - ; If the PATH string is empty, jump over the mangling routines. - StrCmp $1 "" AddToPath_NTdoIt + ; If we reached an error, WATCH OUT. Either this means that + ; the registry key did not exist, or that it didn't fit in + ; NSIS' string limit. If the latter, we have to be very + ; careful not to overwrite the user's PATH. + IfErrors AddToPath_Error + DetailPrint "Current PATH value is set to $1" + StrCmp $1 "" AddToPath_NTAddPath ; Pull off the last character of the PATH string. If it's a semicolon, ; we don't need to add another one, so jump to the section where we @@ -900,21 +983,31 @@ Function AddToPath StrCpy $2 $1 1 -1 StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi + AddToPath_Error: + DetailPrint "Encountered error reading PATH variable." + ; Does the variable exist? If it doesn't, then the + ; error happened because we need to create the + ; variable. If it does, then we failed to read it + ; because we reached NSIS' string limit. + StrCpy $3 0 + AddToPath_loop: + EnumRegValue $4 HKCU "Environment" $3 + StrCmp $4 "PATH" AddToPath_ExceedLimit + StrCmp $4 "" AddToPath_NTAddPath + IntOp $3 $3 + 1 + Goto AddToPath_loop + AddToPath_ExceedLimit: + MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "Your PATH environment variable is too long! Please remove extraneous entries before proceeding. Panda3D needs to add the following the PATH so that the Panda3D utilities and libraries can be located correctly.$\n$\n$0$\n$\nIf you wish to add Panda3D to the path yourself, choose Ignore." IDIGNORE AddToPath_done IDRETRY AddToPath_NT + SetDetailsPrint both + DetailPrint "Cannot append to PATH - variable is likely too long." + SetDetailsPrint listonly + Abort AddToPath_NTAddSemi: StrCpy $1 "$1;" Goto AddToPath_NTAddPath AddToPath_NTAddPath: StrCpy $0 "$1$0" - Goto AddToPath_NTdoIt - AddToPath_NTdoIt: - Call IsUserAdmin - Pop $3 - StrCmp $3 1 0 NotAdmin - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0 - Goto AddToPath_done - - NotAdmin: - WriteRegExpandStr HKCU "Environment" "PATH" $0 + WriteRegExpandStr HKCU "Environment" "PATH" $0 AddToPath_done: Pop $3 Pop $2 @@ -965,42 +1058,40 @@ Function RemoveFromPath Goto unRemoveFromPath_done unRemoveFromPath_NT: + Push $0 StrLen $2 $0 - Call IsUserAdmin - Pop $5 - StrCmp $5 1 0 NotAdmin - ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" - Push $1 - Push $0 - Call StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 - Goto unRemoveFromPath_done + ReadRegStr $1 HKCU "Environment" "PATH" + Push $1 + Push $0 + Call StrStr ; Find $0 in $1 + Pop $0 ; pos of our dir + IntCmp $0 -1 unRemoveFromPath_NT_System + ; else, it is in path + StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir + IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') + IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. + StrLen $0 $1 + StrCpy $1 $1 $0 $2 + StrCpy $3 "$3$1" + WriteRegExpandStr HKCU "Environment" "PATH" $3 - - NotAdmin: - ReadRegStr $1 HKCU "Environment" "PATH" - Push $1 - Push $0 - Call StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKCU "Environment" "PATH" $3 + unRemoveFromPath_NT_System: + Pop $0 + StrLen $2 $0 + ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" + Push $1 + Push $0 + Call StrStr ; Find $0 in $1 + Pop $0 ; pos of our dir + IntCmp $0 -1 unRemoveFromPath_done + ; else, it is in path + StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir + IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') + IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. + StrLen $0 $1 + StrCpy $1 $1 $0 $2 + StrCpy $3 "$3$1" + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 unRemoveFromPath_done: Pop $5 @@ -1051,42 +1142,40 @@ Function un.RemoveFromPath Goto unRemoveFromPath_done unRemoveFromPath_NT: + Push $0 StrLen $2 $0 - Call un.IsUserAdmin - Pop $5 - StrCmp $5 1 0 NotAdmin - ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" - Push $1 - Push $0 - Call un.StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 - Goto unRemoveFromPath_done + ReadRegStr $1 HKCU "Environment" "PATH" + Push $1 + Push $0 + Call un.StrStr ; Find $0 in $1 + Pop $0 ; pos of our dir + IntCmp $0 -1 unRemoveFromPath_NT_System + ; else, it is in path + StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir + IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') + IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. + StrLen $0 $1 + StrCpy $1 $1 $0 $2 + StrCpy $3 "$3$1" + WriteRegExpandStr HKCU "Environment" "PATH" $3 - - NotAdmin: - ReadRegStr $1 HKCU "Environment" "PATH" - Push $1 - Push $0 - Call un.StrStr ; Find $0 in $1 - Pop $0 ; pos of our dir - IntCmp $0 -1 unRemoveFromPath_done - ; else, it is in path - StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir - IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') - IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. - StrLen $0 $1 - StrCpy $1 $1 $0 $2 - StrCpy $3 "$3$1" - WriteRegExpandStr HKCU "Environment" "PATH" $3 + unRemoveFromPath_NT_System: + Pop $0 + StrLen $2 $0 + ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" + Push $1 + Push $0 + Call un.StrStr ; Find $0 in $1 + Pop $0 ; pos of our dir + IntCmp $0 -1 unRemoveFromPath_done + ; else, it is in path + StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir + IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';') + IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon. + StrLen $0 $1 + StrCpy $1 $1 $0 $2 + StrCpy $3 "$3$1" + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3 unRemoveFromPath_done: Pop $5 @@ -1097,148 +1186,6 @@ Function un.RemoveFromPath Pop $0 FunctionEnd -; From: http://nsis.sourceforge.net/archive/nsisweb.php?page=329&instances=0,11 -; Localized by Ben Johnson (bkj@andrew.cmu.edu) -Function IsUserAdmin - Push $0 - Push $1 - Push $2 - Push $3 - Call IsNT - Pop $1 - - ClearErrors - UserInfo::GetName - ;IfErrors Win9x - Pop $2 - UserInfo::GetAccountType - Pop $3 - - ; Compare results of IsNT with "1" - StrCmp $1 1 0 NotNT - ;This is NT - - - StrCmp $3 "Admin" 0 NotAdmin - ; Observation: I get here when running Win98SE. (Lilla) - ; The functions UserInfo.dll looks for are there on Win98 too, - ; but just don't work. So UserInfo.dll, knowing that admin isn't required - ; on Win98, returns admin anyway. (per kichik) - ; MessageBox MB_OK 'User "$R1" is in the Administrators group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - Return - - NotAdmin: - ; You should still check for an empty string because the functions - ; UserInfo.dll looks for may not be present on Windows 95. (per kichik) - - #StrCmp $2 "" Win9x - #StrCpy $0 0 - ;MessageBox MB_OK 'User "$2" is in the "$3" group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 0 - Return - - ;Because we use IsNT, this is redundant. - #Win9x: - # ; comment/message below is by UserInfo.nsi author: - # ; This one means you don't need to care about admin or - # ; not admin because Windows 9x doesn't either - # ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" - # StrCpy $0 0 - - NotNT: - ;We are not NT - ;Win9x doesn't have "admin" users. - ;Let the user do whatever. - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - -FunctionEnd - -Function un.IsUserAdmin - Push $0 - Push $1 - Push $2 - Push $3 - Call un.IsNT - Pop $1 - - ClearErrors - UserInfo::GetName - ;IfErrors Win9x - Pop $2 - UserInfo::GetAccountType - Pop $3 - - ; Compare results of IsNT with "1" - StrCmp $1 1 0 NotNT - ;This is NT - - - StrCmp $3 "Admin" 0 NotAdmin - ; Observation: I get here when running Win98SE. (Lilla) - ; The functions UserInfo.dll looks for are there on Win98 too, - ; but just don't work. So UserInfo.dll, knowing that admin isn't required - ; on Win98, returns admin anyway. (per kichik) - ; MessageBox MB_OK 'User "$R1" is in the Administrators group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - Return - - NotAdmin: - ; You should still check for an empty string because the functions - ; UserInfo.dll looks for may not be present on Windows 95. (per kichik) - - #StrCmp $2 "" Win9x - #StrCpy $0 0 - ;MessageBox MB_OK 'User "$2" is in the "$3" group' - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 0 - Return - - ;Because we use IsNT, this is redundant. - #Win9x: - # ; comment/message below is by UserInfo.nsi author: - # ; This one means you don't need to care about admin or - # ; not admin because Windows 9x doesn't either - # ;MessageBox MB_OK "Error! This DLL can't run under Windows 9x!" - # StrCpy $0 0 - - NotNT: - ;We are not NT - ;Win9x doesn't have "admin" users. - ;Let the user do whatever. - Pop $3 - Pop $2 - Pop $1 - Pop $0 - - Push 1 - -FunctionEnd - Function StrRep ;Written by dirtydingus 2003-02-20 04:30:09 diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 6e4c06b7d2..bade6c8288 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -758,8 +758,8 @@ if (COMPILER=="GCC"): # 64-bits OS X doesn't have Carbon. PkgDisable("CARBON") - if (PkgSkip("PYTHON")==0): - IncDirectory("ALWAYS", SDK["PYTHON"]) + #if (PkgSkip("PYTHON")==0): + # IncDirectory("PYTHON", SDK["PYTHON"]) if (GetHost() == "darwin"): if (PkgSkip("FREETYPE")==0 and not os.path.isdir(GetThirdpartyDir() + 'freetype')): IncDirectory("FREETYPE", "/usr/X11/include") @@ -827,10 +827,7 @@ if (COMPILER=="GCC"): SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h") if not PkgSkip("PYTHON"): - if GetTarget() == "darwin" and not RTDIST and not PkgHasCustomLocation("PYTHON"): - LibName("PYTHON", "-framework Python") - else: - SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config") + SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config") SmartPkgEnable("OPENSSL", "openssl", ("ssl", "crypto"), ("openssl/ssl.h", "openssl/crypto.h")) SmartPkgEnable("ZLIB", "zlib", ("z"), "zlib.h") @@ -1063,6 +1060,10 @@ def CompileCxx(obj,src,opts): cmd += "/DWINVER=0x601 " else: cmd += "/DWINVER=0x501 " + # Work around a WinXP/2003 bug when using VS 2015+. + if SDK.get("VISUALSTUDIO_VERSION") == '14.0': + cmd += "/Zc:threadSafeInit- " + cmd += "/Fo" + obj + " /nologo /c" if GetTargetArch() != 'x64' and (not PkgSkip("SSE2") or 'SSE2' in opts): cmd += " /arch:SSE2" @@ -1241,7 +1242,7 @@ def CompileCxx(obj,src,opts): cmd += ' -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__' cmd += ' -fstack-protector -march=armv5te -mtune=xscale -msoft-float' elif arch == 'mips': - cmd += ' -fno-strict-aliasing -finline-functions -fmessage-length=0' + cmd += ' -finline-functions -fmessage-length=0' cmd += ' -fno-inline-functions-called-once -fgcse-after-reload' cmd += ' -frerun-cse-after-loop -frename-registers' @@ -1251,17 +1252,13 @@ def CompileCxx(obj,src,opts): if optlevel >= 3: cmd += " -fomit-frame-pointer" if arch.startswith('arm'): - cmd += ' -fno-strict-aliasing -finline-limit=64 -mthumb' - elif arch == 'x86': - cmd += ' -fstrict-aliasing' + cmd += ' -finline-limit=64 -mthumb' elif arch == 'mips': cmd += ' -funswitch-loops -finline-limit=300' else: cmd += ' -fno-omit-frame-pointer' if arch.startswith('arm'): cmd += ' -marm' - elif arch == 'x86': - cmd += ' -fno-strict-aliasing' # Enable SIMD instructions if requested if arch.startswith('arm') and PkgSkip("NEON") == 0: @@ -1289,6 +1286,9 @@ def CompileCxx(obj,src,opts): if ('SSE2' in opts or not PkgSkip("SSE2")) and not arch.startswith("arm"): cmd += " -msse2" + # Needed by both Python, Panda, Eigen, all of which break aliasing rules. + cmd += " -fno-strict-aliasing" + if optlevel >= 3: cmd += " -ffast-math" if optlevel == 3: @@ -2126,9 +2126,7 @@ DTOOL_CONFIG=[ ("COMPILE_IN_DEFAULT_FONT", '1', '1'), ("STDFLOAT_DOUBLE", 'UNDEF', 'UNDEF'), ("HAVE_MAYA", '1', '1'), - ("MAYA_PRE_5_0", 'UNDEF', 'UNDEF'), ("HAVE_SOFTIMAGE", 'UNDEF', 'UNDEF'), - ("SSL_097", 'UNDEF', 'UNDEF'), ("REPORT_OPENSSL_ERRORS", '1', '1'), ("USE_PANDAFILESTREAM", '1', '1'), ("USE_DELETED_CHAIN", '1', '1'), @@ -2136,7 +2134,6 @@ DTOOL_CONFIG=[ ("HAVE_GLX", 'UNDEF', '1'), ("HAVE_WGL", '1', 'UNDEF'), ("HAVE_DX9", 'UNDEF', 'UNDEF'), - ("HAVE_CHROMIUM", 'UNDEF', 'UNDEF'), ("HAVE_THREADS", '1', '1'), ("SIMPLE_THREADS", 'UNDEF', 'UNDEF'), ("OS_SIMPLE_THREADS", '1', '1'), @@ -2149,12 +2146,9 @@ DTOOL_CONFIG=[ ("DO_COLLISION_RECORDING", 'UNDEF', 'UNDEF'), ("SUPPORT_IMMEDIATE_MODE", 'UNDEF', 'UNDEF'), ("SUPPORT_FIXED_FUNCTION", '1', '1'), - ("TRACK_IN_INTERPRETER", 'UNDEF', 'UNDEF'), ("DO_MEMORY_USAGE", 'UNDEF', 'UNDEF'), ("DO_PIPELINING", '1', '1'), ("EXPORT_TEMPLATES", 'yes', 'yes'), - ("LINK_IN_GL", 'UNDEF', 'UNDEF'), - ("LINK_IN_PHYSICS", 'UNDEF', 'UNDEF'), ("DEFAULT_PATHSEP", '";"', '":"'), ("WORDS_BIGENDIAN", 'UNDEF', 'UNDEF'), ("HAVE_NAMESPACE", '1', '1'), @@ -2216,7 +2210,6 @@ DTOOL_CONFIG=[ ("IS_LINUX", 'UNDEF', '1'), ("IS_OSX", 'UNDEF', 'UNDEF'), ("IS_FREEBSD", 'UNDEF', 'UNDEF'), - ("GLOBAL_OPERATOR_NEW_EXCEPTIONS", 'UNDEF', '1'), ("HAVE_EIGEN", 'UNDEF', 'UNDEF'), ("LINMATH_ALIGN", '1', '1'), ("HAVE_ZLIB", 'UNDEF', 'UNDEF'), @@ -2234,11 +2227,12 @@ DTOOL_CONFIG=[ ("HAVE_PNM", '1', '1'), ("HAVE_STB_IMAGE", '1', '1'), ("HAVE_VORBIS", 'UNDEF', 'UNDEF'), - ("HAVE_NVIDIACG", 'UNDEF', 'UNDEF'), ("HAVE_FREETYPE", 'UNDEF', 'UNDEF'), ("HAVE_FFTW", 'UNDEF', 'UNDEF'), ("HAVE_OPENSSL", 'UNDEF', 'UNDEF'), ("HAVE_NET", 'UNDEF', 'UNDEF'), + ("WANT_NATIVE_NET", '1', '1'), + ("SIMULATE_NETWORK_DELAY", 'UNDEF', 'UNDEF'), ("HAVE_EGG", '1', '1'), ("HAVE_CG", 'UNDEF', 'UNDEF'), ("HAVE_CGGL", 'UNDEF', 'UNDEF'), @@ -2250,12 +2244,12 @@ DTOOL_CONFIG=[ ("HAVE_OPENCV", 'UNDEF', 'UNDEF'), ("HAVE_DIRECTCAM", 'UNDEF', 'UNDEF'), ("HAVE_SQUISH", 'UNDEF', 'UNDEF'), - ("HAVE_FCOLLADA", 'UNDEF', 'UNDEF'), ("HAVE_CARBON", 'UNDEF', 'UNDEF'), ("HAVE_COCOA", 'UNDEF', 'UNDEF'), ("HAVE_OPENAL_FRAMEWORK", 'UNDEF', 'UNDEF'), ("HAVE_ROCKET_PYTHON", '1', '1'), ("HAVE_ROCKET_DEBUGGER", 'UNDEF', 'UNDEF'), + ("USE_TAU", 'UNDEF', 'UNDEF'), ("PRC_SAVE_DESCRIPTIONS", '1', '1'), # ("_SECURE_SCL", '0', 'UNDEF'), # ("_SECURE_SCL_THROWS", '0', 'UNDEF'), @@ -2377,9 +2371,6 @@ def WriteConfigSettings(): if (GetOptimize() <= 3): dtool_config["DO_COLLISION_RECORDING"] = '1' - #if (GetOptimize() <= 2): - # dtool_config["TRACK_IN_INTERPRETER"] = '1' - if (GetOptimize() <= 3): dtool_config["DO_MEMORY_USAGE"] = '1' @@ -2754,8 +2745,14 @@ except ImportError as err: if "No module named %s" not in str(err): raise""" % (module, module) +exthelpers_code = """ +"This module is deprecated. Import from direct.extensions_native.extension_native_helpers instead." +from direct.extensions_native.extension_native_helpers import * +""" + if not PkgSkip("PYTHON"): ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code) + ConditionalWriteFile(GetOutputDir() + '/pandac/extension_native_helpers.py', exthelpers_code) ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '') ########################################################################################## @@ -2788,8 +2785,13 @@ if (GetTarget() == 'darwin'): # OpenAL is not yet working well on OSX for us, so let's do this for now. configprc = configprc.replace("p3openal_audio", "p3fmod_audio") -ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc) -ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc) +if GetTarget() == 'windows': + # Convert to Windows newlines. + ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc, newline='\r\n') + ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc, newline='\r\n') +else: + ConditionalWriteFile(GetOutputDir()+"/etc/Config.prc", configprc) + ConditionalWriteFile(GetOutputDir()+"/etc/Confauto.prc", confautoprc) ########################################################################################## # @@ -2886,22 +2888,75 @@ if tp_dir is not None: if GetTarget() == 'windows': CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/") - if not PkgSkip("PYTHON"): - pydll = "/" + SDK["PYTHONVERSION"].replace(".", "") - if (GetOptimize() <= 2): pydll += "_d.dll" - else: pydll += ".dll" - CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll) - for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): - CopyFile(GetOutputDir() + "/bin/", fn) + if not PkgSkip("PYTHON") and not RTDIST: + #XXX rdb I don't think we need to copy over the Python DLL, do we? + #pydll = "/" + SDK["PYTHONVERSION"].replace(".", "") + #if (GetOptimize() <= 2): pydll += "_d.dll" + #else: pydll += ".dll" + #CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll) - if not RTDIST: - CopyTree(GetOutputDir() + "/python", SDK["PYTHON"]) - if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"): - CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe") - if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"): - CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe") - ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n") + #for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): + # CopyFile(GetOutputDir() + "/bin/", fn) + + # Copy the whole Python directory. + CopyTree(GetOutputDir() + "/python", SDK["PYTHON"]) + + # NB: Python does not always ship with the correct manifest/dll. + # Figure out the correct one to ship, and grab it from WinSxS dir. + manifest = GetOutputDir() + '/tmp/python.manifest' + if os.path.isfile(manifest): + os.unlink(manifest) + oscmd('mt -inputresource:"%s\\python.exe";#1 -out:"%s" -nologo' % (SDK["PYTHON"], manifest), True) + + if os.path.isfile(manifest): + import xml.etree.ElementTree as ET + tree = ET.parse(manifest) + idents = tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity') + else: + idents = () + + for ident in tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity'): + sxs_name = '_'.join([ + ident.get('processorArchitecture'), + ident.get('name').lower(), + ident.get('publicKeyToken'), + ident.get('version'), + ]) + + # Find the manifest matching these parameters. + pattern = os.path.join('C:' + os.sep, 'Windows', 'WinSxS', 'Manifests', sxs_name + '_*.manifest') + manifests = glob.glob(pattern) + if not manifests: + print("%sWARNING:%s Could not locate manifest %s. You may need to reinstall the Visual C++ Redistributable." % (GetColor("red"), GetColor(), pattern)) + continue + + CopyFile(GetOutputDir() + "/python/" + ident.get('name') + ".manifest", manifests[0]) + + # Also copy the corresponding msvcr dll. + pattern = os.path.join('C:' + os.sep, 'Windows', 'WinSxS', sxs_name + '_*', 'msvcr*.dll') + for file in glob.glob(pattern): + CopyFile(GetOutputDir() + "/python/", file) + + # Copy python.exe to ppython.exe. + if not os.path.isfile(SDK["PYTHON"] + "/ppython.exe") and os.path.isfile(SDK["PYTHON"] + "/python.exe"): + CopyFile(GetOutputDir() + "/python/ppython.exe", SDK["PYTHON"] + "/python.exe") + if not os.path.isfile(SDK["PYTHON"] + "/ppythonw.exe") and os.path.isfile(SDK["PYTHON"] + "/pythonw.exe"): + CopyFile(GetOutputDir() + "/python/ppythonw.exe", SDK["PYTHON"] + "/pythonw.exe") + ConditionalWriteFile(GetOutputDir() + "/python/panda.pth", "..\n../bin\n") + +# Copy over the MSVC runtime. +if GetTarget() == 'windows' and "VISUALSTUDIO" in SDK: + vcver = SDK["VISUALSTUDIO_VERSION"].replace('.', '') + crtname = "Microsoft.VC%s.CRT" % (vcver) + dir = os.path.join(SDK["VISUALSTUDIO"], "VC", "redist", GetTargetArch(), crtname) + + if os.path.isfile(os.path.join(dir, "msvcr" + vcver + ".dll")): + CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcr" + vcver + ".dll")) + if os.path.isfile(os.path.join(dir, "msvcp" + vcver + ".dll")): + CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcp" + vcver + ".dll")) + if os.path.isfile(os.path.join(dir, "vcruntime" + vcver + ".dll")): + CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "vcruntime" + vcver + ".dll")) ######################################################################## ## @@ -2909,8 +2964,14 @@ if tp_dir is not None: ## ######################################################################## -CopyFile(GetOutputDir()+"/", "doc/LICENSE") -CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes") +if GetTarget() == 'windows': + # Convert to Windows newlines so they can be opened by notepad. + WriteFile(GetOutputDir() + "/LICENSE", ReadFile("doc/LICENSE"), newline='\r\n') + WriteFile(GetOutputDir() + "/ReleaseNotes", ReadFile("doc/ReleaseNotes"), newline='\r\n') +else: + CopyFile(GetOutputDir()+"/", "doc/LICENSE") + CopyFile(GetOutputDir()+"/", "doc/ReleaseNotes") + if (PkgSkip("PANDATOOL")==0): CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".mel") CopyAllFiles(GetOutputDir()+"/plugins/", "pandatool/src/scripts/", ".ms") @@ -3152,10 +3213,6 @@ COMMON_EGG2X_LIBS=[ 'libpandaegg.dll', ] + COMMON_PANDA_LIBS -COMMON_DTOOL_LIBS_PYSTUB = COMMON_DTOOL_LIBS + ['libp3pystub.lib'] -COMMON_PANDA_LIBS_PYSTUB = COMMON_PANDA_LIBS + ['libp3pystub.lib'] -COMMON_EGG2X_LIBS_PYSTUB = COMMON_EGG2X_LIBS + ['libp3pystub.lib'] - ######################################################################## # # This section contains a list of all the files that need to be compiled. @@ -3259,7 +3316,7 @@ TargetAdd('libp3dtoolconfig.dll', opts=['ADVAPI', 'OPENSSL', 'WINGDI', 'WINUSER' # DIRECTORY: dtool/src/interrogatedb/ # -OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:INTERROGATEDB'] +OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:INTERROGATEDB', 'PYTHON'] TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx') TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx') TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj') @@ -3271,7 +3328,7 @@ TargetAdd('libp3interrogatedb.dll', opts=['PYTHON']) if not PkgSkip("PYTHON"): # This used to be called dtoolconfig.pyd, but it just contains the interrogatedb # stuff, so it has been renamed appropriately. - OPTS=['DIR:dtool/metalibs/dtoolconfig'] + OPTS=['DIR:dtool/metalibs/dtoolconfig', 'PYTHON'] TargetAdd('interrogatedb_pydtool.obj', opts=OPTS, input="pydtool.cxx") TargetAdd('interrogatedb.pyd', input='interrogatedb_pydtool.obj') TargetAdd('interrogatedb.pyd', input='libp3dtool.dll') @@ -3283,11 +3340,12 @@ if not PkgSkip("PYTHON"): # DIRECTORY: dtool/src/pystub/ # -OPTS=['DIR:dtool/src/pystub'] -TargetAdd('p3pystub_pystub.obj', opts=OPTS, input='pystub.cxx') -TargetAdd('libp3pystub.lib', input='p3pystub_pystub.obj') -#TargetAdd('libp3pystub.lib', input='libp3dtool.dll') -TargetAdd('libp3pystub.lib', opts=['ADVAPI']) +if not RUNTIME and not RTDIST: + OPTS=['DIR:dtool/src/pystub'] + TargetAdd('p3pystub_pystub.obj', opts=OPTS, input='pystub.cxx') + TargetAdd('libp3pystub.lib', input='p3pystub_pystub.obj') + #TargetAdd('libp3pystub.lib', input='libp3dtool.dll') + TargetAdd('libp3pystub.lib', opts=['ADVAPI']) # # DIRECTORY: dtool/src/interrogate/ @@ -3300,14 +3358,14 @@ if (not RUNTIME): TargetAdd('interrogate.exe', input='interrogate_composite1.obj') TargetAdd('interrogate.exe', input='interrogate_composite2.obj') TargetAdd('interrogate.exe', input='libp3cppParser.ilb') - TargetAdd('interrogate.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('interrogate.exe', input=COMMON_DTOOL_LIBS) TargetAdd('interrogate.exe', input='libp3interrogatedb.dll') TargetAdd('interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) TargetAdd('interrogate_module_interrogate_module.obj', opts=OPTS, input='interrogate_module.cxx') TargetAdd('interrogate_module.exe', input='interrogate_module_interrogate_module.obj') TargetAdd('interrogate_module.exe', input='libp3cppParser.ilb') - TargetAdd('interrogate_module.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('interrogate_module.exe', input=COMMON_DTOOL_LIBS) TargetAdd('interrogate_module.exe', input='libp3interrogatedb.dll') TargetAdd('interrogate_module.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) @@ -3315,7 +3373,7 @@ if (not RUNTIME): TargetAdd('parse_file_parse_file.obj', opts=OPTS, input='parse_file.cxx') TargetAdd('parse_file.exe', input='parse_file_parse_file.obj') TargetAdd('parse_file.exe', input='libp3cppParser.ilb') - TargetAdd('parse_file.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('parse_file.exe', input=COMMON_DTOOL_LIBS) TargetAdd('parse_file.exe', input='libp3interrogatedb.dll') TargetAdd('parse_file.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) @@ -3327,7 +3385,7 @@ if (PkgSkip("OPENSSL")==0 and not RUNTIME and not RTDIST): OPTS=['DIR:dtool/src/prckeys', 'OPENSSL'] TargetAdd('make-prc-key_makePrcKey.obj', opts=OPTS, input='makePrcKey.cxx') TargetAdd('make-prc-key.exe', input='make-prc-key_makePrcKey.obj') - TargetAdd('make-prc-key.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('make-prc-key.exe', input=COMMON_DTOOL_LIBS) TargetAdd('make-prc-key.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) # @@ -3339,7 +3397,7 @@ if (not RTDIST and not RUNTIME): TargetAdd('test_interrogate_test_interrogate.obj', opts=OPTS, input='test_interrogate.cxx') TargetAdd('test_interrogate.exe', input='test_interrogate_test_interrogate.obj') TargetAdd('test_interrogate.exe', input='libp3interrogatedb.dll') - TargetAdd('test_interrogate.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('test_interrogate.exe', input=COMMON_DTOOL_LIBS) TargetAdd('test_interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) # @@ -3357,7 +3415,7 @@ OPTS=['DIR:panda/src/express', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB'] TargetAdd('p3express_composite1.obj', opts=OPTS, input='p3express_composite1.cxx') TargetAdd('p3express_composite2.obj', opts=OPTS, input='p3express_composite2.cxx') -OPTS=['DIR:panda/src/express', 'OPENSSL', 'ZLIB'] +OPTS=['DIR:panda/src/express', 'OPENSSL', 'ZLIB', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/express', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3express.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3express.in', opts=['IMOD:panda3d.core', 'ILIB:libp3express', 'SRCDIR:panda/src/express']) @@ -3372,7 +3430,7 @@ OPTS=['DIR:panda/src/downloader', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB'] TargetAdd('p3downloader_composite1.obj', opts=OPTS, input='p3downloader_composite1.cxx') TargetAdd('p3downloader_composite2.obj', opts=OPTS, input='p3downloader_composite2.cxx') -OPTS=['DIR:panda/src/downloader', 'OPENSSL', 'ZLIB'] +OPTS=['DIR:panda/src/downloader', 'OPENSSL', 'ZLIB', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/downloader', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3downloader.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3downloader.in', opts=['IMOD:panda3d.core', 'ILIB:libp3downloader', 'SRCDIR:panda/src/downloader']) @@ -3404,11 +3462,12 @@ if (not RUNTIME): TargetAdd('p3pipeline_composite2.obj', opts=OPTS, input='p3pipeline_composite2.cxx') TargetAdd('p3pipeline_contextSwitch.obj', opts=OPTS, input='contextSwitch.c') - OPTS=['DIR:panda/src/pipeline'] + OPTS=['DIR:panda/src/pipeline', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pipeline', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pipeline.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pipeline.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pipeline', 'SRCDIR:panda/src/pipeline']) TargetAdd('libp3pipeline_igate.obj', input='libp3pipeline.in', opts=["DEPENDENCYONLY"]) + TargetAdd('p3pipeline_pythonThread.obj', opts=OPTS, input='pythonThread.cxx') # # DIRECTORY: panda/src/linmath/ @@ -3419,7 +3478,7 @@ if (not RUNTIME): TargetAdd('p3linmath_composite1.obj', opts=OPTS, input='p3linmath_composite1.cxx') TargetAdd('p3linmath_composite2.obj', opts=OPTS, input='p3linmath_composite2.cxx') - OPTS=['DIR:panda/src/linmath'] + OPTS=['DIR:panda/src/linmath', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/linmath', ["*.h", "*_composite*.cxx"]) for ifile in IGATEFILES[:]: if "_src." in ifile: @@ -3440,7 +3499,7 @@ if (not RUNTIME): TargetAdd('p3putil_composite1.obj', opts=OPTS, input='p3putil_composite1.cxx') TargetAdd('p3putil_composite2.obj', opts=OPTS, input='p3putil_composite2.cxx') - OPTS=['DIR:panda/src/putil', 'ZLIB'] + OPTS=['DIR:panda/src/putil', 'ZLIB', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/putil', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("test_bam.h") TargetAdd('libp3putil.in', opts=OPTS, input=IGATEFILES) @@ -3456,7 +3515,7 @@ if (not RUNTIME): OPTS=['DIR:panda/src/audio', 'BUILDING:PANDA'] TargetAdd('p3audio_composite1.obj', opts=OPTS, input='p3audio_composite1.cxx') - OPTS=['DIR:panda/src/audio'] + OPTS=['DIR:panda/src/audio', 'PYTHON'] IGATEFILES=["audio.h"] TargetAdd('libp3audio.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3audio.in', opts=['IMOD:panda3d.core', 'ILIB:libp3audio', 'SRCDIR:panda/src/audio']) @@ -3471,7 +3530,7 @@ if (not RUNTIME): TargetAdd('p3event_composite1.obj', opts=OPTS, input='p3event_composite1.cxx') TargetAdd('p3event_composite2.obj', opts=OPTS, input='p3event_composite2.cxx') - OPTS=['DIR:panda/src/event'] + OPTS=['DIR:panda/src/event', 'PYTHON'] TargetAdd('p3event_pythonTask.obj', opts=OPTS, input='pythonTask.cxx') IGATEFILES=GetDirectoryContents('panda/src/event', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3event.in', opts=OPTS, input=IGATEFILES) @@ -3487,7 +3546,7 @@ if (not RUNTIME): TargetAdd('p3mathutil_composite1.obj', opts=OPTS, input='p3mathutil_composite1.cxx') TargetAdd('p3mathutil_composite2.obj', opts=OPTS, input='p3mathutil_composite2.cxx') - OPTS=['DIR:panda/src/mathutil', 'FFTW'] + OPTS=['DIR:panda/src/mathutil', 'FFTW', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/mathutil', ["*.h", "*_composite*.cxx"]) for ifile in IGATEFILES[:]: if "_src." in ifile: @@ -3504,7 +3563,7 @@ if (not RUNTIME): OPTS=['DIR:panda/src/gsgbase', 'BUILDING:PANDA'] TargetAdd('p3gsgbase_composite1.obj', opts=OPTS, input='p3gsgbase_composite1.cxx') - OPTS=['DIR:panda/src/gsgbase'] + OPTS=['DIR:panda/src/gsgbase', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/gsgbase', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3gsgbase.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3gsgbase.in', opts=['IMOD:panda3d.core', 'ILIB:libp3gsgbase', 'SRCDIR:panda/src/gsgbase']) @@ -3520,7 +3579,7 @@ if (not RUNTIME): TargetAdd('p3pnmimage_composite2.obj', opts=OPTS, input='p3pnmimage_composite2.cxx') TargetAdd('p3pnmimage_convert_srgb_sse2.obj', opts=OPTS+['SSE2'], input='convert_srgb_sse2.cxx') - OPTS=['DIR:panda/src/pnmimage', 'ZLIB'] + OPTS=['DIR:panda/src/pnmimage', 'ZLIB', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pnmimage', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pnmimage.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pnmimage.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmimage', 'SRCDIR:panda/src/pnmimage']) @@ -3535,7 +3594,7 @@ if (not RUNTIME): OPTS=['DIR:panda/src/nativenet', 'OPENSSL', 'BUILDING:PANDA'] TargetAdd('p3nativenet_composite1.obj', opts=OPTS, input='p3nativenet_composite1.cxx') - OPTS=['DIR:panda/src/nativenet', 'OPENSSL'] + OPTS=['DIR:panda/src/nativenet', 'OPENSSL', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/nativenet', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3nativenet.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3nativenet.in', opts=['IMOD:panda3d.core', 'ILIB:libp3nativenet', 'SRCDIR:panda/src/nativenet']) @@ -3550,7 +3609,7 @@ if (not RUNTIME): TargetAdd('p3net_composite1.obj', opts=OPTS, input='p3net_composite1.cxx') TargetAdd('p3net_composite2.obj', opts=OPTS, input='p3net_composite2.cxx') - OPTS=['DIR:panda/src/net'] + OPTS=['DIR:panda/src/net', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/net', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("datagram_ui.h") TargetAdd('libp3net.in', opts=OPTS, input=IGATEFILES) @@ -3566,7 +3625,7 @@ if (not RUNTIME): TargetAdd('p3pstatclient_composite1.obj', opts=OPTS, input='p3pstatclient_composite1.cxx') TargetAdd('p3pstatclient_composite2.obj', opts=OPTS, input='p3pstatclient_composite2.cxx') - OPTS=['DIR:panda/src/pstatclient'] + OPTS=['DIR:panda/src/pstatclient', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pstatclient', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pstatclient.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pstatclient.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pstatclient', 'SRCDIR:panda/src/pstatclient']) @@ -3581,7 +3640,7 @@ if (not RUNTIME): TargetAdd('p3gobj_composite1.obj', opts=OPTS, input='p3gobj_composite1.cxx') TargetAdd('p3gobj_composite2.obj', opts=OPTS, input='p3gobj_composite2.cxx') - OPTS=['DIR:panda/src/gobj', 'NVIDIACG', 'ZLIB', 'SQUISH'] + OPTS=['DIR:panda/src/gobj', 'NVIDIACG', 'ZLIB', 'SQUISH', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/gobj', ["*.h", "*_composite*.cxx"]) if ("cgfx_states.h" in IGATEFILES): IGATEFILES.remove("cgfx_states.h") TargetAdd('libp3gobj.in', opts=OPTS, input=IGATEFILES) @@ -3598,7 +3657,7 @@ if (not RUNTIME): TargetAdd('p3pgraphnodes_composite1.obj', opts=OPTS, input='p3pgraphnodes_composite1.cxx') TargetAdd('p3pgraphnodes_composite2.obj', opts=OPTS, input='p3pgraphnodes_composite2.cxx') - OPTS=['DIR:panda/src/pgraphnodes'] + OPTS=['DIR:panda/src/pgraphnodes', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pgraphnodes', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pgraphnodes.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pgraphnodes.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraphnodes', 'SRCDIR:panda/src/pgraphnodes']) @@ -3616,7 +3675,7 @@ if (not RUNTIME): TargetAdd('p3pgraph_composite3.obj', opts=OPTS, input='p3pgraph_composite3.cxx') TargetAdd('p3pgraph_composite4.obj', opts=OPTS, input='p3pgraph_composite4.cxx') - OPTS=['DIR:panda/src/pgraph'] + OPTS=['DIR:panda/src/pgraph', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pgraph', ["*.h", "nodePath.cxx", "*_composite*.cxx"]) TargetAdd('libp3pgraph.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraph', 'SRCDIR:panda/src/pgraph']) @@ -3632,7 +3691,7 @@ if (not RUNTIME): TargetAdd('p3cull_composite1.obj', opts=OPTS, input='p3cull_composite1.cxx') TargetAdd('p3cull_composite2.obj', opts=OPTS, input='p3cull_composite2.cxx') - OPTS=['DIR:panda/src/cull'] + OPTS=['DIR:panda/src/cull', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/cull', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3cull.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3cull.in', opts=['IMOD:panda3d.core', 'ILIB:libp3cull', 'SRCDIR:panda/src/cull']) @@ -3647,7 +3706,7 @@ if (not RUNTIME): TargetAdd('p3chan_composite1.obj', opts=OPTS, input='p3chan_composite1.cxx') TargetAdd('p3chan_composite2.obj', opts=OPTS, input='p3chan_composite2.cxx') - OPTS=['DIR:panda/src/chan'] + OPTS=['DIR:panda/src/chan', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/chan', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove('movingPart.h') IGATEFILES.remove('animChannelFixed.h') @@ -3664,7 +3723,7 @@ if (not RUNTIME): TargetAdd('p3char_composite1.obj', opts=OPTS, input='p3char_composite1.cxx') TargetAdd('p3char_composite2.obj', opts=OPTS, input='p3char_composite2.cxx') - OPTS=['DIR:panda/src/char'] + OPTS=['DIR:panda/src/char', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/char', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3char.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3char.in', opts=['IMOD:panda3d.core', 'ILIB:libp3char', 'SRCDIR:panda/src/char']) @@ -3679,7 +3738,7 @@ if (not RUNTIME): TargetAdd('p3dgraph_composite1.obj', opts=OPTS, input='p3dgraph_composite1.cxx') TargetAdd('p3dgraph_composite2.obj', opts=OPTS, input='p3dgraph_composite2.cxx') - OPTS=['DIR:panda/src/dgraph'] + OPTS=['DIR:panda/src/dgraph', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/dgraph', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3dgraph.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3dgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dgraph', 'SRCDIR:panda/src/dgraph']) @@ -3694,7 +3753,7 @@ if (not RUNTIME): TargetAdd('p3display_composite1.obj', opts=OPTS, input='p3display_composite1.cxx') TargetAdd('p3display_composite2.obj', opts=OPTS, input='p3display_composite2.cxx') - OPTS=['DIR:panda/src/display'] + OPTS=['DIR:panda/src/display', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/display', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("renderBuffer.h") TargetAdd('libp3display.in', opts=OPTS, input=IGATEFILES) @@ -3718,7 +3777,7 @@ if (not RUNTIME): TargetAdd('p3device_composite1.obj', opts=OPTS, input='p3device_composite1.cxx') TargetAdd('p3device_composite2.obj', opts=OPTS, input='p3device_composite2.cxx') - OPTS=['DIR:panda/src/device'] + OPTS=['DIR:panda/src/device', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/device', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3device.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3device.in', opts=['IMOD:panda3d.core', 'ILIB:libp3device', 'SRCDIR:panda/src/device']) @@ -3732,7 +3791,7 @@ if (PkgSkip("FREETYPE")==0 and not RUNTIME): OPTS=['DIR:panda/src/pnmtext', 'BUILDING:PANDA', 'FREETYPE'] TargetAdd('p3pnmtext_composite1.obj', opts=OPTS, input='p3pnmtext_composite1.cxx') - OPTS=['DIR:panda/src/pnmtext', 'FREETYPE'] + OPTS=['DIR:panda/src/pnmtext', 'FREETYPE', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pnmtext', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pnmtext.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pnmtext.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmtext', 'SRCDIR:panda/src/pnmtext']) @@ -3747,7 +3806,7 @@ if (not RUNTIME): TargetAdd('p3text_composite1.obj', opts=OPTS, input='p3text_composite1.cxx') TargetAdd('p3text_composite2.obj', opts=OPTS, input='p3text_composite2.cxx') - OPTS=['DIR:panda/src/text', 'ZLIB', 'FREETYPE'] + OPTS=['DIR:panda/src/text', 'ZLIB', 'FREETYPE', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/text', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3text.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3text.in', opts=['IMOD:panda3d.core', 'ILIB:libp3text', 'SRCDIR:panda/src/text']) @@ -3761,7 +3820,7 @@ if (not RUNTIME): OPTS=['DIR:panda/src/movies', 'BUILDING:PANDA', 'VORBIS'] TargetAdd('p3movies_composite1.obj', opts=OPTS, input='p3movies_composite1.cxx') - OPTS=['DIR:panda/src/movies', 'VORBIS'] + OPTS=['DIR:panda/src/movies', 'VORBIS', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/movies', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3movies.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3movies.in', opts=['IMOD:panda3d.core', 'ILIB:libp3movies', 'SRCDIR:panda/src/movies']) @@ -3777,7 +3836,7 @@ if (not RUNTIME): TargetAdd('p3grutil_composite1.obj', opts=OPTS, input='p3grutil_composite1.cxx') TargetAdd('p3grutil_composite2.obj', opts=OPTS, input='p3grutil_composite2.cxx') - OPTS=['DIR:panda/src/grutil'] + OPTS=['DIR:panda/src/grutil', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/grutil', ["*.h", "*_composite*.cxx"]) if 'convexHull.h' in IGATEFILES: IGATEFILES.remove('convexHull.h') TargetAdd('libp3grutil.in', opts=OPTS, input=IGATEFILES) @@ -3793,7 +3852,7 @@ if (not RUNTIME): TargetAdd('p3tform_composite1.obj', opts=OPTS, input='p3tform_composite1.cxx') TargetAdd('p3tform_composite2.obj', opts=OPTS, input='p3tform_composite2.cxx') - OPTS=['DIR:panda/src/tform'] + OPTS=['DIR:panda/src/tform', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/tform', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3tform.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3tform.in', opts=['IMOD:panda3d.core', 'ILIB:libp3tform', 'SRCDIR:panda/src/tform']) @@ -3808,7 +3867,7 @@ if (not RUNTIME): TargetAdd('p3collide_composite1.obj', opts=OPTS, input='p3collide_composite1.cxx') TargetAdd('p3collide_composite2.obj', opts=OPTS, input='p3collide_composite2.cxx') - OPTS=['DIR:panda/src/collide'] + OPTS=['DIR:panda/src/collide', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/collide', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3collide.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3collide.in', opts=['IMOD:panda3d.core', 'ILIB:libp3collide', 'SRCDIR:panda/src/collide']) @@ -3823,7 +3882,7 @@ if (not RUNTIME): TargetAdd('p3parametrics_composite1.obj', opts=OPTS, input='p3parametrics_composite1.cxx') TargetAdd('p3parametrics_composite2.obj', opts=OPTS, input='p3parametrics_composite2.cxx') - OPTS=['DIR:panda/src/parametrics'] + OPTS=['DIR:panda/src/parametrics', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/parametrics', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3parametrics.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3parametrics.in', opts=['IMOD:panda3d.core', 'ILIB:libp3parametrics', 'SRCDIR:panda/src/parametrics']) @@ -3838,7 +3897,7 @@ if (not RUNTIME): TargetAdd('p3pgui_composite1.obj', opts=OPTS, input='p3pgui_composite1.cxx') TargetAdd('p3pgui_composite2.obj', opts=OPTS, input='p3pgui_composite2.cxx') - OPTS=['DIR:panda/src/pgui'] + OPTS=['DIR:panda/src/pgui', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/pgui', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pgui.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pgui.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgui', 'SRCDIR:panda/src/pgui']) @@ -3862,7 +3921,7 @@ if (not RUNTIME): TargetAdd('p3recorder_composite1.obj', opts=OPTS, input='p3recorder_composite1.cxx') TargetAdd('p3recorder_composite2.obj', opts=OPTS, input='p3recorder_composite2.cxx') - OPTS=['DIR:panda/src/recorder'] + OPTS=['DIR:panda/src/recorder', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/recorder', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3recorder.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3recorder.in', opts=['IMOD:panda3d.core', 'ILIB:libp3recorder', 'SRCDIR:panda/src/recorder']) @@ -3882,7 +3941,7 @@ if (not RUNTIME): OPTS=['DIR:panda/src/dxml', 'BUILDING:PANDA', 'TINYXML'] TargetAdd('p3dxml_composite1.obj', opts=OPTS, input='p3dxml_composite1.cxx') - OPTS=['DIR:panda/src/dxml', 'TINYXML'] + OPTS=['DIR:panda/src/dxml', 'TINYXML', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/dxml', ["*.h", "p3dxml_composite1.cxx"]) TargetAdd('libp3dxml.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3dxml.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dxml', 'SRCDIR:panda/src/dxml']) @@ -4008,6 +4067,7 @@ if (not RUNTIME): if PkgSkip("FREETYPE")==0: TargetAdd('core_module.obj', input='libp3pnmtext.in') + TargetAdd('core_module.obj', opts=['PYTHON']) TargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core']) TargetAdd('core.pyd', input='libp3downloader_igate.obj') @@ -4047,6 +4107,7 @@ if (not RUNTIME): if PkgSkip("FREETYPE")==0: TargetAdd('core.pyd', input="libp3pnmtext_igate.obj") + TargetAdd('core.pyd', input='p3pipeline_pythonThread.obj') TargetAdd('core.pyd', input='p3putil_ext_composite.obj') TargetAdd('core.pyd', input='p3pnmimage_pfmFile_ext.obj') TargetAdd('core.pyd', input='p3event_pythonTask.obj') @@ -4075,7 +4136,7 @@ if (PkgSkip("VISION") == 0) and (not RUNTIME): TargetAdd('libp3vision.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3vision.dll', opts=OPTS) - OPTS=['DIR:panda/src/vision', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS'] + OPTS=['DIR:panda/src/vision', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/vision', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3vision.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3vision.in', opts=['IMOD:panda3d.vision', 'ILIB:libp3vision', 'SRCDIR:panda/src/vision']) @@ -4097,14 +4158,14 @@ if (PkgSkip("VISION") == 0) and (not RUNTIME): # if (PkgSkip("ROCKET") == 0) and (not RUNTIME): - OPTS=['DIR:panda/src/rocket', 'BUILDING:ROCKET', 'ROCKET'] + OPTS=['DIR:panda/src/rocket', 'BUILDING:ROCKET', 'ROCKET', 'PYTHON'] TargetAdd('p3rocket_composite1.obj', opts=OPTS, input='p3rocket_composite1.cxx') TargetAdd('libp3rocket.dll', input='p3rocket_composite1.obj') TargetAdd('libp3rocket.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3rocket.dll', opts=OPTS) - OPTS=['DIR:panda/src/rocket', 'ROCKET', 'RTTI', 'EXCEPTIONS'] + OPTS=['DIR:panda/src/rocket', 'ROCKET', 'RTTI', 'EXCEPTIONS', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/rocket', ["rocketInputHandler.h", "rocketInputHandler.cxx", "rocketRegion.h", "rocketRegion.cxx", "rocketRegion_ext.h"]) TargetAdd('libp3rocket.in', opts=OPTS, input=IGATEFILES) @@ -4134,7 +4195,7 @@ if PkgSkip("AWESOMIUM") == 0 and not RUNTIME: TargetAdd('libp3awesomium.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3awesomium.dll', opts=OPTS) - OPTS=['DIR:panda/src/awesomium', 'AWESOMIUM'] + OPTS=['DIR:panda/src/awesomium', 'AWESOMIUM', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/awesomium', ["*.h", "*_composite1.cxx"]) TargetAdd('libp3awesomium.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3awesomium.in', opts=['IMOD:panda3d.awesomium', 'ILIB:libp3awesomium', 'SRCDIR:panda/src/awesomium']) @@ -4159,7 +4220,7 @@ if (PkgSkip('SKEL')==0) and (not RUNTIME): OPTS=['DIR:panda/src/skel', 'BUILDING:PANDASKEL', 'ADVAPI'] TargetAdd('p3skel_composite1.obj', opts=OPTS, input='p3skel_composite1.cxx') - OPTS=['DIR:panda/src/skel', 'ADVAPI'] + OPTS=['DIR:panda/src/skel', 'ADVAPI', 'PYTHON'] IGATEFILES=GetDirectoryContents("panda/src/skel", ["*.h", "*_composite*.cxx"]) TargetAdd('libp3skel.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3skel.in', opts=['IMOD:panda3d.skel', 'ILIB:libp3skel', 'SRCDIR:panda/src/skel']) @@ -4175,7 +4236,9 @@ if (PkgSkip('SKEL')==0) and (not RUNTIME): TargetAdd('libpandaskel.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandaskel.dll', opts=OPTS) + OPTS=['PYTHON'] TargetAdd('skel_module.obj', input='libp3skel.in') + TargetAdd('skel_module.obj', opts=OPTS) TargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d.core']) TargetAdd('skel.pyd', input='skel_module.obj') @@ -4193,7 +4256,7 @@ if (PkgSkip('PANDAFX')==0) and (not RUNTIME): OPTS=['DIR:panda/src/distort', 'BUILDING:PANDAFX'] TargetAdd('p3distort_composite1.obj', opts=OPTS, input='p3distort_composite1.cxx') - OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG'] + OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/distort', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3distort.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3distort.in', opts=['IMOD:panda3d.fx', 'ILIB:libp3distort', 'SRCDIR:panda/src/distort']) @@ -4212,7 +4275,7 @@ if (PkgSkip('PANDAFX')==0) and (not RUNTIME): TargetAdd('libpandafx.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandafx.dll', opts=['ADVAPI', 'NVIDIACG']) - OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG'] + OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG', 'PYTHON'] TargetAdd('fx_module.obj', input='libp3distort.in') TargetAdd('fx_module.obj', opts=OPTS) TargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d.core']) @@ -4235,7 +4298,7 @@ if (PkgSkip("VRPN")==0 and not RUNTIME): TargetAdd('libp3vrpn.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3vrpn.dll', opts=['VRPN']) - OPTS=['DIR:panda/src/vrpn', 'VRPN'] + OPTS=['DIR:panda/src/vrpn', 'VRPN', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/vrpn', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3vrpn.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3vrpn.in', opts=['IMOD:panda3d.vrpn', 'ILIB:libp3vrpn', 'SRCDIR:panda/src/vrpn']) @@ -4289,43 +4352,43 @@ if (PkgSkip("OPENSSL")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOL TargetAdd('apply_patch_apply_patch.obj', opts=OPTS, input='apply_patch.cxx') TargetAdd('apply_patch.exe', input=['apply_patch_apply_patch.obj']) - TargetAdd('apply_patch.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('apply_patch.exe', input=COMMON_PANDA_LIBS) TargetAdd('apply_patch.exe', opts=OPTS) TargetAdd('build_patch_build_patch.obj', opts=OPTS, input='build_patch.cxx') TargetAdd('build_patch.exe', input=['build_patch_build_patch.obj']) - TargetAdd('build_patch.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('build_patch.exe', input=COMMON_PANDA_LIBS) TargetAdd('build_patch.exe', opts=OPTS) if not PkgSkip("ZLIB"): TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx') TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj']) - TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS) TargetAdd('check_adler.exe', opts=OPTS) TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx') TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj']) - TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS) TargetAdd('check_crc.exe', opts=OPTS) TargetAdd('check_md5_check_md5.obj', opts=OPTS, input='check_md5.cxx') TargetAdd('check_md5.exe', input=['check_md5_check_md5.obj']) - TargetAdd('check_md5.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('check_md5.exe', input=COMMON_PANDA_LIBS) TargetAdd('check_md5.exe', opts=OPTS) TargetAdd('pdecrypt_pdecrypt.obj', opts=OPTS, input='pdecrypt.cxx') TargetAdd('pdecrypt.exe', input=['pdecrypt_pdecrypt.obj']) - TargetAdd('pdecrypt.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('pdecrypt.exe', input=COMMON_PANDA_LIBS) TargetAdd('pdecrypt.exe', opts=OPTS) TargetAdd('pencrypt_pencrypt.obj', opts=OPTS, input='pencrypt.cxx') TargetAdd('pencrypt.exe', input=['pencrypt_pencrypt.obj']) - TargetAdd('pencrypt.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('pencrypt.exe', input=COMMON_PANDA_LIBS) TargetAdd('pencrypt.exe', opts=OPTS) TargetAdd('show_ddb_show_ddb.obj', opts=OPTS, input='show_ddb.cxx') TargetAdd('show_ddb.exe', input=['show_ddb_show_ddb.obj']) - TargetAdd('show_ddb.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('show_ddb.exe', input=COMMON_PANDA_LIBS) TargetAdd('show_ddb.exe', opts=OPTS) # @@ -4337,17 +4400,17 @@ if (PkgSkip("ZLIB")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOLS") TargetAdd('multify_multify.obj', opts=OPTS, input='multify.cxx') TargetAdd('multify.exe', input=['multify_multify.obj']) - TargetAdd('multify.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('multify.exe', input=COMMON_PANDA_LIBS) TargetAdd('multify.exe', opts=OPTS) TargetAdd('pzip_pzip.obj', opts=OPTS, input='pzip.cxx') TargetAdd('pzip.exe', input=['pzip_pzip.obj']) - TargetAdd('pzip.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('pzip.exe', input=COMMON_PANDA_LIBS) TargetAdd('pzip.exe', opts=OPTS) TargetAdd('punzip_punzip.obj', opts=OPTS, input='punzip.cxx') TargetAdd('punzip.exe', input=['punzip_punzip.obj']) - TargetAdd('punzip.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('punzip.exe', input=COMMON_PANDA_LIBS) TargetAdd('punzip.exe', opts=OPTS) # @@ -4393,7 +4456,7 @@ if (not RUNTIME): TargetAdd('p3egg_composite1.obj', opts=OPTS, input='p3egg_composite1.cxx') TargetAdd('p3egg_composite2.obj', opts=OPTS, input='p3egg_composite2.cxx') - OPTS=['DIR:panda/src/egg', 'ZLIB'] + OPTS=['DIR:panda/src/egg', 'ZLIB', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/egg', ["*.h", "*_composite*.cxx"]) if "parser.h" in IGATEFILES: IGATEFILES.remove("parser.h") TargetAdd('libp3egg.in', opts=OPTS, input=IGATEFILES) @@ -4410,7 +4473,7 @@ if (not RUNTIME): TargetAdd('p3egg2pg_composite1.obj', opts=OPTS, input='p3egg2pg_composite1.cxx') TargetAdd('p3egg2pg_composite2.obj', opts=OPTS, input='p3egg2pg_composite2.cxx') - OPTS=['DIR:panda/src/egg2pg'] + OPTS=['DIR:panda/src/egg2pg', 'PYTHON'] IGATEFILES=['load_egg_file.h'] TargetAdd('libp3egg2pg.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3egg2pg.in', opts=['IMOD:panda3d.egg', 'ILIB:libp3egg2pg', 'SRCDIR:panda/src/egg2pg']) @@ -4421,8 +4484,17 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/framework', 'BUILDING:FRAMEWORK'] - TargetAdd('p3framework_composite1.obj', opts=OPTS, input='p3framework_composite1.cxx') + deps = [] + # Framework wants to link in a renderer when building statically, so tell it what is available. + if GetLinkAllStatic(): + deps = ['dtool_have_gl.dat', 'dtool_have_tinydisplay.dat'] + if not PkgSkip("GL"): + DefSymbol("FRAMEWORK", "HAVE_GL") + if not PkgSkip("TINYDISPLAY"): + DefSymbol("FRAMEWORK", "HAVE_TINYDISPLAY") + + OPTS=['DIR:panda/src/framework', 'BUILDING:FRAMEWORK', 'FRAMEWORK'] + TargetAdd('p3framework_composite1.obj', opts=OPTS, input='p3framework_composite1.cxx', dep=deps) TargetAdd('libp3framework.dll', input='p3framework_composite1.obj') TargetAdd('libp3framework.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3framework.dll', opts=['ADVAPI']) @@ -4472,7 +4544,7 @@ if (not RUNTIME): TargetAdd('libpandaegg.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandaegg.dll', opts=['ADVAPI']) - OPTS=['DIR:panda/metalibs/pandaegg', 'DIR:panda/src/egg'] + OPTS=['DIR:panda/metalibs/pandaegg', 'DIR:panda/src/egg', 'PYTHON'] TargetAdd('egg_module.obj', input='libp3egg2pg.in') TargetAdd('egg_module.obj', input='libp3egg.in') TargetAdd('egg_module.obj', opts=OPTS) @@ -4609,12 +4681,12 @@ if (PkgSkip("EGL")==0 and PkgSkip("GLES2")==0 and PkgSkip("X11")==0 and not RUNT # DIRECTORY: panda/src/ode/ # if (PkgSkip("ODE")==0 and not RUNTIME): - OPTS=['DIR:panda/src/ode', 'BUILDING:PANDAODE', 'ODE'] + OPTS=['DIR:panda/src/ode', 'BUILDING:PANDAODE', 'ODE', 'PYTHON'] TargetAdd('p3ode_composite1.obj', opts=OPTS, input='p3ode_composite1.cxx') TargetAdd('p3ode_composite2.obj', opts=OPTS, input='p3ode_composite2.cxx') TargetAdd('p3ode_composite3.obj', opts=OPTS, input='p3ode_composite3.cxx') - OPTS=['DIR:panda/src/ode', 'ODE'] + OPTS=['DIR:panda/src/ode', 'ODE', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/ode', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("odeConvexGeom.h") IGATEFILES.remove("odeHeightFieldGeom.h") @@ -4638,7 +4710,7 @@ if (PkgSkip("ODE")==0 and not RUNTIME): TargetAdd('libpandaode.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandaode.dll', opts=['WINUSER', 'ODE']) - OPTS=['DIR:panda/metalibs/pandaode', 'ODE'] + OPTS=['DIR:panda/metalibs/pandaode', 'ODE', 'PYTHON'] TargetAdd('ode_module.obj', input='libpandaode.in') TargetAdd('ode_module.obj', opts=OPTS) TargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d.core']) @@ -4658,7 +4730,7 @@ if (PkgSkip("BULLET")==0 and not RUNTIME): OPTS=['DIR:panda/src/bullet', 'BUILDING:PANDABULLET', 'BULLET'] TargetAdd('p3bullet_composite.obj', opts=OPTS, input='p3bullet_composite.cxx') - OPTS=['DIR:panda/src/bullet', 'BULLET'] + OPTS=['DIR:panda/src/bullet', 'BULLET', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/bullet', ["*.h", "*_composite*.cxx"]) TargetAdd('libpandabullet.in', opts=OPTS, input=IGATEFILES) TargetAdd('libpandabullet.in', opts=['IMOD:panda3d.bullet', 'ILIB:libpandabullet', 'SRCDIR:panda/src/bullet']) @@ -4676,7 +4748,7 @@ if (PkgSkip("BULLET")==0 and not RUNTIME): TargetAdd('libpandabullet.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandabullet.dll', opts=['WINUSER', 'BULLET']) - OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET'] + OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET', 'PYTHON'] TargetAdd('bullet_module.obj', input='libpandabullet.in') TargetAdd('bullet_module.obj', opts=OPTS) TargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d.core']) @@ -4696,7 +4768,7 @@ if (PkgSkip("PHYSX")==0): OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC'] TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx') - OPTS=['DIR:panda/src/physx', 'PHYSX', 'NOARCH:PPC'] + OPTS=['DIR:panda/src/physx', 'PHYSX', 'NOARCH:PPC', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"]) TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES) TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx']) @@ -4715,7 +4787,7 @@ if (PkgSkip("PHYSX")==0): TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'NOARCH:PPC']) - OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC'] + OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC', 'PYTHON'] TargetAdd('physx_module.obj', input='libpandaphysx.in') TargetAdd('physx_module.obj', opts=OPTS) TargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core']) @@ -4736,7 +4808,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME): TargetAdd('p3physics_composite1.obj', opts=OPTS, input='p3physics_composite1.cxx') TargetAdd('p3physics_composite2.obj', opts=OPTS, input='p3physics_composite2.cxx') - OPTS=['DIR:panda/src/physics'] + OPTS=['DIR:panda/src/physics', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/physics', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("forces.h") TargetAdd('libp3physics.in', opts=OPTS, input=IGATEFILES) @@ -4752,7 +4824,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (PkgSkip("PANDAPARTICLESYSTEM")==0) and (not TargetAdd('p3particlesystem_composite1.obj', opts=OPTS, input='p3particlesystem_composite1.cxx') TargetAdd('p3particlesystem_composite2.obj', opts=OPTS, input='p3particlesystem_composite2.cxx') - OPTS=['DIR:panda/src/particlesystem'] + OPTS=['DIR:panda/src/particlesystem', 'PYTHON'] IGATEFILES=GetDirectoryContents('panda/src/particlesystem', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove('orientedParticle.h') IGATEFILES.remove('orientedParticleFactory.h') @@ -4779,7 +4851,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME): TargetAdd('libpandaphysics.dll', input=COMMON_PANDA_LIBS) TargetAdd('libpandaphysics.dll', opts=['ADVAPI']) - OPTS=['DIR:panda/metalibs/pandaphysics'] + OPTS=['DIR:panda/metalibs/pandaphysics', 'PYTHON'] TargetAdd('physics_module.obj', input='libp3physics.in') if (PkgSkip("PANDAPARTICLESYSTEM")==0): TargetAdd('physics_module.obj', input='libp3particlesystem.in') @@ -4800,7 +4872,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME): # if (PkgSkip("SPEEDTREE")==0): - OPTS=['DIR:panda/src/speedtree', 'BUILDING:PANDASPEEDTREE', 'SPEEDTREE'] + OPTS=['DIR:panda/src/speedtree', 'BUILDING:PANDASPEEDTREE', 'SPEEDTREE', 'PYTHON'] TargetAdd('pandaspeedtree_composite1.obj', opts=OPTS, input='pandaspeedtree_composite1.cxx') IGATEFILES=GetDirectoryContents('panda/src/speedtree', ["*.h", "*_composite*.cxx"]) TargetAdd('libpandaspeedtree.in', opts=OPTS, input=IGATEFILES) @@ -4829,7 +4901,7 @@ if (not RTDIST and not RUNTIME and PkgSkip("PVIEW")==0 and GetTarget() != 'andro TargetAdd('pview.exe', input='pview_pview.obj') TargetAdd('pview.exe', input='libp3framework.dll') TargetAdd('pview.exe', input='libpandaegg.dll') - TargetAdd('pview.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('pview.exe', input=COMMON_PANDA_LIBS) TargetAdd('pview.exe', opts=['ADVAPI', 'WINSOCK2', 'WINSHELL']) # @@ -4856,7 +4928,7 @@ if (not RUNTIME and GetTarget() == 'android'): TargetAdd('pview.exe', input='libp3framework.dll') TargetAdd('pview.exe', input='libpandaegg.dll') TargetAdd('pview.exe', input='libp3android.dll') - TargetAdd('pview.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('pview.exe', input=COMMON_PANDA_LIBS) TargetAdd('AndroidManifest.xml', opts=OPTS, input='pview_manifest.xml') # @@ -4933,7 +5005,7 @@ if (PkgSkip("DIRECT")==0): # if (PkgSkip("DIRECT")==0): - OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA', 'BUILDING:DIRECT', 'BISONPREFIX_dcyy'] + OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA', 'BISONPREFIX_dcyy', 'PYTHON'] CreateFile(GetOutputDir()+"/include/dcParser.h") TargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx') TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY']) @@ -4941,7 +5013,7 @@ if (PkgSkip("DIRECT")==0): TargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx') TargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx') - OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA'] + OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA', 'PYTHON'] IGATEFILES=GetDirectoryContents('direct/src/dcparser', ["*.h", "*_composite*.cxx"]) if "dcParser.h" in IGATEFILES: IGATEFILES.remove("dcParser.h") if "dcmsgtypes.h" in IGATEFILES: IGATEFILES.remove('dcmsgtypes.h') @@ -4957,7 +5029,7 @@ if (PkgSkip("DIRECT")==0): OPTS=['DIR:direct/src/deadrec', 'BUILDING:DIRECT'] TargetAdd('p3deadrec_composite1.obj', opts=OPTS, input='p3deadrec_composite1.cxx') - OPTS=['DIR:direct/src/deadrec'] + OPTS=['DIR:direct/src/deadrec', 'PYTHON'] IGATEFILES=GetDirectoryContents('direct/src/deadrec', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3deadrec.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3deadrec.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3deadrec', 'SRCDIR:direct/src/deadrec']) @@ -4968,12 +5040,12 @@ if (PkgSkip("DIRECT")==0): # if (PkgSkip("DIRECT")==0): - OPTS=['DIR:direct/src/distributed', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'BUILDING:DIRECT', 'OPENSSL'] + OPTS=['DIR:direct/src/distributed', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'BUILDING:DIRECT', 'OPENSSL', 'PYTHON'] TargetAdd('p3distributed_config_distributed.obj', opts=OPTS, input='config_distributed.cxx') TargetAdd('p3distributed_cConnectionRepository.obj', opts=OPTS, input='cConnectionRepository.cxx') TargetAdd('p3distributed_cDistributedSmoothNodeBase.obj', opts=OPTS, input='cDistributedSmoothNodeBase.cxx') - OPTS=['DIR:direct/src/distributed', 'WITHINPANDA', 'OPENSSL'] + OPTS=['DIR:direct/src/distributed', 'WITHINPANDA', 'OPENSSL', 'PYTHON'] IGATEFILES=GetDirectoryContents('direct/src/distributed', ["*.h", "*.cxx"]) TargetAdd('libp3distributed.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3distributed.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3distributed', 'SRCDIR:direct/src/distributed']) @@ -4987,7 +5059,7 @@ if (PkgSkip("DIRECT")==0): OPTS=['DIR:direct/src/interval', 'BUILDING:DIRECT'] TargetAdd('p3interval_composite1.obj', opts=OPTS, input='p3interval_composite1.cxx') - OPTS=['DIR:direct/src/interval'] + OPTS=['DIR:direct/src/interval', 'PYTHON'] IGATEFILES=GetDirectoryContents('direct/src/interval', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3interval.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3interval.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3interval', 'SRCDIR:direct/src/interval']) @@ -5003,7 +5075,7 @@ if (PkgSkip("DIRECT")==0): if GetTarget() == 'darwin': TargetAdd('p3showbase_showBase_assist.obj', opts=OPTS, input='showBase_assist.mm') - OPTS=['DIR:direct/src/showbase'] + OPTS=['DIR:direct/src/showbase', 'PYTHON'] IGATEFILES=GetDirectoryContents('direct/src/showbase', ["*.h", "showBase.cxx"]) TargetAdd('libp3showbase.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3showbase.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3showbase', 'SRCDIR:direct/src/showbase']) @@ -5018,7 +5090,7 @@ if (PkgSkip("DIRECT")==0): TargetAdd('p3motiontrail_cMotionTrail.obj', opts=OPTS, input='cMotionTrail.cxx') TargetAdd('p3motiontrail_config_motiontrail.obj', opts=OPTS, input='config_motiontrail.cxx') - OPTS=['DIR:direct/src/motiontrail'] + OPTS=['DIR:direct/src/motiontrail', 'PYTHON'] IGATEFILES=GetDirectoryContents('direct/src/motiontrail', ["*.h", "cMotionTrail.cxx"]) TargetAdd('libp3motiontrail.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3motiontrail.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3motiontrail', 'SRCDIR:direct/src/motiontrail']) @@ -5034,24 +5106,17 @@ if (PkgSkip("DIRECT")==0): TargetAdd('libp3direct.dll', input='p3direct_direct.obj') TargetAdd('libp3direct.dll', input='p3directbase_directbase.obj') - TargetAdd('libp3direct.dll', input='p3dcparser_composite1.obj') - TargetAdd('libp3direct.dll', input='p3dcparser_composite2.obj') - TargetAdd('libp3direct.dll', input='p3dcparser_dcParser.obj') - TargetAdd('libp3direct.dll', input='p3dcparser_dcLexer.obj') TargetAdd('libp3direct.dll', input='p3showbase_showBase.obj') if GetTarget() == 'darwin': TargetAdd('libp3direct.dll', input='p3showbase_showBase_assist.obj') TargetAdd('libp3direct.dll', input='p3deadrec_composite1.obj') TargetAdd('libp3direct.dll', input='p3interval_composite1.obj') - TargetAdd('libp3direct.dll', input='p3distributed_config_distributed.obj') - TargetAdd('libp3direct.dll', input='p3distributed_cConnectionRepository.obj') - TargetAdd('libp3direct.dll', input='p3distributed_cDistributedSmoothNodeBase.obj') TargetAdd('libp3direct.dll', input='p3motiontrail_config_motiontrail.obj') TargetAdd('libp3direct.dll', input='p3motiontrail_cMotionTrail.obj') TargetAdd('libp3direct.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3direct.dll', opts=['ADVAPI', 'OPENSSL', 'WINUSER', 'WINGDI']) - OPTS=['DIR:direct/metalibs/direct'] + OPTS=['DIR:direct/metalibs/direct', 'PYTHON'] TargetAdd('direct_module.obj', input='libp3dcparser.in') TargetAdd('direct_module.obj', input='libp3showbase.in') TargetAdd('direct_module.obj', input='libp3deadrec.in') @@ -5068,23 +5133,38 @@ if (PkgSkip("DIRECT")==0): TargetAdd('direct.pyd', input='libp3distributed_igate.obj') TargetAdd('direct.pyd', input='libp3motiontrail_igate.obj') + # These are part of direct.pyd, not libp3direct.dll, because they rely on + # the Python libraries. If a C++ user needs these modules, we can move them + # back and filter out the Python-specific code. + TargetAdd('direct.pyd', input='p3dcparser_composite1.obj') + TargetAdd('direct.pyd', input='p3dcparser_composite2.obj') + TargetAdd('direct.pyd', input='p3dcparser_dcParser.obj') + TargetAdd('direct.pyd', input='p3dcparser_dcLexer.obj') + TargetAdd('direct.pyd', input='p3distributed_config_distributed.obj') + TargetAdd('direct.pyd', input='p3distributed_cConnectionRepository.obj') + TargetAdd('direct.pyd', input='p3distributed_cDistributedSmoothNodeBase.obj') + TargetAdd('direct.pyd', input='direct_module.obj') TargetAdd('direct.pyd', input='libp3direct.dll') TargetAdd('direct.pyd', input='libp3interrogatedb.dll') TargetAdd('direct.pyd', input=COMMON_PANDA_LIBS) - TargetAdd('direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI']) + TargetAdd('direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI', 'WINSOCK2']) # # DIRECTORY: direct/src/dcparse/ # if (PkgSkip("PYTHON")==0 and PkgSkip("DIRECT")==0 and not RTDIST and not RUNTIME): - OPTS=['DIR:direct/src/dcparse', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'ADVAPI'] + OPTS=['DIR:direct/src/dcparse', 'DIR:direct/src/dcparser', 'WITHINPANDA', 'ADVAPI', 'PYTHON'] TargetAdd('dcparse_dcparse.obj', opts=OPTS, input='dcparse.cxx') + TargetAdd('p3dcparse.exe', input='p3dcparser_composite1.obj') + TargetAdd('p3dcparse.exe', input='p3dcparser_composite2.obj') + TargetAdd('p3dcparse.exe', input='p3dcparser_dcParser.obj') + TargetAdd('p3dcparse.exe', input='p3dcparser_dcLexer.obj') TargetAdd('p3dcparse.exe', input='dcparse_dcparse.obj') TargetAdd('p3dcparse.exe', input='libp3direct.dll') - TargetAdd('p3dcparse.exe', input=COMMON_PANDA_LIBS_PYSTUB) - TargetAdd('p3dcparse.exe', opts=['ADVAPI']) + TargetAdd('p3dcparse.exe', input=COMMON_PANDA_LIBS) + TargetAdd('p3dcparse.exe', opts=['ADVAPI', 'PYTHON']) # # DIRECTORY: direct/src/plugin/ @@ -5133,9 +5213,10 @@ if (RTDIST or RUNTIME): if (PkgSkip("PYTHON")==0 and RTDIST): # Freeze VFSImporter and its dependency modules into p3dpython. # Mark panda3d.core as a dependency to make sure to build that first. - TargetAdd('p3dpython_frozen.obj', input='VFSImporter.py', opts=['DIR:direct/src/showbase', 'FREEZE_STARTUP']) + TargetAdd('p3dpython_frozen.obj', input='VFSImporter.py', opts=['DIR:direct/src/showbase', 'FREEZE_STARTUP', 'PYTHON']) TargetAdd('p3dpython_frozen.obj', dep='core.pyd') + OPTS += ['PYTHON'] TargetAdd('p3dpython_p3dpython_composite1.obj', opts=OPTS, input='p3dpython_composite1.cxx') TargetAdd('p3dpython_p3dPythonMain.obj', opts=OPTS, input='p3dPythonMain.cxx') TargetAdd('p3dpython.exe', input='p3dpython_p3dpython_composite1.obj') @@ -5166,7 +5247,7 @@ if (RTDIST or RUNTIME): TargetAdd('p3dpythonw.exe', input='libp3interrogatedb.dll') TargetAdd('p3dpythonw.exe', opts=['SUBSYSTEM:WINDOWS', 'PYTHON', 'WINUSER']) - if (PkgSkip("OPENSSL")==0 and RTDIST): + if (PkgSkip("OPENSSL")==0 and RTDIST and False): OPTS=['DIR:direct/src/plugin', 'DIR:panda/src/express', 'OPENSSL'] if GetTarget() == 'darwin': OPTS += ['OPT:2'] @@ -5287,7 +5368,7 @@ if (RUNTIME): TargetAdd('panda3d.exe', input='libpandaexpress.dll') TargetAdd('panda3d.exe', input='libp3dtoolconfig.dll') TargetAdd('panda3d.exe', input='libp3dtool.dll') - TargetAdd('panda3d.exe', input='libp3pystub.lib') + #TargetAdd('panda3d.exe', input='libp3pystub.lib') TargetAdd('panda3d.exe', input='libp3tinyxml.ilb') TargetAdd('panda3d.exe', opts=['NOICON', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'WINSHELL', 'ADVAPI', 'WINSOCK2', 'WINOLE', 'CARBON']) @@ -5301,7 +5382,7 @@ if (RUNTIME): TargetAdd('Panda3D.app', input='libpandaexpress.dll') TargetAdd('Panda3D.app', input='libp3dtoolconfig.dll') TargetAdd('Panda3D.app', input='libp3dtool.dll') - TargetAdd('Panda3D.app', input='libp3pystub.lib') + #TargetAdd('Panda3D.app', input='libp3pystub.lib') TargetAdd('Panda3D.app', input='libp3tinyxml.ilb') TargetAdd('Panda3D.app', input='panda3d_mac.plist', ipath=OPTS) TargetAdd('Panda3D.app', input='models/plugin_images/panda3d.icns') @@ -5316,7 +5397,7 @@ if (RUNTIME): TargetAdd('panda3dw.exe', input='libpandaexpress.dll') TargetAdd('panda3dw.exe', input='libp3dtoolconfig.dll') TargetAdd('panda3dw.exe', input='libp3dtool.dll') - TargetAdd('panda3dw.exe', input='libp3pystub.lib') + #TargetAdd('panda3dw.exe', input='libp3pystub.lib') TargetAdd('panda3dw.exe', input='libp3tinyxml.ilb') TargetAdd('panda3dw.exe', opts=['SUBSYSTEM:WINDOWS', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER', 'WINSHELL', 'ADVAPI', 'WINSOCK2', 'WINOLE', 'CARBON']) @@ -5327,7 +5408,7 @@ if (RTDIST): TargetAdd('plugin_standalone_panda3dBase.obj', opts=OPTS, input='panda3dBase.cxx') TargetAdd('plugin_standalone_p3dEmbedMain.obj', opts=OPTS, input='p3dEmbedMain.cxx') TargetAdd('plugin_standalone_p3dEmbed.obj', opts=OPTS, input='p3dEmbed.cxx') - TargetAdd('plugin_standalone_pystub.obj', opts=OPTS, input='pystub.cxx') + #TargetAdd('plugin_standalone_pystub.obj', opts=OPTS, input='pystub.cxx') TargetAdd('plugin_standalone_dtoolbase_composite1.obj', opts=OPTS, input='p3dtoolbase_composite1.cxx') TargetAdd('plugin_standalone_dtoolbase_composite2.obj', opts=OPTS, input='p3dtoolbase_composite2.cxx') TargetAdd('plugin_standalone_lookup3.obj', opts=OPTS, input='lookup3.c') @@ -5346,7 +5427,7 @@ if (RTDIST): TargetAdd('p3dembed.exe', input='plugin_standalone_panda3dBase.obj') TargetAdd('p3dembed.exe', input='plugin_standalone_p3dEmbedMain.obj') TargetAdd('p3dembed.exe', input='plugin_standalone_p3dEmbed.obj') - TargetAdd('p3dembed.exe', input='plugin_standalone_pystub.obj') + #TargetAdd('p3dembed.exe', input='plugin_standalone_pystub.obj') TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolbase_composite1.obj') TargetAdd('p3dembed.exe', input='plugin_standalone_dtoolbase_composite2.obj') TargetAdd('p3dembed.exe', input='plugin_standalone_lookup3.obj') @@ -5377,7 +5458,7 @@ if (RTDIST): TargetAdd('p3dembedw.exe', input='plugin_standalone_panda3dBase.obj') TargetAdd('p3dembedw.exe', input='plugin_standalone_p3dEmbedWinMain.obj') TargetAdd('p3dembedw.exe', input='plugin_standalone_p3dEmbed.obj') - TargetAdd('p3dembedw.exe', input='plugin_standalone_pystub.obj') + #TargetAdd('p3dembedw.exe', input='plugin_standalone_pystub.obj') TargetAdd('p3dembedw.exe', input='plugin_standalone_dtoolbase_composite1.obj') TargetAdd('p3dembedw.exe', input='plugin_standalone_dtoolbase_composite2.obj') TargetAdd('p3dembedw.exe', input='plugin_standalone_lookup3.obj') @@ -5445,17 +5526,17 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('bam-info.exe', input='libp3progbase.lib') TargetAdd('bam-info.exe', input='libp3pandatoolbase.lib') TargetAdd('bam-info.exe', input='libpandaegg.dll') - TargetAdd('bam-info.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('bam-info.exe', input=COMMON_PANDA_LIBS) TargetAdd('bam-info.exe', opts=['ADVAPI', 'FFTW']) TargetAdd('bam2egg_bamToEgg.obj', opts=OPTS, input='bamToEgg.cxx') TargetAdd('bam2egg.exe', input='bam2egg_bamToEgg.obj') - TargetAdd('bam2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('bam2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('bam2egg.exe', opts=['ADVAPI', 'FFTW']) TargetAdd('egg2bam_eggToBam.obj', opts=OPTS, input='eggToBam.cxx') TargetAdd('egg2bam.exe', input='egg2bam_eggToBam.obj') - TargetAdd('egg2bam.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2bam.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2bam.exe', opts=['ADVAPI', 'FFTW']) # @@ -5494,7 +5575,7 @@ if (PkgSkip("PANDATOOL")==0 and PkgSkip("FCOLLADA")==0): TargetAdd('dae2egg_daeToEgg.obj', opts=OPTS, input='daeToEgg.cxx') TargetAdd('dae2egg.exe', input='dae2egg_daeToEgg.obj') TargetAdd('dae2egg.exe', input='libp3daeegg.lib') - TargetAdd('dae2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('dae2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('dae2egg.exe', opts=['WINUSER', 'FCOLLADA', 'CARBON']) # @@ -5528,14 +5609,14 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('dxf-points.exe', input='libp3progbase.lib') TargetAdd('dxf-points.exe', input='libp3dxf.lib') TargetAdd('dxf-points.exe', input='libp3pandatoolbase.lib') - TargetAdd('dxf-points.exe', input=COMMON_PANDA_LIBS_PYSTUB) + TargetAdd('dxf-points.exe', input=COMMON_PANDA_LIBS) TargetAdd('dxf-points.exe', opts=['ADVAPI', 'FFTW']) TargetAdd('dxf2egg_dxfToEgg.obj', opts=OPTS, input='dxfToEgg.cxx') TargetAdd('dxf2egg.exe', input='dxf2egg_dxfToEgg.obj') TargetAdd('dxf2egg.exe', input='libp3dxfegg.lib') TargetAdd('dxf2egg.exe', input='libp3dxf.lib') - TargetAdd('dxf2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('dxf2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('dxf2egg.exe', opts=['ADVAPI', 'FFTW']) TargetAdd('egg2dxf_eggToDXF.obj', opts=OPTS, input='eggToDXF.cxx') @@ -5543,7 +5624,7 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('egg2dxf.exe', input='egg2dxf_eggToDXF.obj') TargetAdd('egg2dxf.exe', input='egg2dxf_eggToDXFLayer.obj') TargetAdd('egg2dxf.exe', input='libp3dxf.lib') - TargetAdd('egg2dxf.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2dxf.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2dxf.exe', opts=['ADVAPI', 'FFTW']) # @@ -5568,12 +5649,12 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('obj2egg_objToEgg.obj', opts=OPTS, input='objToEgg.cxx') TargetAdd('obj2egg.exe', input='obj2egg_objToEgg.obj') TargetAdd('obj2egg.exe', input='libp3objegg.lib') - TargetAdd('obj2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('obj2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2obj_eggToObj.obj', opts=OPTS, input='eggToObj.cxx') TargetAdd('egg2obj.exe', input='egg2obj_eggToObj.obj') TargetAdd('egg2obj.exe', input='libp3objegg.lib') - TargetAdd('egg2obj.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2obj.exe', input=COMMON_EGG2X_LIBS) # # DIRECTORY: pandatool/src/palettizer/ @@ -5597,7 +5678,7 @@ if (PkgSkip("FREETYPE")==0) and (PkgSkip("PANDATOOL")==0): TargetAdd('egg-mkfont.exe', input='egg-mkfont_rangeDescription.obj') TargetAdd('egg-mkfont.exe', input='egg-mkfont_rangeIterator.obj') TargetAdd('egg-mkfont.exe', input='libp3palettizer.lib') - TargetAdd('egg-mkfont.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-mkfont.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-mkfont.exe', opts=['ADVAPI', 'FREETYPE']) # @@ -5624,7 +5705,7 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('egg-optchar.exe', input='egg-optchar_eggOptcharUserData.obj') TargetAdd('egg-optchar.exe', input='egg-optchar_vertexMembership.obj') TargetAdd('egg-optchar.exe', input='libp3eggcharbase.lib') - TargetAdd('egg-optchar.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-optchar.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-optchar.exe', opts=['ADVAPI', 'FREETYPE']) # @@ -5636,7 +5717,7 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('egg-palettize_eggPalettize.obj', opts=OPTS, input='eggPalettize.cxx') TargetAdd('egg-palettize.exe', input='egg-palettize_eggPalettize.obj') TargetAdd('egg-palettize.exe', input='libp3palettizer.lib') - TargetAdd('egg-palettize.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-palettize.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-palettize.exe', opts=['ADVAPI']) # @@ -5650,7 +5731,7 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('egg-qtess.exe', input='libp3eggbase.lib') TargetAdd('egg-qtess.exe', input='libp3progbase.lib') TargetAdd('egg-qtess.exe', input='libp3converter.lib') - TargetAdd('egg-qtess.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-qtess.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-qtess.exe', opts=['ADVAPI']) # @@ -5661,49 +5742,49 @@ if (PkgSkip("PANDATOOL")==0): OPTS=['DIR:pandatool/src/eggprogs'] TargetAdd('egg-crop_eggCrop.obj', opts=OPTS, input='eggCrop.cxx') TargetAdd('egg-crop.exe', input='egg-crop_eggCrop.obj') - TargetAdd('egg-crop.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-crop.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-crop.exe', opts=['ADVAPI']) TargetAdd('egg-make-tube_eggMakeTube.obj', opts=OPTS, input='eggMakeTube.cxx') TargetAdd('egg-make-tube.exe', input='egg-make-tube_eggMakeTube.obj') - TargetAdd('egg-make-tube.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-make-tube.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-make-tube.exe', opts=['ADVAPI']) TargetAdd('egg-texture-cards_eggTextureCards.obj', opts=OPTS, input='eggTextureCards.cxx') TargetAdd('egg-texture-cards.exe', input='egg-texture-cards_eggTextureCards.obj') - TargetAdd('egg-texture-cards.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-texture-cards.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-texture-cards.exe', opts=['ADVAPI']) TargetAdd('egg-topstrip_eggTopstrip.obj', opts=OPTS, input='eggTopstrip.cxx') TargetAdd('egg-topstrip.exe', input='egg-topstrip_eggTopstrip.obj') TargetAdd('egg-topstrip.exe', input='libp3eggcharbase.lib') - TargetAdd('egg-topstrip.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-topstrip.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-topstrip.exe', opts=['ADVAPI']) TargetAdd('egg-trans_eggTrans.obj', opts=OPTS, input='eggTrans.cxx') TargetAdd('egg-trans.exe', input='egg-trans_eggTrans.obj') - TargetAdd('egg-trans.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-trans.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-trans.exe', opts=['ADVAPI']) TargetAdd('egg2c_eggToC.obj', opts=OPTS, input='eggToC.cxx') TargetAdd('egg2c.exe', input='egg2c_eggToC.obj') - TargetAdd('egg2c.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2c.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2c.exe', opts=['ADVAPI']) TargetAdd('egg-rename_eggRename.obj', opts=OPTS, input='eggRename.cxx') TargetAdd('egg-rename.exe', input='egg-rename_eggRename.obj') - TargetAdd('egg-rename.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-rename.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-rename.exe', opts=['ADVAPI']) TargetAdd('egg-retarget-anim_eggRetargetAnim.obj', opts=OPTS, input='eggRetargetAnim.cxx') TargetAdd('egg-retarget-anim.exe', input='egg-retarget-anim_eggRetargetAnim.obj') TargetAdd('egg-retarget-anim.exe', input='libp3eggcharbase.lib') - TargetAdd('egg-retarget-anim.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-retarget-anim.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-retarget-anim.exe', opts=['ADVAPI']) TargetAdd('egg-list-textures_eggListTextures.obj', opts=OPTS, input='eggListTextures.cxx') TargetAdd('egg-list-textures.exe', input='egg-list-textures_eggListTextures.obj') - TargetAdd('egg-list-textures.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg-list-textures.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg-list-textures.exe', opts=['ADVAPI']) # @@ -5734,33 +5815,33 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('egg2flt_eggToFlt.obj', opts=OPTS, input='eggToFlt.cxx') TargetAdd('egg2flt.exe', input='egg2flt_eggToFlt.obj') TargetAdd('egg2flt.exe', input='libp3flt.lib') - TargetAdd('egg2flt.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2flt.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2flt.exe', opts=['ADVAPI']) TargetAdd('flt-info_fltInfo.obj', opts=OPTS, input='fltInfo.cxx') TargetAdd('flt-info.exe', input='flt-info_fltInfo.obj') TargetAdd('flt-info.exe', input='libp3flt.lib') - TargetAdd('flt-info.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('flt-info.exe', input=COMMON_EGG2X_LIBS) TargetAdd('flt-info.exe', opts=['ADVAPI']) TargetAdd('flt-trans_fltTrans.obj', opts=OPTS, input='fltTrans.cxx') TargetAdd('flt-trans.exe', input='flt-trans_fltTrans.obj') TargetAdd('flt-trans.exe', input='libp3flt.lib') - TargetAdd('flt-trans.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('flt-trans.exe', input=COMMON_EGG2X_LIBS) TargetAdd('flt-trans.exe', opts=['ADVAPI']) TargetAdd('flt2egg_fltToEgg.obj', opts=OPTS, input='fltToEgg.cxx') TargetAdd('flt2egg.exe', input='flt2egg_fltToEgg.obj') TargetAdd('flt2egg.exe', input='libp3flt.lib') TargetAdd('flt2egg.exe', input='libp3fltegg.lib') - TargetAdd('flt2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('flt2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('flt2egg.exe', opts=['ADVAPI']) TargetAdd('fltcopy_fltCopy.obj', opts=OPTS, input='fltCopy.cxx') TargetAdd('fltcopy.exe', input='fltcopy_fltCopy.obj') TargetAdd('fltcopy.exe', input='libp3cvscopy.lib') TargetAdd('fltcopy.exe', input='libp3flt.lib') - TargetAdd('fltcopy.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('fltcopy.exe', input=COMMON_EGG2X_LIBS) TargetAdd('fltcopy.exe', opts=['ADVAPI']) @@ -5786,7 +5867,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('image-info.exe', input='libp3pandatoolbase.lib') TargetAdd('image-info.exe', input='libpandaegg.dll') TargetAdd('image-info.exe', input=COMMON_PANDA_LIBS) - TargetAdd('image-info.exe', input='libp3pystub.lib') TargetAdd('image-info.exe', opts=['ADVAPI']) TargetAdd('image-resize_imageResize.obj', opts=OPTS, input='imageResize.cxx') @@ -5796,7 +5876,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('image-resize.exe', input='libp3pandatoolbase.lib') TargetAdd('image-resize.exe', input='libpandaegg.dll') TargetAdd('image-resize.exe', input=COMMON_PANDA_LIBS) - TargetAdd('image-resize.exe', input='libp3pystub.lib') TargetAdd('image-resize.exe', opts=['ADVAPI']) TargetAdd('image-trans_imageTrans.obj', opts=OPTS, input='imageTrans.cxx') @@ -5806,7 +5885,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('image-trans.exe', input='libp3pandatoolbase.lib') TargetAdd('image-trans.exe', input='libpandaegg.dll') TargetAdd('image-trans.exe', input=COMMON_PANDA_LIBS) - TargetAdd('image-trans.exe', input='libp3pystub.lib') TargetAdd('image-trans.exe', opts=['ADVAPI']) # @@ -5820,7 +5898,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('pfm-trans.exe', input='libp3progbase.lib') TargetAdd('pfm-trans.exe', input='libp3pandatoolbase.lib') TargetAdd('pfm-trans.exe', input=COMMON_PANDA_LIBS) - TargetAdd('pfm-trans.exe', input='libp3pystub.lib') TargetAdd('pfm-trans.exe', opts=['ADVAPI']) TargetAdd('pfm-bba_pfmBba.obj', opts=OPTS, input='pfmBba.cxx') @@ -5830,7 +5907,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('pfm-bba.exe', input='libp3progbase.lib') TargetAdd('pfm-bba.exe', input='libp3pandatoolbase.lib') TargetAdd('pfm-bba.exe', input=COMMON_PANDA_LIBS) - TargetAdd('pfm-bba.exe', input='libp3pystub.lib') TargetAdd('pfm-bba.exe', opts=['ADVAPI']) # @@ -5864,14 +5940,13 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('lwo-scan.exe', input='libp3pandatoolbase.lib') TargetAdd('lwo-scan.exe', input='libpandaegg.dll') TargetAdd('lwo-scan.exe', input=COMMON_PANDA_LIBS) - TargetAdd('lwo-scan.exe', input='libp3pystub.lib') TargetAdd('lwo-scan.exe', opts=['ADVAPI']) TargetAdd('lwo2egg_lwoToEgg.obj', opts=OPTS, input='lwoToEgg.cxx') TargetAdd('lwo2egg.exe', input='lwo2egg_lwoToEgg.obj') TargetAdd('lwo2egg.exe', input='libp3lwo.lib') TargetAdd('lwo2egg.exe', input='libp3lwoegg.lib') - TargetAdd('lwo2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('lwo2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('lwo2egg.exe', opts=['ADVAPI']) # @@ -5912,7 +5987,7 @@ for VER in MAXVERSIONS: TargetAdd('maxegg'+VNUM+'.dlo', input='maxegg'+VNUM+'_composite1.obj') TargetAdd('maxegg'+VNUM+'.dlo', input='maxEgg'+VNUM+'.res') TargetAdd('maxegg'+VNUM+'.dlo', input='maxEgg.def', ipath=OPTS) - TargetAdd('maxegg'+VNUM+'.dlo', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('maxegg'+VNUM+'.dlo', input=COMMON_EGG2X_LIBS) TargetAdd('maxegg'+VNUM+'.dlo', opts=OPTS) # @@ -5998,8 +6073,11 @@ if (PkgSkip("PANDATOOL")==0): # if (PkgSkip("PANDATOOL")==0): + if not PkgSkip("FCOLLADA"): + DefSymbol("FCOLLADA", "HAVE_FCOLLADA") + OPTS=['DIR:pandatool/src/ptloader', 'DIR:pandatool/src/flt', 'DIR:pandatool/src/lwo', 'DIR:pandatool/src/xfile', 'DIR:pandatool/src/xfileegg', 'DIR:pandatool/src/daeegg', 'BUILDING:PTLOADER', 'FCOLLADA'] - TargetAdd('p3ptloader_config_ptloader.obj', opts=OPTS, input='config_ptloader.cxx') + TargetAdd('p3ptloader_config_ptloader.obj', opts=OPTS, input='config_ptloader.cxx', dep='dtool_have_fcollada.dat') TargetAdd('p3ptloader_loaderFileTypePandatool.obj', opts=OPTS, input='loaderFileTypePandatool.cxx') TargetAdd('libp3ptloader.dll', input='p3ptloader_config_ptloader.obj') TargetAdd('libp3ptloader.dll', input='p3ptloader_loaderFileTypePandatool.obj') @@ -6062,7 +6140,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('softcvs.exe', input='libp3pandatoolbase.lib') TargetAdd('softcvs.exe', input='libpandaegg.dll') TargetAdd('softcvs.exe', input=COMMON_PANDA_LIBS) - TargetAdd('softcvs.exe', input='libp3pystub.lib') TargetAdd('softcvs.exe', opts=['ADVAPI']) # @@ -6080,7 +6157,6 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('text-stats.exe', input='libp3pandatoolbase.lib') TargetAdd('text-stats.exe', input='libpandaegg.dll') TargetAdd('text-stats.exe', input=COMMON_PANDA_LIBS) - TargetAdd('text-stats.exe', input='libp3pystub.lib') TargetAdd('text-stats.exe', opts=['ADVAPI']) # @@ -6095,14 +6171,13 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('vrml-trans.exe', input='libp3progbase.lib') TargetAdd('vrml-trans.exe', input='libp3pandatoolbase.lib') TargetAdd('vrml-trans.exe', input=COMMON_PANDA_LIBS) - TargetAdd('vrml-trans.exe', input='libp3pystub.lib') TargetAdd('vrml-trans.exe', opts=['ADVAPI']) TargetAdd('vrml2egg_vrmlToEgg.obj', opts=OPTS, input='vrmlToEgg.cxx') TargetAdd('vrml2egg.exe', input='vrml2egg_vrmlToEgg.obj') TargetAdd('vrml2egg.exe', input='libp3vrmlegg.lib') TargetAdd('vrml2egg.exe', input='libp3vrml.lib') - TargetAdd('vrml2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('vrml2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('vrml2egg.exe', opts=['ADVAPI']) # @@ -6122,7 +6197,6 @@ if (PkgSkip("PANDATOOL")==0 and (GetTarget() == 'windows' or PkgSkip("GTK2")==0) TargetAdd('pstats.exe', input='libp3progbase.lib') TargetAdd('pstats.exe', input='libp3pandatoolbase.lib') TargetAdd('pstats.exe', input=COMMON_PANDA_LIBS) - TargetAdd('pstats.exe', input='libp3pystub.lib') TargetAdd('pstats.exe', opts=['SUBSYSTEM:WINDOWS', 'WINSOCK', 'WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM', 'GTK2']) # @@ -6135,7 +6209,7 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('egg2x.exe', input='egg2x_eggToX.obj') TargetAdd('egg2x.exe', input='libp3xfileegg.lib') TargetAdd('egg2x.exe', input='libp3xfile.lib') - TargetAdd('egg2x.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2x.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2x.exe', opts=['ADVAPI']) TargetAdd('x-trans_xFileTrans.obj', opts=OPTS, input='xFileTrans.cxx') @@ -6144,14 +6218,13 @@ if (PkgSkip("PANDATOOL")==0): TargetAdd('x-trans.exe', input='libp3xfile.lib') TargetAdd('x-trans.exe', input='libp3pandatoolbase.lib') TargetAdd('x-trans.exe', input=COMMON_PANDA_LIBS) - TargetAdd('x-trans.exe', input='libp3pystub.lib') TargetAdd('x-trans.exe', opts=['ADVAPI']) TargetAdd('x2egg_xFileToEgg.obj', opts=OPTS, input='xFileToEgg.cxx') TargetAdd('x2egg.exe', input='x2egg_xFileToEgg.obj') TargetAdd('x2egg.exe', input='libp3xfileegg.lib') TargetAdd('x2egg.exe', input='libp3xfile.lib') - TargetAdd('x2egg.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('x2egg.exe', input=COMMON_EGG2X_LIBS) TargetAdd('x2egg.exe', opts=['ADVAPI']) # @@ -6176,8 +6249,8 @@ for VER in MAYAVERSIONS: TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaeggimport'+VNUM+'_mayaeggimport.obj') TargetAdd('mayaeggimport'+VNUM+'.mll', input='libpandaegg.dll') TargetAdd('mayaeggimport'+VNUM+'.mll', input=COMMON_PANDA_LIBS) - if GetTarget() == 'windows': - TargetAdd('mayaeggimport'+VNUM+'.mll', input='libp3pystub.lib') + #if GetTarget() == 'windows': + # TargetAdd('mayaeggimport'+VNUM+'.mll', input='libp3pystub.lib') TargetAdd('mayaeggimport'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('mayaloader'+VNUM+'_config_mayaloader.obj', opts=OPTS, input='config_mayaloader.cxx') @@ -6210,7 +6283,7 @@ for VER in MAYAVERSIONS: TargetAdd('libmayapview'+VNUM+'.mll', input='libmaya'+VNUM+'.lib') TargetAdd('libmayapview'+VNUM+'.mll', input='libp3framework.dll') if GetTarget() == 'windows': - TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS) else: TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS) TargetAdd('libmayapview'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS) @@ -6220,7 +6293,7 @@ for VER in MAYAVERSIONS: TargetAdd('maya2egg'+VNUM+'_bin.exe', input='libmayaegg'+VNUM+'.lib') TargetAdd('maya2egg'+VNUM+'_bin.exe', input='libmaya'+VNUM+'.lib') if GetTarget() == 'windows': - TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) else: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS) @@ -6230,7 +6303,7 @@ for VER in MAYAVERSIONS: TargetAdd('egg2maya'+VNUM+'_bin.exe', input='libmayaegg'+VNUM+'.lib') TargetAdd('egg2maya'+VNUM+'_bin.exe', input='libmaya'+VNUM+'.lib') if GetTarget() == 'windows': - TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) else: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS) @@ -6240,7 +6313,7 @@ for VER in MAYAVERSIONS: TargetAdd('mayacopy'+VNUM+'_bin.exe', input='libp3cvscopy.lib') TargetAdd('mayacopy'+VNUM+'_bin.exe', input='libmaya'+VNUM+'.lib') if GetTarget() == 'windows': - TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) + TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) else: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS) @@ -6253,17 +6326,17 @@ for VER in MAYAVERSIONS: TargetAdd('maya2egg'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') TargetAdd('maya2egg'+VNUM+'.exe', input='libpandaexpress.dll') - TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) TargetAdd('maya2egg'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS) TargetAdd('egg2maya'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') TargetAdd('egg2maya'+VNUM+'.exe', input='libpandaexpress.dll') - TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) TargetAdd('egg2maya'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS) TargetAdd('mayacopy'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') TargetAdd('mayacopy'+VNUM+'.exe', input='libpandaexpress.dll') - TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) TargetAdd('mayacopy'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS) # @@ -6275,7 +6348,7 @@ if (PkgSkip("CONTRIB")==0 and not RUNTIME): TargetAdd('libpandaai.dll', input='p3ai_composite1.obj') TargetAdd('libpandaai.dll', input=COMMON_PANDA_LIBS) - OPTS=['DIR:contrib/src/ai'] + OPTS=['DIR:contrib/src/ai', 'PYTHON'] IGATEFILES=GetDirectoryContents('contrib/src/ai', ["*.h", "*_composite*.cxx"]) TargetAdd('libpandaai.in', opts=OPTS, input=IGATEFILES) TargetAdd('libpandaai.in', opts=['IMOD:panda3d.ai', 'ILIB:libpandaai', 'SRCDIR:contrib/src/ai']) @@ -6536,17 +6609,14 @@ def MakeInstallerNSIS(file, title, installdir): if (os.path.exists("nsis-output.exe")): os.remove("nsis-output.exe") WriteFile(GetOutputDir()+"/tmp/__init__.py", "") - psource = os.path.abspath(".") - panda = os.path.abspath(GetOutputDir()) nsis_defs = { 'COMPRESSOR' : COMPRESSOR, 'TITLE' : title, 'INSTALLDIR' : installdir, - 'OUTFILE' : os.path.join(psource, 'nsis-output.exe'), - 'LICENSE' : os.path.join(panda, 'LICENSE'), - 'BUILT' : panda, - 'SOURCE' : psource, + 'OUTFILE' : '..\\' + file, + 'BUILT' : '..\\' + GetOutputDir(), + 'SOURCE' : '..', 'PYVER' : SDK["PYTHONVERSION"][6:9], 'REGVIEW' : regview, } @@ -6560,10 +6630,29 @@ def MakeInstallerNSIS(file, title, installdir): for item in nsis_defs.items(): cmd += ' -D%s="%s"' % item - cmd += ' "%s"' % (os.path.join(psource, 'makepanda', 'installer.nsi')) + cmd += ' "makepanda\installer.nsi"' oscmd(cmd) - os.rename("nsis-output.exe", file) +def MakeDebugSymbolArchive(zipname, dirname): + import zipfile + zip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'bin', '*.pdb')): + zip.write(fn, dirname + '/bin/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'panda3d', '*.pdb')): + zip.write(fn, dirname + '/panda3d/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'plugins', '*.pdb')): + zip.write(fn, dirname + '/plugins/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'python', '*.pdb')): + zip.write(fn, dirname + '/python/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'python', 'DLLs', '*.pdb')): + zip.write(fn, dirname + '/python/DLLs/' + os.path.basename(fn)) + + zip.close() INSTALLER_DEB_FILE=""" Package: panda3dMAJOR @@ -6758,9 +6847,9 @@ def MakeInstallerLinux(): txt = txt.replace("VERSION", DEBVERSION).replace("ARCH", pkg_arch).replace("PV", PV).replace("MAJOR", MAJOR_VERSION) txt = txt.replace("INSTSIZE", str(GetDirectorySize("targetroot") / 1024)) oscmd("mkdir --mode=0755 -p targetroot/DEBIAN") - oscmd("cd targetroot ; (find usr -type f -exec md5sum {} \;) > DEBIAN/md5sums") + oscmd("cd targetroot && (find usr -type f -exec md5sum {} ;) > DEBIAN/md5sums") if (not RUNTIME): - oscmd("cd targetroot ; (find etc -type f -exec md5sum {} \;) >> DEBIAN/md5sums") + oscmd("cd targetroot && (find etc -type f -exec md5sum {} ;) >> DEBIAN/md5sums") WriteFile("targetroot/DEBIAN/conffiles","/etc/Config.prc\n") WriteFile("targetroot/DEBIAN/postinst","#!/bin/sh\necho running ldconfig\nldconfig\n") oscmd("cp targetroot/DEBIAN/postinst targetroot/DEBIAN/postrm") @@ -6788,7 +6877,7 @@ def MakeInstallerLinux(): if RUNTIME: # The runtime doesn't export any useful symbols, so just query the dependencies. - oscmd("cd targetroot; %(dpkg_shlibdeps)s -x%(pkg_name)s %(lib_pattern)s %(bin_pattern)s*" % locals()) + oscmd("cd targetroot && %(dpkg_shlibdeps)s -x%(pkg_name)s %(lib_pattern)s %(bin_pattern)s*" % locals()) depends = ReadFile("targetroot/debian/substvars").replace("shlibs:Depends=", "").strip() recommends = "" else: @@ -6796,12 +6885,12 @@ def MakeInstallerLinux(): pkg_dir = "debian/panda3d" + MAJOR_VERSION # Generate a symbols file so that other packages can know which symbols we export. - oscmd("cd targetroot; dpkg-gensymbols -q -ODEBIAN/symbols -v%(pkg_version)s -p%(pkg_name)s -e%(lib_pattern)s" % locals()) + oscmd("cd targetroot && dpkg-gensymbols -q -ODEBIAN/symbols -v%(pkg_version)s -p%(pkg_name)s -e%(lib_pattern)s" % locals()) # Library dependencies are required, binary dependencies are recommended. # We explicitly exclude libphysx-extras since we don't want to depend on PhysX. - oscmd("cd targetroot; LD_LIBRARY_PATH=usr/%(lib_dir)s/panda3d %(dpkg_shlibdeps)s -Tdebian/substvars_dep --ignore-missing-info -x%(pkg_name)s -xlibphysx-extras %(lib_pattern)s" % locals()) - oscmd("cd targetroot; LD_LIBRARY_PATH=usr/%(lib_dir)s/panda3d %(dpkg_shlibdeps)s -Tdebian/substvars_rec --ignore-missing-info -x%(pkg_name)s %(bin_pattern)s" % locals()) + oscmd("cd targetroot && LD_LIBRARY_PATH=usr/%(lib_dir)s/panda3d %(dpkg_shlibdeps)s -Tdebian/substvars_dep --ignore-missing-info -x%(pkg_name)s -xlibphysx-extras %(lib_pattern)s" % locals()) + oscmd("cd targetroot && LD_LIBRARY_PATH=usr/%(lib_dir)s/panda3d %(dpkg_shlibdeps)s -Tdebian/substvars_rec --ignore-missing-info -x%(pkg_name)s %(bin_pattern)s" % locals()) # Parse the substvars files generated by dpkg-shlibdeps. depends = ReadFile("targetroot/debian/substvars_dep").replace("shlibs:Depends=", "").strip() @@ -6954,8 +7043,10 @@ def MakeInstallerOSX(): oscmd("cp -R %s/lib/libp3fmod_audio.* dstroot/fmodex/Developer/Panda3D/lib/" % GetOutputDir()) oscmd("cp -R %s/lib/libfmodex* dstroot/fmodex/Developer/Panda3D/lib/" % GetOutputDir()) - oscmd("mkdir -p dstroot/headers/Developer/Panda3D") + oscmd("mkdir -p dstroot/headers/Developer/Panda3D/lib") oscmd("cp -R %s/include dstroot/headers/Developer/Panda3D/include" % GetOutputDir()) + if os.path.isfile(GetOutputDir() + "/lib/libp3pystub.a"): + oscmd("cp -R -P %s/lib/libp3pystub.a dstroot/headers/Developer/Panda3D/lib/" % GetOutputDir()) if os.path.isdir("samples"): oscmd("mkdir -p dstroot/samples/Developer/Examples/Panda3D") @@ -7131,7 +7222,7 @@ try: target = GetTarget() if target == 'windows': fn = "Panda3D-" - dir = "C:\\Panda3D-" + VERSION + dir = "Panda3D-" + VERSION if RUNTIME: fn += "Runtime-" @@ -7150,8 +7241,9 @@ try: fn += '-x64' dir += '-x64' - fn += '.exe' - MakeInstallerNSIS(fn, title, dir) + MakeInstallerNSIS(fn + '.exe', title, 'C:\\' + dir) + if not RUNTIME: + MakeDebugSymbolArchive(fn + '-pdb.zip', dir) elif (target == 'linux'): MakeInstallerLinux() elif (target == 'darwin'): diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 9321a79060..2b9e9d4a32 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -512,6 +512,7 @@ def oscmd(cmd, ignoreError = False): exit("Cannot find "+exe+" on search path") res = os.spawnl(os.P_WAIT, exe_path, cmd) else: + cmd = cmd.replace(';', '\\;') res = subprocess.call(cmd, shell=True) sig = res & 0x7F if (GetVerbose() and res != 0): @@ -966,7 +967,12 @@ def ReadBinaryFile(wfile): ex = sys.exc_info()[1] exit("Cannot read %s: %s" % (wfile, ex)) -def WriteFile(wfile, data): +def WriteFile(wfile, data, newline=None): + if newline is not None: + data = data.replace('\r\n', '\n') + data = data.replace('\r', '\n') + data = data.replace('\n', newline) + try: dsthandle = open(wfile, "w") dsthandle.write(data) @@ -984,18 +990,24 @@ def WriteBinaryFile(wfile, data): ex = sys.exc_info()[1] exit("Cannot write to %s: %s" % (wfile, ex)) -def ConditionalWriteFile(dest, desiredcontents): +def ConditionalWriteFile(dest, data, newline=None): + if newline is not None: + data = data.replace('\r\n', '\n') + data = data.replace('\r', '\n') + data = data.replace('\n', newline) + try: rfile = open(dest, 'r') contents = rfile.read(-1) rfile.close() except: contents = 0 - if contents != desiredcontents: + + if contents != data: if VERBOSE: print("Writing %s" % (dest)) sys.stdout.flush() - WriteFile(dest, desiredcontents) + WriteFile(dest, data) def DeleteVCS(dir): if dir == "": dir = "." @@ -2051,9 +2063,68 @@ def SdkLocateWindows(version = '7.1'): version = version.upper() if version == '10': + version = '10.0' + + if version.startswith('10.') and version.count('.') == 1: + # Choose the latest version of the Windows 10 SDK. platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10") + + # Fallback in case we can't read the registry. + if not platsdk or not os.path.isdir(platsdk): + platsdk = "C:\\Program Files (x86)\\Windows Kits\\10\\" + + if platsdk and os.path.isdir(platsdk): + incdirs = glob.glob(os.path.join(platsdk, 'Include', version + '.*.*')) + max_version = () + for dir in incdirs: + verstring = os.path.basename(dir) + + # Check that the important include directories exist. + if not os.path.isdir(os.path.join(dir, 'ucrt')): + continue + if not os.path.isdir(os.path.join(dir, 'shared')): + continue + if not os.path.isdir(os.path.join(dir, 'um')): + continue + if not os.path.isdir(os.path.join(platsdk, 'Lib', verstring, 'ucrt')): + continue + if not os.path.isdir(os.path.join(platsdk, 'Lib', verstring, 'um')): + continue + + print(verstring) + vertuple = tuple(map(int, verstring.split('.'))) + if vertuple > max_version: + version = verstring + max_version = vertuple + + if not max_version: + # No suitable version found. + platsdk = None + + elif version.startswith('10.'): + # We chose a specific version of the Windows 10 SDK. Verify it exists. + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10") + + # Fallback in case we can't read the registry. + if not platsdk or not os.path.isdir(platsdk): + platsdk = "C:\\Program Files (x86)\\Windows Kits\\10\\" + + if version.count('.') == 2: + version += '.0' + + if platsdk and not os.path.isdir(os.path.join(platsdk, 'Include', version)): + platsdk = None + + elif version == '8.1': + platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot81") + + # Fallback in case we can't read the registry. + if not platsdk or not os.path.isdir(platsdk): + platsdk = "C:\\Program Files (x86)\\Windows Kits\\8.1\\" + elif version == '8.0': platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot") + else: platsdk = GetRegistryKey("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v" + version, "InstallationFolder") @@ -2320,12 +2391,13 @@ def SetupVisualStudioEnviron(): AddToPathEnv("LIB", SDK["VISUALSTUDIO"] + "VC\\lib\\" + libdir) AddToPathEnv("LIB", SDK["VISUALSTUDIO"] + "VC\\atlmfc\\lib\\" + libdir) - if SDK["MSPLATFORM_VERSION"] == '10': + winsdk_ver = SDK["MSPLATFORM_VERSION"] + if winsdk_ver.startswith('10.'): AddToPathEnv("PATH", SDK["MSPLATFORM"] + "bin\\" + arch) # Windows Kit 10 introduces the "universal CRT". - inc_dir = SDK["MSPLATFORM"] + "Include\\10.0.10586.0\\" - lib_dir = SDK["MSPLATFORM"] + "Lib\\10.0.10586.0\\" + inc_dir = SDK["MSPLATFORM"] + "Include\\" + winsdk_ver + "\\" + lib_dir = SDK["MSPLATFORM"] + "Lib\\" + winsdk_ver + "\\" AddToPathEnv("INCLUDE", inc_dir + "shared") AddToPathEnv("INCLUDE", inc_dir + "ucrt") AddToPathEnv("INCLUDE", inc_dir + "um") @@ -2353,11 +2425,21 @@ def SetupVisualStudioEnviron(): # Targeting the 7.1 SDK (which is the only way to have Windows XP support) # with Visual Studio 2015 requires use of the Universal CRT. - if SDK["MSPLATFORM_VERSION"] == '7.1' and SDK["VISUALSTUDIO_VERSION"] == '14.0': + if winsdk_ver == '7.1' and SDK["VISUALSTUDIO_VERSION"] == '14.0': win_kit = GetRegistryKey("SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10") + + # Fallback in case we can't read the registry. + if not win_kit or not os.path.isdir(win_kit): + win_kit = "C:\\Program Files (x86)\\Windows Kits\\10\\" + elif not win_kit.endswith('\\'): + win_kit += '\\' + AddToPathEnv("LIB", win_kit + "Lib\\10.0.10150.0\\ucrt\\" + arch) AddToPathEnv("INCLUDE", win_kit + "Include\\10.0.10150.0\\ucrt") + # Copy the DLLs to the bin directory. + CopyAllFiles(GetOutputDir() + "/bin/", win_kit + "Redist\\ucrt\\DLLs\\" + arch + "\\") + ######################################################################## # # Include and Lib directories. diff --git a/panda/.gitignore b/panda/.gitignore deleted file mode 100644 index ec20cdb1ee..0000000000 --- a/panda/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.pyc -*.pyo -# These are files that are generated within the source tree by the -# ppremake system. -Makefile -pp.dep -/built/ -Opt?-* diff --git a/panda/src/android/pview.cxx b/panda/src/android/pview.cxx index 60ee5eada6..9a29b94574 100644 --- a/panda/src/android/pview.cxx +++ b/panda/src/android/pview.cxx @@ -13,7 +13,6 @@ #include "pandaFramework.h" #include "pandaSystem.h" -#include "pystub.h" #include "texturePool.h" #include "multitexReducer.h" #include "sceneGraphReducer.h" @@ -29,9 +28,6 @@ #include "checkPandaVersion.h" int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - PandaFramework framework; framework.open_framework(argc, argv); framework.set_window_title("Panda Viewer"); diff --git a/panda/src/audiotraits/openalAudioManager.h b/panda/src/audiotraits/openalAudioManager.h index f78e8a53ea..70089c138d 100644 --- a/panda/src/audiotraits/openalAudioManager.h +++ b/panda/src/audiotraits/openalAudioManager.h @@ -23,7 +23,7 @@ #include "reMutex.h" // OSX uses the OpenAL framework -#ifdef IS_OSX +#ifdef HAVE_OPENAL_FRAMEWORK #include #include #else diff --git a/panda/src/audiotraits/openalAudioSound.h b/panda/src/audiotraits/openalAudioSound.h index 95fd736190..3442acb4f2 100644 --- a/panda/src/audiotraits/openalAudioSound.h +++ b/panda/src/audiotraits/openalAudioSound.h @@ -21,7 +21,7 @@ #include "openalAudioManager.h" // OSX uses the OpenAL framework -#ifdef IS_OSX +#ifdef HAVE_OPENAL_FRAMEWORK #include #include #else diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index e8dbe968f2..cb4d39c444 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -36,6 +36,34 @@ BulletBodyNode(const char *name) : PandaNode(name) { set_into_collide_mask(CollideMask::all_on()); } +/** + * + */ +BulletBodyNode:: +BulletBodyNode(const BulletBodyNode ©) : + PandaNode(copy), + _shapes(copy._shapes) +{ + if (copy._shape && copy._shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) { + // btCompoundShape does not define a copy constructor. Manually copy. + btCompoundShape *shape = new btCompoundShape; + _shape = shape; + + btCompoundShape *copy_shape = (btCompoundShape *)copy._shape; + int num_children = copy_shape->getNumChildShapes(); + for (int i = 0; i < num_children; ++i) { + shape->addChildShape(copy_shape->getChildTransform(i), + copy_shape->getChildShape(i)); + } + } + else if (copy._shape && copy._shape->getShapeType() == EMPTY_SHAPE_PROXYTYPE) { + _shape = new btEmptyShape(); + } + else { + _shape = copy._shape; + } +} + /** * Returns the subset of CollideMask bits that may be set for this particular * type of PandaNode. For BodyNodes this returns all bits on. diff --git a/panda/src/bullet/bulletBodyNode.h b/panda/src/bullet/bulletBodyNode.h index 42f43cfd6a..53fe6c7136 100644 --- a/panda/src/bullet/bulletBodyNode.h +++ b/panda/src/bullet/bulletBodyNode.h @@ -33,6 +33,7 @@ class BulletShape; class EXPCL_PANDABULLET BulletBodyNode : public PandaNode { protected: BulletBodyNode(const char *name); + BulletBodyNode(const BulletBodyNode ©); PUBLISHED: INLINE ~BulletBodyNode(); diff --git a/panda/src/bullet/bulletCharacterControllerNode.cxx b/panda/src/bullet/bulletCharacterControllerNode.cxx index 929aaa8001..8d9dfdf434 100644 --- a/panda/src/bullet/bulletCharacterControllerNode.cxx +++ b/panda/src/bullet/bulletCharacterControllerNode.cxx @@ -13,6 +13,10 @@ #include "bulletCharacterControllerNode.h" +#if BT_BULLET_VERSION >= 285 +static const btVector3 up_vectors[3] = {btVector3(1.0f, 0.0f, 0.0f), btVector3(0.0f, 1.0f, 0.0f), btVector3(0.0f, 0.0f, 1.0f)}; +#endif + TypeHandle BulletCharacterControllerNode::_type_handle; /** @@ -54,8 +58,13 @@ BulletCharacterControllerNode(BulletShape *shape, PN_stdfloat step_height, const _angular_movement = 0.0f; // Character controller +#if BT_BULLET_VERSION >= 285 + _character = new btKinematicCharacterController(_ghost, convex, step_height, up_vectors[_up]); + _character->setGravity(up_vectors[_up] * -(btScalar)9.81f); +#else _character = new btKinematicCharacterController(_ghost, convex, step_height, _up); _character->setGravity((btScalar)9.81f); +#endif // Retain a pointer to the shape _shape = shape; @@ -268,8 +277,11 @@ get_max_slope() const { */ PN_stdfloat BulletCharacterControllerNode:: get_gravity() const { - +#if BT_BULLET_VERSION >= 285 + return -(PN_stdfloat)_character->getGravity()[_up]; +#else return (PN_stdfloat)_character->getGravity(); +#endif } /** @@ -277,8 +289,11 @@ get_gravity() const { */ void BulletCharacterControllerNode:: set_gravity(PN_stdfloat gravity) { - +#if BT_BULLET_VERSION >= 285 + _character->setGravity(up_vectors[_up] * -(btScalar)gravity); +#else _character->setGravity((btScalar)gravity); +#endif } diff --git a/panda/src/bullet/bulletGhostNode.cxx b/panda/src/bullet/bulletGhostNode.cxx index 8f8c783943..ddead41067 100644 --- a/panda/src/bullet/bulletGhostNode.cxx +++ b/panda/src/bullet/bulletGhostNode.cxx @@ -55,7 +55,7 @@ void BulletGhostNode:: parents_changed() { Parents parents = get_parents(); - for (int i=0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); TypeHandle type = parent->get_type(); diff --git a/panda/src/bullet/bulletManifoldPoint.I b/panda/src/bullet/bulletManifoldPoint.I index 0086f3020b..6730d2f349 100644 --- a/panda/src/bullet/bulletManifoldPoint.I +++ b/panda/src/bullet/bulletManifoldPoint.I @@ -24,8 +24,15 @@ INLINE BulletManifoldPoint:: */ INLINE void BulletManifoldPoint:: set_lateral_friction_initialized(bool value) { - +#if BT_BULLET_VERSION >= 285 + if (value) { + _pt.m_contactPointFlags |= BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED; + } else { + _pt.m_contactPointFlags &= ~BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED; + } +#else _pt.m_lateralFrictionInitialized = value; +#endif } /** @@ -33,8 +40,11 @@ set_lateral_friction_initialized(bool value) { */ INLINE bool BulletManifoldPoint:: get_lateral_friction_initialized() const { - +#if BT_BULLET_VERSION >= 285 + return (_pt.m_contactPointFlags & BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED) != 0; +#else return _pt.m_lateralFrictionInitialized; +#endif } /** @@ -195,8 +205,9 @@ get_applied_impulse_lateral2() const { */ INLINE void BulletManifoldPoint:: set_contact_cfm1(PN_stdfloat value) { - +#if BT_BULLET_VERSION < 285 _pt.m_contactCFM1 = (btScalar)value; +#endif } /** @@ -204,8 +215,11 @@ set_contact_cfm1(PN_stdfloat value) { */ INLINE PN_stdfloat BulletManifoldPoint:: get_contact_cfm1() const { - +#if BT_BULLET_VERSION < 285 return (PN_stdfloat)_pt.m_contactCFM1; +#else + return 0; +#endif } /** @@ -213,8 +227,9 @@ get_contact_cfm1() const { */ INLINE void BulletManifoldPoint:: set_contact_cfm2(PN_stdfloat value) { - +#if BT_BULLET_VERSION < 285 _pt.m_contactCFM2 = (btScalar)value; +#endif } /** @@ -222,6 +237,9 @@ set_contact_cfm2(PN_stdfloat value) { */ INLINE PN_stdfloat BulletManifoldPoint:: get_contact_cfm2() const { - +#if BT_BULLET_VERSION < 285 return (PN_stdfloat)_pt.m_contactCFM2; +#else + return 0; +#endif } diff --git a/panda/src/bullet/bulletRigidBodyNode.I b/panda/src/bullet/bulletRigidBodyNode.I index 6be1af948f..de1d5eea05 100644 --- a/panda/src/bullet/bulletRigidBodyNode.I +++ b/panda/src/bullet/bulletRigidBodyNode.I @@ -18,7 +18,6 @@ INLINE BulletRigidBodyNode:: ~BulletRigidBodyNode() { delete _rigid; - delete _motion; } /** diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index cc5f5945f5..5c5e722785 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -21,16 +21,12 @@ TypeHandle BulletRigidBodyNode::_type_handle; */ BulletRigidBodyNode:: BulletRigidBodyNode(const char *name) : BulletBodyNode(name) { - - // Motion state - _motion = new MotionState(); - // Mass properties btScalar mass(0.0); btVector3 inertia(0, 0, 0); // construction info - btRigidBody::btRigidBodyConstructionInfo ci(mass, _motion, _shape, inertia); + btRigidBody::btRigidBodyConstructionInfo ci(mass, &_motion, _shape, inertia); // Additional damping if (bullet_additional_damping) { @@ -46,6 +42,31 @@ BulletRigidBodyNode(const char *name) : BulletBodyNode(name) { _rigid->setUserPointer(this); } +/** + * Do not call the copy constructor directly; instead, use make_copy() or + * copy_subgraph() to make a copy of a node. + */ +BulletRigidBodyNode:: +BulletRigidBodyNode(const BulletRigidBodyNode ©) : + BulletBodyNode(copy), + _motion(copy._motion) +{ + _rigid = new btRigidBody(*copy._rigid); + _rigid->setUserPointer(this); + _rigid->setCollisionShape(_shape); + _rigid->setMotionState(&_motion); +} + +/** + * Returns a newly-allocated PandaNode that is a shallow copy of this one. It + * will be a different pointer, but its internal data may or may not be shared + * with that of the original PandaNode. No children will be copied. + */ +PandaNode *BulletRigidBodyNode:: +make_copy() const { + return new BulletRigidBodyNode(*this); +} + /** * */ @@ -255,7 +276,7 @@ apply_central_impulse(const LVector3 &impulse) { void BulletRigidBodyNode:: transform_changed() { - if (_motion->sync_disabled()) return; + if (_motion.sync_disabled()) return; NodePath np = NodePath::any_path((PandaNode *)this); CPT(TransformState) ts = np.get_net_transform(); @@ -265,7 +286,7 @@ transform_changed() { // transform within the motion state. For dynamic bodies we need to store // the net scale within the motion state, since Bullet might update the // transform via MotionState::setWorldTransform. - _motion->set_net_transform(ts); + _motion.set_net_transform(ts); // For dynamic or static bodies we directly apply the new transform. if (!is_kinematic()) { @@ -309,7 +330,7 @@ sync_p2b() { void BulletRigidBodyNode:: sync_b2p() { - _motion->sync_b2p((PandaNode *)this); + _motion.sync_b2p((PandaNode *)this); } /** @@ -564,7 +585,7 @@ pick_dirty_flag() { bool BulletRigidBodyNode:: pick_dirty_flag() { - return _motion->pick_dirty_flag(); + return _motion.pick_dirty_flag(); } /** diff --git a/panda/src/bullet/bulletRigidBodyNode.h b/panda/src/bullet/bulletRigidBodyNode.h index 2d6b54f2f3..ea59c9202c 100644 --- a/panda/src/bullet/bulletRigidBodyNode.h +++ b/panda/src/bullet/bulletRigidBodyNode.h @@ -124,14 +124,16 @@ private: bool _was_dirty; }; - MotionState *_motion; + MotionState _motion; btRigidBody *_rigid; public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *manager, Datagram &dg); + virtual PandaNode *make_copy() const; protected: + BulletRigidBodyNode(const BulletRigidBodyNode ©); static TypedWritable *make_from_bam(const FactoryParams ¶ms); void fillin(DatagramIterator &scan, BamReader *manager); diff --git a/panda/src/chan/animChannelFixed.cxx b/panda/src/chan/animChannelFixed.cxx new file mode 100644 index 0000000000..375e107f62 --- /dev/null +++ b/panda/src/chan/animChannelFixed.cxx @@ -0,0 +1,17 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file animChannelFixed.cxx + * @author rdb + * @date 2016-05-29 + */ + +#include "animChannelFixed.h" + +template class AnimChannelFixed; +template class AnimChannelFixed; diff --git a/panda/src/chan/animChannelFixed.h b/panda/src/chan/animChannelFixed.h index 8835cc6db2..9940f5bdcf 100644 --- a/panda/src/chan/animChannelFixed.h +++ b/panda/src/chan/animChannelFixed.h @@ -62,6 +62,8 @@ private: static TypeHandle _type_handle; }; +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_CHAN, EXPTP_PANDA_CHAN, AnimChannelFixed); +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_CHAN, EXPTP_PANDA_CHAN, AnimChannelFixed); #include "animChannelFixed.I" diff --git a/panda/src/chan/p3chan_composite1.cxx b/panda/src/chan/p3chan_composite1.cxx index 411d6c0a9f..99bac712c7 100644 --- a/panda/src/chan/p3chan_composite1.cxx +++ b/panda/src/chan/p3chan_composite1.cxx @@ -3,6 +3,7 @@ #include "animBundleNode.cxx" #include "animChannel.cxx" #include "animChannelBase.cxx" +#include "animChannelFixed.cxx" #include "animChannelMatrixDynamic.cxx" #include "animChannelMatrixFixed.cxx" #include "animChannelMatrixXfmTable.cxx" diff --git a/panda/src/char/character.cxx b/panda/src/char/character.cxx index a57ec2eda6..ed28ac491e 100644 --- a/panda/src/char/character.cxx +++ b/panda/src/char/character.cxx @@ -228,7 +228,7 @@ calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, bool &found_any, // around this, we will force-recompute all of the bounding volumes of our // parent nodes immediately. Parents parents = get_parents(); - for (int i = 0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); parent->get_bounds(); } diff --git a/panda/src/collide/collisionPlane.cxx b/panda/src/collide/collisionPlane.cxx index 1d7b4ed758..c551464960 100644 --- a/panda/src/collide/collisionPlane.cxx +++ b/panda/src/collide/collisionPlane.cxx @@ -18,6 +18,7 @@ #include "collisionLine.h" #include "collisionRay.h" #include "collisionSegment.h" +#include "collisionTube.h" #include "collisionParabola.h" #include "config_collide.h" #include "pointerToArray.h" @@ -293,6 +294,76 @@ test_intersection_from_segment(const CollisionEntry &entry) const { return new_entry; } +/** + * + */ +PT(CollisionEntry) CollisionPlane:: +test_intersection_from_tube(const CollisionEntry &entry) const { + const CollisionTube *tube; + DCAST_INTO_R(tube, entry.get_from(), 0); + + const LMatrix4 &wrt_mat = entry.get_wrt_mat(); + + LPoint3 from_a = tube->get_point_a() * wrt_mat; + LPoint3 from_b = tube->get_point_b() * wrt_mat; + LVector3 from_radius_v = + LVector3(tube->get_radius(), 0.0f, 0.0f) * wrt_mat; + PN_stdfloat from_radius = length(from_radius_v); + + PN_stdfloat dist_a = _plane.dist_to_plane(from_a); + PN_stdfloat dist_b = _plane.dist_to_plane(from_b); + + if (dist_a >= from_radius && dist_b >= from_radius) { + // Entirely in front of the plane means no intersection. + return NULL; + } + + if (collide_cat.is_debug()) { + collide_cat.debug() + << "intersection detected from " << entry.get_from_node_path() + << " into " << entry.get_into_node_path() << "\n"; + } + PT(CollisionEntry) new_entry = new CollisionEntry(entry); + + LVector3 normal = (has_effective_normal() && tube->get_respect_effective_normal()) ? get_effective_normal() : get_normal(); + new_entry->set_surface_normal(normal); + + PN_stdfloat t; + LVector3 from_direction = from_b - from_a; + if (_plane.intersects_line(t, from_a, from_direction)) { + // It intersects the plane. + if (t >= 1.0f) { + new_entry->set_surface_point(from_b - get_normal() * dist_b); + + } else if (t <= 0.0f) { + new_entry->set_surface_point(from_a - get_normal() * dist_a); + + } else { + // Within the tube! Yay, that means we have a surface point. + new_entry->set_surface_point(from_a + t * from_direction); + } + } else { + // If it's completely parallel, pretend it's colliding in the center of + // the tube. + new_entry->set_surface_point(from_a + 0.5f * from_direction - get_normal() * dist_a); + } + + if (IS_NEARLY_EQUAL(dist_a, dist_b)) { + // Let's be fair and choose the center of the tube. + new_entry->set_interior_point(from_a + 0.5f * from_direction - get_normal() * from_radius); + + } else if (dist_a < dist_b) { + // Point A penetrates deeper. + new_entry->set_interior_point(from_a - get_normal() * from_radius); + + } else if (dist_b < dist_a) { + // No, point B does. + new_entry->set_interior_point(from_b - get_normal() * from_radius); + } + + return new_entry; +} + /** * This is part of the double-dispatch implementation of test_intersection(). * It is called when the "from" object is a parabola. diff --git a/panda/src/collide/collisionPlane.h b/panda/src/collide/collisionPlane.h index 232b52c650..4130cf2151 100644 --- a/panda/src/collide/collisionPlane.h +++ b/panda/src/collide/collisionPlane.h @@ -72,6 +72,8 @@ protected: virtual PT(CollisionEntry) test_intersection_from_segment(const CollisionEntry &entry) const; virtual PT(CollisionEntry) + test_intersection_from_tube(const CollisionEntry &entry) const; + virtual PT(CollisionEntry) test_intersection_from_parabola(const CollisionEntry &entry) const; virtual PT(CollisionEntry) test_intersection_from_box(const CollisionEntry &entry) const; diff --git a/panda/src/collide/collisionSolid.cxx b/panda/src/collide/collisionSolid.cxx index 54a4d36a3f..5f27903b45 100644 --- a/panda/src/collide/collisionSolid.cxx +++ b/panda/src/collide/collisionSolid.cxx @@ -17,6 +17,7 @@ #include "collisionLine.h" #include "collisionRay.h" #include "collisionSegment.h" +#include "collisionTube.h" #include "collisionParabola.h" #include "collisionBox.h" #include "collisionEntry.h" @@ -237,6 +238,17 @@ test_intersection_from_segment(const CollisionEntry &) const { return NULL; } +/** + * This is part of the double-dispatch implementation of test_intersection(). + * It is called when the "from" object is a tube. + */ +PT(CollisionEntry) CollisionSolid:: +test_intersection_from_tube(const CollisionEntry &) const { + report_undefined_intersection_test(CollisionTube::get_class_type(), + get_type()); + return NULL; +} + /** * This is part of the double-dispatch implementation of test_intersection(). * It is called when the "from" object is a parabola. diff --git a/panda/src/collide/collisionSolid.h b/panda/src/collide/collisionSolid.h index 2aa2c082d3..4f80cb922a 100644 --- a/panda/src/collide/collisionSolid.h +++ b/panda/src/collide/collisionSolid.h @@ -108,6 +108,8 @@ protected: virtual PT(CollisionEntry) test_intersection_from_segment(const CollisionEntry &entry) const; virtual PT(CollisionEntry) + test_intersection_from_tube(const CollisionEntry &entry) const; + virtual PT(CollisionEntry) test_intersection_from_parabola(const CollisionEntry &entry) const; virtual PT(CollisionEntry) test_intersection_from_box(const CollisionEntry &entry) const; @@ -175,6 +177,7 @@ private: friend class CollisionLine; friend class CollisionRay; friend class CollisionSegment; + friend class CollisionTube; friend class CollisionParabola; friend class CollisionHandlerFluidPusher; friend class CollisionBox; diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 7c2a5f2c15..2e0802b350 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -14,10 +14,12 @@ #include "collisionSphere.h" #include "collisionLine.h" #include "collisionRay.h" -#include "collisionSegment.h" #include "collisionHandler.h" #include "collisionEntry.h" +#include "collisionSegment.h" +#include "collisionTube.h" #include "collisionParabola.h" +#include "collisionBox.h" #include "config_collide.h" #include "boundingSphere.h" #include "datagram.h" @@ -435,6 +437,62 @@ test_intersection_from_segment(const CollisionEntry &entry) const { return new_entry; } +/** + * + */ +PT(CollisionEntry) CollisionSphere:: +test_intersection_from_tube(const CollisionEntry &entry) const { + const CollisionTube *tube; + DCAST_INTO_R(tube, entry.get_from(), 0); + + const LMatrix4 &wrt_mat = entry.get_wrt_mat(); + + LPoint3 from_a = tube->get_point_a() * wrt_mat; + LPoint3 from_b = tube->get_point_b() * wrt_mat; + LVector3 from_direction = from_b - from_a; + + LVector3 from_radius_v = + LVector3(tube->get_radius(), 0.0f, 0.0f) * wrt_mat; + PN_stdfloat from_radius = length(from_radius_v); + + double t1, t2; + if (!intersects_line(t1, t2, from_a, from_direction, from_radius)) { + // No intersection. + return NULL; + } + + if (t2 < 0.0 || t1 > 1.0) { + // Both intersection points are before the start of the tube or after + // the end of the tube. + return NULL; + } + + PN_stdfloat t = (t1 + t2) * (PN_stdfloat)0.5; + t = max(t, (PN_stdfloat)0.0); + t = min(t, (PN_stdfloat)1.0); + LPoint3 inner_point = from_a + t * from_direction; + + if (collide_cat.is_debug()) { + collide_cat.debug() + << "intersection detected from " << entry.get_from_node_path() + << " into " << entry.get_into_node_path() << "\n"; + } + PT(CollisionEntry) new_entry = new CollisionEntry(entry); + + LVector3 normal = inner_point - get_center(); + normal.normalize(); + new_entry->set_surface_point(get_center() + normal * get_radius()); + new_entry->set_interior_point(inner_point - normal * from_radius); + + if (has_effective_normal() && tube->get_respect_effective_normal()) { + new_entry->set_surface_normal(get_effective_normal()); + } else { + new_entry->set_surface_normal(normal); + } + + return new_entry; +} + /** * */ diff --git a/panda/src/collide/collisionSphere.h b/panda/src/collide/collisionSphere.h index fe5d1d2d7b..f6cb45d804 100644 --- a/panda/src/collide/collisionSphere.h +++ b/panda/src/collide/collisionSphere.h @@ -72,6 +72,8 @@ protected: virtual PT(CollisionEntry) test_intersection_from_segment(const CollisionEntry &entry) const; virtual PT(CollisionEntry) + test_intersection_from_tube(const CollisionEntry &entry) const; + virtual PT(CollisionEntry) test_intersection_from_parabola(const CollisionEntry &entry) const; virtual PT(CollisionEntry) test_intersection_from_box(const CollisionEntry &entry) const; diff --git a/panda/src/collide/collisionTube.cxx b/panda/src/collide/collisionTube.cxx index 17e9cd5c3f..cb3f24f737 100644 --- a/panda/src/collide/collisionTube.cxx +++ b/panda/src/collide/collisionTube.cxx @@ -47,6 +47,14 @@ make_copy() { return new CollisionTube(*this); } +/** + * + */ +PT(CollisionEntry) CollisionTube:: +test_intersection(const CollisionEntry &entry) const { + return entry.get_into()->test_intersection_from_tube(entry); +} + /** * Transforms the solid by the indicated matrix. */ diff --git a/panda/src/collide/collisionTube.h b/panda/src/collide/collisionTube.h index afc14d71dc..fe6a57c981 100644 --- a/panda/src/collide/collisionTube.h +++ b/panda/src/collide/collisionTube.h @@ -40,6 +40,9 @@ public: INLINE CollisionTube(const CollisionTube ©); virtual CollisionSolid *make_copy(); + virtual PT(CollisionEntry) + test_intersection(const CollisionEntry &entry) const; + virtual void xform(const LMatrix4 &mat); virtual PStatCollector &get_volume_pcollector(); diff --git a/panda/src/configfiles/.gitignore b/panda/src/configfiles/.gitignore deleted file mode 100644 index 7bcbfafc88..0000000000 --- a/panda/src/configfiles/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/20_panda.prc diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index d0eb6362b2..c8f7626468 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -638,9 +638,6 @@ do_compute_pixels(int i, int x_size, int y_size, CData *cdata) { Region ®ion = cdata->_regions[i]; - int old_w = region._pixels[1] - region._pixels[0]; - int old_h = region._pixels[3] - region._pixels[2]; - region._pixels[0] = int((region._dimensions[0] * x_size) + 0.5); region._pixels[1] = int((region._dimensions[1] * x_size) + 0.5); region._pixels_i[0] = region._pixels[0]; diff --git a/panda/src/display/frameBufferProperties.cxx b/panda/src/display/frameBufferProperties.cxx index 51120fbec1..98b8341322 100644 --- a/panda/src/display/frameBufferProperties.cxx +++ b/panda/src/display/frameBufferProperties.cxx @@ -659,7 +659,7 @@ setup_color_texture(Texture *tex) const { // as the below one would be generated dynamically by the GSG to reflect the // formats that are supported for render-to-texture. - static const int num_formats = 15; + static const int num_formats = 17; static const struct { unsigned char color_bits, red_bits, green_bits, blue_bits, alpha_bits; bool has_float; @@ -669,6 +669,8 @@ setup_color_texture(Texture *tex) const { { 1, 1, 1, 0, 0, false, Texture::F_rg }, { 1, 1, 1, 1, 0, false, Texture::F_rgb }, { 1, 1, 1, 1, 1, false, Texture::F_rgba }, + { 8, 8, 0, 0, 0, false, Texture::F_red }, + { 16, 8, 8, 0, 0, false, Texture::F_rg }, { 24, 8, 8, 8, 0, false, Texture::F_rgb8 }, { 32, 8, 8, 8, 8, false, Texture::F_rgba8 }, { 16, 16, 0, 0, 0, true, Texture::F_r16 }, diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index ac2c194195..ad3aa3caa6 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -118,6 +118,23 @@ PStatCollector GraphicsEngine::_occlusion_passed_pcollector("Occlusion results:V PStatCollector GraphicsEngine::_occlusion_failed_pcollector("Occlusion results:Occluded"); PStatCollector GraphicsEngine::_occlusion_tests_pcollector("Occlusion tests"); +// This is used to keep track of which scenes we have already culled. +struct CullKey { + GraphicsStateGuardian *_gsg; + NodePath _camera; + int _lens_index; +}; + +INLINE static bool operator < (const CullKey &a, const CullKey &b) { + if (a._gsg != b._gsg) { + return a._gsg < b._gsg; + } + if (a._camera != b._camera) { + return a._camera < b._camera; + } + return a._lens_index < b._lens_index; +} + /** * Creates a new GraphicsEngine object. The Pipeline is normally left to * default to NULL, which indicates the global render pipeline, but it may be @@ -1375,7 +1392,6 @@ cull_to_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { // Keep track of the cameras we have already used in this thread to render // DisplayRegions. - typedef pair CullKey; typedef pmap AlreadyCulled; AlreadyCulled already_culled; @@ -1390,10 +1406,13 @@ cull_to_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { if (dr != (DisplayRegion *)NULL) { DisplayRegionPipelineReader *dr_reader = new DisplayRegionPipelineReader(dr, current_thread); - NodePath camera = dr_reader->get_camera(); - int lens_index = dr_reader->get_lens_index(); - AlreadyCulled::iterator aci = already_culled.insert(AlreadyCulled::value_type(CullKey(camera, lens_index), (DisplayRegion *)NULL)).first; + CullKey key; + key._gsg = win->get_gsg(); + key._camera = dr_reader->get_camera(); + key._lens_index = dr_reader->get_lens_index(); + + AlreadyCulled::iterator aci = already_culled.insert(AlreadyCulled::value_type(key, (DisplayRegion *)NULL)).first; if ((*aci).second == NULL) { // We have not used this camera already in this thread. Perform // the cull operation. @@ -1508,7 +1527,7 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { // We have to place this collector inside begin_frame, because we need // a current context for PStatGPUTimer to work. { - PStatGPUTimer timer(win->get_gsg(), win->get_draw_window_pcollector(), current_thread); + PStatGPUTimer timer(gsg, win->get_draw_window_pcollector(), current_thread); win->clear(current_thread); if (display_cat.is_spam()) { @@ -1528,8 +1547,8 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { if (_auto_flip) { #ifdef DO_PSTATS // This is a good time to perform a latency query. - if (win->get_gsg()->get_timer_queries_active()) { - win->get_gsg()->issue_timer_query(GraphicsStateGuardian::_command_latency_pcollector.get_index()); + if (gsg->get_timer_queries_active()) { + gsg->issue_timer_query(GraphicsStateGuardian::_command_latency_pcollector.get_index()); } #endif @@ -1541,7 +1560,7 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { win->begin_flip(); } { - PStatGPUTimer timer(win->get_gsg(), GraphicsEngine::_flip_end_pcollector, current_thread); + PStatGPUTimer timer(gsg, GraphicsEngine::_flip_end_pcollector, current_thread); win->end_flip(); } } diff --git a/panda/src/display/graphicsPipeSelection.cxx b/panda/src/display/graphicsPipeSelection.cxx index 9ac0e8aa1f..cef68b22c2 100644 --- a/panda/src/display/graphicsPipeSelection.cxx +++ b/panda/src/display/graphicsPipeSelection.cxx @@ -105,6 +105,8 @@ get_pipe_type(int n) const { LightMutexHolder holder(_lock); if (n >= 0 && n < (int)_pipe_types.size()) { result = _pipe_types[n]._type; + } else { + result = TypeHandle::none(); } } return result; diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 18d35d7f78..67fbdb2f6c 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -235,6 +235,7 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _supports_basic_shaders = false; _supports_geometry_shaders = false; _supports_tessellation_shaders = false; + _supports_compute_shaders = false; _supports_glsl = false; _supports_hlsl = false; @@ -1362,8 +1363,18 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name, } } - // TODO: dummy light - nassertr(false, &LMatrix4::ident_mat()); + // Apply the default OpenGL lights otherwise. + // Special exception for light 0, which defaults to white. + if (index == 0) { + string basename = name->get_basename(); + if (basename == "color" || basename == "diffuse") { + t.set_row(3, _light_color_scale); + return &t; + } else if (basename == "specular") { + return &LMatrix4::ones_mat(); + } + } + return fetch_specified_member(NodePath(), name, t); } default: nassertr(false /*should never get here*/, &LMatrix4::ident_mat()); @@ -1394,8 +1405,16 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) static const CPT_InternalName IN_quadraticAttenuation("quadraticAttenuation"); static const CPT_InternalName IN_shadowMatrix("shadowMatrix"); + PandaNode *node = NULL; + if (!np.is_empty()) { + node = np.node(); + } + if (attrib == IN_color) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::ident_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ident_mat()); LColor c = light->get_color(); c.componentwise_mult(_light_color_scale); @@ -1403,9 +1422,12 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) return &t; } else if (attrib == IN_ambient) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::ident_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ident_mat()); - if (np.node()->is_of_type(AmbientLight::get_class_type())) { + if (node->is_of_type(AmbientLight::get_class_type())) { LColor c = light->get_color(); c.componentwise_mult(_light_color_scale); t.set_row(3, c); @@ -1416,9 +1438,12 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) return &t; } else if (attrib == IN_diffuse) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::ident_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ones_mat()); - if (np.node()->is_of_type(AmbientLight::get_class_type())) { + if (node->is_of_type(AmbientLight::get_class_type())) { // Ambient light has no diffuse color. t.set_row(3, LColor(0.0f, 0.0f, 0.0f, 1.0f)); } else { @@ -1429,19 +1454,25 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) return &t; } else if (attrib == IN_specular) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::ident_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ones_mat()); t.set_row(3, light->get_specular_color()); return &t; } else if (attrib == IN_position) { - if (np.node()->is_of_type(AmbientLight::get_class_type())) { + if (np.is_empty()) { + t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0); + return &t; + } else if (node->is_of_type(AmbientLight::get_class_type())) { // Ambient light has no position. t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); return &t; - } else if (np.node()->is_of_type(DirectionalLight::get_class_type())) { + } else if (node->is_of_type(DirectionalLight::get_class_type())) { DirectionalLight *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); CPT(TransformState) transform = np.get_transform(_scene_setup->get_scene_root().get_parent()); LVector3 dir = -(light->get_direction() * transform->get_mat()); @@ -1450,7 +1481,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) return &t; } else { LightLensNode *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); Lens *lens = light->get_lens(); nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat()); @@ -1465,13 +1496,16 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) } } else if (attrib == IN_halfVector) { - if (np.node()->is_of_type(AmbientLight::get_class_type())) { + if (np.is_empty()) { + t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0); + return &t; + } else if (node->is_of_type(AmbientLight::get_class_type())) { // Ambient light has no half-vector. t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); return &t; - } else if (np.node()->is_of_type(DirectionalLight::get_class_type())) { + } else if (node->is_of_type(DirectionalLight::get_class_type())) { DirectionalLight *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); CPT(TransformState) transform = np.get_transform(_scene_setup->get_scene_root().get_parent()); LVector3 dir = -(light->get_direction() * transform->get_mat()); @@ -1483,7 +1517,7 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) return &t; } else { LightLensNode *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); Lens *lens = light->get_lens(); nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat()); @@ -1501,13 +1535,16 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) } } else if (attrib == IN_spotDirection) { - if (np.node()->is_of_type(AmbientLight::get_class_type())) { + if (node == (PandaNode *)NULL) { + t.set_row(3, LVector3(0.0f, 0.0f, -1.0f)); + return &t; + } else if (node->is_of_type(AmbientLight::get_class_type())) { // Ambient light has no spot direction. t.set_row(3, LVector3(0.0f, 0.0f, 0.0f)); return &t; } else { LightLensNode *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); Lens *lens = light->get_lens(); nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat()); @@ -1522,9 +1559,10 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) } } else if (attrib == IN_spotCutoff) { - if (np.node()->is_of_type(Spotlight::get_class_type())) { + if (node != (PandaNode *)NULL && + node->is_of_type(Spotlight::get_class_type())) { LightLensNode *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); Lens *lens = light->get_lens(); nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat()); @@ -1538,9 +1576,10 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) } } else if (attrib == IN_spotCosCutoff) { - if (np.node()->is_of_type(Spotlight::get_class_type())) { + if (node != (PandaNode *)NULL && + node->is_of_type(Spotlight::get_class_type())) { LightLensNode *light; - DCAST_INTO_R(light, np.node(), &LMatrix4::ident_mat()); + DCAST_INTO_R(light, node, &LMatrix4::ident_mat()); Lens *lens = light->get_lens(); nassertr(lens != (Lens *)NULL, &LMatrix4::ident_mat()); @@ -1552,51 +1591,72 @@ fetch_specified_member(const NodePath &np, CPT_InternalName attrib, LMatrix4 &t) t.set_row(3, LVecBase4(-1)); return &t; } + } else if (attrib == IN_spotExponent) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::zeros_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ident_mat()); t.set_row(3, LVecBase4(light->get_exponent())); return &t; } else if (attrib == IN_attenuation) { - Light *light = np.node()->as_light(); - nassertr(light != (Light *)NULL, &LMatrix4::ones_mat()); + if (node != (PandaNode *)NULL) { + Light *light = node->as_light(); + nassertr(light != (Light *)NULL, &LMatrix4::ones_mat()); - t.set_row(3, LVecBase4(light->get_attenuation(), 0)); + t.set_row(3, LVecBase4(light->get_attenuation(), 0)); + } else { + t.set_row(3, LVecBase4(1, 0, 0, 0)); + } return &t; } else if (attrib == IN_constantAttenuation) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::ones_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ones_mat()); t.set_row(3, LVecBase4(light->get_attenuation()[0])); return &t; } else if (attrib == IN_linearAttenuation) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::zeros_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ident_mat()); t.set_row(3, LVecBase4(light->get_attenuation()[1])); return &t; } else if (attrib == IN_quadraticAttenuation) { - Light *light = np.node()->as_light(); + if (node == (PandaNode *)NULL) { + return &LMatrix4::zeros_mat(); + } + Light *light = node->as_light(); nassertr(light != (Light *)NULL, &LMatrix4::ident_mat()); t.set_row(3, LVecBase4(light->get_attenuation()[2])); return &t; } else if (attrib == IN_shadowMatrix) { - LensNode *lnode; - DCAST_INTO_R(lnode, np.node(), &LMatrix4::ident_mat()); - Lens *lens = lnode->get_lens(); - static const LMatrix4 biasmat(0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f); + if (node == (PandaNode *)NULL) { + return &biasmat; + } + + LensNode *lnode; + DCAST_INTO_R(lnode, node, &LMatrix4::ident_mat()); + Lens *lens = lnode->get_lens(); + t = get_external_transform()->get_mat() * get_scene()->get_camera_transform()->get_mat() * np.get_net_transform()->get_inverse()->get_mat() * @@ -2060,8 +2120,6 @@ flush_timer_queries() { _last_num_queried = first; - int frame_index = ClockObject::get_global_clock()->get_frame_count(); - for (int i = 0; i < first; ++i) { CPT(TimerQueryContext) query = _pending_timer_queries[i]; diff --git a/panda/src/display/standardMunger.I b/panda/src/display/standardMunger.I index 4ebd308de2..e9dd4b43f8 100644 --- a/panda/src/display/standardMunger.I +++ b/panda/src/display/standardMunger.I @@ -18,13 +18,3 @@ INLINE GraphicsStateGuardian *StandardMunger:: get_gsg() const { return (GraphicsStateGuardian *)GeomMunger::get_gsg(); } - -/** - * Returns the render mode active on this munger. Intended for derived - * classes that may have to munge differently depending on render mode. - */ -INLINE RenderModeAttrib::Mode StandardMunger:: -get_render_mode() const { - return (_render_mode != NULL) ? _render_mode->get_mode() - : RenderModeAttrib::M_filled; -} diff --git a/panda/src/display/standardMunger.cxx b/panda/src/display/standardMunger.cxx index 1f88f23c46..b6bc1ada2a 100644 --- a/panda/src/display/standardMunger.cxx +++ b/panda/src/display/standardMunger.cxx @@ -38,9 +38,6 @@ StandardMunger(GraphicsStateGuardianBase *gsg, const RenderState *state, _auto_shader(false), _shader_skinning(false) { - _render_mode = (const RenderModeAttrib *) - state->get_attrib(RenderModeAttrib::get_class_slot()); - if (!get_gsg()->get_runtime_color_scale()) { // We might need to munge the colors. const ColorAttrib *color_attrib; @@ -183,14 +180,14 @@ munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data, // it rather than draw them one by one. if ((unsupported_bits & Geom::GR_composite_bits) != 0 || (unsupported_bits & Geom::GR_strip_cut_index) != 0) { -/* - * This decomposes everything in the primitive, so that if (for instance) the - * primitive contained both strips and fans, but the GSG didn't support fans, - * it would decompose the strips too. To handle this correctly, we'd need a - * separate decompose_fans() and decompose_strips() call; but for now, we'll - * just say it's good enough. In practice, we don't have any GSG's that can - * support strips without also supporting fans. - */ + + // This decomposes everything in the primitive, so that if (for + // instance) the primitive contained both strips and fans, but the GSG + // didn't support fans, it would decompose the strips too. To handle + // this correctly, we'd need a separate decompose_fans() and + // decompose_strips() call; but for now, we'll just say it's good + // enough. In practice, we don't have any GSG's that can support strips + // without also supporting fans. geom = geom->decompose(); // Decomposing might produce an indexed Geom, so re-check the @@ -228,14 +225,14 @@ premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data) { // it rather than draw them one by one. if ((unsupported_bits & Geom::GR_composite_bits) != 0 || (unsupported_bits & Geom::GR_strip_cut_index) != 0) { -/* - * This decomposes everything in the primitive, so that if (for instance) the - * primitive contained both strips and fans, but the GSG didn't support fans, - * it would decompose the strips too. To handle this correctly, we'd need a - * separate decompose_fans() and decompose_strips() call; but for now, we'll - * just say it's good enough. In practice, we don't have any GSG's that can - * support strips without also supporting fans. - */ + + // This decomposes everything in the primitive, so that if (for + // instance) the primitive contained both strips and fans, but the GSG + // didn't support fans, it would decompose the strips too. To handle + // this correctly, we'd need a separate decompose_fans() and + // decompose_strips() call; but for now, we'll just say it's good + // enough. In practice, we don't have any GSG's that can support strips + // without also supporting fans. geom = geom->decompose(); // Decomposing might produce an indexed Geom, so re-check the @@ -267,10 +264,6 @@ int StandardMunger:: compare_to_impl(const GeomMunger *other) const { const StandardMunger *om = (const StandardMunger *)other; - if (_render_mode != om->_render_mode) { - return _render_mode < om->_render_mode ? -1 : 1; - } - if (_munge_color != om->_munge_color) { return (int)_munge_color - (int)om->_munge_color; } diff --git a/panda/src/display/standardMunger.h b/panda/src/display/standardMunger.h index 6a6dd9e675..05e8ee0344 100644 --- a/panda/src/display/standardMunger.h +++ b/panda/src/display/standardMunger.h @@ -46,13 +46,10 @@ protected: virtual int geom_compare_to_impl(const GeomMunger *other) const; virtual CPT(RenderState) munge_state_impl(const RenderState *state); - INLINE RenderModeAttrib::Mode get_render_mode() const; - private: int _num_components; NumericType _numeric_type; Contents _contents; - CPT(RenderModeAttrib) _render_mode; bool _munge_color; bool _munge_color_scale; diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index 0366107669..26baaff0c1 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -1110,7 +1110,7 @@ get_ssl_ctx() { _ssl_ctx = SSL_CTX_new(SSLv23_client_method()); -#if defined(SSL_097) && !defined(NDEBUG) +#ifndef NDEBUG // If we have debugging enabled, set a callback that allows us to report the // SSL messages as they are sent and received. if (downloader_cat.is_debug()) { @@ -1554,7 +1554,7 @@ split_whitespace(string &a, string &b, const string &c) { b = c.substr(p); } -#if defined(SSL_097) && !defined(NDEBUG) +#ifndef NDEBUG /** * This method is attached as a callback for SSL messages only when debug * output is enabled. @@ -1614,7 +1614,7 @@ ssl_msg_callback(int write_p, int version, int content_type, downloader_cat.debug() << describe.str(); } -#endif // defined(SSL_097) && !defined(NDEBUG) +#endif // !defined(NDEBUG) /** * diff --git a/panda/src/downloader/httpClient.h b/panda/src/downloader/httpClient.h index 32f9d38a7b..d901066357 100644 --- a/panda/src/downloader/httpClient.h +++ b/panda/src/downloader/httpClient.h @@ -155,7 +155,7 @@ private: static void split_whitespace(string &a, string &b, const string &c); -#if defined(SSL_097) && !defined(NDEBUG) +#ifndef NDEBUG static void ssl_msg_callback(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); diff --git a/panda/src/downloader/multiplexStreamBuf.cxx b/panda/src/downloader/multiplexStreamBuf.cxx index daa2d78ed9..96d4a22755 100644 --- a/panda/src/downloader/multiplexStreamBuf.cxx +++ b/panda/src/downloader/multiplexStreamBuf.cxx @@ -12,7 +12,6 @@ */ #include "multiplexStreamBuf.h" -#include "lightMutexHolder.h" #if defined(WIN32_VC) || defined(WIN64_VC) #define WINDOWS_LEAN_AND_MEAN @@ -114,8 +113,6 @@ void MultiplexStreamBuf:: add_output(MultiplexStreamBuf::BufferType buffer_type, MultiplexStreamBuf::OutputType output_type, ostream *out, FILE *fout, bool owns_obj) { - // Ensure that we have the mutex while we fiddle with the list of outputs. - LightMutexHolder holder(_lock); Output o; o._buffer_type = buffer_type; @@ -123,7 +120,11 @@ add_output(MultiplexStreamBuf::BufferType buffer_type, o._out = out; o._fout = fout; o._owns_obj = owns_obj; + + // Ensure that we have the mutex while we fiddle with the list of outputs. + _lock.acquire(); _outputs.push_back(o); + _lock.release(); } @@ -132,9 +133,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type, */ void MultiplexStreamBuf:: flush() { - LightMutexHolder holder(_lock); - + _lock.acquire(); write_chars("", 0, true); + _lock.release(); } /** @@ -143,7 +144,7 @@ flush() { */ int MultiplexStreamBuf:: overflow(int ch) { - LightMutexHolder holder(_lock); + _lock.acquire(); streamsize n = pptr() - pbase(); @@ -158,6 +159,7 @@ overflow(int ch) { write_chars(&c, 1, false); } + _lock.release(); return 0; } @@ -167,7 +169,7 @@ overflow(int ch) { */ int MultiplexStreamBuf:: sync() { - LightMutexHolder holder(_lock); + _lock.acquire(); streamsize n = pptr() - pbase(); @@ -179,6 +181,7 @@ sync() { write_chars(pbase(), n, false); pbump(-n); + _lock.release(); return 0; // Return 0 for success, EOF to indicate write full. } diff --git a/panda/src/downloader/multiplexStreamBuf.h b/panda/src/downloader/multiplexStreamBuf.h index 52a75c5ff9..d869124116 100644 --- a/panda/src/downloader/multiplexStreamBuf.h +++ b/panda/src/downloader/multiplexStreamBuf.h @@ -17,7 +17,7 @@ #include "pandabase.h" #include "pvector.h" -#include "lightMutex.h" +#include "mutexImpl.h" #include /** @@ -70,7 +70,7 @@ private: typedef pvector Outputs; Outputs _outputs; - LightMutex _lock; + MutexImpl _lock; string _line_buffer; }; diff --git a/panda/src/downloadertools/apply_patch.cxx b/panda/src/downloadertools/apply_patch.cxx index 105064f3c9..908f3c8189 100644 --- a/panda/src/downloadertools/apply_patch.cxx +++ b/panda/src/downloadertools/apply_patch.cxx @@ -10,7 +10,6 @@ */ #include "pandabase.h" -#include "pystub.h" #include "panda_getopt.h" #include "preprocess_argv.h" #include "patchfile.h" @@ -18,9 +17,6 @@ int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - preprocess_argv(argc, argv); if (argc < 3) { diff --git a/panda/src/downloadertools/build_patch.cxx b/panda/src/downloadertools/build_patch.cxx index a107c45ad6..d14e27db9f 100644 --- a/panda/src/downloadertools/build_patch.cxx +++ b/panda/src/downloadertools/build_patch.cxx @@ -10,7 +10,6 @@ */ #include "pandabase.h" -#include "pystub.h" #include "panda_getopt.h" #include "preprocess_argv.h" #include "patchfile.h" @@ -51,9 +50,6 @@ help() { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - Filename patch_file; bool complete_file = false; int footprint_length = 0; diff --git a/panda/src/downloadertools/check_adler.cxx b/panda/src/downloadertools/check_adler.cxx index 8c98b4c3d6..b53eb2839f 100644 --- a/panda/src/downloadertools/check_adler.cxx +++ b/panda/src/downloadertools/check_adler.cxx @@ -10,13 +10,9 @@ */ #include "download_utils.h" -#include "pystub.h" int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - if (argc < 2) { cerr << "Usage: check_adler " << endl; return 1; diff --git a/panda/src/downloadertools/check_crc.cxx b/panda/src/downloadertools/check_crc.cxx index 49313f818b..9afadd4fb2 100644 --- a/panda/src/downloadertools/check_crc.cxx +++ b/panda/src/downloadertools/check_crc.cxx @@ -10,13 +10,9 @@ */ #include "download_utils.h" -#include "pystub.h" int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - if (argc < 2) { cerr << "Usage: check_crc " << endl; return 1; diff --git a/panda/src/downloadertools/check_md5.cxx b/panda/src/downloadertools/check_md5.cxx index c706d4fb2a..5b386c7c1e 100644 --- a/panda/src/downloadertools/check_md5.cxx +++ b/panda/src/downloadertools/check_md5.cxx @@ -10,7 +10,6 @@ */ #include "pandabase.h" -#include "pystub.h" #include "hashVal.h" #include "filename.h" #include "panda_getopt.h" @@ -65,9 +64,6 @@ output_hash(const string &filename, const HashVal &hash) { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - extern char *optarg; extern int optind; const char *optstr = "i:db:qh"; diff --git a/panda/src/downloadertools/multify.cxx b/panda/src/downloadertools/multify.cxx index 72506f4095..8f3df9ce14 100644 --- a/panda/src/downloadertools/multify.cxx +++ b/panda/src/downloadertools/multify.cxx @@ -10,7 +10,6 @@ */ #include "pandabase.h" -#include "pystub.h" #include "panda_getopt.h" #include "preprocess_argv.h" #include "multifile.h" @@ -758,9 +757,6 @@ tokenize_extensions(const string &str, pset &extensions) { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - preprocess_argv(argc, argv); if (argc < 2) { usage(); diff --git a/panda/src/downloadertools/pdecrypt.cxx b/panda/src/downloadertools/pdecrypt.cxx index 55791f14c3..73a242fda1 100644 --- a/panda/src/downloadertools/pdecrypt.cxx +++ b/panda/src/downloadertools/pdecrypt.cxx @@ -11,7 +11,6 @@ * @date 2004-09-01 */ -#include "pystub.h" #include "filename.h" #include "encrypt_string.h" #include "pnotify.h" @@ -46,9 +45,6 @@ usage() { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - extern char *optarg; extern int optind; const char *optstr = "o:p:h"; diff --git a/panda/src/downloadertools/pencrypt.cxx b/panda/src/downloadertools/pencrypt.cxx index d37cd64a48..5f8774c4d9 100644 --- a/panda/src/downloadertools/pencrypt.cxx +++ b/panda/src/downloadertools/pencrypt.cxx @@ -11,7 +11,6 @@ * @date 2004-09-01 */ -#include "pystub.h" #include "filename.h" #include "encrypt_string.h" #include "pnotify.h" diff --git a/panda/src/downloadertools/punzip.cxx b/panda/src/downloadertools/punzip.cxx index 82d3693522..5753f7b6ec 100644 --- a/panda/src/downloadertools/punzip.cxx +++ b/panda/src/downloadertools/punzip.cxx @@ -9,7 +9,6 @@ * @file punzip.cxx */ -#include "pystub.h" #include "filename.h" #include "compress_string.h" #include "pnotify.h" @@ -31,9 +30,6 @@ usage() { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - extern char *optarg; extern int optind; const char *optstr = "o:ch"; diff --git a/panda/src/downloadertools/pzip.cxx b/panda/src/downloadertools/pzip.cxx index 25eb02ac7c..6364be0130 100644 --- a/panda/src/downloadertools/pzip.cxx +++ b/panda/src/downloadertools/pzip.cxx @@ -9,7 +9,6 @@ * @file pzip.cxx */ -#include "pystub.h" #include "filename.h" #include "compress_string.h" #include "pnotify.h" @@ -55,9 +54,6 @@ usage() { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - extern char *optarg; extern int optind; const char *optstr = "o:c123456789h"; diff --git a/panda/src/downloadertools/show_ddb.cxx b/panda/src/downloadertools/show_ddb.cxx index 6d82df7f02..d19c3be9cd 100644 --- a/panda/src/downloadertools/show_ddb.cxx +++ b/panda/src/downloadertools/show_ddb.cxx @@ -12,15 +12,11 @@ */ #include "pandabase.h" -#include "pystub.h" #include "downloadDb.h" #include "filename.h" int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - if (argc != 3) { cerr << "Usage: show_ddb server.ddb client.ddb\n"; return 1; diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx index 03b5e8b6cb..4b5efc2b8c 100644 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx @@ -403,10 +403,35 @@ extract_texture_data(Texture *tex) { */ ShaderContext *DXGraphicsStateGuardian9:: prepare_shader(Shader *se) { + PStatTimer timer(_prepare_shader_pcollector); + + switch (se->get_language()) { + case Shader::SL_GLSL: + dxgsg9_cat.error() + << "Tried to load GLSL shader, but GLSL shaders not supported by Direct3D 9.\n"; + return NULL; + + case Shader::SL_Cg: #ifdef HAVE_CG - CLP(ShaderContext) *result = new CLP(ShaderContext)(se, this); - return result; + if (_supports_basic_shaders) { + return new DXShaderContext9(se, this); + } else { + dxgsg9_cat.error() + << "Tried to load Cg shader, but basic shaders not supported.\n"; + return NULL; + } +#else + dxgsg9_cat.error() + << "Tried to load Cg shader, but Cg support not compiled in.\n"; + return NULL; #endif + + default: + dxgsg9_cat.error() + << "Tried to load shader with unsupported shader language!\n"; + return NULL; + } + return NULL; } @@ -415,7 +440,7 @@ prepare_shader(Shader *se) { */ void DXGraphicsStateGuardian9:: release_shader(ShaderContext *sc) { - CLP(ShaderContext) *gsc = DCAST(CLP(ShaderContext), sc); + DXShaderContext9 *gsc = DCAST(DXShaderContext9, sc); delete gsc; } @@ -429,9 +454,9 @@ release_shader(ShaderContext *sc) { * This function should not be called directly to prepare a buffer. Instead, * call Geom::prepare(). */ -VertexBufferContext *CLP(GraphicsStateGuardian):: +VertexBufferContext *DXGraphicsStateGuardian9:: prepare_vertex_buffer(GeomVertexArrayData *data) { - CLP(VertexBufferContext) *dvbc = new CLP(VertexBufferContext)(this, _prepared_objects, data); + DXVertexBufferContext9 *dvbc = new DXVertexBufferContext9(this, _prepared_objects, data); DWORD usage; D3DPOOL pool; @@ -458,7 +483,7 @@ prepare_vertex_buffer(GeomVertexArrayData *data) { if (!FAILED(hr)) { #if 0 - if (dxgsg9_cat.is_debug() && CLP(debug_buffers)) { + if (dxgsg9_cat.is_debug() && DXdebug_buffers9) { dxgsg9_cat.debug() << "creating vertex buffer " << dvbc->_vbuffer << ": " << data->get_num_rows() << " vertices " @@ -481,16 +506,16 @@ prepare_vertex_buffer(GeomVertexArrayData *data) { * Updates the vertex buffer with the current data, and makes it the current * vertex buffer for rendering. */ -bool CLP(GraphicsStateGuardian):: +bool DXGraphicsStateGuardian9:: apply_vertex_buffer(VertexBufferContext *vbc, const GeomVertexArrayDataHandle *reader, bool force ) { - CLP(VertexBufferContext) *dvbc = DCAST(CLP(VertexBufferContext), vbc); + DXVertexBufferContext9 *dvbc = DCAST(DXVertexBufferContext9, vbc); if (dvbc->was_modified(reader)) { int num_bytes = reader->get_data_size_bytes(); #if 0 - if (dxgsg9_cat.is_debug() && CLP(debug_buffers)) { + if (dxgsg9_cat.is_debug() && DXdebug_buffers9) { dxgsg9_cat.debug() << "copying " << num_bytes << " bytes into vertex buffer " << dvbc->_vbuffer << "\n"; @@ -544,13 +569,13 @@ apply_vertex_buffer(VertexBufferContext *vbc, * should never be called directly; instead, call Data::release() (or simply * let the Data destruct). */ -void CLP(GraphicsStateGuardian):: +void DXGraphicsStateGuardian9:: release_vertex_buffer(VertexBufferContext *vbc) { - CLP(VertexBufferContext) *dvbc = DCAST(CLP(VertexBufferContext), vbc); + DXVertexBufferContext9 *dvbc = DCAST(DXVertexBufferContext9, vbc); #if 0 - if (dxgsg9_cat.is_debug() && CLP(debug_buffers)) { + if (dxgsg9_cat.is_debug() && DXdebug_buffers9) { dxgsg9_cat.debug() << "deleting vertex buffer " << dvbc->_vbuffer << "\n"; } @@ -575,8 +600,8 @@ release_vertex_buffer(VertexBufferContext *vbc) { * If force is not true, the function may return false indicating the data is * not currently available. */ -bool CLP(GraphicsStateGuardian):: -setup_array_data(CLP(VertexBufferContext)*& dvbc, +bool DXGraphicsStateGuardian9:: +setup_array_data(DXVertexBufferContext9*& dvbc, const GeomVertexArrayDataHandle* array_reader, bool force) { @@ -587,7 +612,7 @@ setup_array_data(CLP(VertexBufferContext)*& dvbc, return false; } - dvbc = (CLP(VertexBufferContext)*)vbc; + dvbc = (DXVertexBufferContext9*)vbc; return true; } @@ -1028,17 +1053,17 @@ end_scene() { if (_vertex_array_shader_context != 0) { _vertex_array_shader_context->disable_shader_vertex_arrays(this); _vertex_array_shader = (Shader *)NULL; - _vertex_array_shader_context = (CLP(ShaderContext) *)NULL; + _vertex_array_shader_context = (DXShaderContext9 *)NULL; } if (_texture_binding_shader_context != 0) { _texture_binding_shader_context->disable_shader_texture_bindings(this); _texture_binding_shader = (Shader *)NULL; - _texture_binding_shader_context = (CLP(ShaderContext) *)NULL; + _texture_binding_shader_context = (DXShaderContext9 *)NULL; } if (_current_shader_context != 0) { _current_shader_context->unbind(this); _current_shader = (Shader *)NULL; - _current_shader_context = (CLP(ShaderContext) *)NULL; + _current_shader_context = (DXShaderContext9 *)NULL; } _dlights.clear(); @@ -1242,7 +1267,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, * pipeline is about to be used - dxShaderContexts are responsible for setting * up their own vertex arrays. */ -bool CLP(GraphicsStateGuardian):: +bool DXGraphicsStateGuardian9:: update_standard_vertex_arrays(bool force) { int fvf = 0; @@ -1257,7 +1282,7 @@ update_standard_vertex_arrays(bool force) { } // Get the vertex buffer for this array. - CLP(VertexBufferContext)* dvbc; + DXVertexBufferContext9* dvbc; if (!setup_array_data(dvbc, array_reader, force)) { dxgsg9_cat.error() << "Unable to setup vertex buffer for array " << array_index << "\n"; return false; @@ -1290,7 +1315,7 @@ update_standard_vertex_arrays(bool force) { * so, the standard streams need to be disabled to get them "out of the way." * Called only from begin_draw_primitives. */ -void CLP(GraphicsStateGuardian):: +void DXGraphicsStateGuardian9:: disable_standard_vertex_arrays() { for ( int array_index = 0; array_index < _num_bound_streams; ++array_index ) { @@ -2184,7 +2209,8 @@ reset() { Geom::GR_point_perspective | Geom::GR_point_sprite | Geom::GR_indexed_other | Geom::GR_triangle_strip | Geom::GR_triangle_fan | - Geom::GR_flat_first_vertex; + Geom::GR_flat_first_vertex | + Geom::GR_render_mode_wireframe | Geom::GR_render_mode_point; // overwrite gsg defaults with these values @@ -2383,7 +2409,7 @@ reset() { // OVERRIDE SUPPORT SINCE IT DOES NOT WORK WELL _screen->_supports_automatic_mipmap_generation = false; - this -> reset_render_states ( ); + reset_render_states(); _max_vertices_per_array = d3d_caps.MaxVertexIndex; _max_vertices_per_primitive = d3d_caps.MaxPrimitiveCount; @@ -2646,11 +2672,11 @@ reset() { set_render_state(D3DRS_BLENDOP, D3DBLENDOP_ADD); _current_shader = (Shader *)NULL; - _current_shader_context = (CLP(ShaderContext) *)NULL; + _current_shader_context = (DXShaderContext9 *)NULL; _vertex_array_shader = (Shader *)NULL; - _vertex_array_shader_context = (CLP(ShaderContext) *)NULL; + _vertex_array_shader_context = (DXShaderContext9 *)NULL; _texture_binding_shader = (Shader *)NULL; - _texture_binding_shader_context = (CLP(ShaderContext) *)NULL; + _texture_binding_shader_context = (DXShaderContext9 *)NULL; PRINT_REFCNT(dxgsg9, _d3d_device); @@ -2775,13 +2801,13 @@ do_issue_alpha_test() { void DXGraphicsStateGuardian9:: do_issue_shader() { - CLP(ShaderContext) *context = 0; + DXShaderContext9 *context = 0; Shader *shader = 0; if (_target_shader) { shader = (Shader *)(_target_shader->get_shader()); } if (shader) { - context = (CLP(ShaderContext) *)(shader->prepare_now(get_prepared_objects(), this)); + context = (DXShaderContext9 *)(shader->prepare_now(get_prepared_objects(), this)); } if (context == 0 || (context && context -> valid (this) == false)) { @@ -2819,7 +2845,8 @@ do_issue_shader() { */ void DXGraphicsStateGuardian9:: do_issue_render_mode() { - const RenderModeAttrib *target_render_mode = DCAST(RenderModeAttrib, _target_rs->get_attrib_def(RenderModeAttrib::get_class_slot())); + const RenderModeAttrib *target_render_mode; + _target_rs->get_attrib_def(target_render_mode); RenderModeAttrib::Mode mode = target_render_mode->get_mode(); switch (mode) { @@ -3395,6 +3422,8 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) { D3DFORMAT DXGraphicsStateGuardian9:: get_index_type(Geom::NumericType numeric_type) { switch (numeric_type) { + // NT_uint8 is automatically promoted to uint16. + case Geom::NT_uint8: case Geom::NT_uint16: return D3DFMT_INDEX16; @@ -4539,7 +4568,7 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *presentation_params, } } - this -> mark_new(); + mark_new(); hr = _d3d_device->Reset(&_presentation_reset); if (FAILED(hr) && hr != D3DERR_DEVICELOST) { return hr; diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.h b/panda/src/dxgsg9/dxGraphicsStateGuardian9.h index 512cedbda2..21bb0d7265 100644 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.h +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.h @@ -79,7 +79,7 @@ public: bool force); virtual void release_vertex_buffer(VertexBufferContext *vbc); - bool setup_array_data(CLP(VertexBufferContext)*& vbc, + bool setup_array_data(DXVertexBufferContext9 *&vbc, const GeomVertexArrayDataHandle* data, bool force); @@ -295,12 +295,12 @@ protected: CullFaceAttrib::Mode _cull_face_mode; RenderModeAttrib::Mode _current_fill_mode; //point/wireframe/solid - PT(Shader) _current_shader; - CLP(ShaderContext) *_current_shader_context; - PT(Shader) _vertex_array_shader; - CLP(ShaderContext) *_vertex_array_shader_context; - PT(Shader) _texture_binding_shader; - CLP(ShaderContext) *_texture_binding_shader_context; + PT(Shader) _current_shader; + DXShaderContext9 *_current_shader_context; + PT(Shader) _vertex_array_shader; + DXShaderContext9 *_vertex_array_shader_context; + PT(Shader) _texture_binding_shader; + DXShaderContext9 *_texture_binding_shader_context; const DXIndexBufferContext9 *_active_ibuffer; diff --git a/panda/src/dxgsg9/dxIndexBufferContext9.cxx b/panda/src/dxgsg9/dxIndexBufferContext9.cxx index 51429d67c8..6cf6a78c84 100644 --- a/panda/src/dxgsg9/dxIndexBufferContext9.cxx +++ b/panda/src/dxgsg9/dxIndexBufferContext9.cxx @@ -27,9 +27,8 @@ TypeHandle DXIndexBufferContext9::_type_handle; DXIndexBufferContext9:: DXIndexBufferContext9(PreparedGraphicsObjects *pgo, GeomPrimitive *data) : IndexBufferContext(pgo, data), - _ibuffer(NULL) -{ - _managed = -1; + _ibuffer(NULL), + _managed(-1) { } /** @@ -37,8 +36,7 @@ DXIndexBufferContext9(PreparedGraphicsObjects *pgo, GeomPrimitive *data) : */ DXIndexBufferContext9:: ~DXIndexBufferContext9() { - - this -> free_ibuffer ( ); + free_ibuffer(); } /** @@ -70,13 +68,10 @@ free_ibuffer(void) { << "deleting index buffer " << _ibuffer << "\n"; } - if (DEBUG_INDEX_BUFFER) - { + if (DEBUG_INDEX_BUFFER) { RELEASE(_ibuffer, dxgsg9, "index buffer", RELEASE_ONCE); - } - else - { - _ibuffer -> Release ( ); + } else { + _ibuffer->Release(); } _ibuffer = NULL; @@ -99,6 +94,11 @@ allocate_ibuffer(DXScreenData &scrn, data_size = reader->get_data_size_bytes(); + if (reader->get_index_type() == GeomEnums::NT_uint8) { + // We widen 8-bits indices to 16-bits. + data_size *= 2; + } + _managed = scrn._managed_index_buffers; if (_managed) { @@ -147,16 +147,12 @@ create_ibuffer(DXScreenData &scrn, nassertv(reader->get_object() == get_data()); Thread *current_thread = reader->get_current_thread(); - this -> free_ibuffer ( ); + free_ibuffer(); PStatTimer timer(GraphicsStateGuardian::_create_index_buffer_pcollector, current_thread); - int data_size; - - data_size = reader->get_data_size_bytes(); - - this -> allocate_ibuffer(scrn, reader); + allocate_ibuffer(scrn, reader); } /** @@ -175,6 +171,11 @@ upload_data(const GeomPrimitivePipelineReader *reader, bool force) { } int data_size = reader->get_data_size_bytes(); + if (reader->get_index_type() == GeomEnums::NT_uint8) { + // We widen 8-bits indices to 16-bits. + data_size *= 2; + } + if (dxgsg9_cat.is_spam()) { dxgsg9_cat.spam() << "copying " << data_size @@ -186,12 +187,9 @@ upload_data(const GeomPrimitivePipelineReader *reader, bool force) { HRESULT hr; BYTE *local_pointer; - if (_managed) - { + if (_managed) { hr = _ibuffer->Lock(0, data_size, (void **) &local_pointer, 0); - } - else - { + } else { hr = _ibuffer->Lock(0, data_size, (void **) &local_pointer, D3DLOCK_DISCARD); } if (FAILED(hr)) { @@ -201,7 +199,16 @@ upload_data(const GeomPrimitivePipelineReader *reader, bool force) { } GraphicsStateGuardian::_data_transferred_pcollector.add_level(data_size); - memcpy(local_pointer, data_pointer, data_size); + + if (reader->get_index_type() == GeomEnums::NT_uint8) { + // Widen to 16-bits, as DirectX doesn't support 8-bits indices. + uint16_t *ptr = (uint16_t *)local_pointer; + for (size_t i = 0; i < data_size; i += 2) { + *ptr++ = (uint16_t)*data_pointer++; + } + } else { + memcpy(local_pointer, data_pointer, data_size); + } _ibuffer->Unlock(); return true; diff --git a/panda/src/dxgsg9/dxOcclusionQueryContext9.h b/panda/src/dxgsg9/dxOcclusionQueryContext9.h index f930bc71e0..c2e54dedc2 100644 --- a/panda/src/dxgsg9/dxOcclusionQueryContext9.h +++ b/panda/src/dxgsg9/dxOcclusionQueryContext9.h @@ -41,7 +41,7 @@ public: } static void init_type() { OcclusionQueryContext::init_type(); - register_type(_type_handle, CLASSPREFIX_QUOTED "OcclusionQueryContext", + register_type(_type_handle, "DXOcclusionQueryContext9", OcclusionQueryContext::get_class_type()); } virtual TypeHandle get_type() const { diff --git a/panda/src/dxgsg9/dxShaderContext9.I b/panda/src/dxgsg9/dxShaderContext9.I index ba79e89d74..74590ff2c0 100644 --- a/panda/src/dxgsg9/dxShaderContext9.I +++ b/panda/src/dxgsg9/dxShaderContext9.I @@ -17,7 +17,7 @@ * shader, or if the current video card isn't shader-capable, or if no shader * languages are compiled into panda. */ -INLINE bool CLP(ShaderContext):: +INLINE bool DXShaderContext9:: valid(GSG *gsg) { #ifdef HAVE_CG return (_cg_program != 0); diff --git a/panda/src/dxgsg9/dxShaderContext9.cxx b/panda/src/dxgsg9/dxShaderContext9.cxx index 2dbfd6da9c..9d151ac44a 100644 --- a/panda/src/dxgsg9/dxShaderContext9.cxx +++ b/panda/src/dxgsg9/dxShaderContext9.cxx @@ -28,13 +28,13 @@ #define DEBUG_SHADER 0 -TypeHandle CLP(ShaderContext)::_type_handle; +TypeHandle DXShaderContext9::_type_handle; /** * xyz */ -CLP(ShaderContext):: -CLP(ShaderContext)(Shader *s, GSG *gsg) : ShaderContext(s) { +DXShaderContext9:: +DXShaderContext9(Shader *s, GSG *gsg) : ShaderContext(s) { _vertex_element_array = NULL; _vertex_declaration = NULL; @@ -46,7 +46,6 @@ CLP(ShaderContext)(Shader *s, GSG *gsg) : ShaderContext(s) { CGcontext context = DCAST(DXGraphicsStateGuardian9, gsg)->_cg_context; if (s->get_language() == Shader::SL_Cg) { - // Ask the shader to compile itself for us and to give us the resulting Cg // program objects. if (!s->cg_compile_for(gsg->_shader_caps, context, @@ -63,7 +62,7 @@ CLP(ShaderContext)(Shader *s, GSG *gsg) : ShaderContext(s) { HRESULT hr; bool success = true; hr = cgD3D9LoadProgram(_cg_program, FALSE, assembly_flags); - if (FAILED (hr)) { + if (FAILED(hr)) { dxgsg9_cat.error() << "cgD3D9LoadProgram failed " << D3DERRORSTRING(hr); @@ -80,46 +79,26 @@ CLP(ShaderContext)(Shader *s, GSG *gsg) : ShaderContext(s) { /** * xyz */ -CLP(ShaderContext):: -~CLP(ShaderContext)() { +DXShaderContext9:: +~DXShaderContext9() { release_resources(); - if ( _vertex_declaration != NULL ) { + if (_vertex_declaration != NULL) { _vertex_declaration->Release(); _vertex_declaration = NULL; } - if ( _vertex_element_array != NULL ) { + if (_vertex_element_array != NULL) { delete _vertex_element_array; _vertex_element_array = NULL; } } -/* - * int save_file (int size, void *data, char *file_path) { int state; int - * file_handle; state = false; file_handle = _open (file_path, _O_CREAT | - * _O_RDWR | _O_TRUNC, _S_IREAD | _S_IWRITE); if (file_handle != -1) { if - * (_write (file_handle, data, size) == size) { state = true; } _close - * (file_handle); } return state; } if (dxgsg9_cat.is_debug()) { DEBUG: output - * the generated program const char *vertex_program; const char - * *pixel_program; vertex_program = cgGetProgramString (_cg_program[0], - * CG_COMPILED_PROGRAM); pixel_program = cgGetProgramString (_cg_program[1], - * CG_COMPILED_PROGRAM); dxgsg9_cat.debug() << vertex_program << "\n"; - * dxgsg9_cat.debug() << pixel_program << "\n"; save the generated program to - * a file int size; char file_path [512]; char drive[_MAX_DRIVE]; char - * dir[_MAX_DIR]; char fname[_MAX_FNAME]; char ext[_MAX_EXT]; _splitpath - * (_name.c_str ( ), drive, dir, fname, ext); size = strlen (vertex_program); - * sprintf (file_path, "%s.vasm", fname); save_file (size, (void *) - * vertex_program, file_path); size = strlen (pixel_program); sprintf - * (file_path, "%s.pasm", fname); save_file (size, (void *) pixel_program, - * file_path); } - */ - /** * Should deallocate all system resources (such as vertex program handles or * Cg contexts). */ -void CLP(ShaderContext):: +void DXShaderContext9:: release_resources() { #ifdef HAVE_CG if (_cg_program) { @@ -139,9 +118,8 @@ release_resources() { * This function is to be called to enable a new shader. It also initializes * all of the shader's input parameters. */ -bool CLP(ShaderContext):: +bool DXShaderContext9:: bind(GSG *gsg) { - bool bind_state = false; #ifdef HAVE_CG @@ -149,7 +127,7 @@ bind(GSG *gsg) { // clear the last cached FVF to make sure the next SetFVF call goes // through - gsg -> _last_fvf = 0; + gsg->_last_fvf = 0; // Pass in k-parameters and transform-parameters issue_parameters(gsg, Shader::SSD_general); @@ -159,7 +137,7 @@ bind(GSG *gsg) { // Bind the shaders. bind_state = true; hr = cgD3D9BindProgram(_cg_program); - if (FAILED (hr)) { + if (FAILED(hr)) { dxgsg9_cat.error() << "cgD3D9BindProgram failed " << D3DERRORSTRING(hr); CGerror error = cgGetError(); @@ -178,9 +156,8 @@ bind(GSG *gsg) { /** * This function disables a currently-bound shader. */ -void CLP(ShaderContext):: +void DXShaderContext9:: unbind(GSG *gsg) { - #ifdef HAVE_CG if (_cg_program) { HRESULT hr; @@ -211,48 +188,59 @@ InternalName *global_internal_name_0 = 0; InternalName *global_internal_name_1 = 0; #endif -void CLP(ShaderContext):: +void DXShaderContext9:: issue_parameters(GSG *gsg, int altered) { #ifdef HAVE_CG if (_cg_program) { - // Iterate through _ptr parameters - for (int i=0; i<(int)_shader->_ptr_spec.size(); i++) { - if(altered & (_shader->_ptr_spec[i]._dep[0] | _shader->_ptr_spec[i]._dep[1])){ -#ifdef HAVE_CG - const Shader::ShaderPtrSpec& _ptr = _shader->_ptr_spec[i]; - Shader::ShaderPtrData* _ptr_data = - const_cast< Shader::ShaderPtrData*>(gsg->fetch_ptr_parameter(_ptr)); + // Iterate through _ptr parameters + for (size_t i = 0; i < _shader->_ptr_spec.size(); ++i) { + const Shader::ShaderPtrSpec &spec = _shader->_ptr_spec[i]; - if (_ptr_data == NULL){ //the input is not contained in ShaderPtrData + if (altered & (spec._dep[0] | spec._dep[1])) { + const Shader::ShaderPtrData *ptr_data = gsg->fetch_ptr_parameter(spec); + + if (ptr_data == NULL) { //the input is not contained in ShaderPtrData release_resources(); return; } - CGparameter p = _cg_parameter_map[_ptr._id._seqno]; + // Calculate how many elements to transfer; no more than it expects, + // but certainly no more than we have. + int input_size = min(abs(spec._dim[0] * spec._dim[1] * spec._dim[2]), ptr_data->_size); + + CGparameter p = _cg_parameter_map[spec._id._seqno]; + switch (ptr_data->_type) { + case Shader::SPT_int: + cgSetParameterValueic(p, input_size, (int *)ptr_data->_ptr); + break; + + case Shader::SPT_double: + cgSetParameterValuedc(p, input_size, (double *)ptr_data->_ptr); + break; - switch(_ptr_data->_type) { case Shader::SPT_float: - cgD3D9SetUniform(p, (PN_stdfloat*)_ptr_data->_ptr); + cgSetParameterValuefc(p, input_size, (float *)ptr_data->_ptr); break; default: dxgsg9_cat.error() - << _ptr._id._name << ":" << "unrecognized parameter type\n"; + << spec._id._name << ": unrecognized parameter type\n"; release_resources(); return; } } -#endif } - for (int i=0; i<(int)_shader->_mat_spec.size(); i++) { - if (altered & (_shader->_mat_spec[i]._dep[0] | _shader->_mat_spec[i]._dep[1])) { - CGparameter p = _cg_parameter_map[_shader->_mat_spec[i]._id._seqno]; + for (size_t i = 0; i < _shader->_mat_spec.size(); ++i) { + Shader::ShaderMatSpec &spec = _shader->_mat_spec[i]; + + if (altered & (spec._dep[0] | spec._dep[1])) { + CGparameter p = _cg_parameter_map[spec._id._seqno]; if (p == NULL) { continue; } - const LMatrix4 *val = gsg->fetch_specified_value(_shader->_mat_spec[i], altered); + const LMatrix4 *val = gsg->fetch_specified_value(spec, altered); if (val) { HRESULT hr; PN_stdfloat v [4]; @@ -263,83 +251,79 @@ issue_parameters(GSG *gsg, int altered) { const float *data; data = temp_matrix.get_data(); - #if DEBUG_SHADER +#if DEBUG_SHADER // DEBUG - global_data = (PN_stdfloat *) data; - global_shader_mat_spec = &_shader->_mat_spec[i]; - global_internal_name_0 = global_shader_mat_spec -> _arg [0]; - global_internal_name_1 = global_shader_mat_spec -> _arg [1]; - #endif + global_data = (PN_stdfloat *)data; + global_shader_mat_spec = &spec; + global_internal_name_0 = global_shader_mat_spec->_arg[0]; + global_internal_name_1 = global_shader_mat_spec->_arg[1]; +#endif - switch (_shader->_mat_spec[i]._piece) { + switch (spec._piece) { case Shader::SMP_whole: // TRANSPOSE REQUIRED temp_matrix.transpose_in_place(); data = temp_matrix.get_data(); - hr = cgD3D9SetUniform (p, data); + hr = cgD3D9SetUniform(p, data); break; case Shader::SMP_transpose: // NO TRANSPOSE REQUIRED - hr = cgD3D9SetUniform (p, data); + hr = cgD3D9SetUniform(p, data); break; case Shader::SMP_row0: - hr = cgD3D9SetUniform (p, data + 0); + hr = cgD3D9SetUniform(p, data + 0); break; case Shader::SMP_row1: - hr = cgD3D9SetUniform (p, data + 4); + hr = cgD3D9SetUniform(p, data + 4); break; case Shader::SMP_row2: - hr = cgD3D9SetUniform (p, data + 8); + hr = cgD3D9SetUniform(p, data + 8); break; case Shader::SMP_row3x1: case Shader::SMP_row3x2: case Shader::SMP_row3x3: case Shader::SMP_row3: - hr = cgD3D9SetUniform (p, data + 12); + hr = cgD3D9SetUniform(p, data + 12); break; case Shader::SMP_col0: v[0] = data[0]; v[1] = data[4]; v[2] = data[8]; v[3] = data[12]; - hr = cgD3D9SetUniform (p, v); + hr = cgD3D9SetUniform(p, v); break; case Shader::SMP_col1: v[0] = data[1]; v[1] = data[5]; v[2] = data[9]; v[3] = data[13]; - hr = cgD3D9SetUniform (p, v); + hr = cgD3D9SetUniform(p, v); break; case Shader::SMP_col2: v[0] = data[2]; v[1] = data[6]; v[2] = data[10]; v[3] = data[14]; - hr = cgD3D9SetUniform (p, v); + hr = cgD3D9SetUniform(p, v); break; case Shader::SMP_col3: v[0] = data[3]; v[1] = data[7]; v[2] = data[11]; v[3] = data[15]; - hr = cgD3D9SetUniform (p, v); + hr = cgD3D9SetUniform(p, v); break; default: dxgsg9_cat.error() - << "issue_parameters ( ) SMP parameter type not implemented " << _shader->_mat_spec[i]._piece << "\n"; + << "issue_parameters () SMP parameter type not implemented " << spec._piece << "\n"; break; } - if (FAILED (hr)) { - + if (FAILED(hr)) { string name = "unnamed"; - if (_shader->_mat_spec[i]._arg [0]) { - name = _shader->_mat_spec[i]._arg [0] -> get_basename ( ); + if (spec._arg[0]) { + name = spec._arg[0]->get_basename(); } dxgsg9_cat.error() - << "NAME " << name << "\n" - << "MAT TYPE " - << _shader->_mat_spec[i]._piece - << " cgD3D9SetUniform failed " - << D3DERRORSTRING(hr); + << "NAME " << name << "\n" << "MAT TYPE " << spec._piece + << " cgD3D9SetUniform failed " << D3DERRORSTRING(hr); - CGerror error = cgGetError (); + CGerror error = cgGetError(); if (error != CG_NO_ERROR) { dxgsg9_cat.error() << " CG ERROR: " << cgGetErrorString(error) << "\n"; } @@ -354,13 +338,12 @@ issue_parameters(GSG *gsg, int altered) { /** * Disable all the vertex arrays used by this shader. */ -void CLP(ShaderContext):: +void DXShaderContext9:: disable_shader_vertex_arrays(GSG *gsg) { LPDIRECT3DDEVICE9 device = gsg->_screen->_d3d_device; - for ( int array_index = 0; array_index < _num_bound_streams; ++array_index ) - { - device->SetStreamSource( array_index, NULL, 0, 0 ); + for (int array_index = 0; array_index < _num_bound_streams; ++array_index) { + device->SetStreamSource(array_index, NULL, 0, 0); } _num_bound_streams = 0; } @@ -372,8 +355,8 @@ disable_shader_vertex_arrays(GSG *gsg) { * because it may unnecessarily disable arrays then immediately reenable them. * We may optimize this someday. */ -bool CLP(ShaderContext):: -update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { +bool DXShaderContext9:: +update_shader_vertex_arrays(DXShaderContext9 *prev, GSG *gsg, bool force) { if (prev) prev->disable_shader_vertex_arrays(gsg); #ifdef HAVE_CG if (!_cg_program) { @@ -394,7 +377,7 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { // Discard and recreate the VertexElementArray. This thrashes pretty // bad.... - if ( _vertex_element_array != NULL ) { + if (_vertex_element_array != NULL) { delete _vertex_element_array; } _vertex_element_array = new VertexElementArray(nvarying + 2); @@ -408,17 +391,17 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { // out only those for a single stream. int number_of_arrays = gsg->_data_reader->get_num_arrays(); - for ( int array_index = 0; array_index < number_of_arrays; ++array_index ) { + for (int array_index = 0; array_index < number_of_arrays; ++array_index) { const GeomVertexArrayDataHandle* array_reader = - gsg->_data_reader->get_array_reader( array_index ); - if ( array_reader == NULL ) { + gsg->_data_reader->get_array_reader(array_index); + if (array_reader == NULL) { dxgsg9_cat.error() << "Unable to get reader for array " << array_index << "\n"; continue; } - for ( int var_index = 0; var_index < nvarying; ++var_index ) { + for (int var_index = 0; var_index < nvarying; ++var_index) { CGparameter p = _cg_parameter_map[_shader->_var_spec[var_index]._id._seqno]; - if ( p == NULL ) { + if (p == NULL) { dxgsg9_cat.info() << "No parameter in map for parameter " << var_index << " (probably optimized away)\n"; @@ -440,14 +423,12 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { } } - const GeomVertexArrayDataHandle* param_array_reader; + const GeomVertexArrayDataHandle *param_array_reader; Geom::NumericType numeric_type; - int num_values; - int start; - int stride; - if ( gsg->_data_reader->get_array_info( name, - param_array_reader, num_values, numeric_type, - start, stride ) == false ) { + int num_values, start, stride; + if (!gsg->_data_reader->get_array_info(name, param_array_reader, + num_values, numeric_type, + start, stride)) { // This is apparently not an error (actually I think it is, just not // a fatal one). The GL implementation fails silently in this case, // but the net result is that we end up not supplying input for a @@ -458,105 +439,105 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { } // If not associated with the array we're working on, move on. - if ( param_array_reader != array_reader ) { + if (param_array_reader != array_reader) { continue; } - const char* semantic = cgGetParameterSemantic( p ); - if ( semantic == NULL ) { + const char *semantic = cgGetParameterSemantic(p); + if (semantic == NULL) { dxgsg9_cat.error() << "Unable to retrieve semantic for parameter " << var_index << "\n"; continue; } - if ( strncmp( semantic, "POSITION", strlen( "POSITION" ) ) == 0 ) { + if (strncmp(semantic, "POSITION", strlen("POSITION")) == 0) { if (numeric_type == Geom::NT_float32) { switch (num_values) { - case 3: - vertex_element_array->add_position_xyz_vertex_element(array_index, start); - break; - case 4: - vertex_element_array->add_position_xyzw_vertex_element(array_index, start); - break; - default: - dxgsg9_cat.error() << "VE ERROR: invalid number of vertex coordinate elements " << num_values << "\n"; - break; + case 3: + vertex_element_array->add_position_xyz_vertex_element(array_index, start); + break; + case 4: + vertex_element_array->add_position_xyzw_vertex_element(array_index, start); + break; + default: + dxgsg9_cat.error() << "VE ERROR: invalid number of vertex coordinate elements " << num_values << "\n"; + break; } } else { dxgsg9_cat.error() << "VE ERROR: invalid vertex type " << numeric_type << "\n"; } - } else if ( strncmp( semantic, "TEXCOORD", strlen( "TEXCOORD" ) ) == 0 ) { - int slot = atoi( semantic + strlen( "TEXCOORD" ) ); + } else if (strncmp(semantic, "TEXCOORD", strlen("TEXCOORD")) == 0) { + int slot = atoi(semantic + strlen("TEXCOORD")); if (numeric_type == Geom::NT_float32) { switch (num_values) { - case 1: - vertex_element_array->add_u_vertex_element(array_index, start, slot); - break; - case 2: - vertex_element_array->add_uv_vertex_element(array_index, start, slot); - break; - case 3: - vertex_element_array->add_uvw_vertex_element(array_index, start, slot); - break; - case 4: - vertex_element_array->add_xyzw_vertex_element(array_index, start, slot); - break; - default: - dxgsg9_cat.error() << "VE ERROR: invalid number of vertex texture coordinate elements " << num_values << "\n"; - break; + case 1: + vertex_element_array->add_u_vertex_element(array_index, start, slot); + break; + case 2: + vertex_element_array->add_uv_vertex_element(array_index, start, slot); + break; + case 3: + vertex_element_array->add_uvw_vertex_element(array_index, start, slot); + break; + case 4: + vertex_element_array->add_xyzw_vertex_element(array_index, start, slot); + break; + default: + dxgsg9_cat.error() << "VE ERROR: invalid number of vertex texture coordinate elements " << num_values << "\n"; + break; } } else { dxgsg9_cat.error() << "VE ERROR: invalid texture coordinate type " << numeric_type << "\n"; } - } else if ( strncmp( semantic, "COLOR", strlen( "COLOR" ) ) == 0 ) { + } else if (strncmp(semantic, "COLOR", strlen("COLOR")) == 0) { if (numeric_type == Geom::NT_packed_dcba || numeric_type == Geom::NT_packed_dabc || numeric_type == Geom::NT_uint8) { switch (num_values) { - case 4: - vertex_element_array->add_diffuse_color_vertex_element(array_index, start); - break; - default: - dxgsg9_cat.error() << "VE ERROR: invalid color coordinates " << num_values << "\n"; - break; + case 4: + vertex_element_array->add_diffuse_color_vertex_element(array_index, start); + break; + default: + dxgsg9_cat.error() << "VE ERROR: invalid color coordinates " << num_values << "\n"; + break; } } else { dxgsg9_cat.error() << "VE ERROR: invalid color type " << numeric_type << "\n"; } - } else if ( strncmp( semantic, "NORMAL", strlen( "NORMAL" ) ) == 0 ) { + } else if (strncmp(semantic, "NORMAL", strlen("NORMAL")) == 0) { if (numeric_type == Geom::NT_float32) { switch (num_values) { - case 3: - vertex_element_array->add_normal_vertex_element(array_index, start); - break; - default: - dxgsg9_cat.error() << "VE ERROR: invalid number of normal coordinate elements " << num_values << "\n"; - break; + case 3: + vertex_element_array->add_normal_vertex_element(array_index, start); + break; + default: + dxgsg9_cat.error() << "VE ERROR: invalid number of normal coordinate elements " << num_values << "\n"; + break; } } else { dxgsg9_cat.error() << "VE ERROR: invalid normal type " << numeric_type << "\n"; } - } else if ( strncmp( semantic, "BINORMAL", strlen( "BINORMAL" ) ) == 0 ) { + } else if (strncmp(semantic, "BINORMAL", strlen("BINORMAL")) == 0) { if (numeric_type == Geom::NT_float32) { switch (num_values) { - case 3: - vertex_element_array->add_binormal_vertex_element(array_index, start); - break; - default: - dxgsg9_cat.error() << "VE ERROR: invalid number of binormal coordinate elements " << num_values << "\n"; - break; + case 3: + vertex_element_array->add_binormal_vertex_element(array_index, start); + break; + default: + dxgsg9_cat.error() << "VE ERROR: invalid number of binormal coordinate elements " << num_values << "\n"; + break; } } else { dxgsg9_cat.error() << "VE ERROR: invalid binormal type " << numeric_type << "\n"; } - } else if ( strncmp( semantic, "TANGENT", strlen( "TANGENT" ) ) == 0 ) { + } else if (strncmp(semantic, "TANGENT", strlen("TANGENT")) == 0) { if (numeric_type == Geom::NT_float32) { switch (num_values) { - case 3: - vertex_element_array->add_tangent_vertex_element(array_index, start); - break; - default: - dxgsg9_cat.error() << "VE ERROR: invalid number of tangent coordinate elements " << num_values << "\n"; - break; + case 3: + vertex_element_array->add_tangent_vertex_element(array_index, start); + break; + default: + dxgsg9_cat.error() << "VE ERROR: invalid number of tangent coordinate elements " << num_values << "\n"; + break; } } else { dxgsg9_cat.error() << "VE ERROR: invalid tangent type " << numeric_type << "\n"; @@ -567,15 +548,15 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { } // Get the vertex buffer for this array. - CLP(VertexBufferContext)* dvbc; + DXVertexBufferContext9 *dvbc; if (!gsg->setup_array_data(dvbc, array_reader, force)) { dxgsg9_cat.error() << "Unable to setup vertex buffer for array " << array_index << "\n"; continue; } // Bind this array as the data source for the corresponding stream. - const GeomVertexArrayFormat* array_format = array_reader->get_array_format(); - hr = device->SetStreamSource( array_index, dvbc->_vbuffer, 0, array_format->get_stride() ); + const GeomVertexArrayFormat *array_format = array_reader->get_array_format(); + hr = device->SetStreamSource(array_index, dvbc->_vbuffer, 0, array_format->get_stride()); if (FAILED(hr)) { dxgsg9_cat.error() << "SetStreamSource failed" << D3DERRORSTRING(hr); } @@ -583,8 +564,8 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { _num_bound_streams = number_of_arrays; - if (( _vertex_element_array != NULL ) && - ( _vertex_element_array->add_end_vertex_element() != false )) { + if (_vertex_element_array != NULL && + _vertex_element_array->add_end_vertex_element()) { if (dxgsg9_cat.is_debug()) { // Note that the currently generated vertex declaration works but // never validates. My theory is that this is due to the shader @@ -599,17 +580,17 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { } // Discard the old VertexDeclaration. This thrashes pretty bad.... - if ( _vertex_declaration != NULL ) { + if (_vertex_declaration != NULL) { _vertex_declaration->Release(); _vertex_declaration = NULL; } - hr = device->CreateVertexDeclaration( _vertex_element_array->_vertex_element_array, - &_vertex_declaration ); - if (FAILED (hr)) { + hr = device->CreateVertexDeclaration(_vertex_element_array->_vertex_element_array, + &_vertex_declaration); + if (FAILED(hr)) { dxgsg9_cat.error() << "CreateVertexDeclaration failed" << D3DERRORSTRING(hr); } else { - hr = device->SetVertexDeclaration( _vertex_declaration ); + hr = device->SetVertexDeclaration(_vertex_declaration); if (FAILED(hr)) { dxgsg9_cat.error() << "SetVertexDeclaration failed" << D3DERRORSTRING(hr); } @@ -626,12 +607,11 @@ update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, bool force) { /** * Disable all the texture bindings used by this shader. */ -void CLP(ShaderContext):: -disable_shader_texture_bindings(GSG *gsg) -{ +void DXShaderContext9:: +disable_shader_texture_bindings(GSG *gsg) { #ifdef HAVE_CG if (_cg_program) { - for (int i=0; i<(int)_shader->_tex_spec.size(); i++) { + for (size_t i = 0; i < _shader->_tex_spec.size(); ++i) { CGparameter p = _cg_parameter_map[_shader->_tex_spec[i]._id._seqno]; if (p == NULL) { continue; @@ -640,12 +620,10 @@ disable_shader_texture_bindings(GSG *gsg) HRESULT hr; - hr = gsg -> _d3d_device -> SetTexture (texunit, NULL); - if (FAILED (hr)) { + hr = gsg->_d3d_device->SetTexture(texunit, NULL); + if (FAILED(hr)) { dxgsg9_cat.error() - << "SetTexture (" - << texunit - << ", NULL) failed " + << "SetTexture(" << texunit << ", NULL) failed " << D3DERRORSTRING(hr); } } @@ -660,60 +638,44 @@ disable_shader_texture_bindings(GSG *gsg) * because it may unnecessarily disable textures then immediately reenable * them. We may optimize this someday. */ -void CLP(ShaderContext):: -update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg) -{ - if (prev) prev->disable_shader_texture_bindings(gsg); +void DXShaderContext9:: +update_shader_texture_bindings(DXShaderContext9 *prev, GSG *gsg) { + if (prev) { + prev->disable_shader_texture_bindings(gsg); + } #ifdef HAVE_CG if (_cg_program) { - - for (int i=0; i<(int)_shader->_tex_spec.size(); i++) { - CGparameter p = _cg_parameter_map[_shader->_tex_spec[i]._id._seqno]; + for (size_t i = 0; i < _shader->_tex_spec.size(); ++i) { + Shader::ShaderTexSpec &spec = _shader->_tex_spec[i]; + CGparameter p = _cg_parameter_map[spec._id._seqno]; if (p == NULL) { continue; } - Texture *tex = NULL; + int view = gsg->get_current_tex_view_offset(); - InternalName *id = _shader->_tex_spec[i]._name; SamplerState sampler; - if (id != NULL) { - const ShaderInput *input = gsg->_target_shader->get_shader_input(id); - tex = input->get_texture(); - sampler = input->get_sampler(); - - } else { - // We get the TextureAttrib directly from the _target_rs, not the - // filtered TextureAttrib in _target_texture. - const TextureAttrib *texattrib = DCAST(TextureAttrib, gsg->_target_rs->get_attrib_def(TextureAttrib::get_class_slot())); - nassertv(texattrib != (TextureAttrib *)NULL); - - if (_shader->_tex_spec[i]._stage >= texattrib->get_num_on_stages()) { - continue; - } - TextureStage *stage = texattrib->get_on_stage(_shader->_tex_spec[i]._stage); - tex = texattrib->get_on_texture(stage); - sampler = texattrib->get_on_sampler(stage); - view += stage->get_tex_view_offset(); - } - if (_shader->_tex_spec[i]._suffix != 0) { - // The suffix feature is inefficient. It is a temporary hack. - if (tex == 0) { - continue; - } - tex = tex->load_related(_shader->_tex_spec[i]._suffix); - } - if ((tex == 0) || (tex->get_texture_type() != _shader->_tex_spec[i]._desired_type)) { + PT(Texture) tex = gsg->fetch_specified_texture(spec, sampler, view); + if (tex.is_null()) { continue; } + + if (spec._suffix != 0) { + // The suffix feature is inefficient. It is a temporary hack. + tex = tex->load_related(spec._suffix); + } + + if (tex->get_texture_type() != spec._desired_type) { + continue; + } + TextureContext *tc = tex->prepare_now(view, gsg->_prepared_objects, gsg); if (tc == (TextureContext*)NULL) { continue; } int texunit = cgGetParameterResourceIndex(p); - gsg->apply_texture(texunit, tc, sampler); } } @@ -721,8 +683,7 @@ update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg) } // DEBUG CODE TO TEST ASM CODE GENERATED BY Cg -void assemble_shader_test(char *file_path) -{ +void assemble_shader_test(char *file_path) { int flags; D3DXMACRO *defines; LPD3DXINCLUDE include; @@ -735,17 +696,15 @@ void assemble_shader_test(char *file_path) shader = 0; error_messages = 0; - D3DXAssembleShaderFromFile (file_path, defines, include, flags, &shader, &error_messages); - if (error_messages) - { + D3DXAssembleShaderFromFile(file_path, defines, include, flags, &shader, &error_messages); + if (error_messages) { char *error_message; - error_message = (char *) (error_messages -> GetBufferPointer ( )); - if (error_message) - { + error_message = (char *)error_messages->GetBufferPointer(); + if (error_message) { dxgsg9_cat.error() << error_message; } - error_messages -> Release ( ); + error_messages->Release(); } } diff --git a/panda/src/dxgsg9/dxShaderContext9.h b/panda/src/dxgsg9/dxShaderContext9.h index df873e3c1b..8f0a543e50 100644 --- a/panda/src/dxgsg9/dxShaderContext9.h +++ b/panda/src/dxgsg9/dxShaderContext9.h @@ -21,33 +21,46 @@ #include "shader.h" #include "shaderContext.h" -#define CLP(name) DX##name##9 -#define CLASSPREFIX_QUOTED "DX" - class VertexElementArray; -class CLP(GraphicsStateGuardian); +class DXGraphicsStateGuardian9; -/* - * Caution: adding HLSL support is going to be tricky, as the parsing needs to - * be done in the cull thread, which cannot use the DX API. - Josh typedef - * struct { int vertex_shader; int total_constant_descriptions; - * D3DXCONSTANT_DESC *constant_description_array; } DX_PARAMETER; typedef - * struct { int state; union { DIRECT_3D_VERTEX_SHADER - * direct_3d_vertex_shader; DIRECT_3D_PIXEL_SHADER direct_3d_pixel_shader; }; - * LPD3DXCONSTANTTABLE constant_table; D3DXCONSTANTTABLE_DESC - * constant_table_description; int total_semantics; D3DXSEMANTIC - * *semantic_array; } DIRECT_3D_SHADER; - */ +// Caution: adding HLSL support is going to be tricky, as the parsing needs to +// be done in the cull thread, which cannot use the DX API. - Josh +// +// +// typedef struct +// { +// int vertex_shader; +// int total_constant_descriptions; +// D3DXCONSTANT_DESC *constant_description_array; +// } +// DX_PARAMETER; +// +// typedef struct +// { +// int state; +// union +// { +// DIRECT_3D_VERTEX_SHADER direct_3d_vertex_shader; +// DIRECT_3D_PIXEL_SHADER direct_3d_pixel_shader; +// }; +// LPD3DXCONSTANTTABLE constant_table; +// D3DXCONSTANTTABLE_DESC constant_table_description; +// +// int total_semantics; +// D3DXSEMANTIC *semantic_array; +// } +// DIRECT_3D_SHADER; /** * xyz */ -class EXPCL_PANDADX CLP(ShaderContext) : public ShaderContext { +class EXPCL_PANDADX DXShaderContext9 : public ShaderContext { public: - typedef CLP(GraphicsStateGuardian) GSG; + typedef DXGraphicsStateGuardian9 GSG; - CLP(ShaderContext)(Shader *s, GSG *gsg); - ~CLP(ShaderContext)(); + DXShaderContext9(Shader *s, GSG *gsg); + ~DXShaderContext9(); INLINE bool valid(GSG *gsg); bool bind(GSG *gsg); @@ -55,10 +68,10 @@ public: void issue_parameters(GSG *gsg, int altered); void issue_transform(GSG *gsg); void disable_shader_vertex_arrays(GSG *gsg); - bool update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg, + bool update_shader_vertex_arrays(DXShaderContext9 *prev, GSG *gsg, bool force); void disable_shader_texture_bindings(GSG *gsg); - void update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg); + void update_shader_texture_bindings(DXShaderContext9 *prev, GSG *gsg); class VertexElementArray* _vertex_element_array; LPDIRECT3DVERTEXDECLARATION9 _vertex_declaration; @@ -83,7 +96,7 @@ public: } static void init_type() { TypedObject::init_type(); - register_type(_type_handle, CLASSPREFIX_QUOTED "ShaderContext", + register_type(_type_handle, "DXShaderContext9", TypedObject::get_class_type()); } virtual TypeHandle get_type() const { diff --git a/panda/src/dxgsg9/dxVertexBufferContext9.cxx b/panda/src/dxgsg9/dxVertexBufferContext9.cxx index b5374b1afd..48eb65fc6e 100644 --- a/panda/src/dxgsg9/dxVertexBufferContext9.cxx +++ b/panda/src/dxgsg9/dxVertexBufferContext9.cxx @@ -26,10 +26,10 @@ TypeHandle DXVertexBufferContext9::_type_handle; /** * */ -CLP(VertexBufferContext):: -CLP(VertexBufferContext)(CLP(GraphicsStateGuardian) *dxgsg, - PreparedGraphicsObjects *pgo, - GeomVertexArrayData *data) : +DXVertexBufferContext9:: +DXVertexBufferContext9(DXGraphicsStateGuardian9 *dxgsg, + PreparedGraphicsObjects *pgo, + GeomVertexArrayData *data) : VertexBufferContext(pgo, data), _vbuffer(NULL) { @@ -170,7 +170,7 @@ CLP(VertexBufferContext)(CLP(GraphicsStateGuardian) *dxgsg, * epoch), or requeue itself on the tail of the queue (in which case the * eviction will be requested again much later). */ -void CLP(VertexBufferContext):: +void DXVertexBufferContext9:: evict_lru() { dequeue_lru(); diff --git a/panda/src/dxgsg9/dxVertexBufferContext9.h b/panda/src/dxgsg9/dxVertexBufferContext9.h index 9295dcb07c..84966360ee 100644 --- a/panda/src/dxgsg9/dxVertexBufferContext9.h +++ b/panda/src/dxgsg9/dxVertexBufferContext9.h @@ -19,17 +19,17 @@ #include "vertexBufferContext.h" #include "deletedChain.h" -class CLP(GraphicsStateGuardian); +class DXGraphicsStateGuardian9; /** * Caches a GeomVertexArrayData in the DirectX device as a vertex buffer. */ -class EXPCL_PANDADX CLP(VertexBufferContext) : public VertexBufferContext { +class EXPCL_PANDADX DXVertexBufferContext9 : public VertexBufferContext { public: - CLP(VertexBufferContext)(CLP(GraphicsStateGuardian) *dxgsg, + DXVertexBufferContext9(DXGraphicsStateGuardian9 *dxgsg, PreparedGraphicsObjects *pgo, GeomVertexArrayData *data); - ALLOC_DELETED_CHAIN(CLP(VertexBufferContext)); + ALLOC_DELETED_CHAIN(DXVertexBufferContext9); virtual void evict_lru(); diff --git a/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx b/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx index f1853879ae..3cde32fc16 100644 --- a/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx @@ -312,16 +312,18 @@ rebuild_bitplanes() { case RTP_aux_float_3: { CDWriter cdataw(_cycler, cdata, false); - nassertr(cdata->_textures.size() == cdataw->_textures.size(), false); cdataw->_textures[i]._rtm_mode = RTM_none; } + // Creating the CDWriter invalidated the CDLockedReader. + cdata = CDLockedReader(_cycler); break; default: { CDWriter cdataw(_cycler, cdata, false); - nassertr(cdata->_textures.size() == cdataw->_textures.size(), false); cdataw->_textures[i]._rtm_mode = RTM_copy_texture; } + // Creating the CDWriter invalidated the CDLockedReader. + cdata = CDLockedReader(_cycler); break; } } diff --git a/panda/src/egg/.gitignore b/panda/src/egg/.gitignore deleted file mode 100644 index 63ad794cfb..0000000000 --- a/panda/src/egg/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/lexer.cxx -/parser.cxx -/parser.h diff --git a/panda/src/egg/eggLine.cxx b/panda/src/egg/eggLine.cxx index 4da9b87d7d..fca1efd7f1 100644 --- a/panda/src/egg/eggLine.cxx +++ b/panda/src/egg/eggLine.cxx @@ -17,7 +17,6 @@ TypeHandle EggLine::_type_handle; - /** * */ @@ -26,6 +25,14 @@ EggLine:: clear(); } +/** + * Makes a copy of this object. + */ +EggLine *EggLine:: +make_copy() const { + return new EggLine(*this); +} + /** * Writes the point to the indicated output stream in Egg format. */ diff --git a/panda/src/egg/eggLine.h b/panda/src/egg/eggLine.h index ce036c40f3..059dfa7648 100644 --- a/panda/src/egg/eggLine.h +++ b/panda/src/egg/eggLine.h @@ -29,6 +29,8 @@ PUBLISHED: INLINE EggLine &operator = (const EggLine ©); virtual ~EggLine(); + virtual EggLine *make_copy() const OVERRIDE; + virtual void write(ostream &out, int indent_level) const; INLINE bool has_thick() const; diff --git a/panda/src/egg/eggNurbsCurve.cxx b/panda/src/egg/eggNurbsCurve.cxx index f00528f0f0..79b1d5011b 100644 --- a/panda/src/egg/eggNurbsCurve.cxx +++ b/panda/src/egg/eggNurbsCurve.cxx @@ -17,6 +17,14 @@ TypeHandle EggNurbsCurve::_type_handle; +/** + * Makes a copy of this object. + */ +EggNurbsCurve *EggNurbsCurve:: +make_copy() const { + return new EggNurbsCurve(*this); +} + /** * Prepares a new curve definition with the indicated order and number of * knots. This also implies a particular number of vertices as well (the diff --git a/panda/src/egg/eggNurbsCurve.h b/panda/src/egg/eggNurbsCurve.h index 5eb8a054c8..9797a12ea8 100644 --- a/panda/src/egg/eggNurbsCurve.h +++ b/panda/src/egg/eggNurbsCurve.h @@ -29,6 +29,8 @@ PUBLISHED: INLINE EggNurbsCurve(const EggNurbsCurve ©); INLINE EggNurbsCurve &operator = (const EggNurbsCurve ©); + virtual EggNurbsCurve *make_copy() const OVERRIDE; + void setup(int order, int num_knots); INLINE void set_order(int order); diff --git a/panda/src/egg/eggNurbsSurface.cxx b/panda/src/egg/eggNurbsSurface.cxx index a5bd29cc78..c89ebfe157 100644 --- a/panda/src/egg/eggNurbsSurface.cxx +++ b/panda/src/egg/eggNurbsSurface.cxx @@ -17,6 +17,14 @@ TypeHandle EggNurbsSurface::_type_handle; +/** + * Makes a copy of this object. + */ +EggNurbsSurface *EggNurbsSurface:: +make_copy() const { + return new EggNurbsSurface(*this); +} + /** * Prepares a new surface definition with the indicated order and number of * knots in each dimension. This also implies a particular number of vertices diff --git a/panda/src/egg/eggNurbsSurface.h b/panda/src/egg/eggNurbsSurface.h index 35d5daba88..8e09d43fbd 100644 --- a/panda/src/egg/eggNurbsSurface.h +++ b/panda/src/egg/eggNurbsSurface.h @@ -36,6 +36,8 @@ PUBLISHED: INLINE EggNurbsSurface(const EggNurbsSurface ©); INLINE EggNurbsSurface &operator = (const EggNurbsSurface ©); + virtual EggNurbsSurface *make_copy() const OVERRIDE; + void setup(int u_order, int v_order, int num_u_knots, int num_v_knots); diff --git a/panda/src/egg/eggPatch.cxx b/panda/src/egg/eggPatch.cxx index 274217d0c2..0bed947622 100644 --- a/panda/src/egg/eggPatch.cxx +++ b/panda/src/egg/eggPatch.cxx @@ -21,6 +21,13 @@ TypeHandle EggPatch::_type_handle; +/** + * Makes a copy of this object. + */ +EggPatch *EggPatch:: +make_copy() const { + return new EggPatch(*this); +} /** * Writes the patch to the indicated output stream in Egg format. diff --git a/panda/src/egg/eggPatch.h b/panda/src/egg/eggPatch.h index d7a0989aef..63cfc61353 100644 --- a/panda/src/egg/eggPatch.h +++ b/panda/src/egg/eggPatch.h @@ -28,6 +28,8 @@ PUBLISHED: INLINE EggPatch(const EggPatch ©); INLINE EggPatch &operator = (const EggPatch ©); + virtual EggPatch *make_copy() const OVERRIDE; + virtual void write(ostream &out, int indent_level) const; public: diff --git a/panda/src/egg/eggPoint.cxx b/panda/src/egg/eggPoint.cxx index 95eef093ea..a344ee59cd 100644 --- a/panda/src/egg/eggPoint.cxx +++ b/panda/src/egg/eggPoint.cxx @@ -17,6 +17,13 @@ TypeHandle EggPoint::_type_handle; +/** + * Makes a copy of this object. + */ +EggPoint *EggPoint:: +make_copy() const { + return new EggPoint(*this); +} /** * Cleans up modeling errors in whatever context this makes sense. For diff --git a/panda/src/egg/eggPoint.h b/panda/src/egg/eggPoint.h index 74edd1b04d..ae7d7e1d34 100644 --- a/panda/src/egg/eggPoint.h +++ b/panda/src/egg/eggPoint.h @@ -28,6 +28,8 @@ PUBLISHED: INLINE EggPoint(const EggPoint ©); INLINE EggPoint &operator = (const EggPoint ©); + virtual EggPoint *make_copy() const OVERRIDE; + INLINE bool has_thick() const; INLINE double get_thick() const; INLINE void set_thick(double thick); diff --git a/panda/src/egg/eggPolygon.cxx b/panda/src/egg/eggPolygon.cxx index e10252c2ae..2d6a3378c7 100644 --- a/panda/src/egg/eggPolygon.cxx +++ b/panda/src/egg/eggPolygon.cxx @@ -21,6 +21,13 @@ TypeHandle EggPolygon::_type_handle; +/** + * Makes a copy of this object. + */ +EggPolygon *EggPolygon:: +make_copy() const { + return new EggPolygon(*this); +} /** * Cleans up modeling errors in whatever context this makes sense. For diff --git a/panda/src/egg/eggPolygon.h b/panda/src/egg/eggPolygon.h index 7c0298d9bd..a549af3bf7 100644 --- a/panda/src/egg/eggPolygon.h +++ b/panda/src/egg/eggPolygon.h @@ -27,6 +27,8 @@ PUBLISHED: INLINE EggPolygon(const EggPolygon ©); INLINE EggPolygon &operator = (const EggPolygon ©); + virtual EggPolygon *make_copy() const OVERRIDE; + virtual bool cleanup(); bool calculate_normal(LNormald &result, CoordinateSystem cs = CS_default) const; diff --git a/panda/src/egg/eggPrimitive.I b/panda/src/egg/eggPrimitive.I index 68ba3de1e3..d849d23882 100644 --- a/panda/src/egg/eggPrimitive.I +++ b/panda/src/egg/eggPrimitive.I @@ -27,6 +27,7 @@ INLINE EggPrimitive:: EggPrimitive(const EggPrimitive ©) : EggNode(copy), EggAttributes(copy), + EggRenderMode(copy), _textures(copy._textures), _material(copy._material), _bface(copy._bface) @@ -42,6 +43,7 @@ INLINE EggPrimitive &EggPrimitive:: operator = (const EggPrimitive ©) { EggNode::operator = (copy); EggAttributes::operator = (copy); + EggRenderMode::operator = (copy); copy_vertices(copy); _textures = copy._textures; _material = copy._material; diff --git a/panda/src/egg/eggPrimitive.h b/panda/src/egg/eggPrimitive.h index 4e8672249e..905e049596 100644 --- a/panda/src/egg/eggPrimitive.h +++ b/panda/src/egg/eggPrimitive.h @@ -72,6 +72,8 @@ PUBLISHED: INLINE EggPrimitive &operator = (const EggPrimitive ©); INLINE ~EggPrimitive(); + virtual EggPrimitive *make_copy() const=0; + virtual EggRenderMode *determine_alpha_mode(); virtual EggRenderMode *determine_depth_write_mode(); virtual EggRenderMode *determine_depth_test_mode(); diff --git a/panda/src/egg/eggTriangleFan.cxx b/panda/src/egg/eggTriangleFan.cxx index d71ad75fed..30d441286a 100644 --- a/panda/src/egg/eggTriangleFan.cxx +++ b/panda/src/egg/eggTriangleFan.cxx @@ -18,7 +18,6 @@ TypeHandle EggTriangleFan::_type_handle; - /** * */ @@ -27,6 +26,14 @@ EggTriangleFan:: clear(); } +/** + * Makes a copy of this object. + */ +EggTriangleFan *EggTriangleFan:: +make_copy() const { + return new EggTriangleFan(*this); +} + /** * Writes the triangle fan to the indicated output stream in Egg format. */ diff --git a/panda/src/egg/eggTriangleFan.h b/panda/src/egg/eggTriangleFan.h index 1cf6e1edf9..0a5e3f1e35 100644 --- a/panda/src/egg/eggTriangleFan.h +++ b/panda/src/egg/eggTriangleFan.h @@ -29,6 +29,8 @@ PUBLISHED: INLINE EggTriangleFan &operator = (const EggTriangleFan ©); virtual ~EggTriangleFan(); + virtual EggTriangleFan *make_copy() const OVERRIDE; + virtual void write(ostream &out, int indent_level) const; virtual void apply_first_attribute(); diff --git a/panda/src/egg/eggTriangleStrip.cxx b/panda/src/egg/eggTriangleStrip.cxx index 41bd5c4668..5882471c9e 100644 --- a/panda/src/egg/eggTriangleStrip.cxx +++ b/panda/src/egg/eggTriangleStrip.cxx @@ -18,7 +18,6 @@ TypeHandle EggTriangleStrip::_type_handle; - /** * */ @@ -27,6 +26,14 @@ EggTriangleStrip:: clear(); } +/** + * Makes a copy of this object. + */ +EggTriangleStrip *EggTriangleStrip:: +make_copy() const { + return new EggTriangleStrip(*this); +} + /** * Writes the triangle strip to the indicated output stream in Egg format. */ diff --git a/panda/src/egg/eggTriangleStrip.h b/panda/src/egg/eggTriangleStrip.h index 1400aefbd9..202172d1cd 100644 --- a/panda/src/egg/eggTriangleStrip.h +++ b/panda/src/egg/eggTriangleStrip.h @@ -29,6 +29,8 @@ PUBLISHED: INLINE EggTriangleStrip &operator = (const EggTriangleStrip ©); virtual ~EggTriangleStrip(); + virtual EggTriangleStrip *make_copy() const OVERRIDE; + virtual void write(ostream &out, int indent_level) const; protected: diff --git a/panda/src/egg/eggVertex.cxx b/panda/src/egg/eggVertex.cxx index 973f583b7b..7663fd4eb3 100644 --- a/panda/src/egg/eggVertex.cxx +++ b/panda/src/egg/eggVertex.cxx @@ -138,11 +138,7 @@ has_uvw(const string &name) const { bool EggVertex:: has_aux(const string &name) const { AuxMap::const_iterator xi = _aux_map.find(name); - if (xi != _aux_map.end()) { - EggVertexAux *aux_obj = (*xi).second; - return true; - } - return false; + return (xi != _aux_map.end()); } /** diff --git a/panda/src/egg2pg/eggSaver.cxx b/panda/src/egg2pg/eggSaver.cxx index 6767d5c287..3976aa0714 100644 --- a/panda/src/egg2pg/eggSaver.cxx +++ b/panda/src/egg2pg/eggSaver.cxx @@ -23,12 +23,16 @@ #include "colorAttrib.h" #include "materialAttrib.h" #include "textureAttrib.h" +#include "cullBinAttrib.h" #include "cullFaceAttrib.h" #include "transparencyAttrib.h" +#include "depthTestAttrib.h" +#include "depthOffsetAttrib.h" #include "depthWriteAttrib.h" #include "lodNode.h" #include "switchNode.h" #include "sequenceNode.h" +#include "uvScrollNode.h" #include "collisionNode.h" #include "collisionPolygon.h" #include "collisionPlane.h" @@ -92,7 +96,27 @@ add_node(PandaNode *node) { _data->add_child(_vpool); NodePath root(node); - convert_node(WorkingNodePath(root), _data, false); + convert_node(WorkingNodePath(root), _data, false, NULL); + + // Remove the vertex pool if it has no vertices. + if (_vpool->empty()) { + _data->remove_child(_vpool); + } + _vpool = NULL; +} + +/** + * Adds the scene graph rooted at the indicated node (but without the node + * itself) to the accumulated egg data within this object. Call + * get_egg_data() to retrieve the result. + */ +void EggSaver:: +add_subgraph(PandaNode *root) { + _vpool = new EggVertexPool(root->get_name()); + _data->add_child(_vpool); + + NodePath root_path(root); + recurse_nodes(root_path, _data, false, NULL); // Remove the vertex pool if it has no vertices. if (_vpool->empty()) { @@ -107,22 +131,22 @@ add_node(PandaNode *node) { */ void EggSaver:: convert_node(const WorkingNodePath &node_path, EggGroupNode *egg_parent, - bool has_decal) { + bool has_decal, CharacterJointMap *joint_map) { PandaNode *node = node_path.node(); if (node->is_geom_node()) { - convert_geom_node(DCAST(GeomNode, node), node_path, egg_parent, has_decal); + convert_geom_node(DCAST(GeomNode, node), node_path, egg_parent, has_decal, joint_map); } else if (node->is_of_type(LODNode::get_class_type())) { - convert_lod_node(DCAST(LODNode, node), node_path, egg_parent, has_decal); + convert_lod_node(DCAST(LODNode, node), node_path, egg_parent, has_decal, joint_map); } else if (node->is_of_type(SequenceNode::get_class_type())) { - convert_sequence_node(DCAST(SequenceNode, node), node_path, egg_parent, has_decal); + convert_sequence_node(DCAST(SequenceNode, node), node_path, egg_parent, has_decal, joint_map); } else if (node->is_of_type(SwitchNode::get_class_type())) { - convert_switch_node(DCAST(SwitchNode, node), node_path, egg_parent, has_decal); + convert_switch_node(DCAST(SwitchNode, node), node_path, egg_parent, has_decal, joint_map); } else if (node->is_of_type(CollisionNode::get_class_type())) { - convert_collision_node(DCAST(CollisionNode, node), node_path, egg_parent, has_decal); + convert_collision_node(DCAST(CollisionNode, node), node_path, egg_parent, has_decal, joint_map); } else if (node->is_of_type(AnimBundleNode::get_class_type())) { convert_anim_node(DCAST(AnimBundleNode, node), node_path, egg_parent, has_decal); @@ -136,7 +160,7 @@ convert_node(const WorkingNodePath &node_path, EggGroupNode *egg_parent, egg_parent->add_child(egg_group); apply_node_properties(egg_group, node); - recurse_nodes(node_path, egg_group, has_decal); + recurse_nodes(node_path, egg_group, has_decal, joint_map); } } @@ -145,7 +169,8 @@ convert_node(const WorkingNodePath &node_path, EggGroupNode *egg_parent, */ void EggSaver:: convert_lod_node(LODNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal) { + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map) { // An LOD node gets converted to an ordinary EggGroup, but we apply the // appropriate switch conditions to each of our children. EggGroup *egg_group = new EggGroup(node->get_name()); @@ -162,7 +187,7 @@ convert_lod_node(LODNode *node, const WorkingNodePath &node_path, // Convert just this one node to an EggGroup. PT(EggGroup) next_group = new EggGroup; - convert_node(WorkingNodePath(node_path, child), next_group, has_decal); + convert_node(WorkingNodePath(node_path, child), next_group, has_decal, joint_map); if (next_group->size() == 1) { // If we have exactly one child, and that child is an EggGroup, @@ -190,7 +215,8 @@ convert_lod_node(LODNode *node, const WorkingNodePath &node_path, */ void EggSaver:: convert_sequence_node(SequenceNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal) { + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map) { // A sequence node gets converted to an ordinary EggGroup, we only apply the // appropriate switch attributes to turn it into a sequence EggGroup *egg_group = new EggGroup(node->get_name()); @@ -208,7 +234,7 @@ convert_sequence_node(SequenceNode *node, const WorkingNodePath &node_path, // Convert just this one node to an EggGroup. PT(EggGroup) next_group = new EggGroup; - convert_node(WorkingNodePath(node_path, child), next_group, has_decal); + convert_node(WorkingNodePath(node_path, child), next_group, has_decal, joint_map); egg_group->add_child(next_group.p()); } @@ -220,7 +246,8 @@ convert_sequence_node(SequenceNode *node, const WorkingNodePath &node_path, */ void EggSaver:: convert_switch_node(SwitchNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal) { + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map) { // A sequence node gets converted to an ordinary EggGroup, we only apply the // appropriate switch attributes to turn it into a sequence EggGroup *egg_group = new EggGroup(node->get_name()); @@ -237,7 +264,7 @@ convert_switch_node(SwitchNode *node, const WorkingNodePath &node_path, // Convert just this one node to an EggGroup. PT(EggGroup) next_group = new EggGroup; - convert_node(WorkingNodePath(node_path, child), next_group, has_decal); + convert_node(WorkingNodePath(node_path, child), next_group, has_decal, joint_map); egg_group->add_child(next_group.p()); } @@ -314,7 +341,7 @@ convert_anim_node(AnimBundleNode *node, const WorkingNodePath &node_path, * structure. */ void EggSaver:: -convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, CharacterJointMap *jointMap) { +convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, CharacterJointMap *joint_map) { int num_children = bundleNode->get_num_children(); EggGroupNode *joint_group = egg_parent; @@ -329,9 +356,9 @@ convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, Charac joint->set_group_type(EggGroup::GT_joint); joint_group = joint; egg_parent->add_child(joint_group); - if (jointMap!=NULL) { - CharacterJointMap::iterator mi = jointMap->find(character_joint); - if (mi != jointMap->end()) { + if (joint_map != NULL) { + CharacterJointMap::iterator mi = joint_map->find(character_joint); + if (mi != joint_map->end()) { pvector > &joint_vertices = (*mi).second; pvector >::const_iterator vi; for (vi = joint_vertices.begin(); vi != joint_vertices.end(); ++vi) { @@ -343,7 +370,7 @@ convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, Charac for (int i = 0; i < num_children ; i++) { PartGroup *partGroup= bundleNode->get_child(i); - convert_character_bundle(partGroup, joint_group, jointMap); + convert_character_bundle(partGroup, joint_group, joint_map); } } @@ -353,35 +380,28 @@ convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, Charac */ void EggSaver:: convert_character_node(Character *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal) { + EggGroupNode *egg_parent, bool has_decal) { // A sequence node gets converted to an ordinary EggGroup, we only apply the - // appropriate switch attributes to turn it into a sequence + // appropriate switch attributes to turn it into a sequence. + // We have to use DT_structured since it is the only mode that preserves the + // node hierarchy, including LODNodes and CollisionNodes that may be under + // this Character node. EggGroup *egg_group = new EggGroup(node->get_name()); - egg_group->set_dart_type(EggGroup::DT_default); + egg_group->set_dart_type(EggGroup::DT_structured); egg_parent->add_child(egg_group); apply_node_properties(egg_group, node); - CharacterJointMap jointMap; + CharacterJointMap joint_map; + recurse_nodes(node_path, egg_group, has_decal, &joint_map); // turn it into a switch.. egg_group->set_switch_flag(true); - int num_children = node->get_num_children(); int num_bundles = node->get_num_bundles(); - - for (int i = 0; i < num_children; i++) { - PandaNode *child = node->get_child(i); - - if (child->is_geom_node()) { - convert_geom_node(DCAST(GeomNode, child), WorkingNodePath(node_path, child), egg_group, has_decal, &jointMap); - } + for (int i = 0; i < num_bundles; ++i) { + PartBundle *bundle = node->get_bundle(i); + convert_character_bundle(bundle, egg_group, &joint_map); } - - for (int i = 0; i < num_bundles ; i++) { - PartBundle *bundle= node->get_bundle(i); - convert_character_bundle(bundle, egg_group, &jointMap); - } - } @@ -390,13 +410,27 @@ convert_character_node(Character *node, const WorkingNodePath &node_path, */ void EggSaver:: convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal) { + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map) { // A sequence node gets converted to an ordinary EggGroup, we only apply the // appropriate switch attributes to turn it into a sequence EggGroup *egg_group = new EggGroup(node->get_name()); egg_parent->add_child(egg_group); apply_node_properties(egg_group, node, false); + // Set the collision masks, if present. + CollideMask from_mask = node->get_from_collide_mask(); + CollideMask into_mask = node->get_into_collide_mask(); + if (from_mask != CollisionNode::get_default_collide_mask() || + into_mask != CollisionNode::get_default_collide_mask()) { + if (from_mask == into_mask) { + egg_group->set_collide_mask(into_mask); + } else { + egg_group->set_from_collide_mask(from_mask); + egg_group->set_into_collide_mask(into_mask); + } + } + // turn it into a collision node egg_group->set_collide_flags(EggGroup::CF_descend); @@ -416,8 +450,20 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, // traverse solids for (int i = 0; i < num_solids; i++) { CPT(CollisionSolid) child = node->get_solid(i); + int flags = EggGroup::CF_descend; + + if (!child->is_tangible()) { + flags |= EggGroup::CF_intangible; + } + + if (child->has_effective_normal() && + child->get_effective_normal() == LVector3::up()) { + flags |= EggGroup::CF_level; + } + if (child->is_of_type(CollisionPolygon::get_class_type())) { egg_group->set_cs_type(EggGroup::CST_polyset); + egg_group->set_collide_flags(flags); EggPolygon *egg_poly = new EggPolygon; egg_group->add_child(egg_poly); @@ -443,10 +489,15 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_sphere = egg_group; } else { egg_sphere = new EggGroup; - egg_sphere->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_sphere); } - egg_sphere->set_cs_type(EggGroup::CST_sphere); + + if (child->is_of_type(CollisionInvSphere::get_class_type())) { + egg_sphere->set_cs_type(EggGroup::CST_inv_sphere); + } else { + egg_sphere->set_cs_type(EggGroup::CST_sphere); + } + egg_sphere->set_collide_flags(flags); EggVertex ev1, ev2; ev1.set_pos(LCAST(double, (center + offset) * net_mat)); @@ -480,10 +531,10 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_plane = egg_group; } else { egg_plane = new EggGroup; - egg_plane->set_collide_flags(EggGroup::CF_descend); egg_group->add_child(egg_plane); } egg_plane->set_cs_type(EggGroup::CST_plane); + egg_plane->set_collide_flags(flags); EggVertex ev0, ev1, ev2; ev0.set_pos(LCAST(double, origin * net_mat)); @@ -498,19 +549,83 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, egg_poly->add_vertex(cvpool->create_unique_vertex(ev2)); } else if (child->is_of_type(CollisionBox::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionBox" << "\n"; - } else if (child->is_of_type(CollisionInvSphere::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionInvSphere" << "\n"; + CPT(CollisionBox) box = DCAST(CollisionBox, child); + LPoint3 min_point = box->get_min(); + LPoint3 max_point = box->get_max(); + + EggGroup *egg_box; + if (num_solids == 1) { + egg_box = egg_group; + } else { + egg_box = new EggGroup; + egg_group->add_child(egg_box); + } + egg_box->set_cs_type(EggGroup::CST_box); + egg_box->set_collide_flags(flags); + + // Just add the min and max points. + EggVertex ev0, ev1; + ev0.set_pos(LCAST(double, min_point * net_mat)); + ev1.set_pos(LCAST(double, max_point * net_mat)); + + EggLine *egg_poly = new EggLine; + egg_box->add_child(egg_poly); + + egg_poly->add_vertex(cvpool->create_unique_vertex(ev0)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev1)); + } else if (child->is_of_type(CollisionTube::get_class_type())) { - nout << "Encountered unhandled collsion type: CollisionTube" << "\n"; + CPT(CollisionTube) tube = DCAST(CollisionTube, child); + LPoint3 point_a = tube->get_point_a(); + LPoint3 point_b = tube->get_point_b(); + LPoint3 centroid = (point_a + point_b) * 0.5f; + + // Also get an arbitrary vector perpendicular to the tube. + LVector3 axis = point_b - point_a; + LVector3 sideways; + if (abs(axis[2]) > abs(axis[1])) { + sideways = axis.cross(LVector3(0, 1, 0)); + } else { + sideways = axis.cross(LVector3(0, 0, 1)); + } + sideways.normalize(); + sideways *= tube->get_radius(); + LVector3 extend = axis.normalized() * tube->get_radius(); + + EggGroup *egg_tube; + if (num_solids == 1) { + egg_tube = egg_group; + } else { + egg_tube = new EggGroup; + egg_group->add_child(egg_tube); + } + egg_tube->set_cs_type(EggGroup::CST_tube); + egg_tube->set_collide_flags(flags); + + // Add two points for the endcaps, and then two points around the + // centroid to indicate the radius. + EggVertex ev0, ev1, ev2, ev3; + ev0.set_pos(LCAST(double, (point_a - extend) * net_mat)); + ev1.set_pos(LCAST(double, (centroid + sideways) * net_mat)); + ev2.set_pos(LCAST(double, (point_b + extend) * net_mat)); + ev3.set_pos(LCAST(double, (centroid - sideways) * net_mat)); + + EggPolygon *egg_poly = new EggPolygon; + egg_tube->add_child(egg_poly); + + egg_poly->add_vertex(cvpool->create_unique_vertex(ev0)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev1)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev2)); + egg_poly->add_vertex(cvpool->create_unique_vertex(ev3)); + } else { - nout << "Encountered unknown CollisionSolid" << "\n"; + nout << "Encountered unknown collision solid type " << child->get_type() << "\n"; } } } // recurse over children - hm. do I need to do this? - recurse_nodes(node_path, egg_group, has_decal); + recurse_nodes(node_path, egg_group, has_decal, joint_map); } /** @@ -518,7 +633,7 @@ convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, */ void EggSaver:: convert_geom_node(GeomNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal, CharacterJointMap *jointMap) { + EggGroupNode *egg_parent, bool has_decal, CharacterJointMap *joint_map) { PT(EggGroup) egg_group = new EggGroup(node->get_name()); bool fancy_attributes = apply_node_properties(egg_group, node); @@ -548,7 +663,17 @@ convert_geom_node(GeomNode *node, const WorkingNodePath &node_path, // Now get out all the various kinds of geometry. int num_geoms = node->get_num_geoms(); for (int i = 0; i < num_geoms; ++i) { - CPT(RenderState) geom_state = net_state->compose(node->get_geom_state(i)); + CPT(RenderState) geom_state = node->get_geom_state(i); + CPT(RenderState) geom_net_state = net_state->compose(geom_state); + + // If there is only one Geom, and the node has no state, apply the state + // attributes from the Geom to the group instead, so that we don't end up + // duplicating it for a lot of primitives. + if (num_geoms == 1 && node->get_num_children() == 0 && egg_parent == egg_group && + !geom_state->is_empty() && node->get_state()->is_empty()) { + apply_state_properties(egg_group, geom_state); + geom_state = RenderState::make_empty(); + } const Geom *geom = node->get_geom(i); int num_primitives = geom->get_num_primitives(); @@ -557,12 +682,12 @@ convert_geom_node(GeomNode *node, const WorkingNodePath &node_path, CPT(GeomPrimitive) simple = primitive->decompose(); CPT(GeomVertexData) vdata = geom->get_vertex_data(); // vdata = vdata->animate_vertices(true, Thread::get_current_thread()); - convert_primitive(vdata, simple, geom_state, - net_mat, egg_parent, jointMap); + convert_primitive(vdata, simple, geom_state, geom_net_state, + net_mat, egg_parent, joint_map); } } - recurse_nodes(node_path, egg_parent, has_decal); + recurse_nodes(node_path, egg_parent, has_decal, joint_map); } /** @@ -571,11 +696,29 @@ convert_geom_node(GeomNode *node, const WorkingNodePath &node_path, void EggSaver:: convert_primitive(const GeomVertexData *vertex_data, const GeomPrimitive *primitive, - const RenderState *net_state, + const RenderState *geom_state, const RenderState *net_state, const LMatrix4 &net_mat, EggGroupNode *egg_parent, - CharacterJointMap *jointMap) { + CharacterJointMap *joint_map) { GeomVertexReader reader(vertex_data); + // Make a zygote that will be duplicated for each primitive. + PT(EggPrimitive) egg_prim; + if (primitive->is_of_type(GeomTriangles::get_class_type())) { + egg_prim = new EggPolygon(); + } else if (primitive->is_of_type(GeomPatches::get_class_type())) { + egg_prim = new EggPatch(); + } else if (primitive->is_of_type(GeomPoints::get_class_type())) { + egg_prim = new EggPoint(); + } else if (primitive->is_of_type(GeomLines::get_class_type())) { + egg_prim = new EggLine(); + } else { + // Huh, an unknown geometry type. + return; + } + + // Apply render attributes. + apply_state_properties(egg_prim, geom_state); + // Check for a color scale. LVecBase4 color_scale(1.0f, 1.0f, 1.0f, 1.0f); const ColorScaleAttrib *csa; @@ -607,20 +750,20 @@ convert_primitive(const GeomVertexData *vertex_data, const MaterialAttrib *ma; if (net_state->get_attrib(ma)) { egg_mat = get_egg_material(ma->get_material()); + if (egg_mat != (EggMaterial *)NULL) { + egg_prim->set_material(egg_mat); + } } // Check for a texture. - EggTexture *egg_tex = (EggTexture *)NULL; const TextureAttrib *ta; if (net_state->get_attrib(ta)) { - egg_tex = get_egg_texture(ta->get_texture()); - } + EggTexture *egg_tex = get_egg_texture(ta->get_texture()); - // Check the texture environment - if ((ta != (const TextureAttrib *)NULL) && (egg_tex != (const EggTexture *)NULL)) { - TextureStage* tex_stage = ta->get_on_stage(0); - if (tex_stage != (const TextureStage *)NULL) { - switch (tex_stage->get_mode()) { + if (egg_tex != (EggTexture *)NULL) { + TextureStage *tex_stage = ta->get_on_stage(0); + if (tex_stage != (TextureStage *)NULL) { + switch (tex_stage->get_mode()) { case TextureStage::M_modulate: if (has_color_off == true) { egg_tex->set_env_type(EggTexture::ET_replace); @@ -645,7 +788,10 @@ convert_primitive(const GeomVertexData *vertex_data, break; default: break; + } } + + egg_prim->set_texture(egg_tex); } } @@ -654,73 +800,22 @@ convert_primitive(const GeomVertexData *vertex_data, const CullFaceAttrib *cfa; if (net_state->get_attrib(cfa)) { if (cfa->get_effective_mode() == CullFaceAttrib::M_cull_none) { - bface = true; - } - } - - // Check the depth write flag - only needed for AM_blend_no_occlude - bool has_depthwrite = false; - DepthWriteAttrib::Mode depthwrite = DepthWriteAttrib::M_on; - const DepthWriteAttrib *dwa; - if (net_state->get_attrib(dwa)) { - depthwrite = dwa->get_mode(); - has_depthwrite = true; - } - - // Check the transparency flag. - bool has_transparency = false; - TransparencyAttrib::Mode transparency = TransparencyAttrib::M_none; - const TransparencyAttrib *tra; - if (net_state->get_attrib(tra)) { - transparency = tra->get_mode(); - has_transparency = true; - } - if (has_transparency && (egg_tex != (EggTexture *)NULL)) { - EggRenderMode::AlphaMode tex_trans = EggRenderMode::AM_unspecified; - switch (transparency) { - case TransparencyAttrib::M_none: - tex_trans = EggRenderMode::AM_off; - break; - case TransparencyAttrib::M_alpha: - if (has_depthwrite && (depthwrite == DepthWriteAttrib::M_off)) { - tex_trans = EggRenderMode::AM_blend_no_occlude; - has_depthwrite = false; - } else { - tex_trans = EggRenderMode::AM_blend; - } - break; - case TransparencyAttrib::M_premultiplied_alpha: - tex_trans = EggRenderMode::AM_premultiplied; - break; - case TransparencyAttrib::M_multisample: - tex_trans = EggRenderMode::AM_ms; - break; - case TransparencyAttrib::M_multisample_mask: - tex_trans = EggRenderMode::AM_ms_mask; - break; - case TransparencyAttrib::M_binary: - tex_trans = EggRenderMode::AM_binary; - break; - case TransparencyAttrib::M_dual: - tex_trans = EggRenderMode::AM_dual; - break; - default: // intentional fall-through - break; - } - if (tex_trans != EggRenderMode::AM_unspecified) { - egg_tex->set_alpha_mode(tex_trans); + egg_prim->set_bface_flag(true); } } // Check for line thickness and such. - bool has_render_mode = false; - bool perspective = false; - PN_stdfloat thickness = 1; const RenderModeAttrib *rma; if (net_state->get_attrib(rma)) { - has_render_mode = true; - thickness = rma->get_thickness(); - perspective = rma->get_perspective(); + if (egg_prim->is_of_type(EggPoint::get_class_type())) { + EggPoint *egg_point = (EggPoint *)egg_prim.p(); + egg_point->set_thick(rma->get_thickness()); + egg_point->set_perspective(rma->get_perspective()); + + } else if (egg_prim->is_of_type(EggLine::get_class_type())) { + EggLine *egg_line = (EggLine *)egg_prim.p(); + egg_line->set_thick(rma->get_thickness()); + } } LNormal normal; @@ -730,48 +825,9 @@ convert_primitive(const GeomVertexData *vertex_data, int num_primitives = primitive->get_num_primitives(); int num_vertices = primitive->get_num_vertices_per_primitive(); - EggPrimitive *(*make_func)(void); - - if (primitive->is_of_type(GeomTriangles::get_class_type())) { - make_func = make_egg_polygon; - } else if (primitive->is_of_type(GeomPatches::get_class_type())) { - make_func = make_egg_patch; - } else if (primitive->is_of_type(GeomPoints::get_class_type())) { - make_func = make_egg_point; - } else if (primitive->is_of_type(GeomLines::get_class_type())) { - make_func = make_egg_line; - } else { - // Huh, an unknown geometry type. - return; - } - for (int i = 0; i < num_primitives; ++i) { - PT(EggPrimitive) egg_prim = (*make_func)(); - - egg_parent->add_child(egg_prim); - - if (egg_mat != (EggMaterial *)NULL) { - egg_prim->set_material(egg_mat); - } - if (egg_tex != (EggTexture *)NULL) { - egg_prim->set_texture(egg_tex); - } - - if (bface) { - egg_prim->set_bface_flag(true); - } - - if (has_render_mode) { - if (egg_prim->is_of_type(EggPoint::get_class_type())) { - EggPoint *egg_point = (EggPoint *)egg_prim.p(); - egg_point->set_thick(thickness); - egg_point->set_perspective(perspective); - - } else if (egg_prim->is_of_type(EggLine::get_class_type())) { - EggLine *egg_line = (EggLine *)egg_prim.p(); - egg_line->set_thick(thickness); - } - } + PT(EggPrimitive) egg_child = egg_prim->make_copy(); + egg_parent->add_child(egg_child); for (int j = 0; j < num_vertices; j++) { EggVertex egg_vert; @@ -811,8 +867,8 @@ convert_primitive(const GeomVertexData *vertex_data, EggVertex *new_egg_vert = _vpool->create_unique_vertex(egg_vert); - if ((vertex_data->has_column(InternalName::get_transform_blend())) && - (jointMap!=NULL) && (transformBlendTable!=NULL)) { + if (vertex_data->has_column(InternalName::get_transform_blend()) && + joint_map != NULL && transformBlendTable != NULL) { reader.set_column(InternalName::get_transform_blend()); int idx = reader.get_data1i(); const TransformBlend &blend = transformBlendTable->get_blend(idx); @@ -824,9 +880,9 @@ convert_primitive(const GeomVertexData *vertex_data, if (vertex_transform->is_of_type(JointVertexTransform::get_class_type())) { const JointVertexTransform *joint_vertex_transform = DCAST(const JointVertexTransform, vertex_transform); - CharacterJointMap::iterator mi = jointMap->find(joint_vertex_transform->get_joint()); - if (mi == jointMap->end()) { - mi = jointMap->insert(CharacterJointMap::value_type(joint_vertex_transform->get_joint(), pvector >())).first; + CharacterJointMap::iterator mi = joint_map->find(joint_vertex_transform->get_joint()); + if (mi == joint_map->end()) { + mi = joint_map->insert(CharacterJointMap::value_type(joint_vertex_transform->get_joint(), pvector >())).first; } pvector > &joint_vertices = (*mi).second; joint_vertices.push_back(pair(new_egg_vert, weight)); @@ -835,7 +891,7 @@ convert_primitive(const GeomVertexData *vertex_data, } } - egg_prim->add_vertex(new_egg_vert); + egg_child->add_vertex(new_egg_vert); } } } @@ -845,13 +901,13 @@ convert_primitive(const GeomVertexData *vertex_data, */ void EggSaver:: recurse_nodes(const WorkingNodePath &node_path, EggGroupNode *egg_parent, - bool has_decal) { + bool has_decal, CharacterJointMap *joint_map) { PandaNode *node = node_path.node(); int num_children = node->get_num_children(); for (int i = 0; i < num_children; i++) { PandaNode *child = node->get_child(i); - convert_node(WorkingNodePath(node_path, child), egg_parent, has_decal); + convert_node(WorkingNodePath(node_path, child), egg_parent, has_decal, joint_map); } } @@ -897,6 +953,14 @@ apply_node_properties(EggGroup *egg_group, PandaNode *node, bool allow_backstage } } + if (node->is_of_type(UvScrollNode::get_class_type())) { + const UvScrollNode *scroll_node = (const UvScrollNode *)node; + egg_group->set_scroll_u(scroll_node->get_u_speed()); + egg_group->set_scroll_v(scroll_node->get_v_speed()); + egg_group->set_scroll_w(scroll_node->get_w_speed()); + egg_group->set_scroll_r(scroll_node->get_r_speed()); + } + const RenderEffects *effects = node->get_effects(); const RenderEffect *effect = effects->get_effect(BillboardEffect::get_class_type()); if (effect != (RenderEffect *)NULL) { @@ -941,6 +1005,97 @@ apply_node_properties(EggGroup *egg_group, PandaNode *node, bool allow_backstage any_applied = true; } + const RenderState *state = node->get_state(); + if (apply_state_properties(egg_group, state)) { + return true; + } + + return any_applied; +} + +/** + * Applies any special render state settings on the primitive or group. + * Returns true if any were applied, false otherwise. + */ +bool EggSaver:: +apply_state_properties(EggRenderMode *egg_render_mode, const RenderState *state) { + if (state->is_empty()) { + return false; + } + + bool any_applied = false; + + // Check the transparency mode. + const TransparencyAttrib *tra; + if (state->get_attrib(tra)) { + EggRenderMode::AlphaMode tex_trans = EggRenderMode::AM_unspecified; + switch (tra->get_mode()) { + case TransparencyAttrib::M_none: + tex_trans = EggRenderMode::AM_off; + break; + case TransparencyAttrib::M_alpha: + tex_trans = EggRenderMode::AM_blend; + break; + case TransparencyAttrib::M_premultiplied_alpha: + tex_trans = EggRenderMode::AM_premultiplied; + break; + case TransparencyAttrib::M_multisample: + tex_trans = EggRenderMode::AM_ms; + break; + case TransparencyAttrib::M_multisample_mask: + tex_trans = EggRenderMode::AM_ms_mask; + break; + case TransparencyAttrib::M_binary: + tex_trans = EggRenderMode::AM_binary; + break; + case TransparencyAttrib::M_dual: + tex_trans = EggRenderMode::AM_dual; + break; + default: // intentional fall-through + break; + } + egg_render_mode->set_alpha_mode(tex_trans); + } + + const DepthWriteAttrib *dwa; + if (state->get_attrib(dwa)) { + if (dwa->get_mode() != DepthWriteAttrib::M_off) { + egg_render_mode->set_depth_write_mode(EggRenderMode::DWM_on); + + } else if (egg_render_mode->get_alpha_mode() == EggRenderMode::AM_blend) { + // AM_blend_no_occlude is like AM_blend but also implies DWM_off. + egg_render_mode->set_alpha_mode(EggRenderMode::AM_blend_no_occlude); + + } else { + egg_render_mode->set_depth_write_mode(EggRenderMode::DWM_off); + } + any_applied = true; + } + + const DepthTestAttrib *dta; + if (state->get_attrib(dta)) { + RenderAttrib::PandaCompareFunc mode = dta->get_mode(); + if (mode == DepthTestAttrib::M_none || mode == DepthTestAttrib::M_always) { + egg_render_mode->set_depth_test_mode(EggRenderMode::DTM_off); + } else { + egg_render_mode->set_depth_test_mode(EggRenderMode::DTM_on); + } + any_applied = true; + } + + const DepthOffsetAttrib *doa; + if (state->get_attrib(doa)) { + egg_render_mode->set_depth_offset(doa->get_offset()); + any_applied = true; + } + + const CullBinAttrib *cba; + if (state->get_attrib(cba)) { + egg_render_mode->set_bin(cba->get_bin_name()); + egg_render_mode->set_draw_order(cba->get_draw_order()); + any_applied = true; + } + return any_applied; } @@ -1187,35 +1342,3 @@ get_egg_texture(Texture *tex) { return NULL; } - -/** - * A factory function to make a new EggPolygon instance. - */ -EggPrimitive *EggSaver:: -make_egg_polygon() { - return new EggPolygon; -} - -/** - * A factory function to make a new EggPatch instance. - */ -EggPrimitive *EggSaver:: -make_egg_patch() { - return new EggPatch; -} - -/** - * A factory function to make a new EggPoint instance. - */ -EggPrimitive *EggSaver:: -make_egg_point() { - return new EggPoint; -} - -/** - * A factory function to make a new EggLine instance. - */ -EggPrimitive *EggSaver:: -make_egg_line() { - return new EggLine; -} diff --git a/panda/src/egg2pg/eggSaver.h b/panda/src/egg2pg/eggSaver.h index 0944f0a4eb..a361591241 100644 --- a/panda/src/egg2pg/eggSaver.h +++ b/panda/src/egg2pg/eggSaver.h @@ -55,19 +55,23 @@ PUBLISHED: EggSaver(EggData *data = NULL); void add_node(PandaNode *node); + void add_subgraph(PandaNode *root); INLINE EggData *get_egg_data() const; private: typedef pmap > > CharacterJointMap; void convert_node(const WorkingNodePath &node_path, EggGroupNode *egg_parent, - bool has_decal); + bool has_decal, CharacterJointMap *joint_map); void convert_lod_node(LODNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal); + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map); void convert_sequence_node(SequenceNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal); + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map); void convert_switch_node(SwitchNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal); + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map); EggGroupNode *convert_animGroup_node(AnimGroup *animGroup, double fps ); void convert_anim_node(AnimBundleNode *node, const WorkingNodePath &node_path, EggGroupNode *egg_parent, bool has_decal); @@ -75,29 +79,27 @@ private: EggGroupNode *egg_parent, bool has_decal); void convert_character_bundle(PartGroup *bundleNode, EggGroupNode *egg_parent, CharacterJointMap *jointMap); void convert_collision_node(CollisionNode *node, const WorkingNodePath &node_path, - EggGroupNode *egg_parent, bool has_decal); + EggGroupNode *egg_parent, bool has_decal, + CharacterJointMap *joint_map); void convert_geom_node(GeomNode *node, const WorkingNodePath &node_path, EggGroupNode *egg_parent, bool has_decal, CharacterJointMap *jointMap=NULL); void convert_primitive(const GeomVertexData *vertex_data, const GeomPrimitive *primitive, + const RenderState *geom_state, const RenderState *net_state, const LMatrix4 &net_mat, EggGroupNode *egg_parent, CharacterJointMap *jointMap); void recurse_nodes(const WorkingNodePath &node_path, EggGroupNode *egg_parent, - bool has_decal); + bool has_decal, CharacterJointMap *joint_map); bool apply_node_properties(EggGroup *egg_group, PandaNode *node, bool allow_backstage = true); + bool apply_state_properties(EggRenderMode *egg_render_mode, const RenderState *state); bool apply_tags(EggGroup *egg_group, PandaNode *node); bool apply_tag(EggGroup *egg_group, PandaNode *node, const string &tag); EggMaterial *get_egg_material(Material *tex); EggTexture *get_egg_texture(Texture *tex); - static EggPrimitive *make_egg_polygon(); - static EggPrimitive *make_egg_patch(); - static EggPrimitive *make_egg_point(); - static EggPrimitive *make_egg_line(); - PT(EggData) _data; PT(EggVertexPool) _vpool; diff --git a/panda/src/egg2pg/save_egg_file.cxx b/panda/src/egg2pg/save_egg_file.cxx index db129802ba..520987da68 100644 --- a/panda/src/egg2pg/save_egg_file.cxx +++ b/panda/src/egg2pg/save_egg_file.cxx @@ -14,6 +14,7 @@ #include "save_egg_file.h" #include "eggSaver.h" #include "config_egg2pg.h" +#include "modelRoot.h" #include "sceneGraphReducer.h" #include "virtualFileSystem.h" #include "config_util.h" @@ -31,7 +32,13 @@ save_egg_file(const Filename &filename, PandaNode *node, CoordinateSystem cs) { data->set_coordinate_system(cs); EggSaver saver(data); - saver.add_node(node); + if (node->is_of_type(ModelRoot::get_class_type())) { + // If this is a ModelRoot, only write the nodes below it. Otherwise we + // end up inserting a node when we do a bam2egg. + saver.add_subgraph(node); + } else { + saver.add_node(node); + } return data->write_egg(filename); } @@ -43,6 +50,12 @@ save_egg_file(const Filename &filename, PandaNode *node, CoordinateSystem cs) { bool save_egg_data(EggData *data, PandaNode *node) { EggSaver saver(data); - saver.add_node(node); + if (node->is_of_type(ModelRoot::get_class_type())) { + // If this is a ModelRoot, only write the nodes below it. Otherwise we + // end up inserting a node when we do a bam2egg. + saver.add_subgraph(node); + } else { + saver.add_node(node); + } return true; } diff --git a/panda/src/event/asyncTask.cxx b/panda/src/event/asyncTask.cxx index 2a83740b52..fb251aebd6 100644 --- a/panda/src/event/asyncTask.cxx +++ b/panda/src/event/asyncTask.cxx @@ -18,10 +18,6 @@ #include "throw_event.h" #include "eventParameter.h" -#ifdef HAVE_PYTHON -#include "py_panda.h" -#endif - AtomicAdjust::Integer AsyncTask::_next_task_id; PStatCollector AsyncTask::_show_code_pcollector("App:Show code"); TypeHandle AsyncTask::_type_handle; @@ -48,9 +44,6 @@ AsyncTask(const string &name) : _total_dt(0.0), _num_frames(0) { -#ifdef HAVE_PYTHON - _python_object = NULL; -#endif // HAVE_PYTHON set_name(name); // Carefully copy _next_task_id and increment it so that we get a unique ID. @@ -68,9 +61,6 @@ AsyncTask(const string &name) : AsyncTask:: ~AsyncTask() { nassertv(_state == S_inactive && _manager == NULL && _chain == NULL); -#ifdef HAVE_PYTHON - set_python_object(NULL); -#endif } /** @@ -355,35 +345,6 @@ set_priority(int priority) { } } -#ifdef HAVE_PYTHON -/** - * Specifies an arbitrary Python object that will be piggybacked on the task - * object. - */ -void AsyncTask:: -set_python_object(PyObject *python_object) { - Py_XINCREF(python_object); - Py_XDECREF(_python_object); - _python_object = python_object; -} -#endif // HAVE_PYTHON - -#ifdef HAVE_PYTHON -/** - * Returns the Python object that was specified to set_python_object(), if - * any, or None if no object was specified. - */ -PyObject *AsyncTask:: -get_python_object() const { - if (_python_object != (PyObject *)NULL) { - Py_XINCREF(_python_object); - return _python_object; - } - Py_INCREF(Py_None); - return Py_None; -} -#endif // HAVE_PYTHON - /** * */ diff --git a/panda/src/event/asyncTask.h b/panda/src/event/asyncTask.h index 48633a9d91..97176df0a3 100644 --- a/panda/src/event/asyncTask.h +++ b/panda/src/event/asyncTask.h @@ -92,11 +92,6 @@ PUBLISHED: INLINE void set_done_event(const string &done_event); INLINE const string &get_done_event() const; -#ifdef HAVE_PYTHON - void set_python_object(PyObject *python_object); - PyObject *get_python_object() const; -#endif // HAVE_PYTHON - INLINE double get_dt() const; INLINE double get_max_dt() const; INLINE double get_average_dt() const; @@ -140,11 +135,6 @@ protected: static PStatCollector _show_code_pcollector; PStatCollector _task_pcollector; -private: -#ifdef HAVE_PYTHON - PyObject *_python_object; -#endif // HAVE_PYTHON - public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/event/pythonTask.I b/panda/src/event/pythonTask.I index 7b2e5d5082..b2f9a0ef07 100644 --- a/panda/src/event/pythonTask.I +++ b/panda/src/event/pythonTask.I @@ -10,37 +10,3 @@ * @author drose * @date 2008-09-16 */ - -/** - * If None is passed, calls clear_delay, otherwise sets the delay time. See - * AsyncTask::set_delay() and AsyncTask::clear_delay(). - */ -INLINE void PythonTask:: -set_delay(PyObject *delay) { - if (delay == Py_None) { - AsyncTask::clear_delay(); - return; - } - - PyObject *value = PyNumber_Float(delay); - if (value == NULL) { - return; - } - - AsyncTask::set_delay(PyFloat_AS_DOUBLE(value)); - Py_DECREF(value); -} - -/** - * Returns the delay time if set, None otherwise. See AsyncTask::has_delay() - * and AsyncTask::get_delay(). - */ -INLINE PyObject *PythonTask:: -get_delay() const { - if (AsyncTask::has_delay()) { - return PyFloat_FromDouble(AsyncTask::get_delay()); - } else { - Py_INCREF(Py_None); - return Py_None; - } -} diff --git a/panda/src/event/pythonTask.cxx b/panda/src/event/pythonTask.cxx index 61068759f1..3ca6178803 100644 --- a/panda/src/event/pythonTask.cxx +++ b/panda/src/event/pythonTask.cxx @@ -18,12 +18,9 @@ #ifdef HAVE_PYTHON #include "py_panda.h" -TypeHandle PythonTask::_type_handle; +#include "pythonThread.h" -Configure(config_pythonTask); -ConfigureFn(config_pythonTask) { - PythonTask::init_type(); -} +TypeHandle PythonTask::_type_handle; #ifndef CPPPARSER extern struct Dtool_PyTypedObject Dtool_TypedReferenceCount; @@ -188,6 +185,19 @@ get_upon_death() { */ void PythonTask:: set_owner(PyObject *owner) { +#ifndef NDEBUG + if (owner != Py_None) { + PyObject *add = PyObject_GetAttrString(owner, "_addTask"); + PyObject *clear = PyObject_GetAttrString(owner, "_clearTask"); + + if (add == NULL || !PyCallable_Check(add) || + clear == NULL || !PyCallable_Check(clear)) { + Dtool_Raise_TypeError("owner object should have _addTask and _clearTask methods"); + return; + } + } +#endif + if (_owner != NULL && _owner != Py_None && _state != S_inactive) { unregister_from_owner(); } @@ -391,8 +401,7 @@ do_python_task() { if (_generator == (PyObject *)NULL) { // We are calling the function directly. PyObject *args = get_args(); - result = - Thread::get_current_thread()->call_python_func(_function, args); + result = PythonThread::call_python_func(_function, args); Py_DECREF(args); #ifdef PyGen_Check @@ -494,10 +503,16 @@ do_python_task() { ostringstream strm; #if PY_MAJOR_VERSION >= 3 PyObject *str = PyObject_ASCII(result); + if (str == NULL) { + str = PyUnicode_FromString(""); + } strm << *this << " returned " << PyUnicode_AsUTF8(str); #else PyObject *str = PyObject_Repr(result); + if (str == NULL) { + str = PyString_FromString(""); + } strm << *this << " returned " << PyString_AsString(str); #endif @@ -606,18 +621,9 @@ call_owner_method(const char *method_name) { if (_owner != Py_None) { PyObject *func = PyObject_GetAttrString(_owner, (char *)method_name); if (func == (PyObject *)NULL) { -#if PY_MAJOR_VERSION >= 3 - PyObject *str = PyObject_ASCII(_owner); task_cat.error() - << "Owner object " << PyUnicode_AsUTF8(str) << " added to " - << *this << " has no method " << method_name << "().\n"; -#else - PyObject *str = PyObject_Repr(_owner); - task_cat.error() - << "Owner object " << PyString_AsString(str) << " added to " - << *this << " has no method " << method_name << "().\n"; -#endif - Py_DECREF(str); + << "Owner object added to " << *this << " has no method " + << method_name << "().\n"; } else { call_function(func); diff --git a/panda/src/event/pythonTask.h b/panda/src/event/pythonTask.h index 558fb7c5a8..d97be5795e 100644 --- a/panda/src/event/pythonTask.h +++ b/panda/src/event/pythonTask.h @@ -50,9 +50,6 @@ PUBLISHED: int __traverse__(visitproc visit, void *arg); int __clear__(); - INLINE void set_delay(PyObject *delay); - INLINE PyObject *get_delay() const; - PUBLISHED: // The name of this task. MAKE_PROPERTY(name, get_name, set_name); @@ -72,10 +69,10 @@ PUBLISHED: MAKE_PROPERTY(wakeTime, get_wake_time); // The delay value that has been set on this task, if any, or None. - MAKE_PROPERTY(delay_time, get_delay, set_delay); + MAKE_PROPERTY2(delay_time, has_delay, get_delay, set_delay, clear_delay); // Alias of delay_time. - MAKE_PROPERTY(delayTime, get_delay, set_delay); + MAKE_PROPERTY2(delayTime, has_delay, get_delay, set_delay, clear_delay); // The number of frames that have elapsed since the task was started, // according to the task manager's clock. diff --git a/panda/src/express/memoryInfo.cxx b/panda/src/express/memoryInfo.cxx index 815e57448d..d12b7313a0 100644 --- a/panda/src/express/memoryInfo.cxx +++ b/panda/src/express/memoryInfo.cxx @@ -108,7 +108,7 @@ determine_dynamic_type() { return; } - TypeHandle orig_type = _dynamic_type; + //TypeHandle orig_type = _dynamic_type; update_type_handle(_dynamic_type, got_type); } } diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index c99c83bdb3..2f7cda439b 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -2478,12 +2478,7 @@ check_signatures() { } if (pkey != NULL) { - EVP_MD_CTX *md_ctx; -#ifdef SSL_097 - md_ctx = EVP_MD_CTX_create(); -#else - md_ctx = new EVP_MD_CTX; -#endif + EVP_MD_CTX *md_ctx = EVP_MD_CTX_create(); EVP_VerifyInit(md_ctx, EVP_sha1()); nassertv(_read != NULL); @@ -2764,12 +2759,7 @@ write_data(ostream &write, istream *read, streampos fpos, // And we also need to have a private key. nassertr(_pkey != NULL, fpos); - EVP_MD_CTX *md_ctx; -#ifdef SSL_097 - md_ctx = EVP_MD_CTX_create(); -#else - md_ctx = new EVP_MD_CTX; -#endif + EVP_MD_CTX *md_ctx = EVP_MD_CTX_create(); EVP_SignInit(md_ctx, EVP_sha1()); // Read and hash the multifile contents, but only up till @@ -2807,11 +2797,7 @@ write_data(ostream &write, istream *read, streampos fpos, delete[] sig_data; -#ifdef SSL_097 EVP_MD_CTX_destroy(md_ctx); -#else - delete md_ctx; -#endif } #endif // HAVE_OPENSSL diff --git a/panda/src/express/nodeReferenceCount.I b/panda/src/express/nodeReferenceCount.I index d27fa0a43a..4273f0b78c 100644 --- a/panda/src/express/nodeReferenceCount.I +++ b/panda/src/express/nodeReferenceCount.I @@ -129,7 +129,7 @@ node_ref() const { #endif ref(); - AtomicAdjust::inc(((NodeReferenceCount *)this)->_node_ref_count); + AtomicAdjust::inc(_node_ref_count); } /** @@ -174,7 +174,7 @@ node_unref_only() const { // you can't use PointerTo's? nassertv(_node_ref_count > 0); - AtomicAdjust::dec(((NodeReferenceCount *)this)->_node_ref_count); + AtomicAdjust::dec(_node_ref_count); } /** diff --git a/panda/src/express/nodeReferenceCount.h b/panda/src/express/nodeReferenceCount.h index 349d66660b..2312508f1b 100644 --- a/panda/src/express/nodeReferenceCount.h +++ b/panda/src/express/nodeReferenceCount.h @@ -42,14 +42,13 @@ PUBLISHED: INLINE void node_ref() const; INLINE bool node_unref() const; INLINE bool test_ref_count_integrity() const; - -protected: INLINE void node_unref_only() const; +protected: bool do_test_ref_count_integrity() const; private: - AtomicAdjust::Integer _node_ref_count; + mutable AtomicAdjust::Integer _node_ref_count; public: static TypeHandle get_class_type() { diff --git a/panda/src/express/ordered_vector.T b/panda/src/express/ordered_vector.T index 6a7100f90f..7ea866e52f 100644 --- a/panda/src/express/ordered_vector.T +++ b/panda/src/express/ordered_vector.T @@ -280,7 +280,6 @@ TYPENAME ordered_vector::SIZE_TYPE ordered_vector::CONST_ITERATOR first, TYPENAME ordered_vector::CONST_ITERATOR last, const TYPENAME ordered_vector::KEY_TYPE &key) const { - typedef pair::CONST_ITERATOR, TYPENAME ordered_vector::CONST_ITERATOR> pair_type; if (first == last) { // The list is empty; the key is not on the list. diff --git a/panda/src/express/pointerToArray.h b/panda/src/express/pointerToArray.h index 5632a8246f..004e15fdea 100644 --- a/panda/src/express/pointerToArray.h +++ b/panda/src/express/pointerToArray.h @@ -14,36 +14,47 @@ #ifndef POINTERTOARRAY_H #define POINTERTOARRAY_H - /* * This file defines the classes PointerToArray and ConstPointerToArray (and * their abbreviations, PTA and CPTA), which are extensions to the PointerTo - * class that support reference-counted arrays. You may think of a - * PointerToArray as the same thing as a traditional C-style array. However, - * it actually stores a pointer to an STL vector, which is then reference- - * counted. Thus, most vector operations may be applied directly to a - * PointerToArray object, including dynamic resizing via push_back() and - * pop_back(). Unlike the PointerTo class, the PointerToArray may store - * pointers to any kind of object, not just those derived from ReferenceCount. + * class that support reference-counted arrays. + * + * You may think of a PointerToArray as the same thing as a traditional + * C-style array. However, it actually stores a pointer to an STL vector, + * which is then reference-counted. Thus, most vector operations may be + * applied directly to a PointerToArray object, including dynamic resizing via + * push_back() and pop_back(). + * + * Unlike the PointerTo class, the PointerToArray may store pointers to any + * kind of object, not just those derived from ReferenceCount. + * * Like PointerTo and ConstPointerTo, the macro abbreviations PTA and CPTA are - * defined for convenience. Some examples of syntax: instead of: + * defined for convenience. + * + * Some examples of syntax: instead of: + * * PTA(int) array(10); int *array = new int[10]; * memset(array, 0, sizeof(int) * 10); memset(array, 0, sizeof(int) * 10); - * array[i] = array[i+1]; array[i] = array[i+1]; num_elements - * = array.size(); (no equivalent) PTA(int) copy = array; - * int *copy = array; Note that in the above example, unlike an STL vector - * (but like a C-style array), assigning a PointerToArray object from another - * simply copies the pointer, and does not copy individual elements. (Of - * course, reference counts are adjusted appropriately7.) If you actually - * wanted an element-by-element copy of the array, you would do this: PTA(int) - * copy(0); Create a pointer to an empty vector. copy.v() = - * array.v(); v() is the STL vector itself. The (0) parameter to - * the constructor in the above example is crucial. When a numeric length - * parameter, such as zero, is given to the constructor, it means to define a - * new STL vector with that number of elements initially in it. If no - * parameter is given, on the other hand, it means the PointerToArray should - * point to nothing--no STL vector is created. This is equivalent to a C - * array that points to NULL. + * array[i] = array[i+1]; array[i] = array[i+1]; + * num_elements = array.size(); (no equivalent) + * + * PTA(int) copy = array; int *copy = array; + * + * Note that in the above example, unlike an STL vector (but like a C-style + * array), assigning a PointerToArray object from another simply copies the + * pointer, and does not copy individual elements. (Of course, reference + * counts are adjusted appropriately.) If you actually wanted an + * element-by-element copy of the array, you would do this: + * + * PTA(int) copy(0); // Create a pointer to an empty vector. + * copy.v() = array.v(); // v() is the STL vector itself. + * + * The (0) parameter to the constructor in the above example is crucial. When + * a numeric length parameter, such as zero, is given to the constructor, it + * means to define a new STL vector with that number of elements initially in + * it. If no parameter is given, on the other hand, it means the + * PointerToArray should point to nothing--no STL vector is created. This is + * equivalent to a C array that points to NULL. */ #include "pandabase.h" @@ -102,11 +113,9 @@ PUBLISHED: INLINE int get_node_ref_count() const; #ifdef HAVE_PYTHON -#if PY_VERSION_HEX >= 0x02060000 EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags)); EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const); #endif -#endif #else // CPPPARSER // This is the actual, complete interface. @@ -257,11 +266,9 @@ PUBLISHED: INLINE int get_node_ref_count() const; #ifdef HAVE_PYTHON -#if PY_VERSION_HEX >= 0x02060000 EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const); EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const); #endif -#endif #else // CPPPARSER // This is the actual, complete interface. diff --git a/panda/src/express/pointerToArray_ext.I b/panda/src/express/pointerToArray_ext.I index 82ba097d24..7502334e6e 100644 --- a/panda/src/express/pointerToArray_ext.I +++ b/panda/src/express/pointerToArray_ext.I @@ -175,7 +175,6 @@ __getitem__(size_t n) const { return (*this->_this)[n]; } -#if PY_VERSION_HEX >= 0x02060000 /** * This is used to implement the buffer protocol, in order to allow efficient * access to the array data through a Python multiview object. @@ -183,7 +182,7 @@ __getitem__(size_t n) const { template INLINE int Extension >:: __getbuffer__(PyObject *self, Py_buffer *view, int flags) { - +#if PY_VERSION_HEX >= 0x02060000 const char *format = get_format_code(Element); if (format == NULL) { // Not supported. @@ -222,6 +221,9 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) { view->internal = (void*) this->_this; return 0; +#else + return -1; +#endif } /** @@ -230,13 +232,14 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) { template INLINE void Extension >:: __releasebuffer__(PyObject *self, Py_buffer *view) const { +#if PY_VERSION_HEX >= 0x02060000 // Note: PyBuffer_Release automatically decrements view->obj. - if (view->internal != NULL) { // Oh, right, let's not forget to unref this. unref_delete((const PointerToArray *)view->internal); view->internal = NULL; } +#endif } /** @@ -246,7 +249,7 @@ __releasebuffer__(PyObject *self, Py_buffer *view) const { template INLINE int Extension >:: __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { - +#if PY_VERSION_HEX >= 0x02060000 if ((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) { PyErr_SetString(PyExc_BufferError, "Object is not writable."); @@ -291,6 +294,9 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { view->internal = (void*) this->_this; return 0; +#else + return -1; +#endif } /** @@ -299,12 +305,12 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { template INLINE void Extension >:: __releasebuffer__(PyObject *self, Py_buffer *view) const { +#if PY_VERSION_HEX >= 0x02060000 // Note: PyBuffer_Release automatically decrements obj->view. - if (view->internal != NULL) { // Oh, right, let's not forget to unref this. unref_delete((const PointerToArray *)view->internal); view->internal = NULL; } +#endif } -#endif // PY_VERSION_HEX diff --git a/panda/src/express/pointerToArray_ext.h b/panda/src/express/pointerToArray_ext.h index d5c3fd5824..73ec780675 100644 --- a/panda/src/express/pointerToArray_ext.h +++ b/panda/src/express/pointerToArray_ext.h @@ -35,10 +35,8 @@ public: INLINE const Element &__getitem__(size_t n) const; INLINE void __setitem__(size_t n, const Element &value); -#if PY_VERSION_HEX >= 0x02060000 INLINE int __getbuffer__(PyObject *self, Py_buffer *view, int flags); INLINE void __releasebuffer__(PyObject *self, Py_buffer *view) const; -#endif }; /** @@ -55,10 +53,8 @@ public: INLINE const Element &__getitem__(size_t n) const; -#if PY_VERSION_HEX >= 0x02060000 INLINE int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const; INLINE void __releasebuffer__(PyObject *self, Py_buffer *view) const; -#endif }; #ifdef _MSC_VER diff --git a/panda/src/framework/pandaFramework.cxx b/panda/src/framework/pandaFramework.cxx index 3703793fac..d5c6b49829 100644 --- a/panda/src/framework/pandaFramework.cxx +++ b/panda/src/framework/pandaFramework.cxx @@ -94,7 +94,7 @@ open_framework(int &argc, char **&argv) { extern EXPCL_PANDAGL void init_libpandagl(); init_libpandagl(); #elif defined(HAVE_DX9) - extern EXPCL_PANDADX9 void init_libpandadx9(); + extern EXPCL_PANDADX void init_libpandadx9(); init_libpandadx9(); #elif defined(HAVE_TINYDISPLAY) extern EXPCL_TINYDISPLAY void init_libtinydisplay(); diff --git a/panda/src/framework/windowFramework.cxx b/panda/src/framework/windowFramework.cxx index 7ac9e89fa2..756a1b61f1 100644 --- a/panda/src/framework/windowFramework.cxx +++ b/panda/src/framework/windowFramework.cxx @@ -595,23 +595,20 @@ load_model(const NodePath &parent, Filename filename) { extension = Filename(filename.get_basename_wo_extension()).get_extension(); } #endif // HAVE_ZLIB + TexturePool *texture_pool = TexturePool::get_global_ptr(); + LoaderFileType *model_type = NULL; + if (!extension.empty()) { LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); - LoaderFileType *model_type = - reg->get_type_from_extension(extension); + model_type = reg->get_type_from_extension(extension); + if (model_type == (LoaderFileType *)NULL) { // The extension isn't a known model file type; is it a known image file // extension? - if (extension == "txo" || downcase(extension) == "dds") { - // A texture object. Not exactly an image, but certainly a texture. + TexturePool *texture_pool = TexturePool::get_global_ptr(); + if (texture_pool->get_texture_type(extension) != NULL) { + // It is a known image file extension. is_image = true; - - } else { - TexturePool *texture_pool = TexturePool::get_global_ptr(); - if (texture_pool->get_texture_type(extension) != NULL) { - // It is a known image file extension. - is_image = true; - } } } } @@ -629,6 +626,13 @@ load_model(const NodePath &parent, Filename filename) { node = load_image_as_model(filename); } else { node = loader.load_sync(filename, options); + + // It failed to load. Is it because the extension isn't recognised? If + // so, then we just got done printing out the known scene types, and we + // should also print out the supported texture types. + if (node == (PandaNode *)NULL && !is_image && model_type == NULL) { + texture_pool->write_texture_types(nout, 2); + } } if (node == (PandaNode *)NULL) { diff --git a/panda/src/gles2gsg/gles2gsg.h b/panda/src/gles2gsg/gles2gsg.h index f88d40c3fc..8d80e690eb 100644 --- a/panda/src/gles2gsg/gles2gsg.h +++ b/panda/src/gles2gsg/gles2gsg.h @@ -231,6 +231,16 @@ typedef char GLchar; #define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 #define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 #define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 #undef SUPPORT_IMMEDIATE_MODE #define APIENTRY diff --git a/panda/src/glesgsg/glesgsg.h b/panda/src/glesgsg/glesgsg.h index 416e5737cb..c0afb58b56 100644 --- a/panda/src/glesgsg/glesgsg.h +++ b/panda/src/glesgsg/glesgsg.h @@ -132,6 +132,17 @@ #define GL_DEBUG_SEVERITY_LOW 0x9148 #define GL_DEBUG_OUTPUT 0x92E0 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 + #undef SUPPORT_IMMEDIATE_MODE #define APIENTRY #define APIENTRYP * diff --git a/panda/src/glstuff/glGeomMunger_src.cxx b/panda/src/glstuff/glGeomMunger_src.cxx index e9a98e82fc..b26f2bbb10 100644 --- a/panda/src/glstuff/glGeomMunger_src.cxx +++ b/panda/src/glstuff/glGeomMunger_src.cxx @@ -409,41 +409,6 @@ premunge_format_impl(const GeomVertexFormat *orig) { return format; } -#ifdef OPENGLES -/** - * Converts a Geom and/or its data as necessary. - */ -void CLP(GeomMunger):: -munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data, - Thread *current_thread) { - StandardMunger::munge_geom_impl(geom, vertex_data, current_thread); - - // OpenGL ES has no polygon mode, so we have to emulate it. - RenderModeAttrib::Mode render_mode = get_render_mode(); - if (render_mode == RenderModeAttrib::M_point) { - geom = geom->make_points(); - } else if (render_mode == RenderModeAttrib::M_wireframe) { - geom = geom->make_lines(); - } -} - -/** - * Converts a Geom and/or its data as necessary. - */ -void CLP(GeomMunger):: -premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data) { - StandardMunger::premunge_geom_impl(geom, vertex_data); - - // OpenGL ES has no polygon mode, so we have to emulate it. - RenderModeAttrib::Mode render_mode = get_render_mode(); - if (render_mode == RenderModeAttrib::M_point) { - geom = geom->make_points(); - } else if (render_mode == RenderModeAttrib::M_wireframe) { - geom = geom->make_lines(); - } -} -#endif // OPENGLES - /** * Called to compare two GeomMungers who are known to be of the same type, for * an apples-to-apples comparison. This will never be called on two pointers @@ -473,11 +438,6 @@ compare_to_impl(const GeomMunger *other) const { int CLP(GeomMunger):: geom_compare_to_impl(const GeomMunger *other) const { const CLP(GeomMunger) *om = (CLP(GeomMunger) *)other; -#ifdef OPENGLES - if (get_render_mode() != om->get_render_mode()) { - return get_render_mode() < om->get_render_mode() ? -1 : 1; - } -#endif if (_texture != om->_texture) { return _texture < om->_texture ? -1 : 1; } diff --git a/panda/src/glstuff/glGeomMunger_src.h b/panda/src/glstuff/glGeomMunger_src.h index 5122dda25f..a3eae7c8b4 100644 --- a/panda/src/glstuff/glGeomMunger_src.h +++ b/panda/src/glstuff/glGeomMunger_src.h @@ -40,12 +40,6 @@ protected: const GeomVertexAnimationSpec &animation); virtual CPT(GeomVertexFormat) premunge_format_impl(const GeomVertexFormat *orig); -#ifdef OPENGLES - virtual void munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data, - Thread *current_thread); - virtual void premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data); -#endif - virtual int compare_to_impl(const GeomMunger *other) const; virtual int geom_compare_to_impl(const GeomMunger *other) const; diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 7e055364e4..ad09596f9c 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -514,7 +514,8 @@ rebuild_bitplanes() { if (num_fbos > _fbo.size()) { // Generate more FBO handles. int start = _fbo.size(); - _fbo.resize(num_fbos, 0); + GLuint zero = 0; + _fbo.resize(num_fbos, zero); glgsg->_glGenFramebuffers(num_fbos - start, &_fbo[start]); } @@ -1752,7 +1753,7 @@ resolve_multisamples() { if (_rbm[RTP_depth_stencil] != 0 || _rbm[RTP_depth] != 0) { if (_shared_depth_buffer) { CLP(GraphicsBuffer) *graphics_buffer = NULL; - CLP(GraphicsBuffer) *highest_sort_graphics_buffer = NULL; + //CLP(GraphicsBuffer) *highest_sort_graphics_buffer = NULL; list ::iterator graphics_buffer_iterator; int max_sort_order = 0; @@ -1764,7 +1765,7 @@ resolve_multisamples() { // this call removes the entry from the list if (graphics_buffer->get_sort() >= max_sort_order) { max_sort_order = graphics_buffer->get_sort(); - highest_sort_graphics_buffer = graphics_buffer; + //highest_sort_graphics_buffer = graphics_buffer; } } } diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index bba123ea92..dc2c0c45e6 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -628,6 +628,9 @@ reset() { } _supported_geom_rendering = +#ifndef OPENGLES + Geom::GR_render_mode_wireframe | Geom::GR_render_mode_point | +#endif Geom::GR_indexed_point | Geom::GR_point | Geom::GR_point_uniform_size | Geom::GR_indexed_other | @@ -1053,6 +1056,24 @@ reset() { break; #endif + case GL_COMPRESSED_R11_EAC: + case GL_COMPRESSED_RG11_EAC: + _compressed_texture_formats.set_bit(Texture::CM_eac); + break; + + case GL_COMPRESSED_RGB8_ETC2: + case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + case GL_COMPRESSED_RGBA8_ETC2_EAC: + _compressed_texture_formats.set_bit(Texture::CM_etc1); + _compressed_texture_formats.set_bit(Texture::CM_etc2); + break; + +#ifdef OPENGLES + case GL_ETC1_RGB8_OES: + _compressed_texture_formats.set_bit(Texture::CM_etc1); + break; +#endif + default: break; } @@ -1335,6 +1356,8 @@ reset() { get_extension_func("glMapBuffer"); _glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) get_extension_func("glUnmapBuffer"); + _glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) + get_extension_func("glGetBufferSubData"); #endif } #ifndef OPENGLES_1 @@ -1355,6 +1378,8 @@ reset() { get_extension_func("glMapBufferARB"); _glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) get_extension_func("glUnmapBufferARB"); + _glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) + get_extension_func("glGetBufferSubDataARB"); } #endif // OPENGLES_1 @@ -3935,7 +3960,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, #endif #if !defined(OPENGLES) && defined(SUPPORT_FIXED_FUNCTION) // Display lists not supported by OpenGL ES. - if (geom_reader->get_usage_hint() == Geom::UH_static && + if (/*geom_reader->get_usage_hint() == Geom::UH_static &&*/ _data_reader->get_usage_hint() == Geom::UH_static && display_lists) { // If the geom claims to be totally static, try to build it into a display @@ -8066,6 +8091,12 @@ get_texture_target(Texture::TextureType texture_type) const { return GL_TEXTURE_1D; #endif + case Texture::TT_1d_texture_array: + // There are no 1D array textures in OpenGL ES. Fall back to 2D textures. +#ifndef OPENGLES + return GL_TEXTURE_1D_ARRAY; +#endif + case Texture::TT_2d_texture: return GL_TEXTURE_2D; @@ -8282,6 +8313,11 @@ get_component_type(Texture::ComponentType component_type) { return GL_HALF_FLOAT; #endif +#ifndef OPENGLES_1 + case Texture::T_unsigned_int: + return GL_UNSIGNED_INT; +#endif + default: GLCAT.error() << "Invalid Texture::Type value!\n"; return GL_UNSIGNED_BYTE; @@ -8444,9 +8480,9 @@ get_external_image_format(Texture *tex) const { case Texture::CM_rgtc: #ifndef OPENGLES - if (tex->get_format() == Texture::F_luminance) { + if (format == Texture::F_luminance) { return GL_COMPRESSED_LUMINANCE_LATC1_EXT; - } else if (tex->get_format() == Texture::F_luminance_alpha) { + } else if (format == Texture::F_luminance_alpha) { return GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; } else if (tex->get_num_components() == 1) { return GL_COMPRESSED_RED_RGTC1; @@ -8456,6 +8492,41 @@ get_external_image_format(Texture *tex) const { #endif break; + case Texture::CM_etc1: +#ifdef OPENGLES + return GL_ETC1_RGB8_OES; +#endif + // Fall through - ETC2 is backward compatible + case Texture::CM_etc2: + if (format == Texture::F_rgbm) { + return GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + } else if (format == Texture::F_srgb_alpha) { + return GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC; + } else if (format == Texture::F_srgb) { + return GL_COMPRESSED_SRGB8_ETC2; + } else if (Texture::has_alpha(format)) { + return GL_COMPRESSED_RGBA8_ETC2_EAC; + } else { + return GL_COMPRESSED_RGB8_ETC2; + } + break; + + case Texture::CM_eac: + if (Texture::is_unsigned(tex->get_component_type())) { + if (tex->get_num_components() == 1) { + return GL_COMPRESSED_R11_EAC; + } else { + return GL_COMPRESSED_RG11_EAC; + } + } else { + if (tex->get_num_components() == 1) { + return GL_COMPRESSED_SIGNED_R11_EAC; + } else { + return GL_COMPRESSED_SIGNED_RG11_EAC; + } + } + break; + case Texture::CM_default: case Texture::CM_off: case Texture::CM_dxt2: @@ -8565,7 +8636,7 @@ get_external_image_format(Texture *tex) const { } GLCAT.error() << "Invalid Texture::Format value in get_external_image_format(): " - << tex->get_format() << "\n"; + << format << "\n"; return GL_RGB; } @@ -8615,10 +8686,14 @@ get_internal_image_format(Texture *tex, bool force_sized) const { break; case Texture::F_rgbm: + case Texture::F_rgba5: case Texture::F_rgb10_a2: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; } + if (get_supports_compressed_texture_format(Texture::CM_etc2) && !is_3d) { + return GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + } #ifndef OPENGLES if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; @@ -8633,6 +8708,9 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; } #endif + if (get_supports_compressed_texture_format(Texture::CM_etc2) && !is_3d) { + return GL_COMPRESSED_RGBA8_ETC2_EAC; + } #ifndef OPENGLES if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; @@ -8651,6 +8729,9 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; } #endif + if (get_supports_compressed_texture_format(Texture::CM_etc2) && !is_3d) { + return GL_COMPRESSED_RGBA8_ETC2_EAC; + } #ifndef OPENGLES if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; @@ -8661,7 +8742,6 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_rgb: case Texture::F_rgb5: - case Texture::F_rgba5: case Texture::F_rgb8: case Texture::F_rgb12: case Texture::F_rgb332: @@ -8670,7 +8750,14 @@ get_internal_image_format(Texture *tex, bool force_sized) const { if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } -#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_etc2) && !is_3d) { + return GL_COMPRESSED_RGB8_ETC2; + } +#ifdef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_etc1) && !is_3d) { + return GL_ETC1_RGB8_OES; + } +#else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGB_FXT1_3DFX; } @@ -8702,6 +8789,13 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return GL_COMPRESSED_RED_RGTC1; } #endif + if (get_supports_compressed_texture_format(Texture::CM_eac) && !is_3d) { + if (Texture::is_unsigned(tex->get_component_type())) { + return GL_COMPRESSED_R11_EAC; + } else { + return GL_COMPRESSED_SIGNED_R11_EAC; + } + } if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } @@ -8721,6 +8815,13 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return GL_COMPRESSED_RG_RGTC2; } #endif + if (get_supports_compressed_texture_format(Texture::CM_eac) && !is_3d) { + if (Texture::is_unsigned(tex->get_component_type())) { + return GL_COMPRESSED_RG11_EAC; + } else { + return GL_COMPRESSED_SIGNED_RG11_EAC; + } + } if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } @@ -8764,12 +8865,18 @@ get_internal_image_format(Texture *tex, bool force_sized) const { if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; } + if (get_supports_compressed_texture_format(Texture::CM_etc2) && !is_3d) { + return GL_COMPRESSED_SRGB8_ETC2; + } return GL_COMPRESSED_SRGB; case Texture::F_srgb_alpha: if (get_supports_compressed_texture_format(Texture::CM_dxt5) && !is_3d) { return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; } + if (get_supports_compressed_texture_format(Texture::CM_etc2) && !is_3d) { + return GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC; + } return GL_COMPRESSED_SRGB_ALPHA; case Texture::F_sluminance: @@ -8855,9 +8962,9 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::CM_rgtc: #ifndef OPENGLES - if (tex->get_format() == Texture::F_luminance) { + if (format == Texture::F_luminance) { return GL_COMPRESSED_LUMINANCE_LATC1_EXT; - } else if (tex->get_format() == Texture::F_luminance_alpha) { + } else if (format == Texture::F_luminance_alpha) { return GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; } else if (tex->get_num_components() == 1) { return GL_COMPRESSED_RED_RGTC1; @@ -8867,6 +8974,41 @@ get_internal_image_format(Texture *tex, bool force_sized) const { #endif break; + case Texture::CM_etc1: +#ifdef OPENGLES + return GL_ETC1_RGB8_OES; +#endif + // Fall through - ETC2 is backward compatible + case Texture::CM_etc2: + if (format == Texture::F_rgbm) { + return GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2; + } else if (format == Texture::F_srgb_alpha) { + return GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC; + } else if (format == Texture::F_srgb) { + return GL_COMPRESSED_SRGB8_ETC2; + } else if (Texture::has_alpha(format)) { + return GL_COMPRESSED_RGBA8_ETC2_EAC; + } else { + return GL_COMPRESSED_RGB8_ETC2; + } + break; + + case Texture::CM_eac: + if (Texture::is_unsigned(tex->get_component_type())) { + if (tex->get_num_components() == 1) { + return GL_COMPRESSED_R11_EAC; + } else { + return GL_COMPRESSED_RG11_EAC; + } + } else { + if (tex->get_num_components() == 1) { + return GL_COMPRESSED_SIGNED_R11_EAC; + } else { + return GL_COMPRESSED_SIGNED_RG11_EAC; + } + } + break; + case Texture::CM_default: case Texture::CM_off: case Texture::CM_dxt2: @@ -9197,7 +9339,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const { default: GLCAT.error() << "Invalid image format in get_internal_image_format(): " - << (int)tex->get_format() << "\n"; + << (int)format << "\n"; return force_sized ? GL_RGB8 : GL_RGB; } } @@ -10804,8 +10946,6 @@ do_issue_tex_matrix() { */ void CLP(GraphicsStateGuardian):: do_issue_tex_gen() { - bool force_normal = false; - nassertv(_num_active_texture_stages <= _max_texture_stages); // These are passed in for the four OBJECT_PLANE or EYE_PLANE values; they @@ -10849,7 +10989,6 @@ do_issue_tex_gen() { glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); - force_normal = true; break; case TexGenAttrib::M_eye_cube_map: @@ -10872,7 +11011,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -10900,7 +11038,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -10924,7 +11061,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -10952,7 +11088,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -11668,6 +11803,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { break; case Texture::TT_2d_texture: case Texture::TT_cube_map: + case Texture::TT_1d_texture_array: _glTexStorage2D(target, num_levels, internal_format, width, height); break; case Texture::TT_3d_texture: @@ -12126,6 +12262,14 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, // fill it in with the correct clear color, which we can then // upload. ptimage = tex->make_ram_mipmap_image(n); + + } else if (image_compression != Texture::CM_off) { + // We can't upload a NULL compressed texture. + if (_supports_texture_max_level) { + // Tell the GL we have no more mipmaps for it to use. + glTexParameteri(texture_target, GL_TEXTURE_MAX_LEVEL, n - mipmap_bias); + } + break; } } image_ptr = ptimage; @@ -12504,20 +12648,26 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { GLint minfilter, magfilter; GLfloat border_color[4]; - glGetTexParameteriv(target, GL_TEXTURE_WRAP_S, &wrap_u); - glGetTexParameteriv(target, GL_TEXTURE_WRAP_T, &wrap_v); - wrap_w = GL_REPEAT; -#ifndef OPENGLES_1 - if (_supports_3d_texture) { - glGetTexParameteriv(target, GL_TEXTURE_WRAP_R, &wrap_w); - } +#ifdef OPENGLES + if (true) { +#else + if (target != GL_TEXTURE_BUFFER) { #endif - glGetTexParameteriv(target, GL_TEXTURE_MIN_FILTER, &minfilter); - glGetTexParameteriv(target, GL_TEXTURE_MAG_FILTER, &magfilter); + glGetTexParameteriv(target, GL_TEXTURE_WRAP_S, &wrap_u); + glGetTexParameteriv(target, GL_TEXTURE_WRAP_T, &wrap_v); + wrap_w = GL_REPEAT; +#ifndef OPENGLES_1 + if (_supports_3d_texture) { + glGetTexParameteriv(target, GL_TEXTURE_WRAP_R, &wrap_w); + } +#endif + glGetTexParameteriv(target, GL_TEXTURE_MIN_FILTER, &minfilter); + glGetTexParameteriv(target, GL_TEXTURE_MAG_FILTER, &magfilter); #ifndef OPENGLES - glGetTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, border_color); + glGetTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, border_color); #endif + } GLenum page_target = target; if (target == GL_TEXTURE_CUBE_MAP) { @@ -12982,14 +13132,20 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { tex->set_component_type(type); tex->set_format(format); - tex->set_wrap_u(get_panda_wrap_mode(wrap_u)); - tex->set_wrap_v(get_panda_wrap_mode(wrap_v)); - tex->set_wrap_w(get_panda_wrap_mode(wrap_w)); - tex->set_border_color(LColor(border_color[0], border_color[1], - border_color[2], border_color[3])); +#ifdef OPENGLES + if (true) { +#else + if (target != GL_TEXTURE_BUFFER) { +#endif + tex->set_wrap_u(get_panda_wrap_mode(wrap_u)); + tex->set_wrap_v(get_panda_wrap_mode(wrap_v)); + tex->set_wrap_w(get_panda_wrap_mode(wrap_w)); + tex->set_border_color(LColor(border_color[0], border_color[1], + border_color[2], border_color[3])); - tex->set_minfilter(get_panda_filter_type(minfilter)); - // tex->set_magfilter(get_panda_filter_type(magfilter)); + tex->set_minfilter(get_panda_filter_type(minfilter)); + //tex->set_magfilter(get_panda_filter_type(magfilter)); + } PTA_uchar image; size_t page_size = 0; @@ -13076,6 +13232,13 @@ extract_texture_image(PTA_uchar &image, size_t &page_size, } } +#ifndef OPENGLES + } else if (target == GL_TEXTURE_BUFFER) { + // In the case of a buffer texture, we need to get it from the buffer. + image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n)); + _glGetBufferSubData(target, 0, image.size(), image.p()); +#endif + } else if (compression == Texture::CM_off) { // An uncompressed 1-d, 2-d, or 3-d texture. image = PTA_uchar::empty_array(tex->get_expected_ram_mipmap_image_size(n)); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 3c93fcd174..8080670fc5 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -801,6 +801,7 @@ public: #ifndef OPENGLES PFNGLMAPBUFFERPROC _glMapBuffer; PFNGLUNMAPBUFFERPROC _glUnmapBuffer; + PFNGLGETBUFFERSUBDATAPROC _glGetBufferSubData; #endif #ifdef OPENGLES diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 0324fbb4a1..b02ec341df 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -901,7 +901,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) { bind._func = Shader::SMF_first; bind._part[0] = Shader::SMO_attr_material; bind._arg[0] = NULL; - bind._dep[0] = Shader::SSD_general | Shader::SSD_material; + bind._dep[0] = Shader::SSD_general | Shader::SSD_material | Shader::SSD_frame; bind._part[1] = Shader::SMO_identity; bind._arg[1] = NULL; bind._dep[1] = Shader::SSD_NONE; @@ -1296,12 +1296,15 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) { case GL_SAMPLER_2D_ARRAY_SHADOW: #ifndef OPENGLES case GL_INT_SAMPLER_1D: + case GL_INT_SAMPLER_1D_ARRAY: case GL_INT_SAMPLER_BUFFER: case GL_INT_SAMPLER_CUBE_MAP_ARRAY: case GL_UNSIGNED_INT_SAMPLER_1D: + case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: case GL_UNSIGNED_INT_SAMPLER_BUFFER: case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY: case GL_SAMPLER_1D: + case GL_SAMPLER_1D_ARRAY: case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_BUFFER: case GL_SAMPLER_CUBE_MAP_ARRAY: @@ -1597,6 +1600,12 @@ get_sampler_texture_type(int &out, GLenum param_type) { case GL_SAMPLER_1D: out = Texture::TT_1d_texture; return true; + + case GL_INT_SAMPLER_1D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: + case GL_SAMPLER_1D_ARRAY: + out = Texture::TT_1d_texture_array; + return true; #endif case GL_INT_SAMPLER_2D: @@ -2145,7 +2154,8 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { // Bind the vertex buffer to the binding index. if (ai >= _glgsg->_current_vertex_buffers.size()) { - _glgsg->_current_vertex_buffers.resize(ai + 1, 0); + GLuint zero = 0; + _glgsg->_current_vertex_buffers.resize(ai + 1, zero); } if (_glgsg->_current_vertex_buffers[ai] != gvbc->_index) { _glgsg->_glBindVertexBuffer(ai, gvbc->_index, 0, stride); @@ -2403,16 +2413,24 @@ update_shader_texture_bindings(ShaderContext *prev) { Texture *tex; const ShaderInput *sinp = _glgsg->_target_shader->get_shader_input(input._name); - if (sinp->get_value_type() == ShaderInput::M_texture_image) { + switch (sinp->get_value_type()) { + case ShaderInput::M_texture_image: param = (const ParamTextureImage *)sinp->get_param(); tex = param->get_texture(); + break; - } else if (sinp->get_value_type() == ShaderInput::M_texture) { + case ShaderInput::M_texture: // People find it convenient to be able to pass a texture without // further ado. tex = sinp->get_texture(); + break; - } else { + case ShaderInput::M_invalid: + GLCAT.error() + << "Missing texture image binding input " << *input._name << "\n"; + continue; + + default: GLCAT.error() << "Mismatching type for parameter " << *input._name << ", expected texture image binding\n"; continue; @@ -2428,8 +2446,8 @@ update_shader_texture_bindings(ShaderContext *prev) { if (gtc != (TextureContext*)NULL) { input._gtc = gtc; - gl_tex = gtc->_index; _glgsg->update_texture(gtc, true); + gl_tex = gtc->_index; if (gtc->needs_barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT)) { barriers |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; diff --git a/panda/src/glstuff/panda_glext.h b/panda/src/glstuff/panda_glext.h index 61b983ed7a..3be88b13c5 100644 --- a/panda/src/glstuff/panda_glext.h +++ b/panda/src/glstuff/panda_glext.h @@ -4493,8 +4493,6 @@ GLAPI void APIENTRY glVertexBlendARB (GLint count); #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object 1 -typedef ptrdiff_t GLsizeiptrARB; -typedef ptrdiff_t GLintptrARB; #define GL_BUFFER_SIZE_ARB 0x8764 #define GL_BUFFER_USAGE_ARB 0x8765 #define GL_ARRAY_BUFFER_ARB 0x8892 @@ -4530,9 +4528,9 @@ typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); -typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); -typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); typedef void *(APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); @@ -4542,9 +4540,9 @@ GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer); GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers); GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers); GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer); -GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); -GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); -GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptr offset, GLsizeiptr size, void *data); GLAPI void *APIENTRY glMapBufferARB (GLenum target, GLenum access); GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target); GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); @@ -10881,7 +10879,7 @@ GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint #define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B #define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); -typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptr offset); typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params); @@ -10894,7 +10892,7 @@ typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_ typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot); -GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptr offset); GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot); GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params); diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 2a8a44e819..7dd43c8675 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -174,7 +174,6 @@ open_window() { << "No X visual: cannot open window.\n"; return false; } - Visual *visual = _visual_info->visual; if (glxgsg->_fbconfig != None) { setup_colormap(glxgsg->_fbconfig); diff --git a/panda/src/gobj/geom.I b/panda/src/gobj/geom.I index 05ddfd85ff..33132b3be5 100644 --- a/panda/src/gobj/geom.I +++ b/panda/src/gobj/geom.I @@ -44,21 +44,6 @@ get_geom_rendering() const { return cdata->_geom_rendering; } -/** - * Returns the minimum (i.e. most dynamic) usage_hint among all of the - * individual GeomPrimitives that have been added to the geom. - */ -INLINE Geom::UsageHint Geom:: -get_usage_hint() const { - CDLockedReader cdata(_cycler); - if (!cdata->_got_usage_hint) { - CDWriter cdataw(((Geom *)this)->_cycler, cdata, false); - ((Geom *)this)->reset_usage_hint(cdataw); - return cdataw->_usage_hint; - } - return cdata->_usage_hint; -} - /** * Returns a const pointer to the GeomVertexData, for application code to * directly examine (but not modify) the geom's underlying data. @@ -114,7 +99,6 @@ modify_primitive(int i) { Thread *current_thread = Thread::get_current_thread(); CDWriter cdata(_cycler, true, current_thread); nassertr(i >= 0 && i < (int)cdata->_primitives.size(), NULL); - cdata->_got_usage_hint = false; cdata->_modified = Geom::get_next_modified(); clear_cache_stage(current_thread); return cdata->_primitives[i].get_write_pointer(); @@ -505,8 +489,6 @@ CData() : _primitive_type(PT_none), _shade_model(SM_uniform), _geom_rendering(0), - _usage_hint(UH_unspecified), - _got_usage_hint(false), _nested_vertices(0), _internal_bounds_stale(true), _bounds_type(BoundingVolume::BT_default) @@ -523,8 +505,6 @@ CData(const Geom::CData ©) : _primitive_type(copy._primitive_type), _shade_model(copy._shade_model), _geom_rendering(copy._geom_rendering), - _usage_hint(copy._usage_hint), - _got_usage_hint(copy._got_usage_hint), _modified(copy._modified), _internal_bounds(copy._internal_bounds), _nested_vertices(copy._nested_vertices), @@ -627,15 +607,6 @@ get_geom_rendering() const { return _cdata->_geom_rendering; } -/** - * - */ -INLINE GeomPipelineReader::UsageHint GeomPipelineReader:: -get_usage_hint() const { - nassertr(_cdata->_got_usage_hint, UH_static); - return _cdata->_usage_hint; -} - /** * */ diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 2b7e914d86..1d3e0a2a45 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -104,6 +104,24 @@ make_copy() const { return new Geom(*this); } +/** + * Returns the minimum (i.e. most dynamic) usage_hint among all of the + * individual GeomPrimitives that have been added to the geom. + * @deprecated This is no longer very useful. + */ +Geom::UsageHint Geom:: +get_usage_hint() const { + CDReader cdata(_cycler); + GeomEnums::UsageHint hint = UH_unspecified; + Primitives::const_iterator pi; + for (pi = cdata->_primitives.begin(); + pi != cdata->_primitives.end(); + ++pi) { + hint = min(hint, (*pi).get_read_pointer()->get_usage_hint()); + } + return hint; +} + /** * Changes the UsageHint hint for all of the primitives on this Geom to the * same value. See get_usage_hint(). @@ -115,7 +133,6 @@ void Geom:: set_usage_hint(Geom::UsageHint usage_hint) { Thread *current_thread = Thread::get_current_thread(); CDWriter cdata(_cycler, true, current_thread); - cdata->_usage_hint = usage_hint; Primitives::iterator pi; for (pi = cdata->_primitives.begin(); pi != cdata->_primitives.end(); ++pi) { @@ -304,7 +321,6 @@ set_primitive(int i, const GeomPrimitive *primitive) { } reset_geom_rendering(cdata); - cdata->_got_usage_hint = false; cdata->_modified = Geom::get_next_modified(); clear_cache_stage(current_thread); mark_internal_bounds_stale(cdata); @@ -346,7 +362,6 @@ add_primitive(const GeomPrimitive *primitive) { } reset_geom_rendering(cdata); - cdata->_got_usage_hint = false; cdata->_modified = Geom::get_next_modified(); clear_cache_stage(current_thread); mark_internal_bounds_stale(cdata); @@ -369,7 +384,6 @@ remove_primitive(int i) { cdata->_shade_model = SM_uniform; } reset_geom_rendering(cdata); - cdata->_got_usage_hint = false; cdata->_modified = Geom::get_next_modified(); clear_cache_stage(current_thread); mark_internal_bounds_stale(cdata); @@ -1154,8 +1168,6 @@ draw(GraphicsStateGuardianBase *gsg, const GeomMunger *munger, const GeomVertexData *vertex_data, bool force, Thread *current_thread) const { GeomPipelineReader geom_reader(this, current_thread); - geom_reader.check_usage_hint(); - GeomVertexDataPipelineReader data_reader(vertex_data, current_thread); data_reader.check_array_readers(); @@ -1380,22 +1392,6 @@ check_will_be_valid(const GeomVertexData *vertex_data) const { return true; } -/** - * Recomputes the minimum usage_hint. - */ -void Geom:: -reset_usage_hint(Geom::CData *cdata) { - cdata->_usage_hint = UH_unspecified; - Primitives::const_iterator pi; - for (pi = cdata->_primitives.begin(); - pi != cdata->_primitives.end(); - ++pi) { - cdata->_usage_hint = min(cdata->_usage_hint, - (*pi).get_read_pointer()->get_usage_hint()); - } - cdata->_got_usage_hint = true; -} - /** * Rederives the _geom_rendering member. */ @@ -1670,7 +1666,6 @@ fillin(DatagramIterator &scan, BamReader *manager) { // instead, we rederive it in finalize(). scan.get_uint16(); - _got_usage_hint = false; _modified = Geom::get_next_modified(); _bounds_type = BoundingVolume::BT_default; @@ -1679,39 +1674,6 @@ fillin(DatagramIterator &scan, BamReader *manager) { } } -/** - * Ensures that the Geom's usage_hint cache has been computed. - */ -void GeomPipelineReader:: -check_usage_hint() const { - if (!_cdata->_got_usage_hint) { - // We'll need to get a fresh pointer, since another thread might already - // have modified the pointer on the object since we queried it. - { -#ifdef DO_PIPELINING - unref_delete((CycleData *)_cdata); -#endif - Geom::CDWriter fresh_cdata(((Geom *)_object)->_cycler, - false, _current_thread); - ((GeomPipelineReader *)this)->_cdata = fresh_cdata; -#ifdef DO_PIPELINING - _cdata->ref(); -#endif - if (!fresh_cdata->_got_usage_hint) { - // The cache is still stale. We have to do the work of freshening it. - ((Geom *)_object)->reset_usage_hint(fresh_cdata); - nassertv(fresh_cdata->_got_usage_hint); - } - - // When fresh_cdata goes out of scope, its write lock is released, and - // _cdata reverts to our usual convention of an unlocked copy of the - // data. - } - } - - nassertv(_cdata->_got_usage_hint); -} - /** * */ diff --git a/panda/src/gobj/geom.h b/panda/src/gobj/geom.h index 6a12e8ee98..cd02493d79 100644 --- a/panda/src/gobj/geom.h +++ b/panda/src/gobj/geom.h @@ -75,9 +75,9 @@ PUBLISHED: MAKE_PROPERTY(shade_model, get_shade_model); MAKE_PROPERTY(geom_rendering, get_geom_rendering); - INLINE UsageHint get_usage_hint() const; + UsageHint get_usage_hint() const; void set_usage_hint(UsageHint usage_hint); - MAKE_PROPERTY(usage_hint, get_usage_hint, set_usage_hint); + //MAKE_PROPERTY(usage_hint, get_usage_hint, set_usage_hint); INLINE CPT(GeomVertexData) get_vertex_data(Thread *current_thread = Thread::get_current_thread()) const; PT(GeomVertexData) modify_vertex_data(); @@ -194,7 +194,6 @@ private: void clear_prepared(PreparedGraphicsObjects *prepared_objects); bool check_will_be_valid(const GeomVertexData *vertex_data) const; - void reset_usage_hint(CData *cdata); void reset_geom_rendering(CData *cdata); void combine_primitives(GeomPrimitive *a_prim, const GeomPrimitive *b_prim, @@ -318,8 +317,6 @@ private: PrimitiveType _primitive_type; ShadeModel _shade_model; int _geom_rendering; - UsageHint _usage_hint; - bool _got_usage_hint; UpdateSeq _modified; CPT(BoundingVolume) _internal_bounds; @@ -416,12 +413,9 @@ public: INLINE const Geom *get_object() const; INLINE Thread *get_current_thread() const; - void check_usage_hint() const; - INLINE PrimitiveType get_primitive_type() const; INLINE ShadeModel get_shade_model() const; INLINE int get_geom_rendering() const; - INLINE UsageHint get_usage_hint() const; INLINE CPT(GeomVertexData) get_vertex_data() const; INLINE int get_num_primitives() const; INLINE CPT(GeomPrimitive) get_primitive(int i) const; diff --git a/panda/src/gobj/geomEnums.h b/panda/src/gobj/geomEnums.h index 42af6bb0f1..7d55a797a1 100644 --- a/panda/src/gobj/geomEnums.h +++ b/panda/src/gobj/geomEnums.h @@ -128,6 +128,10 @@ PUBLISHED: // The union of the above shade model types. GR_shade_model_bits = 0x06000, + + // If a particular non-fill polygon mode is used. + GR_render_mode_wireframe= 0x40000, + GR_render_mode_point = 0x80000, }; // The shade model specifies whether the per-vertex colors and normals diff --git a/panda/src/gobj/geomVertexArrayData.h b/panda/src/gobj/geomVertexArrayData.h index 8058409cea..e52876d376 100644 --- a/panda/src/gobj/geomVertexArrayData.h +++ b/panda/src/gobj/geomVertexArrayData.h @@ -113,7 +113,7 @@ PUBLISHED: static void lru_epoch(); INLINE static VertexDataBook &get_book(); -#if PY_VERSION_HEX >= 0x02060000 +#ifdef HAVE_PYTHON EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags)); EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const); EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const); diff --git a/panda/src/gobj/geomVertexArrayData_ext.cxx b/panda/src/gobj/geomVertexArrayData_ext.cxx index 1ddf599dfd..72b206c469 100644 --- a/panda/src/gobj/geomVertexArrayData_ext.cxx +++ b/panda/src/gobj/geomVertexArrayData_ext.cxx @@ -22,14 +22,13 @@ struct InternalBufferData { string _format; }; -#if PY_VERSION_HEX >= 0x02060000 /** * This is used to implement the buffer protocol, in order to allow efficient * access to the array data through a Python multiview object. */ int Extension:: __getbuffer__(PyObject *self, Py_buffer *view, int flags) { - +#if PY_VERSION_HEX >= 0x02060000 PT(GeomVertexArrayDataHandle) handle = _this->modify_handle(); CPT(GeomVertexArrayFormat) format = handle->get_array_format(); @@ -79,6 +78,9 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) { view->suboffsets = NULL; return 0; +#else + return -1; +#endif } /** @@ -86,7 +88,7 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) { */ int Extension:: __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { - +#if PY_VERSION_HEX >= 0x02060000 if ((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) { PyErr_SetString(PyExc_BufferError, "Object is not writable."); @@ -142,6 +144,9 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { view->suboffsets = NULL; return 0; +#else + return -1; +#endif } /** @@ -149,8 +154,8 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { */ void Extension:: __releasebuffer__(PyObject *self, Py_buffer *view) const { +#if PY_VERSION_HEX >= 0x02060000 // Note: PyBuffer_Release automatically decrements view->obj. - InternalBufferData *data; data = (InternalBufferData *) view->internal; if (data == NULL) { @@ -158,10 +163,9 @@ __releasebuffer__(PyObject *self, Py_buffer *view) const { } delete data; view->internal = NULL; +#endif } -#endif // PY_VERSION_HEX >= 0x02060000 - /** * Copies all data from the given buffer object. The array is rescaled as * necessary. diff --git a/panda/src/gobj/geomVertexArrayData_ext.h b/panda/src/gobj/geomVertexArrayData_ext.h index d892ef5a2d..51649d5976 100644 --- a/panda/src/gobj/geomVertexArrayData_ext.h +++ b/panda/src/gobj/geomVertexArrayData_ext.h @@ -29,11 +29,9 @@ template<> class Extension : public ExtensionBase { public: -#if PY_VERSION_HEX >= 0x02060000 int __getbuffer__(PyObject *self, Py_buffer *view, int flags); int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const; void __releasebuffer__(PyObject *self, Py_buffer *view) const; -#endif }; /** diff --git a/panda/src/gobj/p3gobj_ext_composite.cxx b/panda/src/gobj/p3gobj_ext_composite.cxx index 33584e701b..5d71156d01 100644 --- a/panda/src/gobj/p3gobj_ext_composite.cxx +++ b/panda/src/gobj/p3gobj_ext_composite.cxx @@ -1,3 +1,4 @@ #include "internalName_ext.cxx" #include "geomVertexArrayData_ext.cxx" +#include "texture_ext.cxx" #include "textureCollection_ext.cxx" diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index d668af1882..e067c18582 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -376,7 +376,7 @@ cp_dependency(ShaderMatInput inp) { return SSD_NONE; } if (inp == SMO_attr_material || inp == SMO_attr_material2) { - dep |= SSD_material; + dep |= SSD_material | SSD_frame; } if (inp == SMO_attr_color) { dep |= SSD_color; @@ -1765,6 +1765,69 @@ cg_compile_shader(const ShaderCaps &caps, CGcontext context) { return false; } + // This is present to work around a bug in the Cg compiler for Direct3D 9. + // It generates "texld_sat" instructions that the result in an + // D3DXERR_INVALIDDATA error when trying to load the shader, since the _sat + // modifier may not be used on tex* instructions. + if (_cg_fprofile == CG_PROFILE_PS_2_0 || + _cg_fprofile == CG_PROFILE_PS_2_X || + _cg_fprofile == CG_PROFILE_PS_3_0) { + vector_string lines; + tokenize(cgGetProgramString(_cg_fprogram, CG_COMPILED_PROGRAM), lines, "\n"); + + ostringstream out; + int num_modified = 0; + + for (size_t i = 0; i < lines.size(); ++i) { + const string &line = lines[i]; + + size_t space = line.find(' '); + if (space == string::npos) { + out << line << '\n'; + continue; + } + + string instr = line.substr(0, space); + + // Look for a texld instruction with _sat modifier. + if (instr.compare(0, 5, "texld") == 0 && + instr.compare(instr.size() - 4, 4, "_sat") == 0) { + // Which destination register are we operating on? + string reg = line.substr(space + 1, line.find(',', space) - space - 1); + + // Move the saturation operation to a separate instruction. + instr.resize(instr.size() - 4); + out << instr << ' ' << line.substr(space + 1) << '\n'; + out << "mov_sat " << reg << ", " << reg << '\n'; + ++num_modified; + } else { + out << line << '\n'; + } + } + + if (num_modified > 0) { + string result = out.str(); + CGprogram new_program; + new_program = cgCreateProgram(context, CG_OBJECT, result.c_str(), + (CGprofile)_cg_fprofile, "fshader", + (const char**)NULL); + if (new_program) { + cgDestroyProgram(_cg_fprogram); + _cg_fprogram = new_program; + + if (shader_cat.is_debug()) { + shader_cat.debug() + << "Replaced " << num_modified << " invalid texld_sat instruction" + << ((num_modified == 1) ? "" : "s") << " in compiled shader\n"; + } + } else { + shader_cat.warning() + << "Failed to load shader with fixed texld_sat instructions: " + << cgGetErrorString(cgGetError()) << "\n"; + } + } + } + // DEBUG: output the generated program if (shader_cat.is_debug()) { const char *vertex_program; @@ -1881,59 +1944,95 @@ cg_analyze_shader(const ShaderCaps &caps) { // Assign sequence numbers to all parameters. GLCgShaderContext relies on // the fact that the varyings start at seqno 0. int seqno = 0; - for (int i=0; i<(int)_var_spec.size(); i++) { + for (size_t i = 0; i < _var_spec.size(); ++i) { _var_spec[i]._id._seqno = seqno++; } - for (int i=0; i<(int)_mat_spec.size(); i++) { + for (size_t i = 0; i < _mat_spec.size(); ++i) { _mat_spec[i]._id._seqno = seqno++; } - for (int i=0; i<(int)_tex_spec.size(); i++) { + for (size_t i = 0; i < _tex_spec.size(); ++i) { _tex_spec[i]._id._seqno = seqno++; } - for (int i=0; i<(int)_ptr_spec.size(); i++) { + for (size_t i = 0; i < _ptr_spec.size(); ++i) { _ptr_spec[i]._id._seqno = seqno++; _ptr_spec[i]._info._id = _ptr_spec[i]._id; } -/* - * The following code is present to work around a bug in the Cg compiler. It - * does not generate correct code for shadow map lookups when using arbfp1. - * This is a particularly onerous limitation, given that arbfp1 is the only Cg - * target that works on radeons. I suspect this is an intentional omission on - * nvidia's part. The following code fetches the output listing, detects the - * error, repairs the code, and resumbits the repaired code to Cg. if - * ((_cg_fprofile == CG_PROFILE_ARBFP1) && (gsghint->_supports_shadow_filter)) - * { bool shadowunit[32]; bool anyshadow = false; memset(shadowunit, 0, - * sizeof(shadowunit)); vector_string lines; - * tokenize(cgGetProgramString(_cg_program[SHADER_type_frag], - * CG_COMPILED_PROGRAM), lines, "\n"); figure out which texture units contain - * shadow maps. for (int lineno=0; lineno<(int)lines.size(); lineno++) { if - * (lines[lineno].compare(0,21,"#var sampler2DSHADOW ")) { continue; } - * vector_string fields; tokenize(lines[lineno], fields, ":"); if - * (fields.size()!=5) { continue; } vector_string words; - * tokenize(trim(fields[2]), words, " "); if (words.size()!=2) { continue; } - * int unit = atoi(words[1].c_str()); if ((unit < 0)||(unit >= 32)) { - * continue; } anyshadow = true; shadowunit[unit] = true; } modify all TEX - * statements that use the relevant texture units. if (anyshadow) { for (int - * lineno=0; lineno<(int)lines.size(); lineno++) { if - * (lines[lineno].compare(0,4,"TEX ")) { continue; } vector_string fields; - * tokenize(lines[lineno], fields, ","); if - * ((fields.size()!=4)||(trim(fields[3]) != "2D;")) { continue; } - * vector_string texunitf; tokenize(trim(fields[2]), texunitf, "[]"); if - * ((texunitf.size()!=3)||(texunitf[0] != "texture")||(texunitf[2]!="")) { - * continue; } int unit = atoi(texunitf[1].c_str()); if ((unit < 0) || (unit - * >= 32) || (shadowunit[unit]==false)) { continue; } lines[lineno] = - * fields[0]+","+fields[1]+","+fields[2]+", SHADOW2D;"; } string result = - * "!!ARBfp1.0\nOPTION ARB_fragment_program_shadow;\n"; for (int lineno=1; - * lineno<(int)lines.size(); lineno++) { result += (lines[lineno] + "\n"); } - * _cg_program[2] = _cg_program[SHADER_type_frag]; - * _cg_program[SHADER_type_frag] = cgCreateProgram(_cg_context, CG_OBJECT, - * result.c_str(), _cg_profile[SHADER_type_frag], "fshader", (const - * char**)NULL); cg_report_errors(s->get_name(), _cg_context); if - * (_cg_program[SHADER_type_frag]==0) { release_resources(); return false; } } - * } - */ + /* + // The following code is present to work around a bug in the Cg compiler. + // It does not generate correct code for shadow map lookups when using arbfp1. + // This is a particularly onerous limitation, given that arbfp1 is the only + // Cg target that works on radeons. I suspect this is an intentional + // omission on nvidia's part. The following code fetches the output listing, + // detects the error, repairs the code, and resumbits the repaired code to Cg. + if ((_cg_fprofile == CG_PROFILE_ARBFP1) && (gsghint->_supports_shadow_filter)) { + bool shadowunit[32]; + bool anyshadow = false; + memset(shadowunit, 0, sizeof(shadowunit)); + vector_string lines; + tokenize(cgGetProgramString(_cg_program[SHADER_type_frag], + CG_COMPILED_PROGRAM), lines, "\n"); + // figure out which texture units contain shadow maps. + for (int lineno=0; lineno<(int)lines.size(); lineno++) { + if (lines[lineno].compare(0,21,"#var sampler2DSHADOW ")) { + continue; + } + vector_string fields; + tokenize(lines[lineno], fields, ":"); + if (fields.size()!=5) { + continue; + } + vector_string words; + tokenize(trim(fields[2]), words, " "); + if (words.size()!=2) { + continue; + } + int unit = atoi(words[1].c_str()); + if ((unit < 0)||(unit >= 32)) { + continue; + } + anyshadow = true; + shadowunit[unit] = true; + } + // modify all TEX statements that use the relevant texture units. + if (anyshadow) { + for (int lineno=0; lineno<(int)lines.size(); lineno++) { + if (lines[lineno].compare(0,4,"TEX ")) { + continue; + } + vector_string fields; + tokenize(lines[lineno], fields, ","); + if ((fields.size()!=4)||(trim(fields[3]) != "2D;")) { + continue; + } + vector_string texunitf; + tokenize(trim(fields[2]), texunitf, "[]"); + if ((texunitf.size()!=3)||(texunitf[0] != "texture")||(texunitf[2]!="")) { + continue; + } + int unit = atoi(texunitf[1].c_str()); + if ((unit < 0) || (unit >= 32) || (shadowunit[unit]==false)) { + continue; + } + lines[lineno] = fields[0]+","+fields[1]+","+fields[2]+", SHADOW2D;"; + } + string result = "!!ARBfp1.0\nOPTION ARB_fragment_program_shadow;\n"; + for (int lineno=1; lineno<(int)lines.size(); lineno++) { + result += (lines[lineno] + "\n"); + } + _cg_program[2] = _cg_program[SHADER_type_frag]; + _cg_program[SHADER_type_frag] = + cgCreateProgram(_cg_context, CG_OBJECT, result.c_str(), + _cg_profile[SHADER_type_frag], "fshader", (const char**)NULL); + cg_report_errors(s->get_name(), _cg_context); + if (_cg_program[SHADER_type_frag]==0) { + release_resources(); + return false; + } + } + } + */ cg_release_resources(); return true; @@ -2286,7 +2385,7 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { /** * Loads a given GLSL file line by line, and processes any #pragma include and - * once statements. + * once statements, as well as removes any comments. * * The set keeps track of which files we have already included, for checking * recursive includes. @@ -2299,7 +2398,8 @@ r_preprocess_source(ostream &out, const Filename &fn, if (depth > glsl_include_recursion_limit) { shader_cat.error() - << "#pragma include nested too deeply\n"; + << "GLSL includes nested too deeply, raise glsl-include-recursion-limit" + " if necessary\n"; return false; } @@ -2360,56 +2460,226 @@ r_preprocess_source(ostream &out, const Filename &fn, // Iterate over the lines for things we may need to preprocess. string line; + int ext_google_include = 0; // 1 = warn, 2 = enable + int ext_google_line = 0; bool had_include = false; int lineno = 0; while (getline(*source, line)) { ++lineno; - // Check if this line contains a #pragma. - char pragma[64]; - if (line.size() < 8 || - sscanf(line.c_str(), " # pragma %63s", pragma) != 1) { - // Just pass the line through unmodified. - out << line << "\n"; - - // One exception: check for an #endif after an include. We have to - // restore the line number in case the include happened under an #if - // block. - int nread = 0; - if (had_include && sscanf(line.c_str(), " # endif %n", &nread) == 0 && nread >= 6) { - out << "#line " << (lineno + 1) << " " << fileno << "\n"; - } + if (line.empty()) { + out.put('\n'); continue; } - int nread = 0; - if (strcmp(pragma, "include") == 0) { - // Allow both double quotes and angle brackets. - Filename incfn, source_dir; - { - char incfile[2048]; - if (sscanf(line.c_str(), " # pragma%*[ \t]include \"%2047[^\"]\" %n", incfile, &nread) == 1 - && nread == line.size()) { - // A regular include, with double quotes. Probably a local file. - source_dir = full_fn.get_dirname(); - incfn = incfile; + // If the line ends with a backslash, concatenate the following line. + // Preprocessor definitions may be broken up into multiple lines. + while (line[line.size() - 1] == '\\') { + line.resize(line.size() - 1); + string line2; - } else if (sscanf(line.c_str(), " # pragma%*[ \t]include <%2047[^\"]> %n", incfile, &nread) == 1 - && nread == line.size()) { - // Angled includes are also OK, but we don't search in the directory - // of the source file. - incfn = incfile; + if (getline(*source, line2)) { + line += line2; + out.put('\n'); + ++lineno; + } else { + break; + } + } + // Look for comments to strip. This is necessary because comments may + // appear in the middle of or around a preprocessor definition. + size_t line_comment = line.find("//"); + size_t block_comment = line.find("/*"); + if (line_comment < block_comment) { + // A line comment - strip off the rest of the line. + line.resize(line_comment); + + } else if (block_comment < line_comment) { + // A block comment. Search for closing block. + string line2 = line.substr(block_comment + 2); + + // According to the GLSL specification, a block comment is replaced with + // a single whitespace character. + line.resize(block_comment); + line += ' '; + + size_t block_end = line2.find("*/"); + while (block_end == string::npos) { + // Didn't find it - look in the next line. + if (getline(*source, line2)) { + out.put('\n'); + ++lineno; + block_end = line2.find("*/"); } else { - // Couldn't parse it. shader_cat.error() - << "Malformed #pragma include at line " << lineno - << " of file " << fn << ":\n " << line << "\n"; + << "Expected */ before end of file " << fn << "\n"; return false; } } + line += line2.substr(block_end + 2); + } + + // Check if this line contains a #directive. + char directive[64]; + if (line.size() < 8 || sscanf(line.c_str(), " # %63s", directive) != 1) { + // Nope. Just pass the line through unmodified. + out << line << "\n"; + continue; + } + + char pragma[64]; + int nread = 0; + // What kind of directive is it? + if (strcmp(directive, "pragma") == 0 && + sscanf(line.c_str(), " # pragma %63s", pragma) == 1) { + if (strcmp(pragma, "include") == 0) { + // Allow both double quotes and angle brackets. + Filename incfn, source_dir; + { + char incfile[2048]; + if (sscanf(line.c_str(), " # pragma%*[ \t]include \"%2047[^\"]\" %n", incfile, &nread) == 1 + && nread == line.size()) { + // A regular include, with double quotes. Probably a local file. + source_dir = full_fn.get_dirname(); + incfn = incfile; + + } else if (sscanf(line.c_str(), " # pragma%*[ \t]include <%2047[^\"]> %n", incfile, &nread) == 1 + && nread == line.size()) { + // Angled includes are also OK, but we don't search in the directory + // of the source file. + incfn = incfile; + + } else { + // Couldn't parse it. + shader_cat.error() + << "Malformed #pragma include at line " << lineno + << " of file " << fn << ":\n " << line << "\n"; + return false; + } + } + + // OK, great. Process the include. + if (!r_preprocess_source(out, incfn, source_dir, once_files, record, depth + 1)) { + // An error occurred. Pass on the failure. + shader_cat.error(false) << "included at line " + << lineno << " of file " << fn << ":\n " << line << "\n"; + return false; + } + + // Restore the line counter. + out << "#line " << (lineno + 1) << " " << fileno << " // " << fn << "\n"; + had_include = true; + + } else if (strcmp(pragma, "once") == 0) { + // Do a stricter syntax check, just to be extra safe. + if (sscanf(line.c_str(), " # pragma%*[ \t]once %n", &nread) != 0 || + nread != line.size()) { + shader_cat.error() + << "Malformed #pragma once at line " << lineno + << " of file " << fn << ":\n " << line << "\n"; + return false; + } + + once_files.insert(full_fn); + + } else { + // Forward it, the driver will ignore it if it doesn't know it. + out << line << "\n"; + } + + } else if (strcmp(directive, "endif") == 0) { + // Check for an #endif after an include. We have to restore the line + // number in case the include happened under an #if block. + out << line << "\n"; + int nread = 0; + if (had_include) { + out << "#line " << (lineno + 1) << " " << fileno << "\n"; + } + + } else if (strcmp(directive, "extension") == 0) { + // Check for special preprocessing extensions. + char extension[256]; + char behavior[9]; + if (sscanf(line.c_str(), " # extension%*[ \t]%255s%*[ \t]:%*[ \t]%8s", extension, behavior) == 2) { + // Parse the behavior string. + int mode; + if (strcmp(behavior, "require") == 0 || strcmp(behavior, "enable") == 0) { + mode = 2; + } else if (strcmp(behavior, "warn") == 0) { + mode = 1; + } else if (strcmp(behavior, "disable") == 0) { + mode = 0; + } else { + shader_cat.error() + << "Extension directive specifies invalid behavior at line " + << lineno << " of file " << fn << ":\n " << line << "\n"; + return false; + } + + if (strcmp(extension, "all") == 0) { + if (mode == 2) { + shader_cat.error() + << "Extension directive for 'all' may only specify 'warn' or " + "'disable' at line " << lineno << " of file " << fn + << ":\n " << line << "\n"; + return false; + } + ext_google_include = mode; + ext_google_line = mode; + out << line << "\n"; + + } else if (strcmp(extension, "GL_GOOGLE_include_directive") == 0) { + // Enable the Google extension support for #include statements. + // This also implicitly enables GL_GOOGLE_cpp_style_line_directive. + // This matches the behavior of Khronos' glslang reference compiler. + ext_google_include = mode; + ext_google_line = mode; + + } else if (strcmp(extension, "GL_GOOGLE_cpp_style_line_directive") == 0) { + // Enables strings in #line statements. + ext_google_line = mode; + + } else { + // It's an extension the driver should worry about. + out << line << "\n"; + } + } else { + shader_cat.error() + << "Failed to parse extension directive at line " + << lineno << " of file " << fn << ":\n " << line << "\n"; + return false; + } + } else if (ext_google_include > 0 && strcmp(directive, "include") == 0) { + // Warn about extension use if requested. + if (ext_google_include == 1) { + shader_cat.warning() + << "Extension GL_GOOGLE_include_directive is being used at line " + << lineno << " of file " << fn +#ifndef NDEBUG + << ":\n " << line +#endif + << "\n"; + } + + // This syntax allows only double quotes, not angle brackets. + Filename incfn; + { + char incfile[2048]; + if (sscanf(line.c_str(), " # include%*[ \t]\"%2047[^\"]\" %n", incfile, &nread) != 1 + || nread != line.size()) { + // Couldn't parse it. + shader_cat.error() + << "Malformed #include at line " << lineno + << " of file " << fn << ":\n " << line << "\n"; + return false; + } + incfn = incfile; + } + // OK, great. Process the include. + Filename source_dir = full_fn.get_dirname(); if (!r_preprocess_source(out, incfn, source_dir, once_files, record, depth + 1)) { // An error occurred. Pass on the failure. shader_cat.error(false) << "included at line " @@ -2421,28 +2691,36 @@ r_preprocess_source(ostream &out, const Filename &fn, out << "#line " << (lineno + 1) << " " << fileno << " // " << fn << "\n"; had_include = true; - } else if (strcmp(pragma, "once") == 0) { - // Do a stricter syntax check, just to be extra safe. - if (sscanf(line.c_str(), " # pragma%*[ \t]once %n", &nread) != 0 || - nread != line.size()) { - shader_cat.error() - << "Malformed #pragma once at line " << lineno - << " of file " << fn << ":\n " << line << "\n"; - return false; + } else if (ext_google_line > 0 && strcmp(directive, "line") == 0) { + // It's a #line directive. See if it uses a string instead of number. + char filestr[2048]; + if (sscanf(line.c_str(), " # line%*[ \t]%d%*[ \t]\"%2047[^\"]\" %n", &lineno, filestr, &nread) == 2 + && nread == line.size()) { + // Warn about extension use if requested. + if (ext_google_line == 1) { + shader_cat.warning() + << "Extension GL_GOOGLE_cpp_style_line_directive is being used at line " + << lineno << " of file " << fn +#ifndef NDEBUG + << ":\n " << line +#endif + << "\n"; + } + + // Replace the string line number with an integer. This is something + // we can substitute later when parsing the GLSL log from the driver. + fileno = 2048 + _included_files.size(); + _included_files.push_back(Filename(filestr)); + + out << "#line " << lineno << " " << fileno << " // " << filestr << "\n"; + + } else { + // We couldn't parse the #line directive. Pass it through unmodified. + out << line << "\n"; } - - once_files.insert(full_fn); - - } else if (strcmp(pragma, "optionNV") == 0) { - // This is processed by NVIDIA drivers. Don't touch it. - out << line << "\n"; - } else { - // Forward it, the driver will ignore it if it doesn't know it. + // Different directive (eg. #version). Leave it untouched. out << line << "\n"; - shader_cat.warning() - << "Ignoring unknown pragma directive \"" << pragma << "\" at line " - << lineno << " of file " << fn << ":\n " << line << "\n"; } } diff --git a/panda/src/gobj/texture.I b/panda/src/gobj/texture.I index b608a39c00..47ce9e233f 100644 --- a/panda/src/gobj/texture.I +++ b/panda/src/gobj/texture.I @@ -2318,8 +2318,8 @@ get_unsigned_short(const unsigned char *&p) { } /** - * Returns true if the indicated filename ends in .txo or .txo.pz, false - * otherwise. + * Returns true if the indicated filename ends in .txo or .txo.pz or .txo.gz, + * false otherwise. */ INLINE bool Texture:: is_txo_filename(const Filename &fullpath) { @@ -2333,8 +2333,8 @@ is_txo_filename(const Filename &fullpath) { } /** - * Returns true if the indicated filename ends in .dds or .dds.pz, false - * otherwise. + * Returns true if the indicated filename ends in .dds or .dds.pz or .dds.gz, + * false otherwise. */ INLINE bool Texture:: is_dds_filename(const Filename &fullpath) { @@ -2347,6 +2347,21 @@ is_dds_filename(const Filename &fullpath) { return (downcase(extension) == "dds"); } +/** + * Returns true if the indicated filename ends in .ktx or .ktx.pz or .ktx.gz, + * false otherwise. + */ +INLINE bool Texture:: +is_ktx_filename(const Filename &fullpath) { + string extension = fullpath.get_extension(); +#ifdef HAVE_ZLIB + if (extension == "pz" || extension == "gz") { + extension = Filename(fullpath.get_basename_wo_extension()).get_extension(); + } +#endif // HAVE_ZLIB + return (downcase(extension) == "ktx"); +} + /** * */ diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 8368dcf926..b5d7fc3ac5 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -132,6 +132,231 @@ struct DDSHeader { DDSCaps2 caps; }; +// Stuff to read KTX files. +enum KTXType { + KTX_BYTE = 0x1400, + KTX_UNSIGNED_BYTE = 0x1401, + KTX_SHORT = 0x1402, + KTX_UNSIGNED_SHORT = 0x1403, + KTX_INT = 0x1404, + KTX_UNSIGNED_INT = 0x1405, + KTX_FLOAT = 0x1406, + KTX_HALF_FLOAT = 0x140B, + KTX_UNSIGNED_BYTE_3_3_2 = 0x8032, + KTX_UNSIGNED_SHORT_4_4_4_4 = 0x8033, + KTX_UNSIGNED_SHORT_5_5_5_1 = 0x8034, + KTX_UNSIGNED_INT_8_8_8_8 = 0x8035, + KTX_UNSIGNED_INT_10_10_10_2 = 0x8036, + KTX_UNSIGNED_BYTE_2_3_3_REV = 0x8362, + KTX_UNSIGNED_SHORT_5_6_5 = 0x8363, + KTX_UNSIGNED_SHORT_5_6_5_REV = 0x8364, + KTX_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365, + KTX_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366, + KTX_UNSIGNED_INT_8_8_8_8_REV = 0x8367, + KTX_UNSIGNED_INT_2_10_10_10_REV = 0x8368, + KTX_UNSIGNED_INT_24_8 = 0x84FA, + KTX_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B, + KTX_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E, + KTX_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD, +}; + +enum KTXFormat { + KTX_ALPHA = 0x1906, + KTX_ALPHA12 = 0x803D, + KTX_ALPHA16 = 0x803E, + KTX_ALPHA16_SNORM = 0x9018, + KTX_ALPHA4 = 0x803B, + KTX_ALPHA8 = 0x803C, + KTX_ALPHA8_SNORM = 0x9014, + KTX_ALPHA_SNORM = 0x9010, + KTX_BGR = 0x80E0, + KTX_BGR_INTEGER = 0x8D9A, + KTX_BGRA = 0x80E1, + KTX_BGRA_INTEGER = 0x8D9B, + KTX_BLUE = 0x1905, + KTX_BLUE_INTEGER = 0x8D96, + KTX_COLOR_INDEX = 0x1900, + KTX_DEPTH24_STENCIL8 = 0x88F0, + KTX_DEPTH32F_STENCIL8 = 0x8CAD, + KTX_DEPTH_COMPONENT = 0x1902, + KTX_DEPTH_COMPONENT16 = 0x81A5, + KTX_DEPTH_COMPONENT24 = 0x81A6, + KTX_DEPTH_COMPONENT32 = 0x81A7, + KTX_DEPTH_COMPONENT32F = 0x8CAC, + KTX_DEPTH_STENCIL = 0x84F9, + KTX_GREEN = 0x1904, + KTX_GREEN_INTEGER = 0x8D95, + KTX_INTENSITY = 0x8049, + KTX_INTENSITY12 = 0x804C, + KTX_INTENSITY16 = 0x804D, + KTX_INTENSITY16_SNORM = 0x901B, + KTX_INTENSITY4 = 0x804A, + KTX_INTENSITY8 = 0x804B, + KTX_INTENSITY8_SNORM = 0x9017, + KTX_INTENSITY_SNORM = 0x9013, + KTX_LUMINANCE = 0x1909, + KTX_LUMINANCE12 = 0x8041, + KTX_LUMINANCE12_ALPHA12 = 0x8047, + KTX_LUMINANCE12_ALPHA4 = 0x8046, + KTX_LUMINANCE16 = 0x8042, + KTX_LUMINANCE16_ALPHA16 = 0x8048, + KTX_LUMINANCE16_ALPHA16_SNORM = 0x901A, + KTX_LUMINANCE16_SNORM = 0x9019, + KTX_LUMINANCE4 = 0x803F, + KTX_LUMINANCE4_ALPHA4 = 0x8043, + KTX_LUMINANCE6_ALPHA2 = 0x8044, + KTX_LUMINANCE8 = 0x8040, + KTX_LUMINANCE8_ALPHA8 = 0x8045, + KTX_LUMINANCE8_ALPHA8_SNORM = 0x9016, + KTX_LUMINANCE8_SNORM = 0x9015, + KTX_LUMINANCE_ALPHA = 0x190A, + KTX_LUMINANCE_ALPHA_SNORM = 0x9012, + KTX_LUMINANCE_SNORM = 0x9011, + KTX_R11F_G11F_B10F = 0x8C3A, + KTX_R16 = 0x822A, + KTX_R16_SNORM = 0x8F98, + KTX_R16F = 0x822D, + KTX_R16I = 0x8233, + KTX_R16UI = 0x8234, + KTX_R32F = 0x822E, + KTX_R32I = 0x8235, + KTX_R32UI = 0x8236, + KTX_R3_G3_B2 = 0x2A10, + KTX_R8 = 0x8229, + KTX_R8_SNORM = 0x8F94, + KTX_R8I = 0x8231, + KTX_R8UI = 0x8232, + KTX_RED = 0x1903, + KTX_RED_INTEGER = 0x8D94, + KTX_RED_SNORM = 0x8F90, + KTX_RG = 0x8227, + KTX_RG16 = 0x822C, + KTX_RG16_SNORM = 0x8F99, + KTX_RG16F = 0x822F, + KTX_RG16I = 0x8239, + KTX_RG16UI = 0x823A, + KTX_RG32F = 0x8230, + KTX_RG32I = 0x823B, + KTX_RG32UI = 0x823C, + KTX_RG8 = 0x822B, + KTX_RG8_SNORM = 0x8F95, + KTX_RG8I = 0x8237, + KTX_RG8UI = 0x8238, + KTX_RG_INTEGER = 0x8228, + KTX_RG_SNORM = 0x8F91, + KTX_RGB = 0x1907, + KTX_RGB10 = 0x8052, + KTX_RGB10_A2 = 0x8059, + KTX_RGB12 = 0x8053, + KTX_RGB16 = 0x8054, + KTX_RGB16_SNORM = 0x8F9A, + KTX_RGB16F = 0x881B, + KTX_RGB16I = 0x8D89, + KTX_RGB16UI = 0x8D77, + KTX_RGB2 = 0x804E, + KTX_RGB32F = 0x8815, + KTX_RGB32I = 0x8D83, + KTX_RGB32UI = 0x8D71, + KTX_RGB4 = 0x804F, + KTX_RGB5 = 0x8050, + KTX_RGB5_A1 = 0x8057, + KTX_RGB8 = 0x8051, + KTX_RGB8_SNORM = 0x8F96, + KTX_RGB8I = 0x8D8F, + KTX_RGB8UI = 0x8D7D, + KTX_RGB9_E5 = 0x8C3D, + KTX_RGB_INTEGER = 0x8D98, + KTX_RGB_SNORM = 0x8F92, + KTX_RGBA = 0x1908, + KTX_RGBA12 = 0x805A, + KTX_RGBA16 = 0x805B, + KTX_RGBA16_SNORM = 0x8F9B, + KTX_RGBA16F = 0x881A, + KTX_RGBA16I = 0x8D88, + KTX_RGBA16UI = 0x8D76, + KTX_RGBA2 = 0x8055, + KTX_RGBA32F = 0x8814, + KTX_RGBA32I = 0x8D82, + KTX_RGBA32UI = 0x8D70, + KTX_RGBA4 = 0x8056, + KTX_RGBA8 = 0x8058, + KTX_RGBA8_SNORM = 0x8F97, + KTX_RGBA8I = 0x8D8E, + KTX_RGBA8UI = 0x8D7C, + KTX_RGBA_INTEGER = 0x8D99, + KTX_RGBA_SNORM = 0x8F93, + KTX_SLUMINANCE = 0x8C46, + KTX_SLUMINANCE8 = 0x8C47, + KTX_SLUMINANCE8_ALPHA8 = 0x8C45, + KTX_SLUMINANCE_ALPHA = 0x8C44, + KTX_SRGB = 0x8C40, + KTX_SRGB8 = 0x8C41, + KTX_SRGB8_ALPHA8 = 0x8C43, + KTX_SRGB_ALPHA = 0x8C42, + KTX_STENCIL_INDEX = 0x1901, + KTX_STENCIL_INDEX1 = 0x8D46, + KTX_STENCIL_INDEX16 = 0x8D49, + KTX_STENCIL_INDEX4 = 0x8D47, + KTX_STENCIL_INDEX8 = 0x8D48, +}; + +enum KTXCompressedFormat { + KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2 = 0x8C72, + KTX_COMPRESSED_LUMINANCE_LATC1 = 0x8C70, + KTX_COMPRESSED_R11_EAC = 0x9270, + KTX_COMPRESSED_RED = 0x8225, + KTX_COMPRESSED_RED_RGTC1 = 0x8DBB, + KTX_COMPRESSED_RG = 0x8226, + KTX_COMPRESSED_RG11_EAC = 0x9272, + KTX_COMPRESSED_RG_RGTC2 = 0x8DBD, + KTX_COMPRESSED_RGB = 0x84ED, + KTX_COMPRESSED_RGB8_ETC2 = 0x9274, + KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276, + KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E, + KTX_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F, + KTX_COMPRESSED_RGB_FXT1_3DFX = 0x86B0, + KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01, + KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00, + KTX_COMPRESSED_RGB_S3TC_DXT1 = 0x83F0, + KTX_COMPRESSED_RGBA = 0x84EE, + KTX_COMPRESSED_RGBA8_ETC2_EAC = 0x9278, + KTX_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C, + KTX_COMPRESSED_RGBA_FXT1_3DFX = 0x86B1, + KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03, + KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 0x9137, + KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02, + KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 0x9138, + KTX_COMPRESSED_RGBA_S3TC_DXT1 = 0x83F1, + KTX_COMPRESSED_RGBA_S3TC_DXT3 = 0x83F2, + KTX_COMPRESSED_RGBA_S3TC_DXT5 = 0x83F3, + KTX_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2 = 0x8C73, + KTX_COMPRESSED_SIGNED_LUMINANCE_LATC1 = 0x8C71, + KTX_COMPRESSED_SIGNED_R11_EAC = 0x9271, + KTX_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC, + KTX_COMPRESSED_SIGNED_RG11_EAC = 0x9273, + KTX_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE, + KTX_COMPRESSED_SLUMINANCE = 0x8C4A, + KTX_COMPRESSED_SLUMINANCE_ALPHA = 0x8C4B, + KTX_COMPRESSED_SRGB = 0x8C48, + KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279, + KTX_COMPRESSED_SRGB8_ETC2 = 0x9275, + KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277, + KTX_COMPRESSED_SRGB_ALPHA = 0x8C49, + KTX_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D, + KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1 = 0x8A56, + KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2 = 0x93F0, + KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1 = 0x8A57, + KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2 = 0x93F1, + KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1 = 0x8C4D, + KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3 = 0x8C4E, + KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5 = 0x8C4F, + KTX_COMPRESSED_SRGB_PVRTC_2BPPV1 = 0x8A54, + KTX_COMPRESSED_SRGB_PVRTC_4BPPV1 = 0x8A55, + KTX_COMPRESSED_SRGB_S3TC_DXT1 = 0x8C4C, + KTX_ETC1_RGB8 = 0x8D64, + KTX_ETC1_SRGB8 = 0x88EE, +}; + /** * Constructs an empty texture. The default is to set up the texture as an * empty 2-d texture; follow up with one of the variants of setup_texture() if @@ -709,6 +934,23 @@ read_dds(istream &in, const string &filename, bool header_only) { return do_read_dds(cdata, in, filename, header_only); } +/** + * Reads the texture from a KTX file object. This is a Khronos-defined file + * format; it is similar in principle to a dds object, in that it is designed + * to contain the texture image in a form as similar as possible to its + * runtime image, and it can contain mipmaps, pre-compressed textures, and so + * on. + * + * As with read_dds, the filename is just for reference. + */ +bool Texture:: +read_ktx(istream &in, const string &filename, bool header_only) { + CDWriter cdata(_cycler, true); + cdata->inc_properties_modified(); + cdata->inc_image_modified(); + return do_read_ktx(cdata, in, filename, header_only); +} + /** * Loads a texture whose filename is derived by concatenating a suffix to the * filename of this texture. May return NULL, for example, if this texture @@ -1412,6 +1654,10 @@ write(ostream &out, int indent_level) const { case TT_buffer_texture: out << "buffer, " << cdata->_x_size; break; + + case TT_1d_texture_array: + out << "1-d array, " << cdata->_x_size << " x " << cdata->_y_size; + break; } if (cdata->_num_views > 1) { @@ -1439,6 +1685,7 @@ write(ostream &out, int indent_level) const { case T_unsigned_int_24_8: case T_int: + case T_unsigned_int: out << " ints"; break; @@ -1810,6 +2057,8 @@ format_texture_type(TextureType tt) { return "cube_map_array"; case TT_buffer_texture: return "buffer_texture"; + case TT_1d_texture_array: + return "1d_texture_array"; } return "**invalid**"; } @@ -1862,6 +2111,8 @@ format_component_type(ComponentType ct) { return "short"; case T_half_float: return "half_float"; + case T_unsigned_int: + return "unsigned_int"; } return "**invalid**"; @@ -1888,6 +2139,8 @@ string_component_type(const string &str) { return T_short; } else if (cmp_nocase(str, "half_float") == 0) { return T_half_float; + } else if (cmp_nocase(str, "unsigned_int") == 0) { + return T_unsigned_int; } gobj_cat->error() @@ -1956,7 +2209,7 @@ format_format(Format format) { case F_r16: return "r16"; case F_r16i: - return "r16i"; + return "r16i"; case F_rg16: return "rg16"; case F_rgb16: @@ -2123,6 +2376,12 @@ format_compression_mode(CompressionMode cm) { return "pvr1_4bpp"; case CM_rgtc: return "rgtc"; + case CM_etc1: + return "etc1"; + case CM_etc2: + return "etc2"; + case CM_eac: + return "eac"; } return "**invalid**"; @@ -2158,6 +2417,12 @@ string_compression_mode(const string &str) { return CM_pvr1_4bpp; } else if (cmp_nocase_uh(str, "rgtc") == 0) { return CM_rgtc; + } else if (cmp_nocase_uh(str, "etc1") == 0) { + return CM_etc1; + } else if (cmp_nocase_uh(str, "etc2") == 0) { + return CM_etc2; + } else if (cmp_nocase_uh(str, "eac") == 0) { + return CM_eac; } gobj_cat->error() @@ -2272,7 +2537,8 @@ bool Texture:: is_unsigned(Texture::ComponentType ctype) { return (ctype == T_unsigned_byte || ctype == T_unsigned_short || - ctype == T_unsigned_int_24_8); + ctype == T_unsigned_int_24_8 || + ctype == T_unsigned_int); } /** @@ -2535,6 +2801,13 @@ do_read(CData *cdata, const Filename &fullpath, const Filename &alpha_fullpath, return do_read_dds_file(cdata, fullpath, header_only); } + if (is_ktx_filename(fullpath)) { + if (record != (BamCacheRecord *)NULL) { + record->add_dependent_file(fullpath); + } + return do_read_ktx_file(cdata, fullpath, header_only); + } + // If read_pages or read_mipmaps is specified, then z and n actually // indicate z_size and n_size, respectively--the numerical limits on which // to search for filenames. @@ -3374,7 +3647,7 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) unsigned int dimension = dds.get_uint32(); unsigned int misc_flag = dds.get_uint32(); unsigned int array_size = dds.get_uint32(); - unsigned int alpha_mode = dds.get_uint32(); + /*unsigned int alpha_mode = */dds.get_uint32(); switch (format) { case 2: // DXGI_FORMAT_R32G32B32A32_FLOAT @@ -3820,6 +4093,770 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) return true; } +/** + * Called internally when read() detects a KTX file. Assumes the lock is + * already held. + */ +bool Texture:: +do_read_ktx_file(CData *cdata, const Filename &fullpath, bool header_only) { + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + + Filename filename = Filename::binary_filename(fullpath); + PT(VirtualFile) file = vfs->get_file(filename); + if (file == (VirtualFile *)NULL) { + // No such file. + gobj_cat.error() + << "Could not find " << fullpath << "\n"; + return false; + } + + if (gobj_cat.is_debug()) { + gobj_cat.debug() + << "Reading KTX file " << filename << "\n"; + } + + istream *in = file->open_read_file(true); + bool success = do_read_ktx(cdata, *in, fullpath, header_only); + vfs->close_read_file(in); + + if (!has_name()) { + set_name(fullpath.get_basename_wo_extension()); + } + + cdata->_fullpath = fullpath; + cdata->_alpha_fullpath = Filename(); + cdata->_keep_ram_image = false; + + return success; +} + +/** + * + */ +bool Texture:: +do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only) { + StreamReader ktx(in); + + if (ktx.extract_bytes(12) != "\xABKTX 11\xBB\r\n\x1A\n") { + gobj_cat.error() + << filename << " is not a KTX file.\n"; + return false; + } + + // See: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/ + uint32_t gl_type, type_size, gl_format, internal_format, gl_base_format, + width, height, depth, num_array_elements, num_faces, num_mipmap_levels, + kvdata_size; + + bool big_endian; + if (ktx.get_uint32() == 0x04030201) { + big_endian = false; + gl_type = ktx.get_uint32(); + type_size = ktx.get_uint32(); + gl_format = ktx.get_uint32(); + internal_format = ktx.get_uint32(); + gl_base_format = ktx.get_uint32(); + width = ktx.get_uint32(); + height = ktx.get_uint32(); + depth = ktx.get_uint32(); + num_array_elements = ktx.get_uint32(); + num_faces = ktx.get_uint32(); + num_mipmap_levels = ktx.get_uint32(); + kvdata_size = ktx.get_uint32(); + } else { + big_endian = true; + gl_type = ktx.get_be_uint32(); + type_size = ktx.get_be_uint32(); + gl_format = ktx.get_be_uint32(); + internal_format = ktx.get_be_uint32(); + gl_base_format = ktx.get_be_uint32(); + width = ktx.get_be_uint32(); + height = ktx.get_be_uint32(); + depth = ktx.get_be_uint32(); + num_array_elements = ktx.get_be_uint32(); + num_faces = ktx.get_be_uint32(); + num_mipmap_levels = ktx.get_be_uint32(); + kvdata_size = ktx.get_be_uint32(); + } + + // Skip metadata section. + ktx.skip_bytes(kvdata_size); + + ComponentType type; + CompressionMode compression; + Format format; + bool swap_bgr = false; + + if (gl_type == 0 || gl_format == 0) { + // Compressed texture. + if (gl_type > 0 || gl_format > 0) { + gobj_cat.error() + << "Compressed textures must have both type and format set to 0.\n"; + return false; + } + type = T_unsigned_byte; + compression = CM_on; + + KTXFormat base_format; + switch ((KTXCompressedFormat)internal_format) { + case KTX_COMPRESSED_RED: + format = F_red; + base_format = KTX_RED; + break; + case KTX_COMPRESSED_RG: + format = F_rg; + base_format = KTX_RG; + break; + case KTX_COMPRESSED_RGB: + format = F_rgb; + base_format = KTX_RGB; + break; + case KTX_COMPRESSED_RGBA: + format = F_rgba; + base_format = KTX_RGBA; + break; + case KTX_COMPRESSED_SRGB: + format = F_srgb; + base_format = KTX_SRGB; + break; + case KTX_COMPRESSED_SRGB_ALPHA: + format = F_srgb_alpha; + base_format = KTX_SRGB_ALPHA; + break; + case KTX_COMPRESSED_RGB_FXT1_3DFX: + format = F_rgb; + base_format = KTX_RGB; + compression = CM_fxt1; + break; + case KTX_COMPRESSED_RGBA_FXT1_3DFX: + format = F_rgba; + base_format = KTX_RGBA; + compression = CM_fxt1; + break; + case KTX_COMPRESSED_RGB_S3TC_DXT1: + format = F_rgb; + base_format = KTX_RGB; + compression = CM_dxt1; + break; + case KTX_COMPRESSED_RGBA_S3TC_DXT1: + format = F_rgbm; + base_format = KTX_RGB; + compression = CM_dxt1; + break; + case KTX_COMPRESSED_RGBA_S3TC_DXT3: + format = F_rgba; + base_format = KTX_RGBA; + compression = CM_dxt3; + break; + case KTX_COMPRESSED_RGBA_S3TC_DXT5: + format = F_rgba; + base_format = KTX_RGBA; + compression = CM_dxt5; + break; + case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT1: + format = F_srgb_alpha; + base_format = KTX_SRGB_ALPHA; + compression = CM_dxt1; + break; + case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT3: + format = F_srgb_alpha; + base_format = KTX_SRGB_ALPHA; + compression = CM_dxt3; + break; + case KTX_COMPRESSED_SRGB_ALPHA_S3TC_DXT5: + format = F_srgb_alpha; + base_format = KTX_SRGB_ALPHA; + compression = CM_dxt5; + break; + case KTX_COMPRESSED_SRGB_S3TC_DXT1: + format = F_srgb; + base_format = KTX_SRGB; + compression = CM_dxt1; + break; + case KTX_COMPRESSED_RED_RGTC1: + case KTX_COMPRESSED_SIGNED_RED_RGTC1: + format = F_red; + base_format = KTX_RED; + compression = CM_rgtc; + break; + case KTX_COMPRESSED_RG_RGTC2: + case KTX_COMPRESSED_SIGNED_RG_RGTC2: + format = F_rg; + base_format = KTX_RG; + compression = CM_rgtc; + break; + case KTX_ETC1_RGB8: + format = F_rgb; + base_format = KTX_RGB; + compression = CM_etc1; + break; + case KTX_ETC1_SRGB8: + format = F_srgb; + base_format = KTX_SRGB; + compression = CM_etc1; + break; + case KTX_COMPRESSED_RGB8_ETC2: + format = F_rgb; + base_format = KTX_RGB; + compression = CM_etc2; + break; + case KTX_COMPRESSED_SRGB8_ETC2: + format = F_srgb; + base_format = KTX_SRGB; + compression = CM_etc2; + break; + case KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + format = F_rgbm; + base_format = KTX_RGBA; + compression = CM_etc2; + break; + case KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + format = F_rgbm; + base_format = KTX_SRGB8_ALPHA8; + compression = CM_etc2; + break; + case KTX_COMPRESSED_RGBA8_ETC2_EAC: + format = F_rgba; + base_format = KTX_RGBA; + compression = CM_etc2; + break; + case KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: + format = F_srgb_alpha; + base_format = KTX_SRGB8_ALPHA8; + compression = CM_etc2; + break; + case KTX_COMPRESSED_R11_EAC: + case KTX_COMPRESSED_SIGNED_R11_EAC: + format = F_red; + base_format = KTX_RED; + compression = CM_eac; + break; + case KTX_COMPRESSED_RG11_EAC: + case KTX_COMPRESSED_SIGNED_RG11_EAC: + format = F_rg; + base_format = KTX_RG; + compression = CM_eac; + break; + case KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1: + format = F_srgb_alpha; + base_format = KTX_SRGB_ALPHA; + compression = CM_pvr1_2bpp; + break; + case KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1: + format = F_srgb_alpha; + base_format = KTX_SRGB_ALPHA; + compression = CM_pvr1_4bpp; + break; + case KTX_COMPRESSED_RGBA_BPTC_UNORM: + case KTX_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: + case KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: + case KTX_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: + default: + gobj_cat.error() + << filename << " has unsupported compressed internal format " << internal_format << "\n"; + return false; + } + + if (base_format != gl_base_format) { + gobj_cat.error() + << filename << " has internal format that is incompatible with base " + "format (0x" << hex << gl_base_format << ", expected 0x" + << base_format << dec << ")\n"; + return false; + } + + } else { + // Uncompressed texture. + compression = CM_off; + switch ((KTXType)gl_type) { + case KTX_BYTE: + type = T_byte; + break; + case KTX_UNSIGNED_BYTE: + type = T_unsigned_byte; + break; + case KTX_SHORT: + type = T_short; + break; + case KTX_UNSIGNED_SHORT: + type = T_unsigned_short; + break; + case KTX_INT: + type = T_int; + break; + case KTX_UNSIGNED_INT: + type = T_unsigned_int; + break; + case KTX_FLOAT: + type = T_float; + break; + case KTX_HALF_FLOAT: + type = T_half_float; + break; + case KTX_UNSIGNED_INT_24_8: + type = T_unsigned_int_24_8; + break; + default: + gobj_cat.error() + << filename << " has unsupported component type " << gl_type << "\n"; + return false; + } + + if (gl_format != gl_base_format) { + gobj_cat.error() + << filename << " has mismatched formats: " << gl_format << " != " + << gl_base_format << "\n"; + } + + switch (gl_format) { + case KTX_DEPTH_COMPONENT: + switch (internal_format) { + case KTX_DEPTH_COMPONENT: + format = F_depth_component; + break; + case KTX_DEPTH_COMPONENT16: + format = F_depth_component16; + break; + case KTX_DEPTH_COMPONENT24: + format = F_depth_component24; + break; + case KTX_DEPTH_COMPONENT32: + case KTX_DEPTH_COMPONENT32F: + format = F_depth_component32; + break; + default: + format = F_depth_component; + gobj_cat.warning() + << filename << " has unsupported depth component format " << internal_format << "\n"; + } + break; + + case KTX_DEPTH_STENCIL: + format = F_depth_stencil; + if (internal_format != KTX_DEPTH_STENCIL && + internal_format != KTX_DEPTH24_STENCIL8) { + gobj_cat.warning() + << filename << " has unsupported depth stencil format " << internal_format << "\n"; + } + break; + + case KTX_RED: + switch (internal_format) { + case KTX_RED: + case KTX_RED_SNORM: + case KTX_R8: + case KTX_R8_SNORM: + format = F_red; + break; + case KTX_R16: + case KTX_R16_SNORM: + case KTX_R16F: + format = F_r16; + break; + case KTX_R32F: + format = F_r32; + break; + default: + format = F_red; + gobj_cat.warning() + << filename << " has unsupported red format " << internal_format << "\n"; + } + break; + + case KTX_RED_INTEGER: + switch (internal_format) { + case KTX_R8I: + case KTX_R8UI: + format = F_r8i; + break; + case KTX_R16I: + case KTX_R16UI: + format = F_r16i; + break; + case KTX_R32I: + case KTX_R32UI: + format = F_r32i; + break; + default: + gobj_cat.error() + << filename << " has unsupported red integer format " << internal_format << "\n"; + return false; + } + break; + + case KTX_GREEN: + format = F_green; + if (internal_format != KTX_GREEN) { + gobj_cat.warning() + << filename << " has unsupported green format " << internal_format << "\n"; + } + break; + + case KTX_BLUE: + format = F_blue; + if (internal_format != KTX_BLUE) { + gobj_cat.warning() + << filename << " has unsupported blue format " << internal_format << "\n"; + } + break; + + case KTX_RG: + switch (internal_format) { + case KTX_RG: + case KTX_RG_SNORM: + case KTX_RG8: + case KTX_RG8_SNORM: + format = F_rg; + break; + case KTX_RG16: + case KTX_RG16_SNORM: + case KTX_RG16F: + format = F_rg16; + break; + case KTX_RG32F: + format = F_rg32; + break; + default: + format = F_rg; + gobj_cat.warning() + << filename << " has unsupported RG format " << internal_format << "\n"; + } + break; + + case KTX_RG_INTEGER: + switch (internal_format) { + case KTX_RG8I: + case KTX_RG8UI: + format = F_rg8i; + break; + case KTX_RG16I: + case KTX_RG16UI: + case KTX_RG32I: + case KTX_RG32UI: + default: + gobj_cat.error() + << filename << " has unsupported RG integer format " << internal_format << "\n"; + return false; + } + break; + + case KTX_RGB: + swap_bgr = true; + case KTX_BGR: + switch (internal_format) { + case KTX_RGB: + case KTX_RGB_SNORM: + format = F_rgb; + break; + case KTX_RGB5: + format = F_rgb5; + break; + case KTX_RGB12: + format = F_rgb12; + break; + case KTX_R3_G3_B2: + format = F_rgb332; + break; + case KTX_RGB9_E5: + format = F_rgb9_e5; + break; + case KTX_R11F_G11F_B10F: + format = F_r11_g11_b10; + break; + case KTX_RGB8: + case KTX_RGB8_SNORM: + format = F_rgb8; + break; + case KTX_RGB16: + case KTX_RGB16_SNORM: + case KTX_RGB16F: + format = F_rgb16; + break; + case KTX_RGB32F: + format = F_rgb32; + break; + case KTX_SRGB: + case KTX_SRGB8: + format = F_srgb; + break; + default: + format = F_rgb; + gobj_cat.warning() + << filename << " has unsupported RGB format " << internal_format << "\n"; + } + break; + + case KTX_RGB_INTEGER: + swap_bgr = true; + case KTX_BGR_INTEGER: + switch (internal_format) { + case KTX_RGB8I: + case KTX_RGB8UI: + format = F_rgb8i; + break; + case KTX_RGB16I: + case KTX_RGB16UI: + case KTX_RGB32I: + case KTX_RGB32UI: + default: + gobj_cat.error() + << filename << " has unsupported RGB integer format " << internal_format << "\n"; + return false; + } + break; + + case KTX_RGBA: + swap_bgr = true; + case KTX_BGRA: + switch (internal_format) { + case KTX_RGBA: + case KTX_RGBA_SNORM: + format = F_rgba; + break; + case KTX_RGBA4: + format = F_rgba4; + break; + case KTX_RGB5_A1: + format = F_rgba5; + break; + case KTX_RGBA12: + format = F_rgba12; + break; + case KTX_RGB10_A2: + format = F_rgb10_a2; + break; + case KTX_RGBA8: + case KTX_RGBA8_SNORM: + format = F_rgba8; + break; + case KTX_RGBA16: + case KTX_RGBA16_SNORM: + case KTX_RGBA16F: + format = F_rgba16; + break; + case KTX_RGBA32F: + format = F_rgba32; + break; + case KTX_SRGB_ALPHA: + case KTX_SRGB8_ALPHA8: + format = F_srgb_alpha; + break; + default: + format = F_rgba; + gobj_cat.warning() + << filename << " has unsupported RGBA format " << internal_format << "\n"; + } + break; + break; + + case KTX_RGBA_INTEGER: + swap_bgr = true; + case KTX_BGRA_INTEGER: + switch (internal_format) { + case KTX_RGBA8I: + case KTX_RGBA8UI: + format = F_rgba8i; + break; + case KTX_RGBA16I: + case KTX_RGBA16UI: + case KTX_RGBA32I: + case KTX_RGBA32UI: + default: + gobj_cat.error() + << filename << " has unsupported RGBA integer format " << internal_format << "\n"; + return false; + } + break; + + case KTX_LUMINANCE: + format = F_luminance; + break; + + case KTX_LUMINANCE_ALPHA: + format = F_luminance_alpha; + break; + + case KTX_ALPHA: + format = F_alpha; + break; + + case KTX_STENCIL_INDEX: + default: + gobj_cat.error() + << filename << " has unsupported format " << gl_format << "\n"; + return false; + } + } + + TextureType texture_type; + if (depth > 0) { + texture_type = TT_3d_texture; + + } else if (num_faces > 1) { + if (num_faces != 6) { + gobj_cat.error() + << filename << " has " << num_faces << " cube map faces, expected 6\n"; + return false; + } + if (width != height) { + gobj_cat.error() + << filename << " is cube map, but does not have square dimensions\n"; + return false; + } + if (num_array_elements > 0) { + depth = num_array_elements * 6; + texture_type = TT_cube_map_array; + } else { + depth = 6; + texture_type = TT_cube_map; + } + + } else if (height > 0) { + if (num_array_elements > 0) { + depth = num_array_elements; + texture_type = TT_2d_texture_array; + } else { + depth = 1; + texture_type = TT_2d_texture; + } + + } else if (width > 0) { + depth = 1; + if (num_array_elements > 0) { + height = num_array_elements; + texture_type = TT_1d_texture_array; + } else { + height = 1; + texture_type = TT_1d_texture; + } + + } else { + gobj_cat.error() + << filename << " has zero size\n"; + return false; + } + + do_setup_texture(cdata, texture_type, width, height, depth, type, format); + + cdata->_orig_file_x_size = cdata->_x_size; + cdata->_orig_file_y_size = cdata->_y_size; + cdata->_compression = compression; + cdata->_ram_image_compression = compression; + + if (!header_only) { + bool generate_mipmaps = false; + if (num_mipmap_levels == 0) { + generate_mipmaps = true; + num_mipmap_levels = 1; + } + + for (uint32_t n = 0; n < num_mipmap_levels; ++n) { + uint32_t image_size; + if (big_endian) { + image_size = ktx.get_be_uint32(); + } else { + image_size = ktx.get_uint32(); + } + PTA_uchar image; + + if (compression == CM_off) { + uint32_t row_size = do_get_expected_mipmap_x_size(cdata, (int)n) * cdata->_num_components * cdata->_component_width; + uint32_t num_rows = do_get_expected_mipmap_y_size(cdata, (int)n) * do_get_expected_mipmap_z_size(cdata, (int)n); + uint32_t row_padded = (row_size + 3) & ~3; + + if (image_size == row_size * num_rows) { + if (row_padded != row_size) { + // Someone tightly packed the image. This is invalid, but because + // we like it tightly packed too, we'll read it anyway. + gobj_cat.warning() + << filename << " does not have proper row padding for mipmap " + "level " << n << "\n"; + } + image = PTA_uchar::empty_array(image_size); + ktx.extract_bytes(image.p(), image_size); + + } else if (image_size != row_padded * num_rows) { + gobj_cat.error() + << filename << " has invalid image size " << image_size + << " for mipmap level " << n << " (expected " + << row_padded * num_rows << ")\n"; + return false; + + } else { + // Read it row by row. + image = PTA_uchar::empty_array(row_size * num_rows); + uint32_t skip = row_padded - row_size; + unsigned char *p = image.p(); + for (uint32_t row = 0; row < num_rows; ++row) { + ktx.extract_bytes(p, row_size); + ktx.skip_bytes(skip); + p += row_size; + } + } + + // Swap red and blue channels if necessary to match Panda conventions. + if (swap_bgr) { + unsigned char *begin = image.p(); + const unsigned char *end = image.p() + image.size(); + size_t skip = cdata->_num_components; + nassertr(skip == 3 || skip == 4, false); + + switch (cdata->_component_width) { + case 1: + for (unsigned char *p = begin; p < end; p += skip) { + swap(p[0], p[2]); + } + break; + case 2: + for (short *p = (short *)begin; p < (short *)end; p += skip) { + swap(p[0], p[2]); + } + break; + case 4: + for (int *p = (int *)begin; p < (int *)end; p += skip) { + swap(p[0], p[2]); + } + break; + default: + nassertr(false, false); + break; + } + } + + do_set_ram_mipmap_image(cdata, (int)n, MOVE(image), + row_size * do_get_expected_mipmap_y_size(cdata, (int)n)); + + } else { + // Compressed image. We'll trust that the file has the right size. + image = PTA_uchar::empty_array(image_size); + ktx.extract_bytes(image.p(), image_size); + do_set_ram_mipmap_image(cdata, (int)n, MOVE(image), image_size / depth); + } + + ktx.skip_bytes(3 - ((image_size + 3) & 3)); + } + + cdata->_has_read_pages = true; + cdata->_has_read_mipmaps = true; + cdata->_num_mipmap_levels_read = cdata->_ram_images.size(); + + if (generate_mipmaps) { + do_generate_ram_mipmap_images(cdata, false); + } + } + + if (in.fail() || in.eof()) { + gobj_cat.error() + << filename << ": truncated KTX file.\n"; + return false; + } + + cdata->_loaded_from_image = true; + cdata->_loaded_from_txo = true; + + return true; +} + /** * Internal method to write a series of pages and/or mipmap levels to disk * files. @@ -4607,6 +5644,27 @@ do_get_clear_data(const CData *cdata, unsigned char *into) const { } break; } + + case T_unsigned_int: + { + // Note: there are no 32-bit UNORM textures. Therefore, we don't do any + // normalization here, either. + switch (cdata->_num_components) { + case 2: + ((unsigned int *)into)[1] = (unsigned int)cdata->_clear_color[1]; + case 1: + ((unsigned int *)into)[0] = (unsigned int)cdata->_clear_color[0]; + break; + case 4: + ((unsigned int *)into)[3] = (unsigned int)cdata->_clear_color[3]; + case 3: // BGR <-> RGB + ((unsigned int *)into)[0] = (unsigned int)cdata->_clear_color[2]; + ((unsigned int *)into)[1] = (unsigned int)cdata->_clear_color[1]; + ((unsigned int *)into)[2] = (unsigned int)cdata->_clear_color[0]; + break; + } + break; + } } return cdata->_num_components * cdata->_component_width; @@ -4692,18 +5750,24 @@ do_compress_ram_image(CData *cdata, Texture::CompressionMode compression, case Texture::F_rgb10_a2: if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_dxt1)) { compression = CM_dxt1; - } else if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_dxt3)) { + } else if (gsg->get_supports_compressed_texture_format(CM_dxt3)) { compression = CM_dxt3; - } else if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_dxt5)) { + } else if (gsg->get_supports_compressed_texture_format(CM_dxt5)) { compression = CM_dxt5; + } else if (gsg->get_supports_compressed_texture_format(CM_etc2)) { + compression = CM_etc2; + } else if (gsg->get_supports_compressed_texture_format(CM_etc1)) { + compression = CM_etc1; } break; case Texture::F_rgba4: if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_dxt3)) { compression = CM_dxt3; - } else if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_dxt5)) { + } else if (gsg->get_supports_compressed_texture_format(CM_dxt5)) { compression = CM_dxt5; + } else if (gsg->get_supports_compressed_texture_format(CM_etc2)) { + compression = CM_etc2; } break; @@ -4714,6 +5778,8 @@ do_compress_ram_image(CData *cdata, Texture::CompressionMode compression, case Texture::F_rgba32: if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_dxt5)) { compression = CM_dxt5; + } else if (gsg->get_supports_compressed_texture_format(CM_etc2)) { + compression = CM_etc2; } break; @@ -4721,6 +5787,8 @@ do_compress_ram_image(CData *cdata, Texture::CompressionMode compression, case Texture::F_rg: if (gsg == NULL || gsg->get_supports_compressed_texture_format(CM_rgtc)) { compression = CM_rgtc; + } else if (gsg->get_supports_compressed_texture_format(CM_eac)) { + compression = CM_eac; } break; @@ -4947,8 +6015,8 @@ do_compress_ram_image_bc4(const RamImage &uncompressed_image, // of the secondary interpolation mode supported by BC4. This is not // important for most textures, but it may be added in the future. - nassertv(x_blocks * y_blocks * 4 * 4 <= uncompressed_image._page_size); - nassertv(x_size * y_size == uncompressed_image._page_size); + nassertv((size_t)x_blocks * (size_t)y_blocks * 4 * 4 <= uncompressed_image._page_size); + nassertv((size_t)x_size * (size_t)y_size == uncompressed_image._page_size); static const int remap[] = {1, 7, 6, 5, 4, 3, 2, 0}; @@ -5046,8 +6114,8 @@ do_compress_ram_image_bc5(const RamImage &uncompressed_image, // BC5 uses the same compression algorithm as BC4, except repeated for two // channels. - nassertv(x_blocks * y_blocks * 4 * 4 * 2 <= uncompressed_image._page_size); - nassertv(stride * y_size == uncompressed_image._page_size); + nassertv((size_t)x_blocks * (size_t)y_blocks * 4 * 4 * 2 <= uncompressed_image._page_size); + nassertv((size_t)stride * (size_t)y_size == uncompressed_image._page_size); static const int remap[] = {1, 7, 6, 5, 4, 3, 2, 0}; @@ -5706,6 +6774,10 @@ do_setup_texture(CData *cdata, Texture::TextureType texture_type, case TT_buffer_texture: nassertv(y_size == 1 && z_size == 1); break; + + case TT_1d_texture_array: + nassertv(z_size == 1); + break; } if (texture_type != TT_2d_texture) { @@ -5822,14 +6894,9 @@ do_set_component_type(CData *cdata, Texture::ComponentType component_type) { break; case T_float: - cdata->_component_width = 4; - break; - case T_unsigned_int_24_8: - cdata->_component_width = 4; - break; - case T_int: + case T_unsigned_int: cdata->_component_width = 4; break; } @@ -6344,6 +7411,9 @@ do_set_simple_ram_image(CData *cdata, CPTA_uchar image, int x_size, int y_size) */ int Texture:: do_get_expected_num_mipmap_levels(const CData *cdata) const { + if (cdata->_texture_type == Texture::TT_buffer_texture) { + return 1; + } int size = max(cdata->_x_size, cdata->_y_size); if (cdata->_texture_type == Texture::TT_3d_texture) { size = max(size, cdata->_z_size); @@ -6472,7 +7542,12 @@ do_generate_ram_mipmap_images(CData *cdata, bool allow_recompress) { // Now try to get the uncompressed source image. do_get_uncompressed_ram_image(cdata); - nassertv(cdata->_ram_image_compression == CM_off); + if (cdata->_ram_image_compression != CM_off) { + gobj_cat.error() + << "Cannot generate mipmap levels for image with compression " + << cdata->_ram_image_compression << "\n"; + return; + } } do_clear_ram_mipmap_images(cdata); @@ -8970,6 +10045,7 @@ make_this_from_bam(const FactoryParams ¶ms) { case TT_buffer_texture: case TT_1d_texture: case TT_2d_texture: + case TT_1d_texture_array: if (alpha_filename.empty()) { me = TexturePool::load_texture(filename, primary_file_num_channels, has_read_mipmaps, options); diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index 010f847b6a..cd05019416 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -79,6 +79,7 @@ PUBLISHED: TT_cube_map, TT_buffer_texture, TT_cube_map_array, + TT_1d_texture_array, }; enum ComponentType { @@ -90,6 +91,7 @@ PUBLISHED: T_byte, T_short, T_half_float, + T_unsigned_int, }; enum Format { @@ -206,6 +208,9 @@ PUBLISHED: CM_pvr1_2bpp, CM_pvr1_4bpp, CM_rgtc, // BC4/BC5: 1 or 2 channels, individually compressed. + CM_etc1, + CM_etc2, + CM_eac, // EAC: 1 or 2 channels. }; enum QualityLevel { @@ -284,6 +289,7 @@ PUBLISHED: BLOCKING static PT(Texture) make_from_txo(istream &in, const string &filename = ""); BLOCKING bool write_txo(ostream &out, const string &filename = "") const; BLOCKING bool read_dds(istream &in, const string &filename = "", bool header_only = false); + BLOCKING bool read_ktx(istream &in, const string &filename = "", bool header_only = false); BLOCKING INLINE bool load(const PNMImage &pnmimage, const LoaderOptions &options = LoaderOptions()); BLOCKING INLINE bool load(const PNMImage &pnmimage, int z, int n, const LoaderOptions &options = LoaderOptions()); @@ -439,9 +445,15 @@ PUBLISHED: CPTA_uchar get_ram_image_as(const string &requested_format); INLINE PTA_uchar modify_ram_image(); INLINE PTA_uchar make_ram_image(); +#ifndef CPPPARSER INLINE void set_ram_image(CPTA_uchar image, CompressionMode compression = CM_off, size_t page_size = 0); void set_ram_image_as(CPTA_uchar image, const string &provided_format); +#else + EXTEND void set_ram_image(PyObject *image, CompressionMode compression = CM_off, + size_t page_size = 0); + EXTEND void set_ram_image_as(PyObject *image, const string &provided_format); +#endif INLINE void clear_ram_image(); INLINE void set_keep_ram_image(bool keep_ram_image); virtual bool get_keep_ram_image() const; @@ -657,6 +669,8 @@ protected: bool do_read_txo(CData *cdata, istream &in, const string &filename); bool do_read_dds_file(CData *cdata, const Filename &fullpath, bool header_only); bool do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only); + bool do_read_ktx_file(CData *cdata, const Filename &fullpath, bool header_only); + bool do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only); bool do_write(CData *cdata, const Filename &fullpath, int z, int n, bool write_pages, bool write_mipmaps); @@ -840,6 +854,7 @@ private: INLINE static bool is_txo_filename(const Filename &fullpath); INLINE static bool is_dds_filename(const Filename &fullpath); + INLINE static bool is_ktx_filename(const Filename &fullpath); void do_filter_2d_mipmap_pages(const CData *cdata, RamImage &to, const RamImage &from, diff --git a/panda/src/gobj/texturePeeker.I b/panda/src/gobj/texturePeeker.I index d41ee14db9..ccf6bdcc45 100644 --- a/panda/src/gobj/texturePeeker.I +++ b/panda/src/gobj/texturePeeker.I @@ -53,6 +53,6 @@ get_z_size() const { * Returns whether a given coordinate is inside of the texture dimensions. */ INLINE bool TexturePeeker:: -has_pixel(size_t x, size_t y) const { - return x < _x_size && y < _y_size; +has_pixel(int x, int y) const { + return x >= 0 && y >= 0 && x < _x_size && y < _y_size; } diff --git a/panda/src/gobj/texturePeeker.cxx b/panda/src/gobj/texturePeeker.cxx index cbe9003def..42e619e501 100644 --- a/panda/src/gobj/texturePeeker.cxx +++ b/panda/src/gobj/texturePeeker.cxx @@ -176,7 +176,7 @@ lookup(LColor &color, PN_stdfloat u, PN_stdfloat v) const { * coordinates are used. */ void TexturePeeker:: -fetch_pixel(LColor& color, size_t x, size_t y) const { +fetch_pixel(LColor& color, int x, int y) const { nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); const unsigned char *p = _image.p() + (y * _x_size + x) * _pixel_width; (*_get_texel)(color, p, _get_component); diff --git a/panda/src/gobj/texturePeeker.h b/panda/src/gobj/texturePeeker.h index e9af394dec..cb503bf041 100644 --- a/panda/src/gobj/texturePeeker.h +++ b/panda/src/gobj/texturePeeker.h @@ -36,10 +36,10 @@ PUBLISHED: INLINE int get_y_size() const; INLINE int get_z_size() const; - INLINE bool has_pixel(size_t x, size_t y) const; + INLINE bool has_pixel(int x, int y) const; void lookup(LColor &color, PN_stdfloat u, PN_stdfloat v) const; void lookup(LColor &color, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w) const; - void fetch_pixel(LColor &color, size_t x, size_t y) const; + void fetch_pixel(LColor &color, int x, int y) const; bool lookup_bilinear(LColor &color, PN_stdfloat u, PN_stdfloat v) const; void filter_rect(LColor &color, PN_stdfloat min_u, PN_stdfloat min_v, diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index cf73364cde..dd850c98ad 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -90,7 +90,7 @@ get_texture_type(const string &extension) const { // Check the PNM type registry. PNMFileTypeRegistry *pnm_reg = PNMFileTypeRegistry::get_global_ptr(); PNMFileType *type = pnm_reg->get_type_from_extension(c); - if (type != (PNMFileType *)NULL) { + if (type != (PNMFileType *)NULL || c == "txo" || c == "dds" || c == "ktx") { // This is a known image type; create an ordinary Texture. ((TexturePool *)this)->_type_registry[c] = Texture::make_texture; return Texture::make_texture; @@ -109,6 +109,11 @@ void TexturePool:: write_texture_types(ostream &out, int indent_level) const { MutexHolder holder(_lock); + // These are supported out of the box. + indent(out, indent_level) << "Texture Object .txo\n"; + indent(out, indent_level) << "DirectDraw Surface .dds\n"; + indent(out, indent_level) << "Khronos Texture .ktx\n"; + PNMFileTypeRegistry *pnm_reg = PNMFileTypeRegistry::get_global_ptr(); pnm_reg->write(out, indent_level); @@ -641,7 +646,7 @@ ns_load_2d_texture_array(const Filename &filename_pattern, nassertr(tex != (Texture *)NULL, NULL); tex->set_filename(filename_pattern); tex->set_fullpath(filename); - tex->_texture_pool_key = filename; + tex->_texture_pool_key = unique_filename; { MutexHolder holder(_lock); diff --git a/panda/src/gobj/texture_ext.cxx b/panda/src/gobj/texture_ext.cxx new file mode 100644 index 0000000000..1e661e960a --- /dev/null +++ b/panda/src/gobj/texture_ext.cxx @@ -0,0 +1,151 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file texture_ext.cxx + * @author rdb + * @date 2016-08-08 + */ + +#include "texture_ext.h" + +#ifdef HAVE_PYTHON + +#ifndef CPPPARSER +extern Dtool_PyTypedObject Dtool_PointerToArray_unsigned_char; +extern Dtool_PyTypedObject Dtool_ConstPointerToArray_unsigned_char; +#endif + +/** + * Replaces the current system-RAM image with the new data. If compression is + * not CM_off, it indicates that the new data is already pre-compressed in the + * indicated format. + * + * This does *not* affect keep_ram_image. + */ +void Extension:: +set_ram_image(PyObject *image, Texture::CompressionMode compression, + size_t page_size) { + nassertv(compression != Texture::CM_default); + + // Check if perhaps a PointerToArray object was passed in. + if (DtoolCanThisBeAPandaInstance(image)) { + Dtool_PyInstDef *inst = (Dtool_PyInstDef *)image; + + if (inst->_My_Type == &Dtool_ConstPointerToArray_unsigned_char) { + _this->set_ram_image(*(const CPTA_uchar *)inst->_ptr_to_object, compression, page_size); + return; + + } else if (inst->_My_Type == &Dtool_PointerToArray_unsigned_char) { + _this->set_ram_image(*(const PTA_uchar *)inst->_ptr_to_object, compression, page_size); + return; + } + } + +#if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(image)) { + // User passed a buffer object. + Py_buffer view; + if (PyObject_GetBuffer(image, &view, PyBUF_CONTIG_RO) == -1) { + PyErr_SetString(PyExc_TypeError, + "Texture.set_ram_image() requires a contiguous buffer"); + return; + } + + int component_width = _this->get_component_width(); + if (compression == Texture::CM_off) { + if (view.itemsize != 1 && view.itemsize != component_width) { + PyErr_SetString(PyExc_TypeError, + "buffer.itemsize does not match Texture component size"); + return; + } + + if (view.len % component_width != 0) { + PyErr_Format(PyExc_ValueError, + "byte buffer is not a multiple of %zu bytes", + component_width); + return; + } + } else { + if (view.itemsize != 1) { + PyErr_SetString(PyExc_TypeError, + "buffer.itemsize should be 1 for compressed images"); + return; + } + } + + PTA_uchar data = PTA_uchar::empty_array(view.len, Texture::get_class_type()); + memcpy(data.p(), view.buf, view.len); + _this->set_ram_image(MOVE(data), compression, page_size); + + PyBuffer_Release(&view); + return; + } +#endif + + Dtool_Raise_ArgTypeError(image, 0, "Texture.set_ram_image", "CPTA_uchar or buffer"); +} + +/** + * Replaces the current system-RAM image with the new data, converting it + * first if necessary from the indicated component-order format. See + * get_ram_image_as() for specifications about the format. This method cannot + * support compressed image data or sub-pages; use set_ram_image() for that. + */ +void Extension:: +set_ram_image_as(PyObject *image, const string &provided_format) { + // Check if perhaps a PointerToArray object was passed in. + if (DtoolCanThisBeAPandaInstance(image)) { + Dtool_PyInstDef *inst = (Dtool_PyInstDef *)image; + + if (inst->_My_Type == &Dtool_ConstPointerToArray_unsigned_char) { + _this->set_ram_image_as(*(const CPTA_uchar *)inst->_ptr_to_object, provided_format); + return; + + } else if (inst->_My_Type == &Dtool_PointerToArray_unsigned_char) { + _this->set_ram_image_as(*(const PTA_uchar *)inst->_ptr_to_object, provided_format); + return; + } + } + +#if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(image)) { + // User passed a buffer object. + Py_buffer view; + if (PyObject_GetBuffer(image, &view, PyBUF_CONTIG_RO) == -1) { + PyErr_SetString(PyExc_TypeError, + "Texture.set_ram_image_as() requires a contiguous buffer"); + return; + } + + int component_width = _this->get_component_width(); + if (view.itemsize != 1 && view.itemsize != component_width) { + PyErr_SetString(PyExc_TypeError, + "buffer.itemsize does not match Texture component size"); + return; + } + + if (view.len % component_width != 0) { + PyErr_Format(PyExc_ValueError, + "byte buffer is not a multiple of %zu bytes", + component_width); + return; + } + + PTA_uchar data = PTA_uchar::empty_array(view.len, Texture::get_class_type()); + memcpy(data.p(), view.buf, view.len); + _this->set_ram_image_as(MOVE(data), provided_format); + + PyBuffer_Release(&view); + return; + } +#endif + + Dtool_Raise_ArgTypeError(image, 0, "Texture.set_ram_image_as", "CPTA_uchar or buffer"); +} + +#endif // HAVE_PYTHON diff --git a/panda/src/gobj/texture_ext.h b/panda/src/gobj/texture_ext.h new file mode 100644 index 0000000000..d33fce24ef --- /dev/null +++ b/panda/src/gobj/texture_ext.h @@ -0,0 +1,41 @@ +/** + * PANDA 3D SOFTWARE + * Copyright (c) Carnegie Mellon University. All rights reserved. + * + * All use of this software is subject to the terms of the revised BSD + * license. You should have received a copy of this license along + * with this source code in a file named "LICENSE." + * + * @file texture_ext.h + * @author rdb + * @date 2016-08-08 + */ + +#ifndef TEXTURE_EXT_H +#define TEXTURE_EXT_H + +#ifndef CPPPARSER + +#include "extension.h" +#include "py_panda.h" +#include "texture.h" + +#ifdef HAVE_PYTHON + +/** + * This class defines the extension methods for Texture, which are + * called instead of any C++ methods with the same prototype. + */ +template<> +class Extension : public ExtensionBase { +public: + void set_ram_image(PyObject *image, Texture::CompressionMode compression = Texture::CM_off, + size_t page_size = 0); + void set_ram_image_as(PyObject *image, const string &provided_format); +}; + +#endif // HAVE_PYTHON + +#endif // CPPPARSER + +#endif // TEXTURE_EXT_H diff --git a/panda/src/grutil/multitexReducer.cxx b/panda/src/grutil/multitexReducer.cxx index ea300e7902..8481444a2d 100644 --- a/panda/src/grutil/multitexReducer.cxx +++ b/panda/src/grutil/multitexReducer.cxx @@ -756,17 +756,13 @@ make_texture_layer(const NodePath &render, case TextureStage::CM_modulate: { TextureStage::CombineSource source0 = stage_info._stage->get_combine_rgb_source0(); - TextureStage::CombineOperand operand0 = stage_info._stage->get_combine_rgb_operand0(); TextureStage::CombineSource source1 = stage_info._stage->get_combine_rgb_source1(); - TextureStage::CombineOperand operand1 = stage_info._stage->get_combine_rgb_operand1(); // Since modulate doesn't care about order, let's establish the // convention that the lowest-numbered source operand is in slot 0 // (just for purposes of comparison). if (source1 < source0) { source0 = stage_info._stage->get_combine_rgb_source1(); - operand0 = stage_info._stage->get_combine_rgb_operand1(); source1 = stage_info._stage->get_combine_rgb_source0(); - operand1 = stage_info._stage->get_combine_rgb_operand0(); } if (source0 == TextureStage::CS_primary_color && diff --git a/panda/src/grutil/pipeOcclusionCullTraverser.cxx b/panda/src/grutil/pipeOcclusionCullTraverser.cxx index ca4316c5cc..91ebeb6559 100644 --- a/panda/src/grutil/pipeOcclusionCullTraverser.cxx +++ b/panda/src/grutil/pipeOcclusionCullTraverser.cxx @@ -673,8 +673,6 @@ show_results(int num_fragments, const Geom *geom, TransparencyAttrib::make(TransparencyAttrib::M_alpha), ColorAttrib::make_flat(color)); - GraphicsStateGuardian *gsg = _buffer->get_gsg(); - CullableObject *internal_viz = new CullableObject(geom, state, internal_transform); _internal_cull_handler->record_object(internal_viz, _internal_trav); diff --git a/panda/src/grutil/shaderTerrainMesh.cxx b/panda/src/grutil/shaderTerrainMesh.cxx index 8e655de000..8c2d03cdd4 100644 --- a/panda/src/grutil/shaderTerrainMesh.cxx +++ b/panda/src/grutil/shaderTerrainMesh.cxx @@ -534,7 +534,7 @@ void ShaderTerrainMesh::add_for_draw(CullTraverser *trav, CullTraverserData &dat // After rendering, increment the view index ++_current_view_index; - if (_current_view_index > stm_max_views) { + if (_current_view_index > (size_t)stm_max_views) { shader_terrain_cat.error() << "More views than supported! Increase the stm-max-views config variable!" << endl; } diff --git a/panda/src/movies/dr_flac.h b/panda/src/movies/dr_flac.h index c6da7b9004..26d133191d 100644 --- a/panda/src/movies/dr_flac.h +++ b/panda/src/movies/dr_flac.h @@ -503,7 +503,7 @@ static DRFLAC_INLINE uint32_t drflac__swap_endian_uint32(uint32_t n) { #ifdef _MSC_VER return _byteswap_ulong(n); -#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC__ >= 3)) +#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) return __builtin_bswap32(n); #else return ((n & 0xFF000000) >> 24) | @@ -517,7 +517,7 @@ static DRFLAC_INLINE uint64_t drflac__swap_endian_uint64(uint64_t n) { #ifdef _MSC_VER return _byteswap_uint64(n); -#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC__ >= 3)) +#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) return __builtin_bswap64(n); #else return ((n & 0xFF00000000000000ULL) >> 56) | diff --git a/panda/src/nativenet/buffered_datagramconnection.cxx b/panda/src/nativenet/buffered_datagramconnection.cxx index 22bfab5215..b9abc6a406 100644 --- a/panda/src/nativenet/buffered_datagramconnection.cxx +++ b/panda/src/nativenet/buffered_datagramconnection.cxx @@ -13,10 +13,6 @@ #include "buffered_datagramconnection.h" -#ifdef HAVE_PYTHON -#include "py_panda.h" -#endif - TypeHandle Buffered_DatagramConnection::_type_handle; /** @@ -34,22 +30,6 @@ SendMessage(const Datagram &msg) { // Raise an exception to give us more information at the python level nativenet_cat.warning() << "Buffered_DatagramConnection::SendMessage->Error On Write--Out Buffer = " << _Writer.AmountBuffered() << "\n"; -#ifdef HAVE_PYTHON - ostringstream s; - -#if PY_VERSION_HEX >= 0x03030000 - PyObject *exc_type = PyExc_ConnectionError; -#else - PyObject *exc_type = PyExc_OSError; -#endif - - s << endl << "Error sending message: " << endl; - msg.dump_hex(s); - s << "Message data: " << msg.get_data() << endl; - - string message = s.str(); - PyErr_SetString(exc_type, message.c_str()); -#endif ClearAll(); } diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx index c9debb3f2c..afae75b753 100644 --- a/panda/src/ode/odeTriMeshData.cxx +++ b/panda/src/ode/odeTriMeshData.cxx @@ -54,14 +54,19 @@ print_data(const string &marker) { void OdeTriMeshData:: remove_data(OdeTriMeshData *data) { - odetrimeshdata_cat.debug() << get_class_type() << "::remove_data(" << data->get_id() << ")" << "\n"; - nassertv(_tri_mesh_data_map != (TriMeshDataMap *)NULL); - TriMeshDataMap::iterator iter; + if (odetrimeshdata_cat.is_debug()) { + odetrimeshdata_cat.debug() + << get_class_type() << "::remove_data(" << data->get_id() << ")" << "\n"; + } + if (_tri_mesh_data_map == (TriMeshDataMap *)NULL) { + return; + } + TriMeshDataMap::iterator iter; for (iter = _tri_mesh_data_map->begin(); iter != _tri_mesh_data_map->end(); ++iter) { - if ( iter->second == data ) { + if (iter->second == data) { break; } } @@ -72,7 +77,7 @@ remove_data(OdeTriMeshData *data) { for (iter = _tri_mesh_data_map->begin(); iter != _tri_mesh_data_map->end(); ++iter) { - if ( iter->second == data ) { + if (iter->second == data) { break; } } @@ -150,8 +155,13 @@ operator = (const OdeTriMeshData &other) { void OdeTriMeshData:: process_model(const NodePath& model, bool &use_normals) { // TODO: assert if _vertices is something other than 0. - ostream &out = odetrimeshdata_cat.debug(); - out << "process_model(" << model << ")" << "\n"; + if (odetrimeshdata_cat.is_debug()) { + odetrimeshdata_cat.debug() + << "process_model(" << model << ")" << "\n"; + } + if (model.is_empty()) { + return; + } NodePathCollection geomNodePaths = model.find_all_matches("**/+GeomNode"); if (model.node()->get_type() == GeomNode::get_class_type()) { diff --git a/panda/src/parametrics/curveFitter.cxx b/panda/src/parametrics/curveFitter.cxx index 0cc20c20fa..6592d7aff2 100644 --- a/panda/src/parametrics/curveFitter.cxx +++ b/panda/src/parametrics/curveFitter.cxx @@ -154,11 +154,9 @@ void CurveFitter:: sample(ParametricCurveCollection *curves, int count) { nassertv(curves != (ParametricCurveCollection *)NULL); PN_stdfloat max_t = curves->get_max_t(); - PN_stdfloat t, last_t, d; + PN_stdfloat t; DataPoint dp; - last_t = 0.0f; - d = 0.0f; int i; for (i = 0; i < count; i++) { t = max_t * (PN_stdfloat)i / (PN_stdfloat)(count-1); diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index 7fd2da2d83..e62a3d6e24 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -911,7 +911,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { AttribNodeRegistry *areg = AttribNodeRegistry::get_global_ptr(); if (manager->get_file_minor_ver() >= 40) { - for (int i = 0; i < _off_planes.size(); ++i) { + for (size_t i = 0; i < _off_planes.size(); ++i) { pi += _off_planes[i].complete_pointers(p_list + pi, manager); int n = areg->find_node(_off_planes[i]); @@ -921,7 +921,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { } } - for (int i = 0; i < _on_planes.size(); ++i) { + for (size_t i = 0; i < _on_planes.size(); ++i) { pi += _on_planes[i].complete_pointers(p_list + pi, manager); int n = areg->find_node(_on_planes[i]); diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index 33503de0eb..0bd7a0fe5f 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -59,7 +59,20 @@ munge_geom(GraphicsStateGuardianBase *gsg, if (_geom != (Geom *)NULL) { _munger = munger; + GraphicsStateGuardianBase *gsg = traverser->get_gsg(); + int gsg_bits = gsg->get_supported_geom_rendering(); + if (!hardware_point_sprites) { + // If support for hardware point sprites or perspective-scaled points is + // disabled, we don't allow the GSG to tell us it supports them. + gsg_bits &= ~(Geom::GR_point_perspective | Geom::GR_point_sprite); + } + if (!hardware_points) { + // If hardware-points is off, we don't allow any kind of point + // rendering, except plain old one-pixel points; + gsg_bits &= ~(Geom::GR_point_bits & ~Geom::GR_point); + } int geom_rendering; + int unsupported_bits; { GeomPipelineReader geom_reader(_geom, current_thread); @@ -76,31 +89,24 @@ munge_geom(GraphicsStateGuardianBase *gsg, geom_rendering = geom_reader.get_geom_rendering(); geom_rendering = _state->get_geom_rendering(geom_rendering); geom_rendering = _internal_transform->get_geom_rendering(geom_rendering); + unsupported_bits = geom_rendering & ~gsg_bits; if (geom_rendering & Geom::GR_point_bits) { if (geom_reader.get_primitive_type() != Geom::PT_points) { - if (singular_points) { + if (singular_points || + (unsupported_bits & Geom::GR_render_mode_point) != 0) { // Isolate the points so there's no unneeded overlap. _geom = _geom->make_points(); } } } + if (unsupported_bits & Geom::GR_render_mode_wireframe) { + if (geom_reader.get_primitive_type() != Geom::PT_lines) { + _geom = _geom->make_lines(); + } + } } - GraphicsStateGuardianBase *gsg = traverser->get_gsg(); - int gsg_bits = gsg->get_supported_geom_rendering(); - if (!hardware_point_sprites) { - // If support for hardware point sprites or perspective-scaled points is - // disabled, we don't allow the GSG to tell us it supports them. - gsg_bits &= ~(Geom::GR_point_perspective | Geom::GR_point_sprite); - } - if (!hardware_points) { - // If hardware-points is off, we don't allow any kind of point - // rendering, except plain old one-pixel points; - gsg_bits &= ~(Geom::GR_point_bits & ~Geom::GR_point); - } - int unsupported_bits = geom_rendering & ~gsg_bits; - if ((unsupported_bits & Geom::GR_point_bits) != 0) { // The GSG doesn't support rendering these fancy points directly; we // have to render them in software instead. Munge them into quads. diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index a677345b8a..b80eb3b428 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -935,11 +935,11 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { int pi = RenderAttrib::complete_pointers(p_list, manager); if (manager->get_file_minor_ver() >= 40) { - for (int i = 0; i < _off_lights.size(); ++i) { + for (size_t i = 0; i < _off_lights.size(); ++i) { pi += _off_lights[i].complete_pointers(p_list + pi, manager); } - for (int i = 0; i < _on_lights.size(); ++i) { + for (size_t i = 0; i < _on_lights.size(); ++i) { pi += _on_lights[i].complete_pointers(p_list + pi, manager); } @@ -978,7 +978,7 @@ finalize(BamReader *manager) { // Check if any of the nodes we loaded are mentioned in the // AttribNodeRegistry. If so, replace them. - for (int i = 0; i < _off_lights.size(); ++i) { + for (size_t i = 0; i < _off_lights.size(); ++i) { int n = areg->find_node(_off_lights[i]); if (n != -1) { // If it's in the registry, replace it. @@ -986,7 +986,7 @@ finalize(BamReader *manager) { } } - for (int i = 0; i < _on_lights.size(); ++i) { + for (size_t i = 0; i < _on_lights.size(); ++i) { int n = areg->find_node(_on_lights[i]); if (n != -1) { // If it's in the registry, replace it. @@ -1067,12 +1067,12 @@ fillin(DatagramIterator &scan, BamReader *manager) { if (manager->get_file_minor_ver() >= 40) { _off_lights.resize(scan.get_uint16()); - for (int i = 0; i < _off_lights.size(); ++i) { + for (size_t i = 0; i < _off_lights.size(); ++i) { _off_lights[i].fillin(scan, manager); } _on_lights.resize(scan.get_uint16()); - for (int i = 0; i < _on_lights.size(); ++i) { + for (size_t i = 0; i < _on_lights.size(); ++i) { _on_lights[i].fillin(scan, manager); } } else { diff --git a/panda/src/pgraph/loader.cxx b/panda/src/pgraph/loader.cxx index 671a40c638..32187508e0 100644 --- a/panda/src/pgraph/loader.cxx +++ b/panda/src/pgraph/loader.cxx @@ -431,8 +431,6 @@ save_file(const Filename &filename, const LoaderOptions &options, return false; } - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - bool result = try_save_file(this_filename, this_options, node, requested_type); if (!result) { if (report_errors) { @@ -451,10 +449,7 @@ save_file(const Filename &filename, const LoaderOptions &options, bool Loader:: try_save_file(const Filename &pathname, const LoaderOptions &options, PandaNode *node, LoaderFileType *requested_type) const { - bool report_errors = ((options.get_flags() & LoaderOptions::LF_report_errors) != 0 || loader_cat.is_debug()); - - bool result = requested_type->save_file(pathname, options, node); - return result; + return requested_type->save_file(pathname, options, node); } /** diff --git a/panda/src/pgraph/modelFlattenRequest.cxx b/panda/src/pgraph/modelFlattenRequest.cxx index 74a7db8461..2b02b58f00 100644 --- a/panda/src/pgraph/modelFlattenRequest.cxx +++ b/panda/src/pgraph/modelFlattenRequest.cxx @@ -24,7 +24,16 @@ do_task() { // We make another instance of the original node, so we can safely flatten // that without affecting the original copy. NodePath np("flatten_root"); - np.attach_new_node(_orig); + + // Except if we try to attach a node without parents, this will cause the + // original NodePath to be affected, so we have to make a (shallow) copy. + if (_orig->get_num_parents() == 0) { + PT(PandaNode) copy = _orig->make_copy(); + copy->copy_children(_orig); + np.attach_new_node(copy); + } else { + np.attach_new_node(_orig); + } np.flatten_strong(); _model = np.get_child(0).node(); _is_ready = true; diff --git a/panda/src/pgraph/modelFlattenRequest.h b/panda/src/pgraph/modelFlattenRequest.h index 0cea9d87d2..5716635f82 100644 --- a/panda/src/pgraph/modelFlattenRequest.h +++ b/panda/src/pgraph/modelFlattenRequest.h @@ -38,6 +38,10 @@ PUBLISHED: INLINE bool is_ready() const; INLINE PandaNode *get_model() const; + MAKE_PROPERTY(orig, get_orig); + MAKE_PROPERTY(ready, is_ready); + MAKE_PROPERTY(model, get_model); + protected: virtual DoneStatus do_task(); diff --git a/panda/src/pgraph/modelLoadRequest.h b/panda/src/pgraph/modelLoadRequest.h index 06d4307236..00f55e8052 100644 --- a/panda/src/pgraph/modelLoadRequest.h +++ b/panda/src/pgraph/modelLoadRequest.h @@ -45,6 +45,12 @@ PUBLISHED: INLINE bool is_ready() const; INLINE PandaNode *get_model() const; + MAKE_PROPERTY(filename, get_filename); + MAKE_PROPERTY(options, get_options); + MAKE_PROPERTY(loader, get_loader); + MAKE_PROPERTY(ready, is_ready); + MAKE_PROPERTY(model, get_model); + protected: virtual DoneStatus do_task(); diff --git a/panda/src/pgraph/modelSaveRequest.h b/panda/src/pgraph/modelSaveRequest.h index 2180813f76..878e28edee 100644 --- a/panda/src/pgraph/modelSaveRequest.h +++ b/panda/src/pgraph/modelSaveRequest.h @@ -46,6 +46,13 @@ PUBLISHED: INLINE bool is_ready() const; INLINE bool get_success() const; + MAKE_PROPERTY(filename, get_filename); + MAKE_PROPERTY(options, get_options); + MAKE_PROPERTY(node, get_node); + MAKE_PROPERTY(loader, get_loader); + MAKE_PROPERTY(ready, is_ready); + MAKE_PROPERTY(success, get_success); + protected: virtual DoneStatus do_task(); diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index 78c2520faa..a30fc1d40d 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -905,15 +905,19 @@ PUBLISHED: NodePath find_net_tag(const string &key) const; EXTENSION(INLINE PyObject *get_tag_keys() const); - EXTENSION(INLINE void set_python_tag(const string &key, PyObject *value)); - EXTENSION(INLINE PyObject *get_python_tag(const string &key) const); - EXTENSION(INLINE void get_python_tag_keys(vector_string &keys) const); + + EXTENSION(PyObject *get_python_tags()); + EXTENSION(INLINE void set_python_tag(PyObject *keys, PyObject *value)); + EXTENSION(INLINE PyObject *get_python_tag(PyObject *keys) const); EXTENSION(INLINE PyObject *get_python_tag_keys() const); - EXTENSION(INLINE bool has_python_tag(const string &key) const); - EXTENSION(INLINE void clear_python_tag(const string &key)); - EXTENSION(INLINE PyObject *get_net_python_tag(const string &key) const); - EXTENSION(INLINE bool has_net_python_tag(const string &key) const); - EXTENSION(NodePath find_net_python_tag(const string &key) const); + EXTENSION(INLINE bool has_python_tag(PyObject *keys) const); + EXTENSION(INLINE void clear_python_tag(PyObject *keys)); + EXTENSION(INLINE PyObject *get_net_python_tag(PyObject *keys) const); + EXTENSION(INLINE bool has_net_python_tag(PyObject *keys) const); + EXTENSION(NodePath find_net_python_tag(PyObject *keys) const); + MAKE_PROPERTY(python_tags, get_python_tags); + + EXTENSION(int __traverse__(visitproc visit, void *arg)); INLINE void list_tags() const; diff --git a/panda/src/pgraph/nodePathCollection_ext.cxx b/panda/src/pgraph/nodePathCollection_ext.cxx index 28b5ed5255..c6f17b7aa4 100644 --- a/panda/src/pgraph/nodePathCollection_ext.cxx +++ b/panda/src/pgraph/nodePathCollection_ext.cxx @@ -76,16 +76,19 @@ __reduce__(PyObject *self) const { // object whose constructor we should call (e.g. this), and the arguments // necessary to reconstruct this object. - PyObject *this_class = PyObject_Type(self); + PyObject *this_class = (PyObject *)self->ob_type; if (this_class == NULL) { return NULL; } + PyObject *self_iter = PyObject_GetIter(self); + if (self_iter == NULL) { + return NULL; + } + // Since a NodePathCollection is itself an iterator, we can simply pass it // as the fourth tuple component. - PyObject *result = Py_BuildValue("(O()OO)", this_class, Py_None, self); - Py_DECREF(this_class); - return result; + return Py_BuildValue("(O()ON)", this_class, Py_None, self_iter); } /** diff --git a/panda/src/pgraph/nodePath_ext.I b/panda/src/pgraph/nodePath_ext.I index 0931d2d794..5bc6c78c5a 100644 --- a/panda/src/pgraph/nodePath_ext.I +++ b/panda/src/pgraph/nodePath_ext.I @@ -14,15 +14,19 @@ #include "pandaNode_ext.h" /** - * Fills the given vector up with the list of Python tags on this PandaNode. - * - * It is the user's responsibility to ensure that the keys vector is empty - * before making this call; otherwise, the new files will be appended to it. + * Returns a dictionary of Python tags that is associated with the current + * node. This is similar to the regular tags, except this can store any + * Python object instead of just a string. However, the Python object is not + * recorded to a bam file. */ -INLINE void Extension:: -get_python_tag_keys(vector_string &keys) const { - nassertv_always(!_this->is_empty()); - invoke_extension(_this->node()).get_python_tag_keys(keys); +INLINE PyObject *Extension:: +get_python_tags() { + // An empty NodePath returns None + if (_this->is_empty()) { + Py_INCREF(Py_None); + return Py_None; + } + return invoke_extension(_this->node()).get_python_tags(); } /** @@ -63,7 +67,7 @@ get_python_tag_keys() const { * of any one key's object. */ INLINE void Extension:: -set_python_tag(const string &key, PyObject *value) { +set_python_tag(PyObject *key, PyObject *value) { nassertv_always(!_this->is_empty()); invoke_extension(_this->node()).set_python_tag(key, value); } @@ -74,7 +78,7 @@ set_python_tag(const string &key, PyObject *value) { * None. See also get_net_python_tag(). */ INLINE PyObject *Extension:: -get_python_tag(const string &key) const { +get_python_tag(PyObject *key) const { // An empty NodePath quietly returns no tags. This makes // get_net_python_tag() easier to implement. if (_this->is_empty()) { @@ -90,7 +94,7 @@ get_python_tag(const string &key) const { * value has been set. See also has_net_python_tag(). */ INLINE bool Extension:: -has_python_tag(const string &key) const { +has_python_tag(PyObject *key) const { // An empty NodePath quietly has no tags. This makes has_net_python_tag() // easier to implement. if (_this->is_empty()) { @@ -105,7 +109,7 @@ has_python_tag(const string &key) const { * the indicated key. */ INLINE void Extension:: -clear_python_tag(const string &key) { +clear_python_tag(PyObject *key) { nassertv_always(!_this->is_empty()); invoke_extension(_this->node()).clear_python_tag(key); } @@ -117,7 +121,7 @@ clear_python_tag(const string &key) { * get_python_tag(). */ INLINE PyObject *Extension:: -get_net_python_tag(const string &key) const { +get_net_python_tag(PyObject *key) const { NodePath tag_np = find_net_python_tag(key); return invoke_extension(&tag_np).get_python_tag(key); } @@ -127,6 +131,17 @@ get_net_python_tag(const string &key) const { * or on any ancestor node, or false otherwise. See also has_python_tag(). */ INLINE bool Extension:: -has_net_python_tag(const string &key) const { +has_net_python_tag(PyObject *key) const { return !find_net_python_tag(key).is_empty(); } + +/** + * Called by Python to implement cycle detection. + */ +INLINE int Extension:: +__traverse__(visitproc visit, void *arg) { + if (_this->is_empty()) { + return 0; + } + return invoke_extension(_this->node()).__traverse__(visit, arg); +} diff --git a/panda/src/pgraph/nodePath_ext.cxx b/panda/src/pgraph/nodePath_ext.cxx index 656802b8f0..081a69a814 100644 --- a/panda/src/pgraph/nodePath_ext.cxx +++ b/panda/src/pgraph/nodePath_ext.cxx @@ -172,7 +172,7 @@ __reduce_persist__(PyObject *self, PyObject *pickler) const { * node contains this tag definition. See set_python_tag(). */ NodePath Extension:: -find_net_python_tag(const string &key) const { +find_net_python_tag(PyObject *key) const { if (_this->is_empty()) { return NodePath::not_found(); } diff --git a/panda/src/pgraph/nodePath_ext.h b/panda/src/pgraph/nodePath_ext.h index 93573ed6ad..3b0b8db42a 100644 --- a/panda/src/pgraph/nodePath_ext.h +++ b/panda/src/pgraph/nodePath_ext.h @@ -35,15 +35,19 @@ public: PyObject *__reduce_persist__(PyObject *self, PyObject *pickler) const; INLINE PyObject *get_tag_keys() const; - INLINE void set_python_tag(const string &key, PyObject *value); - INLINE PyObject *get_python_tag(const string &key) const; - INLINE void get_python_tag_keys(vector_string &keys) const; + + INLINE PyObject *get_python_tags(); + INLINE void set_python_tag(PyObject *key, PyObject *value); + INLINE PyObject *get_python_tag(PyObject *key) const; INLINE PyObject *get_python_tag_keys() const; - INLINE bool has_python_tag(const string &key) const; - INLINE void clear_python_tag(const string &key); - INLINE PyObject *get_net_python_tag(const string &key) const; - INLINE bool has_net_python_tag(const string &key) const; - NodePath find_net_python_tag(const string &key) const; + INLINE bool has_python_tag(PyObject *key) const; + INLINE void clear_python_tag(PyObject *key); + INLINE PyObject *get_net_python_tag(PyObject *key) const; + INLINE bool has_net_python_tag(PyObject *key) const; + NodePath find_net_python_tag(PyObject *key) const; + + // This is defined to implement cycle detection in Python tags. + INLINE int __traverse__(visitproc visit, void *arg); PyObject *get_tight_bounds(const NodePath &other = NodePath()) const; }; diff --git a/panda/src/pgraph/occluderEffect.cxx b/panda/src/pgraph/occluderEffect.cxx index 36c874a1f2..f27c486d88 100644 --- a/panda/src/pgraph/occluderEffect.cxx +++ b/panda/src/pgraph/occluderEffect.cxx @@ -47,10 +47,6 @@ add_on_occluder(const NodePath &occluder) const { nassertr(!occluder.is_empty() && occluder.node()->is_of_type(OccluderNode::get_class_type()), this); OccluderEffect *effect = new OccluderEffect(*this); effect->_on_occluders.insert(occluder); - - pair insert_result = - effect->_on_occluders.insert(Occluders::value_type(occluder)); - return return_new(effect); } @@ -170,7 +166,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { AttribNodeRegistry *areg = AttribNodeRegistry::get_global_ptr(); if (manager->get_file_minor_ver() >= 40) { - for (int i = 0; i < _on_occluders.size(); ++i) { + for (size_t i = 0; i < _on_occluders.size(); ++i) { pi += _on_occluders[i].complete_pointers(p_list + pi, manager); int n = areg->find_node(_on_occluders[i]); diff --git a/panda/src/pgraph/pandaNode.I b/panda/src/pgraph/pandaNode.I index fa60e11b41..747f322a36 100644 --- a/panda/src/pgraph/pandaNode.I +++ b/panda/src/pgraph/pandaNode.I @@ -380,7 +380,10 @@ has_tags() const { return true; } #ifdef HAVE_PYTHON - if (!cdata->_python_tag_data.empty()) { + // This is a bit awkward, since it doesn't catch cases where the Python tags + // are cleared. Maybe we should make this behavior deprecated, so that + // has_tags will not consider the Python tags. + if (!_python_tag_data.is_null()) { return true; } #endif // HAVE_PYTHON diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 38a1c5f096..f74f7fc24d 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -27,7 +27,6 @@ #include "config_mathutil.h" #include "lightReMutexHolder.h" #include "graphicsStateGuardianBase.h" -#include "py_panda.h" // This category is just temporary for debugging convenience. NotifyCategoryDecl(drawmask, EXPCL_PANDA_PGRAPH, EXPTP_PANDA_PGRAPH); @@ -131,7 +130,8 @@ PandaNode(const PandaNode ©) : TypedWritableReferenceCount(copy), Namable(copy), _paths_lock("PandaNode::_paths_lock"), - _dirty_prev_transform(false) + _dirty_prev_transform(false), + _python_tag_data(copy._python_tag_data) { if (pgraph_cat.is_debug()) { pgraph_cat.debug() @@ -172,12 +172,6 @@ PandaNode(const PandaNode ©) : ++cdata->_internal_bounds_mark; cdata->_final_bounds = copy_cdata->_final_bounds; cdata->_fancy_bits = copy_cdata->_fancy_bits; - -#ifdef HAVE_PYTHON - // Copy and increment all of the Python objects held by the other node. - cdata->_python_tag_data = copy_cdata->_python_tag_data; - cdata->inc_py_refs(); -#endif // HAVE_PYTHON } } @@ -1270,32 +1264,13 @@ copy_tags(PandaNode *other) { cdataw->_tag_data[(*ti).first] = (*ti).second; } cdataw->set_fancy_bit(FB_tag, !cdataw->_tag_data.empty()); - -#ifdef HAVE_PYTHON - PythonTagData::const_iterator pti; - for (pti = cdatar->_python_tag_data.begin(); - pti != cdatar->_python_tag_data.end(); - ++pti) { - const string &key = (*pti).first; - PyObject *value = (*pti).second; - Py_XINCREF(value); - - pair result; - result = cdataw->_python_tag_data.insert(PythonTagData::value_type(key, value)); - - if (!result.second) { - // The insert was unsuccessful; that means the key was already present - // in the map. In this case, we should decrement the original value's - // reference count and replace it with the new object. - PythonTagData::iterator wpti = result.first; - PyObject *old_value = (*wpti).second; - Py_XDECREF(old_value); - (*wpti).second = value; - } - } -#endif // HAVE_PYTHON } CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler); + + // It's okay to copy the tags by pointer, because get_python_tags does a + // copy-on-write. + _python_tag_data = other->_python_tag_data; + mark_bam_modified(); } @@ -1321,20 +1296,9 @@ list_tags(ostream &out, const string &separator) const { } } -#ifdef HAVE_PYTHON - if (!cdata->_python_tag_data.empty()) { - if (!cdata->_tag_data.empty()) { - out << separator; - } - PythonTagData::const_iterator ti = cdata->_python_tag_data.begin(); - out << (*ti).first; - ++ti; - while (ti != cdata->_python_tag_data.end()) { - out << separator << (*ti).first; - ++ti; - } - } -#endif // HAVE_PYTHON + // We used to list the Python tags here. That's a bit awkward, though, + // since that means calling up into Python code to print the keys. If + // someone finds it useful, we can implement it in an extension method. } /** @@ -1393,50 +1357,11 @@ compare_tags(const PandaNode *other) const { return -1; } -#ifdef HAVE_PYTHON - PythonTagData::const_iterator api = cdata->_python_tag_data.begin(); - PythonTagData::const_iterator bpi = cdata_other->_python_tag_data.begin(); - while (api != cdata->_python_tag_data.end() && - bpi != cdata_other->_python_tag_data.end()) { - int cmp = strcmp((*api).first.c_str(), (*bpi).first.c_str()); - if (cmp != 0) { - return cmp; - } - -#if PY_MAJOR_VERSION >= 3 - if (PyObject_RichCompareBool((*api).second, (*bpi).second, Py_LT) == 1) { - return -1; - } else if (PyObject_RichCompareBool((*api).second, (*bpi).second, Py_GT) == 1) { - return 1; - } else if (PyObject_RichCompareBool((*api).second, (*bpi).second, Py_EQ) == 1) { - cmp = 0; - } else { -#else - if (PyObject_Cmp((*api).second, (*bpi).second, &cmp) == -1) { -#endif - // Unable to compare objects; just compare pointers. - if ((*api).second != (*bpi).second) { - cmp = (*api).second < (*bpi).second ? -1 : 1; - } else { - cmp = 0; - } - } - if (cmp != 0) { - return cmp; - } - - ++api; - ++bpi; + // We compare these by pointer, since it's problematic to call up into + // Python from arbitrary C++ code. + if (_python_tag_data != other->_python_tag_data) { + return (_python_tag_data < other->_python_tag_data) ? -1 : 1; } - if (api != cdata->_python_tag_data.end()) { - // list A is longer. - return 1; - } - if (bpi != cdata_other->_python_tag_data.end()) { - // list B is longer. - return -1; - } -#endif // HAVE_PYTHON return 0; } @@ -1494,30 +1419,6 @@ copy_all_properties(PandaNode *other) { cdataw->_tag_data[(*ti).first] = (*ti).second; } -#ifdef HAVE_PYTHON - PythonTagData::const_iterator pti; - for (pti = cdatar->_python_tag_data.begin(); - pti != cdatar->_python_tag_data.end(); - ++pti) { - const string &key = (*pti).first; - PyObject *value = (*pti).second; - Py_XINCREF(value); - - pair result; - result = cdataw->_python_tag_data.insert(PythonTagData::value_type(key, value)); - - if (!result.second) { - // The insert was unsuccessful; that means the key was already present - // in the map. In this case, we should decrement the original value's - // reference count and replace it with the new object. - PythonTagData::iterator wpti = result.first; - PyObject *old_value = (*wpti).second; - Py_XDECREF(old_value); - (*wpti).second = value; - } - } -#endif // HAVE_PYTHON - static const int change_bits = (FB_transform | FB_state | FB_effects | FB_tag | FB_draw_mask); cdataw->_fancy_bits = @@ -1532,6 +1433,10 @@ copy_all_properties(PandaNode *other) { } CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler); + // It's okay to copy the tags by pointer, because get_python_tags does a + // copy-on-write. + _python_tag_data = other->_python_tag_data; + if (any_transform_changed || any_state_changed || any_draw_mask_changed) { mark_bounds_stale(current_thread); @@ -1597,7 +1502,7 @@ replace_node(PandaNode *other) { // Switch the parents. Thread *current_thread = Thread::get_current_thread(); Parents other_parents = other->get_parents(); - for (int i = 0; i < other_parents.get_num_parents(); ++i) { + for (size_t i = 0; i < other_parents.get_num_parents(); ++i) { PandaNode *parent = other_parents.get_parent(i); if (find_parent(parent) != -1) { // This node was already a child of this parent; don't change it. @@ -1902,7 +1807,7 @@ is_under_scene_root() const { } Parents parents = get_parents(); - for (int i = 0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); if (parent->find_stashed((PandaNode *)this) == -1) { if (parent->is_under_scene_root()) { @@ -2401,7 +2306,7 @@ void PandaNode:: r_mark_geom_bounds_stale(Thread *current_thread) { Children children = get_children(current_thread); - int i; + size_t i; for (i = 0; i < children.get_num_children(); i++) { PandaNode *child = children.get_child(i); child->r_mark_geom_bounds_stale(current_thread); @@ -2550,7 +2455,7 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, Children children = get_children(current_thread); // We must call get_num_children() each time through the loop, in case we're // running SIMPLE_THREADS and we get interrupted. - int i; + size_t i; for (i = 0; i < children.get_num_children(); i++) { PandaNode *child = children.get_child(i); CPT(RenderState) child_state = node_state->compose(child->get_state()); @@ -2760,7 +2665,7 @@ find_node_above(PandaNode *node) { } Parents parents = get_parents(); - for (int i = 0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); if (parent->find_node_above(node)) { return true; @@ -3810,7 +3715,6 @@ CData(const PandaNode::CData ©) : _effects(copy._effects), _tag_data(copy._tag_data), - // _python_tag_data appears below. _draw_control_mask(copy._draw_control_mask), _draw_show_mask(copy._draw_show_mask), _into_collide_mask(copy._into_collide_mask), @@ -3836,12 +3740,6 @@ CData(const PandaNode::CData ©) : // Note that this copy constructor is not used by the PandaNode copy // constructor! Any elements that must be copied between nodes should also // be explicitly copied there. - -#ifdef HAVE_PYTHON - // Copy and increment all of the Python objects held by the other node. - _python_tag_data = copy._python_tag_data; - inc_py_refs(); -#endif // HAVE_PYTHON } /** @@ -3849,10 +3747,6 @@ CData(const PandaNode::CData ©) : */ PandaNode::CData:: ~CData() { -#ifdef HAVE_PYTHON - // Free all of the Python objects held by this node. - dec_py_refs(); -#endif // HAVE_PYTHON } /** @@ -4029,62 +3923,6 @@ fillin(DatagramIterator &scan, BamReader *manager) { fillin_down_list(*modify_stashed(), "stashed", scan, manager); } -#ifdef HAVE_PYTHON -/** - * Increments the reference counts on all held Python objects. - */ -void PandaNode::CData:: -inc_py_refs() { - if (!_python_tag_data.empty()) { -#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) - // This might happen at any time, so be sure the Python state is ready for - // it. - PyGILState_STATE gstate; - gstate = PyGILState_Ensure(); -#endif - PythonTagData::const_iterator ti; - for (ti = _python_tag_data.begin(); - ti != _python_tag_data.end(); - ++ti) { - PyObject *value = (*ti).second; - Py_XINCREF(value); - } -#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) - PyGILState_Release(gstate); -#endif - } -} -#endif // HAVE_PYTHON - -#ifdef HAVE_PYTHON -/** - * Decrements the reference counts on all held Python objects. - */ -void PandaNode::CData:: -dec_py_refs() { - if (!_python_tag_data.empty()) { -#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) - // This might happen at any time, so be sure the Python state is ready for - // it. - PyGILState_STATE gstate; - gstate = PyGILState_Ensure(); -#endif - - PythonTagData::const_iterator ti; - for (ti = _python_tag_data.begin(); - ti != _python_tag_data.end(); - ++ti) { - PyObject *value = (*ti).second; - Py_XDECREF(value); - } - -#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) - PyGILState_Release(gstate); -#endif - } -} -#endif // HAVE_PYTHON - /** * Writes the indicated list of parent node pointers to the datagram. */ diff --git a/panda/src/pgraph/pandaNode.h b/panda/src/pgraph/pandaNode.h index 05bbcaadba..0bbc984117 100644 --- a/panda/src/pgraph/pandaNode.h +++ b/panda/src/pgraph/pandaNode.h @@ -200,12 +200,15 @@ PUBLISHED: EXTENSION(PyObject *get_tag_keys() const); - EXTENSION(void set_python_tag(const string &key, PyObject *value)); - EXTENSION(PyObject *get_python_tag(const string &key) const); - EXTENSION(bool has_python_tag(const string &key) const); - EXTENSION(void clear_python_tag(const string &key)); - EXTENSION(void get_python_tag_keys(vector_string &keys) const); + EXTENSION(PyObject *get_python_tags()); + EXTENSION(void set_python_tag(PyObject *key, PyObject *value)); + EXTENSION(PyObject *get_python_tag(PyObject *key) const); + EXTENSION(bool has_python_tag(PyObject *key) const); + EXTENSION(void clear_python_tag(PyObject *key)); EXTENSION(PyObject *get_python_tag_keys() const); + MAKE_PROPERTY(python_tags, get_python_tags); + + EXTENSION(int __traverse__(visitproc visit, void *arg)); INLINE bool has_tags() const; void copy_tags(PandaNode *other); @@ -507,9 +510,16 @@ private: // This is used to maintain a table of keyed data on each node, for the // user's purposes. typedef phash_map TagData; -#ifdef HAVE_PYTHON - typedef phash_map PythonTagData; -#endif // HAVE_PYTHON + + // This is actually implemented in pandaNode_ext.h, but defined here so + // that we can destruct it from the C++ side. Note that it isn't cycled, + // because I imagine it's rare to see a Python thread on a stage other than + // stage 0, and let's not make things unnecessarily complicated. + class PythonTagData : public ReferenceCount { + public: + virtual ~PythonTagData() {}; + }; + PT(PythonTagData) _python_tag_data; #ifndef NDEBUG unsigned int _unexpected_change_flags; @@ -555,9 +565,6 @@ private: CPT(RenderEffects) _effects; TagData _tag_data; -#ifdef HAVE_PYTHON - PythonTagData _python_tag_data; -#endif // HAVE_PYTHON // These two together determine the per-camera visibility of this node. // See adjust_draw_mask() for details. diff --git a/panda/src/pgraph/pandaNode_ext.cxx b/panda/src/pgraph/pandaNode_ext.cxx index 9395a56e3b..aa24e623ee 100644 --- a/panda/src/pgraph/pandaNode_ext.cxx +++ b/panda/src/pgraph/pandaNode_ext.cxx @@ -71,116 +71,7 @@ __deepcopy__(PyObject *self, PyObject *memo) const { } /** - * Associates an arbitrary Python object with a user-defined key which is - * stored on the node. This is similar to set_tag(), except it can store any - * Python object instead of just a string. However, the Python object is not - * recorded to a bam file. - * - * Each unique key stores a different string value. There is no effective - * limit on the number of different keys that may be stored or on the length - * of any one key's value. - */ -void Extension:: -set_python_tag(const string &key, PyObject *value) { - Thread *current_thread = Thread::get_current_thread(); - int pipeline_stage = current_thread->get_pipeline_stage(); - nassertv(pipeline_stage == 0); - - PandaNode::CDWriter cdata(_this->_cycler); - Py_XINCREF(value); - - pair result; - result = cdata->_python_tag_data.insert(PandaNode::PythonTagData::value_type(key, value)); - - if (!result.second) { - // The insert was unsuccessful; that means the key was already present in - // the map. In this case, we should decrement the original value's - // reference count and replace it with the new object. - PandaNode::PythonTagData::iterator ti = result.first; - PyObject *old_value = (*ti).second; - Py_XDECREF(old_value); - (*ti).second = value; - } - - // Even though the python tag isn't recorded in the bam stream? - _this->mark_bam_modified(); -} - -/** - * Retrieves the Python object that was previously set on this node for the - * particular key, if any. If no value has been previously set, returns None. - */ -PyObject *Extension:: -get_python_tag(const string &key) const { - PandaNode::CDReader cdata(_this->_cycler); - PandaNode::PythonTagData::const_iterator ti; - ti = cdata->_python_tag_data.find(key); - if (ti != cdata->_python_tag_data.end()) { - PyObject *result = (*ti).second; - Py_XINCREF(result); - return result; - } - Py_INCREF(Py_None); - return Py_None; -} - -/** - * Returns true if a Python object has been defined on this node for the - * particular key (even if that object is None), or false if no object has - * been set. - */ -bool Extension:: -has_python_tag(const string &key) const { - PandaNode::CDReader cdata(_this->_cycler); - PandaNode::PythonTagData::const_iterator ti; - ti = cdata->_python_tag_data.find(key); - return (ti != cdata->_python_tag_data.end()); -} - -/** - * Removes the Python object defined for this key on this particular node. - * After a call to clear_python_tag(), has_python_tag() will return false for - * the indicated key. - */ -void Extension:: -clear_python_tag(const string &key) { - Thread *current_thread = Thread::get_current_thread(); - int pipeline_stage = current_thread->get_pipeline_stage(); - nassertv(pipeline_stage == 0); - - PandaNode::CDWriter cdata(_this->_cycler, current_thread); - PandaNode::PythonTagData::iterator ti; - ti = cdata->_python_tag_data.find(key); - if (ti != cdata->_python_tag_data.end()) { - PyObject *value = (*ti).second; - Py_XDECREF(value); - cdata->_python_tag_data.erase(ti); - } - - // Even though the python tag isn't recorded in the bam stream? - _this->mark_bam_modified(); -} - -/** - * Fills the given vector up with the list of Python tags on this PandaNode. - * - * It is the user's responsibility to ensure that the keys vector is empty - * before making this call; otherwise, the new files will be appended to it. - */ -void Extension:: -get_python_tag_keys(vector_string &keys) const { - PandaNode::CDReader cdata(_this->_cycler); - if (!cdata->_python_tag_data.empty()) { - PandaNode::PythonTagData::const_iterator ti = cdata->_python_tag_data.begin(); - while (ti != cdata->_python_tag_data.end()) { - keys.push_back((*ti).first); - ++ti; - } - } -} - -/** - * This variant on get_tag_keys returns a Python list of strings. + * This variant on get_tag_keys returns a Python tuple of strings keys. */ PyObject *Extension:: get_tag_keys() const { @@ -195,20 +86,138 @@ get_tag_keys() const { return result; } +/** + * Returns a dictionary of Python tags that is associated with the current + * node. This is similar to the regular tags, except this can store any + * Python object instead of just a string. However, the Python object is not + * recorded to a bam file. + */ +PyObject *Extension:: +get_python_tags() { + if (_this->_python_tag_data == NULL) { + _this->_python_tag_data = new PythonTagDataImpl; + + } else if (_this->_python_tag_data->get_ref_count() > 1) { + // Copy-on-write. + _this->_python_tag_data = new PythonTagDataImpl(*(PythonTagDataImpl *)_this->_python_tag_data.p()); + } + return ((PythonTagDataImpl *)_this->_python_tag_data.p())->_dict; +} + +/** + * Associates an arbitrary Python object with a user-defined key which is + * stored on the node. This is similar to set_tag(), except it can store any + * Python object instead of just a string. However, the Python object is not + * recorded to a bam file. + * + * Each unique key stores a different string value. There is no effective + * limit on the number of different keys that may be stored or on the length + * of any one key's value. + */ +int Extension:: +set_python_tag(PyObject *key, PyObject *value) { + return PyDict_SetItem(get_python_tags(), key, value); +} + +/** + * Retrieves the Python object that was previously set on this node for the + * particular key, if any. If no value has been previously set, returns None. + */ +PyObject *Extension:: +get_python_tag(PyObject *key) const { + if (_this->_python_tag_data == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + + PyObject *dict = ((PythonTagDataImpl *)_this->_python_tag_data.p())->_dict; + PyObject *value = PyDict_GetItem(dict, key); + if (value == NULL) { + value = Py_None; + } + // PyDict_GetItem returns a borrowed reference. + Py_INCREF(value); + return value; +} + +/** + * Returns true if a Python object has been defined on this node for the + * particular key (even if that object is None), or false if no object has + * been set. + */ +bool Extension:: +has_python_tag(PyObject *key) const { + if (_this->_python_tag_data == NULL) { + return false; + } + + PyObject *dict = ((PythonTagDataImpl *)_this->_python_tag_data.p())->_dict; + return (PyDict_GetItem(dict, key) != NULL); +} + +/** + * Removes the Python object defined for this key on this particular node. + * After a call to clear_python_tag(), has_python_tag() will return false for + * the indicated key. + */ +void Extension:: +clear_python_tag(PyObject *key) { + if (_this->_python_tag_data == NULL) { + return; + } + + PyObject *dict = get_python_tags(); + if (PyDict_GetItem(dict, key) != NULL) { + PyDict_DelItem(dict, key); + } +} + /** * This variant on get_python_tag_keys returns a Python list of strings. */ PyObject *Extension:: get_python_tag_keys() const { - vector_string keys; - get_python_tag_keys(keys); - - PyObject *result = PyTuple_New(keys.size()); - for (size_t i = 0; i < keys.size(); ++i) { - PyTuple_SET_ITEM(result, i, Dtool_WrapValue(keys[i])); + if (_this->_python_tag_data == NULL) { + return PyTuple_New(0); } - return result; + PyObject *dict = ((PythonTagDataImpl *)_this->_python_tag_data.p())->_dict; + return PyDict_Keys(dict); +} + +/** + * Called by Python to implement cycle detection. + */ +int Extension:: +__traverse__(visitproc visit, void *arg) { + // To fully implement cycle breaking, we also have to recurse into all of + // the node's children. However, this seems like it would be potentially + // quite expensive, so I'd rather not do it unless we had some optimization + // that would allow us to quickly find out whether there are children with + // Python tags. + if (_this->_python_tag_data != NULL) { + Py_VISIT(((PythonTagDataImpl *)_this->_python_tag_data.p())->_dict); + } + return 0; +} + +/** + * Destroys the tags associated with the node. + */ +Extension::PythonTagDataImpl:: +~PythonTagDataImpl() { +#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) + // This might happen at any time, so be sure the Python state is ready for + // it. + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); +#endif + + Py_CLEAR(_dict); + +#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) + PyGILState_Release(gstate); +#endif } #endif // HAVE_PYTHON diff --git a/panda/src/pgraph/pandaNode_ext.h b/panda/src/pgraph/pandaNode_ext.h index f4be38279e..86527d42d4 100644 --- a/panda/src/pgraph/pandaNode_ext.h +++ b/panda/src/pgraph/pandaNode_ext.h @@ -34,12 +34,26 @@ public: PyObject *get_tag_keys() const; - void set_python_tag(const string &key, PyObject *value); - PyObject *get_python_tag(const string &key) const; - bool has_python_tag(const string &key) const; - void clear_python_tag(const string &key); - void get_python_tag_keys(vector_string &keys) const; + PyObject *get_python_tags(); + int set_python_tag(PyObject *keys, PyObject *value); + PyObject *get_python_tag(PyObject *keys) const; + bool has_python_tag(PyObject *keys) const; + void clear_python_tag(PyObject *keys); PyObject *get_python_tag_keys() const; + + // This is defined to implement cycle detection in Python tags. + int __traverse__(visitproc visit, void *arg); + +private: + // This is what actually stores the Python tags. + class PythonTagDataImpl : public PandaNode::PythonTagData { + public: + PythonTagDataImpl() : _dict(PyDict_New()) {}; + PythonTagDataImpl(const PythonTagDataImpl ©) : _dict(PyDict_Copy(copy._dict)) {}; + virtual ~PythonTagDataImpl(); + + PyObject *_dict; + }; }; #endif // HAVE_PYTHON diff --git a/panda/src/pgraph/renderModeAttrib.I b/panda/src/pgraph/renderModeAttrib.I index 5c42e42f53..8034b5cbc3 100644 --- a/panda/src/pgraph/renderModeAttrib.I +++ b/panda/src/pgraph/renderModeAttrib.I @@ -71,8 +71,12 @@ get_wireframe_color() const { INLINE int RenderModeAttrib:: get_geom_rendering(int geom_rendering) const { if (_mode == M_point) { - geom_rendering |= Geom::GR_point; + geom_rendering |= Geom::GR_point | Geom::GR_render_mode_point; + + } else if (_mode == M_wireframe) { + geom_rendering |= Geom::GR_render_mode_wireframe; } + if ((geom_rendering & Geom::GR_point) != 0) { if (_perspective) { geom_rendering |= (Geom::GR_point_perspective | Geom::GR_point_uniform_size); diff --git a/panda/src/pgraph/shaderInput.cxx b/panda/src/pgraph/shaderInput.cxx index 6ba5499490..3ee38ef70a 100644 --- a/panda/src/pgraph/shaderInput.cxx +++ b/panda/src/pgraph/shaderInput.cxx @@ -100,9 +100,15 @@ get_texture() const { */ const SamplerState &ShaderInput:: get_sampler() const { - return (_type == M_texture_sampler) - ? DCAST(ParamTextureSampler, _value)->get_sampler() - : get_texture()->get_default_sampler(); + if (_type == M_texture_sampler) { + return DCAST(ParamTextureSampler, _value)->get_sampler(); + + } else if (!_value.is_null()) { + return get_texture()->get_default_sampler(); + + } else { + return SamplerState::get_default(); + } } /** diff --git a/panda/src/physx/physxFileStream.h b/panda/src/physx/physxFileStream.h index a8cc858b1b..5b7682c9e0 100644 --- a/panda/src/physx/physxFileStream.h +++ b/panda/src/physx/physxFileStream.h @@ -17,6 +17,7 @@ #include "pandabase.h" #include "virtualFile.h" #include "filename.h" +#include #include "physx_includes.h" diff --git a/panda/src/pipeline/config_pipeline.cxx b/panda/src/pipeline/config_pipeline.cxx index 2dd7106dee..24b23da485 100644 --- a/panda/src/pipeline/config_pipeline.cxx +++ b/panda/src/pipeline/config_pipeline.cxx @@ -17,7 +17,6 @@ #include "externalThread.h" #include "genericThread.h" #include "thread.h" -#include "pythonThread.h" #include "pandaSystem.h" #include "dconfig.h" @@ -73,9 +72,6 @@ init_libpipeline() { ExternalThread::init_type(); GenericThread::init_type(); Thread::init_type(); -#ifdef HAVE_PYTHON - PythonThread::init_type(); -#endif // HAVE_PYTHON #ifdef HAVE_THREADS { diff --git a/panda/src/pipeline/cycleDataLockedReader.I b/panda/src/pipeline/cycleDataLockedReader.I index 05a66c6213..0ac88ebb67 100644 --- a/panda/src/pipeline/cycleDataLockedReader.I +++ b/panda/src/pipeline/cycleDataLockedReader.I @@ -61,6 +61,36 @@ operator = (const CycleDataLockedReader ©) { _cycler->increment_read(_pointer); } +#ifdef USE_MOVE_SEMANTICS +/** + * + */ +template +INLINE CycleDataLockedReader:: +CycleDataLockedReader(CycleDataLockedReader &&from) NOEXCEPT : + _cycler(from._cycler), + _current_thread(from._current_thread), + _pointer(from._pointer) +{ + from._pointer = NULL; +} + +/** + * + */ +template +INLINE void CycleDataLockedReader:: +operator = (CycleDataLockedReader &&from) NOEXCEPT { + nassertv(_pointer == (CycleDataType *)NULL); + nassertv(_current_thread == from._current_thread); + + _cycler = from._cycler; + _pointer = from._pointer; + + from._pointer = NULL; +} +#endif // USE_MOVE_SEMANTICS + /** * */ diff --git a/panda/src/pipeline/cycleDataLockedReader.h b/panda/src/pipeline/cycleDataLockedReader.h index 80deaf3dce..f66143fab4 100644 --- a/panda/src/pipeline/cycleDataLockedReader.h +++ b/panda/src/pipeline/cycleDataLockedReader.h @@ -47,6 +47,11 @@ public: INLINE CycleDataLockedReader(const CycleDataLockedReader ©); INLINE void operator = (const CycleDataLockedReader ©); +#if defined(USE_MOVE_SEMANTICS) && defined(DO_PIPELINING) + INLINE CycleDataLockedReader(CycleDataLockedReader &&from) NOEXCEPT; + INLINE void operator = (CycleDataLockedReader &&from) NOEXCEPT; +#endif + INLINE ~CycleDataLockedReader(); INLINE const CycleDataType *operator -> () const; diff --git a/panda/src/pipeline/cycleDataLockedStageReader.I b/panda/src/pipeline/cycleDataLockedStageReader.I index 521df13494..9f2c74d23a 100644 --- a/panda/src/pipeline/cycleDataLockedStageReader.I +++ b/panda/src/pipeline/cycleDataLockedStageReader.I @@ -64,6 +64,38 @@ operator = (const CycleDataLockedStageReader ©) { _cycler->increment_read(_pointer); } +#ifdef USE_MOVE_SEMANTICS +/** + * + */ +template +INLINE CycleDataLockedStageReader:: +CycleDataLockedStageReader(CycleDataLockedStageReader &&from) NOEXCEPT : + _cycler(from._cycler), + _current_thread(from._current_thread), + _pointer(from._pointer), + _stage(from._stage) +{ + from._pointer = NULL; +} + +/** + * + */ +template +INLINE void CycleDataLockedStageReader:: +operator = (CycleDataLockedStageReader &&from) NOEXCEPT { + nassertv(_pointer == (CycleDataType *)NULL); + nassertv(_current_thread == from._current_thread); + + _cycler = from._cycler; + _pointer = from._pointer; + _stage = from._stage; + + from._pointer = NULL; +} +#endif // USE_MOVE_SEMANTICS + /** * */ diff --git a/panda/src/pipeline/cycleDataLockedStageReader.h b/panda/src/pipeline/cycleDataLockedStageReader.h index 5b7e84cc19..6837a6edf4 100644 --- a/panda/src/pipeline/cycleDataLockedStageReader.h +++ b/panda/src/pipeline/cycleDataLockedStageReader.h @@ -34,6 +34,11 @@ public: INLINE CycleDataLockedStageReader(const CycleDataLockedStageReader ©); INLINE void operator = (const CycleDataLockedStageReader ©); +#if defined(USE_MOVE_SEMANTICS) && defined(DO_PIPELINING) + INLINE CycleDataLockedStageReader(CycleDataLockedStageReader &&from) NOEXCEPT; + INLINE void operator = (CycleDataLockedStageReader &&from) NOEXCEPT; +#endif + INLINE ~CycleDataLockedStageReader(); INLINE const CycleDataType *operator -> () const; diff --git a/panda/src/pipeline/cycleDataStageWriter.I b/panda/src/pipeline/cycleDataStageWriter.I index ab6c53544d..3e6d464768 100644 --- a/panda/src/pipeline/cycleDataStageWriter.I +++ b/panda/src/pipeline/cycleDataStageWriter.I @@ -114,6 +114,38 @@ CycleDataStageWriter(PipelineCycler &cycler, int stage, force_to_0, _current_thread); } +#ifdef USE_MOVE_SEMANTICS +/** + * + */ +template +INLINE CycleDataStageWriter:: +CycleDataStageWriter(CycleDataStageWriter &&from) NOEXCEPT : + _cycler(from._cycler), + _current_thread(from._current_thread), + _pointer(from._pointer), + _stage(from._stage) +{ + from._pointer = NULL; +} + +/** + * + */ +template +INLINE void CycleDataStageWriter:: +operator = (CycleDataStageWriter &&from) NOEXCEPT { + nassertv(_pointer == (CycleDataType *)NULL); + nassertv(_current_thread == from._current_thread); + + _cycler = from._cycler; + _pointer = from._pointer; + _stage = from._stage; + + from._pointer = NULL; +} +#endif // USE_MOVE_SEMANTICS + /** * */ diff --git a/panda/src/pipeline/cycleDataStageWriter.h b/panda/src/pipeline/cycleDataStageWriter.h index 967a367284..d154adb6d8 100644 --- a/panda/src/pipeline/cycleDataStageWriter.h +++ b/panda/src/pipeline/cycleDataStageWriter.h @@ -47,6 +47,11 @@ public: CycleDataLockedStageReader &take_from, bool force_to_0); +#if defined(USE_MOVE_SEMANTICS) && defined(DO_PIPELINING) + INLINE CycleDataStageWriter(CycleDataStageWriter &&from) NOEXCEPT; + INLINE void operator = (CycleDataStageWriter &&from) NOEXCEPT; +#endif + INLINE ~CycleDataStageWriter(); INLINE CycleDataType *operator -> (); diff --git a/panda/src/pipeline/cycleDataWriter.I b/panda/src/pipeline/cycleDataWriter.I index 0f0bc481eb..3706468612 100644 --- a/panda/src/pipeline/cycleDataWriter.I +++ b/panda/src/pipeline/cycleDataWriter.I @@ -122,7 +122,7 @@ template INLINE CycleDataWriter:: CycleDataWriter(PipelineCycler &cycler, CycleDataLockedReader &take_from, - bool force_to_0) : + bool force_to_0) : _cycler(&cycler), _current_thread(take_from.get_current_thread()) { @@ -130,6 +130,36 @@ CycleDataWriter(PipelineCycler &cycler, force_to_0, _current_thread); } +#ifdef USE_MOVE_SEMANTICS +/** + * + */ +template +INLINE CycleDataWriter:: +CycleDataWriter(CycleDataWriter &&from) NOEXCEPT : + _cycler(from._cycler), + _current_thread(from._current_thread), + _pointer(from._pointer) +{ + from._pointer = NULL; +} + +/** + * + */ +template +INLINE void CycleDataWriter:: +operator = (CycleDataWriter &&from) NOEXCEPT { + nassertv(_pointer == (CycleDataType *)NULL); + nassertv(_current_thread == from._current_thread); + + _cycler = from._cycler; + _pointer = from._pointer; + + from._pointer = NULL; +} +#endif // USE_MOVE_SEMANTICS + /** * */ diff --git a/panda/src/pipeline/cycleDataWriter.h b/panda/src/pipeline/cycleDataWriter.h index c62f034ca3..e2a4da7831 100644 --- a/panda/src/pipeline/cycleDataWriter.h +++ b/panda/src/pipeline/cycleDataWriter.h @@ -49,6 +49,11 @@ public: INLINE CycleDataWriter(PipelineCycler &cycler, CycleDataLockedReader &take_from); INLINE CycleDataWriter(PipelineCycler &cycler, CycleDataLockedReader &take_from, bool force_to_0); +#if defined(USE_MOVE_SEMANTICS) && defined(DO_PIPELINING) + INLINE CycleDataWriter(CycleDataWriter &&from) NOEXCEPT; + INLINE void operator = (CycleDataWriter &&from) NOEXCEPT; +#endif + INLINE ~CycleDataWriter(); INLINE CycleDataType *operator -> (); diff --git a/panda/src/pipeline/p3pipeline_composite2.cxx b/panda/src/pipeline/p3pipeline_composite2.cxx index e5ee007a77..e6607a6ebf 100644 --- a/panda/src/pipeline/p3pipeline_composite2.cxx +++ b/panda/src/pipeline/p3pipeline_composite2.cxx @@ -10,7 +10,6 @@ #include "pipelineCyclerTrueImpl.cxx" #include "pmutex.cxx" #include "psemaphore.cxx" -#include "pythonThread.cxx" #include "reMutex.cxx" #include "reMutexDirect.cxx" #include "reMutexHolder.cxx" diff --git a/panda/src/pipeline/pipelineCyclerTrueImpl.I b/panda/src/pipeline/pipelineCyclerTrueImpl.I index d2e78fca2d..2c393d0546 100644 --- a/panda/src/pipeline/pipelineCyclerTrueImpl.I +++ b/panda/src/pipeline/pipelineCyclerTrueImpl.I @@ -368,7 +368,13 @@ get_write_count() const { INLINE PT(CycleData) PipelineCyclerTrueImpl:: cycle_2() { TAU_PROFILE("PT(CycleData) PipelineCyclerTrueImpl::cycle_2()", " ", TAU_USER); - PT(CycleData) last_val = _data[1]._cdata.p(); + + // This trick moves an NPT into a PT without unnecessarily incrementing and + // subsequently decrementing the regular reference count. + PT(CycleData) last_val; + last_val.swap(_data[1]._cdata); + last_val->node_unref_only(); + nassertr(_lock.debug_is_locked(), last_val); nassertr(_dirty, last_val); nassertr(_num_stages == 2, last_val); @@ -389,7 +395,13 @@ cycle_2() { INLINE PT(CycleData) PipelineCyclerTrueImpl:: cycle_3() { TAU_PROFILE("PT(CycleData) PipelineCyclerTrueImpl::cycle_3()", " ", TAU_USER); - PT(CycleData) last_val = _data[2]._cdata.p(); + + // This trick moves an NPT into a PT without unnecessarily incrementing and + // subsequently decrementing the regular reference count. + PT(CycleData) last_val; + last_val.swap(_data[2]._cdata); + last_val->node_unref_only(); + nassertr(_lock.debug_is_locked(), last_val); nassertr(_dirty, last_val); nassertr(_num_stages == 3, last_val); diff --git a/panda/src/pipeline/pipelineCyclerTrueImpl.cxx b/panda/src/pipeline/pipelineCyclerTrueImpl.cxx index 9610a98bb9..b1466ce155 100644 --- a/panda/src/pipeline/pipelineCyclerTrueImpl.cxx +++ b/panda/src/pipeline/pipelineCyclerTrueImpl.cxx @@ -255,7 +255,12 @@ write_stage_upstream(int pipeline_stage, bool force_to_0, Thread *current_thread */ PT(CycleData) PipelineCyclerTrueImpl:: cycle() { - PT(CycleData) last_val = _data[_num_stages - 1]._cdata.p(); + // This trick moves an NPT into a PT without unnecessarily incrementing and + // subsequently decrementing the regular reference count. + PT(CycleData) last_val; + last_val.swap(_data[_num_stages - 1]._cdata); + last_val->node_unref_only(); + nassertr(_lock.debug_is_locked(), last_val); nassertr(_dirty, last_val); diff --git a/panda/src/pipeline/pythonThread.cxx b/panda/src/pipeline/pythonThread.cxx index 5800368b77..976e13aa57 100644 --- a/panda/src/pipeline/pythonThread.cxx +++ b/panda/src/pipeline/pythonThread.cxx @@ -36,18 +36,7 @@ PythonThread(PyObject *function, PyObject *args, nassert_raise("Invalid function passed to PythonThread constructor"); } - if (args == Py_None) { - // None means no arguments; create an empty tuple. - _args = PyTuple_New(0); - } else { - _args = NULL; - if (PySequence_Check(args)) { - _args = PySequence_Tuple(args); - } - if (_args == NULL) { - nassert_raise("Invalid args passed to PythonThread constructor"); - } - } + set_args(args); } /** @@ -73,13 +62,198 @@ join() { if (_result == NULL) { // No result; return None. - return Py_BuildValue(""); + Py_INCREF(Py_None); + return Py_None; } Py_INCREF(_result); return _result; } +/** + * + */ +PyObject *PythonThread:: +get_args() const { + return _args; +} + +/** + * + */ +void PythonThread:: +set_args(PyObject *args) { + Py_XDECREF(_args); + + if (args == Py_None) { + // None means no arguments; create an empty tuple. + _args = PyTuple_New(0); + } else { + _args = NULL; + if (PySequence_Check(args)) { + _args = PySequence_Tuple(args); + } + if (_args == NULL) { + Dtool_Raise_TypeError("PythonThread args must be a tuple"); + } + } +} + +#ifdef HAVE_PYTHON +/** + * Internal function to safely call a Python function within a sub-thread, + * that might execute in parallel with existing Python code. The return value + * is the return value of the Python function, or NULL if there was an + * exception. + */ +PyObject *PythonThread:: +call_python_func(PyObject *function, PyObject *args) { + Thread *current_thread = get_current_thread(); + + // Create a new Python thread state data structure, so Python can properly + // lock itself. + PyObject *result = NULL; + + if (current_thread == get_main_thread()) { + // In the main thread, just call the function. + result = PyObject_Call(function, args, NULL); + + if (result == (PyObject *)NULL) { + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { + // If we caught SystemExit, let it pass by without bothering to print + // a callback. + + } else { + // Temporarily save and restore the exception state so we can print a + // callback on-the-spot. + PyObject *exc, *val, *tb; + PyErr_Fetch(&exc, &val, &tb); + + Py_XINCREF(exc); + Py_XINCREF(val); + Py_XINCREF(tb); + PyErr_Restore(exc, val, tb); + PyErr_Print(); + + PyErr_Restore(exc, val, tb); + } + } + + } else { +#ifndef HAVE_THREADS + // Shouldn't be possible to come here without having some kind of + // threading support enabled. + nassertr(false, NULL); +#else + +#ifdef SIMPLE_THREADS + // We can't use the PyGILState interface, which assumes we are using true + // OS-level threading. PyGILState enforces policies like only one thread + // state per OS-level thread, which is not true in the case of + // SIMPLE_THREADS. + + // For some reason I don't fully understand, I'm getting a crash when I + // clean up old PyThreadState objects with PyThreadState_Delete(). It + // appears that the thread state is still referenced somewhere at the time + // I call delete, and the crash occurs because I've deleted an active + // pointer. + + // Storing these pointers in a vector for permanent recycling seems to + // avoid this problem. I wish I understood better what's going wrong, but + // I guess this workaround will do. + static pvector thread_states; + + PyThreadState *orig_thread_state = PyThreadState_Get(); + PyInterpreterState *istate = orig_thread_state->interp; + PyThreadState *new_thread_state; + if (thread_states.empty()) { + new_thread_state = PyThreadState_New(istate); + } else { + new_thread_state = thread_states.back(); + thread_states.pop_back(); + } + PyThreadState_Swap(new_thread_state); + + // Call the user's function. + result = PyObject_Call(function, args, NULL); + if (result == (PyObject *)NULL && PyErr_Occurred()) { + // We got an exception. Move the exception from the current thread into + // the main thread, so it can be handled there. + PyObject *exc, *val, *tb; + PyErr_Fetch(&exc, &val, &tb); + + thread_cat.error() + << "Exception occurred within " << *current_thread << "\n"; + + // Temporarily restore the exception state so we can print a callback + // on-the-spot. + Py_XINCREF(exc); + Py_XINCREF(val); + Py_XINCREF(tb); + PyErr_Restore(exc, val, tb); + PyErr_Print(); + + PyThreadState_Swap(orig_thread_state); + thread_states.push_back(new_thread_state); + // PyThreadState_Clear(new_thread_state); + // PyThreadState_Delete(new_thread_state); + + PyErr_Restore(exc, val, tb); + + // Now attempt to force the main thread to the head of the ready queue, + // so it can respond to the exception immediately. This only works if + // the main thread is not blocked, of course. + Thread::get_main_thread()->preempt(); + + } else { + // No exception. Restore the thread state normally. + PyThreadState *state = PyThreadState_Swap(orig_thread_state); + thread_states.push_back(new_thread_state); + // PyThreadState_Clear(new_thread_state); + // PyThreadState_Delete(new_thread_state); + } + +#else // SIMPLE_THREADS + // With true threading enabled, we're better off using PyGILState. + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + // Call the user's function. + result = PyObject_Call(function, args, NULL); + if (result == (PyObject *)NULL && PyErr_Occurred()) { + // We got an exception. Move the exception from the current thread into + // the main thread, so it can be handled there. + PyObject *exc, *val, *tb; + PyErr_Fetch(&exc, &val, &tb); + + thread_cat.error() + << "Exception occurred within " << *current_thread << "\n"; + + // Temporarily restore the exception state so we can print a callback + // on-the-spot. + Py_XINCREF(exc); + Py_XINCREF(val); + Py_XINCREF(tb); + PyErr_Restore(exc, val, tb); + PyErr_Print(); + + PyGILState_Release(gstate); + + PyErr_Restore(exc, val, tb); + } else { + // No exception. Restore the thread state normally. + PyGILState_Release(gstate); + } + + +#endif // SIMPLE_THREADS +#endif // HAVE_THREADS + } + + return result; +} +#endif // HAVE_PYTHON + /** * */ diff --git a/panda/src/pipeline/pythonThread.h b/panda/src/pipeline/pythonThread.h index f5b015deae..ea3adc2ac2 100644 --- a/panda/src/pipeline/pythonThread.h +++ b/panda/src/pipeline/pythonThread.h @@ -24,7 +24,7 @@ * the Python level. It will spawn a thread that executes an arbitrary Python * functor. */ -class EXPCL_PANDA_PIPELINE PythonThread : public Thread { +class PythonThread : public Thread { PUBLISHED: PythonThread(PyObject *function, PyObject *args, const string &name, const string &sync_name); @@ -32,6 +32,15 @@ PUBLISHED: BLOCKING PyObject *join(); +public: + PyObject *get_args() const; + void set_args(PyObject *); + + static PyObject *call_python_func(PyObject *function, PyObject *args); + +PUBLISHED: + MAKE_PROPERTY(args, get_args, set_args); + protected: virtual void thread_main(); diff --git a/panda/src/pipeline/thread.I b/panda/src/pipeline/thread.I index 159f764d6d..b721486c72 100644 --- a/panda/src/pipeline/thread.I +++ b/panda/src/pipeline/thread.I @@ -48,6 +48,16 @@ get_pstats_index() const { return _pstats_index; } +/** + * Returns the Python index associated with this thread, or -1 if no index has + * yet been associated with this thread. This is used internally by the + * direct.stdpy.thread module; you should not need to call this directly. + */ +INLINE int Thread:: +get_python_index() const { + return _python_index; +} + /** * Returns a string that is guaranteed to be unique to this thread, across all * processes on the machine, during at least the lifetime of this process. @@ -263,6 +273,15 @@ get_current_task() const { return _current_task; } +/** + * Stores a Python index to be associated with this thread. This is used + * internally by the thread module; you should not need to call this directly. + */ +INLINE void Thread:: +set_python_index(int python_index) { + _python_index = python_index; +} + /** * Should be called by the main thread just before exiting the program, this * blocks until any remaining thread cleanup has finished. diff --git a/panda/src/pipeline/thread.cxx b/panda/src/pipeline/thread.cxx index db22ee5803..6a0f0278fc 100644 --- a/panda/src/pipeline/thread.cxx +++ b/panda/src/pipeline/thread.cxx @@ -19,10 +19,6 @@ #include "conditionVarDebug.h" #include "conditionVarFullDebug.h" -#ifdef HAVE_PYTHON -#include "py_panda.h" -#endif - Thread *Thread::_main_thread; Thread *Thread::_external_thread; TypeHandle Thread::_type_handle; @@ -47,33 +43,17 @@ Thread(const string &name, const string &sync_name) : { _started = false; _pstats_index = -1; + _python_index = -1; _pstats_callback = NULL; _pipeline_stage = 0; _joinable = false; _current_task = NULL; -#ifdef HAVE_PYTHON - _python_data = Py_None; - Py_INCREF(_python_data); -#endif - #ifdef DEBUG_THREADS _blocked_on_mutex = NULL; _waiting_on_cvar = NULL; _waiting_on_cvar_full = NULL; #endif - -#if defined(HAVE_PYTHON) && !defined(SIMPLE_THREADS) - // Ensure that the Python threading system is initialized and ready to go. -#ifdef WITH_THREAD // This symbol defined within Python.h - -#if PY_VERSION_HEX >= 0x03020000 - Py_Initialize(); -#endif - - PyEval_InitThreads(); -#endif -#endif } /** @@ -81,10 +61,6 @@ Thread(const string &name, const string &sync_name) : */ Thread:: ~Thread() { -#ifdef HAVE_PYTHON - Py_DECREF(_python_data); -#endif - #ifdef DEBUG_THREADS nassertv(_blocked_on_mutex == NULL && _waiting_on_cvar == NULL && @@ -225,242 +201,6 @@ start(ThreadPriority priority, bool joinable) { return _started; } -#ifdef HAVE_PYTHON -/** - * Sets an arbitrary Python object that may be associated with this thread - * object. This is just for the purposes of associated arbitrary Python data - * with the C++ object; other than managing the reference count, the C++ code - * does nothing with this object. - */ -void Thread:: -set_python_data(PyObject *python_data) { - Py_DECREF(_python_data); - _python_data = python_data; - Py_INCREF(_python_data); -} -#endif // HAVE_PYTHON - -#ifdef HAVE_PYTHON -/** - * Returns the Python object that was set with set_python_data(). - */ -PyObject *Thread:: -get_python_data() const { - Py_INCREF(_python_data); - return _python_data; -} -#endif // HAVE_PYTHON - -#ifdef HAVE_PYTHON -/** - * Internal function to safely call a Python function within a sub-thread, - * that might execute in parallel with existing Python code. The return value - * is the return value of the Python function, or NULL if there was an - * exception. - */ -PyObject *Thread:: -call_python_func(PyObject *function, PyObject *args) { - nassertr(this == get_current_thread(), NULL); - - // Create a new Python thread state data structure, so Python can properly - // lock itself. - PyObject *result = NULL; - - if (this == get_main_thread()) { - // In the main thread, just call the function. - result = PyObject_Call(function, args, NULL); - - if (result == (PyObject *)NULL) { - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { - // If we caught SystemExit, let it pass by without bothering to print - // a callback. - - } else { - // Temporarily save and restore the exception state so we can print a - // callback on-the-spot. - PyObject *exc, *val, *tb; - PyErr_Fetch(&exc, &val, &tb); - - Py_XINCREF(exc); - Py_XINCREF(val); - Py_XINCREF(tb); - PyErr_Restore(exc, val, tb); - PyErr_Print(); - - PyErr_Restore(exc, val, tb); - } - } - - } else { -#ifndef HAVE_THREADS - // Shouldn't be possible to come here without having some kind of - // threading support enabled. - nassertr(false, NULL); -#else - -#ifdef SIMPLE_THREADS - // We can't use the PyGILState interface, which assumes we are using true - // OS-level threading. PyGILState enforces policies like only one thread - // state per OS-level thread, which is not true in the case of - // SIMPLE_THREADS. - - // For some reason I don't fully understand, I'm getting a crash when I - // clean up old PyThreadState objects with PyThreadState_Delete(). It - // appears that the thread state is still referenced somewhere at the time - // I call delete, and the crash occurs because I've deleted an active - // pointer. - - // Storing these pointers in a vector for permanent recycling seems to - // avoid this problem. I wish I understood better what's going wrong, but - // I guess this workaround will do. - static pvector thread_states; - - PyThreadState *orig_thread_state = PyThreadState_Get(); - PyInterpreterState *istate = orig_thread_state->interp; - PyThreadState *new_thread_state; - if (thread_states.empty()) { - new_thread_state = PyThreadState_New(istate); - } else { - new_thread_state = thread_states.back(); - thread_states.pop_back(); - } - PyThreadState_Swap(new_thread_state); - - // Call the user's function. - result = PyObject_Call(function, args, NULL); - if (result == (PyObject *)NULL && PyErr_Occurred()) { - // We got an exception. Move the exception from the current thread into - // the main thread, so it can be handled there. - PyObject *exc, *val, *tb; - PyErr_Fetch(&exc, &val, &tb); - - thread_cat.error() - << "Exception occurred within " << *this << "\n"; - - // Temporarily restore the exception state so we can print a callback - // on-the-spot. - Py_XINCREF(exc); - Py_XINCREF(val); - Py_XINCREF(tb); - PyErr_Restore(exc, val, tb); - PyErr_Print(); - - PyThreadState_Swap(orig_thread_state); - thread_states.push_back(new_thread_state); - // PyThreadState_Clear(new_thread_state); - // PyThreadState_Delete(new_thread_state); - - PyErr_Restore(exc, val, tb); - - // Now attempt to force the main thread to the head of the ready queue, - // so it can respond to the exception immediately. This only works if - // the main thread is not blocked, of course. - Thread::get_main_thread()->preempt(); - - } else { - // No exception. Restore the thread state normally. - PyThreadState *state = PyThreadState_Swap(orig_thread_state); - thread_states.push_back(new_thread_state); - // PyThreadState_Clear(new_thread_state); - // PyThreadState_Delete(new_thread_state); - } - -#else // SIMPLE_THREADS - // With true threading enabled, we're better off using PyGILState. - PyGILState_STATE gstate; - gstate = PyGILState_Ensure(); - - // Call the user's function. - result = PyObject_Call(function, args, NULL); - if (result == (PyObject *)NULL && PyErr_Occurred()) { - // We got an exception. Move the exception from the current thread into - // the main thread, so it can be handled there. - PyObject *exc, *val, *tb; - PyErr_Fetch(&exc, &val, &tb); - - thread_cat.error() - << "Exception occurred within " << *this << "\n"; - - // Temporarily restore the exception state so we can print a callback - // on-the-spot. - Py_XINCREF(exc); - Py_XINCREF(val); - Py_XINCREF(tb); - PyErr_Restore(exc, val, tb); - PyErr_Print(); - - PyGILState_Release(gstate); - - PyErr_Restore(exc, val, tb); - } else { - // No exception. Restore the thread state normally. - PyGILState_Release(gstate); - } - - -#endif // SIMPLE_THREADS -#endif // HAVE_THREADS - } - - return result; -} -#endif // HAVE_PYTHON - -#ifdef HAVE_PYTHON -/** - * Called when a Python exception is raised during processing of a thread. - * Gets the error string and passes it back to the calling Python process in a - * sensible way. - */ -void Thread:: -handle_python_exception() { - /* - PyObject *exc, *val, *tb; - PyErr_Fetch(&exc, &val, &tb); - - ostringstream strm; - strm << "\n"; - - if (PyObject_HasAttrString(exc, "__name__")) { - PyObject *exc_name = PyObject_GetAttrString(exc, "__name__"); - PyObject *exc_str = PyObject_Str(exc_name); - strm << PyString_AsString(exc_str); - Py_DECREF(exc_str); - Py_DECREF(exc_name); - } else { - PyObject *exc_str = PyObject_Str(exc); - strm << PyString_AsString(exc_str); - Py_DECREF(exc_str); - } - Py_DECREF(exc); - - if (val != (PyObject *)NULL) { - PyObject *val_str = PyObject_Str(val); - strm << ": " << PyString_AsString(val_str); - Py_DECREF(val_str); - Py_DECREF(val); - } - if (tb != (PyObject *)NULL) { - Py_DECREF(tb); - } - - strm << "\nException occurred within thread " << get_name(); - string message = strm.str(); - nout << message << "\n"; - - nassert_raise(message); - */ - - thread_cat.error() - << "Exception occurred within " << *this << "\n"; - - // Now attempt to force the main thread to the head of the ready queue, so - // it will be the one to receive the above assertion. This mainly only has - // an effect if SIMPLE_THREADS is in use. - Thread::get_main_thread()->preempt(); -} -#endif // HAVE_PYTHON - /** * Creates the Thread object that represents the main thread. */ diff --git a/panda/src/pipeline/thread.h b/panda/src/pipeline/thread.h index 71cbe8bcce..2240174f02 100644 --- a/panda/src/pipeline/thread.h +++ b/panda/src/pipeline/thread.h @@ -59,6 +59,7 @@ PUBLISHED: INLINE const string &get_sync_name() const; INLINE int get_pstats_index() const; + INLINE int get_python_index() const; INLINE string get_unique_id() const; INLINE int get_pipeline_stage() const; @@ -88,15 +89,21 @@ PUBLISHED: BLOCKING INLINE void join(); INLINE void preempt(); -#ifdef HAVE_PYTHON - void set_python_data(PyObject *python_data); - PyObject *get_python_data() const; -#endif - INLINE AsyncTaskBase *get_current_task() const; + INLINE void set_python_index(int index); + INLINE static void prepare_for_exit(); + MAKE_PROPERTY(sync_name, get_sync_name); + MAKE_PROPERTY(pstats_index, get_pstats_index); + MAKE_PROPERTY(python_index, get_python_index); + MAKE_PROPERTY(unique_id, get_unique_id); + MAKE_PROPERTY(pipeline_stage, get_pipeline_stage, set_pipeline_stage); + MAKE_PROPERTY(started, is_started); + MAKE_PROPERTY(joinable, is_joinable); + MAKE_PROPERTY(current_task, get_current_task); + public: // This class allows integration with PStats, particularly in the // SIMPLE_THREADS case. @@ -111,12 +118,6 @@ public: INLINE void set_pstats_callback(PStatsCallback *pstats_callback); INLINE PStatsCallback *get_pstats_callback() const; -#ifdef HAVE_PYTHON - // Integration with Python. - PyObject *call_python_func(PyObject *function, PyObject *args); - void handle_python_exception(); -#endif // HAVE_PYTHON - private: static void init_main_thread(); static void init_external_thread(); @@ -133,9 +134,7 @@ private: bool _joinable; AsyncTaskBase *_current_task; -#ifdef HAVE_PYTHON - PyObject *_python_data; -#endif + int _python_index; #ifdef DEBUG_THREADS MutexDebug *_blocked_on_mutex; diff --git a/panda/src/pnmimage/pfmFile.I b/panda/src/pnmimage/pfmFile.I index 42625aeb32..b8f63272f0 100644 --- a/panda/src/pnmimage/pfmFile.I +++ b/panda/src/pnmimage/pfmFile.I @@ -82,7 +82,7 @@ get_point1(int x, int y) const { */ INLINE void PfmFile:: set_point1(int x, int y, PN_float32 point) { - nassertv(!cnan(point)); + //nassertv(!cnan(point)); nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); _table[(y * _x_size + x) * _num_channels] = point; @@ -105,7 +105,7 @@ get_point2(int x, int y) const { */ INLINE void PfmFile:: set_point2(int x, int y, const LVecBase2f &point) { - nassertv(!point.is_nan()); + //nassertv(!point.is_nan()); nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); switch (_num_channels) { @@ -202,7 +202,7 @@ get_point3(int x, int y) const { */ INLINE void PfmFile:: set_point3(int x, int y, const LVecBase3f &point) { - nassertv(!point.is_nan()); + //nassertv(!point.is_nan()); nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); switch (_num_channels) { @@ -264,7 +264,7 @@ get_point4(int x, int y) const { */ INLINE void PfmFile:: set_point4(int x, int y, const LVecBase4f &point) { - nassertv(!point.is_nan()); + //nassertv(!point.is_nan()); nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); switch (_num_channels) { diff --git a/panda/src/pnmimage/pfmFile.cxx b/panda/src/pnmimage/pfmFile.cxx index 75bb06682f..d0424fcafe 100644 --- a/panda/src/pnmimage/pfmFile.cxx +++ b/panda/src/pnmimage/pfmFile.cxx @@ -86,7 +86,8 @@ clear() { void PfmFile:: clear(int x_size, int y_size, int num_channels) { nassertv(x_size >= 0 && y_size >= 0); - nassertv(num_channels > 0 && num_channels <= 4 || (x_size == 0 && y_size == 0 && num_channels == 0)); + nassertv((num_channels > 0 && num_channels <= 4) || + (x_size == 0 && y_size == 0 && num_channels == 0)); _x_size = x_size; _y_size = y_size; @@ -632,7 +633,6 @@ calc_average_point(LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 radi continue; } - const LPoint3f &p = get_point(xi, yi); int gi = (yi - min_y) * y_size + (xi - min_x); nassertr(gi >= 0 && gi < size, false); mini_grid[gi]._sxi = xi; @@ -1449,17 +1449,20 @@ apply_1d_lut(int channel, const PfmFile &lut, PN_float32 x_scale) { void PfmFile:: merge(const PfmFile &other) { nassertv(is_valid() && other.is_valid()); - nassertv(other._x_size == _x_size && other._y_size == _y_size); + nassertv(other._x_size == _x_size && other._y_size == _y_size && other._num_channels == _num_channels); if (!_has_no_data_value) { // Trivial no-op. return; } - for (int yi = 0; yi < _y_size; ++yi) { - for (int xi = 0; xi < _x_size; ++xi) { - if (!has_point(xi, yi) && other.has_point(xi, yi)) { - set_point(xi, yi, other.get_point(xi, yi)); + size_t point_size = _num_channels * sizeof(PN_float32); + for (int y = 0; y < _y_size; ++y) { + for (int x = 0; x < _x_size; ++x) { + if (!has_point(x, y) && other.has_point(x, y)) { + memcpy(&_table[(y * _x_size + x) * _num_channels], + &other._table[(y * _x_size + x) * _num_channels], + point_size); } } } @@ -1541,7 +1544,7 @@ apply_crop(int x_begin, int x_end, int y_begin, int y_end) { int new_x_size = x_end - x_begin; int new_y_size = y_end - y_begin; Table new_table; - int new_size = new_x_size * new_y_size * _num_channels; + size_t new_size = (size_t)new_x_size * (size_t)new_y_size * (size_t)_num_channels; // We allocate a little bit bigger to allow safe overflow: you can call // get_point3() or get_point4() on the last point of a 1- or 3-channel diff --git a/panda/src/pnmimage/pfmFile.h b/panda/src/pnmimage/pfmFile.h index d1bb93bcc4..74eda76bce 100644 --- a/panda/src/pnmimage/pfmFile.h +++ b/panda/src/pnmimage/pfmFile.h @@ -170,9 +170,9 @@ PUBLISHED: void output(ostream &out) const; +#ifdef HAVE_PYTHON EXTENSION(PyObject *get_points() const); -#if PY_VERSION_HEX >= 0x02060000 EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const); #endif diff --git a/panda/src/pnmimage/pfmFile_ext.cxx b/panda/src/pnmimage/pfmFile_ext.cxx index a6306cbbf4..4e041e986f 100644 --- a/panda/src/pnmimage/pfmFile_ext.cxx +++ b/panda/src/pnmimage/pfmFile_ext.cxx @@ -70,7 +70,6 @@ get_points() const { return list; } -#if PY_VERSION_HEX >= 0x02060000 /** * This is a very low-level function that returns a read-only multiview into * the internal table of floating-point numbers. Use this method at your own @@ -78,7 +77,7 @@ get_points() const { */ int Extension:: __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { - +#if PY_VERSION_HEX >= 0x02060000 if ((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) { PyErr_SetString(PyExc_BufferError, "Object is not writable."); @@ -118,8 +117,9 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) const { view->suboffsets = NULL; return 0; +#else + return -1; +#endif } -#endif // PY_VERSION_HEX >= 0x02060000 - #endif // HAVE_PYTHON diff --git a/panda/src/pnmimage/pfmFile_ext.h b/panda/src/pnmimage/pfmFile_ext.h index cf8d4b20aa..0476e7d3e8 100644 --- a/panda/src/pnmimage/pfmFile_ext.h +++ b/panda/src/pnmimage/pfmFile_ext.h @@ -31,9 +31,7 @@ class Extension : public ExtensionBase { public: PyObject *get_points() const; -#if PY_VERSION_HEX >= 0x02060000 int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const; -#endif }; #endif // HAVE_PYTHON diff --git a/panda/src/pnmimage/pnm-image-filter-core.cxx b/panda/src/pnmimage/pnm-image-filter-core.cxx index 8907068b50..273a4b0713 100644 --- a/panda/src/pnmimage/pnm-image-filter-core.cxx +++ b/panda/src/pnmimage/pnm-image-filter-core.cxx @@ -25,7 +25,6 @@ FUNCTION_NAME(IMAGETYPE &dest, const IMAGETYPE &source, // the image xelvals scaled in the A direction only. This will hold the // adjusted xel data from our first pass. - typedef StoreType *StoreTypeP; StoreType **matrix = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() * sizeof(StoreType *)); int a, b; diff --git a/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx b/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx index 0709c25cd3..4edf632ee4 100644 --- a/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx +++ b/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx @@ -27,7 +27,6 @@ FUNCTION_NAME(IMAGETYPE &dest, const IMAGETYPE &source, // the image xelvals scaled in the A direction only. This will hold the // adjusted xel data from our first pass. - typedef StoreType *StoreTypeP; StoreType **matrix = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() * sizeof(StoreType *)); StoreType **matrix_weight = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() * sizeof(StoreType *)); diff --git a/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx index 2c8932f7c9..9a96d64fc4 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx @@ -97,7 +97,7 @@ static int cb_read(void *user, char *data, int size) { if (in->eof()) { // Gracefully handle EOF. - in->clear(); + in->clear(ios::eofbit); } return (int)in->gcount(); @@ -109,19 +109,10 @@ static void cb_skip(void *user, int n) { in->seekg(n, ios::cur); - if (in->fail()) { + // If we can't seek, move forward by ignoring bytes instead. + if (in->fail() && n > 0) { in->clear(); - - // Implement skip by just reading and discarding the result. - static const int size = 4096; - char data[4096]; - while (n > 4096) { - in->read(data, 4096); - n -= 4096; - } - if (n > 0) { - in->read(data, n); - } + in->ignore(n); } } @@ -148,6 +139,7 @@ public: private: bool _is_float; stbi__context _context; + unsigned char _buffer[1024]; }; TypeHandle PNMFileTypeStbImage::_type_handle; @@ -224,27 +216,39 @@ StbImageReader(PNMFileType *type, istream *file, bool owns_file, string magic_nu PNMReader(type, file, owns_file), _is_float(false) { - // Hope we can putback() more than one character. - for (string::reverse_iterator mi = magic_number.rbegin(); - mi != magic_number.rend(); - mi++) { - _file->putback(*mi); - } - if (_file->fail()) { - pnmimage_cat.error() - << "Unable to put back magic number.\n"; - _is_valid = false; - return; + // Prepare the stb_image context. See stbi__start_callbacks. + _context.io.read = cb_read; + _context.io.skip = cb_skip; + _context.io.eof = cb_eof; + _context.io_user_data = (void *)file; + _context.buflen = sizeof(_context.buffer_start); + _context.read_from_callbacks = 1; + _context.img_buffer = _buffer; + _context.img_buffer_original = _buffer; + + // Prepopulate it with the magic number we already read, then fill it up. + // We need a big enough buffer so that we can read the image header. + // If stb_image runs out, it will switch to its own 128-byte buffer. + memcpy(_buffer, magic_number.data(), magic_number.size()); + file->read((char *)_buffer + magic_number.size(), sizeof(_buffer) - magic_number.size()); + + if (file->eof()) { + file->clear(ios::eofbit); } - stbi__start_callbacks(&_context, &io_callbacks, (void *)file); + size_t length = file->gcount() + magic_number.size(); + _context.img_buffer_end = _buffer + length; + _context.img_buffer_original_end = _context.img_buffer_end; + // Invoke stbi_info to read the image size and channel count. if (strncmp(magic_number.c_str(), "#?", 2) == 0 && stbi__hdr_info(&_context, &_x_size, &_y_size, &_num_channels)) { _is_valid = true; _is_float = true; + } else if (stbi__info_main(&_context, &_x_size, &_y_size, &_num_channels)) { _is_valid = true; + } else { _is_valid = false; pnmimage_cat.error() @@ -275,14 +279,21 @@ read_pfm(PfmFile &pfm) { } // Reposition the file at the beginning. - _file->seekg(0, ios::beg); - if (_file->tellg() != (streampos)0) { - pnmimage_cat.error() - << "Could not reposition file pointer to the beginning.\n"; - return false; - } + if (_context.img_buffer_end == _context.img_buffer_original_end) { + // All we need to do is rewind the buffer. + stbi__rewind(&_context); - stbi__start_callbacks(&_context, &io_callbacks, (void *)_file); + } else { + // We need to reinitialize the context. + _file->seekg(0, ios::beg); + if (_file->tellg() != (streampos)0) { + pnmimage_cat.error() + << "Could not reposition file pointer to the beginning.\n"; + return false; + } + + stbi__start_callbacks(&_context, &io_callbacks, (void *)_file); + } nassertr(_num_channels == 3, false); @@ -425,19 +436,31 @@ main_decode_loop: */ int StbImageReader:: read_data(xel *array, xelval *alpha) { - // Reposition the file at the beginning. - _file->seekg(0, ios::beg); - if (_file->tellg() != (streampos)0) { - pnmimage_cat.error() - << "Could not reposition file pointer to the beginning.\n"; + if (!is_valid()) { return 0; } - stbi__start_callbacks(&_context, &io_callbacks, (void *)_file); + // Reposition the file at the beginning. + if (_context.img_buffer_end == _context.img_buffer_original_end) { + // All we need to do is rewind the buffer. + stbi__rewind(&_context); + + } else { + // We need to reinitialize the context. + _file->seekg(0, ios::beg); + if (_file->tellg() != (streampos)0) { + pnmimage_cat.error() + << "Could not reposition file pointer to the beginning.\n"; + return false; + } + + stbi__start_callbacks(&_context, &io_callbacks, (void *)_file); + } int cols = 0; int rows = 0; - stbi_uc *data = stbi__load_main(&_context, &cols, &rows, NULL, _num_channels); + int comp = _num_channels; + stbi_uc *data = stbi__load_main(&_context, &cols, &rows, &comp, _num_channels); if (data == NULL) { pnmimage_cat.error() @@ -446,6 +469,7 @@ read_data(xel *array, xelval *alpha) { } nassertr(cols == _x_size, 0); + nassertr(comp == _num_channels, 0); size_t pixels = (size_t)_x_size * (size_t)rows; stbi_uc *ptr = data; diff --git a/panda/src/pnmtext/freetypeFont.cxx b/panda/src/pnmtext/freetypeFont.cxx index d66bcee868..f42b5b72bc 100644 --- a/panda/src/pnmtext/freetypeFont.cxx +++ b/panda/src/pnmtext/freetypeFont.cxx @@ -241,8 +241,8 @@ copy_bitmap_to_pnmimage(const FT_Bitmap &bitmap, PNMImage &image) { // This is the easy case: we can copy the rendered glyph directly into our // image, one pixel at a time. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { - for (int xi = 0; xi < bitmap.width; xi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { image.set_gray_val(xi, yi, buffer_row[xi]); } buffer_row += bitmap.pitch; @@ -252,11 +252,11 @@ copy_bitmap_to_pnmimage(const FT_Bitmap &bitmap, PNMImage &image) { // This is a little bit more work: we have to expand the one-bit-per-pixel // bitmap into a one-byte-per-pixel image. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { xelval maxval = image.get_maxval(); int bit = 0x80; unsigned char *b = buffer_row; - for (int xi = 0; xi < bitmap.width; xi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { if (*b & bit) { image.set_gray_val(xi, yi, maxval); } else { @@ -277,8 +277,8 @@ copy_bitmap_to_pnmimage(const FT_Bitmap &bitmap, PNMImage &image) { // Here we must expand a grayscale pixmap with n levels of gray into our // 256-level texture. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { - for (int xi = 0; xi < bitmap.width; xi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { image.set_gray(xi, yi, (PN_stdfloat)buffer_row[xi] / (bitmap.num_grays - 1)); } buffer_row += bitmap.pitch; @@ -691,7 +691,6 @@ outline_nurbs(NurbsCurveResult *ncr) { PN_stdfloat st0 = st, st1 = st; if (i > 0) { - PN_stdfloat last_t = ncr->get_sample_t(i - 1); st0 = ncr->get_sample_t(i - 1) * 0.1f + st * 0.9f; } if (i < num_samples - 1) { diff --git a/panda/src/putil/animInterface.cxx b/panda/src/putil/animInterface.cxx index 1fd73dc6f0..4727b4f907 100644 --- a/panda/src/putil/animInterface.cxx +++ b/panda/src/putil/animInterface.cxx @@ -356,7 +356,12 @@ is_playing() const { return false; case PM_play: - return get_f() < _play_frames; + if (_effective_frame_rate < 0.0) { + // If we're playing backwards, check if we're at the beginning. + return get_f() > 0; + } else { + return get_f() < _play_frames; + } case PM_loop: case PM_pingpong: diff --git a/panda/src/putil/bamCache.cxx b/panda/src/putil/bamCache.cxx index 06211b5690..5576e16a43 100644 --- a/panda/src/putil/bamCache.cxx +++ b/panda/src/putil/bamCache.cxx @@ -310,13 +310,24 @@ emergency_read_only() { */ void BamCache:: consider_flush_index() { - ReMutexHolder holder(_lock); +#if defined(HAVE_THREADS) || defined(DEBUG_THREADS) + if (!_lock.try_acquire()) { + // If we can't grab the lock, no big deal. We don't want to hold up + // the frame waiting for a cache operation. We can try again later. + return; + } +#endif + if (_index_stale_since != 0) { int elapsed = (int)time(NULL) - (int)_index_stale_since; if (elapsed > _flush_time) { flush_index(); } } + +#if defined(HAVE_THREADS) || defined(DEBUG_THREADS) + _lock.release(); +#endif } /** diff --git a/panda/src/putil/bamReader_ext.cxx b/panda/src/putil/bamReader_ext.cxx index 4a490f90d9..1648d7e24c 100644 --- a/panda/src/putil/bamReader_ext.cxx +++ b/panda/src/putil/bamReader_ext.cxx @@ -13,6 +13,7 @@ #include "bamReader_ext.h" #include "config_util.h" +#include "pythonThread.h" #ifdef HAVE_PYTHON @@ -45,8 +46,7 @@ static TypedWritable *factory_callback(const FactoryParams ¶ms){ PyObject *args = PyTuple_Pack(2, py_scan, py_manager); // Now call the Python function. - Thread *current_thread = Thread::get_current_thread(); - PyObject *result = current_thread->call_python_func(func, args); + PyObject *result = PythonThread::call_python_func(func, args); Py_DECREF(args); Py_DECREF(py_scan); Py_DECREF(py_manager); diff --git a/panda/src/putil/copyOnWriteObject.I b/panda/src/putil/copyOnWriteObject.I index c8727d8e7c..304e7214c5 100644 --- a/panda/src/putil/copyOnWriteObject.I +++ b/panda/src/putil/copyOnWriteObject.I @@ -66,13 +66,22 @@ operator = (const CopyOnWriteObject ©) { #ifdef COW_THREADED /** - * See CachedTypedWritableReferenceCount::cache_ref(). + * @see CachedTypedWritableReferenceCount::cache_ref() */ INLINE void CopyOnWriteObject:: cache_ref() const { MutexHolder holder(_lock_mutex); CachedTypedWritableReferenceCount::cache_ref(); } + +/** + * @see CachedTypedWritableReferenceCount::cache_unref() + */ +INLINE bool CopyOnWriteObject:: +cache_unref() const { + MutexHolder holder(_lock_mutex); + return CachedTypedWritableReferenceCount::cache_unref(); +} #endif // COW_THREADED /** diff --git a/panda/src/putil/copyOnWriteObject.h b/panda/src/putil/copyOnWriteObject.h index 4799c727f1..8cada6bfd7 100644 --- a/panda/src/putil/copyOnWriteObject.h +++ b/panda/src/putil/copyOnWriteObject.h @@ -48,6 +48,7 @@ PUBLISHED: #ifdef COW_THREADED virtual bool unref() const; INLINE void cache_ref() const; + INLINE bool cache_unref() const; #endif // COW_THREADED protected: diff --git a/panda/src/putil/copyOnWritePointer.cxx b/panda/src/putil/copyOnWritePointer.cxx index 5ff01f1ccc..de0a2e8abf 100644 --- a/panda/src/putil/copyOnWritePointer.cxx +++ b/panda/src/putil/copyOnWritePointer.cxx @@ -12,7 +12,6 @@ */ #include "copyOnWritePointer.h" -#include "mutexHolder.h" #include "config_util.h" #include "config_pipeline.h" @@ -69,7 +68,7 @@ get_write_pointer() { Thread *current_thread = Thread::get_current_thread(); - MutexHolder holder(_cow_object->_lock_mutex); + _cow_object->_lock_mutex.acquire(); while (_cow_object->_lock_status == CopyOnWriteObject::LS_locked_write && _cow_object->_locking_thread != current_thread) { if (util_cat.is_debug()) { @@ -89,10 +88,20 @@ get_write_pointer() { << "Making copy of " << _cow_object->get_type() << " because it is locked in read mode.\n"; } + PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy(); - cache_unref_delete(_cow_object); + + // We can't call cache_unref_delete, because we hold the lock. + if (!_cow_object->CachedTypedWritableReferenceCount::cache_unref()) { + _cow_object->_lock_mutex.release(); + delete _cow_object; + } else { + _cow_object->_lock_mutex.release(); + } _cow_object = new_object; _cow_object->cache_ref(); + _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write; + _cow_object->_locking_thread = current_thread; } else if (_cow_object->get_cache_ref_count() > 1) { // No one else has it specifically read-locked, but there are other @@ -106,9 +115,18 @@ get_write_pointer() { } PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy(); - cache_unref_delete(_cow_object); + + // We can't call cache_unref_delete, because we hold the lock. + if (!_cow_object->CachedTypedWritableReferenceCount::cache_unref()) { + _cow_object->_lock_mutex.release(); + delete _cow_object; + } else { + _cow_object->_lock_mutex.release(); + } _cow_object = new_object; _cow_object->cache_ref(); + _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write; + _cow_object->_locking_thread = current_thread; } else { // No other thread has the pointer locked, and we're the only @@ -118,9 +136,10 @@ get_write_pointer() { // We can't assert that there are no outstanding ordinary references to // it, though, since the creator of the object might have saved himself a // reference. + _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write; + _cow_object->_locking_thread = current_thread; + _cow_object->_lock_mutex.release(); } - _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write; - _cow_object->_locking_thread = current_thread; return _cow_object; } diff --git a/panda/src/putil/doubleBitMask.I b/panda/src/putil/doubleBitMask.I index 6d21ad2ffb..a6997af549 100644 --- a/panda/src/putil/doubleBitMask.I +++ b/panda/src/putil/doubleBitMask.I @@ -700,7 +700,7 @@ operator ^= (const DoubleBitMask &other) { template INLINE void DoubleBitMask:: operator <<= (int shift) { - _hi = (_hi << shift) | ((_lo >> half_bits - shift) & BitMaskType::lower_on(shift)); + _hi = (_hi << shift) | ((_lo >> (half_bits - shift)) & BitMaskType::lower_on(shift)); _lo <<= shift; } @@ -710,7 +710,7 @@ operator <<= (int shift) { template INLINE void DoubleBitMask:: operator >>= (int shift) { - _lo = (_lo >> shift) | ((_hi & BitMaskType::lower_on(shift)) << half_bits - shift); + _lo = (_lo >> shift) | ((_hi & BitMaskType::lower_on(shift)) << (half_bits - shift)); _hi >>= shift; } diff --git a/panda/src/putil/loaderOptions.I b/panda/src/putil/loaderOptions.I index f28be10370..b15780c847 100644 --- a/panda/src/putil/loaderOptions.I +++ b/panda/src/putil/loaderOptions.I @@ -81,10 +81,10 @@ get_texture_flags() const { /** * Specifies the expected number of views to load for the texture. This is * ignored unless TF_multiview is included in texture_flags. This must be - * specified when loading a 3-d multiview texture, in which case it is used to - * differentiate z levels from separate views; it may be zero in the case of - * 2-d textures or cube maps, in which case the number of views can be - * inferred from the number of images found on disk. + * specified when loading a 3-d multiview texture or 2-d texture array, in + * which case it is used to differentiate z levels from separate views; it + * may be zero in the case of 2-d textures or cube maps, in which case the + * number of views can be inferred from the number of images found on disk. */ INLINE void LoaderOptions:: set_texture_num_views(int texture_num_views) { diff --git a/panda/src/putil/pythonCallbackObject.cxx b/panda/src/putil/pythonCallbackObject.cxx index 0679a4c473..fd1c9aa64f 100644 --- a/panda/src/putil/pythonCallbackObject.cxx +++ b/panda/src/putil/pythonCallbackObject.cxx @@ -16,7 +16,7 @@ #ifdef HAVE_PYTHON #include "py_panda.h" -#include "thread.h" +#include "pythonThread.h" #include "callbackData.h" #include "config_util.h" @@ -121,8 +121,7 @@ do_python_callback(CallbackData *cbdata) { PyObject *args = Py_BuildValue("(O)", pycbdata); Py_DECREF(pycbdata); - PyObject *result = - Thread::get_current_thread()->call_python_func(_function, args); + PyObject *result = PythonThread::call_python_func(_function, args); Py_DECREF(args); if (result == (PyObject *)NULL) { diff --git a/panda/src/putil/simpleHashMap.I b/panda/src/putil/simpleHashMap.I index 67db8830b9..d68fae9542 100644 --- a/panda/src/putil/simpleHashMap.I +++ b/panda/src/putil/simpleHashMap.I @@ -553,7 +553,6 @@ expand_table() { nassertv(_num_entries == 0); // Now copy the entries from the old table into the new table. - int num_added = 0; for (size_t i = 0; i < old_table_size; ++i) { if (old_map.has_element(i)) { size_t new_index = get_hash(old_map._table[i]._key); diff --git a/panda/src/putil/weakKeyHashMap.I b/panda/src/putil/weakKeyHashMap.I index ea5aa43e9a..c80e47723d 100644 --- a/panda/src/putil/weakKeyHashMap.I +++ b/panda/src/putil/weakKeyHashMap.I @@ -600,7 +600,6 @@ expand_table() { nassertv(_num_entries == 0); // Now copy the entries from the old table into the new table. - int num_added = 0; for (size_t i = 0; i < old_table_size; ++i) { if (old_map.has_element(i)) { size_t new_index = get_hash(old_map._table[i]._key.get_orig()); diff --git a/panda/src/rocket/rocketInputHandler.cxx b/panda/src/rocket/rocketInputHandler.cxx index 5451beda9e..fcfa6dc2cf 100644 --- a/panda/src/rocket/rocketInputHandler.cxx +++ b/panda/src/rocket/rocketInputHandler.cxx @@ -152,7 +152,6 @@ get_rocket_key(const ButtonHandle handle) { void RocketInputHandler:: do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output) { - Thread *current_thread = trav->get_current_thread(); MutexHolder holder(_lock); if (input.has_data(_pixel_xy_input)) { diff --git a/panda/src/speedtree/.gitignore b/panda/src/speedtree/.gitignore deleted file mode 100644 index cc8bd6d1ad..0000000000 --- a/panda/src/speedtree/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/speedtree_parameters.h diff --git a/panda/src/testbed/pgrid.cxx b/panda/src/testbed/pgrid.cxx index 76f56a58d9..e028e6c03c 100644 --- a/panda/src/testbed/pgrid.cxx +++ b/panda/src/testbed/pgrid.cxx @@ -12,7 +12,6 @@ */ #include "pandaFramework.h" -#include "pystub.h" #include "pandaNode.h" #include "transformState.h" #include "clockObject.h" @@ -385,9 +384,6 @@ load_gridded_models(WindowFramework *window, int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - preprocess_argv(argc, argv); PandaFramework framework; framework.open_framework(argc, argv); diff --git a/panda/src/testbed/pview.cxx b/panda/src/testbed/pview.cxx index f656a5de3d..c31537e2c5 100644 --- a/panda/src/testbed/pview.cxx +++ b/panda/src/testbed/pview.cxx @@ -13,7 +13,6 @@ #include "pandaFramework.h" #include "pandaSystem.h" -#include "pystub.h" #include "textNode.h" #include "configVariableBool.h" #include "texturePool.h" @@ -234,9 +233,6 @@ report_version() { int main(int argc, char **argv) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - preprocess_argv(argc, argv); framework.open_framework(argc, argv); framework.set_window_title("Panda Viewer"); diff --git a/panda/src/text/dynamicTextFont.cxx b/panda/src/text/dynamicTextFont.cxx index 705bd1a943..09369a12b9 100644 --- a/panda/src/text/dynamicTextFont.cxx +++ b/panda/src/text/dynamicTextFont.cxx @@ -220,7 +220,6 @@ write(ostream &out, int indent_level) const { Cache::const_iterator ci; for (ci = _cache.begin(); ci != _cache.end(); ++ci) { int glyph_index = (*ci).first; - const TextGlyph *glyph = (*ci).second; indent(out, indent_level + 2) << glyph_index; @@ -630,7 +629,7 @@ copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph) { // This is the easy case: we can memcpy the rendered glyph directly into // our texture image, one row at a time. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { unsigned char *texture_row = glyph->get_row(yi); nassertv(texture_row != (unsigned char *)NULL); @@ -642,13 +641,13 @@ copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph) { // This is a little bit more work: we have to expand the one-bit-per-pixel // bitmap into a one-byte-per-pixel texture. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { unsigned char *texture_row = glyph->get_row(yi); nassertv(texture_row != (unsigned char *)NULL); int bit = 0x80; unsigned char *b = buffer_row; - for (int xi = 0; xi < bitmap.width; xi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { if (*b & bit) { texture_row[xi] = 0xff; } else { @@ -669,10 +668,10 @@ copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph) { // Here we must expand a grayscale pixmap with n levels of gray into our // 256-level texture. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { unsigned char *texture_row = glyph->get_row(yi); nassertv(texture_row != (unsigned char *)NULL); - for (int xi = 0; xi < bitmap.width; xi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { texture_row[xi] = (int)(buffer_row[xi] * 255) / (bitmap.num_grays - 1); } buffer_row += bitmap.pitch; diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index 933712c531..4829576407 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -1329,10 +1329,9 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { // width is defined by the wordwrap size with the upper left corner // starting from 0,0,0 if the wordwrap size is unspecified the alignment // could eventually result wrong. - PN_stdfloat xpos; + PN_stdfloat xpos = 0; switch (align) { case TextProperties::A_left: - xpos = 0.0f; _lr[0] = max(_lr[0], row_width); break; @@ -1348,7 +1347,6 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { break; case TextProperties::A_boxed_left: - xpos = 0.0f; _lr[0] = max(_lr[0], max(row_width, wordwrap)); break; @@ -1489,6 +1487,7 @@ assemble_row(TextAssembler::TextRow &row, placement._scale = properties->get_glyph_scale(); placement._xpos = (xpos - frame[0]); placement._ypos = (properties->get_glyph_shift() - frame[2]); + placement._slant = properties->get_slant(); placement._properties = properties; placed_glyphs.push_back(placement); diff --git a/panda/src/text/textNode.cxx b/panda/src/text/textNode.cxx index b9bfd22125..454c7dd7f3 100644 --- a/panda/src/text/textNode.cxx +++ b/panda/src/text/textNode.cxx @@ -911,7 +911,7 @@ count_geoms(PandaNode *node) { } Children children = node->get_children(); - for (int i = 0; i < children.get_num_children(); ++i) { + for (size_t i = 0; i < children.get_num_children(); ++i) { num_geoms += count_geoms(children.get_child(i)); } diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 7f6355c135..30f2c4762e 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -1474,10 +1474,10 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, << " seconds of inactivity; releasing held buttons.\n"; } { - for (int i = 0; i < _current_buttons_down.get_num_bits(); ++i) { + for (size_t i = 0; i < _current_buttons_down.get_num_bits(); ++i) { if (_current_buttons_down.get_bit(i)) { - release(ButtonHandle(i)); - new_button_events.add_event(ButtonEvent(ButtonHandle(i), ButtonEvent::T_up)); + release(ButtonHandle((int)i)); + new_button_events.add_event(ButtonEvent(ButtonHandle((int)i), ButtonEvent::T_up)); } } } @@ -1488,10 +1488,10 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, case IS_inactive_to_active: // "Press" all of the buttons we "released" before. { - for (int i = 0; i < _current_buttons_down.get_num_bits(); ++i) { + for (size_t i = 0; i < _current_buttons_down.get_num_bits(); ++i) { if (_current_buttons_down.get_bit(i)) { - press(ButtonHandle(i), false); - new_button_events.add_event(ButtonEvent(ButtonHandle(i), ButtonEvent::T_down)); + press(ButtonHandle((int)i), false); + new_button_events.add_event(ButtonEvent(ButtonHandle((int)i), ButtonEvent::T_down)); } } } diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx index 9e37c67037..6818ea65a0 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx @@ -114,7 +114,8 @@ reset() { Geom::GR_point | Geom::GR_indexed_other | Geom::GR_triangle_strip | - Geom::GR_flat_last_vertex; + Geom::GR_flat_last_vertex | + Geom::GR_render_mode_wireframe | Geom::GR_render_mode_point; _max_texture_dimension = (1 << ZB_POINT_ST_FRAC_BITS); _max_texture_stages = MAX_TEXTURE_STAGES; @@ -1722,24 +1723,9 @@ update_texture(TextureContext *tc, bool force, int stage_index, bool uses_mipmap */ void TinyGraphicsStateGuardian:: release_texture(TextureContext *tc) { - TinyTextureContext *gtc = DCAST(TinyTextureContext, tc); - _texturing_state = 0; // just in case - GLTexture *gltex = >c->_gltex; - if (gltex->allocated_buffer != NULL) { - nassertv(gltex->num_levels != 0); - TinyTextureContext::get_class_type().dec_memory_usage(TypeHandle::MC_array, gltex->total_bytecount); - PANDA_FREE_ARRAY(gltex->allocated_buffer); - gltex->allocated_buffer = NULL; - gltex->total_bytecount = 0; - gltex->num_levels = 0; - } else { - nassertv(gltex->num_levels == 0); - } - - gtc->dequeue_lru(); - + TinyTextureContext *gtc = DCAST(TinyTextureContext, tc); delete gtc; } diff --git a/panda/src/tinydisplay/tinyTextureContext.I b/panda/src/tinydisplay/tinyTextureContext.I index 10ba8332d2..ca4f620db1 100644 --- a/panda/src/tinydisplay/tinyTextureContext.I +++ b/panda/src/tinydisplay/tinyTextureContext.I @@ -22,11 +22,3 @@ TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex, int view) : _gltex.allocated_buffer = NULL; _gltex.total_bytecount = 0; } - -/** - * - */ -INLINE TinyTextureContext:: -~TinyTextureContext() { - nassertv(_gltex.num_levels == 0 && _gltex.allocated_buffer == NULL && _gltex.total_bytecount == 0); -} diff --git a/panda/src/tinydisplay/tinyTextureContext.cxx b/panda/src/tinydisplay/tinyTextureContext.cxx index d5ec90b012..87427ac365 100644 --- a/panda/src/tinydisplay/tinyTextureContext.cxx +++ b/panda/src/tinydisplay/tinyTextureContext.cxx @@ -16,6 +16,24 @@ TypeHandle TinyTextureContext::_type_handle; +/** + * Releases the memory associated with the texture. + */ +TinyTextureContext:: +~TinyTextureContext() { + GLTexture *gltex = &_gltex; + if (gltex->allocated_buffer != NULL) { + nassertv(gltex->num_levels != 0); + TinyTextureContext::get_class_type().dec_memory_usage(TypeHandle::MC_array, gltex->total_bytecount); + PANDA_FREE_ARRAY(gltex->allocated_buffer); + gltex->allocated_buffer = NULL; + gltex->total_bytecount = 0; + gltex->num_levels = 0; + } else { + nassertv(gltex->num_levels == 0); + } +} + /** * Evicts the page from the LRU. Called internally when the LRU determines * that it is full. May also be called externally when necessary to diff --git a/panda/src/tinydisplay/tinyTextureContext.h b/panda/src/tinydisplay/tinyTextureContext.h index 78e6af40de..d321ae4ab8 100644 --- a/panda/src/tinydisplay/tinyTextureContext.h +++ b/panda/src/tinydisplay/tinyTextureContext.h @@ -27,7 +27,7 @@ public: INLINE TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex, int view); ALLOC_DELETED_CHAIN(TinyTextureContext); - INLINE ~TinyTextureContext(); + ~TinyTextureContext(); virtual void evict_lru(); diff --git a/panda/src/tinydisplay/zbuffer.cxx b/panda/src/tinydisplay/zbuffer.cxx index 4623a85353..cc25320646 100644 --- a/panda/src/tinydisplay/zbuffer.cxx +++ b/panda/src/tinydisplay/zbuffer.cxx @@ -489,11 +489,11 @@ lookup_texture_mipmap_linear(ZTextureDef *texture_def, int s, int t, unsigned in level = max((int)level - 1, 0); p2 = ZB_LOOKUP_TEXTURE_MIPMAP_NEAREST(texture_def, s, t, level); - unsigned int bitsize = level + ZB_POINT_ST_FRAC_BITS; - r = LINEAR_FILTER_BITSIZE(PIXEL_R(p2), PIXEL_R(p1), level_dx, bitsize); - g = LINEAR_FILTER_BITSIZE(PIXEL_G(p2), PIXEL_G(p1), level_dx, bitsize); - b = LINEAR_FILTER_BITSIZE(PIXEL_B(p2), PIXEL_B(p1), level_dx, bitsize); - a = LINEAR_FILTER_BITSIZE(PIXEL_A(p2), PIXEL_A(p1), level_dx, bitsize); + unsigned int f = level_dx >> (level - 1); + r = LINEAR_FILTER(PIXEL_R(p1), PIXEL_R(p2), f); + g = LINEAR_FILTER(PIXEL_G(p1), PIXEL_G(p2), f); + b = LINEAR_FILTER(PIXEL_B(p1), PIXEL_B(p2), f); + a = LINEAR_FILTER(PIXEL_A(p1), PIXEL_A(p2), f); return RGBA_TO_PIXEL(r, g, b, a); } @@ -570,11 +570,11 @@ lookup_texture_mipmap_trilinear(ZTextureDef *texture_def, int s, int t, unsigned } int r, g, b, a; - unsigned int bitsize = level + ZB_POINT_ST_FRAC_BITS; - r = LINEAR_FILTER_BITSIZE(PIXEL_R(p2a), PIXEL_R(p1a), level_dx, bitsize); - g = LINEAR_FILTER_BITSIZE(PIXEL_G(p2a), PIXEL_G(p1a), level_dx, bitsize); - b = LINEAR_FILTER_BITSIZE(PIXEL_B(p2a), PIXEL_B(p1a), level_dx, bitsize); - a = LINEAR_FILTER_BITSIZE(PIXEL_A(p2a), PIXEL_A(p1a), level_dx, bitsize); + unsigned int f = level_dx >> (level - 1); + r = LINEAR_FILTER(PIXEL_R(p1a), PIXEL_R(p2a), f); + g = LINEAR_FILTER(PIXEL_G(p1a), PIXEL_G(p2a), f); + b = LINEAR_FILTER(PIXEL_B(p1a), PIXEL_B(p2a), f); + a = LINEAR_FILTER(PIXEL_A(p1a), PIXEL_A(p2a), f); return RGBA_TO_PIXEL(r, g, b, a); } diff --git a/panda/src/tinydisplay/ztriangle_two.h b/panda/src/tinydisplay/ztriangle_two.h index d1c5a56916..6bb255ce01 100644 --- a/panda/src/tinydisplay/ztriangle_two.h +++ b/panda/src/tinydisplay/ztriangle_two.h @@ -81,7 +81,7 @@ FNAME(smooth_untextured) (ZBuffer *zb, #define EARLY_OUT() \ { \ - int c0, c1, c2; \ + unsigned int c0, c1, c2; \ c0 = RGBA_TO_PIXEL(p0->r, p0->g, p0->b, p0->a); \ c1 = RGBA_TO_PIXEL(p1->r, p1->g, p1->b, p1->a); \ c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a); \ @@ -223,7 +223,7 @@ FNAME(smooth_textured) (ZBuffer *zb, #define EARLY_OUT() \ { \ - int c0, c1, c2; \ + unsigned int c0, c1, c2; \ c0 = RGBA_TO_PIXEL(p0->r, p0->g, p0->b, p0->a); \ c1 = RGBA_TO_PIXEL(p1->r, p1->g, p1->b, p1->a); \ c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a); \ diff --git a/panda/src/vision/config_vision.cxx b/panda/src/vision/config_vision.cxx index 91c6acac86..3b53c0ed02 100644 --- a/panda/src/vision/config_vision.cxx +++ b/panda/src/vision/config_vision.cxx @@ -60,8 +60,8 @@ init_libvision() { PandaSystem *ps = PandaSystem::get_global_ptr(); ps->add_system("OpenCV"); - TexturePool *ts = TexturePool::get_global_ptr(); #ifndef HAVE_FFMPEG + TexturePool *ts = TexturePool::get_global_ptr(); ts->register_texture_type(OpenCVTexture::make_texture, "avi"); #endif #endif diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index c12568882d..64090c53aa 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -305,7 +305,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { // Set up the mmap buffers struct v4l2_buffer buf; - for (int i = 0; i < _bufcount; ++i) { + for (unsigned int i = 0; i < (unsigned int)_bufcount; ++i) { memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; @@ -367,7 +367,7 @@ WebcamVideoCursorV4L:: close(_fd); } if (_buffers) { - for (int i = 0; i < _bufcount; ++i) { + for (unsigned int i = 0; i < (unsigned int)_bufcount; ++i) { munmap(_buffers[i], _buflens[i]); } free(_buffers); @@ -455,7 +455,7 @@ fetch_buffer() { } // Flip the image vertically - for (size_t row = 0; row < _size_y; ++row) { + for (int row = 0; row < _size_y; ++row) { memcpy(block + (_size_y - row - 1) * new_bpl, newbuf + row * new_bpl, new_bpl); } free(newbuf); diff --git a/panda/src/vision/webcamVideoOpenCV.cxx b/panda/src/vision/webcamVideoOpenCV.cxx index 92a22dc4a5..d4c68070fa 100644 --- a/panda/src/vision/webcamVideoOpenCV.cxx +++ b/panda/src/vision/webcamVideoOpenCV.cxx @@ -33,7 +33,7 @@ find_all_webcams_opencv() { "numbers that are assumed to be available via OpenCV to the " "WebcamVideo interface. The default camera index is 0. " "Specify empty string if there are no available cameras.")); - for (int i = 0; i < wemcam_opencv_camera_index.get_num_words(); ++i) { + for (size_t i = 0; i < wemcam_opencv_camera_index.get_num_words(); ++i) { PT(WebcamVideo) wc = new WebcamVideoOpenCV(wemcam_opencv_camera_index[i]); WebcamVideoOpenCV::_all_webcams.push_back(wc); } diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 6940f2d592..732932a1e4 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -27,6 +27,8 @@ #include "nativeWindowHandle.h" #include "virtualFileSystem.h" #include "get_x11.h" +#include "pnmImage.h" +#include "pnmFileTypeRegistry.h" #include #include @@ -2228,109 +2230,144 @@ read_ico(istream &ico) { // Seek to the image in the ICO. ico.seekg(entries[entry].offset); if (!ico.good()) goto cleanup; - ico.read(reinterpret_cast(&infoHeader), sizeof(IcoInfoHeader)); - if (!ico.good()) goto cleanup; - bitsPerPixel = infoHeader.bitsPerPixel; - // TODO: Support PNG compressed ICOs. - if (infoHeader.compression != 0) goto cleanup; + if (ico.peek() == 0x89) { + // Hang on, this is actually a PNG header. + PNMImage img; + PNMFileTypeRegistry *reg = PNMFileTypeRegistry::get_global_ptr(); + if (!img.read(ico, "", reg->get_type_from_extension("png"))) { + goto cleanup; + } + img.set_maxval(255); - // Load the color palette, if one exists. - if (bitsPerPixel != 24 && bitsPerPixel != 32) { - colorCount = 1 << bitsPerPixel; - palette = new IcoColor[colorCount]; - ico.read(reinterpret_cast(palette), colorCount * sizeof(IcoColor)); + image = XcursorImageCreate(img.get_x_size(), img.get_y_size()); + + xel *ptr = img.get_array(); + xelval *alpha = img.get_alpha_array(); + size_t num_pixels = (size_t)img.get_x_size() * (size_t)img.get_y_size(); + unsigned int *dest = image->pixels; + + if (alpha != NULL) { + for (size_t p = 0; p < num_pixels; ++p) { + *dest++ = (*alpha << 24U) | (ptr->r << 16U) | (ptr->g << 8U) | (ptr->b); + ++ptr; + ++alpha; + } + } else { + for (size_t p = 0; p < num_pixels; ++p) { + *dest++ = 0xff000000U | (ptr->r << 16U) | (ptr->g << 8U) | (ptr->b); + ++ptr; + } + } + + } else { + ico.read(reinterpret_cast(&infoHeader), sizeof(IcoInfoHeader)); if (!ico.good()) goto cleanup; + bitsPerPixel = infoHeader.bitsPerPixel; + + if (infoHeader.compression != 0) goto cleanup; + + // Load the color palette, if one exists. + if (bitsPerPixel != 24 && bitsPerPixel != 32) { + colorCount = 1 << bitsPerPixel; + palette = new IcoColor[colorCount]; + ico.read(reinterpret_cast(palette), colorCount * sizeof(IcoColor)); + if (!ico.good()) goto cleanup; + } + + // Read in the pixel data. + xorBmpSize = (infoHeader.width * (infoHeader.height / 2) * bitsPerPixel) / 8; + andBmpSize = (infoHeader.width * (infoHeader.height / 2)) / 8; + curXor = xorBmp = new char[xorBmpSize]; + curAnd = andBmp = new char[andBmpSize]; + ico.read(xorBmp, xorBmpSize); + if (!ico.good()) goto cleanup; + ico.read(andBmp, andBmpSize); + if (!ico.good()) goto cleanup; + + image = XcursorImageCreate(infoHeader.width, infoHeader.height / 2); + + // Support all the formats that GIMP supports. + switch (bitsPerPixel) { + case 1: + case 4: + case 8: + // For colors less that a byte wide, shift and mask the palette indices + // off each element of the xorBmp and append them to the image. + mask = ((1 << bitsPerPixel) - 1); + for (i = image->height - 1; i >= 0; i--) { + for (j = 0; j < image->width; j += 8 / bitsPerPixel) { + for (k = 0; k < 8 / bitsPerPixel; k++) { + shift = 8 - ((k + 1) * bitsPerPixel); + color = palette[(*curXor & (mask << shift)) >> shift]; + image->pixels[(i * image->width) + j + k] = (color.red << 16) + + (color.green << 8) + + (color.blue); + } + + curXor++; + } + + // Set the alpha byte properly according to the andBmp. + for (j = 0; j < image->width; j += 8) { + for (k = 0; k < 8; k++) { + shift = 7 - k; + image->pixels[(i * image->width) + j + k] |= + ((*curAnd & (1 << shift)) >> shift) ? 0x0 : (0xff << 24); + } + + curAnd++; + } + } + break; + + case 24: + // Pack each of the three bytes into a single color, BGR -> 0RGB + for (i = image->height - 1; i >= 0; i--) { + for (j = 0; j < image->width; j++) { + image->pixels[(i * image->width) + j] = (*(curXor + 2) << 16) + + (*(curXor + 1) << 8) + (*curXor); + curXor += 3; + } + + // Set the alpha byte properly according to the andBmp. + for (j = 0; j < image->width; j += 8) { + for (k = 0; k < 8; k++) { + shift = 7 - k; + image->pixels[(i * image->width) + j + k] |= + ((*curAnd & (1 << shift)) >> shift) ? 0x0 : (0xff << 24); + } + + curAnd++; + } + } + break; + + case 32: + // Pack each of the four bytes into a single color, BGRA -> ARGB + for (i = image->height - 1; i >= 0; i--) { + for (j = 0; j < image->width; j++) { + image->pixels[(i * image->width) + j] = (*(curXor + 3) << 24) + + (*(curXor + 2) << 16) + + (*(curXor + 1) << 8) + + (*curXor); + curXor += 4; + } + } + break; + + default: + goto cleanup; + } } - // Read in the pixel data. - xorBmpSize = (infoHeader.width * (infoHeader.height / 2) * bitsPerPixel) / 8; - andBmpSize = (infoHeader.width * (infoHeader.height / 2)) / 8; - curXor = xorBmp = new char[xorBmpSize]; - curAnd = andBmp = new char[andBmpSize]; - ico.read(xorBmp, xorBmpSize); - if (!ico.good()) goto cleanup; - ico.read(andBmp, andBmpSize); - if (!ico.good()) goto cleanup; - // If this is an actual CUR not an ICO set up the hotspot properly. - image = XcursorImageCreate(infoHeader.width, infoHeader.height / 2); - if (header.type == 2) { image->xhot = entries[entry].xhot; image->yhot = entries[entry].yhot; } - - // Support all the formats that GIMP supports, minus PNG compressed ICOs. - // Would need to use libpng to decode the compressed ones. - switch (bitsPerPixel) { - case 1: - case 4: - case 8: - // For colors less that a byte wide, shift and mask the palette indices - // off each element of the xorBmp and append them to the image. - mask = ((1 << bitsPerPixel) - 1); - for (i = image->height - 1; i >= 0; i--) { - for (j = 0; j < image->width; j += 8 / bitsPerPixel) { - for (k = 0; k < 8 / bitsPerPixel; k++) { - shift = 8 - ((k + 1) * bitsPerPixel); - color = palette[(*curXor & (mask << shift)) >> shift]; - image->pixels[(i * image->width) + j + k] = (color.red << 16) + - (color.green << 8) + - (color.blue); - } - - curXor++; - } - - // Set the alpha byte properly according to the andBmp. - for (j = 0; j < image->width; j += 8) { - for (k = 0; k < 8; k++) { - shift = 7 - k; - image->pixels[(i * image->width) + j + k] |= - ((*curAnd & (1 << shift)) >> shift) ? 0x0 : (0xff << 24); - } - - curAnd++; - } - } - - break; - case 24: - // Pack each of the three bytes into a single color, BGR -> 0RGB - for (i = image->height - 1; i >= 0; i--) { - for (j = 0; j < image->width; j++) { - image->pixels[(i * image->width) + j] = (*(curXor + 2) << 16) + - (*(curXor + 1) << 8) + (*curXor); - curXor += 3; - } - - // Set the alpha byte properly according to the andBmp. - for (j = 0; j < image->width; j += 8) { - for (k = 0; k < 8; k++) { - shift = 7 - k; - image->pixels[(i * image->width) + j + k] |= - ((*curAnd & (1 << shift)) >> shift) ? 0x0 : (0xff << 24); - } - - curAnd++; - } - - } - - break; - case 32: - // Pack each of the four bytes into a single color, BGRA -> ARGB - for (i = image->height - 1; i >= 0; i--) { - for (j = 0; j < image->width; j++) { - image->pixels[(i * image->width) + j] = (*(curXor + 3) << 24) + - (*(curXor + 2) << 16) + - (*(curXor + 1) << 8) + - (*curXor); - curXor += 4; - } - } - - break; - default: - goto cleanup; - break; + if (header.type == 2) { + image->xhot = entries[entry].xhot; + image->yhot = entries[entry].yhot; + } else { + image->xhot = 0; + image->yhot = 0; } ret = XcursorImageLoadCursor(_display, image); diff --git a/pandatool/.gitignore b/pandatool/.gitignore deleted file mode 100644 index 692e733aa2..0000000000 --- a/pandatool/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# These are files that are generated within the source tree by the -# ppremake system. -Makefile -pp.dep -/built/ -Opt?-* diff --git a/pandatool/src/assimp/assimpLoader.cxx b/pandatool/src/assimp/assimpLoader.cxx index 661286d454..fb383a1b7f 100644 --- a/pandatool/src/assimp/assimpLoader.cxx +++ b/pandatool/src/assimp/assimpLoader.cxx @@ -39,7 +39,7 @@ #include "pandaIOSystem.h" #include "pandaLogger.h" -#include "assimp/postprocess.h" +#include "postprocess.h" struct BoneWeight { CPT(JointVertexTransform) joint_vertex_xform; diff --git a/pandatool/src/assimp/assimpLoader.h b/pandatool/src/assimp/assimpLoader.h index 85dd7f59a0..41ac3e1dc6 100644 --- a/pandatool/src/assimp/assimpLoader.h +++ b/pandatool/src/assimp/assimpLoader.h @@ -20,8 +20,8 @@ #include "texture.h" #include "pmap.h" -#include "assimp/scene.h" -#include "assimp/Importer.hpp" +#include "scene.h" +#include "Importer.hpp" class Character; class CharacterJointBundle; diff --git a/pandatool/src/assimp/pandaIOStream.h b/pandatool/src/assimp/pandaIOStream.h index 913f96a740..cb4ddf251c 100644 --- a/pandatool/src/assimp/pandaIOStream.h +++ b/pandatool/src/assimp/pandaIOStream.h @@ -16,7 +16,7 @@ #include "config_assimp.h" -#include "assimp/IOStream.hpp" +#include "IOStream.hpp" class PandaIOSystem; diff --git a/pandatool/src/assimp/pandaIOSystem.h b/pandatool/src/assimp/pandaIOSystem.h index cbf3d9cf6d..f38223381c 100644 --- a/pandatool/src/assimp/pandaIOSystem.h +++ b/pandatool/src/assimp/pandaIOSystem.h @@ -17,7 +17,7 @@ #include "config_assimp.h" #include "virtualFileSystem.h" -#include "assimp/IOSystem.hpp" +#include "IOSystem.hpp" /** * Custom implementation of Assimp::IOSystem. diff --git a/pandatool/src/assimp/pandaLogger.cxx b/pandatool/src/assimp/pandaLogger.cxx index d503dc3fbe..cab31e1c06 100644 --- a/pandatool/src/assimp/pandaLogger.cxx +++ b/pandatool/src/assimp/pandaLogger.cxx @@ -13,7 +13,7 @@ #include "pandaLogger.h" -#include "assimp/DefaultLogger.hpp" +#include "DefaultLogger.hpp" PandaLogger *PandaLogger::_ptr = NULL; diff --git a/pandatool/src/assimp/pandaLogger.h b/pandatool/src/assimp/pandaLogger.h index 799784e7fc..a9bcbb40af 100644 --- a/pandatool/src/assimp/pandaLogger.h +++ b/pandatool/src/assimp/pandaLogger.h @@ -16,7 +16,7 @@ #include "config_assimp.h" -#include "assimp/Logger.hpp" +#include "Logger.hpp" /** * Custom implementation of Assimp::Logger. It simply wraps around the diff --git a/pandatool/src/bam/bamInfo.cxx b/pandatool/src/bam/bamInfo.cxx index 9c3403dc00..44d015c2fe 100644 --- a/pandatool/src/bam/bamInfo.cxx +++ b/pandatool/src/bam/bamInfo.cxx @@ -24,7 +24,6 @@ #include "pvector.h" #include "bamCacheRecord.h" #include "bamCacheIndex.h" -#include "pystub.h" /** * @@ -322,9 +321,6 @@ list_hierarchy(PandaNode *node, int indent_level) { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - BamInfo prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/bam/bamToEgg.cxx b/pandatool/src/bam/bamToEgg.cxx index b3a2c48535..7f70255ce9 100644 --- a/pandatool/src/bam/bamToEgg.cxx +++ b/pandatool/src/bam/bamToEgg.cxx @@ -13,7 +13,6 @@ #include "bamToEgg.h" #include "save_egg_file.h" -#include "pystub.h" #include "string_utils.h" #include "bamFile.h" #include "bamCacheRecord.h" @@ -98,9 +97,6 @@ run() { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - BamToEgg prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/bam/eggToBam.cxx b/pandatool/src/bam/eggToBam.cxx index ce9f2884a6..238eba17cf 100644 --- a/pandatool/src/bam/eggToBam.cxx +++ b/pandatool/src/bam/eggToBam.cxx @@ -31,7 +31,6 @@ #include "load_prc_file.h" #include "windowProperties.h" #include "frameBufferProperties.h" -#include "pystub.h" /** * @@ -485,9 +484,6 @@ make_buffer() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggToBam prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/bam/ptsToBam.cxx b/pandatool/src/bam/ptsToBam.cxx index d1d55056e4..5f570d309b 100644 --- a/pandatool/src/bam/ptsToBam.cxx +++ b/pandatool/src/bam/ptsToBam.cxx @@ -19,7 +19,6 @@ #include "pandaNode.h" #include "geomNode.h" #include "dcast.h" -#include "pystub.h" #include "string_utils.h" #include "config_egg2pg.h" @@ -230,9 +229,6 @@ close_vertex_data() { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - PtsToBam prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/configfiles/.gitignore b/pandatool/src/configfiles/.gitignore deleted file mode 100644 index 04c04a48d7..0000000000 --- a/pandatool/src/configfiles/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/30_pandatool.prc diff --git a/pandatool/src/cvscopy/testCopy.cxx b/pandatool/src/cvscopy/testCopy.cxx index 8f9fbce3a4..4947bc8d5c 100644 --- a/pandatool/src/cvscopy/testCopy.cxx +++ b/pandatool/src/cvscopy/testCopy.cxx @@ -13,7 +13,6 @@ #include "testCopy.h" #include "cvsSourceDirectory.h" -#include "pystub.h" /** * @@ -59,9 +58,6 @@ copy_file(const Filename &source, const Filename &dest, int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - TestCopy prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/daeegg/daeCharacter.cxx b/pandatool/src/daeegg/daeCharacter.cxx index 0d6e0d1e39..31d8db02cb 100644 --- a/pandatool/src/daeegg/daeCharacter.cxx +++ b/pandatool/src/daeegg/daeCharacter.cxx @@ -177,7 +177,7 @@ influence_vertex(int index, EggVertex *vertex) { for (size_t pa = 0; pa < influence->GetPairCount(); ++pa) { const FCDJointWeightPair* jwpair = influence->GetPair(pa); - if (jwpair->jointIndex >= 0 && jwpair->jointIndex < _joints.size()) { + if (jwpair->jointIndex >= 0 && jwpair->jointIndex < (int)_joints.size()) { EggGroup *joint = _joints[jwpair->jointIndex]._group.p(); if (joint != NULL) { joint->ref_vertex(vertex, jwpair->weight); diff --git a/pandatool/src/daeprogs/daeToEgg.cxx b/pandatool/src/daeprogs/daeToEgg.cxx index c96f656100..c3ba781361 100644 --- a/pandatool/src/daeprogs/daeToEgg.cxx +++ b/pandatool/src/daeprogs/daeToEgg.cxx @@ -14,7 +14,6 @@ #include "daeToEgg.h" #include "daeToEggConverter.h" -#include "pystub.h" /** * @@ -76,9 +75,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - DAEToEgg prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/daeprogs/eggToDAE.cxx b/pandatool/src/daeprogs/eggToDAE.cxx index 31b8f24d5d..dff2286b88 100644 --- a/pandatool/src/daeprogs/eggToDAE.cxx +++ b/pandatool/src/daeprogs/eggToDAE.cxx @@ -13,7 +13,6 @@ #include "eggToDAE.h" #include "dcast.h" -#include "pystub.h" #include "pandaVersion.h" #include "FCDocument/FCDocument.h" @@ -165,9 +164,6 @@ void EggToDAE::apply_transform(FCDSceneNode* to, const PT(EggGroup) from) { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggToDAE prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/dxfprogs/dxfPoints.cxx b/pandatool/src/dxfprogs/dxfPoints.cxx index 2dba8ae801..c0002b2826 100644 --- a/pandatool/src/dxfprogs/dxfPoints.cxx +++ b/pandatool/src/dxfprogs/dxfPoints.cxx @@ -12,7 +12,6 @@ */ #include "dxfPoints.h" -#include "pystub.h" /** * @@ -83,9 +82,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - DXFPoints prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/dxfprogs/dxfToEgg.cxx b/pandatool/src/dxfprogs/dxfToEgg.cxx index 512c790b96..4ca66f0a94 100644 --- a/pandatool/src/dxfprogs/dxfToEgg.cxx +++ b/pandatool/src/dxfprogs/dxfToEgg.cxx @@ -14,7 +14,6 @@ #include "dxfToEgg.h" #include "dxfToEggConverter.h" -#include "pystub.h" /** * @@ -68,9 +67,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - DXFToEgg prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/dxfprogs/eggToDXF.cxx b/pandatool/src/dxfprogs/eggToDXF.cxx index 3a3b24d564..e3fb8a85d5 100644 --- a/pandatool/src/dxfprogs/eggToDXF.cxx +++ b/pandatool/src/dxfprogs/eggToDXF.cxx @@ -14,7 +14,6 @@ #include "eggToDXF.h" #include "eggPolygon.h" #include "dcast.h" -#include "pystub.h" /** * @@ -143,9 +142,6 @@ write_entities(ostream &out) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggToDXF prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/egg-mkfont/eggMakeFont.cxx b/pandatool/src/egg-mkfont/eggMakeFont.cxx index f51fbebc7a..024f302199 100644 --- a/pandatool/src/egg-mkfont/eggMakeFont.cxx +++ b/pandatool/src/egg-mkfont/eggMakeFont.cxx @@ -29,7 +29,6 @@ #include "eggVertex.h" #include "string_utils.h" #include "dcast.h" -#include "pystub.h" #include @@ -737,9 +736,6 @@ is_numeric(const string &str) { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggMakeFont prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/egg-optchar/eggOptchar.cxx b/pandatool/src/egg-optchar/eggOptchar.cxx index d6f541045e..bc1d3058b3 100644 --- a/pandatool/src/egg-optchar/eggOptchar.cxx +++ b/pandatool/src/egg-optchar/eggOptchar.cxx @@ -31,7 +31,6 @@ #include "pset.h" #include "compose_matrix.h" #include "fftCompressor.h" -#include "pystub.h" #include @@ -1508,13 +1507,10 @@ do_defpose() { nassertv(anim_index != -1); // Now we can recursively apply the default pose to the hierarchy. - ch->get_root_joint()->apply_default_pose(anim_index, frame); + root_joint->apply_default_pose(anim_index, frame); } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggOptchar prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/egg-palettize/eggPalettize.cxx b/pandatool/src/egg-palettize/eggPalettize.cxx index cefec3d589..200b62e798 100644 --- a/pandatool/src/egg-palettize/eggPalettize.cxx +++ b/pandatool/src/egg-palettize/eggPalettize.cxx @@ -23,7 +23,6 @@ #include "pnotify.h" #include "notifyCategory.h" #include "notifySeverity.h" -#include "pystub.h" #include @@ -866,9 +865,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggPalettize prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/egg-qtess/eggQtess.cxx b/pandatool/src/egg-qtess/eggQtess.cxx index df0e63e830..21bc6317fb 100644 --- a/pandatool/src/egg-qtess/eggQtess.cxx +++ b/pandatool/src/egg-qtess/eggQtess.cxx @@ -14,7 +14,6 @@ #include "eggQtess.h" #include "qtessGlobals.h" #include "dcast.h" -#include "pystub.h" /** * @@ -331,9 +330,6 @@ find_surfaces(EggNode *egg_node) { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggQtess prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggbase/eggMultiBase.cxx b/pandatool/src/eggbase/eggMultiBase.cxx index 1e1d548793..cc591d4c18 100644 --- a/pandatool/src/eggbase/eggMultiBase.cxx +++ b/pandatool/src/eggbase/eggMultiBase.cxx @@ -104,6 +104,33 @@ post_process_egg_files() { // Do nothing. break; } + + if (_got_tbnall) { + for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) { + if ((*ei)->recompute_tangent_binormal(GlobPattern("*"))) { + (*ei)->remove_unused_vertices(true); + } + } + } else { + if (_got_tbnauto) { + for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) { + if ((*ei)->recompute_tangent_binormal_auto()) { + (*ei)->remove_unused_vertices(true); + } + } + } + + for (vector_string::const_iterator si = _tbn_names.begin(); + si != _tbn_names.end(); + ++si) { + GlobPattern uv_name(*si); + nout << "Computing tangent and binormal for \"" << uv_name << "\"\n"; + for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) { + (*ei)->recompute_tangent_binormal(uv_name); + (*ei)->remove_unused_vertices(true); + } + } + } } diff --git a/pandatool/src/eggbase/eggReader.cxx b/pandatool/src/eggbase/eggReader.cxx index 2c2d2a0a0e..72d0007fb3 100644 --- a/pandatool/src/eggbase/eggReader.cxx +++ b/pandatool/src/eggbase/eggReader.cxx @@ -170,11 +170,17 @@ handle_args(ProgramBase::Args &args) { Filename filename = Filename::from_os_specific(*ai); EggData file_data; - if (!file_data.read(filename)) { - // Rather than returning false, we simply exit here, so the ProgramBase - // won't try to tell the user how to run the program just because we got - // a bad egg file. - exit(1); + if (filename != "-") { + if (!file_data.read(filename)) { + // Rather than returning false, we simply exit here, so the ProgramBase + // won't try to tell the user how to run the program just because we got + // a bad egg file. + exit(1); + } + } else { + if (!file_data.read(cin)) { + exit(1); + } } if (_noabs && file_data.original_had_absolute_pathnames()) { diff --git a/pandatool/src/eggprogs/eggCrop.cxx b/pandatool/src/eggprogs/eggCrop.cxx index 64f2e017b4..38edb93284 100644 --- a/pandatool/src/eggprogs/eggCrop.cxx +++ b/pandatool/src/eggprogs/eggCrop.cxx @@ -17,7 +17,6 @@ #include "eggPrimitive.h" #include "eggVertex.h" #include "dcast.h" -#include "pystub.h" /** * @@ -118,9 +117,6 @@ strip_prims(EggGroupNode *group) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggCrop prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggListTextures.cxx b/pandatool/src/eggprogs/eggListTextures.cxx index 3174e5ad87..c804a8110b 100644 --- a/pandatool/src/eggprogs/eggListTextures.cxx +++ b/pandatool/src/eggprogs/eggListTextures.cxx @@ -14,7 +14,6 @@ #include "eggListTextures.h" #include "eggTextureCollection.h" #include "pnmImageHeader.h" -#include "pystub.h" /** * @@ -59,9 +58,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggListTextures prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggMakeTube.cxx b/pandatool/src/eggprogs/eggMakeTube.cxx index efda24d353..37adfd8d59 100644 --- a/pandatool/src/eggprogs/eggMakeTube.cxx +++ b/pandatool/src/eggprogs/eggMakeTube.cxx @@ -18,7 +18,6 @@ #include "eggPolygon.h" #include "pointerTo.h" #include "look_at.h" -#include "pystub.h" /** * @@ -264,9 +263,6 @@ add_polygon(EggVertex *a, EggVertex *b, EggVertex *c, EggVertex *d) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggMakeTube prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggRename.cxx b/pandatool/src/eggprogs/eggRename.cxx index ac28ae39b6..abde299e2d 100644 --- a/pandatool/src/eggprogs/eggRename.cxx +++ b/pandatool/src/eggprogs/eggRename.cxx @@ -12,7 +12,6 @@ */ #include "eggRename.h" -#include "pystub.h" /** * @@ -52,9 +51,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggRename prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggRetargetAnim.cxx b/pandatool/src/eggprogs/eggRetargetAnim.cxx index 82a825a8cc..f354eb57b9 100644 --- a/pandatool/src/eggprogs/eggRetargetAnim.cxx +++ b/pandatool/src/eggprogs/eggRetargetAnim.cxx @@ -21,7 +21,6 @@ #include "eggJointPointer.h" #include "eggTable.h" #include "compose_matrix.h" -#include "pystub.h" /** * @@ -186,9 +185,6 @@ retarget_anim(EggCharacterData *char_data, EggJointData *joint_data, int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggRetargetAnim prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggTextureCards.cxx b/pandatool/src/eggprogs/eggTextureCards.cxx index e0363af75a..03cb811809 100644 --- a/pandatool/src/eggprogs/eggTextureCards.cxx +++ b/pandatool/src/eggprogs/eggTextureCards.cxx @@ -19,7 +19,6 @@ #include "eggTexture.h" #include "eggPolygon.h" #include "pnmImageHeader.h" -#include "pystub.h" #include @@ -483,9 +482,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggTextureCards prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggToC.cxx b/pandatool/src/eggprogs/eggToC.cxx index 9a25e1615d..28fcb2f36e 100644 --- a/pandatool/src/eggprogs/eggToC.cxx +++ b/pandatool/src/eggprogs/eggToC.cxx @@ -21,7 +21,6 @@ #include "eggPolysetMaker.h" #include "eggBin.h" #include "string_utils.h" -#include "pystub.h" /** * @@ -364,9 +363,6 @@ write_bin(EggBin *bin) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggToC prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggTopstrip.cxx b/pandatool/src/eggprogs/eggTopstrip.cxx index 16c7b3371a..e0bbcf4e7e 100644 --- a/pandatool/src/eggprogs/eggTopstrip.cxx +++ b/pandatool/src/eggprogs/eggTopstrip.cxx @@ -21,7 +21,6 @@ #include "eggJointPointer.h" #include "eggTable.h" #include "compose_matrix.h" -#include "pystub.h" /** * @@ -343,9 +342,6 @@ adjust_transform(LMatrix4d &mat) const { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggTopstrip prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/eggprogs/eggTrans.cxx b/pandatool/src/eggprogs/eggTrans.cxx index 3f86d54903..28d439e617 100644 --- a/pandatool/src/eggprogs/eggTrans.cxx +++ b/pandatool/src/eggprogs/eggTrans.cxx @@ -13,7 +13,6 @@ #include "eggTrans.h" #include "eggGroupUniquifier.h" -#include "pystub.h" /** * @@ -131,9 +130,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggTrans prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/fltprogs/eggToFlt.cxx b/pandatool/src/fltprogs/eggToFlt.cxx index 36351af679..90e9d123a3 100644 --- a/pandatool/src/fltprogs/eggToFlt.cxx +++ b/pandatool/src/fltprogs/eggToFlt.cxx @@ -34,7 +34,6 @@ #include "dcast.h" #include "string_utils.h" #include "vector_string.h" -#include "pystub.h" /** * @@ -666,9 +665,6 @@ get_flt_texture(EggTexture *egg_texture) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggToFlt prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/fltprogs/fltCopy.cxx b/pandatool/src/fltprogs/fltCopy.cxx index ea5dfbde07..6ecb3b7833 100644 --- a/pandatool/src/fltprogs/fltCopy.cxx +++ b/pandatool/src/fltprogs/fltCopy.cxx @@ -19,7 +19,6 @@ #include "fltExternalReference.h" #include "fltError.h" #include "dcast.h" -#include "pystub.h" /** * @@ -231,9 +230,6 @@ scan_flt(FltRecord *record, FltCopy::Refs &refs, FltCopy::Textures &textures) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - FltCopy prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/fltprogs/fltInfo.cxx b/pandatool/src/fltprogs/fltInfo.cxx index 8f35093c73..a6d4649bff 100644 --- a/pandatool/src/fltprogs/fltInfo.cxx +++ b/pandatool/src/fltprogs/fltInfo.cxx @@ -15,7 +15,6 @@ #include "fltHeader.h" #include "indent.h" -#include "pystub.h" /** * @@ -91,9 +90,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - FltInfo prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/fltprogs/fltToEgg.cxx b/pandatool/src/fltprogs/fltToEgg.cxx index 6935e29c68..c08a8381d9 100644 --- a/pandatool/src/fltprogs/fltToEgg.cxx +++ b/pandatool/src/fltprogs/fltToEgg.cxx @@ -15,7 +15,6 @@ #include "fltToEggConverter.h" #include "config_flt.h" -#include "pystub.h" /** * @@ -99,9 +98,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - init_libflt(); FltToEgg prog; prog.parse_command_line(argc, argv); diff --git a/pandatool/src/fltprogs/fltTrans.cxx b/pandatool/src/fltprogs/fltTrans.cxx index 3fd6ae9656..692f8e374b 100644 --- a/pandatool/src/fltprogs/fltTrans.cxx +++ b/pandatool/src/fltprogs/fltTrans.cxx @@ -14,7 +14,6 @@ #include "fltTrans.h" #include "fltHeader.h" -#include "pystub.h" /** * @@ -127,9 +126,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - FltTrans prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/gtk-stats/gtkStats.cxx b/pandatool/src/gtk-stats/gtkStats.cxx index 9ad165fa29..b76bc292f3 100644 --- a/pandatool/src/gtk-stats/gtkStats.cxx +++ b/pandatool/src/gtk-stats/gtkStats.cxx @@ -15,7 +15,6 @@ #include "gtkStats.h" #include "gtkStatsServer.h" #include "config_pstats.h" -#include "pystub.h" GtkWidget *main_window; static GtkStatsServer *server = NULL; @@ -53,9 +52,6 @@ timer(gpointer data) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - gtk_init(&argc, &argv); main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); diff --git a/pandatool/src/imageprogs/imageFixHiddenColor.cxx b/pandatool/src/imageprogs/imageFixHiddenColor.cxx index 46ff3e5636..bb56bcc659 100644 --- a/pandatool/src/imageprogs/imageFixHiddenColor.cxx +++ b/pandatool/src/imageprogs/imageFixHiddenColor.cxx @@ -13,7 +13,6 @@ #include "imageFixHiddenColor.h" #include "string_utils.h" -#include "pystub.h" /** * @@ -143,9 +142,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - ImageFixHiddenColor prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/imageprogs/imageInfo.cxx b/pandatool/src/imageprogs/imageInfo.cxx index d445e028ee..175a5dba1d 100644 --- a/pandatool/src/imageprogs/imageInfo.cxx +++ b/pandatool/src/imageprogs/imageInfo.cxx @@ -13,7 +13,6 @@ #include "imageInfo.h" #include "pnmImageHeader.h" -#include "pystub.h" /** * @@ -88,9 +87,6 @@ is_power_2(int value) const { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - ImageInfo prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/imageprogs/imageResize.cxx b/pandatool/src/imageprogs/imageResize.cxx index 6b6a877490..ae5a746c1a 100644 --- a/pandatool/src/imageprogs/imageResize.cxx +++ b/pandatool/src/imageprogs/imageResize.cxx @@ -13,7 +13,6 @@ #include "imageResize.h" #include "string_utils.h" -#include "pystub.h" /** * @@ -117,9 +116,6 @@ dispatch_size_request(const string &opt, const string &arg, void *var) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - ImageResize prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/imageprogs/imageTrans.cxx b/pandatool/src/imageprogs/imageTrans.cxx index 68187459a7..da33516eeb 100644 --- a/pandatool/src/imageprogs/imageTrans.cxx +++ b/pandatool/src/imageprogs/imageTrans.cxx @@ -13,7 +13,6 @@ #include "imageTrans.h" #include "string_utils.h" -#include "pystub.h" /** * @@ -203,9 +202,6 @@ extract_alpha() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - ImageTrans prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/imageprogs/imageTransformColors.cxx b/pandatool/src/imageprogs/imageTransformColors.cxx index 2dfec7eab2..a18629f798 100644 --- a/pandatool/src/imageprogs/imageTransformColors.cxx +++ b/pandatool/src/imageprogs/imageTransformColors.cxx @@ -13,7 +13,6 @@ #include "imageTransformColors.h" #include "string_utils.h" -#include "pystub.h" #include "pnmImage.h" #include @@ -471,9 +470,6 @@ process_image(PNMImage &image) { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - ImageTransformColors prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/lwo/test_lwo.cxx b/pandatool/src/lwo/test_lwo.cxx index 3d06358ef5..b541fb8360 100644 --- a/pandatool/src/lwo/test_lwo.cxx +++ b/pandatool/src/lwo/test_lwo.cxx @@ -14,13 +14,9 @@ #include "lwoInputFile.h" #include "lwoChunk.h" #include "config_lwo.h" -#include "pystub.h" int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - init_liblwo(); if (argc != 2) { nout << "test_lwo file.lwo\n"; diff --git a/pandatool/src/lwoprogs/lwoScan.cxx b/pandatool/src/lwoprogs/lwoScan.cxx index 5b72a5be2d..a7fbf46933 100644 --- a/pandatool/src/lwoprogs/lwoScan.cxx +++ b/pandatool/src/lwoprogs/lwoScan.cxx @@ -16,7 +16,6 @@ #include "lwoInputFile.h" #include "lwoChunk.h" #include "config_lwo.h" -#include "pystub.h" /** * @@ -77,9 +76,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - init_liblwo(); LwoScan prog; prog.parse_command_line(argc, argv); diff --git a/pandatool/src/lwoprogs/lwoToEgg.cxx b/pandatool/src/lwoprogs/lwoToEgg.cxx index bfdc45cd33..a2e54b48ea 100644 --- a/pandatool/src/lwoprogs/lwoToEgg.cxx +++ b/pandatool/src/lwoprogs/lwoToEgg.cxx @@ -17,7 +17,6 @@ #include "lwoHeader.h" #include "lwoInputFile.h" #include "config_lwo.h" -#include "pystub.h" /** * @@ -80,9 +79,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - init_liblwo(); LwoToEgg prog; prog.parse_command_line(argc, argv); diff --git a/pandatool/src/maxegg/maxEggLoader.cxx b/pandatool/src/maxegg/maxEggLoader.cxx index 222738493e..ba4c705965 100644 --- a/pandatool/src/maxegg/maxEggLoader.cxx +++ b/pandatool/src/maxegg/maxEggLoader.cxx @@ -279,7 +279,7 @@ void MaxEggJoint::CreateMaxBone(void) _node->SetRenderable(FALSE); #ifdef _UNICODE - TCHAR *wname [1024]; + TCHAR wname[1024]; wname[1023] = 0; mbstowcs(wname, _egg_joint->get_name().c_str(), 1023); _node->SetName(wname); @@ -452,7 +452,14 @@ MaxEggMesh *MaxEggLoader::GetMesh(EggVertexPool *pool) result->_tvert_count = 0; result->_cvert_count = 0; result->_face_count = 0; - result->_node->SetName(TSTR(name.c_str())); +#ifdef _UNICODE + TCHAR wname[1024]; + wname[1023] = 0; + mbstowcs(wname, name.c_str(), 1023); + result->_node->SetName(wname); +#else + result->_node->SetName((char*) name.c_str()); +#endif _mesh_tab[pool] = result; } return result; diff --git a/pandatool/src/maxegg/maxToEggConverter.cxx b/pandatool/src/maxegg/maxToEggConverter.cxx index f0df22ddca..b07c1fd77d 100644 --- a/pandatool/src/maxegg/maxToEggConverter.cxx +++ b/pandatool/src/maxegg/maxToEggConverter.cxx @@ -565,7 +565,14 @@ make_nurbs_curve(INode *max_node, NURBSCVCurve *curve, return false; } +#ifdef _UNICODE + char mbname[1024]; + mbname[1023] = 0; + wcstombs(mbname, max_node->GetName(), 1023); + string name(mbname); +#else string name = max_node->GetName(); +#endif string vpool_name = name + ".cvs"; EggVertexPool *vpool = new EggVertexPool(vpool_name); @@ -624,7 +631,15 @@ make_polyset(INode *max_node, Mesh *mesh, // separate vertices. So instead of adding all the vertices up front, // we'll start with an empty vpool, and add vertices to it on the fly. +#ifdef _UNICODE + char mbname[1024]; + mbname[1023] = 0; + wcstombs(mbname, max_node->GetName(), 1023); + string node_name(mbname); +#else string node_name = max_node->GetName(); +#endif + string vpool_name = node_name + ".verts"; EggVertexPool *vpool = new EggVertexPool(vpool_name); egg_group->add_child(vpool); diff --git a/pandatool/src/maxprogs/maxEggImport.cxx b/pandatool/src/maxprogs/maxEggImport.cxx index 52a9cd369f..8565a612b4 100644 --- a/pandatool/src/maxprogs/maxEggImport.cxx +++ b/pandatool/src/maxprogs/maxEggImport.cxx @@ -178,7 +178,8 @@ static INT_PTR CALLBACK ImportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM return TRUE; } -int MaxEggImporter::DoImport(const TCHAR *name,ImpInterface *ii,Interface *i, BOOL suppressPrompts) { +int MaxEggImporter:: +DoImport(const TCHAR *name, ImpInterface *ii, Interface *i, BOOL suppressPrompts) { // Prompt the user with our dialogbox. if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_IMPORT_DLG), i->GetMAXHWnd(), ImportDlgProc, (LPARAM)this)) { @@ -187,13 +188,23 @@ int MaxEggImporter::DoImport(const TCHAR *name,ImpInterface *ii,Interface *i, BO std::ostringstream log; Notify::ptr()->set_ostream_ptr(&log, false); + +#ifdef _UNICODE + char sname[2048]; + sname[2047] = 0; + wcstombs(sname, name, 2047); + bool ok = MaxLoadEggFile(sname, _merge ? true:false, _importmodel ? true:false, _importanim ? true:false); +#else bool ok = MaxLoadEggFile(name, _merge ? true:false, _importmodel ? true:false, _importanim ? true:false); +#endif + string txt = log.str(); if (txt != "") { - MessageBox(NULL, txt.c_str(), "Panda3D Importer", MB_OK); - } else { - if (!ok) MessageBox(NULL, "Import Failed, unknown reason\n", "Panda3D Importer", MB_OK); + MessageBoxA(NULL, txt.c_str(), "Panda3D Importer", MB_OK); + } else if (!ok) { + MessageBoxA(NULL, "Import Failed, unknown reason\n", "Panda3D Importer", MB_OK); } + Notify::ptr()->set_ostream_ptr(NULL, false); return 1; } diff --git a/pandatool/src/maya/post_maya_include.h b/pandatool/src/maya/post_maya_include.h index 341266fe9a..34e7152b63 100644 --- a/pandatool/src/maya/post_maya_include.h +++ b/pandatool/src/maya/post_maya_include.h @@ -13,9 +13,3 @@ // This header file works in conjunction with pre_maya_include.h; it cleans up // some of the definitions that it left open. - -// Remove the symbols defined from pre_maya_include.h. -#ifdef MAYA_PRE_5_0 -#undef ostream -#undef istream -#endif // MAYA_PRE_5_0 diff --git a/pandatool/src/maya/pre_maya_include.h b/pandatool/src/maya/pre_maya_include.h index d1b18b21de..0244ec7ba4 100644 --- a/pandatool/src/maya/pre_maya_include.h +++ b/pandatool/src/maya/pre_maya_include.h @@ -27,30 +27,6 @@ #define _BOOL 1 #endif -#ifdef MAYA_PRE_5_0 -// Old versions of Maya, before version 5.0, used etc. instead of -// the new headers. This requires some workarounds to make this -// work compatibly with Panda, which uses the new headers. - -// In windows, the antiquated headers define completely unrelated (and -// incompatible) classes from those declared in the new headers. On the other -// hand, in gcc the antiquated headers seem to be references to the new -// template classes, so under gcc we also have to declare typedefs to make -// this work. -#ifdef __GNUC__ -#ifndef PRE_MAYA_INCLUDE_H -#define PRE_MAYA_INCLUDE_H -#include -typedef ostream maya_ostream; -typedef istream maya_istream; -#endif -#endif // __GNUC__ - -#define ostream maya_ostream -#define istream maya_istream - -#else // MAYA_PRE_5_0 - // In Maya 5.0, the headers seem to provide the manifest REQUIRE_IOSTREAM, // which forces it to use the new headers instead of the old // headers. It also says this is for Linux only, but it seems to @@ -68,5 +44,3 @@ typedef istream maya_istream; #include #endif #endif - -#endif // MAYA_PRE_5_0 diff --git a/pandatool/src/mayaprogs/eggToMaya.cxx b/pandatool/src/mayaprogs/eggToMaya.cxx index 48ac972aea..da944e58e6 100644 --- a/pandatool/src/mayaprogs/eggToMaya.cxx +++ b/pandatool/src/mayaprogs/eggToMaya.cxx @@ -14,9 +14,6 @@ #include "eggToMaya.h" #include "mayaEggLoader.h" #include "mayaApi.h" -#ifdef _WIN32 - #include "pystub.h" -#endif // We must define this to prevent Maya from doubly-declaring its MApiVersion // string in this file as well as in libmayaegg. @@ -128,13 +125,6 @@ run() { } int main(int argc, char *argv[]) { - // We don't want pystub on linux, since it gives problems with Maya's - // python. -#ifdef _WIN32 - // A call to pystub() to force libpystub.so to be linked in. - pystub(); -#endif - EggToMaya prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/mayaprogs/mayaCopy.cxx b/pandatool/src/mayaprogs/mayaCopy.cxx index eeb11eda4e..70cb614a2d 100644 --- a/pandatool/src/mayaprogs/mayaCopy.cxx +++ b/pandatool/src/mayaprogs/mayaCopy.cxx @@ -18,9 +18,6 @@ #include "cvsSourceDirectory.h" #include "mayaShader.h" #include "dcast.h" -#ifdef _WIN32 - #include "pystub.h" -#endif #include "pre_maya_include.h" #include @@ -449,13 +446,6 @@ collect_shader_for_node(const MDagPath &dag_path) { int main(int argc, char *argv[]) { - // We don't want pystub on linux, since it gives problems with Maya's - // python. -#ifdef _WIN32 - // A call to pystub() to force libpystub.so to be linked in. - pystub(); -#endif - MayaCopy prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/mayaprogs/mayaToEgg.cxx b/pandatool/src/mayaprogs/mayaToEgg.cxx index a7a4cfe7c6..5ceb4cf1ee 100644 --- a/pandatool/src/mayaprogs/mayaToEgg.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg.cxx @@ -43,9 +43,6 @@ #include "config_mayaegg.h" #include "config_maya.h" // for maya_cat #include "globPattern.h" -#ifdef _WIN32 - #include "pystub.h" -#endif /** * @@ -336,13 +333,6 @@ dispatch_transform_type(const string &opt, const string &arg, void *var) { } int main(int argc, char *argv[]) { - // We don't want pystub on linux, since it gives problems with Maya's - // python. -#ifdef _WIN32 - // A call to pystub() to force libpystub.so to be linked in. - pystub(); -#endif - MayaToEgg prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/mayaprogs/mayaToEgg_client.cxx b/pandatool/src/mayaprogs/mayaToEgg_client.cxx index d5d3f40c9f..dfde2661c1 100644 --- a/pandatool/src/mayaprogs/mayaToEgg_client.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg_client.cxx @@ -12,9 +12,6 @@ */ #include "mayaToEgg_client.h" -#ifdef _WIN32 - #include "pystub.h" -#endif /** * @@ -31,13 +28,6 @@ MayaToEggClient() : } int main(int argc, char *argv[]) { - // We don't want pystub on linux, since it gives problems with Maya's - // python. -#ifdef _WIN32 - // A call to pystub() to force libpystub.so to be linked in. - pystub(); -#endif - MayaToEggClient prog; // Open a connection to the server process PT(Connection) con = prog.qManager->open_TCP_client_connection(prog.server,0); diff --git a/pandatool/src/mayaprogs/mayaToEgg_server.cxx b/pandatool/src/mayaprogs/mayaToEgg_server.cxx index 19fd9ac22f..30f88f99d0 100644 --- a/pandatool/src/mayaprogs/mayaToEgg_server.cxx +++ b/pandatool/src/mayaprogs/mayaToEgg_server.cxx @@ -19,9 +19,6 @@ #include "config_mayaegg.h" #include "config_maya.h" // for maya_cat #include "globPattern.h" -#ifdef _WIN32 - #include "pystub.h" -#endif /** * @@ -458,13 +455,6 @@ poll() { } // poll int main(int argc, char *argv[]) { - // We don't want pystub on linux, since it gives problems with Maya's - // python. -#ifdef _WIN32 - // A call to pystub() to force libpystub.so to be linked in. - pystub(); -#endif - MayaToEggServer prog; // Open a rendezvous port for receiving new connections from the client PT(Connection) rend = prog.qManager->open_TCP_server_rendezvous(4242, 50); diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index b0576147f0..aac472759d 100644 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -49,10 +49,6 @@ #include #endif -#ifdef HAVE_PYTHON -#include "pystub.h" -#endif - #define QUOTESTR(x) #x #define TOSTRING(x) QUOTESTR(x) @@ -187,11 +183,6 @@ get_maya_location(const char *ver, string &loc) { int main(int argc, char *argv[]) { -#ifdef HAVE_PYTHON - // Force pystub to be linked in. - pystub(); -#endif - // First, get the command line and append _bin, so we will actually run // maya2egg_bin.exe, egg2maya_bin.exe, etc. Filename command = Filename::from_os_specific(argv[0]); diff --git a/pandatool/src/miscprogs/binToC.cxx b/pandatool/src/miscprogs/binToC.cxx index 3f1b188441..8d1ee2dec8 100644 --- a/pandatool/src/miscprogs/binToC.cxx +++ b/pandatool/src/miscprogs/binToC.cxx @@ -12,7 +12,6 @@ */ #include "binToC.h" -#include "pystub.h" // The number of bytes across the page to write. static const int col_width = 11; @@ -144,9 +143,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - BinToC prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/objprogs/eggToObj.cxx b/pandatool/src/objprogs/eggToObj.cxx index a3f7a79171..aac15220e9 100644 --- a/pandatool/src/objprogs/eggToObj.cxx +++ b/pandatool/src/objprogs/eggToObj.cxx @@ -12,7 +12,6 @@ */ #include "eggToObj.h" -#include "pystub.h" #include "eggPolygon.h" #include "eggGroupNode.h" #include "dcast.h" @@ -76,9 +75,6 @@ handle_args(ProgramBase::Args &args) { } int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - EggToObj prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/objprogs/objToEgg.cxx b/pandatool/src/objprogs/objToEgg.cxx index db551440ae..9a46aa7166 100644 --- a/pandatool/src/objprogs/objToEgg.cxx +++ b/pandatool/src/objprogs/objToEgg.cxx @@ -14,7 +14,6 @@ #include "objToEgg.h" #include "objToEggConverter.h" -#include "pystub.h" /** * @@ -68,9 +67,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - ObjToEgg prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/pfmprogs/pfmBba.cxx b/pandatool/src/pfmprogs/pfmBba.cxx index cf9d47d2ab..5517e45a63 100644 --- a/pandatool/src/pfmprogs/pfmBba.cxx +++ b/pandatool/src/pfmprogs/pfmBba.cxx @@ -14,7 +14,6 @@ #include "pfmBba.h" #include "config_pfm.h" #include "pfmFile.h" -#include "pystub.h" /** * @@ -136,9 +135,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - PfmBba prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/pfmprogs/pfmTrans.cxx b/pandatool/src/pfmprogs/pfmTrans.cxx index 02608c60f0..270d6a03af 100644 --- a/pandatool/src/pfmprogs/pfmTrans.cxx +++ b/pandatool/src/pfmprogs/pfmTrans.cxx @@ -15,7 +15,6 @@ #include "config_pfm.h" #include "pfmFile.h" #include "pfmVizzer.h" -#include "pystub.h" #include "texture.h" #include "texturePool.h" #include "pointerTo.h" @@ -504,9 +503,6 @@ dispatch_translate(const string &opt, const string &arg, void *var) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - PfmTrans prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/progbase/test_prog.cxx b/pandatool/src/progbase/test_prog.cxx index 7a4cd02529..5123385cc5 100644 --- a/pandatool/src/progbase/test_prog.cxx +++ b/pandatool/src/progbase/test_prog.cxx @@ -14,7 +14,6 @@ #include "programBase.h" #include "pnotify.h" -#include "pystub.h" class TestProgram : public ProgramBase { public: @@ -59,9 +58,6 @@ TestProgram() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - TestProgram t; t.parse_command_line(argc, argv); diff --git a/pandatool/src/softprogs/softCVS.cxx b/pandatool/src/softprogs/softCVS.cxx index bbc932659a..22329eb8c5 100644 --- a/pandatool/src/softprogs/softCVS.cxx +++ b/pandatool/src/softprogs/softCVS.cxx @@ -15,7 +15,6 @@ #include "pnotify.h" #include "multifile.h" -#include "pystub.h" #include @@ -580,9 +579,6 @@ cvs_add_or_remove(const string &cvs_command, const vector_string &paths) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - SoftCVS prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/text-stats/textStats.cxx b/pandatool/src/text-stats/textStats.cxx index 5b975cb798..2cbf69b4d9 100644 --- a/pandatool/src/text-stats/textStats.cxx +++ b/pandatool/src/text-stats/textStats.cxx @@ -16,7 +16,6 @@ #include "pStatServer.h" #include "config_pstats.h" -#include "pystub.h" #include @@ -99,9 +98,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - TextStats prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/vrml/.gitignore b/pandatool/src/vrml/.gitignore deleted file mode 100644 index 1a69860d3a..0000000000 --- a/pandatool/src/vrml/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/vrmlLexer.cxx -/vrmlParser.cxx -/vrmlParser.h diff --git a/pandatool/src/vrmlprogs/vrmlToEgg.cxx b/pandatool/src/vrmlprogs/vrmlToEgg.cxx index 613f55c84b..dee6b5eb39 100644 --- a/pandatool/src/vrmlprogs/vrmlToEgg.cxx +++ b/pandatool/src/vrmlprogs/vrmlToEgg.cxx @@ -14,7 +14,6 @@ #include "vrmlToEgg.h" #include "vrmlToEggConverter.h" -#include "pystub.h" /** * @@ -66,9 +65,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - VRMLToEgg prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/vrmlprogs/vrmlTrans.cxx b/pandatool/src/vrmlprogs/vrmlTrans.cxx index fd485eada0..e03075b0e5 100644 --- a/pandatool/src/vrmlprogs/vrmlTrans.cxx +++ b/pandatool/src/vrmlprogs/vrmlTrans.cxx @@ -13,7 +13,6 @@ #include "vrmlTrans.h" #include "parse_vrml.h" -#include "pystub.h" /** * @@ -88,9 +87,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - VRMLTrans prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/pandatool/src/win-stats/winStats.cxx b/pandatool/src/win-stats/winStats.cxx index 2ec39a7e83..e8995edaba 100644 --- a/pandatool/src/win-stats/winStats.cxx +++ b/pandatool/src/win-stats/winStats.cxx @@ -15,7 +15,6 @@ #include "winStatsServer.h" #include "config_pstats.h" -#include "pystub.h" #include diff --git a/pandatool/src/xfile/.gitignore b/pandatool/src/xfile/.gitignore deleted file mode 100644 index 0023fd48ae..0000000000 --- a/pandatool/src/xfile/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/xLexer.cxx -/xParser.cxx -/xParser.h diff --git a/pandatool/src/xfileprogs/eggToX.cxx b/pandatool/src/xfileprogs/eggToX.cxx index 37c0fc8658..a677a38176 100644 --- a/pandatool/src/xfileprogs/eggToX.cxx +++ b/pandatool/src/xfileprogs/eggToX.cxx @@ -13,7 +13,6 @@ #include "eggToX.h" #include "config_xfile.h" -#include "pystub.h" /** * @@ -70,9 +69,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - init_libxfile(); EggToX prog; prog.parse_command_line(argc, argv); diff --git a/pandatool/src/xfileprogs/xFileToEgg.cxx b/pandatool/src/xfileprogs/xFileToEgg.cxx index e7026b6642..fd0c90e77a 100644 --- a/pandatool/src/xfileprogs/xFileToEgg.cxx +++ b/pandatool/src/xfileprogs/xFileToEgg.cxx @@ -14,7 +14,6 @@ #include "xFileToEgg.h" #include "xFileToEggConverter.h" #include "config_xfile.h" -#include "pystub.h" /** * @@ -114,9 +113,6 @@ run() { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - init_libxfile(); XFileToEgg prog; prog.parse_command_line(argc, argv); diff --git a/pandatool/src/xfileprogs/xFileTrans.cxx b/pandatool/src/xfileprogs/xFileTrans.cxx index 0c5335055b..afe58b2538 100644 --- a/pandatool/src/xfileprogs/xFileTrans.cxx +++ b/pandatool/src/xfileprogs/xFileTrans.cxx @@ -13,7 +13,6 @@ #include "xFileTrans.h" #include "xFile.h" -#include "pystub.h" /** * @@ -90,9 +89,6 @@ handle_args(ProgramBase::Args &args) { int main(int argc, char *argv[]) { - // A call to pystub() to force libpystub.so to be linked in. - pystub(); - XFileTrans prog; prog.parse_command_line(argc, argv); prog.run(); diff --git a/samples/shadows/advanced.py b/samples/shadows/advanced.py index 7211f9a087..988e78df32 100755 --- a/samples/shadows/advanced.py +++ b/samples/shadows/advanced.py @@ -50,6 +50,7 @@ class World(DirectObject): props, winprops, GraphicsPipe.BFRefuseWindow, base.win.getGsg(), base.win) + self.buffer = LBuffer if not LBuffer: self.t = addTitle( @@ -73,9 +74,10 @@ class World(DirectObject): self.inst_w = addInstructions(0.12, 'W : stop/start the Walk Cycle') self.inst_t = addInstructions(0.18, 'T : stop/start the Teapot') self.inst_l = addInstructions(0.24, 'L : move light source far or close') - self.inst_v = addInstructions(0.30, 'V: View the Depth-Texture results') - self.inst_x = addInstructions(0.36, 'Left/Right Arrow : switch camera angles') - self.inst_a = addInstructions(0.42, 'Something about A/Z and push bias') + self.inst_v = addInstructions(0.30, 'V : View the Depth-Texture results') + self.inst_u = addInstructions(0.36, 'U : toggle updating the shadow map') + self.inst_x = addInstructions(0.42, 'Left/Right Arrow : switch camera angles') + self.inst_a = addInstructions(0.48, 'Something about A/Z and push bias') base.setBackgroundColor(0, 0, 0.2, 1) @@ -120,20 +122,14 @@ class World(DirectObject): self.accept("arrow_left", self.incrementCameraPosition, [-1]) self.accept("arrow_right", self.incrementCameraPosition, [1]) self.accept("p", self.toggleInterval, [self.pandaMovement]) - self.accept("P", self.toggleInterval, [self.pandaMovement]) self.accept("t", self.toggleInterval, [self.teapotMovement]) - self.accept("T", self.toggleInterval, [self.teapotMovement]) self.accept("w", self.toggleInterval, [self.pandaWalk]) - self.accept("W", self.toggleInterval, [self.pandaWalk]) self.accept("v", base.bufferViewer.toggleEnable) - self.accept("V", base.bufferViewer.toggleEnable) + self.accept("u", self.toggleUpdateShadowMap) self.accept("l", self.incrementLightPosition, [1]) - self.accept("L", self.incrementLightPosition, [1]) self.accept("o", base.oobe) self.accept('a', self.adjustPushBias, [1.1]) - self.accept('A', self.adjustPushBias, [1.1]) self.accept('z', self.adjustPushBias, [0.9]) - self.accept('Z', self.adjustPushBias, [0.9]) self.LCam = base.makeCamera(LBuffer) self.LCam.node().setScene(render) @@ -180,6 +176,9 @@ class World(DirectObject): else: ival.resume() + def toggleUpdateShadowMap(self): + self.buffer.active = not self.buffer.active + def incrementCameraPosition(self, n): self.cameraSelection = (self.cameraSelection + n) % 6 if (self.cameraSelection == 0): diff --git a/samples/shadows/basic.py b/samples/shadows/basic.py index 95de1198a2..843b9b9b27 100755 --- a/samples/shadows/basic.py +++ b/samples/shadows/basic.py @@ -42,8 +42,9 @@ class World(DirectObject): self.inst_w = addInstructions(0.12, 'W : stop/start the Walk Cycle') self.inst_t = addInstructions(0.18, 'T : stop/start the Teapot') self.inst_l = addInstructions(0.24, 'L : move light source far or close') - self.inst_v = addInstructions(0.30, 'V: View the Depth-Texture results') - self.inst_x = addInstructions(0.36, 'Left/Right Arrow : switch camera angles') + self.inst_v = addInstructions(0.30, 'V : View the Depth-Texture results') + self.inst_u = addInstructions(0.36, 'U : toggle updating the shadow map') + self.inst_x = addInstructions(0.42, 'Left/Right Arrow : switch camera angles') base.setBackgroundColor(0, 0, 0.2, 1) @@ -88,15 +89,11 @@ class World(DirectObject): self.accept("arrow_left", self.incrementCameraPosition, [-1]) self.accept("arrow_right", self.incrementCameraPosition, [1]) self.accept("p", self.toggleInterval, [self.pandaMovement]) - self.accept("P", self.toggleInterval, [self.pandaMovement]) self.accept("t", self.toggleInterval, [self.teapotMovement]) - self.accept("T", self.toggleInterval, [self.teapotMovement]) self.accept("w", self.toggleInterval, [self.pandaWalk]) - self.accept("W", self.toggleInterval, [self.pandaWalk]) self.accept("v", base.bufferViewer.toggleEnable) - self.accept("V", base.bufferViewer.toggleEnable) + self.accept("u", self.toggleUpdateShadowMap) self.accept("l", self.incrementLightPosition, [1]) - self.accept("L", self.incrementLightPosition, [1]) self.accept("o", base.oobe) self.light = render.attachNewNode(Spotlight("Spot")) @@ -127,6 +124,10 @@ class World(DirectObject): else: ival.resume() + def toggleUpdateShadowMap(self): + buffer = self.light.node().getShadowBuffer(base.win.gsg) + buffer.active = not buffer.active + def incrementCameraPosition(self, n): self.cameraSelection = (self.cameraSelection + n) % 6 if (self.cameraSelection == 0):