Commit Graph

1766 Commits

Author SHA1 Message Date
rdb 1d9334f578 parser-inc: add atomic_int, etc. typedefs 2019-01-30 23:59:34 +01:00
rdb 376cef51c4 interrogate: fix Python 3 crash with optional std::wstring args
This would cause PyMem_Free to be called on an uninitialized pointer if a default argument was not specified.

Fixes #542
2019-01-26 19:27:50 +01:00
rdb 403e56817a dtoolbase: fix x86 compilation error on Android 2019-01-26 19:22:44 +01:00
rdb ba4036e290 prc: clear error flag if loading deploy-ng blobinfo fails 2019-01-19 23:12:46 +01:00
rdb 6eca44464e load_dso: prevent load_dso_error() from returning old error
This happens if load_dso fails due to being unable to find the file, but not setting the dlerror flag and therefore causing a misleading error message to be shown.
2019-01-19 23:10:46 +01:00
rdb 84a1315104 More fixes to work around broken libc++ eof() in Mac OS X 10.7 2019-01-10 21:53:02 +01:00
Sam Edwards 0c890f059d interrogate: Export Python entry points with EXPORT_CLASS
Closes #505
2019-01-03 12:39:22 +01:00
Sam Edwards ce4985a333 interrogatedb: Fix missing 'static' keyword 2019-01-02 10:18:59 -07:00
rdb ac8be1a2e6 py_panda: fix int-to-enum conversion in Python 2
Fixes #498
2019-01-01 16:32:04 +01:00
rdb 0a43008313 py_panda: avoid duplicate symbol issues with LINK_ALL_STATIC
Fixes #478
2018-12-30 16:42:50 +01:00
Sam Edwards 818fdbd232 interrogate: Tidy up hash_string function
The main motivation behind this change is to get rid of a
signed integer overflow that sometimes happens in the prime
multiplication step, which is (per the C++ spec) undefined
behavior. However, it's probably for the best to use only
unsigned int when the function is clearly trying to avoid
negative values.

Not that I suspect it matters much, but I have also heavily
tested that the behavior of the function is unchanged (at
least on PC hardware - signed integer overflow doesn't
behave portably) although it may now be slightly faster due
to the fact that I have removed the floating-point math.
2018-12-30 04:21:34 -07:00
rdb 01915a36db Merge branch 'master' into deploy-ng 2018-12-26 23:41:50 +01:00
rdb a9d6d3be46 interrogate: refactor default argument handling 2018-12-26 22:47:14 +01:00
rdb 47188b47f6 interrogate: fix recording type of property in interrogatedb 2018-12-23 15:45:30 +01:00
rdb 256c8c5a23 interrogate: don't add space at end of command-line comment 2018-12-23 15:44:59 +01:00
rdb 6df8aede1f interrogatedb: add interrogate_element_is_sequence/mapping 2018-12-23 15:44:01 +01:00
rdb 4c0fa1e75d Merge branch 'master' into deploy-ng 2018-12-16 22:36:45 +01:00
rdb 7995d483ab py_panda: make standard_type_members static and internal 2018-12-16 18:46:30 +01:00
rdb a7752da4f1 Merge branch 'master' into deploy-ng 2018-12-09 20:22:23 +01:00
rdb 825058805a dtoolutil: add GlobPattern::matches_file() and unit test
This is used similar to matches() but for file paths: it does not match slashes for * characters and has special support for /**/ and ignores // and /./ patterns.
2018-12-09 15:21:11 +01:00
rdb c560c502b9 Merge branch 'master' into deploy-ng 2018-12-01 22:14:01 +01:00
rdb 7ed8b01a84 Merge branch 'input-overhaul' 2018-11-30 22:04:13 +01:00
rdb d7124d4df4 Merge branch 'master' into deploy-ng 2018-11-29 12:57:49 +01:00
rdb 97d4e32a06 general: use nassert_raise instead of nassertv(false) et al
Even a brief error message in the assertion is infinitely more useful to a user who is not at home in the source code, especially for assertions that may reasonably be triggered by honest user mistakes.
2018-11-28 17:35:20 +01:00
rdb 32df05b528 Fix crash when unmounting/closing multifile while streams are open
It's not really reasonable to expect a user to find every occurrence of a cached resource that might be using an open stream and remove it or crash otherwise.

This is fixed by keeping the multifile stream open as long as any substreams are still pointing to it, using a simplified reference counting (care is taken not to fully make StreamWrapper reference-counted, since it's not in express and existing uses should not be broken).

Fixes #449
Also see #428
2018-11-27 21:19:38 +01:00
rdb 26fcf131c9 Merge branch 'master' into input-overhaul 2018-11-25 17:10:31 +01:00
rdb e32388c2f8 interrogate: fix crash reading static property 2018-11-24 22:44:09 +01:00
rdb 3d7fcf2ce9 Merge branch 'master' into deploy-ng 2018-11-12 18:31:43 +01:00
rdb 074c5187b0 Adopt new WindowProperties(size=(x, y), ...) short-hand
This is intended as replacement for WindowProperties.size(x, y), which is deprecated since it conflicts with the `size` property.  See #444.
2018-11-12 17:53:53 +01:00
rdb 598664ab80 interrogate: disambiguate case where static method shadows a property
While it becomes possible to do this now, it should not become standard practice, and we should deprecate cases where we already do it by renaming either the static method or the property.

Fixes #444
2018-11-12 16:31:54 +01:00
Sam Edwards a9dfd8352e general: Distinguish local/system includes
This changes includes so that local includes are consistently
#include "localFile.h"
while system and third-party includes are consistently
#include <systemFile.h>

This commit mostly converts the former to the latter; the two
exceptions are in android_main.cxx and fmodAudioSound.h, where
the reverse was necessary.
2018-11-10 18:00:10 -07:00
rdb 0581e414a4 parser-inc: remove patchlevel.h include from Python.h 2018-11-09 11:40:11 +01:00
rdb 5ba09ec5a0 interrogate: fix compile error when building with LINK_ALL_STATIC
Fixes #442
2018-11-09 11:38:41 +01:00
rdb cf65010a54 Merge branch 'master' into deploy-ng 2018-11-06 23:40:24 +01:00
rdb 70bfe21a63 Merge branch 'master' into input-overhaul 2018-11-06 22:10:39 +01:00
rdb b8ed9b1275 Remove pystub dependency from interrogate and friends 2018-11-06 21:49:17 +01:00
rdb 6e8cb98861 dtoolbase: fix compile errors with --no-python 2018-11-06 20:32:37 +01:00
rdb 49b72fb198 Move Python support code from libp3interrogatedb to generated module
This prevents libp3interrogatedb from having a dependency on the Python library.

See #387
2018-11-06 19:24:37 +01:00
rdb e6f870ece6 Remove Python type tables from interrogatedb 2018-11-05 22:14:25 +01:00
rdb b13c4fb8d1 pystub: add a few more calls 2018-11-05 22:14:20 +01:00
rdb 23bb814f3f Merge branch 'master' into deploy-ng 2018-11-04 15:26:58 +01:00
Sam Edwards 0b91b3eeb3 vrpn: Add VRPN headers to parser-inc, remove CPPPARSER workarounds 2018-11-03 22:51:32 -06:00
rdb a799bcaec9 Merge branch 'master' into deploy-ng 2018-11-03 22:51:32 +01:00
rdb 5ac3cf3fc6 Eliminate C++ DConfig; replace it with a Python compatibility shim 2018-11-02 23:27:07 +01:00
rdb 357b6d3093 Merge branch 'master' into input-overhaul 2018-10-29 23:40:46 +01:00
rdb ad3b145951 interrogate: generated property getter should copy in some cases
This is to fix eg. public ButtonHandle members from being returned as const reference, which means they won't outlive the struct they are accessed on, a recipe for obscure crashes.

The is_trivial() criterium for this to apply is admittedly really arbitrary; I haven't really figured out what the right criterium should be, but it's better than hardcoding ButtonHandle.
2018-10-29 16:08:29 -06:00
rdb 2ed4cd7ce6 cppparser: fix CPPStructType::is_trivial() for eg. ButtonHandle 2018-10-29 16:08:29 -06:00
Mitchell Stokes b16f9f8f4f Merge branch 'master' into deploy-ng 2018-10-18 17:58:21 -07:00
loblao e67d2a16c1
Dtool_PyModuleInitHelper: Fix segfault 2018-10-18 12:14:20 -03:00
Younguk Kim d6efceb1ed dtoolbase: fix NOMINMAX macro redefinition warning 2018-10-17 20:47:20 +09:00
rdb 9da335ac42 Merge branch 'master' into deploy-ng 2018-10-16 23:02:19 +02:00
rdb 90cc8fe385 Fix building with SIMPLE_THREADS=1 2018-10-16 22:15:36 +02:00
rdb 82e2c39172 dtoolutil: fix tautological comparison compile warning 2018-10-16 16:32:57 +02:00
rdb dd50d7d206 Merge branch 'master' into deploy-ng 2018-10-16 12:37:32 +02:00
rdb 51f5124048 dtoolutil: consistently use char32_t for Unicode code points
Unlike wchar_t, char32_t is guaranteed to be able to hold a UTF-32 character.
2018-10-15 22:23:45 +02:00
rdb ebfb3702ac prc: work around macOS compiler error when making optimized build 2018-10-15 22:21:45 +02:00
rdb c28045990c Merge branch 'master' into deploy-ng 2018-10-15 15:42:48 +02:00
rdb d7f19b73e0 dtoolutil: minor fix to TextEncoder::append_text 2018-10-15 13:27:36 +02:00
Sam Edwards 602ea6ebf4 general: Fix a couple more compiler warnings
- express: Fix a warning when compiling for debug

- dtoolutil: Give TextEncoder a virtual destructor
2018-10-13 16:14:34 -06:00
rdb 29b577971f dtoolutil: improve Unicode encoding/decoding, support non-BMP chars
- Support encoding and decoding four-byte UTF-8 sequences
- E_unicode supports surrogate pairs, renamed to E_utf16be for clarity
- char32_t should be used for storing a Unicode code point
2018-10-08 22:33:54 +02:00
rdb 9061fd9416 dtoolutil: fix TextEncoder methods for Python 3
The no-arguments get_text() and set_text() will now return Unicode strings in Python 3, but passing in an encoding will make them return/take bytes objects.

In Python 2, they all take regular strings, but Unicode is also accepted by the no-argument get_text() and set_text().

In the future we probably want to remove most of this interface for Python users, to whom all this is unnecessary since it duplicates functionality already in the standard library.
2018-10-08 22:14:51 +02:00
rdb 14042faa3d Merge branch 'master' into input-overhaul 2018-10-08 01:25:33 +02:00
rdb 8375340582 py_panda: fix TypeError being raised instead of AttributeError
This prevented doing something like hasattr(vec3, "stuff")
2018-10-07 20:24:19 +02:00
Sam Edwards 8d14705689 interrogate: Fix typo 2018-10-07 01:36:44 -06:00
rdb 3ffe11485d Merge branch 'master' into input-overhaul 2018-09-28 15:12:49 +02:00
rdb 5ae38a8a92 Fix crash loading from search path
Possible fix for #395
2018-09-27 22:16:56 +02:00
rdb a3a7c0cf9d parser-inc: add more POSIX system header stubs 2018-09-23 14:21:19 +02:00
rdb 77724f49dc dtoolbase: remove TypeHandle::_none symbol, no longer needed 2018-09-23 13:50:06 +02:00
rdb d6b7abedfe prc: fix some race conditions querying bool and searchpath vars
This is not perfect, and we need to more thoroughly address thread safety in the PRC system, but it will nonetheless address a lot of the race condition issues when querying these variables from two threads at the same time.
2018-09-23 13:44:38 +02:00
rdb aacafe7be3 dtoolutil: give DSearchPath a defaulted move constructor 2018-09-23 13:03:47 +02:00
rdb 338b428e65 Merge branch 'master' into deploy-ng 2018-09-17 17:37:07 +02:00
rdb e30b597926 Merge branch 'master' into input-overhaul 2018-09-16 12:28:22 +02:00
rdb 8b3cc74cad interrogate: write out OS-generic filenames in #include directives
Fixes #386
2018-09-13 21:14:04 +02:00
rdb cb9e65720a interrogate: do not use MOVE in generated code, but use std::move 2018-09-09 13:48:50 +02:00
rdb 809f9b04f6 Fix problems with spinlock mutex/cvar implementation
This reimplements the spinlock on top of std::atomic_flag, which is guaranteed to be lockless.  It also inserts the PAUSE (REP NOP) instruction which is strongly recommended to be placed in busy-wait loops by Intel.

This also includes a recursive spinlock implementation.

The spinlock implementation is disabled by default, but can be enabled by adding the --override MUTEX_SPINLOCK=1 flag to makepanda.
2018-09-04 12:58:48 +02:00
rdb 670047b4b0 dtoolbase: enable use of std::atomic_flag, also on macOS 2018-09-04 12:02:13 +02:00
Sam Edwards 4695557a5d general: Don't require BUILDING_* for static builds 2018-08-31 23:54:32 -06:00
rdb 1d6c3f6486 Merge branch 'master' into input-overhaul 2018-08-26 19:03:21 +02:00
rdb b1fc88027a dtoolbase: add missing DTOOL_PLATFORM for linux_aarch64 2018-08-26 14:04:48 +02:00
rdb c9372c3699 Fix a few GCC compile warnings 2018-08-26 14:02:33 +02:00
rdb 57b66ebeaf Merge branch 'master' into deploy-ng 2018-08-20 19:13:04 +02:00
Mitchell Stokes f663d215d5 Remove some unused variables 2018-08-19 16:55:07 +02:00
rdb c4b657b5b2 interrogate: support implicit typecast operators in some cases
For example, this will let us pass a ConfigVariableFilename to anything that accepts a Filename, just like in C++.

Does not work if the return value if the typecast operator requires management.
2018-08-19 16:06:16 +02:00
rdb 21f5e77467 dtoolbase: prefer GCC AtomicAdjust implementation over i386 asm one 2018-08-19 16:05:39 +02:00
rdb 5da8b63a66 cppparser: fix formatting of typecast operator 2018-08-19 16:04:56 +02:00
Mitchell Stokes 49c47164ff Merge remote-tracking branch 'origin/master' into deploy-ng 2018-08-12 19:58:15 -07:00
rdb 4ff619b75f pystub: fix some definitions that should be variables, not funcs
This is needed to compile Panda3D with -flto.
2018-08-09 14:56:40 +02:00
rdb 2a2b48134b parser-inc: fix bad socklen_t definition in ws2tcpip.h 2018-08-02 21:24:37 +02:00
rdb 30721ba33b cppparser: fix issues when parsing templated constructor definition 2018-07-31 14:05:08 +02:00
rdb 079a7495f2 Fix macOS build by providing missing std::copysign 2018-07-31 10:47:16 +02:00
rdb ad3ab3ad21 Define stable ordering for WeakPointerTo for use as map/set key
Currently, the WeakPointerTo comparison operators compare the raw pointers, but this is not useful as it may cause a false equality if one weak pointer in the comparison is expired and points to memory that has since been reused.

Instead, we can define a comparison based on the control block pointer, which exists since the new weak pointer implementation in 0bb81a43c9.  This is implemented in the owner_before method, matching C++11 std::weak_ptr semantics.

I would now recommend deprecating most comparison operators of WeakPointerTo or redefining them to make more sense, ie. comparing equal if they (once) referred to the same object and not if they simply point to the same memory address.  This has not yet been done, though code that uses the comparison operators has been fixed in this commit.

Overloads of std::owner_less have been provided for creating a map or set with Weak(Const)PointerTo keys.
2018-07-30 17:27:09 +02:00
rdb 684a58e7e9 parser-inc: add timespec 2018-07-17 22:21:44 +02:00
Mitchell Stokes e4cf73378c Merge remote-tracking branch 'origin/master' into deploy-ng 2018-07-15 14:38:05 -07:00
Mitchell Stokes c33ae8a95f Merge branch 'master' into deploy-ng 2018-07-15 12:42:51 -07:00
rdb e673937384 parser-inc: add <memory> include to unordered_map/set for allocator 2018-07-09 16:02:06 +02:00
rdb e9e18c2277 dtoolutil: fix PandaSystem TypeHandle static init issue 2018-07-04 20:29:31 +02:00
rdb 68e7f681f4 interrogate: support enum class to limited extent in Python 2
Only the basics are supported; the __members__ or iter interface is not supported at this time.

See also #351 for discussion on pulling in enum34 module.
2018-07-02 12:16:35 +02:00
rdb 9441c28f61 interrogate: do not wrap methods with rvalue arguments
This could in theory be supported, but this is not really intuitive from a Python user's point of view.
2018-06-30 21:38:45 +02:00
rdb e191ee84f4 cppparser: class is not implicitly copyable if it has a move ctor 2018-06-30 21:38:45 +02:00
rdb b2c04a8c7a interrogate: support scoped enum args and return values 2018-06-30 21:38:40 +02:00