Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2020-06-14 13:02:25 +02:00
commit d01c53c2d8
24 changed files with 4423 additions and 4195 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
/* A Bison parser, made by GNU Bison 3.0.5. */
/* A Bison parser, made by GNU Bison 3.5.3. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,6 +31,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
# define YY_CPPYY_BUILT_TMP_CPPBISON_YXX_H_INCLUDED
/* Debug traces. */

View File

@ -1891,7 +1891,7 @@ instance_identifier_and_maybe_trailing_return_type:
}
$$ = $1;
}
| instance_identifier ':' INTEGER
| instance_identifier ':' const_expr
{
// Bitfield definition.
$1->_bit_width = $3;
@ -3278,17 +3278,9 @@ no_angle_bracket_const_expr:
{
$$ = new CPPExpression(CPPExpression::sizeof_func($3));
}
| KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
| KW_SIZEOF no_angle_bracket_const_expr %prec UNARY
{
CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
if (arg == nullptr) {
yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
} else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
CPPInstance *inst = arg->as_instance();
$$ = new CPPExpression(CPPExpression::sizeof_func(inst->_type));
} else {
$$ = new CPPExpression(CPPExpression::sizeof_func(arg->as_type()));
}
$$ = new CPPExpression(CPPExpression::sizeof_func($2));
}
| KW_SIZEOF ELLIPSIS '(' name ')' %prec UNARY
{
@ -3402,9 +3394,9 @@ no_angle_bracket_const_expr:
{
$$ = new CPPExpression('f', $1);
}
| no_angle_bracket_const_expr '.' no_angle_bracket_const_expr
| no_angle_bracket_const_expr '.' name
{
$$ = new CPPExpression('.', $1, $3);
$$ = new CPPExpression('.', $1, new CPPExpression($3, current_scope, global_scope, current_lexer));
}
| no_angle_bracket_const_expr POINTSAT no_angle_bracket_const_expr
{
@ -3542,17 +3534,9 @@ const_expr:
{
$$ = new CPPExpression(CPPExpression::sizeof_func($3));
}
| KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
| KW_SIZEOF const_expr %prec UNARY
{
CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
if (arg == nullptr) {
yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
} else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
CPPInstance *inst = arg->as_instance();
$$ = new CPPExpression(CPPExpression::sizeof_func(inst->_type));
} else {
$$ = new CPPExpression(CPPExpression::sizeof_func(arg->as_type()));
}
$$ = new CPPExpression(CPPExpression::sizeof_func($2));
}
| KW_SIZEOF ELLIPSIS '(' name ')' %prec UNARY
{
@ -3704,9 +3688,9 @@ const_expr:
{
$$ = new CPPExpression('f', $1);
}
| const_expr '.' const_expr
| const_expr '.' name
{
$$ = new CPPExpression('.', $1, $3);
$$ = new CPPExpression('.', $1, new CPPExpression($3, current_scope, global_scope, current_lexer));
}
| const_expr POINTSAT const_expr
{
@ -3886,17 +3870,9 @@ formal_const_expr:
{
$$ = new CPPExpression(CPPExpression::sizeof_func($3));
}
| KW_SIZEOF '(' IDENTIFIER ')' %prec UNARY
| KW_SIZEOF formal_const_expr %prec UNARY
{
CPPDeclaration *arg = $3->find_symbol(current_scope, global_scope, current_lexer);
if (arg == nullptr) {
yyerror("undefined sizeof argument: " + $3->get_fully_scoped_name(), @3);
} else if (arg->get_subtype() == CPPDeclaration::ST_instance) {
CPPInstance *inst = arg->as_instance();
$$ = new CPPExpression(CPPExpression::sizeof_func(inst->_type));
} else {
$$ = new CPPExpression(CPPExpression::sizeof_func(arg->as_type()));
}
$$ = new CPPExpression(CPPExpression::sizeof_func($2));
}
| KW_SIZEOF ELLIPSIS '(' name ')' %prec UNARY
{
@ -4044,9 +4020,9 @@ formal_const_expr:
{
$$ = new CPPExpression('f', $1);
}
| formal_const_expr '.' const_expr
| formal_const_expr '.' name
{
$$ = new CPPExpression('.', $1, $3);
$$ = new CPPExpression('.', $1, new CPPExpression($3, current_scope, global_scope, current_lexer));
}
| formal_const_expr POINTSAT const_expr
{

View File

@ -429,12 +429,24 @@ type_trait(int trait, CPPType *type, CPPType *arg) {
CPPExpression CPPExpression::
sizeof_func(CPPType *type) {
CPPExpression expr(0);
expr._type = T_sizeof;
expr._type = T_sizeof_type;
expr._u._typecast._to = type;
expr._u._typecast._op1 = nullptr;
return expr;
}
/**
*
*/
CPPExpression CPPExpression::
sizeof_func(CPPExpression *op1) {
CPPExpression expr(0);
expr._type = T_sizeof_expr;
expr._u._typecast._to = nullptr;
expr._u._typecast._op1 = op1;
return expr;
}
/**
*
*/
@ -629,7 +641,8 @@ evaluate() const {
case T_empty_aggregate_init:
case T_new:
case T_default_new:
case T_sizeof:
case T_sizeof_type:
case T_sizeof_expr:
case T_sizeof_ellipsis:
return Result();
@ -1058,7 +1071,8 @@ determine_type() const {
case T_default_new:
return CPPType::new_type(new CPPPointerType(_u._typecast._to));
case T_sizeof:
case T_sizeof_type:
case T_sizeof_expr:
case T_sizeof_ellipsis:
case T_alignof:
// Note: this should actually be size_t, but that is defined as a typedef
@ -1334,10 +1348,13 @@ is_fully_specified() const {
case T_default_construct:
case T_empty_aggregate_init:
case T_default_new:
case T_sizeof:
case T_sizeof_type:
case T_alignof:
return _u._typecast._to->is_fully_specified();
case T_sizeof_expr:
return _u._typecast._op1->is_fully_specified();
case T_sizeof_ellipsis:
return _u._ident->is_fully_specified();
@ -1469,7 +1486,7 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
case T_default_construct:
case T_empty_aggregate_init:
case T_default_new:
case T_sizeof:
case T_sizeof_type:
case T_alignof:
rep->_u._typecast._to =
_u._typecast._to->substitute_decl(subst, current_scope, global_scope)
@ -1477,6 +1494,13 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
any_changed = any_changed || (rep->_u._typecast._to != _u._typecast._to);
break;
case T_sizeof_expr:
rep->_u._typecast._op1 =
_u._typecast._op1->substitute_decl(subst, current_scope, global_scope)
->as_expression();
any_changed = any_changed || (rep->_u._typecast._op1 != _u._typecast._op1);
break;
case T_trinary_operation:
rep->_u._op._op3 =
_u._op._op3->substitute_decl(subst, current_scope, global_scope)
@ -1567,10 +1591,13 @@ is_tbd() const {
case T_new:
case T_default_construct:
case T_default_new:
case T_sizeof:
case T_sizeof_type:
case T_alignof:
return _u._typecast._to->is_tbd();
case T_sizeof_expr:
return _u._typecast._op1->is_tbd();
case T_trinary_operation:
if (_u._op._op3->is_tbd()) {
return true;
@ -1807,12 +1834,17 @@ output(std::ostream &out, int indent_level, CPPScope *scope, bool) const {
out << "())";
break;
case T_sizeof:
case T_sizeof_type:
out << "sizeof(";
_u._typecast._to->output(out, indent_level, scope, false);
out << ")";
break;
case T_sizeof_expr:
out << "sizeof ";
_u._typecast._op1->output(out, indent_level, scope, false);
break;
case T_sizeof_ellipsis:
out << "sizeof...(";
_u._ident->output(out, scope);
@ -2222,10 +2254,13 @@ is_equal(const CPPDeclaration *other) const {
case T_default_construct:
case T_empty_aggregate_init:
case T_default_new:
case T_sizeof:
case T_sizeof_type:
case T_alignof:
return _u._typecast._to == ot->_u._typecast._to;
case T_sizeof_expr:
return _u._typecast._op1 == ot->_u._typecast._op1;
case T_unary_operation:
return *_u._op._op1 == *ot->_u._op._op1;
@ -2324,10 +2359,13 @@ is_less(const CPPDeclaration *other) const {
case T_default_construct:
case T_empty_aggregate_init:
case T_default_new:
case T_sizeof:
case T_sizeof_type:
case T_alignof:
return _u._typecast._to < ot->_u._typecast._to;
case T_sizeof_expr:
return _u._typecast._op1 < ot->_u._typecast._op1;
case T_trinary_operation:
if (*_u._op._op3 != *ot->_u._op._op3) {
return *_u._op._op3 < *ot->_u._op._op3;

View File

@ -52,7 +52,8 @@ public:
T_empty_aggregate_init,
T_new,
T_default_new,
T_sizeof,
T_sizeof_type,
T_sizeof_expr,
T_sizeof_ellipsis,
T_alignof,
T_unary_operation,
@ -89,6 +90,7 @@ public:
static CPPExpression typeid_op(CPPExpression *op1, CPPType *std_type_info);
static CPPExpression type_trait(int trait, CPPType *type, CPPType *arg = nullptr);
static CPPExpression sizeof_func(CPPType *type);
static CPPExpression sizeof_func(CPPExpression *op1);
static CPPExpression sizeof_ellipsis_func(CPPIdentifier *ident);
static CPPExpression alignof_func(CPPType *type);
static CPPExpression lambda(CPPClosureType *type);

View File

@ -74,7 +74,17 @@ CPPInstance(CPPType *type, CPPInstanceIdentifier *ii, int storage_class,
ii->_ident = nullptr;
_storage_class = storage_class;
_initializer = nullptr;
_bit_width = ii->_bit_width;
if (ii->_bit_width != nullptr) {
CPPExpression::Result result = ii->_bit_width->evaluate();
if (result._type != CPPExpression::RT_error) {
_bit_width = ii->_bit_width->evaluate().as_integer();
} else {
_bit_width = -1;
}
} else {
_bit_width = -1;
}
CPPParameterList *params = ii->get_initializer();
if (params != nullptr) {

View File

@ -82,7 +82,7 @@ initializer_type(CPPParameterList *params) {
CPPInstanceIdentifier::
CPPInstanceIdentifier(CPPIdentifier *ident) :
_ident(ident),
_bit_width(-1),
_bit_width(nullptr),
_packed(false) {
}

View File

@ -86,8 +86,8 @@ public:
typedef std::vector<Modifier> Modifiers;
Modifiers _modifiers;
// If not -1, indicates a bitfield
int _bit_width;
// If not null, indicates a bitfield
CPPExpression *_bit_width;
// Indicates a parameter pack
bool _packed;

View File

@ -24,19 +24,23 @@
#include <stdcompare.h>
#include <pair>
template<class key, class element, class compare = less<key> >
namespace std {
template<class T> class allocator;
}
template<class Key, class Element, class Compare = less<Key>, class Allocator = std::allocator<pair<const Key, T> > >
class map {
public:
typedef key key_type;
typedef element data_type;
typedef element mapped_type;
typedef pair<const key, element> value_type;
typedef compare key_compare;
typedef Key key_type;
typedef Element data_type;
typedef Element mapped_type;
typedef pair<const Key, Element> value_type;
typedef Compare key_compare;
typedef element *pointer;
typedef const element *const_pointer;
typedef element &reference;
typedef const element &const_reference;
typedef Element *pointer;
typedef const Element *const_pointer;
typedef Element &reference;
typedef const Element &const_reference;
class iterator;
class const_iterator;

View File

@ -1,5 +1,7 @@
#pragma once
#include <iosfwd>
namespace std {
template<class CharT, class Traits>
std::basic_ostream<CharT, Traits> &ends(std::basic_ostream<CharT, Traits> &os);

View File

@ -26,6 +26,7 @@
namespace std {
template<class charT> struct char_traits;
template<class T> class allocator;
template<> struct char_traits<char> {
using char_type = char;
@ -51,7 +52,7 @@ namespace std {
using state_type = mbstate_t;
};
template<class ctype>
template<class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> >
class basic_string {
public:
struct iterator;
@ -63,17 +64,17 @@ namespace std {
static const size_t npos = -1;
basic_string();
basic_string(const basic_string<ctype> &copy);
void operator = (const basic_string<ctype> &copy);
basic_string(const ctype *string);
basic_string(const basic_string<CharT> &copy);
void operator = (const basic_string<CharT> &copy);
basic_string(const CharT *string);
~basic_string();
const ctype *c_str() const;
const CharT *c_str() const;
size_t length() const;
ctype at(size_t pos) const;
ctype operator[](size_t pos) const;
ctype &operator[](size_t pos);
CharT at(size_t pos) const;
CharT operator[](size_t pos) const;
CharT &operator[](size_t pos);
};
typedef basic_string<char> string;

View File

@ -22,17 +22,21 @@
#include <stdtypedefs.h>
namespace std {
template<class T> class allocator;
}
inline namespace std {
template<class element>
template<class T, class Allocator = std::allocator<T> >
class vector {
public:
typedef element value_type;
typedef T value_type;
typedef element *pointer;
typedef const element *const_pointer;
typedef element &reference;
typedef const element &const_reference;
typedef T *pointer;
typedef const T *const_pointer;
typedef T &reference;
typedef const T &const_reference;
typedef pointer iterator;
typedef const_pointer const_iterator;

View File

@ -42,6 +42,8 @@ public:
virtual CollisionSolid *make_copy();
static bool verify_points(const LPoint3 *begin, const LPoint3 *end);
PUBLISHED:
virtual LPoint3 get_collision_origin() const;
@ -53,7 +55,6 @@ PUBLISHED:
INLINE static bool verify_points(const LPoint3 &a, const LPoint3 &b,
const LPoint3 &c, const LPoint3 &d);
static bool verify_points(const LPoint3 &a, const LPoint3 &b, const LPoint3 &c);
static bool verify_points(const LPoint3 *begin, const LPoint3 *end);
bool is_valid() const;
bool is_concave() const;

View File

@ -111,9 +111,9 @@ get_verify_ssl() const {
* Specifies the set of ciphers that are to be made available for SSL
* connections. This is a string as described in the ciphers(1) man page of
* the OpenSSL documentation (or see
* https://www.openssl.org/docs/apps/ciphers.html ). If this isn't specified,
* the default is provided by the Config file. You may also specify "DEFAULT"
* to use the built-in OpenSSL default value.
* https://www.openssl.org/docs/man1.1.1/man1/ciphers.html ). If this isn't
* specified, the default is provided by the Config file. You may also specify
* "DEFAULT" to use the built-in OpenSSL default value.
*/
INLINE void HTTPClient::
set_cipher_list(const std::string &cipher_list) {

View File

@ -60,7 +60,7 @@ set_budget(int total_budget) {
}
/**
* Gets the total triangle budget of the drawer
* Gets the total triangle budget of the drawer.
*/
INLINE int MeshDrawer2D::
get_budget() {
@ -68,7 +68,7 @@ get_budget() {
}
/**
* Sets clipping rectangle
* Sets the clipping rectangle.
*/
INLINE void MeshDrawer2D::
set_clip(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h) {
@ -79,7 +79,7 @@ set_clip(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h) {
}
/**
* Draws a 2d rectangle. Ignores the cliping rectangle
* Draws a 2D rectangle. Ignores the clipping rectangle.
*/
INLINE void MeshDrawer2D::
quad_raw(const LVector3 &v1, const LVector4 &c1, const LVector2 &uv1,
@ -125,7 +125,7 @@ rectangle_raw(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,
}
/**
* Draws a 2d rectangle, that can be cliped
* Draws a 2D rectangle which can be clipped.
*/
INLINE void MeshDrawer2D::
rectangle(PN_stdfloat x, PN_stdfloat y, PN_stdfloat w, PN_stdfloat h,

View File

@ -39,8 +39,8 @@
#include "nodePath.h"
/**
* This class allows the drawing of 2d objects - mainly based on quads and
* rectangles. Allows clipping and serverl high level UI theme functions.
* This class allows the drawing of 2D objects - mainly based on quads and
* rectangles. It allows clipping and several high level UI theme functions.
*/
class EXPCL_PANDA_GRUTIL MeshDrawer2D : public TypedObject {
PUBLISHED:

View File

@ -136,7 +136,10 @@ private:
* used to do a full reset of buffers
*/
inline void Buffered_DatagramConnection::ClearAll(void) {
nativenet_cat.error() << "Buffered_DatagramConnection::ClearAll Starting Auto Reset\n";
if (nativenet_cat.is_debug()) {
nativenet_cat.debug()
<< "Buffered_DatagramConnection::ClearAll Starting Auto Reset\n";
}
Close();
_Writer.ReSet();
_Reader.ReSet();
@ -215,8 +218,11 @@ inline Buffered_DatagramConnection::~Buffered_DatagramConnection(void)
inline Buffered_DatagramConnection::Buffered_DatagramConnection(int rbufsize, int wbufsize, int write_flush_point)
: _Writer(wbufsize,write_flush_point) , _Reader(rbufsize)
{
nativenet_cat.error() << "Buffered_DatagramConnection Constructor rbufsize = " << rbufsize
<< " wbufsize = " << wbufsize << " write_flush_point = " << write_flush_point << "\n";
if (nativenet_cat.is_debug()) {
nativenet_cat.debug()
<< "Buffered_DatagramConnection Constructor rbufsize = " << rbufsize
<< " wbufsize = " << wbufsize << " write_flush_point = " << write_flush_point << "\n";
}
}
inline bool Buffered_DatagramConnection::SendMessageBufferOnly(Datagram &msg)
@ -289,7 +295,9 @@ bool Buffered_DatagramConnection::Flush(void)
* Reset
*/
inline void Buffered_DatagramConnection::Reset() {
nativenet_cat.error() << "Buffered_DatagramConnection::Reset()\n";
if (nativenet_cat.is_debug()) {
nativenet_cat.debug() << "Buffered_DatagramConnection::Reset()\n";
}
ClearAll();
}

View File

@ -507,8 +507,10 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) {
<< " draw_mask = " << data._draw_mask << "\n";
}
Thread *current_thread = trav->get_current_thread();
// Get all the Geoms, with no decalling.
Geoms geoms = get_geoms(trav->get_current_thread());
Geoms geoms = get_geoms(current_thread);
int num_geoms = geoms.get_num_geoms();
trav->_geoms_pcollector.add_level(num_geoms);
CPT(TransformState) internal_transform = data.get_internal_transform(trav);
@ -532,9 +534,9 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) {
if (num_geoms > 1) {
if (data._view_frustum != nullptr) {
// Cull the individual Geom against the view frustum.
CPT(BoundingVolume) geom_volume = geom->get_bounds();
CPT(BoundingVolume) geom_volume = geom->get_bounds(current_thread);
const GeometricBoundingVolume *geom_gbv =
DCAST(GeometricBoundingVolume, geom_volume);
geom_volume->as_geometric_bounding_volume();
int result = data._view_frustum->contains(geom_gbv);
if (result == BoundingVolume::IF_no_intersection) {
@ -544,9 +546,9 @@ add_for_draw(CullTraverser *trav, CullTraverserData &data) {
}
if (!data._cull_planes->is_empty()) {
// Also cull the Geom against the cull planes.
CPT(BoundingVolume) geom_volume = geom->get_bounds();
CPT(BoundingVolume) geom_volume = geom->get_bounds(current_thread);
const GeometricBoundingVolume *geom_gbv =
DCAST(GeometricBoundingVolume, geom_volume);
geom_volume->as_geometric_bounding_volume();
int result;
data._cull_planes->do_cull(result, state, geom_gbv);
if (result == BoundingVolume::IF_no_intersection) {

View File

@ -165,6 +165,12 @@ clear_python_tag(PyObject *key) {
if (PyDict_GetItem(dict, key) != nullptr) {
PyDict_DelItem(dict, key);
}
if (PyDict_Size(dict) == 0 && Py_REFCNT(dict) == 1) {
// This was the last tag, and do_get_python_tags() made sure we have a
// unique reference to the tags, so clear the tag object.
_this->_python_tag_data.clear();
}
}
/**

View File

@ -114,6 +114,11 @@ has_any_of(int low_bit, int size) const {
++w;
while (size > 0) {
if ((size_t)w >= get_num_words()) {
// Now we're up to the highest bits.
return (_highest_bits != 0);
}
if (size <= num_bits_per_word) {
// The remainder fits within one word of the array.
return _array[w].has_any_of(0, size);
@ -125,11 +130,6 @@ has_any_of(int low_bit, int size) const {
}
size -= num_bits_per_word;
++w;
if (w >= (int)get_num_words()) {
// Now we're up to the highest bits.
return (_highest_bits != 0);
}
}
return false;

View File

@ -655,6 +655,9 @@ int main(int argc, char *argv[]) {
PyImport_FrozenModules = blobinfo.pointers[0];
retval = Py_FrozenMain(argc, argv);
fflush(stdout);
fflush(stderr);
unmap_blob(blob);
return retval;
}

View File

@ -14,7 +14,6 @@ void vshader(float4 vtx_position : POSITION,
}
void fshader(float4 l_pos: TEXCOORD0,
float4 l_scale: TEXCOORD1,
uniform sampler2D k_texnormal : TEXUNIT0,
uniform sampler2D k_texalbedo : TEXUNIT1,
uniform sampler2D k_texdepth : TEXUNIT2,

View File

@ -194,6 +194,35 @@ def test_nodepath_python_tags():
assert rc1 == rc2
def test_nodepath_clear_python_tag():
from panda3d.core import NodePath
path = NodePath("node")
assert not path.has_python_tag("a")
assert not path.has_python_tag("b")
assert not path.node().has_tags()
path.set_python_tag("a", "value")
assert path.has_python_tag("a")
assert not path.has_python_tag("b")
assert path.node().has_tags()
path.set_python_tag("b", "value")
assert path.has_python_tag("a")
assert path.has_python_tag("b")
assert path.node().has_tags()
path.clear_python_tag("a")
assert not path.has_python_tag("a")
assert path.has_python_tag("b")
assert path.node().has_tags()
path.clear_python_tag("b")
assert not path.has_python_tag("a")
assert not path.has_python_tag("b")
assert not path.node().has_tags()
def test_nodepath_replace_texture():
from panda3d.core import NodePath, Texture

View File

@ -123,3 +123,20 @@ def test_bitarray_pickle():
ba = ~BitArray(94187049178237918273981729127381723)
assert ba == pickle.loads(pickle.dumps(ba, -1))
def test_bitarray_has_any_of():
ba = BitArray()
assert not ba.has_any_of(100, 200)
ba = BitArray()
ba.set_range(0, 53)
assert ba.has_any_of(52, 1)
assert ba.has_any_of(52, 100)
assert not ba.has_any_of(53, 45)
ba = BitArray()
ba.invert_in_place()
assert ba.has_any_of(0, 1)
assert ba.has_any_of(53, 45)
assert ba.has_any_of(0, 100)