Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2023-08-04 14:07:41 +02:00
commit a68ecb9765
6 changed files with 1259 additions and 1265 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.1. */
/* A Bison parser, made by GNU Bison 3.8.2. */
/* 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-2021 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
@ -15,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -30,6 +31,10 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_DCYY_BUILT_TMP_DCPARSER_YXX_H_INCLUDED
# define YY_DCYY_BUILT_TMP_DCPARSER_YXX_H_INCLUDED
/* Debug traces. */
@ -40,54 +45,63 @@
extern int dcyydebug;
#endif
/* Token type. */
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
UNSIGNED_INTEGER = 258,
SIGNED_INTEGER = 259,
REAL = 260,
STRING = 261,
IDENTIFIER = 262,
HEX_STRING = 263,
KEYWORD = 264,
KW_DCLASS = 265,
KW_STRUCT = 266,
KW_FROM = 267,
KW_IMPORT = 268,
KW_TYPEDEF = 269,
KW_KEYWORD = 270,
KW_SWITCH = 271,
KW_CASE = 272,
KW_DEFAULT = 273,
KW_BREAK = 274,
KW_INT8 = 275,
KW_INT16 = 276,
KW_INT32 = 277,
KW_INT64 = 278,
KW_UINT8 = 279,
KW_UINT16 = 280,
KW_UINT32 = 281,
KW_UINT64 = 282,
KW_FLOAT64 = 283,
KW_STRING = 284,
KW_BLOB = 285,
KW_BLOB32 = 286,
KW_INT8ARRAY = 287,
KW_INT16ARRAY = 288,
KW_INT32ARRAY = 289,
KW_UINT8ARRAY = 290,
KW_UINT16ARRAY = 291,
KW_UINT32ARRAY = 292,
KW_UINT32UINT8ARRAY = 293,
KW_CHAR = 294,
START_DC = 295,
START_PARAMETER_VALUE = 296,
START_PARAMETER_DESCRIPTION = 297
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
UNSIGNED_INTEGER = 258, /* UNSIGNED_INTEGER */
SIGNED_INTEGER = 259, /* SIGNED_INTEGER */
REAL = 260, /* REAL */
STRING = 261, /* STRING */
IDENTIFIER = 262, /* IDENTIFIER */
HEX_STRING = 263, /* HEX_STRING */
KEYWORD = 264, /* KEYWORD */
KW_DCLASS = 265, /* KW_DCLASS */
KW_STRUCT = 266, /* KW_STRUCT */
KW_FROM = 267, /* KW_FROM */
KW_IMPORT = 268, /* KW_IMPORT */
KW_TYPEDEF = 269, /* KW_TYPEDEF */
KW_KEYWORD = 270, /* KW_KEYWORD */
KW_SWITCH = 271, /* KW_SWITCH */
KW_CASE = 272, /* KW_CASE */
KW_DEFAULT = 273, /* KW_DEFAULT */
KW_BREAK = 274, /* KW_BREAK */
KW_INT8 = 275, /* KW_INT8 */
KW_INT16 = 276, /* KW_INT16 */
KW_INT32 = 277, /* KW_INT32 */
KW_INT64 = 278, /* KW_INT64 */
KW_UINT8 = 279, /* KW_UINT8 */
KW_UINT16 = 280, /* KW_UINT16 */
KW_UINT32 = 281, /* KW_UINT32 */
KW_UINT64 = 282, /* KW_UINT64 */
KW_FLOAT64 = 283, /* KW_FLOAT64 */
KW_STRING = 284, /* KW_STRING */
KW_BLOB = 285, /* KW_BLOB */
KW_BLOB32 = 286, /* KW_BLOB32 */
KW_INT8ARRAY = 287, /* KW_INT8ARRAY */
KW_INT16ARRAY = 288, /* KW_INT16ARRAY */
KW_INT32ARRAY = 289, /* KW_INT32ARRAY */
KW_UINT8ARRAY = 290, /* KW_UINT8ARRAY */
KW_UINT16ARRAY = 291, /* KW_UINT16ARRAY */
KW_UINT32ARRAY = 292, /* KW_UINT32ARRAY */
KW_UINT32UINT8ARRAY = 293, /* KW_UINT32UINT8ARRAY */
KW_CHAR = 294, /* KW_CHAR */
START_DC = 295, /* START_DC */
START_PARAMETER_VALUE = 296, /* START_PARAMETER_VALUE */
START_PARAMETER_DESCRIPTION = 297 /* START_PARAMETER_DESCRIPTION */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Tokens. */
/* Token kinds. */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define UNSIGNED_INTEGER 258
#define SIGNED_INTEGER 259
#define REAL 260
@ -134,6 +148,8 @@ extern int dcyydebug;
extern YYSTYPE dcyylval;
int dcyyparse (void);
#endif /* !YY_DCYY_BUILT_TMP_DCPARSER_YXX_H_INCLUDED */

View File

@ -297,6 +297,7 @@ dclass_or_struct:
dclass:
KW_DCLASS optional_name
{
$<u.dclass>$ = current_class;
current_class = new DCClass(dc_file, $2, false, false);
}
dclass_derivation '{' dclass_fields '}'
@ -401,6 +402,7 @@ dclass_field:
struct:
KW_STRUCT optional_name
{
$<u.dclass>$ = current_class;
current_class = new DCClass(dc_file, $2, true, false);
}
struct_derivation '{' struct_fields '}'
@ -488,6 +490,7 @@ struct_field:
atomic_field:
optional_name '('
{
$<u.atomic>$ = current_atomic;
if (current_class == nullptr) {
yyerror("Cannot define a method outside of a struct or class.");
DCClass *temp_class = new DCClass(dc_file, "temp", false, false); // memory leak.
@ -1243,12 +1246,13 @@ optional_name:
switch:
KW_SWITCH optional_name '(' parameter_or_atomic ')' '{'
{
$<u.dswitch>$ = current_switch;
current_switch = new DCSwitch($2, $4);
}
switch_fields '}'
{
$$ = current_switch;
current_switch = (DCSwitch *)$<u.parameter>7;
current_switch = $<u.dswitch>7;
}
;

View File

@ -3315,8 +3315,9 @@ class ShowBase(DirectObject.DirectObject):
init_app_for_gui()
# Disable the Windows message loop, since Tcl wants to handle this all
# on its own.
ConfigVariableBool('disable-message-loop', False).value = True
# on its own, except if the Panda window is on a separate thread.
if self.graphicsEngine.getThreadingModel().getDrawStage() == 0:
ConfigVariableBool('disable-message-loop', False).value = True
if ConfigVariableBool('tk-main-loop', True):
# Put Tkinter in charge of the main loop. It really

View File

@ -68,6 +68,33 @@ static string format_error() {
#define format_error() strerror(errno)
#endif
#if defined(_WIN32) && defined(LIBRESSL_VERSION_NUMBER)
/**
* This exists to work around an issue with LibreSSL's version of
* BIO_sock_should_retry, which does not understand Windows error codes.
* The implementation here matches the behaviour of OpenSSL on Windows.
*/
static int
sock_should_retry(int i) {
if (i == 0 || i == -1) {
int err = WSAGetLastError();
switch (err) {
case WSAEWOULDBLOCK:
case ENOTCONN:
case EINPROGRESS:
case EALREADY:
return 1;
default:
break;
}
}
return 0;
}
#else
#define sock_should_retry(err) BIO_sock_should_retry(err)
#endif
/**
* This flavor of the constructor automatically creates a socket BIO and feeds
* it the server and port name from the indicated URL. It doesn't call
@ -214,8 +241,7 @@ connect() {
result = BIO_sock_error(fd);
} else {
result = ::connect(fd, (sockaddr *)&_addr, _addrlen);
if (result != 0 && BIO_sock_should_retry(-1)) {
if (result != 0 && sock_should_retry(-1)) {
// It's still in progress; we should retry later. This causes
// should_retry() to return true.
BIO_set_flags(_bio, BIO_FLAGS_SHOULD_RETRY);

63
tests/test_tools.py Normal file
View File

@ -0,0 +1,63 @@
import pytest
import subprocess
import sys
import os
import tempfile
import panda3d
try:
panda3d_tools = pytest.importorskip("panda3d_tools")
except:
panda3d_tools = None
def get_tool(name):
if sys.platform == 'win32':
name += '.exe'
if panda3d_tools:
tools_dir = os.path.dirname(panda3d_tools.__file__)
else:
tools_dir = os.path.join(os.path.dirname(os.path.dirname(panda3d.__file__)), 'bin')
path = os.path.join(tools_dir, name)
if not os.path.isfile(path):
pytest.skip(name + ' not found')
return path
def test_bam_info():
path = get_tool('bam-info')
output = subprocess.check_output([path, '-h'], stderr=subprocess.STDOUT).strip()
assert output.startswith(b"This program scans one or more Bam files")
def test_egg_trans():
path = get_tool('egg-trans')
output = subprocess.check_output([path, '-h'], stderr=subprocess.STDOUT).strip()
assert output.startswith(b"egg-trans reads an egg file and writes")
def test_pzip():
data = b'test \000 data'
try:
file = tempfile.NamedTemporaryFile(suffix='.bin', delete=False)
file.write(data)
file.close()
path = get_tool('pzip')
subprocess.check_output([path, file.name])
zlib = pytest.importorskip('zlib')
with open(file.name + '.pz', 'rb') as pz:
assert zlib.decompress(pz.read(), 32 + 15, 4096) == data
finally:
if os.path.isfile(file.name):
os.remove(file.name)
if os.path.isfile(file.name + '.pz'):
os.remove(file.name + '.pz')