From ef986ccfc09dd831896e31198169b95f44f93819 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 24 Oct 2016 21:29:43 +0200 Subject: [PATCH 01/93] Texture.set_ram_image(_as) now directly accepts buffers with right component size --- panda/src/express/pointerToArray.h | 59 ++++++---- panda/src/gobj/p3gobj_ext_composite.cxx | 1 + panda/src/gobj/texture.h | 6 + panda/src/gobj/texture_ext.cxx | 147 ++++++++++++++++++++++++ panda/src/gobj/texture_ext.h | 37 ++++++ 5 files changed, 226 insertions(+), 24 deletions(-) create mode 100644 panda/src/gobj/texture_ext.cxx create mode 100644 panda/src/gobj/texture_ext.h diff --git a/panda/src/express/pointerToArray.h b/panda/src/express/pointerToArray.h index 2485f28759..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" 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/texture.h b/panda/src/gobj/texture.h index 1f125fd7ce..cd05019416 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -445,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; diff --git a/panda/src/gobj/texture_ext.cxx b/panda/src/gobj/texture_ext.cxx new file mode 100644 index 0000000000..2a462849c0 --- /dev/null +++ b/panda/src/gobj/texture_ext.cxx @@ -0,0 +1,147 @@ +/** + * 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" + +#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"); +} diff --git a/panda/src/gobj/texture_ext.h b/panda/src/gobj/texture_ext.h new file mode 100644 index 0000000000..f5b4bb4ccd --- /dev/null +++ b/panda/src/gobj/texture_ext.h @@ -0,0 +1,37 @@ +/** + * 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" + +/** + * 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 // CPPPARSER + +#endif // TEXTURE_EXT_H From 1049088f1174b4801b6e6d116b884c0a79a59aa3 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 24 Oct 2016 21:34:24 +0200 Subject: [PATCH 02/93] Clean up some of the dtool_config.h variables --- .../src/distributed/cConnectionRepository.cxx | 6 ++-- makepanda/makepanda.py | 33 ++++++++++--------- panda/src/audiotraits/openalAudioManager.h | 2 +- panda/src/audiotraits/openalAudioSound.h | 2 +- panda/src/downloader/httpClient.cxx | 6 ++-- panda/src/downloader/httpClient.h | 2 +- panda/src/express/multifile.cxx | 18 ++-------- 7 files changed, 29 insertions(+), 40 deletions(-) diff --git a/direct/src/distributed/cConnectionRepository.cxx b/direct/src/distributed/cConnectionRepository.cxx index 41fb3d6286..1781422930 100644 --- a/direct/src/distributed/cConnectionRepository.cxx +++ b/direct/src/distributed/cConnectionRepository.cxx @@ -403,7 +403,7 @@ send_datagram(const Datagram &dg) { #ifdef WANT_NATIVE_NET if (_native) { - bool result = _bdc.SendMessage(); + bool result = _bdc.SendMessage(dg); if (!result && _bdc.IsConnected()) { #ifdef HAVE_PYTHON ostringstream s; @@ -415,8 +415,8 @@ send_datagram(const Datagram &dg) { #endif s << endl << "Error sending message: " << endl; - msg.dump_hex(s); - s << "Message data: " << msg.get_data() << endl; + dg.dump_hex(s); + s << "Message data: " << dg.get_data() << endl; string message = s.str(); PyErr_SetString(exc_type, message.c_str()); diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 8cde77e0f7..d1def1ec8e 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2122,9 +2122,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'), @@ -2132,7 +2130,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'), @@ -2145,12 +2142,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'), @@ -2212,7 +2206,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'), @@ -2230,11 +2223,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'), @@ -2246,12 +2240,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'), @@ -2373,9 +2367,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' @@ -4425,8 +4416,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']) @@ -6005,8 +6005,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') 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/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/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 From e1ea1e8fb098bb0d73f9eff4bede0386ee9deba1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 24 Oct 2016 22:51:11 +0200 Subject: [PATCH 03/93] Fix link error on Windows with WANT_NATIVE_NET --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index d1def1ec8e..18c73e5f26 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -5080,7 +5080,7 @@ if (PkgSkip("DIRECT")==0): 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/ From 758cd523e24a4bed60181647a462bef5427762c3 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 27 Oct 2016 12:37:00 +0200 Subject: [PATCH 04/93] Don't use assimp/ prefix when including assimp files --- pandatool/src/assimp/assimpLoader.cxx | 2 +- pandatool/src/assimp/assimpLoader.h | 4 ++-- pandatool/src/assimp/pandaIOStream.h | 2 +- pandatool/src/assimp/pandaIOSystem.h | 2 +- pandatool/src/assimp/pandaLogger.cxx | 2 +- pandatool/src/assimp/pandaLogger.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) 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 From 81dd4d97ad7dfc622e3a8e7e33f22a9bcaa2a182 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 27 Oct 2016 13:56:02 +0200 Subject: [PATCH 05/93] Implement make_copy() for BulletRigidBodyNode This appears to be the last piece needed to load BulletRigidBodyNodes from BAM files. --- panda/src/bullet/bulletBodyNode.cxx | 19 ++++++++++++++++++ panda/src/bullet/bulletBodyNode.h | 1 + panda/src/bullet/bulletRigidBodyNode.cxx | 25 ++++++++++++++++++++++++ panda/src/bullet/bulletRigidBodyNode.h | 2 ++ 4 files changed, 47 insertions(+) diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index e8dbe968f2..6580c79722 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -36,6 +36,25 @@ 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) { + _shape = new btCompoundShape(copy._shape); + } + 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/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index cc5f5945f5..23c6d17afd 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -46,6 +46,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 = new MotionState(*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); +} + /** * */ diff --git a/panda/src/bullet/bulletRigidBodyNode.h b/panda/src/bullet/bulletRigidBodyNode.h index 2d6b54f2f3..42b2495aff 100644 --- a/panda/src/bullet/bulletRigidBodyNode.h +++ b/panda/src/bullet/bulletRigidBodyNode.h @@ -130,8 +130,10 @@ private: 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); From d43f0ef9099b0c8be4dea911e4834f8f97a043a2 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 28 Oct 2016 12:09:05 +0200 Subject: [PATCH 06/93] Fix DirectScrolledList regression --- direct/src/gui/DirectScrolledList.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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): From 59b0913b0b25dfcd5912060c8d940d15d0663cc6 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 30 Oct 2016 20:06:12 -0700 Subject: [PATCH 07/93] Cleanup .gitignore files Remove all .gitignore files in subdirectories and add a few new ignores to the top-level directory .gitignore file. --- .gitignore | 5 +++++ contrib/.gitignore | 9 --------- contrib/src/panda3dtoolsgui/.gitignore | 2 -- direct/.gitignore | 9 --------- direct/src/configfiles/.gitignore | 1 - direct/src/dcparser/.gitignore | 3 --- direct/src/extensions_native/.gitignore | 1 - direct/src/gui/.gitignore | 2 -- direct/src/p3d/.gitignore | 8 -------- direct/src/plugin/.gitignore | 1 - direct/src/plugin_activex/.gitignore | 1 - direct/src/plugin_npapi/.gitignore | 1 - direct/src/plugin_standalone/.gitignore | 2 -- direct/src/showutil/.gitignore | 1 - dmodels/.gitignore | 7 ------- dmodels/src/.gitignore | 6 ------ dtool/.gitignore | 7 ------- dtool/src/cppparser/.gitignore | 2 -- dtool/src/dtoolutil/.gitignore | 3 --- dtool/src/prc/.gitignore | 1 - makepanda/.gitignore | 2 -- panda/.gitignore | 8 -------- panda/src/configfiles/.gitignore | 1 - panda/src/egg/.gitignore | 3 --- panda/src/speedtree/.gitignore | 1 - pandatool/.gitignore | 6 ------ pandatool/src/configfiles/.gitignore | 1 - pandatool/src/vrml/.gitignore | 3 --- pandatool/src/xfile/.gitignore | 3 --- 29 files changed, 5 insertions(+), 95 deletions(-) delete mode 100644 contrib/.gitignore delete mode 100644 contrib/src/panda3dtoolsgui/.gitignore delete mode 100644 direct/.gitignore delete mode 100644 direct/src/configfiles/.gitignore delete mode 100644 direct/src/dcparser/.gitignore delete mode 100644 direct/src/extensions_native/.gitignore delete mode 100644 direct/src/gui/.gitignore delete mode 100644 direct/src/p3d/.gitignore delete mode 100644 direct/src/plugin/.gitignore delete mode 100644 direct/src/plugin_activex/.gitignore delete mode 100644 direct/src/plugin_npapi/.gitignore delete mode 100644 direct/src/plugin_standalone/.gitignore delete mode 100644 direct/src/showutil/.gitignore delete mode 100644 dmodels/.gitignore delete mode 100644 dmodels/src/.gitignore delete mode 100644 dtool/.gitignore delete mode 100644 dtool/src/cppparser/.gitignore delete mode 100644 dtool/src/dtoolutil/.gitignore delete mode 100644 dtool/src/prc/.gitignore delete mode 100644 makepanda/.gitignore delete mode 100644 panda/.gitignore delete mode 100644 panda/src/configfiles/.gitignore delete mode 100644 panda/src/egg/.gitignore delete mode 100644 panda/src/speedtree/.gitignore delete mode 100644 pandatool/.gitignore delete mode 100644 pandatool/src/configfiles/.gitignore delete mode 100644 pandatool/src/vrml/.gitignore delete mode 100644 pandatool/src/xfile/.gitignore diff --git a/.gitignore b/.gitignore index 8f3af151c7..44373e05fe 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,8 @@ CTestTestfile.cmake # Windows Thumbs.db ehthumbs.db + +# Python +__pycache__ +*.pyc +*.pyo 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/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/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/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/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_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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 From ed761f29978fdea38e3cfafb5dd504db4c4c99a7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 31 Oct 2016 20:14:48 +0100 Subject: [PATCH 08/93] Fix build without Python --- panda/src/gobj/texture_ext.cxx | 4 ++++ panda/src/gobj/texture_ext.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/panda/src/gobj/texture_ext.cxx b/panda/src/gobj/texture_ext.cxx index 2a462849c0..1e661e960a 100644 --- a/panda/src/gobj/texture_ext.cxx +++ b/panda/src/gobj/texture_ext.cxx @@ -13,6 +13,8 @@ #include "texture_ext.h" +#ifdef HAVE_PYTHON + #ifndef CPPPARSER extern Dtool_PyTypedObject Dtool_PointerToArray_unsigned_char; extern Dtool_PyTypedObject Dtool_ConstPointerToArray_unsigned_char; @@ -145,3 +147,5 @@ set_ram_image_as(PyObject *image, const string &provided_format) { 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 index f5b4bb4ccd..d33fce24ef 100644 --- a/panda/src/gobj/texture_ext.h +++ b/panda/src/gobj/texture_ext.h @@ -20,6 +20,8 @@ #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. @@ -32,6 +34,8 @@ public: void set_ram_image_as(PyObject *image, const string &provided_format); }; +#endif // HAVE_PYTHON + #endif // CPPPARSER #endif // TEXTURE_EXT_H From c822fb57af130d78392893d3117df51c79727525 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 31 Oct 2016 20:46:20 +0100 Subject: [PATCH 09/93] Changes suggested by liuzhengcai to fix 3dsmax 2014 build --- pandatool/src/maxprogs/maxEggImport.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pandatool/src/maxprogs/maxEggImport.cxx b/pandatool/src/maxprogs/maxEggImport.cxx index f72092300f..5e8dd94f16 100644 --- a/pandatool/src/maxprogs/maxEggImport.cxx +++ b/pandatool/src/maxprogs/maxEggImport.cxx @@ -179,9 +179,10 @@ static INT_PTR CALLBACK ImportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM return FALSE; } 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)) { @@ -190,13 +191,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; } From 4526de8f7ad198b9e2ac4c7f8e0ca7e34d24c7cb Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 31 Oct 2016 22:07:01 +0100 Subject: [PATCH 10/93] Fix exception when trying to pickle NodePathCollection objects --- doc/ReleaseNotes | 1 + panda/src/pgraph/nodePathCollection_ext.cxx | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index a05c4487e4..76c7add700 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -45,6 +45,7 @@ This issue fixes several bugs that were still found in 1.9.2. * 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 ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/pgraph/nodePathCollection_ext.cxx b/panda/src/pgraph/nodePathCollection_ext.cxx index 48898fb547..0f8c8cdc4a 100644 --- a/panda/src/pgraph/nodePathCollection_ext.cxx +++ b/panda/src/pgraph/nodePathCollection_ext.cxx @@ -84,16 +84,19 @@ __reduce__(PyObject *self) const { // (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); } //////////////////////////////////////////////////////////////////// From 5832ab8099f8880e8b8ca6404d5233c9e6187179 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 31 Oct 2016 22:10:47 +0100 Subject: [PATCH 11/93] Fix errors when trying to raise vectors to a power --- doc/ReleaseNotes | 1 + dtool/src/interrogate/interfaceMakerPythonNative.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 76c7add700..157a20b2bf 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -46,6 +46,7 @@ This issue fixes several bugs that were still found in 1.9.2. * 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 ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index db1825c079..014c98f438 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -2209,7 +2209,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); From 50e8d5d08d344e6ebca579f3f82348627bd87b1b Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 31 Oct 2016 22:33:52 +0100 Subject: [PATCH 12/93] Update stdint.h This adds missing definitions from the standard library header ` stdint.h` to the interrogate header. I also changed the `typedef` to the C++11 style `using`. Closes: #125 --- dtool/src/parser-inc/stdint.h | 48 +++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) 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 From 1467541b8d1df4364ca2bebad0d45620dfdc9f60 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 1 Nov 2016 12:17:49 +0100 Subject: [PATCH 13/93] Interrogate issues: "fix #pragma once" for files specified on command-line, fix "unexpected $end" not having line numbers when parsing template parameter list --- dtool/src/cppparser/cppFile.h | 2 +- dtool/src/cppparser/cppParser.cxx | 15 ++++++++++++++- dtool/src/cppparser/cppPreprocessor.cxx | 6 +++--- 3 files changed, 18 insertions(+), 5 deletions(-) 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/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/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index f0fe1c9819..a6ad3d1cad 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -951,7 +951,7 @@ internal_get_next_token() { case ',': if (_paren_nesting <= 0) { _state = S_end_nested; - return CPPToken::eof(); + return CPPToken(0, loc); } break; @@ -959,7 +959,7 @@ internal_get_next_token() { if (_paren_nesting <= 0) { _parsing_template_params = false; _state = S_end_nested; - return CPPToken::eof(); + return CPPToken(0, loc); } } } @@ -1639,7 +1639,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; } From 7bef96e71d2910d3dc9513079c256db30959f41a Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 3 Nov 2016 11:11:02 +0100 Subject: [PATCH 14/93] Don't give misleading error when image shader input is missing --- panda/src/glstuff/glShaderContext_src.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 60563af5db..3e1fe026f9 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -2413,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; From 7259425b7c1324192bdd55a5814c6a0530abb02b Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 3 Nov 2016 11:34:10 +0100 Subject: [PATCH 15/93] Let's do away with Geom-wide usage hints, it's not very useful --- .../glstuff/glGraphicsStateGuardian_src.cxx | 2 +- panda/src/gobj/geom.I | 29 -------- panda/src/gobj/geom.cxx | 74 +++++-------------- panda/src/gobj/geom.h | 10 +-- 4 files changed, 21 insertions(+), 94 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 0b36265eb6..296b38df76 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -3956,7 +3956,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 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; From 22f0b508510cf2daa9a5f7e555d463d1d45ecfe2 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 3 Nov 2016 12:13:06 +0100 Subject: [PATCH 16/93] More Interrogate C++11 support changes: * Parse variadic templates * Add (incomplete) type_traits support * Parse anonymous class template params * Parse volatile/lvalue/rvalue methods * Don't generate destructor for indestructible types * Add xmmintrin.h header * Allow invoking extensions with references --- dtool/src/cppparser/cppArrayType.cxx | 11 +- dtool/src/cppparser/cppArrayType.h | 1 + dtool/src/cppparser/cppBison.cxx.prebuilt | 9516 +++++++++-------- dtool/src/cppparser/cppBison.h.prebuilt | 492 +- dtool/src/cppparser/cppBison.yxx | 346 +- .../cppparser/cppClassTemplateParameter.cxx | 30 +- .../src/cppparser/cppClassTemplateParameter.h | 1 + dtool/src/cppparser/cppConstType.cxx | 43 +- dtool/src/cppparser/cppConstType.h | 5 + dtool/src/cppparser/cppDeclaration.cxx | 10 +- dtool/src/cppparser/cppDeclaration.h | 71 +- dtool/src/cppparser/cppExpression.cxx | 219 +- dtool/src/cppparser/cppExpression.h | 11 +- dtool/src/cppparser/cppExtensionType.cxx | 26 +- dtool/src/cppparser/cppExtensionType.h | 2 + dtool/src/cppparser/cppFunctionType.cxx | 11 +- dtool/src/cppparser/cppFunctionType.h | 3 + dtool/src/cppparser/cppInstance.cxx | 13 +- dtool/src/cppparser/cppInstance.h | 3 + dtool/src/cppparser/cppInstanceIdentifier.cxx | 14 +- dtool/src/cppparser/cppInstanceIdentifier.h | 4 + dtool/src/cppparser/cppPointerType.cxx | 65 + dtool/src/cppparser/cppPointerType.h | 2 + dtool/src/cppparser/cppPreprocessor.cxx | 58 +- dtool/src/cppparser/cppReferenceType.cxx | 79 + dtool/src/cppparser/cppReferenceType.h | 3 + dtool/src/cppparser/cppScope.cxx | 1 - dtool/src/cppparser/cppSimpleType.cxx | 53 + dtool/src/cppparser/cppSimpleType.h | 18 +- dtool/src/cppparser/cppStructType.cxx | 377 +- dtool/src/cppparser/cppStructType.h | 12 + dtool/src/cppparser/cppTemplateScope.cxx | 6 +- dtool/src/cppparser/cppType.cxx | 176 +- dtool/src/cppparser/cppType.h | 17 + dtool/src/cppparser/cppTypedefType.cxx | 41 + dtool/src/cppparser/cppTypedefType.h | 5 + dtool/src/interrogate/interrogateBuilder.cxx | 10 +- dtool/src/interrogatedb/extension.h | 16 + dtool/src/parser-inc/type_traits | 96 + dtool/src/parser-inc/xmmintrin.h | 1 + 40 files changed, 7175 insertions(+), 4693 deletions(-) create mode 100644 dtool/src/parser-inc/type_traits create mode 100644 dtool/src/parser-inc/xmmintrin.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 427e91bf55..dcc103b178 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 5547 +#define YYLAST 6206 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 150 +#define YYNTOKENS 168 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 104 +#define YYNNTS 107 /* YYNRULES -- Number of rules. */ -#define YYNRULES 672 +#define YYNRULES 733 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 1320 +#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,81 +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, 792, 796, 807, 811, 815, 819, 823, 827, 831, - 835, 839, 843, 847, 851, 859, 860, 864, 865, 870, - 869, 885, 894, 902, 910, 918, 929, 945, 944, 959, - 974, 983, 998, 997, 1022, 1021, 1049, 1048, 1079, 1078, - 1097, 1096, 1117, 1116, 1148, 1147, 1173, 1186, 1190, 1194, - 1198, 1202, 1206, 1211, 1215, 1226, 1230, 1234, 1238, 1242, - 1246, 1250, 1254, 1258, 1262, 1266, 1270, 1274, 1278, 1282, - 1286, 1290, 1294, 1298, 1302, 1306, 1310, 1314, 1318, 1322, - 1326, 1330, 1334, 1338, 1342, 1346, 1350, 1354, 1358, 1362, - 1366, 1370, 1374, 1378, 1385, 1386, 1391, 1390, 1398, 1402, - 1403, 1407, 1413, 1422, 1426, 1430, 1434, 1438, 1444, 1454, - 1458, 1463, 1475, 1479, 1493, 1508, 1513, 1518, 1523, 1528, - 1533, 1538, 1543, 1549, 1548, 1570, 1580, 1590, 1594, 1598, - 1607, 1611, 1616, 1620, 1625, 1633, 1638, 1646, 1650, 1655, - 1659, 1664, 1672, 1677, 1685, 1689, 1696, 1700, 1707, 1711, - 1715, 1719, 1723, 1730, 1734, 1738, 1742, 1746, 1750, 1757, - 1758, 1759, 1763, 1766, 1767, 1768, 1772, 1777, 1783, 1789, - 1800, 1804, 1814, 1818, 1822, 1827, 1832, 1837, 1842, 1847, - 1852, 1860, 1864, 1868, 1873, 1878, 1883, 1888, 1893, 1898, - 1903, 1909, 1917, 1921, 1926, 1931, 1936, 1941, 1946, 1951, - 1959, 1963, 1968, 1973, 1978, 1983, 1988, 1993, 1998, 2004, - 2011, 2018, 2028, 2032, 2040, 2044, 2048, 2052, 2056, 2072, - 2088, 2097, 2104, 2108, 2116, 2120, 2124, 2128, 2132, 2148, - 2164, 2182, 2191, 2198, 2202, 2210, 2214, 2230, 2246, 2255, - 2262, 2266, 2274, 2278, 2287, 2286, 2311, 2310, 2340, 2341, - 2348, 2349, 2353, 2354, 2358, 2362, 2366, 2370, 2374, 2378, - 2382, 2386, 2390, 2394, 2401, 2409, 2413, 2417, 2422, 2430, - 2434, 2441, 2442, 2447, 2454, 2455, 2460, 2468, 2472, 2476, - 2483, 2487, 2491, 2499, 2498, 2521, 2520, 2543, 2544, 2548, - 2554, 2561, 2570, 2571, 2572, 2576, 2580, 2584, 2588, 2592, - 2596, 2601, 2606, 2611, 2616, 2620, 2625, 2634, 2639, 2647, - 2651, 2655, 2663, 2673, 2673, 2683, 2684, 2688, 2689, 2690, - 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2698, 2698, 2698, - 2699, 2699, 2699, 2699, 2700, 2700, 2700, 2700, 2700, 2701, - 2701, 2701, 2702, 2702, 2702, 2702, 2702, 2703, 2703, 2703, - 2703, 2703, 2704, 2704, 2704, 2704, 2704, 2705, 2705, 2705, - 2705, 2705, 2706, 2706, 2706, 2706, 2707, 2707, 2707, 2707, - 2707, 2708, 2708, 2708, 2708, 2708, 2709, 2709, 2709, 2709, - 2709, 2709, 2710, 2710, 2710, 2710, 2710, 2711, 2711, 2711, - 2711, 2712, 2712, 2712, 2712, 2713, 2713, 2713, 2713, 2713, - 2714, 2714, 2714, 2715, 2715, 2715, 2715, 2715, 2716, 2716, - 2716, 2716, 2716, 2717, 2717, 2717, 2717, 2717, 2720, 2720, - 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2721, - 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2722, - 2722, 2726, 2730, 2737, 2741, 2748, 2752, 2759, 2763, 2767, - 2771, 2775, 2779, 2783, 2787, 2791, 2795, 2799, 2803, 2807, - 2811, 2815, 2819, 2823, 2827, 2831, 2835, 2839, 2843, 2847, - 2851, 2855, 2859, 2863, 2867, 2871, 2875, 2879, 2883, 2887, - 2891, 2895, 2899, 2903, 2911, 2915, 2919, 2923, 2927, 2931, - 2935, 2945, 2951, 2957, 2963, 2969, 2975, 2981, 2988, 2995, - 3002, 3009, 3015, 3021, 3025, 3029, 3033, 3037, 3048, 3059, - 3063, 3067, 3071, 3075, 3079, 3083, 3087, 3091, 3095, 3099, - 3103, 3107, 3111, 3115, 3119, 3123, 3127, 3131, 3135, 3139, - 3143, 3147, 3151, 3155, 3159, 3163, 3167, 3171, 3175, 3179, - 3186, 3190, 3194, 3198, 3202, 3206, 3210, 3214, 3218, 3224, - 3230, 3234, 3238, 3252, 3256, 3260, 3264, 3268, 3272, 3276, - 3280, 3284, 3288, 3292, 3303, 3314, 3318, 3322, 3326, 3330, - 3334, 3338, 3342, 3346, 3350, 3354, 3358, 3362, 3366, 3370, - 3374, 3378, 3382, 3386, 3390, 3394, 3398, 3402, 3406, 3410, - 3414, 3418, 3422, 3426, 3430, 3437, 3441, 3445, 3449, 3453, - 3457, 3461, 3465, 3469, 3475, 3481, 3489, 3490, 3491, 3495, - 3496, 3497, 3498, 3502, 3510, 3518, 3546, 3550, 3554, 3558, - 3562, 3568, 3572, 3576, 3580, 3591, 3595, 3599, 3607, 3611, - 3615, 3621, 3632 + 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 @@ -961,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", @@ -982,22 +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", "$@3", - "multiple_instance_identifiers", "typedef_declaration", "$@4", + "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", "$@12", "template_formal_parameters", - "template_nonempty_formal_parameters", "template_formal_parameter", - "template_formal_parameter_type", "instance_identifier", "$@13", + "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", @@ -1006,13 +1055,14 @@ 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", "$@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", + "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", @@ -1039,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 -734 +#define YYPACT_NINF -868 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-734))) + (!!((Yystate) == (-868))) -#define YYTABLE_NINF -668 +#define YYTABLE_NINF -729 #define yytable_value_is_error(Yytable_value) \ 0 @@ -1059,138 +1111,155 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 234, -734, 2792, 4509, 43, 3003, -734, -734, -734, -734, - -734, -734, -734, -734, -90, -84, -79, -70, -48, -32, - -11, -24, 10, -734, -734, 15, 41, 65, 4717, -734, - -734, 77, 76, 99, 129, 147, -734, 142, 164, 178, - 2792, 2792, 2792, 2792, 2792, 1390, 310, 2792, 3797, -734, - 252, -734, -734, -734, -734, -734, -734, -734, 4739, 181, - -734, -23, -734, -734, 1575, 1958, 1958, -734, 2339, -734, - 1958, -734, -734, 144, -734, -734, -734, -734, -22, 82, - 1087, -734, -734, -734, -734, -734, -734, 5402, 5402, 5402, - -734, 5402, 895, 5402, 162, -734, 5366, 203, 216, 219, - 225, 5402, 1487, 244, 251, 258, 5402, 5402, 250, 5297, - 5402, 5402, 2433, 5402, 5402, -734, 253, -734, -734, -734, - 3265, -734, -734, -734, -734, -734, 2792, 4509, 2792, 2792, - 2792, 2792, 4509, 2792, 4509, 2792, 2792, 2792, -734, -734, - 264, 2339, 266, 2339, 2339, -734, 4509, 2792, 2792, 4509, - 4509, 1390, 2792, 2792, 74, 74, 74, 74, 74, -90, - -79, -70, -48, -32, -24, 15, 41, 1421, 2122, 2253, - 2350, 178, 278, -88, 3797, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, 2339, 280, 304, -734, -734, - 74, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, - 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, - 2792, 2792, 2222, 2792, -734, -734, 144, 2792, -734, -734, - -734, 1958, -734, -734, -734, -734, -734, 299, 256, 144, - 144, 256, 256, 4068, 305, -734, 315, -734, -734, -734, - -734, 1226, 342, -18, -3, 13, -734, -734, -734, 5402, - -734, -734, -734, -734, 5402, -734, -734, -734, 5241, 2111, - -734, 2339, 2339, 2339, 2339, -734, -734, 341, -734, -734, - -734, -734, -734, 2792, 3339, -734, 340, -734, 3411, -734, - 2339, 249, -734, -734, 2339, 291, 333, -734, 358, 4581, - 2339, -734, 2339, 323, 313, 390, -734, -734, -734, -734, - 412, 1087, -734, 368, 392, -734, 376, 377, 382, 387, - 388, 400, 389, 401, 403, 411, 425, 2792, -734, 2792, - -734, -734, 402, 428, 429, 431, 409, 433, 3518, 434, - 437, 2792, 2792, -734, -734, -42, 310, 969, 1108, 928, - 928, 744, 744, 318, 318, -734, 3707, 4017, 4074, 4158, - 744, 744, 386, 386, 74, 74, 74, -734, -734, -45, - 2009, -734, 3539, 256, 408, 256, 256, 256, 256, 256, - 439, -734, 305, -734, 305, -734, 439, 439, -734, 256, - 4638, 4487, 256, 256, 441, 30, -734, 106, -734, 2792, - 2339, 442, -734, -734, -734, -734, 1226, -734, 517, -734, - -734, -734, 465, 474, 475, 476, 479, 4849, -734, 3478, - 4271, 338, 448, 313, -734, -734, 481, -734, 4509, 459, - 483, 468, -734, 14, 2792, 4739, 236, -734, -734, 469, - -734, -734, 2339, 93, -734, -734, -734, 2108, -734, -734, - 817, -734, 485, -734, -734, -734, -734, -734, -734, -734, - 471, -734, 472, -734, -734, -734, 3557, 477, 473, -734, - -734, -734, 478, -734, -734, -734, -734, 74, 3797, -734, - 4343, 339, -734, -734, 2792, -734, -734, -734, 439, 256, - 439, 439, 439, 439, 439, 2792, 185, 4739, 106, -734, - 270, 300, 561, -734, 4415, 482, 106, 106, 106, 106, - 106, 106, 52, -734, -734, 480, 3797, -734, 49, -734, - 498, 4905, -734, 496, -734, 4961, -734, 616, 619, 622, - 623, -734, -734, 399, 506, -734, -734, 2339, 2209, 2339, - 499, 510, -734, 106, -734, -734, 14, -734, 817, -734, - 511, 490, 2339, 1544, 4343, 502, 817, 4343, 3575, 236, - 503, 236, 236, 236, 236, 236, 247, -734, -734, 5017, - -734, 501, -734, 275, -734, 5, 521, 523, 505, 525, - 529, 2336, 3742, 515, 817, 817, 3118, 817, 817, 817, - 817, -734, 78, 346, -734, 1226, 2792, 2792, -734, -734, - 2792, 2792, 504, 4660, -734, -734, -734, -734, 514, 542, - -734, 3797, 439, 524, 530, 106, 52, 534, 538, 339, - -734, -734, 106, 540, 540, 540, 540, 540, 337, 2792, - 2792, -734, -734, 541, -734, 2792, -734, 2866, 557, 560, - -734, -734, -734, -37, 564, 565, 566, 5073, 28, -734, - 558, 106, 567, 5323, 4271, 80, -734, 346, -734, 5402, - -734, -734, -734, -734, -734, -734, -734, 550, 568, 571, - -734, -734, 4717, -734, -734, 572, 551, 573, -734, 590, - 2792, 2792, 2792, 2792, 1390, 2792, 591, 42, -734, -734, - 3839, -734, 252, -734, 594, 817, 89, 595, -734, 365, - 236, 598, 598, 598, 598, 598, -734, 2792, -734, 4343, - -734, 1842, -734, -734, 2339, 2792, 2792, -734, -734, -734, - -734, -734, 2336, 563, 585, 3797, -734, -734, 817, 372, - 372, 726, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, 599, 601, - -734, -734, 372, 372, 372, 335, 742, -734, 2792, -734, - 2108, 624, -734, 498, -13, -8, -6, 31, 561, 4717, - 144, 243, -734, -734, 4343, 52, -734, 4343, 4343, -734, - 540, 606, 3797, 604, 3761, 4160, 4778, 4794, 2339, 394, - -734, 2339, -734, -734, -734, 2866, 5129, 743, 627, 746, - 747, 748, -734, 631, 4509, 80, 4509, -734, -734, -734, - -734, 2906, -734, -734, 633, -734, -734, 4509, 4509, 4509, - 626, 4509, 4509, 4509, 1390, 74, 74, 74, 74, 617, - 34, 74, -734, -734, 1989, 2792, 2792, 2792, 2792, 2792, - 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, - 2792, 2792, 2792, 2792, 2792, 2792, 2450, 2792, 561, 348, - 630, 561, -734, 598, 4343, 620, 625, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, - -734, -734, 634, -734, 635, 639, 644, -734, 2564, 372, - -734, -734, -734, -734, -734, 1544, 632, 3742, 817, -734, - -734, -734, -734, 339, 144, -734, -734, 646, 647, 650, - -734, 653, 654, 4343, -734, -734, 2953, -734, 2953, -734, - 2953, -734, -734, 2953, 2953, 2953, -734, 5185, -734, -734, - 56, -734, 110, 655, 124, -734, -734, -734, -734, 649, - 667, 670, 671, 663, 673, 2906, 2906, 2906, 2906, 2906, - 1390, 2906, 3970, -734, 817, 664, 676, 677, 2792, 679, - 675, 687, 680, 3610, 2792, -734, -734, -734, 969, 1108, - 928, 928, 744, 744, 318, 318, -734, 3779, 4017, 4074, - 4158, 744, 744, 386, 386, 74, 74, 74, -734, -734, - 128, 3149, -2, 665, -734, -2, 4343, 690, -734, 561, - 1695, -734, -734, -734, -734, 2336, 3797, 692, -734, -734, - 699, -734, -734, -734, 561, 561, 561, 694, -734, -734, - -734, -734, -734, -734, -734, 832, 718, 841, 727, 728, - 847, 730, 4509, 4509, 4509, 4509, 4509, 4509, 209, 209, - 209, 209, 209, 713, 139, 209, 2906, 2906, 2906, 2906, - 2906, 2906, 2906, 2906, 2906, 2906, 2906, 2906, 2906, 2906, - 2906, 2906, 2906, 2906, 2906, 2678, 2792, -734, -734, 716, - 717, 719, 720, -734, 722, -734, -734, 74, 2792, -734, - -734, -734, 4343, 723, 561, -2, -734, 715, 561, -734, - 339, 339, 339, 561, 725, -734, 745, -734, -734, 160, - -734, 731, 740, 750, 754, 734, 755, 2906, -734, 3197, - 4000, 2848, 2848, 1434, 1434, 526, 526, -734, 3928, 4174, - 4203, 1131, 536, 536, 209, 209, 209, -734, -734, 163, - 3167, 2792, 2792, -734, 2792, 2792, 3797, 4343, 749, 561, - -2, -734, -2, 751, -734, -734, -734, -2, 764, 883, - 884, 768, -734, 756, 758, 759, -734, 760, 209, 2906, - -734, -734, 169, 177, 187, 192, 753, 561, -2, -734, - -734, 762, 766, -734, 2792, 2792, 2792, 2792, 3970, -734, - -734, -734, -734, 561, 339, 777, 778, 199, 205, 215, - 228, 339, -734, -734, -734, -734, -734, -734, -734, -734 + 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. @@ -1198,170 +1267,187 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 672, 0, 0, 0, 672, 5, 584, 580, 583, - 668, 669, 586, 587, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 582, 588, 0, 0, 0, 0, 590, - 589, 0, 0, 0, 0, 0, 581, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 672, 0, 3, 524, - 585, 253, 261, 335, 336, 338, 339, 320, 0, 0, - 350, 317, 349, 344, 341, 340, 343, 321, 0, 322, - 342, 352, 337, 672, 4, 255, 256, 257, 0, 306, - 0, 252, 332, 333, 334, 1, 20, 672, 672, 672, - 21, 672, 672, 672, 0, 37, 672, 0, 0, 0, - 0, 672, 0, 0, 0, 0, 672, 672, 0, 672, - 672, 672, 0, 672, 672, 6, 0, 16, 7, 18, - 0, 14, 15, 17, 64, 39, 672, 0, 672, 672, - 672, 672, 0, 672, 0, 672, 672, 672, 274, 279, - 0, 0, 545, 0, 0, 273, 0, 672, 672, 0, - 0, 0, 672, 672, 554, 552, 551, 553, 550, 253, - 335, 336, 338, 339, 350, 349, 344, 341, 340, 343, - 342, 337, 0, 0, 485, 656, 657, 658, 661, 659, - 663, 662, 660, 664, 650, 649, 0, 647, 652, 646, - 549, 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, 670, 671, 672, 0, 318, 319, - 351, 341, 346, 345, 348, 254, 347, 0, 672, 672, - 672, 672, 672, 672, 0, 282, 240, 672, 665, 666, - 667, 0, 308, 656, 657, 659, 284, 258, 286, 672, - 51, 40, 50, 52, 672, 41, 46, 22, 672, 0, - 44, 0, 0, 0, 0, 49, 672, 0, 25, 24, - 23, 47, 43, 0, 0, 138, 0, 53, 0, 19, - 0, 0, 45, 48, 0, 281, 263, 272, 0, 0, - 0, 12, 0, 0, 0, 280, 59, 265, 266, 267, - 306, 0, 262, 0, 484, 483, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 275, 672, - 277, 276, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 579, 651, 672, 672, 563, 564, 565, - 566, 567, 568, 571, 572, 578, 0, 560, 561, 562, - 569, 570, 558, 559, 555, 556, 557, 577, 576, 0, - 0, 283, 0, 672, 0, 672, 672, 672, 672, 672, - 245, 232, 0, 241, 0, 242, 244, 243, 171, 672, - 0, 0, 672, 672, 0, 172, 175, 672, 170, 672, - 314, 0, 311, 310, 305, 309, 0, 672, 672, 42, - 38, 672, 0, 0, 0, 0, 0, 672, 323, 0, - 672, 281, 263, 0, 280, 67, 0, 329, 0, 0, - 55, 57, 72, 74, 0, 0, 672, 264, 672, 0, - 353, 188, 0, 0, 62, 353, 193, 0, 63, 61, - 0, 270, 308, 268, 530, 544, 536, 532, 534, 535, - 0, 542, 0, 541, 531, 538, 0, 0, 0, 537, - 540, 543, 0, 547, 548, 539, 533, 525, 486, 88, - 672, 672, 87, 648, 0, 575, 574, 260, 246, 672, - 237, 233, 234, 236, 235, 672, 0, 0, 672, 209, - 0, 0, 672, 174, 0, 0, 672, 672, 672, 672, - 672, 672, 672, 222, 221, 0, 482, 481, 315, 304, - 259, 672, 289, 672, 288, 672, 325, 0, 0, 0, - 0, 327, 672, 0, 0, 150, 151, 0, 0, 0, - 0, 140, 141, 672, 149, 139, 0, 69, 0, 331, - 0, 0, 0, 672, 672, 0, 0, 672, 0, 672, - 0, 672, 672, 672, 672, 672, 0, 213, 212, 672, - 76, 0, 672, 0, 8, 0, 0, 0, 0, 0, - 0, 672, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 60, 672, 672, 152, 0, 0, 0, 278, 546, - 0, 0, 0, 0, 90, 92, 89, 91, 0, 0, - 167, 573, 238, 0, 0, 672, 672, 0, 0, 672, - 173, 176, 672, 227, 223, 224, 226, 225, 0, 0, - 672, 206, 186, 247, 312, 0, 285, 0, 0, 291, - 290, 328, 672, 0, 0, 0, 0, 672, 0, 36, - 143, 672, 145, 672, 0, 672, 68, 672, 330, 672, - 56, 639, 635, 638, 641, 642, 178, 0, 0, 0, - 637, 643, 0, 645, 644, 0, 0, 0, 636, 0, - 0, 0, 0, 0, 0, 0, 0, 179, 210, 182, - 211, 593, 640, 177, 0, 0, 0, 0, 271, 0, - 672, 218, 214, 215, 217, 216, 82, 672, 13, 672, - 189, 354, 355, 353, 0, 672, 672, 191, 192, 194, - 196, 197, 672, 0, 200, 202, 199, 195, 0, 159, - 155, 0, 105, 106, 107, 108, 109, 110, 113, 114, - 129, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 133, 132, 116, 115, 102, 104, 103, - 111, 112, 100, 101, 97, 98, 99, 96, 0, 0, - 95, 153, 156, 158, 157, 0, 0, 163, 672, 165, - 0, 0, 65, 269, 0, 0, 0, 0, 672, 0, - 672, 0, 353, 239, 672, 672, 207, 672, 672, 248, - 228, 231, 187, 0, 316, 663, 0, 662, 0, 0, - 292, 0, 294, 653, 672, 0, 672, 0, 0, 0, - 0, 0, 324, 0, 0, 672, 0, 134, 137, 135, - 142, 0, 147, 184, 0, 70, 54, 0, 0, 0, - 601, 0, 0, 0, 0, 609, 608, 607, 606, 0, - 0, 605, 58, 181, 0, 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, 672, 0, - 0, 672, 84, 219, 672, 0, 0, 357, 358, 362, - 359, 366, 360, 361, 363, 364, 365, 367, 368, 369, - 370, 371, 372, 373, 374, 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, 432, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, - 429, 430, 431, 433, 434, 435, 436, 437, 438, 439, - 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 672, 474, - 475, 476, 467, 479, 463, 464, 462, 469, 470, 458, - 459, 460, 461, 468, 466, 473, 471, 477, 472, 478, - 465, 356, 0, 9, 0, 0, 0, 198, 201, 160, - 154, 131, 130, 162, 166, 672, 0, 187, 0, 528, - 527, 529, 526, 672, 672, 168, 93, 0, 0, 0, - 208, 0, 0, 672, 229, 313, 0, 297, 0, 296, - 0, 295, 655, 0, 0, 0, 654, 672, 293, 326, - 0, 26, 0, 0, 0, 35, 144, 148, 146, 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, 185, 487, 0, 0, 0, 0, 672, 0, - 0, 0, 0, 0, 0, 634, 180, 183, 618, 619, - 620, 621, 622, 623, 626, 627, 633, 0, 615, 616, - 617, 624, 625, 613, 614, 610, 611, 612, 632, 631, - 0, 0, 73, 0, 78, 75, 672, 0, 220, 672, - 0, 190, 11, 10, 203, 672, 204, 0, 161, 66, - 0, 169, 94, 591, 672, 672, 672, 0, 303, 302, - 301, 300, 299, 298, 287, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 500, 498, - 497, 499, 496, 0, 0, 495, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 71, 600, 0, - 0, 0, 0, 599, 0, 603, 604, 594, 0, 630, - 629, 80, 672, 0, 672, 77, 480, 0, 672, 353, - 672, 672, 672, 672, 0, 27, 0, 32, 34, 0, - 29, 0, 0, 0, 0, 0, 0, 0, 523, 509, - 510, 511, 512, 513, 514, 515, 516, 522, 0, 506, - 507, 508, 504, 505, 501, 502, 503, 521, 520, 0, - 0, 0, 0, 602, 0, 0, 628, 672, 0, 672, - 83, 205, 164, 0, 251, 250, 249, 230, 0, 0, - 0, 0, 494, 0, 0, 0, 493, 0, 488, 0, - 519, 518, 0, 0, 0, 0, 0, 672, 85, 592, - 28, 0, 0, 30, 0, 0, 0, 0, 517, 597, - 596, 598, 595, 672, 672, 0, 0, 0, 0, 0, - 0, 672, 79, 33, 31, 491, 490, 492, 489, 81 + 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[] = { - -734, -734, -260, -734, 210, -734, -734, 657, -734, -734, - 188, 371, -734, -104, -734, -102, -734, -734, -134, -734, - -734, -734, 666, -734, -734, -734, -734, -734, -435, -734, - -734, 298, -734, -734, -734, 311, 414, -480, -734, -534, - -550, -460, -734, -72, -734, 143, -571, -734, -405, -705, - -734, -379, 113, -474, 97, -179, -213, -40, 684, -573, - 688, 16, -83, -734, -82, -734, -734, -734, -734, 149, - -80, -734, -377, -734, -734, -15, -7, -734, -734, -734, - -734, -17, 3, -734, -734, -434, -734, -10, -734, -476, - -106, -31, 246, 522, -249, -734, -734, 637, -734, -733, - 795, 799, -495, -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, 563, 564, 117, 428, 118, 119, 258, - 120, 419, 420, 121, 440, 581, 279, 538, 646, 293, - 544, 547, 294, 699, 1202, 1257, 874, 1116, 471, 761, - 818, 122, 276, 530, 531, 532, 533, 582, 1015, 583, - 599, 384, 385, 676, 677, 822, 621, 434, 438, 713, - 714, 386, 679, 556, 502, 234, 235, 73, 295, 142, - 296, 74, 75, 397, 76, 398, 513, 628, 629, 800, - 77, 78, 394, 390, 391, 79, 80, 123, 522, 632, - 124, 81, 82, 83, 84, 561, 562, 701, 1001, 505, - 303, 304, 1072, 174, 49, 680, 681, 186, 187, 802, - 803, 584, 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 @@ -1369,1372 +1455,1531 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 6, 568, 489, 361, 647, 275, 407, 1006, 537, 603, - 592, 145, 771, 143, 173, 469, 373, 375, 216, 510, - 780, 144, 307, 308, 309, 310, 545, 312, 638, 314, - 315, 316, 769, 218, 214, 786, 215, 297, 298, 332, - 299, 323, 324, 85, 493, 189, 329, 330, 682, 370, - 372, 374, 376, 377, 126, -665, 843, 609, 333, 789, - 127, 172, 1037, 1039, 1041, 128, 686, 222, 223, 224, - -666, 594, 236, 226, 129, 689, 824, 691, 692, 693, - 694, 695, 332, 219, 684, 595, -667, 687, 596, 830, - 807, 597, 238, 239, 719, 720, 130, 762, 763, 764, - 765, 475, 470, 302, 237, 300, 199, 598, -665, 808, - 593, -665, 131, 301, 332, 611, 238, 239, 495, 332, - 133, 332, 496, -666, 132, 305, -666, 305, 305, 305, - 305, 705, 305, 1019, 305, 305, 305, 511, 1020, -667, - 1021, 515, -667, 306, 793, 134, 305, 305, 311, 706, - 313, 305, 305, 546, 566, 567, 227, 494, 332, 135, - 228, 332, 322, 497, 678, 325, 326, 327, 559, 844, - 222, 223, 224, 226, 813, 240, 624, 1022, 772, 625, - 1085, 359, 619, 1145, 478, 136, 480, 481, 482, 483, - 484, 297, 298, 387, 299, 297, 298, 620, 299, 240, - 486, 229, 1146, 490, 491, 869, 1024, 766, 773, 137, - 821, 241, 146, 457, 1030, 236, 873, 211, 212, 213, - 147, 875, 767, 768, 222, 620, 498, 371, 236, 236, - 371, 371, 388, 767, 768, 870, 392, 1147, 1009, 876, - 499, 1174, 825, 148, 395, 500, 238, 239, 550, 426, - 501, 1150, 551, 175, 176, 332, 1148, 302, 214, 300, - 215, 302, 637, 300, 230, 6, 332, 301, 364, 1002, - 1151, 301, 365, 149, 1199, 250, 251, 252, 231, 253, - 255, 256, 150, 232, 260, 1228, 151, 1270, 233, 265, - 332, 257, 1016, 552, 271, 272, 332, 274, 277, 278, - 602, 282, 283, 1138, 332, 1139, 1271, 1140, 152, 1280, - 1141, 1142, 1143, 366, 332, 1299, 177, 178, 305, 332, - 175, 176, 153, 1300, 1029, 217, 332, 1031, 1032, 240, - 485, 604, 332, 1301, 472, 189, 179, 180, 1302, 181, - 488, 387, 332, 1023, 182, 1315, 183, 261, 1028, 682, - 199, 1316, 1184, 1185, 1186, 332, 553, 1, 2, 3, - 262, 1317, 371, 263, 371, 371, 371, 371, 371, 264, - 554, 593, 806, 268, 1318, 555, 367, 417, 371, 418, - 269, 371, 371, 177, 178, 549, 504, 270, 507, 1026, - 368, 696, 697, 534, 273, 369, 6, 514, 284, 395, - 6, 703, 704, 179, 180, 10, 181, 11, 317, 535, - 319, 182, 594, 183, 1117, 485, 607, -86, 199, -86, - 1207, -86, 243, 244, 331, 558, 595, 6, 335, 596, - 387, 336, 597, 1112, 540, 422, 1115, 260, 363, 435, - 184, 436, 399, 437, 185, 485, 608, 605, 598, 430, - 389, 431, 432, 433, 387, 206, 207, 208, 209, 210, - -232, 211, 212, 213, -86, 678, -86, 408, -86, 388, - 600, 396, 435, 1130, 436, 410, 770, 423, 371, 767, - 768, 1013, 620, 791, 507, 177, 178, 504, 1043, 1044, - 1045, 472, 767, 768, 1113, 504, 504, 504, 504, 504, - 504, 622, 424, 387, 387, 245, 180, 387, 181, 872, - 697, 534, 630, 182, 444, 183, 767, 768, 439, 332, - 682, 6, 445, 446, 48, 208, 209, 210, 447, 211, - 212, 213, 504, 448, 449, 451, 450, 452, 458, 817, - 647, 241, 683, 388, 1047, 462, 388, 479, 558, 453, - 558, 558, 558, 558, 558, 774, 775, 454, 1174, 776, - 777, 702, 154, 155, 156, 157, 158, 1025, 1174, 190, - 716, 455, 1073, 1137, 459, 460, 145, 461, 143, 463, - 465, 600, 622, 466, 485, 606, 144, 492, 395, 509, - 512, 516, 536, 613, 614, 615, 616, 617, 618, 1004, - 1005, 517, 518, 519, 504, 622, 520, 541, 600, 539, - 542, 504, 543, 560, 585, 586, 587, 590, 469, 507, - 801, 612, 591, 589, -307, 627, 633, 534, 623, 634, - 645, 6, 635, 636, 639, 643, 678, 644, 649, 648, - 504, 685, 690, 840, 823, 145, 622, 143, 700, 707, - 778, 708, 709, 710, 718, 144, 1203, 711, 781, 387, - 1264, 1265, 1266, 1179, 1180, 1181, 1182, 1183, 782, 1184, - 1185, 1186, 783, 328, 784, 1181, 1182, 1183, 787, 1184, - 1185, 1186, 788, 804, 1205, 620, -239, 805, 814, 558, - 839, 809, 810, 811, 827, 832, 507, 816, 388, 1210, - 1211, 1212, 785, 828, 305, 305, 829, 831, 833, 790, - 1007, 716, 1008, 337, 338, 339, 340, 341, 342, 343, - 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 834, 360, 1010, 842, 815, 362, - 868, 871, 1258, 697, 387, 1011, 1014, 387, 387, 1012, - 1033, 1018, 1034, 1050, 1312, 1051, 1052, 1053, 1054, 1055, - 1074, 1319, 145, 1084, 143, 197, 198, 507, 1118, 1260, - 1078, 1119, 144, 1262, 1114, 1263, 199, 472, 1267, 236, - 1128, 1121, 1122, 388, 622, 1123, 388, 388, 801, 801, - 801, 1124, 1132, 1152, 1133, 409, 1134, 1286, 801, 1135, - 1136, 1149, 1153, 6, 387, 1154, 1155, 1156, 1157, 1201, - 1188, 1131, 1189, 1190, 823, 1192, 1073, 1073, 1073, 1073, - 1073, 1193, 1073, 1194, 1288, 1209, 1195, 238, 239, 573, - 1056, 274, 1058, 574, 387, 1110, 1204, 826, 1208, 456, - 1213, 188, 1214, 1075, 1076, 1077, 1215, 1079, 1080, 1081, - 1082, 1216, 1304, 467, 468, 1217, 1218, 1219, 1220, 1227, - 1251, 1252, 1261, 225, 1254, 1253, 1255, 472, 1311, 1259, - 472, 1268, 1269, 388, 575, 247, 1273, 1272, 242, 248, - 1276, 206, 207, 208, 209, 210, 1274, 211, 212, 213, - 1275, 1277, 1290, 1291, 1292, 1287, 1293, 267, 1289, 1303, - 1294, 254, 1295, 1296, 1297, 1313, 1314, 281, 1305, 576, - 240, 506, 1306, 650, 1003, 400, 1129, 1073, 1073, 1073, - 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, - 1073, 1073, 1073, 1073, 1073, 1073, 318, 577, 320, 321, - 1187, 819, 641, 1127, 413, 87, 548, 195, 196, 197, - 198, 578, 88, 89, 1048, 820, 579, 1087, 1057, 572, - 199, 580, 414, 91, 92, 93, 415, 0, 1120, 0, - 0, 0, 1191, 473, 249, 387, 0, 702, 1073, 0, - 334, 0, 101, 0, 0, 192, 193, 194, 195, 196, - 197, 198, 106, 387, 0, 0, 601, 0, 107, 0, - 0, 199, 0, 110, 0, 0, 0, 506, 0, 0, - 0, 0, 0, 113, 683, 114, 0, 0, 0, 0, - 0, 0, 600, 236, 0, 0, 0, 0, 0, 801, - 1073, 801, 388, 801, 0, 0, 801, 801, 801, 1164, - 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 402, 0, 403, 404, 405, 406, - 0, 0, 0, 204, 205, 206, 207, 208, 209, 210, - 0, 211, 212, 213, 0, 416, 387, 305, 0, 421, - 0, 0, 0, 0, 0, 427, 1163, 429, 0, 0, - 0, 0, 0, 715, 0, 441, 443, 243, 244, 442, - 248, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 0, 211, 212, 213, 388, 0, 0, 472, 0, - 0, 0, 0, 0, 716, 193, 194, 195, 196, 197, - 198, 188, 0, 472, 472, 472, 0, 0, 0, 0, - 199, 792, 506, 0, 0, 0, 0, 794, 1168, 1169, - 1170, 1171, 1172, 1173, 1249, 0, 0, 0, 0, 0, - 177, 178, 387, 1174, 0, 0, 0, 0, 1221, 1222, - 1223, 1224, 1225, 1226, 0, 0, 0, 0, 0, 0, - 245, 180, 0, 181, 0, 508, 503, 0, 182, 0, - 183, 0, 835, 836, 837, 838, 0, 841, 0, 0, - 0, 388, 0, 472, 0, 0, 0, 472, 0, 600, - 600, 600, 472, 246, 0, 0, 0, 387, 0, 506, - 1282, 1283, 0, 1284, 1285, 557, 0, 565, 0, 0, - 0, 0, 0, 0, 715, 0, 0, 393, 0, 0, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 0, 211, 212, 213, 0, 0, 388, 0, 472, 0, - 0, 0, 0, 1307, 1308, 1309, 1310, 0, 1179, 1180, - 1181, 1182, 1183, 0, 1184, 1185, 1186, 53, 0, 54, - 55, 56, 0, 0, 0, 0, 472, 503, 0, 0, - 506, 0, 1017, 0, 0, 503, 503, 503, 503, 503, - 503, 0, 472, 600, 0, 0, 63, 221, 0, 0, - 600, 1158, 1159, 1160, 1161, 1162, 0, 1165, 0, 0, - 0, 0, 640, 0, 642, 0, 65, 66, 0, 0, - 0, 0, 503, 0, 0, 0, 0, 421, 0, 0, - 0, 0, 70, 0, 0, 0, 0, 72, 557, 0, - 557, 557, 557, 557, 557, 0, 1083, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1088, 1089, 1090, - 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, - 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 0, 1111, - 0, 0, 0, 7, 8, 9, 10, 0, 11, 12, - 13, 159, 0, 0, 503, 0, 0, 0, 0, 0, - 0, 503, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, - 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, - 1247, 0, 0, 0, 0, 0, 0, 15, 52, 0, - 503, 160, 0, 161, 162, 163, 57, 58, 0, 20, - 59, 0, 0, 164, 22, 1172, 1173, 61, 0, 0, - 0, 0, 23, 24, 165, 0, 1174, 0, 0, 0, - 166, 167, 53, 1278, 54, 55, 56, 0, 0, 28, - 0, 29, 0, 30, 220, 0, 0, 0, 31, 557, - 168, 169, 34, 0, 0, 35, 67, 175, 176, 565, - 36, 63, 221, 37, 68, 69, 170, 0, 0, 71, - 0, 171, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 65, 66, 0, 40, 1298, 0, 41, 42, 43, - 1126, 0, 44, 0, 45, 46, 0, 70, 0, 47, - 0, 0, 72, 0, 0, 0, 0, 651, 652, 653, - 10, 0, 11, 654, 655, 51, 0, 0, 656, 0, - 177, 178, 0, 0, 0, 137, 0, 0, 0, 0, - 0, 1179, 1180, 1181, 1182, 1183, 1027, 1184, 1185, 1186, - 179, 180, 0, 181, 0, 0, 0, 0, 182, 0, - 183, 657, 52, 1042, 0, 53, 1046, 54, 55, 56, - 57, 380, 0, 658, 59, 0, 1197, 60, 659, 0, - 0, 61, 0, 266, 0, 0, 660, 661, 62, 0, - 0, 0, 0, 0, 63, 64, 53, 0, 54, 55, - 56, 0, 0, 662, 0, 663, 0, 664, 220, 0, - 0, 381, 665, 0, 65, 66, 666, 715, 0, 667, - 67, 0, 0, 0, 668, 63, 221, 669, 68, 69, - 70, 0, 0, 71, 0, 72, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 65, 66, 0, 670, 0, - 0, 671, 672, 0, 0, 0, 673, 0, 674, 0, - 0, 70, 0, 675, 0, 0, 72, 0, 877, 878, - 879, 880, 881, 882, 883, 884, 885, 886, 1250, 887, - 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, - 1256, 0, 0, 0, 0, 0, 0, 898, 899, 900, - 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, - 911, 912, 913, 914, 0, 0, 915, 916, 917, 918, - 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, - 929, 0, 930, 0, 931, 932, 933, 934, 935, 936, - 937, 938, 939, 940, 941, 942, 943, 0, 0, 0, - 0, 0, 944, 945, 946, 0, 947, 948, 949, 950, - 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, - 961, 962, 0, 963, 964, 965, 966, 967, 968, 969, - 970, 971, 972, 973, 974, 975, 976, 977, 0, 0, - 0, 978, 979, 980, 981, 982, 983, 984, 985, 986, - 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, - 997, 998, 1206, 999, 1000, 877, 878, 879, 880, 881, - 882, 883, 884, 885, 886, 0, 887, 888, 889, 890, - 891, 892, 893, 894, 895, 896, 897, 0, 0, 0, - 0, 0, 0, 0, 898, 899, 900, 901, 902, 903, - 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, - 914, 0, 0, 915, 916, 917, 918, 919, 920, 921, - 922, 923, 924, 925, 926, 927, 928, 929, 0, 930, - 0, 931, 932, 933, 934, 935, 936, 937, 938, 939, - 940, 941, 942, 943, 0, 0, 0, 0, 0, 944, - 945, 946, 0, 947, 948, 949, 950, 951, 952, 953, - 954, 955, 956, 957, 958, 959, 960, 961, 962, 0, - 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, - 973, 974, 975, 976, 977, 0, 0, 0, 978, 979, - 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, - 990, 991, 992, 993, 994, 995, 996, 997, 998, 0, - 999, 1000, 651, 652, 653, 10, 0, 11, 654, 655, - 51, 0, 0, 1086, 0, 0, 0, 0, 0, 53, - 0, 54, 55, 56, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 0, 0, 0, 657, 52, 63, 221, - 53, 199, 54, 55, 56, 57, 380, 0, 658, 59, - 0, 0, 60, 659, 0, 0, 61, 0, 65, 66, - 0, 660, 661, 62, 0, 0, 0, 0, 0, 63, - 64, 0, 0, 0, 70, 0, 0, 0, 662, 72, - 663, 0, 664, 0, 0, 0, 381, 665, 0, 65, - 66, 666, 0, 0, 667, 67, 0, 0, 0, 668, - 0, 0, 669, 68, 69, 70, 0, 0, 71, 0, - 72, 7, 8, 9, 10, 0, 11, 12, 13, 14, - 0, 175, 176, 670, 0, 0, 671, 672, 0, 0, - 0, 673, 0, 674, 0, 0, 0, 0, 675, 0, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 0, 211, 212, 213, 15, 0, 476, 0, 16, - 0, 17, 18, 19, 0, 0, 0, 20, 0, 569, - 570, 21, 22, 53, 0, 54, 55, 56, 0, 0, - 23, 24, 25, 0, 177, 178, 0, 0, 26, 27, - 0, 0, 0, 0, 0, 0, 0, 28, 0, 29, - 0, 30, 63, 221, 179, 180, 31, 181, 32, 33, - 34, 0, 182, 35, 183, 0, 0, 0, 36, 525, - 526, 37, 65, 66, 38, 7, 8, 9, 10, 39, - 11, 12, 13, 14, 571, 0, 0, 401, 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, 0, 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, 175, - 176, 0, 0, 65, 66, 0, 40, 0, 0, 41, - 42, 43, 0, 0, 44, 0, 45, 46, 358, 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, 148, 0, 21, - 22, 53, 0, 54, 55, 56, 0, 0, 23, 24, - 25, 0, 177, 178, 0, 0, 26, 27, 0, 0, - 0, 0, 0, 0, 0, 28, 0, 29, 0, 30, - 63, 221, 179, 180, 31, 181, 32, 33, 34, 0, - 182, 35, 183, 175, 176, 0, 36, 0, 0, 37, - 65, 66, 38, 7, 8, 9, 10, 39, 11, 12, - 13, 14, 712, 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, 0, 0, - 0, 0, 0, 0, 152, 0, 0, 15, 0, 0, - 0, 16, 0, 17, 18, 19, 177, 178, 0, 20, - 0, 0, 0, 21, 22, 0, 0, 0, 0, 0, - 0, 280, 23, 24, 25, 0, 179, 180, 0, 181, - 26, 27, 0, 0, 182, 0, 183, 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, 14, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 0, 41, 42, 43, - 0, 0, 44, 0, 45, 46, 1109, 0, 0, 47, + 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, 15, 0, 0, 0, 16, 0, 17, 18, 19, + 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, 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, 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, 14, - 1125, 0, 0, 0, 0, 0, 0, 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, 15, 0, 0, 0, 16, + 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, 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, 14, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 41, 42, 43, 0, 0, - 44, 0, 45, 46, 1248, 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, 1170, 1171, 1172, - 1173, 0, 26, 27, 0, 0, 175, 176, 0, 0, - 1174, 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, 57, 0, 0, 0, 40, 0, 0, 41, - 42, 43, 0, 0, 44, 0, 45, 46, 0, 177, - 178, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1059, 0, 0, 0, 0, 0, 179, - 795, 796, 797, 175, 176, 1060, 0, 182, 0, 183, - 1061, 0, 67, 0, 0, 0, 0, 0, 23, 24, - 798, 69, 0, 0, 799, 1179, 1180, 1181, 1182, 1183, - 0, 1184, 1185, 1186, 0, 0, 0, 29, 0, 30, - 0, 0, 0, -2, 1062, 0, 0, 0, 1063, 57, - 0, 1064, 0, 0, 0, 0, 36, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 177, 178, 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, - 1065, 0, 0, 1066, 1067, 1068, 179, 180, 1069, 181, - 1070, 46, 86, 87, 182, 1071, 183, 0, 0, 67, - 88, 89, 0, 0, 0, 0, 0, 798, 69, 90, - 0, 91, 92, 93, 94, 0, 0, 0, 95, 0, - 0, 0, 96, 0, 0, 0, 97, 98, 99, 100, - 101, 102, 0, 0, 0, 0, 0, 103, 104, 105, - 106, 0, 0, 0, 0, 0, 107, 108, 0, 0, - 109, 110, 0, 0, 0, 111, 0, 0, 0, 0, - 112, 113, 0, 114, 721, 0, 0, 0, 0, 0, - 0, 115, 0, 722, 723, 724, 725, 726, 727, 728, - 729, 0, 0, 0, 0, 0, 0, 0, 116, 0, - 730, 0, 731, 732, 733, 734, 735, 736, 737, 738, - 739, 740, 741, 742, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 0, 0, 0, 0, 0, 0, 0, - 743, 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, 0, 744, 0, 0, - 0, 0, 0, 1167, 1168, 1169, 1170, 1171, 1172, 1173, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1174, + 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, 0, 0, 0, 745, 0, 0, 746, 0, - 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, - 757, 0, 758, 759, 0, 0, 0, 760, 0, 0, - 0, 0, 0, 0, 0, 285, 286, 0, 0, 0, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 0, 211, 212, 213, 0, 0, 1200, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 0, - 211, 212, 213, 287, 0, 1281, 53, 0, 54, 55, - 56, 57, 0, 0, 0, 288, 0, 0, 60, 1176, - 1177, 1178, 61, 0, 1179, 1180, 1181, 1182, 1183, 62, - 1184, 1185, 1186, 0, 0, 63, 64, 0, 0, 285, - 286, 0, 0, 0, 0, 0, 0, 289, 0, 0, - 0, 0, 0, 0, 0, 65, 66, 0, 0, 0, - 0, 67, 0, 0, 0, 0, 0, 0, 0, 290, - 69, 70, 0, 0, 71, 0, 72, 287, 0, 0, - 53, 291, 54, 55, 56, 57, 0, 0, 0, 288, - 0, 0, 60, 0, 0, 0, 61, 292, 0, 0, - 0, 0, 0, 62, 0, 0, 0, 0, 0, 63, - 64, 411, 412, 0, 0, 0, 0, 0, 0, 0, - 0, 289, 0, 0, 0, 0, 0, 0, 0, 65, - 66, 0, 0, 0, 0, 67, 0, 0, 0, 0, - 0, 0, 0, 290, 69, 70, 0, 0, 71, 287, - 72, 0, 53, 0, 54, 55, 56, 57, 0, 0, - 0, 288, 0, 0, 60, 0, 0, 0, 61, 0, - 0, 292, 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, 523, 0, 199, 0, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 0, 211, 212, 213, 524, 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, 464, 0, 0, 0, 0, 0, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 0, 211, 212, 213, 477, 0, 0, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 0, - 211, 212, 213, 588, 0, 0, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 0, 211, 212, - 213, 688, 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, 1196, 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, 474, 0, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 0, - 211, 212, 213, 0, 845, 846, 847, 848, 849, 850, - 851, 852, 0, 0, 0, 0, 0, 0, 0, 0, - 717, 853, 0, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 0, 211, 212, 213, 1035, 0, - 0, 0, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 0, 211, 212, 213, 0, 1198, 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, 1166, 1167, 1168, 1169, 1170, 1171, 1172, - 1173, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1174, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, - 864, 0, 865, 866, 867, 1166, 1167, 1168, 1169, 1170, - 1171, 1172, 1173, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1174, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1168, 1169, 1170, - 1171, 1172, 1173, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1174, 0, 193, 194, 195, 196, 197, 198, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 199, - 0, 0, 0, 0, 0, 0, 0, 1279, 0, 1175, - 1176, 1177, 1178, 0, 0, 1179, 1180, 1181, 1182, 1183, - 0, 1184, 1185, 1186, 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, 1175, 1176, 1177, 1178, 0, 199, 1179, 1180, 1181, - 1182, 1183, 0, 1184, 1185, 1186, 52, 0, 0, 53, - 0, 54, 55, 56, 57, 380, 0, 0, 59, 0, - 0, 60, 1176, 1177, 1178, 61, 0, 1179, 1180, 1181, - 1182, 1183, 62, 1184, 1185, 1186, 0, 0, 63, 64, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 0, - 211, 212, 213, 0, 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, 1168, 1169, 1170, 1171, 1172, 1173, 0, 0, 0, - 0, 0, 382, 0, 0, 0, 1174, 383, 203, 204, - 205, 206, 207, 208, 209, 210, 57, 211, 212, 213, - 1168, 1169, 1170, 1171, 1172, 1173, 0, 0, 0, 0, - 0, 0, 0, 177, 178, 1174, 0, 0, 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, - 0, 0, 0, 179, 180, 0, 181, 0, 0, 0, - 0, 182, 0, 183, 0, 0, 67, 0, 0, 0, - 0, 0, 0, 0, 798, 69, 0, 0, 1036, 0, - 0, 525, 526, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 204, 205, 206, 207, 208, 209, 210, - 0, 211, 212, 213, 0, 0, 0, 1177, 1178, 0, - 0, 1179, 1180, 1181, 1182, 1183, 0, 1184, 1185, 1186, - 0, 0, 53, 0, 54, 55, 56, 527, 528, 0, - 0, 0, 0, 0, 60, 0, 0, 1178, 0, 0, - 1179, 1180, 1181, 1182, 1183, 62, 1184, 1185, 1186, 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, 0, - 0, 0, 0, 0, 0, 529, 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, 610, - 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, 425, 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, 779, 63, 64, - 140, 0, 0, 60, 0, 0, 0, 61, 138, 0, - 0, 0, 0, 0, 62, 487, 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, 0, 0, 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, 0, - 181, 0, 798, 69, 0, 182, 1038, 183, 86, 87, - 67, 0, 0, 0, 0, 0, 88, 89, 798, 69, - 0, 0, 1040, 0, 0, 90, 0, 91, 92, 93, - 94, 0, 0, 0, 95, 0, 0, 0, 96, 0, - 0, 0, 97, 98, 99, 100, 101, 102, 0, 0, - 0, 0, 0, 103, 104, 105, 106, 0, 0, 0, - 0, 0, 107, 108, 86, 87, 109, 110, 0, 0, - 0, 111, 88, 89, 0, 0, 112, 113, 0, 114, - 0, 90, 0, 91, 92, 93, 94, 115, 0, 0, - 95, 0, 0, 0, 96, 0, 0, 0, 97, 98, - 99, 100, 101, 102, 116, 0, 521, 0, 0, 103, - 104, 105, 106, 0, 0, 0, 0, 0, 107, 108, - 86, 87, 109, 110, 0, 0, 0, 111, 88, 89, - 0, 0, 112, 113, 0, 114, 0, 90, 0, 91, - 92, 93, 94, 115, 0, 0, 95, 0, 0, 0, - 96, 0, 0, 0, 97, 98, 99, 100, 101, 102, - 116, 0, 626, 0, 0, 103, 104, 105, 106, 0, - 0, 0, 0, 0, 107, 108, 86, 87, 109, 110, - 0, 0, 0, 111, 88, 89, 0, 0, 112, 113, - 0, 114, 0, 90, 0, 91, 92, 93, 94, 115, - 0, 0, 95, 0, 0, 0, 96, 0, 0, 0, - 97, 98, 99, 100, 101, 102, 116, 0, 631, 0, - 0, 103, 104, 105, 106, 0, 0, 0, 0, 0, - 107, 108, 86, 87, 109, 110, 0, 0, 0, 111, - 88, 89, 0, 0, 112, 113, 0, 114, 0, 90, - 0, 91, 92, 93, 94, 115, 0, 0, 95, 0, - 0, 0, 96, 0, 0, 0, 97, 98, 99, 100, - 101, 102, 116, 0, 698, 0, 0, 103, 104, 105, - 106, 0, 0, 0, 0, 0, 107, 108, 86, 87, - 109, 110, 0, 0, 0, 111, 88, 89, 0, 0, - 112, 113, 0, 114, 0, 90, 0, 91, 92, 93, - 94, 115, 0, 0, 95, 0, 0, 0, 96, 0, - 0, 0, 97, 98, 99, 100, 101, 102, 116, 0, - 812, 0, 0, 103, 104, 105, 106, 0, 0, 0, - 0, 0, 107, 108, 86, 87, 109, 110, 0, 0, - 0, 111, 88, 89, 0, 0, 112, 113, 0, 114, - 0, 90, 0, 91, 92, 93, 94, 115, 0, 0, - 95, 0, 0, 0, 96, 0, 0, 0, 97, 98, - 99, 100, 101, 102, 116, 0, 1049, 0, 0, 103, - 104, 105, 106, 0, 0, 0, 0, 0, 107, 108, - 86, 87, 109, 110, 0, 0, 0, 111, 88, 89, - 0, 0, 112, 113, 0, 114, 0, 90, 0, 91, - 92, 93, 94, 115, 0, 0, 95, 0, 0, 0, - 96, 0, 0, 0, 97, 98, 99, 100, 101, 102, - 116, 0, 1144, 0, 0, 103, 104, 105, 106, 0, - 0, 0, 0, 0, 107, 108, 0, 87, 109, 110, - 0, 0, 0, 111, 88, 89, 0, 0, 112, 113, - 0, 114, 0, 0, 0, 91, 92, 93, 0, 0, - 0, 0, 0, 87, 0, 0, 249, 0, 0, 0, - 88, 89, 0, 0, 101, 0, 116, 0, 0, 0, - 0, 91, 92, 93, 106, 0, 0, 0, 0, 0, - 107, 0, 249, 0, 0, 110, 0, 0, 0, 0, - 101, 0, 0, 0, 112, 113, 87, 114, 0, 0, - 106, 0, 0, 88, 89, 0, 107, 0, 0, 0, - 109, 110, -136, 0, 91, 92, 93, 0, 0, 0, - 112, 113, 116, 114, 0, 249, 0, 0, 0, 0, - 0, 0, 87, 101, 259, 0, 0, 0, 0, 88, - 89, 0, 0, 106, 0, 0, 0, 0, 116, 107, - 91, 92, 93, 0, 110, 0, 0, 0, 0, 0, - 0, 249, 0, 0, 113, 0, 114, 0, 0, 101, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, - 0, 0, 0, 0, 0, 107, 0, 0, 0, 0, - 110, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 113, 0, 114, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 116 + 0, 0, 0, 0, 0, 0, 189 }; static const yytype_int16 yycheck[] = { - 1, 435, 381, 216, 538, 109, 266, 712, 413, 485, - 470, 28, 583, 28, 45, 57, 229, 230, 58, 396, - 593, 28, 128, 129, 130, 131, 12, 133, 523, 135, - 136, 137, 582, 56, 6, 606, 8, 120, 120, 127, - 120, 147, 148, 0, 14, 46, 152, 153, 543, 228, - 229, 230, 231, 232, 144, 73, 14, 492, 146, 609, - 144, 45, 795, 796, 797, 144, 546, 64, 65, 66, - 73, 73, 73, 70, 144, 549, 647, 551, 552, 553, - 554, 555, 127, 106, 544, 87, 73, 547, 90, 662, - 127, 93, 10, 11, 574, 575, 144, 577, 578, 579, - 580, 146, 144, 120, 126, 120, 32, 109, 126, 146, - 32, 129, 144, 120, 127, 494, 10, 11, 12, 127, - 144, 127, 16, 126, 135, 126, 129, 128, 129, 130, - 131, 126, 133, 146, 135, 136, 137, 397, 146, 126, - 146, 401, 129, 127, 620, 135, 147, 148, 132, 144, - 134, 152, 153, 139, 61, 62, 12, 127, 127, 144, - 16, 127, 146, 57, 543, 149, 150, 151, 428, 127, - 167, 168, 169, 170, 146, 93, 127, 146, 583, 130, - 146, 212, 130, 127, 363, 144, 365, 366, 367, 368, - 369, 274, 274, 233, 274, 278, 278, 145, 278, 93, - 379, 57, 146, 382, 383, 685, 779, 129, 585, 144, - 130, 129, 135, 319, 785, 216, 690, 143, 144, 145, - 144, 697, 144, 145, 221, 145, 120, 228, 229, 230, - 231, 232, 233, 144, 145, 146, 237, 127, 718, 699, - 134, 32, 647, 144, 241, 139, 10, 11, 12, 289, - 144, 127, 16, 10, 11, 127, 146, 274, 6, 274, - 8, 278, 522, 278, 120, 266, 127, 274, 12, 703, - 146, 278, 16, 144, 146, 87, 88, 89, 134, 91, - 92, 93, 135, 139, 96, 146, 144, 127, 144, 101, - 127, 129, 768, 57, 106, 107, 127, 109, 110, 111, - 479, 113, 114, 1036, 127, 1038, 146, 1040, 144, 146, - 1043, 1044, 1045, 57, 127, 146, 73, 74, 319, 127, - 10, 11, 144, 146, 784, 144, 127, 787, 788, 93, - 145, 146, 127, 146, 335, 336, 93, 94, 146, 96, - 380, 381, 127, 778, 101, 146, 103, 144, 782, 844, - 32, 146, 143, 144, 145, 127, 120, 123, 124, 125, - 144, 146, 363, 144, 365, 366, 367, 368, 369, 144, - 134, 32, 632, 129, 146, 139, 120, 128, 379, 130, - 129, 382, 383, 73, 74, 425, 387, 129, 389, 146, - 134, 144, 145, 410, 144, 139, 397, 398, 145, 396, - 401, 126, 127, 93, 94, 6, 96, 8, 144, 410, - 144, 101, 73, 103, 874, 145, 146, 126, 32, 128, - 1125, 130, 10, 11, 146, 426, 87, 428, 148, 90, - 470, 127, 93, 868, 418, 144, 871, 249, 139, 126, - 130, 128, 254, 130, 134, 145, 146, 487, 109, 126, - 145, 128, 129, 130, 494, 137, 138, 139, 140, 141, - 145, 143, 144, 145, 126, 844, 128, 126, 130, 470, - 471, 129, 126, 1023, 128, 135, 130, 144, 479, 144, - 145, 146, 145, 146, 485, 73, 74, 488, 94, 95, - 96, 492, 144, 145, 146, 496, 497, 498, 499, 500, - 501, 502, 144, 543, 544, 93, 94, 547, 96, 144, - 145, 528, 513, 101, 146, 103, 144, 145, 128, 127, - 1015, 522, 146, 146, 2, 139, 140, 141, 146, 143, - 144, 145, 533, 146, 146, 146, 136, 136, 136, 643, - 1074, 129, 543, 544, 804, 136, 547, 139, 549, 146, - 551, 552, 553, 554, 555, 586, 587, 146, 32, 590, - 591, 562, 40, 41, 42, 43, 44, 780, 32, 47, - 571, 146, 821, 1033, 146, 146, 593, 146, 593, 146, - 146, 582, 583, 146, 145, 488, 593, 146, 585, 147, - 73, 126, 144, 496, 497, 498, 499, 500, 501, 705, - 706, 127, 127, 127, 605, 606, 127, 148, 609, 128, - 127, 612, 144, 144, 129, 144, 144, 144, 57, 620, - 627, 139, 144, 146, 126, 129, 10, 644, 148, 10, - 533, 632, 10, 10, 128, 136, 1015, 127, 148, 128, - 641, 139, 139, 674, 645, 662, 647, 662, 147, 128, - 146, 128, 147, 128, 139, 662, 1116, 128, 144, 699, - 1210, 1211, 1212, 137, 138, 139, 140, 141, 126, 143, - 144, 145, 148, 151, 144, 139, 140, 141, 144, 143, - 144, 145, 144, 126, 1119, 145, 145, 127, 130, 690, - 674, 127, 127, 127, 144, 144, 697, 130, 699, 1134, - 1135, 1136, 605, 135, 705, 706, 135, 135, 135, 612, - 147, 712, 127, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 144, 213, 10, 146, 641, 217, - 146, 146, 1202, 145, 784, 146, 4, 787, 788, 148, - 144, 127, 148, 10, 1304, 128, 10, 10, 10, 128, - 127, 1311, 779, 146, 779, 21, 22, 768, 148, 1204, - 144, 146, 779, 1208, 144, 1209, 32, 778, 1213, 780, - 148, 147, 147, 784, 785, 146, 787, 788, 795, 796, - 797, 147, 146, 144, 147, 273, 146, 1257, 805, 146, - 146, 146, 135, 804, 844, 135, 135, 144, 135, 144, - 146, 1024, 136, 136, 815, 136, 1065, 1066, 1067, 1068, - 1069, 146, 1071, 136, 1259, 126, 146, 10, 11, 12, - 814, 643, 816, 16, 874, 866, 146, 649, 146, 317, - 146, 46, 10, 827, 828, 829, 128, 831, 832, 833, - 834, 10, 1287, 331, 332, 128, 128, 10, 128, 146, - 144, 144, 147, 68, 144, 146, 144, 868, 1303, 146, - 871, 146, 127, 874, 57, 80, 136, 146, 79, 80, - 146, 137, 138, 139, 140, 141, 136, 143, 144, 145, - 136, 136, 128, 10, 10, 146, 128, 102, 147, 146, - 144, 6, 144, 144, 144, 128, 128, 112, 146, 92, - 93, 389, 146, 542, 704, 258, 1018, 1166, 1167, 1168, - 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, - 1179, 1180, 1181, 1182, 1183, 1184, 141, 120, 143, 144, - 1074, 643, 528, 1015, 278, 50, 424, 19, 20, 21, - 22, 134, 57, 58, 805, 644, 139, 844, 815, 437, - 32, 144, 278, 68, 69, 70, 278, -1, 978, -1, - -1, -1, 1078, 336, 79, 1015, -1, 978, 1227, -1, - 185, -1, 87, -1, -1, 16, 17, 18, 19, 20, - 21, 22, 97, 1033, -1, -1, 474, -1, 103, -1, - -1, 32, -1, 108, -1, -1, -1, 485, -1, -1, - -1, -1, -1, 118, 1015, 120, -1, -1, -1, -1, - -1, -1, 1023, 1024, -1, -1, -1, -1, -1, 1036, - 1279, 1038, 1033, 1040, -1, -1, 1043, 1044, 1045, 1070, - 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 259, -1, 261, 262, 263, 264, - -1, -1, -1, 135, 136, 137, 138, 139, 140, 141, - -1, 143, 144, 145, -1, 280, 1116, 1078, -1, 284, - -1, -1, -1, -1, -1, 290, 1070, 292, -1, -1, - -1, -1, -1, 571, -1, 300, 301, 10, 11, 300, - 301, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, -1, 143, 144, 145, 1116, -1, -1, 1119, -1, - -1, -1, -1, -1, 1125, 17, 18, 19, 20, 21, - 22, 336, -1, 1134, 1135, 1136, -1, -1, -1, -1, - 32, 619, 620, -1, -1, -1, -1, 625, 17, 18, - 19, 20, 21, 22, 1185, -1, -1, -1, -1, -1, - 73, 74, 1202, 32, -1, -1, -1, -1, 1152, 1153, - 1154, 1155, 1156, 1157, -1, -1, -1, -1, -1, -1, - 93, 94, -1, 96, -1, 390, 387, -1, 101, -1, - 103, -1, 670, 671, 672, 673, -1, 675, -1, -1, - -1, 1202, -1, 1204, -1, -1, -1, 1208, -1, 1210, - 1211, 1212, 1213, 126, -1, -1, -1, 1257, -1, 697, - 1251, 1252, -1, 1254, 1255, 426, -1, 432, -1, -1, - -1, -1, -1, -1, 712, -1, -1, 11, -1, -1, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - -1, 143, 144, 145, -1, -1, 1257, -1, 1259, -1, - -1, -1, -1, 1294, 1295, 1296, 1297, -1, 137, 138, - 139, 140, 141, -1, 143, 144, 145, 51, -1, 53, - 54, 55, -1, -1, -1, -1, 1287, 488, -1, -1, - 768, -1, 770, -1, -1, 496, 497, 498, 499, 500, - 501, -1, 1303, 1304, -1, -1, 80, 81, -1, -1, - 1311, 1065, 1066, 1067, 1068, 1069, -1, 1071, -1, -1, - -1, -1, 527, -1, 529, -1, 100, 101, -1, -1, - -1, -1, 533, -1, -1, -1, -1, 542, -1, -1, - -1, -1, 116, -1, -1, -1, -1, 121, 549, -1, - 551, 552, 553, 554, 555, -1, 834, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 845, 846, 847, - 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, - 858, 859, 860, 861, 862, 863, 864, 865, -1, 867, - -1, -1, -1, 3, 4, 5, 6, -1, 8, 9, - 10, 11, -1, -1, 605, -1, -1, -1, -1, -1, - -1, 612, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, - 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, - 1184, -1, -1, -1, -1, -1, -1, 47, 48, -1, - 641, 51, -1, 53, 54, 55, 56, 57, -1, 59, - 60, -1, -1, 63, 64, 21, 22, 67, -1, -1, - -1, -1, 72, 73, 74, -1, 32, -1, -1, -1, - 80, 81, 51, 1227, 53, 54, 55, -1, -1, 89, - -1, 91, -1, 93, 63, -1, -1, -1, 98, 690, - 100, 101, 102, -1, -1, 105, 106, 10, 11, 704, - 110, 80, 81, 113, 114, 115, 116, -1, -1, 119, - -1, 121, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 100, 101, -1, 134, 1279, -1, 137, 138, 139, - 1008, -1, 142, -1, 144, 145, -1, 116, -1, 149, - -1, -1, 121, -1, -1, -1, -1, 3, 4, 5, - 6, -1, 8, 9, 10, 11, -1, -1, 14, -1, - 73, 74, -1, -1, -1, 144, -1, -1, -1, -1, - -1, 137, 138, 139, 140, 141, 781, 143, 144, 145, - 93, 94, -1, 96, -1, -1, -1, -1, 101, -1, - 103, 47, 48, 798, -1, 51, 801, 53, 54, 55, - 56, 57, -1, 59, 60, -1, 1084, 63, 64, -1, - -1, 67, -1, 126, -1, -1, 72, 73, 74, -1, - -1, -1, -1, -1, 80, 81, 51, -1, 53, 54, - 55, -1, -1, 89, -1, 91, -1, 93, 63, -1, - -1, 97, 98, -1, 100, 101, 102, 1125, -1, 105, - 106, -1, -1, -1, 110, 80, 81, 113, 114, 115, - 116, -1, -1, 119, -1, 121, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 100, 101, -1, 134, -1, - -1, 137, 138, -1, -1, -1, 142, -1, 144, -1, - -1, 116, -1, 149, -1, -1, 121, -1, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 1186, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 1198, -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, 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, -1, -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, 10, 11, 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, -1, 148, -1, 51, - -1, 53, 54, 55, -1, -1, -1, 59, -1, 61, - 62, 63, 64, 51, -1, 53, 54, 55, -1, -1, - 72, 73, 74, -1, 73, 74, -1, -1, 80, 81, - -1, -1, -1, -1, -1, -1, -1, 89, -1, 91, - -1, 93, 80, 81, 93, 94, 98, 96, 100, 101, - 102, -1, 101, 105, 103, -1, -1, -1, 110, 10, - 11, 113, 100, 101, 116, 3, 4, 5, 6, 121, - 8, 9, 10, 11, 126, -1, -1, 126, 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, -1, -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, 10, - 11, -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, 73, 74, -1, -1, 80, 81, -1, -1, - -1, -1, -1, -1, -1, 89, -1, 91, -1, 93, - 80, 81, 93, 94, 98, 96, 100, 101, 102, -1, - 101, 105, 103, 10, 11, -1, 110, -1, -1, 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, -1, -1, - -1, -1, -1, -1, 144, -1, -1, 47, -1, -1, - -1, 51, -1, 53, 54, 55, 73, 74, -1, 59, - -1, -1, -1, 63, 64, -1, -1, -1, -1, -1, - -1, 88, 72, 73, 74, -1, 93, 94, -1, 96, - 80, 81, -1, -1, 101, -1, 103, -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, 11, -1, -1, -1, -1, - -1, -1, -1, -1, 134, -1, -1, 137, 138, 139, - -1, -1, 142, -1, 144, 145, 146, -1, -1, 149, + 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, - -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, 11, - 126, -1, -1, -1, -1, -1, -1, -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, 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, 11, -1, -1, -1, -1, -1, -1, - -1, -1, 134, -1, -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, 19, 20, 21, - 22, -1, 80, 81, -1, -1, 10, 11, -1, -1, - 32, 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, 56, -1, -1, -1, 134, -1, -1, 137, - 138, 139, -1, -1, 142, -1, 144, 145, -1, 73, - 74, 149, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 47, -1, -1, -1, -1, -1, 93, - 94, 95, 96, 10, 11, 59, -1, 101, -1, 103, - 64, -1, 106, -1, -1, -1, -1, -1, 72, 73, - 114, 115, -1, -1, 118, 137, 138, 139, 140, 141, - -1, 143, 144, 145, -1, -1, -1, 91, -1, 93, - -1, -1, -1, 0, 98, -1, -1, -1, 102, 56, - -1, 105, -1, -1, -1, -1, 110, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 73, 74, -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, - 134, -1, -1, 137, 138, 139, 93, 94, 142, 96, - 144, 145, 49, 50, 101, 149, 103, -1, -1, 106, - 57, 58, -1, -1, -1, -1, -1, 114, 115, 66, - -1, 68, 69, 70, 71, -1, -1, -1, 75, -1, - -1, -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, -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, -1, -1, -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, 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, 89, -1, -1, + -1, -1, -1, -1, -1, 98, 1164, -1, -1, -1, -1, -1, -1, 16, 17, 18, 19, 20, 21, 22, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, + 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, - -1, -1, -1, -1, -1, 127, -1, -1, 130, -1, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, -1, 144, 145, -1, -1, -1, 149, -1, -1, - -1, -1, -1, -1, -1, 10, 11, -1, -1, -1, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, -1, 143, 144, 145, -1, -1, 148, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, -1, - 143, 144, 145, 48, -1, 148, 51, -1, 53, 54, - 55, 56, -1, -1, -1, 60, -1, -1, 63, 132, - 133, 134, 67, -1, 137, 138, 139, 140, 141, 74, - 143, 144, 145, -1, -1, 80, 81, -1, -1, 10, - 11, -1, -1, -1, -1, -1, -1, 92, -1, -1, - -1, -1, -1, -1, -1, 100, 101, -1, -1, -1, - -1, 106, -1, -1, -1, -1, -1, -1, -1, 114, - 115, 116, -1, -1, 119, -1, 121, 48, -1, -1, - 51, 126, 53, 54, 55, 56, -1, -1, -1, 60, - -1, -1, 63, -1, -1, -1, 67, 142, -1, -1, - -1, -1, -1, 74, -1, -1, -1, -1, -1, 80, - 81, 10, 11, -1, -1, -1, -1, -1, -1, -1, - -1, 92, -1, -1, -1, -1, -1, -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, -1, -1, - -1, 60, -1, -1, 63, -1, -1, -1, 67, -1, - -1, 142, -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, -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, 17, 18, 19, 20, 21, 22, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, - -1, -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, - 133, 134, 135, 136, 137, 138, 139, 140, 141, -1, - 143, 144, 145, -1, -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, 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, 93, 94, -1, 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, -1, -1, 135, 136, 137, 138, 139, 140, 141, - -1, 143, 144, 145, -1, -1, -1, 133, 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, 134, -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, 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, 100, 101, -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, 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, - 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, -1, -1, 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, -1, - 96, -1, 114, 115, -1, 101, 118, 103, 49, 50, - 106, -1, -1, -1, -1, -1, 57, 58, 114, 115, - -1, -1, 118, -1, -1, 66, -1, 68, 69, 70, - 71, -1, -1, -1, 75, -1, -1, -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, 57, 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, 57, 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, 57, 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, - 57, 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, 57, 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, 57, 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, 57, 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, -1, 50, 107, 108, - -1, -1, -1, 112, 57, 58, -1, -1, 117, 118, - -1, 120, -1, -1, -1, 68, 69, 70, -1, -1, - -1, -1, -1, 50, -1, -1, 79, -1, -1, -1, - 57, 58, -1, -1, 87, -1, 145, -1, -1, -1, - -1, 68, 69, 70, 97, -1, -1, -1, -1, -1, - 103, -1, 79, -1, -1, 108, -1, -1, -1, -1, - 87, -1, -1, -1, 117, 118, 50, 120, -1, -1, - 97, -1, -1, 57, 58, -1, 103, -1, -1, -1, - 107, 108, 135, -1, 68, 69, 70, -1, -1, -1, - 117, 118, 145, 120, -1, 79, -1, -1, -1, -1, - -1, -1, 50, 87, 88, -1, -1, -1, -1, 57, - 58, -1, -1, 97, -1, -1, -1, -1, 145, 103, - 68, 69, 70, -1, 108, -1, -1, -1, -1, -1, - -1, 79, -1, -1, 118, -1, 120, -1, -1, 87, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, - -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, - 108, 145, -1, -1, -1, -1, -1, -1, -1, -1, - 118, -1, 120, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 145 + -1, -1, -1, -1, -1, -1, 162 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_uint16 yystos[] = { - 0, 123, 124, 125, 151, 152, 253, 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, 243, 244, - 252, 11, 48, 51, 53, 54, 55, 56, 57, 60, - 63, 67, 74, 80, 81, 100, 101, 106, 114, 115, - 116, 119, 121, 207, 211, 212, 214, 220, 221, 225, - 226, 231, 232, 233, 234, 0, 49, 50, 57, 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, 181, 227, 230, 253, 144, 144, 144, 144, - 144, 144, 135, 144, 135, 144, 144, 144, 11, 48, - 60, 114, 209, 225, 226, 231, 135, 144, 144, 144, - 135, 144, 144, 144, 243, 243, 243, 243, 243, 11, - 51, 53, 54, 55, 63, 74, 80, 81, 100, 101, - 116, 121, 211, 241, 243, 10, 11, 73, 74, 93, - 94, 96, 101, 103, 130, 134, 247, 248, 250, 253, - 243, 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, 207, 144, 56, 106, - 63, 81, 232, 232, 232, 250, 232, 12, 16, 57, - 120, 134, 139, 144, 205, 206, 253, 126, 10, 11, - 93, 129, 251, 10, 11, 93, 126, 250, 251, 79, - 160, 160, 160, 160, 6, 160, 160, 129, 159, 88, - 160, 144, 144, 144, 144, 160, 126, 250, 129, 129, - 129, 160, 160, 144, 160, 163, 182, 160, 160, 166, - 88, 250, 160, 160, 145, 10, 11, 48, 60, 92, - 114, 126, 142, 169, 172, 208, 210, 212, 214, 220, - 225, 226, 231, 240, 241, 253, 211, 240, 240, 240, - 240, 211, 240, 211, 240, 240, 240, 144, 250, 144, - 250, 250, 211, 240, 240, 211, 211, 211, 243, 240, - 240, 146, 127, 146, 250, 148, 127, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 146, 241, - 243, 206, 243, 139, 12, 16, 57, 120, 134, 139, - 205, 253, 205, 206, 205, 206, 205, 205, 14, 16, - 57, 97, 134, 139, 191, 192, 201, 207, 253, 145, - 223, 224, 253, 11, 222, 232, 129, 213, 215, 160, - 157, 126, 250, 250, 250, 250, 250, 152, 126, 243, - 135, 10, 11, 172, 208, 210, 250, 128, 130, 161, - 162, 250, 144, 144, 144, 57, 207, 250, 156, 250, - 126, 128, 129, 130, 197, 126, 128, 130, 198, 128, - 164, 250, 251, 250, 146, 146, 146, 146, 146, 146, - 136, 146, 136, 146, 146, 146, 243, 240, 136, 146, - 146, 146, 136, 146, 146, 146, 146, 243, 243, 57, - 144, 178, 253, 247, 129, 146, 148, 146, 205, 139, - 205, 205, 205, 205, 205, 145, 205, 97, 207, 201, - 205, 205, 146, 14, 127, 12, 16, 57, 120, 134, - 139, 144, 204, 251, 253, 239, 243, 253, 250, 147, - 222, 152, 73, 216, 253, 152, 126, 127, 127, 127, - 127, 147, 228, 127, 146, 10, 11, 56, 57, 114, - 183, 184, 185, 186, 231, 253, 144, 198, 167, 128, - 211, 148, 127, 144, 170, 12, 139, 171, 243, 207, - 12, 16, 57, 120, 134, 139, 203, 251, 253, 152, - 144, 235, 236, 153, 154, 250, 61, 62, 235, 61, - 62, 126, 243, 12, 16, 57, 92, 120, 134, 139, - 144, 165, 187, 189, 251, 129, 144, 144, 146, 146, - 144, 144, 191, 32, 73, 87, 90, 93, 109, 190, - 253, 243, 205, 239, 146, 207, 204, 146, 146, 178, - 14, 201, 139, 204, 204, 204, 204, 204, 204, 130, - 145, 196, 253, 148, 127, 130, 147, 129, 217, 218, - 253, 147, 229, 10, 10, 10, 10, 152, 252, 128, - 250, 186, 250, 136, 127, 204, 168, 189, 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, 193, 194, 201, 202, - 245, 246, 252, 253, 191, 139, 187, 191, 146, 203, - 139, 203, 203, 203, 203, 203, 144, 145, 147, 173, - 147, 237, 253, 126, 127, 126, 144, 128, 128, 147, - 128, 128, 126, 199, 200, 243, 253, 128, 139, 187, - 187, 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, 179, 187, 187, 187, 187, 129, 144, 145, 190, - 130, 196, 198, 222, 241, 241, 241, 241, 146, 57, - 209, 144, 126, 148, 144, 204, 196, 144, 144, 190, - 204, 146, 243, 239, 243, 94, 95, 96, 114, 118, - 219, 226, 249, 250, 126, 127, 152, 127, 146, 127, - 127, 127, 147, 146, 130, 204, 130, 163, 180, 181, - 185, 130, 195, 253, 196, 198, 160, 144, 135, 135, - 209, 135, 144, 135, 144, 243, 243, 243, 243, 211, - 241, 243, 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, 187, - 146, 146, 144, 203, 176, 239, 191, 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, 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, 238, 235, 154, 240, 240, 199, 147, 127, 187, - 10, 146, 148, 146, 4, 188, 239, 243, 127, 146, - 146, 146, 146, 178, 209, 206, 146, 250, 235, 191, - 196, 191, 191, 144, 148, 127, 118, 249, 118, 249, - 118, 249, 250, 94, 95, 96, 250, 152, 219, 147, - 10, 128, 10, 10, 10, 128, 211, 195, 211, 47, - 59, 64, 98, 102, 105, 134, 137, 138, 139, 142, - 144, 149, 242, 244, 127, 211, 211, 211, 144, 211, - 211, 211, 211, 243, 146, 146, 14, 202, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 146, - 241, 243, 178, 146, 144, 178, 177, 191, 148, 146, - 237, 147, 147, 146, 147, 126, 243, 193, 148, 165, - 190, 206, 146, 147, 146, 146, 146, 191, 249, 249, - 249, 249, 249, 249, 147, 127, 146, 127, 146, 146, - 127, 146, 144, 135, 135, 135, 144, 135, 242, 242, - 242, 242, 242, 211, 241, 242, 15, 16, 17, 18, - 19, 20, 21, 22, 32, 131, 132, 133, 134, 137, - 138, 139, 140, 141, 143, 144, 145, 168, 146, 136, - 136, 240, 136, 146, 136, 146, 146, 243, 129, 146, - 148, 144, 174, 191, 146, 178, 147, 199, 146, 126, - 178, 178, 178, 146, 10, 128, 10, 128, 128, 10, - 128, 211, 211, 211, 211, 211, 211, 146, 146, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 146, 241, - 243, 144, 144, 146, 144, 144, 243, 175, 191, 146, - 178, 147, 178, 235, 190, 190, 190, 178, 146, 127, - 127, 146, 146, 136, 136, 136, 146, 136, 242, 129, - 146, 148, 241, 241, 241, 241, 191, 146, 178, 147, - 128, 10, 10, 128, 144, 144, 144, 144, 242, 146, - 146, 146, 146, 146, 178, 146, 146, 241, 241, 241, - 241, 178, 190, 128, 128, 146, 146, 146, 146, 190 + 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, + 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, 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_uint8 yyr1[] = +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, 160, 161, 161, 162, 162, 164, - 163, 163, 163, 163, 163, 165, 165, 167, 166, 166, - 168, 168, 170, 169, 171, 169, 173, 172, 174, 172, - 175, 172, 176, 172, 177, 172, 172, 178, 178, 178, - 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, - 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 179, 179, 180, 180, 182, 181, 181, 183, - 183, 184, 184, 185, 185, 185, 185, 185, 185, 186, - 186, 186, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 188, 187, 189, 189, 190, 190, 190, - 191, 191, 191, 191, 191, 192, 192, 193, 193, 193, - 193, 193, 194, 194, 195, 195, 196, 196, 197, 197, - 197, 197, 197, 198, 198, 198, 198, 198, 198, 199, - 199, 199, 200, 200, 200, 200, 201, 201, 201, 201, - 202, 202, 203, 203, 203, 203, 203, 203, 203, 203, - 203, 204, 204, 204, 204, 204, 204, 204, 204, 204, - 204, 204, 205, 205, 205, 205, 205, 205, 205, 205, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 206, 207, 207, 207, 207, 207, 207, 207, 207, - 207, 207, 208, 208, 208, 208, 208, 208, 208, 208, - 208, 208, 208, 209, 209, 209, 209, 209, 209, 209, - 210, 210, 211, 211, 213, 212, 215, 214, 216, 216, - 217, 217, 218, 218, 219, 219, 219, 219, 219, 219, - 219, 219, 219, 219, 220, 221, 221, 221, 221, 222, - 222, 223, 223, 223, 224, 224, 224, 225, 225, 225, - 226, 226, 226, 228, 227, 229, 227, 227, 227, 230, - 230, 230, 231, 231, 231, 232, 232, 232, 232, 232, - 232, 232, 232, 232, 232, 232, 232, 232, 232, 233, - 233, 233, 234, 236, 235, 237, 237, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 239, 239, 240, 240, 241, 241, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 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, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 247, 247, 247, 248, - 248, 248, 248, 249, 249, 249, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 251, 251, 251, 252, 252, - 252, 252, 253 + 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, 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, 1, 2, - 2, 2, 2, 4, 5, 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, 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, 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, @@ -2746,27 +2991,29 @@ static const yytype_uint8 yyr2[] = 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, 1, 1, - 3, 1, 1, 1, 1, 1, 3, 1, 4, 7, - 7, 7, 7, 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, 4, 7, 7, 7, 7, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 3, 1, 4, 7, 7, 7, + 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, 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, 4, 4, 2, 5, 4, 4, 2, + 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, 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, 5, 4, 4, 2, 2, 2, 2, 2, + 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, 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, + 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, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 0 + 1, 2, 2, 0 }; @@ -3542,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 3550 "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 3558 "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 3566 "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 3574 "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 3583 "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 3591 "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); @@ -3604,11 +3859,11 @@ yyreduce: publish_nest_level++; current_scope->set_current_vis(V_published); } -#line 3608 "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])); @@ -3617,19 +3872,19 @@ yyreduce: } publish_nest_level = 0; } -#line 3621 "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 3629 "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); @@ -3637,27 +3892,27 @@ yyreduce: current_scope->set_current_vis(V_public); } } -#line 3641 "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 3649 "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 3657 "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); @@ -3668,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 3672 "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) { @@ -3693,11 +3948,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-8])); } } -#line 3697 "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) { @@ -3727,11 +3982,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-10])); } } -#line 3731 "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) { @@ -3748,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 3752 "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) { @@ -3780,11 +4035,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-10])); } } -#line 3784 "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) { @@ -3821,11 +4076,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-12])); } } -#line 3825 "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) { @@ -3847,11 +4102,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-8])); } } -#line 3851 "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) { @@ -3884,11 +4139,11 @@ yyreduce: current_scope->add_declaration(make_property, global_scope, current_lexer, (yylsp[-12])); } } -#line 3888 "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) { @@ -3910,11 +4165,11 @@ yyreduce: current_scope->add_declaration(make_seq, global_scope, current_lexer, (yylsp[-8])); } } -#line 3914 "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) { @@ -3925,11 +4180,11 @@ yyreduce: yywarning("static_assert failed: " + str.str(), (yylsp[-4])); } } -#line 3929 "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(); @@ -3939,55 +4194,55 @@ yyreduce: yywarning("static_assert failed", (yylsp[-2])); } } -#line 3943 "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 3953 "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 3962 "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 3970 "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) = 0; +} +#line 4225 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 41: +#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 3979 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 41: -#line 793 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extern; -} -#line 3987 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4234 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 42: -#line 797 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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") { @@ -3998,108 +4253,108 @@ yyreduce: yywarning("Ignoring unknown linkage type \"" + (yyvsp[-1].str) + "\"", (yylsp[-1])); } } -#line 4002 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 43: -#line 808 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_static; -} -#line 4010 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4257 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 44: -#line 812 "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_inline; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_static; } -#line 4018 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4265 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 45: -#line 816 "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_virtual; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_inline; } -#line 4026 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4273 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 46: -#line 820 "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_explicit; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_virtual; } -#line 4034 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4281 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 47: -#line 824 "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_register; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_explicit; } -#line 4042 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4289 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 48: -#line 828 "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_volatile; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_register; } -#line 4050 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4297 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 49: -#line 832 "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_mutable; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_volatile; } -#line 4058 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4305 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 50: -#line 836 "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_constexpr; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_mutable; } -#line 4066 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4313 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 51: -#line 840 "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_blocking; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_constexpr; } -#line 4074 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4321 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 52: -#line 844 "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_extension; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_blocking; } -#line 4082 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4329 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 53: -#line 848 "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_thread_local; + (yyval.u.integer) = (yyvsp[0].u.integer) | (int)CPPInstance::SC_extension; } -#line 4090 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4337 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 54: -#line 852 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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 4099 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4354 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 59: -#line 870 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 60: +#line 892 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { // We don't need to push/pop type, because we can't nest // type_like_declaration. @@ -4110,19 +4365,19 @@ yyreduce: } push_storage_class((yyvsp[-1].u.integer)); } -#line 4114 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 60: -#line 881 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - pop_storage_class(); -} -#line 4122 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4369 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 61: -#line 886 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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 @@ -4131,23 +4386,11 @@ yyreduce: current_scope->add_declaration((yyvsp[-1].u.decl), global_scope, current_lexer, (yylsp[-1])); } -#line 4135 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 62: -#line 895 "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 4147 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4390 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 63: -#line 903 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 917 "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)); @@ -4155,11 +4398,23 @@ yyreduce: (yyvsp[-1].u.instance)->set_initializer((yyvsp[0].u.expr)); } } -#line 4159 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4402 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 65: -#line 919 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 64: +#line 925 "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 4414 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 66: +#line 941 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if (current_storage_class & CPPInstance::SC_const) { (yyvsp[-1].u.inst_ident)->add_modifier(IIT_const); @@ -4170,11 +4425,11 @@ yyreduce: inst->set_initializer((yyvsp[0].u.expr)); current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-1])); } -#line 4174 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4429 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 66: -#line 930 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 67: +#line 952 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { if (current_storage_class & CPPInstance::SC_const) { (yyvsp[-3].u.inst_ident)->add_modifier(IIT_const); @@ -4185,11 +4440,11 @@ yyreduce: inst->set_initializer((yyvsp[-2].u.expr)); current_scope->add_declaration(inst, global_scope, current_lexer, (yylsp[-3])); } -#line 4189 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4444 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 67: -#line 945 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 68: +#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. @@ -4200,19 +4455,19 @@ yyreduce: } push_storage_class((yyvsp[-1].u.integer)); } -#line 4204 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 68: -#line 956 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - pop_storage_class(); -} -#line 4212 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4459 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 69: -#line 960 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 978 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + pop_storage_class(); +} +#line 4467 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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(); @@ -4224,11 +4479,11 @@ yyreduce: } } } -#line 4228 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4483 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 70: -#line 975 "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); @@ -4237,11 +4492,11 @@ yyreduce: 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 4241 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4496 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 71: -#line 984 "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); @@ -4250,19 +4505,19 @@ yyreduce: 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 4254 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 72: -#line 998 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); -} -#line 4262 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4509 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 73: -#line 1002 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1020 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); +} +#line 4517 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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() || @@ -4282,19 +4537,19 @@ yyreduce: (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-5]).file); } -#line 4286 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 74: -#line 1022 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); -} -#line 4294 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4541 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 75: -#line 1026 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1044 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); +} +#line 4549 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 76: +#line 1048 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); CPPType *type; @@ -4312,19 +4567,19 @@ yyreduce: (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-5]).file); } -#line 4316 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 76: -#line 1049 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); -} -#line 4324 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4571 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 77: -#line 1053 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1071 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + push_scope((yyvsp[-1].u.identifier)->get_scope(current_scope, global_scope)); +} +#line 4579 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 78: +#line 1075 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); if ((yyvsp[-5].u.identifier)->is_scoped()) { @@ -4343,19 +4598,19 @@ yyreduce: (yyval.u.instance) = new CPPInstance(type, ii, 0, (yylsp[-5]).file); } } -#line 4347 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 78: -#line 1079 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - push_scope((yyvsp[-2].u.inst_ident)->get_scope(current_scope, global_scope)); -} -#line 4355 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4602 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 79: -#line 1083 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1101 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + push_scope((yyvsp[-2].u.inst_ident)->get_scope(current_scope, global_scope)); +} +#line 4610 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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); @@ -4369,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 4373 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 80: -#line 1097 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - push_scope((yyvsp[-2].u.inst_ident)->get_scope(current_scope, global_scope)); -} -#line 4381 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4628 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 81: -#line 1101 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1119 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + push_scope((yyvsp[-2].u.inst_ident)->get_scope(current_scope, global_scope)); +} +#line 4636 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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); @@ -4395,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 4399 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4654 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 82: -#line 1117 "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 4409 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4664 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 83: -#line 1123 "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(); @@ -4434,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 4438 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4693 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 84: -#line 1148 "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 4448 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4703 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 85: -#line 1154 "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(); @@ -4464,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 4468 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4723 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 86: -#line 1174 "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); @@ -4478,494 +4733,557 @@ yyreduce: (yyval.u.instance) = (CPPInstance *)NULL; } } -#line 4482 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 87: -#line 1187 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.integer) = 0; -} -#line 4490 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4737 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 88: -#line 1191 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1209 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_const_method; + (yyval.u.integer) = 0; } -#line 4498 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4745 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 89: -#line 1195 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1213 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_noexcept; + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_const_method; } -#line 4506 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4753 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 90: -#line 1199 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1217 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_final; + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_volatile_method; } -#line 4514 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4761 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 91: -#line 1203 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1221 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (int)CPPFunctionType::F_override; + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_noexcept; } -#line 4522 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4769 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 92: -#line 1207 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1225 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - // Used for lambdas, currently ignored. - (yyval.u.integer) = 0; + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_final; } -#line 4531 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4777 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 93: -#line 1212 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1229 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[-3].u.integer); + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_override; } -#line 4539 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4785 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 94: -#line 1216 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1233 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.integer) = (yyvsp[-4].u.integer); + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_lvalue_method; } -#line 4547 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4793 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 95: -#line 1227 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1237 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "!"; + (yyval.u.integer) = (yyvsp[-1].u.integer) | (int)CPPFunctionType::F_rvalue_method; } -#line 4555 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4801 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 96: -#line 1231 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1241 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "~"; + // Used for lambdas, currently ignored. + (yyval.u.integer) = (yyvsp[-1].u.integer); } -#line 4563 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4810 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 97: -#line 1235 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1246 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "*"; + (yyval.u.integer) = (yyvsp[-3].u.integer); } -#line 4571 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4818 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 98: -#line 1239 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1250 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "/"; + (yyval.u.integer) = (yyvsp[-4].u.integer); } -#line 4579 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4826 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 99: -#line 1243 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1254 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "%"; + (yyval.u.integer) = (yyvsp[-5].u.integer); } -#line 4587 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4834 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 100: -#line 1247 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1265 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "+"; + (yyval.str) = "!"; } -#line 4595 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4842 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 101: -#line 1251 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1269 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "-"; + (yyval.str) = "~"; } -#line 4603 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4850 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 102: -#line 1255 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1273 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "|"; + (yyval.str) = "*"; } -#line 4611 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4858 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 103: -#line 1259 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1277 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "&"; + (yyval.str) = "/"; } -#line 4619 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4866 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 104: -#line 1263 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1281 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "^"; + (yyval.str) = "%"; } -#line 4627 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4874 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 105: -#line 1267 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1285 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "||"; + (yyval.str) = "+"; } -#line 4635 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4882 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 106: -#line 1271 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1289 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "&&"; + (yyval.str) = "-"; } -#line 4643 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4890 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 107: -#line 1275 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1293 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "=="; + (yyval.str) = "|"; } -#line 4651 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4898 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 108: -#line 1279 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1297 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "!="; + (yyval.str) = "&"; } -#line 4659 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4906 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 109: -#line 1283 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1301 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "<="; + (yyval.str) = "^"; } -#line 4667 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4914 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 110: -#line 1287 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1305 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = ">="; + (yyval.str) = "||"; } -#line 4675 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4922 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 111: -#line 1291 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1309 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "<"; + (yyval.str) = "&&"; } -#line 4683 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4930 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 112: -#line 1295 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1313 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = ">"; + (yyval.str) = "=="; } -#line 4691 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4938 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 113: -#line 1299 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1317 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "<<"; + (yyval.str) = "!="; } -#line 4699 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4946 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 114: -#line 1303 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1321 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = ">>"; + (yyval.str) = "<="; } -#line 4707 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4954 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 115: -#line 1307 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1325 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "="; + (yyval.str) = ">="; } -#line 4715 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4962 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 116: -#line 1311 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1329 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = ","; + (yyval.str) = "<"; } -#line 4723 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4970 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 117: -#line 1315 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1333 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "++"; + (yyval.str) = ">"; } -#line 4731 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4978 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 118: -#line 1319 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1337 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "--"; + (yyval.str) = "<<"; } -#line 4739 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4986 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 119: -#line 1323 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1341 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "*="; + (yyval.str) = ">>"; } -#line 4747 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 4994 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 120: -#line 1327 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1345 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "/="; + (yyval.str) = "="; } -#line 4755 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5002 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 121: -#line 1331 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1349 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "%="; + (yyval.str) = ","; } -#line 4763 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5010 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 122: -#line 1335 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1353 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "+="; + (yyval.str) = "++"; } -#line 4771 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5018 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 123: -#line 1339 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1357 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "-="; + (yyval.str) = "--"; } -#line 4779 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5026 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 124: -#line 1343 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1361 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "|="; + (yyval.str) = "*="; } -#line 4787 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5034 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 125: -#line 1347 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1365 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "&="; + (yyval.str) = "/="; } -#line 4795 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5042 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 126: -#line 1351 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1369 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "^="; + (yyval.str) = "%="; } -#line 4803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5050 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 127: -#line 1355 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1373 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "<<="; + (yyval.str) = "+="; } -#line 4811 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5058 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 128: -#line 1359 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1377 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = ">>="; + (yyval.str) = "-="; } -#line 4819 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5066 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 129: -#line 1363 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1381 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "->"; + (yyval.str) = "|="; } -#line 4827 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5074 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 130: -#line 1367 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1385 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "[]"; + (yyval.str) = "&="; } -#line 4835 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5082 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 131: -#line 1371 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1389 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "()"; + (yyval.str) = "^="; } -#line 4843 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5090 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 132: -#line 1375 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1393 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "new"; + (yyval.str) = "<<="; } -#line 4851 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5098 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 133: -#line 1379 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1397 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.str) = "delete"; + (yyval.str) = ">>="; } -#line 4859 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5106 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 134: +#line 1401 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.str) = "->"; +} +#line 5114 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 135: +#line 1405 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.str) = "[]"; +} +#line 5122 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 136: -#line 1391 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1409 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - push_scope(new CPPTemplateScope(current_scope)); + (yyval.str) = "()"; } -#line 4867 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5130 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 137: -#line 1395 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1413 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - pop_scope(); + (yyval.str) = "new"; } -#line 4875 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5138 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 138: +#line 1417 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.str) = "delete"; +} +#line 5146 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 141: -#line 1408 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1429 "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)); + push_scope(new CPPTemplateScope(current_scope)); } -#line 4885 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5154 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 142: -#line 1414 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1433 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + pop_scope(); +} +#line 5162 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 4895 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 143: -#line 1423 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[0].u.identifier))); -} -#line 4903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 144: -#line 1427 "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 4911 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 145: -#line 1431 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[0].u.identifier))); -} -#line 4919 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 146: -#line 1435 "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 4927 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5172 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 147: -#line 1439 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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 1466 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((CPPIdentifier *)NULL)); +} +#line 5190 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 151: +#line 1470 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[0].u.identifier))); +} +#line 5198 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 152: +#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 5206 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 153: +#line 1478 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((CPPIdentifier *)NULL); + ctp->_packed = true; + (yyval.u.decl) = CPPType::new_type(ctp); +} +#line 5216 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 154: +#line 1484 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPClassTemplateParameter *ctp = new CPPClassTemplateParameter((yyvsp[0].u.identifier)); + ctp->_packed = true; + (yyval.u.decl) = CPPType::new_type(ctp); +} +#line 5226 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 155: +#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 4937 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5236 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 148: -#line 1445 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 156: +#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 4948 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5247 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 149: -#line 1455 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 157: +#line 1503 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + CPPInstance *inst = new CPPInstance((yyvsp[-1].u.type), (yyvsp[0].u.inst_ident), 0, (yylsp[0]).file); + (yyval.u.decl) = inst; +} +#line 5256 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 158: +#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 4956 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5274 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 150: -#line 1459 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + 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 4965 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5283 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 151: -#line 1464 "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) { @@ -4973,19 +5291,31 @@ yyreduce: } assert((yyval.u.type) != NULL); } -#line 4977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5295 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 152: -#line 1476 "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 4985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5315 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 153: -#line 1480 "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 @@ -4999,11 +5329,11 @@ yyreduce: (yyval.u.inst_ident) = new CPPInstanceIdentifier(ident); } -#line 5003 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5333 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 154: -#line 1494 "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()) { @@ -5018,91 +5348,91 @@ yyreduce: (yyval.u.inst_ident) = new CPPInstanceIdentifier(ident); } -#line 5022 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5352 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 155: -#line 1509 "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 5031 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5361 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 156: -#line 1514 "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 5040 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5370 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 157: -#line 1519 "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 5049 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5379 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 158: -#line 1524 "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 5058 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5388 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 159: -#line 1529 "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 5067 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5397 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 160: -#line 1534 "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 5076 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5406 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 161: -#line 1539 "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 5085 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5415 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 162: -#line 1544 "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 5094 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5424 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 163: -#line 1549 "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)); } -#line 5102 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5432 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 164: -#line 1553 "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); @@ -5116,11 +5446,11 @@ yyreduce: (yyval.u.inst_ident)->add_func_modifier((yyvsp[-2].u.param_list), (yyvsp[0].u.integer)); } } -#line 5120 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5450 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 165: -#line 1571 "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 @@ -5130,721 +5460,886 @@ yyreduce: } (yyval.u.inst_ident) = (yyvsp[-1].u.inst_ident); } -#line 5134 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5464 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 166: -#line 1581 "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 5144 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5474 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 167: -#line 1591 "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 5152 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5482 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 168: -#line 1595 "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 5160 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5490 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 169: -#line 1599 "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 5169 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 170: -#line 1608 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; -} -#line 5177 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 171: -#line 1612 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; - (yyval.u.param_list)->_includes_ellipsis = true; -} -#line 5186 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 172: -#line 1617 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = (yyvsp[0].u.param_list); -} -#line 5194 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 173: -#line 1621 "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 5203 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 174: -#line 1626 "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 5212 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 175: -#line 1634 "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 5221 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 176: -#line 1639 "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 5230 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 177: -#line 1647 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; -} -#line 5238 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 178: -#line 1651 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = new CPPParameterList; - (yyval.u.param_list)->_includes_ellipsis = true; -} -#line 5247 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 179: -#line 1656 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.param_list) = (yyvsp[0].u.param_list); -} -#line 5255 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 180: -#line 1660 "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 5264 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5499 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 181: -#line 1665 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1678 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.param_list) = new CPPParameterList; +} +#line 5507 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 182: +#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 5273 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5542 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 182: -#line 1673 "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 5282 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5551 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 183: -#line 1678 "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 5291 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 184: -#line 1686 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 5299 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 185: -#line 1690 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 5307 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 186: -#line 1697 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 5315 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 187: -#line 1701 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 5323 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5560 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 188: -#line 1708 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1717 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (yyval.u.param_list) = new CPPParameterList; } -#line 5331 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5568 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 189: -#line 1712 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1721 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (yyval.u.param_list) = new CPPParameterList; + (yyval.u.param_list)->_includes_ellipsis = true; } -#line 5339 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5577 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 190: -#line 1716 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1726 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (yyval.u.param_list) = (yyvsp[0].u.param_list); } -#line 5347 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5585 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 191: -#line 1720 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1730 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_default()); + (yyval.u.param_list) = (yyvsp[-2].u.param_list); + (yyval.u.param_list)->_includes_ellipsis = true; } -#line 5355 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5594 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 192: -#line 1724 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1735 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_delete()); + (yyval.u.param_list) = (yyvsp[-1].u.param_list); + (yyval.u.param_list)->_includes_ellipsis = true; } -#line 5363 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5603 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 193: -#line 1731 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1743 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (yyval.u.param_list) = new CPPParameterList; + (yyval.u.param_list)->_parameters.push_back((yyvsp[0].u.instance)); } -#line 5371 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5612 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 194: -#line 1735 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1748 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = (CPPExpression *)NULL; + (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 */ +#line 5621 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 195: -#line 1739 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 5387 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 196: -#line 1743 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_default()); -} -#line 5395 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 197: -#line 1747 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_delete()); -} -#line 5403 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 198: -#line 1751 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1756 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (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 1760 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 5637 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 197: +#line 1767 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 5645 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 198: +#line 1771 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 5653 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 199: +#line 1778 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 5661 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 200: +#line 1782 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 5669 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 201: +#line 1786 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 5677 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 202: -#line 1764 "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 5418 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5685 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 203: +#line 1794 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(CPPExpression::get_delete()); +} +#line 5693 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 204: +#line 1801 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (CPPExpression *)NULL; +} +#line 5701 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 1773 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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 5741 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 5427 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5757 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 207: -#line 1778 "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 5437 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5767 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 208: -#line 1784 "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 5447 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5777 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 209: -#line 1790 "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 5455 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5814 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 210: -#line 1801 "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 5463 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5822 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 211: -#line 1805 "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 5474 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 212: -#line 1815 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5482 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 213: -#line 1819 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); -} -#line 5490 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 214: -#line 1823 "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 5499 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 215: -#line 1828 "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 5508 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 216: -#line 1833 "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 5517 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 217: -#line 1838 "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 5526 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 218: -#line 1843 "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 5535 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 219: -#line 1848 "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 5544 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 220: -#line 1853 "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 5553 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 221: -#line 1861 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5561 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 222: -#line 1865 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); -} -#line 5569 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 223: -#line 1869 "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 5578 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 224: -#line 1874 "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 5587 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 225: -#line 1879 "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 5596 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5833 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 226: -#line 1884 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 1902 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); +} +#line 5841 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 227: +#line 1906 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[0].u.identifier)); +} +#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[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_const); +} +#line 5858 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 5867 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 5876 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 5605 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5885 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 227: -#line 1889 "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 5614 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5894 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 228: -#line 1894 "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 5623 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 229: -#line 1899 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + 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 5632 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 5912 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 230: -#line 1904 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + 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[0].u.inst_ident); + (yyval.u.inst_ident)->add_modifier(IIT_const); +} +#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 5642 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6001 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 231: -#line 1910 "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 5651 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 232: -#line 1918 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5659 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 233: -#line 1922 "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 5668 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 234: -#line 1927 "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 5677 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 235: -#line 1932 "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 5686 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 236: -#line 1937 "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 5695 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 237: -#line 1942 "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 5704 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 238: -#line 1947 "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 5713 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 239: -#line 1952 "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 5722 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 240: -#line 1960 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); -} -#line 5730 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 241: -#line 1964 "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 5739 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 242: -#line 1969 "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 5748 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 243: -#line 1974 "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 5757 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 244: -#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_reference); -} -#line 5766 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 245: -#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_rvalue_reference); -} -#line 5775 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6010 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 246: -#line 1989 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2005 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); + (yyval.u.inst_ident)->_packed = true; +} +#line 6019 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 247: +#line 2010 "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 6028 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 248: +#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 6037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 6046 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 6055 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 6064 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 6073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 5784 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6082 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 247: -#line 1994 "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 5793 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6091 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 248: -#line 1999 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + 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 5803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6298 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 249: -#line 2005 "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 5814 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6309 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 250: -#line 2012 "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 5825 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6320 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 251: -#line 2019 "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 5836 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6331 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 252: -#line 2029 "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 5844 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6339 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 253: -#line 2033 "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) { @@ -5852,43 +6347,43 @@ yyreduce: } assert((yyval.u.type) != NULL); } -#line 5856 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6351 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 254: -#line 2041 "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 5864 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6359 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 255: -#line 2045 "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 5872 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6367 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 256: -#line 2049 "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 5880 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6375 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 257: -#line 2053 "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 5888 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6383 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 258: -#line 2057 "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) { @@ -5904,11 +6399,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 5908 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6403 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 259: -#line 2073 "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) { @@ -5924,11 +6419,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 5928 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6423 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 260: -#line 2089 "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) { @@ -5937,27 +6432,53 @@ yyreduce: yyerror("could not determine type of " + str.str(), (yylsp[-1])); } } -#line 5941 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6436 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 261: -#line 2098 "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 5949 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6458 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 262: -#line 2105 "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 5957 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6478 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 263: -#line 2109 "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) { @@ -5965,43 +6486,43 @@ yyreduce: } assert((yyval.u.decl) != NULL); } -#line 5969 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6490 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 264: -#line 2117 "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 5977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6498 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 265: -#line 2121 "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 5985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6506 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 266: -#line 2125 "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 5993 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6514 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 267: -#line 2129 "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 6001 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6522 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 268: -#line 2133 "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) { @@ -6017,11 +6538,11 @@ yyreduce: (yyval.u.decl) = et; } } -#line 6021 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6542 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 269: -#line 2149 "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) { @@ -6037,11 +6558,11 @@ yyreduce: (yyval.u.decl) = et; } } -#line 6041 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6562 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 270: -#line 2165 "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])); @@ -6059,11 +6580,11 @@ yyreduce: (yyval.u.decl) = et; } } -#line 6063 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6584 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 271: -#line 2183 "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) { @@ -6072,27 +6593,41 @@ yyreduce: yyerror("could not determine type of " + str.str(), (yylsp[-1])); } } -#line 6076 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6597 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 272: -#line 2192 "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 6084 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6619 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 273: -#line 2199 "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 6092 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6627 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 274: -#line 2203 "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) { @@ -6100,19 +6635,19 @@ yyreduce: } assert((yyval.u.type) != NULL); } -#line 6104 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6639 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 275: -#line 2211 "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 6112 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6647 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 276: -#line 2215 "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) { @@ -6128,11 +6663,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 6132 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6667 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 277: -#line 2231 "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) { @@ -6148,11 +6683,11 @@ yyreduce: (yyval.u.type) = et; } } -#line 6152 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6687 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 278: -#line 2247 "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) { @@ -6161,54 +6696,85 @@ yyreduce: yyerror("could not determine type of " + str.str(), (yylsp[-1])); } } -#line 6165 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6700 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 279: -#line 2256 "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 6173 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6722 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 280: -#line 2263 "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 6181 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6730 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 281: -#line 2267 "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 6191 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6740 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 282: -#line 2275 "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 6199 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6748 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 283: -#line 2279 "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 6208 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6757 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 284: -#line 2287 "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; @@ -6222,22 +6788,22 @@ yyreduce: push_scope(new_scope); push_struct(st); } -#line 6226 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6792 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 285: -#line 2301 "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 6237 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 286: -#line 2311 "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; @@ -6257,253 +6823,253 @@ yyreduce: push_scope(new_scope); push_struct(st); } -#line 6261 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6827 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 287: -#line 2331 "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 6272 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6838 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 289: -#line 2342 "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 6280 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6846 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 294: -#line 2359 "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 6288 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6854 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 295: -#line 2363 "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 6296 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6862 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 296: -#line 2367 "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 6304 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6870 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 297: -#line 2371 "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 6312 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6878 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 298: -#line 2375 "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 6320 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6886 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 299: -#line 2379 "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 6328 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6894 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 300: -#line 2383 "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 6336 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6902 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 301: -#line 2387 "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 6344 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6910 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 302: -#line 2391 "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 6352 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6918 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 303: -#line 2395 "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 6360 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6926 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 304: -#line 2402 "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 6369 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6935 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 305: -#line 2410 "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 6377 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6943 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 306: -#line 2414 "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 6385 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6951 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 307: -#line 2418 "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 6394 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6960 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 308: -#line 2423 "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 6403 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6969 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 309: -#line 2431 "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 6411 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 310: -#line 2435 "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 6419 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 312: -#line 2443 "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 6428 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 6994 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 313: -#line 2448 "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 6437 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7003 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 315: -#line 2456 "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 6446 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7012 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 316: -#line 2461 "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 6455 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7021 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 317: -#line 2469 "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 6463 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7029 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 318: -#line 2473 "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 6471 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 319: -#line 2477 "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 6479 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7045 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 320: -#line 2484 "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 6487 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7053 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 321: -#line 2488 "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 6495 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7061 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 322: -#line 2492 "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 6503 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7069 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 323: -#line 2499 "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) { @@ -6521,19 +7087,19 @@ yyreduce: current_scope->define_namespace(nspace); push_scope(scope); } -#line 6525 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7091 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 324: -#line 2517 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 359: +#line 2733 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); } -#line 6533 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7099 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 325: -#line 2521 "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) { @@ -6552,143 +7118,143 @@ yyreduce: current_scope->define_namespace(nspace); push_scope(scope); } -#line 6556 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7122 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 326: -#line 2540 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + case 361: +#line 2756 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { pop_scope(); } -#line 6564 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7130 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 329: -#line 2549 "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 6574 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7140 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 330: -#line 2555 "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 6585 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7151 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 331: -#line 2562 "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 6595 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7161 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 335: -#line 2577 "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 6603 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7169 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 336: -#line 2581 "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 6611 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7177 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 337: -#line 2585 "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 6619 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7185 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 338: -#line 2589 "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 6627 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7193 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 339: -#line 2593 "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 6635 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7201 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 340: -#line 2597 "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 6644 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7210 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 341: -#line 2602 "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 6653 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7219 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 342: -#line 2607 "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 6662 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7228 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 343: -#line 2612 "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 6671 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7237 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 344: -#line 2617 "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 6679 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7245 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 345: -#line 2621 "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 6688 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7254 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 346: -#line 2626 "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) { @@ -6697,477 +7263,485 @@ yyreduce: (yyval.u.simple_type)->_flags |= CPPSimpleType::F_long; } } -#line 6701 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7267 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 347: -#line 2635 "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 6710 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7276 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 348: -#line 2640 "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 6719 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7285 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 349: -#line 2648 "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 6727 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7293 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 350: -#line 2652 "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 6735 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7301 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 351: -#line 2656 "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 6744 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7310 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 352: -#line 2664 "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 6752 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7318 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 353: -#line 2673 "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 6760 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7326 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 354: -#line 2677 "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 6768 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 457: -#line 2718 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { -} -#line 6775 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 481: -#line 2727 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 6783 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 482: -#line 2731 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6791 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 483: -#line 2738 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (CPPExpression *)NULL; -} -#line 6799 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 484: -#line 2742 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6807 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 485: -#line 2749 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6815 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 486: -#line 2753 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(',', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6823 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 487: -#line 2760 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 6831 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 488: -#line 2764 "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 6839 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 489: -#line 2768 "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 6847 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 490: -#line 2772 "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 6855 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 491: -#line 2776 "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 6863 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 492: -#line 2780 "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 6871 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 493: -#line 2784 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); -} -#line 6879 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 494: -#line 2788 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); -} -#line 6887 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7334 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 495: -#line 2792 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2936 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); } -#line 6895 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 496: -#line 2796 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); -} -#line 6903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 497: -#line 2800 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); -} -#line 6911 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 498: -#line 2804 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); -} -#line 6919 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 499: -#line 2808 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[0].u.expr)); -} -#line 6927 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 500: -#line 2812 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); -} -#line 6935 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 501: -#line 2816 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6943 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 502: -#line 2820 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6951 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 503: -#line 2824 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6959 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 504: -#line 2828 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6967 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 505: -#line 2832 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6975 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 506: -#line 2836 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6983 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 507: -#line 2840 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6991 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 508: -#line 2844 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 6999 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 509: -#line 2848 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7007 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 510: -#line 2852 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7015 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 511: -#line 2856 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7023 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 512: -#line 2860 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7031 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 513: -#line 2864 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7039 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 514: -#line 2868 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7047 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 515: -#line 2872 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7055 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 516: -#line 2876 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7063 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 517: -#line 2880 "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 7071 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 518: -#line 2884 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7079 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7341 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 519: -#line 2888 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2945 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); + (yyval.u.expr) = (CPPExpression *)NULL; } -#line 7087 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7349 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 520: -#line 2892 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); -} -#line 7095 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 521: -#line 2896 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7103 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 522: -#line 2900 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7111 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 523: -#line 2904 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 7119 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 524: -#line 2912 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2949 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 7127 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7357 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 2916 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2978 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { - (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); + (yyval.u.expr) = (yyvsp[0].u.expr); } -#line 7135 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7397 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 526: -#line 2920 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 2982 "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)); + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-2].u.type), (yyvsp[0].u.expr))); } -#line 7143 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7405 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 527: -#line 2924 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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_dynamic_cast)); + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_static_cast)); } -#line 7151 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7413 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 528: -#line 2928 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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_const_cast)); + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_dynamic_cast)); } -#line 7159 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7421 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 529: -#line 2932 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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_reinterpret_cast)); + (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[-4].u.type), (yyvsp[-1].u.expr), CPPExpression::T_const_cast)); } -#line 7167 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7429 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 530: -#line 2936 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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 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 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); @@ -7177,633 +7751,175 @@ yyreduce: assert(type != NULL); (yyval.u.expr) = new CPPExpression(CPPExpression::construct_op(type, (yyvsp[-1].u.expr))); } -#line 7181 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7755 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 531: -#line 2946 "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 7191 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7765 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 532: -#line 2952 "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 7201 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7775 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 533: -#line 2958 "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 7211 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7785 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 534: -#line 2964 "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 7221 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7795 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 535: -#line 2970 "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 7231 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7805 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 536: -#line 2976 "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 7241 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7815 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 537: -#line 2982 "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 7252 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7826 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 538: -#line 2989 "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 7263 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7837 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 539: -#line 2996 "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 7274 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7848 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 540: -#line 3003 "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 7285 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7859 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 541: -#line 3010 "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 7295 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7869 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 542: -#line 3016 "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 7305 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 543: -#line 3022 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); -} -#line 7313 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 544: -#line 3026 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[-1].u.type))); -} -#line 7321 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 545: -#line 3030 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[0].u.type))); -} -#line 7329 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 546: -#line 3034 "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 7337 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 547: -#line 3038 "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 7352 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 548: -#line 3049 "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 7367 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 549: -#line 3060 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[0].u.expr)); -} -#line 7375 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 550: -#line 3064 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[0].u.expr)); -} -#line 7383 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 551: -#line 3068 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[0].u.expr)); -} -#line 7391 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 552: -#line 3072 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_PLUS, (yyvsp[0].u.expr)); -} -#line 7399 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 553: -#line 3076 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[0].u.expr)); -} -#line 7407 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 554: -#line 3080 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[0].u.expr)); -} -#line 7415 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 555: -#line 3084 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('*', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7423 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 556: -#line 3088 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('/', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7431 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 557: -#line 3092 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('%', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7439 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 558: -#line 3096 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('+', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7447 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 559: -#line 3100 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('-', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7455 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 560: -#line 3104 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('|', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7463 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 561: -#line 3108 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('^', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7471 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 562: -#line 3112 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('&', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7479 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 563: -#line 3116 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7487 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 564: -#line 3120 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7495 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 565: -#line 3124 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7503 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 566: -#line 3128 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7511 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 567: -#line 3132 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7519 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 568: -#line 3136 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7527 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 569: -#line 3140 "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 570: -#line 3144 "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 571: -#line 3148 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7551 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 572: -#line 3152 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7559 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 573: -#line 3156 "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 7567 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 574: -#line 3160 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('[', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7575 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 575: -#line 3164 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 7583 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 576: -#line 3168 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); -} -#line 7591 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 577: -#line 3172 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7599 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 578: -#line 3176 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 7607 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 579: -#line 3180 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 7615 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 580: -#line 3187 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); -} -#line 7623 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 581: -#line 3191 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(true); -} -#line 7631 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7879 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; case 582: -#line 3195 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(false); -} -#line 7639 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 583: -#line 3199 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); -} -#line 7647 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 584: -#line 3203 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.real)); -} -#line 7655 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 585: -#line 3207 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 7663 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 586: -#line 3211 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 7671 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 587: -#line 3215 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.identifier), current_scope, global_scope, current_lexer); -} -#line 7679 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 588: -#line 3219 "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 7689 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 589: -#line 3225 "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 7699 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 590: -#line 3231 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); -} -#line 7707 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 591: -#line 3235 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = NULL; -} -#line 7715 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 592: -#line 3239 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = NULL; -} -#line 7723 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 593: -#line 3253 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 7731 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 594: -#line 3257 "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 7739 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 595: -#line 3261 "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 7747 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 596: -#line 3265 "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 7755 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 597: -#line 3269 "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 7763 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 598: -#line 3273 "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 7771 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 599: -#line 3277 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#line 3244 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ { (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[-1].u.type))); } -#line 7779 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7887 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 600: -#line 3281 "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 7787 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 601: -#line 3285 "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 7795 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7911 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 602: -#line 3289 "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 7803 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7919 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 603: -#line 3293 "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"); @@ -7814,11 +7930,11 @@ yyreduce: } (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.type), std_type_info)); } -#line 7818 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7934 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 604: -#line 3304 "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"); @@ -7829,343 +7945,953 @@ yyreduce: } (yyval.u.expr) = new CPPExpression(CPPExpression::typeid_op((yyvsp[-1].u.expr), std_type_info)); } -#line 7833 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7949 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 605: -#line 3315 "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 7841 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7957 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 606: -#line 3319 "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 7849 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7965 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 607: -#line 3323 "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 7857 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7973 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 608: -#line 3327 "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 7865 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7981 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 609: -#line 3331 "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 7873 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 7997 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 610: -#line 3335 "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 7881 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8005 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 611: -#line 3339 "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 7889 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8013 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 612: -#line 3343 "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 7897 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8021 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 613: -#line 3347 "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 7905 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8029 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 614: -#line 3351 "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 7913 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8037 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 615: -#line 3355 "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 7921 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8045 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 616: -#line 3359 "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 7929 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8053 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 617: -#line 3363 "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 7937 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8061 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 618: -#line 3367 "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 7945 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8069 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 619: -#line 3371 "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 7953 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8077 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 620: -#line 3375 "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 7961 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8085 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 621: -#line 3379 "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 7969 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8093 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 622: -#line 3383 "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 7977 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8101 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 623: -#line 3387 "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 7985 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8109 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 624: -#line 3391 "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 7993 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8117 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 625: -#line 3395 "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 8001 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8125 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 626: -#line 3399 "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 8009 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8133 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 627: -#line 3403 "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 8017 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8141 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 628: -#line 3407 "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 8025 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8149 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 629: -#line 3411 "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 8033 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 630: -#line 3415 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); -} -#line 8041 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 631: -#line 3419 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); -} -#line 8049 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 632: -#line 3423 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression('.', (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 8057 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 633: -#line 3427 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[-2].u.expr), (yyvsp[0].u.expr)); -} -#line 8065 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 634: -#line 3431 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[-1].u.expr); -} -#line 8073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 635: -#line 3438 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); -} -#line 8081 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 636: -#line 3442 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(true); -} -#line 8089 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 637: -#line 3446 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression(false); -} -#line 8097 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 638: -#line 3450 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); -} -#line 8105 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 639: -#line 3454 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.real)); -} -#line 8113 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 640: -#line 3458 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 8121 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 641: -#line 3462 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = (yyvsp[0].u.expr); -} -#line 8129 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 642: -#line 3466 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ - { - (yyval.u.expr) = new CPPExpression((yyvsp[0].u.identifier), current_scope, global_scope, current_lexer); -} -#line 8137 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 643: -#line 3470 "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 8147 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ - break; - - case 644: -#line 3476 "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 8157 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 645: -#line 3482 "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(CPPExpression::get_nullptr()); + (yyval.u.expr) = new CPPExpression('f', (yyvsp[-3].u.expr), (yyvsp[-1].u.expr)); } #line 8165 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; + case 616: +#line 3394 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression('f', (yyvsp[-2].u.expr)); +} +#line 8173 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 8181 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + 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 8189 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 619: +#line 3406 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[-1].u.expr); +} +#line 8197 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 620: +#line 3413 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); +} +#line 8205 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 621: +#line 3417 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(true); +} +#line 8213 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 622: +#line 3421 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression(false); +} +#line 8221 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 623: +#line 3425 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.integer)); +} +#line 8229 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 624: +#line 3429 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = new CPPExpression((yyvsp[0].u.real)); +} +#line 8237 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 625: +#line 3433 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (yyval.u.expr) = (yyvsp[0].u.expr); +} +#line 8245 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ + break; + + case 626: +#line 3437 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ + { + (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 3503 "dtool/src/cppparser/cppBison.yxx" /* yacc.c:1646 */ +#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 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) { @@ -8173,11 +8899,11 @@ yyreduce: } (yyval.u.type) = type; } -#line 8177 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8903 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 654: -#line 3511 "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) { @@ -8185,143 +8911,169 @@ yyreduce: } (yyval.u.type) = type; } -#line 8189 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8915 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 655: -#line 3519 "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 8197 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8923 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 656: -#line 3547 "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 8205 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8941 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 657: -#line 3551 "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 8213 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8949 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 658: -#line 3555 "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 8221 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8965 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 659: -#line 3559 "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 8229 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8973 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 660: -#line 3563 "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 8239 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8983 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 661: -#line 3569 "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 8247 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8991 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 662: -#line 3573 "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 8255 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 8999 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 663: -#line 3577 "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 8263 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9007 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 664: -#line 3581 "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 8271 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9015 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 665: -#line 3592 "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 8279 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9023 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 666: -#line 3596 "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 8287 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9031 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 667: -#line 3600 "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 8295 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9047 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 668: -#line 3608 "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 8303 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9055 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 669: -#line 3612 "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 8311 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9063 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 670: -#line 3616 "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 8321 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9073 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; - case 671: -#line 3622 "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); @@ -8330,11 +9082,11 @@ yyreduce: } (yyval.u.expr)->_str += (yyvsp[0].u.expr)->_str; } -#line 8334 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ +#line 9086 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; -#line 8338 "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 d2d9da8458..f5200316d0 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 '}' { @@ -1187,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 '(' ')' { @@ -1215,6 +1249,10 @@ function_post: | function_post KW_THROW '(' name ')' { $$ = $1; +} + | function_post KW_THROW '(' name ELLIPSIS ')' +{ + $$ = $1; } /* | function_post '[' '[' attribute_specifiers ']' ']' { @@ -1418,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 { @@ -1447,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; } ; @@ -1467,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); } ; @@ -1785,6 +1855,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 { @@ -1913,10 +2000,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 { @@ -1959,6 +2115,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 { @@ -2093,6 +2259,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 { @@ -2100,6 +2276,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 { @@ -2187,6 +2374,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 { @@ -2251,6 +2448,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 { @@ -2279,6 +2486,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); } ; @@ -2693,6 +2909,7 @@ element: | CHAR_TOK | IDENTIFIER | TYPENAME_IDENTIFIER + | TYPEPACK_IDENTIFIER | SCOPING | SIMPLE_IDENTIFIER | ELLIPSIS | OROR | ANDAND @@ -2711,10 +2928,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 { } | '+' | '-' | '*' | '/' | '&' | '|' | '^' | '!' | '~' | '=' | '%' @@ -2783,6 +3001,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 { @@ -3021,6 +3243,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 { @@ -3238,6 +3464,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)); } ; @@ -3276,6 +3570,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 { @@ -3518,6 +3816,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); } ; @@ -3550,6 +3854,10 @@ name: | TYPENAME_IDENTIFIER { $$ = $1; +} + | TYPEPACK_IDENTIFIER +{ + $$ = $1; } | KW_FINAL { @@ -3595,6 +3903,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..602f367722 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,15 @@ 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); + if (_ident != NULL) { + out << "class "; + _ident->output(out, scope); + } else { + out << "class"; + } + if (_packed) { + out << "..."; + } if (_default_type) { out << " = "; _default_type->output(out, indent_level, scope, false); @@ -82,6 +90,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 +115,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/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 74473df660..675ba83507 100644 --- a/dtool/src/cppparser/cppInstance.h +++ b/dtool/src/cppparser/cppInstance.h @@ -68,6 +68,9 @@ public: // 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/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 a6ad3d1cad..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; @@ -2451,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; @@ -2490,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; @@ -2751,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); @@ -2760,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..a340a5a709 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -27,7 +27,6 @@ #include "cppPreprocessor.h" #include "cppTemplateScope.h" #include "cppClassTemplateParameter.h" -#include "cppConstType.h" #include "cppFunctionType.h" #include "cppUsing.h" #include "cppBisonDefs.h" 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..f33112d686 100644 --- a/dtool/src/cppparser/cppStructType.cxx +++ b/dtool/src/cppparser/cppStructType.cxx @@ -126,16 +126,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 +304,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 +331,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 +358,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 +430,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 +601,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 +755,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 +818,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 +849,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 +878,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 +907,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/cppType.cxx b/dtool/src/cppparser/cppType.cxx index e6430e6b45..780ebfc0ef 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -12,7 +12,11 @@ */ #include "cppType.h" -#include "cppTypedefType.h" +#include "cppConstType.h" +#include "cppPointerType.h" +#include "cppReferenceType.h" +#include "cppStructType.h" +#include "cppExtensionType.h" #include CPPType::Types CPPType::_types; @@ -57,6 +61,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 +85,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 +109,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 +128,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 +395,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/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 11ac166440..83f36c533b 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -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/interrogatedb/extension.h b/dtool/src/interrogatedb/extension.h index dd995081c1..8e844e3ebc 100644 --- a/dtool/src/interrogatedb/extension.h +++ b/dtool/src/interrogatedb/extension.h @@ -47,6 +47,14 @@ invoke_extension(T *ptr) { return ext; } +template +inline Extension +invoke_extension(T &ptr) { + Extension ext; + ext._this = &ptr; + return ext; +} + /** * The const version of the above function. */ @@ -58,4 +66,12 @@ invoke_extension(const T *ptr) { return ext; } +template +inline const Extension +invoke_extension(const T &ptr) { + Extension ext; + ext._this = (T *) &ptr; + return ext; +} + #endif 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/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; From c2abb4b2f86501108a905e37d70a5997dbccdfd0 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 3 Nov 2016 19:27:04 +0700 Subject: [PATCH 17/93] Revert code that is triggering an odd compiler quirk in MSVC --- dtool/src/interrogatedb/extension.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/dtool/src/interrogatedb/extension.h b/dtool/src/interrogatedb/extension.h index 8e844e3ebc..dd995081c1 100644 --- a/dtool/src/interrogatedb/extension.h +++ b/dtool/src/interrogatedb/extension.h @@ -47,14 +47,6 @@ invoke_extension(T *ptr) { return ext; } -template -inline Extension -invoke_extension(T &ptr) { - Extension ext; - ext._this = &ptr; - return ext; -} - /** * The const version of the above function. */ @@ -66,12 +58,4 @@ invoke_extension(const T *ptr) { return ext; } -template -inline const Extension -invoke_extension(const T &ptr) { - Extension ext; - ext._this = (T *) &ptr; - return ext; -} - #endif From c0fd29d822571b9a1a865f4446f895a3f4b721db Mon Sep 17 00:00:00 2001 From: tobspr Date: Thu, 3 Nov 2016 14:08:25 +0100 Subject: [PATCH 18/93] Add functional header to parser-inc (#126) * Support for the functional header * Add unordered_map and initializer_list * Add unordered_set header * Fix spacing, and remove unecessary defines * Add missing definitions to memory header * Use variadic templates in functional header --- dtool/src/parser-inc/functional | 153 +++++++++++++++++++++ dtool/src/parser-inc/initializer_list | 34 +++++ dtool/src/parser-inc/memory | 184 +++++++++++++++++++++++--- dtool/src/parser-inc/unordered_map | 84 ++++++++++++ dtool/src/parser-inc/unordered_set | 83 ++++++++++++ 5 files changed, 516 insertions(+), 22 deletions(-) create mode 100644 dtool/src/parser-inc/functional create mode 100644 dtool/src/parser-inc/initializer_list create mode 100644 dtool/src/parser-inc/unordered_map create mode 100644 dtool/src/parser-inc/unordered_set 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/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 From d54d43ac3401a64ab4a1137bd17477f5bb0d6fa0 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 3 Nov 2016 18:04:14 +0100 Subject: [PATCH 19/93] cppparser: fix issue with templated external method definitions --- dtool/src/cppparser/cppBison.cxx.prebuilt | 11 ++++++++++- dtool/src/cppparser/cppBison.yxx | 11 ++++++++++- dtool/src/cppparser/cppClassTemplateParameter.cxx | 11 +++++------ dtool/src/cppparser/cppScope.h | 5 +++-- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/dtool/src/cppparser/cppBison.cxx.prebuilt b/dtool/src/cppparser/cppBison.cxx.prebuilt index dcc103b178..877a9636e1 100644 --- a/dtool/src/cppparser/cppBison.cxx.prebuilt +++ b/dtool/src/cppparser/cppBison.cxx.prebuilt @@ -5426,7 +5426,16 @@ yyreduce: 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 5432 "built/tmp/cppBison.yxx.c" /* yacc.c:1646 */ break; diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index f5200316d0..04cdb53a4b 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -1617,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 { diff --git a/dtool/src/cppparser/cppClassTemplateParameter.cxx b/dtool/src/cppparser/cppClassTemplateParameter.cxx index 602f367722..7ed9a94faf 100644 --- a/dtool/src/cppparser/cppClassTemplateParameter.cxx +++ b/dtool/src/cppparser/cppClassTemplateParameter.cxx @@ -42,15 +42,14 @@ is_fully_specified() const { void CPPClassTemplateParameter:: output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { if (complete) { - if (_ident != NULL) { - out << "class "; - _ident->output(out, scope); - } else { - out << "class"; - } + 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); 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: From b0a84087556b24b9fa76306a80ed7fb59f2dac11 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 4 Nov 2016 00:49:04 +0700 Subject: [PATCH 20/93] Fix issue with Windows build --- dtool/src/parser-inc/stdtypedefs.h | 2 ++ 1 file changed, 2 insertions(+) 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 From e9a43a21fa63f535fe48c6a92078ad752fc3b34f Mon Sep 17 00:00:00 2001 From: Tohka Date: Tue, 1 Nov 2016 17:25:47 +0200 Subject: [PATCH 21/93] Remove PiratesMagicWordManager VR Studio code reference --- direct/src/distributed/DistributedObjectGlobalUD.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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: From 8c1f64e086e3dd12be80a97b2e35ce3cffbff6d2 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 14 Nov 2016 19:40:46 +0100 Subject: [PATCH 22/93] Fix for 1.9: fix errors when Cg-style matrix inputs are mat3 --- doc/ReleaseNotes | 1 + panda/src/glstuff/glShaderContext_src.cxx | 12 ++++++++++-- panda/src/glstuff/glShaderContext_src.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 157a20b2bf..b7462a97d6 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -47,6 +47,7 @@ This issue fixes several bugs that were still found in 1.9.2. * 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/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index df8ea97655..5ce322bfac 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -51,7 +51,7 @@ TypeHandle CLP(ShaderContext)::_type_handle; // actually picked up and the appropriate ShaderMatSpec pushed onto _mat_spec. //////////////////////////////////////////////////////////////////// bool CLP(ShaderContext):: -parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *objShader) { +parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_type, Shader *objShader) { Shader::ShaderArgInfo p; p._id = arg_id; p._cat = GLCAT; @@ -167,6 +167,14 @@ parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *objSha else if (pieces[0] == "col2") bind._piece = Shader::SMP_col2; else if (pieces[0] == "col3") bind._piece = Shader::SMP_col3; + if (param_type == GL_FLOAT_MAT3) { + if (bind._piece == Shader::SMP_whole) { + bind._piece = Shader::SMP_upper3x3; + } else if (bind._piece == Shader::SMP_transpose) { + bind._piece = Shader::SMP_transpose3x3; + } + } + if (!objShader->cp_parse_coord_sys(p, pieces, next, bind, true)) { return false; } @@ -614,7 +622,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext } //Tries to parse shorthand notations like mspos_XXX and trans_model_to_clip_of_XXX - if (parse_and_set_short_hand_shader_vars(arg_id, s)) { + if (parse_and_set_short_hand_shader_vars(arg_id, param_type, s)) { continue; } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 62d54ed675..51376e44f4 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -87,7 +87,7 @@ private: void glsl_report_program_errors(GLuint program, bool fatal); bool glsl_compile_shader(Shader::ShaderType type); bool glsl_compile_and_link(); - bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *s); + bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_type, Shader *s); void release_resources(); public: From b02e3521bcf1ab064dbfb1fa05d265ee1681db44 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 27 Nov 2016 12:30:37 +0100 Subject: [PATCH 23/93] Fix wrong GL texture being bound to image slot after being recreated --- panda/src/glstuff/glShaderContext_src.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 3e1fe026f9..e133664912 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -2446,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; From cf389276da45f564c9fcd6b0d8886096fa39d759 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 27 Nov 2016 13:04:54 +0100 Subject: [PATCH 24/93] Backport b02e352 to 1.9: rdb: Fix wrong GL texture being bound to image slot after being recreated --- panda/src/glstuff/glShaderContext_src.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 5ce322bfac..6c68aeb4a6 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1684,8 +1684,8 @@ update_shader_texture_bindings(ShaderContext *prev) { if (gtc != (TextureContext*)NULL) { _glsl_img_textures[i] = 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; From 78bf339c4160f3b9e6630afa767ebc6b3f58d57a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 27 Nov 2016 14:24:37 +0100 Subject: [PATCH 25/93] Fix material shader inputs not being updated properly --- panda/src/glstuff/glShaderContext_src.cxx | 2 +- panda/src/gobj/shader.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index e133664912..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; diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index d9cf151e83..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; From 7db45cb647a160dc0acd14f291124d6bd1f71dea Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 27 Nov 2016 14:25:00 +0100 Subject: [PATCH 26/93] Make fetching of p3d_LightSource[n] input clearly defined for non-existent lights Refer to OpenGL 2.1 spec page 61 Closes: #129 --- panda/src/display/graphicsStateGuardian.cxx | 125 ++++++++++++++------ 1 file changed, 92 insertions(+), 33 deletions(-) diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index ad532c5643..67fbdb2f6c 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -1363,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()); @@ -1395,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); @@ -1404,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); @@ -1417,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 { @@ -1430,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()); @@ -1451,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()); @@ -1466,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()); @@ -1484,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()); @@ -1502,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()); @@ -1523,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()); @@ -1539,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()); @@ -1553,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() * From 1e2961f7efb7264acdfa9ef2c887f0aa292d72da Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 21:53:37 +0100 Subject: [PATCH 27/93] Improve windows installer: .prc file assoc, use DOS newlines for prc, error if installing 64-bit version on 32-bit Windows --- makepanda/installer.nsi | 12 ++++++++++++ makepanda/makepanda.py | 19 +++++++++++++++---- makepanda/makepandacore.py | 19 +++++++++++++++---- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index a1f364910d..04d9e521d0 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" @@ -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 @@ -634,6 +643,9 @@ Section -post 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" "" diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 18c73e5f26..27a5192f2b 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2781,8 +2781,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) ########################################################################################## # @@ -2902,8 +2907,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") diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 29ecf9f06d..123c2bb555 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -966,7 +966,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 +989,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 = "." From 948ff8562d54f74c6ae8d29e6e0c89c1f91ad472 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 22:41:46 +0100 Subject: [PATCH 28/93] Support targeting Windows XP with MSVC 2015 --- makepanda/installer.nsi | 16 ++++++-- makepanda/makepanda.py | 82 +++++++++++++++++++++++++++++++------- makepanda/makepandacore.py | 23 +++++++++++ 3 files changed, 104 insertions(+), 17 deletions(-) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index 04d9e521d0..d14cb44da9 100755 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -143,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 diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 27a5192f2b..af852dc161 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1060,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" @@ -2884,22 +2888,72 @@ 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.isdir(dir): + CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "vcruntime" + vcver + ".dll")) + CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "msvcp" + vcver + ".dll")) ######################################################################## ## diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 123c2bb555..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): @@ -2068,6 +2069,10 @@ def SdkLocateWindows(version = '7.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 = () @@ -2100,6 +2105,10 @@ def SdkLocateWindows(version = '7.1'): # 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' @@ -2109,6 +2118,10 @@ def SdkLocateWindows(version = '7.1'): 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") @@ -2414,9 +2427,19 @@ def SetupVisualStudioEnviron(): # with Visual Studio 2015 requires use of the Universal CRT. 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. From 5ad900a413b27548640fdece2f56f33f3b9539bc Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 22:43:28 +0100 Subject: [PATCH 29/93] Bullet fixes: copying compound shapes, compile warnings, motion state alignment --- panda/src/bullet/bulletBodyNode.cxx | 11 ++++++++++- panda/src/bullet/bulletGhostNode.cxx | 2 +- panda/src/bullet/bulletRigidBodyNode.I | 1 - panda/src/bullet/bulletRigidBodyNode.cxx | 20 ++++++++------------ panda/src/bullet/bulletRigidBodyNode.h | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index 6580c79722..cb4d39c444 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -45,7 +45,16 @@ BulletBodyNode(const BulletBodyNode ©) : _shapes(copy._shapes) { if (copy._shape && copy._shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) { - _shape = new btCompoundShape(copy._shape); + // 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(); 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/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 23c6d17afd..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) { @@ -52,13 +48,13 @@ BulletRigidBodyNode(const char *name) : BulletBodyNode(name) { */ BulletRigidBodyNode:: BulletRigidBodyNode(const BulletRigidBodyNode ©) : - BulletBodyNode(copy) + BulletBodyNode(copy), + _motion(copy._motion) { - _motion = new MotionState(*copy._motion); _rigid = new btRigidBody(*copy._rigid); _rigid->setUserPointer(this); _rigid->setCollisionShape(_shape); - _rigid->setMotionState(_motion); + _rigid->setMotionState(&_motion); } /** @@ -280,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(); @@ -290,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()) { @@ -334,7 +330,7 @@ sync_p2b() { void BulletRigidBodyNode:: sync_b2p() { - _motion->sync_b2p((PandaNode *)this); + _motion.sync_b2p((PandaNode *)this); } /** @@ -589,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 42b2495aff..ea59c9202c 100644 --- a/panda/src/bullet/bulletRigidBodyNode.h +++ b/panda/src/bullet/bulletRigidBodyNode.h @@ -124,7 +124,7 @@ private: bool _was_dirty; }; - MotionState *_motion; + MotionState _motion; btRigidBody *_rigid; public: From 80af51477a8c03df06f1f16a848866613045f7e3 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 22:59:51 +0100 Subject: [PATCH 30/93] Backport ability to create a pdb zipfile to 1.9 --- makepanda/makepanda.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 17778946f2..4adcb96d5e 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -6459,6 +6459,26 @@ def MakeInstallerNSIS(file, title, installdir): 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 @@ -7012,11 +7032,13 @@ try: MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64") else: MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION+"-x64") + MakeDebugSymbolArchive("Panda3D-"+VERSION+dbg+"-x64-pdb.zip", "Panda3D-"+VERSION+"-x64") else: if (RUNTIME): MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+".exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION) else: MakeInstallerNSIS("Panda3D-"+VERSION+dbg+".exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION) + MakeDebugSymbolArchive("Panda3D-"+VERSION+dbg+"-pdb.zip", "Panda3D-"+VERSION) elif (target == 'linux'): MakeInstallerLinux() elif (target == 'darwin'): From 441b791e574a432ae912fdd959ee17cdb041f22b Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 23:05:01 +0100 Subject: [PATCH 31/93] Fix extract_texture_data for buffer textures --- .../glstuff/glGraphicsStateGuardian_src.cxx | 57 +++++++++++++------ .../src/glstuff/glGraphicsStateGuardian_src.h | 1 + panda/src/gobj/texture.cxx | 3 + 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 296b38df76..dc2c0c45e6 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1356,6 +1356,8 @@ reset() { get_extension_func("glMapBuffer"); _glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) get_extension_func("glUnmapBuffer"); + _glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) + get_extension_func("glGetBufferSubData"); #endif } #ifndef OPENGLES_1 @@ -1376,6 +1378,8 @@ reset() { get_extension_func("glMapBufferARB"); _glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) get_extension_func("glUnmapBufferARB"); + _glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) + get_extension_func("glGetBufferSubDataARB"); } #endif // OPENGLES_1 @@ -12644,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) { @@ -13122,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; @@ -13216,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/gobj/texture.cxx b/panda/src/gobj/texture.cxx index a3ce86c7dd..b5d7fc3ac5 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -7411,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); From 1c957b26b48cb36cb4244902fd866f244f3119ba Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 23:07:09 +0100 Subject: [PATCH 32/93] Fix for getting R8 and R8G8 formats via FrameBufferProperties --- panda/src/display/frameBufferProperties.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 }, From 335debee54c1f02bea505bd199e95497099c999c Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 23:53:57 +0100 Subject: [PATCH 33/93] Fix error building debian package --- makepanda/makepanda.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index af852dc161..b6d2cc1b8b 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -6844,9 +6844,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") @@ -6874,7 +6874,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: @@ -6882,12 +6882,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() From 6259feb9344689686b036c989adaad31777bd6d2 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 30 Nov 2016 00:05:36 +0100 Subject: [PATCH 34/93] Fix issue building against copy of Python that was compiled with MSVC 2010 --- makepanda/makepanda.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index b6d2cc1b8b..bade6c8288 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2951,9 +2951,12 @@ if GetTarget() == 'windows' and "VISUALSTUDIO" in SDK: crtname = "Microsoft.VC%s.CRT" % (vcver) dir = os.path.join(SDK["VISUALSTUDIO"], "VC", "redist", GetTargetArch(), crtname) - if os.path.isdir(dir): - CopyFile(GetOutputDir() + "/bin/", os.path.join(dir, "vcruntime" + vcver + ".dll")) + 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")) ######################################################################## ## From 573dad8dde37f9f37d008c720a35784a4f2a1e58 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Wed, 30 Nov 2016 19:07:47 -0800 Subject: [PATCH 35/93] general: Fix missing includes. --- dtool/src/cppparser/cppScope.cxx | 1 + dtool/src/cppparser/cppStructType.cxx | 1 + dtool/src/cppparser/cppType.cxx | 1 + panda/src/egg2pg/save_egg_file.cxx | 1 + 4 files changed, 4 insertions(+) diff --git a/dtool/src/cppparser/cppScope.cxx b/dtool/src/cppparser/cppScope.cxx index a340a5a709..a873cfa3cf 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -28,6 +28,7 @@ #include "cppTemplateScope.h" #include "cppClassTemplateParameter.h" #include "cppFunctionType.h" +#include "cppConstType.h" #include "cppUsing.h" #include "cppBisonDefs.h" #include "indent.h" diff --git a/dtool/src/cppparser/cppStructType.cxx b/dtool/src/cppparser/cppStructType.cxx index f33112d686..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" diff --git a/dtool/src/cppparser/cppType.cxx b/dtool/src/cppparser/cppType.cxx index 780ebfc0ef..801c571add 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -16,6 +16,7 @@ #include "cppPointerType.h" #include "cppReferenceType.h" #include "cppStructType.h" +#include "cppTypedefType.h" #include "cppExtensionType.h" #include diff --git a/panda/src/egg2pg/save_egg_file.cxx b/panda/src/egg2pg/save_egg_file.cxx index 95afdf5be2..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" From 4a8f1839eafeaf107ea3b3f59c35137116e69712 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 1 Dec 2016 17:36:38 +0100 Subject: [PATCH 36/93] 1.9: change to support .whl distribution (putting panda DLLs in panda3d/ dir) --- .../extensions_native/extension_native_helpers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/direct/src/extensions_native/extension_native_helpers.py b/direct/src/extensions_native/extension_native_helpers.py index 20afc7ddef..e17457b872 100644 --- a/direct/src/extensions_native/extension_native_helpers.py +++ b/direct/src/extensions_native/extension_native_helpers.py @@ -50,9 +50,18 @@ if sys.platform == "win32": filename = "libpandaexpress%s%s" % (dll_suffix, dll_ext) for dir in sys.path + [sys.prefix]: lib = os.path.join(dir, filename) - if (os.path.exists(lib)): + if os.path.exists(lib): target = dir - if target == None: + + # Perhaps it is in the same directory as panda3d/core.pyd ? + if target is None: + for dir in sys.path: + lib = os.path.join(dir, 'panda3d', filename) + if os.path.exists(lib): + target = os.path.join(dir, 'panda3d') + break + + if target is None: message = "Cannot find %s" % (filename) raise ImportError(message) From 2b6e192e5aeb9c1b5078815c15735698f4ed1b6b Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 3 Dec 2016 01:04:35 +0100 Subject: [PATCH 37/93] Protect against overallocation when reading corrupt texture from bam --- panda/src/gobj/texture.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index fa16fa7ab8..bcabaa7a8c 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -8271,6 +8271,14 @@ do_fillin_body(CData *cdata, DatagramIterator &scan, BamReader *manager) { cdata->_simple_image_date_generated = scan.get_int32(); size_t u_size = scan.get_uint32(); + + // Protect against large allocation. + if (u_size > scan.get_remaining_size()) { + gobj_cat.error() + << "simple RAM image extends past end of datagram, is texture corrupt?\n"; + return; + } + PTA_uchar image = PTA_uchar::empty_array(u_size, get_class_type()); scan.extract_bytes(image.p(), u_size); @@ -8327,6 +8335,14 @@ do_fillin_rawdata(CData *cdata, DatagramIterator &scan, BamReader *manager) { // fill the cdata->_image buffer with image data size_t u_size = scan.get_uint32(); + + // Protect against large allocation. + if (u_size > scan.get_remaining_size()) { + gobj_cat.error() + << "RAM image " << n << " extends past end of datagram, is texture corrupt?\n"; + return; + } + PTA_uchar image = PTA_uchar::empty_array(u_size, get_class_type()); scan.extract_bytes(image.p(), u_size); From 84789ecdd18a3aadd3d6a8cb0ed17bd1acaea531 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 4 Dec 2016 21:28:52 +0100 Subject: [PATCH 38/93] Fix GL compile error on Mac OS X --- panda/src/glstuff/glGraphicsStateGuardian_src.h | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 8080670fc5..fe8cff8b59 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -247,6 +247,7 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VPROC) (GLuint index, const GLuin typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VPROC) (GLuint index, GLenum pname, GLuint64EXT *params); typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); #endif // OPENGLES #endif // __EDG__ From a056543d5a3863d930535b0f9ad27600f73c5cd6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 5 Dec 2016 02:02:25 +0100 Subject: [PATCH 39/93] Support push_macro and pop_macro in cppparser --- dtool/src/cppparser/cppPreprocessor.cxx | 33 ++++++++++++++++++++++++- dtool/src/cppparser/cppPreprocessor.h | 3 +++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 5df779fc1d..83050d3c41 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -1461,7 +1461,6 @@ handle_define_directive(const string &args, const YYLTYPE &loc) { CPPManifest *other = result.first->second; warning("redefinition of macro '" + manifest->_name + "'", loc); warning("previous definition is here", other->_loc); - delete other; result.first->second = manifest; } } @@ -1679,6 +1678,38 @@ handle_pragma_directive(const string &args, const YYLTYPE &loc) { assert(it != _parsed_files.end()); it->_pragma_once = true; } + + char macro[64]; + if (sscanf(args.c_str(), "push_macro ( \"%63[^\"]\" )", macro) == 1) { + // We just mark it as pushed for now, so that the next time someone tries + // to override it, we save the old value. + Manifests::iterator mi = _manifests.find(macro); + if (mi != _manifests.end()) { + _manifest_stack[macro].push_back(mi->second); + } else { + _manifest_stack[macro].push_back(NULL); + } + + } else if (sscanf(args.c_str(), "pop_macro ( \"%63[^\"]\" )", macro) == 1) { + ManifestStack &stack = _manifest_stack[macro]; + if (stack.size() > 0) { + CPPManifest *manifest = stack.back(); + stack.pop_back(); + Manifests::iterator mi = _manifests.find(macro); + if (manifest == NULL) { + // It was undefined when it was pushed, so make it undefined again. + if (mi != _manifests.end()) { + _manifests.erase(mi); + } + } else if (mi != _manifests.end()) { + mi->second = manifest; + } else { + _manifests.insert(Manifests::value_type(macro, manifest)); + } + } else { + warning("pop_macro without matching push_macro", loc); + } + } } /** diff --git a/dtool/src/cppparser/cppPreprocessor.h b/dtool/src/cppparser/cppPreprocessor.h index 74ff8edcf1..e375b259dd 100644 --- a/dtool/src/cppparser/cppPreprocessor.h +++ b/dtool/src/cppparser/cppPreprocessor.h @@ -72,6 +72,9 @@ public: typedef map Manifests; Manifests _manifests; + typedef pvector ManifestStack; + map _manifest_stack; + pvector _quote_include_kind; DSearchPath _quote_include_path; DSearchPath _angle_include_path; From 46c8990f40dd0d9e0fddb5a8c1e92acf4b7e0cae Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 5 Dec 2016 12:55:13 -0500 Subject: [PATCH 40/93] Switch to clang by default on Mac; drop burden of supporting GCC 4.2 Also get rid of that annoying message about -pthread in clang. --- makepanda/makepanda.py | 9 ++++----- makepanda/makepandacore.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index bade6c8288..6d0bd9638c 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1686,11 +1686,7 @@ def CompileLink(dll, obj, opts): if 'NOARCH:' + arch.upper() not in opts: cmd += " -arch %s" % arch - if "SYSROOT" in SDK: - cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"]) - - # Android-specific flags. - if GetTarget() == 'android': + elif GetTarget() == 'android': cmd += " -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now" if GetTargetArch() == 'armv7a': cmd += " -march=armv7-a -Wl,--fix-cortex-a8" @@ -1698,6 +1694,9 @@ def CompileLink(dll, obj, opts): else: cmd += " -pthread" + if "SYSROOT" in SDK: + cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"]) + if LDFLAGS != "": cmd += " " + LDFLAGS diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 2b9e9d4a32..b9899f6adb 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -396,10 +396,16 @@ def CrossCompiling(): return GetTarget() != GetHost() def GetCC(): - return os.environ.get('CC', TOOLCHAIN_PREFIX + 'gcc') + if TARGET == 'darwin': + return os.environ.get('CC', TOOLCHAIN_PREFIX + 'clang') + else: + return os.environ.get('CC', TOOLCHAIN_PREFIX + 'gcc') def GetCXX(): - return os.environ.get('CXX', TOOLCHAIN_PREFIX + 'g++') + if TARGET == 'darwin': + return os.environ.get('CXX', TOOLCHAIN_PREFIX + 'clang++') + else: + return os.environ.get('CXX', TOOLCHAIN_PREFIX + 'g++') def GetStrip(): # Hack From 83507e413fa34d0edc4af6c4c1aa0d7b6f60220d Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 5 Dec 2016 16:30:44 -0500 Subject: [PATCH 41/93] Fix Mac OS X Snow Leopard build --- direct/src/showbase/PythonUtil.py | 37 ++++++++++++++++++++++++++++++- makepanda/makepanda.py | 2 +- makepanda/makepandacore.py | 5 +++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index ebf8bce63f..0c850f51a0 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -38,7 +38,6 @@ import os import sys import random import time -import importlib __report_indent = 3 @@ -61,6 +60,42 @@ def Functor(function, *args, **kArgs): return functor """ +try: + import importlib +except ImportError: + # Backward compatibility for Python 2.6. + def _resolve_name(name, package, level): + if not hasattr(package, 'rindex'): + raise ValueError("'package' not set to a string") + dot = len(package) + for x in xrange(level, 1, -1): + try: + dot = package.rindex('.', 0, dot) + except ValueError: + raise ValueError("attempted relative import beyond top-level " + "package") + return "%s.%s" % (package[:dot], name) + + def import_module(name, package=None): + if name.startswith('.'): + if not package: + raise TypeError("relative imports require the 'package' argument") + level = 0 + for character in name: + if character != '.': + break + level += 1 + name = _resolve_name(name[level:], package, level) + __import__(name) + return sys.modules[name] + + imp = import_module('imp') + importlib = imp.new_module("importlib") + importlib._resolve_name = _resolve_name + importlib.import_module = import_module + sys.modules['importlib'] = importlib + + class Functor: def __init__(self, function, *args, **kargs): assert callable(function), "function should be a callable obj" diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 6d0bd9638c..990c32f5e5 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -4599,7 +4599,7 @@ if (GetTarget() == 'darwin' and PkgSkip("COCOA")==0 and PkgSkip("GL")==0 and not if (PkgSkip('PANDAFX')==0): TargetAdd('libpandagl.dll', input='libpandafx.dll') TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'COCOA']) + TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'COCOA', 'CARBON']) # # DIRECTORY: panda/src/osxdisplay/ diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index b9899f6adb..2eb4342b06 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2002,6 +2002,11 @@ def SdkLocatePython(prefer_thirdparty_python=False): SDK["PYTHONVERSION"] = "python" + ver SDK["PYTHONEXEC"] = "/System/Library/Frameworks/Python.framework/Versions/" + ver + "/bin/python" + ver + # Avoid choosing the one in the thirdparty package dir. + PkgSetCustomLocation("PYTHON") + IncDirectory("PYTHON", py_fwx + "/include") + LibDirectory("PYTHON", "%s/usr/lib" % (SDK.get("MACOSX", ""))) + if sys.version[:3] != ver: print("Warning: building with Python %s instead of %s since you targeted a specific Mac OS X version." % (ver, sys.version[:3])) From c410d812ffed47dea8379db2340a8af7eaac9d6c Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 5 Dec 2016 16:31:44 -0500 Subject: [PATCH 42/93] Remove some settings from dtool_config.h to prevent rebuilds: - HAVE_OPENCV - OPENCV_VER_23 - HAVE_FFMPEG - HAVE_SWSCALE - HAVE_SWRESAMPLE --- makepanda/makepanda.py | 30 ++++++++++++++++++-------- panda/src/ffmpeg/ffmpegAudioCursor.cxx | 2 -- panda/src/ffmpeg/ffmpegAudioCursor.h | 5 ----- panda/src/vision/openCVTexture.cxx | 16 ++++++++++++++ panda/src/vision/openCVTexture.h | 16 +------------- 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 990c32f5e5..2c26091ef4 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2236,11 +2236,7 @@ DTOOL_CONFIG=[ ("HAVE_CG", 'UNDEF', 'UNDEF'), ("HAVE_CGGL", 'UNDEF', 'UNDEF'), ("HAVE_CGDX9", 'UNDEF', 'UNDEF'), - ("HAVE_FFMPEG", 'UNDEF', 'UNDEF'), - ("HAVE_SWSCALE", 'UNDEF', 'UNDEF'), - ("HAVE_SWRESAMPLE", 'UNDEF', 'UNDEF'), ("HAVE_ARTOOLKIT", 'UNDEF', 'UNDEF'), - ("HAVE_OPENCV", 'UNDEF', 'UNDEF'), ("HAVE_DIRECTCAM", 'UNDEF', 'UNDEF'), ("HAVE_SQUISH", 'UNDEF', 'UNDEF'), ("HAVE_CARBON", 'UNDEF', 'UNDEF'), @@ -2295,9 +2291,6 @@ def WriteConfigSettings(): else: dtool_config["HAVE_"+x] = 'UNDEF' - if not PkgSkip("OPENCV"): - dtool_config["OPENCV_VER_23"] = '1' if OPENCV_VER_23 else 'UNDEF' - dtool_config["HAVE_NET"] = '1' if (PkgSkip("NVIDIACG")==0): @@ -4128,8 +4121,20 @@ if (not RUNTIME): # if (PkgSkip("VISION") == 0) and (not RUNTIME): + # We want to know whether we have ffmpeg so that we can override the .avi association. + if not PkgSkip("FFMPEG"): + DefSymbol("OPENCV", "HAVE_FFMPEG") + if not PkgSkip("OPENCV"): + DefSymbol("OPENCV", "HAVE_OPENCV") + if OPENCV_VER_23: + DefSymbol("OPENCV", "OPENCV_VER_23") + OPTS=['DIR:panda/src/vision', 'BUILDING:VISION', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS'] - TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx') + TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx', dep=[ + 'dtool_have_ffmpeg.dat', + 'dtool_have_opencv.dat', + 'dtool_have_directcam.dat', + ]) TargetAdd('libp3vision.dll', input='p3vision_composite1.obj') TargetAdd('libp3vision.dll', input=COMMON_PANDA_LIBS) @@ -4318,8 +4323,15 @@ if (PkgSkip("VRPN")==0 and not RUNTIME): # DIRECTORY: panda/src/ffmpeg # if PkgSkip("FFMPEG") == 0 and not RUNTIME: + if not PkgSkip("SWSCALE"): + DefSymbol("FFMPEG", "HAVE_SWSCALE") + if not PkgSkip("SWRESAMPLE"): + DefSymbol("FFMPEG", "HAVE_SWRESAMPLE") + OPTS=['DIR:panda/src/ffmpeg', 'BUILDING:FFMPEG', 'FFMPEG', 'SWSCALE', 'SWRESAMPLE'] - TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx') + TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx', dep=[ + 'dtool_have_swscale.dat', 'dtool_have_swresample.dat']) + TargetAdd('libp3ffmpeg.dll', input='p3ffmpeg_composite1.obj') TargetAdd('libp3ffmpeg.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3ffmpeg.dll', opts=OPTS) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 2f73cff60c..659925cce3 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -50,9 +50,7 @@ FfmpegAudioCursor(FfmpegAudio *src) : _packet_data(0), _format_ctx(0), _audio_ctx(0), -#ifdef HAVE_SWRESAMPLE _resample_ctx(0), -#endif _buffer(0), _buffer_alloc(0), _frame(0) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.h b/panda/src/ffmpeg/ffmpegAudioCursor.h index 21f79dc62d..ff37fa8bc6 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.h +++ b/panda/src/ffmpeg/ffmpegAudioCursor.h @@ -31,10 +31,7 @@ struct AVFormatContext; struct AVCodecContext; struct AVStream; struct AVPacket; - -#ifdef HAVE_SWRESAMPLE struct SwrContext; -#endif /** * A stream that generates a sequence of audio samples. @@ -72,9 +69,7 @@ protected: int _buffer_head; int _buffer_tail; -#ifdef HAVE_SWRESAMPLE SwrContext *_resample_ctx; -#endif public: static TypeHandle get_class_type() { diff --git a/panda/src/vision/openCVTexture.cxx b/panda/src/vision/openCVTexture.cxx index 34c70284b1..7d09636b0c 100644 --- a/panda/src/vision/openCVTexture.cxx +++ b/panda/src/vision/openCVTexture.cxx @@ -21,6 +21,22 @@ #include "bamReader.h" #include "bamCacheRecord.h" +// This symbol is predefined by the Panda3D build system to select whether we +// are using the OpenCV 2.3 or later interface, or if it is not defined, we +// are using the original interface. +#ifdef OPENCV_VER_23 + +#include +// #include +#include + +#else +#include +#include +#include + +#endif // OPENCV_VER_23 + TypeHandle OpenCVTexture::_type_handle; /** diff --git a/panda/src/vision/openCVTexture.h b/panda/src/vision/openCVTexture.h index ad898e51a8..1ad8e11a7a 100644 --- a/panda/src/vision/openCVTexture.h +++ b/panda/src/vision/openCVTexture.h @@ -19,21 +19,7 @@ #include "videoTexture.h" -// This symbol is predefined by the Panda3D build system to select whether we -// are using the OpenCV 2.3 or later interface, or if it is not defined, we -// are using the original interface. -#ifdef OPENCV_VER_23 - -#include -// #include -#include - -#else -#include -#include -#include - -#endif // OPENCV_VER_23 +struct CvCapture; /** * A specialization on VideoTexture that takes its input using the CV library, From 6344c05b18b8f7f32d01e79cab2bd96914a6fd3d Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 5 Dec 2016 17:21:09 -0500 Subject: [PATCH 43/93] Clean up dynamic loading of Win32 funcs, remove makepanda touchinput setting, remove checks for pre-WinXP --- makepanda/makepanda.py | 40 +---- panda/src/dxgsg9/wdxGraphicsPipe9.cxx | 20 ++- panda/src/windisplay/winGraphicsPipe.cxx | 76 ++-------- panda/src/windisplay/winGraphicsPipe.h | 11 -- panda/src/windisplay/winGraphicsWindow.cxx | 162 ++++++++++----------- panda/src/windisplay/winGraphicsWindow.h | 23 ++- 6 files changed, 132 insertions(+), 200 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 2c26091ef4..956e8db52c 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -94,7 +94,6 @@ PkgListSet(["PYTHON", "DIRECT", # Python support "PANDAPARTICLESYSTEM", # Built in particle system "CONTRIB", # Experimental "SSE2", "NEON", # Compiler features - "TOUCHINPUT", # Touchinput interface (requires Windows 7) ]) CheckPandaSourceTree() @@ -170,7 +169,8 @@ def parseopts(args): "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=", "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl", - "universal", "target=", "arch=", "git-commit="] + "universal", "target=", "arch=", "git-commit=", + "use-touchinput", "no-touchinput"] anything = 0 optimize = "" target = None @@ -316,18 +316,6 @@ def parseopts(args): print("No Windows SDK version specified. Defaulting to '7.1'.") WINDOWS_SDK = '7.1' - is_win7 = False - if sys.platform == 'win32': - # Note: not available in cygwin. - winver = sys.getwindowsversion() - if winver[0] >= 6 and winver[1] >= 1: - is_win7 = True - - if RUNTIME or not is_win7: - PkgDisable("TOUCHINPUT") - else: - PkgDisable("TOUCHINPUT") - if clean_build and os.path.isdir(GetOutputDir()): print("Deleting %s" % (GetOutputDir())) shutil.rmtree(GetOutputDir()) @@ -1055,14 +1043,11 @@ def CompileCxx(obj,src,opts): cmd += "/favor:blend " cmd += "/wd4996 /wd4275 /wd4273 " - # Enable Windows 7 interfaces if we need Touchinput. - if PkgSkip("TOUCHINPUT") == 0: - 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- " + # We still target Windows XP. + 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): @@ -1113,12 +1098,7 @@ def CompileCxx(obj,src,opts): if GetTargetArch() == 'x64': cmd += "/favor:blend " cmd += "/wd4996 /wd4275 /wd4267 /wd4101 /wd4273 " - - # Enable Windows 7 interfaces if we need Touchinput. - if PkgSkip("TOUCHINPUT") == 0: - cmd += "/DWINVER=0x601 " - else: - cmd += "/DWINVER=0x501 " + cmd += "/DWINVER=0x501 " cmd += "/Fo" + obj + " /c" for x in ipath: cmd += " /I" + x for (opt,dir) in INCDIRECTORIES: @@ -2129,7 +2109,6 @@ DTOOL_CONFIG=[ ("REPORT_OPENSSL_ERRORS", '1', '1'), ("USE_PANDAFILESTREAM", '1', '1'), ("USE_DELETED_CHAIN", '1', '1'), - ("HAVE_WIN_TOUCHINPUT", 'UNDEF', 'UNDEF'), ("HAVE_GLX", 'UNDEF', '1'), ("HAVE_WGL", '1', 'UNDEF'), ("HAVE_DX9", 'UNDEF', 'UNDEF'), @@ -2347,9 +2326,6 @@ def WriteConfigSettings(): if (PkgSkip("PYTHON") != 0): dtool_config["HAVE_ROCKET_PYTHON"] = 'UNDEF' - if (PkgSkip("TOUCHINPUT") == 0 and GetTarget() == "windows"): - dtool_config["HAVE_WIN_TOUCHINPUT"] = '1' - if (GetOptimize() <= 3): dtool_config["HAVE_ROCKET_DEBUGGER"] = '1' diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx index 8174105f39..c3c0ee0099 100644 --- a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx @@ -19,6 +19,16 @@ TypeHandle wdxGraphicsPipe9::_type_handle; +static bool MyGetProcAddr(HINSTANCE hDLL, FARPROC *pFn, const char *szExportedFnName) { + *pFn = (FARPROC) GetProcAddress(hDLL, szExportedFnName); + if (*pFn == NULL) { + wdxdisplay9_cat.error() + << "GetProcAddr failed for " << szExportedFnName << ", error=" << GetLastError() < 1MB, card is lying and I cant tell what it is #define UNKNOWN_VIDMEM_SIZE 0xFFFFFFFF @@ -154,7 +164,10 @@ make_output(const string &name, */ bool wdxGraphicsPipe9:: init() { - if (!MyLoadLib(_hDDrawDLL, "ddraw.dll")) { + _hDDrawDLL = LoadLibrary("ddraw.dll"); + if (_hDDrawDLL == NULL) { + wdxdisplay9_cat.error() + << "LoadLibrary failed for ddraw.dll, error=" << GetLastError() <_physical_memory = memory_status.ullTotalPhys; - display_information->_available_physical_memory = memory_status.ullAvailPhys; - display_information->_page_file_size = memory_status.ullTotalPageFile; - display_information->_available_page_file_size = memory_status.ullAvailPageFile; - display_information->_process_virtual_memory = memory_status.ullTotalVirtual; - display_information->_available_process_virtual_memory = memory_status.ullAvailVirtual; - display_information->_memory_load = memory_status.dwMemoryLoad; - } - } else { - MEMORYSTATUS memory_status; - - memory_status.dwLength = sizeof(MEMORYSTATUS); - GlobalMemoryStatus (&memory_status); - - display_information->_physical_memory = memory_status.dwTotalPhys; - display_information->_available_physical_memory = memory_status.dwAvailPhys; - display_information->_page_file_size = memory_status.dwTotalPageFile; - display_information->_available_page_file_size = memory_status.dwAvailPageFile; - display_information->_process_virtual_memory = memory_status.dwTotalVirtual; - display_information->_available_process_virtual_memory = memory_status.dwAvailVirtual; + memory_status.dwLength = sizeof(MEMORYSTATUSEX); + if (GlobalMemoryStatusEx(&memory_status)) { + display_information->_physical_memory = memory_status.ullTotalPhys; + display_information->_available_physical_memory = memory_status.ullAvailPhys; + display_information->_page_file_size = memory_status.ullTotalPageFile; + display_information->_available_page_file_size = memory_status.ullAvailPageFile; + display_information->_process_virtual_memory = memory_status.ullTotalVirtual; + display_information->_available_process_virtual_memory = memory_status.ullAvailVirtual; display_information->_memory_load = memory_status.dwMemoryLoad; } @@ -687,19 +664,12 @@ WinGraphicsPipe() { _supported_types = OT_window | OT_fullscreen_window; - // these fns arent defined on win95, so get dynamic ptrs to them to avoid - // ugly DLL loader failures on w95 - _pfnTrackMouseEvent = NULL; - - _hUser32 = (HINSTANCE)LoadLibrary("user32.dll"); - if (_hUser32 != NULL) { - _pfnTrackMouseEvent = - (PFN_TRACKMOUSEEVENT)GetProcAddress(_hUser32, "TrackMouseEvent"); - + HMODULE user32 = GetModuleHandleA("user32.dll"); + if (user32 != NULL) { if (dpi_aware) { typedef HRESULT (WINAPI *PFN_SETPROCESSDPIAWARENESS)(Process_DPI_Awareness); PFN_SETPROCESSDPIAWARENESS pfnSetProcessDpiAwareness = - (PFN_SETPROCESSDPIAWARENESS)GetProcAddress(_hUser32, "SetProcessDpiAwarenessInternal"); + (PFN_SETPROCESSDPIAWARENESS)GetProcAddress(user32, "SetProcessDpiAwarenessInternal"); if (pfnSetProcessDpiAwareness == NULL) { if (windisplay_cat.is_debug()) { @@ -908,26 +878,4 @@ lookup_cpu_data() { */ WinGraphicsPipe:: ~WinGraphicsPipe() { - if (_hUser32 != NULL) { - FreeLibrary(_hUser32); - _hUser32 = NULL; - } -} - -bool MyGetProcAddr(HINSTANCE hDLL, FARPROC *pFn, const char *szExportedFnName) { - *pFn = (FARPROC) GetProcAddress(hDLL, szExportedFnName); - if (*pFn == NULL) { - windisplay_cat.error() << "GetProcAddr failed for " << szExportedFnName << ", error=" << GetLastError() < 1)) { + if (_input_devices.size() > 1) { RAWINPUTDEVICE Rid; Rid.usUsagePage = 0x01; Rid.usUsage = 0x02; Rid.dwFlags = 0;// RIDEV_NOLEGACY; // adds HID mouse and also ignores legacy mouse messages Rid.hwndTarget = _hWnd; - pRegisterRawInputDevices(&Rid, 1, sizeof (Rid)); + RegisterRawInputDevices(&Rid, 1, sizeof (Rid)); } // Create a WindowHandle for ourselves @@ -535,10 +537,23 @@ open_window() { // set us as the focus window for keyboard input set_focus(); + // Try initializing the touch function pointers. + static bool initialized = false; + if (!initialized) { + initialized = true; + HMODULE user32 = GetModuleHandleA("user32.dll"); + if (user32) { + // Introduced in Windows 7. + pRegisterTouchWindow = (PFN_REGISTERTOUCHWINDOW)GetProcAddress(user32, "RegisterTouchWindow"); + pGetTouchInputInfo = (PFN_GETTOUCHINPUTINFO)GetProcAddress(user32, "GetTouchInputInfo"); + pCloseTouchInputHandle = (PFN_CLOSETOUCHINPUTHANDLE)GetProcAddress(user32, "CloseTouchInputHandle"); + } + } + // Register for Win7 touch events. -#ifdef HAVE_WIN_TOUCHINPUT - RegisterTouchWindow(_hWnd, 0); -#endif + if (pRegisterTouchWindow != NULL) { + pRegisterTouchWindow(_hWnd, 0); + } return true; } @@ -563,45 +578,35 @@ initialize_input_devices() { GraphicsWindowInputDevice::pointer_and_keyboard(this, "keyboard_mouse"); add_input_device(device); - // Try initializing the Raw Input function pointers. - if (pRegisterRawInputDevices==0) { - HMODULE user32 = LoadLibrary("user32.dll"); - if (user32) { - pRegisterRawInputDevices = (tRegisterRawInputDevices)GetProcAddress(user32,"RegisterRawInputDevices"); - pGetRawInputDeviceList = (tGetRawInputDeviceList) GetProcAddress(user32,"GetRawInputDeviceList"); - pGetRawInputDeviceInfoA = (tGetRawInputDeviceInfoA) GetProcAddress(user32,"GetRawInputDeviceInfoA"); - pGetRawInputData = (tGetRawInputData) GetProcAddress(user32,"GetRawInputData"); - } - } - - if (pRegisterRawInputDevices==0) return; - if (pGetRawInputDeviceList==0) return; - if (pGetRawInputDeviceInfoA==0) return; - if (pGetRawInputData==0) return; - // Get the number of devices. - if (pGetRawInputDeviceList(NULL, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) != 0) + if (GetRawInputDeviceList(NULL, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { return; + } // Allocate the array to hold the DeviceList pRawInputDeviceList = (PRAWINPUTDEVICELIST)alloca(sizeof(RAWINPUTDEVICELIST) * nInputDevices); - if (pRawInputDeviceList==0) return; + if (pRawInputDeviceList==0) { + return; + } // Fill the Array - if (pGetRawInputDeviceList(pRawInputDeviceList, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) == -1) + if (GetRawInputDeviceList(pRawInputDeviceList, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) == -1) { return; + } // Loop through all raw devices and find the raw mice for (int i = 0; i < (int)nInputDevices; i++) { if (pRawInputDeviceList[i].dwType == RIM_TYPEMOUSE) { // Fetch information about specified mouse device. UINT nSize; - if (pGetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)0, &nSize) != 0) + if (GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)0, &nSize) != 0) { return; + } char *psName = (char*)alloca(sizeof(TCHAR) * nSize); if (psName == 0) return; - if (pGetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)psName, &nSize) < 0) + if (GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)psName, &nSize) < 0) { return; + } // If it's not an RDP mouse, add it to the list of raw mice. if (strncmp(psName,"\\??\\Root#RDP_MOU#0000#",22)!=0) { @@ -1215,31 +1220,25 @@ adjust_z_order(WindowProperties::ZOrder last_z_order, */ void WinGraphicsWindow:: track_mouse_leaving(HWND hwnd) { - // Note: could use _TrackMouseEvent in comctrl32.dll (part of IE 3.0+) which - // emulates TrackMouseEvent on w95, but that requires another 500K of memory - // to hold that DLL, which is lame just to support w95, which probably has - // other issues anyway WinGraphicsPipe *winpipe; DCAST_INTO_V(winpipe, _pipe); - if (winpipe->_pfnTrackMouseEvent != NULL) { - TRACKMOUSEEVENT tme = { - sizeof(TRACKMOUSEEVENT), - TME_LEAVE, - hwnd, - 0 - }; + TRACKMOUSEEVENT tme = { + sizeof(TRACKMOUSEEVENT), + TME_LEAVE, + hwnd, + 0 + }; - // tell win32 to post WM_MOUSELEAVE msgs - BOOL bSucceeded = winpipe->_pfnTrackMouseEvent(&tme); + // tell win32 to post WM_MOUSELEAVE msgs + BOOL bSucceeded = TrackMouseEvent(&tme); - if ((!bSucceeded) && windisplay_cat.is_debug()) { - windisplay_cat.debug() - << "TrackMouseEvent failed!, LastError=" << GetLastError() << endl; - } - - _tracking_mouse_leaving = true; + if (!bSucceeded && windisplay_cat.is_debug()) { + windisplay_cat.debug() + << "TrackMouseEvent failed!, LastError=" << GetLastError() << endl; } + + _tracking_mouse_leaving = true; } /** @@ -2067,15 +2066,16 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { } break; -#ifdef HAVE_WIN_TOUCHINPUT case WM_TOUCH: - _numTouches = LOWORD(wparam); - if(_numTouches > MAX_TOUCHES) - _numTouches = MAX_TOUCHES; - GetTouchInputInfo((HTOUCHINPUT)lparam, _numTouches, _touches, sizeof(TOUCHINPUT)); - CloseTouchInputHandle((HTOUCHINPUT)lparam); + _num_touches = LOWORD(wparam); + if (_num_touches > MAX_TOUCHES) { + _num_touches = MAX_TOUCHES; + } + if (pGetTouchInputInfo != 0) { + pGetTouchInputInfo((HTOUCHINPUT)lparam, _num_touches, _touches, sizeof(TOUCHINPUT)); + pCloseTouchInputHandle((HTOUCHINPUT)lparam); + } break; -#endif } // do custom messages processing if any has been set @@ -2607,7 +2607,7 @@ handle_raw_input(HRAWINPUT hraw) { if (hraw == 0) { return; } - if (pGetRawInputData(hraw, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)) == -1) { + if (GetRawInputData(hraw, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)) == -1) { return; } @@ -2616,7 +2616,7 @@ handle_raw_input(HRAWINPUT hraw) { return; } - if (pGetRawInputData(hraw, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize) { + if (GetRawInputData(hraw, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize) { return; } @@ -2973,12 +2973,8 @@ bool WinGraphicsWindow::supports_window_procs() const{ * */ bool WinGraphicsWindow:: -is_touch_event(GraphicsWindowProcCallbackData* callbackData){ -#ifdef HAVE_WIN_TOUCHINPUT +is_touch_event(GraphicsWindowProcCallbackData *callbackData) { return callbackData->get_msg() == WM_TOUCH; -#else - return false; -#endif } /** @@ -2987,11 +2983,7 @@ is_touch_event(GraphicsWindowProcCallbackData* callbackData){ */ int WinGraphicsWindow:: get_num_touches(){ -#ifdef HAVE_WIN_TOUCHINPUT - return _numTouches; -#else - return 0; -#endif + return _num_touches; } /** @@ -2999,8 +2991,9 @@ get_num_touches(){ * */ TouchInfo WinGraphicsWindow:: -get_touch_info(int index){ -#ifdef HAVE_WIN_TOUCHINPUT +get_touch_info(int index) { + nassertr(index >= 0 && index < MAX_TOUCHES, TouchInfo()); + TOUCHINPUT ti = _touches[index]; POINT point; point.x = TOUCH_COORD_TO_PIXEL(ti.x); @@ -3013,7 +3006,4 @@ get_touch_info(int index){ ret.set_id(ti.dwID); ret.set_flags(ti.dwFlags); return ret; -#else - return TouchInfo(); -#endif } diff --git a/panda/src/windisplay/winGraphicsWindow.h b/panda/src/windisplay/winGraphicsWindow.h index 798218052a..ec7e1217ff 100644 --- a/panda/src/windisplay/winGraphicsWindow.h +++ b/panda/src/windisplay/winGraphicsWindow.h @@ -34,8 +34,23 @@ typedef struct { int y; int width; int height; -} -WINDOW_METRICS; +} WINDOW_METRICS; + +#if WINVER < 0x0601 +// Not used on Windows XP, but we still need to define it. +typedef struct tagTOUCHINPUT { + LONG x; + LONG y; + HANDLE hSource; + DWORD dwID; + DWORD dwFlags; + DWORD dwMask; + DWORD dwTime; + ULONG_PTR dwExtraInfo; + DWORD cxContact; + DWORD cyContact; +} TOUCHINPUT, *PTOUCHINPUT; +#endif /** * An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in @@ -177,10 +192,8 @@ private: typedef pset WinProcClasses; WinProcClasses _window_proc_classes; -#ifdef HAVE_WIN_TOUCHINPUT - UINT _numTouches; + UINT _num_touches; TOUCHINPUT _touches[MAX_TOUCHES]; -#endif private: // We need this map to support per-window calls to window_proc(). From b182224463b153420ac4eb1a4ea6c9f86dae7ad5 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 5 Dec 2016 17:22:24 -0500 Subject: [PATCH 44/93] interrogate: fix issues with abstract classes and covariance (fixes EggPolygon constructor) --- dtool/src/cppparser/cppFunctionType.cxx | 9 +++-- dtool/src/cppparser/cppFunctionType.h | 2 +- dtool/src/cppparser/cppStructType.cxx | 54 ++++++++----------------- 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/dtool/src/cppparser/cppFunctionType.cxx b/dtool/src/cppparser/cppFunctionType.cxx index 371b714c2d..1872ea11f5 100644 --- a/dtool/src/cppparser/cppFunctionType.cxx +++ b/dtool/src/cppparser/cppFunctionType.cxx @@ -326,14 +326,17 @@ as_function_type() { * This is similar to is_equal(), except it is more forgiving: it considers * the functions to be equivalent only if the return type and the types of all * parameters match. + * + * Note that this isn't symmetric to account for covariant return types. */ bool CPPFunctionType:: -is_equivalent_function(const CPPFunctionType &other) const { - if (!_return_type->is_equivalent(*other._return_type)) { +match_virtual_override(const CPPFunctionType &other) const { + if (!_return_type->is_equivalent(*other._return_type) && + !_return_type->is_convertible_to(other._return_type)) { return false; } - if (_flags != other._flags) { + if (((_flags ^ other._flags) & ~(F_override | F_final)) != 0) { return false; } diff --git a/dtool/src/cppparser/cppFunctionType.h b/dtool/src/cppparser/cppFunctionType.h index f08de51e45..1e44681f13 100644 --- a/dtool/src/cppparser/cppFunctionType.h +++ b/dtool/src/cppparser/cppFunctionType.h @@ -84,7 +84,7 @@ public: virtual CPPFunctionType *as_function_type(); - bool is_equivalent_function(const CPPFunctionType &other) const; + bool match_virtual_override(const CPPFunctionType &other) const; CPPIdentifier *_class_owner; diff --git a/dtool/src/cppparser/cppStructType.cxx b/dtool/src/cppparser/cppStructType.cxx index 73712c66ad..afb03dd463 100644 --- a/dtool/src/cppparser/cppStructType.cxx +++ b/dtool/src/cppparser/cppStructType.cxx @@ -378,6 +378,10 @@ is_constructible(const CPPType *given_type) const { } } + if (is_abstract()) { + return false; + } + // Check for a different constructor. CPPFunctionGroup *fgroup = get_constructor(); if (fgroup != (CPPFunctionGroup *)NULL) { @@ -444,6 +448,10 @@ is_destructible() const { */ bool CPPStructType:: is_default_constructible(CPPVisibility min_vis) const { + if (is_abstract()) { + return false; + } + CPPInstance *constructor = get_default_constructor(); if (constructor != (CPPInstance *)NULL) { // It has a default constructor. @@ -498,24 +506,6 @@ is_default_constructible(CPPVisibility min_vis) const { } } - // Check that we don't have pure virtual methods. - 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_pure_virtual) { - // Here's a pure virtual function. - return false; - } - } - } - return true; } @@ -524,6 +514,10 @@ is_default_constructible(CPPVisibility min_vis) const { */ bool CPPStructType:: is_copy_constructible(CPPVisibility min_vis) const { + if (is_abstract()) { + return false; + } + CPPInstance *constructor = get_copy_constructor(); if (constructor != (CPPInstance *)NULL) { // It has a copy constructor. @@ -581,24 +575,6 @@ is_copy_constructible(CPPVisibility min_vis) const { } } - // Check that we don't have pure virtual methods. - 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_pure_virtual) { - // Here's a pure virtual function. - return false; - } - } - } - return true; } @@ -620,6 +596,10 @@ is_move_constructible(CPPVisibility min_vis) const { return false; } + if (is_abstract()) { + return false; + } + return true; } @@ -1214,7 +1194,7 @@ get_virtual_funcs(VFunctions &funcs) const { CPPFunctionType *new_ftype = new_inst->_type->as_function_type(); assert(new_ftype != (CPPFunctionType *)NULL); - if (new_ftype->is_equivalent_function(*base_ftype)) { + if (new_ftype->match_virtual_override(*base_ftype)) { // It's a match! We now know it's virtual. Erase this function // from the list, so we can add it back in below. funcs.erase(vfi); From 3fa5b6b4ee569425ab99e16e4e1aa55273abc0f4 Mon Sep 17 00:00:00 2001 From: tobspr Date: Tue, 6 Dec 2016 18:42:08 +0100 Subject: [PATCH 45/93] Add prc variable to force image bindings as writeonly (#131) --- panda/src/glstuff/glShaderContext_src.cxx | 5 ++++- panda/src/glstuff/glmisc_src.cxx | 5 +++++ panda/src/glstuff/glmisc_src.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index b02ec341df..528b98804c 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -2486,7 +2486,10 @@ update_shader_texture_bindings(ShaderContext *prev) { bool has_write = param->has_write_access(); input._writable = has_write; - if (has_read && has_write) { + if (gl_force_image_bindings_writeonly) { + access = GL_WRITE_ONLY; + + } else if (has_read && has_write) { access = GL_READ_WRITE; } else if (has_read) { diff --git a/panda/src/glstuff/glmisc_src.cxx b/panda/src/glstuff/glmisc_src.cxx index c44a36aaf6..544a5c2c79 100644 --- a/panda/src/glstuff/glmisc_src.cxx +++ b/panda/src/glstuff/glmisc_src.cxx @@ -299,6 +299,11 @@ ConfigVariableBool gl_support_shadow_filter "cards suffered from a broken implementation of the " "shadow map filtering features.")); +ConfigVariableBool gl_force_image_bindings_writeonly + ("gl-force-image-bindings-writeonly", false, + PRC_DESC("Forces all image inputs (not textures!) to be bound as writeonly, " + "to read from an image, rebind it as sampler.")); + ConfigVariableEnum gl_coordinate_system ("gl-coordinate-system", CS_yup_right, PRC_DESC("Which coordinate system to use as the internal " diff --git a/panda/src/glstuff/glmisc_src.h b/panda/src/glstuff/glmisc_src.h index b008aeb8d3..fb8040828f 100644 --- a/panda/src/glstuff/glmisc_src.h +++ b/panda/src/glstuff/glmisc_src.h @@ -80,6 +80,7 @@ extern ConfigVariableBool gl_fixed_vertex_attrib_locations; extern ConfigVariableBool gl_support_primitive_restart_index; extern ConfigVariableBool gl_support_sampler_objects; extern ConfigVariableBool gl_support_shadow_filter; +extern ConfigVariableBool gl_force_image_bindings_writeonly; extern ConfigVariableEnum gl_coordinate_system; extern EXPCL_GL void CLP(init_classes)(); From e778c529b2afb94024c2aa01912b15c0d93fe83c Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2016 00:42:44 +0100 Subject: [PATCH 46/93] Implement Python 3.6 fspath protocol; allow passing a pathlib.Path wherever Filename is expected The Python 3.6 fspath protocol allows passing Filename objects into any Python standard library calls that take a path. --- dtool/src/dtoolutil/filename.I | 25 +++--- dtool/src/dtoolutil/filename.h | 13 ++-- panda/src/express/filename_ext.cxx | 119 +++++++++++++++++++++++++++++ panda/src/express/filename_ext.h | 3 + 4 files changed, 145 insertions(+), 15 deletions(-) diff --git a/dtool/src/dtoolutil/filename.I b/dtool/src/dtoolutil/filename.I index 9ab46bf501..9bc23dfca3 100644 --- a/dtool/src/dtoolutil/filename.I +++ b/dtool/src/dtoolutil/filename.I @@ -38,7 +38,6 @@ Filename(const char *filename) { (*this) = filename; } - /** * */ @@ -84,6 +83,20 @@ Filename(Filename &&from) NOEXCEPT : } #endif // USE_MOVE_SEMANTICS +/** + * Creates an empty Filename. + */ +INLINE Filename:: +Filename() : + _dirname_end(0), + _basename_start(0), + _basename_end(string::npos), + _extension_start(string::npos), + _hash_start(string::npos), + _hash_end(string::npos), + _flags(0) { +} + /** * */ @@ -155,14 +168,6 @@ pattern_filename(const string &filename) { return result; } -/** - * - */ -INLINE Filename:: -~Filename() { -} - - /** * */ @@ -233,7 +238,7 @@ operator = (string &&filename) NOEXCEPT { */ INLINE Filename &Filename:: operator = (Filename &&from) NOEXCEPT { - _filename = MOVE(from._filename); + _filename = move(from._filename); _dirname_end = from._dirname_end; _basename_start = from._basename_start; _basename_end = from._basename_end; diff --git a/dtool/src/dtoolutil/filename.h b/dtool/src/dtoolutil/filename.h index 378bf4fe1c..e0c4b8c414 100644 --- a/dtool/src/dtoolutil/filename.h +++ b/dtool/src/dtoolutil/filename.h @@ -55,20 +55,22 @@ public: }; INLINE Filename(const char *filename); - -PUBLISHED: - INLINE Filename(const string &filename = ""); + INLINE Filename(const string &filename); INLINE Filename(const wstring &filename); INLINE Filename(const Filename ©); - Filename(const Filename &dirname, const Filename &basename); - INLINE ~Filename(); #ifdef USE_MOVE_SEMANTICS INLINE Filename(string &&filename) NOEXCEPT; INLINE Filename(Filename &&from) NOEXCEPT; #endif +PUBLISHED: + INLINE Filename(); + Filename(const Filename &dirname, const Filename &basename); + #ifdef HAVE_PYTHON + EXTENSION(Filename(PyObject *path)); + EXTENSION(PyObject *__reduce__(PyObject *self) const); #endif @@ -118,6 +120,7 @@ PUBLISHED: INLINE char operator [] (size_t n) const; EXTENSION(PyObject *__repr__() const); + EXTENSION(PyObject *__fspath__() const); INLINE string substr(size_t begin) const; INLINE string substr(size_t begin, size_t end) const; diff --git a/panda/src/express/filename_ext.cxx b/panda/src/express/filename_ext.cxx index 70afd0d07d..1c9bf78e7e 100644 --- a/panda/src/express/filename_ext.cxx +++ b/panda/src/express/filename_ext.cxx @@ -14,6 +14,115 @@ #include "filename_ext.h" #ifdef HAVE_PYTHON + +#ifndef CPPPARSER +extern Dtool_PyTypedObject Dtool_Filename; +#endif // CPPPARSER + +/** + * Constructs a Filename object from a str, bytes object, or os.PathLike. + */ +void Extension:: +__init__(PyObject *path) { + nassertv(path != NULL); + nassertv(_this != NULL); + + Py_ssize_t length; + + if (PyUnicode_CheckExact(path)) { + wchar_t *data; +#if PY_VERSION_HEX >= 0x03020000 + data = PyUnicode_AsWideCharString(path, &length); +#else + length = PyUnicode_GET_SIZE(path); + data = (wchar_t *)alloca(sizeof(wchar_t) * (length + 1)); + PyUnicode_AsWideChar((PyUnicodeObject *)path, data, length); +#endif + (*_this) = wstring(data, length); + +#if PY_VERSION_HEX >= 0x03020000 + PyMem_Free(data); +#endif + return; + } + + if (PyBytes_CheckExact(path)) { + char *data; + PyBytes_AsStringAndSize(path, &data, &length); + (*_this) = string(data, length); + return; + } + + if (Py_TYPE(path) == &Dtool_Filename._PyType) { + // Copy constructor. + (*_this) = *((Filename *)((Dtool_PyInstDef *)path)->_ptr_to_object); + return; + } + + PyObject *path_str; + +#if PY_VERSION_HEX >= 0x03060000 + // It must be an os.PathLike object. Check for an __fspath__ method. + PyObject *fspath = PyObject_GetAttrString((PyObject *)Py_TYPE(path), "__fspath__"); + if (fspath == NULL) { + PyErr_Format(PyExc_TypeError, "expected str, bytes or os.PathLike object, not %s", Py_TYPE(path)->tp_name); + return; + } + + path_str = PyObject_CallFunctionObjArgs(fspath, path, NULL); + Py_DECREF(fspath); +#else + // There is no standard path protocol before Python 3.6, but let's try and + // support taking pathlib paths anyway. We don't version check this to + // allow people to use backports of the pathlib module. + if (PyObject_HasAttrString(path, "_format_parsed_parts")) { + path_str = PyObject_Str(path); + } else { +#if PY_VERSION_HEX >= 0x03040000 + PyErr_Format(PyExc_TypeError, "expected str, bytes, Path or Filename object, not %s", Py_TYPE(path)->tp_name); +#elif PY_MAJOR_VERSION >= 3 + PyErr_Format(PyExc_TypeError, "expected str, bytes or Filename object, not %s", Py_TYPE(path)->tp_name); +#else + PyErr_Format(PyExc_TypeError, "expected str or unicode object, not %s", Py_TYPE(path)->tp_name); +#endif + return; + } +#endif + + if (path_str == NULL) { + return; + } + + if (PyUnicode_CheckExact(path_str)) { + wchar_t *data; +#if PY_VERSION_HEX >= 0x03020000 + data = PyUnicode_AsWideCharString(path_str, &length); +#else + length = PyUnicode_GET_SIZE(path_str); + data = (wchar_t *)alloca(sizeof(wchar_t) * (length + 1)); + PyUnicode_AsWideChar((PyUnicodeObject *)path_str, data, length); +#endif + (*_this) = Filename::from_os_specific_w(wstring(data, length)); + +#if PY_VERSION_HEX >= 0x03020000 + PyMem_Free(data); +#endif + + } else if (PyBytes_CheckExact(path_str)) { + char *data; + PyBytes_AsStringAndSize(path_str, &data, &length); + (*_this) = Filename::from_os_specific(string(data, length)); + + } else { +#if PY_MAJOR_VERSION >= 3 + PyErr_Format(PyExc_TypeError, "expected str or bytes object, not %s", Py_TYPE(path_str)->tp_name); +#else + PyErr_Format(PyExc_TypeError, "expected str or unicode object, not %s", Py_TYPE(path_str)->tp_name); +#endif + } + Py_DECREF(path_str); +} + /** * This special Python method is implement to provide support for the pickle * module. @@ -62,6 +171,16 @@ __repr__() const { return result; } +/** + * Allows a Filename object to be passed to any Python function that accepts + * an os.PathLike object. + */ +PyObject *Extension:: +__fspath__() const { + wstring filename = _this->to_os_specific_w(); + return PyUnicode_FromWideChar(filename.data(), (Py_ssize_t)filename.size()); +} + /** * This variant on scan_directory returns a Python list of strings on success, * or None on failure. diff --git a/panda/src/express/filename_ext.h b/panda/src/express/filename_ext.h index c1d5869ec7..1ebeaacc52 100644 --- a/panda/src/express/filename_ext.h +++ b/panda/src/express/filename_ext.h @@ -29,8 +29,11 @@ template<> class Extension : public ExtensionBase { public: + void __init__(PyObject *path); + PyObject *__reduce__(PyObject *self) const; PyObject *__repr__() const; + PyObject *__fspath__() const; PyObject *scan_directory() const; }; From ceee5e9df95d3301ed9d329491737f0e39321a86 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2016 19:32:01 +0100 Subject: [PATCH 47/93] Show texture names in glBindTexture() calls in spam output --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index dc2c0c45e6..8c355cbb03 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6188,7 +6188,7 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z, if (GLCAT.is_spam()) { GLCAT.spam() - << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << ")\n"; + << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << "): " << *tex << "\n"; } } @@ -11365,7 +11365,7 @@ apply_texture(CLP(TextureContext) *gtc) { glBindTexture(target, gtc->_index); if (GLCAT.is_spam()) { GLCAT.spam() - << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << ")\n"; + << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << "): " << *gtc->get_texture() << "\n"; } report_my_gl_errors(); @@ -11663,7 +11663,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { if (GLCAT.is_spam()) { GLCAT.spam() - << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << ")\n"; + << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << "): " << *tex << "\n"; } } @@ -12636,14 +12636,14 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { } #endif + Texture *tex = gtc->get_texture(); + glBindTexture(target, gtc->_index); if (GLCAT.is_spam()) { GLCAT.spam() - << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << ")\n"; + << "glBindTexture(0x" << hex << target << dec << ", " << gtc->_index << "): " << *tex << "\n"; } - Texture *tex = gtc->get_texture(); - GLint wrap_u, wrap_v, wrap_w; GLint minfilter, magfilter; GLfloat border_color[4]; From b1d61b7b10117f8ee0fec99027f57240af39c046 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2016 19:32:44 +0100 Subject: [PATCH 48/93] Fix back-to-front sorting with gl-coordinate-system set to a custom value --- panda/src/display/graphicsStateGuardian.cxx | 4 ++++ panda/src/display/graphicsStateGuardian.h | 2 +- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 10 ---------- panda/src/glstuff/glGraphicsStateGuardian_src.h | 2 -- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 67fbdb2f6c..fee041f57a 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -147,6 +147,10 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _coordinate_system = CS_invalid; _internal_transform = TransformState::make_identity(); + if (_internal_coordinate_system == CS_default) { + _internal_coordinate_system = get_default_coordinate_system(); + } + set_coordinate_system(get_default_coordinate_system()); _data_reader = (GeomVertexDataPipelineReader *)NULL; diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 825b03286d..f8c9dabe6b 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -322,7 +322,7 @@ public: virtual void set_state_and_transform(const RenderState *state, const TransformState *transform); - virtual PN_stdfloat compute_distance_to(const LPoint3 &point) const; + PN_stdfloat compute_distance_to(const LPoint3 &point) const; virtual void clear(DrawableRegion *clearable); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 8c355cbb03..80719c2e69 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6024,16 +6024,6 @@ make_geom_munger(const RenderState *state, Thread *current_thread) { return GeomMunger::register_munger(munger, current_thread); } -/** - * This function will compute the distance to the indicated point, assumed to - * be in eye coordinates, from the camera plane. The point is assumed to be - * in the GSG's internal coordinate system. - */ -PN_stdfloat CLP(GraphicsStateGuardian):: -compute_distance_to(const LPoint3 &point) const { - return -point[2]; -} - /** * Copy the pixels within the indicated display region from the framebuffer * into texture memory. diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index fe8cff8b59..7659ee13e5 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -358,8 +358,6 @@ public: virtual PT(GeomMunger) make_geom_munger(const RenderState *state, Thread *current_thread); - virtual PN_stdfloat compute_distance_to(const LPoint3 &point) const; - virtual void clear(DrawableRegion *region); virtual bool framebuffer_copy_to_texture From 83d54bcdafc9ba5ed9108e8f0619544f4d275c75 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2016 22:57:53 +0100 Subject: [PATCH 49/93] Try to preserve refresh rate when switching display mode on Windows --- doc/ReleaseNotes | 1 + panda/src/windisplay/winGraphicsWindow.cxx | 27 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index b7462a97d6..a288196f72 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -48,6 +48,7 @@ This issue fixes several bugs that were still found in 1.9.2. * 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 +* Now tries to preserve refresh rate when switching fullscreen on Windows ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index f270a70f61..0f7e33dc75 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -2357,7 +2357,15 @@ hide_or_show_cursor(bool hide_cursor) { bool WinGraphicsWindow:: find_acceptable_display_mode(DWORD dwWidth, DWORD dwHeight, DWORD bpp, DEVMODE &dm) { + + // Get the current mode. We'll try to match the refresh rate. + DEVMODE cur_dm; + ZeroMemory(&cur_dm, sizeof(cur_dm)); + cur_dm.dmSize = sizeof(cur_dm); + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &cur_dm); + int modenum = 0; + int saved_modenum = -1; while (1) { ZeroMemory(&dm, sizeof(dm)); @@ -2369,11 +2377,28 @@ find_acceptable_display_mode(DWORD dwWidth, DWORD dwHeight, DWORD bpp, if ((dm.dmPelsWidth == dwWidth) && (dm.dmPelsHeight == dwHeight) && (dm.dmBitsPerPel == bpp)) { - return true; + // If this also matches in refresh rate, we're done here. Otherwise, + // save this as a second choice for later. + if (dm.dmDisplayFrequency == cur_dm.dmDisplayFrequency) { + return true; + } else if (saved_modenum == -1) { + saved_modenum = modenum; + } } modenum++; } + // Failed to find an exact match, but we do have a match that didn't match + // the refresh rate. + if (saved_modenum != -1) { + ZeroMemory(&dm, sizeof(dm)); + dm.dmSize = sizeof(dm); + + if (EnumDisplaySettings(NULL, saved_modenum, &dm)) { + return true; + } + } + return false; } From a1338b9ac6171b2fc37f088b8130e5d22b378b54 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2016 23:00:06 +0100 Subject: [PATCH 50/93] Backport to 1.9: fix for distance sorting with gl-coordinate-system changed --- doc/ReleaseNotes | 1 + panda/src/display/graphicsStateGuardian.cxx | 4 ++++ panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 13 ------------- panda/src/glstuff/glGraphicsStateGuardian_src.h | 2 -- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index a288196f72..03d2dcf92a 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -49,6 +49,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix error when trying to raise vectors to a power * GLSL: fix error when legacy matrix generator inputs are mat3 * Now tries to preserve refresh rate when switching fullscreen on Windows +* Fix back-to-front sorting when gl-coordinate-system is changed ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 0a2ae03c1e..d3557fa390 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -148,6 +148,10 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _coordinate_system = CS_invalid; _internal_transform = TransformState::make_identity(); + if (internal_coordinate_system == CS_default) { + _internal_coordinate_system = get_default_coordinate_system(); + } + set_coordinate_system(get_default_coordinate_system()); _data_reader = (GeomVertexDataPipelineReader *)NULL; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index b70552a032..575d6e202c 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -5485,19 +5485,6 @@ make_geom_munger(const RenderState *state, Thread *current_thread) { return GeomMunger::register_munger(munger, current_thread); } -//////////////////////////////////////////////////////////////////// -// Function: GLGraphicsStateGuardian::compute_distance_to -// Access: Public, Virtual -// Description: This function will compute the distance to the -// indicated point, assumed to be in eye coordinates, -// from the camera plane. The point is assumed to be -// in the GSG's internal coordinate system. -//////////////////////////////////////////////////////////////////// -PN_stdfloat CLP(GraphicsStateGuardian):: -compute_distance_to(const LPoint3 &point) const { - return -point[2]; -} - //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::framebuffer_copy_to_texture // Access: Public, Virtual diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index f8ec534eb2..27fd475724 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -336,8 +336,6 @@ public: virtual PT(GeomMunger) make_geom_munger(const RenderState *state, Thread *current_thread); - virtual PN_stdfloat compute_distance_to(const LPoint3 &point) const; - virtual void clear(DrawableRegion *region); virtual bool framebuffer_copy_to_texture From 32377cb618207f5a5a294934d9c2310d6fb8635e Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 7 Dec 2016 23:04:15 +0100 Subject: [PATCH 51/93] interrogate: fix to allow pointers to forcetyped classes --- dtool/src/interrogate/interfaceMakerPythonNative.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index d4eea3fdff..a844771fa6 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -6142,7 +6142,7 @@ pack_return_value(ostream &out, int indent_level, FunctionRemap *remap, write_python_instance(out, indent_level, return_expr, owns_memory, itype, is_const); } - } else if (TypeManager::is_struct(orig_type->as_pointer_type()->_pointing_at)) { + } else if (TypeManager::is_struct(orig_type->remove_pointer())) { TypeIndex type_index = builder.get_type(TypeManager::unwrap(TypeManager::resolve_type(orig_type)),false); const InterrogateType &itype = idb->get_type(type_index); @@ -6749,6 +6749,8 @@ is_cpp_type_legal(CPPType *in_ctype) { return true; } else if (TypeManager::is_pointer_to_simple(type)) { return true; + } else if (builder.in_forcetype(type->get_local_name(&parser))) { + return true; } else if (TypeManager::is_exported(type)) { return true; } else if (TypeManager::is_pointer_to_PyObject(in_ctype)) { From c422f5952fdf4a11ba19a83c6431f13bed2aa22c Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 8 Dec 2016 23:21:01 +0100 Subject: [PATCH 52/93] Increase default alignment to 2x word size, make DeletedBufferChain allocations more efficient NB. NeverFreeMemory no longer performs alignment. This fixes the Bullet crash on Win64. Need to check Win32. --- dtool/src/dtoolbase/deletedBufferChain.cxx | 11 +++++++++-- dtool/src/dtoolbase/deletedBufferChain.h | 6 +----- dtool/src/dtoolbase/memoryHook.I | 10 ++++++---- dtool/src/dtoolbase/neverFreeMemory.I | 2 ++ dtool/src/dtoolbase/neverFreeMemory.cxx | 10 +++------- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/dtool/src/dtoolbase/deletedBufferChain.cxx b/dtool/src/dtoolbase/deletedBufferChain.cxx index 89f056219c..122edf8837 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.cxx +++ b/dtool/src/dtoolbase/deletedBufferChain.cxx @@ -39,7 +39,7 @@ allocate(size_t size, TypeHandle type_handle) { assert(size <= _buffer_size); // Determine how much space to allocate. - const size_t alloc_size = _buffer_size + flag_reserved_bytes; + const size_t alloc_size = _buffer_size + flag_reserved_bytes + MemoryHook::get_memory_alignment() - 1; ObjectNode *obj; @@ -69,7 +69,10 @@ allocate(size_t size, TypeHandle type_handle) { // If we get here, the deleted_chain is empty; we have to allocate a new // object from the system pool. - obj = (ObjectNode *)NeverFreeMemory::alloc(alloc_size); + // Allocate memory, and make sure the object starts at the proper alignment. + void *mem = NeverFreeMemory::alloc(alloc_size); + intptr_t pad = ((intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment(); + obj = (ObjectNode *)((uintptr_t)mem + pad); #ifdef USE_DELETEDCHAINFLAG obj->_flag = DCF_alive; @@ -77,6 +80,10 @@ allocate(size_t size, TypeHandle type_handle) { void *ptr = node_to_buffer(obj); +#ifdef _DEBUG + assert(((uintptr_t)ptr % MemoryHook::get_memory_alignment()) == 0); +#endif + #ifdef DO_MEMORY_USAGE type_handle.inc_memory_usage(TypeHandle::MC_deleted_chain_active, alloc_size); #endif // DO_MEMORY_USAGE diff --git a/dtool/src/dtoolbase/deletedBufferChain.h b/dtool/src/dtoolbase/deletedBufferChain.h index 6df4583ee8..8f82c1abbc 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.h +++ b/dtool/src/dtoolbase/deletedBufferChain.h @@ -95,12 +95,8 @@ private: // Without DELETEDCHAINFLAG, we don't even store the _flag member at all. static const size_t flag_reserved_bytes = 0; -#elif defined(LINMATH_ALIGN) - // With SSE2 alignment, we need all 16 bytes to preserve alignment. - static const size_t flag_reserved_bytes = 16; - #else - // Otherwise, we only need enough space for the Integer itself. + // Otherwise, we need space for the integer. static const size_t flag_reserved_bytes = sizeof(AtomicAdjust::Integer); #endif // USE_DELETEDCHAINFLAG diff --git a/dtool/src/dtoolbase/memoryHook.I b/dtool/src/dtoolbase/memoryHook.I index c54e34c1f3..09f89cc9df 100644 --- a/dtool/src/dtoolbase/memoryHook.I +++ b/dtool/src/dtoolbase/memoryHook.I @@ -45,8 +45,9 @@ get_memory_alignment() { // don't strictly have to align *everything*, but it's just easier to do so. const size_t alignment_size = 16; #else - // Otherwise, use word alignment. - const size_t alignment_size = sizeof(void *); + // Otherwise, align to two words. This seems to be pretty standard to the + // point where some code may rely on this being the case. + const size_t alignment_size = sizeof(void *) * 2; #endif return alignment_size; } @@ -72,8 +73,9 @@ get_header_reserved_bytes() { static const size_t header_reserved_bytes = sizeof(size_t) + sizeof(size_t); #else - // If we're not aligning, we just need space for the word itself. - static const size_t header_reserved_bytes = sizeof(size_t); + // Virtually all allocators align to two words, so we make sure we preserve + // that alignment for the benefit of anyone who relies upon that. + static const size_t header_reserved_bytes = sizeof(void *) * 2; #endif return header_reserved_bytes; diff --git a/dtool/src/dtoolbase/neverFreeMemory.I b/dtool/src/dtoolbase/neverFreeMemory.I index 33e5b5851c..2156209616 100644 --- a/dtool/src/dtoolbase/neverFreeMemory.I +++ b/dtool/src/dtoolbase/neverFreeMemory.I @@ -14,6 +14,8 @@ /** * Returns a pointer to a newly-allocated block of memory of the indicated * size. + * + * Please note that the resulting pointer is not aligned to any boundary. */ INLINE void *NeverFreeMemory:: alloc(size_t size) { diff --git a/dtool/src/dtoolbase/neverFreeMemory.cxx b/dtool/src/dtoolbase/neverFreeMemory.cxx index 1ec800a749..fd10b683d8 100644 --- a/dtool/src/dtoolbase/neverFreeMemory.cxx +++ b/dtool/src/dtoolbase/neverFreeMemory.cxx @@ -39,13 +39,9 @@ void *NeverFreeMemory:: ns_alloc(size_t size) { _lock.acquire(); - // We always allocate integer multiples of this many bytes, to guarantee - // this minimum alignment. - static const size_t alignment_size = MemoryHook::get_memory_alignment(); - - // Round up to the next alignment_size. - size = ((size + alignment_size - 1) / alignment_size) * alignment_size; - + //NB: we no longer do alignment here. The only class that uses this is + // DeletedBufferChain, and we can do the alignment potentially more + // efficiently there since we don't end up overallocating as much. _total_used += size; // Look for a page that has sufficient space remaining. From 9eb04a533d7b16fe5c044e47a6c156cc0f3b5043 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 9 Dec 2016 01:41:32 +0100 Subject: [PATCH 53/93] More texture load/store performance optimisations --- panda/src/gobj/texture.cxx | 53 ++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 8fa7226806..76530db95b 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -7729,10 +7729,11 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, // Most common case: one byte per pixel, and the source image shows a // maxval of 255. No scaling is necessary. Because this is such a common // case, we break it out per component for best performance. + const xel *array = pnmimage.get_array(); switch (num_components) { case 1: for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); } @@ -7742,9 +7743,10 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, case 2: if (img_has_alpha) { + const xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + const xel *row = array + j * x_size; + const xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)alpha_row[i]; @@ -7753,7 +7755,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)255; @@ -7765,7 +7767,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, case 3: for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)PPM_GETG(row[i]); @@ -7777,9 +7779,10 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, case 4: if (img_has_alpha) { + const xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + const xel *row = array + j * x_size; + const xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)PPM_GETG(row[i]); @@ -7790,7 +7793,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)PPM_GETG(row[i]); @@ -7813,7 +7816,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, for (int j = y_size-1; j >= 0; j--) { for (int i = 0; i < x_size; i++) { if (is_grayscale) { - store_unscaled_short(p, pnmimage.get_gray_val(i, j)); + store_unscaled_short(p, pnmimage.get_gray_val(i, j)); } else { store_unscaled_short(p, pnmimage.get_blue_val(i, j)); store_unscaled_short(p, pnmimage.get_green_val(i, j)); @@ -7979,11 +7982,13 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, const unsigned char *p = &image[idx]; if (component_width == 1) { + xel *array = pnmimage.get_array(); if (is_grayscale) { if (has_alpha) { + xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + xel *row = array + j * x_size; + xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); alpha_row[i] = *p++; @@ -7991,7 +7996,7 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); } @@ -7999,9 +8004,10 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, } } else { if (has_alpha) { + xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + xel *row = array + j * x_size; + xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); PPM_PUTG(row[i], *p++); @@ -8011,7 +8017,7 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); PPM_PUTG(row[i], *p++); @@ -8932,13 +8938,20 @@ compare_images(const PNMImage &a, const PNMImage &b) { nassertr(a.get_x_size() == b.get_x_size() && a.get_y_size() == b.get_y_size(), false); + const xel *a_array = a.get_array(); + const xel *b_array = b.get_array(); + const xelval *a_alpha = a.get_alpha_array(); + const xelval *b_alpha = b.get_alpha_array(); + + int x_size = a.get_x_size(); + int delta = 0; for (int yi = 0; yi < a.get_y_size(); ++yi) { - xel *a_row = a.row(yi); - xel *b_row = b.row(yi); - xelval *a_alpha_row = a.alpha_row(yi); - xelval *b_alpha_row = b.alpha_row(yi); - for (int xi = 0; xi < a.get_x_size(); ++xi) { + const xel *a_row = a_array + yi * x_size; + const xel *b_row = b_array + yi * x_size; + const xelval *a_alpha_row = a_alpha + yi * x_size; + const xelval *b_alpha_row = b_alpha + yi * x_size; + for (int xi = 0; xi < x_size; ++xi) { delta += abs(PPM_GETR(a_row[xi]) - PPM_GETR(b_row[xi])); delta += abs(PPM_GETG(a_row[xi]) - PPM_GETG(b_row[xi])); delta += abs(PPM_GETB(a_row[xi]) - PPM_GETB(b_row[xi])); From b21e8fdf3216b9a18d7f2edef9fc5ce5590f9969 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 11 Dec 2016 15:22:40 +0100 Subject: [PATCH 54/93] COW performance tweaks; also somehow fixes Bullet soft body issue --- .../putil/cachedTypedWritableReferenceCount.I | 19 +++- .../putil/cachedTypedWritableReferenceCount.h | 3 +- panda/src/putil/copyOnWriteObject.cxx | 17 ++++ panda/src/putil/copyOnWriteObject.h | 3 + panda/src/putil/copyOnWritePointer.I | 97 ++++++++++++++++--- panda/src/putil/copyOnWritePointer.cxx | 28 +++--- panda/src/putil/copyOnWritePointer.h | 14 ++- 7 files changed, 145 insertions(+), 36 deletions(-) diff --git a/panda/src/putil/cachedTypedWritableReferenceCount.I b/panda/src/putil/cachedTypedWritableReferenceCount.I index 050c95eb3f..1d60f9a614 100644 --- a/panda/src/putil/cachedTypedWritableReferenceCount.I +++ b/panda/src/putil/cachedTypedWritableReferenceCount.I @@ -126,7 +126,7 @@ cache_ref() const { #endif ref(); - AtomicAdjust::inc(((CachedTypedWritableReferenceCount *)this)->_cache_ref_count); + AtomicAdjust::inc(_cache_ref_count); } /** @@ -147,7 +147,7 @@ cache_unref() const { // you can't use PointerTo's? nassertr(_cache_ref_count > 0, 0); - AtomicAdjust::dec(((CachedTypedWritableReferenceCount *)this)->_cache_ref_count); + AtomicAdjust::dec(_cache_ref_count); return ReferenceCount::unref(); } @@ -164,6 +164,19 @@ test_ref_count_integrity() const { #endif } +/** + * Decrements the cache reference count without affecting the normal reference + * count. Don't use this. + */ +INLINE void CachedTypedWritableReferenceCount:: +cache_ref_only() const { +#ifdef _DEBUG + nassertv(test_ref_count_integrity()); +#endif + + AtomicAdjust::inc(_cache_ref_count); +} + /** * Decrements the cache reference count without affecting the normal reference * count. Intended to be called by derived classes only, presumably to @@ -180,7 +193,7 @@ cache_unref_only() const { // you can't use PointerTo's? nassertv(_cache_ref_count > 0); - AtomicAdjust::dec(((CachedTypedWritableReferenceCount *)this)->_cache_ref_count); + AtomicAdjust::dec(_cache_ref_count); } /** diff --git a/panda/src/putil/cachedTypedWritableReferenceCount.h b/panda/src/putil/cachedTypedWritableReferenceCount.h index 15772048dd..7420253fcb 100644 --- a/panda/src/putil/cachedTypedWritableReferenceCount.h +++ b/panda/src/putil/cachedTypedWritableReferenceCount.h @@ -47,11 +47,12 @@ PUBLISHED: MAKE_PROPERTY(cache_ref_count, get_cache_ref_count); protected: + INLINE void cache_ref_only() const; INLINE void cache_unref_only() const; bool do_test_ref_count_integrity() const; private: - AtomicAdjust::Integer _cache_ref_count; + mutable AtomicAdjust::Integer _cache_ref_count; public: static TypeHandle get_class_type() { diff --git a/panda/src/putil/copyOnWriteObject.cxx b/panda/src/putil/copyOnWriteObject.cxx index 0faa2f23ce..172f354319 100644 --- a/panda/src/putil/copyOnWriteObject.cxx +++ b/panda/src/putil/copyOnWriteObject.cxx @@ -35,4 +35,21 @@ unref() const { } return is_zero; } + +/** + * Explicitly increments the cache reference count only. Don't use this. + * + * In the case of a CopyOnWriteObject, when the reference count decrements + * down to the cache reference count, the object is implicitly unlocked. + */ +void CopyOnWriteObject:: +cache_ref_only() const { + MutexHolder holder(_lock_mutex); + CachedTypedWritableReferenceCount::cache_ref_only(); + if (get_ref_count() == get_cache_ref_count()) { + ((CopyOnWriteObject *)this)->_lock_status = LS_unlocked; + ((CopyOnWriteObject *)this)->_locking_thread = NULL; + ((CopyOnWriteObject *)this)->_lock_cvar.notify(); + } +} #endif // COW_THREADED diff --git a/panda/src/putil/copyOnWriteObject.h b/panda/src/putil/copyOnWriteObject.h index 8cada6bfd7..12ea5baf24 100644 --- a/panda/src/putil/copyOnWriteObject.h +++ b/panda/src/putil/copyOnWriteObject.h @@ -49,6 +49,9 @@ PUBLISHED: virtual bool unref() const; INLINE void cache_ref() const; INLINE bool cache_unref() const; + +public: + void cache_ref_only() const; #endif // COW_THREADED protected: diff --git a/panda/src/putil/copyOnWritePointer.I b/panda/src/putil/copyOnWritePointer.I index 98a0987791..a44731bcbc 100644 --- a/panda/src/putil/copyOnWritePointer.I +++ b/panda/src/putil/copyOnWritePointer.I @@ -74,23 +74,58 @@ INLINE CopyOnWritePointer:: * */ INLINE CopyOnWritePointer:: -CopyOnWritePointer(CopyOnWritePointer &&move) NOEXCEPT : - _cow_object(move._cow_object) +CopyOnWritePointer(CopyOnWritePointer &&from) NOEXCEPT : + _cow_object(from._cow_object) { // Steal the other's reference count. - move._cow_object = (CopyOnWriteObject *)NULL; + from._cow_object = (CopyOnWriteObject *)NULL; +} + +/** + * + */ +INLINE CopyOnWritePointer:: +CopyOnWritePointer(PointerTo &&from) NOEXCEPT : + _cow_object(from.p()) +{ + // Steal the other's reference count, but because it is a regular pointer, + // we do need to include the cache reference count. + if (_cow_object != (CopyOnWriteObject *)NULL) { + _cow_object->cache_ref_only(); + } + from.cheat() = NULL; } /** * */ INLINE void CopyOnWritePointer:: -operator = (CopyOnWritePointer &&move) NOEXCEPT { +operator = (CopyOnWritePointer &&from) NOEXCEPT { // Protect against self-move-assignment. - if (move._cow_object != _cow_object) { + if (from._cow_object != _cow_object) { CopyOnWriteObject *old_object = _cow_object; - _cow_object = move._cow_object; - move._cow_object = NULL; + _cow_object = from._cow_object; + from._cow_object = NULL; + + if (old_object != (CopyOnWriteObject *)NULL) { + cache_unref_delete(old_object); + } + } +} + +/** + * + */ +INLINE void CopyOnWritePointer:: +operator = (PointerTo &&from) NOEXCEPT { + if (from.p() != _cow_object) { + CopyOnWriteObject *old_object = _cow_object; + + // Steal the other's reference count, but because it is a regular pointer, + // we do need to include the cache reference count. + _cow_object = from.p(); + _cow_object->cache_ref_only(); + from.cheat() = NULL; if (old_object != (CopyOnWriteObject *)NULL) { cache_unref_delete(old_object); @@ -262,20 +297,60 @@ operator = (To *object) { */ template INLINE CopyOnWritePointerTo:: -CopyOnWritePointerTo(CopyOnWritePointerTo &&move) NOEXCEPT : - CopyOnWritePointer((CopyOnWritePointer &&)move) +CopyOnWritePointerTo(CopyOnWritePointerTo &&from) NOEXCEPT : + CopyOnWritePointer((CopyOnWritePointer &&)from) { } #endif // CPPPARSER +#ifndef CPPPARSER +/** + * + */ +template +INLINE CopyOnWritePointerTo:: +CopyOnWritePointerTo(PointerTo &&from) NOEXCEPT { + // Steal the other's reference count, but because it is a regular pointer, + // we do need to include the cache reference count. + _cow_object = from.p(); + if (_cow_object != (CopyOnWriteObject *)NULL) { + _cow_object->cache_ref_only(); + } + from.cheat() = NULL; +} +#endif // CPPPARSER + #ifndef CPPPARSER /** * */ template INLINE void CopyOnWritePointerTo:: -operator = (CopyOnWritePointerTo &&move) NOEXCEPT { - CopyOnWritePointer::operator = ((CopyOnWritePointer &&)move); +operator = (CopyOnWritePointerTo &&from) NOEXCEPT { + CopyOnWritePointer::operator = ((CopyOnWritePointer &&)from); +} +#endif // CPPPARSER + +#ifndef CPPPARSER +/** + * + */ +template +INLINE void CopyOnWritePointerTo:: +operator = (PointerTo &&from) NOEXCEPT { + if (from.p() != _cow_object) { + CopyOnWriteObject *old_object = _cow_object; + + // Steal the other's reference count, but because it is a regular pointer, + // we do need to include the cache reference count. + _cow_object = from.p(); + _cow_object->cache_ref_only(); + from.cheat() = NULL; + + if (old_object != (CopyOnWriteObject *)NULL) { + cache_unref_delete(old_object); + } + } } #endif // CPPPARSER #endif // USE_MOVE_SEMANTICS diff --git a/panda/src/putil/copyOnWritePointer.cxx b/panda/src/putil/copyOnWritePointer.cxx index de0a2e8abf..e2396e84a9 100644 --- a/panda/src/putil/copyOnWritePointer.cxx +++ b/panda/src/putil/copyOnWritePointer.cxx @@ -90,19 +90,17 @@ get_write_pointer() { } PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy(); + _cow_object->CachedTypedWritableReferenceCount::cache_unref(); + _cow_object->_lock_mutex.release(); - // 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(); - } + MutexHolder holder(new_object->_lock_mutex); _cow_object = new_object; - _cow_object->cache_ref(); + _cow_object->CachedTypedWritableReferenceCount::cache_ref(); _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write; _cow_object->_locking_thread = current_thread; + return new_object; + } else if (_cow_object->get_cache_ref_count() > 1) { // No one else has it specifically read-locked, but there are other // CopyOnWritePointers holding the same object, so we should make our own @@ -115,19 +113,17 @@ get_write_pointer() { } PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy(); + _cow_object->CachedTypedWritableReferenceCount::cache_unref(); + _cow_object->_lock_mutex.release(); - // 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(); - } + MutexHolder holder(new_object->_lock_mutex); _cow_object = new_object; - _cow_object->cache_ref(); + _cow_object->CachedTypedWritableReferenceCount::cache_ref(); _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write; _cow_object->_locking_thread = current_thread; + return new_object; + } else { // No other thread has the pointer locked, and we're the only // CopyOnWritePointer with this object. We can safely write to it without diff --git a/panda/src/putil/copyOnWritePointer.h b/panda/src/putil/copyOnWritePointer.h index c40c432670..1a7f0e099d 100644 --- a/panda/src/putil/copyOnWritePointer.h +++ b/panda/src/putil/copyOnWritePointer.h @@ -37,8 +37,10 @@ public: INLINE ~CopyOnWritePointer(); #ifdef USE_MOVE_SEMANTICS - INLINE CopyOnWritePointer(CopyOnWritePointer &&move) NOEXCEPT; - INLINE void operator = (CopyOnWritePointer &&move) NOEXCEPT; + INLINE CopyOnWritePointer(CopyOnWritePointer &&from) NOEXCEPT; + INLINE CopyOnWritePointer(PointerTo &&from) NOEXCEPT; + INLINE void operator = (CopyOnWritePointer &&from) NOEXCEPT; + INLINE void operator = (PointerTo &&from) NOEXCEPT; #endif INLINE bool operator == (const CopyOnWritePointer &other) const; @@ -61,7 +63,7 @@ public: INLINE bool test_ref_count_integrity() const; INLINE bool test_ref_count_nonzero() const; -private: +protected: CopyOnWriteObject *_cow_object; }; @@ -84,8 +86,10 @@ public: INLINE void operator = (To *object); #ifdef USE_MOVE_SEMANTICS - INLINE CopyOnWritePointerTo(CopyOnWritePointerTo &&move) NOEXCEPT; - INLINE void operator = (CopyOnWritePointerTo &&move) NOEXCEPT; + INLINE CopyOnWritePointerTo(CopyOnWritePointerTo &&from) NOEXCEPT; + INLINE CopyOnWritePointerTo(PointerTo &&from) NOEXCEPT; + INLINE void operator = (CopyOnWritePointerTo &&from) NOEXCEPT; + INLINE void operator = (PointerTo &&from) NOEXCEPT; #endif #ifdef COW_THREADED From 23645cc407a04034bef457a9a3ab62dc62b94a94 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 13 Dec 2016 21:00:11 +0100 Subject: [PATCH 55/93] Fix DDS load crash with certain formats; support R16, RG16, R32, RG32 --- panda/src/gobj/texture.cxx | 98 ++++++++++++++++++++++++++++++++++++-- panda/src/gobj/texture.h | 2 + 2 files changed, 96 insertions(+), 4 deletions(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 76530db95b..115d9529bf 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -3643,13 +3643,13 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) header.pf.four_cc == 0x30315844) { // 'DX10' // A DirectX 10 style texture, which has an additional header. func = read_dds_level_generic_uncompressed; - unsigned int format = dds.get_uint32(); + unsigned int dxgi_format = dds.get_uint32(); 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(); - switch (format) { + switch (dxgi_format) { case 2: // DXGI_FORMAT_R32G32B32A32_FLOAT format = F_rgba32; component_type = T_float; @@ -3665,6 +3665,11 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) component_type = T_unsigned_short; func = read_dds_level_abgr16; break; + case 16: // DXGI_FORMAT_R32G32_FLOAT + format = F_rg32; + component_type = T_float; + func = read_dds_level_raw; + break; case 27: // DXGI_FORMAT_R8G8B8A8_TYPELESS case 28: // DXGI_FORMAT_R8G8B8A8_UNORM format = F_rgba8; @@ -3688,6 +3693,41 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) component_type = T_byte; func = read_dds_level_abgr8; break; + case 34: // DXGI_FORMAT_R16G16_FLOAT: + format = F_rg16; + component_type = T_half_float; + func = read_dds_level_raw; + break; + case 35: // DXGI_FORMAT_R16G16_UNORM: + format = F_rg16; + component_type = T_unsigned_short; + func = read_dds_level_raw; + break; + case 37: // DXGI_FORMAT_R16G16_SNORM: + format = F_rg16; + component_type = T_short; + func = read_dds_level_raw; + break; + case 40: // DXGI_FORMAT_D32_FLOAT + format = F_depth_component32; + component_type = T_float; + func = read_dds_level_raw; + break; + case 41: // DXGI_FORMAT_R32_FLOAT + format = F_r32; + component_type = T_float; + func = read_dds_level_raw; + break; + case 42: // DXGI_FORMAT_R32_UINT + format = F_r32i; + component_type = T_unsigned_int; + func = read_dds_level_raw; + break; + case 43: // DXGI_FORMAT_R32_SINT + format = F_r32i; + component_type = T_int; + func = read_dds_level_raw; + break; case 48: // DXGI_FORMAT_R8G8_TYPELESS case 49: // DXGI_FORMAT_R8G8_UNORM format = F_rg; @@ -3703,6 +3743,36 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) format = F_rg8i; component_type = T_byte; break; + case 54: // DXGI_FORMAT_R16_FLOAT: + format = F_r16; + component_type = T_half_float; + func = read_dds_level_raw; + break; + case 55: // DXGI_FORMAT_D16_UNORM: + format = F_depth_component16; + component_type = T_unsigned_short; + func = read_dds_level_raw; + break; + case 56: // DXGI_FORMAT_R16_UNORM: + format = F_r16; + component_type = T_unsigned_short; + func = read_dds_level_raw; + break; + case 57: // DXGI_FORMAT_R16_UINT: + format = F_r16i; + component_type = T_unsigned_short; + func = read_dds_level_raw; + break; + case 58: // DXGI_FORMAT_R16_SNORM: + format = F_r16; + component_type = T_short; + func = read_dds_level_raw; + break; + case 59: // DXGI_FORMAT_R16_SINT: + format = F_r16i; + component_type = T_short; + func = read_dds_level_raw; + break; case 60: // DXGI_FORMAT_R8_TYPELESS case 61: // DXGI_FORMAT_R8_UNORM format = F_red; @@ -3760,7 +3830,6 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) compression = CM_rgtc; func = read_dds_level_bc4; break; - break; case 82: // DXGI_FORMAT_BC5_TYPELESS case 83: // DXGI_FORMAT_BC5_UNORM format = F_rg; @@ -3786,7 +3855,7 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) break; default: gobj_cat.error() - << filename << ": unsupported DXGI format " << format << ".\n"; + << filename << ": unsupported DXGI format " << dxgi_format << ".\n"; return false; } @@ -8264,6 +8333,7 @@ read_dds_level_abgr32(Texture *tex, CData *cdata, const DDSHeader &header, int n size_t size = tex->do_get_expected_ram_mipmap_page_size(cdata, n); size_t row_bytes = x_size * 16; + nassertr(row_bytes * y_size == size, PTA_uchar()); PTA_uchar image = PTA_uchar::empty_array(size); for (int y = y_size - 1; y >= 0; --y) { unsigned char *p = image.p() + y * row_bytes; @@ -8280,6 +8350,26 @@ read_dds_level_abgr32(Texture *tex, CData *cdata, const DDSHeader &header, int n return image; } +/** + * Called by read_dds for a DDS file that needs no transformations applied. + */ +PTA_uchar Texture:: +read_dds_level_raw(Texture *tex, CData *cdata, const DDSHeader &header, int n, istream &in) { + int x_size = tex->do_get_expected_mipmap_x_size(cdata, n); + int y_size = tex->do_get_expected_mipmap_y_size(cdata, n); + + size_t size = tex->do_get_expected_ram_mipmap_page_size(cdata, n); + size_t row_bytes = x_size * cdata->_num_components * cdata->_component_width; + nassertr(row_bytes * y_size == size, PTA_uchar()); + PTA_uchar image = PTA_uchar::empty_array(size); + for (int y = y_size - 1; y >= 0; --y) { + unsigned char *p = image.p() + y * row_bytes; + in.read((char *)p, row_bytes); + } + + return image; +} + /** * Called by read_dds for a DDS file whose format isn't one we've specifically * optimized. diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index cd05019416..e40ca6f8e5 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -817,6 +817,8 @@ private: int n, istream &in); static PTA_uchar read_dds_level_abgr32(Texture *tex, CData *cdata, const DDSHeader &header, int n, istream &in); + static PTA_uchar read_dds_level_raw(Texture *tex, CData *cdata, const DDSHeader &header, + int n, istream &in); static PTA_uchar read_dds_level_generic_uncompressed(Texture *tex, CData *cdata, const DDSHeader &header, int n, istream &in); From 34068dc0c1d88a6111eec380df4096422a58867e Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 13 Dec 2016 21:22:17 +0100 Subject: [PATCH 56/93] Implement support for SSBOs --- panda/src/display/graphicsStateGuardian.I | 8 + panda/src/display/graphicsStateGuardian.cxx | 24 ++- panda/src/display/graphicsStateGuardian.h | 8 + panda/src/glstuff/glBufferContext_src.I | 25 +++ panda/src/glstuff/glBufferContext_src.cxx | 49 +++++ panda/src/glstuff/glBufferContext_src.h | 52 +++++ .../glstuff/glGraphicsStateGuardian_src.cxx | 171 +++++++++++++++- .../src/glstuff/glGraphicsStateGuardian_src.h | 14 ++ panda/src/glstuff/glShaderContext_src.cxx | 53 +++++ panda/src/glstuff/glShaderContext_src.h | 12 ++ panda/src/glstuff/glmisc_src.cxx | 1 + panda/src/glstuff/glstuff_src.cxx | 1 + panda/src/glstuff/glstuff_src.h | 1 + panda/src/gobj/p3gobj_composite2.cxx | 1 + panda/src/gobj/preparedGraphicsObjects.I | 7 +- panda/src/gobj/preparedGraphicsObjects.cxx | 165 +++++++++++++++ panda/src/gobj/preparedGraphicsObjects.h | 19 ++ panda/src/gobj/shaderBuffer.I | 63 ++++++ panda/src/gobj/shaderBuffer.cxx | 193 ++++++++++++++++++ panda/src/gobj/shaderBuffer.h | 97 +++++++++ panda/src/gobj/shaderContext.h | 1 + panda/src/gsgbase/graphicsStateGuardianBase.h | 5 + panda/src/pgraph/nodePath.I | 8 + panda/src/pgraph/nodePath.h | 2 + panda/src/pgraph/shaderAttrib.cxx | 29 +++ panda/src/pgraph/shaderAttrib.h | 1 + panda/src/pgraph/shaderInput.I | 12 ++ panda/src/pgraph/shaderInput.h | 7 +- 28 files changed, 1014 insertions(+), 15 deletions(-) create mode 100644 panda/src/glstuff/glBufferContext_src.I create mode 100644 panda/src/glstuff/glBufferContext_src.cxx create mode 100644 panda/src/glstuff/glBufferContext_src.h create mode 100644 panda/src/gobj/shaderBuffer.I create mode 100644 panda/src/gobj/shaderBuffer.cxx create mode 100644 panda/src/gobj/shaderBuffer.h diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index ea3a9b61ac..15f95a19f4 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -62,6 +62,14 @@ release_all_index_buffers() { return _prepared_objects->release_all_index_buffers(); } +/** + * Frees the resources for all index buffers associated with this GSG. + */ +INLINE int GraphicsStateGuardian:: +release_all_shader_buffers() { + return _prepared_objects->release_all_shader_buffers(); +} + /** * Sets the active flag associated with the GraphicsStateGuardian. If the * GraphicsStateGuardian is marked inactive, nothing is rendered. This is not diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index fee041f57a..d5b2f769a0 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -62,12 +62,15 @@ #include #include -PStatCollector GraphicsStateGuardian::_vertex_buffer_switch_pcollector("Vertex buffer switch:Vertex"); -PStatCollector GraphicsStateGuardian::_index_buffer_switch_pcollector("Vertex buffer switch:Index"); +PStatCollector GraphicsStateGuardian::_vertex_buffer_switch_pcollector("Buffer switch:Vertex"); +PStatCollector GraphicsStateGuardian::_index_buffer_switch_pcollector("Buffer switch:Index"); +PStatCollector GraphicsStateGuardian::_shader_buffer_switch_pcollector("Buffer switch:Shader"); PStatCollector GraphicsStateGuardian::_load_vertex_buffer_pcollector("Draw:Transfer data:Vertex buffer"); PStatCollector GraphicsStateGuardian::_load_index_buffer_pcollector("Draw:Transfer data:Index buffer"); +PStatCollector GraphicsStateGuardian::_load_shader_buffer_pcollector("Draw:Transfer data:Shader buffer"); PStatCollector GraphicsStateGuardian::_create_vertex_buffer_pcollector("Draw:Transfer data:Create Vertex buffer"); PStatCollector GraphicsStateGuardian::_create_index_buffer_pcollector("Draw:Transfer data:Create Index buffer"); +PStatCollector GraphicsStateGuardian::_create_shader_buffer_pcollector("Draw:Transfer data:Create Shader buffer"); PStatCollector GraphicsStateGuardian::_load_texture_pcollector("Draw:Transfer data:Texture"); PStatCollector GraphicsStateGuardian::_data_transferred_pcollector("Data transferred"); PStatCollector GraphicsStateGuardian::_texmgrmem_total_pcollector("Texture manager"); @@ -104,6 +107,7 @@ PStatCollector GraphicsStateGuardian::_prepare_geom_pcollector("Draw:Prepare:Geo PStatCollector GraphicsStateGuardian::_prepare_shader_pcollector("Draw:Prepare:Shader"); PStatCollector GraphicsStateGuardian::_prepare_vertex_buffer_pcollector("Draw:Prepare:Vertex buffer"); PStatCollector GraphicsStateGuardian::_prepare_index_buffer_pcollector("Draw:Prepare:Index buffer"); +PStatCollector GraphicsStateGuardian::_prepare_shader_buffer_pcollector("Draw:Prepare:Shader buffer"); PStatCollector GraphicsStateGuardian::_draw_set_state_transform_pcollector("Draw:Set State:Transform"); PStatCollector GraphicsStateGuardian::_draw_set_state_alpha_test_pcollector("Draw:Set State:Alpha test"); @@ -657,6 +661,22 @@ void GraphicsStateGuardian:: release_index_buffer(IndexBufferContext *) { } +/** + * Prepares the indicated buffer for retained-mode rendering. + */ +BufferContext *GraphicsStateGuardian:: +prepare_shader_buffer(ShaderBuffer *) { + return (BufferContext *)NULL; +} + +/** + * Frees the resources previously allocated via a call to prepare_data(), + * including deleting the BufferContext itself, if necessary. + */ +void GraphicsStateGuardian:: +release_shader_buffer(BufferContext *) { +} + /** * Begins a new occlusion query. After this call, you may call * begin_draw_primitives() and draw_triangles()/draw_whatever() repeatedly. diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index f8c9dabe6b..81643a1f11 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -88,6 +88,7 @@ PUBLISHED: INLINE int release_all_geoms(); INLINE int release_all_vertex_buffers(); INLINE int release_all_index_buffers(); + INLINE int release_all_shader_buffers(); INLINE void set_active(bool active); INLINE bool is_active() const; @@ -307,6 +308,9 @@ public: virtual IndexBufferContext *prepare_index_buffer(GeomPrimitive *data); virtual void release_index_buffer(IndexBufferContext *ibc); + virtual BufferContext *prepare_shader_buffer(ShaderBuffer *data); + virtual void release_shader_buffer(BufferContext *ibc); + virtual void begin_occlusion_query(); virtual PT(OcclusionQueryContext) end_occlusion_query(); @@ -640,10 +644,13 @@ public: // Statistics static PStatCollector _vertex_buffer_switch_pcollector; static PStatCollector _index_buffer_switch_pcollector; + static PStatCollector _shader_buffer_switch_pcollector; static PStatCollector _load_vertex_buffer_pcollector; static PStatCollector _load_index_buffer_pcollector; + static PStatCollector _load_shader_buffer_pcollector; static PStatCollector _create_vertex_buffer_pcollector; static PStatCollector _create_index_buffer_pcollector; + static PStatCollector _create_shader_buffer_pcollector; static PStatCollector _load_texture_pcollector; static PStatCollector _data_transferred_pcollector; static PStatCollector _texmgrmem_total_pcollector; @@ -680,6 +687,7 @@ public: static PStatCollector _prepare_shader_pcollector; static PStatCollector _prepare_vertex_buffer_pcollector; static PStatCollector _prepare_index_buffer_pcollector; + static PStatCollector _prepare_shader_buffer_pcollector; // A whole slew of collectors to measure the cost of individual state // changes. These are disabled by default. diff --git a/panda/src/glstuff/glBufferContext_src.I b/panda/src/glstuff/glBufferContext_src.I new file mode 100644 index 0000000000..bec8283a18 --- /dev/null +++ b/panda/src/glstuff/glBufferContext_src.I @@ -0,0 +1,25 @@ +/** + * 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 glBufferContext_src.I + * @author rdb + * @date 2016-12-12 + */ + +/** + * + */ +INLINE CLP(BufferContext):: +CLP(BufferContext)(CLP(GraphicsStateGuardian) *glgsg, + PreparedGraphicsObjects *pgo) : + BufferContext(&pgo->_sbuffer_residency), + AdaptiveLruPage(0), + _glgsg(glgsg) +{ + _index = 0; +} diff --git a/panda/src/glstuff/glBufferContext_src.cxx b/panda/src/glstuff/glBufferContext_src.cxx new file mode 100644 index 0000000000..f2e588f945 --- /dev/null +++ b/panda/src/glstuff/glBufferContext_src.cxx @@ -0,0 +1,49 @@ +/** + * 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 glBufferContext_src.cxx + * @author rdb + * @date 2016-12-12 + */ + +TypeHandle CLP(BufferContext)::_type_handle; + +/** + * Evicts the page from the LRU. Called internally when the LRU determines + * that it is full. May also be called externally when necessary to + * explicitly evict the page. + * + * It is legal for this method to either evict the page as requested, do + * nothing (in which case the eviction will be requested again at the next + * epoch), or requeue itself on the tail of the queue (in which case the + * eviction will be requested again much later). + */ +void CLP(BufferContext):: +evict_lru() { + dequeue_lru(); + + // Make sure the buffer is unbound before we delete it. + if (_glgsg->_current_ibuffer_index == _index) { + if (GLCAT.is_debug() && gl_debug_buffers) { + GLCAT.debug() + << "unbinding index buffer\n"; + } + _glgsg->_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + _glgsg->_current_ibuffer_index = 0; + } + + // Free the buffer. + _glgsg->_glDeleteBuffers(1, &_index); + + // We still need a valid index number, though, in case we want to re-load + // the buffer later. + _glgsg->_glGenBuffers(1, &_index); + + update_data_size_bytes(0); + set_resident(false); +} diff --git a/panda/src/glstuff/glBufferContext_src.h b/panda/src/glstuff/glBufferContext_src.h new file mode 100644 index 0000000000..b6c46aab76 --- /dev/null +++ b/panda/src/glstuff/glBufferContext_src.h @@ -0,0 +1,52 @@ +/** + * 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 glBufferContext_src.h + * @author rdb + * @date 2016-12-12 + */ + +#include "pandabase.h" +#include "bufferContext.h" +#include "deletedChain.h" + +/** + * Caches a GeomPrimitive on the GL as a buffer object. + */ +class EXPCL_GL CLP(BufferContext) : public BufferContext, public AdaptiveLruPage { +public: + INLINE CLP(BufferContext)(CLP(GraphicsStateGuardian) *glgsg, + PreparedGraphicsObjects *pgo); + ALLOC_DELETED_CHAIN(CLP(BufferContext)); + + virtual void evict_lru(); + + CLP(GraphicsStateGuardian) *_glgsg; + + // This is the GL "name" of the data object. + GLuint _index; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + BufferContext::init_type(); + register_type(_type_handle, CLASSPREFIX_QUOTED "BufferContext", + BufferContext::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#include "glBufferContext_src.I" diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 80719c2e69..98c21610c5 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1796,7 +1796,7 @@ reset() { } #endif -#ifndef OPENGLES +#ifndef OPENGLES_1 // Check for uniform buffers. #ifdef OPENGLES if (is_at_least_gl_version(3, 1) || has_extension("GL_ARB_uniform_buffer_object")) { @@ -1810,12 +1810,30 @@ reset() { get_extension_func("glGetActiveUniformBlockiv"); _glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) get_extension_func("glGetActiveUniformBlockName"); - - _glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) - get_extension_func("glBindBufferBase"); } else { _supports_uniform_buffers = false; } + +#ifndef OPENGLES + // Check for SSBOs. + if (is_at_least_gl_version(4, 3) || has_extension("ARB_shader_storage_buffer_object")) { + _supports_shader_buffers = true; + _glGetProgramInterfaceiv = (PFNGLGETPROGRAMINTERFACEIVPROC) + get_extension_func("glGetProgramInterfaceiv"); + _glGetProgramResourceName = (PFNGLGETPROGRAMRESOURCENAMEPROC) + get_extension_func("glGetProgramResourceName"); + _glGetProgramResourceiv = (PFNGLGETPROGRAMRESOURCEIVPROC) + get_extension_func("glGetProgramResourceiv"); + } else +#endif + { + _supports_shader_buffers = false; + } + + if (_supports_uniform_buffers || _supports_shader_buffers) { + _glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) + get_extension_func("glBindBufferBase"); + } #endif // Check whether we support geometry instancing and instanced vertex @@ -3031,6 +3049,9 @@ reset() { _current_vertex_buffers.clear(); _current_vertex_format.clear(); memset(_vertex_attrib_columns, 0, sizeof(const GeomVertexColumn *) * 32); + + _current_sbuffer_index = 0; + _current_sbuffer_base.clear(); #endif report_my_gl_errors(); @@ -5873,6 +5894,122 @@ setup_primitive(const unsigned char *&client_pointer, return true; } +#ifndef OPENGLES +/** + * Creates a new retained-mode representation of the given data, and returns a + * newly-allocated BufferContext pointer to reference it. It is the + * responsibility of the calling function to later call release_shader_buffer() + * with this same pointer (which will also delete the pointer). + * + * This function should not be called directly to prepare a buffer. Instead, + * call ShaderBuffer::prepare(). + */ +BufferContext *CLP(GraphicsStateGuardian):: +prepare_shader_buffer(ShaderBuffer *data) { + if (_supports_shader_buffers) { + PStatGPUTimer timer(this, _prepare_shader_buffer_pcollector); + + CLP(BufferContext) *gbc = new CLP(BufferContext)(this, _prepared_objects); + _glGenBuffers(1, &gbc->_index); + + if (GLCAT.is_debug() && gl_debug_buffers) { + GLCAT.debug() + << "creating shader buffer " << (int)gbc->_index << ": "<< *data << "\n"; + } + _glBindBuffer(GL_SHADER_STORAGE_BUFFER, gbc->_index); + _current_sbuffer_index = gbc->_index; + + if (_use_object_labels) { + string name = data->get_name(); + _glObjectLabel(GL_SHADER_STORAGE_BUFFER, gbc->_index, name.size(), name.data()); + } + + uint64_t num_bytes = data->get_data_size_bytes(); + if (_supports_buffer_storage) { + _glBufferStorage(GL_SHADER_STORAGE_BUFFER, num_bytes, data->get_initial_data(), 0); + } else { + _glBufferData(GL_SHADER_STORAGE_BUFFER, num_bytes, data->get_initial_data(), get_usage(data->get_usage_hint())); + } + + gbc->enqueue_lru(&_prepared_objects->_graphics_memory_lru); + + report_my_gl_errors(); + return gbc; + } + + return NULL; +} + +/** + * Binds the given shader buffer to the given binding slot. + */ +void CLP(GraphicsStateGuardian):: +apply_shader_buffer(GLuint base, ShaderBuffer *buffer) { + GLuint index = 0; + if (buffer != NULL) { + BufferContext *bc = buffer->prepare_now(get_prepared_objects(), this); + if (bc != NULL) { + CLP(BufferContext) *gbc = DCAST(CLP(BufferContext), bc); + index = gbc->_index; + gbc->set_active(true); + } + } + + if (base >= _current_sbuffer_base.size()) { + _current_sbuffer_base.resize(base + 1, 0); + } + + if (_current_sbuffer_base[base] != index) { + if (GLCAT.is_spam() && gl_debug_buffers) { + GLCAT.spam() + << "binding shader buffer " << (int)index + << " to index " << base << "\n"; + } + _glBindBufferBase(GL_SHADER_STORAGE_BUFFER, base, index); + _current_sbuffer_base[base] = index; + _current_sbuffer_index = index; + + report_my_gl_errors(); + } +} + +/** + * Frees the GL resources previously allocated for the data. This function + * should never be called directly; instead, call Data::release() (or simply + * let the Data destruct). + */ +void CLP(GraphicsStateGuardian):: +release_shader_buffer(BufferContext *bc) { + nassertv(_supports_buffers); + + CLP(BufferContext) *gbc = DCAST(CLP(BufferContext), bc); + + if (GLCAT.is_debug() && gl_debug_buffers) { + GLCAT.debug() + << "deleting shader buffer " << (int)gbc->_index << "\n"; + } + + // Make sure the buffer is unbound before we delete it. Not strictly + // necessary according to the OpenGL spec, but it might help out a flaky + // driver, and we need to keep our internal state consistent anyway. + if (_current_sbuffer_index == gbc->_index) { + if (GLCAT.is_spam() && gl_debug_buffers) { + GLCAT.spam() + << "unbinding shader buffer\n"; + } + _glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); + _current_sbuffer_index = 0; + } + + _glDeleteBuffers(1, &gbc->_index); + report_my_gl_errors(); + + gbc->_index = 0; + + delete gbc; +} +#endif + #ifndef OPENGLES /** * Begins a new occlusion query. After this call, you may call @@ -6499,7 +6636,7 @@ do_issue_shade_model() { #ifndef OPENGLES_1 /** - * + * Called when the current ShaderAttrib state has changed. */ void CLP(GraphicsStateGuardian):: do_issue_shader() { @@ -6512,21 +6649,30 @@ do_issue_shader() { shader = _default_shader; nassertv(shader != NULL); } - #endif + if (shader) { - context = shader->prepare_now(get_prepared_objects(), this); + if (_current_shader != shader) { + context = shader->prepare_now(get_prepared_objects(), this); + } else { + context = _current_shader_context; + } } + #ifndef SUPPORT_FIXED_FUNCTION // If it failed, try applying the default shader. if (shader != _default_shader && (context == 0 || !context->valid())) { shader = _default_shader; nassertv(shader != NULL); - context = shader->prepare_now(get_prepared_objects(), this); + if (_current_shader != shader) { + context = shader->prepare_now(get_prepared_objects(), this); + } else { + context = _current_shader_context; + } } #endif - if (context == 0 || (context->valid() == false)) { + if (context == 0 || !context->valid()) { if (_current_shader_context != 0) { _current_shader_context->unbind(); _current_shader = 0; @@ -6538,12 +6684,16 @@ do_issue_shader() { // bind the new one. if (_current_shader_context != NULL && _current_shader->get_language() != shader->get_language()) { + // If it's a different type of shader, make sure to unbind the old. _current_shader_context->unbind(); } context->bind(); _current_shader = shader; - _current_shader_context = context; } + + // Bind the shader storage buffers. + context->update_shader_buffer_bindings(_current_shader_context); + _current_shader_context = context; } #ifndef OPENGLES @@ -10116,6 +10266,7 @@ set_state_and_transform(const RenderState *target, } #endif + // Update all of the state that is bound to the shader program. if (_current_shader_context != NULL) { _current_shader_context->set_state_and_transform(target, transform, _projection_mat); } diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 7659ee13e5..85290cd6f2 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -344,6 +344,12 @@ public: const GeomPrimitivePipelineReader *reader, bool force); +#ifndef OPENGLES + virtual BufferContext *prepare_shader_buffer(ShaderBuffer *data); + void apply_shader_buffer(GLuint base, ShaderBuffer *buffer); + virtual void release_shader_buffer(BufferContext *bc); +#endif + #ifndef OPENGLES virtual void begin_occlusion_query(); virtual PT(OcclusionQueryContext) end_occlusion_query(); @@ -685,6 +691,9 @@ protected: bool _use_vertex_attrib_binding; CPT(GeomVertexFormat) _current_vertex_format; const GeomVertexColumn *_vertex_attrib_columns[32]; + + GLuint _current_sbuffer_index; + pvector _current_sbuffer_base; #endif int _active_texture_stage; @@ -811,6 +820,7 @@ public: #ifndef OPENGLES_1 bool _supports_uniform_buffers; + bool _supports_shader_buffers; PFNGLBINDBUFFERBASEPROC _glBindBufferBase; bool _supports_buffer_storage; @@ -995,6 +1005,9 @@ public: PFNGLMAKETEXTUREHANDLENONRESIDENTPROC _glMakeTextureHandleNonResident; PFNGLUNIFORMHANDLEUI64PROC _glUniformHandleui64; PFNGLUNIFORMHANDLEUI64VPROC _glUniformHandleui64v; + PFNGLGETPROGRAMINTERFACEIVPROC _glGetProgramInterfaceiv; + PFNGLGETPROGRAMRESOURCENAMEPROC _glGetProgramResourceName; + PFNGLGETPROGRAMRESOURCEIVPROC _glGetProgramResourceiv; #endif // !OPENGLES GLenum _edge_clamp; @@ -1090,6 +1103,7 @@ private: friend class CLP(VertexBufferContext); friend class CLP(IndexBufferContext); + friend class CLP(BufferContext); friend class CLP(ShaderContext); friend class CLP(CgShaderContext); friend class CLP(GraphicsBuffer); diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 528b98804c..6947a39235 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -324,6 +324,34 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext } } +#ifndef OPENGLES + // Get the used shader storage blocks. + if (_glgsg->_supports_shader_buffers) { + GLint block_count = 0, block_maxlength = 0; + + _glgsg->_glGetProgramInterfaceiv(_glsl_program, GL_SHADER_STORAGE_BLOCK, GL_ACTIVE_RESOURCES, &block_count); + _glgsg->_glGetProgramInterfaceiv(_glsl_program, GL_SHADER_STORAGE_BLOCK, GL_MAX_NAME_LENGTH, &block_maxlength); + + block_maxlength = max(64, block_maxlength); + char *block_name_cstr = (char *)alloca(block_maxlength); + + for (int i = 0; i < block_count; ++i) { + block_name_cstr[0] = 0; + _glgsg->_glGetProgramResourceName(_glsl_program, GL_SHADER_STORAGE_BLOCK, i, block_maxlength, NULL, block_name_cstr); + + const GLenum props[] = {GL_BUFFER_BINDING, GL_BUFFER_DATA_SIZE}; + GLint values[2]; + _glgsg->_glGetProgramResourceiv(_glsl_program, GL_SHADER_STORAGE_BLOCK, i, 2, props, 2, NULL, values); + + StorageBlock block; + block._name = InternalName::make(block_name_cstr); + block._binding_index = values[0]; + block._min_size = values[1]; + _storage_blocks.push_back(block); + } + } +#endif + // Bind the program, so that we can call glUniform1i for the textures. _glgsg->_glUseProgram(_glsl_program); @@ -2659,6 +2687,31 @@ update_shader_texture_bindings(ShaderContext *prev) { _glgsg->report_my_gl_errors(); } +/** + * Updates the shader buffer bindings for this shader. + */ +void CLP(ShaderContext):: +update_shader_buffer_bindings(ShaderContext *prev) { +#ifndef OPENGLES + // Update the shader storage buffer bindings. + const ShaderAttrib *attrib = _glgsg->_target_shader; + + for (size_t i = 0; i < _storage_blocks.size(); ++i) { + StorageBlock &block = _storage_blocks[i]; + + ShaderBuffer *buffer = attrib->get_shader_input_buffer(block._name); +#ifndef NDEBUG + if (buffer->get_data_size_bytes() < block._min_size) { + GLCAT.error() + << "cannot bind " << *buffer << " to shader because it is too small" + " (expected at least " << block._min_size << " bytes)\n"; + } +#endif + _glgsg->apply_shader_buffer(block._binding_index, buffer); + } +#endif +} + /** * This subroutine prints the infolog for a shader. */ diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 183f068277..e143774ed6 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -55,6 +55,7 @@ public: bool update_shader_vertex_arrays(ShaderContext *prev, bool force); void disable_shader_texture_bindings() OVERRIDE; void update_shader_texture_bindings(ShaderContext *prev) OVERRIDE; + void update_shader_buffer_bindings(ShaderContext *prev) OVERRIDE; INLINE bool uses_standard_vertex_arrays(void); INLINE bool uses_custom_vertex_arrays(void); @@ -87,6 +88,17 @@ private: pmap _glsl_uniform_handles; #endif +#ifndef OPENGLES + struct StorageBlock { + CPT(InternalName) _name; + GLuint _binding_index; + GLint _min_size; + }; + typedef pvector StorageBlocks; + StorageBlocks _storage_blocks; + BitArray _used_storage_bindings; +#endif + struct ImageInput { CPT(InternalName) _name; CLP(TextureContext) *_gtc; diff --git a/panda/src/glstuff/glmisc_src.cxx b/panda/src/glstuff/glmisc_src.cxx index 544a5c2c79..fd2bcf7aee 100644 --- a/panda/src/glstuff/glmisc_src.cxx +++ b/panda/src/glstuff/glmisc_src.cxx @@ -331,6 +331,7 @@ void CLP(init_classes)() { CLP(SamplerContext)::init_type(); #endif CLP(VertexBufferContext)::init_type(); + CLP(BufferContext)::init_type(); CLP(GraphicsBuffer)::init_type(); #ifndef OPENGLES diff --git a/panda/src/glstuff/glstuff_src.cxx b/panda/src/glstuff/glstuff_src.cxx index af8bcc1df3..06abef89f4 100644 --- a/panda/src/glstuff/glstuff_src.cxx +++ b/panda/src/glstuff/glstuff_src.cxx @@ -21,6 +21,7 @@ #include "glSamplerContext_src.cxx" #include "glVertexBufferContext_src.cxx" #include "glIndexBufferContext_src.cxx" +#include "glBufferContext_src.cxx" #include "glOcclusionQueryContext_src.cxx" #include "glTimerQueryContext_src.cxx" #include "glLatencyQueryContext_src.cxx" diff --git a/panda/src/glstuff/glstuff_src.h b/panda/src/glstuff/glstuff_src.h index 46edb3ac83..02e3208445 100644 --- a/panda/src/glstuff/glstuff_src.h +++ b/panda/src/glstuff/glstuff_src.h @@ -33,6 +33,7 @@ #include "glSamplerContext_src.h" #include "glVertexBufferContext_src.h" #include "glIndexBufferContext_src.h" +#include "glBufferContext_src.h" #include "glOcclusionQueryContext_src.h" #include "glTimerQueryContext_src.h" #include "glLatencyQueryContext_src.h" diff --git a/panda/src/gobj/p3gobj_composite2.cxx b/panda/src/gobj/p3gobj_composite2.cxx index 81e23e5c07..56704b12b3 100644 --- a/panda/src/gobj/p3gobj_composite2.cxx +++ b/panda/src/gobj/p3gobj_composite2.cxx @@ -5,6 +5,7 @@ #include "samplerContext.cxx" #include "samplerState.cxx" #include "savedContext.cxx" +#include "shaderBuffer.cxx" #include "shaderContext.cxx" #include "shader.cxx" #include "simpleAllocator.cxx" diff --git a/panda/src/gobj/preparedGraphicsObjects.I b/panda/src/gobj/preparedGraphicsObjects.I index a9bd618ab5..6cc6daf914 100644 --- a/panda/src/gobj/preparedGraphicsObjects.I +++ b/panda/src/gobj/preparedGraphicsObjects.I @@ -45,6 +45,7 @@ release_all() { _texture_residency.set_levels(); _vbuffer_residency.set_levels(); _ibuffer_residency.set_levels(); + _sbuffer_residency.set_levels(); } /** @@ -58,7 +59,8 @@ get_num_queued() const { get_num_queued_geoms() + get_num_queued_shaders() + get_num_queued_vertex_buffers() + - get_num_queued_index_buffers()); + get_num_queued_index_buffers() + + get_num_queued_shader_buffers()); } /** @@ -72,7 +74,8 @@ get_num_prepared() const { get_num_prepared_geoms() + get_num_prepared_shaders() + get_num_prepared_vertex_buffers() + - get_num_prepared_index_buffers()); + get_num_prepared_index_buffers() + + get_num_prepared_shader_buffers()); } /** diff --git a/panda/src/gobj/preparedGraphicsObjects.cxx b/panda/src/gobj/preparedGraphicsObjects.cxx index 7b2b5e08a9..5c9ec855e3 100644 --- a/panda/src/gobj/preparedGraphicsObjects.cxx +++ b/panda/src/gobj/preparedGraphicsObjects.cxx @@ -41,6 +41,7 @@ PreparedGraphicsObjects() : _texture_residency(_name, "texture"), _vbuffer_residency(_name, "vbuffer"), _ibuffer_residency(_name, "ibuffer"), + _sbuffer_residency(_name, "sbuffer"), _graphics_memory_lru("graphics_memory_lru", graphics_memory_limit), _sampler_object_lru("sampler_object_lru", sampler_object_limit) { @@ -121,6 +122,16 @@ PreparedGraphicsObjects:: delete ibc; } _released_index_buffers.clear(); + + release_all_shader_buffers(); + Buffers::iterator bci; + for (bci = _released_shader_buffers.begin(); + bci != _released_shader_buffers.end(); + ++bci) { + BufferContext *bc = (BufferContext *)(*bci); + delete bc; + } + _released_shader_buffers.clear(); } /** @@ -167,6 +178,9 @@ show_residency_trackers(ostream &out) const { out << "\nIndex buffers:\n"; _ibuffer_residency.write(out, 2); + + out << "\nShader buffers:\n"; + _sbuffer_residency.write(out, 2); } /** @@ -1195,6 +1209,155 @@ prepare_index_buffer_now(GeomPrimitive *data, GraphicsStateGuardianBase *gsg) { return ibc; } +/** + * Indicates that a buffer would like to be put on the list to be prepared + * when the GSG is next ready to do this (presumably at the next frame). + */ +void PreparedGraphicsObjects:: +enqueue_shader_buffer(ShaderBuffer *data) { + ReMutexHolder holder(_lock); + + _enqueued_shader_buffers.insert(data); +} + +/** + * Returns true if the index buffer has been queued on this GSG, false + * otherwise. + */ +bool PreparedGraphicsObjects:: +is_shader_buffer_queued(const ShaderBuffer *data) const { + ReMutexHolder holder(_lock); + + EnqueuedShaderBuffers::const_iterator qi = _enqueued_shader_buffers.find((ShaderBuffer *)data); + return (qi != _enqueued_shader_buffers.end()); +} + +/** + * Removes a buffer from the queued list of data arrays to be prepared. + * Normally it is not necessary to call this, unless you change your mind + * about preparing it at the last minute, since the data will automatically be + * dequeued and prepared at the next frame. + * + * The return value is true if the buffer is successfully dequeued, false if + * it had not been queued. + */ +bool PreparedGraphicsObjects:: +dequeue_shader_buffer(ShaderBuffer *data) { + ReMutexHolder holder(_lock); + + EnqueuedShaderBuffers::iterator qi = _enqueued_shader_buffers.find(data); + if (qi != _enqueued_shader_buffers.end()) { + _enqueued_shader_buffers.erase(qi); + return true; + } + return false; +} + +/** + * Returns true if the index buffer has been prepared on this GSG, false + * otherwise. + */ +bool PreparedGraphicsObjects:: +is_shader_buffer_prepared(const ShaderBuffer *data) const { + return data->is_prepared((PreparedGraphicsObjects *)this); +} + +/** + * Indicates that a data context, created by a previous call to + * prepare_shader_buffer(), is no longer needed. The driver resources will not + * be freed until some GSG calls update(), indicating it is at a stage where + * it is ready to release datas--this prevents conflicts from threading or + * multiple GSG's sharing datas (we have no way of knowing which graphics + * context is currently active, or what state it's in, at the time + * release_shader_buffer is called). + */ +void PreparedGraphicsObjects:: +release_shader_buffer(BufferContext *bc) { + ReMutexHolder holder(_lock); + + bool removed = (_prepared_shader_buffers.erase(bc) != 0); + nassertv(removed); + + _released_shader_buffers.insert(bc); +} + +/** + * Releases all datas at once. This will force them to be reloaded into data + * memory for all GSG's that share this object. Returns the number of datas + * released. + */ +int PreparedGraphicsObjects:: +release_all_shader_buffers() { + ReMutexHolder holder(_lock); + + int num_shader_buffers = (int)_prepared_shader_buffers.size() + (int)_enqueued_shader_buffers.size(); + + Buffers::iterator bci; + for (bci = _prepared_shader_buffers.begin(); + bci != _prepared_shader_buffers.end(); + ++bci) { + + BufferContext *bc = (BufferContext *)(*bci); + _released_shader_buffers.insert(bc); + } + + _prepared_shader_buffers.clear(); + _enqueued_shader_buffers.clear(); + + return num_shader_buffers; +} + +/** + * Returns the number of index buffers that have been enqueued to be prepared + * on this GSG. + */ +int PreparedGraphicsObjects:: +get_num_queued_shader_buffers() const { + return _enqueued_shader_buffers.size(); +} + +/** + * Returns the number of index buffers that have already been prepared on this + * GSG. + */ +int PreparedGraphicsObjects:: +get_num_prepared_shader_buffers() const { + return _prepared_shader_buffers.size(); +} + +/** + * Immediately creates a new BufferContext for the indicated data and + * returns it. This assumes that the GraphicsStateGuardian is the currently + * active rendering context and that it is ready to accept new datas. If this + * is not necessarily the case, you should use enqueue_shader_buffer() instead. + * + * Normally, this function is not called directly. Call Data::prepare_now() + * instead. + * + * The BufferContext contains all of the pertinent information needed by + * the GSG to keep track of this one particular data, and will exist as long + * as the data is ready to be rendered. + * + * When either the Data or the PreparedGraphicsObjects object destructs, the + * BufferContext will be deleted. + */ +BufferContext *PreparedGraphicsObjects:: +prepare_shader_buffer_now(ShaderBuffer *data, GraphicsStateGuardianBase *gsg) { + ReMutexHolder holder(_lock); + + // Ask the GSG to create a brand new BufferContext. There might be + // several GSG's sharing the same set of datas; if so, it doesn't matter + // which of them creates the context (since they're all shared anyway). + BufferContext *bc = gsg->prepare_shader_buffer(data); + + if (bc != (BufferContext *)NULL) { + bool prepared = _prepared_shader_buffers.insert(bc).second; + nassertr(prepared, bc); + } + + return bc; +} + /** * This is called by the GraphicsStateGuardian to indicate that it is about to * begin processing of the frame. @@ -1276,6 +1439,7 @@ begin_frame(GraphicsStateGuardianBase *gsg, Thread *current_thread) { _texture_residency.begin_frame(current_thread); _vbuffer_residency.begin_frame(current_thread); _ibuffer_residency.begin_frame(current_thread); + _sbuffer_residency.begin_frame(current_thread); // Now prepare all the textures, geoms, and buffers awaiting preparation. EnqueuedTextures::iterator qti; @@ -1359,6 +1523,7 @@ end_frame(Thread *current_thread) { _texture_residency.end_frame(current_thread); _vbuffer_residency.end_frame(current_thread); _ibuffer_residency.end_frame(current_thread); + _sbuffer_residency.end_frame(current_thread); } /** diff --git a/panda/src/gobj/preparedGraphicsObjects.h b/panda/src/gobj/preparedGraphicsObjects.h index cc138576de..1dbde2d305 100644 --- a/panda/src/gobj/preparedGraphicsObjects.h +++ b/panda/src/gobj/preparedGraphicsObjects.h @@ -22,6 +22,7 @@ #include "geomVertexArrayData.h" #include "geomPrimitive.h" #include "shader.h" +#include "shaderBuffer.h" #include "pointerTo.h" #include "pStatCollector.h" #include "pset.h" @@ -35,6 +36,7 @@ class GeomContext; class ShaderContext; class VertexBufferContext; class IndexBufferContext; +class BufferContext; class GraphicsStateGuardianBase; /** @@ -142,6 +144,19 @@ PUBLISHED: prepare_index_buffer_now(GeomPrimitive *data, GraphicsStateGuardianBase *gsg); + void enqueue_shader_buffer(ShaderBuffer *data); + bool is_shader_buffer_queued(const ShaderBuffer *data) const; + bool dequeue_shader_buffer(ShaderBuffer *data); + bool is_shader_buffer_prepared(const ShaderBuffer *data) const; + void release_shader_buffer(BufferContext *bc); + int release_all_shader_buffers(); + int get_num_queued_shader_buffers() const; + int get_num_prepared_shader_buffers() const; + + BufferContext * + prepare_shader_buffer_now(ShaderBuffer *data, + GraphicsStateGuardianBase *gsg); + public: void begin_frame(GraphicsStateGuardianBase *gsg, Thread *current_thread); @@ -160,6 +175,7 @@ private: typedef phash_set Buffers; typedef phash_set< PT(GeomVertexArrayData) > EnqueuedVertexBuffers; typedef phash_set< PT(GeomPrimitive) > EnqueuedIndexBuffers; + typedef phash_set< PT(ShaderBuffer) > EnqueuedShaderBuffers; // Sampler states are stored a little bit differently, as they are mapped by // value and can't store the list of prepared samplers. @@ -207,6 +223,8 @@ private: EnqueuedVertexBuffers _enqueued_vertex_buffers; Buffers _prepared_index_buffers, _released_index_buffers; EnqueuedIndexBuffers _enqueued_index_buffers; + Buffers _prepared_shader_buffers, _released_shader_buffers; + EnqueuedShaderBuffers _enqueued_shader_buffers; BufferCache _vertex_buffer_cache; BufferCacheLRU _vertex_buffer_cache_lru; @@ -220,6 +238,7 @@ public: BufferResidencyTracker _texture_residency; BufferResidencyTracker _vbuffer_residency; BufferResidencyTracker _ibuffer_residency; + BufferResidencyTracker _sbuffer_residency; AdaptiveLru _graphics_memory_lru; SimpleLru _sampler_object_lru; diff --git a/panda/src/gobj/shaderBuffer.I b/panda/src/gobj/shaderBuffer.I new file mode 100644 index 0000000000..eb51f42f4e --- /dev/null +++ b/panda/src/gobj/shaderBuffer.I @@ -0,0 +1,63 @@ +/** + * 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 shaderBuffer.I + * @author rdb + * @date 2016-12-12 + */ + +/** + * Creates an uninitialized buffer object with the given size. For now, these + * parameters cannot be modified, but this may change in the future. + */ +INLINE ShaderBuffer:: +ShaderBuffer(const string &name, uint64_t size, UsageHint usage_hint) : + Namable(name), + _data_size_bytes(size), + _usage_hint(usage_hint) { +} + +/** + * Creates a buffer object initialized with the given data. For now, these + * parameters cannot be modified, but this may change in the future. + */ +INLINE ShaderBuffer:: +ShaderBuffer(const string &name, pvector initial_data, UsageHint usage_hint) : + Namable(name), + _data_size_bytes(initial_data.size()), + _usage_hint(usage_hint), + _initial_data(initial_data) { +} + +/** + * Returns the buffer size in bytes. + */ +INLINE uint64_t ShaderBuffer:: +get_data_size_bytes() const { + return _data_size_bytes; +} + +/** + * Returns the buffer usage hint. + */ +INLINE GeomEnums::UsageHint ShaderBuffer:: +get_usage_hint() const { + return _usage_hint; +} + +/** + * Returns a pointer to the initial buffer data, or NULL if not specified. + */ +INLINE const unsigned char *ShaderBuffer:: +get_initial_data() const { + if (_initial_data.empty()) { + return NULL; + } else { + return &_initial_data[0]; + } +} diff --git a/panda/src/gobj/shaderBuffer.cxx b/panda/src/gobj/shaderBuffer.cxx new file mode 100644 index 0000000000..a7cd5f8150 --- /dev/null +++ b/panda/src/gobj/shaderBuffer.cxx @@ -0,0 +1,193 @@ +/** + * 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 shaderBuffer.cxx + * @author rdb + * @date 2016-12-12 + */ + +#include "shaderBuffer.h" +#include "preparedGraphicsObjects.h" + +TypeHandle ShaderBuffer::_type_handle; + +/** + * + */ +void ShaderBuffer:: +output(ostream &out) const { + out << "buffer " << get_name() << ", " << _data_size_bytes << "B, " << _usage_hint; +} + +/** + * Indicates that the data should be enqueued to be prepared in the indicated + * prepared_objects at the beginning of the next frame. This will ensure the + * data is already loaded into the GSG if it is expected to be rendered soon. + * + * Use this function instead of prepare_now() to preload datas from a user + * interface standpoint. + */ +void ShaderBuffer:: +prepare(PreparedGraphicsObjects *prepared_objects) { + prepared_objects->enqueue_shader_buffer(this); +} + +/** + * Returns true if the data has already been prepared or enqueued for + * preparation on the indicated GSG, false otherwise. + */ +bool ShaderBuffer:: +is_prepared(PreparedGraphicsObjects *prepared_objects) const { + if (_contexts == (Contexts *)NULL) { + return false; + } + Contexts::const_iterator ci; + ci = _contexts->find(prepared_objects); + if (ci != _contexts->end()) { + return true; + } + return prepared_objects->is_shader_buffer_queued(this); +} + +/** + * Creates a context for the data on the particular GSG, if it does not + * already exist. Returns the new (or old) BufferContext. This assumes + * that the GraphicsStateGuardian is the currently active rendering context + * and that it is ready to accept new datas. If this is not necessarily the + * case, you should use prepare() instead. + * + * Normally, this is not called directly except by the GraphicsStateGuardian; + * a data does not need to be explicitly prepared by the user before it may be + * rendered. + */ +BufferContext *ShaderBuffer:: +prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) { + if (_contexts == (Contexts *)NULL) { + _contexts = new Contexts; + } + Contexts::const_iterator ci; + ci = _contexts->find(prepared_objects); + if (ci != _contexts->end()) { + return (*ci).second; + } + + BufferContext *vbc = prepared_objects->prepare_shader_buffer_now(this, gsg); + if (vbc != (BufferContext *)NULL) { + (*_contexts)[prepared_objects] = vbc; + } + return vbc; +} + +/** + * Frees the data context only on the indicated object, if it exists there. + * Returns true if it was released, false if it had not been prepared. + */ +bool ShaderBuffer:: +release(PreparedGraphicsObjects *prepared_objects) { + if (_contexts != (Contexts *)NULL) { + Contexts::iterator ci; + ci = _contexts->find(prepared_objects); + if (ci != _contexts->end()) { + BufferContext *vbc = (*ci).second; + prepared_objects->release_shader_buffer(vbc); + return true; + } + } + + // Maybe it wasn't prepared yet, but it's about to be. + return prepared_objects->dequeue_shader_buffer(this); +} + +/** + * Frees the context allocated on all objects for which the data has been + * declared. Returns the number of contexts which have been freed. + */ +int ShaderBuffer:: +release_all() { + int num_freed = 0; + + if (_contexts != (Contexts *)NULL) { + // We have to traverse a copy of the _contexts list, because the + // PreparedGraphicsObjects object will call clear_prepared() in response + // to each release_shader_buffer(), and we don't want to be modifying the + // _contexts list while we're traversing it. + Contexts temp = *_contexts; + num_freed = (int)_contexts->size(); + + Contexts::const_iterator ci; + for (ci = temp.begin(); ci != temp.end(); ++ci) { + PreparedGraphicsObjects *prepared_objects = (*ci).first; + BufferContext *vbc = (*ci).second; + prepared_objects->release_shader_buffer(vbc); + } + + // Now that we've called release_shader_buffer() on every known context, + // the _contexts list should have completely emptied itself. + nassertr(_contexts == NULL, num_freed); + } + + return num_freed; +} + +/** + * Tells the BamReader how to create objects of type ParamValue. + */ +void ShaderBuffer:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +/** + * Writes the contents of this object to the datagram for shipping out to a + * Bam file. + */ +void ShaderBuffer:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_string(get_name()); + dg.add_uint64(_data_size_bytes); + dg.add_uint8(_usage_hint); + dg.add_bool(!_initial_data.empty()); + dg.append_data(_initial_data.data(), _initial_data.size()); +} + +/** + * This function is called by the BamReader's factory when a new object of + * type ParamValue is encountered in the Bam file. It should create the + * ParamValue and extract its information from the file. + */ +TypedWritable *ShaderBuffer:: +make_from_bam(const FactoryParams ¶ms) { + ShaderBuffer *param = new ShaderBuffer; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +/** + * This internal function is called by make_from_bam to read in all of the + * relevant data from the BamFile for the new ParamValue. + */ +void ShaderBuffer:: +fillin(DatagramIterator &scan, BamReader *manager) { + set_name(scan.get_string()); + _data_size_bytes = scan.get_uint64(); + _usage_hint = (UsageHint)scan.get_uint8(); + + if (scan.get_bool() && _data_size_bytes > 0) { + nassertv_always(_data_size_bytes <= scan.get_remaining_size()); + _initial_data.resize(_data_size_bytes); + scan.extract_bytes(&_initial_data[0], _data_size_bytes); + } else { + _initial_data.clear(); + } +} diff --git a/panda/src/gobj/shaderBuffer.h b/panda/src/gobj/shaderBuffer.h new file mode 100644 index 0000000000..5faa4322ac --- /dev/null +++ b/panda/src/gobj/shaderBuffer.h @@ -0,0 +1,97 @@ +/** + * 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 shaderBuffer.h + * @author rdb + * @date 2016-12-12 + */ + +#ifndef SHADERBUFFER_H +#define SHADERBUFFER_H + +#include "pandabase.h" +#include "namable.h" +#include "geomEnums.h" + +class BufferContext; +class PreparedGraphicsObjects; + +/** + * This is a generic buffer object that lives in graphics memory. + */ +class EXPCL_PANDA_GOBJ ShaderBuffer : public TypedWritableReferenceCount, public Namable, public GeomEnums { +private: + INLINE ShaderBuffer() DEFAULT_CTOR; + +PUBLISHED: + INLINE ShaderBuffer(const string &name, uint64_t size, UsageHint usage_hint); + INLINE ShaderBuffer(const string &name, pvector initial_data, UsageHint usage_hint); + +public: + INLINE uint64_t get_data_size_bytes() const; + INLINE UsageHint get_usage_hint() const; + INLINE const unsigned char *get_initial_data() const; + + virtual void output(ostream &out) const; + +PUBLISHED: + MAKE_PROPERTY(data_size_bytes, get_data_size_bytes); + MAKE_PROPERTY(usage_hint, get_usage_hint); + + void prepare(PreparedGraphicsObjects *prepared_objects); + bool is_prepared(PreparedGraphicsObjects *prepared_objects) const; + + BufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg); + bool release(PreparedGraphicsObjects *prepared_objects); + int release_all(); + +private: + uint64_t _data_size_bytes; + UsageHint _usage_hint; + pvector _initial_data; + + typedef pmap Contexts; + Contexts *_contexts; + +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + +public: + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + TypedWritableReferenceCount::init_type(); + Namable::init_type(); + register_type(_type_handle, "ShaderBuffer", + TypedWritableReferenceCount::get_class_type(), + Namable::get_class_type()); + } + +private: + static TypeHandle _type_handle; +}; + +INLINE ostream &operator << (ostream &out, const ShaderBuffer &m) { + m.output(out); + return out; +} + +#include "shaderBuffer.I" + +#endif diff --git a/panda/src/gobj/shaderContext.h b/panda/src/gobj/shaderContext.h index 2b356cef8f..7a5312faa2 100644 --- a/panda/src/gobj/shaderContext.h +++ b/panda/src/gobj/shaderContext.h @@ -42,6 +42,7 @@ public: INLINE virtual bool update_shader_vertex_arrays(ShaderContext *prev, bool force) { return false; }; INLINE virtual void disable_shader_texture_bindings() {}; INLINE virtual void update_shader_texture_bindings(ShaderContext *prev) {}; + INLINE virtual void update_shader_buffer_bindings(ShaderContext *prev) {}; INLINE virtual bool uses_standard_vertex_arrays(void) { return true; }; INLINE virtual bool uses_custom_vertex_arrays(void) { return false; }; diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.h b/panda/src/gsgbase/graphicsStateGuardianBase.h index 90455869ac..c45f36aca0 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.h +++ b/panda/src/gsgbase/graphicsStateGuardianBase.h @@ -31,6 +31,7 @@ class GraphicsOutputBase; class VertexBufferContext; class IndexBufferContext; +class BufferContext; class GeomContext; class GeomNode; class Geom; @@ -57,6 +58,7 @@ class SamplerContext; class SamplerState; class Shader; class ShaderContext; +class ShaderBuffer; class RenderState; class TransformState; class Material; @@ -162,6 +164,9 @@ public: virtual IndexBufferContext *prepare_index_buffer(GeomPrimitive *data)=0; virtual void release_index_buffer(IndexBufferContext *ibc)=0; + virtual BufferContext *prepare_shader_buffer(ShaderBuffer *data)=0; + virtual void release_shader_buffer(BufferContext *ibc)=0; + virtual void dispatch_compute(int size_x, int size_y, int size_z)=0; virtual PT(GeomMunger) get_geom_munger(const RenderState *state, diff --git a/panda/src/pgraph/nodePath.I b/panda/src/pgraph/nodePath.I index 1e9813debc..cfcef09112 100644 --- a/panda/src/pgraph/nodePath.I +++ b/panda/src/pgraph/nodePath.I @@ -1253,6 +1253,14 @@ set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z set_shader_input(new ShaderInput(id, tex, read, write, z, n, priority)); } +/** + * + */ +INLINE void NodePath:: +set_shader_input(CPT_InternalName id, ShaderBuffer *buf, int priority) { + set_shader_input(new ShaderInput(id, buf, priority)); +} + /** * */ diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index a30fc1d40d..1bbe0845cf 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -61,6 +61,7 @@ class GlobPattern; class PreparedGraphicsObjects; class SamplerState; class Shader; +class ShaderBuffer; class ShaderInput; // @@ -632,6 +633,7 @@ PUBLISHED: INLINE void set_shader_input(CPT_InternalName id, Texture *tex, int priority=0); INLINE void set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority=0); INLINE void set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0); + INLINE void set_shader_input(CPT_InternalName id, ShaderBuffer *buf, int priority=0); INLINE void set_shader_input(CPT_InternalName id, const NodePath &np, int priority=0); INLINE void set_shader_input(CPT_InternalName id, const PTA_float &v, int priority=0); INLINE void set_shader_input(CPT_InternalName id, const PTA_double &v, int priority=0); diff --git a/panda/src/pgraph/shaderAttrib.cxx b/panda/src/pgraph/shaderAttrib.cxx index 93ccf45bc2..758d980a50 100644 --- a/panda/src/pgraph/shaderAttrib.cxx +++ b/panda/src/pgraph/shaderAttrib.cxx @@ -25,6 +25,7 @@ #include "datagram.h" #include "datagramIterator.h" #include "nodePath.h" +#include "shaderBuffer.h" TypeHandle ShaderAttrib::_type_handle; int ShaderAttrib::_attrib_slot; @@ -461,6 +462,34 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const { } } +/** + * Returns the ShaderInput as a ShaderBuffer. Assertion fails if there is + * none, or if it is not a ShaderBuffer. + */ +ShaderBuffer *ShaderAttrib:: +get_shader_input_buffer(const InternalName *id) const { + Inputs::const_iterator i = _inputs.find(id); + if (i == _inputs.end()) { + ostringstream strm; + strm << "Shader input " << id->get_name() << " is not present.\n"; + nassert_raise(strm.str()); + return NULL; + } else { + const ShaderInput *p = (*i).second; + + if (p->get_value_type() == ShaderInput::M_buffer) { + ShaderBuffer *value; + DCAST_INTO_R(value, p->_value, NULL); + return value; + } + + ostringstream strm; + strm << "Shader input " << id->get_name() << " is not a ShaderBuffer.\n"; + nassert_raise(strm.str()); + return NULL; + } +} + /** * Returns the shader object associated with the node. If get_override * returns true, but get_shader returns NULL, that means that this attribute diff --git a/panda/src/pgraph/shaderAttrib.h b/panda/src/pgraph/shaderAttrib.h index 08676286f5..5a28e929b1 100644 --- a/panda/src/pgraph/shaderAttrib.h +++ b/panda/src/pgraph/shaderAttrib.h @@ -111,6 +111,7 @@ PUBLISHED: Texture *get_shader_input_texture(const InternalName *id, SamplerState *sampler=NULL) const; const Shader::ShaderPtrData *get_shader_input_ptr(const InternalName *id) const; const LMatrix4 &get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const; + ShaderBuffer *get_shader_input_buffer(const InternalName *id) const; static void register_with_read_factory(); diff --git a/panda/src/pgraph/shaderInput.I b/panda/src/pgraph/shaderInput.I index 52f46369ad..7344717e47 100644 --- a/panda/src/pgraph/shaderInput.I +++ b/panda/src/pgraph/shaderInput.I @@ -55,6 +55,18 @@ ShaderInput(CPT_InternalName name, ParamValueBase *param, int priority) : { } +/** + * + */ +INLINE ShaderInput:: +ShaderInput(CPT_InternalName name, ShaderBuffer *buf, int priority) : + _name(MOVE(name)), + _type(M_buffer), + _priority(priority), + _value(buf) +{ +} + /** * */ diff --git a/panda/src/pgraph/shaderInput.h b/panda/src/pgraph/shaderInput.h index 260d5a6ab1..c91c790618 100644 --- a/panda/src/pgraph/shaderInput.h +++ b/panda/src/pgraph/shaderInput.h @@ -31,6 +31,7 @@ #include "samplerState.h" #include "shader.h" #include "texture.h" +#include "shaderBuffer.h" /** * This is a small container class that can hold any one of the value types @@ -52,6 +53,7 @@ PUBLISHED: INLINE ShaderInput(CPT_InternalName name, int priority=0); INLINE ShaderInput(CPT_InternalName name, Texture *tex, int priority=0); INLINE ShaderInput(CPT_InternalName name, ParamValueBase *param, int priority=0); + INLINE ShaderInput(CPT_InternalName name, ShaderBuffer *buf, int priority=0); INLINE ShaderInput(CPT_InternalName name, const PTA_float &ptr, int priority=0); INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase4f &ptr, int priority=0); INLINE ShaderInput(CPT_InternalName name, const PTA_LVecBase3f &ptr, int priority=0); @@ -96,7 +98,8 @@ PUBLISHED: M_numeric, M_texture_sampler, M_param, - M_texture_image + M_texture_image, + M_buffer, }; INLINE const InternalName *get_name() const; @@ -123,6 +126,8 @@ private: int _priority; int _type; + friend class ShaderAttrib; + public: static TypeHandle get_class_type() { return _type_handle; From b6cb9b004506cb3d00db22fd276d288c2eabbf8a Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 17 Dec 2016 00:17:30 +0100 Subject: [PATCH 57/93] ffmpeg: support videos with alpha; add ffmpeg-prefer-libvpx prc var ffmpeg-prefer-libvpx forces ffmpeg to use the libvpx decoder for VP8/VP9 files, allowing the playback of WebM files with an alpha channel. --- panda/src/ffmpeg/config_ffmpeg.cxx | 8 ++++ panda/src/ffmpeg/config_ffmpeg.h | 1 + panda/src/ffmpeg/ffmpegVideoCursor.cxx | 61 ++++++++++++++++++-------- panda/src/ffmpeg/ffmpegVideoCursor.h | 1 + 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/panda/src/ffmpeg/config_ffmpeg.cxx b/panda/src/ffmpeg/config_ffmpeg.cxx index 115b3c31c3..f0d6a5518e 100644 --- a/panda/src/ffmpeg/config_ffmpeg.cxx +++ b/panda/src/ffmpeg/config_ffmpeg.cxx @@ -76,6 +76,14 @@ ConfigVariableInt ffmpeg_read_buffer_size "This is important for performance. A typical size is that of a " "cache page, e.g. 4kb.")); +ConfigVariableBool ffmpeg_prefer_libvpx +("ffmpeg-prefer-libvpx", false, + PRC_DESC("If this is true, Panda will overrule ffmpeg's best judgment on " + "which decoder to use for decoding VP8 and VP9 files, and try to " + "choose libvpx. This is useful when you want to play WebM videos " + "with an alpha channel, which aren't supported by ffmpeg's own " + "VP8/VP9 decoders.")); + /** * Initializes the library. This must be called at least once before any of * the functions or classes in this library can be used. Normally it will be diff --git a/panda/src/ffmpeg/config_ffmpeg.h b/panda/src/ffmpeg/config_ffmpeg.h index 58f81af821..c3854fc9e1 100644 --- a/panda/src/ffmpeg/config_ffmpeg.h +++ b/panda/src/ffmpeg/config_ffmpeg.h @@ -31,6 +31,7 @@ extern ConfigVariableBool ffmpeg_support_seek; extern ConfigVariableBool ffmpeg_global_lock; extern ConfigVariableEnum ffmpeg_thread_priority; extern ConfigVariableInt ffmpeg_read_buffer_size; +extern ConfigVariableBool ffmpeg_prefer_libvpx; extern EXPCL_FFMPEG void init_libffmpeg(); diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 8affe3c116..1829e003de 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -22,6 +22,7 @@ extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" + #include "libavutil/pixdesc.h" #ifdef HAVE_SWSCALE #include "libswscale/swscale.h" #endif @@ -35,11 +36,16 @@ PStatCollector FfmpegVideoCursor::_fetch_buffer_pcollector("*:FFMPEG Video Decod PStatCollector FfmpegVideoCursor::_seek_pcollector("*:FFMPEG Video Decoding:Seek"); PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Video to BGR"); - #if LIBAVFORMAT_VERSION_MAJOR < 53 #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO #endif +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) +#define AV_PIX_FMT_NONE PIX_FMT_NONE +#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 +#define AV_PIX_FMT_BGRA PIX_FMT_BGRA +#endif + /** * This constructor is only used when reading from a bam file. */ @@ -55,6 +61,7 @@ FfmpegVideoCursor() : _format_ctx(NULL), _video_ctx(NULL), _convert_ctx(NULL), + _pixel_format(AV_PIX_FMT_NONE), _video_index(-1), _frame(NULL), _frame_out(NULL), @@ -80,17 +87,6 @@ init_from(FfmpegVideo *source) { ReMutexHolder av_holder(_av_lock); -#ifdef HAVE_SWSCALE - nassertv(_convert_ctx == NULL); - _convert_ctx = sws_getContext(_size_x, _size_y, _video_ctx->pix_fmt, -#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 74, 100) - _size_x, _size_y, AV_PIX_FMT_BGR24, -#else - _size_x, _size_y, PIX_FMT_BGR24, -#endif - SWS_BILINEAR | SWS_PRINT_INFO, NULL, NULL, NULL); -#endif // HAVE_SWSCALE - #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 59, 100) _frame = av_frame_alloc(); _frame_out = av_frame_alloc(); @@ -115,6 +111,25 @@ init_from(FfmpegVideo *source) { _eof_known = false; _eof_frame = 0; + // Check if we got an alpha format. Please note that some video codecs + // (eg. libvpx) change the pix_fmt after decoding the first frame, which is + // why we didn't do this earlier. + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(_video_ctx->pix_fmt); + if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) { + _num_components = 4; + _pixel_format = AV_PIX_FMT_BGRA; + } else { + _num_components = 3; + _pixel_format = AV_PIX_FMT_BGR24; + } + +#ifdef HAVE_SWSCALE + nassertv(_convert_ctx == NULL); + _convert_ctx = sws_getContext(_size_x, _size_y, _video_ctx->pix_fmt, + _size_x, _size_y, _pixel_format, + SWS_BILINEAR | SWS_PRINT_INFO, NULL, NULL, NULL); +#endif // HAVE_SWSCALE + #ifdef HAVE_THREADS set_max_readahead_frames(ffmpeg_max_readahead_frames); #endif // HAVE_THREADS @@ -495,7 +510,17 @@ open_stream() { return false; } - AVCodec *pVideoCodec = avcodec_find_decoder(_video_ctx->codec_id); + AVCodec *pVideoCodec = NULL; + if (ffmpeg_prefer_libvpx) { + if (_video_ctx->codec_id == AV_CODEC_ID_VP9) { + pVideoCodec = avcodec_find_decoder_by_name("libvpx-vp9"); + } else if (_video_ctx->codec_id == AV_CODEC_ID_VP8) { + pVideoCodec = avcodec_find_decoder_by_name("libvpx"); + } + } + if (pVideoCodec == NULL) { + pVideoCodec = avcodec_find_decoder(_video_ctx->codec_id); + } if (pVideoCodec == NULL) { ffmpeg_cat.info() << "Couldn't find codec\n"; @@ -515,7 +540,7 @@ open_stream() { _size_x = _video_ctx->width; _size_y = _video_ctx->height; - _num_components = 3; // Don't know how to implement RGBA movies yet. + _num_components = 3; _length = (double)_format_ctx->duration / (double)AV_TIME_BASE; _can_seek = true; _can_seek_fast = true; @@ -1075,8 +1100,8 @@ export_frame(FfmpegBuffer *buffer) { return; } - _frame_out->data[0] = buffer->_block + ((_size_y - 1) * _size_x * 3); - _frame_out->linesize[0] = _size_x * -3; + _frame_out->data[0] = buffer->_block + ((_size_y - 1) * _size_x * _num_components); + _frame_out->linesize[0] = _size_x * -_num_components; buffer->_begin_frame = _begin_frame; buffer->_end_frame = _end_frame; @@ -1086,7 +1111,7 @@ export_frame(FfmpegBuffer *buffer) { nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL); sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize); #else - img_convert((AVPicture *)_frame_out, PIX_FMT_BGR24, + img_convert((AVPicture *)_frame_out, _pixel_format, (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y); #endif } else { @@ -1094,7 +1119,7 @@ export_frame(FfmpegBuffer *buffer) { nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL); sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize); #else - img_convert((AVPicture *)_frame_out, PIX_FMT_BGR24, + img_convert((AVPicture *)_frame_out, _pixel_format, (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y); #endif } diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.h b/panda/src/ffmpeg/ffmpegVideoCursor.h index a44ec57490..199b533f47 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.h +++ b/panda/src/ffmpeg/ffmpegVideoCursor.h @@ -104,6 +104,7 @@ private: int _max_readahead_frames; ThreadPriority _thread_priority; PT(GenericThread) _thread; + AVPixelFormat _pixel_format; // This global Mutex protects calls to avcodec_opencloseetc. static ReMutex _av_lock; From da0d7752c1701f7416a45aaeeeb8bb102a811b70 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 18 Dec 2016 00:08:59 +0100 Subject: [PATCH 58/93] Register .webm extension for videos --- panda/src/grutil/config_grutil.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/grutil/config_grutil.cxx b/panda/src/grutil/config_grutil.cxx index 5564a3719d..94613f4da6 100644 --- a/panda/src/grutil/config_grutil.cxx +++ b/panda/src/grutil/config_grutil.cxx @@ -131,6 +131,6 @@ init_libgrutil() { MovieTexture::register_with_read_factory(); TexturePool *ts = TexturePool::get_global_ptr(); - ts->register_texture_type(MovieTexture::make_texture, "avi m2v mov mpg mpeg mp4 wmv asf flv nut ogm mkv ogv"); + ts->register_texture_type(MovieTexture::make_texture, "avi m2v mov mpg mpeg mp4 wmv asf flv nut ogm mkv ogv webm"); #endif } From 36f2eda9ecf9a84fbdd8b8a27adb0b757818c223 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 18 Dec 2016 00:12:26 +0100 Subject: [PATCH 59/93] Fix name of "Buffer switch" pcollector in pStatProperties.cxx --- panda/src/pstatclient/pStatProperties.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panda/src/pstatclient/pStatProperties.cxx b/panda/src/pstatclient/pStatProperties.cxx index ca8c7c8ead..7b14891daa 100644 --- a/panda/src/pstatclient/pStatProperties.cxx +++ b/panda/src/pstatclient/pStatProperties.cxx @@ -151,9 +151,9 @@ static TimeCollectorProperties time_properties[] = { static LevelCollectorProperties level_properties[] = { { 1, "Graphics memory", { 0.0, 0.0, 1.0 }, "MB", 64, 1048576 }, - { 1, "Vertex buffer switch", { 0.0, 0.6, 0.8 }, "", 500 }, - { 1, "Vertex buffer switch:Vertex", { 0.8, 0.0, 0.6 } }, - { 1, "Vertex buffer switch:Index", { 0.8, 0.6, 0.3 } }, + { 1, "Buffer switch", { 0.0, 0.6, 0.8 }, "", 500 }, + { 1, "Buffer switch:Vertex", { 0.8, 0.0, 0.6 } }, + { 1, "Buffer switch:Index", { 0.8, 0.6, 0.3 } }, { 1, "Geom cache size", { 0.6, 0.8, 0.6 }, "", 500 }, { 1, "Geom cache size:Active", { 0.9, 1.0, 0.3 }, "", 500 }, { 1, "Geom cache operations", { 1.0, 0.6, 0.6 }, "", 500 }, From 4b5c31716036258f421bd783faaac16e7fdf3ccb Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Dec 2016 22:26:16 +0100 Subject: [PATCH 60/93] Improve shader caching; cache result of preprocess if cache-generated-shaders is set --- panda/src/gobj/shader.cxx | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index e067c18582..306f76f6f8 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2380,6 +2380,12 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { _last_modified = max(_last_modified, vf->get_timestamp()); _source_files.push_back(vf->get_filename()); } + + // Strip trailing whitespace. + while (isspace(into[into.size() - 1])) { + into.resize(into.size() - 1); + } + return true; } @@ -2521,6 +2527,11 @@ r_preprocess_source(ostream &out, const Filename &fn, line += line2.substr(block_end + 2); } + // Strip trailing whitespace. + while (isspace(line[line.size() - 1])) { + line.resize(line.size() - 1); + } + // Check if this line contains a #directive. char directive[64]; if (line.size() < 8 || sscanf(line.c_str(), " # %63s", directive) != 1) { @@ -2940,6 +2951,14 @@ load(const Filename &file, ShaderLanguage lang) { } _load_table[sfile] = shader; + + if (cache_generated_shaders) { + ShaderTable::const_iterator i = _make_table.find(shader->_text); + if (i != _make_table.end() && (lang == SL_none || lang == i->second->_language)) { + return i->second; + } + _make_table[shader->_text] = shader; + } return shader; } @@ -2970,6 +2989,14 @@ load(ShaderLanguage lang, const Filename &vertex, } _load_table[sfile] = shader; + + if (cache_generated_shaders) { + ShaderTable::const_iterator i = _make_table.find(shader->_text); + if (i != _make_table.end() && (lang == SL_none || lang == i->second->_language)) { + return i->second; + } + _make_table[shader->_text] = shader; + } return shader; } @@ -3025,14 +3052,21 @@ load_compute(ShaderLanguage lang, const Filename &fn) { if (!shader->read(sfile, record)) { return NULL; } + _load_table[sfile] = shader; + + if (cache_generated_shaders) { + ShaderTable::const_iterator i = _make_table.find(shader->_text); + if (i != _make_table.end() && (lang == SL_none || lang == i->second->_language)) { + return i->second; + } + _make_table[shader->_text] = shader; + } // It makes little sense to cache the shader before compilation, so we keep // the record for when we have the compiled the shader. swap(shader->_record, record); shader->_cache_compiled_shader = BamCache::get_global_ptr()->get_cache_compiled_shaders(); shader->_fullpath = shader->_source_files[0]; - - _load_table[sfile] = shader; return shader; } @@ -3166,7 +3200,6 @@ make_compute(ShaderLanguage lang, const string &body) { sbody._separate = true; sbody._compute = body; - if (cache_generated_shaders) { ShaderTable::const_iterator i = _make_table.find(sbody); if (i != _make_table.end() && (lang == SL_none || lang == i->second->_language)) { From da79c28a6cbbfc4a42914c6826ecc8985f83e9d3 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Dec 2016 23:29:42 +0100 Subject: [PATCH 61/93] Add RectangleLight class --- panda/src/pgraphnodes/config_pgraphnodes.cxx | 3 + .../pgraphnodes/p3pgraphnodes_composite2.cxx | 1 + panda/src/pgraphnodes/rectangleLight.I | 59 +++++++ panda/src/pgraphnodes/rectangleLight.cxx | 150 ++++++++++++++++++ panda/src/pgraphnodes/rectangleLight.h | 98 ++++++++++++ 5 files changed, 311 insertions(+) create mode 100644 panda/src/pgraphnodes/rectangleLight.I create mode 100644 panda/src/pgraphnodes/rectangleLight.cxx create mode 100644 panda/src/pgraphnodes/rectangleLight.h diff --git a/panda/src/pgraphnodes/config_pgraphnodes.cxx b/panda/src/pgraphnodes/config_pgraphnodes.cxx index 47b0ed3baf..f512110858 100644 --- a/panda/src/pgraphnodes/config_pgraphnodes.cxx +++ b/panda/src/pgraphnodes/config_pgraphnodes.cxx @@ -26,6 +26,7 @@ #include "lodNode.h" #include "nodeCullCallbackData.h" #include "pointLight.h" +#include "rectangleLight.h" #include "selectiveChildNode.h" #include "sequenceNode.h" #include "shaderGenerator.h" @@ -121,6 +122,7 @@ init_libpgraphnodes() { LODNode::init_type(); NodeCullCallbackData::init_type(); PointLight::init_type(); + RectangleLight::init_type(); SelectiveChildNode::init_type(); SequenceNode::init_type(); ShaderGenerator::init_type(); @@ -137,6 +139,7 @@ init_libpgraphnodes() { LightNode::register_with_read_factory(); LODNode::register_with_read_factory(); PointLight::register_with_read_factory(); + RectangleLight::register_with_read_factory(); SelectiveChildNode::register_with_read_factory(); SequenceNode::register_with_read_factory(); SphereLight::register_with_read_factory(); diff --git a/panda/src/pgraphnodes/p3pgraphnodes_composite2.cxx b/panda/src/pgraphnodes/p3pgraphnodes_composite2.cxx index 952a2448c9..4dd4f04bff 100644 --- a/panda/src/pgraphnodes/p3pgraphnodes_composite2.cxx +++ b/panda/src/pgraphnodes/p3pgraphnodes_composite2.cxx @@ -1,5 +1,6 @@ #include "nodeCullCallbackData.cxx" #include "pointLight.cxx" +#include "rectangleLight.cxx" #include "sceneGraphAnalyzer.cxx" #include "selectiveChildNode.cxx" #include "sequenceNode.cxx" diff --git a/panda/src/pgraphnodes/rectangleLight.I b/panda/src/pgraphnodes/rectangleLight.I new file mode 100644 index 0000000000..c97dd536f2 --- /dev/null +++ b/panda/src/pgraphnodes/rectangleLight.I @@ -0,0 +1,59 @@ +/** + * 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 rectangleLight.I + * @author rdb + * @date 2016-12-19 + */ + +/** + * + */ +INLINE RectangleLight::CData:: +CData() : + _max_distance(make_inf((PN_stdfloat)0)) +{ +} + +/** + * + */ +INLINE RectangleLight::CData:: +CData(const RectangleLight::CData ©) : + _max_distance(copy._max_distance) +{ +} + +/** + * Returns the color of specular highlights generated by the light. This is + * usually the same as get_color(). + */ +INLINE const LColor &RectangleLight:: +get_specular_color() const { + return get_color(); +} + +/** + * Returns the maximum distance at which the light has any effect, as previously + * specified by set_max_distance. + */ +INLINE PN_stdfloat RectangleLight:: +get_max_distance() const { + CDReader cdata(_cycler); + return cdata->_max_distance; +} + +/** + * Sets the radius of the light's sphere of influence. Beyond this distance, the + * light may be attenuated to zero, if this is supported by the shader. + */ +INLINE void RectangleLight:: +set_max_distance(PN_stdfloat max_distance) { + CDWriter cdata(_cycler); + cdata->_max_distance = max_distance; +} diff --git a/panda/src/pgraphnodes/rectangleLight.cxx b/panda/src/pgraphnodes/rectangleLight.cxx new file mode 100644 index 0000000000..187d35cd2d --- /dev/null +++ b/panda/src/pgraphnodes/rectangleLight.cxx @@ -0,0 +1,150 @@ +/** + * 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 rectangleLight.cxx + * @author rdb + * @date 2016-12-19 + */ + +#include "rectangleLight.h" +#include "graphicsStateGuardianBase.h" +#include "bamWriter.h" +#include "bamReader.h" +#include "datagram.h" +#include "datagramIterator.h" + +TypeHandle RectangleLight::_type_handle; + +/** + * + */ +CycleData *RectangleLight::CData:: +make_copy() const { + return new CData(*this); +} + +/** + * Writes the contents of this object to the datagram for shipping out to a + * Bam file. + */ +void RectangleLight::CData:: +write_datagram(BamWriter *manager, Datagram &dg) const { + dg.add_stdfloat(_max_distance); +} + +/** + * This internal function is called by make_from_bam to read in all of the + * relevant data from the BamFile for the new Light. + */ +void RectangleLight::CData:: +fillin(DatagramIterator &scan, BamReader *manager) { + _max_distance = scan.get_stdfloat(); +} + +/** + * + */ +RectangleLight:: +RectangleLight(const string &name) : + LightLensNode(name) +{ +} + +/** + * Do not call the copy constructor directly; instead, use make_copy() or + * copy_subgraph() to make a copy of a node. + */ +RectangleLight:: +RectangleLight(const RectangleLight ©) : + LightLensNode(copy), + _cycler(copy._cycler) +{ +} + +/** + * 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 *RectangleLight:: +make_copy() const { + return new RectangleLight(*this); +} + +/** + * + */ +void RectangleLight:: +write(ostream &out, int indent_level) const { + LightLensNode::write(out, indent_level); + indent(out, indent_level) << *this << "\n"; +} + +/** + * Returns the relative priority associated with all lights of this class. + * This priority is used to order lights whose instance priority + * (get_priority()) is the same--the idea is that other things being equal, + * AmbientLights (for instance) are less important than DirectionalLights. + */ +int RectangleLight:: +get_class_priority() const { + return (int)CP_area_priority; +} + +/** + * + */ +void RectangleLight:: +bind(GraphicsStateGuardianBase *gsg, const NodePath &light, int light_id) { +} + +/** + * Tells the BamReader how to create objects of type RectangleLight. + */ +void RectangleLight:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +/** + * Writes the contents of this object to the datagram for shipping out to a + * Bam file. + */ +void RectangleLight:: +write_datagram(BamWriter *manager, Datagram &dg) { + LightLensNode::write_datagram(manager, dg); + manager->write_cdata(dg, _cycler); +} + +/** + * This function is called by the BamReader's factory when a new object of + * type RectangleLight is encountered in the Bam file. It should create the + * RectangleLight and extract its information from the file. + */ +TypedWritable *RectangleLight:: +make_from_bam(const FactoryParams ¶ms) { + RectangleLight *node = new RectangleLight(""); + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + node->fillin(scan, manager); + + return node; +} + +/** + * This internal function is called by make_from_bam to read in all of the + * relevant data from the BamFile for the new RectangleLight. + */ +void RectangleLight:: +fillin(DatagramIterator &scan, BamReader *manager) { + LightLensNode::fillin(scan, manager); + + manager->read_cdata(scan, _cycler); +} diff --git a/panda/src/pgraphnodes/rectangleLight.h b/panda/src/pgraphnodes/rectangleLight.h new file mode 100644 index 0000000000..00d4d586ea --- /dev/null +++ b/panda/src/pgraphnodes/rectangleLight.h @@ -0,0 +1,98 @@ +/** + * 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 rectangleLight.h + * @author rdb + * @date 2016-12-19 + */ + +#ifndef RECTANGLELIGHT_H +#define RECTANGLELIGHT_H + +#include "pandabase.h" + +#include "lightLensNode.h" +#include "pointLight.h" + +/** + * This is a type of area light that is an axis aligned rectangle, pointing + * along the Y axis in the positive direction. + */ +class EXPCL_PANDA_PGRAPHNODES RectangleLight : public LightLensNode { +PUBLISHED: + RectangleLight(const string &name); + +protected: + RectangleLight(const RectangleLight ©); + +public: + virtual PandaNode *make_copy() const; + virtual void write(ostream &out, int indent_level) const; + +PUBLISHED: + INLINE const LColor &get_specular_color() const FINAL; + + INLINE PN_stdfloat get_max_distance() const; + INLINE void set_max_distance(PN_stdfloat max_distance); + MAKE_PROPERTY(max_distance, get_max_distance, set_max_distance); + + virtual int get_class_priority() const; + +public: + virtual void bind(GraphicsStateGuardianBase *gsg, const NodePath &light, + int light_id); + +private: + // This is the data that must be cycled between pipeline stages. + class EXPCL_PANDA_PGRAPHNODES CData : public CycleData { + public: + INLINE CData(); + INLINE CData(const CData ©); + virtual CycleData *make_copy() const; + virtual void write_datagram(BamWriter *manager, Datagram &dg) const; + virtual void fillin(DatagramIterator &scan, BamReader *manager); + virtual TypeHandle get_parent_type() const { + return RectangleLight::get_class_type(); + } + + PN_stdfloat _max_distance; + }; + + PipelineCycler _cycler; + typedef CycleDataReader CDReader; + typedef CycleDataWriter CDWriter; + +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + LightLensNode::init_type(); + register_type(_type_handle, "RectangleLight", + LightLensNode::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#include "rectangleLight.I" + +#endif From 04819719fb0918fdc463c1e86ed94b30b6e5e682 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Dec 2016 23:32:23 +0100 Subject: [PATCH 62/93] Fix erroneous report in installer while installing libs --- makepanda/installer.nsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index d14cb44da9..d934cc4ee0 100755 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -166,6 +166,10 @@ SectionGroup "Panda3D Libraries" SetOutPath $INSTDIR\models File /r /x CVS "${BUILT}\models\*" + SetDetailsPrint both + DetailPrint "Installing optional components..." + SetDetailsPrint listonly + RMDir /r "$SMPROGRAMS\${TITLE}" CreateDirectory "$SMPROGRAMS\${TITLE}" SectionEnd From b2ccf6c0d2313d794468f7ae04beaddf5d930eb8 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Dec 2016 23:35:05 +0100 Subject: [PATCH 63/93] Add ability to produce .whl file Based on original version by pennomi Closes: #83 --- makepanda/makepanda.py | 21 +- makepanda/makewheel.py | 558 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 577 insertions(+), 2 deletions(-) create mode 100644 makepanda/makewheel.py diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 956e8db52c..f2746881bd 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -39,6 +39,7 @@ import sys COMPILER=0 INSTALLER=0 +WHEEL=0 GENMAN=0 COMPRESSOR="zlib" THREADCOUNT=0 @@ -124,6 +125,7 @@ def usage(problem): print(" --verbose (print out more information)") print(" --runtime (build a runtime build instead of an SDK build)") print(" --installer (build an installer)") + print(" --wheel (build a pip-installable .whl)") print(" --optimize X (optimization level can be 1,2,3,4)") print(" --version X (set the panda version number)") print(" --lzma (use lzma compression when building Windows installer)") @@ -159,13 +161,13 @@ def usage(problem): os._exit(1) def parseopts(args): - global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION + global INSTALLER,WHEEL,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER longopts = [ "help","distributor=","verbose","runtime","osxtarget=", - "optimize=","everything","nothing","installer","rtdist","nocolor", + "optimize=","everything","nothing","installer","wheel","rtdist","nocolor", "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=", "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl", @@ -188,6 +190,7 @@ def parseopts(args): if (option=="--help"): raise Exception elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 + elif (option=="--wheel"): WHEEL=1 elif (option=="--verbose"): SetVerbose(True) elif (option=="--distributor"): DISTRIBUTOR=value elif (option=="--rtdist"): RTDIST=1 @@ -416,9 +419,18 @@ if (RUNTIME): if (INSTALLER and RTDIST): exit("Cannot build an installer for the rtdist build!") +if (WHEEL and RUNTIME): + exit("Cannot build a wheel for the runtime build!") + +if (WHEEL and RTDIST): + exit("Cannot build a wheel for the rtdist build!") + if (INSTALLER) and (PkgSkip("PYTHON")) and (not RUNTIME) and GetTarget() == 'windows': exit("Cannot build installer on Windows without python") +if WHEEL and PkgSkip("PYTHON"): + exit("Cannot build wheel without Python") + if (RTDIST) and (PkgSkip("WX") and PkgSkip("FLTK")): exit("Cannot build rtdist without wx or fltk") @@ -7239,6 +7251,11 @@ try: MakeInstallerFreeBSD() else: exit("Do not know how to make an installer for this platform") + + if WHEEL: + ProgressOutput(100.0, "Building wheel") + from makewheel import makewheel + makewheel(VERSION, GetOutputDir()) finally: SaveDependencyCache() diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py new file mode 100644 index 0000000000..81caf24701 --- /dev/null +++ b/makepanda/makewheel.py @@ -0,0 +1,558 @@ +""" +Generates a wheel (.whl) file from the output of makepanda. + +Since the wheel requires special linking, this will only work if compiled with +the `--wheel` parameter. +""" +from __future__ import print_function, unicode_literals +from distutils.util import get_platform as get_dist +import json + +import sys +import os +from os.path import join +import shutil +import zipfile +import hashlib +import tempfile +import subprocess +from sysconfig import get_config_var +from optparse import OptionParser +from makepandacore import ColorText, LocateBinary, ParsePandaVersion, GetExtensionSuffix, SetVerbose, GetVerbose +from base64 import urlsafe_b64encode + + +def get_platform(): + p = get_dist().replace('-', '_').replace('.', '_') + #if "linux" in p: + # print(ColorText("red", "WARNING:") + + # " Linux-specific wheel files are not supported." + # " We will generate this wheel as a generic package instead.") + # return "any" + return p + + +def get_abi_tag(): + if sys.version_info >= (3, 0): + soabi = get_config_var('SOABI') + if soabi and soabi.startswith('cpython-'): + return 'cp' + soabi.split('-')[1] + elif soabi: + return soabi.replace('.', '_').replace('-', '_') + + soabi = 'cp%d%d' % (sys.version_info[:2]) + + debug_flag = get_config_var('Py_DEBUG') + if (debug_flag is None and hasattr(sys, 'gettotalrefcount')) or debug_flag: + soabi += 'd' + + malloc_flag = get_config_var('WITH_PYMALLOC') + if malloc_flag is None or malloc_flag: + soabi += 'm' + + if sys.version_info < (3, 3): + usize = get_config_var('Py_UNICODE_SIZE') + if (usize is None and sys.maxunicode == 0x10ffff) or usize == 4: + soabi += 'u' + + return soabi + + +def is_exe_file(path): + return os.path.isfile(path) and path.lower().endswith('.exe') + + +def is_elf_file(path): + base = os.path.basename(path) + return os.path.isfile(path) and '.' not in base and \ + open(path, 'rb').read(4) == b'\x7FELF' + + +def is_mach_o_file(path): + base = os.path.basename(path) + return os.path.isfile(path) and '.' not in base and \ + open(path, 'rb').read(4) == b'\xCA\xFE\xBA\xBE' + + +if sys.platform in ('win32', 'cygwin'): + is_executable = is_exe_file +elif sys.platform == 'darwin': + is_executable = is_mach_o_file +else: + is_executable = is_elf_file + + +# Other global parameters +PY_VERSION = "cp{}{}".format(sys.version_info.major, sys.version_info.minor) +ABI_TAG = get_abi_tag() +PLATFORM_TAG = get_platform() +EXCLUDE_EXT = [".pyc", ".pyo", ".N", ".prebuilt", ".xcf", ".plist", ".vcproj", ".sln"] + +# Plug-ins to install. +PLUGIN_LIBS = ["pandagl", "pandagles", "pandagles2", "p3ptloader", "p3assimp", "p3ffmpeg", "p3openal_audio", "p3fmod_audio"] + +WHEEL_DATA = """Wheel-Version: 1.0 +Generator: makepanda +Root-Is-Purelib: false +Tag: {}-{}-{} +""" + +METADATA = { + "license": "BSD", + "name": "Panda3D", + "metadata_version": "2.0", + "generator": "makepanda", + "summary": "Panda3D is a game engine, a framework for 3D rendering and " + "game development for Python and C++ programs.", + "extensions": { + "python.details": { + "project_urls": { + "Home": "https://www.panda3d.org/" + }, + "document_names": { + "license": "LICENSE.txt" + }, + "contacts": [ + { + "role": "author", + "email": "etc-panda3d@lists.andrew.cmu.edu", + "name": "Panda3D Team" + } + ] + } + }, + "classifiers": [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: C++", + "Programming Language :: Python", + "Topic :: Games/Entertainment", + "Topic :: Multimedia", + "Topic :: Multimedia :: Graphics", + "Topic :: Multimedia :: Graphics :: 3D Rendering" + ] +} + +PANDA3D_TOOLS_INIT = """import os, sys +import panda3d + +if sys.platform in ('win32', 'cygwin'): + path_var = 'PATH' +elif sys.platform == 'darwin': + path_var = 'DYLD_LIBRARY_PATH' +else: + path_var = 'LD_LIBRARY_PATH' + +dir = os.path.dirname(panda3d.__file__) +del panda3d +if not os.environ.get(path_var): + os.environ[path_var] = dir +else: + os.environ[path_var] = dir + os.pathsep + os.environ[path_var] + +del os, sys, path_var, dir + + +def _exec_tool(tool): + import os, sys + from subprocess import Popen + tools_dir = os.path.dirname(__file__) + handle = Popen(sys.argv, executable=os.path.join(tools_dir, tool)) + try: + try: + return handle.wait() + except KeyboardInterrupt: + # Give the program a chance to handle the signal gracefully. + return handle.wait() + except: + handle.kill() + handle.wait() + raise + +# Register all the executables in this directory as global functions. +{0} +""" + + +def parse_dependencies_windows(data): + """ Parses the given output from dumpbin /dependents to determine the list + of dll's this executable file depends on. """ + + lines = data.splitlines() + li = 0 + while li < len(lines): + line = lines[li] + li += 1 + if line.find(' has the following dependencies') != -1: + break + + if li < len(lines): + line = lines[li] + if line.strip() == '': + # Skip a blank line. + li += 1 + + # Now we're finding filenames, until the next blank line. + filenames = [] + while li < len(lines): + line = lines[li] + li += 1 + line = line.strip() + if line == '': + # We're done. + return filenames + filenames.append(line) + + # At least we got some data. + return filenames + + +def parse_dependencies_unix(data): + """ Parses the given output from otool -XL or ldd to determine the list of + libraries this executable file depends on. """ + + lines = data.splitlines() + filenames = [] + for l in lines: + l = l.strip() + if l != "statically linked": + filenames.append(l.split(' ', 1)[0]) + return filenames + + +def scan_dependencies(pathname): + """ Checks the named file for DLL dependencies, and adds any appropriate + dependencies found into pluginDependencies and dependentFiles. """ + + if sys.platform == "darwin": + command = ['otool', '-XL', pathname] + elif sys.platform in ("win32", "cygwin"): + command = ['dumpbin', '/dependents', pathname] + else: + command = ['ldd', pathname] + + output = subprocess.check_output(command, universal_newlines=True) + filenames = None + + if sys.platform in ("win32", "cygwin"): + filenames = parse_dependencies_windows(output) + else: + filenames = parse_dependencies_unix(output) + + if filenames is None: + sys.exit("Unable to determine dependencies from %s" % (pathname)) + + return filenames + + +class WheelFile(object): + def __init__(self, name, version): + self.name = name + self.version = version + + wheel_name = "{}-{}-{}-{}-{}.whl".format( + name, version, PY_VERSION, ABI_TAG, PLATFORM_TAG) + + print("Writing %s" % (wheel_name)) + self.zip_file = zipfile.ZipFile(wheel_name, 'w', zipfile.ZIP_DEFLATED) + self.records = [] + + # Used to locate dependency libraries. + self.lib_path = [] + self.dep_paths = {} + + def consider_add_dependency(self, target_path, dep, search_path=None): + """Considers adding a dependency library. + Returns the target_path if it was added, which may be different from + target_path if it was already added earlier, or None if it wasn't.""" + + if dep in self.dep_paths: + # Already considered this. + return self.dep_paths[dep] + + self.dep_paths[dep] = None + + if dep.lower().startswith("python"): + # Don't include the Python library. + return + + source_path = None + + if search_path is None: + search_path = self.lib_path + + for lib_dir in search_path: + # Ignore static stuff. + path = os.path.join(lib_dir, dep) + if os.path.isfile(path): + source_path = os.path.normpath(path) + break + + if not source_path: + # Couldn't find library in the panda3d lib dir. + #print("Ignoring %s" % (dep)) + return + + self.dep_paths[dep] = target_path + self.write_file(target_path, source_path) + return target_path + + def write_file(self, target_path, source_path): + """Adds the given file to the .whl file.""" + + # If this is a .so file, we should set the rpath appropriately. + temp = None + ext = os.path.splitext(source_path)[1] + if ext in ('.so', '.dylib') or '.so.' in os.path.basename(source_path) or \ + (not ext and is_executable(source_path)): + # Scan and add Unix dependencies. + deps = scan_dependencies(source_path) + for dep in deps: + # Only include dependencies with relative path. Otherwise we + # end up overwriting system files like /lib/ld-linux.so.2! + # Yes, it happened to me. + if '/' not in dep: + target_dep = os.path.dirname(target_path) + '/' + dep + self.consider_add_dependency(target_dep, dep) + + suffix = '' + if '.so' in os.path.basename(source_path): + suffix = '.so' + elif ext == '.dylib': + suffix = '.dylib' + + temp = tempfile.NamedTemporaryFile(suffix=suffix, prefix='whl', delete=False) + temp.write(open(source_path, 'rb').read()) + os.fchmod(temp.fileno(), os.fstat(temp.fileno()).st_mode | 0o111) + temp.close() + + # Fix things like @loader_path/../lib references + if sys.platform == "darwin": + loader_path = [os.path.dirname(source_path)] + for dep in deps: + if '@loader_path' not in dep: + continue + + dep_path = dep.replace('@loader_path', '.') + target_dep = os.path.dirname(target_path) + '/' + os.path.basename(dep) + target_dep = self.consider_add_dependency(target_dep, dep_path, loader_path) + if not target_dep: + # It won't be included, so no use adjusting the path. + continue + + new_dep = os.path.join('@loader_path', os.path.relpath(target_dep, os.path.dirname(target_path))) + subprocess.call(["install_name_tool", "-change", dep, new_dep, temp.name]) + else: + subprocess.call(["strip", "-s", temp.name]) + subprocess.call(["patchelf", "--set-rpath", "$ORIGIN", temp.name]) + + source_path = temp.name + + ext = ext.lower() + if ext in ('.dll', '.pyd', '.exe'): + # Scan and add Win32 dependencies. + for dep in scan_dependencies(source_path): + target_dep = os.path.dirname(target_path) + '/' + dep + self.consider_add_dependency(target_dep, dep) + + # Calculate the SHA-256 hash and size. + sha = hashlib.sha256() + fp = open(source_path, 'rb') + size = 0 + data = fp.read(1024 * 1024) + while data: + size += len(data) + sha.update(data) + data = fp.read(1024 * 1024) + fp.close() + + # Save it in PEP-0376 format for writing out later. + digest = str(urlsafe_b64encode(sha.digest())) + digest = digest.rstrip('=') + self.records.append("{},sha256={},{}\n".format(target_path, digest, size)) + + if GetVerbose(): + print("Adding %s from %s" % (target_path, source_path)) + self.zip_file.write(source_path, target_path) + + #if temp: + # os.unlink(temp.name) + + def write_file_data(self, target_path, source_data): + """Adds the given file from a string.""" + + sha = hashlib.sha256() + sha.update(source_data.encode()) + digest = str(urlsafe_b64encode(sha.digest())) + digest = digest.rstrip('=') + self.records.append("{},sha256={},{}\n".format(target_path, digest, len(source_data))) + + if GetVerbose(): + print("Adding %s from data" % target_path) + self.zip_file.writestr(target_path, source_data) + + def write_directory(self, target_dir, source_dir): + """Adds the given directory recursively to the .whl file.""" + + for root, dirs, files in os.walk(source_dir): + for file in files: + if os.path.splitext(file)[1] in EXCLUDE_EXT: + continue + + source_path = os.path.join(root, file) + target_path = os.path.join(target_dir, os.path.relpath(source_path, source_dir)) + target_path = target_path.replace('\\', '/') + self.write_file(target_path, source_path) + + def close(self): + # Write the RECORD file. + record_file = "{}-{}.dist-info/RECORD".format(self.name, self.version) + self.records.append(record_file + ",,\n") + + self.zip_file.writestr(record_file, "".join(self.records)) + self.zip_file.close() + + +def makewheel(version, output_dir): + if sys.platform not in ("win32", "darwin") and not sys.platform.startswith("cygwin"): + if not LocateBinary("patchelf"): + raise Exception("patchelf is required when building a Linux wheel.") + + # Global filepaths + panda3d_dir = join(output_dir, "panda3d") + pandac_dir = join(output_dir, "pandac") + direct_dir = join(output_dir, "direct") + models_dir = join(output_dir, "models") + etc_dir = join(output_dir, "etc") + bin_dir = join(output_dir, "bin") + if sys.platform == "win32": + libs_dir = join(output_dir, "bin") + else: + libs_dir = join(output_dir, "lib") + license_src = "LICENSE" + readme_src = "README.md" + + # Update relevant METADATA entries + METADATA['version'] = version + version_classifiers = [ + "Programming Language :: Python :: {}".format(*sys.version_info), + "Programming Language :: Python :: {}.{}".format(*sys.version_info), + ] + METADATA['classifiers'].extend(version_classifiers) + + # Build out the metadata + details = METADATA["extensions"]["python.details"] + homepage = details["project_urls"]["Home"] + author = details["contacts"][0]["name"] + email = details["contacts"][0]["email"] + metadata = ''.join([ + "Metadata-Version: {metadata_version}\n" \ + "Name: {name}\n" \ + "Version: {version}\n" \ + "Summary: {summary}\n" \ + "License: {license}\n".format(**METADATA), + "Home-page: {}\n".format(homepage), + "Author: {}\n".format(author), + "Author-email: {}\n".format(email), + "Platform: {}\n".format(PLATFORM_TAG), + ] + ["Classifier: {}\n".format(c) for c in METADATA['classifiers']]) + + # Zip it up and name it the right thing + whl = WheelFile('panda3d', version) + whl.lib_path = [libs_dir] + + # Add the trees with Python modules. + whl.write_directory('direct', direct_dir) + + # Write the panda3d tree. We use a custom empty __init__ since the + # default one adds the bin directory to the PATH, which we don't have. + whl.write_file_data('panda3d/__init__.py', '') + + ext_suffix = GetExtensionSuffix() + + for file in os.listdir(panda3d_dir): + if file == '__init__.py': + pass + elif file.endswith(ext_suffix) or file.endswith('.py'): + source_path = os.path.join(panda3d_dir, file) + + if file.endswith('.pyd') and PLATFORM_TAG.startswith('cygwin'): + # Rename it to .dll for cygwin Python to be able to load it. + target_path = 'panda3d/' + os.path.splitext(file)[0] + '.dll' + else: + target_path = 'panda3d/' + file + whl.write_file(target_path, source_path) + + # Add plug-ins. + for lib in PLUGIN_LIBS: + plugin_name = 'lib' + lib + if sys.platform in ('win32', 'cygwin'): + plugin_name += '.dll' + elif sys.platform == 'darwin': + plugin_name += '.dylib' + else: + plugin_name += '.so' + plugin_path = os.path.join(libs_dir, plugin_name) + if os.path.isfile(plugin_path): + whl.write_file('panda3d/' + plugin_name, plugin_path) + + # Add the pandac tree for backward compatibility. + for file in os.listdir(pandac_dir): + if file.endswith('.py'): + whl.write_file('pandac/' + file, os.path.join(pandac_dir, file)) + + # Add a panda3d-tools directory containing the executables. + entry_points = '[console_scripts]\n' + tools_init = '' + for file in os.listdir(bin_dir): + source_path = os.path.join(bin_dir, file) + + if is_executable(source_path): + # Put the .exe files inside the panda3d-tools directory. + whl.write_file('panda3d_tools/' + file, source_path) + + # Tell pip to create a wrapper script. + basename = os.path.splitext(file)[0] + funcname = basename.replace('-', '_') + entry_points += '{0} = panda3d_tools:{1}\n'.format(basename, funcname) + tools_init += '{0} = lambda: _exec_tool({1!r})\n'.format(funcname, file) + + whl.write_file_data('panda3d_tools/__init__.py', PANDA3D_TOOLS_INIT.format(tools_init)) + + # Add the .data directory, containing additional files. + data_dir = 'panda3d-{}.data'.format(version) + #whl.write_directory(data_dir + '/data/etc', etc_dir) + #whl.write_directory(data_dir + '/data/models', models_dir) + + # Actually, let's not. That seems to install the files to the strangest + # places in the user's filesystem. Let's instead put them in panda3d. + whl.write_directory('panda3d/etc', etc_dir) + whl.write_directory('panda3d/models', models_dir) + + # Add the dist-info directory last. + info_dir = 'panda3d-{}.dist-info'.format(version) + whl.write_file_data(info_dir + '/entry_points.txt', entry_points) + whl.write_file_data(info_dir + '/metadata.json', json.dumps(METADATA, indent=4, separators=(',', ': '))) + whl.write_file_data(info_dir + '/METADATA', metadata) + whl.write_file_data(info_dir + '/WHEEL', WHEEL_DATA.format(PY_VERSION, ABI_TAG, PLATFORM_TAG)) + whl.write_file(info_dir + '/LICENSE.txt', license_src) + whl.write_file(info_dir + '/README.md', readme_src) + whl.write_file_data(info_dir + '/top_level.txt', 'direct\npanda3d\npandac\npanda3d_tools\n') + + whl.close() + + +if __name__ == "__main__": + version = ParsePandaVersion("dtool/PandaVersion.pp") + + parser = OptionParser() + parser.add_option('', '--version', dest = 'version', help = 'Panda3D version number (default: %s)' % (version), default = version) + parser.add_option('', '--outputdir', dest = 'outputdir', help = 'Makepanda\'s output directory (default: built)', default = 'built') + parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False) + (options, args) = parser.parse_args() + + SetVerbose(options.verbose) + makewheel(options.version, options.outputdir) From eab2a1a733dbef60f1a9c2bc1a26b5e42a0e6a3f Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 19 Dec 2016 23:39:50 +0100 Subject: [PATCH 64/93] Add CP_area_priority for area lights --- panda/src/pgraph/light.h | 1 + 1 file changed, 1 insertion(+) diff --git a/panda/src/pgraph/light.h b/panda/src/pgraph/light.h index 05fa4c10f6..eeca3409bd 100644 --- a/panda/src/pgraph/light.h +++ b/panda/src/pgraph/light.h @@ -90,6 +90,7 @@ protected: CP_point_priority, CP_directional_priority, CP_spot_priority, + CP_area_priority, }; private: From 1808ad217cea81b5232cf7be977ee4f375416b6a Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 20 Dec 2016 23:14:58 +0100 Subject: [PATCH 65/93] Fix Python 3 error in particle sample in 1.9 --- direct/src/particles/ParticleEffect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/particles/ParticleEffect.py b/direct/src/particles/ParticleEffect.py index 914630f19c..3ccec4b589 100644 --- a/direct/src/particles/ParticleEffect.py +++ b/direct/src/particles/ParticleEffect.py @@ -200,7 +200,7 @@ class ParticleEffect(NodePath): def loadConfig(self, filename): data = vfs.readFile(filename, 1) - data = data.replace('\r', '') + data = data.replace(b'\r', b'') try: exec(data) except: From 637767fec893b43c4e6201a434fa435991ffe543 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 20 Dec 2016 23:15:21 +0100 Subject: [PATCH 66/93] Flush nout before inducing crash in assert-abort --- dtool/src/prc/notify.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dtool/src/prc/notify.cxx b/dtool/src/prc/notify.cxx index ebfd19ac42..9a34869923 100644 --- a/dtool/src/prc/notify.cxx +++ b/dtool/src/prc/notify.cxx @@ -405,6 +405,9 @@ assert_failure(const char *expression, int line, // so we can guarantee it has already been constructed. ALIGN_16BYTE ConfigVariableBool assert_abort("assert-abort", false); if (assert_abort) { + // Make sure the error message has been flushed to the output. + nout.flush(); + #ifdef WIN32 // How to trigger an exception in VC++ that offers to take us into // the debugger? abort() doesn't do it. We used to be able to From 5aa86185723f4858827e62703082c3ece672a303 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 20 Dec 2016 23:18:05 +0100 Subject: [PATCH 67/93] Don't error if passing an oversized matrix array to a mat4[1] shader parameter --- panda/src/pgraph/shaderAttrib.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/panda/src/pgraph/shaderAttrib.cxx b/panda/src/pgraph/shaderAttrib.cxx index ad9b1a6eef..350c97ac84 100644 --- a/panda/src/pgraph/shaderAttrib.cxx +++ b/panda/src/pgraph/shaderAttrib.cxx @@ -501,7 +501,8 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const { nassertr(!np.is_empty(), LMatrix4::ident_mat()); return np.get_transform()->get_mat(); - } else if (p->get_value_type() == ShaderInput::M_numeric && p->get_ptr()._size == 16) { + } else if (p->get_value_type() == ShaderInput::M_numeric && + p->get_ptr()._size >= 16 && (p->get_ptr()._size & 15) == 0) { const Shader::ShaderPtrData &ptr = p->get_ptr(); switch (ptr._type) { @@ -527,7 +528,7 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const { } ostringstream strm; - strm << "Shader input " << id->get_name() << " is not a NodePath or LMatrix4.\n"; + strm << "Shader input " << id->get_name() << " is not a NodePath, LMatrix4 or PTA_LMatrix4.\n"; nassert_raise(strm.str()); return LMatrix4::ident_mat(); } From a13fb0e8ca4c6e04e4a7a9937e8a6c88758cef1b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 21 Dec 2016 17:33:22 +0100 Subject: [PATCH 68/93] Fix compilation issue with older ffmpeg versions --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 6 +++++- panda/src/ffmpeg/ffmpegVideoCursor.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 1829e003de..77598a3644 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -46,6 +46,10 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid #define AV_PIX_FMT_BGRA PIX_FMT_BGRA #endif +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100) +#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_FLAG_ALPHA +#endif + /** * This constructor is only used when reading from a bam file. */ @@ -512,7 +516,7 @@ open_stream() { AVCodec *pVideoCodec = NULL; if (ffmpeg_prefer_libvpx) { - if (_video_ctx->codec_id == AV_CODEC_ID_VP9) { + if ((int)_video_ctx->codec_id == 168) { // AV_CODEC_ID_VP9 pVideoCodec = avcodec_find_decoder_by_name("libvpx-vp9"); } else if (_video_ctx->codec_id == AV_CODEC_ID_VP8) { pVideoCodec = avcodec_find_decoder_by_name("libvpx"); diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.h b/panda/src/ffmpeg/ffmpegVideoCursor.h index 199b533f47..23cfda389b 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.h +++ b/panda/src/ffmpeg/ffmpegVideoCursor.h @@ -104,7 +104,12 @@ private: int _max_readahead_frames; ThreadPriority _thread_priority; PT(GenericThread) _thread; + +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) + PixelFormat _pixel_format; +#else AVPixelFormat _pixel_format; +#endif // This global Mutex protects calls to avcodec_opencloseetc. static ReMutex _av_lock; From 92302942feb5d2eacf4dd8bc9caa7fe4cb4aaf3c Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 21 Dec 2016 17:14:10 +0100 Subject: [PATCH 69/93] Changes to build on ancient Linux distributions (CentOS 5 / manylinux) --- doc/ReleaseNotes | 1 + panda/src/glxdisplay/panda_glxext.h | 1 + panda/src/vision/webcamVideoV4L.cxx | 66 +++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 03d2dcf92a..92a31b7d52 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -50,6 +50,7 @@ This issue fixes several bugs that were still found in 1.9.2. * GLSL: fix error when legacy matrix generator inputs are mat3 * Now tries to preserve refresh rate when switching fullscreen on Windows * Fix back-to-front sorting when gl-coordinate-system is changed +* Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1) ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/glxdisplay/panda_glxext.h b/panda/src/glxdisplay/panda_glxext.h index 308e166224..5208302929 100644 --- a/panda/src/glxdisplay/panda_glxext.h +++ b/panda/src/glxdisplay/panda_glxext.h @@ -199,6 +199,7 @@ GLXContext glXCreateContextAttribsARB (X11_Display *dpy, GLXFBConfig config, GLX #ifndef GLX_ARB_get_proc_address #define GLX_ARB_get_proc_address 1 +typedef void (*__GLXextFuncPtr)(void); typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); #ifdef GLX_GLXEXT_PROTOTYPES __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); diff --git a/panda/src/vision/webcamVideoV4L.cxx b/panda/src/vision/webcamVideoV4L.cxx index 71cee3d312..dd77c6813e 100644 --- a/panda/src/vision/webcamVideoV4L.cxx +++ b/panda/src/vision/webcamVideoV4L.cxx @@ -23,6 +23,72 @@ #include #include +#ifndef CPPPARSER +#ifndef VIDIOC_ENUM_FRAMESIZES +enum v4l2_frmsizetypes { + V4L2_FRMSIZE_TYPE_DISCRETE = 1, + V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, + V4L2_FRMSIZE_TYPE_STEPWISE = 3, +}; + +struct v4l2_frmsize_discrete { + __u32 width; + __u32 height; +}; + +struct v4l2_frmsize_stepwise { + __u32 min_width; + __u32 max_width; + __u32 step_width; + __u32 min_height; + __u32 max_height; + __u32 step_height; +}; + +struct v4l2_frmsizeenum { + __u32 index; + __u32 pixel_format; + __u32 type; + union { + struct v4l2_frmsize_discrete discrete; + struct v4l2_frmsize_stepwise stepwise; + }; + __u32 reserved[2]; +}; + +#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) +#endif + +#ifndef VIDIOC_ENUM_FRAMEINTERVALS +enum v4l2_frmivaltypes { + V4L2_FRMIVAL_TYPE_DISCRETE = 1, + V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, + V4L2_FRMIVAL_TYPE_STEPWISE = 3, +}; + +struct v4l2_frmival_stepwise { + struct v4l2_fract min; + struct v4l2_fract max; + struct v4l2_fract step; +}; + +struct v4l2_frmivalenum { + __u32 index; + __u32 pixel_format; + __u32 width; + __u32 height; + __u32 type; + union { + struct v4l2_fract discrete; + struct v4l2_frmival_stepwise stepwise; + }; + __u32 reserved[2]; +}; + +#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) +#endif +#endif + TypeHandle WebcamVideoV4L::_type_handle; //////////////////////////////////////////////////////////////////// From c1d6e9316631e33b49e10f29de0089a700c49b43 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 21 Dec 2016 17:41:15 +0100 Subject: [PATCH 70/93] Don't link extension modules with libpython; changes to help w/ building whls This fixes compatibility issues with homebrew Python on Mac OS X. This introduces a --no-directscripts flag to disable building packpanda and eggcacher, which require linking with libpython (which is not available on manylinux). When building a wheel, the packpanda and eggcacher modules can instead be added to console_scripts in the entry_points definition. --- direct/src/directscripts/eggcacher.py | 4 ++++ direct/src/directscripts/packpanda.py | 3 +++ doc/ReleaseNotes | 1 + makepanda/makepanda.py | 15 +++++++++++---- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/direct/src/directscripts/eggcacher.py b/direct/src/directscripts/eggcacher.py index ea2f653876..3d53e4e122 100644 --- a/direct/src/directscripts/eggcacher.py +++ b/direct/src/directscripts/eggcacher.py @@ -88,3 +88,7 @@ class EggCacher: progress += size cacher = EggCacher(sys.argv[1:]) + +# Dummy main function so this can be added to console_scripts. +def main(): + return 0 diff --git a/direct/src/directscripts/packpanda.py b/direct/src/directscripts/packpanda.py index 72e33c3e9b..c27c8c678d 100755 --- a/direct/src/directscripts/packpanda.py +++ b/direct/src/directscripts/packpanda.py @@ -419,3 +419,6 @@ else: if not(os.path.exists("/usr/bin/rpmbuild") or os.path.exists("/usr/bin/dpkg-deb")): exit("To build an installer, either rpmbuild or dpkg-deb must be present on your system!") +# Dummy main function so this can be added to console_scripts. +def main(): + return 0 diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 92a31b7d52..4ba7c0930f 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -2,6 +2,7 @@ This issue fixes several bugs that were still found in 1.9.2. +* Fix crash when using homebrew Python on Mac OS X * Fix crash when running in Steam on Linux when using OpenAL * Fix crash using wx/tkinter on Mac as long as want-wx/tk is set * Fix loading models from 'models' package with models/ prefix diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 4adcb96d5e..040fb03e2b 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -74,6 +74,7 @@ STRDXSDKVERSION = 'default' STRMSPLATFORMVERSION = 'default' BOOUSEINTELCOMPILER = False OPENCV_VER_23 = False +DIRECTSCRIPTS = True if "MACOSX_DEPLOYMENT_TARGET" in os.environ: OSXTARGET=os.environ["MACOSX_DEPLOYMENT_TARGET"] @@ -169,7 +170,7 @@ def usage(problem): def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL - global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX + global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,DIRECTSCRIPTS global STRDXSDKVERSION, STRMSPLATFORMVERSION, BOOUSEINTELCOMPILER longopts = [ "help","distributor=","verbose","runtime","osxtarget=", @@ -177,7 +178,7 @@ def parseopts(args): "version=","lzma","no-python","threads=","outputdir=","override=", "static","host=","debversion=","rpmrelease=","p3dsuffix=", "directx-sdk=", "platform-sdk=", "use-icl", "clean", - "universal", "target=", "arch=", "git-commit="] + "universal", "target=", "arch=", "git-commit=", "no-directscripts"] anything = 0 optimize = "" target = None @@ -223,6 +224,7 @@ def parseopts(args): # Backward compatibility, OPENGL was renamed to GL elif (option=="--use-opengl"): PkgEnable("GL") elif (option=="--no-opengl"): PkgDisable("GL") + elif (option=="--no-directscripts"): DIRECTSCRIPTS=False elif (option=="--directx-sdk"): STRDXSDKVERSION = value.strip().lower() if STRDXSDKVERSION == '': @@ -799,7 +801,7 @@ if (COMPILER=="GCC"): if GetTarget() != 'darwin': # CgGL is covered by the Cg framework, and we don't need X11 components on OSX if not PkgSkip("NVIDIACG") and not RUNTIME: - SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h") + SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h", thirdparty_dir = "nvidiacg") if not RUNTIME: SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h")) SmartPkgEnable("XRANDR", "xrandr", "Xrandr", "X11/extensions/Xrandr.h") @@ -1646,6 +1648,11 @@ def CompileLink(dll, obj, opts): if LDFLAGS != "": cmd += " " + LDFLAGS + # Don't link libraries with Python. + if "PYTHON" in opts and GetOrigExt(dll) != ".exe" and not RTDIST: + opts = opts[:] + opts.remove("PYTHON") + for (opt, dir) in LIBDIRECTORIES: if (opt=="ALWAYS") or (opt in opts): cmd += ' -L' + BracketNameWithQuotes(dir) @@ -4822,7 +4829,7 @@ if (PkgSkip("DIRECT")==0): OPTS=['DIR:direct/src/directbase', 'PYTHON'] TargetAdd('p3directbase_directbase.obj', opts=OPTS+['BUILDING:DIRECT'], input='directbase.cxx') - if (PkgSkip("PYTHON")==0 and not RTDIST and not RUNTIME): + if (PkgSkip("PYTHON")==0 and not RTDIST and not RUNTIME and DIRECTSCRIPTS): DefSymbol("BUILDING:PACKPANDA", "IMPORT_MODULE", "direct.directscripts.packpanda") TargetAdd('packpanda.obj', opts=OPTS+['BUILDING:PACKPANDA'], input='ppython.cxx') TargetAdd('packpanda.exe', input='packpanda.obj') From 62d0d8292e21561caf6486dfdc3ec87204443f14 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 9 Dec 2016 01:41:32 +0100 Subject: [PATCH 71/93] More texture load/store performance optimisations --- panda/src/gobj/texture.cxx | 53 ++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index bcabaa7a8c..cd5cd54e73 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -6005,10 +6005,11 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, // Most common case: one byte per pixel, and the source image // maxval of 255. No scaling is necessary. Because this is such a common // case, we break it out per component for best performance. + const xel *array = pnmimage.get_array(); switch (num_components) { case 1: for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); } @@ -6018,9 +6019,10 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, case 2: if (img_has_alpha) { + const xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + const xel *row = array + j * x_size; + const xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)alpha_row[i]; @@ -6029,7 +6031,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)255; @@ -6041,7 +6043,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, case 3: for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)PPM_GETG(row[i]); @@ -6053,9 +6055,10 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, case 4: if (img_has_alpha) { + const xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + const xel *row = array + j * x_size; + const xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)PPM_GETG(row[i]); @@ -6066,7 +6069,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + const xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { *p++ = (uchar)PPM_GETB(row[i]); *p++ = (uchar)PPM_GETG(row[i]); @@ -6089,7 +6092,7 @@ convert_from_pnmimage(PTA_uchar &image, size_t page_size, for (int j = y_size-1; j >= 0; j--) { for (int i = 0; i < x_size; i++) { if (is_grayscale) { - store_unscaled_short(p, pnmimage.get_gray_val(i, j)); + store_unscaled_short(p, pnmimage.get_gray_val(i, j)); } else { store_unscaled_short(p, pnmimage.get_blue_val(i, j)); store_unscaled_short(p, pnmimage.get_green_val(i, j)); @@ -6260,11 +6263,13 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, const unsigned char *p = &image[idx]; if (component_width == 1) { + xel *array = pnmimage.get_array(); if (is_grayscale) { if (has_alpha) { + xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + xel *row = array + j * x_size; + xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); alpha_row[i] = *p++; @@ -6272,7 +6277,7 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); } @@ -6280,9 +6285,10 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, } } else { if (has_alpha) { + xelval *alpha = pnmimage.get_alpha_array(); for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); - xelval *alpha_row = pnmimage.alpha_row(j); + xel *row = array + j * x_size; + xelval *alpha_row = alpha + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); PPM_PUTG(row[i], *p++); @@ -6292,7 +6298,7 @@ convert_to_pnmimage(PNMImage &pnmimage, int x_size, int y_size, } } else { for (int j = y_size-1; j >= 0; j--) { - xel *row = pnmimage.row(j); + xel *row = array + j * x_size; for (int i = 0; i < x_size; i++) { PPM_PUTB(row[i], *p++); PPM_PUTG(row[i], *p++); @@ -7028,13 +7034,20 @@ compare_images(const PNMImage &a, const PNMImage &b) { nassertr(a.get_x_size() == b.get_x_size() && a.get_y_size() == b.get_y_size(), false); + const xel *a_array = a.get_array(); + const xel *b_array = b.get_array(); + const xelval *a_alpha = a.get_alpha_array(); + const xelval *b_alpha = b.get_alpha_array(); + + int x_size = a.get_x_size(); + int delta = 0; for (int yi = 0; yi < a.get_y_size(); ++yi) { - xel *a_row = a.row(yi); - xel *b_row = b.row(yi); - xelval *a_alpha_row = a.alpha_row(yi); - xelval *b_alpha_row = b.alpha_row(yi); - for (int xi = 0; xi < a.get_x_size(); ++xi) { + const xel *a_row = a_array + yi * x_size; + const xel *b_row = b_array + yi * x_size; + const xelval *a_alpha_row = a_alpha + yi * x_size; + const xelval *b_alpha_row = b_alpha + yi * x_size; + for (int xi = 0; xi < x_size; ++xi) { delta += abs(PPM_GETR(a_row[xi]) - PPM_GETR(b_row[xi])); delta += abs(PPM_GETG(a_row[xi]) - PPM_GETG(b_row[xi])); delta += abs(PPM_GETB(a_row[xi]) - PPM_GETB(b_row[xi])); From e8fbd2f9dac83c7ff1e3085efbd50718714563ab Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 21 Dec 2016 18:14:46 +0100 Subject: [PATCH 72/93] Fix potential crash in shader preprocess code --- panda/src/gobj/shader.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index 306f76f6f8..27a055a794 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2382,7 +2382,7 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { } // Strip trailing whitespace. - while (isspace(into[into.size() - 1])) { + while (!into.empty() && isspace(into[into.size() - 1])) { into.resize(into.size() - 1); } @@ -2528,7 +2528,7 @@ r_preprocess_source(ostream &out, const Filename &fn, } // Strip trailing whitespace. - while (isspace(line[line.size() - 1])) { + while (!line.empty() && isspace(line[line.size() - 1])) { line.resize(line.size() - 1); } From 7d414500c6578bfbb1b1f489acc2ea7075de5dbb Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 22 Dec 2016 11:32:02 +0100 Subject: [PATCH 73/93] Various compile fixes --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 15 ++++++++------- panda/src/ffmpeg/ffmpegVideoCursor.h | 6 +----- panda/src/movies/dr_flac.h | 8 ++++++-- .../src/putil/cachedTypedWritableReferenceCount.h | 4 +++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 77598a3644..8e2d0b0e47 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -44,10 +44,11 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid #define AV_PIX_FMT_NONE PIX_FMT_NONE #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 #define AV_PIX_FMT_BGRA PIX_FMT_BGRA +typedef PixelFormat AVPixelFormat; #endif #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 32, 100) -#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_FLAG_ALPHA +#define AV_PIX_FMT_FLAG_ALPHA PIX_FMT_ALPHA #endif /** @@ -65,7 +66,7 @@ FfmpegVideoCursor() : _format_ctx(NULL), _video_ctx(NULL), _convert_ctx(NULL), - _pixel_format(AV_PIX_FMT_NONE), + _pixel_format((int)AV_PIX_FMT_NONE), _video_index(-1), _frame(NULL), _frame_out(NULL), @@ -121,16 +122,16 @@ init_from(FfmpegVideo *source) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(_video_ctx->pix_fmt); if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) { _num_components = 4; - _pixel_format = AV_PIX_FMT_BGRA; + _pixel_format = (int)AV_PIX_FMT_BGRA; } else { _num_components = 3; - _pixel_format = AV_PIX_FMT_BGR24; + _pixel_format = (int)AV_PIX_FMT_BGR24; } #ifdef HAVE_SWSCALE nassertv(_convert_ctx == NULL); _convert_ctx = sws_getContext(_size_x, _size_y, _video_ctx->pix_fmt, - _size_x, _size_y, _pixel_format, + _size_x, _size_y, (AVPixelFormat)_pixel_format, SWS_BILINEAR | SWS_PRINT_INFO, NULL, NULL, NULL); #endif // HAVE_SWSCALE @@ -1115,7 +1116,7 @@ export_frame(FfmpegBuffer *buffer) { nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL); sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize); #else - img_convert((AVPicture *)_frame_out, _pixel_format, + img_convert((AVPicture *)_frame_out, (AVPixelFormat)_pixel_format, (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y); #endif } else { @@ -1123,7 +1124,7 @@ export_frame(FfmpegBuffer *buffer) { nassertv(_convert_ctx != NULL && _frame != NULL && _frame_out != NULL); sws_scale(_convert_ctx, _frame->data, _frame->linesize, 0, _size_y, _frame_out->data, _frame_out->linesize); #else - img_convert((AVPicture *)_frame_out, _pixel_format, + img_convert((AVPicture *)_frame_out, (AVPixelFormat)_pixel_format, (AVPicture *)_frame, _video_ctx->pix_fmt, _size_x, _size_y); #endif } diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.h b/panda/src/ffmpeg/ffmpegVideoCursor.h index 23cfda389b..b37637a0b0 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.h +++ b/panda/src/ffmpeg/ffmpegVideoCursor.h @@ -105,11 +105,7 @@ private: ThreadPriority _thread_priority; PT(GenericThread) _thread; -#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) - PixelFormat _pixel_format; -#else - AVPixelFormat _pixel_format; -#endif + int _pixel_format; // This global Mutex protects calls to avcodec_opencloseetc. static ReMutex _av_lock; diff --git a/panda/src/movies/dr_flac.h b/panda/src/movies/dr_flac.h index 26d133191d..fdac6a2f79 100644 --- a/panda/src/movies/dr_flac.h +++ b/panda/src/movies/dr_flac.h @@ -534,7 +534,9 @@ static DRFLAC_INLINE uint64_t drflac__swap_endian_uint64(uint64_t n) static DRFLAC_INLINE uint32_t drflac__be2host_32(uint32_t n) { -#ifdef __linux__ +#if defined(__BYTE_ORDER__) && (__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__) + return drflac__swap_endian_uint32(n); +#elif defined(__linux__) return be32toh(n); #else if (drflac__is_little_endian()) { @@ -547,7 +549,9 @@ static DRFLAC_INLINE uint32_t drflac__be2host_32(uint32_t n) static DRFLAC_INLINE uint64_t drflac__be2host_64(uint64_t n) { -#ifdef __linux__ +#if defined(__BYTE_ORDER__) && (__BYTE_ORDER == __ORDER_LITTLE_ENDIAN__) + return drflac__swap_endian_uint64(n); +#elif defined(__linux__) return be64toh(n); #else if (drflac__is_little_endian()) { diff --git a/panda/src/putil/cachedTypedWritableReferenceCount.h b/panda/src/putil/cachedTypedWritableReferenceCount.h index 7420253fcb..f2e9362dca 100644 --- a/panda/src/putil/cachedTypedWritableReferenceCount.h +++ b/panda/src/putil/cachedTypedWritableReferenceCount.h @@ -46,8 +46,10 @@ PUBLISHED: MAKE_PROPERTY(cache_ref_count, get_cache_ref_count); -protected: +public: INLINE void cache_ref_only() const; + +protected: INLINE void cache_unref_only() const; bool do_test_ref_count_integrity() const; From 056ea94765aeccd659e3905fa46ccc4556eaa9e8 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 22 Dec 2016 21:28:19 +0100 Subject: [PATCH 74/93] Fix PythonThread crash (LP bug 1245818) --- panda/src/pipeline/pythonThread.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/panda/src/pipeline/pythonThread.cxx b/panda/src/pipeline/pythonThread.cxx index c1ef41e344..493b576229 100644 --- a/panda/src/pipeline/pythonThread.cxx +++ b/panda/src/pipeline/pythonThread.cxx @@ -50,6 +50,13 @@ PythonThread(PyObject *function, PyObject *args, nassert_raise("Invalid args passed to PythonThread constructor"); } } + +#ifndef SIMPLE_THREADS + // Ensure that the Python threading system is initialized and ready to go. +#ifdef WITH_THREAD // This symbol defined within Python.h + PyEval_InitThreads(); +#endif +#endif } //////////////////////////////////////////////////////////////////// @@ -59,9 +66,20 @@ PythonThread(PyObject *function, PyObject *args, //////////////////////////////////////////////////////////////////// PythonThread:: ~PythonThread() { + // Unfortunately, we need to grab the GIL to release these things, + // since the destructor could be called from any thread. +#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); +#endif + Py_DECREF(_function); Py_XDECREF(_args); Py_XDECREF(_result); + +#if defined(HAVE_THREADS) && !defined(SIMPLE_THREADS) + PyGILState_Release(gstate); +#endif } //////////////////////////////////////////////////////////////////// From 601b6b86781912ac761d4d25d1a3499b93b7e690 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 22 Dec 2016 21:29:11 +0100 Subject: [PATCH 75/93] Tweaks for building with static thirdparty libs on Linux Sneak in a function used by makewheel --- makepanda/makepanda.py | 14 +++++++++++--- makepanda/makepandacore.py | 12 ++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 040fb03e2b..cb175542f2 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -561,6 +561,10 @@ if (COMPILER == "MSVC"): LibName(pkg, 'dxerrVNUM.lib'.replace("VNUM", vnum)) #LibName(pkg, 'ddraw.lib') LibName(pkg, 'dxguid.lib') + + if not PkgSkip("FREETYPE") and os.path.isdir(GetThirdpartyDir() + "freetype/include/freetype2"): + IncDirectory("FREETYPE", GetThirdpartyDir() + "freetype/include/freetype2") + IncDirectory("ALWAYS", GetThirdpartyDir() + "extras/include") LibName("WINSOCK", "wsock32.lib") LibName("WINSOCK2", "wsock32.lib") @@ -766,9 +770,13 @@ if (COMPILER=="GCC"): SmartPkgEnable("JPEG", "", ("jpeg"), "jpeglib.h") SmartPkgEnable("PNG", "libpng", ("png"), "png.h", tool = "libpng-config") - if GetTarget() == "darwin" and not PkgSkip("FFMPEG"): - LibName("FFMPEG", "-Wl,-read_only_relocs,suppress") - LibName("FFMPEG", "-framework VideoDecodeAcceleration") + if not PkgSkip("FFMPEG"): + if GetTarget() == "darwin": + LibName("FFMPEG", "-Wl,-read_only_relocs,suppress") + LibName("FFMPEG", "-framework VideoDecodeAcceleration") + elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"): + # Needed when linking ffmpeg statically on Linux. + LibName("FFMPEG", "-Wl,-Bsymbolic") cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV") if cv_lib == "opencv_core": diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 1b011188ff..fea93fd434 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1491,6 +1491,11 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, if os.path.isdir(os.path.join(pkg_dir, "include")): IncDirectory(target_pkg, os.path.join(pkg_dir, "include")) + # Handle cases like freetype2 where the include dir is a subdir under "include" + for i in incs: + if os.path.isdir(os.path.join(pkg_dir, "include", i)): + IncDirectory(target_pkg, os.path.join(pkg_dir, "include", i)) + if os.path.isdir(os.path.join(pkg_dir, "lib")): LibDirectory(target_pkg, os.path.join(pkg_dir, "lib")) @@ -2749,6 +2754,13 @@ def GetOrigExt(x): def SetOrigExt(x, v): ORIG_EXT[x] = v +def GetExtensionSuffix(): + target = GetTarget() + if target == 'windows': + return '.pyd' + else: + return '.so' + def CalcLocation(fn, ipath): if (fn.count("/")): return fn dllext = "" From 2ac1734566dbe5174a72b878a429b581421461ad Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 23 Dec 2016 00:36:59 +0100 Subject: [PATCH 76/93] Fix crash when trying to write 16-bit TIFF file (LP bug 1222922) Note: does not actually add support for writing 16-bit tifs; Panda just doesn't crash but automatically downsamples to 8-bit. --- doc/ReleaseNotes | 1 + panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 4ba7c0930f..3ad0ecd49b 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -76,6 +76,7 @@ remained in the 1.9.1 release, including: * Fix constant reloading of texture when gl-ignore-mipmaps is set * BamReader now releases the GIL (so it can be used threaded) * Fix AttributeError in direct.stdpy.threading module +* Fix crash when writing 16-bit .tif file (now silently downsamples) ------------------------ RELEASE 1.9.1 ------------------------ diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index ab09b1f034..5bfb87e5c3 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx @@ -1114,13 +1114,13 @@ write_data(xel *array, xelval *alpha) { bytesperrow = _x_size * samplesperpixel; } else if ( grayscale ) { samplesperpixel = 1; - bitspersample = pm_maxvaltobits( _maxval ); + bitspersample = min(8, pm_maxvaltobits(_maxval)); photometric = PHOTOMETRIC_MINISBLACK; i = 8 / bitspersample; bytesperrow = ( _x_size + i - 1 ) / i; } else { samplesperpixel = 1; - bitspersample = 8; + bitspersample = min(8, pm_maxvaltobits(_maxval)); photometric = PHOTOMETRIC_PALETTE; bytesperrow = _x_size; } From 122d9dd3ffa48f4f9297b9b05cb36f9ebcf7b7e6 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 24 Dec 2016 22:19:51 +0100 Subject: [PATCH 77/93] Support building with OpenSSL 1.1.0 --- dtool/src/prc/encryptStreamBuf.cxx | 88 ++++++++++++++++++----------- dtool/src/prc/encryptStreamBuf.h | 6 +- panda/src/downloader/httpClient.cxx | 18 +++--- 3 files changed, 67 insertions(+), 45 deletions(-) diff --git a/dtool/src/prc/encryptStreamBuf.cxx b/dtool/src/prc/encryptStreamBuf.cxx index acf76f9c0a..fed8b8e7b6 100644 --- a/dtool/src/prc/encryptStreamBuf.cxx +++ b/dtool/src/prc/encryptStreamBuf.cxx @@ -73,8 +73,8 @@ EncryptStreamBuf() { _key_length = encryption_key_length; _iteration_count = encryption_iteration_count; - _read_valid = false; - _write_valid = false; + _read_ctx = NULL; + _write_ctx = NULL; _read_overflow_buffer = NULL; _in_read_overflow_buffer = 0; @@ -110,7 +110,6 @@ open_read(istream *source, bool owns_source, const string &password) { _source = source; _owns_source = owns_source; - _read_valid = false; // Now read the header information. StreamReader sr(_source, false); @@ -123,6 +122,11 @@ open_read(istream *source, bool owns_source, const string &password) { if (cipher == NULL) { prc_cat.error() << "Unknown encryption algorithm in stream.\n"; + + if (_read_ctx != NULL) { + EVP_CIPHER_CTX_free(_read_ctx); + _read_ctx = NULL; + } return; } @@ -143,17 +147,25 @@ open_read(istream *source, bool owns_source, const string &password) { string iv = sr.extract_bytes(iv_length); + if (_read_ctx != NULL) { + EVP_CIPHER_CTX_reset(_read_ctx); + } else { + _read_ctx = EVP_CIPHER_CTX_new(); + } + nassertv(_read_ctx != NULL); + // Initialize the context int result; - result = EVP_DecryptInit(&_read_ctx, cipher, NULL, (unsigned char *)iv.data()); + result = EVP_DecryptInit(_read_ctx, cipher, NULL, (unsigned char *)iv.data()); nassertv(result > 0); - result = EVP_CIPHER_CTX_set_key_length(&_read_ctx, key_length); + result = EVP_CIPHER_CTX_set_key_length(_read_ctx, key_length); if (result <= 0) { prc_cat.error() << "Invalid key length " << key_length * 8 << " bits for algorithm " << OBJ_nid2sn(nid) << "\n"; - EVP_CIPHER_CTX_cleanup(&_read_ctx); + EVP_CIPHER_CTX_free(_read_ctx); + _read_ctx = NULL; return; } @@ -167,11 +179,9 @@ open_read(istream *source, bool owns_source, const string &password) { nassertv(result > 0); // Store the key within the context. - result = EVP_DecryptInit(&_read_ctx, NULL, key, NULL); + result = EVP_DecryptInit(_read_ctx, NULL, key, NULL); nassertv(result > 0); - _read_valid = true; - _read_overflow_buffer = new unsigned char[_read_block_size]; _in_read_overflow_buffer = 0; thread_consider_yield(); @@ -182,9 +192,9 @@ open_read(istream *source, bool owns_source, const string &password) { */ void EncryptStreamBuf:: close_read() { - if (_read_valid) { - EVP_CIPHER_CTX_cleanup(&_read_ctx); - _read_valid = false; + if (_read_ctx != NULL) { + EVP_CIPHER_CTX_free(_read_ctx); + _read_ctx = NULL; } if (_read_overflow_buffer != (unsigned char *)NULL) { @@ -211,7 +221,6 @@ open_write(ostream *dest, bool owns_dest, const string &password) { close_write(); _dest = dest; _owns_dest = owns_dest; - _write_valid = false; const EVP_CIPHER *cipher = EVP_get_cipherbyname(_algorithm.c_str()); @@ -219,22 +228,33 @@ open_write(ostream *dest, bool owns_dest, const string &password) { if (cipher == NULL) { prc_cat.error() << "Unknown encryption algorithm: " << _algorithm << "\n"; + + if (_write_ctx != NULL) { + EVP_CIPHER_CTX_free(_write_ctx); + _write_ctx = NULL; + } return; - }; + } int nid = EVP_CIPHER_nid(cipher); int iv_length = EVP_CIPHER_iv_length(cipher); _write_block_size = EVP_CIPHER_block_size(cipher); - unsigned char *iv = (unsigned char *)alloca(iv_length); - // Generate a random IV. It doesn't need to be cryptographically secure, // just unique. + unsigned char *iv = (unsigned char *)alloca(iv_length); RAND_pseudo_bytes(iv, iv_length); + if (_read_ctx != NULL) { + EVP_CIPHER_CTX_reset(_write_ctx); + } else { + _write_ctx = EVP_CIPHER_CTX_new(); + } + nassertv(_write_ctx != NULL); + int result; - result = EVP_EncryptInit(&_write_ctx, cipher, NULL, iv); + result = EVP_EncryptInit(_write_ctx, cipher, NULL, iv); nassertv(result > 0); // Store the appropriate key length in the context. @@ -242,12 +262,13 @@ open_write(ostream *dest, bool owns_dest, const string &password) { if (key_length == 0) { key_length = EVP_CIPHER_key_length(cipher); } - result = EVP_CIPHER_CTX_set_key_length(&_write_ctx, key_length); + result = EVP_CIPHER_CTX_set_key_length(_write_ctx, key_length); if (result <= 0) { prc_cat.error() << "Invalid key length " << key_length * 8 << " bits for algorithm " << OBJ_nid2sn(nid) << "\n"; - EVP_CIPHER_CTX_cleanup(&_write_ctx); + EVP_CIPHER_CTX_free(_write_ctx); + _write_ctx = NULL; return; } @@ -271,7 +292,7 @@ open_write(ostream *dest, bool owns_dest, const string &password) { nassertv(result > 0); // Store the key in the context. - result = EVP_EncryptInit(&_write_ctx, NULL, key, NULL); + result = EVP_EncryptInit(_write_ctx, NULL, key, NULL); nassertv(result > 0); // Now write the header information to the stream. @@ -284,7 +305,6 @@ open_write(ostream *dest, bool owns_dest, const string &password) { sw.add_uint16((uint16_t)count); sw.append_data(iv, iv_length); - _write_valid = true; thread_consider_yield(); } @@ -298,15 +318,16 @@ close_write() { write_chars(pbase(), n); pbump(-(int)n); - if (_write_valid) { + if (_write_ctx != NULL) { unsigned char *write_buffer = (unsigned char *)alloca(_write_block_size); int bytes_written = 0; - EVP_EncryptFinal(&_write_ctx, write_buffer, &bytes_written); + EVP_EncryptFinal(_write_ctx, write_buffer, &bytes_written); thread_consider_yield(); _dest->write((const char *)write_buffer, bytes_written); - _write_valid = false; + EVP_CIPHER_CTX_free(_write_ctx); + _write_ctx = NULL; } if (_owns_dest) { @@ -418,7 +439,7 @@ read_chars(char *start, size_t length) { do { // Get more bytes from the stream. - if (!_read_valid) { + if (_read_ctx == NULL) { return 0; } @@ -429,20 +450,21 @@ read_chars(char *start, size_t length) { int result; if (source_length != 0) { result = - EVP_DecryptUpdate(&_read_ctx, read_buffer, &bytes_read, + EVP_DecryptUpdate(_read_ctx, read_buffer, &bytes_read, source_buffer, source_length); } else { result = - EVP_DecryptFinal(&_read_ctx, read_buffer, &bytes_read); - _read_valid = false; + EVP_DecryptFinal(_read_ctx, read_buffer, &bytes_read); + EVP_CIPHER_CTX_free(_read_ctx); + _read_ctx = NULL; } if (result <= 0) { prc_cat.error() << "Error decrypting stream.\n"; - if (_read_valid) { - EVP_CIPHER_CTX_cleanup(&_read_ctx); - _read_valid = false; + if (_read_ctx != NULL) { + EVP_CIPHER_CTX_free(_read_ctx); + _read_ctx = NULL; } } thread_consider_yield(); @@ -472,13 +494,13 @@ read_chars(char *start, size_t length) { */ void EncryptStreamBuf:: write_chars(const char *start, size_t length) { - if (_write_valid && length != 0) { + if (_write_ctx != NULL && length != 0) { size_t max_write_buffer = length + _write_block_size; unsigned char *write_buffer = (unsigned char *)alloca(max_write_buffer); int bytes_written = 0; int result = - EVP_EncryptUpdate(&_write_ctx, write_buffer, &bytes_written, + EVP_EncryptUpdate(_write_ctx, write_buffer, &bytes_written, (unsigned char *)start, length); if (result <= 0) { prc_cat.error() diff --git a/dtool/src/prc/encryptStreamBuf.h b/dtool/src/prc/encryptStreamBuf.h index 0542457267..4861a89240 100644 --- a/dtool/src/prc/encryptStreamBuf.h +++ b/dtool/src/prc/encryptStreamBuf.h @@ -64,14 +64,12 @@ private: int _key_length; int _iteration_count; - bool _read_valid; - EVP_CIPHER_CTX _read_ctx; + EVP_CIPHER_CTX *_read_ctx; size_t _read_block_size; unsigned char *_read_overflow_buffer; size_t _in_read_overflow_buffer; - bool _write_valid; - EVP_CIPHER_CTX _write_ctx; + EVP_CIPHER_CTX *_write_ctx; size_t _write_block_size; }; diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index 26baaff0c1..f1ae5d7e7c 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -231,11 +231,7 @@ operator = (const HTTPClient ©) { */ HTTPClient:: ~HTTPClient() { - // Before we can free the context, we must remove the X509_STORE pointer - // from it, so it won't be destroyed along with it (this object is shared - // among all contexts). if (_ssl_ctx != (SSL_CTX *)NULL) { - _ssl_ctx->cert_store = NULL; SSL_CTX_free(_ssl_ctx); } @@ -1122,7 +1118,11 @@ get_ssl_ctx() { OpenSSLWrapper *sslw = OpenSSLWrapper::get_global_ptr(); sslw->notify_ssl_errors(); - SSL_CTX_set_cert_store(_ssl_ctx, sslw->get_x509_store()); + X509_STORE *store = sslw->get_x509_store(); + if (store != NULL) { + X509_STORE_up_ref(store); + } + SSL_CTX_set_cert_store(_ssl_ctx, store); return _ssl_ctx; } @@ -1511,15 +1511,17 @@ x509_name_subset(X509_NAME *name_a, X509_NAME *name_b) { for (int ai = 0; ai < count_a; ai++) { X509_NAME_ENTRY *na = X509_NAME_get_entry(name_a, ai); - int bi = X509_NAME_get_index_by_OBJ(name_b, na->object, -1); + int bi = X509_NAME_get_index_by_OBJ(name_b, X509_NAME_ENTRY_get_object(na), -1); if (bi < 0) { // This entry in name_a is not defined in name_b. return false; } X509_NAME_ENTRY *nb = X509_NAME_get_entry(name_b, bi); - if (na->value->length != nb->value->length || - memcmp(na->value->data, nb->value->data, na->value->length) != 0) { + ASN1_STRING *na_value = X509_NAME_ENTRY_get_data(na); + ASN1_STRING *nb_value = X509_NAME_ENTRY_get_data(nb); + if (na_value->length != nb_value->length || + memcmp(na_value->data, nb_value->data, na_value->length) != 0) { // This entry in name_a doesn't match that of name_b. return false; } From 28bb737597d527ef4184b5f935da7e316a19c2f4 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 24 Dec 2016 22:21:18 +0100 Subject: [PATCH 78/93] Load X11 extensions dynamically; don't expect them to be there at compile time Add x-cursor-size variable for overriding XCursor size. --- makepanda/makepanda.py | 22 +--- panda/src/display/get_x11.h | 13 -- panda/src/x11display/config_x11display.cxx | 5 + panda/src/x11display/config_x11display.h | 1 + panda/src/x11display/x11GraphicsPipe.I | 32 +++++ panda/src/x11display/x11GraphicsPipe.cxx | 140 +++++++++++++++++---- panda/src/x11display/x11GraphicsPipe.h | 56 +++++++++ panda/src/x11display/x11GraphicsWindow.cxx | 140 +++++++++++---------- panda/src/x11display/x11GraphicsWindow.h | 14 +-- 9 files changed, 288 insertions(+), 135 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index f2746881bd..f84beca1bf 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -88,7 +88,7 @@ PkgListSet(["PYTHON", "DIRECT", # Python support "MFC", "WX", "FLTK", # Used for web plug-in only "ROCKET", "AWESOMIUM", # GUI libraries "CARBON", "COCOA", # Mac OS X toolkits - "X11", "XF86DGA", "XRANDR", "XCURSOR", # Unix platform support + "X11", # Unix platform support "PANDATOOL", "PVIEW", "DEPLOYTOOLS", # Toolchain "SKEL", # Example SKEL project "PANDAFX", # Some distortion special lenses @@ -516,9 +516,6 @@ IncDirectory("ALWAYS", GetOutputDir()+"/include") if (COMPILER == "MSVC"): PkgDisable("X11") - PkgDisable("XRANDR") - PkgDisable("XF86DGA") - PkgDisable("XCURSOR") PkgDisable("GLES") PkgDisable("GLES2") PkgDisable("EGL") @@ -843,9 +840,6 @@ if (COMPILER=="GCC"): SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h") if not RUNTIME: SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h")) - SmartPkgEnable("XRANDR", "xrandr", "Xrandr", "X11/extensions/Xrandr.h") - SmartPkgEnable("XF86DGA", "xxf86dga", "Xxf86dga", "X11/extensions/xf86dga.h") - SmartPkgEnable("XCURSOR", "xcursor", "Xcursor", "X11/Xcursor/Xcursor.h") if GetHost() != "darwin": # Workaround for an issue where pkg-config does not include this path @@ -2194,9 +2188,6 @@ DTOOL_CONFIG=[ ("PHAVE_STDINT_H", '1', '1'), ("HAVE_RTTI", '1', '1'), ("HAVE_X11", 'UNDEF', '1'), - ("HAVE_XRANDR", 'UNDEF', '1'), - ("HAVE_XF86DGA", 'UNDEF', '1'), - ("HAVE_XCURSOR", 'UNDEF', '1'), ("IS_LINUX", 'UNDEF', '1'), ("IS_OSX", 'UNDEF', 'UNDEF'), ("IS_FREEBSD", 'UNDEF', 'UNDEF'), @@ -2301,9 +2292,6 @@ def WriteConfigSettings(): dtool_config["PHAVE_SYS_MALLOC_H"] = '1' dtool_config["HAVE_OPENAL_FRAMEWORK"] = '1' dtool_config["HAVE_X11"] = 'UNDEF' # We might have X11, but we don't need it. - dtool_config["HAVE_XRANDR"] = 'UNDEF' - dtool_config["HAVE_XF86DGA"] = 'UNDEF' - dtool_config["HAVE_XCURSOR"] = 'UNDEF' dtool_config["HAVE_GLX"] = 'UNDEF' dtool_config["IS_LINUX"] = 'UNDEF' dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF' @@ -4581,7 +4569,7 @@ if (GetTarget() not in ['windows', 'darwin'] and PkgSkip("GL")==0 and PkgSkip("X TargetAdd('libpandagl.dll', input='p3glgsg_glgsg.obj') TargetAdd('libpandagl.dll', input='p3glxdisplay_composite1.obj') TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11', 'XRANDR', 'XF86DGA', 'XCURSOR']) + TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'NVIDIACG', 'CGGL', 'X11']) # # DIRECTORY: panda/src/cocoadisplay/ @@ -4656,7 +4644,7 @@ if (PkgSkip("EGL")==0 and PkgSkip("GLES")==0 and PkgSkip("X11")==0 and not RUNTI TargetAdd('libpandagles.dll', input='p3glesgsg_glesgsg.obj') TargetAdd('libpandagles.dll', input='pandagles_egldisplay_composite1.obj') TargetAdd('libpandagles.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11', 'XRANDR', 'XF86DGA', 'XCURSOR']) + TargetAdd('libpandagles.dll', opts=['MODULE', 'GLES', 'EGL', 'X11']) # # DIRECTORY: panda/src/egldisplay/ @@ -4674,7 +4662,7 @@ if (PkgSkip("EGL")==0 and PkgSkip("GLES2")==0 and PkgSkip("X11")==0 and not RUNT TargetAdd('libpandagles2.dll', input='p3gles2gsg_gles2gsg.obj') TargetAdd('libpandagles2.dll', input='pandagles2_egldisplay_composite1.obj') TargetAdd('libpandagles2.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11', 'XRANDR', 'XF86DGA', 'XCURSOR']) + TargetAdd('libpandagles2.dll', opts=['MODULE', 'GLES2', 'EGL', 'X11']) # # DIRECTORY: panda/src/ode/ @@ -4970,7 +4958,7 @@ if (not RUNTIME and (GetTarget() in ('windows', 'darwin') or PkgSkip("X11")==0) TargetAdd('libp3tinydisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM']) else: TargetAdd('libp3tinydisplay.dll', input='p3x11display_composite1.obj') - TargetAdd('libp3tinydisplay.dll', opts=['X11', 'XRANDR', 'XF86DGA', 'XCURSOR']) + TargetAdd('libp3tinydisplay.dll', opts=['X11']) TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite1.obj') TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite2.obj') TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_1.obj') diff --git a/panda/src/display/get_x11.h b/panda/src/display/get_x11.h index c188164598..f9112766d7 100644 --- a/panda/src/display/get_x11.h +++ b/panda/src/display/get_x11.h @@ -49,19 +49,6 @@ struct XVisualInfo; #include #include #include - -#ifdef HAVE_XRANDR -#include -#endif // HAVE_XRANDR - -#ifdef HAVE_XCURSOR -#include -#endif - -#ifdef HAVE_XF86DGA -#include -#endif - #include "post_x11_include.h" #endif // CPPPARSER diff --git a/panda/src/x11display/config_x11display.cxx b/panda/src/x11display/config_x11display.cxx index 13b225e418..c2b89c42b2 100644 --- a/panda/src/x11display/config_x11display.cxx +++ b/panda/src/x11display/config_x11display.cxx @@ -60,6 +60,11 @@ ConfigVariableInt x_wheel_right_button "mouse button number does the system report when one scrolls " "to the right?")); +ConfigVariableInt x_cursor_size +("x-cursor-size", -1, + PRC_DESC("This sets the cursor size when using XCursor to change the mouse " + "cursor. The default is to use the default size for the display.")); + ConfigVariableString x_wm_class_name ("x-wm-class-name", "", PRC_DESC("Specify the value to use for the res_name field of the window's " diff --git a/panda/src/x11display/config_x11display.h b/panda/src/x11display/config_x11display.h index 88fb2f2133..bc40aad627 100644 --- a/panda/src/x11display/config_x11display.h +++ b/panda/src/x11display/config_x11display.h @@ -32,6 +32,7 @@ extern ConfigVariableInt x_wheel_down_button; extern ConfigVariableInt x_wheel_left_button; extern ConfigVariableInt x_wheel_right_button; +extern ConfigVariableInt x_cursor_size; extern ConfigVariableString x_wm_class_name; extern ConfigVariableString x_wm_class; diff --git a/panda/src/x11display/x11GraphicsPipe.I b/panda/src/x11display/x11GraphicsPipe.I index cb452bef23..fb56700299 100644 --- a/panda/src/x11display/x11GraphicsPipe.I +++ b/panda/src/x11display/x11GraphicsPipe.I @@ -57,6 +57,38 @@ get_hidden_cursor() { return _hidden_cursor; } +/** + * Returns true if relative mouse mode is supported on this display. + */ +INLINE bool x11GraphicsPipe:: +supports_relative_mouse() const { + return (_XF86DGADirectVideo != NULL); +} + +/** + * Enables relative mouse mode for this display. Returns false if unsupported. + */ +INLINE bool x11GraphicsPipe:: +enable_relative_mouse() { + if (_XF86DGADirectVideo != NULL) { + x11display_cat.info() << "Enabling relative mouse using XF86DGA extension\n"; + _XF86DGADirectVideo(_display, _screen, XF86DGADirectMouse); + return true; + } + return false; +} + +/** + * Disables relative mouse mode for this display. + */ +INLINE void x11GraphicsPipe:: +disable_relative_mouse() { + if (_XF86DGADirectVideo != NULL) { + x11display_cat.info() << "Disabling relative mouse using XF86DGA extension\n"; + _XF86DGADirectVideo(_display, _screen, 0); + } +} + /** * Globally disables the printing of error messages that are raised by the X11 * system, for instance in order to test whether a particular X11 operation diff --git a/panda/src/x11display/x11GraphicsPipe.cxx b/panda/src/x11display/x11GraphicsPipe.cxx index 9eee9f6d7a..a0d4e8ffae 100644 --- a/panda/src/x11display/x11GraphicsPipe.cxx +++ b/panda/src/x11display/x11GraphicsPipe.cxx @@ -17,6 +17,8 @@ #include "frameBufferProperties.h" #include "displayInformation.h" +#include + TypeHandle x11GraphicsPipe::_type_handle; bool x11GraphicsPipe::_error_handlers_installed = false; @@ -31,7 +33,11 @@ LightReMutex x11GraphicsPipe::_x_mutex; * */ x11GraphicsPipe:: -x11GraphicsPipe(const string &display) { +x11GraphicsPipe(const string &display) : + _have_xrandr(false), + _xcursor_size(-1), + _XF86DGADirectVideo(NULL) { + string display_spec = display; if (display_spec.empty()) { display_spec = display_cfg; @@ -86,34 +92,116 @@ x11GraphicsPipe(const string &display) { _display_height = DisplayHeight(_display, _screen); _is_valid = true; -#ifdef HAVE_XRANDR - // Use Xrandr to fill in the supported resolution list. - int num_sizes, num_rates; - XRRScreenSize *xrrs; - xrrs = XRRSizes(_display, 0, &num_sizes); - _display_information->_total_display_modes = 0; - for (int i = 0; i < num_sizes; ++i) { - XRRRates(_display, 0, i, &num_rates); - _display_information->_total_display_modes += num_rates; - } + // Dynamically load the xf86dga extension. + void *xf86dga = dlopen("libXxf86dga.so.1", RTLD_NOW | RTLD_LOCAL); + if (xf86dga != NULL) { + pfn_XF86DGAQueryVersion _XF86DGAQueryVersion = (pfn_XF86DGAQueryVersion)dlsym(xf86dga, "XF86DGAQueryVersion"); + _XF86DGADirectVideo = (pfn_XF86DGADirectVideo)dlsym(xf86dga, "XF86DGADirectVideo"); - short *rates; - short counter = 0; - _display_information->_display_mode_array = new DisplayMode[_display_information->_total_display_modes]; - for (int i = 0; i < num_sizes; ++i) { - int num_rates; - rates = XRRRates(_display, 0, i, &num_rates); - for (int j = 0; j < num_rates; ++j) { - DisplayMode* dm = _display_information->_display_mode_array + counter; - dm->width = xrrs[i].width; - dm->height = xrrs[i].height; - dm->refresh_rate = rates[j]; - dm->bits_per_pixel = -1; - dm->fullscreen_only = false; - ++counter; + int major_ver, minor_ver; + if (_XF86DGAQueryVersion == NULL || _XF86DGADirectVideo == NULL) { + x11display_cat.warning() + << "libXxf86dga.so.1 does not provide required functions; relative mouse mode will not work.\n"; + + } else if (!_XF86DGAQueryVersion(_display, &major_ver, &minor_ver)) { + _XF86DGADirectVideo = NULL; + } + } else { + _XF86DGADirectVideo = NULL; + if (x11display_cat.is_debug()) { + x11display_cat.debug() + << "cannot dlopen libXxf86dga.so.1; cursor changing will not work.\n"; + } + } + + // Dynamically load the XCursor extension. + void *xcursor = dlopen("libXcursor.so.1", RTLD_NOW | RTLD_LOCAL); + if (xcursor != NULL) { + pfn_XcursorGetDefaultSize _XcursorGetDefaultSize = (pfn_XcursorGetDefaultSize)dlsym(xcursor, "XcursorGetDefaultSize"); + _XcursorXcFileLoadImages = (pfn_XcursorXcFileLoadImages)dlsym(xcursor, "XcursorXcFileLoadImages"); + _XcursorImagesLoadCursor = (pfn_XcursorImagesLoadCursor)dlsym(xcursor, "XcursorImagesLoadCursor"); + _XcursorImagesDestroy = (pfn_XcursorImagesDestroy)dlsym(xcursor, "XcursorImagesDestroy"); + _XcursorImageCreate = (pfn_XcursorImageCreate)dlsym(xcursor, "XcursorImageCreate"); + _XcursorImageLoadCursor = (pfn_XcursorImageLoadCursor)dlsym(xcursor, "XcursorImageLoadCursor"); + _XcursorImageDestroy = (pfn_XcursorImageDestroy)dlsym(xcursor, "XcursorImageDestroy"); + + if (_XcursorGetDefaultSize == NULL || _XcursorXcFileLoadImages == NULL || + _XcursorImagesLoadCursor == NULL || _XcursorImagesDestroy == NULL || + _XcursorImageCreate == NULL || _XcursorImageLoadCursor == NULL || + _XcursorImageDestroy == NULL) { + _xcursor_size = -1; + x11display_cat.warning() + << "libXcursor.so.1 does not provide required functions; cursor changing will not work.\n"; + + } else if (x_cursor_size.get_value() >= 0) { + _xcursor_size = x_cursor_size; + } else { + _xcursor_size = _XcursorGetDefaultSize(_display); + } + } else { + _xcursor_size = -1; + if (x11display_cat.is_debug()) { + x11display_cat.debug() + << "cannot dlopen libXcursor.so.1; cursor changing will not work.\n"; + } + } + + // Dynamically load the XRandr extension. + void *xrandr = dlopen("libXrandr.so.2", RTLD_NOW | RTLD_LOCAL); + if (xrandr != NULL) { + pfn_XRRQueryExtension _XRRQueryExtension = (pfn_XRRQueryExtension)dlsym(xrandr, "XRRQueryExtension"); + _XRRSizes = (pfn_XRRSizes)dlsym(xrandr, "XRRSizes"); + _XRRRates = (pfn_XRRRates)dlsym(xrandr, "XRRRates"); + _XRRGetScreenInfo = (pfn_XRRGetScreenInfo)dlsym(xrandr, "XRRGetScreenInfo"); + _XRRConfigCurrentConfiguration = (pfn_XRRConfigCurrentConfiguration)dlsym(xrandr, "XRRConfigCurrentConfiguration"); + _XRRSetScreenConfig = (pfn_XRRSetScreenConfig)dlsym(xrandr, "XRRSetScreenConfig"); + + if (_XRRQueryExtension == NULL || _XRRSizes == NULL || _XRRRates == NULL || + _XRRGetScreenInfo == NULL || _XRRConfigCurrentConfiguration == NULL || + _XRRSetScreenConfig == NULL) { + _have_xrandr = false; + x11display_cat.warning() + << "libXrandr.so.2 does not provide required functions; resolution setting will not work.\n"; + } else { + int event, error; + _have_xrandr = _XRRQueryExtension(_display, &event, &error); + } + } else { + _have_xrandr = false; + if (x11display_cat.is_debug()) { + x11display_cat.debug() + << "cannot dlopen libXrandr.so.2; resolution setting will not work.\n"; + } + } + + // Use Xrandr to fill in the supported resolution list. + if (_have_xrandr) { + int num_sizes, num_rates; + XRRScreenSize *xrrs; + xrrs = _XRRSizes(_display, 0, &num_sizes); + _display_information->_total_display_modes = 0; + for (int i = 0; i < num_sizes; ++i) { + _XRRRates(_display, 0, i, &num_rates); + _display_information->_total_display_modes += num_rates; + } + + short *rates; + short counter = 0; + _display_information->_display_mode_array = new DisplayMode[_display_information->_total_display_modes]; + for (int i = 0; i < num_sizes; ++i) { + int num_rates; + rates = _XRRRates(_display, 0, i, &num_rates); + for (int j = 0; j < num_rates; ++j) { + DisplayMode* dm = _display_information->_display_mode_array + counter; + dm->width = xrrs[i].width; + dm->height = xrrs[i].height; + dm->refresh_rate = rates[j]; + dm->bits_per_pixel = -1; + dm->fullscreen_only = false; + ++counter; + } } } -#endif // Connect to an input method for supporting international text entry. _im = XOpenIM(_display, NULL, NULL, NULL); diff --git a/panda/src/x11display/x11GraphicsPipe.h b/panda/src/x11display/x11GraphicsPipe.h index ab06a9b692..4da09d3144 100644 --- a/panda/src/x11display/x11GraphicsPipe.h +++ b/panda/src/x11display/x11GraphicsPipe.h @@ -21,6 +21,22 @@ #include "lightReMutex.h" #include "windowHandle.h" #include "get_x11.h" +#include "config_x11display.h" + +// Excerpt the few definitions we need for the extensions. +#define XF86DGADirectMouse 0x0004 + +typedef struct _XcursorFile XcursorFile; +typedef struct _XcursorImage XcursorImage; +typedef struct _XcursorImages XcursorImages; + +typedef unsigned short Rotation; +typedef unsigned short SizeID; +typedef struct _XRRScreenConfiguration XRRScreenConfiguration; +typedef struct { + int width, height; + int mwidth, mheight; +} XRRScreenSize; class FrameBufferProperties; @@ -40,6 +56,10 @@ public: INLINE X11_Cursor get_hidden_cursor(); + INLINE bool supports_relative_mouse() const; + INLINE bool enable_relative_mouse(); + INLINE void disable_relative_mouse(); + static INLINE int disable_x_error_messages(); static INLINE int enable_x_error_messages(); static INLINE int get_x_error_count(); @@ -61,6 +81,38 @@ public: Atom _net_wm_state_add; Atom _net_wm_state_remove; + // Extension functions. + typedef int (*pfn_XcursorGetDefaultSize)(X11_Display *); + typedef XcursorImages *(*pfn_XcursorXcFileLoadImages)(XcursorFile *, int); + typedef X11_Cursor (*pfn_XcursorImagesLoadCursor)(X11_Display *, const XcursorImages *); + typedef void (*pfn_XcursorImagesDestroy)(XcursorImages *); + typedef XcursorImage *(*pfn_XcursorImageCreate)(int, int); + typedef X11_Cursor (*pfn_XcursorImageLoadCursor)(X11_Display *, const XcursorImage *); + typedef void (*pfn_XcursorImageDestroy)(XcursorImage *); + + int _xcursor_size; + pfn_XcursorXcFileLoadImages _XcursorXcFileLoadImages; + pfn_XcursorImagesLoadCursor _XcursorImagesLoadCursor; + pfn_XcursorImagesDestroy _XcursorImagesDestroy; + pfn_XcursorImageCreate _XcursorImageCreate; + pfn_XcursorImageLoadCursor _XcursorImageLoadCursor; + pfn_XcursorImageDestroy _XcursorImageDestroy; + + typedef Bool (*pfn_XRRQueryExtension)(X11_Display *, int*, int*); + typedef XRRScreenSize *(*pfn_XRRSizes)(X11_Display*, int, int*); + typedef short *(*pfn_XRRRates)(X11_Display*, int, int, int*); + typedef XRRScreenConfiguration *(*pfn_XRRGetScreenInfo)(X11_Display*, X11_Window); + typedef SizeID (*pfn_XRRConfigCurrentConfiguration)(XRRScreenConfiguration*, Rotation*); + typedef Status (*pfn_XRRSetScreenConfig)(X11_Display*, XRRScreenConfiguration *, + Drawable, int, Rotation, Time); + + bool _have_xrandr; + pfn_XRRSizes _XRRSizes; + pfn_XRRRates _XRRRates; + pfn_XRRGetScreenInfo _XRRGetScreenInfo; + pfn_XRRConfigCurrentConfiguration _XRRConfigCurrentConfiguration; + pfn_XRRSetScreenConfig _XRRSetScreenConfig; + protected: X11_Display *_display; int _screen; @@ -69,6 +121,10 @@ protected: X11_Cursor _hidden_cursor; + typedef Bool (*pfn_XF86DGAQueryVersion)(X11_Display *, int*, int*); + typedef Status (*pfn_XF86DGADirectVideo)(X11_Display *, int, int); + pfn_XF86DGADirectVideo _XF86DGADirectVideo; + private: void make_hidden_cursor(); void release_hidden_cursor(); diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 732932a1e4..3ea2cd3fb0 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -38,7 +38,24 @@ #include #endif -#ifdef HAVE_XCURSOR +struct _XcursorFile { + void *closure; + int (*read)(XcursorFile *, unsigned char *, int); + int (*write)(XcursorFile *, unsigned char *, int); + int (*seek)(XcursorFile *, long, int); +}; + +typedef struct _XcursorImage { + unsigned int version; + unsigned int size; + unsigned int width; + unsigned int height; + unsigned int xhot; + unsigned int yhot; + unsigned int delay; + unsigned int *pixels; +} XcursorImage; + static int xcursor_read(XcursorFile *file, unsigned char *buf, int len) { istream* str = (istream*) file->closure; str->read((char*) buf, len); @@ -66,7 +83,6 @@ static int xcursor_seek(XcursorFile *file, long offset, int whence) { return str->tellg(); } -#endif TypeHandle x11GraphicsWindow::_type_handle; @@ -92,14 +108,14 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, _xwindow = (X11_Window)NULL; _ic = (XIC)NULL; _visual_info = NULL; - -#ifdef HAVE_XRANDR _orig_size_id = -1; - int event, error; - _have_xrandr = XRRQueryExtension(_display, &event, &error); -#else - _have_xrandr = false; -#endif + + if (x11_pipe->_have_xrandr) { + // We may still need these functions after the pipe is already destroyed, + // so we copy them into the x11GraphicsWindow. + _XRRGetScreenInfo = x11_pipe->_XRRGetScreenInfo; + _XRRSetScreenConfig = x11_pipe->_XRRSetScreenConfig; + } _awaiting_configure = false; _dga_mouse_enabled = false; @@ -474,10 +490,9 @@ set_properties_now(WindowProperties &properties) { if (is_fullscreen != want_fullscreen || (is_fullscreen && properties.has_size())) { if (want_fullscreen) { - if (_have_xrandr) { -#ifdef HAVE_XRANDR - XRRScreenConfiguration* conf = XRRGetScreenInfo(_display, x11_pipe->get_root()); - SizeID old_size_id = XRRConfigCurrentConfiguration(conf, &_orig_rotation); + if (x11_pipe->_have_xrandr) { + XRRScreenConfiguration* conf = _XRRGetScreenInfo(_display, x11_pipe->get_root()); + SizeID old_size_id = x11_pipe->_XRRConfigCurrentConfiguration(conf, &_orig_rotation); SizeID new_size_id = (SizeID) -1; int num_sizes = 0, reqsizex, reqsizey; if (properties.has_size()) { @@ -488,7 +503,7 @@ set_properties_now(WindowProperties &properties) { reqsizey = _properties.get_y_size(); } XRRScreenSize *xrrs; - xrrs = XRRSizes(_display, 0, &num_sizes); + xrrs = x11_pipe->_XRRSizes(_display, 0, &num_sizes); for (int i = 0; i < num_sizes; ++i) { if (xrrs[i].width == reqsizex && xrrs[i].height == reqsizey) { @@ -502,14 +517,13 @@ set_properties_now(WindowProperties &properties) { } else { if (new_size_id != old_size_id) { - XRRSetScreenConfig(_display, conf, x11_pipe->get_root(), new_size_id, _orig_rotation, CurrentTime); + _XRRSetScreenConfig(_display, conf, x11_pipe->get_root(), new_size_id, _orig_rotation, CurrentTime); if (_orig_size_id == (SizeID) -1) { // Remember the original resolution so we can switch back to it. _orig_size_id = old_size_id; } } } -#endif } else { // If we don't have Xrandr support, we fake the fullscreen support by // setting the window size to the desktop size. @@ -517,15 +531,13 @@ set_properties_now(WindowProperties &properties) { x11_pipe->get_display_height()); } } else { -#ifdef HAVE_XRANDR // Change the resolution back to what it was. Don't remove the SizeID // typecast! - if (_have_xrandr && _orig_size_id != (SizeID) -1) { - XRRScreenConfiguration* conf = XRRGetScreenInfo(_display, x11_pipe->get_root()); - XRRSetScreenConfig(_display, conf, x11_pipe->get_root(), _orig_size_id, _orig_rotation, CurrentTime); + if (_orig_size_id != (SizeID) -1) { + XRRScreenConfiguration *conf = _XRRGetScreenInfo(_display, x11_pipe->get_root()); + _XRRSetScreenConfig(_display, conf, x11_pipe->get_root(), _orig_size_id, _orig_rotation, CurrentTime); _orig_size_id = (SizeID) -1; } -#endif // Set the origin back to what it was if (!properties.has_origin() && _properties.has_origin()) { properties.set_origin(_properties.get_x_origin(), _properties.get_y_origin()); @@ -686,23 +698,17 @@ set_properties_now(WindowProperties &properties) { switch (properties.get_mouse_mode()) { case WindowProperties::M_absolute: XUngrabPointer(_display, CurrentTime); -#ifdef HAVE_XF86DGA if (_dga_mouse_enabled) { - x11display_cat.info() << "Disabling relative mouse using XF86DGA extension\n"; - XF86DGADirectVideo(_display, _screen, 0); + x11_pipe->disable_relative_mouse(); _dga_mouse_enabled = false; } -#endif _properties.set_mouse_mode(WindowProperties::M_absolute); properties.clear_mouse_mode(); break; case WindowProperties::M_relative: -#ifdef HAVE_XF86DGA if (!_dga_mouse_enabled) { - int major_ver, minor_ver; - if (XF86DGAQueryVersion(_display, &major_ver, &minor_ver)) { - + if (x11_pipe->supports_relative_mouse()) { X11_Cursor cursor = None; if (_properties.get_cursor_hidden()) { x11GraphicsPipe *x11_pipe; @@ -714,8 +720,7 @@ set_properties_now(WindowProperties &properties) { GrabModeAsync, _xwindow, cursor, CurrentTime) != GrabSuccess) { x11display_cat.error() << "Failed to grab pointer!\n"; } else { - x11display_cat.info() << "Enabling relative mouse using XF86DGA extension\n"; - XF86DGADirectVideo(_display, _screen, XF86DGADirectMouse); + x11_pipe->enable_relative_mouse(); _properties.set_mouse_mode(WindowProperties::M_relative); properties.clear_mouse_mode(); @@ -730,25 +735,24 @@ set_properties_now(WindowProperties &properties) { _input_devices[0].set_pointer_in_window(event.xbutton.x, event.xbutton.y); } } else { - x11display_cat.info() << "XF86DGA extension not available\n"; + x11display_cat.info() + << "XF86DGA extension not available, cannot enable relative mouse mode\n"; _dga_mouse_enabled = false; } } -#endif break; case WindowProperties::M_confined: { -#ifdef HAVE_XF86DGA + x11GraphicsPipe *x11_pipe; + DCAST_INTO_V(x11_pipe, _pipe); + if (_dga_mouse_enabled) { - XF86DGADirectVideo(_display, _screen, 0); + x11_pipe->disable_relative_mouse(); _dga_mouse_enabled = false; } -#endif X11_Cursor cursor = None; if (_properties.get_cursor_hidden()) { - x11GraphicsPipe *x11_pipe; - DCAST_INTO_V(x11_pipe, _pipe); cursor = x11_pipe->get_hidden_cursor(); } @@ -813,10 +817,9 @@ close_window() { XFlush(_display); } -#ifdef HAVE_XRANDR // Change the resolution back to what it was. Don't remove the SizeID // typecast! - if (_have_xrandr && _orig_size_id != (SizeID) -1) { + if (_orig_size_id != (SizeID) -1) { X11_Window root; if (_pipe != NULL) { x11GraphicsPipe *x11_pipe; @@ -827,11 +830,10 @@ close_window() { // closed. Oh well, let's get the root window by ourselves. root = RootWindow(_display, _screen); } - XRRScreenConfiguration* conf = XRRGetScreenInfo(_display, root); - XRRSetScreenConfig(_display, conf, root, _orig_size_id, _orig_rotation, CurrentTime); + XRRScreenConfiguration *conf = _XRRGetScreenInfo(_display, root); + _XRRSetScreenConfig(_display, conf, root, _orig_size_id, _orig_rotation, CurrentTime); _orig_size_id = -1; } -#endif GraphicsWindow::close_window(); } @@ -859,15 +861,14 @@ open_window() { _properties.set_size(100, 100); } -#ifdef HAVE_XRANDR - if (_properties.get_fullscreen() && _have_xrandr) { - XRRScreenConfiguration* conf = XRRGetScreenInfo(_display, x11_pipe->get_root()); + if (_properties.get_fullscreen() && x11_pipe->_have_xrandr) { + XRRScreenConfiguration* conf = _XRRGetScreenInfo(_display, x11_pipe->get_root()); if (_orig_size_id == (SizeID) -1) { - _orig_size_id = XRRConfigCurrentConfiguration(conf, &_orig_rotation); + _orig_size_id = x11_pipe->_XRRConfigCurrentConfiguration(conf, &_orig_rotation); } int num_sizes, new_size_id = -1; XRRScreenSize *xrrs; - xrrs = XRRSizes(_display, 0, &num_sizes); + xrrs = x11_pipe->_XRRSizes(_display, 0, &num_sizes); for (int i = 0; i < num_sizes; ++i) { if (xrrs[i].width == _properties.get_x_size() && xrrs[i].height == _properties.get_y_size()) { @@ -882,12 +883,11 @@ open_window() { return false; } if (new_size_id != _orig_size_id) { - XRRSetScreenConfig(_display, conf, x11_pipe->get_root(), new_size_id, _orig_rotation, CurrentTime); + _XRRSetScreenConfig(_display, conf, x11_pipe->get_root(), new_size_id, _orig_rotation, CurrentTime); } else { _orig_size_id = -1; } } -#endif X11_Window parent_window = x11_pipe->get_root(); WindowHandle *window_handle = _properties.get_parent_window(); @@ -2081,11 +2081,15 @@ check_event(X11_Display *display, XEvent *event, char *arg) { */ X11_Cursor x11GraphicsWindow:: get_cursor(const Filename &filename) { -#ifndef HAVE_XCURSOR - x11display_cat.info() - << "XCursor support not enabled in build; cannot change mouse cursor.\n"; - return None; -#else // HAVE_XCURSOR + x11GraphicsPipe *x11_pipe; + DCAST_INTO_R(x11_pipe, _pipe, None); + + if (x11_pipe->_xcursor_size == -1) { + x11display_cat.info() + << "libXcursor.so.1 not available; cannot change mouse cursor.\n"; + return None; + } + // First, look for the unresolved filename in our index. pmap::iterator fi = _cursor_filenames.find(filename); if (fi != _cursor_filenames.end()) { @@ -2135,10 +2139,10 @@ get_cursor(const Filename &filename) { xcfile.write = &xcursor_write; xcfile.seek = &xcursor_seek; - XcursorImages *images = XcursorXcFileLoadImages(&xcfile, XcursorGetDefaultSize(_display)); + XcursorImages *images = x11_pipe->_XcursorXcFileLoadImages(&xcfile, x11_pipe->_xcursor_size); if (images != NULL) { - h = XcursorImagesLoadCursor(_display, images); - XcursorImagesDestroy(images); + h = x11_pipe->_XcursorImagesLoadCursor(_display, images); + x11_pipe->_XcursorImagesDestroy(images); } } else if (memcmp(magic, "\0\0\1\0", 4) == 0 @@ -2159,18 +2163,19 @@ get_cursor(const Filename &filename) { _cursor_filenames[resolved] = h; return h; -#endif // HAVE_XCURSOR } -#ifdef HAVE_XCURSOR /** * Reads a Windows .ico or .cur file from the indicated stream and returns it * as an X11 Cursor. If the file cannot be loaded, returns None. */ X11_Cursor x11GraphicsWindow:: read_ico(istream &ico) { - // Local structs, this is just POD, make input easier - typedef struct { + x11GraphicsPipe *x11_pipe; + DCAST_INTO_R(x11_pipe, _pipe, None); + + // Local structs, this is just POD, make input easier + typedef struct { uint16_t reserved, type, count; } IcoHeader; @@ -2204,7 +2209,7 @@ read_ico(istream &ico) { XcursorImage *image = NULL; X11_Cursor ret = None; - int def_size = XcursorGetDefaultSize(_display); + int def_size = x11_pipe->_xcursor_size; // Get our header, note that ICO = type 1 and CUR = type 2. ico.read(reinterpret_cast(&header), sizeof(IcoHeader)); @@ -2240,7 +2245,7 @@ read_ico(istream &ico) { } img.set_maxval(255); - image = XcursorImageCreate(img.get_x_size(), img.get_y_size()); + image = x11_pipe->_XcursorImageCreate(img.get_x_size(), img.get_y_size()); xel *ptr = img.get_array(); xelval *alpha = img.get_alpha_array(); @@ -2285,7 +2290,7 @@ read_ico(istream &ico) { ico.read(andBmp, andBmpSize); if (!ico.good()) goto cleanup; - image = XcursorImageCreate(infoHeader.width, infoHeader.height / 2); + image = x11_pipe->_XcursorImageCreate(infoHeader.width, infoHeader.height / 2); // Support all the formats that GIMP supports. switch (bitsPerPixel) { @@ -2370,10 +2375,10 @@ read_ico(istream &ico) { image->yhot = 0; } - ret = XcursorImageLoadCursor(_display, image); + ret = x11_pipe->_XcursorImageLoadCursor(_display, image); cleanup: - XcursorImageDestroy(image); + x11_pipe->_XcursorImageDestroy(image); delete[] entries; delete[] palette; delete[] xorBmp; @@ -2381,4 +2386,3 @@ cleanup: return ret; } -#endif // HAVE_XCURSOR diff --git a/panda/src/x11display/x11GraphicsWindow.h b/panda/src/x11display/x11GraphicsWindow.h index fe160284f8..5b55bf3619 100644 --- a/panda/src/x11display/x11GraphicsWindow.h +++ b/panda/src/x11display/x11GraphicsWindow.h @@ -20,11 +20,6 @@ #include "graphicsWindow.h" #include "buttonHandle.h" -#ifdef HAVE_XRANDR -typedef unsigned short Rotation; -typedef unsigned short SizeID; -#endif - /** * Interfaces to the X11 window system. */ @@ -76,9 +71,7 @@ protected: private: X11_Cursor get_cursor(const Filename &filename); -#ifdef HAVE_XCURSOR X11_Cursor read_ico(istream &ico); -#endif protected: X11_Display *_display; @@ -87,12 +80,8 @@ protected: Colormap _colormap; XIC _ic; XVisualInfo *_visual_info; - - bool _have_xrandr; -#ifdef HAVE_XRANDR Rotation _orig_rotation; SizeID _orig_size_id; -#endif LVecBase2i _fixed_size; @@ -109,6 +98,9 @@ protected: }; pvector _mouse_device_info; + x11GraphicsPipe::pfn_XRRGetScreenInfo _XRRGetScreenInfo; + x11GraphicsPipe::pfn_XRRSetScreenConfig _XRRSetScreenConfig; + public: static TypeHandle get_class_type() { return _type_handle; From 45356e85e148f40d4111ce9b101aeae1d5954c88 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 11:48:38 +0100 Subject: [PATCH 79/93] Backward compat with older OpenSSL versions --- dtool/src/prc/encryptStreamBuf.cxx | 27 +++++++-------------------- panda/src/downloader/httpClient.cxx | 8 ++++++++ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/dtool/src/prc/encryptStreamBuf.cxx b/dtool/src/prc/encryptStreamBuf.cxx index fed8b8e7b6..6cb0ee6b39 100644 --- a/dtool/src/prc/encryptStreamBuf.cxx +++ b/dtool/src/prc/encryptStreamBuf.cxx @@ -111,6 +111,11 @@ open_read(istream *source, bool owns_source, const string &password) { _source = source; _owns_source = owns_source; + if (_read_ctx != NULL) { + EVP_CIPHER_CTX_free(_read_ctx); + _read_ctx = NULL; + } + // Now read the header information. StreamReader sr(_source, false); int nid = sr.get_uint16(); @@ -122,11 +127,6 @@ open_read(istream *source, bool owns_source, const string &password) { if (cipher == NULL) { prc_cat.error() << "Unknown encryption algorithm in stream.\n"; - - if (_read_ctx != NULL) { - EVP_CIPHER_CTX_free(_read_ctx); - _read_ctx = NULL; - } return; } @@ -147,11 +147,7 @@ open_read(istream *source, bool owns_source, const string &password) { string iv = sr.extract_bytes(iv_length); - if (_read_ctx != NULL) { - EVP_CIPHER_CTX_reset(_read_ctx); - } else { - _read_ctx = EVP_CIPHER_CTX_new(); - } + _read_ctx = EVP_CIPHER_CTX_new(); nassertv(_read_ctx != NULL); // Initialize the context @@ -228,11 +224,6 @@ open_write(ostream *dest, bool owns_dest, const string &password) { if (cipher == NULL) { prc_cat.error() << "Unknown encryption algorithm: " << _algorithm << "\n"; - - if (_write_ctx != NULL) { - EVP_CIPHER_CTX_free(_write_ctx); - _write_ctx = NULL; - } return; } @@ -246,11 +237,7 @@ open_write(ostream *dest, bool owns_dest, const string &password) { unsigned char *iv = (unsigned char *)alloca(iv_length); RAND_pseudo_bytes(iv, iv_length); - if (_read_ctx != NULL) { - EVP_CIPHER_CTX_reset(_write_ctx); - } else { - _write_ctx = EVP_CIPHER_CTX_new(); - } + _write_ctx = EVP_CIPHER_CTX_new(); nassertv(_write_ctx != NULL); int result; diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index f1ae5d7e7c..63ba1c6258 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -232,6 +232,12 @@ operator = (const HTTPClient ©) { HTTPClient:: ~HTTPClient() { if (_ssl_ctx != (SSL_CTX *)NULL) { +#if OPENSSL_VERSION_NUMBER < 0x10100000 + // Before we can free the context, we must remove the X509_STORE pointer + // from it, so it won't be destroyed along with it (this object is shared + // among all contexts). + _ssl_ctx->cert_store = NULL; +#endif SSL_CTX_free(_ssl_ctx); } @@ -1119,9 +1125,11 @@ get_ssl_ctx() { sslw->notify_ssl_errors(); X509_STORE *store = sslw->get_x509_store(); +#if OPENSSL_VERSION_NUMBER >= 0x10100000 if (store != NULL) { X509_STORE_up_ref(store); } +#endif SSL_CTX_set_cert_store(_ssl_ctx, store); return _ssl_ctx; From 59c3aa3ef6a090592b7ee32e7b4ca229c6ffe649 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 09:59:29 -0500 Subject: [PATCH 80/93] cocoa: don't crash if display server doesn't give us display modes --- panda/src/cocoadisplay/cocoaGraphicsPipe.mm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsPipe.mm b/panda/src/cocoadisplay/cocoaGraphicsPipe.mm index 1969ac4116..367b00c520 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsPipe.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsPipe.mm @@ -148,11 +148,14 @@ load_display_information() { //_display_information->_device_id = CGDisplaySerialNumber(_display); // Display modes + size_t num_modes = 0; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 CFArrayRef modes = CGDisplayCopyAllDisplayModes(_display, NULL); - size_t num_modes = CFArrayGetCount(modes); - _display_information->_total_display_modes = num_modes; - _display_information->_display_mode_array = new DisplayMode[num_modes]; + if (modes != NULL) { + num_modes = CFArrayGetCount(modes); + _display_information->_total_display_modes = num_modes; + _display_information->_display_mode_array = new DisplayMode[num_modes]; + } for (size_t i = 0; i < num_modes; ++i) { CGDisplayModeRef mode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); @@ -189,13 +192,17 @@ load_display_information() { } CFRelease(encoding); } - CFRelease(modes); + if (modes != NULL) { + CFRelease(modes); + } #else CFArrayRef modes = CGDisplayAvailableModes(_display); - size_t num_modes = CFArrayGetCount(modes); - _display_information->_total_display_modes = num_modes; - _display_information->_display_mode_array = new DisplayMode[num_modes]; + if (modes != NULL) { + num_modes = CFArrayGetCount(modes); + _display_information->_total_display_modes = num_modes; + _display_information->_display_mode_array = new DisplayMode[num_modes]; + } for (size_t i = 0; i < num_modes; ++i) { CFDictionaryRef mode = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i); From 23a345437a0edd7fcb1b3a1585d847f6134dfe49 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 16:10:06 +0100 Subject: [PATCH 81/93] makewheel changes for macOS, manylinux1, Python 2.6 --- makepanda/makewheel.py | 139 ++++++++++++++++++++++++----------------- 1 file changed, 81 insertions(+), 58 deletions(-) diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index 81caf24701..dda4bc75e0 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -3,9 +3,11 @@ Generates a wheel (.whl) file from the output of makepanda. Since the wheel requires special linking, this will only work if compiled with the `--wheel` parameter. + +Please keep this file work with Panda3D 1.9 until that reaches EOL. """ from __future__ import print_function, unicode_literals -from distutils.util import get_platform as get_dist +from distutils.util import get_platform import json import sys @@ -16,20 +18,18 @@ import zipfile import hashlib import tempfile import subprocess -from sysconfig import get_config_var +from distutils.sysconfig import get_config_var from optparse import OptionParser from makepandacore import ColorText, LocateBinary, ParsePandaVersion, GetExtensionSuffix, SetVerbose, GetVerbose from base64 import urlsafe_b64encode -def get_platform(): - p = get_dist().replace('-', '_').replace('.', '_') - #if "linux" in p: - # print(ColorText("red", "WARNING:") + - # " Linux-specific wheel files are not supported." - # " We will generate this wheel as a generic package instead.") - # return "any" - return p +default_platform = get_platform() + +if default_platform.startswith("linux-"): + # Is this manylinux1? + if os.path.isfile("/lib/libc-2.5.so") and os.path.isdir("/opt/python"): + default_platform = platform.replace("linux", "manylinux1") def get_abi_tag(): @@ -71,7 +71,9 @@ def is_elf_file(path): def is_mach_o_file(path): base = os.path.basename(path) return os.path.isfile(path) and '.' not in base and \ - open(path, 'rb').read(4) == b'\xCA\xFE\xBA\xBE' + open(path, 'rb').read(4) in (b'\xCA\xFE\xBA\xBE', b'\xBE\xBA\xFE\bCA', + b'\xFE\xED\xFA\xCE', b'\xCE\xFA\xED\xFE', + b'\xFE\xED\xFA\xCF', b'\xCF\xFA\xED\xFE') if sys.platform in ('win32', 'cygwin'): @@ -83,18 +85,17 @@ else: # Other global parameters -PY_VERSION = "cp{}{}".format(sys.version_info.major, sys.version_info.minor) +PY_VERSION = "cp{0}{1}".format(*sys.version_info) ABI_TAG = get_abi_tag() -PLATFORM_TAG = get_platform() EXCLUDE_EXT = [".pyc", ".pyo", ".N", ".prebuilt", ".xcf", ".plist", ".vcproj", ".sln"] # Plug-ins to install. -PLUGIN_LIBS = ["pandagl", "pandagles", "pandagles2", "p3ptloader", "p3assimp", "p3ffmpeg", "p3openal_audio", "p3fmod_audio"] +PLUGIN_LIBS = ["pandagl", "pandagles", "pandagles2", "pandadx9", "p3tinydisplay", "p3ptloader", "p3assimp", "p3ffmpeg", "p3openal_audio", "p3fmod_audio"] WHEEL_DATA = """Wheel-Version: 1.0 Generator: makepanda Root-Is-Purelib: false -Tag: {}-{}-{} +Tag: {0}-{1}-{2} """ METADATA = { @@ -234,7 +235,11 @@ def scan_dependencies(pathname): else: command = ['ldd', pathname] - output = subprocess.check_output(command, universal_newlines=True) + process = subprocess.Popen(command, stdout=subprocess.PIPE, universal_newlines=True) + output, unused_err = process.communicate() + retcode = process.poll() + if retcode: + raise subprocess.CalledProcessError(retcode, command[0], output=output) filenames = None if sys.platform in ("win32", "cygwin"): @@ -245,16 +250,21 @@ def scan_dependencies(pathname): if filenames is None: sys.exit("Unable to determine dependencies from %s" % (pathname)) + if sys.platform == "darwin" and len(filenames) > 0: + # Filter out the library ID. + if os.path.basename(filenames[0]).split('.', 1)[0] == os.path.basename(pathname).split('.', 1)[0]: + del filenames[0] + return filenames class WheelFile(object): - def __init__(self, name, version): + def __init__(self, name, version, platform): self.name = name self.version = version - wheel_name = "{}-{}-{}-{}-{}.whl".format( - name, version, PY_VERSION, ABI_TAG, PLATFORM_TAG) + wheel_name = "{0}-{1}-{2}-{3}-{4}.whl".format( + name, version, PY_VERSION, ABI_TAG, platform) print("Writing %s" % (wheel_name)) self.zip_file = zipfile.ZipFile(wheel_name, 'w', zipfile.ZIP_DEFLATED) @@ -279,6 +289,10 @@ class WheelFile(object): # Don't include the Python library. return + if sys.platform == "darwin" and dep.endswith(".so"): + # Temporary hack for 1.9, which had link deps on modules. + return + source_path = None if search_path is None: @@ -372,7 +386,7 @@ class WheelFile(object): # Save it in PEP-0376 format for writing out later. digest = str(urlsafe_b64encode(sha.digest())) digest = digest.rstrip('=') - self.records.append("{},sha256={},{}\n".format(target_path, digest, size)) + self.records.append("{0},sha256={1},{2}\n".format(target_path, digest, size)) if GetVerbose(): print("Adding %s from %s" % (target_path, source_path)) @@ -388,7 +402,7 @@ class WheelFile(object): sha.update(source_data.encode()) digest = str(urlsafe_b64encode(sha.digest())) digest = digest.rstrip('=') - self.records.append("{},sha256={},{}\n".format(target_path, digest, len(source_data))) + self.records.append("{0},sha256={1},{2}\n".format(target_path, digest, len(source_data))) if GetVerbose(): print("Adding %s from data" % target_path) @@ -409,18 +423,20 @@ class WheelFile(object): def close(self): # Write the RECORD file. - record_file = "{}-{}.dist-info/RECORD".format(self.name, self.version) + record_file = "{0}-{1}.dist-info/RECORD".format(self.name, self.version) self.records.append(record_file + ",,\n") self.zip_file.writestr(record_file, "".join(self.records)) self.zip_file.close() -def makewheel(version, output_dir): +def makewheel(version, output_dir, platform=default_platform): if sys.platform not in ("win32", "darwin") and not sys.platform.startswith("cygwin"): if not LocateBinary("patchelf"): raise Exception("patchelf is required when building a Linux wheel.") + platform = platform.replace('-', '_').replace('.', '_') + # Global filepaths panda3d_dir = join(output_dir, "panda3d") pandac_dir = join(output_dir, "pandac") @@ -438,8 +454,8 @@ def makewheel(version, output_dir): # Update relevant METADATA entries METADATA['version'] = version version_classifiers = [ - "Programming Language :: Python :: {}".format(*sys.version_info), - "Programming Language :: Python :: {}.{}".format(*sys.version_info), + "Programming Language :: Python :: {0}".format(*sys.version_info), + "Programming Language :: Python :: {0}.{1}".format(*sys.version_info), ] METADATA['classifiers'].extend(version_classifiers) @@ -454,14 +470,14 @@ def makewheel(version, output_dir): "Version: {version}\n" \ "Summary: {summary}\n" \ "License: {license}\n".format(**METADATA), - "Home-page: {}\n".format(homepage), - "Author: {}\n".format(author), - "Author-email: {}\n".format(email), - "Platform: {}\n".format(PLATFORM_TAG), - ] + ["Classifier: {}\n".format(c) for c in METADATA['classifiers']]) + "Home-page: {0}\n".format(homepage), + "Author: {0}\n".format(author), + "Author-email: {0}\n".format(email), + "Platform: {0}\n".format(platform), + ] + ["Classifier: {0}\n".format(c) for c in METADATA['classifiers']]) # Zip it up and name it the right thing - whl = WheelFile('panda3d', version) + whl = WheelFile('panda3d', version, platform) whl.lib_path = [libs_dir] # Add the trees with Python modules. @@ -479,11 +495,12 @@ def makewheel(version, output_dir): elif file.endswith(ext_suffix) or file.endswith('.py'): source_path = os.path.join(panda3d_dir, file) - if file.endswith('.pyd') and PLATFORM_TAG.startswith('cygwin'): + if file.endswith('.pyd') and platform.startswith('cygwin'): # Rename it to .dll for cygwin Python to be able to load it. target_path = 'panda3d/' + os.path.splitext(file)[0] + '.dll' else: target_path = 'panda3d/' + file + whl.write_file(target_path, source_path) # Add plug-ins. @@ -499,31 +516,8 @@ def makewheel(version, output_dir): if os.path.isfile(plugin_path): whl.write_file('panda3d/' + plugin_name, plugin_path) - # Add the pandac tree for backward compatibility. - for file in os.listdir(pandac_dir): - if file.endswith('.py'): - whl.write_file('pandac/' + file, os.path.join(pandac_dir, file)) - - # Add a panda3d-tools directory containing the executables. - entry_points = '[console_scripts]\n' - tools_init = '' - for file in os.listdir(bin_dir): - source_path = os.path.join(bin_dir, file) - - if is_executable(source_path): - # Put the .exe files inside the panda3d-tools directory. - whl.write_file('panda3d_tools/' + file, source_path) - - # Tell pip to create a wrapper script. - basename = os.path.splitext(file)[0] - funcname = basename.replace('-', '_') - entry_points += '{0} = panda3d_tools:{1}\n'.format(basename, funcname) - tools_init += '{0} = lambda: _exec_tool({1!r})\n'.format(funcname, file) - - whl.write_file_data('panda3d_tools/__init__.py', PANDA3D_TOOLS_INIT.format(tools_init)) - # Add the .data directory, containing additional files. - data_dir = 'panda3d-{}.data'.format(version) + data_dir = 'panda3d-{0}.data'.format(version) #whl.write_directory(data_dir + '/data/etc', etc_dir) #whl.write_directory(data_dir + '/data/models', models_dir) @@ -532,12 +526,40 @@ def makewheel(version, output_dir): whl.write_directory('panda3d/etc', etc_dir) whl.write_directory('panda3d/models', models_dir) + # Add the pandac tree for backward compatibility. + for file in os.listdir(pandac_dir): + if file.endswith('.py'): + whl.write_file('pandac/' + file, os.path.join(pandac_dir, file)) + + # Add a panda3d-tools directory containing the executables. + entry_points = '[console_scripts]\n' + entry_points += 'eggcacher = direct.directscripts.eggcacher:main\n' + entry_points += 'packpanda = direct.directscripts.packpanda:main\n' + tools_init = '' + for file in os.listdir(bin_dir): + basename = os.path.splitext(file)[0] + if basename in ('eggcacher', 'packpanda'): + continue + + source_path = os.path.join(bin_dir, file) + + if is_executable(source_path): + # Put the .exe files inside the panda3d-tools directory. + whl.write_file('panda3d_tools/' + file, source_path) + + # Tell pip to create a wrapper script. + funcname = basename.replace('-', '_') + entry_points += '{0} = panda3d_tools:{1}\n'.format(basename, funcname) + tools_init += '{0} = lambda: _exec_tool({1!r})\n'.format(funcname, file) + + whl.write_file_data('panda3d_tools/__init__.py', PANDA3D_TOOLS_INIT.format(tools_init)) + # Add the dist-info directory last. - info_dir = 'panda3d-{}.dist-info'.format(version) + info_dir = 'panda3d-{0}.dist-info'.format(version) whl.write_file_data(info_dir + '/entry_points.txt', entry_points) whl.write_file_data(info_dir + '/metadata.json', json.dumps(METADATA, indent=4, separators=(',', ': '))) whl.write_file_data(info_dir + '/METADATA', metadata) - whl.write_file_data(info_dir + '/WHEEL', WHEEL_DATA.format(PY_VERSION, ABI_TAG, PLATFORM_TAG)) + whl.write_file_data(info_dir + '/WHEEL', WHEEL_DATA.format(PY_VERSION, ABI_TAG, platform)) whl.write_file(info_dir + '/LICENSE.txt', license_src) whl.write_file(info_dir + '/README.md', readme_src) whl.write_file_data(info_dir + '/top_level.txt', 'direct\npanda3d\npandac\npanda3d_tools\n') @@ -552,6 +574,7 @@ if __name__ == "__main__": parser.add_option('', '--version', dest = 'version', help = 'Panda3D version number (default: %s)' % (version), default = version) parser.add_option('', '--outputdir', dest = 'outputdir', help = 'Makepanda\'s output directory (default: built)', default = 'built') parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False) + parser.add_option('', '--platform', dest = 'platform', help = 'Override platform tag (default: %s)' % (default_platform), default = get_platform()) (options, args) = parser.parse_args() SetVerbose(options.verbose) From 4393455ebac4fd4c65febc5d5bf7dde862117978 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 16:12:54 +0100 Subject: [PATCH 82/93] Fix get_keyboard_map on Czech (and other) layouts Now reports proper Unicode name, and doesn't omit keys that don't have a recognised mapping by Panda https://bugs.launchpad.net/panda3d/+bug/1652145 --- doc/ReleaseNotes | 1 + panda/src/windisplay/winGraphicsWindow.cxx | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 3ad0ecd49b..cd6bdf2f4c 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -52,6 +52,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Now tries to preserve refresh rate when switching fullscreen on Windows * Fix back-to-front sorting when gl-coordinate-system is changed * Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1) +* get_keyboard_map now includes keys on layouts with special characters ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 0f7e33dc75..7f949415fe 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -2721,7 +2721,7 @@ ButtonMap *WinGraphicsWindow:: get_keyboard_map() const { ButtonMap *map = new ButtonMap; - char text[256]; + wchar_t text[256]; UINT vsc = 0; unsigned short ex_vsc[] = {0x57, 0x58, 0x011c, 0x011d, 0x0135, 0x0137, 0x0138, 0x0145, 0x0147, 0x0148, 0x0149, 0x014b, 0x014d, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x015b, 0x015c, 0x015d}; @@ -2759,14 +2759,15 @@ get_keyboard_map() const { UINT vk = MapVirtualKeyA(vsc, MAPVK_VSC_TO_VK_EX); button = lookup_key(vk); - if (button == ButtonHandle::none()) { - continue; - } + //if (button == ButtonHandle::none()) { + // continue; + //} } - int len = GetKeyNameTextA(lparam, text, 256); - string label (text, len); - map->map_button(raw_button, button, label); + int len = GetKeyNameTextW(lparam, text, 256); + TextEncoder enc; + enc.set_wtext(wstring(text, len)); + map->map_button(raw_button, button, enc.get_text()); } return map; From 0c742d59e58dd4c7a5a608e5d243d42319a7357a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 22:03:05 +0100 Subject: [PATCH 83/93] Fix crash due to incorrect alignment when building Eigen with AVX extensions Consequentially, we now use 32-byte alignment when building with eigen if __AVX__ is set. --- doc/ReleaseNotes | 1 + dtool/src/dtoolbase/deletedBufferChain.h | 4 ++++ dtool/src/dtoolbase/dlmalloc_src.cxx | 5 +++++ dtool/src/dtoolbase/dtoolbase.h | 2 +- dtool/src/dtoolbase/memoryHook.I | 12 +++++++++++- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index cd6bdf2f4c..74a0a9ea05 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -53,6 +53,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Fix back-to-front sorting when gl-coordinate-system is changed * Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1) * get_keyboard_map now includes keys on layouts with special characters +* Fix crash due to incorrect alignment when compiling Eigen with AVX ------------------------ RELEASE 1.9.2 ------------------------ diff --git a/dtool/src/dtoolbase/deletedBufferChain.h b/dtool/src/dtoolbase/deletedBufferChain.h index 301ee5d297..a71bc90b45 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.h +++ b/dtool/src/dtoolbase/deletedBufferChain.h @@ -105,7 +105,11 @@ private: #elif defined(LINMATH_ALIGN) // With SSE2 alignment, we need all 16 bytes to preserve alignment. +#ifdef __AVX__ + static const size_t flag_reserved_bytes = 32; +#else static const size_t flag_reserved_bytes = 16; +#endif #else // Otherwise, we only need enough space for the Integer itself. diff --git a/dtool/src/dtoolbase/dlmalloc_src.cxx b/dtool/src/dtoolbase/dlmalloc_src.cxx index 4e21f4c914..dcbb0daa25 100644 --- a/dtool/src/dtoolbase/dlmalloc_src.cxx +++ b/dtool/src/dtoolbase/dlmalloc_src.cxx @@ -453,8 +453,13 @@ DEFAULT_MMAP_THRESHOLD default: 256K // drose: We require 16-byte alignment of certain structures, to // support SSE2. We don't strictly have to align *everything*, but // it's just easier to do so. +#ifdef __AVX__ +// Eigen requires 32-byte alignment when using AVX instructions. +#define MALLOC_ALIGNMENT ((size_t)32U) +#else #define MALLOC_ALIGNMENT ((size_t)16U) #endif +#endif #ifndef WIN32 #ifdef _WIN32 diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index 2c883f8220..27add7c84d 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -372,7 +372,7 @@ // enforce alignment externally. #define MEMORY_HOOK_DO_ALIGN 1 -#elif defined(IS_OSX) || defined(_WIN64) +#elif (defined(IS_OSX) || defined(_WIN64)) && !defined(__AVX__) // The OS-provided malloc implementation will do the required // alignment. #undef MEMORY_HOOK_DO_ALIGN diff --git a/dtool/src/dtoolbase/memoryHook.I b/dtool/src/dtoolbase/memoryHook.I index 9286a18d7a..ecccf07d65 100644 --- a/dtool/src/dtoolbase/memoryHook.I +++ b/dtool/src/dtoolbase/memoryHook.I @@ -55,7 +55,12 @@ get_memory_alignment() { // We require 16-byte alignment of certain structures, to support // SSE2. We don't strictly have to align *everything*, but it's just // easier to do so. +#ifdef __AVX__ + // Eigen requires 32-byte alignment when using AVX instructions. + const size_t alignment_size = 32; +#else const size_t alignment_size = 16; +#endif #else // Otherwise, use word alignment. const size_t alignment_size = sizeof(void *); @@ -79,7 +84,12 @@ get_header_reserved_bytes() { #ifdef LINMATH_ALIGN // If we're doing SSE2 alignment, we must reserve a full 16-byte // block, since anything less than that will spoil the alignment. - static const size_t header_reserved_bytes = 16; +#ifdef __AVX__ + // Eigen requires 32-byte alignment when using AVX instructions. + const size_t header_reserved_bytes = 32; +#else + const size_t header_reserved_bytes = 16; +#endif #elif defined(MEMORY_HOOK_DO_ALIGN) // If we're just aligning to words, we reserve a block as big as two From 741ff454ed951603145a00c85c52252c55c7f48f Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 22:53:21 +0100 Subject: [PATCH 84/93] We need to link tools that use interrogatedb with pystub again --- makepanda/makepanda.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 8854faecd1..95dc6d791b 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -3337,6 +3337,7 @@ if (not RUNTIME): TargetAdd('interrogate.exe', input='libp3cppParser.ilb') TargetAdd('interrogate.exe', input=COMMON_DTOOL_LIBS) TargetAdd('interrogate.exe', input='libp3interrogatedb.dll') + TargetAdd('interrogate.exe', input='libp3pystub.lib') TargetAdd('interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) TargetAdd('interrogate_module_interrogate_module.obj', opts=OPTS, input='interrogate_module.cxx') @@ -3344,6 +3345,7 @@ if (not RUNTIME): TargetAdd('interrogate_module.exe', input='libp3cppParser.ilb') TargetAdd('interrogate_module.exe', input=COMMON_DTOOL_LIBS) TargetAdd('interrogate_module.exe', input='libp3interrogatedb.dll') + TargetAdd('interrogate_module.exe', input='libp3pystub.lib') TargetAdd('interrogate_module.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) if (not RTDIST): @@ -3352,6 +3354,7 @@ if (not RUNTIME): TargetAdd('parse_file.exe', input='libp3cppParser.ilb') TargetAdd('parse_file.exe', input=COMMON_DTOOL_LIBS) TargetAdd('parse_file.exe', input='libp3interrogatedb.dll') + TargetAdd('parse_file.exe', input='libp3pystub.lib') TargetAdd('parse_file.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) # @@ -3375,6 +3378,7 @@ if (not RTDIST and not RUNTIME): 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) + TargetAdd('test_interrogate.exe', input='libp3pystub.lib') TargetAdd('test_interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) # @@ -5160,6 +5164,7 @@ if (PkgSkip("PYTHON")==0 and PkgSkip("DIRECT")==0 and not RTDIST and not RUNTIME TargetAdd('p3dcparse.exe', input='dcparse_dcparse.obj') TargetAdd('p3dcparse.exe', input='libp3direct.dll') TargetAdd('p3dcparse.exe', input=COMMON_PANDA_LIBS) + TargetAdd('p3dcparse.exe', input='libp3pystub.lib') TargetAdd('p3dcparse.exe', opts=['ADVAPI', 'PYTHON']) # From 9c789db9183342f80a00d8d23e6f4f94fd70ea41 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 25 Dec 2016 23:58:08 +0100 Subject: [PATCH 85/93] Compile fix for Python 3.2 --- dtool/src/pystub/pystub.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dtool/src/pystub/pystub.cxx b/dtool/src/pystub/pystub.cxx index 4f2e74144a..d0d6a4ca1a 100644 --- a/dtool/src/pystub/pystub.cxx +++ b/dtool/src/pystub/pystub.cxx @@ -149,12 +149,14 @@ extern "C" { EXPCL_PYSTUB int PyUnicodeUCS2_FromStringAndSize(...); EXPCL_PYSTUB int PyUnicodeUCS2_FromWideChar(...); EXPCL_PYSTUB int PyUnicodeUCS2_AsWideChar(...); + EXPCL_PYSTUB int PyUnicodeUCS2_AsWideCharString(...); EXPCL_PYSTUB int PyUnicodeUCS2_GetSize(...); EXPCL_PYSTUB int PyUnicodeUCS4_FromFormat(...); EXPCL_PYSTUB int PyUnicodeUCS4_FromString(...); EXPCL_PYSTUB int PyUnicodeUCS4_FromStringAndSize(...); EXPCL_PYSTUB int PyUnicodeUCS4_FromWideChar(...); EXPCL_PYSTUB int PyUnicodeUCS4_AsWideChar(...); + EXPCL_PYSTUB int PyUnicodeUCS4_AsWideCharString(...); EXPCL_PYSTUB int PyUnicodeUCS4_GetSize(...); EXPCL_PYSTUB int PyUnicode_AsUTF8(...); EXPCL_PYSTUB int PyUnicode_AsUTF8AndSize(...); @@ -349,12 +351,14 @@ int PyUnicodeUCS2_FromString(...) { return 0; } int PyUnicodeUCS2_FromStringAndSize(...) { return 0; } int PyUnicodeUCS2_FromWideChar(...) { return 0; } int PyUnicodeUCS2_AsWideChar(...) { return 0; } +int PyUnicodeUCS2_AsWideCharString(...) { return 0; } int PyUnicodeUCS2_GetSize(...) { return 0; } int PyUnicodeUCS4_FromFormat(...) { return 0; } int PyUnicodeUCS4_FromString(...) { return 0; } int PyUnicodeUCS4_FromStringAndSize(...) { return 0; } int PyUnicodeUCS4_FromWideChar(...) { return 0; } int PyUnicodeUCS4_AsWideChar(...) { return 0; } +int PyUnicodeUCS4_AsWideCharString(...) { return 0; } int PyUnicodeUCS4_GetSize(...) { return 0; } int PyUnicode_AsUTF8(...) { return 0; } int PyUnicode_AsUTF8AndSize(...) { return 0; } From fb2568afada31088bf7e19e5de1033ba9d8d8f2b Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 26 Dec 2016 17:36:11 +0100 Subject: [PATCH 86/93] Fix faulty merge --- doc/ReleaseNotes | 2 +- dtool/src/dtoolbase/memoryHook.I | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 74a0a9ea05..d3e22a1fc3 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -54,6 +54,7 @@ This issue fixes several bugs that were still found in 1.9.2. * Now also compiles on older Linux distros (eg. CentOS 5 / manylinux1) * get_keyboard_map now includes keys on layouts with special characters * Fix crash due to incorrect alignment when compiling Eigen with AVX +* Fix crash when writing 16-bit .tif file (now silently downsamples) ------------------------ RELEASE 1.9.2 ------------------------ @@ -78,7 +79,6 @@ remained in the 1.9.1 release, including: * Fix constant reloading of texture when gl-ignore-mipmaps is set * BamReader now releases the GIL (so it can be used threaded) * Fix AttributeError in direct.stdpy.threading module -* Fix crash when writing 16-bit .tif file (now silently downsamples) ------------------------ RELEASE 1.9.1 ------------------------ diff --git a/dtool/src/dtoolbase/memoryHook.I b/dtool/src/dtoolbase/memoryHook.I index d22a51ad48..3d2be05097 100644 --- a/dtool/src/dtoolbase/memoryHook.I +++ b/dtool/src/dtoolbase/memoryHook.I @@ -70,12 +70,11 @@ get_header_reserved_bytes() { #ifdef LINMATH_ALIGN // If we're doing SSE2 alignment, we must reserve a full 16-byte block, // since anything less than that will spoil the alignment. - static const size_t header_reserved_bytes = 16; #ifdef __AVX__ // Eigen requires 32-byte alignment when using AVX instructions. - const size_t header_reserved_bytes = 32; + static const size_t header_reserved_bytes = 32; #else - const size_t header_reserved_bytes = 16; + static const size_t header_reserved_bytes = 16; #endif #elif defined(MEMORY_HOOK_DO_ALIGN) From 325302b6239d264a1679c1f146f5ee06bfcab1f1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 26 Dec 2016 17:36:38 +0100 Subject: [PATCH 87/93] makewheel: support building single-arch .whl from a fat Panda build --- makepanda/makewheel.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/makepanda/makewheel.py b/makepanda/makewheel.py index dda4bc75e0..6d3b6fdf72 100644 --- a/makepanda/makewheel.py +++ b/makepanda/makewheel.py @@ -29,7 +29,7 @@ default_platform = get_platform() if default_platform.startswith("linux-"): # Is this manylinux1? if os.path.isfile("/lib/libc-2.5.so") and os.path.isdir("/opt/python"): - default_platform = platform.replace("linux", "manylinux1") + default_platform = default_platform.replace("linux", "manylinux1") def get_abi_tag(): @@ -75,6 +75,10 @@ def is_mach_o_file(path): b'\xFE\xED\xFA\xCE', b'\xCE\xFA\xED\xFE', b'\xFE\xED\xFA\xCF', b'\xCF\xFA\xED\xFE') +def is_fat_file(path): + return os.path.isfile(path) and \ + open(path, 'rb').read(4) in (b'\xCA\xFE\xBA\xBE', b'\xBE\xBA\xFE\bCA') + if sys.platform in ('win32', 'cygwin'): is_executable = is_exe_file @@ -262,6 +266,7 @@ class WheelFile(object): def __init__(self, name, version, platform): self.name = name self.version = version + self.platform = platform wheel_name = "{0}-{1}-{2}-{3}-{4}.whl".format( name, version, PY_VERSION, ABI_TAG, platform) @@ -285,7 +290,7 @@ class WheelFile(object): self.dep_paths[dep] = None - if dep.lower().startswith("python"): + if dep.lower().startswith("python") or os.path.basename(dep).startswith("libpython"): # Don't include the Python library. return @@ -339,6 +344,18 @@ class WheelFile(object): suffix = '.dylib' temp = tempfile.NamedTemporaryFile(suffix=suffix, prefix='whl', delete=False) + + # On macOS, if no fat wheel was requested, extract the right architecture. + if sys.platform == "darwin" and is_fat_file(source_path) and not self.platform.endswith("_intel"): + if self.platform.endswith("_x86_64"): + arch = 'x86_64' + else: + arch = self.platform.split('_')[-1] + subprocess.call(['lipo', source_path, '-extract', arch, '-output', temp.name]) + else: + # Otherwise, just copy it over. + temp.write(open(source_path, 'rb').read()) + temp.write(open(source_path, 'rb').read()) os.fchmod(temp.fileno(), os.fstat(temp.fileno()).st_mode | 0o111) temp.close() @@ -578,4 +595,4 @@ if __name__ == "__main__": (options, args) = parser.parse_args() SetVerbose(options.verbose) - makewheel(options.version, options.outputdir) + makewheel(options.version, options.outputdir, options.platform) From ea2305de701fe89082bcd26de6b29d3077dc7a8b Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Mon, 26 Dec 2016 17:37:02 -0700 Subject: [PATCH 88/93] general: Fix missing includes. --- panda/src/gobj/shaderBuffer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/panda/src/gobj/shaderBuffer.h b/panda/src/gobj/shaderBuffer.h index 5faa4322ac..549ebdc536 100644 --- a/panda/src/gobj/shaderBuffer.h +++ b/panda/src/gobj/shaderBuffer.h @@ -15,8 +15,11 @@ #define SHADERBUFFER_H #include "pandabase.h" +#include "typedWritableReferenceCount.h" #include "namable.h" #include "geomEnums.h" +#include "graphicsStateGuardianBase.h" +#include "factoryParams.h" class BufferContext; class PreparedGraphicsObjects; From cf105f276c55b7a02b87c527bc01f56ef3df306b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 28 Dec 2016 20:23:27 +0100 Subject: [PATCH 89/93] More alignment fixes for 32-byte AVX --- dtool/src/dtoolbase/deletedBufferChain.cxx | 4 ++-- dtool/src/dtoolbase/dtoolbase.h | 5 +++++ panda/src/linmath/lsimpleMatrix.h | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dtool/src/dtoolbase/deletedBufferChain.cxx b/dtool/src/dtoolbase/deletedBufferChain.cxx index 122edf8837..557b6ce9d8 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.cxx +++ b/dtool/src/dtoolbase/deletedBufferChain.cxx @@ -71,7 +71,7 @@ allocate(size_t size, TypeHandle type_handle) { // Allocate memory, and make sure the object starts at the proper alignment. void *mem = NeverFreeMemory::alloc(alloc_size); - intptr_t pad = ((intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment(); + intptr_t pad = (-(intptr_t)flag_reserved_bytes - (intptr_t)mem) % MemoryHook::get_memory_alignment(); obj = (ObjectNode *)((uintptr_t)mem + pad); #ifdef USE_DELETEDCHAINFLAG @@ -80,7 +80,7 @@ allocate(size_t size, TypeHandle type_handle) { void *ptr = node_to_buffer(obj); -#ifdef _DEBUG +#ifndef NDEBUG assert(((uintptr_t)ptr % MemoryHook::get_memory_alignment()) == 0); #endif diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index b192f24055..c6cbbd7f46 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -339,21 +339,26 @@ typedef struct _object PyObject; #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE +#define ALIGN_32BYTE #define ALIGN_64BYTE #elif defined(_MSC_VER) #define ALIGN_4BYTE __declspec(align(4)) #define ALIGN_8BYTE __declspec(align(8)) #define ALIGN_16BYTE __declspec(align(16)) +#define ALIGN_32BYTE __declspec(align(32)) #define ALIGN_64BYTE __declspec(align(64)) #elif defined(__GNUC__) #define ALIGN_4BYTE __attribute__ ((aligned (4))) #define ALIGN_8BYTE __attribute__ ((aligned (8))) #define ALIGN_16BYTE __attribute__ ((aligned (16))) +#define ALIGN_32BYTE __attribute__ ((aligned (32))) #define ALIGN_64BYTE __attribute__ ((aligned (64))) #else #define ALIGN_4BYTE #define ALIGN_8BYTE #define ALIGN_16BYTE +#define ALIGN_32BYTE +#define ALIGN_64BYTE #endif // Do we need to implement memory-alignment enforcement within the MemoryHook diff --git a/panda/src/linmath/lsimpleMatrix.h b/panda/src/linmath/lsimpleMatrix.h index 0ba2dc1196..5669e18be3 100644 --- a/panda/src/linmath/lsimpleMatrix.h +++ b/panda/src/linmath/lsimpleMatrix.h @@ -58,7 +58,9 @@ private: #endif // HAVE_EIGEN // This is as good a place as any to define this alignment macro. -#ifdef LINMATH_ALIGN +#if defined(LINMATH_ALIGN) && defined(HAVE_EIGEN) && defined(__AVX__) +#define ALIGN_LINMATH ALIGN_32BYTE +#elif defined(LINMATH_ALIGN) #define ALIGN_LINMATH ALIGN_16BYTE #else #define ALIGN_LINMATH From fa851ae5acb2b0ce06a2ae425f896ce7acb983c4 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 22:42:05 +0100 Subject: [PATCH 90/93] Allow custom version to be passed on to makewheel when building with --wheel --- makepanda/makepanda.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 95dc6d791b..c96d188bcb 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -52,6 +52,7 @@ RUNTIME=0 DISTRIBUTOR="" VERSION=None DEBVERSION=None +WHLVERSION=None RPMRELEASE="1" GIT_COMMIT=None P3DSUFFIX=None @@ -163,7 +164,7 @@ def usage(problem): def parseopts(args): global INSTALLER,WHEEL,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL - global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION + global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER longopts = [ "help","distributor=","verbose","runtime","osxtarget=", @@ -206,8 +207,11 @@ def parseopts(args): elif (option=="--arch"): target_arch = value.strip() elif (option=="--nocolor"): DisableColors() elif (option=="--version"): - VERSION=value - if (len(VERSION.split(".")) != 3): raise Exception + match = re.match(r'^\d+\.\d+\.\d+', value) + if not match: + usage("version requires three digits") + WHLVERSION = value + VERSION = match.group() elif (option=="--lzma"): COMPRESSOR="lzma" elif (option=="--override"): AddOverride(value.strip()) elif (option=="--static"): SetLinkAllStatic(True) @@ -7257,7 +7261,7 @@ try: if WHEEL: ProgressOutput(100.0, "Building wheel") from makewheel import makewheel - makewheel(VERSION, GetOutputDir()) + makewheel(WHLVERSION, GetOutputDir()) finally: SaveDependencyCache() From 40ea0ab7869a77093d4d60fe31f01fcf58d60089 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 22:46:57 +0100 Subject: [PATCH 91/93] cppparser: support directives __LINE__, __FILE__, __has_include --- dtool/src/cppparser/cppPreprocessor.cxx | 247 +++++++++++++++++------- dtool/src/cppparser/cppPreprocessor.h | 3 + 2 files changed, 177 insertions(+), 73 deletions(-) diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 83050d3c41..feda153530 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -809,6 +809,8 @@ expand_manifests(const string &input_expr, bool expand_undefined, // Here's an identifier. Is it "defined"? if (ident == "defined") { expand_defined_function(expr, q, p); + } else if (expand_undefined && ident == "__has_include") { + expand_has_include_function(expr, q, p, loc); } else { // Is it a manifest? Manifests::const_iterator mi = _manifests.find(ident); @@ -817,6 +819,20 @@ expand_manifests(const string &input_expr, bool expand_undefined, expand_manifest_inline(expr, q, p, manifest); manifest_found = true; + } else if (ident == "__FILE__") { + // Special case: this is a dynamic definition. + string file = string("\"") + loc.file._filename_as_referenced.get_fullpath() + "\""; + expr = expr.substr(0, q) + file + expr.substr(p); + p = q + file.size(); + manifest_found = true; + + } else if (ident == "__LINE__") { + // So is this. + string line = format_string(loc.first_line); + expr = expr.substr(0, q) + line + expr.substr(p); + p = q + line.size(); + manifest_found = true; + } else if (expand_undefined && ident != "true" && ident != "false") { // It is not found. Expand it to 0, but only if we are currently // parsing an #if expression. @@ -1486,14 +1502,10 @@ handle_undef_directive(const string &args, const YYLTYPE &loc) { */ void CPPPreprocessor:: handle_ifdef_directive(const string &args, const YYLTYPE &loc) { - Manifests::const_iterator mi = _manifests.find(args); - if (mi != _manifests.end()) { - // The macro is defined. We continue. - return; + if (!is_manifest_defined(args)) { + // The macro is undefined. Skip stuff. + skip_false_if_block(true); } - - // The macro is undefined. Skip stuff. - skip_false_if_block(true); } /** @@ -1501,17 +1513,12 @@ handle_ifdef_directive(const string &args, const YYLTYPE &loc) { */ void CPPPreprocessor:: handle_ifndef_directive(const string &args, const YYLTYPE &loc) { - Manifests::const_iterator mi = _manifests.find(args); - if (mi == _manifests.end()) { - // The macro is undefined. We continue. - return; + if (is_manifest_defined(args)) { + // The macro is defined. Skip stuff. + skip_false_if_block(true); } - - // The macro is defined. Skip stuff. - skip_false_if_block(true); } - /** * */ @@ -1593,6 +1600,8 @@ handle_include_directive(const string &args, const YYLTYPE &loc) { _angle_includes.insert(filename); } } + } else { + warning("Ignoring invalid #include directive", loc); } filename.set_text(); @@ -1600,71 +1609,30 @@ handle_include_directive(const string &args, const YYLTYPE &loc) { // Now look for the filename. If we didn't use angle quotes, look first in // the current directory. - bool found_file = false; CPPFile::Source source = CPPFile::S_none; - if (okflag) { - found_file = false; + if (find_include(filename, angle_quotes, source)) { + _last_c = '\0'; - // Search the current directory. - if (!angle_quotes && !found_file && filename.exists()) { - found_file = true; + // If it was explicitly named on the command-line, mark it S_local. + filename.make_canonical(); + if (_explicit_files.count(filename)) { source = CPPFile::S_local; } - // Search the same directory as the includer. - if (!angle_quotes && !found_file) { - Filename match(get_file()._filename.get_dirname(), filename); - if (match.exists()) { - filename = match; - found_file = true; - source = CPPFile::S_alternate; - } + CPPFile file(filename, filename_as_referenced, source); + + // Don't include it if we included it before and it had #pragma once. + ParsedFiles::const_iterator it = _parsed_files.find(file); + if (it != _parsed_files.end() && it->_pragma_once) { + return; } - // Now search the angle-include-path - if (angle_quotes && !found_file && filename.resolve_filename(_angle_include_path)) { - found_file = true; - source = CPPFile::S_system; - } - - // Now search the quote-include-path - if (!angle_quotes && !found_file) { - for (size_t dir=0; dir<_quote_include_path.get_num_directories(); dir++) { - Filename match(_quote_include_path.get_directory(dir), filename); - if (match.exists()) { - filename = match; - found_file = true; - source = _quote_include_kind[dir]; - } - } - } - - if (!found_file) { - warning("Cannot find " + filename.get_fullpath(), loc); - } else { - _last_c = '\0'; - - // If it was explicitly named on the command-line, mark it S_local. - filename.make_canonical(); - if (_explicit_files.count(filename)) { - source = CPPFile::S_local; - } - - CPPFile file(filename, filename_as_referenced, source); - - // Don't include it if we included it before and it had #pragma once. - ParsedFiles::const_iterator it = _parsed_files.find(file); - if (it != _parsed_files.end() && it->_pragma_once) { - return; - } - - if (!push_file(file)) { - warning("Unable to read " + filename.get_fullpath(), loc); - } + if (!push_file(file)) { + warning("Unable to read " + filename.get_fullpath(), loc); } } else { - warning("Ignoring invalid #include directive", loc); + warning("Cannot find " + filename.get_fullpath(), loc); } } @@ -1779,6 +1747,69 @@ skip_false_if_block(bool consider_elifs) { _save_comments = true; } +/** + * Returns true if the given manifest is defined. + */ +bool CPPPreprocessor:: +is_manifest_defined(const string &manifest_name) { + Manifests::const_iterator mi = _manifests.find(manifest_name); + if (mi != _manifests.end()) { + return true; + } + + if (manifest_name == "__has_include" || + manifest_name == "__FILE__" || + manifest_name == "__LINE__") { + // Special built-in directives that are considered "defined". + return true; + } + + return false; +} + +/** + * Locates the given filename. Changes the first argument to the full path. + */ +bool CPPPreprocessor:: +find_include(Filename &filename, bool angle_quotes, CPPFile::Source &source) { + // Now look for the filename. If we didn't use angle quotes, look first in + // the current directory. + if (!angle_quotes && filename.exists()) { + source = CPPFile::S_local; + return true; + } + + // Search the same directory as the includer. + if (!angle_quotes) { + Filename match(get_file()._filename.get_dirname(), filename); + if (match.exists()) { + filename = match; + source = CPPFile::S_alternate; + return true; + } + } + + // Now search the angle-include-path + if (angle_quotes && filename.resolve_filename(_angle_include_path)) { + source = CPPFile::S_system; + return true; + } + + // Now search the quote-include-path + if (!angle_quotes) { + for (size_t dir = 0; dir < _quote_include_path.get_num_directories(); ++dir) { + Filename match(_quote_include_path.get_directory(dir), filename); + if (match.exists()) { + filename = match; + source = _quote_include_kind[dir]; + return true; + } + } + } + + return false; +} + /** * */ @@ -1885,6 +1916,14 @@ get_identifier(int c) { if (mi != _manifests.end() && !should_ignore_manifest((*mi).second)) { return expand_manifest((*mi).second); } + if (name == "__FILE__") { + return get_literal(SIMPLE_STRING, loc, loc.file._filename_as_referenced); + } + if (name == "__LINE__") { + YYSTYPE result; + result.u.integer = loc.first_line; + return CPPToken(INTEGER, loc, "", result); + } // Check for keywords. int kw = check_keyword(name); @@ -2227,9 +2266,7 @@ expand_defined_function(string &expr, size_t q, size_t &p) { vector_string args; extract_manifest_args_inline("defined", 1, -1, args, expr, p); if (args.size() >= 1) { - const string &manifest_name = args[0]; - Manifests::const_iterator mi = _manifests.find(manifest_name); - if (mi != _manifests.end()) { + if (is_manifest_defined(args[0])) { // The macro is defined; the result is "1". result = "1"; } else { @@ -2242,6 +2279,70 @@ expand_defined_function(string &expr, size_t q, size_t &p) { p = q + result.size(); } +/** + * Expands the __has_include(manifest) function to either 1 or 0, depending on + * whether the include file exists. + */ +void CPPPreprocessor:: +expand_has_include_function(string &expr, size_t q, size_t &p, YYLTYPE loc) { + bool found_file = false; + + // Skip whitespace till paren. + while (p < expr.size() && isspace(expr[p])) { + p++; + } + size_t args_begin = p + 1; + + vector_string args; + extract_manifest_args_inline("__has_include", 1, -1, args, expr, p); + + if (!args.empty() && args[0].size() >= 2) { + Filename filename; + bool angle_quotes = false; + + string inc = args[0]; + + // Just to play things safe, since our manifest-expansion logic might not + // filter out quotes and angle brackets properly, we'll only expand + // manifests if we don't begin with a quote or bracket. + if (!inc.empty() && (inc[0] != '"' && inc[0] != '<')) { + inc = expand_manifests(inc, false, loc); + } + + if (inc[0] == '"' && inc[inc.size() - 1] == '"') { + filename = inc.substr(1, inc.size() - 2); + } else if (inc[0] == '<' && inc[inc.size() - 1] == '>') { + filename = inc.substr(1, inc.size() - 2); + if (!_noangles) { + // If _noangles is true, we don't make a distinction between angle + // brackets and quote marks--all #inc statements are treated the + // same, as if they used quote marks. + angle_quotes = true; + } + } else { + loc.last_column += loc.first_column + p - 2; + loc.first_column += args_begin; + warning("invalid argument for __has_include() directive", loc); + expr = expr.substr(0, q) + "0" + expr.substr(p); + p = q + 1; + return; + } + + filename.set_text(); + + CPPFile::Source source = CPPFile::S_none; + found_file = find_include(filename, angle_quotes, source); + } else { + loc.last_column += loc.first_column + p - 2; + loc.first_column += args_begin; + warning("invalid argument for __has_include() directive", loc); + } + + string result = found_file ? "1" : "0"; + expr = expr.substr(0, q) + result + expr.substr(p); + p = q + result.size(); +} + /** * */ diff --git a/dtool/src/cppparser/cppPreprocessor.h b/dtool/src/cppparser/cppPreprocessor.h index e375b259dd..e119211596 100644 --- a/dtool/src/cppparser/cppPreprocessor.h +++ b/dtool/src/cppparser/cppPreprocessor.h @@ -143,6 +143,8 @@ private: void handle_error_directive(const string &args, const YYLTYPE &loc); void skip_false_if_block(bool consider_elifs); + bool is_manifest_defined(const string &manifest_name); + bool find_include(Filename &filename, bool angle_quotes, CPPFile::Source &source); CPPToken get_quoted_char(int c); CPPToken get_quoted_string(int c); @@ -153,6 +155,7 @@ private: void extract_manifest_args(const string &name, int num_args, int va_arg, vector_string &args); void expand_defined_function(string &expr, size_t q, size_t &p); + void expand_has_include_function(string &expr, size_t q, size_t &p, YYLTYPE loc); void expand_manifest_inline(string &expr, size_t q, size_t &p, const CPPManifest *manifest); void extract_manifest_args_inline(const string &name, int num_args, From 40e981e485c383367d5f2a9bacf2b906ea90df2d Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 22:47:58 +0100 Subject: [PATCH 92/93] makepanda: enable C++11 support by default --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index c96d188bcb..92f7edb5f7 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1194,7 +1194,7 @@ def CompileCxx(obj,src,opts): if (COMPILER=="GCC"): if (src.endswith(".c")): cmd = GetCC() +' -fPIC -c -o ' + obj - else: cmd = GetCXX()+' -ftemplate-depth-70 -fPIC -c -o ' + obj + else: cmd = GetCXX()+' -std=gnu++0x -ftemplate-depth-70 -fPIC -c -o ' + obj for (opt, dir) in INCDIRECTORIES: if (opt=="ALWAYS") or (opt in opts): cmd += ' -I' + BracketNameWithQuotes(dir) for (opt, dir) in FRAMEWORKDIRECTORIES: From 9facf874aba9b2b051b8cd1f0e62bb8baf68cda3 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Jan 2017 23:53:24 +0100 Subject: [PATCH 93/93] Let compiler synthesize QuadDef move assignment operator This hopefully fixes a compile issue with older clang versions. --- panda/src/text/textAssembler.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/panda/src/text/textAssembler.h b/panda/src/text/textAssembler.h index 1215765bf5..64b4c7ef03 100644 --- a/panda/src/text/textAssembler.h +++ b/panda/src/text/textAssembler.h @@ -212,21 +212,6 @@ private: typedef pmap GeomCollectorMap; struct QuadDef { - // Copying this class is a performance hotspot, hence we define the move - // constructor. - ALWAYS_INLINE QuadDef() {} - ALWAYS_INLINE QuadDef(const QuadDef ©) : - _dimensions(copy._dimensions), _uvs(copy._uvs), - _slantl(copy._slantl), _slanth(copy._slanth), - _glyph(copy._glyph) {} - -#ifdef USE_MOVE_SEMANTICS - ALWAYS_INLINE QuadDef(QuadDef &&from) NOEXCEPT : - _dimensions(from._dimensions), _uvs(from._uvs), - _slantl(from._slantl), _slanth(from._slanth), - _glyph(move(from._glyph)) {} -#endif - LVecBase4 _dimensions; LVecBase4 _uvs; PN_stdfloat _slantl, _slanth;