Fix various Windows build issues

This commit is contained in:
rdb 2015-03-27 23:17:35 +01:00
parent f624cdcac0
commit 477aa4bdfe
11 changed files with 155 additions and 126 deletions

View File

@ -2263,7 +2263,7 @@ class Packager:
self.executablePath.appendDirectory('/usr/lib')
self.executablePath.appendDirectory('/usr/local/lib')
if os.uname()[1] == "pcbsd":
if self.platform.startswith('freebsd') and os.uname()[1] == "pcbsd":
self.executablePath.appendDirectory('/usr/PCBSD/local/lib')
# Set this flag true to automatically add allow_python_dev to

View File

@ -2865,7 +2865,12 @@ define_array_type(InterrogateType &itype, CPPArrayType *cpptype) {
itype._flags |= InterrogateType::F_array;
itype._wrapped_type = get_type(cpptype->_element_type, false);
itype._array_size = cpptype->_bounds->evaluate().as_integer();
if (cpptype->_bounds == NULL) {
// This indicates an unsized array.
itype._array_size = -1;
} else {
itype._array_size = cpptype->_bounds->evaluate().as_integer();
}
}
////////////////////////////////////////////////////////////////////

View File

@ -19,6 +19,6 @@
NotifyCategoryDef(prc, "");
ConfigVariableBool assert_abort
ALIGN_16BYTE ConfigVariableBool assert_abort
("assert-abort", false,
PRC_DESC("Set this true to trigger a core dump and/or stack trace when the first assertion fails"));

View File

@ -22,7 +22,8 @@ class ConfigVariableBool;
NotifyCategoryDecl(prc, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG);
extern ConfigVariableBool assert_abort;
// This is aligned to match the shadowed definition in notify.cxx.
extern ALIGN_16BYTE ConfigVariableBool assert_abort;
#endif

View File

@ -403,7 +403,7 @@ assert_failure(const char *expression, int line,
// This is redefined here, shadowing the defining in config_prc.h,
// so we can guarantee it has already been constructed.
ConfigVariableBool assert_abort("assert-abort", false);
ALIGN_16BYTE ConfigVariableBool assert_abort("assert-abort", false);
if (assert_abort) {
#ifdef WIN32
// How to trigger an exception in VC++ that offers to take us into

View File

@ -224,7 +224,7 @@ SectionGroup "Panda3D Libraries"
!endif
!ifdef HAVE_PHYSX
Section "PhysX support" SecPhysX
Section "NVIDIA PhysX" SecPhysX
SectionIn 1
SetOutPath "$INSTDIR\bin"

View File

@ -290,7 +290,7 @@ def parseopts(args):
winver = sys.getwindowsversion()
if platsdk and os.path.isdir(platsdk) and winver[0] >= 6 and winver[1] >= 1:
is_win7 = True
if not is_win7:
if RUNTIME or not is_win7:
PkgDisable("TOUCHINPUT")
parseopts(sys.argv[1:])
@ -598,14 +598,17 @@ if (COMPILER == "MSVC"):
LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex64_vc.lib")
else:
LibName("FMODEX", GetThirdpartyDir() + "fmodex/lib/fmodex_vc.lib")
if (PkgSkip("FLTK")==0 and RTDIST):
LibName("FLTK", GetThirdpartyDir() + "fltk/lib/fltk.lib")
if not PkgSkip("FLTK"):
# If we have fltk, we don't need wx
PkgDisable("WX")
if (PkgSkip("WX")==0 and RTDIST):
LibName("WX", GetThirdpartyDir() + "wx/lib/wxbase28u.lib")
LibName("WX", GetThirdpartyDir() + "wx/lib/wxmsw28u_core.lib")
DefSymbol("WX", "__WXMSW__", "")
DefSymbol("WX", "_UNICODE", "")
DefSymbol("WX", "UNICODE", "")
if (PkgSkip("FLTK")==0 and RTDIST):
LibName("FLTK", GetThirdpartyDir() + "fltk/lib/fltk.lib")
if (PkgSkip("VORBIS")==0):
LibName("VORBIS", GetThirdpartyDir() + "vorbis/lib/libogg_static.lib")
LibName("VORBIS", GetThirdpartyDir() + "vorbis/lib/libvorbis_static.lib")
@ -689,13 +692,12 @@ if (COMPILER=="GCC"):
IncDirectory("FREETYPE", "/usr/X11/include/freetype2")
LibDirectory("FREETYPE", "/usr/X11/lib")
if (os.path.isdir("/usr/PCBSD")):
IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
if (GetHost() == "freebsd"):
IncDirectory("ALWAYS", "/usr/local/include")
LibDirectory("ALWAYS", "/usr/local/lib")
if (os.path.isdir("/usr/PCBSD")):
IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
# WARNING! The order of the ffmpeg libraries matters!
@ -889,22 +891,37 @@ def printStatus(header,warnings):
tkeep = ""
tomit = ""
for x in PkgListGet():
if (PkgSkip(x)==0): tkeep = tkeep + x + " "
else: tomit = tomit + x + " "
if RTDIST: print("Makepanda: Runtime distribution build")
elif RUNTIME: print("Makepanda: Runtime build")
else: print("Makepanda: Regular build")
print("Makepanda: Compiler:",COMPILER)
print("Makepanda: Optimize:",GetOptimize())
print("Makepanda: Keep Pkg:",tkeep)
print("Makepanda: Omit Pkg:",tomit)
if (GENMAN): print("Makepanda: Generate API reference manual")
else : print("Makepanda: Don't generate API reference manual")
if (GetHost() == "windows" and not RTDIST):
if INSTALLER: print("Makepanda: Build installer, using",COMPRESSOR)
else : print("Makepanda: Don't build installer")
print("Makepanda: Version ID: "+VERSION)
for x in warnings: print("Makepanda: "+x)
if PkgSkip(x):
tomit = tomit + x + " "
else:
tkeep = tkeep + x + " "
if RTDIST:
print("Makepanda: Runtime distribution build")
elif RUNTIME:
print("Makepanda: Runtime build")
else:
print("Makepanda: Regular build")
print("Makepanda: Compiler: %s" % (COMPILER))
print("Makepanda: Optimize: %d" % (GetOptimize()))
print("Makepanda: Keep Pkg: %s" % (tkeep))
print("Makepanda: Omit Pkg: %s" % (tomit))
if GENMAN:
print("Makepanda: Generate API reference manual")
else:
print("Makepanda: Don't generate API reference manual")
if GetHost() == "windows" and not RTDIST:
if INSTALLER:
print("Makepanda: Build installer, using %s" % (COMPRESSOR))
else:
print("Makepanda: Don't build installer")
print("Makepanda: Version ID: %s" % (VERSION))
for x in warnings:
print("Makepanda: %s" % (x))
print("-------------------------------------------------------------------")
print("")
sys.stdout.flush()
@ -946,6 +963,8 @@ def CompileCxx(obj,src,opts):
# Enable Windows 7 interfaces if we need Touchinput.
if PkgSkip("TOUCHINPUT") == 0:
cmd += "/DWINVER=0x601 "
else:
cmd += "/DWINVER=0x501 "
cmd += "/Fo" + obj + " /nologo /c"
if GetTargetArch() != 'x64' and (not PkgSkip("SSE2") or 'SSE2' in opts):
cmd += " /arch:SSE2"
@ -996,6 +1015,8 @@ def CompileCxx(obj,src,opts):
# Enable Windows 7 interfaces if we need Touchinput.
if PkgSkip("TOUCHINPUT") == 0:
cmd += "/DWINVER=0x601 "
else:
cmd += "/DWINVER=0x501 "
cmd += "/Fo" + obj + " /c"
for x in ipath: cmd += " /I" + x
for (opt,dir) in INCDIRECTORIES:
@ -1360,6 +1381,8 @@ def CompileLib(lib, obj, opts):
if not BOOUSEINTELCOMPILER:
#Use MSVC Linker
cmd = 'link /lib /nologo'
if GetOptimizeOption(opts) == 4:
cmd += " /LTCG"
if HasTargetArch():
cmd += " /MACHINE:" + GetTargetArch().upper()
cmd += ' /OUT:' + BracketNameWithQuotes(lib)
@ -3556,10 +3579,9 @@ if (not RUNTIME):
DefSymbol("TINYXML", "TIXML_USE_STL", "")
if (RUNTIME or RTDIST):
OPTS=['DIR:panda/src/dxml', 'TINYXML']
TargetAdd('tinyxml_composite1.obj', opts=OPTS, input='tinyxml_composite1.cxx')
TargetAdd('libp3tinyxml.ilb', input='tinyxml_composite1.obj')
OPTS=['DIR:panda/src/dxml', 'TINYXML']
TargetAdd('tinyxml_composite1.obj', opts=OPTS, input='tinyxml_composite1.cxx')
TargetAdd('libp3tinyxml.ilb', input='tinyxml_composite1.obj')
if (not RUNTIME):
OPTS=['DIR:panda/src/dxml', 'BUILDING:PANDA', 'TINYXML']
@ -3741,6 +3763,7 @@ if (not RUNTIME):
TargetAdd('core.pyd', input='p3display_pythonGraphicsWindowProc.obj')
TargetAdd('core.pyd', input='core_module.obj')
TargetAdd('core.pyd', input='libp3tinyxml.ilb')
TargetAdd('core.pyd', input=COMMON_PANDA_LIBS)
TargetAdd('core.pyd', opts=OPTS)

View File

@ -2203,8 +2203,9 @@ def LibName(opt, name):
if not os.path.exists(name):
WARNINGS.append(name + " not found. Skipping Package " + opt)
if (opt in PkgListGet()):
print("%sWARNING:%s Could not locate thirdparty package %s, excluding from build" % (GetColor("red"), GetColor(), opt.lower()))
PkgDisable(opt)
if not PkgSkip(opt):
print("%sWARNING:%s Could not locate thirdparty package %s, excluding from build" % (GetColor("red"), GetColor(), opt.lower()))
PkgDisable(opt)
return
else:
print("%sERROR:%s Could not locate thirdparty package %s, aborting build" % (GetColor("red"), GetColor(), opt.lower()))

View File

@ -26,8 +26,6 @@ distribution.
#ifndef TINYXML_INCLUDED
#define TINYXML_INCLUDED
#include "pandasymbols.h"
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4530 )
@ -80,7 +78,7 @@ distribution.
#define TIXML_SNPRINTF snprintf
#define TIXML_SSCANF sscanf
#endif
#endif
#endif
class TiXmlDocument;
class TiXmlElement;
@ -95,10 +93,10 @@ const int TIXML_MAJOR_VERSION = 2;
const int TIXML_MINOR_VERSION = 6;
const int TIXML_PATCH_VERSION = 1;
/* Internal structure for tracking location of items
/* Internal structure for tracking location of items
in the XML file.
*/
struct EXPCL_PANDA TiXmlCursor
struct TiXmlCursor
{
TiXmlCursor() { Clear(); }
void Clear() { row = col = -1; }
@ -118,7 +116,7 @@ struct EXPCL_PANDA TiXmlCursor
If you return 'true' from a Visit method, recursive parsing will continue. If you return
false, <b>no children of this node or its sibilings</b> will be Visited.
All flavors of Visit methods have a default implementation that returns 'true' (continue
All flavors of Visit methods have a default implementation that returns 'true' (continue
visiting). You need to only override methods that are interesting to you.
Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting.
@ -127,7 +125,7 @@ struct EXPCL_PANDA TiXmlCursor
@sa TiXmlNode::Accept()
*/
class EXPCL_PANDA TiXmlVisitor
class TiXmlVisitor
{
public:
virtual ~TiXmlVisitor() {}
@ -153,8 +151,8 @@ public:
};
// Only used by Attribute::Query functions
enum
{
enum
{
TIXML_SUCCESS,
TIXML_NO_ATTRIBUTE,
TIXML_WRONG_TYPE
@ -193,7 +191,7 @@ const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
A Decleration contains: Attributes (not on tree)
@endverbatim
*/
class EXPCL_PANDA TiXmlBase
class TiXmlBase
{
friend class TiXmlNode;
friend class TiXmlElement;
@ -206,10 +204,10 @@ public:
/** All TinyXml classes can print themselves to a filestream
or the string class (TiXmlString in non-STL mode, std::string
in STL mode.) Either or both cfile and str can be null.
This is a formatted print, and will insert
This is a formatted print, and will insert
tabs and newlines.
(For an unformatted stream, use the << operator.)
*/
virtual void Print( FILE* cfile, int depth ) const = 0;
@ -254,11 +252,11 @@ public:
// in the UTF-8 sequence.
static const int utf8ByteTable[256];
virtual const char* Parse( const char* p,
TiXmlParsingData* data,
virtual const char* Parse( const char* p,
TiXmlParsingData* data,
TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
/** Expands entities in a string. Note this should not contian the tag's '<', '>', etc,
/** Expands entities in a string. Note this should not contian the tag's '<', '>', etc,
or they will be transformed into entities!
*/
static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
@ -289,9 +287,9 @@ protected:
static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
inline static bool IsWhiteSpace( char c )
{
return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
inline static bool IsWhiteSpace( char c )
{
return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
}
inline static bool IsWhiteSpace( int c )
{
@ -376,7 +374,7 @@ protected:
/// Field containing a generic user pointer
void* userData;
// None of these methods are reliable for any language except English.
// Good for approximation, not great for accuracy.
static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
@ -422,13 +420,13 @@ private:
in a document, or stand on its own. The type of a TiXmlNode
can be queried, and it can be cast to its more defined type.
*/
class EXPCL_PANDA TiXmlNode : public TiXmlBase
class TiXmlNode : public TiXmlBase
{
friend class TiXmlDocument;
friend class TiXmlElement;
public:
#ifdef TIXML_USE_STL
#ifdef TIXML_USE_STL
/** An input stream operator, for every class. Tolerant of newlines and
formatting, but doesn't expect them.
@ -442,7 +440,7 @@ public:
The operator<< and operator>> are not completely symmetric. Writing
a node to a stream is very well defined. You'll get a nice stream
of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) If you create
a TiXmlElement (for example) and read that from an input stream,
the text needs to define an element or junk will result. This is
@ -450,7 +448,7 @@ public:
A TiXmlDocument will read nodes until it reads a root element, and
all the children of that root element.
*/
*/
friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
/// Appends the XML node or attribute to a std::string.
@ -532,7 +530,7 @@ public:
}
const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
TiXmlNode* LastChild() { return lastChild; }
const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
TiXmlNode* LastChild( const char * _value ) {
return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
@ -711,11 +709,11 @@ public:
virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
/** Create an exact duplicate of this node and return it. The memory must be deleted
by the caller.
by the caller.
*/
virtual TiXmlNode* Clone() const = 0;
/** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
/** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
XML tree will be conditionally visited and the host will be called back
via the TiXmlVisitor interface.
@ -726,7 +724,7 @@ public:
The interface has been based on ideas from:
- http://www.saxproject.org/
- http://c2.com/cgi/wiki?HierarchicalVisitorPattern
- http://c2.com/cgi/wiki?HierarchicalVisitorPattern
Which are both good references for "visiting".
@ -778,7 +776,7 @@ private:
part of the tinyXML document object model. There are other
suggested ways to look at this problem.
*/
class EXPCL_PANDA TiXmlAttribute : public TiXmlBase
class TiXmlAttribute : public TiXmlBase
{
friend class TiXmlAttributeSet;
@ -823,7 +821,7 @@ public:
/** QueryIntValue examines the value string. It is an alternative to the
IntValue() method with richer error checking.
If the value is an integer, it is stored in 'value' and
If the value is an integer, it is stored in 'value' and
the call returns TIXML_SUCCESS. If it is not
an integer, it returns TIXML_WRONG_TYPE.
@ -842,21 +840,21 @@ public:
#ifdef TIXML_USE_STL
/// STL std::string form.
void SetName( const std::string& _name ) { name = _name; }
/// STL std::string form.
void SetName( const std::string& _name ) { name = _name; }
/// STL std::string form.
void SetValue( const std::string& _value ) { value = _value; }
#endif
/// Get the next sibling attribute in the DOM. Returns null at end.
const TiXmlAttribute* Next() const;
TiXmlAttribute* Next() {
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
}
/// Get the previous sibling attribute in the DOM. Returns null at beginning.
const TiXmlAttribute* Previous() const;
TiXmlAttribute* Previous() {
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
}
bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
@ -892,7 +890,7 @@ private:
/* A class used to manage a group of attributes.
It is only used internally, both by the ELEMENT and the DECLARATION.
The set can be changed transparent to the Element and Declaration
classes that use it, but NOT transparent to the Attribute
which has to implement a next() and previous() method. Which makes
@ -902,7 +900,7 @@ private:
- I like circular lists
- it demonstrates some independence from the (typical) doubly linked list.
*/
class EXPCL_PANDA TiXmlAttributeSet
class TiXmlAttributeSet
{
public:
TiXmlAttributeSet();
@ -939,7 +937,7 @@ private:
and can contain other elements, text, comments, and unknowns.
Elements also contain an arbitrary number of attributes.
*/
class EXPCL_PANDA TiXmlElement : public TiXmlNode
class TiXmlElement : public TiXmlNode
{
public:
/// Construct an element.
@ -979,11 +977,11 @@ public:
/** QueryIntAttribute examines the attribute - it is an alternative to the
Attribute() method with richer error checking.
If the attribute is an integer, it is stored in 'value' and
If the attribute is an integer, it is stored in 'value' and
the call returns TIXML_SUCCESS. If it is not
an integer, it returns TIXML_WRONG_TYPE. If the attribute
does not exist, then TIXML_NO_ATTRIBUTE is returned.
*/
*/
int QueryIntAttribute( const char* name, int* _value ) const;
/// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
int QueryDoubleAttribute( const char* name, double* _value ) const;
@ -1011,7 +1009,7 @@ public:
/** Template form of the attribute query which will try to read the
attribute into the specified type. Very easy, very powerful, but
be careful to make sure to call this with the correct type.
NOTE: This method doesn't work correctly for 'string' types that contain spaces.
@return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE
@ -1084,7 +1082,7 @@ public:
/** Convenience function for easy access to the text inside an element. Although easy
and concise, GetText() is limited compared to getting the TiXmlText child
and accessing it directly.
If the first child of 'this' is a TiXmlText, the GetText()
returns the character string of the Text node, else null is returned.
@ -1094,23 +1092,23 @@ public:
const char* str = fooElement->GetText();
@endverbatim
'str' will be a pointer to "This is text".
'str' will be a pointer to "This is text".
Note that this function can be misleading. If the element foo was created from
this XML:
@verbatim
<foo><b>This is text</b></foo>
<foo><b>This is text</b></foo>
@endverbatim
then the value of str would be null. The first child node isn't a text node, it is
another element. From this XML:
@verbatim
<foo>This is <b>text</b></foo>
<foo>This is <b>text</b></foo>
@endverbatim
GetText() will return "This is ".
WARNING: GetText() accesses a child node - don't become confused with the
similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
WARNING: GetText() accesses a child node - don't become confused with the
similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
safe type casts on the referenced node.
*/
const char* GetText() const;
@ -1128,7 +1126,7 @@ public:
virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* visitor ) const;
@ -1154,7 +1152,7 @@ private:
/** An XML comment.
*/
class EXPCL_PANDA TiXmlComment : public TiXmlNode
class TiXmlComment : public TiXmlNode
{
public:
/// Constructs an empty comment.
@ -1181,7 +1179,7 @@ public:
virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* visitor ) const;
@ -1199,16 +1197,16 @@ private:
};
/** XML text. A text node can have 2 ways to output the next. "normal" output
/** XML text. A text node can have 2 ways to output the next. "normal" output
and CDATA. It will default to the mode it was parsed from the XML file and
you generally want to leave it alone, but you can change the output mode with
you generally want to leave it alone, but you can change the output mode with
SetCDATA() and query it with CDATA().
*/
class EXPCL_PANDA TiXmlText : public TiXmlNode
class TiXmlText : public TiXmlNode
{
friend class TiXmlElement;
public:
/** Constructor for text element. By default, it is treated as
/** Constructor for text element. By default, it is treated as
normal, encoded text. If you want it be output as a CDATA text
element, set the parameter _cdata to 'true'
*/
@ -1244,7 +1242,7 @@ public:
virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* content ) const;
@ -1277,7 +1275,7 @@ private:
handled as special cases, not generic attributes, simply
because there can only be at most 3 and they are always the same.
*/
class EXPCL_PANDA TiXmlDeclaration : public TiXmlNode
class TiXmlDeclaration : public TiXmlNode
{
public:
/// Construct an empty declaration.
@ -1320,7 +1318,7 @@ public:
virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* visitor ) const;
@ -1346,7 +1344,7 @@ private:
DTD tags get thrown into TiXmlUnknowns.
*/
class EXPCL_PANDA TiXmlUnknown : public TiXmlNode
class TiXmlUnknown : public TiXmlNode
{
public:
TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {}
@ -1365,7 +1363,7 @@ public:
virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* content ) const;
@ -1385,7 +1383,7 @@ private:
XML pieces. It can be saved, loaded, and printed to the screen.
The 'value' of a document node is the xml file name.
*/
class EXPCL_PANDA TiXmlDocument : public TiXmlNode
class TiXmlDocument : public TiXmlNode
{
public:
/// Create an empty document, that has no name.
@ -1451,7 +1449,7 @@ public:
- The ErrorId() will contain the integer identifier of the error (not generally useful)
- The ErrorDesc() method will return the name of the error. (very useful)
- The ErrorRow() and ErrorCol() will return the location of the error (if known)
*/
*/
bool Error() const { return error; }
/// Contains a textual (english) description of the error if one occurs.
@ -1462,7 +1460,7 @@ public:
*/
int ErrorId() const { return errorId; }
/** Returns the location (if known) of the error. The first column is column 1,
/** Returns the location (if known) of the error. The first column is column 1,
and the first row is row 1. A value of 0 means the row and column wasn't applicable
(memory errors, for example, have no row/column) or the parser lost the error. (An
error in the error reporting, in that case.)
@ -1475,7 +1473,7 @@ public:
/** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol())
to report the correct values for row and column. It does not change the output
or input in any way.
By calling this method, with a tab size
greater than 0, the row and column of each node and attribute is stored
when the file is loaded. Very useful for tracking the DOM back in to
@ -1503,11 +1501,11 @@ public:
/** If you have handled the error, it can be reset with this call. The error
state is automatically cleared if you Parse a new XML block.
*/
void ClearError() { error = false;
errorId = 0;
errorDesc = "";
errorLocation.row = errorLocation.col = 0;
//errorLocation.last = 0;
void ClearError() { error = false;
errorId = 0;
errorDesc = "";
errorLocation.row = errorLocation.col = 0;
//errorLocation.last = 0;
}
/** Write the document to standard out using formatted printing ("pretty print"). */
@ -1517,7 +1515,7 @@ public:
will allocate a character array (new char[]) and return it as a pointer. The
calling code pust call delete[] on the return char* to avoid a memory leak.
*/
//char* PrintToMemory() const;
//char* PrintToMemory() const;
/// Print this Document to a FILE stream.
virtual void Print( FILE* cfile, int depth = 0 ) const;
@ -1527,7 +1525,7 @@ public:
virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* content ) const;
@ -1565,7 +1563,7 @@ private:
<Document>
@endverbatim
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
easy to write a *lot* of code that looks like:
@verbatim
@ -1585,7 +1583,7 @@ private:
@endverbatim
And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
and correct to use:
@verbatim
@ -1606,7 +1604,7 @@ private:
What they should not be used for is iteration:
@verbatim
int i=0;
int i=0;
while ( true )
{
TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement();
@ -1617,8 +1615,8 @@ private:
}
@endverbatim
It seems reasonable, but it is in fact two embedded while loops. The Child method is
a linear walk to find the element, so this code would iterate much more than it needs
It seems reasonable, but it is in fact two embedded while loops. The Child method is
a linear walk to find the element, so this code would iterate much more than it needs
to. Instead, prefer:
@verbatim
@ -1630,7 +1628,7 @@ private:
}
@endverbatim
*/
class EXPCL_PANDA TiXmlHandle
class TiXmlHandle
{
public:
/// Create a handle from any node (at any depth of the tree.) This can be a null pointer.
@ -1648,20 +1646,20 @@ public:
/// Return a handle to the first child element with the given name.
TiXmlHandle FirstChildElement( const char * value ) const;
/** Return a handle to the "index" child with the given name.
/** Return a handle to the "index" child with the given name.
The first child is 0, the second 1, etc.
*/
TiXmlHandle Child( const char* value, int index ) const;
/** Return a handle to the "index" child.
/** Return a handle to the "index" child.
The first child is 0, the second 1, etc.
*/
TiXmlHandle Child( int index ) const;
/** Return a handle to the "index" child element with the given name.
/** Return a handle to the "index" child element with the given name.
The first child element is 0, the second 1, etc. Note that only TiXmlElements
are indexed: other types are not counted.
*/
TiXmlHandle ChildElement( const char* value, int index ) const;
/** Return a handle to the "index" child element.
/** Return a handle to the "index" child element.
The first child element is 0, the second 1, etc. Note that only TiXmlElements
are indexed: other types are not counted.
*/
@ -1677,7 +1675,7 @@ public:
/** Return the handle as a TiXmlNode. This may return null.
*/
TiXmlNode* ToNode() const { return node; }
TiXmlNode* ToNode() const { return node; }
/** Return the handle as a TiXmlElement. This may return null.
*/
TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
@ -1688,11 +1686,11 @@ public:
*/
TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
/** @deprecated use ToNode.
/** @deprecated use ToNode.
Return the handle as a TiXmlNode. This may return null.
*/
TiXmlNode* Node() const { return ToNode(); }
/** @deprecated use ToElement.
TiXmlNode* Node() const { return ToNode(); }
/** @deprecated use ToElement.
Return the handle as a TiXmlElement. This may return null.
*/
TiXmlElement* Element() const { return ToElement(); }
@ -1729,7 +1727,7 @@ private:
fprintf( stdout, "%s", printer.CStr() );
@endverbatim
*/
class EXPCL_PANDA TiXmlPrinter : public TiXmlVisitor
class TiXmlPrinter : public TiXmlVisitor
{
public:
TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ),
@ -1752,7 +1750,7 @@ public:
void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; }
/// Query the indention string.
const char* Indent() { return indent.c_str(); }
/** Set the line breaking string. By default set to newline (\n).
/** Set the line breaking string. By default set to newline (\n).
Some operating systems prefer other characters, or can be
set to the null/empty string for no indenation.
*/
@ -1760,12 +1758,12 @@ public:
/// Query the current line breaking string.
const char* LineBreak() { return lineBreak.c_str(); }
/** Switch over to "stream printing" which is the most dense formatting without
/** Switch over to "stream printing" which is the most dense formatting without
linebreaks. Common when the XML is needed for network transmission.
*/
void SetStreamPrinting() { indent = "";
lineBreak = "";
}
}
/// Return the result.
const char* CStr() { return buffer.c_str(); }
/// Return the length of the result string.

View File

@ -22,9 +22,9 @@
// The below functions can encode and decode sRGB colors in various
// representations. Some of them are implemented using look-up tables,
// some others using SSE2 intrinsics.
extern EXPCL_PANDA_PNMIMAGE const unsigned char to_srgb8_table[256];
extern EXPCL_PANDA_PNMIMAGE const unsigned char to_linear_uchar_table[256];
extern EXPCL_PANDA_PNMIMAGE const float to_linear_float_table[256];
extern EXPCL_PANDA_PNMIMAGE ALIGN_64BYTE const unsigned char to_srgb8_table[256];
extern EXPCL_PANDA_PNMIMAGE ALIGN_64BYTE const unsigned char to_linear_uchar_table[256];
extern EXPCL_PANDA_PNMIMAGE ALIGN_64BYTE const float to_linear_float_table[256];
EXPCL_PANDA_PNMIMAGE CONSTEXPR float decode_sRGB_float(unsigned char val);
EXPCL_PANDA_PNMIMAGE INLINE float decode_sRGB_float(float val);

View File

@ -21,6 +21,7 @@
#include "extension.h"
#include "pythonCallbackObject.h"
#include "pointerTo.h"
#include "py_panda.h"
////////////////////////////////////////////////////////////////////