diff --git a/README.md b/README.md index 42ad27f53f..aaace18a07 100644 --- a/README.md +++ b/README.md @@ -96,9 +96,12 @@ files into the appropriate locations on your computer. You may have to run the Mac OS X -------- -On Mac OS X, all you need to compile Panda3D is a set of precompiled -thirdparty packages, which can be acquired from here: -https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-mac.tar.gz +On Mac OS X, you will need to download a set of precompiled thirdparty packages in order to +compile Panda3D, which can be acquired from [here](https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-mac.tar.gz). + +In order to build the installer on Mac OS X you will need to install PackageMaker. +This can be obtained from the "Auxiliary Tools for Xcode" which can be downloaded +from Apple [here](https://developer.apple.com/downloads/). After placing the thirdparty directory inside the panda3d source directory, you may build Panda3D using a command like the following: diff --git a/contrib/Package.pp b/contrib/Package.pp deleted file mode 100644 index ba166e1185..0000000000 --- a/contrib/Package.pp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Package.pp -// -// This file defines certain configuration variables that are to be -// written into the various make scripts. It is processed by ppremake -// (along with the Sources.pp files in each of the various -// contribories) to generate build scripts appropriate to each -// environment. -// -// This is the package-specific file, which should be at the top of -// every source hierarchy. It generally gets the ball rolling, and is -// responsible for explicitly including all of the relevent Config.pp -// files. - -// What is the name and version of this source tree? -#if $[eq $[PACKAGE],] - #define PACKAGE contrib - #define VERSION 0.80 -#endif - - -// Where should we find the PANDA source contribory? -#if $[PANDA_SOURCE] - #define PANDA_SOURCE $[unixfilename $[PANDA_SOURCE]] -#elif $[or $[CTPROJS],$[PANDA]] - // If we are presently attached, use the environment variable. - #define PANDA_SOURCE $[unixfilename $[PANDA]] - #if $[eq $[PANDA],] - #error You seem to be attached to some trees, but not PANDA! - #endif -#else - // Otherwise, if we are not attached, we guess that the source is a - // sibling contribory to this source root. - #define PANDA_SOURCE $[standardize $[TOPDIR]/../panda] -#endif - -// Where should we install CONTRIB? -#if $[CONTRIB_INSTALL] - #define CONTRIB_INSTALL $[unixfilename $[CONTRIB_INSTALL]] -#elif $[CTPROJS] - #set CONTRIB $[unixfilename $[CONTRIB]] - #define CONTRIB_INSTALL $[CONTRIB]/built - #if $[eq $[CONTRIB],] - #error You seem to be attached to some trees, but not CONTRIB! - #endif -#else - #defer CONTRIB_INSTALL $[unixfilename $[INSTALL_DIR]] -#endif - -// Also get the PANDA Package file and everything that includes. -#if $[not $[isfile $[PANDA_SOURCE]/Package.pp]] - #printvar PANDA_SOURCE - #error PANDA source contribory not found from contrib! Are you attached properly? -#endif - -#include $[PANDA_SOURCE]/Package.pp - -// Define the inter-tree dependencies. -#define NEEDS_TREES panda $[NEEDS_TREES] -#define DEPENDABLE_HEADER_DIRS $[DEPENDABLE_HEADER_DIRS] $[PANDA_INSTALL]/include diff --git a/contrib/Sources.pp b/contrib/Sources.pp deleted file mode 100644 index 47e8f28367..0000000000 --- a/contrib/Sources.pp +++ /dev/null @@ -1,10 +0,0 @@ -// This is the toplevel directory for a package. - -#define DIR_TYPE toplevel - -#define REQUIRED_TREES dtool panda - -#define EXTRA_DIST \ - Sources.pp Config.pp Package.pp - -#define PYTHON_PACKAGE 1 diff --git a/contrib/src/Sources.pp b/contrib/src/Sources.pp deleted file mode 100644 index fb8681dab2..0000000000 --- a/contrib/src/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group diff --git a/contrib/src/ai/Sources.pp b/contrib/src/ai/Sources.pp deleted file mode 100644 index 051fbd3858..0000000000 --- a/contrib/src/ai/Sources.pp +++ /dev/null @@ -1,82 +0,0 @@ -#define LOCAL_LIBS p3contribbase -#define BUILDING_DLL BUILDING_PANDAAI - -#define OTHER_LIBS \ - panda:c \ - p3express:c p3putil:c p3pandabase:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#begin lib_target - #define TARGET pandaai - - #define COMBINED_SOURCES p3ai_composite1.cxx - - #define SOURCES \ - aiBehaviors.h \ - aiCharacter.h \ - aiGlobals.h \ - aiNode.h \ - aiPathFinder.h \ - aiWorld.h \ - arrival.h \ - config_ai.h \ - evade.h \ - flee.h \ - flock.h \ - aiGlobals.h \ - meshNode.h \ - obstacleAvoidance.h \ - pathFind.h \ - pathFollow.h \ - pursue.h \ - seek.h \ - wander.h - - #define INCLUDED_SOURCES \ - aiBehaviors.cxx \ - aiCharacter.cxx \ - aiNode.cxx \ - aiPathFinder.cxx \ - aiWorld.cxx \ - p3ai_composite.cxx \ - p3ai_composite1.cxx \ - arrival.cxx \ - config_ai.cxx \ - evade.cxx \ - flee.cxx \ - flock.cxx \ - meshNode.cxx \ - obstacleAvoidance.cxx \ - pathFind.cxx \ - pathFollow.cxx \ - pursue.cxx \ - seek.cxx \ - wander.cxx - - - #define INSTALL_HEADERS \ - aiBehaviors.h \ - aiCharacter.h \ - aiGlobals.h \ - aiNode.h \ - aiPathFinder.h \ - aiWorld.h \ - arrival.h \ - config_ai.h \ - evade.h \ - flee.h \ - flock.h \ - aiGlobals.h \ - meshNode.h \ - obstacleAvoidance.h \ - pathFind.h \ - pathFollow.h \ - pursue.h \ - seek.h \ - wander.h - - #define IGATESCAN all - -#end lib_target - diff --git a/contrib/src/contribbase/Sources.pp b/contrib/src/contribbase/Sources.pp deleted file mode 100644 index 9c95349a8e..0000000000 --- a/contrib/src/contribbase/Sources.pp +++ /dev/null @@ -1,13 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3contribbase - - #define SOURCES \ - contribbase.cxx contribbase.h contribsymbols.h \ - - #define INSTALL_HEADERS \ - contribbase.h contribbase.h - -#end lib_target diff --git a/contrib/src/sceneeditor/Sources.pp b/contrib/src/sceneeditor/Sources.pp deleted file mode 100644 index 60f5d0bcdd..0000000000 --- a/contrib/src/sceneeditor/Sources.pp +++ /dev/null @@ -1,2 +0,0 @@ -// For now, since we are not installing Python files, this file can -// remain empty. diff --git a/direct/Package.pp b/direct/Package.pp deleted file mode 100644 index 51d3658679..0000000000 --- a/direct/Package.pp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Package.pp -// -// This file defines certain configuration variables that are to be -// written into the various make scripts. It is processed by ppremake -// (along with the Sources.pp files in each of the various -// directories) to generate build scripts appropriate to each -// environment. -// -// This is the package-specific file, which should be at the top of -// every source hierarchy. It generally gets the ball rolling, and is -// responsible for explicitly including all of the relevent Config.pp -// files. - -// What is the name and version of this source tree? -#if $[eq $[PACKAGE],] - #define PACKAGE direct - #define VERSION 0.80 -#endif - - -// Where should we find the PANDA source directory? -#if $[PANDA_SOURCE] - #define PANDA_SOURCE $[unixfilename $[PANDA_SOURCE]] -#elif $[or $[CTPROJS],$[PANDA]] - // If we are presently attached, use the environment variable. - #define PANDA_SOURCE $[unixfilename $[PANDA]] - #if $[eq $[PANDA],] - #error You seem to be attached to some trees, but not PANDA! - #endif -#else - // Otherwise, if we are not attached, we guess that the source is a - // sibling directory to this source root. - #define PANDA_SOURCE $[standardize $[TOPDIR]/../panda] -#endif - -// Where should we install DIRECT? -#if $[DIRECT_INSTALL] - #define DIRECT_INSTALL $[unixfilename $[DIRECT_INSTALL]] -#elif $[CTPROJS] - #set DIRECT $[unixfilename $[DIRECT]] - #define DIRECT_INSTALL $[DIRECT]/built - #if $[eq $[DIRECT],] - #error You seem to be attached to some trees, but not DIRECT! - #endif -#else - #defer DIRECT_INSTALL $[unixfilename $[INSTALL_DIR]] -#endif - -// Also get the PANDA Package file and everything that includes. -#if $[not $[isfile $[PANDA_SOURCE]/Package.pp]] - #printvar PANDA_SOURCE - #error PANDA source directory not found from direct! Are you attached properly? -#endif - -#include $[PANDA_SOURCE]/Package.pp - -// Define the inter-tree dependencies. -#define NEEDS_TREES panda $[NEEDS_TREES] -#define DEPENDABLE_HEADER_DIRS $[DEPENDABLE_HEADER_DIRS] $[PANDA_INSTALL]/include diff --git a/direct/Sources.pp b/direct/Sources.pp deleted file mode 100644 index 621e12ba69..0000000000 --- a/direct/Sources.pp +++ /dev/null @@ -1,11 +0,0 @@ -// This is the toplevel directory for a package. - -#define DIR_TYPE toplevel - -#define SAMPLE_SOURCE_FILE src/directbase/directbase.cxx -#define REQUIRED_TREES dtool panda - -#define EXTRA_DIST \ - Sources.pp Config.pp Package.pp - -#define PYTHON_PACKAGE 1 diff --git a/direct/metalibs/Sources.pp b/direct/metalibs/Sources.pp deleted file mode 100644 index 93e28f9e7c..0000000000 --- a/direct/metalibs/Sources.pp +++ /dev/null @@ -1,7 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group - -// The metalibs directory always depends on the src directory. -#define DEPENDS src diff --git a/direct/metalibs/direct/Sources.pp b/direct/metalibs/direct/Sources.pp deleted file mode 100644 index 9225e58454..0000000000 --- a/direct/metalibs/direct/Sources.pp +++ /dev/null @@ -1,32 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_DIRECT -#define USE_PACKAGES native_net - -#define COMPONENT_LIBS \ - p3directbase p3dcparser p3showbase p3deadrec p3directd p3interval p3distributed p3motiontrail p3http - -#define OTHER_LIBS \ - panda:m \ - pandaexpress:m \ - p3parametrics:c \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3express:c p3pstatclient:c p3prc:c p3pandabase:c p3linmath:c \ - p3putil:c p3display:c p3event:c p3pgraph:c p3pgraphnodes:c \ - p3gsgbase:c p3gobj:c p3mathutil:c \ - p3downloader:c p3pnmimage:c p3chan:c \ - p3pipeline:c p3cull:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] - -#begin metalib_target - #define TARGET p3direct - - #define SOURCES direct.cxx -#end metalib_target - diff --git a/direct/src/Sources.pp b/direct/src/Sources.pp deleted file mode 100644 index fb8681dab2..0000000000 --- a/direct/src/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 39158377b8..6e23b0c346 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -525,9 +525,8 @@ class Actor(DirectObject, NodePath): self.__LODNode = None # remove all its children - if(self.__geomNode): - self.__geomNode.removeChildren() - + if self.__geomNode: + self.__geomNode.getChildren().detach() self.__hasLOD = 0 diff --git a/direct/src/actor/Sources.pp b/direct/src/actor/Sources.pp deleted file mode 100644 index a03ea8c336..0000000000 --- a/direct/src/actor/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -// For now, since we are not installing Python files, this file can -// remain empty. - diff --git a/direct/src/cluster/Sources.pp b/direct/src/cluster/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/configfiles/Sources.pp b/direct/src/configfiles/Sources.pp deleted file mode 100644 index 40e93e6d88..0000000000 --- a/direct/src/configfiles/Sources.pp +++ /dev/null @@ -1,10 +0,0 @@ -#define INSTALL_CONFIG \ - 40_direct.prc - -#if $[CTPROJS] - // These files only matter to ctattach users. - #define INSTALL_CONFIG $[INSTALL_CONFIG] direct.init -#endif - - -#include $[THISDIRPREFIX]direct.prc.pp diff --git a/direct/src/configfiles/direct.prc.pp b/direct/src/configfiles/direct.prc.pp deleted file mode 100644 index 4f903bec2e..0000000000 --- a/direct/src/configfiles/direct.prc.pp +++ /dev/null @@ -1,32 +0,0 @@ -// -// direct.prc.pp -// -// This file defines the script to auto-generate direct.prc at -// ppremake time. This is intended to fill in some of the default -// parameters, in particular the default display types. -// - -#output 40_direct.prc notouch -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - -#if $[CTPROJS] -// If we are using the ctattach tools, append "built"--this is a VR -// Studio convention. -model-path $DMODELS/built -sound-path $DMODELS/built -#else -// Most people outside the VR Studio just see this. -model-path $DMODELS -sound-path $DMODELS -#endif - -# Define a new egg object type. See the comments in _panda.prc about this. - -egg-object-type-direct-widget collide-mask { 0x80000000 } { Polyset descend } - -# Define a new cull bin that will render on top of everything else. - -cull-bin gui-popup 60 unsorted - -#end 40_direct.prc diff --git a/direct/src/controls/ControlManager.py b/direct/src/controls/ControlManager.py index dd8a187888..04339e738f 100755 --- a/direct/src/controls/ControlManager.py +++ b/direct/src/controls/ControlManager.py @@ -13,13 +13,13 @@ from direct.directnotify import DirectNotifyGlobal #if __debug__: # import DevWalker from direct.task import Task +from panda3d.core import ConfigVariableBool + CollisionHandlerRayStart = 4000.0 # This is a hack, it may be better to use a line instead of a ray. class ControlManager: notify = DirectNotifyGlobal.directNotify.newCategory("ControlManager") - wantAvatarPhysicsIndicator = config.GetBool('want-avatar-physics-indicator', 0) - wantAvatarPhysicsDebug = config.GetBool('want-avatar-physics-debug', 0) - wantWASD = config.GetBool('want-WASD', 0) + wantWASD = ConfigVariableBool('want-WASD', True) def __init__(self, enable=True, passMessagesThrough = False): assert self.notify.debug("init control manager %s" % (passMessagesThrough)) diff --git a/direct/src/controls/GravityWalker.py b/direct/src/controls/GravityWalker.py index 7c232e55f4..32c18c05f3 100755 --- a/direct/src/controls/GravityWalker.py +++ b/direct/src/controls/GravityWalker.py @@ -18,15 +18,17 @@ from direct.showbase import DirectObject from direct.controls.ControlManager import CollisionHandlerRayStart from direct.showbase.InputStateGlobal import inputState from direct.task.Task import Task -from pandac.PandaModules import * +from panda3d.core import * +from direct.extensions_native import VBase3_extensions +from direct.extensions_native import VBase4_extensions import math class GravityWalker(DirectObject.DirectObject): notify = directNotify.newCategory("GravityWalker") - wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0) - wantFloorSphere = base.config.GetBool('want-floor-sphere', 0) - earlyEventSphere = base.config.GetBool('early-event-sphere', 0) + wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False) + wantFloorSphere = ConfigVariableBool('want-floor-sphere', False) + earlyEventSphere = ConfigVariableBool('early-event-sphere', False) DiagonalFactor = math.sqrt(2.) / 2. diff --git a/direct/src/controls/PhysicsWalker.py b/direct/src/controls/PhysicsWalker.py index dae64252fc..e58c2df3f6 100755 --- a/direct/src/controls/PhysicsWalker.py +++ b/direct/src/controls/PhysicsWalker.py @@ -19,7 +19,11 @@ from direct.showbase import DirectObject from direct.controls.ControlManager import CollisionHandlerRayStart from direct.showbase.InputStateGlobal import inputState from direct.task.Task import Task -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.physics import * +from direct.extensions_native import Mat3_extensions +from direct.extensions_native import VBase3_extensions +from direct.extensions_native import VBase4_extensions import math #import LineStream @@ -27,8 +31,7 @@ import math class PhysicsWalker(DirectObject.DirectObject): notify = DirectNotifyGlobal.directNotify.newCategory("PhysicsWalker") - wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0) - wantAvatarPhysicsIndicator = base.config.GetBool('want-avatar-physics-indicator', 0) + wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False) useLifter = 0 useHeightRay = 0 diff --git a/direct/src/controls/Sources.pp b/direct/src/controls/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/dcparse/Sources.pp b/direct/src/dcparse/Sources.pp deleted file mode 100644 index e89232f924..0000000000 --- a/direct/src/dcparse/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -#define LOCAL_LIBS \ - p3dcparser -#define OTHER_LIBS \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \ - p3pipeline:c p3downloader:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - panda:m \ - p3pystub - -#define C++FLAGS -DWITHIN_PANDA - -#begin bin_target - #define TARGET dcparse - #define USE_PACKAGES zlib openssl tar - - #define SOURCES \ - dcparse.cxx - #define WIN_SYS_LIBS shell32.lib -#end bin_target - diff --git a/direct/src/dcparser/Sources.pp b/direct/src/dcparser/Sources.pp deleted file mode 100644 index 7e6610b12b..0000000000 --- a/direct/src/dcparser/Sources.pp +++ /dev/null @@ -1,64 +0,0 @@ -#define OTHER_LIBS \ - p3express:c pandaexpress:m \ - p3pstatclient:c p3pipeline:c panda:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c p3pandabase:c \ - p3downloader:c $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3linmath:c p3putil:c - -#define LOCAL_LIBS \ - p3directbase -#define YACC_PREFIX dcyy -#define C++FLAGS -DWITHIN_PANDA -#define UNIX_SYS_LIBS m -#define USE_PACKAGES python - -#begin lib_target - #define TARGET p3dcparser - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - dcAtomicField.h dcAtomicField.I dcClass.h dcClass.I \ - dcDeclaration.h \ - dcField.h dcField.I \ - dcFile.h dcFile.I \ - dcKeyword.h dcKeywordList.h \ - dcLexer.lxx \ - dcLexerDefs.h dcMolecularField.h dcParser.yxx dcParserDefs.h \ - dcSubatomicType.h \ - dcPackData.h dcPackData.I \ - dcPacker.h dcPacker.I \ - dcPackerCatalog.h dcPackerCatalog.I \ - dcPackerInterface.h dcPackerInterface.I \ - dcParameter.h dcClassParameter.h dcArrayParameter.h \ - dcSimpleParameter.h dcSwitchParameter.h \ - dcNumericRange.h dcNumericRange.I \ - dcSwitch.h \ - dcTypedef.h \ - dcPython.h \ - dcbase.h dcindent.h hashGenerator.h \ - primeNumberGenerator.h - - #define INCLUDED_SOURCES \ - dcAtomicField.cxx dcClass.cxx \ - dcDeclaration.cxx \ - dcField.cxx dcFile.cxx \ - dcKeyword.cxx dcKeywordList.cxx \ - dcMolecularField.cxx dcSubatomicType.cxx \ - dcPackData.cxx \ - dcPacker.cxx \ - dcPackerCatalog.cxx \ - dcPackerInterface.cxx \ - dcParameter.cxx dcClassParameter.cxx dcArrayParameter.cxx \ - dcSimpleParameter.cxx dcSwitchParameter.cxx \ - dcSwitch.cxx \ - dcTypedef.cxx \ - dcindent.cxx \ - hashGenerator.cxx primeNumberGenerator.cxx - - // #define SOURCES $[SOURCES] $[INCLUDED_SOURCES] - // #define COMBINED_SOURCES - - #define IGATESCAN all -#end lib_target diff --git a/direct/src/deadrec/Sources.pp b/direct/src/deadrec/Sources.pp deleted file mode 100644 index d4aa44db58..0000000000 --- a/direct/src/deadrec/Sources.pp +++ /dev/null @@ -1,28 +0,0 @@ -#begin lib_target - #define TARGET p3deadrec - #define LOCAL_LIBS \ - p3directbase - #define OTHER_LIBS \ - p3express:c p3linmath:c \ - p3interrogatedb:c p3dconfig:c \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3prc:c p3pandabase:c p3putil:c \ - p3pipeline:c - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_deadrec.h \ - smoothMover.h smoothMover.I - - #define INCLUDED_SOURCES \ - config_deadrec.cxx \ - smoothMover.cxx - - #define INSTALL_HEADERS \ - config_deadrec.h \ - smoothMover.h smoothMover.I - - #define IGATESCAN \ - all -#end lib_target diff --git a/direct/src/directbase/Sources.pp b/direct/src/directbase/Sources.pp deleted file mode 100644 index 432770e485..0000000000 --- a/direct/src/directbase/Sources.pp +++ /dev/null @@ -1,20 +0,0 @@ -#define USE_PACKAGES cg // from gobj. - -#begin lib_target - #define TARGET p3directbase - - #define SOURCES \ - directbase.cxx directbase.h directsymbols.h \ - - #define INSTALL_HEADERS \ - directbase.h directsymbols.h - - // These libraries and frameworks are used by dtoolutil; we redefine - // them here so they get into the panda build system. - #if $[ne $[PLATFORM], FreeBSD] - #define UNIX_SYS_LIBS dl - #endif - #define WIN_SYS_LIBS shell32.lib - #define OSX_SYS_FRAMEWORKS Foundation $[if $[not $[BUILD_IPHONE]],AppKit] - -#end lib_target diff --git a/direct/src/directd/Sources.pp b/direct/src/directd/Sources.pp deleted file mode 100644 index 48d26a2582..0000000000 --- a/direct/src/directd/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ - -// This package presently only builds on Windows. -// We also require the network layer (queuedConnectionManager, etc.) -#define BUILD_DIRECTORY $[and $[WINDOWS_PLATFORM],$[HAVE_NET],$[HAVE_DIRECTD]] - -#define LOCAL_LIBS \ - p3directbase -#define OTHER_LIBS \ - $[if $[HAVE_NET],p3net:c] p3linmath:c p3putil:c p3express:c panda:m pandaexpress:m p3dtoolconfig p3dtool -#define WIN_SYS_LIBS $[WIN_SYS_LIBS] user32.lib //advapi32.lib - -#begin lib_target - #define TARGET p3directd - - #define SOURCES \ - directd.h directd.cxx - - #define INSTALL_HEADERS \ - directd.h - - #define IGATESCAN directd.h - -#end lib_target diff --git a/direct/src/directdServer/Sources.pp b/direct/src/directdServer/Sources.pp deleted file mode 100644 index d9cf9f413a..0000000000 --- a/direct/src/directdServer/Sources.pp +++ /dev/null @@ -1,30 +0,0 @@ - -// This package presently only builds on Windows. -// We also require the network layer (queuedConnectionManager, etc.) -#define BUILD_DIRECTORY $[and $[WINDOWS_PLATFORM],$[HAVE_NET],$[HAVE_DIRECTD]] - -//#define LOCAL_LIBS \ -// p3directbase -#define OTHER_LIBS \ - $[if $[HAVE_NET],p3net:c] p3linmath:c p3putil:c p3express:c panda:m pandaexpress:m p3dtoolconfig p3dtool -#define WIN_SYS_LIBS $[WIN_SYS_LIBS] user32.lib //advapi32.lib - -#begin bin_target - #define TARGET p3directdServer - #define LOCAL_LIBS p3directd - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - directdServer.cxx directdServer.h - -#end bin_target - -#begin test_bin_target - #define TARGET directdClient - #define LOCAL_LIBS p3directd - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - directdClient.cxx directdClient.h - -#end test_bin_target diff --git a/direct/src/directdevices/Sources.pp b/direct/src/directdevices/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/directnotify/Sources.pp b/direct/src/directnotify/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/directscripts/Sources.pp b/direct/src/directscripts/Sources.pp deleted file mode 100644 index 0f33d11f05..0000000000 --- a/direct/src/directscripts/Sources.pp +++ /dev/null @@ -1,8 +0,0 @@ -#if $[and $[CTPROJS],$[WINDOWS_PLATFORM]] - // This script is only useful if you're using the ctattach script on - // Windows; therefore, we only bother to install it if you're using - // the cattach scripts. - #define INSTALL_SCRIPTS runPythonEmacs - -#endif - diff --git a/direct/src/directtools/DirectSelection.py b/direct/src/directtools/DirectSelection.py index 8711bd08b6..b783e34114 100644 --- a/direct/src/directtools/DirectSelection.py +++ b/direct/src/directtools/DirectSelection.py @@ -227,16 +227,27 @@ class SelectedNodePaths(DirectObject): selected = self.last # Toggle visibility of selected node paths if selected: - selected.toggleVis() + if selected.isHidden(): + selected.show() + else: + selected.hide() def toggleVisAll(self): # Toggle viz for all selected node paths - self.forEachSelectedNodePathDo(NodePath.toggleVis) + selectedNodePaths = self.getSelectedAsList() + for nodePath in selectedNodePaths: + if nodePath.isHidden(): + nodePath.show() + else: + nodePath.hide() def isolateSelected(self): selected = self.last if selected: - selected.isolate() + selected.showAllDescendents() + for sib in selected.getParent().getChildren(): + if sib.node() != selected.node(): + sib.hide() def getDirectNodePath(self, nodePath): # Get this pointer diff --git a/direct/src/directtools/DirectSession.py b/direct/src/directtools/DirectSession.py index 124799c6cb..312d805134 100644 --- a/direct/src/directtools/DirectSession.py +++ b/direct/src/directtools/DirectSession.py @@ -879,7 +879,9 @@ class DirectSession(DirectObject): # Yes, show everything in level self.showAllDescendants(nodePath.getParent()) # Now hide all of this node path's siblings - nodePath.hideSiblings() + for sib in nodePath.getParent().getChildren(): + if sib.node() != nodePath.node(): + sib.hide() def toggleVis(self, nodePath = 'None Given'): """ Toggle visibility of node path """ @@ -890,7 +892,10 @@ class DirectSession(DirectObject): nodePath = self.selected.last if nodePath: # Now toggle node path's visibility state - nodePath.toggleVis() + if nodePath.isHidden(): + nodePath.show() + else: + nodePath.hide() def removeNodePath(self, nodePath = 'None Given'): if nodePath == 'None Given': @@ -904,8 +909,11 @@ class DirectSession(DirectObject): def showAllDescendants(self, nodePath = render): """ Show the level and its descendants """ - nodePath.showAllDescendants() - nodePath.hideCS() + if not isinstance(nodePath, CollisionNode): + nodePath.show() + + for child in nodePath.getChildren(): + self.showAllDescendants(child) def upAncestry(self): if self.ancestry: diff --git a/direct/src/directtools/Sources.pp b/direct/src/directtools/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/directutil/Sources.pp b/direct/src/directutil/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/distributed/Sources.pp b/direct/src/distributed/Sources.pp deleted file mode 100644 index 676dfe65d3..0000000000 --- a/direct/src/distributed/Sources.pp +++ /dev/null @@ -1,25 +0,0 @@ -#define C++FLAGS -DWITHIN_PANDA - -#begin lib_target - #define BUILD_TARGET $[HAVE_PYTHON] - #define USE_PACKAGES openssl native_net net - - #define TARGET p3distributed - #define LOCAL_LIBS \ - p3directbase p3dcparser - #define OTHER_LIBS \ - p3event:c p3downloader:c panda:m p3express:c pandaexpress:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \ - p3pipeline:c $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] - - #define SOURCES \ - config_distributed.cxx config_distributed.h \ - cConnectionRepository.cxx cConnectionRepository.I \ - cConnectionRepository.h \ - cDistributedSmoothNodeBase.cxx cDistributedSmoothNodeBase.I \ - cDistributedSmoothNodeBase.h - - #define IGATESCAN all -#end lib_target diff --git a/direct/src/extensions_native/CInterval_extensions.py b/direct/src/extensions_native/CInterval_extensions.py index f20232e2cb..5a64d96c5f 100644 --- a/direct/src/extensions_native/CInterval_extensions.py +++ b/direct/src/extensions_native/CInterval_extensions.py @@ -1,4 +1,5 @@ -from .core import Dtool_funcToMethod +from panda3d.direct import CInterval +from .extension_native_helpers import Dtool_funcToMethod from direct.directnotify.DirectNotifyGlobal import directNotify CInterval.DtoolClassDict["notify"] = directNotify.newCategory("Interval") diff --git a/direct/src/extensions_native/HTTPChannel_extensions.py b/direct/src/extensions_native/HTTPChannel_extensions.py index 3257c16278..f355847b10 100644 --- a/direct/src/extensions_native/HTTPChannel_extensions.py +++ b/direct/src/extensions_native/HTTPChannel_extensions.py @@ -3,6 +3,9 @@ #del func ##################################################################### +from panda3d.core import HTTPChannel +from .extension_native_helpers import Dtool_funcToMethod + """ HTTPChannel-extensions module: contains methods to extend functionality of the HTTPChannel class diff --git a/direct/src/extensions_native/Mat3_extensions.py b/direct/src/extensions_native/Mat3_extensions.py old mode 100755 new mode 100644 index 3895a4dd46..dc47a04f04 --- a/direct/src/extensions_native/Mat3_extensions.py +++ b/direct/src/extensions_native/Mat3_extensions.py @@ -8,6 +8,8 @@ Mat3-extensions module: contains methods to extend functionality of the LMatrix3f class. """ +from panda3d.core import Mat3 +from .extension_native_helpers import Dtool_funcToMethod def pPrintValues(self): """ diff --git a/direct/src/extensions_native/NodePath_extensions.py b/direct/src/extensions_native/NodePath_extensions.py index 33c530180c..6e1920fde5 100644 --- a/direct/src/extensions_native/NodePath_extensions.py +++ b/direct/src/extensions_native/NodePath_extensions.py @@ -8,6 +8,9 @@ NodePath-extensions module: contains methods to extend functionality of the NodePath class """ +from panda3d.core import NodePath +from .extension_native_helpers import Dtool_funcToMethod + #################################################################### def id(self): """Deprecated. Returns a unique id identifying the NodePath instance""" @@ -27,7 +30,8 @@ del getChildrenAsList ##################################################################### def printChildren(self): - """Prints out the children of the bottom node of a node path""" + """Deprecated. Prints out the children of the bottom node of a node path""" + print("Warning: NodePath.printChildren() is deprecated.") for child in self.getChildren(): print(child.getName()) Dtool_funcToMethod(printChildren, NodePath) @@ -35,14 +39,16 @@ del printChildren ##################################################################### def removeChildren(self): - """Deletes the children of the bottom node of a node path""" + """Deprecated. Deletes the children of the bottom node of a node path""" + print("Warning: NodePath.removeChildren() is deprecated. Use get_children().detach() instead.") self.getChildren().detach() Dtool_funcToMethod(removeChildren, NodePath) del removeChildren ##################################################################### def toggleVis(self): - """Toggles visibility of a nodePath""" + """Deprecated. Toggles visibility of a nodePath""" + print("Warning: NodePath.toggleVis() is deprecated. Use is_hidden(), show() and hide() instead.") if self.isHidden(): self.show() return 1 @@ -54,7 +60,8 @@ del toggleVis ##################################################################### def showSiblings(self): - """Show all the siblings of a node path""" + """Deprecated. Show all the siblings of a node path""" + print("Warning: NodePath.showSiblings() is deprecated.") for sib in self.getParent().getChildren(): if sib.node() != self.node(): sib.show() @@ -63,7 +70,8 @@ del showSiblings ##################################################################### def hideSiblings(self): - """Hide all the siblings of a node path""" + """Deprecated. Hide all the siblings of a node path""" + print("Warning: NodePath.hideSiblings() is deprecated.") for sib in self.getParent().getChildren(): if sib.node() != self.node(): sib.hide() @@ -72,7 +80,8 @@ del hideSiblings ##################################################################### def showAllDescendants(self): - """Show the node path and all its children""" + """Deprecated. Show the node path and all its children""" + print("Warning: NodePath.showAllDescendants() is deprecated.") self.show() for child in self.getChildren(): child.showAllDescendants() @@ -81,9 +90,12 @@ del showAllDescendants ##################################################################### def isolate(self): - """Show the node path and hide its siblings""" + """Deprecated. Show the node path and hide its siblings""" + print("Warning: NodePath.isolate() is deprecated.") self.showAllDescendants() - self.hideSiblings() + for sib in self.getParent().getChildren(): + if sib.node() != self.node(): + sib.hide() Dtool_funcToMethod(isolate, NodePath) del isolate ##################################################################### @@ -101,7 +113,8 @@ del remove ##################################################################### def lsNames(self): - """Walk down a tree and print out the path""" + """Deprecated. Walk down a tree and print out the path""" + print("Warning: NodePath.lsNames() is deprecated.") if self.isEmpty(): print("(empty)") else: @@ -114,7 +127,8 @@ Dtool_funcToMethod(lsNames, NodePath) del lsNames ##################################################################### def lsNamesRecurse(self, indentString=' '): - """Walk down a tree and print out the path""" + """Deprecated. Walk down a tree and print out the path""" + print("Warning: NodePath.lsNamesRecurse() is deprecated.") for nodePath in self.getChildren(): type = nodePath.node().getType().getName() name = nodePath.getName() @@ -125,7 +139,8 @@ Dtool_funcToMethod(lsNamesRecurse, NodePath) del lsNamesRecurse ##################################################################### def reverseLsNames(self): - """Walk up a tree and print out the path to the root""" + """Deprecated. Walk up a tree and print out the path to the root""" + print("Warning: NodePath.reverseLsNames() is deprecated.") ancestors = list(self.getAncestors()) ancestry = ancestors.reverse() indentString = "" @@ -139,8 +154,8 @@ Dtool_funcToMethod(reverseLsNames, NodePath) del reverseLsNames ##################################################################### def getAncestry(self): - """Get a list of a node path's ancestors""" - print("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.""") + """Deprecated. Get a list of a node path's ancestors""" + print("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.") ancestors = list(self.getAncestors()) ancestors.reverse() return ancestors @@ -151,8 +166,9 @@ del getAncestry def pPrintString(self, other = None): """ - pretty print + Deprecated. pretty print """ + print("NodePath.pPrintString() is deprecated.") if __debug__: # Normally I would have put the if __debug__ around # the entire funciton, the that doesn't seem to work @@ -183,7 +199,8 @@ del pPrintString ##################################################################### def printPos(self, other = None, sd = 2): - """ Pretty print a node path's pos """ + """ Deprecated. Pretty print a node path's pos """ + print("NodePath.printPos() is deprecated.") formatString = '%0.' + '%d' % sd + 'f' if other: pos = self.getPos(other) @@ -201,7 +218,8 @@ del printPos ##################################################################### def printHpr(self, other = None, sd = 2): - """ Pretty print a node path's hpr """ + """ Deprecated. Pretty print a node path's hpr """ + print("NodePath.printHpr() is deprecated.") formatString = '%0.' + '%d' % sd + 'f' if other: hpr = self.getHpr(other) @@ -219,7 +237,8 @@ del printHpr ##################################################################### def printScale(self, other = None, sd = 2): - """ Pretty print a node path's scale """ + """ Deprecated. Pretty print a node path's scale """ + print("NodePath.printScale() is deprecated.") formatString = '%0.' + '%d' % sd + 'f' if other: scale = self.getScale(other) @@ -237,7 +256,8 @@ Dtool_funcToMethod(printScale, NodePath) del printScale ##################################################################### def printPosHpr(self, other = None, sd = 2): - """ Pretty print a node path's pos and, hpr """ + """ Deprecated. Pretty print a node path's pos and, hpr """ + print("NodePath.printPosHpr() is deprecated.") formatString = '%0.' + '%d' % sd + 'f' if other: pos = self.getPos(other) @@ -260,7 +280,8 @@ Dtool_funcToMethod(printPosHpr, NodePath) del printPosHpr ##################################################################### def printPosHprScale(self, other = None, sd = 2): - """ Pretty print a node path's pos, hpr, and scale """ + """ Deprecated. Pretty print a node path's pos, hpr, and scale """ + print("NodePath.printPosHprScale() is deprecated.") formatString = '%0.' + '%d' % sd + 'f' if other: pos = self.getPos(other) @@ -289,6 +310,8 @@ del printPosHprScale ##################################################################### def printTransform(self, other = None, sd = 2, fRecursive = 0): + "Deprecated." + print("NodePath.printTransform() is deprecated.") from panda3d.core import Vec3 fmtStr = '%%0.%df' % sd name = self.getName() @@ -327,7 +350,8 @@ del printTransform def iPos(self, other = None): - """ Set node path's pos to 0, 0, 0 """ + """ Deprecated. Set node path's pos to 0, 0, 0 """ + print("NodePath.iPos() is deprecated.") if other: self.setPos(other, 0, 0, 0) else: @@ -337,7 +361,8 @@ del iPos ##################################################################### def iHpr(self, other = None): - """ Set node path's hpr to 0, 0, 0 """ + """ Deprecated. Set node path's hpr to 0, 0, 0 """ + print("NodePath.iHpr() is deprecated.") if other: self.setHpr(other, 0, 0, 0) else: @@ -347,7 +372,8 @@ Dtool_funcToMethod(iHpr, NodePath) del iHpr ##################################################################### def iScale(self, other = None): - """ SEt node path's scale to 1, 1, 1 """ + """ Deprecated. Set node path's scale to 1, 1, 1 """ + print("NodePath.iScale() is deprecated.") if other: self.setScale(other, 1, 1, 1) else: @@ -357,7 +383,8 @@ Dtool_funcToMethod(iScale, NodePath) del iScale ##################################################################### def iPosHpr(self, other = None): - """ Set node path's pos and hpr to 0, 0, 0 """ + """ Deprecated. Set node path's pos and hpr to 0, 0, 0 """ + print("NodePath.iPosHpr() is deprecated.") if other: self.setPosHpr(other, 0, 0, 0, 0, 0, 0) else: @@ -367,7 +394,8 @@ Dtool_funcToMethod(iPosHpr, NodePath) del iPosHpr ##################################################################### def iPosHprScale(self, other = None): - """ Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """ + """ Deprecated. Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """ + print("NodePath.iPosHprScale() is deprecated.") if other: self.setPosHprScale(other, 0, 0, 0, 0, 0, 0, 1, 1, 1) else: @@ -417,11 +445,13 @@ del deselect ##################################################################### def showCS(self, mask = None): """ + Deprecated. Shows the collision solids at or below this node. If mask is not None, it is a BitMask32 object (e.g. WallBitmask, CameraBitmask) that indicates which particular collision solids should be made visible; otherwise, all of them will be. """ + print("NodePath.showCS() is deprecated. Use findAllMatches('**/+CollisionNode').show() instead.") npc = self.findAllMatches('**/+CollisionNode') for p in range(0, npc.getNumPaths()): np = npc[p] @@ -433,11 +463,13 @@ del showCS ##################################################################### def hideCS(self, mask = None): """ + Deprecated. Hides the collision solids at or below this node. If mask is not None, it is a BitMask32 object (e.g. WallBitmask, CameraBitmask) that indicates which particular collision solids should be hidden; otherwise, all of them will be. """ + print("NodePath.hideCS() is deprecated. Use findAllMatches('**/+CollisionNode').hide() instead.") npc = self.findAllMatches('**/+CollisionNode') for p in range(0, npc.getNumPaths()): np = npc[p] @@ -621,6 +653,7 @@ del getNumDescendants ##################################################################### def removeNonCollisions(self): # remove anything that is not collision-related + print("NodePath.removeNonCollisions() is deprecated") stack = [self] while len(stack): np = stack.pop() diff --git a/direct/src/extensions_native/Sources.pp b/direct/src/extensions_native/Sources.pp deleted file mode 100644 index a961cd35c4..0000000000 --- a/direct/src/extensions_native/Sources.pp +++ /dev/null @@ -1,20 +0,0 @@ -#if $[OSX_PLATFORM] -#output extensions_darwin.py -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - -# This defines the shared-library filename extension that is built and -# imported on OSX. It's normally .dylib, but in certain Python and -# OSX versions (for instance, Python 2.4 on OSX 10.4), it appears that -# we need to generate and import .so files instead, since Python won't -# import the .dylibs directly. This is controlled via the BUNDLE_EXT -# variable defined in Config.pp. -#if $[BUNDLE_EXT] -dll_ext = "$[BUNDLE_EXT]" -#else -dll_ext = ".dylib" -#endif - -#end extensions_darwin.py - -#endif // OSX_PLATFORM diff --git a/direct/src/extensions_native/VBase3_extensions.py b/direct/src/extensions_native/VBase3_extensions.py old mode 100755 new mode 100644 index 29fbb3dc00..425c58f4f4 --- a/direct/src/extensions_native/VBase3_extensions.py +++ b/direct/src/extensions_native/VBase3_extensions.py @@ -2,6 +2,9 @@ Methods to extend functionality of the VBase3 class """ +from panda3d.core import VBase3 +from .extension_native_helpers import Dtool_funcToMethod + def pPrintValues(self): """ Pretty print diff --git a/direct/src/extensions_native/VBase4_extensions.py b/direct/src/extensions_native/VBase4_extensions.py old mode 100755 new mode 100644 index cf5c790e51..ca1da67704 --- a/direct/src/extensions_native/VBase4_extensions.py +++ b/direct/src/extensions_native/VBase4_extensions.py @@ -2,6 +2,9 @@ Methods to extend functionality of the VBase4 class """ +from panda3d.core import VBase4 +from .extension_native_helpers import Dtool_funcToMethod + def pPrintValues(self): """ Pretty print @@ -16,6 +19,5 @@ def asTuple(self): """ print("Warning: VBase4.asTuple() is no longer needed and deprecated. Use the vector directly instead.") return tuple(self) - Dtool_funcToMethod(asTuple, VBase4) del asTuple diff --git a/direct/src/extensions_native/core_extensions.py b/direct/src/extensions_native/core_extensions.py deleted file mode 100644 index 3380dc3cf3..0000000000 --- a/direct/src/extensions_native/core_extensions.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys - -main_dir = Filename() - -if sys.argv and sys.argv[0]: - main_dir = Filename.from_os_specific(sys.argv[0]) - -if main_dir.empty(): - # We must be running in the Python interpreter directly, so return the CWD. - main_dir = ExecutionEnvironment.get_cwd() -else: - main_dir.make_absolute() - main_dir = Filename(main_dir.get_dirname()) -ExecutionEnvironment.shadow_environment_variable('MAIN_DIR', main_dir.to_os_specific()) -del sys, main_dir - - -def Dtool_funcToMethod(func, cls, method_name=None): - """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method. - The new method is accessible to any instance immediately.""" - #if sys.version_info < (3, 0): - # func.im_class = cls - func.im_func = func - func.im_self = None - if not method_name: - method_name = func.__name__ - cls.DtoolClassDict[method_name] = func; - diff --git a/direct/src/extensions_native/extension_native_helpers.py b/direct/src/extensions_native/extension_native_helpers.py index 9424b640ce..c6747e7272 100644 --- a/direct/src/extensions_native/extension_native_helpers.py +++ b/direct/src/extensions_native/extension_native_helpers.py @@ -1,122 +1,10 @@ ### Tools -__all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod", "Dtool_PreloadDLL"] +__all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod"] import imp, sys, os -# The following code exists to work around a problem that exists -# with Python 2.5 or greater. - -# Specifically, Python 2.5 is designed to import files named *.pyd -# only; it will not import files named *.dll (or *.so). We work -# around this problem by explicitly preloading all of the dll's we -# expect to need. - -dll_suffix = '' -if sys.platform == "win32": - # On Windows, dynamic libraries end in ".dll". - dll_ext = '.dll' - module_ext = '.pyd' - - # We allow the caller to preload dll_suffix into the sys module. - dll_suffix = getattr(sys, 'dll_suffix', None) - - if dll_suffix is None: - # Otherwise, we try to determine it from the executable name: - # python_d.exe implies _d across the board. - dll_suffix = '' - if sys.executable.endswith('_d.exe'): - dll_suffix = '_d' - -elif sys.platform == "darwin": - # On OSX, the dynamic libraries usually end in .dylib, but - # sometimes we need .so. - try: - from direct.extensions_native.extensions_darwin import dll_ext - except ImportError: - dll_ext = '.dylib' - module_ext = '.so' -else: - # On most other UNIX systems (including linux), .so is used. - dll_ext = '.so' - module_ext = '.so' - -if sys.platform == "win32": - # On Windows, we must furthermore ensure that the PATH is modified - # to locate all of the DLL files. - - # First, search for the directory that contains all of our compiled - # modules. - target = None - 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)): - target = dir - if target == None: - message = "Cannot find %s" % (filename) - raise ImportError(message) - - # And add that directory to the system path. - path = os.environ["PATH"] - if not path.startswith(target + ";"): - os.environ["PATH"] = target + ";" + path - -def Dtool_FindModule(module): - # Finds a .pyd module on the Python path. - filename = module.replace('.', os.path.sep) + module_ext - for dir in sys.path: - lib = os.path.join(dir, filename) - if (os.path.exists(lib)): - return lib - - return None - -def Dtool_PreloadDLL(module): - if module in sys.modules: - return - - # First find it as a .pyd module on the Python path. - if Dtool_FindModule(module): - # OK, we should have no problem importing it as is. - return - - # Nope, we'll need to search for a dynamic lib and preload it. - # Search for the appropriate directory. - target = None - filename = module.replace('.', os.path.sep) + dll_suffix + dll_ext - for dir in sys.path + [sys.prefix]: - lib = os.path.join(dir, filename) - if (os.path.exists(lib)): - target = dir - break - - if target is None: - message = "DLL loader cannot find %s." % (module) - raise ImportError(message) - - # Now import the file explicitly. - pathname = os.path.join(target, filename) - imp.load_dynamic(module, pathname) - -# Nowadays, we can compile libpandaexpress with libpanda into a -# .pyd file called panda3d/core.pyd which can be imported without -# any difficulty. Let's see if this is the case. - -# In order to support things like py2exe that play games with the -# physical python files on disk, we can't entirely rely on -# Dtool_FindModule to find our panda3d.core module. However, we -# should be able to import it. To differentiate the old-style Panda -# build (with .dll's) from the new-style Panda build (with .pyd's), we -# first try to import panda3d.core directly; if it succeeds we're in a -# new-style build, and if it fails we must be in an old-style build. -try: - from panda3d.core import * -except ImportError: - Dtool_PreloadDLL("libpandaexpress") - from libpandaexpress import * - def Dtool_ObjectToDict(cls, name, obj): - cls.DtoolClassDict[name] = obj; + cls.DtoolClassDict[name] = obj def Dtool_funcToMethod(func, cls, method_name=None): """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method. @@ -127,4 +15,4 @@ def Dtool_funcToMethod(func, cls, method_name=None): func.im_self = None if not method_name: method_name = func.__name__ - cls.DtoolClassDict[method_name] = func; + cls.DtoolClassDict[method_name] = func diff --git a/direct/src/ffi/.gitignore b/direct/src/ffi/.gitignore deleted file mode 100644 index 98b300e013..0000000000 --- a/direct/src/ffi/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/genPyCode -/genPyCode.bat -/genPyCode.py diff --git a/direct/src/ffi/DoGenPyCode.py b/direct/src/ffi/DoGenPyCode.py deleted file mode 100644 index 9bfb627ab1..0000000000 --- a/direct/src/ffi/DoGenPyCode.py +++ /dev/null @@ -1,344 +0,0 @@ -""" This module implements genPyCode, which is itself a generated -script with a few default parameters filled in. This module allows -the user to specify alternate parameters on the command line. """ - -import getopt -import sys -import os -import time -from direct.ffi import FFIConstants - -# Define a help string for the user -helpString =""" -genPyCode -h -genPyCode -genPyCode [opts] -i libdtoolconfig libcode1 libcode2 ... - -This script generates Python wrappers to interface with the C++ -libraries that have already been run through interrogate. It is -necessary to run this script after building the Panda tools for the -first time, or after any major change in which some of the interface -may have changed. - -The default options are baked into genPyCode by ppremake and need not -be specified. However, it is possible to override these on the -command line if you need to fine-tune the behavior of genPyCode for -some reason. Most often, the only needed change will be to add one or -more additional libraries to the list of libraries instrumented by -default. - - -Options: - -h print this message - -v verbose - -d generate HTML documentation too - -C dir directory to write output code - -H dir directory to write output HTML - -x dir directory to pull extension code from - -i lib interrogate library - -e dir directory to search for *.in files (may be repeated) - -p dir directory to search for Python source files (may be repeated) - -r remove the default library list; instrument only named libraries - -O no C++ comments or assertion statements - -n Don't use squeezeTool to squeeze the result into one .pyz file - -s Don't delete source files after squeezing - -Any additional names listed on the command line are taken to be names -of libraries that are to be instrumented. - -""" - -HTMLHeader = """ - - -Panda3D documentation generated %s - - -""" - -HTMLFooter = """ - - -""" - -# Initialize variables -outputCodeDir = '' -outputHTMLDir = '' -directDir = '' -extensionsDir = '' -interrogateLib = '' -codeLibs = [] -etcPath = [] -pythonSourcePath = [] -doSqueeze = True -deleteSourceAfterSqueeze = True -doHTML = False -native = False # This is set by genPyCode.py - -def doGetopts(): - global outputCodeDir - global outputHTMLDir - global extensionsDir - global interrogateLib - global codeLibs - global doSqueeze - global deleteSourceAfterSqueeze - global doHTML - global etcPath - global pythonSourcePath - - # These options are allowed but are flagged as warnings (they are - # deprecated with the new genPyCode script): - - # -g adds libgateway - # -t adds libtoontown - # -p adds libpirates - # -o adds libopt - - FFIConstants.notify.setDebug(0) - FFIConstants.notify.setInfo(0) - - # Extract the args the user passed in - try: - opts, pargs = getopt.getopt(sys.argv[1:], 'hvdOC:H:x:Ni:e:p:rns') - except e: - # User passed in a bad option, print the error and the help, then exit - print(e) - print(helpString) - sys.exit() - - # Store the option values into our variables - for opt in opts: - flag, value = opt - if (flag == '-h'): - print(helpString) - sys.exit() - elif (flag == '-v'): - if not FFIConstants.notify.getInfo(): - FFIConstants.notify.setInfo(1) - else: - FFIConstants.notify.setDebug(1) - elif (flag == '-d'): - doHTML = True - elif (flag == '-C'): - outputCodeDir = value - elif (flag == '-H'): - outputHTMLDir = value - elif (flag == '-x'): - extensionsDir = value - elif (flag == '-i'): - interrogateLib = value - elif (flag == '-e'): - etcPath.append(value) - elif (flag == '-p'): - pythonSourcePath.append(value) - elif (flag == '-r'): - codeLibs = [] - elif (flag == '-O'): - FFIConstants.wantComments = 0 - FFIConstants.wantTypeChecking = 0 - elif (flag == '-n'): - doSqueeze = False - elif (flag == '-s'): - deleteSourceAfterSqueeze = False - - else: - FFIConstants.notify.error('illegal option: ' + flag) - - # Check for old, no-longer-used parameter: - invalidParameters = [ - 'linux', 'win-debug', 'win-release', 'win-publish', - 'install', 'release' - ] - if pargs and pargs[0] in invalidParameters: - FFIConstants.notify.warning("parameter is deprecated: %s" % (pargs[0])) - del pargs[0] - - # Store the program arguments into the codeLibs - for arg in pargs: - arg = arg.strip() - if arg: - codeLibs.append(arg) - - # Make sure each name appears on codeLibs exactly once. - newLibs = [] - for codeLib in codeLibs: - if codeLib not in newLibs: - newLibs.append(codeLib) - codeLibs = newLibs - - -def doErrorCheck(): - global outputCodeDir - global outputHTMLDir - global extensionsDir - global interrogateLib - global codeLibs - global doSqueeze - global etcPath - - # Now do some error checking and verbose output - if (not interrogateLib): - FFIConstants.notify.error('You must specify an interrogate library (-i lib)') - else: - FFIConstants.notify.debug('Setting interrogate library to: ' + interrogateLib) - FFIConstants.InterrogateModuleName = interrogateLib - - if (not outputCodeDir): - FFIConstants.notify.info('Setting output code directory to current directory') - outputCodeDir = '.' - elif (not os.path.exists(outputCodeDir)): - FFIConstants.notify.info('Directory does not exist, creating: ' + outputCodeDir) - os.mkdir(outputCodeDir) - FFIConstants.notify.info('Setting output code directory to: ' + outputCodeDir) - else: - FFIConstants.notify.info('Setting output code directory to: ' + outputCodeDir) - - if doHTML: - if (not outputHTMLDir): - FFIConstants.notify.info('Setting output HTML directory to current directory') - outputHTMLDir = '.' - elif (not os.path.exists(outputHTMLDir)): - FFIConstants.notify.info('Directory does not exist, creating: ' + outputHTMLDir) - os.makedirs(outputHTMLDir) - FFIConstants.notify.info('Setting output HTML directory to: ' + outputHTMLDir) - else: - FFIConstants.notify.info('Setting output HTML directory to: ' + outputHTMLDir) - - - if (not extensionsDir): - FFIConstants.notify.debug('Setting extensions directory to current directory') - extensionsDir = '.' - elif (not os.path.exists(extensionsDir)): - FFIConstants.notify.error('Directory does not exist: ' + extensionsDir) - else: - FFIConstants.notify.debug('Setting extensions directory to: ' + extensionsDir) - - - if (not codeLibs): - FFIConstants.notify.error('You must specify one or more libraries to generate code from') - else: - FFIConstants.notify.debug('Generating code for: ' + repr(codeLibs)) - FFIConstants.CodeModuleNameList = codeLibs - -def generateNativeWrappers(): - from direct.extensions_native.extension_native_helpers import Dtool_PreloadDLL - - # Empty out the output directories of unnecessary crud from - # previous runs before we begin. - for file in os.listdir(outputCodeDir): - pathname = os.path.join(outputCodeDir, file) - if not os.path.isdir(pathname): - os.unlink(pathname) - - # Generate __init__.py - initFilename = os.path.join(outputCodeDir, '__init__.py') - init = open(initFilename, 'w') - - # Generate PandaModules.py - pandaModulesFilename = os.path.join(outputCodeDir, 'PandaModules.py') - pandaModules = open(pandaModulesFilename, 'w') - - # Copy in any helper classes from the extensions_native directory - extensionHelperFiles = ['extension_native_helpers.py'] - for name in extensionHelperFiles: - inFilename = os.path.join(extensionsDir, name) - outFilename = os.path.join(outputCodeDir, name) - if os.path.exists(inFilename): - inFile = open(inFilename, 'r') - outFile = open(outFilename, 'w') - outFile.write(inFile.read()) - - # Generate a series of "libpandaModules.py" etc. files, one for - # each named module. - for moduleName in FFIConstants.CodeModuleNameList: - print('Importing code library: ' + moduleName) - Dtool_PreloadDLL(moduleName) - - __import__(moduleName) - module = sys.modules[moduleName] - - # Make a suitable meta module name - metaModuleName = "" - nextCap = False - for ch in moduleName: - if ch == '.': - nextCap = True - elif nextCap: - metaModuleName += ch.upper() - nextCap = False - else: - metaModuleName += ch - metaModuleName += "Modules" - - # Wrap the import in a try..except so that we can continue if - # the library isn't present. This is particularly necessary - # in the runtime (plugin) environment, where all libraries are - # not necessarily downloaded. - if sys.version_info >= (3, 0): - pandaModules.write('try:\n from .%s import *\nexcept ImportError as err:\n if "DLL loader cannot find" not in str(err):\n raise\n' % (metaModuleName)) - else: - pandaModules.write('try:\n from %s import *\nexcept ImportError, err:\n if "DLL loader cannot find" not in str(err):\n raise\n' % (metaModuleName)) - - # Not sure if this message is helpful or annoying. - #pandaModules.write(' print("Failed to import %s")\n' % (moduleName)) - pandaModules.write('\n') - - moduleModulesFilename = os.path.join(outputCodeDir, '%s.py' % (metaModuleName)) - moduleModules = open(moduleModulesFilename, 'w') - - if sys.version_info >= (3, 0): - moduleModules.write('from .extension_native_helpers import *\n') - else: - moduleModules.write('from extension_native_helpers import *\n') - moduleModules.write('Dtool_PreloadDLL("%s")\n' % (moduleName)) - - moduleModules.write('from %s import *\n\n' % (moduleName)) - - # Now look for extensions - for className, classDef in module.__dict__.items(): - if isinstance(classDef, type): - extensionFilename = os.path.join(extensionsDir, '%s_extensions.py' % (className)) - if os.path.exists(extensionFilename): - print(' Found extensions for class: %s' % (className)) - extension = open(extensionFilename, 'r') - moduleModules.write(extension.read()) - moduleModules.write('\n') - - -def run(): - global outputCodeDir - global outputHTMLDir - global directDir - global extensionsDir - global interrogateLib - global codeLibs - global doSqueeze - global deleteSourceAfterSqueeze - global etcPath - global pythonSourcePath - - doGetopts() - doErrorCheck() - - # Ok, now we can start generating code - if native: - generateNativeWrappers() - - else: - from direct.ffi import FFIInterrogateDatabase - db = FFIInterrogateDatabase.FFIInterrogateDatabase(etcPath = etcPath) - db.generateCode(outputCodeDir, extensionsDir) - - if doSqueeze: - db.squeezeGeneratedCode(outputCodeDir, deleteSourceAfterSqueeze) - - if doHTML: - from direct.directscripts import gendocs - from panda3d.core import PandaSystem - versionString = '%s %s' % ( - PandaSystem.getDistributor(), PandaSystem.getVersionString()) - - gendocs.generate(versionString, etcPath, pythonSourcePath, - outputHTMLDir, HTMLHeader % time.asctime(), - HTMLFooter, '', '.html') diff --git a/direct/src/ffi/FFIConstants.py b/direct/src/ffi/FFIConstants.py deleted file mode 100644 index 1ace18472e..0000000000 --- a/direct/src/ffi/FFIConstants.py +++ /dev/null @@ -1,24 +0,0 @@ - -# create a DirectNotify category for FFI modules -from direct.directnotify.DirectNotifyGlobal import * -notify = directNotify.newCategory("FFI") - -# This is the name of the file that the importing code will be stored -importModuleName = 'PandaModules' - -# A header for all the generated files -generatedHeader = '# This file is automatically generated. It would be unwise to edit.\n\n' - -# These modules should come from somewhere outside this program -# Maybe in an environment variable, or by looking at what you are -# attached to? -CodeModuleNameList = [] - -# This is the module that contains the interrogate functions -InterrogateModuleName = None - -# Should FFI output C++ comments with the source code? -wantComments = 1 - -# Should FFI output type assertions? -wantTypeChecking = 1 diff --git a/direct/src/ffi/FFIEnvironment.py b/direct/src/ffi/FFIEnvironment.py deleted file mode 100644 index f857c69d34..0000000000 --- a/direct/src/ffi/FFIEnvironment.py +++ /dev/null @@ -1,32 +0,0 @@ -import FFIConstants - -class FFIEnvironment: - def __init__(self): - self.reset() - - def reset(self): - self.types = {} - self.globalFunctions = [] - self.downcastFunctions = [] - self.globalValues = [] - self.manifests = [] - - def addType(self, typeDescriptor, name): - if name in self.types: - FFIConstants.notify.info('Redefining type named: ' + name) - self.types[name] = typeDescriptor - - def getTypeNamed(self, name): - try: - self.types[name] - except KeyError: - raise 'Type not found in FFIEnvironment' - - def addGlobalFunction(self, typeDescriptors): - self.globalFunctions.extend(typeDescriptors) - def addDowncastFunction(self, typeDescriptor): - self.downcastFunctions.append(typeDescriptor) - def addGlobalValue(self, typeDescriptor): - self.globalValues.append(typeDescriptor) - def addManifest(self, typeDescriptor): - self.manifests.append(typeDescriptor) diff --git a/direct/src/ffi/FFIExternalObject.py b/direct/src/ffi/FFIExternalObject.py deleted file mode 100644 index 962060715b..0000000000 --- a/direct/src/ffi/FFIExternalObject.py +++ /dev/null @@ -1,268 +0,0 @@ -from new import instance -import FFIConstants - -WrapperClassMap = {} - -DowncastMap = {} - -# For testing, you can turn verbose and debug on -# FFIConstants.notify.setInfo(1) -# FFIConstants.notify.setDebug(1) - -# Uncomment the notify statements if you need to debug, -# otherwise leave them commented out to prevent runtime -# overhead of calling them - - - -# Register a python class in the type map if it is a typed object -# The type map is used for upcasting and downcasting through -# the panda inheritance chain -def registerInTypeMap(pythonClass): - from pandac import TypedObject - if issubclass(pythonClass, TypedObject.TypedObject): - typeIndex = pythonClass.getClassType().getIndex() - WrapperClassMap[typeIndex] = pythonClass - - -def funcToMethod(func, clas, method_name=None): - """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method. - The new method is accessible to any instance immediately.""" - func.im_class=clas - func.im_func=func - func.im_self=None - if not method_name: - clas.__dict__[method_name]=func - else: - clas.__dict__[func.__name__]=func - - -def FFIInstance(classdef, this = 0, userManagesMemory = 0): - answer = instance(classdef) - answer.this = this - answer.userManagesMemory = userManagesMemory - return answer - -class FFIExternalObject: - def __init__(self, *_args): - # By default, we do not manage our own memory - self.userManagesMemory = 0 - # Start with a null this pointer - self.this = 0 - - def destructor(self): - # Base destructor in case you do not define one - pass - - def getLineage(self, thisClass, targetBaseClass): - # Recursively determine the path in the heirarchy tree from thisClass - # to the targetBaseClass - return self.getLineageInternal(thisClass, targetBaseClass, [thisClass]) - - def getLineageInternal(self, thisClass, targetBaseClass, chain): - # Recursively determine the path in the heirarchy tree from thisClass - # to the targetBaseClass - #FFIConstants.notify.debug('getLineageInternal: checking %s to %s' - # % (thisClass.__name__, targetBaseClass.__name__)) - if (targetBaseClass in thisClass.__bases__): - # Found a link - return chain + [targetBaseClass] - elif (len(thisClass.__bases__) == 0): - # No possible links - return 0 - else: - # recurse - for base in thisClass.__bases__: - res = self.getLineageInternal(base, targetBaseClass, chain+[base]) - if res: - # FFIConstants.notify.debug('getLineageInternal: found path: ' + repr(res)) - return res - # Not found anywhere - return 0 - - def getDowncastFunctions(self, thisClass, baseClass): - #FFIConstants.notify.debug( - # 'getDowncastFunctions: Looking for downcast function from %s to %s' - # % (baseClass.__name__, thisClass.__name__)) - lineage = self.getLineage(thisClass, baseClass) - # Start with an empty list of downcast functions - downcastFunctionList = [] - - # If it could not find the baseClass anywhere in the lineage, - # return empty - if not lineage: - return [] - - # Walk along the lineage looking for downcast functions from - # class to class+1. Start at the top and work downwards. - top = len(lineage) - 1 - for i in range(top): - toClass = lineage[top - i - 1] - fromClass = lineage[top - i] - downcastFuncName = ('downcastTo' + toClass.__name__ - + 'From' + fromClass.__name__) - # Look over this classes global modules dictionaries - # for the downcast function name - for globmod in toClass.__CModuleDowncasts__: - func = globmod.__dict__.get(downcastFuncName) - if func: - #FFIConstants.notify.debug( - # 'getDowncastFunctions: Found downcast function %s in %s' - # % (downcastFuncName, globmod.__name__)) - downcastFunctionList.append(func) - return downcastFunctionList - - def lookUpNewType(self, typeHandle, rootType): - # We tried to downcast to an unknown type. Try to figure out - # the lowest type we *do* know, so we can downcast to that - # type instead. - if typeHandle.getNumParentClasses() == 0: - # This type has no parents! That shouldn't happen. - FFIConstants.notify.warning("Unknown class type: %s has no parents!" % (typeHandle.getName())) - return None - - parentType = typeHandle.getParentTowards(rootType, self) - parentIndex = parentType.getIndex() - parentWrapperClass = WrapperClassMap.get(parentIndex) - if parentWrapperClass == None: - parentWrapperClass = self.lookUpNewType(parentType, rootType) - - if parentWrapperClass != None: - # If the parent class is known, then record that this - # class is a derivation of that parent class. - WrapperClassMap[typeHandle.getIndex()] = parentWrapperClass - - return parentWrapperClass - - def setPointer(self): - # See what type it really is and downcast to that type (if necessary) - # Look up the TypeHandle in the dict. get() returns None if it is not there - index = self.getTypeIndex() - exactWrapperClass = WrapperClassMap.get(index) - if exactWrapperClass == None: - # This is an unknown class type. Perhaps it derives from - # a class type we know. - exactWrapperClass = self.lookUpNewType(self.getType(), self.getClassType()) - - # We do not need to downcast if we already have the same class - if (exactWrapperClass and (exactWrapperClass != self.__class__)): - # Create a new wrapper class instance - #exactObject = exactWrapperClass(None) - exactObject = FFIInstance(exactWrapperClass) - # Get the downcast pointer that has had all the downcast - # funcs called - downcastObject = self.downcast(exactWrapperClass) - exactObject.this = downcastObject.this - exactObject.userManagesMemory = downcastObject.userManagesMemory - # Make sure the original downcast object does not get - # garbage collected so that the exactObject will not get - # gc'd thereby transferring ownership of the object to - # this new exactObject - downcastObject.userManagesMemory = 0 - return exactObject - else: - return self - - def downcast(self, toClass): - fromClass = self.__class__ - #FFIConstants.notify.debug('downcast: downcasting from %s to %s' % \ - # (fromClass.__name__, toClass.__name__)) - - # Check the cache to see if we have looked this up before - downcastChain = DowncastMap.get((fromClass, toClass)) - if downcastChain == None: - downcastChain = self.getDowncastFunctions(toClass, fromClass) - #FFIConstants.notify.debug('downcast: computed downcast chain: ' + repr(downcastChain)) - # Store it for next time - DowncastMap[(fromClass, toClass)] = downcastChain - newObject = self - for downcastFunc in downcastChain: - #FFIConstants.notify.debug('downcast: downcasting %s using %s' % \ - # (newObject.__class__.__name__, downcastFunc)) - newObject = downcastFunc(newObject) - return newObject - - def compareTo(self, other): - # By default, we compare the C++ pointers - # Some classes will override the compareTo operator with their own - # logic in C++ (like vectors and matrices for instance) - try: - if self.this < other.this: - return -1 - if self.this > other.this: - return 1 - else: - return 0 - except: - return 1 - - def __cmp__(self, other): - # Only use the C++ compareTo if they are the same class - if isinstance(other, self.__class__): - return self.compareTo(other) - # Otherwise, they must not be the same - # Just do a basic python id compare - else: - return cmp(id(self), id(other)) - - def __repr__(self): - # Lots of Panda classes have an output function defined that takes an Ostream - # We create a LineStream for the output function to write to, then we extract - # the string out of it and return it as our str - try: - from pandac import LineStream - lineStream = LineStream.LineStream() - self.output(lineStream) - baseRepr = lineStream.getLine() - except AssertionError, e: - raise AssertionError, e - except: - baseRepr = ('[' + self.__class__.__name__ + ' at: ' + repr(self.this) + ']') - # In any case, return the baseRepr - return baseRepr - - def __str__(self): - # This is a more complete version of printing which shows the object type - # and pointer, plus the output from write() or output() whichever is defined - # Print this info for all objects - baseRepr = ('[' + self.__class__.__name__ + ' at: ' + repr(self.this) + ']') - # Lots of Panda classes have an write or output function defined that takes an Ostream - # We create a LineStream for the write or output function to write to, then we extract - # the string out of it and return it as our repr - from pandac import LineStream - lineStream = LineStream.LineStream() - try: - # First try the write function, that is the better one - self.write(lineStream) - while lineStream.isTextAvailable(): - baseRepr = baseRepr + '\n' + lineStream.getLine() - except AssertionError, e: - raise AssertionError, e - except: - try: - # Sometimes write insists on a seconds parameter. - self.write(lineStream, 0) - while lineStream.isTextAvailable(): - baseRepr = baseRepr + '\n' + lineStream.getLine() - except AssertionError, e: - raise AssertionError, e - except: - try: - # Ok, no write function, lets try output then - self.output(lineStream) - while lineStream.isTextAvailable(): - baseRepr = baseRepr + '\n' + lineStream.getLine() - except AssertionError, e: - raise AssertionError, e - except: - pass - # In any case, return the baseRepr - return baseRepr - - def __hash__(self): - return self.this - - - - - diff --git a/direct/src/ffi/FFIInterrogateDatabase.py b/direct/src/ffi/FFIInterrogateDatabase.py deleted file mode 100644 index f203addc82..0000000000 --- a/direct/src/ffi/FFIInterrogateDatabase.py +++ /dev/null @@ -1,870 +0,0 @@ - -# Note: do not import this file directly, it is meant to be used as part of -# a Python script (generatePythonCode) that sets up variables that this -# module depends on - -import string -import os -import glob - -import FFIEnvironment -import FFITypes -import FFISpecs -import FFIRename -import FFIConstants -import FFIOverload -from direct.showbase.PythonUtil import * - -FFIConstants.notify.info('Importing interrogate library: ' + FFIConstants.InterrogateModuleName) - -# Note: we do a from lib import * here because we do not want -# to be dependent on the name of the interrogate library in this code -exec('from ' + FFIConstants.InterrogateModuleName + ' import *') - - -def constructGlobalFile(codeDir, CModuleName): - """ - Open a file that will hold the global values and functions code - """ - file = open(os.path.join(codeDir, CModuleName + 'Globals' + '.py'), 'w') - return file - - -def constructDowncastFile(codeDir, CModuleName): - """ - Open a file that will hold the global values and functions code - """ - file = open(os.path.join(codeDir, CModuleName + 'Downcasts' + '.py'), 'w') - return file - - -def constructImportFile(codeDir, CModuleName): - """ - Open a file that will hold the global values and functions code - """ - file = open(os.path.join(codeDir, CModuleName + 'Modules' + '.py'), 'w') - return file - -def outputGlobalFileImports(file, methodList, CModuleName): - # Print the standard header - file.write(FFIConstants.generatedHeader) - file.write('# CMODULE [' + CModuleName + ']\n') - - # Import Python's builtin types - file.write('from types import IntType, LongType, FloatType, NoneType, StringType\n') - file.write('from direct.ffi import FFIExternalObject\n') - - - # Import the C modules - CModuleList = [] - for method in methodList: - if (not (method.typeDescriptor.moduleName in CModuleList)): - CModuleList.append(method.typeDescriptor.moduleName) - for CModuleName in CModuleList: - if CModuleName: - file.write('import ' + CModuleName + '\n') - - moduleList = [] - for method in methodList: - returnType = method.typeDescriptor.returnType.recursiveTypeDescriptor() - returnTypeName = returnType.foreignTypeName - if (not (returnTypeName in moduleList)): - if (returnType.__class__ == FFITypes.ClassTypeDescriptor): - moduleList.append(returnTypeName) - - # Look at all the arguments - argTypes = method.typeDescriptor.argumentTypes - for argType in argTypes: - # Get the real return type (not derived) - argType = argType.typeDescriptor.recursiveTypeDescriptor() - if (not argType.isNested): - argTypeName = argType.foreignTypeName - # Do not put our own module in the import list - # Do not put modules already in the list (like a set) - if (not (argTypeName in moduleList)): - # If this is a class (not a primitive), put it on the list - if (argType.__class__ == FFITypes.ClassTypeDescriptor): - moduleList.append(argTypeName) - - - for moduleName in moduleList: - if moduleName: - file.write('import ' + moduleName + '\n') - file.write('import ' + moduleName + '1\n') - - file.write('\n') - - -def outputImportFileImports(file, typeList, CModuleName): - """ - This is the file that we will import to get all the panda modules - """ - - # Print the standard header - file.write(FFIConstants.generatedHeader) - file.write('# CMODULE [' + CModuleName + ']\n') - file.write('# Import the interrogate module\n') - file.write('import ' + FFIConstants.InterrogateModuleName + '\n') - file.write('\n') - - file.write('# Import the C module\n') - file.write('import ' + CModuleName + '\n') - - # Filter out only the class and enum type descriptors (not const, pointers, etc) - classTypeList = [] - enumTypeList = [] - for type in typeList: - if (type.__class__ == FFITypes.ClassTypeDescriptor): - if (not type.isNested): - classTypeList.append(type) - elif (type.__class__ == FFITypes.EnumTypeDescriptor): - if (not type.isNested): - enumTypeList.append(type) - - # Sort the types based on inheritance, most generic first - classTypeList.sort(FFIOverload.inheritanceLevelSort) - - moduleList = [] - for type in classTypeList: - moduleList.append(type.foreignTypeName) - - file.write('# Import enums into the global name space\n') - for type in enumTypeList: - file.write('from ' + type.enumName + ' import *\n') - file.write('\n') - - file.write('# Import downcast functions\n') - file.write('from ' + CModuleName + 'Downcasts import *\n') - file.write('\n') - - file.write('# Import classes\n') - for moduleName in moduleList: - if moduleName: - file.write('import ' + moduleName + '\n') - file.write('\n') - - file.write('# Import classes2\n') - for moduleName in moduleList: - if moduleName: - file.write('import ' + moduleName + '1\n') - file.write('\n') - - - file.write('# Import the global module file into our name space\n') - file.write('from ' + CModuleName + 'Globals import *\n') - file.write('\n') - - file.write('# Generate the classes\n') - #for moduleName in moduleList: - # file.write(moduleName + '.generateClass_' + moduleName + '()\n') - file.write('\n') - - file.write('# Copy the classes into our own namespace\n') - for moduleName in moduleList: - file.write(moduleName + ' = ' + moduleName + '.' + moduleName + '\n') - file.write('\n') - - file.write('# Put the classes in the wrapper class map\n') - file.write('from direct.ffi.FFIExternalObject import registerInTypeMap\n') - file.write('\n') - for moduleName in moduleList: - file.write('registerInTypeMap(' + moduleName + ')\n') - file.write('\n') - - - -def getTypeName(typeIndex, scoped=0): - """ - Return a fully specified type name for this type index - Return the scoped name if asked for it - """ - nameComponents = [] - name = '' - - - if scoped: - typeName = interrogate_type_scoped_name(typeIndex) - else: - typeName = interrogate_type_name(typeIndex) - - if typeIndex == 0: - FFIConstants.notify.debug('typeIndex 0: ' + typeName) - - if interrogate_type_is_wrapped(typeIndex): - typeName = getTypeName(interrogate_type_wrapped_type(typeIndex)) - if interrogate_type_is_const(typeIndex): - nameComponents.append('const') - if interrogate_type_is_pointer(typeIndex): - nameComponents.append('ptr') - if interrogate_type_is_signed(typeIndex): - # signed is now built into the type name - #nameComponents.append('signed') - pass - if interrogate_type_is_unsigned(typeIndex): - # unsigned is now built into the type name - #nameComponents.append('unsigned') - pass - if interrogate_type_is_long(typeIndex): - nameComponents.append('long') - if interrogate_type_is_longlong(typeIndex): - nameComponents.append('longLong') - if interrogate_type_is_short(typeIndex): - nameComponents.append('short') - if (len(nameComponents) > 0): - typeName = string.capitalize(typeName[0]) + typeName[1:] - nameComponents.append(typeName) - for i in range(len(nameComponents)): - if (i == 0): - name = name + nameComponents[i] - else: - name = name + string.capitalize(nameComponents[i][0]) + nameComponents[i][1:] - - FFIConstants.notify.debug('typeIndex: ' + repr(typeIndex) + ' typeName: ' + typeName + ' has name: ' + name) - - if not name: - FFIConstants.notify.warning('typeIndex: ' + repr(typeIndex) + ' typeName: ' + typeName + ' has no name') - name = "UnnamedType" - - return name - - -class FFIInterrogateDatabase: - - def __init__(self, etcPath = []): - for dir in etcPath: - interrogate_add_search_directory(dir) - - self.typeIndexMap = {} - self.environment = FFIEnvironment.FFIEnvironment() - - def isDefinedType(self, typeIndex): - return typeIndex in self.typeIndexMap - - def constructDescriptor(self, typeIndex): - if interrogate_type_is_atomic(typeIndex): - return self.constructPrimitiveTypeDescriptor(typeIndex) - - elif interrogate_type_is_enum(typeIndex): - return self.constructEnumTypeDescriptor(typeIndex) - - elif interrogate_type_is_wrapped(typeIndex): - if interrogate_type_is_pointer(typeIndex): - return self.constructPointerTypeDescriptor(typeIndex) - elif interrogate_type_is_const(typeIndex): - return self.constructConstTypeDescriptor(typeIndex) - - elif (interrogate_type_is_class(typeIndex) or - interrogate_type_is_struct(typeIndex) or - interrogate_type_is_union(typeIndex)): - return self.constructClassTypeDescriptor(typeIndex) - - elif (not interrogate_type_is_fully_defined(typeIndex)): - return self.constructClassTypeDescriptor(typeIndex) - - else: - raise 'A type in the interrogate database was not recognized: '+ repr(typeIndex) - - def constructPrimitiveTypeDescriptor(self, typeIndex): - if self.isDefinedType(typeIndex): - return self.typeIndexMap[typeIndex] - else: - descriptor = FFITypes.PrimitiveTypeDescriptor() - #descriptor.environment = self.environment - descriptor.atomicType = interrogate_type_atomic_token(typeIndex) - if interrogate_type_has_module_name(typeIndex): - descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex) - descriptor.foreignTypeName = \ - FFIRename.nonClassNameFromCppName(getTypeName(typeIndex)) - descriptor.typeIndex = typeIndex - self.typeIndexMap[typeIndex] = descriptor - return descriptor - - def constructEnumTypeDescriptor(self, typeIndex): - if self.isDefinedType(typeIndex): - return self.typeIndexMap[typeIndex] - else: - descriptor = FFITypes.EnumTypeDescriptor() - #descriptor.environment = self.environment - descriptor.isNested = interrogate_type_is_nested(typeIndex) - if descriptor.isNested: - outerTypeIndex = interrogate_type_outer_class(typeIndex) - descriptor.outerType = self.constructDescriptor(outerTypeIndex) - if interrogate_type_has_module_name(typeIndex): - descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex) - - # Enums are ints in C++ but we do not want to redefine the int type - # So we will just call them enums - descriptor.enumName = FFIRename.classNameFromCppName(getTypeName(typeIndex)) - descriptor.foreignTypeName = '__enum__' + descriptor.enumName - numValues = interrogate_type_number_of_enum_values(typeIndex) - - # Store the names and values of the enum in a dictionary - for i in range(numValues): - value = interrogate_type_enum_value(typeIndex, i) - name = FFIRename.classNameFromCppName( - interrogate_type_enum_value_name(typeIndex, i)) - scopedName = FFIRename.classNameFromCppName( - interrogate_type_enum_value_scoped_name(typeIndex, i)) - descriptor.values[name] = value - - descriptor.typeIndex = typeIndex - self.typeIndexMap[typeIndex] = descriptor - return descriptor - - def constructPointerTypeDescriptor(self, typeIndex): - if self.isDefinedType(typeIndex): - return self.typeIndexMap[typeIndex] - descriptor = FFITypes.PointerTypeDescriptor() - #descriptor.environment = self.environment - descriptor.isNested = interrogate_type_is_nested(typeIndex) - if descriptor.isNested: - outerTypeIndex = interrogate_type_outer_class(typeIndex) - descriptor.outerType = self.constructDescriptor(outerTypeIndex) - if interrogate_type_has_module_name(typeIndex): - descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex) - descriptor.foreignTypeName = \ - FFIRename.nonClassNameFromCppName(getTypeName(typeIndex)) - descriptor.typeIndex = typeIndex - wrappedTypeIndex = interrogate_type_wrapped_type(typeIndex) - wrappedTypeDescriptor = self.constructDescriptor(wrappedTypeIndex) - descriptor.typeDescriptor = wrappedTypeDescriptor - self.typeIndexMap[typeIndex] = descriptor - return descriptor - - def constructConstTypeDescriptor(self, typeIndex): - if self.isDefinedType(typeIndex): - return self.typeIndexMap[typeIndex] - descriptor = FFITypes.ConstTypeDescriptor() - #descriptor.environment = self.environment - descriptor.isNested = interrogate_type_is_nested(typeIndex) - if descriptor.isNested: - outerTypeIndex = interrogate_type_outer_class(typeIndex) - descriptor.outerType = self.constructDescriptor(outerTypeIndex) - if interrogate_type_has_module_name(typeIndex): - descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex) - descriptor.foreignTypeName = \ - FFIRename.nonClassNameFromCppName(getTypeName(typeIndex)) - descriptor.typeIndex = typeIndex - wrappedTypeIndex = interrogate_type_wrapped_type(typeIndex) - wrappedTypeDescriptor = self.constructDescriptor(wrappedTypeIndex) - descriptor.typeDescriptor = wrappedTypeDescriptor - self.typeIndexMap[typeIndex] = descriptor - return descriptor - - def constructParentTypeDescriptors(self, typeIndex): - numParents = interrogate_type_number_of_derivations(typeIndex) - descriptors = [] - for i in range(numParents): - parentTypeIndex = interrogate_type_get_derivation(typeIndex, i) - if self.isDefinedType(parentTypeIndex): - parentTypeDescriptor = self.typeIndexMap[parentTypeIndex] - else: - parentTypeDescriptor = self.constructDescriptor(parentTypeIndex) - descriptors.append(parentTypeDescriptor) - return descriptors - - def constructNestedTypeDescriptors(self, typeIndex): - nestedTypes = [] - numNestedTypes = interrogate_type_number_of_nested_types(typeIndex) - for i in range(numNestedTypes): - nestedTypeIndex = interrogate_type_get_nested_type(typeIndex, i) - descriptor = self.constructDescriptor(nestedTypeIndex) - nestedTypes.append(descriptor) - return nestedTypes - - def constructClassTypeDescriptor(self, typeIndex): - if self.isDefinedType(typeIndex): - return self.typeIndexMap[typeIndex] - typeName = FFIRename.classNameFromCppName(getTypeName(typeIndex)) - if typeName == "PyObject": - # A special case: the PyObject type is really a native - # Python object, not to be molested--it's not really an - # FFI class object. - descriptor = FFITypes.PyObjectTypeDescriptor() - self.typeIndexMap[typeIndex] = descriptor - return descriptor - - descriptor = FFITypes.ClassTypeDescriptor() - self.typeIndexMap[typeIndex] = descriptor - #descriptor.environment = self.environment - descriptor.foreignTypeName = typeName - - if (typeName == "TypedObject"): - FFITypes.TypedObjectDescriptor = descriptor - - descriptor.isNested = interrogate_type_is_nested(typeIndex) - if descriptor.isNested: - outerTypeIndex = interrogate_type_outer_class(typeIndex) - descriptor.outerType = self.constructDescriptor(outerTypeIndex) - if interrogate_type_has_module_name(typeIndex): - descriptor.moduleName = 'lib' + interrogate_type_module_name(typeIndex) - if FFIConstants.wantComments: - if interrogate_type_has_comment(typeIndex): - descriptor.comment = interrogate_type_comment(typeIndex) - descriptor.typeIndex = typeIndex - descriptor.instanceMethods = self.constructMemberFunctionSpecifications(typeIndex) - descriptor.upcastMethods = self.constructUpcastFunctionSpecifications(typeIndex) - # Constructing downcasts does not return the functions, it just puts them in the class - # See the comment in that function - self.constructDowncastFunctionSpecifications(typeIndex) - descriptor.filterOutStaticMethods() - descriptor.constructors = self.constructConstructorSpecifications(typeIndex) - descriptor.destructor = self.constructDestructorSpecification(typeIndex) - descriptor.parentTypes = self.constructParentTypeDescriptors(typeIndex) - descriptor.nestedTypes = self.constructNestedTypeDescriptors(typeIndex) - return descriptor - - def constructFunctionTypeDescriptors(self, functionIndex): - - # Store these values because they will be the same for all the wrappers - isVirtual = interrogate_function_is_virtual(functionIndex) - #environment = self.environment - foreignTypeName = interrogate_function_name(functionIndex) - if FFIConstants.wantComments: - prototype = interrogate_function_prototype(functionIndex) - if interrogate_function_has_comment(functionIndex): - comment = interrogate_function_comment(functionIndex) - else: - comment = '' - # Prepend lib to the module name it reports because that will be the name of - # the Python module we import. This is apparently stems from a makefile - # discrepency in the way we build the libraries - if interrogate_function_has_module_name(functionIndex): - moduleName = 'lib' + interrogate_function_module_name(functionIndex) - else: - moduleName = None - typeIndex = functionIndex - - # Look at the Python wrappers for this function - numPythonWrappers = interrogate_function_number_of_python_wrappers(functionIndex) - - if numPythonWrappers == 0: - # If there are no Python wrappers, it is because interrogate could not handle - # something about the function. Just return an empty list - return [] - - wrapperDescriptors = [] - - # Iterate over the wrappers constructing a FunctionTypeDescriptor for each - for i in range(numPythonWrappers): - descriptor = FFITypes.FunctionTypeDescriptor() - descriptor.isVirtual = isVirtual - #descriptor.environment = environment - descriptor.foreignTypeName = foreignTypeName - if FFIConstants.wantComments: - descriptor.comment = comment - descriptor.prototype = prototype - descriptor.moduleName = moduleName - descriptor.typeIndex = typeIndex - pythonFunctionIndex = interrogate_function_python_wrapper(functionIndex, i) - descriptor.wrapperName = interrogate_wrapper_name(pythonFunctionIndex) - # Even if it does not have a return value, it reports void which is better - # for generating code, so I will not even ask here - # if interrogate_wrapper_has_return_value(pythonFunctionIndex): - returnType = interrogate_wrapper_return_type(pythonFunctionIndex) - descriptor.returnType = self.constructDescriptor(returnType) - descriptor.argumentTypes = self.constructFunctionArgumentTypes(pythonFunctionIndex) - descriptor.userManagesMemory = interrogate_wrapper_caller_manages_return_value(pythonFunctionIndex) - descriptor.returnValueDestructor = interrogate_wrapper_return_value_destructor(pythonFunctionIndex) - wrapperDescriptors.append(descriptor) - - return wrapperDescriptors - - def constructFunctionArgumentTypes(self, functionIndex): - numArgs = interrogate_wrapper_number_of_parameters(functionIndex) - arguments = [] - for argIndex in range(numArgs): - if interrogate_wrapper_parameter_has_name(functionIndex, argIndex): - name = FFIRename.nonClassNameFromCppName( - interrogate_wrapper_parameter_name(functionIndex, argIndex)) - else: - name = ('parameter' + repr(argIndex)) - descriptor = self.constructDescriptor( - interrogate_wrapper_parameter_type(functionIndex, argIndex)) - - argSpec = FFISpecs.MethodArgumentSpecification() - if interrogate_wrapper_parameter_is_this(functionIndex, argIndex): - argSpec.isThis = 1 - argSpec.name = name - argSpec.typeDescriptor = descriptor - arguments.append(argSpec) - return arguments - - def constructMemberFunctionSpecifications(self, typeIndex): - funcSpecs = [] - numFuncs = interrogate_type_number_of_methods(typeIndex) - for i in range(numFuncs): - funcIndex = interrogate_type_get_method(typeIndex, i) - typeDescs = self.constructFunctionTypeDescriptors(funcIndex) - for typeDesc in typeDescs: - funcSpec = FFISpecs.MethodSpecification() - funcSpec.name = FFIRename.methodNameFromCppName( - interrogate_function_name(funcIndex), - getTypeName(typeIndex)) - funcSpec.typeDescriptor = typeDesc - funcSpec.index = funcIndex - funcSpecs.append(funcSpec) - return funcSpecs - - def constructUpcastFunctionSpecifications(self, typeIndex): - funcSpecs = [] - numFuncs = interrogate_type_number_of_derivations(typeIndex) - for i in range(numFuncs): - if interrogate_type_derivation_has_upcast(typeIndex, i): - funcIndex = interrogate_type_get_upcast(typeIndex, i) - typeDescs = self.constructFunctionTypeDescriptors(funcIndex) - for typeDesc in typeDescs: - funcSpec = FFISpecs.MethodSpecification() - # We synthesize the upcast function name instead - # of using the name supplied by interrogate, to - # allow for possible renaming of types on this - # side. - funcSpec.name = 'upcastTo' + typeDesc.returnType.typeDescriptor.foreignTypeName - #funcSpec.name = FFIRename.methodNameFromCppName( - # interrogate_function_name(funcIndex)) - funcSpec.typeDescriptor = typeDesc - funcSpec.index = funcIndex - funcSpecs.append(funcSpec) - return funcSpecs - - def constructDowncastFunctionSpecifications(self, typeIndex): - """ - The strange thing about downcast functions is that they appear in the - class they are being downcast TO, not downcast FROM. But they should be - built into the class they are being downcast from. For instance, a method - downcastToNode(ptrBoundedObject) will appear in Node's list of methods - but should be compiled into BoundedObject's class - UPDATE: These are no longer compiled into the from-class. That was - preventing the libraries from being independent since the from class - now had knowledge of the to class which is potentially in a library - downstream. Now these functions are just global functions - """ - numFuncs = interrogate_type_number_of_derivations(typeIndex) - for i in range(numFuncs): - # Make sure this downcast is possible - if (not interrogate_type_derivation_downcast_is_impossible(typeIndex, i)): - if interrogate_type_derivation_has_downcast(typeIndex, i): - funcIndex = interrogate_type_get_downcast(typeIndex, i) - typeDescs = self.constructFunctionTypeDescriptors(funcIndex) - for typeDesc in typeDescs: - funcSpec = FFISpecs.GlobalFunctionSpecification() - funcSpec.name = FFIRename.methodNameFromCppName( - interrogate_function_name(funcIndex), - getTypeName(typeIndex)) - funcSpec.typeDescriptor = typeDesc - funcSpec.index = funcIndex - # Here we look for the class in the first argument - fromClass = typeDesc.argumentTypes[0].typeDescriptor.recursiveTypeDescriptor() - - # Append the from class name on the method to uniquify it now - # that these are global methods - funcSpec.name = funcSpec.name + 'From' + fromClass.foreignTypeName - - # Append this funcSpec to that class's downcast methods - # fromClass.downcastMethods.append(funcSpec) - self.environment.addDowncastFunction(funcSpec) - - def constructConstructorSpecifications(self, typeIndex): - funcSpecs = [] - numFuncs = interrogate_type_number_of_constructors(typeIndex) - for i in range(numFuncs): - funcIndex = interrogate_type_get_constructor(typeIndex, i) - typeDescs = self.constructFunctionTypeDescriptors(funcIndex) - for typeDesc in typeDescs: - funcSpec = FFISpecs.MethodSpecification() - funcSpec.name = 'constructor' - # funcSpec.name = FFIRename.methodNameFromCppName( - # interrogate_function_name(funcIndex)) - funcSpec.typeDescriptor = typeDesc - # Flag this function as being a constructor - funcSpec.constructor = 1 - funcSpec.index = funcIndex - funcSpecs.append(funcSpec) - return funcSpecs - - def constructDestructorSpecification(self, typeIndex): - if (not interrogate_type_has_destructor(typeIndex)): - return None - funcIndex = interrogate_type_get_destructor(typeIndex) - typeDescs = self.constructFunctionTypeDescriptors(funcIndex) - if (len(typeDescs) == 0): - return None - for typeDesc in typeDescs: - funcSpec = FFISpecs.MethodSpecification() - funcSpec.name = 'destructor' - # funcSpec.name = FFIRename.methodNameFromCppName( - # interrogate_function_name(funcIndex)) - funcSpec.typeDescriptor = typeDesc - funcSpec.index = funcIndex - return funcSpec - - def addTypes(self, CModuleName): - for i in range(interrogate_number_of_global_types()): - typeIndex = interrogate_get_global_type(i) - if self.typeInCModule(typeIndex, CModuleName): - self.constructDescriptor(typeIndex) - - def addEnvironmentTypes(self): - for descriptor in self.typeIndexMap.values(): - self.environment.addType(descriptor, descriptor.foreignTypeName) - - def functionInCModule(self, funcIndex, CModuleName): - if interrogate_function_has_module_name(funcIndex): - moduleName = 'lib' + interrogate_function_module_name(funcIndex) - return (moduleName == CModuleName) - - def typeInCModule(self, typeIndex, CModuleName): - if interrogate_type_has_module_name(typeIndex): - moduleName = 'lib' + interrogate_type_module_name(typeIndex) - return (moduleName == CModuleName) - - - def constructGlobal(self, globalIndex, CModuleName): - # We really do not need the descriptor for the value, just - # the getter and setter - # typeIndex = interrogate_element_type(globalIndex) - # descriptor = self.constructDescriptor(typeIndex) - - if interrogate_element_has_getter(globalIndex): - getterIndex = interrogate_element_getter(globalIndex) - # If this function is not in this Cmodule just return - if not self.functionInCModule(getterIndex, CModuleName): - return None - getter = self.constructGlobalFunction(getterIndex) - else: - getter = None - - if interrogate_element_has_setter(globalIndex): - setterIndex = interrogate_element_setter(globalIndex) - # If this function is not in this Cmodule just return - if not self.functionInCModule(setterIndex, CModuleName): - return None - setter = self.constructGlobalFunction(setterIndex) - else: - setter = None - globalSpec = FFISpecs.GlobalValueSpecification() - globalSpec.getter = getter - globalSpec.setter = setter - # globalSpec.typeDescriptor = descriptor - cppName = interrogate_element_name(globalIndex) - globalSpec.name = FFIRename.classNameFromCppName(cppName) - return globalSpec - - def constructGlobalFunction(self, globalIndex): - descriptors = self.constructFunctionTypeDescriptors(globalIndex) - if (len(descriptors) == 0): - return None - funcSpecs = [] - for descriptor in descriptors: - funcSpec = FFISpecs.GlobalFunctionSpecification() - funcSpec.typeDescriptor = descriptor - funcSpec.name = FFIRename.methodNameFromCppName( - funcSpec.typeDescriptor.foreignTypeName) - funcSpec.index = globalIndex - funcSpecs.append(funcSpec) - return funcSpecs - - def addGlobalFunctions(self, CModuleName): - numGlobals = interrogate_number_of_global_functions() - for i in range(numGlobals): - funcIndex = interrogate_get_global_function(i) - if self.functionInCModule(funcIndex, CModuleName): - newGlob = self.constructGlobalFunction(funcIndex) - if newGlob: - self.environment.addGlobalFunction(newGlob) - - def addGlobalValues(self, CModuleName): - numGlobals = interrogate_number_of_globals() - for i in range(numGlobals): - globalIndex = interrogate_get_global(i) - newGlob = self.constructGlobal(globalIndex, CModuleName) - if newGlob: - self.environment.addGlobalValue(newGlob) - - def constructManifest(self, manifestIndex): - descriptor = None - intValue = None - getter = None - - if interrogate_manifest_has_type(manifestIndex): - typeIndex = interrogate_manifest_get_type(manifestIndex) - descriptor = self.constructDescriptor(typeIndex) - - definition = interrogate_manifest_definition(manifestIndex) - - # See if this manifest is an int. There are shortcuts if it is. - # If it does have an int value, there will be no getter, we will - # just output the value in the generated code - if interrogate_manifest_has_int_value(manifestIndex): - intValue = interrogate_manifest_get_int_value(manifestIndex) - else: - # See if this manifest has a getter - if interrogate_manifest_has_getter(manifestIndex): - getterIndex = interrogate_manifest_getter(manifestIndex) - getter = self.constructGlobalFunction(getterIndex) - - manifestSpec = FFISpecs.ManifestSpecification() - manifestSpec.typeDescriptor = descriptor - manifestSpec.definition = definition - manifestSpec.intValue = intValue - manifestSpec.getter = getter - cppName = interrogate_manifest_name(manifestIndex) - manifestSpec.name = FFIRename.classNameFromCppName(cppName) - return manifestSpec - - def addManifestSymbols(self): - numManifests = interrogate_number_of_manifests() - for i in range(numManifests): - manifestIndex = interrogate_get_manifest(i) - newManifest = self.constructManifest(manifestIndex) - self.environment.addManifest(newManifest) - - - def generateCode(self, codeDir, extensionsDir): - # Empty out the codeDir of unnecessary crud from previous runs - # before we begin. - for file in os.listdir(codeDir): - pathname = os.path.join(codeDir, file) - if not os.path.isdir(pathname): - os.unlink(pathname) - - # Import all the C++ modules - for CModuleName in FFIConstants.CodeModuleNameList: - self.generateCodeLib(codeDir, extensionsDir, CModuleName) - - # For convenience, output a file that imports all the c module files - file = open(os.path.join(codeDir, FFIConstants.importModuleName + '.py'), 'w') - for CModuleName in FFIConstants.CodeModuleNameList: - file.write('from ' + CModuleName + 'Modules import *\n') - file.close() - - # Generate an empty __init__.py to make the directory a Python - # package. - init = os.path.join(codeDir, '__init__.py') - file = open(init, 'w') - file.close() - - def squeezeGeneratedCode(self, outputDir, deleteSource=True): - - # Since we will be squeezing the importModuleName file, rename - # the original to something we can import from within the - # squeezed version. - squeezedName = FFIConstants.importModuleName - unsqueezedName = FFIConstants.importModuleName + 'Unsqueezed' - - os.rename(os.path.join(outputDir, squeezedName + '.py'), - os.path.join(outputDir, unsqueezedName + '.py')) - - # Get the list of files to squeeze. This is all of the .py - # files in the output directory except for the __init__.py - # file. - - files = glob.glob(os.path.join(outputDir, '*.py')) - init = os.path.join(outputDir, '__init__.py') - try: - files.remove(init) - except: - pass - - print "Squeezing %s files." % (len(files)) - - from direct.showbase import pandaSqueezeTool - - pandaSqueezeTool.squeeze(squeezedName, unsqueezedName, - files, outputDir) - - if deleteSource: - # Remove the now-squeezed source files. - for file in files: - os.remove(file) - - - def generateCodeLib(self, codeDir, extensionsDir, CModuleName): - # Reset the environment so we are clean from any old modules - self.environment.reset() - - FFIConstants.notify.info('='*50) - FFIConstants.notify.warning('Importing code library: ' + CModuleName) - exec('import ' + CModuleName) - - if interrogate_error_flag(): - FFIConstants.notify.error("Error reading interrogate database; can't continue.") - - self.updateBindings(CModuleName) - - FFIConstants.notify.info('Generating type code...') - for type in self.environment.types.values(): - # Do not generate code for nested types at the top level - if (not type.isNested): - type.generateGlobalCode(codeDir, extensionsDir) - - - FFIConstants.notify.info('Generating global downcast code...') - downcastFile = constructDowncastFile(codeDir, CModuleName) - # Output all the imports based on this list of functions - outputGlobalFileImports(downcastFile, - self.environment.downcastFunctions, - CModuleName) - for type in self.environment.downcastFunctions: - type.generateGlobalDowncastCode(downcastFile) - - FFIConstants.notify.info('Generating global code...') - globalFile = constructGlobalFile(codeDir, CModuleName) - - # Make a list of all the global functions. This includes the normal - # global functions as well as the getters and setters on all the - # global values. This list is used to figure out what files to import - # Only include the global functions from the current C module - globalFunctions = self.environment.globalFunctions - for globalValue in self.environment.globalValues: - if globalValue.getter: - globalFunctions.append(globalValue.getter) - if globalValue.setter: - globalFunctions.append(globalValue.setter) - # Output all the imports based on this list of functions - outputGlobalFileImports(globalFile, globalFunctions, CModuleName) - - # Generate overloading - overloadedGlobalFunctions = {} - for methodSpec in globalFunctions: - methodList = overloadedGlobalFunctions.setdefault(methodSpec.name, []) - methodList.append(methodSpec) - - overloadedGlobalFunctions = FFIOverload.cullOverloadedMethods(overloadedGlobalFunctions) - - for methodSpecList in overloadedGlobalFunctions.values(): - treeColl = FFIOverload.FFIMethodArgumentTreeCollection(None, methodSpecList) - treeColl.generateCode(globalFile, -1) - - FFIConstants.notify.info('Generating global values...') - for type in self.environment.globalValues: - type.generateGlobalCode(globalFile) - - FFIConstants.notify.info('Generating global functions...') - for type in self.environment.globalFunctions: - type.generateGlobalCode(globalFile) - - FFIConstants.notify.info('Generating manifests...') - for type in self.environment.manifests: - type.generateGlobalCode(globalFile) - - globalFile.close() - - FFIConstants.notify.info('Generating import code...') - importFile = constructImportFile(codeDir, CModuleName) - outputImportFileImports(importFile, self.environment.types.values(), CModuleName) - - def updateBindings(self, CModuleName): - FFIConstants.notify.info('Updating Bindings') - FFIConstants.notify.info('Adding Types...') - self.addTypes(CModuleName) - FFIConstants.notify.info('Adding global values...') - self.addGlobalValues(CModuleName) - FFIConstants.notify.info('Adding global functions...') - self.addGlobalFunctions(CModuleName) - FFIConstants.notify.info('Adding manifests symbols...') - self.addManifestSymbols() - FFIConstants.notify.info('Adding environment types...') - self.addEnvironmentTypes() - - diff --git a/direct/src/ffi/FFIOverload.py b/direct/src/ffi/FFIOverload.py deleted file mode 100644 index 51b85e8787..0000000000 --- a/direct/src/ffi/FFIOverload.py +++ /dev/null @@ -1,472 +0,0 @@ -from direct.showbase.PythonUtil import * -from types import * -import string -import FFIConstants -import FFISpecs -import FFITypes - -""" -Things that are not supported: - - Overloading a function based on an enum being differentiated from an int - - Type names from C++ cannot have __enum__ in their name - - Overloading static and non-static methods with the same name -""" - -AT_not_atomic = 0 -AT_int = 1 -AT_float = 2 -AT_double = 3 -AT_bool = 4 -AT_char = 5 -AT_void = 6 -AT_string = 7 -AT_longlong = 8 - -def cullOverloadedMethods(fullMethodDict): - """ - Find all the entries that have multiple indexes for the same method name - Get rid of all others. - """ - tmpDict = {} - # For each class - for methodName in fullMethodDict.keys(): - methodList = fullMethodDict[methodName] - # See if this method has more than one function index (overloaded) - if (len(methodList) > 1): - tmpDict[methodName] = methodList - # Mark all the method specifications as overloaded - for methodSpec in methodList: - methodSpec.overloaded = 1 - - return tmpDict - - -def getTypeName(classTypeDesc, typeDesc): - """ - Map the interrogate primitive type names to python type names. - We assume that the module using this has imported the types module. - It is valid to pass in None for classTypeDesc if we are not in a class - """ - - typeName = typeDesc.getFullNestedName() - - # Atomic C++ types are type checked against the builtin - # Python types. This code sorts out the mapping - if typeDesc.isAtomic(): - - # Ints, bools, and chars are treated as ints. - # Enums are special and are not atomic, see below - if ((typeDesc.atomicType == AT_int) or - (typeDesc.atomicType == AT_bool) or - (typeDesc.atomicType == AT_char)): - return 'IntType' - - # Floats and doubles are both floats in Python - elif ((typeDesc.atomicType == AT_float) or - (typeDesc.atomicType == AT_double)): - return 'FloatType' - - elif ((typeDesc.atomicType == AT_longlong)): - return 'LongType' - - # Strings are treated as Python strings - elif ((typeDesc.atomicType == AT_string)): - return 'StringType' - - elif (typeDesc.atomicType == AT_void): - # Convert the void type to None type... I guess... - # So far we do not have any code that uses this - return 'NoneType' - - else: - FFIConstants.notify.error("Unknown atomicType: %s" % (typeDesc.atomicType)) - - # If the type is an enum, we really want to treat it like an int - # To handle this, the type will have __enum__ in the name - # Usually it will start the typeName, but some typeNames have the - # surrounding class as part of their name - # like BoundedObject.__enum__BoundingVolumeType - elif (typeName.find('__enum__') >= 0): - return 'IntType' - - # If it was not atomic or enum, it must be a class which is a - # bit trickier because we output different things depending on the - # scoping of the type. - else: - - # classTypeDesc typeDesc fullNestedName Resulting TypeName - # 1 Outer Other Other Other.Other - # 2 Outer Outer Outer Outer - # 3 Outer Inner Outer.Inner Outer.Inner - # 4 Inner Other Other Other.Other - # 5 Inner Outer Outer Outer - # 6 Inner Inner Outer.Inner Outer.Inner - # 7 None Other Other Other.Other - - # CASES 1, 4, and 7 are the only ones that are different from the full - # nested name, returning Other.Other - - returnNestedTypeNames = string.split(typeName, '.') - returnModuleName = returnNestedTypeNames[0] - - if classTypeDesc: - classTypeName = classTypeDesc.getFullNestedName() - classNestedTypeNames = string.split(classTypeName, '.') - # If there is no nesting, return typeName.typeName - if ((not (classTypeDesc.foreignTypeName in returnNestedTypeNames)) and - (not (typeDesc.foreignTypeName in classNestedTypeNames))): - return (returnModuleName + '.' + typeName) - # All other cases, we just need typeName - else: - return typeName - else: - # If you had no class, you need to specify module plus typename - return (returnModuleName + '.' + typeName) - - -def inheritsFrom(type1, type2): - """ - Return true if type1 inherits from type2 - This works by recursively checking parentTypes for type1 - """ - if type1.parentTypes: - if type2 in type1.parentTypes: - return 1 - else: - result = 0 - for type in type1.parentTypes: - result = (result or inheritsFrom(type, type2)) - return result - else: - return 0 - -def getInheritanceLevel(type, checkNested = 1): - if type.__class__ == FFITypes.PyObjectTypeDescriptor: - # A special case: PyObject * is always the most general - # object. Everything is a PyObject. - return -1 - - # If this is a nested type, return the inheritance level of the outer type. - if type.isNested: - # Check the level of your outer class - # pass the checkNested flag as 0 to prevent an infinite loop - # between the parent and child - level = getInheritanceLevel(type.outerType, 0) - else: - level = 0 - - for parentType in type.parentTypes: - # Add 1 because you are one level higher than your parent - level = max(level, 1+getInheritanceLevel(parentType)) - - if checkNested: - for nestedType in type.nestedTypes: - # Do not add 1 to your nested types - level = max(level, getInheritanceLevel(nestedType)) - - return level - -def inheritanceLevelSort(type1, type2): - level1 = getInheritanceLevel(type1) - level2 = getInheritanceLevel(type2) - if (level1 == level2): - # If they are equal in the inheritance, - # sort them alphabetically by their type name - return cmp(type1.foreignTypeName, type2.foreignTypeName) - elif (level1 < level2): - return -1 - elif (level1 > level2): - return 1 - - -def subclass(type1, type2): - """ - Helper funcion used in sorting classes by inheritance - """ - # If the types are the same, return 0 - if type1 == type2: - return 0 - # If you have no args, sort you first - elif (type1 == 0): - return 1 - elif (type2 == 0): - return -1 - # If class1 inherits from class2 return -1 - elif inheritsFrom(type1, type2): - return -1 - # If class2 inherits from class1 return 1 - elif inheritsFrom(type2, type1): - return 1 - else: - # This is the don't care case. We must specify a sorting - # rule just so it is not arbitrary - if (type1.foreignTypeName > type2.foreignTypeName): - return -1 - else: - return 1 - - -class FFIMethodArgumentTreeCollection: - def __init__(self, classTypeDesc, methodSpecList): - self.classTypeDesc = classTypeDesc - self.methodSpecList = methodSpecList - self.methodDict = {} - self.treeDict = {} - - def outputOverloadedMethodHeader(self, file, nesting): - # If one is static, we assume they all are. - # The current system does not support overloading static and non-static - # methods with the same name - # Constructors are not treated as static. They are special because - # they are not really constructors, they are instance methods that fill - # in the this pointer. - # Global functions do not need static versions - if (self.methodSpecList[0].isStatic() and - (not self.methodSpecList[0].isConstructor())): - indent(file, nesting, 'def ' + - self.methodSpecList[0].name + '(*_args):\n') - else: - indent(file, nesting, 'def ' + - self.methodSpecList[0].name + '(self, *_args):\n') - self.methodSpecList[0].outputCFunctionComment(file, nesting+2) - indent(file, nesting+2, 'numArgs = len(_args)\n') - - def outputOverloadedMethodFooter(self, file, nesting): - # If this is a static method, we need to output a static version - # If one is static, we assume they all are. - # The current system does not support overloading static and non-static - # methods with the same name - # Constructors are not treated as static. They are special because - # they are not really constructors, they are instance methods that fill - # in the this pointer. - methodName = self.methodSpecList[0].name - - if (self.methodSpecList[0].isStatic() and - (not self.methodSpecList[0].isConstructor()) and - (not isinstance(self.methodSpecList[0], FFISpecs.GlobalFunctionSpecification))): - self.outputOverloadedStaticFooter(file, nesting) - else: - if self.classTypeDesc: - indent(file, nesting, "FFIExternalObject.funcToMethod("+methodName+','+ self.classTypeDesc.foreignTypeName+ ",'"+methodName+"')\n") - indent(file, nesting, 'del '+methodName+'\n') - indent(file, nesting, ' \n') - - indent(file, nesting+1, '\n') - - def outputOverloadedStaticFooter(self, file, nesting): - # foo = staticmethod(foo) - methodName = self.methodSpecList[0].name - indent(file, nesting, self.classTypeDesc.foreignTypeName + '.' + methodName + ' = staticmethod(' + methodName + ')\n') - indent(file, nesting,'del ' +methodName+' \n\n') - - def setup(self): - for method in self.methodSpecList: - numArgs = len(method.typeDescriptor.thislessArgTypes()) - numArgsList = self.methodDict.setdefault(numArgs, []) - numArgsList.append(method) - for numArgs in self.methodDict.keys(): - methodList = self.methodDict[numArgs] - tree = FFIMethodArgumentTree(self.classTypeDesc, methodList) - treeList = self.treeDict.setdefault(numArgs, []) - treeList.append(tree) - - def generateCode(self, file, nesting): - self.setup() - self.outputOverloadedMethodHeader(file, nesting) - numArgsKeys = self.treeDict.keys() - numArgsKeys.sort() - for i in range(len(numArgsKeys)): - numArgs = numArgsKeys[i] - trees = self.treeDict[numArgs] - for tree in trees: - # If this is the first case, output an if clause - if (i == 0): - indent(file, nesting+2, 'if (numArgs == ' + repr(numArgs) + '):\n') - # If this is a subsequent first case, output an elif clause - else: - indent(file, nesting+2, 'elif (numArgs == ' + repr(numArgs) + '):\n') - tree.setup() - tree.traverse(file, nesting+1, 0) - - # If the overloaded function got all the way through the if statements - # it must have had the wrong number or type of arguments - indent(file, nesting+2, "else:\n") - indent(file, nesting+3, "raise TypeError, 'Invalid number of arguments: ' + repr(numArgs) + ', expected one of: ") - for numArgs in numArgsKeys: - indent(file, 0, (repr(numArgs) + ' ')) - indent(file, 0, "'\n") - - self.outputOverloadedMethodFooter(file, nesting) - - - -class FFIMethodArgumentTree: - """ - Tree is made from nested dictionaries. - The keys are methodNamed. - The values are [tree, methodSpec] - methodSpec may be None at any level - If tree is None, it is a leaf node and methodSpec will be defined - """ - def __init__(self, classTypeDesc, methodSpecList): - self.argSpec = None - self.classTypeDesc = classTypeDesc - self.methodSpecList = methodSpecList - # The actual tree is implemented as nested dictionaries - self.tree = {} - - def setup(self): - for methodSpec in self.methodSpecList: - argTypes = methodSpec.typeDescriptor.thislessArgTypes() - self.fillInArgTypes(argTypes, methodSpec) - - def fillInArgTypes(self, argTypes, methodSpec): - # If the method takes no arguments, we will assign a type index of 0 - if (len(argTypes) == 0): - self.tree[0] = [ - FFIMethodArgumentTree(self.classTypeDesc, - self.methodSpecList), - methodSpec] - - else: - self.argSpec = argTypes[0] - typeDesc = self.argSpec.typeDescriptor.recursiveTypeDescriptor() - - if (len(argTypes) == 1): - # If this is the last parameter, we are a leaf node, so store the - # methodSpec in this dictionary - self.tree[typeDesc] = [None, methodSpec] - else: - if typeDesc in self.tree: - # If there already is a tree here, jump into and pass the - # cdr of the arg list - subTree = self.tree[typeDesc][0] - subTree.fillInArgTypes(argTypes[1:], methodSpec) - else: - # Add a subtree for the rest of the arg list - subTree = FFIMethodArgumentTree(self.classTypeDesc, - self.methodSpecList) - subTree.fillInArgTypes(argTypes[1:], methodSpec) - # This subtree has no method spec - self.tree[typeDesc] = [subTree, None] - - def traverse(self, file, nesting, level): - oneTreeHasArgs = 0 - typeNameList = [] - - # First see if this tree branches at all. If it does not there are - # drastic optimizations we can take because we can simply call the - # bottom-most function. We are not checking the types of all the - # arguments for the sake of type checking, we are simply trying to - # figure out which overloaded function to call. If there is only - # one overloaded function with this number of arguements at this - # level, it must be the one. No need to continue checking all the - # arguments. - branches = 0 - subTree = self - prevTree = subTree - levelCopy = level - - while subTree: - if (len(subTree.tree.keys()) == 0): - # Dead end branch - break - if (len(subTree.tree.keys()) > 1): - # Ok, we branch, it was worth a try though - branches = 1 - break - - prevTree = subTree - # Must only have one subtree, traverse it - subTree = subTree.tree.values()[0][0] - levelCopy += 1 - - # If there were no branches, this is easy - # Just output the function and return - # Note this operates on prevTree because subTree went one too far - if not branches: - methodSpec = prevTree.tree.values()[0][1] - indent(file, nesting+2, 'return ') - methodSpec.outputOverloadedCall(file, prevTree.classTypeDesc, levelCopy) - return - - # Ok, We must have a branch down here somewhere - # Make a copy of the keys so we can sort them in place - sortedKeys = self.tree.keys() - # Sort the keys based on inheritance hierarchy, most specific classes first - sortedKeys.sort(subclass) - - for i in range(len(sortedKeys)): - typeDesc = sortedKeys[i] - # See if this takes no arguments - if (typeDesc == 0): - # Output the function - methodSpec = self.tree[0][1] - indent(file, nesting+2, 'return ') - methodSpec.outputOverloadedCall(file, self.classTypeDesc, 0) - else: - # This is handled at the top of the file now (?) - # Import a file if we need to for this typeDesc - # if ((typeDesc != 0) and - # (not typeDesc.isNested) and - # # Do not put our own module in the import list - # (self.classTypeDesc != typeDesc) and - # # If this is a class (not a primitive), put it on the list - # (typeDesc.__class__ == FFITypes.ClassTypeDescriptor)): - # indent(file, nesting+2, 'import ' + typeDesc.foreignTypeName + '\n') - - # Specify that at least one of these trees had arguments - # so we know to output an else clause - oneTreeHasArgs = 1 - typeName = getTypeName(self.classTypeDesc, typeDesc) - typeNameList.append(typeName) - if typeDesc.__class__ == FFITypes.PyObjectTypeDescriptor: - # A special case: if one of the parameters is - # PyObject *, that means anything is accepted. - condition = '1' - - else: - # Otherwise, we'll check the particular type of - # the object. - condition = '(isinstance(_args[' + repr(level) + '], ' + typeName + '))' - # Legal types for a float parameter include int and long. - if (typeName == 'FloatType'): - condition += (' or (isinstance(_args[' + repr(level) + '], IntType))') - condition += (' or (isinstance(_args[' + repr(level) + '], LongType))') - # Legal types for a long parameter include int. - elif (typeName == 'LongType'): - condition += (' or (isinstance(_args[' + repr(level) + '], IntType))') - # Legal types for an int parameter include long. - elif (typeName == 'IntType'): - condition += (' or (isinstance(_args[' + repr(level) + '], LongType))') - - indent(file, nesting+2, 'if ' + condition + ':\n') - - if (self.tree[typeDesc][0] is not None): - self.tree[typeDesc][0].traverse(file, nesting+1, level+1) - else: - methodSpec = self.tree[typeDesc][1] - indent(file, nesting+3, 'return ') - numArgs = level+1 - methodSpec.outputOverloadedCall(file, self.classTypeDesc, numArgs) - - # Output an else clause if one of the trees had arguments - if oneTreeHasArgs: - indent(file, nesting+2, "raise TypeError, 'Invalid argument " + repr(level) + ", expected one of: ") - for name in typeNameList: - indent(file, 0, ('<' + name + '> ')) - indent(file, 0, "'\n") - - def isSinglePath(self): - if (len(self.tree.keys()) > 1): - # More than one child, return false - return 0 - else: - # Only have one child, see if he only has one child - key = self.tree.keys()[0] - tree = self.tree[key][0] - if tree: - return tree.isSinglePath() - else: - return self.tree[key][1] - diff --git a/direct/src/ffi/FFIRename.py b/direct/src/ffi/FFIRename.py deleted file mode 100644 index 7a637cd930..0000000000 --- a/direct/src/ffi/FFIRename.py +++ /dev/null @@ -1,151 +0,0 @@ -import FFIConstants -from string import * - - -pythonKeywords = ['and','del','for','is','raise','assert','elif','from','lambda','return','break','else','global','not','try','class','except','if','or','while','continue','exec','import','pass','def','finally','in','print'] - - -methodRenameDictionary = { - 'operator==': '__eq__', - 'operator!=': '__ne__', - 'operator<<': '__lshift__', - 'operator>>': '__rshift__', - 'operator<': '__lt__', - 'operator>': '__gt__', - 'operator<=': '__le__', - 'operator>=': '__ge__', - 'operator=': 'assign', - 'operator()': '__call__', - 'operator[]': '__getitem__', - 'operator++': 'increment', - 'operator--': 'decrement', - 'operator^': '__xor__', - 'operator%': '__mod__', - 'operator!': 'logicalNot', - 'operator~': 'bitwiseNot', - 'operator&': '__and__', - 'operator&&': 'logicalAnd', - 'operator|': '__or__', - 'operator||': 'logicalOr', - 'operator+': '__add__', - 'operator-': '__sub__', - 'operator*': '__mul__', - 'operator/': '__div__', - 'operator+=': '__iadd__', - 'operator-=': '__isub__', - 'operator*=': '__imul__', - 'operator/=': '__idiv__', - 'operator,': 'concatenate', - 'operator|=': '__ior__', - 'operator&=': '__iand__', - 'operator^=': '__ixor__', - 'operator~=': 'bitwiseNotEqual', - 'operator->': 'dereference', - 'operator<<=': '__ilshift__', - 'operator>>=': '__irshift__', - 'print': 'Cprint', - 'CInterval.setT': '_priv__cSetT', - } - -classRenameDictionary = { - 'Loader': 'PandaLoader', - 'String': 'CString', - 'LMatrix4f': 'Mat4', - 'LMatrix3f': 'Mat3', - 'LVecBase4f': 'VBase4', - 'LVector4f': 'Vec4', - 'LPoint4f': 'Point4', - 'LVecBase3f': 'VBase3', - 'LVector3f': 'Vec3', - 'LPoint3f': 'Point3', - 'LVecBase2f': 'VBase2', - 'LVector2f': 'Vec2', - 'LPoint2f': 'Point2', - 'LQuaternionf': 'Quat', - 'LMatrix4d': 'Mat4D', - 'LMatrix3d': 'Mat3D', - 'LVecBase4d': 'VBase4D', - 'LVector4d': 'Vec4D', - 'LPoint4d': 'Point4D', - 'LVecBase3d': 'VBase3D', - 'LVector3d': 'Vec3D', - 'LPoint3d': 'Point3D', - 'LVecBase2d': 'VBase2D', - 'LVector2d': 'Vec2D', - 'LPoint2d': 'Point2D', - 'LQuaterniond': 'QuatD', - 'Plane': 'PlaneBase', - 'Planef': 'Plane', - 'Planed': 'PlaneD', - 'Frustum': 'FrustumBase', - 'Frustumf': 'Frustum', - 'Frustumd': 'FrustumD' - } - - -def checkKeyword(cppName): - if cppName in pythonKeywords: - cppName = '_' + cppName - return cppName - -# TODO: Make faster - this thing is horribly slow -def classNameFromCppName(cppName): - # initialize to empty string - className = '' - # These are the characters we want to strip out of the name - badChars = '!@#$%^&*()<>,.-=+~{}? ' - nextCap = 0 - firstChar = 1 - for char in cppName: - if (char in badChars): - continue - elif (char == '_'): - nextCap = 1 - continue - elif (nextCap or firstChar): - className = className + capitalize(char) - nextCap = 0 - firstChar = 0 - else: - className = className + char - if className in classRenameDictionary: - className = classRenameDictionary[className] - - if (className == ''): - FFIConstants.notify.warning('Renaming class: ' + cppName + ' to empty string') - # FFIConstants.notify.debug('Renaming class: ' + cppName + ' to: ' + className) - # Note we do not have to check for keywords because class name are capitalized - return className - -def nonClassNameFromCppName(cppName): - className = classNameFromCppName(cppName) - # Make the first character lowercase - newName = lower(className[0])+className[1:] - # Mangle names that happen to be python keywords so they are not anymore - newName = checkKeyword(newName) - return newName - -def methodNameFromCppName(cppName, className = None): - methodName = '' - badChars = ' ' - nextCap = 0 - for char in cppName: - if (char in badChars): - continue - elif (char == '_'): - nextCap = 1 - continue - elif nextCap: - methodName = methodName + capitalize(char) - nextCap = 0 - else: - methodName = methodName + char - - if className != None: - methodName = methodRenameDictionary.get(className + '.' + methodName, methodName) - methodName = methodRenameDictionary.get(methodName, methodName) - - # Mangle names that happen to be python keywords so they are not anymore - methodName = checkKeyword(methodName) - return methodName - diff --git a/direct/src/ffi/FFISpecs.py b/direct/src/ffi/FFISpecs.py deleted file mode 100644 index 9700a87a03..0000000000 --- a/direct/src/ffi/FFISpecs.py +++ /dev/null @@ -1,586 +0,0 @@ - -import FFIConstants -import FFITypes -import FFIOverload -import string - -from direct.showbase.PythonUtil import * - -augmentedAssignments = ['__iadd__', '__isub__', '__imul__', '__idiv__', - '__ior__', '__iand__', '__ixor__', - '__ilshift__', '__irshift__'] - -class FunctionSpecification: - def __init__(self): - self.name = '' - self.typeDescriptor = None - self.index = 0 - self.overloaded = 0 - # Is this function a constructor - self.constructor = 0 - - def isConstructor(self): - return self.constructor - - def isStatic(self): - for arg in self.typeDescriptor.argumentTypes: - if arg.isThis: - return 0 - # No args were this pointers, must be static - return 1 - - def outputTypeChecking(self, methodClass, args, file, nesting): - """ - Output an assert statement to check the type of each arg in this method - This can be turned off with a command line parameter in generatePythonCode - It is valid to pass in None for methodClass if you are not in any methodClass - """ - if FFIConstants.wantTypeChecking: - for i in range(len(args)): - methodArgSpec = args[i] - typeDesc = methodArgSpec.typeDescriptor.recursiveTypeDescriptor() - typeName = FFIOverload.getTypeName(methodClass, typeDesc) - - # We only do type checking on class types. C++ can do - # type checking on the primitive types, and will do a - # better job anyway. - if typeDesc.__class__ == FFITypes.ClassTypeDescriptor: - # Get the real return type (not derived) - if ((not typeDesc.isNested) and - # Do not put our own module in the import list - (methodClass != typeDesc)): - indent(file, nesting, 'import ' + typeDesc.foreignTypeName + '\n') - indent(file, nesting, 'if not isinstance(' + - methodArgSpec.name + ', ' + typeName + '):\n') - indent(file, nesting + 1, - 'raise TypeError, "Invalid argument %s, expected <%s>"\n' % (i, typeDesc.foreignTypeName)) - - def outputCFunctionComment(self, file, nesting): - """ - Output a docstring to the file describing the C++ call with type info - Also output the C++ comment from interrogate. - """ - if FFIConstants.wantComments: - indent(file, nesting, '"""\n') - - # Output the function prototype - if self.typeDescriptor.prototype: - indent(file, nesting, self.typeDescriptor.prototype + '\n') - - # Output the function comment - if self.typeDescriptor.comment: - # To insert tabs into the comment, replace all newlines with a newline+tabs - comment = string.replace(self.typeDescriptor.comment, - '\n', ('\n' + (' ' * nesting))) - indent(file, nesting, comment) - - indent(file, 0, '\n') - indent(file, nesting, '"""\n') - - def getFinalName(self): - """ - Return the name of the function given that it might be overloaded - If it is overloaded, prepend "overloaded", then append the types of - each argument to make it unique. - - So "getChild(int)" becomes "overloaded_getChild_int(int)" - """ - if self.overloaded: - name = 'private__overloaded_' + self.name - for methodArgSpec in self.typeDescriptor.argumentTypes: - name = name + '_' + methodArgSpec.typeDescriptor.foreignTypeName - return name - else: - return self.name - - def outputOverloadedCall(self, file, classTypeDesc, numArgs): - """ - Write the function call to call this overloaded method - For example: - self.overloaded_setPos_ptrNodePath_float_float_float(*_args) - If it is a class (static) method, call the class method - Class.overloaded_setPos_ptrNodePath_float_float_float(*_args) - - Constructors are not treated as static. They are special because - they are not really constructors, they are instance methods that fill - in the this pointer. - - These do not get indented because they are not the beginning of the line - - If classTypeDesc is None, then this is a global function and should - output code as such - - """ - if classTypeDesc: - if (self.isStatic() and not self.isConstructor()): - if numArgs: - indent(file, 0, classTypeDesc.foreignTypeName + '.' + self.getFinalName() + '(*_args)\n') - else: - indent(file, 0, classTypeDesc.foreignTypeName + '.' + self.getFinalName() + '()\n') - else: - if numArgs: - indent(file, 0, 'self.' + self.getFinalName() + '(*_args)\n') - else: - indent(file, 0, 'self.' + self.getFinalName() + '()\n') - else: - if numArgs: - indent(file, 0, self.getFinalName() + '(*_args)\n') - else: - indent(file, 0, self.getFinalName() + '()\n') - - -class GlobalFunctionSpecification(FunctionSpecification): - def __init__(self): - FunctionSpecification.__init__(self) - - # Use generateCode when creating a global (non-class) function - def generateGlobalCode(self, file): - self.outputHeader(file) - self.outputBody(file) - self.outputFooter(file) - - # Use generateCode when creating a global (non-class) function - def generateGlobalDowncastCode(self, file): - self.outputHeader(file) - self.outputBody(file, 0, 0) # no downcast, no type checking - self.outputFooter(file) - - # Use generateMethodCode when creating a global->class function - def generateMethodCode(self, methodClass, file, nesting): - self.outputMethodHeader(methodClass, file, nesting) - self.outputMethodBody(methodClass, file, nesting) - self.outputMethodFooter(methodClass, file, nesting) - - ################################################## - ## Global Function Code Generation - ################################################## - def outputHeader(self, file): - argTypes = self.typeDescriptor.argumentTypes - indent(file, 0, 'def ' + self.getFinalName() + '(') - for i in range(len(argTypes)): - file.write(argTypes[i].name) - if (i < (len(argTypes)-1)): - file.write(', ') - file.write('):\n') - - def outputBody(self, file, needsDowncast=1, typeChecking=1): - # The method body will look something like - # returnValue = PandaGlobal.method(arg) - # returnObject = NodePath() - # returnObject.this = returnValue - # returnObject.userManagesMemory = 1 (optional) - # return returnObject - self.outputCFunctionComment(file, 1) - argTypes = self.typeDescriptor.argumentTypes - # The global downcast functions do not need type checking, and - # in fact have a problem where they assert you are downcasting - # from the immediate superclass when in fact you may be downcasting - # from a class way up the chain as long as their is single - # inheritance up to it - if typeChecking: - self.outputTypeChecking(None, argTypes, file, 1) - indent(file, 1, 'returnValue = ' + self.typeDescriptor.moduleName - + '.' + self.typeDescriptor.wrapperName + '(') - for i in range(len(argTypes)): - file.write(argTypes[i].passName()) - if (i < (len(argTypes)-1)): - file.write(', ') - file.write(')\n') - #indent(file, 1, 'if returnValue is None:\n') - #indent(file, 2, 'return None\n') - returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor() - returnType.generateReturnValueWrapper(None, file, - self.typeDescriptor.userManagesMemory, - needsDowncast, 1) - - def outputFooter(self, file): - indent(file, 0, '\n') - - ################################################## - ## Class Method Code Generation - ################################################## - def outputMethodHeader(self, methodClass, file, nesting): - argTypes = self.typeDescriptor.argumentTypes - indent(file, nesting, 'def ' + self.getFinalName() + '(') - for i in range(len(argTypes)): - # Instead of the first argument, put self - if (i == 0): - file.write('self') - else: - file.write(argTypes[i].name) - if (i < (len(argTypes)-1)): - file.write(', ') - file.write('):\n') - - def outputMethodBody(self, methodClass, file, nesting): - # The method body will look something like - # returnValue = PandaGlobal.method(self.this, arg) - # returnValue.userManagesMemory = 1 (optional) - # return returnValue - self.outputCFunctionComment(file, nesting+2) - argTypes = self.typeDescriptor.argumentTypes - self.outputTypeChecking(methodClass, argTypes[1:], file, nesting+2) - indent(file, nesting+2, 'returnValue = ' + self.typeDescriptor.moduleName - + '.' + self.typeDescriptor.wrapperName + '(') - for i in range(len(argTypes)): - # Instead of the first argument, put self.this - if (i == 0): - file.write('self.this') - else: - file.write(argTypes[i].passName()) - if (i < (len(argTypes)-1)): - file.write(', ') - file.write(')\n') - indent(file, 1, 'if returnValue is None:\n') - indent(file, 2, 'return None\n') - - returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor() - returnType.generateReturnValueWrapper(methodClass, file, - self.typeDescriptor.userManagesMemory, - 1, nesting+2) - - def outputMethodFooter(self, methodClass, file, nesting): - indent(file, nesting+1, '\n') - - -class MethodSpecification(FunctionSpecification): - def __init__(self): - FunctionSpecification.__init__(self) - - def generateConstructorCode(self, methodClass, file, nesting): - self.outputConstructorHeader(methodClass, file, nesting) - self.outputConstructorBody(methodClass, file, nesting) - self.outputConstructorFooter(methodClass, file, nesting) - - def generateDestructorCode(self, methodClass, file, nesting): - self.outputDestructorHeader(methodClass, file, nesting) - self.outputDestructorBody(methodClass, file, nesting) - self.outputDestructorFooter(methodClass, file, nesting) - - def generateMethodCode(self, methodClass, file, nesting): - self.outputMethodHeader(methodClass, file, nesting) - self.outputMethodBody(methodClass, file, nesting) - self.outputMethodFooter(methodClass, file, nesting) - - def generateStaticCode(self, methodClass, file, nesting): - self.outputStaticHeader(methodClass, file, nesting) - self.outputStaticBody(methodClass, file, nesting) - self.outputStaticFooter(methodClass, file, nesting) - - def generateInheritedMethodCode(self, methodClass, parentList, file, nesting, needsDowncast): - self.outputInheritedMethodHeader(methodClass, parentList, file, nesting, needsDowncast) - self.outputInheritedMethodBody(methodClass, parentList, file, nesting, needsDowncast) - self.outputInheritedMethodFooter(methodClass, parentList, file, nesting, needsDowncast) - - def generateUpcastMethodCode(self, methodClass, file, nesting): - # The upcast method code is just like regular code, but the - # return value wrapper does not have downcasting instructions - self.outputMethodHeader(methodClass, file, nesting) - self.outputMethodBody(methodClass, file, nesting, 0) # no downcast - self.outputMethodFooter(methodClass, file, nesting) - - ################################################## - ## Constructor Code Generation - ################################################## - def outputConstructorHeader(self, methodClass, file, nesting): - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - indent(file, nesting+1, 'def ' + self.getFinalName() + '(self') - if (len(thislessArgTypes) > 0): - file.write(', ') - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].name) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write('):\n') - self.outputCFunctionComment(file, nesting+2) - - - def outputConstructorBody(self, methodClass, file, nesting): - # The method body will look something like - # self.this = panda.Class_constructor(arg) - # self.userManagesMemory = 1 (optional) - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - self.outputTypeChecking(methodClass, thislessArgTypes, file, nesting+2) - indent(file, nesting+2, 'self.this = ' + self.typeDescriptor.moduleName + '.' - + self.typeDescriptor.wrapperName + '(') - # Do not pass self into the constructor - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].passName()) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write(')\n') - indent(file, nesting+2, 'assert self.this != 0\n') - if self.typeDescriptor.userManagesMemory: - indent(file, nesting+2, 'self.userManagesMemory = 1\n') - - def outputConstructorFooter(self, methodClass, file, nesting): - indent(file, nesting+1, '\n') - - - ################################################## - ## Destructor Code Generation - ################################################## - def outputDestructorHeader(self, methodClass, file, nesting): - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - indent(file, nesting+1, 'def ' + self.getFinalName() + '(self') - if (len(thislessArgTypes) > 0): - file.write(', ') - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].name) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write('):\n') - self.outputCFunctionComment(file, nesting+2) - - def outputDestructorBody(self, methodClass, file, nesting): - # The method body will look something like - # panda.Class_destructor(self.this) - functionName = (self.typeDescriptor.moduleName + '.' - + self.typeDescriptor.wrapperName) - # Make sure the module and function have not been deleted first - # This only happens during shutdown - indent(file, nesting+2, 'if (' + self.typeDescriptor.moduleName + ' and ' + - functionName + '):\n') - indent(file, nesting+3, functionName + '(self.this)\n') - - def outputDestructorFooter(self, methodClass, file, nesting): - indent(file, nesting+1, '\n') - - ################################################## - ## Method Code Generation - ################################################## - def outputMethodHeader(self, methodClass, file, nesting): - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - indent(file, nesting, 'def ' + self.getFinalName() + '(self') - if (len(thislessArgTypes) > 0): - file.write(', ') - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].name) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write('):\n') - - def outputMethodBody(self, methodClass, file, nesting, needsDowncast=1): - # The method body will look something like - # returnValue = panda.Class_method(self.this, arg) - # returnValue.userManagesMemory = 1 (optional) - # return returnValue - self.outputCFunctionComment(file, nesting+2) - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - self.outputTypeChecking(methodClass, thislessArgTypes, file, nesting+2) - indent(file, nesting+2, 'returnValue = ' + self.typeDescriptor.moduleName + '.' - + self.typeDescriptor.wrapperName + '(') - file.write('self.this') - if (len(thislessArgTypes) > 0): - file.write(', ') - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].passName()) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write(')\n') - # If this is an augmented assignment operator like +=, we have special rules - # In this case we simply call the C++ function, make sure we got the same - # return value back, then return self. Otherwise if you let it go through the - # normal system, it actually deletes the old Python object causing the C++ memory - # to be deleted then returns a new Python shadow object with the old C++ pointer... BAD! - if self.getFinalName() in augmentedAssignments: - indent(file, nesting+2, 'assert self.this == returnValue\n') - indent(file, nesting+2, 'return self\n') - else: - returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor() - returnType.generateReturnValueWrapper(methodClass, file, - self.typeDescriptor.userManagesMemory, - needsDowncast, nesting+2) - - def outputMethodFooter(self, methodClass, file, nesting): - indent(file, nesting, 'FFIExternalObject.funcToMethod(' +self.getFinalName()+ ',' + methodClass.foreignTypeName + ",'" +self.getFinalName() +"')\n") - indent(file, nesting, 'del ' + self.getFinalName()+' \n') - indent(file, nesting+1,'\n') - #indent(file, nesting, methodClass.foreignTypeName +'.'+ self.getFinalName() + ' = staticmethod(' + self.getFinalName() + ')\n') - #indent(file, nesting,'del ' + self.getFinalName()+' \n') - #indent(file, nesting+1, '\n') - indent(file, nesting+1, '\n') - - - ################################################## - ## Static Method Code Generation - ################################################## - def outputStaticHeader(self, methodClass, file, nesting): - argTypes = self.typeDescriptor.argumentTypes - indent(file, nesting, 'def ' + self.getFinalName() + '(') - for i in range(len(argTypes)): - file.write(argTypes[i].name) - if (i < (len(argTypes)-1)): - file.write(', ') - file.write('):\n') - - - def outputStaticBody(self, methodClass, file, nesting): - # The method body will look something like - # returnValue = panda.class_method(self.this, arg) - # returnValue.userManagesMemory = 1 (optional) - # return returnValue - self.outputCFunctionComment(file, nesting+2) - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - self.outputTypeChecking(methodClass, thislessArgTypes, file, nesting+2) - indent(file, nesting+2, 'returnValue = ' + self.typeDescriptor.moduleName + '.' - + self.typeDescriptor.wrapperName + '(') - # Static methods do not take the this parameter - if (len(thislessArgTypes) > 0): - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].passName()) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write(')\n') - returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor() - returnType.generateReturnValueWrapper(methodClass, file, - self.typeDescriptor.userManagesMemory, - 1, nesting+2) - - def outputStaticFooter(self, methodClass, file, nesting): - indent(file, nesting, methodClass.foreignTypeName +'.'+ self.getFinalName() + ' = staticmethod(' + self.getFinalName() + ')\n') - indent(file, nesting,'del ' + self.getFinalName()+' \n') - indent(file, nesting+1, '\n') - - ################################################## - ## Upcast Method Code Generation - ################################################## - def outputInheritedMethodHeader(self, methodClass, parentList, file, nesting, needsDowncast): - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - indent(file, nesting, 'def ' + self.getFinalName() + '(self') - if (len(thislessArgTypes) > 0): - file.write(', ') - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].name) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write('):\n') - - def outputInheritedMethodBody(self, methodClass, parentList, file, nesting, needsDowncast): - # The method body will look something like - # upcastSelf = self.upcastToParentClass() - # returnValue = libpanda.method(upcastSelf.this, arg) - # returnValue.userManagesMemory = 1 (optional) - # return returnValue - self.outputCFunctionComment(file, nesting+2) - argTypes = self.typeDescriptor.argumentTypes - thislessArgTypes = self.typeDescriptor.thislessArgTypes() - self.outputTypeChecking(methodClass, thislessArgTypes, file, nesting+2) - indent(file, nesting+2, 'upcastSelf = self\n') - for i in range(len(parentList)): - # Only output the upcast call if that parent class defines it - parentClass = parentList[i] - methodName = 'upcastTo' + parentClass.foreignTypeName - if (i != 0): - childClass = parentList[i-1] - if childClass.hasMethodNamed(methodName): - indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n') - else: - indent(file, nesting+2, '# upcastSelf = upcastSelf.' + methodName + '()\n') - else: - if methodClass.hasMethodNamed(methodName): - indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n') - else: - indent(file, nesting+2, '# upcastSelf = upcastSelf.' + methodName + '()\n') - - indent(file, nesting+2, 'returnValue = ' + self.typeDescriptor.moduleName - + '.' + self.typeDescriptor.wrapperName + '(upcastSelf.this') - if (len(thislessArgTypes) > 0): - file.write(', ') - for i in range(len(thislessArgTypes)): - file.write(thislessArgTypes[i].passName()) - if (i < (len(thislessArgTypes)-1)): - file.write(', ') - file.write(')\n') - returnType = self.typeDescriptor.returnType.recursiveTypeDescriptor() - # Generate the return value code with no downcast instructions - returnType.generateReturnValueWrapper(methodClass, file, - self.typeDescriptor.userManagesMemory, - needsDowncast, nesting+2) - - def outputInheritedMethodFooter(self, methodClass, parentList, file, nesting, needsDowncast): - indent(file, nesting, 'FFIExternalObject.funcToMethod(' +self.getFinalName()+ ',' + methodClass.foreignTypeName + ",'" +self.getFinalName() +"')\n") - indent(file, nesting, 'del ' + self.getFinalName()+' \n') - indent(file, nesting+1,'\n') - - -class GlobalValueSpecification: - def __init__(self): - self.name = '' - # We really do not need the descriptor for the value, just - # the getter and setter - # self.typeDescriptor = None - # To be filled in with a GlobalFunctionSpecification - self.getter = None - # To be filled in with a GlobalFunctionSpecification - self.setter = None - - def generateGlobalCode(self, file): - indent(file, 0, '# Global value: ' + self.name + '\n') - if self.getter: - self.getter.generateGlobalCode(file) - if self.setter: - self.setter.generateGlobalCode(file) - indent(file, 0, '\n') - - -# Manifest symbols -class ManifestSpecification: - def __init__(self): - self.name = '' - - # We are not currently using the type descriptor - self.typeDescriptor = None - - # To be filled in with a GlobalFunctionSpecification - # if this manifest has one - self.getter = None - - # Manifests that have int values have their int value defined - # instead of having to call a getter (because there are so many of them) - self.intValue = None - - # The string definition of this manifest - self.definition = None - - def generateGlobalCode(self, file): - # Note, if the manifest has no value and no getter we do not output anything - # even though they may be defined in the C++ sense. Without any values - # they are pretty useless in Python - - # If it has an int value, just output that instead of bothering - # with a getter - if (self.intValue != None): - indent(file, 0, '# Manifest: ' + self.name + '\n') - indent(file, 0, (self.name + ' = ' + repr(self.intValue) + '\n')) - indent(file, 0, '\n') - - elif self.definition: - indent(file, 0, ('# Manifest: ' + self.name + ' definition: ' + - self.definition + '\n')) - # Out put the getter - if self.getter: - self.getter.generateGlobalCode(file) - indent(file, 0, '\n') - - -class MethodArgumentSpecification: - def __init__(self): - self.name = '' - self.typeDescriptor = None - # By default it is not the this pointer - self.isThis = 0 - - def passName(self): - if (self.typeDescriptor.recursiveTypeDescriptor().__class__ == \ - FFITypes.ClassTypeDescriptor): - return self.name + '.this' - else: - return self.name diff --git a/direct/src/ffi/FFITypes.py b/direct/src/ffi/FFITypes.py deleted file mode 100644 index da20acb499..0000000000 --- a/direct/src/ffi/FFITypes.py +++ /dev/null @@ -1,1026 +0,0 @@ - -""" -Type Descriptors - -Type Descriptors are used for code generation of C++ types. They -know everything they need to know about themselves to generate code. -They get constructed by and stored in FFIInterrogateDatabase. - -""" - -import os -import string -import FFIConstants -import FFIOverload - - -from direct.showbase.PythonUtil import * - -TypedObjectDescriptor = None - - -class BaseTypeDescriptor: - """ - A type descriptor contains everything you need to know about a C++ function, - class, or primitive. - """ - def __init__(self): - # The pythonified name from C++ - self.foreignTypeName = '' - - # The typeIndex for lookup in the typeIndexMap - self.typeIndex = 0 - - # The C++ prototype for this type - self.prototype = '' - - # The C++ comment for this type - self.comment = '' - - # Is this a nested type? - self.isNested = 0 - - # If we are nested, this is the typeDescriptor we are nested in - self.outerType = None - - # The type descriptors for the types we derive from - self.parentTypes = [] - - # atomicType may be one of the following - # AT_not_atomic = 0 - # AT_int = 1 - # AT_float = 2 - # AT_double = 3 - # AT_bool = 4 - # AT_char = 5 - # AT_void = 6 - # AT_string = 7 - # AT_longlong = 8 - # By default this type is not atomic - self.atomicType = 0 - - # What C module did this type come from? - self.moduleName = '' - - def isAtomic(self): - return (self.atomicType != 0) - - def generateGlobalCode(self, dir, extensionsDir): - # By default generate no code - pass - def recursiveTypeDescriptor(self): - """ - Attempt to get to the bottom of a type descriptor - Since we are at the bottom when we get here, just return self - """ - return self - def recordOverloadedMethods(self): - # By default do nothing - pass - def generateReturnValueWrapper(self, classTypeDesc, file, userManagesMemory, - needsDowncast, nesting): - # By default do nothing - pass - def getFullNestedName(self): - """ - If this type is nested, it will return the fully specified name - For example: OuterClass.InnerClass.ReallyInnerClass - """ - if self.isNested: - return self.outerType.getFullNestedName() + '.' + self.foreignTypeName - else: - return self.foreignTypeName - - -class PrimitiveTypeDescriptor(BaseTypeDescriptor): - """ - Primitive type descriptors include int, float, char, etc. - These get mapped to Python types like IntType, FloatType, StringType - """ - def __init__(self): - BaseTypeDescriptor.__init__(self) - - def generateReturnValueWrapper(self, classTypeDesc, file, userManagesMemory, - needsDowncast, nesting): - """ - Write code to the file that will return a primitive to the caller. - Pretty simple since there is no extra work needed here - """ - indent(file, nesting, 'return returnValue\n') - -class PyObjectTypeDescriptor(BaseTypeDescriptor): - """ - This is a special type descriptor for a PyObject * parameter, - which means a natural Python object of any type, to be passed - through without molestation. - """ - def __init__(self): - BaseTypeDescriptor.__init__(self) - - def generateReturnValueWrapper(self, classTypeDesc, file, userManagesMemory, - needsDowncast, nesting): - indent(file, nesting, 'return returnValue\n') - - - -class EnumTypeDescriptor(PrimitiveTypeDescriptor): - """ - EnumTypeDescriptors represent enums in C++ - """ - def __init__(self): - PrimitiveTypeDescriptor.__init__(self) - # A dictionary of name, value pairs for this enum - self.values = {} - # The enum name is different than the foreignTypeName because - # we record the foreignTypeName as enum (int) - self.enumName = '' - # Specify that we do not have any parent or nested types to make - # the sorting based on inheritance happy. Essentially, we do not - # inherit from anybody or have any nested types - self.parentTypes = [] - self.nestedTypes = [] - - def generateGlobalCode(self, dir, extensionsDir): - """ - Generate enum code for this type. - """ - fileName = self.enumName + '.py' - file = open(os.path.join(dir, fileName), 'w') - indent(file, 0, FFIConstants.generatedHeader) - self.generateCode(file, 0) - - def generateCode(self, file, nesting): - indent(file, nesting, '# CMODULE [' + self.moduleName + ']\n') - self.outputComment(file, nesting) - self.outputValues(file, nesting) - - - def outputComment(self, file, nesting): - indent(file, nesting, '\n') - indent(file, nesting, '##################################################\n') - indent(file, nesting, '# Enum ' + self.enumName + '\n') - indent(file, nesting, '##################################################\n') - indent(file, nesting, '\n') - - def outputValues(self, file, nesting): - """ - For each entry in the dictionary, output a line for name, value pairs - Example: - off = 0 - on = 1 - """ - for key in self.values.keys(): - indent(file, nesting, key + ' = ' + repr(self.values[key]) + '\n') - - -class DerivedTypeDescriptor(BaseTypeDescriptor): - """ - DerivedTypeDescriptor is a wrapper around a primitive or class type - For instance const, or pointer to. - """ - def __init__(self): - BaseTypeDescriptor.__init__(self) - self.typeDescriptor = None - - def recursiveTypeDescriptor(self): - """ - Attempt to get to the bottom of a type descriptor by - recursively unravelling typeDescriptors until you get to - a type that is not derived (primitive or class) in which - case the base class will just return self. - """ - return self.typeDescriptor.recursiveTypeDescriptor() - -class PointerTypeDescriptor(DerivedTypeDescriptor): - """ - Points to another type descriptor - """ - def __init__(self): - DerivedTypeDescriptor.__init__(self) - -class ConstTypeDescriptor(DerivedTypeDescriptor): - """ - Const version of another type descriptor - """ - def __init__(self): - DerivedTypeDescriptor.__init__(self) - -class ClassTypeDescriptor(BaseTypeDescriptor): - """ - This describes a C++ class. It holds lists of all its methods too. - It can also generate Python shadow class code for itself. - """ - def __init__(self): - BaseTypeDescriptor.__init__(self) - - # Methods interrogate told us were constructors - self.constructors = [] - - # A method interrogate told us is the destructor - self.destructor = None - - # Methods interrogate told us were instance methods - # Note: the methods without the this pointer get moved into staticMethods - self.instanceMethods = [] - - # Methods interrogate told us were upcast methods - self.upcastMethods = [] - - # Methods interrogate told us were downcast methods - self.downcastMethods = [] - - # Instance methods that had no this pointer are moved into here - self.staticMethods = [] - - # These are dictionaries used to temporarily hold methods for - # overloading while generating code - self.overloadedClassMethods = {} - self.overloadedInstanceMethods = {} - - # Nested typeDescriptors inside this class - self.nestedTypes = [] - - - def getExtensionModuleName(self): - """ - Return a filename for the extensions for this class - Example: NodePath extensions would be found in NodePath-extensions.py - """ - return self.foreignTypeName + '-extensions.py' - - def getCModulesRecursively(self, parent): - # Now look at all the methods that we might inherit if we are at - # a multiple inheritance node and get their C modules - for parentType in parent.parentTypes: - if (not (parentType.moduleName in self.CModules)): - self.CModules.append(parentType.moduleName) - for method in parentType.instanceMethods: - if (not (method.typeDescriptor.moduleName in self.CModules)): - self.CModules.append(method.typeDescriptor.moduleName) - for method in parentType.upcastMethods: - if (not (method.typeDescriptor.moduleName in self.CModules)): - self.CModules.append(method.typeDescriptor.moduleName) - self.getCModulesRecursively(parentType) - - def getCModules(self): - """ - Return a list of all the C modules this class references - """ - try: - # Prevent from doing the work twice - # if CModules is already defined, just return it - return self.CModules - except: - # Otherwise, it must be our first time through, do the real work - # Start with our own moduleName - self.CModules = [self.moduleName] - for method in (self.constructors + [self.destructor] + self.instanceMethods - + self.upcastMethods + self.downcastMethods + self.staticMethods): - if method: - if (not (method.typeDescriptor.moduleName in self.CModules)): - self.CModules.append(method.typeDescriptor.moduleName) - self.getCModulesRecursively(self) - - return self.CModules - - - def getReturnTypeModules(self): - """ - Return a list of all the other shadow class modules this - class references. - Be careful about nested types - """ - # Return type modules are cached once they are calculated so we - # do not have to calculate them again - try: - return self.returnTypeModules - except: - moduleList = [] - upcastMethods = [] - if (len(self.parentTypes) >= 2): - for parentType in self.parentTypes: - for method in parentType.instanceMethods: - upcastMethods.append(method) - for method in parentType.upcastMethods: - upcastMethods.append(method) - for method in (self.constructors + [self.destructor] + self.instanceMethods - + self.upcastMethods + self.downcastMethods - + self.staticMethods + upcastMethods): - if method: - # Get the real return type (not derived) - returnType = method.typeDescriptor.returnType.recursiveTypeDescriptor() - if (not returnType.isNested): - returnTypeName = returnType.foreignTypeName - # Do not put our own module in the import list - if ((returnTypeName != self.foreignTypeName) and - # Do not put modules already in the list (like a set) - (not (returnTypeName in moduleList))): - # If this is a class (not a primitive), put it on the list - if (returnType.__class__ == ClassTypeDescriptor): - moduleList.append(returnTypeName) - # Now look at all the arguments - argTypes = method.typeDescriptor.argumentTypes - for argType in argTypes: - # Get the real return type (not derived) - argType = argType.typeDescriptor.recursiveTypeDescriptor() - if (not argType.isNested): - argTypeName = argType.foreignTypeName - # Do not put our own module in the import list - if ((argTypeName != self.foreignTypeName) and - # Do not put modules already in the list (like a set) - (not (argTypeName in moduleList))): - # If this is a class (not a primitive), put it on the list - if (argType.__class__ == ClassTypeDescriptor): - moduleList.append(argTypeName) - self.returnTypeModules = moduleList - return self.returnTypeModules - - - def recordClassMethod(self, methodSpec): - """ - Record all class methods in a 2 level dictionary so we can go - through them and see which are overloaded - { className: {methodName: [methodSpec, methodSpec, methodSpec]}} - """ - methodList = self.overloadedClassMethods.setdefault(methodSpec.name, []) - methodList.append(methodSpec) - - - def recordInstanceMethod(self, methodSpec): - """ - Record all instance methods in a 2 level dictionary so we can go - through them and see which are overloaded - { className: {methodName: [methodSpec, methodSpec, methodSpec]}} - """ - methodList = self.overloadedInstanceMethods.setdefault(methodSpec.name, []) - methodList.append(methodSpec) - - - def cullOverloadedMethods(self): - """ - Find all the entries that have multiple indexes for the same method name - Get rid of all others. Do this for class methods and instance methods - """ - self.overloadedClassMethods = FFIOverload.cullOverloadedMethods(self.overloadedClassMethods) - self.overloadedInstanceMethods = FFIOverload.cullOverloadedMethods(self.overloadedInstanceMethods) - - - def filterOutStaticMethods(self): - """ - Run through the list of instance methods and filter out the - ones that are static class methods. We can tell this because they - do not have a this pointer in their arg list. Those methods that - are static are then placed in a new staticMethods list and the ones - that are left are stored back in the instanceMethods list. We are - avoiding modifying the instanceMethods list in place while traversing it. - Do not check upcast or downcast methods because we know they are not static. - """ - newInstanceMethods = [] - for method in self.instanceMethods: - if method.isStatic(): - self.staticMethods.append(method) - else: - newInstanceMethods.append(method) - self.instanceMethods = newInstanceMethods - - - def recordOverloadedMethods(self): - """ - Record all the methods in dictionaries based on method name - so we can see if they are overloaded - """ - classMethods = self.constructors + self.staticMethods - if self.destructor: - classMethods = classMethods + [self.destructor] - for method in classMethods: - self.recordClassMethod(method) - - instanceMethods = (self.instanceMethods + self.upcastMethods + self.downcastMethods) - for method in instanceMethods: - self.recordInstanceMethod(method) - - - def hasMethodNamed(self, methodName): - for method in (self.constructors + [self.destructor] + self.instanceMethods - + self.upcastMethods + self.downcastMethods + self.staticMethods): - if (method and (method.name == methodName)): - return 1 - return 0 - - - def copyParentMethods(self, file, nesting): - """ - At multiple inheritance nodes, copy all the parent methods into - this class and call them after upcasting us to that class - """ - if (len(self.parentTypes) >= 2 or \ - (len(self.parentTypes) == 1 and self.hasMethodNamed('upcastTo' + self.parentTypes[0].foreignTypeName))): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Upcast inherited instance method wrappers #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for parentType in self.parentTypes: - parentList = [parentType] - self.copyParentMethodsRecursively(parentList, file, nesting) - - - def inheritsMethodNamed(self, parentList, methodName): - """ - returns true if the named method is a method on this class, or - on any parent class except the last one in the list. - """ - if self.hasMethodNamed(methodName): - return 1 - for pi in range(len(parentList) - 1): - if parentList[pi].hasMethodNamed(methodName): - return 1 - return 0 - - def copyParentMethodsRecursively(self, parentList, file, nesting): - """ - Copy all the parents instance methods - Do not copy functions if this class already has a function with that name - We need to recurse up the hierarchy copying all our parents nodes all - the way up the tree stopping either at the top, or at another MI node - that has already copied his parent's methods in - Note: Do not copy the downcast methods - """ - parent = parentList[-1] - if (len(parent.parentTypes) > 0): - recurse = 1 - else: - recurse = 0 - - for method in parent.instanceMethods: - if not self.inheritsMethodNamed(parentList, method.name): - # with downcast for all instance methods that are not themselves upcasts - method.generateInheritedMethodCode(self, parentList, file, nesting, 1) - - # Also duplicate the overloaded method dispatch functions, if - # we don't already have any matching methods by this name. - for methodSpecList in parent.overloadedInstanceMethods.values(): - if not self.inheritsMethodNamed(parentList, methodSpecList[0].name): - treeColl = FFIOverload.FFIMethodArgumentTreeCollection(self, methodSpecList) - treeColl.generateCode(file, nesting) - - # Copy all the parents upcast methods so we transitively pick them up - for method in parent.upcastMethods: - if not self.inheritsMethodNamed(parentList, method.name): - # no downcast for all instance methods that are themselves upcasts - # that would cause an infinite loop - method.generateInheritedMethodCode(self, parentList, file, nesting, 0) - - # Now recurse up the hierarchy until we get to a node that is itself - # a multiple inheritance node and stop there because he will have already - # copied all his parent functions in - if recurse: - for parentType in parent.parentTypes: - newParentList = parentList[:] - newParentList.append(parentType) - self.copyParentMethodsRecursively(newParentList, file, nesting) - - - def generateOverloadedMethods(self, file, nesting): - """ - Generate code for all the overloaded methods of this class - """ - if (len(self.overloadedClassMethods.values()) or - len(self.overloadedInstanceMethods.values())): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Overloaded methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - # Overload all the class and instance methods - for methodSpecList in (self.overloadedClassMethods.values() + - self.overloadedInstanceMethods.values()): - treeColl = FFIOverload.FFIMethodArgumentTreeCollection(self, methodSpecList) - treeColl.generateCode(file, nesting) - - - def generateGlobalCode(self, dir, extensionsDir): - """ - Generate shadow class code for this type. - We make our own file form our foreignTypeName and put it in the dir - passed in. - """ - fileName = self.foreignTypeName + '.py' - fileName1 = self.foreignTypeName + '1.py' - file = open(os.path.join(dir, fileName), 'w') - indent(file, 0, FFIConstants.generatedHeader) - self.outputBaseImports(file) - self.generateCode1(file, 0, extensionsDir) - file.close() - - file = open(os.path.join(dir, fileName1), 'w') - indent(file, 0, FFIConstants.generatedHeader) - #self.outputBaseImports(file) - self.generateCode2(file, 0, extensionsDir, self.foreignTypeName) - file.close() - - - # Copy in any extensions we may have - #self.copyExtensions(extensionsDir, file, 0) - #self.outputClassFooter(file) - file.close() - - - def generateCode(self, file, nesting, extensionsDir=None): - - self.recordOverloadedMethods() - self.cullOverloadedMethods() - self.outputImports(file, nesting) - self.outputClassHeader(file, nesting) - self.outputClassComment(file, nesting) - self.outputClassCModules(file, nesting) - - self.outputNestedTypes(file, nesting) - - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Constructors #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - self.outputBaseConstructor(file, nesting) - if self.constructors: - for method in self.constructors: - method.generateConstructorCode(self, file, nesting) - else: - self.outputEmptyConstructor(file, nesting) - - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Destructor #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - self.outputBaseDestructor(file, nesting) - if self.destructor: - self.destructor.generateDestructorCode(self, file, nesting) - # If you have no destructor, inherit one - - ########################## - ## Extension methods moved up locally - if extensionsDir: - self.copyExtensions(extensionsDir, file, 0) - - ########################## - ## import return types - returnTypeModules = self.getReturnTypeModules() - if len(returnTypeModules): - for moduleName in returnTypeModules: - indent(file, nesting, 'import ' + moduleName + '\n') - - ################################ - - - if len(self.staticMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Static Methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.staticMethods: - method.generateStaticCode(self, file, nesting) - - if len(self.instanceMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Instance methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.instanceMethods: - method.generateMethodCode(self, file, nesting) - - if len(self.upcastMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Upcast methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.upcastMethods: - method.generateUpcastMethodCode(self, file, nesting) - - if len(self.downcastMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Downcast methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.downcastMethods: - method.generateDowncastMethodCode(self, file, nesting) - - # Copy in all our parent nodes (only does work if we are an MI node) - self.copyParentMethods(file, nesting) - - self.generateOverloadedMethods(file, nesting) - - def generateCode1(self, file, nesting, extensionsDir=None): - - self.recordOverloadedMethods() - self.cullOverloadedMethods() - self.outputImports(file, nesting) - self.outputClassHeader(file, nesting) - self.outputClassComment(file, nesting) - self.outputClassCModules(file, nesting) - - self.outputNestedTypes(file, nesting) - - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Constructors #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - self.outputBaseConstructor(file, nesting) - if self.constructors: - for method in self.constructors: - method.generateConstructorCode(self, file, nesting) - else: - self.outputEmptyConstructor(file, nesting) - - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Destructor #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - self.outputBaseDestructor(file, nesting) - if self.destructor: - self.destructor.generateDestructorCode(self, file, nesting) - # If you have no destructor, inherit one - ########################## - ## Extension methods moved up locally - if extensionsDir: - self.copyExtensions(extensionsDir, file, 0) - - - - def generateCode2(self, file, nesting, extensionsDir, file1module): - - indent(file, nesting, 'from ' + file1module + ' import *\n') - - ########################## - ## import return types - returnTypeModules = self.getReturnTypeModules() - if len(returnTypeModules): - for moduleName in returnTypeModules: - indent(file, nesting, 'import ' + moduleName + '\n') - - ################################ - - - if len(self.staticMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Static Methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.staticMethods: - method.generateStaticCode(self, file, nesting) - - if len(self.instanceMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Instance methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.instanceMethods: - method.generateMethodCode(self, file, nesting) - - if len(self.upcastMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Upcast methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.upcastMethods: - method.generateUpcastMethodCode(self, file, nesting) - - if len(self.downcastMethods): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Downcast methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - for method in self.downcastMethods: - method.generateDowncastMethodCode(self, file, nesting) - - # Copy in all our parent nodes (only does work if we are an MI node) - self.copyParentMethods(file, nesting) - - self.generateOverloadedMethods(file, nesting) - - - def outputNestedTypes(self, file, nesting): - if (len(self.nestedTypes) > 0): - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Nested Types #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - # Output code in this same file for all our nested types - for nestedType in self.nestedTypes: - nestedType.generateCode(file, nesting+1) - - - def copyExtensions(self, extensionsDir, file, nesting): - """ - Copy in the extension file for this class if one exists - If you want to extend a C++ file, create a file in the extensions directory and - this will append that extension file to the generated code file. - """ - extensionFileName = self.getExtensionModuleName() - extensionFilePath = os.path.join(extensionsDir, extensionFileName) - if os.path.exists(extensionFilePath): - FFIConstants.notify.info('Found extensions for class: ' + self.foreignTypeName) - extensionFile = open(extensionFilePath) - indent(file, nesting+1, '\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '# Extension methods #\n') - indent(file, nesting+1, '##################################################\n') - indent(file, nesting+1, '\n') - # Copy the contents of the extensions file to the class file verbatim - indent(file, nesting, extensionFile.read()) - else: - # No extensions for this class - pass - - - def outputBaseImports(self, file): - indent(file, 0, '# CMODULE [' + self.moduleName + ']\n') - # Everybody imports types for type checking - indent(file, 0, 'from types import IntType, LongType, FloatType, NoneType, StringType\n') - indent(file, 0, 'from direct.ffi import FFIExternalObject\n') - indent(file, 0, '\n') - - indent(file, 0, '# Import all the C modules this class uses\n') - for moduleName in self.getCModules(): - if moduleName: - indent(file, 0, 'import ' + moduleName + '\n') - indent(file, 0, 'import ' + moduleName + 'Downcasts\n') - indent(file, 0, '\n') - indent(file, 0, 'from direct.ffi import FFIExternalObject\n') - - - - def outputImportsRecursively(self, parent, file, nesting): - # Not sure why we need to import parent types... - #for parentType in parent.parentTypes: - # self.outputImportsRecursively(parentType, file, nesting) - - parentTypeName = parent.foreignTypeName - fullNestedName = parent.getFullNestedName() - if (fullNestedName != parentTypeName): - nestedChain = fullNestedName.split(".") - moduleName = nestedChain[0] - indent(file, nesting, 'import ' + moduleName + '\n') - else: - indent(file, nesting, 'import ' + parent.foreignTypeName + '\n') - - #returnTypeModules = parent.getReturnTypeModules() - #if len(returnTypeModules): - # for moduleName in returnTypeModules: - # indent(file, nesting, 'import ' + moduleName + '\n') - - - def outputImports(self, file, nesting): - """ - Generate code that imports the modules we need for this class - """ - indent(file, nesting, '# Import everybody we inherit from\n') - indent(file, nesting, '# and all the shadow class modules this class uses\n') - - # Output all of our return types - #returnTypeModules = self.getReturnTypeModules() - #if len(returnTypeModules): - # for moduleName in returnTypeModules: - # indent(file, nesting, 'import ' + moduleName + '\n') - - for parentType in self.parentTypes: - self.outputImportsRecursively(parentType, file, nesting) - indent(file, nesting, '\n') - - - - def outputClassComment(self, file, nesting): - """ - Output the class comment to the file - """ - if FFIConstants.wantComments: - if self.comment: - indent(file, nesting+1, ('"' * 3) + '\n') - # To insert tabs into the comment, replace all newlines with a newline+tabs - comment = string.replace(self.comment, - '\n', ('\n' + (' ' * (nesting+1)))) - indent(file, nesting+1, comment) - file.write('\n') - indent(file, nesting+1, ('"' * 3) + '\n\n') - - def outputClassHeader(self, file, nesting): - """ - Output the class definition to the file - """ - - if (self.foreignTypeName == ''): - FFIConstants.notify.warning('Class with no name') - - -# # If this is the toplevel, we need to delay the generation of this -# # class to avoid circular imports, so put the entire class in a function -# # that we will call later -# if (nesting==0): -# indent(file, nesting, '# Delay the definition of this class until all the imports are done\n') -# indent(file, nesting, '# Make sure we only define this class once\n') -# indent(file, nesting, 'classDefined = 0\n') -# indent(file, nesting, 'def generateClass_' + self.foreignTypeName + '():\n') -# indent(file, nesting, ' if classDefined: return\n') -# indent(file, nesting, ' global classDefined\n') -# indent(file, nesting, ' classDefined = 1\n') -# # Start the class definition indented a space to account for the function -# indent(file, nesting, ' class ' + self.foreignTypeName) -# else: -# # Start the class definition -# indent(file, nesting, 'class ' + self.foreignTypeName) - - indent(file, nesting, 'class ' + self.foreignTypeName) - - # Everybody inherits from FFIExternalObject - file.write('(') - # Also inherit from all of your parentTypes - for i in range(len(self.parentTypes)): - parentTypeName = self.parentTypes[i].foreignTypeName - moduleName = parentTypeName - # assuming the type "Node" is stored in module "Node.py" - # and we have done an "import Node", we need to then - # inherit from Node.Node - # Actually it is trickier than this. If we import from a - # nested class, we need to inherit from something like: - # parentClassModule.parentClass.nestedClass - fullNestedName = self.parentTypes[i].getFullNestedName() - if (fullNestedName != parentTypeName): - nestedChain = fullNestedName.split(".") - moduleName = nestedChain[0] - parentTypeName = fullNestedName - file.write(moduleName + '.' + parentTypeName) - file.write(', ') - file.write('FFIExternalObject.FFIExternalObject):\n') - - - def outputClassCModules(self, file, nesting): - # Store the class C modules for the class so they do not - # get garbage collected before we do - # TODO: this did not appear to work so I'm taking it out - #indent(file, nesting+1, '__CModules__ = [') - #for moduleName in self.getCModules(): - # file.write(moduleName + ',') - #file.write(']\n') - - # Store the downcast function modules so the FFIExternalObject - # can index into them to find the downcast functions - indent(file, nesting+1, '__CModuleDowncasts__ = (') - for moduleName in self.getCModules(): - file.write(moduleName + 'Downcasts,') - file.write(')\n') - - - def outputClassFooter(self, file): - #indent(file, 0, " # When this class gets defined, put it in this module's namespace\n") - #indent(file, 0, " globals()['" + self.foreignTypeName + "'] = " + self.foreignTypeName + '\n') - pass - - - def outputBaseConstructor(self, file, nesting): - """ - Output the __init__ constructor for this class. - There is special login if you pass in None to the constructor, you - will not get an actual C object with memory, you will just get the - shadow class shell object. This is useful for functions that want - to return this type that already have a this pointer and just need - to construct a shadow object to contain it. - """ - - indent(file, nesting+1, 'def __init__(self, *_args):\n') - indent(file, nesting+2, '# Do Not Initialize the super class it is inlined\n') - #indent(file, nesting+2, '# Initialize the super class\n') - #indent(file, nesting+2, 'FFIExternalObject.FFIExternalObject.__init__(self)\n') - ## this is not the right way to do this any more.. - indent(file, nesting+2, '# If you want an empty shadow object use the FFIInstance(class) function\n') - #indent(file, nesting+2, 'if ((len(_args) == 1) and (_args[0] == None)):\n') - #indent(file, nesting+3, 'return\n') - #indent(file, nesting+2, '# Otherwise, call the C constructor\n') - indent(file, nesting+2, 'self.constructor(*_args)\n') - indent(file, nesting, '\n') - - - - - def outputEmptyConstructor(self, file, nesting): - """ - If there is no C++ constructor, we output code for a runtime error - You really do not want to create a class with a null this pointer - """ - indent(file, nesting+1, 'def constructor(self):\n') - indent(file, nesting+2, "raise RuntimeError, 'No C++ constructor defined for class: ' + self.__class__.__name__\n") - - - def outputBaseDestructor(self, file, nesting): - """ - This destructor overwrites the builtin Python destructor - using the __del__ method. This will get called whenever a - Python object is garbage collected. We are going to overwrite - it with special cleanup for Panda. - """ - if self.destructor: - indent(file, nesting+1, 'def __del__(self):\n') - - # Reference counting is now handled in the C++ code - # indent(file, nesting+2, 'if isinstance(self, ReferenceCount):\n') - # indent(file, nesting+3, 'self.unref()\n') - # indent(file, nesting+3, 'if (self.getCount() == 0):\n') - # indent(file, nesting+4, 'self.destructor()\n') - - # If the scripting language owns the memory for this object, - # we need to call the C++ destructor when Python frees the - # shadow object, but only if the userManagesMemory flag is set. - # Also make sure we are not destructing a null pointer - indent(file, nesting+2, 'if (self.userManagesMemory and (self.this != 0)):\n') - self.destructor.outputDestructorBody(self, file, nesting+1) - indent(file, nesting, '\n') - - #indent(file, nesting+3, 'self.destructor()\n') - - - def outputEmptyDestructor(self, file, nesting): - """ - If there is no C++ destructor, we just output this - empty one instead - """ - indent(file, nesting+1, 'def destructor(self):\n') - indent(file, nesting+2, "raise RuntimeError, 'No C++ destructor defined for class: ' + self.__class__.__name__\n") - - - def generateReturnValueWrapper(self, classTypeDesc, file, userManagesMemory, - needsDowncast, nesting): - """ - Generate code that creates a shadow object of this type - then sets the this pointer and returns the object. We call the - class destructor with None as the only parameter to get an - empty shadow object. - """ - #if classTypeDesc != self: - # indent(file, nesting, 'import ' + self.foreignTypeName + '\n') - indent(file, nesting, 'if returnValue == 0: return None\n') - # Do not put Class.Class if this file is the file that defines Class - # Also check for nested classes. They do not need the module name either - typeName = FFIOverload.getTypeName(classTypeDesc, self) - #file.write(typeName + '(None)\n') - ### inline the old constructers - - #indent(file, nesting, 'returnObject = ') - #file.write('FFIExternalObject.FFIInstance('+ typeName + ', returnValue,'+str(userManagesMemory)+')\n') - #indent(file, nesting, 'returnObject.this = 0\n') - #indent(file, nesting, 'returnObject.userManagesMemory = 0\n'); - - ## - #indent(file, nesting, 'returnObject.this = returnValue\n') - # Zero this pointers get returned as the Python None object - #indent(file, nesting, 'if (returnObject.this == 0): return None\n') - #if userManagesMemory: - # indent(file, nesting, 'returnObject.userManagesMemory = 1\n') - #else: - # indent(file, nesting, 'returnObject.userManagesMemory = 0\n') - - if needsDowncast: - #indent(file, nesting, 'returnObject = FFIExternalObject.FFIInstance('+ typeName + ', returnValue,'+str(userManagesMemory)+')\n') - if (FFIOverload.inheritsFrom(self, TypedObjectDescriptor) or - self == TypedObjectDescriptor): - #indent(file, nesting, 'return returnObject.setPointer()\n') - indent(file, nesting, 'return FFIExternalObject.FFIInstance('+ typeName + ', returnValue,'+str(userManagesMemory)+').setPointer()\n') - else: - indent(file, nesting,'return FFIExternalObject.FFIInstance('+ typeName + ', returnValue,'+str(userManagesMemory)+')\n') - #indent(file, nesting, 'return returnObject\n') - else: - indent(file, nesting,'return FFIExternalObject.FFIInstance('+ typeName + ', returnValue,'+str(userManagesMemory)+')\n') - #indent(file, nesting, 'return returnObject\n') - - - -class FunctionTypeDescriptor(BaseTypeDescriptor): - """ - A C++ function type. It knows its returnType, arguments, etc. - """ - def __init__(self): - BaseTypeDescriptor.__init__(self) - self.returnType = None - self.argumentTypes = [] - self.userManagesMemory = 0 - self.isVirtual = 0 - self.moduleName = '' - self.wrapperName = '' - self.returnValueDestructor = None - def thislessArgTypes(self): - """ - It is often useful to know the list of arguments excluding the - this parameter (if there was one) - """ - return filter(lambda type: (not type.isThis), self.argumentTypes) - diff --git a/direct/src/ffi/Sources.pp b/direct/src/ffi/Sources.pp deleted file mode 100644 index e0625858f0..0000000000 --- a/direct/src/ffi/Sources.pp +++ /dev/null @@ -1,12 +0,0 @@ -#define INSTALL_SCRIPTS genPyCode.py -#define INSTALL_MODULES panda3d.py - -// If we're on Win32 without Cygwin, install the genPyCode.bat file; -// for all other platforms, install the genPyCode sh script. -#if $[MAKE_BAT_SCRIPTS] - #define INSTALL_SCRIPTS $[INSTALL_SCRIPTS] genPyCode.bat -#else - #define INSTALL_SCRIPTS $[INSTALL_SCRIPTS] genPyCode -#endif - -#include $[THISDIRPREFIX]genPyCode.pp diff --git a/direct/src/ffi/__init__.py b/direct/src/ffi/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/ffi/genPyCode.pp b/direct/src/ffi/genPyCode.pp deleted file mode 100644 index e9eeb52340..0000000000 --- a/direct/src/ffi/genPyCode.pp +++ /dev/null @@ -1,220 +0,0 @@ -// -// genPyCode.pp -// -// This file defines the script to auto-generate a sensible genPyCode -// for the user based on the Config.pp variables in effect at the time -// ppremake is run. The generated script will know which directories -// to generate its output to, as well as which source files to read -// for the input. -// - -#define install_dir $[$[upcase $[PACKAGE]]_INSTALL] -#define install_lib_dir $[or $[INSTALL_LIB_DIR],$[install_dir]/lib] -#define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin] -#define install_igatedb_dir $[or $[INSTALL_IGATEDB_DIR],$[install_dir]/etc] - -#define python $[PYTHON_COMMAND] -#if $[USE_DEBUG_PYTHON] - #define python $[PYTHON_DEBUG_COMMAND] -#endif - -// If we're on Win32 without Cygwin, generate a genPyCode.bat file; -// for all other platforms, generate a genPyCode sh script. Although -// it's true that on non-Win32 platforms we don't need the script -// (since the python file itself could be made directly executable), -// we generate the script anyway to be consistent with Win32, which -// does require it. - -#if $[MAKE_BAT_SCRIPTS] - -#output genPyCode.bat -@echo off -rem #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -rem ################################# DO NOT EDIT ########################### - -$[python] -u $[osfilename $[install_bin_dir]/genPyCode.py] %1 %2 %3 %4 %5 %6 %7 %8 %9 -#end genPyCode.bat - -#else // MAKE_BAT_SCRIPTS - -#output genPyCode $[if $[>= $[PPREMAKE_VERSION],1.21],binary] -#! /bin/sh -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - -#if $[CTPROJS] -# This script was generated while the user was using the ctattach -# tools. That had better still be the case. -#if $[WINDOWS_PLATFORM] -$[python] -u `cygpath -w $DIRECT/built/bin/genPyCode.py` "$@" -#else -$[python] -u $DIRECT/built/bin/genPyCode.py "$@" -#endif -#else -$[python] -u '$[osfilename $[install_bin_dir]/genPyCode.py]' "$@" -#endif -#end genPyCode - -#endif // MAKE_BAT_SCRIPTS - -#output genPyCode.py -#! /usr/bin/env $[python] -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - -import os -import sys -import glob - -#if $[CTPROJS] -# This script was generated while the user was using the ctattach -# tools. That had better still be the case. - -def deCygwinify(path): - if os.name in ['nt'] and path[0] == '/': - # On Windows, we may need to convert from a Cygwin-style path - # to a native Windows path. - - # Check for a case like /i/ or /p/: this converts - # to i:/ or p:/. - - dirs = path.split('/') - if len(dirs) > 2 and len(dirs[1]) == 1: - path = '%s:\%s' % (dirs[1], '\\'.join(dirs[2:])) - - else: - # Otherwise, prepend $PANDA_ROOT and flip the slashes. - pandaRoot = os.getenv('PANDA_ROOT') - if pandaRoot: - path = os.path.normpath(pandaRoot + path) - - return path - -ctprojs = os.getenv('CTPROJS') -if not ctprojs: - print "You are no longer attached to any trees!" - sys.exit(1) - -directDir = os.getenv('DIRECT') -if not directDir: - print "You are not attached to DIRECT!" - sys.exit(1) - -directDir = deCygwinify(directDir) - -# Make sure that direct.showbase.FindCtaPaths gets imported. -parent, base = os.path.split(directDir) - -if parent not in sys.path: - sys.path.append(parent) - -import direct.showbase.FindCtaPaths - -#endif // CTPROJS - -from direct.ffi import DoGenPyCode -from direct.ffi import FFIConstants - -# The following parameters were baked in to this script at the time -# ppremake was run in Direct. -#define extensions_name $[if $[PYTHON_NATIVE],extensions_native,extensions] - -#if $[>= $[OPTIMIZE], 4] -FFIConstants.wantComments = 0 -FFIConstants.wantTypeChecking = 0 -#endif - -DoGenPyCode.interrogateLib = r'libdtoolconfig' -DoGenPyCode.codeLibs = r'$[GENPYCODE_LIBS]'.split() -DoGenPyCode.native = $[if $[PYTHON_NATIVE],1,0] - -#if $[not $[CTPROJS]] -// Since the user is not using ctattach, bake these variables in too. -DoGenPyCode.directDir = r'$[osfilename $[TOPDIR]]' -DoGenPyCode.outputCodeDir = r'$[osfilename $[install_lib_dir]/pandac]' -DoGenPyCode.outputHTMLDir = r'$[osfilename $[install_data_dir]/doc]' -DoGenPyCode.extensionsDir = r'$[osfilename $[TOPDIR]/src/$[extensions_name]]' -DoGenPyCode.etcPath = [r'$[osfilename $[install_igatedb_dir]]'] -DoGenPyCode.pythonSourcePath = r'$[osfilename $[TOPDIR]]' - -#else -# The user is expected to be using ctattach, so don't bake in the -# following four; these instead come from the dynamic settings set by -# ctattach. - -DoGenPyCode.directDir = directDir -DoGenPyCode.outputCodeDir = os.path.join(directDir, 'built', 'lib', 'pandac') -DoGenPyCode.outputHTMLDir = os.path.join(directDir, 'built', 'shared', 'doc') -DoGenPyCode.extensionsDir = os.path.join(directDir, 'src', '$[extensions_name]') -DoGenPyCode.etcPath = [] -DoGenPyCode.pythonSourcePath = [] - -#if $[CTA_GENERIC_GENPYCODE] -# Look for additional packages (other than the basic three) -# that the user might be dynamically attached to. -packages = [] -for proj in ctprojs.split(): - projName = proj.split(':')[0] - packages.append(projName) -packages.reverse() - -try: - from direct.extensions_native.extension_native_helpers import Dtool_PreloadDLL -except ImportError: - print "Unable to import Dtool_PreloadDLL, not trying generic libraries." -else: - for package in packages: - packageDir = os.getenv(package) - if packageDir: - packageDir = deCygwinify(packageDir) - etcDir = os.path.join(packageDir, 'etc') - try: - inFiles = glob.glob(os.path.join(etcDir, 'built', '*.in')) - except: - inFiles = [] - if inFiles: - DoGenPyCode.etcPath.append(etcDir) - - if package not in ['WINTOOLS', 'DTOOL', 'DIRECT', 'PANDA']: - DoGenPyCode.pythonSourcePath.append(packageDir) - - libDir = os.path.join(packageDir, 'built', 'lib') - try: - files = os.listdir(libDir) - except: - files = [] - for file in files: - if os.path.isfile(os.path.join(libDir, file)): - basename, ext = os.path.splitext(file) - - # Try to import the library. If we can import it, - # instrument it. - try: - Dtool_PreloadDLL(basename) - # __import__(basename, globals(), locals()) - isModule = 1 - except: - isModule = 0 - - # - # RHH.... hack OPT2 .. py debug libraries... - # - if not isModule: - # debug py library magin naming in windows.. - basename = basename.replace('_d','') - try: - Dtool_PreloadDLL(basename) - # __import__(basename, globals(), locals()) - isModule = 1 - except: - isModule = 0 - - if isModule: - if basename not in DoGenPyCode.codeLibs: - DoGenPyCode.codeLibs.append(basename) -#endif // CTA_GENERIC_GENPYCODE -#endif // CTPROJS - -DoGenPyCode.run() - -#end genPyCode.py diff --git a/direct/src/ffi/jGenPyCode.py b/direct/src/ffi/jGenPyCode.py deleted file mode 100755 index 3c8ee77bee..0000000000 --- a/direct/src/ffi/jGenPyCode.py +++ /dev/null @@ -1,96 +0,0 @@ -############################################################## -# -# This module should be invoked by a shell-script that says: -# -# python -c "import direct.ffi.jGenPyCode" -# -# Before invoking python, the shell-script may need to set -# these environment variables, to make sure that everything -# can be located appropriately. -# -# PYTHONPATH -# PATH -# LD_LIBRARY_PATH -# -############################################################## - -import sys, os - -############################################################## -# -# Locate the 'direct' tree and the 'pandac' tree. -# -############################################################## - -DIRECT=None -PANDAC=None - -for dir in sys.path: - if (DIRECT is None): - if (dir != "") and os.path.exists(os.path.join(dir,"direct")): - DIRECT=os.path.join(dir,"direct") - if (PANDAC is None): - if (dir != "") and (os.path.exists(os.path.join(dir,"pandac"))): - PANDAC=os.path.join(dir,"pandac") - -if (DIRECT is None): - sys.exit("Could not locate the 'direct' python modules") -if (PANDAC is None): - sys.exit("Could not locate the 'pandac' python modules") - -############################################################## -# -# Locate direct/src/extensions. -# -# It could be inside the direct tree. It may be underneath -# a 'src' subdirectory. Or, the direct tree may actually be -# a stub that points to the source tree. -# -############################################################## - -EXTENSIONS=None - -if (EXTENSIONS is None): - if os.path.isdir(os.path.join(DIRECT,"src","extensions_native")): - EXTENSIONS=os.path.join(DIRECT,"src","extensions_native") - -if (EXTENSIONS is None): - if os.path.isdir(os.path.join(DIRECT,"extensions_native")): - EXTENSIONS=os.path.join(DIRECT,"extensions_native") - -if (EXTENSIONS is None): - if os.path.isdir(os.path.join(DIRECT,"..","..","direct","src","extensions_native")): - EXTENSIONS=os.path.join(DIRECT,"..","..","direct","src","extensions_native") - -if (EXTENSIONS is None): - sys.exit("Could not locate direct/src/extensions_native") - -############################################################## -# -# Call genpycode with default paths. -# -############################################################## - -from direct.ffi import DoGenPyCode -DoGenPyCode.outputCodeDir = PANDAC -DoGenPyCode.outputHTMLDir = os.path.join(PANDAC,"..","doc") -DoGenPyCode.directDir = DIRECT -DoGenPyCode.extensionsDir = EXTENSIONS -DoGenPyCode.interrogateLib = r'libdtoolconfig' -DoGenPyCode.codeLibs = ['libpandaexpress','libpanda','libpandaphysics','libpandafx','libp3direct','libpandaskel','libpandaegg','libpandaode'] -DoGenPyCode.etcPath = [os.path.join(PANDAC,"input")] -DoGenPyCode.pythonSourcePath = [DIRECT] -DoGenPyCode.native = 1 - -#print "outputDir = ", DoGenPyCode.outputDir -#print "directDir = ", DoGenPyCode.directDir -#print "extensionsDir = ", DoGenPyCode.extensionsDir -#print "interrogateLib = ", DoGenPyCode.interrogateLib -#print "codeLibs = ", DoGenPyCode.codeLibs -#print "etcPath = ", DoGenPyCode.etcPath -#print "native = ", DoGenPyCode.native - -DoGenPyCode.run() - -os._exit(0) - diff --git a/direct/src/ffi/panda3d.py b/direct/src/ffi/panda3d.py deleted file mode 100644 index 301f766104..0000000000 --- a/direct/src/ffi/panda3d.py +++ /dev/null @@ -1,275 +0,0 @@ -#!/bin/true -import os, sys, imp - -panda3d_modules = { - "core" :("libpandaexpress", "libpanda"), - "dtoolconfig" : "libp3dtoolconfig", - "physics" : "libpandaphysics", - "fx" : "libpandafx", - "direct" : "libp3direct", - "egg" : "libpandaegg", - "ode" : "libpandaode", - "bullet" : "libpandabullet", - "vision" : "libp3vision", - "physx" : "libpandaphysx", - "ai" : "libpandaai", - "awesomium" : "libp3awesomium", - "speedtree" : "libpandaspeedtree", - "rocket" :("_rocketcore", "_rocketcontrols", "libp3rocket"), - "vrpn" : "libp3vrpn", -} - -class panda3d_import_manager: - # Important: store a reference to the sys and os modules, as - # all references in the global namespace will be reset. - os = os - sys = sys - imp = imp - - __libraries__ = {} - - # Figure out the dll suffix (commonly, _d for windows debug builds), - # and the dll extension. - dll_suffix = '' - dll_exts = ('.pyd', '.so') - if sys.platform == "win32": - dll_exts = ('.pyd', '.dll') - - # We allow the caller to preload dll_suffix into the sys module. - dll_suffix = getattr(sys, 'dll_suffix', None) - - if dll_suffix is None: - # Otherwise, we try to determine it from the executable name: - # python_d.exe implies _d across the board. - dll_suffix = '' - if sys.executable.endswith('_d.exe'): - dll_suffix = '_d' - - # On OSX, extension modules can be loaded from either .so or .dylib. - if sys.platform == "darwin": - dll_exts = ('.pyd', '.so', '.dylib') - - prepared = False - - @classmethod - def __prepare(cls): - # This method only needs to be called once. - if cls.prepared: - return - cls.prepared = True - - # First, we must ensure that the library path is - # modified to locate all of the dynamic libraries. - target = None - filename = "libpandaexpress" + cls.dll_suffix - for dir in cls.sys.path + [cls.sys.prefix]: - lib = cls.os.path.join(dir, filename) - for dll_ext in cls.dll_exts: - if (cls.os.path.exists(lib + dll_ext)): - target = dir - break - if target == None: - raise ImportError("Cannot find %s" % (filename)) - target = cls.os.path.abspath(target) - - # And add that directory to the system library path. - if cls.sys.platform == "win32": - cls.__prepend_to_path("PATH", target) - else: - cls.__prepend_to_path("LD_LIBRARY_PATH", target) - - if cls.sys.platform == "darwin": - cls.__prepend_to_path("DYLD_LIBRARY_PATH", target) - - @classmethod - def __prepend_to_path(cls, varname, target): - """ Prepends the given directory to the - specified search path environment variable. """ - - # Get the current value - if varname in cls.os.environ: - path = cls.os.environ[varname].strip(cls.os.pathsep) - else: - path = "" - - # Prepend our value, if it's not already the first thing - if len(path) == 0: - cls.os.environ[varname] = target - elif not path.startswith(target): - cls.os.environ[varname] = target + cls.os.pathsep + path - - @classmethod - def libimport(cls, name): - """ Imports and returns the specified library name. The - provided library name has to be without dll extension. """ - - if name in cls.__libraries__: - return cls.__libraries__[name] - - if not cls.prepared: cls.__prepare() - - # Try to import it normally first. - try: - return __import__(name) - except ImportError: - _, err, _ = cls.sys.exc_info() - if str(err) != "No module named " + name and \ - str(err) != "No module named '%s'" % name: - raise - - # Hm, importing normally didn't work. Let's try imp.load_dynamic. - # But first, locate the desired library. - target = None - filename = name + cls.dll_suffix - for dir in cls.sys.path + [cls.sys.prefix]: - lib = cls.os.path.join(dir, filename) - for dll_ext in cls.dll_exts: - if (cls.os.path.exists(lib + dll_ext)): - target = lib + dll_ext - break - if target: - # Once we find the first match, break all the way - # out--don't keep looking for a second match. - break - if target == None: - message = "DLL loader cannot find %s." % name - raise ImportError(message) - target = cls.os.path.abspath(target) - - # Now import the file explicitly. - lib = cls.imp.load_dynamic(name, target) - cls.__libraries__[name] = lib - return lib - -class panda3d_submodule(type(sys)): - """ Represents a submodule of 'panda3d' that represents a dynamic - library. This dynamic library is loaded when something is accessed - from the module. """ - - __manager__ = panda3d_import_manager - - def __init__(self, name, library): - type(sys).__init__(self, "panda3d." + name) - self.__library__ = library - self.__libraries__ = [self.__library__] - - def __load__(self): - """ Forces the library to be loaded right now. """ - self.__manager__.libimport(self.__library__) - - def __getattr__(self, name): - mod = self.__manager__.libimport(self.__library__) - if name == "__all__": - everything = [] - for obj in mod.__dict__.keys(): - if not obj.startswith("__"): - everything.append(obj) - self.__all__ = everything - return everything - elif name == "__library__": - return self.__library__ - elif name == "__libraries__": - return self.__libraries__ - elif name in mod.__dict__.keys(): - value = mod.__dict__[name] - setattr(self, name, value) - return value - - # Not found? Raise the error that Python would normally raise. - raise AttributeError("'module' object has no attribute '%s'" % name) - -class panda3d_multisubmodule(type(sys)): - """ Represents a submodule of 'panda3d' that represents multiple - dynamic libraries. These are loaded when something is accessed - from the module. """ - - __manager__ = panda3d_import_manager - - def __init__(self, name, libraries): - type(sys).__init__(self, "panda3d." + name) - self.__libraries__ = libraries - - def __load__(self): - """ Forces the libraries to be loaded right now. """ - err = [] - for lib in self.__libraries__: - try: - self.__manager__.libimport(lib) - except ImportError: - _, msg, _ = self.__manager__.sys.exc_info() - err.append(str(msg).rstrip('.')) - if len(err) > 0: - raise ImportError(', '.join(err)) - - def __getattr__(self, name): - if name == "__all__": - everything = [] - for lib in self.__libraries__: - for obj in self.__manager__.libimport(lib).__dict__: - if not obj.startswith("__"): - everything.append(obj) - self.__all__ = everything - return everything - elif name == "__libraries__": - return self.__libraries__ - - for lib in self.__libraries__: - mod = self.__manager__.libimport(lib) - if name in mod.__dict__: - value = mod.__dict__[name] - setattr(self, name, value) - return value - - # Not found? Raise the error that Python would normally raise. - raise AttributeError("'module' object has no attribute '%s'" % name) - -class panda3d_module(type(sys)): - """ Represents the main 'panda3d' module. """ - - __file__ = __file__ - modules = panda3d_modules - __manager__ = panda3d_import_manager - - def __load__(self): - """ Force all the libraries to be loaded right now. """ - err = [] - for module in self.modules: - try: - self.__manager__.sys.modules["panda3d.%s" % module].__load__() - except ImportError: - _, msg, _ = self.__manager__.sys.exc_info() - err.append(str(msg).rstrip('.')) - if len(err) > 0: - raise ImportError(', '.join(err)) - - - def __getattr__(self, name): - if name == "__all__": - self.__all__ = name - return self.modules.keys() - elif name == "__file__": - return self.__file__ - elif name in self.modules: - value = self.__manager__.sys.modules["panda3d.%s" % name] - setattr(self, name, value) - return value - - # Not found? Raise the error that Python would normally raise. - raise AttributeError("'module' object has no attribute '%s'" % name) - -# Create the fake module objects and insert them into sys.modules. -this = panda3d_module("panda3d") - -# Loop through the module dictionary, create a fake -# module for each of them, and insert them into -# sys.modules and into the 'panda3d' fake module. -for mod, lib in panda3d_modules.items(): - if isinstance(lib, tuple): - module = panda3d_multisubmodule(mod, lib) - else: - module = panda3d_submodule(mod, lib) - sys.modules["panda3d." + mod] = module - this.__dict__[mod] = module - -# Important: this must be the last thing in this file -sys.modules["panda3d"] = this diff --git a/direct/src/filter/Sources.pp b/direct/src/filter/Sources.pp deleted file mode 100644 index 0b4c7990cc..0000000000 --- a/direct/src/filter/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ - -#defer install_data_dir $[install_lib_dir]/$[PACKAGE]/$[DIRNAME] -#define INSTALL_DATA filter-bloomi.sha filter-bloomx.sha filter-bloomy.sha filter-blurx.sha filter-blury.sha filter-copy.sha filter-down4.sha - diff --git a/direct/src/fsm/Sources.pp b/direct/src/fsm/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/gui/Sources.pp b/direct/src/gui/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/http/Sources.pp b/direct/src/http/Sources.pp deleted file mode 100644 index 9b19488778..0000000000 --- a/direct/src/http/Sources.pp +++ /dev/null @@ -1,38 +0,0 @@ -#define BUILD_DIRECTORY $[WANT_NATIVE_NET] -#define USE_PACKAGES native_net - -#define OTHER_LIBS \ - p3express:c pandaexpress:m \ - p3pstatclient:c p3pipeline:c panda:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c p3pandabase:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3linmath:c p3putil:c - -#define LOCAL_LIBS \ - p3directbase -#define C++FLAGS -DWITHIN_PANDA -#define UNIX_SYS_LIBS m -#define USE_PACKAGES python - -#begin lib_target - #define TARGET p3http - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - - #define SOURCES \ - config_http.h \ - http_connection.h \ - http_request.h - - - #define INCLUDED_SOURCES \ - config_http.cxx \ - http_connection.cxx \ - parsedhttprequest.cxx \ - http_request.cxx - - - #define IGATESCAN all -#end lib_target diff --git a/direct/src/interval/Interval.py b/direct/src/interval/Interval.py index 0ce940a261..1a677254cc 100644 --- a/direct/src/interval/Interval.py +++ b/direct/src/interval/Interval.py @@ -7,6 +7,8 @@ from direct.showbase.DirectObject import DirectObject from direct.task.Task import Task, TaskManager from panda3d.core import * from panda3d.direct import * +from direct.extensions_native import CInterval_extensions +from direct.extensions_native import NodePath_extensions import math class Interval(DirectObject): diff --git a/direct/src/interval/Sources.pp b/direct/src/interval/Sources.pp deleted file mode 100644 index 39bafa8d9b..0000000000 --- a/direct/src/interval/Sources.pp +++ /dev/null @@ -1,54 +0,0 @@ -#begin lib_target - #define TARGET p3interval - #define LOCAL_LIBS \ - p3directbase - #define OTHER_LIBS \ - p3downloader:c p3linmath:c \ - p3chan:c p3event:c p3gobj:c p3pnmimage:c p3mathutil:c \ - p3pgraph:c p3putil:c panda:m p3express:c pandaexpress:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3pandabase:c p3prc:c p3gsgbase:c p3pstatclient:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3pipeline:c - - #define SOURCES \ - config_interval.cxx config_interval.h \ - cInterval.cxx cInterval.I cInterval.h \ - cIntervalManager.cxx cIntervalManager.I cIntervalManager.h \ - cConstraintInterval.cxx cConstraintInterval.I cConstraintInterval.h \ - cConstrainTransformInterval.cxx cConstrainTransformInterval.I cConstrainTransformInterval.h \ - cConstrainPosInterval.cxx cConstrainPosInterval.I cConstrainPosInterval.h \ - cConstrainHprInterval.cxx cConstrainHprInterval.I cConstrainHprInterval.h \ - cConstrainPosHprInterval.cxx cConstrainPosHprInterval.I cConstrainPosHprInterval.h \ - cLerpInterval.cxx cLerpInterval.I cLerpInterval.h \ - cLerpNodePathInterval.cxx cLerpNodePathInterval.I cLerpNodePathInterval.h \ - cLerpAnimEffectInterval.cxx cLerpAnimEffectInterval.I cLerpAnimEffectInterval.h \ - cMetaInterval.cxx cMetaInterval.I cMetaInterval.h \ - hideInterval.cxx hideInterval.I hideInterval.h \ - lerpblend.cxx lerpblend.h \ - showInterval.cxx showInterval.I showInterval.h \ - waitInterval.cxx waitInterval.I waitInterval.h \ - lerp_helpers.h - - #define INSTALL_HEADERS \ - config_interval.h \ - cInterval.I cInterval.h \ - cIntervalManager.I cIntervalManager.h \ - cConstraintInterval.I cConstraintInterval.h \ - cConstrainTransformInterval.I cConstrainTransformInterval.h \ - cConstrainPosInterval.I cConstrainPosInterval.h \ - cConstrainHprInterval.I cConstrainHprInterval.h \ - cConstrainPosHprInterval.I cConstrainPosHprInterval.h \ - cLerpInterval.I cLerpInterval.h \ - cLerpNodePathInterval.I cLerpNodePathInterval.h \ - cLerpAnimEffectInterval.I cLerpAnimEffectInterval.h \ - cMetaInterval.I cMetaInterval.h \ - hideInterval.I hideInterval.h \ - lerpblend.h \ - showInterval.I showInterval.h \ - waitInterval.I waitInterval.h \ - lerp_helpers.h - - #define IGATESCAN all -#end lib_target diff --git a/direct/src/leveleditor/Sources.pp b/direct/src/leveleditor/Sources.pp deleted file mode 100644 index 55b12dc4fa..0000000000 --- a/direct/src/leveleditor/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -// Toontown-specific codes have been moved into $TOONTOWN source tree - - diff --git a/direct/src/motiontrail/MotionTrail.py b/direct/src/motiontrail/MotionTrail.py index 531deef003..bf11cf5493 100644 --- a/direct/src/motiontrail/MotionTrail.py +++ b/direct/src/motiontrail/MotionTrail.py @@ -4,6 +4,7 @@ from panda3d.core import * from panda3d.direct import * from direct.task import Task from direct.showbase.DirectObject import DirectObject +from direct.directnotify.DirectNotifyGlobal import directNotify def remove_task ( ): diff --git a/direct/src/motiontrail/Sources.pp b/direct/src/motiontrail/Sources.pp deleted file mode 100644 index beeb760f99..0000000000 --- a/direct/src/motiontrail/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -#begin lib_target - #define TARGET p3motiontrail - #define LOCAL_LIBS \ - p3directbase - - #define OTHER_LIBS \ - p3linmath:c \ - p3mathutil:c \ - p3gobj:c \ - p3putil:c \ - p3pipeline:c \ - p3event:c \ - p3pstatclient:c \ - p3pnmimage:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3pgraph:c \ - panda:m \ - p3express:c \ - p3downloader:c \ - pandaexpress:m \ - p3interrogatedb:c \ - p3dconfig:c \ - p3dtoolconfig:m \ - p3dtoolutil:c \ - p3dtoolbase:c \ - p3dtool:m \ - p3pandabase:c \ - p3prc:c \ - p3gsgbase:c \ - p3parametrics:c - - - #define SOURCES \ - config_motiontrail.cxx config_motiontrail.h \ - cMotionTrail.cxx cMotionTrail.h - - #define INSTALL_HEADERS \ - config_motiontrail.h \ - cMotionTrail.h - - #define IGATESCAN all -#end lib_target diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 791bad6b8e..f9ddab983f 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -3361,7 +3361,7 @@ class Packager: self.currentPackage.addExtensionModules() self.currentPackage.freezer.reset() - self.do_file('panda3d/_core.pyd', newDir='panda3d') + self.do_file('panda3d/core.pyd', newDir='panda3d') # This is the key Python module that is imported at runtime to # start an application running. diff --git a/direct/src/p3d/Sources.pp b/direct/src/p3d/Sources.pp deleted file mode 100644 index 390348668b..0000000000 --- a/direct/src/p3d/Sources.pp +++ /dev/null @@ -1,77 +0,0 @@ -// This directory contains the Python code necessary to interface with -// the browser plugin system at runtime. It also contains the Python -// scripts to create and manage p3d files, which are the actual -// runtime applications, and packages, which are additional code and -// assets that can be downloaded at runtime by p3d files. - -#if $[BUILD_P3D_SCRIPTS] - - // If the developer has asked to build the shell script to invoke - // ppackage.py (or some other Python script in this directory), then - // do so now. These convenient scripts aren't built by default, - // because usually ppackage.p3d etc. is a more reliable way to - // invoke these applications. However, there might be development - // environments that don't have a ppackage.p3d available, in which - // case it is convenient to have one or more of these scripts. - - #define INSTALL_SCRIPTS $[BUILD_P3D_SCRIPTS:%=%.py] - - // On Windows, we generate a batch file; on other platforms - // (including Cygwin), we generate a sh script. - - #define install_dir $[$[upcase $[PACKAGE]]_INSTALL] - #define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin] - - #define python $[PYTHON_COMMAND] - #if $[USE_DEBUG_PYTHON] - #define python $[PYTHON_DEBUG_COMMAND] - #endif - #if $[>= $[OPTIMIZE], 4] - #define python $[python] -OO - #endif - - #foreach scriptname $[BUILD_P3D_SCRIPTS] - #if $[MAKE_BAT_SCRIPTS] - #set INSTALL_SCRIPTS $[INSTALL_SCRIPTS] $[scriptname].bat - #else - #set INSTALL_SCRIPTS $[INSTALL_SCRIPTS] $[scriptname] - #endif - - #if $[MAT_BAT_SCRIPTS] - #output $[scriptname].bat notouch -@echo off -rem #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -rem ################################# DO NOT EDIT ########################### - -$[python] -u $[osfilename $[install_bin_dir]/$[scriptname].py] %1 %2 %3 %4 %5 %6 %7 %8 %9 - #end $[scriptname].bat - - #else // MAKE_BAT_SCRIPTS - - #output $[scriptname] binary notouch -#! /bin/sh -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - - #if $[CTPROJS] -# This script was generated while the user was using the ctattach -# tools. That had better still be the case. - #if $[WINDOWS_PLATFORM] -$[python] -u `cygpath -w $DIRECT/built/bin/$[scriptname].py` "$@" - #else -$[python] -u $DIRECT/built/bin/$[scriptname].py "$@" - #endif - #else -$[python] -u '$[osfilename $[install_bin_dir]/$[scriptname].py]' "$@" - #endif - #end $[scriptname] - - #endif // MAKE_BAT_SCRIPTS - - #end scriptname - -#endif // WANT_PACKAGE_SCRIPT - - - - diff --git a/direct/src/particles/Sources.pp b/direct/src/particles/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/physics/Sources.pp b/direct/src/physics/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/plugin/Sources.pp b/direct/src/plugin/Sources.pp deleted file mode 100644 index 6b26a02ca3..0000000000 --- a/direct/src/plugin/Sources.pp +++ /dev/null @@ -1,369 +0,0 @@ -// This directory contains the code for the "Core API" part of the -// Panda3D browser plugin system, which is not built unless you have -// defined HAVE_P3D_PLUGIN in your Config.pp. Most Panda3D developers -// will have no need to build this, unless you are developing the -// plugin system itself. - -// This directory also contains the code for p3dpython.exe, which is -// part of the Panda3D rtdist build. It's not strictly part of the -// "Core API"; it is packaged as part of each downloadable version of -// Panda3D. It is only built if you have defined either -// PANDA_PACKAGE_HOST_URL or HAVE_P3D_RTDIST in your Config.pp, which -// indicates an intention to build a downloadable version of Panda3D. -// Developers who are preparing a custom Panda3D package for download -// by the plugin will need to build this. - -// If P3D_PLUGIN_MT is defined, then (on Windows) /MT is used to -// compile the core API and the NPAPI and ActiveX plugins, instead of -// /MD. This links the plugin with the static C runtime library, -// instead of the dynamic runtime library, which is much better for -// distributing the plugin with the XPI and CAB interfaces. This -// requires that special /MT versions of OpenSSL and zlib are available. - -#define _MT $[if $[P3D_PLUGIN_MT],_mt] - -#define COREAPI_SOURCES \ - fileSpec.cxx fileSpec.h fileSpec.I \ - find_root_dir.cxx find_root_dir.h \ - $[if $[IS_OSX],find_root_dir_assist.mm] \ - get_tinyxml.h \ - binaryXml.cxx binaryXml.h \ - fhandle.h \ - handleStream.cxx handleStream.h handleStream.I \ - handleStreamBuf.cxx handleStreamBuf.h handleStreamBuf.I \ - mkdir_complete.cxx mkdir_complete.h \ - parse_color.cxx parse_color.h \ - wstring_encode.cxx wstring_encode.h \ - p3d_lock.h p3d_plugin.h \ - p3d_plugin_config.h \ - p3d_plugin_common.h \ - p3dAuthSession.h p3dAuthSession.I \ - p3dBoolObject.h \ - p3dConcreteSequence.h \ - p3dConcreteStruct.h \ - p3dConditionVar.h p3dConditionVar.I \ - p3dDownload.h p3dDownload.I \ - p3dFileDownload.h p3dFileDownload.I \ - p3dFileParams.h p3dFileParams.I \ - p3dFloatObject.h \ - p3dHost.h p3dHost.I \ - p3dInstance.h p3dInstance.I \ - p3dInstanceManager.h p3dInstanceManager.I \ - p3dIntObject.h \ - p3dMainObject.h \ - p3dMultifileReader.h p3dMultifileReader.I \ - p3dNoneObject.h \ - p3dObject.h p3dObject.I \ - p3dOsxSplashWindow.h p3dOsxSplashWindow.I \ - p3dPackage.h p3dPackage.I \ - p3dPatchfileReader.h p3dPatchfileReader.I \ - p3dPatchFinder.h p3dPatchFinder.I \ - p3dPythonObject.h \ - p3dReferenceCount.h p3dReferenceCount.I \ - p3dSession.h p3dSession.I \ - p3dSplashWindow.h p3dSplashWindow.I \ - p3dStringObject.h \ - p3dTemporaryFile.h p3dTemporaryFile.I \ - p3dUndefinedObject.h \ - p3dWinSplashWindow.h p3dWinSplashWindow.I \ - p3dX11SplashWindow.h p3dX11SplashWindow.I \ - p3dWindowParams.h p3dWindowParams.I \ - plugin_get_x11.h \ - xml_helpers.h \ - run_p3dpython.h - -#define COREAPI_INCLUDED_SOURCES \ - p3d_plugin.cxx \ - p3dAuthSession.cxx \ - p3dBoolObject.cxx \ - p3dConcreteSequence.cxx \ - p3dConcreteStruct.cxx \ - p3dConditionVar.cxx \ - p3dDownload.cxx \ - p3dFileDownload.cxx \ - p3dFileParams.cxx \ - p3dFloatObject.cxx \ - p3dHost.cxx \ - p3dInstance.cxx \ - p3dInstanceManager.cxx \ - p3dIntObject.cxx \ - p3dMainObject.cxx \ - p3dMultifileReader.cxx \ - p3dNoneObject.cxx \ - p3dObject.cxx \ - p3dOsxSplashWindow.cxx \ - p3dPackage.cxx \ - p3dPatchfileReader.cxx \ - p3dPatchFinder.cxx \ - p3dPythonObject.cxx \ - p3dReferenceCount.cxx \ - p3dSession.cxx \ - p3dSplashWindow.cxx \ - p3dStringObject.cxx \ - p3dTemporaryFile.cxx \ - p3dUndefinedObject.cxx \ - p3dWinSplashWindow.cxx \ - p3dX11SplashWindow.cxx \ - p3dWindowParams.cxx \ - xml_helpers.cxx - -#begin lib_target - -// -// p3d_plugin.dll, the main entry point to the Core API. -// - - #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_OPENSSL],$[HAVE_ZLIB]] - #define USE_PACKAGES openssl$[_MT] zlib$[_MT] x11 - #define TARGET p3d_plugin - #define LIB_PREFIX - #define BUILDING_DLL BUILDING_P3D_PLUGIN - #define LINK_FORCE_STATIC_RELEASE_C_RUNTIME $[P3D_PLUGIN_MT] - - #define OTHER_LIBS \ - p3tinyxml$[_MT] $[if $[OSX_PLATFORM],p3subprocbuffer] - - #define COMBINED_SOURCES p3d_plugin_composite1.cxx - #define SOURCES $[COREAPI_SOURCES] - #define INCLUDED_SOURCES $[COREAPI_INCLUDED_SOURCES] - - #define INSTALL_HEADERS \ - p3d_plugin.h - - #define WIN_SYS_LIBS user32.lib gdi32.lib shell32.lib comctl32.lib msimg32.lib ole32.lib - -#end lib_target - -#begin static_lib_target - -// -// libp3d_plugin_static.lib, the Core API as a static library (for p3dembed). -// - - #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_OPENSSL],$[HAVE_ZLIB]] - #define USE_PACKAGES openssl zlib x11 - #define TARGET p3d_plugin_static - #define BUILDING_DLL BUILDING_P3D_PLUGIN - - #define OTHER_LIBS \ - p3tinyxml $[if $[OSX_PLATFORM],p3subprocbuffer] - - #define COMBINED_SOURCES p3d_plugin_composite1.cxx - #define SOURCES $[COREAPI_SOURCES] - #define INCLUDED_SOURCES $[COREAPI_INCLUDED_SOURCES] - - #define WIN_SYS_LIBS user32.lib gdi32.lib shell32.lib comctl32.lib msimg32.lib ole32.lib - -#end static_lib_target - -#begin bin_target - -// -// p3dcert.exe, the authorization GUI invoked when the user clicks the -// red "play" button to approve an unknown certificate. Considered -// part of the Core API, though it is a separate download. -// -#if $[HAVE_FLTK] - #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_FLTK],$[HAVE_OPENSSL]] - #define USE_PACKAGES fltk openssl - #define SOURCES p3dCert.cxx p3dCert.h -#else - #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_WX],$[HAVE_OPENSSL]] - #define USE_PACKAGES wx openssl - #define SOURCES p3dCert_wx.cxx p3dCert_wx.h -#endif - #define TARGET p3dcert - - #define SOURCES $[SOURCES] \ - is_pathsep.h is_pathsep.I \ - wstring_encode.cxx wstring_encode.h \ - mkdir_complete.cxx mkdir_complete.h - - #define OSX_SYS_FRAMEWORKS Carbon - -#end bin_target - - -#define PLUGIN_COMMON_SOURCES \ - load_plugin.cxx load_plugin.h \ - fileSpec.cxx fileSpec.h fileSpec.I \ - find_root_dir.cxx find_root_dir.h \ - $[if $[IS_OSX],find_root_dir_assist.mm] \ - is_pathsep.h is_pathsep.I \ - mkdir_complete.cxx mkdir_complete.h \ - get_twirl_data.cxx get_twirl_data.h \ - parse_color.cxx parse_color.h \ - wstring_encode.cxx wstring_encode.h - - -#begin static_lib_target -// -// libplugin_common.lib, a repository of code shared between the core -// API and the various plugin implementations. -// - - #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_OPENSSL]] - #define TARGET plugin_common - #define USE_PACKAGES openssl - - #define SOURCES $[PLUGIN_COMMON_SOURCES] - -#end static_lib_target - -#if $[P3D_PLUGIN_MT] -#begin static_lib_target -// -// libplugin_common_mt.lib, the same as above, with /MT compilation. -// - - #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_OPENSSL]] - #define TARGET plugin_common_mt - #define USE_PACKAGES openssl_mt - #define LINK_FORCE_STATIC_RELEASE_C_RUNTIME 1 - - #define SOURCES $[PLUGIN_COMMON_SOURCES] - -#end static_lib_target -#endif // $[P3D_PLUGIN_MT] - - - -// The remaining targets build p3dpython.exe and variants. - -#begin bin_target - -// -// p3dpython.exe, the primary entry point to the downloaded Panda3D -// runtime. This executable is run in a child process by the Core API -// to invoke a particular instance of Panda. -// - - #define BUILD_TARGET $[and $[HAVE_P3D_RTDIST],$[HAVE_PYTHON],$[HAVE_OPENSSL]] - #define USE_PACKAGES python openssl cg - #define TARGET p3dpython - - #define OTHER_LIBS \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3express:c pandaexpress:m p3dxml:c \ - p3pgraph:c p3pgraphnodes:c p3cull:c p3gsgbase:c p3gobj:c \ - p3mathutil:c p3downloader:c p3pnmimage:c \ - p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \ - p3pipeline:c p3event:c p3display:c panda:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[HAVE_NET],p3net:c] \ - p3tinyxml - - #define SOURCES \ - binaryXml.cxx binaryXml.h \ - fhandle.h \ - handleStream.cxx handleStream.h handleStream.I \ - handleStreamBuf.cxx handleStreamBuf.h handleStreamBuf.I \ - p3d_lock.h p3d_plugin.h \ - p3d_plugin_config.h \ - p3dCInstance.cxx \ - p3dCInstance.h p3dCInstance.I \ - p3dPythonRun.cxx p3dPythonRun.h p3dPythonRun.I \ - run_p3dpython.h run_p3dpython.cxx - - #define SOURCES $[SOURCES] \ - p3dPythonMain.cxx - - // If you have to link with a static Python library, define it here. - #define EXTRA_LIBS $[EXTRA_P3DPYTHON_LIBS] - #define OSX_SYS_FRAMEWORKS Carbon - - #define WIN_SYS_LIBS user32.lib -#end bin_target - -#begin bin_target - -// -// p3dpythonw.exe, a special variant on p3dpython.exe required by -// Windows (and built only on a Windows platform). This variant is -// compiled as a desktop application, as opposed to p3dpython.exe, -// which is a console application. (Both variants are required, -// because the plugin might be invoked either from a console or from -// the desktop.) -// - - #define BUILD_TARGET $[and $[HAVE_P3D_RTDIST],$[HAVE_PYTHON],$[HAVE_OPENSSL],$[WINDOWS_PLATFORM]] - #define USE_PACKAGES python openssl - #define TARGET p3dpythonw - #define EXTRA_CDEFS NON_CONSOLE - - #define OTHER_LIBS \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3express:c pandaexpress:m p3dxml:c \ - p3pgraph:c p3pgraphnodes:c p3cull:c p3gsgbase:c p3gobj:c \ - p3mathutil:c p3downloader:c p3pnmimage:c \ - p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \ - p3pipeline:c p3event:c p3display:c panda:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[HAVE_NET],p3net:c] \ - p3tinyxml - - #define SOURCES \ - binaryXml.cxx binaryXml.h \ - fhandle.h \ - handleStream.cxx handleStream.h handleStream.I \ - handleStreamBuf.cxx handleStreamBuf.h handleStreamBuf.I \ - p3d_lock.h p3d_plugin.h \ - p3d_plugin_config.h \ - p3dCInstance.cxx \ - p3dCInstance.h p3dCInstance.I \ - p3dPythonRun.cxx p3dPythonRun.h p3dPythonRun.I \ - run_p3dpython.h run_p3dpython.cxx - - #define SOURCES $[SOURCES] \ - p3dPythonMain.cxx - - // If you have to link with a static Python library, define it here. - #define EXTRA_LIBS $[EXTRA_P3DPYTHON_LIBS] - #define OSX_SYS_FRAMEWORKS Carbon - - #define WIN_SYS_LIBS user32.lib -#end bin_target - -#begin lib_target - -// -// libp3dpython.dll, a special library used to run P3DPythonRun within -// the parent (browser) process, instead of forking a child, as a -// desparation fallback in case forking fails for some reason. -// - #define BUILD_TARGET $[and $[HAVE_P3D_RTDIST],$[HAVE_PYTHON],$[HAVE_OPENSSL]] - #define USE_PACKAGES python openssl cg - #define TARGET libp3dpython - #define LIB_PREFIX - - #define OTHER_LIBS \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3express:c pandaexpress:m p3dxml:c \ - p3pgraph:c p3pgraphnodes:c p3cull:c p3gsgbase:c p3gobj:c \ - p3mathutil:c p3downloader:c p3pnmimage:c \ - p3prc:c p3pstatclient:c p3pandabase:c p3linmath:c p3putil:c \ - p3pipeline:c p3event:c p3display:c panda:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[HAVE_NET],p3net:c] \ - p3tinyxml - - #define SOURCES \ - binaryXml.cxx binaryXml.h \ - fhandle.h \ - handleStream.cxx handleStream.h handleStream.I \ - handleStreamBuf.cxx handleStreamBuf.h handleStreamBuf.I \ - p3d_lock.h p3d_plugin.h \ - p3d_plugin_config.h \ - p3dCInstance.cxx \ - p3dCInstance.h p3dCInstance.I \ - p3dPythonRun.cxx p3dPythonRun.h p3dPythonRun.I \ - run_p3dpython.h run_p3dpython.cxx - - #define WIN_SYS_LIBS user32.lib -#end lib_target - - -#include $[THISDIRPREFIX]p3d_plugin_config.h.pp diff --git a/direct/src/plugin/p3dPythonRun.cxx b/direct/src/plugin/p3dPythonRun.cxx index 3c8e8628c6..e0d1f71b82 100644 --- a/direct/src/plugin/p3dPythonRun.cxx +++ b/direct/src/plugin/p3dPythonRun.cxx @@ -193,7 +193,7 @@ run_python() { return 1; } - // Set the __path__ such that it can find panda3d/_core.pyd, etc. + // Set the __path__ such that it can find panda3d/core.pyd, etc. Filename panda3d_dir(dir, "panda3d"); string dir_str = panda3d_dir.to_os_specific(); PyModule_AddObject(panda3d_module, "__path__", Py_BuildValue("[s#]", dir_str.data(), dir_str.length())); diff --git a/direct/src/plugin/p3d_plugin_config.h.pp b/direct/src/plugin/p3d_plugin_config.h.pp deleted file mode 100644 index 93b330cf6d..0000000000 --- a/direct/src/plugin/p3d_plugin_config.h.pp +++ /dev/null @@ -1,38 +0,0 @@ -// This file is read and processed by ppremake to generate -// p3d_plugin_config.h. - -#output p3d_plugin_config.h notouch -/* p3d_plugin_config.h. Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. */ -/********************************** DO NOT EDIT ****************************/ - -/* The URL that is the root of the download server that this plugin - should contact. The contents.xml file that defines this particular - "coreapi" package should be found at this location. */ -#$[]define PANDA_PACKAGE_HOST_URL "$[PANDA_PACKAGE_HOST_URL]" - -/* The Core API version number. This one also appears in - pandaVersion.h. */ -#$[]define P3D_COREAPI_VERSION_STR "$[join .,$[P3D_COREAPI_VERSION]]" - -/* As does the plugin version number. */ -#$[]define P3D_PLUGIN_VERSION_STR "$[join .,$[P3D_PLUGIN_VERSION]]" - -/* The filename(s) to generate output to when the plugin is running. - For debugging purposes only. */ -#$[]define P3D_PLUGIN_LOG_DIRECTORY "$[subst \,\\,$[osfilename $[P3D_PLUGIN_LOG_DIRECTORY]]]" -#$[]define P3D_PLUGIN_LOG_BASENAME1 "$[P3D_PLUGIN_LOG_BASENAME1]" -#$[]define P3D_PLUGIN_LOG_BASENAME2 "$[P3D_PLUGIN_LOG_BASENAME2]" -#$[]define P3D_PLUGIN_LOG_BASENAME3 "$[P3D_PLUGIN_LOG_BASENAME3]" - -/* For development only: the location at which p3dpython.exe can be - found. Empty string for the default. */ -#$[]define P3D_PLUGIN_P3DPYTHON "$[subst \,\\,$[osfilename $[P3D_PLUGIN_P3DPYTHON]]]" - -/* For development only: the location at which p3d_plugin.dll/.so can - be found. Empty string for the default. */ -#$[]define P3D_PLUGIN_P3D_PLUGIN "$[subst \,\\,$[osfilename $[P3D_PLUGIN_P3D_PLUGIN]]]" - -/* We need to know whether GTK is enabled for XEmbed. */ -$[cdefine HAVE_GTK] - -#end p3d_plugin_config.h diff --git a/direct/src/plugin_activex/P3DActiveX.rc.pp b/direct/src/plugin_activex/P3DActiveX.rc.pp deleted file mode 100644 index 28d66e6edd..0000000000 --- a/direct/src/plugin_activex/P3DActiveX.rc.pp +++ /dev/null @@ -1,175 +0,0 @@ -// -// P3DActiveX.rc.pp -// -// This file defines the script to auto-generate P3DActiveX.rc at -// ppremake time. We use this to fill in the DLL version correctly. -// - -#output P3DActiveX.rc notouch -/$[]/#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -/$[]/################################# DO NOT EDIT ########################### - -// Microsoft Visual C++ generated resource script. -// -#$[]include "resource.h" - -#$[]define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#$[]include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#$[]undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#$[]if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#$[]ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#$[]pragma code_page(1252) -#$[]endif //_WIN32 - -#$[]ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#$[]include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "1 TYPELIB ""P3DActiveX.tlb""\r\n" - "\0" -END - -#$[]endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION $[P3D_PLUGIN_DLL_COMMA_VERSION] - PRODUCTVERSION $[P3D_PLUGIN_DLL_COMMA_VERSION] - FILEFLAGSMASK 0x3fL -#$[]ifdef _DEBUG - FILEFLAGS 0x1L -#$[]else - FILEFLAGS 0x0L -#$[]endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "FileDescription", "Panda3D Game Engine Plug-in $[P3D_PLUGIN_VERSION_STR]\0" - Value "CompanyName", "$[PANDA_DISTRIBUTOR]" - VALUE "FileVersion", "$[P3D_PLUGIN_DLL_DOT_VERSION]" - VALUE "InternalName", "P3DActiveX.ocx" - VALUE "LegalTrademarks", "\0" - VALUE "FileOpenName", "Panda3D applet\0" - VALUE "OLESelfRegister", "\0" - VALUE "OriginalFilename", "P3DActiveX.ocx" - VALUE "ProductName", "Panda3D Game Engine Plug-in $[P3D_PLUGIN_VERSION_STR]\0" - VALUE "ProductVersion", "$[P3D_PLUGIN_DLL_DOT_VERSION]" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_P3DACTIVEX BITMAP "P3DActiveXCtrl.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PROPPAGE_P3DACTIVEX DIALOG 0, 0, 250, 62 -STYLE DS_SETFONT | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "TODO: Place controls to manipulate properties of P3DActiveX Control on this dialog.", - IDC_STATIC,7,25,229,16 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#$[]ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PROPPAGE_P3DACTIVEX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 243 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END -END -#$[]endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_P3DACTIVEX "P3DActiveX Control" - IDS_P3DACTIVEX_PPG "P3DActiveX Property Page" -END - -STRINGTABLE -BEGIN - IDS_P3DACTIVEX_PPG_CAPTION "General" -END - -#$[]endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#$[]ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "P3DActiveX.tlb" - -///////////////////////////////////////////////////////////////////////////// -#$[]endif // not APSTUDIO_INVOKED - - -#end P3DActiveX.rc - diff --git a/direct/src/plugin_activex/Sources.pp b/direct/src/plugin_activex/Sources.pp deleted file mode 100644 index e2379d3b06..0000000000 --- a/direct/src/plugin_activex/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -// This directory builds the code for the ActiveX (Internet Explorer) -// plugin, part of the Panda3D browser plugin system. Most Panda3D -// developers will have no need to build this, unless you are -// developing the plugin system itself. Define HAVE_P3D_PLUGIN in -// your Config.pp to build this directory. - -#define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[WINDOWS_PLATFORM],$[HAVE_ACTIVEX],$[not $[eq $[USE_COMPILER],MSVC9x64]]] - -#define _MT $[if $[P3D_PLUGIN_MT],_mt] - -#begin lib_target - #define TARGET p3dactivex - #define LIB_PREFIX - #define DYNAMIC_LIB_EXT .ocx - - #define LOCAL_LIBS plugin_common$[_MT] - #define LINK_FORCE_STATIC_RELEASE_C_RUNTIME $[P3D_PLUGIN_MT] - #define OTHER_LIBS p3tinyxml$[_MT] - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx - - #define SOURCES \ - P3DActiveX.h P3DActiveXCtrl.h P3DActiveXPropPage.h \ - PPBrowserObject.h PPDownloadCallback.h PPDownloadRequest.h \ - PPInstance.h PPInterface.h PPLogger.h PPPandaObject.h \ - resource.h P3DActiveX.idl - - #define INCLUDED_SOURCES \ - P3DActiveX.cpp P3DActiveXCtrl.cpp P3DActiveXPropPage.cpp \ - PPBrowserObject.cpp PPDownloadCallback.cpp PPDownloadRequest.cpp \ - PPInstance.cpp PPInterface.cpp PPLogger.cpp PPPandaObject.cpp - - #define EXTRA_CDEFS _USRDLL _WINDLL _MBCS $[if $[not $[P3D_PLUGIN_MT]],_AFXDLL] - #define WIN_RESOURCE_FILE P3DActiveX.rc - #define LINKER_DEF_FILE P3DActiveX.def - - #define INSTALL_HEADERS - -#end lib_target - -#include $[THISDIRPREFIX]P3DActiveX.rc.pp diff --git a/direct/src/plugin_npapi/Sources.pp b/direct/src/plugin_npapi/Sources.pp deleted file mode 100644 index 1c41e7b57d..0000000000 --- a/direct/src/plugin_npapi/Sources.pp +++ /dev/null @@ -1,62 +0,0 @@ -// This directory builds the code for the NPAPI (Mozilla) plugin, part -// of the Panda3D browser plugin system. Most Panda3D developers will -// have no need to build this, unless you are developing the plugin -// system itself. Define HAVE_P3D_PLUGIN in your Config.pp to build -// this directory. - -#define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_NPAPI]] - -#define _MT $[if $[P3D_PLUGIN_MT],_mt] -#define USE_PACKAGES npapi gtk - -#begin lib_target - // By Mozilla convention, on Windows at least, the generated DLL - // filename must begin with "np", not "libnp". (Actually, this is - // probably no longer true on recent versions of Mozilla. But why - // take chances?) - #define TARGET nppanda3d - #define LIB_PREFIX - - #define LOCAL_LIBS plugin_common$[_MT] - #define LINK_FORCE_STATIC_RELEASE_C_RUNTIME $[P3D_PLUGIN_MT] - #define OTHER_LIBS p3tinyxml$[_MT] - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx - - #define SOURCES \ - nppanda3d_common.h \ - ppBrowserObject.h ppBrowserObject.I \ - ppDownloadRequest.h ppDownloadRequest.I \ - ppInstance.h ppInstance.I \ - ppPandaObject.h ppPandaObject.I \ - ppToplevelObject.h ppToplevelObject.I \ - startup.h - - #define INCLUDED_SOURCES \ - ppBrowserObject.cxx \ - ppDownloadRequest.cxx \ - ppInstance.cxx \ - ppPandaObject.cxx \ - ppToplevelObject.cxx \ - startup.cxx - - // Windows-specific options. - #if $[WINDOWS_PLATFORM] - #define WIN_RESOURCE_FILE nppanda3d.rc - #define LINKER_DEF_FILE nppanda3d.def - #define WIN_SYS_LIBS user32.lib shell32.lib ole32.lib - #endif - - // Mac-specific options. - #if $[OSX_PLATFORM] - #define LINK_AS_BUNDLE 1 - #define BUNDLE_EXT - #endif - - #define INSTALL_HEADERS - -#end lib_target - - -#include $[THISDIRPREFIX]nppanda3d.rc.pp diff --git a/direct/src/plugin_npapi/nppanda3d.rc.pp b/direct/src/plugin_npapi/nppanda3d.rc.pp deleted file mode 100644 index 553ea9b8d5..0000000000 --- a/direct/src/plugin_npapi/nppanda3d.rc.pp +++ /dev/null @@ -1,55 +0,0 @@ -// -// nppanda3d.rc.pp -// -// This file defines the script to auto-generate nppanda3d.rc at -// ppremake time. We use this to fill in the DLL version correctly. -// -// This resource file is required on Windows to load the appropriate -// text into the DLL, so Mozilla will recognize the DLL as a plugin. -// It also defines the MIME type supported by the plugin. - -#output nppanda3d.rc notouch -/$[]/#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -/$[]/################################# DO NOT EDIT ########################### - -#$[]define APSTUDIO_READONLY_SYMBOLS -#$[]include "winresrc.h" -#$[]undef APSTUDIO_READONLY_SYMBOLS - - -VS_VERSION_INFO VERSIONINFO - FILEVERSION $[P3D_PLUGIN_DLL_COMMA_VERSION] - PRODUCTVERSION $[P3D_PLUGIN_DLL_COMMA_VERSION] - FILEFLAGSMASK 0x3fL -#$[]ifdef _DEBUG - FILEFLAGS 0x1L -#$[]else - FILEFLAGS 0x0L -#$[]endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "FileDescription", "Runs 3-D games and interactive applets\0" - VALUE "FileVersion", "$[P3D_PLUGIN_DLL_DOT_VERSION]" - VALUE "LegalTrademarks", "\0" - VALUE "MIMEType", "application/x-panda3d\0" - VALUE "FileExtents", "p3d\0" - VALUE "FileOpenName", "Panda3D applet\0" - VALUE "OriginalFilename", "nppanda3d.dll\0" - VALUE "ProductName", "Panda3D Game Engine Plug-In $[P3D_PLUGIN_VERSION_STR]\0" - VALUE "ProductVersion", "$[P3D_PLUGIN_DLL_DOT_VERSION]" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#end nppanda3d.rc - diff --git a/direct/src/plugin_standalone/Sources.pp b/direct/src/plugin_standalone/Sources.pp deleted file mode 100644 index 9f14945e10..0000000000 --- a/direct/src/plugin_standalone/Sources.pp +++ /dev/null @@ -1,142 +0,0 @@ -// This directory contains the code for the panda3d.exe executable, -// the "standalone" part of the Panda3D plugin/runtime system. Define -// HAVE_P3D_PLUGIN in your Config.pp to build it. - -#define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_OPENSSL],$[HAVE_ZLIB]] - -#begin bin_target - #define USE_PACKAGES openssl zlib - #define TARGET panda3d - - #define LOCAL_LIBS plugin_common - - #define OTHER_LIBS \ - p3prc:c p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3pandabase:c p3downloader:c p3express:c pandaexpress:m \ - p3pystub p3tinyxml - - #define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon - - #define SOURCES \ - panda3dBase.cxx panda3dBase.h panda3dBase.I \ - panda3d.cxx panda3d.h panda3d.I \ - panda3dMain.cxx - - #define WIN_RESOURCE_FILE panda3d.rc - #define WIN_SYS_LIBS user32.lib gdi32.lib shell32.lib ole32.lib - -#end bin_target - -#begin bin_target - // On Windows, we also need to build panda3dw.exe, the non-console - // version of panda3d.exe. - - #define BUILD_TARGET $[WINDOWS_PLATFORM] - #define USE_PACKAGES openssl zlib - #define TARGET panda3dw - - #define LOCAL_LIBS plugin_common - - #define OTHER_LIBS \ - p3prc:c p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3pandabase:c p3downloader:c p3express:c pandaexpress:m \ - p3pystub p3tinyxml - - #define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon - - #define SOURCES \ - panda3dBase.cxx panda3dBase.h panda3dBase.I \ - panda3d.cxx panda3d.h panda3d.I \ - panda3dWinMain.cxx - - #define WIN_RESOURCE_FILE panda3d.rc - #define WIN_SYS_LIBS user32.lib gdi32.lib shell32.lib ole32.lib - -#end bin_target - -#begin bin_target - // On Mac, we'll build panda3d_mac, which is the Carbon-friendly - // application we wrap in a bundle, for picking a p3d file from - // Finder. - - #define BUILD_TARGET $[OSX_PLATFORM] - #define USE_PACKAGES openssl zlib - #define TARGET panda3d_mac - - #define LOCAL_LIBS plugin_common - - #define OTHER_LIBS \ - p3prc:c p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3pandabase:c p3downloader:c p3express:c pandaexpress:m \ - p3pystub p3tinyxml - - #define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon - - #define SOURCES \ - panda3dBase.cxx panda3dBase.h panda3dBase.I \ - panda3d.cxx panda3d.h panda3d.I \ - panda3dMac.cxx panda3dMac.h panda3dMac.I - -#end bin_target - -#begin bin_target - #define USE_PACKAGES openssl zlib - #define TARGET p3dembed - #define LOCAL_LIBS plugin_common p3d_plugin_static - - // We need to define this, even though we are not creating a DLL, - // because we need the symbols to be "exported" so we can find them in - // our own address space. - #define EXTRA_CDEFS BUILDING_P3D_PLUGIN - - #define OTHER_LIBS \ - p3prc:c p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3pandabase:c p3downloader:c p3express:c pandaexpress:m \ - p3pystub p3tinyxml \ - $[if $[OSX_PLATFORM],p3subprocbuffer] - - #define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon - - #define SOURCES \ - panda3dBase.cxx panda3dBase.h panda3dBase.I \ - p3dEmbed.cxx p3dEmbedMain.cxx - - #define WIN_RESOURCE_FILE panda3d.rc - #define WIN_SYS_LIBS user32.lib gdi32.lib shell32.lib comctl32.lib msimg32.lib ole32.lib - -#end bin_target - -#begin bin_target - // On Windows, we also need to build p3dembedw.exe, the non-console - // version of p3dembed.exe. - - #define BUILD_TARGET $[WINDOWS_PLATFORM] - #define USE_PACKAGES openssl zlib - #define TARGET p3dembedw - #define LOCAL_LIBS plugin_common p3d_plugin_static - - // We need to define this, even though we are not creating a DLL, - // because we need the symbols to be "exported" so we can find them in - // our own address space. - #define EXTRA_CDEFS BUILDING_P3D_PLUGIN P3DEMBEDW - - #define OTHER_LIBS \ - p3prc:c p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3pandabase:c p3downloader:c p3express:c pandaexpress:m \ - p3pystub p3tinyxml - - #define SOURCES \ - panda3dBase.cxx panda3dBase.h panda3dBase.I \ - p3dEmbed.cxx p3dEmbedMain.cxx - - #define WIN_RESOURCE_FILE panda3d.rc - #define WIN_SYS_LIBS user32.lib gdi32.lib shell32.lib comctl32.lib msimg32.lib ole32.lib - -#end bin_target - -#include $[THISDIRPREFIX]panda3d.rc.pp diff --git a/direct/src/plugin_standalone/panda3d.rc.pp b/direct/src/plugin_standalone/panda3d.rc.pp deleted file mode 100644 index b01c3bf0fc..0000000000 --- a/direct/src/plugin_standalone/panda3d.rc.pp +++ /dev/null @@ -1,53 +0,0 @@ -// -// panda3d.rc.pp -// -// This file defines the script to auto-generate panda3d.rc at -// ppremake time. We use this to fill in the DLL version correctly. -// - -#output panda3d.rc notouch -/$[]/#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -/$[]/################################# DO NOT EDIT ########################### - -#$[]define APSTUDIO_READONLY_SYMBOLS -#$[]include "winresrc.h" -#$[]undef APSTUDIO_READONLY_SYMBOLS - - -VS_VERSION_INFO VERSIONINFO - FILEVERSION $[P3D_PLUGIN_DLL_COMMA_VERSION] - PRODUCTVERSION $[P3D_PLUGIN_DLL_COMMA_VERSION] - FILEFLAGSMASK 0x3fL -#$[]ifdef _DEBUG - FILEFLAGS 0x1L -#$[]else - FILEFLAGS 0x0L -#$[]endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "FileDescription", "Panda3D Game Engine Runtime $[P3D_PLUGIN_VERSION_STR]\0" - VALUE "FileVersion", "$[P3D_PLUGIN_DLL_DOT_VERSION]" - VALUE "LegalTrademarks", "\0" - VALUE "MIMEType", "application/x-panda3d\0" - VALUE "FileExtents", "p3d\0" - VALUE "FileOpenName", "Panda3D applet\0" - VALUE "ProductName", "Panda3D Game Engine Runtime $[P3D_PLUGIN_VERSION_STR]\0" - VALUE "ProductVersion", "$[P3D_PLUGIN_DLL_DOT_VERSION]" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -ICON_FILE ICON "panda3d.ico" - -#end panda3d.rc - diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index bb1d1e6758..51ba813cb2 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -1420,17 +1420,14 @@ def printListEnum(l): pass # base class for all Panda C++ objects -# libdtoolconfig doesn't seem to have this, grab it off of PandaNode +# libdtoolconfig doesn't seem to have this, grab it off of TypedObject dtoolSuperBase = None def _getDtoolSuperBase(): global dtoolSuperBase from panda3d.core import TypedObject dtoolSuperBase = TypedObject.__bases__[0] - assert repr(dtoolSuperBase) == "" \ - or repr(dtoolSuperBase) == "" \ - or repr(dtoolSuperBase) == "" \ - or repr(dtoolSuperBase) == "" + assert dtoolSuperBase.__name__ == 'DTOOL_SUPER_BASE' safeReprNotify = None diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 23b1554ecd..82155713af 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -11,6 +11,8 @@ from panda3d.core import * from panda3d.direct import get_config_showbase, throw_new_frame, init_app_for_gui from panda3d.direct import storeAccessibilityShortcutKeys, allowAccessibilityShortcutKeys +# Register the extension methods for NodePath. +from direct.extensions_native import NodePath_extensions # This needs to be available early for DirectGUI imports import __builtin__ as builtins @@ -2512,6 +2514,8 @@ class ShowBase(DirectObject.DirectObject): rig.reparentTo(camera) self.graphicsEngine.openWindows() self.graphicsEngine.renderFrame() + self.graphicsEngine.renderFrame() + self.graphicsEngine.syncFrame() tex = buffer.getTexture() saved = self.screenshot(namePrefix = namePrefix, @@ -2602,6 +2606,7 @@ class ShowBase(DirectObject.DirectObject): # One more frame for luck. self.graphicsEngine.renderFrame() + self.graphicsEngine.syncFrame() saved = self.screenshot(namePrefix = namePrefix, defaultFilename = defaultFilename, diff --git a/direct/src/showbase/Sources.pp b/direct/src/showbase/Sources.pp deleted file mode 100644 index 09b7c92601..0000000000 --- a/direct/src/showbase/Sources.pp +++ /dev/null @@ -1,41 +0,0 @@ -#begin lib_target - #define TARGET p3showbase - #define LOCAL_LIBS \ - p3directbase - #define OTHER_LIBS \ - p3pgraph:c p3pgraphnodes:c p3gsgbase:c p3gobj:c p3mathutil:c p3pstatclient:c \ - p3downloader:c p3pandabase:c p3pnmimage:c p3prc:c \ - p3pipeline:c p3cull:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3display:c p3linmath:c p3event:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - - #define WIN_SYS_LIBS \ - User32.lib - - #define SOURCES \ - showBase.cxx showBase.h \ - $[if $[IS_OSX],showBase_assist.mm] - - #define IGATESCAN all -#end lib_target - -// Define a Python extension module for operating on frozen modules. -// This is a pure C module; it involves no Panda code or C++ code. -#begin lib_target - #define BUILD_TARGET $[HAVE_PYTHON] - #define TARGET p3extend_frozen - #define LIB_PREFIX - #if $[OSX_PLATFORM] - #define LINK_AS_BUNDLE 1 - #define BUNDLE_EXT .so - #endif - #if $[WINDOWS_PLATFORM] - #define DYNAMIC_LIB_EXT .pyd - #endif - - #define SOURCES extend_frozen.c -#end lib_target - diff --git a/direct/src/showbase/VFSImporter.py b/direct/src/showbase/VFSImporter.py index e092775e6e..eb2b7bd7d4 100644 --- a/direct/src/showbase/VFSImporter.py +++ b/direct/src/showbase/VFSImporter.py @@ -1,7 +1,7 @@ __all__ = ['register', 'sharedPackages', 'reloadSharedPackage', 'reloadSharedPackages'] -from panda3d._core import Filename, VirtualFileSystem, VirtualFileMountSystem, OFileStream, copyStream +from panda3d.core import Filename, VirtualFileSystem, VirtualFileMountSystem, OFileStream, copyStream import sys import marshal import imp diff --git a/direct/src/showutil/Sources.pp b/direct/src/showutil/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/stdpy/Sources.pp b/direct/src/stdpy/Sources.pp deleted file mode 100644 index 60f5d0bcdd..0000000000 --- a/direct/src/stdpy/Sources.pp +++ /dev/null @@ -1,2 +0,0 @@ -// For now, since we are not installing Python files, this file can -// remain empty. diff --git a/direct/src/stdpy/file.py b/direct/src/stdpy/file.py index 27257ad890..d6ef48cd9e 100644 --- a/direct/src/stdpy/file.py +++ b/direct/src/stdpy/file.py @@ -10,7 +10,7 @@ __all__ = [ 'execfile', ] -import panda3d._core as core +from panda3d import core import sys import os import io diff --git a/direct/src/task/Sources.pp b/direct/src/task/Sources.pp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 5374c135d2..63ee7fd271 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -19,6 +19,7 @@ except ImportError: signal = None from panda3d.core import * +from direct.extensions_native import HTTPChannel_extensions def print_exc_plus(): """ diff --git a/direct/src/tkpanels/Sources.pp b/direct/src/tkpanels/Sources.pp deleted file mode 100644 index a03ea8c336..0000000000 --- a/direct/src/tkpanels/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -// For now, since we are not installing Python files, this file can -// remain empty. - diff --git a/direct/src/tkwidgets/Sources.pp b/direct/src/tkwidgets/Sources.pp deleted file mode 100644 index a03ea8c336..0000000000 --- a/direct/src/tkwidgets/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -// For now, since we are not installing Python files, this file can -// remain empty. - diff --git a/direct/src/wxwidgets/Sources.pp b/direct/src/wxwidgets/Sources.pp deleted file mode 100644 index a03ea8c336..0000000000 --- a/direct/src/wxwidgets/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -// For now, since we are not installing Python files, this file can -// remain empty. - diff --git a/dmodels/Package.pp b/dmodels/Package.pp deleted file mode 100644 index dbfbbdf63a..0000000000 --- a/dmodels/Package.pp +++ /dev/null @@ -1,63 +0,0 @@ -// -// Package.pp -// -// This file defines certain configuration variables that are to be -// written into the various make scripts. It is processed by ppremake -// (along with the Sources.pp files in each of the various -// directories) to generate build scripts appropriate to each -// environment. -// -// This is the package-specific file, which should be at the top of -// every source hierarchy. It generally gets the ball rolling, and is -// responsible for explicitly including all of the relevent Config.pp -// files. - - - -// What is the name and version of this source tree? -#if $[eq $[PACKAGE],] - #define PACKAGE dmodels - #define VERSION 0.80 -#endif - - -// Where should we find the DIRECT source directory? -#if $[or $[CTPROJS],$[DIRECT]] - // If we are presently attached, use the environment variable. - #define DIRECT_SOURCE $[DIRECT] - #if $[eq $[DIRECT],] - #error You seem to be attached to some trees, but not DIRECT! - #endif -#else - // Otherwise, if we are not attached, we guess that the source is a - // sibling directory to this source root. - #define DIRECT_SOURCE $[standardize $[TOPDIR]/../direct] -#endif - -// Where should we install DMODELS? -#if $[DMODELS_INSTALL] - #define DMODELS_INSTALL $[unixfilename $[DMODELS_INSTALL]] -#elif $[or $[CTPROJS],$[DMODELS]] - #define DMODELS_INSTALL $[DMODELS]/built - #if $[eq $[DMODELS],] - #error You seem to be attached to some trees, but not DMODELS! - #endif -#else - #defer DMODELS_INSTALL $[INSTALL_DIR] -#endif - - -// Define the inter-tree dependencies. -#define NEEDS_TREES $[NEEDS_TREES] direct - - -// Also get the DIRECT Package file and everything that includes. -#if $[not $[isfile $[DIRECT_SOURCE]/Package.pp]] - #printvar DIRECT_SOURCE - #error DIRECT source directory not found from dmodels! Are you attached properly? -#endif - -#include $[DIRECT_SOURCE]/Package.pp - -// Define some global variables for this tree. -#define FLT2EGG_OPTS -no -uo ft diff --git a/dmodels/Sources.pp b/dmodels/Sources.pp deleted file mode 100644 index 395f6c15a0..0000000000 --- a/dmodels/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is the toplevel directory for a models tree. - -#define DIR_TYPE models_toplevel -#define TEXATTRIB_DIR src/maps diff --git a/dmodels/src/Sources.pp b/dmodels/src/Sources.pp deleted file mode 100644 index e88235a622..0000000000 --- a/dmodels/src/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE models_group diff --git a/dmodels/src/audio/Sources.pp b/dmodels/src/audio/Sources.pp deleted file mode 100644 index e88235a622..0000000000 --- a/dmodels/src/audio/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE models_group diff --git a/dmodels/src/audio/sfx/Sources.pp b/dmodels/src/audio/sfx/Sources.pp deleted file mode 100644 index aaf99b9c60..0000000000 --- a/dmodels/src/audio/sfx/Sources.pp +++ /dev/null @@ -1,9 +0,0 @@ -#define DIR_TYPE models -#define INSTALL_TO audio/sfx - -// General GUI Sounds -#begin install_audio - #define SOURCES \ - GUI_rollover.wav GUI_click.wav -#end install_audio - diff --git a/dmodels/src/fonts/Sources.pp b/dmodels/src/fonts/Sources.pp deleted file mode 100644 index e0185d5787..0000000000 --- a/dmodels/src/fonts/Sources.pp +++ /dev/null @@ -1,8 +0,0 @@ -#define DIR_TYPE models -#define INSTALL_TO models/fonts - - -//#begin install_egg -// #define SOURCES Comic.egg -//#end install_egg - diff --git a/dmodels/src/gui/Sources.pp b/dmodels/src/gui/Sources.pp deleted file mode 100644 index 4b336411af..0000000000 --- a/dmodels/src/gui/Sources.pp +++ /dev/null @@ -1,14 +0,0 @@ -#define DIR_TYPE models -#define INSTALL_TO models/gui - -#begin flt_egg - #define SOURCES $[wildcard *.flt] -#end flt_egg - -#begin install_egg - #define SOURCES $[patsubst %.flt,%.egg,$[wildcard *.flt]] -#end install_egg - -#begin install_egg - #define SOURCES radio_button_gui.egg -#end install_egg diff --git a/dmodels/src/icons/Sources.pp b/dmodels/src/icons/Sources.pp deleted file mode 100644 index 1e354e6c2e..0000000000 --- a/dmodels/src/icons/Sources.pp +++ /dev/null @@ -1,30 +0,0 @@ -#define DIR_TYPE models -#define INSTALL_TO icons - -#define fltfiles $[wildcard *.flt] -#begin flt_egg - #define SOURCES $[fltfiles] -#end flt_egg - -#define mayafiles $[wildcard *.mb] -#begin maya_egg - #define SOURCES $[mayafiles] -#end maya_egg - -#define eggfiles $[wildcard *.egg] -#begin egg - #define SOURCES $[eggfiles] -#end egg - -#begin install_icons - #define SOURCES \ - folder.gif minusnode.gif openfolder.gif plusnode.gif python.gif \ - sphere2.gif tk.gif dot_black.gif dot_blue.gif dot_green.gif \ - dot_red.gif dot_white.gif -#end install_icons - -#begin install_egg - #define SOURCES \ - $[fltfiles:%.flt=%.egg] $[mayafiles:%.mb=%.egg] \ - $[eggfiles] -#end install_egg diff --git a/dmodels/src/level_editor/Sources.pp b/dmodels/src/level_editor/Sources.pp deleted file mode 100644 index a1745b8d7f..0000000000 --- a/dmodels/src/level_editor/Sources.pp +++ /dev/null @@ -1,13 +0,0 @@ -#define DIR_TYPE models -#define INSTALL_TO models/level_editor - -#begin flt_egg - #define SOURCES $[wildcard *.flt] -#end flt_egg - - -// #begin install_egg -// #define SOURCES \ -// donalds_dock_layout.egg minnies_melody_land_layout.egg \ -// the_burrrgh_layout.egg toontown_central_layout.egg -// #end install_egg diff --git a/dmodels/src/maps/Sources.pp b/dmodels/src/maps/Sources.pp deleted file mode 100644 index 00f8dcbf15..0000000000 --- a/dmodels/src/maps/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -#define DIR_TYPE models - -// Nothing to install here. diff --git a/dmodels/src/misc/Sources.pp b/dmodels/src/misc/Sources.pp deleted file mode 100644 index a0ca3a2ab8..0000000000 --- a/dmodels/src/misc/Sources.pp +++ /dev/null @@ -1,22 +0,0 @@ -#define DIR_TYPE models -#define INSTALL_TO models/misc - -#begin flt_egg - #define SOURCES $[wildcard *.flt] -#end flt_egg - - -#begin install_egg - #define UNPAL_SOURCES \ - camera.egg rgbCube.egg xyzAxis.egg -#end install_egg - -#begin install_egg - #define SOURCES \ - gridBack.egg objectHandles.egg sphere.egg smiley.egg lilsmiley.egg -#end install_egg - -#begin install_egg - #define SOURCES \ - fade_sphere.egg fade.egg iris.egg -#end install_egg diff --git a/doc/Config.pp.sample b/doc/Config.pp.sample deleted file mode 100644 index 567961384b..0000000000 --- a/doc/Config.pp.sample +++ /dev/null @@ -1,41 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// Caution: there are two separate, independent build systems: -// 'makepanda', and 'ppremake'. Use one or the other, do not attempt -// to use both. This file is part of the 'ppremake' system. -/////////////////////////////////////////////////////////////////////// - -// This is a sample Config.pp that you may wish to use for your own -// needs. For a longer list of configuration variables that you may -// set in your own Config.pp file, see dtool/Config.pp. - -// What level of compiler optimization/debug symbols should we build? -// The various optimize levels are defined as follows: -// -// 1 - No compiler optimizations, full debug symbols -// 2 - Full compiler optimizations, full debug symbols -// (if the compiler supports this) -// 3 - Full compiler optimizations, no debug symbols -// 4 - Full optimizations, no debug symbols, and asserts removed -// -// Setting this has no effect when BUILD_TYPE is "stopgap". In this -// case, the compiler optimizations are selected by setting the -// environment variable OPTIMIZE accordingly at compile time. -#define OPTIMIZE 3 - - - -// If you have installed the DirectX SDK in a particular location on -// your machine (currently, Panda requires DirectX 8.1 in order to -// build the DirectX interfaces), then you must indicate that location -// here. These two variables point to the include and lib -// directories, respectively. - -// Note the use of the Panda filename convention, with forward slashes -// instead of backslashes, and /c/ instead of c:/ . -#define DX9_IPATH /c/DXSDK-DEC2006/include -#define DX9_LPATH /c/DXSDK-DEC2006/lib - -// If for any reason you need to turn off the DX9 builds, -// you can uncomment the following line. (Defining a -// variable to an empty string means setting it false.) -//#define HAVE_DX9 diff --git a/doc/INSTALL-MK b/doc/INSTALL similarity index 97% rename from doc/INSTALL-MK rename to doc/INSTALL index 6fc7dbdbd1..4157e03957 100644 --- a/doc/INSTALL-MK +++ b/doc/INSTALL @@ -1,10 +1,3 @@ - -/////////////////////////////////////////////////////////////////////// -// Caution: there are two separate, independent build systems: -// 'makepanda', and 'ppremake'. Use one or the other, do not attempt -// to use both. This file is part of the 'makepanda' system. -/////////////////////////////////////////////////////////////////////// - Panda3D Install --- using the 'makepanda' system. NOTE: As the makepanda build system changes more frequently @@ -44,9 +37,8 @@ directory will contain the following subdirectories: models - piece 1, source code from github panda - piece 1, source code from github pandatool - piece 1, source code from github - ppremake - piece 1, source code from github contrib - piece 1, source code from github - samples - piece 1, sample programs + samples - piece 1, source code from github thirdparty - piece 2, third party tools diff --git a/doc/INSTALL-PP b/doc/INSTALL-PP deleted file mode 100644 index 2f3fc57087..0000000000 --- a/doc/INSTALL-PP +++ /dev/null @@ -1,885 +0,0 @@ - -/////////////////////////////////////////////////////////////////////// -// Caution: there are two separate, independent build systems: -// 'makepanda', and 'ppremake'. Use one or the other, do not attempt -// to use both. This file is part of the 'ppremake' system. -/////////////////////////////////////////////////////////////////////// - -Panda3D Install --- using the 'ppremake' system. - -This document describes how to compile and install Panda 3D on a -system for the first time. Panda is a complex project and is not -trivial to install, although it is not really very difficult. Please -do take the time to read this document before starting. - -Panda is known to build successfully on Linux, SGI Irix, and Windows -NT/2000/XP. It should also be easily portable to other Unix-based -OpenGL systems with little or no changes (please let us know if you -try this). When compiled by Windows NT/2000/XP, it will then run on a -Windows 98 system, but we have found that Windows 98 is not itself -stable enough to compile the codebase without crashing. - -Before you begin to compile Panda, there are a number of optional -support libraries that you may wish to install. None of these are -essential; Panda will build successfully without them, but possibly -without some functionality. - -* Python. Panda is itself a C++ project, but it can generate a - seamless Python interface layer to its C++ objects and function - calls. Since Python is an interpreted language with a command - prompt, this provides an excellent way to get interactive control - over the 3-D environment. However, it is not necessary to use the - Python interface; Panda is also perfectly useful without Python, as - a C++ 3-D library. - - Other scripting language interfaces are possible, too, in theory. - Panda can generate an interface layer for itself that should be - accessible by any scripting language that can make C function calls - to an external library. We have used this in the past, for - instance, to interface Panda with Squeak, an implementation of - Smalltalk. At the present, the Python interface is the only one we - actively maintain. We use Python 2.2, but almost any version should - work; you can get Python at http://www.python.org . - -* NSPR. This is the Netscape Portable Runtime library, an OS - compatibility layer written by the folks at Mozilla for support of - the Netscape browser on different platforms. Panda takes advantage - of NSPR to implement threading and network communications. At the - present, if you do not have NSPR available Panda will not be able to - fork threads and will not provide a networking interface. Aside - from that, the PStats analysis tools (which depend on networking) - will not be built without NSPR. We have compiled Panda with NSPR - version 3 and 4.0, although other versions should also work. You - can download NSPR from http://www.mozilla.org/projects/nspr/ . - -* VRPN, the "Virtual Reality Peripheral Network," a peripheral - interface library designed by UNC. This is particularly useful for - interfacing Panda with external devices like trackers and joysticks; - without it, Panda can only interface with the keyboard and mouse. - You can find out about it at http://www.cs.unc.edu/Research/vrpn . - -* libjpeg, libtiff, libpng. These free libraries provide support to - Panda for reading and writing JPEG, TIFF, and PNG image files, for - instance for texture images. Even without these libraries, Panda - has built-in support for pbm/pgm/ppm, SGI (rgb), TGA, BMP, and a few - other assorted image types like Alias and SoftImage native formats. - Most Linux systems come with these libraries already installed, and - the version numbers of these libraries is not likely to be - important. You can download libjpeg from the Independent JPEG group - at http://www.ijg.org , libtiff from SGI at - ftp://ftp.sgi.com/graphics/tiff , and libpng from - http://www.libpng.org . - -* zlib. This very common free library provides basic - compression/decompression routines, and is the basis for the Unix - gzip tool (among many other things). If available, Panda uses it to - enable storing compressed files within its native multifile format, - as well as in a few other places here and there. It's far from - essential. If you don't have it already, you can get it at - http://www.gzip.org/zlib . - -* Fmod. This is a free sound library that our friends at CMU have - recently integrated into Panda. It provides basic support for - playing WAV files, MP3 files, and MIDI files within Panda. Get it - at http://www.fmod.org . - -* Freetype. This free library provides support for loading TTF font - files (as well as many other types of font files) directly for - rendering text within Panda (using Panda's TextNode interface, as - well as the whole suite of DirectGui 2-d widgets in direct). If you - do not have this library, you can still render text in Panda, but - you are limited to using fonts that have been pre-generated and - stored in egg files. There are a handful of provided font files of - this nature in the models directory (specifically, cmr12, cmss12, - and cmtt12); these were generated from some of the free fonts - supplied with TeX. This can be found at http://www.freetype.org ; - you will need at least version 2.0. - -* OpenSSL. This free library provides an interface to secure SSL - communications (as well as a normal, unsecured TCP/IP library). It - is used to implement the HTTP client code in Panda for communicating - with web servers and/or loading files directly from web servers, in - both normal http and secure https modes. It also provides some - basic encryption services, allowing encrypted files to be stored in - metafiles (for instance). If you do not have any need to contact - web servers with your Panda client, and you have no interest in - encryption, you do not need to install this library. Find it at - http://www.openssl.org . We used version 0.9.6 or 0.9.7, but if - there is a more recent version it should be fine. - -* FFTW, the "Fastest Fourier Transform in the West". This free - whimsically-named library provides the mathematical support for - compressing animation tables into Panda's binary bam format. If - enabled, animation tables can be compressed in a lossy form similar - to jpeg, which provides approximately a 5:1 compression ratio better - than gzip alone even at the most conservative setting. If you don't - need to have particularly small animation files, you don't need this - library. Get it at http://www.fftw.org . - -* Gtk--. This is a C++ graphical toolkit library, and is only used - for one application, the PStats viewer for graphical analysis of - real-time performance, which is part of the pandatool package. - Gtk-- only compiles on Unix, and primarily Linux; it is possible to - compile it with considerable difficulty on Irix. (On Windows, you - don't need this, since you will use the pstats viewer built in the - win-stats subdirectory instead.) We have used version 1.2.1. You - can find it at http://www.gtkmm.org . - - -PANDA'S BUILD PHILOSOPHY - -Panda is divided into a number of separate packages, each of which -compiles separately, and each of which generally depends on the ones -before it. The packages are, in order: - - dtool - this defines most of the build scripts and local - configuration options for Panda. It also includes the program - "interrogate," which is used to generate the Python interface, as - well as some low-level libraries that are shared both by - interrogate and Panda. It is a fairly small package. - - panda - this is the bulk of the C++ Panda code. It contains the 3-D - engine itself, as well as supporting C++ interfaces like - networking, audio, and device interfaces. Expect this package to - take from 30 to 60 minutes to build from scratch. You must build - and install dtool before you can build panda. - - direct - this is the high-level Python interface to Panda. Although - there is some additional C++ interface code here, most of the code - in this package is Python; there is no reason to install this - package if you are not planning on using the Python interface. - DIRECT is an acronym, and has nothing to do with DirectX. - You must build and install dtool and panda before you can build - direct. - - pandatool - this is a suite of command-line utilities, written in - C++ using the Panda libraries, that provide useful support - functionality for Panda as a whole, like model-conversion - utilities. You must build and install dtool and panda before you - can build pandatool, although it does not depend on direct. - - pandaapp - this holds a few sample applications that link with panda - (and pandatool), but are not generally useful enough to justify - putting them in pandatool. Most of these are not actually - graphical applications; they just take advantage of the various - support libraries (like HTTPClient) that Panda provides. At the - moment, most people probably won't find anything useful here, but - you're welcome to browse; and we will probably add more - applications later. You must build and install dtool, panda, anda - pandatool before you can build pandaapp. - -In graphical form, here are the packages along with a few extras: - - +------------------------------+ - | Your Python Application Here | - +------------------------------+ - | - | +-----------+ - | | pandaapp | - | +-----------+ - | | - V V - +--------+ +-----------+ +---------------------------+ - | direct | | pandatool | | Your C++ Application Here | - +--------+ +-----------+ +---------------------------+ - | | | - +-------------+-------------------/ - V - +-------+ - | panda | - +-------+ - | - V - +-------+ - | dtool | - +-------+ - -The arrows above show dependency. - - -Usually, these packages will be installed as siblings of each other -within the same directory; the build scripts expect this by default, -although other installations are possible. - -In order to support multiplatform builds, we do not include makefiles -or project files with the sources. Instead, all the compilation -relationships are defined in a series of files distributed throughout -the source trees, one per directory, called Sources.pp. - -A separate program, called ppremake ("Panda pre-make") reads the -various Sources.pp files, as well as any local configuration -definitions you have provided, and generates the actual makefiles that -are appropriate for the current platform and configuration. It is -somewhat akin to the idea of GNU autoconf ("configure"), although it -is both less automatic and more general, and it supports non-Unix -platforms easily. - - -HOW TO CONFIGURE PANDA FOR YOUR ENVIRONMENT - -When you run ppremake within a Panda source tree, it reads in a number -of configuration variable definitions given in the file Config.pp in -the root of the dtool package, as well as in a custom Config.pp file -that you specify. Many of the variables in dtool/Config.pp will -already have definitions that are sensible for you; some will not. -You must customize these variables before you run ppremake. - -Normally, rather than modifying dtool/Config.pp directly, you should -create your own, empty Config.pp file. By default, this file should -be stored in the root of the Panda install directory, as specified -when you built ppremake, but you may put it elsewhere if you prefer by -setting the environment variable PPREMAKE_CONFIG to its full filename -path (more on this in the platform-specific installation notes, -below). - -The definitions you give in your personal Config.pp file will override -those given in the file within dtool. It is also possible simply to -modify dtool/Config.pp, but this is not recommended as it makes it -difficult to remember which customizations you have made, and makes -installing updated versions of Panda problematic. - -The syntax of the Config.pp file is something like a cross between the -C preprocessor and Makefile syntax. The full syntax of ppremake input -scripts is described in more detail in another document, but the most -common thing you will need to do is set the value of a variable using -the #define statement (or the mostly equivalent #defer statement). -Look in dtool/Config.pp for numerous examples of this. - -Some of the variables you may define within the Config.pp file hold a -true or a false value by nature. It is important to note that you -indicate a variable is true by defining it to some nonempty string -(e.g. "yes" or "1"), and false by defining it to nothing. For -example: - - #define HAVE_DX9 1 - -Indicates you have the DirectX SDK installed, while - - #define HAVE_DX9 - -Indicates you do not. Do not be tempted to define HAVE_DX9 to no or 0; -since these are both nonempty strings, they are considered to -represent true! Also, don't try to use a pair of quotation marks to -represent the empty string, since the quotation marks become part of -the string (which is thus nonempty). - -The comments within dtool/Config.pp describe a more complete list of -the variables you may define. The ones that you are most likely to -find useful are: - - INSTALL_DIR - this is the prefix of the directory hierarchy into - which Panda should be installed. If this is not defined, the - default value is compiled into ppremake. A full description on - setting this parameter is given below in the section describing - how to build ppremake. On Unix systems this is taken from the - --prefix parameter to configure (usually /usr/local/panda); for - Windows users it is specified in config_msvc.h, and is set to - C:\Panda3d unless you modify it. - - OPTIMIZE - define this to 1, 2, 3, or 4. This is not the same thing - as compiler optimization level; our four levels of OPTIMIZE define - broad combinations of compiler optimizations and debug symbols: - - 1 - No compiler optimizations, full debug symbols - Windows: debug heap - 2 - Full compiler optimizations, debug symbols - Windows: debug heap - 3 - Full compiler optimizations, - Unix: no debug symbols - Windows: non-debug heap, debug symbols available in pdb files - 4 - Full optimizations, no debug symbols, and asserts removed - Windows: non-debug heap - - Usually OPTIMIZE 3 is the most appropriate choice for development - work. We recommend OPTIMIZE 4 only for final QA and/or - distribution of a shippable product, never for any development or - alpha testing; and we recommend OPTIMIZE levels 1 and 2 only for - active development of the C++ code within Panda. - - PYTHON_IPATH / PYTHON_LPATH / PYTHON_LIBS - the full pathname to - Python header files, if Python is installed on your system. As of - Python version 2.0, compiling Python interfaces doesn't require - linking with any special libraries, so normally PYTHON_LPATH and - PYTHON_LIBS are left empty. You definitely need to set - PYTHON_IPATH, however, if you wish to compile Panda so that it can - be used from Python. - - NSPR_IPATH / NSPR_LPATH / NSPR_LIBS - the full pathname to NSPR - header and library files, and the name of the NSPR library, if - NSPR is installed on your system. - - VRPN_IPATH / VRPN_LPATH / VRPN_LIBS - the full pathname to VRPN - header and library files, and the name of the VRPN libraries, if - VRPN is installed on your system. - - DX9_IPATH / DX9_LPATH / DX9_LIBS - the full pathname to the - DirectX 9 SDK header and library files, if you have installed - this SDK. (You must currently install this SDK in order to - build DirectX9 support for Panda.) - - GL_IPATH / GL_LPATH / GL_LIBS - You get the idea. (Normally, OpenGL - is installed in the standard system directories, so you can leave - GL_IPATH and GL_LPATH empty. But if they happen to be installed - somewhere else on your machine, you can fill in the pathnames - here.) - - Similar *_IPATH / *_LPATH / *_LIBS variables for other optional - third-party libraries. - - - -HOW TO BUILD PANDA ON A UNIX SYSTEM - -First, make a subdirectory to hold the Panda sources. This can be -anywhere you like; in these examples, we'll assume you build -everything within a directory called "panda3d" in your home directory. - - mkdir ~/panda3d - -You should also create the directory into which panda should be -installed. The default installation directory is /usr/local/panda. -You may choose an alternate installation directory by using the ---prefix parameter to the ppremake configure script, described below. -We recommend giving yourself write permission to this directory, so -that you can run 'make install' and similar scripts that will need to -write to this installation directory, without having to be root. - su root - mkdir /usr/local/panda - chown /usr/local/panda - exit - -Whatever you choose for your installation directory, you should make -sure the bin directory (e.g. /usr/local/panda/bin) is included on your -search path, and the lib directory (e.g. /usr/local/panda/lib) is on -your LD_LIBRARY_PATH. If you use a C-shell derivative like tcsh, the -syntax for this is: - - set path=(/usr/local/panda/bin $path) - setenv LD_LIBRARY_PATH /usr/local/panda/lib:$LD_LIBRARY_PATH - -If you have a Bourne-shell derivative, e.g. bash, the syntax is: - - PATH=/usr/local/panda/bin:$PATH - LD_LIBRARY_PATH=/usr/local/panda/lib:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - - -You must now compile ppremake before you can begin to compile Panda -itself. Generally, you do something like the following: - - cd ~/panda3d/ppremake - ./configure - make - make install - -If the configure script does not already exist, read the document -BUILD_FROM_CVS.txt in the ppremake source directory. - -As mentioned above, the default installation directory is -/usr/local/panda. Thus, ppremake will install itself into -/usr/local/panda/bin. If you prefer, you can install Panda into -another directory by doing something like this: - - ./configure --prefix=/my/install/directory - make - make install - -Now you should create your personal Config.pp file, as described -above, and customize whatever variables are appropriate. By default, -ppremake will look for this file in the root of the install directory, -e.g. /usr/local/panda/Config.pp. If you want to put it somewhere -else, for instance in your home directory, you must set the -PPREMAKE_CONFIG environment variable to point to it: - - setenv PPREMAKE_CONFIG ~/Config.pp - -In bash: - - PPREMAKE_CONFIG=~/Config.pp - export PPREMAKE_CONFIG - -You may find it a good idea to make this and other environment -settings in your .cshrc or .bashrc file so that they will remain set -for future sessions. - -Now you can test the configuration settings in your Config.pp file: - - cd ~/panda3d/dtool - ppremake - -When you run ppremake within the dtool directory, it will generate a -file, dtool_config.h (as well as all of the Makefiles). This file -will be included by all of the Panda3D sources, and reveals the -settings of many of the options you have configured. You should -examine this file now to ensure that your settings have been made the -way you expect. - -Note that ppremake will also try to create several subdirectories in -the install directory, so you must have write access to the install -directory in order for ppremake to run completely successfully. If -you did not choose to give yourself write access to the install -directory, you may run ppremake as root; in this case we recommend -running ppremake first as a normal user in order to compile, and then -running ppremake again as root just before running make install as -root. - -Now that you have run ppremake, you can build the Panda3D sources. -Begin with dtool (the current directory): - - make - make install - -Once you have successfully built and installed dtool, you can then -build and install panda: - - cd ~/panda3d/panda - ppremake - make - make install - -After installing panda, you are almost ready to run the program -"pview," which is a basic model viewer program that demonstrates some -Panda functionality (see HOW TO RUN PANDA, below). Successfully -running pview proves that Panda is installed and configured correctly -(at least as a C++ library). - -If you wish, you may also build direct. You only need to build this -if you intend to use the Python interfaces. - - cd ~/panda3d/direct - ppremake - make - make install - -And you may build pandatool. You only need to build this if you want -to take advantage of model conversion utilities for Panda like -maya2egg and egg2bam, or if you want to use other tools like pstats. - - cd ~/panda3d/pandatool - ppremake - make - make install - - - -HOW TO BUILD PANDA ON A WINDOWS SYSTEM, USING CYGWIN - -Cygwin is a set of third-party libraries and tools that present a very -Unix-like environment for Windows systems. If you prefer to use a -Unix environment, Cygwin is the way to go. You can download Cygwin -for free from http://www.cygwin.com. - -Panda can build and run within a Cygwin environment, but it does not -require it. Note that Cygwin is used strictly as a build environment; -the Cygwin compiler is not used, so no dependency on Cygwin will be -built into Panda. The Panda DLL's that you will generate within a -Cygwin environment will be exactly the same as those you would -generate in a non-Cygwin environment; once built, Panda will run -correctly on any Win32 machine, with or without Cygwin installed. - -If you do not wish to install Cygwin for your build environment, see -the instructions below. - -If you wish to use Cygwin, there is one important point to keep in -mind. Panda internally uses a Unix-like filename convention; that is, -forward slashes (instead of backslashes) separate directory -components, and there is no leading drive letter on any filename. -These Unix-like filenames are mapped to Windows filenames (with drive -letters and backslashes) when system calls are made. - -Cygwin also uses a Unix-like filename convention, and uses a series of -mount commands to control the mapping of Unix filenames to Windows -filenames. Panda is not itself a Cygwin program, and does not read -the Cygwin mount definitions. - -That's important enough it's worth repeating. Panda is not aware of -the Cygwin mount points. So a Unix-like filename that makes sense to -a Cygwin command may not be accessible by the same filename from -within Panda. - -However, you can set things up so that most of the time, Cygwin and -Panda agree, which is convenient. To do this, it is important to -understand how Panda maps Unix-like filenames to Windows filenames. - - * Any relative pathname (that is, a pathname that does not begin - with a leading slash) is left unchanged, except to reverse the - slashes. - - * Any full pathname whose topmost directory component is *not* a - single letter is prepended with the contents of the environment - variable PANDA_ROOT. - - * Any full pathname whose topmost directory component *is* a single - letter is turned into a drive letter and colon followed by the - remainder of the path. For example, /c/windows/system is turned - into C:\windows\system. - -The expectation is that most of the files you will want to access -within Panda will all be within one directory structure, which you -identify by setting the PANDA_ROOT variable. Generally, when you are -using Cygwin, you will want to set this variable to be the same thing -as the root of your Cygwin tree. - -For instance, typically Cygwin installs itself in C:\Cygwin. This -means that when you reference the directory /usr/local/bin within -Cygwin, you are actually referring to C:\Cygwin\usr\local\bin. You -should therefore set PANDA_ROOT to C:\Cygwin, so that /usr/local/bin -within Panda will also refer to C:\Cygwin\usr\local\bin. - -To sum up: to use Panda within a Cygwin environment, - -In tcsh: - - setenv PANDA_ROOT 'C:\Cygwin' - -or in bash: - - PANDA_ROOT='C:\Cygwin' - export PANDA_ROOT - -(In fact, you do not actually have to set PANDA_ROOT if Cygwin is -installed into C:\Cygwin, since this is Panda's default behavior if -C:\Cygwin exists. But it's important to understand what Panda is -doing to remap directories, and in particular that there is no -relationship to any actual Cygwin mount points.) - -There is one additional point: you will need to ensure that the Visual -Studio command-line utilities (like cl.exe) are available on your -path. Set your path appropriately to point to them, if necessary (or -run vcvars32.bat to do it for you; see the paragraph below.) - -Follow the instructions under HOW TO BUILD PANDA FOR A UNIX -ENVIRONMENT, above. - - - -HOW TO BUILD PANDA ON A WINDOWS SYSTEM, WITHOUT CYGWIN - -You will have to make sure that you installed the command-line -utilities on your system path when you installed Visual Studio, or you -can run the batch file vcvars32.bat to put these utilities on your -path for the current session (this batch file is in a directory like -c:\Program Files\Microsoft Visual Studio .Net\Vc7\bin). - -Microsoft provides a command-line make utility with Visual Studio -called nmake, although it's nowhere near as robust as the GNU make -utility provided with Cygwin. But Panda can generate Makefiles that -follow the nmake convention, and will do so by default if your -ppremake was not built with the Cygwin tools. - -You will need a directory for holding the installed Panda. This can -be anywhere you like; the default is C:\Panda3d. If you choose to -specify otherwise you should modify the INSTALL_DIR line in -ppremake\config_msvc.h before you build ppremake (below). -(Alternatively, you can leave ppremake alone and simply redefine -INSTALL_DIR in your Config.pp file, but then you will also need to -define the environment variable PPREMAKE_CONFIG to point to your -Config.pp.) - - md C:\Panda3d - -You will first need to build a copy of ppremake.exe. There is a -Microsoft VC7 project file in the ppremake directory that will build -this. Once it is built, copy it to the Panda bin directory (which you -will have to make yourself). This will be a directory called "bin" -below the root of the installed directory you created above; for -instance, C:\Panda3d\bin. - -Make sure the Panda bin and lib directories are on your path, and set -a few environment variables for building. We suggest creating a file -called PandaEnv.bat to hold these commands; then you may invoke this -batch file before every Panda session to set up your environment -properly. Alternatively, you may make these definitions in the -registry. - - path C:\Panda3d\bin;C:\Panda3d\lib;%PATH% - set PANDA_ROOT=C:\ - -Setting PANDA_ROOT is optional; it specifies the default drive Panda -will search for file references. (Panda internally uses a Unix-like -filename convention, which does not use leading drive letters. See -the bullet points in the Cygwin section, above, describing the rules -Panda uses to map its Unix-like filenames to Windows filenames.) - -Now make a directory for building Panda. This may be different from -the directory, above, that holds the installed Panda files; or it may -be the same. In this example we assume you will be building in the -same directory, C:\Panda3d. - -Now set up your personal Config.pp file to control your local -configuration settings, as described above. By default, ppremake will -look for this file in the root of the install directory, -e.g. C:\Panda3d\Config.pp; if you want to put it somewhere else you -should define the environment variable PPREMAKE_CONFIG to the full -path to your Config.pp. - -Use your favorite text editor to add the appropriate lines to your -Config.pp to define the correct paths to the various third-party -packages you have installed on your system. See HOW TO CONFIGURE -PANDA FOR YOUR ENVIRONMENT, above. - - edit C:\Panda3d\Config.pp - - -Now you can test the configuration settings in your Config.pp file: - - C: - cd \Panda3d\dtool - ppremake - -When you run ppremake within the dtool directory, it will generate a -file, dtool_config.h (as well as all of the Makefiles). This file -will be included by all of the Panda3D sources, and reveals the -settings of many of the options you have configured. You should -examine this file now to ensure that your settings have been made the -way you expect. - -Now that you have run ppremake, you can build the Panda3D sources. -Begin with dtool (the current directory): - - nmake - nmake install - -Once you have successfully built and installed dtool, you can then -build and install panda: - - cd \Panda3d\panda - ppremake - nmake - nmake install - -After installing panda, you are almost ready to run the program -"pview," which is a basic model viewer program that demonstrates some -Panda functionality (see HOW TO RUN PANDA, below). Successfully -running pview proves that Panda is now installed and configured -correctly (at least as a C++ library). - -If you wish, you may also build direct. You only need to build this -if you intend to use the Python interfaces. - - cd \Panda3d\direct - ppremake - nmake - nmake install - -And you may build pandatool. You only need to build this if you want -to take advantage of model conversion utilities for Panda like -maya2egg and egg2bam, or if you want to use other tools like pstats. - - cd \Panda3d\pandatool - ppremake - nmake - nmake install - - - - - -HOW TO RUN PANDA - -Once Panda has been successfully built and installed, you should be -able to run pview to test that everything is working (you might need -to type rehash first if you use csh): - - pview - -If you get an error about some shared library or libraries not being -found, check that your LD_LIBRARY_PATH setting (on Unix) or your PATH -(on Windows) includes the directory in which all of the Panda -libraries have been installed. (This is normally $INSTALL_DIR/lib, or -whatever you set INSTALL_DIR to followed by "lib". On Unix, this -defaults to /usr/local/panda/lib. If you have redefined -INSTALL_LIB_DIR in your Config.pp, for instance to define Panda as a -native Python module, you should use that directory instead.) - -If all goes well, pview should open up a window with a blue triangle. -You can use the mouse to move the triangle around. You can also pass -on the command line the name of an egg or bam file, if you have one -(look in the models directory for some sample egg files), and pview -will load up and display the model. - - -There are several files in the $INSTALL_DIR/etc directory with the -filename extension .prc; these are Panda Runtime Configuration files. -These are different from the Config.pp file, which controls the way -Panda is compiled and is only used at build time. The prc files are -read in every time Panda is started and control the way Panda behaves -at runtime. - -The system-defined prc files begin with digits, so that they sort to -the top of the list and are read first (and so that you may define one -or more additional files that are read afterwards and that will -therefore override the values specified in these system files). The -digits also imply an ordering between the prc files. We recommend -that you name your own prc file(s) beginning with letters, unless for -some reason you need a file to be loaded before one of the -system-defined prc files. - -We suggest creating a file in $INSTALL_DIR/etc called Config.prc, into -which you will put your own custom configuration options. For -instance, if you want to run using OpenGL instead of the Windows -default of DirectX9, you can add the line: - -load-display pandagl - -to your Config.prc file. If you choose not to do this at this time, -you can just leave this file empty for now; however, we do recommend -creating at least an empty Config.prc file as a placeholder into which -you can add your custom configuration options later. - -The complete list of available configuration options is very large and -is not fully documented; but there are other documents that list -several particularly useful config variables. These are sometimes -referred to as "Configrc" variables because an older Panda convention -named this file Configrc instead of Config.prc. - -If you want to load Config.prc from other than the compiled-in default -directory of $INSTALL_DIR/etc, set the environment variable: - - PRC_DIR=/my/home/directory - export PRC_DIR - -Where /my/home/directory is the name of your home directory (or -wherever you put the Config.prc file). Note that if you redefine -PRC_DIR, you will no longer automatically load the standard prc files -that were installed into $INSTALL_DIR/etc (so you should consider -copying these files into the same directory). It is possible to -configure Panda to search for prc files in more than one directory, -but that's a little more complicated and is outside the scope of this -document. - - - - - -HOW TO BUILD THE PYTHON INTERFACES - -You may stop now if you only intend to use Panda as a C++ library. -However, if you wish to use Panda from within Python, you must now -generate the Python interfaces. - -There are two parts to the Python interface for Panda. The first part -is a series of wrapper functions that are compiled into the Panda -libraries themselves, along with associated *.in files that describe -the class hierarchy. If you defined PYTHON_IPATH correctly in your -Config.pp file, then Python should have been detected by ppremake, and -it would have generated makefiles to build these wrappers -automatically. (You would have seen the program "interrogate" running -within each directory as panda was building, and you will have a -number of *.in files now installed into $INSTALL_DIR/etc.) - -If, for some reason, the interrogate program did not run, perhaps -because you defined an invalid directory in PYTHON_IPATH, you can go -back and fix this now, and simply re-run ppremake and make install -again in each of dtool, panda, and direct. - -To make Panda accessible to Python, you will need to add -$INSTALL_DIR/lib to your PYTHONPATH variable, e.g.: - - setenv PYTHONPATH ${PYTHONPATH}:/usr/local/panda/lib - -Or, on Windows: - - set PYTHONPATH=%PYTHONPATH%;C:\Panda3d\lib - -We recommend the PYTHONPATH approach for most users, since it keeps -all of the Panda files within one directory and doesn't clutter up the -Python distribution. However, if you only intend to use Panda from -Python, and especially if you want to make it accessible to multiple -users, it may be more attractive to install the Panda libraries as a -standard Python module, so that it is not necessary to modify your -PYTHONPATH variable; see "Installing Panda as a standard Python -module", below. - -The second part to the Python interface is a series of generated -Python wrapper classes, for each C++ class detected by interrogate. -These classes must be generated after all of the C++ code has been -compiled and installed. Execute the following command (you might need -to type rehash first if you use csh): - - genPyCode - -This is a script that was installed into $INSTALL_DIR/bin as part of -the build of direct. It invokes Python to read the *.in files -generated by interrogate, and generates the appropriate wrapper -functions, which are then written into $INSTALL_DIR/lib/pandac. -(There will be several hundred generated Python modules, which are -normally "squeezed" into a single file called PandaModules.pyz using -PythonWare's SqueezeTool. This squeeze step gives a significant -load-time speedup, especially on Windows; but if it causes problems, -you can use the option -n, e.g. 'genPyCode -n', to avoid it.) - -You will need to re-run this script only if the Panda interface -changes, e.g. if a class is added or a method's parameters change. -You should certainly re-run it any time you update and install a new -version of Panda. - - -Installing Panda as a native Python module - -Panda can be optionally configured to install its run-time interfaces -into the Python installation directory, instead of into the normal -$INSTALL_DIR/lib directory. This means you can run Panda from Python -without having to set your PYTHONPATH variable, but it does clutter up -your Python distribution a bit. - -To do this, simply add something like the following line to your -Config.pp: - - #define INSTALL_LIB_DIR /usr/lib/python2.2/site-packages - -Where you give the actual path to the site-packages directory for your -particular installation of Python. On Windows, this will probably -look something like this: - - #define INSTALL_LIB_DIR C:\Python22\Lib\site-packages - -Then go back and re-run ppremake and make install in each of dtool, -panda, and direct, and then re-run genPyCode, to install the Panda -libraries and Python files directly into the Python site-packages -directory. - -You may also need to set your LD_LIBRARY_PATH (on Unix) or PATH (on -Windows) to reference this new directory instead of $INSTALL_DIR/lib, -especially if you want to be able to run any of the Panda standalone -programs occasionally, like pview or any of the model converters. - -Unix users should note that you must have write permission to the -site-packages directory in order to install files there. You may -choose to run these install steps (ppremake, make install, genPyCode) -as root to avoid this problem. If you encounter difficulty running -genPyCode as root, make sure that you still have LD_LIBRARY_PATH -defined appropriately once you have become root. - - -Testing the Python interface - -Assuming that you have already set up your Config.prc file and tested -that pview works, as described above in HOW TO RUN PANDA, you should -now be ready to try to run Panda from within Python. Start up a -Python shell and type the following command: - - Python 2.2.2 (#37, Feb 10 2003, 18:00:06) [MSC 32 bit (Intel)] on win32 - Type "help", "copyright", "credits" or "license" for more information. - >>> import direct.directbase.DirectStart - -You should see a graphics window come up, very similar to the one you -saw when you ran pview. To load a particular model file into the -scene, try something like this: - - >>> m = loader.loadModel('/c/Panda3d/models/smiley.egg') - >>> m.reparentTo(render) - >>> run() - -Note that Panda expects a forward-slash convention for pathnames, with -no leading drive letter, even on a Windows system. See the full -description of how Panda maps these pathnames to Windows pathnames in -HOW TO BUILD PANDA ON A WINDOWS SYSTEM, USING CYGWIN, above. - -You can now move the scene around with the mouse, just as in pview -(you may need to pull the camera back by dragging upwards while -holding down the right mouse button in order to see the model). - -Congratulations! Panda 3D is now successfully installed. See the -online documentation available at http://www.etc.cmu.edu/panda3d/ for -more help about where to go next. diff --git a/dtool/Config.Android.pp b/dtool/Config.Android.pp deleted file mode 100644 index ff4e57f89e..0000000000 --- a/dtool/Config.Android.pp +++ /dev/null @@ -1,374 +0,0 @@ -// -// Config.Android.pp -// -// This file defines some custom config variables for the Android -// platform. It makes some initial guesses about compiler features, -// etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -// Android is a Linux distribution. -#define IS_LINUX 1 - -// These libraries are provided by the Android NDK. -#define ZLIB_IPATH -#define ZLIB_LPATH -#define ZLIB_LIBS z -#define HAVE_ZLIB 1 - -#define GLES_IPATH -#define GLES_LPATH -#define GLES_LIBS GLESv1_CM -#define HAVE_GLES 1 - -#define GLES2_IPATH -#define GLES2_LPATH -#define GLES2_LIBS GLESv2 -#define HAVE_GLES2 1 - -#define EGL_IPATH -#define EGL_LPATH -#define EGL_LIBS EGL -#define HAVE_EGL 1 - -// We don't have these, of course, so let's disable -// them for convenience in case they were autodetected. -#define HAVE_DX9 -#define HAVE_CG - -// Compiler flags -#defer TOOLCHAIN_PATH $[ANDROID_NDK_HOME]/toolchains/$[ANDROID_TOOLCHAIN]/prebuilt/windows/bin -#defer TOOLCHAIN_PREFIX $[if $[eq $[ANDROID_ABI],x86],i686-linux-android,$[ANDROID_ABI]] -#defer CC $[TOOLCHAIN_PATH]/$[TOOLCHAIN_PREFIX]-gcc -#defer CXX $[TOOLCHAIN_PATH]/$[TOOLCHAIN_PREFIX]-g++ -#defer AR $[TOOLCHAIN_PATH]/$[TOOLCHAIN_PREFIX]-ar -#define C++FLAGS_GEN -fno-exceptions -fno-rtti - -#defer SYSROOT $[ANDROID_NDK_HOME]/platforms/$[ANDROID_PLATFORM]/arch-$[ANDROID_ARCH] -#defer SYSROOT_FLAGS --sysroot=$[subst \,/,$[osfilename $[SYSROOT]]] - -#defer EXTRA_IPATH $[ANDROID_NDK_HOME]/sources/android/native_app_glue $[SYSROOT]/usr/include -#defer EXTRA_LPATH $[SYSROOT]/usr/lib -#defer EXTRA_LIBS $[if $[eq $[BUILD_TYPE],android],,c m] - -// Define the CFLAGS and LDFLAGS settings for the various architectures. -#defer ANDROID_arm_CFLAGS\ - -fpic\ - -ffunction-sections\ - -funwind-tables\ - -fstack-protector\ - -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__\ - -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__\ - $[if $[eq $[ANDROID_ABI],armeabi-v7a],-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16,-march=armv5te -mtune=xscale -msoft-float] - -#defer ANDROID_arm_LDFLAGS -march=armv7-a -Wl,--fix-cortex-a8 - -#define ANDROID_mips_CFLAGS\ - -fpic\ - -fno-strict-aliasing\ - -finline-functions\ - -ffunction-sections\ - -funwind-tables\ - -fmessage-length=0\ - -fno-inline-functions-called-once\ - -fgcse-after-reload\ - -frerun-cse-after-loop\ - -frename-registers - -#define ANDROID_mips_LDFLAGS - -#define ANDROID_x86_CFLAGS\ - -ffunction-sections\ - -funwind-tables\ - -fstack-protector - -#define ANDROID_x86_LDFLAGS - -// Select the flags for our architecture and add some common ones. -#defer ANDROID_CFLAGS $[ANDROID_$[ANDROID_ARCH]_CFLAGS] -DANDROID -Wa,$[if $[ANDROID_DISABLE_NX],--execstack,--noexecstack] -#defer ANDROID_LDFLAGS -Wl,--no-undefined\ - -Wl,-z,$[if $[ANDROID_DISABLE_NX],execstack,noexecstack]\ - -Wl,-z,$[if $[ANDROID_DISABLE_RELRO],norelro,relro]\ - -Wl,-z,$[if $[ANDROID_DISABLE_RELRO],lazy,now] - -// How to compile a C or C++ file into a .o file. $[target] is the -// name of the .o file, $[source] is the name of the source file, -// $[ipath] is a space-separated list of directories to search for -// include files, and $[flags] is a list of additional flags to pass -// to the compiler. -#defer os_ipath $[subst \,/,$[osfilename $[ipath]]] -#defer COMPILE_C $[CC] $[SYSROOT_FLAGS] $[ANDROID_CFLAGS] $[CFLAGS_GEN] $[flags] $[os_ipath:%=-I%] -c $[source] -o $[target] -#defer COMPILE_C++ $[CXX] $[SYSROOT_FLAGS] $[ANDROID_CFLAGS] $[C++FLAGS_GEN] $[flags] $[os_ipath:%=-I%] -c $[source] -o $[target] - -// What flags should be passed to both C and C++ compilers to enable -// debug symbols? This will be supplied when OPTIMIZE (above) is set -// to 1, 2, or 3. -#defer DEBUGFLAGS -g - -// What flags should be passed to both C and C++ compilers to enable -// compiler optimizations? This will be supplied when OPTIMIZE -// (above) is set to 2, 3, or 4. -#defer OPTFLAGS -O2 - -// By convention, any source file that contains the string _no_opt_ in -// its filename won't have the above compiler optimizations run for it. -#defer no_opt $[findstring _no_opt_,$[source]] - -// What define variables should be passed to the compilers for each -// value of OPTIMIZE? We separate this so we can pass these same -// options to interrogate, guaranteeing that the correct interfaces -// are generated. Do not include -D here; that will be supplied -// automatically. -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] - -// What additional flags should be passed for each value of OPTIMIZE -// (above)? We separate out the compiler-optimization flags, above, -// so we can compile certain files that give optimizers trouble (like -// the output of lex and yacc) without them, but with all the other -// relevant flags. - -#define ANDROID_DEBUG_CFLAGS -fno-omit-frame-pointer -fno-strict-aliasing -#define ANDROID_RELEASE_CFLAGS -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 - -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS] $[ANDROID_DEBUG_FLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] $[ANDROID_DEBUG_FLAGS] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] $[ANDROID_RELEASE_FLAGS] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]] $[ANDROID_RELEASE_FLAGS] - -// What additional flags should be passed to both compilers when -// building shared (relocatable) sources? Some architectures require -// special support for this. -#defer CFLAGS_SHARED -fPIC - -// How to generate a C or C++ executable from a collection of .o -// files. $[target] is the name of the binary to generate, and -// $[sources] is the list of .o files. $[libs] is a space-separated -// list of dependent libraries, and $[lpath] is a space-separated list -// of directories in which those libraries can be found. -#defer os_lpath $[subst \,/,$[osfilename $[lpath]]] -#defer LINK_BIN_C $[LINK_BIN_C++] -#defer LINK_BIN_C++ $[cxx_ld]\ - -Wl,--gc-sections\ - -Wl,-z,nocopyreloc\ - $[SYSROOT_FLAGS]\ - $[sources]\ - $[flags]\ - $[os_lpath:%=-L%] $[libs:%=-l%]\ - -o $[target] - -// How to generate a static C or C++ library. $[target] is the -// name of the library to generate, and $[sources] is the list of .o -// files that will go into the library. -#defer STATIC_LIB_C $[AR] cru $[target] $[sources] -#defer STATIC_LIB_C++ $[AR] cru $[target] $[sources] - -// How to run ranlib, if necessary, after generating a static library. -// $[target] is the name of the library. Set this to the empty string -// if ranlib is not necessary on your platform. -#defer RANLIB ranlib $[target] - -// Where to put the so_locations file, used by an Irix MIPSPro -// compiler, to generate a map of shared library memory locations. -#defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations - - -// How to generate a shared C or C++ library. $[source] and $[target] -// as above, and $[libs] is a space-separated list of dependent -// libraries, and $[lpath] is a space-separated list of directories in -// which those libraries can be found. -#defer SHARED_LIB_C $[SHARED_LIB_C++] -#defer SHARED_LIB_C++ $[cxx_ld]\ - -Wl,-soname,$[notdir $[target]]\ - -shared\ - $[SYSROOT_FLAGS]\ - $[sources]\ - $[flags]\ - $[os_lpath:%=-L%] $[libs:%=-l%]\ - -o $[target] -#define BUNDLE_LIB_C++ - -// How to install a data file or executable file. $[local] is the -// local name of the file to install, and $[dest] is the name of the -// directory to put it in. - -// On Unix systems, we strongly prefer using the install program to -// install files. This has nice features like automatically setting -// the permissions bits, and also is usually clever enough to install -// a running program without crashing the running instance. However, -// it doesn't understanding installing a program from a subdirectory, -// so we have to cd into the source directory first. -#defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,] -#defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/ -#defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/ - -#define SYSTEM_IGATE_FLAGS -D__const=const -Dvolatile -Dmutable - -// Posix thread support is provided by the Android NDK. -#define HAVE_POSIX_THREADS 1 -#define THREADS_LIBS - -// Is the platform big-endian (like an SGI workstation) or -// little-endian (like a PC)? Define this to the empty string to -// indicate little-endian, or nonempty to indicate big-endian. -#define WORDS_BIGENDIAN - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT 1 -#define HAVE_GETOPT_LONG_ONLY 1 - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H 1 - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH 1 - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE 1 -#define HAVE_IOS_BINARY 1 -#define HAVE_IOS_TYPEDEFS 1 - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the files /proc/self/* to determine our -// environment variables at static init time? -#define HAVE_PROC_SELF_EXE 1 -#define HAVE_PROC_SELF_MAPS 1 -#define HAVE_PROC_SELF_ENVIRON 1 -#define HAVE_PROC_SELF_CMDLINE 1 - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV -#define PROTOTYPE_GLOBAL_ARGV -#define GLOBAL_ARGV -#define GLOBAL_ARGC - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM 1 - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM 1 - -// Does fstream::open() require a third parameter, specifying the -// umask? Versions of gcc prior to 3.2 had this. -#define HAVE_OPEN_MASK - -// Do we have the lockf() function available? -#define HAVE_LOCKF - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW 1 - -// Do we have ? -#define PHAVE_IO_H - -// Do we have ? -#define PHAVE_MALLOC_H 1 - -// Do we have ? -#define PHAVE_ALLOCA_H 1 - -// Do we have ? -#define PHAVE_LOCALE_H 1 - -// Do we have ? -#define PHAVE_STRING_H 1 - -// Do we have ? -#define PHAVE_STDLIB_H 1 - -// Do we have ? -#define PHAVE_LIMITS_H 1 - -// Do we have ? -#define PHAVE_MINMAX_H - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H 1 - -// Do we have ? -#define PHAVE_UNISTD_H 1 - -// Do we have ? -#define PHAVE_UTIME_H 1 - -// Do we have ? -#define PHAVE_DIRENT_H 1 - -// Do we have (and do we want to use it instead of dirent.h)? -#define PHAVE_GLOB_H - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H 1 - -// Do we have (and therefore makecontext() / swapcontext())? -#define PHAVE_UCONTEXT_H 1 - -// Do we have ? This enables us to use raw mouse input. -#define PHAVE_LINUX_INPUT_H 1 - -// Do we have RTTI (and )? -// Technically, Android has RTTI support now, -// but we keep it disabled for performance reasons. -#define HAVE_RTTI - -// Do we have ? -#define PHAVE_STDINT_H 1 - -// We need 64-bit file i/o -#define __USE_LARGEFILE64 1 - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .so -#define STATIC_LIB_EXT .a -#define BUNDLE_EXT diff --git a/dtool/Config.Cygwin.pp b/dtool/Config.Cygwin.pp deleted file mode 100644 index 11c8729f6e..0000000000 --- a/dtool/Config.Cygwin.pp +++ /dev/null @@ -1,12 +0,0 @@ -// -// Config.Cygwin.pp -// -// This file defines some custom config variables for the Windows -// platform, when ppremake has been compiled using Cygwin. It -// inherits most of its parameters from Config.Win32.pp. -// - -// Note: if you are building for 64-bit Windows, you should configure -// ppremake with the "Cygwin64" platform name instead of "Cygwin". - -#include $[THISDIRPREFIX]Config.Win32.pp diff --git a/dtool/Config.Cygwin64.pp b/dtool/Config.Cygwin64.pp deleted file mode 100644 index 0d77563bd9..0000000000 --- a/dtool/Config.Cygwin64.pp +++ /dev/null @@ -1,10 +0,0 @@ -// -// Config.Cygwin64.pp -// -// This file defines some custom config variables for the Windows -// platform, when ppremake has been compiled using Cygwin. It -// inherits most of its parameters from Config.Win64.pp. -// - -// 32-bit -#include $[THISDIRPREFIX]Config.Win64.pp diff --git a/dtool/Config.FreeBSD.pp b/dtool/Config.FreeBSD.pp deleted file mode 100644 index b7a2fde268..0000000000 --- a/dtool/Config.FreeBSD.pp +++ /dev/null @@ -1,303 +0,0 @@ -// -// Config.FreeBSD.pp -// -// This file defines some custom config variables for the FreeBSD -// platform. It makes some initial guesses about compiler features, -// etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -#define IS_FREEBSD 1 - -// Compiler flags - -// How to invoke the C and C++ compilers. -#if $[eq $[USE_COMPILER], GCC] - #define CC gcc - #define CXX g++ - #define AR ar - - // gcc might run into template limits on some parts of Panda. - // I upped this from 25 to build on OS X (GCC 3.3) -- skyler. - #define C++FLAGS_GEN -ftemplate-depth-30 -#else - #define CC cc - #define CXX CC - #define AR ar -#endif - -// FreeBSD doesn't (yet) have any funny architecture flags. -#defer ARCH_FLAGS - -// How to compile a C or C++ file into a .o file. $[target] is the -// name of the .o file, $[source] is the name of the source file, -// $[ipath] is a space-separated list of directories to search for -// include files, and $[flags] is a list of additional flags to pass -// to the compiler. -#defer COMPILE_C $[CC] $[CFLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source] -#defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source] - -// What flags should be passed to both C and C++ compilers to enable -// debug symbols? This will be supplied when OPTIMIZE (above) is set -// to 1, 2, or 3. -#defer DEBUGFLAGS -g - -// What flags should be passed to both C and C++ compilers to enable -// compiler optimizations? This will be supplied when OPTIMIZE -// (above) is set to 2, 3, or 4. -#defer OPTFLAGS -O2 - -// By convention, any source file that contains the string _no_opt_ in -// its filename won't have the above compiler optimizations run for it. -#defer no_opt $[findstring _no_opt_,$[source]] - -// What define variables should be passed to the compilers for each -// value of OPTIMIZE? We separate this so we can pass these same -// options to interrogate, guaranteeing that the correct interfaces -// are generated. Do not include -D here; that will be supplied -// automatically. -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] - -// What additional flags should be passed for each value of OPTIMIZE -// (above)? We separate out the compiler-optimization flags, above, -// so we can compile certain files that give optimizers trouble (like -// the output of lex and yacc) without them, but with all the other -// relevant flags. -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]] - -// What additional flags should be passed to both compilers when -// building shared (relocatable) sources? Some architectures require -// special support for this. -#defer CFLAGS_SHARED -fPIC - -// How to generate a C or C++ executable from a collection of .o -// files. $[target] is the name of the binary to generate, and -// $[sources] is the list of .o files. $[libs] is a space-separated -// list of dependent libraries, and $[lpath] is a space-separated list -// of directories in which those libraries can be found. -#defer LINK_BIN_C $[cc_ld] $[ARCH_FLAGS] -o $[target] $[sources] $[flags] $[lpath:%=-L%] $[libs:%=-l%]\ - $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]] -#defer LINK_BIN_C++ $[cxx_ld] $[ARCH_FLAGS] \ - -o $[target] $[sources]\ - $[flags]\ - $[lpath:%=-L%] $[libs:%=-l%]\ - $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]] - -// How to generate a static C or C++ library. $[target] is the -// name of the library to generate, and $[sources] is the list of .o -// files that will go into the library. -#defer STATIC_LIB_C $[AR] cru $[target] $[sources] -#defer STATIC_LIB_C++ $[AR] cru $[target] $[sources] - -// How to run ranlib, if necessary, after generating a static library. -// $[target] is the name of the library. Set this to the empty string -// if ranlib is not necessary on your platform. -#defer RANLIB ranlib $[target] - -// Where to put the so_locations file, used by an Irix MIPSPro -// compiler, to generate a map of shared library memory locations. -#defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations - - -// How to generate a shared C or C++ library. $[source] and $[target] -// as above, and $[libs] is a space-separated list of dependent -// libraries, and $[lpath] is a space-separated list of directories in -// which those libraries can be found. -#defer SHARED_LIB_C $[cc_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#defer SHARED_LIB_C++ $[cxx_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#define BUNDLE_LIB_C++ - -// How to install a data file or executable file. $[local] is the -// local name of the file to install, and $[dest] is the name of the -// directory to put it in. - -// On Unix systems, we strongly prefer using the install program to -// install files. This has nice features like automatically setting -// the permissions bits, and also is usually clever enough to install -// a running program without crashing the running instance. However, -// it doesn't understanding installing a program from a subdirectory, -// so we have to cd into the source directory first. -#defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,] -#defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/ -#defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/ - -// What additional flags should we pass to interrogate? -#if $[eq $[shell uname -m], amd64] // if FreeBSD is 64bit - #define SYSTEM_IGATE_FLAGS -D_LP64 -D__const=const -Dvolatile -Dmutable -#else - #define SYSTEM_IGATE_FLAGS -D__i386__ -D__const=const -Dvolatile -Dmutable -#endif - -// Is the platform big-endian (like an SGI workstation) or -// little-endian (like a PC)? Define this to the empty string to -// indicate little-endian, or nonempty to indicate big-endian. -#define WORDS_BIGENDIAN - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT 1 -#define HAVE_GETOPT_LONG_ONLY 1 - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H 1 - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH 1 - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE 1 -#define HAVE_IOS_BINARY 1 -#define HAVE_IOS_TYPEDEFS 1 - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the files /proc/self/* to determine our -// environment variables at static init time? -#define HAVE_PROC_CURPROC_FILE 1 -#define HAVE_PROC_CURPROC_MAP 1 -#define HAVE_PROC_CURPROC_CMDLINE 1 - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV -#define PROTOTYPE_GLOBAL_ARGV -#define GLOBAL_ARGV -#define GLOBAL_ARGC - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM 1 - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM 1 - -// Does fstream::open() require a third parameter, specifying the -// umask? Versions of gcc prior to 3.2 had this. -#define HAVE_OPEN_MASK - -// Do we have the lockf() function available? -#define HAVE_LOCKF 1 - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW 1 - -// Do we have ? -#define PHAVE_IO_H - -// Do we have ? -#define PHAVE_MALLOC_H - -// Do we have ? -#define PHAVE_ALLOCA_H - -// Do we have ? -#define PHAVE_LOCALE_H 1 - -// Do we have ? -#define PHAVE_STRING_H 1 - -// Do we have ? -#define PHAVE_STDLIB_H 1 - -// Do we have ? -#define PHAVE_LIMITS_H 1 - -// Do we have ? -#define PHAVE_MINMAX_H - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H 1 - -// Do we have ? -#define PHAVE_UNISTD_H 1 - -// Do we have ? -#define PHAVE_UTIME_H 1 - -// Do we have ? -#define PHAVE_DIRENT_H 1 - -// Do we have (and do we want to use it instead of dirent.h)? -#define PHAVE_GLOB_H 1 - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H 1 - -// Do we have (and therefore makecontext() / swapcontext())? -#define PHAVE_UCONTEXT_H 1 - -// Do we have ? This enables us to use raw mouse input. -#define PHAVE_LINUX_INPUT_H - -// Do we have ? -#define PHAVE_STDINT_H 1 - -// Do we have RTTI (and )? -#define HAVE_RTTI 1 - -// We need 64-bit file i/o -#define __USE_LARGEFILE64 1 - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .so -#define STATIC_LIB_EXT .a -#define BUNDLE_EXT - -#if $[isdir /usr/PCBSD/local] // if we're running PC-BSD - #define EXTRA_IPATH /usr/PCBSD/local/include/ - #define EXTRA_LPATH /usr/PCBSD/local/lib/ -#endif - -#define EXTRA_IPATH /usr/local/include/ -#define EXTRA_LPATH /usr/local/lib/ diff --git a/dtool/Config.Irix.pp b/dtool/Config.Irix.pp deleted file mode 100644 index 3912a8b4ae..0000000000 --- a/dtool/Config.Irix.pp +++ /dev/null @@ -1,151 +0,0 @@ -// -// Config.Irix.pp -// -// This file defines some custom config variables for the SGI/Irix -// platform. It makes some initial guesses about compiler features, -// etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -// What additional flags should we pass to interrogate? -#define SYSTEM_IGATE_FLAGS -D__mips__ -D__MIPSEB__ -D_LANGUAGE_C_PLUS_PLUS -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 - -// Is the platform big-endian (like an SGI workstation) or -// little-endian (like a PC)? Define this to the empty string to -// indicate little-endian, or nonempty to indicate big-endian. -#define WORDS_BIGENDIAN 1 - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT 1 -#define HAVE_GETOPT_LONG_ONLY - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H 1 - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH 1 - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE -#define HAVE_IOS_BINARY -#define HAVE_IOS_TYPEDEFS - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the file /proc/self/environ to determine our -// environment variables at static init time? -#define HAVE_PROC_SELF_ENVIRON - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV 1 -#define PROTOTYPE_GLOBAL_ARGV 1 -#define GLOBAL_ARGV __Argv -#define GLOBAL_ARGC __Argc - -// Can we read the file /proc/self/cmdline to determine our -// command-line arguments at static init time? -#define HAVE_PROC_SELF_CMDLINE - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM - -// Does fstream::open() require a third parameter, specifying the -// umask? -#define HAVE_OPEN_MASK 1 - -// Do we have the lockf() function available? -#define HAVE_LOCKF 1 - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW - -// Do we have ? -#define PHAVE_IO_H - -// Do we have ? -#define PHAVE_MALLOC_H 1 - -// Do we have ? -#define PHAVE_ALLOCA_H 1 - -// Do we have ? -#define PHAVE_LOCALE_H 1 - -// Do we have ? -#define PHAVE_MINMAX_H - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H 1 - -// Do we have ? -#define PHAVE_UNISTD_H 1 - -// Do we have ? -#define PHAVE_UTIME_H 1 - -// Do we have ? -#define PHAVE_DIRENT_H 1 - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H - -// Do we have ? -#define PHAVE_STDINT_H - -// Do we have RTTI (and )? -#define HAVE_RTTI 1 - -// The Irix compiler doesn't support the modern STL allocator. -#define USE_STL_ALLOCATOR - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .so -#define BUNDLE_EXT diff --git a/dtool/Config.Linux.pp b/dtool/Config.Linux.pp deleted file mode 100644 index 36156b07d0..0000000000 --- a/dtool/Config.Linux.pp +++ /dev/null @@ -1,339 +0,0 @@ -// -// Config.Linux.pp -// -// This file defines some custom config variables for the Linux -// platform. It makes some initial guesses about compiler features, -// etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -#define IS_LINUX 1 - -// Compiler flags - -// How to invoke the C and C++ compilers. -#if $[eq $[USE_COMPILER], GCC] - #define CC gcc - #define CXX g++ - #define AR ar - - // gcc might run into template limits on some parts of Panda. - // I upped this from 25 to build on OS X (GCC 3.3) -- skyler. - #define C++FLAGS_GEN -ftemplate-depth-30 -#else - #define CC cc - #define CXX CC - #define AR ar -#endif - -// Linux doesn't (yet) have any funny architecture flags. -#defer ARCH_FLAGS - -// How to compile a C or C++ file into a .o file. $[target] is the -// name of the .o file, $[source] is the name of the source file, -// $[ipath] is a space-separated list of directories to search for -// include files, and $[flags] is a list of additional flags to pass -// to the compiler. -#defer COMPILE_C $[CC] $[CFLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source] -#defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] $[ARCH_FLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source] - -// What flags should be passed to both C and C++ compilers to enable -// debug symbols? This will be supplied when OPTIMIZE (above) is set -// to 1, 2, or 3. -#defer DEBUGFLAGS -g - -// What flags should be passed to both C and C++ compilers to enable -// compiler optimizations? This will be supplied when OPTIMIZE -// (above) is set to 2, 3, or 4. -#defer OPTFLAGS -O2 - -// By convention, any source file that contains the string _no_opt_ in -// its filename won't have the above compiler optimizations run for it. -#defer no_opt $[findstring _no_opt_,$[source]] - -// What define variables should be passed to the compilers for each -// value of OPTIMIZE? We separate this so we can pass these same -// options to interrogate, guaranteeing that the correct interfaces -// are generated. Do not include -D here; that will be supplied -// automatically. -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] - -// What additional flags should be passed for each value of OPTIMIZE -// (above)? We separate out the compiler-optimization flags, above, -// so we can compile certain files that give optimizers trouble (like -// the output of lex and yacc) without them, but with all the other -// relevant flags. -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]] - -// What additional flags should be passed to both compilers when -// building shared (relocatable) sources? Some architectures require -// special support for this. -#defer CFLAGS_SHARED -fPIC - -// How to generate a C or C++ executable from a collection of .o -// files. $[target] is the name of the binary to generate, and -// $[sources] is the list of .o files. $[libs] is a space-separated -// list of dependent libraries, and $[lpath] is a space-separated list -// of directories in which those libraries can be found. -#defer LINK_BIN_C $[cc_ld] $[ARCH_FLAGS] -o $[target] $[sources] $[flags] $[lpath:%=-L%] $[libs:%=-l%]\ - $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]] -#defer LINK_BIN_C++ $[cxx_ld] $[ARCH_FLAGS] \ - -o $[target] $[sources]\ - $[flags]\ - $[lpath:%=-L%] $[libs:%=-l%]\ - $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]] - -// How to generate a static C or C++ library. $[target] is the -// name of the library to generate, and $[sources] is the list of .o -// files that will go into the library. -#defer STATIC_LIB_C $[AR] cru $[target] $[sources] -#defer STATIC_LIB_C++ $[AR] cru $[target] $[sources] - -// How to run ranlib, if necessary, after generating a static library. -// $[target] is the name of the library. Set this to the empty string -// if ranlib is not necessary on your platform. -#defer RANLIB ranlib $[target] - -// Where to put the so_locations file, used by an Irix MIPSPro -// compiler, to generate a map of shared library memory locations. -#defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations - - -// How to generate a shared C or C++ library. $[source] and $[target] -// as above, and $[libs] is a space-separated list of dependent -// libraries, and $[lpath] is a space-separated list of directories in -// which those libraries can be found. -#defer SHARED_LIB_C $[cc_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#defer SHARED_LIB_C++ $[cxx_ld] -shared $[LFLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#define BUNDLE_LIB_C++ - -// How to install a data file or executable file. $[local] is the -// local name of the file to install, and $[dest] is the name of the -// directory to put it in. - -// On Unix systems, we strongly prefer using the install program to -// install files. This has nice features like automatically setting -// the permissions bits, and also is usually clever enough to install -// a running program without crashing the running instance. However, -// it doesn't understanding installing a program from a subdirectory, -// so we have to cd into the source directory first. -#defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,] -#defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/ -#defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/ - -// Variable definitions for building with the Irix MIPSPro compiler. -#if $[eq $[USE_COMPILER], MIPS] - #define CC cc -n32 -mips3 - #define CXX CC -n32 -mips3 - - // Turn off a few annoying warning messages. - // 1174 - function 'blah' was declared but never used - // 1201 - trailing comma is nonstandard. - // 1209 - controlling expression is constant, e.g. if (0) { ... } - // 1234 - access control not specified, 'public' by default - // 1355 - extra ";" ignored - // 1375 - destructor for base class is not virtual. - // this one actually is bad. But we got alot of them from the classes - // that we've derived from STL collections. Beware of this. - // 3322 - omission of explicit type is nonstandard ("int" assumed) - #define WOFF_LIST -woff 1174,1201,1209,1234,1355,1375,3322 - - // Linker warnings - // 85 - definition of SOMESYMBOL in SOMELIB preempts that of definition in - // SOMEOTHERLIB. - #define WOFF_LIST $[WOFF_LIST] -Wl,-LD_MSG:off=85 - - #defer OPTFLAGS -O2 -OPT:Olimit=2500 - - #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] $[WOFF_LIST] -g - #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] $[WOFF_LIST] - #defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[WOFF_LIST] - #defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[WOFF_LIST] - - #defer CFLAGS_SHARED - - #defer STATIC_LIB_C $[CC] -ar -o $[target] $[sources] - #defer STATIC_LIB_C++ $[CXX] -ar -o $[target] $[sources] - #defer RANLIB - - #defer SHARED_FLAGS -Wl,-none -Wl,-update_registry,$[SO_LOCATIONS] - #defer SHARED_LIB_C $[cc_ld] -shared $[SHARED_FLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] - #defer SHARED_LIB_C++ $[cxx_ld] -shared $[SHARED_FLAGS] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#endif - - - -// What additional flags should we pass to interrogate? -#if $[eq $[shell uname -m], x86_64] // if Linux is 64bit - #define SYSTEM_IGATE_FLAGS -D_LP64 -D__const=const -Dvolatile -Dmutable -#else - #define SYSTEM_IGATE_FLAGS -D__i386__ -D__const=const -Dvolatile -Dmutable -#endif - -// Is the platform big-endian (like an SGI workstation) or -// little-endian (like a PC)? Define this to the empty string to -// indicate little-endian, or nonempty to indicate big-endian. -#define WORDS_BIGENDIAN - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT 1 -#define HAVE_GETOPT_LONG_ONLY 1 - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H 1 - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH 1 - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE 1 -#define HAVE_IOS_BINARY 1 -#define HAVE_IOS_TYPEDEFS 1 - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the files /proc/self/* to determine our -// environment variables at static init time? -#define HAVE_PROC_SELF_EXE 1 -#define HAVE_PROC_SELF_MAPS 1 -#define HAVE_PROC_SELF_ENVIRON 1 -#define HAVE_PROC_SELF_CMDLINE 1 - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV -#define PROTOTYPE_GLOBAL_ARGV -#define GLOBAL_ARGV -#define GLOBAL_ARGC - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM 1 - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM 1 - -// Does fstream::open() require a third parameter, specifying the -// umask? Versions of gcc prior to 3.2 had this. -#define HAVE_OPEN_MASK - -// Do we have the lockf() function available? -#define HAVE_LOCKF 1 - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW 1 - - -// Do we have ? -#define PHAVE_IO_H - -// Do we have ? -#define PHAVE_MALLOC_H 1 - -// Do we have ? -#define PHAVE_ALLOCA_H 1 - -// Do we have ? -#define PHAVE_LOCALE_H 1 - -// Do we have ? -#define PHAVE_STRING_H 1 - -// Do we have ? -#define PHAVE_STDLIB_H 1 - -// Do we have ? -#define PHAVE_LIMITS_H 1 - -// Do we have ? -#define PHAVE_MINMAX_H - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H 1 - -// Do we have ? -#define PHAVE_UNISTD_H 1 - -// Do we have ? -#define PHAVE_UTIME_H 1 - -// Do we have ? -#define PHAVE_DIRENT_H 1 - -// Do we have (and do we want to use it instead of dirent.h)? -#define PHAVE_GLOB_H 1 - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H 1 - -// Do we have (and therefore makecontext() / swapcontext())? -#define PHAVE_UCONTEXT_H 1 - -// Do we have ? This enables us to use raw mouse input. -#define PHAVE_LINUX_INPUT_H 1 - -// Do we have RTTI (and )? -#define HAVE_RTTI 1 - -// Do we have ? -#define PHAVE_STDINT_H 1 - -// We need 64-bit file i/o -#define __USE_LARGEFILE64 1 - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .so -#define STATIC_LIB_EXT .a -#define BUNDLE_EXT diff --git a/dtool/Config.OSX.pp b/dtool/Config.OSX.pp deleted file mode 100644 index be2dd75c84..0000000000 --- a/dtool/Config.OSX.pp +++ /dev/null @@ -1,295 +0,0 @@ -// -// Config.OSX.pp -// -// This file defines some custom config variables for the osx -// platform. It makes some initial guesses about compiler features, -// etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -#define IS_OSX 1 - -// Compiler flags - -#define CC gcc -#define CXX g++ -#define C++FLAGS_GEN -ftemplate-depth-30 - -// Configure for universal binaries on OSX. -#defer ARCH_FLAGS $[if $[UNIVERSAL_BINARIES],-arch i386 -arch ppc -arch x86_64,] -#define OSX_CDEFS -#define OSX_CFLAGS -Wno-deprecated-declarations - -// Whether to build for Cocoa, Carbon or both. 64-bits systems do not -// have Carbon. We also disable it for universal and 64-bits builds. -#define HAVE_COCOA 1 -#defer HAVE_CARBON $[not $[or $[eq $[shell uname -m], x86_64],$[UNIVERSAL_BINARIES]]] - -// How to compile a C or C++ file into a .o file. $[target] is the -// name of the .o file, $[source] is the name of the source file, -// $[ipath] is a space-separated list of directories to search for -// include files, and $[flags] is a list of additional flags to pass -// to the compiler. - -#defer COMPILE_C $[CC] $[CFLAGS_GEN] $[ARCH_FLAGS] $[OSX_CFLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source] -#defer COMPILE_C++ $[CXX] $[C++FLAGS_GEN] $[ARCH_FLAGS] $[OSX_CFLAGS] -c -o $[target] $[ipath:%=-I%] $[flags] $[source] - -// What flags should be passed to both C and C++ compilers to enable -// debug symbols? This will be supplied when OPTIMIZE (above) is set -// to 1, 2, or 3. -#defer DEBUGFLAGS -g - -// What flags should be passed to both C and C++ compilers to enable -// compiler optimizations? This will be supplied when OPTIMIZE -// (above) is set to 2, 3, or 4. -#defer OPTFLAGS -O2 - -// By convention, any source file that contains the string _no_opt_ in -// its filename won't have the above compiler optimizations run for it. -#defer no_opt $[findstring _no_opt_,$[source]] - -// What define variables should be passed to the compilers for each -// value of OPTIMIZE? We separate this so we can pass these same -// options to interrogate, guaranteeing that the correct interfaces -// are generated. Do not include -D here; that will be supplied -// automatically. -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] $[OSX_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] $[OSX_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] $[OSX_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] $[OSX_CDEFS] - -// What additional flags should be passed for each value of OPTIMIZE -// (above)? We separate out the compiler-optimization flags, above, -// so we can compile certain files that give optimizers trouble (like -// the output of lex and yacc) without them, but with all the other -// relevant flags. -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=-D%] -Wall $[DEBUGFLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=-D%] -Wall $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=-D%] $[DEBUGFLAGS] $[if $[no_opt],,$[OPTFLAGS]] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=-D%] $[if $[no_opt],,$[OPTFLAGS]] - -// What additional flags should be passed to both compilers when -// building shared (relocatable) sources? Some architectures require -// special support for this. -#defer CFLAGS_SHARED -fPIC - -// How to generate a C or C++ executable from a collection of .o -// files. $[target] is the name of the binary to generate, and -// $[sources] is the list of .o files. $[libs] is a space-separated -// list of dependent libraries, and $[lpath] is a space-separated list -// of directories in which those libraries can be found. -#defer link_bin_opts $[ARCH_FLAGS] $[OSX_CFLAGS] \ - $[if $[not $[LINK_ALL_STATIC]],-undefined dynamic_lookup] \ - -o $[target] $[sources]\ - $[flags]\ - $[lpath:%=-L%] $[libs:%=-l%]\ - $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[bin_frameworks]] - -#defer LINK_BIN_C $[cc_ld] $[link_bin_opts] -#defer LINK_BIN_C++ $[cxx_ld] $[link_bin_opts] - -// How to generate a static C or C++ library. $[target] is the -// name of the library to generate, and $[sources] is the list of .o -// files that will go into the library. -#defer STATIC_LIB_C libtool -static -o $[target] $[sources] -#defer STATIC_LIB_C++ libtool -static -o $[target] $[sources] - -// How to run ranlib, if necessary, after generating a static library. -// $[target] is the name of the library. Set this to the empty string -// if ranlib is not necessary on your platform. -#defer RANLIB ranlib $[target] - -// Where to put the so_locations file, used by an Irix MIPSPro -// compiler, to generate a map of shared library memory locations. -#defer SO_LOCATIONS $[DTOOL_INSTALL]/etc/so_locations - - -// How to generate a shared C or C++ library. $[source] and $[target] -// as above, and $[libs] is a space-separated list of dependent -// libraries, and $[lpath] is a space-separated list of directories in -// which those libraries can be found. -#defer SHARED_LIB_C $[cc_ld] $[ARCH_FLAGS] $[OSX_CFLAGS] -o $[target] -dynamiclib -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]] -#defer SHARED_LIB_C++ $[cxx_ld] $[ARCH_FLAGS] $[OSX_CFLAGS] -undefined dynamic_lookup -dynamic -dynamiclib -o $[target] -dynamiclib -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]] -#defer BUNDLE_LIB_C++ $[cxx_ld] $[ARCH_FLAGS] $[OSX_CFLAGS] -undefined dynamic_lookup -bundle -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]] - -// How to install a data file or executable file. $[local] is the -// local name of the file to install, and $[dest] is the name of the -// directory to put it in. - -// On Unix systems, we strongly prefer using the install program to -// install files. This has nice features like automatically setting -// the permissions bits, and also is usually clever enough to install -// a running program without crashing the running instance. However, -// it doesn't understanding installing a program from a subdirectory, -// so we have to cd into the source directory first. -#defer install_dash_p $[if $[KEEP_TIMESTAMPS],-p,] -#defer INSTALL $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_DATA] $[install_dash_p] $[notdir $[local]] $[dest]/ -#defer INSTALL_PROG $[if $[ne $[dir $[local]], ./],cd ./$[dir $[local]] &&] install -m $[INSTALL_UMASK_PROG] $[install_dash_p] $[notdir $[local]] $[dest]/ - - -// Assume that OSX has OpenGL available. -#define HAVE_GL 1 - -// What additional flags should we pass to interrogate? -#define BASE_IGATE_FLAGS -D__FLT_EVAL_METHOD__=0 -D__const=const -Dvolatile -Dmutable -D__LITTLE_ENDIAN__ -D__inline__=inline -D__GNUC__ -#define IGATE_ARCH -D__i386__ -#defer SYSTEM_IGATE_FLAGS $[BASE_IGATE_FLAGS] $[IGATE_ARCH] - -// We don't need worry about defining WORDS_BIGENDIAN (and we -// shouldn't anyway, since ppc and intel are different). We rely on -// dtoolbase.h to determine this at compilation time. -#define WORDS_BIGENDIAN - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT 1 -#define HAVE_GETOPT_LONG_ONLY - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H 1 - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH 1 - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE 1 -#define HAVE_IOS_BINARY 1 -#define HAVE_IOS_TYPEDEFS 1 - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the file /proc/self/* to determine our -// environment variables at static init time? -#define HAVE_PROC_SELF_EXE -#define HAVE_PROC_SELF_MAPS -#define HAVE_PROC_SELF_ENVIRON -#define HAVE_PROC_SELF_CMDLINE - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV -#define PROTOTYPE_GLOBAL_ARGV -#define GLOBAL_ARGV __Argv -#define GLOBAL_ARGC __Argc - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM 1 - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM 1 - -// Does fstream::open() require a third parameter, specifying the -// umask? Versions of gcc prior to 3.2 had this. -#define HAVE_OPEN_MASK - -// Do we have the lockf() function available? -#define HAVE_LOCKF 1 - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW 1 - -// Do we have ? -#define PHAVE_IO_H - -// Do we have ? -#define PHAVE_MALLOC_H - -// Do we have ? -#define PHAVE_ALLOCA_H 1 - -// Do we have ? -#define PHAVE_LOCALE_H 1 - -// Do we have ? -#define PHAVE_STRING_H 1 - -// Do we have ? -#define PHAVE_STDLIB_H 1 - -// Do we have ? -#define PHAVE_LIMITS_H 1 - -// Do we have ? -#define PHAVE_MINMAX_H - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H 1 - -// Do we have ? -#define PHAVE_UNISTD_H 1 - -// Do we have ? -#define PHAVE_UTIME_H 1 - -// Do we have ? -#define PHAVE_DIRENT_H 1 - -// Do we have (and do we want to use it instead of dirent.h)? -#define PHAVE_GLOB_H 1 - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H 1 - -// Do we have (and therefore makecontext() / swapcontext())? -#define PHAVE_UCONTEXT_H 1 - -// Do we have RTTI (and )? -#define HAVE_RTTI 1 - -// Do we have ? -#define PHAVE_STDINT_H 1 - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .dylib -#define STATIC_LIB_EXT .a - -// If you need to build .so files in addition to .dylibs, declare this -// too. Python 2.4 on OSX 10.4 seems to require this (it won't import -// a .dylib file directly). -//#define BUNDLE_EXT .so diff --git a/dtool/Config.Win32.pp b/dtool/Config.Win32.pp deleted file mode 100644 index 8c56d25a29..0000000000 --- a/dtool/Config.Win32.pp +++ /dev/null @@ -1,171 +0,0 @@ -// -// Config.Win32.pp -// -// This file defines some custom config variables for the Windows -// platform, using MS VC++. It makes some initial guesses about -// compiler features, etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -// What additional flags should we pass to interrogate? -#define SYSTEM_IGATE_FLAGS -longlong __int64 -D_X86_ -DWIN32_VC -D"_declspec(param)=" -D"__declspec(param)=" -D_near -D_far -D__near -D__far -D_WIN32 -D__stdcall -Dvolatile -Dmutable -DWIN32 - -// Additional flags to pass to the Tau instrumentor. -#define TAU_INSTRUMENTOR_FLAGS -DTAU_USE_C_API -DPROFILING_ON -DWIN32_VC -D_WIN32 -D__cdecl= -D__stdcall= -D__fastcall= -D__i386 -D_MSC_VER=1310 -D_W64= -D_INTEGRAL_MAX_BITS=64 --exceptions --late_tiebreaker --no_class_name_injection --no_warnings --restrict --microsoft --new_for_init - -// Is the platform big-endian (like an SGI workstation) or -// little-endian (like a PC)? Define this to the empty string to -// indicate little-endian, or nonempty to indicate big-endian. -#define WORDS_BIGENDIAN - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS 1 - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT -#define HAVE_GETOPT_LONG_ONLY - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE 1 -#define HAVE_IOS_BINARY 1 -#define HAVE_IOS_TYPEDEFS 1 - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the file /proc/self/* to determine our -// environment variables at static init time? -#define HAVE_PROC_SELF_EXE -#define HAVE_PROC_SELF_MAPS -#define HAVE_PROC_SELF_ENVIRON -#define HAVE_PROC_SELF_CMDLINE - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV 1 -#define PROTOTYPE_GLOBAL_ARGV -#define GLOBAL_ARGV __argv -#define GLOBAL_ARGC __argc - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM 1 - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM 1 - -// Does fstream::open() require a third parameter, specifying the -// umask? -#define HAVE_OPEN_MASK - -// Do we have the lockf() function available? -#define HAVE_LOCKF 1 - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW 1 - -// Do we have ? -#define PHAVE_IO_H 1 - -// Do we have ? -#define PHAVE_MALLOC_H 1 - -// Do we have ? -#define PHAVE_ALLOCA_H - -// Do we have ? -#define PHAVE_LOCALE_H - -// Do we have ? -#define PHAVE_STRING_H 1 - -// Do we have ? -#define PHAVE_STDLIB_H - -// Do we have ? -#define PHAVE_LIMITS_H - -// Do we have ? -#define PHAVE_MINMAX_H 1 - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H - -// Do we have ? -#define PHAVE_UNISTD_H - -// Do we have ? -#define PHAVE_UTIME_H - -// Do we have ? -#define PHAVE_DIRENT_H - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H - -// Do we have (and therefore makecontext() / swapcontext())? -#define PHAVE_UCONTEXT_H - -// Do we have RTTI (and )? -#define HAVE_RTTI 1 - -// Do we have ? -#define PHAVE_STDINT_H - -// can Intel C++ build this directory successfully (if not, change CC to msvc) -#define NOT_INTEL_BUILDABLE false - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .dll -#define STATIC_LIB_EXT .lib -#define BUNDLE_EXT - - diff --git a/dtool/Config.Win64.pp b/dtool/Config.Win64.pp deleted file mode 100644 index 40936b0bdc..0000000000 --- a/dtool/Config.Win64.pp +++ /dev/null @@ -1,171 +0,0 @@ -// -// Config.Win64.pp -// -// This file defines some custom config variables for the Windows -// platform, using MS VC++. It makes some initial guesses about -// compiler features, etc. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -// What additional flags should we pass to interrogate? -#define SYSTEM_IGATE_FLAGS -longlong __int64 -D_X64_ -DWIN64_VC -D"_declspec(param)=" -D"__declspec(param)=" -D_near -D_far -D__near -D__far -D_WIN32 -D_WIN64 -D__stdcall -Dvolatile -Dmutable -DWIN64 - -// Additional flags to pass to the Tau instrumentor. -#define TAU_INSTRUMENTOR_FLAGS -DTAU_USE_C_API -DPROFILING_ON -DWIN64_VC -D_WIN32 -D_WIN64 -D__cdecl= -D__stdcall= -D__fastcall= -D__i386 -D_MSC_VER=1310 -D_W64= -D_INTEGRAL_MAX_BITS=64 --exceptions --late_tiebreaker --no_class_name_injection --no_warnings --restrict --microsoft --new_for_init - -// Is the platform big-endian (like an SGI workstation) or -// little-endian (like a PC)? Define this to the empty string to -// indicate little-endian, or nonempty to indicate big-endian. -#define WORDS_BIGENDIAN - -// Does the C++ compiler support namespaces? -#define HAVE_NAMESPACE 1 - -// Does the C++ compiler support ios::binary? -#define HAVE_IOS_BINARY 1 - -// How about the typename keyword? -#define HAVE_TYPENAME 1 - -// Will the compiler avoid inserting extra bytes in structs between a -// base struct and its derived structs? It is safe to define this -// false if you don't know, but if you know that you can get away with -// this you may gain a tiny performance gain by defining this true. -// If you define this true incorrectly, you will get lots of -// assertion failures on execution. -#define SIMPLE_STRUCT_POINTERS 1 - -// Does gettimeofday() take only one parameter? -#define GETTIMEOFDAY_ONE_PARAM - -// Do we have getopt() and/or getopt_long_only() built into the -// system? -#define HAVE_GETOPT -#define HAVE_GETOPT_LONG_ONLY - -// Are the above getopt() functions defined in getopt.h, or somewhere else? -#define PHAVE_GETOPT_H - -// Can we determine the terminal width by making an ioctl(TIOCGWINSZ) call? -#define IOCTL_TERMINAL_WIDTH - -// Do the system headers define a "streamsize" typedef? How about the -// ios::binary enumerated value? And other ios typedef symbols like -// ios::openmode and ios::fmtflags? -#define HAVE_STREAMSIZE 1 -#define HAVE_IOS_BINARY 1 -#define HAVE_IOS_TYPEDEFS 1 - -// Can we safely call getenv() at static init time? -#define STATIC_INIT_GETENV 1 - -// Can we read the file /proc/self/* to determine our -// environment variables at static init time? -#define HAVE_PROC_SELF_EXE -#define HAVE_PROC_SELF_MAPS -#define HAVE_PROC_SELF_ENVIRON -#define HAVE_PROC_SELF_CMDLINE - -// Do we have a global pair of argc/argv variables that we can read at -// static init time? Should we prototype them? What are they called? -#define HAVE_GLOBAL_ARGV 1 -#define PROTOTYPE_GLOBAL_ARGV -#define GLOBAL_ARGV __argv -#define GLOBAL_ARGC __argc - -// Should we include or ? Define PHAVE_IOSTREAM -// to nonempty if we should use , or empty if we should use -// . -#define PHAVE_IOSTREAM 1 - -// Do we have a true stringstream class defined in ? -#define PHAVE_SSTREAM 1 - -// Does fstream::open() require a third parameter, specifying the -// umask? -#define HAVE_OPEN_MASK - -// Do we have the lockf() function available? -#define HAVE_LOCKF 1 - -// Do the compiler or system libraries define wchar_t for you? -#define HAVE_WCHAR_T 1 - -// Does define the typedef wstring? Most do, but for some -// reason, versions of gcc before 3.0 didn't do this. -#define HAVE_WSTRING 1 - -// Do we have ? -#define PHAVE_NEW 1 - -// Do we have ? -#define PHAVE_IO_H 1 - -// Do we have ? -#define PHAVE_MALLOC_H 1 - -// Do we have ? -#define PHAVE_ALLOCA_H - -// Do we have ? -#define PHAVE_LOCALE_H - -// Do we have ? -#define PHAVE_STRING_H 1 - -// Do we have ? -#define PHAVE_STDLIB_H - -// Do we have ? -#define PHAVE_LIMITS_H - -// Do we have ? -#define PHAVE_MINMAX_H 1 - -// Do we have ? -#define PHAVE_SYS_TYPES_H 1 -#define PHAVE_SYS_TIME_H - -// Do we have ? -#define PHAVE_UNISTD_H - -// Do we have ? -#define PHAVE_UTIME_H - -// Do we have ? -#define PHAVE_DIRENT_H - -// Do we have (and presumably a Linux-style audio -// interface)? -#define PHAVE_SYS_SOUNDCARD_H - -// Do we have (and therefore makecontext() / swapcontext())? -#define PHAVE_UCONTEXT_H - -// Do we have RTTI (and )? -#define HAVE_RTTI 1 - -// Do we have ? -#define PHAVE_STDINT_H - -// can Intel C++ build this directory successfully (if not, change CC to msvc) -#define NOT_INTEL_BUILDABLE false - -// The dynamic library file extension (usually .so .dll or .dylib): -#define DYNAMIC_LIB_EXT .dll -#define STATIC_LIB_EXT .lib -#define BUNDLE_EXT - - diff --git a/dtool/Config.pp b/dtool/Config.pp deleted file mode 100644 index cf59d047b6..0000000000 --- a/dtool/Config.pp +++ /dev/null @@ -1,1237 +0,0 @@ -// -// dtool/Config.pp -// -// This file defines certain configuration variables that are written -// into the various make scripts. It is processed by ppremake (along -// with the Sources.pp files in each of the various directories) to -// generate build scripts appropriate to each environment. -// - -// ******************************************************************* -// NOTE: you should not attempt to copy this file verbatim as your own -// personal Config.pp file. Instead, you should start with an empty -// Config.pp file, and add lines to it when you wish to override -// settings given in here. In the normal ppremake system, this file -// will always be read first, and then your personal Config.pp file -// will be read later, which gives you a chance to override the -// default settings found in this file. However, if you start by -// copying the entire file, it will be difficult to tell which -// settings you have customized, and it will be difficult to upgrade -// to a subsequent version of Panda. -// ******************************************************************* - -// -// ppremake is capable of generating makefiles for Unix compilers such -// as gcc or SGI's MipsPRO compiler, as well as for Windows -// environments like Microsoft's Visual C++. It can also, -// potentially, generate Microsoft Developer's Studio project files -// directly, although we haven't written the scripts to do this yet. -// In principle, it can be extended to generate suitable build script -// files for any number of different build environments. -// -// All of these build scripts can be tuned for a particular -// environment via this file. This is the place for the user to -// specify which external packages are installed and where, or to -// enable or disable certain optional features. However, it is -// suggested that rather than modify this file directly, you create a -// custom file in your home directory and there redefine whatever -// variables are appropriate, and set the environment variable -// PPREMAKE_CONFIG to refer to it. In this way, you can easily get an -// updated source tree (including a new Config.pp) without risking -// accidentally losing your customizations. This also avoids having -// to redefine the same variables in different packages (for instance, -// in dtool and in panda). -// -// The syntax in this file resembles some hybrid between C++ -// preprocessor declarations and GNU make variables. This is the same -// syntax used in the various ppremake system configure files; it's -// designed to be easy to use as a macro language to generate -// makefiles and their ilk. -// -// Some of the variables below are defined using the #define command, -// and others are defined using #defer. The two are very similar in -// their purpose; the difference is that, if the variable definition -// includes references to other variables (e.g. $[varname]), then -// #define will evaluate all of the other variable references -// immediately and store the resulting expansion, while #defer will -// store only the variable references themselves, and expand them when -// the variable is later referenced. It is very similar to the -// relationship between := and = in GNU Make. -// dtool/Config.pp - -// In general, #defer is used in this file, to allow the user to -// redefine critical variables in his or her own Config.pp file. - - - -// What kind of build scripts are we generating? This selects a -// suitable template file from the ppremake system files. The -// allowable choices, at present, are: -// -// unix - Generate makefiles suitable for most Unix platforms. -// msvc - Generate Visual C++ project files (still a work in progress) -// nmake - Generate makefiles for Microsoft Visual C++, using -// Microsoft's nmake utility. -// gmsvc - Generate makefiles similar to the above, using Microsoft -// Visual C++, but uses the Cygwin-supplied GNU make -// instead of Microsoft nmake. This is potentially -// faster if you have multiple CPU's, since it supports -// distributed make. It's a tiny bit slower if you're -// not taking advantage of distributed make, because of -// the overhead associated with Cygwin fork() calls. - -#if $[eq $[PLATFORM], Win32] - #define BUILD_TYPE nmake -#elif $[eq $[PLATFORM], Cygwin] - #define BUILD_TYPE gmsvc -#elif $[OSX_PLATFORM] - #define BUILD_TYPE unix -#else - #define BUILD_TYPE unix -#endif - -// What is the default install directory for all trees in the Panda -// suite? The default value for this variable is provided by -// ppremake; on Unix machines it is the value of --prefix passed in to -// the configure script, and on Windows machines the default is -// hardcoded in config_msvc.h to C:\Panda3d. - -// You may also override this for a particular tree by defining a -// variable name like DTOOL_INSTALL or PANDA_INSTALL. (The -// INSTALL_DIR variable will have no effect if you are using the -// ctattach tools to control your attachment to the trees; but this -// will be the case only if you are a member of the VR Studio.) - -// #define INSTALL_DIR /usr/local/panda - -// If you intend to use Panda only as a Python module, you may find -// the following define useful (but you should put in the correct path -// to site-packages within your own installed Python). This will -// install the Panda libraries into the standard Python search space -// so that they can be accessed as Python modules. (Also see the -// PYTHON_IPATH variable, below.) - -// If you don't do this, you can still use Panda as a Python module, -// but you must put /usr/local/panda/lib (or $INSTALL_DIR/lib) on -// your PYTHONPATH. - -// #define INSTALL_LIB_DIR /usr/lib/python2.6/site-packages - - -// The character used to separate components of an OS-specific -// directory name depends on the platform (it is '/' on Unix, '\' on -// Windows). That character selection is hardcoded into Panda and -// cannot be changed here. (Note that an internal Panda filename -// always uses the forward slash, '/', to separate the components of a -// directory name.) - -// There's a different character used to separate the complete -// directory names in a search path specification. On Unix, the -// normal convention is ':', on Windows, it has to be ';', because the -// colon is already used to mark the drive letter. This character is -// selectable here. Most users won't want to change this. If -// multiple characters are placed in this string, any one of them may -// be used as a separator character. -#define DEFAULT_PATHSEP $[if $[WINDOWS_PLATFORM],;,:] - -// What level of compiler optimization/debug symbols should we build? -// The various optimize levels are defined as follows: -// -// 1 - No compiler optimizations, debug symbols, debug heap, lots of checks -// 2 - Full compiler optimizations, debug symbols, debug heap, lots of checks -// 3 - Full compiler optimizations, full debug symbols, fewer checks -// 4 - Full optimizations, no debug symbols, and asserts removed -// -#define OPTIMIZE 3 - -// On OSX, you may or may not want to compile universal binaries. - -// Turning this option on allows your compiled version of Panda to run -// on any version of OSX (PPC or Intel-based), but it will also -// increase the compilation time, as well as the resulting binary -// size. I believe you have to be building on an Intel-based platform -// to generate universal binaries using this technique. This option -// has no effect on non-OSX platforms. -#define UNIVERSAL_BINARIES - -// Panda uses prc files for runtime configuration. There are many -// compiled-in options to customize the behavior of the prc config -// system; most users won't need to change any of them. Feel free to -// skip over all of the PRC_* variables defined here. - -// The default behavior is to search for files names *.prc in the -// directory specified by the PRC_DIR environment variable, and then -// to search along all of the directories named by the PRC_PATH -// environment variable. Either of these variables might be -// undefined; if both of them are undefined, the default is to search -// in the directory named here by DEFAULT_PRC_DIR. - -// By default, we specify the install/etc dir, which is where the -// system-provided PRC files get copied to. -#defer DEFAULT_PRC_DIR $[INSTALL_DIR]/etc - -// You can specify the names of the environment variables that are -// used to specify the search location(s) for prc files at runtime. -// These are space-separated lists of environment variable names. -// Specify empty string for either one of these to disable the -// feature. For instance, redefining PRC_DIR_ENVVARS here to -// PANDA_PRC_DIR would cause the environment variable $PANDA_PRC_DIR -// to be consulted at startup instead of the default value of -// $PRC_DIR. -#define PRC_DIR_ENVVARS PRC_DIR -#define PRC_PATH_ENVVARS PRC_PATH - -// You can specify the name of the file(s) to search for in the above -// paths to be considered a config file. This should be a -// space-separated list of filename patterns. This is *.prc by -// default; normally there's no reason to change this. -#define PRC_PATTERNS *.prc - -// You can optionally encrypt your prc file(s) to help protect them -// from curious eyes. You have to specify the encryption key, which -// gets hard-coded into the executable. (This feature provides mere -// obfuscation, not real security, since the encryption key can -// potentially be extracted by a hacker.) This requires building with -// OpenSSL (see below). -#define PRC_ENCRYPTED_PATTERNS *.prc.pe -#define PRC_ENCRYPTION_KEY "" - -// One unusual feature of config is the ability to execute one or more -// of the files it discovers as if it were a program, and then treat -// the output of this program as a prc file. If you want to use this -// feature, define this variable to the filename pattern or patterns -// for such executable-style config programs (e.g. *prc.exe). This -// can be the same as the above if you like this sort of ambiguity; in -// that case, config will execute the file if it appears to be -// executable; otherwise, it will simply read it. -#define PRC_EXECUTABLE_PATTERNS - -// If you do use the above feature, you'll need another environment -// variable that specifies additional arguments to pass to the -// executable programs. The default definition, given here, makes -// that variable be $PRC_EXECUTABLE_ARGS. Sorry, the same arguments -// must be supplied to all executables in a given runtime session. -#define PRC_EXECUTABLE_ARGS_ENVVAR PRC_EXECUTABLE_ARGS - -// You can implement signed prc files, if you require this advanced -// feature. This allows certain config variables to be set only by a -// prc file that has been provided by a trusted source. To do this, -// first install and compile Dtool with OpenSSL (below) and run the -// program make-prc-key, and then specify here the output filename -// generated by that program, and then recompile Dtool (ppremake; make -// install). -#define PRC_PUBLIC_KEYS_FILENAME - -// By default, the signed-prc feature, above, is enabled only for a -// release build (OPTIMIZE = 4). In a normal development environment -// (OPTIMIZE < 4), any prc file can set any config variable, whether -// or not it is signed. Set this variable true (nonempty) or false -// (empty) to explicitly enable or disable this feature. -#defer PRC_RESPECT_TRUST_LEVEL $[= $[OPTIMIZE],4] - -// If trust level is in effect, this specifies the default trust level -// for any legacy (Dconfig) config variables (that is, variables -// created using the config.GetBool(), etc. interface, rather than the -// newer ConfigVariableBool interface). -#defer PRC_DCONFIG_TRUST_LEVEL 0 - -// If trust level is in effect, you may globally increment the -// (mis)trust level of all variables by the specified amount. -// Incrementing this value by 1 will cause all variables to require at -// least a level 1 signature. -#define PRC_INC_TRUST_LEVEL 0 - -// Similarly, the descriptions are normally saved only in a -// development build, not in a release build. Set this value true to -// explicitly save them anyway. -#defer PRC_SAVE_DESCRIPTIONS $[< $[OPTIMIZE],4] - -// This is the end of the PRC variable customization section. The -// remaining variables are of general interest to everyone. - - -// You may define this to build or develop the plugin. -//#define HAVE_P3D_PLUGIN 1 - -// You may define both of these to build or develop the Panda3D -// rtdist, the environment packaged up for distribution with the -// plugin. -//#define PANDA_PACKAGE_VERSION local_dev -//#define PANDA_PACKAGE_HOST_URL http://some.url/ -#defer HAVE_P3D_RTDIST $[PANDA_PACKAGE_HOST_URL] - - - -// NOTE: In the following, to indicate "yes" to a yes/no question, -// define the variable to be a nonempty string. To indicate "no", -// define the variable to be an empty string. - -// Many of the HAVE_* variables are defined in terms of expressions -// based on the paths and library names, etc., defined above. These -// are defined using the "defer" command, so that they are not -// evaluated right away, giving the user an opportunity to redefine -// the variables they depend on, or to redefine the HAVE_* variables -// themselves (you can explicitly define a HAVE_* variable to some -// nonempty string to force the package to be marked as installed). - - -// Do you want to generate a Python-callable interrogate interface? -// This is only necessary if you plan to make calls into Panda from a -// program written in Python. This is done only if HAVE_PYTHON, -// below, is also true. -#define INTERROGATE_PYTHON_INTERFACE 1 - -// Define this true to use the new interrogate feature to generate -// Python-native objects directly, rather than requiring a separate -// FFI step. This loads and runs much more quickly than the original -// mechanism. Define this false (that is, empty) to use the original -// interfaces. -#define PYTHON_NATIVE 1 - -// Do you want to generate a C-callable interrogate interface? This -// generates an interface similar to the Python interface above, with -// a C calling convention. It should be useful for most other kinds -// of scripting language; the VR Studio used to use this to make calls -// into Panda from Squeak. This is not presently used by any VR -// Studio code. -#define INTERROGATE_C_INTERFACE - -// Do you even want to build interrogate at all? This is the program -// that reads our C++ source files and generates one of the above -// interfaces. If you won't be building the interfaces, you don't -// need the program. -#defer HAVE_INTERROGATE $[or $[INTERROGATE_PYTHON_INTERFACE],$[INTERROGATE_C_INTERFACE]] - -// What additional options should be passed to interrogate when -// generating either of the above two interfaces? Generally, you -// probably don't want to mess with this. -#define INTERROGATE_OPTIONS -fnames -string -refcount -assert - -// What's the name of the interrogate binary to run? The default -// specified is the one that is built as part of DTOOL. If you have a -// prebuilt binary standing by (for instance, one built opt4), specify -// its name instead. -#define INTERROGATE interrogate -#define INTERROGATE_MODULE interrogate_module - -// What is the name of the C# compiler binary? -#define CSHARP csc - -// This defines the include path to the Eigen linear algebra library. -// If this is provided, Panda will use this library as the fundamental -// implementation of its own linmath library; otherwise, it will use -// its own internal implementation. The primary advantage of using -// Eigen is SSE2 support, which is only activated if LINMATH_ALIGN -// is also enabled. (However, activating LINMATH_ALIGN does -// constrain most objects in Panda to 16-byte alignment, which could -// impact memory usage on very-low-memory platforms.) Currently -// experimental. -#define EIGEN_IPATH -#defer EIGEN_CFLAGS $[if $[WINDOWS_PLATFORM],/arch:SSE2,-msse2] -#defer HAVE_EIGEN $[isdir $[EIGEN_IPATH]/Eigen] -#define LINMATH_ALIGN 1 - -// Is Python installed, and should Python interfaces be generated? If -// Python is installed, which directory is it in? -#define PYTHON_IPATH /usr/include/python2.6 -#define PYTHON_LPATH -#define PYTHON_FPATH -#define PYTHON_COMMAND python -#defer PYTHON_DEBUG_COMMAND $[PYTHON_COMMAND]$[if $[WINDOWS_PLATFORM],_d] -#define PYTHON_FRAMEWORK -#defer HAVE_PYTHON $[or $[PYTHON_FRAMEWORK],$[isdir $[PYTHON_IPATH]]] - -// By default, we'll assume the user only wants to run with Debug -// python if he has to--that is, on Windows when building a debug build. -#defer USE_DEBUG_PYTHON $[and $[< $[OPTIMIZE],3],$[WINDOWS_PLATFORM]] - -// Define the default set of libraries to be instrumented by -// genPyCode. You may wish to add to this list to add your own -// libraries, or if you want to use some of the more obscure -// interfaces like libpandaegg and libpandafx. -#defer GENPYCODE_LIBS libpandaexpress libpanda libpandaphysics libp3direct libpandafx libp3vision $[if $[HAVE_ODE],libpandaode] $[if $[HAVE_VRPN],libp3vrpn] - -// Normally, Python source files are copied into the INSTALL_LIB_DIR -// defined above, along with the compiled C++ library objects, when -// you make install. If you prefer not to copy these Python source -// files, but would rather run them directly out of the source -// directory (presumably so you can develop them and make changes -// without having to reinstall), comment out this definition and put -// your source directory on your PYTHONPATH. -#define INSTALL_PYTHON_SOURCE 1 - -// Do you want to compile in support for tracking memory usage? This -// enables you to define the variable "track-memory-usage" at runtime -// to help track memory leaks, and also report total memory usage on -// PStats. There is some small overhead for having this ability -// available, even if it is unused. -#defer DO_MEMORY_USAGE $[<= $[OPTIMIZE], 3] - -// This option compiles in support for simulating network delay via -// the min-lag and max-lag prc variables. It adds a tiny bit of -// overhead even when it is not activated, so it is typically enabled -// only in a development build. -#defer SIMULATE_NETWORK_DELAY $[<= $[OPTIMIZE], 3] - -// This option compiles in support for immediate-mode OpenGL -// rendering. Since this is normally useful only for researching -// buggy drivers, and since there is a tiny bit of per-primitive -// overhead to have this option available even if it is unused, it is -// by default enabled only in a development build. This has no effect -// on DirectX rendering. -#defer SUPPORT_IMMEDIATE_MODE $[<= $[OPTIMIZE], 3] - -// These are two optional alternative memory-allocation schemes -// available within Panda. You can experiment with either of them to -// see if they give better performance than the system malloc(), but -// at the time of this writing, it doesn't appear that they do. -#define USE_MEMORY_DLMALLOC -#define USE_MEMORY_PTMALLOC2 - -// Set this true if you prefer to use the system malloc library even -// if 16-byte alignment must be performed on top of it, wasting up to -// 30% of memory usage. If you do not set this, and 16-byte alignment -// is required and not provided by the system malloc library, then an -// alternative malloc system (above) will be used instead. -#define MEMORY_HOOK_DO_ALIGN - -// Panda contains some experimental code to compile for IPhone. This -// requires the Apple IPhone SDK, which is currently only available -// for OS X platforms. Set this to either "iPhoneSimulator" or -// "iPhoneOS". Note that this is still *experimental* and incomplete! -// Don't enable this unless you know what you're doing! -#define BUILD_IPHONE - -// Panda contains some experimental code to compile for Android. This -// requires the Google Android NDK. -// Besides BUILD_ANDROID, you'll also have to set ANDROID_NDK_HOME -// to the location of the Android NDK directory. ANDROID_NDK_HOME may -// not contain any spaces. -// Furthermore, ANDROID_ABI can be set to armeabi, armeabi-v7a, x86, -// or mips, depending on which architecture should be targeted. -#define ANDROID_NDK_HOME -#define ANDROID_ABI armeabi -#define ANDROID_STL gnustl_shared -#define ANDROID_PLATFORM android-9 -#define ANDROID_ARCH arm -#defer ANDROID_TOOLCHAIN $[if $[eq $[ANDROID_ARCH],arm],arm-linux-androideabi] - -// Do you want to use one of the alternative malloc implementations? -// This is almost always a good idea on Windows, where the standard -// malloc implementation appears to be pretty poor, but probably -// doesn't matter much on Linux (which is likely to implement -// ptmalloc2 anyway). We always define this by default on Windows; on -// Linux, we define it by default only when DO_MEMORY_USAGE is enabled -// (since in that case, we'll be paying the overhead for the extra -// call anyway) or when HAVE_THREADS is not defined (since the -// non-thread-safe dlmalloc is a tiny bit faster than the system -// library). - -// In hindsight, let's not enable this at all. It just causes -// problems. -//#defer ALTERNATIVE_MALLOC $[or $[WINDOWS_PLATFORM],$[DO_MEMORY_USAGE],$[not $[HAVE_THREADS]]] -#define ALTERNATIVE_MALLOC - -// Define this true to use the DELETED_CHAIN macros, which support -// fast re-use of existing allocated blocks, minimizing the low-level -// calls to malloc() and free() for frequently-created and -deleted -// objects. There's usually no reason to set this false, unless you -// suspect a bug in Panda's memory management code. -#define USE_DELETED_CHAIN 1 - -// Define this if you are building on Windows 7 or better, and you -// want your Panda build to run only on Windows 7 or better, and you -// need to use the Windows touchinput interfaces. -#define HAVE_WIN_TOUCHINPUT - -// Define this true to build the low-level native network -// implementation. Normally this should be set true. -#define WANT_NATIVE_NET 1 -#define NATIVE_NET_IPATH -#define NATIVE_NET_LPATH -#define NATIVE_NET_LIBS $[if $[WINDOWS_PLATFORM],wsock32.lib] - -// Do you want to build the high-level network interface? This layers -// on top of the low-level native_net interface, specified above. -// Normally, if you build NATIVE_NET, you will also build NET. -#defer HAVE_NET $[WANT_NATIVE_NET] - -// Do you want to build the egg loader? Usually there's no reason to -// avoid building this, unless you really want to make a low-footprint -// build (such as, for instance, for the iPhone). -#define HAVE_EGG 1 - -// Is a third-party STL library installed, and where? This is only -// necessary if the default include and link lines that come with the -// compiler don't provide adequate STL support. At least some form of -// STL is absolutely required in order to build Panda. -#define STL_IPATH -#define STL_LPATH -#define STL_CFLAGS -#define STL_LIBS - -// Does your STL library provide hashed associative containers like -// hash_map and hash_set? Define this true if you have a nonstandard -// STL library that provides these, like Visual Studio .NET's. (These -// hashtable containers are not part of the C++ standard yet, but the -// Dinkum STL library that VC7 ships with includes a preliminary -// implementation that Panda can optionally use.) For now, we assume -// you have this by default only on a Windows platform. - -// On second thought, it turns out that this API is still too -// volatile. The interface seems to have changed with the next -// version of .NET, and it didn't present any measureable performance -// gain anyway. Never mind. -#define HAVE_STL_HASH - -// Is OpenSSL installed, and where? -#define OPENSSL_IPATH -#define OPENSSL_LPATH -#define OPENSSL_LIBS ssl crypto -#defer HAVE_OPENSSL $[libtest $[OPENSSL_LPATH],$[OPENSSL_LIBS]] - -// Define this true to include the OpenSSL code to report verbose -// error messages when they occur. -#defer REPORT_OPENSSL_ERRORS $[< $[OPTIMIZE], 4] - -// Is libjpeg installed, and where? -#define JPEG_IPATH -#define JPEG_LPATH -#define JPEG_LIBS jpeg -#defer HAVE_JPEG $[libtest $[JPEG_LPATH],$[JPEG_LIBS]] - -// Some versions of libjpeg did not provide jpegint.h. Redefine this -// to empty if you lack this header file. -#define PHAVE_JPEGINT_H 1 - -// Do you want to compile video-for-linux? If you have an older Linux -// system with incompatible headers, define this to empty string. -#defer HAVE_VIDEO4LINUX $[IS_LINUX] - -// Is libpng installed, and where? -#define PNG_IPATH -#define PNG_LPATH -#define PNG_LIBS png -#defer HAVE_PNG $[libtest $[PNG_LPATH],$[PNG_LIBS]] - -// Is libtiff installed, and where? -#define TIFF_IPATH -#define TIFF_LPATH -#define TIFF_LIBS tiff z -#defer HAVE_TIFF $[libtest $[TIFF_LPATH],$[TIFF_LIBS]] - -// These image file formats don't require the assistance of a -// third-party library to read and write, so there's normally no -// reason to disable them in the build, unless you are looking to -// reduce the memory footprint. -#define HAVE_SGI_RGB 1 -#define HAVE_TGA 1 -#define HAVE_IMG 1 -#define HAVE_SOFTIMAGE_PIC 1 -#define HAVE_BMP 1 -#define HAVE_PNM 1 - -// Is libtar installed, and where? This is used to optimize patch -// generation against tar files. -#define TAR_IPATH -#define TAR_LPATH -#define TAR_LIBS tar -#defer HAVE_TAR $[libtest $[TAR_LPATH],$[TAR_LIBS]] - - -// Is libfftw installed, and where? -#define FFTW_IPATH /opt/local/include -#define FFTW_LPATH /opt/local/lib -#define FFTW_LIBS rfftw fftw -#defer HAVE_FFTW $[libtest $[FFTW_LPATH],$[FFTW_LIBS]] -// This is because darwinport's version of the fftw lib is called -// drfftw instead of rfftw. -#defer PHAVE_DRFFTW_H $[libtest $[FFTW_LPATH],drfftw] - -// Is libsquish installed, and where? -#define SQUISH_IPATH /usr/local/include -#define SQUISH_LPATH /usr/local/lib -#define SQUISH_LIBS squish -#defer HAVE_SQUISH $[libtest $[SQUISH_LPATH],$[SQUISH_LIBS]] - - -// Is Berkeley DB installed, and where? Presently, this is only used -// for some applications (egg-optchar in particular) in Pandatool, and -// it is completely optional there. If available, egg-optchar takes -// advantage of it to allow the optimization of very large numbers of -// models in one pass, that might otherwise exceed available memory. - -// Actually, this isn't even true anymore. At the time of this writing, -// no system in Panda makes use of Berkeley DB. So don't bother to -// define this. -#define BDB_IPATH -#define BDB_LPATH -#define BDB_LIBS db db_cxx -#defer HAVE_BDB $[libtest $[BDB_LPATH],$[BDB_LIBS]] - -// Is Cg installed, and where? -#if $[WINDOWS_PLATFORM] - #define CG_IPATH - #define CG_LPATH - #define CG_LIBS cg.lib -#else - #define CG_IPATH - #define CG_LPATH - #define CG_LIBS Cg -#endif -#define CG_FRAMEWORK -#defer HAVE_CG $[or $[CG_FRAMEWORK],$[libtest $[CG_LPATH],$[CG_LIBS]]] - -// Is CgGL installed, and where? -#defer CGGL_IPATH $[CG_IPATH] -#defer CGGL_LPATH $[CG_LPATH] -#define CGGL_LIBS $[if $[WINDOWS_PLATFORM],cgGL.lib,CgGL] -#defer HAVE_CGGL $[or $[CGGL_FRAMEWORK],$[and $[HAVE_CG],$[libtest $[CGGL_LPATH],$[CGGL_LIBS]]]] - -// Is CgDX9 installed, and where? -#defer CGDX9_IPATH $[CG_IPATH] -#defer CGDX9_LPATH $[CG_LPATH] -#define CGDX9_LIBS $[if $[WINDOWS_PLATFORM],cgD3D9.lib,CgDX9] -#defer HAVE_CGDX9 $[and $[HAVE_CG],$[libtest $[CGDX9_LPATH],$[CGDX9_LIBS]]] - -// Is CgDX10 installed, and where? -#defer CGDX10_IPATH $[CG_IPATH] -#defer CGDX10_LPATH $[CG_LPATH] -#define CGDX10_LIBS $[if $[WINDOWS_PLATFORM],cgD3D10.lib,CgDX10] -#defer HAVE_CGDX10 $[and $[HAVE_CG],$[libtest $[CGDX10_LPATH],$[CGDX10_LIBS]]] - -// Is VRPN installed, and where? -#define VRPN_IPATH -#define VRPN_LPATH -#define VRPN_LIBS -#defer HAVE_VRPN $[libtest $[VRPN_LPATH],$[VRPN_LIBS]] - -// Is HELIX installed, and where? -#define HELIX_IPATH -#define HELIX_LPATH -#define HELIX_LIBS -#defer HAVE_HELIX $[libtest $[HELIX_LPATH],$[HELIX_LIBS]] - -// Is ZLIB installed, and where? -#define ZLIB_IPATH -#define ZLIB_LPATH -#define ZLIB_LIBS z -#defer HAVE_ZLIB $[libtest $[ZLIB_LPATH],$[ZLIB_LIBS]] - -// Is OpenGL installed, and where? -#defer GL_IPATH /usr/include -#defer GL_LPATH -#defer GL_LIBS -#if $[WINDOWS_PLATFORM] - #define GL_LIBS opengl32.lib -#elif $[OSX_PLATFORM] - #defer GL_FRAMEWORK OpenGL -#else - #defer GL_LPATH /usr/X11R6/lib - #defer GL_LIBS GL -#endif -#defer HAVE_GL $[libtest $[GL_LPATH],$[GL_LIBS]] - -// If you are having trouble linking in OpenGL extension functions at -// runtime for some reason, you can set this variable. This defines -// the minimum runtime version of OpenGL that Panda will require. -// Setting it to a higher version will compile in hard references to -// the extension functions provided by that OpenGL version and below, -// which may reduce runtime portability to other systems, but it will -// avoid issues with getting extension function pointers. It also, of -// course, requires you to install the OpenGL header files and -// compile-time libraries appropriate to the version you want to -// compile against. - -// The variable is the major, minor version of OpenGL, separated by a -// space (instead of a dot). Thus, "1 1" means OpenGL version 1.1. -#define MIN_GL_VERSION 1 1 - -// Do you want to build tinydisplay, a light and fast software -// renderer built into Panda, based on TinyGL? This isn't as -// full-featured as Mesa, but it is many times faster, and in fact -// competes favorably with hardware-accelerated integrated graphics -// cards for raw speed (though the hardware-accelerated output looks -// better). -#define HAVE_TINYDISPLAY 1 - -// Is OpenGL ES 1.x installed, and where? This is a minimal subset of -// OpenGL for mobile devices. -#define GLES_IPATH -#define GLES_LPATH -#define GLES_LIBS GLES_cm -#defer HAVE_GLES $[libtest $[GLES_LPATH],$[GLES_LIBS]] - -// OpenGL ES 2.x is a version of OpenGL ES but without fixed-function -// pipeline - everything is programmable there. -#define GLES2_IPATH -#define GLES2_LPATH -#define GLES2_LIBS GLESv2 -#defer HAVE_GLES2 $[libtest $[GLES2_LPATH],$[GLES2_LIBS]] - -// EGL is like GLX, but for OpenGL ES. -#defer EGL_IPATH -#defer EGL_LPATH -#defer EGL_LIBS EGL -#defer HAVE_EGL $[libtest $[EGL_LPATH],$[EGL_LIBS]] - -// The SDL library is useful only for tinydisplay, and is not even -// required for that, as tinydisplay is also supported natively on -// each supported platform. -#define SDL_IPATH -#define SDL_LPATH -#define SDL_LIBS -#defer HAVE_SDL $[libtest $[SDL_LPATH],$[SDL_LIBS]] - -// X11 may need to be linked against for tinydisplay, but probably -// only on a Linux platform. -#define X11_IPATH -#define X11_LPATH /usr/X11R6/lib -#define X11_LIBS X11 -#defer HAVE_X11 $[and $[UNIX_PLATFORM],$[libtest $[X11_LPATH],$[X11_LIBS]]] - -// This defines if we have XF86DGA installed. This enables smooth -// FPS-style mouse in x11display, when mouse mode M_relative is used. -#define XF86DGA_IPATH /usr/include/X11/extensions -#define XF86DGA_LPATH /usr/lib -#define XF86DGA_LIBS Xxf86dga -#defer HAVE_XF86DGA $[libtest $[XF86DGA_LPATH],$[XF86DGA_LIBS]] - -// This defines if we have XRANDR installed. This -// enables resolution switching in x11display. -#define XRANDR_IPATH /usr/include/X11/extensions -#define XRANDR_LPATH /usr/lib -#define XRANDR_LIBS Xrandr -#defer HAVE_XRANDR $[libtest $[XRANDR_LPATH],$[XRANDR_LIBS]] - -// This defines if we have XCURSOR installed. This -// enables custom cursor support in x11display. -#define XCURSOR_IPATH /usr/include/X11/extensions -#define XCURSOR_LPATH /usr/lib -#define XCURSOR_LIBS Xcursor -#defer HAVE_XCURSOR $[libtest $[XCURSOR_LPATH],$[XCURSOR_LIBS]] - -// How about GLX? -#define GLX_IPATH -#define GLX_LPATH -#defer HAVE_GLX $[and $[HAVE_GL],$[HAVE_X11]] - -// glXGetProcAddress() is the function used to query OpenGL extensions -// under X. However, this function is itself an extension function, -// leading to a chicken-and-egg problem. One approach is to compile -// in a hard reference to the function, another is to pull the -// function address from the dynamic runtime. Each has its share of -// problems. Panda's default behavior is to pull it from the dynamic -// runtime; define this to compile in a reference to the function. -// This is only relevant from platforms using OpenGL under X (for -// instance, Linux). -#define LINK_IN_GLXGETPROCADDRESS - -// Should we try to build the WGL interface? -#defer HAVE_WGL $[and $[HAVE_GL],$[WINDOWS_PLATFORM]] - -// These interfaces are for OSX only. -#define HAVE_COCOA -#define HAVE_CARBON - -// Is DirectX9 available, and should we try to build with it? -#define DX9_IPATH -#define DX9_LPATH -#define DX9_LIBS d3d9.lib d3dx9.lib dxerr9.lib -#defer HAVE_DX9 $[libtest $[DX9_LPATH],$[DX9_LIBS]] - -// Set this nonempty to use instead of . The -// choice between the two is largely based on which version of the -// DirectX SDK(s) you might have installed. The generic library is -// the default for 64-bit windows. -#defer USE_GENERIC_DXERR_LIBRARY $[WIN64_PLATFORM] - -// Do we have at least OpenCV 2.3? -#define OPENCV_VER_23 1 - -// Is OpenCV installed, and where? -#define OPENCV_IPATH -#define OPENCV_LPATH -#defer OPENCV_LIBS $[if $[OPENCV_VER_23], opencv_highgui opencv_core, cv highgui cxcore] -#defer HAVE_OPENCV $[libtest $[OPENCV_LPATH],$[OPENCV_LIBS]] - -// Is FFMPEG installed, and where? -#define FFMPEG_IPATH /usr/include/ffmpeg -#define FFMPEG_LPATH -#define FFMPEG_LIBS $[if $[WINDOWS_PLATFORM],avcodec.lib avformat.lib avutil.lib swscale.lib swresample.lib,avcodec avformat avutil swscale swresample] -#defer HAVE_FFMPEG $[libtest $[FFMPEG_LPATH],$[FFMPEG_LIBS]] -// Define this if you compiled ffmpeg with libswscale enabled. -#define HAVE_SWSCALE 1 -#define HAVE_SWRESAMPLE 1 - -// Is ODE installed, and where? -#define ODE_IPATH -#define ODE_LPATH -#define ODE_LIBS $[if $[WINDOWS_PLATFORM],ode.lib,ode] -#define ODE_CFLAGS -#defer HAVE_ODE $[libtest $[ODE_LPATH],$[ODE_LIBS]] - -// Is Awesomium installed, and where? -#define AWESOMIUM_IPATH -#define AWESOMIUM_LPATH -#if $[OSX_PLATFORM] - #define AWESOMIUM_LIBS -#else - #define AWESOMIUM_LIBS $[if $[WINDOWS_PLATFORM],awesomium.lib,awesomium] -#endif -#define AWESOMIUM_FRAMEWORK -#defer HAVE_AWESOMIUM $[libtest $[AWESOMIUM_LPATH],$[AWESOMIUM_LIBS]] - -// Mozilla's so-called Gecko SDK, a.k.a. Xulrunner SDK, implements -// NPAPI. So does the OSX WebKit framework. Either implementation -// can be used to build a web plugin for Firefox, Safari, Chrome, and -// other non-Microsoft browsers. -#define NPAPI_IPATH -#define NPAPI_LPATH -#define NPAPI_LIBS -#define NPAPI_FRAMEWORK -#define HAVE_NPAPI - -#define HAVE_ACTIVEX $[WINDOWS_PLATFORM] - -// Do you want to build the DirectD tools for starting Panda clients -// remotely? This only affects the direct tree. Enabling this may -// cause libdirect.dll to fail to load on Win98 clients. -#define HAVE_DIRECTD - -// If your system supports the Posix threads interface -// (pthread_create(), etc.), define this true. -#define HAVE_POSIX_THREADS $[and $[isfile /usr/include/pthread.h],$[not $[WINDOWS_PLATFORM]]] - -// Do you want to build in support for threading (multiprocessing)? -// Building in support for threading will enable Panda to take -// advantage of multiple CPU's if you have them (and if the OS -// supports kernel threads running on different CPU's), but it will -// slightly slow down Panda for the single CPU case, so this is not -// enabled by default. -#define HAVE_THREADS 1 -#define THREADS_LIBS $[if $[not $[WINDOWS_PLATFORM]],pthread] - -// If you have enabled threading support with HAVE_THREADS, the -// default is to use OS-provided threading constructs, which usually -// allows for full multiprogramming support (i.e. the program can take -// advantage of multiple CPU's). On the other hand, compiling in this -// full OS-provided support can impose some substantial runtime -// overhead, making the application run slower on a single-CPU -// machine. To avoid this overhead, but still gain some of the basic -// functionality of threads (such as support for asynchronous model -// loads), define SIMPLE_THREADS true in addition to HAVE_THREADS. -// This will compile in a homespun cooperative threading -// implementation that runs strictly on one CPU, adding very little -// overhead over plain single-threaded code. -#define SIMPLE_THREADS - -// If this is defined true, then OS threading constructs will be used -// (if available) to perform context switches in the SIMPLE_THREADS -// model, instead of strictly user-space calls like setjmp/longjmp. A -// mutex is used to ensure that only one thread runs at a time, so the -// normal SIMPLE_THREADS optimizations still apply, and the normal -// SIMPLE_THREADS scheduler is used to switch between threads (instead -// of the OS scheduler). This may be more portable and more reliable, -// but it is a weird hybrid between user-space threads and os-provided -// threads. This has meaning only if SIMPLE_THREADS is also defined. -#define OS_SIMPLE_THREADS 1 - -// Whether threading is defined or not, you might want to validate the -// thread and synchronization operations. With threading enabled, -// defining this will also enable deadlock detection and logging. -// Without threading enabled, defining this will simply verify that a -// mutex is not recursively locked. There is, of course, additional -// run-time overhead for these tests. -#defer DEBUG_THREADS $[<= $[OPTIMIZE], 2] - -// Do you want to compile in support for pipelining? This adds code -// to maintain a different copy of the scene graph for each thread in -// the render pipeline, so that app, cull, and draw may each safely -// run in a separate thread, allowing maximum parallelization of CPU -// processing for the frame. Enabling this option does not *require* -// you to use separate threads for rendering, but makes it possible. -// However, compiling this option in does add some additional runtime -// overhead even if it is not used. By default, we enable pipelining -// whenever threads are enabled, assuming that if you have threads, -// you also want to use pipelining. We also enable it at OPTIMIZE -// level 1, since that enables additional runtime checks. -#defer DO_PIPELINING $[or $[<= $[OPTIMIZE], 1],$[HAVE_THREADS]] - -// Define this true to implement mutexes and condition variables via -// user-space spinlocks, instead of via OS-provided constructs. This -// is almost never a good idea, except possibly in very specialized -// cases when you are building Panda for a particular application, on -// a particular platform, and you are sure you won't have more threads -// than CPU's. Even then, OS-based locking is probably better. -#define MUTEX_SPINLOCK - -// Define this to use the PandaFileStream interface for pifstream, -// pofstream, and pfstream. This is a customized file buffer that may -// have slightly better newline handling, but its primary benefit is -// that it supports SIMPLE_THREADS better by blocking just the active -// "thread" when I/O is delayed, instead of blocking the entire -// process. Normally, there's no reason to turn this off, unless you -// suspect a bug in Panda. -#define USE_PANDAFILESTREAM 1 - -// Do you want to build the PStats interface, for graphical run-time -// performance statistics? This requires NET to be available. By -// default, we don't build PStats when OPTIMIZE = 4, although this is -// possible. -#defer DO_PSTATS $[or $[and $[HAVE_NET],$[< $[OPTIMIZE], 4]], $[DO_PSTATS]] - -// Do you want to type-check downcasts? This is a good idea during -// development, but does impose some run-time overhead. -#defer DO_DCAST $[< $[OPTIMIZE], 3] - -// Do you want to build the debugging tools for recording and -// visualizing intersection tests by the collision system? Enabling -// this increases runtime collision overhead just a tiny bit. -#defer DO_COLLISION_RECORDING $[< $[OPTIMIZE], 4] - -// Do you want to include the "debug" and "spam" Notify messages? -// Normally, these are stripped out when we build with OPTIMIZE = 4, but -// sometimes it's useful to keep them around. Redefine this in your -// own Config.pp to achieve that. -#defer NOTIFY_DEBUG $[< $[OPTIMIZE], 4] - -// Do you want to build the audio interface? -#define HAVE_AUDIO 1 - -// The Tau profiler provides a multiplatform, thread-aware profiler. -// To use it, define USE_TAU to 1, and set TAU_MAKEFILE to the -// filename that contains the Tau-provided Makefile for your platform. -// Then rebuild the code with ppremake; make install. Alternatively, -// instead of setting TAU_MAKEFILE, you can also define TAU_ROOT and -// PDT_ROOT, to point to the root directory of the tau and pdtoolkit -// installations, respectively; then the individual Tau components -// will be invoked directly. This is especially useful on Windows, -// where there is no Tau Makefile. -#define TAU_MAKEFILE -#define TAU_ROOT -#define PDT_ROOT -#define TAU_OPTS -optKeepFiles -optRevert -#define TAU_CFLAGS -#define USE_TAU - -// Info for the RAD game tools, Miles Sound System -// note this may be overwritten in wintools Config.pp -#define RAD_MSS_IPATH /usr/include/Miles6/include -#define RAD_MSS_LPATH /usr/lib/Miles6/lib/win -#define RAD_MSS_LIBS Mss32 -#defer HAVE_RAD_MSS $[libtest $[RAD_MSS_LPATH],$[RAD_MSS_LIBS]] - -// Info for the Fmod audio engine -#define FMODEX_IPATH /usr/local/fmod/api/inc -#define FMODEX_LPATH /usr/local/fmod/api/lib -#define FMODEX_LIBS $[if $[libtest $[FMODEX_LPATH],fmodex64],fmodex64,fmodex] -#defer HAVE_FMODEX $[libtest $[FMODEX_LPATH],$[FMODEX_LIBS]] - -// Info for the OpenAL audio engine -#define OPENAL_IPATH -#define OPENAL_LPATH -#if $[OSX_PLATFORM] - #define OPENAL_LIBS - #define OPENAL_FRAMEWORK OpenAL -#else - #define OPENAL_LIBS openal - #define OPENAL_FRAMEWORK -#endif -#defer HAVE_OPENAL $[or $[OPENAL_FRAMEWORK],$[libtest $[OPENAL_LPATH],$[OPENAL_LIBS]]] - -// Info for the NVIDIA PhysX SDK -#define PHYSX_IPATH /usr/include/PhysX/v2.8.3/SDKs/Cooking/include /usr/include/PhysX/v2.8.3/SDKs/Foundation/include /usr/include/PhysX/v2.8.3/SDKs/NxCharacter/include /usr/include/PhysX/v2.8.3/SDKs/Physics/include /usr/include/PhysX/v2.8.3/SDKs/PhysXLoader/include -#define PHYSX_LPATH /usr/lib/PhysX/v2.8.3 -#define PHYSX_LIBS $[if $[WINDOWS_PLATFORM],PhysXLoader.lib NxCharacter.lib NxCooking.lib NxExtensions.lib,PhysXLoader NxCharacter NxCooking] -#defer HAVE_PHYSX $[libtest $[PHYSX_LPATH],$[PHYSX_LIBS]] - -// Info for the SpeedTree tree and terrain rendering library. This is -// a commercial library that specializes in rendering trees and other -// foliage. - -// This may be either "OpenGL" or "DirectX9". Case is important, due -// to the naming of the SpeedTree libraries. -#define SPEEDTREE_API OpenGL -// The local directory in which the SpeedTree SDK has been installed. -#define SPEEDTREE_SDK_DIR -// The default directory in which to find the SpeedTree installation at runtime. -#defer SPEEDTREE_BIN_DIR $[SPEEDTREE_SDK_DIR]/Bin - -#defer SPEEDTREE_IPATH $[SPEEDTREE_SDK_DIR]/Include -#defer SPEEDTREE_LPATH $[SPEEDTREE_SDK_DIR]/Lib/Windows/VC9$[if $[WIN64_PLATFORM],.x64] -#defer SPEEDTREE_DEBUG $[if $[< $[OPTIMIZE], 3],_d] -#defer SPEEDTREE_64 $[if $[WIN64_PLATFORM],64] - -// These names are used to build up the names of the SpeedTree libraries. -#defer SPEEDTREE_VERSION 5.1 -#defer SPEEDTREE_LIB_SUFFIX _v$[SPEEDTREE_VERSION]_VC90MT$[SPEEDTREE_64]_Static$[SPEEDTREE_DEBUG].lib -#if $[WINDOWS_PLATFORM] -#defer SPEEDTREE_LIBS SpeedTreeCore$[SPEEDTREE_LIB_SUFFIX] SpeedTreeForest$[SPEEDTREE_LIB_SUFFIX] SpeedTree$[SPEEDTREE_API]Renderer$[SPEEDTREE_LIB_SUFFIX] SpeedTreeRenderInterface$[SPEEDTREE_LIB_SUFFIX] $[if $[eq $[SPEEDTREE_API],OpenGL],glew32.lib glu32.lib] -#else -#defer SPEEDTREE_LIBS -#endif -#defer HAVE_SPEEDTREE $[isdir $[SPEEDTREE_SDK_DIR]] - -// Is gtk+-2 installed? This is needed to build the pstats program on -// Unix (or non-Windows) platforms. It is also used to provide -// support for XEmbed for the web plugin system, which is necessary to -// support Chromium on Linux. -#define PKG_CONFIG pkg-config -#define HAVE_GTK - -// Do we have Freetype 2.0 (or better)? If available, this package is -// used to generate dynamic in-the-world text from font files. - -// On Unix, freetype comes with the freetype-config executable, which -// tells us where to look for the various files. On Windows, we need to -// supply this information explicitly. -#defer FREETYPE_CONFIG $[if $[not $[WINDOWS_PLATFORM]],freetype-config] -#defer HAVE_FREETYPE $[or $[libtest $[FREETYPE_LPATH],$[FREETYPE_LIBS]],$[bintest $[FREETYPE_CONFIG]]] - -#define FREETYPE_CFLAGS -#define FREETYPE_IPATH -#define FREETYPE_LPATH -#define FREETYPE_LIBS - -// Define this true to compile in a default font, so every TextNode -// will always have a font available without requiring the user to -// specify one. Define it empty not to do this, saving a few -// kilobytes on the generated library. Sorry, you can't pick a -// particular font to be the default; it's hardcoded in the source -// (although you can use the text-default-font prc variable to specify -// a particular font file to load as the default, overriding the -// compiled-in font). -#define COMPILE_IN_DEFAULT_FONT 1 - -// Define this true to compile a special version of Panda to use a -// "double" floating-precision type for most internal values, such as -// positions and transforms, instead of the standard single-precision -// "float" type. This does not affect the default numeric type of -// vertices, which is controlled by the runtime config variable -// vertices-float64. -#define STDFLOAT_DOUBLE - -// We use wxWidgets--the C++ library, not the Python library--for -// building the application p3dcert, which is needed only when -// building the plugin/runtime system. This uses a wx-config program, -// similar to freetype, above. -#defer WX_CONFIG $[if $[not $[WINDOWS_PLATFORM]],wx-config] -#defer HAVE_WX $[or $[libtest $[WX_LPATH],$[WX_LIBS]],$[bintest $[WX_CONFIG]]] - -#define WX_CFLAGS -#define WX_IPATH -#define WX_LPATH -#define WX_LIBS - -// We use FLTK--the C++ library, not the Python library--for -// building the application p3dcert, which is needed only when -// building the plugin/runtime system. This uses a fltk-config program, -// similar to freetype, above. -#defer FLTK_CONFIG $[if $[not $[WINDOWS_PLATFORM]],fltk-config] -#defer HAVE_FLTK $[or $[libtest $[FLTK_LPATH],$[FLTK_LIBS]],$[bintest $[FLTK_CONFIG]]] - -#define FLTK_CFLAGS -#define FLTK_IPATH -#define FLTK_LPATH -#define FLTK_LIBS - -// Is Maya installed? This matters only to programs in PANDATOOL. - -// Also, as of Maya 5.0 it seems the Maya library will not compile -// properly with optimize level 4 set (we get link errors with ostream). - -#define MAYA_LOCATION /usr/aw/maya -#defer MAYA_LIBS $[if $[WINDOWS_PLATFORM],Foundation.lib OpenMaya.lib OpenMayaAnim.lib OpenMayaUI.lib,Foundation OpenMaya OpenMayaAnim OpenMayaUI] -// Optionally define this to the value of LM_LICENSE_FILE that should -// be set before invoking Maya. -#define MAYA_LICENSE_FILE -#defer HAVE_MAYA $[and $[<= $[OPTIMIZE], 3],$[isdir $[MAYA_LOCATION]/include/maya]] -// Define this if your version of Maya is earlier than 5.0 (e.g. Maya 4.5). -#define MAYA_PRE_5_0 - -#define MAYA2EGG maya2egg - -// In the same fashion as mayaegg converter above, set softimage to egg converter as well -#define SOFTIMAGE_LOCATION /c/Softimage/sdk_18sp2/SDK_1.8SP2/SAAPHIRE -#defer SOFTIMAGE_LIBS SAA.lib -#defer HAVE_SOFTIMAGE $[isdir $[SOFTIMAGE_LOCATION]/h] - -// Is FCollada installed? This is for the daeegg converter. -#define FCOLLADA_IPATH /usr/local/include/fcollada -#define FCOLLADA_LPATH /usr/local/lib -#define FCOLLADA_LIBS FColladaSD -#defer HAVE_FCOLLADA $[libtest $[FCOLLADA_LPATH],$[FCOLLADA_LIBS]] - -// Is the COLLADA DOM installed? This is for the native COLLADA loader. -// This defines the versions that your copy of COLLADA DOM supports. -#define COLLADA14DOM_IPATH /usr/local/include/collada-dom /usr/local/include/collada-dom/1.4 -#define COLLADA14DOM_LPATH /usr/local/lib -#define COLLADA14DOM_LIBS collada14dom xml2 boost_filesystem -#defer HAVE_COLLADA14DOM $[libtest $[COLLADA14DOM_LPATH],$[COLLADA14DOM_LIBS]] - -#define COLLADA15DOM_IPATH /usr/local/include/collada-dom /usr/local/include/collada-dom/1.5 -#define COLLADA15DOM_LPATH /usr/local/lib -#define COLLADA15DOM_LIBS collada15dom xml2 boost_filesystem -#defer HAVE_COLLADA15DOM $[libtest $[COLLADA15DOM_LPATH],$[COLLADA15DOM_LIBS]] - -// The Assimp library loads various model formats. -#define ASSIMP_IPATH /usr/local/include/assimp -#define ASSIMP_LPATH /usr/local/lib -#define ASSIMP_LIBS assimp -#define HAVE_ASSIMP $[libtest $[ASSIMP_LPATH],$[ASSIMP_LIBS]] - -// Also for the ARToolKit library, for augmented reality -#define ARTOOLKIT_IPATH -#define ARTOOLKIT_LPATH -#define ARTOOLKIT_LIBS $[if $[WINDOWS_PLATFORM],libAR.lib,AR] -#defer HAVE_ARTOOLKIT $[libtest $[ARTOOLKIT_LPATH],$[ARTOOLKIT_LIBS]] - -// libRocket is a GUI library -#define ROCKET_IPATH /usr/local/include -#define ROCKET_LPATH /usr/local/lib -#define ROCKET_LIBS RocketCore RocketDebugger boost_python -#defer HAVE_ROCKET $[libtest $[ROCKET_LPATH],$[ROCKET_LIBS]] -#defer HAVE_ROCKET_DEBUGGER $[< $[OPTIMIZE],4] -// Unset this if you built libRocket without Python bindings -#defer HAVE_ROCKET_PYTHON $[and $[HAVE_ROCKET],$[HAVE_PYTHON]] - -// Bullet is a physics engine -#define BULLET_IPATH /usr/local/include/bullet -#define BULLET_LPATH /usr/local/lib -#if $[WIN64_PLATFORM] -#define BULLET_LIBS BulletSoftBody_x64.lib BulletDynamics_x64.lib BulletCollision_x64.lib LinearMath_x64.lib -#elif $[WINDOWS_PLATFORM] -#define BULLET_LIBS BulletSoftBody.lib BulletDynamics.lib BulletCollision.lib LinearMath.lib -#else -#define BULLET_LIBS BulletSoftBody BulletDynamics BulletCollision LinearMath -#endif -#defer HAVE_BULLET $[libtest $[BULLET_LPATH],$[BULLET_LIBS]] - -// libvorbisfile is used for reading Ogg Vorbis audio files (.ogg). -#define VORBIS_IPATH -#define VORBIS_LPATH -#define VORBIS_LIBS $[if $[WINDOWS_PLATFORM],libogg_static.lib libvorbis_static.lib libvorbisfile_static.lib,ogg vorbis vorbisfile] -#defer HAVE_VORBIS $[libtest $[VORBIS_LPATH],$[VORBIS_LIBS]] - -// Define this to explicitly indicate the given platform string within -// the resulting Panda runtime. Normally it is best to leave this -// undefined, in which case Panda will determine the best value -// automatically. -#define DTOOL_PLATFORM - -// Define this to generate static libraries and executables, rather than -// dynamic libraries. -//#define LINK_ALL_STATIC yes - -// The panda source tree is made up of a bunch of component libraries -// (e.g. express, downloader, pgraph, egg) which are ultimately -// combined into a smaller group of meta libraries or metalibs -// (e.g. libpandaexpress, libpanda, libpandaegg). Depending on your -// build configuration, these component libraries might have their own -// existence, or they might disappear completely and be contained -// entirely within their metalibs. The former is more convenient for -// rapid development, while the latter might be more convenient for -// distribution. - -// Define this variable to compile and link each component as a -// separate library so that the resulting metalibs are small and there -// are many separate component libraries; leave it undefined to link -// component object files directly into their containing metalibs so -// that the resutling metalib files are large and component libraries -// don't actually exist. The Windows has traditionally been built -// with this cleared (because of the original Win32 STL requirements), -// while the Unix build has traditionally been built with it set. -// Changing this from the traditional platform-specific setting is not -// 100% supported yet. -#define BUILD_COMPONENTS $[not $[WINDOWS_PLATFORM]] - -// Define this to export the templates from the DLL. This is only -// meaningful if LINK_ALL_STATIC is not defined, and we are building -// on Windows. Some Windows compilers may not support this syntax. -#defer EXPORT_TEMPLATES yes - -// Define this to generate .bat files when a Sources.pp makes a -// script; leave it clear to generate Unix-style sh scripts. -#defer MAKE_BAT_SCRIPTS $[eq $[PLATFORM],Win32] - -// Define USE_COMPILER to switch the particular compiler that should -// be used. A handful of tokens are recognized, depending on BUILD_TYPE. -// This may also be further customized within Global.$[BUILD_TYPE].pp. - -// If BUILD_TYPE is "unix", this may be one of: -// GCC (gcc/g++) -// MIPS (Irix MIPSPro compiler) -// -// If BUILD_TYPE is "msvc" or "gmsvc", this may be one of: -// MSVC (Microsoft Visual C++ 6.0) -// MSVC7 (Microsoft Visual C++ 7.0) -// BOUNDS (BoundsChecker) -// INTEL (Intel C/C++ compiler) - -#if $[WINDOWS_PLATFORM] - #if $[eq $[USE_COMPILER],] - #define USE_COMPILER MSVC7 - #endif -#elif $[eq $[PLATFORM], Irix] - #define USE_COMPILER MIPS -#elif $[eq $[PLATFORM], Linux] - #define USE_COMPILER GCC -#elif $[OSX_PLATFORM] - #define USE_COMPILER GCC -#elif $[eq $[PLATFORM], FreeBSD] - #define USE_COMPILER GCC -#endif - -// Permission masks to install data and executable files, -// respectively. This is only meaningful for Unix systems. -#define INSTALL_UMASK_DATA 644 -#define INSTALL_UMASK_PROG 755 - -// How to invoke bison and flex. Panda takes advantage of some -// bison/flex features, and therefore specifically requires bison and -// flex, not some other versions of yacc and lex. However, you only -// need to have these programs if you need to make changes to the -// bison or flex sources (see the next point, below). -#defer BISON bison -#defer FLEX flex - -// You may not even have bison and flex installed. If you don't, no -// sweat; Panda ships with the pre-generated output of these programs, -// so you don't need them unless you want to make changes to the -// grammars themselves (files named *.yxx or *.lxx). -#defer HAVE_BISON $[bintest $[BISON]] - -// How to invoke sed. A handful of make rules use this. Since some -// platforms (specifically, non-Unix platforms like Windows) don't -// have any kind of sed, ppremake performs some limited sed-like -// functions. The default is to use ppremake in this capacity. In -// this variable, $[source] is the name of the file to read, $[target] -// is the name of the file to generate, and $[script] is the one-line -// sed script to run. -#defer SED ppremake -s "$[script]" <$[source] >$[target] - -// What directory name (within each source directory) should the .o -// (or .obj) files be written to? This can be any name, and it can be -// used to differentiate different builds within the same tree. -// However, don't define this to be '.', or you will be very sad the -// next time you run 'make clean'. -//#defer ODIR Opt$[OPTIMIZE]-$[PLATFORM]$[USE_COMPILER] -// ODIR_SUFFIX is optional, usually empty -#defer ODIR Opt$[OPTIMIZE]-$[PLATFORM]$[ODIR_SUFFIX] - - -// What is the normal extension of a compiled object file? -#if $[WINDOWS_PLATFORM] - #define OBJ .obj -#else - #define OBJ .o -#endif - - -////////////////////////////////////////////////////////////////////// -// There are also some additional variables that control specific -// compiler/platform features or characteristics, defined in the -// platform specific file Config.platform.pp. Be sure to inspect -// these variables for correctness too. -////////////////////////////////////////////////////////////////////// diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp deleted file mode 100644 index cdea47c29f..0000000000 --- a/dtool/LocalSetup.pp +++ /dev/null @@ -1,722 +0,0 @@ -// -// LocalSetup.pp -// -// This file contains further instructions to set up the DTOOL package -// when using ppremake. In particular, it creates the dtool_config.h -// file based on the user's selected configure variables. This script -// need not execute when BUILD_TYPE is "autoconf"; in this case, the -// dtool_config.h file will automatically be correctly generated by -// configure. -// - -#print -#print Configuring support for the following optional third-party packages: -#if $[HAVE_EIGEN] -#print + Eigen linear algebra library -#if $[LINMATH_ALIGN] -#print + (vectorization enabled in build) -#else -#print - (vectorization NOT enabled in build) -#endif -#else -#print - Did not find Eigen linear algebra library -#endif -#if $[HAVE_OPENSSL] -#print + OpenSSL -#else -#print - Did not find OpenSSL -#endif -#if $[HAVE_JPEG] -#print + libjpeg -#else -#print - Did not find libjpeg -#endif -#if $[HAVE_PNG] -#print + libpng -#else -#print - Did not find libpng -#endif -#if $[HAVE_TIFF] -#print + libtiff -#else -#print - Did not find libtiff -#endif -#if $[HAVE_TAR] -#print + libtar -#else -#print - Did not find libtar -#endif -#if $[HAVE_FFTW] -#print + fftw -#else -#print - Did not find fftw -#endif -#if $[HAVE_SQUISH] -#print + squish -#else -#print - Did not find squish -#endif -#if $[HAVE_CG] -#print + Nvidia Cg High Level Shading Language -#else -#print - Did not find Nvidia Cg High Level Shading Language -#endif -#if $[HAVE_CGGL] -#print + Cg OpenGL API -#else -#print - Did not find Cg OpenGL API -#endif -#if $[HAVE_CGDX9] -#print + Cg DX9 API -#else -#print - Did not find Cg DX9 API -#endif -#if $[HAVE_CGDX10] -#print + Cg DX10 API -#else -#print - Did not find Cg DX10 API -#endif -#if $[HAVE_VRPN] -#print + VRPN -#else -#print - Did not find VRPN -#endif -#if $[HAVE_ZLIB] -#print + zlib -#else -#print - Did not find zlib -#endif -#if $[HAVE_RAD_MSS] -#print + Miles Sound System -#else -#print - Did not find Miles Sound System -#endif -#if $[HAVE_FMODEX] -#print + FMOD Ex sound library -#else -#print - Did not find FMOD Ex sound library -#endif -#if $[HAVE_OPENAL] -#print + OpenAL sound library -#else -#print - Did not find OpenAL sound library -#endif -#if $[HAVE_PHYSX] -#print + Ageia PhysX -#else -#print - Did not find Ageia PhysX -#endif -#if $[HAVE_SPEEDTREE] -#print + SpeedTree -#else -#print - Did not find SpeedTree -#endif -#if $[HAVE_GTK] -#print + gtk+-2 -#else -#print - Did not find gtk+-2 -#endif -#if $[HAVE_FREETYPE] -#print + Freetype -#else -#print - Did not find Freetype -#endif -#if $[HAVE_WX] -#print + WxWidgets -#else -#print - Did not find WxWidgets -#endif -#if $[HAVE_FLTK] -#print + FLTK -#else -#print - Did not find FLTK -#endif -#if $[HAVE_GL] -#print + OpenGL -#else -#print - Did not find OpenGL -#endif -#if $[HAVE_GLES] -#print + OpenGL ES 1 -#else -#print - Did not find OpenGL ES 1 -#endif -#if $[HAVE_GLES2] -#print + OpenGL ES 2 -#else -#print - Did not find OpenGL ES 2 -#endif -#if $[HAVE_DX9] -#print + DirectX9 -#else -#print - Did not find DirectX9 -#endif -#if $[HAVE_TINYDISPLAY] -#print + Tinydisplay -#else -#print - Not building Tinydisplay -#endif -//#if $[HAVE_SDL] -//#print + SDL -//#else -//#print - Did not find SDL -//#endif -#if $[HAVE_X11] -#print + X11 -#else -#print - Did not find X11 -#endif -#if $[HAVE_OPENCV] -#print + OpenCV -#else -#print - Did not find OpenCV -#endif -#if $[HAVE_FFMPEG] -#print + FFMPEG -#else -#print - Did not find FFMPEG -#endif -#if $[HAVE_ODE] -#print + ODE -#else -#print - Did not find ODE -#endif -#if $[HAVE_AWESOMIUM] -#print + AWESOMIUM -#else -#print - Did not find AWESOMIUM -#endif -#if $[HAVE_MAYA] -#print + OpenMaya -#else -#print - Did not find OpenMaya -#endif -#if $[HAVE_FCOLLADA] -#print + FCollada -#else -#print - Did not find FCollada -#endif -#if $[or $[HAVE_COLLADA14DOM],$[HAVE_COLLADA15DOM]] -#print + COLLADA DOM -#else -#print - Did not find COLLADA DOM -#endif -#if $[HAVE_ASSIMP] -#print + Assimp -#else -#print - Did not find Assimp -#endif -#if $[HAVE_ARTOOLKIT] -#print + ARToolKit -#else -#print - Did not find ARToolKit -#endif -#if $[HAVE_ROCKET] -#if $[HAVE_ROCKET_PYTHON] -#print + libRocket with Python bindings -#else -#print + libRocket without Python bindings -#endif -#else -#print - Did not find libRocket -#endif -#if $[HAVE_BULLET] -#print + Bullet Physics -#else -#print - Did not find Bullet Physics -#endif -#if $[HAVE_VORBIS] -#print + libvorbis (Ogg Vorbis Decoder) -#else -#print - Did not find libvorbis (Ogg Vorbis Decoder) -#endif - -#print -#if $[and $[HAVE_INTERROGATE],$[HAVE_PYTHON]] -#print Compilation will generate Python interfaces. -#else -#print Configuring Panda WITHOUT Python interfaces. -#endif -#if $[HAVE_THREADS] -#if $[SIMPLE_THREADS] -#print Compilation will include simulated threading support. -#else -#if $[DO_PIPELINING] -#print Compilation will include full, pipelined threading support. -#else -#print Compilation will include nonpipelined threading support. -#endif -#endif -#else -#print Configuring Panda without threading support. -#endif - -#if $[OSX_PLATFORM] -#if $[UNIVERSAL_BINARIES] -#print Compilation will create universal binaries. -#else -#print Compilation will not create universal binaries. -#endif -#endif - -#print -#print See dtool_config.h for more details about the specified configuration. - -#print - -// We don't include the ppremake version in the first comment line of -// the output to dtool_config.h, below, to minimize unnecessary -// complete rebuilds due to an updated ppremake version. -#output dtool_config.h notouch -#format straight -/* dtool_config.h. Generated automatically by $[PPREMAKE] from $[SOURCEFILE]. */ - -/* Debug / non-debug symbols. OPTIMIZE = $[OPTIMIZE] */ -#if $[<= $[OPTIMIZE],2] -#define _DEBUG 1 -#elif $[= $[OPTIMIZE],4] -#define NDEBUG 1 -#endif -$[cdefine _DEBUG] -$[cdefine NDEBUG] - -/* Define if we have Eigen available. */ -$[cdefine HAVE_EIGEN] -$[cdefine LINMATH_ALIGN] - -/* Define if we have Python installed. */ -$[cdefine HAVE_PYTHON] -$[cdefine USE_DEBUG_PYTHON] -/* Define if we have Python as a framework (Mac OS X). */ -$[cdefine PYTHON_FRAMEWORK] - -/* Define if we have RAD game tools, Miles Sound System installed. */ -$[cdefine HAVE_RAD_MSS] - -/* Define if we have Freetype 2.0 or better available. */ -$[cdefine HAVE_FREETYPE] - -/* Define if we want to compile in a default font. */ -$[cdefine COMPILE_IN_DEFAULT_FONT] - -/* Define to use doubles for most numbers, intead of single-precision floats. */ -$[cdefine STDFLOAT_DOUBLE] - -/* Define if we have Maya available. */ -$[cdefine HAVE_MAYA] -$[cdefine MAYA_PRE_5_0] - -/* Define if we have libRocket available and built with the Rocket Debugger. */ -$[cdefine HAVE_ROCKET_DEBUGGER] - -/* Define if we have built libRocket available and built with Python support. */ -$[cdefine HAVE_ROCKET_PYTHON] - -/* Define if we have SoftImage available. */ -$[cdefine HAVE_SOFTIMAGE] - -/* Define if we have FCollada available. */ -$[cdefine HAVE_FCOLLADA] - -/* Define if we have ARToolKit available. */ -$[cdefine HAVE_ARTOOLKIT] - -/* Define if we have libvorbisfile available. */ -$[cdefine HAVE_VORBIS] - -/* Define if we have OpenSSL installed. */ -$[cdefine HAVE_OPENSSL] -$[cdefine REPORT_OPENSSL_ERRORS] - -/* Define if we have libjpeg installed. */ -$[cdefine HAVE_JPEG] -$[cdefine PHAVE_JPEGINT_H] - -/* Define to build video-for-linux. */ -$[cdefine HAVE_VIDEO4LINUX] - -/* Define if we have libpng installed. */ -$[cdefine HAVE_PNG] - -/* Define if we have libtiff installed. */ -$[cdefine HAVE_TIFF] - -/* Define if we want to build these other image file formats. */ -$[cdefine HAVE_SGI_RGB] -$[cdefine HAVE_TGA] -$[cdefine HAVE_IMG] -$[cdefine HAVE_SOFTIMAGE_PIC] -$[cdefine HAVE_BMP] -$[cdefine HAVE_PNM] - -/* Define if we have libtar installed. */ -$[cdefine HAVE_TAR] - -/* Define if we have libfftw installed. */ -$[cdefine HAVE_FFTW] - -/* Define if we have libsquish installed. */ -$[cdefine HAVE_SQUISH] - -/* Define if we have Berkeley DB installed. */ -$[cdefine HAVE_BDB] - -/* Define if we have HELIX installed. */ -$[cdefine HAVE_HELIX] - -/* Define if we have CG installed. */ -$[cdefine HAVE_CG] - -/* Define if we have CGGL installed. */ -$[cdefine HAVE_CGGL] - -/* Define if we have CGDX9 installed. */ -$[cdefine HAVE_CGDX9] - -/* Define if we have CGDX10 installed. */ -$[cdefine HAVE_CGDX10] - -/* Define for dxerr.h instead of dxerr9.h. */ -$[cdefine USE_GENERIC_DXERR_LIBRARY] - -/* Define if we have zlib installed. */ -$[cdefine HAVE_ZLIB] - -/* Define the preconfigured minimum GL version number. */ -#if HAVE_GL -# define MIN_GL_VERSION_MAJOR $[word 1,$[MIN_GL_VERSION]] -# define MIN_GL_VERSION_MINOR $[word 2,$[MIN_GL_VERSION]] -#endif - -/* Define if we have OpenCV installed and want to build for OpenCV. */ -$[cdefine HAVE_OPENCV] -$[cdefine OPENCV_VER_23] - -/* Define if we have FFMPEG installed and want to build for FFMPEG. */ -$[cdefine HAVE_FFMPEG] -$[cdefine HAVE_SWSCALE] -$[cdefine HAVE_SWRESAMPLE] - -/* Define if we have AWESOMIUM installed and want to build for AWESOMIUM. */ -$[cdefine HAVE_AWESOMIUM] - -/* Define if we have GLX installed and want to build for GLX. */ -$[cdefine HAVE_GLX] - -/* Define if we have EGL installed and want to build for EGL. */ -$[cdefine HAVE_EGL] - -/* Define if we have Windows-GL installed and want to build for Wgl. */ -$[cdefine HAVE_WGL] - -/* Define if we have DirectX installed and want to build for DX. */ -$[cdefine HAVE_DX9] - -/* The choice of generic vs. the specific dxerr library largely - depends on which SDK you have installed. */ -$[cdefine USE_GENERIC_DXERR_LIBRARY] - -/* Define if we want to build tinydisplay. */ -$[cdefine HAVE_TINYDISPLAY] - -/* Define if we have the SDL library. */ -$[cdefine HAVE_SDL] - -/* Define if we have X11. */ -$[cdefine HAVE_X11] - -/* Define if we have the XFree86-DGA extension. */ -$[cdefine HAVE_XF86DGA] - -/* Define if we have the XRandR extension. */ -$[cdefine HAVE_XRANDR] - -/* Define if we have the XCursor extension. */ -$[cdefine HAVE_XCURSOR] - -/* Define if we want to compile the threading code. */ -$[cdefine HAVE_THREADS] - -/* Define if we want to use fast, user-space simulated threads. */ -$[cdefine SIMPLE_THREADS] - -/* Define if SIMPLE_THREADS should be implemented with the OS-provided - threading layer (if available). */ -$[cdefine OS_SIMPLE_THREADS] - -/* Define to enable deadlock detection, mutex recursion checks, etc. */ -$[cdefine DEBUG_THREADS] - -/* Define to implement mutexes and condition variables via a user-space spinlock. */ -$[cdefine MUTEX_SPINLOCK] - -/* Define to enable the PandaFileStream implementation of pfstream etc. */ -$[cdefine USE_PANDAFILESTREAM] - -/* Define if we want to compile the net code. */ -$[cdefine HAVE_NET] - -/* Define if we want to compile the egg code. */ -$[cdefine HAVE_EGG] - -/* Define if we want to compile the audio code. */ -$[cdefine HAVE_AUDIO] - -/* Define if we have bison and flex available. */ -$[cdefine HAVE_BISON] - -/* Define if we want to use PStats. */ -$[cdefine DO_PSTATS] - -/* Define if we want to type-check downcasts. */ -$[cdefine DO_DCAST] - -/* Define if we want to provide collision system recording and - visualization tools. */ -$[cdefine DO_COLLISION_RECORDING] - -/* Define if we want to enable track-memory-usage. */ -$[cdefine DO_MEMORY_USAGE] - -/* Define if we want to enable min-lag and max-lag. */ -$[cdefine SIMULATE_NETWORK_DELAY] - -/* Define if we want to allow immediate mode OpenGL rendering. */ -$[cdefine SUPPORT_IMMEDIATE_MODE] - -/* Define for either of the alternative malloc schemes. */ -$[cdefine USE_MEMORY_DLMALLOC] -$[cdefine USE_MEMORY_PTMALLOC2] - -/* Define if we want to compile in support for pipelining. */ -$[cdefine DO_PIPELINING] - -/* Define if we want to keep Notify debug messages around, or undefine - to compile them out. */ -$[cdefine NOTIFY_DEBUG] - -/* Define if we want to export template classes from the DLL. Only - makes sense to MSVC++. */ -$[cdefine EXPORT_TEMPLATES] - -/* Define if we are linking PANDAPHYSX in with PANDA. */ -$[cdefine LINK_IN_PHYSX] - -/* The compiled-in character(s) to expect to separate different - components of a path list (e.g. $PRC_PATH). */ -# define DEFAULT_PATHSEP "$[DEFAULT_PATHSEP]" - -/* Many of the prc variables are exported by - dtool/src/prc/prc_parameters.h.pp, instead of here. Only those prc - variables that must be visible outside of the prc directory are - exported here. */ - -/* The filename that specifies the public keys to import into - config. */ -# define PRC_PUBLIC_KEYS_FILENAME "$[unixfilename $[PRC_PUBLIC_KEYS_FILENAME]]" -#if $[PRC_PUBLIC_KEYS_FILENAME] -# define PRC_PUBLIC_KEYS_INCLUDE "$[osfilename $[PRC_PUBLIC_KEYS_FILENAME]]" -#endif - -/* Define if you want to save the descriptions for ConfigVariables. */ -$[cdefine PRC_SAVE_DESCRIPTIONS] - - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -$[cdefine WORDS_BIGENDIAN] - -/* Define if the C++ compiler uses namespaces. */ -$[cdefine HAVE_NAMESPACE] - -/* Define if fstream::open() accepts a third parameter for umask. */ -$[cdefine HAVE_OPEN_MASK] - -/* Define if we have a lockf() function. */ -$[cdefine HAVE_LOCKF] - -/* Define if some header file defines wchar_t. */ -$[cdefine HAVE_WCHAR_T] - -/* Define if the header file defines wstring. */ -$[cdefine HAVE_WSTRING] - -/* Define if the C++ compiler supports the typename keyword. */ -$[cdefine HAVE_TYPENAME] - -/* Define if we can trust the compiler not to insert extra bytes in - structs between base structs and derived structs. */ -$[cdefine SIMPLE_STRUCT_POINTERS] - -/* Define if we have Dinkumware STL installed. */ -$[cdefine HAVE_DINKUM] - -/* Define if we have STL hash_map etc. available */ -$[cdefine HAVE_STL_HASH] - -/* Define if gettimeofday() takes only one parameter. */ -$[cdefine GETTIMEOFDAY_ONE_PARAM] - -/* Define if you have the getopt function. */ -$[cdefine HAVE_GETOPT] - -/* Define if you have the getopt_long_only function. */ -$[cdefine HAVE_GETOPT_LONG_ONLY] - -/* Define if getopt appears in getopt.h. */ -$[cdefine PHAVE_GETOPT_H] - -/* Define if you have ioctl(TIOCGWINSZ) to determine terminal width. */ -$[cdefine IOCTL_TERMINAL_WIDTH] - -/* Do the system headers define a "streamsize" typedef? */ -$[cdefine HAVE_STREAMSIZE] - -/* Do the system headers define key ios typedefs like ios::openmode - and ios::fmtflags? */ -$[cdefine HAVE_IOS_TYPEDEFS] - -/* Define if the C++ iostream library defines ios::binary. */ -$[cdefine HAVE_IOS_BINARY] - -/* Can we safely call getenv() at static init time? */ -$[cdefine STATIC_INIT_GETENV] - -/* Can we read the file /proc/self/[*] to determine our - environment variables at static init time? */ -$[cdefine HAVE_PROC_SELF_EXE] -$[cdefine HAVE_PROC_SELF_MAPS] -$[cdefine HAVE_PROC_SELF_ENVIRON] -$[cdefine HAVE_PROC_SELF_CMDLINE] -$[cdefine HAVE_PROC_CURPROC_FILE] -$[cdefine HAVE_PROC_CURPROC_MAP] -$[cdefine HAVE_PROC_CURPROC_CMDLINE] - -/* Do we have a global pair of argc/argv variables that we can read at - static init time? Should we prototype them? What are they called? */ -$[cdefine HAVE_GLOBAL_ARGV] -$[cdefine PROTOTYPE_GLOBAL_ARGV] -$[cdefine GLOBAL_ARGV] -$[cdefine GLOBAL_ARGC] - -/* Define if you have the header file. */ -$[cdefine PHAVE_IO_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_IOSTREAM] - -/* Define if you have the header file. */ -$[cdefine PHAVE_MALLOC_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_SYS_MALLOC_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_ALLOCA_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_LOCALE_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_STRING_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_STDLIB_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_LIMITS_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_MINMAX_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_SSTREAM] - -/* Define if you have the header file. */ -$[cdefine PHAVE_NEW] - -/* Define if you have the header file. */ -$[cdefine PHAVE_SYS_TYPES_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_SYS_TIME_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_UNISTD_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_UTIME_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_GLOB_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_DIRENT_H] - -/* Define if you have the header file. */ -$[cdefine PHAVE_DRFFTW_H] - -/* Do we have (and presumably a Linux-style audio - interface)? */ -$[cdefine PHAVE_SYS_SOUNDCARD_H] - -/* Do we have (and therefore makecontext() / - swapcontext())? */ -$[cdefine PHAVE_UCONTEXT_H] - -/* Do we have ? This enables us to use raw mouse input. */ -$[cdefine PHAVE_LINUX_INPUT_H] - -/* Do we have ? */ -$[cdefine PHAVE_STDINT_H] - -/* Do we have RTTI (and )? */ -$[cdefine HAVE_RTTI] - -/* Do we have Posix threads? */ -$[cdefine HAVE_POSIX_THREADS] - -/* Is the code being compiled with the Tau profiler's instrumentor? */ -$[cdefine USE_TAU] - -/* Define if needed to have 64-bit file i/o */ -$[cdefine __USE_LARGEFILE64] - -// To activate the DELETED_CHAIN macros. -$[cdefine USE_DELETED_CHAIN] - -// To build the Windows TOUCHINPUT interfaces (requires Windows 7). -$[cdefine HAVE_WIN_TOUCHINPUT] - -// If we are to build the native net interfaces. -$[cdefine WANT_NATIVE_NET] - -/* Turn off warnings for using scanf and such */ -#if $[or $[eq $[USE_COMPILER],MSVC9], $[eq $[USE_COMPILER],MSVC9x64]] - #print Will ignore CRT_SECURE warnings for MSVC9 - $[cdefine _CRT_SECURE_NO_WARNINGS] - # pragma warning( disable : 4996 4275 4267 4099 4049 4013 4005 ) -#endif - -/* Static linkage instead of the normal dynamic linkage? */ -$[cdefine LINK_ALL_STATIC] - -/* Define to compile the plugin code. */ -$[cdefine HAVE_P3D_PLUGIN] - -/* Define to compile for Cocoa or Carbon on Mac OS X. */ -$[cdefine HAVE_COCOA] -$[cdefine HAVE_CARBON] - -/* Platform-identifying defines. */ -$[cdefine IS_OSX] -$[cdefine IS_LINUX] -$[cdefine IS_FREEBSD] -$[cdefine BUILD_IPHONE] -$[cdefine UNIVERSAL_BINARIES] - -#if $[DTOOL_PLATFORM] -# define DTOOL_PLATFORM "$[DTOOL_PLATFORM]" -#endif - -#end dtool_config.h diff --git a/dtool/Package.pp b/dtool/Package.pp deleted file mode 100644 index b0b787eb42..0000000000 --- a/dtool/Package.pp +++ /dev/null @@ -1,439 +0,0 @@ -// -// Package.pp -// -// This file defines certain configuration variables that are to be -// written into the various make scripts. It is processed by ppremake -// (along with the Sources.pp files in each of the various -// directories) to generate build scripts appropriate to each -// environment. -// -// This is the package-specific file, which should be at the top of -// every source hierarchy. It generally gets the ball rolling, and is -// responsible for explicitly including all of the relevant Config.pp -// files. - -// Check the version of ppremake in use. -#if $[< $[PPREMAKE_VERSION],1.11] - #error You need at least ppremake version 1.11 to process this tree. -#endif - -// Get the current version info for Panda. -#include $[THISDIRPREFIX]PandaVersion.pp -#define PANDA_MAJOR_VERSION $[word 1,$[PANDA_VERSION]] -#define PANDA_MINOR_VERSION $[word 2,$[PANDA_VERSION]] -#define PANDA_SEQUENCE_VERSION $[word 3,$[PANDA_VERSION]] -#defer PANDA_VERSION_STR $[PANDA_MAJOR_VERSION].$[PANDA_MINOR_VERSION].$[PANDA_SEQUENCE_VERSION]$[if $[not $[PANDA_OFFICIAL_VERSION]],c] -#defer PANDA_VERSION_SYMBOL panda_version_$[PANDA_MAJOR_VERSION]_$[PANDA_MINOR_VERSION] - -// The panda version as a single number, with three digits reserved -// for each component. -#define PANDA_NUMERIC_VERSION $[+ $[* $[PANDA_MAJOR_VERSION],1000000],$[* $[PANDA_MINOR_VERSION],1000],$[PANDA_SEQUENCE_VERSION]] - -#define P3D_PLUGIN_MAJOR_VERSION $[word 1,$[P3D_PLUGIN_VERSION]] -#define P3D_PLUGIN_MINOR_VERSION $[word 2,$[P3D_PLUGIN_VERSION]] -#define P3D_PLUGIN_SEQUENCE_VERSION $[word 3,$[P3D_PLUGIN_VERSION]] -#defer P3D_PLUGIN_VERSION_STR $[P3D_PLUGIN_MAJOR_VERSION].$[P3D_PLUGIN_MINOR_VERSION].$[P3D_PLUGIN_SEQUENCE_VERSION]$[if $[not $[PANDA_OFFICIAL_VERSION]],c] - -// The plugin version as a dot-delimited integer quad, according to MS -// conventions for DLL version numbers. -#defer P3D_PLUGIN_DLL_DOT_VERSION $[word 1,$[P3D_PLUGIN_VERSION]].$[word 2,$[P3D_PLUGIN_VERSION]].$[word 3,$[P3D_PLUGIN_VERSION]].$[if $[PANDA_OFFICIAL_VERSION],1000,0] -// The same thing as a comma-delimited quad. -#defer P3D_PLUGIN_DLL_COMMA_VERSION $[word 1,$[P3D_PLUGIN_VERSION]],$[word 2,$[P3D_PLUGIN_VERSION]],$[word 3,$[P3D_PLUGIN_VERSION]],$[if $[PANDA_OFFICIAL_VERSION],1000,0] - -// What is the name of this source tree? -#if $[eq $[PACKAGE],] - #define PACKAGE dtool -#endif - -// Where should we install DTOOL, specifically? -#if $[DTOOL_INSTALL] - #define DTOOL_INSTALL $[unixfilename $[DTOOL_INSTALL]] -#elif $[CTPROJS] - // If we are presently attached, use the environment variable. - // We define two variables: one for ourselves, which burns in the - // current value of the DTOOL environment variable (so that any - // attempt to install in this tree will install correctly, no - // matter whether we are attached to a different DTOOL later by - // mistake), and one for other trees to use, which expands to a - // ordinary reference to the DTOOL environment variable, so - // they will read from the right tree no matter which DTOOL they're - // attached to. - #set DTOOL $[unixfilename $[DTOOL]] - #define DTOOL_INSTALL $[DTOOL]/built - #if $[eq $[DTOOL],] - #error You seem to be attached to some trees, but not DTOOL! - #endif -#else - // Otherwise, if we are not attached, install in the standard place - // (unless the user specifies otherwise). - #defer DTOOL_INSTALL $[unixfilename $[INSTALL_DIR]] -#endif - - -// These variables tell ppremake how to interpret the contents of the -// PLATFORM variable, and help it to control the effects of functions -// like $[os] and $[isfullpath]. - -// True if we are specifically 32-bit Windows. -#define WIN32_PLATFORM $[or $[eq $[PLATFORM],Win32],$[eq $[PLATFORM],Cygwin]] - -// True if we are 64-bit windows. -#define WIN64_PLATFORM $[or $[eq $[PLATFORM],Win64],$[eq $[PLATFORM],Cygwin64]] - -// True if we are building on some flavor of Windows. -#define WINDOWS_PLATFORM $[or $[WIN32_PLATFORM],$[WIN64_PLATFORM]] - -// True if we are building on some flavor of OS X. -#define OSX_PLATFORM $[eq $[PLATFORM],OSX] - -// True if we are building on some flavor of Unix. -#define UNIX_PLATFORM $[and $[not $[WINDOWS_PLATFORM]],$[not $[OSX_PLATFORM]]] - - - -// Pull in the package-level Config file. This contains a lot of -// configuration variables that the user might want to fine-tune. -#include $[THISDIRPREFIX]Config.pp - -// Also get the platform-specific config file. This defines a few -// more variables that are more likely to be platform-dependent and -// are less likely to be directly modified by the user. -#include $[THISDIRPREFIX]Config.$[PLATFORM].pp - -// If the environment variable PPREMAKE_CONFIG is set, it points to a -// user-customized Config.pp file, for instance in the user's home -// directory. This file might redefine any of the variables defined -// above. -#if $[ne $[PPREMAKE_CONFIG],] - #define PPREMAKE_CONFIG $[unixfilename $[PPREMAKE_CONFIG]] - #print Reading $[PPREMAKE_CONFIG] (referred to by PPREMAKE_CONFIG) - #include $[PPREMAKE_CONFIG] - -#elif $[wildcard $[unixfilename $[INSTALL_DIR]]/Config.pp] - // If the PPREMAKE_CONFIG variable is not, but there exists a - // Config.pp in the compiled-in INSTALL_DIR, use that one by default. - #define PPREMAKE_CONFIG $[unixfilename $[INSTALL_DIR]]/Config.pp - #print Reading $[PPREMAKE_CONFIG] (referred to by INSTALL_DIR, because PPREMAKE_CONFIG is empty) - #include $[PPREMAKE_CONFIG] - -#else - // Otherwise, just carry on without it. - #print Environment variable PPREMAKE_CONFIG not set; using defaults. -#endif - -#include $[THISDIRPREFIX]pptempl/PostConfig.pp - -// Now evaluate all of our deferred variable definitions from -// Config.pp. -#set EIGEN_IPATH $[unixfilename $[EIGEN_IPATH]] -#set HAVE_EIGEN $[HAVE_EIGEN] - -#set PYTHON_IPATH $[unixfilename $[PYTHON_IPATH]] -#set PYTHON_LPATH $[unixfilename $[PYTHON_LPATH]] -#set PYTHON_FPATH $[unixfilename $[PYTHON_FPATH]] -#set PYTHON_FRAMEWORK $[unixfilename $[PYTHON_FRAMEWORK]] -#set HAVE_PYTHON $[HAVE_PYTHON] - -#set NATIVE_NET_IPATH $[unixfilename $[NATIVE_NET_IPATH]] -#set NATIVE_NET_LPATH $[unixfilename $[NATIVE_NET_LPATH]] -#set NATIVE_NET_LIBS $[NATIVE_NET_LIBS] -#set WANT_NATIVE_NET $[WANT_NATIVE_NET] - -#set HAVE_NET $[HAVE_NET] - -#set OPENSSL_IPATH $[unixfilename $[OPENSSL_IPATH]] -#set OPENSSL_LPATH $[unixfilename $[OPENSSL_LPATH]] -#set OPENSSL_LIBS $[OPENSSL_LIBS] -#set HAVE_OPENSSL $[HAVE_OPENSSL] - -#set JPEG_IPATH $[unixfilename $[JPEG_IPATH]] -#set JPEG_LPATH $[unixfilename $[JPEG_LPATH]] -#set JPEG_LIBS $[JPEG_LIBS] -#set HAVE_JPEG $[HAVE_JPEG] - -#set PNG_IPATH $[unixfilename $[PNG_IPATH]] -#set PNG_LPATH $[unixfilename $[PNG_LPATH]] -#set PNG_LIBS $[PNG_LIBS] -#set HAVE_PNG $[HAVE_PNG] - -#set TIFF_IPATH $[unixfilename $[TIFF_IPATH]] -#set TIFF_LPATH $[unixfilename $[TIFF_LPATH]] -#set TIFF_LIBS $[TIFF_LIBS] -#set HAVE_TIFF $[HAVE_TIFF] - -#set TAR_IPATH $[unixfilename $[TAR_IPATH]] -#set TAR_LPATH $[unixfilename $[TAR_LPATH]] -#set TAR_LIBS $[TAR_LIBS] -#set HAVE_TAR $[HAVE_TAR] - -#set FFTW_IPATH $[unixfilename $[FFTW_IPATH]] -#set FFTW_LPATH $[unixfilename $[FFTW_LPATH]] -#set FFTW_LIBS $[FFTW_LIBS] -#set HAVE_FFTW $[HAVE_FFTW] - -#set SQUISH_IPATH $[unixfilename $[SQUISH_IPATH]] -#set SQUISH_LPATH $[unixfilename $[SQUISH_LPATH]] -#set SQUISH_LIBS $[SQUISH_LIBS] -#set HAVE_SQUISH $[HAVE_SQUISH] - -#set BDB_IPATH $[unixfilename $[BDB_IPATH]] -#set BDB_LPATH $[unixfilename $[BDB_LPATH]] -#set BDB_LIBS $[BDB_LIBS] -#set HAVE_BDB $[HAVE_BDB] - -#set CG_IPATH $[unixfilename $[CG_IPATH]] -#set CG_LPATH $[unixfilename $[CG_LPATH]] -#set CG_LIBS $[CG_LIBS] -#set HAVE_CG $[HAVE_CG] - -#set CGGL_IPATH $[unixfilename $[CGGL_IPATH]] -#set CGGL_LPATH $[unixfilename $[CGGL_LPATH]] -#set CGGL_LIBS $[CGGL_LIBS] -#set HAVE_CGGL $[HAVE_CGGL] - -#set CGDX9_IPATH $[unixfilename $[CGDX9_IPATH]] -#set CGDX9_LPATH $[unixfilename $[CGDX9_LPATH]] -#set CGDX9_LIBS $[CGDX9_LIBS] -#set HAVE_CGDX9 $[HAVE_CGDX9] - -#set CGDX10_IPATH $[unixfilename $[CGDX10_IPATH]] -#set CGDX10_LPATH $[unixfilename $[CGDX10_LPATH]] -#set CGDX10_LIBS $[CGDX10_LIBS] -#set HAVE_CGDX10 $[HAVE_CGDX10] - -#set VRPN_IPATH $[unixfilename $[VRPN_IPATH]] -#set VRPN_LPATH $[unixfilename $[VRPN_LPATH]] -#set VRPN_LIBS $[VRPN_LIBS] -#set HAVE_VRPN $[HAVE_VRPN] - -#set HELIX_IPATH $[unixfilename $[HELIX_IPATH]] -#set HELIX_LPATH $[unixfilename $[HELIX_LPATH]] -#set HELIX_LIBS $[HELIX_LIBS] -#set HAVE_HELIX $[HAVE_HELIX] - -#set ZLIB_IPATH $[unixfilename $[ZLIB_IPATH]] -#set ZLIB_LPATH $[unixfilename $[ZLIB_LPATH]] -#set ZLIB_LIBS $[ZLIB_LIBS] -#set HAVE_ZLIB $[HAVE_ZLIB] - -#set GL_IPATH $[unixfilename $[GL_IPATH]] -#set GL_LPATH $[unixfilename $[GL_LPATH]] -#set GL_LIBS $[GL_LIBS] -#set HAVE_GL $[HAVE_GL] - -#set GLES_IPATH $[unixfilename $[GLES_IPATH]] -#set GLES_LPATH $[unixfilename $[GLES_LPATH]] -#set GLES_LIBS $[GLES_LIBS] -#set HAVE_GLES $[HAVE_GLES] - -#set GLES2_IPATH $[unixfilename $[GLES2_IPATH]] -#set GLES2_LPATH $[unixfilename $[GLES2_LPATH]] -#set GLES2_LIBS $[GLES2_LIBS] -#set HAVE_GLES2 $[HAVE_GLES2] - -#set GLX_IPATH $[unixfilename $[GLX_IPATH]] -#set GLX_LPATH $[unixfilename $[GLX_LPATH]] -#set HAVE_GLX $[HAVE_GLX] - -#set EGL_IPATH $[unixfilename $[EGL_IPATH]] -#set EGL_LPATH $[unixfilename $[EGL_LPATH]] -#set EGL_LIBS $[unixfilename $[EGL_LIBS]] -#set HAVE_EGL $[HAVE_EGL] - -#set HAVE_WGL $[HAVE_WGL] - -#set HAVE_COCOA $[HAVE_COCOA] -#set HAVE_CARBON $[HAVE_CARBON] - -#set DX9_IPATH $[unixfilename $[DX9_IPATH]] -#set DX9_LPATH $[unixfilename $[DX9_LPATH]] -#set DX9_LIBS $[DX9_LIBS] -#set HAVE_DX9 $[HAVE_DX9] - -#set OPENCV_IPATH $[unixfilename $[OPENCV_IPATH]] -#set OPENCV_LPATH $[unixfilename $[OPENCV_LPATH]] -#set OPENCV_LIBS $[OPENCV_LIBS] -#set HAVE_OPENCV $[HAVE_OPENCV] - -#set FFMPEG_IPATH $[unixfilename $[FFMPEG_IPATH]] -#set FFMPEG_LPATH $[unixfilename $[FFMPEG_LPATH]] -#set FFMPEG_LIBS $[FFMPEG_LIBS] -#set HAVE_FFMPEG $[HAVE_FFMPEG] - -#set ODE_IPATH $[unixfilename $[ODE_IPATH]] -#set ODE_LPATH $[unixfilename $[ODE_LPATH]] -#set ODE_LIBS $[ODE_LIBS] -#set HAVE_ODE $[HAVE_ODE] - -#set AWESOMIUM_IPATH $[unixfilename $[AWESOMIUM_IPATH]] -#set AWESOMIUM_LPATH $[unixfilename $[AWESOMIUM_LPATH]] -#set AWESOMIUM_LIBS $[AWESOMIUM_LIBS] -#set AWESOMIUM_FRAMEWORK $[unixfilename $[AWESOMIUM_FRAMEWORK]] -#set HAVE_AWESOMIUM $[HAVE_AWESOMIUM] - -#set NPAPI_IPATH $[unixfilename $[NPAPI_IPATH]] -#set NPAPI_LPATH $[unixfilename $[NPAPI_LPATH]] -#set NPAPI_LIBS $[NPAPI_LIBS] -#set HAVE_NPAPI $[HAVE_NPAPI] - -#set HAVE_THREADS $[HAVE_THREADS] -#set DEBUG_THREADS $[DEBUG_THREADS] -#set MUTEX_SPINLOCK $[MUTEX_SPINLOCK] - -#set DO_PSTATS $[DO_PSTATS] - -#set RAD_MSS_IPATH $[unixfilename $[RAD_MSS_IPATH]] -#set RAD_MSS_LPATH $[unixfilename $[RAD_MSS_LPATH]] -#set RAD_MSS_LIBS $[RAD_MSS_LIBS] -#set HAVE_RAD_MSS $[HAVE_RAD_MSS] - -#set FMODEX_IPATH $[unixfilename $[FMODEX_IPATH]] -#set FMODEX_LPATH $[unixfilename $[FMODEX_LPATH]] -#set FMODEX_LIBS $[FMODEX_LIBS] -#set HAVE_FMODEX $[HAVE_FMODEX] - -#set OPENAL_IPATH $[unixfilename $[OPENAL_IPATH]] -#set OPENAL_LPATH $[unixfilename $[OPENAL_LPATH]] -#set OPENAL_LIBS $[OPENAL_LIBS] -#set OPENAL_FRAMEWORK $[unixfilename $[OPENAL_FRAMEWORK]] -#set HAVE_OPENAL $[HAVE_OPENAL] - -#set PHYSX_IPATH $[unixfilename $[PHYSX_IPATH]] -#set PHYSX_LPATH $[unixfilename $[PHYSX_LPATH]] -#set PHYSX_LIBS $[PHYSX_LIBS] -#set HAVE_PHYSX $[HAVE_PHYSX] - -#set SPEEDTREE_IPATH $[unixfilename $[SPEEDTREE_IPATH]] -#set SPEEDTREE_LPATH $[unixfilename $[SPEEDTREE_LPATH]] -#set SPEEDTREE_LIBS $[SPEEDTREE_LIBS] -#set HAVE_SPEEDTREE $[HAVE_SPEEDTREE] - -#set PKG_CONFIG $[PKG_CONFIG] -#set HAVE_GTK $[HAVE_GTK] - -#set FREETYPE_CONFIG $[FREETYPE_CONFIG] -#set HAVE_FREETYPE $[HAVE_FREETYPE] -#set FREETYPE_CFLAGS $[FREETYPE_CFLAGS] -#set FREETYPE_IPATH $[unixfilename $[FREETYPE_IPATH]] -#set FREETYPE_LPATH $[unixfilename $[FREETYPE_LPATH]] -#set FREETYPE_LIBS $[FREETYPE_LIBS] - -#set WX_CONFIG $[WX_CONFIG] -#set HAVE_WX $[HAVE_WX] -#set WX_CFLAGS $[WX_CFLAGS] -#set WX_IPATH $[unixfilename $[WX_IPATH]] -#set WX_LPATH $[unixfilename $[WX_LPATH]] -#set WX_LIBS $[WX_LIBS] - -#set FLTK_CONFIG $[FLTK_CONFIG] -#set HAVE_FLTK $[HAVE_FLTK] -#set FLTK_CFLAGS $[FLTK_CFLAGS] -#set FLTK_IPATH $[unixfilename $[FLTK_IPATH]] -#set FLTK_LPATH $[unixfilename $[FLTK_LPATH]] -#set FLTK_LIBS $[FLTK_LIBS] - - -#set MAYA_LOCATION $[unixfilename $[MAYA_LOCATION]] -#set HAVE_MAYA $[HAVE_MAYA] - -#set SOFTIMAGE_LOCATION $[unixfilename $[SOFTIMAGE_LOCATION]] -#set HAVE_SOFTIMAGE $[HAVE_SOFTIMAGE] - -#set FCOLLADA_IPATH $[unixfilename $[FCOLLADA_IPATH]] -#set FCOLLADA_LPATH $[unixfilename $[FCOLLADA_LPATH]] -#set FCOLLADA_LIBS $[FCOLLADA_LIBS] -#set HAVE_FCOLLADA $[HAVE_FCOLLADA] - -#set COLLADA14DOM_IPATH $[unixfilename $[COLLADA14DOM_IPATH]] -#set COLLADA14DOM_LPATH $[unixfilename $[COLLADA14DOM_LPATH]] -#set COLLADA14DOM_LIBS $[COLLADA14DOM_LIBS] -#set HAVE_COLLADA14DOM $[HAVE_COLLADA14DOM] - -#set COLLADA15DOM_IPATH $[unixfilename $[COLLADA15DOM_IPATH]] -#set COLLADA15DOM_LPATH $[unixfilename $[COLLADA15DOM_LPATH]] -#set COLLADA15DOM_LIBS $[COLLADA15DOM_LIBS] -#set HAVE_COLLADA15DOM $[HAVE_COLLADA15DOM] - -#set ASSIMP_IPATH $[unixfilename $[ASSIMP_IPATH]] -#set ASSIMP_LPATH $[unixfilename $[ASSIMP_LPATH]] -#set ASSIMP_LIBS $[ASSIMP_LIBS] -#set HAVE_ASSIMP $[HAVE_ASSIMP] - -#set ARTOOLKIT_IPATH $[unixfilename $[ARTOOLKIT_IPATH]] -#set ARTOOLKIT_LPATH $[unixfilename $[ARTOOLKIT_LPATH]] -#set ARTOOLKIT_LIBS $[ARTOOLKIT_LIBS] -#set HAVE_ARTOOLKIT $[HAVE_ARTOOLKIT] - -#set ROCKET_IPATH $[unixfilename $[ROCKET_IPATH]] -#set ROCKET_LPATH $[unixfilename $[ROCKET_LPATH]] -#set ROCKET_LIBS $[ROCKET_LIBS] -#set HAVE_ROCKET $[HAVE_ROCKET] -#set HAVE_ROCKET_PYTHON $[HAVE_ROCKET_PYTHON] - -#set BULLET_IPATH $[unixfilename $[BULLET_IPATH]] -#set BULLET_LPATH $[unixfilename $[BULLET_LPATH]] -#set BULLET_LIBS $[BULLET_LIBS] -#set HAVE_BULLET $[HAVE_BULLET] - -#set VORBIS_IPATH $[unixfilename $[VORBIS_IPATH]] -#set VORBIS_LPATH $[unixfilename $[VORBIS_LPATH]] -#set VORBIS_LIBS $[VORBIS_LIBS] -#set HAVE_VORBIS $[HAVE_VORBIS] - -// Now infer a few more variables based on what was defined. -#if $[and $[HAVE_GTK],$[PKG_CONFIG]] - #define cflags $[shell $[PKG_CONFIG] gtk+-2.0 --cflags] - #define libs $[shell $[PKG_CONFIG] gtk+-2.0 --libs] - - #define GTK_CFLAGS $[filter-out -I%,$[cflags]] - #define GTK_IPATH $[unique $[patsubst -I%,%,$[filter -I%,$[cflags]]]] - #define GTK_LPATH $[unique $[patsubst -L%,%,$[filter -L%,$[libs]]]] - #define GTK_LIBS $[patsubst -l%,%,$[filter -l%,$[libs]]] -#endif - -#if $[and $[HAVE_FREETYPE],$[FREETYPE_CONFIG]] - #define cflags $[shell $[FREETYPE_CONFIG] --cflags] - #define libs $[shell $[FREETYPE_CONFIG] --libs] - - #define FREETYPE_CFLAGS $[filter-out -I%,$[cflags]] - #define FREETYPE_IPATH $[unique $[patsubst -I%,%,$[filter -I%,$[cflags]]]] - #define FREETYPE_LPATH $[unique $[patsubst -L%,%,$[filter -L%,$[libs]]]] - #define FREETYPE_LIBS $[patsubst -l%,%,$[filter -l%,$[libs]]] -#endif - -#if $[and $[HAVE_WX],$[WX_CONFIG]] - #define cflags $[shell $[WX_CONFIG] --cflags] - #define libs $[shell $[WX_CONFIG] --libs core,base] - - #define WX_CFLAGS $[filter-out -I%,$[cflags]] - #define WX_IPATH $[unique $[patsubst -I%,%,$[filter -I%,$[cflags]]]] - #define WX_LPATH $[unique $[patsubst -L%,%,$[filter -L%,$[libs]]]] - #define WX_LFLAGS $[filter-out -l%,$[libs]] - #define WX_LIBS $[patsubst -l%,%,$[filter -l%,$[libs]]] -#endif - -#if $[and $[HAVE_FLTK],$[FLTK_CONFIG]] - #define cflags $[shell $[FLTK_CONFIG] --cflags] - #define libs $[shell $[FLTK_CONFIG] --ldflags] - - #define FLTK_CFLAGS $[filter-out -I%,$[cflags]] - #define FLTK_IPATH $[unique $[patsubst -I%,%,$[filter -I%,$[cflags]]]] - #define FLTK_LPATH $[unique $[patsubst -L%,%,$[filter -L%,$[libs]]]] - #define FLTK_LFLAGS $[filter-out -l%,$[libs]] - #define FLTK_LIBS $[patsubst -l%,%,$[filter -l%,$[libs]]] -#endif - -#if $[HAVE_PHYSX] - #define GENPYCODE_LIBS $[GENPYCODE_LIBS] libpandaphysx -#endif - -#if $[HAVE_SPEEDTREE] - #define GENPYCODE_LIBS $[GENPYCODE_LIBS] libpandaspeedtree -#endif - -#if $[HAVE_AWESOMIUM] - #define GENPYCODE_LIBS $[GENPYCODE_LIBS] libpandaawesomium -#endif - -// Finally, include the system configure file. -#include $[THISDIRPREFIX]pptempl/System.pp diff --git a/dtool/PandaVersion.pp b/dtool/PandaVersion.pp index 85d2181d87..ba362a70ac 100644 --- a/dtool/PandaVersion.pp +++ b/dtool/PandaVersion.pp @@ -2,6 +2,10 @@ // by Package.pp, which puts it in the global namespace for all // ppremake scripts for Panda. +// Actually, we don't have ppremake any more, but this file is still +// being parsed today by makepanda. We should probably find a better +// place to put this. + // Use spaces to separate the major, minor, and sequence numbers here. #define PANDA_VERSION 1 10 0 diff --git a/dtool/Sources.pp b/dtool/Sources.pp deleted file mode 100644 index ece3e4687f..0000000000 --- a/dtool/Sources.pp +++ /dev/null @@ -1,7 +0,0 @@ -// This is the toplevel directory. It contains configure.in and other -// stuff. - -#define DIR_TYPE toplevel - -#define CONFIG_HEADER dtool_config.h -#define EXTRA_PPREMAKE_SOURCE PandaVersion.pp diff --git a/dtool/metalibs/Sources.pp b/dtool/metalibs/Sources.pp deleted file mode 100644 index 93e28f9e7c..0000000000 --- a/dtool/metalibs/Sources.pp +++ /dev/null @@ -1,7 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group - -// The metalibs directory always depends on the src directory. -#define DEPENDS src diff --git a/dtool/metalibs/dtool/Sources.pp b/dtool/metalibs/dtool/Sources.pp deleted file mode 100644 index d5f7ef930f..0000000000 --- a/dtool/metalibs/dtool/Sources.pp +++ /dev/null @@ -1,16 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_DTOOL - -#define COMPONENT_LIBS p3dtoolutil p3dtoolbase - -#begin metalib_target - #define TARGET p3dtool - - #define SOURCES dtool.cxx -#end metalib_target diff --git a/dtool/metalibs/dtoolconfig/Sources.pp b/dtool/metalibs/dtoolconfig/Sources.pp deleted file mode 100644 index fe99ee6351..0000000000 --- a/dtool/metalibs/dtoolconfig/Sources.pp +++ /dev/null @@ -1,19 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_DTOOLCONFIG - -#define COMPONENT_LIBS p3interrogatedb p3dconfig p3prc -#define LOCAL_LIBS p3dtoolutil p3dtoolbase -#define USE_PACKAGES python ssl - -#begin metalib_target - #define TARGET p3dtoolconfig - - #define SOURCES dtoolconfig.cxx \ - $[if $[HAVE_PYTHON], pydtool.cxx] -#end metalib_target diff --git a/dtool/metalibs/dtoolconfig/pydtool.cxx b/dtool/metalibs/dtoolconfig/pydtool.cxx index 83250cd092..377037a295 100644 --- a/dtool/metalibs/dtoolconfig/pydtool.cxx +++ b/dtool/metalibs/dtoolconfig/pydtool.cxx @@ -83,7 +83,6 @@ static PyObject *_inP07ytf513(PyObject *self, PyObject *args); static PyObject *_inP07ytsqGH(PyObject *self, PyObject *args); static PyObject *_inP07yt7shV(PyObject *self, PyObject *args); static PyObject *_inP07ytA1eF(PyObject *self, PyObject *args); -static PyObject *_inP07yt9tTm(PyObject *self, PyObject *args); static PyObject *_inP07yt776V(PyObject *self, PyObject *args); static PyObject *_inP07ytfaH0(PyObject *self, PyObject *args); static PyObject *_inP07ytGB9D(PyObject *self, PyObject *args); @@ -1219,24 +1218,6 @@ _inP07ytA1eF(PyObject *, PyObject *args) { return (PyObject *)NULL; } -/* - * Python simple wrapper for - * TypeIndex interrogate_make_seq_class(MakeSeqIndex make_seq) - */ -static PyObject * -_inP07yt9tTm(PyObject *, PyObject *args) { - int param0; - if (PyArg_ParseTuple(args, "i", ¶m0)) { - TypeIndex return_value = interrogate_make_seq_class((MakeSeqIndex)param0); -#if PY_MAJOR_VERSION >= 3 - return PyLong_FromLong(return_value); -#else - return PyInt_FromLong(return_value); -#endif - } - return (PyObject *)NULL; -} - /* * Python simple wrapper for * char const *interrogate_make_seq_seq_name(MakeSeqIndex make_seq) @@ -2433,7 +2414,6 @@ static PyMethodDef python_simple_funcs[] = { { "interrogate_wrapper_pointer", &_inP07ytsqGH, METH_VARARGS }, { "interrogate_wrapper_unique_name", &_inP07yt7shV, METH_VARARGS }, { "interrogate_get_wrapper_by_unique_name", &_inP07ytA1eF, METH_VARARGS }, - { "interrogate_make_seq_class", &_inP07yt9tTm, METH_VARARGS }, { "interrogate_make_seq_seq_name", &_inP07yt776V, METH_VARARGS }, { "interrogate_make_seq_num_name", &_inP07ytfaH0, METH_VARARGS }, { "interrogate_make_seq_element_name", &_inP07ytGB9D, METH_VARARGS }, diff --git a/dtool/pptempl/Depends.pp b/dtool/pptempl/Depends.pp deleted file mode 100644 index 6dbb331a60..0000000000 --- a/dtool/pptempl/Depends.pp +++ /dev/null @@ -1,175 +0,0 @@ -// -// Depends.pp -// -// This file is loaded and run after each Sources.pp is read. It -// defines the inter-directory dependencies, which is useful for -// determining build order. -// - -#if $[eq $[DIR_TYPE], toplevel] - #define DEPENDABLE_HEADERS $[CONFIG_HEADER] - -#elif $[or $[eq $[DIR_TYPE], src], $[eq $[DIR_TYPE], metalib]] -#if $[eq $[DEPEND_DIRS],] - - // DEPENDABLE_HEADERS is supposed to be the primary purpose of this - // file: here we generate the list of source files that might be - // included in some other source file, and hence is relevant to the - // automatically-generated dependency chain. - - // We generate this variable by walking through all of the targets - // and building it up. - #define DEPENDABLE_HEADERS - - // We will also need to sort out the types files we will actually - // compile within each directory, as well as the lists of files that - // go into each composite. - - // We define $[c_sources], $[cxx_sources], $[yxx_sources], and - // $[lxx_sources] within each target, which lists original files as - // well as synthetic composite files. We also now add - // $[cxx_interrogate_sources], which are the C++ files generated by - // interrogate. Under OSX, we want to compile these files - // separately. - - // Finally, there's $[compile_sources], which is the union of all - // the others: any source files that are actually compiled and - // result in a generated .o (or .obj) file. - - // Finally, we build up $[composite_list] out here to list all of - // the composite files generated for all targets. - - // This is done at this point, within Depends.pp, so that the - // various Template.*.pp files will be able to reliably access - // $[compile_sources] from the different directories. - #define composite_list - // Tag all the static libraries by defining the "lib_is_static" variable. - #forscopes static_lib_target - #define lib_is_static 1 - #end static_lib_target - #if $[WINDOWS_PLATFORM] - #forscopes ss_lib_target - #define lib_is_static 1 - #end ss_lib_target - #endif - #if $[LINK_ALL_STATIC] - #forscopes metalib_target ss_lib_target lib_target - #define lib_is_static 1 - #end metalib_target ss_lib_target lib_target - #endif - - #forscopes metalib_target lib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target - // We can optimize quite a bit by evaluating now several of the key - // deferred variables defined in Globals.pp. This way they won't need - // to get repeatedly reevaluated as each directory examines each - // other. - #define build_directory $[build_directory] - #define build_target $[build_target] - #define active_local_libs $[active_local_libs] - #define active_component_libs $[active_component_libs] - #define active_libs $[active_libs] - #define get_sources $[get_sources] - #define get_igatescan $[get_igatescan] - #define get_igateoutput $[get_igateoutput] - #define get_igatedb $[get_igatedb] - #define get_igatemscan $[get_igatemscan] - #define get_igatemout $[get_igatemout] - - // Report a warning for nonexisting dependencies. - #define nonexisting $[unmapped all_libs,$[LOCAL_LIBS]] - #if $[ne $[nonexisting],] - #print Warning: Lib(s) $[nonexisting], referenced in $[DIRNAME]/$[TARGET], not found. - #endif - - #set DEPENDABLE_HEADERS $[DEPENDABLE_HEADERS] $[filter %.h %.I %.T %_src.cxx,$[get_sources]] $[included_sources] - - // Now compute the source files. - #define c_sources $[filter-out %_src.c,$[filter %.c,$[get_sources]]] - #define mm_sources $[filter %.mm,$[get_sources]] - #define cxx_sources $[filter-out %_src.cxx,$[filter %.cxx %.cpp,$[get_sources]]] - #define cxx_interrogate_sources - #if $[PYTHON_MODULE_ONLY] - #set cxx_interrogate_sources $[cxx_sources] - #set cxx_sources - #endif - - #define yxx_sources $[filter %.yxx,$[get_sources]] - #define lxx_sources $[filter %.lxx,$[get_sources]] - - // Define what the object files are. - #foreach file $[c_sources] $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources] $[yxx_sources] $[lxx_sources] - #define $[file]_obj $[patsubst %.c %.cxx %.mm %.cpp %.yxx %.lxx,$[ODIR]/$[obj_prefix]%$[OBJ],$[notdir $[file]]] - #push 1 $[file]_obj - #end file - - #if $[and $[not $[DONT_COMBINE]],$[or $[USE_SINGLE_COMPOSITE_SOURCEFILE],$[USE_TAU]]] - #if $[> $[words $[cxx_sources]], 1] - // If we have multiple C++ files, put them together into one - // composite file. - #define composite_file $[ODIR]/$[TARGET]_composite.cxx - #set composite_list $[composite_list] $[composite_file] - #define $[composite_file]_sources $[cxx_sources] - #define $[composite_file]_obj $[ODIR]/$[TARGET]_composite$[OBJ] - #push 1 $[composite_file]_sources - #push 1 $[composite_file]_obj - #if $[PYTHON_MODULE_ONLY] - #set cxx_interrogate_sources $[composite_file] - #else - #set cxx_sources $[composite_file] - #endif - #endif - #if $[> $[words $[c_sources]], 1] - // If we have multiple C files, put them together into one - // composite file also. - #define composite_file $[ODIR]/$[TARGET]_composite_c.c - #set composite_list $[composite_list] $[composite_file] - #define $[composite_file]_sources $[c_sources] - #define $[composite_file]_obj $[ODIR]/$[TARGET]_composite_c$[OBJ] - #push 1 $[composite_file]_sources - #push 1 $[composite_file]_obj - #set c_sources $[composite_file] - #endif - #endif - - // Add the bison- and flex-generated .cxx files, as well as the - // interrogate-generated files, to the compile list, too. These - // never get added to composite files, though, mainly because they - // tend to be very large files themselves. - #foreach source_file $[yxx_sources] $[lxx_sources] - #define generated_file $[patsubst %.yxx %.lxx,%.cxx,$[source_file]] - #define $[generated_file]_obj $[patsubst %.yxx %.lxx,$[ODIR]/$[TARGET]_%$[OBJ],$[source_file]] - #define $[generated_file]_sources $[source_file] - #push 1 $[generated_file]_obj - #set cxx_sources $[cxx_sources] $[generated_file] - #end source_file - #if $[and $[build_directory],$[get_igateoutput]] - #define generated_file $[get_igateoutput] - #define $[generated_file]_obj $[get_igateoutput:%.cxx=%$[OBJ]] -// #define $[generated_file]_sources $[get_igatescan] - #push 1 $[generated_file]_obj - // We add this to cxx_sources instead of cxx_interrogate_sources, - // even though it's an interrogate-generated file, because it's - // not a module file--we really only accumulate module files into - // cxx_interrogate_sources. - #set cxx_sources $[cxx_sources] $[generated_file] - #endif - #if $[get_igatemout] - #define generated_file $[get_igatemout] - #define $[generated_file]_obj $[get_igatemout:%.cxx=%$[OBJ]] - #define $[generated_file]_sources none - #push 1 $[generated_file]_obj - #set cxx_interrogate_sources $[cxx_interrogate_sources] $[generated_file] - #endif - - #define compile_sources $[c_sources] $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources] - - #end metalib_target lib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target - - // Allow the user to define additional EXTRA_DEPENDS targets in each - // Sources.pp. - #define DEPEND_DIRS \ - $[sort $[EXTRA_DEPENDS] $[all_libs $[DIRNAME],$[get_depend_libs]]] - #set DEPENDABLE_HEADERS $[sort $[DEPENDABLE_HEADERS] $[EXTRA_DEPENDABLE_HEADERS]] -#endif - -#endif // DIR_TYPE diff --git a/dtool/pptempl/Global.gmsvc.pp b/dtool/pptempl/Global.gmsvc.pp deleted file mode 100644 index 874c73518c..0000000000 --- a/dtool/pptempl/Global.gmsvc.pp +++ /dev/null @@ -1,161 +0,0 @@ -// -// Global.gmsvc.pp -// -// This file is read in before any of the individual Sources.pp files -// are read. It defines a few global variables to assist -// Template.gmsvc.pp. -// - -#defun get_metalibs target,complete_libs - // In Windows, we need to know the complete set of metalibs that - // encapsulates each of the libraries we'd be linking with normally. - // In the case where a particular library is not part of a metalib, - // we include the library itself. - - #define actual_libs - #foreach lib $[complete_libs] - // Only consider libraries that we're actually building. - #if $[all_libs $[and $[build_directory],$[build_target]],$[lib]] - #define modmeta $[module $[TARGET],$[lib]] - #if $[ne $[modmeta],] - #if $[ne $[modmeta],$[target]] // We don't link with ourselves. - #set actual_libs $[actual_libs] $[modmeta] - #endif - #else - #set actual_libs $[actual_libs] $[lib] - #endif - #endif - #end lib - #set actual_libs $[unique $[actual_libs]] $[patsubst %:m,%,$[filter %:m,$[OTHER_LIBS]]] - $[actual_libs] -#end get_metalibs - -#defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]] - -#defun decygwin frompat,topat,path - #foreach file $[path] - $[patsubstw $[frompat],$[topat],$[osfilename $[file]]] - #end file -#end decygwin - -#define install_lib_dir $[install_lib_dir] -#define install_bin_dir $[install_bin_dir] -#define install_headers_dir $[install_headers_dir] -#define install_data_dir $[install_data_dir] -#define install_igatedb_dir $[install_igatedb_dir] -#define install_config_dir $[install_config_dir] -#define install_parser_inc_dir $[install_parser_inc_dir] - -// Define this if we want to make .sbr files. -#if $[USE_BROWSEINFO] -#defer BROWSEINFO_FLAG /Fr"$[osfilename $[target:%.obj=%.sbr]]" -#else -#define BROWSEINFO_FLAG -#endif - -#define CFLAGS_SHARED - -#include $[THISDIRPREFIX]compilerSettings.pp - -#if $[TEST_INLINING] -// /W4 will make MSVC spit out if it inlined a fn or not, but also cause a lot of other spam warnings -#define WARNING_LEVEL_FLAG /W4 -#define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS] -#endif - -// do NOT try to do #defer #defer CDEFINES_OPT1 $[CDEFINES_OPT1] here! it wont let Sources.pp define their own CDEFINES_OPT1! they must use EXTRA_CDEFS! -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] - -#defer cdefines $[CDEFINES_OPT$[OPTIMIZE]] - -// Opt1 /GZ disables OPT flags, so make sure its OPT1 only -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPT1FLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[if $[no_opt],$[OPT1FLAGS],$[OPTFLAGS]] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[if $[no_opt],$[OPT1FLAGS],$[OPTFLAGS]] $[DEBUGPDBFLAGS] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[if $[no_opt],$[OPT1FLAGS],$[OPTFLAGS] $[OPT4FLAGS]] $[DEBUGPDBFLAGS] - -//#if $[FORCE_DEBUG_FLAGS] -// make them all link with non-debug msvc runtime dlls for this case -//#defer DEBUGFLAGS $[subst /MDd,,$[DEBUGFLAGS]] -//#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS] $[DEBUGFLAGS] -//#define LINKER_FLAGS $[LINKER_FLAGS] /debug -//#else -//#endif - -// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs -#defer LDFLAGS_OPT1 $[LINKER_FLAGS] $[LDFLAGS_OPT1] -#defer LDFLAGS_OPT2 $[LINKER_FLAGS] $[LDFLAGS_OPT2] -#defer LDFLAGS_OPT3 $[LINKER_FLAGS] $[LDFLAGS_OPT3] -#defer LDFLAGS_OPT4 $[LINKER_FLAGS] $[LDFLAGS_OPT4] - -// $[dllext] will be "_d" for debug builds, and empty for non-debug -// builds. This is the extra bit of stuff we tack on to the end of a -// dll name. We name the debug dll's file_d.dll, partly to be -// consistent with Python's convention, and partly for our own benefit -// to differentiate debug-built from non-debug-built dll's (since the -// distinction is so important in Windows). -#define dllext $[if $[<= $[OPTIMIZE],2],_d] - -#defer interrogate_ipath $[decygwin %,-S"%",$[install_parser_inc_dir]] $[decygwin %,-I"%",$[target_ipath]] - -// '#defer extra_cflags $[extra_cflags] /STUFF' will never work because extra_cflags hasnt been -// defined yet, so this just evaluates the reference to null and removes the reference and the -// the defining extra_cflags in individual sources.pp's will not picked up. use END_FLAGS instead -#if $[eq $[USE_COMPILER], MSVC9x64] - #defer extra_cflags /EHsc /Zm500 /DWIN64_VC /DWIN64=1 $[WARNING_LEVEL_FLAG] $[END_CFLAGS] -#else - #defer extra_cflags /EHsc /Zm500 /DWIN32_VC /DWIN32=1 $[WARNING_LEVEL_FLAG] $[END_CFLAGS] -#endif - -#if $[direct_tau] -#define tau_ipath $[TAU_ROOT]/include -#define tau_cflags /DPROFILING_ON /DTAU_STDCXXLIB /DTAU_USE_C_API -#define tau_lpath $[TAU_ROOT]/lib/VC7 -#define tau_libs pytau.lib -#else // direct_tau -#define tau_ipath -#define tau_cflags -#define tau_lpath -#define tau_libs -#endif // direct_tau - -#defer DECYGWINED_INC_PATHLIST_ARGS $[decygwin %,/I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]] -#defer MAIN_C_COMPILE_ARGS /nologo /c $[DECYGWINED_INC_PATHLIST_ARGS] $[flags] $[extra_cflags] $[tau_cflags] "$[osfilename $[source]]" - -#defer COMPILE_C $[COMPILER] /Fo"$[osfilename $[target]]" $[MAIN_C_COMPILE_ARGS] -#defer COMPILE_C++ $[COMPILE_C] - -#defer STATIC_LIB_C $[LIBBER] /nologo $[sources] /OUT:"$[osfilename $[target]]" -#defer STATIC_LIB_C++ $[STATIC_LIB_C] - -#if $[eq $[USE_COMPILER], MSVC9x64] - #defer COMPILE_IDL midl /nologo /env win64 /Oicf $[DECYGWINED_INC_PATHLIST_ARGS] -#else - #defer COMPILE_IDL midl /nologo /env win32 /Oicf $[DECYGWINED_INC_PATHLIST_ARGS] -#endif - -#defer COMPILE_RC rc /R /L 0x409 $[DECYGWINED_INC_PATHLIST_ARGS] - -// if we're attached, use dllbase.txt. otherwise let OS loader resolve dll addrspace collisions -#if $[ne $[CTPROJS],] -// use predefined bases to speed dll loading and simplify debugging -#defer DLLNAMEBASE $[lib_prefix]$[TARGET] -#defer DLLBASEADDRFILENAME dllbase.txt -#defer DLLBASEARG "/BASE:@$[dtool_ver_dir]\$[DLLBASEADDRFILENAME],$[DLLNAMEBASE]" -#else -// requires dtool envvar -#define GENERATE_BUILDDATE -#endif - -#defer LINKER_DEF_FILE_ARG $[if $[LINKER_DEF_FILE],/DEF:"$[LINKER_DEF_FILE]",] - -#defer SHARED_LIB_C $[LINKER] /nologo /DLL $[LINKER_DEF_FILE_ARG] $[LDFLAGS_OPT$[OPTIMIZE]] $[DLLBASEARG] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs] $[VER_RESOURCE] -#defer SHARED_LIB_C++ $[SHARED_LIB_C] - -#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs] /OUT:"$[osfilename $[target]]" -#defer LINK_BIN_C++ $[LINK_BIN_C] - -#defer MIDL_COMMAND $[COMPILE_IDL] /out $[ODIR] $[IDL_CDEFS:%=/D%] $[idl] diff --git a/dtool/pptempl/Global.msvc.pp b/dtool/pptempl/Global.msvc.pp deleted file mode 100644 index 96409b53cf..0000000000 --- a/dtool/pptempl/Global.msvc.pp +++ /dev/null @@ -1,164 +0,0 @@ -// -// Global.msvc.pp -// -// This file is read in before any of the individual Sources.pp files -// are read. It defines a few global variables to assist -// Template.msvc.pp. -// - -#define REQUIRED_PPREMAKE_VERSION 1.12 - -#if $[< $[PPREMAKE_VERSION],$[REQUIRED_PPREMAKE_VERSION]] - #error You need at least ppremake version $[REQUIRED_PPREMAKE_VERSION] to use BUILD_TYPE msvc. -#endif - -#defun get_metalibs target,complete_libs - // In Windows, we need to know the complete set of metalibs that - // encapsulates each of the libraries we'd be linking with normally. - // In the case where a particular library is not part of a metalib, - // we include the library itself. - - #define actual_libs - #foreach lib $[complete_libs] - // Only consider libraries that we're actually building. - #if $[all_libs $[and $[build_directory],$[build_target]],$[lib]] - #define modmeta $[module $[TARGET],$[lib]] - #if $[ne $[modmeta],] - #if $[ne $[modmeta],$[target]] // We don't link with ourselves. - #set actual_libs $[actual_libs] $[modmeta] - #endif - #else - #set actual_libs $[actual_libs] $[lib] - #endif - #endif - #end lib - #set actual_libs $[unique $[actual_libs]] $[patsubst %:m,%,$[filter %:m,$[OTHER_LIBS]]] - $[actual_libs] -#end get_metalibs - -#defun decygwin frompat,topat,path - #foreach file $[path] - $[patsubstw $[frompat],$[topat],$[osfilename $[file]]] - #end file -#end decygwin - -#define install_lib_dir $[decygwin %,%,$[install_lib_dir]] -#define install_bin_dir $[decygwin %,%,$[install_bin_dir]] -#define install_headers_dir $[decygwin %,%,$[install_headers_dir]] -#define install_data_dir $[decygwin %,%,$[install_data_dir]] -#define install_igatedb_dir $[decygwin %,%,$[install_igatedb_dir]] -#define install_config_dir $[decygwin %,%,$[install_config_dir]] -#define install_parser_inc_dir $[decygwin %,%,$[install_parser_inc_dir]] - -// Define this if we want to make .sbr files. -#if $[USE_BROWSEINFO] -#defer BROWSEINFO_FLAG /Fr"$[osfilename $[target:%.obj=%.sbr]]" -#else -#define BROWSEINFO_FLAG -#endif - -#define CFLAGS_SHARED - -// Define LINK_ALL_STATIC to generate static libs instead of DLL's. -#if $[ne $[LINK_ALL_STATIC],] - #define build_dlls - #define build_libs yes - #define dlllib lib -#else - #define build_dlls yes - #define build_libs - #define dlllib dll -#endif - -#include $[THISDIRPREFIX]compilerSettings.pp - -#if $[TEST_INLINING] -// /W4 will make MSVC spit out if it inlined a fn or not, but also cause a lot of other spam warnings -#define WARNING_LEVEL_FLAG /W4 -#define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS] -#endif - -// do NOT try to do #defer #defer CDEFINES_OPT1 $[CDEFINES_OPT1] here! it wont let Sources.pp define their own CDEFINES_OPT1! they must use EXTRA_CDEFS! -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] - -// Opt1 /GZ disables OPT flags, so make sure its OPT1 only -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPT1FLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPTFLAGS] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS] $[DEBUGPDBFLAGS] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS] $[OPT4FLAGS] $[DEBUGPDBFLAGS] - -//#if $[FORCE_DEBUG_FLAGS] -// make them all link with non-debug msvc runtime dlls for this case -//#defer DEBUGFLAGS $[subst /MDd,,$[DEBUGFLAGS]] -//#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS] $[DEBUGFLAGS] -//#define LINKER_FLAGS $[LINKER_FLAGS] /debug -//#else -//#endif - -// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs -#defer LDFLAGS_OPT1 $[LINKER_FLAGS] $[LDFLAGS_OPT1] -#defer LDFLAGS_OPT2 $[LINKER_FLAGS] $[LDFLAGS_OPT2] -#defer LDFLAGS_OPT3 $[LINKER_FLAGS] $[LDFLAGS_OPT3] -#defer LDFLAGS_OPT4 $[LINKER_FLAGS] $[LDFLAGS_OPT4] - -// $[dllext] will be "_d" for debug builds, and empty for non-debug -// builds. This is the extra bit of stuff we tack on to the end of a -// dll name. We name the debug dll's file_d.dll, partly to be -// consistent with Python's convention, and partly for our own benefit -// to differentiate debug-built from non-debug-built dll's (since the -// distinction is so important in Windows). -#define dllext $[if $[<= $[OPTIMIZE],2],_d] - -// Because Visual Studio .NET prefers to generate object files using the same -// base name as the source file, we don't want an object file prefix. -#define obj_prefix - -// Additional global defines for building under Microsoft Visual Studio .NET. -#define extra_defines FORCE_INLINING HAVE_DINKUM WIN32_VC WIN32 - -// Additional compiler flags. -#defer extra_cflags /EHsc /Zm500 $[WARNING_LEVEL_FLAG] $[END_CFLAGS] - -#defer interrogate_ipath $[decygwin %,-S"%",$[install_parser_inc_dir]] $[decygwin %,-I"%",$[target_ipath]] - -#defer DECYGWINED_INC_PATHLIST_ARGS $[decygwin %,/I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH]] -#defer MAIN_C_COMPILE_ARGS /nologo /c $[DECYGWINED_INC_PATHLIST_ARGS] $[flags] $[extra_cflags] "$[osfilename $[source]]" - -#defer COMPILE_C $[COMPILER] /Fo"$[osfilename $[target]]" $[MAIN_C_COMPILE_ARGS] -#defer COMPILE_C++ $[COMPILE_C] - -#defer STATIC_LIB_C $[LIBBER] /nologo $[sources] /OUT:"$[osfilename $[target]]" $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] -#defer STATIC_LIB_C++ $[STATIC_LIB_C] - -#defer COMPILE_IDL midl /nologo /env win32 /Oicf $[DECYGWINED_INC_PATHLIST_ARGS] -#defer COMPILE_RC rc /R /L 0x409 $[DECYGWINED_INC_PATHLIST_ARGS] - -// if we're attached, use dllbase.txt. otherwise let OS loader resolve dll addrspace collisions -#if $[ne $[CTPROJS],] -// use predefined bases to speed dll loading and simplify debugging -#defer DLLNAMEBASE $[lib_prefix]$[TARGET] -#defer DLLBASEADDRFILENAME dllbase.txt -#defer DLLBASEARG "/BASE:@$[dtool_ver_dir]\$[DLLBASEADDRFILENAME],$[DLLNAMEBASE]" -#else -// requires dtool envvar -#define GENERATE_BUILDDATE -#endif - -#defer LINKER_DEF_FILE_ARG $[if $[LINKER_DEF_FILE],/DEF:"$[LINKER_DEF_FILE]",] - -//#defer ver_resource $[directory]\ver.res -//#defer SHARED_LIB_C link /nologo /dll /VERBOSE:LIB $[LDFLAGS_OPT$[OPTIMIZE]] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] -#defer SHARED_LIB_C $[LINKER] /nologo /DLL $[LINKER_DEF_FILE_ARG] $[LDFLAGS_OPT$[OPTIMIZE]] $[DLLBASEARG] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] -#defer SHARED_LIB_C++ $[SHARED_LIB_C] - -#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]" -#defer LINK_BIN_C++ $[LINK_BIN_C] - -#if $[ne $[LINK_ALL_STATIC],] - #defer SHARED_LIB_C $[STATIC_LIB_C] - #defer SHARED_LIB_C++ $[STATIC_LIB_C++] - #defer ODIR_SHARED $[ODIR_STATIC] -#endif diff --git a/dtool/pptempl/Global.nmake.pp b/dtool/pptempl/Global.nmake.pp deleted file mode 100644 index 8708ca1e2c..0000000000 --- a/dtool/pptempl/Global.nmake.pp +++ /dev/null @@ -1,154 +0,0 @@ -// -// Global.nmake.pp -// -// This file is read in before any of the individual Sources.pp files -// are read. It defines a few global variables to assist -// Template.nmake.pp. -// -// This was adapted from Global.gmsvc.pp -// - -#defun get_metalibs target,complete_libs - // In Windows, we need to know the complete set of metalibs that - // encapsulates each of the libraries we'd be linking with normally. - // In the case where a particular library is not part of a metalib, - // we include the library itself. - - #define actual_libs - #foreach lib $[complete_libs] - // Only consider libraries that we're actually building. - #if $[all_libs $[and $[build_directory],$[build_target]],$[lib]] - #define modmeta $[module $[TARGET],$[lib]] - #if $[ne $[modmeta],] - #if $[ne $[modmeta],$[target]] // We don't link with ourselves. - #set actual_libs $[actual_libs] $[modmeta] - #endif - #else - #set actual_libs $[actual_libs] $[lib] - #endif - #endif - #end lib - #set actual_libs $[unique $[actual_libs]] $[patsubst %:m,%,$[filter %:m,$[OTHER_LIBS]]] - $[actual_libs] -#end get_metalibs - -#defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]] - -#defun decygwin frompat,topat,path - #foreach file $[path] - $[patsubstw $[frompat],$[topat],$[osfilename $[file]]] - #end file -#end decygwin - -#define install_lib_dir $[install_lib_dir] -#define install_bin_dir $[install_bin_dir] -#define install_headers_dir $[install_headers_dir] -#define install_data_dir $[install_data_dir] -#define install_igatedb_dir $[install_igatedb_dir] -#define install_config_dir $[install_config_dir] -#define install_parser_inc_dir $[install_parser_inc_dir] - -// Define this if we want to make .sbr files. -#if $[USE_BROWSEINFO] -#defer BROWSEINFO_FLAG /Fr"$[osfilename $[target:%.obj=%.sbr]]" -#else -#define BROWSEINFO_FLAG -#endif - -#define CFLAGS_SHARED - -#include $[THISDIRPREFIX]compilerSettings.pp - -#if $[TEST_INLINING] -// /W4 will make MSVC spit out if it inlined a fn or not, but also cause a lot of other spam warnings -#define WARNING_LEVEL_FLAG /W4 -#define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS] -#endif - -// do NOT try to do #defer #defer CDEFINES_OPT1 $[CDEFINES_OPT1] here! it wont let Sources.pp define their own CDEFINES_OPT1! they must use EXTRA_CDEFS! -#defer CDEFINES_OPT1 $[EXTRA_CDEFS] -#defer CDEFINES_OPT2 $[EXTRA_CDEFS] -#defer CDEFINES_OPT3 $[EXTRA_CDEFS] -#defer CDEFINES_OPT4 $[EXTRA_CDEFS] - -#defer cdefines $[CDEFINES_OPT$[OPTIMIZE]] - -// Opt1 /GZ disables OPT flags, so make sure its OPT1 only -#defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[OPT1FLAGS] -#defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] $[COMMONFLAGS] $[DEBUGFLAGS] $[if $[no_opt],$[OPT1FLAGS],$[OPTFLAGS]] -#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[if $[no_opt],$[OPT1FLAGS],$[OPTFLAGS]] $[DEBUGPDBFLAGS] -#defer CFLAGS_OPT4 $[CDEFINES_OPT4:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[if $[no_opt],$[OPT1FLAGS],$[OPTFLAGS] $[OPT4FLAGS]] $[DEBUGPDBFLAGS] - -//#if $[FORCE_DEBUG_FLAGS] -// make them all link with non-debug msvc runtime dlls for this case -//#defer DEBUGFLAGS $[subst /MDd,,$[DEBUGFLAGS]] -//#defer CFLAGS_OPT3 $[CDEFINES_OPT3:%=/D%] $[COMMONFLAGS] $[RELEASEFLAGS] $[OPTFLAGS] $[DEBUGFLAGS] -//#define LINKER_FLAGS $[LINKER_FLAGS] /debug -//#else -//#endif - -// NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs -#defer LDFLAGS_OPT1 $[LINKER_FLAGS] $[LDFLAGS_OPT1] -#defer LDFLAGS_OPT2 $[LINKER_FLAGS] $[LDFLAGS_OPT2] -#defer LDFLAGS_OPT3 $[LINKER_FLAGS] $[LDFLAGS_OPT3] -#defer LDFLAGS_OPT4 $[LINKER_FLAGS] $[LDFLAGS_OPT4] - -// $[dllext] will be "_d" for debug builds, and empty for non-debug -// builds. This is the extra bit of stuff we tack on to the end of a -// dll name. We name the debug dll's file_d.dll, partly to be -// consistent with Python's convention, and partly for our own benefit -// to differentiate debug-built from non-debug-built dll's (since the -// distinction is so important in Windows). -#define dllext $[if $[<= $[OPTIMIZE],2],_d] - -#defer interrogate_ipath $[decygwin %,-S"%",$[install_parser_inc_dir]] $[decygwin %,-I"%",$[target_ipath]] - -// '#defer extra_cflags $[extra_cflags] /STUFF' will never work because extra_cflags hasnt been -// defined yet, so this just evaluates the reference to null and removes the reference and the -// the defining extra_cflags in individual sources.pp's will not picked up. use END_FLAGS instead -#defer extra_cflags /EHsc /Zm500 /DWIN32_VC /DWIN32=1 $[WARNING_LEVEL_FLAG] $[END_CFLAGS] - -#if $[direct_tau] -#define tau_ipath $[TAU_ROOT]/include -#define tau_cflags /DPROFILING_ON /DTAU_STDCXXLIB /DTAU_USE_C_API -#define tau_lpath $[TAU_ROOT]/lib/VC7 -#define tau_libs pytau.lib -#else // direct_tau -#define tau_ipath -#define tau_cflags -#define tau_lpath -#define tau_libs -#endif // direct_tau - -#defer DECYGWINED_INC_PATHLIST_ARGS $[decygwin %,/I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]] -#defer MAIN_C_COMPILE_ARGS /nologo /c $[DECYGWINED_INC_PATHLIST_ARGS] $[flags] $[extra_cflags] $[tau_cflags] "$[osfilename $[source]]" - -#defer COMPILE_C $[COMPILER] /Fo"$[osfilename $[target]]" $[MAIN_C_COMPILE_ARGS] -#defer COMPILE_C++ $[COMPILE_C] - -#defer STATIC_LIB_C $[LIBBER] /nologo $[sources] /OUT:"$[osfilename $[target]]" -#defer STATIC_LIB_C++ $[STATIC_LIB_C] - -#defer COMPILE_IDL midl /nologo /env win32 /Oicf $[DECYGWINED_INC_PATHLIST_ARGS] -#defer COMPILE_RC rc /R /L 0x409 $[DECYGWINED_INC_PATHLIST_ARGS] - -// if we're attached, use dllbase.txt. otherwise let OS loader resolve dll addrspace collisions -#if $[ne $[CTPROJS],] -// use predefined bases to speed dll loading and simplify debugging -#defer DLLNAMEBASE $[lib_prefix]$[TARGET] -#defer DLLBASEADDRFILENAME dllbase.txt -#defer DLLBASEARG "/BASE:@$[dtool_ver_dir]\$[DLLBASEADDRFILENAME],$[DLLNAMEBASE]" -#else -// requires dtool envvar -#define GENERATE_BUILDDATE -#endif - -#defer LINKER_DEF_FILE_ARG $[if $[LINKER_DEF_FILE],/DEF:"$[LINKER_DEF_FILE]",] - -#defer SHARED_LIB_C $[LINKER] /nologo /DLL $[LINKER_DEF_FILE_ARG] $[LDFLAGS_OPT$[OPTIMIZE]] $[DLLBASEARG] /OUT:"$[osfilename $[target]]" $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs] $[VER_RESOURCE]$[if $[and $[eq $[USE_COMPILER], MSVC9],$[not $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME]]],; $[MT_BIN] -nologo -manifest $[target].manifest -outputresource:$[target]\;2,] -#defer SHARED_LIB_C++ $[SHARED_LIB_C] - -#defer LINK_BIN_C $[LINKER] /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath] $[EXTRA_LIBPATH] $[tau_lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] $[tau_libs] /OUT:"$[osfilename $[target]]"$[if $[and $[eq $[USE_COMPILER], MSVC9],$[not $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME]]],; $[MT_BIN] -nologo -manifest $[target].manifest -outputresource:$[target]\;1,] -#defer LINK_BIN_C++ $[LINK_BIN_C] - -#defer MIDL_COMMAND $[COMPILE_IDL] /out $[ODIR] $[IDL_CDEFS:%=/D%] $[idl] diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp deleted file mode 100644 index 7cf3ab660f..0000000000 --- a/dtool/pptempl/Global.pp +++ /dev/null @@ -1,978 +0,0 @@ -// -// Global.pp -// -// This file is read in before any of the individual Sources.pp files -// are read. It defines a few global variables that are useful to all -// different kinds of build_types. -// - -// We start off by defining a number of map variables. These are -// special variables that can be used to look up a particular named -// scope according to a key (that is, according to the value of some -// variable defined within the scope). - -// A named scope is defined using the #begin name .. #end name -// sequence. In general, we use these sequences in the various -// Sources.pp files to define the various targets to build. Each -// named scope carries around its set of variable declarations. The -// named scopes are associated with the dirname of the directory in -// which the Sources.pp file was found. - - -// The first map variable lets us look up a particular library target -// by its target name. The syntax here indicates that we are -// declaring a map variable called "all_libs" whose key is the -// variable $[TARGET] as defined in each instance of a named scope -// called "static_lib_target," "lib_target," and so on in every -// Sources.pp file. (The */ refers to all the Sources.pp files. We -// could also identify a particular file by its directory name, or -// omit the slash to refer to our own Sources.pp file.) - -// After defining this map variable, we can look up other variables -// that are defined for the corresponding target. For instances, -// $[all_libs $[SOURCES],dconfig] will return the value of the SOURCES -// variable as set for the dconfig library (that is, the expression -// $[SOURCES] is evaluated within the named scope whose key is -// "dconfig"--whose variable $[TARGET] was defined to be "dconfig"). -#map all_libs TARGET(*/static_lib_target */dynamic_lib_target */ss_lib_target */lib_target */noinst_lib_target */test_lib_target */metalib_target) - -// This map variable allows us to look up global variables that might -// be defined in a particular Sources.pp, e.g. in the "toplevel" file. -#map dir_type DIR_TYPE(*/) - -#map libs TARGET(*/lib_target */static_lib_target */dynamic_lib_target */ss_lib_target */noinst_lib_target */test_lib_target */metalib_target) - -// This lets us identify which metalib, if any, is including each -// named library. That is, $[module $[TARGET],name] will return -// the name of the metalib that includes library name. -#map module COMPONENT_LIBS(*/metalib_target) - -// This lets up look up components of a particular metalib. -#map components TARGET(*/lib_target */noinst_lib_target */test_lib_target) - -// And this lets us look up source directories by dirname. -#map dirnames DIRNAME(*/) - -// This is used by Template.models.pp. -#if $[HAVE_SOFTIMAGE] - #define SOFT2EGG soft -D libsoftegg soft2egg -#else - // We used to use the old converter from pre-Panda days. Now this - // is no longer supported. - // #define SOFT2EGG soft2egg - #define SOFT2EGG soft -D libsoftegg soft2egg -#endif - -// Define some various compile flags, derived from the variables set -// in Config.pp. -#set INTERROGATE_PYTHON_INTERFACE $[and $[HAVE_PYTHON],$[INTERROGATE_PYTHON_INTERFACE]] -#define run_interrogate $[HAVE_INTERROGATE] - -#define stl_ipath $[wildcard $[STL_IPATH]] -#define stl_lpath $[wildcard $[STL_LPATH]] -#define stl_cflags $[STL_CFLAGS] -#define stl_libs $[STL_LIBS] - -#define eigen_ipath $[wildcard $[EIGEN_IPATH]] -#define eigen_cflags $[EIGEN_CFLAGS] - -#if $[HAVE_PYTHON] - #define python_ipath $[wildcard $[PYTHON_IPATH]] - #define python_lpath $[wildcard $[PYTHON_LPATH]] - #define python_fpath $[wildcard $[PYTHON_FPATH]] - #define python_cflags $[PYTHON_CFLAGS] - #define python_lflags $[PYTHON_LFLAGS] - #define python_libs $[PYTHON_LIBS] - #define python_framework $[PYTHON_FRAMEWORK] -#endif - -#if $[USE_TAU] - #define tau_ipath $[wildcard $[TAU_IPATH]] -#endif - -#if $[HAVE_THREADS] - #define threads_ipath $[wildcard $[THREADS_IPATH]] - #define threads_lpath $[wildcard $[THREADS_LPATH]] - #define threads_cflags $[THREADS_CFLAGS] - #define threads_libs $[THREADS_LIBS] - #define threads_framework $[THREADS_FRAMEWORK] -#endif - -#if $[HAVE_OPENSSL] - #define openssl_ipath $[wildcard $[OPENSSL_IPATH]] - #define openssl_lpath $[wildcard $[OPENSSL_LPATH]] - #define openssl_cflags $[OPENSSL_CFLAGS] - #define openssl_libs $[OPENSSL_LIBS] -#endif - -#if $[HAVE_OPENSSL_MT] - #define openssl_mt_ipath $[wildcard $[OPENSSL_MT_IPATH]] - #define openssl_mt_lpath $[wildcard $[OPENSSL_MT_LPATH]] - #define openssl_mt_cflags $[OPENSSL_MT_CFLAGS] - #define openssl_mt_libs $[OPENSSL_MT_LIBS] -#endif - -#if $[HAVE_ZLIB] - #define zlib_ipath $[wildcard $[ZLIB_IPATH]] - #define zlib_lpath $[wildcard $[ZLIB_LPATH]] - #define zlib_cflags $[ZLIB_CFLAGS] - #define zlib_libs $[ZLIB_LIBS] -#endif - -#if $[HAVE_ZLIB_MT] - #define zlib_mt_ipath $[wildcard $[ZLIB_MT_IPATH]] - #define zlib_mt_lpath $[wildcard $[ZLIB_MT_LPATH]] - #define zlib_mt_cflags $[ZLIB_MT_CFLAGS] - #define zlib_mt_libs $[ZLIB_MT_LIBS] -#endif - -#if $[HAVE_GL] - #define gl_ipath $[wildcard $[GL_IPATH]] - #define gl_lpath $[wildcard $[GL_LPATH]] - #define gl_cflags $[GL_CFLAGS] - #define gl_libs $[GL_LIBS] - #define gl_framework $[GL_FRAMEWORK] -#endif - -#if $[HAVE_GLES] - #define gles_ipath $[wildcard $[GLES_IPATH]] - #define gles_lpath $[wildcard $[GLES_LPATH]] - #define gles_cflags $[GLES_CFLAGS] - #define gles_libs $[GLES_LIBS] -#endif - -#if $[HAVE_GLES2] - #define gles2_ipath $[wildcard $[GLES2_IPATH]] - #define gles2_lpath $[wildcard $[GLES2_LPATH]] - #define gles2_cflags $[GLES2_CFLAGS] - #define gles2_libs $[GLES2_LIBS] -#endif - -#if $[HAVE_SDL] - #define sdl_ipath $[wildcard $[SDL_IPATH]] - #define sdl_lpath $[wildcard $[SDL_LPATH]] - #define sdl_cflags $[SDL_CFLAGS] - #define sdl_libs $[SDL_LIBS] - #define sdl_framework $[SDL_FRAMEWORK] -#endif - -#if $[HAVE_X11] - #define x11_ipath $[wildcard $[X11_IPATH]] - #define x11_lpath $[wildcard $[X11_LPATH]] - #define x11_cflags $[X11_CFLAGS] - #define x11_libs $[X11_LIBS] - #define x11_framework $[X11_FRAMEWORK] -#endif - -#if $[HAVE_XF86DGA] - #define xf86dga_ipath $[wildcard $[XF86DGA_IPATH]] - #define xf86dga_lpath $[wildcard $[XF86DGA_LPATH]] - #define xf86dga_cflags $[XF86DGA_CFLAGS] - #define xf86dga_libs $[XF86DGA_LIBS] -#endif - -#if $[HAVE_XRANDR] - #define xrandr_ipath $[wildcard $[XRANDR_IPATH]] - #define xrandr_lpath $[wildcard $[XRANDR_LPATH]] - #define xrandr_cflags $[XRANDR_CFLAGS] - #define xrandr_libs $[XRANDR_LIBS] -#endif - -#if $[HAVE_XCURSOR] - #define xcursor_ipath $[wildcard $[XCURSOR_IPATH]] - #define xcursor_lpath $[wildcard $[XCURSOR_LPATH]] - #define xcursor_cflags $[XCURSOR_CFLAGS] - #define xcursor_libs $[XCURSOR_LIBS] -#endif - -#if $[HAVE_GLX] - #define glx_ipath $[wildcard $[GLX_IPATH]] - #define glx_lpath $[wildcard $[GLX_LPATH]] - #define glx_cflags $[GLX_CFLAGS] - #define glx_libs $[GLX_LIBS] -#endif - -#if $[HAVE_EGL] - #define egl_ipath $[wildcard $[EGL_IPATH]] - #define egl_lpath $[wildcard $[EGL_LPATH]] - #define egl_cflags $[EGL_CFLAGS] - #define egl_libs $[EGL_LIBS] -#endif - -#if $[HAVE_DX9] - #define dx9_ipath $[wildcard $[DX9_IPATH]] - #define dx9_lpath $[wildcard $[DX9_LPATH]] - #define dx9_cflags $[DX9_CFLAGS] - #define dx9_libs $[DX9_LIBS] -#endif - -#if $[HAVE_OPENCV] - #define opencv_ipath $[wildcard $[OPENCV_IPATH]] - #define opencv_lpath $[wildcard $[OPENCV_LPATH]] - #define opencv_cflags $[OPENCV_CFLAGS] - #define opencv_libs $[OPENCV_LIBS] - #define opencv_framework $[OPENCV_FRAMEWORK] -#endif - -#if $[HAVE_FFMPEG] - #define ffmpeg_ipath $[wildcard $[FFMPEG_IPATH]] - #define ffmpeg_lpath $[wildcard $[FFMPEG_LPATH]] - #define ffmpeg_cflags $[FFMPEG_CFLAGS] - #define ffmpeg_libs $[FFMPEG_LIBS] -#endif - -#if $[HAVE_ODE] - #define ode_ipath $[wildcard $[ODE_IPATH]] - #define ode_lpath $[wildcard $[ODE_LPATH]] - #define ode_cflags $[ODE_CFLAGS] - #define ode_libs $[ODE_LIBS] -#endif - -#if $[HAVE_AWESOMIUM] - #define awesomium_ipath $[wildcard $[AWESOMIUM_IPATH]] - #define awesomium_lpath $[wildcard $[AWESOMIUM_LPATH]] - #define awesomium_libs $[AWESOMIUM_LIBS] - #define awesomium_framework $[AWESOMIUM_FRAMEWORK] -#endif - -#if $[HAVE_NPAPI] - #define npapi_ipath $[wildcard $[NPAPI_IPATH]] - #define npapi_lpath $[wildcard $[NPAPI_LPATH]] - #define npapi_cflags $[NPAPI_CFLAGS] - #define npapi_libs $[NPAPI_LIBS] - #define npapi_framework $[NPAPI_FRAMEWORK] -#endif - -#if $[HAVE_JPEG] - #define jpeg_ipath $[wildcard $[JPEG_IPATH]] - #define jpeg_lpath $[wildcard $[JPEG_LPATH]] - #define jpeg_cflags $[JPEG_CFLAGS] - #define jpeg_libs $[JPEG_LIBS] -#endif - -#if $[HAVE_JPEG_MT] - #define jpeg_mt_ipath $[wildcard $[JPEG_MT_IPATH]] - #define jpeg_mt_lpath $[wildcard $[JPEG_MT_LPATH]] - #define jpeg_mt_cflags $[JPEG_MT_CFLAGS] - #define jpeg_mt_libs $[JPEG_MT_LIBS] -#endif - -#if $[HAVE_PNG] - #define png_ipath $[wildcard $[PNG_IPATH]] - #define png_lpath $[wildcard $[PNG_LPATH]] - #define png_cflags $[PNG_CFLAGS] - #define png_libs $[PNG_LIBS] -#endif - -#if $[HAVE_PNG_MT] - #define png_mt_ipath $[wildcard $[PNG_MT_IPATH]] - #define png_mt_lpath $[wildcard $[PNG_MT_LPATH]] - #define png_mt_cflags $[PNG_MT_CFLAGS] - #define png_mt_libs $[PNG_MT_LIBS] -#endif - -#if $[HAVE_TIFF] - #define tiff_ipath $[wildcard $[TIFF_IPATH]] - #define tiff_lpath $[wildcard $[TIFF_LPATH]] - #define tiff_cflags $[TIFF_CFLAGS] - #define tiff_libs $[TIFF_LIBS] -#endif - -#if $[HAVE_TAR] - #define tar_ipath $[wildcard $[TAR_IPATH]] - #define tar_lpath $[wildcard $[TAR_LPATH]] - #define tar_cflags $[TAR_CFLAGS] - #define tar_libs $[TAR_LIBS] -#endif - -#if $[HAVE_FFTW] - #define fftw_ipath $[wildcard $[FFTW_IPATH]] - #define fftw_lpath $[wildcard $[FFTW_LPATH]] - #define fftw_cflags $[FFTW_CFLAGS] - #define fftw_libs $[FFTW_LIBS] -#endif - -#if $[HAVE_SQUISH] - #define squish_ipath $[wildcard $[SQUISH_IPATH]] - #define squish_lpath $[wildcard $[SQUISH_LPATH]] - #define squish_cflags $[SQUISH_CFLAGS] - #define squish_libs $[SQUISH_LIBS] -#endif - -#if $[HAVE_BDB] - #define bdb_ipath $[wildcard $[BDB_IPATH]] - #define bdb_lpath $[wildcard $[BDB_LPATH]] - #define bdb_cflags $[BDB_CFLAGS] - #define bdb_libs $[BDB_LIBS] -#endif - -#if $[HAVE_CG] - #define cg_ipath $[wildcard $[CG_IPATH]] - #define cg_lpath $[wildcard $[CG_LPATH]] - #define cg_cflags $[CG_CFLAGS] - #define cg_libs $[CG_LIBS] - #define cg_framework $[CG_FRAMEWORK] -#endif - -#if $[HAVE_CGGL] - #define cggl_ipath $[wildcard $[CGGL_IPATH]] - #define cggl_lpath $[wildcard $[CGGL_LPATH]] - #define cggl_cflags $[CGGL_CFLAGS] - #define cggl_libs $[CGGL_LIBS] - #define cggl_framework $[CGGL_FRAMEWORK] -#endif - -#if $[HAVE_CGDX9] - #define cgdx9_ipath $[wildcard $[CGDX9_IPATH]] - #define cgdx9_lpath $[wildcard $[CGDX9_LPATH]] - #define cgdx9_cflags $[CGDX9_CFLAGS] - #define cgdx9_libs $[CGDX9_LIBS] -#endif - -#if $[HAVE_CGDX10] - #define cgdx10_ipath $[wildcard $[CGDX10_IPATH]] - #define cgdx10_lpath $[wildcard $[CGDX10_LPATH]] - #define cgdx10_cflags $[CGDX10_CFLAGS] - #define cgdx10_libs $[CGDX10_LIBS] -#endif - -#if $[HAVE_VRPN] - #define vrpn_ipath $[wildcard $[VRPN_IPATH]] - #define vrpn_lpath $[wildcard $[VRPN_LPATH]] - #define vrpn_cflags $[VRPN_CFLAGS] - #define vrpn_libs $[VRPN_LIBS] -#endif - -#if $[HAVE_HELIX] - #define helix_ipath $[wildcard $[HELIX_IPATH]] - #define helix_lpath $[wildcard $[HELIX_LPATH]] - #define helix_cflags $[HELIX_CFLAGS] - #define helix_libs $[HELIX_LIBS] -#endif - -#if $[HAVE_MIKMOD] - #define mikmod_ipath $[wildcard $[MIKMOD_IPATH]] - #define mikmod_lpath $[wildcard $[MIKMOD_LPATH]] - #define mikmod_cflags $[MIKMOD_CFLAGS] - #define mikmod_libs $[MIKMOD_LIBS] -#endif - -#if $[HAVE_GTK] - #define gtk_ipath $[wildcard $[GTK_IPATH]] - #define gtk_lpath $[wildcard $[GTK_LPATH]] - #define gtk_cflags $[GTK_CFLAGS] - #define gtk_libs $[GTK_LIBS] -#endif - -#if $[HAVE_FREETYPE] - #define freetype_ipath $[wildcard $[FREETYPE_IPATH]] - #define freetype_lpath $[wildcard $[FREETYPE_LPATH]] - #define freetype_cflags $[FREETYPE_CFLAGS] - #define freetype_libs $[FREETYPE_LIBS] - #define freetype_framework $[FREETYPE_FRAMEWORK] -#endif - -#if $[HAVE_WX] - #define wx_ipath $[wildcard $[WX_IPATH]] - #define wx_lpath $[wildcard $[WX_LPATH]] - #define wx_cflags $[WX_CFLAGS] - #define wx_lflags $[WX_LFLAGS] - #define wx_libs $[WX_LIBS] - #define wx_framework $[WX_FRAMEWORK] -#endif - -#if $[HAVE_FLTK] - #define fltk_ipath $[wildcard $[FLTK_IPATH]] - #define fltk_lpath $[wildcard $[FLTK_LPATH]] - #define fltk_cflags $[FLTK_CFLAGS] - #define fltk_lflags $[FLTK_LFLAGS] - #define fltk_libs $[FLTK_LIBS] - #define fltk_framework $[FLTK_FRAMEWORK] -#endif - -#if $[and $[HAVE_MAYA],$[MAYA_LOCATION]] - #define maya_ipath $[MAYA_LOCATION]/include - #define maya_lpath $[MAYA_LOCATION]/lib - #define maya_ld $[wildcard $[MAYA_LOCATION]/bin/mayald] - #define maya_libs $[MAYA_LIBS] -#endif - -#if $[and $[HAVE_SOFTIMAGE],$[SOFTIMAGE_LOCATION]] - #define softimage_ipath $[SOFTIMAGE_LOCATION]/h - #define softimage_lpath $[SOFTIMAGE_LOCATION]/dso - #define softimage_libs $[SOFTIMAGE_LIBS] -#endif - -#if $[HAVE_NET] - #define net_ipath $[wildcard $[NET_IPATH]] - #define net_lpath $[wildcard $[NET_LPATH]] - #define net_libs $[NET_LIBS] -#endif - -#if $[WANT_NATIVE_NET] - #define native_net_ipath $[wildcard $[NATIVE_NET_IPATH]] - #define native_net_lpath $[wildcard $[NATIVE_NET_LPATH]] - #define native_net_libs $[NATIVE_NET_LIBS] -#endif - -#if $[HAVE_RAD_MSS] - #define rad_mss_ipath $[wildcard $[RAD_MSS_IPATH]] - #define rad_mss_lpath $[wildcard $[RAD_MSS_LPATH]] - #define rad_mss_libs $[RAD_MSS_LIBS] -#endif - -#if $[HAVE_FMODEX] - #define fmodex_ipath $[wildcard $[FMODEX_IPATH]] - #define fmodex_lpath $[wildcard $[FMODEX_LPATH]] - #define fmodex_cflags $[FMODEX_CFLAGS] - #define fmodex_libs $[FMODEX_LIBS] -#endif - -#if $[HAVE_OPENAL] - #define openal_ipath $[wildcard $[OPENAL_IPATH]] - #define openal_lpath $[wildcard $[OPENAL_LPATH]] - #define openal_libs $[OPENAL_LIBS] - #define openal_framework $[OPENAL_FRAMEWORK] -#endif - -#if $[HAVE_PHYSX] - #define physx_ipath $[wildcard $[PHYSX_IPATH]] - #define physx_lpath $[wildcard $[PHYSX_LPATH]] - #define physx_libs $[PHYSX_LIBS] -#endif - -#if $[HAVE_SPEEDTREE] - #define speedtree_ipath $[wildcard $[SPEEDTREE_IPATH]] - #define speedtree_lpath $[wildcard $[SPEEDTREE_LPATH]] - #define speedtree_libs $[SPEEDTREE_LIBS] -#endif - -#if $[HAVE_FCOLLADA] - #define fcollada_ipath $[wildcard $[FCOLLADA_IPATH]] - #define fcollada_lpath $[wildcard $[FCOLLADA_LPATH]] - #define fcollada_libs $[FCOLLADA_LIBS] -#endif - -#if $[HAVE_COLLADA14DOM] - #define collada14dom_ipath $[wildcard $[COLLADA14DOM_IPATH]] - #define collada14dom_lpath $[wildcard $[COLLADA14DOM_LPATH]] - #define collada14dom_libs $[COLLADA14DOM_LIBS] -#endif - -#if $[HAVE_COLLADA15DOM] - #define collada15dom_ipath $[wildcard $[COLLADA15DOM_IPATH]] - #define collada15dom_lpath $[wildcard $[COLLADA15DOM_LPATH]] - #define collada15dom_libs $[COLLADA15DOM_LIBS] -#endif - -#if $[HAVE_ASSIMP] - #define assimp_ipath $[wildcard $[ASSIMP_IPATH]] - #define assimp_lpath $[wildcard $[ASSIMP_LPATH]] - #define assimp_libs $[ASSIMP_LIBS] -#endif - -#if $[HAVE_ARTOOLKIT] - #define artoolkit_ipath $[wildcard $[ARTOOLKIT_IPATH]] - #define artoolkit_lpath $[wildcard $[ARTOOLKIT_LPATH]] - #define artoolkit_libs $[ARTOOLKIT_LIBS] -#endif - -#if $[HAVE_ROCKET] - #define rocket_ipath $[wildcard $[ROCKET_IPATH]] - #define rocket_lpath $[wildcard $[ROCKET_LPATH]] - #define rocket_libs $[ROCKET_LIBS] -#endif - -#if $[HAVE_BULLET] - #define bullet_ipath $[wildcard $[BULLET_IPATH]] - #define bullet_lpath $[wildcard $[BULLET_LPATH]] - #define bullet_libs $[BULLET_LIBS] -#endif - -#if $[HAVE_VORBIS] - #define vorbis_ipath $[wildcard $[VORBIS_IPATH]] - #define vorbis_lpath $[wildcard $[VORBIS_LPATH]] - #define vorbis_libs $[VORBIS_LIBS] -#endif - -// We define these two variables true here in the global scope; a -// particular Sources.pp file can redefine these to be false to -// prevent a particular directory or target from being built in -// certain circumstances. -#define BUILD_DIRECTORY 1 -#define BUILD_TARGET 1 - -// This is the default extension for a Maya file. It might be -// overridden within a maya_char_egg rule to convert a .ma file -// instead. -#define MAYA_EXTENSION .mb - -// This variable, when evaluated in the scope of a particular directory, -// will indicate true (i.e. nonempty) when the directory is truly built, -// or false (empty) when the directory is not to be built. -#defer build_directory $[BUILD_DIRECTORY] -// It maps to a direct evaluation of the user-set variable, -// BUILD_DIRECTORY, for historical reasons. This also allows us to -// reserve the right to extend this variable to test other conditions -// as well, should the need arise. - -// This variable, when evaluated in the scope of a particular target, -// will indicated true when the target should be built, or false when -// the target is not to be built. -#defer build_target $[BUILD_TARGET] - -// If we have USE_TAU but not TAU_MAKEFILE, we invoke the tau -// instrumentor and compiler directly. -#define direct_tau $[and $[USE_TAU],$[not $[TAU_MAKEFILE]]] - -#if $[and $[USE_TAU],$[TAU_MAKEFILE]] - // Use the makefile-based rules to run the tau instrumentor. -#defer compile_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C] $[TAU_CFLAGS] -#defer compile_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS] -#defer link_bin_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C] $[TAU_CFLAGS] -#defer link_bin_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS] -#defer shared_lib_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C] $[TAU_CFLAGS] -#defer shared_lib_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS] - -#else -#defer compile_c $[COMPILE_C] -#defer compile_c++ $[COMPILE_C++] -#defer link_bin_c $[LINK_BIN_C] -#defer link_bin_c++ $[LINK_BIN_C++] -#defer shared_lib_c $[SHARED_LIB_C] -#defer shared_lib_c++ $[SHARED_LIB_C++] -#endif // USE_TAU - -#defer static_lib_c $[STATIC_LIB_C] -#defer static_lib_c++ $[STATIC_LIB_C++] -#defer bundle_lib_c $[BUNDLE_LIB_C++] -#defer bundle_lib_c++ $[BUNDLE_LIB_C++] - -// "lib" is the default prefix applied to every generated library. -// This comes from Unix convention. This can be redefined on a -// per-target basis. -#define LIB_PREFIX lib -#defer lib_prefix $[LIB_PREFIX] - -// OSX has a "bundle" concept. This is kind of like a dylib, but not -// quite. Sometimes you might want to link a library *as* a bundle -// instead of as a dylib; sometimes you might want to link a library -// into a dylib *and* a bundle. -#defer bundle_ext $[BUNDLE_EXT] -#defer link_as_bundle $[and $[OSX_PLATFORM],$[LINK_AS_BUNDLE]] - -// On OSX 10.4, we need to have both a .dylib and an .so file. -#defer link_extra_bundle $[and $[OSX_PLATFORM],$[or $[LINK_EXTRA_BUNDLE],$[BUNDLE_EXT]],$[not $[LINK_AS_BUNDLE]],$[not $[LINK_ALL_STATIC]],$[not $[lib_is_static]]] - -// The default library extension various based on the OS. -#defer dynamic_lib_ext $[DYNAMIC_LIB_EXT] -#defer static_lib_ext $[STATIC_LIB_EXT] -#defer lib_ext $[if $[link_as_bundle],$[bundle_ext],$[if $[lib_is_static],$[static_lib_ext],$[dynamic_lib_ext]]] - -#defer link_lib_c $[if $[link_as_bundle],$[bundle_lib_c],$[if $[lib_is_static],$[static_lib_c],$[shared_lib_c]]] -#defer link_lib_c++ $[if $[link_as_bundle],$[bundle_lib_c++],$[if $[lib_is_static],$[static_lib_c++],$[shared_lib_c++]]] - - -// If BUILD_COMPONENTS is not true, we don't actually build all the -// libraries. In particular, we don't build any libraries that are -// listed on a metalib. This variable can be evaluated within a -// library's scope to determine whether it should be built according -// to this rule. -#defer build_lib $[or $[BUILD_COMPONENTS],$[eq $[module $[TARGET],$[TARGET]],]] - -// This variable is true if the lib has an associated pdb (Windows -// only). It appears that pdb's are generated only for dll's, not for -// static libs. -#defer has_pdb $[and $[build_pdbs],$[not $[lib_is_static]]] - - -// This takes advantage of the above two variables to get the actual -// list of local libraries we are to link with, eliminating those that -// won't be built. -#defer active_local_libs \ - $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[LOCAL_LIBS]] -#defer active_component_libs \ - $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[COMPONENT_LIBS]] -#defer active_libs $[active_local_libs] $[active_component_libs] - - -// We define $[complete_local_libs] as the full set of libraries (from -// within this tree) that we must link a particular target with. It -// is the transitive closure of our dependent libs: the libraries we -// depend on, plus the libraries *those* libraries depend on, and so on. -#defer nonunique_complete_local_libs $[closure all_libs,$[active_libs]] -#defer complete_local_libs $[unique $[nonunique_complete_local_libs]] - -// And $[complete_ipath] is the list of directories (from within this -// tree) we should add to our -I list. It's basically just one for -// each directory named in the $[complete_local_libs], above, plus -// whatever else the user might have explicitly named in -// $[LOCAL_INCS]. LOCAL_INCS MUST be a ppremake src dir! (RELDIR only -// checks those) To add an arbitrary extra include dir, define -// EXTRA_IPATH in the Sources.pp -#defer complete_ipath $[all_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%/])] $[EXTRA_IPATH] - - -// This variable, when evaluated within a target, will either be empty -// string if the target is not to be built, or the target name if it -// is. -#defer active_target $[if $[build_target],$[TARGET]] -#defer active_target_libprefext $[if $[build_target],$[lib_prefix]$[TARGET]$[lib_ext]] -#defer active_target_bundleext $[if $[and $[build_target],$[link_extra_bundle]],$[lib_prefix]$[TARGET]$[bundle_ext]] -#defer get_combined_sources $[COMBINED_SOURCES] - -// This subroutine will set up the sources variable to reflect the -// complete set of sources for this target, and also set the -// alt_cflags, alt_libs, etc. as appropriate according to how the -// various USE_* flags are set for the current target. - -// This variable returns the complete set of sources for the current -// target. - -#defer get_sources \ - $[SOURCES] \ - $[if $[or $[NO_COMBINED_SOURCES],$[USE_TAU]], $[INCLUDED_SOURCES], $[get_combined_sources]] - -#defer included_sources $[INCLUDED_SOURCES] - -// This variable returns the set of sources that are to be -// interrogated for the current target. -#defer get_igatescan \ - $[if $[and $[run_interrogate],$[IGATESCAN]], \ - $[if $[eq $[IGATESCAN], all], \ - $[filter-out %.I %.T %.lxx %.yxx %.N %_src.cxx,$[get_sources]] $[filter %_ext.I,$[get_sources]], \ - $[IGATESCAN]]] - -// This variable returns the name of the interrogate database file -// that will be generated for a particular target, or empty string if -// the target is not to be interrogated. -#defer get_igatedb \ - $[if $[and $[run_interrogate],$[IGATESCAN]], \ - $[ODIR]/lib$[TARGET]$[dllext].in] - -// This variable returns the name of the interrogate code file -// that will be generated for a particular target, or empty string if -// the target is not to be interrogated. -#defer get_igateoutput \ - $[if $[and $[run_interrogate],$[IGATESCAN]], \ - $[ODIR]/lib$[TARGET]_igate.cxx] - -// This variable is the set of .in files generated by all of our -// component libraries. If it is nonempty, then we do need to -// generate a module, and $[get_igatemout] is the name of the .cxx file -// that interrogate will produce to make this module. -#defer get_igatemscan $[components $[get_igatedb:%=$[RELDIR]/%],$[active_component_libs]] $[if $[not $[module $[TARGET],$[TARGET]]],$[get_igatedb]] -#defer get_igatemout $[if $[get_igatemscan],$[ODIR]/lib$[TARGET]_module.cxx] - -// This variable returns the set of external packages used by this -// target, and by all the components shared by this target. -#defer use_packages $[unique $[USE_PACKAGES] $[all_libs $[USE_PACKAGES],$[active_component_libs] $[complete_local_libs]]] - -// This function returns the appropriate cflags for the target, based -// on the various external packages this particular target claims to -// require. -#defun get_cflags - // hack to add stl,python. should be removed - #define alt_cflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_cflags] $[python_cflags] $[if $[HAVE_EIGEN],$[eigen_cflags]]] - - #foreach package $[use_packages] - #set alt_cflags $[alt_cflags] $[$[package]_cflags] - #end package - - $[alt_cflags] -#end get_cflags - -// This function returns the appropriate lflags for the target, based -// on the various external packages this particular target claims to -// require. -#defun get_lflags - // hack to add stl,python. should be removed - #define alt_lflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lflags] $[python_lflags]] - - #foreach package $[use_packages] - #set alt_lflags $[alt_lflags] $[$[package]_lflags] - #end package - - $[alt_lflags] -#end get_lflags - -// This function returns the appropriate include path for the target, -// based on the various external packages this particular target -// claims to require. This returns a space-separated set of directory -// names only; the -I switch is not included here. -#defun get_ipath - // hack to add stl,python. should be removed - #define alt_ipath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_ipath] $[python_ipath] $[tau_ipath] $[if $[HAVE_EIGEN],$[eigen_ipath]]] - - #foreach package $[use_packages] - #set alt_ipath $[alt_ipath] $[$[package]_ipath] - #end package - - $[alt_ipath] -#end get_ipath - -// This function returns the appropriate library search path for the -// target, based on the various external packages this particular -// target claims to require. This returns a space-separated set of -// directory names only; the -L switch is not included here. -#defun get_lpath - #define alt_lpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lpath] $[python_lpath]] - - #if $[WINDOWS_PLATFORM] - #set alt_lpath $[WIN32_PLATFORMSDK_LIBPATH] $[alt_lpath] - #endif - - #foreach package $[use_packages] - #set alt_lpath $[alt_lpath] $[$[package]_lpath] - #end package - - $[alt_lpath] -#end get_lpath - -// This function returns the appropriate framework search path for the -// target, based on the various external frameworks this particular -// target claims to require. This returns a space-separated set of -// directory names only; the -F switch is not included here. -#defun get_fpath - #define alt_fpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_fpath] $[python_fpath]] - - #foreach package $[use_packages] - #set alt_fpath $[alt_fpath] $[$[package]_fpath] - #end package - - $[alt_fpath] -#end get_fpath - -// This function returns the appropriate framework for the -// target, based on the various external frameworks this particular -// target claims to require. This returns a space-separated set of -// framework names only; the -framework switch is not included here. -#defun get_frameworks - #define alt_frameworks $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_framework] $[python_framework]] - - #if $[OSX_PLATFORM] - #set alt_frameworks $[alt_frameworks] $[OSX_SYS_FRAMEWORKS] - #endif - - #foreach package $[use_packages] - #set alt_frameworks $[alt_frameworks] $[$[package]_framework] - #end package - - $[alt_frameworks] -#end get_frameworks - -// This function returns the appropriate set of library names to link -// with for the target, based on the various external packages this -// particular target claims to require. This returns a -// space-separated set of library names only; the -l switch is not -// included here. -#defun get_libs - #define alt_libs $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_libs] $[python_libs]] - - #define alt_libs $[alt_libs] $[EXTRA_LIBS] - - #if $[WINDOWS_PLATFORM] - #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_libs] $[transitive_link]] - #elif $[OSX_PLATFORM] - #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_libs] $[transitive_link]] - #elif $[eq $[PLATFORM], Android] - #set alt_libs $[alt_libs] $[ANDROID_SYS_LIBS] $[components $[ANDROID_SYS_LIBS],$[active_libs] $[transitive_link]] - #else - #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_libs] $[transitive_link]] - #endif - - #foreach package $[use_packages] - #set alt_libs $[alt_libs] $[$[package]_libs] - #end package - - $[alt_libs] -#end get_libs - -// This function returns the appropriate value for ld for the target. -#defun get_ld - #if $[filter maya,$[use_packages]] - $[maya_ld] - #endif -#end get_ld - -// This function determines the set of files a given source file -// depends on. It is based on the setting of the $[filename]_sources -// variable to indicate the sources for composite files, etc. -#defun get_depends source - #if $[$[source]_sources] - #if $[ne $[$[source]_sources],none] - $[$[source]_sources] $[dependencies $[$[source]_sources]] - #endif - #else - $[dependencies $[source]] - #endif -#end get_depends - - -// This function determines the set of libraries our various targets -// depend on. This is a complicated definition. It is the union of -// all of our targets' dependencies, except: - -// If a target is part of a metalib, it depends (a) directly on all of -// its normal library dependencies that are part of the same metalib, -// and (b) indirectly on all of the metalibs that every other library -// dependency is part of. If a target is not part of a metalib, it is -// the same as case (b) above. -#defun get_depend_libs - #define depend_libs - #forscopes lib_target noinst_lib_target test_lib_target - #define metalib $[module $[TARGET],$[TARGET]] - #if $[ne $[metalib],] - // This library is included on a metalib. - #foreach depend $[LOCAL_LIBS] - #define depend_metalib $[module $[TARGET],$[depend]] - #if $[eq $[depend_metalib],$[metalib]] - // Here's a dependent library in the *same* metalib. - #set depend_libs $[depend_libs] $[depend] - #elif $[ne $[depend_metalib],] - // This dependent library is in a *different* metalib. - #set depend_libs $[depend_libs] $[depend_metalib] - #else - // This dependent library is not in any metalib. - #set depend_libs $[depend_libs] $[depend] - #endif - #end depend - #else - // This library is *not* included on a metalib. - #foreach depend $[LOCAL_LIBS] - #define depend_metalib $[module $[TARGET],$[depend]] - #if $[ne $[depend_metalib],] - // This dependent library is on a metalib. - #set depend_libs $[depend_libs] $[depend_metalib] - #else - // This dependent library is not in any metalib. - #set depend_libs $[depend_libs] $[depend] - #endif - #end depend - #endif - #end lib_target noinst_lib_target test_lib_target - - // These will never be part of a metalib. - #forscopes static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target metalib_target - #foreach depend $[LOCAL_LIBS] - #define depend_metalib $[module $[TARGET],$[depend]] - #if $[ne $[depend_metalib],] - // This dependent library is on a metalib. - #if $[eq $[depend_metalib],$[TARGET]] - #print Warning: $[TARGET] circularly depends on $[depend]. - #else - #set depend_libs $[depend_libs] $[depend_metalib] - #endif - #else - // This dependent library is not in any metalib. - #set depend_libs $[depend_libs] $[depend] - #endif - #end depend - #end static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target metalib_target - - // In case we're defining any metalibs, these depend directly on - // their components as well. - #set depend_libs $[depend_libs] $[COMPONENT_LIBS(metalib_target)] - - $[depend_libs] -#end get_depend_libs - - -// dtool/pptempl/Global.pp - -// Define a few directories that will be useful. - -#define install_dir $[$[upcase $[PACKAGE]]_INSTALL] -#if $[eq $[install_dir],] - #error Variable $[upcase $[PACKAGE]]_INSTALL is not set! Cannot install! -#endif - -#define other_trees -#define other_trees_lib -#define other_trees_include -#foreach tree $[NEEDS_TREES] - #define tree_install $[$[upcase $[tree]]_INSTALL] - #if $[eq $[tree_install],] -Warning: Variable $[upcase $[tree]]_INSTALL is not set! - #else - #set other_trees $[other_trees] $[tree_install] - #set other_trees_lib $[other_trees_lib] $[tree_install]/lib - #set other_trees_include $[other_trees_include] $[tree_install]/include - #endif -#end tree - -#define install_lib_dir $[or $[INSTALL_LIB_DIR],$[install_dir]/lib] -#define other_trees_lib $[or $[INSTALL_LIB_DIR],$[other_trees_lib]] - -#define install_headers_dir $[or $[INSTALL_HEADERS_DIR],$[install_dir]/include] -#define other_trees_include $[or $[INSTALL_HEADERS_DIR],$[other_trees_include]] - -#define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin] -#define install_data_dir $[or $[INSTALL_DATA_DIR],$[install_dir]/shared] -#define install_igatedb_dir $[or $[INSTALL_IGATEDB_DIR],$[install_dir]/etc] -#define install_config_dir $[or $[INSTALL_CONFIG_DIR],$[install_dir]/etc] -#defer install_py_dir $[install_lib_dir]/$[PACKAGE]/$[DIRNAME] -#defer install_py_package_dir $[install_lib_dir]/$[PACKAGE] - -#if $[ne $[DTOOL_INSTALL],] - #define install_parser_inc_dir $[DTOOL_INSTALL]/include/parser-inc -#else - #define install_parser_inc_dir $[install_headers_dir]/parser-inc -#endif - -// Set up the correct interrogate options. - -// $[dllext] is redefined in the Windows Global.platform.pp files to -// the string _d if we are building a debug tree. This is inserted -// into the .dll and .in filenames before the extension to make a -// runtime distinction between debug and non-debug builds. For now, -// we make a global definition to empty string, since non-Windows -// platforms will leave this empty. -#define dllext - -// $[obj_prefix] defines the prefix that is prepended to the name of -// the object files. It can be used to avoid potential collisions -// when a source file is used by multiple targets but with different -// compile options for each. -// -// $[obj_prefix] may be redefined by one of the Global.platform.pp -// files. -#defer obj_prefix $[TARGET]_ - -// Caution! interrogate_ipath might be redefined in the -// Global.platform.pp file. -#defer interrogate_ipath $[install_parser_inc_dir:%=-S%] $[INTERROGATE_SYSTEM_IPATH:%=-S%] $[target_ipath:%=-I%] - -#defer interrogate_options \ - -DCPPPARSER -D__STDC__=1 -D__cplusplus $[SYSTEM_IGATE_FLAGS] \ - $[interrogate_ipath] \ - $[CDEFINES_OPT$[OPTIMIZE]:%=-D%] \ - $[filter -D%,$[C++FLAGS]] \ - $[INTERROGATE_OPTIONS] \ - $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \ - $[if $[INTERROGATE_C_INTERFACE],-c] \ - $[if $[<= $[OPTIMIZE], 1],-spam] - -#defer interrogate_module_options \ - $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \ - $[if $[INTERROGATE_C_INTERFACE],-c] - - -// The language stuff is used by model builds only. -// Set language_filters to be "%_english %_castillian %_japanese %_german" etc. -#if $[LANGUAGES] - #define language_filters $[subst ,%,$[LANGUAGES:%=_%]] - #print Using language $[LANGUAGE] -#else - #define language_filters -#endif -#define language_egg_filters $[language_filters:%=%.egg] -#define language_dna_filters $[language_filters:%=%.dna] - -// This is used for evaluating SoftImage unpack rules in Template.models.pp. -#defer soft_scene_files $[matrix $[DATABASE]/SCENES/$[SCENE_PREFIX],$[MODEL] $[ANIMS],.1-0.dsc] - -// Include the global definitions for this particular build_type, if -// the file is there. -#sinclude $[GLOBAL_TYPE_FILE] - diff --git a/dtool/pptempl/Global.unix.pp b/dtool/pptempl/Global.unix.pp deleted file mode 100644 index 8136618944..0000000000 --- a/dtool/pptempl/Global.unix.pp +++ /dev/null @@ -1,7 +0,0 @@ -// -// Global.unix.pp -// -// This file is read in before any of the individual Sources.pp files -// are read. It defines a few global variables to assist -// Template.unix.pp. -// diff --git a/dtool/pptempl/PostConfig.pp b/dtool/pptempl/PostConfig.pp deleted file mode 100644 index c2244f2b00..0000000000 --- a/dtool/pptempl/PostConfig.pp +++ /dev/null @@ -1,85 +0,0 @@ -// This file is included after including all of $DTOOL/Config.pp and -// the user's personal Config.pp file. It makes decisions necessary -// following the user's Config settings. - -#if $[and $[OSX_PLATFORM],$[BUILD_IPHONE]] - //#define IPH_PLATFORM iPhoneSimulator - #define IPH_PLATFORM $[BUILD_IPHONE] - #define IPH_VERSION 2.0 - - #if $[eq $[IPH_PLATFORM], iPhoneOS] - #define ARCH_FLAGS -arch armv6 -mcpu=arm1176jzf-s - #define osflags -fpascal-strings -fasm-blocks -miphoneos-version-min=2.0 - #define DEBUGFLAGS -gdwarf-2 - //#define DEBUGFLAGS - #elif $[eq $[IPH_PLATFORM], iPhoneSimulator] - #define ARCH_FLAGS -arch i386 - #define osflags -fpascal-strings -fasm-blocks -mmacosx-version-min=10.5 - #define DEBUGFLAGS -gdwarf-2 - #else - #error Inappropriate value for BUILD_IPHONE. - #endif - - #define dev /Developer/Platforms/$[IPH_PLATFORM].platform/Developer - #define env env MACOSX_DEPLOYMENT_TARGET=10.5 PATH="$[dev]/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" - #define CC $[env] $[dev]/usr/bin/gcc-4.0 - #define CXX $[env] $[dev]/usr/bin/g++-4.0 - #define OSX_CDEFS __IPHONE_OS_VERSION_MIN_REQUIRED=20000 - #define OSX_CFLAGS -isysroot $[dev]/SDKs/$[IPH_PLATFORM]$[IPH_VERSION].sdk $[osflags] - - #defer ODIR_SUFFIX -$[IPH_PLATFORM] -#endif - -#if $[eq $[PLATFORM], Android] - -// These are the flags also used by Android's own ndk-build. -#if $[eq $[ANDROID_ARCH],arm] -#define target_cflags\ - -fpic\ - -ffunction-sections\ - -funwind-tables\ - -fstack-protector\ - -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__\ - -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ - -#elif $[eq $[ANDROID_ARCH],mips] -#define target_cflags\ - -fpic\ - -fno-strict-aliasing\ - -finline-functions\ - -ffunction-sections\ - -funwind-tables\ - -fmessage-length=0\ - -fno-inline-functions-called-once\ - -fgcse-after-reload\ - -frerun-cse-after-loop\ - -frename-registers - -#elif $[eq $[ANDROID_ABI],x86] -#define target_cflags\ - -ffunction-sections\ - -funwind-tables\ - -fstack-protector -#endif - -#if $[eq $[ANDROID_ABI],armeabi-v7a] -#define target_cflags $[target_cflags]\ - -march=armv7-a \ - -mfloat-abi=softfp \ - -mfpu=vfpv3-d16 - -#define target_ldflags $[target_ldflags]\ - -march=armv7-a \ - -Wl,--fix-cortex-a8 - -#elif $[eq $[ANDROID_ABI],armeabi] -#define target_cflags $[target_cflags]\ - -march=armv5te \ - -mtune=xscale \ - -msoft-float -#endif - -#define ANDROID_CFLAGS $[target_cflags] $[ANDROID_CFLAGS] -#define ANDROID_LDFLAGS $[target_ldflags] $[ANDROID_LDFLAGS] - -#endif diff --git a/dtool/pptempl/PythonPackageInit.pp b/dtool/pptempl/PythonPackageInit.pp deleted file mode 100644 index 3139392bde..0000000000 --- a/dtool/pptempl/PythonPackageInit.pp +++ /dev/null @@ -1,107 +0,0 @@ -// -// -// PythonPackageInit.pp -// -// This file is imported by Template.*.pp for a toplevel directory -// that defines PYTHON_PACKAGE, to create the appropriate __init__.py -// file for the toplevel of the package. -// - -// Make sure that every subdirectory of src that contains an -// __init__.py file also contains a Sources.pp file. -#define initpys $[wildcard $[TOPDIR]/src/*/__init__.py] -#foreach file $[initpys] - #define dirname $[dir $[file]] - #if $[not $[wildcard $[dirname]/Sources.pp]] - #print Directory $[notdir $[standardize $[dirname]]] doesn't have a Sources.pp file! - #endif -#end file - - -#output __init__.py - -# This file is generated by ppremake. Do not edit it directly; edit -# dtool/pptempl/PythonPackageInit.pp instead if you need to make changes. - -"""This file defines the path to the Python files within this package. -There are two cases: - -(1) This is a source tree being run interactively by a developer, in - which case the Python files are found in package/src/*/*.py. This - case also breaks down into two sub-cases: (1a) we are using the - ctattach tools, in which case we should look for the files in the - actual source directory according to the ctattach variables, or - (1b) we are not using the ctattach tools, in which case the files - are right where we expect them to be. - -(2) This is an installed tree being run by an end-user, in which case - the Python files are found in package/*/*.py. In this case, this - file doesn't really need to be installed; an empty __init__.py - file to define the package would serve just as well. But the file - is crafted so that it will do no harm if it is installed. -""" - -package = '$[upcase $[PACKAGE]]' - -import os -import sys - -def deCygwinify(path): - if os.name in ['nt'] and path[0] == '/': - # On Windows, we may need to convert from a Cygwin-style path - # to a native Windows path. - - # Check for a case like /i/ or /p/: this converts - # to i:/ or p:/. - - dirs = path.split('/') - if len(dirs) > 2 and len(dirs[1]) == 1: - path = '%s:\%s' % (dirs[1], '\\'.join(dirs[2:])) - - else: - # Otherwise, prepend $PANDA_ROOT and flip the slashes. - pandaRoot = os.getenv('PANDA_ROOT') - if pandaRoot: - path = os.path.normpath(pandaRoot + path) - - return path - -if os.getenv('CTPROJS'): - # Ok, this is case (1a): we are using the ctattach tools, and - # therefore will expect to find the source files in - # $(package)/src/*/*.py. Completely replace the search path with - # this path. - tree = os.getenv(package) - - if not tree: - raise StandardError, 'CTPROJS is defined, but you are not attached to %s!' % (package) - tree = deCygwinify(tree) - __path__[0] = os.path.join(tree, 'src') - - # Also make sure we import direct.showbase.FindCtaPaths, so we'll - # be able to find all of the other attached projects. - if package != 'DIRECT': - tree = os.getenv('DIRECT') - if not tree: - raise StandardError,'CTPROJS is defined, but you are not attached to DIRECT!' - tree = deCygwinify(tree) - parent, base = os.path.split(tree) - if parent not in sys.path: - sys.path.append(parent) - - import direct.showbase.FindCtaPaths - -else: - # We are not using the ctattach tools. - srcDir = os.path.join(__path__[0], 'src') - - if os.path.isdir(srcDir): - # The source directory exists; therefore, we are in case (1b). - __path__[0] = srcDir - - else: - # The source directory does not exist, so we must be in case - # (2). Leave well enough alone. - pass - -#end __init__.py diff --git a/dtool/pptempl/System.pp b/dtool/pptempl/System.pp deleted file mode 100644 index bc228a96e2..0000000000 --- a/dtool/pptempl/System.pp +++ /dev/null @@ -1,38 +0,0 @@ -// -// System.pp -// -// This is a system-wide configure file for ppremake. It's normally -// #included from a package-specific Config.pp in the root of the -// source tree. It makes variable declarations that are not normally -// user-editable, but are required to set up the normal processing of -// ppremake. -// - - -// Define DIR_TYPE as "src", since that's the most common kind of source -// file. -#if $[eq $[DIR_TYPE],] - #define DIR_TYPE src -#endif - -// Define where to look for the various kinds of system files. -#if $[eq $[DEPENDS_FILE],] - #define DEPENDS_FILE $[THISDIRPREFIX]Depends.pp -#endif - -#if $[eq $[GLOBAL_FILE],] - #define GLOBAL_FILE $[THISDIRPREFIX]Global.pp -#endif - -#if $[eq $[GLOBAL_TYPE_FILE],] - #define GLOBAL_TYPE_FILE $[THISDIRPREFIX]Global.$[BUILD_TYPE].pp -#endif - -#if $[eq $[TEMPLATE_FILE],] - #define TEMPLATE_FILE $[THISDIRPREFIX]Template.$[BUILD_TYPE].pp -#endif - - -#if $[eq $[DEPENDENCY_CACHE_FILENAME],] - #define DEPENDENCY_CACHE_FILENAME pp.dep -#endif diff --git a/dtool/pptempl/Template.gmsvc.pp b/dtool/pptempl/Template.gmsvc.pp deleted file mode 100644 index 489b188c07..0000000000 --- a/dtool/pptempl/Template.gmsvc.pp +++ /dev/null @@ -1,1168 +0,0 @@ -// -// Template.gmsvc.pp -// -// This file defines the set of output files that will be generated to -// support a makefile build system invoking Microsoft's Visual C++ -// command-line compiler, similar to Template.msvc.pp, but using -// Cygwin's GNU make instead of Microsoft's nmake. -// - -// Before this file is processed, the following files are read and -// processed (in order): - -// The Package.pp file in the root of the current source hierarchy -// (e.g. $PANDA/Package.pp) -// $DTOOL/Package.pp -// $DTOOL/Config.pp -// $DTOOL/Config.Platform.pp -// The user's PPREMAKE_CONFIG file. -// $DTOOL/pptempl/System.pp -// All of the Sources.pp files in the current source hierarchy -// $DTOOL/pptempl/Global.pp -// $DTOOL/pptempl/Global.gmsvc.pp -// $DTOOL/pptempl/Depends.pp, once for each Sources.pp file -// Template.gmsvc.pp (this file), once for each Sources.pp file - -#if $[ne $[DTOOL],] -#define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase -#define dtool_ver_dir $[osfilename $[dtool_ver_dir_cyg]] -#endif - -// -// Correct LDFLAGS_OPT 3,4 here to get around early evaluation of, even -// if deferred -// -#defer nodefaultlib_cstatic \ - $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],], \ - /NODEFAULTLIB:MSVCRT.LIB, \ - /NODEFAULTLIB:LIBCMT.LIB \ - ] -#defer LDFLAGS_OPT3 $[LDFLAGS_OPT3] $[nodefaultlib_cstatic] -#defer LDFLAGS_OPT4 $[LDFLAGS_OPT4] $[nodefaultlib_cstatic] - -////////////////////////////////////////////////////////////////////// -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]] -////////////////////////////////////////////////////////////////////// -// For a source directory, build a single Makefile with rules to build -// each target. - -#if $[build_directory] - // This is the real set of lib_targets we'll be building. On Windows, - // we don't build the shared libraries which are included on metalibs. - #define real_lib_targets - #define real_lib_target_libs - #define deferred_objs - #forscopes lib_target - #if $[build_target] - #if $[eq $[module $[TARGET],$[TARGET]],] - // This library is not on a metalib, so we can build it. - #set real_lib_targets $[real_lib_targets] $[TARGET] - #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] - #else - // This library is on a metalib, so we can't build it, but we - // should build all the obj's that go into it. - #set deferred_objs $[deferred_objs] \ - $[patsubst %,$[%_obj],$[compile_sources]] - #endif - #endif - #end lib_target - - // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic and static libraries, - // and $[bin_targets] the list of binaries. $[test_bin_targets] is - // the list of binaries that are to be built only when specifically - // asked for. - - #define lib_targets $[forscopes metalib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target,$[if $[build_target],$[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]]] $[real_lib_target_libs] - - #define bin_targets \ - $[active_target(bin_target noinst_bin_target csharp_target):%=$[ODIR]/%.exe] \ - $[active_target(sed_bin_target):%=$[ODIR]/%] - #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%.exe] - - #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%$[dllext]$[lib_ext]] - - // And these variables will define the various things we need to - // install. - #define install_lib $[active_target(metalib_target static_lib_target dynamic_lib_target ss_lib_target)] $[real_lib_targets] - #define install_bin $[active_target(bin_target)] - #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_SCRIPTS]] - #define install_modules $[sort $[INSTALL_MODULES(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_MODULES]] - #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_HEADERS]] - #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] - #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_DATA]] - #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]] - #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target)]] - - // These are the various sources collected from all targets within the - // directory. - #define st_sources $[sort $[compile_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target csharp_target)]] - #define yxx_st_sources $[sort $[yxx_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define dep_sources_1 $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - - // If there is an __init__.py in the directory, then all Python - // files in the directory just get installed without having to be - // named. - #if $[and $[INSTALL_PYTHON_SOURCE],$[wildcard $[TOPDIR]/$[DIRPREFIX]__init__.py]] - #define py_sources $[wildcard $[TOPDIR]/$[DIRPREFIX]*.py] - #endif - #define install_py $[py_sources:$[TOPDIR]/$[DIRPREFIX]%=%] - - // These are the source files that our dependency cache file will - // depend on. If it's an empty list, we won't bother writing rules to - // freshen the cache file. - #define dep_sources $[sort $[filter %.c %.cxx %.cpp %.yxx %.lxx %.h %.I %.T,$[dep_sources_1]]] - -#endif // $[build_directory] - -#defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]] - -// $[static_lib_dependencies] is the set of libraries we will link -// with that happen to be static libs. We will introduce dependency -// rules for these. (We don't need dependency rules for dynamic libs, -// since these don't get burned in at build time.) -#defer static_lib_dependencies $[all_libs $[if $[and $[lib_is_static],$[build_lib]],$[RELDIR:%=%/$[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]]],$[complete_local_libs]] - -// $[target_ipath] is the proper ipath to put on the command line, -// from the context of a particular target. - -#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees_include] $[get_ipath] - -// These are the complete set of extra flags the compiler requires. -#defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]] -#defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] - -// $[complete_lpath] is rather like $[complete_ipath]: the list of -// directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] - -// $[lpath] is like $[target_ipath]: it's the list of directories we -// should add to our -L list, from the context of a particular target. -#defer lpath $[sort $[complete_lpath]] $[other_trees_lib] $[get_lpath] - -// $[libs] is the set of libraries we will link with. -#defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]] - -// This is the set of files we might copy into *.prebuilt, if we have -// bison and flex (or copy from *.prebuilt if we don't have them). -#define bison_prebuilt $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] - -// Rather than making a rule to generate each install directory later, -// we create the directories now. This reduces problems from -// multiprocess builds. -#mkdir $[sort \ - $[if $[install_lib],$[install_lib_dir]] \ - $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \ - $[if $[install_bin] $[install_modules],$[install_lib_dir]] \ - $[if $[install_headers],$[install_headers_dir]] \ - $[if $[install_parser_inc],$[install_parser_inc_dir]] \ - $[if $[install_data],$[install_data_dir]] \ - $[if $[install_config],$[install_config_dir]] \ - $[if $[install_igatedb],$[install_igatedb_dir]] \ - $[if $[install_py],$[install_py_dir] $[install_py_package_dir]] \ - ] - -// Similarly, we need to ensure that $[ODIR] exists. Trying to make -// the makefiles do this automatically just causes problems with -// multiprocess builds. -#mkdir $[ODIR] $[TEST_ODIR] - -// Pre-compiled headers are one way to speed the compilation of many -// C++ source files that include similar headers, but it turns out a -// more effective (and more portable) way is simply to compile all the -// similar source files in one pass. - -// We do this by generating a *_composite.cxx file that has an -// #include line for each of several actual source files, and then we -// compile the composite file instead of the original files. -#foreach composite_file $[composite_list] -#output $[composite_file] notouch -#format collapse -/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */ -/* ################################# DO NOT EDIT ########################### */ - -#foreach file $[$[composite_file]_sources] -#if $[USE_TAU] -// For the benefit of Tau, we copy the source file verbatim into the -// composite file. (Tau doesn't instrument files picked up via #include.) -#copy $[DIRPREFIX]$[file] - -#else -##include "$[file]" -#endif // USE_TAU -#end file - -#end $[composite_file] -#end composite_file - -// Okay, we're ready. Start outputting the Makefile now. -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -// If we are using GNU make, this will automatically enable the -// multiprocessor build mode according to the value in -// NUMBER_OF_PROCESSORS, which should be set by NT. Maybe this isn't -// a good idea to do all the time, but you can always disable it by -// explicitly unsetting NUMBER_OF_PROCESSORS, or by setting it to 1. -//#if $[NUMBER_OF_PROCESSORS] -//MAKEFLAGS := -j$[NUMBER_OF_PROCESSORS] -//#endif - -// The 'all' rule makes all the stuff in the directory except for the -// test_bin_targets. It doesn't do any installation, however. -#define all_targets \ - Makefile \ - $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \ - $[sort $[lib_targets] $[bin_targets]] \ - $[deferred_objs] -all : $[all_targets] - -// The 'test' rule makes all the test_bin_targets. -test : $[test_bin_targets] $[test_lib_targets] - -clean : clean-igate -#forscopes metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[compile_sources] -$[TAB] rm -f $[patsubst %,$[%_obj],$[compile_sources]] -#endif -#end metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[deferred_objs] -$[TAB] rm -f $[deferred_objs] -#endif -#if $[lib_targets] $[bin_targets] $[test_bin_targets] -$[TAB] rm -f $[lib_targets] $[bin_targets] $[test_bin_targets] -#endif -#if $[yxx_st_sources] $[lxx_st_sources] -$[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] -#endif -#if $[py_sources] -$[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code. -#endif -#if $[USE_TAU] -$[TAB] rm -f $[ODIR]/*.il $[ODIR]/*.pdb *.inst.* // scrub out tau-generated files. -#endif - -// 'cleanall' is intended to undo all the effects of running ppremake -// and building. It removes everything except the Makefile. -cleanall : clean -#if $[st_sources] -$[TAB] rm -rf $[ODIR] -#endif -#if $[ne $[DEPENDENCY_CACHE_FILENAME],] -$[TAB] rm -f $[DEPENDENCY_CACHE_FILENAME] -#endif -#if $[composite_list] -$[TAB] rm -f $[composite_list] -#endif - -clean-igate : -#forscopes metalib_target lib_target ss_lib_target - #define igatedb $[get_igatedb] - #define igateoutput $[get_igateoutput] - #define igatemscan $[get_igatemscan] - #define igatemout $[get_igatemout] - #if $[igatedb] -$[TAB] rm -f $[igatedb] - #endif - #if $[igateoutput] -$[TAB] rm -f $[igateoutput] $[$[igateoutput]_obj] - #endif - #if $[igatemout] -$[TAB] rm -f $[igatemout] $[$[igatemout]_obj] - #endif -#end metalib_target lib_target ss_lib_target - -// Now, 'install' and 'uninstall'. These simply copy files into the -// install directory (or remove them). The 'install' rule also makes -// the directories if necessary. -#define installed_files \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_PARSER_INC:%=$[install_parser_inc_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[if $[install_py],$[install_py:%=$[install_py_dir]/%] $[install_py_package_dir]/__init__.py] - -#define installed_igate_files \ - $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%] - -#define install_targets \ - $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=install-lib%] \ - $[active_target(bin_target sed_bin_target csharp_target):%=install-%] \ - $[installed_files] - -install : all $[install_targets] - -install-igate : $[sort $[installed_igate_files]] - -uninstall : $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -uninstall-igate : -#if $[installed_igate_files] -$[TAB] rm -f $[sort $[installed_igate_files]] -#endif - -#if $[HAVE_BISON] -prebuild-bison : $[patsubst %,%.prebuilt,$[bison_prebuilt]] -clean-prebuild-bison : -#if $[bison_prebuilt] -$[TAB] rm -f $[sort $[patsubst %,%.prebuilt,$[bison_prebuilt]]] -#endif -#endif - -// Now it's time to start generating the rules to make our actual -// targets. - -igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] - - -///////////////////////////////////////////////////////////////////// -// First, the dynamic and static libraries. -///////////////////////////////////////////////////////////////////// - -#forscopes metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target - -// We might need to define a BUILDING_ symbol for win32. We use the -// BUILDING_DLL variable name, defined typically in the metalib, for -// this; but in some cases, where the library isn't part of a metalib, -// we define BUILDING_DLL directly for the target. -#define building_var $[or $[BUILDING_DLL],$[module $[BUILDING_DLL],$[TARGET]]] - -// $[igatescan] is the set of C++ headers and source files that we -// need to scan for interrogate. $[igateoutput] is the name of the -// generated .cxx file that interrogate will produce (and which we -// should compile into the library). $[igatedb] is the name of the -// generated .in file that interrogate will produce (and which should -// be installed into the /etc directory). -#define igatescan $[get_igatescan] -#define igateoutput $[get_igateoutput] -#define igatedb $[get_igatedb] - -// If this is a metalib, it may have a number of components that -// include interrogated interfaces. If so, we need to generate a -// 'module' file within this library. This is mainly necessary for -// Python; it contains a table of all of the interrogated functions, -// so we can load the library as a Python module and have access to -// the interrogated functions. - -// $[igatemscan] is the set of .in files generated by all of our -// component libraries. If it is nonempty, then we do need to -// generate a module, and $[igatemout] is the name of the .cxx file -// that interrogate will produce to make this module. -#define igatemscan $[get_igatemscan] -#define igatemout $[get_igatemout] - -#if $[build_lib] - // Now output the rule to actually link the library from all of its - // various .obj files. - - #define sources \ - $[patsubst %,$[%_obj],$[compile_sources]] - #if $[not $[BUILD_COMPONENTS]] - // Also link in all of the component files directly into the metalib. - #define sources $[sources] \ - $[components $[patsubst %,$[RELDIR]/$[%_obj],$[compile_sources]],$[active_component_libs]] - #endif - - #define varname $[subst -,_,.,_,$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -$[varname] = $[sources] - #define target $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] - #define sources $($[varname]) - #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%] - -// not parallel (requires gmake 3.79) because of link.exe conflicts in TMP dir (see audiotraits dir) -#if $[or $[GENERATE_BUILDDATE],$[WIN_RESOURCE_FILE]] - #define resource_file $[or $[WIN_RESOURCE_FILE],$[dtool_ver_dir_cyg]/version.rc] - #define tlb_depend $[patsubst %.idl,$[ODIR]/%.tlb,$[filter %.idl, $[get_sources]]] -$[target] : $[sources] $[static_lib_dependencies] $[resource_file] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%] $[tlb_depend] - - // first generate builddate for rc compiler using compiler preprocessor - #define ver_resource "$[ODIR]\$[lib_prefix]$[TARGET].res" -$[TAB] cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp" > "$[ODIR]\verdate.h" -$[TAB] rc /n /I"$[ODIR]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[ver_resource] $[filter /D%, $[flags]] "$[osfilename $[resource_file]]" - #define sources $[sources] $[ver_resource] - #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] - #else -$[TAB] $[link_lib_c] - #endif -#else - -$[target] : $[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%] - #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] - #else -$[TAB] $[link_lib_c] - #endif -#endif - -// Additional dependency rules for the implicit files that get built -// along with a .dll. -#if $[not $[lib_is_static]] -$[ODIR]/$[lib_prefix]$[TARGET]$[dllext].lib : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#endif -#if $[has_pdb] -$[ODIR]/$[lib_prefix]$[TARGET]$[dllext].pdb : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#endif - -#endif - -// Here are the rules to install and uninstall the library and -// everything that goes along with it. -#define installed_files \ - $[if $[build_lib], \ - $[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] \ - $[if $[not $[lib_is_static]],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].lib] \ - $[if $[has_pdb],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].pdb] \ - ] \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] - -install-lib$[TARGET] : $[installed_files] - -uninstall-lib$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#define local $[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#define dest $[install_lib_dir] -#if $[not $[lib_is_static]] - #if $[or $[eq $[USE_COMPILER], MSVC8],$[eq $[USE_COMPILER], MSVC9],$[eq $[USE_COMPILER], MSVC9x64]] -$[TAB] mt -nologo -manifest $[ODIR]/$[local].manifest -outputresource:$[ODIR]/$[local]\;2 -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local].manifest $[dest] - #endif -#endif -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ - -// Install the .lib associated with a .dll. -#if $[not $[lib_is_static]] -$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].lib : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].lib -#define local $[lib_prefix]$[TARGET]$[dllext].lib -#define dest $[install_lib_dir] -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ -#endif - - -#if $[has_pdb] -$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].pdb : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].pdb -#define local $[lib_prefix]$[TARGET]$[dllext].pdb -#define dest $[install_lib_dir] -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ -#endif - -#if $[igatescan] -// Now, some additional rules to generate and compile the interrogate -// data, if needed. - -// The library name is based on this library. -#define igatelib $[lib_prefix]$[TARGET] -// The module name comes from the metalib that includes this library. -#define igatemod $[module $[TARGET],$[TARGET]] -#if $[eq $[igatemod],] - // Unless no metalib includes this library. - #define igatemod $[TARGET] -#endif - -$[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] : $[igatedb] -#define local $[igatedb] -#define dest $[install_igatedb_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ - -// We have to split this out as a separate rule to properly support -// parallel make. -$[igatedb] : $[igateoutput] - -$[lib_prefix]$[TARGET]_igatescan = $[igatescan] -$[igateoutput] : $[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]] -$[TAB] $[INTERROGATE] -od $[igatedb] -oc $[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $($[lib_prefix]$[TARGET]_igatescan) - -#endif // igatescan - - -#if $[igatemout] -// And finally, some additional rules to build the interrogate module -// file into the library, if this is a metalib that includes -// interrogated components. - -#define igatelib $[lib_prefix]$[TARGET] -#define igatemod $[TARGET] - -$[lib_prefix]$[TARGET]_igatemscan = $[igatemscan] -#define target $[igatemout] -#define sources $($[lib_prefix]$[TARGET]_igatemscan) - -$[target] : $[sources] -$[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources] - -#endif // igatemout - -#foreach idl $[filter %.idl, $[get_sources]] - #define idl_basename $[basename $[idl]] -$[ODIR]/$[idl_basename].tlb : $[ODIR]/$[idl_basename].h -$[ODIR]/$[idl_basename].h : $[idl] -$[TAB] $[MIDL_COMMAND] -#end idl - -#end metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target - - -///////////////////////////////////////////////////////////////////// -// Now, the noninstalled dynamic libraries. These are presumably used -// only within this directory, or at the most within this tree, and -// also presumably will never include interrogate data. That, plus -// the fact that we don't need to generate install rules, makes it a -// lot simpler. -///////////////////////////////////////////////////////////////////// - -#forscopes noinst_lib_target test_lib_target -#define varname $[subst -,_,.,_,$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#define sources $($[varname]) -#define $[VER_RESOURCE] $[COMPILED_RESOURCES] -$[target] : $[sources] $[static_lib_dependencies] $[GENERATED_SOURCES] -#if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] -#else -$[TAB] $[link_lib_c] -#endif - -$[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#if $[has_pdb] -$[ODIR]/$[lib_prefix]$[TARGET]$[dllext].pdb : $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#endif - -// this section is all very clunky and not generalized enough -// assuming tgt dirs and such - -#define rc_to_gen $[filter %.rc, $[GENERATED_SOURCES]] -#if $[rc_to_gen] -$[rc_to_gen] : $[GENERATED_RC_DEPENDENCIES] -$[TAB] $[RC_GENERATOR_RULE] - -$[ODIR]/$[RC_BASENAME].res : $[rc_to_gen] -$[TAB] $[COMPILE_RC] /I"$[ODIR]" /Fo"$[ODIR]/$[RC_BASENAME].res" $[ODIR]/$[RC_BASENAME].rc -#endif - -#define inf_to_gen $[filter %.inf, $[GENERATED_SOURCES]] -#if $[inf_to_gen] -$[inf_to_gen] : $[GENERATED_INF_DEPENDENCIES] -$[TAB] $[INF_GENERATOR_RULE] -#endif - -#define rgs_to_gen $[filter %.rgs, $[GENERATED_SOURCES]] -#if $[rgs_to_gen] -$[rgs_to_gen] : $[GENERATED_RGS_DEPENDENCIES] -$[TAB] $[RGS_GENERATOR_RULE] -#endif - -#define verhdr_to_gen $[filter %Version.h, $[GENERATED_SOURCES]] -#if $[verhdr_to_gen] -$[verhdr_to_gen] : $[GENERATED_VERHEADER_DEPENDENCIES] -$[TAB] $[VERHEADER_GENERATOR_RULE] - -$[VERHEADER_DEPENDENTS] : $[verhdr_to_gen] -#endif - -#define idl_to_gen $[filter %.idl, $[GENERATED_SOURCES]] -#if $[idl_to_gen] -$[idl_to_gen] : $[GENERATED_IDL_DEPENDENCIES] -$[TAB] $[IDL_GENERATOR_RULE] - -$[ODIR]/$[IDL_BASENAME].h : $[idl_to_gen] -#define idl $[idl_to_gen] -$[TAB] $[MIDL_COMMAND] - -// this is a complete hack. I don't know how add a generated .h to the dependency list of $[IDL_BASENAME].cpp. -// it is already there, but in the wrong directory. should really add this to official dependency list -#foreach file $[GENERATED_IDL_H_DEPENDENTS] -$[file] : $[ODIR]/$[IDL_BASENAME].h -$[TAB] // empty, dependency-only 'rule' - -#end file - -$[ODIR]/$[IDL_BASENAME].tlb : $[idl_to_gen] -#define idl $[idl_to_gen] -$[TAB] $[MIDL_COMMAND] -#endif - -#end noinst_lib_target test_lib_target - - -///////////////////////////////////////////////////////////////////// -// The sed_bin_targets are a special bunch. These are scripts that -// are to be preprocessed with sed before being installed, for -// instance to insert a path or something in an appropriate place. -///////////////////////////////////////////////////////////////////// - -#forscopes sed_bin_target -$[TARGET] : $[ODIR]/$[TARGET] - -#define target $[ODIR]/$[TARGET] -#define source $[SOURCE] -#define script $[COMMAND] -$[target] : $[source] -$[TAB] $[SED] -$[TAB] chmod +x $[target] - -#define installed_files \ - $[install_bin_dir]/$[TARGET] - -install-$[TARGET] : $[installed_files] - -uninstall-$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -#define local $[TARGET] -#define dest $[install_bin_dir] -$[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET] -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ - -#end sed_bin_target - - -///////////////////////////////////////////////////////////////////// -// And now, the bin_targets. These are normal C++ executables. No -// interrogate, metalibs, or any such nonsense here. -///////////////////////////////////////////////////////////////////// - -#forscopes bin_target -$[TARGET] : $[ODIR]/$[TARGET].exe - -#define varname $[subst -,_,bin_$[TARGET]] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[TARGET].exe -#define sources $($[varname]) -#define ld $[get_ld] - -#if $[WIN_RESOURCE_FILE] - #define resource_file $[WIN_RESOURCE_FILE] - #define ver_resource "$[ODIR]\$[TARGET].res" -$[ver_resource] : $[resource_file] -$[TAB] rc /n /I"$[ODIR]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[ver_resource] $[filter /D%, $[flags]] "$[osfilename $[resource_file]]" - #set sources $[sources] $[ver_resource] -#endif - -$[target] : $[sources] $[static_lib_dependencies] -#if $[ld] - // If there's a custom linker defined for the target, we have to use it. -$[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#else - // Otherwise, we can use the normal linker. - #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_bin_c++] - #else -$[TAB] $[link_bin_c] - #endif -#endif - -#if $[build_pdbs] -$[ODIR]/$[TARGET].pdb : $[ODIR]/$[TARGET].exe -#endif - -#define installed_files \ - $[install_bin_dir]/$[TARGET].exe \ - $[if $[build_pdbs],$[install_bin_dir]/$[TARGET].pdb] \ - $[if $[or $[eq $[USE_COMPILER],MSVC8],$[eq $[USE_COMPILER],MSVC9],$[eq $[USE_COMPILER],MSVC9x64]],$[install_bin_dir]/$[TARGET].exe.manifest] \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[if $[bin_postprocess_target],$[install_bin_dir]/$[bin_postprocess_target].exe] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] - -install-$[TARGET] : $[installed_files] - - -uninstall-$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_bin_dir]/$[TARGET].exe : $[ODIR]/$[TARGET].exe -#define local $[TARGET].exe -#define dest $[install_bin_dir] -#if $[or $[eq $[USE_COMPILER],MSVC8],$[eq $[USE_COMPILER],MSVC9],$[eq $[USE_COMPILER],MSVC9x64]] -$[TAB] mt -nologo -manifest $[ODIR]/$[local].manifest -outputresource:$[ODIR]/$[local]\;1 -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local].manifest $[dest]/ -#endif -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ - -#if $[build_pdbs] -$[install_bin_dir]/$[TARGET].pdb : $[ODIR]/$[TARGET].pdb -#define local $[TARGET].pdb -#define dest $[install_bin_dir] -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ -#endif - -#if $[bin_postprocess_target] -#define input_exe $[ODIR]/$[TARGET].exe -#define output_exe $[ODIR]/$[bin_postprocess_target].exe - -$[output_exe] : $[input_exe] -$[TAB] rm -f $[output_exe] -$[TAB] $[bin_postprocess_cmd] $[bin_postprocess_arg1] $[input_exe] $[bin_postprocess_arg2] $[output_exe] - -$[install_bin_dir]/$[bin_postprocess_target].exe : $[output_exe] -$[TAB] cp $[install_dash_p] -f $[output_exe] $[install_bin_dir]/ -#endif - -#end bin_target - -///////////////////////////////////////////////////////////////////// -// The noinst_bin_targets and the test_bin_targets share the property -// of being built (when requested), but having no install rules. -///////////////////////////////////////////////////////////////////// - -#forscopes noinst_bin_target test_bin_target test_lib_target -$[TARGET] : $[ODIR]/$[TARGET].exe - -#define varname $[subst -,_,bin_$[TARGET]] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[TARGET].exe -#define sources $($[varname]) -$[target] : $[sources] $[static_lib_dependencies] -#if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_bin_c++] -#else -$[TAB] $[link_bin_c] -#endif - -#end noinst_bin_target test_bin_target test_lib_target - -///////////////////////////////////////////////////////////////////// -// Rules to for rudimentary C-sharp compiling -///////////////////////////////////////////////////////////////////// -#forscopes csharp_target -$[TARGET] : $[ODIR]/$[TARGET].exe - -#define target $[ODIR]/$[TARGET].exe -#define output "$[ODIR]\$[TARGET].exe" - -$[target] : $[sources] -$[TAB] $[CSHARP] /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /debug:pdbonly /filealign:512 /optimize+ /out:$[target] /target:exe $[osfilename $[SOURCES]] - -#if $[build_pdbs] -$[ODIR]/$[TARGET].pdb : $[ODIR]/$[TARGET].exe -#endif - -#define installed_files \ - $[install_bin_dir]/$[TARGET].exe - -install-$[TARGET] : $[installed_files] - -uninstall-$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_bin_dir]/$[TARGET].exe : $[ODIR]/$[TARGET].exe -#define local $[TARGET].exe -#define dest $[install_bin_dir] -$[TAB] cp $[install_dash_p] -f $[ODIR]/$[local] $[dest]/ - -#end csharp_target - -///////////////////////////////////////////////////////////////////// -// Rules to run bison and/or flex as needed. -///////////////////////////////////////////////////////////////////// - -// Rules to generate a C++ file from a Bison input file. -#foreach file $[sort $[yxx_st_sources]] -#define target $[patsubst %.yxx,%.cxx,$[file]] -#define target_header $[patsubst %.yxx,%.h,$[file]] -#define target_prebuilt $[target].prebuilt -#define target_header_prebuilt $[target_header].prebuilt -#if $[HAVE_BISON] -$[target] : $[file] -$[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[file] -$[TAB] mv y.tab.c $[target] -$[TAB] mv y.tab.h $[target_header] -$[target_header] : $[target] -$[target_prebuilt] : $[target] -$[TAB] cp $[target] $[target_prebuilt] -$[target_header_prebuilt] : $[target_header] -$[TAB] cp $[target_header] $[target_header_prebuilt] -#else // HAVE_BISON -$[target] : $[target_prebuilt] -$[TAB] cp $[target_prebuilt] $[target] -$[target_header] : $[target_header_prebuilt] -$[TAB] cp $[target_header_prebuilt] $[target_header] -#endif // HAVE_BISON - -#end file - -// Rules to generate a C++ file from a Flex input file. -#foreach file $[sort $[lxx_st_sources]] -#define target $[patsubst %.lxx,%.cxx,$[file]] -#define target_prebuilt $[target].prebuilt -#if $[HAVE_BISON] -#define source $[file] -$[target] : $[file] -$[TAB] $[FLEX] $[FLEXFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[file] -#define source lex.yy.c -#define script /#include /d -$[TAB] $[SED] -$[TAB] rm lex.yy.c -$[target_prebuilt] : $[target] -$[TAB] cp $[target] $[target_prebuilt] -#else // HAVE_BISON -$[target] : $[target_prebuilt] -$[TAB] cp $[target_prebuilt] $[target] -#endif // HAVE_BISON - -#end file - - -///////////////////////////////////////////////////////////////////// -// Finally, we put in the rules to compile each source file into a .obj -// file. -///////////////////////////////////////////////////////////////////// - -#forscopes metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -// need to use #print to avoid printing to Makefile -// printvar prints the unevaluated defn of the var -// #print TARGET=$[TARGET] -// #printvar TARGET - -// Rules to compile ordinary C files. -#foreach file $[sort $[c_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[cflags] $[building_var:%=/D%] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -#if $[not $[direct_tau]] - -$[target] : $[source] $[get_depends $[source]] -$[TAB] $[compile_c] - -#else // direct_tau -// This version is used to invoke the tau compiler directly. -#define il_source $[target].il -#define pdb_source $[target].pdb // Not to be confused with windows .pdb debugger info files. -#define inst_source $[notdir $[target:%.obj=%.inst.c]] -$[il_source] : $[source] -$[TAB] $[TAU_MAKE_IL] - -$[pdb_source] : $[il_source] -$[TAB] $[TAU_MAKE_PDB] - -$[inst_source] : $[pdb_source] -$[TAB] $[TAU_MAKE_INST] -c - -$[target] : $[inst_source] $[get_depends $[source]] -#define source $[inst_source] -$[TAB] $[COMPILE_C] - -#endif // direct_tau - -#end file - -// Rules to compile C++ files. - -#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[c++flags] $[building_var:%=/D%] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -#if $[not $[direct_tau]] -// Yacc must run before some files can be compiled, so all files -// depend on yacc having run. -$[target] : $[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h] -$[TAB] $[compile_c++] - -#else // direct_tau -// This version is used to invoke the tau compiler directly. -#define il_source $[target].il -#define pdb_source $[target].pdb // Not to be confused with windows .pdb debugger info files. -#define inst_source $[notdir $[target:%.obj=%.inst.cxx]] -$[il_source] : $[source] $[yxx_sources:%.yxx=%.h] -$[TAB] $[TAU_MAKE_IL] - -$[pdb_source] : $[il_source] -$[TAB] $[TAU_MAKE_PDB] - -$[inst_source] : $[pdb_source] -$[TAB] $[TAU_MAKE_INST] -c++ - -$[target] : $[inst_source] $[get_depends $[source]] -#define source $[inst_source] -$[TAB] $[COMPILE_C++] - -#endif // direct_tau - -#end file - -#end metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target - -// And now the rules to install the auxiliary files, like headers and -// data files. -#foreach file $[install_scripts] -$[install_bin_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_bin_dir] -$[TAB] chmod +x $[local]; cp $[install_dash_p] -f $[local] $[dest]/ -#end file - -#foreach file $[install_modules] -$[install_lib_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_lib_dir] -$[TAB] chmod +x $[local]; cp $[install_dash_p] -f $[local] $[dest]/ -#end file - -#foreach file $[install_headers] -$[install_headers_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_headers_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ -#end file - -#foreach file $[install_parser_inc] -#if $[ne $[dir $[file]], ./] -$[install_parser_inc_dir]/$[file] : $[notdir $[file]] - #define local $[notdir $[file]] - #define dest $[install_parser_inc_dir]/$[dir $[file]] -$[TAB] mkdir -p $[install_parser_inc_dir]/$[dir $[file]] || echo -$[TAB] cp $[install_dash_p] -f $[local] $[dest] -#else -$[install_parser_inc_dir]/$[file] : $[file] - #define local $[file] - #define dest $[install_parser_inc_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ -#endif -#end file - -#foreach file $[install_data] -$[install_data_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_data_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ -#end file - -#foreach file $[install_config] -$[install_config_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_config_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ -#end file - -#foreach file $[install_py] -$[install_py_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_py_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ -#end file - -#if $[install_py] -$[install_py_package_dir]/__init__.py : -$[TAB] touch $[install_py_package_dir]/__init__.py -#endif - -// Finally, all the special targets. These are commands that just need -// to be invoked; we don't pretend to know what they are. -#forscopes special_target -$[TARGET] : -$[TAB] $[COMMAND] - -#end special_target - - -// Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] -$[TAB] ppremake - -#if $[USE_TAU] -#foreach composite_file $[composite_list] -$[composite_file] : $[$[composite_file]_sources] -$[TAB] ppremake -#end composite_file -#endif // USE_TAU - -#if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]] -$[DEPENDENCY_CACHE_FILENAME] : $[dep_sources] -$[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME] -#endif - -#end Makefile - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], group] -////////////////////////////////////////////////////////////////////// - -// This is a group directory: a directory above a collection of source -// directories, e.g. $DTOOL/src. We don't need to output anything in -// this directory. - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], toplevel] -////////////////////////////////////////////////////////////////////// - -// This is the toplevel directory, e.g. $DTOOL. Here we build the -// root makefile and also synthesize the dtool_config.h (or whichever -// file) we need. - -#map subdirs -// Iterate through all of our known source files. Each src and -// metalib type file gets its corresponding Makefile listed -// here. However, we test for $[DIR_TYPE] of toplevel, because the -// source directories typically don't define their own DIR_TYPE -// variable, and they end up inheriting this one dynamically. -#forscopes */ -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib],$[and $[eq $[DIR_TYPE], toplevel],$[ne $[DIRNAME],top]]] -#if $[build_directory] - #addmap subdirs $[DIRNAME] -#endif -#endif -#end */ - -#if $[PYTHON_PACKAGE] -#include $[THISDIRPREFIX]PythonPackageInit.pp -#endif - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -all : $[subdirs] -test : $[subdirs:%=test-%] -igate : $[subdirs:%=igate-%] -clean : $[subdirs:%=clean-%] -clean-igate : $[subdirs:%=clean-igate-%] -cleanall : $[subdirs:%=cleanall-%] -install : $[if $[CONFIG_HEADER],$[install_headers_dir] $[install_headers_dir]/$[CONFIG_HEADER]] $[subdirs:%=install-%] -install-igate : $[subdirs:%=install-igate-%] -uninstall : $[subdirs:%=uninstall-%] -#if $[CONFIG_HEADER] -$[TAB] rm -f $[install_headers_dir]/$[CONFIG_HEADER] -#endif -uninstall-igate : $[subdirs:%=uninstall-igate-%] - -#if $[HAVE_BISON] -prebuild-bison : $[subdirs:%=prebuild-bison-%] -clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%] -#endif - -#formap dirname subdirs -#define depends -$[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]] -$[TAB] cd ./$[PATH] && $(MAKE) all -#end dirname - -#formap dirname subdirs -test-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) test -#end dirname - -#formap dirname subdirs -igate-$[dirname] : -$[TAB]cd ./$[PATH] && $(MAKE) igate -#end dirname - -#formap dirname subdirs -clean-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) clean -#end dirname - -#formap dirname subdirs -clean-igate-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) clean-igate -#end dirname - -#formap dirname subdirs -cleanall-$[dirname] : $[patsubst %,cleanall-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd ./$[PATH] && $(MAKE) cleanall -#end dirname - -#formap dirname subdirs -install-$[dirname] : $[patsubst %,install-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd ./$[PATH] && $(MAKE) install -#end dirname - -#formap dirname subdirs -install-igate-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) install-igate -#end dirname - -#formap dirname subdirs -uninstall-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) uninstall -#end dirname - -#formap dirname subdirs -uninstall-igate-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) uninstall-igate -#end dirname - -#if $[HAVE_BISON] -#formap dirname subdirs -prebuild-bison-$[dirname] : -$[TAB]cd ./$[PATH] && $(MAKE) prebuild-bison -clean-prebuild-bison-$[dirname] : -$[TAB]cd ./$[PATH] && $(MAKE) clean-prebuild-bison -#end dirname -#endif - -#if $[ne $[CONFIG_HEADER],] -$[install_headers_dir] : -$[TAB] @test -d $[install_headers_dir] || echo mkdir -p $[install_headers_dir] -$[TAB] @test -d $[install_headers_dir] || mkdir -p $[install_headers_dir] - -$[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER] -#define local $[CONFIG_HEADER] -#define dest $[install_headers_dir] -$[TAB] cp $[install_dash_p] -f $[local] $[dest]/ -#endif - -// Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] -$[TAB] ppremake - -#end Makefile - -// If there is a file called LocalSetup.pp in the package's top -// directory, then invoke that. It might contain some further setup -// instructions. -#sinclude $[TOPDIRPREFIX]LocalSetup.gmsvc.pp -#sinclude $[TOPDIRPREFIX]LocalSetup.pp - - -////////////////////////////////////////////////////////////////////// -#elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]] -////////////////////////////////////////////////////////////////////// - -#include $[THISDIRPREFIX]Template.models.pp - -////////////////////////////////////////////////////////////////////// -#endif // DIR_TYPE - diff --git a/dtool/pptempl/Template.models.nmake.pp b/dtool/pptempl/Template.models.nmake.pp deleted file mode 100644 index 60abeb71ba..0000000000 --- a/dtool/pptempl/Template.models.nmake.pp +++ /dev/null @@ -1,749 +0,0 @@ -// -// Template.models.nmake.pp -// -// This file defines the Makefiles that will be built to generate -// models (egg, bam models computed from flt, soft, alias, -// etc. sources). This Template file is derived from -// Template.models.pp, but uses windows specific conventions, -// rather than unix specific conventions. -// - -#if $[< $[PPREMAKE_VERSION],0.57] - #error You need at least ppremake version 0.58 to build models. -#endif - -// Search for the texattrib dir definition. This will be in the -// models_topdir directory. -#define texattrib_dir $[dir_type $[TEXATTRIB_DIR],models_toplevel] - -// Prefix $[TOPDIR]. If it wasn't defined, make a default. -#if $[texattrib_dir] - #define texattrib_dir $[TOPDIR]/$[texattrib_dir] -#else - #define texattrib_dir $[TOPDIR]/src/maps -#endif - -#define texattrib_file $[texattrib_dir]/textures.txa - -////////////////////////////////////////////////////////////////////// -#if $[eq $[DIR_TYPE], models] -////////////////////////////////////////////////////////////////////// - -#define pal_egg_dir pal_egg -#define bam_dir bams -#defer phase_prefix $[if $[PHASE],phase_$[PHASE]/] - -#defer install_model_dir $[install_dir]/$[phase_prefix]$[INSTALL_TO] -#define filter_dirs $[sort $[TARGET_DIR(filter_egg filter_char_egg optchar_egg)]] - -#defer source_prefix $[SOURCE_DIR:%=%/] - -#if $[LANGUAGES] - #define exlanguage_sources $[notdir $[filter %.flt %.mb %.ma %.lwo %.LWO %.egg,$[wildcard $[TOPDIR]/$[DIRPREFIX]*_$[LANGUAGE].*]]] - - #defun lang_add_files sources, src_ext, local_extra - #define default_filter - #define local_filter - #foreach ext $[src_ext] - #set default_filter $[default_filter] %_$[DEFAULT_LANGUAGE].$[ext] - #set local_filter $[local_filter] %_$[LANGUAGE].$[ext] - #end ext - #define default_langlist $[filter $[default_filter],$[sources]] - #define locallist $[filter $[local_filter],$[local_extra] $[exlanguage_sources]] - #define havelist - #foreach file $[default_langlist] - #foreach ext $[src_ext] - #define wantfile $[file:%_$[DEFAULT_LANGUAGE].$[ext]=%_$[LANGUAGE].$[ext]] - #set havelist $[havelist] $[filter $[wantfile],$[locallist]] - #end ext - #end file - $[havelist] - #end lang_add_files - - #forscopes flt_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], flt, ]] - #endif - #end flt_egg - - #forscopes lwo_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], lwo LWO, ]] - #endif - #end lwo_egg - - #forscopes maya_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], lwo LWO, ]] - #endif - #end maya_egg -#endif - -#define build_flt_eggs \ - $[forscopes flt_egg,$[patsubst %.flt,%$[EGG_SUFFIX].egg,$[SOURCES]]] - -#define build_lwo_eggs \ - $[forscopes lwo_egg,$[patsubst %.lwo %.LWO,%$[EGG_SUFFIX].egg,$[SOURCES]]] - -#define build_maya_eggs \ - $[forscopes maya_egg,$[patsubst %$[MODEL].ma %$[MODEL].mb ,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[SOURCES]]] \ - $[forscopes maya_char_egg,$[POLY_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg] $[NURBS_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg]] \ - $[forscopes maya_char_egg,$[ANIMS:%=$[EGG_PREFIX]%$[CHAN_SUFFIX].egg]] - -#define build_soft_eggs \ - $[forscopes soft_char_egg,$[POLY_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg] $[NURBS_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg]] \ - $[forscopes soft_char_egg,$[ANIMS:%=$[EGG_PREFIX]%$[CHAN_SUFFIX].egg]] - -#define build_eggs \ - $[sort \ - $[build_flt_eggs] \ - $[build_lwo_eggs] \ - $[build_maya_eggs] \ - $[build_soft_eggs]] - -#if $[LANGUAGES] - #forscopes install_egg filter_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], egg, $[build_eggs]]] - #endif - #end install_egg filter_egg -#endif - -// Get the list of egg files that are to be installed -#define install_pal_eggs -#define install_unpal_eggs -#forscopes install_egg - #define egglist $[notdir $[SOURCES]] - #set install_pal_eggs $[install_pal_eggs] $[filter-out $[language_egg_filters],$[egglist]] - #if $[LANGUAGES] - // Now look for the eggs of the current language. - #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]] - #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg] - #if $[filter $[wantegg],$[egglist]] - // The current language file exists. - #set install_pal_eggs $[install_pal_eggs] $[wantegg] - #else - #set install_pal_eggs $[install_pal_eggs] $[egg] - #endif - #end egg - #endif - #define egglist $[notdir $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]] - #set install_unpal_eggs $[install_unpal_eggs] $[filter-out $[language_egg_filters],$[egglist]] - #if $[LANGUAGES] - // Now look for the eggs of the current language. - #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]] - #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg] - #if $[filter $[wantegg],$[egglist]] - // The current language file exists. - #set install_unpal_eggs $[install_unpal_eggs] $[wantegg] - #else - #set install_unpal_eggs $[install_unpal_eggs] $[egg] - #endif - #end egg - #endif -#end install_egg -#define install_eggs $[install_pal_eggs] $[install_unpal_eggs] - - -// Get the list of bam files in the install directories -#define install_egg_dirs $[sort $[forscopes install_egg,$[install_model_dir]]] -#define installed_generic_bams $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.bam,$[filter-out $[language_egg_filters],$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]]] -#if $[LANGUAGES] - #define installed_language_bams $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.bam,$[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]]] -#endif - -// And the list of dna files in the install directories. -#define install_dna_dirs $[sort $[forscopes install_dna,$[install_model_dir]]] -#define installed_generic_dna $[sort $[forscopes install_dna,$[patsubst %,$[install_model_dir]/%,$[filter-out $[language_dna_filters],$[notdir $[SOURCES]]]]]] -#if $[LANGUAGES] - #define installed_language_dna $[sort $[forscopes install_dna,$[patsubst %,$[install_model_dir]/%,$[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[notdir $[SOURCES]]]]]] -#endif - -#define install_other_dirs $[sort $[forscopes install_audio install_icons install_shader install_misc,$[install_model_dir]]] -#define installed_other $[sort $[forscopes install_audio install_icons install_shader install_misc,$[SOURCES:%=$[install_model_dir]/%]]] - - -#define pal_egg_targets $[sort $[patsubst %,$[pal_egg_dir]/%,$[notdir $[install_pal_eggs]]]] -#define bam_targets $[install_eggs:%.egg=$[bam_dir]/%.bam] - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -#define all_targets \ - Makefile \ - $[texattrib_dir] \ - $[filter_dirs] \ - $[optchar_dirs] \ - egg bam -all : $[all_targets] - -egg : $[build_eggs] - -flt : $[build_flt_eggs] -lwo : $[build_lwo_eggs] -maya : $[build_maya_eggs] -soft : $[build_soft_eggs] - -pal : $[if $[pal_egg_targets],$[pal_egg_dir]] $[pal_egg_targets] - -bam : pal $[if $[bam_targets],$[bam_dir]] $[bam_targets] - -#map soft_scenes soft_scene_files(soft_char_egg) - -unpack-soft : $[soft_scenes] - -#define install_bam_targets \ - $[install_egg_dirs] \ - $[installed_generic_bams] $[installed_language_bams] -install-bam : $[install_bam_targets] - -#define install_other_targets \ - $[install_dna_dirs] \ - $[installed_generic_dna] $[installed_language_dna] \ - $[install_other_dirs] \ - $[installed_other] -install-other : $[install_other_targets] - -install : all install-other install-bam -uninstall : uninstall-other uninstall-bam - -clean-bam : -#if $[bam_targets] -$[TAB]del /f/q $[osfilename $[bam_dir]] -#endif - -clean-pal : clean-bam -#if $[pal_egg_targets] -$[TAB]del /f/q $[osfilename $[pal_egg_dir]] -#endif - -clean-flt : -#if $[build_flt_eggs] -$[TAB]del /f/q $[osfilename $[build_flt_eggs]] -#endif - -clean-lwo : -#if $[build_lwo_eggs] -$[TAB]del /f/q $[osfilename $[build_lwo_eggs]] -#endif - -clean-maya : -#if $[build_maya_eggs] -$[TAB]del /f/q $[osfilename $[build_maya_eggs]] -#endif - -clean-soft : -#if $[build_soft_eggs] -$[TAB]del /f/q $[osfilename $[build_soft_eggs]] -#endif - -clean : clean-pal -#if $[build_eggs] -$[TAB]del /f/q $[osfilename $[build_eggs]] *.pt -$[TAB]del /f/q $[osfilename $[build_eggs]] *.pt -#endif -#if $[filter_dirs] -$[TAB]del /f/q $[osfilename $[filter_dirs]] -#endif - -// We need a rule for each directory we might need to make. This -// loops through the full set of directories and creates a rule to -// make each one, as needed. -#foreach directory $[sort \ - $[filter_dirs] \ - $[if $[pal_egg_targets],$[pal_egg_dir]] \ - $[if $[bam_targets],$[bam_dir]] \ - $[TARGET_DIR(filter_char_egg)] \ - $[texattrib_dir] \ - $[install_egg_dirs] \ - $[install_dna_dirs] \ - $[install_other_dirs] \ - ] -$[directory] : -$[TAB]@if not exist $[osfilename $[directory]] mkdir $[osfilename $[directory]] - -// Sometimes we need a target to depend on the directory existing, without -// being fooled by the directory's modification times. We use this -// phony timestamp file to achieve that. -$[directory]/stamp : -$[TAB]@if not exist $[osfilename $[directory]] mkdir $[osfilename $[directory]] -$[TAB]@echo. > $[osfilename $[directory]/stamp] - -#end directory - -// Decompressing compressed files. -#forscopes gz - #foreach gz $[SOURCES] - #define target $[gz:%.gz=%] - #define source $[gz] -$[target] : $[source] -$[TAB]del /f/q $[osfilename $[target]] -$[TAB]gunzip $[GUNZIP_OPTS] < $[osfilename $[source]] > $[osfilename $[target]] - - #end gz -#end gz - -// Egg file generation from Flt files. -#forscopes flt_egg - #foreach flt $[SOURCES] - #define target $[or $[TARGET],$[patsubst %.flt %.FLT,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[flt]]] - #define source $[flt] -$[target] : $[source] -$[TAB]flt2egg $[FLT2EGG_OPTS] -o $[osfilename $[target]] $[osfilename $[source]] - - #end flt -#end flt_egg - -// Egg file generation from Lightwave files. -#forscopes lwo_egg - #foreach lwo $[SOURCES] - #define target $[or $[TARGET],$[patsubst %.lwo %.LWO,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[lwo]]] - #define source $[lwo] -$[target] : $[source] -$[TAB]lwo2egg $[LWO2EGG_OPTS] -o $[osfilename $[target]] $[osfilename $[source]] - - #end lwo -#end lwo_egg - -// Egg file generation from Maya files (for unanimated models). -#forscopes maya_egg - #foreach maya $[SOURCES] - #define target $[or $[TARGET],$[patsubst %$[MODEL].ma %$[MODEL].mb,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[maya]]] - #define source $[maya] -$[target] : $[source] -$[TAB]maya2egg $[MAYA2EGG_OPTS] -o $[osfilename $[target]] $[osfilename $[source]] - - #end maya -#end maya_egg - -// Egg character model generation from Maya files. -#forscopes maya_char_egg - #if $[POLY_MODEL] - #define target $[EGG_PREFIX]$[POLY_MODEL].egg - #define source $[MAYA_PREFIX]$[or $[MODEL],$[POLY_MODEL]].mb -$[target] : $[source] -$[TAB]maya2egg $[MAYA2EGG_OPTS] -p -a model -cn "$[CHAR_NAME]" -o $[osfilename $[target]] $[osfilename $[source]] - #endif - #if $[NURBS_MODEL] - #define target $[EGG_PREFIX]$[NURBS_MODEL].egg - #define source $[MAYA_PREFIX]$[or $[MODEL],$[NURBS_MODEL]].mb -$[target] : $[source] -$[TAB]maya2egg $[MAYA2EGG_OPTS] -a model -cn "$[CHAR_NAME]" -o $[osfilename $[target]] $[osfilename $[source]] - #endif - -#end maya_char_egg - -// Egg animation generation from Maya files. -#forscopes maya_char_egg - #foreach anim $[ANIMS] - #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg - #define source $[MAYA_PREFIX]$[anim].mb - #define begin 0 - #define end - #if $[$[anim]_frames] - #set begin $[word 1,$[$[anim]_frames]] - #set end $[word 2,$[$[anim]_frames]] - #endif -$[target] : $[source] -$[TAB]maya2egg $[MAYA2EGG_OPTS] -a chan -cn "$[CHAR_NAME]" -o $[osfilename $[target]] -sf $[begin] $[if $[end],-ef $[end]] $[osfilename $[source]] - #end anim -#end maya_char_egg - -// Unpack the Soft scene database from its multifile. -#formap scene_file soft_scenes - #define target $[scene_file] - #define source $[scene_file:$[DATABASE]/SCENES/%.1-0.dsc=$[DATABASE]/%.mf] -$[target] : $[source] -$[TAB]multify xf $[osfilename $[source]] -C $[DATABASE] -#end scene_file - -// Egg character model generation from Soft databases. -#forscopes soft_char_egg - #if $[POLY_MODEL] - #define target $[EGG_PREFIX]$[POLY_MODEL].egg - #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc - #define source $[DATABASE]/SCENES/$[scene] -$[target] : $[source] -$[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -p -M $[osfilename $[target]] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene] - #endif - #if $[NURBS_MODEL] - #define target $[EGG_PREFIX]$[NURBS_MODEL].egg - #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc - #define source $[DATABASE]/SCENES/$[scene] -$[target] : $[source] -$[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -n -M $[osfilename $[target]] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene] - #endif - -#end soft_char_egg - -// Egg animation generation from Soft database. -#forscopes soft_char_egg - #foreach anim $[ANIMS] - #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg - #define scene $[SCENE_PREFIX]$[anim].1-0.dsc - #define source $[DATABASE]/SCENES/$[scene] - #define begin 1 - #define end - #if $[$[anim]_frames] - #set begin $[word 1,$[$[anim]_frames]] - #set end $[word 2,$[$[anim]_frames]] - #endif -$[target] : $[source] -$[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -a -A $[osfilename $[target]] -N $[CHAR_NAME] -d $[DATABASE] -s $[scene] $[begin:%=-b%] $[end:%=-e%] - #end anim -#end soft_char_egg - -// Copying egg files from A to B. -#forscopes copy_egg - #for i 1,$[words $[SOURCES]] - #define source $[word $[i],$[SOURCES]] - #define target $[word $[i],$[TARGETS]] -$[target] : $[source] -$[TAB]copy $[osfilename $[source]] $[osfilename $[target]] - #end i -#end copy_egg - - -// Generic egg filters. -#forscopes filter_egg - #foreach egg $[SOURCES] - #define source $[source_prefix]$[egg] - #define target $[TARGET_DIR]/$[notdir $[egg]] -$[target] : $[source] $[pt] $[TARGET_DIR]/stamp -$[TAB]$[COMMAND] - #end egg -#end filter_egg - -// Generic character egg filter; applies an effect to all models and -// animations of a particular character. -#forscopes filter_char_egg - #define sources $[SOURCES:%=$[source_prefix]%] - #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]] - - // A bunch of rules to make each generated egg file depend on the - // first one. - #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]] -$[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp -$[TAB]touch $[osfilename $[TARGET_DIR]/$[egg]] - #end egg - - // And this is the actual optchar pass. -$[target] : $[sources] $[TARGET_DIR]/stamp -$[TAB]$[COMMAND] -#end filter_char_egg - - -// Character optimization. -#forscopes optchar_egg - #define sources $[SOURCES:%=$[source_prefix]%] - #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]] - - // A bunch of rules to make each generated egg file depend on the - // first one. - #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]] -$[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp -$[TAB]touch $[osfilename $[TARGET_DIR]/$[egg]] - #end egg - - // And this is the actual optchar pass. -$[target] : $[sources] $[TARGET_DIR]/stamp -$[TAB]egg-optchar $[OPTCHAR_OPTS] -d $[osfilename $[TARGET_DIR]] $[osfilename $[sources]] -#end optchar_egg - - -// Palettization rules. -#forscopes install_egg - #foreach egg $[SOURCES] - #define pt $[egg:%.egg=$[source_prefix]%.pt] - #define source $[source_prefix]$[egg] - #define target $[pal_egg_dir]/$[notdir $[egg]] -$[target] : $[source] $[pt] $[pal_egg_dir]/stamp - #if $[PHASE] -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dr $[osfilename $[install_dir]] -dm $[osfilename $[install_dir]/%g] -ds $[osfilename $[install_dir]/textures/shadow_pal] -g phase_$[PHASE] -gdir phase_$[PHASE] -o $[osfilename $[target]] $[osfilename $[source]] - #else -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dr $[osfilename $[install_dir]] -dm $[osfilename $[install_dir]/%g] -ds $[osfilename $[install_dir]/textures/shadow_pal] -o $[osfilename $[target]] $[osfilename $[source]] - #endif - -$[pt] : -$[TAB]@echo. > $[osfilename $[pt]] - - #end egg -#end install_egg - - -// Bam file creation. -#forscopes install_egg - #foreach egg $[SOURCES] - #define source $[pal_egg_dir]/$[notdir $[egg]] - #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]] -$[target] : $[source] $[bam_dir]/stamp -$[TAB]egg2bam -pp $[osfilename $[install_dir]] -ps rel -pd $[osfilename $[install_dir]] $[EGG2BAM_OPTS] -o $[osfilename $[target]] $[osfilename $[source]] - #end egg - - #foreach egg $[UNPAL_SOURCES] - #define source $[source_prefix]$[egg] - #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]] -$[target] : $[source] $[bam_dir]/stamp -$[TAB]egg2bam $[EGG2BAM_OPTS] -o $[osfilename $[target]] $[osfilename $[source]] - #end egg - - #foreach egg $[UNPAL_SOURCES_NC] - #define source $[source_prefix]$[egg] - #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]] -$[target] : $[source] $[bam_dir]/stamp -$[TAB]egg2bam $[EGG2BAM_OPTS] -NC -o $[osfilename $[target]] $[osfilename $[source]] - #end egg -#end install_egg - - -// Bam file installation. -#forscopes install_egg - #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]] - #foreach egg $[filter-out $[language_egg_filters],$[egglist]] - #define local $[egg:%.egg=%.bam] - #define sourcedir $[bam_dir] - #define dest $[install_model_dir] -$[dest]/$[local] : $[sourcedir]/$[local] -// cd ./$[sourcedir] && $[INSTALL] -$[TAB]copy /y $[osfilename $[sourcedir]/$[local]] $[osfilename $[dest]] - - #end egg - #if $[LANGUAGES] - // Now look for the eggs of the current language. - #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]] - #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg] - #if $[filter $[wantegg],$[egglist]] - // The current language file exists. - #define local $[wantegg:%.egg=%.bam] - #else - //#print Warning: $[wantegg] not listed, using $[egg] - #define local $[egg:%.egg=%.bam] - #endif - #define remote $[egg:%_$[DEFAULT_LANGUAGE].egg=%.bam] - #define sourcedir $[bam_dir] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[sourcedir]/$[local] -// cd ./$[sourcedir] && $[INSTALL] -$[TAB]copy /y $[osfilename $[sourcedir]/$[local]] $[osfilename $[dest]/$[remote]] - - #end egg - #endif -#end install_egg - -// Bam file uninstallation. -uninstall-bam : -#forscopes install_egg - #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]] - #define generic_egglist $[filter-out $[language_egg_filters],$[egglist]] - #if $[LANGUAGES] - #define language_egglist $[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[egglist]] - #endif - #define files $[patsubst %.egg,$[install_model_dir]/%.bam,$[generic_egglist] $[language_egglist]] - #if $[files] -$[TAB]del /f/q $[osfilename $[files]] - #endif -#end install_egg - - -// DNA file installation. -#forscopes install_dna - #foreach file $[filter-out $[language_dna_filters],$[SOURCES]] - #define local $[file] - #define remote $[notdir $[file]] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[local] -// $[INSTALL] -$[TAB]copy /y $[osfilename $[local]] $[osfilename $[dest]] - - #end file - #if $[LANGUAGES] - // Now files of the current langauge. - #foreach file $[filter %_$[DEFAULT_LANGUAGE].dna,$[SOURCES]] - #define wantfile $[file:%_$[DEFAULT_LANGUAGE].dna=%_$[LANGUAGE].dna] - #if $[filter $[wantfile],$[SOURCES]] - // The current language file exists. - #define local $[wantfile] - #else - //#print Warning: $[wantfile] not listed, using $[file] - #define local $[file] - #endif - #define remote $[notdir $[file:%_$[DEFAULT_LANGUAGE].dna=%.dna]] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[local] -// cd ./$[sourcedir] && $[INSTALL] -$[TAB]copy /y $[osfilename $[local]] $[osfilename $[dest]/$[remote]] - - #end file - #endif -#end install_dna - -// DNA file uninstallation. -uninstall-other: -#forscopes install_dna - #define sources $[notdir $[SOURCES]] - #define generic_sources $[filter-out $[language_dna_filters],$[sources]] - #if $[LANGUAGES] - #define language_sources $[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[sources]] - #endif - #define files $[patsubst %,$[install_model_dir]/%,$[generic_sources] $[language_sources]] - #if $[files] -$[TAB]del /f/q $[osfilename $[files]] - #endif -#end install_dna - - - -// Miscellaneous file installation. -#forscopes install_audio install_icons install_shader install_misc - #foreach file $[SOURCES] - #define local $[file] - #define remote $[notdir $[file]] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[local] -// $[INSTALL] -$[TAB]copy /y $[osfilename $[local]] $[osfilename $[dest]] - - #end file -#end install_audio install_icons install_shader install_misc - -// Miscellaneous file uninstallation. -uninstall-other: -#forscopes install_audio install_icons install_shader install_misc - #define files $[patsubst %,$[install_model_dir]/%,$[SOURCES]] - #if $[files] -$[TAB]del /f/q $[osfilename $[files]] - #endif -#end install_audio install_icons install_shader install_misc - - -#end Makefile - - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], models_group] -////////////////////////////////////////////////////////////////////// - -// This is a group directory: a directory above a collection of source -// directories, e.g. $DTOOL/src. We don't need to output anything in -// this directory. - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], models_toplevel] -////////////////////////////////////////////////////////////////////// - -// This is the toplevel directory for a models tree, e.g. $TTMODELS. -// Here we build the root makefile. - -#map subdirs -// Iterate through all of our known source files. Each models type -// file gets its corresponding Makefile listed here. -#forscopes */ -#if $[eq $[DIR_TYPE], models] -#if $[build_directory] - #addmap subdirs $[DIRNAME] -#endif -#endif -#end */ - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -all : egg pal repal $[subdirs] - -install : all $[subdirs:%=install-%] - -#define sub_targets egg flt lwo maya soft bam pal clean-bam clean-pal clean-flt clean-lwo clean-maya clean-soft clean cleanall unpack-soft install-bam install-other uninstall-bam uninstall-other uninstall - -// Define the rules to propogate these targets to the Makefile within -// each directory. -#foreach target $[sub_targets] -$[target] : $[subdirs:%=$[target]-%] -#end target - - -# -# opt-pal : reorder and resize the palettes to be as optimal as -# possible. This forces a rebuild of all the egg files. -# -opt-pal : pal do-opt-pal install -optimize-palettes : opt-pal - -do-opt-pal : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dm $[osfilename $[install_dir]/%g] -opt -egg - -# -# repal : reexamine the textures.txa file and do whatever needs to be -# done to bring everything up to sync with it. Also make sure all egg -# files are up-to-date. -# -repal : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dm $[osfilename $[install_dir]/%g] -all -egg - -re-pal : repal - -# -# fix-pal : something has gone wrong with the palettes; rebuild all -# palette images to fix it. -# -fix-pal : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dm $[osfilename $[install_dir]/%g] -redo -all -egg - -# -# undo-pal : blow away all the palettization information and start fresh. -# -undo-pal : clean-pal -$[TAB]del /f/q $[osfilename $[texattrib_file:%.txa=%.boo]] - -# -# pi : report the palettization information to standard output for the -# user's perusal. -# -pi : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dm $[osfilename $[install_dir]/%g] -pi - -.PHONY: pi.txt -pi.txt : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dm $[osfilename $[install_dir]/%g] -pi >pi.txt - -# -# pal-stats : report palettization statistics to standard output for the -# user's perusal. -# -pal-stats : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[osfilename $[texattrib_file]] -dm $[osfilename $[install_dir]/%g] -s -stats-pal : pal-stats - -// Somehow, something in the cttools confuses some shells, so that -// when we are attached, 'cd foo' doesn't work, but 'cd ./foo' does. -// Weird. We get around this by putting a ./ in front of each cd -// target below. - -#formap dirname subdirs -$[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]] -$[TAB]cd $[osfilename ./$[RELDIR]] && $(MAKE) all -#end dirname - -// Define the rules to propogate these targets to the Makefile within -// each directory. -#foreach target install $[sub_targets] - #formap dirname subdirs -$[target]-$[dirname] : -$[TAB]cd $[osfilename ./$[RELDIR]] && $(MAKE) $[target] - - #end dirname -#end target - -#end Makefile - - - -////////////////////////////////////////////////////////////////////// -#endif // DIR_TYPE diff --git a/dtool/pptempl/Template.models.pp b/dtool/pptempl/Template.models.pp deleted file mode 100644 index 0ec6fa6b3b..0000000000 --- a/dtool/pptempl/Template.models.pp +++ /dev/null @@ -1,927 +0,0 @@ -// -// Template.models.pp -// -// This file defines the Makefiles that will be built to generate -// models (egg, bam models computed from flt, soft, alias, -// etc. sources). Unlike the other Template files, this is not based -// directly on the BUILD_TYPE, but is specifically included when a -// directory specifies a DIR_TYPE of "models". It uses some -// Unix-specific conventions (like forward slashes as a directory -// separator), so it requires either a Unix platform or a Cygwin -// environment. -// - -#if $[< $[PPREMAKE_VERSION],0.57] - #error You need at least ppremake version 0.58 to build models. -#endif - -// Search for the texattrib dir definition. This will be in the -// models_topdir directory. -#define texattrib_dir $[dir_type $[TEXATTRIB_DIR],models_toplevel] - -// Prefix $[TOPDIR]. If it wasn't defined, make a default. -#if $[texattrib_dir] - #define texattrib_dir $[TOPDIR]/$[texattrib_dir] -#else - #define texattrib_dir $[TOPDIR]/src/maps -#endif - -#define texattrib_file $[texattrib_dir]/textures.txa - -#if $[eq $[BUILD_TYPE], nmake] - #define TOUCH_CMD echo. - #define COPY_CMD xcopy /I/Y - #define DEL_CMD del /f/s/q -#else - #define TOUCH_CMD touch - #define COPY_CMD cp - #define DEL_CMD rm -rf -#endif - -////////////////////////////////////////////////////////////////////// -#if $[eq $[DIR_TYPE], models] -////////////////////////////////////////////////////////////////////// - -#define pal_egg_dir pal_egg -#define bam_dir bams -#defer phase_prefix $[if $[PHASE],phase_$[PHASE]/] - -#defer install_model_dir $[install_dir]/$[phase_prefix]$[INSTALL_TO] -#define filter_dirs $[sort $[TARGET_DIR(filter_egg filter_char_egg optchar_egg)]] - -#defer source_prefix $[SOURCE_DIR:%=%/] - -#if $[LANGUAGES] - #define exlanguage_sources $[notdir $[filter %.flt %.mb %.ma %.lwo %.LWO %.egg %.dna,$[wildcard $[TOPDIR]/$[DIRPREFIX]*_$[LANGUAGE].*]]] - - #defun lang_add_files sources, src_ext, local_extra - #define default_filter - #define local_filter - #foreach ext $[src_ext] - #set default_filter $[default_filter] %_$[DEFAULT_LANGUAGE].$[ext] - #set local_filter $[local_filter] %_$[LANGUAGE].$[ext] - #end ext - #define default_langlist $[filter $[default_filter],$[sources]] - #define locallist $[filter $[local_filter],$[local_extra] $[exlanguage_sources]] - #define havelist - #foreach file $[default_langlist] - #foreach ext $[src_ext] - #define wantfile $[file:%_$[DEFAULT_LANGUAGE].$[ext]=%_$[LANGUAGE].$[ext]] - #set havelist $[havelist] $[filter $[wantfile],$[locallist]] - #end ext - #end file - $[havelist] - #end lang_add_files - - #forscopes flt_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], flt, ]] - #endif - #end flt_egg - - #forscopes lwo_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], lwo LWO, ]] - #endif - #end lwo_egg - - #forscopes maya_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], lwo LWO, ]] - #endif - #end maya_egg -#endif - -#define build_flt_eggs \ - $[forscopes flt_egg,$[patsubst %.flt,%$[EGG_SUFFIX].egg,$[SOURCES]]] - -#define build_lwo_eggs \ - $[forscopes lwo_egg,$[patsubst %.lwo %.LWO,%$[EGG_SUFFIX].egg,$[SOURCES]]] - -#define build_maya_eggs \ - $[forscopes maya_egg,$[patsubst %$[MODEL].ma %$[MODEL].mb ,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[SOURCES]]] \ - $[forscopes maya_char_egg,$[POLY_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg] $[NURBS_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg]] \ - $[forscopes maya_char_egg,$[ANIMS:%=$[EGG_PREFIX]%$[CHAN_SUFFIX].egg]] - -#define build_soft_eggs \ - $[forscopes soft_char_egg,$[POLY_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg] $[NURBS_MODEL:%=$[EGG_PREFIX]%$[EGG_SUFFIX].egg]] \ - $[forscopes soft_char_egg,$[ANIMS:%=$[EGG_PREFIX]%$[CHAN_SUFFIX].egg]] - -#define build_eggs \ - $[sort \ - $[build_flt_eggs] \ - $[build_lwo_eggs] \ - $[build_maya_eggs] \ - $[build_soft_eggs]] - -#define optchar_dirs \ - $[unique $[forscopes optchar_egg,$[TARGET_DIR]]] - -#if $[LANGUAGES] - #forscopes install_egg filter_egg - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], egg, $[build_eggs]]] - #endif - #end install_egg filter_egg - - #forscopes install_dna - #if $[SOURCES] - #set SOURCES $[sort $[SOURCES] $[lang_add_files $[SOURCES], dna, ]] - #endif - #end install_dna -#endif - -// Get the list of egg files that are to be installed -#define install_pal_eggs -#define install_unpal_eggs -#forscopes install_egg - #define egglist $[notdir $[SOURCES]] - #set install_pal_eggs $[install_pal_eggs] $[filter-out $[language_egg_filters],$[egglist]] - #if $[LANGUAGES] - // Now look for the eggs of the current language. - #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]] - #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg] - #if $[filter $[wantegg],$[egglist]] - // The current language file exists. - #set install_pal_eggs $[install_pal_eggs] $[wantegg] - #else - #set install_pal_eggs $[install_pal_eggs] $[egg] - #endif - #end egg - #endif - #define egglist $[notdir $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]] - #set install_unpal_eggs $[install_unpal_eggs] $[filter-out $[language_egg_filters],$[egglist]] - #if $[LANGUAGES] - // Now look for the eggs of the current language. - #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]] - #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg] - #if $[filter $[wantegg],$[egglist]] - // The current language file exists. - #set install_unpal_eggs $[install_unpal_eggs] $[wantegg] - #else - #set install_unpal_eggs $[install_unpal_eggs] $[egg] - #endif - #end egg - #endif -#end install_egg -#define install_eggs $[install_pal_eggs] $[install_unpal_eggs] - - -// Get the list of bam files in the install directories -#define install_egg_dirs $[sort $[forscopes install_egg,$[install_model_dir]]] - -#define installed_generic_eggs $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.egg,$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]] -#define installed_generic_bams $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.bam,$[filter-out $[language_egg_filters],$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]]] -#if $[LANGUAGES] - #define installed_language_bams $[sort $[forscopes install_egg,$[patsubst %.egg,$[install_model_dir]/%.bam,$[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]]]]]] -#endif - -// And the list of dna files in the install directories. -#define install_dna_dirs $[sort $[forscopes install_dna,$[install_model_dir]]] -#define installed_generic_dna $[sort $[forscopes install_dna,$[patsubst %,$[install_model_dir]/%,$[filter-out $[language_dna_filters],$[notdir $[SOURCES]]]]]] -#if $[LANGUAGES] - #define installed_language_dna $[sort $[forscopes install_dna,$[patsubst %,$[install_model_dir]/%,$[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[notdir $[SOURCES]]]]]] -#endif - -#define install_other_dirs $[sort $[forscopes install_audio install_icons install_shader install_misc,$[install_model_dir]]] -#define installed_other $[sort $[forscopes install_audio install_icons install_shader install_misc,$[SOURCES:%=$[install_model_dir]/%]]] - - -#define pal_egg_targets $[sort $[patsubst %,$[pal_egg_dir]/%,$[notdir $[install_pal_eggs]]]] -#define bam_targets $[install_eggs:%.egg=$[bam_dir]/%.bam] - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -#define all_targets \ - Makefile \ - $[texattrib_dir] \ - $[filter_dirs] \ - $[optchar_dirs] \ - egg bam -all : $[all_targets] - -egg : $[build_eggs] - -flt : $[build_flt_eggs] -lwo : $[build_lwo_eggs] -maya : $[build_maya_eggs] -soft : $[build_soft_eggs] - -pal : $[if $[pal_egg_targets],$[pal_egg_dir]] $[pal_egg_targets] - -bam : pal $[if $[bam_targets],$[bam_dir]] $[bam_targets] - -#map soft_scenes soft_scene_files(soft_char_egg) - -unpack-soft : $[soft_scenes] - -#define install_bam_targets \ - $[install_egg_dirs] \ - $[if $[INSTALL_EGG_FILES],$[installed_generic_eggs],$[installed_generic_bams] $[installed_language_bams]] -install-bam : $[install_bam_targets] - -#define install_other_targets \ - $[install_dna_dirs] \ - $[installed_generic_dna] $[installed_language_dna] \ - $[install_other_dirs] \ - $[installed_other] -install-other : $[install_other_targets] - -install : all install-other install-bam -uninstall : uninstall-other uninstall-bam - -clean-bam : -#if $[bam_targets] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[bam_dir]] - #else -$[TAB]$[DEL_CMD] $[bam_dir] - #endif -#endif - -clean-pal : clean-bam -#if $[pal_egg_targets] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[pal_egg_dir]] - #else -$[TAB]rm -rf $[pal_egg_dir] - #endif -#endif - -clean-flt : -#if $[build_flt_eggs] -$[TAB]$[DEL_CMD] $[build_flt_eggs] -#endif - -clean-lwo : -#if $[build_lwo_eggs] -$[TAB]$[DEL_CMD] $[build_lwo_eggs] -#endif - -clean-maya : -#if $[build_maya_eggs] -$[TAB]$[DEL_CMD] $[build_maya_eggs] -#endif - -clean-soft : -#if $[build_soft_eggs] -$[TAB]$[DEL_CMD] $[build_soft_eggs] -#endif - -clean-optchar : -#if $[optchar_dirs] -$[TAB]rm -rf $[optchar_dirs] -#endif - -clean : clean-pal -#if $[build_eggs] -$[TAB]$[DEL_CMD] $[build_eggs] *.pt -#endif -#if $[filter_dirs] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[filter_dirs]] - #else -$[TAB]rm -rf $[filter_dirs] - #endif -#endif - -// We need a rule for each directory we might need to make. This -// loops through the full set of directories and creates a rule to -// make each one, as needed. -#foreach directory $[sort \ - $[filter_dirs] \ - $[if $[pal_egg_targets],$[pal_egg_dir]] \ - $[if $[bam_targets],$[bam_dir]] \ - $[TARGET_DIR(filter_char_egg)] \ - $[texattrib_dir] \ - $[install_egg_dirs] \ - $[install_dna_dirs] \ - $[install_other_dirs] \ - ] -$[directory] : -#if $[eq $[BUILD_TYPE], nmake] -$[TAB] if not exist $[osfilename $[directory]] mkdir $[osfilename $[directory]] -#else -$[TAB]@test -d $[directory] || echo mkdir -p $[directory] -$[TAB]@test -d $[directory] || mkdir -p $[directory] -#endif - -// Sometimes we need a target to depend on the directory existing, without -// being fooled by the directory's modification times. We use this -// phony timestamp file to achieve that. -$[directory]/stamp : -#if $[eq $[BUILD_TYPE], nmake] -$[TAB] if not exist $[osfilename $[directory]] mkdir $[osfilename $[directory]] -$[TAB]$[TOUCH_CMD] $[osfilename $[directory]/stamp] -#else -$[TAB]@test -d $[directory] || echo mkdir -p $[directory] -$[TAB]@test -d $[directory] || mkdir -p $[directory] -$[TAB]$[TOUCH_CMD] $[directory]/stamp -#endif - -#end directory - -// Decompressing compressed files. -#forscopes gz - #foreach gz $[SOURCES] - #define target $[gz:%.gz=%] - #define source $[gz] -$[target] : $[source] -$[TAB]$[DEL_CMD] $[osfilename $[target]] -$[TAB]gunzip $[GUNZIP_OPTS] < $[source] > $[target] - - #end gz -#end gz - -// Egg file generation from Flt files. -#forscopes flt_egg - #foreach flt $[SOURCES] - #define target $[or $[TARGET],$[patsubst %.flt %.FLT,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[flt]]] - #define source $[flt] -$[target] : $[source] -$[TAB]flt2egg $[FLT2EGG_OPTS] -o $[target] $[source] - - #end flt -#end flt_egg - -// Egg file generation from Lightwave files. -#forscopes lwo_egg - #foreach lwo $[SOURCES] - #define target $[or $[TARGET],$[patsubst %.lwo %.LWO,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[lwo]]] - #define source $[lwo] -$[target] : $[source] -$[TAB]lwo2egg $[LWO2EGG_OPTS] -o $[target] $[source] - - #end lwo -#end lwo_egg - -// Egg file generation from Maya files (for unanimated models). -#forscopes maya_egg - #foreach maya $[SOURCES] - #define target $[or $[TARGET],$[patsubst %$[MODEL].ma %$[MODEL].mb,$[EGG_PREFIX]%$[EGG_SUFFIX].egg,$[maya]]] - #define source $[maya] -$[target] : $[source] -$[TAB]$[MAYA2EGG] $[MAYA2EGG_OPTS] -o $[target] $[source] - - #end maya -#end maya_egg - -// Egg character model generation from Maya files. -#forscopes maya_char_egg - #if $[POLY_MODEL] - #define target $[EGG_PREFIX]$[POLY_MODEL].egg - #define source $[MAYA_PREFIX]$[or $[MODEL],$[POLY_MODEL]]$[MAYA_EXTENSION] -$[target] : $[source] -$[TAB]$[MAYA2EGG] $[MAYA2EGG_OPTS] -p -a model -cn "$[CHAR_NAME]" -o $[target] $[source] - #elif $[NURBS_MODEL] - #define target $[EGG_PREFIX]$[NURBS_MODEL].egg - #define source $[MAYA_PREFIX]$[or $[MODEL],$[NURBS_MODEL]]$[MAYA_EXTENSION] -$[target] : $[source] -$[TAB]$[MAYA2EGG] $[MAYA2EGG_OPTS] -a model -cn "$[CHAR_NAME]" -o $[target] $[source] - #elif $[not $[or $[MODEL], $[POLY_MODEL], $[ANIMS]]] - #define target $[EGG_PREFIX].egg - #define source $[MAYA_PREFIX]$[MAYA_EXTENSION] -$[target] : $[source] -$[TAB]$[MAYA2EGG] $[MAYA2EGG_OPTS] -p -a model -cn "$[CHAR_NAME]" -o $[target] $[source] - #endif - -#end maya_char_egg - -// Egg animation generation from Maya files. -#forscopes maya_char_egg - #foreach anim $[ANIMS] - #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg - #define source $[MAYA_PREFIX]$[anim]$[MAYA_EXTENSION] - #define begin 0 - #define end - #if $[$[CHAR_NAME]_$[anim]_frames] - #set begin $[word 1,$[$[CHAR_NAME]_$[anim]_frames]] - #set end $[word 2,$[$[CHAR_NAME]_$[anim]_frames]] - #elif $[$[anim]_frames] - #set begin $[word 1,$[$[anim]_frames]] - #set end $[word 2,$[$[anim]_frames]] - #endif -$[target] : $[source] -$[TAB]$[MAYA2EGG] $[MAYA2EGG_OPTS] -a chan -cn "$[CHAR_NAME]" -o $[target] -sf $[begin] $[if $[end],-ef $[end]] $[source] - #end anim -#end maya_char_egg - -// Unpack the Soft scene database from its multifile. -#formap scene_file soft_scenes - #define target $[scene_file] - #define source $[scene_file:$[DATABASE]/SCENES/%.1-0.dsc=$[DATABASE]/%.mf] -$[target] : $[source] -$[TAB]multify xf $[source] -C $[DATABASE] -#end scene_file - -// Egg character model generation from Soft databases. -#forscopes soft_char_egg - #if $[POLY_MODEL] - #define target $[EGG_PREFIX]$[POLY_MODEL].egg - #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc - #define source $[DATABASE]/SCENES/$[scene] -$[target] : $[source] -$[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -p -M $[target] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene] - #endif - #if $[NURBS_MODEL] - #define target $[EGG_PREFIX]$[NURBS_MODEL].egg - #define scene $[SCENE_PREFIX]$[MODEL].1-0.dsc - #define source $[DATABASE]/SCENES/$[scene] -$[target] : $[source] -$[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -n -M $[target] -N $[CHAR_NAME] -d $[DATABASE] -t $[DATABASE]/PICTURES -s $[scene] - #endif - -#end soft_char_egg - -// Egg animation generation from Soft database. -#forscopes soft_char_egg - #foreach anim $[ANIMS] - #define target $[EGG_PREFIX]$[anim]$[CHAN_SUFFIX].egg - #define scene $[SCENE_PREFIX]$[anim].1-0.dsc - #define source $[DATABASE]/SCENES/$[scene] - #define begin 1 - #define end - #if $[$[anim]_frames] - #set begin $[word 1,$[$[anim]_frames]] - #set end $[word 2,$[$[anim]_frames]] - #endif -$[target] : $[source] -$[TAB]$[SOFT2EGG] $[SOFT2EGG_OPTS] $[if $[SOFTIMAGE_RSRC],-r "$[osfilename $[SOFTIMAGE_RSRC]]"] -a -A $[target] -N $[CHAR_NAME] -d $[DATABASE] -s $[scene] $[begin:%=-b%] $[end:%=-e%] - #end anim -#end soft_char_egg - -// Copying egg files from A to B. -#forscopes copy_egg - #for i 1,$[words $[SOURCES]] - #define source $[word $[i],$[SOURCES]] - #define target $[word $[i],$[TARGETS]] -$[target] : $[source] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[COPY_CMD] $[osfilename $[source]] $[osfilename $[target]] - #else -$[TAB]$[COPY_CMD] $[source] $[target] - #endif - #end i -#end copy_egg - - -// Generic egg filters. -#forscopes filter_egg - #foreach egg $[SOURCES] - #define source $[source_prefix]$[egg] - #define target $[TARGET_DIR]/$[notdir $[egg]] -$[target] : $[source] $[pt] $[TARGET_DIR]/stamp -$[TAB]$[COMMAND] - #end egg -#end filter_egg - -// Generic character egg filter; applies an effect to all models and -// animations of a particular character. -#forscopes filter_char_egg - #define sources $[SOURCES:%=$[source_prefix]%] - #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]] - - // A bunch of rules to make each generated egg file depend on the - // first one. - #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]] -$[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[TOUCH_CMD] $[osfilename $[TARGET_DIR]/$[egg]] - #else -$[TAB]$[TOUCH_CMD] $[TARGET_DIR]/$[egg] - #endif - #end egg - - // And this is the actual optchar pass. -$[target] : $[sources] $[TARGET_DIR]/stamp -$[TAB]$[COMMAND] -#end filter_char_egg - - -// Character optimization. -#forscopes optchar_egg -#if $[LIMIT_OPTCHAR] - // With LIMIT_OPTCHAR enabled, we only want to make local optchar - // operations, allowing one operation at a time. - #foreach egg $[SOURCES] - #define source $[source_prefix]$[egg] - #define target $[TARGET_DIR]/$[notdir $[egg]] -$[target] : $[source] $[TARGET_DIR]/stamp -$[TAB]egg-optchar -keepall $[OPTCHAR_OPTS] -d $[TARGET_DIR] $[source] - #end egg - -#else - // In the normal mode, we allow global optchar operations, requiring - // all egg files to be processed in a single pass. - #define sources $[SOURCES:%=$[source_prefix]%] - #define target $[TARGET_DIR]/$[notdir $[firstword $[SOURCES]]] - - // A bunch of rules to make each generated egg file depend on the - // first one. - #foreach egg $[notdir $[wordlist 2,9999,$[SOURCES]]] -$[TARGET_DIR]/$[egg] : $[target] $[TARGET_DIR]/stamp - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[TOUCH_CMD] $[osfilename $[TARGET_DIR]/$[egg]] - #else -$[TAB]$[TOUCH_CMD] $[TARGET_DIR]/$[egg] - #endif - #end egg - - // And this is the actual optchar pass. -$[target] : $[sources] $[TARGET_DIR]/stamp - -//////////////////////////////// -//$[TAB]egg-optchar $[OPTCHAR_OPTS] -d $[TARGET_DIR] $[sources] - -///// Handles very long lists of egg files by echoing them ////// -///// out to a file then having egg-optchar read in the ////// -///// list from that file. Comment out four lines below ////// -///// and uncomment line above to revert to the old way. ////// - -#define sources_file eoc.tmp -$[TAB]echo -n $[sources] > $[sources_file] -$[TAB]egg-optchar $[OPTCHAR_OPTS] -d $[TARGET_DIR] -inf $[sources_file] -$[TAB]$[DEL_CMD] eoc.tmp -//////////////////////////////// -#endif - -#end optchar_egg - - -// Palettization rules. -#forscopes install_egg - #foreach egg $[SOURCES] - #define pt $[egg:%.egg=$[source_prefix]%.pt] - #define source $[source_prefix]$[egg] - #define target $[pal_egg_dir]/$[notdir $[egg]] -$[target] : $[source] $[pt] $[pal_egg_dir]/stamp - #if $[PHASE] -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dr $[install_dir] -dm $[install_dir]/%g/maps -ds $[install_dir]/shadow_pal -g phase_$[PHASE] -gdir phase_$[PHASE] -o $[target] $[source] - #else -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dr $[install_dir] -dm $[install_dir]/%g/maps -ds $[install_dir]/shadow_pal -o $[target] $[source] - #endif - -$[pt] : -$[TAB]$[TOUCH_CMD] $[pt] - - #end egg -#end install_egg - - -// Bam file creation. -#forscopes install_egg - #foreach egg $[SOURCES] - #define source $[pal_egg_dir]/$[notdir $[egg]] - #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]] -$[target] : $[source] $[bam_dir]/stamp -$[TAB]egg2bam -pp $[install_dir] -ps rel -pd $[install_dir] $[EGG2BAM_OPTS] -o $[target] $[source] - #end egg - - #foreach egg $[UNPAL_SOURCES] - #define source $[source_prefix]$[egg] - #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]] -$[target] : $[source] $[bam_dir]/stamp -$[TAB]egg2bam $[EGG2BAM_OPTS] -o $[target] $[source] - #end egg - - #foreach egg $[UNPAL_SOURCES_NC] - #define source $[source_prefix]$[egg] - #define target $[bam_dir]/$[notdir $[egg:%.egg=%.bam]] -$[target] : $[source] $[bam_dir]/stamp -$[TAB]egg2bam $[EGG2BAM_OPTS] -NC -o $[target] $[source] - #end egg -#end install_egg - - -// Egg file installation (used only if INSTALL_EGG_FILES is true). -#forscopes install_egg - #foreach egg $[SOURCES] - #define basename $[notdir $[egg]] - #define source $[pal_egg_dir]/$[basename] - #define dest $[install_model_dir] - -$[dest]/$[basename] : $[source] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[basename]] -$[TAB]$[COPY_CMD] $[osfilename $[source] $[osfilename $[dest]/$[basename]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[basename] -$[TAB]$[COPY_CMD] $[source] $[dest]/$[basename] - #endif - - #end egg - #foreach egg $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC] - #define basename $[notdir $[egg]] - #define source $[source_prefix]$[basename] - #define dest $[install_model_dir] - -$[dest]/$[basename] : $[source] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[basename]] -$[TAB]$[COPY_CMD] $[osfilename $[source] $[osfilename $[dest]/$[basename]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[basename] -$[TAB]$[COPY_CMD] $[source] $[dest]/$[basename] - #endif - - #end egg -#end install_egg - -// Bam file installation. -#forscopes install_egg - #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]] - #foreach egg $[filter-out $[language_egg_filters],$[egglist]] - #define local $[egg:%.egg=%.bam] - #define sourcedir $[bam_dir] - #define dest $[install_model_dir] -$[dest]/$[local] : $[sourcedir]/$[local] -// cd ./$[sourcedir] && $[INSTALL] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[local]] -$[TAB]$[COPY_CMD] $[osfilename $[sourcedir]/$[local]] $[osfilename $[dest]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[local] -$[TAB]$[COPY_CMD] $[sourcedir]/$[local] $[dest] - #endif - - #end egg - #if $[LANGUAGES] - // Now look for the eggs of the current language. - #foreach egg $[filter %_$[DEFAULT_LANGUAGE].egg,$[egglist]] - #define wantegg $[egg:%_$[DEFAULT_LANGUAGE].egg=%_$[LANGUAGE].egg] - #if $[filter $[wantegg],$[egglist]] - // The current language file exists. - #define local $[wantegg:%.egg=%.bam] - #else - //#print Warning: $[wantegg] not listed, using $[egg] - #define local $[egg:%.egg=%.bam] - #endif - #define remote $[egg:%_$[DEFAULT_LANGUAGE].egg=%.bam] - #define sourcedir $[bam_dir] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[sourcedir]/$[local] -// cd ./$[sourcedir] && $[INSTALL] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[remote]] -$[TAB]$[COPY_CMD] $[osfilename $[sourcedir]/$[local]] $[osfilename $[dest]/$[remote]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[remote] -$[TAB]$[COPY_CMD] $[sourcedir]/$[local] $[dest]/$[remote] - #endif - - #end egg - #endif -#end install_egg - -// Bam file uninstallation. -uninstall-bam : -#forscopes install_egg - #define egglist $[notdir $[SOURCES] $[UNPAL_SOURCES] $[UNPAL_SOURCES_NC]] - #define generic_egglist $[filter-out $[language_egg_filters],$[egglist]] - #if $[LANGUAGES] - #define language_egglist $[patsubst %_$[DEFAULT_LANGUAGE].egg,%.egg,%,,$[egglist]] - #endif - #define files $[patsubst %.egg,$[install_model_dir]/%.bam,$[generic_egglist] $[language_egglist]] - #if $[files] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[files]] - #else -$[TAB]$[DEL_CMD] $[files] - #endif - #endif -#end install_egg - - -// DNA file installation. -#forscopes install_dna - #foreach file $[filter-out $[language_dna_filters],$[SOURCES]] - #define local $[file] - #define remote $[notdir $[file]] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[local] -// $[INSTALL] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[remote]] -$[TAB]$[COPY_CMD] $[osfilename $[local]] $[osfilename $[dest]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[remote] -$[TAB]$[COPY_CMD] $[local] $[dest] - #endif - - #end file - #if $[LANGUAGES] - // Now files of the current langauge. - #foreach file $[filter %_$[DEFAULT_LANGUAGE].dna,$[SOURCES]] - #define wantfile $[file:%_$[DEFAULT_LANGUAGE].dna=%_$[LANGUAGE].dna] - #if $[filter $[wantfile],$[SOURCES]] - // The current language file exists. - #define local $[wantfile] - #else - //#print Warning: $[wantfile] not listed, using $[file] - #define local $[file] - #endif - #define remote $[notdir $[file:%_$[DEFAULT_LANGUAGE].dna=%.dna]] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[local] -// cd ./$[sourcedir] && $[INSTALL] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[remote]] -$[TAB]$[COPY_CMD] $[osfilename $[local]] $[osfilename $[dest]/$[remote]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[remote] -$[TAB]$[COPY_CMD] $[local] $[dest]/$[remote] - #endif - - #end file - #endif -#end install_dna - -// DNA file uninstallation. -uninstall-other: -#forscopes install_dna - #define sources $[notdir $[SOURCES]] - #define generic_sources $[filter-out $[language_dna_filters],$[sources]] - #if $[LANGUAGES] - #define language_sources $[patsubst %_$[DEFAULT_LANGUAGE].dna,%.dna,%,,$[sources]] - #endif - #define files $[patsubst %,$[install_model_dir]/%,$[generic_sources] $[language_sources]] - #if $[files] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[files]] - #else -$[TAB]$[DEL_CMD] $[files] - #endif - #endif -#end install_dna - - - -// Miscellaneous file installation. -#forscopes install_audio install_icons install_shader install_misc - #foreach file $[SOURCES] - #define local $[file] - #define remote $[notdir $[file]] - #define dest $[install_model_dir] -$[dest]/$[remote] : $[local] -// $[INSTALL] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[dest]/$[remote]] -$[TAB]$[COPY_CMD] $[osfilename $[local]] $[osfilename $[dest]] - #else -$[TAB]$[DEL_CMD] $[dest]/$[remote] -$[TAB]$[COPY_CMD] $[local] $[dest] - #endif - - #end file -#end install_audio install_icons install_shader install_misc - -// Miscellaneous file uninstallation. -uninstall-other: -#forscopes install_audio install_icons install_shader install_misc - #define files $[patsubst %,$[install_model_dir]/%,$[SOURCES]] - #if $[files] - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[files]] - #else -$[TAB]$[DEL_CMD] $[files] - #endif - #endif -#end install_audio install_icons install_shader install_misc - - -#end Makefile - - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], models_group] -////////////////////////////////////////////////////////////////////// - -// This is a group directory: a directory above a collection of source -// directories, e.g. $DTOOL/src. We don't need to output anything in -// this directory. - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], models_toplevel] -////////////////////////////////////////////////////////////////////// - -// This is the toplevel directory for a models tree, e.g. $TTMODELS. -// Here we build the root makefile. - -#map subdirs -// Iterate through all of our known source files. Each models type -// file gets its corresponding Makefile listed here. -#forscopes */ -#if $[eq $[DIR_TYPE], models] -#if $[build_directory] - #addmap subdirs $[DIRNAME] -#endif -#endif -#end */ - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -all : egg pal repal $[subdirs] - -install : all $[subdirs:%=install-%] - -#define sub_targets egg flt lwo maya soft bam pal clean-bam clean-pal clean-flt clean-lwo clean-maya clean-soft clean-optchar clean cleanall unpack-soft install-bam install-other uninstall-bam uninstall-other uninstall - -// Define the rules to propogate these targets to the Makefile within -// each directory. -#foreach target $[sub_targets] -$[target] : $[subdirs:%=$[target]-%] -#end target - - -# -# opt-pal : reorder and resize the palettes to be as optimal as -# possible. This forces a rebuild of all the egg files. -# -opt-pal : pal do-opt-pal install -optimize-palettes : opt-pal - -do-opt-pal : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -opt -egg - -# -# repal : reexamine the textures.txa file and do whatever needs to be -# done to bring everything up to sync with it. Also make sure all egg -# files are up-to-date. -# -repal : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -all -egg - -re-pal : repal - -# -# fix-pal : something has gone wrong with the palettes; rebuild all -# palette images to fix it. -# -fix-pal : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -redo -all -egg - -# -# undo-pal : blow away all the palettization information and start fresh. -# -undo-pal : clean-pal - #if $[eq $[BUILD_TYPE], nmake] -$[TAB]$[DEL_CMD] $[osfilename $[texattrib_file:%.txa=%.boo]] - #else -$[TAB]$[DEL_CMD] $[texattrib_file:%.txa=%.boo] - #endif - -# -# pi : report the palettization information to standard output for the -# user's perusal. -# -pi : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -pi - -.PHONY: pi.txt -pi.txt : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -pi >pi.txt - -# -# pal-stats : report palettization statistics to standard output for the -# user's perusal. -# -pal-stats : -$[TAB]egg-palettize $[PALETTIZE_OPTS] -af $[texattrib_file] -dm $[install_dir]/%g/maps -s -stats-pal : pal-stats - -// Somehow, something in the cttools confuses some shells, so that -// when we are attached, 'cd foo' doesn't work, but 'cd ./foo' does. -// Weird. We get around this by putting a ./ in front of each cd -// target below. - -#formap dirname subdirs -$[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]] -$[TAB]cd ./$[RELDIR] && $(MAKE) all -#end dirname - -// Define the rules to propogate these targets to the Makefile within -// each directory. -#foreach target install $[sub_targets] - #formap dirname subdirs -$[target]-$[dirname] : -$[TAB]cd ./$[RELDIR] && $(MAKE) $[target] - - #end dirname -#end target - -#end Makefile - - - -////////////////////////////////////////////////////////////////////// -#endif // DIR_TYPE diff --git a/dtool/pptempl/Template.msvc.pp b/dtool/pptempl/Template.msvc.pp deleted file mode 100644 index 57f04117e0..0000000000 --- a/dtool/pptempl/Template.msvc.pp +++ /dev/null @@ -1,625 +0,0 @@ -// -// Template.msvc.pp -// -// This file defines the set of ouput files that will be generated to -// support a Microsoft Visual C++ .NET solution / project build. It rolls -// libraries into their metalibs, generates .dll files, compiles source -// files to .obj files, and does other Windows-specific things. - -// Before this file is processed, the following files are read and -// processed (in order): - -// The Package.pp file in the root of the current source hierarchy -// (e.g. $PANDA/Package.pp) -// $DTOOL/Package.pp -// $DTOOL/Config.pp -// $DTOOL/Config.Platform.pp -// The user's PPREMAKE_CONFIG file. -// $DTOOL/pptempl/System.pp -// All of the Sources.pp files in the current source hierarchy -// $DTOOL/pptempl/Global.pp -// $DTOOL/pptempl/Global.msvc.pp -// $DTOOL/pptempl/Depends.pp, once for each Sources.pp file -// Template.msvc.pp (this file), once for each Sources.pp file - - -#defun decygwin frompat,topat,path - #foreach file $[path] - #if $[isfullpath $[file]] - $[patsubstw $[frompat],$[topat],$[cygpath_w $[file]]] - #else - $[patsubstw $[frompat],$[topat],$[osfilename $[file]]] - #endif - #end file -#end decygwin - -// should overwrite read-only files -#define COPYCMD xcopy /Y /Q /R - -#if $[ne $[CTPROJS],] -#define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase -#define dtool_ver_dir $[decygwin %,%,$[dtool_ver_dir_cyg]] -#endif - -////////////////////////////////////////////////////////////////////// -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]] -////////////////////////////////////////////////////////////////////// -// For a source directory, build a single Makefile with rules to build -// each target. - -#if $[build_directory] - // This is the real set of lib_targets we'll be building. On Windows, - // we don't build the shared libraries which are included on metalibs. - #define real_lib_targets - #define deferred_objs - #forscopes lib_target - #if $[eq $[module $[TARGET],$[TARGET]],] - // This library is not on a metalib, so we can build it. - #set real_lib_targets $[real_lib_targets] $[active_target] - #else - // This library is on a metalib, so we can't build it, but we - // should build all the obj's that go into it. - #set deferred_objs $[deferred_objs] \ - $[patsubst %_src.cxx,,%.c %.cxx %.yxx %.lxx,$[so_dir]\%.obj,%,,$[get_sources] $[get_igateoutput]] - #endif - #end lib_target - - #defer lib_projects \ - $[active_target(metalib_target lib_target noinst_lib_target)] \ - $[real_lib_targets] - #defer static_lib_projects \ - $[active_target(static_lib_target ss_lib_target)] - #defer bin_projects \ - $[active_target(bin_target noinst_bin_target)] - #defer test_bin_projects \ - $[active_target(test_bin_target)] - - // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic libraries, - // $[static_lib_targets] the list of static libraries, and - // $[bin_targets] the list of binaries. $[test_bin_targets] is the - // list of binaries that are to be built only when specifically asked - // for. - #define lib_targets $[patsubst %,lib%$[dllext].$[dlllib],$[lib_projects]] - #define static_lib_targets $[static_lib_projects:%=lib%$[dllext].lib] - #define bin_targets $[bin_projects:%=%.exe] $[active_target(sed_bin_target)] - #define test_bin_targets $[test_bin_projects:%=%.exe] - - #define all_targets $[unique $[lib_targets] $[static_lib_targets] \ - $[bin_targets] $[test_bin_targets]] - - // $[so_sources] is the set of sources that belong on a shared object, - // and $[st_sources] is the set of sources that belong on a static - // object, like a static library or an executable. In Windows, we - // don't need to make this distinction, but we do anyway in case we - // might in the future for some nutty reason. - #defer so_sources $[get_sources(metalib_target lib_target noinst_lib_target)] - #defer st_sources $[get_sources(static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)] - - // These are the source files that our dependency cache file will - // depend on. If it's an empty list, we won't bother writing rules to - // freshen the cache file. - #define dep_sources $[sort $[filter %.c %.cxx %.yxx %.lxx %.h %.I %.I,$[so_sources] $[st_sources]]] - - #if $[eq $[so_dir],$[st_dir]] - // If the static and shared directories are the same, we have to use the - // same rules to build both shared and static targets. - #set st_sources $[so_sources] $[st_sources] - #set so_sources - #endif -#endif // $[build_directory] - -// And these are the various source files, extracted out by type. -#defer cxx_so_sources $[filter_out %_src.cxx,$[filter %.cxx,$[so_sources]]] -#defer cxx_st_sources $[filter_out %_src.cxx,$[filter %.cxx,$[st_sources]]] -#defer c_so_sources $[filter %.c,$[so_sources]] -#defer c_st_sources $[filter %.c,$[st_sources]] -#defer yxx_so_sources $[filter %.yxx,$[so_sources]] -#defer yxx_st_sources $[filter %.yxx,$[st_sources]] -#defer lxx_so_sources $[filter %.lxx,$[so_sources]] -#defer lxx_st_sources $[filter %.lxx,$[st_sources]] -#defer h_sources $[filter %.h,$[so_sources] $[st_sources]] -#defer i_sources $[filter %.I,$[so_sources] $[st_sources]] - -#if $[DO_PCH] -#define pch_header_source $[get_precompiled_header(metalib_target lib_target noinst_lib_target)] - -#define st_pch_files $[patsubst %.h,$[st_dir]\%.pch,$[pch_header_source]] -#define st_pch_obj_files $[patsubst %.h,$[st_dir]\%.obj,$[pch_header_source]] - -#endif - -// This map variable gets us all the various source files from all the -// targets in this directory. We need it to look up the context in -// which to build a particular source file, since some targets may -// have different requirements (e.g. different local_libs, or -// different USE_this or USE_that) than other targets. -#map all_sources get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target) - -// $[target_ipath] is the proper ipath to put on the command line, -// from the context of a particular target. -#defer target_ipath $[RELDIR] $[TOPDIR] $[sort $[complete_ipath]] $[other_trees:%=%\include] $[get_ipath] - -// $[converted_ipath] is the properly-formatted version of the include path -// for Visual Studio .NET. The resulting list is semicolon separated and uses -// Windows-style pathnames. -#defer converted_ipath $[join ;,$[osfilename $[target_ipath]]] - -// $[file_ipath] is the ipath from the context of a particular source -// file, given in $[file]. It uses the all_sources map to look up -// the target the source file belongs on, to get the proper context. -#defer file_ipath $[all_sources $[target_ipath],$[file]] - -// These are the complete set of extra flags the compiler requires, -// from the context of a particular file, given in $[file]. -#defer cflags $[all_sources $[get_cflags] $[CFLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] -#defer c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] - -// These are the same flags, sans the compiler optimizations. -#defer noopt_c++flags $[all_sources $[get_cflags] $[C++FLAGS],$[file]] $[CFLAGS_OPT$[OPTIMIZE]] - -// $[complete_lpath] is rather like $[complete_ipath]: the list of -// directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[libs $[RELDIR:%=%\$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] - -// $[lpath] is like $[target_ipath]: it's the list of directories we -// should add to our -L list, from the context of a particular target. -#defer lpath $[sort $[complete_lpath]] $[other_trees:%=%\lib] $[get_lpath] - -// $[converted_lpath] is the properly-formatted version of the library path -// for Visual Studio .NET. The resulting list is semicolon separated and uses -// Windows-style pathnames. -#defer converted_lpath $[join ;,$[osfilename $[lpath]]] - -// And $[libs] is the set of libraries we will link with. -#defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]] - -#defer converted_libs $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] - -// This is the set of files we might copy into *.prebuilt, if we have -// bison and flex (or copy from *.prebuilt if we don't have them). -#define bison_prebuilt $[patsubst %.yxx,%.h,$[yxx_so_sources] $[yxx_st_sources]] $[patsubst %.yxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_so_sources] $[lxx_st_sources]] - -// Rather than making a rule to generate each install directory later, -// we create the directories now. This reduces problems from -// multiprocess builds. -#mkdir $[sort \ - $[if $[install_lib],$[install_lib_dir]] \ - $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \ - $[if $[install_headers],$[install_headers_dir]] \ - $[if $[install_parser_inc],$[install_parser_inc_dir]] \ - $[if $[install_data],$[install_data_dir]] \ - $[if $[install_config],$[install_config_dir]] \ - $[if $[install_igatedb],$[install_igatedb_dir]] \ - $[if $[install_py],$[install_py_dir] $[install_py_package_dir]] \ - ] - -// Pre-compiled headers are one way to speed the compilation of many -// C++ source files that include similar headers, but it turns out a -// more effective (and more portable) way is simply to compile all the -// similar source files in one pass. - -// We do this by generating a *_composite.cxx file that has an -// #include line for each of several actual source files, and then we -// compile the composite file instead of the original files. -#foreach composite_file $[composite_list] -#output $[composite_file] notouch -#format collapse -/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE] -. */ -/* ################################# DO NOT EDIT ########################### */ - -#foreach file $[$[composite_file]_sources] -##include "$[file]" -#end file - -#end $[composite_file] -#end composite_file - - -///////////////////////////////////////////////////////////////////// -// First, the dynamic libraries. Each lib_target and metalib_target -// is a dynamic library. -///////////////////////////////////////////////////////////////////// - -#forscopes metalib_target lib_target -// In Windows, we don't actually build all the libraries. In -// particular, we don't build any libraries that are listed on a -// metalib. Is this one such library? -#define build_it $[eq $[module $[TARGET],$[TARGET]],] - -// We might need to define a BUILDING_ symbol for win32. We use the -// BUILDING_DLL variable name, defined typically in the metalib, for -// this; but in some cases, where the library isn't part of a metalib, -// we define BUILDING_DLL directly for the target. -#define building_var $[or $[BUILDING_DLL],$[module $[BUILDING_DLL],$[TARGET]]] -#define defines $[join ;,$[extra_defines] $[building_var]] - -// $[igatescan] is the set of C++ headers and source files that we -// need to scan for interrogate. $[igateoutput] is the name of the -// generated .cxx file that interrogate will produce (and which we -// should compile into the library). $[igatedb] is the name of the -// generated .in file that interrogate will produce (and which should -// be installed into the /etc directory). -#define igatescan $[get_igatescan] -#define igateoutput $[get_igateoutput] -#define igatedb $[get_igatedb] - -// If this is a metalib, it may have a number of components that -// include interrogated interfaces. If so, we need to generate a -// 'module' file within this library. This is mainly necessary for -// Python; it contains a table of all of the interrogated functions, -// so we can load the library as a Python module and have access to -// the interrogated functions. - -// $[igatemscan] is the set of .in files generated by all of our -// component libraries. If it is nonempty, then we do need to -// generate a module, and $[igatemout] is the name of the .cxx file -// that interrogate will produce to make this module. -#define igatemscan $[get_igatemscan] -#define igatemout $[get_igatemout] - -#if $[build_it] - #define target $[ODIR]\$[lib_prefix]$[TARGET].$[dlllib] - - // Installation paths - #define mybasename $[basename $[notdir $[target]]] - #define tmpdirname_cyg $[install_lib_dir]/$[mybasename] - #define tmpdirname_win $[osfilename $[tmpdirname_cyg]] - - // List of object files that will be combined to form this metalib target. - #define objects \ - $[components \ - $[osfilename $[patsubst %,$[RELDIR]\$[%_obj],$[compile_sources]]], \ - $[active_component_libs]] -#endif $[build_it] - -// Additional rules to generate and compile the interrogate data, if needed. -#if $[igatescan] - #define igatelib $[lib_prefix]$[TARGET] - - // The module name comes from the metalib that includes this library. - #define igatemod $[module $[TARGET],$[TARGET]] - #if $[eq $[igatemod],] - // ... unless no metalib includes this library. - #define igatemod $[TARGET] - #endif - - // Built the complete interrogate.exe commandline - #define igate_commandline \ - $[install_bin_dir]\$[INTERROGATE] -od $[igatedb] -oc $[igateoutput] \ - $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" \ - $[igatescan] - - // TODO: Install $[igatedb] in $[install_igatedb_dir] -#endif // igatescan - -// And finally, some additional rules to build the interrogate module -// file into the library, if this is a metalib that includes -// interrogated components. -#if $[igatemout] - #define igatelib $[lib_prefix]$[TARGET] - #define igatemod $[TARGET] - - #define igatemod_commandline \ - $[install_bin_dir]\$[INTERROGATE_MODULE] -oc $[igatemout] \ - -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] \ - $[igatemscan] -#endif // igatemout - -#output $[TARGET].vcproj -#format straight - - - - - - - -#else - ConfigurationType="4"> -#endif - - -#if $[build_it] - -#else - -#endif - -#if $[build_it] - -#else - -#endif -#if $[igatescan] - -#elif $[igatemscan] - -#else - -#endif - - - - - - - - - - - -#if $[compile_sources] -#foreach file $[sort $[compile_sources]] - -#if $[or $[eq $[file],$[igateoutput]],$[eq $[file],$[igatemout]]] - - - -#endif - -#end file -#endif - - - - -#end $[TARGET].vcproj -#end metalib_target lib_target - - -///////////////////////////////////////////////////////////////////// -// Now the static libraries. Again, we assume there's no interrogate -// interfaces going on in here, and there's no question of this being -// a metalib, making the rules relatively simple. -///////////////////////////////////////////////////////////////////// - -#forscopes static_lib_target ss_lib_target -#define target $[ODIR]\$[lib_prefix]$[TARGET].lib -#define defines $[join ;,$[extra_defines]] - -#output $[TARGET].vcproj -#format straight - - - - - - - - - - - - - - - - - - -#if $[compile_sources] -#foreach file $[sort $[compile_sources]] - - -#end file -#endif - - - - -#end $[TARGET].vcproj -#end static_lib_target ss_lib_target - - -///////////////////////////////////////////////////////////////////// -// And now, the bin_targets. These are normal C++ executables. No -// interrogate, metalibs, or any such nonsense here. -///////////////////////////////////////////////////////////////////// - -#forscopes bin_target -#define target $[ODIR]\$[TARGET].exe -#define defines $[join ;,$[extra_defines]] - -#output $[TARGET].vcproj -#format straight - - - - - - - - - - - - - - - - - - -#if $[compile_sources] -#foreach file $[sort $[compile_sources]] - - -#end file -#endif - - - - -#end $[TARGET].vcproj -#end bin_target - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], group] -////////////////////////////////////////////////////////////////////// - -// This is a group directory: a directory above a collection of source -// directories, e.g. $DTOOL/src. We don't need to output anything in -// this directory. - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], toplevel] -////////////////////////////////////////////////////////////////////// - -// This is the toplevel directory, e.g. $DTOOL. Here we build the -// package solution file and also synthesize the dtool_config.h (or -// whichever file) we need. - -//#define project_scopes */static_lib_target */ss_lib_target */lib_target */noinst_lib_target */test_lib_target */metalib_target */bin_target */test_bin_target -#define project_scopes */metalib_target */lib_target */static_lib_target */ss_lib_target */bin_target - -#output $[PACKAGE].sln -#format straight -Microsoft Visual Studio Solution File, Format Version 7.00 -#forscopes $[project_scopes] -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$[TARGET]", "$[osfilename $[PATH]]\$[TARGET].vcproj", "{$[makeguid $[TARGET]]}" -EndProject -#end $[project_scopes] -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = $[ODIR] - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution -#forscopes $[project_scopes] - #define count 0 - #foreach dependency $[DEPEND_DIRS] - {$[makeguid $[TARGET]]}.$[count] = {$[makeguid $[dependency]]} - #set count $[+ $[count],1] - #end dependency -#end $[project_scopes] - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution -#forscopes $[project_scopes] -#define guid $[makeguid $[TARGET]] - {$[guid]}.$[ODIR].ActiveCfg = $[ODIR]|Win32 - {$[guid]}.$[ODIR].Build.0 = $[ODIR]|Win32 -#end $[project_scopes] - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal -#end $[PACKAGE].sln - -// If there is a file called LocalSetup.pp in the package's top -// directory, then invoke that. It might contain some further setup -// instructions. -#sinclude $[TOPDIRPREFIX]LocalSetup.msvc.pp -#sinclude $[TOPDIRPREFIX]LocalSetup.pp - -////////////////////////////////////////////////////////////////////// -#elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]] -////////////////////////////////////////////////////////////////////// - -#include $[THISDIRPREFIX]Template.models.pp - -////////////////////////////////////////////////////////////////////// -#endif // DIR_TYPE diff --git a/dtool/pptempl/Template.nmake.pp b/dtool/pptempl/Template.nmake.pp deleted file mode 100644 index 58ede42909..0000000000 --- a/dtool/pptempl/Template.nmake.pp +++ /dev/null @@ -1,1169 +0,0 @@ -// -// Template.nmake.pp -// -// This file defines the set of output files that will be generated to -// support a makefile build system invoking Microsoft's Visual C++ -// command-line compiler using Microsoft's nmake. -// -// This was adapted from Template.gmsvc.pp -// - -// Before this file is processed, the following files are read and -// processed (in order): - -// The Package.pp file in the root of the current source hierarchy -// (e.g. $PANDA/Package.pp) -// $DTOOL/Package.pp -// $DTOOL/Config.pp -// $DTOOL/Config.Platform.pp -// The user's PPREMAKE_CONFIG file. -// $DTOOL/pptempl/System.pp -// All of the Sources.pp files in the current source hierarchy -// $DTOOL/pptempl/Global.pp -// $DTOOL/pptempl/Global.nmake.pp -// $DTOOL/pptempl/Depends.pp, once for each Sources.pp file -// Template.nmake.pp (this file), once for each Sources.pp file - -#if $[ne $[CTPROJS],] -#define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase -#define dtool_ver_dir $[osfilename $[dtool_ver_dir_cyg]] -#endif - -// -// Correct LDFLAGS_OPT 3,4 here to get around early evaluation of, even -// if deferred -// -#defer nodefaultlib_cstatic \ - $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],], \ - /NODEFAULTLIB:MSVCRT.LIB, \ - /NODEFAULTLIB:LIBCMT.LIB \ - ] -#defer LDFLAGS_OPT3 $[LDFLAGS_OPT3] $[nodefaultlib_cstatic] -#defer LDFLAGS_OPT4 $[LDFLAGS_OPT4] $[nodefaultlib_cstatic] - -////////////////////////////////////////////////////////////////////// -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]] -////////////////////////////////////////////////////////////////////// -// For a source directory, build a single Makefile with rules to build -// each target. - -#if $[build_directory] - // This is the real set of lib_targets we'll be building. On Windows, - // we don't build the shared libraries which are included on metalibs. - #define real_lib_targets - #define real_lib_target_libs - #define deferred_objs - #forscopes lib_target - #if $[build_target] - #if $[eq $[module $[TARGET],$[TARGET]],] - // This library is not on a metalib, so we can build it. - #set real_lib_targets $[real_lib_targets] $[TARGET] - #set real_lib_target_libs $[real_lib_target_libs] $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] - #else - // This library is on a metalib, so we can't build it, but we - // should build all the obj's that go into it. - #set deferred_objs $[deferred_objs] \ - $[patsubst %,$[%_obj],$[compile_sources]] - #endif - #endif - #end lib_target - - // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic and static libraries, - // and $[bin_targets] the list of binaries. $[test_bin_targets] is - // the list of binaries that are to be built only when specifically - // asked for. - - #define lib_targets $[forscopes metalib_target noinst_lib_target test_lib_target static_lib_target dynamic_lib_target ss_lib_target,$[if $[build_target],$[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]]] $[real_lib_target_libs] - - #define bin_targets \ - $[active_target(bin_target noinst_bin_target):%=$[ODIR]/%.exe] \ - $[active_target(sed_bin_target):%=$[ODIR]/%] - #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%.exe] - - #defer test_lib_targets $[active_target(test_lib_target):%=$[if $[TEST_ODIR],$[TEST_ODIR],$[ODIR]]/%$[dllext]$[lib_ext]] - - // And these variables will define the various things we need to - // install. - #define install_lib $[active_target(metalib_target static_lib_target dynamic_lib_target ss_lib_target)] $[real_lib_targets] - #define install_bin $[active_target(bin_target)] - #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_SCRIPTS]] - #define install_modules $[sort $[INSTALL_MODULES(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_MODULES]] - #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_HEADERS]] - #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] - #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_DATA]] - #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target)] $[INSTALL_CONFIG]] - #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target)]] - - // These are the various sources collected from all targets within the - // directory. - #define st_sources $[sort $[compile_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define yxx_st_sources $[sort $[yxx_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - #define dep_sources_1 $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]] - - // If there is an __init__.py in the directory, then all Python - // files in the directory just get installed without having to be - // named. - #if $[and $[INSTALL_PYTHON_SOURCE],$[wildcard $[TOPDIR]/$[DIRPREFIX]__init__.py]] - #define py_sources $[wildcard $[TOPDIR]/$[DIRPREFIX]*.py] - #endif - #define install_py $[py_sources:$[TOPDIR]/$[DIRPREFIX]%=%] - - // These are the source files that our dependency cache file will - // depend on. If it's an empty list, we won't bother writing rules to - // freshen the cache file. - #define dep_sources $[sort $[filter %.c %.cxx %.cpp %.yxx %.lxx %.h %.I %.T,$[dep_sources_1]]] - -#endif // $[build_directory] - -#defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]] - -// $[static_lib_dependencies] is the set of libraries we will link -// with that happen to be static libs. We will introduce dependency -// rules for these. (We don't need dependency rules for dynamic libs, -// since these don't get burned in at build time.) -#defer static_lib_dependencies $[all_libs $[if $[and $[lib_is_static],$[build_lib]],$[RELDIR:%=%/$[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]]],$[complete_local_libs]] - -// $[target_ipath] is the proper ipath to put on the command line, -// from the context of a particular target. - -#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees_include] $[get_ipath] - -// These are the complete set of extra flags the compiler requires. -#defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]] -#defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] - -// $[complete_lpath] is rather like $[complete_ipath]: the list of -// directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] - -// $[lpath] is like $[target_ipath]: it's the list of directories we -// should add to our -L list, from the context of a particular target. -#defer lpath $[sort $[complete_lpath]] $[other_trees_lib] $[get_lpath] - -// $[libs] is the set of libraries we will link with. -#defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]] - -// This is the set of files we might copy into *.prebuilt, if we have -// bison and flex (or copy from *.prebuilt if we don't have them). -#define bison_prebuilt $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] - -// Rather than making a rule to generate each install directory later, -// we create the directories now. This reduces problems from -// multiprocess builds. -#mkdir $[sort \ - $[if $[install_lib],$[install_lib_dir]] \ - $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \ - $[if $[install_bin] $[install_modules],$[install_lib_dir]] \ - $[if $[install_headers],$[install_headers_dir]] \ - $[if $[install_parser_inc],$[install_parser_inc_dir]] \ - $[if $[install_data],$[install_data_dir]] \ - $[if $[install_config],$[install_config_dir]] \ - $[if $[install_igatedb],$[install_igatedb_dir]] \ - $[if $[install_py],$[install_py_dir] $[install_py_package_dir]] \ - ] - -// Similarly, we need to ensure that $[ODIR] exists. Trying to make -// the makefiles do this automatically just causes problems with -// multiprocess builds. -#mkdir $[ODIR] $[TEST_ODIR] - -// Pre-compiled headers are one way to speed the compilation of many -// C++ source files that include similar headers, but it turns out a -// more effective (and more portable) way is simply to compile all the -// similar source files in one pass. - -// We do this by generating a *_composite.cxx file that has an -// #include line for each of several actual source files, and then we -// compile the composite file instead of the original files. -#foreach composite_file $[composite_list] -#output $[composite_file] notouch -#format collapse -/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */ -/* ################################# DO NOT EDIT ########################### */ - -#foreach file $[$[composite_file]_sources] -#if $[USE_TAU] -// For the benefit of Tau, we copy the source file verbatim into the -// composite file. (Tau doesn't instrument files picked up via #include.) -#copy $[DIRPREFIX]$[file] - -#else -##include "$[file]" -#endif // USE_TAU -#end file - -#end $[composite_file] -#end composite_file - -// Okay, we're ready. Start outputting the Makefile now. -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -// If we are using GNU make, this will automatically enable the -// multiprocessor build mode according to the value in -// NUMBER_OF_PROCESSORS, which should be set by NT. Maybe this isn't -// a good idea to do all the time, but you can always disable it by -// explicitly unsetting NUMBER_OF_PROCESSORS, or by setting it to 1. -//#if $[NUMBER_OF_PROCESSORS] -//MAKEFLAGS := -j$[NUMBER_OF_PROCESSORS] -//#endif - -// The 'all' rule makes all the stuff in the directory except for the -// test_bin_targets. It doesn't do any installation, however. -#define all_targets \ - Makefile \ - $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \ - $[sort $[lib_targets] $[bin_targets]] \ - $[deferred_objs] -all : $[patsubst %,$[osfilename %],$[all_targets]] - -// The 'test' rule makes all the test_bin_targets. -test : $[patsubst %,$[osfilename %],$[test_bin_targets] $[test_lib_targets]] - -clean : clean-igate -#forscopes metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[compile_sources] -#foreach file $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif -#end metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target - -#if $[deferred_objs] -#foreach file $[patsubst %,$[osfilename %],$[deferred_objs]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -#if $[lib_targets] $[bin_targets] $[test_bin_targets] -#foreach file $[patsubst %,$[osfilename %],$[lib_targets] $[bin_targets] $[test_bin_targets]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -#if $[yxx_st_sources] $[lxx_st_sources] -#foreach file $[patsubst %,$[osfilename %],$[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -#if $[py_sources] -$[TAB] if exist *.pyc del /f *.pyc -$[TAB] if exist *.pyo del /f *.pyo // Also scrub out old generated Python code. -#endif - -#if $[USE_TAU] -$[TAB] if exist $[osfilename $[ODIR]/*.il] del /f $[osfilename $[ODIR]/*.il] -$[TAB] if exist $[osfilename $[ODIR]/*.pdb] del /f $[osfilename $[ODIR]/*.pdb] -$[TAB] if exist *.inst.* del /f *.inst.* -#endif - -// 'cleanall' is intended to undo all the effects of running ppremake -// and building. It removes everything except the Makefile. -cleanall : clean -#if $[st_sources] -$[TAB] rmdir /s $[ODIR] -#endif -#if $[ne $[DEPENDENCY_CACHE_FILENAME],] -$[TAB] if exist $[osfilename $[DEPENDENCY_CACHE_FILENAME]] del /f $[osfilename $[DEPENDENCY_CACHE_FILENAME]] -#endif -#if $[composite_list] -#foreach file $[patsubst %,$[osfilename %],$[composite_list]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -clean-igate : -#forscopes metalib_target lib_target ss_lib_target - #define igatedb $[get_igatedb] - #define igateoutput $[get_igateoutput] - #define igatemscan $[get_igatemscan] - #define igatemout $[get_igatemout] - #if $[igatedb] -$[TAB] if exist $[osfilename $[igatedb]] del /f $[osfilename $[igatedb]] - #endif - #if $[igateoutput] -$[TAB] if exist $[osfilename $[igateoutput]] del /f $[osfilename $[igateoutput]] -$[TAB] if exist $[osfilename $[$[igateoutput]_obj]] del /f $[osfilename $[$[igateoutput]_obj]] - #endif - #if $[igatemout] -$[TAB] if exist $[osfilename $[igatemout]] del /f $[osfilename $[igatemout]] -$[TAB] if exist $[osfilename $[$[igatemout]_obj]] del /f $[osfilename $[$[igatemout]_obj]] - #endif -#end metalib_target lib_target ss_lib_target - -// Now, 'install' and 'uninstall'. These simply copy files into the -// install directory (or remove them). The 'install' rule also makes -// the directories if necessary. -#define installed_files \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_PARSER_INC:%=$[install_parser_inc_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[if $[install_py],$[install_py:%=$[install_py_dir]/%] $[install_py_package_dir]/__init__.py] - -#define installed_igate_files \ - $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%] - -#define install_targets \ - $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=install-lib%] \ - $[active_target(bin_target sed_bin_target):%=install-%] \ - $[installed_files] - -install : all $[patsubst %,$[osfilename %],$[install_targets]] - -install-igate : $[patsubst %,$[osfilename %],$[sort $[installed_igate_files]]] - -uninstall : $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] -#if $[installed_files] -#foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -uninstall-igate : -#if $[installed_igate_files] -#foreach file $[patsubst %,$[osfilename %],$[sort $[installed_igate_files]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -#if $[HAVE_BISON] -prebuild-bison : $[patsubst %,%.prebuilt,$[bison_prebuilt]] -clean-prebuild-bison : -#if $[bison_prebuilt] -#foreach file $[patsubst %,$[osfilename %],$[sort $[patsubst %,%.prebuilt,$[bison_prebuilt]]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif -#endif - -// Now it's time to start generating the rules to make our actual -// targets. - -igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] - - -///////////////////////////////////////////////////////////////////// -// First, the dynamic and static libraries. -///////////////////////////////////////////////////////////////////// - -#forscopes metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target - -// We might need to define a BUILDING_ symbol for win32. We use the -// BUILDING_DLL variable name, defined typically in the metalib, for -// this; but in some cases, where the library isn't part of a metalib, -// we define BUILDING_DLL directly for the target. -#define building_var $[or $[BUILDING_DLL],$[module $[BUILDING_DLL],$[TARGET]]] - -// $[igatescan] is the set of C++ headers and source files that we -// need to scan for interrogate. $[igateoutput] is the name of the -// generated .cxx file that interrogate will produce (and which we -// should compile into the library). $[igatedb] is the name of the -// generated .in file that interrogate will produce (and which should -// be installed into the /etc directory). -#define igatescan $[get_igatescan] -#define igateoutput $[get_igateoutput] -#define igatedb $[get_igatedb] - -// If this is a metalib, it may have a number of components that -// include interrogated interfaces. If so, we need to generate a -// 'module' file within this library. This is mainly necessary for -// Python; it contains a table of all of the interrogated functions, -// so we can load the library as a Python module and have access to -// the interrogated functions. - -// $[igatemscan] is the set of .in files generated by all of our -// component libraries. If it is nonempty, then we do need to -// generate a module, and $[igatemout] is the name of the .cxx file -// that interrogate will produce to make this module. -#define igatemscan $[get_igatemscan] -#define igatemout $[get_igatemout] - -#if $[build_lib] - // Now output the rule to actually link the library from all of its - // various .obj files. - - #define sources \ - $[patsubst %,$[%_obj],$[compile_sources]] - #if $[not $[BUILD_COMPONENTS]] - // Also link in all of the component files directly into the metalib. - #define sources $[sources] \ - $[components $[patsubst %,$[RELDIR]/$[%_obj],$[compile_sources]],$[active_component_libs]] - #endif - - #define varname $[subst -,_,.,_,$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -$[varname] = $[sources] - #define target $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] - #define sources $($[varname]) - #define flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%] - -// not parallel (requires gmake 3.79) because of link.exe conflicts in TMP dir (see audiotraits dir) -#if $[or $[GENERATE_BUILDDATE],$[WIN_RESOURCE_FILE]] - #define resource_file $[or $[WIN_RESOURCE_FILE],$[dtool_ver_dir_cyg]/version.rc] - #define tlb_depend $[patsubst %.idl,$[ODIR]/%.tlb,$[filter %.idl, $[get_sources]]] -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies] $[resource_file] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%] $[tlb_depend]] - - // first generate builddate for rc compiler using compiler preprocessor - #define ver_resource "$[ODIR]\$[lib_prefix]$[TARGET].res" -$[TAB] cl /nologo /EP "$[dtool_ver_dir]\verdate.cpp" > "$[ODIR]\verdate.h" -$[TAB] rc /n /I"$[ODIR]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[ver_resource] $[filter /D%, $[flags]] "$[osfilename $[resource_file]]" - #define sources $[sources] $[ver_resource] - #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] - #else -$[TAB] $[link_lib_c] - #endif -#else - -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[DLLBASEADDRFILENAME:%=$[dtool_ver_dir_cyg]/%]] - #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] - #else -$[TAB] $[link_lib_c] - #endif -#endif - -// Additional dependency rules for the implicit files that get built -// along with a .dll. -#if $[not $[lib_is_static]] -$[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].lib] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -#endif -#if $[has_pdb] -$[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].pdb] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -#endif - -#endif - -// Here are the rules to install and uninstall the library and -// everything that goes along with it. -#define installed_files \ - $[if $[build_lib], \ - $[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] \ - $[if $[not $[lib_is_static]],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].lib] \ - $[if $[has_pdb],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].pdb] \ - ] \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] - -install-lib$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]] - -uninstall-lib$[TARGET] : -#if $[installed_files] -#foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -$[osfilename $[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -#define local $[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#define dest $[install_lib_dir] -#if $[not $[lib_is_static]] -#if $[eq $[USE_COMPILER], MSVC8] -$[TAB] mt -nologo -manifest $[osfilename $[ODIR]/$[local].manifest] -outputresource:$[osfilename $[ODIR]/$[local]];2 -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local].manifest] $[osfilename $[dest]] -#endif -#endif -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]/] - -// Install the .lib associated with a .dll. -#if $[not $[lib_is_static]] -$[osfilename $[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].lib] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].lib] -#define local $[lib_prefix]$[TARGET]$[dllext].lib -#define dest $[install_lib_dir] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]/] -#endif - - -#if $[has_pdb] -$[osfilename $[install_lib_dir]/$[lib_prefix]$[TARGET]$[dllext].pdb] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].pdb] -#define local $[lib_prefix]$[TARGET]$[dllext].pdb -#define dest $[install_lib_dir] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]/] -#endif - -#if $[igatescan] -// Now, some additional rules to generate and compile the interrogate -// data, if needed. - -// The library name is based on this library. -#define igatelib $[lib_prefix]$[TARGET] -// The module name comes from the metalib that includes this library. -#define igatemod $[module $[TARGET],$[TARGET]] -#if $[eq $[igatemod],] - // Unless no metalib includes this library. - #define igatemod $[TARGET] -#endif - -$[osfilename $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%]] : $[igatedb] -#define local $[igatedb] -#define dest $[install_igatedb_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] - -// We have to split this out as a separate rule to properly support -// parallel make. -$[osfilename $[igatedb]] : $[patsubst %,$[osfilename %],$[igateoutput]] - -$[lib_prefix]$[TARGET]_igatescan = $[patsubst %,$[osfilename %],$[igatescan]] -$[osfilename $[igateoutput]] : $[patsubst %,$[osfilename %],$[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]]] -$[TAB] $[INTERROGATE] -od $[osfilename $[igatedb]] -oc $[osfilename $[igateoutput]] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $($[lib_prefix]$[TARGET]_igatescan) - -#endif // igatescan - - -#if $[igatemout] -// And finally, some additional rules to build the interrogate module -// file into the library, if this is a metalib that includes -// interrogated components. - -#define igatelib $[lib_prefix]$[TARGET] -#define igatemod $[TARGET] - -$[lib_prefix]$[TARGET]_igatemscan = $[patsubst %,$[osfilename %],$[igatemscan]] -#define target $[igatemout] -#define sources $($[lib_prefix]$[TARGET]_igatemscan) - -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources]] -$[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources] - -#endif // igatemout - -#foreach idl $[filter %.idl, $[get_sources]] - #define idl_basename $[basename $[idl]] -$[osfilename $[ODIR]/$[idl_basename].tlb] : $[osfilename $[ODIR]/$[idl_basename].h] -$[osfilename $[ODIR]/$[idl_basename].h] : $[osfilename $[idl]] -$[TAB] $[MIDL_COMMAND] -#end idl - -#end metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target - - -///////////////////////////////////////////////////////////////////// -// Now, the noninstalled dynamic libraries. These are presumably used -// only within this directory, or at the most within this tree, and -// also presumably will never include interrogate data. That, plus -// the fact that we don't need to generate install rules, makes it a -// lot simpler. -///////////////////////////////////////////////////////////////////// - -#forscopes noinst_lib_target test_lib_target -#define varname $[subst -,_,.,_,$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -$[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] -#define target $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext] -#define sources $($[varname]) -#define $[VER_RESOURCE] $[COMPILED_RESOURCES] -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies] $[GENERATED_SOURCES]] -#if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] -#else -$[TAB] $[link_lib_c] -#endif - -$[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -#if $[has_pdb] -$[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext].pdb] : $[osfilename $[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]] -#endif - -// this section is all very clunky and not generalized enough -// assuming tgt dirs and such - -#define rc_to_gen $[filter %.rc, $[GENERATED_SOURCES]] -#if $[rc_to_gen] -$[osfilename $[rc_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_RC_DEPENDENCIES]] -$[TAB] $[RC_GENERATOR_RULE] - -$[osfilename $[ODIR]/$[RC_BASENAME].res] : $[patsubst %,$[osfilename %],$[rc_to_gen]] -$[TAB] $[COMPILE_RC] /I"$[ODIR]" /Fo"$[osfilename $[ODIR]/$[RC_BASENAME].res]" $[osfilename $[ODIR]/$[RC_BASENAME].rc] -#endif - -#define inf_to_gen $[filter %.inf, $[GENERATED_SOURCES]] -#if $[inf_to_gen] -$[osfilename $[inf_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_INF_DEPENDENCIES]] -$[TAB] $[INF_GENERATOR_RULE] -#endif - -#define rgs_to_gen $[filter %.rgs, $[GENERATED_SOURCES]] -#if $[rgs_to_gen] -$[osfilename $[rgs_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_RGS_DEPENDENCIES]] -$[TAB] $[RGS_GENERATOR_RULE] -#endif - -#define verhdr_to_gen $[filter %Version.h, $[GENERATED_SOURCES]] -#if $[verhdr_to_gen] -$[osfilename $[verhdr_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_VERHEADER_DEPENDENCIES]] -$[TAB] $[VERHEADER_GENERATOR_RULE] - -$[osfilename $[VERHEADER_DEPENDENTS]] : $[patsubst %,$[osfilename %],$[verhdr_to_gen]] -#endif - -#define idl_to_gen $[filter %.idl, $[GENERATED_SOURCES]] -#if $[idl_to_gen] -$[osfilename $[idl_to_gen]] : $[patsubst %,$[osfilename %],$[GENERATED_IDL_DEPENDENCIES]] -$[TAB] $[IDL_GENERATOR_RULE] - -$[osfilename $[ODIR]/$[IDL_BASENAME].h] : $[osfilename $[idl_to_gen]] -#define idl $[idl_to_gen] -$[TAB] $[MIDL_COMMAND] - -// this is a complete hack. I don't know how add a generated .h to the dependency list of $[IDL_BASENAME].cpp. -// it is already there, but in the wrong directory. should really add this to official dependency list -#foreach file $[GENERATED_IDL_H_DEPENDENTS] -$[osfilename $[file]] : $[osfilename $[ODIR]/$[IDL_BASENAME].h] -$[TAB] // empty, dependency-only 'rule' - -#end file - -$[osfilename $[ODIR]/$[IDL_BASENAME].tlb] : $[osfilename $[idl_to_gen]] -#define idl $[idl_to_gen] -$[TAB] $[MIDL_COMMAND] -#endif - -#end noinst_lib_target test_lib_target - - -///////////////////////////////////////////////////////////////////// -// The sed_bin_targets are a special bunch. These are scripts that -// are to be preprocessed with sed before being installed, for -// instance to insert a path or something in an appropriate place. -///////////////////////////////////////////////////////////////////// - -#forscopes sed_bin_target -$[osfilename $[TARGET]] : $[osfilename $[ODIR]/$[TARGET]] - -#define target $[ODIR]/$[TARGET] -#define source $[SOURCE] -#define script $[COMMAND] -$[osfilename $[target]] : $[osfilename $[source]] -$[TAB] $[SED] - -#define installed_files \ - $[install_bin_dir]/$[TARGET] - -install-$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]] - -uninstall-$[TARGET] : -#if $[installed_files] -#foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]] -$[TAB] if exist $[file] del /f $[file] -#end file -#endif - -#define local $[TARGET] -#define dest $[install_bin_dir] -$[osfilename $[install_bin_dir]/$[TARGET]] : $[osfilename $[ODIR]/$[TARGET]] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]/] - -#end sed_bin_target - - -///////////////////////////////////////////////////////////////////// -// And now, the bin_targets. These are normal C++ executables. No -// interrogate, metalibs, or any such nonsense here. -///////////////////////////////////////////////////////////////////// - -#forscopes bin_target -$[osfilename $[TARGET]] : $[osfilename $[ODIR]/$[TARGET].exe] - -#define varname $[subst -,_,bin_$[TARGET]] -$[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] -#define target $[ODIR]/$[TARGET].exe -#define sources $($[varname]) -#define ld $[get_ld] - -#if $[WIN_RESOURCE_FILE] - #define resource_file $[WIN_RESOURCE_FILE] - #define ver_resource "$[ODIR]\$[TARGET].res" -$[ver_resource] : $[resource_file] -$[TAB] rc /n /I"$[ODIR]" $[DECYGWINED_INC_PATHLIST_ARGS] /fo$[ver_resource] $[filter /D%, $[flags]] "$[osfilename $[resource_file]]" - #set sources $[sources] $[ver_resource] -#endif - -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies]] -#if $[ld] - // If there's a custom linker defined for the target, we have to use it. -$[TAB] $[ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#else - // Otherwise, we can use the normal linker. - #if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_bin_c++] - #else -$[TAB] $[link_bin_c] - #endif -#endif -#if $[eq $[USE_COMPILER], MSVC8] -$[TAB] mt -nologo -manifest $[osfilename $[target].manifest] -outputresource:$[osfilename $[target]];1 -#endif - -#if $[build_pdbs] -$[osfilename $[ODIR]/$[TARGET].pdb] : $[osfilename $[ODIR]/$[TARGET].exe] -#endif - -#define installed_files \ - $[install_bin_dir]/$[TARGET].exe \ - $[if $[build_pdbs],$[install_bin_dir]/$[TARGET].pdb] \ - $[if $[eq $[USE_COMPILER],MSVC8],$[install_bin_dir]/$[TARGET].exe.manifest] \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[if $[bin_postprocess_target],$[install_bin_dir]/$[bin_postprocess_target].exe] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] - -install-$[TARGET] : $[patsubst %,$[osfilename %],$[installed_files]] - - -uninstall-$[TARGET] : -#if $[installed_files] -#foreach file $[patsubst %,$[osfilename %],$[sort $[installed_files]]] -$[TAB] if exist $[osfilename $[file]] del /f $[osfilename $[file]] -#end file -#endif - -$[osfilename $[install_bin_dir]/$[TARGET].exe] : $[osfilename $[ODIR]/$[TARGET].exe] -#define local $[TARGET].exe -#define dest $[install_bin_dir] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]/] -#if $[eq $[USE_COMPILER],MSVC8] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local].manifest] $[osfilename $[dest]/] -#endif - -#if $[build_pdbs] -$[osfilename $[install_bin_dir]/$[TARGET].pdb] : $[osfilename $[ODIR]/$[TARGET].pdb] -#define local $[TARGET].pdb -#define dest $[install_bin_dir] -$[TAB] xcopy /I/Y $[osfilename $[ODIR]/$[local]] $[osfilename $[dest]/] -#endif - -#if $[bin_postprocess_target] -#define input_exe $[ODIR]/$[TARGET].exe -#define output_exe $[ODIR]/$[bin_postprocess_target].exe - -$[osfilename $[output_exe]] : $[osfilename $[input_exe]] -$[TAB] if exist $[osfilename $[output_exe]] del /f $[osfilename $[output_exe]] -$[TAB] $[bin_postprocess_cmd] $[bin_postprocess_arg1] $[osfilename $[input_exe]] $[bin_postprocess_arg2] $[osfilename $[output_exe]] - -$[osfilename $[install_bin_dir]/$[bin_postprocess_target].exe] : $[osfilename $[output_exe]] -$[TAB] xcopy /I/Y $[osfilename $[output_exe]] $[osfilename $[install_bin_dir]/] -#endif - -#end bin_target - -///////////////////////////////////////////////////////////////////// -// The noinst_bin_targets and the test_bin_targets share the property -// of being built (when requested), but having no install rules. -///////////////////////////////////////////////////////////////////// - -#forscopes noinst_bin_target test_bin_target test_lib_target -$[osfilename $[TARGET]] : $[osfilename $[ODIR]/$[TARGET].exe] - -#define varname $[subst -,_,bin_$[TARGET]] -$[varname] = $[patsubst %,$[osfilename $[%_obj]],$[compile_sources]] -#define target $[ODIR]/$[TARGET].exe -#define sources $($[varname]) -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[sources] $[static_lib_dependencies]] -#if $[filter %.cxx %.cpp %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_bin_c++] -#else -$[TAB] $[link_bin_c] -#endif - -#end noinst_bin_target test_bin_target test_lib_target - -///////////////////////////////////////////////////////////////////// -// Rules to run bison and/or flex as needed. -///////////////////////////////////////////////////////////////////// - -// Rules to generate a C++ file from a Bison input file. -#foreach file $[sort $[yxx_st_sources]] -#define target $[patsubst %.yxx,%.cxx,$[file]] -#define target_header $[patsubst %.yxx,%.h,$[file]] -#define target_prebuilt $[target].prebuilt -#define target_header_prebuilt $[target_header].prebuilt -#if $[HAVE_BISON] -$[osfilename $[target]] : $[osfilename $[file]] -$[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[osfilename $[file]] -$[TAB] move /y y.tab.c $[osfilename $[target]] -$[TAB] move /y y.tab.h $[osfilename $[target_header]] -$[osfilename $[target_header]] : $[osfilename $[target]] -$[osfilename $[target_prebuilt]] : $[osfilename $[target]] -$[TAB] copy /Y $[osfilename $[target]] $[osfilename $[target_prebuilt]] -$[osfilename $[target_header_prebuilt]] : $[osfilename $[target_header]] -$[TAB] copy /Y $[osfilename $[target_header]] $[osfilename $[target_header_prebuilt]] -#else // HAVE_BISON -$[osfilename $[target]] : $[osfilename $[target_prebuilt]] -$[TAB] copy /Y $[osfilename $[target_prebuilt]] $[osfilename $[target]] -$[osfilename $[target_header]] : $[osfilename $[target_header_prebuilt]] -$[TAB] copy /Y $[osfilename $[target_header_prebuilt]] $[osfilename $[target_header]] -#endif // HAVE_BISON - -#end file - -// Rules to generate a C++ file from a Flex input file. -#foreach file $[sort $[lxx_st_sources]] -#define target $[patsubst %.lxx,%.cxx,$[file]] -#define target_prebuilt $[target].prebuilt -#if $[HAVE_BISON] -#define source $[file] -$[osfilename $[target]] : $[osfilename $[file]] -$[TAB] $[FLEX] $[FLEXFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[osfilename $[file]] -#define source lex.yy.c -#define script /#include /d -$[TAB] $[SED] -$[TAB] if exist lex.yy.c del lex.yy.c -$[osfilename $[target_prebuilt]] : $[osfilename $[target]] -$[TAB] copy /Y $[osfilename $[target]] $[osfilename $[target_prebuilt]] -#else // HAVE_BISON -$[osfilename $[target]] : $[osfilename $[target_prebuilt]] -$[TAB] copy /Y $[osfilename $[target_prebuilt]] $[osfilename $[target]] -#endif // HAVE_BISON - -#end file - - -///////////////////////////////////////////////////////////////////// -// Finally, we put in the rules to compile each source file into a .obj -// file. -///////////////////////////////////////////////////////////////////// - -#forscopes metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -// need to use #print to avoid printing to Makefile -// printvar prints the unevaluated defn of the var -// #print TARGET=$[TARGET] -// #printvar TARGET - -// Rules to compile ordinary C files. -#foreach file $[sort $[c_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[cflags] $[building_var:%=/D%] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -#if $[not $[direct_tau]] - -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source] $[get_depends $[source]]] -$[TAB] $[compile_c] - -#else // direct_tau -// This version is used to invoke the tau compiler directly. -#define il_source $[target].il -#define pdb_source $[target].pdb // Not to be confused with windows .pdb debugger info files. -#define inst_source $[notdir $[target:%.obj=%.inst.c]] -$[osfilename $[il_source]] : $[osfilename $[source]] -$[TAB] $[TAU_MAKE_IL] - -$[osfilename $[pdb_source]] : $[osfilename $[il_source]] -$[TAB] $[TAU_MAKE_PDB] - -$[osfilename $[inst_source]] : $[osfilename $[pdb_source]] -$[TAB] $[TAU_MAKE_INST] -c - -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[inst_source] $[get_depends $[source]]] -#define source $[inst_source] -$[TAB] $[COMPILE_C] - -#endif // direct_tau - -#end file - -// Rules to compile C++ files. - -#foreach file $[sort $[cxx_sources] $[cxx_interrogate_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[c++flags] $[building_var:%=/D%] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -#if $[not $[direct_tau]] -// Yacc must run before some files can be compiled, so all files -// depend on yacc having run. -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h]] -$[TAB] $[compile_c++] - -#else // direct_tau -// This version is used to invoke the tau compiler directly. -#define il_source $[target].il -#define pdb_source $[target].pdb // Not to be confused with windows .pdb debugger info files. -#define inst_source $[notdir $[target:%.obj=%.inst.cxx]] -$[osfilename $[il_source]] : $[patsubst %,$[osfilename %],$[source] $[yxx_sources:%.yxx=%.h]] -$[TAB] $[TAU_MAKE_IL] - -$[osfilename $[pdb_source]] : $[osfilename $[il_source]] -$[TAB] $[TAU_MAKE_PDB] - -$[osfilename $[inst_source]] : $[osfilename $[pdb_source]] -$[TAB] $[TAU_MAKE_INST] -c++ - -$[osfilename $[target]] : $[patsubst %,$[osfilename %],$[inst_source] $[get_depends $[source]]] -#define source $[inst_source] -$[TAB] $[COMPILE_C++] - -#endif // direct_tau - -#end file - -#end metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target - -// And now the rules to install the auxiliary files, like headers and -// data files. -#foreach file $[install_scripts] -$[osfilename $[install_bin_dir]/$[file]] : $[osfilename $[file]] -#define local $[file] -#define dest $[install_bin_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#end file - -#foreach file $[install_modules] -$[osfilename $[install_lib_dir]/$[file]] : $[osfilename $[file]] -#define local $[file] -#define dest $[install_lib_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#end file - -#foreach file $[install_headers] -$[osfilename $[install_headers_dir]/$[file]] : $[osfilename $[file]] -#define local $[file] -#define dest $[install_headers_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#end file - -#foreach file $[install_parser_inc] -#if $[ne $[dir $[file]], ./] -$[osfilename $[install_parser_inc_dir]/$[file]] : $[osfilename $[notdir $[file]]] - #define local $[notdir $[file]] - #define dest $[install_parser_inc_dir]/$[dir $[file]] -$[TAB] mkdir $[osfilename $[install_parser_inc_dir]/$[dir $[file]]] || echo -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]] -#else -$[osfilename $[install_parser_inc_dir]/$[file]] : $[osfilename $[file]] - #define local $[file] - #define dest $[install_parser_inc_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#endif -#end file - -#foreach file $[install_data] -$[osfilename $[install_data_dir]/$[file]] : $[osfilename $[file]] -#define local $[file] -#define dest $[install_data_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#end file - -#foreach file $[install_config] -$[osfilename $[install_config_dir]/$[file]] : $[osfilename $[file]] -#define local $[file] -#define dest $[install_config_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#end file - -#foreach file $[install_py] -$[osfilename $[install_py_dir]/$[file]] : $[osfilename $[file]] -#define local $[file] -#define dest $[install_py_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#end file - -#if $[install_py] -$[osfilename $[install_py_package_dir]/__init__.py] : -$[TAB] echo. > $[osfilename $[install_py_package_dir]/__init__.py] -#endif - -// Finally, all the special targets. These are commands that just need -// to be invoked; we don't pretend to know what they are. -#forscopes special_target -$[osfilename $[TARGET]] : -$[TAB] $[COMMAND] - -#end special_target - - -// Finally, the rules to freshen the Makefile itself. -Makefile : $[osfilename $[SOURCE_FILENAME]] $[osfilename $[EXTRA_PPREMAKE_SOURCE]] -$[TAB] ppremake - -#if $[USE_TAU] -#foreach composite_file $[composite_list] -$[osfilename $[composite_file]] : $[patsubst %,$[osfilename %],$[$[composite_file]_sources]] -$[TAB] ppremake -#end composite_file -#endif // USE_TAU - -#if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]] -$[osfilename $[DEPENDENCY_CACHE_FILENAME]] : $[patsubst %,$[osfilename %],$[dep_sources]] -$[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME] -#endif - -#end Makefile - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], group] -////////////////////////////////////////////////////////////////////// - -// This is a group directory: a directory above a collection of source -// directories, e.g. $DTOOL/src. We don't need to output anything in -// this directory. - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], toplevel] -////////////////////////////////////////////////////////////////////// - -// This is the toplevel directory, e.g. $DTOOL. Here we build the -// root makefile and also synthesize the dtool_config.h (or whichever -// file) we need. - -#map subdirs -// Iterate through all of our known source files. Each src and -// metalib type file gets its corresponding Makefile listed -// here. However, we test for $[DIR_TYPE] of toplevel, because the -// source directories typically don't define their own DIR_TYPE -// variable, and they end up inheriting this one dynamically. -#forscopes */ -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib],$[and $[eq $[DIR_TYPE], toplevel],$[ne $[DIRNAME],top]]] -#if $[build_directory] - #addmap subdirs $[DIRNAME] -#endif -#endif -#end */ - -#if $[PYTHON_PACKAGE] -#include $[THISDIRPREFIX]PythonPackageInit.pp -#endif - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -all : $[subdirs] -test : $[subdirs:%=test-%] -igate : $[subdirs:%=igate-%] -clean : $[subdirs:%=clean-%] -clean-igate : $[subdirs:%=clean-igate-%] -cleanall : $[subdirs:%=cleanall-%] -install : $[if $[CONFIG_HEADER],$[osfilename $[install_headers_dir]] $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]]] $[subdirs:%=install-%] -install-igate : $[subdirs:%=install-igate-%] -uninstall : $[subdirs:%=uninstall-%] -#if $[CONFIG_HEADER] -$[TAB] if exist $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] del /f $[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] -#endif -uninstall-igate : $[subdirs:%=uninstall-igate-%] - -#if $[HAVE_BISON] -prebuild-bison : $[subdirs:%=prebuild-bison-%] -clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%] -#endif - -#formap dirname subdirs -#define depends -$[osfilename $[dirname]] : $[patsubst %,$[osfilename %],$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) all -#end dirname - -#formap dirname subdirs -test-$[dirname] : -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) test -#end dirname - -#formap dirname subdirs -igate-$[dirname] : -$[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) igate -#end dirname - -#formap dirname subdirs -clean-$[dirname] : -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) clean -#end dirname - -#formap dirname subdirs -clean-igate-$[dirname] : -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) clean-igate -#end dirname - -#formap dirname subdirs -cleanall-$[dirname] : $[patsubst %,cleanall-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) cleanall -#end dirname - -#formap dirname subdirs -install-$[dirname] : $[patsubst %,install-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) install -#end dirname - -#formap dirname subdirs -install-igate-$[dirname] : -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) install-igate -#end dirname - -#formap dirname subdirs -uninstall-$[dirname] : -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) uninstall -#end dirname - -#formap dirname subdirs -uninstall-igate-$[dirname] : -$[TAB] cd $[osfilename ./$[PATH]] && $(MAKE) uninstall-igate -#end dirname - -#if $[HAVE_BISON] -#formap dirname subdirs -prebuild-bison-$[dirname] : -$[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) prebuild-bison -clean-prebuild-bison-$[dirname] : -$[TAB]cd $[osfilename ./$[PATH]] && $(MAKE) clean-prebuild-bison -#end dirname -#endif - -#if $[ne $[CONFIG_HEADER],] -$[osfilename $[install_headers_dir]] : -$[TAB] if not exist $[osfilename $[install_headers_dir]] echo mkdir $[osfilename $[install_headers_dir]] -$[TAB] if not exist $[osfilename $[install_headers_dir]] mkdir $[osfilename $[install_headers_dir]] - -$[osfilename $[install_headers_dir]/$[CONFIG_HEADER]] : $[osfilename $[CONFIG_HEADER]] -#define local $[CONFIG_HEADER] -#define dest $[install_headers_dir] -$[TAB] xcopy /I/Y $[osfilename $[local]] $[osfilename $[dest]/] -#endif - -// Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] -$[TAB] ppremake - -#end Makefile - -// If there is a file called LocalSetup.pp in the package's top -// directory, then invoke that. It might contain some further setup -// instructions. -#sinclude $[TOPDIRPREFIX]LocalSetup.nmake.pp -#sinclude $[TOPDIRPREFIX]LocalSetup.pp - - -////////////////////////////////////////////////////////////////////// -#elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]] -////////////////////////////////////////////////////////////////////// - -#include $[THISDIRPREFIX]Template.models.pp - -////////////////////////////////////////////////////////////////////// -#endif // DIR_TYPE - diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp deleted file mode 100644 index e9baf63dba..0000000000 --- a/dtool/pptempl/Template.unix.pp +++ /dev/null @@ -1,962 +0,0 @@ -// -// -// Template.unix.pp -// -// This file defines the set of output files that will be generated to -// support a generic Unix-style build system. -// - -// Before this file is processed, the following files are read and -// processed (in order): - -// The Package.pp file in the root of the current source hierarchy -// (e.g. $PANDA/Package.pp) -// $DTOOL/Package.pp -// $DTOOL/Config.pp -// $DTOOL/Config.Platform.pp -// The user's PPREMAKE_CONFIG file. -// $DTOOL/pptempl/System.pp -// All of the Sources.pp files in the current source hierarchy -// $DTOOL/pptempl/Global.pp -// $DTOOL/pptempl/Global.gmsvc.pp -// $DTOOL/pptempl/Depends.pp, once for each Sources.pp file -// Template.gmsvc.pp (this file), once for each Sources.pp file - -#if $[ne $[DTOOL],] -#define dtool_ver_dir_cyg $[DTOOL]/src/dtoolbase -#define dtool_ver_dir $[osfilename $[dtool_ver_dir_cyg]] -#endif - -////////////////////////////////////////////////////////////////////// -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib]] -////////////////////////////////////////////////////////////////////// -// For a source directory, build a single Makefile with rules to build -// each target. - -#if $[build_directory] - // We need to know the various targets we'll be building. - // $[lib_targets] will be the list of dynamic and static libraries, - // and $[bin_targets] the list of binaries. $[test_bin_targets] is - // the list of binaries that are to be built only when specifically - // asked for. - #define lib_targets $[active_target_libprefext(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target noinst_lib_target):%=$[ODIR]/%] - #define bundle_targets $[active_target_bundleext(metalib_target):%=$[ODIR]/%] - - #define bin_targets $[active_target(bin_target noinst_bin_target sed_bin_target):%=$[ODIR]/%] - #define test_bin_targets $[active_target(test_bin_target):%=$[ODIR]/%] - - // And these variables will define the various things we need to - // install. - #define install_lib $[active_target(metalib_target lib_target ss_lib_target static_lib_target)] - #define install_bin $[active_target(bin_target)] - #define install_scripts $[sort $[INSTALL_SCRIPTS(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_SCRIPTS]] - #define install_modules $[sort $[INSTALL_MODULES(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_MODULES]] - #define install_headers $[sort $[INSTALL_HEADERS(metalib_target lib_target ss_lib_target static_lib_target bin_target)] $[INSTALL_HEADERS]] - #define install_parser_inc $[sort $[INSTALL_PARSER_INC]] - #define install_data $[sort $[INSTALL_DATA(metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target bin_target)] $[INSTALL_DATA]] - #define install_config $[sort $[INSTALL_CONFIG(metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target bin_target)] $[INSTALL_CONFIG]] - #define install_igatedb $[sort $[get_igatedb(metalib_target lib_target ss_lib_target)]] - - // These are the various sources collected from all targets within the - // directory. - #define st_sources $[sort $[compile_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - #define yxx_st_sources $[sort $[yxx_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - #define dep_sources_1 $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target)]] - - // These are the source files that our dependency cache file will - // depend on. If it's an empty list, we won't bother writing rules to - // freshen the cache file. - #define dep_sources $[sort $[filter %.c %.cxx %.mm %.yxx %.lxx %.h %.I %.T,$[dep_sources_1]]] - - // If there is an __init__.py in the directory, then all Python - // files in the directory just get installed without having to be - // named. - #if $[and $[INSTALL_PYTHON_SOURCE],$[wildcard $[TOPDIR]/$[DIRPREFIX]__init__.py]] - #define py_sources $[wildcard $[TOPDIR]/$[DIRPREFIX]*.py] - #endif - #define install_py $[py_sources:$[TOPDIR]/$[DIRPREFIX]%=%] - -#endif // $[build_directory] - -#defer actual_local_libs $[complete_local_libs] - -// $[static_lib_dependencies] is the set of libraries we will link -// with that happen to be static libs. We will introduce dependency -// rules for these. (We don't need dependency rules for dynamic libs, -// since these don't get burned in at build time.) -#defer static_lib_dependencies $[all_libs $[if $[lib_is_static],$[RELDIR:%=%/$[ODIR]/$[lib_prefix]$[TARGET]$[dllext]$[lib_ext]]],$[complete_local_libs]] - -// $[target_ipath] is the proper ipath to put on the command line, -// from the context of a particular target. - -#defer target_ipath $[TOPDIR] $[sort $[complete_ipath]] $[other_trees_include] $[get_ipath] - -// These are the complete set of extra flags the compiler requires. -#defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]] -#defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] -#defer lflags $[get_lflags] $[LFLAGS] $[LFLAGS_OPT$[OPTIMIZE]] - -// $[complete_lpath] is rather like $[complete_ipath]: the list of -// directories (from within this tree) we should add to our -L list. -#defer complete_lpath $[libs $[RELDIR:%=%/$[ODIR]],$[actual_local_libs]] $[EXTRA_LPATH] - -// $[lpath] is like $[target_ipath]: it's the list of directories we -// should add to our -L list, from the context of a particular target. -#defer lpath $[sort $[complete_lpath]] $[other_trees_lib] $[install_lib_dir] $[get_lpath] - -// And $[libs] is the set of libraries we will link with. -#defer nonunique_libs $[nonunique_complete_local_libs:%=%$[dllext]] $[patsubst %:m,,%:c %,%$[dllext],$[OTHER_LIBS]] $[get_libs] - -// Don't use $[unique] here, since some libraries actually do need to be -// named multiple times (when linking static). -#if $[LINK_ALL_STATIC] - #defer libs $[nonunique_libs] -#else - #defer libs $[unique $[nonunique_libs]] -#endif - -// And $[frameworks] is the set of OSX-style frameworks we will link with. -#defer frameworks $[unique $[get_frameworks]] -#defer bin_frameworks $[unique $[get_frameworks] $[all_libs $[get_frameworks],$[complete_local_libs]]] -//#defer bin_frameworks $[unique $[get_frameworks]] - -// This is the set of files we might copy into *.prebuilt, if we have -// bison and flex (or copy from *.prebuilt if we don't have them). -#define bison_prebuilt $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] - -// Rather than making a rule to generate each install directory later, -// we create the directories now. This reduces problems from -// multiprocess builds. -#mkdir $[sort \ - $[if $[install_lib],$[install_lib_dir]] \ - $[if $[install_bin] $[install_scripts],$[install_bin_dir]] \ - $[if $[install_lib] $[install_modules],$[install_lib_dir]] \ - $[if $[install_headers],$[install_headers_dir]] \ - $[if $[install_parser_inc],$[install_parser_inc_dir]] \ - $[if $[install_data],$[install_data_dir]] \ - $[if $[install_config],$[install_config_dir]] \ - $[if $[install_igatedb],$[install_igatedb_dir]] \ - $[if $[install_py],$[install_py_dir] $[install_py_package_dir]] \ - ] - -// Similarly, we need to ensure that $[ODIR] exists. Trying to make -// the makefiles do this automatically just causes problems with -// multiprocess builds. -#mkdir $[ODIR] - -// Pre-compiled headers are one way to speed the compilation of many -// C++ source files that include similar headers, but it turns out a -// more effective (and more portable) way is simply to compile all the -// similar source files in one pass. - -// We do this by generating a *_composite.cxx file that has an -// #include line for each of several actual source files, and then we -// compile the composite file instead of the original files. -#foreach composite_file $[composite_list] -#output $[composite_file] notouch -#format collapse -/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */ -/* ################################# DO NOT EDIT ########################### */ - -#foreach file $[$[composite_file]_sources] -#if $[USE_TAU] -// For the benefit of Tau, we copy the source file verbatim into the -// composite file. (Tau doesn't instrument files picked up via #include.) -#copy $[DIRPREFIX]$[file] - -#else -##include "$[file]" -#endif // USE_TAU -#end file - -#end $[composite_file] -#end composite_file - -// Okay, we're ready. Start outputting the Makefile now. -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -#if $[and $[USE_TAU],$[TAU_MAKEFILE]] -include $[TAU_MAKEFILE] -#endif - -// If we are using GNU make, this will automatically enable the -// multiprocessor build mode according to the value in -// NUMBER_OF_PROCESSORS, which should be set by NT. Maybe this isn't -// a good idea to do all the time, but you can always disable it by -// explicitly unsetting NUMBER_OF_PROCESSORS, or by setting it to 1. -//#if $[NUMBER_OF_PROCESSORS] -//MAKEFLAGS := -j$[NUMBER_OF_PROCESSORS] -//#endif - -// The 'all' rule makes all the stuff in the directory except for the -// test_bin_targets. It doesn't do any installation, however. -#define all_targets \ - Makefile \ - $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \ - $[sort $[lib_targets] $[bundle_targets] $[bin_targets]] -all : $[all_targets] - -// The 'test' rule makes all the test_bin_targets. -test : $[test_bin_targets] - -clean : clean-igate -#forscopes metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[compile_sources] -$[TAB] rm -f $[patsubst %,$[%_obj],$[compile_sources]] -#endif -#end metalib_target lib_target noinst_lib_target static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[lib_targets] $[bundle_targets] $[bin_targets] $[test_bin_targets] -$[TAB] rm -f $[lib_targets] $[bundle_targets] $[bin_targets] $[test_bin_targets] -#endif -#if $[yxx_st_sources] $[lxx_st_sources] -$[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] -#endif -#if $[py_sources] -$[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code. -#endif -#if $[USE_TAU] -$[TAB] rm -f *.pdb *.inst.* // scrub out tau-generated files. -#endif - -// 'cleanall' is intended to undo all the effects of running ppremake -// and building. It removes everything except the Makefile. -cleanall : clean -#if $[st_sources] -$[TAB] rm -rf $[ODIR] -#endif -#if $[ne $[DEPENDENCY_CACHE_FILENAME],] -$[TAB] rm -f $[DEPENDENCY_CACHE_FILENAME] -#endif -#if $[composite_list] -$[TAB] rm -f $[composite_list] -#endif - -clean-igate : -#forscopes metalib_target lib_target ss_lib_target dynamic_lib_target - #define igatedb $[get_igatedb] - #define igateoutput $[get_igateoutput] - #define igatemscan $[get_igatemscan] - #define igatemout $[get_igatemout] - #if $[igatedb] -$[TAB] rm -f $[igatedb] - #endif - #if $[igateoutput] -$[TAB] rm -f $[igateoutput] $[$[igateoutput]_obj] - #endif - #if $[igatemout] -$[TAB] rm -f $[igatemout] $[$[igatemout]_obj] - #endif -#end metalib_target lib_target ss_lib_target dynamic_lib_target - -// Now, 'install' and 'uninstall'. These simply copy files into the -// install directory (or remove them). The 'install' rule also makes -// the directories if necessary. -#define installed_files \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_PARSER_INC:%=$[install_parser_inc_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[if $[install_py],$[install_py:%=$[install_py_dir]/%] $[install_py_package_dir]/__init__.py] - -#define installed_igate_files \ - $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%] - -#define install_targets \ - $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=install-lib%] \ - $[active_target(bin_target sed_bin_target):%=install-%] \ - $[installed_files] - -install : all $[install_targets] - -install-igate : $[sort $[installed_igate_files]] - -uninstall : $[active_target(metalib_target lib_target static_lib_target dynamic_lib_target ss_lib_target):%=uninstall-lib%] $[active_target(bin_target):%=uninstall-%] -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -uninstall-igate : -#if $[installed_igate_files] -$[TAB] rm -f $[sort $[installed_igate_files]] -#endif - -#if $[HAVE_BISON] -prebuild-bison : $[patsubst %,%.prebuilt,$[bison_prebuilt]] -clean-prebuild-bison : -#if $[bison_prebuilt] -$[TAB] rm -f $[sort $[patsubst %,%.prebuilt,$[bison_prebuilt]]] -#endif -#endif - -// Now it's time to start generating the rules to make our actual -// targets. - -igate : $[get_igatedb(metalib_target lib_target ss_lib_target)] - - -///////////////////////////////////////////////////////////////////// -// First, the normally installed dynamic and static libraries. -///////////////////////////////////////////////////////////////////// - -#forscopes metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target - -// In Unix, we always build all the libraries, unlike Windows. -#define build_it 1 - -// We don't need a BUILDING_ symbol for Unix; that's a Windows thing. -#define building_var - -// $[igatescan] is the set of C++ headers and source files that we -// need to scan for interrogate. $[igateoutput] is the name of the -// generated .cxx file that interrogate will produce (and which we -// should compile into the library). $[igatedb] is the name of the -// generated .in file that interrogate will produce (and which should -// be installed into the /etc directory). -#define igatescan $[get_igatescan] -#define igateoutput $[get_igateoutput] -#define igatedb $[get_igatedb] - -// If this is a metalib, it may have a number of components that -// include interrogated interfaces. If so, we need to generate a -// 'module' file within this library. This is mainly necessary for -// Python; it contains a table of all of the interrogated functions, -// so we can load the library as a Python module and have access to -// the interrogated functions. - -// $[igatemscan] is the set of .in files generated by all of our -// component libraries. If it is nonempty, then we do need to -// generate a module, and $[igatemout] is the name of the .cxx file -// that interrogate will produce to make this module. -#define igatemscan $[get_igatemscan] -#define igatemout $[get_igatemout] - -#if $[build_it] - // Now output the rule to actually link the library from all of its - // various .obj files. - - #define sources \ - $[patsubst %,$[%_obj],$[c_sources] $[mm_sources] $[cxx_sources]] - #define interrogate_sources \ - $[patsubst %,$[%_obj],$[cxx_interrogate_sources]] - #define cc_ld $[or $[get_ld],$[CC]] - #define cxx_ld $[or $[get_ld],$[CXX]] - - #define varname $[subst -,_,.,_,$[lib_prefix]$[TARGET]$[lib_ext]] -$[varname] = $[sources] $[if $[not $[link_extra_bundle]],$[interrogate_sources]] - #define target $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] - #define sources $($[varname]) - -$[target] : $[sources] $[static_lib_dependencies] - #if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] - #else -$[TAB] $[link_lib_c] - #endif - - #if $[link_extra_bundle] - // Also generate the bundles (on OSX only). - #define target $[ODIR]/$[lib_prefix]$[TARGET]$[bundle_ext] - #define sources $[interrogate_sources] $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] -$[target] : $[sources] $[static_lib_dependencies] -$[TAB] $[BUNDLE_LIB_C++] - #endif // BUNDLE_EXT -#endif - -// Here are the rules to install and uninstall the library and -// everything that goes along with it. -#define installed_files \ - $[install_lib_dir]/$[lib_prefix]$[TARGET]$[lib_ext] \ - $[if $[link_extra_bundle],$[install_lib_dir]/$[lib_prefix]$[TARGET]$[bundle_ext]] \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] \ - $[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] - -install-lib$[TARGET] : $[installed_files] - -uninstall-lib$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_lib_dir]/$[lib_prefix]$[TARGET]$[lib_ext] : $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] -#define local $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] -#define dest $[install_lib_dir] -$[TAB] $[INSTALL_PROG] - -#if $[link_extra_bundle] -$[install_lib_dir]/$[lib_prefix]$[TARGET]$[bundle_ext] : $[ODIR]/$[lib_prefix]$[TARGET]$[bundle_ext] -#define local $[ODIR]/$[lib_prefix]$[TARGET]$[bundle_ext] -#define dest $[install_lib_dir] -$[TAB] $[INSTALL_PROG] -#endif // link_extra_bundle - -#if $[igatescan] -// Now, some additional rules to generate and compile the interrogate -// data, if needed. - -// The library name is based on this library. -#define igatelib $[lib_prefix]$[TARGET] -// The module name comes from the metalib that includes this library. -#define igatemod $[module $[TARGET],$[TARGET]] -#if $[eq $[igatemod],] - // Unless no metalib includes this library. - #define igatemod $[TARGET] -#endif - -$[igatedb:$[ODIR]/%=$[install_igatedb_dir]/%] : $[igatedb] -#define local $[igatedb] -#define dest $[install_igatedb_dir] -$[TAB] $[INSTALL] - -// We have to split this out as a separate rule to properly support -// parallel make. -$[igatedb] : $[igateoutput] - -$[lib_prefix]$[TARGET]_igatescan = $[igatescan] -$[igateoutput] : $[sort $[patsubst %.h,%.h,%.I,%.I,%.T,%.T,%,,$[dependencies $[igatescan]] $[igatescan:%=./%]]] -$[TAB] $[INTERROGATE] -od $[igatedb] -oc $[igateoutput] $[interrogate_options] -module "$[igatemod]" -library "$[igatelib]" $($[lib_prefix]$[TARGET]_igatescan) - -#endif // igatescan - - -#if $[igatemout] -// And finally, some additional rules to build the interrogate module -// file into the library, if this is a metalib that includes -// interrogated components. - -#define igatelib $[lib_prefix]$[TARGET] -#define igatemod $[TARGET] - -$[lib_prefix]$[TARGET]_igatemscan = $[igatemscan] -#define target $[igatemout] -#define sources $($[lib_prefix]$[TARGET]_igatemscan) - -$[target] : $[sources] -$[TAB] $[INTERROGATE_MODULE] -oc $[target] -module "$[igatemod]" -library "$[igatelib]" $[interrogate_module_options] $[sources] - -#endif // igatemout - -#end metalib_target lib_target ss_lib_target static_lib_target dynamic_lib_target - - - - -///////////////////////////////////////////////////////////////////// -// Now, the noninstalled dynamic libraries. These are presumably used -// only within this directory, or at the most within this tree, and -// also presumably will never include interrogate data. That, plus -// the fact that we don't need to generate install rules, makes it a -// lot simpler. -///////////////////////////////////////////////////////////////////// - -#forscopes noinst_lib_target -#define varname $[subst -,_,$[lib_prefix]$[TARGET]_so] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[lib_prefix]$[TARGET]$[lib_ext] -#define sources $($[varname]) -$[target] : $[sources] $[static_lib_dependencies] -#if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_lib_c++] -#else -$[TAB] $[link_lib_c] -#endif - -#end noinst_lib_target - - -///////////////////////////////////////////////////////////////////// -// The sed_bin_targets are a special bunch. These are scripts that -// are to be preprocessed with sed before being installed, for -// instance to insert a path or something in an appropriate place. -///////////////////////////////////////////////////////////////////// - -#forscopes sed_bin_target -$[TARGET] : $[ODIR]/$[TARGET] - -#define target $[ODIR]/$[TARGET] -#define source $[SOURCE] -#define script $[COMMAND] -$[target] : $[source] -$[TAB] $[SED] -$[TAB] chmod +x $[target] - -#define installed_files \ - $[install_bin_dir]/$[TARGET] - -install-$[TARGET] : $[installed_files] - -uninstall-$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -#define local $[ODIR]/$[TARGET] -#define dest $[install_bin_dir] -$[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET] -$[TAB] $[INSTALL_PROG] - -#end sed_bin_target - - -///////////////////////////////////////////////////////////////////// -// And now, the bin_targets. These are normal C++ executables. No -// interrogate, metalibs, or any such nonsense here. -///////////////////////////////////////////////////////////////////// - -#forscopes bin_target -$[TARGET] : $[ODIR]/$[TARGET] - -#define varname $[subst -,_,bin_$[TARGET]] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[TARGET] -#define sources $($[varname]) -#define cc_ld $[or $[get_ld],$[CC]] -#define cxx_ld $[or $[get_ld],$[CXX]] -#define flags $[lflags] -$[target] : $[sources] $[static_lib_dependencies] -#if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_bin_c++] -#else -$[TAB] $[link_bin_c] -#endif - -#define installed_files \ - $[install_bin_dir]/$[TARGET] \ - $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ - $[INSTALL_MODULES:%=$[install_lib_dir]/%] \ - $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ - $[INSTALL_DATA:%=$[install_data_dir]/%] \ - $[INSTALL_CONFIG:%=$[install_config_dir]/%] - -install-$[TARGET] : $[installed_files] - -uninstall-$[TARGET] : -#if $[installed_files] -$[TAB] rm -f $[sort $[installed_files]] -#endif - -$[install_bin_dir]/$[TARGET] : $[ODIR]/$[TARGET] -#define local $[ODIR]/$[TARGET] -#define dest $[install_bin_dir] -$[TAB] $[INSTALL_PROG] - -#end bin_target - - - -///////////////////////////////////////////////////////////////////// -// The noinst_bin_targets and the test_bin_targets share the property -// of being built (when requested), but having no install rules. -///////////////////////////////////////////////////////////////////// - -#forscopes noinst_bin_target test_bin_target -$[TARGET] : $[ODIR]/$[TARGET] - -#define varname $[subst -,_,bin_$[TARGET]] -$[varname] = $[patsubst %,$[%_obj],$[compile_sources]] -#define target $[ODIR]/$[TARGET] -#define sources $($[varname]) -#define cc_ld $[or $[get_ld],$[CC]] -#define cxx_ld $[or $[get_ld],$[CXX]] -#define flags $[lflags] -$[target] : $[sources] $[static_lib_dependencies] -#if $[filter %.mm %.cxx %.yxx %.lxx,$[get_sources]] -$[TAB] $[link_bin_c++] -#else -$[TAB] $[link_bin_c] -#endif - -#end noinst_bin_target test_bin_target - - - -///////////////////////////////////////////////////////////////////// -// Rules to run bison and/or flex as needed. -///////////////////////////////////////////////////////////////////// - -// Rules to generate a C++ file from a Bison input file. -#foreach file $[sort $[yxx_st_sources]] -#define target $[patsubst %.yxx,%.cxx,$[file]] -#define target_header $[patsubst %.yxx,%.h,$[file]] -#define target_prebuilt $[target].prebuilt -#define target_header_prebuilt $[target_header].prebuilt -#if $[HAVE_BISON] -$[target] : $[file] -$[TAB] $[BISON] $[YFLAGS] -y $[if $[YACC_PREFIX],-d --name-prefix=$[YACC_PREFIX]] $[file] -$[TAB] mv y.tab.c $[target] -$[TAB] mv y.tab.h $[target_header] -$[target_header] : $[target] -$[target_prebuilt] : $[target] -$[TAB] cp $[target] $[target_prebuilt] -$[target_header_prebuilt] : $[target_header] -$[TAB] cp $[target_header] $[target_header_prebuilt] -#else // HAVE_BISON -$[target] : $[target_prebuilt] -$[TAB] cp $[target_prebuilt] $[target] -$[target_header] : $[target_header_prebuilt] -$[TAB] cp $[target_header_prebuilt] $[target_header] -#endif // HAVE_BISON - -#end file - -// Rules to generate a C++ file from a Flex input file. -#foreach file $[sort $[lxx_st_sources]] -#define target $[patsubst %.lxx,%.cxx,$[file]] -#define target_prebuilt $[target].prebuilt -#if $[HAVE_BISON] -#define source $[file] -$[target] : $[file] -$[TAB] $[FLEX] $[FLEXFLAGS] $[if $[YACC_PREFIX],-P$[YACC_PREFIX]] -olex.yy.c $[file] -#define source lex.yy.c -#define script /#include /d -$[TAB] $[SED] -$[TAB] rm lex.yy.c -$[target_prebuilt] : $[target] -$[TAB] cp $[target] $[target_prebuilt] -#else // HAVE_BISON -$[target] : $[target_prebuilt] -$[TAB] cp $[target_prebuilt] $[target] -#endif // HAVE_BISON - -#end file - - -///////////////////////////////////////////////////////////////////// -// Finally, we put in the rules to compile each source file into a .obj -// file. -///////////////////////////////////////////////////////////////////// - -#forscopes static_lib_target bin_target noinst_bin_target test_bin_target - -// Rules to compile ordinary C files (static objects). -#foreach file $[sort $[c_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[cflags] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -$[target] : $[source] $[get_depends $[source]] -$[TAB] $[compile_c] - -#end file - -// Rules to compile C++ files (static objects). - -#foreach file $[sort $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[c++flags] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -// Yacc must run before some files can be compiled, so all files -// depend on yacc having run. -$[target] : $[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h] -$[TAB] $[compile_c++] - -#end file - -#end static_lib_target bin_target noinst_bin_target test_bin_target - -#forscopes metalib_target lib_target noinst_lib_target ss_lib_target - -// Rules to compile ordinary C files (shared objects). -#foreach file $[sort $[c_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[cflags] $[CFLAGS_SHARED] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -$[target] : $[source] $[get_depends $[source]] -$[TAB] $[compile_c] - -#end file - -// Rules to compile C++ files (shared objects). - -#foreach file $[sort $[mm_sources] $[cxx_sources] $[cxx_interrogate_sources]] -#define target $[$[file]_obj] -#define source $[file] -#define ipath $[target_ipath] -#define flags $[c++flags] $[CFLAGS_SHARED] -#if $[ne $[file], $[notdir $file]] - // If the source file is not in the current directory, tack on "." - // to front of the ipath. - #set ipath . $[ipath] -#endif - -// Yacc must run before some files can be compiled, so all files -// depend on yacc having run. -$[target] : $[source] $[get_depends $[source]] $[yxx_sources:%.yxx=%.h] -$[TAB] $[compile_c++] - -#end file - -#end metalib_target lib_target noinst_lib_target ss_lib_target - -// And now the rules to install the auxiliary files, like headers and -// data files. -#foreach file $[install_scripts] -$[install_bin_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_bin_dir] -$[TAB] $[INSTALL_PROG] -#end file - -#foreach file $[install_modules] -$[install_lib_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_lib_dir] -$[TAB] $[INSTALL_PROG] -#end file - -#foreach file $[install_headers] -$[install_headers_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_headers_dir] -$[TAB] $[INSTALL] -#end file - -#foreach file $[install_parser_inc] -#if $[ne $[dir $[file]], ./] -$[install_parser_inc_dir]/$[file] : $[notdir $[file]] - #define local $[notdir $[file]] - #define dest $[install_parser_inc_dir]/$[dir $[file]] -$[TAB] mkdir -p $[install_parser_inc_dir]/$[dir $[file]] || echo -$[TAB] $[INSTALL] -#else -$[install_parser_inc_dir]/$[file] : $[file] - #define local $[file] - #define dest $[install_parser_inc_dir] -$[TAB] $[INSTALL] -#endif -#end file - -#foreach file $[install_data] -$[install_data_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_data_dir] -$[TAB] $[INSTALL] -#end file - -#foreach file $[install_config] -$[install_config_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_config_dir] -$[TAB] $[INSTALL] -#end file - -#foreach file $[install_py] -$[install_py_dir]/$[file] : $[file] -#define local $[file] -#define dest $[install_py_dir] -$[TAB] $[INSTALL] -#end file - -#if $[install_py] -$[install_py_package_dir]/__init__.py : -$[TAB] touch $[install_py_package_dir]/__init__.py -#endif - -// Finally, all the special targets. These are commands that just need -// to be invoked; we don't pretend to know what they are. -#forscopes special_target -$[TARGET] : -$[TAB] $[COMMAND] - -#end special_target - - -// Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] -$[TAB] ppremake - -#if $[USE_TAU] -#foreach composite_file $[composite_list] -$[composite_file] : $[$[composite_file]_sources] -$[TAB] ppremake -#end composite_file -#endif // USE_TAU - -#if $[and $[DEPENDENCY_CACHE_FILENAME],$[dep_sources]] -$[DEPENDENCY_CACHE_FILENAME] : $[dep_sources] -$[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME] -#endif - -#end Makefile - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], group] -////////////////////////////////////////////////////////////////////// - -// This is a group directory: a directory above a collection of source -// directories, e.g. $DTOOL/src. We don't need to output anything in -// this directory. - - - -////////////////////////////////////////////////////////////////////// -#elif $[eq $[DIR_TYPE], toplevel] -////////////////////////////////////////////////////////////////////// - -// This is the toplevel directory, e.g. $DTOOL. Here we build the -// root makefile and also synthesize the dtool_config.h (or whichever -// file) we need. - -#map subdirs -// Iterate through all of our known source files. Each src and -// metalib type file gets its corresponding Makefile listed -// here. However, we test for $[DIR_TYPE] of toplevel, because the -// source directories typically don't define their own DIR_TYPE -// variable, and they end up inheriting this one dynamically. -#forscopes */ -#if $[or $[eq $[DIR_TYPE], src],$[eq $[DIR_TYPE], metalib],$[and $[eq $[DIR_TYPE], toplevel],$[ne $[DIRNAME],top]]] -#if $[build_directory] - #addmap subdirs $[DIRNAME] -#endif -#endif -#end */ - -#if $[PYTHON_PACKAGE] -#include $[THISDIRPREFIX]PythonPackageInit.pp -#endif - -#output Makefile -#format makefile -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. -################################# DO NOT EDIT ########################### - -all : $[subdirs] -test : $[subdirs:%=test-%] -igate : $[subdirs:%=igate-%] -clean : $[subdirs:%=clean-%] -clean-igate : $[subdirs:%=clean-igate-%] -cleanall : $[subdirs:%=cleanall-%] -install : $[if $[CONFIG_HEADER],$[install_headers_dir] $[install_headers_dir]/$[CONFIG_HEADER]] $[subdirs:%=install-%] -install-igate : $[subdirs:%=install-igate-%] -uninstall : $[subdirs:%=uninstall-%] -#if $[CONFIG_HEADER] -$[TAB] rm -f $[install_headers_dir]/$[CONFIG_HEADER] -#endif -uninstall-igate : $[subdirs:%=uninstall-igate-%] - -#if $[HAVE_BISON] -prebuild-bison : $[subdirs:%=prebuild-bison-%] -clean-prebuild-bison : $[subdirs:%=clean-prebuild-bison-%] -#endif - -#formap dirname subdirs -#define depends -$[dirname] : $[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]] -$[TAB] cd ./$[PATH] && $(MAKE) all -#end dirname - -#formap dirname subdirs -test-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) test -#end dirname - -#formap dirname subdirs -igate-$[dirname] : -$[TAB]cd ./$[PATH] && $(MAKE) igate -#end dirname - -#formap dirname subdirs -clean-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) clean -#end dirname - -#formap dirname subdirs -clean-igate-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) clean-igate -#end dirname - -#formap dirname subdirs -cleanall-$[dirname] : $[patsubst %,cleanall-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd ./$[PATH] && $(MAKE) cleanall -#end dirname - -#formap dirname subdirs -install-$[dirname] : $[patsubst %,install-%,$[dirnames $[if $[build_directory],$[DIRNAME]],$[DEPEND_DIRS]]] -$[TAB] cd ./$[PATH] && $(MAKE) install -#end dirname - -#formap dirname subdirs -install-igate-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) install-igate -#end dirname - -#formap dirname subdirs -uninstall-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) uninstall -#end dirname - -#formap dirname subdirs -uninstall-igate-$[dirname] : -$[TAB] cd ./$[PATH] && $(MAKE) uninstall-igate -#end dirname - -#if $[HAVE_BISON] -#formap dirname subdirs -prebuild-bison-$[dirname] : -$[TAB]cd ./$[PATH] && $(MAKE) prebuild-bison -clean-prebuild-bison-$[dirname] : -$[TAB]cd ./$[PATH] && $(MAKE) clean-prebuild-bison -#end dirname -#endif - -#if $[ne $[CONFIG_HEADER],] -$[install_headers_dir] : -$[TAB] @test -d $[install_headers_dir] || echo mkdir -p $[install_headers_dir] -$[TAB] @test -d $[install_headers_dir] || mkdir -p $[install_headers_dir] - -$[install_headers_dir]/$[CONFIG_HEADER] : $[CONFIG_HEADER] -#define local $[CONFIG_HEADER] -#define dest $[install_headers_dir] -$[TAB] $[INSTALL] -#endif - -// Finally, the rules to freshen the Makefile itself. -Makefile : $[SOURCE_FILENAME] $[EXTRA_PPREMAKE_SOURCE] -$[TAB] ppremake - -#end Makefile - -// If there is a file called LocalSetup.pp in the package's top -// directory, then invoke that. It might contain some further setup -// instructions. -#sinclude $[TOPDIRPREFIX]LocalSetup.unix.pp -#sinclude $[TOPDIRPREFIX]LocalSetup.pp - - -////////////////////////////////////////////////////////////////////// -#elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]] -////////////////////////////////////////////////////////////////////// - -#include $[THISDIRPREFIX]Template.models.pp - -////////////////////////////////////////////////////////////////////// -#endif // DIR_TYPE diff --git a/dtool/pptempl/compilerSettings.pp b/dtool/pptempl/compilerSettings.pp deleted file mode 100644 index b9ce84b782..0000000000 --- a/dtool/pptempl/compilerSettings.pp +++ /dev/null @@ -1,419 +0,0 @@ -#print Generating for $[USE_COMPILER] - - -////////////////////////////// -// MICROSOFT VISUAL C++ 6.0 // -////////////////////////////// -#if $[eq $[USE_COMPILER], MSVC] - #define COMPILER cl - #define LINKER link - #define LIBBER lib - #define COMMONFLAGS /Gi- - - // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined - #define OPTFLAGS /O2 /Ob1 /G7 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,] - #define OPT1FLAGS /GZ - - // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead - #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]" - #defer DEBUGFLAGS /MDd $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS] - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - #define WARNING_LEVEL_FLAG /Wall - - // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs - #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF - #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4] - - #define MAPINFOFLAGS /MAPINFO:EXPORTS /MAPINFO:FIXUPS /MAPINFO:LINES - - #if $[ENABLE_PROFILING] - // note according to docs, this should force /PDB:none /DEBUGTYPE:cv, so no pdb file is generated for debug?? (doesnt seem to be true) - #define PROFILE_FLAG /PROFILE - #else - #define PROFILE_FLAG - #endif - - // Note: all Opts will link w/debug info now - #define LINKER_FLAGS /DEBUG /DEBUGTYPE:CV $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304 /WARN:3 - - // Added to avoid old iostream reference problems - #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB - -// for mixed intel/msvc build, add these -// #define EXTRA_LIBPATH /ia32/lib -// #define EXTRA_INCPATH /ia32/include - - #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]] - #define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS] - #endif - - // ensure pdbs are copied to install dir - #define build_pdbs yes - - -//////////////////////////////////////////////////////////////////// -// MICROSOFT VISUAL C++ 7.0, 7.1, & 8.0 (.NET, .NET 2003, & 2005) // -//////////////////////////////////////////////////////////////////// -#elif $[or $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]], $[eq $[USE_COMPILER],MSVC8]] - #define COMPILER cl - #define LINKER link - #define LIBBER lib - - #if $[eq $[NO_CROSSOBJ_OPT],] - #define DO_CROSSOBJ_OPT 1 - #endif - - #if $[DO_CROSSOBJ_OPT] - #define OPT4FLAGS /GL - #define LDFLAGS_OPT4 /LTCG - #if $[>= $[OPTIMIZE],4] - #define LIBBER $[LIBBER] /LTCG - #endif - #endif - - #define CDEFINES_OPT1 - #define CDEFINES_OPT2 - #define CDEFINES_OPT3 - #define CDEFINES_OPT4 - - // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs - - #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF - #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4] - - #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope - - // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined - #if $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]] - #define REGULAR_OPTFLAGS /O2 /Ob2 /G7 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,] - #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL /G7,$[REGULAR_OPTFLAGS]] - #else - #define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,] - #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL,$[REGULAR_OPTFLAGS]] - #endif - - // #define OPT1FLAGS /RTCsu /GS removing /RTCu because it crashes in dxgsg with internal compiler bug - #define OPT1FLAGS /RTCs /GS - - #define WARNING_LEVEL_FLAG /W3 // WL - //#define WARNING_LEVEL_FLAG /Wall - //#define WARNING_LEVEL_FLAG /W4 /WX - - // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead - #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]" - - // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version - // for both Opt1 and Opt4!) instead of the msvcrt dlls - - #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MTd, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS] - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - - #if $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]] - #define MAPINFOFLAGS /MAPINFO:EXPORTS /MAPINFO:LINES - #else - #define MAPINFOFLAGS /MAPINFO:EXPORTS - #endif - - #if $[ENABLE_PROFILING] - #define PROFILE_FLAG /FIXED:NO - #else - #define PROFILE_FLAG - #endif - - #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]] - #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING] - #endif - - // Note: all Opts will link w/debug info now - #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304 - - // Added to avoid old iostream reference problems - #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB - #if $[eq $[USE_COMPILER],MSVC8] - #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc - #endif -// #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcprt.lib - -// in case we have mixed intel/msvc build -// #define EXTRA_LIBPATH /ia32/lib -// #define EXTRA_INCPATH /ia32/include - - // ensure pdbs are copied to install dir - #define build_pdbs yes - - -///////////////////////////////////// -// MICROSOFT VISUAL C++ 9.0 (2008) // -///////////////////////////////////// -#elif $[eq $[USE_COMPILER], MSVC9] - #define COMPILER cl - #define LINKER link - #define LIBBER lib - #define MT_BIN mt - - #if $[eq $[NO_CROSSOBJ_OPT],] - #define DO_CROSSOBJ_OPT 1 - #endif - - #if $[DO_CROSSOBJ_OPT] - #define OPT4FLAGS /GL - #define LDFLAGS_OPT4 /LTCG - #if $[>= $[OPTIMIZE],4] - #define LIBBER $[LIBBER] /LTCG - #endif - #endif - - #define CDEFINES_OPT1 - #define CDEFINES_OPT2 - #define CDEFINES_OPT3 - #define CDEFINES_OPT4 - - // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs - - #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF - #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4] - - #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope /bigobj - - // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined - #define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,] - - #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL,$[REGULAR_OPTFLAGS]] - - // #define OPT1FLAGS /RTCsu /GS removing /RTCu because it crashes in dxgsg with internal compiler bug - #define OPT1FLAGS /RTCs /GS - - #define WARNING_LEVEL_FLAG /W3 // WL - - // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead - #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]" - - // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version - // for both Opt1 and Opt4!) instead of the msvcrt dlls - - #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MTd, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS] - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - - #define MAPINFOFLAGS /MAPINFO:EXPORTS - - #if $[ENABLE_PROFILING] - #define PROFILE_FLAG /FIXED:NO - #else - #define PROFILE_FLAG - #endif - - #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]] - #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING] - #endif - - // Note: all Opts will link w/debug info now - #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304 - - // Added to avoid old iostream reference problems - #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB - // Added to make pandatool function in VS 9 - #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc - // Added to generate manifest files even when no dependencies exist - #define LINKER_FLAGS $[LINKER_FLAGS] /MANIFEST - - // ensure pdbs are copied to install dir - #define build_pdbs yes - - - -/////////////////////////////////////////////////// -// MICROSOFT VISUAL C++ 9.0 (2008) 64-bit output // -/////////////////////////////////////////////////// -#elif $[eq $[USE_COMPILER], MSVC9x64] - #define COMPILER cl - #define LINKER link - #define LIBBER lib - #define MT_BIN mt - - #if $[eq $[NO_CROSSOBJ_OPT],] - #define DO_CROSSOBJ_OPT 1 - #endif - - #if $[DO_CROSSOBJ_OPT] - #define OPT4FLAGS /GL - #define LDFLAGS_OPT4 /LTCG - #if $[>= $[OPTIMIZE],4] - #define LIBBER $[LIBBER] /LTCG - #endif - #endif - - #define CDEFINES_OPT1 - #define CDEFINES_OPT2 - #define CDEFINES_OPT3 - #define CDEFINES_OPT4 - - // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs - - #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF - #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4] - - #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope /bigobj - - // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined - #define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,] - - #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL,$[REGULAR_OPTFLAGS]] - - // #define OPT1FLAGS /RTCsu /GS removing /RTCu because it crashes in dxgsg with internal compiler bug - #define OPT1FLAGS /RTCs /GS - - #define WARNING_LEVEL_FLAG /W3 // WL - - // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead - #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]" - - // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version - // for both Opt1 and Opt4!) instead of the msvcrt dlls - - #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MTd, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS] - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - - #define MAPINFOFLAGS /MAPINFO:EXPORTS - - #if $[ENABLE_PROFILING] - #define PROFILE_FLAG /FIXED:NO - #else - #define PROFILE_FLAG - #endif - - #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]] - #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING] - #endif - - // Note: all Opts will link w/debug info now - #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] $[if $[eq $[USE_COMPILER],MSVC9x64], /MACHINE:X64,] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304 - - // Added to avoid old iostream reference problems - #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB - // Added to make pandatool function in VS 9 - #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc - // Added to generate manifest files even when no dependencies exist - #define LINKER_FLAGS $[LINKER_FLAGS] /MANIFEST - - - // ensure pdbs are copied to install dir - #define build_pdbs yes - - -//////////////////// -// INTEL COMPILER // -//////////////////// -#elif $[eq $[USE_COMPILER], INTEL] - #define COMPILER icl - #define LINKER xilink - #define LIBBER xilib - #define COMMONFLAGS /DHAVE_DINKUM /Gi- /Qwd985 /Qvc7 /G6 - - // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead - #defer DEBUGPDBFLAGS /Zi /Qinline_debug_info /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]" - // Oy- needed for MS debugger - #defer DEBUGFLAGS /Oy- /MDd $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS] - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - #define WARNING_LEVEL_FLAG /W3 - - #if $[DO_CROSSOBJ_OPT] - #define OPT4FLAGS /Qipo - #define LDFLAGS_OPT4 /Qipo - #endif - - // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs - #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB - #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF - #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4] - -// #define OPTFLAGS /O3 /Qipo /QaxW /Qvec_report1 - #define OPTFLAGS /O3 /Qip - - // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined - #define OPTFLAGS $[OPTFLAGS] $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,] - - #define OPT1FLAGS /GZ /Od - // We assume the Intel compiler installation dir is mounted as /ia32. - #define EXTRA_LIBPATH /ia32/lib - #define EXTRA_INCPATH /ia32/include - - #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]] - #define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS] - #endif - - // Note: all Opts will link w/debug info now - #define LINKER_FLAGS /DEBUG /DEBUGTYPE:CV $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304 - - // Added to avoid old iostream reference problems - #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB - - // ensure pdbs are copied to install dir - #define build_pdbs yes - -#elif $[eq $[USE_COMPILER], BOUNDS] // NuMega BoundsChecker - #define COMPILER nmcl - #define LINKER nmlink - #define LIBBER lib - #define COMMONFLAGS - #define OPTFLAGS /O2 /Ogity /G6 - #define OPT1FLAGS /GZ - #defer DEBUGPDBFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]" - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - #define EXTRA_LIBPATH - #define EXTRA_INCPATH - #if $[BOUNDS_TRUETIME] // NuMega BoundsChecker TrueTime Profiler - // This may look like a bad thing (to extend the compiler - // and linker with a switch), but I think it's the right - // thing to do in this case -- skyler. - #define COMPILER $[COMPILER] /NMttOn - #define LINKER $[LINKER] /NMttOn - #endif - -#elif $[eq $[USE_COMPILER], TRUETIME] // NuMega TrueTime Profiler - // This may look like a bad thing (to extend the compiler - // and linker with a switch), but I think it's the right - // thing to do in this case -- skyler. - #define COMPILER nmcl /NMttOn - #define LINKER nmlink /NMttOn - #define LIBBER lib - #define COMMONFLAGS - #define OPTFLAGS /O2 /Ogity /G6 - #define OPT1FLAGS /GZ - #defer DEBUGPDBFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]" - #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD] - #define EXTRA_LIBPATH - #define EXTRA_INCPATH -#else - #error Invalid value specified for USE_COMPILER. -#endif - -#if $[CHECK_SYNTAX_ONLY] -#define END_CFLAGS $[END_CFLAGS] /Zs -#endif - -#if $[GEN_ASSEMBLY] -// Note: Opt4 /GL will cause /FAs to not generate .asm! Must remove /GL for /FAs to work! -#define END_CFLAGS $[END_CFLAGS] /FAs -#endif - -#if $[PREPROCESSOR_OUTPUT] -#define END_CFLAGS $[END_CFLAGS] /E -#endif - -#defer tau_opts $[decygwin %,-I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]] $[building_var:%=-D%] -#if $[eq $[USE_COMPILER], MSVC9x64] - #defer TAU_MAKE_IL $[PDT_ROOT]/Windows/bin/edgcpfe -o $[il_source] $[tau_opts] $[cdefines:%=-D%] $[C++FLAGS] -DWIN64=1 $[TAU_INSTRUMENTOR_FLAGS] $[source] -#else - #defer TAU_MAKE_IL $[PDT_ROOT]/Windows/bin/edgcpfe -o $[il_source] $[tau_opts] $[cdefines:%=-D%] $[C++FLAGS] -DWIN32=1 $[TAU_INSTRUMENTOR_FLAGS] $[source] -#endif -#defer TAU_MAKE_PDB $[PDT_ROOT]/Windows/bin/taucpdisp $[il_source] > $[pdb_source] -#defer TAU_MAKE_INST $[TAU_ROOT]/bin/tau_instrumentor $[pdb_source] $[source] -o $[inst_source] diff --git a/dtool/src/Sources.pp b/dtool/src/Sources.pp deleted file mode 100644 index fb8681dab2..0000000000 --- a/dtool/src/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group diff --git a/dtool/src/attach/Sources.pp b/dtool/src/attach/Sources.pp deleted file mode 100644 index 40a36fbd8f..0000000000 --- a/dtool/src/attach/Sources.pp +++ /dev/null @@ -1,27 +0,0 @@ -// This directory defines the ctattach tools, which are completely -// undocumented and are only intended for use by the VR Studio as a -// convenient way to manage development by multiple people within the -// various Panda source trees. These tools are not recommended for -// use by the rest of the world; it's probably not worth the headache -// of learning how to set them up. - -// Therefore, we only install the stuff in this directory if the -// builder is already using the ctattach tools. Otherwise, it's safe -// to assume s/he doesn't need the ctattach tools. - -#define BUILD_DIRECTORY $[CTPROJS] -#if $[CTPROJS] - #define INSTALL_HEADERS \ - ctattch.pl ctattch.pl.rnd ctunattach.pl ctquery.pl ctdelta.pl \ - ctdelta.pl.rnd unco.pl ctvspec.pl ctcm.pl ctccase.pl ctntool.pl \ - ctcvs.pl ctproj.pl ctutils.pl - - #define INSTALL_SCRIPTS \ - ctattach.drv ctunattach.drv ctquery ctdelta ctihave ctallihave \ - ctunco ctattachcc cttimewarp get-cttree update-cttree get-delta \ - ctsanity ctmkelem ctmkdir ctci ctco ctrm ctmv ctmake neartool - - #define INSTALL_CONFIG \ - dtool.cshrc dtool.init dtool.emacs dtool.alias \ - dtool.sh dtool.alias-sh -#endif diff --git a/dtool/src/cppparser/Sources.pp b/dtool/src/cppparser/Sources.pp deleted file mode 100644 index 46aa8634e9..0000000000 --- a/dtool/src/cppparser/Sources.pp +++ /dev/null @@ -1,44 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_INTERROGATE] - -#define LOCAL_LIBS p3dtoolutil p3dtoolbase -#define YACC_PREFIX cppyy - -#begin static_lib_target - #define TARGET p3cppParser - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - cppArrayType.h cppBison.yxx cppBisonDefs.h \ - cppClassTemplateParameter.h cppCommentBlock.h cppConstType.h \ - cppDeclaration.h cppEnumType.h cppExpression.h \ - cppExpressionParser.h cppExtensionType.h cppFile.h \ - cppFunctionGroup.h cppFunctionType.h cppGlobals.h \ - cppIdentifier.h cppInstance.h cppInstanceIdentifier.h \ - cppMakeProperty.h cppMakeSeq.h cppManifest.h \ - cppNameComponent.h cppNamespace.h \ - cppParameterList.h cppParser.h cppPointerType.h \ - cppPreprocessor.h cppReferenceType.h cppScope.h \ - cppSimpleType.h cppStructType.h cppTBDType.h \ - cppTemplateParameterList.h cppTemplateScope.h cppToken.h \ - cppType.h cppTypeDeclaration.h cppTypeParser.h \ - cppTypeProxy.h cppTypedefType.h cppUsing.h cppVisibility.h - - #define INCLUDED_SOURCES \ - cppArrayType.cxx cppClassTemplateParameter.cxx \ - cppCommentBlock.cxx cppConstType.cxx cppDeclaration.cxx \ - cppEnumType.cxx cppExpression.cxx cppExpressionParser.cxx \ - cppExtensionType.cxx cppFile.cxx cppFunctionGroup.cxx \ - cppFunctionType.cxx cppGlobals.cxx cppIdentifier.cxx \ - cppInstance.cxx cppInstanceIdentifier.cxx \ - cppMakeProperty.cxx cppMakeSeq.cxx cppManifest.cxx \ - cppNameComponent.cxx cppNamespace.cxx cppParameterList.cxx \ - cppParser.cxx cppPointerType.cxx cppPreprocessor.cxx \ - cppReferenceType.cxx cppScope.cxx cppSimpleType.cxx \ - cppStructType.cxx cppTBDType.cxx \ - cppTemplateParameterList.cxx cppTemplateScope.cxx \ - cppToken.cxx cppType.cxx cppTypeDeclaration.cxx \ - cppTypeParser.cxx cppTypeProxy.cxx cppTypedefType.cxx \ - cppUsing.cxx cppVisibility.cxx - -#end static_lib_target diff --git a/dtool/src/cppparser/cppBison.cxx.prebuilt b/dtool/src/cppparser/cppBison.cxx.prebuilt index 2f00575c4f..90f0cec6f9 100644 --- a/dtool/src/cppparser/cppBison.cxx.prebuilt +++ b/dtool/src/cppparser/cppBison.cxx.prebuilt @@ -797,7 +797,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 79 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 4452 +#define YYLAST 4493 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 141 @@ -935,8 +935,8 @@ static const yytype_int16 yyrhs[] = 104, 158, -1, 48, -1, 64, -1, 69, 120, -1, 90, 120, -1, 89, 120, -1, 88, 120, -1, 80, 135, 10, 118, 10, 137, 119, -1, 80, 135, 10, - 118, 10, 118, 10, 137, 119, -1, 81, 135, 232, - 118, 232, 118, 232, 137, 119, -1, 97, 135, 227, + 118, 10, 118, 10, 137, 119, -1, 81, 135, 10, + 118, 10, 118, 10, 137, 119, -1, 97, 135, 227, 118, 233, 137, -1, 97, 135, 227, 137, -1, -1, 72, 150, 148, -1, 234, -1, 67, 151, -1, 67, 6, 151, -1, 96, 151, -1, 76, 151, -1, 109, @@ -1117,63 +1117,63 @@ static const yytype_uint16 yyrline[] = { 0, 404, 404, 405, 409, 416, 417, 418, 422, 423, 427, 440, 439, 451, 452, 453, 454, 455, 456, 457, - 458, 471, 480, 484, 492, 496, 500, 511, 532, 537, - 548, 562, 561, 576, 580, 584, 595, 599, 603, 607, - 611, 615, 619, 623, 627, 631, 638, 642, 651, 663, - 662, 678, 677, 695, 703, 714, 723, 737, 736, 752, - 751, 762, 777, 783, 792, 799, 812, 811, 836, 835, - 860, 859, 890, 889, 908, 907, 928, 927, 959, 958, - 984, 997, 1001, 1005, 1009, 1013, 1020, 1024, 1028, 1032, - 1036, 1040, 1044, 1048, 1052, 1056, 1060, 1064, 1068, 1072, - 1076, 1080, 1084, 1088, 1092, 1096, 1100, 1104, 1108, 1112, - 1116, 1120, 1124, 1128, 1132, 1136, 1140, 1144, 1148, 1152, - 1156, 1160, 1164, 1168, 1172, 1179, 1180, 1185, 1184, 1192, - 1196, 1197, 1201, 1207, 1216, 1220, 1224, 1228, 1232, 1238, - 1248, 1252, 1257, 1269, 1273, 1287, 1302, 1307, 1312, 1317, - 1322, 1327, 1332, 1337, 1342, 1348, 1347, 1369, 1373, 1378, - 1382, 1387, 1395, 1400, 1408, 1412, 1419, 1423, 1430, 1434, - 1438, 1442, 1446, 1453, 1454, 1455, 1459, 1462, 1463, 1464, - 1468, 1473, 1479, 1485, 1489, 1499, 1503, 1507, 1511, 1516, - 1521, 1526, 1531, 1536, 1541, 1549, 1553, 1557, 1561, 1566, - 1571, 1576, 1581, 1586, 1591, 1596, 1602, 1610, 1614, 1619, - 1624, 1629, 1634, 1639, 1644, 1649, 1658, 1662, 1670, 1674, - 1678, 1682, 1686, 1702, 1718, 1727, 1734, 1738, 1746, 1750, - 1754, 1758, 1762, 1778, 1794, 1812, 1821, 1828, 1832, 1840, - 1844, 1860, 1879, 1885, 1896, 1895, 1920, 1919, 1949, 1950, - 1954, 1955, 1959, 1963, 1967, 1971, 1975, 1979, 1983, 1987, - 1991, 1998, 2006, 2010, 2014, 2018, 2025, 2029, 2036, 2037, - 2043, 2051, 2052, 2058, 2067, 2074, 2078, 2082, 2090, 2089, - 2112, 2111, 2134, 2135, 2139, 2145, 2154, 2155, 2156, 2160, - 2164, 2168, 2172, 2176, 2180, 2185, 2190, 2195, 2200, 2205, - 2209, 2214, 2223, 2228, 2236, 2240, 2245, 2249, 2254, 2262, - 2272, 2272, 2282, 2283, 2287, 2288, 2289, 2290, 2291, 2292, - 2293, 2294, 2295, 2296, 2297, 2297, 2297, 2298, 2298, 2298, - 2298, 2299, 2299, 2299, 2299, 2299, 2300, 2300, 2300, 2301, - 2301, 2301, 2301, 2301, 2302, 2302, 2302, 2302, 2302, 2303, - 2303, 2303, 2303, 2303, 2304, 2304, 2304, 2305, 2305, 2305, - 2305, 2305, 2306, 2306, 2306, 2306, 2306, 2307, 2307, 2307, - 2308, 2308, 2308, 2308, 2309, 2309, 2309, 2309, 2309, 2310, - 2310, 2310, 2310, 2310, 2311, 2311, 2311, 2311, 2312, 2312, - 2312, 2312, 2312, 2313, 2313, 2313, 2313, 2313, 2314, 2314, - 2314, 2314, 2314, 2315, 2315, 2315, 2315, 2318, 2318, 2318, - 2318, 2318, 2318, 2318, 2318, 2318, 2318, 2318, 2319, 2319, - 2319, 2319, 2319, 2319, 2319, 2319, 2319, 2319, 2320, 2320, - 2324, 2328, 2335, 2339, 2346, 2350, 2357, 2361, 2365, 2369, - 2373, 2377, 2381, 2385, 2389, 2393, 2397, 2401, 2405, 2409, - 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445, 2449, - 2453, 2457, 2461, 2465, 2469, 2473, 2477, 2481, 2485, 2489, - 2497, 2501, 2505, 2509, 2513, 2523, 2529, 2535, 2541, 2547, - 2553, 2559, 2566, 2573, 2580, 2587, 2593, 2599, 2603, 2607, - 2611, 2615, 2619, 2623, 2627, 2631, 2635, 2639, 2643, 2647, - 2651, 2655, 2659, 2663, 2667, 2671, 2675, 2679, 2683, 2687, - 2691, 2695, 2699, 2703, 2707, 2711, 2715, 2719, 2723, 2727, - 2731, 2738, 2742, 2746, 2750, 2754, 2758, 2762, 2766, 2770, - 2784, 2788, 2792, 2796, 2800, 2804, 2808, 2812, 2816, 2820, - 2824, 2828, 2832, 2836, 2840, 2844, 2848, 2852, 2856, 2860, - 2864, 2868, 2872, 2876, 2880, 2884, 2888, 2892, 2896, 2900, - 2904, 2908, 2912, 2916, 2920, 2924, 2928, 2935, 2939, 2943, - 2947, 2951, 2955, 2959, 2963, 2967, 2974, 2982, 2990, 3016, - 3020, 3027, 3031, 3035, 3041, 3052 + 458, 471, 480, 484, 492, 496, 500, 511, 532, 554, + 565, 579, 578, 593, 597, 601, 612, 616, 620, 624, + 628, 632, 636, 640, 644, 648, 655, 659, 668, 680, + 679, 695, 694, 712, 720, 731, 740, 754, 753, 769, + 768, 779, 794, 800, 809, 816, 829, 828, 853, 852, + 877, 876, 907, 906, 925, 924, 945, 944, 976, 975, + 1001, 1014, 1018, 1022, 1026, 1030, 1037, 1041, 1045, 1049, + 1053, 1057, 1061, 1065, 1069, 1073, 1077, 1081, 1085, 1089, + 1093, 1097, 1101, 1105, 1109, 1113, 1117, 1121, 1125, 1129, + 1133, 1137, 1141, 1145, 1149, 1153, 1157, 1161, 1165, 1169, + 1173, 1177, 1181, 1185, 1189, 1196, 1197, 1202, 1201, 1209, + 1213, 1214, 1218, 1224, 1233, 1237, 1241, 1245, 1249, 1255, + 1265, 1269, 1274, 1286, 1290, 1304, 1319, 1324, 1329, 1334, + 1339, 1344, 1349, 1354, 1359, 1365, 1364, 1386, 1390, 1395, + 1399, 1404, 1412, 1417, 1425, 1429, 1436, 1440, 1447, 1451, + 1455, 1459, 1463, 1470, 1471, 1472, 1476, 1479, 1480, 1481, + 1485, 1490, 1496, 1502, 1506, 1516, 1520, 1524, 1528, 1533, + 1538, 1543, 1548, 1553, 1558, 1566, 1570, 1574, 1578, 1583, + 1588, 1593, 1598, 1603, 1608, 1613, 1619, 1627, 1631, 1636, + 1641, 1646, 1651, 1656, 1661, 1666, 1675, 1679, 1687, 1691, + 1695, 1699, 1703, 1719, 1735, 1744, 1751, 1755, 1763, 1767, + 1771, 1775, 1779, 1795, 1811, 1829, 1838, 1845, 1849, 1857, + 1861, 1877, 1896, 1902, 1913, 1912, 1937, 1936, 1966, 1967, + 1971, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, + 2008, 2015, 2023, 2027, 2031, 2035, 2042, 2046, 2053, 2054, + 2060, 2068, 2069, 2075, 2084, 2091, 2095, 2099, 2107, 2106, + 2129, 2128, 2151, 2152, 2156, 2162, 2171, 2172, 2173, 2177, + 2181, 2185, 2189, 2193, 2197, 2202, 2207, 2212, 2217, 2222, + 2226, 2231, 2240, 2245, 2253, 2257, 2262, 2266, 2271, 2279, + 2289, 2289, 2299, 2300, 2304, 2305, 2306, 2307, 2308, 2309, + 2310, 2311, 2312, 2313, 2314, 2314, 2314, 2315, 2315, 2315, + 2315, 2316, 2316, 2316, 2316, 2316, 2317, 2317, 2317, 2318, + 2318, 2318, 2318, 2318, 2319, 2319, 2319, 2319, 2319, 2320, + 2320, 2320, 2320, 2320, 2321, 2321, 2321, 2322, 2322, 2322, + 2322, 2322, 2323, 2323, 2323, 2323, 2323, 2324, 2324, 2324, + 2325, 2325, 2325, 2325, 2326, 2326, 2326, 2326, 2326, 2327, + 2327, 2327, 2327, 2327, 2328, 2328, 2328, 2328, 2329, 2329, + 2329, 2329, 2329, 2330, 2330, 2330, 2330, 2330, 2331, 2331, + 2331, 2331, 2331, 2332, 2332, 2332, 2332, 2335, 2335, 2335, + 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2336, 2336, + 2336, 2336, 2336, 2336, 2336, 2336, 2336, 2336, 2337, 2337, + 2341, 2345, 2352, 2356, 2363, 2367, 2374, 2378, 2382, 2386, + 2390, 2394, 2398, 2402, 2406, 2410, 2414, 2418, 2422, 2426, + 2430, 2434, 2438, 2442, 2446, 2450, 2454, 2458, 2462, 2466, + 2470, 2474, 2478, 2482, 2486, 2490, 2494, 2498, 2502, 2506, + 2514, 2518, 2522, 2526, 2530, 2540, 2546, 2552, 2558, 2564, + 2570, 2576, 2583, 2590, 2597, 2604, 2610, 2616, 2620, 2624, + 2628, 2632, 2636, 2640, 2644, 2648, 2652, 2656, 2660, 2664, + 2668, 2672, 2676, 2680, 2684, 2688, 2692, 2696, 2700, 2704, + 2708, 2712, 2716, 2720, 2724, 2728, 2732, 2736, 2740, 2744, + 2748, 2755, 2759, 2763, 2767, 2771, 2775, 2779, 2783, 2787, + 2801, 2805, 2809, 2813, 2817, 2821, 2825, 2829, 2833, 2837, + 2841, 2845, 2849, 2853, 2857, 2861, 2865, 2869, 2873, 2877, + 2881, 2885, 2889, 2893, 2897, 2901, 2905, 2909, 2913, 2917, + 2921, 2925, 2929, 2933, 2937, 2941, 2945, 2952, 2956, 2960, + 2964, 2968, 2972, 2976, 2980, 2984, 2991, 2999, 3007, 3033, + 3037, 3044, 3048, 3052, 3058, 3069 }; #endif @@ -1521,132 +1521,132 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -659 +#define YYPACT_NINF -677 static const yytype_int16 yypact[] = { - 191, -659, 2440, 3611, 10, 2563, -659, -659, -659, -659, - -659, -659, -659, -659, -100, -91, -86, -78, -65, -60, - -43, -30, -659, -9, 24, 52, 3807, -659, 55, 59, - 62, 86, -659, 88, 95, 2440, 2440, 2440, 2440, 1620, - 2440, 3118, -659, 212, -659, -659, -659, -659, -659, -659, - -659, 3770, 117, -659, -659, -659, -659, 4285, -659, 3661, - 3661, -659, 103, -659, 3661, -659, -659, 524, -659, -659, - -659, -659, 153, -4, 41, -659, -659, -659, -659, -659, - -659, 4341, 4341, -659, 4341, 2455, 4341, 134, -659, 4292, - 156, 175, 4341, 79, 193, 196, 201, 4341, 4341, 205, - 4187, 4341, 44, 4341, 4341, -659, -659, -659, -659, 2655, - -659, -659, -659, -659, -659, -659, 2440, 3611, 2440, 2440, - 2440, 2440, 2440, 3611, 2440, 2440, 2440, -659, 103, 209, - 103, 103, -659, 2440, 2440, 3611, 3611, 2440, 2440, 81, - 81, 81, 81, -100, -86, -78, -65, -60, -43, -9, - 24, 4179, 1829, 3297, 3483, 95, 219, -87, 3118, 81, - 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, - 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, - 2440, 1840, 2440, -659, -659, 524, 2440, -659, -659, 3600, - -659, 3661, -659, -659, -659, -659, -659, -659, 251, 524, - 524, 524, 524, 524, 524, 206, -659, -659, 2716, 229, - -659, 31, 4341, -659, -659, -659, 4341, -659, -659, -659, - 4236, 87, -659, 373, 103, -659, -659, 270, -659, -659, - -659, -659, -659, 2440, 2726, -659, 268, 2790, -659, 103, - -659, -659, -659, 260, 269, -659, 3770, 271, 3672, 103, - -659, 103, -16, 288, -659, -659, -659, -4, 41, -659, - 275, 295, -659, 280, 284, 285, 292, 298, 299, 310, - 301, 305, 306, -659, 2440, -659, -659, 314, 317, 319, - 330, 321, 323, 2440, 2440, -659, 3290, 3321, 2860, 2860, - 892, 892, 644, 644, -659, 2944, 3336, 3351, 3381, 892, - 892, 559, 559, 81, 81, 81, -659, -659, -79, 954, - 206, 2909, -659, 524, 206, 206, 206, 206, 206, -2, - 2440, 103, 287, -659, -659, -659, -659, 2716, -659, 347, - -659, -659, -659, 352, 361, 362, 3854, -659, 2888, 3493, - 3770, -16, -659, -659, -659, 33, -659, 2440, 3770, 585, - -659, -659, 335, -659, -659, 103, 1940, -659, -659, 341, - 66, 31, -659, -659, -659, -659, -659, -659, -659, 349, - -659, -659, -659, 345, -659, -659, -659, 366, -659, -659, - 81, 3118, 2440, -659, -659, -659, 206, 367, 356, 3118, - -659, 67, -659, 370, 3900, 173, 380, 387, -659, 3946, - -659, 502, 103, -659, -659, 220, -659, -659, -659, 103, - 3563, 103, 386, 397, -659, 389, -659, -659, -659, -659, - 341, 1400, 388, 341, 1400, 341, 2926, 585, -659, -659, - 391, 585, 585, 585, 585, 585, 124, -659, 3992, -659, - 379, -659, 171, -659, 390, 2040, 2962, 399, 341, 341, - 2565, 341, 341, 341, 341, -659, 329, -659, 2716, 2440, - -659, 2440, 3118, 1400, -659, -659, 2440, -659, 467, 1477, - 1587, 247, -659, -659, 173, -659, -659, -51, 412, 4038, - 17, 410, 389, 417, 4304, 3493, -659, -659, 411, 389, - 389, 389, 389, 389, 389, -94, -659, 341, -659, 329, - -659, -659, -659, -659, -659, -659, 408, 3709, 419, -659, - 3807, -659, 1730, 413, 420, -659, 2440, 2440, 2440, 1620, - 2440, 423, 12, -659, 389, 3135, -659, 212, -659, 341, - 197, 424, -659, 329, -659, 164, 585, 426, 426, 426, - 426, 426, -659, 2440, -659, 1400, -659, 1261, -659, -659, - 103, 2440, 2040, 409, 431, 3118, -659, -659, 341, 167, - 167, 555, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, 430, 429, - -659, -659, 167, 167, 167, 210, 265, 1940, -659, 2440, - 452, -659, -659, 370, -49, -46, 437, 3084, 103, 847, - 103, -659, -659, 847, -659, 847, -659, 847, 847, 847, - 4084, -659, 4130, 567, 459, 103, -659, -659, 3611, -94, - 3611, -659, -659, -659, -659, 389, 443, 443, 443, 443, - 443, 189, 792, 2440, -659, -659, -659, 329, 463, -659, - 3611, 3770, 389, 3611, 447, -659, 3611, 3611, 81, 81, - 81, 448, -44, 81, 528, -659, 1510, 93, 2440, 2440, - 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, - 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2140, - 2440, 273, 582, 458, 528, 476, -659, -659, 426, 1400, - 460, 461, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, 465, - -659, 462, 468, -659, 2240, 167, -659, -659, -659, -659, - -659, 2962, 1400, 470, 341, -659, -659, 528, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, 474, - -659, 478, -659, -659, -659, 443, 472, 481, 479, 484, - 487, 792, 792, 792, 792, 1620, 792, 3169, -659, 485, - 510, -659, 341, 492, 389, 93, 505, 2440, 496, 507, - 2440, -659, -659, -23, -659, -659, -659, 2440, -659, 3290, - 3321, 2860, 2860, 892, 892, 644, 644, -659, 3101, 3336, - 3351, 3381, 892, 892, 559, 559, 81, 81, 81, -659, - -659, -8, 1418, 501, -659, -23, 341, 1400, 503, -659, - 528, 1123, -659, -659, -659, 2040, 3118, 506, -659, -659, - -23, 520, 523, 1400, 3611, 3611, 3611, 3611, 162, 162, - 162, 162, 508, 74, 162, 792, 792, 792, 792, 792, - 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, - 792, 792, 792, 792, 2340, 2440, -659, 341, -659, -659, - 93, -659, 511, 513, -659, 512, 81, -659, 516, 3118, - 2440, -659, -659, -659, 1400, -659, 518, 528, -23, -659, - 519, 528, -659, -659, 521, 525, 533, 526, 537, 792, - -659, 3306, 3366, 678, 678, 935, 935, 657, 657, -659, - 3152, 3501, 1853, 919, 813, 813, 162, 162, 162, -659, - -659, 90, 1638, -659, -659, 2440, -659, 2440, 37, 3118, - 1400, 529, 528, -23, -659, -23, 528, -659, 534, -659, - 536, 162, 792, -659, -659, 137, 140, -659, 531, 545, - 528, -23, -23, 2440, 2440, 3169, -659, -659, -659, 528, - -23, 147, 150, -23, -659, -659 + 243, -677, 2495, 3659, 39, 2629, -677, -677, -677, -677, + -677, -677, -677, -677, -90, -85, -47, -38, 8, 23, + 28, 57, -677, 30, 54, 73, 3855, -677, 85, 91, + 137, 158, -677, 167, 172, 2495, 2495, 2495, 2495, 1675, + 2495, 3169, -677, 66, -677, -677, -677, -677, -677, -677, + -677, 3818, 176, -677, -677, -677, -677, 4313, -677, 3709, + 3709, -677, 186, -677, 3709, -677, -677, 331, -677, -677, + -677, -677, 17, -4, 36, -677, -677, -677, -677, -677, + -677, 4382, 4382, -677, 4382, 3529, 4382, 173, -677, 4321, + 187, 189, 4382, 47, 206, 212, 215, 4382, 4382, 205, + 2487, 4382, 92, 4382, 4382, -677, -677, -677, -677, 2721, + -677, -677, -677, -677, -677, -677, 2495, 3659, 2495, 2495, + 2495, 2495, 2495, 3659, 2495, 2495, 2495, -677, 186, 214, + 186, 186, -677, 2495, 2495, 3659, 3659, 2495, 2495, 44, + 44, 44, 44, -90, -47, -38, 8, 23, 28, 30, + 54, 4227, 1884, 3333, 3564, 172, 226, -82, 3169, 44, + 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, + 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, + 2495, 1895, 2495, -677, -677, 331, 2495, -677, -677, 3648, + -677, 3709, -677, -677, -677, -677, -677, -677, 232, 331, + 331, 331, 331, 331, 331, 238, -677, -677, 2782, 256, + -677, -66, 4382, -677, -677, -677, 4382, -677, -677, -677, + 4260, 59, -677, 367, 373, -677, -677, 275, -677, -677, + -677, -677, -677, 2495, 2792, -677, 269, 2856, -677, 186, + -677, -677, -677, 261, 266, -677, 3818, 267, 3720, 186, + -677, 186, 296, 288, -677, -677, -677, -4, 36, -677, + 271, 293, -677, 306, 308, 309, 311, 312, 314, 285, + 315, 321, 322, -677, 2495, -677, -677, 327, 328, 330, + 298, 332, 333, 2495, 2495, -677, 3236, 3372, 3445, 3445, + 465, 465, 582, 582, -677, 2993, 3387, 3402, 767, 465, + 465, 378, 378, 44, 44, 44, -677, -677, -75, 954, + 238, 2954, -677, 331, 238, 238, 238, 238, 238, 119, + 2495, 186, 338, -677, -677, -677, -677, 2782, -677, 340, + -677, -677, -677, 354, 359, 360, 3902, -677, 1693, 3574, + 3818, 296, -677, -677, -677, 12, -677, 2495, 3818, 264, + -677, -677, 344, -677, -677, 186, 1995, -677, -677, 529, + -16, -66, -677, -677, -677, -677, -677, -677, -677, 345, + -677, -677, -677, 347, -677, -677, -677, 365, -677, -677, + 44, 3169, 2495, -677, -677, -677, 238, 366, 342, 3169, + -677, 143, -677, 385, 3948, 228, 386, 377, -677, 3994, + -677, 505, 507, -677, -677, 120, -677, -677, -677, 186, + 3611, 186, 391, 403, -677, 394, -677, -677, -677, -677, + 529, 1455, 392, 529, 1455, 529, 2975, 264, -677, -677, + 395, 264, 264, 264, 264, 264, 142, -677, 4040, -677, + 393, -677, 164, -677, 398, 2095, 3011, 400, 529, 529, + 2631, 529, 529, 529, 529, -677, 225, -677, 2782, 2495, + -677, 2495, 3169, 1455, -677, -677, 2495, -677, 537, 638, + 819, 279, -677, -677, 228, -677, -677, -70, 416, 4086, + 3, 417, 394, 425, 4361, 3574, -677, -677, 419, 394, + 394, 394, 394, 394, 394, -94, -677, 529, -677, 225, + -677, -677, -677, -677, -677, -677, 418, 3757, 437, -677, + 3855, -677, 1785, 429, 439, -677, 2495, 2495, 2495, 1675, + 2495, 415, 21, -677, 394, 3186, -677, 66, -677, 529, + 216, 430, -677, 225, -677, 155, 264, 433, 433, 433, + 433, 433, -677, 2495, -677, 1455, -677, 1316, -677, -677, + 186, 2495, 2095, 428, 452, 3169, -677, -677, 529, 162, + 162, 562, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, 440, 436, + -677, -677, 162, 162, 162, 236, 218, 1995, -677, 2495, + 460, -677, -677, 385, -59, -32, 442, 3030, 186, 323, + 186, -677, -677, 323, -677, 323, -677, 323, 323, 323, + 4132, -677, 4178, 570, 462, 572, -677, -677, 3659, -94, + 3659, -677, -677, -677, -677, 394, 448, 448, 448, 448, + 448, 193, 2506, 2495, -677, -677, -677, 225, 468, -677, + 3659, 3818, 394, 3659, 455, -677, 3659, 3659, 44, 44, + 44, 461, -24, 44, 547, -677, 1565, -9, 2495, 2495, + 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, + 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2195, + 2495, 244, 601, 471, 547, 489, -677, -677, 433, 1455, + 470, 478, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, 480, + -677, 482, 483, -677, 2295, 162, -677, -677, -677, -677, + -677, 3011, 1455, 485, 529, -677, -677, 547, -677, -677, + -677, -677, -677, -677, -677, -677, -677, -677, -677, 491, + -677, 492, -677, -677, -677, 448, 497, 498, 494, 499, + 509, 2506, 2506, 2506, 2506, 1675, 2506, 3220, -677, 501, + 521, -677, 529, 508, 394, -9, 523, 2495, 514, 526, + 2495, -677, -677, 13, -677, -677, -677, 2495, -677, 3236, + 3372, 3445, 3445, 465, 465, 582, 582, -677, 3152, 3387, + 3402, 767, 465, 465, 378, 378, 44, 44, 44, -677, + -677, 50, 1032, 520, -677, 13, 529, 1455, 525, -677, + 547, 1178, -677, -677, -677, 2095, 3169, 530, -677, -677, + 13, 538, 539, 1455, 3659, 3659, 3659, 3659, 179, 179, + 179, 179, 531, 55, 179, 2506, 2506, 2506, 2506, 2506, + 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2506, + 2506, 2506, 2506, 2506, 2395, 2495, -677, 529, -677, -677, + -9, -677, 528, 532, -677, 536, 44, -677, 549, 3169, + 2495, -677, -677, -677, 1455, -677, 545, 547, 13, -677, + 550, 547, -677, -677, 552, 553, 565, 557, 568, 2506, + -677, 3357, 3417, 828, 828, 644, 644, 665, 665, -677, + 3203, 3432, 1908, 1002, 426, 426, 179, 179, 179, -677, + -677, 68, 1473, -677, -677, 2495, -677, 2495, 15, 3169, + 1455, 560, 547, 13, -677, 13, 547, -677, 563, -677, + 564, 179, 2506, -677, -677, 75, 86, -677, 569, 578, + 547, 13, 13, 2495, 2495, 3220, -677, -677, -677, 547, + 13, 93, 134, 13, -677, -677 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -659, -659, -183, -659, 98, -659, -659, 454, -659, -659, - -21, -95, -659, -659, -659, -160, -234, -659, -659, -659, - -181, -275, 469, -659, -659, -659, -659, -659, -659, -659, - -658, -659, -659, 221, -659, -659, -659, 222, 302, -273, - -659, -423, -659, 77, -495, -328, -543, -659, -504, 76, - -351, 354, -39, 480, 203, -36, -81, -659, -77, -659, - -659, -659, 244, -68, -659, -303, -659, -659, -15, 58, - -659, -659, -659, -659, -24, 207, -659, -659, 170, -659, - -85, -659, -507, -104, -20, -140, 71, -593, -659, -659, - -305, 490, -368, -1 + -677, -677, -177, -677, 124, -677, -677, 487, -677, -677, + -21, -98, -677, -677, -677, -144, -225, -677, -677, -677, + -173, -272, 484, -677, -677, -677, -677, -677, -677, -677, + -676, -677, -677, 235, -677, -677, -677, 237, 313, -235, + -677, -423, -677, 94, -495, -318, -547, -677, -504, -342, + -224, -54, -39, 488, 224, -36, -78, -677, -77, -677, + -677, -677, 262, -68, -677, -317, -677, -677, -13, 58, + -677, -677, -677, -677, 26, 246, -677, -677, 191, -677, + -64, -677, -499, -104, -20, 156, 71, -145, -677, -677, + -340, 481, -368, -1 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1655,857 +1655,875 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -264 static const yytype_int16 yytable[] = { - 6, 531, 132, 156, 658, 235, 194, 195, 665, 832, - 79, 130, 185, 419, 264, 265, 266, 267, 268, 157, - 270, 271, 272, 183, 393, 184, 675, 652, 254, 277, - 278, 284, 255, 281, 282, 116, 710, 480, 705, 284, - 616, 256, 653, 336, 117, 422, 925, 194, 195, 118, - 285, 194, 195, 527, 194, 195, 527, 119, 383, 878, - 213, 214, 987, 215, 217, 218, 206, 633, 222, 284, - 120, 225, 284, 41, 284, 121, 231, 232, 988, 234, - 237, 263, 241, 242, 131, 259, 634, 269, 845, 194, - 195, 846, 122, 891, 257, 527, 123, 194, 195, 279, - 280, 353, 843, 354, 355, 356, 139, 140, 141, 142, - 284, 159, 168, 194, 195, 262, 208, 262, 262, 262, - 262, 262, 711, 262, 262, 262, 124, 239, 611, 991, - 676, 639, 262, 262, 320, 387, 262, 262, 646, 647, - 648, 649, 650, 651, 527, 394, 879, 499, -246, 399, - 530, -246, 533, 254, 637, 613, 254, 255, 210, 125, - 255, 308, 880, 423, 624, 626, 256, 258, 438, 256, - 373, 659, 896, 677, 1057, 559, 560, 527, 602, 603, - 604, 605, 898, -263, 206, 465, 458, 126, 466, 940, - 133, 222, 284, 963, 134, 330, 226, 135, 206, 206, - 206, 206, 206, 206, 332, 706, 323, 346, 284, 349, - 259, 1010, 136, 259, 897, 180, 181, 182, 183, 257, - 184, 479, 257, 137, 657, 6, 10, 1053, 11, 653, - 138, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 6, 531, 235, 156, 658, 832, 194, 195, 665, 183, + 393, 184, 185, 130, 264, 265, 266, 267, 268, 157, + 270, 271, 272, 419, 422, 194, 195, 652, 925, 277, + 278, 254, 255, 281, 282, 675, 284, 480, 705, 79, + 616, 256, 653, 284, 710, 116, 194, 195, 633, 336, + 117, -246, 132, 527, -246, 285, 527, 194, 195, 284, + 213, 214, 383, 215, 217, 218, 206, 634, 222, 194, + 195, 225, 183, 41, 184, 168, 231, 232, 845, 234, + 237, 263, 241, 242, 131, 535, 284, 269, 118, 537, + 538, 539, 540, 541, 284, 527, 257, 119, 987, 279, + 280, -263, 194, 195, 458, 846, 139, 140, 141, 142, + 843, 159, 897, 891, 988, 262, 208, 262, 262, 262, + 262, 262, 711, 262, 262, 262, 10, 653, 11, 624, + 626, 310, 262, 262, 207, 259, 262, 262, 611, 676, + 637, 613, 423, 120, 527, 314, 315, 316, 317, 318, + 319, 394, 1057, 210, 879, 399, 254, 255, 121, 254, + 255, 308, 880, 122, 226, 124, 256, 258, 284, 256, + 373, 940, 896, 284, 438, 239, 332, 527, 180, 181, + 182, 659, 898, 123, 206, 499, 284, 991, 530, 125, + 533, 222, 1010, 284, 708, 330, 194, 195, 206, 206, + 206, 206, 206, 206, 284, 1053, 323, 346, 126, 349, + 963, 284, 1066, 559, 560, 706, 602, 603, 604, 605, + 133, 257, 840, 1067, 257, 6, 134, 479, 194, 195, + 1074, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 186, 309, 219, 284, 701, 311, 284, 542, - 543, 468, 469, 470, 190, 284, 192, 193, 284, 840, - 207, 197, 998, 262, 1066, 194, 195, 1067, 878, 878, - 878, 878, 471, 878, 1074, 835, 928, 1075, 549, 550, - 630, 223, 258, 632, 865, 258, 973, 974, 975, 707, - 543, 418, 608, 609, 338, 1, 2, 3, 527, 427, - 224, 885, 206, 228, 850, 416, 229, 702, 852, 390, - 853, 230, 854, 855, 856, 653, 866, 6, 398, 881, - 702, 6, 608, 609, 703, 627, 628, 629, 417, 1043, - 233, 527, 320, 1045, 274, 608, 609, 839, 437, 327, - 6, 194, 195, 447, 380, 381, 283, 448, 190, 192, - 193, 197, 878, 878, 878, 878, 878, 878, 878, 878, - 878, 878, 878, 878, 878, 878, 878, 878, 878, 878, - 878, 313, 524, 334, 1061, 524, 416, 337, 1062, 641, - 981, 389, 1000, 702, 339, 344, 190, 449, 190, 486, - 487, 488, 1070, 6, 345, 489, 347, 358, 608, 609, - 923, 1073, 362, 284, 496, 326, 878, 363, 426, 937, - 528, 364, 365, 528, 524, 392, 437, 446, 450, 366, - 437, 437, 437, 437, 437, 367, 368, 369, 370, 614, - 548, 615, 371, 372, 556, 490, 353, 831, 354, 606, - 607, 374, 451, 462, 375, 612, 376, 377, 378, 878, - 379, 416, 528, 234, 608, 609, 452, 395, 662, 400, - 439, 453, 6, 524, 527, 6, 454, 194, 195, 401, - 402, 496, 460, 671, 459, 1034, 132, -262, 496, 496, - 496, 496, 496, 496, 655, 130, 464, 473, 612, 672, - 491, 461, 463, 535, 996, 474, 524, 537, 538, 539, - 540, 541, 477, 484, 492, 485, 555, 546, 529, 493, - 1004, 536, 50, 496, 494, 551, 620, 620, 620, 558, - 635, 638, 612, 980, 326, 437, 198, 617, 640, 310, - 199, 645, 390, 660, 528, 663, 667, 833, 666, 834, - 262, 556, 196, 314, 315, 316, 317, 318, 319, 527, - 674, 704, 543, 209, 211, 836, 61, 837, 131, 838, - 844, 1041, 618, 63, 847, 527, 619, 859, 860, 653, - 200, 882, 887, 227, 892, 890, 840, 668, 669, 670, - 168, 673, 240, 924, 926, 428, 429, 430, 930, 933, - 929, 431, 862, 932, 864, 945, 934, 943, 390, 499, - 938, 941, 708, 947, 389, 942, 944, 1059, 273, 946, - 275, 276, 884, 555, 883, 976, 527, 886, 977, 979, - 888, 889, 982, 984, 985, 201, 993, 524, 655, 1002, - 997, 432, 1003, 1001, 496, 1009, 1035, 1037, 830, 202, - 1036, 1038, 390, 533, 203, 1042, 612, 1044, 1046, 204, - 1048, 496, 1047, 1049, 1050, 326, 1060, 386, 1068, 1063, - 524, 1064, 527, 894, 331, 168, 612, 620, 841, 921, - 389, 620, 1069, 620, 939, 620, 620, 620, 963, 177, - 178, 179, 995, 180, 181, 182, 433, 959, 960, 961, - 962, 978, 1033, 894, 657, 643, 341, 644, 528, 963, - 434, 333, 482, 664, 335, 435, 863, 342, 631, 829, - 931, 0, 0, 0, 389, 0, 0, 0, 0, 343, - 0, 948, 949, 950, 951, 0, 954, 0, 0, 350, - 0, 352, 0, 0, 0, 0, 0, 360, 361, 899, + 305, 306, 284, 309, 998, 320, 387, 311, 639, 386, + 259, 465, 657, 259, 466, 646, 647, 648, 649, 650, + 651, 1075, 135, 262, 428, 429, 430, 542, 543, 850, + 431, 549, 550, 852, 136, 853, 928, 854, 855, 856, + 707, 543, 258, 219, 701, 258, 630, 608, 609, 632, + 677, 418, 137, 190, 338, 192, 193, 138, 527, 427, + 197, 186, 206, 973, 974, 975, 468, 469, 470, 390, + 432, 1043, 223, 835, 224, 1045, 228, 6, 398, 653, + 866, 6, 229, 194, 195, 230, 702, 471, 417, 881, + 233, 527, 353, 198, 354, 606, 607, 199, 437, 274, + 6, 608, 609, 703, 380, 381, 702, 1, 2, 3, + 608, 609, 313, 283, 702, 416, 1061, 627, 628, 629, + 1062, 608, 609, 839, 320, 433, 327, 334, 50, 608, + 609, 923, 524, 335, 1070, 524, 641, 200, 1000, 434, + 981, 389, 337, 1073, 435, 339, 344, 190, 192, 193, + 197, 345, 347, 6, 486, 487, 488, 358, 362, 168, + 489, 284, 369, 353, 496, 354, 355, 356, 426, 937, + 528, 865, 61, 528, 524, 377, 437, 446, 618, 63, + 437, 437, 437, 437, 437, 190, 416, 190, 885, 614, + 548, 615, 201, 363, 556, 364, 365, 831, 366, 367, + 490, 368, 370, 462, 326, 612, 202, 963, 371, 372, + 395, 203, 528, 234, 374, 375, 204, 376, 662, 378, + 379, 400, 6, 524, 527, 6, 392, 401, 402, 439, + 459, 496, 464, 671, 460, 1034, 166, 167, 496, 496, + 496, 496, 496, 496, 655, 474, 168, 130, 612, 672, + 461, 463, -262, 473, 996, 491, 524, 878, 177, 178, + 179, 416, 180, 181, 182, 477, 555, 478, 484, 492, + 1004, 485, 529, 496, 493, 536, 620, 620, 620, 494, + 558, 546, 612, 551, 635, 437, 132, 617, 638, 194, + 195, 447, 390, 196, 528, 448, 640, 194, 195, 645, + 262, 556, 674, 660, 209, 211, 970, 971, 972, 527, + 973, 974, 975, 663, 666, 667, 833, 704, 131, 543, + 834, 1041, 836, 326, 227, 527, 838, 837, 844, 847, + 859, 860, 861, 240, 653, 449, 882, 668, 669, 670, + 887, 673, 50, 175, 176, 177, 178, 179, 890, 180, + 181, 182, 862, 892, 864, 840, 924, 926, 390, 273, + 929, 275, 276, 168, 389, 930, 450, 1059, 932, 933, + 945, 934, 884, 555, 883, 938, 527, 886, 941, 942, + 888, 889, 943, 944, 946, 947, 61, 524, 655, 977, + 451, 976, 618, 63, 496, 979, 619, 499, 194, 195, + 982, 984, 390, 985, 452, 993, 612, 1002, 1003, 453, + 980, 496, 997, 1035, 454, 961, 962, 1001, 1009, 1036, + 524, 1037, 527, 894, 830, 963, 612, 620, 841, 921, + 389, 620, 1042, 620, 1038, 620, 620, 620, 1044, 1046, + 1047, 533, 1048, 50, 1049, 1050, 963, 1060, 1063, 1064, + 939, 995, 333, 894, 326, 1033, 1068, 331, 528, 978, + 175, 176, 177, 178, 179, 1069, 180, 181, 182, 643, + 343, 341, 644, 482, 389, 342, 878, 878, 878, 878, + 350, 878, 352, 863, 664, 0, 631, 61, 360, 361, + 829, 931, 657, 618, 63, 0, 0, 623, 0, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, - 0, 922, 175, 176, 177, 178, 179, 0, 180, 181, - 182, 0, 0, 983, 0, 968, 969, 970, 971, 972, - 0, 973, 974, 975, 0, 7, 8, 9, 10, 0, - 11, 12, 13, 524, 548, 0, 968, 969, 970, 971, - 972, 391, 973, 974, 975, 1011, 1012, 1013, 1014, 1015, - 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, - 1026, 1027, 1028, 1029, 0, 0, 0, 0, 867, 952, - 0, 528, 0, 0, 963, 444, 894, 0, 0, 0, - 0, 0, 0, 0, 868, 953, 0, 194, 195, 0, - 0, 0, 22, 0, 0, 0, 0, 0, 0, 1051, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, - 0, 0, 0, 496, 612, 0, 262, 869, 524, 0, - 870, 0, 478, 0, 32, 0, 0, 0, 0, 481, - 0, 483, 50, 0, 524, 936, 0, 0, 1005, 1006, - 1007, 1008, 1065, 166, 167, 0, 0, 871, 0, 0, - 0, 872, 873, 168, 0, 874, 528, 875, 0, 894, - 0, 876, 0, 0, 556, 0, 957, 958, 959, 960, - 961, 962, 528, 970, 971, 972, 61, 973, 974, 975, - 963, 0, 618, 63, 1031, 524, 961, 962, 622, 622, - 622, 986, 0, 0, 0, 0, 963, 0, 989, 160, + 0, 922, 968, 969, 970, 971, 972, 0, 973, 974, + 975, 0, 0, 983, 162, 163, 164, 165, 166, 167, + 0, 0, 0, 968, 969, 970, 971, 972, 168, 973, + 974, 975, 391, 524, 548, 0, 0, 0, 0, 0, + 878, 878, 878, 878, 878, 878, 878, 878, 878, 878, + 878, 878, 878, 878, 878, 878, 878, 878, 878, 194, + 195, 0, 0, 0, 0, 0, 444, 0, 0, 952, + 0, 528, 0, 0, 0, 0, 894, 959, 960, 961, + 962, 0, 0, 0, 0, 953, 0, 0, 0, 963, + 0, 0, 0, 0, 878, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, + 0, 0, 0, 496, 612, 0, 262, 0, 524, 0, + 481, 0, 483, 173, 174, 175, 176, 177, 178, 179, + 0, 180, 181, 182, 524, 936, 0, 878, 1005, 1006, + 1007, 1008, 0, 0, 0, 0, 0, 0, 61, 0, + 0, 0, 0, 0, 618, 63, 528, 0, 625, 894, + 0, 0, 0, 0, 556, 0, 0, 0, 0, 0, + 0, 0, 528, 0, 0, 0, 0, 0, 0, 622, + 622, 622, 0, 0, 1031, 524, 968, 969, 970, 971, + 972, 986, 973, 974, 975, 0, 0, 0, 989, 160, 161, 162, 163, 164, 165, 166, 167, 0, 0, 612, 0, 0, 0, 0, 0, 168, 0, 0, 0, 0, 0, 0, 0, 528, 0, 0, 894, 0, 0, 0, 894, 524, 0, 0, 0, 0, 555, 0, 0, 0, - 0, 0, 0, 0, 0, 1055, 0, 1056, 0, 0, - 175, 176, 177, 178, 179, 0, 180, 181, 182, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 528, - 444, 894, 0, 1071, 1072, 894, 1032, 968, 969, 970, - 971, 972, 0, 973, 974, 975, 0, 0, 0, 894, - 0, 1039, 0, 968, 969, 970, 971, 972, 894, 973, - 974, 975, 0, 0, 0, 0, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 0, 180, 181, - 182, 0, 0, 0, 384, 0, 444, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 849, 622, - 851, 0, 0, 622, 0, 622, 0, 622, 622, 622, - 0, 0, 0, 0, 0, 861, 712, 713, 714, 715, - 716, 717, 718, 719, 720, 721, 0, 722, 723, 724, - 725, 726, 727, 728, 729, 730, 731, 732, 0, 0, - 0, 0, 0, 0, 733, 734, 735, 736, 737, 738, - 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, - 749, 0, 0, 750, 751, 752, 753, 754, 755, 756, - 757, 758, 759, 760, 761, 762, 763, 0, 764, 0, - 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, - 775, 776, 0, 0, 0, 777, 0, 778, 0, 779, - 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, - 790, 791, 792, 0, 793, 794, 795, 796, 797, 798, - 799, 0, 800, 801, 802, 803, 804, 0, 0, 0, - 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, - 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, - 825, 999, 826, 827, 712, 713, 714, 715, 716, 717, - 718, 719, 720, 721, 0, 722, 723, 724, 725, 726, - 727, 728, 729, 730, 731, 732, 0, 0, 0, 0, - 0, 0, 733, 734, 735, 736, 737, 738, 739, 740, - 741, 742, 743, 744, 745, 746, 747, 748, 749, 0, - 0, 750, 751, 752, 753, 754, 755, 756, 757, 758, - 759, 760, 761, 762, 763, 0, 764, 0, 765, 766, - 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, - 0, 0, 0, 777, 0, 778, 0, 779, 780, 781, - 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, - 792, 0, 793, 794, 795, 796, 797, 798, 799, 0, - 800, 801, 802, 803, 804, 0, 0, 0, 805, 806, - 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, - 817, 818, 819, 820, 821, 822, 823, 824, 825, 0, - 826, 827, 0, 500, 501, 502, 10, 0, 11, 503, - 504, 44, 0, 0, 505, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 160, 161, 162, 163, 164, 165, 166, - 167, 0, 0, 0, 0, 0, 506, 45, 0, 168, - 46, 0, 47, 48, 49, 50, 507, 0, 52, 0, - 0, 53, 508, 0, 0, 54, 0, 0, 0, 0, - 509, 55, 0, 0, 0, 0, 0, 56, 57, 58, - 0, 0, 0, 0, 510, 0, 511, 194, 195, 0, - 0, 512, 0, 59, 60, 513, 0, 0, 514, 61, - 0, 0, 515, 0, 0, 62, 63, 64, 0, 0, - 65, 0, 66, 500, 501, 502, 10, 0, 11, 503, - 504, 44, 0, 0, 895, 516, 0, 0, 1058, 517, - 0, 0, 50, 518, 0, 519, 0, 0, 0, 520, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 0, 180, 181, 182, 0, 506, 45, 992, 0, - 46, 0, 47, 48, 49, 50, 507, 0, 52, 0, - 0, 53, 508, 0, 0, 54, 61, 0, 0, 0, - 509, 55, 618, 63, 0, 0, 623, 56, 57, 58, - 0, 0, 0, 0, 510, 0, 511, 194, 195, 0, - 0, 512, 0, 59, 60, 513, 0, 0, 514, 61, - 0, 0, 515, 0, 0, 62, 63, 64, 0, 0, - 65, 0, 66, 7, 8, 9, 10, 0, 11, 12, - 13, 143, 0, 0, 0, 516, 0, 0, 0, 517, - 0, 0, 50, 518, 0, 519, 0, 0, 0, 520, - 0, 0, 0, 160, 161, 162, 163, 164, 165, 166, - 167, 0, 0, 0, 0, 0, 15, 45, 0, 168, - 144, 0, 145, 146, 147, 50, 51, 0, 52, 0, - 0, 148, 21, 0, 0, 54, 61, 0, 0, 0, - 22, 149, 618, 63, 0, 0, 625, 150, 151, 58, - 0, 0, 0, 0, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 152, 153, 30, 0, 0, 31, 61, - 0, 0, 32, 0, 0, 62, 63, 154, 0, 0, - 65, 0, 155, 500, 501, 502, 10, 0, 11, 503, - 504, 44, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 0, 0, 40, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 0, 180, 181, 182, 0, 506, 45, 1054, 0, - 46, 0, 47, 48, 49, 50, 507, 0, 52, 0, - 0, 53, 508, 0, 0, 54, 0, 0, 0, 0, - 509, 55, 0, 0, 0, 0, 0, 56, 57, 58, - 0, 0, 0, 0, 510, 0, 511, 0, 0, 0, - 0, 512, 0, 59, 60, 513, 0, 0, 514, 61, - 0, 0, 515, 0, 0, 62, 63, 64, 0, 0, - 65, 0, 66, 7, 8, 9, 10, 0, 11, 12, - 13, 14, 0, 0, 0, 516, 0, 0, 0, 517, - 0, 0, 0, 518, 0, 519, 0, 0, 0, 520, - 957, 958, 959, 960, 961, 962, 0, 0, 0, 46, - 0, 47, 48, 49, 963, 0, 15, 0, 0, 0, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 56, 191, 58, 0, - 22, 23, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 59, 60, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 28, 29, 30, 64, 0, 31, 0, - 0, 66, 32, 7, 8, 9, 10, 33, 11, 12, - 13, 14, 34, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 133, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 307, 967, 40, - 0, 968, 969, 970, 971, 972, 15, 973, 974, 975, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, - 22, 23, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 28, 29, 30, 0, 0, 31, 0, - 0, 0, 32, 7, 8, 9, 10, 33, 11, 12, - 13, 14, 34, 0, 0, 0, 0, 445, 0, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 0, 0, 40, - 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, - 22, 23, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 28, 29, 30, 0, 0, 31, 0, - 0, 0, 32, 7, 8, 9, 10, 33, 11, 12, - 13, 14, 34, 0, 0, 0, 0, 552, 0, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 0, 0, 40, - 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, - 22, 23, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 28, 29, 30, 0, 0, 31, 0, - 0, 0, 32, 7, 8, 9, 10, 33, 11, 12, - 13, 14, 34, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 920, 0, 40, - 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, - 22, 23, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 28, 29, 30, 0, 0, 31, 0, - 0, 0, 32, 7, 8, 9, 10, 33, 11, 12, - 13, 14, 34, 0, 0, 0, 0, 935, 0, 0, - 0, 0, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 0, 0, 40, - 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 0, 0, 0, 0, 0, 0, - 22, 23, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 26, 0, 27, 0, 0, 0, - 0, 0, 0, 28, 29, 30, 0, 0, 31, 0, - 0, 0, 32, 7, 8, 9, 10, 33, 11, 12, - 13, 14, 34, 0, 0, 0, 0, 0, 0, 0, - 0, 216, 0, 0, 0, 35, 0, 0, 0, 36, - 37, 0, 0, 38, 0, 39, 0, 1030, 0, 40, - 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, - 16, 0, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 20, 21, 0, 81, 0, 0, 0, 0, 0, - 22, 23, 82, 0, 0, 0, 0, 24, 25, 0, - 0, 84, 85, 86, 26, 0, 27, 0, 0, 0, - 0, 212, 0, 28, 29, 30, 0, 92, 31, 0, - 0, 0, 32, 0, 0, 0, 97, 33, 0, 0, - 0, 98, 34, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -2, 103, 35, 104, 0, 0, 36, - 37, 561, 0, 38, 0, 39, 0, 0, 0, 40, - 562, 563, 564, 565, 566, 567, 568, 569, 0, 0, - 0, 0, 0, 0, 0, 0, 570, 0, 571, 572, - 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, - 0, 80, 81, 0, 0, 0, 0, 0, 0, 0, - 82, 0, 0, 0, 0, 583, 0, 83, 0, 84, - 85, 86, 87, 0, 0, 88, 0, 0, 0, 89, - 0, 0, 0, 90, 91, 92, 93, 0, 0, 584, - 0, 94, 95, 96, 97, 0, 0, 0, 0, 98, - 99, 0, 0, 100, 0, 243, 244, 101, 0, 0, - 0, 102, 103, 0, 104, 0, 0, 0, 0, 0, - 0, 0, 105, 585, 0, 0, 586, 0, 587, 588, - 589, 590, 591, 592, 593, 594, 595, 596, 597, 0, - 598, 599, 245, 0, 600, 46, 0, 47, 48, 49, - 50, 246, 0, 247, 0, 0, 53, 0, 0, 0, - 54, 0, 0, 0, 0, 0, 55, 324, 0, 0, - 0, 0, 56, 57, 58, 0, 243, 244, 0, 0, - 0, 0, 248, 0, 0, 0, 0, 0, 59, 60, - 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, - 249, 63, 64, 0, 0, 65, 46, 66, 47, 48, - 49, 0, 250, 245, 0, 0, 46, 0, 47, 48, - 49, 50, 246, 0, 247, 0, 0, 53, 251, 0, - 0, 54, 0, 56, 191, 58, 0, 55, 0, 0, - 243, 244, 0, 56, 57, 58, 0, 0, 0, 59, - 60, 0, 0, 248, 0, 0, 0, 0, 0, 59, - 60, 0, 0, 64, 0, 61, 0, 0, 66, 0, - 0, 249, 63, 64, 0, 0, 65, 245, 66, 0, - 46, 0, 47, 48, 49, 50, 340, 0, 247, 0, - 0, 53, 0, 0, 0, 54, 0, 0, 0, 251, - 0, 55, 0, 0, 0, 0, 0, 56, 57, 58, - 0, 0, 0, 0, 0, 0, 0, 248, 0, 164, - 165, 166, 167, 59, 60, 0, 0, 0, 0, 61, - 0, 168, 0, 0, 0, 249, 63, 64, 0, 0, - 65, 0, 66, 160, 161, 162, 163, 164, 165, 166, - 167, 0, 0, 0, 0, 0, 0, 0, 0, 168, - 0, 0, 0, 251, 160, 161, 162, 163, 164, 165, - 166, 167, 0, 0, 0, 0, 0, 0, 0, 0, - 168, 160, 161, 162, 163, 164, 165, 166, 167, 0, - 0, 0, 0, 0, 0, 0, 0, 168, 0, 160, - 161, 162, 163, 164, 165, 166, 167, 0, 0, 0, - 0, 0, 0, 0, 0, 168, 0, 160, 161, 162, - 163, 164, 165, 166, 167, 0, 173, 174, 175, 176, - 177, 178, 179, 168, 180, 181, 182, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 405, 0, 0, 0, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 0, 180, 181, 182, 406, 0, 0, 0, 0, - 0, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 0, 180, 181, 182, 385, 0, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 0, - 180, 181, 182, 534, 382, 0, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 0, 180, 181, - 182, 557, 0, 0, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 0, 180, 181, 182, 160, - 161, 162, 163, 164, 165, 166, 167, 0, 0, 0, - 0, 0, 0, 0, 0, 168, 160, 161, 162, 163, - 164, 165, 166, 167, 0, 0, 0, 0, 0, 0, - 0, 0, 168, 160, 161, 162, 163, 164, 165, 166, - 167, 0, 0, 0, 0, 0, 0, 0, 0, 168, - 678, 679, 680, 681, 682, 683, 684, 685, 0, 0, - 0, 0, 0, 0, 0, 0, 686, 955, 956, 957, - 958, 959, 960, 961, 962, 0, 0, 0, 0, 0, - 0, 0, 0, 963, 955, 956, 957, 958, 959, 960, - 961, 962, 0, 0, 0, 0, 0, 0, 0, 0, - 963, 0, 848, 0, 0, 0, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 0, 180, 181, - 182, 990, 0, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 0, 180, 181, 182, 0, 0, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 0, 180, 181, 182, 0, 0, 687, 688, 689, - 690, 691, 692, 693, 694, 695, 696, 697, 0, 698, - 699, 700, 1052, 0, 964, 965, 966, 967, 0, 0, + 0, 0, 0, 0, 0, 1055, 0, 1056, 0, 957, + 958, 959, 960, 961, 962, 0, 0, 948, 949, 950, + 951, 444, 954, 963, 0, 0, 0, 0, 0, 528, + 0, 894, 0, 1071, 1072, 894, 1032, 160, 161, 162, + 163, 164, 165, 166, 167, 0, 0, 0, 0, 894, + 0, 1039, 0, 168, 0, 0, 0, 0, 894, 0, + 0, 0, 0, 0, 0, 0, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 444, 180, 181, + 182, 0, 0, 0, 384, 0, 0, 0, 0, 849, + 622, 851, 0, 0, 622, 0, 622, 0, 622, 622, + 622, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, + 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 968, 969, 970, 971, 972, 0, 973, 974, 975, 0, - 0, 964, 965, 966, 967, 0, 0, 968, 969, 970, - 971, 972, 0, 973, 974, 975, 161, 162, 163, 164, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 1051, 180, 181, 182, 0, + 0, 0, 992, 0, 0, 0, 0, 0, 0, 0, + 0, 712, 713, 714, 715, 716, 717, 718, 719, 720, + 721, 0, 722, 723, 724, 725, 726, 727, 728, 729, + 730, 731, 732, 0, 0, 0, 0, 0, 1065, 733, + 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, + 744, 745, 746, 747, 748, 749, 0, 0, 750, 751, + 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, + 762, 763, 0, 764, 0, 765, 766, 767, 768, 769, + 770, 771, 772, 773, 774, 775, 776, 0, 0, 0, + 777, 0, 778, 0, 779, 780, 781, 782, 783, 784, + 785, 786, 787, 788, 789, 790, 791, 792, 0, 793, + 794, 795, 796, 797, 798, 799, 0, 800, 801, 802, + 803, 804, 0, 0, 0, 805, 806, 807, 808, 809, + 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, + 820, 821, 822, 823, 824, 825, 999, 826, 827, 712, + 713, 714, 715, 716, 717, 718, 719, 720, 721, 0, + 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, + 732, 0, 0, 0, 0, 0, 0, 733, 734, 735, + 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, + 746, 747, 748, 749, 0, 0, 750, 751, 752, 753, + 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, + 0, 764, 0, 765, 766, 767, 768, 769, 770, 771, + 772, 773, 774, 775, 776, 0, 0, 0, 777, 0, + 778, 0, 779, 780, 781, 782, 783, 784, 785, 786, + 787, 788, 789, 790, 791, 792, 0, 793, 794, 795, + 796, 797, 798, 799, 0, 800, 801, 802, 803, 804, + 0, 0, 0, 805, 806, 807, 808, 809, 810, 811, + 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, + 822, 823, 824, 825, 0, 826, 827, 0, 500, 501, + 502, 10, 0, 11, 503, 504, 44, 0, 0, 505, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 160, 161, + 162, 163, 164, 165, 166, 167, 0, 0, 0, 0, + 0, 506, 45, 0, 168, 46, 0, 47, 48, 49, + 50, 507, 0, 52, 0, 0, 53, 508, 0, 1058, + 54, 0, 0, 0, 0, 509, 55, 0, 0, 0, + 0, 0, 56, 57, 58, 0, 0, 0, 0, 510, + 0, 511, 0, 0, 0, 0, 512, 0, 59, 60, + 513, 0, 0, 514, 61, 0, 0, 515, 0, 0, + 62, 63, 64, 0, 0, 65, 0, 66, 500, 501, + 502, 10, 0, 11, 503, 504, 44, 0, 0, 895, + 516, 0, 0, 0, 517, 0, 0, 0, 518, 0, + 519, 0, 0, 0, 520, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 0, 180, 181, 182, + 0, 506, 45, 1054, 0, 46, 0, 47, 48, 49, + 50, 507, 0, 52, 0, 0, 53, 508, 0, 0, + 54, 0, 0, 0, 0, 509, 55, 0, 0, 0, + 0, 0, 56, 57, 58, 0, 0, 0, 0, 510, + 0, 511, 0, 0, 0, 0, 512, 0, 59, 60, + 513, 0, 0, 514, 61, 0, 0, 515, 0, 0, + 62, 63, 64, 0, 0, 65, 0, 66, 7, 8, + 9, 10, 0, 11, 12, 13, 143, 0, 0, 0, + 516, 0, 0, 0, 517, 0, 0, 0, 518, 0, + 519, 0, 0, 0, 520, 0, 0, 0, 160, 161, + 162, 163, 164, 165, 166, 167, 0, 0, 0, 0, + 0, 15, 45, 0, 168, 144, 0, 145, 146, 147, + 50, 51, 0, 52, 0, 0, 148, 21, 0, 0, + 54, 0, 0, 0, 0, 22, 149, 0, 0, 0, + 0, 0, 150, 151, 58, 0, 0, 0, 0, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 152, 153, + 30, 0, 0, 31, 61, 0, 0, 32, 0, 0, + 62, 63, 154, 0, 0, 65, 0, 155, 500, 501, + 502, 10, 0, 11, 503, 504, 44, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 405, 0, 0, 40, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 0, 180, 181, 182, + 406, 506, 45, 0, 0, 46, 0, 47, 48, 49, + 50, 507, 0, 52, 0, 0, 53, 508, 0, 0, + 54, 0, 0, 0, 0, 509, 55, 0, 0, 0, + 0, 0, 56, 57, 58, 0, 0, 0, 0, 510, + 0, 511, 0, 0, 0, 0, 512, 0, 59, 60, + 513, 0, 0, 514, 61, 0, 0, 515, 0, 0, + 62, 63, 64, 0, 0, 65, 0, 66, 7, 8, + 9, 10, 0, 11, 12, 13, 14, 0, 0, 0, + 516, 0, 0, 0, 517, 0, 0, 0, 518, 0, + 519, 0, 0, 0, 520, 957, 958, 959, 960, 961, + 962, 0, 0, 0, 46, 0, 47, 48, 49, 963, + 0, 15, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 0, 56, 191, 58, 0, 22, 23, 0, 0, 0, + 0, 0, 24, 25, 0, 0, 0, 59, 60, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 28, 29, + 30, 64, 0, 31, 0, 0, 66, 32, 7, 8, + 9, 10, 33, 11, 12, 13, 14, 34, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 0, 307, 967, 40, 0, 968, 969, 970, 971, + 972, 15, 973, 974, 975, 16, 0, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 0, 0, 0, 0, 0, 22, 23, 0, 0, 0, + 0, 0, 24, 25, 0, 0, 0, 0, 0, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 28, 29, + 30, 0, 0, 31, 0, 0, 0, 32, 7, 8, + 9, 10, 33, 11, 12, 13, 14, 34, 0, 0, + 0, 0, 445, 0, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 0, 0, 0, 40, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 0, 0, 0, 0, 0, 22, 23, 0, 0, 0, + 0, 0, 24, 25, 0, 0, 0, 0, 0, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 28, 29, + 30, 0, 0, 31, 0, 0, 0, 32, 7, 8, + 9, 10, 33, 11, 12, 13, 14, 34, 0, 0, + 0, 0, 552, 0, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 0, 0, 0, 40, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 0, 0, 0, 0, 0, 22, 23, 0, 0, 0, + 0, 0, 24, 25, 0, 0, 0, 0, 0, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 28, 29, + 30, 0, 0, 31, 0, 0, 0, 32, 7, 8, + 9, 10, 33, 11, 12, 13, 14, 34, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 0, 920, 0, 40, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 0, 0, 0, 0, 0, 22, 23, 0, 0, 0, + 0, 0, 24, 25, 0, 0, 0, 0, 0, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 28, 29, + 30, 0, 0, 31, 0, 0, 0, 32, 7, 8, + 9, 10, 33, 11, 12, 13, 14, 34, 0, 0, + 0, 0, 935, 0, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 0, 0, 0, 40, 0, 0, 0, 0, 0, + 0, 15, 0, 0, 0, 16, 0, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 0, 0, 0, 0, 0, 22, 23, 0, 0, 0, + 0, 0, 24, 25, 0, 0, 0, 0, 0, 26, + 0, 27, 0, 0, 0, 0, 0, 0, 28, 29, + 30, 0, 0, 31, 0, 0, 0, 32, 7, 8, + 9, 10, 33, 11, 12, 13, 14, 34, 0, 7, + 8, 9, 10, 0, 11, 12, 13, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, 0, + 39, 0, 1030, 0, 40, 0, 81, 0, 0, 0, + 0, 15, 0, 0, 82, 16, 0, 17, 18, 19, + 0, 0, 867, 84, 85, 86, 20, 21, 0, 0, + 0, 0, 0, 212, 0, 22, 23, 0, 868, 92, + 0, 0, 24, 25, 0, 0, 22, 0, 97, 26, + 0, 27, 0, 98, 0, 0, 0, 0, 28, 29, + 30, 0, 27, 31, 0, 0, 103, 32, 104, 0, + 0, 869, 33, 0, 870, 0, 0, 34, 32, 0, + 0, 0, 0, -127, 0, 0, 0, 0, 0, 0, + 35, 0, 0, 0, 36, 37, 0, 0, 38, -2, + 39, 871, 0, 0, 40, 872, 873, 561, 0, 874, + 0, 875, 0, 0, 0, 876, 562, 563, 564, 565, + 566, 567, 568, 569, 0, 0, 0, 0, 0, 0, + 0, 0, 570, 0, 571, 572, 573, 574, 575, 576, + 577, 578, 579, 580, 581, 582, 0, 80, 81, 0, + 0, 0, 0, 0, 0, 0, 82, 0, 0, 0, + 0, 583, 0, 83, 0, 84, 85, 86, 87, 0, + 0, 88, 0, 0, 0, 89, 0, 0, 0, 90, + 91, 92, 93, 0, 0, 584, 0, 94, 95, 96, + 97, 0, 0, 0, 0, 98, 99, 0, 0, 100, + 0, 243, 244, 101, 0, 0, 0, 102, 103, 0, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 585, + 0, 0, 586, 0, 587, 588, 589, 590, 591, 592, + 593, 594, 595, 596, 597, 0, 598, 599, 245, 0, + 600, 46, 0, 47, 48, 49, 50, 246, 0, 247, + 0, 0, 53, 0, 0, 0, 54, 0, 0, 0, + 0, 0, 55, 324, 0, 0, 0, 0, 56, 57, + 58, 0, 243, 244, 0, 0, 0, 0, 248, 0, + 0, 0, 0, 0, 59, 60, 0, 0, 0, 0, + 61, 0, 0, 0, 0, 0, 249, 63, 64, 0, + 0, 65, 46, 66, 47, 48, 49, 0, 250, 245, + 0, 0, 46, 0, 47, 48, 49, 50, 246, 0, + 247, 0, 0, 53, 251, 0, 0, 54, 0, 56, + 191, 58, 0, 55, 0, 0, 243, 244, 0, 56, + 57, 58, 0, 0, 0, 59, 60, 0, 0, 248, + 0, 0, 0, 0, 0, 59, 60, 0, 0, 64, + 0, 61, 0, 0, 66, 0, 0, 249, 63, 64, + 0, 0, 65, 245, 66, 0, 46, 0, 47, 48, + 49, 50, 340, 0, 247, 0, 0, 53, 0, 0, + 0, 54, 0, 0, 0, 251, 0, 55, 0, 0, + 0, 0, 0, 56, 57, 58, 0, 0, 0, 0, + 0, 0, 0, 248, 0, 0, 0, 0, 0, 59, + 60, 0, 0, 0, 0, 61, 0, 0, 0, 0, + 0, 249, 63, 64, 0, 0, 65, 0, 66, 160, + 161, 162, 163, 164, 165, 166, 167, 0, 0, 0, + 0, 0, 0, 0, 0, 168, 0, 0, 0, 251, + 160, 161, 162, 163, 164, 165, 166, 167, 0, 0, + 0, 0, 0, 0, 0, 0, 168, 0, 160, 161, + 162, 163, 164, 165, 166, 167, 0, 0, 0, 0, + 0, 0, 0, 0, 168, 0, 160, 161, 162, 163, + 164, 165, 166, 167, 0, 0, 0, 0, 0, 0, + 0, 0, 168, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 0, 0, 0, 0, 0, 0, 0, - 0, 168, 956, 957, 958, 959, 960, 961, 962, 0, - 0, 0, 0, 0, 0, 0, 0, 963, 162, 163, - 164, 165, 166, 167, 0, 0, 0, 46, 0, 47, - 48, 49, 168, 162, 163, 164, 165, 166, 167, 0, - 0, 0, 0, 0, 0, 0, 0, 168, 162, 163, - 164, 165, 166, 167, 56, 191, 58, 0, 0, 0, - 0, 0, 168, 957, 958, 959, 960, 961, 962, 0, - 59, 60, 0, 0, 0, 0, 0, 963, 162, 163, - 164, 165, 166, 167, 64, 0, 0, 0, 0, 66, - 0, 0, 168, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 0, 180, 181, 182, 0, 0, 965, - 966, 967, 134, 0, 968, 969, 970, 971, 972, 0, - 973, 974, 975, 0, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 0, 180, 181, 182, 0, 0, + 0, 168, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 0, 180, 181, + 182, 385, 0, 0, 0, 0, 0, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 0, 180, + 181, 182, 534, 382, 0, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 0, 180, 181, 182, + 557, 0, 0, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 0, 180, 181, 182, 848, 0, + 0, 0, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 0, 180, 181, 182, 160, 161, 162, + 163, 164, 165, 166, 167, 0, 0, 0, 0, 0, + 0, 0, 0, 168, 160, 161, 162, 163, 164, 165, + 166, 167, 0, 0, 0, 0, 0, 0, 0, 0, + 168, 678, 679, 680, 681, 682, 683, 684, 685, 0, + 0, 0, 0, 0, 0, 0, 0, 686, 955, 956, + 957, 958, 959, 960, 961, 962, 0, 0, 0, 0, + 0, 0, 0, 0, 963, 955, 956, 957, 958, 959, + 960, 961, 962, 0, 0, 0, 0, 0, 0, 0, + 0, 963, 161, 162, 163, 164, 165, 166, 167, 0, + 0, 0, 0, 0, 0, 0, 0, 168, 0, 0, + 0, 0, 990, 0, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 0, 180, 181, 182, 0, + 0, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 0, 180, 181, 182, 0, 0, 687, 688, + 689, 690, 691, 692, 693, 694, 695, 696, 697, 0, + 698, 699, 700, 1052, 0, 964, 965, 966, 967, 0, + 0, 968, 969, 970, 971, 972, 0, 973, 974, 975, + 0, 0, 964, 965, 966, 967, 0, 0, 968, 969, + 970, 971, 972, 0, 973, 974, 975, 0, 0, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 0, - 180, 181, 182, 0, 0, 0, 172, 173, 174, 175, - 176, 177, 178, 179, 0, 180, 181, 182, 0, 965, - 966, 967, 0, 0, 968, 969, 970, 971, 972, 0, - 973, 974, 975, 407, 408, 0, 0, 173, 174, 175, - 176, 177, 178, 179, 0, 180, 181, 182, 957, 958, - 959, 960, 961, 962, 0, 0, 0, 0, 0, 0, - 0, 0, 963, 46, 0, 47, 48, 49, 0, 0, - 0, 0, 0, 46, 0, 47, 48, 49, 409, 410, - 0, 0, 0, 0, 53, 0, 0, 0, 0, 0, - 56, 191, 58, 0, 55, 0, 0, 0, 0, 0, - 56, 57, 58, 407, 408, 0, 59, 60, 0, 0, - 0, 0, 0, 0, 0, 0, 59, 60, 0, 0, - 64, 0, 0, 0, 0, 66, 0, 0, 411, 0, - 64, 0, 0, 65, 0, 66, 0, 0, 0, 0, - 0, 0, 0, 46, 0, 47, 48, 49, 137, 0, - 0, 0, 44, 0, 53, 966, 967, 0, 0, 968, - 969, 970, 971, 972, 55, 973, 974, 975, 0, 0, - 56, 57, 58, 0, 0, 0, 0, 0, 0, 0, - 46, 0, 47, 48, 49, 0, 59, 60, 45, 0, - 0, 46, 0, 47, 48, 49, 50, 51, 0, 52, - 64, 312, 53, 65, 0, 66, 54, 56, 191, 58, - 0, 0, 55, 44, 0, 0, 0, 0, 56, 57, - 58, 0, 0, 59, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 59, 60, 0, 64, 0, 0, - 61, 46, 66, 47, 48, 49, 62, 63, 64, 45, - 44, 65, 46, 66, 47, 48, 49, 50, 348, 0, - 52, 0, 0, 53, 0, 0, 0, 54, 56, 191, - 58, 0, 0, 55, 0, 0, 0, 0, 0, 56, - 57, 58, 0, 0, 59, 60, 45, 0, 0, 46, - 0, 47, 48, 49, 50, 59, 60, 52, 64, 0, - 53, 61, 0, 66, 54, 0, 0, 62, 63, 64, - 55, 44, 65, 0, 66, 0, 56, 57, 58, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 661, 0, 59, 60, 0, 0, 0, 0, 61, 0, - 0, 0, 0, 0, 62, 63, 64, 45, 127, 65, - 46, 66, 47, 48, 49, 50, 0, 0, 52, 0, - 0, 53, 0, 0, 0, 54, 0, 0, 0, 0, + 180, 181, 182, 956, 957, 958, 959, 960, 961, 962, + 0, 0, 0, 46, 0, 47, 48, 49, 963, 162, + 163, 164, 165, 166, 167, 0, 0, 0, 0, 0, + 0, 0, 0, 168, 162, 163, 164, 165, 166, 167, + 56, 191, 58, 0, 0, 0, 0, 0, 168, 162, + 163, 164, 165, 166, 167, 0, 59, 60, 0, 0, + 0, 0, 0, 168, 957, 958, 959, 960, 961, 962, + 64, 0, 0, 0, 0, 66, 0, 0, 963, 957, + 958, 959, 960, 961, 962, 0, 0, 0, 0, 0, + 0, 0, 0, 963, 164, 165, 166, 167, 134, 0, + 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, + 965, 966, 967, 0, 0, 968, 969, 970, 971, 972, + 0, 973, 974, 975, 0, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 0, 180, 181, 182, 0, + 0, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 0, 180, 181, 182, 0, 0, 0, 172, 173, 174, + 175, 176, 177, 178, 179, 216, 180, 181, 182, 0, + 965, 966, 967, 0, 0, 968, 969, 970, 971, 972, + 0, 973, 974, 975, 0, 0, 966, 967, 0, 0, + 968, 969, 970, 971, 972, 0, 973, 974, 975, 0, + 0, 173, 174, 175, 176, 177, 178, 179, 81, 180, + 181, 182, 0, 0, 407, 408, 82, 0, 0, 0, + 0, 0, 0, 0, 0, 84, 85, 86, 0, 0, + 0, 0, 0, 0, 0, 212, 0, 0, 0, 0, + 0, 92, 0, 0, 46, 0, 47, 48, 49, 0, + 97, 407, 408, 0, 46, 98, 47, 48, 49, 409, + 410, 0, 0, 0, 0, 53, 0, 0, 103, 0, + 104, 56, 191, 58, 0, 55, 0, 0, 0, 0, + 0, 56, 57, 58, 0, 0, 0, 59, 60, 0, + 0, 46, 0, 47, 48, 49, 0, 59, 60, 0, + 44, 64, 53, 0, 0, 0, 66, 0, 0, 411, + 0, 64, 55, 0, 65, 0, 66, 0, 56, 57, + 58, 0, 0, 0, 0, 0, 0, 0, 46, 137, + 47, 48, 49, 0, 59, 60, 45, 0, 0, 46, + 0, 47, 48, 49, 50, 51, 0, 52, 64, 312, + 53, 65, 0, 66, 54, 56, 191, 58, 0, 0, + 55, 44, 0, 0, 0, 0, 56, 57, 58, 0, + 0, 59, 60, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 59, 60, 0, 64, 0, 0, 61, 46, + 66, 47, 48, 49, 62, 63, 64, 45, 44, 65, + 46, 66, 47, 48, 49, 50, 348, 0, 52, 0, + 0, 53, 0, 0, 0, 54, 56, 191, 58, 0, 0, 55, 0, 0, 0, 0, 0, 56, 57, 58, - 0, 0, 0, 0, 0, 0, 0, 46, 0, 47, - 48, 49, 50, 59, 60, 0, 0, 0, 53, 61, - 0, 0, 54, 0, 0, 62, 63, 64, 55, 0, + 0, 0, 59, 60, 45, 0, 0, 46, 0, 47, + 48, 49, 50, 59, 60, 52, 64, 0, 53, 61, + 0, 66, 54, 0, 0, 62, 63, 64, 55, 44, 65, 0, 66, 0, 56, 57, 58, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 59, 60, 80, 81, 0, 0, 61, 0, 0, 0, - 0, 82, 128, 63, 64, 0, 0, 65, 83, 66, - 84, 85, 86, 87, 0, 0, 88, 0, 0, 0, - 89, 0, 0, 0, 90, 91, 92, 93, 0, 0, - 0, 0, 94, 95, 96, 97, 0, 0, 80, 81, - 98, 99, 0, 0, 100, 0, 0, 82, 101, 0, - 0, 0, 102, 103, 83, 104, 84, 85, 86, 87, - 0, 0, 88, 105, 0, 0, 89, 0, 0, 0, - 90, 91, 92, 93, 0, 0, 0, 0, 94, 95, - 96, 97, 403, 0, 80, 81, 98, 99, 0, 0, - 100, 0, 0, 82, 101, 0, 0, 0, 102, 103, - 83, 104, 84, 85, 86, 87, 0, 0, 88, 105, - 0, 0, 89, 0, 0, 0, 90, 91, 92, 93, - 0, 0, 0, 0, 94, 95, 96, 97, 467, 0, - 80, 81, 98, 99, 0, 0, 100, 0, 0, 82, - 101, 0, 0, 0, 102, 103, 83, 104, 84, 85, - 86, 87, 0, 0, 88, 105, 0, 0, 89, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 661, 0, + 59, 60, 0, 0, 0, 0, 61, 0, 0, 0, + 0, 0, 62, 63, 64, 45, 127, 65, 46, 66, + 47, 48, 49, 50, 0, 0, 52, 0, 0, 53, + 0, 0, 0, 54, 0, 0, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 56, 57, 58, 0, 0, + 0, 0, 0, 0, 0, 46, 0, 47, 48, 49, + 50, 59, 60, 0, 0, 0, 53, 61, 0, 0, + 54, 0, 0, 62, 63, 64, 55, 0, 65, 0, + 66, 0, 56, 57, 58, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 59, 60, + 80, 81, 0, 0, 61, 0, 0, 0, 0, 82, + 128, 63, 64, 0, 0, 65, 83, 66, 84, 85, + 86, 87, 0, 0, 88, 0, 0, 0, 89, 0, 0, 0, 90, 91, 92, 93, 0, 0, 0, 0, - 94, 95, 96, 97, 475, 0, 80, 81, 98, 99, + 94, 95, 96, 97, 0, 0, 80, 81, 98, 99, 0, 0, 100, 0, 0, 82, 101, 0, 0, 0, 102, 103, 83, 104, 84, 85, 86, 87, 0, 0, 88, 105, 0, 0, 89, 0, 0, 0, 90, 91, 92, 93, 0, 0, 0, 0, 94, 95, 96, 97, - 544, 0, 80, 81, 98, 99, 0, 0, 100, 0, + 403, 0, 80, 81, 98, 99, 0, 0, 100, 0, 0, 82, 101, 0, 0, 0, 102, 103, 83, 104, 84, 85, 86, 87, 0, 0, 88, 105, 0, 0, 89, 0, 0, 0, 90, 91, 92, 93, 0, 0, - 0, 0, 94, 95, 96, 97, 636, 0, 80, 81, + 0, 0, 94, 95, 96, 97, 467, 0, 80, 81, 98, 99, 0, 0, 100, 0, 0, 82, 101, 0, 0, 0, 102, 103, 83, 104, 84, 85, 86, 87, 0, 0, 88, 105, 0, 0, 89, 0, 0, 0, 90, 91, 92, 93, 0, 0, 0, 0, 94, 95, - 96, 97, 857, 0, 0, 0, 98, 99, 0, 46, - 100, 47, 48, 49, 101, 0, 81, 0, 102, 103, - 187, 104, 0, 0, 82, 0, 0, 0, 0, 105, - 188, 0, 0, 84, 85, 86, 56, 189, 58, 0, - 0, 0, 0, 212, 0, 0, 0, 0, 858, 92, - 0, 0, 59, 60, 0, 0, 0, 0, 97, 0, - 0, 0, 0, 98, 80, 81, 64, 0, 0, 0, - 0, 66, 0, 82, 0, 0, 103, 0, 104, 0, - 83, 0, 84, 85, 86, 87, 0, 0, 88, 0, - 0, 0, 89, -127, 126, 0, 90, 91, 92, 93, - 0, 0, 0, 0, 94, 95, 96, 97, 0, 0, - 0, 0, 98, 99, 0, 46, 100, 47, 48, 49, - 101, 81, 0, 0, 102, 103, 187, 104, 0, 82, - 0, 0, 0, 81, 0, 0, 188, 0, 84, 85, - 86, 82, 56, 189, 58, 0, 0, 0, 212, 0, - 84, 85, 86, 0, 92, 221, 0, 0, 59, 60, - 212, 0, 0, 97, 0, 0, 92, 0, 98, 0, - 81, 0, 64, 0, 0, 97, 0, 66, 82, 0, - 98, 103, 0, 104, 100, 0, 0, 84, 85, 86, - 0, 0, 0, 103, 0, 104, 0, 212, 0, 0, - 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, - 0, 0, 97, 0, 0, 0, 0, 98, 0, 0, + 96, 97, 475, 0, 80, 81, 98, 99, 0, 0, + 100, 0, 0, 82, 101, 0, 0, 0, 102, 103, + 83, 104, 84, 85, 86, 87, 0, 0, 88, 105, + 0, 0, 89, 0, 0, 0, 90, 91, 92, 93, + 0, 0, 0, 0, 94, 95, 96, 97, 544, 0, + 80, 81, 98, 99, 0, 0, 100, 0, 0, 82, + 101, 0, 0, 0, 102, 103, 83, 104, 84, 85, + 86, 87, 0, 0, 88, 105, 0, 0, 89, 0, + 0, 0, 90, 91, 92, 93, 0, 0, 0, 0, + 94, 95, 96, 97, 636, 0, 80, 81, 98, 99, + 0, 0, 100, 0, 0, 82, 101, 0, 0, 0, + 102, 103, 83, 104, 84, 85, 86, 87, 0, 0, + 88, 105, 0, 0, 89, 0, 0, 0, 90, 91, + 92, 93, 0, 0, 0, 0, 94, 95, 96, 97, + 857, 0, 0, 0, 98, 99, 0, 46, 100, 47, + 48, 49, 101, 0, 0, 0, 102, 103, 187, 104, + 0, 0, 0, 0, 0, 0, 0, 105, 188, 0, + 0, 0, 0, 0, 56, 189, 58, 0, 80, 81, + 0, 0, 0, 0, 0, 0, 858, 82, 0, 0, + 59, 60, 0, 0, 83, 0, 84, 85, 86, 87, + 0, 0, 88, 0, 64, 0, 89, 0, 0, 66, + 90, 91, 92, 93, 0, 0, 0, 0, 94, 95, + 96, 97, 0, 0, 0, 0, 98, 99, 0, 0, + 100, 0, 126, 46, 101, 47, 48, 49, 102, 103, + 81, 104, 0, 0, 187, 0, 0, 0, 82, 0, + 0, 0, 0, 0, 188, 0, 0, 84, 85, 86, + 56, 189, 58, 0, 0, 0, 0, 212, 0, 0, + 0, 0, 0, 92, 221, 0, 59, 60, 0, 0, + 81, 0, 97, 0, 0, 0, 0, 98, 82, 0, + 64, 0, 0, 0, 0, 66, 0, 84, 85, 86, + 103, 81, 104, 0, 0, 0, 0, 212, 0, 82, + 0, 0, 0, 92, 0, 0, 0, 0, 84, 85, + 86, 0, 97, 0, 0, 0, 0, 98, 212, 0, + 0, 100, 0, 0, 92, 0, 0, 0, 0, 0, + 103, 0, 104, 97, 0, 0, 0, 0, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 103, 0, 104 + 0, 103, 0, 104 }; #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-659))) + (!!((Yystate) == (-677))) #define yytable_value_is_error(Yytable_value) \ YYID (0) static const yytype_int16 yycheck[] = { - 1, 424, 26, 39, 499, 100, 10, 11, 512, 552, - 0, 26, 51, 341, 118, 119, 120, 121, 122, 39, - 124, 125, 126, 6, 327, 8, 14, 121, 109, 133, - 134, 118, 109, 137, 138, 135, 543, 405, 533, 118, - 463, 109, 136, 226, 135, 12, 704, 10, 11, 135, - 137, 10, 11, 421, 10, 11, 424, 135, 137, 652, - 81, 82, 85, 84, 85, 86, 67, 118, 89, 118, - 135, 92, 118, 2, 118, 135, 97, 98, 101, 100, - 101, 117, 103, 104, 26, 109, 137, 123, 137, 10, - 11, 137, 135, 137, 109, 463, 126, 10, 11, 135, - 136, 117, 609, 119, 120, 121, 35, 36, 37, 38, - 118, 40, 31, 10, 11, 116, 120, 118, 119, 120, - 121, 122, 545, 124, 125, 126, 135, 83, 456, 137, - 118, 482, 133, 134, 136, 137, 137, 138, 489, 490, - 491, 492, 493, 494, 512, 328, 653, 420, 117, 332, - 423, 120, 425, 234, 137, 458, 237, 234, 117, 135, - 237, 181, 657, 130, 469, 470, 234, 109, 351, 237, - 274, 499, 676, 524, 137, 448, 449, 545, 451, 452, - 453, 454, 677, 117, 185, 118, 120, 135, 121, 847, - 135, 212, 118, 31, 135, 216, 117, 135, 199, 200, - 201, 202, 203, 204, 117, 533, 207, 246, 118, 248, - 234, 137, 126, 237, 121, 134, 135, 136, 6, 234, - 8, 404, 237, 135, 497, 226, 6, 137, 8, 136, - 135, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 1, 424, 100, 39, 499, 552, 10, 11, 512, 6, + 327, 8, 51, 26, 118, 119, 120, 121, 122, 39, + 124, 125, 126, 341, 12, 10, 11, 121, 704, 133, + 134, 109, 109, 137, 138, 14, 118, 405, 533, 0, + 463, 109, 136, 118, 543, 135, 10, 11, 118, 226, + 135, 117, 26, 421, 120, 137, 424, 10, 11, 118, + 81, 82, 137, 84, 85, 86, 67, 137, 89, 10, + 11, 92, 6, 2, 8, 31, 97, 98, 137, 100, + 101, 117, 103, 104, 26, 427, 118, 123, 135, 431, + 432, 433, 434, 435, 118, 463, 109, 135, 85, 135, + 136, 117, 10, 11, 120, 137, 35, 36, 37, 38, + 609, 40, 121, 137, 101, 116, 120, 118, 119, 120, + 121, 122, 545, 124, 125, 126, 6, 136, 8, 469, + 470, 185, 133, 134, 117, 109, 137, 138, 456, 118, + 137, 458, 130, 135, 512, 199, 200, 201, 202, 203, + 204, 328, 137, 117, 653, 332, 234, 234, 135, 237, + 237, 181, 657, 135, 117, 135, 234, 109, 118, 237, + 274, 847, 676, 118, 351, 83, 117, 545, 134, 135, + 136, 499, 677, 126, 185, 420, 118, 137, 423, 135, + 425, 212, 137, 118, 536, 216, 10, 11, 199, 200, + 201, 202, 203, 204, 118, 137, 207, 246, 135, 248, + 31, 118, 137, 448, 449, 533, 451, 452, 453, 454, + 135, 234, 4, 137, 237, 226, 135, 404, 10, 11, + 137, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 135, 182, 120, 118, 529, 186, 118, 135, - 136, 88, 89, 90, 57, 118, 59, 60, 118, 4, - 117, 64, 930, 274, 137, 10, 11, 137, 871, 872, - 873, 874, 109, 876, 137, 558, 709, 137, 117, 118, - 473, 135, 234, 476, 645, 237, 134, 135, 136, 135, - 136, 340, 135, 136, 233, 114, 115, 116, 676, 348, - 135, 662, 313, 120, 619, 339, 120, 120, 623, 320, - 625, 120, 627, 628, 629, 136, 137, 328, 329, 657, - 120, 332, 135, 136, 137, 88, 89, 90, 339, 997, - 135, 709, 136, 1001, 135, 135, 136, 137, 349, 120, - 351, 10, 11, 12, 283, 284, 137, 16, 151, 152, - 153, 154, 955, 956, 957, 958, 959, 960, 961, 962, - 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, - 973, 130, 421, 10, 1042, 424, 410, 117, 1046, 484, - 885, 320, 935, 120, 126, 135, 189, 56, 191, 10, - 11, 12, 1060, 404, 135, 16, 135, 119, 135, 136, - 137, 1069, 137, 118, 415, 208, 1009, 137, 347, 842, - 421, 137, 137, 424, 463, 138, 427, 356, 87, 137, - 431, 432, 433, 434, 435, 137, 137, 127, 137, 459, - 441, 461, 137, 137, 445, 56, 117, 551, 119, 120, - 121, 137, 111, 382, 137, 456, 137, 127, 137, 1052, - 137, 485, 463, 484, 135, 136, 125, 120, 507, 117, - 135, 130, 473, 512, 842, 476, 135, 10, 11, 118, - 118, 482, 137, 519, 135, 980, 510, 117, 489, 490, - 491, 492, 493, 494, 495, 510, 140, 117, 499, 519, - 111, 135, 135, 427, 927, 118, 545, 431, 432, 433, - 434, 435, 10, 127, 125, 118, 445, 138, 130, 130, - 943, 130, 55, 524, 135, 135, 468, 469, 470, 130, - 118, 121, 533, 884, 327, 536, 12, 466, 121, 185, - 16, 130, 543, 135, 545, 126, 126, 138, 135, 118, - 551, 552, 62, 199, 200, 201, 202, 203, 204, 927, - 137, 137, 136, 73, 74, 10, 99, 137, 510, 140, - 118, 994, 105, 106, 137, 943, 109, 10, 119, 136, - 56, 118, 135, 93, 56, 137, 4, 516, 517, 518, - 31, 520, 102, 135, 118, 10, 11, 12, 137, 137, - 140, 16, 638, 138, 640, 126, 138, 135, 609, 882, - 140, 137, 536, 126, 543, 137, 135, 1040, 128, 135, - 130, 131, 661, 552, 660, 140, 994, 663, 118, 137, - 666, 667, 127, 137, 127, 111, 135, 676, 639, 119, - 137, 56, 119, 137, 645, 137, 135, 135, 550, 125, - 137, 135, 653, 926, 130, 137, 657, 138, 137, 135, - 127, 662, 137, 137, 127, 458, 137, 313, 137, 135, - 709, 135, 1040, 674, 220, 31, 677, 619, 607, 699, - 609, 623, 137, 625, 844, 627, 628, 629, 31, 130, - 131, 132, 926, 134, 135, 136, 111, 19, 20, 21, - 22, 882, 977, 704, 977, 484, 237, 485, 709, 31, - 125, 221, 410, 510, 224, 130, 639, 237, 474, 549, - 805, -1, -1, -1, 653, -1, -1, -1, -1, 239, - -1, 871, 872, 873, 874, -1, 876, -1, -1, 249, - -1, 251, -1, -1, -1, -1, -1, 257, 258, 678, + 179, 180, 118, 182, 930, 136, 137, 186, 482, 313, + 234, 118, 497, 237, 121, 489, 490, 491, 492, 493, + 494, 137, 135, 274, 10, 11, 12, 135, 136, 619, + 16, 117, 118, 623, 126, 625, 709, 627, 628, 629, + 135, 136, 234, 120, 529, 237, 473, 135, 136, 476, + 524, 340, 135, 57, 233, 59, 60, 135, 676, 348, + 64, 135, 313, 134, 135, 136, 88, 89, 90, 320, + 56, 997, 135, 558, 135, 1001, 120, 328, 329, 136, + 137, 332, 120, 10, 11, 120, 120, 109, 339, 657, + 135, 709, 117, 12, 119, 120, 121, 16, 349, 135, + 351, 135, 136, 137, 283, 284, 120, 114, 115, 116, + 135, 136, 130, 137, 120, 339, 1042, 88, 89, 90, + 1046, 135, 136, 137, 136, 111, 120, 10, 55, 135, + 136, 137, 421, 10, 1060, 424, 484, 56, 935, 125, + 885, 320, 117, 1069, 130, 126, 135, 151, 152, 153, + 154, 135, 135, 404, 10, 11, 12, 119, 137, 31, + 16, 118, 127, 117, 415, 119, 120, 121, 347, 842, + 421, 645, 99, 424, 463, 127, 427, 356, 105, 106, + 431, 432, 433, 434, 435, 189, 410, 191, 662, 459, + 441, 461, 111, 137, 445, 137, 137, 551, 137, 137, + 56, 137, 137, 382, 208, 456, 125, 31, 137, 137, + 120, 130, 463, 484, 137, 137, 135, 137, 507, 137, + 137, 117, 473, 512, 842, 476, 138, 118, 118, 135, + 135, 482, 140, 519, 137, 980, 21, 22, 489, 490, + 491, 492, 493, 494, 495, 118, 31, 510, 499, 519, + 135, 135, 117, 117, 927, 111, 545, 652, 130, 131, + 132, 485, 134, 135, 136, 10, 445, 10, 127, 125, + 943, 118, 130, 524, 130, 130, 468, 469, 470, 135, + 130, 138, 533, 135, 118, 536, 510, 466, 121, 10, + 11, 12, 543, 62, 545, 16, 121, 10, 11, 130, + 551, 552, 137, 135, 73, 74, 130, 131, 132, 927, + 134, 135, 136, 126, 135, 126, 138, 137, 510, 136, + 118, 994, 10, 327, 93, 943, 140, 137, 118, 137, + 10, 119, 10, 102, 136, 56, 118, 516, 517, 518, + 135, 520, 55, 128, 129, 130, 131, 132, 137, 134, + 135, 136, 638, 56, 640, 4, 135, 118, 609, 128, + 140, 130, 131, 31, 543, 137, 87, 1040, 138, 137, + 126, 138, 661, 552, 660, 140, 994, 663, 137, 137, + 666, 667, 135, 135, 135, 126, 99, 676, 639, 118, + 111, 140, 105, 106, 645, 137, 109, 882, 10, 11, + 127, 137, 653, 127, 125, 135, 657, 119, 119, 130, + 884, 662, 137, 135, 135, 21, 22, 137, 137, 137, + 709, 135, 1040, 674, 550, 31, 677, 619, 607, 699, + 609, 623, 137, 625, 135, 627, 628, 629, 138, 137, + 137, 926, 127, 55, 137, 127, 31, 137, 135, 135, + 844, 926, 221, 704, 458, 977, 137, 220, 709, 882, + 128, 129, 130, 131, 132, 137, 134, 135, 136, 484, + 239, 237, 485, 410, 653, 237, 871, 872, 873, 874, + 249, 876, 251, 639, 510, -1, 474, 99, 257, 258, + 549, 805, 977, 105, 106, -1, -1, 109, -1, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, -1, 700, 128, 129, 130, 131, 132, -1, 134, 135, - 136, -1, -1, 887, -1, 128, 129, 130, 131, 132, - -1, 134, 135, 136, -1, 3, 4, 5, 6, -1, - 8, 9, 10, 842, 805, -1, 128, 129, 130, 131, - 132, 321, 134, 135, 136, 955, 956, 957, 958, 959, - 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, - 970, 971, 972, 973, -1, -1, -1, -1, 46, 875, - -1, 842, -1, -1, 31, 355, 847, -1, -1, -1, - -1, -1, -1, -1, 62, 875, -1, 10, 11, -1, - -1, -1, 70, -1, -1, -1, -1, -1, -1, 1009, - -1, -1, -1, -1, -1, -1, -1, -1, 86, -1, - -1, -1, -1, 884, 885, -1, 887, 95, 927, -1, - 98, -1, 402, -1, 102, -1, -1, -1, -1, 409, - -1, 411, 55, -1, 943, 834, -1, -1, 944, 945, - 946, 947, 1052, 21, 22, -1, -1, 125, -1, -1, - -1, 129, 130, 31, -1, 133, 927, 135, -1, 930, - -1, 139, -1, -1, 935, -1, 17, 18, 19, 20, - 21, 22, 943, 130, 131, 132, 99, 134, 135, 136, - 31, -1, 105, 106, 974, 994, 21, 22, 468, 469, - 470, 890, -1, -1, -1, -1, 31, -1, 897, 15, + 136, -1, -1, 887, 17, 18, 19, 20, 21, 22, + -1, -1, -1, 128, 129, 130, 131, 132, 31, 134, + 135, 136, 321, 842, 805, -1, -1, -1, -1, -1, + 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, + 965, 966, 967, 968, 969, 970, 971, 972, 973, 10, + 11, -1, -1, -1, -1, -1, 355, -1, -1, 875, + -1, 842, -1, -1, -1, -1, 847, 19, 20, 21, + 22, -1, -1, -1, -1, 875, -1, -1, -1, 31, + -1, -1, -1, -1, 1009, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, + -1, -1, -1, 884, 885, -1, 887, -1, 927, -1, + 409, -1, 411, 126, 127, 128, 129, 130, 131, 132, + -1, 134, 135, 136, 943, 834, -1, 1052, 944, 945, + 946, 947, -1, -1, -1, -1, -1, -1, 99, -1, + -1, -1, -1, -1, 105, 106, 927, -1, 109, 930, + -1, -1, -1, -1, 935, -1, -1, -1, -1, -1, + -1, -1, 943, -1, -1, -1, -1, -1, -1, 468, + 469, 470, -1, -1, 974, 994, 128, 129, 130, 131, + 132, 890, 134, 135, 136, -1, -1, -1, 897, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, 980, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, 994, -1, -1, 997, -1, -1, -1, 1001, 1040, -1, -1, -1, -1, 935, -1, -1, -1, - -1, -1, -1, -1, -1, 1035, -1, 1037, -1, -1, + -1, -1, -1, -1, -1, 1035, -1, 1037, -1, 17, + 18, 19, 20, 21, 22, -1, -1, 871, 872, 873, + 874, 550, 876, 31, -1, -1, -1, -1, -1, 1040, + -1, 1042, -1, 1063, 1064, 1046, 975, 15, 16, 17, + 18, 19, 20, 21, 22, -1, -1, -1, -1, 1060, + -1, 990, -1, 31, -1, -1, -1, -1, 1069, -1, + -1, -1, -1, -1, -1, -1, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 606, 134, 135, + 136, -1, -1, -1, 140, -1, -1, -1, -1, 618, + 619, 620, -1, -1, 623, -1, 625, -1, 627, 628, + 629, 955, 956, 957, 958, 959, 960, 961, 962, 963, + 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 128, 129, 130, 131, 132, -1, 134, 135, 136, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 1040, - 550, 1042, -1, 1063, 1064, 1046, 975, 128, 129, 130, - 131, 132, -1, 134, 135, 136, -1, -1, -1, 1060, - -1, 990, -1, 128, 129, 130, 131, 132, 1069, 134, - 135, 136, -1, -1, -1, -1, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, -1, 134, 135, - 136, -1, -1, -1, 140, -1, 606, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 618, 619, - 620, -1, -1, 623, -1, 625, -1, 627, 628, 629, - -1, -1, -1, -1, -1, 635, 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, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, -1, -1, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, -1, 65, -1, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, -1, -1, -1, 82, -1, 84, -1, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, -1, 101, 102, 103, 104, 105, 106, - 107, -1, 109, 110, 111, 112, 113, -1, -1, -1, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 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, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, - -1, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, -1, 65, -1, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - -1, -1, -1, 82, -1, 84, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, -1, 101, 102, 103, 104, 105, 106, 107, -1, - 109, 110, 111, 112, 113, -1, -1, -1, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, -1, - 139, 140, -1, 3, 4, 5, 6, -1, 8, 9, - 10, 11, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 15, 16, 17, 18, 19, 20, 21, - 22, -1, -1, -1, -1, -1, 46, 47, -1, 31, - 50, -1, 52, 53, 54, 55, 56, -1, 58, -1, - -1, 61, 62, -1, -1, 65, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, 79, - -1, -1, -1, -1, 84, -1, 86, 10, 11, -1, - -1, 91, -1, 93, 94, 95, -1, -1, 98, 99, - -1, -1, 102, -1, -1, 105, 106, 107, -1, -1, - 110, -1, 112, 3, 4, 5, 6, -1, 8, 9, - 10, 11, -1, -1, 14, 125, -1, -1, 1038, 129, - -1, -1, 55, 133, -1, 135, -1, -1, -1, 139, + -1, -1, -1, -1, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 1009, 134, 135, 136, -1, + -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, + -1, 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, 1052, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, -1, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, -1, 65, -1, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, -1, -1, -1, + 82, -1, 84, -1, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, -1, 101, + 102, 103, 104, 105, 106, 107, -1, 109, 110, 111, + 112, 113, -1, -1, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, -1, 134, 135, 136, -1, 46, 47, 140, -1, - 50, -1, 52, 53, 54, 55, 56, -1, 58, -1, - -1, 61, 62, -1, -1, 65, 99, -1, -1, -1, - 70, 71, 105, 106, -1, -1, 109, 77, 78, 79, - -1, -1, -1, -1, 84, -1, 86, 10, 11, -1, - -1, 91, -1, 93, 94, 95, -1, -1, 98, 99, - -1, -1, 102, -1, -1, 105, 106, 107, -1, -1, - 110, -1, 112, 3, 4, 5, 6, -1, 8, 9, - 10, 11, -1, -1, -1, 125, -1, -1, -1, 129, - -1, -1, 55, 133, -1, 135, -1, -1, -1, 139, - -1, -1, -1, 15, 16, 17, 18, 19, 20, 21, - 22, -1, -1, -1, -1, -1, 46, 47, -1, 31, - 50, -1, 52, 53, 54, 55, 56, -1, 58, -1, - -1, 61, 62, -1, -1, 65, 99, -1, -1, -1, - 70, 71, 105, 106, -1, -1, 109, 77, 78, 79, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, 98, 99, - -1, -1, 102, -1, -1, 105, 106, 107, -1, -1, - 110, -1, 112, 3, 4, 5, 6, -1, 8, 9, - 10, 11, -1, -1, -1, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, -1, -1, 139, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, -1, 134, 135, 136, -1, 46, 47, 140, -1, - 50, -1, 52, 53, 54, 55, 56, -1, 58, -1, - -1, 61, 62, -1, -1, 65, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, 79, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, 91, -1, 93, 94, 95, -1, -1, 98, 99, - -1, -1, 102, -1, -1, 105, 106, 107, -1, -1, - 110, -1, 112, 3, 4, 5, 6, -1, 8, 9, - 10, 11, -1, -1, -1, 125, -1, -1, -1, 129, - -1, -1, -1, 133, -1, 135, -1, -1, -1, 139, - 17, 18, 19, 20, 21, 22, -1, -1, -1, 50, - -1, 52, 53, 54, 31, -1, 46, -1, -1, -1, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, -1, -1, 77, 78, 79, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, -1, - -1, -1, 93, 94, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, 107, -1, 98, -1, - -1, 112, 102, 3, 4, 5, 6, 107, 8, 9, - 10, 11, 112, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 135, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, 137, 125, 139, - -1, 128, 129, 130, 131, 132, 46, 134, 135, 136, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, -1, -1, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, -1, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, 98, -1, - -1, -1, 102, 3, 4, 5, 6, 107, 8, 9, - 10, 11, 112, -1, -1, -1, -1, 117, -1, -1, - -1, -1, -1, -1, -1, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, -1, -1, 139, - -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, -1, -1, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, -1, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, 98, -1, - -1, -1, 102, 3, 4, 5, 6, 107, 8, 9, - 10, 11, 112, -1, -1, -1, -1, 117, -1, -1, - -1, -1, -1, -1, -1, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, -1, -1, 139, - -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, -1, -1, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, -1, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, 98, -1, - -1, -1, 102, 3, 4, 5, 6, 107, 8, 9, - 10, 11, 112, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, 137, -1, 139, - -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, -1, -1, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, -1, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, 98, -1, - -1, -1, 102, 3, 4, 5, 6, 107, 8, 9, - 10, 11, 112, -1, -1, -1, -1, 117, -1, -1, - -1, -1, -1, -1, -1, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, -1, -1, 139, - -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, -1, -1, -1, -1, -1, -1, - 70, 71, -1, -1, -1, -1, -1, 77, 78, -1, - -1, -1, -1, -1, 84, -1, 86, -1, -1, -1, - -1, -1, -1, 93, 94, 95, -1, -1, 98, -1, - -1, -1, 102, 3, 4, 5, 6, 107, 8, 9, - 10, 11, 112, -1, -1, -1, -1, -1, -1, -1, - -1, 6, -1, -1, -1, 125, -1, -1, -1, 129, - 130, -1, -1, 133, -1, 135, -1, 137, -1, 139, - -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 50, -1, 52, 53, 54, -1, -1, -1, -1, -1, - -1, 61, 62, -1, 49, -1, -1, -1, -1, -1, - 70, 71, 57, -1, -1, -1, -1, 77, 78, -1, - -1, 66, 67, 68, 84, -1, 86, -1, -1, -1, - -1, 76, -1, 93, 94, 95, -1, 82, 98, -1, - -1, -1, 102, -1, -1, -1, 91, 107, -1, -1, - -1, 96, 112, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 0, 109, 125, 111, -1, -1, 129, - 130, 6, -1, 133, -1, 135, -1, -1, -1, 139, - 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, - -1, -1, -1, -1, -1, -1, 31, -1, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - -1, 48, 49, -1, -1, -1, -1, -1, -1, -1, - 57, -1, -1, -1, -1, 60, -1, 64, -1, 66, - 67, 68, 69, -1, -1, 72, -1, -1, -1, 76, - -1, -1, -1, 80, 81, 82, 83, -1, -1, 84, - -1, 88, 89, 90, 91, -1, -1, -1, -1, 96, - 97, -1, -1, 100, -1, 10, 11, 104, -1, -1, - -1, 108, 109, -1, 111, -1, -1, -1, -1, -1, - -1, -1, 119, 118, -1, -1, 121, -1, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, - 135, 136, 47, -1, 139, 50, -1, 52, 53, 54, - 55, 56, -1, 58, -1, -1, 61, -1, -1, -1, - 65, -1, -1, -1, -1, -1, 71, 11, -1, -1, - -1, -1, 77, 78, 79, -1, 10, 11, -1, -1, - -1, -1, 87, -1, -1, -1, -1, -1, 93, 94, - -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, - 105, 106, 107, -1, -1, 110, 50, 112, 52, 53, - 54, -1, 117, 47, -1, -1, 50, -1, 52, 53, - 54, 55, 56, -1, 58, -1, -1, 61, 133, -1, - -1, 65, -1, 77, 78, 79, -1, 71, -1, -1, - 10, 11, -1, 77, 78, 79, -1, -1, -1, 93, - 94, -1, -1, 87, -1, -1, -1, -1, -1, 93, - 94, -1, -1, 107, -1, 99, -1, -1, 112, -1, - -1, 105, 106, 107, -1, -1, 110, 47, 112, -1, - 50, -1, 52, 53, 54, 55, 56, -1, 58, -1, - -1, 61, -1, -1, -1, 65, -1, -1, -1, 133, - -1, 71, -1, -1, -1, -1, -1, 77, 78, 79, - -1, -1, -1, -1, -1, -1, -1, 87, -1, 19, - 20, 21, 22, 93, 94, -1, -1, -1, -1, 99, - -1, 31, -1, -1, -1, 105, 106, 107, -1, -1, - 110, -1, 112, 15, 16, 17, 18, 19, 20, 21, - 22, -1, -1, -1, -1, -1, -1, -1, -1, 31, - -1, -1, -1, 133, 15, 16, 17, 18, 19, 20, - 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, - 31, 15, 16, 17, 18, 19, 20, 21, 22, -1, - -1, -1, -1, -1, -1, -1, -1, 31, -1, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, 31, -1, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 126, 127, 128, 129, - 130, 131, 132, 31, 134, 135, 136, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 118, -1, -1, -1, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, -1, 134, 135, 136, 137, -1, -1, -1, -1, - -1, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, -1, 134, 135, 136, 137, -1, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, - 134, 135, 136, 137, 120, -1, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, -1, 134, 135, - 136, 119, -1, -1, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, -1, 134, 135, 136, 15, - 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, 31, 15, 16, 17, 18, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 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, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, -1, -1, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + -1, 65, -1, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, -1, -1, -1, 82, -1, + 84, -1, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, -1, 101, 102, 103, + 104, 105, 106, 107, -1, 109, 110, 111, 112, 113, + -1, -1, -1, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, -1, 139, 140, -1, 3, 4, + 5, 6, -1, 8, 9, 10, 11, -1, -1, 14, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 15, 16, + 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, + -1, 46, 47, -1, 31, 50, -1, 52, 53, 54, + 55, 56, -1, 58, -1, -1, 61, 62, -1, 1038, + 65, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, 79, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, 91, -1, 93, 94, + 95, -1, -1, 98, 99, -1, -1, 102, -1, -1, + 105, 106, 107, -1, -1, 110, -1, 112, 3, 4, + 5, 6, -1, 8, 9, 10, 11, -1, -1, 14, + 125, -1, -1, -1, 129, -1, -1, -1, 133, -1, + 135, -1, -1, -1, 139, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, -1, 134, 135, 136, + -1, 46, 47, 140, -1, 50, -1, 52, 53, 54, + 55, 56, -1, 58, -1, -1, 61, 62, -1, -1, + 65, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, 79, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, 91, -1, 93, 94, + 95, -1, -1, 98, 99, -1, -1, 102, -1, -1, + 105, 106, 107, -1, -1, 110, -1, 112, 3, 4, + 5, 6, -1, 8, 9, 10, 11, -1, -1, -1, + 125, -1, -1, -1, 129, -1, -1, -1, 133, -1, + 135, -1, -1, -1, 139, -1, -1, -1, 15, 16, + 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, + -1, 46, 47, -1, 31, 50, -1, 52, 53, 54, + 55, 56, -1, 58, -1, -1, 61, 62, -1, -1, + 65, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, 79, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, -1, -1, 98, 99, -1, -1, 102, -1, -1, + 105, 106, 107, -1, -1, 110, -1, 112, 3, 4, + 5, 6, -1, 8, 9, 10, 11, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, 118, -1, -1, 139, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, -1, 134, 135, 136, + 137, 46, 47, -1, -1, 50, -1, 52, 53, 54, + 55, 56, -1, 58, -1, -1, 61, 62, -1, -1, + 65, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, 79, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, 91, -1, 93, 94, + 95, -1, -1, 98, 99, -1, -1, 102, -1, -1, + 105, 106, 107, -1, -1, 110, -1, 112, 3, 4, + 5, 6, -1, 8, 9, 10, 11, -1, -1, -1, + 125, -1, -1, -1, 129, -1, -1, -1, 133, -1, + 135, -1, -1, -1, 139, 17, 18, 19, 20, 21, + 22, -1, -1, -1, 50, -1, 52, 53, 54, 31, + -1, 46, -1, -1, -1, 50, -1, 52, 53, 54, + -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, + -1, 77, 78, 79, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, -1, -1, -1, 93, 94, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, 107, -1, 98, -1, -1, 112, 102, 3, 4, + 5, 6, 107, 8, 9, 10, 11, 112, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, -1, 137, 125, 139, -1, 128, 129, 130, 131, + 132, 46, 134, 135, 136, 50, -1, 52, 53, 54, + -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, + -1, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, -1, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, -1, -1, 98, -1, -1, -1, 102, 3, 4, + 5, 6, 107, 8, 9, 10, 11, 112, -1, -1, + -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, -1, -1, -1, 139, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, 50, -1, 52, 53, 54, + -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, + -1, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, -1, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, -1, -1, 98, -1, -1, -1, 102, 3, 4, + 5, 6, 107, 8, 9, 10, 11, 112, -1, -1, + -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, -1, -1, -1, 139, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, 50, -1, 52, 53, 54, + -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, + -1, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, -1, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, -1, -1, 98, -1, -1, -1, 102, 3, 4, + 5, 6, 107, 8, 9, 10, 11, 112, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, -1, 137, -1, 139, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, 50, -1, 52, 53, 54, + -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, + -1, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, -1, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, -1, -1, 98, -1, -1, -1, 102, 3, 4, + 5, 6, 107, 8, 9, 10, 11, 112, -1, -1, + -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, -1, -1, -1, 139, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, 50, -1, 52, 53, 54, + -1, -1, -1, -1, -1, -1, 61, 62, -1, -1, + -1, -1, -1, -1, -1, 70, 71, -1, -1, -1, + -1, -1, 77, 78, -1, -1, -1, -1, -1, 84, + -1, 86, -1, -1, -1, -1, -1, -1, 93, 94, + 95, -1, -1, 98, -1, -1, -1, 102, 3, 4, + 5, 6, 107, 8, 9, 10, 11, 112, -1, 3, + 4, 5, 6, -1, 8, 9, 10, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, -1, + 135, -1, 137, -1, 139, -1, 49, -1, -1, -1, + -1, 46, -1, -1, 57, 50, -1, 52, 53, 54, + -1, -1, 46, 66, 67, 68, 61, 62, -1, -1, + -1, -1, -1, 76, -1, 70, 71, -1, 62, 82, + -1, -1, 77, 78, -1, -1, 70, -1, 91, 84, + -1, 86, -1, 96, -1, -1, -1, -1, 93, 94, + 95, -1, 86, 98, -1, -1, 109, 102, 111, -1, + -1, 95, 107, -1, 98, -1, -1, 112, 102, -1, + -1, -1, -1, 126, -1, -1, -1, -1, -1, -1, + 125, -1, -1, -1, 129, 130, -1, -1, 133, 0, + 135, 125, -1, -1, 139, 129, 130, 6, -1, 133, + -1, 135, -1, -1, -1, 139, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, - -1, -1, 31, 15, 16, 17, 18, 19, 20, 21, - 22, -1, -1, -1, -1, -1, -1, -1, -1, 31, + -1, -1, 31, -1, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, -1, 48, 49, -1, + -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, + -1, 60, -1, 64, -1, 66, 67, 68, 69, -1, + -1, 72, -1, -1, -1, 76, -1, -1, -1, 80, + 81, 82, 83, -1, -1, 84, -1, 88, 89, 90, + 91, -1, -1, -1, -1, 96, 97, -1, -1, 100, + -1, 10, 11, 104, -1, -1, -1, 108, 109, -1, + 111, -1, -1, -1, -1, -1, -1, -1, 119, 118, + -1, -1, 121, -1, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, 135, 136, 47, -1, + 139, 50, -1, 52, 53, 54, 55, 56, -1, 58, + -1, -1, 61, -1, -1, -1, 65, -1, -1, -1, + -1, -1, 71, 11, -1, -1, -1, -1, 77, 78, + 79, -1, 10, 11, -1, -1, -1, -1, 87, -1, + -1, -1, -1, -1, 93, 94, -1, -1, -1, -1, + 99, -1, -1, -1, -1, -1, 105, 106, 107, -1, + -1, 110, 50, 112, 52, 53, 54, -1, 117, 47, + -1, -1, 50, -1, 52, 53, 54, 55, 56, -1, + 58, -1, -1, 61, 133, -1, -1, 65, -1, 77, + 78, 79, -1, 71, -1, -1, 10, 11, -1, 77, + 78, 79, -1, -1, -1, 93, 94, -1, -1, 87, + -1, -1, -1, -1, -1, 93, 94, -1, -1, 107, + -1, 99, -1, -1, 112, -1, -1, 105, 106, 107, + -1, -1, 110, 47, 112, -1, 50, -1, 52, 53, + 54, 55, 56, -1, 58, -1, -1, 61, -1, -1, + -1, 65, -1, -1, -1, 133, -1, 71, -1, -1, + -1, -1, -1, 77, 78, 79, -1, -1, -1, -1, + -1, -1, -1, 87, -1, -1, -1, -1, -1, 93, + 94, -1, -1, -1, -1, 99, -1, -1, -1, -1, + -1, 105, 106, 107, -1, -1, 110, -1, 112, 15, + 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, + -1, -1, -1, -1, -1, 31, -1, -1, -1, 133, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, - -1, -1, -1, -1, -1, -1, 31, 15, 16, 17, + -1, -1, -1, -1, -1, -1, 31, -1, 15, 16, + 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, + -1, -1, -1, -1, 31, -1, 15, 16, 17, 18, + 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, + -1, -1, 31, -1, -1, 15, 16, 17, 18, 19, + 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, + -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, -1, 134, 135, + 136, 137, -1, -1, -1, -1, -1, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, -1, 134, + 135, 136, 137, 120, -1, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, -1, 134, 135, 136, + 119, -1, -1, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, -1, 134, 135, 136, 118, -1, + -1, -1, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, -1, 134, 135, 136, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, 31, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, - 31, -1, 118, -1, -1, -1, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, -1, 134, 135, - 136, 120, -1, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, -1, 134, 135, 136, -1, -1, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, -1, 134, 135, 136, -1, -1, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, -1, 134, - 135, 136, 120, -1, 122, 123, 124, 125, -1, -1, - 128, 129, 130, 131, 132, -1, 134, 135, 136, -1, - -1, 122, 123, 124, 125, -1, -1, 128, 129, 130, - 131, 132, -1, 134, 135, 136, 16, 17, 18, 19, + 31, 15, 16, 17, 18, 19, 20, 21, 22, -1, + -1, -1, -1, -1, -1, -1, -1, 31, 15, 16, + 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, + -1, -1, -1, -1, 31, 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, 31, 16, 17, 18, 19, 20, 21, 22, -1, - -1, -1, -1, -1, -1, -1, -1, 31, 17, 18, - 19, 20, 21, 22, -1, -1, -1, 50, -1, 52, - 53, 54, 31, 17, 18, 19, 20, 21, 22, -1, - -1, -1, -1, -1, -1, -1, -1, 31, 17, 18, - 19, 20, 21, 22, 77, 78, 79, -1, -1, -1, - -1, -1, 31, 17, 18, 19, 20, 21, 22, -1, - 93, 94, -1, -1, -1, -1, -1, 31, 17, 18, - 19, 20, 21, 22, 107, -1, -1, -1, -1, 112, - -1, -1, 31, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, -1, 134, 135, 136, -1, -1, 123, - 124, 125, 135, -1, 128, 129, 130, 131, 132, -1, - 134, 135, 136, -1, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, -1, 134, 135, 136, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, + -1, -1, 120, -1, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, -1, 134, 135, 136, -1, + -1, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, -1, 134, 135, 136, -1, -1, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, - 134, 135, 136, -1, -1, -1, 125, 126, 127, 128, - 129, 130, 131, 132, -1, 134, 135, 136, -1, 123, - 124, 125, -1, -1, 128, 129, 130, 131, 132, -1, - 134, 135, 136, 10, 11, -1, -1, 126, 127, 128, - 129, 130, 131, 132, -1, 134, 135, 136, 17, 18, - 19, 20, 21, 22, -1, -1, -1, -1, -1, -1, - -1, -1, 31, 50, -1, 52, 53, 54, -1, -1, - -1, -1, -1, 50, -1, 52, 53, 54, 55, 56, - -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, - 77, 78, 79, -1, 71, -1, -1, -1, -1, -1, - 77, 78, 79, 10, 11, -1, 93, 94, -1, -1, - -1, -1, -1, -1, -1, -1, 93, 94, -1, -1, - 107, -1, -1, -1, -1, 112, -1, -1, 105, -1, - 107, -1, -1, 110, -1, 112, -1, -1, -1, -1, - -1, -1, -1, 50, -1, 52, 53, 54, 135, -1, - -1, -1, 11, -1, 61, 124, 125, -1, -1, 128, - 129, 130, 131, 132, 71, 134, 135, 136, -1, -1, - 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, - 50, -1, 52, 53, 54, -1, 93, 94, 47, -1, - -1, 50, -1, 52, 53, 54, 55, 56, -1, 58, - 107, 71, 61, 110, -1, 112, 65, 77, 78, 79, - -1, -1, 71, 11, -1, -1, -1, -1, 77, 78, - 79, -1, -1, 93, 94, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 93, 94, -1, 107, -1, -1, - 99, 50, 112, 52, 53, 54, 105, 106, 107, 47, - 11, 110, 50, 112, 52, 53, 54, 55, 56, -1, - 58, -1, -1, 61, -1, -1, -1, 65, 77, 78, - 79, -1, -1, 71, -1, -1, -1, -1, -1, 77, - 78, 79, -1, -1, 93, 94, 47, -1, -1, 50, - -1, 52, 53, 54, 55, 93, 94, 58, 107, -1, - 61, 99, -1, 112, 65, -1, -1, 105, 106, 107, - 71, 11, 110, -1, 112, -1, 77, 78, 79, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 91, -1, 93, 94, -1, -1, -1, -1, 99, -1, - -1, -1, -1, -1, 105, 106, 107, 47, 11, 110, - 50, 112, 52, 53, 54, 55, -1, -1, 58, -1, - -1, 61, -1, -1, -1, 65, -1, -1, -1, -1, + 134, 135, 136, 120, -1, 122, 123, 124, 125, -1, + -1, 128, 129, 130, 131, 132, -1, 134, 135, 136, + -1, -1, 122, 123, 124, 125, -1, -1, 128, 129, + 130, 131, 132, -1, 134, 135, 136, -1, -1, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, + 134, 135, 136, 16, 17, 18, 19, 20, 21, 22, + -1, -1, -1, 50, -1, 52, 53, 54, 31, 17, + 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, + -1, -1, -1, 31, 17, 18, 19, 20, 21, 22, + 77, 78, 79, -1, -1, -1, -1, -1, 31, 17, + 18, 19, 20, 21, 22, -1, 93, 94, -1, -1, + -1, -1, -1, 31, 17, 18, 19, 20, 21, 22, + 107, -1, -1, -1, -1, 112, -1, -1, 31, 17, + 18, 19, 20, 21, 22, -1, -1, -1, -1, -1, + -1, -1, -1, 31, 19, 20, 21, 22, 135, -1, + -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, + 123, 124, 125, -1, -1, 128, 129, 130, 131, 132, + -1, 134, 135, 136, -1, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, -1, 134, 135, 136, -1, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + -1, 134, 135, 136, -1, -1, -1, 125, 126, 127, + 128, 129, 130, 131, 132, 6, 134, 135, 136, -1, + 123, 124, 125, -1, -1, 128, 129, 130, 131, 132, + -1, 134, 135, 136, -1, -1, 124, 125, -1, -1, + 128, 129, 130, 131, 132, -1, 134, 135, 136, -1, + -1, 126, 127, 128, 129, 130, 131, 132, 49, 134, + 135, 136, -1, -1, 10, 11, 57, -1, -1, -1, + -1, -1, -1, -1, -1, 66, 67, 68, -1, -1, + -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, + -1, 82, -1, -1, 50, -1, 52, 53, 54, -1, + 91, 10, 11, -1, 50, 96, 52, 53, 54, 55, + 56, -1, -1, -1, -1, 61, -1, -1, 109, -1, + 111, 77, 78, 79, -1, 71, -1, -1, -1, -1, + -1, 77, 78, 79, -1, -1, -1, 93, 94, -1, + -1, 50, -1, 52, 53, 54, -1, 93, 94, -1, + 11, 107, 61, -1, -1, -1, 112, -1, -1, 105, + -1, 107, 71, -1, 110, -1, 112, -1, 77, 78, + 79, -1, -1, -1, -1, -1, -1, -1, 50, 135, + 52, 53, 54, -1, 93, 94, 47, -1, -1, 50, + -1, 52, 53, 54, 55, 56, -1, 58, 107, 71, + 61, 110, -1, 112, 65, 77, 78, 79, -1, -1, + 71, 11, -1, -1, -1, -1, 77, 78, 79, -1, + -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 93, 94, -1, 107, -1, -1, 99, 50, + 112, 52, 53, 54, 105, 106, 107, 47, 11, 110, + 50, 112, 52, 53, 54, 55, 56, -1, 58, -1, + -1, 61, -1, -1, -1, 65, 77, 78, 79, -1, -1, 71, -1, -1, -1, -1, -1, 77, 78, 79, - -1, -1, -1, -1, -1, -1, -1, 50, -1, 52, - 53, 54, 55, 93, 94, -1, -1, -1, 61, 99, - -1, -1, 65, -1, -1, 105, 106, 107, 71, -1, + -1, -1, 93, 94, 47, -1, -1, 50, -1, 52, + 53, 54, 55, 93, 94, 58, 107, -1, 61, 99, + -1, 112, 65, -1, -1, 105, 106, 107, 71, 11, 110, -1, 112, -1, 77, 78, 79, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 93, 94, 48, 49, -1, -1, 99, -1, -1, -1, - -1, 57, 105, 106, 107, -1, -1, 110, 64, 112, - 66, 67, 68, 69, -1, -1, 72, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 91, -1, + 93, 94, -1, -1, -1, -1, 99, -1, -1, -1, + -1, -1, 105, 106, 107, 47, 11, 110, 50, 112, + 52, 53, 54, 55, -1, -1, 58, -1, -1, 61, + -1, -1, -1, 65, -1, -1, -1, -1, -1, 71, + -1, -1, -1, -1, -1, 77, 78, 79, -1, -1, + -1, -1, -1, -1, -1, 50, -1, 52, 53, 54, + 55, 93, 94, -1, -1, -1, 61, 99, -1, -1, + 65, -1, -1, 105, 106, 107, 71, -1, 110, -1, + 112, -1, 77, 78, 79, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 93, 94, + 48, 49, -1, -1, 99, -1, -1, -1, -1, 57, + 105, 106, 107, -1, -1, 110, 64, 112, 66, 67, + 68, 69, -1, -1, 72, -1, -1, -1, 76, -1, + -1, -1, 80, 81, 82, 83, -1, -1, -1, -1, + 88, 89, 90, 91, -1, -1, 48, 49, 96, 97, + -1, -1, 100, -1, -1, 57, 104, -1, -1, -1, + 108, 109, 64, 111, 66, 67, 68, 69, -1, -1, + 72, 119, -1, -1, 76, -1, -1, -1, 80, 81, + 82, 83, -1, -1, -1, -1, 88, 89, 90, 91, + 138, -1, 48, 49, 96, 97, -1, -1, 100, -1, + -1, 57, 104, -1, -1, -1, 108, 109, 64, 111, + 66, 67, 68, 69, -1, -1, 72, 119, -1, -1, 76, -1, -1, -1, 80, 81, 82, 83, -1, -1, - -1, -1, 88, 89, 90, 91, -1, -1, 48, 49, + -1, -1, 88, 89, 90, 91, 138, -1, 48, 49, 96, 97, -1, -1, 100, -1, -1, 57, 104, -1, -1, -1, 108, 109, 64, 111, 66, 67, 68, 69, -1, -1, 72, 119, -1, -1, 76, -1, -1, -1, @@ -2524,39 +2542,29 @@ static const yytype_int16 yycheck[] = 108, 109, 64, 111, 66, 67, 68, 69, -1, -1, 72, 119, -1, -1, 76, -1, -1, -1, 80, 81, 82, 83, -1, -1, -1, -1, 88, 89, 90, 91, - 138, -1, 48, 49, 96, 97, -1, -1, 100, -1, - -1, 57, 104, -1, -1, -1, 108, 109, 64, 111, - 66, 67, 68, 69, -1, -1, 72, 119, -1, -1, - 76, -1, -1, -1, 80, 81, 82, 83, -1, -1, - -1, -1, 88, 89, 90, 91, 138, -1, 48, 49, - 96, 97, -1, -1, 100, -1, -1, 57, 104, -1, - -1, -1, 108, 109, 64, 111, 66, 67, 68, 69, - -1, -1, 72, 119, -1, -1, 76, -1, -1, -1, + 138, -1, -1, -1, 96, 97, -1, 50, 100, 52, + 53, 54, 104, -1, -1, -1, 108, 109, 61, 111, + -1, -1, -1, -1, -1, -1, -1, 119, 71, -1, + -1, -1, -1, -1, 77, 78, 79, -1, 48, 49, + -1, -1, -1, -1, -1, -1, 138, 57, -1, -1, + 93, 94, -1, -1, 64, -1, 66, 67, 68, 69, + -1, -1, 72, -1, 107, -1, 76, -1, -1, 112, 80, 81, 82, 83, -1, -1, -1, -1, 88, 89, - 90, 91, 138, -1, -1, -1, 96, 97, -1, 50, - 100, 52, 53, 54, 104, -1, 49, -1, 108, 109, - 61, 111, -1, -1, 57, -1, -1, -1, -1, 119, - 71, -1, -1, 66, 67, 68, 77, 78, 79, -1, - -1, -1, -1, 76, -1, -1, -1, -1, 138, 82, - -1, -1, 93, 94, -1, -1, -1, -1, 91, -1, - -1, -1, -1, 96, 48, 49, 107, -1, -1, -1, - -1, 112, -1, 57, -1, -1, 109, -1, 111, -1, - 64, -1, 66, 67, 68, 69, -1, -1, 72, -1, - -1, -1, 76, 126, 135, -1, 80, 81, 82, 83, - -1, -1, -1, -1, 88, 89, 90, 91, -1, -1, - -1, -1, 96, 97, -1, 50, 100, 52, 53, 54, - 104, 49, -1, -1, 108, 109, 61, 111, -1, 57, - -1, -1, -1, 49, -1, -1, 71, -1, 66, 67, - 68, 57, 77, 78, 79, -1, -1, -1, 76, -1, - 66, 67, 68, -1, 82, 83, -1, -1, 93, 94, - 76, -1, -1, 91, -1, -1, 82, -1, 96, -1, - 49, -1, 107, -1, -1, 91, -1, 112, 57, -1, - 96, 109, -1, 111, 100, -1, -1, 66, 67, 68, - -1, -1, -1, 109, -1, 111, -1, 76, -1, -1, - -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, - -1, -1, 91, -1, -1, -1, -1, 96, -1, -1, + 90, 91, -1, -1, -1, -1, 96, 97, -1, -1, + 100, -1, 135, 50, 104, 52, 53, 54, 108, 109, + 49, 111, -1, -1, 61, -1, -1, -1, 57, -1, + -1, -1, -1, -1, 71, -1, -1, 66, 67, 68, + 77, 78, 79, -1, -1, -1, -1, 76, -1, -1, + -1, -1, -1, 82, 83, -1, 93, 94, -1, -1, + 49, -1, 91, -1, -1, -1, -1, 96, 57, -1, + 107, -1, -1, -1, -1, 112, -1, 66, 67, 68, + 109, 49, 111, -1, -1, -1, -1, 76, -1, 57, + -1, -1, -1, 82, -1, -1, -1, -1, 66, 67, + 68, -1, 91, -1, -1, -1, -1, 96, 76, -1, + -1, 100, -1, -1, 82, -1, -1, -1, -1, -1, + 109, -1, 111, 91, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 109, -1, 111 + -1, 109, -1, 111 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -2596,7 +2604,7 @@ static const yytype_uint8 yystos[] = 227, 227, 227, 227, 227, 227, 227, 137, 225, 227, 192, 227, 71, 130, 192, 192, 192, 192, 192, 192, 136, 207, 208, 234, 11, 206, 216, 120, 198, 200, - 151, 148, 117, 232, 10, 232, 143, 117, 227, 126, + 151, 148, 117, 232, 10, 10, 143, 117, 227, 126, 56, 163, 194, 232, 135, 135, 193, 135, 56, 193, 232, 147, 232, 117, 119, 120, 121, 186, 119, 154, 232, 232, 137, 137, 137, 137, 137, 137, 137, 127, @@ -2610,7 +2618,7 @@ static const yytype_uint8 yystos[] = 219, 220, 144, 145, 232, 117, 227, 12, 16, 56, 87, 111, 125, 130, 135, 156, 180, 232, 120, 135, 137, 135, 227, 135, 140, 118, 121, 138, 88, 89, - 90, 109, 203, 117, 118, 138, 213, 10, 232, 143, + 90, 109, 203, 117, 118, 138, 213, 10, 10, 143, 233, 232, 179, 232, 127, 118, 10, 11, 12, 16, 56, 111, 125, 130, 135, 191, 234, 160, 161, 180, 3, 4, 5, 9, 10, 14, 46, 56, 62, 70, @@ -2649,7 +2657,7 @@ static const yytype_uint8 yystos[] = 145, 224, 187, 138, 118, 180, 10, 137, 140, 137, 4, 227, 181, 223, 118, 137, 137, 137, 118, 232, 231, 232, 231, 231, 231, 231, 231, 138, 138, 10, - 119, 232, 196, 184, 196, 191, 137, 46, 62, 95, + 119, 10, 196, 184, 196, 191, 137, 46, 62, 95, 98, 125, 129, 130, 133, 135, 139, 226, 228, 223, 185, 186, 118, 196, 193, 191, 196, 135, 196, 196, 137, 137, 56, 171, 234, 14, 189, 121, 185, 227, @@ -3705,7 +3713,7 @@ yyreduce: CPPDeclaration *getter = (yyvsp[(5) - (7)].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid getter: " + (yyvsp[(5) - (7)].u.identifier)->get_fully_scoped_name(), (yylsp[(1) - (7)])); + yyerror("Reference to non-existent or invalid getter: " + (yyvsp[(5) - (7)].u.identifier)->get_fully_scoped_name(), (yylsp[(5) - (7)])); } CPPMakeProperty *make_property = new CPPMakeProperty((yyvsp[(3) - (7)].u.identifier), getter->as_function_group(), NULL, current_scope, (yylsp[(1) - (7)]).file); @@ -3719,14 +3727,14 @@ yyreduce: { CPPDeclaration *getter = (yyvsp[(5) - (9)].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid getter: " + (yyvsp[(5) - (9)].u.identifier)->get_fully_scoped_name(), (yylsp[(1) - (9)])); + yyerror("Reference to non-existent or invalid getter: " + (yyvsp[(5) - (9)].u.identifier)->get_fully_scoped_name(), (yylsp[(5) - (9)])); } else { CPPDeclaration *setter = (yyvsp[(7) - (9)].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); CPPFunctionGroup *setter_func = NULL; if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid setter: " + (yyvsp[(7) - (9)].u.identifier)->get_fully_scoped_name(), (yylsp[(1) - (9)])); + yyerror("Reference to non-existent or invalid setter: " + (yyvsp[(7) - (9)].u.identifier)->get_fully_scoped_name(), (yylsp[(7) - (9)])); } else { setter_func = setter->as_function_group(); } @@ -3742,14 +3750,31 @@ yyreduce: /* Line 1792 of yacc.c */ #line 533 "dtool/src/cppparser/cppBison.yxx" { - CPPMakeSeq *make_seq = new CPPMakeSeq((yyvsp[(3) - (9)].u.identifier)->get_simple_name(), (yyvsp[(5) - (9)].u.identifier)->get_simple_name(), (yyvsp[(7) - (9)].u.identifier)->get_simple_name(), (yylsp[(1) - (9)]).file); - current_scope->add_declaration(make_seq, global_scope, current_lexer, (yylsp[(1) - (9)])); + CPPDeclaration *length_getter = (yyvsp[(5) - (9)].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); + if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) { + yyerror("reference to non-existent or invalid length method: " + (yyvsp[(5) - (9)].u.identifier)->get_fully_scoped_name(), (yylsp[(5) - (9)])); + length_getter = NULL; + } + + CPPDeclaration *element_getter = (yyvsp[(7) - (9)].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); + if (element_getter == (CPPDeclaration *)NULL || element_getter->get_subtype() != CPPDeclaration::ST_function_group) { + yyerror("reference to non-existent or invalid element method: " + (yyvsp[(7) - (9)].u.identifier)->get_fully_scoped_name(), (yylsp[(5) - (9)])); + element_getter = NULL; + } + + if (length_getter != (CPPDeclaration *)NULL && element_getter != (CPPDeclaration *)NULL) { + CPPMakeSeq *make_seq = new CPPMakeSeq((yyvsp[(3) - (9)].u.identifier), + length_getter->as_function_group(), + element_getter->as_function_group(), + current_scope, (yylsp[(1) - (9)]).file); + current_scope->add_declaration(make_seq, global_scope, current_lexer, (yylsp[(1) - (9)])); + } } break; case 29: /* Line 1792 of yacc.c */ -#line 538 "dtool/src/cppparser/cppBison.yxx" +#line 555 "dtool/src/cppparser/cppBison.yxx" { CPPExpression::Result result = (yyvsp[(3) - (6)].u.expr)->evaluate(); if (result._type == CPPExpression::RT_error) { @@ -3764,7 +3789,7 @@ yyreduce: case 30: /* Line 1792 of yacc.c */ -#line 549 "dtool/src/cppparser/cppBison.yxx" +#line 566 "dtool/src/cppparser/cppBison.yxx" { // This alternative version of static_assert was introduced in C++17. CPPExpression::Result result = (yyvsp[(3) - (4)].u.expr)->evaluate(); @@ -3778,7 +3803,7 @@ yyreduce: case 31: /* Line 1792 of yacc.c */ -#line 562 "dtool/src/cppparser/cppBison.yxx" +#line 579 "dtool/src/cppparser/cppBison.yxx" { CPPScope *new_scope = new CPPScope(current_scope, CPPNameComponent("temp"), V_public); @@ -3788,7 +3813,7 @@ yyreduce: case 32: /* Line 1792 of yacc.c */ -#line 568 "dtool/src/cppparser/cppBison.yxx" +#line 585 "dtool/src/cppparser/cppBison.yxx" { delete current_scope; pop_scope(); @@ -3797,7 +3822,7 @@ yyreduce: case 33: /* Line 1792 of yacc.c */ -#line 577 "dtool/src/cppparser/cppBison.yxx" +#line 594 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = 0; } @@ -3805,7 +3830,7 @@ yyreduce: case 34: /* Line 1792 of yacc.c */ -#line 581 "dtool/src/cppparser/cppBison.yxx" +#line 598 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_extern; } @@ -3813,7 +3838,7 @@ yyreduce: case 35: /* Line 1792 of yacc.c */ -#line 585 "dtool/src/cppparser/cppBison.yxx" +#line 602 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(3) - (3)].u.integer) | (int)CPPInstance::SC_extern; if ((yyvsp[(2) - (3)].str) == "C") { @@ -3828,7 +3853,7 @@ yyreduce: case 36: /* Line 1792 of yacc.c */ -#line 596 "dtool/src/cppparser/cppBison.yxx" +#line 613 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_static; } @@ -3836,7 +3861,7 @@ yyreduce: case 37: /* Line 1792 of yacc.c */ -#line 600 "dtool/src/cppparser/cppBison.yxx" +#line 617 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_inline; } @@ -3844,7 +3869,7 @@ yyreduce: case 38: /* Line 1792 of yacc.c */ -#line 604 "dtool/src/cppparser/cppBison.yxx" +#line 621 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_virtual; } @@ -3852,7 +3877,7 @@ yyreduce: case 39: /* Line 1792 of yacc.c */ -#line 608 "dtool/src/cppparser/cppBison.yxx" +#line 625 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_explicit; } @@ -3860,7 +3885,7 @@ yyreduce: case 40: /* Line 1792 of yacc.c */ -#line 612 "dtool/src/cppparser/cppBison.yxx" +#line 629 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_register; } @@ -3868,7 +3893,7 @@ yyreduce: case 41: /* Line 1792 of yacc.c */ -#line 616 "dtool/src/cppparser/cppBison.yxx" +#line 633 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_volatile; } @@ -3876,7 +3901,7 @@ yyreduce: case 42: /* Line 1792 of yacc.c */ -#line 620 "dtool/src/cppparser/cppBison.yxx" +#line 637 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_mutable; } @@ -3884,7 +3909,7 @@ yyreduce: case 43: /* Line 1792 of yacc.c */ -#line 624 "dtool/src/cppparser/cppBison.yxx" +#line 641 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_constexpr; } @@ -3892,7 +3917,7 @@ yyreduce: case 44: /* Line 1792 of yacc.c */ -#line 628 "dtool/src/cppparser/cppBison.yxx" +#line 645 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_blocking; } @@ -3900,7 +3925,7 @@ yyreduce: case 45: /* Line 1792 of yacc.c */ -#line 632 "dtool/src/cppparser/cppBison.yxx" +#line 649 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(2) - (2)].u.integer) | (int)CPPInstance::SC_extension; } @@ -3908,7 +3933,7 @@ yyreduce: case 46: /* Line 1792 of yacc.c */ -#line 639 "dtool/src/cppparser/cppBison.yxx" +#line 656 "dtool/src/cppparser/cppBison.yxx" { /* multiple_var_declaration adds itself to the scope. */ } @@ -3916,7 +3941,7 @@ yyreduce: case 47: /* Line 1792 of yacc.c */ -#line 643 "dtool/src/cppparser/cppBison.yxx" +#line 660 "dtool/src/cppparser/cppBison.yxx" { // 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 @@ -3929,7 +3954,7 @@ yyreduce: case 48: /* Line 1792 of yacc.c */ -#line 652 "dtool/src/cppparser/cppBison.yxx" +#line 669 "dtool/src/cppparser/cppBison.yxx" { if ((yyvsp[(2) - (3)].u.instance) != (CPPInstance *)NULL) { (yyvsp[(2) - (3)].u.instance)->_storage_class |= (current_storage_class | (yyvsp[(1) - (3)].u.integer)); @@ -3941,7 +3966,7 @@ yyreduce: case 49: /* Line 1792 of yacc.c */ -#line 663 "dtool/src/cppparser/cppBison.yxx" +#line 680 "dtool/src/cppparser/cppBison.yxx" { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -3956,7 +3981,7 @@ yyreduce: case 50: /* Line 1792 of yacc.c */ -#line 674 "dtool/src/cppparser/cppBison.yxx" +#line 691 "dtool/src/cppparser/cppBison.yxx" { pop_storage_class(); } @@ -3964,7 +3989,7 @@ yyreduce: case 51: /* Line 1792 of yacc.c */ -#line 678 "dtool/src/cppparser/cppBison.yxx" +#line 695 "dtool/src/cppparser/cppBison.yxx" { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -3975,7 +4000,7 @@ yyreduce: case 52: /* Line 1792 of yacc.c */ -#line 685 "dtool/src/cppparser/cppBison.yxx" +#line 702 "dtool/src/cppparser/cppBison.yxx" { pop_storage_class(); } @@ -3983,7 +4008,7 @@ yyreduce: case 53: /* Line 1792 of yacc.c */ -#line 696 "dtool/src/cppparser/cppBison.yxx" +#line 713 "dtool/src/cppparser/cppBison.yxx" { CPPInstance *inst = new CPPInstance(current_type, (yyvsp[(1) - (2)].u.inst_ident), current_storage_class, @@ -3995,7 +4020,7 @@ yyreduce: case 54: /* Line 1792 of yacc.c */ -#line 704 "dtool/src/cppparser/cppBison.yxx" +#line 721 "dtool/src/cppparser/cppBison.yxx" { CPPInstance *inst = new CPPInstance(current_type, (yyvsp[(1) - (4)].u.inst_ident), current_storage_class, @@ -4007,7 +4032,7 @@ yyreduce: case 55: /* Line 1792 of yacc.c */ -#line 715 "dtool/src/cppparser/cppBison.yxx" +#line 732 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(1) - (2)].u.inst_ident)->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance(current_type, (yyvsp[(1) - (2)].u.inst_ident), @@ -4020,7 +4045,7 @@ yyreduce: case 56: /* Line 1792 of yacc.c */ -#line 724 "dtool/src/cppparser/cppBison.yxx" +#line 741 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(1) - (4)].u.inst_ident)->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance(current_type, (yyvsp[(1) - (4)].u.inst_ident), @@ -4033,7 +4058,7 @@ yyreduce: case 57: /* Line 1792 of yacc.c */ -#line 737 "dtool/src/cppparser/cppBison.yxx" +#line 754 "dtool/src/cppparser/cppBison.yxx" { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -4048,7 +4073,7 @@ yyreduce: case 58: /* Line 1792 of yacc.c */ -#line 748 "dtool/src/cppparser/cppBison.yxx" +#line 765 "dtool/src/cppparser/cppBison.yxx" { pop_storage_class(); } @@ -4056,7 +4081,7 @@ yyreduce: case 59: /* Line 1792 of yacc.c */ -#line 752 "dtool/src/cppparser/cppBison.yxx" +#line 769 "dtool/src/cppparser/cppBison.yxx" { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -4067,7 +4092,7 @@ yyreduce: case 60: /* Line 1792 of yacc.c */ -#line 759 "dtool/src/cppparser/cppBison.yxx" +#line 776 "dtool/src/cppparser/cppBison.yxx" { pop_storage_class(); } @@ -4075,7 +4100,7 @@ yyreduce: case 61: /* Line 1792 of yacc.c */ -#line 763 "dtool/src/cppparser/cppBison.yxx" +#line 780 "dtool/src/cppparser/cppBison.yxx" { if ((yyvsp[(2) - (3)].u.instance) != (CPPDeclaration *)NULL) { CPPInstance *inst = (yyvsp[(2) - (3)].u.instance)->as_instance(); @@ -4091,7 +4116,7 @@ yyreduce: case 62: /* Line 1792 of yacc.c */ -#line 778 "dtool/src/cppparser/cppBison.yxx" +#line 795 "dtool/src/cppparser/cppBison.yxx" { CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, (yyvsp[(1) - (2)].u.inst_ident), current_scope, (yylsp[(1) - (2)]).file); @@ -4101,7 +4126,7 @@ yyreduce: case 63: /* Line 1792 of yacc.c */ -#line 784 "dtool/src/cppparser/cppBison.yxx" +#line 801 "dtool/src/cppparser/cppBison.yxx" { CPPType *target_type = current_type; CPPTypedefType *typedef_type = new CPPTypedefType(target_type, (yyvsp[(1) - (4)].u.inst_ident), current_scope, (yylsp[(1) - (4)]).file); @@ -4111,7 +4136,7 @@ yyreduce: case 64: /* Line 1792 of yacc.c */ -#line 793 "dtool/src/cppparser/cppBison.yxx" +#line 810 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(1) - (2)].u.inst_ident)->add_modifier(IIT_const); CPPType *target_type = current_type; @@ -4122,7 +4147,7 @@ yyreduce: case 65: /* Line 1792 of yacc.c */ -#line 800 "dtool/src/cppparser/cppBison.yxx" +#line 817 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(1) - (4)].u.inst_ident)->add_modifier(IIT_const); CPPType *target_type = current_type; @@ -4133,7 +4158,7 @@ yyreduce: case 66: /* Line 1792 of yacc.c */ -#line 812 "dtool/src/cppparser/cppBison.yxx" +#line 829 "dtool/src/cppparser/cppBison.yxx" { push_scope((yyvsp[(1) - (2)].u.identifier)->get_scope(current_scope, global_scope)); } @@ -4141,7 +4166,7 @@ yyreduce: case 67: /* Line 1792 of yacc.c */ -#line 816 "dtool/src/cppparser/cppBison.yxx" +#line 833 "dtool/src/cppparser/cppBison.yxx" { CPPType *type; if ((yyvsp[(1) - (6)].u.identifier)->get_simple_name() == current_scope->get_simple_name() || @@ -4165,7 +4190,7 @@ yyreduce: case 68: /* Line 1792 of yacc.c */ -#line 836 "dtool/src/cppparser/cppBison.yxx" +#line 853 "dtool/src/cppparser/cppBison.yxx" { push_scope((yyvsp[(1) - (2)].u.identifier)->get_scope(current_scope, global_scope)); } @@ -4173,7 +4198,7 @@ yyreduce: case 69: /* Line 1792 of yacc.c */ -#line 840 "dtool/src/cppparser/cppBison.yxx" +#line 857 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); CPPType *type; @@ -4195,7 +4220,7 @@ yyreduce: case 70: /* Line 1792 of yacc.c */ -#line 860 "dtool/src/cppparser/cppBison.yxx" +#line 877 "dtool/src/cppparser/cppBison.yxx" { push_scope((yyvsp[(2) - (3)].u.identifier)->get_scope(current_scope, global_scope)); } @@ -4203,7 +4228,7 @@ yyreduce: case 71: /* Line 1792 of yacc.c */ -#line 864 "dtool/src/cppparser/cppBison.yxx" +#line 881 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); if ((yyvsp[(2) - (7)].u.identifier)->is_scoped()) { @@ -4226,7 +4251,7 @@ yyreduce: case 72: /* Line 1792 of yacc.c */ -#line 890 "dtool/src/cppparser/cppBison.yxx" +#line 907 "dtool/src/cppparser/cppBison.yxx" { push_scope((yyvsp[(4) - (6)].u.inst_ident)->get_scope(current_scope, global_scope)); } @@ -4234,7 +4259,7 @@ yyreduce: case 73: /* Line 1792 of yacc.c */ -#line 894 "dtool/src/cppparser/cppBison.yxx" +#line 911 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); CPPType *type = (yyvsp[(1) - (10)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); @@ -4252,7 +4277,7 @@ yyreduce: case 74: /* Line 1792 of yacc.c */ -#line 908 "dtool/src/cppparser/cppBison.yxx" +#line 925 "dtool/src/cppparser/cppBison.yxx" { push_scope((yyvsp[(5) - (7)].u.inst_ident)->get_scope(current_scope, global_scope)); } @@ -4260,7 +4285,7 @@ yyreduce: case 75: /* Line 1792 of yacc.c */ -#line 912 "dtool/src/cppparser/cppBison.yxx" +#line 929 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); CPPType *type = (yyvsp[(1) - (11)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); @@ -4278,7 +4303,7 @@ yyreduce: case 76: /* Line 1792 of yacc.c */ -#line 928 "dtool/src/cppparser/cppBison.yxx" +#line 945 "dtool/src/cppparser/cppBison.yxx" { if ((yyvsp[(1) - (4)].u.identifier) != NULL) { push_scope((yyvsp[(1) - (4)].u.identifier)->get_scope(current_scope, global_scope)); @@ -4288,7 +4313,7 @@ yyreduce: case 77: /* Line 1792 of yacc.c */ -#line 934 "dtool/src/cppparser/cppBison.yxx" +#line 951 "dtool/src/cppparser/cppBison.yxx" { if ((yyvsp[(1) - (8)].u.identifier) != NULL) { pop_scope(); @@ -4317,7 +4342,7 @@ yyreduce: case 78: /* Line 1792 of yacc.c */ -#line 959 "dtool/src/cppparser/cppBison.yxx" +#line 976 "dtool/src/cppparser/cppBison.yxx" { if ((yyvsp[(1) - (5)].u.identifier) != NULL) { push_scope((yyvsp[(1) - (5)].u.identifier)->get_scope(current_scope, global_scope)); @@ -4327,7 +4352,7 @@ yyreduce: case 79: /* Line 1792 of yacc.c */ -#line 965 "dtool/src/cppparser/cppBison.yxx" +#line 982 "dtool/src/cppparser/cppBison.yxx" { if ((yyvsp[(1) - (9)].u.identifier) != NULL) { pop_scope(); @@ -4347,7 +4372,7 @@ yyreduce: case 80: /* Line 1792 of yacc.c */ -#line 985 "dtool/src/cppparser/cppBison.yxx" +#line 1002 "dtool/src/cppparser/cppBison.yxx" { CPPDeclaration *decl = (yyvsp[(1) - (1)].u.identifier)->find_symbol(current_scope, global_scope, current_lexer); @@ -4361,7 +4386,7 @@ yyreduce: case 81: /* Line 1792 of yacc.c */ -#line 998 "dtool/src/cppparser/cppBison.yxx" +#line 1015 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = 0; } @@ -4369,7 +4394,7 @@ yyreduce: case 82: /* Line 1792 of yacc.c */ -#line 1002 "dtool/src/cppparser/cppBison.yxx" +#line 1019 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (int)CPPFunctionType::F_const_method; } @@ -4377,7 +4402,7 @@ yyreduce: case 83: /* Line 1792 of yacc.c */ -#line 1006 "dtool/src/cppparser/cppBison.yxx" +#line 1023 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (int)CPPFunctionType::F_noexcept; } @@ -4385,7 +4410,7 @@ yyreduce: case 84: /* Line 1792 of yacc.c */ -#line 1010 "dtool/src/cppparser/cppBison.yxx" +#line 1027 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(1) - (4)].u.integer); } @@ -4393,7 +4418,7 @@ yyreduce: case 85: /* Line 1792 of yacc.c */ -#line 1014 "dtool/src/cppparser/cppBison.yxx" +#line 1031 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.integer) = (yyvsp[(1) - (5)].u.integer); } @@ -4401,7 +4426,7 @@ yyreduce: case 86: /* Line 1792 of yacc.c */ -#line 1021 "dtool/src/cppparser/cppBison.yxx" +#line 1038 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "!"; } @@ -4409,7 +4434,7 @@ yyreduce: case 87: /* Line 1792 of yacc.c */ -#line 1025 "dtool/src/cppparser/cppBison.yxx" +#line 1042 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "~"; } @@ -4417,7 +4442,7 @@ yyreduce: case 88: /* Line 1792 of yacc.c */ -#line 1029 "dtool/src/cppparser/cppBison.yxx" +#line 1046 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "*"; } @@ -4425,7 +4450,7 @@ yyreduce: case 89: /* Line 1792 of yacc.c */ -#line 1033 "dtool/src/cppparser/cppBison.yxx" +#line 1050 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "/"; } @@ -4433,7 +4458,7 @@ yyreduce: case 90: /* Line 1792 of yacc.c */ -#line 1037 "dtool/src/cppparser/cppBison.yxx" +#line 1054 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "%"; } @@ -4441,7 +4466,7 @@ yyreduce: case 91: /* Line 1792 of yacc.c */ -#line 1041 "dtool/src/cppparser/cppBison.yxx" +#line 1058 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "+"; } @@ -4449,7 +4474,7 @@ yyreduce: case 92: /* Line 1792 of yacc.c */ -#line 1045 "dtool/src/cppparser/cppBison.yxx" +#line 1062 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "-"; } @@ -4457,7 +4482,7 @@ yyreduce: case 93: /* Line 1792 of yacc.c */ -#line 1049 "dtool/src/cppparser/cppBison.yxx" +#line 1066 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "|"; } @@ -4465,7 +4490,7 @@ yyreduce: case 94: /* Line 1792 of yacc.c */ -#line 1053 "dtool/src/cppparser/cppBison.yxx" +#line 1070 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "&"; } @@ -4473,7 +4498,7 @@ yyreduce: case 95: /* Line 1792 of yacc.c */ -#line 1057 "dtool/src/cppparser/cppBison.yxx" +#line 1074 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "^"; } @@ -4481,7 +4506,7 @@ yyreduce: case 96: /* Line 1792 of yacc.c */ -#line 1061 "dtool/src/cppparser/cppBison.yxx" +#line 1078 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "||"; } @@ -4489,7 +4514,7 @@ yyreduce: case 97: /* Line 1792 of yacc.c */ -#line 1065 "dtool/src/cppparser/cppBison.yxx" +#line 1082 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "&&"; } @@ -4497,7 +4522,7 @@ yyreduce: case 98: /* Line 1792 of yacc.c */ -#line 1069 "dtool/src/cppparser/cppBison.yxx" +#line 1086 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "=="; } @@ -4505,7 +4530,7 @@ yyreduce: case 99: /* Line 1792 of yacc.c */ -#line 1073 "dtool/src/cppparser/cppBison.yxx" +#line 1090 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "!="; } @@ -4513,7 +4538,7 @@ yyreduce: case 100: /* Line 1792 of yacc.c */ -#line 1077 "dtool/src/cppparser/cppBison.yxx" +#line 1094 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "<="; } @@ -4521,7 +4546,7 @@ yyreduce: case 101: /* Line 1792 of yacc.c */ -#line 1081 "dtool/src/cppparser/cppBison.yxx" +#line 1098 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = ">="; } @@ -4529,7 +4554,7 @@ yyreduce: case 102: /* Line 1792 of yacc.c */ -#line 1085 "dtool/src/cppparser/cppBison.yxx" +#line 1102 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "<"; } @@ -4537,7 +4562,7 @@ yyreduce: case 103: /* Line 1792 of yacc.c */ -#line 1089 "dtool/src/cppparser/cppBison.yxx" +#line 1106 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = ">"; } @@ -4545,7 +4570,7 @@ yyreduce: case 104: /* Line 1792 of yacc.c */ -#line 1093 "dtool/src/cppparser/cppBison.yxx" +#line 1110 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "<<"; } @@ -4553,7 +4578,7 @@ yyreduce: case 105: /* Line 1792 of yacc.c */ -#line 1097 "dtool/src/cppparser/cppBison.yxx" +#line 1114 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = ">>"; } @@ -4561,7 +4586,7 @@ yyreduce: case 106: /* Line 1792 of yacc.c */ -#line 1101 "dtool/src/cppparser/cppBison.yxx" +#line 1118 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "="; } @@ -4569,7 +4594,7 @@ yyreduce: case 107: /* Line 1792 of yacc.c */ -#line 1105 "dtool/src/cppparser/cppBison.yxx" +#line 1122 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = ","; } @@ -4577,7 +4602,7 @@ yyreduce: case 108: /* Line 1792 of yacc.c */ -#line 1109 "dtool/src/cppparser/cppBison.yxx" +#line 1126 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "++"; } @@ -4585,7 +4610,7 @@ yyreduce: case 109: /* Line 1792 of yacc.c */ -#line 1113 "dtool/src/cppparser/cppBison.yxx" +#line 1130 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "--"; } @@ -4593,7 +4618,7 @@ yyreduce: case 110: /* Line 1792 of yacc.c */ -#line 1117 "dtool/src/cppparser/cppBison.yxx" +#line 1134 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "*="; } @@ -4601,7 +4626,7 @@ yyreduce: case 111: /* Line 1792 of yacc.c */ -#line 1121 "dtool/src/cppparser/cppBison.yxx" +#line 1138 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "/="; } @@ -4609,7 +4634,7 @@ yyreduce: case 112: /* Line 1792 of yacc.c */ -#line 1125 "dtool/src/cppparser/cppBison.yxx" +#line 1142 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "%="; } @@ -4617,7 +4642,7 @@ yyreduce: case 113: /* Line 1792 of yacc.c */ -#line 1129 "dtool/src/cppparser/cppBison.yxx" +#line 1146 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "+="; } @@ -4625,7 +4650,7 @@ yyreduce: case 114: /* Line 1792 of yacc.c */ -#line 1133 "dtool/src/cppparser/cppBison.yxx" +#line 1150 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "-="; } @@ -4633,7 +4658,7 @@ yyreduce: case 115: /* Line 1792 of yacc.c */ -#line 1137 "dtool/src/cppparser/cppBison.yxx" +#line 1154 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "|="; } @@ -4641,7 +4666,7 @@ yyreduce: case 116: /* Line 1792 of yacc.c */ -#line 1141 "dtool/src/cppparser/cppBison.yxx" +#line 1158 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "&="; } @@ -4649,7 +4674,7 @@ yyreduce: case 117: /* Line 1792 of yacc.c */ -#line 1145 "dtool/src/cppparser/cppBison.yxx" +#line 1162 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "^="; } @@ -4657,7 +4682,7 @@ yyreduce: case 118: /* Line 1792 of yacc.c */ -#line 1149 "dtool/src/cppparser/cppBison.yxx" +#line 1166 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "<<="; } @@ -4665,7 +4690,7 @@ yyreduce: case 119: /* Line 1792 of yacc.c */ -#line 1153 "dtool/src/cppparser/cppBison.yxx" +#line 1170 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = ">>="; } @@ -4673,7 +4698,7 @@ yyreduce: case 120: /* Line 1792 of yacc.c */ -#line 1157 "dtool/src/cppparser/cppBison.yxx" +#line 1174 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "->"; } @@ -4681,7 +4706,7 @@ yyreduce: case 121: /* Line 1792 of yacc.c */ -#line 1161 "dtool/src/cppparser/cppBison.yxx" +#line 1178 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "[]"; } @@ -4689,7 +4714,7 @@ yyreduce: case 122: /* Line 1792 of yacc.c */ -#line 1165 "dtool/src/cppparser/cppBison.yxx" +#line 1182 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "()"; } @@ -4697,7 +4722,7 @@ yyreduce: case 123: /* Line 1792 of yacc.c */ -#line 1169 "dtool/src/cppparser/cppBison.yxx" +#line 1186 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "new"; } @@ -4705,7 +4730,7 @@ yyreduce: case 124: /* Line 1792 of yacc.c */ -#line 1173 "dtool/src/cppparser/cppBison.yxx" +#line 1190 "dtool/src/cppparser/cppBison.yxx" { (yyval.str) = "delete"; } @@ -4713,7 +4738,7 @@ yyreduce: case 127: /* Line 1792 of yacc.c */ -#line 1185 "dtool/src/cppparser/cppBison.yxx" +#line 1202 "dtool/src/cppparser/cppBison.yxx" { push_scope(new CPPTemplateScope(current_scope)); } @@ -4721,7 +4746,7 @@ yyreduce: case 128: /* Line 1792 of yacc.c */ -#line 1189 "dtool/src/cppparser/cppBison.yxx" +#line 1206 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); } @@ -4729,7 +4754,7 @@ yyreduce: case 132: /* Line 1792 of yacc.c */ -#line 1202 "dtool/src/cppparser/cppBison.yxx" +#line 1219 "dtool/src/cppparser/cppBison.yxx" { CPPTemplateScope *ts = current_scope->as_template_scope(); assert(ts != NULL); @@ -4739,7 +4764,7 @@ yyreduce: case 133: /* Line 1792 of yacc.c */ -#line 1208 "dtool/src/cppparser/cppBison.yxx" +#line 1225 "dtool/src/cppparser/cppBison.yxx" { CPPTemplateScope *ts = current_scope->as_template_scope(); assert(ts != NULL); @@ -4749,7 +4774,7 @@ yyreduce: case 134: /* Line 1792 of yacc.c */ -#line 1217 "dtool/src/cppparser/cppBison.yxx" +#line 1234 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[(2) - (2)].u.identifier))); } @@ -4757,7 +4782,7 @@ yyreduce: case 135: /* Line 1792 of yacc.c */ -#line 1221 "dtool/src/cppparser/cppBison.yxx" +#line 1238 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[(2) - (4)].u.identifier), (yyvsp[(4) - (4)].u.type))); } @@ -4765,7 +4790,7 @@ yyreduce: case 136: /* Line 1792 of yacc.c */ -#line 1225 "dtool/src/cppparser/cppBison.yxx" +#line 1242 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[(2) - (2)].u.identifier))); } @@ -4773,7 +4798,7 @@ yyreduce: case 137: /* Line 1792 of yacc.c */ -#line 1229 "dtool/src/cppparser/cppBison.yxx" +#line 1246 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type(new CPPClassTemplateParameter((yyvsp[(2) - (4)].u.identifier), (yyvsp[(4) - (4)].u.type))); } @@ -4781,7 +4806,7 @@ yyreduce: case 138: /* Line 1792 of yacc.c */ -#line 1233 "dtool/src/cppparser/cppBison.yxx" +#line 1250 "dtool/src/cppparser/cppBison.yxx" { CPPInstance *inst = new CPPInstance((yyvsp[(1) - (3)].u.type), (yyvsp[(2) - (3)].u.inst_ident), 0, (yylsp[(2) - (3)]).file); inst->set_initializer((yyvsp[(3) - (3)].u.expr)); @@ -4791,7 +4816,7 @@ yyreduce: case 139: /* Line 1792 of yacc.c */ -#line 1239 "dtool/src/cppparser/cppBison.yxx" +#line 1256 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(3) - (4)].u.inst_ident)->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance((yyvsp[(2) - (4)].u.type), (yyvsp[(3) - (4)].u.inst_ident), 0, (yylsp[(3) - (4)]).file); @@ -4802,7 +4827,7 @@ yyreduce: case 140: /* Line 1792 of yacc.c */ -#line 1249 "dtool/src/cppparser/cppBison.yxx" +#line 1266 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.simple_type)); } @@ -4810,7 +4835,7 @@ yyreduce: case 141: /* Line 1792 of yacc.c */ -#line 1253 "dtool/src/cppparser/cppBison.yxx" +#line 1270 "dtool/src/cppparser/cppBison.yxx" { yywarning("Not a type: " + (yyvsp[(1) - (1)].u.identifier)->get_fully_scoped_name(), (yylsp[(1) - (1)])); (yyval.u.type) = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); @@ -4819,7 +4844,7 @@ yyreduce: case 142: /* Line 1792 of yacc.c */ -#line 1258 "dtool/src/cppparser/cppBison.yxx" +#line 1275 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = (yyvsp[(1) - (1)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.type) == NULL) { @@ -4831,7 +4856,7 @@ yyreduce: case 143: /* Line 1792 of yacc.c */ -#line 1270 "dtool/src/cppparser/cppBison.yxx" +#line 1287 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[(1) - (1)].u.identifier)); } @@ -4839,7 +4864,7 @@ yyreduce: case 144: /* Line 1792 of yacc.c */ -#line 1274 "dtool/src/cppparser/cppBison.yxx" +#line 1291 "dtool/src/cppparser/cppBison.yxx" { // For an operator function. We implement this simply by building a // ficticious name for the function; in other respects it's just @@ -4857,7 +4882,7 @@ yyreduce: case 145: /* Line 1792 of yacc.c */ -#line 1288 "dtool/src/cppparser/cppBison.yxx" +#line 1305 "dtool/src/cppparser/cppBison.yxx" { // A C++11 literal operator. if (!(yyvsp[(2) - (3)].str).empty()) { @@ -4876,7 +4901,7 @@ yyreduce: case 146: /* Line 1792 of yacc.c */ -#line 1303 "dtool/src/cppparser/cppBison.yxx" +#line 1320 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); @@ -4885,7 +4910,7 @@ yyreduce: case 147: /* Line 1792 of yacc.c */ -#line 1308 "dtool/src/cppparser/cppBison.yxx" +#line 1325 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); @@ -4894,7 +4919,7 @@ yyreduce: case 148: /* Line 1792 of yacc.c */ -#line 1313 "dtool/src/cppparser/cppBison.yxx" +#line 1330 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); @@ -4903,7 +4928,7 @@ yyreduce: case 149: /* Line 1792 of yacc.c */ -#line 1318 "dtool/src/cppparser/cppBison.yxx" +#line 1335 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); @@ -4912,7 +4937,7 @@ yyreduce: case 150: /* Line 1792 of yacc.c */ -#line 1323 "dtool/src/cppparser/cppBison.yxx" +#line 1340 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); @@ -4921,7 +4946,7 @@ yyreduce: case 151: /* Line 1792 of yacc.c */ -#line 1328 "dtool/src/cppparser/cppBison.yxx" +#line 1345 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(3) - (3)].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[(1) - (3)].u.identifier)); @@ -4930,7 +4955,7 @@ yyreduce: case 152: /* Line 1792 of yacc.c */ -#line 1333 "dtool/src/cppparser/cppBison.yxx" +#line 1350 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(1) - (4)].u.inst_ident); (yyval.u.inst_ident)->add_array_modifier((yyvsp[(3) - (4)].u.expr)); @@ -4939,7 +4964,7 @@ yyreduce: case 153: /* Line 1792 of yacc.c */ -#line 1338 "dtool/src/cppparser/cppBison.yxx" +#line 1355 "dtool/src/cppparser/cppBison.yxx" { // bitfield definition. We ignore the bitfield for now. (yyval.u.inst_ident) = (yyvsp[(1) - (3)].u.inst_ident); @@ -4948,7 +4973,7 @@ yyreduce: case 154: /* Line 1792 of yacc.c */ -#line 1343 "dtool/src/cppparser/cppBison.yxx" +#line 1360 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (3)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); @@ -4957,7 +4982,7 @@ yyreduce: case 155: /* Line 1792 of yacc.c */ -#line 1348 "dtool/src/cppparser/cppBison.yxx" +#line 1365 "dtool/src/cppparser/cppBison.yxx" { push_scope((yyvsp[(1) - (2)].u.inst_ident)->get_scope(current_scope, global_scope)); } @@ -4965,7 +4990,7 @@ yyreduce: case 156: /* Line 1792 of yacc.c */ -#line 1352 "dtool/src/cppparser/cppBison.yxx" +#line 1369 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); (yyval.u.inst_ident) = (yyvsp[(1) - (6)].u.inst_ident); @@ -4983,7 +5008,7 @@ yyreduce: case 157: /* Line 1792 of yacc.c */ -#line 1370 "dtool/src/cppparser/cppBison.yxx" +#line 1387 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = new CPPParameterList; } @@ -4991,7 +5016,7 @@ yyreduce: case 158: /* Line 1792 of yacc.c */ -#line 1374 "dtool/src/cppparser/cppBison.yxx" +#line 1391 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = new CPPParameterList; (yyval.u.param_list)->_includes_ellipsis = true; @@ -5000,7 +5025,7 @@ yyreduce: case 159: /* Line 1792 of yacc.c */ -#line 1379 "dtool/src/cppparser/cppBison.yxx" +#line 1396 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = (yyvsp[(1) - (1)].u.param_list); } @@ -5008,7 +5033,7 @@ yyreduce: case 160: /* Line 1792 of yacc.c */ -#line 1383 "dtool/src/cppparser/cppBison.yxx" +#line 1400 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = (yyvsp[(1) - (3)].u.param_list); (yyval.u.param_list)->_includes_ellipsis = true; @@ -5017,7 +5042,7 @@ yyreduce: case 161: /* Line 1792 of yacc.c */ -#line 1388 "dtool/src/cppparser/cppBison.yxx" +#line 1405 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = (yyvsp[(1) - (2)].u.param_list); (yyval.u.param_list)->_includes_ellipsis = true; @@ -5026,7 +5051,7 @@ yyreduce: case 162: /* Line 1792 of yacc.c */ -#line 1396 "dtool/src/cppparser/cppBison.yxx" +#line 1413 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = new CPPParameterList; (yyval.u.param_list)->_parameters.push_back((yyvsp[(1) - (1)].u.instance)); @@ -5035,7 +5060,7 @@ yyreduce: case 163: /* Line 1792 of yacc.c */ -#line 1401 "dtool/src/cppparser/cppBison.yxx" +#line 1418 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.param_list) = (yyvsp[(1) - (3)].u.param_list); (yyval.u.param_list)->_parameters.push_back((yyvsp[(3) - (3)].u.instance)); @@ -5044,7 +5069,7 @@ yyreduce: case 164: /* Line 1792 of yacc.c */ -#line 1409 "dtool/src/cppparser/cppBison.yxx" +#line 1426 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -5052,7 +5077,7 @@ yyreduce: case 165: /* Line 1792 of yacc.c */ -#line 1413 "dtool/src/cppparser/cppBison.yxx" +#line 1430 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(2) - (2)].u.expr); } @@ -5060,7 +5085,7 @@ yyreduce: case 166: /* Line 1792 of yacc.c */ -#line 1420 "dtool/src/cppparser/cppBison.yxx" +#line 1437 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -5068,7 +5093,7 @@ yyreduce: case 167: /* Line 1792 of yacc.c */ -#line 1424 "dtool/src/cppparser/cppBison.yxx" +#line 1441 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(2) - (2)].u.expr); } @@ -5076,7 +5101,7 @@ yyreduce: case 168: /* Line 1792 of yacc.c */ -#line 1431 "dtool/src/cppparser/cppBison.yxx" +#line 1448 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -5084,7 +5109,7 @@ yyreduce: case 169: /* Line 1792 of yacc.c */ -#line 1435 "dtool/src/cppparser/cppBison.yxx" +#line 1452 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -5092,7 +5117,7 @@ yyreduce: case 170: /* Line 1792 of yacc.c */ -#line 1439 "dtool/src/cppparser/cppBison.yxx" +#line 1456 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -5100,7 +5125,7 @@ yyreduce: case 171: /* Line 1792 of yacc.c */ -#line 1443 "dtool/src/cppparser/cppBison.yxx" +#line 1460 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(2) - (3)].u.expr); } @@ -5108,7 +5133,7 @@ yyreduce: case 172: /* Line 1792 of yacc.c */ -#line 1447 "dtool/src/cppparser/cppBison.yxx" +#line 1464 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -5116,14 +5141,14 @@ yyreduce: case 176: /* Line 1792 of yacc.c */ -#line 1460 "dtool/src/cppparser/cppBison.yxx" +#line 1477 "dtool/src/cppparser/cppBison.yxx" { } break; case 180: /* Line 1792 of yacc.c */ -#line 1469 "dtool/src/cppparser/cppBison.yxx" +#line 1486 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.instance) = new CPPInstance((yyvsp[(1) - (3)].u.type), (yyvsp[(2) - (3)].u.inst_ident), 0, (yylsp[(2) - (3)]).file); (yyval.u.instance)->set_initializer((yyvsp[(3) - (3)].u.expr)); @@ -5132,7 +5157,7 @@ yyreduce: case 181: /* Line 1792 of yacc.c */ -#line 1474 "dtool/src/cppparser/cppBison.yxx" +#line 1491 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(3) - (4)].u.inst_ident)->add_modifier(IIT_const); (yyval.u.instance) = new CPPInstance((yyvsp[(2) - (4)].u.type), (yyvsp[(3) - (4)].u.inst_ident), 0, (yylsp[(3) - (4)]).file); @@ -5142,7 +5167,7 @@ yyreduce: case 182: /* Line 1792 of yacc.c */ -#line 1480 "dtool/src/cppparser/cppBison.yxx" +#line 1497 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(4) - (5)].u.inst_ident)->add_modifier(IIT_const); (yyval.u.instance) = new CPPInstance((yyvsp[(3) - (5)].u.type), (yyvsp[(4) - (5)].u.inst_ident), 0, (yylsp[(3) - (5)]).file); @@ -5152,7 +5177,7 @@ yyreduce: case 183: /* Line 1792 of yacc.c */ -#line 1486 "dtool/src/cppparser/cppBison.yxx" +#line 1503 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.instance) = (yyvsp[(2) - (2)].u.instance); } @@ -5160,7 +5185,7 @@ yyreduce: case 184: /* Line 1792 of yacc.c */ -#line 1490 "dtool/src/cppparser/cppBison.yxx" +#line 1507 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_parameter)); @@ -5171,7 +5196,7 @@ yyreduce: case 185: /* Line 1792 of yacc.c */ -#line 1500 "dtool/src/cppparser/cppBison.yxx" +#line 1517 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } @@ -5179,7 +5204,7 @@ yyreduce: case 186: /* Line 1792 of yacc.c */ -#line 1504 "dtool/src/cppparser/cppBison.yxx" +#line 1521 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[(1) - (1)].u.identifier)); } @@ -5187,7 +5212,7 @@ yyreduce: case 187: /* Line 1792 of yacc.c */ -#line 1508 "dtool/src/cppparser/cppBison.yxx" +#line 1525 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[(1) - (1)].u.identifier)); } @@ -5195,7 +5220,7 @@ yyreduce: case 188: /* Line 1792 of yacc.c */ -#line 1512 "dtool/src/cppparser/cppBison.yxx" +#line 1529 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); @@ -5204,7 +5229,7 @@ yyreduce: case 189: /* Line 1792 of yacc.c */ -#line 1517 "dtool/src/cppparser/cppBison.yxx" +#line 1534 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); @@ -5213,7 +5238,7 @@ yyreduce: case 190: /* Line 1792 of yacc.c */ -#line 1522 "dtool/src/cppparser/cppBison.yxx" +#line 1539 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); @@ -5222,7 +5247,7 @@ yyreduce: case 191: /* Line 1792 of yacc.c */ -#line 1527 "dtool/src/cppparser/cppBison.yxx" +#line 1544 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); @@ -5231,7 +5256,7 @@ yyreduce: case 192: /* Line 1792 of yacc.c */ -#line 1532 "dtool/src/cppparser/cppBison.yxx" +#line 1549 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); @@ -5240,7 +5265,7 @@ yyreduce: case 193: /* Line 1792 of yacc.c */ -#line 1537 "dtool/src/cppparser/cppBison.yxx" +#line 1554 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(3) - (3)].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[(1) - (3)].u.identifier)); @@ -5249,7 +5274,7 @@ yyreduce: case 194: /* Line 1792 of yacc.c */ -#line 1542 "dtool/src/cppparser/cppBison.yxx" +#line 1559 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(1) - (4)].u.inst_ident); (yyval.u.inst_ident)->add_array_modifier((yyvsp[(3) - (4)].u.expr)); @@ -5258,7 +5283,7 @@ yyreduce: case 195: /* Line 1792 of yacc.c */ -#line 1550 "dtool/src/cppparser/cppBison.yxx" +#line 1567 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } @@ -5266,7 +5291,7 @@ yyreduce: case 196: /* Line 1792 of yacc.c */ -#line 1554 "dtool/src/cppparser/cppBison.yxx" +#line 1571 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[(1) - (1)].u.identifier)); } @@ -5274,7 +5299,7 @@ yyreduce: case 197: /* Line 1792 of yacc.c */ -#line 1558 "dtool/src/cppparser/cppBison.yxx" +#line 1575 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((yyvsp[(1) - (1)].u.identifier)); } @@ -5282,7 +5307,7 @@ yyreduce: case 198: /* Line 1792 of yacc.c */ -#line 1562 "dtool/src/cppparser/cppBison.yxx" +#line 1579 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); @@ -5291,7 +5316,7 @@ yyreduce: case 199: /* Line 1792 of yacc.c */ -#line 1567 "dtool/src/cppparser/cppBison.yxx" +#line 1584 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); @@ -5300,7 +5325,7 @@ yyreduce: case 200: /* Line 1792 of yacc.c */ -#line 1572 "dtool/src/cppparser/cppBison.yxx" +#line 1589 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); @@ -5309,7 +5334,7 @@ yyreduce: case 201: /* Line 1792 of yacc.c */ -#line 1577 "dtool/src/cppparser/cppBison.yxx" +#line 1594 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); @@ -5318,7 +5343,7 @@ yyreduce: case 202: /* Line 1792 of yacc.c */ -#line 1582 "dtool/src/cppparser/cppBison.yxx" +#line 1599 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); @@ -5327,7 +5352,7 @@ yyreduce: case 203: /* Line 1792 of yacc.c */ -#line 1587 "dtool/src/cppparser/cppBison.yxx" +#line 1604 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(3) - (3)].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[(1) - (3)].u.identifier)); @@ -5336,7 +5361,7 @@ yyreduce: case 204: /* Line 1792 of yacc.c */ -#line 1592 "dtool/src/cppparser/cppBison.yxx" +#line 1609 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(1) - (4)].u.inst_ident); (yyval.u.inst_ident)->add_array_modifier((yyvsp[(3) - (4)].u.expr)); @@ -5345,7 +5370,7 @@ yyreduce: case 205: /* Line 1792 of yacc.c */ -#line 1597 "dtool/src/cppparser/cppBison.yxx" +#line 1614 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (7)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); @@ -5355,7 +5380,7 @@ yyreduce: case 206: /* Line 1792 of yacc.c */ -#line 1603 "dtool/src/cppparser/cppBison.yxx" +#line 1620 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (3)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); @@ -5364,7 +5389,7 @@ yyreduce: case 207: /* Line 1792 of yacc.c */ -#line 1611 "dtool/src/cppparser/cppBison.yxx" +#line 1628 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } @@ -5372,7 +5397,7 @@ yyreduce: case 208: /* Line 1792 of yacc.c */ -#line 1615 "dtool/src/cppparser/cppBison.yxx" +#line 1632 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_const); @@ -5381,7 +5406,7 @@ yyreduce: case 209: /* Line 1792 of yacc.c */ -#line 1620 "dtool/src/cppparser/cppBison.yxx" +#line 1637 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_volatile); @@ -5390,7 +5415,7 @@ yyreduce: case 210: /* Line 1792 of yacc.c */ -#line 1625 "dtool/src/cppparser/cppBison.yxx" +#line 1642 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_pointer); @@ -5399,7 +5424,7 @@ yyreduce: case 211: /* Line 1792 of yacc.c */ -#line 1630 "dtool/src/cppparser/cppBison.yxx" +#line 1647 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_reference); @@ -5408,7 +5433,7 @@ yyreduce: case 212: /* Line 1792 of yacc.c */ -#line 1635 "dtool/src/cppparser/cppBison.yxx" +#line 1652 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (2)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_rvalue_reference); @@ -5417,7 +5442,7 @@ yyreduce: case 213: /* Line 1792 of yacc.c */ -#line 1640 "dtool/src/cppparser/cppBison.yxx" +#line 1657 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(3) - (3)].u.inst_ident); (yyval.u.inst_ident)->add_scoped_pointer_modifier((yyvsp[(1) - (3)].u.identifier)); @@ -5426,7 +5451,7 @@ yyreduce: case 214: /* Line 1792 of yacc.c */ -#line 1645 "dtool/src/cppparser/cppBison.yxx" +#line 1662 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(1) - (4)].u.inst_ident); (yyval.u.inst_ident)->add_array_modifier((yyvsp[(3) - (4)].u.expr)); @@ -5435,7 +5460,7 @@ yyreduce: case 215: /* Line 1792 of yacc.c */ -#line 1650 "dtool/src/cppparser/cppBison.yxx" +#line 1667 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.inst_ident) = (yyvsp[(2) - (7)].u.inst_ident); (yyval.u.inst_ident)->add_modifier(IIT_paren); @@ -5445,7 +5470,7 @@ yyreduce: case 216: /* Line 1792 of yacc.c */ -#line 1659 "dtool/src/cppparser/cppBison.yxx" +#line 1676 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.simple_type)); } @@ -5453,7 +5478,7 @@ yyreduce: case 217: /* Line 1792 of yacc.c */ -#line 1663 "dtool/src/cppparser/cppBison.yxx" +#line 1680 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = (yyvsp[(1) - (1)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.type) == NULL) { @@ -5465,7 +5490,7 @@ yyreduce: case 218: /* Line 1792 of yacc.c */ -#line 1671 "dtool/src/cppparser/cppBison.yxx" +#line 1688 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type(new CPPTBDType((yyvsp[(2) - (2)].u.identifier))); } @@ -5473,7 +5498,7 @@ yyreduce: case 219: /* Line 1792 of yacc.c */ -#line 1675 "dtool/src/cppparser/cppBison.yxx" +#line 1692 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.struct_type)); } @@ -5481,7 +5506,7 @@ yyreduce: case 220: /* Line 1792 of yacc.c */ -#line 1679 "dtool/src/cppparser/cppBison.yxx" +#line 1696 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.struct_type)); } @@ -5489,7 +5514,7 @@ yyreduce: case 221: /* Line 1792 of yacc.c */ -#line 1683 "dtool/src/cppparser/cppBison.yxx" +#line 1700 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.enum_type)); } @@ -5497,7 +5522,7 @@ yyreduce: case 222: /* Line 1792 of yacc.c */ -#line 1687 "dtool/src/cppparser/cppBison.yxx" +#line 1704 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (2)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5517,7 +5542,7 @@ yyreduce: case 223: /* Line 1792 of yacc.c */ -#line 1703 "dtool/src/cppparser/cppBison.yxx" +#line 1720 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (4)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5537,7 +5562,7 @@ yyreduce: case 224: /* Line 1792 of yacc.c */ -#line 1719 "dtool/src/cppparser/cppBison.yxx" +#line 1736 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = (yyvsp[(3) - (4)].u.expr)->determine_type(); if ((yyval.u.type) == (CPPType *)NULL) { @@ -5550,7 +5575,7 @@ yyreduce: case 225: /* Line 1792 of yacc.c */ -#line 1728 "dtool/src/cppparser/cppBison.yxx" +#line 1745 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = new CPPSimpleType(CPPSimpleType::T_auto); } @@ -5558,7 +5583,7 @@ yyreduce: case 226: /* Line 1792 of yacc.c */ -#line 1735 "dtool/src/cppparser/cppBison.yxx" +#line 1752 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type((yyvsp[(1) - (1)].u.simple_type)); } @@ -5566,7 +5591,7 @@ yyreduce: case 227: /* Line 1792 of yacc.c */ -#line 1739 "dtool/src/cppparser/cppBison.yxx" +#line 1756 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = (yyvsp[(1) - (1)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.decl) == NULL) { @@ -5578,7 +5603,7 @@ yyreduce: case 228: /* Line 1792 of yacc.c */ -#line 1747 "dtool/src/cppparser/cppBison.yxx" +#line 1764 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type(new CPPTBDType((yyvsp[(2) - (2)].u.identifier))); } @@ -5586,7 +5611,7 @@ yyreduce: case 229: /* Line 1792 of yacc.c */ -#line 1751 "dtool/src/cppparser/cppBison.yxx" +#line 1768 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = CPPType::new_type((yyvsp[(1) - (1)].u.struct_type)); } @@ -5594,7 +5619,7 @@ yyreduce: case 230: /* Line 1792 of yacc.c */ -#line 1755 "dtool/src/cppparser/cppBison.yxx" +#line 1772 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = new CPPTypeDeclaration(CPPType::new_type((yyvsp[(1) - (1)].u.struct_type))); } @@ -5602,7 +5627,7 @@ yyreduce: case 231: /* Line 1792 of yacc.c */ -#line 1759 "dtool/src/cppparser/cppBison.yxx" +#line 1776 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = new CPPTypeDeclaration(CPPType::new_type((yyvsp[(1) - (1)].u.enum_type))); } @@ -5610,7 +5635,7 @@ yyreduce: case 232: /* Line 1792 of yacc.c */ -#line 1763 "dtool/src/cppparser/cppBison.yxx" +#line 1780 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (2)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5630,7 +5655,7 @@ yyreduce: case 233: /* Line 1792 of yacc.c */ -#line 1779 "dtool/src/cppparser/cppBison.yxx" +#line 1796 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (4)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5650,7 +5675,7 @@ yyreduce: case 234: /* Line 1792 of yacc.c */ -#line 1795 "dtool/src/cppparser/cppBison.yxx" +#line 1812 "dtool/src/cppparser/cppBison.yxx" { yywarning(string("C++ does not permit forward declaration of untyped enum ") + (yyvsp[(2) - (2)].u.identifier)->get_fully_scoped_name(), (yylsp[(1) - (2)])); @@ -5672,7 +5697,7 @@ yyreduce: case 235: /* Line 1792 of yacc.c */ -#line 1813 "dtool/src/cppparser/cppBison.yxx" +#line 1830 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = (yyvsp[(3) - (4)].u.expr)->determine_type(); if ((yyval.u.decl) == (CPPType *)NULL) { @@ -5685,7 +5710,7 @@ yyreduce: case 236: /* Line 1792 of yacc.c */ -#line 1822 "dtool/src/cppparser/cppBison.yxx" +#line 1839 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.decl) = new CPPSimpleType(CPPSimpleType::T_auto); } @@ -5693,7 +5718,7 @@ yyreduce: case 237: /* Line 1792 of yacc.c */ -#line 1829 "dtool/src/cppparser/cppBison.yxx" +#line 1846 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.simple_type)); } @@ -5701,7 +5726,7 @@ yyreduce: case 238: /* Line 1792 of yacc.c */ -#line 1833 "dtool/src/cppparser/cppBison.yxx" +#line 1850 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = (yyvsp[(1) - (1)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if ((yyval.u.type) == NULL) { @@ -5713,7 +5738,7 @@ yyreduce: case 239: /* Line 1792 of yacc.c */ -#line 1841 "dtool/src/cppparser/cppBison.yxx" +#line 1858 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type(new CPPTBDType((yyvsp[(2) - (2)].u.identifier))); } @@ -5721,7 +5746,7 @@ yyreduce: case 240: /* Line 1792 of yacc.c */ -#line 1845 "dtool/src/cppparser/cppBison.yxx" +#line 1862 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (2)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5741,7 +5766,7 @@ yyreduce: case 241: /* Line 1792 of yacc.c */ -#line 1861 "dtool/src/cppparser/cppBison.yxx" +#line 1878 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (2)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -5761,7 +5786,7 @@ yyreduce: case 242: /* Line 1792 of yacc.c */ -#line 1880 "dtool/src/cppparser/cppBison.yxx" +#line 1897 "dtool/src/cppparser/cppBison.yxx" { CPPInstance *inst = new CPPInstance((yyvsp[(1) - (2)].u.type), (yyvsp[(2) - (2)].u.inst_ident), 0, (yylsp[(1) - (2)]).file); (yyval.u.type) = inst->_type; @@ -5771,7 +5796,7 @@ yyreduce: case 243: /* Line 1792 of yacc.c */ -#line 1886 "dtool/src/cppparser/cppBison.yxx" +#line 1903 "dtool/src/cppparser/cppBison.yxx" { (yyvsp[(3) - (3)].u.inst_ident)->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance((yyvsp[(2) - (3)].u.type), (yyvsp[(3) - (3)].u.inst_ident), 0, (yylsp[(1) - (3)]).file); @@ -5782,7 +5807,7 @@ yyreduce: case 244: /* Line 1792 of yacc.c */ -#line 1896 "dtool/src/cppparser/cppBison.yxx" +#line 1913 "dtool/src/cppparser/cppBison.yxx" { CPPVisibility starting_vis = ((yyvsp[(1) - (2)].u.extension_enum) == CPPExtensionType::T_class) ? V_private : V_public; @@ -5800,7 +5825,7 @@ yyreduce: case 245: /* Line 1792 of yacc.c */ -#line 1910 "dtool/src/cppparser/cppBison.yxx" +#line 1927 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.struct_type) = current_struct; current_struct->_incomplete = false; @@ -5811,7 +5836,7 @@ yyreduce: case 246: /* Line 1792 of yacc.c */ -#line 1920 "dtool/src/cppparser/cppBison.yxx" +#line 1937 "dtool/src/cppparser/cppBison.yxx" { CPPVisibility starting_vis = ((yyvsp[(1) - (2)].u.extension_enum) == CPPExtensionType::T_class) ? V_private : V_public; @@ -5835,7 +5860,7 @@ yyreduce: case 247: /* Line 1792 of yacc.c */ -#line 1940 "dtool/src/cppparser/cppBison.yxx" +#line 1957 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.struct_type) = current_struct; current_struct->_incomplete = false; @@ -5846,7 +5871,7 @@ yyreduce: case 252: /* Line 1792 of yacc.c */ -#line 1960 "dtool/src/cppparser/cppBison.yxx" +#line 1977 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(2) - (2)].u.type), V_public, false); } @@ -5854,7 +5879,7 @@ yyreduce: case 253: /* Line 1792 of yacc.c */ -#line 1964 "dtool/src/cppparser/cppBison.yxx" +#line 1981 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(2) - (2)].u.type), V_protected, false); } @@ -5862,7 +5887,7 @@ yyreduce: case 254: /* Line 1792 of yacc.c */ -#line 1968 "dtool/src/cppparser/cppBison.yxx" +#line 1985 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(2) - (2)].u.type), V_private, false); } @@ -5870,7 +5895,7 @@ yyreduce: case 255: /* Line 1792 of yacc.c */ -#line 1972 "dtool/src/cppparser/cppBison.yxx" +#line 1989 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(3) - (3)].u.type), V_public, true); } @@ -5878,7 +5903,7 @@ yyreduce: case 256: /* Line 1792 of yacc.c */ -#line 1976 "dtool/src/cppparser/cppBison.yxx" +#line 1993 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(3) - (3)].u.type), V_protected, true); } @@ -5886,7 +5911,7 @@ yyreduce: case 257: /* Line 1792 of yacc.c */ -#line 1980 "dtool/src/cppparser/cppBison.yxx" +#line 1997 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(3) - (3)].u.type), V_private, true); } @@ -5894,7 +5919,7 @@ yyreduce: case 258: /* Line 1792 of yacc.c */ -#line 1984 "dtool/src/cppparser/cppBison.yxx" +#line 2001 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(3) - (3)].u.type), V_public, true); } @@ -5902,7 +5927,7 @@ yyreduce: case 259: /* Line 1792 of yacc.c */ -#line 1988 "dtool/src/cppparser/cppBison.yxx" +#line 2005 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(3) - (3)].u.type), V_protected, true); } @@ -5910,7 +5935,7 @@ yyreduce: case 260: /* Line 1792 of yacc.c */ -#line 1992 "dtool/src/cppparser/cppBison.yxx" +#line 2009 "dtool/src/cppparser/cppBison.yxx" { current_struct->append_derivation((yyvsp[(3) - (3)].u.type), V_private, true); } @@ -5918,7 +5943,7 @@ yyreduce: case 261: /* Line 1792 of yacc.c */ -#line 1999 "dtool/src/cppparser/cppBison.yxx" +#line 2016 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.enum_type) = current_enum; current_enum = NULL; @@ -5927,7 +5952,7 @@ yyreduce: case 262: /* Line 1792 of yacc.c */ -#line 2007 "dtool/src/cppparser/cppBison.yxx" +#line 2024 "dtool/src/cppparser/cppBison.yxx" { current_enum = new CPPEnumType((yyvsp[(2) - (4)].u.identifier), (yyvsp[(4) - (4)].u.type), current_scope, (yylsp[(1) - (4)]).file); } @@ -5935,7 +5960,7 @@ yyreduce: case 263: /* Line 1792 of yacc.c */ -#line 2011 "dtool/src/cppparser/cppBison.yxx" +#line 2028 "dtool/src/cppparser/cppBison.yxx" { current_enum = new CPPEnumType((yyvsp[(2) - (2)].u.identifier), current_scope, (yylsp[(1) - (2)]).file); } @@ -5943,7 +5968,7 @@ yyreduce: case 264: /* Line 1792 of yacc.c */ -#line 2015 "dtool/src/cppparser/cppBison.yxx" +#line 2032 "dtool/src/cppparser/cppBison.yxx" { current_enum = new CPPEnumType(NULL, (yyvsp[(3) - (3)].u.type), current_scope, (yylsp[(1) - (3)]).file); } @@ -5951,7 +5976,7 @@ yyreduce: case 265: /* Line 1792 of yacc.c */ -#line 2019 "dtool/src/cppparser/cppBison.yxx" +#line 2036 "dtool/src/cppparser/cppBison.yxx" { current_enum = new CPPEnumType(NULL, current_scope, (yylsp[(1) - (1)]).file); } @@ -5959,7 +5984,7 @@ yyreduce: case 266: /* Line 1792 of yacc.c */ -#line 2026 "dtool/src/cppparser/cppBison.yxx" +#line 2043 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type((yyvsp[(1) - (1)].u.simple_type)); } @@ -5967,7 +5992,7 @@ yyreduce: case 267: /* Line 1792 of yacc.c */ -#line 2030 "dtool/src/cppparser/cppBison.yxx" +#line 2047 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = (yyvsp[(1) - (1)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); } @@ -5975,7 +6000,7 @@ yyreduce: case 269: /* Line 1792 of yacc.c */ -#line 2038 "dtool/src/cppparser/cppBison.yxx" +#line 2055 "dtool/src/cppparser/cppBison.yxx" { assert(current_enum != NULL); CPPInstance *inst = current_enum->add_element((yyvsp[(2) - (3)].u.identifier)->get_simple_name()); @@ -5985,7 +6010,7 @@ yyreduce: case 270: /* Line 1792 of yacc.c */ -#line 2044 "dtool/src/cppparser/cppBison.yxx" +#line 2061 "dtool/src/cppparser/cppBison.yxx" { assert(current_enum != NULL); CPPInstance *inst = current_enum->add_element((yyvsp[(2) - (5)].u.identifier)->get_simple_name(), (yyvsp[(4) - (5)].u.expr)); @@ -5995,7 +6020,7 @@ yyreduce: case 272: /* Line 1792 of yacc.c */ -#line 2053 "dtool/src/cppparser/cppBison.yxx" +#line 2070 "dtool/src/cppparser/cppBison.yxx" { assert(current_enum != NULL); CPPInstance *inst = current_enum->add_element((yyvsp[(2) - (2)].u.identifier)->get_simple_name()); @@ -6005,7 +6030,7 @@ yyreduce: case 273: /* Line 1792 of yacc.c */ -#line 2059 "dtool/src/cppparser/cppBison.yxx" +#line 2076 "dtool/src/cppparser/cppBison.yxx" { assert(current_enum != NULL); CPPInstance *inst = current_enum->add_element((yyvsp[(2) - (4)].u.identifier)->get_simple_name(), (yyvsp[(4) - (4)].u.expr)); @@ -6015,7 +6040,7 @@ yyreduce: case 274: /* Line 1792 of yacc.c */ -#line 2068 "dtool/src/cppparser/cppBison.yxx" +#line 2085 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.extension_enum) = CPPExtensionType::T_enum; } @@ -6023,7 +6048,7 @@ yyreduce: case 275: /* Line 1792 of yacc.c */ -#line 2075 "dtool/src/cppparser/cppBison.yxx" +#line 2092 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.extension_enum) = CPPExtensionType::T_class; } @@ -6031,7 +6056,7 @@ yyreduce: case 276: /* Line 1792 of yacc.c */ -#line 2079 "dtool/src/cppparser/cppBison.yxx" +#line 2096 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.extension_enum) = CPPExtensionType::T_struct; } @@ -6039,7 +6064,7 @@ yyreduce: case 277: /* Line 1792 of yacc.c */ -#line 2083 "dtool/src/cppparser/cppBison.yxx" +#line 2100 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.extension_enum) = CPPExtensionType::T_union; } @@ -6047,7 +6072,7 @@ yyreduce: case 278: /* Line 1792 of yacc.c */ -#line 2090 "dtool/src/cppparser/cppBison.yxx" +#line 2107 "dtool/src/cppparser/cppBison.yxx" { CPPScope *scope = (yyvsp[(2) - (3)].u.identifier)->find_scope(current_scope, global_scope, current_lexer); if (scope == NULL) { @@ -6069,7 +6094,7 @@ yyreduce: case 279: /* Line 1792 of yacc.c */ -#line 2108 "dtool/src/cppparser/cppBison.yxx" +#line 2125 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); } @@ -6077,7 +6102,7 @@ yyreduce: case 280: /* Line 1792 of yacc.c */ -#line 2112 "dtool/src/cppparser/cppBison.yxx" +#line 2129 "dtool/src/cppparser/cppBison.yxx" { CPPScope *scope = (yyvsp[(3) - (4)].u.identifier)->find_scope(current_scope, global_scope, current_lexer); if (scope == NULL) { @@ -6100,7 +6125,7 @@ yyreduce: case 281: /* Line 1792 of yacc.c */ -#line 2131 "dtool/src/cppparser/cppBison.yxx" +#line 2148 "dtool/src/cppparser/cppBison.yxx" { pop_scope(); } @@ -6108,7 +6133,7 @@ yyreduce: case 284: /* Line 1792 of yacc.c */ -#line 2140 "dtool/src/cppparser/cppBison.yxx" +#line 2157 "dtool/src/cppparser/cppBison.yxx" { CPPUsing *using_decl = new CPPUsing((yyvsp[(2) - (2)].u.identifier), false, (yylsp[(1) - (2)]).file); current_scope->add_declaration(using_decl, global_scope, current_lexer, (yylsp[(1) - (2)])); @@ -6118,7 +6143,7 @@ yyreduce: case 285: /* Line 1792 of yacc.c */ -#line 2146 "dtool/src/cppparser/cppBison.yxx" +#line 2163 "dtool/src/cppparser/cppBison.yxx" { CPPUsing *using_decl = new CPPUsing((yyvsp[(3) - (3)].u.identifier), true, (yylsp[(1) - (3)]).file); current_scope->add_declaration(using_decl, global_scope, current_lexer, (yylsp[(1) - (3)])); @@ -6128,7 +6153,7 @@ yyreduce: case 289: /* Line 1792 of yacc.c */ -#line 2161 "dtool/src/cppparser/cppBison.yxx" +#line 2178 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_bool); } @@ -6136,7 +6161,7 @@ yyreduce: case 290: /* Line 1792 of yacc.c */ -#line 2165 "dtool/src/cppparser/cppBison.yxx" +#line 2182 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_char); } @@ -6144,7 +6169,7 @@ yyreduce: case 291: /* Line 1792 of yacc.c */ -#line 2169 "dtool/src/cppparser/cppBison.yxx" +#line 2186 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_wchar_t); } @@ -6152,7 +6177,7 @@ yyreduce: case 292: /* Line 1792 of yacc.c */ -#line 2173 "dtool/src/cppparser/cppBison.yxx" +#line 2190 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_char16_t); } @@ -6160,7 +6185,7 @@ yyreduce: case 293: /* Line 1792 of yacc.c */ -#line 2177 "dtool/src/cppparser/cppBison.yxx" +#line 2194 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_char32_t); } @@ -6168,7 +6193,7 @@ yyreduce: case 294: /* Line 1792 of yacc.c */ -#line 2181 "dtool/src/cppparser/cppBison.yxx" +#line 2198 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_short); @@ -6177,7 +6202,7 @@ yyreduce: case 295: /* Line 1792 of yacc.c */ -#line 2186 "dtool/src/cppparser/cppBison.yxx" +#line 2203 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_long); @@ -6186,7 +6211,7 @@ yyreduce: case 296: /* Line 1792 of yacc.c */ -#line 2191 "dtool/src/cppparser/cppBison.yxx" +#line 2208 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_longlong); @@ -6195,7 +6220,7 @@ yyreduce: case 297: /* Line 1792 of yacc.c */ -#line 2196 "dtool/src/cppparser/cppBison.yxx" +#line 2213 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_unsigned); @@ -6204,7 +6229,7 @@ yyreduce: case 298: /* Line 1792 of yacc.c */ -#line 2201 "dtool/src/cppparser/cppBison.yxx" +#line 2218 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int, CPPSimpleType::F_signed); @@ -6213,7 +6238,7 @@ yyreduce: case 299: /* Line 1792 of yacc.c */ -#line 2206 "dtool/src/cppparser/cppBison.yxx" +#line 2223 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_int); } @@ -6221,7 +6246,7 @@ yyreduce: case 300: /* Line 1792 of yacc.c */ -#line 2210 "dtool/src/cppparser/cppBison.yxx" +#line 2227 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = (yyvsp[(2) - (2)].u.simple_type); (yyval.u.simple_type)->_flags |= CPPSimpleType::F_short; @@ -6230,7 +6255,7 @@ yyreduce: case 301: /* Line 1792 of yacc.c */ -#line 2215 "dtool/src/cppparser/cppBison.yxx" +#line 2232 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = (yyvsp[(2) - (2)].u.simple_type); if ((yyval.u.simple_type)->_flags & CPPSimpleType::F_long) { @@ -6243,7 +6268,7 @@ yyreduce: case 302: /* Line 1792 of yacc.c */ -#line 2224 "dtool/src/cppparser/cppBison.yxx" +#line 2241 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = (yyvsp[(2) - (2)].u.simple_type); (yyval.u.simple_type)->_flags |= CPPSimpleType::F_unsigned; @@ -6252,7 +6277,7 @@ yyreduce: case 303: /* Line 1792 of yacc.c */ -#line 2229 "dtool/src/cppparser/cppBison.yxx" +#line 2246 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = (yyvsp[(2) - (2)].u.simple_type); (yyval.u.simple_type)->_flags |= CPPSimpleType::F_signed; @@ -6261,7 +6286,7 @@ yyreduce: case 304: /* Line 1792 of yacc.c */ -#line 2237 "dtool/src/cppparser/cppBison.yxx" +#line 2254 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_float); } @@ -6269,7 +6294,7 @@ yyreduce: case 305: /* Line 1792 of yacc.c */ -#line 2241 "dtool/src/cppparser/cppBison.yxx" +#line 2258 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_float, CPPSimpleType::F_long); @@ -6278,7 +6303,7 @@ yyreduce: case 306: /* Line 1792 of yacc.c */ -#line 2246 "dtool/src/cppparser/cppBison.yxx" +#line 2263 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_double); } @@ -6286,7 +6311,7 @@ yyreduce: case 307: /* Line 1792 of yacc.c */ -#line 2250 "dtool/src/cppparser/cppBison.yxx" +#line 2267 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_float, CPPSimpleType::F_longlong); @@ -6295,7 +6320,7 @@ yyreduce: case 308: /* Line 1792 of yacc.c */ -#line 2255 "dtool/src/cppparser/cppBison.yxx" +#line 2272 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_double, CPPSimpleType::F_long); @@ -6304,7 +6329,7 @@ yyreduce: case 309: /* Line 1792 of yacc.c */ -#line 2263 "dtool/src/cppparser/cppBison.yxx" +#line 2280 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.simple_type) = new CPPSimpleType(CPPSimpleType::T_void); } @@ -6312,7 +6337,7 @@ yyreduce: case 310: /* Line 1792 of yacc.c */ -#line 2272 "dtool/src/cppparser/cppBison.yxx" +#line 2289 "dtool/src/cppparser/cppBison.yxx" { current_lexer->_resolve_identifiers = false; } @@ -6320,7 +6345,7 @@ yyreduce: case 311: /* Line 1792 of yacc.c */ -#line 2276 "dtool/src/cppparser/cppBison.yxx" +#line 2293 "dtool/src/cppparser/cppBison.yxx" { current_lexer->_resolve_identifiers = true; } @@ -6328,14 +6353,14 @@ yyreduce: case 406: /* Line 1792 of yacc.c */ -#line 2316 "dtool/src/cppparser/cppBison.yxx" +#line 2333 "dtool/src/cppparser/cppBison.yxx" { } break; case 430: /* Line 1792 of yacc.c */ -#line 2325 "dtool/src/cppparser/cppBison.yxx" +#line 2342 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -6343,7 +6368,7 @@ yyreduce: case 431: /* Line 1792 of yacc.c */ -#line 2329 "dtool/src/cppparser/cppBison.yxx" +#line 2346 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -6351,7 +6376,7 @@ yyreduce: case 432: /* Line 1792 of yacc.c */ -#line 2336 "dtool/src/cppparser/cppBison.yxx" +#line 2353 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (CPPExpression *)NULL; } @@ -6359,7 +6384,7 @@ yyreduce: case 433: /* Line 1792 of yacc.c */ -#line 2340 "dtool/src/cppparser/cppBison.yxx" +#line 2357 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -6367,7 +6392,7 @@ yyreduce: case 434: /* Line 1792 of yacc.c */ -#line 2347 "dtool/src/cppparser/cppBison.yxx" +#line 2364 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -6375,7 +6400,7 @@ yyreduce: case 435: /* Line 1792 of yacc.c */ -#line 2351 "dtool/src/cppparser/cppBison.yxx" +#line 2368 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(',', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6383,7 +6408,7 @@ yyreduce: case 436: /* Line 1792 of yacc.c */ -#line 2358 "dtool/src/cppparser/cppBison.yxx" +#line 2375 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -6391,7 +6416,7 @@ yyreduce: case 437: /* Line 1792 of yacc.c */ -#line 2362 "dtool/src/cppparser/cppBison.yxx" +#line 2379 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(2) - (4)].u.type), (yyvsp[(4) - (4)].u.expr))); } @@ -6399,7 +6424,7 @@ yyreduce: case 438: /* Line 1792 of yacc.c */ -#line 2366 "dtool/src/cppparser/cppBison.yxx" +#line 2383 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(3) - (7)].u.type), (yyvsp[(6) - (7)].u.expr))); } @@ -6407,7 +6432,7 @@ yyreduce: case 439: /* Line 1792 of yacc.c */ -#line 2370 "dtool/src/cppparser/cppBison.yxx" +#line 2387 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(3) - (7)].u.type), (yyvsp[(6) - (7)].u.expr))); } @@ -6415,7 +6440,7 @@ yyreduce: case 440: /* Line 1792 of yacc.c */ -#line 2374 "dtool/src/cppparser/cppBison.yxx" +#line 2391 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[(3) - (4)].u.type))); } @@ -6423,7 +6448,7 @@ yyreduce: case 441: /* Line 1792 of yacc.c */ -#line 2378 "dtool/src/cppparser/cppBison.yxx" +#line 2395 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[(3) - (4)].u.type))); } @@ -6431,7 +6456,7 @@ yyreduce: case 442: /* Line 1792 of yacc.c */ -#line 2382 "dtool/src/cppparser/cppBison.yxx" +#line 2399 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[(2) - (2)].u.expr)); } @@ -6439,7 +6464,7 @@ yyreduce: case 443: /* Line 1792 of yacc.c */ -#line 2386 "dtool/src/cppparser/cppBison.yxx" +#line 2403 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[(2) - (2)].u.expr)); } @@ -6447,7 +6472,7 @@ yyreduce: case 444: /* Line 1792 of yacc.c */ -#line 2390 "dtool/src/cppparser/cppBison.yxx" +#line 2407 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[(2) - (2)].u.expr)); } @@ -6455,7 +6480,7 @@ yyreduce: case 445: /* Line 1792 of yacc.c */ -#line 2394 "dtool/src/cppparser/cppBison.yxx" +#line 2411 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[(2) - (2)].u.expr)); } @@ -6463,7 +6488,7 @@ yyreduce: case 446: /* Line 1792 of yacc.c */ -#line 2398 "dtool/src/cppparser/cppBison.yxx" +#line 2415 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[(2) - (2)].u.expr)); } @@ -6471,7 +6496,7 @@ yyreduce: case 447: /* Line 1792 of yacc.c */ -#line 2402 "dtool/src/cppparser/cppBison.yxx" +#line 2419 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('*', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6479,7 +6504,7 @@ yyreduce: case 448: /* Line 1792 of yacc.c */ -#line 2406 "dtool/src/cppparser/cppBison.yxx" +#line 2423 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('/', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6487,7 +6512,7 @@ yyreduce: case 449: /* Line 1792 of yacc.c */ -#line 2410 "dtool/src/cppparser/cppBison.yxx" +#line 2427 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('%', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6495,7 +6520,7 @@ yyreduce: case 450: /* Line 1792 of yacc.c */ -#line 2414 "dtool/src/cppparser/cppBison.yxx" +#line 2431 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('+', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6503,7 +6528,7 @@ yyreduce: case 451: /* Line 1792 of yacc.c */ -#line 2418 "dtool/src/cppparser/cppBison.yxx" +#line 2435 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('-', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6511,7 +6536,7 @@ yyreduce: case 452: /* Line 1792 of yacc.c */ -#line 2422 "dtool/src/cppparser/cppBison.yxx" +#line 2439 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('|', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6519,7 +6544,7 @@ yyreduce: case 453: /* Line 1792 of yacc.c */ -#line 2426 "dtool/src/cppparser/cppBison.yxx" +#line 2443 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('^', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6527,7 +6552,7 @@ yyreduce: case 454: /* Line 1792 of yacc.c */ -#line 2430 "dtool/src/cppparser/cppBison.yxx" +#line 2447 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('&', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6535,7 +6560,7 @@ yyreduce: case 455: /* Line 1792 of yacc.c */ -#line 2434 "dtool/src/cppparser/cppBison.yxx" +#line 2451 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6543,7 +6568,7 @@ yyreduce: case 456: /* Line 1792 of yacc.c */ -#line 2438 "dtool/src/cppparser/cppBison.yxx" +#line 2455 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6551,7 +6576,7 @@ yyreduce: case 457: /* Line 1792 of yacc.c */ -#line 2442 "dtool/src/cppparser/cppBison.yxx" +#line 2459 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6559,7 +6584,7 @@ yyreduce: case 458: /* Line 1792 of yacc.c */ -#line 2446 "dtool/src/cppparser/cppBison.yxx" +#line 2463 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6567,7 +6592,7 @@ yyreduce: case 459: /* Line 1792 of yacc.c */ -#line 2450 "dtool/src/cppparser/cppBison.yxx" +#line 2467 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6575,7 +6600,7 @@ yyreduce: case 460: /* Line 1792 of yacc.c */ -#line 2454 "dtool/src/cppparser/cppBison.yxx" +#line 2471 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6583,7 +6608,7 @@ yyreduce: case 461: /* Line 1792 of yacc.c */ -#line 2458 "dtool/src/cppparser/cppBison.yxx" +#line 2475 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6591,7 +6616,7 @@ yyreduce: case 462: /* Line 1792 of yacc.c */ -#line 2462 "dtool/src/cppparser/cppBison.yxx" +#line 2479 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6599,7 +6624,7 @@ yyreduce: case 463: /* Line 1792 of yacc.c */ -#line 2466 "dtool/src/cppparser/cppBison.yxx" +#line 2483 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('?', (yyvsp[(1) - (5)].u.expr), (yyvsp[(3) - (5)].u.expr), (yyvsp[(5) - (5)].u.expr)); } @@ -6607,7 +6632,7 @@ yyreduce: case 464: /* Line 1792 of yacc.c */ -#line 2470 "dtool/src/cppparser/cppBison.yxx" +#line 2487 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('[', (yyvsp[(1) - (4)].u.expr), (yyvsp[(3) - (4)].u.expr)); } @@ -6615,7 +6640,7 @@ yyreduce: case 465: /* Line 1792 of yacc.c */ -#line 2474 "dtool/src/cppparser/cppBison.yxx" +#line 2491 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('f', (yyvsp[(1) - (4)].u.expr), (yyvsp[(3) - (4)].u.expr)); } @@ -6623,7 +6648,7 @@ yyreduce: case 466: /* Line 1792 of yacc.c */ -#line 2478 "dtool/src/cppparser/cppBison.yxx" +#line 2495 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('f', (yyvsp[(1) - (3)].u.expr)); } @@ -6631,7 +6656,7 @@ yyreduce: case 467: /* Line 1792 of yacc.c */ -#line 2482 "dtool/src/cppparser/cppBison.yxx" +#line 2499 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('.', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6639,7 +6664,7 @@ yyreduce: case 468: /* Line 1792 of yacc.c */ -#line 2486 "dtool/src/cppparser/cppBison.yxx" +#line 2503 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6647,7 +6672,7 @@ yyreduce: case 469: /* Line 1792 of yacc.c */ -#line 2490 "dtool/src/cppparser/cppBison.yxx" +#line 2507 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(2) - (3)].u.expr); } @@ -6655,7 +6680,7 @@ yyreduce: case 470: /* Line 1792 of yacc.c */ -#line 2498 "dtool/src/cppparser/cppBison.yxx" +#line 2515 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -6663,7 +6688,7 @@ yyreduce: case 471: /* Line 1792 of yacc.c */ -#line 2502 "dtool/src/cppparser/cppBison.yxx" +#line 2519 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(2) - (4)].u.type), (yyvsp[(4) - (4)].u.expr))); } @@ -6671,7 +6696,7 @@ yyreduce: case 472: /* Line 1792 of yacc.c */ -#line 2506 "dtool/src/cppparser/cppBison.yxx" +#line 2523 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(3) - (7)].u.type), (yyvsp[(6) - (7)].u.expr))); } @@ -6679,7 +6704,7 @@ yyreduce: case 473: /* Line 1792 of yacc.c */ -#line 2510 "dtool/src/cppparser/cppBison.yxx" +#line 2527 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(3) - (7)].u.type), (yyvsp[(6) - (7)].u.expr))); } @@ -6687,7 +6712,7 @@ yyreduce: case 474: /* Line 1792 of yacc.c */ -#line 2514 "dtool/src/cppparser/cppBison.yxx" +#line 2531 "dtool/src/cppparser/cppBison.yxx" { // A constructor call. CPPType *type = (yyvsp[(1) - (4)].u.identifier)->find_type(current_scope, global_scope, false, current_lexer); @@ -6701,7 +6726,7 @@ yyreduce: case 475: /* Line 1792 of yacc.c */ -#line 2524 "dtool/src/cppparser/cppBison.yxx" +#line 2541 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int)); @@ -6711,7 +6736,7 @@ yyreduce: case 476: /* Line 1792 of yacc.c */ -#line 2530 "dtool/src/cppparser/cppBison.yxx" +#line 2547 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char)); @@ -6721,7 +6746,7 @@ yyreduce: case 477: /* Line 1792 of yacc.c */ -#line 2536 "dtool/src/cppparser/cppBison.yxx" +#line 2553 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_wchar_t)); @@ -6731,7 +6756,7 @@ yyreduce: case 478: /* Line 1792 of yacc.c */ -#line 2542 "dtool/src/cppparser/cppBison.yxx" +#line 2559 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char16_t)); @@ -6741,7 +6766,7 @@ yyreduce: case 479: /* Line 1792 of yacc.c */ -#line 2548 "dtool/src/cppparser/cppBison.yxx" +#line 2565 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char32_t)); @@ -6751,7 +6776,7 @@ yyreduce: case 480: /* Line 1792 of yacc.c */ -#line 2554 "dtool/src/cppparser/cppBison.yxx" +#line 2571 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_bool)); @@ -6761,7 +6786,7 @@ yyreduce: case 481: /* Line 1792 of yacc.c */ -#line 2560 "dtool/src/cppparser/cppBison.yxx" +#line 2577 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, @@ -6772,7 +6797,7 @@ yyreduce: case 482: /* Line 1792 of yacc.c */ -#line 2567 "dtool/src/cppparser/cppBison.yxx" +#line 2584 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, @@ -6783,7 +6808,7 @@ yyreduce: case 483: /* Line 1792 of yacc.c */ -#line 2574 "dtool/src/cppparser/cppBison.yxx" +#line 2591 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, @@ -6794,7 +6819,7 @@ yyreduce: case 484: /* Line 1792 of yacc.c */ -#line 2581 "dtool/src/cppparser/cppBison.yxx" +#line 2598 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, @@ -6805,7 +6830,7 @@ yyreduce: case 485: /* Line 1792 of yacc.c */ -#line 2588 "dtool/src/cppparser/cppBison.yxx" +#line 2605 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_float)); @@ -6815,7 +6840,7 @@ yyreduce: case 486: /* Line 1792 of yacc.c */ -#line 2594 "dtool/src/cppparser/cppBison.yxx" +#line 2611 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_double)); @@ -6825,7 +6850,7 @@ yyreduce: case 487: /* Line 1792 of yacc.c */ -#line 2600 "dtool/src/cppparser/cppBison.yxx" +#line 2617 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[(3) - (4)].u.type))); } @@ -6833,7 +6858,7 @@ yyreduce: case 488: /* Line 1792 of yacc.c */ -#line 2604 "dtool/src/cppparser/cppBison.yxx" +#line 2621 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[(3) - (4)].u.type))); } @@ -6841,7 +6866,7 @@ yyreduce: case 489: /* Line 1792 of yacc.c */ -#line 2608 "dtool/src/cppparser/cppBison.yxx" +#line 2625 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[(2) - (2)].u.type))); } @@ -6849,7 +6874,7 @@ yyreduce: case 490: /* Line 1792 of yacc.c */ -#line 2612 "dtool/src/cppparser/cppBison.yxx" +#line 2629 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[(2) - (5)].u.type), (yyvsp[(4) - (5)].u.expr))); } @@ -6857,7 +6882,7 @@ yyreduce: case 491: /* Line 1792 of yacc.c */ -#line 2616 "dtool/src/cppparser/cppBison.yxx" +#line 2633 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[(2) - (2)].u.expr)); } @@ -6865,7 +6890,7 @@ yyreduce: case 492: /* Line 1792 of yacc.c */ -#line 2620 "dtool/src/cppparser/cppBison.yxx" +#line 2637 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[(2) - (2)].u.expr)); } @@ -6873,7 +6898,7 @@ yyreduce: case 493: /* Line 1792 of yacc.c */ -#line 2624 "dtool/src/cppparser/cppBison.yxx" +#line 2641 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[(2) - (2)].u.expr)); } @@ -6881,7 +6906,7 @@ yyreduce: case 494: /* Line 1792 of yacc.c */ -#line 2628 "dtool/src/cppparser/cppBison.yxx" +#line 2645 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_STAR, (yyvsp[(2) - (2)].u.expr)); } @@ -6889,7 +6914,7 @@ yyreduce: case 495: /* Line 1792 of yacc.c */ -#line 2632 "dtool/src/cppparser/cppBison.yxx" +#line 2649 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[(2) - (2)].u.expr)); } @@ -6897,7 +6922,7 @@ yyreduce: case 496: /* Line 1792 of yacc.c */ -#line 2636 "dtool/src/cppparser/cppBison.yxx" +#line 2653 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('*', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6905,7 +6930,7 @@ yyreduce: case 497: /* Line 1792 of yacc.c */ -#line 2640 "dtool/src/cppparser/cppBison.yxx" +#line 2657 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('/', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6913,7 +6938,7 @@ yyreduce: case 498: /* Line 1792 of yacc.c */ -#line 2644 "dtool/src/cppparser/cppBison.yxx" +#line 2661 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('%', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6921,7 +6946,7 @@ yyreduce: case 499: /* Line 1792 of yacc.c */ -#line 2648 "dtool/src/cppparser/cppBison.yxx" +#line 2665 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('+', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6929,7 +6954,7 @@ yyreduce: case 500: /* Line 1792 of yacc.c */ -#line 2652 "dtool/src/cppparser/cppBison.yxx" +#line 2669 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('-', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6937,7 +6962,7 @@ yyreduce: case 501: /* Line 1792 of yacc.c */ -#line 2656 "dtool/src/cppparser/cppBison.yxx" +#line 2673 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('|', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6945,7 +6970,7 @@ yyreduce: case 502: /* Line 1792 of yacc.c */ -#line 2660 "dtool/src/cppparser/cppBison.yxx" +#line 2677 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('^', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6953,7 +6978,7 @@ yyreduce: case 503: /* Line 1792 of yacc.c */ -#line 2664 "dtool/src/cppparser/cppBison.yxx" +#line 2681 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('&', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6961,7 +6986,7 @@ yyreduce: case 504: /* Line 1792 of yacc.c */ -#line 2668 "dtool/src/cppparser/cppBison.yxx" +#line 2685 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6969,7 +6994,7 @@ yyreduce: case 505: /* Line 1792 of yacc.c */ -#line 2672 "dtool/src/cppparser/cppBison.yxx" +#line 2689 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6977,7 +7002,7 @@ yyreduce: case 506: /* Line 1792 of yacc.c */ -#line 2676 "dtool/src/cppparser/cppBison.yxx" +#line 2693 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6985,7 +7010,7 @@ yyreduce: case 507: /* Line 1792 of yacc.c */ -#line 2680 "dtool/src/cppparser/cppBison.yxx" +#line 2697 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -6993,7 +7018,7 @@ yyreduce: case 508: /* Line 1792 of yacc.c */ -#line 2684 "dtool/src/cppparser/cppBison.yxx" +#line 2701 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7001,7 +7026,7 @@ yyreduce: case 509: /* Line 1792 of yacc.c */ -#line 2688 "dtool/src/cppparser/cppBison.yxx" +#line 2705 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7009,7 +7034,7 @@ yyreduce: case 510: /* Line 1792 of yacc.c */ -#line 2692 "dtool/src/cppparser/cppBison.yxx" +#line 2709 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('<', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7017,7 +7042,7 @@ yyreduce: case 511: /* Line 1792 of yacc.c */ -#line 2696 "dtool/src/cppparser/cppBison.yxx" +#line 2713 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('>', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7025,7 +7050,7 @@ yyreduce: case 512: /* Line 1792 of yacc.c */ -#line 2700 "dtool/src/cppparser/cppBison.yxx" +#line 2717 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7033,7 +7058,7 @@ yyreduce: case 513: /* Line 1792 of yacc.c */ -#line 2704 "dtool/src/cppparser/cppBison.yxx" +#line 2721 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7041,7 +7066,7 @@ yyreduce: case 514: /* Line 1792 of yacc.c */ -#line 2708 "dtool/src/cppparser/cppBison.yxx" +#line 2725 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('?', (yyvsp[(1) - (5)].u.expr), (yyvsp[(3) - (5)].u.expr), (yyvsp[(5) - (5)].u.expr)); } @@ -7049,7 +7074,7 @@ yyreduce: case 515: /* Line 1792 of yacc.c */ -#line 2712 "dtool/src/cppparser/cppBison.yxx" +#line 2729 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('[', (yyvsp[(1) - (4)].u.expr), (yyvsp[(3) - (4)].u.expr)); } @@ -7057,7 +7082,7 @@ yyreduce: case 516: /* Line 1792 of yacc.c */ -#line 2716 "dtool/src/cppparser/cppBison.yxx" +#line 2733 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('f', (yyvsp[(1) - (4)].u.expr), (yyvsp[(3) - (4)].u.expr)); } @@ -7065,7 +7090,7 @@ yyreduce: case 517: /* Line 1792 of yacc.c */ -#line 2720 "dtool/src/cppparser/cppBison.yxx" +#line 2737 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('f', (yyvsp[(1) - (3)].u.expr)); } @@ -7073,7 +7098,7 @@ yyreduce: case 518: /* Line 1792 of yacc.c */ -#line 2724 "dtool/src/cppparser/cppBison.yxx" +#line 2741 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('.', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7081,7 +7106,7 @@ yyreduce: case 519: /* Line 1792 of yacc.c */ -#line 2728 "dtool/src/cppparser/cppBison.yxx" +#line 2745 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7089,7 +7114,7 @@ yyreduce: case 520: /* Line 1792 of yacc.c */ -#line 2732 "dtool/src/cppparser/cppBison.yxx" +#line 2749 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(2) - (3)].u.expr); } @@ -7097,7 +7122,7 @@ yyreduce: case 521: /* Line 1792 of yacc.c */ -#line 2739 "dtool/src/cppparser/cppBison.yxx" +#line 2756 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.integer)); } @@ -7105,7 +7130,7 @@ yyreduce: case 522: /* Line 1792 of yacc.c */ -#line 2743 "dtool/src/cppparser/cppBison.yxx" +#line 2760 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(true); } @@ -7113,7 +7138,7 @@ yyreduce: case 523: /* Line 1792 of yacc.c */ -#line 2747 "dtool/src/cppparser/cppBison.yxx" +#line 2764 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(false); } @@ -7121,7 +7146,7 @@ yyreduce: case 524: /* Line 1792 of yacc.c */ -#line 2751 "dtool/src/cppparser/cppBison.yxx" +#line 2768 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.integer)); } @@ -7129,7 +7154,7 @@ yyreduce: case 525: /* Line 1792 of yacc.c */ -#line 2755 "dtool/src/cppparser/cppBison.yxx" +#line 2772 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.real)); } @@ -7137,7 +7162,7 @@ yyreduce: case 526: /* Line 1792 of yacc.c */ -#line 2759 "dtool/src/cppparser/cppBison.yxx" +#line 2776 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -7145,7 +7170,7 @@ yyreduce: case 527: /* Line 1792 of yacc.c */ -#line 2763 "dtool/src/cppparser/cppBison.yxx" +#line 2780 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -7153,7 +7178,7 @@ yyreduce: case 528: /* Line 1792 of yacc.c */ -#line 2767 "dtool/src/cppparser/cppBison.yxx" +#line 2784 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.identifier), current_scope, global_scope, current_lexer); } @@ -7161,7 +7186,7 @@ yyreduce: case 529: /* Line 1792 of yacc.c */ -#line 2771 "dtool/src/cppparser/cppBison.yxx" +#line 2788 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); } @@ -7169,7 +7194,7 @@ yyreduce: case 530: /* Line 1792 of yacc.c */ -#line 2785 "dtool/src/cppparser/cppBison.yxx" +#line 2802 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -7177,7 +7202,7 @@ yyreduce: case 531: /* Line 1792 of yacc.c */ -#line 2789 "dtool/src/cppparser/cppBison.yxx" +#line 2806 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(2) - (4)].u.type), (yyvsp[(4) - (4)].u.expr))); } @@ -7185,7 +7210,7 @@ yyreduce: case 532: /* Line 1792 of yacc.c */ -#line 2793 "dtool/src/cppparser/cppBison.yxx" +#line 2810 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(3) - (7)].u.type), (yyvsp[(6) - (7)].u.expr))); } @@ -7193,7 +7218,7 @@ yyreduce: case 533: /* Line 1792 of yacc.c */ -#line 2797 "dtool/src/cppparser/cppBison.yxx" +#line 2814 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::typecast_op((yyvsp[(3) - (7)].u.type), (yyvsp[(6) - (7)].u.expr))); } @@ -7201,7 +7226,7 @@ yyreduce: case 534: /* Line 1792 of yacc.c */ -#line 2801 "dtool/src/cppparser/cppBison.yxx" +#line 2818 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::sizeof_func((yyvsp[(3) - (4)].u.type))); } @@ -7209,7 +7234,7 @@ yyreduce: case 535: /* Line 1792 of yacc.c */ -#line 2805 "dtool/src/cppparser/cppBison.yxx" +#line 2822 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::alignof_func((yyvsp[(3) - (4)].u.type))); } @@ -7217,7 +7242,7 @@ yyreduce: case 536: /* Line 1792 of yacc.c */ -#line 2809 "dtool/src/cppparser/cppBison.yxx" +#line 2826 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[(2) - (2)].u.type))); } @@ -7225,7 +7250,7 @@ yyreduce: case 537: /* Line 1792 of yacc.c */ -#line 2813 "dtool/src/cppparser/cppBison.yxx" +#line 2830 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::new_op((yyvsp[(2) - (5)].u.type), (yyvsp[(4) - (5)].u.expr))); } @@ -7233,7 +7258,7 @@ yyreduce: case 538: /* Line 1792 of yacc.c */ -#line 2817 "dtool/src/cppparser/cppBison.yxx" +#line 2834 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_NOT, (yyvsp[(2) - (2)].u.expr)); } @@ -7241,7 +7266,7 @@ yyreduce: case 539: /* Line 1792 of yacc.c */ -#line 2821 "dtool/src/cppparser/cppBison.yxx" +#line 2838 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_NEGATE, (yyvsp[(2) - (2)].u.expr)); } @@ -7249,7 +7274,7 @@ yyreduce: case 540: /* Line 1792 of yacc.c */ -#line 2825 "dtool/src/cppparser/cppBison.yxx" +#line 2842 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_MINUS, (yyvsp[(2) - (2)].u.expr)); } @@ -7257,7 +7282,7 @@ yyreduce: case 541: /* Line 1792 of yacc.c */ -#line 2829 "dtool/src/cppparser/cppBison.yxx" +#line 2846 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(UNARY_REF, (yyvsp[(2) - (2)].u.expr)); } @@ -7265,7 +7290,7 @@ yyreduce: case 542: /* Line 1792 of yacc.c */ -#line 2833 "dtool/src/cppparser/cppBison.yxx" +#line 2850 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('*', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7273,7 +7298,7 @@ yyreduce: case 543: /* Line 1792 of yacc.c */ -#line 2837 "dtool/src/cppparser/cppBison.yxx" +#line 2854 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('/', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7281,7 +7306,7 @@ yyreduce: case 544: /* Line 1792 of yacc.c */ -#line 2841 "dtool/src/cppparser/cppBison.yxx" +#line 2858 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('%', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7289,7 +7314,7 @@ yyreduce: case 545: /* Line 1792 of yacc.c */ -#line 2845 "dtool/src/cppparser/cppBison.yxx" +#line 2862 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('+', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7297,7 +7322,7 @@ yyreduce: case 546: /* Line 1792 of yacc.c */ -#line 2849 "dtool/src/cppparser/cppBison.yxx" +#line 2866 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('-', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7305,7 +7330,7 @@ yyreduce: case 547: /* Line 1792 of yacc.c */ -#line 2853 "dtool/src/cppparser/cppBison.yxx" +#line 2870 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('|', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7313,7 +7338,7 @@ yyreduce: case 548: /* Line 1792 of yacc.c */ -#line 2857 "dtool/src/cppparser/cppBison.yxx" +#line 2874 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('^', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7321,7 +7346,7 @@ yyreduce: case 549: /* Line 1792 of yacc.c */ -#line 2861 "dtool/src/cppparser/cppBison.yxx" +#line 2878 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('&', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7329,7 +7354,7 @@ yyreduce: case 550: /* Line 1792 of yacc.c */ -#line 2865 "dtool/src/cppparser/cppBison.yxx" +#line 2882 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(OROR, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7337,7 +7362,7 @@ yyreduce: case 551: /* Line 1792 of yacc.c */ -#line 2869 "dtool/src/cppparser/cppBison.yxx" +#line 2886 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(ANDAND, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7345,7 +7370,7 @@ yyreduce: case 552: /* Line 1792 of yacc.c */ -#line 2873 "dtool/src/cppparser/cppBison.yxx" +#line 2890 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(EQCOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7353,7 +7378,7 @@ yyreduce: case 553: /* Line 1792 of yacc.c */ -#line 2877 "dtool/src/cppparser/cppBison.yxx" +#line 2894 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(NECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7361,7 +7386,7 @@ yyreduce: case 554: /* Line 1792 of yacc.c */ -#line 2881 "dtool/src/cppparser/cppBison.yxx" +#line 2898 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(LECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7369,7 +7394,7 @@ yyreduce: case 555: /* Line 1792 of yacc.c */ -#line 2885 "dtool/src/cppparser/cppBison.yxx" +#line 2902 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(GECOMPARE, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7377,7 +7402,7 @@ yyreduce: case 556: /* Line 1792 of yacc.c */ -#line 2889 "dtool/src/cppparser/cppBison.yxx" +#line 2906 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('<', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7385,7 +7410,7 @@ yyreduce: case 557: /* Line 1792 of yacc.c */ -#line 2893 "dtool/src/cppparser/cppBison.yxx" +#line 2910 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('>', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7393,7 +7418,7 @@ yyreduce: case 558: /* Line 1792 of yacc.c */ -#line 2897 "dtool/src/cppparser/cppBison.yxx" +#line 2914 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(LSHIFT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7401,7 +7426,7 @@ yyreduce: case 559: /* Line 1792 of yacc.c */ -#line 2901 "dtool/src/cppparser/cppBison.yxx" +#line 2918 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(RSHIFT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7409,7 +7434,7 @@ yyreduce: case 560: /* Line 1792 of yacc.c */ -#line 2905 "dtool/src/cppparser/cppBison.yxx" +#line 2922 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('?', (yyvsp[(1) - (5)].u.expr), (yyvsp[(3) - (5)].u.expr), (yyvsp[(5) - (5)].u.expr)); } @@ -7417,7 +7442,7 @@ yyreduce: case 561: /* Line 1792 of yacc.c */ -#line 2909 "dtool/src/cppparser/cppBison.yxx" +#line 2926 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('[', (yyvsp[(1) - (4)].u.expr), (yyvsp[(3) - (4)].u.expr)); } @@ -7425,7 +7450,7 @@ yyreduce: case 562: /* Line 1792 of yacc.c */ -#line 2913 "dtool/src/cppparser/cppBison.yxx" +#line 2930 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('f', (yyvsp[(1) - (4)].u.expr), (yyvsp[(3) - (4)].u.expr)); } @@ -7433,7 +7458,7 @@ yyreduce: case 563: /* Line 1792 of yacc.c */ -#line 2917 "dtool/src/cppparser/cppBison.yxx" +#line 2934 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('f', (yyvsp[(1) - (3)].u.expr)); } @@ -7441,7 +7466,7 @@ yyreduce: case 564: /* Line 1792 of yacc.c */ -#line 2921 "dtool/src/cppparser/cppBison.yxx" +#line 2938 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression('.', (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7449,7 +7474,7 @@ yyreduce: case 565: /* Line 1792 of yacc.c */ -#line 2925 "dtool/src/cppparser/cppBison.yxx" +#line 2942 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(POINTSAT, (yyvsp[(1) - (3)].u.expr), (yyvsp[(3) - (3)].u.expr)); } @@ -7457,7 +7482,7 @@ yyreduce: case 566: /* Line 1792 of yacc.c */ -#line 2929 "dtool/src/cppparser/cppBison.yxx" +#line 2946 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(2) - (3)].u.expr); } @@ -7465,7 +7490,7 @@ yyreduce: case 567: /* Line 1792 of yacc.c */ -#line 2936 "dtool/src/cppparser/cppBison.yxx" +#line 2953 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.integer)); } @@ -7473,7 +7498,7 @@ yyreduce: case 568: /* Line 1792 of yacc.c */ -#line 2940 "dtool/src/cppparser/cppBison.yxx" +#line 2957 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(true); } @@ -7481,7 +7506,7 @@ yyreduce: case 569: /* Line 1792 of yacc.c */ -#line 2944 "dtool/src/cppparser/cppBison.yxx" +#line 2961 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(false); } @@ -7489,7 +7514,7 @@ yyreduce: case 570: /* Line 1792 of yacc.c */ -#line 2948 "dtool/src/cppparser/cppBison.yxx" +#line 2965 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.integer)); } @@ -7497,7 +7522,7 @@ yyreduce: case 571: /* Line 1792 of yacc.c */ -#line 2952 "dtool/src/cppparser/cppBison.yxx" +#line 2969 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.real)); } @@ -7505,7 +7530,7 @@ yyreduce: case 572: /* Line 1792 of yacc.c */ -#line 2956 "dtool/src/cppparser/cppBison.yxx" +#line 2973 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -7513,7 +7538,7 @@ yyreduce: case 573: /* Line 1792 of yacc.c */ -#line 2960 "dtool/src/cppparser/cppBison.yxx" +#line 2977 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -7521,7 +7546,7 @@ yyreduce: case 574: /* Line 1792 of yacc.c */ -#line 2964 "dtool/src/cppparser/cppBison.yxx" +#line 2981 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].u.identifier), current_scope, global_scope, current_lexer); } @@ -7529,7 +7554,7 @@ yyreduce: case 575: /* Line 1792 of yacc.c */ -#line 2968 "dtool/src/cppparser/cppBison.yxx" +#line 2985 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression(CPPExpression::get_nullptr()); } @@ -7537,7 +7562,7 @@ yyreduce: case 576: /* Line 1792 of yacc.c */ -#line 2975 "dtool/src/cppparser/cppBison.yxx" +#line 2992 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(1) - (1)].u.identifier)->find_type(current_scope, global_scope, true); if (type == NULL) { @@ -7549,7 +7574,7 @@ yyreduce: case 577: /* Line 1792 of yacc.c */ -#line 2983 "dtool/src/cppparser/cppBison.yxx" +#line 3000 "dtool/src/cppparser/cppBison.yxx" { CPPType *type = (yyvsp[(2) - (2)].u.identifier)->find_type(current_scope, global_scope, true, current_lexer); if (type == NULL) { @@ -7561,7 +7586,7 @@ yyreduce: case 578: /* Line 1792 of yacc.c */ -#line 2991 "dtool/src/cppparser/cppBison.yxx" +#line 3008 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.type) = CPPType::new_type(new CPPTBDType((yyvsp[(2) - (2)].u.identifier))); } @@ -7569,7 +7594,7 @@ yyreduce: case 579: /* Line 1792 of yacc.c */ -#line 3017 "dtool/src/cppparser/cppBison.yxx" +#line 3034 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.identifier) = (yyvsp[(1) - (1)].u.identifier); } @@ -7577,7 +7602,7 @@ yyreduce: case 580: /* Line 1792 of yacc.c */ -#line 3021 "dtool/src/cppparser/cppBison.yxx" +#line 3038 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.identifier) = (yyvsp[(1) - (1)].u.identifier); } @@ -7585,7 +7610,7 @@ yyreduce: case 581: /* Line 1792 of yacc.c */ -#line 3028 "dtool/src/cppparser/cppBison.yxx" +#line 3045 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = new CPPExpression((yyvsp[(1) - (1)].str)); } @@ -7593,7 +7618,7 @@ yyreduce: case 582: /* Line 1792 of yacc.c */ -#line 3032 "dtool/src/cppparser/cppBison.yxx" +#line 3049 "dtool/src/cppparser/cppBison.yxx" { (yyval.u.expr) = (yyvsp[(1) - (1)].u.expr); } @@ -7601,7 +7626,7 @@ yyreduce: case 583: /* Line 1792 of yacc.c */ -#line 3036 "dtool/src/cppparser/cppBison.yxx" +#line 3053 "dtool/src/cppparser/cppBison.yxx" { // The right string takes on the literal type of the left. (yyval.u.expr) = (yyvsp[(1) - (2)].u.expr); @@ -7611,7 +7636,7 @@ yyreduce: case 584: /* Line 1792 of yacc.c */ -#line 3042 "dtool/src/cppparser/cppBison.yxx" +#line 3059 "dtool/src/cppparser/cppBison.yxx" { // We have to check that the two literal types match up. (yyval.u.expr) = (yyvsp[(1) - (2)].u.expr); @@ -7624,7 +7649,7 @@ yyreduce: /* Line 1792 of yacc.c */ -#line 7628 "built/tmp/cppBison.yxx.c" +#line 7653 "built/tmp/cppBison.yxx.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index d98f4f71e8..ebca2ad3be 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -502,7 +502,7 @@ declaration: CPPDeclaration *getter = $5->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @1); + yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @5); } CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(), NULL, current_scope, @1.file); @@ -512,14 +512,14 @@ declaration: { CPPDeclaration *getter = $5->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @1); + yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @5); } else { CPPDeclaration *setter = $7->find_symbol(current_scope, global_scope, current_lexer); CPPFunctionGroup *setter_func = NULL; if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @1); + yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @7); } else { setter_func = setter->as_function_group(); } @@ -529,10 +529,27 @@ declaration: current_scope->add_declaration(make_property, global_scope, current_lexer, @1); } } - | KW_MAKE_SEQ '(' name ',' name ',' name ')' ';' + | KW_MAKE_SEQ '(' IDENTIFIER ',' IDENTIFIER ',' IDENTIFIER ')' ';' { - CPPMakeSeq *make_seq = new CPPMakeSeq($3->get_simple_name(), $5->get_simple_name(), $7->get_simple_name(), @1.file); - current_scope->add_declaration(make_seq, global_scope, current_lexer, @1); + CPPDeclaration *length_getter = $5->find_symbol(current_scope, global_scope, current_lexer); + if (length_getter == (CPPDeclaration *)NULL || length_getter->get_subtype() != CPPDeclaration::ST_function_group) { + yyerror("reference to non-existent or invalid length method: " + $5->get_fully_scoped_name(), @5); + length_getter = NULL; + } + + CPPDeclaration *element_getter = $7->find_symbol(current_scope, global_scope, current_lexer); + if (element_getter == (CPPDeclaration *)NULL || element_getter->get_subtype() != CPPDeclaration::ST_function_group) { + yyerror("reference to non-existent or invalid element method: " + $7->get_fully_scoped_name(), @5); + element_getter = NULL; + } + + if (length_getter != (CPPDeclaration *)NULL && element_getter != (CPPDeclaration *)NULL) { + CPPMakeSeq *make_seq = new CPPMakeSeq($3, + length_getter->as_function_group(), + element_getter->as_function_group(), + current_scope, @1.file); + current_scope->add_declaration(make_seq, global_scope, current_lexer, @1); + } } | KW_STATIC_ASSERT '(' const_expr ',' string_literal ')' { diff --git a/dtool/src/cppparser/cppEnumType.cxx b/dtool/src/cppparser/cppEnumType.cxx index e3506d0ad1..abb8e595ed 100644 --- a/dtool/src/cppparser/cppEnumType.cxx +++ b/dtool/src/cppparser/cppEnumType.cxx @@ -19,6 +19,7 @@ #include "cppConstType.h" #include "cppScope.h" #include "cppParser.h" +#include "cppIdentifier.h" #include "indent.h" //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppMakeSeq.cxx b/dtool/src/cppparser/cppMakeSeq.cxx index db3207c58a..b3b8a78b5f 100644 --- a/dtool/src/cppparser/cppMakeSeq.cxx +++ b/dtool/src/cppparser/cppMakeSeq.cxx @@ -20,13 +20,46 @@ // Description: //////////////////////////////////////////////////////////////////// CPPMakeSeq:: -CPPMakeSeq(const string &seq_name, const string &num_name, - const string &element_name, const CPPFile &file) : +CPPMakeSeq(CPPIdentifier *ident, + CPPFunctionGroup *length_getter, + CPPFunctionGroup *element_getter, + CPPScope *current_scope, const CPPFile &file) : CPPDeclaration(file), - _seq_name(seq_name), - _num_name(num_name), - _element_name(element_name) + _ident(ident), + _length_getter(length_getter), + _element_getter(element_getter) { + _ident->_native_scope = current_scope; +} + +//////////////////////////////////////////////////////////////////// +// Function: CPPMakeSeq::get_simple_name +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +string CPPMakeSeq:: +get_simple_name() const { + return _ident->get_simple_name(); +} + +//////////////////////////////////////////////////////////////////// +// Function: CPPMakeSeq::get_local_name +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +string CPPMakeSeq:: +get_local_name(CPPScope *scope) const { + return _ident->get_local_name(scope); +} + +//////////////////////////////////////////////////////////////////// +// Function: CPPMakeSeq::get_fully_scoped_name +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +string CPPMakeSeq:: +get_fully_scoped_name() const { + return _ident->get_fully_scoped_name(); } //////////////////////////////////////////////////////////////////// @@ -36,8 +69,10 @@ CPPMakeSeq(const string &seq_name, const string &num_name, //////////////////////////////////////////////////////////////////// void CPPMakeSeq:: output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { - out << "__make_seq(" << _seq_name << ", " << _num_name << ", " - << _element_name << ");"; + out << "__make_seq(" << _ident->get_local_name(scope) + << ", " << _length_getter->_name + << ", " << _element_getter->_name + << ");"; } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppMakeSeq.h b/dtool/src/cppparser/cppMakeSeq.h index 0016617c69..e5eb414f11 100644 --- a/dtool/src/cppparser/cppMakeSeq.h +++ b/dtool/src/cppparser/cppMakeSeq.h @@ -18,6 +18,8 @@ #include "dtoolbase.h" #include "cppDeclaration.h" +#include "cppIdentifier.h" +#include "cppFunctionGroup.h" /////////////////////////////////////////////////////////////////// // Class : CPPMakeSeq @@ -29,8 +31,14 @@ //////////////////////////////////////////////////////////////////// class CPPMakeSeq : public CPPDeclaration { public: - CPPMakeSeq(const string &seq_name, const string &num_name, - const string &element_name, const CPPFile &file); + CPPMakeSeq(CPPIdentifier *ident, + CPPFunctionGroup *length_getter, + CPPFunctionGroup *element_getter, + CPPScope *current_scope, const CPPFile &file); + + virtual string get_simple_name() const; + virtual string get_local_name(CPPScope *scope = NULL) const; + virtual string get_fully_scoped_name() const; virtual void output(ostream &out, int indent_level, CPPScope *scope, bool complete) const; @@ -38,11 +46,9 @@ public: virtual SubType get_subtype() const; virtual CPPMakeSeq *as_make_seq(); - string _seq_name; - string _num_name; - string _element_name; + CPPIdentifier *_ident; + CPPFunctionGroup *_length_getter; + CPPFunctionGroup *_element_getter; }; #endif - - diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index ec2771ab06..e4e83c13e3 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -20,6 +20,11 @@ #include "cppIdentifier.h" #include "cppTemplateScope.h" #include "cppTemplateParameterList.h" +#include "cppConstType.h" +#include "cppFunctionGroup.h" +#include "cppFunctionType.h" +#include "cppPointerType.h" +#include "cppParameterList.h" #include "cppSimpleType.h" #include "cppGlobals.h" #include "cppCommentBlock.h" @@ -154,8 +159,10 @@ int CPPPreprocessor::InputFile:: get() { assert(_in != NULL); - _line_number = _next_line_number; - _col_number = _next_col_number; + if (!_lock_position) { + _line_number = _next_line_number; + _col_number = _next_col_number; + } int c = _in->get(); @@ -201,7 +208,7 @@ peek() { // shouldn't see any of these unless there was some DOS-to-Unix file // conversion problem. while (c == '\r') { - get(); + _in->get(); c = _in->peek(); } @@ -1872,10 +1879,11 @@ get_identifier(int c) { loc.last_line = get_line_number(); loc.last_column = get_col_number(); - if ((c == '\'' || c == '"') && name != "operator") { + if ((c == '\'' || c == '"') && + (name == "L" || name == "u8" || + name == "u" || name == "U")) { // This is actually a wide-character or wide-string literal or // some such. Figure out the correct character type to use. - // We had to add in an exception in order to support operator"". CPPExpression::Type type; if (name == "L") { @@ -1886,9 +1894,6 @@ get_identifier(int c) { type = CPPExpression::T_u16string; } else if (name == "U") { type = CPPExpression::T_u32string; - } else { - type = CPPExpression::T_string; - warning("unrecognized literal prefix " + name, loc); } get(); diff --git a/dtool/src/cppparser/cppScope.cxx b/dtool/src/cppparser/cppScope.cxx index 4118668ed4..fc221591c6 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -14,6 +14,7 @@ #include "cppScope.h" +#include "cppParser.h" #include "cppDeclaration.h" #include "cppNamespace.h" #include "cppTypedefType.h" diff --git a/dtool/src/cppparser/cppStructType.h b/dtool/src/cppparser/cppStructType.h index bbbbaa324a..66f9381964 100644 --- a/dtool/src/cppparser/cppStructType.h +++ b/dtool/src/cppparser/cppStructType.h @@ -17,7 +17,9 @@ #include "dtoolbase.h" +#include "cppIdentifier.h" #include "cppExtensionType.h" +#include "cppFunctionGroup.h" #include "cppVisibility.h" #include diff --git a/dtool/src/cppparser/cppToken.cxx b/dtool/src/cppparser/cppToken.cxx index 56b215ad22..5f247fef68 100644 --- a/dtool/src/cppparser/cppToken.cxx +++ b/dtool/src/cppparser/cppToken.cxx @@ -14,6 +14,7 @@ #include "cppToken.h" +#include "cppExpression.h" #include "cppIdentifier.h" #include "cppBison.h" diff --git a/dtool/src/dconfig/Sources.pp b/dtool/src/dconfig/Sources.pp deleted file mode 100644 index 7ffbeae592..0000000000 --- a/dtool/src/dconfig/Sources.pp +++ /dev/null @@ -1,43 +0,0 @@ -#define LOCAL_LIBS p3dtoolutil p3dtoolbase p3prc - -#begin lib_target - #define TARGET p3dconfig - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_dconfig.h \ - dconfig.I dconfig.h - - #define INCLUDED_SOURCES \ - config_dconfig.cxx dconfig.cxx - - #define INSTALL_HEADERS \ - config_dconfig.h \ - dconfig.I dconfig.h - -#end lib_target - -#begin test_bin_target - #define TARGET test_config - #define SOURCES test_config.cxx - #define LOCAL_LIBS p3dconfig $[LOCAL_LIBS] -#end test_bin_target - -#begin test_bin_target - #define TARGET test_expand - #define SOURCES test_expand.cxx - #define LOCAL_LIBS p3dconfig $[LOCAL_LIBS] -#end test_bin_target - -#begin test_bin_target - #define TARGET test_pfstream - #define SOURCES test_pfstream.cxx - #define LOCAL_LIBS p3dconfig $[LOCAL_LIBS] -#end test_bin_target - -#begin test_bin_target - #define TARGET test_searchpath - #define SOURCES test_searchpath.cxx - #define LOCAL_LIBS p3dconfig $[LOCAL_LIBS] -#end test_bin_target diff --git a/dtool/src/dtoolbase/Sources.pp b/dtool/src/dtoolbase/Sources.pp deleted file mode 100644 index c44e2d7de0..0000000000 --- a/dtool/src/dtoolbase/Sources.pp +++ /dev/null @@ -1,115 +0,0 @@ -#define SELECT_TAU select.tau -#define USE_PACKAGES threads - -#begin lib_target - #define TARGET p3dtoolbase - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - addHash.I addHash.h \ - atomicAdjust.h \ - atomicAdjustDummyImpl.h atomicAdjustDummyImpl.I \ - atomicAdjustGccImpl.h atomicAdjustGccImpl.I \ - atomicAdjustI386Impl.h atomicAdjustI386Impl.I \ - atomicAdjustPosixImpl.h atomicAdjustPosixImpl.I \ - atomicAdjustWin32Impl.h atomicAdjustWin32Impl.I \ - cmath.I cmath.h \ - deletedBufferChain.h deletedBufferChain.I \ - deletedChain.h deletedChain.T \ - dtoolbase.h dtoolbase_cc.h dtoolsymbols.h \ - dtool_platform.h \ - fakestringstream.h \ - indent.I indent.h indent.cxx \ - memoryBase.h \ - memoryHook.h memoryHook.I \ - mutexImpl.h \ - mutexDummyImpl.h mutexDummyImpl.I \ - mutexPosixImpl.h mutexPosixImpl.I \ - mutexWin32Impl.h mutexWin32Impl.I \ - mutexSpinlockImpl.h mutexSpinlockImpl.I \ - nearly_zero.h \ - neverFreeMemory.h neverFreeMemory.I \ - numeric_types.h \ - pdtoa.h pstrtod.h \ - register_type.I register_type.h \ - selectThreadImpl.h \ - stl_compares.I stl_compares.h \ - typeHandle.I typeHandle.h \ - typeRegistry.I typeRegistry.h \ - typeRegistryNode.I typeRegistryNode.h \ - typedObject.I typedObject.h \ - pallocator.T pallocator.h \ - pdeque.h plist.h pmap.h pset.h \ - pvector.h epvector.h \ - lookup3.h lookup3.c \ - dlmalloc_src.cxx ptmalloc2_smp_src.cxx - - #define INCLUDED_SOURCES \ - addHash.cxx \ - atomicAdjustDummyImpl.cxx \ - atomicAdjustGccImpl.cxx \ - atomicAdjustI386Impl.cxx \ - atomicAdjustPosixImpl.cxx \ - atomicAdjustWin32Impl.cxx \ - deletedBufferChain.cxx \ - dtoolbase.cxx \ - memoryBase.cxx \ - memoryHook.cxx \ - mutexDummyImpl.cxx \ - mutexPosixImpl.cxx \ - mutexWin32Impl.cxx \ - mutexSpinlockImpl.cxx \ - neverFreeMemory.cxx \ - pdtoa.cxx \ - pstrtod.cxx \ - register_type.cxx \ - typeHandle.cxx \ - typeRegistry.cxx typeRegistryNode.cxx \ - typedObject.cxx - - #define INSTALL_HEADERS \ - addHash.I addHash.h \ - atomicAdjust.h \ - atomicAdjustDummyImpl.h atomicAdjustDummyImpl.I \ - atomicAdjustGccImpl.h atomicAdjustGccImpl.I \ - atomicAdjustI386Impl.h atomicAdjustI386Impl.I \ - atomicAdjustPosixImpl.h atomicAdjustPosixImpl.I \ - atomicAdjustWin32Impl.h atomicAdjustWin32Impl.I \ - cmath.I cmath.h \ - deletedBufferChain.h deletedBufferChain.I \ - deletedChain.h deletedChain.T \ - dtoolbase.h dtoolbase_cc.h dtoolsymbols.h \ - dtool_platform.h \ - fakestringstream.h \ - indent.I indent.h \ - memoryBase.h \ - memoryHook.h memoryHook.I \ - mutexImpl.h \ - mutexDummyImpl.h mutexDummyImpl.I \ - mutexPosixImpl.h mutexPosixImpl.I \ - mutexWin32Impl.h mutexWin32Impl.I \ - mutexSpinlockImpl.h mutexSpinlockImpl.I \ - nearly_zero.h \ - neverFreeMemory.h neverFreeMemory.I \ - numeric_types.h \ - pdtoa.h pstrtod.h \ - register_type.I register_type.h \ - selectThreadImpl.h \ - stl_compares.I stl_compares.h \ - typeHandle.I typeHandle.h \ - typeRegistry.I typeRegistry.h \ - typeRegistryNode.I typeRegistryNode.h \ - typedObject.I typedObject.h \ - pallocator.T pallocator.h \ - pdeque.h plist.h pmap.h pset.h \ - pvector.h epvector.h \ - lookup3.h - -#end lib_target - -#begin test_bin_target - #define TARGET test_strtod - #define SOURCES test_strtod.cxx pstrtod.cxx pstrtod.h - -#end test_bin_target diff --git a/dtool/src/dtoolutil/Sources.pp b/dtool/src/dtoolutil/Sources.pp deleted file mode 100644 index a75ae352ae..0000000000 --- a/dtool/src/dtoolutil/Sources.pp +++ /dev/null @@ -1,96 +0,0 @@ -#begin lib_target - #define TARGET p3dtoolutil - #define LOCAL_LIBS p3dtoolbase - #if $[ne $[PLATFORM], FreeBSD] - #define UNIX_SYS_LIBS dl - #endif - #define WIN_SYS_LIBS shell32.lib - #define OSX_SYS_FRAMEWORKS Foundation $[if $[not $[BUILD_IPHONE]],AppKit] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - checkPandaVersion.h \ - config_dtoolutil.h \ - dSearchPath.I dSearchPath.h \ - executionEnvironment.I executionEnvironment.h filename.I \ - filename.h \ - $[if $[IS_OSX],filename_assist.mm filename_assist.h,] \ - globPattern.I globPattern.h \ - lineStream.I lineStream.h \ - lineStreamBuf.I lineStreamBuf.h \ - load_dso.h \ - pandaFileStream.h pandaFileStream.I \ - pandaFileStreamBuf.h \ - pandaSystem.h pandaVersion.h \ - panda_getopt.h panda_getopt_long.h panda_getopt_impl.h \ - pfstream.h pfstream.I pfstreamBuf.h \ - preprocess_argv.h \ - string_utils.h string_utils.I \ - stringDecoder.h stringDecoder.I \ - textEncoder.h textEncoder.I \ - unicodeLatinMap.h \ - vector_string.h \ - vector_src.h \ - win32ArgParser.h - - #define INCLUDED_SOURCES \ - checkPandaVersion.cxx \ - config_dtoolutil.cxx \ - dSearchPath.cxx \ - executionEnvironment.cxx filename.cxx \ - globPattern.cxx \ - lineStream.cxx lineStreamBuf.cxx \ - load_dso.cxx \ - pandaFileStream.cxx pandaFileStreamBuf.cxx \ - pandaSystem.cxx \ - panda_getopt_impl.cxx \ - pfstreamBuf.cxx pfstream.cxx \ - preprocess_argv.cxx \ - string_utils.cxx \ - stringDecoder.cxx \ - textEncoder.cxx \ - unicodeLatinMap.cxx \ - vector_string.cxx \ - win32ArgParser.cxx - - #define INSTALL_HEADERS \ - checkPandaVersion.h \ - config_dtoolutil.h \ - dSearchPath.I dSearchPath.h \ - executionEnvironment.I executionEnvironment.h filename.I \ - filename.h \ - globPattern.I globPattern.h \ - lineStream.I lineStream.h \ - lineStreamBuf.I lineStreamBuf.h \ - load_dso.h \ - pandaFileStream.h pandaFileStream.I \ - pandaFileStreamBuf.h \ - pandaSystem.h pandaVersion.h \ - panda_getopt.h panda_getopt_long.h panda_getopt_impl.h \ - pfstream.h pfstream.I pfstreamBuf.h \ - preprocess_argv.h \ - string_utils.h string_utils.I \ - stringDecoder.h stringDecoder.I \ - textEncoder.h textEncoder.I \ - unicodeLatinMap.h \ - vector_string.h \ - vector_src.cxx vector_src.h \ - win32ArgParser.h -#end lib_target - -#begin test_bin_target - #define TARGET test_pfstream - #define LOCAL_LIBS p3dtoolbase p3dtoolutil - - #define SOURCES test_pfstream.cxx -#end test_bin_target - -#begin test_bin_target - #define TARGET test_touch - #define LOCAL_LIBS p3dtoolbase p3dtoolutil - - #define SOURCES test_touch.cxx -#end test_bin_target - -#include $[THISDIRPREFIX]pandaVersion.h.pp diff --git a/dtool/src/dtoolutil/pandaVersion.h.pp b/dtool/src/dtoolutil/pandaVersion.h.pp deleted file mode 100644 index 679d1153d6..0000000000 --- a/dtool/src/dtoolutil/pandaVersion.h.pp +++ /dev/null @@ -1,158 +0,0 @@ -// -// pandaVersion.h.pp -// -// This file defines the script to auto-generate pandaVersion.h at -// ppremake time. -// - -#output pandaVersion.h notouch -/* Filename: pandaVersion.h - * Created by: drose (26Jan05) - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * 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." - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/******************************************************************* - * Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. - ***************************** DO NOT EDIT ************************* - - Do NOT attempt to edit the version number in this file. This is a - generated file, and your changes to this file will not persist. To - increment the version number, modify dtool/PandaVersion.pp and - re-run ppremake. - - ***************************** DO NOT EDIT *************************/ - -/* Include this file anywhere you need to determine the Panda version - number at compile time. If you need the runtime Panda version, use - pandaSystem.h instead. */ - -/* Try to avoid including this file from another .h file; include it - only from .cxx instead. This helps prevent unnecessarily long - rebuilds just because the version number changes; if this file is - included in a .h file, then any other files which also include that - .h file will need to be rebuilt when the version number changes. */ - -$[cdefine PANDA_MAJOR_VERSION] -$[cdefine PANDA_MINOR_VERSION] -$[cdefine PANDA_SEQUENCE_VERSION] - -/* Define if this is an "official" version, undefine otherwise. */ -$[cdefine PANDA_OFFICIAL_VERSION] - -/* This is the panda numeric version as a single number, with three - digits reserved for each component. */ -$[cdefine PANDA_NUMERIC_VERSION] - -/* This is the panda version expressed as a string. It ends in the - letter "c" if this is not an "official" version (e.g. it was checked - out from CVS by the builder). */ -# define PANDA_VERSION_STR "$[PANDA_VERSION_STR]" - -/* This is the version of the Panda3D ABI expressed as a string. - This usually means the major and minor version. It should be the - same for Panda3D versions that are supposed to be backward - ABI compatible with each other. */ -# define PANDA_ABI_VERSION_STR "$[PANDA_MAJOR_VERSION].$[PANDA_MINOR_VERSION]" - -/* This is a string indicating who has provided this distribution. */ -# define PANDA_DISTRIBUTOR "$[PANDA_DISTRIBUTOR]" - -/* The string indicating the version number of the associated Panda3D - distributable package, or empty string if there is no associated - package. */ -# define PANDA_PACKAGE_VERSION_STR "$[PANDA_PACKAGE_VERSION]" - -/* The string indicating the URL from which the associated Panda3D - distributable package may be downloaded, or empty string if there - is no associated package. */ -# define PANDA_PACKAGE_HOST_URL "$[PANDA_PACKAGE_HOST_URL]" - -#if HAVE_P3D_PLUGIN -/* Similar definitions for the plugin versioning, if in use. */ -$[cdefine P3D_PLUGIN_MAJOR_VERSION] -$[cdefine P3D_PLUGIN_MINOR_VERSION] -$[cdefine P3D_PLUGIN_SEQUENCE_VERSION] -# define P3D_COREAPI_VERSION_STR "$[join .,$[P3D_COREAPI_VERSION]]" -#endif - -#end pandaVersion.h - - -// Let's also define checkPandaVersion.h and checkPandaVersion.cxx here. - -#output checkPandaVersion.h notouch -/* Filename: checkPandaVersion.h - * Created by: drose (26Jan05) - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * 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." - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/******************************************************************* - * Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. - ***************************** DO NOT EDIT *************************/ - -/* Include this file in code that compiles with Panda to guarantee - that it is linking with the same version of the Panda DLL's that it - was compiled with. You should include it in one .cxx file only. */ - -/* We guarantee this by defining an external symbol which is based on - the version number. If that symbol is defined, then our DLL's - (probably) match. Otherwise, we must be running with the wrong - DLL; but the system linker will prevent the DLL from loading with - an undefined symbol. */ - -# include "dtoolbase.h" - -extern EXPCL_DTOOL int $[PANDA_VERSION_SYMBOL]; - -# ifndef WIN32 -/* For Windows, exporting the symbol from the DLL is sufficient; the - DLL will not load unless all expected public symbols are defined. - Other systems may not mind if the symbol is absent unless we - explictly write code that references it. */ -static int check_panda_version = $[PANDA_VERSION_SYMBOL]; -# endif - -#end checkPandaVersion.h - -#output checkPandaVersion.cxx notouch -/* Filename: checkPandaVersion.cxx - * Created by: drose (26Jan05) - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * 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." - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/******************************************************************* - * Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. - ***************************** DO NOT EDIT *************************/ - -# include "dtoolbase.h" - -EXPCL_DTOOL int $[PANDA_VERSION_SYMBOL] = 0; - -#end checkPandaVersion.cxx diff --git a/dtool/src/dtoolutil/unicodeLatinMap.cxx b/dtool/src/dtoolutil/unicodeLatinMap.cxx index b7348ff4e9..f68fd13f3c 100644 --- a/dtool/src/dtoolutil/unicodeLatinMap.cxx +++ b/dtool/src/dtoolutil/unicodeLatinMap.cxx @@ -369,6 +369,8 @@ static const UnicodeLatinMap::Entry latin_map[] = { UnicodeLatinMap::AT_none, UnicodeLatinMap::AF_reversed }, { 0x0258, UnicodeLatinMap::CT_lower, 'e', 0, 0x0258, 0x018e, UnicodeLatinMap::AT_none, UnicodeLatinMap::AF_reversed }, + { 0x0259, UnicodeLatinMap::CT_lower, 'e', 0, 0x0259, 0x018f, + UnicodeLatinMap::AT_none, UnicodeLatinMap::AF_turned }, { 0x0066, UnicodeLatinMap::CT_lower, 'f', 0, 0x0066, 0x0046, UnicodeLatinMap::AT_none, 0 }, { 0x0046, UnicodeLatinMap::CT_upper, 'F', 0, 0x0066, 0x0046, @@ -465,7 +467,9 @@ static const UnicodeLatinMap::Entry latin_map[] = { UnicodeLatinMap::AT_line_below, 0 }, { 0x029c, UnicodeLatinMap::CT_upper, 'H', 0, 0x0068, 0x029c, UnicodeLatinMap::AT_none, UnicodeLatinMap::AF_smallcap }, - { 0x0195, UnicodeLatinMap::CT_lower, 'h', 'v', 0x0195, 0x195, + { 0x0195, UnicodeLatinMap::CT_lower, 'h', 'v', 0x0195, 0x01f6, + UnicodeLatinMap::AT_none, UnicodeLatinMap::AF_ligature }, + { 0x01f6, UnicodeLatinMap::CT_upper, 'H', 'v', 0x0195, 0x01f6, UnicodeLatinMap::AT_none, UnicodeLatinMap::AF_ligature }, { 0x0127, UnicodeLatinMap::CT_lower, 'h', 0, 0x0127, 0x0126, UnicodeLatinMap::AT_stroke, 0 }, diff --git a/dtool/src/interrogate/Sources.pp b/dtool/src/interrogate/Sources.pp deleted file mode 100644 index 667f344fd5..0000000000 --- a/dtool/src/interrogate/Sources.pp +++ /dev/null @@ -1,67 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_INTERROGATE] - -#define LOCAL_LIBS p3cppParser p3interrogatedb p3dconfig p3dtoolutil p3dtoolbase p3pystub -#define USE_PACKAGES openssl - -#begin bin_target - #define TARGET interrogate - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - #define SOURCES \ - functionRemap.h \ - functionWriter.h \ - functionWriterPtrFromPython.h functionWriterPtrToPython.h \ - functionWriters.h \ - interfaceMaker.h \ - interfaceMakerC.h \ - interfaceMakerPython.h interfaceMakerPythonObj.h \ - interfaceMakerPythonSimple.h \ - interfaceMakerPythonNative.h \ - interrogate.h interrogateBuilder.h parameterRemap.I \ - parameterRemap.h \ - parameterRemapBasicStringPtrToString.h \ - parameterRemapBasicStringRefToString.h \ - parameterRemapBasicStringToString.h \ - parameterRemapCharStarToString.h \ - parameterRemapConcreteToPointer.h \ - parameterRemapConstToNonConst.h parameterRemapEnumToInt.h \ - parameterRemapPTToPointer.h \ - parameterRemapReferenceToConcrete.h \ - parameterRemapReferenceToPointer.h parameterRemapThis.h \ - parameterRemapToString.h parameterRemapUnchanged.h \ - typeManager.h - -#define INCLUDED_SOURCES \ - functionRemap.cxx \ - functionWriter.cxx \ - functionWriterPtrFromPython.cxx functionWriterPtrToPython.cxx \ - functionWriters.cxx \ - interfaceMaker.cxx \ - interfaceMakerC.cxx \ - interfaceMakerPython.cxx interfaceMakerPythonObj.cxx \ - interfaceMakerPythonSimple.cxx \ - interfaceMakerPythonNative.cxx \ - interrogate.cxx interrogateBuilder.cxx parameterRemap.cxx \ - parameterRemapBasicStringPtrToString.cxx \ - parameterRemapBasicStringRefToString.cxx \ - parameterRemapBasicStringToString.cxx \ - parameterRemapCharStarToString.cxx \ - parameterRemapConcreteToPointer.cxx \ - parameterRemapConstToNonConst.cxx \ - parameterRemapEnumToInt.cxx parameterRemapPTToPointer.cxx \ - parameterRemapReferenceToConcrete.cxx \ - parameterRemapReferenceToPointer.cxx parameterRemapThis.cxx \ - parameterRemapToString.cxx parameterRemapUnchanged.cxx \ - typeManager.cxx - -#end bin_target - -#begin bin_target - #define TARGET parse_file - #define SOURCES parse_file.cxx -#end bin_target - -#begin bin_target - #define TARGET interrogate_module - #define SOURCES interrogate_module.cxx -#end bin_target diff --git a/dtool/src/interrogate/interfaceMaker.cxx b/dtool/src/interrogate/interfaceMaker.cxx index a9ef73f7dc..5800a68198 100644 --- a/dtool/src/interrogate/interfaceMaker.cxx +++ b/dtool/src/interrogate/interfaceMaker.cxx @@ -79,11 +79,11 @@ InterfaceMaker::Function:: // Description: //////////////////////////////////////////////////////////////////// InterfaceMaker::MakeSeq:: -MakeSeq(const string &name, CPPMakeSeq *cpp_make_seq) : +MakeSeq(const string &name, const InterrogateMakeSeq &imake_seq) : _name(name), - _seq_name(cpp_make_seq->_seq_name), - _num_name(cpp_make_seq->_num_name), - _element_name(cpp_make_seq->_element_name) + _imake_seq(imake_seq), + _length_getter(NULL), + _element_getter(NULL) { } @@ -174,30 +174,6 @@ check_protocols() { if (flags & FunctionRemap::F_iter) { _protocol_types |= PT_iter; } - - // Now are there any make_seq requests within this class? - if (_itype._cpptype != NULL) { - CPPStructType *stype = _itype._cpptype->as_struct_type(); - if (stype != (CPPStructType *)NULL) { - CPPScope *scope = stype->get_scope(); - if (scope != (CPPScope *)NULL) { - CPPScope::Declarations::iterator di; - for (di = scope->_declarations.begin(); di != scope->_declarations.end(); ++di) { - CPPMakeSeq *cpp_make_seq = (*di)->as_make_seq(); - if (cpp_make_seq != (CPPMakeSeq *)NULL) { - string class_name = _itype.get_scoped_name(); - string clean_name = InterrogateBuilder::clean_identifier(class_name); - string wrapper_name = "MakeSeq_" + clean_name + "_" + cpp_make_seq->_seq_name; - MakeSeq *make_seq = new MakeSeq(wrapper_name, cpp_make_seq); - _make_seqs.push_back(make_seq); - - // Also add to the interrogate database. - builder.get_make_seq(cpp_make_seq, stype); - } - } - } - } - } } //////////////////////////////////////////////////////////////////// @@ -637,6 +613,8 @@ get_unique_prefix() { //////////////////////////////////////////////////////////////////// InterfaceMaker::Function *InterfaceMaker:: record_function(const InterrogateType &itype, FunctionIndex func_index) { + assert(func_index != 0); + if (_functions.count(func_index)) { // Already exists. return _functions[func_index]; diff --git a/dtool/src/interrogate/interfaceMaker.h b/dtool/src/interrogate/interfaceMaker.h index 71a1f0eb6d..61a18786c0 100644 --- a/dtool/src/interrogate/interfaceMaker.h +++ b/dtool/src/interrogate/interfaceMaker.h @@ -33,6 +33,7 @@ class CPPInstance; class InterrogateBuilder; class InterrogateElement; class InterrogateFunction; +class InterrogateMakeSeq; class InterrogateType; //////////////////////////////////////////////////////////////////// @@ -116,12 +117,12 @@ public: class MakeSeq { public: - MakeSeq(const string &name, CPPMakeSeq *cpp_make_seq); + MakeSeq(const string &name, const InterrogateMakeSeq &imake_seq); + const InterrogateMakeSeq &_imake_seq; string _name; - string _seq_name; - string _num_name; - string _element_name; + Function *_length_getter; + Function *_element_getter; }; typedef vector MakeSeqs; diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 9c06abeaed..fb6a5a6a70 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -1099,7 +1099,17 @@ write_class_details(ostream &out, Object *obj) { // Write make seqs: generated methods that return a sequence of items. MakeSeqs::iterator msi; for (msi = obj->_make_seqs.begin(); msi != obj->_make_seqs.end(); ++msi) { - write_make_seq(out, obj, ClassName, cClassName, *msi); + if (is_function_legal((*msi)->_length_getter) && + is_function_legal((*msi)->_element_getter)) { + write_make_seq(out, obj, ClassName, cClassName, *msi); + } else { + if (!is_function_legal((*msi)->_length_getter)) { + cerr << "illegal length function for MAKE_SEQ: " << (*msi)->_length_getter->_name << "\n"; + } + if (!is_function_legal((*msi)->_element_getter)) { + cerr << "illegal element function for MAKE_SEQ: " << (*msi)->_element_getter->_name << "\n"; + } + } } // Determine which external imports we will need. @@ -1711,23 +1721,27 @@ write_module_class(ostream &out, Object *obj) { MakeSeqs::iterator msi; for (msi = obj->_make_seqs.begin(); msi != obj->_make_seqs.end(); ++msi) { - const string &seq_name = (*msi)->_seq_name; + MakeSeq *make_seq = (*msi); + if (!is_function_legal(make_seq->_length_getter) || + !is_function_legal(make_seq->_element_getter)) { + continue; + } - if ((seq_name.size() > 4 && seq_name.substr(0, 4) == "get_") || - (seq_name.size() > 7 && seq_name.substr(0, 7) == "modify_")) { + string seq_name = make_seq->_imake_seq.get_name(); - string flags = "METH_NOARGS"; - if (obj->is_static_method((*msi)->_element_name)) { - flags += " | METH_CLASS"; - } - string name1 = methodNameFromCppName((*msi)->_seq_name, export_class_name, false); - string name2 = methodNameFromCppName((*msi)->_seq_name, export_class_name, true); - out << " {\"" << name1 - << "\", (PyCFunction) &" << (*msi)->_name << ", " << flags << ", NULL},\n"; - if (name1 != name2) { - out << " { \"" << name2 - << "\", (PyCFunction) &" << (*msi)->_name << ", " << flags << ", NULL},\n"; - } + string flags = "METH_NOARGS"; + if (!make_seq->_length_getter->_has_this && + !make_seq->_element_getter->_has_this) { + flags += " | METH_STATIC"; + } + + string name1 = methodNameFromCppName(seq_name, export_class_name, false); + string name2 = methodNameFromCppName(seq_name, export_class_name, true); + out << " {\"" << name1 + << "\", (PyCFunction) &" << make_seq->_name << ", " << flags << ", NULL},\n"; + if (name1 != name2) { + out << " { \"" << name2 + << "\", (PyCFunction) &" << make_seq->_name << ", " << flags << ", NULL},\n"; } } @@ -6335,47 +6349,88 @@ pack_return_value(ostream &out, int indent_level, FunctionRemap *remap, void InterfaceMakerPythonNative:: write_make_seq(ostream &out, Object *obj, const std::string &ClassName, const std::string &cClassName, MakeSeq *make_seq) { + out << "/******************************************************************\n" << " * Python make_seq wrapper\n"; out << " *******************************************************************/\n"; out << "static PyObject *" << make_seq->_name + "(PyObject *self, PyObject *) {\n"; - string element_name = methodNameFromCppName(make_seq->_element_name, ClassName, false); - // This used to be a list. But it should really be a tuple, I think, - // because it probably makes more sense for it to be immutable (as - // changes to it won't be visible on the C++ side anyway). + // This used to return a list. But it should really be a tuple, I + // think, because it probably makes more sense for it to be immutable + // (as changes to it won't be visible on the C++ side anyway). - out << " " << cClassName << " *local_this = NULL;\n" - << " if (!Dtool_Call_ExtractThisPointer(self, Dtool_" << ClassName << ", (void **)&local_this)) {\n" - << " return NULL;\n" - << " }\n" - << "\n" - << " PyObject *getter = PyDict_GetItemString(Dtool_" << ClassName << "._PyType.tp_dict, \"" << element_name << "\");\n" - << " if (getter == (PyObject *)NULL) {\n" - << " return Dtool_Raise_AttributeError(self, \"" << element_name << "\");\n" - << " }\n" - << "\n" - << " Py_ssize_t count = (Py_ssize_t)local_this->" << make_seq->_num_name << "();\n" - << " PyObject *tuple = PyTuple_New(count);\n" - << "\n" - << " for (Py_ssize_t i = 0; i < count; ++i) {\n" - << "#if PY_MAJOR_VERSION >= 3\n" - << " PyObject *index = PyLong_FromSsize_t(i);\n" - << "#else\n" - << " PyObject *index = PyInt_FromSsize_t(i);\n" - << "#endif\n" - << " PyObject *value = PyObject_CallFunctionObjArgs(getter, self, index, NULL);\n" - << " PyTuple_SET_ITEM(tuple, i, value);\n" - << " Py_DECREF(index);\n" - << " }\n" - << "\n" - << " if (Dtool_CheckErrorOccurred()) {\n" - << " Py_DECREF(tuple);\n" - << " return NULL;\n" - << " }\n" - << " return tuple;\n" - << "}\n" - << "\n"; + FunctionRemap *remap = make_seq->_length_getter->_remaps.front(); + vector_string pexprs; + + if (make_seq->_length_getter->_has_this) { + out << + " " << cClassName << " *local_this = NULL;\n" + " if (!Dtool_Call_ExtractThisPointer(self, Dtool_" << ClassName << ", (void **)&local_this)) {\n" + " return NULL;\n" + " }\n" + " Py_ssize_t count = (Py_ssize_t)" << remap->get_call_str("local_this", pexprs) << ";\n"; + } else { + out << " Py_ssize_t count = (Py_ssize_t)" << remap->get_call_str("", pexprs) << ";\n"; + } + + Function *elem_getter = make_seq->_element_getter; + + if ((elem_getter->_args_type & AT_varargs) == AT_varargs) { + // Fast way to create a temporary tuple to hold only a single item, under + // the assumption that the called method doesn't do anything with this tuple + // other than unpack it (which is a fairly safe assumption to make). + out << " PyTupleObject args;\n"; + out << " PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n"; + } + + out << + " PyObject *tuple = PyTuple_New(count);\n" + "\n" + " for (Py_ssize_t i = 0; i < count; ++i) {\n" + "#if PY_MAJOR_VERSION >= 3\n" + " PyObject *index = PyLong_FromSsize_t(i);\n" + "#else\n" + " PyObject *index = PyInt_FromSsize_t(i);\n" + "#endif\n"; + + switch (elem_getter->_args_type) { + case AT_keyword_args: + out << " PyTuple_SET_ITEM(&args, 0, index);\n" + " PyObject *value = " << elem_getter->_name << "(self, (PyObject *)&args, NULL);\n"; + break; + + case AT_varargs: + out << " PyTuple_SET_ITEM(&args, 0, index);\n" + " PyObject *value = " << elem_getter->_name << "(self, (PyObject *)&args);\n"; + break; + + case AT_single_arg: + out << " PyObject *value = " << elem_getter->_name << "(self, index);\n"; + break; + + default: + out << " PyObject *value = " << elem_getter->_name << "(self, NULL);\n"; + break; + } + + out << + " PyTuple_SET_ITEM(tuple, i, value);\n" + " Py_DECREF(index);\n" + " }\n" + "\n"; + + if ((elem_getter->_args_type & AT_varargs) == AT_varargs) { + out << " _Py_ForgetReference((PyObject *)&args);\n"; + } + + out << + " if (Dtool_CheckErrorOccurred()) {\n" + " Py_DECREF(tuple);\n" + " return NULL;\n" + " }\n" + " return tuple;\n" + "}\n" + "\n"; } //////////////////////////////////////////////////////////////////// @@ -6494,6 +6549,21 @@ record_object(TypeIndex type_index) { } } + int num_make_seqs = itype.number_of_make_seqs(); + for (int msi = 0; msi < num_make_seqs; msi++) { + MakeSeqIndex make_seq_index = itype.get_make_seq(msi); + const InterrogateMakeSeq &imake_seq = idb->get_make_seq(make_seq_index); + + string class_name = itype.get_scoped_name(); + string clean_name = InterrogateBuilder::clean_identifier(class_name); + string wrapper_name = "MakeSeq_" + clean_name + "_" + imake_seq.get_name(); + + MakeSeq *make_seq = new MakeSeq(wrapper_name, imake_seq); + make_seq->_length_getter = record_function(itype, imake_seq.get_length_getter()); + make_seq->_element_getter = record_function(itype, imake_seq.get_element_getter()); + object->_make_seqs.push_back(make_seq); + } + object->check_protocols(); int num_nested = itype.number_of_nested_types(); diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index d164b80fc7..1017a52628 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1998,7 +1998,7 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type) { //////////////////////////////////////////////////////////////////// MakeSeqIndex InterrogateBuilder:: get_make_seq(CPPMakeSeq *make_seq, CPPStructType *struct_type) { - string make_seq_name = struct_type->get_local_name(&parser) + "::MakeSeq_" + make_seq->_seq_name; + string make_seq_name = make_seq->get_local_name(&parser); // First, check to see if it's already there. MakeSeqsByName::const_iterator tni = @@ -2008,22 +2008,80 @@ get_make_seq(CPPMakeSeq *make_seq, CPPStructType *struct_type) { return index; } + FunctionIndex length_getter = 0; + FunctionIndex element_getter = 0; + + CPPFunctionGroup::Instances::const_iterator fi; + CPPFunctionGroup *fgroup = make_seq->_length_getter; + if (fgroup != NULL) { + for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) { + CPPInstance *function = (*fi); + CPPFunctionType *ftype = + function->_type->as_function_type(); + if (ftype != NULL) { + length_getter = get_function(function, "", struct_type, + struct_type->get_scope(), 0); + if (length_getter != 0) { + break; + } + } + } + if (length_getter == 0) { + cerr << "No instance of length method '" + << fgroup->_name << "' is suitable!\n"; + return 0; + } + } else { + cerr << "MAKE_SEQ " << make_seq_name << " requires a length method.\n"; + return 0; + } + + fgroup = make_seq->_element_getter; + if (fgroup != NULL) { + for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) { + CPPInstance *function = (*fi); + CPPFunctionType *ftype = + function->_type->as_function_type(); + if (ftype != NULL && ftype->_parameters->_parameters.size() >= 1 && + TypeManager::is_integer(ftype->_parameters->_parameters[0]->_type)) { + // It really doesn't matter whether we grab the const or non-const + // version, since they should all return the same function anyway. + element_getter = get_function(function, "", struct_type, + struct_type->get_scope(), 0); + if (element_getter != 0) { + break; + } + } + } + if (element_getter == 0) { + cerr << "No instance of element method '" + << fgroup->_name << "' is suitable!\n"; + return 0; + } + } else { + cerr << "MAKE_SEQ " << make_seq_name << " requires an element method.\n"; + return 0; + } + InterrogateDatabase *idb = InterrogateDatabase::get_ptr(); // It isn't here, so we'll have to define it. MakeSeqIndex index = idb->get_next_index(); _make_seqs_by_name[make_seq_name] = index; InterrogateMakeSeq imake_seq; - imake_seq._class = get_type(struct_type, false); - imake_seq._seq_name = make_seq->_seq_name; - imake_seq._num_name = make_seq->_num_name; - imake_seq._element_name = make_seq->_element_name; + imake_seq._name = make_seq->get_simple_name(); + imake_seq._scoped_name = descope(make_seq->get_local_name(&parser)); + + imake_seq._length_getter = length_getter; + imake_seq._element_getter = element_getter; + + // See if there happens to be a comment before the MAKE_SEQ macro. + if (make_seq->_leading_comment != (CPPCommentBlock *)NULL) { + imake_seq._comment = trim_blanks(make_seq->_leading_comment->_comment); + } idb->add_make_seq(index, imake_seq); - InterrogateType &itype = idb->update_type(imake_seq._class); - itype._make_seqs.push_back(index); - return index; } @@ -2553,6 +2611,10 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, } else if ((*di)->get_subtype() == CPPDeclaration::ST_make_property) { ElementIndex element_index = get_make_property((*di)->as_make_property(), cpptype); itype._elements.push_back(element_index); + + } else if ((*di)->get_subtype() == CPPDeclaration::ST_make_seq) { + MakeSeqIndex make_seq_index = get_make_seq((*di)->as_make_seq(), cpptype); + itype._make_seqs.push_back(make_seq_index); } } diff --git a/dtool/src/interrogatedb/Sources.pp b/dtool/src/interrogatedb/Sources.pp deleted file mode 100644 index 56074a83f9..0000000000 --- a/dtool/src/interrogatedb/Sources.pp +++ /dev/null @@ -1,43 +0,0 @@ -#define LOCAL_LIBS p3dconfig p3dtoolutil p3dtoolbase - -#begin lib_target - #define TARGET p3interrogatedb - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_interrogatedb.h indexRemapper.h interrogateComponent.I \ - interrogateComponent.h interrogateDatabase.I \ - interrogateDatabase.h interrogateElement.I \ - interrogateElement.h interrogateFunction.I \ - interrogateFunction.h interrogateFunctionWrapper.I \ - interrogateFunctionWrapper.h \ - interrogateMakeSeq.I interrogateMakeSeq.h \ - interrogateManifest.I interrogateManifest.h \ - interrogateType.I interrogateType.h \ - interrogate_datafile.I interrogate_datafile.h \ - interrogate_interface.h interrogate_request.h \ - extension.h py_panda.h \ - vector_int.h - - #define INCLUDED_SOURCES \ - config_interrogatedb.cxx \ - dtool_super_base.cxx \ - indexRemapper.cxx \ - interrogateComponent.cxx interrogateDatabase.cxx \ - interrogateElement.cxx interrogateFunction.cxx \ - interrogateFunctionWrapper.cxx \ - interrogateMakeSeq.cxx \ - interrogateManifest.cxx \ - interrogateType.cxx interrogate_datafile.cxx \ - interrogate_interface.cxx interrogate_request.cxx \ - py_panda.cxx \ - vector_int.cxx - - #define INSTALL_HEADERS \ - interrogate_interface.h interrogate_request.h vector_int.h \ - config_interrogatedb.h \ - extension.h py_panda.h \ - vector_int.h - -#end lib_target diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx index c800b81ed3..77d14d30ac 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ b/dtool/src/interrogatedb/interrogateDatabase.cxx @@ -20,8 +20,8 @@ InterrogateDatabase *InterrogateDatabase::_global_ptr = NULL; int InterrogateDatabase::_file_major_version = 0; int InterrogateDatabase::_file_minor_version = 0; -int InterrogateDatabase::_current_major_version = 2; -int InterrogateDatabase::_current_minor_version = 3; +int InterrogateDatabase::_current_major_version = 3; +int InterrogateDatabase::_current_minor_version = 0; //////////////////////////////////////////////////////////////////// // Function: InterrogateDatabase::Constructor diff --git a/dtool/src/interrogatedb/interrogateElement.cxx b/dtool/src/interrogatedb/interrogateElement.cxx index 8dff1f4251..81530cfae6 100644 --- a/dtool/src/interrogatedb/interrogateElement.cxx +++ b/dtool/src/interrogatedb/interrogateElement.cxx @@ -45,10 +45,7 @@ input(istream &in) { InterrogateComponent::input(in); in >> _flags >> _type >> _getter >> _setter; idf_input_string(in, _scoped_name); - - if (InterrogateDatabase::get_file_minor_version() >= 3) { - idf_input_string(in, _comment); - } + idf_input_string(in, _comment); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/interrogateFunction.cxx b/dtool/src/interrogatedb/interrogateFunction.cxx index 34833ac80e..62af522401 100644 --- a/dtool/src/interrogatedb/interrogateFunction.cxx +++ b/dtool/src/interrogatedb/interrogateFunction.cxx @@ -93,10 +93,7 @@ input(istream &in) { idf_input_vector(in, _c_wrappers); idf_input_vector(in, _python_wrappers); idf_input_string(in, _comment); - - if (InterrogateDatabase::get_file_minor_version() >= 2) { - idf_input_string(in, _prototype); - } + idf_input_string(in, _prototype); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.I b/dtool/src/interrogatedb/interrogateMakeSeq.I index 5469e55cc8..b26b7fa864 100644 --- a/dtool/src/interrogatedb/interrogateMakeSeq.I +++ b/dtool/src/interrogatedb/interrogateMakeSeq.I @@ -23,7 +23,8 @@ INLINE InterrogateMakeSeq:: InterrogateMakeSeq(InterrogateModuleDef *def) : InterrogateComponent(def) { - _class = 0; + _length_getter = 0; + _element_getter = 0; } //////////////////////////////////////////////////////////////////// @@ -44,52 +45,71 @@ InterrogateMakeSeq(const InterrogateMakeSeq ©) { INLINE void InterrogateMakeSeq:: operator = (const InterrogateMakeSeq ©) { InterrogateComponent::operator = (copy); - _class = copy._class; - _seq_name = copy._seq_name; - _num_name = copy._num_name; - _element_name = copy._element_name; + _scoped_name = copy._scoped_name; + _comment = copy._comment; + _length_getter = copy._length_getter; + _element_getter = copy._element_getter; } //////////////////////////////////////////////////////////////////// -// Function: InterrogateMakeSeq::get_class +// Function: InterrogateMakeSeq::has_scoped_name // Access: Public -// Description: Return the class that owns the make_seq. +// Description: //////////////////////////////////////////////////////////////////// -INLINE TypeIndex InterrogateMakeSeq:: -get_class() const { - return _class; +INLINE bool InterrogateMakeSeq:: +has_scoped_name() const { + return !_scoped_name.empty(); } //////////////////////////////////////////////////////////////////// -// Function: InterrogateMakeSeq::get_seq_name +// Function: InterrogateMakeSeq::get_scoped_name // Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE const string &InterrogateMakeSeq:: -get_seq_name() const { - return _seq_name; +get_scoped_name() const { + return _scoped_name; } //////////////////////////////////////////////////////////////////// -// Function: InterrogateMakeSeq::get_num_name +// Function: InterrogateMakeSeq::has_comment +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE bool InterrogateMakeSeq:: +has_comment() const { + return !_comment.empty(); +} + +//////////////////////////////////////////////////////////////////// +// Function: InterrogateMakeSeq::get_comment // Access: Public // Description: //////////////////////////////////////////////////////////////////// INLINE const string &InterrogateMakeSeq:: -get_num_name() const { - return _num_name; +get_comment() const { + return _comment; } //////////////////////////////////////////////////////////////////// -// Function: InterrogateMakeSeq::get_element_name +// Element: InterrogateMakeSeq::get_length_getter // Access: Public // Description: //////////////////////////////////////////////////////////////////// -INLINE const string &InterrogateMakeSeq:: -get_element_name() const { - return _element_name; +INLINE FunctionIndex InterrogateMakeSeq:: +get_length_getter() const { + return _length_getter; } +//////////////////////////////////////////////////////////////////// +// Element: InterrogateMakeSeq::get_element_getter +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE FunctionIndex InterrogateMakeSeq:: +get_element_getter() const { + return _element_getter; +} INLINE ostream & operator << (ostream &out, const InterrogateMakeSeq &make_seq) { diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.cxx b/dtool/src/interrogatedb/interrogateMakeSeq.cxx index a8a1822681..99dec723ca 100644 --- a/dtool/src/interrogatedb/interrogateMakeSeq.cxx +++ b/dtool/src/interrogatedb/interrogateMakeSeq.cxx @@ -25,10 +25,10 @@ void InterrogateMakeSeq:: output(ostream &out) const { InterrogateComponent::output(out); - out << _class << " "; - idf_output_string(out, _seq_name); - idf_output_string(out, _num_name); - idf_output_string(out, _element_name); + out << _length_getter << " " + << _element_getter << " "; + idf_output_string(out, _scoped_name); + idf_output_string(out, _comment, '\n'); } //////////////////////////////////////////////////////////////////// @@ -40,10 +40,10 @@ output(ostream &out) const { void InterrogateMakeSeq:: input(istream &in) { InterrogateComponent::input(in); - in >> _class; - idf_input_string(in, _seq_name); - idf_input_string(in, _num_name); - idf_input_string(in, _element_name); + + in >> _length_getter >> _element_getter; + idf_input_string(in, _scoped_name); + idf_input_string(in, _comment); } //////////////////////////////////////////////////////////////////// @@ -55,4 +55,6 @@ input(istream &in) { //////////////////////////////////////////////////////////////////// void InterrogateMakeSeq:: remap_indices(const IndexRemapper &remap) { + _length_getter = remap.map_from(_length_getter); + _element_getter = remap.map_from(_element_getter); } diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.h b/dtool/src/interrogatedb/interrogateMakeSeq.h index bd991f71ca..f6c3f4985b 100644 --- a/dtool/src/interrogatedb/interrogateMakeSeq.h +++ b/dtool/src/interrogatedb/interrogateMakeSeq.h @@ -32,10 +32,14 @@ public: INLINE InterrogateMakeSeq(const InterrogateMakeSeq ©); INLINE void operator = (const InterrogateMakeSeq ©); - INLINE TypeIndex get_class() const; - INLINE const string &get_seq_name() const; - INLINE const string &get_num_name() const; - INLINE const string &get_element_name() const; + INLINE bool has_scoped_name() const; + INLINE const string &get_scoped_name() const; + + INLINE bool has_comment() const; + INLINE const string &get_comment() const; + + INLINE FunctionIndex get_length_getter() const; + INLINE FunctionIndex get_element_getter() const; void output(ostream &out) const; void input(istream &in); @@ -43,10 +47,10 @@ public: void remap_indices(const IndexRemapper &remap); private: - TypeIndex _class; - string _seq_name; - string _num_name; - string _element_name; + string _scoped_name; + string _comment; + FunctionIndex _length_getter; + FunctionIndex _element_getter; friend class InterrogateBuilder; }; diff --git a/dtool/src/interrogatedb/interrogateType.cxx b/dtool/src/interrogatedb/interrogateType.cxx index d0ce756fa4..57618c6734 100644 --- a/dtool/src/interrogatedb/interrogateType.cxx +++ b/dtool/src/interrogatedb/interrogateType.cxx @@ -91,9 +91,7 @@ void InterrogateType::EnumValue:: input(istream &in) { idf_input_string(in, _name); idf_input_string(in, _scoped_name); - if (InterrogateDatabase::get_file_minor_version() >= 3) { - idf_input_string(in, _comment); - } + idf_input_string(in, _comment); in >> _value; } diff --git a/dtool/src/interrogatedb/interrogate_interface.cxx b/dtool/src/interrogatedb/interrogate_interface.cxx index 8254918a64..2c4634c9b3 100644 --- a/dtool/src/interrogatedb/interrogate_interface.cxx +++ b/dtool/src/interrogatedb/interrogate_interface.cxx @@ -414,34 +414,47 @@ interrogate_get_wrapper_by_unique_name(const char *unique_name) { return InterrogateDatabase::get_ptr()->get_wrapper_by_unique_name(unique_name); } -TypeIndex -interrogate_make_seq_class(MakeSeqIndex make_seq) { - //cerr << "interrogate_make_seq_class(" << make_seq << ")\n"; - return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_class(); -} - const char * interrogate_make_seq_seq_name(MakeSeqIndex make_seq) { //cerr << "interrogate_make_seq_seq_name(" << make_seq << ")\n"; static string result; - result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_seq_name(); + result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_name(); return result.c_str(); } +const char * +interrogate_make_seq_scoped_name(MakeSeqIndex make_seq) { + //cerr << "interrogate_make_seq_seq_name(" << make_seq << ")\n"; + static string result; + result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_scoped_name(); + return result.c_str(); +} + +bool +interrogate_make_seq_has_comment(MakeSeqIndex make_seq) { + //cerr << "interrogate_make_seq_has_comment(" << make_seq << ")\n"; + return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).has_comment(); +} + +const char * +interrogate_make_seq_comment(MakeSeqIndex make_seq) { + //cerr << "interrogate_make_seq_comment(" << make_seq << ")\n"; + return InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_comment().c_str(); +} + const char * interrogate_make_seq_num_name(MakeSeqIndex make_seq) { //cerr << "interrogate_make_seq_num_name(" << make_seq << ")\n"; - static string result; - result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_num_name(); - return result.c_str(); + FunctionIndex function = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_length_getter(); + return interrogate_function_name(function); } const char * interrogate_make_seq_element_name(MakeSeqIndex make_seq) { //cerr << "interrogate_make_seq_element_name(" << make_seq << ")\n"; static string result; - result = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_element_name(); - return result.c_str(); + FunctionIndex function = InterrogateDatabase::get_ptr()->get_make_seq(make_seq).get_element_getter(); + return interrogate_function_name(function); } int diff --git a/dtool/src/interrogatedb/interrogate_interface.h b/dtool/src/interrogatedb/interrogate_interface.h index 9cbe879339..104fbd75a6 100644 --- a/dtool/src/interrogatedb/interrogate_interface.h +++ b/dtool/src/interrogatedb/interrogate_interface.h @@ -363,11 +363,10 @@ EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_get_wrapper_by_unique_name( // and get_thing(n) are used to synthesize a new method called // get_things(). -// The class of which the make_seq is a method. -EXPCL_INTERROGATEDB TypeIndex interrogate_make_seq_class(MakeSeqIndex make_seq); - -// The name of the syntheized method, e.g. "get_things" EXPCL_INTERROGATEDB const char *interrogate_make_seq_seq_name(MakeSeqIndex make_seq); +EXPCL_INTERROGATEDB const char *interrogate_make_seq_scoped_name(MakeSeqIndex make_seq); +EXPCL_INTERROGATEDB bool interrogate_make_seq_has_comment(ElementIndex element); +EXPCL_INTERROGATEDB const char *interrogate_make_seq_comment(ElementIndex element); // The name of the real method that returns the length, e.g. "get_num_things" EXPCL_INTERROGATEDB const char *interrogate_make_seq_num_name(MakeSeqIndex make_seq); // The name of the real method that returns the nth element, e.g. "get_thing" diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index 0278a84ce1..76e4a44270 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -14,6 +14,7 @@ #include "py_panda.h" #include "config_interrogatedb.h" +#include "executionEnvironment.h" #ifdef HAVE_PYTHON @@ -626,6 +627,50 @@ PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename) { #endif } + // MAIN_DIR needs to be set very early; this seems like a convenient place + // to do that. Perhaps we'll find a better place for this in the future. + static bool initialized_main_dir = false; + if (!initialized_main_dir) { + // Grab the __main__ module. + PyObject *main_module = PyImport_ImportModule("__main__"); + if (main_module == NULL) { + interrogatedb_cat.warning() << "Unable to import __main__\n"; + } + + // Extract the __file__ attribute, if present. + Filename main_dir; + PyObject *file_attr = PyObject_GetAttrString(main_module, "__file__"); + if (file_attr == NULL) { + // Must be running in the interactive interpreter. Use the CWD. + main_dir = ExecutionEnvironment::get_cwd(); + } else { +#if PY_MAJOR_VERSION >= 3 + Py_ssize_t length; + wchar_t *buffer = PyUnicode_AsWideCharString(file_attr, &length); + if (buffer != NULL) { + main_dir = Filename::from_os_specific_w(std::wstring(buffer, length)); + main_dir.make_absolute(); + main_dir = main_dir.get_dirname(); + PyMem_Free(buffer); + } +#else + char *buffer; + Py_ssize_t length; + if (PyString_AsStringAndSize(file_attr, &buffer, &length) != -1) { + main_dir = Filename::from_os_specific(std::string(buffer, length)); + main_dir.make_absolute(); + main_dir = main_dir.get_dirname(); + } +#endif + else { + interrogatedb_cat.warning() << "Invalid string for __main__.__file__\n"; + } + } + ExecutionEnvironment::shadow_environment_variable("MAIN_DIR", main_dir.to_os_specific()); + PyErr_Clear(); + initialized_main_dir = true; + } + PyModule_AddIntConstant(module, "Dtool_PyNativeInterface", 1); return module; } diff --git a/dtool/src/newheader/Sources.pp b/dtool/src/newheader/Sources.pp deleted file mode 100644 index 0cfb46a643..0000000000 --- a/dtool/src/newheader/Sources.pp +++ /dev/null @@ -1,14 +0,0 @@ -// The program built in this directory is just a utility tool intended -// for use within the VR Studio. Don't build it otherwise. -#define BUILD_DIRECTORY $[CTPROJS] -#if $[CTPROJS] - - #define LOCAL_LIBS p3dtoolbase p3pystub - - #begin bin_target - #define TARGET newheader - #define SOURCES \ - newheader.cxx - #end bin_target - -#endif diff --git a/dtool/src/parser-inc/cg.h b/dtool/src/parser-inc/Cg/cg.h similarity index 100% rename from dtool/src/parser-inc/cg.h rename to dtool/src/parser-inc/Cg/cg.h diff --git a/dtool/src/parser-inc/cgGL.h b/dtool/src/parser-inc/Cg/cgGL.h similarity index 100% rename from dtool/src/parser-inc/cgGL.h rename to dtool/src/parser-inc/Cg/cgGL.h diff --git a/dtool/src/parser-inc/Core.h b/dtool/src/parser-inc/Core/Core.h similarity index 100% rename from dtool/src/parser-inc/Core.h rename to dtool/src/parser-inc/Core/Core.h diff --git a/dtool/src/parser-inc/Dense b/dtool/src/parser-inc/Eigen/Dense similarity index 100% rename from dtool/src/parser-inc/Dense rename to dtool/src/parser-inc/Eigen/Dense diff --git a/dtool/src/parser-inc/StdVector b/dtool/src/parser-inc/Eigen/StdVector similarity index 100% rename from dtool/src/parser-inc/StdVector rename to dtool/src/parser-inc/Eigen/StdVector diff --git a/dtool/src/parser-inc/Forest.h b/dtool/src/parser-inc/Forest/Forest.h similarity index 100% rename from dtool/src/parser-inc/Forest.h rename to dtool/src/parser-inc/Forest/Forest.h diff --git a/dtool/src/parser-inc/DirectX9Renderer.h b/dtool/src/parser-inc/Renderers/OpenGL/DirectX9Renderer.h similarity index 100% rename from dtool/src/parser-inc/DirectX9Renderer.h rename to dtool/src/parser-inc/Renderers/OpenGL/DirectX9Renderer.h diff --git a/dtool/src/parser-inc/OpenGLRenderer.h b/dtool/src/parser-inc/Renderers/OpenGL/OpenGLRenderer.h similarity index 100% rename from dtool/src/parser-inc/OpenGLRenderer.h rename to dtool/src/parser-inc/Renderers/OpenGL/OpenGLRenderer.h diff --git a/dtool/src/parser-inc/RenderInterface.h b/dtool/src/parser-inc/Rocket/Core/RenderInterface.h similarity index 100% rename from dtool/src/parser-inc/RenderInterface.h rename to dtool/src/parser-inc/Rocket/Core/RenderInterface.h diff --git a/dtool/src/parser-inc/Sources.pp b/dtool/src/parser-inc/Sources.pp deleted file mode 100644 index c60d22bf30..0000000000 --- a/dtool/src/parser-inc/Sources.pp +++ /dev/null @@ -1,31 +0,0 @@ -#define INSTALL_PARSER_INC \ - algorithm deque ft2build.h hash_map hash_set iostream list map memory \ - pair pthread.h queue set stack stdcompare.h stdtypedefs.h stdint.h \ - string vector windows.h winsock2.h zlib.h files.h hex.h \ - math.h md5.h evp.h bits/pthreadtypes.h event.h \ - openssl/md5.h openssl/evp.h openssl/rand.h openssl/ssl.h \ - openssl/x509.h openssl/x509v3.h openssl/err.h openssl/rsa.h \ - openssl/crypto.h openssl/pem.h \ - nurbs.hh stddef.h krb5.h MainHelix.h dllpath.h hxcom.h \ - hxcomm.h hxcore.h hxengin.h hxerror.h hxfiles.h hxtbuf.h \ - hxtbuff.h hxwin.h pyconfig.h Python.h py_panda.h Cg/cg.h Cg/cgGL.h \ - opencv/cv.h opencv/cxcore.h opencv/highgui.h \ - opencv2/core/core.hpp opencv2/highgui/highgui.hpp \ - avcodec.h avformat.h avio.h avutil.h swscale.h integer.h \ - intfloat_readwrite.h mathematics.h rational.h rtp.h \ - rtsp.h rtspcodes.h setjmp.h tinyxml.h winsock2.h \ - ode/ode.h collision_trimesh.h artools.h \ - NxBoxController.h NxCapsuleController.h NxController.h \ - NxControllerManager.h NxCooking.h NxExtended.h \ - NxPhysics.h NxStream.h \ - netinet/tcp.h netinet/ip.h sys/socket.h \ - rfftw.h libtar.h malloc.h ucontext.h ctype.h \ - libavutil/avutil.h libavformat/avformat.h \ - libavcodec/avcodec.h libswscale/swscale.h \ - libavformat/avio.h AR/ar.h \ - WebCore.h WebView.h WebViewListener.h \ - Core/Core.h Forest/Forest.h Renderers/OpenGL/OpenGLRenderer.h \ - Renderers/DirectX9/DirectX9Renderer.h \ - glew/glew.h Eigen/Dense Eigen/StdVector \ - Rocket/Core/RenderInterface.h btBulletDynamicsCommon.h OVR.h \ - ogg/os_types.h vorbis/vorbisfile.h diff --git a/dtool/src/parser-inc/glew.h b/dtool/src/parser-inc/glew/glew.h old mode 100644 new mode 100755 similarity index 100% rename from dtool/src/parser-inc/glew.h rename to dtool/src/parser-inc/glew/glew.h diff --git a/dtool/src/parser-inc/ip.h b/dtool/src/parser-inc/netinet/ip.h similarity index 100% rename from dtool/src/parser-inc/ip.h rename to dtool/src/parser-inc/netinet/ip.h diff --git a/dtool/src/parser-inc/tcp.h b/dtool/src/parser-inc/netinet/tcp.h similarity index 100% rename from dtool/src/parser-inc/tcp.h rename to dtool/src/parser-inc/netinet/tcp.h diff --git a/dtool/src/parser-inc/core.hpp b/dtool/src/parser-inc/opencv2/core/core.hpp similarity index 100% rename from dtool/src/parser-inc/core.hpp rename to dtool/src/parser-inc/opencv2/core/core.hpp diff --git a/dtool/src/parser-inc/highgui.hpp b/dtool/src/parser-inc/opencv2/highgui/highgui.hpp similarity index 100% rename from dtool/src/parser-inc/highgui.hpp rename to dtool/src/parser-inc/opencv2/highgui/highgui.hpp diff --git a/dtool/src/parser-inc/crypto.h b/dtool/src/parser-inc/openssl/crypto.h similarity index 100% rename from dtool/src/parser-inc/crypto.h rename to dtool/src/parser-inc/openssl/crypto.h diff --git a/dtool/src/parser-inc/err.h b/dtool/src/parser-inc/openssl/err.h similarity index 100% rename from dtool/src/parser-inc/err.h rename to dtool/src/parser-inc/openssl/err.h diff --git a/dtool/src/parser-inc/evp.h b/dtool/src/parser-inc/openssl/evp.h similarity index 100% rename from dtool/src/parser-inc/evp.h rename to dtool/src/parser-inc/openssl/evp.h diff --git a/dtool/src/parser-inc/md5.h b/dtool/src/parser-inc/openssl/md5.h similarity index 100% rename from dtool/src/parser-inc/md5.h rename to dtool/src/parser-inc/openssl/md5.h diff --git a/dtool/src/parser-inc/pem.h b/dtool/src/parser-inc/openssl/pem.h similarity index 100% rename from dtool/src/parser-inc/pem.h rename to dtool/src/parser-inc/openssl/pem.h diff --git a/dtool/src/parser-inc/rand.h b/dtool/src/parser-inc/openssl/rand.h similarity index 100% rename from dtool/src/parser-inc/rand.h rename to dtool/src/parser-inc/openssl/rand.h diff --git a/dtool/src/parser-inc/rsa.h b/dtool/src/parser-inc/openssl/rsa.h similarity index 100% rename from dtool/src/parser-inc/rsa.h rename to dtool/src/parser-inc/openssl/rsa.h diff --git a/dtool/src/parser-inc/ssl.h b/dtool/src/parser-inc/openssl/ssl.h similarity index 100% rename from dtool/src/parser-inc/ssl.h rename to dtool/src/parser-inc/openssl/ssl.h diff --git a/dtool/src/parser-inc/x509.h b/dtool/src/parser-inc/openssl/x509.h similarity index 100% rename from dtool/src/parser-inc/x509.h rename to dtool/src/parser-inc/openssl/x509.h diff --git a/dtool/src/parser-inc/x509v3.h b/dtool/src/parser-inc/openssl/x509v3.h old mode 100644 new mode 100755 similarity index 100% rename from dtool/src/parser-inc/x509v3.h rename to dtool/src/parser-inc/openssl/x509v3.h diff --git a/dtool/src/prc/Sources.pp b/dtool/src/prc/Sources.pp deleted file mode 100644 index a5bc96963b..0000000000 --- a/dtool/src/prc/Sources.pp +++ /dev/null @@ -1,112 +0,0 @@ -#define LOCAL_LIBS p3dtoolutil p3dtoolbase -#define USE_PACKAGES openssl - -#begin lib_target - #define TARGET p3prc - - #define ANDROID_SYS_LIBS log - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - bigEndian.h \ - config_prc.h \ - configDeclaration.I configDeclaration.h \ - configFlags.I configFlags.h \ - configPage.I configPage.h \ - configPageManager.I configPageManager.h \ - configVariable.I configVariable.h \ - configVariableBase.I configVariableBase.h \ - configVariableBool.I configVariableBool.h \ - configVariableCore.I configVariableCore.h \ - configVariableDouble.I configVariableDouble.h \ - configVariableEnum.I configVariableEnum.h \ - configVariableFilename.I configVariableFilename.h \ - configVariableInt.I configVariableInt.h \ - configVariableInt64.I configVariableInt64.h \ - configVariableList.I configVariableList.h \ - configVariableManager.I configVariableManager.h \ - configVariableSearchPath.I configVariableSearchPath.h \ - configVariableString.I configVariableString.h \ - encryptStreamBuf.h encryptStreamBuf.I encryptStream.h encryptStream.I \ - littleEndian.h \ - nativeNumericData.I nativeNumericData.h \ - pnotify.I pnotify.h \ - notifyCategory.I notifyCategory.h \ - notifyCategoryProxy.I notifyCategoryProxy.h \ - notifySeverity.h \ - prcKeyRegistry.h \ - reversedNumericData.I reversedNumericData.h \ - streamReader.I streamReader.h \ - streamWrapper.I streamWrapper.h \ - streamWriter.I streamWriter.h - - // A generated file - #define SOURCES $[SOURCES] prc_parameters.h - - #define INCLUDED_SOURCES \ - config_prc.cxx \ - configDeclaration.cxx \ - configFlags.cxx \ - configPage.cxx \ - configPageManager.cxx \ - configVariable.cxx \ - configVariableBase.cxx \ - configVariableBool.cxx \ - configVariableCore.cxx \ - configVariableDouble.cxx \ - configVariableEnum.cxx \ - configVariableFilename.cxx \ - configVariableInt.cxx \ - configVariableInt64.cxx \ - configVariableList.cxx \ - configVariableManager.cxx \ - configVariableSearchPath.cxx \ - configVariableString.cxx \ - encryptStreamBuf.cxx encryptStream.cxx \ - nativeNumericData.cxx \ - notify.cxx \ - notifyCategory.cxx \ - notifySeverity.cxx \ - prcKeyRegistry.cxx \ - reversedNumericData.cxx \ - streamReader.cxx streamWrapper.cxx streamWriter.cxx - - #define INSTALL_HEADERS \ - bigEndian.h \ - config_prc.h \ - configDeclaration.I configDeclaration.h \ - configFlags.I configFlags.h \ - configPage.I configPage.h \ - configPageManager.I configPageManager.h \ - configVariable.I configVariable.h \ - configVariableBase.I configVariableBase.h \ - configVariableBool.I configVariableBool.h \ - configVariableCore.I configVariableCore.h \ - configVariableDouble.I configVariableDouble.h \ - configVariableEnum.I configVariableEnum.h \ - configVariableFilename.I configVariableFilename.h \ - configVariableInt.I configVariableInt.h \ - configVariableInt64.I configVariableInt64.h \ - configVariableList.I configVariableList.h \ - configVariableManager.I configVariableManager.h \ - configVariableSearchPath.I configVariableSearchPath.h \ - configVariableString.I configVariableString.h \ - encryptStreamBuf.h encryptStreamBuf.I encryptStream.h encryptStream.I \ - littleEndian.h \ - nativeNumericData.I nativeNumericData.h \ - pnotify.I pnotify.h \ - notifyCategory.I notifyCategory.h \ - notifyCategoryProxy.I notifyCategoryProxy.h \ - notifySeverity.h \ - prcKeyRegistry.I prcKeyRegistry.h \ - reversedNumericData.I reversedNumericData.h \ - streamReader.I streamReader.h \ - streamWrapper.I streamWrapper.h \ - streamWriter.I streamWriter.h - - -#end lib_target - -#include $[THISDIRPREFIX]prc_parameters.h.pp - diff --git a/dtool/src/prc/prc_parameters.h.pp b/dtool/src/prc/prc_parameters.h.pp deleted file mode 100644 index e8dffa3180..0000000000 --- a/dtool/src/prc/prc_parameters.h.pp +++ /dev/null @@ -1,68 +0,0 @@ -// This file is read and processed by ppremake to generate -// prc_parameters.h, which is #included by configPageManager.cxx. -// This mechanism is used, rather than just putting the parameters in -// dtool_config.h, to (a) help keep the prc encryption key from -// getting spread around to too many places, and (b) minimize the need -// to rebuild the whole world just because you changed some low-level -// prc parameters. - -#output prc_parameters.h notouch -/* prc_parameters.h. Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. */ -/********************************** DO NOT EDIT ****************************/ - - -/* The compiled-in default directory to look for the Configrc file, in - the absence of the PRC_DIR environment variable set, and in - the absence of anything specified via the configpath directive. */ -# define DEFAULT_PRC_DIR "$[unixfilename $[DEFAULT_PRC_DIR]]" - -/* The compiled-in name of the environment variable(s) that contain - the name of a single directory in which to search for prc files. */ -# define PRC_DIR_ENVVARS "$[PRC_DIR_ENVVARS]" - -/* The compiled-in name of the environment variable(s) that contain - the name of multiple directories, separated by DEFAULT_PATHSEP, in - which to search for prc files. */ -# define PRC_PATH_ENVVARS "$[PRC_PATH_ENVVARS]" - -/* This is a special variable that is rarely used; it exists primarily - to support the Cygwin-based "ctattach" tools used by the Walt - Disney VR Studio. This defines a set of environment variable(s) - that define a search path, as above; except that the directory - names on these search paths are Panda-style filenames, not - Windows-style filenames; and the path separator is always a space - character, regardless of DEFAULT_PATHSEP. */ -# define PRC_PATH2_ENVVARS "$[PRC_PATH2_ENVVARS]" - -/* The filename(s) to search for in the above paths. Normally this is - *.prc. */ -# define PRC_PATTERNS "$[PRC_PATTERNS]" - -/* The filename(s) for encrypted prc files. */ -# define PRC_ENCRYPTED_PATTERNS "$[PRC_ENCRYPTED_PATTERNS]" - -/* The encryption key used to decrypt any encrypted prc files - identified by PRC_ENCRYPTED_PATTERNS. */ -$[cdefine PRC_ENCRYPTION_KEY] - -/* The filename(s) to search for, and execute, in the above paths. - Normally this is empty. */ -# define PRC_EXECUTABLE_PATTERNS "$[PRC_EXECUTABLE_PATTERNS]" - -/* The environment variable that defines optional args to pass to - executables found that match one of the above patterns. */ -# define PRC_EXECUTABLE_ARGS_ENVVAR "$[PRC_EXECUTABLE_ARGS_ENVVAR]" - -/* Define if we want to enable the "trust_level" feature of prc config - variables. This requires OpenSSL and PRC_PUBLIC_KEYS_FILENAME, - above. */ -$[cdefine PRC_RESPECT_TRUST_LEVEL] - -/* The trust level value for any legacy (DConfig) variables. */ -$[cdefine PRC_DCONFIG_TRUST_LEVEL] - -/* The amount by which we globally increment the trust level. */ -$[cdefine PRC_INC_TRUST_LEVEL] - -#end prc_parameters.h - diff --git a/dtool/src/prckeys/Sources.pp b/dtool/src/prckeys/Sources.pp deleted file mode 100644 index 7580258555..0000000000 --- a/dtool/src/prckeys/Sources.pp +++ /dev/null @@ -1,26 +0,0 @@ -#define LOCAL_LIBS p3dtoolutil p3dtoolbase p3prc p3dconfig p3interrogatedb p3pystub - -#begin bin_target - #define BUILD_TARGET $[HAVE_OPENSSL] - #define USE_PACKAGES openssl - - #define TARGET make-prc-key - - #define SOURCES \ - makePrcKey.cxx - - #define INSTALL_HEADERS \ - signPrcFile_src.cxx - -#end bin_target - -// #begin bin_target -// #define BUILD_TARGET $[HAVE_OPENSSL] -// #define USE_PACKAGES openssl -// -// #define TARGET panda-sign1 -// -// #define SOURCES \ -// panda_sign1.cxx -// -// #end bin_target diff --git a/dtool/src/pystub/Sources.pp b/dtool/src/pystub/Sources.pp deleted file mode 100644 index 6e6c4f9451..0000000000 --- a/dtool/src/pystub/Sources.pp +++ /dev/null @@ -1,13 +0,0 @@ -//#define BUILDING_DLL BUILDING_PYSTUB -#define LOCAL_LIBS p3dtoolbase - -#begin static_lib_target - #define TARGET p3pystub - - #define SOURCES \ - pystub.cxx pystub.h - - #define INSTALL_HEADERS \ - pystub.h - -#end static_lib_target diff --git a/dtool/src/test_interrogate/Sources.pp b/dtool/src/test_interrogate/Sources.pp deleted file mode 100644 index c8ef051e16..0000000000 --- a/dtool/src/test_interrogate/Sources.pp +++ /dev/null @@ -1,15 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_INTERROGATE] -#define LOCAL_LIBS p3interrogatedb p3dconfig p3dtoolutil p3dtoolbase p3pystub -#define USE_PACKAGES openssl - -#begin bin_target - #define TARGET test_interrogate - - #define SOURCES \ - test_interrogate.cxx -#end bin_target - -#begin test_bin_target - #define TARGET test_lib - #define SOURCES test_lib.cxx test_lib.h -#end test_bin_target diff --git a/makepanda/installpanda.py b/makepanda/installpanda.py index a84fb02ac6..c8a2cdf2fe 100644 --- a/makepanda/installpanda.py +++ b/makepanda/installpanda.py @@ -1,10 +1,6 @@ #!/usr/bin/env python ######################################################################## # -# Caution: there are two separate, independent build systems: -# 'makepanda', and 'ppremake'. Use one or the other, do not attempt -# to use both. This file is part of the 'makepanda' system. -# # To install panda using this script, type 'installpanda.py'. # To specify an alternate location than the filesystem root /, # either pass it as only argument or set the DESTDIR environment @@ -127,7 +123,7 @@ def GetLibDir(): something like "lib" or "lib64" or in some cases, something similar to "lib/x86_64-linux-gnu". """ - if sys.platform in ("darwin", "win32"): + if sys.platform in ("darwin", "win32", "cygwin"): return "lib" # This one's a bit tricky. Some systems require us to install diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 2b7b1bf128..1fc89fcd46 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1,10 +1,6 @@ #!/usr/bin/env python ######################################################################## # -# Caution: there are two separate, independent build systems: -# 'makepanda', and 'ppremake'. Use one or the other, do not attempt -# to use both. This file is part of the 'makepanda' system. -# # To build panda using this script, type 'makepanda.py' on unix # or 'makepanda.bat' on windows, and examine the help-text. # Then run the script again with the appropriate options to compile @@ -1237,6 +1233,10 @@ def CompileCxx(obj,src,opts): else: cmd += " -fno-exceptions" + if src.endswith(".mm"): + # Work around Apple compiler bug. + cmd += " -U__EXCEPTIONS" + if 'RTTI' not in opts: # We always disable RTTI on Android for memory usage reasons. if optlevel >= 4 or GetTarget() == "android": @@ -1357,9 +1357,11 @@ def CompileIgate(woutd,wsrc,opts): cmd += ' -srcdir %s -I%s' % (srcdir, srcdir) cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus=201103L' if (COMPILER=="MSVC"): - cmd += ' -D_X86_ -DWIN32_VC -DWIN32 -D_WIN32' + cmd += ' -DWIN32_VC -DWIN32 -D_WIN32' if GetTargetArch() == 'x64': - cmd += ' -DWIN64_VC -DWIN64 -D_WIN64' + cmd += ' -DWIN64_VC -DWIN64 -D_WIN64 -D_M_X64 -D_M_AMD64' + else: + cmd += ' -D_M_IX86' # NOTE: this 1600 value is the version number for VC2010. cmd += ' -D_MSC_VER=1600 -D"__declspec(param)=" -D__cdecl -D_near -D_far -D__near -D__far -D__stdcall' if (COMPILER=="GCC"): @@ -1787,29 +1789,6 @@ def CompileRsrc(target, src, opts): cmd += " " + BracketNameWithQuotes(src) oscmd(cmd) -########################################################################################## -# -# GenPyExtensions -# -########################################################################################## - -def GenPyExtensions(target, inputs, opts): - # Hopefully the need for this will soon go away as we migrate everything to - # C extensions. - - code = "# This file is automatically generated by makepanda.py. Do not modify.\n" - code += "from __future__ import absolute_import\n" - - for i in inputs: - if GetOrigExt(i) == ".pyd": - code += "from .%s import *\n" % (os.path.splitext(os.path.basename(i))[0]) - elif GetOrigExt(i) == ".py": - code += "### BEGIN %s\n" % i - code += ReadFile(i) - code += "### END %s\n" % i - - WriteFile(target, code) - ########################################################################################## # # FreezePy @@ -1966,10 +1945,6 @@ def CompileAnything(target, inputs, opts, progress = None): os.system("chmod +x \"%s\"" % target) return - elif (target.endswith(".py")): - ProgressOutput(progress, "Generating", target) - return GenPyExtensions(target, inputs, opts) - elif (infile.endswith(".py")): if origsuffix == ".obj": source = os.path.splitext(target)[0] + ".c" @@ -2620,28 +2595,22 @@ if (PkgSkip("DIRECT")==0): if os.path.isfile(GetOutputDir() + '/lib/panda3d.py'): os.remove(GetOutputDir() + '/lib/panda3d.py') - # Don't copy this file, which would cause conflict with our 'panda3d' module. - if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.py'): - os.remove(GetOutputDir() + '/direct/ffi/panda3d.py') - if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.pyc'): - os.remove(GetOutputDir() + '/direct/ffi/panda3d.pyc') + # This directory doesn't exist at all any more. + if os.path.isdir(os.path.join(GetOutputDir(), 'direct', 'ffi')): + shutil.rmtree(os.path.join(GetOutputDir(), 'direct', 'ffi')) -# This used to exist; no longer. -if sys.platform == 'win32': - core_so = GetOutputDir() + '/panda3d/core.pyd' - direct_so = GetOutputDir() + '/panda3d/direct.pyd' - dtoolconfig_so = GetOutputDir() + '/panda3d/dtoolconfig.pyd' -else: - core_so = GetOutputDir() + '/panda3d/core.so' - direct_so = GetOutputDir() + '/panda3d/direct.so' - dtoolconfig_so = GetOutputDir() + '/panda3d/dtoolconfig.so' +# These files used to exist; remove them to avoid conflicts. +del_files = ['core.py', 'core.pyc', 'core.pyo', + '_core.pyd', '_core.so', + 'direct.py', 'direct.pyc', 'direct.pyo', + '_direct.pyd', '_direct.so', + 'dtoolconfig.pyd', 'dtoolconfig.so'] -if os.path.isfile(core_so): - os.remove(core_so) -if os.path.isfile(direct_so): - os.remove(direct_so) -if os.path.isfile(dtoolconfig_so): - os.remove(dtoolconfig_so) +for basename in del_files: + path = os.path.join(GetOutputDir(), 'panda3d', basename) + if os.path.isfile(path): + print("Removing %s" % (path)) + os.remove(path) # Write an appropriate panda3d/__init__.py p3d_init = """"Python bindings for the Panda3D libraries" @@ -2661,7 +2630,14 @@ if os.path.isfile(os.path.join(bindir, 'libpanda.dll')): del os, bindir """ -ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init) +if not PkgSkip("PYTHON"): + ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init) + + # Also add this file, for backward compatibility. + ConditionalWriteFile(GetOutputDir() + '/panda3d/dtoolconfig.py', """ +print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.") +from .interrogatedb import * +""") # PandaModules is now deprecated; generate a shim for backward compatibility. for fn in glob.glob(GetOutputDir() + '/pandac/*.py') + glob.glob(GetOutputDir() + '/pandac/*.py[co]'): @@ -2701,8 +2677,9 @@ except ImportError as err: if "No module named %s" not in str(err): raise""" % (module, module) -ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code) -ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '') +if not PkgSkip("PYTHON"): + ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code) + ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '') ########################################################################################## # @@ -2846,35 +2823,6 @@ if not PkgSkip("EIGEN") and GetTarget() == "windows" and GetThirdpartyDir(): ######################################################################## CopyTree(GetOutputDir()+'/include/parser-inc','dtool/src/parser-inc') -MakeDirectory(GetOutputDir()+'/include/parser-inc/openssl') -MakeDirectory(GetOutputDir()+'/include/parser-inc/netinet') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Cg') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Core') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Forest') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Renderers') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Renderers/OpenGL') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Renderers/DirectX9') -MakeDirectory(GetOutputDir()+'/include/parser-inc/glew') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Eigen') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Rocket') -MakeDirectory(GetOutputDir()+'/include/parser-inc/Rocket/Core') -MakeDirectory(GetOutputDir()+'/include/parser-inc/opencv2') -MakeDirectory(GetOutputDir()+'/include/parser-inc/opencv2/core') -MakeDirectory(GetOutputDir()+'/include/parser-inc/opencv2/highgui') -CopyAllFiles(GetOutputDir()+'/include/parser-inc/openssl/','dtool/src/parser-inc/') -CopyAllFiles(GetOutputDir()+'/include/parser-inc/netinet/','dtool/src/parser-inc/') -CopyFile(GetOutputDir()+'/include/parser-inc/Cg/','dtool/src/parser-inc/cg.h') -CopyFile(GetOutputDir()+'/include/parser-inc/Cg/','dtool/src/parser-inc/cgGL.h') -CopyFile(GetOutputDir()+'/include/parser-inc/Core/','dtool/src/parser-inc/Core.h') -CopyFile(GetOutputDir()+'/include/parser-inc/Forest/','dtool/src/parser-inc/Forest.h') -CopyFile(GetOutputDir()+'/include/parser-inc/Renderers/OpenGL/','dtool/src/parser-inc/OpenGLRenderer.h') -CopyFile(GetOutputDir()+'/include/parser-inc/Renderers/DirectX9/','dtool/src/parser-inc/DirectX9Renderer.h') -CopyFile(GetOutputDir()+'/include/parser-inc/glew/','dtool/src/parser-inc/glew.h') -CopyFile(GetOutputDir()+'/include/parser-inc/Eigen/','dtool/src/parser-inc/Dense') -CopyFile(GetOutputDir()+'/include/parser-inc/Eigen/','dtool/src/parser-inc/StdVector') -CopyFile(GetOutputDir()+'/include/parser-inc/Rocket/Core/','dtool/src/parser-inc/RenderInterface.h') -CopyFile(GetOutputDir()+'/include/parser-inc/opencv2/core/','dtool/src/parser-inc/core.hpp') -CopyFile(GetOutputDir()+'/include/parser-inc/opencv2/highgui/','dtool/src/parser-inc/highgui.hpp') DeleteVCS(GetOutputDir()+'/include/parser-inc') ######################################################################## @@ -3224,9 +3172,6 @@ if not PkgSkip("PYTHON"): TargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll') TargetAdd('interrogatedb.pyd', opts=['PYTHON']) - # Make a stub file importing the new one for backward compatibility. - TargetAdd('panda3d/dtoolconfig.py', input='interrogatedb.pyd') - # # DIRECTORY: dtool/src/pystub/ # @@ -3957,69 +3902,60 @@ if (not RUNTIME): if PkgSkip("FREETYPE")==0: TargetAdd('core_module.obj', input='libp3pnmtext.in') - TargetAdd('core_module.obj', opts=['IMOD:panda3d._core', 'ILIB:_core']) + TargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core']) - TargetAdd('_core.pyd', input='libp3downloader_igate.obj') - TargetAdd('_core.pyd', input='p3downloader_stringStream_ext.obj') - TargetAdd('_core.pyd', input='p3express_ext_composite.obj') - TargetAdd('_core.pyd', input='libp3express_igate.obj') + TargetAdd('core.pyd', input='libp3downloader_igate.obj') + TargetAdd('core.pyd', input='p3downloader_stringStream_ext.obj') + TargetAdd('core.pyd', input='p3express_ext_composite.obj') + TargetAdd('core.pyd', input='libp3express_igate.obj') - TargetAdd('_core.pyd', input='libp3recorder_igate.obj') - TargetAdd('_core.pyd', input='libp3pgraphnodes_igate.obj') - TargetAdd('_core.pyd', input='libp3pgraph_igate.obj') - TargetAdd('_core.pyd', input='libp3movies_igate.obj') - TargetAdd('_core.pyd', input='libp3grutil_igate.obj') - TargetAdd('_core.pyd', input='libp3chan_igate.obj') - TargetAdd('_core.pyd', input='libp3pstatclient_igate.obj') - TargetAdd('_core.pyd', input='libp3char_igate.obj') - TargetAdd('_core.pyd', input='libp3collide_igate.obj') - TargetAdd('_core.pyd', input='libp3device_igate.obj') - TargetAdd('_core.pyd', input='libp3dgraph_igate.obj') - TargetAdd('_core.pyd', input='libp3display_igate.obj') - TargetAdd('_core.pyd', input='libp3pipeline_igate.obj') - TargetAdd('_core.pyd', input='libp3event_igate.obj') - TargetAdd('_core.pyd', input='libp3gobj_igate.obj') - TargetAdd('_core.pyd', input='libp3gsgbase_igate.obj') - TargetAdd('_core.pyd', input='libp3linmath_igate.obj') - TargetAdd('_core.pyd', input='libp3mathutil_igate.obj') - TargetAdd('_core.pyd', input='libp3parametrics_igate.obj') - TargetAdd('_core.pyd', input='libp3pnmimage_igate.obj') - TargetAdd('_core.pyd', input='libp3text_igate.obj') - TargetAdd('_core.pyd', input='libp3tform_igate.obj') - TargetAdd('_core.pyd', input='libp3putil_igate.obj') - TargetAdd('_core.pyd', input='libp3audio_igate.obj') - TargetAdd('_core.pyd', input='libp3pgui_igate.obj') - TargetAdd('_core.pyd', input='libp3net_igate.obj') - TargetAdd('_core.pyd', input='libp3nativenet_igate.obj') - TargetAdd('_core.pyd', input='libp3dxml_igate.obj') + TargetAdd('core.pyd', input='libp3recorder_igate.obj') + TargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj') + TargetAdd('core.pyd', input='libp3pgraph_igate.obj') + TargetAdd('core.pyd', input='libp3movies_igate.obj') + TargetAdd('core.pyd', input='libp3grutil_igate.obj') + TargetAdd('core.pyd', input='libp3chan_igate.obj') + TargetAdd('core.pyd', input='libp3pstatclient_igate.obj') + TargetAdd('core.pyd', input='libp3char_igate.obj') + TargetAdd('core.pyd', input='libp3collide_igate.obj') + TargetAdd('core.pyd', input='libp3device_igate.obj') + TargetAdd('core.pyd', input='libp3dgraph_igate.obj') + TargetAdd('core.pyd', input='libp3display_igate.obj') + TargetAdd('core.pyd', input='libp3pipeline_igate.obj') + TargetAdd('core.pyd', input='libp3event_igate.obj') + TargetAdd('core.pyd', input='libp3gobj_igate.obj') + TargetAdd('core.pyd', input='libp3gsgbase_igate.obj') + TargetAdd('core.pyd', input='libp3linmath_igate.obj') + TargetAdd('core.pyd', input='libp3mathutil_igate.obj') + TargetAdd('core.pyd', input='libp3parametrics_igate.obj') + TargetAdd('core.pyd', input='libp3pnmimage_igate.obj') + TargetAdd('core.pyd', input='libp3text_igate.obj') + TargetAdd('core.pyd', input='libp3tform_igate.obj') + TargetAdd('core.pyd', input='libp3putil_igate.obj') + TargetAdd('core.pyd', input='libp3audio_igate.obj') + TargetAdd('core.pyd', input='libp3pgui_igate.obj') + TargetAdd('core.pyd', input='libp3net_igate.obj') + TargetAdd('core.pyd', input='libp3nativenet_igate.obj') + TargetAdd('core.pyd', input='libp3dxml_igate.obj') if PkgSkip("FREETYPE")==0: - TargetAdd('_core.pyd', input="libp3pnmtext_igate.obj") + TargetAdd('core.pyd', input="libp3pnmtext_igate.obj") - TargetAdd('_core.pyd', input='p3putil_typedWritable_ext.obj') - TargetAdd('_core.pyd', input='p3putil_pythonCallbackObject.obj') - TargetAdd('_core.pyd', input='p3pnmimage_pfmFile_ext.obj') - TargetAdd('_core.pyd', input='p3event_pythonTask.obj') - TargetAdd('_core.pyd', input='p3gobj_ext_composite.obj') - TargetAdd('_core.pyd', input='p3pgraph_ext_composite.obj') - TargetAdd('_core.pyd', input='p3display_graphicsStateGuardian_ext.obj') - TargetAdd('_core.pyd', input='p3display_graphicsWindow_ext.obj') - TargetAdd('_core.pyd', input='p3display_pythonGraphicsWindowProc.obj') + TargetAdd('core.pyd', input='p3putil_typedWritable_ext.obj') + TargetAdd('core.pyd', input='p3putil_pythonCallbackObject.obj') + TargetAdd('core.pyd', input='p3pnmimage_pfmFile_ext.obj') + TargetAdd('core.pyd', input='p3event_pythonTask.obj') + TargetAdd('core.pyd', input='p3gobj_ext_composite.obj') + TargetAdd('core.pyd', input='p3pgraph_ext_composite.obj') + TargetAdd('core.pyd', input='p3display_graphicsStateGuardian_ext.obj') + TargetAdd('core.pyd', input='p3display_graphicsWindow_ext.obj') + TargetAdd('core.pyd', input='p3display_pythonGraphicsWindowProc.obj') - TargetAdd('_core.pyd', input='core_module.obj') - TargetAdd('_core.pyd', input='libp3tinyxml.ilb') - TargetAdd('_core.pyd', input='libp3interrogatedb.dll') - TargetAdd('_core.pyd', input=COMMON_PANDA_LIBS) - TargetAdd('_core.pyd', opts=['PYTHON', 'WINSOCK2']) - - OPTS=['DIR:direct/src/extensions_native'] - TargetAdd('panda3d/core.py', input='_core.pyd') - TargetAdd('panda3d/core.py', opts=OPTS, input='core_extensions.py') - TargetAdd('panda3d/core.py', opts=OPTS, input='NodePath_extensions.py') - TargetAdd('panda3d/core.py', opts=OPTS, input='Mat3_extensions.py') - TargetAdd('panda3d/core.py', opts=OPTS, input='VBase3_extensions.py') - TargetAdd('panda3d/core.py', opts=OPTS, input='VBase4_extensions.py') - TargetAdd('panda3d/core.py', opts=OPTS, input='HTTPChannel_extensions.py') + TargetAdd('core.pyd', input='core_module.obj') + TargetAdd('core.pyd', input='libp3tinyxml.ilb') + TargetAdd('core.pyd', input='libp3interrogatedb.dll') + TargetAdd('core.pyd', input=COMMON_PANDA_LIBS) + TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2']) # # DIRECTORY: panda/src/vision/ @@ -4041,7 +3977,7 @@ if (PkgSkip("VISION") == 0) and (not RUNTIME): TargetAdd('vision_module.obj', input='libp3vision.in') TargetAdd('vision_module.obj', opts=OPTS) - TargetAdd('vision_module.obj', opts=['IMOD:panda3d.vision', 'ILIB:vision', 'IMPORT:panda3d._core']) + TargetAdd('vision_module.obj', opts=['IMOD:panda3d.vision', 'ILIB:vision', 'IMPORT:panda3d.core']) TargetAdd('vision.pyd', input='vision_module.obj') TargetAdd('vision.pyd', input='libp3vision_igate.obj') @@ -4072,7 +4008,7 @@ if (PkgSkip("ROCKET") == 0) and (not RUNTIME): TargetAdd('rocket_module.obj', input='libp3rocket.in') TargetAdd('rocket_module.obj', opts=OPTS) - TargetAdd('rocket_module.obj', opts=['IMOD:panda3d.rocket', 'ILIB:rocket', 'IMPORT:panda3d._core']) + TargetAdd('rocket_module.obj', opts=['IMOD:panda3d.rocket', 'ILIB:rocket', 'IMPORT:panda3d.core']) TargetAdd('rocket.pyd', input='rocket_module.obj') TargetAdd('rocket.pyd', input='libp3rocket_igate.obj') @@ -4100,7 +4036,7 @@ if PkgSkip("AWESOMIUM") == 0 and not RUNTIME: TargetAdd('awesomium_module.obj', input='libp3awesomium.in') TargetAdd('awesomium_module.obj', opts=OPTS) - TargetAdd('awesomium_module.obj', opts=['IMOD:panda3d.awesomium', 'ILIB:awesomium', 'IMPORT:panda3d._core']) + TargetAdd('awesomium_module.obj', opts=['IMOD:panda3d.awesomium', 'ILIB:awesomium', 'IMPORT:panda3d.core']) TargetAdd('awesomium.pyd', input='awesomium_module.obj') TargetAdd('awesomium.pyd', input='libp3awesomium_igate.obj') @@ -4134,7 +4070,7 @@ if (PkgSkip('SKEL')==0) and (not RUNTIME): TargetAdd('libpandaskel.dll', opts=OPTS) TargetAdd('skel_module.obj', input='libp3skel.in') - TargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d._core']) + TargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d.core']) TargetAdd('skel.pyd', input='skel_module.obj') TargetAdd('skel.pyd', input='libp3skel_igate.obj') @@ -4173,7 +4109,7 @@ if (PkgSkip('PANDAFX')==0) and (not RUNTIME): OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG'] TargetAdd('fx_module.obj', input='libp3distort.in') TargetAdd('fx_module.obj', opts=OPTS) - TargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d._core']) + TargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d.core']) TargetAdd('fx.pyd', input='fx_module.obj') TargetAdd('fx.pyd', input='libp3distort_igate.obj') @@ -4201,7 +4137,7 @@ if (PkgSkip("VRPN")==0 and not RUNTIME): TargetAdd('vrpn_module.obj', input='libp3vrpn.in') TargetAdd('vrpn_module.obj', opts=OPTS) - TargetAdd('vrpn_module.obj', opts=['IMOD:panda3d.vrpn', 'ILIB:vrpn', 'IMPORT:panda3d._core']) + TargetAdd('vrpn_module.obj', opts=['IMOD:panda3d.vrpn', 'ILIB:vrpn', 'IMPORT:panda3d.core']) TargetAdd('vrpn.pyd', input='vrpn_module.obj') TargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj') @@ -4434,7 +4370,7 @@ if (not RUNTIME): TargetAdd('egg_module.obj', input='libp3egg2pg.in') TargetAdd('egg_module.obj', input='libp3egg.in') TargetAdd('egg_module.obj', opts=OPTS) - TargetAdd('egg_module.obj', opts=['IMOD:panda3d.egg', 'ILIB:egg', 'IMPORT:panda3d._core']) + TargetAdd('egg_module.obj', opts=['IMOD:panda3d.egg', 'ILIB:egg', 'IMPORT:panda3d.core']) TargetAdd('egg.pyd', input='egg_module.obj') TargetAdd('egg.pyd', input='p3egg_eggGroupNode_ext.obj') @@ -4601,7 +4537,7 @@ if (PkgSkip("ODE")==0 and not RUNTIME): OPTS=['DIR:panda/metalibs/pandaode', 'ODE'] TargetAdd('ode_module.obj', input='libpandaode.in') TargetAdd('ode_module.obj', opts=OPTS) - TargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d._core']) + TargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d.core']) TargetAdd('ode.pyd', input='ode_module.obj') TargetAdd('ode.pyd', input='libpandaode_igate.obj') @@ -4639,7 +4575,7 @@ if (PkgSkip("BULLET")==0 and not RUNTIME): OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET'] TargetAdd('bullet_module.obj', input='libpandabullet.in') TargetAdd('bullet_module.obj', opts=OPTS) - TargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d._core']) + TargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d.core']) TargetAdd('bullet.pyd', input='bullet_module.obj') TargetAdd('bullet.pyd', input='libpandabullet_igate.obj') @@ -4678,7 +4614,7 @@ if (PkgSkip("PHYSX")==0): OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC'] TargetAdd('physx_module.obj', input='libpandaphysx.in') TargetAdd('physx_module.obj', opts=OPTS) - TargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d._core']) + TargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core']) TargetAdd('physx.pyd', input='physx_module.obj') TargetAdd('physx.pyd', input='libpandaphysx_igate.obj') @@ -4744,7 +4680,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME): if (PkgSkip("PANDAPARTICLESYSTEM")==0): TargetAdd('physics_module.obj', input='libp3particlesystem.in') TargetAdd('physics_module.obj', opts=OPTS) - TargetAdd('physics_module.obj', opts=['IMOD:panda3d.physics', 'ILIB:physics', 'IMPORT:panda3d._core']) + TargetAdd('physics_module.obj', opts=['IMOD:panda3d.physics', 'ILIB:physics', 'IMPORT:panda3d.core']) TargetAdd('physics.pyd', input='physics_module.obj') TargetAdd('physics.pyd', input='libp3physics_igate.obj') @@ -5001,23 +4937,19 @@ if (PkgSkip("DIRECT")==0): TargetAdd('direct_module.obj', input='libp3interval.in') TargetAdd('direct_module.obj', input='libp3distributed.in') TargetAdd('direct_module.obj', opts=OPTS) - TargetAdd('direct_module.obj', opts=['IMOD:panda3d._direct', 'ILIB:_direct', 'IMPORT:panda3d._core']) + TargetAdd('direct_module.obj', opts=['IMOD:panda3d.direct', 'ILIB:direct', 'IMPORT:panda3d.core']) - TargetAdd('_direct.pyd', input='libp3dcparser_igate.obj') - TargetAdd('_direct.pyd', input='libp3showbase_igate.obj') - TargetAdd('_direct.pyd', input='libp3deadrec_igate.obj') - TargetAdd('_direct.pyd', input='libp3interval_igate.obj') - TargetAdd('_direct.pyd', input='libp3distributed_igate.obj') + TargetAdd('direct.pyd', input='libp3dcparser_igate.obj') + TargetAdd('direct.pyd', input='libp3showbase_igate.obj') + TargetAdd('direct.pyd', input='libp3deadrec_igate.obj') + TargetAdd('direct.pyd', input='libp3interval_igate.obj') + TargetAdd('direct.pyd', input='libp3distributed_igate.obj') - TargetAdd('_direct.pyd', input='direct_module.obj') - 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']) - - OPTS=['DIR:direct/src/extensions_native'] - TargetAdd('panda3d/direct.py', input='_direct.pyd') - TargetAdd('panda3d/direct.py', opts=OPTS, input='CInterval_extensions.py') + TargetAdd('direct.pyd', input='direct_module.obj') + 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']) # # DIRECTORY: direct/src/dcparse/ @@ -5079,7 +5011,7 @@ if (RTDIST or RUNTIME): # Freeze VFSImporter and its dependency modules into p3dpython. # Mark panda3d.core as a dependency to make sure to build that first. TargetAdd('p3dpython_frozen.obj', input='VFSImporter.py', opts=['DIR:direct/src/showbase', 'FREEZE_STARTUP']) - TargetAdd('p3dpython_frozen.obj', dep='panda3d/core.py') + TargetAdd('p3dpython_frozen.obj', dep='core.pyd') TargetAdd('p3dpython_p3dpython_composite1.obj', opts=OPTS, input='p3dpython_composite1.cxx') TargetAdd('p3dpython_p3dPythonMain.obj', opts=OPTS, input='p3dPythonMain.cxx') @@ -6228,7 +6160,7 @@ if (PkgSkip("CONTRIB")==0 and not RUNTIME): TargetAdd('ai_module.obj', input='libpandaai.in') TargetAdd('ai_module.obj', opts=OPTS) - TargetAdd('ai_module.obj', opts=['IMOD:panda3d.ai', 'ILIB:ai', 'IMPORT:panda3d._core']) + TargetAdd('ai_module.obj', opts=['IMOD:panda3d.ai', 'ILIB:ai', 'IMPORT:panda3d.core']) TargetAdd('ai.pyd', input='ai_module.obj') TargetAdd('ai.pyd', input='libpandaai_igate.obj') diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index dd6c06c191..40827b5e43 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1,9 +1,5 @@ ######################################################################## ## -## Caution: there are two separate, independent build systems: -## 'makepanda', and 'ppremake'. Use one or the other, do not attempt -## to use both. This file is part of the 'makepanda' system. -## ## This file, makepandacore, contains all the global state and ## global functions for the makepanda system. ## @@ -508,14 +504,14 @@ def oscmd(cmd, ignoreError = False): print(GetColor("blue") + cmd.split(" ", 1)[0] + " " + GetColor("magenta") + cmd.split(" ", 1)[1] + GetColor()) sys.stdout.flush() - if sys.platform in ("win32", "cygwin"): + if sys.platform == "win32": exe = cmd.split()[0] exe_path = LocateBinary(exe) if exe_path is None: exit("Cannot find "+exe+" on search path") res = os.spawnl(os.P_WAIT, exe_path, cmd) else: - res = os.system(cmd) + res = subprocess.call(cmd, shell=True) sig = res & 0x7F if (GetVerbose() and res != 0): print(ColorText("red", "Process exited with exit status %d and signal code %d" % ((res & 0xFF00) >> 8, sig))) @@ -539,7 +535,7 @@ def oscmd(cmd, ignoreError = False): if sys.platform == "win32": os.spawnl(os.P_WAIT, exe_path, verbose_cmd) else: - os.system(verbose_cmd) + subprocess.call(verbose_cmd, shell=True) exit("The following command returned a non-zero value: " + str(cmd)) return res @@ -1964,7 +1960,7 @@ def SdkLocateVisualStudio(version=10): elif (os.path.isfile("C:\\Program Files\\Microsoft Visual Studio %s\\VC\\bin\\cl.exe" % (version))): SDK["VISUALSTUDIO"] = "C:\\Program Files\\Microsoft Visual Studio %s\\" % (version) - elif (os.path.isfile("C:\\Program Files (x86)\\Microsoft Visual Studio %s\\VC\\bin\\cl.exe")): + elif (os.path.isfile("C:\\Program Files (x86)\\Microsoft Visual Studio %s\\VC\\bin\\cl.exe" % (version))): SDK["VISUALSTUDIO"] = "C:\\Program Files (x86)\\Microsoft Visual Studio %s\\" % (version) elif "VCINSTALLDIR" in os.environ: @@ -2219,7 +2215,11 @@ def SdkAutoDisableSpeedTree(): def AddToPathEnv(path,add): if path in os.environ: - os.environ[path] = add + os.pathsep + os.environ[path] + if sys.platform == 'cygwin' and path != "PATH": + # INCLUDE, LIB, etc. must remain in Windows-style in cygwin. + os.environ[path] = add + ';' + os.environ[path] + else: + os.environ[path] = add + os.pathsep + os.environ[path] else: os.environ[path] = add @@ -2551,6 +2551,10 @@ def CopyFile(dstfile, srcfile): os.symlink(os.readlink(srcfile), dstfile) else: WriteBinaryFile(dstfile, ReadBinaryFile(srcfile)) + + if sys.platform == 'cygwin' and os.path.splitext(dstfile)[1].lower() in ('.dll', '.exe'): + os.chmod(dstfile, 0o755) + JustBuilt([dstfile], [srcfile]) def CopyAllFiles(dstdir, srcdir, suffix=""): @@ -2585,7 +2589,9 @@ def CopyTree(dstdir, srcdir, omitVCS=True): if not omitVCS or entry not in VCS_DIRS: CopyTree(dstpth, srcpth) else: - if sys.platform == 'win32': + if GetHost() == 'windows': + srcdir = srcdir.replace('/', '\\') + dstdir = dstdir.replace('/', '\\') cmd = 'xcopy /I/Y/E/Q "' + srcdir + '" "' + dstdir + '"' else: cmd = 'cp -R -f ' + srcdir + ' ' + dstdir diff --git a/panda/Package.pp b/panda/Package.pp deleted file mode 100644 index 05a50b92e2..0000000000 --- a/panda/Package.pp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Package.pp -// -// This file defines certain configuration variables that are to be -// written into the various make scripts. It is processed by ppremake -// (along with the Sources.pp files in each of the various -// directories) to generate build scripts appropriate to each -// environment. -// -// This is the package-specific file, which should be at the top of -// every source hierarchy. It generally gets the ball rolling, and is -// responsible for explicitly including all of the relevent Config.pp -// files. - -// What is the name and version of this source tree? -#if $[eq $[PACKAGE],] - #define PACKAGE panda - #define VERSION 0.80 -#endif - - -// Where should we find the DTOOL source directory? -#if $[DTOOL_SOURCE] - #define DTOOL_SOURCE $[unixfilename $[DTOOL_SOURCE]] -#elif $[or $[CTPROJS],$[DTOOL]] - // If we are presently attached, use the environment variable. - #define DTOOL_SOURCE $[unixfilename $[DTOOL]] - #if $[eq $[DTOOL],] - #error You seem to be attached to some trees, but not DTOOL! - #endif -#else - // Otherwise, if we are not attached, we guess that the source is a - // sibling directory to this source root. - #define DTOOL_SOURCE $[standardize $[TOPDIR]/../dtool] -#endif - -// Where should we install PANDA? -#if $[PANDA_INSTALL] - #define PANDA_INSTALL $[unixfilename $[PANDA_INSTALL]] -#elif $[CTPROJS] - #set PANDA $[unixfilename $[PANDA]] - #define PANDA_INSTALL $[PANDA]/built - #if $[eq $[PANDA],] - #error You seem to be attached to some trees, but not PANDA! - #endif -#else - #defer PANDA_INSTALL $[unixfilename $[INSTALL_DIR]] -#endif - -// Also get the DTOOL Package file and everything that includes. -#if $[not $[isfile $[DTOOL_SOURCE]/Package.pp]] - #printvar DTOOL_SOURCE - #error DTOOL source directory not found from panda! Are you attached properly? -#endif - -#include $[DTOOL_SOURCE]/Package.pp - -// Define the inter-tree dependencies. -#define NEEDS_TREES dtool $[NEEDS_TREES] -#define DEPENDABLE_HEADER_DIRS $[DEPENDABLE_HEADER_DIRS] $[DTOOL_INSTALL]/include diff --git a/panda/Sources.pp b/panda/Sources.pp deleted file mode 100644 index aab0e6f6d5..0000000000 --- a/panda/Sources.pp +++ /dev/null @@ -1,10 +0,0 @@ -// This is the toplevel directory. It contains configure.in and other -// stuff. - -#define DIR_TYPE toplevel - -#define SAMPLE_SOURCE_FILE src/pandabase/pandabase.cxx -#define REQUIRED_TREES dtool - -#define EXTRA_DIST \ - Config.pp Package.pp Sources.pp diff --git a/panda/metalibs/Sources.pp b/panda/metalibs/Sources.pp deleted file mode 100644 index 93e28f9e7c..0000000000 --- a/panda/metalibs/Sources.pp +++ /dev/null @@ -1,7 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group - -// The metalibs directory always depends on the src directory. -#define DEPENDS src diff --git a/panda/metalibs/panda/Sources.pp b/panda/metalibs/panda/Sources.pp deleted file mode 100644 index 6e853a768a..0000000000 --- a/panda/metalibs/panda/Sources.pp +++ /dev/null @@ -1,40 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDA -#define USE_PACKAGES net - -#define COMPONENT_LIBS \ - p3recorder p3pgraph p3pgraphnodes p3pipeline \ - p3grutil p3chan p3pstatclient \ - p3char p3collide p3cull p3device \ - p3dgraph p3display p3event p3gobj p3gsgbase \ - p3linmath p3mathutil p3movies p3net p3nativenet \ - p3parametrics \ - p3pnmimagetypes p3pnmimage \ - p3pnmtext p3text p3tform p3putil \ - p3audio p3pgui p3pandabase p3dxml - -#define LOCAL_LIBS \ - p3downloader p3express p3pandabase -#define OTHER_LIBS \ - pandaexpress:m \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#if $[LINK_IN_PHYSX] - #define BUILDING_DLL $[BUILDING_DLL] BUILDING_PANDAPHYSX - #define COMPONENT_LIBS $[COMPONENT_LIBS] p3physx -#endif - -#begin metalib_target - #define TARGET panda - - #define SOURCES panda.cxx panda.h - #define INSTALL_HEADERS panda.h -#end metalib_target - diff --git a/panda/metalibs/pandabullet/Sources.pp b/panda/metalibs/pandabullet/Sources.pp deleted file mode 100644 index 9ffe21a707..0000000000 --- a/panda/metalibs/pandabullet/Sources.pp +++ /dev/null @@ -1,20 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILD_DIRECTORY $[HAVE_BULLET] -#define BUILDING_DLL BUILDING_PANDABULLET - -#define COMPONENT_LIBS p3bullet -#define LOCAL_LIBS p3linmath p3putil p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandabullet - #define SOURCES pandabullet.cxx pandabullet.h - #define INSTALL_HEADERS pandabullet.h -#end metalib_target diff --git a/panda/metalibs/pandadx9/Sources.pp b/panda/metalibs/pandadx9/Sources.pp deleted file mode 100644 index e107898137..0000000000 --- a/panda/metalibs/pandadx9/Sources.pp +++ /dev/null @@ -1,24 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_DX9] - -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDADX - -#define COMPONENT_LIBS \ - p3dxgsg9 -#define LOCAL_LIBS p3gsgbase p3display p3express p3gobj -#define OTHER_LIBS p3dtoolconfig p3dtool - -#begin metalib_target - #define TARGET pandadx9 - #define SOURCES pandadx9.cxx - #define WIN_SYS_LIBS \ - ddraw.lib dxguid.lib winmm.lib \ - kernel32.lib gdi32.lib user32.lib advapi32.lib $[WIN_SYS_LIBS] -#end metalib_target - diff --git a/panda/metalibs/pandaegg/Sources.pp b/panda/metalibs/pandaegg/Sources.pp deleted file mode 100644 index ea7b843453..0000000000 --- a/panda/metalibs/pandaegg/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILD_DIRECTORY $[HAVE_EGG] -#define BUILDING_DLL BUILDING_PANDAEGG - -#define COMPONENT_LIBS \ - p3egg2pg egg2sg p3egg - -#define LOCAL_LIBS p3putil p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandaegg - - #define SOURCES pandaegg.cxx pandaegg.h - #define INSTALL_HEADERS pandaegg.h -#end metalib_target diff --git a/panda/metalibs/pandaexpress/Sources.pp b/panda/metalibs/pandaexpress/Sources.pp deleted file mode 100644 index 4cbf790da9..0000000000 --- a/panda/metalibs/pandaexpress/Sources.pp +++ /dev/null @@ -1,21 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAEXPRESS -#define USE_PACKAGES p3net - -#define COMPONENT_LIBS p3downloader p3express p3pandabase -#define OTHER_LIBS p3dconfig:c p3prc:c p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3dtoolconfig:m p3dtool:m - -#begin metalib_target - #define TARGET pandaexpress - - #define SOURCES pandaexpress.cxx - #define WIN_SYS_LIBS \ - advapi32.lib ws2_32.lib $[WIN_SYS_LIBS] - -#end metalib_target diff --git a/panda/metalibs/pandafx/Sources.pp b/panda/metalibs/pandafx/Sources.pp deleted file mode 100644 index c76563220f..0000000000 --- a/panda/metalibs/pandafx/Sources.pp +++ /dev/null @@ -1,19 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAFX - -#define COMPONENT_LIBS \ - p3distort p3effects -#define LOCAL_LIBS p3putil p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandafx - #define SOURCES pandafx.cxx -#end metalib_target diff --git a/panda/metalibs/pandagl/Sources.pp b/panda/metalibs/pandagl/Sources.pp deleted file mode 100644 index da2cc068df..0000000000 --- a/panda/metalibs/pandagl/Sources.pp +++ /dev/null @@ -1,24 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAGL -#define BUILD_DIRECTORY $[HAVE_GL] - -#define COMPONENT_LIBS \ - p3glgsg p3x11display p3glxdisplay \ - p3wgldisplay p3osxdisplay p3cocoadisplay - -#define LOCAL_LIBS p3gsgbase p3display p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandagl - #define SOURCES pandagl.cxx pandagl.h - #define INSTALL_HEADERS pandagl.h - #define WIN_SYS_LIBS opengl32.lib winmm.lib kernel32.lib oldnames.lib user32.lib gdi32.lib -#end metalib_target diff --git a/panda/metalibs/pandagles/Sources.pp b/panda/metalibs/pandagles/Sources.pp deleted file mode 100644 index 06dd9c2837..0000000000 --- a/panda/metalibs/pandagles/Sources.pp +++ /dev/null @@ -1,22 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAGLES -#define BUILD_DIRECTORY $[HAVE_GLES] - -#define COMPONENT_LIBS \ - p3glesgsg p3egldisplay p3androiddisplay - -#define LOCAL_LIBS p3gsgbase p3display p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandagles - #define SOURCES pandagles.cxx pandagles.h - #define INSTALL_HEADERS pandagles.h -#end metalib_target diff --git a/panda/metalibs/pandagles2/Sources.pp b/panda/metalibs/pandagles2/Sources.pp deleted file mode 100644 index 1189b99673..0000000000 --- a/panda/metalibs/pandagles2/Sources.pp +++ /dev/null @@ -1,22 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAGLES2 -#define BUILD_DIRECTORY $[HAVE_GLES2] - -#define COMPONENT_LIBS \ - p3gles2gsg egl2display - -#define LOCAL_LIBS p3gsgbase p3display p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandagles2 - #define SOURCES pandagles2.cxx pandagles2.h - #define INSTALL_HEADERS pandagles2.h -#end metalib_target diff --git a/panda/metalibs/pandaode/Sources.pp b/panda/metalibs/pandaode/Sources.pp deleted file mode 100644 index 8771d21c3f..0000000000 --- a/panda/metalibs/pandaode/Sources.pp +++ /dev/null @@ -1,26 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILD_DIRECTORY $[HAVE_ODE] -#define BUILDING_DLL BUILDING_PANDAODE - -#define COMPONENT_LIBS \ - p3ode - -#define LOCAL_LIBS p3pgraph -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - - -#begin metalib_target -#define TARGET pandaode - - #define SOURCES pandaode.cxx pandaode.h - #define INSTALL_HEADERS pandaode.h - -#end metalib_target - diff --git a/panda/metalibs/pandaphysics/Sources.pp b/panda/metalibs/pandaphysics/Sources.pp deleted file mode 100644 index 48df8f0c1d..0000000000 --- a/panda/metalibs/pandaphysics/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILDING_DLL BUILDING_PANDAPHYSICS - -#define COMPONENT_LIBS \ - p3physics p3particlesystem - -#define LOCAL_LIBS p3linmath p3putil p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandaphysics - - #define SOURCES pandaphysics.cxx pandaphysics.h - #define INSTALL_HEADERS pandaphysics.h - -#end metalib_target diff --git a/panda/metalibs/pandaphysx/Sources.pp b/panda/metalibs/pandaphysx/Sources.pp deleted file mode 100644 index 88534d158f..0000000000 --- a/panda/metalibs/pandaphysx/Sources.pp +++ /dev/null @@ -1,20 +0,0 @@ -// DIR_TYPE "metalib" indicates we are building a shared library that -// consists mostly of references to other shared libraries. Under -// Windows, this directly produces a DLL (as opposed to the regular -// src libraries, which don't produce anything but a pile of OBJ files -// under Windows). - -#define DIR_TYPE metalib -#define BUILD_DIRECTORY $[HAVE_PHYSX] -#define BUILDING_DLL BUILDING_PANDAPHYSX - -#define COMPONENT_LIBS p3physx -#define LOCAL_LIBS p3linmath p3putil p3express -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin metalib_target - #define TARGET pandaphysx - #define SOURCES pandaphysx.cxx pandaphysx.h - #define INSTALL_HEADERS pandaphysx.h -#end metalib_target diff --git a/panda/src/Sources.pp b/panda/src/Sources.pp deleted file mode 100644 index fb8681dab2..0000000000 --- a/panda/src/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group diff --git a/panda/src/audio/Sources.pp b/panda/src/audio/Sources.pp deleted file mode 100644 index 3c439309ae..0000000000 --- a/panda/src/audio/Sources.pp +++ /dev/null @@ -1,51 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define BUILD_DIRECTORY $[HAVE_AUDIO] - -#begin lib_target - #define TARGET p3audio - #define LOCAL_LIBS p3putil p3event p3movies p3linmath - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_audio.h \ - filterProperties.h filterProperties.I\ - audioLoadRequest.h audioLoadRequest.I \ - audioManager.h audioManager.I\ - audioSound.h audioSound.I\ - nullAudioManager.h \ - nullAudioSound.h - - #define INCLUDED_SOURCES \ - config_audio.cxx \ - filterProperties.cxx \ - audioLoadRequest.cxx \ - audioManager.cxx \ - audioSound.cxx \ - nullAudioManager.cxx \ - nullAudioSound.cxx - - #define INSTALL_HEADERS \ - config_audio.h \ - filterProperties.h filterProperties.I\ - audioLoadRequest.h audioLoadRequest.I \ - audioManager.h audioManager.I\ - audioSound.h audioSound.I\ - nullAudioManager.h \ - nullAudioSound.h - - #define IGATESCAN all -#end lib_target - -#begin test_bin_target - #define TARGET test_audio - #define LOCAL_LIBS \ - p3audio - #define OTHER_LIBS \ - $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_audio.cxx - -#end test_bin_target diff --git a/panda/src/audiotraits/Sources.pp b/panda/src/audiotraits/Sources.pp deleted file mode 100644 index 5f7d020123..0000000000 --- a/panda/src/audiotraits/Sources.pp +++ /dev/null @@ -1,87 +0,0 @@ -#define OTHER_LIBS p3dtoolconfig p3dtool p3dtoolbase:c p3dtoolutil:c \ - p3putil:c p3prc:c p3interrogatedb:c p3dconfig:c - -#define BUILD_DIRECTORY $[HAVE_AUDIO] - -#begin lib_target - #define TARGET miles_audio - #define BUILD_TARGET $[HAVE_RAD_MSS] - #define USE_PACKAGES rad_mss - #define BUILDING_DLL BUILDING_MILES_AUDIO - #define LOCAL_LIBS p3audio p3event p3pipeline - #define WIN_SYS_LIBS $[WIN_SYS_LIBS] user32.lib advapi32.lib winmm.lib - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_milesAudio.h \ - milesAudioManager.h \ - milesAudioSound.I milesAudioSound.h \ - milesAudioSample.I milesAudioSample.h \ - milesAudioSequence.I milesAudioSequence.h \ - milesAudioStream.I milesAudioStream.h \ - globalMilesManager.I globalMilesManager.h - - #define INCLUDED_SOURCES \ - config_milesAudio.cxx milesAudioManager.cxx milesAudioSound.cxx \ - milesAudioStream.cxx globalMilesManager.cxx milesAudioSample.cxx \ - milesAudioSequence.cxx - -#end lib_target - -#begin lib_target - #define TARGET p3fmod_audio - #define BUILD_TARGET $[HAVE_FMODEX] - #define USE_PACKAGES fmodex - #define BUILDING_DLL BUILDING_FMOD_AUDIO - #define LOCAL_LIBS p3audio p3event - #define WIN_SYS_LIBS $[WIN_SYS_LIBS] user32.lib advapi32.lib winmm.lib - - #define COMBINED_SOURCES fmod_audio_composite1.cxx - - #define SOURCES \ - config_fmodAudio.h \ - fmodAudioManager.h \ - fmodAudioSound.I fmodAudioSound.h - - #define INCLUDED_SOURCES \ - config_fmodAudio.cxx fmodAudioManager.cxx fmodAudioSound.cxx - -#end lib_target - -#begin lib_target - #define TARGET p3openal_audio - #define BUILD_TARGET $[HAVE_OPENAL] - #define USE_PACKAGES openal - #define BUILDING_DLL BUILDING_OPENAL_AUDIO - #define LOCAL_LIBS p3audio p3event - #define WIN_SYS_LIBS $[WIN_SYS_LIBS] user32.lib advapi32.lib winmm.lib - - #define COMBINED_SOURCES openal_audio_composite1.cxx - - #define SOURCES \ - config_openalAudio.h \ - openalAudioManager.h \ - openalAudioSound.I openalAudioSound.h - - #define INCLUDED_SOURCES \ - config_openalAudio.cxx openalAudioManager.cxx openalAudioSound.cxx - -#end lib_target - -//#begin lib_target -// #define TARGET audio_linux -// #define BUILDING_DLL BUILDING_MISC -// //#define LOCAL_LIBS \ -// // p3audio -// -// #define SOURCES \ -// $[if $[HAVE_SYS_SOUNDCARD_H], \ -// linuxAudioManager.cxx linuxAudioManager.h \ -// linuxAudioSound.cxx linuxAudioSound.h \ -// , \ -// nullAudioManager.cxx nullAudioManager.h \ -// nullAudioSound.cxx nullAudioSound.h \ -// ] -// -//#end lib_target diff --git a/panda/src/awesomium/Sources.pp b/panda/src/awesomium/Sources.pp deleted file mode 100644 index 9f8c512a29..0000000000 --- a/panda/src/awesomium/Sources.pp +++ /dev/null @@ -1,38 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_AWESOMIUM] -#define BUILDING_DLL BUILDING_PANDAAWESOMIUM - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - //I don't understand why ode can have TARGET as just p3ode, here it needs pandaawesomium - #define TARGET pandaawesomium - #define LOCAL_LIBS \ - p3pgraph p3physics - - #define USE_PACKAGES awesomium - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - awesomium_includes.h config_awesomium.h \ - awWebCore.I awWebCore.h \ - awWebView.I awWebView.h \ - awWebViewListener.I awWebViewListener.h - - #define INCLUDED_SOURCES \ - config_awesomium.cxx \ - awWebCore.cxx \ - awWebView.cxx \ - awWebViewListener.cxx - - #define INSTALL_HEADERS \ - awesomium_includes.h config_awesomium.h \ - awWebCore.h awWebCore.I \ - awWebView.h awWebView.I \ - awWebViewListener.I awWebViewListener.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/bullet/Sources.pp b/panda/src/bullet/Sources.pp deleted file mode 100644 index b45e95395b..0000000000 --- a/panda/src/bullet/Sources.pp +++ /dev/null @@ -1,165 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_BULLET] -#define BUILDING_DLL BUILDING_PANDABULLET - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3bullet - #define LOCAL_LIBS p3pgraph p3linmath p3grutil - #define USE_PACKAGES bullet - #define COMBINED_SOURCES $[TARGET]_composite.cxx - - #define SOURCES \ - bulletAllHitsRayResult.h bulletAllHitsRayResult.I \ - bulletBaseCharacterControllerNode.h bulletBaseCharacterControllerNode.I \ - bulletBodyNode.h bulletBodyNode.I \ - bulletBoxShape.h bulletBoxShape.I \ - bulletCapsuleShape.h bulletCapsuleShape.I \ - bulletCharacterControllerNode.h bulletCharacterControllerNode.I \ - bulletClosestHitRayResult.h bulletClosestHitRayResult.I \ - bulletClosestHitSweepResult.h bulletClosestHitSweepResult.I \ - bulletConeShape.h bulletConeShape.I \ - bulletConeTwistConstraint.h bulletConeTwistConstraint.I \ - bulletConstraint.h bulletConstraint.I \ - bulletContactCallbackData.h bulletContactCallbackData.I \ - bulletContactCallbacks.h \ - bulletContactResult.h bulletContactResult.I \ - bulletConvexHullShape.h bulletConvexHullShape.I \ - bulletConvexPointCloudShape.h bulletConvexPointCloudShape.I \ - bulletCylinderShape.h bulletCylinderShape.I \ - bulletDebugNode.h bulletDebugNode.I \ - bulletFilterCallbackData.h bulletFilterCallbackData.I \ - bulletGenericConstraint.h bulletGenericConstraint.I \ - bulletGhostNode.h bulletGhostNode.I \ - bulletHeightfieldShape.h bulletHeightfieldShape.I \ - bulletHelper.h bulletHelper.I \ - bulletHingeConstraint.h bulletHingeConstraint.I \ - bulletManifoldPoint.h bulletManifoldPoint.I \ - bulletMinkowskiSumShape.h bulletMinkowskiSumShape.I \ - bulletMultiSphereShape.h bulletMultiSphereShape.I \ - bulletPersistentManifold.h bulletPersistentManifold.I \ - bulletPlaneShape.h bulletPlaneShape.I \ - bulletRigidBodyNode.h bulletRigidBodyNode.I \ - bulletShape.h bulletShape.I \ - bulletSliderConstraint.h bulletSliderConstraint.I \ - bulletSoftBodyConfig.h bulletSoftBodyConfig.I \ - bulletSoftBodyControl.h bulletSoftBodyControl.I \ - bulletSoftBodyMaterial.h bulletSoftBodyMaterial.I \ - bulletSoftBodyNode.h bulletSoftBodyNode.I \ - bulletSoftBodyShape.h bulletSoftBodyShape.I \ - bulletSoftBodyWorldInfo.h bulletSoftBodyWorldInfo.I \ - bulletSphereShape.h bulletSphereShape.I \ - bulletSphericalConstraint.h bulletSphericalConstraint.I \ - bulletTickCallbackData.h bulletTickCallbackData.I \ - bulletTriangleMesh.h bulletTriangleMesh.I \ - bulletTriangleMeshShape.h bulletTriangleMeshShape.I \ - bulletVehicle.h bulletVehicle.I \ - bulletWheel.h bulletWheel.I \ - bulletWorld.h bulletWorld.I \ - bullet_includes.h \ - bullet_utils.h bullet_utils.I \ - config_bullet.h - - #define INCLUDED_SOURCES \ - bulletAllHitsRayResult.cxx \ - bulletBaseCharacterControllerNode.cxx \ - bulletBodyNode.cxx \ - bulletBoxShape.cxx \ - bulletCapsuleShape.cxx \ - bulletCharacterControllerNode.cxx \ - bulletClosestHitRayResult.cxx \ - bulletClosestHitSweepResult.cxx \ - bulletConeShape.cxx \ - bulletConeTwistConstraint.cxx \ - bulletConstraint.cxx \ - bulletContactCallbackData.cxx \ - bulletContactResult.cxx \ - bulletConvexHullShape.cxx \ - bulletConvexPointCloudShape.cxx \ - bulletCylinderShape.cxx \ - bulletDebugNode.cxx \ - bulletFilterCallbackData.cxx \ - bulletGenericConstraint.cxx \ - bulletGhostNode.cxx \ - bulletHeightfieldShape.cxx \ - bulletHelper.cxx \ - bulletHingeConstraint.cxx \ - bulletManifoldPoint.cxx \ - bulletMinkowskiSumShape.cxx \ - bulletMultiSphereShape.cxx \ - bulletPersistentManifold.cxx \ - bulletPlaneShape.cxx \ - bulletRigidBodyNode.cxx \ - bulletShape.cxx \ - bulletSliderConstraint.cxx \ - bulletSoftBodyConfig.cxx \ - bulletSoftBodyControl.cxx \ - bulletSoftBodyMaterial.cxx \ - bulletSoftBodyNode.cxx \ - bulletSoftBodyShape.cxx \ - bulletSoftBodyWorldInfo.cxx \ - bulletSphereShape.cxx \ - bulletSphericalConstraint.cxx \ - bulletTickCallbackData.cxx \ - bulletTriangleMesh.cxx \ - bulletTriangleMeshShape.cxx \ - bulletVehicle.cxx \ - bulletWheel.cxx \ - bulletWorld.cxx \ - bullet_utils.cxx \ - config_bullet.cxx - - #define INSTALL_HEADERS \ - bulletAllHitsRayResult.h bulletAllHitsRayResult.I \ - bulletBaseCharacterControllerNode.h bulletBaseCharacterControllerNode.I \ - bulletBodyNode.h bulletBodyNode.I \ - bulletBoxShape.h bulletBoxShape.I \ - bulletCapsuleShape.h bulletCapsuleShape.I \ - bulletCharacterControllerNode.h bulletCharacterControllerNode.I \ - bulletClosestHitRayResult.h bulletClosestHitRayResult.I \ - bulletClosestHitSweepResult.h bulletClosestHitSweepResult.I \ - bulletConeShape.h bulletConeShape.I \ - bulletConeTwistConstraint.h bulletConeTwistConstraint.I \ - bulletConstraint.h bulletConstraint.I \ - bulletContactCallbackData.h bulletContactCallbackData.I \ - bulletContactCallbacks.h \ - bulletContactResult.h bulletContactResult.I \ - bulletConvexHullShape.h bulletConvexHullShape.I \ - bulletConvexPointCloudShape.h bulletConvexPointCloudShape.I \ - bulletCylinderShape.h bulletCylinderShape.I \ - bulletDebugNode.h bulletDebugNode.I \ - bulletFilterCallbackData.h bulletFilterCallbackData.I \ - bulletGenericConstraint.h bulletGenericConstraint.I \ - bulletGhostNode.h bulletGhostNode.I \ - bulletHeightfieldShape.h bulletHeightfieldShape.I \ - bulletHelper.h bulletHelper.I \ - bulletHingeConstraint.h bulletHingeConstraint.I \ - bulletManifoldPoint.h bulletManifoldPoint.I \ - bulletMinkowskiSumShape.h bulletMinkowskiSumShape.I \ - bulletMultiSphereShape.h bulletMultiSphereShape.I \ - bulletPersistentManifold.h bulletPersistentManifold.I \ - bulletPlaneShape.h bulletPlaneShape.I \ - bulletRigidBodyNode.h bulletRigidBodyNode.I \ - bulletShape.h bulletShape.I \ - bulletSliderConstraint.h bulletSliderConstraint.I \ - bulletSoftBodyConfig.h bulletSoftBodyConfig.I \ - bulletSoftBodyControl.h bulletSoftBodyControl.I \ - bulletSoftBodyMaterial.h bulletSoftBodyMaterial.I \ - bulletSoftBodyNode.h bulletSoftBodyNode.I \ - bulletSoftBodyShape.h bulletSoftBodyShape.I \ - bulletSoftBodyWorldInfo.h bulletSoftBodyWorldInfo.I \ - bulletSphereShape.h bulletSphereShape.I \ - bulletSphericalConstraint.h bulletSphericalConstraint.I \ - bulletTickCallbackData.h bulletTickCallbackData.I \ - bulletTriangleMesh.h bulletTriangleMesh.I \ - bulletTriangleMeshShape.h bulletTriangleMeshShape.I \ - bulletVehicle.h bulletVehicle.I \ - bulletWheel.h bulletWheel.I \ - bulletWorld.h bulletWorld.I \ - bullet_includes.h \ - bullet_utils.h bullet_utils.I \ - config_bullet.h - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/cftalk/Sources.pp b/panda/src/cftalk/Sources.pp deleted file mode 100644 index f2f7a23f93..0000000000 --- a/panda/src/cftalk/Sources.pp +++ /dev/null @@ -1,24 +0,0 @@ -#define BUILDING_DLL BUILDING_CFTALK - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3cftalk - #define LOCAL_LIBS \ - p3gsgbase p3gobj p3display \ - p3putil p3linmath p3mathutil p3pnmimage - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_cftalk.h \ - cfChannel.h cfChannel.I \ - cfCommand.h cfCommand.I - - #define INCLUDED_SOURCES \ - cfChannel.cxx \ - cfCommand.cxx - -#end lib_target - diff --git a/panda/src/chan/Sources.pp b/panda/src/chan/Sources.pp deleted file mode 100644 index c6a84da277..0000000000 --- a/panda/src/chan/Sources.pp +++ /dev/null @@ -1,90 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3chan - #define LOCAL_LIBS \ - p3pgraph p3putil p3linmath p3mathutil p3event - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - animBundle.I animBundle.h \ - animBundleNode.I animBundleNode.h \ - animChannel.I animChannel.h animChannelBase.I \ - animChannelBase.h \ - animChannelMatrixDynamic.I animChannelMatrixDynamic.h \ - animChannelMatrixFixed.I animChannelMatrixFixed.h \ - animChannelMatrixXfmTable.I animChannelMatrixXfmTable.h \ - animChannelScalarDynamic.I animChannelScalarDynamic.h \ - animChannelScalarTable.I animChannelScalarTable.h \ - animControl.I animControl.N \ - animControl.h animControlCollection.I \ - animControlCollection.h animGroup.I animGroup.h \ - animPreloadTable.I animPreloadTable.h \ - auto_bind.h \ - bindAnimRequest.I bindAnimRequest.h \ - config_chan.h \ - movingPart.I movingPart.h \ - movingPartBase.I movingPartBase.h \ - movingPartMatrix.I movingPartMatrix.h movingPartScalar.I \ - movingPartScalar.h partBundle.I partBundle.N partBundle.h \ - partBundleHandle.I partBundleHandle.h \ - partBundleNode.I partBundleNode.h \ - partGroup.I partGroup.h \ - partSubset.I partSubset.h \ - vector_PartGroupStar.h - - #define INCLUDED_SOURCES \ - animBundle.cxx \ - animBundleNode.cxx \ - animChannel.cxx \ - animChannelBase.cxx \ - animChannelMatrixDynamic.cxx \ - animChannelMatrixFixed.cxx \ - animChannelMatrixXfmTable.cxx \ - animChannelScalarDynamic.cxx \ - animChannelScalarTable.cxx \ - animControl.cxx \ - animControlCollection.cxx animGroup.cxx \ - animPreloadTable.cxx \ - auto_bind.cxx \ - bindAnimRequest.cxx \ - config_chan.cxx movingPartBase.cxx movingPartMatrix.cxx \ - movingPartScalar.cxx partBundle.cxx \ - partBundleHandle.cxx \ - partBundleNode.cxx \ - partGroup.cxx \ - partSubset.cxx \ - vector_PartGroupStar.cxx - - #define INSTALL_HEADERS \ - animBundle.I animBundle.h \ - animBundleNode.I animBundleNode.h \ - animChannel.I animChannel.h animChannelBase.I animChannelBase.h \ - animChannelFixed.I animChannelFixed.h \ - animChannelMatrixDynamic.I animChannelMatrixDynamic.h \ - animChannelMatrixFixed.I animChannelMatrixFixed.h \ - animChannelMatrixXfmTable.I animChannelMatrixXfmTable.h \ - animChannelScalarDynamic.I animChannelScalarDynamic.h \ - animChannelScalarTable.I animChannelScalarTable.h \ - animControl.I animControl.h \ - animControlCollection.I animControlCollection.h animGroup.I \ - animGroup.h \ - animPreloadTable.I animPreloadTable.h \ - auto_bind.h \ - bindAnimRequest.I bindAnimRequest.h \ - config_chan.h \ - movingPart.I movingPart.h movingPartBase.I \ - movingPartBase.h movingPartMatrix.I movingPartMatrix.h \ - movingPartScalar.I movingPartScalar.h partBundle.I partBundle.h \ - partBundleHandle.I partBundleHandle.h \ - partBundleNode.I partBundleNode.h \ - partGroup.I partGroup.h \ - partSubset.I partSubset.h \ - vector_PartGroupStar.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/char/Sources.pp b/panda/src/char/Sources.pp deleted file mode 100644 index ea0d17a5eb..0000000000 --- a/panda/src/char/Sources.pp +++ /dev/null @@ -1,44 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3char - #define LOCAL_LIBS \ - p3chan p3linmath p3putil p3event p3mathutil p3gsgbase \ - p3pstatclient - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - character.I character.h \ - characterJoint.I characterJoint.h \ - characterJointBundle.I characterJointBundle.h \ - characterJointEffect.h characterJointEffect.I \ - characterSlider.h \ - characterVertexSlider.I characterVertexSlider.h \ - config_char.h \ - jointVertexTransform.I jointVertexTransform.h - - #define INCLUDED_SOURCES \ - character.cxx \ - characterJoint.cxx characterJointBundle.cxx \ - characterJointEffect.cxx \ - characterSlider.cxx \ - characterVertexSlider.cxx \ - config_char.cxx \ - jointVertexTransform.cxx - - #define INSTALL_HEADERS \ - character.I character.h \ - characterJoint.I characterJoint.h \ - characterJointBundle.I characterJointBundle.h \ - characterJointEffect.h characterJointEffect.I \ - characterSlider.h \ - characterVertexSlider.I characterVertexSlider.h \ - config_char.h \ - jointVertexTransform.I jointVertexTransform.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/cocoadisplay/Sources.pp b/panda/src/cocoadisplay/Sources.pp deleted file mode 100644 index f0e136fe61..0000000000 --- a/panda/src/cocoadisplay/Sources.pp +++ /dev/null @@ -1,35 +0,0 @@ -#define BUILD_DIRECTORY $[and $[IS_OSX],$[HAVE_GL],$[HAVE_COCOA]] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#define OSX_SYS_FRAMEWORKS ApplicationServices AppKit Carbon - -#begin lib_target - #define TARGET p3cocoadisplay - #define LOCAL_LIBS \ - p3display p3putil p3glgsg - - #define COMBINED_SOURCES $[TARGET]_composite1.mm - - #define INSTALL_HEADERS \ - config_cocoadisplay.h \ - cocoaGraphicsPipe.h cocoaGraphicsPipe.I \ - cocoaGraphicsWindow.h cocoaGraphicsWindow.I \ - cocoaGraphicsStateGuardian.h cocoaGraphicsStateGuardian.I \ - cocoaPandaApp.h cocoaPandaView.h cocoaPandaWindowDelegate.h - - #define INCLUDED_SOURCES \ - config_cocoadisplay.mm \ - cocoaGraphicsPipe.mm \ - cocoaGraphicsStateGuardian.mm \ - cocoaGraphicsWindow.mm \ - cocoaPandaApp.mm \ - cocoaPandaView.mm \ - cocoaPandaWindow.mm \ - cocoaPandaWindowDelegate.mm - - #define SOURCES \ - $[INSTALL_HEADERS] - -#end lib_target diff --git a/panda/src/collada/Sources.pp b/panda/src/collada/Sources.pp deleted file mode 100644 index bca6e5edef..0000000000 --- a/panda/src/collada/Sources.pp +++ /dev/null @@ -1,43 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define LOCAL_LIBS p3display p3pgraph p3express p3putil p3pandabase - -#define COMBINED_SOURCES p3collada_composite1.cxx - -#define SOURCES \ - colladaBindMaterial.cxx \ - colladaBindMaterial.h \ - colladaInput.cxx \ - colladaInput.h colladaInput.I \ - colladaLoader.cxx \ - colladaLoader.h colladaLoader.I \ - colladaPrimitive.cxx \ - colladaPrimitive.h colladaPrimitive.I \ - config_collada.h \ - load_collada_file.h \ - loaderFileTypeDae.h - -#define INCLUDED_SOURCES \ - config_collada.cxx \ - load_collada_file.cxx \ - loaderFileTypeDae.cxx - -#define INSTALL_HEADERS \ - config_collada.h \ - load_collada_file.h \ - loaderFileTypeDae.h - -#begin lib_target - #define BUILD_TARGET $[HAVE_COLLADA14DOM] - #define USE_PACKAGES collada14dom - #define EXTRA_CDEFS PANDA_COLLADA_VERSION=14 - #define TARGET p3collada14 -#end lib_target - -#begin lib_target - #define BUILD_TARGET $[HAVE_COLLADA15DOM] - #define USE_PACKAGES collada15dom - #define EXTRA_CDEFS PANDA_COLLADA_VERSION=15 - #define TARGET p3collada15 -#end lib_target diff --git a/panda/src/collide/Sources.pp b/panda/src/collide/Sources.pp deleted file mode 100644 index 82c4733ab8..0000000000 --- a/panda/src/collide/Sources.pp +++ /dev/null @@ -1,122 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3collide - #define LOCAL_LIBS \ - p3tform p3gobj p3pgraph p3putil \ - p3pstatclient - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - collisionBox.I collisionBox.h \ - collisionEntry.I collisionEntry.h \ - collisionGeom.I collisionGeom.h \ - collisionHandler.I collisionHandler.h \ - collisionHandlerEvent.I collisionHandlerEvent.h \ - collisionHandlerHighestEvent.h \ - collisionHandlerFloor.I collisionHandlerFloor.h \ - collisionHandlerGravity.I collisionHandlerGravity.h \ - collisionHandlerPhysical.I collisionHandlerPhysical.h \ - collisionHandlerPusher.I collisionHandlerPusher.h \ - collisionHandlerFluidPusher.I collisionHandlerFluidPusher.h \ - collisionHandlerQueue.h \ - collisionInvSphere.I collisionInvSphere.h \ - collisionLine.I collisionLine.h \ - collisionLevelStateBase.I collisionLevelStateBase.h \ - collisionLevelState.I collisionLevelState.h \ - collisionNode.I collisionNode.h \ - collisionParabola.I collisionParabola.h \ - collisionPlane.I collisionPlane.h \ - collisionPolygon.I collisionPolygon.h \ - collisionFloorMesh.I collisionFloorMesh.h \ - collisionRay.I collisionRay.h \ - collisionRecorder.I collisionRecorder.h \ - collisionSegment.I collisionSegment.h \ - collisionSolid.I collisionSolid.h \ - collisionSphere.I collisionSphere.h \ - collisionTraverser.I collisionTraverser.h \ - collisionTube.I collisionTube.h \ - collisionVisualizer.I collisionVisualizer.h \ - config_collide.h - - #define INCLUDED_SOURCES \ - collisionBox.cxx \ - collisionEntry.cxx \ - collisionGeom.cxx \ - collisionHandler.cxx \ - collisionHandlerEvent.cxx \ - collisionHandlerHighestEvent.cxx \ - collisionHandlerFloor.cxx \ - collisionHandlerGravity.cxx \ - collisionHandlerPhysical.cxx \ - collisionHandlerPusher.cxx \ - collisionHandlerFluidPusher.cxx \ - collisionHandlerQueue.cxx \ - collisionLevelStateBase.cxx \ - collisionLevelState.cxx \ - collisionInvSphere.cxx \ - collisionLine.cxx \ - collisionNode.cxx \ - collisionParabola.cxx \ - collisionPlane.cxx \ - collisionPolygon.cxx \ - collisionFloorMesh.cxx \ - collisionRay.cxx \ - collisionRecorder.cxx \ - collisionSegment.cxx \ - collisionSolid.cxx \ - collisionSphere.cxx \ - collisionTraverser.cxx \ - collisionTube.cxx \ - collisionVisualizer.cxx \ - config_collide.cxx - - #define INSTALL_HEADERS \ - collisionBox.I collisionBox.h \ - collisionEntry.I collisionEntry.h \ - collisionGeom.I collisionGeom.h \ - collisionHandler.I collisionHandler.h \ - collisionHandlerEvent.I collisionHandlerEvent.h \ - collisionHandlerHighestEvent.h \ - collisionHandlerFloor.I collisionHandlerFloor.h \ - collisionHandlerGravity.I collisionHandlerGravity.h \ - collisionHandlerPhysical.I collisionHandlerPhysical.h \ - collisionHandlerPusher.I collisionHandlerPusher.h \ - collisionHandlerFluidPusher.I collisionHandlerFluidPusher.h \ - collisionHandlerQueue.h \ - collisionInvSphere.I collisionInvSphere.h \ - collisionLevelStateBase.I collisionLevelStateBase.h \ - collisionLevelState.I collisionLevelState.h \ - collisionLine.I collisionLine.h \ - collisionNode.I collisionNode.h \ - collisionParabola.I collisionParabola.h \ - collisionPlane.I collisionPlane.h \ - collisionPolygon.I collisionPolygon.h \ - collisionFloorMesh.I collisionFloorMesh.h \ - collisionRay.I collisionRay.h \ - collisionRecorder.I collisionRecorder.h \ - collisionSegment.I collisionSegment.h \ - collisionSolid.I collisionSolid.h \ - collisionSphere.I collisionSphere.h \ - collisionTraverser.I collisionTraverser.h \ - collisionTube.I collisionTube.h \ - collisionVisualizer.I collisionVisualizer.h \ - config_collide.h - - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_collide - #define LOCAL_LIBS \ - p3collide - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_collide.cxx - -#end test_bin_target diff --git a/panda/src/configfiles/Sources.pp b/panda/src/configfiles/Sources.pp deleted file mode 100644 index df0d016b2f..0000000000 --- a/panda/src/configfiles/Sources.pp +++ /dev/null @@ -1,12 +0,0 @@ - -#define INSTALL_CONFIG \ - panda.emacs panda.emacs.Xdefaults 20_panda.prc - - -#if $[CTPROJS] - // These files only matter to ctattach users. - #define INSTALL_CONFIG $[INSTALL_CONFIG] panda.init -#endif - - -#include $[THISDIRPREFIX]panda.prc.pp diff --git a/panda/src/configfiles/panda.prc.pp b/panda/src/configfiles/panda.prc.pp deleted file mode 100644 index 1a7f6099fa..0000000000 --- a/panda/src/configfiles/panda.prc.pp +++ /dev/null @@ -1,151 +0,0 @@ -// -// panda.prc.pp -// -// This file defines the script to auto-generate panda.prc at -// ppremake time. This is intended to fill in some of the default -// parameters, in particular the default display types. -// - -#output 20_panda.prc notouch -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - -plugin-path $THIS_PRC_DIR/../lib - -# Let's set up a default window size of 800x600. The user can -# override this in his or her personal prc file. -win-size 800 600 - -# Define the display types that have been compiled in. Panda will -# pick one of these by going through the list in this order until one -# is found that works, unless the user specifically requests a -# particular display type with the load-display directive. - -#if $[HAVE_DX9] -aux-display pandadx9 -#endif -#if $[HAVE_GL] -aux-display pandagl -#endif -#if $[HAVE_TINYDISPLAY] -aux-display p3tinydisplay -#endif - -# Define an appropriate default audio library. -#if $[HAVE_RAD_MSS] -audio-library-name p3miles_audio -#elif $[HAVE_FMODEX] -audio-library-name p3fmod_audio -#elif $[HAVE_OPENAL] -audio-library-name p3openal_audio -#endif - - -# The egg loader is handy to have available by default. This allows -# clients to load egg files. (The bam loader is built-in so bam files -# are always loadable). - -# By qualifying with the extension "egg", we indicate the egg loader -# should be made available only if you explicitly name a file with an -# .egg extension. - -# Also see ptloader, which is built as part of pandatool; it allows -# files of more exotic types (like .flt, .mb, .lwo, and .dxf) to be -# loaded directly into Panda. - -load-file-type egg pandaegg - - -# These entries work very similar to load-file-type, except they are -# used by the MovieVideo and MovieAudio code to determine which module -# should be loaded in order to decode files of the given extension. - -# ffmpeg is added by default because it used to be compiled in. -# The * is a special catch-all extension that is consulted unless a -# loader has been defined with an explicit extension. - -load-audio-type * p3ffmpeg -load-video-type * p3ffmpeg - - -# The following lines define some handy object types to use within the -# egg syntax. This remaps { name } into whatever egg -# syntax is given by egg-object-type-name, which makes a handy -# abbreviation for modeling packages (like Maya) to insert -# sophisticated egg syntax into the generated egg file, using a single -# object type string. - -egg-object-type-portal portal { 1 } -egg-object-type-polylight polylight { 1 } -egg-object-type-seq24 { 1 } fps { 24 } -egg-object-type-seq12 { 1 } fps { 12 } -egg-object-type-seq10 { 1 } fps { 10 } -egg-object-type-seq8 { 1 } fps { 8 } -egg-object-type-seq6 { 1} fps { 6 } -egg-object-type-seq4 { 1} fps { 4 } -egg-object-type-seq2 { 1} fps { 2 } -egg-object-type-indexed indexed { 1 } - -egg-object-type-binary alpha { binary } -egg-object-type-dual alpha { dual } -egg-object-type-glass alpha { blend_no_occlude } - -# These are just shortcuts to define the Model and DCS flags, which -# indicate nodes that should not be flattened out of the hierarchy -# during the conversion process. DCS goes one step further and -# indicates that the node's transform is important and should be -# preserved (DCS stands for Dynamic Coordinate System). Notouch is -# even stronger, and means not to do any flattening below the node at -# all. -egg-object-type-model { 1 } -egg-object-type-dcs { 1 } -egg-object-type-notouch { no_touch } - -# The following define various kinds of collision geometry. These -# mark the geometry at this level and below as invisible collision -# polygons, which can be used by Panda's collision system to detect -# collisions more optimally than regular visible polygons. -egg-object-type-barrier { Polyset descend } -egg-object-type-sphere { Sphere descend } -egg-object-type-invsphere { InvSphere descend } -egg-object-type-tube { Tube descend } - -# As above, but these are flagged to be "intangible", so that they -# will trigger an event but not stop an object from passing through. -egg-object-type-trigger { Polyset descend intangible } -egg-object-type-trigger-sphere { Sphere descend intangible } - -# "floor" and "dupefloor" define the nodes in question as floor -# polygons. dupefloor means to duplicate the geometry first so that -# the same polygons serve both as visible geometry and as collision -# polygons. -egg-object-type-floor { Polyset descend level } -egg-object-type-dupefloor { Polyset keep descend level } - -# "bubble" puts an invisible bubble around an object, but does not -# otherwise remove the geometry. -egg-object-type-bubble { Sphere keep descend } - -# "ghost" turns off the normal collide bit that is set on visible -# geometry by default, so that if you are using visible geometry for -# collisions, this particular geometry will not be part of those -# collisions--it is ghostlike. -egg-object-type-ghost collide-mask { 0 } - -# "glow" is useful for halo effects and things of that ilk. It -# renders the object in add mode instead of the normal opaque mode. -egg-object-type-glow blend { add } - -# This isn't used in the egg loader, it controls a setting only within -# maya2egg itself. So if it appears in an egg file, it means nothing. -egg-object-type-keep-all-uvsets - -#if $[HAVE_SPEEDTREE] -# If we have the SpeedTree library available, we'll want to use it for -# loading compiled SpeedTree tree objects, and SpeedTree forest -# tables. -load-file-type srt pandaspeedtree -load-file-type stf pandaspeedtree -#endif - -#end 20_panda.prc diff --git a/panda/src/cull/Sources.pp b/panda/src/cull/Sources.pp deleted file mode 100644 index 0d89b1d4da..0000000000 --- a/panda/src/cull/Sources.pp +++ /dev/null @@ -1,46 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define LOCAL_LIBS \ - p3pgraph p3event p3gsgbase p3gobj p3putil p3linmath \ - p3downloader p3express p3pandabase p3pstatclient - - -#begin lib_target - #define TARGET p3cull - - #define SOURCES \ - binCullHandler.h binCullHandler.I \ - config_cull.h \ - cullBinBackToFront.h cullBinBackToFront.I \ - cullBinFixed.h cullBinFixed.I \ - cullBinFrontToBack.h cullBinFrontToBack.I \ - cullBinStateSorted.h cullBinStateSorted.I \ - cullBinUnsorted.h cullBinUnsorted.I \ - drawCullHandler.h drawCullHandler.I - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define INCLUDED_SOURCES \ - binCullHandler.cxx \ - config_cull.cxx \ - cullBinBackToFront.cxx \ - cullBinFixed.cxx \ - cullBinFrontToBack.cxx \ - cullBinStateSorted.cxx \ - cullBinUnsorted.cxx \ - drawCullHandler.cxx - - #define INSTALL_HEADERS \ - binCullHandler.h binCullHandler.I \ - config_cull.h \ - cullBinBackToFront.h cullBinBackToFront.I \ - cullBinFixed.h cullBinFixed.I \ - cullBinFrontToBack.h cullBinFrontToBack.I \ - cullBinStateSorted.h cullBinStateSorted.I \ - cullBinUnsorted.h cullBinUnsorted.I \ - drawCullHandler.h drawCullHandler.I - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/device/Sources.pp b/panda/src/device/Sources.pp deleted file mode 100644 index 0c38ba1016..0000000000 --- a/panda/src/device/Sources.pp +++ /dev/null @@ -1,57 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3device - #define LOCAL_LIBS \ - p3dgraph p3display p3gobj p3gsgbase p3mathutil p3linmath p3putil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - analogNode.I analogNode.h \ - buttonNode.I buttonNode.h \ - clientAnalogDevice.I clientAnalogDevice.h clientBase.I \ - clientBase.h clientButtonDevice.I clientButtonDevice.h \ - clientDevice.I clientDevice.h clientDialDevice.I \ - clientDialDevice.h clientTrackerDevice.I \ - clientTrackerDevice.h config_device.h \ - dialNode.I dialNode.h \ - mouseAndKeyboard.h \ - trackerData.I trackerData.h \ - trackerNode.I trackerNode.h \ - virtualMouse.h - - #define INCLUDED_SOURCES \ - analogNode.cxx \ - buttonNode.cxx \ - clientAnalogDevice.cxx \ - clientBase.cxx clientButtonDevice.cxx clientDevice.cxx \ - clientDialDevice.cxx clientTrackerDevice.cxx \ - config_device.cxx \ - dialNode.cxx \ - mouseAndKeyboard.cxx \ - trackerData.cxx \ - trackerNode.cxx \ - virtualMouse.cxx - - #define INSTALL_HEADERS \ - analogNode.I analogNode.h \ - buttonNode.I buttonNode.h \ - clientAnalogDevice.I clientAnalogDevice.h \ - clientBase.I clientBase.h \ - clientButtonDevice.I clientButtonDevice.h \ - clientDevice.I clientDevice.h \ - clientDialDevice.I clientDialDevice.h \ - clientTrackerDevice.I clientTrackerDevice.h \ - config_device.h \ - mouseAndKeyboard.h \ - dialNode.I dialNode.h \ - trackerData.I trackerData.h \ - trackerNode.I trackerNode.h \ - virtualMouse.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/dgraph/Sources.pp b/panda/src/dgraph/Sources.pp deleted file mode 100644 index 71eea809db..0000000000 --- a/panda/src/dgraph/Sources.pp +++ /dev/null @@ -1,32 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3dgraph - #define LOCAL_LIBS \ - p3pstatclient p3pgraph p3putil p3mathutil p3event - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_dgraph.h \ - dataGraphTraverser.I dataGraphTraverser.h \ - dataNode.I dataNode.h \ - dataNodeTransmit.I dataNodeTransmit.h - - #define INCLUDED_SOURCES \ - config_dgraph.cxx \ - dataGraphTraverser.cxx \ - dataNode.cxx \ - dataNodeTransmit.cxx - - #define INSTALL_HEADERS \ - config_dgraph.h \ - dataGraphTraverser.I dataGraphTraverser.h \ - dataNode.I dataNode.h \ - dataNodeTransmit.I dataNodeTransmit.h - - #define IGATESCAN \ - all - -#end lib_target diff --git a/panda/src/display/Sources.pp b/panda/src/display/Sources.pp deleted file mode 100644 index 2edfb51d86..0000000000 --- a/panda/src/display/Sources.pp +++ /dev/null @@ -1,151 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define WIN_SYS_LIBS $[WIN_SYS_LIBS] ws2_32.lib - -#begin lib_target - #define TARGET p3display - #define LOCAL_LIBS \ - p3pgraph p3pgraphnodes p3cull p3putil p3gsgbase p3gobj p3linmath p3mathutil \ - p3pstatclient - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - standardMunger.I standardMunger.h \ - config_display.h \ - $[if $[HAVE_PYTHON], pythonGraphicsWindowProc.h] \ - $[if $[HAVE_PYTHON], pythonGraphicsWindowProc.cxx] \ - callbackGraphicsWindow.I callbackGraphicsWindow.h \ - drawableRegion.I drawableRegion.h \ - displayRegion.I displayRegion.h \ - displayRegionCullCallbackData.I displayRegionCullCallbackData.h \ - displayRegionDrawCallbackData.I displayRegionDrawCallbackData.h \ - frameBufferProperties.I frameBufferProperties.h \ - get_x11.h pre_x11_include.h post_x11_include.h \ - graphicsEngine.I graphicsEngine.h \ - graphicsOutput.I graphicsOutput.h \ - graphicsBuffer.I graphicsBuffer.h \ - graphicsDevice.h graphicsDevice.I \ - graphicsPipe.I graphicsPipe.h \ - graphicsPipeSelection.I graphicsPipeSelection.h \ - graphicsStateGuardian.I graphicsStateGuardian.h \ - graphicsStateGuardian_ext.cxx graphicsStateGuardian_ext.h \ - graphicsThreadingModel.I graphicsThreadingModel.h \ - graphicsWindow.I graphicsWindow.h \ - graphicsWindow_ext.cxx graphicsWindow_ext.h \ - graphicsWindowInputDevice.I \ - graphicsWindowInputDevice.h \ - graphicsWindowProc.h \ - graphicsWindowProcCallbackData.I graphicsWindowProcCallbackData.h \ - nativeWindowHandle.I nativeWindowHandle.h \ - parasiteBuffer.I parasiteBuffer.h \ - pStatGPUTimer.I pStatGPUTimer.h \ - windowHandle.I windowHandle.h \ - windowProperties.I windowProperties.h \ - renderBuffer.h \ - stereoDisplayRegion.I stereoDisplayRegion.h \ - displaySearchParameters.h \ - displayInformation.h \ - subprocessWindow.h subprocessWindow.I \ - $[if $[OSX_PLATFORM], subprocessWindowBuffer.h subprocessWindowBuffer.I] \ - touchInfo.h - - - #define INCLUDED_SOURCES \ - standardMunger.cxx \ - config_display.cxx \ - callbackGraphicsWindow.cxx \ - drawableRegion.cxx \ - displayRegion.cxx \ - displayRegionCullCallbackData.cxx \ - displayRegionDrawCallbackData.cxx \ - displaySearchParameters.cxx \ - displayInformation.cxx \ - frameBufferProperties.cxx \ - graphicsEngine.cxx \ - graphicsOutput.cxx \ - graphicsBuffer.cxx \ - graphicsPipe.cxx \ - graphicsPipeSelection.cxx \ - graphicsStateGuardian.cxx \ - graphicsThreadingModel.cxx \ - graphicsWindow.cxx graphicsWindowInputDevice.cxx \ - graphicsWindowProc.cxx \ - graphicsWindowProcCallbackData.cxx \ - graphicsDevice.cxx \ - nativeWindowHandle.cxx \ - parasiteBuffer.cxx \ - windowHandle.cxx \ - windowProperties.cxx \ - stereoDisplayRegion.cxx \ - subprocessWindow.cxx \ - touchInfo.cxx - - #define INSTALL_HEADERS \ - standardMunger.I standardMunger.h \ - config_display.h \ - $[if $[HAVE_PYTHON], pythonGraphicsWindowProc.h] \ - callbackGraphicsWindow.I callbackGraphicsWindow.h \ - drawableRegion.I drawableRegion.h \ - displayInformation.h \ - displayRegion.I displayRegion.h \ - displayRegionCullCallbackData.I displayRegionCullCallbackData.h \ - displayRegionDrawCallbackData.I displayRegionDrawCallbackData.h \ - displaySearchParameters.h \ - frameBufferProperties.I frameBufferProperties.h \ - get_x11.h pre_x11_include.h post_x11_include.h \ - graphicsEngine.I graphicsEngine.h \ - graphicsOutput.I graphicsOutput.h \ - graphicsBuffer.I graphicsBuffer.h \ - graphicsPipe.I graphicsPipe.h \ - graphicsPipeSelection.I graphicsPipeSelection.h \ - graphicsStateGuardian.I \ - graphicsStateGuardian.h \ - graphicsWindow.I graphicsWindow.h \ - graphicsWindowProc.h \ - graphicsWindowProcCallbackData.I graphicsWindowProcCallbackData.h \ - graphicsThreadingModel.I graphicsThreadingModel.h \ - graphicsWindowInputDevice.I graphicsWindowInputDevice.h \ - graphicsDevice.I graphicsDevice.h \ - nativeWindowHandle.I nativeWindowHandle.h \ - parasiteBuffer.I parasiteBuffer.h \ - pStatGPUTimer.I pStatGPUTimer.h \ - windowHandle.I windowHandle.h \ - windowProperties.I windowProperties.h \ - renderBuffer.h \ - stereoDisplayRegion.I stereoDisplayRegion.h \ - subprocessWindow.h subprocessWindow.I \ - subprocessWindowBuffer.h subprocessWindowBuffer.I \ - touchInfo.h - - #define IGATESCAN all - -#end lib_target - - -#begin static_lib_target - // We build a static library of just these files, so the plugin can - // link with it in direct/src/plugin, without pulling in the rest of - // Panda. - - #define BUILD_TARGET $[and $[OSX_PLATFORM],$[HAVE_P3D_PLUGIN]] - - #define TARGET p3subprocbuffer - - #define SOURCES \ - subprocessWindowBuffer.h subprocessWindowBuffer.I \ - subprocessWindowBuffer.cxx - -#end static_lib_target - - -#begin test_bin_target - #define TARGET test_display - #define LOCAL_LIBS \ - p3display p3putil - - #define SOURCES \ - test_display.cxx - -#end test_bin_target - diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index c55b988125..cde94080cd 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -2996,7 +2996,6 @@ close_gsg() { display_cat.debug() << this << " close_gsg " << get_type() << "\n"; } - free_pointers(); // As tempting as it may be to try to release all the textures and // geoms now, we can't, because we might not be the currently-active @@ -3009,18 +3008,13 @@ close_gsg() { // will be responsible for cleaning up anything we don't clean up // explicitly. We'll just let them drop. - // However, if any objects have recently been released, we have to - // ensure they are actually deleted properly. - Thread *current_thread = Thread::get_current_thread(); - _prepared_objects->begin_frame(this, current_thread); - _prepared_objects->end_frame(current_thread); - - // We have to clear the list of timer queries, though, otherwise - // their destructors will cause a crash when they try to access - // the GSG object. + // Make sure that all the contexts belonging to the GSG are deleted. + _prepared_objects.clear(); #ifdef DO_PSTATS _pending_timer_queries.clear(); #endif + + free_pointers(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/distort/Sources.pp b/panda/src/distort/Sources.pp deleted file mode 100644 index 72348d7831..0000000000 --- a/panda/src/distort/Sources.pp +++ /dev/null @@ -1,29 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -//#define OSX_SYS_LIBS mx - -#begin lib_target - #define TARGET p3distort - #define LOCAL_LIBS \ - p3display p3pgraph p3gobj p3linmath - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES config_distort.h \ - projectionScreen.h projectionScreen.I \ - cylindricalLens.h cylindricalLens.I \ - fisheyeLens.h fisheyeLens.I \ - nonlinearImager.h nonlinearImager.I \ - oSphereLens.h oSphereLens.I \ - pSphereLens.h pSphereLens.I - - #define INCLUDED_SOURCES \ - config_distort.cxx cylindricalLens.cxx fisheyeLens.cxx nonlinearImager.cxx \ - projectionScreen.cxx oSphereLens.cxx pSphereLens.cxx - - #define INSTALL_HEADERS - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/doc/Sources.pp b/panda/src/doc/Sources.pp deleted file mode 100644 index 17da11ede2..0000000000 --- a/panda/src/doc/Sources.pp +++ /dev/null @@ -1,3 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - diff --git a/panda/src/doc/howto.use_config.txt b/panda/src/doc/howto.use_config.txt index f4d59a4c7e..30ed1c486c 100644 --- a/panda/src/doc/howto.use_config.txt +++ b/panda/src/doc/howto.use_config.txt @@ -2,12 +2,6 @@ This document describes the use of the Panda's Config.prc configuration files and the runtime subsystem that extracts values from these files, defined in dtool/src/prc. -The Config.prc files are used for runtime configuration only, and are -not related to the Config.pp files, which control compile-time -configuration. If you are looking for documentation on the Config.pp -files, see howto.use_ppremake.txt, and ppremake-*.txt, in this -directory. - USING THE PRC FILES diff --git a/panda/src/doc/howto.use_ppremake.txt b/panda/src/doc/howto.use_ppremake.txt deleted file mode 100644 index 35bcb9f8ba..0000000000 --- a/panda/src/doc/howto.use_ppremake.txt +++ /dev/null @@ -1,66 +0,0 @@ -This document tries to describe how the various Sources.pp files -should be set up within the Panda tree (or a related tree like Direct -or Pandatool), to add new directories, for instance, or modify the -build rules for an existing directory. For a general treatise on the -full syntax and semantics of the ppremake scripting language, see the -ppremake-*.txt files in this directory. - - - - - -TARGET specifies the name of the output file that will be generated, -not a directory name. The target may be a dll, lib, or executable -depending on the type of target (lib_target, static_lib_target, or -bin_target). For instance, in vrpn/Sources.pp, the target name is -pvrpn; this means that "make" within the directory will in principle -generate a file called libpvrpn.dll. - -The TARGET name is particularly confusing for people who only see the -Windows build, however, because on Windows we don't actually generate -a libpvrpn.dll file, or for that matter any other dll file that's -named in the COMPONENT_LIBS of some metalib, like -panda/metalibs/panda/Sources.pp. This is because of our limitation -with STL and DLL's (and also because the per-DLL overhead is fairly -high in Windows). - -The build design is that each subdirectory under panda/src should -generate its own shared library, a .dll file (or .so file on Unix). -Then the user would reference just the particular dll's that his -client application requires, e.g. libpgraph.dll to use the scene -graph, libdisplay.dll to actually do rendering, and libpvrpn.dll to -interface to VRPN. On Windows, however, we can't actually do that for -various reasons, so instead we provide one big metalib called -libpanda.dll which contains all of those pieces, and clients must link -with all of libpanda.dll even if they just want to use a subset of it. - -The fact that we don't actually generate a physical dll file for each -subdirectory on Windows is unimportant to the rest of the build -scripts, which act as if we do. For instance, the COMPONENT_LIBS line -in the panda/Sources.pp file names "pvrpn", as if there were a -libpvrpn.dll; this means that all of the files that are part of the -"pvrpn" target are added to libpanda.dll. (On Unix platforms, it -means we add libpvrpn.so to the list of libraries that are referenced -by libpanda.so.) - -The original intention of SOURCES is to list all of the source files -within this directory that go into the dll. This generally includes -.h files, .I files, and .cxx files. However, at some point one of our -programmers introduced COMBINED_SOURCES and INCLUDED_SOURCES, and he -removed those source files from the SOURCES list, which I think -confuses the whole thing; and I intend to clean this up at some point. -In the vrpn/Sources.pp directory, however, we only have the SOURCES -list, nice and clean. I don't know what you mean about hierarchy; -these files are all in the same directory, so there's just a linear -list of filenames. By convention, these should be kept in -alphabetical order, although it doesn't really matter that much. - -INSTALL_HEADERS names the header files that should be copied into the -public include directory for third-party packages (or other Panda -trees, like Direct) to reference. This makes a C++ public interface. - -IGATESCAN names the source files that are to be scanned by -interrogate. This makes a Python public interface. Most of the time, -we just say "IGATESCAN all" which means to scan all of the source -files in the directory. - diff --git a/panda/src/doc/ppremake-models.txt b/panda/src/doc/ppremake-models.txt deleted file mode 100644 index eb8ed34bde..0000000000 --- a/panda/src/doc/ppremake-models.txt +++ /dev/null @@ -1,540 +0,0 @@ - DEFINING A MODEL TREE - What to put in your Sources.pp files - to generate model and animation files - -The model tree contains model and animation files, for instance in -MultiGen or SoftImage format, and contains rules for generating egg -files, creating character model and animation files, palettizing and -scaling textures, and creating final bam files for loading into an -application. - -The egg format is Panda's working file format for storing general -models and animation files. Typically, the build process for a given -model involves the following steps: - -1. Convert from the source format (e.g. MultiGen or Maya, or any one - of the other formats supported by command-line egg converters) into - egg. - -2. If the model represents an animated character or animation, run - egg-optchar on the egg model file and its associated animation - files to optimize animation performance. - -3. Sometimes, additional filters are also run on the egg files, for - instance to scale them or rotate them appropriately after - conversion. - -4. Run egg-palettize on the egg model file to optionally reduce the - textures, and also pack the textures together onto palette images. - The final textures are copied into the install directory at this - point. - -5. Run egg2bam to convert the final egg files to bam format and copy - the resulting bam files into the install directory. - - -The ppremake system is set up to generate makefiles that automatically -perform these steps, although it currently generates only a Unix-like -makefile, so the at the moment a model tree can only be built on a -Linux or Unix machine, or on a PC with Cygwin installed. - -See the dmodels tree in the Panda3D repository for an example of a -simple buildable model tree. This is different from the models tree, -which is much simpler and includes only ready-to-load egg files; the -dmodels tree is set up as a full-fledged buildable model tree using -the ppremake system. With a few small exceptions, the dmodels tree -does not contain any egg files, although intermediate egg files are -generated during the make process. When you have finished building -the dmodels tree, you will have generated a number of bam files that -are fully optimized and ready to load for your current version of -Panda. - - -To set up a ppremake model tree, you must create a Sources.pp file in -the directory with the models (or in the directory above the SoftImage -tree in the case of SoftImage models). - -The Sources.pp file for a directory in a model tree normally begins -with the line: - - #define DIR_TYPE models - -which identifies this as a subdirectory in a model tree. The rest of -the Sources.pp file contains blocks of the form: - -#begin - #define SOURCES - ... -#end - -where is a list of input filenames for this block, -and defines the type of build rule and may be one of -flt_egg, maya_egg, maya_char_egg, install_egg, or a few others (the -complete list appears below). Some kinds of build rules require other -parameters in addition to the list of source filenames. - - -The available build rules are: - -flt_egg - Runs flt2egg to convert models from MultiGen (.flt) format to - egg. - - SOURCES - a list of MultiGen files to convert. These will have the - extension .flt. Each named MultiGen file will be converted to an - egg file of the same name, with the extension .egg replacing .flt. - - We often use the syntax $[wildcard *.flt] in place of an explicit - list of filenames to automatically pick up all the files with a - .flt extension in the directory. - - FLT2EGG_OPTS - Specifies some additional command-line options that - should be passed to flt2egg. Common settings, for instance, might - be -no to strip normals, or -uo ft to convert models to a standard - scale in feet. See flt2egg -h for a complete list of available - options. If you define this variable, it is usually better to - extend it rather than replace its previous value, which allows - global settings to be defined in the root Package.pp for the model - tree. - - Example: - #begin flt_egg - #define SOURCES $[wildcard *.flt] - #define FLT2EGG_OPTS $[FLT2EGG_OPTS] -no - #end flt_egg - -maya_egg - Runs maya2egg to convert models from Maya (.mb) format to - egg. This form of the block should be used to convert nonanimated - models only; see maya_char_egg, below, to convert animated - (character) models along with their animations. - - SOURCES - a list of Maya files to convert. These will have the - extension .mb or .ma. Each Maya file will be converted to an egg - file of the same name, with the extension .egg replacing .mb or - .ma. - - As in flt_egg, above, you may use the syntax $[wildcard *.mb] in - place of an explicit list of filenames to automatically pick up - all the files with a .mb extension in the directory. - - MAYA2EGG_OPTS - As above, this specifies some additional - command-line options that should be passed to maya2egg. See - maya2egg -h for a complete list of available options. - - Example: - #begin maya_egg - #define SOURCES $[wildcard *.mb] - #define MAYA2EGG_OPTS $[MAYA2EGG_OPTS] -suppress-vcolor - #end maya_egg - -lwo_egg - As above, for Lightwave Object files (.lwo). - -install_egg - Runs egg-palettize on the named egg files, then runs - egg2bam to convert to bam file format, and then copies them into the - install directory. - - SOURCES - a list of egg files to install. Usually, these files are - generated from a previous step (for instance, a previous flt_egg - rule), but they may be ordinary egg files that are checked into - the tree as source files. Generally, you cannot use the wildcard - syntax here (unlike in the flt_egg and maya_egg rules), because - the egg files may not exist at the time ppremake is run; you must - name each egg file explicitly (although it is possible to use the - $[patsubst] function in ppremake to derive the egg files - automatically from the names of the source files if you really - want this). - - UNPAL_SOURCES - a list of egg files to install, omitting the - egg-palettize step. This is normally done for animation files - that do not contain any geometry; there is no point in attempting - to palettize these files since they contain no textures, and - omitting the palettize step saves a bit of time building the model - tree. You should not name any egg files that include geometry or - textures on the UNPAL_SOURCES line, it should only name animation - files. - - SOURCE_DIR - if all of the source egg files can be found in some - other directory than the current directory, this can optionally be - defined to indicate that source directory (relative to the current - directory). Normally, this will only be the case when installing - egg files that were generated from some intermediate step (for - instance, a command specified by filter_egg; see filter_egg, - below). It is also possible to include the source directory as a - part of each egg filename given in the SOURCES list, above. - - INSTALL_TO - the name of the install directory into which these - models should be copied. This is relative to the root of the - tree, and may also be implicitly prefixed by phase_n/, where n is - the phase number (see PHASE, below). Since the install directory - is usually the same for all files in a particular source - directory, we usually define this variable globally at the top of - the Sources.pp file; if it is defined there, it need not appear - within the #begin .. #end scoping of install_egg. - - PHASE - the number of the phase directory into which these models - should be copied. This is optional, but if it is specified, it - implicitly prefixes the INSTALL_TO directory with the name - phase_n, where n is the phase number. This is in support of - building separate trees for a phased download. - - This phase number should match the phase number assigned to these - egg files in the textures.txa file, so egg-palettize will know to - install the textures into the same phase directory. - - Example: - - #begin install_egg - #define SOURCES \ - trolley_station_DD.egg \ - DD_A1.egg DD_A2.egg DD_B1.egg DD_B2.egg DD_C1.egg DD_D1.egg \ - neighborhood_tunnel_DD.egg safe_zone_entrance_tunnel_DD.egg \ - safe_zone_tunnel_DD.egg DD_doors.egg DD_doors_practical.egg - #define PHASE 6 - #end install_egg - - -maya_char_egg - Runs maya2egg to convert an animated model and its - associated animation tables from a Maya file to a number of egg - files. Use this form of the block to convert animated files from - Maya; use maya_egg (above) if you just have an unanimated model. - - To set up Maya animations, you should create multiple Maya files, - one for each animation, and one more for the model itself. Each - Maya file should include the identical joint hierarchy; it is - usually easiest to create the model file first and then duplicate it - to create the animation files. If you have multiple levels of - detail for your character, you should create a separate Maya file - for each LOD. - - The assumption is that your Maya files will follow the following - naming convention: all Maya files that animate a particular - character will begin with the same prefix, and end with the name of - the animation, or with a name like "model" for the model file (or - with the name of the particular level of detail, e.g. "1000" or - "low", in the case of a multiple-LOD model). - - MAYA_PREFIX - Specifies the prefix that all of the Maya files have - in common. - - EGG_PREFIX - Specifies an optional prefix to be given to any egg - filenames generated by this rule. We usually set this to the same - as MAYA_PREFIX, to help associate the egg files with the Maya - files they originated from. - - POLY_MODEL - Specifies the suffix that identifies the model file, - e.g. "model" or "1000". This is the form you will use if you - intend to extract your model directly into polygons (whether it is - modeled in NURBS or polygons). The name of the Maya file that - contains the model is $[MAYA_PREFIX]$[POLY_MODEL].mb (but see - MODEL, below); it will be written to the egg file - $[EGG_PREFIX]$[POLY_MODEL].egg. If you have multiple levels of - detail, you can only name one of them here; define a separate - maya_char_egg block to get each of the other LOD's. - - NURBS_MODEL - Similar to the above; use this form if your character - is modeled in NURBS, and you want to use an egg tool such as - egg-qtess to convert NURBS to polygon models in a later step (for - instance, to generate multiple levels of detail from one source - file). - - MODEL - Optional. If this is specified, it names the actual Maya - file to use to extract the model. That is, instead of - $[MAYA_PREFIX]$[POLY_MODEL].mb, the model will be extracted from - the Maya file $[MAYA_PREFIX]$[MODEL].mb. It will still be written - to the file $[EGG_PREFIX]$[POLY_MODEL].egg. This can be used if - you don't have a particular Maya file set aside to hold the model; - in this case, you can name any one of the animation files, and the - model will be pulled from that animation file. - - ANIMS - Specifies a list of animations to extract from Maya. Each - word in ANIMS represents a different animation; the name of the - Maya file that contains the animation is derived from MAYA_PREFIX, - e.g. $[MAYA_PREFIX]$[anim].mb. Each anim is written to an egg - file whose filename is derived from EGG_PREFIX, - e.g. $[EGG_PREFIX]$[anim].egg. - - CHAR_NAME - Specifies the name of the character that is to be - assigned to the models and animations generated in this rule. - This name is written within each generated egg file, and should be - different for each different character; it allows Panda to ensure - at runtime that a given animation file is being played on the - correct model file. - - MAYA2EGG_OPTS - Specifies some additional command-line options that - are passed to maya2egg. As in the maya_egg rule, above, you - should extend rather than completely redefine this variable. - - Example: - - #begin maya_char_egg - #define MAYA_PREFIX boss- - #define EGG_PREFIX boss-torso- - #define POLY_MODEL zero - #define CHAR_NAME boss-torso - #define ANIMS $[anims] - #define MAYA2EGG_OPTS $[MAYA2EGG_OPTS] -subset body - #end maya_char_egg - - -soft_char_egg - Runs soft2egg to convert a model or animation tables - from a SoftImage 4.3 database to one or more egg files. - - DATABASE - Specifies the root directory of the SoftImage database. - Often, this will be the same for all soft2egg rules in a - particular directory, so we usually define this once at the top of - the file instead of within each soft_char_egg rule. This is - usually a subdirectory within the current directory. - - SCENE_PREFIX - Specifies the name of the SoftImage scene; this is - the prefix that SoftImage applies to each model and animation - filename in the scene. - - The remaining options are similar to those in maya_char_egg, above. - - Example: - - #begin soft_char_egg - #define SCENE_PREFIX suitA- - #defer EGG_PREFIX suitA- - #define POLY_MODEL lose-mod - #define MODEL lose - #define ANIMS lose - #define CHAR_NAME suitA-lose - #end soft_char_egg - - - -optchar_egg - Runs egg-optchar on a character model (and/or multiple - levels of detail of a single model) and all of the associated - animations. This step removes unnecessary joints for optimal - runtime performance, exposes joints that are needed for show code - operations, and can also perform other operations like scaling and - rotating a character and its animation files together. - - It is important to run egg-optchar on the model together with all of - its animation files at the same time; since egg-optchar operates the - joint hierarchy, it must make any adjustments to all of the related - animation files together. - - SOURCES - Specifies the list of egg files that are to be read. This - should include all models and animations that are associated the - the same character. - - SOURCE_DIR - As with the install_egg rule, above, this optionally - specifies the directory in which all of the egg files can be read, - if it is not the current directory. - - TARGET_DIR - Specifies the subdirectory to which all of the - resulting egg files should be written. - - OPTCHAR_OPTS - Specifies additional command-line arguments to pass - to egg-optchar. This normally includes rules to expose joints - and/or transform models. As with any of the OPTS variables, it is - good practice to extend rather than completely redefine this - variable. Common options to egg-optchar are: - - -no - strip surface normals from the model. - -expose joint-name - expose joint-name to the show code. - -flag polyset-name - flag geometry for the show code. - -TR x,y,z - rotate about x, y, and z axes. - -TS scale - scale model by the indicated factor. - - Example: - - #begin optchar_egg - #define TARGET_DIR optchar - #define SOURCES \ - regexp/suitA-lose-mod.egg \ - suitA-lose.egg - #define OPTCHAR_OPTS \ - $[OPTCHAR_OPTS] \ - -no -TR 0,180,0 -TS 0.25 \ - -expose joint-Rhold \ - -expose joint-Lhold -Dp joint-head \ - -expose joint-shadow \ - -expose joint-nameTag - #end optchar_egg - - -copy_egg - Copies an egg file, or a list of egg files, to another file - with a different name. This is particularly useful when extracting - one file for multiple purposes, for instance before using - egg-retarget-anim to retarget an animation to multiple skeletons. - - SOURCES - The list of original egg file names. - - TARGETS - The list of target egg file names. There should be the - same number of filenames in TARGETS as in SOURCES, and they will - be matched up one-to-one; that is, the first egg file in SOURCES - will be copied to the first filename in TARGET, the second egg - file in SOURCES will be copied to the second filename in TARGET, - and so on. - - Example: - - #begin copy_egg - #define SOURCES elf-walk.egg elf-run.egg - #define TARGETS dwarf-walk.egg dwarf-run.egg - #end copy_egg - - -filter_egg - Runs an arbitrary egg command on one or more named egg - files, one at a time. This is usually done when an egg file - generated by one of the above steps needs additional processing. - The modified egg files are written into a specified directory to - differentiate them from the source egg files; a later rule (for - instance, optchar_egg or install_egg) should then specify to take - its source egg files from this directory. - - SOURCES - The list of egg files to process. - - SOURCE_DIR - As above, the source directory in which to read the egg - files, if it is not the current directory. - - TARGET_DIR - The subdirectory into which to write the generated egg - files. - - COMMAND - The egg command to run. This should include the string - $[source], which will be replaced with the name of the source egg - file, and $[target], which will be replaced with the target egg - file. Note that this variable should be defined with the #defer - command instead of the #define command, to prevent the premature - evaluation of $[target] and $[source]. - - Example: - - #begin filter_egg - #define TARGET_DIR scaled - #define SOURCES \ - button.egg bluebox.egg - #defer COMMAND \ - egg-trans -no -TR 0,180,0 -TS 0.25 \ - -o $[target] $[source] - #end filter_egg - - -filter_char_egg - Similar to filter_egg, above, except that one - command is run on all of the files named in SOURCES at the same - time, instead of one at a time. This is particularly useful for - processing a character's model file and its animations all at the - same time, hence the name of the rule. This rule is most often used - to invoke egg-topstrip, which is at the time of this writing the - only egg tool other than egg-optchar that works on a model file and - all animations at the same time. - - SOURCES - The list of egg files to process. - - SOURCE_DIR - As above, the source directory in which to read the egg - files, if it is not the current directory. - - TARGET_DIR - The subdirectory into which to write the generated egg - files. - - COMMAND - The egg command to run. This should include the string - $[sources], which will be replaced with the list of the source egg - files, and it should probably include -d $[TARGET_DIR], to specify - the output directory. Note that this variable should be defined - with the #defer command instead of the #define command, to prevent - the premature evaluation of $[sources] and $[TARGET_DIR]. - - Example: - - #begin filter_char_egg - #define TARGET_DIR topstrip - #define SOURCES \ - boss-torso-zero.egg \ - $[matrix boss-torso-,$[anims],.egg] - #defer COMMAND \ - egg-topstrip -i -t joint_pelvis -d $[TARGET_DIR] $[sources] - #end filter_char_egg - - -HOW TO POPULATE A CVS-CONTROLLED MODEL TREE - -Since a model tree is really just a source tree like any other, you -can check in the source files--the .mb files or .flt files, for -instance, and all of the associated image files--as source files in a -CVS directory. Then any developer can check out the source tree, -ppremake, and make install, exactly the same way you would build -Panda. Of course, .mb files and .flt files are binary files, but CVS -(and most other revision control systems) allows you to add binary -files to the system. You just can't merge multiple changes coming in -at once to the same file, so it's important to make frequent updates -and commits in order to minimize the chance of an accidental -collision with another artist. - -In order for this to work, the source files must reference texture -paths and other external filenames using relative filenames--for -instance, a model should apply a texture named "../maps/grid.tif" -rather than "/home/drose/panda3d/dmodels/maps/grid.tif", for instance. -This is because the entire model tree might be checked out by another -developer within some other directory, and only relative paths within -the model tree will be valid. - -For most modeling packages, it is not difficult to ensure that all of -the external references use only relative paths. Populating a model -tree with, say, MultiGen source files may thus be as simple as copying -the MultiGen files and the image files in and then adding them to cvs -by hand (using -kb to indicate a binary file, of course). - -Maya, on the other hand, for some reason insists on storing texture -references as full pathnames, even if you enter a relative path. It -is not possible using the Maya interface to create an .mb file that -references its textures using relative pathnames. This makes it -impossible to add a Maya file to a CVS repository in the normal way. - -However, it *is* possible to store relative paths within a Maya file -if you use an OpenMaya program to generate the Maya file. Panda -provides a utility called mayacopy that does this (among other useful -features). - -In fact, Panda provides a family of utilities, with similar behavior; -at the time of this writing, the list includes mayacopy, fltcopy, and -lwocopy. (There is also a separate tool called softcvs, used for -integrating SoftImage version 4.3 databases; this works differently -from the others, because of the very different nature of a SoftImage -scene. The use of softcvs is not documented in this file.) - -In general, the copy tools work like this: - - cd mymodels/src/mydir - mayacopy /path/to/my/maya.mb - -This copies the indicated Maya (or MultiGen, LightWave, etc.) file -from the named directory into the current directory. It also copies -in all of the texture files referenced by the Maya file, and it -modifies the Maya file to use only local pathnames to the newly copied -texture files, instead of the full pathnames that would have been -stored in the original Maya file. - -A little heuristic is used to decide where to place each texture image -referenced by the Maya file. The following rules are applied: - - (1) If another texture file with the same name already exists - elsewhere in the source hierarchy, assume this texture image - represents the same image (or a new version of that image) and - overwrite it. (Note that it is not a good idea to have - different texture images that are stored under the same - filename. egg-palettize also makes the assumption that any two - files with the same filename represent the same texture image.) - - (2) If the texture file does not already exist, copy it into src/maps. - - (3) If the src/maps directory does not exist, copy the texture file - into the same directory with the source Maya file. - -As the Maya file and each texture file is copied into the source tree, -the cvs command is automatically invoked to add the file(s) to the -repository, if necessary. It is still your responsibility to issue -the cvs commit command when you are ready to make the changes -permanent. - -You can use mayacopy, fltcopy, etc. to copy in a file from a -completely different hierarchy, or to update a file already within the -source tree. It is particularly important to re-run mayacopy after -modifying any .mb file using Maya, since Maya will replace all of the -local pathnames with full pathnames each time you save the file. -Re-running mayacopy on the same file, in place, will restore the -relative pathnames again. - - - diff --git a/panda/src/doc/ppremake-philosophy.txt b/panda/src/doc/ppremake-philosophy.txt deleted file mode 100644 index 3eff3494a5..0000000000 --- a/panda/src/doc/ppremake-philosophy.txt +++ /dev/null @@ -1,210 +0,0 @@ -The name 'ppremake' stands for Panda Pre-make; ppremake is a -preprocessor that reads a series of source description files and -generates a series of makefiles (or, potentially, other kinds of -package build description files, like VC++ project files). - - -WHY PPREMAKE? - - We needed something like ppremake to meet our complex multi-platform - build requirements. Panda should be built in different ways - according to platform: - - * On Unix systems that support shared libraries (.so files), each - subdirectory becomes a different .so file. This provides the - maximum convenience while developing; local changes remain local - to a particular .so file and don't require relinking of the - whole thing. - - * On Windows systems, the number of shared libraries (.dll files) - must be reduced to minimize overhead, as well as to allow STL to - work properly between different subdirectories within a package. - (In VC6, STL constructs other than vectors do not work between - different DLL's.) Thus, we must define a number of 'metalib' - objects that each represents a set of subdirectories that are to - be linked into one DLL. - - * On systems that do not support shared libraries at all, or for - developers who do not wish to use them, each subdirectory - becomes a static library. - - Also, it should be possible to build Panda natively on each - platform, without having to install Unix tools (e.g. Cygwin). This - means that we cannot depend on common Unix tools and commands (like - install, cp, mv) being present, and makes it difficult to define one - set of makefiles for all platforms. Furthermore, the use of - makefiles themselves is not universal; Windows developers are used - to using VC++ project files to define the build relationships, and - may resist a command-line based build system using makefiles. - - Finally, the relationships between source files should be recorded - only once; it won't do to have to maintain a set of makefiles for - Unix systems and a separate set of VC++ project files for Windows - systems. This invites error and accidental omissions on one side or - the other. - - -WHAT IS PPREMAKE, EXACTLY? - - By design, ppremake is more of a scripting language framework than a - specific application. It is intended to contain as few assumptions - as possible about the structure of the source tree it is processing - or the precise nature of the makefiles (or other build scripts) it - is generating. - - The ppremake executable is hardcoded to define a set of useful - predefined variables and functions, and to follow a particular - procedure to get started scanning a source directory when it is - invoked. However, once it is started, the actual behavior of - ppremake, including the meaning of all the variables defined within - the various Sources.pp files (see below) and all of the generated - output, is almost entirely controlled by scripts written in its own - scripting language. Most of these control scripts are defined - in the directory $DTOOL/pptempl. - - -SOURCE TREE AND INSTALL TREE HIERARCHY - - The layout of the source tree and of the install tree for Panda are - strongly influenced by the Unix convention for open source projects, - particularly as standardized by GNU. This convention has a long - history and is widely understood by open source developers. - - The complete source hierarchy available on SourceForge consists of a - collection of packages, with names like dtool, panda, pandatool, and - direct; each package is the root of a separate buildable hierarchy - that includes a src and a metalibs directory; within these - directories, the source files themselves are distributed logically - among a number of further subdirectories. The structure looks - something like this: - - panda3d/README - panda3d/dtool/ - panda3d/dtool/Package.pp - panda3d/dtool/Sources.pp - panda3d/dtool/src/ - ... - panda3d/panda/ - panda3d/panda/Package.pp - panda3d/panda/Sources.pp - panda3d/panda/src/ - panda3d/panda/src/Sources.pp - panda3d/panda/src/express/ - panda3d/panda/src/express/Sources.pp - panda3d/panda/src/express/typedObject.cxx - panda3d/panda/src/express/typedObject.h - ... - panda3d/panda/metalibs/ - panda3d/panda/metalibs/Sources.pp - panda3d/panda/metalibs/pandaexpress/ - panda3d/panda/metalibs/pandaexpress/Sources.pp - panda3d/panda/metalibs/pandaexpress/pandaexpress.cxx - ... - - Note that there is a file called Sources.pp in each subdirectory - within the hierarchy, and there is a Package.pp at the root of each - package. These files define the build relationships among all the - source files in the hierarchy, and are the input files read by - ppremake to generate makefiles. - - Once the source tree is unpacked, the user's first step (after - customizing the local configuration requirements by setting up a - local Config.pp file) will be to cd into the root of one of the - packages--typically dtool, which must be built before any of the - others--and run ppremake to generate all of the makefiles for that - package. (This is akin to running ./configure within the root of a - package for most GNU software. Unfortunately, Panda cannot easily - take advantage of GNU's autoconf scripts, because of its difficult - multiplatform requirements.) - - Once the package has been configured, the user can build the entire - package with the command 'make' (or 'nmake' in a non-Cygwin Windows - environment). The source files within the tree are compiled in - place. At this point, nothing has yet been installed publicly. In - most Unix/GNU packages, the user may at this point run any - applications built within the tree prior to installation, but Panda - relies too heavily on shared libraries to make this work reliably. - You must 'make install' before you can execute any of the - applications within the Panda package. - - Installing the package with 'make install' (or 'nmake install') - copies to a public location all of the files that are necessary to - make use of the package, either for running applications or building - new applications. This includes all the executables (.exe files) as - well as shared libraries (.dll or .so files) for runtime, as well as - header files (.h files) and static libraries (.lib or .a files) for - building new applications. - - The location to which these files are installed is specified by the - user in the local Config.pp file; the common Unix convention is to - install these in the directory /usr/local/panda. The executables - will go into /usr/local/panda/bin, the static and dynamic libraries - into /usr/local/panda/lib, and the header files into - /usr/local/panda/include. Note that all packages within the source - hierarchy, including dtool, panda, pandatool, and direct, will be - installed into the *same* public install tree, whether it is called - /usr/local/panda or something else. (On a Windows environment the - directory name /usr/local/panda may be inappropriate. It is up to - the user to specify a suitable directory name. We suggest - C:\Panda3d.) - - Once dtool has been built and installed, the next step is to cd to - the panda package, ppremake, and 'make' followed by 'make install', - and so on with the direct and/or pandatool packages. All of these - packages will be installed into /usr/local/panda (or whichever - directory the user specified as the install tree). - - -AN ALTERNATIVE INSTALL TREE PHILOSOPHY - - Installing all the packages to the same install tree works well for - the outside developer who is primarily interested in taking the - whole body of code as a complete piece, but we have different needs - for our own in-house development. It is convenient to be able to - treat the individual packages separately; our in-house 'ctattach' - scripts (not included with the distribution) allow us to use one of - several automatically-built trees for development, or upon need, to - switch on-the-fly to using our own personally built tree. - - In order to make this work, the source tree and the install tree - must become the same thing. When we are developing in-house, 'make - install' copies all the relevant files to the bin, lib, and include - subdirectories of the root of the source package, instead of to a - common public install directory. This allows us to easily - mix-and-match the files from packages built at various times. - - -PPREMAKE VARIABLES TO SUPPORT EITHER PHILOSOPHY - - Variables are defined in ppremake either with the appropriate - #define or #defer command in the local Config.pp, or in the absence of - this, they are taken from environment variables. - - In the normal, install-in-one-place philosophy, the user should - define only INSTALL_DIR, which indicates the root directory name all - packages will be installed to. In the alternative philosophy, used - in-house, the environment variables DTOOL, PANDA, DIRECT, - etc. should be defined, which indicate the location of the source - directories for each of the various trees. - - In either case, the various Package.pp scripts will define the - following ppremake variables appropriately: - - DTOOL_INSTALL - PANDA_INSTALL - DIRECT_INSTALL - (etc). - - The above indicate the directories in which files from each tree - should be installed. In the normal philosophy, these will all - contain the same string, the same thing specified by INSTALL_DIR. - - DTOOL_INSTALL_OTHER - PANDA_INSTALL_OTHER - DIRECT_INSTALL_OTHER - (etc). - - These variables have the same meaning as the above, except that they - are intended to be used from a different package. That is, if code - in the Panda source tree needs to reference an installed file from - Dtool, it should expect to find it in $[DTOOL_INSTALL_OTHER]. diff --git a/panda/src/doc/ppremake-process.txt b/panda/src/doc/ppremake-process.txt deleted file mode 100644 index 70c8b710ae..0000000000 --- a/panda/src/doc/ppremake-process.txt +++ /dev/null @@ -1,142 +0,0 @@ -The following steps are executed when ppremake is invoked: - - 1. Look in the current directory for a file called Package.pp. If - it is not found, but Sources.pp is present in the current - directory, then look for Package.pp in the parent directory. - Repeat until Package.pp is located; this is the root of the - source directory hierarchy. - - 2. Read and interpret the Package.pp file. This should, in turn, - read in (via the #include directive; see below) whatever other - configuration scripts are relevant to the current package. The - exact behavior of Package.pp is not hardcoded into ppremake, but - the Package.pp scripts for each of the Panda directories will - ultimately include the following files in order: - - Any Package.pp for a dependent tree (e.g. $PANDA/Package.pp, etc.) - $DTOOL/Package.pp - $DTOOL/Config.pp - $DTOOL/Config.Platform.pp - The user's Config.pp file, as specified by $PPREMAKE_CONFIG. - $DTOOL/pptempl/System.pp - - The various Package.pp files are designed to cascade down, such - that when you invoke ppremake from a high-level tree, such as - Direct (for instance), ppremake invokes $DIRECT/Package.pp, which - in turn invokes $PANDA/Package.pp, which in turn invokes - $DTOOL/Package.pp. At the bottom level, $DTOOL/Package.pp does - most of the remaining setup work, in particular including the - various Config.pp files, and System.pp. - - The Config.pp files are intended to define the variables the user - might customize for a particular build environment; the user's - personal Config.pp file is included last, and may override any of - the default values defined in the system Config.pp files. - - One particularly critical variable that is defined by Config.pp - is $[BUILD_TYPE]. This represents the type of makefile rules - that are to be generated, e.g. "unix" to generate standard - Unix-style makefile syntax, or "msvc" to generate syntax specific - to Microsoft's nmake. The particular string specified here - controls the selection of which Template files are to be loaded - in a later step to actually generate output files in each source - directory. - - The System.pp file is also essential and defines a few more - variables that ppremake will be looking for during its execution. - This tells ppremake the names of certain critical files that it - needs to include. The use of System.pp to define these - filenames, instead of hardcoding them into ppremake, is - consistent with the ppremake philosophy of letting as much of its - behavior as possible be controlled from within the scripting - language itself. - - 3. Once Package.pp has been read, traverse the entire source - hierarchy, and read each Sources.pp file. A separate named scope - is defined for each Sources.pp file; the name of the scope is - taken from the name of the directory containing the file. - - 4. Read in the global variable declarations. This is loaded from a - particular file specified by System.pp; this file defines global - declarations that will be useful when processing each Template - file later. To save time, this file is read once and stored in a - global scope, rather than re-read with each Template file. The - particular filename is specified by the ppremake variable - $[GLOBAL_FILE], which was set by System.pp; normally this is - $DTOOL/pptempl/Global.pp. - - $DTOOL/pptempl/Global.pp will, in turn, also read in the file - $DTOOL/pptempl/Global.$[BUILD_TYPE].pp if it exists, which may - specify further global declarations that are specific to the - particular build type in effect. Remember, $[BUILD_TYPE] was - specified when Config.pp was read, and controls the particular - type of makefiles or build scripts that are to be generated. - - 5. Build the inter-directory dependency chain. This is the chain of - relationships between different directories within the source - hierarchy. Each directory may depend on code from zero or more - other directories within the same package. (That is, a directory - may include header files defined within another directory, and/or - require linking with a library built in that directory.) - - This inter-directory dependency is critical to determine things - such as build order. If one directory must be built before - another directory, the makefiles must be constructed with this - relationship explicit. - - This relationship is determined for each directory by executing - the script named by $[DEPENDS_FILE] (this variable was set by - System.pp) within each source directory scope. Remember, each - Sources.pp file has already been read in, and assigned its own - unique named scope. The DEPENDS_FILE script is responsible for - defining the variable $[DEPEND_DIRS] to contain the - space-separated list of directories (that is, named scopes) that - the files in this current directory depend on. - - Normally, System.pp sets $[DEPENDS_FILE] to - $DTOOL/pptempl/Depends.pp. This script builds up $[DEPEND_DIRS] - based on the $[get_depend_libs] function which is defined in - Global.pp, which is in turn based on variables like $[LOCAL_LIBS] - defined within the Sources.pp file. - - The inter-directory dependency information can be accessed from - within ppremake scripts simply by examining the $[DEPEND_DIRS] - variable within the appropriate scope. In addition, the - directory relationships are automatically used to sort the - variables $[SUBDIR] and $[SUBTREE] in order, such that each - directory is listed after the directories it depends on. - - There is one other variable which should be defined by the - DEPENDS_FILE script: $[DEPENDABLE_HEADERS] should list the source - files within the current directory that may be named as #include - files in other files. This is used to build file-level - dependencies to support the $[dependencies] built-in function, - and is not related to inter-directory dependencies. - - 6. Finally, generate the actual output files in each source - directory. This is done by executing the script named by - $[TEMPLATE_FILE] (set by System.pp) within each source directory - scope. - - Normally, System.pp sets $[TEMPLATE_FILE] to - $DTOOL/pptempl/Template.$[BUILD_TYPE].pp. Recall again that - $[BUILD_TYPE] was specified when Config.pp was read, and controls - the particular type of makefiles or build scripts that are to be - generated, so there is a different Template script file for each - supported build type. - - The Template file is responsible for generating the actual - makefile (or whatever build script is required) as appropriate to - each source directory. It now has all the information required: - all source directories have been read, so the relationships - between different source directories can control the output; - also, the inter-directory and inter-file dependencies are - available. - - Generally, a Template file will include at least one #output - directive to generate the appropriate makefile for this - directory. Since there may be different kinds of source - directories, each with very different makefile requirements, the - Template files usually have one large #if condition based on the - value of $[DIR_TYPE], which is set within each Sources.pp (and - is set in System.pp to default to "src"). diff --git a/panda/src/doc/ppremake-syntax.txt b/panda/src/doc/ppremake-syntax.txt deleted file mode 100644 index f90c1dcfd9..0000000000 --- a/panda/src/doc/ppremake-syntax.txt +++ /dev/null @@ -1,562 +0,0 @@ -NAMED SCOPES - -Any discussion of ppremake script syntax must begin with an -introduction to ppremake's concept of named scopes. This concept is -relied on heavily within ppremake scripts and is the source of most of -the scripting language's power. - -Like many block-scoped languages, ppremake can support arbitrary -nesting levels of scopes. Each nested scope can access variables in -the outer scopes, and can define new variables that are local to that -scope. - -In ppremake, there is one (unnamed) global scope, in which all the -variables defined in Global.pp and related files are declared. There -are also a number of individually named scopes, one scope for each -directory in the source hierarchy that contains a Sources.pp file. -Each of these scopes is a child of the global scope, each of these -defines the variables defined within its Sources.pp file. The name of -each scope is the name of the directory, with a trailing slash. - -For instance, imagine the following simple directory hierarchy: - - root - root/Package.pp - root/Sources.pp - root/apple - root/apple/Sources.pp - root/apple/pear - root/apple/pear/Sources.pp - root/banana - root/banana/Sources.pp - -In this example, there will be five scopes, ordered like this: - - global scope - | - +------+--+--+-----+ - | | | | - root/ apple/ pear/ banana/ - -That is, there is an unnamed global scope, and four named scopes, one -for each of the four Sources.pp files: "root/", "apple/", "pear/", and -"banana/". Each of the named scopes is a sibling of the others, with -no relation to the directory hierarchy; all of the named scopes are -children of the global scope. (The trailing slash is used to -differentiate these automatically-created named scopes from explicit -nested scopes, described below.) - -It is possible to access, from any one of the scopes, variables that -are defined in another scope. The syntax to do this is discussed in -more detail below, but for instance the expression $[FOO(apple/)] -returns the value of $[FOO] as if it were evaluated within the "apple" -scope. - -Although all of the automatically-created named scopes are given a -flat hierarchy, it is possible to define further nested scopes with -the #begin .. #end syntax (described below) within any of the -Sources.pp files. For instance, in the apple/Sources.pp file, you may -have the syntax: - - #define var1 abc - #define var2 def - - #begin foo - #define var2 123 - #define var3 456 - #end foo - -This adds a new named scope called "foo", which is a child of "apple/": - - global scope - | - +------+--+--+-----+ - | | | | - root/ apple/ pear/ banana/ - | - foo - -Within the apple scope, this new named scope can be referenced by the -name "foo"; within other scopes, it must be referenced explicitly as -"apple/foo". In the example, the value of $[var2(apple/)] is "def", -but the value of $[var2(apple/foo)] is "123". - - -PPREMAKE COMMANDS - -The following commands are available in ppremake scripts. The -commands are similar in syntax to C preprocessor directives: each -command must be given one per line, with a hash mark (#) as the first -non-blank character of the line. - -Simple commands: - - #format - - Defines the type of file that is to be generated by the next - #output command (see #output, below). The string must - evaluate to one of a number of strings that are predefined within - ppremake. Presently, this may be one of the following: - - straight - the output file is generated exactly as given, - without any additional formatting. - - collapse - multiple consecutive blank lines are collapsed into - one blank line, but otherwise the output is generated exactly - as given. - - makefile - the output file is a makefile. This implies that - multiple consecutive blank lines may be collapsed, and long - lines (particularly variable assignment lines) may be folded - with the backslash character for readability. - - #print - - Outputs the indicated text to standard error as soon as it is - encountered. This is useful for debugging ppremake scripts; and - is also a good way to report warnings or status information to the - user. - - #printvar [ ... ] - - Outputs the literal contents of the named variable(s) to standard - error. The output is similar to what you would get if you executed: - #print = "$[]" - except the variable contents are not themselves expanded, making - it possible to view the exact literal contents of the variables. - Note that the variable names should be given without the enclosing - $[ ... ] syntax. - - #mkdir [ ... ] - - Creates the indicated directory names, if they do not already - exist. This will also implicitly create any intervening directory - names that are necessary. - - #include - - Includes the named file. As in all the other commands given here, - the angle brackets are not part of the literal syntax; don't - confuse this with the C #include statement. Instead, - means any ppremake expression which can be evaluated to a string. - If the file does not exist, an error is generated. - - #sinclude - - Includes the named file if it exists, or quietly ignores it if it - does not. This can be used to include an optional configuration - file if it exists. - - #call - - Calls the named subroutine immediately. Here is the - name of the subroutine to call, and is the - comma-separated list of expressions to substitute in for the - subroutine's formal parameters. The subroutine must have - previously been defined with the #defsub command (see below). - - #error - - Generates an error and immediately terminates ppremake, reporting - the indicated error message. Usually this appears within an #if - .. #endif block testing for an unexpected error condition. It may - also be used during debugging. - - #define - - Declares a new variable within the current scope with the - indicated name, and sets it to the indicated value. Variables and - expressions within are evaluated immediately, and the - resulting string is stored as the new variable's value. - - If there was already a variable within the current scope with this - name, that variable is replaced with the new value. However, if - there was a variable by the same name in an enclosing scope, the - variable in the scope above is left unchanged, and a new variable - is defined within the current scope, shadowing the variable above. - - Note that in the above does not include the dollar sign - and square bracket syntax. This syntax is used when evaluating - variables, not when referring to them by name. - - #defer - - Behaves the same as #define, but variables and expressions within - are not evaluated immediately. Instead, the - string is assigned to the variable exactly as it is now. When the - variable is evaluated later, expressions appearing within the - string will be evaluated at that time. This behaves kind of like - a simple function declaration: the variable's literal value - depends on the values of the expressions it depends on, which may - be modified at any subsequent point (thus changing the value of - the variable correspondingly). - - This operation is equivalent to VARIABLE = VALUE syntax in GNU - make (and in most makefile syntax). On the other hand, #define is - equivalent to VARIABLE := VALUE in GNU make. - - #set - - Changes the value of an existing variable to the indicated value. - Like #define, variables and expressions within are - evaluated immediately. - - This is different from #define in that (a) the variable must - already exist (i.e. it has appeared as the target of a previous - #define or #defer), and (b) it is possible to change the value of - a variable in an enclosing scope (as opposed to #define and - #defer, which can only shadow a variable in an enclosing scope, - but cannot change the parent variable itself). - - #push [ ... ] - - Copies the definition of the named variable(s) into the enclosing - dynamic scope. This is primarily useful for defining variables - within an #forscopes or #formap block that must be preserved - outside the block; normally, since the code within these blocks - executes within a different scope, invoking the #define command - within these blocks will define a variable only within the - referenced scope, and the variable will not be available outside - the block. - - The solution is to "push" the variable definition into the - immediately enclosing block, which will be the body of the - function that invoked the #forscopes command. It will be as if - the variable were defined immediately outside the #forscopes. - Normally, a count of 1 should be used; if multiple nested blocks - must be pushed through, the count can be increased to indicated - the number of levels of nesting. - - #map () - - Defines a new map variable. A map variable is a unique construct - in ppremake which associates scopes with named keys. See the - discussion on map variables, below. - - Note that, like #define, #defer, and #set, and - in the above do not include the dollar sign and - square bracket syntax. This syntax is used when evaluating - variables, not when referring to them by name. - - #addmap - - Adds a new entry to the indicated map variable, mapping the - indicated key string to the current scope. This command should - normally appear within a #forscopes .. #end block, to add a series - of keys for each of a number of different scopes. - - -Conditional commands: - - #if - ... - #elif - ... - #else - ... - #endif - - This defines a block of code that should only be executed if the - condition is met. The usual semantics apply: in the case of #if, - the immediately following code is executed only if - evaluates true; otherwise, the condition for any subsequent #elif - commands are tested, until one is found that evaluates true. If - no #elif condition evaluates true, the code under #else is - executed; in any case, normal evaluation resumes after #endif. - - #if conditions can be nested without limit, but each #endif must - match a corresponding #if. Error reporting for a mismatched #if - .. #endif pair is limited. - - As with ppremake in general, an expression is considered to be - true if it evaluates to a nonempty string, or false if it - evaluates to an empty string. - - -Block commands: - - Each of the following commands opens a block which should be closed - with a corresponding #end command. It is akin to the matching of - #if .. #endif. Block commands may be nested without limit. In - ppremake, each #end has a parameter, which must match the name on - the corresponding block command, as a visual aid to the programmer. - - #begin - .. - #end - - Begins a new nested scope. All the variables declared within this - block will be associated with the new scope of the indicated name, - which will be a child of the current scope. - - #foreach - .. - #end - - Executes the nested block of code repeatedly, once for each of the - space-separated words in . The represents the - name of a variable that will be created each time through the - loop, with the next value in sequence. - - #forscopes - .. - #end - - Executes the nested block of code repeatedly, once for each of the - scopes named by the space-separated list of names in . - Each time through the loop, the code will be re-evaluated within a - different named scope, potentially providing new values for all of - the variables referenced. Unlike #foreach, no iterator variable - is necessary. - - #formap - .. - #end - - Executes the nested block of code repeatedly, once for each key in - the map variable. Each time through the loop, a variable named - is created with the value of the current key, and the - code is also evaluated within the associated scope. - - #while - .. - #end - - A general while loop, this repeated executes the nested block of - code as long as remains true, i.e. nonempty. - - #for ,[,] - .. - #end - - A specialized iterative loop. The variable named by is - initialized to the value, then the contents of the loop - are repeated, adding each time, until the variable - reaches the value. - - #defsub - .. - #end - - Defines a new subroutine. The nested block of code will be - evaluated when #call is later invoked. The - list is a comma-delimited list of formal parameter names; these - names are the names of variables that will be filled in with the - corresponding actual parameters on the #call command. - - #defun - .. - #end - - Defines a new function. This is similar to a subroutine, except - that the function is invoked inline, like a variable: $[ - ], instead of with the #call command. - - All output generated within the function (that is, lines of text - between #defun and #end that are not part of a command) are - concatenated together into one string (newlines are removed) and - returned as the result of the function. - - #output - .. - #end - - Sends all output within the block (that is, lines of text between - #output and #end that are not part of a command) to the indicated - filename. The are an optional space-separated list of - keywords that modify the output behavior, presently the only - recognized flag is "notouch". - - If the file does not exist, it is created. If the file already - existed and its contents will be changed by this command, a - message is printed to the user and the file is rewritten. - - If the file already existed and its contents would not have been - changed by this command, nothing is printed to the user, although - the file is still rewritten (and the file modification timestamp - is correspondingly updated with the current time and date). - However, if the keyword "notouch" is included among the optional - following the filename, the file (and consequently its - timestamp) will not be modified unless the contents are actually - different. - - -VARIABLE REFERENCES - -The ppremake syntax supports three different kinds of variable -references: ordinary variables, map variables, and function calls. - -Ordinary variable references: - - Variables in ppremake are always referenced using a leading dollar - sign immediately followed by the name of the variable enclosed in - square brackets. This syntax was chosen to resemble the GNU make - variable syntax, but to be visually distinct to avoid confusion with - actual make variables (which we might be writing to a makefile). - - Note that the dollar sign and square brackets are not actually part - of the variable names, but are simply the syntax used to reference - the variable. However, this syntax is used throughout this document - to refer to variables, to clarify that we are referring to ppremake - variable names. - - Common ordinary variables that might be referenced in this way are - ppremake built-in variables like $[DIRNAME] or $[PLATFORM], or any - user-defined variable created with #define or #defer. Since - environment variables are also automatically pulled into the - ppremake variable space (similar to the behavior of make), - environment variables may also be referenced in this way, although - writing scripts that depend on environment variables is not - recommended as it is not as portable (not every platform gives the - user easy access to environment variables). - - There are also some fancy ways to expand ordinary variables. - - Inline pattern substitution: - - Borrowing more syntax from GNU make, ppremake allows you to - modify the contents of the variable according to a pattern-based - substitution, similar to the $[patsubst] function. The syntax - is $[varname:=], where and are filename - patterns each involving a percent sign (%). The percent sign - stands for the part of the filename that remains the same; the - rest is modified accordingly. For instance, $[file:%.c=%.o] - will expand the variable $[file] and automatically replace a .c - extension with .o. It is equivalent to $[patsubst - %.c,%.o,$[file]]. See ppremake-variables.txt. - - Inline foreign scoping: - - A special ppremake syntax exists to evaluate a variable within - one or more different named scopes. The syntax here is - $[varname()], where represents a - space-separated list of words that name the scope or scopes - within which the variable is to be evaluated. The result is the - space-separated concatenation of the values of the variable in - each of the named scopes. - - To make a contrived example, suppose you had a scope named - "foo", in which a variable $[LETTER] is defined to be the string - "alpha", and a scope named "bar", in which a variable $[LETTER] - is defined to be the string "beta". In the current scope, - however, $[LETTER] is defined as "none". - - In this example, the expression $[LETTER] evaluates to "none", - but $[LETTER(foo)] evaluates to "alpha" and $[LETTER(foo bar)] - evaluates to "alpha beta". - -Map variables: - - A map variable is a special ppremake construct to index into a table - of named scopes by key. The map variable is an indexed lookup into - a set of named scopes, to determine in which scope a given variable - has a particular value. - - To define a map variable, you need to have a set of named scopes, - and an ordinary "key" variable that has been declared in each of - them. The syntax is: - - #map () - - Where is the name of the map variable you are declaring, - is the name of the key variable that exists in each of - the scopes, and is the list of scope names over which - the map variable is being built. - - This builds up an index into based on the value of the - $[] within each scope. Within each scope, the - $[] variable is divided at the spaces into words, and - each word is added to the index as a key referencing this scope. - - - For example, consider the $[LETTER] example above. You could define - a simple map variable thus: - - #map letmap LETTER(foo bar) - - This defines a new map variable called "letmap" that maps into the - two named scopes "foo" and "bar", with the key being the value of - $[LETTER] in each of those two scopes. That is, evaluating letmap - with the string "alpha" will return the scope "foo", while - evaluating letmap with the string "beta" will return the scope - "bar". - - In other words, letmap is now a map variable with two key/value - pairs. The two keys are "alpha" and "beta", which map to the two - scopes "foo" and "bar", respectively. The keys represent the values - of the ordinary variable $[LETTER] as evaluated within the two - scopes. - - Note the similarity to the $[LETTER(foo bar)] syntax, which - incidentally returns the string "alpha beta"--the same two keys that - become part of the map variable. A map variable is a lot like an - inline foreign scoping reference, except it remembers which scope - each key came from. - - - To look up scopes in a map variable, use the syntax: - - $[ ,] - - This returns the value of as evaluated within whatever scope - is referenced by the string . To continue our example, - - $[letmap $[upcase $[LETTER]],alpha] - - will evaluate $[upcase $[LETTER]] in the "foo" scope--that is, the - scope associated with the key "alpha"--which incidentally returns - the string "ALPHA". - - It is also legal to look up multiple scopes at once. If - contains spaces, it is divided up into words at the spaces, and each - word is taken as a separate key. The result of the map variable - reference is the concatenation of all the evaluations of the - expressions in all the matched keys. - - - It is sometimes useful to ask whether a key is defined in a map - variable or not. The $[unmapped] function can do this; see - ppremake-variables.txt. Also, the $[closure] function is useful for - evaluating map variables recursively; see ppremake-variables.txt. - - -Function calls: - - Function calls are a little more familiar from other scripting - languages. User functions are defined with the syntax: - - #defun - .. - #end - - where is any arbitrary function name, and is an - optional list of comma-separated formal parameters. Any text that - appears between #defun and its matching #end (and is not part of - some other command) is returned as the result of the function. - - For instance: - - #defun updowncase abc,def - #if $[def] - $[upcase $[abc]] - #else - $[downcase $[abc]] - #endif - #end updowncase - - This defines a function with two parameters. If the second - parameter is true (nonempty), the result of the function is the - upcase of the first parameter; otherwise, the result of the function - is the downcase of the first parameter. - - To invoke the function, the syntax is somewhat like a variable - expansion: - - $[ ] - - E.g.: - - $[updowncase $[filename],] - - Many builtin functions are also available; see - ppremake-variables.txt. diff --git a/panda/src/doc/ppremake-variables.txt b/panda/src/doc/ppremake-variables.txt deleted file mode 100644 index c88bbaecfb..0000000000 --- a/panda/src/doc/ppremake-variables.txt +++ /dev/null @@ -1,500 +0,0 @@ -In general, variables are referenced within ppremake with the syntax -$[variable-name]. Functions, if defined, are referenced by something -like $[function-name arg1 arg2 ... ]. The ppremake syntax borrows -heavily from that of GNU makefile syntax, with GNU make's parentheses -replaced by square brackets to prevent confusion with actual makefile -syntax. - -Note that the dollar sign and square brackets are not actually part of -the variable names, but are simply the syntax used to reference the -variable. This syntax is included with each variable definition in -this document, because that is how you are most likely to see the -variable references. - - - -The general convention is for variables that are built into ppremake, -or defined by the system ppremake scripts in the $DTOOL root -directory, should be defined with uppercase letters. User-defined -variables, such as those used by the scripts in the $DTOOL/pptempl -directory to generate the various kinds of makefiles, are defined with -lowercase letters. However, following the GNU makefile convention, -all built-in function names are lowercase. - - -The following variables are built into the ppremake executable, and -are always defined: - - $[PPREMAKE] - The name of the ppremake program itself, - e.g. "ppremake". - - $[PPREMAKE_VERSION] - The current version number for ppremake. - - $[PLATFORM] - The compiled-in platform string; presently, this may - be one of Linux, Irix, or Win32. - - $[PACKAGE_FILENAME] - The expected name of the file that indicates - the top of the source hierarchy, e.g. Package.pp. - - $[SOURCE_FILENAME] - The expected name of the file that should be - present in each subdirectory within the source hierarchy and - defines the makefiles that should be generated within each - subdirectory, e.g. Sources.pp. - - $[PPREMAKE_CONFIG] - The full pathname to the initial Config.pp file - to read. This may be specified by -c on the ppremake command - line, or if it is unspecified, it is expected the user will set an - environment variable of this name to the appropriate pathname. - - $[TAB] - The tab character. This is primarily useful for generating - makefiles, which insist on having an actual tab character, without - having to store an actual tab character in the input files. - - $[PACKAGE_FILE] - The pathname to the Package.pp file at the top of - the current source hierarchy, relative to the current directory. - - $[TOPDIR] - The directory name containing $[PACKAGE_FILE]; that is, - the directory name of the top of the current source hierarchy. - Unlike $[PACKAGE_FILE], this is an absolute pathname, rather than - a relative pathname. - -The following variables are built into the ppremake executable, and -are updated with the current values as each Sources.pp file is -scanned: - - $[DIRNAME] - The name of the source directory currently being - processed. This is neither a relative nor an absolute directory - path, and does not contain slashes; it is simply the name of the - directory that contains the current Sources.pp file. By - convention, all directory names within a particular source - hierarchy must be unique. - - $[DIRPREFIX] - The relative pathname to the current source - directory, from $[TOPDIR], with a trailing slash. - - $[SOURCEFILE] - The name of the source file currently being - processed. This will be "Sources.pp" (but see also - $[THISFILENAME], below). Thus, for example, - $[TOPDIR]$[DIRPREFIX]$[SOURCEFILE] will be the full pathname to - the current Sources.pp file. - - $[PATH] - The relative pathname to the current directory, from - $[TOPDIR], without a trailing slash. - - $[RELDIR] - This is a special variable that is similar to $[PATH] in - that it contains the relative pathname to the current directory, - but instead of being relative to $[TOPDIR] it is relative to the - current *output* directory--the directory in which the current - #output command in effect is directing its output. This value of - this variable is therefore dependant on context. - - $[SUBDIRS] - A space-delimited list of source subdirectories within - this source directory. These are simply directory names, without - slashes; prefix each name with $[DIRPREFIX] to make them relative - to $[TOPDIR]. These are automatically sorted in dependency order, - such that a particular directory always appears following all the - directories it depends on. - - $[SUBTREE] - A space-delimited list of names of all source - subdirectories, including this one, at this level and below. The - subdirectory names are relative to $[TOPDIR]. As above, these are - sorted into dependency order. - -The following variables are built into the ppremake executable, and -are updated with the current values as *each* different file is read -in (e.g. via the #include directive): - - $[THISFILENAME] - The current filename being read; often as a - relative filename from $[TOPDIR], or as a full pathname when the - file is outside of the current source hierarchy. - - $[THISDIRPREFIX] - The directory containing the current filename - being read, with a trailing slash; this everything up to and - including the rightmost slash in $[THISFILENAME]. - -The following variable is built into the ppremake executable, and is -filled in after all Sources.pp files have been read: - - $[TREE] - a space-delimited list of names of all the directories in - the current source hierarchy containing a Sources.pp file, - relative to $[TOPDIR]. Note that this variable is not available - until after all the Sources.pp files have been read, so it cannot - itself be referenced within a Sources.pp file. - -The following variables are not set by the ppremake executable, but -are required to be set by one of the startup scripts, typically -$DTOOL/pptempl/System.pp: - - $[GLOBAL_FILE] - the full pathname to the file that should be read - within the global scope after reading each Sources.pp file and - before reading each Template file. - - $[TEMPLATE_FILE] - the full pathname to the file that should be read - once for each Sources.pp file to generate the actual output - makefiles appropriate to each directory. - - $[DEPENDS_FILE] - the full pathname to the file that should be read - once for each Sources.pp file to determine the inter-directory - dependencies and inter-file dependencies. - - $[DEPENDENCY_CACHE_FILENAME] - the name of the file (with no - directory part of the filename) that is used to cache the - inter-file dependencies for each source file in a given directory - between sessions. A file by this name is automatically created in - each source directory. - - $[DEPEND_DIRS] - the list of directories that the current directory - depends on. This is set by the script named by $[DEPENDS_FILE], - and has a different value within each source directory. - - $[DEPENDABLE_HEADERS] - the list of source filenames within the - current directory that are considered source header files and that - might be listed with the #include directory in some other file. - This is used to determine the set of inter-file dependencies. - Like $[DEPEND_DIRS], this is set by the $[DEPENDS_FILE] script, - and has a different value within each source directory. - - $[DEPENDABLE_HEADER_DIRS] - the list of directories outside of the - current source tree in which additional header files ("dependable - headers") may be found. This is used to implement inter-package - dependencies. Any files found in the directories named here are - deemed to be dependable headers, and the $[depdencies] variable - will include these files. - - -The following functions are built into the ppremake executable. In -general, these operate on one word or a group of words separated by -spaces. Functions that take multiple parameters with different -meanings will use commas to separate out the individual parameters -(and then each parameter may still consist of one word or a group of -words). The result is always a string, which might be true/false, or -one word or a group of words. For true/false results, the return -value is either the empty string (false) or a nonempty string (true). - - $[isfullpath ] - returns true if is a full - pathname, i.e. it begins with a slash. Remember that ppremake - always uses Unix-style pathnames internally, even on a Windows - platform. - - $[osfilename ] - converts the indicated Unix-style - pathname to a format appropriate to the platform in use. For - instance, on Windows it replaces all of the forward slashes with - backslashes. On a Unix platform it does nothing. - - $[unixfilename ] - converts the indicated native-style - pathname to a Unix-style pathname for internal operations. This - can be used to read a pathname as supplied by the user, which - might be in Windows style format (i.e. with backslashes instead of - forward slashes). - - $[unixshortname ] - converts the indicated native-style - pathname to a Unix-style pathname for internal operations, using - the 8.3 Windows "short" name, if possible. This is often an easy - way to avoid spaces in long Windows filenames, like c:/Program - Files/whatever. - - $[cygpath_w ] - similar to $[osfilename], except it takes - advantage of the Cygwin library, if available, to do a more - accurate filename conversion. This is generally specific to the - Windows platform. The result is the same as the output of the - 'cygpath -w' shell command. - - $[cygpath_p ] - similar to $[unixfilename], but as above, - duplicates the 'cygpath -p -u' shell command. - - $[wildcard ...] - expands the indicated parameters - as if they were filename wildcards against the current directory. - For example, $[wildcard *.c] returns a list of all C files in the - current directory. - - $[isdir ] - returns true if the named file exists and is a - directory, false otherwise. This actually expands the - parameter(s) given, similar to $[wildcard], and tests the first - file returned. - - $[isfile ] - returns true if the named file exists and is - a regular file, false otherwise. This actually expands the - parameter(s) given, similar to $[wildcard], and tests the first - file returned. - - $[libtest ,] - checks to see if a library file by - the given name exists in any of the named directories. Here - may be any space-separated list of directory names. - Returns true if the library is found, false otherwise. - - This function follows the following ppremake convention: if a - library name is given without an extension, the actual filename to - search for is constructed by prefixing "lib" and adding whatever - extension is appropriate for the OS in question. For instance, - "nspr" may search for libnspr.a (or libnspr.lib on Windows). - However, if the library name is given including an extension, that - is taken to be the filename without modification. - - $[bintest ] - checks to see if an executable program exists - on the current search path. The program may or may not include - the final ".exe" extension (on Windows). Returns true if it is - found, false otherwise. - - $[shell ] - executes the indicated command in a sub-shell, - and returns the standard output from the process. Use of this - command is somewhat unportable (it doesn't work on a Windows - machine that doesn't have Cygwin installed). - - $[standardize ] - convert the indicated filename to - standard form by removing consecutive repeated slashes and - collapsing /../ where possible. - - $[canonical ] - convert the indicated filename to - canonical form by replacing the directory part with the - fully-qualified directory part. This is done by changing to that - directory and calling getcwd(). The result is similar to that of - $[standardize], above, but it is more likely to be consistent - across different filenames. - - This has the effect of (a) converting relative paths to absolute - paths, (b) always resolving a given directory name to the same - string, even if different symbolic links are traversed, and (c) - changing nice symbolic-link paths like /fit/people/drose to ugly - NFS automounter names like /hosts/dimbo/usr2/fit/people/drose. - This can be troubling, but sometimes this is exactly what you - want. - - $[length ] - returns the length of the indicated argument - in characters, not counting leading or trailing spaces. - - $[substr ,,] - returns the substring of - beginning at character (1-based) and continuing to character - , inclusive. - - $[dir ] - returns the directory part of the filename - argument(s). This is the text up to and including the rightmost - slash of each argument, or "./" if the argument contains no slash. - For example, $[dir abc/def/t.c abc/foo.bar lib.exe] will return - the string "abc/def/ abc/ ./". - - $[notdir ] - returns everything except the directory part - of the filename argument(s). This the text following the - rightmost slash of each argument, or the argument itself if there - is no slash. - - $[suffix ] - returns the filename extension of each - argument, including the leading dot, if any. If there is no - extension, it returns the empty string. - - $[basename ] - returns the basename part of each - argument: everything except for the extension and its dot, but - including the directory, if any. - - $[makeguid ] - returns a GUID (global unique identifier) based - on an MD5 digest computation of . The resulting GUID, which - looks like 398F2CC4-C683-26EB-3251-6FC996738F7F, is suitable for - identifying Visual Studio .NET projects. - - $[word ,] - returns the nth word, 1-based, of the - space-separated list of words in the second parameter. - - $[wordlist ,,] - returns the range of words, 1-based, - of the space-separated list of words in the third parameter. See - also $[substr]. - - $[words ] - returns the number of space-separated words in - the list. - - $[firstword ] - returns the first word in the space-separated - list. This is the same as $[word 1,]. - - $[patsubst ,,] - modifies each of the words in the - list (typically, these will be filenames) according to the - / pattern matching. - - Both the and the pattern should include exactly one - percent sign (%). This symbol stands for any sequence of - characters in the filename, and the rest of the pattern represents - literal text. Whatever is matched by the percent sign in - is subsituted in for the percent sign in . - - For example, $[patsubst %.c,%.o,$[sources]] will replace each - filename listed in $[sources] that ends in .c with a corresponding - filename that ends in .o instead. - - The percent sign may appear in the beginning, middle, or end of - the pattern, but it must appear once. It may not appear - twice within a pattern string (but see the special extension for - space-separated patterns, below). If a filename in the - list does not match the pattern, it is left unchanged. In - practice, the percent sign is usually used to stand for the first - part of the filename, and the extension is matched explicitly. - - This function is based on the $(patsubst) function as used in GNU - makefiles. As a special extension to GNU syntax, you may also - insert multiple pairs of , replacement patterns: - - $[patsubst ,,,,,,...,] - - In this syntax, each word will be tested against each pattern in - sequence, until a match is found. When the first match is - found for a given word, the corresponding string is used to - generate the replacement. If all patterns are exhausted - and a match has not been found, the word is inserted unchanged. - - For example: the expression $[patsubst %.c,%.h,%.C,%.H,$[files]] - will convert each .c file to the corresponding .h file, and each - .C file to the corresponding .H file. - - As a further extension to GNU syntax, each pattern may - actually be a space-separate sequence of multiple patterns. In - this case, if the word matches any of the patterns, it is - considered to match the whole pattern. For example, $[patsubst - %.c %.y %.l,%.o,$[files]] will replace any filename in $[files] - that ends in .c, .y, or .l with the extension .o. - - $[patsubstw ,,] - as above, but is not split - into multiple words, even it it contains spaces--it is matched, - spaces and all, with the patterns in the and strings. - - $[filter ,] - filters the space-separated list of - to return only those words that match one or more of the - patterns given in the space-separated list of . For - instance, $[filter %.c,$[files]] returns only those filenames in - $[files] that end in .c. (The same thing can also be achieved - with $[patsubst %.c,%.c,%,,$[files]]--this replaces each - occurrence of %.c with itself, and everything else (%) with the - empty string.) - - $[filter-out ,] - the inverse of $[filter], this - returns only the words that do *not* match any of the patterns in - . For instance, $[filter-out %.c,$[files]] returns only - those file in $[files] that do *not* end in .c. (The same thing - can also be achieved with $[patsubst %.c,,%,%,$[files]].) - - $[subst ,,] - substitutes all occurrences of - appearing in with . Unlike $[patsubst], this pays no - attention to percent signs and does not chop up into words; - it is strictly a byte-for-byte replacement. For instance, $[subst - foo,bar,I need food] produces "I need bard". - - As a further extension to GNU, similar to the corresponding - extension for $[patsubst], you may include multiple , - pairs, e.g.: - - $[subst ,,,,,,...,] - - $[wordsubst ,,] - like $[subst], except it only - replaces whole words. - - $[findstring ,] - returns if and only if it is a substring - of ; otherwise, returns the empty string. - - $[sort ] - returns the space-separated list of , - sorted into alphabetical order. This also removes duplicate - words; $[sort] is therefore often used solely for its side effect - of eliminating duplicate words from a list. - - $[unique ] - removes duplicate words from the list without - changing their respective order. Since this is slightly slower - than $[sort], it should only be used when the order of the - original words on the list is important. - - $[join ] - joins the space-separated list of - into a single string using the separator . - - $[matrix ,,,...,] - splits each - parameter up into a space-separated set of words, and then returns - a result that represents all the ways to combine the different - words in each parameter, like the shell {a,b,c} expansion syntax. - For example, $[matrix a b,c,10 20 30] expands to ac10 ac20 ac30 - bc10 bc20 bc30. - - $[if ,,] - returns if the expression string - is true (that is, nonempty), or if is false - (empty). The false condition may be omitted; if so, empty - string is returned if is false. - - $[foreach ,,] - evaluates once for each - word in the space-separated list . For each such word, a - variable named is assigned the current word, then - is evaluated; the result is the concatenation of all the - evaluations. For instance, $[foreach t,dog cat - mouse,foo/bar/$[t].c] produces "foo/bar/dog.c foo/bar/cat.c - foo/bar/mouse.c". - - $[forscopes ,] - like $[foreach], above, but evaluates - once within each of the scopes named by the space-separated - list. See the discussion on ppremake named scopes in - ppremake-syntax.txt. - - $[eq ,] - returns true (nonempty) if is string - equivalent to , disregarding leading and trailing spaces. - - $[ne ,] - returns true (nonempty) if is *not* string - equivalent to , disregarding leading and trailing spaces. - - $[defined ] - returns true if the named variable has any - definition, whether it is empty or nonempty, or false if it has - not yet been defined. Since the semantic convention of ppremake - is intended to be that all variables are implicitly defined to the - empty string if they are not explicitly defined otherwise, the - meaning of this function is questionable. - - $[= ,] - returns true (nonempty) if is numerically - equivalent to . It is an error if either or is - not a number. This may also be written as $[== ,]. - - $[!= ,] - $[< ,] - $[<= ,] - $[> ,] - $[>= ,] - The above all have the obvious semantic meaning, based on a - numerical comparison of and . - - $[+ ,] - $[- ,] - $[- ] - $[* ,] - $[/ ,] - $[% ,] - The above perform the appropriate arithmetic operation on - and (or on only, in the case of unary minus). The - operation is always integer. - - $[not ] - returns true (nonempty) if the expression is empty, - and false (empty) if the expression is nonempty. - - $[or ,,...,] - returns true (nonempty) if any - of the subexpressions are nonempty. - - $[and ,,...,] - returns true (nonempty) if all - of the subexpressions are nonempty. - - $[upcase ] - returns the input text, with all lowercase - letters converted to uppercase. - - $[downcase ] - returns the input text, with all uppercase - letters converted to lowercase. - - $[cdefine ] - a convenience function to output a C-style - #define or #undef statement based on the value of the named - variable. If the named string is a variable whose definition is - nonempty, this returns "#define varname definition". Otherwise, - it returns "#undef varname". This is particularly useful for - building up a config.h file. - - $[dependencies ] - outputs a list of all the other source - files that the named source file depends on. The set of - dependencies for a particular source file is determined by - ppremake when it scans all the directories; it scans each source - file for the presence of #include directives and uses this - information to build a file dependency tree. This allows ppremake - to generate makefiles with the proper file dependencies built in, - even on systems for which makefile autodependencies have not been - implemented. - - $[closure ,] - recursively expands the map variable - $[varname] with the expression , until all definitions have - been encountered. See the discussion on ppremake map variables in - ppremake-syntax.txt. - - $[unmapped ,] - returns all the words in the - space-separated list that do not match any of the keys in - the indicated map variable. diff --git a/panda/src/downloader/Sources.pp b/panda/src/downloader/Sources.pp deleted file mode 100644 index 6b624efc19..0000000000 --- a/panda/src/downloader/Sources.pp +++ /dev/null @@ -1,108 +0,0 @@ -#define LOCAL_LIBS p3express p3pandabase -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dtool:m -#define USE_PACKAGES zlib net openssl - -#begin lib_target - #define TARGET p3downloader - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_downloader.h \ - bioPtr.I bioPtr.h \ - bioStreamPtr.I bioStreamPtr.h \ - bioStream.I bioStream.h bioStreamBuf.h \ - chunkedStream.I chunkedStream.h \ - chunkedStreamBuf.h chunkedStreamBuf.I \ - decompressor.h decompressor.I \ - documentSpec.I documentSpec.h \ - downloadDb.I downloadDb.h \ - download_utils.h \ - extractor.h \ - httpAuthorization.I httpAuthorization.h \ - httpBasicAuthorization.I httpBasicAuthorization.h \ - httpChannel.I httpChannel.h \ - httpClient.I httpClient.h \ - httpCookie.I httpCookie.h \ - httpDate.I httpDate.h \ - httpDigestAuthorization.I httpDigestAuthorization.h \ - httpEntityTag.I httpEntityTag.h \ - httpEnum.h \ - identityStream.I identityStream.h \ - identityStreamBuf.h identityStreamBuf.I \ - multiplexStream.I multiplexStream.h \ - multiplexStreamBuf.I multiplexStreamBuf.h \ - patcher.h patcher.I \ - socketStream.h socketStream.I \ - stringStreamBuf.I stringStreamBuf.h \ - stringStream.I stringStream.h \ - urlSpec.I urlSpec.h \ - virtualFileHTTP.I virtualFileHTTP.h \ - virtualFileMountHTTP.I virtualFileMountHTTP.h - - #define INCLUDED_SOURCES \ - config_downloader.cxx \ - bioPtr.cxx \ - bioStreamPtr.cxx \ - bioStream.cxx bioStreamBuf.cxx \ - chunkedStream.cxx chunkedStreamBuf.cxx \ - decompressor.cxx \ - documentSpec.cxx \ - downloadDb.cxx \ - download_utils.cxx \ - extractor.cxx \ - httpAuthorization.cxx \ - httpBasicAuthorization.cxx \ - httpChannel.cxx \ - httpClient.cxx \ - httpCookie.cxx \ - httpDate.cxx \ - httpDigestAuthorization.cxx \ - httpEntityTag.cxx \ - httpEnum.cxx \ - identityStream.cxx identityStreamBuf.cxx \ - multiplexStream.cxx multiplexStreamBuf.cxx \ - patcher.cxx \ - socketStream.cxx \ - stringStreamBuf.cxx \ - stringStream.cxx \ - urlSpec.cxx \ - virtualFileHTTP.cxx \ - virtualFileMountHTTP.cxx - - #define INSTALL_HEADERS \ - bioPtr.I bioPtr.h \ - bioStreamPtr.I bioStreamPtr.h \ - bioStream.I bioStream.h bioStreamBuf.h \ - chunkedStream.I chunkedStream.h \ - chunkedStreamBuf.h chunkedStreamBuf.I \ - config_downloader.h \ - decompressor.h decompressor.I \ - documentSpec.h documentSpec.I \ - download_utils.h downloadDb.h downloadDb.I \ - extractor.h \ - httpAuthorization.I httpAuthorization.h \ - httpBasicAuthorization.I httpBasicAuthorization.h \ - httpChannel.I httpChannel.h \ - httpClient.I httpClient.h \ - httpCookie.I httpCookie.h \ - httpDate.I httpDate.h \ - httpDigestAuthorization.I httpDigestAuthorization.h \ - httpEntityTag.I httpEntityTag.h \ - httpEnum.h \ - identityStream.I identityStream.h \ - identityStreamBuf.h identityStreamBuf.I \ - multiplexStream.I multiplexStream.h \ - multiplexStreamBuf.I multiplexStreamBuf.h \ - patcher.h patcher.I \ - socketStream.h socketStream.I \ - stringStreamBuf.I stringStreamBuf.h \ - stringStream.I stringStream.h \ - urlSpec.h urlSpec.I \ - virtualFileHTTP.I virtualFileHTTP.h \ - virtualFileMountHTTP.I virtualFileMountHTTP.h - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/downloadertools/Sources.pp b/panda/src/downloadertools/Sources.pp deleted file mode 100644 index 957709cbf1..0000000000 --- a/panda/src/downloadertools/Sources.pp +++ /dev/null @@ -1,104 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3pystub p3prc:c -#define LOCAL_LIBS p3downloader p3express -#define USE_PACKAGES openssl zlib - -#begin bin_target - #define TARGET apply_patch - #define BUILD_TARGET $[HAVE_OPENSSL] - - #define SOURCES \ - apply_patch.cxx - - #define INSTALL_HEADERS \ - -#end bin_target - -#begin bin_target - #define TARGET build_patch - #define BUILD_TARGET $[HAVE_OPENSSL] - - #define SOURCES \ - build_patch.cxx - -#end bin_target - -#begin bin_target - #define TARGET show_ddb - #define BUILD_TARGET $[HAVE_OPENSSL] - - #define SOURCES \ - show_ddb.cxx - -#end bin_target - -#begin bin_target - #define TARGET check_adler - #define BUILD_TARGET $[HAVE_ZLIB] - - #define SOURCES \ - check_adler.cxx - -#end bin_target - -#begin bin_target - #define TARGET check_crc - #define BUILD_TARGET $[HAVE_ZLIB] - - #define SOURCES \ - check_crc.cxx - -#end bin_target - -#begin bin_target - #define TARGET check_md5 - #define BUILD_TARGET $[HAVE_OPENSSL] - - #define SOURCES \ - check_md5.cxx - -#end bin_target - -#begin bin_target - #define TARGET multify - - #define SOURCES \ - multify.cxx - -#end bin_target - -#begin bin_target - #define TARGET pzip - #define BUILD_TARGET $[HAVE_ZLIB] - - #define SOURCES \ - pzip.cxx - -#end bin_target - -#begin bin_target - #define TARGET punzip - #define BUILD_TARGET $[HAVE_ZLIB] - - #define SOURCES \ - punzip.cxx - -#end bin_target - -#begin bin_target - #define TARGET pencrypt - #define BUILD_TARGET $[HAVE_OPENSSL] - - #define SOURCES \ - pencrypt.cxx - -#end bin_target - -#begin bin_target - #define TARGET pdecrypt - #define BUILD_TARGET $[HAVE_OPENSSL] - - #define SOURCES \ - pdecrypt.cxx - -#end bin_target diff --git a/panda/src/dxgsg9/Sources.pp b/panda/src/dxgsg9/Sources.pp deleted file mode 100644 index 7a58fbcf2e..0000000000 --- a/panda/src/dxgsg9/Sources.pp +++ /dev/null @@ -1,48 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_DX9] - -#define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#define USE_PACKAGES dx9 cg cgdx9 - -#begin lib_target - #define TARGET p3dxgsg9 - #define LOCAL_LIBS \ - p3gsgbase p3gobj p3display p3windisplay \ - p3putil p3linmath p3mathutil p3pnmimage p3event - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - // build dxGraphicsStateGuardian separately since its so big - - #define SOURCES \ - dxGraphicsStateGuardian9.cxx \ - dxGraphicsDevice9.h \ - wdxGraphicsPipe9.I wdxGraphicsPipe9.h \ - wdxGraphicsWindow9.I wdxGraphicsWindow9.h \ - dxgsg9base.h config_dxgsg9.h dxGraphicsStateGuardian9.I dxGraphicsStateGuardian9.h \ - dxVertexBufferContext9.h dxVertexBufferContext9.I \ - dxIndexBufferContext9.h dxIndexBufferContext9.I \ - dxTextureContext9.h dxTextureContext9.I \ - dxGeomMunger9.h dxGeomMunger9.I \ - dxGraphicsDevice9.h \ - dxOcclusionQueryContext9.h dxOcclusionQueryContext9.I \ - dxShaderContext9.h \ - vertexElementArray.h - - #define INCLUDED_SOURCES \ - config_dxgsg9.cxx \ - dxVertexBufferContext9.cxx \ - dxIndexBufferContext9.cxx \ - dxTextureContext9.cxx \ - dxGeomMunger9.cxx \ - dxGraphicsDevice9.cxx \ - wdxGraphicsPipe9.cxx \ - wdxGraphicsWindow9.cxx \ - wdxGraphicsBuffer9.cxx \ - dxShaderContext9.cxx \ - dxOcclusionQueryContext9.cxx \ - vertexElementArray.cxx - -#end lib_target diff --git a/panda/src/dxml/Sources.pp b/panda/src/dxml/Sources.pp deleted file mode 100644 index 77a2e5fac8..0000000000 --- a/panda/src/dxml/Sources.pp +++ /dev/null @@ -1,67 +0,0 @@ -#begin static_lib_target - #define TARGET p3tinyxml - - #define COMBINED_SOURCES tinyxml_composite1.cxx - - #define SOURCES \ - tinyxml.h - - #define INCLUDED_SOURCES \ - tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp - - #define INSTALL_HEADERS \ - tinyxml.h - - #define EXTRA_CDEFS TIXML_USE_STL - #define C++FLAGS $[CFLAGS_SHARED] - -#end static_lib_target - -#if $[P3D_PLUGIN_MT] -#begin static_lib_target -// -// libp3tinyxml_mt.lib, the same as above, with /MT compilation. This -// is needed when building the /MT plugin. -// - #define TARGET p3tinyxml_mt - #define LINK_FORCE_STATIC_RELEASE_C_RUNTIME 1 - - #define COMBINED_SOURCES tinyxml_composite1.cxx - - #define SOURCES \ - tinyxml.h - - #define INCLUDED_SOURCES \ - tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp - - #define INSTALL_HEADERS \ - tinyxml.h - - #define EXTRA_CDEFS TIXML_USE_STL - #define C++FLAGS $[CFLAGS_SHARED] - -#end static_lib_target -#endif // $[P3D_PLUGIN_MT] - -#begin lib_target - #define TARGET p3dxml - - #define LOCAL_LIBS p3pandabase - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dtool:m - - #define COMBINED_SOURCES p3dxml_composite1.cxx - - #define SOURCES \ - config_dxml.h tinyxml.h - - #define INCLUDED_SOURCES \ - config_dxml.cxx \ - tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp - - // It's important not to include tinyxml.h on the IGATESCAN list, - // because that file has to be bracketed by BEGIN_PUBLISH - // .. END_PUBLISH (which is handled by config_dxml.cxx). - #define IGATESCAN config_dxml.h $[INCLUDED_SOURCES] -#end lib_target diff --git a/panda/src/egg/Sources.pp b/panda/src/egg/Sources.pp deleted file mode 100644 index ed5b938e4e..0000000000 --- a/panda/src/egg/Sources.pp +++ /dev/null @@ -1,156 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_EGG] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define YACC_PREFIX eggyy -#define FLEXFLAGS -i -#define USE_PACKAGES zlib - -#begin lib_target - #define TARGET p3egg - #define LOCAL_LIBS \ - p3mathutil p3linmath p3putil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_egg.h eggAnimData.I eggAnimData.h \ - eggAnimPreload.I eggAnimPreload.h \ - eggAttributes.I \ - eggAttributes.h eggBin.h eggBinMaker.h eggComment.I \ - eggComment.h \ - eggCompositePrimitive.I eggCompositePrimitive.h \ - eggCoordinateSystem.I eggCoordinateSystem.h \ - eggCurve.I eggCurve.h eggData.I eggData.h \ - eggExternalReference.I eggExternalReference.h \ - eggFilenameNode.I eggFilenameNode.h eggGroup.I eggGroup.h \ - eggGroupNode_ext.cxx eggGroupNode_ext.h \ - eggGroupNode.I eggGroupNode.h eggGroupUniquifier.h \ - eggLine.I eggLine.h \ - eggMaterial.I eggMaterial.h eggMaterialCollection.I \ - eggMaterialCollection.h \ - eggMesher.h eggMesher.I \ - eggMesherEdge.h eggMesherEdge.I \ - eggMesherFanMaker.h eggMesherFanMaker.I \ - eggMesherStrip.h eggMesherStrip.I \ - eggMiscFuncs.I eggMiscFuncs.h \ - eggMorph.I eggMorph.h eggMorphList.I eggMorphList.h \ - eggNamedObject.I eggNamedObject.h eggNameUniquifier.h \ - eggNode.I eggNode.h eggNurbsCurve.I eggNurbsCurve.h \ - eggNurbsSurface.I eggNurbsSurface.h eggObject.I eggObject.h \ - eggParameters.h \ - eggPatch.I eggPatch.h \ - eggPoint.I eggPoint.h eggPolygon.I \ - eggPolygon.h eggPolysetMaker.h eggPoolUniquifier.h \ - eggPrimitive.I eggPrimitive.h \ - eggRenderMode.I eggRenderMode.h \ - eggSAnimData.I eggSAnimData.h eggSurface.I eggSurface.h \ - eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \ - eggTexture.h eggTextureCollection.I eggTextureCollection.h \ - eggTriangleFan.I eggTriangleFan.h \ - eggTriangleStrip.I eggTriangleStrip.h \ - eggTransform.I eggTransform.h \ - eggUserData.I eggUserData.h \ - eggUtilities.I eggUtilities.h \ - eggVertex.I eggVertex.h \ - eggVertexAux.I eggVertexAux.h \ - eggVertexPool.I eggVertexPool.h \ - eggVertexUV.I eggVertexUV.h \ - eggXfmAnimData.I \ - eggXfmAnimData.h eggXfmSAnim.I eggXfmSAnim.h parserDefs.h \ - parser.yxx lexerDefs.h lexer.lxx pt_EggMaterial.h \ - vector_PT_EggMaterial.h pt_EggTexture.h \ - vector_PT_EggTexture.h pt_EggVertex.h vector_PT_EggVertex.h - - #define INCLUDED_SOURCES \ - config_egg.cxx eggAnimData.cxx \ - eggAnimPreload.cxx \ - eggAttributes.cxx eggBin.cxx \ - eggBinMaker.cxx eggComment.cxx \ - eggCompositePrimitive.cxx \ - eggCoordinateSystem.cxx \ - eggCurve.cxx eggData.cxx eggExternalReference.cxx \ - eggFilenameNode.cxx eggGroup.cxx \ - eggGroupNode.cxx \ - eggGroupUniquifier.cxx eggLine.cxx eggMaterial.cxx \ - eggMaterialCollection.cxx \ - eggMesher.cxx \ - eggMesherEdge.cxx \ - eggMesherFanMaker.cxx \ - eggMesherStrip.cxx \ - eggMiscFuncs.cxx eggMorphList.cxx \ - eggNamedObject.cxx eggNameUniquifier.cxx eggNode.cxx \ - eggNurbsCurve.cxx eggNurbsSurface.cxx eggObject.cxx \ - eggParameters.cxx \ - eggPatch.cxx \ - eggPoint.cxx eggPolygon.cxx eggPolysetMaker.cxx \ - eggPoolUniquifier.cxx eggPrimitive.cxx eggRenderMode.cxx \ - eggSAnimData.cxx eggSurface.cxx eggSwitchCondition.cxx \ - eggTable.cxx eggTexture.cxx eggTextureCollection.cxx \ - eggTransform.cxx \ - eggTriangleFan.cxx \ - eggTriangleStrip.cxx \ - eggUserData.cxx \ - eggUtilities.cxx eggVertex.cxx \ - eggVertexAux.cxx \ - eggVertexPool.cxx eggVertexUV.cxx \ - eggXfmAnimData.cxx eggXfmSAnim.cxx pt_EggMaterial.cxx \ - vector_PT_EggMaterial.cxx pt_EggTexture.cxx \ - vector_PT_EggTexture.cxx pt_EggVertex.cxx \ - vector_PT_EggVertex.cxx - - #define INSTALL_HEADERS \ - eggAnimData.I eggAnimData.h \ - eggAnimPreload.I eggAnimPreload.h \ - eggAttributes.I eggAttributes.h eggBin.h eggBinMaker.h eggComment.I \ - eggComment.h \ - eggCompositePrimitive.I eggCompositePrimitive.h \ - eggCoordinateSystem.I eggCoordinateSystem.h eggCurve.I \ - eggCurve.h eggData.I eggData.h eggExternalReference.I \ - eggExternalReference.h eggFilenameNode.I eggFilenameNode.h \ - eggGroup.I eggGroup.h \ - eggGroupNode_ext.h eggGroupNode.I eggGroupNode.h \ - eggGroupUniquifier.h \ - eggLine.I eggLine.h \ - eggMaterial.I \ - eggMaterial.h eggMaterialCollection.I eggMaterialCollection.h \ - eggMorph.I eggMorph.h eggMorphList.I eggMorphList.h \ - eggNamedObject.I eggNamedObject.h eggNameUniquifier.h eggNode.I eggNode.h \ - eggNurbsCurve.I eggNurbsCurve.h eggNurbsSurface.I eggNurbsSurface.h \ - eggObject.I eggObject.h eggParameters.h \ - eggPatch.I eggPatch.h \ - eggPoint.I eggPoint.h \ - eggPolygon.I eggPolygon.h eggPolysetMaker.h eggPoolUniquifier.h \ - eggPrimitive.I eggPrimitive.h eggRenderMode.I eggRenderMode.h \ - eggSAnimData.I eggSAnimData.h eggSurface.I eggSurface.h \ - eggSwitchCondition.h eggTable.I eggTable.h eggTexture.I \ - eggTexture.h eggTextureCollection.I eggTextureCollection.h \ - eggTransform.I eggTransform.h \ - eggTriangleFan.I eggTriangleFan.h \ - eggTriangleStrip.I eggTriangleStrip.h \ - eggUserData.I eggUserData.h \ - eggUtilities.I eggUtilities.h \ - eggVertex.I eggVertex.h \ - eggVertexAux.I eggVertexAux.h \ - eggVertexPool.I eggVertexPool.h \ - eggVertexUV.I eggVertexUV.h \ - eggXfmAnimData.I eggXfmAnimData.h \ - eggXfmSAnim.I eggXfmSAnim.h \ - pt_EggMaterial.h vector_PT_EggMaterial.h \ - pt_EggTexture.h vector_PT_EggTexture.h \ - pt_EggVertex.h vector_PT_EggVertex.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_egg - #define LOCAL_LIBS \ - p3egg p3putil p3mathutil - - #define SOURCES \ - test_egg.cxx - -#end test_bin_target - diff --git a/panda/src/egg/config_egg.cxx b/panda/src/egg/config_egg.cxx index 0aa50cbcb7..166d6488e0 100644 --- a/panda/src/egg/config_egg.cxx +++ b/panda/src/egg/config_egg.cxx @@ -1,230 +1,230 @@ -// Filename: config_egg.cxx -// Created by: drose (19Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "config_egg.h" -#include "eggRenderMode.h" -#include "eggAnimData.h" -#include "eggAnimPreload.h" -#include "eggAttributes.h" -#include "eggBin.h" -#include "eggBinMaker.h" -#include "eggComment.h" -#include "eggCompositePrimitive.h" -#include "eggCoordinateSystem.h" -#include "eggCurve.h" -#include "eggExternalReference.h" -#include "eggFilenameNode.h" -#include "eggGroup.h" -#include "eggGroupNode.h" -#include "eggGroupUniquifier.h" -#include "eggLine.h" -#include "eggMaterial.h" -#include "eggNameUniquifier.h" -#include "eggNamedObject.h" -#include "eggNode.h" -#include "eggNurbsCurve.h" -#include "eggNurbsSurface.h" -#include "eggObject.h" -#include "eggPatch.h" -#include "eggPoint.h" -#include "eggPolygon.h" -#include "eggPolysetMaker.h" -#include "eggPoolUniquifier.h" -#include "eggPrimitive.h" -#include "eggSAnimData.h" -#include "eggSurface.h" -#include "eggSwitchCondition.h" -#include "eggTable.h" -#include "eggTexture.h" -#include "eggTriangleFan.h" -#include "eggTriangleStrip.h" -#include "eggUserData.h" -#include "eggVertex.h" -#include "eggVertexPool.h" -#include "eggVertexUV.h" -#include "eggVertexAux.h" -#include "eggXfmAnimData.h" -#include "eggXfmSAnim.h" - -#include "dconfig.h" - -Configure(config_egg); -NotifyCategoryDef(egg, ""); - -ConfigureFn(config_egg) { - init_libegg(); -} - -ConfigVariableBool egg_support_old_anims -("egg-support-old-anims", true, - PRC_DESC("Set this true to support loading of old character animation files, which " - "had the convention that the order \"phr\" implied a reversed roll.")); - -ConfigVariableBool egg_mesh -("egg-mesh", true, - PRC_DESC("Set this true to convert triangles and higher-order polygons " - "into triangle strips and triangle fans when an egg file is " - "loaded or converted to bam. Set this false just to triangulate " - "everything into independent triangles.")); - -ConfigVariableBool egg_retesselate_coplanar -("egg-retesselate-coplanar", false, - PRC_DESC("If this is true, the egg loader may reverse the " - "tesselation direction of a single pair of planar triangles that " - "share the same properties, if that will help get a better " - "triangle strip. In some rare cases, doing so can distort the " - "UV's on a face; turning this off should eliminate that artifact " - "(at the cost of less-effective triangle stripping).")); - -ConfigVariableBool egg_unroll_fans -("egg-unroll-fans", true, - PRC_DESC("Set this true to allow the egg loader to convert weak triangle " - "fans--triangles that share the same vertex but aren't " - "connected enough to justify making a triangle fan primitive " - "from them--into a series of zig-zag triangles that can make " - "a triangle strip that might connect better with its neighbors.")); - -ConfigVariableBool egg_show_tstrips -("egg-show-tstrips", false, - PRC_DESC("Set this true to color each triangle strip a random color, with " - "the leading triangle a little bit darker, so you can visually " - "observe the quality of the triangle stripping algorithm.")); - -ConfigVariableBool egg_show_qsheets -("egg-show-qsheets", false, - PRC_DESC("Set this true to color each quadsheet a random color, so you " - "can visually observe the quadsheet algorithm.")); - -ConfigVariableBool egg_show_quads -("egg-show-quads", false, - PRC_DESC("Set this true to color each detected quad a random color, so " - "you can visually observe the algorithm that unifies pairs of " - "triangles into quads (prior to generating triangle strips).")); - -ConfigVariableBool egg_subdivide_polys -("egg-subdivide-polys", true, - PRC_DESC("This is obsolete. In the old Geom implementation, it used to " - "be true to force higher-order polygons that were not otherwise " - "meshed to be subdivided into triangles. In the new " - "Geom implementation, this happens anyway.")); - -ConfigVariableBool egg_consider_fans -("egg-consider-fans", false, - PRC_DESC("Set this true to enable the egg mesher to consider making " - "triangle fans out of triangles that are connected at a common " - "vertex. This may help if your scene involves lots of such " - "connected triangles, but it can also make the overall stripping " - "less effective (by interfering with triangle strips).")); - -ConfigVariableDouble egg_max_tfan_angle -("egg-max-tfan-angle", 40.0, - PRC_DESC("The maximum average angle per triangle to allow in a triangle " - "fan. If triangles are larger than this--that is, more loosely " - "packed--then we figure a triangle strip is likely to do a " - "more effective job than a triangle fan, and the fan maker leaves " - "it alone.")); - -ConfigVariableInt egg_min_tfan_tris -("egg-min-tfan-tris", 4, - PRC_DESC("The minimum number of triangles that must be involved in order " - "to generate a triangle fan. Fewer than this is just interrupting " - "a triangle strip.")); - -ConfigVariableDouble egg_coplanar_threshold -("egg-coplanar-threshold", 0.01, - PRC_DESC("The numerical threshold below which polygons are considered " - "to be coplanar. Determined empirically.")); - -ConfigVariableInt egg_test_vref_integrity -("egg-test-vref-integrity", 20, - PRC_DESC("The maximum number of vertices a primitive may have before " - "its vertices will no longer be checked for internal integrity. " - "This is meaningful in non-production builds only.")); - -ConfigVariableInt egg_recursion_limit -("egg-recursion-limit", 1000, - PRC_DESC("The maximum number of levels that recursive algorithms within " - "the egg library are allowed to traverse. This is a simple hack " - "to prevent deeply-recursive algorithms from triggering a stack " - "overflow. Set it larger to run more efficiently if your stack " - "allows it; set it lower if you experience stack overflows.")); - -ConfigVariableInt egg_precision -("egg-precision", 15, - PRC_DESC("The number of digits of precision to write out for values in " - "an egg file. Leave this at 0 to use the default setting for the " - "stream.")); - -//////////////////////////////////////////////////////////////////// -// Function: init_libegg -// Description: 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 -// called by the static initializers and need not be -// called explicitly, but special cases exist. -//////////////////////////////////////////////////////////////////// -void -init_libegg() { - static bool initialized = false; - if (initialized) { - return; - } - initialized = true; - - EggRenderMode::init_type(); - EggAnimData::init_type(); - EggAnimPreload::init_type(); - EggAttributes::init_type(); - EggBin::init_type(); - EggBinMaker::init_type(); - EggComment::init_type(); - EggCompositePrimitive::init_type(); - EggCoordinateSystem::init_type(); - EggCurve::init_type(); - EggData::init_type(); - EggExternalReference::init_type(); - EggFilenameNode::init_type(); - EggGroup::init_type(); - EggGroupNode::init_type(); - EggGroupUniquifier::init_type(); - EggLine::init_type(); - EggMaterial::init_type(); - EggNameUniquifier::init_type(); - EggNamedObject::init_type(); - EggNode::init_type(); - EggNurbsCurve::init_type(); - EggNurbsSurface::init_type(); - EggObject::init_type(); - EggPatch::init_type(); - EggPoint::init_type(); - EggPolygon::init_type(); - EggPolysetMaker::init_type(); - EggPoolUniquifier::init_type(); - EggPrimitive::init_type(); - EggSAnimData::init_type(); - EggSurface::init_type(); - EggSwitchCondition::init_type(); - EggSwitchConditionDistance::init_type(); - EggTable::init_type(); - EggTexture::init_type(); - EggTriangleFan::init_type(); - EggTriangleStrip::init_type(); - EggUserData::init_type(); - EggVertex::init_type(); - EggVertexPool::init_type(); - EggVertexUV::init_type(); - EggVertexAux::init_type(); - EggXfmAnimData::init_type(); - EggXfmSAnim::init_type(); -} +// Filename: config_egg.cxx +// Created by: drose (19Mar00) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + +#include "config_egg.h" +#include "eggRenderMode.h" +#include "eggAnimData.h" +#include "eggAnimPreload.h" +#include "eggAttributes.h" +#include "eggBin.h" +#include "eggBinMaker.h" +#include "eggComment.h" +#include "eggCompositePrimitive.h" +#include "eggCoordinateSystem.h" +#include "eggCurve.h" +#include "eggExternalReference.h" +#include "eggFilenameNode.h" +#include "eggGroup.h" +#include "eggGroupNode.h" +#include "eggGroupUniquifier.h" +#include "eggLine.h" +#include "eggMaterial.h" +#include "eggNameUniquifier.h" +#include "eggNamedObject.h" +#include "eggNode.h" +#include "eggNurbsCurve.h" +#include "eggNurbsSurface.h" +#include "eggObject.h" +#include "eggPatch.h" +#include "eggPoint.h" +#include "eggPolygon.h" +#include "eggPolysetMaker.h" +#include "eggPoolUniquifier.h" +#include "eggPrimitive.h" +#include "eggSAnimData.h" +#include "eggSurface.h" +#include "eggSwitchCondition.h" +#include "eggTable.h" +#include "eggTexture.h" +#include "eggTriangleFan.h" +#include "eggTriangleStrip.h" +#include "eggUserData.h" +#include "eggVertex.h" +#include "eggVertexPool.h" +#include "eggVertexUV.h" +#include "eggVertexAux.h" +#include "eggXfmAnimData.h" +#include "eggXfmSAnim.h" + +#include "dconfig.h" + +Configure(config_egg); +NotifyCategoryDef(egg, ""); + +ConfigureFn(config_egg) { + init_libegg(); +} + +ConfigVariableBool egg_support_old_anims +("egg-support-old-anims", true, + PRC_DESC("Set this true to support loading of old character animation files, which " + "had the convention that the order \"phr\" implied a reversed roll.")); + +ConfigVariableBool egg_mesh +("egg-mesh", true, + PRC_DESC("Set this true to convert triangles and higher-order polygons " + "into triangle strips and triangle fans when an egg file is " + "loaded or converted to bam. Set this false just to triangulate " + "everything into independent triangles.")); + +ConfigVariableBool egg_retesselate_coplanar +("egg-retesselate-coplanar", false, + PRC_DESC("If this is true, the egg loader may reverse the " + "tesselation direction of a single pair of planar triangles that " + "share the same properties, if that will help get a better " + "triangle strip. In some rare cases, doing so can distort the " + "UV's on a face; turning this off should eliminate that artifact " + "(at the cost of less-effective triangle stripping).")); + +ConfigVariableBool egg_unroll_fans +("egg-unroll-fans", true, + PRC_DESC("Set this true to allow the egg loader to convert weak triangle " + "fans--triangles that share the same vertex but aren't " + "connected enough to justify making a triangle fan primitive " + "from them--into a series of zig-zag triangles that can make " + "a triangle strip that might connect better with its neighbors.")); + +ConfigVariableBool egg_show_tstrips +("egg-show-tstrips", false, + PRC_DESC("Set this true to color each triangle strip a random color, with " + "the leading triangle a little bit darker, so you can visually " + "observe the quality of the triangle stripping algorithm.")); + +ConfigVariableBool egg_show_qsheets +("egg-show-qsheets", false, + PRC_DESC("Set this true to color each quadsheet a random color, so you " + "can visually observe the quadsheet algorithm.")); + +ConfigVariableBool egg_show_quads +("egg-show-quads", false, + PRC_DESC("Set this true to color each detected quad a random color, so " + "you can visually observe the algorithm that unifies pairs of " + "triangles into quads (prior to generating triangle strips).")); + +ConfigVariableBool egg_subdivide_polys +("egg-subdivide-polys", true, + PRC_DESC("This is obsolete. In the old Geom implementation, it used to " + "be true to force higher-order polygons that were not otherwise " + "meshed to be subdivided into triangles. In the new " + "Geom implementation, this happens anyway.")); + +ConfigVariableBool egg_consider_fans +("egg-consider-fans", false, + PRC_DESC("Set this true to enable the egg mesher to consider making " + "triangle fans out of triangles that are connected at a common " + "vertex. This may help if your scene involves lots of such " + "connected triangles, but it can also make the overall stripping " + "less effective (by interfering with triangle strips).")); + +ConfigVariableDouble egg_max_tfan_angle +("egg-max-tfan-angle", 40.0, + PRC_DESC("The maximum average angle per triangle to allow in a triangle " + "fan. If triangles are larger than this--that is, more loosely " + "packed--then we figure a triangle strip is likely to do a " + "more effective job than a triangle fan, and the fan maker leaves " + "it alone.")); + +ConfigVariableInt egg_min_tfan_tris +("egg-min-tfan-tris", 4, + PRC_DESC("The minimum number of triangles that must be involved in order " + "to generate a triangle fan. Fewer than this is just interrupting " + "a triangle strip.")); + +ConfigVariableDouble egg_coplanar_threshold +("egg-coplanar-threshold", 0.01, + PRC_DESC("The numerical threshold below which polygons are considered " + "to be coplanar. Determined empirically.")); + +ConfigVariableInt egg_test_vref_integrity +("egg-test-vref-integrity", 20, + PRC_DESC("The maximum number of vertices a primitive may have before " + "its vertices will no longer be checked for internal integrity. " + "This is meaningful in non-production builds only.")); + +ConfigVariableInt egg_recursion_limit +("egg-recursion-limit", 1000, + PRC_DESC("The maximum number of levels that recursive algorithms within " + "the egg library are allowed to traverse. This is a simple hack " + "to prevent deeply-recursive algorithms from triggering a stack " + "overflow. Set it larger to run more efficiently if your stack " + "allows it; set it lower if you experience stack overflows.")); + +ConfigVariableInt egg_precision +("egg-precision", 15, + PRC_DESC("The number of digits of precision to write out for values in " + "an egg file. Leave this at 0 to use the default setting for the " + "stream.")); + +//////////////////////////////////////////////////////////////////// +// Function: init_libegg +// Description: 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 +// called by the static initializers and need not be +// called explicitly, but special cases exist. +//////////////////////////////////////////////////////////////////// +void +init_libegg() { + static bool initialized = false; + if (initialized) { + return; + } + initialized = true; + + EggRenderMode::init_type(); + EggAnimData::init_type(); + EggAnimPreload::init_type(); + EggAttributes::init_type(); + EggBin::init_type(); + EggBinMaker::init_type(); + EggComment::init_type(); + EggCompositePrimitive::init_type(); + EggCoordinateSystem::init_type(); + EggCurve::init_type(); + EggData::init_type(); + EggExternalReference::init_type(); + EggFilenameNode::init_type(); + EggGroup::init_type(); + EggGroupNode::init_type(); + EggGroupUniquifier::init_type(); + EggLine::init_type(); + EggMaterial::init_type(); + EggNameUniquifier::init_type(); + EggNamedObject::init_type(); + EggNode::init_type(); + EggNurbsCurve::init_type(); + EggNurbsSurface::init_type(); + EggObject::init_type(); + EggPatch::init_type(); + EggPoint::init_type(); + EggPolygon::init_type(); + EggPolysetMaker::init_type(); + EggPoolUniquifier::init_type(); + EggPrimitive::init_type(); + EggSAnimData::init_type(); + EggSurface::init_type(); + EggSwitchCondition::init_type(); + EggSwitchConditionDistance::init_type(); + EggTable::init_type(); + EggTexture::init_type(); + EggTriangleFan::init_type(); + EggTriangleStrip::init_type(); + EggUserData::init_type(); + EggVertex::init_type(); + EggVertexPool::init_type(); + EggVertexUV::init_type(); + EggVertexAux::init_type(); + EggXfmAnimData::init_type(); + EggXfmSAnim::init_type(); +} diff --git a/panda/src/egg/config_egg.h b/panda/src/egg/config_egg.h index dbd47ab3b8..20119cd07c 100644 --- a/panda/src/egg/config_egg.h +++ b/panda/src/egg/config_egg.h @@ -1,48 +1,48 @@ -// Filename: config_egg.h -// Created by: drose (19Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef CONFIG_EGG_H -#define CONFIG_EGG_H - -#include "pandabase.h" -#include "notifyCategoryProxy.h" -#include "configVariableSearchPath.h" -#include "configVariableBool.h" -#include "configVariableEnum.h" -#include "configVariableDouble.h" -#include "configVariableInt.h" - -NotifyCategoryDecl(egg, EXPCL_PANDAEGG, EXPTP_PANDAEGG); - -extern ConfigVariableBool egg_support_old_anims; - -extern EXPCL_PANDAEGG ConfigVariableBool egg_mesh; -extern EXPCL_PANDAEGG ConfigVariableBool egg_retesselate_coplanar; -extern EXPCL_PANDAEGG ConfigVariableBool egg_unroll_fans; -extern EXPCL_PANDAEGG ConfigVariableBool egg_show_tstrips; -extern EXPCL_PANDAEGG ConfigVariableBool egg_show_qsheets; -extern EXPCL_PANDAEGG ConfigVariableBool egg_show_quads; -#define egg_false_color (egg_show_tstrips | egg_show_qsheets | egg_show_quads) -extern EXPCL_PANDAEGG ConfigVariableBool egg_subdivide_polys; -extern EXPCL_PANDAEGG ConfigVariableBool egg_consider_fans; -extern EXPCL_PANDAEGG ConfigVariableDouble egg_max_tfan_angle; -extern EXPCL_PANDAEGG ConfigVariableInt egg_min_tfan_tris; -extern EXPCL_PANDAEGG ConfigVariableDouble egg_coplanar_threshold; -extern EXPCL_PANDAEGG ConfigVariableInt egg_test_vref_integrity; -extern EXPCL_PANDAEGG ConfigVariableInt egg_recursion_limit; -extern EXPCL_PANDAEGG ConfigVariableInt egg_precision; - -extern EXPCL_PANDAEGG void init_libegg(); - -#endif +// Filename: config_egg.h +// Created by: drose (19Mar00) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + +#ifndef CONFIG_EGG_H +#define CONFIG_EGG_H + +#include "pandabase.h" +#include "notifyCategoryProxy.h" +#include "configVariableSearchPath.h" +#include "configVariableBool.h" +#include "configVariableEnum.h" +#include "configVariableDouble.h" +#include "configVariableInt.h" + +NotifyCategoryDecl(egg, EXPCL_PANDAEGG, EXPTP_PANDAEGG); + +extern ConfigVariableBool egg_support_old_anims; + +extern EXPCL_PANDAEGG ConfigVariableBool egg_mesh; +extern EXPCL_PANDAEGG ConfigVariableBool egg_retesselate_coplanar; +extern EXPCL_PANDAEGG ConfigVariableBool egg_unroll_fans; +extern EXPCL_PANDAEGG ConfigVariableBool egg_show_tstrips; +extern EXPCL_PANDAEGG ConfigVariableBool egg_show_qsheets; +extern EXPCL_PANDAEGG ConfigVariableBool egg_show_quads; +#define egg_false_color (egg_show_tstrips | egg_show_qsheets | egg_show_quads) +extern EXPCL_PANDAEGG ConfigVariableBool egg_subdivide_polys; +extern EXPCL_PANDAEGG ConfigVariableBool egg_consider_fans; +extern EXPCL_PANDAEGG ConfigVariableDouble egg_max_tfan_angle; +extern EXPCL_PANDAEGG ConfigVariableInt egg_min_tfan_tris; +extern EXPCL_PANDAEGG ConfigVariableDouble egg_coplanar_threshold; +extern EXPCL_PANDAEGG ConfigVariableInt egg_test_vref_integrity; +extern EXPCL_PANDAEGG ConfigVariableInt egg_recursion_limit; +extern EXPCL_PANDAEGG ConfigVariableInt egg_precision; + +extern EXPCL_PANDAEGG void init_libegg(); + +#endif diff --git a/panda/src/egg/eggData.cxx b/panda/src/egg/eggData.cxx index 71e6fd1424..da891bfb9e 100644 --- a/panda/src/egg/eggData.cxx +++ b/panda/src/egg/eggData.cxx @@ -1,414 +1,414 @@ -// Filename: eggData.cxx -// Created by: drose (20Jan99) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "eggData.h" -#include "eggCoordinateSystem.h" -#include "eggTextureCollection.h" -#include "eggMaterialCollection.h" -#include "eggComment.h" -#include "eggPoolUniquifier.h" -#include "config_egg.h" -#include "config_util.h" -#include "config_express.h" -#include "string_utils.h" -#include "dSearchPath.h" -#include "virtualFileSystem.h" -#include "lightMutexHolder.h" -#include "zStream.h" - -extern int eggyyparse(); -#include "parserDefs.h" -#include "lexerDefs.h" - -TypeHandle EggData::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: EggData::resolve_egg_filename -// Access: Public, Static -// Description: Looks for the indicated filename, first along the -// indicated searchpath, and then along the model_path. -// If found, updates the filename to the full path and -// returns true; otherwise, returns false. -//////////////////////////////////////////////////////////////////// -bool EggData:: -resolve_egg_filename(Filename &egg_filename, const DSearchPath &searchpath) { - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - - if (egg_filename.is_fully_qualified() && vfs->exists(egg_filename)) { - return true; - } - - vfs->resolve_filename(egg_filename, searchpath, "egg") || - vfs->resolve_filename(egg_filename, get_model_path(), "egg"); - - return vfs->exists(egg_filename); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::read -// Access: Public -// Description: Opens the indicated filename and reads the egg data -// contents from it. Returns true if the file was -// successfully opened and read, false if there were -// some errors, in which case the data may be partially -// read. -// -// error is the output stream to which to write error -// messages. -//////////////////////////////////////////////////////////////////// -bool EggData:: -read(Filename filename, string display_name) { - filename.set_text(); - set_egg_filename(filename); - - if (display_name.empty()) { - display_name = filename; - } - - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - - PT(VirtualFile) vfile = vfs->get_file(filename); - if (vfile == NULL) { - egg_cat.error() << "Could not find " << display_name << "\n"; - return false; - } - set_egg_timestamp(vfile->get_timestamp()); - - istream *file = vfile->open_read_file(true); - if (file == (istream *)NULL) { - egg_cat.error() << "Unable to open " << display_name << "\n"; - return false; - } - - egg_cat.info() - << "Reading " << display_name << "\n"; - - bool read_ok = read(*file); - vfile->close_read_file(file); - return read_ok; -} - - -//////////////////////////////////////////////////////////////////// -// Function: EggData::read -// Access: Public -// Description: Parses the egg syntax contained in the indicated -// input stream. Returns true if the stream was a -// completely valid egg file, false if there were some -// errors, in which case the data may be partially read. -// -// Before you call this routine, you should probably -// call set_egg_filename() to set the name of the egg -// file we're processing, if at all possible. If there -// is no such filename, you may set it to the empty -// string. -//////////////////////////////////////////////////////////////////// -bool EggData:: -read(istream &in) { - // First, dispense with any children we had previously. We will - // replace them with the new data. - clear(); - - // Create a temporary EggData structure to read into. We initialize - // it with a copy of ourselves, so that it will get our _coordsys - // value, if the user set it. - PT(EggData) data = new EggData(*this); - - int error_count; - { - LightMutexHolder holder(egg_lock); - egg_init_parser(in, get_egg_filename(), data, data); - eggyyparse(); - egg_cleanup_parser(); - error_count = egg_error_count(); - } - - data->post_read(); - - steal_children(*data); - (*this) = *data; - - return (error_count == 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::merge -// Access: Public -// Description: Appends the other egg structure to the end of this -// one. The other egg structure is invalidated. -//////////////////////////////////////////////////////////////////// -void EggData:: -merge(EggData &other) { - if (get_coordinate_system() == CS_default) { - // If we haven't specified a coordinate system yet, we inherit the - // other one's. - set_coordinate_system(other.get_coordinate_system()); - - } else { - // Otherwise, the other one is forced into our coordinate system - // before we merge. - other.set_coordinate_system(get_coordinate_system()); - } - steal_children(other); -} - - -//////////////////////////////////////////////////////////////////// -// Function: EggData::load_externals -// Access: Public -// Description: Loads up all the egg files referenced by -// entries within the egg structure, and inserts their -// contents in place of the entries. Searches -// for files in the searchpath, if not found directly, -// and writes error messages to the indicated output -// stream. Returns true if all externals were loaded -// successfully, false otherwise. -//////////////////////////////////////////////////////////////////// -bool EggData:: -load_externals(const DSearchPath &searchpath) { - return - r_load_externals(searchpath, get_coordinate_system(), NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::load_externals -// Access: Public -// Description: Loads up all the egg files referenced by -// entries within the egg structure, and inserts their -// contents in place of the entries. Searches -// for files in the searchpath, if not found directly, -// and writes error messages to the indicated output -// stream. Returns true if all externals were loaded -// successfully, false otherwise. -//////////////////////////////////////////////////////////////////// -bool EggData:: -load_externals(const DSearchPath &searchpath, BamCacheRecord *record) { - return - r_load_externals(searchpath, get_coordinate_system(), record); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::collapse_equivalent_textures -// Access: Public -// Description: Removes duplicate references to the same texture -// image with the same properties. Considers two -// texture references with identical properties, but -// different tref names, to be equivalent, and collapses -// them, choosing one tref name to keep arbitrarily. -// Returns the number of textures removed. -//////////////////////////////////////////////////////////////////// -int EggData:: -collapse_equivalent_textures() { - EggTextureCollection textures; - textures.find_used_textures(this); - return - textures.collapse_equivalent_textures(~EggTexture::E_tref_name, this); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::collapse_equivalent_materials -// Access: Public -// Description: Removes duplicate references to the same material -// with the same properties. Considers two material -// references with identical properties, but different -// mref names, to be equivalent, and collapses them, -// choosing one mref name to keep arbitrarily. Returns -// the number of materials removed. -//////////////////////////////////////////////////////////////////// -int EggData:: -collapse_equivalent_materials() { - EggMaterialCollection materials; - materials.find_used_materials(this); - return - materials.collapse_equivalent_materials(~EggMaterial::E_mref_name, this); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::write_egg -// Access: Public -// Description: The main interface for writing complete egg files. -//////////////////////////////////////////////////////////////////// -bool EggData:: -write_egg(Filename filename) { - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - filename.set_text(); - vfs->delete_file(filename); - ostream *file = vfs->open_write_file(filename, true, true); - if (file == (ostream *)NULL) { - egg_cat.error() << "Unable to open " << filename << " for writing.\n"; - return false; - } - - bool wrote_ok = write_egg(*file); - vfs->close_write_file(file); - return wrote_ok; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::write_egg -// Access: Public -// Description: The main interface for writing complete egg files. -//////////////////////////////////////////////////////////////////// -bool EggData:: -write_egg(ostream &out) { - pre_write(); - - if (egg_precision > 0) { - // Change the egg precision as requested. - streamsize orig_precision = out.precision(); - out.precision((streamsize)egg_precision); - write(out, 0); - out.precision(orig_precision); - } else { - // Use the stream default precision. - write(out, 0); - } - return true; -} - - -//////////////////////////////////////////////////////////////////// -// Function: EggData::set_coordinate_system -// Access: Public -// Description: Changes the coordinate system of the EggData. If the -// coordinate system was previously different, this may -// result in a conversion of the data. -//////////////////////////////////////////////////////////////////// -void EggData:: -set_coordinate_system(CoordinateSystem new_coordsys) { - if (new_coordsys == CS_default) { - new_coordsys = get_default_coordinate_system(); - } - if (new_coordsys != _coordsys && - (_coordsys != CS_default && _coordsys != CS_invalid)) { - // Time to convert the data. - LMatrix4d mat = LMatrix4d::convert_mat(_coordsys, new_coordsys); - LMatrix4d inv = LMatrix4d::convert_mat(new_coordsys, _coordsys); - - r_transform(mat, inv, new_coordsys); - r_transform_vertices(mat); - - // Now we have to update the under_flags to ensure that all the - // cached relative matrices are correct. - update_under(0); - } - - _coordsys = new_coordsys; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::write -// Access: Protected, Virtual -// Description: Writes the egg data out to the indicated output -// stream. -//////////////////////////////////////////////////////////////////// -void EggData:: -write(ostream &out, int indent_level) const { - PT(EggCoordinateSystem) ecs = new EggCoordinateSystem(_coordsys); - ecs->write(out, indent_level); - EggGroupNode::write(out, indent_level); - out << flush; -} - - -//////////////////////////////////////////////////////////////////// -// Function: EggData::post_read -// Access: Private -// Description: Does whatever processing is appropriate after reading -// the data in from an egg file. -//////////////////////////////////////////////////////////////////// -void EggData:: -post_read() { - CoordinateSystem old_coordsys = _coordsys; - _coordsys = find_coordsys_entry(); - - if (_coordsys == CS_default) { - // If the egg file didn't contain a entry, - // assume it's Y-up, by convention. - _coordsys = CS_yup_right; - - } else if (_coordsys == CS_invalid) { - egg_cat.warning() - << "Contradictory entries encountered.\n"; - _coordsys = CS_yup_right; - } - - r_mark_coordsys(_coordsys); - - if (old_coordsys != CS_default) { - // Now if we had a previous definition, enforce it. This might - // convert the data to the given coordinate system. - set_coordinate_system(old_coordsys); - } - - // Fill this in before we automatically resolve pathnames. - _had_absolute_pathnames = has_absolute_pathnames(); - - if (get_auto_resolve_externals()) { - // Resolve filenames that are relative to the egg file. - DSearchPath dir; - dir.append_directory(get_egg_filename().get_dirname()); - resolve_filenames(dir); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: EggData::pre_write -// Access: Private -// Description: Does whatever processing is appropriate just before -// writing the data out to an egg file. This includes -// verifying that vertex pool names are unique, etc. -//////////////////////////////////////////////////////////////////// -void EggData:: -pre_write() { - // Pull out all of the texture definitions in the file and massage - // them a bit. - EggTextureCollection textures; - textures.extract_textures(this); - - // Remove any textures that aren't being used. - textures.remove_unused_textures(this); - - // Collapse out any textures that are completely equivalent. For - // this purpose, we consider two textures with identical properties - // but different tref names to be different. - textures.collapse_equivalent_textures(~0, this); - - // Make sure all of the textures have unique TRef names. - textures.uniquify_trefs(); - textures.sort_by_tref(); - - // Do the same thing with the materials. - EggMaterialCollection materials; - materials.extract_materials(this); - materials.remove_unused_materials(this); - materials.collapse_equivalent_materials(~0, this); - materials.uniquify_mrefs(); - materials.sort_by_mref(); - - // Now put them all back at the head of the file, after any initial - // comment records. - iterator ci = begin(); - while (ci != end() && (*ci)->is_of_type(EggComment::get_class_type())) { - ++ci; - } - textures.insert_textures(this, ci); - materials.insert_materials(this, ci); - - // Also make sure that the vertex pools are uniquely named. This - // also checks textures and materials, which is kind of redundant - // since we just did that, but we don't mind. - EggPoolUniquifier pu; - pu.uniquify(this); -} +// Filename: eggData.cxx +// Created by: drose (20Jan99) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + +#include "eggData.h" +#include "eggCoordinateSystem.h" +#include "eggTextureCollection.h" +#include "eggMaterialCollection.h" +#include "eggComment.h" +#include "eggPoolUniquifier.h" +#include "config_egg.h" +#include "config_util.h" +#include "config_express.h" +#include "string_utils.h" +#include "dSearchPath.h" +#include "virtualFileSystem.h" +#include "lightMutexHolder.h" +#include "zStream.h" + +extern int eggyyparse(); +#include "parserDefs.h" +#include "lexerDefs.h" + +TypeHandle EggData::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: EggData::resolve_egg_filename +// Access: Public, Static +// Description: Looks for the indicated filename, first along the +// indicated searchpath, and then along the model_path. +// If found, updates the filename to the full path and +// returns true; otherwise, returns false. +//////////////////////////////////////////////////////////////////// +bool EggData:: +resolve_egg_filename(Filename &egg_filename, const DSearchPath &searchpath) { + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + + if (egg_filename.is_fully_qualified() && vfs->exists(egg_filename)) { + return true; + } + + vfs->resolve_filename(egg_filename, searchpath, "egg") || + vfs->resolve_filename(egg_filename, get_model_path(), "egg"); + + return vfs->exists(egg_filename); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::read +// Access: Public +// Description: Opens the indicated filename and reads the egg data +// contents from it. Returns true if the file was +// successfully opened and read, false if there were +// some errors, in which case the data may be partially +// read. +// +// error is the output stream to which to write error +// messages. +//////////////////////////////////////////////////////////////////// +bool EggData:: +read(Filename filename, string display_name) { + filename.set_text(); + set_egg_filename(filename); + + if (display_name.empty()) { + display_name = filename; + } + + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + + PT(VirtualFile) vfile = vfs->get_file(filename); + if (vfile == NULL) { + egg_cat.error() << "Could not find " << display_name << "\n"; + return false; + } + set_egg_timestamp(vfile->get_timestamp()); + + istream *file = vfile->open_read_file(true); + if (file == (istream *)NULL) { + egg_cat.error() << "Unable to open " << display_name << "\n"; + return false; + } + + egg_cat.info() + << "Reading " << display_name << "\n"; + + bool read_ok = read(*file); + vfile->close_read_file(file); + return read_ok; +} + + +//////////////////////////////////////////////////////////////////// +// Function: EggData::read +// Access: Public +// Description: Parses the egg syntax contained in the indicated +// input stream. Returns true if the stream was a +// completely valid egg file, false if there were some +// errors, in which case the data may be partially read. +// +// Before you call this routine, you should probably +// call set_egg_filename() to set the name of the egg +// file we're processing, if at all possible. If there +// is no such filename, you may set it to the empty +// string. +//////////////////////////////////////////////////////////////////// +bool EggData:: +read(istream &in) { + // First, dispense with any children we had previously. We will + // replace them with the new data. + clear(); + + // Create a temporary EggData structure to read into. We initialize + // it with a copy of ourselves, so that it will get our _coordsys + // value, if the user set it. + PT(EggData) data = new EggData(*this); + + int error_count; + { + LightMutexHolder holder(egg_lock); + egg_init_parser(in, get_egg_filename(), data, data); + eggyyparse(); + egg_cleanup_parser(); + error_count = egg_error_count(); + } + + data->post_read(); + + steal_children(*data); + (*this) = *data; + + return (error_count == 0); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::merge +// Access: Public +// Description: Appends the other egg structure to the end of this +// one. The other egg structure is invalidated. +//////////////////////////////////////////////////////////////////// +void EggData:: +merge(EggData &other) { + if (get_coordinate_system() == CS_default) { + // If we haven't specified a coordinate system yet, we inherit the + // other one's. + set_coordinate_system(other.get_coordinate_system()); + + } else { + // Otherwise, the other one is forced into our coordinate system + // before we merge. + other.set_coordinate_system(get_coordinate_system()); + } + steal_children(other); +} + + +//////////////////////////////////////////////////////////////////// +// Function: EggData::load_externals +// Access: Public +// Description: Loads up all the egg files referenced by +// entries within the egg structure, and inserts their +// contents in place of the entries. Searches +// for files in the searchpath, if not found directly, +// and writes error messages to the indicated output +// stream. Returns true if all externals were loaded +// successfully, false otherwise. +//////////////////////////////////////////////////////////////////// +bool EggData:: +load_externals(const DSearchPath &searchpath) { + return + r_load_externals(searchpath, get_coordinate_system(), NULL); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::load_externals +// Access: Public +// Description: Loads up all the egg files referenced by +// entries within the egg structure, and inserts their +// contents in place of the entries. Searches +// for files in the searchpath, if not found directly, +// and writes error messages to the indicated output +// stream. Returns true if all externals were loaded +// successfully, false otherwise. +//////////////////////////////////////////////////////////////////// +bool EggData:: +load_externals(const DSearchPath &searchpath, BamCacheRecord *record) { + return + r_load_externals(searchpath, get_coordinate_system(), record); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::collapse_equivalent_textures +// Access: Public +// Description: Removes duplicate references to the same texture +// image with the same properties. Considers two +// texture references with identical properties, but +// different tref names, to be equivalent, and collapses +// them, choosing one tref name to keep arbitrarily. +// Returns the number of textures removed. +//////////////////////////////////////////////////////////////////// +int EggData:: +collapse_equivalent_textures() { + EggTextureCollection textures; + textures.find_used_textures(this); + return + textures.collapse_equivalent_textures(~EggTexture::E_tref_name, this); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::collapse_equivalent_materials +// Access: Public +// Description: Removes duplicate references to the same material +// with the same properties. Considers two material +// references with identical properties, but different +// mref names, to be equivalent, and collapses them, +// choosing one mref name to keep arbitrarily. Returns +// the number of materials removed. +//////////////////////////////////////////////////////////////////// +int EggData:: +collapse_equivalent_materials() { + EggMaterialCollection materials; + materials.find_used_materials(this); + return + materials.collapse_equivalent_materials(~EggMaterial::E_mref_name, this); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::write_egg +// Access: Public +// Description: The main interface for writing complete egg files. +//////////////////////////////////////////////////////////////////// +bool EggData:: +write_egg(Filename filename) { + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + filename.set_text(); + vfs->delete_file(filename); + ostream *file = vfs->open_write_file(filename, true, true); + if (file == (ostream *)NULL) { + egg_cat.error() << "Unable to open " << filename << " for writing.\n"; + return false; + } + + bool wrote_ok = write_egg(*file); + vfs->close_write_file(file); + return wrote_ok; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::write_egg +// Access: Public +// Description: The main interface for writing complete egg files. +//////////////////////////////////////////////////////////////////// +bool EggData:: +write_egg(ostream &out) { + pre_write(); + + if (egg_precision > 0) { + // Change the egg precision as requested. + streamsize orig_precision = out.precision(); + out.precision((streamsize)egg_precision); + write(out, 0); + out.precision(orig_precision); + } else { + // Use the stream default precision. + write(out, 0); + } + return true; +} + + +//////////////////////////////////////////////////////////////////// +// Function: EggData::set_coordinate_system +// Access: Public +// Description: Changes the coordinate system of the EggData. If the +// coordinate system was previously different, this may +// result in a conversion of the data. +//////////////////////////////////////////////////////////////////// +void EggData:: +set_coordinate_system(CoordinateSystem new_coordsys) { + if (new_coordsys == CS_default) { + new_coordsys = get_default_coordinate_system(); + } + if (new_coordsys != _coordsys && + (_coordsys != CS_default && _coordsys != CS_invalid)) { + // Time to convert the data. + LMatrix4d mat = LMatrix4d::convert_mat(_coordsys, new_coordsys); + LMatrix4d inv = LMatrix4d::convert_mat(new_coordsys, _coordsys); + + r_transform(mat, inv, new_coordsys); + r_transform_vertices(mat); + + // Now we have to update the under_flags to ensure that all the + // cached relative matrices are correct. + update_under(0); + } + + _coordsys = new_coordsys; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::write +// Access: Protected, Virtual +// Description: Writes the egg data out to the indicated output +// stream. +//////////////////////////////////////////////////////////////////// +void EggData:: +write(ostream &out, int indent_level) const { + PT(EggCoordinateSystem) ecs = new EggCoordinateSystem(_coordsys); + ecs->write(out, indent_level); + EggGroupNode::write(out, indent_level); + out << flush; +} + + +//////////////////////////////////////////////////////////////////// +// Function: EggData::post_read +// Access: Private +// Description: Does whatever processing is appropriate after reading +// the data in from an egg file. +//////////////////////////////////////////////////////////////////// +void EggData:: +post_read() { + CoordinateSystem old_coordsys = _coordsys; + _coordsys = find_coordsys_entry(); + + if (_coordsys == CS_default) { + // If the egg file didn't contain a entry, + // assume it's Y-up, by convention. + _coordsys = CS_yup_right; + + } else if (_coordsys == CS_invalid) { + egg_cat.warning() + << "Contradictory entries encountered.\n"; + _coordsys = CS_yup_right; + } + + r_mark_coordsys(_coordsys); + + if (old_coordsys != CS_default) { + // Now if we had a previous definition, enforce it. This might + // convert the data to the given coordinate system. + set_coordinate_system(old_coordsys); + } + + // Fill this in before we automatically resolve pathnames. + _had_absolute_pathnames = has_absolute_pathnames(); + + if (get_auto_resolve_externals()) { + // Resolve filenames that are relative to the egg file. + DSearchPath dir; + dir.append_directory(get_egg_filename().get_dirname()); + resolve_filenames(dir); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: EggData::pre_write +// Access: Private +// Description: Does whatever processing is appropriate just before +// writing the data out to an egg file. This includes +// verifying that vertex pool names are unique, etc. +//////////////////////////////////////////////////////////////////// +void EggData:: +pre_write() { + // Pull out all of the texture definitions in the file and massage + // them a bit. + EggTextureCollection textures; + textures.extract_textures(this); + + // Remove any textures that aren't being used. + textures.remove_unused_textures(this); + + // Collapse out any textures that are completely equivalent. For + // this purpose, we consider two textures with identical properties + // but different tref names to be different. + textures.collapse_equivalent_textures(~0, this); + + // Make sure all of the textures have unique TRef names. + textures.uniquify_trefs(); + textures.sort_by_tref(); + + // Do the same thing with the materials. + EggMaterialCollection materials; + materials.extract_materials(this); + materials.remove_unused_materials(this); + materials.collapse_equivalent_materials(~0, this); + materials.uniquify_mrefs(); + materials.sort_by_mref(); + + // Now put them all back at the head of the file, after any initial + // comment records. + iterator ci = begin(); + while (ci != end() && (*ci)->is_of_type(EggComment::get_class_type())) { + ++ci; + } + textures.insert_textures(this, ci); + materials.insert_materials(this, ci); + + // Also make sure that the vertex pools are uniquely named. This + // also checks textures and materials, which is kind of redundant + // since we just did that, but we don't mind. + EggPoolUniquifier pu; + pu.uniquify(this); +} diff --git a/panda/src/egg2pg/Sources.pp b/panda/src/egg2pg/Sources.pp deleted file mode 100644 index 9ec47767e4..0000000000 --- a/panda/src/egg2pg/Sources.pp +++ /dev/null @@ -1,54 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_EGG] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define USE_PACKAGES nurbspp - -#begin lib_target - #define TARGET p3egg2pg - #define LOCAL_LIBS \ - p3parametrics p3collide p3egg p3pgraph p3chan p3char - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - animBundleMaker.h \ - characterMaker.h \ - config_egg2pg.h \ - deferredNodeProperty.h \ - eggBinner.h \ - eggLoader.h eggLoader.I \ - eggRenderState.h eggRenderState.I \ - eggSaver.h eggSaver.I \ - egg_parametrics.h \ - load_egg_file.h \ - save_egg_file.h \ - loaderFileTypeEgg.h - - #define INCLUDED_SOURCES \ - animBundleMaker.cxx \ - characterMaker.cxx \ - config_egg2pg.cxx \ - deferredNodeProperty.cxx \ - eggBinner.cxx \ - eggLoader.cxx \ - eggRenderState.cxx \ - eggSaver.cxx \ - egg_parametrics.cxx \ - load_egg_file.cxx \ - save_egg_file.cxx \ - loaderFileTypeEgg.cxx - - #if $[DONT_COMBINE_PGRAPH] - #define SOURCES $[SOURCES] $[INCLUDED_SOURCES] - #define INCLUDED_SOURCES - #define COMBINED_SOURCES - #endif - - #define INSTALL_HEADERS \ - egg_parametrics.h load_egg_file.h save_egg_file.h config_egg2pg.h - - #define IGATESCAN load_egg_file.h save_egg_file.h - -#end lib_target diff --git a/panda/src/egldisplay/Sources.pp b/panda/src/egldisplay/Sources.pp deleted file mode 100644 index 66f15d5f28..0000000000 --- a/panda/src/egldisplay/Sources.pp +++ /dev/null @@ -1,50 +0,0 @@ -#define BUILD_DIRECTORY $[and $[HAVE_EGL],$[HAVE_X11]] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#begin lib_target - #define TARGET p3egldisplay - #define BUILD_TARGET $[HAVE_GLES] - #define USE_PACKAGES gles egl x11 - #define EXTRA_CDEFS OPENGLES_1 - #define LOCAL_LIBS \ - p3glesgsg p3x11display - - #define SOURCES \ - config_egldisplay.cxx config_egldisplay.h \ - eglGraphicsBuffer.h eglGraphicsBuffer.cxx \ - eglGraphicsPipe.I eglGraphicsPipe.cxx eglGraphicsPipe.h \ - eglGraphicsPixmap.h eglGraphicsPixmap.cxx \ - eglGraphicsWindow.h eglGraphicsWindow.cxx \ - eglGraphicsStateGuardian.h eglGraphicsStateGuardian.cxx - - #define INSTALL_HEADERS \ - eglGraphicsBuffer.h eglGraphicsPixmap.h \ - eglGraphicsPipe.I eglGraphicsPipe.h \ - eglGraphicsWindow.I eglGraphicsWindow.h - -#end lib_target - -#begin lib_target - #define TARGET egl2display - #define BUILD_TARGET $[HAVE_GLES2] - #define USE_PACKAGES gles2 egl x11 - #define EXTRA_CDEFS OPENGLES_2 - #define LOCAL_LIBS \ - p3gles2gsg p3x11display - - #define SOURCES \ - config_egldisplay.cxx config_egldisplay.h \ - eglGraphicsBuffer.h eglGraphicsBuffer.cxx \ - eglGraphicsPipe.I eglGraphicsPipe.cxx eglGraphicsPipe.h \ - eglGraphicsPixmap.h eglGraphicsPixmap.cxx \ - eglGraphicsWindow.h eglGraphicsWindow.cxx \ - eglGraphicsStateGuardian.h eglGraphicsStateGuardian.cxx - - #define INSTALL_HEADERS \ - eglGraphicsBuffer.h eglGraphicsPixmap.h \ - eglGraphicsPipe.I eglGraphicsPipe.h \ - eglGraphicsWindow.I eglGraphicsWindow.h - -#end lib_target diff --git a/panda/src/event/Sources.pp b/panda/src/event/Sources.pp deleted file mode 100644 index 22bf575414..0000000000 --- a/panda/src/event/Sources.pp +++ /dev/null @@ -1,77 +0,0 @@ -#define LOCAL_LIBS p3putil p3express p3pandabase p3pstatclient p3linmath -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3event - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - asyncTask.h asyncTask.I \ - asyncTaskChain.h asyncTaskChain.I \ - asyncTaskCollection.h asyncTaskCollection.I \ - asyncTaskManager.h asyncTaskManager.I \ - asyncTaskPause.h asyncTaskPause.I \ - asyncTaskSequence.h asyncTaskSequence.I \ - config_event.h \ - buttonEvent.I buttonEvent.h \ - buttonEventList.I buttonEventList.h \ - genericAsyncTask.h genericAsyncTask.I \ - pointerEvent.I pointerEvent.h \ - pointerEventList.I pointerEventList.h \ - pythonTask.h pythonTask.I pythonTask.cxx \ - event.I event.h eventHandler.h eventHandler.I \ - eventParameter.I eventParameter.h \ - eventQueue.I eventQueue.h eventReceiver.h \ - pt_Event.h throw_event.I throw_event.h - - #define INCLUDED_SOURCES \ - asyncTask.cxx \ - asyncTaskChain.cxx \ - asyncTaskCollection.cxx \ - asyncTaskManager.cxx \ - asyncTaskPause.cxx \ - asyncTaskSequence.cxx \ - buttonEvent.cxx \ - buttonEventList.cxx \ - genericAsyncTask.cxx \ - pointerEvent.cxx \ - pointerEventList.cxx \ - config_event.cxx event.cxx eventHandler.cxx \ - eventParameter.cxx eventQueue.cxx eventReceiver.cxx \ - pt_Event.cxx - - #define INSTALL_HEADERS \ - asyncTask.h asyncTask.I \ - asyncTaskChain.h asyncTaskChain.I \ - asyncTaskCollection.h asyncTaskCollection.I \ - asyncTaskManager.h asyncTaskManager.I \ - asyncTaskPause.h asyncTaskPause.I \ - asyncTaskSequence.h asyncTaskSequence.I \ - buttonEvent.I buttonEvent.h \ - buttonEventList.I buttonEventList.h \ - genericAsyncTask.h genericAsyncTask.I \ - pointerEvent.I pointerEvent.h \ - pointerEventList.I pointerEventList.h \ - pythonTask.h pythonTask.I \ - event.I event.h eventHandler.h eventHandler.I \ - eventParameter.I eventParameter.h \ - eventQueue.I eventQueue.h eventReceiver.h \ - pt_Event.h throw_event.I throw_event.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_task - #define LOCAL_LIBS $[LOCAL_LIBS] p3mathutil - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_task.cxx - -#end test_bin_target diff --git a/panda/src/express/Sources.pp b/panda/src/express/Sources.pp deleted file mode 100644 index 150d0f421d..0000000000 --- a/panda/src/express/Sources.pp +++ /dev/null @@ -1,277 +0,0 @@ -#define LOCAL_LIBS p3pandabase -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3express - #define USE_PACKAGES zlib openssl tar - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx $[TARGET]_ext_composite.cxx - - #define SOURCES \ - buffer.I buffer.h \ - ca_bundle_data_src.c \ - checksumHashGenerator.I checksumHashGenerator.h circBuffer.I \ - circBuffer.h \ - compress_string.h \ - config_express.h \ - copy_stream.h \ - datagram.I datagram.h datagramGenerator.I \ - datagramGenerator.h \ - datagramIterator.I datagramIterator.h datagramSink.I datagramSink.h \ - dcast.T dcast.h \ - encrypt_string.h \ - error_utils.h \ - export_dtool.h \ - filename_ext.h \ - fileReference.h fileReference.I \ - globPattern_ext.h \ - hashGeneratorBase.I hashGeneratorBase.h \ - hashVal.I hashVal.h \ - indirectLess.I indirectLess.h \ - memoryInfo.I memoryInfo.h \ - memoryUsage.I memoryUsage.h \ - memoryUsagePointerCounts.I memoryUsagePointerCounts.h \ - memoryUsagePointers.I memoryUsagePointers.h \ - memoryUsagePointers_ext.h \ - multifile.I multifile.h \ - namable.I \ - namable.h \ - nodePointerTo.h nodePointerTo.I \ - nodePointerToBase.h nodePointerToBase.I \ - nodeReferenceCount.h nodeReferenceCount.I \ - openSSLWrapper.h openSSLWrapper.I \ - ordered_vector.h ordered_vector.I ordered_vector.T \ - pStatCollectorForwardBase.h \ - password_hash.h \ - patchfile.I patchfile.h \ - pointerTo.I pointerTo.h \ - pointerToArray.I pointerToArray.h \ - pointerToArray_ext.h \ - pointerToArrayBase.I pointerToArrayBase.h \ - pointerToBase.I pointerToBase.h \ - pointerToVoid.I pointerToVoid.h \ - profileTimer.I profileTimer.h \ - pta_int.h \ - pta_uchar.h pta_double.h pta_float.h \ - pta_stdfloat.h \ - ramfile.I ramfile.h ramfile_ext.h \ - referenceCount.I referenceCount.h \ - subStream.I subStream.h subStreamBuf.h \ - subfileInfo.h subfileInfo.I \ - streamReader_ext.h \ - temporaryFile.h temporaryFile.I \ - threadSafePointerTo.I threadSafePointerTo.h \ - threadSafePointerToBase.I threadSafePointerToBase.h \ - trueClock.I trueClock.h \ - typeHandle_ext.h \ - typedReferenceCount.I typedReferenceCount.h typedef.h \ - vector_uchar.h vector_double.h vector_float.h \ - vector_stdfloat.h \ - virtualFile.I virtualFileList.I virtualFileList.h virtualFileMount.h \ - virtualFileComposite.h virtualFileComposite.I virtualFile.h \ - virtualFileMount.I virtualFileMountMultifile.h \ - virtualFileMountMultifile.I \ - virtualFileMountRamdisk.h virtualFileMountRamdisk.I \ - virtualFileMountSystem.h virtualFileMountSystem.I \ - virtualFileSimple.h virtualFileSimple.I \ - virtualFileSystem.h virtualFileSystem.I \ - virtualFileSystem_ext.h \ - weakPointerCallback.I weakPointerCallback.h \ - weakPointerTo.I weakPointerTo.h \ - weakPointerToBase.I weakPointerToBase.h \ - weakPointerToVoid.I weakPointerToVoid.h \ - weakReferenceList.I weakReferenceList.h \ - windowsRegistry.h \ - zStream.I zStream.h zStreamBuf.h - - #define INCLUDED_SOURCES \ - buffer.cxx checksumHashGenerator.cxx \ - compress_string.cxx \ - config_express.cxx \ - copy_stream.cxx \ - datagram.cxx datagramGenerator.cxx \ - datagramIterator.cxx \ - datagramSink.cxx dcast.cxx \ - encrypt_string.cxx \ - error_utils.cxx \ - fileReference.cxx \ - hashGeneratorBase.cxx hashVal.cxx \ - memoryInfo.cxx memoryUsage.cxx memoryUsagePointerCounts.cxx \ - memoryUsagePointers_ext.cxx \ - memoryUsagePointers.cxx multifile.cxx \ - namable.cxx \ - nodePointerTo.cxx \ - nodePointerToBase.cxx \ - nodeReferenceCount.cxx \ - openSSLWrapper.cxx \ - ordered_vector.cxx \ - pStatCollectorForwardBase.cxx \ - password_hash.cxx \ - patchfile.cxx \ - pointerTo.cxx \ - pointerToArray.cxx \ - pointerToBase.cxx \ - pointerToVoid.cxx \ - profileTimer.cxx \ - pta_int.cxx \ - pta_uchar.cxx pta_double.cxx pta_float.cxx \ - ramfile_ext.cxx \ - ramfile.cxx \ - referenceCount.cxx \ - streamReader_ext.cxx \ - subStream.cxx subStreamBuf.cxx \ - subfileInfo.cxx \ - temporaryFile.cxx \ - threadSafePointerTo.cxx \ - threadSafePointerToBase.cxx \ - trueClock.cxx \ - typedReferenceCount.cxx \ - vector_uchar.cxx vector_double.cxx vector_float.cxx \ - virtualFileComposite.cxx virtualFile.cxx virtualFileList.cxx \ - virtualFileMount.cxx \ - virtualFileMountMultifile.cxx \ - virtualFileMountRamdisk.cxx \ - virtualFileMountSystem.cxx \ - virtualFileSimple.cxx virtualFileSystem.cxx \ - virtualFileSystem_ext.cxx \ - weakPointerCallback.cxx \ - weakPointerTo.cxx \ - weakPointerToBase.cxx \ - weakPointerToVoid.cxx \ - weakReferenceList.cxx \ - windowsRegistry.cxx \ - zStream.cxx zStreamBuf.cxx - - #define INSTALL_HEADERS \ - buffer.I buffer.h \ - ca_bundle_data_src.c \ - checksumHashGenerator.I checksumHashGenerator.h circBuffer.I \ - circBuffer.h \ - compress_string.h \ - config_express.h \ - copy_stream.h \ - datagram.I datagram.h datagramGenerator.I \ - datagramGenerator.h \ - datagramIterator.I datagramIterator.h datagramSink.I datagramSink.h \ - dcast.T dcast.h \ - encrypt_string.h \ - error_utils.h \ - fileReference.h fileReference.I \ - hashGeneratorBase.I hashGeneratorBase.h \ - hashVal.I hashVal.h \ - indirectLess.I indirectLess.h \ - memoryInfo.I memoryInfo.h \ - memoryUsage.I memoryUsage.h \ - memoryUsagePointerCounts.I memoryUsagePointerCounts.h \ - memoryUsagePointers.I memoryUsagePointers.h \ - multifile.I multifile.h \ - namable.I \ - namable.h \ - nodePointerTo.h nodePointerTo.I \ - nodePointerToBase.h nodePointerToBase.I \ - nodeReferenceCount.h nodeReferenceCount.I \ - openSSLWrapper.h openSSLWrapper.I \ - ordered_vector.h ordered_vector.I ordered_vector.T \ - pStatCollectorForwardBase.h \ - password_hash.h \ - patchfile.I patchfile.h \ - pointerTo.I pointerTo.h \ - pointerToArray.I pointerToArray.h \ - pointerToArrayBase.I pointerToArrayBase.h \ - pointerToBase.I pointerToBase.h \ - pointerToVoid.I pointerToVoid.h \ - profileTimer.I profileTimer.h \ - pta_int.h \ - pta_uchar.h pta_double.h pta_float.h \ - pta_stdfloat.h \ - ramfile.I ramfile.h \ - referenceCount.I referenceCount.h \ - subStream.I subStream.h subStreamBuf.h \ - subfileInfo.h subfileInfo.I \ - temporaryFile.h temporaryFile.I \ - threadSafePointerTo.I threadSafePointerTo.h \ - threadSafePointerToBase.I threadSafePointerToBase.h \ - trueClock.I trueClock.h \ - typedReferenceCount.I typedReferenceCount.h typedef.h \ - vector_uchar.h vector_double.h vector_float.h \ - vector_stdfloat.h \ - virtualFile.I virtualFileList.I virtualFileList.h virtualFileMount.h \ - virtualFileComposite.h virtualFileComposite.I virtualFile.h \ - virtualFileMount.I virtualFileMountMultifile.h \ - virtualFileMountMultifile.I \ - virtualFileMountRamdisk.h virtualFileMountRamdisk.I \ - virtualFileMountSystem.h virtualFileMountSystem.I \ - virtualFileSimple.h virtualFileSimple.I \ - virtualFileSystem.h virtualFileSystem.I \ - weakPointerCallback.I weakPointerCallback.h \ - weakPointerTo.I weakPointerTo.h \ - weakPointerToBase.I weakPointerToBase.h \ - weakPointerToVoid.I weakPointerToVoid.h \ - weakReferenceList.I weakReferenceList.h \ - windowsRegistry.h \ - zStream.I zStream.h zStreamBuf.h - - #define IGATESCAN all - #define WIN_SYS_LIBS \ - advapi32.lib ws2_32.lib $[WIN_SYS_LIBS] - - // These libraries and frameworks are used by dtoolutil; we redefine - // them here so they get into the panda build system. - #if $[ne $[PLATFORM], FreeBSD] - #define UNIX_SYS_LIBS dl - #endif - #define WIN_SYS_LIBS shell32.lib $[WIN_SYS_LIBS] - #define OSX_SYS_FRAMEWORKS Foundation $[if $[not $[BUILD_IPHONE]],AppKit] - -#end lib_target - -#begin test_bin_target - // Not really a "test" program; this program is used to regenerate - // ca_bundle_data_src.c. - - #define TARGET make_ca_bundle - #define LOCAL_LIBS $[LOCAL_LIBS] p3express - #define OTHER_LIBS p3dtoolutil:c p3dtool:m p3pystub - - #define SOURCES \ - make_ca_bundle.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_types - #define LOCAL_LIBS $[LOCAL_LIBS] p3express - #define OTHER_LIBS p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_types.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_ordered_vector - - #define SOURCES \ - test_ordered_vector.cxx - - #define LOCAL_LIBS $[LOCAL_LIBS] p3putil - #define OTHER_LIBS p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m p3pystub - -#end test_bin_target - - -#if $[HAVE_ZLIB] -#begin test_bin_target - #define TARGET test_zstream - #define USE_PACKAGES zlib - #define LOCAL_LIBS $[LOCAL_LIBS] p3express - #define OTHER_LIBS p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_zstream.cxx - -#end test_bin_target -#endif diff --git a/panda/src/express/pointerToBase.I b/panda/src/express/pointerToBase.I index ce319a5f50..09b5f3c75b 100644 --- a/panda/src/express/pointerToBase.I +++ b/panda/src/express/pointerToBase.I @@ -162,7 +162,7 @@ update_type(To *ptr) { // (Assignment to a NULL pointer also works, of course.) //////////////////////////////////////////////////////////////////// template -INLINE void PointerToBase:: +ALWAYS_INLINE void PointerToBase:: clear() { reassign((To *)NULL); } diff --git a/panda/src/express/pointerToBase.h b/panda/src/express/pointerToBase.h index 0828e300f8..7ed792d7d2 100644 --- a/panda/src/express/pointerToBase.h +++ b/panda/src/express/pointerToBase.h @@ -55,7 +55,7 @@ protected: // vs. non-const later. PUBLISHED: - INLINE void clear(); + ALWAYS_INLINE void clear(); void output(ostream &out) const; }; diff --git a/panda/src/express/pointerToVoid.I b/panda/src/express/pointerToVoid.I index 8080801837..c462cb8266 100644 --- a/panda/src/express/pointerToVoid.I +++ b/panda/src/express/pointerToVoid.I @@ -50,7 +50,7 @@ PointerToVoid(const PointerToVoid &) { // false otherwise. (Direct comparison to a NULL // pointer also works.) //////////////////////////////////////////////////////////////////// -INLINE bool PointerToVoid:: +ALWAYS_INLINE bool PointerToVoid:: is_null() const { return (_void_ptr == (void *)NULL); } diff --git a/panda/src/express/pointerToVoid.h b/panda/src/express/pointerToVoid.h index d3a71d7c8b..204cf7b7b6 100644 --- a/panda/src/express/pointerToVoid.h +++ b/panda/src/express/pointerToVoid.h @@ -42,7 +42,7 @@ private: INLINE PointerToVoid(const PointerToVoid ©); PUBLISHED: - INLINE bool is_null() const; + ALWAYS_INLINE bool is_null() const; INLINE size_t get_hash() const; public: diff --git a/panda/src/ffmpeg/Sources.pp b/panda/src/ffmpeg/Sources.pp deleted file mode 100644 index c47164a611..0000000000 --- a/panda/src/ffmpeg/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_FFMPEG] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define BUILDING_DLL BUILDING_FFMPEG - -#define USE_PACKAGES ffmpeg - -#begin lib_target - #define TARGET p3ffmpeg - - #define LOCAL_LIBS p3movies - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx - - #define SOURCES \ - config_ffmpeg.h \ - ffmpegVideo.h ffmpegVideo.I \ - ffmpegVideoCursor.h ffmpegVideoCursor.I \ - ffmpegAudio.h ffmpegAudio.I \ - ffmpegAudioCursor.h ffmpegAudioCursor.I \ - ffmpegVirtualFile.h ffmpegVirtualFile.I - - #define INCLUDED_SOURCES \ - config_ffmpeg.cxx \ - ffmpegVideo.cxx \ - ffmpegVideoCursor.cxx \ - ffmpegAudio.cxx \ - ffmpegAudioCursor.cxx \ - ffmpegVirtualFile.cxx - - #define INSTALL_HEADERS \ - config_ffmpeg.h \ - ffmpegVideo.h ffmpegVideo.I \ - ffmpegVideoCursor.h ffmpegVideoCursor.I \ - ffmpegAudio.h ffmpegAudio.I \ - ffmpegAudioCursor.h ffmpegAudioCursor.I \ - ffmpegVirtualFile.h ffmpegVirtualFile.I - -#end lib_target diff --git a/panda/src/framework/Sources.pp b/panda/src/framework/Sources.pp deleted file mode 100644 index ff9614ddd1..0000000000 --- a/panda/src/framework/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3framework - #define BUILDING_DLL BUILDING_FRAMEWORK - #define LOCAL_LIBS \ - p3recorder p3pgui p3pgraph p3putil p3collide p3chan p3text \ - p3pnmimage p3pnmimagetypes p3event p3char - -#if $[LINK_ALL_STATIC] - // If we're statically linking, we need to explicitly link with - // at least one of the available renderers. - #if $[HAVE_GL] - #define LOCAL_LIBS pandagl $[LOCAL_LIBS] - #elif $[HAVE_DX9] - #define LOCAL_LIBS pandadx9 $[LOCAL_LIBS] - #elif $[HAVE_TINYDISPLAY] - #define LOCAL_LIBS p3tinydisplay $[LOCAL_LIBS] - #endif - - // And we might like to have the p3egg loader available. - #if $[HAVE_EGG] - #define LOCAL_LIBS pandaegg $[LOCAL_LIBS] - #endif -#endif - - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define INCLUDED_SOURCES \ - config_framework.cxx config_framework.h \ - pandaFramework.cxx pandaFramework.I pandaFramework.h \ - windowFramework.cxx windowFramework.I windowFramework.h \ - rock_floor.rgb_src.c shuttle_controls.bam_src.c - - #define INSTALL_HEADERS \ - config_framework.h \ - pandaFramework.I pandaFramework.h \ - windowFramework.I windowFramework.h - -#end lib_target diff --git a/panda/src/gles2gsg/Sources.pp b/panda/src/gles2gsg/Sources.pp deleted file mode 100644 index 76269c227b..0000000000 --- a/panda/src/gles2gsg/Sources.pp +++ /dev/null @@ -1,19 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_GLES2] -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define USE_PACKAGES gles2 -#begin lib_target - #define TARGET p3gles2gsg - #define LOCAL_LIBS \ - p3glstuff p3gsgbase p3gobj p3display \ - p3putil p3linmath p3mathutil p3pnmimage - - #define SOURCES \ - config_gles2gsg.h config_gles2gsg.cxx \ - gles2gsg.h gles2gsg.cxx - - #define INSTALL_HEADERS \ - config_gles2gsg.h gles2gsg.h - -#end lib_target - diff --git a/panda/src/glesgsg/Sources.pp b/panda/src/glesgsg/Sources.pp deleted file mode 100644 index 45f7363cb3..0000000000 --- a/panda/src/glesgsg/Sources.pp +++ /dev/null @@ -1,19 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_GLES] -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define USE_PACKAGES gles -#begin lib_target - #define TARGET p3glesgsg - #define LOCAL_LIBS \ - p3glstuff p3gsgbase p3gobj p3display \ - p3putil p3linmath p3mathutil p3pnmimage - - #define SOURCES \ - config_glesgsg.h config_glesgsg.cxx \ - glesgsg.h glesgsg.cxx - - #define INSTALL_HEADERS \ - config_glesgsg.h glesgsg.h - -#end lib_target - diff --git a/panda/src/glgsg/Sources.pp b/panda/src/glgsg/Sources.pp deleted file mode 100644 index 7558bf2afa..0000000000 --- a/panda/src/glgsg/Sources.pp +++ /dev/null @@ -1,19 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_GL] -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define USE_PACKAGES gl cg cggl -#begin lib_target - #define TARGET p3glgsg - #define LOCAL_LIBS \ - p3glstuff p3gsgbase p3gobj p3display \ - p3putil p3linmath p3mathutil p3pnmimage - - #define SOURCES \ - config_glgsg.h config_glgsg.cxx \ - glgsg.h glgsg.cxx - - #define INSTALL_HEADERS \ - config_glgsg.h glgsg.h - -#end lib_target - diff --git a/panda/src/glstuff/Sources.pp b/panda/src/glstuff/Sources.pp deleted file mode 100644 index 5c18c659de..0000000000 --- a/panda/src/glstuff/Sources.pp +++ /dev/null @@ -1,56 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -// Most of the files here are not actually compiled into anything; -// they're just included by various other directories. - -#begin lib_target - #define TARGET p3glstuff - #define LOCAL_LIBS \ - p3gsgbase p3gobj p3display \ - p3putil p3linmath p3mathutil p3pnmimage - - - #define INSTALL_HEADERS \ - glGeomContext_src.I \ - glGeomContext_src.cxx \ - glGeomContext_src.h \ - glGeomMunger_src.I \ - glGeomMunger_src.cxx \ - glGeomMunger_src.h \ - glGraphicsStateGuardian_src.I \ - glGraphicsStateGuardian_src.cxx \ - glGraphicsStateGuardian_src.h \ - glGraphicsBuffer_src.I \ - glGraphicsBuffer_src.cxx \ - glGraphicsBuffer_src.h \ - glImmediateModeSender_src.I \ - glImmediateModeSender_src.cxx \ - glImmediateModeSender_src.h \ - glIndexBufferContext_src.I \ - glIndexBufferContext_src.cxx \ - glIndexBufferContext_src.h \ - glOcclusionQueryContext_src.I \ - glOcclusionQueryContext_src.cxx \ - glOcclusionQueryContext_src.h \ - glShaderContext_src.I \ - glShaderContext_src.cxx \ - glShaderContext_src.h \ - glTextureContext_src.I \ - glTextureContext_src.cxx \ - glTextureContext_src.h \ - glVertexBufferContext_src.I \ - glVertexBufferContext_src.cxx \ - glVertexBufferContext_src.h \ - glmisc_src.cxx \ - glmisc_src.h \ - glstuff_src.cxx \ - glstuff_src.h \ - glstuff_undef_src.h \ - panda_glext.h - - #define SOURCES \ - $[INSTALL_HEADERS] glpure.cxx - -#end lib_target - diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx index 910bf5c7c1..959982fd52 100644 --- a/panda/src/glstuff/glCgShaderContext_src.cxx +++ b/panda/src/glstuff/glCgShaderContext_src.cxx @@ -132,12 +132,14 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte // // We use positive indices to indicate generic vertex attributes, and negative // indices to indicate conventional vertex attributes (ie. glVertexPointer). - int nvarying = _shader->_var_spec.size(); - for (int i = 0; i < nvarying; ++i) { - Shader::ShaderVarSpec &bind = _shader->_var_spec[i]; + size_t nvarying = _shader->_var_spec.size(); + _attributes.resize(nvarying); + + for (size_t i = 0; i < nvarying; ++i) { + const Shader::ShaderVarSpec &bind = _shader->_var_spec[i]; CGparameter p = _cg_parameter_map[i]; if (p == 0) { - bind._id._seqno = CA_unknown; + _attributes[i] = CA_unknown; continue; } @@ -312,8 +314,7 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte } #endif - // Abuse the seqno field to store the GLSL attribute location. - bind._id._seqno = loc; + _attributes[i] = loc; } _glgsg->report_my_gl_errors(); @@ -326,7 +327,7 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte //////////////////////////////////////////////////////////////////// CLP(CgShaderContext):: ~CLP(CgShaderContext)() { - release_resources(); + // Don't call release_resources; we may not have an active context. } //////////////////////////////////////////////////////////////////// @@ -707,6 +708,7 @@ issue_parameters(int altered) { } } + cg_report_errors(); _glgsg->report_my_gl_errors(); } @@ -773,8 +775,8 @@ disable_shader_vertex_arrays() { return; } - for (int i = 0; i < (int)_shader->_var_spec.size(); ++i) { - GLint p = _shader->_var_spec[i]._id._seqno; + for (size_t i = 0; i < _shader->_var_spec.size(); ++i) { + GLint p = _attributes[i]; if (p >= 0) { _glgsg->_glDisableVertexAttribArray(p); @@ -843,8 +845,8 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { const GeomVertexArrayDataHandle *array_reader; Geom::NumericType numeric_type; int start, stride, num_values; - int nvarying = _shader->_var_spec.size(); - for (int i = 0; i < nvarying; ++i) { + size_t nvarying = _shader->_var_spec.size(); + for (size_t i = 0; i < nvarying; ++i) { const Shader::ShaderVarSpec &bind = _shader->_var_spec[i]; InternalName *name = bind._name; int texslot = bind._append_uv; @@ -858,7 +860,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { name = name->append(texname->get_basename()); } } - GLint p = bind._id._seqno; + GLint p = _attributes[i]; // Don't apply vertex colors if they are disabled with a ColorAttrib. int num_elements, element_stride, divisor; diff --git a/panda/src/glstuff/glCgShaderContext_src.h b/panda/src/glstuff/glCgShaderContext_src.h index 6bb0f8f43c..ddf7a351a1 100644 --- a/panda/src/glstuff/glCgShaderContext_src.h +++ b/panda/src/glstuff/glCgShaderContext_src.h @@ -68,6 +68,7 @@ private: CGprogram _cg_program; GLuint _glsl_program; + pvector _attributes; GLint _color_attrib_index; CGparameter _transform_table_param; CGparameter _slider_table_param; @@ -92,9 +93,9 @@ public: return _type_handle; } static void init_type() { - TypedObject::init_type(); + ShaderContext::init_type(); register_type(_type_handle, CLASSPREFIX_QUOTED "CgShaderContext", - TypedObject::get_class_type()); + ShaderContext::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index 2d851775a5..46ac9a7ba6 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -409,20 +409,19 @@ rebuild_bitplanes() { // Now create the FBO's. _have_any_color = false; - _fbo.reserve(num_fbos); - for (int layer = 0; layer < num_fbos; ++layer) { - if (layer >= _fbo.size()) { - _fbo.push_back(0); - } + if (num_fbos > _fbo.size()) { + // Generate more FBO handles. + int start = _fbo.size(); + _fbo.resize(num_fbos, 0); + glgsg->_glGenFramebuffers(num_fbos - start, &_fbo[start]); + } + + for (int layer = 0; layer < num_fbos; ++layer) { // Bind the FBO if (_fbo[layer] == 0) { - glgsg->_glGenFramebuffers(1, &_fbo[layer]); - - if (_fbo[layer] == 0) { - report_my_gl_errors(); - return; - } + report_my_gl_errors(); + return; } glgsg->bind_fbo(_fbo[layer]); @@ -1118,11 +1117,7 @@ generate_mipmaps() { CLP(TextureContext) *gtc = *it; if (gtc->_generate_mipmaps) { - glgsg->_state_texture = 0; - glgsg->update_texture(gtc, true); - glgsg->apply_texture(gtc); - glgsg->_glGenerateMipmap(gtc->_target); - glBindTexture(gtc->_target, 0); + glgsg->generate_mipmaps(gtc); } } @@ -1626,6 +1621,15 @@ report_my_errors(int line, const char *file) { void CLP(GraphicsBuffer):: check_host_valid() { if ((_host == 0)||(!_host->is_valid())) { + _rb_data_size_bytes = 0; + if (_rb_context != NULL) { + // We must delete this object first, because when the GSG + // destructs, so will the tracker that this context is + // attached to. + _rb_context->update_data_size_bytes(0); + delete _rb_context; + _rb_context = NULL; + } _is_valid = false; _gsg.clear(); _host.clear(); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.I b/panda/src/glstuff/glGraphicsStateGuardian_src.I index 636a80864c..b01aa417ec 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.I +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.I @@ -624,10 +624,10 @@ INLINE void CLP(GraphicsStateGuardian):: set_color_write_mask(int mask) { if (gl_color_mask && _active_color_write_mask != mask) { _active_color_write_mask = mask; - glColorMask((_color_write_mask & ColorWriteAttrib::C_red) != 0, - (_color_write_mask & ColorWriteAttrib::C_green) != 0, - (_color_write_mask & ColorWriteAttrib::C_blue) != 0, - (_color_write_mask & ColorWriteAttrib::C_alpha) != 0); + glColorMask((mask & ColorWriteAttrib::C_red) != 0, + (mask & ColorWriteAttrib::C_green) != 0, + (mask & ColorWriteAttrib::C_blue) != 0, + (mask & ColorWriteAttrib::C_alpha) != 0); } } diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 614dbec469..bd797c249f 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -284,12 +284,14 @@ fix_component_ordering(PTA_uchar &new_image, case GL_RGB: switch (tex->get_component_type()) { case Texture::T_unsigned_byte: + case Texture::T_byte: new_image = PTA_uchar::empty_array(orig_image_size); uchar_bgr_to_rgb(new_image, orig_image, orig_image_size / 3); result = new_image; break; case Texture::T_unsigned_short: + case Texture::T_short: new_image = PTA_uchar::empty_array(orig_image_size); ushort_bgr_to_rgb((unsigned short *)new_image.p(), (const unsigned short *)orig_image, @@ -305,12 +307,14 @@ fix_component_ordering(PTA_uchar &new_image, case GL_RGBA: switch (tex->get_component_type()) { case Texture::T_unsigned_byte: + case Texture::T_byte: new_image = PTA_uchar::empty_array(orig_image_size); uchar_bgra_to_rgba(new_image, orig_image, orig_image_size / 4); result = new_image; break; case Texture::T_unsigned_short: + case Texture::T_short: new_image = PTA_uchar::empty_array(orig_image_size); ushort_bgra_to_rgba((unsigned short *)new_image.p(), (const unsigned short *)orig_image, @@ -1873,6 +1877,15 @@ reset() { #endif // OPENGLES #endif +#ifndef OPENGLES + if (is_at_least_gl_version(4, 5) || has_extension("GL_ARB_direct_state_access")) { + _glGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC) + get_extension_func("glGenerateTextureMipmap"); + } else { + _glGenerateTextureMipmap = NULL; + } +#endif + _supports_framebuffer_multisample = false; if ( has_extension("GL_EXT_framebuffer_multisample") ) { _supports_framebuffer_multisample = true; @@ -4684,6 +4697,20 @@ update_texture(TextureContext *tc, bool force) { void CLP(GraphicsStateGuardian):: release_texture(TextureContext *tc) { CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc); + +#ifndef OPENGLES + _textures_needing_fetch_barrier.erase(gtc); + _textures_needing_image_access_barrier.erase(gtc); + _textures_needing_update_barrier.erase(gtc); + _textures_needing_framebuffer_barrier.erase(gtc); +#endif + + glDeleteTextures(1, >c->_index); + + if (gtc->_buffer != 0) { + _glDeleteBuffers(1, >c->_buffer); + } + delete gtc; } @@ -4817,6 +4844,11 @@ prepare_sampler(const SamplerState &sampler) { void CLP(GraphicsStateGuardian):: release_sampler(SamplerContext *sc) { CLP(SamplerContext) *gsc = DCAST(CLP(SamplerContext), sc); + + if (gsc->_index != 0) { + _glDeleteSamplers(1, &gsc->_index); + } + delete gsc; } #endif // !OPENGLES @@ -4923,6 +4955,17 @@ prepare_shader(Shader *se) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: release_shader(ShaderContext *sc) { +#ifndef OPENGLES_1 + if (sc->is_of_type(CLP(ShaderContext)::get_class_type())) { + ((CLP(ShaderContext) *)sc)->release_resources(); + } +#if defined(HAVE_CG) && !defined(OPENGLES_2) + else if (sc->is_of_type(CLP(CgShaderContext)::get_class_type())) { + ((CLP(CgShaderContext) *)sc)->release_resources(); + } +#endif +#endif + delete sc; } @@ -7785,6 +7828,10 @@ get_component_type(Texture::ComponentType component_type) { #ifndef OPENGLES_1 return GL_INT; #endif + case Texture::T_byte: + return GL_BYTE; + case Texture::T_short: + return GL_SHORT; default: GLCAT.error() << "Invalid Texture::Type value!\n"; return GL_UNSIGNED_BYTE; @@ -8409,6 +8456,10 @@ get_internal_image_format(Texture *tex, bool force_sized) const { #ifndef OPENGLES if (tex->get_component_type() == Texture::T_unsigned_short) { return GL_RGBA16; + } else if (tex->get_component_type() == Texture::T_short) { + return GL_RGBA16_SNORM; + } else if (tex->get_component_type() == Texture::T_byte) { + return GL_RGBA8_SNORM; } else #endif { @@ -8425,27 +8476,32 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return force_sized ? GL_RGBA8 : GL_RGBA; #else case Texture::F_rgba8: - return GL_RGBA8; + if (Texture::is_unsigned(tex->get_component_type())) { + return GL_RGBA8; + } else { + return GL_RGBA8_SNORM; + } + case Texture::F_r8i: - if (tex->get_component_type() == Texture::T_unsigned_byte) { + if (Texture::is_unsigned(tex->get_component_type())) { return GL_R8UI; } else { return GL_R8I; } case Texture::F_rg8i: - if (tex->get_component_type() == Texture::T_unsigned_byte) { + if (Texture::is_unsigned(tex->get_component_type())) { return GL_RG8UI; } else { return GL_RG8I; } case Texture::F_rgb8i: - if (tex->get_component_type() == Texture::T_unsigned_byte) { + if (Texture::is_unsigned(tex->get_component_type())) { return GL_RGB8UI; } else { return GL_RGB8I; } case Texture::F_rgba8i: - if (tex->get_component_type() == Texture::T_unsigned_byte) { + if (Texture::is_unsigned(tex->get_component_type())) { return GL_RGBA8UI; } else { return GL_RGBA8I; @@ -8457,17 +8513,24 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_rgba16: if (tex->get_component_type() == Texture::T_float) { return GL_RGBA16F; - } else { + } else if (Texture::is_unsigned(tex->get_component_type())) { return GL_RGBA16; + } else { + return GL_RGBA16_SNORM; } case Texture::F_rgba32: return GL_RGBA32F; #endif // OPENGLES case Texture::F_rgb: - if (tex->get_component_type() == Texture::T_float) { - return GL_RGB16F; - } else { + switch (tex->get_component_type()) { + case Texture::T_float: return GL_RGB16F; +#ifndef OPENGLES + case Texture::T_unsigned_short: return GL_RGB16; + case Texture::T_short: return GL_RGB16_SNORM; + case Texture::T_byte: return GL_RGB8_SNORM; +#endif + default: return force_sized ? GL_RGB8 : GL_RGB; } @@ -8490,14 +8553,20 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return GL_RGB16F; #else case Texture::F_rgb8: - return GL_RGB8; + if (Texture::is_unsigned(tex->get_component_type())) { + return GL_RGB8; + } else { + return GL_RGB8_SNORM; + } case Texture::F_rgb12: return GL_RGB12; case Texture::F_rgb16: if (tex->get_component_type() == Texture::T_float) { return GL_RGB16F; - } else { + } else if (Texture::is_unsigned(tex->get_component_type())) { return GL_RGB16; + } else { + return GL_RGB16_SNORM; } #endif // OPENGLES case Texture::F_rgb32: @@ -8517,14 +8586,18 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_r16: if (tex->get_component_type() == Texture::T_float) { return GL_R16F; - } else { + } else if (Texture::is_unsigned(tex->get_component_type())) { return GL_R16; + } else { + return GL_R16_SNORM; } case Texture::F_rg16: if (tex->get_component_type() == Texture::T_float) { return GL_RG16F; - } else { + } else if (Texture::is_unsigned(tex->get_component_type())) { return GL_RG16; + } else { + return GL_RG16_SNORM; } #endif @@ -8537,7 +8610,14 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_red: case Texture::F_green: case Texture::F_blue: - return force_sized ? GL_R8 : GL_RED; +#ifndef OPENGLES + if (!Texture::is_unsigned(tex->get_component_type())) { + return GL_R8_SNORM; + } else +#endif + { + return force_sized ? GL_R8 : GL_RED; + } #endif case Texture::F_alpha: @@ -8551,6 +8631,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const { #ifndef OPENGLES if (tex->get_component_type() == Texture::T_float) { return GL_LUMINANCE16F_ARB; + } else if (tex->get_component_type() == Texture::T_short) { + return GL_LUMINANCE16_SNORM; } else if (tex->get_component_type() == Texture::T_unsigned_short) { return GL_LUMINANCE16; } else @@ -11687,6 +11769,31 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, return true; } +//////////////////////////////////////////////////////////////////// +// Function: GLGraphicsStateGuardian::generate_mipmaps +// Access: Protected +// Description: Causes mipmaps to be generated for an uploaded +// texture. +//////////////////////////////////////////////////////////////////// +void CLP(GraphicsStateGuardian):: +generate_mipmaps(CLP(TextureContext) *gtc) { +#ifndef OPENGLES + if (_glGenerateTextureMipmap != NULL) { + // OpenGL 4.5 offers an easy way to do this without binding. + _glGenerateTextureMipmap(gtc->_index); + return; + } +#endif + + if (_glGenerateMipmap != NULL) { + _state_texture = 0; + update_texture(gtc, true); + apply_texture(gtc); + _glGenerateMipmap(gtc->_target); + glBindTexture(gtc->_target, 0); + } +} + //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::upload_simple_texture // Access: Protected @@ -12094,15 +12201,19 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { break; case GL_R8I: + type = Texture::T_byte; format = Texture::F_r8i; break; case GL_RG8I: + type = Texture::T_byte; format = Texture::F_rg8i; break; case GL_RGB8I: + type = Texture::T_byte; format = Texture::F_rgb8i; break; case GL_RGBA8I: + type = Texture::T_byte; format = Texture::F_rgba8i; break; @@ -12172,6 +12283,19 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { type = Texture::T_unsigned_short; format = Texture::F_r16; break; + + case GL_RGB16_SNORM: + type = Texture::T_short; + format = Texture::F_rgb16; + break; + case GL_RG16_SNORM: + type = Texture::T_short; + format = Texture::F_rg16; + break; + case GL_R16_SNORM: + type = Texture::T_short; + format = Texture::F_r16; + break; #endif #ifndef OPENGLES diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 62df6fe84c..7d5f796140 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -546,6 +546,7 @@ protected: GLenum component_type, bool one_page_only, int z, Texture::CompressionMode image_compression); + void generate_mipmaps(CLP(TextureContext) *gtc); bool upload_simple_texture(CLP(TextureContext) *gtc); size_t get_texture_memory_size(CLP(TextureContext) *gtc); @@ -794,6 +795,10 @@ public: PFNGLGENERATEMIPMAPEXTPROC _glGenerateMipmap; PFNGLBINDPROGRAMARBPROC _glBindProgram; +#ifndef OPENGLES + PFNGLGENERATETEXTUREMIPMAPPROC _glGenerateTextureMipmap; +#endif + bool _supports_framebuffer_multisample; bool _supports_framebuffer_multisample_coverage_nv; INLINE bool get_supports_framebuffer_multisample(); diff --git a/panda/src/glstuff/glSamplerContext_src.cxx b/panda/src/glstuff/glSamplerContext_src.cxx index 13f4129071..c09655912d 100644 --- a/panda/src/glstuff/glSamplerContext_src.cxx +++ b/panda/src/glstuff/glSamplerContext_src.cxx @@ -39,10 +39,7 @@ CLP(SamplerContext)(CLP(GraphicsStateGuardian) *glgsg, //////////////////////////////////////////////////////////////////// CLP(SamplerContext):: ~CLP(SamplerContext)() { - if (_index != 0) { - _glgsg->_glDeleteSamplers(1, &_index); - _index = 0; - } + // Don't call glDeleteSamplers; we may not have an active context. } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index beec31ad17..08ef11b2a5 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1513,7 +1513,7 @@ get_sampler_texture_type(int &out, GLenum param_type) { //////////////////////////////////////////////////////////////////// CLP(ShaderContext):: ~CLP(ShaderContext)() { - release_resources(); + // Don't call release_resources; we may not have an active context. } //////////////////////////////////////////////////////////////////// @@ -2479,6 +2479,15 @@ glsl_report_program_errors(GLuint program, bool fatal) { //////////////////////////////////////////////////////////////////// bool CLP(ShaderContext):: glsl_compile_shader(Shader::ShaderType type) { + static const char *types[] = {"", "vertex ", "fragment ", "geometry ", + "tessellation control ", "tessellation evaluation ", "compute ", ""}; + + if (GLCAT.is_debug()) { + GLCAT.debug() + << "Compiling GLSL " << types[type] << "shader " + << _shader->get_filename(type) << "\n"; + } + GLuint handle = 0; switch (type) { case Shader::ST_vertex: @@ -2514,7 +2523,7 @@ glsl_compile_shader(Shader::ShaderType type) { } if (!handle) { GLCAT.error() - << "Could not create a GLSL shader of the requested type.\n"; + << "Could not create a GLSL " << types[type] << "shader.\n"; _glgsg->report_my_gl_errors(); return false; } @@ -2533,8 +2542,8 @@ glsl_compile_shader(Shader::ShaderType type) { if (status != GL_TRUE) { GLCAT.error() - << "An error occurred while compiling GLSL shader " - << _shader->get_filename(type) << ":\n"; + << "An error occurred while compiling GLSL " << types[type] + << "shader " << _shader->get_filename(type) << ":\n"; glsl_report_shader_errors(handle, type, true); _glgsg->_glDeleteShader(handle); _glgsg->report_my_gl_errors(); @@ -2629,12 +2638,18 @@ glsl_compile_and_link() { } #endif + if (GLCAT.is_debug()) { + GLCAT.debug() + << "Linking GLSL shader " << _shader->get_filename() << "\n"; + } + _glgsg->_glLinkProgram(_glsl_program); GLint status; _glgsg->_glGetProgramiv(_glsl_program, GL_LINK_STATUS, &status); if (status != GL_TRUE) { - GLCAT.error() << "An error occurred while linking GLSL shader program!\n"; + GLCAT.error() << "An error occurred while linking GLSL shader " + << _shader->get_filename() << "\n"; glsl_report_program_errors(_glsl_program, true); return false; } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index f6231b8481..eb4e2df24f 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -116,9 +116,9 @@ public: return _type_handle; } static void init_type() { - TypedObject::init_type(); + ShaderContext::init_type(); register_type(_type_handle, CLASSPREFIX_QUOTED "ShaderContext", - TypedObject::get_class_type()); + ShaderContext::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/glstuff/glTextureContext_src.cxx b/panda/src/glstuff/glTextureContext_src.cxx index 1383275832..3238ae5a30 100644 --- a/panda/src/glstuff/glTextureContext_src.cxx +++ b/panda/src/glstuff/glTextureContext_src.cxx @@ -23,22 +23,7 @@ TypeHandle CLP(TextureContext)::_type_handle; //////////////////////////////////////////////////////////////////// CLP(TextureContext):: ~CLP(TextureContext)() { -#ifndef OPENGLES - if (gl_enable_memory_barriers) { - _glgsg->_textures_needing_fetch_barrier.erase(this); - _glgsg->_textures_needing_image_access_barrier.erase(this); - _glgsg->_textures_needing_update_barrier.erase(this); - _glgsg->_textures_needing_framebuffer_barrier.erase(this); - } -#endif - - glDeleteTextures(1, &_index); - _index = 0; - - if (_buffer != 0) { - _glgsg->_glDeleteBuffers(1, &_buffer); - _buffer = 0; - } + // Don't call glDeleteTextures; we may not have an active context. } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glstuff/glmisc_src.cxx b/panda/src/glstuff/glmisc_src.cxx index 0d4e31ae96..cc72730a43 100644 --- a/panda/src/glstuff/glmisc_src.cxx +++ b/panda/src/glstuff/glmisc_src.cxx @@ -308,6 +308,9 @@ void CLP(init_classes)() { CLP(IndexBufferContext)::init_type(); #ifndef OPENGLES_1 CLP(ShaderContext)::init_type(); +#endif +#if defined(HAVE_CG) && !defined(OPENGLES) + CLP(CgShaderContext)::init_type(); #endif CLP(TextureContext)::init_type(); #ifndef OPENGLES diff --git a/panda/src/glxdisplay/Sources.pp b/panda/src/glxdisplay/Sources.pp deleted file mode 100644 index 45c48c73a5..0000000000 --- a/panda/src/glxdisplay/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_GLX] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m -#define USE_PACKAGES gl glx cg -#if $[LINK_IN_GLXGETPROCADDRESS] - #define EXTRA_CDEFS LINK_IN_GLXGETPROCADDRESS -#endif - -#begin lib_target - #define TARGET p3glxdisplay - #define LOCAL_LIBS \ - p3glgsg p3x11display - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_glxdisplay.h \ - glxGraphicsBuffer.h glxGraphicsBuffer.I \ - glxGraphicsPipe.h glxGraphicsPipe.I \ - glxGraphicsPixmap.h glxGraphicsPixmap.I \ - glxGraphicsWindow.h \ - glxGraphicsStateGuardian.h glxGraphicsStateGuardian.I \ - posixGraphicsStateGuardian.h posixGraphicsStateGuardian.I \ - panda_glxext.h - - #define INCLUDED_SOURCES \ - config_glxdisplay.cxx \ - glxGraphicsBuffer.cxx \ - glxGraphicsPipe.cxx \ - glxGraphicsPixmap.cxx \ - glxGraphicsWindow.cxx \ - glxGraphicsStateGuardian.cxx \ - posixGraphicsStateGuardian.cxx - - #define INSTALL_HEADERS \ - glxGraphicsBuffer.I glxGraphicsBuffer.h \ - glxGraphicsPipe.h glxGraphicsPipe.I \ - glxGraphicsWindow.h - -#end lib_target - diff --git a/panda/src/gobj/Sources.pp b/panda/src/gobj/Sources.pp deleted file mode 100644 index 5c74dac9d3..0000000000 --- a/panda/src/gobj/Sources.pp +++ /dev/null @@ -1,255 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -//#define OSX_SYS_LIBS mx -#define USE_PACKAGES zlib cg squish - -#begin lib_target - #define TARGET p3gobj - #define LOCAL_LIBS \ - p3pstatclient p3event p3linmath p3mathutil p3pnmimage p3gsgbase p3putil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx \ - $[TARGET]_ext_composite.cxx - - #define SOURCES \ - adaptiveLru.I adaptiveLru.h \ - animateVerticesRequest.I animateVerticesRequest.h \ - bufferContext.I bufferContext.h \ - bufferContextChain.I bufferContextChain.h \ - bufferResidencyTracker.I bufferResidencyTracker.h \ - config_gobj.h \ - geom.h geom.I \ - geomContext.I geomContext.h \ - geomEnums.h \ - geomMunger.h geomMunger.I \ - geomPrimitive.h geomPrimitive.I \ - geomPatches.h \ - geomTriangles.h \ - geomTristrips.h \ - geomTrifans.h \ - geomLines.h \ - geomLinestrips.h \ - geomPoints.h \ - geomVertexArrayData.h geomVertexArrayData.I \ - geomVertexArrayData_ext.h \ - geomVertexArrayFormat.h geomVertexArrayFormat.I \ - geomCacheEntry.h geomCacheEntry.I \ - geomCacheManager.h geomCacheManager.I \ - geomVertexAnimationSpec.h geomVertexAnimationSpec.I \ - geomVertexData.h geomVertexData.I \ - geomVertexColumn.h geomVertexColumn.I \ - geomVertexFormat.h geomVertexFormat.I \ - geomVertexReader.h geomVertexReader.I \ - geomVertexRewriter.h geomVertexRewriter.I \ - geomVertexWriter.h geomVertexWriter.I \ - indexBufferContext.I indexBufferContext.h \ - internalName.I internalName.h \ - internalName_ext.h \ - lens.h lens.I \ - material.I material.h materialPool.I materialPool.h \ - matrixLens.I matrixLens.h \ - occlusionQueryContext.I occlusionQueryContext.h \ - orthographicLens.I orthographicLens.h perspectiveLens.I \ - paramTexture.I paramTexture.h \ - perspectiveLens.h \ - preparedGraphicsObjects.I preparedGraphicsObjects.h \ - queryContext.I queryContext.h \ - samplerState.I samplerState.h \ - savedContext.I savedContext.h \ - shader.I shader.h \ - shaderContext.h shaderContext.I \ - simpleAllocator.h simpleAllocator.I \ - simpleLru.h simpleLru.I \ - sliderTable.I sliderTable.h \ - texture.I texture.h \ - textureCollection.I textureCollection.h \ - textureCollection_ext.h \ - textureContext.I textureContext.h \ - texturePeeker.I texturePeeker.h \ - texturePool.I texturePool.h \ - texturePoolFilter.I texturePoolFilter.h \ - textureReloadRequest.I textureReloadRequest.h \ - textureStage.I textureStage.h \ - textureStagePool.I textureStagePool.h \ - timerQueryContext.I timerQueryContext.h \ - transformBlend.I transformBlend.h \ - transformBlendTable.I transformBlendTable.h \ - transformTable.I transformTable.h \ - userVertexSlider.I userVertexSlider.h \ - userVertexTransform.I userVertexTransform.h \ - vertexBufferContext.I vertexBufferContext.h \ - vertexDataBlock.I vertexDataBlock.h \ - vertexDataBook.I vertexDataBook.h \ - vertexDataBuffer.I vertexDataBuffer.h \ - vertexDataPage.I vertexDataPage.h \ - vertexDataSaveFile.I vertexDataSaveFile.h \ - vertexSlider.I vertexSlider.h \ - vertexTransform.I vertexTransform.h \ - videoTexture.I videoTexture.h - - #define INCLUDED_SOURCES \ - adaptiveLru.cxx \ - animateVerticesRequest.cxx \ - bufferContext.cxx \ - bufferContextChain.cxx \ - bufferResidencyTracker.cxx \ - config_gobj.cxx \ - geomContext.cxx \ - geom.cxx \ - geomEnums.cxx \ - geomMunger.cxx \ - geomPrimitive.cxx \ - geomPatches.cxx \ - geomTriangles.cxx \ - geomTristrips.cxx \ - geomTrifans.cxx \ - geomLines.cxx \ - geomLinestrips.cxx \ - geomPoints.cxx \ - geomVertexArrayData.cxx \ - geomVertexArrayData_ext.cxx \ - geomVertexArrayFormat.cxx \ - geomCacheEntry.cxx \ - geomCacheManager.cxx \ - geomVertexAnimationSpec.cxx \ - geomVertexData.cxx \ - geomVertexColumn.cxx \ - geomVertexFormat.cxx \ - geomVertexReader.cxx \ - geomVertexRewriter.cxx \ - geomVertexWriter.cxx \ - indexBufferContext.cxx \ - material.cxx \ - internalName.cxx \ - internalName_ext.cxx \ - lens.cxx \ - materialPool.cxx matrixLens.cxx \ - occlusionQueryContext.cxx \ - orthographicLens.cxx \ - paramTexture.cxx \ - perspectiveLens.cxx \ - preparedGraphicsObjects.cxx \ - queryContext.cxx \ - samplerState.cxx \ - savedContext.cxx \ - shader.cxx \ - shaderContext.cxx \ - simpleAllocator.cxx \ - simpleLru.cxx \ - sliderTable.cxx \ - texture.cxx \ - textureCollection.cxx \ - textureCollection_ext.cxx \ - textureContext.cxx \ - texturePeeker.cxx \ - texturePool.cxx \ - texturePoolFilter.cxx \ - textureReloadRequest.cxx \ - textureStage.cxx \ - textureStagePool.cxx \ - timerQueryContext.cxx \ - transformBlend.cxx \ - transformBlendTable.cxx \ - transformTable.cxx \ - userVertexSlider.cxx \ - userVertexTransform.cxx \ - vertexBufferContext.cxx \ - vertexDataBlock.cxx \ - vertexDataBook.cxx \ - vertexDataBuffer.cxx \ - vertexDataPage.cxx \ - vertexDataSaveFile.cxx \ - vertexSlider.cxx \ - vertexTransform.cxx \ - videoTexture.cxx - - #define INSTALL_HEADERS \ - adaptiveLru.I adaptiveLru.h \ - animateVerticesRequest.I animateVerticesRequest.h \ - bufferContext.I bufferContext.h \ - bufferContextChain.I bufferContextChain.h \ - bufferResidencyTracker.I bufferResidencyTracker.h \ - config_gobj.h \ - geom.I geom.h \ - textureContext.I textureContext.h \ - geom.h geom.I \ - geomContext.I geomContext.h \ - geomEnums.h \ - geomMunger.h geomMunger.I \ - geomPrimitive.h geomPrimitive.I \ - geomPatches.h \ - geomTriangles.h \ - geomTristrips.h \ - geomTrifans.h \ - geomLines.h \ - geomLinestrips.h \ - geomPoints.h \ - geomVertexArrayData.h geomVertexArrayData.I \ - geomVertexArrayFormat.h geomVertexArrayFormat.I \ - geomCacheEntry.h geomCacheEntry.I \ - geomCacheManager.h geomCacheManager.I \ - geomVertexAnimationSpec.h geomVertexAnimationSpec.I \ - geomVertexData.h geomVertexData.I \ - geomVertexColumn.h geomVertexColumn.I \ - geomVertexFormat.h geomVertexFormat.I \ - geomVertexReader.h geomVertexReader.I \ - geomVertexRewriter.h geomVertexRewriter.I \ - geomVertexWriter.h geomVertexWriter.I \ - indexBufferContext.I indexBufferContext.h \ - internalName.I internalName.h \ - lens.h lens.I \ - material.I material.h \ - materialPool.I materialPool.h matrixLens.I matrixLens.h \ - occlusionQueryContext.I occlusionQueryContext.h \ - orthographicLens.I orthographicLens.h \ - paramTexture.I paramTexture.h \ - perspectiveLens.I perspectiveLens.h \ - preparedGraphicsObjects.I preparedGraphicsObjects.h \ - queryContext.I queryContext.h \ - samplerState.I samplerState.h \ - savedContext.I savedContext.h \ - shader.I shader.h \ - shaderContext.h shaderContext.I \ - simpleAllocator.h simpleAllocator.I \ - simpleLru.h simpleLru.I \ - sliderTable.I sliderTable.h \ - texture.I texture.h \ - textureCollection.I textureCollection.h \ - textureContext.I textureContext.h \ - texturePeeker.I texturePeeker.h \ - texturePool.I texturePool.h \ - texturePoolFilter.I texturePoolFilter.h \ - textureReloadRequest.I textureReloadRequest.h \ - textureStage.I textureStage.h \ - textureStagePool.I textureStagePool.h \ - timerQueryContext.I timerQueryContext.h \ - transformBlend.I transformBlend.h \ - transformBlendTable.I transformBlendTable.h \ - transformTable.I transformTable.h \ - userVertexSlider.I userVertexSlider.h \ - userVertexTransform.I userVertexTransform.h \ - vertexBufferContext.I vertexBufferContext.h \ - vertexDataBlock.I vertexDataBlock.h \ - vertexDataBook.I vertexDataBook.h \ - vertexDataBuffer.I vertexDataBuffer.h \ - vertexDataPage.I vertexDataPage.h \ - vertexDataSaveFile.I vertexDataSaveFile.h \ - vertexSlider.I vertexSlider.h \ - vertexTransform.I vertexTransform.h \ - videoTexture.I videoTexture.h - - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_gobj - #define LOCAL_LIBS \ - p3gobj p3putil - - #define SOURCES \ - test_gobj.cxx - -#end test_bin_target - diff --git a/panda/src/gobj/geomVertexColumn.h b/panda/src/gobj/geomVertexColumn.h index 8fab9952aa..cd6f8b6efa 100644 --- a/panda/src/gobj/geomVertexColumn.h +++ b/panda/src/gobj/geomVertexColumn.h @@ -433,6 +433,7 @@ private: }; friend class GeomVertexArrayFormat; + friend class GeomVertexData; friend class GeomVertexReader; friend class GeomVertexWriter; }; diff --git a/panda/src/gobj/geomVertexData.cxx b/panda/src/gobj/geomVertexData.cxx index 1ac95c98c3..5715ec3953 100644 --- a/panda/src/gobj/geomVertexData.cxx +++ b/panda/src/gobj/geomVertexData.cxx @@ -976,11 +976,7 @@ set_color(const LColor &color) const { } PT(GeomVertexData) new_data = new GeomVertexData(*this); - GeomVertexWriter to(new_data, InternalName::get_color()); - while (!to.is_at_end()) { - to.set_data4(color); - } - + do_set_color(new_data, color); return new_data; } @@ -1008,12 +1004,7 @@ set_color(const LColor &color, int num_components, PT(GeomVertexData) new_data = replace_column (InternalName::get_color(), num_components, numeric_type, contents); - // Now go through and set the new color value. - GeomVertexWriter to(new_data, InternalName::get_color()); - while (!to.is_at_end()) { - to.set_data4(color); - } - + do_set_color(new_data, color); return new_data; } @@ -1196,6 +1187,64 @@ transform_vertices(const LMatrix4 &mat, int begin_row, int end_row) { } } +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexData::do_set_color +// Access: Private, Static +// Description: Fills in the color column of the given vertex data +// object with a constant color. Assumes that there +// is already a color column present. +//////////////////////////////////////////////////////////////////// +void GeomVertexData:: +do_set_color(GeomVertexData *vdata, const LColor &color) { + // This function is used relatively often (by the SceneGraphReducer, + // when flattening colors, and by the munger, when munging colors), + // so I've written out a version that avoids the performance overhead + // of the packer and GeomVertexWriter. + + const GeomVertexFormat *format = vdata->get_format(); + const GeomVertexColumn *column; + int array_index; + if (!format->get_array_info(InternalName::get_color(), array_index, column)) { + nassertv(false); + } + + size_t stride = format->get_array(array_index)->get_stride(); + + GeomVertexColumn::Packer *packer = column->_packer; + nassertv(packer != NULL); + + // Pack into a buffer, which we will then copy. + unsigned char buffer[32]; + size_t bufsize = column->get_total_bytes(); +#ifdef STDFLOAT_DOUBLE + packer->set_data4d(buffer, color); +#else + packer->set_data4f(buffer, color); +#endif + + PT(GeomVertexArrayDataHandle) handle = + vdata->modify_array(array_index)->modify_handle(); + unsigned char *write_ptr = handle->get_write_pointer(); + unsigned char *end_ptr = write_ptr + handle->get_data_size_bytes(); + write_ptr += column->get_start(); + + if (bufsize == 4) { + // Most common case. + while (write_ptr < end_ptr) { + write_ptr[0] = buffer[0]; + write_ptr[1] = buffer[1]; + write_ptr[2] = buffer[2]; + write_ptr[3] = buffer[3]; + write_ptr += stride; + } + } else { + while (write_ptr < end_ptr) { + memcpy(write_ptr, buffer, bufsize); + write_ptr += stride; + } + } +} + //////////////////////////////////////////////////////////////////// // Function: GeomVertexData::bytewise_copy // Access: Private, Static diff --git a/panda/src/gobj/geomVertexData.h b/panda/src/gobj/geomVertexData.h index de1b3d23d1..08fbdcc4cc 100644 --- a/panda/src/gobj/geomVertexData.h +++ b/panda/src/gobj/geomVertexData.h @@ -182,6 +182,8 @@ public: static INLINE float unpack_ufloat_c(PN_uint32 data); private: + static void do_set_color(GeomVertexData *vdata, const LColor &color); + static void bytewise_copy(unsigned char *to, int to_stride, const unsigned char *from, int from_stride, const GeomVertexColumn *from_type, diff --git a/panda/src/gobj/lens.cxx b/panda/src/gobj/lens.cxx index c22174493c..b0e050a5e0 100644 --- a/panda/src/gobj/lens.cxx +++ b/panda/src/gobj/lens.cxx @@ -1817,12 +1817,13 @@ do_define_geom_data(CData *cdata) { if (!is_linear()) { num_segments = lens_geom_segments; } - + if (cdata->_geom_data == (GeomVertexData *)NULL) { cdata->_geom_data = new GeomVertexData ("lens", GeomVertexFormat::get_v3(), Geom::UH_dynamic); } + cdata->_geom_data->unclean_set_num_rows(num_segments * 8 + 2); GeomVertexWriter vertex(cdata->_geom_data, InternalName::get_vertex()); LPoint3 near_point, far_point; @@ -1835,8 +1836,8 @@ do_define_geom_data(CData *cdata) { // Hey, this point is off the lens! Can't do a frustum. return 0; } - vertex.add_data3(near_point); - vertex.add_data3(far_point); + vertex.set_data3(near_point); + vertex.set_data3(far_point); // Upper right, right edge. LPoint3 p2(1.0f, 1.0f - t, 0.0f); @@ -1844,8 +1845,8 @@ do_define_geom_data(CData *cdata) { // Hey, this point is off the lens! Can't do a frustum. return 0; } - vertex.add_data3(near_point); - vertex.add_data3(far_point); + vertex.set_data3(near_point); + vertex.set_data3(far_point); // Lower right, bottom edge. LPoint3 p3(1.0f - t, -1.0f, 0.0f); @@ -1853,8 +1854,8 @@ do_define_geom_data(CData *cdata) { // Hey, this point is off the lens! Can't do a frustum. return 0; } - vertex.add_data3(near_point); - vertex.add_data3(far_point); + vertex.set_data3(near_point); + vertex.set_data3(far_point); // Lower left, left edge. LPoint3 p4(-1.0f, -1.0f + t, 0.0f); @@ -1862,19 +1863,20 @@ do_define_geom_data(CData *cdata) { // Hey, this point is off the lens! Can't do a frustum. return 0; } - vertex.add_data3(near_point); - vertex.add_data3(far_point); + vertex.set_data3(near_point); + vertex.set_data3(far_point); } - // Finally, add one more pair for the viewing axis (or more - // specifically, the center of the lens). - LPoint3 pc(-cdata->_film_offset[0], -cdata->_film_offset[1], 0.0f); + + // Finally, add one more pair for the viewing axis (or more specifically, the + // center of the lens). + LPoint3 pc(0); if (!do_extrude(cdata, pc, near_point, far_point)) { - vertex.add_data3(0.0f, 0.0f, 0.0f); - vertex.add_data3(0.0f, 0.0f, 0.0f); + vertex.set_data3(0.0f, 0.0f, 0.0f); + vertex.set_data3(0.0f, 0.0f, 0.0f); } else { - vertex.add_data3(near_point); - vertex.add_data3(far_point); + vertex.set_data3(near_point); + vertex.set_data3(far_point); } return num_segments; diff --git a/panda/src/gobj/preparedGraphicsObjects.cxx b/panda/src/gobj/preparedGraphicsObjects.cxx index ee694450aa..075ee719fd 100644 --- a/panda/src/gobj/preparedGraphicsObjects.cxx +++ b/panda/src/gobj/preparedGraphicsObjects.cxx @@ -63,7 +63,9 @@ PreparedGraphicsObjects:: // There may be objects that are still prepared when we destruct. // If this is so, then all of the GSG's that own them have already // destructed, so we can assume their resources were internally - // cleaned up. Quietly erase these remaining objects. + // cleaned up. Besides, we may not even be allowed to call the + // GSG release methods since some APIs (eg. OpenGL) require a + // context current. So we just call the destructors. ReMutexHolder holder(_lock); release_all_textures(); @@ -72,18 +74,38 @@ PreparedGraphicsObjects:: tci != _released_textures.end(); ++tci) { TextureContext *tc = (*tci); - tc->set_owning_chain(NULL); + delete tc; } - // Is this a leak? Should we delete these TextureContexts? _released_textures.clear(); release_all_samplers(); + ReleasedSamplers::iterator ssci; + for (ssci = _released_samplers.begin(); + ssci != _released_samplers.end(); + ++ssci) { + SamplerContext *sc = (*ssci); + delete sc; + } _released_samplers.clear(); release_all_geoms(); + Geoms::iterator gci; + for (gci = _released_geoms.begin(); + gci != _released_geoms.end(); + ++gci) { + GeomContext *gc = (*gci); + delete gc; + } _released_geoms.clear(); release_all_shaders(); + Shaders::iterator sci; + for (sci = _released_shaders.begin(); + sci != _released_shaders.end(); + ++sci) { + ShaderContext *sc = (*sci); + delete sc; + } _released_shaders.clear(); release_all_vertex_buffers(); @@ -92,7 +114,7 @@ PreparedGraphicsObjects:: vbci != _released_vertex_buffers.end(); ++vbci) { VertexBufferContext *vbc = (VertexBufferContext *)(*vbci); - vbc->set_owning_chain(NULL); + delete vbc; } _released_vertex_buffers.clear(); @@ -102,7 +124,7 @@ PreparedGraphicsObjects:: ibci != _released_index_buffers.end(); ++ibci) { IndexBufferContext *ibc = (IndexBufferContext *)(*ibci); - ibc->set_owning_chain(NULL); + delete ibc; } _released_index_buffers.clear(); } diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index 7761312d2f..b6b39f54a4 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2041,10 +2041,10 @@ cg_compile_for(const ShaderCaps &caps, CGcontext context, combined_program = cgCombinePrograms(programs.size(), &programs[0]); // Build a parameter map. - int n_mat = (int)_mat_spec.size(); - int n_tex = (int)_tex_spec.size(); - int n_var = (int)_var_spec.size(); - int n_ptr = (int)_ptr_spec.size(); + size_t n_mat = _mat_spec.size(); + size_t n_tex = _tex_spec.size(); + size_t n_var = _var_spec.size(); + size_t n_ptr = _ptr_spec.size(); map.resize(n_mat + n_tex + n_var + n_ptr); @@ -2057,12 +2057,20 @@ cg_compile_for(const ShaderCaps &caps, CGcontext context, programs_by_type[cgGetProgramDomain(program)] = program; } - for (int i = 0; i < n_mat; ++i) { + for (size_t i = 0; i < n_mat; ++i) { const ShaderArgId &id = _mat_spec[i]._id; map[id._seqno] = cgGetNamedParameter(programs_by_type[id._type], id._name.c_str()); + + if (shader_cat.is_debug()) { + const char *resource = cgGetParameterResourceName(map[id._seqno]); + if (resource != NULL) { + shader_cat.debug() << "Uniform parameter " << id._name + << " is bound to resource " << resource << "\n"; + } + } } - for (int i = 0; i < n_tex; ++i) { + for (size_t i = 0; i < n_tex; ++i) { const ShaderArgId &id = _tex_spec[i]._id; CGparameter p = cgGetNamedParameter(programs_by_type[id._type], id._name.c_str()); @@ -2076,7 +2084,7 @@ cg_compile_for(const ShaderCaps &caps, CGcontext context, map[id._seqno] = p; } - for (int i = 0; i < n_var; ++i) { + for (size_t i = 0; i < n_var; ++i) { const ShaderArgId &id = _var_spec[i]._id; CGparameter p = cgGetNamedParameter(programs_by_type[id._type], id._name.c_str()); @@ -2097,9 +2105,17 @@ cg_compile_for(const ShaderCaps &caps, CGcontext context, map[id._seqno] = p; } - for (int i = 0; i < n_ptr; ++i) { + for (size_t i = 0; i < n_ptr; ++i) { const ShaderArgId &id = _ptr_spec[i]._id; map[id._seqno] = cgGetNamedParameter(programs_by_type[id._type], id._name.c_str()); + + if (shader_cat.is_debug()) { + const char *resource = cgGetParameterResourceName(map[id._seqno]); + if (resource != NULL) { + shader_cat.debug() << "Uniform ptr parameter " << id._name + << " is bound to resource " << resource << "\n"; + } + } } // Transfer ownership of the compiled shader. diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 5f54059fbb..b26c4ebca9 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -1552,10 +1552,12 @@ write(ostream &out, int indent_level) const { switch (cdata->_component_type) { case T_unsigned_byte: + case T_byte: out << " bytes"; break; case T_unsigned_short: + case T_short: out << " shorts"; break; @@ -2001,6 +2003,10 @@ format_component_type(ComponentType ct) { return "unsigned_int_24_8"; case T_int: return "int"; + case T_byte: + return "unsigned_byte"; + case T_short: + return "short"; } return "**invalid**"; @@ -2024,6 +2030,10 @@ string_component_type(const string &str) { return T_unsigned_int_24_8; } else if (cmp_nocase(str, "int") == 0) { return T_int; + } else if (cmp_nocase(str, "byte") == 0) { + return T_byte; + } else if (cmp_nocase(str, "short") == 0) { + return T_short; } gobj_cat->error() @@ -2411,6 +2421,19 @@ make_texture() { return new Texture; } +//////////////////////////////////////////////////////////////////// +// Function: Texture::is_unsigned +// Access: Public, Static +// Description: Returns true if the indicated component type is +// unsigned, false otherwise. +//////////////////////////////////////////////////////////////////// +bool Texture:: +is_unsigned(Texture::ComponentType ctype) { + return (ctype == T_unsigned_byte || + ctype == T_unsigned_short || + ctype == T_unsigned_int_24_8); +} + //////////////////////////////////////////////////////////////////// // Function: Texture::is_specific // Access: Public, Static @@ -4525,6 +4548,48 @@ do_get_clear_data(const CData *cdata, unsigned char *into) const { } break; } + + case T_byte: + { + LColor scaled = cdata->_clear_color.fmin(LColor(1)).fmax(LColor(-1)); + scaled *= 127; + switch (cdata->_num_components) { + case 2: + into[1] = (char)scaled[1]; + case 1: + into[0] = (char)scaled[0]; + break; + case 4: + into[3] = (char)scaled[3]; + case 3: // BGR <-> RGB + into[0] = (char)scaled[2]; + into[1] = (char)scaled[1]; + into[2] = (char)scaled[0]; + break; + } + break; + } + + case T_short: + { + LColor scaled = cdata->_clear_color.fmin(LColor(1)).fmax(LColor(-1)); + scaled *= 32767; + switch (cdata->_num_components) { + case 2: + ((short *)into)[1] = (short)scaled[1]; + case 1: + ((short *)into)[0] = (short)scaled[0]; + break; + case 4: + ((short *)into)[3] = (short)scaled[3]; + case 3: // BGR <-> RGB + ((short *)into)[0] = (short)scaled[2]; + ((short *)into)[1] = (short)scaled[1]; + ((short *)into)[2] = (short)scaled[0]; + break; + } + break; + } } return cdata->_num_components * cdata->_component_width; @@ -5222,10 +5287,12 @@ do_set_component_type(CData *cdata, Texture::ComponentType component_type) { switch (component_type) { case T_unsigned_byte: + case T_byte: cdata->_component_width = 1; break; case T_unsigned_short: + case T_short: cdata->_component_width = 2; break; diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index fff5770693..3ab9d33f02 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -93,6 +93,8 @@ PUBLISHED: T_float, T_unsigned_int_24_8, // Packed T_int, + T_byte, + T_short, }; enum Format { @@ -527,6 +529,7 @@ public: static PT(Texture) make_texture(); public: + static bool is_unsigned(ComponentType ctype); static bool is_specific(CompressionMode compression); static bool has_alpha(Format format); static bool has_binary_alpha(Format format); diff --git a/panda/src/grutil/Sources.pp b/panda/src/grutil/Sources.pp deleted file mode 100644 index 509409b9e1..0000000000 --- a/panda/src/grutil/Sources.pp +++ /dev/null @@ -1,65 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3grutil - #define LOCAL_LIBS \ - p3display p3text p3pgraph p3gobj p3linmath p3putil p3movies p3audio - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - pipeOcclusionCullTraverser.I pipeOcclusionCullTraverser.h \ - cardMaker.I cardMaker.h \ - config_grutil.h \ - movieTexture.I movieTexture.h \ - fisheyeMaker.I fisheyeMaker.h \ - frameRateMeter.I frameRateMeter.h \ - meshDrawer.I meshDrawer.h \ - meshDrawer2D.I meshDrawer2D.h \ - geoMipTerrain.I geoMipTerrain.h \ - sceneGraphAnalyzerMeter.I sceneGraphAnalyzerMeter.h \ - heightfieldTesselator.I heightfieldTesselator.h \ - lineSegs.I lineSegs.h \ - multitexReducer.I multitexReducer.h multitexReducer.cxx \ - nodeVertexTransform.I nodeVertexTransform.h \ - pfmVizzer.I pfmVizzer.h \ - rigidBodyCombiner.I rigidBodyCombiner.h - - #define INCLUDED_SOURCES \ - cardMaker.cxx \ - movieTexture.cxx \ - fisheyeMaker.cxx \ - config_grutil.cxx \ - frameRateMeter.cxx \ - meshDrawer.cxx \ - meshDrawer2D.cxx \ - geoMipTerrain.cxx \ - sceneGraphAnalyzerMeter.cxx \ - heightfieldTesselator.cxx \ - nodeVertexTransform.cxx \ - pfmVizzer.cxx \ - pipeOcclusionCullTraverser.cxx \ - lineSegs.cxx \ - rigidBodyCombiner.cxx - - #define INSTALL_HEADERS \ - cardMaker.I cardMaker.h \ - movieTexture.I movieTexture.h \ - fisheyeMaker.I fisheyeMaker.h \ - frameRateMeter.I frameRateMeter.h \ - meshDrawer.I meshDrawer.h \ - meshDrawer2D.I meshDrawer2D.h \ - geoMipTerrain.I geoMipTerrain.h \ - sceneGraphAnalyzerMeter.I sceneGraphAnalyzerMeter.h \ - heightfieldTesselator.I heightfieldTesselator.h \ - lineSegs.I lineSegs.h \ - multitexReducer.I multitexReducer.h \ - nodeVertexTransform.I nodeVertexTransform.h \ - pfmVizzer.I pfmVizzer.h \ - rigidBodyCombiner.I rigidBodyCombiner.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/gsgbase/Sources.pp b/panda/src/gsgbase/Sources.pp deleted file mode 100644 index ffdb5592d3..0000000000 --- a/panda/src/gsgbase/Sources.pp +++ /dev/null @@ -1,41 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3gsgbase - #define LOCAL_LIBS \ - p3putil p3linmath - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_gsgbase.h \ - displayRegionBase.I displayRegionBase.h \ - graphicsOutputBase.I graphicsOutputBase.h \ - graphicsStateGuardianBase.h - - #define INCLUDED_SOURCES \ - config_gsgbase.cxx \ - displayRegionBase.cxx \ - graphicsOutputBase.cxx \ - graphicsStateGuardianBase.cxx - - #define INSTALL_HEADERS \ - displayRegionBase.I displayRegionBase.h \ - graphicsOutputBase.I graphicsOutputBase.h \ - graphicsStateGuardianBase.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_gsgbase - #define LOCAL_LIBS \ - p3gsgbase - - #define SOURCES \ - test_gsgbase.cxx - -#end test_bin_target - diff --git a/panda/src/iphone/Sources.pp b/panda/src/iphone/Sources.pp deleted file mode 100644 index 5c79142a94..0000000000 --- a/panda/src/iphone/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -#define BUILD_DIRECTORY $[BUILD_IPHONE] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define OSX_SYS_FRAMEWORKS Foundation QuartzCore UIKit OpenGLES - -#begin bin_target - #define TARGET iphone_pview - - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - #define LOCAL_LIBS \ - p3iphonedisplay \ - p3framework p3putil p3collide p3pgraph p3chan p3text \ - p3pnmimage p3pnmimagetypes p3event p3gobj p3display \ - p3mathutil p3putil p3express p3dgraph p3device p3tform \ - p3linmath p3pstatclient panda p3glstuff - - #define SOURCES \ - pview_delegate.h pview_delegate.mm \ - pview_main.mm - -#end bin_target diff --git a/panda/src/iphonedisplay/Sources.pp b/panda/src/iphonedisplay/Sources.pp deleted file mode 100644 index e3561e099e..0000000000 --- a/panda/src/iphonedisplay/Sources.pp +++ /dev/null @@ -1,32 +0,0 @@ -#define BUILD_DIRECTORY $[BUILD_IPHONE] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define OSX_SYS_FRAMEWORKS Foundation QuartzCore UIKit OpenGLES - -#begin lib_target - #define TARGET p3iphonedisplay - - #define LOCAL_LIBS \ - p3framework p3putil p3collide p3pgraph p3chan p3text \ - p3pnmimage p3pnmimagetypes p3event p3gobj p3display \ - p3mathutil p3putil p3express p3dgraph p3device p3tform \ - p3linmath p3pstatclient panda p3glstuff p3glesgsg - - #define SOURCES \ - config_iphonedisplay.h config_iphonedisplay.mm \ - viewController.h viewController.mm \ - eaglView.h eaglView.mm \ - iPhoneGraphicsPipe.h iPhoneGraphicsPipe.mm \ - iPhoneGraphicsStateGuardian.h iPhoneGraphicsStateGuardian.mm \ - iPhoneGraphicsWindow.h iPhoneGraphicsWindow.I iPhoneGraphicsWindow.mm - - #define INSTALL_HEADERS \ - config_iphonedisplay.h \ - viewController.h \ - iPhoneGraphicsPipe.h \ - iPhoneGraphicsStateGuardian.h \ - iPhoneGraphicsWindow.h iPhoneGraphicsWindow.I - -#end lib_target diff --git a/panda/src/linmath/Sources.pp b/panda/src/linmath/Sources.pp deleted file mode 100644 index 286d812509..0000000000 --- a/panda/src/linmath/Sources.pp +++ /dev/null @@ -1,80 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3linmath - #define LOCAL_LIBS \ - p3express p3pandabase - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - aa_luse.h \ - compose_matrix.h compose_matrix_src.I \ - config_linmath.h \ - configVariableColor.h configVariableColor.I \ - coordinateSystem.h dbl2fltnames.h dblnames.h \ - deg_2_rad.h deg_2_rad.I \ - flt2dblnames.h fltnames.h intnames.h lcast_to.h \ - lmatrix.h lmatrix_ext.h lorientation.h \ - lpoint2.h lpoint3.h lpoint4.h \ - lquaternion.h lrotation.h \ - lsimpleMatrix.h lsimpleMatrix.I \ - luse.I luse.N luse.h \ - lvec2_ops.h lvec3_ops.h lvec4_ops.h \ - lvecBase2.h lvecBase3.h lvecBase4.h \ - lvector2.h lvector3.h lvector4.h \ - lvecBase2_ext.h lvecBase3_ext.h lvecBase4_ext.h \ - lpoint2_ext.h lpoint3_ext.h lpoint4_ext.h \ - lvector2_ext.h lvector3_ext.h lvector4_ext.h \ - mathNumbers.h mathNumbers.I - - #define INCLUDED_SOURCES \ - compose_matrix.cxx config_linmath.cxx configVariableColor.cxx \ - coordinateSystem.cxx lmatrix.cxx \ - lorientation.cxx lpoint2.cxx \ - lpoint3.cxx lpoint4.cxx lquaternion.cxx lrotation.cxx \ - luse.cxx lvecBase2.cxx lvecBase3.cxx lvecBase4.cxx \ - lvector2.cxx lvector3.cxx lvector4.cxx mathNumbers.cxx - - #define INSTALL_HEADERS \ - aa_luse.h \ - compose_matrix.h compose_matrix_src.I \ - compose_matrix_src.h config_linmath.h \ - configVariableColor.h configVariableColor.I \ - coordinateSystem.h \ - dbl2fltnames.h dblnames.h \ - deg_2_rad.h deg_2_rad.I \ - flt2dblnames.h fltnames.h intnames.h lcast_to.h lcast_to_src.I lcast_to_src.h \ - lmat_ops.h lmat_ops_src.I lmat_ops_src.h lmatrix.h \ - lmatrix3_src.I lmatrix3_src.h lmatrix4_src.I \ - lmatrix4_src.h lorientation.h lorientation_src.I \ - lorientation_src.h lpoint2.h lpoint2_src.I lpoint2_src.h lpoint3.h \ - lpoint3_src.I lpoint3_src.h lpoint4.h lpoint4_src.I lpoint4_src.h \ - lquaternion.h lquaternion_src.I lquaternion_src.h lrotation.h \ - lrotation_src.I lrotation_src.h \ - lsimpleMatrix.I lsimpleMatrix.h \ - luse.I luse.h lvec2_ops.h \ - lvec2_ops_src.I lvec2_ops_src.h lvec3_ops.h lvec3_ops_src.I \ - lvec3_ops_src.h lvec4_ops.h lvec4_ops_src.I lvec4_ops_src.h \ - lvecBase2.h lvecBase2_src.I lvecBase2_src.h lvecBase3.h \ - lvecBase3_src.I lvecBase3_src.h lvecBase4.h lvecBase4_src.I \ - lvecBase4_src.h lvector2.h lvector2_src.I lvector2_src.h \ - lvector3.h lvector3_src.I lvector3_src.h lvector4.h lvector4_src.I \ - lvector4_src.h mathNumbers.h mathNumbers.I - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_math - #define LOCAL_LIBS \ - p3linmath - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_math.cxx - -#end test_bin_target - diff --git a/panda/src/linmath/lmatrix3_src.h b/panda/src/linmath/lmatrix3_src.h index 8bcae35c6c..934cd5e53c 100644 --- a/panda/src/linmath/lmatrix3_src.h +++ b/panda/src/linmath/lmatrix3_src.h @@ -76,6 +76,10 @@ PUBLISHED: FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22); + INLINE_LINMATH CRow operator [](int i) const; + INLINE_LINMATH Row operator [](int i); + INLINE_LINMATH static int size(); + INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase3) &v); INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase3) &v); @@ -99,10 +103,6 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE &operator () (int row, int col); INLINE_LINMATH FLOATTYPE operator () (int row, int col) const; - INLINE_LINMATH CRow operator [](int i) const; - INLINE_LINMATH Row operator [](int i); - INLINE_LINMATH static int size(); - INLINE_LINMATH bool is_nan() const; INLINE_LINMATH bool is_identity() const; diff --git a/panda/src/linmath/lmatrix4_src.h b/panda/src/linmath/lmatrix4_src.h index 14fe9fe869..61a0d45018 100644 --- a/panda/src/linmath/lmatrix4_src.h +++ b/panda/src/linmath/lmatrix4_src.h @@ -85,6 +85,10 @@ PUBLISHED: INLINE_LINMATH void set_upper_3(const FLOATNAME(LMatrix3) &upper3); INLINE_LINMATH FLOATNAME(LMatrix3) get_upper_3() const; + INLINE_LINMATH CRow operator [](int i) const; + INLINE_LINMATH Row operator [](int i); + INLINE_LINMATH static int size(); + INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase4) &v); INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase4) &v); @@ -107,10 +111,6 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE &operator () (int row, int col); INLINE_LINMATH FLOATTYPE operator () (int row, int col) const; - INLINE_LINMATH CRow operator [](int i) const; - INLINE_LINMATH Row operator [](int i); - INLINE_LINMATH static int size(); - INLINE_LINMATH bool is_nan() const; INLINE_LINMATH bool is_identity() const; diff --git a/panda/src/mathutil/Sources.pp b/panda/src/mathutil/Sources.pp deleted file mode 100644 index 4a1b4de454..0000000000 --- a/panda/src/mathutil/Sources.pp +++ /dev/null @@ -1,128 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3mathutil - #define LOCAL_LIBS \ - p3linmath p3putil p3event p3express - #define USE_PACKAGES fftw - #define UNIX_SYS_LIBS m - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - boundingHexahedron.I boundingHexahedron.h boundingLine.I \ - boundingLine.h \ - boundingBox.I boundingBox.h \ - boundingPlane.I boundingPlane.h \ - boundingSphere.I boundingSphere.h \ - boundingVolume.I boundingVolume.h config_mathutil.h \ - fftCompressor.h finiteBoundingVolume.h frustum.h \ - geometricBoundingVolume.I geometricBoundingVolume.h \ - intersectionBoundingVolume.h intersectionBoundingVolume.I \ - linmath_events.h \ - look_at.h \ - linmath_events.h \ - mersenne.h \ - omniBoundingVolume.I \ - omniBoundingVolume.h \ - parabola.h \ - perlinNoise.h perlinNoise.I \ - perlinNoise2.h perlinNoise2.I \ - perlinNoise3.h perlinNoise3.I \ - plane.h \ - pta_LMatrix4.h pta_LMatrix3.h pta_LVecBase3.h \ - pta_LVecBase4.h pta_LVecBase2.h \ - randomizer.h randomizer.I \ - rotate_to.h \ - stackedPerlinNoise2.h stackedPerlinNoise2.I \ - stackedPerlinNoise3.h stackedPerlinNoise3.I \ - triangulator.h triangulator.I \ - triangulator3.h triangulator3.I \ - unionBoundingVolume.h unionBoundingVolume.I - - #define INCLUDED_SOURCES \ - boundingHexahedron.cxx boundingLine.cxx \ - boundingBox.cxx \ - boundingPlane.cxx \ - boundingSphere.cxx \ - boundingVolume.cxx config_mathutil.cxx fftCompressor.cxx \ - finiteBoundingVolume.cxx geometricBoundingVolume.cxx \ - intersectionBoundingVolume.cxx \ - look_at.cxx \ - linmath_events.cxx \ - mersenne.cxx \ - omniBoundingVolume.cxx \ - parabola.cxx \ - perlinNoise.cxx \ - perlinNoise2.cxx \ - perlinNoise3.cxx \ - plane.cxx \ - pta_LMatrix4.cxx pta_LMatrix3.cxx pta_LVecBase3.cxx \ - pta_LVecBase4.cxx pta_LVecBase2.cxx \ - randomizer.cxx \ - rotate_to.cxx \ - stackedPerlinNoise2.cxx \ - stackedPerlinNoise3.cxx \ - triangulator.cxx \ - triangulator3.cxx \ - unionBoundingVolume.cxx - - #define INSTALL_HEADERS \ - boundingHexahedron.I boundingHexahedron.h boundingLine.I \ - boundingLine.h \ - boundingBox.I boundingBox.h \ - boundingPlane.I boundingPlane.h \ - boundingSphere.I boundingSphere.h boundingVolume.I \ - boundingVolume.h config_mathutil.h fftCompressor.h \ - pta_LMatrix4.h pta_LMatrix3.h pta_LVecBase3.h \ - pta_LVecBase4.h pta_LVecBase2.h \ - finiteBoundingVolume.h frustum.h frustum_src.I frustum_src.h \ - geometricBoundingVolume.I geometricBoundingVolume.h look_at.h \ - intersectionBoundingVolume.h intersectionBoundingVolume.I \ - look_at_src.I look_at_src.h \ - linmath_events.h \ - mersenne.h \ - omniBoundingVolume.I omniBoundingVolume.h \ - parabola.h parabola_src.I parabola_src.cxx parabola_src.h \ - perlinNoise.h perlinNoise.I \ - perlinNoise2.h perlinNoise2.I \ - perlinNoise3.h perlinNoise3.I \ - plane.h plane_src.I plane_src.cxx plane_src.h \ - randomizer.h randomizer.I \ - rotate_to.h rotate_to_src.cxx \ - stackedPerlinNoise2.h stackedPerlinNoise2.I \ - stackedPerlinNoise3.h stackedPerlinNoise3.I \ - triangulator.h triangulator.I \ - triangulator3.h triangulator3.I \ - unionBoundingVolume.h unionBoundingVolume.I - - - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_mathutil - #define LOCAL_LIBS \ - p3mathutil p3pipeline - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_mathutil.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_tri - #define LOCAL_LIBS \ - p3mathutil p3pipeline - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_tri.cxx - -#end test_bin_target - diff --git a/panda/src/movies/Sources.pp b/panda/src/movies/Sources.pp deleted file mode 100644 index f4a2757e0a..0000000000 --- a/panda/src/movies/Sources.pp +++ /dev/null @@ -1,67 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - - -#begin lib_target - #define TARGET p3movies - #define LOCAL_LIBS p3gobj - - #define USE_PACKAGES dx9 vorbis - #define WIN_SYS_LIBS $[WIN_SYS_LIBS] strmiids.lib winmm.lib - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx - - #define SOURCES \ - config_movies.h \ - inkblotVideo.h inkblotVideo.I \ - inkblotVideoCursor.h inkblotVideoCursor.I \ - microphoneAudio.h microphoneAudio.I \ - movieAudio.h movieAudio.I \ - movieAudioCursor.h movieAudioCursor.I \ - movieTypeRegistry.h movieTypeRegistry.I \ - movieVideo.h movieVideo.I \ - movieVideoCursor.h movieVideoCursor.I \ - userDataAudio.h userDataAudio.I \ - userDataAudioCursor.h userDataAudioCursor.I \ - vorbisAudio.h vorbisAudio.I \ - vorbisAudioCursor.h vorbisAudioCursor.I \ - wavAudio.h wavAudio.I \ - wavAudioCursor.h wavAudioCursor.I - - #define INCLUDED_SOURCES \ - config_movies.cxx \ - inkblotVideo.cxx \ - inkblotVideoCursor.cxx \ - microphoneAudio.cxx \ - microphoneAudioDS.cxx \ - movieAudio.cxx \ - movieAudioCursor.cxx \ - movieTypeRegistry.cxx \ - movieVideo.cxx \ - movieVideoCursor.cxx \ - userDataAudio.cxx \ - userDataAudioCursor.cxx \ - vorbisAudio.cxx \ - vorbisAudioCursor.cxx \ - wavAudio.cxx \ - wavAudioCursor.cxx - - #define INSTALL_HEADERS \ - config_movies.h \ - inkblotVideo.h inkblotVideo.I \ - inkblotVideoCursor.h inkblotVideoCursor.I \ - microphoneAudio.h microphoneAudio.I \ - movieAudio.h movieAudio.I \ - movieAudioCursor.h movieAudioCursor.I \ - movieTypeRegistry.h movieTypeRegistry.I \ - movieVideo.h movieVideo.I \ - movieVideoCursor.h movieVideoCursor.I \ - vorbisAudio.h vorbisAudio.I \ - vorbisAudioCursor.h vorbisAudioCursor.I \ - wavAudio.h wavAudio.I \ - wavAudioCursor.h wavAudioCursor.I - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/nativenet/Sources.pp b/panda/src/nativenet/Sources.pp deleted file mode 100644 index 99515889c8..0000000000 --- a/panda/src/nativenet/Sources.pp +++ /dev/null @@ -1,57 +0,0 @@ -#define LOCAL_LIBS p3express p3pandabase - -#define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dtool:m - -#define BUILD_DIRECTORY $[WANT_NATIVE_NET] -#define USE_PACKAGES native_net openssl - -#begin lib_target - #define TARGET p3nativenet - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - buffered_datagramconnection.h \ - buffered_datagramreader.h buffered_datagramreader.i \ - ringbuffer.h ringbuffer.i socket_ip.h \ - socket_tcp_listen.h time_accumulator.h time_out.h \ - socket_address.I socket_address.h \ - socket_portable.h time_base.h time_span.h buffered_datagramwriter.h \ - socket_base.h socket_selector.h \ - socket_udp.h \ - socket_udp_incoming.h time_clock.h \ - membuffer.h membuffer.i socket_fdset.h socket_tcp.h \ - socket_udp_outgoing.h time_general.h - - #define INCLUDED_SOURCES \ - config_nativenet.cxx \ - buffered_datagramconnection.cxx \ - socket_ip.cxx \ - socket_tcp.cxx \ - socket_tcp_listen.cxx \ - socket_tcp_ssl.cxx \ - socket_udp.cxx \ - socket_udp_incoming.cxx \ - socket_udp_outgoing.cxx - - #define INSTALL_HEADERS \ - buffered_datagramconnection.h \ - config_nativenet.h \ - ringbuffer.h ringbuffer.i socket_ip.h socket_tcp_listen.h \ - time_accumulator.h time_out.h \ - buffered_datagramreader.h buffered_datagramreader.i \ - socket_address.I socket_address.h \ - socket_portable.h time_base.h time_span.h buffered_datagramwriter.h \ - socket_base.h socket_selector.h \ - socket_udp.h \ - socket_udp_incoming.h time_clock.h \ - membuffer.h membuffer.i socket_fdset.h socket_tcp.h \ - socket_udp_outgoing.h time_general.h - - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/net/Sources.pp b/panda/src/net/Sources.pp deleted file mode 100644 index b047315270..0000000000 --- a/panda/src/net/Sources.pp +++ /dev/null @@ -1,138 +0,0 @@ -#define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dtool:m -#define WIN_SYS_LIBS Iphlpapi.lib - -#define BUILD_DIRECTORY $[and $[HAVE_NET],$[WANT_NATIVE_NET]] -#define USE_PACKAGES net - -#begin lib_target - #define TARGET p3net - #define LOCAL_LIBS \ - p3express p3downloader p3pandabase p3nativenet p3pipeline - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_net.h connection.h connectionListener.h \ - connectionManager.N connectionManager.h \ - connectionReader.I connectionReader.h \ - connectionWriter.h datagramQueue.h \ - datagramTCPHeader.I datagramTCPHeader.h \ - datagramUDPHeader.I datagramUDPHeader.h \ - netAddress.h netDatagram.I netDatagram.h \ - datagramGeneratorNet.I datagramGeneratorNet.h \ - datagramSinkNet.I datagramSinkNet.h \ - queuedConnectionListener.I \ - queuedConnectionListener.h queuedConnectionManager.h \ - queuedConnectionReader.h recentConnectionReader.h \ - queuedReturn.h queuedReturn.I - - #define INCLUDED_SOURCES \ - config_net.cxx connection.cxx connectionListener.cxx \ - connectionManager.cxx connectionReader.cxx \ - connectionWriter.cxx datagramQueue.cxx datagramTCPHeader.cxx \ - datagramUDPHeader.cxx netAddress.cxx netDatagram.cxx \ - datagramGeneratorNet.cxx \ - datagramSinkNet.cxx \ - queuedConnectionListener.cxx \ - queuedConnectionManager.cxx queuedConnectionReader.cxx \ - recentConnectionReader.cxx - - #define INSTALL_HEADERS \ - config_net.h connection.h connectionListener.h connectionManager.h \ - connectionReader.I connectionReader.h \ - connectionWriter.h datagramQueue.h \ - datagramTCPHeader.I datagramTCPHeader.h \ - datagramUDPHeader.I datagramUDPHeader.h \ - netAddress.h netDatagram.I \ - netDatagram.h queuedConnectionListener.I \ - datagramGeneratorNet.I datagramGeneratorNet.h \ - datagramSinkNet.I datagramSinkNet.h \ - queuedConnectionListener.h queuedConnectionManager.h \ - queuedConnectionReader.h queuedReturn.I queuedReturn.h \ - recentConnectionReader.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_datagram - #define LOCAL_LIBS p3net - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_datagram.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_spam_client - #define LOCAL_LIBS p3net p3putil - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - datagram_ui.cxx datagram_ui.h test_spam_client.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_spam_server - #define LOCAL_LIBS p3net p3putil - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - datagram_ui.cxx datagram_ui.h test_spam_server.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_tcp_client - #define LOCAL_LIBS p3net - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - datagram_ui.cxx datagram_ui.h test_tcp_client.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_tcp_server - #define LOCAL_LIBS p3net - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - datagram_ui.cxx datagram_ui.h test_tcp_server.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_raw_server - #define LOCAL_LIBS p3net - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - test_raw_server.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_udp - #define LOCAL_LIBS p3net - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - datagram_ui.cxx datagram_ui.h test_udp.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET fake_http_server - #define LOCAL_LIBS p3net - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - fake_http_server.cxx - -#end test_bin_target diff --git a/panda/src/ode/Sources.pp b/panda/src/ode/Sources.pp deleted file mode 100644 index 6d1393f815..0000000000 --- a/panda/src/ode/Sources.pp +++ /dev/null @@ -1,125 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_ODE] -#define BUILDING_DLL BUILDING_PANDAODE - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3ode - #define LOCAL_LIBS \ - p3pgraph p3physics - - #define USE_PACKAGES ode - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx \ - $[TARGET]_composite2.cxx $[TARGET]_composite3.cxx \ - $[TARGET]_ext_composite.cxx - - #define SOURCES \ - ode_includes.h config_ode.h \ - odeWorld.I odeWorld.h \ - odeMass.I odeMass.h \ - odeBody.I odeBody.h odeBody_ext.h \ - odeJointGroup.I odeJointGroup.h \ - odeJoint.I odeJoint.h odeJoint_ext.h \ - odeUtil.h odeUtil_ext.h \ - odeSpace.I odeSpace.h \ - odeSpace_ext.I odeSpace_ext.h \ - odeGeom.I odeGeom.h \ - odeGeom_ext.I odeGeom_ext.h \ - odeSurfaceParameters.I odeSurfaceParameters.h \ - odeContactGeom.I odeContactGeom.h \ - odeContact.I odeContact.h \ - odeAMotorJoint.I odeAMotorJoint.h \ - odeBallJoint.I odeBallJoint.h \ - odeContactJoint.I odeContactJoint.h \ - odeFixedJoint.I odeFixedJoint.h \ - odeHingeJoint.I odeHingeJoint.h \ - odeHinge2Joint.I odeHinge2Joint.h \ - odeLMotorJoint.I odeLMotorJoint.h \ - odeNullJoint.I odeNullJoint.h \ - odePlane2dJoint.I odePlane2dJoint.h \ - odeSliderJoint.I odeSliderJoint.h \ - odeUniversalJoint.I odeUniversalJoint.h \ - odeJointCollection.I odeJointCollection.h \ - odeSimpleSpace.I odeSimpleSpace.h \ - odeHashSpace.I odeHashSpace.h \ - odeQuadTreeSpace.I odeQuadTreeSpace.h \ - odeSphereGeom.I odeSphereGeom.h \ - odeBoxGeom.I odeBoxGeom.h \ - odePlaneGeom.I odePlaneGeom.h \ - odeCappedCylinderGeom.I odeCappedCylinderGeom.h \ - odeCylinderGeom.I odeCylinderGeom.h \ - odeRayGeom.I odeRayGeom.h \ - odeTriMeshData.I odeTriMeshData.h \ - odeTriMeshGeom.I odeTriMeshGeom.h \ - odeCollisionEntry.I odeCollisionEntry.h \ - odeHelperStructs.h - - #define INCLUDED_SOURCES \ - config_ode.cxx \ - odeWorld.cxx odeMass.cxx \ - odeBody.cxx odeBody_ext.cxx \ - odeJointGroup.cxx \ - odeJoint.cxx odeJoint_ext.cxx \ - odeUtil.cxx odeUtil_ext.cxx \ - odeSpace.cxx odeSpace_ext.cxx \ - odeGeom.cxx odeGeom_ext.cxx \ - odeSurfaceParameters.cxx \ - odeContactGeom.cxx odeContact.cxx \ - odeAMotorJoint.cxx odeBallJoint.cxx \ - odeContactJoint.cxx odeFixedJoint.cxx \ - odeHingeJoint.cxx odeHinge2Joint.cxx \ - odeLMotorJoint.cxx odeNullJoint.cxx \ - odePlane2dJoint.cxx odeSliderJoint.cxx \ - odeUniversalJoint.cxx odeJointCollection.cxx\ - odeSimpleSpace.cxx \ - odeHashSpace.cxx odeQuadTreeSpace.cxx \ - odeSphereGeom.cxx odeBoxGeom.cxx \ - odePlaneGeom.cxx odeCappedCylinderGeom.cxx \ - odeCylinderGeom.cxx odeRayGeom.cxx \ - odeTriMeshData.cxx odeTriMeshGeom.cxx \ - odeCollisionEntry.cxx - - - #define INSTALL_HEADERS \ - ode_includes.h config_ode.h \ - odeWorld.I odeWorld.h \ - odeMass.I odeMass.h \ - odeBody.I odeBody.h \ - odeJointGroup.I odeJointGroup.h \ - odeJoint.I odeJoint.h \ - odeUtil.h \ - odeSpace.I odeSpace.h \ - odeGeom.I odeGeom.h \ - odeSurfaceParameters.I odeSurfaceParameters.h \ - odeContactGeom.I odeContactGeom.h \ - odeContact.I odeContact.h \ - odeAMotorJoint.I odeAMotorJoint.h \ - odeBallJoint.I odeBallJoint.h \ - odeContactJoint.I odeContactJoint.h \ - odeFixedJoint.I odeFixedJoint.h \ - odeHingeJoint.I odeHingeJoint.h \ - odeHinge2Joint.I odeHinge2Joint.h \ - odeLMotorJoint.I odeLMotorJoint.h \ - odeNullJoint.I odeNullJoint.h \ - odePlane2dJoint.I odePlane2dJoint.h \ - odeSliderJoint.I odeSliderJoint.h \ - odeUniversalJoint.I odeUniversalJoint.h \ - odeJointCollection.I odeJointCollection.h \ - odeSimpleSpace.I odeSimpleSpace.h \ - odeHashSpace.I odeHashSpace.h \ - odeQuadTreeSpace.I odeQuadTreeSpace.h \ - odeSphereGeom.I odeSphereGeom.h \ - odeBoxGeom.I odeBoxGeom.h \ - odePlaneGeom.I odePlaneGeom.h \ - odeCappedCylinderGeom.I odeCappedCylinderGeom.h \ - odeCylinderGeom.I odeCylinderGeom.h \ - odeRayGeom.I odeRayGeom.h \ - odeTriMeshData.I odeTriMeshData.h \ - odeTriMeshGeom.I odeTriMeshGeom.h \ - odeCollisionEntry.I odeCollisionEntry.h - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/osxdisplay/Sources.pp b/panda/src/osxdisplay/Sources.pp deleted file mode 100644 index f693f17b09..0000000000 --- a/panda/src/osxdisplay/Sources.pp +++ /dev/null @@ -1,28 +0,0 @@ -#define BUILD_DIRECTORY $[and $[IS_OSX],$[HAVE_GL],$[HAVE_CARBON]] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define OSX_SYS_FRAMEWORKS ApplicationServices Carbon AGL CoreServices Cocoa -#define USE_PACKAGES gl cggl - -#begin lib_target - #define TARGET p3osxdisplay - #define LOCAL_LIBS \ - p3display p3putil p3glgsg - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define INSTALL_HEADERS \ - config_osxdisplay.h \ - osxGraphicsPipe.h \ - osxGraphicsWindow.h osxGraphicsWindow.I \ - osxGraphicsStateGuardian.h - - #define INCLUDED_SOURCES \ - config_osxdisplay.cxx osxGraphicsPipe.cxx osxGraphicsStateGuardian.cxx osxGraphicsBuffer.cxx - - #define SOURCES \ - $[INSTALL_HEADERS] osxGraphicsWindow.mm - -#end lib_target diff --git a/panda/src/pandabase/Sources.pp b/panda/src/pandabase/Sources.pp deleted file mode 100644 index b81651e970..0000000000 --- a/panda/src/pandabase/Sources.pp +++ /dev/null @@ -1,13 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3pandabase - - #define SOURCES \ - pandabase.cxx pandabase.h pandasymbols.h \ - - #define INSTALL_HEADERS \ - pandabase.h pandasymbols.h - -#end lib_target diff --git a/panda/src/parametrics/Sources.pp b/panda/src/parametrics/Sources.pp deleted file mode 100644 index 5ddbb707af..0000000000 --- a/panda/src/parametrics/Sources.pp +++ /dev/null @@ -1,77 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3parametrics - #define LOCAL_LIBS \ - p3pgraph p3linmath p3express p3putil p3pandabase - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_parametrics.h \ - cubicCurveseg.h curveFitter.I curveFitter.h \ - hermiteCurve.h \ - nurbsCurve.I nurbsCurve.h \ - nurbsCurveEvaluator.I nurbsCurveEvaluator.h \ - nurbsCurveInterface.I nurbsCurveInterface.h \ - nurbsCurveResult.I nurbsCurveResult.h \ - nurbsBasisVector.I nurbsBasisVector.h \ - nurbsSurfaceEvaluator.I nurbsSurfaceEvaluator.h \ - nurbsSurfaceResult.I nurbsSurfaceResult.h \ - nurbsVertex.h nurbsVertex.I \ - parametricCurve.h \ - parametricCurveCollection.I parametricCurveCollection.h \ - piecewiseCurve.h \ - ropeNode.I ropeNode.h \ - sheetNode.I sheetNode.h - - #define INCLUDED_SOURCES \ - config_parametrics.cxx cubicCurveseg.cxx \ - curveFitter.cxx hermiteCurve.cxx \ - nurbsCurve.cxx \ - nurbsCurveEvaluator.cxx \ - nurbsCurveInterface.cxx \ - nurbsCurveResult.cxx \ - nurbsBasisVector.cxx \ - nurbsSurfaceEvaluator.cxx \ - nurbsSurfaceResult.cxx \ - nurbsVertex.cxx \ - parametricCurve.cxx parametricCurveCollection.cxx \ - piecewiseCurve.cxx \ - ropeNode.cxx \ - sheetNode.cxx - - #define INSTALL_HEADERS \ - config_parametrics.h \ - cubicCurveseg.h \ - curveFitter.I curveFitter.h \ - hermiteCurve.h \ - nurbsCurve.I nurbsCurve.h \ - nurbsCurveEvaluator.I nurbsCurveEvaluator.h \ - nurbsCurveInterface.I nurbsCurveInterface.h \ - nurbsCurveResult.I nurbsCurveResult.h \ - nurbsBasisVector.I nurbsBasisVector.h \ - nurbsSurfaceEvaluator.I nurbsSurfaceEvaluator.h \ - nurbsSurfaceResult.I nurbsSurfaceResult.h \ - nurbsVertex.h nurbsVertex.I \ - parametricCurve.h \ - parametricCurveCollection.I parametricCurveCollection.h \ - piecewiseCurve.h \ - ropeNode.I ropeNode.h \ - sheetNode.I sheetNode.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_parametrics - #define LOCAL_LIBS \ - p3parametrics - - #define SOURCES \ - test_parametrics.cxx - -#end test_bin_target - diff --git a/panda/src/parametrics/nurbsCurveResult.h b/panda/src/parametrics/nurbsCurveResult.h index 269ce6ba40..bbd890dd12 100644 --- a/panda/src/parametrics/nurbsCurveResult.h +++ b/panda/src/parametrics/nurbsCurveResult.h @@ -67,7 +67,7 @@ PUBLISHED: INLINE PN_stdfloat get_sample_t(int n) const; INLINE const LPoint3 &get_sample_point(int n) const; MAKE_SEQ(get_sample_ts, get_num_samples, get_sample_t); - MAKE_SEQ(get_sample_points, get_num_samples, get_sample_points); + MAKE_SEQ(get_sample_points, get_num_samples, get_sample_point); private: int find_segment(PN_stdfloat t); diff --git a/panda/src/particlesystem/Sources.pp b/panda/src/particlesystem/Sources.pp deleted file mode 100644 index c16bf74b0c..0000000000 --- a/panda/src/particlesystem/Sources.pp +++ /dev/null @@ -1,84 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3particlesystem - #define LOCAL_LIBS \ - p3pgraph p3physics - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - baseParticle.I baseParticle.h baseParticleEmitter.I \ - baseParticleEmitter.h baseParticleFactory.I \ - baseParticleFactory.h baseParticleRenderer.I \ - baseParticleRenderer.h arcEmitter.I arcEmitter.h \ - boxEmitter.I boxEmitter.h \ - config_particlesystem.h discEmitter.I discEmitter.h \ - geomParticleRenderer.I geomParticleRenderer.h lineEmitter.I \ - lineEmitter.h lineParticleRenderer.I lineParticleRenderer.h \ - particleSystem.I particleSystem.h particleSystemManager.I \ - particleSystemManager.h pointEmitter.I pointEmitter.h \ - pointParticle.h pointParticleFactory.h \ - pointParticleRenderer.I pointParticleRenderer.h \ - rectangleEmitter.I rectangleEmitter.h ringEmitter.I \ - ringEmitter.h sparkleParticleRenderer.I \ - sparkleParticleRenderer.h sphereSurfaceEmitter.I \ - sphereSurfaceEmitter.h sphereVolumeEmitter.I \ - sphereVolumeEmitter.h spriteParticleRenderer.I \ - spriteParticleRenderer.h tangentRingEmitter.I \ - tangentRingEmitter.h zSpinParticle.I zSpinParticle.h \ - zSpinParticleFactory.I zSpinParticleFactory.h \ - particleCommonFuncs.h colorInterpolationManager.I \ - colorInterpolationManager.h - -// oriented particles currently unimplemented -// orientedParticle.I orientedParticle.h \ -// orientedParticleFactory.I orientedParticleFactory.h \ - - #define INCLUDED_SOURCES \ - baseParticle.cxx baseParticleEmitter.cxx baseParticleFactory.cxx \ - baseParticleRenderer.cxx boxEmitter.cxx arcEmitter.cxx \ - config_particlesystem.cxx discEmitter.cxx \ - geomParticleRenderer.cxx lineEmitter.cxx \ - lineParticleRenderer.cxx particleSystem.cxx \ - particleSystemManager.cxx pointEmitter.cxx pointParticle.cxx \ - pointParticleFactory.cxx pointParticleRenderer.cxx \ - rectangleEmitter.cxx ringEmitter.cxx \ - sparkleParticleRenderer.cxx sphereSurfaceEmitter.cxx \ - sphereVolumeEmitter.cxx spriteParticleRenderer.cxx \ - tangentRingEmitter.cxx zSpinParticle.cxx \ - zSpinParticleFactory.cxx colorInterpolationManager.cxx - -// orientedParticle.cxx orientedParticleFactory.cxx - - #define INSTALL_HEADERS \ - baseParticle.I baseParticle.h baseParticleEmitter.I \ - baseParticleEmitter.h baseParticleFactory.I baseParticleFactory.h \ - baseParticleRenderer.I baseParticleRenderer.h arcEmitter.I arcEmitter.h \ - boxEmitter.I boxEmitter.h config_particlesystem.h \ - discEmitter.I discEmitter.h \ - emitters.h geomParticleRenderer.I geomParticleRenderer.h \ - lineEmitter.I lineEmitter.h lineParticleRenderer.I \ - lineParticleRenderer.h particleSystem.I particleSystem.h \ - particleSystemManager.I \ - particleSystemManager.h particlefactories.h particles.h \ - pointEmitter.I pointEmitter.h pointParticle.h \ - pointParticleFactory.h pointParticleRenderer.I \ - pointParticleRenderer.h rectangleEmitter.I rectangleEmitter.h \ - ringEmitter.I ringEmitter.h sparkleParticleRenderer.I \ - sparkleParticleRenderer.h sphereSurfaceEmitter.I \ - sphereSurfaceEmitter.h sphereVolumeEmitter.I sphereVolumeEmitter.h \ - spriteParticleRenderer.I spriteParticleRenderer.h \ - tangentRingEmitter.I tangentRingEmitter.h zSpinParticle.I \ - zSpinParticle.h zSpinParticleFactory.I zSpinParticleFactory.h \ - particleCommonFuncs.h colorInterpolationManager.I \ - colorInterpolationManager.h - -// orientedParticle.I orientedParticle.h \ -// orientedParticleFactory.I orientedParticleFactory.h \ - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/pgraph/Sources.pp b/panda/src/pgraph/Sources.pp deleted file mode 100644 index 838adc49b4..0000000000 --- a/panda/src/pgraph/Sources.pp +++ /dev/null @@ -1,351 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define LOCAL_LIBS \ - p3event p3gsgbase p3gobj p3putil p3linmath \ - p3downloader p3express p3pandabase p3pstatclient -#define USE_PACKAGES python - -#begin lib_target - #define TARGET p3pgraph - - // This directory is too big to combine into a single composite - // file--at least on Windows. - #define DONT_COMBINE $[WINDOWS_PLATFORM] - - #define SOURCES \ - accumulatedAttribs.I accumulatedAttribs.h \ - alphaTestAttrib.I alphaTestAttrib.h \ - antialiasAttrib.I antialiasAttrib.h \ - attribNodeRegistry.I attribNodeRegistry.h \ - audioVolumeAttrib.I audioVolumeAttrib.h \ - auxSceneData.I auxSceneData.h \ - auxBitplaneAttrib.I auxBitplaneAttrib.h \ - bamFile.I bamFile.h \ - billboardEffect.I billboardEffect.h \ - cacheStats.I cacheStats.h \ - camera.I camera.h \ - clipPlaneAttrib.I clipPlaneAttrib.h \ - colorAttrib.I colorAttrib.h \ - colorBlendAttrib.I colorBlendAttrib.h \ - colorScaleAttrib.I colorScaleAttrib.h \ - colorWriteAttrib.I colorWriteAttrib.h \ - compassEffect.I compassEffect.h \ - config_pgraph.h \ - cullBin.I cullBin.h \ - cullBinEnums.h \ - cullBinAttrib.I cullBinAttrib.h \ - cullBinManager.I cullBinManager.h \ - cullFaceAttrib.I cullFaceAttrib.h \ - cullHandler.I cullHandler.h \ - cullPlanes.I cullPlanes.h \ - cullResult.I cullResult.h \ - cullTraverser.I cullTraverser.h \ - cullTraverserData.I cullTraverserData.h \ - cullableObject.I cullableObject.h \ - decalEffect.I decalEffect.h \ - depthOffsetAttrib.I depthOffsetAttrib.h \ - depthTestAttrib.I depthTestAttrib.h \ - depthWriteAttrib.I depthWriteAttrib.h \ - findApproxLevelEntry.I findApproxLevelEntry.h \ - findApproxPath.I findApproxPath.h \ - fog.I fog.h \ - fogAttrib.I fogAttrib.h \ - geomDrawCallbackData.I geomDrawCallbackData.h \ - geomNode.I geomNode.h \ - geomTransformer.I geomTransformer.h \ - internalNameCollection.I internalNameCollection.h \ - lensNode.I lensNode.h \ - light.I light.h \ - lightAttrib.I lightAttrib.h \ - lightRampAttrib.I lightRampAttrib.h \ - loader.I loader.h \ - loaderFileType.h \ - loaderFileTypeBam.h \ - loaderFileTypeRegistry.h \ - materialAttrib.I materialAttrib.h \ - materialCollection.I materialCollection.h \ - modelFlattenRequest.I modelFlattenRequest.h \ - modelLoadRequest.I modelLoadRequest.h \ - modelSaveRequest.I modelSaveRequest.h \ - modelNode.I modelNode.h \ - modelPool.I modelPool.h \ - modelRoot.I modelRoot.h \ - nodePath.I nodePath.h nodePath.cxx \ - nodePath_ext.I nodePath_ext.h \ - nodePathCollection.I nodePathCollection.h \ - nodePathCollection_ext.h \ - nodePathComponent.I nodePathComponent.h \ - occluderEffect.I occluderEffect.h \ - occluderNode.I occluderNode.h \ - pandaNode.I pandaNode.h \ - pandaNodeChain.I pandaNodeChain.h \ - paramNodePath.I paramNodePath.h \ - planeNode.I planeNode.h \ - polylightEffect.I polylightEffect.h \ - polylightNode.I polylightNode.h \ - portalNode.I portalNode.h \ - portalClipper.I portalClipper.h \ - renderAttrib.I renderAttrib.h \ - renderAttribRegistry.I renderAttribRegistry.h \ - renderEffect.I renderEffect.h \ - renderEffects.I renderEffects.h \ - renderModeAttrib.I renderModeAttrib.h \ - renderState.I renderState.h \ - rescaleNormalAttrib.I rescaleNormalAttrib.h \ - sceneGraphReducer.I sceneGraphReducer.h \ - sceneSetup.I sceneSetup.h \ - scissorAttrib.I scissorAttrib.h \ - scissorEffect.I scissorEffect.h \ - shadeModelAttrib.I shadeModelAttrib.h \ - shaderAttrib.I shaderAttrib.h \ - shaderInput.I shaderInput.h \ - shaderPool.I shaderPool.h \ - showBoundsEffect.I showBoundsEffect.h \ - stateMunger.I stateMunger.h \ - stencilAttrib.I stencilAttrib.h \ - texMatrixAttrib.I texMatrixAttrib.h \ - texProjectorEffect.I texProjectorEffect.h \ - textureAttrib.I textureAttrib.h \ - texGenAttrib.I texGenAttrib.h \ - textureStageCollection.I textureStageCollection.h \ - transformState.I transformState.h \ - transparencyAttrib.I transparencyAttrib.h \ - weakNodePath.I weakNodePath.h \ - workingNodePath.I workingNodePath.h \ - nodePath_ext.h nodePath_ext.I \ - nodePathCollection_ext.h \ - pandaNode_ext.h \ - renderState_ext.h \ - transformState_ext.h - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx \ - $[TARGET]_composite3.cxx $[TARGET]_composite4.cxx \ - $[TARGET]_ext_composite.cxx - #define INCLUDED_SOURCES \ - accumulatedAttribs.cxx \ - alphaTestAttrib.cxx \ - antialiasAttrib.cxx \ - attribNodeRegistry.cxx \ - audioVolumeAttrib.cxx \ - auxBitplaneAttrib.cxx \ - auxSceneData.cxx \ - bamFile.cxx \ - billboardEffect.cxx \ - cacheStats.cxx \ - camera.cxx \ - clipPlaneAttrib.cxx \ - colorAttrib.cxx \ - colorBlendAttrib.cxx \ - colorScaleAttrib.cxx \ - colorWriteAttrib.cxx \ - compassEffect.cxx \ - config_pgraph.cxx \ - cullBin.cxx \ - cullBinAttrib.cxx \ - cullBinManager.cxx \ - cullFaceAttrib.cxx \ - cullHandler.cxx \ - cullPlanes.cxx \ - cullResult.cxx \ - cullTraverser.cxx \ - cullTraverserData.cxx \ - cullableObject.cxx \ - decalEffect.cxx \ - depthOffsetAttrib.cxx \ - depthTestAttrib.cxx \ - depthWriteAttrib.cxx \ - findApproxLevelEntry.cxx \ - findApproxPath.cxx \ - fog.cxx \ - fogAttrib.cxx \ - geomDrawCallbackData.cxx \ - geomNode.cxx \ - geomTransformer.cxx \ - internalNameCollection.cxx \ - lensNode.cxx \ - light.cxx \ - lightAttrib.cxx \ - lightRampAttrib.cxx \ - loader.cxx \ - loaderFileType.cxx \ - loaderFileTypeBam.cxx \ - loaderFileTypeRegistry.cxx \ - materialAttrib.cxx \ - materialCollection.cxx \ - modelFlattenRequest.cxx \ - modelLoadRequest.cxx \ - modelSaveRequest.cxx \ - modelNode.cxx \ - modelPool.cxx \ - modelRoot.cxx \ - nodePathCollection.cxx \ - nodePathComponent.cxx \ - occluderEffect.cxx \ - occluderNode.cxx \ - pandaNode.cxx \ - pandaNodeChain.cxx \ - paramNodePath.cxx \ - planeNode.cxx \ - polylightEffect.cxx \ - polylightNode.cxx \ - portalNode.cxx \ - portalClipper.cxx \ - renderAttrib.cxx \ - renderAttribRegistry.cxx \ - renderEffect.cxx \ - renderEffects.cxx \ - renderModeAttrib.cxx \ - renderState.cxx \ - rescaleNormalAttrib.cxx \ - sceneGraphReducer.cxx \ - sceneSetup.cxx \ - scissorAttrib.cxx \ - scissorEffect.cxx \ - shadeModelAttrib.cxx \ - shaderAttrib.cxx \ - shaderInput.cxx \ - shaderPool.cxx \ - showBoundsEffect.cxx \ - stateMunger.cxx \ - stencilAttrib.cxx \ - texMatrixAttrib.cxx \ - texProjectorEffect.cxx \ - textureAttrib.cxx \ - texGenAttrib.cxx \ - textureStageCollection.cxx \ - transformState.cxx \ - transparencyAttrib.cxx \ - weakNodePath.cxx \ - workingNodePath.cxx \ - nodePath_ext.cxx \ - nodePathCollection_ext.cxx \ - pandaNode_ext.cxx \ - renderState_ext.cxx \ - transformState_ext.cxx - - #define INSTALL_HEADERS \ - accumulatedAttribs.I accumulatedAttribs.h \ - alphaTestAttrib.I alphaTestAttrib.h \ - antialiasAttrib.I antialiasAttrib.h \ - attribNodeRegistry.I attribNodeRegistry.h \ - audioVolumeAttrib.I audioVolumeAttrib.h \ - auxSceneData.I auxSceneData.h \ - auxBitplaneAttrib.I auxBitplaneAttrib.h \ - bamFile.I bamFile.h \ - billboardEffect.I billboardEffect.h \ - cacheStats.I cacheStats.h \ - camera.I camera.h \ - clipPlaneAttrib.I clipPlaneAttrib.h \ - colorAttrib.I colorAttrib.h \ - colorBlendAttrib.I colorBlendAttrib.h \ - colorScaleAttrib.I colorScaleAttrib.h \ - colorWriteAttrib.I colorWriteAttrib.h \ - compassEffect.I compassEffect.h \ - config_pgraph.h \ - cullBin.I cullBin.h \ - cullBinEnums.h \ - cullBinAttrib.I cullBinAttrib.h \ - cullBinManager.I cullBinManager.h \ - cullFaceAttrib.I cullFaceAttrib.h \ - cullHandler.I cullHandler.h \ - cullPlanes.I cullPlanes.h \ - cullResult.I cullResult.h \ - cullTraverser.I cullTraverser.h \ - cullTraverserData.I cullTraverserData.h \ - cullableObject.I cullableObject.h \ - decalEffect.I decalEffect.h \ - depthOffsetAttrib.I depthOffsetAttrib.h \ - depthTestAttrib.I depthTestAttrib.h \ - depthWriteAttrib.I depthWriteAttrib.h \ - fog.I fog.h \ - fogAttrib.I fogAttrib.h \ - geomDrawCallbackData.I geomDrawCallbackData.h \ - geomNode.I geomNode.h \ - geomTransformer.I geomTransformer.h \ - internalNameCollection.I internalNameCollection.h \ - lensNode.I lensNode.h \ - light.I light.h \ - lightAttrib.I lightAttrib.h \ - lightRampAttrib.I lightRampAttrib.h \ - loader.I loader.h \ - loaderFileType.h \ - loaderFileTypeBam.h \ - loaderFileTypeRegistry.h \ - materialAttrib.I materialAttrib.h \ - materialCollection.I materialCollection.h \ - modelFlattenRequest.I modelFlattenRequest.h \ - modelLoadRequest.I modelLoadRequest.h \ - modelSaveRequest.I modelSaveRequest.h \ - modelNode.I modelNode.h \ - modelPool.I modelPool.h \ - modelRoot.I modelRoot.h \ - nodePath.I nodePath.h \ - nodePathCollection.I nodePathCollection.h \ - nodePathComponent.I nodePathComponent.h \ - occluderEffect.I occluderEffect.h \ - occluderNode.I occluderNode.h \ - pandaNode.I pandaNode.h \ - pandaNode_ext.h pandaNode_ext.cxx \ - pandaNodeChain.I pandaNodeChain.h \ - paramNodePath.I paramNodePath.h \ - planeNode.I planeNode.h \ - polylightEffect.I polylightEffect.h \ - polylightNode.I polylightNode.h \ - portalNode.I portalNode.h \ - portalClipper.I portalClipper.h \ - renderAttrib.I renderAttrib.h \ - renderAttribRegistry.I renderAttribRegistry.h \ - renderEffect.I renderEffect.h \ - renderEffects.I renderEffects.h \ - renderModeAttrib.I renderModeAttrib.h \ - renderState.I renderState.h \ - renderState_ext.h renderState_ext.cxx \ - rescaleNormalAttrib.I rescaleNormalAttrib.h \ - sceneGraphReducer.I sceneGraphReducer.h \ - sceneSetup.I sceneSetup.h \ - scissorAttrib.I scissorAttrib.h \ - scissorEffect.I scissorEffect.h \ - shadeModelAttrib.I shadeModelAttrib.h \ - shaderAttrib.I shaderAttrib.h \ - shaderInput.I shaderInput.h \ - shaderPool.I shaderPool.h \ - showBoundsEffect.I showBoundsEffect.h \ - stateMunger.I stateMunger.h \ - stencilAttrib.I stencilAttrib.h \ - texMatrixAttrib.I texMatrixAttrib.h \ - texProjectorEffect.I texProjectorEffect.h \ - textureAttrib.I textureAttrib.h \ - texGenAttrib.I texGenAttrib.h \ - textureStageCollection.I textureStageCollection.h \ - transformState.I transformState.h \ - transformState_ext.h transformState_ext.cxx \ - transparencyAttrib.I transparencyAttrib.h \ - weakNodePath.I weakNodePath.h \ - workingNodePath.I workingNodePath.h - -// No need to install these. -// findApproxLevelEntry.I findApproxLevelEntry.h \ -// findApproxPath.I findApproxPath.h \ - - #define IGATESCAN all - -// Uncomment these lines to compile everything individually instead of -// combining into p3pgraph_composite*.cxx. - -// #define COMBINED_SOURCES -// #define SOURCES $[SOURCES] $[INCLUDED_SOURCES] - -#end lib_target - - -#begin test_bin_target - #define TARGET test_pgraph - - #define SOURCES \ - test_pgraph.cxx - - #define LOCAL_LIBS $[LOCAL_LIBS] p3pgraph - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - -#end test_bin_target diff --git a/panda/src/pgraphnodes/Sources.pp b/panda/src/pgraphnodes/Sources.pp deleted file mode 100644 index 08d8108484..0000000000 --- a/panda/src/pgraphnodes/Sources.pp +++ /dev/null @@ -1,76 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define LOCAL_LIBS \ - p3event p3gsgbase p3gobj p3putil p3linmath \ - p3downloader p3express p3pandabase p3pstatclient p3pgraph -#define USE_PACKAGES python - -#begin lib_target - #define TARGET p3pgraphnodes - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - ambientLight.h ambientLight.I \ - callbackNode.h callbackNode.I \ - computeNode.h computeNode.I \ - config_pgraphnodes.h \ - directionalLight.h directionalLight.I \ - fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \ - lightLensNode.h lightLensNode.I \ - lightNode.h lightNode.I \ - lodNode.I lodNode.h lodNodeType.h \ - nodeCullCallbackData.h nodeCullCallbackData.I \ - pointLight.h pointLight.I \ - sceneGraphAnalyzer.h sceneGraphAnalyzer.I \ - selectiveChildNode.h selectiveChildNode.I \ - sequenceNode.h sequenceNode.I \ - shaderGenerator.h shaderGenerator.I \ - spotlight.h spotlight.I \ - switchNode.h switchNode.I \ - uvScrollNode.I uvScrollNode.h - - #define INCLUDED_SOURCES \ - ambientLight.cxx \ - callbackNode.cxx \ - computeNode.cxx \ - config_pgraphnodes.cxx \ - directionalLight.cxx \ - fadeLodNode.cxx fadeLodNodeData.cxx \ - lightLensNode.cxx \ - lightNode.cxx \ - lodNode.cxx lodNodeType.cxx \ - nodeCullCallbackData.cxx \ - pointLight.cxx \ - sceneGraphAnalyzer.cxx \ - selectiveChildNode.cxx \ - sequenceNode.cxx \ - shaderGenerator.cxx \ - spotlight.cxx \ - switchNode.cxx \ - uvScrollNode.cxx - - #define INSTALL_HEADERS \ - ambientLight.h ambientLight.I \ - callbackNode.h callbackNode.I \ - computeNode.h computeNode.I \ - config_pgraphnodes.h \ - directionalLight.h directionalLight.I \ - fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \ - lightLensNode.h lightLensNode.I \ - lightNode.h lightNode.I \ - lodNode.I lodNode.h lodNodeType.h \ - nodeCullCallbackData.h nodeCullCallbackData.I \ - pointLight.h pointLight.I \ - sceneGraphAnalyzer.h sceneGraphAnalyzer.I \ - selectiveChildNode.h selectiveChildNode.I \ - sequenceNode.h sequenceNode.I \ - shaderGenerator.h shaderGenerator.I \ - spotlight.h spotlight.I \ - switchNode.h switchNode.I \ - uvScrollNode.I uvScrollNode.h - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/pgui/Sources.pp b/panda/src/pgui/Sources.pp deleted file mode 100644 index 503e2ff2d5..0000000000 --- a/panda/src/pgui/Sources.pp +++ /dev/null @@ -1,93 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3pgui - #define LOCAL_LIBS \ - p3audio p3grutil p3text p3tform p3linmath p3event p3putil p3gobj \ - p3mathutil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_pgui.h \ - pgButton.I pgButton.h \ - pgButtonNotify.I pgButtonNotify.h \ - pgCullTraverser.I pgCullTraverser.h \ - pgEntry.I pgEntry.h \ - pgMouseWatcherGroup.I pgMouseWatcherGroup.h \ - pgMouseWatcherParameter.I pgMouseWatcherParameter.h \ - pgFrameStyle.I pgFrameStyle.h \ - pgItem.I pgItem.h \ - pgItemNotify.I pgItemNotify.h \ - pgMouseWatcherBackground.h \ - pgMouseWatcherRegion.I pgMouseWatcherRegion.h \ - pgScrollFrame.I pgScrollFrame.h \ - pgSliderBar.I pgSliderBar.h \ - pgSliderBarNotify.I pgSliderBarNotify.h \ - pgTop.I pgTop.h \ - pgVirtualFrame.I pgVirtualFrame.h \ - pgWaitBar.I pgWaitBar.h - - #define INCLUDED_SOURCES \ - config_pgui.cxx \ - pgButton.cxx \ - pgButtonNotify.cxx \ - pgCullTraverser.cxx \ - pgEntry.cxx \ - pgMouseWatcherGroup.cxx \ - pgMouseWatcherParameter.cxx \ - pgFrameStyle.cxx \ - pgItem.cxx \ - pgItemNotify.cxx \ - pgMouseWatcherBackground.cxx \ - pgMouseWatcherRegion.cxx \ - pgScrollFrame.cxx \ - pgSliderBar.cxx \ - pgSliderBarNotify.cxx \ - pgTop.cxx \ - pgVirtualFrame.cxx \ - pgWaitBar.cxx - - #define INSTALL_HEADERS \ - pgButton.I pgButton.h \ - pgButtonNotify.I pgButtonNotify.h \ - pgCullTraverser.I pgCullTraverser.h \ - pgEntry.I pgEntry.h \ - pgMouseWatcherGroup.I pgMouseWatcherGroup.h \ - pgMouseWatcherParameter.I pgMouseWatcherParameter.h \ - pgFrameStyle.I pgFrameStyle.h \ - pgItem.I pgItem.h \ - pgItemNotify.I pgItemNotify.h \ - pgMouseWatcherBackground.h \ - pgMouseWatcherRegion.I pgMouseWatcherRegion.h \ - pgScrollFrame.I pgScrollFrame.h \ - pgSliderBar.I pgSliderBar.h \ - pgSliderBarNotify.I pgSliderBarNotify.h \ - pgTop.I pgTop.h \ - pgVirtualFrame.I pgVirtualFrame.h \ - pgWaitBar.I pgWaitBar.h - - - #define IGATESCAN all - -#end lib_target - - -#begin test_bin_target - #define TARGET test_pgentry - - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define LOCAL_LIBS \ - p3framework p3putil p3collide p3pgraph p3chan p3text \ - p3pnmimage p3pnmimagetypes p3event p3gobj p3display \ - p3mathutil p3putil p3express p3dgraph p3device p3tform \ - p3linmath p3pstatclient panda - - #define UNIX_SYS_LIBS m - - #define SOURCES \ - test_pgentry.cxx - -#end test_bin_target diff --git a/panda/src/physics/Sources.pp b/panda/src/physics/Sources.pp deleted file mode 100644 index af187c0ab8..0000000000 --- a/panda/src/physics/Sources.pp +++ /dev/null @@ -1,81 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3physics - #define LOCAL_LIBS \ - p3pgraph p3linmath p3collide - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - actorNode.I actorNode.h angularEulerIntegrator.h angularForce.h \ - angularIntegrator.h angularVectorForce.I \ - angularVectorForce.h baseForce.I baseForce.h \ - baseIntegrator.I baseIntegrator.h config_physics.h \ - forceNode.I forceNode.h \ - linearControlForce.I linearControlForce.h \ - linearCylinderVortexForce.I linearCylinderVortexForce.h \ - linearDistanceForce.I \ - linearDistanceForce.h linearEulerIntegrator.h linearForce.I \ - linearForce.h linearFrictionForce.I linearFrictionForce.h \ - linearIntegrator.h linearJitterForce.h linearNoiseForce.I \ - linearNoiseForce.h linearRandomForce.I linearRandomForce.h \ - linearSinkForce.h linearSourceForce.h \ - linearUserDefinedForce.I linearUserDefinedForce.h \ - linearVectorForce.I linearVectorForce.h physical.I \ - physical.h physicalNode.I physicalNode.h \ - physicsCollisionHandler.I physicsCollisionHandler.h \ - physicsManager.I physicsManager.h \ - physicsObject.I physicsObject.h \ - physicsObjectCollection.I physicsObjectCollection.h - - #define INCLUDED_SOURCES \ - actorNode.cxx angularEulerIntegrator.cxx angularForce.cxx \ - angularIntegrator.cxx angularVectorForce.cxx baseForce.cxx \ - baseIntegrator.cxx config_physics.cxx forceNode.cxx \ - linearControlForce.cxx \ - linearCylinderVortexForce.cxx linearDistanceForce.cxx \ - linearEulerIntegrator.cxx linearForce.cxx \ - linearFrictionForce.cxx linearIntegrator.cxx \ - linearJitterForce.cxx linearNoiseForce.cxx \ - linearRandomForce.cxx linearSinkForce.cxx \ - linearSourceForce.cxx linearUserDefinedForce.cxx \ - linearVectorForce.cxx physical.cxx physicalNode.cxx \ - physicsCollisionHandler.cxx physicsManager.cxx physicsObject.cxx \ - physicsObjectCollection.cxx - - #define INSTALL_HEADERS \ - actorNode.I actorNode.h angularEulerIntegrator.h angularForce.h \ - angularIntegrator.h angularVectorForce.I angularVectorForce.h \ - baseForce.I baseForce.h baseIntegrator.I baseIntegrator.h \ - config_physics.h forceNode.I forceNode.h forces.h \ - linearControlForce.I linearControlForce.h \ - linearCylinderVortexForce.I linearCylinderVortexForce.h \ - linearDistanceForce.I linearDistanceForce.h linearEulerIntegrator.h \ - linearForce.I linearForce.h linearFrictionForce.I \ - linearFrictionForce.h linearIntegrator.h linearJitterForce.h \ - linearNoiseForce.I linearNoiseForce.h linearRandomForce.I \ - linearRandomForce.h linearSinkForce.h linearSourceForce.h \ - linearUserDefinedForce.I linearUserDefinedForce.h \ - linearVectorForce.I linearVectorForce.h physical.I physical.h \ - physicalNode.I physicalNode.h \ - physicsCollisionHandler.I physicsCollisionHandler.h \ - physicsManager.I physicsManager.h \ - physicsObject.I physicsObject.h \ - physicsObjectCollection.h physicsObjectCollection.I - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_physics - #define LOCAL_LIBS \ - p3linmath p3physics p3collide - - #define SOURCES \ - test_physics.cxx - -#end test_bin_target - diff --git a/panda/src/physx/Sources.pp b/panda/src/physx/Sources.pp deleted file mode 100644 index 5fef3e6b4f..0000000000 --- a/panda/src/physx/Sources.pp +++ /dev/null @@ -1,408 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_PHYSX] -#define BUILDING_DLL BUILDING_PANDAPHYSX - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3physx - #define LOCAL_LIBS p3pgraph p3linmath p3grutil - #define USE_PACKAGES physx - #define COMBINED_SOURCES $[TARGET]_composite.cxx - - #define SOURCES \ - config_physx.h physx_includes.h \ - physxActor.I physxActor.h \ - physxActorDesc.I physxActorDesc.h \ - physxBodyDesc.I physxBodyDesc.h \ - physxBounds3.I physxBounds3.h \ - physxBox.I physxBox.h \ - physxBoxController.I physxBoxController.h \ - physxBoxControllerDesc.I physxBoxControllerDesc.h \ - physxBoxForceFieldShape.I physxBoxForceFieldShape.h \ - physxBoxForceFieldShapeDesc.I physxBoxForceFieldShapeDesc.h \ - physxBoxShape.I physxBoxShape.h \ - physxBoxShapeDesc.I physxBoxShapeDesc.h \ - physxCapsule.I physxCapsule.h \ - physxCapsuleController.I physxCapsuleController.h \ - physxCapsuleControllerDesc.I physxCapsuleControllerDesc.h \ - physxCapsuleForceFieldShape.I physxCapsuleForceFieldShape.h \ - physxCapsuleForceFieldShapeDesc.I physxCapsuleForceFieldShapeDesc.h \ - physxCapsuleShape.I physxCapsuleShape.h \ - physxCapsuleShapeDesc.I physxCapsuleShapeDesc.h \ - physxCcdSkeleton.I physxCcdSkeleton.h \ - physxCcdSkeletonDesc.I physxCcdSkeletonDesc.h \ - physxCloth.I physxCloth.h \ - physxClothDesc.I physxClothDesc.h \ - physxClothMesh.I physxClothMesh.h \ - physxClothMeshDesc.I physxClothMeshDesc.h \ - physxClothNode.I physxClothNode.h \ - physxConstraintDominance.I physxConstraintDominance.h \ - physxContactPair.I physxContactPair.h \ - physxContactPoint.I physxContactPoint.h \ - physxContactReport.I physxContactReport.h \ - physxController.I physxController.h \ - physxControllerDesc.I physxControllerDesc.h \ - physxControllerReport.I physxControllerReport.h \ - physxControllerShapeHit.I physxControllerShapeHit.h \ - physxControllersHit.I physxControllersHit.h \ - physxConvexForceFieldShape.I physxConvexForceFieldShape.h \ - physxConvexForceFieldShapeDesc.I physxConvexForceFieldShapeDesc.h \ - physxConvexMesh.I physxConvexMesh.h \ - physxConvexMeshDesc.I physxConvexMeshDesc.h \ - physxConvexShape.I physxConvexShape.h \ - physxConvexShapeDesc.I physxConvexShapeDesc.h \ - physxCylindricalJoint.I physxCylindricalJoint.h \ - physxCylindricalJointDesc.I physxCylindricalJointDesc.h \ - physxD6Joint.I physxD6Joint.h \ - physxD6JointDesc.I physxD6JointDesc.h \ - physxDebugGeomNode.I physxDebugGeomNode.h \ - physxDistanceJoint.I physxDistanceJoint.h \ - physxDistanceJointDesc.I physxDistanceJointDesc.h \ - physxEnums.h \ - physxFileStream.h \ - physxFixedJoint.I physxFixedJoint.h \ - physxFixedJointDesc.I physxFixedJointDesc.h \ - physxForceField.I physxForceField.h \ - physxForceFieldDesc.I physxForceFieldDesc.h \ - physxForceFieldShape.I physxForceFieldShape.h \ - physxForceFieldShapeDesc.I physxForceFieldShapeDesc.h \ - physxForceFieldShapeGroup.I physxForceFieldShapeGroup.h \ - physxForceFieldShapeGroupDesc.I physxForceFieldShapeGroupDesc.h \ - physxGroupsMask.I physxGroupsMask.h \ - physxHeightField.I physxHeightField.h \ - physxHeightFieldDesc.I physxHeightFieldDesc.h \ - physxHeightFieldShape.I physxHeightFieldShape.h \ - physxHeightFieldShapeDesc.I physxHeightFieldShapeDesc.h \ - physxJoint.I physxJoint.h \ - physxJointDesc.I physxJointDesc.h \ - physxJointDriveDesc.I physxJointDriveDesc.h \ - physxJointLimitDesc.I physxJointLimitDesc.h \ - physxJointLimitSoftDesc.I physxJointLimitSoftDesc.h \ - physxKitchen.I physxKitchen.h \ - physxLinearInterpolationValues.I physxLinearInterpolationValues.h \ - physxManager.I physxManager.h \ - physxMask.I physxMask.h \ - physxMaterial.I physxMaterial.h \ - physxMaterialDesc.I physxMaterialDesc.h \ - physxMemoryReadBuffer.h \ - physxMemoryWriteBuffer.h \ - physxMeshPool.I physxMeshPool.h \ - physxMeshHash.I physxMeshHash.h \ - physxMotorDesc.I physxMotorDesc.h \ - physxObject.I physxObject.h \ - physxObjectCollection.I physxObjectCollection.h \ - physxOverlapReport.I physxOverlapReport.h \ - physxPlane.I physxPlane.h \ - physxPlaneShape.I physxPlaneShape.h \ - physxPlaneShapeDesc.I physxPlaneShapeDesc.h \ - physxPointInPlaneJoint.I physxPointInPlaneJoint.h \ - physxPointInPlaneJointDesc.I physxPointInPlaneJointDesc.h \ - physxPointOnLineJoint.I physxPointOnLineJoint.h \ - physxPointOnLineJointDesc.I physxPointOnLineJointDesc.h \ - physxPrismaticJoint.I physxPrismaticJoint.h \ - physxPrismaticJointDesc.I physxPrismaticJointDesc.h \ - physxPulleyJoint.I physxPulleyJoint.h \ - physxPulleyJointDesc.I physxPulleyJointDesc.h \ - physxRay.I physxRay.h \ - physxRaycastHit.I physxRaycastHit.h \ - physxRaycastReport.I physxRaycastReport.h \ - physxRevoluteJoint.I physxRevoluteJoint.h \ - physxRevoluteJointDesc.I physxRevoluteJointDesc.h \ - physxScene.I physxScene.h \ - physxSceneDesc.I physxSceneDesc.h \ - physxSceneStats2.I physxSceneStats2.h \ - physxSegment.I physxSegment.h \ - physxShape.I physxShape.h \ - physxShapeDesc.I physxShapeDesc.h \ - physxSoftBody.I physxSoftBody.h \ - physxSoftBodyDesc.I physxSoftBodyDesc.h \ - physxSoftBodyMesh.I physxSoftBodyMesh.h \ - physxSoftBodyMeshDesc.I physxSoftBodyMeshDesc.h \ - physxSoftBodyNode.I physxSoftBodyNode.h \ - physxSphere.I physxSphere.h \ - physxSphereForceFieldShape.I physxSphereForceFieldShape.h \ - physxSphereForceFieldShapeDesc.I physxSphereForceFieldShapeDesc.h \ - physxSphereShape.I physxSphereShape.h \ - physxSphereShapeDesc.I physxSphereShapeDesc.h \ - physxSphericalJoint.I physxSphericalJoint.h \ - physxSphericalJointDesc.I physxSphericalJointDesc.h \ - physxSpringDesc.I physxSpringDesc.h \ - physxTriangleMesh.I physxTriangleMesh.h \ - physxTriangleMeshDesc.I physxTriangleMeshDesc.h \ - physxTriangleMeshShape.I physxTriangleMeshShape.h \ - physxTriangleMeshShapeDesc.I physxTriangleMeshShapeDesc.h \ - physxTriggerReport.I physxTriggerReport.h \ - physxUtilLib.I physxUtilLib.h \ - physxVehicle.I physxVehicle.h \ - physxVehicleDesc.I physxVehicleDesc.h \ - physxWheel.I physxWheel.h \ - physxWheelDesc.I physxWheelDesc.h \ - physxWheelShape.I physxWheelShape.h \ - physxWheelShapeDesc.I physxWheelShapeDesc.h \ - - #define INCLUDED_SOURCES \ - config_physx.cxx \ - physxActor.cxx \ - physxActorDesc.cxx \ - physxBodyDesc.cxx \ - physxBounds3.cxx \ - physxBox.cxx \ - physxBoxController.cxx \ - physxBoxControllerDesc.cxx \ - physxBoxForceFieldShape.cxx \ - physxBoxForceFieldShapeDesc.cxx \ - physxBoxShape.cxx \ - physxBoxShapeDesc.cxx \ - physxCapsule.cxx \ - physxCapsuleController.cxx \ - physxCapsuleControllerDesc.cxx \ - physxCapsuleForceFieldShape.cxx \ - physxCapsuleForceFieldShapeDesc.cxx \ - physxCapsuleShape.cxx \ - physxCapsuleShapeDesc.cxx \ - physxCcdSkeleton.cxx \ - physxCcdSkeletonDesc.cxx \ - physxCloth.cxx \ - physxClothDesc.cxx \ - physxClothMesh.cxx \ - physxClothMeshDesc.cxx \ - physxClothNode.cxx \ - physxConstraintDominance.cxx \ - physxContactPair.cxx \ - physxContactPoint.cxx \ - physxContactReport.cxx \ - physxController.cxx \ - physxControllerDesc.cxx \ - physxControllerReport.cxx \ - physxControllerShapeHit.cxx \ - physxControllersHit.cxx \ - physxConvexForceFieldShape.cxx \ - physxConvexForceFieldShapeDesc.cxx \ - physxConvexMesh.cxx \ - physxConvexMeshDesc.cxx \ - physxConvexShape.cxx \ - physxConvexShapeDesc.cxx \ - physxCylindricalJoint.cxx \ - physxCylindricalJointDesc.cxx \ - physxD6Joint.cxx \ - physxD6JointDesc.cxx \ - physxDebugGeomNode.cxx \ - physxDistanceJoint.cxx \ - physxDistanceJointDesc.cxx \ - physxEnums.cxx \ - physxFileStream.cxx \ - physxFixedJoint.cxx \ - physxFixedJointDesc.cxx \ - physxForceField.cxx \ - physxForceFieldDesc.cxx \ - physxForceFieldShape.cxx \ - physxForceFieldShapeDesc.cxx \ - physxForceFieldShapeGroup.cxx \ - physxForceFieldShapeGroupDesc.cxx \ - physxGroupsMask.cxx \ - physxHeightField.cxx \ - physxHeightFieldDesc.cxx \ - physxHeightFieldShape.cxx \ - physxHeightFieldShapeDesc.cxx \ - physxJoint.cxx \ - physxJointDesc.cxx \ - physxJointDriveDesc.cxx \ - physxJointLimitDesc.cxx \ - physxJointLimitSoftDesc.cxx \ - physxKitchen.cxx \ - physxLinearInterpolationValues.cxx \ - physxManager.cxx \ - physxMask.cxx \ - physxMaterial.cxx \ - physxMaterialDesc.cxx \ - physxMemoryReadBuffer.cxx \ - physxMemoryWriteBuffer.cxx \ - physxMeshPool.cxx \ - physxMeshHash.cxx \ - physxMotorDesc.cxx \ - physxObject.cxx \ - physxObjectCollection.cxx \ - physxOverlapReport.cxx \ - physxPlane.cxx \ - physxPlaneShape.cxx \ - physxPlaneShapeDesc.cxx \ - physxPointInPlaneJoint.cxx \ - physxPointInPlaneJointDesc.cxx \ - physxPointOnLineJoint.cxx \ - physxPointOnLineJointDesc.cxx \ - physxPrismaticJoint.cxx \ - physxPrismaticJointDesc.cxx \ - physxPulleyJoint.cxx \ - physxPulleyJointDesc.cxx \ - physxRay.cxx \ - physxRaycastHit.cxx \ - physxRaycastReport.cxx \ - physxRevoluteJoint.cxx \ - physxRevoluteJointDesc.cxx \ - physxScene.cxx \ - physxSceneDesc.cxx \ - physxSceneStats2.cxx \ - physxSegment.cxx \ - physxShape.cxx \ - physxShapeDesc.cxx \ - physxSoftBody.cxx \ - physxSoftBodyDesc.cxx \ - physxSoftBodyMesh.cxx \ - physxSoftBodyMeshDesc.cxx \ - physxSoftBodyNode.cxx \ - physxSphere.cxx \ - physxSphereForceFieldShape.cxx \ - physxSphereForceFieldShapeDesc.cxx \ - physxSphereShape.cxx \ - physxSphereShapeDesc.cxx \ - physxSphericalJoint.cxx \ - physxSphericalJointDesc.cxx \ - physxSpringDesc.cxx \ - physxTriangleMesh.cxx \ - physxTriangleMeshDesc.cxx \ - physxTriangleMeshShape.cxx \ - physxTriangleMeshShapeDesc.cxx \ - physxTriggerReport.cxx \ - physxUtilLib.cxx \ - physxVehicle.cxx \ - physxVehicleDesc.cxx \ - physxWheel.cxx \ - physxWheelDesc.cxx \ - physxWheelShape.cxx \ - physxWheelShapeDesc.cxx \ - - #define INSTALL_HEADERS \ - config_physx.h physx_includes.h \ - physxActor.I physxActor.h \ - physxActorDesc.I physxActorDesc.h \ - physxBodyDesc.I physxBodyDesc.h \ - physxBounds3.I physxBounds3.h \ - physxBox.I physxBox.h \ - physxBoxController.I physxBoxController.h \ - physxBoxControllerDesc.I physxBoxControllerDesc.h \ - physxBoxForceFieldShape.I physxBoxForceFieldShape.h \ - physxBoxForceFieldShapeDesc.I physxBoxForceFieldShapeDesc.h \ - physxBoxShape.I physxBoxShape.h \ - physxBoxShapeDesc.I physxBoxShapeDesc.h \ - physxCapsule.I physxCapsule.h \ - physxCapsuleController.I physxCapsuleController.h \ - physxCapsuleControllerDesc.I physxCapsuleControllerDesc.h \ - physxCapsuleForceFieldShape.I physxCapsuleForceFieldShape.h \ - physxCapsuleForceFieldShapeDesc.I physxCapsuleForceFieldShapeDesc.h \ - physxCapsuleShape.I physxCapsuleShape.h \ - physxCapsuleShapeDesc.I physxCapsuleShapeDesc.h \ - physxCcdSkeleton.I physxCcdSkeleton.h \ - physxCcdSkeletonDesc.I physxCcdSkeletonDesc.h \ - physxCloth.I physxCloth.h \ - physxClothDesc.I physxClothDesc.h \ - physxClothMesh.I physxClothMesh.h \ - physxClothMeshDesc.I physxClothMeshDesc.h \ - physxClothNode.I physxClothNode.h \ - physxConstraintDominance.I physxConstraintDominance.h \ - physxContactPair.I physxContactPair.h \ - physxContactPoint.I physxContactPoint.h \ - physxContactReport.I physxContactReport.h \ - physxController.I physxController.h \ - physxControllerDesc.I physxControllerDesc.h \ - physxControllerReport.I physxControllerReport.h \ - physxControllerShapeHit.I physxControllerShapeHit.h \ - physxControllersHit.I physxControllersHit.h \ - physxConvexForceFieldShape.I physxConvexForceFieldShape.h \ - physxConvexForceFieldShapeDesc.I physxConvexForceFieldShapeDesc.h \ - physxConvexMesh.I physxConvexMesh.h \ - physxConvexMeshDesc.I physxConvexMeshDesc.h \ - physxConvexShape.I physxConvexShape.h \ - physxConvexShapeDesc.I physxConvexShapeDesc.h \ - physxCylindricalJoint.I physxCylindricalJoint.h \ - physxCylindricalJointDesc.I physxCylindricalJointDesc.h \ - physxD6Joint.I physxD6Joint.h \ - physxD6JointDesc.I physxD6JointDesc.h \ - physxDebugGeomNode.I physxDebugGeomNode.h \ - physxDistanceJoint.I physxDistanceJoint.h \ - physxDistanceJointDesc.I physxDistanceJointDesc.h \ - physxEnums.h \ - physxFileStream.h \ - physxFixedJoint.I physxFixedJoint.h \ - physxFixedJointDesc.I physxFixedJointDesc.h \ - physxForceField.I physxForceField.h \ - physxForceFieldDesc.I physxForceFieldDesc.h \ - physxForceFieldShape.I physxForceFieldShape.h \ - physxForceFieldShapeDesc.I physxForceFieldShapeDesc.h \ - physxForceFieldShapeGroup.I physxForceFieldShapeGroup.h \ - physxForceFieldShapeGroupDesc.I physxForceFieldShapeGroupDesc.h \ - physxGroupsMask.I physxGroupsMask.h \ - physxHeightField.I physxHeightField.h \ - physxHeightFieldDesc.I physxHeightFieldDesc.h \ - physxHeightFieldShape.I physxHeightFieldShape.h \ - physxHeightFieldShapeDesc.I physxHeightFieldShapeDesc.h \ - physxJoint.I physxJoint.h \ - physxJointDesc.I physxJointDesc.h \ - physxJointDriveDesc.I physxJointDriveDesc.h \ - physxJointLimitDesc.I physxJointLimitDesc.h \ - physxJointLimitSoftDesc.I physxJointLimitSoftDesc.h \ - physxKitchen.I physxKitchen.h \ - physxLinearInterpolationValues.I physxLinearInterpolationValues.h \ - physxManager.I physxManager.h \ - physxMask.I physxMask.h \ - physxMaterial.I physxMaterial.h \ - physxMaterialDesc.I physxMaterialDesc.h \ - physxMemoryReadBuffer.h \ - physxMemoryWriteBuffer.h \ - physxMeshPool.I physxMeshPool.h \ - physxMeshHash.I physxMeshHash.h \ - physxMotorDesc.I physxMotorDesc.h \ - physxObject.I physxObject.h \ - physxObjectCollection.I physxObjectCollection.h \ - physxOverlapReport.I physxOverlapReport.h \ - physxPlane.I physxPlane.h \ - physxPlaneShape.I physxPlaneShape.h \ - physxPlaneShapeDesc.I physxPlaneShapeDesc.h \ - physxPointInPlaneJoint.I physxPointInPlaneJoint.h \ - physxPointInPlaneJointDesc.I physxPointInPlaneJointDesc.h \ - physxPointOnLineJoint.I physxPointOnLineJoint.h \ - physxPointOnLineJointDesc.I physxPointOnLineJointDesc.h \ - physxPrismaticJoint.I physxPrismaticJoint.h \ - physxPrismaticJointDesc.I physxPrismaticJointDesc.h \ - physxPulleyJoint.I physxPulleyJoint.h \ - physxPulleyJointDesc.I physxPulleyJointDesc.h \ - physxRay.I physxRay.h \ - physxRaycastHit.I physxRaycastHit.h \ - physxRaycastReport.I physxRaycastReport.h \ - physxRevoluteJoint.I physxRevoluteJoint.h \ - physxRevoluteJointDesc.I physxRevoluteJointDesc.h \ - physxScene.I physxScene.h \ - physxSceneDesc.I physxSceneDesc.h \ - physxSceneStats2.I physxSceneStats2.h \ - physxSegment.I physxSegment.h \ - physxShape.I physxShape.h \ - physxShapeDesc.I physxShapeDesc.h \ - physxSoftBody.I physxSoftBody.h \ - physxSoftBodyDesc.I physxSoftBodyDesc.h \ - physxSoftBodyMesh.I physxSoftBodyMesh.h \ - physxSoftBodyMeshDesc.I physxSoftBodyMeshDesc.h \ - physxSoftBodyNode.I physxSoftBodyNode.h \ - physxSphere.I physxSphere.h \ - physxSphereForceFieldShape.I physxSphereForceFieldShape.h \ - physxSphereForceFieldShapeDesc.I physxSphereForceFieldShapeDesc.h \ - physxSphereShape.I physxSphereShape.h \ - physxSphereShapeDesc.I physxSphereShapeDesc.h \ - physxSphericalJoint.I physxSphericalJoint.h \ - physxSphericalJointDesc.I physxSphericalJointDesc.h \ - physxSpringDesc.I physxSpringDesc.h \ - physxTriangleMesh.I physxTriangleMesh.h \ - physxTriangleMeshDesc.I physxTriangleMeshDesc.h \ - physxTriangleMeshShape.I physxTriangleMeshShape.h \ - physxTriangleMeshShapeDesc.I physxTriangleMeshShapeDesc.h \ - physxTriggerReport.I physxTriggerReport.h \ - physxUtilLib.I physxUtilLib.h \ - physxVehicle.I physxVehicle.h \ - physxVehicleDesc.I physxVehicleDesc.h \ - physxWheel.I physxWheel.h \ - physxWheelDesc.I physxWheelDesc.h \ - physxWheelShape.I physxWheelShape.h \ - physxWheelShapeDesc.I physxWheelShapeDesc.h \ - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/pipeline/Sources.pp b/panda/src/pipeline/Sources.pp deleted file mode 100644 index c072750f11..0000000000 --- a/panda/src/pipeline/Sources.pp +++ /dev/null @@ -1,288 +0,0 @@ -#define LOCAL_LIBS p3express p3pandabase -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define SELECT_TAU select.tau - -#begin lib_target - #define TARGET p3pipeline - #define USE_PACKAGES threads - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - asyncTaskBase.h asyncTaskBase.I \ - contextSwitch.c contextSwitch.h \ - blockerSimple.h blockerSimple.I \ - conditionVar.h conditionVar.I \ - conditionVarDebug.h conditionVarDebug.I \ - conditionVarDirect.h conditionVarDirect.I \ - conditionVarDummyImpl.h conditionVarDummyImpl.I \ - conditionVarFull.h conditionVarFull.I \ - conditionVarFullDebug.h conditionVarFullDebug.I \ - conditionVarFullDirect.h conditionVarFullDirect.I \ - conditionVarFullWin32Impl.h conditionVarFullWin32Impl.I \ - conditionVarImpl.h \ - conditionVarPosixImpl.h conditionVarPosixImpl.I \ - conditionVarWin32Impl.h conditionVarWin32Impl.I \ - conditionVarSimpleImpl.h conditionVarSimpleImpl.I \ - conditionVarSpinlockImpl.h conditionVarSpinlockImpl.I \ - config_pipeline.h \ - cycleData.h cycleData.I \ - cycleDataLockedReader.h cycleDataLockedReader.I \ - cycleDataLockedStageReader.h cycleDataLockedStageReader.I \ - cycleDataReader.h cycleDataReader.I \ - cycleDataStageReader.h cycleDataStageReader.I \ - cycleDataStageWriter.h cycleDataStageWriter.I \ - cycleDataWriter.h cycleDataWriter.I \ - cyclerHolder.h cyclerHolder.I \ - externalThread.h \ - genericThread.h genericThread.I \ - lightMutex.I lightMutex.h \ - lightMutexDirect.h lightMutexDirect.I \ - lightMutexHolder.I lightMutexHolder.h \ - lightReMutex.I lightReMutex.h \ - lightReMutexDirect.h lightReMutexDirect.I \ - lightReMutexHolder.I lightReMutexHolder.h \ - mainThread.h \ - mutexDebug.h mutexDebug.I \ - mutexDirect.h mutexDirect.I \ - mutexHolder.h mutexHolder.I \ - mutexSimpleImpl.h mutexSimpleImpl.I \ - mutexTrueImpl.h \ - pipeline.h pipeline.I \ - pipelineCycler.h pipelineCycler.I \ - pipelineCyclerLinks.h pipelineCyclerLinks.I \ - pipelineCyclerBase.h \ - pipelineCyclerDummyImpl.h pipelineCyclerDummyImpl.I \ - pipelineCyclerTrivialImpl.h pipelineCyclerTrivialImpl.I \ - pipelineCyclerTrueImpl.h pipelineCyclerTrueImpl.I \ - pmutex.h pmutex.I \ - pythonThread.h \ - reMutex.I reMutex.h \ - reMutexDirect.h reMutexDirect.I \ - reMutexHolder.I reMutexHolder.h \ - psemaphore.h psemaphore.I \ - thread.h thread.I threadImpl.h \ - threadDummyImpl.h threadDummyImpl.I \ - threadPosixImpl.h threadPosixImpl.I \ - threadSimpleImpl.h threadSimpleImpl.I \ - threadSimpleManager.h threadSimpleManager.I \ - threadWin32Impl.h threadWin32Impl.I \ - threadPriority.h - - #define INCLUDED_SOURCES \ - asyncTaskBase.cxx \ - conditionVar.cxx \ - conditionVarDebug.cxx \ - conditionVarDirect.cxx \ - conditionVarDummyImpl.cxx \ - conditionVarFull.cxx \ - conditionVarFullDebug.cxx \ - conditionVarFullDirect.cxx \ - conditionVarFullWin32Impl.cxx \ - conditionVarPosixImpl.cxx \ - conditionVarWin32Impl.cxx \ - conditionVarSimpleImpl.cxx \ - conditionVarSpinlockImpl.cxx \ - config_pipeline.cxx \ - contextSwitch_longjmp_src.c \ - contextSwitch_posix_src.c \ - contextSwitch_ucontext_src.c \ - contextSwitch_windows_src.c \ - cycleData.cxx \ - cycleDataLockedReader.cxx \ - cycleDataLockedStageReader.cxx \ - cycleDataReader.cxx \ - cycleDataStageReader.cxx \ - cycleDataStageWriter.cxx \ - cycleDataWriter.cxx \ - cyclerHolder.cxx \ - externalThread.cxx \ - genericThread.cxx \ - lightMutex.cxx \ - lightMutexDirect.cxx \ - lightMutexHolder.cxx \ - lightReMutex.cxx \ - lightReMutexDirect.cxx \ - lightReMutexHolder.cxx \ - mainThread.cxx \ - mutexDebug.cxx \ - mutexDirect.cxx \ - mutexHolder.cxx \ - mutexSimpleImpl.cxx \ - pipeline.cxx \ - pipelineCycler.cxx \ - pipelineCyclerDummyImpl.cxx \ - pipelineCyclerTrivialImpl.cxx \ - pipelineCyclerTrueImpl.cxx \ - pmutex.cxx \ - pythonThread.cxx \ - reMutex.cxx \ - reMutexDirect.cxx \ - reMutexHolder.cxx \ - psemaphore.cxx \ - thread.cxx \ - threadDummyImpl.cxx \ - threadPosixImpl.cxx \ - threadSimpleImpl.cxx \ - threadSimpleManager.cxx \ - threadWin32Impl.cxx \ - threadPriority.cxx - - #define INSTALL_HEADERS \ - asyncTaskBase.h asyncTaskBase.I \ - contextSwitch.h \ - blockerSimple.h blockerSimple.I \ - conditionVar.h conditionVar.I \ - conditionVarDebug.h conditionVarDebug.I \ - conditionVarDirect.h conditionVarDirect.I \ - conditionVarDummyImpl.h conditionVarDummyImpl.I \ - conditionVarFull.h conditionVarFull.I \ - conditionVarFullDebug.h conditionVarFullDebug.I \ - conditionVarFullDirect.h conditionVarFullDirect.I \ - conditionVarFullWin32Impl.h conditionVarFullWin32Impl.I \ - conditionVarImpl.h \ - conditionVarPosixImpl.h conditionVarPosixImpl.I \ - conditionVarWin32Impl.h conditionVarWin32Impl.I \ - conditionVarSimpleImpl.h conditionVarSimpleImpl.I \ - conditionVarSpinlockImpl.h conditionVarSpinlockImpl.I \ - config_pipeline.h \ - cycleData.h cycleData.I \ - cycleDataLockedReader.h cycleDataLockedReader.I \ - cycleDataLockedStageReader.h cycleDataLockedStageReader.I \ - cycleDataReader.h cycleDataReader.I \ - cycleDataStageReader.h cycleDataStageReader.I \ - cycleDataStageWriter.h cycleDataStageWriter.I \ - cycleDataWriter.h cycleDataWriter.I \ - cyclerHolder.h cyclerHolder.I \ - externalThread.h \ - genericThread.h genericThread.I \ - lightMutex.I lightMutex.h \ - lightMutexDirect.h lightMutexDirect.I \ - lightMutexHolder.I lightMutexHolder.h \ - lightReMutex.I lightReMutex.h \ - lightReMutexDirect.h lightReMutexDirect.I \ - lightReMutexHolder.I lightReMutexHolder.h \ - mainThread.h \ - mutexDebug.h mutexDebug.I \ - mutexDirect.h mutexDirect.I \ - mutexHolder.h mutexHolder.I \ - mutexSimpleImpl.h mutexSimpleImpl.I \ - mutexTrueImpl.h \ - pipeline.h pipeline.I \ - pipelineCycler.h pipelineCycler.I \ - pipelineCyclerLinks.h pipelineCyclerLinks.I \ - pipelineCyclerBase.h \ - pipelineCyclerDummyImpl.h pipelineCyclerDummyImpl.I \ - pipelineCyclerTrivialImpl.h pipelineCyclerTrivialImpl.I \ - pipelineCyclerTrueImpl.h pipelineCyclerTrueImpl.I \ - pmutex.h pmutex.I \ - pythonThread.h \ - reMutex.I reMutex.h \ - reMutexDirect.h reMutexDirect.I \ - reMutexHolder.I reMutexHolder.h \ - psemaphore.h psemaphore.I \ - thread.h thread.I threadImpl.h \ - threadDummyImpl.h threadDummyImpl.I \ - threadPosixImpl.h threadPosixImpl.I \ - threadSimpleImpl.h threadSimpleImpl.I \ - threadSimpleManager.h threadSimpleManager.I \ - threadWin32Impl.h threadWin32Impl.I \ - threadPriority.h - - #define IGATESCAN all - -#end lib_target - - -#begin test_bin_target - #define TARGET test_threaddata - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_threaddata.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_diners - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_diners.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_mutex - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_mutex.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_concurrency - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_concurrency.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_delete - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_delete.cxx - -#end test_bin_target - - -#begin test_bin_target - #define TARGET test_atomic - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_atomic.cxx - -#end test_bin_target - - - -#begin test_bin_target - #define TARGET test_setjmp - #define LOCAL_LIBS $[LOCAL_LIBS] p3pipeline - #define OTHER_LIBS \ - p3interrogatedb:c p3dconfig:c p3dtoolbase:c p3prc:c \ - p3dtoolutil:c p3dtool:m p3dtoolconfig:m p3pystub - - #define SOURCES \ - test_setjmp.cxx - -#end test_bin_target diff --git a/panda/src/pnmimage/Sources.pp b/panda/src/pnmimage/Sources.pp deleted file mode 100644 index 3b3863cb98..0000000000 --- a/panda/src/pnmimage/Sources.pp +++ /dev/null @@ -1,55 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define USE_PACKAGES zlib - -#begin lib_target - #define TARGET p3pnmimage - #define LOCAL_LIBS \ - p3linmath p3putil p3express p3mathutil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_pnmimage.h \ - convert_srgb.I convert_srgb.h \ - convert_srgb_sse2.cxx \ - pfmFile.I pfmFile.h \ - pfmFile_ext.cxx pfmFile_ext.h \ - pnmbitio.h \ - pnmBrush.h pnmBrush.I \ - pnmFileType.h pnmFileTypeRegistry.h pnmImage.I \ - pnmImage.h pnmImageHeader.I pnmImageHeader.h \ - pnmPainter.h pnmPainter.I \ - pnmReader.I \ - pnmReader.h pnmWriter.I pnmWriter.h pnmimage_base.h \ - ppmcmap.h - - #define INCLUDED_SOURCES \ - config_pnmimage.cxx \ - convert_srgb.cxx \ - pfmFile.cxx \ - pnm-image-filter.cxx \ - pnmbitio.cxx \ - pnmBrush.cxx \ - pnmFileType.cxx \ - pnmFileTypeRegistry.cxx pnmImage.cxx pnmImageHeader.cxx \ - pnmPainter.cxx \ - pnmReader.cxx pnmWriter.cxx pnmimage_base.cxx \ - ppmcmap.cxx - - #define INSTALL_HEADERS \ - config_pnmimage.h \ - convert_srgb.I convert_srgb.h \ - pfmFile.I pfmFile.h \ - pfmFile_ext.cxx pfmFile_ext.h \ - pnmBrush.h pnmBrush.I \ - pnmFileType.h pnmFileTypeRegistry.h pnmImage.I \ - pnmImage.h pnmImageHeader.I pnmImageHeader.h \ - pnmPainter.h pnmPainter.I \ - pnmReader.I \ - pnmReader.h pnmWriter.I pnmWriter.h pnmimage_base.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/pnmimagetypes/Sources.pp b/panda/src/pnmimagetypes/Sources.pp deleted file mode 100644 index 33b27fc712..0000000000 --- a/panda/src/pnmimagetypes/Sources.pp +++ /dev/null @@ -1,43 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define USE_PACKAGES jpeg png zlib tiff - -#begin lib_target - #define TARGET p3pnmimagetypes - #define LOCAL_LIBS \ - p3pnmimage - - #define COMBINED_SOURCES \ - $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_pnmimagetypes.h pnmFileTypeBMP.h \ - pnmFileTypeIMG.h \ - pnmFileTypePNG.h \ - pnmFileTypePNM.h \ - pnmFileTypePfm.h \ - pnmFileTypeSGI.h pnmFileTypeSoftImage.h \ - pnmFileTypeTGA.h \ - pnmFileTypeTIFF.h \ - pnmFileTypeJPG.h - - #define INCLUDED_SOURCES \ - config_pnmimagetypes.cxx \ - pnmFileTypeBMPReader.cxx pnmFileTypeBMPWriter.cxx \ - pnmFileTypeBMP.cxx \ - pnmFileTypeIMG.cxx \ - pnmFileTypeJPG.cxx pnmFileTypeJPGReader.cxx pnmFileTypeJPGWriter.cxx \ - pnmFileTypePNG.cxx \ - pnmFileTypePNM.cxx \ - pnmFileTypePfm.cxx \ - pnmFileTypeSGI.cxx \ - pnmFileTypeSGIReader.cxx pnmFileTypeSGIWriter.cxx \ - pnmFileTypeSoftImage.cxx \ - pnmFileTypeTIFF.cxx \ - pnmFileTypeTGA.cxx - - #define INSTALL_HEADERS \ - config_pnmimagetypes.h - -#end lib_target - diff --git a/panda/src/pnmtext/Sources.pp b/panda/src/pnmtext/Sources.pp deleted file mode 100644 index 73d07ca903..0000000000 --- a/panda/src/pnmtext/Sources.pp +++ /dev/null @@ -1,30 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_FREETYPE] -#define USE_PACKAGES freetype - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define USE_PACKAGES freetype - - #define TARGET p3pnmtext - #define LOCAL_LIBS \ - p3pnmimage p3putil p3linmath p3pipeline - - #define SOURCES \ - config_pnmtext.cxx config_pnmtext.h \ - freetypeFace.cxx freetypeFace.h freetypeFace.I \ - freetypeFont.cxx freetypeFont.h freetypeFont.I \ - pnmTextGlyph.cxx pnmTextGlyph.h pnmTextGlyph.I \ - pnmTextMaker.cxx pnmTextMaker.h pnmTextMaker.I - - #define INSTALL_HEADERS \ - config_pnmtext.h \ - freetypeFace.h freetypeFace.I \ - freetypeFont.h freetypeFont.I \ - pnmTextGlyph.h pnmTextGlyph.I \ - pnmTextMaker.h pnmTextMaker.I - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/pstatclient/Sources.pp b/panda/src/pstatclient/Sources.pp deleted file mode 100644 index 7ba3a7bee2..0000000000 --- a/panda/src/pstatclient/Sources.pp +++ /dev/null @@ -1,62 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define LOCAL_LIBS \ - p3net p3putil p3express - - #define TARGET p3pstatclient - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_pstats.h pStatClient.I pStatClient.h \ - pStatClientImpl.I pStatClientImpl.h \ - pStatClientVersion.I \ - pStatClientVersion.h pStatClientControlMessage.h \ - pStatCollector.I pStatCollector.h pStatCollectorDef.h \ - pStatCollectorForward.I pStatCollectorForward.h \ - pStatFrameData.I pStatFrameData.h pStatProperties.h \ - pStatServerControlMessage.h pStatThread.I pStatThread.h \ - pStatTimer.I pStatTimer.h - - #define INCLUDED_SOURCES \ - config_pstats.cxx pStatClient.cxx pStatClientImpl.cxx \ - pStatClientVersion.cxx \ - pStatClientControlMessage.cxx \ - pStatCollector.cxx \ - pStatCollectorDef.cxx \ - pStatCollectorForward.cxx \ - pStatFrameData.cxx pStatProperties.cxx \ - pStatServerControlMessage.cxx \ - pStatThread.cxx - - #define INSTALL_HEADERS \ - config_pstats.h pStatClient.I pStatClient.h \ - pStatClientImpl.I pStatClientImpl.h \ - pStatClientVersion.I pStatClientVersion.h \ - pStatClientControlMessage.h pStatCollector.I pStatCollector.h \ - pStatCollectorDef.h \ - pStatCollectorForward.I pStatCollectorForward.h \ - pStatFrameData.I pStatFrameData.h \ - pStatProperties.h \ - pStatServerControlMessage.h pStatThread.I pStatThread.h \ - pStatTimer.I pStatTimer.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define LOCAL_LIBS \ - p3pstatclient - #define OTHER_LIBS \ - $[OTHER_LIBS] p3pystub - - #define TARGET test_client - - #define SOURCES \ - test_client.cxx - -#end test_bin_target - diff --git a/panda/src/putil/Sources.pp b/panda/src/putil/Sources.pp deleted file mode 100644 index aea7e90733..0000000000 --- a/panda/src/putil/Sources.pp +++ /dev/null @@ -1,249 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define LOCAL_LIBS p3pipeline p3linmath p3express p3pandabase -#define USE_PACKAGES zlib - -#begin lib_target - #define TARGET p3putil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - animInterface.h animInterface.I \ - autoTextureScale.h \ - bam.h \ - bamCache.h bamCache.I \ - bamCacheIndex.h bamCacheIndex.I \ - bamCacheRecord.h bamCacheRecord.I \ - bamEnums.h \ - bamReader.I bamReader.N bamReader.h bamReaderParam.I \ - bamReaderParam.h \ - bamWriter.I bamWriter.h \ - bitArray.I bitArray.h \ - bitMask.I bitMask.h \ - buttonHandle.I buttonHandle.h \ - buttonMap.I buttonMap.h \ - buttonRegistry.I buttonRegistry.h \ - cachedTypedWritableReferenceCount.h cachedTypedWritableReferenceCount.I \ - callbackData.h callbackData.I \ - callbackObject.h callbackObject.I \ - callbackObject_ext.h callbackObject_ext.I \ - clockObject.h clockObject.I \ - colorSpace.h collideMask.h \ - copyOnWriteObject.h copyOnWriteObject.I \ - copyOnWritePointer.h copyOnWritePointer.I \ - compareTo.I compareTo.h \ - config_util.N config_util.h configurable.h \ - cPointerCallbackObject.h cPointerCallbackObject.I \ - datagramInputFile.I datagramInputFile.h \ - datagramOutputFile.I datagramOutputFile.h \ - doubleBitMask.I doubleBitMask.h \ - drawMask.h \ - factory.I factory.h \ - factoryBase.I factoryBase.h \ - factoryParam.I factoryParam.h factoryParams.I \ - factoryParams.h \ - firstOfPairCompare.I firstOfPairCompare.h \ - firstOfPairLess.I firstOfPairLess.h \ - globalPointerRegistry.I globalPointerRegistry.h \ - indirectCompareNames.I indirectCompareNames.h \ - indirectCompareSort.I indirectCompareSort.h \ - indirectCompareTo.I indirectCompareTo.h \ - ioPtaDatagramFloat.h ioPtaDatagramInt.h \ - ioPtaDatagramShort.h keyboardButton.h \ - linkedListNode.I linkedListNode.h \ - load_prc_file.h \ - loaderOptions.I loaderOptions.h \ - modifierButtons.I modifierButtons.h mouseButton.h \ - mouseData.I mouseData.h nameUniquifier.I nameUniquifier.h \ - nodeCachedReferenceCount.h nodeCachedReferenceCount.I \ - paramValue.I paramValue.h \ - pbitops.I pbitops.h \ - portalMask.h \ - pta_ushort.h \ - pythonCallbackObject.cxx \ - pythonCallbackObject.h pythonCallbackObject.I \ - simpleHashMap.I simpleHashMap.h \ - sparseArray.I sparseArray.h \ - timedCycle.I timedCycle.h typedWritable.I \ - typedWritable.h typedWritable_ext.h typedWritable_ext.cxx \ - typedWritableReferenceCount.I \ - typedWritableReferenceCount.h updateSeq.I updateSeq.h \ - uniqueIdAllocator.h \ - vector_typedWritable.h \ - vector_ushort.h vector_writable.h \ - writableConfigurable.h \ - writableParam.I writableParam.h - - #define INCLUDED_SOURCES \ - animInterface.cxx \ - autoTextureScale.cxx \ - bamCache.cxx \ - bamCacheIndex.cxx \ - bamCacheRecord.cxx \ - bamEnums.cxx \ - bamReader.cxx bamReaderParam.cxx \ - bamWriter.cxx \ - bitArray.cxx \ - bitMask.cxx \ - buttonHandle.cxx buttonMap.cxx buttonRegistry.cxx \ - cachedTypedWritableReferenceCount.cxx \ - callbackData.cxx \ - callbackObject.cxx \ - clockObject.cxx \ - colorSpace.cxx \ - config_util.cxx configurable.cxx \ - copyOnWriteObject.cxx \ - copyOnWritePointer.cxx \ - cPointerCallbackObject.cxx \ - datagramInputFile.cxx datagramOutputFile.cxx \ - doubleBitMask.cxx \ - factoryBase.cxx \ - factoryParam.cxx factoryParams.cxx \ - globalPointerRegistry.cxx \ - ioPtaDatagramFloat.cxx \ - ioPtaDatagramInt.cxx ioPtaDatagramShort.cxx \ - keyboardButton.cxx \ - linkedListNode.cxx \ - load_prc_file.cxx \ - loaderOptions.cxx \ - modifierButtons.cxx mouseButton.cxx mouseData.cxx \ - nameUniquifier.cxx \ - nodeCachedReferenceCount.cxx \ - paramValue.cxx \ - pbitops.cxx \ - pta_ushort.cxx \ - simpleHashMap.cxx \ - sparseArray.cxx \ - timedCycle.cxx typedWritable.cxx \ - typedWritableReferenceCount.cxx updateSeq.cxx \ - uniqueIdAllocator.cxx \ - vector_typedWritable.cxx \ - vector_ushort.cxx vector_writable.cxx \ - writableConfigurable.cxx writableParam.cxx - - #define INSTALL_HEADERS \ - animInterface.h animInterface.I \ - autoTextureScale.h \ - bam.h \ - bamCache.h bamCache.I \ - bamCacheIndex.h bamCacheIndex.I \ - bamCacheRecord.h bamCacheRecord.I \ - bamEnums.h \ - bamReader.I bamReader.h bamReaderParam.I bamReaderParam.h \ - bamWriter.I bamWriter.h \ - bitArray.I bitArray.h \ - bitMask.I bitMask.h \ - buttonHandle.I buttonHandle.h \ - buttonMap.I buttonMap.h \ - buttonRegistry.I buttonRegistry.h \ - cachedTypedWritableReferenceCount.h cachedTypedWritableReferenceCount.I \ - callbackData.h callbackData.I \ - callbackObject.h callbackObject.I \ - callbackObject_ext.h callbackObject_ext.I \ - clockObject.h clockObject.I \ - colorSpace.h collideMask.h \ - copyOnWriteObject.h copyOnWriteObject.I \ - copyOnWritePointer.h copyOnWritePointer.I \ - compareTo.I compareTo.h \ - config_util.h configurable.h \ - cPointerCallbackObject.h cPointerCallbackObject.I \ - datagramInputFile.I datagramInputFile.h \ - datagramOutputFile.I datagramOutputFile.h \ - doubleBitMask.I doubleBitMask.h \ - drawMask.h \ - factory.I factory.h \ - factoryBase.I factoryBase.h factoryParam.I factoryParam.h \ - factoryParams.I factoryParams.h \ - firstOfPairCompare.I firstOfPairCompare.h \ - firstOfPairLess.I firstOfPairLess.h \ - globalPointerRegistry.I globalPointerRegistry.h \ - indirectCompareNames.I indirectCompareNames.h \ - indirectCompareSort.I indirectCompareSort.h \ - indirectCompareTo.I indirectCompareTo.h \ - ioPtaDatagramFloat.h ioPtaDatagramInt.h \ - ioPtaDatagramShort.h iterator_types.h keyboardButton.h \ - linkedListNode.I linkedListNode.h \ - load_prc_file.h \ - loaderOptions.I loaderOptions.h \ - modifierButtons.I \ - modifierButtons.h mouseButton.h mouseData.I mouseData.h \ - nameUniquifier.I nameUniquifier.h \ - nodeCachedReferenceCount.h nodeCachedReferenceCount.I \ - paramValue.I paramValue.h \ - pbitops.I pbitops.h \ - portalMask.h \ - pta_ushort.h \ - pythonCallbackObject.h pythonCallbackObject.I \ - simpleHashMap.I simpleHashMap.h \ - sparseArray.I sparseArray.h \ - timedCycle.I timedCycle.h typedWritable.I \ - typedWritable.h typedWritable_ext.h typedWritableReferenceCount.I \ - typedWritableReferenceCount.h updateSeq.I updateSeq.h \ - uniqueIdAllocator.h \ - vector_typedWritable.h \ - vector_ushort.h vector_writable.h \ - writableConfigurable.h writableParam.I \ - writableParam.h - - #define IGATESCAN all - -#end lib_target - -#begin test_bin_target - #define TARGET test_bamRead - #define LOCAL_LIBS \ - p3putil p3pgraph - - #define SOURCES \ - test_bam.cxx test_bam.h test_bamRead.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_bamWrite - #define LOCAL_LIBS \ - p3putil p3pgraph - - #define SOURCES \ - test_bam.cxx test_bam.h test_bamWrite.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_filename - - #define SOURCES \ - test_filename.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_uniqueIdAllocator - - #define SOURCES \ - uniqueIdAllocator.cxx test_uniqueIdAllocator.cxx - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_glob - - #define SOURCES \ - test_glob.cxx - - #define LOCAL_LIBS $[LOCAL_LIBS] p3putil - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - -#end test_bin_target - -#begin test_bin_target - #define TARGET test_linestream - - #define SOURCES \ - test_linestream.cxx - - #define LOCAL_LIBS $[LOCAL_LIBS] p3putil - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - -#end test_bin_target diff --git a/panda/src/recorder/Sources.pp b/panda/src/recorder/Sources.pp deleted file mode 100644 index 4a6b1ca898..0000000000 --- a/panda/src/recorder/Sources.pp +++ /dev/null @@ -1,38 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c -#define LOCAL_LIBS p3dgraph p3putil p3express p3pandabase - -#begin lib_target - #define TARGET p3recorder - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_recorder.h \ - mouseRecorder.h \ - recorderBase.h recorderBase.I \ - recorderController.h recorderController.I \ - recorderFrame.h recorderFrame.I \ - recorderHeader.h recorderHeader.I \ - recorderTable.h recorderTable.I \ - socketStreamRecorder.h socketStreamRecorder.I - - #define INCLUDED_SOURCES \ - config_recorder.cxx \ - mouseRecorder.cxx \ - recorderBase.cxx recorderController.cxx \ - recorderFrame.cxx recorderHeader.cxx recorderTable.cxx \ - socketStreamRecorder.cxx - - #define INSTALL_HEADERS \ - mouseRecorder.h \ - recorderBase.h recorderBase.I \ - recorderController.h recorderController.I \ - recorderFrame.h recorderFrame.I \ - recorderHeader.h recorderHeader.I \ - recorderTable.h recorderTable.I \ - socketStreamRecorder.h socketStreamRecorder.I - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/rocket/Sources.pp b/panda/src/rocket/Sources.pp deleted file mode 100644 index ce23403691..0000000000 --- a/panda/src/rocket/Sources.pp +++ /dev/null @@ -1,40 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define USE_PACKAGES rocket -#define BUILD_DIRECTORY $[HAVE_ROCKET] - -#define BUILDING_DLL BUILDING_ROCKET - -#begin lib_target - #define TARGET p3rocket - #define LOCAL_LIBS \ - p3display p3pgraph p3gobj p3linmath p3putil p3dgraph p3text - - #define COMBINED_SOURCES p3rocket_composite1.cxx - - #define SOURCES \ - config_rocket.h \ - rocketFileInterface.h \ - rocketInputHandler.h \ - rocketRegion.h \ - $[if $[HAVE_ROCKET_PYTHON],rocketRegion_ext.cxx rocketRegion_ext.h] \ - rocketRenderInterface.h \ - rocketSystemInterface.h - - #define INCLUDED_SOURCES \ - config_rocket.cxx \ - rocketFileInterface.cxx \ - rocketInputHandler.cxx \ - rocketRegion.cxx \ - rocketRenderInterface.cxx \ - rocketSystemInterface.cxx - - #define INSTALL_HEADERS \ - config_rocket.h rocketRegion.h - -#if $[HAVE_ROCKET_PYTHON] - #define IGATESCAN rocketInputHandler.h rocketInputHandler.cxx rocketRegion.h rocketRegion.cxx rocketRegion_ext.h -#endif - -#end lib_target diff --git a/panda/src/skel/Sources.pp b/panda/src/skel/Sources.pp deleted file mode 100644 index 58d9c1a1d5..0000000000 --- a/panda/src/skel/Sources.pp +++ /dev/null @@ -1,31 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define USE_PACKAGES -#define BUILDING_DLL BUILDING_PANDASKEL - -#begin lib_target - #define TARGET p3skel - #define LOCAL_LIBS \ - p3display p3text p3pgraph p3gobj p3linmath p3putil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_skel.h \ - basicSkel.I basicSkel.h \ - typedSkel.I typedSkel.h - - #define INCLUDED_SOURCES \ - config_skel.cxx \ - basicSkel.cxx \ - typedSkel.cxx - - #define INSTALL_HEADERS \ - basicSkel.h basicSkel.I \ - typedSkel.I typedSkel.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/speedtree/Sources.pp b/panda/src/speedtree/Sources.pp deleted file mode 100644 index 9980b4219e..0000000000 --- a/panda/src/speedtree/Sources.pp +++ /dev/null @@ -1,56 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_SPEEDTREE] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define USE_PACKAGES speedtree $[if $[eq $[SPEEDTREE_API],OpenGL],gl cg cggl] $[if $[eq $[SPEEDTREE_API],DirectX9],dx9 cg cgdx9] -#define BUILDING_DLL BUILDING_PANDASPEEDTREE - -#begin lib_target - #define TARGET pandaspeedtree - #define LOCAL_LIBS \ - p3display p3text p3pgraph p3gobj p3linmath p3putil $[if $[eq $[SPEEDTREE_API],DirectX9],dxgsg9] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_speedtree.h \ - loaderFileTypeSrt.h \ - loaderFileTypeStf.h \ - speedtree_api.h \ - speedTreeNode.h speedTreeNode.I \ - stBasicTerrain.h stBasicTerrain.I \ - stTerrain.h stTerrain.I \ - stTransform.h stTransform.I \ - stTree.h stTree.I - - // A generated file - #define SOURCES $[SOURCES] speedtree_parameters.h - - #define INCLUDED_SOURCES \ - config_speedtree.cxx \ - loaderFileTypeSrt.cxx \ - loaderFileTypeStf.cxx \ - speedtree_api.cxx \ - speedTreeNode.cxx \ - stBasicTerrain.cxx \ - stTerrain.cxx \ - stTransform.cxx \ - stTree.cxx - - #define INSTALL_HEADERS \ - config_speedtree.h \ - speedtree_parameters.h \ - speedtree_api.h \ - speedTreeNode.h speedTreeNode.I \ - stBasicTerrain.h stBasicTerrain.I \ - stTerrain.h stTerrain.I \ - stTransform.h stTransform.I \ - stTree.h stTree.I - - #define IGATESCAN all - -#end lib_target - - -#include $[THISDIRPREFIX]speedtree_parameters.h.pp diff --git a/panda/src/speedtree/speedtree_parameters.h.pp b/panda/src/speedtree/speedtree_parameters.h.pp deleted file mode 100644 index 1810d68dd6..0000000000 --- a/panda/src/speedtree/speedtree_parameters.h.pp +++ /dev/null @@ -1,18 +0,0 @@ -// This file is read and processed by ppremake to generate -// speedtree_parameters.h, which is #included by speedtree_api.h. - -#output speedtree_parameters.h notouch -/* speedtree_parameters.h. Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. */ -/********************************** DO NOT EDIT ****************************/ - -/* We need to define the appropriate macro to tell the SpeedTree - headers which API we intend to use. This should be one of - SPEEDTREE_OPENGL or SPEEDTREE_DIRECTX9 (or, when Panda supports it, - SPEEDTREE_DIRECTX10). */ -# define SPEEDTREE_$[upcase $[SPEEDTREE_API]] - -/* The default directory in which to search for SpeedTree's provided - shaders and terrain files. */ -# define SPEEDTREE_BIN_DIR "$[SPEEDTREE_BIN_DIR]" - -#end speedtree_parameters.h diff --git a/panda/src/testbed/Sources.pp b/panda/src/testbed/Sources.pp deleted file mode 100644 index 0b6082d095..0000000000 --- a/panda/src/testbed/Sources.pp +++ /dev/null @@ -1,40 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3pystub - -#define USE_PACKAGES cg freetype - -#define LOCAL_LIBS \ - p3framework p3putil p3collide p3pgraph p3chan p3text \ - p3pnmimage p3pnmimagetypes p3pnmtext p3event p3gobj p3display \ - p3mathutil p3putil p3express p3dgraph p3device p3tform \ - p3linmath p3pstatclient panda - -#begin bin_target - #define TARGET pview - - #define SOURCES \ - pview.cxx -#end bin_target - -#begin test_bin_target - #define TARGET pgrid - - #define SOURCES \ - pgrid.cxx - #define UNIX_SYS_LIBS m -#end test_bin_target - -#begin test_bin_target - #define TARGET test_lod - #define SOURCES test_lod.cxx -#end test_bin_target - -#begin test_bin_target - #define TARGET test_texmem - #define SOURCES test_texmem.cxx -#end test_bin_target - -#begin test_bin_target - #define TARGET test_map - #define SOURCES test_map.cxx -#end test_bin_target diff --git a/panda/src/text/Sources.pp b/panda/src/text/Sources.pp deleted file mode 100644 index 26768cf47c..0000000000 --- a/panda/src/text/Sources.pp +++ /dev/null @@ -1,68 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define USE_PACKAGES freetype zlib - - #define TARGET p3text - #define LOCAL_LIBS \ - p3putil p3gobj p3pgraph p3linmath \ - p3pnmtext p3pnmimage p3gsgbase p3mathutil \ - p3parametrics - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_text.h \ - default_font.h \ - dynamicTextFont.I dynamicTextFont.h \ - dynamicTextGlyph.I dynamicTextGlyph.h \ - dynamicTextPage.I dynamicTextPage.h \ - fontPool.I fontPool.h \ - geomTextGlyph.I geomTextGlyph.h \ - staticTextFont.I staticTextFont.h \ - textAssembler.I textAssembler.h \ - textFont.I textFont.h \ - textGlyph.I textGlyph.h \ - textGraphic.I textGraphic.h \ - textNode.I textNode.h \ - textProperties.I textProperties.h \ - textPropertiesManager.I textPropertiesManager.h - - #define INCLUDED_SOURCES \ - config_text.cxx \ - default_font.cxx \ - dynamicTextFont.cxx \ - dynamicTextGlyph.cxx \ - dynamicTextPage.cxx \ - fontPool.cxx \ - geomTextGlyph.cxx \ - staticTextFont.cxx \ - textAssembler.cxx \ - textFont.cxx textGlyph.cxx \ - textGraphic.cxx \ - textNode.cxx \ - textProperties.cxx \ - textPropertiesManager.cxx \ - cmss12.bam_src.c cmss12.bam.pz_src.c persans.ttf_src.c - - #define INSTALL_HEADERS \ - config_text.h \ - dynamicTextFont.I dynamicTextFont.h \ - dynamicTextGlyph.I dynamicTextGlyph.h \ - dynamicTextPage.I dynamicTextPage.h \ - fontPool.I fontPool.h \ - geomTextGlyph.I geomTextGlyph.h \ - staticTextFont.I staticTextFont.h \ - textAssembler.I textAssembler.h \ - textFont.I textFont.h \ - textGlyph.I textGlyph.h \ - textGraphic.I textGraphic.h \ - textNode.I textNode.h \ - textProperties.I textProperties.h \ - textPropertiesManager.I textPropertiesManager.h - - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/text/dynamicTextFont.I b/panda/src/text/dynamicTextFont.I index 30efec424b..d8af7dc340 100644 --- a/panda/src/text/dynamicTextFont.I +++ b/panda/src/text/dynamicTextFont.I @@ -260,8 +260,18 @@ get_poly_margin() const { //////////////////////////////////////////////////////////////////// INLINE void DynamicTextFont:: set_page_size(int x_size, int y_size) { - _page_x_size = x_size; - _page_y_size = y_size; + _page_size.set(x_size, y_size); +} + +//////////////////////////////////////////////////////////////////// +// Function: DynamicTextFont::get_page_size +// Access: Published +// Description: Returns the size of the textures that are created +// for the DynamicTextFont. See set_page_size(). +//////////////////////////////////////////////////////////////////// +INLINE const LVecBase2i &DynamicTextFont:: +get_page_size() const { + return _page_size; } //////////////////////////////////////////////////////////////////// @@ -272,7 +282,7 @@ set_page_size(int x_size, int y_size) { //////////////////////////////////////////////////////////////////// INLINE int DynamicTextFont:: get_page_x_size() const { - return _page_x_size; + return _page_size.get_x(); } //////////////////////////////////////////////////////////////////// @@ -283,7 +293,7 @@ get_page_x_size() const { //////////////////////////////////////////////////////////////////// INLINE int DynamicTextFont:: get_page_y_size() const { - return _page_y_size; + return _page_size.get_y(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/text/dynamicTextFont.cxx b/panda/src/text/dynamicTextFont.cxx index c089926002..514b4660a7 100644 --- a/panda/src/text/dynamicTextFont.cxx +++ b/panda/src/text/dynamicTextFont.cxx @@ -44,6 +44,8 @@ #include "nurbsCurveResult.h" //#include "renderModeAttrib.h" //#include "antialiasAttrib.h" +#include "colorAttrib.h" +#include "textureAttrib.h" TypeHandle DynamicTextFont::_type_handle; @@ -110,8 +112,7 @@ DynamicTextFont(const DynamicTextFont ©) : FreetypeFont(copy), _texture_margin(copy._texture_margin), _poly_margin(copy._poly_margin), - _page_x_size(copy._page_x_size), - _page_y_size(copy._page_y_size), + _page_size(copy._page_size), _minfilter(copy._minfilter), _magfilter(copy._magfilter), _anisotropic_degree(copy._anisotropic_degree), @@ -194,8 +195,8 @@ garbage_collect() { Cache new_cache; Cache::iterator ci; for (ci = _cache.begin(); ci != _cache.end(); ++ci) { - DynamicTextGlyph *glyph = (*ci).second; - if (glyph == (DynamicTextGlyph *)NULL || glyph->_geom_count != 0) { + TextGlyph *glyph = (*ci).second; + if (glyph == (TextGlyph *)NULL || glyph->get_ref_count() > 1) { // Keep this one. new_cache.insert(new_cache.end(), (*ci)); } else { @@ -252,7 +253,7 @@ write(ostream &out, int indent_level) const { Cache::const_iterator ci; for (ci = _cache.begin(); ci != _cache.end(); ++ci) { int glyph_index = (*ci).first; - DynamicTextGlyph *glyph = (*ci).second; + TextGlyph *glyph = (*ci).second; indent(out, indent_level + 2) << glyph_index; @@ -269,7 +270,7 @@ write(ostream &out, int indent_level) const { } release_face(face); - out << ", count = " << glyph->_geom_count << "\n"; + out << '\n'; } } @@ -285,7 +286,7 @@ write(ostream &out, int indent_level) const { // printable glyph. //////////////////////////////////////////////////////////////////// bool DynamicTextFont:: -get_glyph(int character, const TextGlyph *&glyph) { +get_glyph(int character, CPT(TextGlyph) &glyph) { if (!_is_valid) { glyph = (TextGlyph *)NULL; return false; @@ -302,12 +303,12 @@ get_glyph(int character, const TextGlyph *&glyph) { if (ci != _cache.end()) { glyph = (*ci).second; } else { - DynamicTextGlyph *dynamic_glyph = make_glyph(character, face, glyph_index); + TextGlyph *dynamic_glyph = make_glyph(character, face, glyph_index); _cache.insert(Cache::value_type(glyph_index, dynamic_glyph)); glyph = dynamic_glyph; } - if (glyph == (DynamicTextGlyph *)NULL) { + if (glyph == (TextGlyph *)NULL) { glyph = get_invalid_glyph(); glyph_index = 0; } @@ -327,8 +328,7 @@ void DynamicTextFont:: initialize() { _texture_margin = text_texture_margin; _poly_margin = text_poly_margin; - _page_x_size = text_page_size[0]; - _page_y_size = text_page_size[1]; + _page_size.set(text_page_size[0], text_page_size[1]); // We don't necessarily want to use mipmaps, since we don't want to // regenerate those every time the texture changes, but we probably @@ -442,10 +442,10 @@ determine_tex_format() { // newly-created TextGlyph object, or NULL if the // glyph cannot be created for some reason. //////////////////////////////////////////////////////////////////// -DynamicTextGlyph *DynamicTextFont:: +TextGlyph *DynamicTextFont:: make_glyph(int character, FT_Face face, int glyph_index) { if (!load_glyph(face, glyph_index, false)) { - return (DynamicTextGlyph *)NULL; + return (TextGlyph *)NULL; } FT_GlyphSlot slot = face->glyph; @@ -461,6 +461,7 @@ make_glyph(int character, FT_Face face, int glyph_index) { } PN_stdfloat advance = slot->advance.x / 64.0; + advance /= _font_pixels_per_unit; if (_render_mode != RM_texture && slot->format == ft_glyph_format_outline) { @@ -520,8 +521,8 @@ make_glyph(int character, FT_Face face, int glyph_index) { _contours.clear(); FT_Outline_Decompose(&slot->outline, &funcs, (void *)this); - PT(DynamicTextGlyph) glyph = - new DynamicTextGlyph(character, advance / _font_pixels_per_unit); + PT(TextGlyph) glyph = + new TextGlyph(character, advance); switch (_render_mode) { case RM_wireframe: render_wireframe_contours(glyph); @@ -553,8 +554,8 @@ make_glyph(int character, FT_Face face, int glyph_index) { if (bitmap.width == 0 || bitmap.rows == 0) { // If we got an empty bitmap, it's a special case. - PT(DynamicTextGlyph) glyph = - new DynamicTextGlyph(character, advance / _font_pixels_per_unit); + PT(TextGlyph) glyph = + new TextGlyph(character, advance); _empty_glyphs.push_back(glyph); return glyph; @@ -571,7 +572,7 @@ make_glyph(int character, FT_Face face, int glyph_index) { // If the bitmap produced from the font doesn't require scaling // or any other processing before it goes to the texture, we can // just copy it directly into the texture. - glyph = slot_glyph(character, bitmap.width, bitmap.rows); + glyph = slot_glyph(character, bitmap.width, bitmap.rows, advance); copy_bitmap_to_texture(bitmap, glyph); } else { @@ -599,7 +600,7 @@ make_glyph(int character, FT_Face face, int glyph_index) { int_y_size += outline * 2; tex_x_size += outline * 2; tex_y_size += outline * 2; - glyph = slot_glyph(character, int_x_size, int_y_size); + glyph = slot_glyph(character, int_x_size, int_y_size, advance); if (outline != 0) { // Pad the glyph image to make room for the outline. @@ -612,11 +613,43 @@ make_glyph(int character, FT_Face face, int glyph_index) { } } - glyph->make_geom((int)floor(slot->bitmap_top + outline * _scale_factor + 0.5f), - (int)floor(slot->bitmap_left - outline * _scale_factor + 0.5f), - advance, _poly_margin, - tex_x_size, tex_y_size, - _font_pixels_per_unit, _tex_pixels_per_unit); + DynamicTextPage *page = glyph->get_page(); + if (page != NULL) { + int bitmap_top = (int)floor(slot->bitmap_top + outline * _scale_factor + 0.5f); + int bitmap_left = (int)floor(slot->bitmap_left - outline * _scale_factor + 0.5f); + + tex_x_size += glyph->_margin * 2; + tex_y_size += glyph->_margin * 2; + + // Determine the corners of the rectangle in geometric units. + PN_stdfloat tex_poly_margin = _poly_margin / _tex_pixels_per_unit; + PN_stdfloat origin_y = bitmap_top / _font_pixels_per_unit; + PN_stdfloat origin_x = bitmap_left / _font_pixels_per_unit; + + LVecBase4 dimensions( + origin_x - tex_poly_margin, + origin_y - tex_y_size / _tex_pixels_per_unit - tex_poly_margin, + origin_x + tex_x_size / _tex_pixels_per_unit + tex_poly_margin, + origin_y + tex_poly_margin); + + // And the corresponding corners in UV units. We add 0.5f to center + // the UV in the middle of its texel, to minimize roundoff errors + // when we are close to 1-to-1 pixel size. + LVecBase2i page_size = page->get_size(); + LVecBase4 texcoords( + ((PN_stdfloat)(glyph->_x - _poly_margin) + 0.5f) / page_size[0], + 1.0f - ((PN_stdfloat)(glyph->_y + _poly_margin + tex_y_size) + 0.5f) / page_size[1], + ((PN_stdfloat)(glyph->_x + _poly_margin + tex_x_size) + 0.5f) / page_size[0], + 1.0f - ((PN_stdfloat)(glyph->_y - _poly_margin) + 0.5f) / page_size[1]); + + CPT(RenderState) state; + state = RenderState::make(TextureAttrib::make(page), + TransparencyAttrib::make(TransparencyAttrib::M_alpha)); + state = state->add_attrib(ColorAttrib::make_flat(LColor(1.0f, 1.0f, 1.0f, 1.0f)), -1); + + glyph->set_quad(dimensions, texcoords, state); + } + return glyph; } } @@ -835,7 +868,7 @@ blend_pnmimage_to_texture(const PNMImage &image, DynamicTextGlyph *glyph, // filled in yet except with its size. //////////////////////////////////////////////////////////////////// DynamicTextGlyph *DynamicTextFont:: -slot_glyph(int character, int x_size, int y_size) { +slot_glyph(int character, int x_size, int y_size, PN_stdfloat advance) { // Increase the indicated size by the current margin. x_size += _texture_margin * 2; y_size += _texture_margin * 2; @@ -850,7 +883,7 @@ slot_glyph(int character, int x_size, int y_size) { do { DynamicTextPage *page = _pages[pi]; - DynamicTextGlyph *glyph = page->slot_glyph(character, x_size, y_size, _texture_margin); + DynamicTextGlyph *glyph = page->slot_glyph(character, x_size, y_size, _texture_margin, advance); if (glyph != (DynamicTextGlyph *)NULL) { // Once we found a page to hold the glyph, that becomes our // new preferred page. @@ -874,7 +907,7 @@ slot_glyph(int character, int x_size, int y_size) { // glyphs? if (garbage_collect() != 0) { // Yes, we just freed up some space. Try once more, recursively. - return slot_glyph(character, x_size, y_size); + return slot_glyph(character, x_size, y_size, advance); } else { // No good; all recorded glyphs are actually in use. We need to @@ -882,7 +915,7 @@ slot_glyph(int character, int x_size, int y_size) { _preferred_page = _pages.size(); PT(DynamicTextPage) page = new DynamicTextPage(this, _preferred_page); _pages.push_back(page); - return page->slot_glyph(character, x_size, y_size, _texture_margin); + return page->slot_glyph(character, x_size, y_size, _texture_margin, advance); } } @@ -893,7 +926,7 @@ slot_glyph(int character, int x_size, int y_size) { // geometry, as a wireframe render. //////////////////////////////////////////////////////////////////// void DynamicTextFont:: -render_wireframe_contours(DynamicTextGlyph *glyph) { +render_wireframe_contours(TextGlyph *glyph) { PT(GeomVertexData) vdata = new GeomVertexData (string(), GeomVertexFormat::get_v3(), Geom::UH_static); @@ -926,7 +959,7 @@ render_wireframe_contours(DynamicTextGlyph *glyph) { // geometry, as a polygon render. //////////////////////////////////////////////////////////////////// void DynamicTextFont:: -render_polygon_contours(DynamicTextGlyph *glyph, bool face, bool extrude) { +render_polygon_contours(TextGlyph *glyph, bool face, bool extrude) { PT(GeomVertexData) vdata = new GeomVertexData (string(), GeomVertexFormat::get_v3n3(), Geom::UH_static); diff --git a/panda/src/text/dynamicTextFont.h b/panda/src/text/dynamicTextFont.h index 8c0e84d4e6..355f15ee43 100644 --- a/panda/src/text/dynamicTextFont.h +++ b/panda/src/text/dynamicTextFont.h @@ -74,6 +74,7 @@ PUBLISHED: INLINE PN_stdfloat get_poly_margin() const; INLINE void set_page_size(int x_size, int y_size); + INLINE const LVecBase2i &get_page_size() const; INLINE int get_page_x_size() const; INLINE int get_page_y_size() const; @@ -110,21 +111,21 @@ PUBLISHED: virtual void write(ostream &out, int indent_level) const; public: - virtual bool get_glyph(int character, const TextGlyph *&glyph); + virtual bool get_glyph(int character, CPT(TextGlyph) &glyph); private: void initialize(); void update_filters(); void determine_tex_format(); - DynamicTextGlyph *make_glyph(int character, FT_Face face, int glyph_index); + TextGlyph *make_glyph(int character, FT_Face face, int glyph_index); void copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph); void copy_pnmimage_to_texture(const PNMImage &image, DynamicTextGlyph *glyph); void blend_pnmimage_to_texture(const PNMImage &image, DynamicTextGlyph *glyph, const LColor &fg); - DynamicTextGlyph *slot_glyph(int character, int x_size, int y_size); + DynamicTextGlyph *slot_glyph(int character, int x_size, int y_size, PN_stdfloat advance); - void render_wireframe_contours(DynamicTextGlyph *glyph); - void render_polygon_contours(DynamicTextGlyph *glyph, bool face, bool extrude); + void render_wireframe_contours(TextGlyph *glyph); + void render_polygon_contours(TextGlyph *glyph, bool face, bool extrude); static int outline_move_to(const FT_Vector *to, void *user); static int outline_line_to(const FT_Vector *to, void *user); @@ -137,7 +138,7 @@ private: int _texture_margin; PN_stdfloat _poly_margin; - int _page_x_size, _page_y_size; + LVecBase2i _page_size; SamplerState::FilterType _minfilter; SamplerState::FilterType _magfilter; @@ -159,14 +160,14 @@ private: // This doesn't need to be a reference-counting pointer, because the // reference to each glyph is kept by the DynamicTextPage object. - typedef pmap Cache; + typedef pmap Cache; Cache _cache; // This is a list of the glyphs that do not have any printable // properties (e.g. space), but still have an advance measure. We // store them here to keep their reference counts; they also appear // in the above table. - typedef pvector< PT(DynamicTextGlyph) > EmptyGlyphs; + typedef pvector< PT(TextGlyph) > EmptyGlyphs; EmptyGlyphs _empty_glyphs; class ContourPoint { diff --git a/panda/src/text/dynamicTextGlyph.I b/panda/src/text/dynamicTextGlyph.I index 4f6e589d03..0839f56492 100644 --- a/panda/src/text/dynamicTextGlyph.I +++ b/panda/src/text/dynamicTextGlyph.I @@ -21,16 +21,13 @@ //////////////////////////////////////////////////////////////////// INLINE DynamicTextGlyph:: DynamicTextGlyph(int character, DynamicTextPage *page, int x, int y, - int x_size, int y_size, int margin) : - TextGlyph(character), + int x_size, int y_size, int margin, PN_stdfloat advance) : + TextGlyph(character, advance), _page(page), _x(x), _y(y), _x_size(x_size), _y_size(y_size), - _margin(margin), - _top(0), _left(0), _bottom(0), _right(0), - _uv_top(0), _uv_left(0), _uv_bottom(0), _uv_right(0) + _margin(margin) { - _geom_count = 0; } //////////////////////////////////////////////////////////////////// @@ -42,14 +39,12 @@ DynamicTextGlyph(int character, DynamicTextPage *page, int x, int y, //////////////////////////////////////////////////////////////////// INLINE DynamicTextGlyph:: DynamicTextGlyph(int character, PN_stdfloat advance) : - TextGlyph(character), + TextGlyph(character, advance), _page((DynamicTextPage *)NULL), _x(0), _y(0), _x_size(0), _y_size(0), _margin(0) { - _advance = advance; - _geom_count = 1; } //////////////////////////////////////////////////////////////////// @@ -105,17 +100,6 @@ intersects(int x, int y, int x_size, int y_size) const { y >= mbot || hbot <= _y); } -//////////////////////////////////////////////////////////////////// -// Function: DynamicTextGlyph::get_top -// Access: Published -// Description: Returns the vertex coordinates that can be used when -// creating a custom text renderer. -//////////////////////////////////////////////////////////////////// -INLINE PN_stdfloat DynamicTextGlyph:: -get_top() const { - return _top; -} - //////////////////////////////////////////////////////////////////// // Function: DynamicTextGlyph::get_left // Access: Published @@ -124,7 +108,7 @@ get_top() const { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: get_left() const { - return _left; + return _quad_dimensions[0]; } //////////////////////////////////////////////////////////////////// @@ -135,7 +119,7 @@ get_left() const { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: get_bottom() const { - return _bottom; + return _quad_dimensions[1]; } //////////////////////////////////////////////////////////////////// @@ -146,18 +130,18 @@ get_bottom() const { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: get_right() const { - return _right; + return _quad_dimensions[2]; } //////////////////////////////////////////////////////////////////// -// Function: DynamicTextGlyph::get_uv_top +// Function: DynamicTextGlyph::get_top // Access: Published -// Description: Returns the UV coordinates that can be used when +// Description: Returns the vertex coordinates that can be used when // creating a custom text renderer. //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: -get_uv_top() const { - return _uv_top; +get_top() const { + return _quad_dimensions[3]; } //////////////////////////////////////////////////////////////////// @@ -168,7 +152,7 @@ get_uv_top() const { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: get_uv_left() const { - return _uv_left; + return _quad_texcoords[0]; } //////////////////////////////////////////////////////////////////// @@ -179,7 +163,7 @@ get_uv_left() const { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: get_uv_bottom() const { - return _uv_bottom; + return _quad_texcoords[1]; } //////////////////////////////////////////////////////////////////// @@ -190,5 +174,16 @@ get_uv_bottom() const { //////////////////////////////////////////////////////////////////// INLINE PN_stdfloat DynamicTextGlyph:: get_uv_right() const { - return _uv_right; + return _quad_texcoords[2]; +} + +//////////////////////////////////////////////////////////////////// +// Function: DynamicTextGlyph::get_uv_top +// Access: Published +// Description: Returns the UV coordinates that can be used when +// creating a custom text renderer. +//////////////////////////////////////////////////////////////////// +INLINE PN_stdfloat DynamicTextGlyph:: +get_uv_top() const { + return _quad_texcoords[3]; } diff --git a/panda/src/text/dynamicTextGlyph.cxx b/panda/src/text/dynamicTextGlyph.cxx index 3702d0e866..ac1c3a40f1 100644 --- a/panda/src/text/dynamicTextGlyph.cxx +++ b/panda/src/text/dynamicTextGlyph.cxx @@ -87,118 +87,6 @@ erase(DynamicTextFont *font) { font->get_bg()); } -//////////////////////////////////////////////////////////////////// -// Function: DynamicTextGlyph::make_geom -// Access: Public -// Description: Creates the actual geometry for the glyph. The -// parameters bitmap_top and bitmap_left are from -// FreeType, and indicate the position of the top left -// corner of the bitmap relative to the glyph's origin. -// The advance number represents the number of pixels -// the pen should be advanced after drawing this glyph. -//////////////////////////////////////////////////////////////////// -void DynamicTextGlyph:: -make_geom(int bitmap_top, int bitmap_left, PN_stdfloat advance, PN_stdfloat poly_margin, - PN_stdfloat tex_x_size, PN_stdfloat tex_y_size, - PN_stdfloat font_pixels_per_unit, PN_stdfloat tex_pixels_per_unit) { - nassertv(_page != (DynamicTextPage *)NULL); - - // This function should not be called twice. - nassertv(_geom_count == 0); - - tex_x_size += _margin * 2; - tex_y_size += _margin * 2; - - // Determine the corners of the rectangle in geometric units. - PN_stdfloat tex_poly_margin = poly_margin / tex_pixels_per_unit; - PN_stdfloat origin_y = bitmap_top / font_pixels_per_unit; - PN_stdfloat origin_x = bitmap_left / font_pixels_per_unit; - _top = origin_y + tex_poly_margin; - _left = origin_x - tex_poly_margin; - _bottom = origin_y - tex_y_size / tex_pixels_per_unit - tex_poly_margin; - _right = origin_x + tex_x_size / tex_pixels_per_unit + tex_poly_margin; - - // And the corresponding corners in UV units. We add 0.5f to center - // the UV in the middle of its texel, to minimize roundoff errors - // when we are close to 1-to-1 pixel size. - _uv_top = 1.0f - ((PN_stdfloat)(_y - poly_margin) + 0.5f) / _page->get_y_size(); - _uv_left = ((PN_stdfloat)(_x - poly_margin) + 0.5f) / _page->get_x_size(); - _uv_bottom = 1.0f - ((PN_stdfloat)(_y + poly_margin + tex_y_size) + 0.5f) / _page->get_y_size(); - _uv_right = ((PN_stdfloat)(_x + poly_margin + tex_x_size) + 0.5f) / _page->get_x_size(); - - // Create a corresponding triangle pair. We use a pair of indexed - // triangles rather than a single triangle strip, to avoid the bad - // vertex duplication behavior with lots of two-triangle strips. - PT(GeomVertexData) vdata = new GeomVertexData - (string(), GeomVertexFormat::get_v3t2(), - Geom::UH_static); - vdata->unclean_set_num_rows(4); - - GeomVertexWriter vertex(vdata, InternalName::get_vertex()); - GeomVertexWriter texcoord(vdata, InternalName::get_texcoord()); - - vertex.add_data3(_left, 0, _top); - vertex.add_data3(_left, 0, _bottom); - vertex.add_data3(_right, 0, _top); - vertex.add_data3(_right, 0, _bottom); - - texcoord.add_data2(_uv_left, _uv_top); - texcoord.add_data2(_uv_left, _uv_bottom); - texcoord.add_data2(_uv_right, _uv_top); - texcoord.add_data2(_uv_right, _uv_bottom); - - PT(GeomTriangles) tris = new GeomTriangles(Geom::UH_static); - tris->reserve_num_vertices(6); - tris->add_vertex(0); - tris->add_vertex(1); - tris->add_vertex(2); - tris->close_primitive(); - tris->add_vertex(2); - tris->add_vertex(1); - tris->add_vertex(3); - tris->close_primitive(); - - PT(Geom) geom = new GeomTextGlyph(this, vdata); - geom->add_primitive(tris); - _geom = geom; - - // The above will increment our _geom_count to 1. Reset it back - // down to 0, since our own internal Geom doesn't count. - nassertv(_geom_count == 1); - _geom_count--; - - _state = RenderState::make(TextureAttrib::make(_page), - TransparencyAttrib::make(TransparencyAttrib::M_alpha)); - _state = _state->add_attrib(ColorAttrib::make_flat(LColor(1.0f, 1.0f, 1.0f, 1.0f)), -1); - - _advance = advance / font_pixels_per_unit; -} - -//////////////////////////////////////////////////////////////////// -// Function: DynamicTextGlyph::set_geom -// Access: Public -// Description: Sets the geom from a pre-built object. -//////////////////////////////////////////////////////////////////// -void DynamicTextGlyph:: -set_geom(GeomVertexData *vdata, GeomPrimitive *prim, - const RenderState *state) { - // This function is called when _geom_count = 1, because it was - // constructed via the empty Glyph constructor. - nassertv(_geom_count == 1); - _geom_count--; - - PT(Geom) geom = new GeomTextGlyph(this, vdata); - geom->add_primitive(prim); - _geom = geom; - - // The above will increment our _geom_count to 1. Reset it back - // down to 0, since our own internal Geom doesn't count. - nassertv(_geom_count == 1); - _geom_count--; - - _state = state; -} - //////////////////////////////////////////////////////////////////// // Function: DynamicTextGlyph::is_whitespace // Access: Public, Virtual diff --git a/panda/src/text/dynamicTextGlyph.h b/panda/src/text/dynamicTextGlyph.h index 08dc4094c4..39fdec65c2 100644 --- a/panda/src/text/dynamicTextGlyph.h +++ b/panda/src/text/dynamicTextGlyph.h @@ -35,7 +35,7 @@ class EXPCL_PANDA_TEXT DynamicTextGlyph : public TextGlyph { public: INLINE DynamicTextGlyph(int character, DynamicTextPage *page, int x, int y, int x_size, int y_size, - int margin); + int margin, PN_stdfloat advance); INLINE DynamicTextGlyph(int character, PN_stdfloat advance); private: INLINE DynamicTextGlyph(const DynamicTextGlyph ©); @@ -48,34 +48,28 @@ PUBLISHED: INLINE bool intersects(int x, int y, int x_size, int y_size) const; - INLINE PN_stdfloat get_top() const; INLINE PN_stdfloat get_left() const; INLINE PN_stdfloat get_bottom() const; INLINE PN_stdfloat get_right() const; + INLINE PN_stdfloat get_top() const; - INLINE PN_stdfloat get_uv_top() const; INLINE PN_stdfloat get_uv_left() const; INLINE PN_stdfloat get_uv_bottom() const; INLINE PN_stdfloat get_uv_right() const; + INLINE PN_stdfloat get_uv_top() const; public: unsigned char *get_row(int y); void erase(DynamicTextFont *font); - void make_geom(int top, int left, PN_stdfloat advance, PN_stdfloat poly_margin, - PN_stdfloat tex_x_size, PN_stdfloat tex_y_size, - PN_stdfloat font_pixels_per_unit, PN_stdfloat tex_pixels_per_unit); - void set_geom(GeomVertexData *vdata, GeomPrimitive *prim, - const RenderState *state); virtual bool is_whitespace() const; DynamicTextPage *_page; - int _geom_count; int _x, _y; int _x_size, _y_size; int _margin; - PN_stdfloat _top, _left, _bottom, _right; - PN_stdfloat _uv_top, _uv_left, _uv_bottom, _uv_right; + + friend class DynamicTextFont; public: static TypeHandle get_class_type() { diff --git a/panda/src/text/dynamicTextPage.I b/panda/src/text/dynamicTextPage.I index 64edd02a80..394e34436b 100644 --- a/panda/src/text/dynamicTextPage.I +++ b/panda/src/text/dynamicTextPage.I @@ -13,6 +13,16 @@ //////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// Function: DynamicTextPage::get_size +// Access: Published +// Description: Returns the size of the page (texture), in pixels. +//////////////////////////////////////////////////////////////////// +INLINE const LVecBase2i &DynamicTextPage:: +get_size() const { + return _size; +} + //////////////////////////////////////////////////////////////////// // Function: DynamicTextPage::get_x_size // Access: Published @@ -20,7 +30,7 @@ //////////////////////////////////////////////////////////////////// INLINE int DynamicTextPage:: get_x_size() const { - return _x_size; + return _size.get_x(); } //////////////////////////////////////////////////////////////////// @@ -30,10 +40,9 @@ get_x_size() const { //////////////////////////////////////////////////////////////////// INLINE int DynamicTextPage:: get_y_size() const { - return _y_size; + return _size.get_y(); } - //////////////////////////////////////////////////////////////////// // Function: DynamicTextPage::is_empty // Access: Published diff --git a/panda/src/text/dynamicTextPage.cxx b/panda/src/text/dynamicTextPage.cxx index f42063c0fd..d145751481 100644 --- a/panda/src/text/dynamicTextPage.cxx +++ b/panda/src/text/dynamicTextPage.cxx @@ -38,10 +38,9 @@ DynamicTextPage(DynamicTextFont *font, int page_number) : // doesn't usually have a high fill factor. set_quality_level(text_quality_level); - _x_size = _font->get_page_x_size(); - _y_size = _font->get_page_y_size(); + _size = _font->get_page_size(); - setup_2d_texture(_x_size, _y_size, T_unsigned_byte, font->get_tex_format()); + setup_2d_texture(_size[0], _size[1], T_unsigned_byte, font->get_tex_format()); // Assign a name to the Texture. ostringstream strm; @@ -63,7 +62,7 @@ DynamicTextPage(DynamicTextFont *font, int page_number) : set_border_color(font->get_bg()); // Fill the page with the font's background color. - fill_region(0, 0, _x_size, _y_size, font->get_bg()); + fill_region(0, 0, _size[0], _size[1], font->get_bg()); } //////////////////////////////////////////////////////////////////// @@ -74,7 +73,8 @@ DynamicTextPage(DynamicTextFont *font, int page_number) : // glyph object and returns it; otherwise, returns NULL. //////////////////////////////////////////////////////////////////// DynamicTextGlyph *DynamicTextPage:: -slot_glyph(int character, int x_size, int y_size, int margin) { +slot_glyph(int character, int x_size, int y_size, int margin, + PN_stdfloat advance) { int x, y; if (!find_hole(x, y, x_size, y_size)) { // No room for the glyph. @@ -84,7 +84,7 @@ slot_glyph(int character, int x_size, int y_size, int margin) { // The glyph can be fit at (x, y). Slot it. PT(DynamicTextGlyph) glyph = new DynamicTextGlyph(character, this, - x, y, x_size, y_size, margin); + x, y, x_size, y_size, margin, advance); _glyphs.push_back(glyph); return glyph; } @@ -97,7 +97,7 @@ slot_glyph(int character, int x_size, int y_size, int margin) { //////////////////////////////////////////////////////////////////// void DynamicTextPage:: fill_region(int x, int y, int x_size, int y_size, const LColor &color) { - nassertv(x >= 0 && x + x_size <= _x_size && y >= 0 && y + y_size <= _y_size); + nassertv(x >= 0 && x + x_size <= _size[0] && y >= 0 && y + y_size <= _size[1]); int num_components = get_num_components(); if (num_components == 1) { // Luminance or alpha. @@ -110,7 +110,7 @@ fill_region(int x, int y, int x_size, int y_size, const LColor &color) { unsigned char *image = modify_ram_image(); for (int yi = y; yi < y + y_size; yi++) { - unsigned char *row = image + yi * _x_size; + unsigned char *row = image + yi * _size[0]; memset(row + x, v, x_size); } @@ -127,7 +127,7 @@ fill_region(int x, int y, int x_size, int y_size, const LColor &color) { PN_uint16 *image = (PN_uint16 *)modify_ram_image().p(); for (int yi = y; yi < y + y_size; yi++) { - PN_uint16 *row = image + yi * _x_size ; + PN_uint16 *row = image + yi * _size[0] ; for (int xi = x; xi < x + x_size; xi++) { row[xi] = v.v; } @@ -142,7 +142,7 @@ fill_region(int x, int y, int x_size, int y_size, const LColor &color) { unsigned char *image = modify_ram_image(); for (int yi = y; yi < y + y_size; yi++) { - unsigned char *row = image + yi * _x_size * 3; + unsigned char *row = image + yi * _size[0] * 3; for (int xi = x; xi < x + x_size; xi++) { row[xi * 3] = p0; row[xi * 3 + 1] = p1; @@ -164,12 +164,12 @@ fill_region(int x, int y, int x_size, int y_size, const LColor &color) { PN_uint32 *image = (PN_uint32 *)modify_ram_image().p(); for (int yi = y; yi < y + y_size; yi++) { - PN_uint32 *row = image + yi * _x_size; + PN_uint32 *row = image + yi * _size[0]; for (int xi = x; xi < x + x_size; xi++) { row[xi] = v.v; } } - } + } } //////////////////////////////////////////////////////////////////// @@ -189,7 +189,8 @@ garbage_collect(DynamicTextFont *font) { Glyphs::iterator gi; for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { DynamicTextGlyph *glyph = (*gi); - if (glyph->_geom_count != 0) { + cerr << glyph->get_character() << " - " << glyph->get_ref_count() << "\n"; + if (glyph->get_ref_count() > 1) { // Keep this one. new_glyphs.insert(new_glyphs.end(), (*gi)); } else { @@ -214,11 +215,11 @@ garbage_collect(DynamicTextFont *font) { bool DynamicTextPage:: find_hole(int &x, int &y, int x_size, int y_size) const { y = 0; - while (y + y_size <= _y_size) { - int next_y = _y_size; + while (y + y_size <= _size[1]) { + int next_y = _size[1]; // Scan along the row at 'y'. x = 0; - while (x + x_size <= _x_size) { + while (x + x_size <= _size[0]) { int next_x = x; // Consider the spot at x, y. diff --git a/panda/src/text/dynamicTextPage.h b/panda/src/text/dynamicTextPage.h index d0266df9f0..e32187f7f4 100644 --- a/panda/src/text/dynamicTextPage.h +++ b/panda/src/text/dynamicTextPage.h @@ -37,10 +37,11 @@ class EXPCL_PANDA_TEXT DynamicTextPage : public Texture { public: DynamicTextPage(DynamicTextFont *font, int page_number); - DynamicTextGlyph *slot_glyph(int character, - int x_size, int y_size, int margin); + DynamicTextGlyph *slot_glyph(int character, int x_size, int y_size, + int margin, PN_stdfloat advance); PUBLISHED: + INLINE const LVecBase2i &get_size() const; INLINE int get_x_size() const; INLINE int get_y_size() const; @@ -58,7 +59,7 @@ private: typedef pvector< PT(DynamicTextGlyph) > Glyphs; Glyphs _glyphs; - int _x_size, _y_size; + LVecBase2i _size; DynamicTextFont *_font; diff --git a/panda/src/text/geomTextGlyph.cxx b/panda/src/text/geomTextGlyph.cxx index 446f67ebe3..607c24a4fc 100644 --- a/panda/src/text/geomTextGlyph.cxx +++ b/panda/src/text/geomTextGlyph.cxx @@ -13,9 +13,6 @@ //////////////////////////////////////////////////////////////////// #include "geomTextGlyph.h" - -#ifdef HAVE_FREETYPE - #include "datagramIterator.h" #include "bamReader.h" #include "indent.h" @@ -26,26 +23,25 @@ TypeHandle GeomTextGlyph::_type_handle; //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomTextGlyph:: -GeomTextGlyph(DynamicTextGlyph *glyph, const GeomVertexData *data) : +GeomTextGlyph(const TextGlyph *glyph, const GeomVertexData *data) : Geom(data) { // Initially, there is only one glyph in the Geom. There might be // additional Glyphs later when we flatten the graph and call // Geom::unify(). - if (glyph != (DynamicTextGlyph *)NULL) { + if (glyph != (const TextGlyph *)NULL) { _glyphs.reserve(1); _glyphs.push_back(glyph); - glyph->_geom_count++; } } //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomTextGlyph:: GeomTextGlyph(const GeomVertexData *data) : @@ -57,59 +53,48 @@ GeomTextGlyph(const GeomVertexData *data) : //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::Copy Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomTextGlyph:: GeomTextGlyph(const GeomTextGlyph ©) : Geom(copy), _glyphs(copy._glyphs) { - Glyphs::iterator gi; - for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { - DynamicTextGlyph *glyph = (*gi); - nassertv(glyph != (DynamicTextGlyph *)NULL); - glyph->_geom_count++; +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomTextGlyph::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +GeomTextGlyph:: +GeomTextGlyph(const Geom ©, const TextGlyph *glyph) : + Geom(copy) +{ + if (glyph != (const TextGlyph *)NULL) { + _glyphs.reserve(1); + _glyphs.push_back(glyph); } } //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::Copy Assignment Operator // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomTextGlyph:: operator = (const GeomTextGlyph ©) { Geom::operator = (copy); - - Glyphs::iterator gi; - for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { - DynamicTextGlyph *glyph = (*gi); - nassertv(glyph != (DynamicTextGlyph *)NULL); - glyph->_geom_count--; - nassertv((*gi)->_geom_count >= 0); - } _glyphs = copy._glyphs; - for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { - DynamicTextGlyph *glyph = (*gi); - nassertv(glyph != (DynamicTextGlyph *)NULL); - glyph->_geom_count++; - } } //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomTextGlyph:: ~GeomTextGlyph() { - Glyphs::iterator gi; - for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { - DynamicTextGlyph *glyph = (*gi); - nassertv(glyph != (DynamicTextGlyph *)NULL); - glyph->_geom_count--; - nassertv(glyph->_geom_count >= 0); - } } //////////////////////////////////////////////////////////////////// @@ -149,11 +134,8 @@ copy_primitives_from(const Geom *other) { DCAST_INTO_R(tother, other, false); // Also copy the glyph pointers. - Glyphs::const_iterator gi; - for (gi = tother->_glyphs.begin(); gi != tother->_glyphs.end(); ++gi) { - _glyphs.push_back(*gi); - (*gi)->_geom_count++; - } + _glyphs.reserve(_glyphs.size() + tother->_glyphs.size()); + _glyphs.insert(_glyphs.end(), tother->_glyphs.begin(), tother->_glyphs.end()); return true; } @@ -176,18 +158,15 @@ count_geom(const Geom *other) { const GeomTextGlyph *tother; DCAST_INTO_V(tother, other); - Glyphs::const_iterator gi; - for (gi = tother->_glyphs.begin(); gi != tother->_glyphs.end(); ++gi) { - _glyphs.push_back(*gi); - (*gi)->_geom_count++; - } + _glyphs.reserve(_glyphs.size() + tother->_glyphs.size()); + _glyphs.insert(_glyphs.end(), tother->_glyphs.begin(), tother->_glyphs.end()); } } //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::output // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomTextGlyph:: output(ostream &out) const { @@ -195,8 +174,8 @@ output(ostream &out) const { out << ", glyphs: ["; Glyphs::const_iterator gi; for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { - DynamicTextGlyph *glyph = (*gi); - nassertv(glyph != (DynamicTextGlyph *)NULL); + const TextGlyph *glyph = (*gi); + nassertv(glyph != (const TextGlyph *)NULL); out << " " << glyph->get_character(); } out << " ]"; @@ -205,7 +184,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::write // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomTextGlyph:: write(ostream &out, int indent_level) const { @@ -214,13 +193,24 @@ write(ostream &out, int indent_level) const { << "Glyphs: ["; Glyphs::const_iterator gi; for (gi = _glyphs.begin(); gi != _glyphs.end(); ++gi) { - DynamicTextGlyph *glyph = (*gi); - nassertv(glyph != (DynamicTextGlyph *)NULL); + const TextGlyph *glyph = (*gi); + nassertv(glyph != (const TextGlyph *)NULL); out << " " << glyph->get_character(); } out << " ]\n"; } +//////////////////////////////////////////////////////////////////// +// Function: GeomTextGlyph::add_glyph +// Access: Public +// Description: Adds a glyph to the list of glyphs referenced by +// this Geom. +//////////////////////////////////////////////////////////////////// +void GeomTextGlyph:: +add_glyph(const TextGlyph *glyph) { + _glyphs.push_back(glyph); +} + //////////////////////////////////////////////////////////////////// // Function: GeomTextGlyph::register_with_factory // Access: Public, Static @@ -238,7 +228,7 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable* GeomTextGlyph:: make_GeomTextGlyph(const FactoryParams ¶ms) { - GeomTextGlyph *me = new GeomTextGlyph((DynamicTextGlyph *)NULL, + GeomTextGlyph *me = new GeomTextGlyph((const TextGlyph *)NULL, (GeomVertexData *)NULL); DatagramIterator scan; BamReader *manager; @@ -247,5 +237,3 @@ make_GeomTextGlyph(const FactoryParams ¶ms) { me->fillin(scan, manager); return me; } - -#endif // HAVE_FREETYPE diff --git a/panda/src/text/geomTextGlyph.h b/panda/src/text/geomTextGlyph.h index a49ae582a7..944e07c25a 100644 --- a/panda/src/text/geomTextGlyph.h +++ b/panda/src/text/geomTextGlyph.h @@ -17,15 +17,12 @@ #include "pandabase.h" #include "geom.h" - -#ifdef HAVE_FREETYPE - -#include "dynamicTextGlyph.h" +#include "textGlyph.h" //////////////////////////////////////////////////////////////////// // Class : GeomTextGlyph // Description : This is a specialization on Geom for containing a -// primitive intended to represent a DynamicTextGlyph. +// primitive intended to represent a TextGlyph. // Its sole purpose is to maintain the geom count on the // glyph, so we can determine the actual usage count on // a dynamic glyph (and thus know when it is safe to @@ -33,10 +30,10 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_TEXT GeomTextGlyph : public Geom { public: - GeomTextGlyph(DynamicTextGlyph *glyph, - const GeomVertexData *data); + GeomTextGlyph(const TextGlyph *glyph, const GeomVertexData *data); GeomTextGlyph(const GeomVertexData *data); GeomTextGlyph(const GeomTextGlyph ©); + GeomTextGlyph(const Geom ©, const TextGlyph *glyph); void operator = (const GeomTextGlyph ©); virtual ~GeomTextGlyph(); ALLOC_DELETED_CHAIN(GeomTextGlyph); @@ -48,8 +45,12 @@ public: virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level = 0) const; + void add_glyph(const TextGlyph *glyph); + + friend class TextAssembler; + private: - typedef pvector< PT(DynamicTextGlyph) > Glyphs; + typedef pvector< CPT(TextGlyph) > Glyphs; Glyphs _glyphs; public: @@ -77,11 +78,4 @@ private: #include "geomTextGlyph.I" -#else // HAVE_FREETYPE - -// Without Freetype, a GeomTextGlyph is really just an ordinary Geom. -typedef Geom GeomTextGlyph; - -#endif // HAVE_FREETYPE - #endif // GEOMTEXTGLYPH_H diff --git a/panda/src/text/staticTextFont.cxx b/panda/src/text/staticTextFont.cxx index c174ec2fa5..28b7e94c61 100644 --- a/panda/src/text/staticTextFont.cxx +++ b/panda/src/text/staticTextFont.cxx @@ -234,7 +234,7 @@ write(ostream &out, int indent_level) const { // printable glyph. //////////////////////////////////////////////////////////////////// bool StaticTextFont:: -get_glyph(int character, const TextGlyph *&glyph) { +get_glyph(int character, CPT(TextGlyph) &glyph) { Glyphs::const_iterator gi = _glyphs.find(character); if (gi == _glyphs.end()) { // No definition for this character. diff --git a/panda/src/text/staticTextFont.h b/panda/src/text/staticTextFont.h index 92c626c0d1..c97796f6ef 100644 --- a/panda/src/text/staticTextFont.h +++ b/panda/src/text/staticTextFont.h @@ -47,7 +47,7 @@ PUBLISHED: virtual void write(ostream &out, int indent_level) const; public: - virtual bool get_glyph(int character, const TextGlyph *&glyph); + virtual bool get_glyph(int character, CPT(TextGlyph) &glyph); private: void find_character_gsets(PandaNode *root, CPT(Geom) &ch, CPT(Geom) &dot, diff --git a/panda/src/text/textAssembler.I b/panda/src/text/textAssembler.I index f6e40e26e6..0de7f7d06d 100644 --- a/panda/src/text/textAssembler.I +++ b/panda/src/text/textAssembler.I @@ -522,24 +522,6 @@ ComputedProperties(ComputedProperties *based_on, const wstring &wname, << "Unknown TextProperties: " << name << "\n"; } } - - -//////////////////////////////////////////////////////////////////// -// Function: TextAssembler::GlyphPlacement::add_piece -// Access: Public -// Description: Adds a piece of the glyph, consisting of a single -// Geom and an associated RenderState. Typically, a -// glyph will have exactly one piece; there will only be -// multiple pieces in the case of cheesy accent marks or -// ligatures. -//////////////////////////////////////////////////////////////////// -INLINE void TextAssembler::GlyphPlacement:: -add_piece(Geom *geom, const RenderState *state) { - Piece piece; - piece._geom = geom; - piece._state = state; - _pieces.push_back(piece); -} //////////////////////////////////////////////////////////////////// // Function: TextAssembler::GeomCollectorKey::Constructor diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index 609ea8c676..bb81f91d6d 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -573,75 +573,62 @@ assemble_text() { const TextProperties *properties = NULL; CPT(RenderState) text_state; CPT(RenderState) shadow_state; - LMatrix4 shadow_xform; + LVector2 shadow(0); bool any_shadow = false; GeomCollectorMap geom_collector_map; GeomCollectorMap geom_shadow_collector_map; + QuadMap quad_map; + QuadMap quad_shadow_map; PlacedGlyphs::const_iterator pgi; for (pgi = placed_glyphs.begin(); pgi != placed_glyphs.end(); ++pgi) { - const GlyphPlacement *placement = (*pgi); + const GlyphPlacement &placement = (*pgi); - if (placement->_properties != properties) { + if (placement._properties != properties) { // Get a new set of properties for future glyphs. - properties = placement->_properties; - text_state = RenderState::make_empty(); - shadow_state = RenderState::make_empty(); - shadow_xform = LMatrix4::ident_mat(); - - if (properties->has_text_color()) { - text_state = text_state->add_attrib(ColorAttrib::make_flat(properties->get_text_color())); - if (properties->get_text_color()[3] != 1.0) { - text_state = text_state->add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_alpha)); - } - } - - if (properties->has_bin()) { - text_state = text_state->add_attrib(CullBinAttrib::make(properties->get_bin(), properties->get_draw_order() + 2)); - } + properties = placement._properties; + text_state = properties->get_text_state(); if (properties->has_shadow()) { - shadow_state = shadow_state->add_attrib(ColorAttrib::make_flat(properties->get_shadow_color())); - if (properties->get_shadow_color()[3] != 1.0) { - shadow_state = shadow_state->add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_alpha)); - } - - if (properties->has_bin()) { - shadow_state = shadow_state->add_attrib(CullBinAttrib::make(properties->get_bin(), properties->get_draw_order() + 1)); - } - - LVector2 offset = properties->get_shadow(); - shadow_xform = LMatrix4::translate_mat(offset[0], 0.0f, -offset[1]); + shadow = properties->get_shadow(); + shadow_state = properties->get_shadow_state(); + } else { + shadow.set(0, 0); + shadow_state.clear(); } } - // We have to place the shadow first, because it copies as it - // goes, while the place-text function just stomps on the - // vertices. if (properties->has_shadow()) { if (_dynamic_merge) { - placement->assign_append_to(geom_shadow_collector_map, shadow_state, shadow_xform); + if (placement._glyph->has_quad()) { + placement.assign_quad_to(quad_shadow_map, shadow_state, shadow); + } else { + placement.assign_append_to(geom_shadow_collector_map, shadow_state, shadow); + } } else { - placement->assign_copy_to(shadow_geom_node, shadow_state, shadow_xform); + placement.assign_to(shadow_geom_node, shadow_state, shadow); } // Don't shadow the graphics. That can result in duplication of // button objects, plus it looks weird. If you want a shadowed // graphic, you can shadow it yourself before you add it. - //placement->copy_graphic_to(shadow_node, shadow_state, shadow_xform); + //placement.copy_graphic_to(shadow_node, shadow_state, shadow); any_shadow = true; } if (_dynamic_merge) { - placement->assign_append_to(geom_collector_map, text_state, LMatrix4::ident_mat()); + if (placement._glyph->has_quad()) { + placement.assign_quad_to(quad_map, text_state); + } else { + placement.assign_append_to(geom_collector_map, text_state); + } } else { - placement->assign_to(text_geom_node, text_state); + placement.assign_to(text_geom_node, text_state); } - placement->copy_graphic_to(text_node, text_state, LMatrix4::ident_mat()); - delete placement; - } + placement.copy_graphic_to(text_node, text_state); + } placed_glyphs.clear(); if (any_shadow) { @@ -655,14 +642,18 @@ assemble_text() { (*gc).second.append_geom(text_geom_node, (*gc).first._state); } + generate_quads(text_geom_node, quad_map); + if (any_shadow) { for (gc = geom_shadow_collector_map.begin(); gc != geom_shadow_collector_map.end(); ++gc) { (*gc).second.append_geom(shadow_geom_node, (*gc).first._state); } + + generate_quads(shadow_geom_node, quad_shadow_map); } - + parent_node->add_child(text_node); return parent_node; @@ -686,8 +677,8 @@ calc_width(wchar_t character, const TextProperties &properties) { } bool got_glyph; - const TextGlyph *first_glyph = NULL; - const TextGlyph *second_glyph = NULL; + CPT(TextGlyph) first_glyph; + CPT(TextGlyph) second_glyph; UnicodeLatinMap::AccentType accent_type; int additional_flags; PN_stdfloat glyph_scale; @@ -750,7 +741,7 @@ has_exact_character(wchar_t character, const TextProperties &properties) { TextFont *font = properties.get_font(); nassertr(font != (TextFont *)NULL, false); - const TextGlyph *glyph = NULL; + CPT(TextGlyph) glyph; return font->get_glyph(character, glyph); } @@ -776,8 +767,8 @@ has_character(wchar_t character, const TextProperties &properties) { } bool got_glyph; - const TextGlyph *first_glyph = NULL; - const TextGlyph *second_glyph = NULL; + CPT(TextGlyph) first_glyph; + CPT(TextGlyph) second_glyph; UnicodeLatinMap::AccentType accent_type; int additional_flags; PN_stdfloat glyph_scale; @@ -820,7 +811,7 @@ is_whitespace(wchar_t character, const TextProperties &properties) { TextFont *font = properties.get_font(); nassertr(font != (TextFont *)NULL, false); - const TextGlyph *glyph = NULL; + CPT(TextGlyph) glyph; if (!font->get_glyph(character, glyph)) { return false; } @@ -828,7 +819,6 @@ is_whitespace(wchar_t character, const TextProperties &properties) { return glyph->is_whitespace(); } -#ifndef CPPPARSER // interrogate has a bit of trouble with wstring. //////////////////////////////////////////////////////////////////// // Function: TextAssembler::scan_wtext // Access: Private @@ -914,7 +904,7 @@ scan_wtext(TextAssembler::TextString &output_string, TextPropertiesManager *manager = TextPropertiesManager::get_global_ptr(); - + // Get the graphic image. const TextGraphic *named_graphic = manager->get_graphic_ptr(graphic_name); if (named_graphic != (TextGraphic *)NULL) { @@ -932,7 +922,6 @@ scan_wtext(TextAssembler::TextString &output_string, } } } -#endif // CPPPARSER //////////////////////////////////////////////////////////////////// // Function: TextAssembler::wordwrap_text @@ -1213,6 +1202,181 @@ calc_hyphen_width(const TextCharacter &tch) { return hyphen_width; } +//////////////////////////////////////////////////////////////////// +// Function: TextAssembler::generate_quads +// Access: Private +// Description: Generates Geoms for the given quads and adds them +// to the GeomNode. +//////////////////////////////////////////////////////////////////// +void TextAssembler:: +generate_quads(GeomNode *geom_node, const QuadMap &quad_map) { + QuadMap::const_iterator qmi; + for (qmi = quad_map.begin(); qmi != quad_map.end(); ++qmi) { + const QuadDefs &quads = qmi->second; + GeomTextGlyph::Glyphs glyphs; + glyphs.reserve(quads.size()); + + static CPT(GeomVertexFormat) format; + if (format.is_null()) { + // The optimized code below assumes 32-bit floats, so let's + // make sure we got the right format by creating it ourselves. + format = GeomVertexFormat::register_format(new GeomVertexArrayFormat( + InternalName::get_vertex(), 3, GeomEnums::NT_float32, GeomEnums::C_point, + InternalName::get_texcoord(), 2, GeomEnums::NT_float32, GeomEnums::C_texcoord)); + } + + PT(GeomVertexData) vdata = new GeomVertexData("text", format, Geom::UH_static); + + PT(GeomTriangles) tris = new GeomTriangles(Geom::UH_static); + if (quads.size() > 10922) { + tris->set_index_type(GeomEnums::NT_uint32); + } else { + tris->set_index_type(GeomEnums::NT_uint16); + } + PT(GeomVertexArrayData) indices = tris->modify_vertices(); + + int i = 0; + + // This is quite a critical loop and GeomVertexWriter quickly becomes + // the bottleneck. So, I've written this out the hard way instead. + // Two versions of the loop: one for 32-bit indices, one for 16-bit. + { + PT(GeomVertexArrayDataHandle) vtx_handle = vdata->modify_array(0)->modify_handle(); + vtx_handle->unclean_set_num_rows(quads.size() * 4); + + unsigned char *write_ptr = vtx_handle->get_write_pointer(); + size_t stride = format->get_array(0)->get_stride() / sizeof(PN_float32); + + PN_float32 *vtx_ptr = (PN_float32 *) + (write_ptr + format->get_column(InternalName::get_vertex())->get_start()); + PN_float32 *tex_ptr = (PN_float32 *) + (write_ptr + format->get_column(InternalName::get_texcoord())->get_start()); + + if (tris->get_index_type() == GeomEnums::NT_uint32) { + // 32-bit index case. + PT(GeomVertexArrayDataHandle) idx_handle = indices->modify_handle(); + idx_handle->unclean_set_num_rows(quads.size() * 6); + PN_uint32 *idx_ptr = (PN_uint32 *)idx_handle->get_write_pointer(); + + QuadDefs::const_iterator qi; + for (qi = quads.begin(); qi != quads.end(); ++qi) { + const QuadDef &quad = (*qi); + + vtx_ptr[0] = quad._dimensions[0] + quad._slanth; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[3]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[0]; + tex_ptr[1] = quad._uvs[3]; + tex_ptr += stride; + + vtx_ptr[0] = quad._dimensions[0] + quad._slantl; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[1]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[0]; + tex_ptr[1] = quad._uvs[1]; + tex_ptr += stride; + + vtx_ptr[0] = quad._dimensions[2] + quad._slanth; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[3]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[2]; + tex_ptr[1] = quad._uvs[3]; + tex_ptr += stride; + + vtx_ptr[0] = quad._dimensions[2] + quad._slantl; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[1]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[2]; + tex_ptr[1] = quad._uvs[1]; + tex_ptr += stride; + + *(idx_ptr++) = i + 0; + *(idx_ptr++) = i + 1; + *(idx_ptr++) = i + 2; + *(idx_ptr++) = i + 2; + *(idx_ptr++) = i + 1; + *(idx_ptr++) = i + 3; + i += 4; + + glyphs.push_back(MOVE(quad._glyph)); + } + } else { + // 16-bit index case. + PT(GeomVertexArrayDataHandle) idx_handle = indices->modify_handle(); + idx_handle->unclean_set_num_rows(quads.size() * 6); + PN_uint16 *idx_ptr = (PN_uint16 *)idx_handle->get_write_pointer(); + + QuadDefs::const_iterator qi; + for (qi = quads.begin(); qi != quads.end(); ++qi) { + const QuadDef &quad = (*qi); + + vtx_ptr[0] = quad._dimensions[0] + quad._slanth; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[3]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[0]; + tex_ptr[1] = quad._uvs[3]; + tex_ptr += stride; + + vtx_ptr[0] = quad._dimensions[0] + quad._slantl; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[1]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[0]; + tex_ptr[1] = quad._uvs[1]; + tex_ptr += stride; + + vtx_ptr[0] = quad._dimensions[2] + quad._slanth; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[3]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[2]; + tex_ptr[1] = quad._uvs[3]; + tex_ptr += stride; + + vtx_ptr[0] = quad._dimensions[2] + quad._slantl; + vtx_ptr[1] = 0; + vtx_ptr[2] = quad._dimensions[1]; + vtx_ptr += stride; + + tex_ptr[0] = quad._uvs[2]; + tex_ptr[1] = quad._uvs[1]; + tex_ptr += stride; + + *(idx_ptr++) = i + 0; + *(idx_ptr++) = i + 1; + *(idx_ptr++) = i + 2; + *(idx_ptr++) = i + 2; + *(idx_ptr++) = i + 1; + *(idx_ptr++) = i + 3; + i += 4; + + glyphs.push_back(MOVE(quad._glyph)); + } + } + } + + // We can compute this value much faster than GeomPrimitive can. + tris->set_minmax(0, i - 1, NULL, NULL); + + PT(GeomTextGlyph) geom = new GeomTextGlyph(vdata); + geom->_glyphs.swap(glyphs); + geom->add_primitive(tris); + geom_node->add_geom(geom, qmi->first); + } +} + //////////////////////////////////////////////////////////////////// // Function: TextAssembler::assemble_paragraph // Access: Private @@ -1232,16 +1396,17 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { for (bi = _text_block.begin(); bi != _text_block.end(); ++bi) { TextRow &row = (*bi); + // Store the index of the first glyph we're going to place. + size_t first_glyph = placed_glyphs.size(); + // First, assemble all the glyphs of this row. - PlacedGlyphs row_placed_glyphs; PN_stdfloat row_width, line_height, wordwrap; TextProperties::Alignment align; - assemble_row(row, row_placed_glyphs, + assemble_row(row, placed_glyphs, row_width, line_height, align, wordwrap); + // Now move the row to its appropriate position. This might // involve a horizontal as well as a vertical translation. - LMatrix4 mat = LMatrix4::ident_mat(); - if (num_rows == 0) { // If this is the first row, account for its space. _ul[1] = 0.8f * line_height; @@ -1292,15 +1457,13 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { break; } - mat.set_row(3, LVector3(xpos, 0.0f, ypos)); row._xpos = xpos; row._ypos = ypos; - // Now store the geoms we assembled. - PlacedGlyphs::iterator pi; - for (pi = row_placed_glyphs.begin(); pi != row_placed_glyphs.end(); ++pi) { - (*pi)->_xform *= mat; - placed_glyphs.push_back(*pi); + // Now adjust the geoms we've assembled. + for (size_t i = first_glyph; i < placed_glyphs.size(); ++i) { + placed_glyphs[i]._xpos += xpos; + placed_glyphs[i]._ypos += ypos; } // Advance to the next line. @@ -1324,7 +1487,7 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { //////////////////////////////////////////////////////////////////// void TextAssembler:: assemble_row(TextAssembler::TextRow &row, - TextAssembler::PlacedGlyphs &row_placed_glyphs, + TextAssembler::PlacedGlyphs &placed_glyphs, PN_stdfloat &row_width, PN_stdfloat &line_height, TextProperties::Alignment &align, PN_stdfloat &wordwrap) { Thread *current_thread = Thread::get_current_thread(); @@ -1349,7 +1512,7 @@ assemble_row(TextAssembler::TextRow &row, properties->get_underscore_height() != underscore_properties->get_underscore_height()))) { // Change the underscore status. if (underscore && underscore_start != xpos) { - draw_underscore(row_placed_glyphs, underscore_start, xpos, + draw_underscore(placed_glyphs, underscore_start, xpos, underscore_properties); } underscore = properties->get_underscore(); @@ -1366,6 +1529,11 @@ assemble_row(TextAssembler::TextRow &row, align = properties->get_align(); } + //[fabius] a good place to take wordwrap size + if (properties->get_wordwrap() > 0.0f) { + wordwrap = properties->get_wordwrap(); + } + // And the height of the row is the maximum of all the fonts used // within the row. if (graphic != (TextGraphic *)NULL) { @@ -1390,8 +1558,7 @@ assemble_row(TextAssembler::TextRow &row, } else if (graphic != (TextGraphic *)NULL) { // A special embedded graphic. - GlyphPlacement *placement = new GlyphPlacement; - row_placed_glyphs.push_back(placement); + GlyphPlacement placement; PT(PandaNode) model = graphic->get_model().node(); if (graphic->get_instance_flag()) { @@ -1400,12 +1567,12 @@ assemble_row(TextAssembler::TextRow &row, PT(ModelNode) model_node = new ModelNode(""); model_node->set_preserve_transform(ModelNode::PT_no_touch); model_node->add_child(model); - placement->_graphic_model = model_node.p(); + placement._graphic_model = model_node.p(); } else { // Copy the model in. This the preferred way; it's a little // cheaper to render than instancing (because flattening is // more effective). - placement->_graphic_model = model->copy_subgraph(); + placement._graphic_model = model->copy_subgraph(); } LVecBase4 frame = graphic->get_frame(); @@ -1415,29 +1582,20 @@ assemble_row(TextAssembler::TextRow &row, // Now compute the matrix that will transform the glyph (or // glyphs) into position. - LMatrix4 glyph_xform = LMatrix4::scale_mat(glyph_scale); + placement._scale = properties->get_glyph_scale(); + placement._xpos = (xpos - frame[0]); + placement._ypos = (properties->get_glyph_shift() - frame[2]); + placement._properties = properties; - glyph_xform(3, 0) += (xpos - frame[0]); - glyph_xform(3, 2) += (properties->get_glyph_shift() - frame[2]); - - if (properties->has_slant()) { - LMatrix4 shear(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - properties->get_slant(), 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); - glyph_xform = shear * glyph_xform; - } - - placement->_xform = glyph_xform; - placement->_properties = properties; + placed_glyphs.push_back(placement); xpos += advance * glyph_scale; } else { // A printable character. bool got_glyph; - const TextGlyph *first_glyph; - const TextGlyph *second_glyph; + CPT(TextGlyph) first_glyph; + CPT(TextGlyph) second_glyph; UnicodeLatinMap::AccentType accent_type; int additional_flags; PN_stdfloat glyph_scale; @@ -1464,35 +1622,17 @@ assemble_row(TextAssembler::TextRow &row, // into this character. Normally, there is only one Geom per // character, but it may involve multiple Geoms if we need to // add cheesy accents or ligatures. - GlyphPlacement *placement = new GlyphPlacement; - row_placed_glyphs.push_back(placement); - - PN_stdfloat advance = 0.0f; - - if (first_glyph != (TextGlyph *)NULL) { - PT(Geom) first_char_geom = first_glyph->get_geom(_usage_hint); - if (first_char_geom != (Geom *)NULL) { - placement->add_piece(first_char_geom, first_glyph->get_state()); - } - advance = first_glyph->get_advance() * advance_scale; - } - if (second_glyph != (TextGlyph *)NULL) { - PT(Geom) second_char_geom = second_glyph->get_geom(_usage_hint); - if (second_char_geom != (Geom *)NULL) { - second_char_geom->transform_vertices(LMatrix4::translate_mat(advance, 0.0f, 0.0f)); - placement->add_piece(second_char_geom, second_glyph->get_state()); - } - advance += second_glyph->get_advance(); - } + GlyphPlacement placement; glyph_scale *= properties->get_glyph_scale() * properties->get_text_scale(); - //[fabius] a good place to take wordwrap size - if (properties->get_wordwrap() > 0.0f) { - wordwrap = properties->get_wordwrap(); - } - // Now compute the matrix that will transform the glyph (or - // glyphs) into position. - LMatrix4 glyph_xform = LMatrix4::scale_mat(glyph_scale); + placement._glyph = NULL; + placement._scale = glyph_scale; + placement._xpos = xpos; + placement._ypos = properties->get_glyph_shift(); + placement._slant = properties->get_slant(); + placement._properties = properties; + + PN_stdfloat advance = 0.0f; if (accent_type != UnicodeLatinMap::AT_none || additional_flags != 0) { // If we have some special handling to perform, do so now. @@ -1500,14 +1640,18 @@ assemble_row(TextAssembler::TextRow &row, // glyph, so go get that. LPoint3 min_vert, max_vert; bool found_any = false; - placement->calc_tight_bounds(min_vert, max_vert, found_any, - current_thread); + if (first_glyph != NULL) { + first_glyph->calc_tight_bounds(min_vert, max_vert, found_any, + current_thread); + } + if (second_glyph != NULL) { + second_glyph->calc_tight_bounds(min_vert, max_vert, found_any, + current_thread); + } if (found_any) { LPoint3 centroid = (min_vert + max_vert) / 2.0f; - tack_on_accent(accent_type, min_vert, max_vert, centroid, - properties, placement); - + if ((additional_flags & UnicodeLatinMap::AF_turned) != 0) { // Invert the character. Should we also invert the accent // mark, so that an accent that would have been above the @@ -1520,28 +1664,35 @@ assemble_row(TextAssembler::TextRow &row, // We rotate the character around its centroid, which may // not always be the right point, but it's the best we've // got and it's probably pretty close. - LMatrix4 rotate = - LMatrix4::translate_mat(-centroid) * - LMatrix4::rotate_mat_normaxis(180.0f, LVecBase3(0.0f, -1.0f, 0.0f)) * - LMatrix4::translate_mat(centroid); - glyph_xform *= rotate; + placement._scale *= -1; + placement._xpos += centroid[0] * 2; + placement._ypos += centroid[2] * 2; + } + + if (accent_type != UnicodeLatinMap::AT_none) { + GlyphPlacement accent_placement(placement); + tack_on_accent(accent_type, min_vert, max_vert, centroid, + properties, accent_placement); + placed_glyphs.push_back(accent_placement); } } } - glyph_xform(3, 0) += xpos; - glyph_xform(3, 2) += properties->get_glyph_shift(); - - if (properties->has_slant()) { - LMatrix4 shear(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - properties->get_slant(), 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); - glyph_xform = shear * glyph_xform; + if (first_glyph != (TextGlyph *)NULL) { + assert(!first_glyph->is_whitespace()); + advance = first_glyph->get_advance() * advance_scale; + swap(placement._glyph, first_glyph); + placed_glyphs.push_back(placement); + } + + // Check if there is a second glyph to create a hacky ligature or + // some such nonsense. + if (second_glyph != (TextGlyph *)NULL) { + placement._xpos += advance * glyph_scale; + advance += second_glyph->get_advance(); + swap(placement._glyph, second_glyph); + placed_glyphs.push_back(placement); } - - placement->_xform = glyph_xform; - placement->_properties = properties; xpos += advance * glyph_scale; line_height = max(line_height, font->get_line_height() * glyph_scale); @@ -1549,7 +1700,7 @@ assemble_row(TextAssembler::TextRow &row, } if (underscore && underscore_start != xpos) { - draw_underscore(row_placed_glyphs, underscore_start, xpos, + draw_underscore(placed_glyphs, underscore_start, xpos, underscore_properties); } @@ -1570,7 +1721,7 @@ assemble_row(TextAssembler::TextRow &row, } } } - + //////////////////////////////////////////////////////////////////// // Function: TextAssembler::draw_underscore // Access: Private, Static @@ -1578,35 +1729,44 @@ assemble_row(TextAssembler::TextRow &row, // for the indicated range of glyphs in this row. //////////////////////////////////////////////////////////////////// void TextAssembler:: -draw_underscore(TextAssembler::PlacedGlyphs &row_placed_glyphs, - PN_stdfloat underscore_start, PN_stdfloat underscore_end, +draw_underscore(TextAssembler::PlacedGlyphs &placed_glyphs, + PN_stdfloat underscore_start, PN_stdfloat underscore_end, const TextProperties *underscore_properties) { + CPT(GeomVertexFormat) format = GeomVertexFormat::get_v3cp(); PT(GeomVertexData) vdata = - new GeomVertexData("text", format, Geom::UH_static); - vdata->reserve_num_rows(2); + new GeomVertexData("underscore", format, Geom::UH_static); + vdata->unclean_set_num_rows(2); GeomVertexWriter vertex(vdata, InternalName::get_vertex()); GeomVertexWriter color(vdata, InternalName::get_color()); PN_stdfloat y = underscore_properties->get_underscore_height(); - vertex.add_data3(underscore_start, 0.0f, y); - color.add_data4(underscore_properties->get_text_color()); - vertex.add_data3(underscore_end, 0.0f, y); - color.add_data4(underscore_properties->get_text_color()); + vertex.set_data3(underscore_start, 0.0f, y); + color.set_data4(underscore_properties->get_text_color()); + vertex.set_data3(underscore_end, 0.0f, y); + color.set_data4(underscore_properties->get_text_color()); PT(GeomLines) lines = new GeomLines(Geom::UH_static); - lines->add_vertices(0, 1); + lines->add_next_vertices(2); lines->close_primitive(); PT(Geom) geom = new Geom(vdata); geom->add_primitive(lines); - GlyphPlacement *placement = new GlyphPlacement; - placement->add_piece(geom, RenderState::make_empty()); - placement->_xform = LMatrix4::ident_mat(); - placement->_properties = underscore_properties; + PT(TextGlyph) glyph = new TextGlyph(0, geom, RenderState::make_empty(), 0); - row_placed_glyphs.push_back(placement); + // Eventually we should probably replace this with the set_quad + // approach, or better, for improved performance. + //glyph->set_quad(LVecBase4(underscore_start, y, underscore_end, y+0.1), LVecBase4(0), RenderState::make_empty()); + + GlyphPlacement placement; + placement._glyph = MOVE(glyph); + placement._xpos = 0; + placement._ypos = 0; + placement._scale = 1; + placement._slant = 0; + placement._properties = underscore_properties; + placed_glyphs.push_back(placement); } //////////////////////////////////////////////////////////////////// @@ -1630,8 +1790,8 @@ draw_underscore(TextAssembler::PlacedGlyphs &row_placed_glyphs, //////////////////////////////////////////////////////////////////// void TextAssembler:: get_character_glyphs(int character, const TextProperties *properties, - bool &got_glyph, const TextGlyph *&glyph, - const TextGlyph *&second_glyph, + bool &got_glyph, CPT(TextGlyph) &glyph, + CPT(TextGlyph) &second_glyph, UnicodeLatinMap::AccentType &accent_type, int &additional_flags, PN_stdfloat &glyph_scale, PN_stdfloat &advance_scale) { @@ -1701,8 +1861,7 @@ get_character_glyphs(int character, const TextProperties *properties, } } } - - + //////////////////////////////////////////////////////////////////// // Function: TextAssembler::tack_on_accent // Access: Private @@ -1715,7 +1874,7 @@ tack_on_accent(UnicodeLatinMap::AccentType accent_type, const LPoint3 &min_vert, const LPoint3 &max_vert, const LPoint3 ¢roid, const TextProperties *properties, - TextAssembler::GlyphPlacement *placement) const { + TextAssembler::GlyphPlacement &placement) const { switch (accent_type) { case UnicodeLatinMap::AT_grave: // We use the slash as the grave and acute accents. ASCII does @@ -1843,7 +2002,7 @@ tack_on_accent(UnicodeLatinMap::AccentType accent_type, default: // There are lots of other crazy kinds of accents. Forget 'em. break; - } + } } //////////////////////////////////////////////////////////////////// @@ -1860,48 +2019,42 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, const LPoint3 &min_vert, const LPoint3 &max_vert, const LPoint3 ¢roid, const TextProperties *properties, - TextAssembler::GlyphPlacement *placement) const { + TextAssembler::GlyphPlacement &placement) const { TextFont *font = properties->get_font(); nassertr(font != (TextFont *)NULL, false); Thread *current_thread = Thread::get_current_thread(); - const TextGlyph *accent_glyph; + CPT(TextGlyph) accent_glyph; if (font->get_glyph(accent_mark, accent_glyph) || font->get_glyph(toupper(accent_mark), accent_glyph)) { - PT(Geom) accent_geom = accent_glyph->get_geom(_usage_hint); - if (accent_geom != (Geom *)NULL) { + if (!accent_glyph->is_whitespace()) { LPoint3 min_accent, max_accent; bool found_any = false; - accent_geom->calc_tight_bounds(min_accent, max_accent, found_any, - current_thread); + accent_glyph->calc_tight_bounds(min_accent, max_accent, found_any, + current_thread); if (found_any) { PN_stdfloat t, u; LMatrix4 accent_mat; - - // This gets set to true if the glyph gets mirrored and needs - // to have backface culling disabled. - bool mirrored = false; + bool has_mat = true; switch (transform) { case CT_none: - accent_mat = LMatrix4::ident_mat(); + has_mat = false; break; case CT_mirror_x: - accent_mat = LMatrix4::scale_mat(-1.0f, 1.0f, 1.0f); + accent_mat = LMatrix4::scale_mat(-1.0f, -1.0f, 1.0f); t = min_accent[0]; min_accent[0] = -max_accent[0]; max_accent[0] = -t; - mirrored = true; break; case CT_mirror_y: - accent_mat = LMatrix4::scale_mat(1.0f, 1.0f, -1.0f); + accent_mat = LMatrix4::scale_mat(1.0f, -1.0f, -1.0f); t = min_accent[2]; min_accent[2] = -max_accent[2]; max_accent[2] = -t; - mirrored = true; break; case CT_rotate_90: @@ -1916,8 +2069,8 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, break; case CT_rotate_180: - accent_mat = LMatrix4::scale_mat(-1.0f, -1.0f, 1.0f); - + has_mat = false; + placement._scale *= -1; t = min_accent[0]; min_accent[0] = -max_accent[0]; max_accent[0] = -t; @@ -1946,20 +2099,19 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, break; case CT_squash_mirror_y: - accent_mat = LMatrix4::scale_mat(squash_accent_scale_x, 1.0f, -squash_accent_scale_y); + accent_mat = LMatrix4::scale_mat(squash_accent_scale_x, -1.0f, -squash_accent_scale_y); min_accent[0] *= squash_accent_scale_x; max_accent[0] *= squash_accent_scale_x; t = min_accent[2]; min_accent[2] = -max_accent[2] * squash_accent_scale_y; max_accent[2] = -t * squash_accent_scale_y; - mirrored = true; break; case CT_squash_mirror_diag: accent_mat = LMatrix4::rotate_mat_normaxis(270.0f, LVecBase3(0.0f, -1.0f, 0.0f)) * - LMatrix4::scale_mat(-squash_accent_scale_x, 1.0f, squash_accent_scale_y); - + LMatrix4::scale_mat(-squash_accent_scale_x, -1.0f, squash_accent_scale_y); + // rotate min, max t = min_accent[0]; u = max_accent[0]; @@ -1967,7 +2119,6 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, max_accent[0] = max_accent[2] * -squash_accent_scale_x; min_accent[2] = -u * squash_accent_scale_y; max_accent[2] = -t * squash_accent_scale_y; - mirrored = true; break; case CT_small_squash: @@ -1979,20 +2130,19 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, break; case CT_small_squash_mirror_y: - accent_mat = LMatrix4::scale_mat(small_squash_accent_scale_x, 1.0f, -small_squash_accent_scale_y); + accent_mat = LMatrix4::scale_mat(small_squash_accent_scale_x, -1.0f, -small_squash_accent_scale_y); min_accent[0] *= small_squash_accent_scale_x; max_accent[0] *= small_squash_accent_scale_x; t = min_accent[2]; min_accent[2] = -max_accent[2] * small_squash_accent_scale_y; max_accent[2] = -t * small_squash_accent_scale_y; - mirrored = true; break; case CT_small_squash_mirror_diag: accent_mat = LMatrix4::rotate_mat_normaxis(270.0f, LVecBase3(0.0f, -1.0f, 0.0f)) * - LMatrix4::scale_mat(-small_squash_accent_scale_x, 1.0f, small_squash_accent_scale_y); - + LMatrix4::scale_mat(-small_squash_accent_scale_x, -1.0f, small_squash_accent_scale_y); + // rotate min, max t = min_accent[0]; u = max_accent[0]; @@ -2000,11 +2150,11 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, max_accent[0] = max_accent[2] * -small_squash_accent_scale_x; min_accent[2] = -u * small_squash_accent_scale_y; max_accent[2] = -t * small_squash_accent_scale_y; - mirrored = true; break; case CT_small: - accent_mat = LMatrix4::scale_mat(small_accent_scale); + has_mat = false; + placement._scale *= small_accent_scale; min_accent *= small_accent_scale; max_accent *= small_accent_scale; break; @@ -2024,20 +2174,20 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, break; case CT_tiny: - accent_mat = LMatrix4::scale_mat(tiny_accent_scale); + has_mat = false; + placement._scale *= tiny_accent_scale; min_accent *= tiny_accent_scale; max_accent *= tiny_accent_scale; break; case CT_tiny_mirror_x: - accent_mat = LMatrix4::scale_mat(-tiny_accent_scale, 1.0f, tiny_accent_scale); - + accent_mat = LMatrix4::scale_mat(-tiny_accent_scale, -1.0f, tiny_accent_scale); + t = min_accent[0]; min_accent[0] = -max_accent[0] * tiny_accent_scale; max_accent[0] = -t * tiny_accent_scale; min_accent[2] *= tiny_accent_scale; max_accent[2] *= tiny_accent_scale; - mirrored = true; break; case CT_tiny_rotate_270: @@ -2053,60 +2203,52 @@ tack_on_accent(char accent_mark, TextAssembler::CheesyPosition position, min_accent[2] = -u * tiny_accent_scale; max_accent[2] = -t * tiny_accent_scale; break; + + default: + has_mat = false; } LPoint3 accent_centroid = (min_accent + max_accent) / 2.0f; PN_stdfloat accent_height = max_accent[2] - min_accent[2]; - LVector3 trans; + PN_stdfloat accent_y = 0; switch (position) { case CP_above: // A little above the character. - trans.set(centroid[0] - accent_centroid[0], 0.0f, - max_vert[2] - accent_centroid[2] + accent_height * 0.5); + accent_y = max_vert[2] - accent_centroid[2] + accent_height * 0.5f; break; case CP_below: // A little below the character. - trans.set(centroid[0] - accent_centroid[0], 0.0f, - min_vert[2] - accent_centroid[2] - accent_height * 0.5); + accent_y = min_vert[2] - accent_centroid[2] - accent_height * 0.5f; break; case CP_top: // Touching the top of the character. - trans.set(centroid[0] - accent_centroid[0], 0.0f, - max_vert[2] - accent_centroid[2]); + accent_y = max_vert[2] - accent_centroid[2]; break; case CP_bottom: // Touching the bottom of the character. - trans.set(centroid[0] - accent_centroid[0], 0.0f, - min_vert[2] - accent_centroid[2]); + accent_y = min_vert[2] - accent_centroid[2]; break; case CP_within: // Centered within the character. - trans.set(centroid[0] - accent_centroid[0], 0.0f, - centroid[2] - accent_centroid[2]); + accent_y = centroid[2] - accent_centroid[2]; break; } - accent_mat.set_row(3, trans); - accent_geom->transform_vertices(accent_mat); + placement._xpos += placement._scale * (centroid[0] - accent_centroid[0] + placement._slant * accent_y); + placement._ypos += placement._scale * accent_y; - if (mirrored) { - // Once someone asks for this pointer, we hold its reference - // count and never free it. - static CPT(RenderState) disable_backface; - if (disable_backface == (const RenderState *)NULL) { - disable_backface = RenderState::make - (CullFaceAttrib::make(CullFaceAttrib::M_cull_none)); - } - - CPT(RenderState) state = - accent_glyph->get_state()->compose(disable_backface); - placement->add_piece(accent_geom, state); + if (has_mat) { + // Some non-trivial transformation. Apply it to the Geom. + PT(Geom) accent_geom = accent_glyph->get_geom(_usage_hint); + accent_geom->transform_vertices(accent_mat); + placement._glyph = new TextGlyph(0, accent_geom, accent_glyph->get_state(), 0); } else { - placement->add_piece(accent_geom, accent_glyph->get_state()); + // A trivial transformation. + placement._glyph = accent_glyph; } return true; @@ -2155,25 +2297,6 @@ append_delta(wstring &wtext, TextAssembler::ComputedProperties *other) { } } -//////////////////////////////////////////////////////////////////// -// Function: TextAssembler::GlyphPlacement::calc_tight_bounds -// Access: Private -// Description: Expands min_point and max_point to include all of the -// vertices in the glyph(s), if any. found_any is set -// true if any points are found. It is the caller's -// responsibility to initialize min_point, max_point, -// and found_any before calling this function. -//////////////////////////////////////////////////////////////////// -void TextAssembler::GlyphPlacement:: -calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, - bool &found_any, Thread *current_thread) const { - Pieces::const_iterator pi; - for (pi = _pieces.begin(); pi != _pieces.end(); ++pi) { - (*pi)._geom->calc_tight_bounds(min_point, max_point, found_any, - current_thread); - } -} - //////////////////////////////////////////////////////////////////// // Function: TextAssembler::GlyphPlacement::assign_to // Access: Private @@ -2182,33 +2305,17 @@ calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, // modified by this operation. //////////////////////////////////////////////////////////////////// void TextAssembler::GlyphPlacement:: -assign_to(GeomNode *geom_node, const RenderState *state) const { - Pieces::const_iterator pi; - for (pi = _pieces.begin(); pi != _pieces.end(); ++pi) { - (*pi)._geom->transform_vertices(_xform); - geom_node->add_geom((*pi)._geom, state->compose((*pi)._state)); - } -} +assign_to(GeomNode *geom_node, const RenderState *state, + const LVector2 &offset) const { -//////////////////////////////////////////////////////////////////// -// Function: TextAssembler::GlyphPlacement::assign_copy_to -// Access: Private -// Description: Puts the pieces of the GlyphPlacement in the -// indicated GeomNode. This flavor will make a copy of -// the Geoms first, and then apply the additional -// transform to the vertices. -//////////////////////////////////////////////////////////////////// -void TextAssembler::GlyphPlacement:: -assign_copy_to(GeomNode *geom_node, const RenderState *state, - const LMatrix4 &extra_xform) const { - LMatrix4 new_xform = _xform * extra_xform; - Pieces::const_iterator pi; - for (pi = _pieces.begin(); pi != _pieces.end(); ++pi) { - const Geom *geom = (*pi)._geom; - PT(Geom) new_geom = geom->make_copy(); - new_geom->transform_vertices(new_xform); - geom_node->add_geom(new_geom, state->compose((*pi)._state)); - } + LMatrix4 xform(_scale, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + _slant * _scale, 0.0f, _scale, 0.0f, + _xpos + offset[0], 0.0f, _ypos - offset[1], 1.0f); + + PT(Geom) geom = _glyph->get_geom(GeomEnums::UH_static); + geom->transform_vertices(xform); + geom_node->add_geom(geom, state->compose(_glyph->get_state())); } //////////////////////////////////////////////////////////////////// @@ -2220,72 +2327,98 @@ assign_copy_to(GeomNode *geom_node, const RenderState *state, // vertices. //////////////////////////////////////////////////////////////////// void TextAssembler::GlyphPlacement:: -assign_append_to(GeomCollectorMap &geom_collector_map, +assign_append_to(GeomCollectorMap &geom_collector_map, const RenderState *state, - const LMatrix4 &extra_xform) const { - LMatrix4 new_xform = _xform * extra_xform; - Pieces::const_iterator pi; + const LVector2 &offset) const { + + LMatrix4 xform(_scale, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + _slant * _scale, 0.0f, _scale, 0.0f, + _xpos + offset[0], 0.0f, _ypos - offset[1], 1.0f); + + PT(Geom) geom = _glyph->get_geom(GeomEnums::UH_static); int p, sp, s, e, i; - for (pi = _pieces.begin(); pi != _pieces.end(); ++pi) { - const Geom *geom = (*pi)._geom; - const GeomVertexData *vdata = geom->get_vertex_data(); - CPT(RenderState) rs = (*pi)._state->compose(state); - GeomCollectorKey key(rs, vdata->get_format()); - GeomCollectorMap::iterator mi = geom_collector_map.find(key); - if (mi == geom_collector_map.end()) { - mi = geom_collector_map.insert(GeomCollectorMap::value_type(key, GeomCollector(vdata->get_format()))).first; - } - GeomCollector &geom_collector = (*mi).second; - geom_collector.count_geom(geom); + const GeomVertexData *vdata = geom->get_vertex_data(); + CPT(RenderState) rs = _glyph->get_state()->compose(state); + GeomCollectorKey key(rs, vdata->get_format()); - // We use this map to keep track of vertex indices we have already - // added, so that we don't needlessly duplicate vertices into our - // output vertex data. - VertexIndexMap vimap; + GeomCollectorMap::iterator mi = geom_collector_map.find(key); + if (mi == geom_collector_map.end()) { + mi = geom_collector_map.insert(GeomCollectorMap::value_type(key, GeomCollector(vdata->get_format()))).first; + } + GeomCollector &geom_collector = (*mi).second; + geom_collector.count_geom(geom); - for (p = 0; p < geom->get_num_primitives(); p++) { - CPT(GeomPrimitive) primitive = geom->get_primitive(p)->decompose(); + // We use this map to keep track of vertex indices we have already + // added, so that we don't needlessly duplicate vertices into our + // output vertex data. + VertexIndexMap vimap; - // Get a new GeomPrimitive of the corresponding type. - GeomPrimitive *new_prim = geom_collector.get_primitive(primitive->get_type()); + for (p = 0; p < geom->get_num_primitives(); p++) { + CPT(GeomPrimitive) primitive = geom->get_primitive(p)->decompose(); - // Walk through all of the components (e.g. triangles) of the - // primitive. - for (sp = 0; sp < primitive->get_num_primitives(); sp++) { - s = primitive->get_primitive_start(sp); - e = primitive->get_primitive_end(sp); + // Get a new GeomPrimitive of the corresponding type. + GeomPrimitive *new_prim = geom_collector.get_primitive(primitive->get_type()); - // Walk through all of the vertices in the component. - for (i = s; i < e; i++) { - int vi = primitive->get_vertex(i); + // Walk through all of the components (e.g. triangles) of the + // primitive. + for (sp = 0; sp < primitive->get_num_primitives(); sp++) { + s = primitive->get_primitive_start(sp); + e = primitive->get_primitive_end(sp); - // Attempt to insert number "vi" into the map. - pair added = vimap.insert(VertexIndexMap::value_type(vi, 0)); - int new_vertex; - if (added.second) { - // The insert succeeded. That means this is the first - // time we have encountered this vertex. - new_vertex = geom_collector.append_vertex(vdata, vi, new_xform); - // Update the map with the newly-created target vertex index. - (*(added.first)).second = new_vertex; + // Walk through all of the vertices in the component. + for (i = s; i < e; i++) { + int vi = primitive->get_vertex(i); - } else { - // The insert failed. This means we have previously - // encountered this vertex, and we have already entered - // its target vertex index into the vimap. Extract that - // vertex index, so we can reuse it. - new_vertex = (*(added.first)).second; - } - new_prim->add_vertex(new_vertex); + // Attempt to insert number "vi" into the map. + pair added = vimap.insert(VertexIndexMap::value_type(vi, 0)); + int new_vertex; + if (added.second) { + // The insert succeeded. That means this is the first + // time we have encountered this vertex. + new_vertex = geom_collector.append_vertex(vdata, vi, xform); + // Update the map with the newly-created target vertex index. + (*(added.first)).second = new_vertex; + + } else { + // The insert failed. This means we have previously + // encountered this vertex, and we have already entered + // its target vertex index into the vimap. Extract that + // vertex index, so we can reuse it. + new_vertex = (*(added.first)).second; } - new_prim->close_primitive(); + new_prim->add_vertex(new_vertex); } + new_prim->close_primitive(); } } } +//////////////////////////////////////////////////////////////////// +// Function: TextAssembler::GlyphPlacement::assign_quad_to +// Access: Private +// Description: If this glyph is representable as a single quad, +// assigns it to the appropriate position in the map. +//////////////////////////////////////////////////////////////////// +void TextAssembler::GlyphPlacement:: +assign_quad_to(QuadMap &quad_map, const RenderState *state, + const LVector2 &offset) const { + + QuadDef quad; + if (_glyph->get_quad(quad._dimensions, quad._uvs)) { + quad._dimensions *= _scale; + quad._slantl = quad._dimensions[1] * _slant; + quad._slanth = quad._dimensions[3] * _slant; + quad._dimensions += LVecBase4(_xpos, _ypos, _xpos, _ypos); + quad._dimensions += LVecBase4(offset[0], -offset[1], offset[0], -offset[1]); + quad._glyph = _glyph; + + quad_map[state->compose(_glyph->get_state())].push_back(MOVE(quad)); + } +} + //////////////////////////////////////////////////////////////////// // Function: TextAssembler::GlyphPlacement::copy_graphic_to // Access: Private @@ -2293,16 +2426,20 @@ assign_append_to(GeomCollectorMap &geom_collector_map, // copies it to the indicated node. //////////////////////////////////////////////////////////////////// void TextAssembler::GlyphPlacement:: -copy_graphic_to(PandaNode *node, const RenderState *state, - const LMatrix4 &extra_xform) const { +copy_graphic_to(PandaNode *node, const RenderState *state) const { if (_graphic_model != (PandaNode *)NULL) { - LMatrix4 new_xform = _xform * extra_xform; - // We need an intermediate node to hold the transform and state. PT(PandaNode) intermediate_node = new PandaNode(""); node->add_child(intermediate_node); - intermediate_node->set_transform(TransformState::make_mat(new_xform)); + intermediate_node->set_transform( + TransformState::make_pos_hpr_scale_shear( + LVecBase3(_xpos, 0, _ypos), + LVecBase3::zero(), + LVecBase3(_scale, 1, _scale), + LVecBase3(0, _slant, 0) + ) + ); intermediate_node->set_state(state); intermediate_node->add_child(_graphic_model); } diff --git a/panda/src/text/textAssembler.h b/panda/src/text/textAssembler.h index 07bb80b0b9..24db6244c6 100644 --- a/panda/src/text/textAssembler.h +++ b/panda/src/text/textAssembler.h @@ -164,12 +164,10 @@ private: // And here it is, wordwrapped. TextBlock _text_block; -#ifndef CPPPARSER // interrogate has a bit of trouble with wstring iterators. void scan_wtext(TextString &output_string, wstring::const_iterator &si, const wstring::const_iterator &send, ComputedProperties *current_cprops); -#endif // CPPPARSER bool wordwrap_text(); @@ -179,13 +177,6 @@ private: // These structures are built up by assemble_paragraph() and // assemble_row(). They represent the actual Geoms as laid out in a // paragraph. - - class Piece { - public: - PT(Geom) _geom; - CPT(RenderState) _state; - }; - typedef pvector Pieces; class GeomCollectorKey { public: @@ -218,26 +209,50 @@ private: }; typedef pmap GeomCollectorMap; - class GlyphPlacement : public MemoryBase { + 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; + CPT(TextGlyph) _glyph; + }; + typedef pvector QuadDefs; + typedef pmap QuadMap; + + void generate_quads(GeomNode *geom_node, const QuadMap &quad_map); + + class GlyphPlacement { public: - INLINE void add_piece(Geom *geom, const RenderState *state); - void calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, - bool &found_any, Thread *current_thread) const; - void assign_to(GeomNode *geom_node, const RenderState *state) const; - void assign_copy_to(GeomNode *geom_node, const RenderState *state, - const LMatrix4 &extra_xform) const; + void assign_to(GeomNode *geom_node, const RenderState *state, + const LVector2 &offset = LVector2::zero()) const; void assign_append_to(GeomCollectorMap &geom_collector_map, const RenderState *state, - const LMatrix4 &extra_xform) const; - void copy_graphic_to(PandaNode *node, const RenderState *state, - const LMatrix4 &extra_xform) const; + const LVector2 &offset = LVector2::zero()) const; + void assign_quad_to(QuadMap &quad_map, const RenderState *state, + const LVector2 &offset = LVector2::zero()) const; + void copy_graphic_to(PandaNode *node, const RenderState *state) const; - Pieces _pieces; + CPT(TextGlyph) _glyph; PT(PandaNode) _graphic_model; - LMatrix4 _xform; + PN_stdfloat _xpos, _ypos; + PN_stdfloat _scale, _slant; const TextProperties *_properties; }; - typedef pvector PlacedGlyphs; + typedef pvector PlacedGlyphs; void assemble_paragraph(PlacedGlyphs &placed_glyphs); void assemble_row(TextRow &row, @@ -281,8 +296,8 @@ private: static void get_character_glyphs(int character, const TextProperties *properties, - bool &got_glyph, const TextGlyph *&glyph, - const TextGlyph *&second_glyph, + bool &got_glyph, CPT(TextGlyph) &glyph, + CPT(TextGlyph) &second_glyph, UnicodeLatinMap::AccentType &accent_type, int &additional_flags, PN_stdfloat &glyph_scale, PN_stdfloat &advance_scale); @@ -291,13 +306,13 @@ private: tack_on_accent(UnicodeLatinMap::AccentType accent_type, const LPoint3 &min_vert, const LPoint3 &max_vert, const LPoint3 ¢roid, - const TextProperties *properties, GlyphPlacement *placement) const; + const TextProperties *properties, GlyphPlacement &placement) const; bool tack_on_accent(char accent_mark, CheesyPosition position, CheesyTransform transform, const LPoint3 &min_vert, const LPoint3 &max_vert, const LPoint3 ¢roid, - const TextProperties *properties, GlyphPlacement *placement) const; + const TextProperties *properties, GlyphPlacement &placement) const; // These are filled in by assemble_paragraph(). LVector2 _ul; diff --git a/panda/src/text/textFont.I b/panda/src/text/textFont.I index 030f96d28d..278d8ebaf7 100644 --- a/panda/src/text/textFont.I +++ b/panda/src/text/textFont.I @@ -87,9 +87,9 @@ set_space_advance(PN_stdfloat space_advance) { // it may still return a printable glyph, or it may // return NULL. //////////////////////////////////////////////////////////////////// -INLINE const TextGlyph *TextFont:: +INLINE CPT(TextGlyph) TextFont:: get_glyph(int character) { - const TextGlyph *glyph = NULL; + CPT(TextGlyph) glyph; get_glyph(character, glyph); return glyph; } diff --git a/panda/src/text/textFont.h b/panda/src/text/textFont.h index 193616c298..74de7f1d3e 100644 --- a/panda/src/text/textFont.h +++ b/panda/src/text/textFont.h @@ -78,12 +78,12 @@ PUBLISHED: INLINE PN_stdfloat get_space_advance() const; INLINE void set_space_advance(PN_stdfloat space_advance); - INLINE const TextGlyph *get_glyph(int character); + INLINE CPT(TextGlyph) get_glyph(int character); virtual void write(ostream &out, int indent_level) const; public: - virtual bool get_glyph(int character, const TextGlyph *&glyph)=0; + virtual bool get_glyph(int character, CPT(TextGlyph) &glyph)=0; TextGlyph *get_invalid_glyph(); static RenderMode string_render_mode(const string &string); diff --git a/panda/src/text/textGlyph.I b/panda/src/text/textGlyph.I index 89852d38ea..b728f1e456 100644 --- a/panda/src/text/textGlyph.I +++ b/panda/src/text/textGlyph.I @@ -16,14 +16,15 @@ //////////////////////////////////////////////////////////////////// // Function: TextGlyph::Default constructor // Access: Public -// Description: This constructor makes an invalid glyph. +// Description: This constructor makes an empty glyph. //////////////////////////////////////////////////////////////////// INLINE TextGlyph:: -TextGlyph(int character) : - _character(character) +TextGlyph(int character, PN_stdfloat advance) : + _character(character), + _geom((Geom *)NULL), + _advance(advance), + _has_quad(false) { - _geom = (Geom *)NULL; - _advance = 0.0f; } //////////////////////////////////////////////////////////////////// @@ -37,8 +38,12 @@ TextGlyph(int character, const Geom *geom, _character(character), _geom(geom), _state(state), - _advance(advance) -{ + _advance(advance), + _has_quad(false) +{ + if (geom != NULL) { + check_quad_geom(); + } if (_state == (RenderState *)NULL) { _state = RenderState::make_empty(); } @@ -54,8 +59,11 @@ TextGlyph(const TextGlyph ©) : _character(copy._character), _geom(copy._geom), _state(copy._state), - _advance(copy._advance) -{ + _advance(copy._advance), + _has_quad(copy._has_quad), + _quad_dimensions(copy._quad_dimensions), + _quad_texcoords(copy._quad_texcoords) +{ } //////////////////////////////////////////////////////////////////// @@ -69,6 +77,9 @@ operator = (const TextGlyph ©) { _geom = copy._geom; _state = copy._state; _advance = copy._advance; + _has_quad = copy._has_quad; + _quad_dimensions = copy._quad_dimensions; + _quad_texcoords = copy._quad_texcoords; } //////////////////////////////////////////////////////////////////// @@ -83,28 +94,40 @@ get_character() const { } //////////////////////////////////////////////////////////////////// -// Function: TextGlyph::get_geom +// Function: TextGlyph::has_quad // Access: Public -// Description: Returns a Geom that renders the particular glyph. +// Description: Returns true if this glyph contains the definition +// for a simple quad, rather than a more complex piece +// of geometry. +// +// You may still call get_geom() even if this returns +// true, which will synthesize a Geom for this quad. //////////////////////////////////////////////////////////////////// -INLINE PT(Geom) TextGlyph:: -get_geom(Geom::UsageHint usage_hint) const { - if (_geom == (Geom *)NULL) { - return NULL; +INLINE bool TextGlyph:: +has_quad() const { + return _has_quad; +} + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::get_quad +// Access: Public +// Description: Assuming that this glyph is representable as a +// textured quad, returns its dimensions and UV range. +// Returns false if it is not representable as a quad, +// or if it is whitespace. +// +// The order of the components is left, bottom, +// right, top. +//////////////////////////////////////////////////////////////////// +INLINE bool TextGlyph:: +get_quad(LVecBase4 &dimensions, LVecBase4 &texcoords) const { + if (!_has_quad) { + return false; } - // We always return a copy of the geom. That will allow the caller - // to modify its vertices without fear of stomping on other copies; - // it is also critical for the DynamicTextGlyph, which depends on - // this behavior to properly count references to this glyph. - PT(Geom) new_geom = _geom->make_copy(); - new_geom->set_usage_hint(usage_hint); - const GeomVertexData *vdata = new_geom->get_vertex_data(); - nassertr(vdata != NULL, new_geom); - if (vdata->get_usage_hint() != usage_hint) { - new_geom->modify_vertex_data()->set_usage_hint(usage_hint); - } - return new_geom; + dimensions = _quad_dimensions; + texcoords = _quad_texcoords; + return true; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/text/textGlyph.cxx b/panda/src/text/textGlyph.cxx index 7c1c6ff4a6..c3bad08c39 100644 --- a/panda/src/text/textGlyph.cxx +++ b/panda/src/text/textGlyph.cxx @@ -27,7 +27,7 @@ TextGlyph:: //////////////////////////////////////////////////////////////////// // Function: TextGlyph::is_whitespace -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns true if this glyph represents invisible // whitespace, or false if it corresponds to some // visible character. @@ -38,3 +38,276 @@ is_whitespace() const { // all glyphs are non-whitespace. return false; } + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::get_geom +// Access: Published +// Description: Returns a Geom that renders the particular glyph. +// It will be generated if necessary. +// +// This method will always return a copy of the Geom, +// so the caller is free to modify it. +//////////////////////////////////////////////////////////////////// +PT(Geom) TextGlyph:: +get_geom(Geom::UsageHint usage_hint) const { + if (_geom.is_null()) { + // Maybe we have yet to generate a suitable Geom. + if (_has_quad) { + ((TextGlyph *)this)->make_quad_geom(); + if (_geom.is_null()) { + return (Geom *)NULL; + } + } else { + // Nope. + return (Geom *)NULL; + } + } + + // We always return a copy of the geom. That will allow the caller + // to modify its vertices without fear of stomping on other copies. + // It is also important that we store a reference to this glyph on + // the Geom, since the DynamicTextFont relies on counting references + // to determine whether a glyph is no longer used. + PT(Geom) new_geom = new GeomTextGlyph(*_geom, this); + new_geom->set_usage_hint(usage_hint); + const GeomVertexData *vdata = new_geom->get_vertex_data(); + nassertr(vdata != NULL, new_geom); + if (vdata->get_usage_hint() != usage_hint) { + new_geom->modify_vertex_data()->set_usage_hint(usage_hint); + } + return new_geom; +} + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::calc_tight_bounds +// Access: Public +// Description: Expands min_point and max_point to include all of the +// vertices in the glyph, if any. found_any is set +// true if any points are found. It is the caller's +// responsibility to initialize min_point, max_point, +// and found_any before calling this function. +//////////////////////////////////////////////////////////////////// +void TextGlyph:: +calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, + bool &found_any, Thread *current_thread) const { + if (_has_quad) { + found_any = true; + min_point.set(_quad_dimensions[0], 0, _quad_dimensions[1]); + max_point.set(_quad_dimensions[2], 0, _quad_dimensions[3]); + + } else if (!_geom.is_null()) { + _geom->calc_tight_bounds(min_point, max_point, found_any, current_thread); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::set_quad +// Access: Public +// Description: Sets the glyph using the given quad parameters. +// Any Geom assigned will be cleared. +// The order of the components is left, bottom, +// right, top. +//////////////////////////////////////////////////////////////////// +void TextGlyph:: +set_quad(const LVecBase4 &dimensions, const LVecBase4 &texcoords, + const RenderState *state) { + _geom.clear(); + + _quad_dimensions = dimensions; + _quad_texcoords = texcoords; + _has_quad = true; + _state = state; +} + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::set_geom +// Access: Public +// Description: Sets the geom from a pre-built Geom object. +// Any quad parameters assigned will be cleared. +//////////////////////////////////////////////////////////////////// +void TextGlyph:: +set_geom(GeomVertexData *vdata, GeomPrimitive *prim, + const RenderState *state) { + PT(Geom) geom = new Geom(vdata); + geom->add_primitive(prim); + _geom = geom; + + _has_quad = false; + _state = state; +} + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::check_quad_geom +// Access: Private +// Description: Checks if the geom that was passed in is actually +// a quad, and if so, sets the appropriate quad +// parameters. +// +// This is useful when loading static text fonts, so +// that they can still benefit from the fast text +// assembly that is done for quads. +//////////////////////////////////////////////////////////////////// +void TextGlyph:: +check_quad_geom() { + // Currently it looks for rather specific signs that this glyph + // has been generated using egg-mkfont. For now, this is fine. + CPT(GeomVertexData) vdata = _geom->get_vertex_data(); + if (vdata->get_num_rows() != 4) { + return; + } + + // Does it appear to have a single primitive with two triangles? + if (_geom->get_num_primitives() != 1) { + return; + } + CPT(GeomPrimitive) prim = _geom->get_primitive(0); + if (!prim->is_indexed() || + prim->get_primitive_type() != GeomPrimitive::PT_polygons) { + return; + } + if (!prim->is_of_type(GeomTriangles::get_class_type())) { + prim = prim->decompose(); + } + if (prim->get_num_vertices() != 6) { + return; + } + + // Check that it has a vertex column and optionally a texcoord column. + CPT(GeomVertexFormat) format = vdata->get_format(); + if (format->get_num_columns() > 2 || + !format->has_column(InternalName::get_vertex())) { + return; + } + if (format->has_column(InternalName::get_texcoord()) != (format->get_num_columns() == 2)) { + // The second column, if there is one, is not a texcoord. + return; + } + + // Check that the vertices are arranged in a square. + GeomVertexReader vertex(vdata, InternalName::get_vertex()); + LVecBase3 v = vertex.get_data3(); + if (!IS_NEARLY_ZERO(v[1])) { + return; + } + PN_stdfloat minx = v[0]; + PN_stdfloat maxx = v[0]; + PN_stdfloat miny = v[2]; + PN_stdfloat maxy = v[2]; + + for (int i = 0; i < 3; ++i) { + v = vertex.get_data3(); + if (!IS_NEARLY_ZERO(v[1])) { + return; + } + if (!IS_NEARLY_EQUAL(v[0], minx) && !IS_NEARLY_EQUAL(v[0], maxx)) { + if (!IS_NEARLY_EQUAL(minx, maxx)) { + return; + } + minx = min(v[0], minx); + maxx = max(v[0], maxx); + } + if (!IS_NEARLY_EQUAL(v[2], miny) && !IS_NEARLY_EQUAL(v[2], maxy)) { + if (!IS_NEARLY_EQUAL(miny, maxy)) { + return; + } + miny = min(v[2], miny); + maxy = max(v[2], maxy); + } + } + + PN_stdfloat minu = 0; + PN_stdfloat maxu = 0; + PN_stdfloat minv = 0; + PN_stdfloat maxv = 0; + + // Same for the texcoord data. + if (format->has_column(InternalName::get_texcoord())) { + GeomVertexReader texcoord(vdata, InternalName::get_texcoord()); + LVecBase2 tc = texcoord.get_data2(); + minu = tc[0]; + maxu = tc[0]; + minv = tc[1]; + maxv = tc[1]; + + for (int i = 0; i < 3; ++i) { + tc = texcoord.get_data2(); + if (!IS_NEARLY_EQUAL(tc[0], minu) && !IS_NEARLY_EQUAL(tc[0], maxu)) { + if (!IS_NEARLY_EQUAL(minu, maxu)) { + return; + } + minu = min(tc[0], minu); + maxu = max(tc[0], maxu); + } + if (!IS_NEARLY_EQUAL(tc[1], minv) && !IS_NEARLY_EQUAL(tc[1], maxv)) { + if (!IS_NEARLY_EQUAL(minv, maxv)) { + return; + } + minv = min(tc[1], minv); + maxv = max(tc[1], maxv); + } + } + } + + _quad_dimensions.set(minx, miny, maxx, maxy); + _quad_texcoords.set(minu, minv, maxu, maxv); + _has_quad = true; +} + +//////////////////////////////////////////////////////////////////// +// Function: TextGlyph::make_quad_geom +// Access: Private +// Description: Generates a Geom representing this text glyph, if +// at all possible. +//////////////////////////////////////////////////////////////////// +void TextGlyph:: +make_quad_geom() { + // The default implementation is to generate a Geom based on the + // get_quad() implementation, if any. + LVecBase4 dimensions, uvs; + if (!get_quad(dimensions, uvs)) { + return; + } + + // Create a corresponding triangle pair. We use a pair of indexed + // triangles rather than a single triangle strip, to avoid the bad + // vertex duplication behavior with lots of two-triangle strips. + PT(GeomVertexData) vdata = new GeomVertexData + (string(), GeomVertexFormat::get_v3t2(), Geom::UH_static); + vdata->unclean_set_num_rows(4); + + PT(GeomTriangles) tris = new GeomTriangles(Geom::UH_static); + + { + GeomVertexWriter vertex(vdata, InternalName::get_vertex()); + GeomVertexWriter texcoord(vdata, InternalName::get_texcoord()); + + PT(GeomVertexArrayData) indices = tris->modify_vertices(); + indices->unclean_set_num_rows(6); + + GeomVertexWriter index(indices, 0); + + vertex.set_data3(dimensions[0], 0, dimensions[3]); + vertex.set_data3(dimensions[0], 0, dimensions[1]); + vertex.set_data3(dimensions[2], 0, dimensions[3]); + vertex.set_data3(dimensions[2], 0, dimensions[1]); + + texcoord.set_data2(uvs[0], uvs[3]); + texcoord.set_data2(uvs[0], uvs[1]); + texcoord.set_data2(uvs[2], uvs[3]); + texcoord.set_data2(uvs[2], uvs[1]); + + index.set_data1i(0); + index.set_data1i(1); + index.set_data1i(2); + index.set_data1i(2); + index.set_data1i(1); + index.set_data1i(3); + } + + // We create a regular Geom here, not a GeomTextGlyph, since doing so + // would create a circular reference. When the get_geom method makes + // a copy, it will add in a pointer to this text glyph. + PT(Geom) geom = new Geom(vdata); + geom->add_primitive(tris); + _geom = geom; +} diff --git a/panda/src/text/textGlyph.h b/panda/src/text/textGlyph.h index fc321fbaf9..85f10b8509 100644 --- a/panda/src/text/textGlyph.h +++ b/panda/src/text/textGlyph.h @@ -30,7 +30,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_TEXT TextGlyph : public TypedReferenceCount { public: - INLINE TextGlyph(int character); + INLINE TextGlyph(int character, PN_stdfloat advance=0); INLINE TextGlyph(int character, const Geom *geom, const RenderState *state, PN_stdfloat advance); INLINE TextGlyph(const TextGlyph ©); @@ -39,18 +39,42 @@ public: PUBLISHED: INLINE int get_character() const; - INLINE PT(Geom) get_geom(Geom::UsageHint usage_hint) const; + INLINE bool has_quad() const; + INLINE bool get_quad(LVecBase4 &dimensions, LVecBase4 &texcoords) const; INLINE const RenderState *get_state() const; INLINE PN_stdfloat get_advance() const; virtual bool is_whitespace() const; + PT(Geom) get_geom(Geom::UsageHint usage_hint) const; + +public: + void calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, + bool &found_any, Thread *current_thread) const; + + void set_quad(const LVecBase4 &dimensions, const LVecBase4 &texcoords, + const RenderState *state); + + void set_geom(GeomVertexData *vdata, GeomPrimitive *prim, + const RenderState *state); + +private: + void check_quad_geom(); + void make_quad_geom(); + protected: int _character; CPT(Geom) _geom; CPT(RenderState) _state; PN_stdfloat _advance; + bool _has_quad; + // top, left, bottom, right + LVecBase4 _quad_dimensions; + LVecBase4 _quad_texcoords; + + friend class GeomTextGlyph; + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/text/textProperties.I b/panda/src/text/textProperties.I index 05c3521b05..0adeb553b0 100644 --- a/panda/src/text/textProperties.I +++ b/panda/src/text/textProperties.I @@ -550,6 +550,7 @@ INLINE void TextProperties:: set_text_color(const LColor &text_color) { _text_color = text_color; _specified |= F_has_text_color; + _text_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -562,6 +563,7 @@ INLINE void TextProperties:: clear_text_color() { _text_color.set(1.0f, 1.0f, 1.0f, 1.0f); _specified &= ~F_has_text_color; + _text_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -603,6 +605,7 @@ INLINE void TextProperties:: set_shadow_color(const LColor &shadow_color) { _shadow_color = shadow_color; _specified |= F_has_shadow_color; + _shadow_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -614,6 +617,7 @@ INLINE void TextProperties:: clear_shadow_color() { _shadow_color.set(0.0f, 0.0f, 0.0f, 1.0f); _specified &= ~F_has_shadow_color; + _shadow_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -711,6 +715,8 @@ INLINE void TextProperties:: set_bin(const string &bin) { _bin = bin; _specified |= F_has_bin; + _text_state.clear(); + _shadow_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -725,6 +731,8 @@ INLINE void TextProperties:: clear_bin() { _bin = string(); _specified &= ~F_has_bin; + _text_state.clear(); + _shadow_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -768,6 +776,8 @@ INLINE int TextProperties:: set_draw_order(int draw_order) { _draw_order = draw_order; _specified |= F_has_draw_order; + _text_state.clear(); + _shadow_state.clear(); return _draw_order + 3; } @@ -780,6 +790,8 @@ INLINE void TextProperties:: clear_draw_order() { _draw_order = 1; _specified &= ~F_has_draw_order; + _text_state.clear(); + _shadow_state.clear(); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/text/textProperties.cxx b/panda/src/text/textProperties.cxx index ae764288dd..116a4309aa 100644 --- a/panda/src/text/textProperties.cxx +++ b/panda/src/text/textProperties.cxx @@ -19,6 +19,9 @@ #include "staticTextFont.h" #include "bamFile.h" #include "fontPool.h" +#include "colorAttrib.h" +#include "cullBinAttrib.h" +#include "transparencyAttrib.h" PT(TextFont) TextProperties::_default_font; bool TextProperties::_loaded_default_font = false; @@ -61,6 +64,8 @@ TextProperties() { TextProperties:: TextProperties(const TextProperties ©) { (*this) = copy; + _text_state = copy._text_state; + _shadow_state = copy._shadow_state; } //////////////////////////////////////////////////////////////////// @@ -91,6 +96,9 @@ operator = (const TextProperties ©) { _glyph_scale = copy._glyph_scale; _glyph_shift = copy._glyph_shift; _text_scale = copy._text_scale; + + _text_state.clear(); + _shadow_state.clear(); } //////////////////////////////////////////////////////////////////// @@ -372,6 +380,62 @@ write(ostream &out, int indent_level) const { } } +//////////////////////////////////////////////////////////////////// +// Function: TextProperties::get_text_state +// Access: Public +// Description: Returns a RenderState object suitable for rendering +// text with these properties. +//////////////////////////////////////////////////////////////////// +const RenderState *TextProperties:: +get_text_state() const { + if (!_text_state.is_null()) { + return _text_state; + } + + CPT(RenderState) state = RenderState::make_empty(); + + if (has_text_color()) { + state = state->add_attrib(ColorAttrib::make_flat(get_text_color())); + if (get_text_color()[3] != 1.0) { + state = state->add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_alpha)); + } + } + + if (has_bin()) { + state = state->add_attrib(CullBinAttrib::make(get_bin(), get_draw_order() + 2)); + } + + swap(_text_state, state); + return _text_state; +} + +//////////////////////////////////////////////////////////////////// +// Function: TextProperties::get_shadow_state +// Access: Public +// Description: Returns a RenderState object suitable for rendering +// the shadow of this text with these properties. +//////////////////////////////////////////////////////////////////// +const RenderState *TextProperties:: +get_shadow_state() const { + if (!_shadow_state.is_null()) { + return _shadow_state; + } + + CPT(RenderState) state = RenderState::make_empty(); + + state = state->add_attrib(ColorAttrib::make_flat(get_shadow_color())); + if (get_shadow_color()[3] != 1.0) { + state = state->add_attrib(TransparencyAttrib::make(TransparencyAttrib::M_alpha)); + } + + if (has_bin()) { + state = state->add_attrib(CullBinAttrib::make(get_bin(), get_draw_order() + 1)); + } + + swap(_shadow_state, state); + return _shadow_state; +} + //////////////////////////////////////////////////////////////////// // Function: TextProperties::load_default_font // Access: Private, Static diff --git a/panda/src/text/textProperties.h b/panda/src/text/textProperties.h index 68710bbbba..e3478d41fa 100644 --- a/panda/src/text/textProperties.h +++ b/panda/src/text/textProperties.h @@ -21,6 +21,7 @@ #include "luse.h" #include "textFont.h" #include "pointerTo.h" +#include "renderState.h" //////////////////////////////////////////////////////////////////// // Class : TextProperties @@ -169,6 +170,10 @@ PUBLISHED: void write(ostream &out, int indent_level = 0) const; +public: + const RenderState *get_text_state() const; + const RenderState *get_shadow_state() const; + private: static void load_default_font(); @@ -216,6 +221,9 @@ private: PN_stdfloat _glyph_shift; PN_stdfloat _text_scale; + mutable CPT(RenderState) _text_state; + mutable CPT(RenderState) _shadow_state; + static PT(TextFont) _default_font; static bool _loaded_default_font; diff --git a/panda/src/tform/Sources.pp b/panda/src/tform/Sources.pp deleted file mode 100644 index 42894003fa..0000000000 --- a/panda/src/tform/Sources.pp +++ /dev/null @@ -1,54 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#begin lib_target - #define TARGET p3tform - #define LOCAL_LIBS \ - p3grutil p3dgraph p3pgraph p3linmath p3display p3event p3putil p3gobj p3gsgbase \ - p3mathutil p3device - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - buttonThrower.I buttonThrower.h \ - config_tform.h \ - driveInterface.I driveInterface.h \ - mouseInterfaceNode.I mouseInterfaceNode.h \ - mouseSubregion.I mouseSubregion.h \ - mouseWatcher.I mouseWatcher.h \ - mouseWatcherBase.h mouseWatcherGroup.h \ - mouseWatcherParameter.I mouseWatcherParameter.h \ - mouseWatcherRegion.I mouseWatcherRegion.h \ - trackball.h \ - transform2sg.h - - #define INCLUDED_SOURCES \ - buttonThrower.cxx \ - config_tform.cxx \ - driveInterface.cxx \ - mouseInterfaceNode.cxx \ - mouseSubregion.cxx \ - mouseWatcher.cxx \ - mouseWatcherBase.cxx \ - mouseWatcherGroup.cxx \ - mouseWatcherParameter.cxx \ - mouseWatcherRegion.cxx \ - trackball.cxx \ - transform2sg.cxx - - #define INSTALL_HEADERS \ - buttonThrower.I buttonThrower.h \ - driveInterface.I driveInterface.h \ - mouseInterfaceNode.I mouseInterfaceNode.h \ - mouseSubregion.I mouseSubregion.h \ - mouseWatcher.I mouseWatcher.h \ - mouseWatcherBase.h mouseWatcherGroup.h \ - mouseWatcherParameter.I mouseWatcherParameter.h \ - mouseWatcherRegion.I mouseWatcherRegion.h \ - trackball.h \ - transform2sg.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/tinydisplay/Sources.pp b/panda/src/tinydisplay/Sources.pp deleted file mode 100644 index b1c94a354b..0000000000 --- a/panda/src/tinydisplay/Sources.pp +++ /dev/null @@ -1,77 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_TINYDISPLAY] -#define BUILDING_DLL BUILDING_TINYDISPLAY - -#define OSX_SYS_FRAMEWORKS $[if $[not $[BUILD_IPHONE]],ApplicationServices Carbon CoreServices Cocoa ] -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define USE_PACKAGES sdl -#if $[UNIX_PLATFORM] - #define USE_PACKAGES $[USE_PACKAGES] x11 -#endif - -#begin lib_target - #define TARGET p3tinydisplay - #define LOCAL_LIBS \ - p3gsgbase p3gobj p3display \ - p3putil p3linmath p3mathutil p3pnmimage p3windisplay p3x11display - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx - - #define SOURCES \ - config_tinydisplay.h \ - tinyGeomMunger.I tinyGeomMunger.h \ - tinySDLGraphicsPipe.I tinySDLGraphicsPipe.h \ - tinySDLGraphicsWindow.h tinySDLGraphicsWindow.I \ - tinyGraphicsBuffer.h tinyGraphicsBuffer.I \ - tinyGraphicsStateGuardian.h tinyGraphicsStateGuardian.I \ - tinyTextureContext.I tinyTextureContext.h \ - tinyWinGraphicsPipe.I tinyWinGraphicsPipe.h \ - tinyWinGraphicsWindow.h tinyWinGraphicsWindow.I \ - tinyXGraphicsPipe.I tinyXGraphicsPipe.h \ - tinyXGraphicsWindow.h tinyXGraphicsWindow.I \ - tinyOffscreenGraphicsPipe.I tinyOffscreenGraphicsPipe.h \ - tinyOsxGraphicsPipe.I tinyOsxGraphicsPipe.h \ - tinyOsxGraphicsWindow.h tinyOsxGraphicsWindow.I \ - $[if $[and $[IS_OSX],$[HAVE_CARBON]],tinyOsxGraphicsWindow.mm,] \ - zbuffer.h zfeatures.h zgl.h \ - zline.h zmath.h \ - ztriangle_1.cxx ztriangle_2.cxx \ - ztriangle_3.cxx ztriangle_4.cxx \ - ztriangle.h ztriangle_two.h \ - ztriangle_code_1.h ztriangle_code_2.h \ - ztriangle_code_3.h ztriangle_code_4.h \ - ztriangle_table.h ztriangle_table.cxx \ - store_pixel.h store_pixel_code.h store_pixel_table.h - - #define INCLUDED_SOURCES \ - clip.cxx \ - config_tinydisplay.cxx \ - error.cxx \ - image_util.cxx \ - init.cxx \ - td_light.cxx \ - memory.cxx \ - specbuf.cxx \ - store_pixel.cxx \ - td_texture.cxx \ - tinyGeomMunger.cxx \ - tinyGraphicsBuffer.cxx \ - tinyGraphicsStateGuardian.cxx \ - tinyOffscreenGraphicsPipe.cxx \ - tinyOsxGraphicsPipe.cxx \ - tinySDLGraphicsPipe.cxx \ - tinySDLGraphicsWindow.cxx \ - tinyTextureContext.cxx \ - tinyWinGraphicsPipe.cxx \ - tinyWinGraphicsWindow.cxx \ - tinyXGraphicsPipe.cxx \ - tinyXGraphicsWindow.cxx \ - vertex.cxx \ - zbuffer.cxx \ - zdither.cxx \ - zline.cxx \ - zmath.cxx - -#end lib_target - diff --git a/panda/src/vision/Sources.pp b/panda/src/vision/Sources.pp deleted file mode 100644 index df37d8d4f3..0000000000 --- a/panda/src/vision/Sources.pp +++ /dev/null @@ -1,44 +0,0 @@ -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m p3prc:c - -#define USE_PACKAGES opencv artoolkit jpeg - -#define BUILDING_DLL BUILDING_VISION - -#begin lib_target - #define TARGET p3vision - #define LOCAL_LIBS \ - p3display p3text p3pgraph p3gobj p3linmath p3putil p3audio p3movies - - #define COMBINED_SOURCES p3vision_composite1.cxx - - #define SOURCES \ - arToolKit.I arToolKit.h \ - config_vision.h \ - openCVTexture.I openCVTexture.h \ - webcamVideo.h webcamVideo.I \ - webcamVideoCursorOpenCV.h webcamVideoOpenCV.h \ - webcamVideoCursorV4L.h webcamVideoV4L.h - - #define INCLUDED_SOURCES \ - arToolKit.cxx \ - config_vision.cxx \ - openCVTexture.cxx \ - webcamVideo.cxx \ - webcamVideoDS.cxx \ - webcamVideoCursorOpenCV.cxx \ - webcamVideoOpenCV.cxx \ - webcamVideoCursorV4L.cxx \ - webcamVideoV4L.cxx - - #define INSTALL_HEADERS \ - arToolKit.I arToolKit.h \ - openCVTexture.I openCVTexture.h \ - webcamVideo.h webcamVideo.I \ - webcamVideoCursorOpenCV.h webcamVideoOpenCV.h \ - webcamVideoCursorV4L.h webcamVideoV4L.h - - #define IGATESCAN all - -#end lib_target - diff --git a/panda/src/vrpn/Sources.pp b/panda/src/vrpn/Sources.pp deleted file mode 100644 index 8f878cfa93..0000000000 --- a/panda/src/vrpn/Sources.pp +++ /dev/null @@ -1,33 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_VRPN] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#define BUILDING_DLL BUILDING_VRPN - -#begin lib_target - #define TARGET p3vrpn - #define LOCAL_LIBS \ - p3device p3dgraph - #define USE_PACKAGES vrpn - - #define SOURCES \ - config_vrpn.cxx config_vrpn.h vrpnClient.I vrpnClient.cxx \ - vrpnAnalog.I vrpnAnalog.cxx vrpnAnalog.h \ - vrpnAnalogDevice.I vrpnAnalogDevice.cxx vrpnAnalogDevice.h \ - vrpnButton.I vrpnButton.cxx vrpnButton.h \ - vrpnButtonDevice.I vrpnButtonDevice.cxx vrpnButtonDevice.h \ - vrpnClient.h \ - vrpnDial.I vrpnDial.cxx vrpnDial.h \ - vrpnDialDevice.I vrpnDialDevice.cxx vrpnDialDevice.h \ - vrpnTracker.I vrpnTracker.cxx vrpnTracker.h \ - vrpnTrackerDevice.I vrpnTrackerDevice.cxx vrpnTrackerDevice.h \ - vrpn_interface.h - - #define INSTALL_HEADERS \ - config_vrpn.h \ - vrpnClient.I vrpnClient.h - - #define IGATESCAN all - -#end lib_target diff --git a/panda/src/wgldisplay/Sources.pp b/panda/src/wgldisplay/Sources.pp deleted file mode 100644 index 4ae2a07bff..0000000000 --- a/panda/src/wgldisplay/Sources.pp +++ /dev/null @@ -1,35 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_WGL] - -#define USE_PACKAGES gl cg - - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#begin lib_target - #define TARGET p3wgldisplay - #define LOCAL_LIBS \ - p3display p3putil p3windisplay p3glgsg - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define INSTALL_HEADERS \ - config_wgldisplay.h \ - wglGraphicsBuffer.I wglGraphicsBuffer.h \ - wglGraphicsPipe.I wglGraphicsPipe.h \ - wglGraphicsStateGuardian.I wglGraphicsStateGuardian.h \ - wglGraphicsWindow.I wglGraphicsWindow.h \ - wglext.h - - #define INCLUDED_SOURCES \ - config_wgldisplay.cxx \ - wglGraphicsBuffer.cxx \ - wglGraphicsPipe.cxx \ - wglGraphicsStateGuardian.cxx \ - wglGraphicsWindow.cxx - - #define SOURCES \ - $[INSTALL_HEADERS] - - -#end lib_target diff --git a/panda/src/windisplay/Sources.pp b/panda/src/windisplay/Sources.pp deleted file mode 100644 index cd450ca1b9..0000000000 --- a/panda/src/windisplay/Sources.pp +++ /dev/null @@ -1,37 +0,0 @@ -#define BUILD_DIRECTORY $[WINDOWS_PLATFORM] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m -#define WIN_SYS_LIBS Imm32.lib - -#define BUILDING_DLL BUILDING_PANDAWIN - -#define USE_PACKAGES dx9 - -#begin lib_target - #define TARGET p3windisplay - #define LOCAL_LIBS \ - p3display p3putil - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx winDetectDx9.cxx - - #define SOURCES \ - config_windisplay.h \ - winGraphicsPipe.I winGraphicsPipe.h \ - winGraphicsWindow.I winGraphicsWindow.h \ - winDetectDx.h - - #define INSTALL_HEADERS \ - config_windisplay.h \ - winGraphicsPipe.I winGraphicsPipe.h \ - winGraphicsWindow.I winGraphicsWindow.h -// Win32Defs.h - - #define INCLUDED_SOURCES \ - config_windisplay.cxx winGraphicsPipe.cxx \ - winGraphicsWindow.cxx \ - winDetectDx9.cxx - - #define WIN_SYS_LIBS Imm32.lib winmm.lib kernel32.lib oldnames.lib user32.lib gdi32.lib - -#end lib_target diff --git a/panda/src/windisplay/config_windisplay.cxx b/panda/src/windisplay/config_windisplay.cxx index e0bda2979e..4d8f8efc5b 100644 --- a/panda/src/windisplay/config_windisplay.cxx +++ b/panda/src/windisplay/config_windisplay.cxx @@ -71,6 +71,14 @@ ConfigVariableBool dpi_aware "that is introduced in Windows 8.1. Set this to false if you are " "experiencing problems with this setting.")); +ConfigVariableBool dpi_window_resize +("dpi-window-resize", false, + PRC_DESC("Set this to true to let Panda3D resize the window according to the " + "DPI settings whenever the window is dragged to a monitor with " + "different DPI, or when the DPI setting is changed in the control " + "panel. Only available in Windows 8.1 and later, and requires " + "dpi-aware to be set as well.")); + ConfigVariableBool swapbuffer_framelock ("swapbuffer-framelock", false, PRC_DESC("Set this true to enable HW swapbuffer frame-lock on 3dlabs cards")); diff --git a/panda/src/windisplay/config_windisplay.h b/panda/src/windisplay/config_windisplay.h index f3f7cb1ea4..a620b4e64a 100644 --- a/panda/src/windisplay/config_windisplay.h +++ b/panda/src/windisplay/config_windisplay.h @@ -31,6 +31,7 @@ extern ConfigVariableBool ime_aware; extern ConfigVariableBool ime_hide; extern ConfigVariableBool request_dxdisplay_information; extern ConfigVariableBool dpi_aware; +extern ConfigVariableBool dpi_window_resize; extern EXPCL_PANDAWIN ConfigVariableBool swapbuffer_framelock; diff --git a/panda/src/windisplay/winGraphicsPipe.cxx b/panda/src/windisplay/winGraphicsPipe.cxx index eb56ec2f10..8fd031ffef 100644 --- a/panda/src/windisplay/winGraphicsPipe.cxx +++ b/panda/src/windisplay/winGraphicsPipe.cxx @@ -32,6 +32,12 @@ TypeHandle WinGraphicsPipe::_type_handle; #define MAXIMUM_PROCESSORS 32 #endif +typedef enum _Process_DPI_Awareness { + Process_DPI_Unaware = 0, + Process_System_DPI_Aware = 1, + Process_Per_Monitor_DPI_Aware = 2 +} Process_DPI_Awareness; + typedef struct _PROCESSOR_POWER_INFORMATION { ULONG Number; ULONG MaxMhz; @@ -686,7 +692,6 @@ WinGraphicsPipe() { // these fns arent defined on win95, so get dynamic ptrs to them // to avoid ugly DLL loader failures on w95 _pfnTrackMouseEvent = NULL; - _pfnSetProcessDPIAware = NULL; _hUser32 = (HINSTANCE)LoadLibrary("user32.dll"); if (_hUser32 != NULL) { @@ -694,13 +699,20 @@ WinGraphicsPipe() { (PFN_TRACKMOUSEEVENT)GetProcAddress(_hUser32, "TrackMouseEvent"); if (dpi_aware) { - _pfnSetProcessDPIAware = - (PFN_SETPROCESSDPIAWARE)GetProcAddress(_hUser32, "SetProcessDPIAware"); + typedef HRESULT (WINAPI *PFN_SETPROCESSDPIAWARENESS)(Process_DPI_Awareness); + PFN_SETPROCESSDPIAWARENESS pfnSetProcessDpiAwareness = + (PFN_SETPROCESSDPIAWARENESS)GetProcAddress(_hUser32, "SetProcessDpiAwarenessInternal"); - if (windisplay_cat.is_debug()) { - windisplay_cat.debug() << "Calling SetProcessDPIAware().\n"; + if (pfnSetProcessDpiAwareness == NULL) { + if (windisplay_cat.is_debug()) { + windisplay_cat.debug() << "Unable to find SetProcessDpiAwareness in user32.dll.\n"; + } + } else { + if (windisplay_cat.is_debug()) { + windisplay_cat.debug() << "Calling SetProcessDpiAwareness().\n"; + } + pfnSetProcessDpiAwareness(Process_Per_Monitor_DPI_Aware); } - _pfnSetProcessDPIAware(); } } diff --git a/panda/src/windisplay/winGraphicsPipe.h b/panda/src/windisplay/winGraphicsPipe.h index 2afeaf0b94..88d3e264d6 100644 --- a/panda/src/windisplay/winGraphicsPipe.h +++ b/panda/src/windisplay/winGraphicsPipe.h @@ -45,9 +45,6 @@ private: typedef BOOL (WINAPI *PFN_TRACKMOUSEEVENT)(LPTRACKMOUSEEVENT); PFN_TRACKMOUSEEVENT _pfnTrackMouseEvent; - typedef BOOL (WINAPI *PFN_SETPROCESSDPIAWARE)(void); - PFN_SETPROCESSDPIAWARE _pfnSetProcessDPIAware; - public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 5018fb8a4a..f270a70f61 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -26,6 +26,10 @@ #include +#ifndef WM_DPICHANGED +#define WM_DPICHANGED 0x02E0 +#endif + TypeHandle WinGraphicsWindow::_type_handle; TypeHandle WinGraphicsWindow::WinWindowHandle::_type_handle; @@ -2151,6 +2155,28 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { system_changed_properties(properties); break; + case WM_DPICHANGED: + // The window moved to a monitor of different DPI, or someone changed + // the DPI setting in the configuration panel. + if (windisplay_cat.is_debug()) { + windisplay_cat.debug() << "DPI changed to " << LOWORD(wparam); + + if (LOWORD(wparam) != HIWORD(wparam)) { + windisplay_cat.debug(false) << "x" << HIWORD(wparam) << "\n"; + } else { + windisplay_cat.debug(false) << "\n"; + } + } + // Resize the window if requested to match the new DPI. + // Obviously, don't do this if a fixed size was requested. + if (!_properties.get_fixed_size() && dpi_window_resize) { + RECT &rect = *(LPRECT)lparam; + SetWindowPos(_hWnd, HWND_TOP, rect.left, rect.top, + rect.right - rect.left, rect.bottom - rect.top, + SWP_NOZORDER | SWP_NOACTIVATE); + } + break; + #ifdef HAVE_WIN_TOUCHINPUT case WM_TOUCH: _numTouches = LOWORD(wparam); diff --git a/panda/src/x11display/Sources.pp b/panda/src/x11display/Sources.pp deleted file mode 100644 index 34303420aa..0000000000 --- a/panda/src/x11display/Sources.pp +++ /dev/null @@ -1,21 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_X11] - -#define OTHER_LIBS p3interrogatedb:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m -#define USE_PACKAGES x11 xf86dga xrandr xcursor - -#begin lib_target - #define TARGET p3x11display - #define LOCAL_LIBS p3display - - #define SOURCES \ - config_x11display.cxx config_x11display.h \ - x11GraphicsPipe.I x11GraphicsPipe.cxx x11GraphicsPipe.h \ - x11GraphicsWindow.h x11GraphicsWindow.I x11GraphicsWindow.cxx - - #define INSTALL_HEADERS \ - x11GraphicsPipe.I x11GraphicsPipe.h \ - x11GraphicsWindow.I x11GraphicsWindow.h - -#end lib_target - diff --git a/pandatool/Package.pp b/pandatool/Package.pp deleted file mode 100644 index 28a52d356f..0000000000 --- a/pandatool/Package.pp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Package.pp -// -// This file defines certain configuration variables that are to be -// written into the various make scripts. It is processed by ppremake -// (along with the Sources.pp files in each of the various -// directories) to generate build scripts appropriate to each -// environment. -// -// This is the package-specific file, which should be at the top of -// every source hierarchy. It generally gets the ball rolling, and is -// responsible for explicitly including all of the relevent Config.pp -// files. - - - -// What is the name and version of this source tree? -#if $[eq $[PACKAGE],] - #define PACKAGE pandatool - #define VERSION 0.80 -#endif - - -// Where should we find the PANDA source directory? -#if $[or $[CTPROJS],$[PANDA]] - // If we are presently attached, use the environment variable. - #define PANDA_SOURCE $[unixfilename $[PANDA]] - #if $[eq $[PANDA],] - #error You seem to be attached to some trees, but not PANDA! - #endif -#else - // Otherwise, if we are not attached, we guess that the source is a - // sibling directory to this source root. - #define PANDA_SOURCE $[standardize $[TOPDIR]/../panda] -#endif - -// Where should we install PANDATOOL? -#if $[PANDATOOL_INSTALL] - #define PANDATOOL_INSTALL $[unixfilename $[PANDATOOL_INSTALL]] -#elif $[CTPROJS] - #set PANDATOOL $[unixfilename $[PANDATOOL]] - #define PANDATOOL_INSTALL $[PANDATOOL]/built - #if $[eq $[PANDATOOL],] - #error You seem to be attached to some trees, but not PANDATOOL! - #endif -#else - #defer PANDATOOL_INSTALL $[unixfilename $[INSTALL_DIR]] -#endif - -// Also get the PANDA Package file and everything that includes. -#if $[not $[isfile $[PANDA_SOURCE]/Package.pp]] - #printvar PANDA_SOURCE - #error PANDA source directory not found from pandatool! Are you attached properly? -#endif - -#include $[PANDA_SOURCE]/Package.pp - -// Define the inter-tree dependencies. -#define NEEDS_TREES panda $[NEEDS_TREES] -#define DEPENDABLE_HEADER_DIRS $[DEPENDABLE_HEADER_DIRS] $[PANDA_INSTALL]/include diff --git a/pandatool/Sources.pp b/pandatool/Sources.pp deleted file mode 100644 index f002841f0c..0000000000 --- a/pandatool/Sources.pp +++ /dev/null @@ -1,10 +0,0 @@ -// This is the toplevel directory. It contains configure.in and other -// stuff. - -#define DIR_TYPE toplevel - -#define SAMPLE_SOURCE_FILE src/pandatoolbase/pandatoolbase.cxx -#define REQUIRED_TREES p3dtool panda - -#define EXTRA_DIST \ - Config.Irix.pp Config.Linux.pp Config.Win32.pp Package.pp diff --git a/pandatool/src/Sources.pp b/pandatool/src/Sources.pp deleted file mode 100644 index fb8681dab2..0000000000 --- a/pandatool/src/Sources.pp +++ /dev/null @@ -1,4 +0,0 @@ -// This is a group directory: a directory level above a number of -// source subdirectories. - -#define DIR_TYPE group diff --git a/pandatool/src/assimp/Sources.pp b/pandatool/src/assimp/Sources.pp deleted file mode 100644 index b7a2a2545a..0000000000 --- a/pandatool/src/assimp/Sources.pp +++ /dev/null @@ -1,35 +0,0 @@ -#begin lib_target - #define BUILD_TARGET $[HAVE_ASSIMP] - - #define TARGET p3assimp - #define BUILDING_DLL BUILDING_ASSIMP - #define LOCAL_LIBS \ - p3pandatoolbase - #define USE_PACKAGES assimp - - #define OTHER_LIBS \ - p3egg2pg:c p3egg:c pandaegg:m \ - p3pstatclient:c p3mathutil:c p3linmath:c p3putil:c \ - p3gobj:c p3chan:c p3parametrics:c p3pgraph:c p3pgraphnodes:c \ - p3pnmimage:c p3grutil:c p3collide:c p3tform:c p3text:c \ - p3char:c p3dgraph:c p3display:c p3device:c p3cull:c \ - p3downloader:c p3pipeline:c \ - p3event:c p3gsgbase:c p3movies:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - - #define SOURCES \ - assimpLoader.cxx assimpLoader.h \ - config_assimp.cxx config_assimp.h \ - loaderFileTypeAssimp.cxx loaderFileTypeAssimp.h \ - pandaIOStream.cxx pandaIOStream.h \ - pandaIOSystem.cxx pandaIOSystem.h \ - pandaLogger.cxx pandaLogger.h - - #define INSTALL_HEADERS \ - assimpLoader.h \ - config_assimp.h loaderFileTypeAssimp.h - -#end lib_target diff --git a/pandatool/src/bam/Sources.pp b/pandatool/src/bam/Sources.pp deleted file mode 100644 index 790d11b960..0000000000 --- a/pandatool/src/bam/Sources.pp +++ /dev/null @@ -1,56 +0,0 @@ -#define USE_PACKAGES fftw cg -#define OTHER_LIBS \ - p3egg2pg:c p3egg:c pandaegg:m \ - p3pipeline:c p3recorder:c p3parametrics:c p3collide:c p3chan:c p3char:c \ - p3dgraph:c p3downloader:c p3recorder:c \ - p3pnmimagetypes:c p3pnmimage:c p3pgraph:c p3display:c \ - p3pgraphnodes:c p3gobj:c p3putil:c \ - p3mathutil:c p3linmath:c p3event:c p3pstatclient:c \ - p3gsgbase:c p3grutil:c p3text:c p3cull:c \ - p3tform:c p3device:c p3movies:c \ - $[if $[HAVE_FREETYPE],p3pnmtext:c] \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[HAVE_AUDIO],p3audio:c] \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c \ - p3dtoolconfig:m p3dtool:m p3pystub - -#begin bin_target - #define TARGET bam-info - #define LOCAL_LIBS \ - p3progbase - - #define SOURCES \ - bamInfo.cxx bamInfo.h - - #define INSTALL_HEADERS -#end bin_target - -#begin bin_target - #define TARGET egg2bam - #define LOCAL_LIBS \ - p3eggbase p3progbase - - #define SOURCES \ - eggToBam.cxx eggToBam.h -#end bin_target - - -#begin bin_target - #define TARGET bam2egg - #define LOCAL_LIBS \ - p3converter p3eggbase p3progbase - - #define SOURCES \ - bamToEgg.cxx bamToEgg.h -#end bin_target - -#begin bin_target - #define TARGET pts2bam - #define LOCAL_LIBS \ - p3progbase - - #define SOURCES \ - ptsToBam.cxx ptsToBam.h -#end bin_target diff --git a/pandatool/src/configfiles/Sources.pp b/pandatool/src/configfiles/Sources.pp deleted file mode 100644 index 34420b6967..0000000000 --- a/pandatool/src/configfiles/Sources.pp +++ /dev/null @@ -1,11 +0,0 @@ - -#define INSTALL_CONFIG \ - 30_pandatool.prc - -#if $[CTPROJS] - // These files only matter to ctattach users. - #define INSTALL_CONFIG $[INSTALL_CONFIG] pandatool.init -#endif - - -#include $[THISDIRPREFIX]pandatool.prc.pp diff --git a/pandatool/src/configfiles/pandatool.prc.pp b/pandatool/src/configfiles/pandatool.prc.pp deleted file mode 100644 index 695f6afea0..0000000000 --- a/pandatool/src/configfiles/pandatool.prc.pp +++ /dev/null @@ -1,21 +0,0 @@ -// -// pandatool.prc.pp -// -// This file defines the script to auto-generate pandatool.prc at -// ppremake time. -// - -#output 30_pandatool.prc notouch -#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]]. -################################# DO NOT EDIT ########################### - - -# Since we have compiled pandatool, it follows that the ptloader -# module is available. Request that it be loaded. This module allows -# direct loading of third-party model files like .flt, .mb, or .dxf -# into Panda, for instance via the loadModel() call or on the pview -# command line. - -load-file-type p3ptloader - -#end 30_pandatool.prc diff --git a/pandatool/src/converter/Sources.pp b/pandatool/src/converter/Sources.pp deleted file mode 100644 index 127af6a18c..0000000000 --- a/pandatool/src/converter/Sources.pp +++ /dev/null @@ -1,24 +0,0 @@ -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3display:c p3pgraph:c panda:m \ - p3mathutil:c p3linmath:c p3putil:c p3express:c p3pandabase:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#begin ss_lib_target - #define TARGET p3converter - #define LOCAL_LIBS p3pandatoolbase - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - somethingToEggConverter.I somethingToEggConverter.cxx \ - somethingToEggConverter.h \ - eggToSomethingConverter.I eggToSomethingConverter.cxx \ - eggToSomethingConverter.h - - #define INSTALL_HEADERS \ - somethingToEggConverter.I somethingToEggConverter.h \ - eggToSomethingConverter.I eggToSomethingConverter.h - -#end ss_lib_target diff --git a/pandatool/src/cvscopy/Sources.pp b/pandatool/src/cvscopy/Sources.pp deleted file mode 100644 index 087ab92904..0000000000 --- a/pandatool/src/cvscopy/Sources.pp +++ /dev/null @@ -1,37 +0,0 @@ -#begin ss_lib_target - #define TARGET p3cvscopy - #define LOCAL_LIBS \ - p3progbase p3pandatoolbase - - #define OTHER_LIBS \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - cvsCopy.h cvsSourceDirectory.h cvsSourceTree.h - - #define INCLUDED_SOURCES \ - cvsCopy.cxx cvsSourceDirectory.cxx cvsSourceTree.cxx - - #define INSTALL_HEADERS \ - cvsCopy.h - -#end ss_lib_target - -#begin test_bin_target - #define TARGET testcopy - #define LOCAL_LIBS p3cvscopy - - #define OTHER_LIBS \ - p3prc:c p3dconfig:c p3dtool:m p3pystub - - #define SOURCES \ - testCopy.cxx testCopy.h - -#end test_bin_target diff --git a/pandatool/src/daeegg/Sources.pp b/pandatool/src/daeegg/Sources.pp deleted file mode 100644 index e3557e65f1..0000000000 --- a/pandatool/src/daeegg/Sources.pp +++ /dev/null @@ -1,27 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_FCOLLADA] - -#begin ss_lib_target - #define USE_PACKAGES fcollada - #define TARGET p3daeegg - #define LOCAL_LIBS p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3pipeline:c p3mathutil:c p3linmath:c p3putil:c p3event:c \ - panda:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - - #define SOURCES \ - config_daeegg.cxx config_daeegg.h \ - daeToEggConverter.cxx daeToEggConverter.h \ - daeCharacter.cxx daeCharacter.h \ - daeMaterials.cxx daeMaterials.h \ - pre_fcollada_include.h fcollada_utils.h - - #define INSTALL_HEADERS \ - config_daeegg.h daeToEggConverter.h \ - daeCharacter.h daeMaterials.h \ - pre_fcollada_include.h fcollada_utils.h - -#end ss_lib_target diff --git a/pandatool/src/daeprogs/Sources.pp b/pandatool/src/daeprogs/Sources.pp deleted file mode 100644 index b994b66017..0000000000 --- a/pandatool/src/daeprogs/Sources.pp +++ /dev/null @@ -1,25 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_FCOLLADA] - -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3pnmimage:c p3putil:c p3event:c p3mathutil:c p3linmath:c panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub - -#begin bin_target - #define TARGET dae2egg - #define LOCAL_LIBS p3daeegg p3eggbase p3progbase - - #define SOURCES \ - daeToEgg.cxx daeToEgg.h - -#end bin_target - -//#begin bin_target -// #define TARGET egg2dae -// #define LOCAL_LIBS p3daeegg p3eggbase p3progbase -// -// #define SOURCES \ -// eggToDAE.cxx eggToDAE.h -// -//#end bin_target diff --git a/pandatool/src/dxf/Sources.pp b/pandatool/src/dxf/Sources.pp deleted file mode 100644 index 868383958d..0000000000 --- a/pandatool/src/dxf/Sources.pp +++ /dev/null @@ -1,19 +0,0 @@ -#begin ss_lib_target - #define TARGET p3dxf - #define LOCAL_LIBS p3pandatoolbase - - #define OTHER_LIBS \ - p3pipeline:c p3event:c p3putil:c p3mathutil:c p3linmath:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3dtoolutil:c p3dconfig:c p3prc:c p3interrogatedb:c p3dtoolbase:c p3dtool:m - - #define SOURCES \ - dxfFile.cxx dxfFile.h dxfLayer.h dxfLayer.cxx \ - dxfLayerMap.cxx dxfLayerMap.h \ - dxfVertex.cxx dxfVertex.h - - #define INSTALL_HEADERS \ - dxfFile.h dxfLayer.h dxfLayerMap.h dxfVertex.h - -#end ss_lib_target diff --git a/pandatool/src/dxfegg/Sources.pp b/pandatool/src/dxfegg/Sources.pp deleted file mode 100644 index bb9f1d20df..0000000000 --- a/pandatool/src/dxfegg/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -#begin ss_lib_target - #define TARGET p3dxfegg - #define LOCAL_LIBS p3converter p3dxf p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - dxfToEggConverter.cxx dxfToEggConverter.h \ - dxfToEggLayer.cxx dxfToEggLayer.h - - #define INSTALL_HEADERS \ - dxfToEggConverter.h dxfToEggLayer.h - -#end ss_lib_target diff --git a/pandatool/src/dxfprogs/Sources.pp b/pandatool/src/dxfprogs/Sources.pp deleted file mode 100644 index 8b083c037c..0000000000 --- a/pandatool/src/dxfprogs/Sources.pp +++ /dev/null @@ -1,42 +0,0 @@ -#define UNIX_SYS_LIBS m -#define USE_PACKAGES fftw - -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET dxf-points - #define LOCAL_LIBS \ - p3progbase p3dxf - - #define SOURCES \ - dxfPoints.cxx dxfPoints.h - -#end bin_target - -#begin bin_target - #define TARGET dxf2egg - #define LOCAL_LIBS p3dxf p3dxfegg p3eggbase p3progbase - - #define SOURCES \ - dxfToEgg.cxx dxfToEgg.h - -#end bin_target - -#begin bin_target - #define TARGET egg2dxf - #define LOCAL_LIBS p3dxf p3eggbase p3progbase - - #define SOURCES \ - eggToDXF.cxx eggToDXF.h \ - eggToDXFLayer.cxx eggToDXFLayer.h - -#end bin_target diff --git a/pandatool/src/egg-mkfont/Sources.pp b/pandatool/src/egg-mkfont/Sources.pp deleted file mode 100644 index d999a22a77..0000000000 --- a/pandatool/src/egg-mkfont/Sources.pp +++ /dev/null @@ -1,35 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_FREETYPE] - -#define USE_PACKAGES freetype - -#define LOCAL_LIBS \ - p3palettizer p3eggbase p3progbase - -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3pnmimagetypes:c p3pnmtext:c \ - p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET egg-mkfont - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #defer SOURCES \ - eggMakeFont.h \ - rangeDescription.h rangeDescription.I \ - rangeIterator.h rangeIterator.I - - #define INCLUDED_SOURCES \ - eggMakeFont.cxx \ - rangeDescription.cxx \ - rangeIterator.cxx - -#end bin_target diff --git a/pandatool/src/egg-optchar/Sources.pp b/pandatool/src/egg-optchar/Sources.pp deleted file mode 100644 index e8b69c4584..0000000000 --- a/pandatool/src/egg-optchar/Sources.pp +++ /dev/null @@ -1,21 +0,0 @@ -#define LOCAL_LIBS \ - p3eggcharbase p3converter p3eggbase p3progbase -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3event:c p3pipeline:c p3pstatclient:c p3downloader:c p3net:c p3nativenet:c \ - p3pnmimagetypes:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub -#define UNIX_SYS_LIBS m - -#begin bin_target - #define TARGET egg-optchar - - #define SOURCES \ - config_egg_optchar.cxx config_egg_optchar.h \ - eggOptchar.cxx eggOptchar.h \ - eggOptcharUserData.I eggOptcharUserData.cxx eggOptcharUserData.h \ - vertexMembership.I vertexMembership.cxx vertexMembership.h - -#end bin_target diff --git a/pandatool/src/egg-palettize/Sources.pp b/pandatool/src/egg-palettize/Sources.pp deleted file mode 100644 index 5bb7b6e3c8..0000000000 --- a/pandatool/src/egg-palettize/Sources.pp +++ /dev/null @@ -1,36 +0,0 @@ -#define USE_PACKAGES cg // from gobj. - -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pgraph:c p3pgraphnodes:c p3gobj:c p3linmath:c p3putil:c \ - p3pnmimage:c p3pnmimagetypes:c p3display:c p3pipeline:c \ - p3event:c p3mathutil:c p3cull:c p3gsgbase:c p3pstatclient:c \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - panda:m \ - p3pandabase:c p3express:c p3downloader:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c \ - p3dtoolconfig:m p3dtool:m - -#begin bin_target - #define TARGET egg-palettize - #define LOCAL_LIBS \ - p3palettizer p3eggbase p3progbase - - #define OTHER_LIBS $[OTHER_LIBS] p3pystub - - #define SOURCES \ - eggPalettize.h eggPalettize.cxx - -#end bin_target - -#begin lib_target - #define TARGET p3txafile - #define BUILDING_DLL BUILDING_MISC - #define LOCAL_LIBS \ - p3palettizer - - #define SOURCES \ - txaFileFilter.h txaFileFilter.I txaFileFilter.cxx - -#end lib_target - diff --git a/pandatool/src/egg-qtess/Sources.pp b/pandatool/src/egg-qtess/Sources.pp deleted file mode 100644 index b9d1770a79..0000000000 --- a/pandatool/src/egg-qtess/Sources.pp +++ /dev/null @@ -1,46 +0,0 @@ -#define USE_PACKAGES cg // from gobj. - -#begin bin_target - #define TARGET egg-qtess - #define LOCAL_LIBS \ - p3eggbase p3progbase - #define OTHER_LIBS \ - p3egg2pg:c p3egg:c pandaegg:m \ - p3chan:c p3char:c p3downloader:c p3event:c \ - p3tform:c p3grutil:c p3text:c p3dgraph:c p3display:c p3gsgbase:c \ - p3collide:c p3gobj:c p3cull:c p3device:c \ - p3parametrics:c p3pgraph:c p3pgraphnodes:c p3pipeline:c p3pstatclient:c p3chan:c \ - p3pnmimagetypes:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c \ - p3movies:c \ - $[if $[HAVE_FREETYPE],p3pnmtext:c] \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[HAVE_AUDIO],p3audio:c] \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub - #define UNIX_SYS_LIBS m - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_egg_qtess.h \ - eggQtess.h \ - isoPlacer.I isoPlacer.h \ - qtessGlobals.h \ - qtessInputEntry.I qtessInputEntry.h \ - qtessInputFile.I qtessInputFile.h \ - qtessSurface.I qtessSurface.h \ - subdivSegment.I subdivSegment.h - - #define INCLUDED_SOURCES \ - config_egg_qtess.cxx \ - eggQtess.cxx \ - isoPlacer.cxx \ - qtessGlobals.cxx \ - qtessInputEntry.cxx \ - qtessInputFile.cxx \ - qtessSurface.cxx \ - subdivSegment.cxx - -#end bin_target - diff --git a/pandatool/src/eggbase/Sources.pp b/pandatool/src/eggbase/Sources.pp deleted file mode 100644 index fdddba7cee..0000000000 --- a/pandatool/src/eggbase/Sources.pp +++ /dev/null @@ -1,38 +0,0 @@ -#begin ss_lib_target - #define TARGET p3eggbase - #define LOCAL_LIBS \ - p3progbase p3converter - #define OTHER_LIBS \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - eggBase.h eggConverter.h eggFilter.h \ - eggMakeSomething.h \ - eggMultiBase.h eggMultiFilter.h \ - eggReader.h eggSingleBase.h \ - eggToSomething.h eggWriter.h \ - somethingToEgg.h - - #define INCLUDED_SOURCES \ - eggBase.cxx eggConverter.cxx eggFilter.cxx \ - eggMakeSomething.cxx \ - eggMultiBase.cxx \ - eggMultiFilter.cxx eggReader.cxx eggSingleBase.cxx \ - eggToSomething.cxx \ - eggWriter.cxx somethingToEgg.cxx - - #define INSTALL_HEADERS \ - eggBase.h eggConverter.h eggFilter.h \ - eggMakeSomething.h \ - eggMultiBase.h eggMultiFilter.h \ - eggReader.h eggSingleBase.h eggToSomething.h eggWriter.h somethingToEgg.h - -#end ss_lib_target - diff --git a/pandatool/src/eggcharbase/Sources.pp b/pandatool/src/eggcharbase/Sources.pp deleted file mode 100644 index 34ee69e60e..0000000000 --- a/pandatool/src/eggcharbase/Sources.pp +++ /dev/null @@ -1,58 +0,0 @@ -#begin ss_lib_target - #define TARGET p3eggcharbase - #define LOCAL_LIBS \ - p3eggbase p3progbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3event:c p3linmath:c p3mathutil:c p3pnmimage:c p3putil:c \ - p3pipeline:c p3pstatclient:c p3downloader:c p3net:c p3nativenet:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c dtooolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - #define USE_PACKAGES zlib - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_eggcharbase.h eggBackPointer.h \ - eggCharacterCollection.h eggCharacterCollection.I \ - eggCharacterData.h eggCharacterData.I \ - eggCharacterDb.I eggCharacterDb.h \ - eggCharacterFilter.h \ - eggComponentData.h eggComponentData.I \ - eggJointData.h \ - eggJointData.I eggJointPointer.h eggJointPointer.I \ - eggJointNodePointer.h \ - eggMatrixTablePointer.h eggScalarTablePointer.h \ - eggSliderData.h eggSliderData.I \ - eggVertexPointer.h - - #define INCLUDED_SOURCES \ - config_eggcharbase.cxx eggBackPointer.cxx \ - eggCharacterCollection.cxx eggCharacterData.cxx \ - eggCharacterDb.cxx \ - eggCharacterFilter.cxx eggComponentData.cxx eggJointData.cxx \ - eggJointPointer.cxx eggJointNodePointer.cxx \ - eggMatrixTablePointer.cxx eggScalarTablePointer.cxx \ - eggSliderData.cxx \ - eggSliderPointer.cxx \ - eggVertexPointer.cxx - - #define INSTALL_HEADERS \ - eggBackPointer.h \ - eggCharacterCollection.I eggCharacterCollection.h \ - eggCharacterData.I eggCharacterData.h \ - eggCharacterDb.I eggCharacterDb.h \ - eggCharacterFilter.h \ - eggComponentData.I eggComponentData.h \ - eggJointData.h eggJointData.I \ - eggJointPointer.h eggJointPointer.I \ - eggJointNodePointer.h \ - eggMatrixTablePointer.h \ - eggScalarTablePointer.h \ - eggSliderData.I eggSliderData.h \ - eggVertexPointer.h - -#end ss_lib_target - diff --git a/pandatool/src/eggprogs/Sources.pp b/pandatool/src/eggprogs/Sources.pp deleted file mode 100644 index 54754a8ec5..0000000000 --- a/pandatool/src/eggprogs/Sources.pp +++ /dev/null @@ -1,84 +0,0 @@ -#define LOCAL_LIBS \ - p3converter p3eggbase p3progbase -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3event:c p3pipeline:c p3pstatclient:c p3downloader:c p3net:c p3nativenet:c \ - p3pnmimagetypes:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub -#define UNIX_SYS_LIBS m - -#begin bin_target - #define TARGET egg-rename - - #define SOURCES \ - eggRename.cxx eggRename.h - -#end bin_target - -#begin bin_target - #define TARGET egg-trans - - #define SOURCES \ - eggTrans.cxx eggTrans.h - -#end bin_target - -#begin bin_target - #define TARGET egg-crop - - #define SOURCES \ - eggCrop.cxx eggCrop.h - -#end bin_target - -#begin bin_target - #define TARGET egg-texture-cards - - #define SOURCES \ - eggTextureCards.cxx eggTextureCards.h - -#end bin_target - -#begin bin_target - #define TARGET egg-make-tube - - #define SOURCES \ - eggMakeTube.cxx eggMakeTube.h - -#end bin_target - -#begin bin_target - #define LOCAL_LIBS p3eggcharbase $[LOCAL_LIBS] - #define TARGET egg-topstrip - - #define SOURCES \ - eggTopstrip.cxx eggTopstrip.h - -#end bin_target - -#begin bin_target - #define LOCAL_LIBS p3eggcharbase $[LOCAL_LIBS] - #define TARGET egg-retarget-anim - - #define SOURCES \ - eggRetargetAnim.cxx eggRetargetAnim.h - -#end bin_target - -#begin bin_target - #define TARGET egg2c - - #define SOURCES \ - eggToC.cxx eggToC.h - -#end bin_target - -#begin bin_target - #define TARGET egg-list-textures - - #define SOURCES \ - eggListTextures.cxx eggListTextures.h - -#end bin_target diff --git a/pandatool/src/flt/Sources.pp b/pandatool/src/flt/Sources.pp deleted file mode 100644 index 03a8fe8889..0000000000 --- a/pandatool/src/flt/Sources.pp +++ /dev/null @@ -1,71 +0,0 @@ -#define USE_PACKAGES zlib - -#begin ss_lib_target - #define TARGET p3flt - #define LOCAL_LIBS p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3pstatclient:c p3downloader:c p3net:c p3nativenet:c \ - p3mathutil:c p3linmath:c p3putil:c p3event:c p3express:c \ - panda:m \ - p3pandabase:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - #define UNIX_SYS_LIBS m - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_flt.h fltBead.h fltBeadID.h fltCurve.I fltCurve.h \ - fltError.h fltExternalReference.h fltEyepoint.h fltFace.I \ - fltFace.h fltGeometry.I fltGeometry.h fltGroup.h fltHeader.h \ - fltInstanceDefinition.h fltInstanceRef.h fltLOD.h \ - fltLightSourceDefinition.h fltLocalVertexPool.I \ - fltLocalVertexPool.h fltMaterial.h fltMesh.I fltMesh.h \ - fltMeshPrimitive.I fltMeshPrimitive.h fltObject.h \ - fltOpcode.h fltPackedColor.I fltPackedColor.h fltRecord.I \ - fltRecord.h fltRecordReader.h fltRecordWriter.h fltTexture.h \ - fltTrackplane.h fltTransformGeneralMatrix.h \ - fltTransformPut.h fltTransformRecord.h \ - fltTransformRotateAboutEdge.h fltTransformRotateAboutPoint.h \ - fltTransformRotateScale.h fltTransformScale.h \ - fltTransformTranslate.h fltUnsupportedRecord.h \ - fltVectorRecord.h \ - fltVertex.I fltVertex.h fltVertexList.h - - #define INCLUDED_SOURCES \ - config_flt.cxx fltBead.cxx fltBeadID.cxx fltCurve.cxx \ - fltError.cxx fltExternalReference.cxx fltEyepoint.cxx \ - fltFace.cxx fltGeometry.cxx fltGroup.cxx fltHeader.cxx \ - fltInstanceDefinition.cxx fltInstanceRef.cxx fltLOD.cxx \ - fltLightSourceDefinition.cxx fltLocalVertexPool.cxx \ - fltMaterial.cxx fltMesh.cxx fltMeshPrimitive.cxx \ - fltObject.cxx fltOpcode.cxx fltPackedColor.cxx fltRecord.cxx \ - fltRecordReader.cxx fltRecordWriter.cxx fltTexture.cxx \ - fltTrackplane.cxx fltTransformGeneralMatrix.cxx \ - fltTransformPut.cxx fltTransformRecord.cxx \ - fltTransformRotateAboutEdge.cxx \ - fltTransformRotateAboutPoint.cxx fltTransformRotateScale.cxx \ - fltTransformScale.cxx fltTransformTranslate.cxx \ - fltUnsupportedRecord.cxx fltVectorRecord.cxx \ - fltVertex.cxx fltVertexList.cxx - - #define INSTALL_HEADERS \ - fltBead.h fltBeadID.h fltCurve.I fltCurve.h \ - fltError.h fltExternalReference.h \ - fltEyepoint.h fltFace.I fltFace.h fltGeometry.I fltGeometry.h \ - fltGroup.h fltHeader.h \ - fltInstanceDefinition.h fltInstanceRef.h fltLOD.h \ - fltLightSourceDefinition.h fltLocalVertexPool.I fltLocalVertexPool.h \ - fltMaterial.h fltMesh.I fltMesh.h \ - fltMeshPrimitive.I fltMeshPrimitive.h \ - fltObject.h fltOpcode.h \ - fltPackedColor.I fltPackedColor.h fltRecord.I fltRecord.h \ - fltRecordReader.h fltRecordWriter.h fltTexture.h fltTrackplane.h \ - fltTransformGeneralMatrix.h fltTransformPut.h fltTransformRecord.h \ - fltTransformRotateAboutEdge.h fltTransformRotateAboutPoint.h \ - fltTransformRotateScale.h fltTransformScale.h \ - fltTransformTranslate.h fltUnsupportedRecord.h fltVectorRecord.h \ - fltVertex.I fltVertex.h fltVertexList.h - -#end ss_lib_target diff --git a/pandatool/src/fltegg/Sources.pp b/pandatool/src/fltegg/Sources.pp deleted file mode 100644 index 441bb4fabc..0000000000 --- a/pandatool/src/fltegg/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -#begin ss_lib_target - #define TARGET p3fltegg - #define LOCAL_LIBS p3converter p3flt p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3mathutil:c p3linmath:c p3putil:c p3event:c p3pipeline:c \ - p3pstatclient:c p3downloader:c p3net:c p3nativenet:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - fltToEggConverter.I fltToEggConverter.cxx fltToEggConverter.h \ - fltToEggLevelState.I fltToEggLevelState.cxx fltToEggLevelState.h - - #define INSTALL_HEADERS \ - fltToEggConverter.I fltToEggConverter.h \ - fltToEggLevelState.I fltToEggLevelState.h - -#end ss_lib_target diff --git a/pandatool/src/fltprogs/Sources.pp b/pandatool/src/fltprogs/Sources.pp deleted file mode 100644 index 92504e4886..0000000000 --- a/pandatool/src/fltprogs/Sources.pp +++ /dev/null @@ -1,56 +0,0 @@ -#define UNIX_SYS_LIBS m - -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3pnmimagetypes:c p3pnmimage:c p3event:c \ - p3putil:c p3mathutil:c p3pipeline:c p3pstatclient:c p3downloader:c p3net:c p3nativenet:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub - -#begin bin_target - #define TARGET fltcopy - #define LOCAL_LIBS p3cvscopy p3flt - - #define SOURCES \ - fltCopy.cxx fltCopy.h - -#end bin_target - -#begin bin_target - #define TARGET flt-trans - #define LOCAL_LIBS \ - p3progbase p3flt - - #define SOURCES \ - fltTrans.cxx fltTrans.h - -#end bin_target - -#begin bin_target - #define TARGET flt-info - #define LOCAL_LIBS \ - p3progbase p3flt - - #define SOURCES \ - fltInfo.cxx fltInfo.h - -#end bin_target - -#begin bin_target - #define TARGET flt2egg - #define LOCAL_LIBS p3flt p3fltegg p3eggbase p3progbase - - #define SOURCES \ - fltToEgg.cxx fltToEgg.h - -#end bin_target - -#begin bin_target - #define TARGET egg2flt - #define LOCAL_LIBS p3flt p3eggbase p3progbase - - #define SOURCES \ - eggToFlt.cxx eggToFlt.h - -#end bin_target diff --git a/pandatool/src/gtk-stats/Sources.pp b/pandatool/src/gtk-stats/Sources.pp deleted file mode 100644 index fb2d922a8f..0000000000 --- a/pandatool/src/gtk-stats/Sources.pp +++ /dev/null @@ -1,37 +0,0 @@ -#define BUILD_DIRECTORY $[and $[HAVE_GTK],$[HAVE_NET]] -#define USE_PACKAGES net gtk - -#begin bin_target - // We suspect gtk will not be built universal on OSX. Don't try. - #define UNIVERSAL_BINARIES - - // We rename TARGET to pstats-gtk on Windows, so it won't compete - // with Windows-native pstats. - #define TARGET $[if $[WINDOWS_PLATFORM],pstats-gtk,pstats] - #define LOCAL_LIBS \ - p3progbase p3pstatserver - #define OTHER_LIBS \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3pandabase:c p3pnmimage:c p3event:c p3pstatclient:c \ - p3linmath:c p3putil:c p3pipeline:c p3express:c pandaexpress:m panda:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m \ - p3pystub - - #define SOURCES \ - gtkStats.cxx \ - gtkStatsChartMenu.cxx gtkStatsChartMenu.h \ - gtkStatsGraph.cxx gtkStatsGraph.h \ - gtkStatsLabel.cxx gtkStatsLabel.h \ - gtkStatsLabelStack.cxx gtkStatsLabelStack.h \ - gtkStatsMenuId.h \ - gtkStatsMonitor.cxx gtkStatsMonitor.h gtkStatsMonitor.I \ - gtkStatsPianoRoll.cxx gtkStatsPianoRoll.h \ - gtkStatsServer.cxx gtkStatsServer.h \ - gtkStatsStripChart.cxx gtkStatsStripChart.h - - #if $[DEVELOP_GTKSTATS] - #define EXTRA_CDEFS $[EXTRA_CDEFS] DEVELOP_GTKSTATS - #endif - -#end bin_target - diff --git a/pandatool/src/imagebase/Sources.pp b/pandatool/src/imagebase/Sources.pp deleted file mode 100644 index 0cca137f21..0000000000 --- a/pandatool/src/imagebase/Sources.pp +++ /dev/null @@ -1,28 +0,0 @@ -#begin ss_lib_target - #define TARGET p3imagebase - #define LOCAL_LIBS \ - p3progbase - - #define OTHER_LIBS \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - imageReader.h imageWriter.I imageWriter.h \ - imageBase.h imageFilter.h - - #define INCLUDED_SOURCES \ - imageBase.cxx imageFilter.cxx \ - imageReader.cxx imageWriter.cxx - - #define INSTALL_HEADERS \ - imageBase.h imageFilter.h imageReader.h imageWriter.I imageWriter.h - -#end ss_lib_target - diff --git a/pandatool/src/imageprogs/Sources.pp b/pandatool/src/imageprogs/Sources.pp deleted file mode 100644 index 9cf99d0f91..0000000000 --- a/pandatool/src/imageprogs/Sources.pp +++ /dev/null @@ -1,45 +0,0 @@ -#define LOCAL_LIBS \ - p3imagebase p3progbase - -#define OTHER_LIBS \ - p3pipeline:c p3event:c p3pstatclient:c p3grutil:c \ - panda:m \ - p3pandabase:c p3pnmimage:c p3pnmimagetypes:c \ - p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET image-trans - #define SOURCES \ - imageTrans.cxx imageTrans.h -#end bin_target - -#begin bin_target - #define TARGET image-resize - #define SOURCES \ - imageResize.cxx imageResize.h imageResize.I -#end bin_target - -#begin bin_target - #define TARGET image-fix-hidden-color - #define SOURCES \ - imageFixHiddenColor.cxx imageFixHiddenColor.h imageFixHiddenColor.I -#end bin_target - -#begin bin_target - #define TARGET image-transform-colors - #define SOURCES \ - imageTransformColors.cxx imageTransformColors.h imageTransformColors.I -#end bin_target - -#begin bin_target - #define TARGET image-info - #define SOURCES \ - imageInfo.cxx imageInfo.h -#end bin_target - diff --git a/pandatool/src/lwo/Sources.pp b/pandatool/src/lwo/Sources.pp deleted file mode 100644 index 62bf8bf355..0000000000 --- a/pandatool/src/lwo/Sources.pp +++ /dev/null @@ -1,90 +0,0 @@ -#define LOCAL_LIBS p3pandatoolbase -#define OTHER_LIBS \ - p3mathutil:c p3linmath:c p3putil:c p3pipeline:c p3event:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m -#define UNIX_SYS_LIBS m - -#begin ss_lib_target - #define TARGET p3lwo - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_lwo.h iffChunk.I iffChunk.h iffGenericChunk.I \ - iffGenericChunk.h iffId.I iffId.h iffInputFile.I \ - iffInputFile.h lwoBoundingBox.h lwoChunk.h lwoClip.h \ - lwoDiscontinuousVertexMap.h lwoGroupChunk.h lwoHeader.I \ - lwoHeader.h lwoInputFile.I lwoInputFile.h lwoLayer.h \ - lwoPoints.h lwoPolygons.h lwoPolygonTags.h lwoTags.h \ - lwoStillImage.h lwoSurface.h lwoSurfaceBlock.h \ - lwoSurfaceBlockAxis.h lwoSurfaceBlockChannel.h \ - lwoSurfaceBlockCoordSys.h lwoSurfaceBlockEnabled.h \ - lwoSurfaceBlockImage.h lwoSurfaceBlockOpacity.h \ - lwoSurfaceBlockProjection.h lwoSurfaceBlockHeader.h \ - lwoSurfaceBlockRefObj.h lwoSurfaceBlockRepeat.h \ - lwoSurfaceBlockTMap.h lwoSurfaceBlockTransform.h \ - lwoSurfaceBlockVMapName.h lwoSurfaceBlockWrap.h \ - lwoSurfaceColor.h lwoSurfaceParameter.h \ - lwoSurfaceSidedness.h lwoSurfaceSmoothingAngle.h \ - lwoVertexMap.h - - #define INCLUDED_SOURCES \ - config_lwo.cxx iffChunk.cxx iffGenericChunk.cxx iffId.cxx \ - iffInputFile.cxx lwoBoundingBox.cxx lwoChunk.cxx lwoClip.cxx \ - lwoDiscontinuousVertexMap.cxx lwoGroupChunk.cxx \ - lwoHeader.cxx lwoInputFile.cxx lwoLayer.cxx lwoPoints.cxx \ - lwoPolygons.cxx lwoPolygonTags.cxx lwoTags.cxx \ - lwoStillImage.cxx lwoSurface.cxx lwoSurfaceBlock.cxx \ - lwoSurfaceBlockAxis.cxx lwoSurfaceBlockChannel.cxx \ - lwoSurfaceBlockCoordSys.cxx lwoSurfaceBlockEnabled.cxx \ - lwoSurfaceBlockImage.cxx lwoSurfaceBlockOpacity.cxx \ - lwoSurfaceBlockProjection.cxx lwoSurfaceBlockHeader.cxx \ - lwoSurfaceBlockRefObj.cxx lwoSurfaceBlockRepeat.cxx \ - lwoSurfaceBlockTMap.cxx lwoSurfaceBlockTransform.cxx \ - lwoSurfaceBlockVMapName.cxx lwoSurfaceBlockWrap.cxx \ - lwoSurfaceColor.cxx lwoSurfaceParameter.cxx \ - lwoSurfaceSidedness.cxx lwoSurfaceSmoothingAngle.cxx \ - lwoVertexMap.cxx - - #define INSTALL_HEADERS \ - iffChunk.I iffChunk.h iffGenericChunk.I iffGenericChunk.h iffId.I \ - iffId.h iffInputFile.I iffInputFile.h \ - lwoBoundingBox.h \ - lwoChunk.h \ - lwoClip.h \ - lwoDiscontinuousVertexMap.h \ - lwoGroupChunk.h \ - lwoHeader.I lwoHeader.h \ - lwoInputFile.I lwoInputFile.h \ - lwoLayer.h \ - lwoPoints.h \ - lwoPolygons.h \ - lwoPolygonTags.h \ - lwoTags.h \ - lwoStillImage.h \ - lwoSurface.h \ - lwoSurfaceBlock.h \ - lwoSurfaceBlockAxis.h \ - lwoSurfaceBlockChannel.h \ - lwoSurfaceBlockCoordSys.h \ - lwoSurfaceBlockEnabled.h \ - lwoSurfaceBlockImage.h \ - lwoSurfaceBlockOpacity.h \ - lwoSurfaceBlockProjection.h \ - lwoSurfaceBlockHeader.h \ - lwoSurfaceBlockRefObj.h \ - lwoSurfaceBlockRepeat.h \ - lwoSurfaceBlockTMap.h \ - lwoSurfaceBlockTransform.h \ - lwoSurfaceBlockVMapName.h \ - lwoSurfaceBlockWrap.h \ - lwoSurfaceColor.h \ - lwoSurfaceParameter.h \ - lwoSurfaceSidedness.h \ - lwoSurfaceSmoothingAngle.h \ - lwoVertexMap.h - -#end ss_lib_target diff --git a/pandatool/src/lwoegg/Sources.pp b/pandatool/src/lwoegg/Sources.pp deleted file mode 100644 index 7fbc50b614..0000000000 --- a/pandatool/src/lwoegg/Sources.pp +++ /dev/null @@ -1,31 +0,0 @@ -#begin ss_lib_target - #define TARGET p3lwoegg - #define LOCAL_LIBS p3converter p3lwo p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3mathutil:c p3linmath:c p3putil:c p3pipeline:c p3event:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - #define UNIX_SYS_LIBS m - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - cLwoClip.I cLwoClip.h cLwoLayer.I cLwoLayer.h cLwoPoints.I \ - cLwoPoints.h cLwoPolygons.I cLwoPolygons.h cLwoSurface.I \ - cLwoSurface.h cLwoSurfaceBlock.I cLwoSurfaceBlock.h \ - cLwoSurfaceBlockTMap.I cLwoSurfaceBlockTMap.h \ - lwoToEggConverter.I lwoToEggConverter.h - - #define INCLUDED_SOURCES \ - cLwoClip.cxx cLwoLayer.cxx cLwoPoints.cxx cLwoPolygons.cxx \ - cLwoSurface.cxx cLwoSurfaceBlock.cxx \ - cLwoSurfaceBlockTMap.cxx lwoToEggConverter.cxx \ - lwoToEggConverter.h - - #define INSTALL_HEADERS \ - lwoToEggConverter.I lwoToEggConverter.h - -#end ss_lib_target diff --git a/pandatool/src/lwoprogs/Sources.pp b/pandatool/src/lwoprogs/Sources.pp deleted file mode 100644 index 425e2ac0dc..0000000000 --- a/pandatool/src/lwoprogs/Sources.pp +++ /dev/null @@ -1,29 +0,0 @@ - -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET lwo2egg - #define LOCAL_LIBS p3lwo p3lwoegg p3eggbase p3progbase - - #define SOURCES \ - lwoToEgg.cxx lwoToEgg.h - -#end bin_target - -#begin bin_target - #define TARGET lwo-scan - #define LOCAL_LIBS p3lwo p3progbase - - #define SOURCES \ - lwoScan.cxx lwoScan.h - -#end bin_target diff --git a/pandatool/src/maya/Sources.pp b/pandatool/src/maya/Sources.pp deleted file mode 100644 index 6ecd3dd2d0..0000000000 --- a/pandatool/src/maya/Sources.pp +++ /dev/null @@ -1,24 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_MAYA] - -#begin ss_lib_target - #define USE_PACKAGES maya - #define TARGET mayabase - #define LOCAL_LIBS \ - p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m \ - p3pipeline:c p3interrogatedb:c - - #define SOURCES \ - config_maya.cxx config_maya.h \ - mayaApi.cxx mayaApi.h \ - mayaShader.cxx mayaShader.h \ - mayaShaderColorDef.cxx mayaShaderColorDef.h \ - mayaShaders.cxx mayaShaders.h \ - maya_funcs.I maya_funcs.cxx maya_funcs.h \ - post_maya_include.h pre_maya_include.h - -#end ss_lib_target - diff --git a/pandatool/src/mayaegg/Sources.pp b/pandatool/src/mayaegg/Sources.pp deleted file mode 100644 index de7a2d142d..0000000000 --- a/pandatool/src/mayaegg/Sources.pp +++ /dev/null @@ -1,28 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_MAYA] - -#begin ss_lib_target - #define USE_PACKAGES maya - #define TARGET p3mayaegg - #define LOCAL_LIBS \ - mayabase p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub \ - p3pipeline:c p3interrogatedb:c p3gobj:c - - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - config_mayaegg.cxx config_mayaegg.h \ - mayaEggGroupUserData.cxx mayaEggGroupUserData.I mayaEggGroupUserData.h \ - mayaEggLoader.cxx mayaEggLoader.h \ - mayaBlendDesc.cxx mayaBlendDesc.h \ - mayaNodeDesc.cxx mayaNodeDesc.h \ - mayaNodeTree.cxx mayaNodeTree.h \ - mayaToEggConverter.cxx mayaToEggConverter.h - -#end ss_lib_target - diff --git a/pandatool/src/mayaprogs/Sources.pp b/pandatool/src/mayaprogs/Sources.pp deleted file mode 100644 index 85fc9b8085..0000000000 --- a/pandatool/src/mayaprogs/Sources.pp +++ /dev/null @@ -1,241 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_MAYA] - -#define WIN_SYS_LIBS shell32.lib advapi32.lib ws2_32.lib - -#begin bin_target - #define TARGET maya2egg - #define OTHER_LIBS \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m \ - p3express:c pandaexpress:m - #define SOURCES \ - mayapath.cxx -#end bin_target - -#begin bin_target - #define TARGET maya2egg_server - #define OTHER_LIBS \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m \ - p3express:c pandaexpress:m - #define SOURCES \ - mayapath.cxx -#end bin_target - -#begin bin_target - #define USE_PACKAGES maya - #define TARGET maya2egg_bin - #define LOCAL_LIBS \ - mayabase p3mayaegg p3eggbase p3progbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3pipeline:c p3pnmimage:c - - // Irix requires this to be named explicitly. - #define UNIX_SYS_LIBS \ - ExtensionLayer - - #define SOURCES \ - mayaToEgg.cxx mayaToEgg.h - -#end bin_target - -#begin bin_target - #define USE_PACKAGES maya - #define TARGET maya2egg_server_bin - #define LOCAL_LIBS \ - mayabase p3mayaegg p3eggbase p3progbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3pipeline:c p3pnmimage:c - - // Irix requires this to be named explicitly. - #define UNIX_SYS_LIBS \ - ExtensionLayer - - #define SOURCES \ - mayaToEgg_server.cxx mayaToEgg_server.h - -#end bin_target - -#begin bin_target - #define USE_PACKAGES maya - #define TARGET maya2egg_client - #define LOCAL_LIBS \ - mayabase p3mayaegg p3eggbase p3progbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3pipeline:c p3pnmimage:c - - // Irix requires this to be named explicitly. - #define UNIX_SYS_LIBS \ - ExtensionLayer - - #define SOURCES \ - mayaToEgg_client.cxx mayaToEgg_client.h - -#end bin_target - -#begin bin_target - #define TARGET egg2maya - #define OTHER_LIBS \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m \ - p3express:c pandaexpress:m - #define SOURCES \ - mayapath.cxx -#end bin_target - -#begin bin_target - #define USE_PACKAGES maya - #define TARGET egg2maya_bin - #define LOCAL_LIBS \ - mayabase p3mayaegg p3eggbase p3progbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3pipeline:c p3pnmimage:c - - // Irix requires this to be named explicitly. - #define UNIX_SYS_LIBS \ - ExtensionLayer - - #define SOURCES \ - eggToMaya.cxx eggToMaya.h - -#end bin_target - - -#begin bin_target - #define TARGET mayacopy - #define OTHER_LIBS \ - p3dtoolbase:c p3dtoolutil:c p3dtool:m p3prc:c p3dtoolconfig:m \ - p3express:c pandaexpress:m - #define SOURCES \ - mayapath.cxx -#end bin_target - -#begin bin_target - #define USE_PACKAGES maya - #define TARGET mayacopy_bin - #define LOCAL_LIBS p3cvscopy mayabase p3progbase - - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3putil:c p3pipeline:c p3pnmimage:c - - // Irix requires this to be named explicitly. - #define UNIX_SYS_LIBS \ - ExtensionLayer - - #define SOURCES \ - mayaCopy.cxx mayaCopy.h - -#end bin_target - - -#begin lib_target - #define BUILD_TARGET $[not $[LINK_ALL_STATIC]] - #define USE_PACKAGES maya - #define TARGET mayapview - #define LOCAL_LIBS mayabase p3mayaegg - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3framework:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3pipeline:c - - #define BUILDING_DLL BUILDING_MISC - - #if $[WINDOWS_PLATFORM] - // On Windows, Maya expects its plugins to be named with a .mll - // extension, but it's a perfectly normal dll otherwise. This - // ppremake hack achieves that filename. - #define dlllib mll - #endif - - #define SOURCES \ - mayaPview.cxx mayaPview.h - -#end lib_target - -#begin lib_target - #define BUILD_TARGET $[not $[LINK_ALL_STATIC]] - #define USE_PACKAGES maya - #define TARGET mayasavepview - - #if $[WINDOWS_PLATFORM] - #define dlllib mll - #endif - - #define SOURCES \ - mayaSavePview.cxx mayaSavePview.h -#end lib_target - -#begin lib_target - #define BUILD_TARGET $[not $[LINK_ALL_STATIC]] - #define USE_PACKAGES maya - #define TARGET mayaEggImport - #define LOCAL_LIBS mayabase p3mayaegg - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3framework:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m $[if $[WINDOWS_PLATFORM],p3pystub,] \ - p3pipeline:c - - #define BUILDING_DLL BUILDING_MISC - - #if $[WINDOWS_PLATFORM] - #define dlllib mll - #endif - - #define SOURCES \ - mayaEggImport.cxx - -#end lib_target - -#begin lib_target - #define USE_PACKAGES maya - #define TARGET mayaloader - #define BUILDING_DLL BUILDING_MISC - #define LOCAL_LIBS \ - mayabase p3mayaegg p3ptloader p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3egg2pg:c p3egg:c pandaegg:m \ - p3mathutil:c p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3dtoolconfig p3dtool \ - p3event:c p3gobj:c p3chan:c p3pgraph:c p3parametrics:c p3char:c p3prc:c p3dtoolutil:c \ - p3interrogatedb:c p3dtoolbase:c p3collide:c p3pnmimage:c p3dgraph:c p3tform:c \ - p3pipeline:c p3pstatclient:c p3grutil:c p3gsgbase:c p3net:c p3display:c \ - p3cull:c p3text:c p3nativenet:c p3movies:c p3audio:c \ - $[if $[HAVE_FREETYPE],p3pnmtext:c] - - #define SOURCES \ - config_mayaloader.cxx - -#end lib_target - -#begin test_bin_target - #define USE_PACKAGES maya - #define TARGET normal_test - - #define SOURCES \ - normal_test.cxx - -#end test_bin_target diff --git a/pandatool/src/miscprogs/Sources.pp b/pandatool/src/miscprogs/Sources.pp deleted file mode 100644 index 51bdb5bed6..0000000000 --- a/pandatool/src/miscprogs/Sources.pp +++ /dev/null @@ -1,22 +0,0 @@ -#define LOCAL_LIBS \ - p3progbase - -#define OTHER_LIBS \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#define UNIX_SYS_LIBS m - -#begin bin_target - #define TARGET bin2c - - #define SOURCES \ - binToC.cxx binToC.h - -#end bin_target diff --git a/pandatool/src/objegg/Sources.pp b/pandatool/src/objegg/Sources.pp deleted file mode 100644 index 7e372a8666..0000000000 --- a/pandatool/src/objegg/Sources.pp +++ /dev/null @@ -1,25 +0,0 @@ -#begin ss_lib_target - #define TARGET p3objegg - #define LOCAL_LIBS p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - config_objegg.cxx config_objegg.h \ - objToEggConverter.cxx objToEggConverter.h objToEggConverter.I \ - eggToObjConverter.cxx eggToObjConverter.h - - #define INSTALL_HEADERS \ - objToEggConverter.h objToEggConverter.I \ - eggToObjConverter.h - -#end ss_lib_target diff --git a/pandatool/src/objegg/eggToObjConverter.cxx b/pandatool/src/objegg/eggToObjConverter.cxx index 193782ff00..314785a83d 100644 --- a/pandatool/src/objegg/eggToObjConverter.cxx +++ b/pandatool/src/objegg/eggToObjConverter.cxx @@ -1,462 +1,462 @@ -// Filename: eggToObjConverter.cxx -// Created by: drose (19Dec12) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "eggToObjConverter.h" -#include "config_objegg.h" -#include "config_egg.h" -#include "eggData.h" -#include "string_utils.h" -#include "streamReader.h" -#include "virtualFileSystem.h" -#include "eggPolygon.h" -#include "eggPoint.h" -#include "eggLine.h" -#include "dcast.h" - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -EggToObjConverter:: -EggToObjConverter() { -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -EggToObjConverter:: -EggToObjConverter(const EggToObjConverter ©) : - EggToSomethingConverter(copy) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -EggToObjConverter:: -~EggToObjConverter() { -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::make_copy -// Access: Public, Virtual -// Description: Allocates and returns a new copy of the converter. -//////////////////////////////////////////////////////////////////// -EggToSomethingConverter *EggToObjConverter:: -make_copy() { - return new EggToObjConverter(*this); -} - - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::get_name -// Access: Public, Virtual -// Description: Returns the English name of the file type this -// converter supports. -//////////////////////////////////////////////////////////////////// -string EggToObjConverter:: -get_name() const { - return "obj"; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::get_extension -// Access: Public, Virtual -// Description: Returns the common extension of the file type this -// converter supports. -//////////////////////////////////////////////////////////////////// -string EggToObjConverter:: -get_extension() const { - return "obj"; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::supports_compressed -// Access: Published, Virtual -// Description: Returns true if this file type can transparently save -// compressed files (with a .pz extension), false -// otherwise. -//////////////////////////////////////////////////////////////////// -bool EggToObjConverter:: -supports_compressed() const { - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::write_file -// Access: Public, Virtual -// Description: Handles the conversion of the internal EggData to the -// target file format, written to the specified -// filename. -//////////////////////////////////////////////////////////////////// -bool EggToObjConverter:: -write_file(const Filename &filename) { - clear_error(); - - if (_egg_data->get_coordinate_system() == CS_default) { - _egg_data->set_coordinate_system(CS_zup_right); - } - - if (!process(filename)) { - _error = true; - } - return !had_error(); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::process -// Access: Private -// Description: -//////////////////////////////////////////////////////////////////// -bool EggToObjConverter:: -process(const Filename &filename) { - _egg_data->flatten_transforms(); - collect_vertices(_egg_data); - - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - Filename obj_filename = Filename::text_filename(filename); - vfs->delete_file(obj_filename); - ostream *file = vfs->open_write_file(obj_filename, true, true); - if (file == (ostream *)NULL) { - return false; - } - if (egg_precision != 0) { - file->precision(egg_precision); - } - - _current_group = NULL; - - /* - (*file) << "\n#\n" - << "# obj file generated by the following command:\n" - << "# " << get_exec_command() << "\n" - << "#\n\n"; - */ - - write_vertices(*file, "v", 3, _unique_vert3); - write_vertices(*file, "v", 4, _unique_vert4); - write_vertices(*file, "vt", 2, _unique_uv2); - write_vertices(*file, "vt", 3, _unique_uv3); - write_vertices(*file, "vn", 3, _unique_norm); - - write_faces(*file, _egg_data); - - bool success = (file != (ostream *)NULL); - vfs->close_write_file(file); - - return success; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::collect_vertices -// Access: Private -// Description: Recursively walks the egg structure, looking for -// vertices referenced by polygons or points. Any such -// vertices are added to the vertex tables for writing -// to the obj file. -//////////////////////////////////////////////////////////////////// -void EggToObjConverter:: -collect_vertices(EggNode *egg_node) { - if (egg_node->is_of_type(EggPrimitive::get_class_type())) { - EggPrimitive *egg_prim = DCAST(EggPrimitive, egg_node); - EggPrimitive::iterator pi; - for (pi = egg_prim->begin(); pi != egg_prim->end(); ++pi) { - record_vertex(*pi); - } - - } else if (egg_node->is_of_type(EggGroupNode::get_class_type())) { - EggGroupNode *egg_group = DCAST(EggGroupNode, egg_node); - - EggGroupNode::iterator ci; - for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { - collect_vertices(*ci); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::write_faces -// Access: Private -// Description: Recursively walks the egg structure again, this time -// writing out the face records for any polygons, -// points, or lines encountered. -//////////////////////////////////////////////////////////////////// -void EggToObjConverter:: -write_faces(ostream &out, EggNode *egg_node) { - if (egg_node->is_of_type(EggPrimitive::get_class_type())) { - const char *prim_type = NULL; - if (egg_node->is_of_type(EggPolygon::get_class_type())) { - prim_type = "f"; - } else if (egg_node->is_of_type(EggPoint::get_class_type())) { - prim_type = "p"; - } else if (egg_node->is_of_type(EggLine::get_class_type())) { - prim_type = "l"; - } - - if (prim_type != NULL) { - write_group_reference(out, egg_node); - - EggPrimitive *egg_prim = DCAST(EggPrimitive, egg_node); - - out << prim_type; - EggPrimitive::iterator pi; - for (pi = egg_prim->begin(); pi != egg_prim->end(); ++pi) { - VertexDef &vdef = _vmap[(*pi)]; - int vert_index = -1; - int uv_index = -1; - int norm_index = -1; - - if (vdef._vert3_index != -1) { - vert_index = vdef._vert3_index + 1; - } else if (vdef._vert4_index != -1) { - vert_index = vdef._vert4_index + 1 + (int)_unique_vert3.size(); - } - - if (vdef._uv2_index != -1) { - uv_index = vdef._uv2_index + 1; - } else if (vdef._uv3_index != -1) { - uv_index = vdef._uv3_index + 1 + (int)_unique_uv2.size(); - } - - if (vdef._norm_index != -1) { - norm_index = vdef._norm_index + 1; - } - - if (vert_index == -1) { - continue; - } - - if (norm_index != -1) { - if (uv_index != -1) { - out << " " << vert_index << "/" << uv_index << "/" << norm_index; - } else { - out << " " << vert_index << "//" << norm_index; - } - } else if (uv_index != -1) { - out << " " << vert_index << "/" << uv_index; - } else { - out << " " << vert_index; - } - } - out << "\n"; - } - } else if (egg_node->is_of_type(EggGroupNode::get_class_type())) { - EggGroupNode *egg_group = DCAST(EggGroupNode, egg_node); - - EggGroupNode::iterator ci; - for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { - write_faces(out, *ci); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::write_group_reference -// Access: Private -// Description: Writes the "g" tag to describe this polygon's group, -// if needed. -//////////////////////////////////////////////////////////////////// -void EggToObjConverter:: -write_group_reference(ostream &out, EggNode *egg_node) { - EggGroupNode *egg_group = egg_node->get_parent(); - if (egg_group == _current_group) { - // Same group we wrote last time. - return; - } - - string group_name; - get_group_name(group_name, egg_group); - if (group_name.empty()) { - out << "g default\n"; - } else { - out << "g" << group_name << "\n"; - } - _current_group = egg_group; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::get_group_name -// Access: Private -// Description: Recursively determines the appropriate string to -// write for the "g" tag to describe a particular -// EggGroupNode. -//////////////////////////////////////////////////////////////////// -void EggToObjConverter:: -get_group_name(string &group_name, EggGroupNode *egg_group) { - string name = trim(egg_group->get_name()); - if (!name.empty()) { - group_name += ' '; - - // Remove nonstandard characters. - for (string::const_iterator ni = name.begin(); ni != name.end(); ++ni) { - char c = (*ni); - if (!isalnum(c)) { - c = '_'; - } - group_name += c; - } - } - - // Now recurse. - EggGroupNode *egg_parent = egg_group->get_parent(); - if (egg_parent != NULL) { - get_group_name(group_name, egg_parent); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::record_vertex -// Access: Private -// Description: Adds the indicated EggVertex to the unique vertex -// tables, for writing later by write_vertices(). -//////////////////////////////////////////////////////////////////// -void EggToObjConverter:: -record_vertex(EggVertex *vertex) { - VertexDef &vdef = _vmap[vertex]; - - switch (vertex->get_num_dimensions()) { - case 1: - vdef._vert3_index = record_unique(_unique_vert3, vertex->get_pos1()); - break; - case 2: - vdef._vert3_index = record_unique(_unique_vert3, vertex->get_pos2()); - break; - case 3: - vdef._vert3_index = record_unique(_unique_vert3, vertex->get_pos3()); - break; - case 4: - vdef._vert4_index = record_unique(_unique_vert4, vertex->get_pos4()); - break; - } - - if (vertex->has_uv("")) { - vdef._uv2_index = record_unique(_unique_uv2, vertex->get_uv("")); - } else if (vertex->has_uvw("")) { - vdef._uv3_index = record_unique(_unique_uv3, vertex->get_uvw("")); - } - - if (vertex->has_normal()) { - vdef._norm_index = record_unique(_unique_norm, vertex->get_normal()); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::record_unique -// Access: Private -// Description: Records the indicated vertex value, returning the -// shared index if this value already appears elsewhere -// in the table, or the new unique index if this is the -// first time this value appears. -//////////////////////////////////////////////////////////////////// -int EggToObjConverter:: -record_unique(UniqueVertices &unique, const LVecBase4d &vec) { - // We record a zero-based index. Note that we will actually write - // out a one-based index to the obj file, as required by the - // standard. - int index = unique.size(); - UniqueVertices::iterator ui = unique.insert(UniqueVertices::value_type(vec, index)).first; - return (*ui).second; -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::record_unique -// Access: Private -// Description: Records the indicated vertex value, returning the -// shared index if this value already appears elsewhere -// in the table, or the new unique index if this is the -// first time this value appears. -//////////////////////////////////////////////////////////////////// -int EggToObjConverter:: -record_unique(UniqueVertices &unique, const LVecBase3d &vec) { - return record_unique(unique, LVecBase4d(vec[0], vec[1], vec[2], 0.0)); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::record_unique -// Access: Private -// Description: Records the indicated vertex value, returning the -// shared index if this value already appears elsewhere -// in the table, or the new unique index if this is the -// first time this value appears. -//////////////////////////////////////////////////////////////////// -int EggToObjConverter:: -record_unique(UniqueVertices &unique, const LVecBase2d &vec) { - return record_unique(unique, LVecBase4d(vec[0], vec[1], 0.0, 0.0)); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::record_unique -// Access: Private -// Description: Records the indicated vertex value, returning the -// shared index if this value already appears elsewhere -// in the table, or the new unique index if this is the -// first time this value appears. -//////////////////////////////////////////////////////////////////// -int EggToObjConverter:: -record_unique(UniqueVertices &unique, double pos) { - return record_unique(unique, LVecBase4d(pos, 0.0, 0.0, 0.0)); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::write_vertices -// Access: Private -// Description: Actually writes the vertex values recorded in the -// indicated table to the obj output stream. -//////////////////////////////////////////////////////////////////// -void EggToObjConverter:: -write_vertices(ostream &out, const string &prefix, int num_components, - const UniqueVertices &unique) { - // First, sort the list into numeric order. - int num_vertices = (int)unique.size(); - const LVecBase4d **vertices = (const LVecBase4d **)PANDA_MALLOC_ARRAY(num_vertices * sizeof(LVecBase4d *)); - memset(vertices, 0, num_vertices * sizeof(LVecBase4d *)); - UniqueVertices::const_iterator ui; - for (ui = unique.begin(); ui != unique.end(); ++ui) { - int index = (*ui).second; - const LVecBase4d &vec = (*ui).first; - nassertv(index >= 0 && index < num_vertices); - nassertv(vertices[index] == NULL); - vertices[index] = &vec; - } - - for (int i = 0; i < num_vertices; ++i) { - out << prefix; - const LVecBase4d &vec = *(vertices[i]); - for (int ci = 0; ci < num_components; ++ci) { - out << " " << vec[ci]; - } - out << "\n"; - } - PANDA_FREE_ARRAY(vertices); -} - -//////////////////////////////////////////////////////////////////// -// Function: EggToObjConverter::VertexDef::Constructor -// Access: Private -// Description: -//////////////////////////////////////////////////////////////////// -EggToObjConverter::VertexDef:: -VertexDef() : - _vert3_index(-1), - _vert4_index(-1), - _uv2_index(-1), - _uv3_index(-1), - _norm_index(-1) -{ -} +// Filename: eggToObjConverter.cxx +// Created by: drose (19Dec12) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + +#include "eggToObjConverter.h" +#include "config_objegg.h" +#include "config_egg.h" +#include "eggData.h" +#include "string_utils.h" +#include "streamReader.h" +#include "virtualFileSystem.h" +#include "eggPolygon.h" +#include "eggPoint.h" +#include "eggLine.h" +#include "dcast.h" + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +EggToObjConverter:: +EggToObjConverter() { +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +EggToObjConverter:: +EggToObjConverter(const EggToObjConverter ©) : + EggToSomethingConverter(copy) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::Destructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +EggToObjConverter:: +~EggToObjConverter() { +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::make_copy +// Access: Public, Virtual +// Description: Allocates and returns a new copy of the converter. +//////////////////////////////////////////////////////////////////// +EggToSomethingConverter *EggToObjConverter:: +make_copy() { + return new EggToObjConverter(*this); +} + + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::get_name +// Access: Public, Virtual +// Description: Returns the English name of the file type this +// converter supports. +//////////////////////////////////////////////////////////////////// +string EggToObjConverter:: +get_name() const { + return "obj"; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::get_extension +// Access: Public, Virtual +// Description: Returns the common extension of the file type this +// converter supports. +//////////////////////////////////////////////////////////////////// +string EggToObjConverter:: +get_extension() const { + return "obj"; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::supports_compressed +// Access: Published, Virtual +// Description: Returns true if this file type can transparently save +// compressed files (with a .pz extension), false +// otherwise. +//////////////////////////////////////////////////////////////////// +bool EggToObjConverter:: +supports_compressed() const { + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::write_file +// Access: Public, Virtual +// Description: Handles the conversion of the internal EggData to the +// target file format, written to the specified +// filename. +//////////////////////////////////////////////////////////////////// +bool EggToObjConverter:: +write_file(const Filename &filename) { + clear_error(); + + if (_egg_data->get_coordinate_system() == CS_default) { + _egg_data->set_coordinate_system(CS_zup_right); + } + + if (!process(filename)) { + _error = true; + } + return !had_error(); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::process +// Access: Private +// Description: +//////////////////////////////////////////////////////////////////// +bool EggToObjConverter:: +process(const Filename &filename) { + _egg_data->flatten_transforms(); + collect_vertices(_egg_data); + + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + Filename obj_filename = Filename::text_filename(filename); + vfs->delete_file(obj_filename); + ostream *file = vfs->open_write_file(obj_filename, true, true); + if (file == (ostream *)NULL) { + return false; + } + if (egg_precision != 0) { + file->precision(egg_precision); + } + + _current_group = NULL; + + /* + (*file) << "\n#\n" + << "# obj file generated by the following command:\n" + << "# " << get_exec_command() << "\n" + << "#\n\n"; + */ + + write_vertices(*file, "v", 3, _unique_vert3); + write_vertices(*file, "v", 4, _unique_vert4); + write_vertices(*file, "vt", 2, _unique_uv2); + write_vertices(*file, "vt", 3, _unique_uv3); + write_vertices(*file, "vn", 3, _unique_norm); + + write_faces(*file, _egg_data); + + bool success = (file != (ostream *)NULL); + vfs->close_write_file(file); + + return success; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::collect_vertices +// Access: Private +// Description: Recursively walks the egg structure, looking for +// vertices referenced by polygons or points. Any such +// vertices are added to the vertex tables for writing +// to the obj file. +//////////////////////////////////////////////////////////////////// +void EggToObjConverter:: +collect_vertices(EggNode *egg_node) { + if (egg_node->is_of_type(EggPrimitive::get_class_type())) { + EggPrimitive *egg_prim = DCAST(EggPrimitive, egg_node); + EggPrimitive::iterator pi; + for (pi = egg_prim->begin(); pi != egg_prim->end(); ++pi) { + record_vertex(*pi); + } + + } else if (egg_node->is_of_type(EggGroupNode::get_class_type())) { + EggGroupNode *egg_group = DCAST(EggGroupNode, egg_node); + + EggGroupNode::iterator ci; + for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { + collect_vertices(*ci); + } + } +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::write_faces +// Access: Private +// Description: Recursively walks the egg structure again, this time +// writing out the face records for any polygons, +// points, or lines encountered. +//////////////////////////////////////////////////////////////////// +void EggToObjConverter:: +write_faces(ostream &out, EggNode *egg_node) { + if (egg_node->is_of_type(EggPrimitive::get_class_type())) { + const char *prim_type = NULL; + if (egg_node->is_of_type(EggPolygon::get_class_type())) { + prim_type = "f"; + } else if (egg_node->is_of_type(EggPoint::get_class_type())) { + prim_type = "p"; + } else if (egg_node->is_of_type(EggLine::get_class_type())) { + prim_type = "l"; + } + + if (prim_type != NULL) { + write_group_reference(out, egg_node); + + EggPrimitive *egg_prim = DCAST(EggPrimitive, egg_node); + + out << prim_type; + EggPrimitive::iterator pi; + for (pi = egg_prim->begin(); pi != egg_prim->end(); ++pi) { + VertexDef &vdef = _vmap[(*pi)]; + int vert_index = -1; + int uv_index = -1; + int norm_index = -1; + + if (vdef._vert3_index != -1) { + vert_index = vdef._vert3_index + 1; + } else if (vdef._vert4_index != -1) { + vert_index = vdef._vert4_index + 1 + (int)_unique_vert3.size(); + } + + if (vdef._uv2_index != -1) { + uv_index = vdef._uv2_index + 1; + } else if (vdef._uv3_index != -1) { + uv_index = vdef._uv3_index + 1 + (int)_unique_uv2.size(); + } + + if (vdef._norm_index != -1) { + norm_index = vdef._norm_index + 1; + } + + if (vert_index == -1) { + continue; + } + + if (norm_index != -1) { + if (uv_index != -1) { + out << " " << vert_index << "/" << uv_index << "/" << norm_index; + } else { + out << " " << vert_index << "//" << norm_index; + } + } else if (uv_index != -1) { + out << " " << vert_index << "/" << uv_index; + } else { + out << " " << vert_index; + } + } + out << "\n"; + } + } else if (egg_node->is_of_type(EggGroupNode::get_class_type())) { + EggGroupNode *egg_group = DCAST(EggGroupNode, egg_node); + + EggGroupNode::iterator ci; + for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { + write_faces(out, *ci); + } + } +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::write_group_reference +// Access: Private +// Description: Writes the "g" tag to describe this polygon's group, +// if needed. +//////////////////////////////////////////////////////////////////// +void EggToObjConverter:: +write_group_reference(ostream &out, EggNode *egg_node) { + EggGroupNode *egg_group = egg_node->get_parent(); + if (egg_group == _current_group) { + // Same group we wrote last time. + return; + } + + string group_name; + get_group_name(group_name, egg_group); + if (group_name.empty()) { + out << "g default\n"; + } else { + out << "g" << group_name << "\n"; + } + _current_group = egg_group; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::get_group_name +// Access: Private +// Description: Recursively determines the appropriate string to +// write for the "g" tag to describe a particular +// EggGroupNode. +//////////////////////////////////////////////////////////////////// +void EggToObjConverter:: +get_group_name(string &group_name, EggGroupNode *egg_group) { + string name = trim(egg_group->get_name()); + if (!name.empty()) { + group_name += ' '; + + // Remove nonstandard characters. + for (string::const_iterator ni = name.begin(); ni != name.end(); ++ni) { + char c = (*ni); + if (!isalnum(c)) { + c = '_'; + } + group_name += c; + } + } + + // Now recurse. + EggGroupNode *egg_parent = egg_group->get_parent(); + if (egg_parent != NULL) { + get_group_name(group_name, egg_parent); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::record_vertex +// Access: Private +// Description: Adds the indicated EggVertex to the unique vertex +// tables, for writing later by write_vertices(). +//////////////////////////////////////////////////////////////////// +void EggToObjConverter:: +record_vertex(EggVertex *vertex) { + VertexDef &vdef = _vmap[vertex]; + + switch (vertex->get_num_dimensions()) { + case 1: + vdef._vert3_index = record_unique(_unique_vert3, vertex->get_pos1()); + break; + case 2: + vdef._vert3_index = record_unique(_unique_vert3, vertex->get_pos2()); + break; + case 3: + vdef._vert3_index = record_unique(_unique_vert3, vertex->get_pos3()); + break; + case 4: + vdef._vert4_index = record_unique(_unique_vert4, vertex->get_pos4()); + break; + } + + if (vertex->has_uv("")) { + vdef._uv2_index = record_unique(_unique_uv2, vertex->get_uv("")); + } else if (vertex->has_uvw("")) { + vdef._uv3_index = record_unique(_unique_uv3, vertex->get_uvw("")); + } + + if (vertex->has_normal()) { + vdef._norm_index = record_unique(_unique_norm, vertex->get_normal()); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::record_unique +// Access: Private +// Description: Records the indicated vertex value, returning the +// shared index if this value already appears elsewhere +// in the table, or the new unique index if this is the +// first time this value appears. +//////////////////////////////////////////////////////////////////// +int EggToObjConverter:: +record_unique(UniqueVertices &unique, const LVecBase4d &vec) { + // We record a zero-based index. Note that we will actually write + // out a one-based index to the obj file, as required by the + // standard. + int index = unique.size(); + UniqueVertices::iterator ui = unique.insert(UniqueVertices::value_type(vec, index)).first; + return (*ui).second; +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::record_unique +// Access: Private +// Description: Records the indicated vertex value, returning the +// shared index if this value already appears elsewhere +// in the table, or the new unique index if this is the +// first time this value appears. +//////////////////////////////////////////////////////////////////// +int EggToObjConverter:: +record_unique(UniqueVertices &unique, const LVecBase3d &vec) { + return record_unique(unique, LVecBase4d(vec[0], vec[1], vec[2], 0.0)); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::record_unique +// Access: Private +// Description: Records the indicated vertex value, returning the +// shared index if this value already appears elsewhere +// in the table, or the new unique index if this is the +// first time this value appears. +//////////////////////////////////////////////////////////////////// +int EggToObjConverter:: +record_unique(UniqueVertices &unique, const LVecBase2d &vec) { + return record_unique(unique, LVecBase4d(vec[0], vec[1], 0.0, 0.0)); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::record_unique +// Access: Private +// Description: Records the indicated vertex value, returning the +// shared index if this value already appears elsewhere +// in the table, or the new unique index if this is the +// first time this value appears. +//////////////////////////////////////////////////////////////////// +int EggToObjConverter:: +record_unique(UniqueVertices &unique, double pos) { + return record_unique(unique, LVecBase4d(pos, 0.0, 0.0, 0.0)); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::write_vertices +// Access: Private +// Description: Actually writes the vertex values recorded in the +// indicated table to the obj output stream. +//////////////////////////////////////////////////////////////////// +void EggToObjConverter:: +write_vertices(ostream &out, const string &prefix, int num_components, + const UniqueVertices &unique) { + // First, sort the list into numeric order. + int num_vertices = (int)unique.size(); + const LVecBase4d **vertices = (const LVecBase4d **)PANDA_MALLOC_ARRAY(num_vertices * sizeof(LVecBase4d *)); + memset(vertices, 0, num_vertices * sizeof(LVecBase4d *)); + UniqueVertices::const_iterator ui; + for (ui = unique.begin(); ui != unique.end(); ++ui) { + int index = (*ui).second; + const LVecBase4d &vec = (*ui).first; + nassertv(index >= 0 && index < num_vertices); + nassertv(vertices[index] == NULL); + vertices[index] = &vec; + } + + for (int i = 0; i < num_vertices; ++i) { + out << prefix; + const LVecBase4d &vec = *(vertices[i]); + for (int ci = 0; ci < num_components; ++ci) { + out << " " << vec[ci]; + } + out << "\n"; + } + PANDA_FREE_ARRAY(vertices); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggToObjConverter::VertexDef::Constructor +// Access: Private +// Description: +//////////////////////////////////////////////////////////////////// +EggToObjConverter::VertexDef:: +VertexDef() : + _vert3_index(-1), + _vert4_index(-1), + _uv2_index(-1), + _uv3_index(-1), + _norm_index(-1) +{ +} diff --git a/pandatool/src/objegg/objToEggConverter.cxx b/pandatool/src/objegg/objToEggConverter.cxx index 0db9464e5a..66949fe10f 100644 --- a/pandatool/src/objegg/objToEggConverter.cxx +++ b/pandatool/src/objegg/objToEggConverter.cxx @@ -1,1188 +1,1188 @@ -// Filename: objToEggConverter.cxx -// Created by: drose (07Dec10) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "objToEggConverter.h" -#include "config_objegg.h" -#include "eggData.h" -#include "string_utils.h" -#include "streamReader.h" -#include "virtualFileSystem.h" -#include "eggPolygon.h" -#include "nodePath.h" -#include "geomTriangles.h" -#include "geomPoints.h" -#include "colorAttrib.h" -#include "shadeModelAttrib.h" -#include "dcast.h" -#include "triangulator3.h" -#include "config_egg2pg.h" - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -ObjToEggConverter:: -ObjToEggConverter() { -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -ObjToEggConverter:: -ObjToEggConverter(const ObjToEggConverter ©) : - SomethingToEggConverter(copy) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -ObjToEggConverter:: -~ObjToEggConverter() { -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::make_copy -// Access: Public, Virtual -// Description: Allocates and returns a new copy of the converter. -//////////////////////////////////////////////////////////////////// -SomethingToEggConverter *ObjToEggConverter:: -make_copy() { - return new ObjToEggConverter(*this); -} - - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::get_name -// Access: Public, Virtual -// Description: Returns the English name of the file type this -// converter supports. -//////////////////////////////////////////////////////////////////// -string ObjToEggConverter:: -get_name() const { - return "obj"; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::get_extension -// Access: Public, Virtual -// Description: Returns the common extension of the file type this -// converter supports. -//////////////////////////////////////////////////////////////////// -string ObjToEggConverter:: -get_extension() const { - return "obj"; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::supports_compressed -// Access: Published, Virtual -// Description: Returns true if this file type can transparently load -// compressed files (with a .pz extension), false -// otherwise. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -supports_compressed() const { - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::supports_convert_to_node -// Access: Published, Virtual -// Description: Returns true if this converter can directly convert -// the model type to internal Panda memory structures, -// given the indicated options, or false otherwise. If -// this returns true, then convert_to_node() may be -// called to perform the conversion, which may be faster -// than calling convert_file() if the ultimate goal is a -// PandaNode anyway. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -supports_convert_to_node(const LoaderOptions &options) const { - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::convert_file -// Access: Public, Virtual -// Description: Handles the reading of the input file and converting -// it to egg. Returns true if successful, false -// otherwise. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -convert_file(const Filename &filename) { - clear_error(); - - if (_egg_data->get_coordinate_system() == CS_default) { - _egg_data->set_coordinate_system(CS_zup_right); - } - - if (!process(filename)) { - _error = true; - } - return !had_error(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::convert_to_node -// Access: Public, Virtual -// Description: Reads the input file and directly produces a -// ready-to-render model file as a PandaNode. Returns -// NULL on failure, or if it is not supported. (This -// functionality is not supported by all converter -// types; see supports_convert_to_node()). -//////////////////////////////////////////////////////////////////// -PT(PandaNode) ObjToEggConverter:: -convert_to_node(const LoaderOptions &options, const Filename &filename) { - clear_error(); - - _root_node = new PandaNode(""); - _current_vertex_data = new VertexData(_root_node, "root"); - - if (!process_node(filename)) { - _error = true; - } - - _current_vertex_data->close_geom(this); - delete _current_vertex_data; - - if (had_error()) { - return NULL; - } - - return _root_node; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process -// Access: Protected -// Description: Reads the file and converts it to egg structures. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process(const Filename &filename) { - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *strm = vfs->open_read_file(filename, true); - if (strm == NULL) { - objegg_cat.error() - << "Couldn't read " << filename << "\n"; - return false; - } - - _v_table.clear(); - _vn_table.clear(); - _rgb_table.clear(); - _vt_table.clear(); - _xvt_table.clear(); - _ref_plane_res.set(1.0, 1.0); - _v4_given = false; - _vt3_given = false; - _f_given = false; - - _vpool = new EggVertexPool("vpool"); - _egg_data->add_child(_vpool); - _root_group = new EggGroup("root"); - _egg_data->add_child(_root_group); - _current_group = _root_group; - - StreamReader sr(strm, true); - string line = sr.readline(); - _line_number = 1; - while (!line.empty()) { - line = trim(line); - if (line.empty()) { - line = sr.readline(); - continue; - } - - while (line[line.length() - 1] == '\\') { - // If it ends on a backslash, it's a continuation character. - string line2 = sr.readline(); - ++_line_number; - if (line2.empty()) { - break; - } - line = line.substr(0, line.length() - 1) + trim(line2); - } - - if (line.substr(0, 15) == "#_ref_plane_res") { - process_ref_plane_res(line); - line = sr.readline(); - continue; - } - - if (line[0] == '#') { - line = sr.readline(); - continue; - } - - if (!process_line(line)) { - return false; - } - line = sr.readline(); - ++_line_number; - } - - if (!_f_given) { - generate_egg_points(); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_line -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_line(const string &line) { - vector_string words; - tokenize(line, words, " \t", true); - nassertr(!words.empty(), false); - - string tag = words[0]; - if (tag == "v") { - return process_v(words); - } else if (tag == "vt") { - return process_vt(words); - } else if (tag == "xvt") { - return process_xvt(words); - } else if (tag == "xvc") { - return process_xvc(words); - } else if (tag == "vn") { - return process_vn(words); - } else if (tag == "f") { - return process_f(words); - } else if (tag == "g") { - return process_g(words); - } else { - bool inserted = _ignored_tags.insert(tag).second; - if (inserted) { - objegg_cat.info() - << "Ignoring tag " << tag << "\n"; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_line -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_ref_plane_res(const string &line) { - // the #_ref_plane_res line is a DRZ extension that defines the - // pixel resolution of the projector device. It's needed to - // properly scale the xvt lines. - - vector_string words; - tokenize(line, words, " \t", true); - nassertr(!words.empty(), false); - - if (words.size() != 3) { - objegg_cat.error() - << "Wrong number of tokens at line " << _line_number << "\n"; - return false; - } - - bool okflag = true; - LPoint3d pos; - okflag &= string_to_double(words[1], _ref_plane_res[0]); - okflag &= string_to_double(words[2], _ref_plane_res[1]); - - if (!okflag) { - objegg_cat.error() - << "Invalid number at line " << _line_number << ":\n"; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_v -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_v(vector_string &words) { - if (words.size() != 4 && words.size() != 5 && - words.size() != 7 && words.size() != 8) { - objegg_cat.error() - << "Wrong number of tokens at line " << _line_number << "\n"; - return false; - } - - bool okflag = true; - LPoint4d pos; - okflag &= string_to_double(words[1], pos[0]); - okflag &= string_to_double(words[2], pos[1]); - okflag &= string_to_double(words[3], pos[2]); - if (words.size() == 5 || words.size() == 8) { - okflag &= string_to_double(words[4], pos[3]); - _v4_given = true; - } else { - pos[3] = 1.0; - } - - if (!okflag) { - objegg_cat.error() - << "Invalid number at line " << _line_number << "\n"; - return false; - } - - _v_table.push_back(pos); - - // Meshlab format might include an RGB color following the vertex - // position. - if (words.size() == 7 && words.size() == 8) { - size_t si = words.size(); - LVecBase3d rgb; - okflag &= string_to_double(words[si - 3], rgb[0]); - okflag &= string_to_double(words[si - 2], rgb[1]); - okflag &= string_to_double(words[si - 1], rgb[2]); - - if (!okflag) { - objegg_cat.error() - << "Invalid number at line " << _line_number << "\n"; - return false; - } - while (_rgb_table.size() + 1 < _v_table.size()) { - _rgb_table.push_back(LVecBase3d(1.0, 1.0, 1.0)); - } - _rgb_table.push_back(rgb); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_vt -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_vt(vector_string &words) { - if (words.size() != 3 && words.size() != 4) { - objegg_cat.error() - << "Wrong number of tokens at line " << _line_number << "\n"; - return false; - } - - bool okflag = true; - LTexCoord3d uvw; - okflag &= string_to_double(words[1], uvw[0]); - okflag &= string_to_double(words[2], uvw[1]); - if (words.size() == 4) { - okflag &= string_to_double(words[3], uvw[2]); - _vt3_given = true; - } else { - uvw[2] = 0.0; - } - - if (!okflag) { - objegg_cat.error() - << "Invalid number at line " << _line_number << "\n"; - return false; - } - - _vt_table.push_back(uvw); - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_xvt -// Access: Protected -// Description: "xvt" is an extended column invented by DRZ. It -// includes texture coordinates in pixel space of the -// projector device, as well as for each camera. We map -// it to the nominal texture coordinates here. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_xvt(vector_string &words) { - if (words.size() < 3) { - objegg_cat.error() - << "Wrong number of tokens at line " << _line_number << "\n"; - return false; - } - - bool okflag = true; - LTexCoordd uv; - okflag &= string_to_double(words[1], uv[0]); - okflag &= string_to_double(words[2], uv[1]); - - if (!okflag) { - objegg_cat.error() - << "Invalid number at line " << _line_number << "\n"; - return false; - } - - uv[0] /= _ref_plane_res[0]; - uv[1] = 1.0 - uv[1] / _ref_plane_res[1]; - - _xvt_table.push_back(uv); - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_xvc -// Access: Protected -// Description: "xvc" is another extended column invented by DRZ. We -// quietly ignore it. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_xvc(vector_string &words) { - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_vn -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_vn(vector_string &words) { - if (words.size() != 4) { - objegg_cat.error() - << "Wrong number of tokens at line " << _line_number << "\n"; - return false; - } - - bool okflag = true; - LVector3d normal; - okflag &= string_to_double(words[1], normal[0]); - okflag &= string_to_double(words[2], normal[1]); - okflag &= string_to_double(words[3], normal[2]); - - if (!okflag) { - objegg_cat.error() - << "Invalid number at line " << _line_number << "\n"; - return false; - } - normal.normalize(); - - _vn_table.push_back(normal); - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_f -// Access: Protected -// Description: Defines a face in the obj file. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_f(vector_string &words) { - _f_given = true; - - PT(EggPolygon) poly = new EggPolygon; - for (size_t i = 1; i < words.size(); ++i) { - EggVertex *vertex = get_face_vertex(words[i]); - if (vertex == NULL) { - return false; - } - poly->add_vertex(vertex); - } - _current_group->add_child(poly); - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_g -// Access: Protected -// Description: Defines a group in the obj file. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_g(vector_string &words) { - EggGroup *group = _root_group; - - // We assume the group names define a hierarchy of more-specific to - // less-specific group names, so that the first group name is the - // bottommost node, and the last group name is the topmost node. - - // Thus, iterate from the back to the front. - size_t i = words.size(); - while (i > 1) { - --i; - EggNode *child = group->find_child(words[i]); - if (child == NULL || !child->is_of_type(EggGroup::get_class_type())) { - child = new EggGroup(words[i]); - group->add_child(child); - } - group = DCAST(EggGroup, child); - } - - _current_group = group; - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::get_face_vertex -// Access: Protected -// Description: Returns or creates a vertex in the vpool according to -// the indicated face reference. -//////////////////////////////////////////////////////////////////// -EggVertex *ObjToEggConverter:: -get_face_vertex(const string &reference) { - VertexEntry entry(this, reference); - - // Synthesize a vertex. - EggVertex synth; - - if (entry._vi != 0) { - if (_v4_given) { - synth.set_pos(LCAST(double, _v_table[entry._vi - 1])); - } else { - LPoint4d pos = _v_table[entry._vi - 1]; - synth.set_pos(LPoint3d(pos[0], pos[1], pos[2])); - } - - if (entry._vi - 1 < (int)_rgb_table.size()) { - // We have a per-vertex color too. - LRGBColord rgb = _rgb_table[entry._vi - 1]; - LColor rgba(rgb[0], rgb[1], rgb[2], 1.0); - synth.set_color(rgba); - } - } - - if (entry._vti != 0) { - // We have a texture coordinate; apply it. - if (_vt3_given) { - synth.set_uvw("", _vt_table[entry._vti - 1]); - } else { - LTexCoord3d uvw = _vt_table[entry._vti - 1]; - synth.set_uv("", LTexCoordd(uvw[0], uvw[1])); - } - } else if (entry._vi - 1 < (int)_xvt_table.size()) { - // We have an xvt texture coordinate. - synth.set_uv("", _xvt_table[entry._vi - 1]); - } - - if (entry._vni != 0) { - // We have a normal; apply it. - synth.set_normal(_vn_table[entry._vni - 1]); - } - - return _vpool->create_unique_vertex(synth); -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::generate_egg_points -// Access: Protected -// Description: If an obj file defines no faces, create a bunch of -// EggVertex objects to illustrate the vertex positions -// at least. -//////////////////////////////////////////////////////////////////// -void ObjToEggConverter:: -generate_egg_points() { - for (size_t vi = 0; vi < _v_table.size(); ++vi) { - const LVecBase4d &p = _v_table[vi]; - _vpool->make_new_vertex(LVecBase3d(p[0], p[1], p[2])); - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_node -// Access: Protected -// Description: Reads the file and converts it to PandaNode structures. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_node(const Filename &filename) { - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - istream *strm = vfs->open_read_file(filename, true); - if (strm == NULL) { - objegg_cat.error() - << "Couldn't read " << filename << "\n"; - return false; - } - - _v_table.clear(); - _vn_table.clear(); - _rgb_table.clear(); - _vt_table.clear(); - _xvt_table.clear(); - _ref_plane_res.set(1.0, 1.0); - _v4_given = false; - _vt3_given = false; - _f_given = false; - - StreamReader sr(strm, true); - string line = sr.readline(); - _line_number = 1; - while (!line.empty()) { - line = trim(line); - if (line.empty()) { - line = sr.readline(); - continue; - } - - if (line.substr(0, 15) == "#_ref_plane_res") { - process_ref_plane_res(line); - line = sr.readline(); - continue; - } - - if (line[0] == '#') { - line = sr.readline(); - continue; - } - - if (!process_line_node(line)) { - return false; - } - line = sr.readline(); - ++_line_number; - } - - if (!_f_given) { - generate_points(); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_line_node -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_line_node(const string &line) { - vector_string words; - tokenize(line, words, " \t", true); - nassertr(!words.empty(), false); - - string tag = words[0]; - if (tag == "v") { - return process_v(words); - } else if (tag == "vt") { - return process_vt(words); - } else if (tag == "xvt") { - return process_xvt(words); - } else if (tag == "xvc") { - return process_xvc(words); - } else if (tag == "vn") { - return process_vn(words); - } else if (tag == "f") { - return process_f_node(words); - } else if (tag == "g") { - return process_g_node(words); - } else { - bool inserted = _ignored_tags.insert(tag).second; - if (inserted) { - objegg_cat.info() - << "Ignoring tag " << tag << "\n"; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_f_node -// Access: Protected -// Description: Defines a face in the obj file. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_f_node(vector_string &words) { - _f_given = true; - - bool all_vn = true; - int non_vn_index = -1; - - pvector verts; - verts.reserve(words.size() - 1); - for (size_t i = 1; i < words.size(); ++i) { - VertexEntry entry(this, words[i]); - verts.push_back(entry); - if (entry._vni == 0) { - all_vn = false; - non_vn_index = i; - } - } - - if (verts.size() < 3) { - // Not enough vertices. - objegg_cat.error() - << "Degenerate face at " << _line_number << "\n"; - return false; - } - - int synth_vni = 0; - if (!all_vn) { - // Synthesize a normal if we need it. - LNormald normal = LNormald::zero(); - for (size_t i = 0; i < verts.size(); ++i) { - int vi0 = verts[i]._vi; - int vi1 = verts[(i + 1) % verts.size()]._vi; - if (vi0 == 0 || vi1 == 0) { - continue; - } - const LVecBase4d &p0 = _v_table[vi0 - 1]; - const LVecBase4d &p1 = _v_table[vi1 - 1]; - - normal[0] += p0[1] * p1[2] - p0[2] * p1[1]; - normal[1] += p0[2] * p1[0] - p0[0] * p1[2]; - normal[2] += p0[0] * p1[1] - p0[1] * p1[0]; - } - normal.normalize(); - synth_vni = add_synth_normal(normal); - } - - Triangulator3 tri; - int num_tris = 1; - - if (verts.size() != 3) { - // We have to triangulate a higher-order polygon. - for (size_t i = 0; i < verts.size(); ++i) { - const LVecBase4d &p = _v_table[verts[i]._vi - 1]; - tri.add_vertex(p[0], p[1], p[2]); - tri.add_polygon_vertex(i); - } - - tri.triangulate(); - num_tris = tri.get_num_triangles(); - } - - if (_current_vertex_data->_prim->get_num_vertices() + 3 * num_tris > egg_max_indices || - _current_vertex_data->_entries.size() + verts.size() > egg_max_vertices) { - // We'll exceed our specified limit with these triangles; start a new Geom. - _current_vertex_data->close_geom(this); - } - - if (verts.size() == 3) { - // It's already a triangle; add it directly. - _current_vertex_data->add_triangle(this, verts[0], verts[1], verts[2], synth_vni); - - } else { - // Get the triangulated results. - for (int ti = 0; ti < num_tris; ++ti) { - int i0 = tri.get_triangle_v0(ti); - int i1 = tri.get_triangle_v1(ti); - int i2 = tri.get_triangle_v2(ti); - _current_vertex_data->add_triangle(this, verts[i0], verts[i1], verts[i2], synth_vni); - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::process_g_node -// Access: Protected -// Description: Defines a group in the obj file. -//////////////////////////////////////////////////////////////////// -bool ObjToEggConverter:: -process_g_node(vector_string &words) { - _current_vertex_data->close_geom(this); - delete _current_vertex_data; - _current_vertex_data = NULL; - - NodePath np(_root_node); - - // We assume the group names define a hierarchy of more-specific to - // less-specific group names, so that the first group name is the - // bottommost node, and the last group name is the topmost node. - - // Thus, iterate from the back to the front. - size_t i = words.size(); - string name; - while (i > 2) { - --i; - name = words[i]; - NodePath child = np.find(name); - if (!child) { - child = np.attach_new_node(name); - } - np = child; - } - - if (i > 1) { - --i; - name = words[i]; - } - - _current_vertex_data = new VertexData(np.node(), name); - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::generate_points -// Access: Protected -// Description: If an obj file defines no faces, create a bunch of -// GeomPoints to illustrate the vertex positions at -// least. -//////////////////////////////////////////////////////////////////// -void ObjToEggConverter:: -generate_points() { - CPT(GeomVertexFormat) format = GeomVertexFormat::get_v3(); - PT(GeomVertexData) vdata = new GeomVertexData("points", format, GeomEnums::UH_static); - vdata->set_num_rows(_v_table.size()); - GeomVertexWriter vertex_writer(vdata, InternalName::get_vertex()); - - for (size_t vi = 0; vi < _v_table.size(); ++vi) { - const LVecBase4d &p = _v_table[vi]; - vertex_writer.add_data3d(p[0], p[1], p[2]); - } - - PT(GeomPrimitive) prim = new GeomPoints(GeomEnums::UH_static); - prim->add_next_vertices(_v_table.size()); - prim->close_primitive(); - - PT(Geom) geom = new Geom(vdata); - geom->add_primitive(prim); - - PT(GeomNode) geom_node = new GeomNode("points"); - geom_node->add_geom(geom); - _root_node->add_child(geom_node); -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::add_synth_normal -// Access: Private -// Description: Adds a new normal to the synth_vn table, or returns -// an existing normal. In either case returns the -// 1-based index number to the normal. -//////////////////////////////////////////////////////////////////// -int ObjToEggConverter:: -add_synth_normal(const LVecBase3d &normal) { - pair result = _unique_synth_vn_table.insert(UniqueVec3Table::value_type(normal, _unique_synth_vn_table.size())); - UniqueVec3Table::iterator ni = result.first; - int index = (*ni).second; - - if (result.second) { - // If the normal was added to the table, it's a unique normal, and - // now we have to add it to the table too. - _synth_vn_table.push_back(normal); - } - - return index + 1; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::VertexEntry::Constructor -// Access: Public -// Description: Creates a VertexEntry from the n/n/n string format in -// the obj file face reference. -//////////////////////////////////////////////////////////////////// -ObjToEggConverter::VertexEntry:: -VertexEntry(const ObjToEggConverter *converter, const string &obj_vertex) { - _vi = 0; - _vti = 0; - _vni = 0; - _synth_vni = 0; - - vector_string words; - tokenize(obj_vertex, words, "/", false); - nassertv(!words.empty()); - - for (size_t i = 0; i < words.size(); ++i) { - int index; - if (trim(words[i]).empty()) { - index = 0; - } else { - if (!string_to_int(words[i], index)) { - index = 0; - } - } - - switch (i) { - case 0: - _vi = index; - if (_vi < 0) { - _vi = (int)converter->_v_table.size() + _vi; - } - if (_vi < 0 || _vi - 1 >= (int)converter->_v_table.size()) { - _vi = 0; - } - break; - - case 1: - _vti = index; - if (_vti < 0) { - _vti = (int)converter->_vt_table.size() + _vti; - } - if (_vti < 0 || _vti - 1 >= (int)converter->_vt_table.size()) { - _vti = 0; - } - break; - - case 2: - _vni = index; - if (_vni < 0) { - _vni = (int)converter->_vn_table.size() + _vni; - } - if (_vni < 0 || _vni - 1 >= (int)converter->_vn_table.size()) { - _vni = 0; - } - break; - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::VertexData::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -ObjToEggConverter::VertexData:: -VertexData(PandaNode *parent, const string &name) : - _parent(parent), _name(name) -{ - _geom_node = NULL; - - _v4_given = false; - _vt3_given = false; - _vt_given = false; - _rgb_given = false; - _vn_given = false; - - _prim = new GeomTriangles(GeomEnums::UH_static); -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::VertexData::add_vertex -// Access: Public -// Description: Adds a new entry to the vertex data for the indicated -// VertexEntry, or returns an equivalent vertex already -// present. -//////////////////////////////////////////////////////////////////// -int ObjToEggConverter::VertexData:: -add_vertex(const ObjToEggConverter *converter, const VertexEntry &entry) { - pair result; - UniqueVertexEntries::iterator ni; - int index; - - if (entry._vni != 0 || entry._synth_vni != 0) { - // If we are storing a vertex with a normal, see if we - // have already stored a vertex without a normal first. - VertexEntry no_normal(entry); - no_normal._vni = 0; - no_normal._synth_vni = 0; - ni = _unique_entries.find(no_normal); - if (ni != _unique_entries.end()) { - // We did have such a vertex! In this case, repurpose this - // vertex, resetting it to contain this normal. - index = (*ni).second; - _unique_entries.erase(ni); - result = _unique_entries.insert(UniqueVertexEntries::value_type(entry, index)); - nassertr(result.second, index); - nassertr(_entries[index] == no_normal, index); - _entries[index]._vni = entry._vni; - _entries[index]._synth_vni = entry._synth_vni; - return index; - } - } else if (entry._vni == 0 && entry._synth_vni == 0) { - // If we are storing a vertex *without* any normal, see if we have - // already stored a vertex with a normal first. - ni = _unique_entries.lower_bound(entry); - if (ni != _unique_entries.end() && (*ni).first.matches_except_normal(entry)) { - // We had such a vertex, so use it. - index = (*ni).second; - return index; - } - } - - // We didn't already have a vertex we could repurpose, so try to add - // exactly the desired vertex. - result = _unique_entries.insert(UniqueVertexEntries::value_type(entry, _entries.size())); - ni = result.first; - index = (*ni).second; - - if (result.second) { - // If the vertex was added to the table, it's a unique vertex, and - // now we have to add it to the vertex data too. - _entries.push_back(entry); - - if (converter->_v4_given) { - _v4_given = true; - } - if (converter->_vt3_given) { - _vt3_given = true; - } - if (entry._vti != 0) { - _vt_given = true; - } else if (entry._vi - 1 < (int)converter->_xvt_table.size()) { - // We have an xvt texture coordinate. - _vt_given = true; - } - if (entry._vi - 1 < (int)converter->_rgb_table.size()) { - // We have a per-vertex color too. - _rgb_given = true; - } - if (entry._vni != 0) { - _vn_given = true; - } - } - - return index; -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::VertexData::add_triangle -// Access: Public -// Description: Adds a triangle to the primitive, as a triple of -// three VertexEntry objects, which are each added to -// the vertex pool. If synth_vni is not 0, it is -// assigned to the last vertex. -//////////////////////////////////////////////////////////////////// -void ObjToEggConverter::VertexData:: -add_triangle(const ObjToEggConverter *converter, const VertexEntry &v0, - const VertexEntry &v1, const VertexEntry &v2, - int synth_vni) { - int v0i, v1i, v2i; - - v0i = add_vertex(converter, v0); - v1i = add_vertex(converter, v1); - - if (synth_vni != 0) { - VertexEntry v2n(v2); - v2n._synth_vni = synth_vni; - v2i = add_vertex(converter, v2n); - } else { - v2i = add_vertex(converter, v2); - } - - _prim->add_vertices(v0i, v1i, v2i); - _prim->close_primitive(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ObjToEggConverter::VertexData::close_geom -// Access: Public -// Description: Finishes the current geom and stores it as a child -// in the root. Prepares for new geoms. -//////////////////////////////////////////////////////////////////// -void ObjToEggConverter::VertexData:: -close_geom(const ObjToEggConverter *converter) { - if (_prim->get_num_vertices() != 0) { - // Create a new format that includes only the columns we actually - // used. - PT(GeomVertexArrayFormat) aformat = new GeomVertexArrayFormat; - if (_v4_given) { - aformat->add_column(InternalName::get_vertex(), 4, - GeomEnums::NT_stdfloat, GeomEnums::C_point); - } else { - aformat->add_column(InternalName::get_vertex(), 3, - GeomEnums::NT_stdfloat, GeomEnums::C_point); - } - - // We always add normals--if no normals appeared in the file, we - // synthesize them. - aformat->add_column(InternalName::get_normal(), 3, - GeomEnums::NT_stdfloat, GeomEnums::C_vector); - - if (_vt_given) { - if (_vt3_given) { - aformat->add_column(InternalName::get_texcoord(), 3, - GeomEnums::NT_stdfloat, GeomEnums::C_texcoord); - } else { - aformat->add_column(InternalName::get_texcoord(), 2, - GeomEnums::NT_stdfloat, GeomEnums::C_texcoord); - } - } - - if (_rgb_given) { - aformat->add_column(InternalName::get_color(), 4, - GeomEnums::NT_uint8, GeomEnums::C_color); - } - - CPT(GeomVertexFormat) format = GeomVertexFormat::register_format(aformat); - - // Create and populate the vertex data. - PT(GeomVertexData) vdata = new GeomVertexData(_name, format, GeomEnums::UH_static); - GeomVertexWriter vertex_writer(vdata, InternalName::get_vertex()); - GeomVertexWriter normal_writer(vdata, InternalName::get_normal()); - GeomVertexWriter texcoord_writer(vdata, InternalName::get_texcoord()); - GeomVertexWriter color_writer(vdata, InternalName::get_color()); - - for (size_t i = 0; i < _entries.size(); ++i) { - const VertexEntry &entry = _entries[i]; - - if (entry._vi != 0) { - vertex_writer.set_row(i); - vertex_writer.add_data4d(converter->_v_table[entry._vi - 1]); - } - if (entry._vti != 0) { - texcoord_writer.set_row(i); - texcoord_writer.add_data3d(converter->_vt_table[entry._vti - 1]); - } else if (entry._vi - 1 < (int)converter->_xvt_table.size()) { - // We have an xvt texture coordinate. - texcoord_writer.set_row(i); - texcoord_writer.add_data2d(converter->_xvt_table[entry._vi - 1]); - } - if (entry._vni != 0) { - normal_writer.set_row(i); - normal_writer.add_data3d(converter->_vn_table[entry._vni - 1]); - } else if (entry._synth_vni != 0) { - normal_writer.set_row(i); - normal_writer.add_data3d(converter->_synth_vn_table[entry._synth_vni - 1]); - } else { - // In this case, the normal isn't used and doesn't matter; we - // fill it in a unit vector just for neatness. - normal_writer.set_row(i); - normal_writer.add_data3d(0, 0, 1); - } - if (_rgb_given) { - if (entry._vi - 1 < (int)converter->_rgb_table.size()) { - color_writer.set_row(i); - color_writer.add_data3d(converter->_rgb_table[entry._vi - 1]); - } - } - } - - // Transform to zup-right. - vdata->transform_vertices(LMatrix4::convert_mat(CS_zup_right, CS_default)); - - // Now create a Geom with this data. - CPT(RenderState) state = RenderState::make_empty(); - if (_rgb_given) { - state = state->add_attrib(ColorAttrib::make_vertex()); - } else { - state = state->add_attrib(ColorAttrib::make_flat(LColor(1, 1, 1, 1))); - } - if (!_vn_given) { - // We have synthesized these normals; specify the flat-shading - // attrib. - state = state->add_attrib(ShadeModelAttrib::make(ShadeModelAttrib::M_flat)); - _prim->set_shade_model(GeomEnums::SM_flat_last_vertex); - } - - PT(Geom) geom = new Geom(vdata); - geom->add_primitive(_prim); - - if (_geom_node == NULL) { - _geom_node = new GeomNode(_name); - _parent->add_child(_geom_node); - } - - _geom_node->add_geom(geom, state); - } - - _prim = new GeomTriangles(GeomEnums::UH_static); - _entries.clear(); - _unique_entries.clear(); -} +// Filename: objToEggConverter.cxx +// Created by: drose (07Dec10) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + +#include "objToEggConverter.h" +#include "config_objegg.h" +#include "eggData.h" +#include "string_utils.h" +#include "streamReader.h" +#include "virtualFileSystem.h" +#include "eggPolygon.h" +#include "nodePath.h" +#include "geomTriangles.h" +#include "geomPoints.h" +#include "colorAttrib.h" +#include "shadeModelAttrib.h" +#include "dcast.h" +#include "triangulator3.h" +#include "config_egg2pg.h" + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +ObjToEggConverter:: +ObjToEggConverter() { +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +ObjToEggConverter:: +ObjToEggConverter(const ObjToEggConverter ©) : + SomethingToEggConverter(copy) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::Destructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +ObjToEggConverter:: +~ObjToEggConverter() { +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::make_copy +// Access: Public, Virtual +// Description: Allocates and returns a new copy of the converter. +//////////////////////////////////////////////////////////////////// +SomethingToEggConverter *ObjToEggConverter:: +make_copy() { + return new ObjToEggConverter(*this); +} + + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::get_name +// Access: Public, Virtual +// Description: Returns the English name of the file type this +// converter supports. +//////////////////////////////////////////////////////////////////// +string ObjToEggConverter:: +get_name() const { + return "obj"; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::get_extension +// Access: Public, Virtual +// Description: Returns the common extension of the file type this +// converter supports. +//////////////////////////////////////////////////////////////////// +string ObjToEggConverter:: +get_extension() const { + return "obj"; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::supports_compressed +// Access: Published, Virtual +// Description: Returns true if this file type can transparently load +// compressed files (with a .pz extension), false +// otherwise. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +supports_compressed() const { + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::supports_convert_to_node +// Access: Published, Virtual +// Description: Returns true if this converter can directly convert +// the model type to internal Panda memory structures, +// given the indicated options, or false otherwise. If +// this returns true, then convert_to_node() may be +// called to perform the conversion, which may be faster +// than calling convert_file() if the ultimate goal is a +// PandaNode anyway. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +supports_convert_to_node(const LoaderOptions &options) const { + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::convert_file +// Access: Public, Virtual +// Description: Handles the reading of the input file and converting +// it to egg. Returns true if successful, false +// otherwise. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +convert_file(const Filename &filename) { + clear_error(); + + if (_egg_data->get_coordinate_system() == CS_default) { + _egg_data->set_coordinate_system(CS_zup_right); + } + + if (!process(filename)) { + _error = true; + } + return !had_error(); +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::convert_to_node +// Access: Public, Virtual +// Description: Reads the input file and directly produces a +// ready-to-render model file as a PandaNode. Returns +// NULL on failure, or if it is not supported. (This +// functionality is not supported by all converter +// types; see supports_convert_to_node()). +//////////////////////////////////////////////////////////////////// +PT(PandaNode) ObjToEggConverter:: +convert_to_node(const LoaderOptions &options, const Filename &filename) { + clear_error(); + + _root_node = new PandaNode(""); + _current_vertex_data = new VertexData(_root_node, "root"); + + if (!process_node(filename)) { + _error = true; + } + + _current_vertex_data->close_geom(this); + delete _current_vertex_data; + + if (had_error()) { + return NULL; + } + + return _root_node; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process +// Access: Protected +// Description: Reads the file and converts it to egg structures. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process(const Filename &filename) { + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + istream *strm = vfs->open_read_file(filename, true); + if (strm == NULL) { + objegg_cat.error() + << "Couldn't read " << filename << "\n"; + return false; + } + + _v_table.clear(); + _vn_table.clear(); + _rgb_table.clear(); + _vt_table.clear(); + _xvt_table.clear(); + _ref_plane_res.set(1.0, 1.0); + _v4_given = false; + _vt3_given = false; + _f_given = false; + + _vpool = new EggVertexPool("vpool"); + _egg_data->add_child(_vpool); + _root_group = new EggGroup("root"); + _egg_data->add_child(_root_group); + _current_group = _root_group; + + StreamReader sr(strm, true); + string line = sr.readline(); + _line_number = 1; + while (!line.empty()) { + line = trim(line); + if (line.empty()) { + line = sr.readline(); + continue; + } + + while (line[line.length() - 1] == '\\') { + // If it ends on a backslash, it's a continuation character. + string line2 = sr.readline(); + ++_line_number; + if (line2.empty()) { + break; + } + line = line.substr(0, line.length() - 1) + trim(line2); + } + + if (line.substr(0, 15) == "#_ref_plane_res") { + process_ref_plane_res(line); + line = sr.readline(); + continue; + } + + if (line[0] == '#') { + line = sr.readline(); + continue; + } + + if (!process_line(line)) { + return false; + } + line = sr.readline(); + ++_line_number; + } + + if (!_f_given) { + generate_egg_points(); + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_line +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_line(const string &line) { + vector_string words; + tokenize(line, words, " \t", true); + nassertr(!words.empty(), false); + + string tag = words[0]; + if (tag == "v") { + return process_v(words); + } else if (tag == "vt") { + return process_vt(words); + } else if (tag == "xvt") { + return process_xvt(words); + } else if (tag == "xvc") { + return process_xvc(words); + } else if (tag == "vn") { + return process_vn(words); + } else if (tag == "f") { + return process_f(words); + } else if (tag == "g") { + return process_g(words); + } else { + bool inserted = _ignored_tags.insert(tag).second; + if (inserted) { + objegg_cat.info() + << "Ignoring tag " << tag << "\n"; + } + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_line +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_ref_plane_res(const string &line) { + // the #_ref_plane_res line is a DRZ extension that defines the + // pixel resolution of the projector device. It's needed to + // properly scale the xvt lines. + + vector_string words; + tokenize(line, words, " \t", true); + nassertr(!words.empty(), false); + + if (words.size() != 3) { + objegg_cat.error() + << "Wrong number of tokens at line " << _line_number << "\n"; + return false; + } + + bool okflag = true; + LPoint3d pos; + okflag &= string_to_double(words[1], _ref_plane_res[0]); + okflag &= string_to_double(words[2], _ref_plane_res[1]); + + if (!okflag) { + objegg_cat.error() + << "Invalid number at line " << _line_number << ":\n"; + return false; + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_v +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_v(vector_string &words) { + if (words.size() != 4 && words.size() != 5 && + words.size() != 7 && words.size() != 8) { + objegg_cat.error() + << "Wrong number of tokens at line " << _line_number << "\n"; + return false; + } + + bool okflag = true; + LPoint4d pos; + okflag &= string_to_double(words[1], pos[0]); + okflag &= string_to_double(words[2], pos[1]); + okflag &= string_to_double(words[3], pos[2]); + if (words.size() == 5 || words.size() == 8) { + okflag &= string_to_double(words[4], pos[3]); + _v4_given = true; + } else { + pos[3] = 1.0; + } + + if (!okflag) { + objegg_cat.error() + << "Invalid number at line " << _line_number << "\n"; + return false; + } + + _v_table.push_back(pos); + + // Meshlab format might include an RGB color following the vertex + // position. + if (words.size() == 7 && words.size() == 8) { + size_t si = words.size(); + LVecBase3d rgb; + okflag &= string_to_double(words[si - 3], rgb[0]); + okflag &= string_to_double(words[si - 2], rgb[1]); + okflag &= string_to_double(words[si - 1], rgb[2]); + + if (!okflag) { + objegg_cat.error() + << "Invalid number at line " << _line_number << "\n"; + return false; + } + while (_rgb_table.size() + 1 < _v_table.size()) { + _rgb_table.push_back(LVecBase3d(1.0, 1.0, 1.0)); + } + _rgb_table.push_back(rgb); + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_vt +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_vt(vector_string &words) { + if (words.size() != 3 && words.size() != 4) { + objegg_cat.error() + << "Wrong number of tokens at line " << _line_number << "\n"; + return false; + } + + bool okflag = true; + LTexCoord3d uvw; + okflag &= string_to_double(words[1], uvw[0]); + okflag &= string_to_double(words[2], uvw[1]); + if (words.size() == 4) { + okflag &= string_to_double(words[3], uvw[2]); + _vt3_given = true; + } else { + uvw[2] = 0.0; + } + + if (!okflag) { + objegg_cat.error() + << "Invalid number at line " << _line_number << "\n"; + return false; + } + + _vt_table.push_back(uvw); + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_xvt +// Access: Protected +// Description: "xvt" is an extended column invented by DRZ. It +// includes texture coordinates in pixel space of the +// projector device, as well as for each camera. We map +// it to the nominal texture coordinates here. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_xvt(vector_string &words) { + if (words.size() < 3) { + objegg_cat.error() + << "Wrong number of tokens at line " << _line_number << "\n"; + return false; + } + + bool okflag = true; + LTexCoordd uv; + okflag &= string_to_double(words[1], uv[0]); + okflag &= string_to_double(words[2], uv[1]); + + if (!okflag) { + objegg_cat.error() + << "Invalid number at line " << _line_number << "\n"; + return false; + } + + uv[0] /= _ref_plane_res[0]; + uv[1] = 1.0 - uv[1] / _ref_plane_res[1]; + + _xvt_table.push_back(uv); + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_xvc +// Access: Protected +// Description: "xvc" is another extended column invented by DRZ. We +// quietly ignore it. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_xvc(vector_string &words) { + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_vn +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_vn(vector_string &words) { + if (words.size() != 4) { + objegg_cat.error() + << "Wrong number of tokens at line " << _line_number << "\n"; + return false; + } + + bool okflag = true; + LVector3d normal; + okflag &= string_to_double(words[1], normal[0]); + okflag &= string_to_double(words[2], normal[1]); + okflag &= string_to_double(words[3], normal[2]); + + if (!okflag) { + objegg_cat.error() + << "Invalid number at line " << _line_number << "\n"; + return false; + } + normal.normalize(); + + _vn_table.push_back(normal); + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_f +// Access: Protected +// Description: Defines a face in the obj file. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_f(vector_string &words) { + _f_given = true; + + PT(EggPolygon) poly = new EggPolygon; + for (size_t i = 1; i < words.size(); ++i) { + EggVertex *vertex = get_face_vertex(words[i]); + if (vertex == NULL) { + return false; + } + poly->add_vertex(vertex); + } + _current_group->add_child(poly); + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_g +// Access: Protected +// Description: Defines a group in the obj file. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_g(vector_string &words) { + EggGroup *group = _root_group; + + // We assume the group names define a hierarchy of more-specific to + // less-specific group names, so that the first group name is the + // bottommost node, and the last group name is the topmost node. + + // Thus, iterate from the back to the front. + size_t i = words.size(); + while (i > 1) { + --i; + EggNode *child = group->find_child(words[i]); + if (child == NULL || !child->is_of_type(EggGroup::get_class_type())) { + child = new EggGroup(words[i]); + group->add_child(child); + } + group = DCAST(EggGroup, child); + } + + _current_group = group; + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::get_face_vertex +// Access: Protected +// Description: Returns or creates a vertex in the vpool according to +// the indicated face reference. +//////////////////////////////////////////////////////////////////// +EggVertex *ObjToEggConverter:: +get_face_vertex(const string &reference) { + VertexEntry entry(this, reference); + + // Synthesize a vertex. + EggVertex synth; + + if (entry._vi != 0) { + if (_v4_given) { + synth.set_pos(LCAST(double, _v_table[entry._vi - 1])); + } else { + LPoint4d pos = _v_table[entry._vi - 1]; + synth.set_pos(LPoint3d(pos[0], pos[1], pos[2])); + } + + if (entry._vi - 1 < (int)_rgb_table.size()) { + // We have a per-vertex color too. + LRGBColord rgb = _rgb_table[entry._vi - 1]; + LColor rgba(rgb[0], rgb[1], rgb[2], 1.0); + synth.set_color(rgba); + } + } + + if (entry._vti != 0) { + // We have a texture coordinate; apply it. + if (_vt3_given) { + synth.set_uvw("", _vt_table[entry._vti - 1]); + } else { + LTexCoord3d uvw = _vt_table[entry._vti - 1]; + synth.set_uv("", LTexCoordd(uvw[0], uvw[1])); + } + } else if (entry._vi - 1 < (int)_xvt_table.size()) { + // We have an xvt texture coordinate. + synth.set_uv("", _xvt_table[entry._vi - 1]); + } + + if (entry._vni != 0) { + // We have a normal; apply it. + synth.set_normal(_vn_table[entry._vni - 1]); + } + + return _vpool->create_unique_vertex(synth); +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::generate_egg_points +// Access: Protected +// Description: If an obj file defines no faces, create a bunch of +// EggVertex objects to illustrate the vertex positions +// at least. +//////////////////////////////////////////////////////////////////// +void ObjToEggConverter:: +generate_egg_points() { + for (size_t vi = 0; vi < _v_table.size(); ++vi) { + const LVecBase4d &p = _v_table[vi]; + _vpool->make_new_vertex(LVecBase3d(p[0], p[1], p[2])); + } +} + + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_node +// Access: Protected +// Description: Reads the file and converts it to PandaNode structures. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_node(const Filename &filename) { + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + istream *strm = vfs->open_read_file(filename, true); + if (strm == NULL) { + objegg_cat.error() + << "Couldn't read " << filename << "\n"; + return false; + } + + _v_table.clear(); + _vn_table.clear(); + _rgb_table.clear(); + _vt_table.clear(); + _xvt_table.clear(); + _ref_plane_res.set(1.0, 1.0); + _v4_given = false; + _vt3_given = false; + _f_given = false; + + StreamReader sr(strm, true); + string line = sr.readline(); + _line_number = 1; + while (!line.empty()) { + line = trim(line); + if (line.empty()) { + line = sr.readline(); + continue; + } + + if (line.substr(0, 15) == "#_ref_plane_res") { + process_ref_plane_res(line); + line = sr.readline(); + continue; + } + + if (line[0] == '#') { + line = sr.readline(); + continue; + } + + if (!process_line_node(line)) { + return false; + } + line = sr.readline(); + ++_line_number; + } + + if (!_f_given) { + generate_points(); + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_line_node +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_line_node(const string &line) { + vector_string words; + tokenize(line, words, " \t", true); + nassertr(!words.empty(), false); + + string tag = words[0]; + if (tag == "v") { + return process_v(words); + } else if (tag == "vt") { + return process_vt(words); + } else if (tag == "xvt") { + return process_xvt(words); + } else if (tag == "xvc") { + return process_xvc(words); + } else if (tag == "vn") { + return process_vn(words); + } else if (tag == "f") { + return process_f_node(words); + } else if (tag == "g") { + return process_g_node(words); + } else { + bool inserted = _ignored_tags.insert(tag).second; + if (inserted) { + objegg_cat.info() + << "Ignoring tag " << tag << "\n"; + } + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_f_node +// Access: Protected +// Description: Defines a face in the obj file. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_f_node(vector_string &words) { + _f_given = true; + + bool all_vn = true; + int non_vn_index = -1; + + pvector verts; + verts.reserve(words.size() - 1); + for (size_t i = 1; i < words.size(); ++i) { + VertexEntry entry(this, words[i]); + verts.push_back(entry); + if (entry._vni == 0) { + all_vn = false; + non_vn_index = i; + } + } + + if (verts.size() < 3) { + // Not enough vertices. + objegg_cat.error() + << "Degenerate face at " << _line_number << "\n"; + return false; + } + + int synth_vni = 0; + if (!all_vn) { + // Synthesize a normal if we need it. + LNormald normal = LNormald::zero(); + for (size_t i = 0; i < verts.size(); ++i) { + int vi0 = verts[i]._vi; + int vi1 = verts[(i + 1) % verts.size()]._vi; + if (vi0 == 0 || vi1 == 0) { + continue; + } + const LVecBase4d &p0 = _v_table[vi0 - 1]; + const LVecBase4d &p1 = _v_table[vi1 - 1]; + + normal[0] += p0[1] * p1[2] - p0[2] * p1[1]; + normal[1] += p0[2] * p1[0] - p0[0] * p1[2]; + normal[2] += p0[0] * p1[1] - p0[1] * p1[0]; + } + normal.normalize(); + synth_vni = add_synth_normal(normal); + } + + Triangulator3 tri; + int num_tris = 1; + + if (verts.size() != 3) { + // We have to triangulate a higher-order polygon. + for (size_t i = 0; i < verts.size(); ++i) { + const LVecBase4d &p = _v_table[verts[i]._vi - 1]; + tri.add_vertex(p[0], p[1], p[2]); + tri.add_polygon_vertex(i); + } + + tri.triangulate(); + num_tris = tri.get_num_triangles(); + } + + if (_current_vertex_data->_prim->get_num_vertices() + 3 * num_tris > egg_max_indices || + _current_vertex_data->_entries.size() + verts.size() > egg_max_vertices) { + // We'll exceed our specified limit with these triangles; start a new Geom. + _current_vertex_data->close_geom(this); + } + + if (verts.size() == 3) { + // It's already a triangle; add it directly. + _current_vertex_data->add_triangle(this, verts[0], verts[1], verts[2], synth_vni); + + } else { + // Get the triangulated results. + for (int ti = 0; ti < num_tris; ++ti) { + int i0 = tri.get_triangle_v0(ti); + int i1 = tri.get_triangle_v1(ti); + int i2 = tri.get_triangle_v2(ti); + _current_vertex_data->add_triangle(this, verts[i0], verts[i1], verts[i2], synth_vni); + } + } + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::process_g_node +// Access: Protected +// Description: Defines a group in the obj file. +//////////////////////////////////////////////////////////////////// +bool ObjToEggConverter:: +process_g_node(vector_string &words) { + _current_vertex_data->close_geom(this); + delete _current_vertex_data; + _current_vertex_data = NULL; + + NodePath np(_root_node); + + // We assume the group names define a hierarchy of more-specific to + // less-specific group names, so that the first group name is the + // bottommost node, and the last group name is the topmost node. + + // Thus, iterate from the back to the front. + size_t i = words.size(); + string name; + while (i > 2) { + --i; + name = words[i]; + NodePath child = np.find(name); + if (!child) { + child = np.attach_new_node(name); + } + np = child; + } + + if (i > 1) { + --i; + name = words[i]; + } + + _current_vertex_data = new VertexData(np.node(), name); + + return true; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::generate_points +// Access: Protected +// Description: If an obj file defines no faces, create a bunch of +// GeomPoints to illustrate the vertex positions at +// least. +//////////////////////////////////////////////////////////////////// +void ObjToEggConverter:: +generate_points() { + CPT(GeomVertexFormat) format = GeomVertexFormat::get_v3(); + PT(GeomVertexData) vdata = new GeomVertexData("points", format, GeomEnums::UH_static); + vdata->set_num_rows(_v_table.size()); + GeomVertexWriter vertex_writer(vdata, InternalName::get_vertex()); + + for (size_t vi = 0; vi < _v_table.size(); ++vi) { + const LVecBase4d &p = _v_table[vi]; + vertex_writer.add_data3d(p[0], p[1], p[2]); + } + + PT(GeomPrimitive) prim = new GeomPoints(GeomEnums::UH_static); + prim->add_next_vertices(_v_table.size()); + prim->close_primitive(); + + PT(Geom) geom = new Geom(vdata); + geom->add_primitive(prim); + + PT(GeomNode) geom_node = new GeomNode("points"); + geom_node->add_geom(geom); + _root_node->add_child(geom_node); +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::add_synth_normal +// Access: Private +// Description: Adds a new normal to the synth_vn table, or returns +// an existing normal. In either case returns the +// 1-based index number to the normal. +//////////////////////////////////////////////////////////////////// +int ObjToEggConverter:: +add_synth_normal(const LVecBase3d &normal) { + pair result = _unique_synth_vn_table.insert(UniqueVec3Table::value_type(normal, _unique_synth_vn_table.size())); + UniqueVec3Table::iterator ni = result.first; + int index = (*ni).second; + + if (result.second) { + // If the normal was added to the table, it's a unique normal, and + // now we have to add it to the table too. + _synth_vn_table.push_back(normal); + } + + return index + 1; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::VertexEntry::Constructor +// Access: Public +// Description: Creates a VertexEntry from the n/n/n string format in +// the obj file face reference. +//////////////////////////////////////////////////////////////////// +ObjToEggConverter::VertexEntry:: +VertexEntry(const ObjToEggConverter *converter, const string &obj_vertex) { + _vi = 0; + _vti = 0; + _vni = 0; + _synth_vni = 0; + + vector_string words; + tokenize(obj_vertex, words, "/", false); + nassertv(!words.empty()); + + for (size_t i = 0; i < words.size(); ++i) { + int index; + if (trim(words[i]).empty()) { + index = 0; + } else { + if (!string_to_int(words[i], index)) { + index = 0; + } + } + + switch (i) { + case 0: + _vi = index; + if (_vi < 0) { + _vi = (int)converter->_v_table.size() + _vi; + } + if (_vi < 0 || _vi - 1 >= (int)converter->_v_table.size()) { + _vi = 0; + } + break; + + case 1: + _vti = index; + if (_vti < 0) { + _vti = (int)converter->_vt_table.size() + _vti; + } + if (_vti < 0 || _vti - 1 >= (int)converter->_vt_table.size()) { + _vti = 0; + } + break; + + case 2: + _vni = index; + if (_vni < 0) { + _vni = (int)converter->_vn_table.size() + _vni; + } + if (_vni < 0 || _vni - 1 >= (int)converter->_vn_table.size()) { + _vni = 0; + } + break; + } + } +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::VertexData::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +ObjToEggConverter::VertexData:: +VertexData(PandaNode *parent, const string &name) : + _parent(parent), _name(name) +{ + _geom_node = NULL; + + _v4_given = false; + _vt3_given = false; + _vt_given = false; + _rgb_given = false; + _vn_given = false; + + _prim = new GeomTriangles(GeomEnums::UH_static); +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::VertexData::add_vertex +// Access: Public +// Description: Adds a new entry to the vertex data for the indicated +// VertexEntry, or returns an equivalent vertex already +// present. +//////////////////////////////////////////////////////////////////// +int ObjToEggConverter::VertexData:: +add_vertex(const ObjToEggConverter *converter, const VertexEntry &entry) { + pair result; + UniqueVertexEntries::iterator ni; + int index; + + if (entry._vni != 0 || entry._synth_vni != 0) { + // If we are storing a vertex with a normal, see if we + // have already stored a vertex without a normal first. + VertexEntry no_normal(entry); + no_normal._vni = 0; + no_normal._synth_vni = 0; + ni = _unique_entries.find(no_normal); + if (ni != _unique_entries.end()) { + // We did have such a vertex! In this case, repurpose this + // vertex, resetting it to contain this normal. + index = (*ni).second; + _unique_entries.erase(ni); + result = _unique_entries.insert(UniqueVertexEntries::value_type(entry, index)); + nassertr(result.second, index); + nassertr(_entries[index] == no_normal, index); + _entries[index]._vni = entry._vni; + _entries[index]._synth_vni = entry._synth_vni; + return index; + } + } else if (entry._vni == 0 && entry._synth_vni == 0) { + // If we are storing a vertex *without* any normal, see if we have + // already stored a vertex with a normal first. + ni = _unique_entries.lower_bound(entry); + if (ni != _unique_entries.end() && (*ni).first.matches_except_normal(entry)) { + // We had such a vertex, so use it. + index = (*ni).second; + return index; + } + } + + // We didn't already have a vertex we could repurpose, so try to add + // exactly the desired vertex. + result = _unique_entries.insert(UniqueVertexEntries::value_type(entry, _entries.size())); + ni = result.first; + index = (*ni).second; + + if (result.second) { + // If the vertex was added to the table, it's a unique vertex, and + // now we have to add it to the vertex data too. + _entries.push_back(entry); + + if (converter->_v4_given) { + _v4_given = true; + } + if (converter->_vt3_given) { + _vt3_given = true; + } + if (entry._vti != 0) { + _vt_given = true; + } else if (entry._vi - 1 < (int)converter->_xvt_table.size()) { + // We have an xvt texture coordinate. + _vt_given = true; + } + if (entry._vi - 1 < (int)converter->_rgb_table.size()) { + // We have a per-vertex color too. + _rgb_given = true; + } + if (entry._vni != 0) { + _vn_given = true; + } + } + + return index; +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::VertexData::add_triangle +// Access: Public +// Description: Adds a triangle to the primitive, as a triple of +// three VertexEntry objects, which are each added to +// the vertex pool. If synth_vni is not 0, it is +// assigned to the last vertex. +//////////////////////////////////////////////////////////////////// +void ObjToEggConverter::VertexData:: +add_triangle(const ObjToEggConverter *converter, const VertexEntry &v0, + const VertexEntry &v1, const VertexEntry &v2, + int synth_vni) { + int v0i, v1i, v2i; + + v0i = add_vertex(converter, v0); + v1i = add_vertex(converter, v1); + + if (synth_vni != 0) { + VertexEntry v2n(v2); + v2n._synth_vni = synth_vni; + v2i = add_vertex(converter, v2n); + } else { + v2i = add_vertex(converter, v2); + } + + _prim->add_vertices(v0i, v1i, v2i); + _prim->close_primitive(); +} + +//////////////////////////////////////////////////////////////////// +// Function: ObjToEggConverter::VertexData::close_geom +// Access: Public +// Description: Finishes the current geom and stores it as a child +// in the root. Prepares for new geoms. +//////////////////////////////////////////////////////////////////// +void ObjToEggConverter::VertexData:: +close_geom(const ObjToEggConverter *converter) { + if (_prim->get_num_vertices() != 0) { + // Create a new format that includes only the columns we actually + // used. + PT(GeomVertexArrayFormat) aformat = new GeomVertexArrayFormat; + if (_v4_given) { + aformat->add_column(InternalName::get_vertex(), 4, + GeomEnums::NT_stdfloat, GeomEnums::C_point); + } else { + aformat->add_column(InternalName::get_vertex(), 3, + GeomEnums::NT_stdfloat, GeomEnums::C_point); + } + + // We always add normals--if no normals appeared in the file, we + // synthesize them. + aformat->add_column(InternalName::get_normal(), 3, + GeomEnums::NT_stdfloat, GeomEnums::C_vector); + + if (_vt_given) { + if (_vt3_given) { + aformat->add_column(InternalName::get_texcoord(), 3, + GeomEnums::NT_stdfloat, GeomEnums::C_texcoord); + } else { + aformat->add_column(InternalName::get_texcoord(), 2, + GeomEnums::NT_stdfloat, GeomEnums::C_texcoord); + } + } + + if (_rgb_given) { + aformat->add_column(InternalName::get_color(), 4, + GeomEnums::NT_uint8, GeomEnums::C_color); + } + + CPT(GeomVertexFormat) format = GeomVertexFormat::register_format(aformat); + + // Create and populate the vertex data. + PT(GeomVertexData) vdata = new GeomVertexData(_name, format, GeomEnums::UH_static); + GeomVertexWriter vertex_writer(vdata, InternalName::get_vertex()); + GeomVertexWriter normal_writer(vdata, InternalName::get_normal()); + GeomVertexWriter texcoord_writer(vdata, InternalName::get_texcoord()); + GeomVertexWriter color_writer(vdata, InternalName::get_color()); + + for (size_t i = 0; i < _entries.size(); ++i) { + const VertexEntry &entry = _entries[i]; + + if (entry._vi != 0) { + vertex_writer.set_row(i); + vertex_writer.add_data4d(converter->_v_table[entry._vi - 1]); + } + if (entry._vti != 0) { + texcoord_writer.set_row(i); + texcoord_writer.add_data3d(converter->_vt_table[entry._vti - 1]); + } else if (entry._vi - 1 < (int)converter->_xvt_table.size()) { + // We have an xvt texture coordinate. + texcoord_writer.set_row(i); + texcoord_writer.add_data2d(converter->_xvt_table[entry._vi - 1]); + } + if (entry._vni != 0) { + normal_writer.set_row(i); + normal_writer.add_data3d(converter->_vn_table[entry._vni - 1]); + } else if (entry._synth_vni != 0) { + normal_writer.set_row(i); + normal_writer.add_data3d(converter->_synth_vn_table[entry._synth_vni - 1]); + } else { + // In this case, the normal isn't used and doesn't matter; we + // fill it in a unit vector just for neatness. + normal_writer.set_row(i); + normal_writer.add_data3d(0, 0, 1); + } + if (_rgb_given) { + if (entry._vi - 1 < (int)converter->_rgb_table.size()) { + color_writer.set_row(i); + color_writer.add_data3d(converter->_rgb_table[entry._vi - 1]); + } + } + } + + // Transform to zup-right. + vdata->transform_vertices(LMatrix4::convert_mat(CS_zup_right, CS_default)); + + // Now create a Geom with this data. + CPT(RenderState) state = RenderState::make_empty(); + if (_rgb_given) { + state = state->add_attrib(ColorAttrib::make_vertex()); + } else { + state = state->add_attrib(ColorAttrib::make_flat(LColor(1, 1, 1, 1))); + } + if (!_vn_given) { + // We have synthesized these normals; specify the flat-shading + // attrib. + state = state->add_attrib(ShadeModelAttrib::make(ShadeModelAttrib::M_flat)); + _prim->set_shade_model(GeomEnums::SM_flat_last_vertex); + } + + PT(Geom) geom = new Geom(vdata); + geom->add_primitive(_prim); + + if (_geom_node == NULL) { + _geom_node = new GeomNode(_name); + _parent->add_child(_geom_node); + } + + _geom_node->add_geom(geom, state); + } + + _prim = new GeomTriangles(GeomEnums::UH_static); + _entries.clear(); + _unique_entries.clear(); +} diff --git a/pandatool/src/objegg/objToEggConverter.h b/pandatool/src/objegg/objToEggConverter.h index ba537dbe2a..66fb6d7f37 100644 --- a/pandatool/src/objegg/objToEggConverter.h +++ b/pandatool/src/objegg/objToEggConverter.h @@ -1,152 +1,152 @@ -// Filename: ObjToEggConverter.h -// Created by: drose (07Dec10) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef OBJTOEGGCONVERTER_H -#define OBJTOEGGCONVERTER_H - -#include "pandatoolbase.h" - -#include "somethingToEggConverter.h" -#include "eggVertexPool.h" -#include "eggGroup.h" -#include "geomVertexData.h" -#include "geomVertexWriter.h" -#include "geomPrimitive.h" -#include "geomNode.h" -#include "pandaNode.h" -#include "pvector.h" -#include "epvector.h" - -//////////////////////////////////////////////////////////////////// -// Class : ObjToEggConverter -// Description : Convert an Obj file to egg data. -//////////////////////////////////////////////////////////////////// -class ObjToEggConverter : public SomethingToEggConverter { -public: - ObjToEggConverter(); - ObjToEggConverter(const ObjToEggConverter ©); - ~ObjToEggConverter(); - - virtual SomethingToEggConverter *make_copy(); - - virtual string get_name() const; - virtual string get_extension() const; - virtual bool supports_compressed() const; - virtual bool supports_convert_to_node(const LoaderOptions &options) const; - - virtual bool convert_file(const Filename &filename); - virtual PT(PandaNode) convert_to_node(const LoaderOptions &options, const Filename &filename); - -protected: - bool process(const Filename &filename); - bool process_line(const string &line); - bool process_ref_plane_res(const string &line); - - bool process_v(vector_string &words); - bool process_vt(vector_string &words); - bool process_xvt(vector_string &words); - bool process_xvc(vector_string &words); - bool process_vn(vector_string &words); - bool process_f(vector_string &words); - bool process_g(vector_string &words); - - EggVertex *get_face_vertex(const string &face_reference); - void generate_egg_points(); - - bool process_node(const Filename &filename); - bool process_line_node(const string &line); - - bool process_f_node(vector_string &words); - bool process_g_node(vector_string &words); - - void generate_points(); - int add_synth_normal(const LVecBase3d &normal); - - // Read from the obj file. - int _line_number; - typedef epvector Vec4Table; - typedef epvector Vec3Table; - typedef epvector Vec2Table; - typedef pmap UniqueVec3Table; - - Vec4Table _v_table; - Vec3Table _vn_table, _rgb_table; - Vec3Table _vt_table; - Vec2Table _xvt_table; - Vec3Table _synth_vn_table; - UniqueVec3Table _unique_synth_vn_table; - LVecBase2d _ref_plane_res; - bool _v4_given, _vt3_given; - bool _f_given; - - pset _ignored_tags; - - // Structures filled when creating an egg file. - PT(EggVertexPool) _vpool; - PT(EggGroup) _root_group; - EggGroup *_current_group; - - // Structures filled when creating a PandaNode directly. - PT(PandaNode) _root_node; - - class VertexEntry { - public: - VertexEntry(); - VertexEntry(const ObjToEggConverter *converter, const string &obj_vertex); - - INLINE bool operator < (const VertexEntry &other) const; - INLINE bool operator == (const VertexEntry &other) const; - INLINE bool matches_except_normal(const VertexEntry &other) const; - - // The 1-based vertex, texcoord, and normal index numbers - // appearing in the obj file for this vertex. 0 if the index - // number is not given. - int _vi, _vti, _vni; - - // The 1-based index number to the synthesized normal, if needed. - int _synth_vni; - }; - typedef pmap UniqueVertexEntries; - typedef pvector VertexEntries; - - class VertexData { - public: - VertexData(PandaNode *parent, const string &name); - - int add_vertex(const ObjToEggConverter *converter, const VertexEntry &entry); - void add_triangle(const ObjToEggConverter *converter, const VertexEntry &v0, - const VertexEntry &v1, const VertexEntry &v2, - int synth_vni); - void close_geom(const ObjToEggConverter *converter); - - PT(PandaNode) _parent; - string _name; - PT(GeomNode) _geom_node; - - PT(GeomPrimitive) _prim; - VertexEntries _entries; - UniqueVertexEntries _unique_entries; - - bool _v4_given, _vt3_given; - bool _vt_given, _rgb_given, _vn_given; - }; - - VertexData *_current_vertex_data; - - friend class VertexData; -}; - -#include "objToEggConverter.I" - -#endif +// Filename: ObjToEggConverter.h +// Created by: drose (07Dec10) +// +//////////////////////////////////////////////////////////////////// +// +// 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." +// +//////////////////////////////////////////////////////////////////// + +#ifndef OBJTOEGGCONVERTER_H +#define OBJTOEGGCONVERTER_H + +#include "pandatoolbase.h" + +#include "somethingToEggConverter.h" +#include "eggVertexPool.h" +#include "eggGroup.h" +#include "geomVertexData.h" +#include "geomVertexWriter.h" +#include "geomPrimitive.h" +#include "geomNode.h" +#include "pandaNode.h" +#include "pvector.h" +#include "epvector.h" + +//////////////////////////////////////////////////////////////////// +// Class : ObjToEggConverter +// Description : Convert an Obj file to egg data. +//////////////////////////////////////////////////////////////////// +class ObjToEggConverter : public SomethingToEggConverter { +public: + ObjToEggConverter(); + ObjToEggConverter(const ObjToEggConverter ©); + ~ObjToEggConverter(); + + virtual SomethingToEggConverter *make_copy(); + + virtual string get_name() const; + virtual string get_extension() const; + virtual bool supports_compressed() const; + virtual bool supports_convert_to_node(const LoaderOptions &options) const; + + virtual bool convert_file(const Filename &filename); + virtual PT(PandaNode) convert_to_node(const LoaderOptions &options, const Filename &filename); + +protected: + bool process(const Filename &filename); + bool process_line(const string &line); + bool process_ref_plane_res(const string &line); + + bool process_v(vector_string &words); + bool process_vt(vector_string &words); + bool process_xvt(vector_string &words); + bool process_xvc(vector_string &words); + bool process_vn(vector_string &words); + bool process_f(vector_string &words); + bool process_g(vector_string &words); + + EggVertex *get_face_vertex(const string &face_reference); + void generate_egg_points(); + + bool process_node(const Filename &filename); + bool process_line_node(const string &line); + + bool process_f_node(vector_string &words); + bool process_g_node(vector_string &words); + + void generate_points(); + int add_synth_normal(const LVecBase3d &normal); + + // Read from the obj file. + int _line_number; + typedef epvector Vec4Table; + typedef epvector Vec3Table; + typedef epvector Vec2Table; + typedef pmap UniqueVec3Table; + + Vec4Table _v_table; + Vec3Table _vn_table, _rgb_table; + Vec3Table _vt_table; + Vec2Table _xvt_table; + Vec3Table _synth_vn_table; + UniqueVec3Table _unique_synth_vn_table; + LVecBase2d _ref_plane_res; + bool _v4_given, _vt3_given; + bool _f_given; + + pset _ignored_tags; + + // Structures filled when creating an egg file. + PT(EggVertexPool) _vpool; + PT(EggGroup) _root_group; + EggGroup *_current_group; + + // Structures filled when creating a PandaNode directly. + PT(PandaNode) _root_node; + + class VertexEntry { + public: + VertexEntry(); + VertexEntry(const ObjToEggConverter *converter, const string &obj_vertex); + + INLINE bool operator < (const VertexEntry &other) const; + INLINE bool operator == (const VertexEntry &other) const; + INLINE bool matches_except_normal(const VertexEntry &other) const; + + // The 1-based vertex, texcoord, and normal index numbers + // appearing in the obj file for this vertex. 0 if the index + // number is not given. + int _vi, _vti, _vni; + + // The 1-based index number to the synthesized normal, if needed. + int _synth_vni; + }; + typedef pmap UniqueVertexEntries; + typedef pvector VertexEntries; + + class VertexData { + public: + VertexData(PandaNode *parent, const string &name); + + int add_vertex(const ObjToEggConverter *converter, const VertexEntry &entry); + void add_triangle(const ObjToEggConverter *converter, const VertexEntry &v0, + const VertexEntry &v1, const VertexEntry &v2, + int synth_vni); + void close_geom(const ObjToEggConverter *converter); + + PT(PandaNode) _parent; + string _name; + PT(GeomNode) _geom_node; + + PT(GeomPrimitive) _prim; + VertexEntries _entries; + UniqueVertexEntries _unique_entries; + + bool _v4_given, _vt3_given; + bool _vt_given, _rgb_given, _vn_given; + }; + + VertexData *_current_vertex_data; + + friend class VertexData; +}; + +#include "objToEggConverter.I" + +#endif diff --git a/pandatool/src/objprogs/Sources.pp b/pandatool/src/objprogs/Sources.pp deleted file mode 100644 index 9f8b6c81e3..0000000000 --- a/pandatool/src/objprogs/Sources.pp +++ /dev/null @@ -1,30 +0,0 @@ -#define UNIX_SYS_LIBS m - -#define OTHER_LIBS \ - p3egg:c p3egg2pg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET obj2egg - #define LOCAL_LIBS p3objegg p3eggbase p3progbase - - #define SOURCES \ - objToEgg.cxx objToEgg.h - -#end bin_target - -#begin bin_target - #define TARGET egg2obj - #define LOCAL_LIBS p3objegg p3eggbase p3progbase - - #define SOURCES \ - eggToObj.cxx eggToObj.h - -#end bin_target diff --git a/pandatool/src/palettizer/Sources.pp b/pandatool/src/palettizer/Sources.pp deleted file mode 100644 index 57cab79d88..0000000000 --- a/pandatool/src/palettizer/Sources.pp +++ /dev/null @@ -1,39 +0,0 @@ -#begin ss_lib_target - #define TARGET p3palettizer - #define LOCAL_LIBS \ - p3pandatoolbase - - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_palettizer.h destTextureImage.h eggFile.h \ - filenameUnifier.h imageFile.h omitReason.h \ - pal_string_utils.h paletteGroup.h \ - paletteGroups.h paletteImage.h \ - palettePage.h palettizer.h sourceTextureImage.h \ - textureImage.h textureMemoryCounter.h texturePlacement.h \ - texturePosition.h textureProperties.h \ - textureReference.h textureRequest.h \ - txaFile.h txaLine.h - - #define INCLUDED_SOURCES \ - config_palettizer.cxx destTextureImage.cxx eggFile.cxx \ - filenameUnifier.cxx imageFile.cxx \ - omitReason.cxx pal_string_utils.cxx paletteGroup.cxx \ - paletteGroups.cxx paletteImage.cxx palettePage.cxx \ - palettizer.cxx sourceTextureImage.cxx textureImage.cxx \ - textureMemoryCounter.cxx texturePlacement.cxx \ - texturePosition.cxx textureProperties.cxx \ - textureReference.cxx textureRequest.cxx txaFile.cxx \ - txaLine.cxx - -#end ss_lib_target diff --git a/pandatool/src/pandatoolbase/Sources.pp b/pandatool/src/pandatoolbase/Sources.pp deleted file mode 100644 index acd6308c77..0000000000 --- a/pandatool/src/pandatoolbase/Sources.pp +++ /dev/null @@ -1,26 +0,0 @@ -#define OTHER_LIBS \ - p3pipeline:c panda:m \ - p3express:c p3putil:c p3pandabase:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - -#begin ss_lib_target - #define TARGET p3pandatoolbase - - #define SOURCES \ - animationConvert.cxx animationConvert.h \ - config_pandatoolbase.cxx config_pandatoolbase.h \ - distanceUnit.cxx distanceUnit.h \ - pandatoolbase.cxx pandatoolbase.h pandatoolsymbols.h \ - pathReplace.cxx pathReplace.I pathReplace.h \ - pathStore.cxx pathStore.h - - #define INSTALL_HEADERS \ - animationConvert.h \ - config_pandatoolbase.h \ - distanceUnit.h \ - pandatoolbase.h pandatoolsymbols.h \ - pathReplace.I pathReplace.h \ - pathStore.h - -#end ss_lib_target diff --git a/pandatool/src/pfmprogs/Sources.pp b/pandatool/src/pfmprogs/Sources.pp deleted file mode 100644 index f97089ada7..0000000000 --- a/pandatool/src/pfmprogs/Sources.pp +++ /dev/null @@ -1,40 +0,0 @@ -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3display:c p3gobj:c p3pgraph:c p3pstatclient:c p3grutil:c panda:m \ - p3pandabase:c p3pnmimage:c p3pnmimagetypes:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET pfm-trans - #define LOCAL_LIBS p3progbase - - #define SOURCES \ - config_pfm.cxx config_pfm.h \ - pfmTrans.cxx pfmTrans.h - -#end bin_target - -#begin bin_target - #define TARGET pfm-bba - #define LOCAL_LIBS p3progbase - - #define SOURCES \ - config_pfm.cxx config_pfm.h \ - pfmBba.cxx pfmBba.h - -#end bin_target - -//#begin bin_target -// #define TARGET pfm-wallpaper -// #define LOCAL_LIBS p3progbase -// -// #define SOURCES \ -// config_pfm.cxx config_pfm.h \ -// pfmWallpaper.cxx pfmWallpaper.h -// -//#end bin_target diff --git a/pandatool/src/progbase/Sources.pp b/pandatool/src/progbase/Sources.pp deleted file mode 100644 index 6d1ec85da2..0000000000 --- a/pandatool/src/progbase/Sources.pp +++ /dev/null @@ -1,45 +0,0 @@ -#define USE_PACKAGES zlib - -#begin ss_lib_target - #define TARGET p3progbase - #define LOCAL_LIBS \ - p3pandatoolbase - #define OTHER_LIBS \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - programBase.I programBase.h \ - withOutputFile.I withOutputFile.h \ - wordWrapStream.h wordWrapStreamBuf.I \ - wordWrapStreamBuf.h - - #define INCLUDED_SOURCES \ - programBase.cxx withOutputFile.cxx wordWrapStream.cxx \ - wordWrapStreamBuf.cxx - - #define INSTALL_HEADERS \ - programBase.I programBase.h \ - withOutputFile.I withOutputFile.h \ - wordWrapStream.h wordWrapStreamBuf.I \ - wordWrapStreamBuf.h - -#end ss_lib_target - -#begin test_bin_target - #define TARGET test_prog - #define LOCAL_LIBS \ - p3progbase - #define OTHER_LIBS p3pystub - - #define SOURCES \ - test_prog.cxx - -#end test_bin_target - diff --git a/pandatool/src/pstatserver/Sources.pp b/pandatool/src/pstatserver/Sources.pp deleted file mode 100644 index 74c352b48d..0000000000 --- a/pandatool/src/pstatserver/Sources.pp +++ /dev/null @@ -1,31 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_NET] - -#begin ss_lib_target - #define TARGET p3pstatserver - #define LOCAL_LIBS p3pandatoolbase - #define OTHER_LIBS \ - p3pstatclient:c p3downloader:c p3net:c p3putil:c p3pipeline:c \ - panda:m \ - p3pandabase:c p3express:c p3linmath:c pandaexpress:m \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m - - #define SOURCES \ - pStatClientData.cxx pStatClientData.h pStatGraph.I pStatGraph.cxx \ - pStatGraph.h pStatListener.cxx pStatListener.h pStatMonitor.I \ - pStatMonitor.cxx pStatMonitor.h pStatPianoRoll.I pStatPianoRoll.cxx \ - pStatPianoRoll.h pStatReader.cxx pStatReader.h pStatServer.cxx \ - pStatServer.h pStatStripChart.I pStatStripChart.cxx \ - pStatStripChart.h pStatThreadData.I pStatThreadData.cxx \ - pStatThreadData.h pStatView.I pStatView.cxx pStatView.h \ - pStatViewLevel.I pStatViewLevel.cxx pStatViewLevel.h - - #define INSTALL_HEADERS \ - pStatClientData.h pStatGraph.I pStatGraph.h pStatListener.h \ - pStatMonitor.I pStatMonitor.h pStatPianoRoll.I pStatPianoRoll.h \ - pStatReader.h pStatServer.h pStatStripChart.I pStatStripChart.h \ - pStatThreadData.I pStatThreadData.h pStatView.I pStatView.h \ - pStatViewLevel.I pStatViewLevel.h - -#end ss_lib_target - diff --git a/pandatool/src/ptloader/Sources.pp b/pandatool/src/ptloader/Sources.pp deleted file mode 100644 index 8a5abae7d2..0000000000 --- a/pandatool/src/ptloader/Sources.pp +++ /dev/null @@ -1,35 +0,0 @@ -#define USE_PACKAGES cg // from gobj. - -#begin lib_target - #define TARGET p3ptloader - #define BUILDING_DLL BUILDING_PTLOADER - #define LOCAL_LIBS \ - p3fltegg p3flt p3lwoegg p3lwo p3dxfegg p3dxf p3vrmlegg p3vrml p3xfileegg p3xfile \ - p3objegg \ - p3converter p3pandatoolbase $[if $[HAVE_FCOLLADA],p3daeegg] - #define OTHER_LIBS \ - p3egg2pg:c p3egg:c pandaegg:m \ - p3pstatclient:c p3mathutil:c p3linmath:c p3putil:c \ - p3gobj:c p3chan:c p3parametrics:c p3pgraph:c p3pgraphnodes:c \ - p3pnmimage:c p3grutil:c p3collide:c p3tform:c p3text:c \ - p3char:c p3dgraph:c p3display:c p3device:c p3cull:c \ - p3downloader:c p3pipeline:c \ - p3event:c p3gsgbase:c p3movies:c \ - $[if $[HAVE_FREETYPE],p3pnmtext:c] \ - $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[HAVE_AUDIO],p3audio:c] \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - config_ptloader.cxx config_ptloader.h \ - loaderFileTypePandatool.cxx loaderFileTypePandatool.h - - #define INSTALL_HEADERS \ - config_ptloader.h loaderFileTypePandatool.h - -#end lib_target diff --git a/pandatool/src/softegg/Sources.pp b/pandatool/src/softegg/Sources.pp deleted file mode 100644 index 56bbd8ee00..0000000000 --- a/pandatool/src/softegg/Sources.pp +++ /dev/null @@ -1,27 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_SOFTIMAGE] - -#begin lib_target - #define USE_PACKAGES softimage - #define TARGET p3softegg - #define LOCAL_LIBS \ - p3converter p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3linmath:c p3putil:c panda:m \ - p3express:c pandaexpress:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m - - #define BUILDING_DLL BUILDING_MISC - #define UNIX_SYS_LIBS \ - m - - #define SOURCES \ - config_softegg.cxx config_softegg.h \ - softEggGroupUserData.cxx softEggGroupUserData.I softEggGroupUserData.h \ - softToEggConverter.cxx softToEggConverter.h \ - soft2Egg.c \ - softNodeTree.cxx softNodeTree.h \ - softNodeDesc.cxx softNodeDesc.h - -#end lib_target - diff --git a/pandatool/src/softprogs/Sources.pp b/pandatool/src/softprogs/Sources.pp deleted file mode 100644 index 2933cae69d..0000000000 --- a/pandatool/src/softprogs/Sources.pp +++ /dev/null @@ -1,20 +0,0 @@ -#begin bin_target - #define TARGET softcvs - #define LOCAL_LIBS p3progbase - #define USE_PACKAGES openssl - - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - - #define SOURCES \ - softCVS.cxx softCVS.h softFilename.cxx softFilename.h - -#end bin_target diff --git a/pandatool/src/text-stats/Sources.pp b/pandatool/src/text-stats/Sources.pp deleted file mode 100644 index 623914c1fd..0000000000 --- a/pandatool/src/text-stats/Sources.pp +++ /dev/null @@ -1,22 +0,0 @@ -#define BUILD_DIRECTORY $[HAVE_NET] - -#begin bin_target - #define TARGET text-stats - #define LOCAL_LIBS \ - p3progbase p3pstatserver - #define OTHER_LIBS \ - p3pstatclient:c p3linmath:c p3putil:c p3pipeline:c p3event:c \ - p3pnmimage:c p3mathutil:c \ - p3downloader:c $[if $[HAVE_NET],p3net:c] $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m p3pystub - - #define SOURCES \ - textMonitor.cxx textMonitor.h textMonitor.I \ - textStats.cxx textStats.h - - #define INSTALL_HEADERS - -#end bin_target - diff --git a/pandatool/src/vrml/Sources.pp b/pandatool/src/vrml/Sources.pp deleted file mode 100644 index 4c8084a404..0000000000 --- a/pandatool/src/vrml/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -#define YACC_PREFIX vrmlyy - -#begin ss_lib_target - #define TARGET p3vrml - #define LOCAL_LIBS \ - p3pandatoolbase - #define OTHER_LIBS \ - p3mathutil:c p3linmath:c p3pipeline:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m - - #define USE_PACKAGES zlib - - #define SOURCES \ - parse_vrml.cxx parse_vrml.h \ - standard_nodes.cxx standard_nodes.h \ - vrmlLexer.lxx \ - vrmlParser.yxx \ - vrmlNode.cxx vrmlNode.h \ - vrmlNodeType.cxx vrmlNodeType.h - -#end ss_lib_target diff --git a/pandatool/src/vrmlegg/Sources.pp b/pandatool/src/vrmlegg/Sources.pp deleted file mode 100644 index 3be1e08eec..0000000000 --- a/pandatool/src/vrmlegg/Sources.pp +++ /dev/null @@ -1,23 +0,0 @@ -#begin ss_lib_target - #define TARGET p3vrmlegg - #define LOCAL_LIBS p3converter p3vrml p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3mathutil:c p3linmath:c p3event:c p3putil:c p3express:c \ - p3pipeline:c \ - panda:m \ - p3pandabase:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - - #define SOURCES \ - indexedFaceSet.cxx indexedFaceSet.h \ - vrmlAppearance.cxx vrmlAppearance.h \ - vrmlToEggConverter.cxx vrmlToEggConverter.h - - #define INSTALL_HEADERS \ - indexedFaceSet.h \ - vrmlAppearance.h \ - vrmlToEggConverter.h - -#end ss_lib_target diff --git a/pandatool/src/vrmlprogs/Sources.pp b/pandatool/src/vrmlprogs/Sources.pp deleted file mode 100644 index 0c521f21cd..0000000000 --- a/pandatool/src/vrmlprogs/Sources.pp +++ /dev/null @@ -1,29 +0,0 @@ -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET vrml2egg - #define LOCAL_LIBS p3vrml p3vrmlegg p3eggbase p3progbase - - #define SOURCES \ - vrmlToEgg.cxx vrmlToEgg.h - -#end bin_target - -#begin bin_target - #define TARGET vrml-trans - #define LOCAL_LIBS \ - p3progbase p3vrml - - #define SOURCES \ - vrmlTrans.cxx vrmlTrans.h - -#end bin_target diff --git a/pandatool/src/win-stats/Sources.pp b/pandatool/src/win-stats/Sources.pp deleted file mode 100644 index 51c6b47d5c..0000000000 --- a/pandatool/src/win-stats/Sources.pp +++ /dev/null @@ -1,33 +0,0 @@ -#define BUILD_DIRECTORY $[and $[WINDOWS_PLATFORM],$[HAVE_NET]] -#define USE_PACKAGES net - -#begin bin_target - #define TARGET pstats - #define LOCAL_LIBS \ - p3progbase p3pstatserver - #define OTHER_LIBS \ - p3pstatclient:c p3linmath:c p3putil:c p3net:c p3express:c pandaexpress:m panda:m \ - p3dtoolutil:c p3dtoolbase:c p3prc:c p3dconfig:c p3dtoolconfig:m p3dtool:m \ - p3pystub - - #define SOURCES \ - winStats.cxx \ - winStatsChartMenu.cxx winStatsChartMenu.h \ - winStatsGraph.cxx winStatsGraph.h \ - winStatsLabel.cxx winStatsLabel.h \ - winStatsLabelStack.cxx winStatsLabelStack.h \ - winStatsMenuId.h \ - winStatsMonitor.cxx winStatsMonitor.h winStatsMonitor.I \ - winStatsPianoRoll.cxx winStatsPianoRoll.h \ - winStatsServer.cxx winStatsServer.h \ - winStatsStripChart.cxx winStatsStripChart.h - - #if $[DEVELOP_WINSTATS] - #define EXTRA_CDEFS $[EXTRA_CDEFS] DEVELOP_WINSTATS - #endif - #define EXTRA_CDEFS $[EXTRA_CDEFS] WIN32_LEAN_AND_MEAN - - #define WIN_SYS_LIBS Imm32.lib winmm.lib kernel32.lib oldnames.lib user32.lib gdi32.lib - -#end bin_target - diff --git a/pandatool/src/xfile/Sources.pp b/pandatool/src/xfile/Sources.pp deleted file mode 100644 index b04fd10646..0000000000 --- a/pandatool/src/xfile/Sources.pp +++ /dev/null @@ -1,60 +0,0 @@ -#define YACC_PREFIX xyy -#define FLEXFLAGS -i - -#define USE_PACKAGES zlib - -#begin ss_lib_target - #define TARGET p3xfile - #define LOCAL_LIBS p3pandatoolbase - #define OTHER_LIBS \ - p3event:c p3putil:c p3pipeline:c p3mathutil:c p3linmath:c panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - - #define USE_PACKAGES zlib - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - config_xfile.h \ - standard_templates.h \ - windowsGuid.h \ - xFile.I xFile.h \ - xFileArrayDef.I xFileArrayDef.h \ - xFileDataDef.I xFileDataDef.h \ - xFileDataNode.I xFileDataNode.h \ - xFileDataNodeReference.I xFileDataNodeReference.h \ - xFileDataNodeTemplate.I xFileDataNodeTemplate.h \ - xFileDataObject.I xFileDataObject.h \ - xFileDataObjectArray.I xFileDataObjectArray.h \ - xFileDataObjectDouble.I xFileDataObjectDouble.h \ - xFileDataObjectInteger.I xFileDataObjectInteger.h \ - xFileDataObjectString.I xFileDataObjectString.h \ - xFileNode.I xFileNode.h \ - xFileParseData.I xFileParseData.h \ - xFileTemplate.I xFileTemplate.h \ - xLexer.lxx xLexerDefs.h \ - xParser.yxx xParserDefs.h - - #define INCLUDED_SOURCES \ - config_xfile.cxx \ - standard_templates.cxx \ - windowsGuid.cxx\ - xFile.cxx \ - xFileArrayDef.cxx \ - xFileDataDef.cxx \ - xFileDataNode.cxx \ - xFileDataNodeReference.cxx \ - xFileDataNodeTemplate.cxx \ - xFileDataObject.cxx \ - xFileDataObjectArray.cxx \ - xFileDataObjectDouble.cxx \ - xFileDataObjectInteger.cxx \ - xFileDataObjectString.cxx \ - xFileNode.cxx \ - xFileParseData.cxx \ - xFileTemplate.cxx - - -#end ss_lib_target diff --git a/pandatool/src/xfileegg/Sources.pp b/pandatool/src/xfileegg/Sources.pp deleted file mode 100644 index eac0549716..0000000000 --- a/pandatool/src/xfileegg/Sources.pp +++ /dev/null @@ -1,27 +0,0 @@ -#begin ss_lib_target - #define TARGET p3xfileegg - #define LOCAL_LIBS p3xfile p3eggbase p3progbase p3pandatoolbase - #define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3mathutil:c p3linmath:c p3putil:c p3pipeline:c p3event:c \ - p3pnmimage:c \ - panda:m \ - p3pandabase:c p3express:c pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m - - #define COMBINED_SOURCES $[TARGET]_composite1.cxx - - #define SOURCES \ - xFileAnimationSet.h xFileAnimationSet.I \ - xFileFace.h xFileMaker.h xFileMaterial.h \ - xFileMesh.h xFileNormal.h \ - xFileToEggConverter.h xFileVertex.h - - #define INCLUDED_SOURCES \ - xFileAnimationSet.cxx \ - xFileFace.cxx xFileMaker.cxx xFileMaterial.cxx \ - xFileMesh.cxx xFileNormal.cxx \ - xFileToEggConverter.cxx xFileVertex.cxx - -#end ss_lib_target diff --git a/pandatool/src/xfileprogs/Sources.pp b/pandatool/src/xfileprogs/Sources.pp deleted file mode 100644 index 1d2ec0e2ad..0000000000 --- a/pandatool/src/xfileprogs/Sources.pp +++ /dev/null @@ -1,38 +0,0 @@ -#define OTHER_LIBS \ - p3egg:c pandaegg:m \ - p3pipeline:c p3event:c p3pstatclient:c panda:m \ - p3pandabase:c p3pnmimage:c p3mathutil:c p3linmath:c p3putil:c p3express:c \ - pandaexpress:m \ - p3interrogatedb:c p3prc:c p3dconfig:c p3dtoolconfig:m \ - p3dtoolutil:c p3dtoolbase:c p3dtool:m \ - $[if $[WANT_NATIVE_NET],p3nativenet:c] \ - $[if $[and $[HAVE_NET],$[WANT_NATIVE_NET]],p3net:c p3downloader:c] \ - p3pystub - -#begin bin_target - #define TARGET egg2x - #define LOCAL_LIBS p3xfileegg p3xfile p3eggbase p3progbase p3pandatoolbase - - #define SOURCES \ - eggToX.cxx eggToX.h - -#end bin_target - -#begin bin_target - #define TARGET x2egg - #define LOCAL_LIBS p3xfileegg p3xfile p3converter p3eggbase p3progbase p3pandatoolbase - - #define SOURCES \ - xFileToEgg.cxx xFileToEgg.h - -#end bin_target - -#begin bin_target - #define TARGET x-trans - #define LOCAL_LIBS \ - p3progbase p3xfile - - #define SOURCES \ - xFileTrans.cxx xFileTrans.h - -#end bin_target diff --git a/ppremake/.gitignore b/ppremake/.gitignore deleted file mode 100644 index 9b7d9572e7..0000000000 --- a/ppremake/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/.deps/ -/Debug/ -/Makefile.in -/aclocal.m4 -/autom4te.cache/ -/config.h -/config.h.in -/config.log -/config.status -/configure -/ipch/ -/ppremake -/stamp-h1 -Makefile diff --git a/ppremake/BUILD_FROM_CVS.txt b/ppremake/BUILD_FROM_CVS.txt deleted file mode 100644 index df917ba0d0..0000000000 --- a/ppremake/BUILD_FROM_CVS.txt +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// Caution: there are two separate, independent build systems: -// 'makepanda', and 'ppremake'. Use one or the other, do not attempt -// to use both. This file is part of the 'ppremake' system. -/////////////////////////////////////////////////////////////////////// - -To build ppremake on Unix (or Windows Cygwin) using autoconf, follow -the following steps. - -If you are on Windows, note that you may build ppremake either using -or without using Cygwin. This document describes how to build it with -Cygwin; if you want to build it without Cygwin just use the provided -VC7 project file. However, if you intend to use Cygwin to build and -install the rest of Panda (see the top-level INSTALL document for -Panda), you must also use Cygwin to build ppremake, since otherwise -ppremake will not be able to correctly decode Cygwin-style pathnames -into Windows-style pathnames. In general, if you have Cygwin -installed, you should follow these steps to build ppremake; you should -use the VC7 project files only if you don't have Cygwin and you have -no intention of getting it. - -(1) If the file "configure" exists, skip to step (4), below. This is - the normal case; you must have unpacked an archive file that - includes the normal autoconf files already generated for you. You - can now successfully build the tree without having autoconf - installed on your own machine. - - Otherwise, you must have checked this tree directly out from CVS. - Since the autoconf-generated files are not part of the source - tree, you must now generate them. - - (2) Install autoconf and/or automake, if they are not already - installed. If you are building on a Linux machine, you probably - already have these installed. If you are running on Cygwin, you - may need to re-run the Cygwin install program and explicitly - check the "autoconf" option in order to install these scripts. - Also, if you are on Cygwin, you will need to ensure that gcc is - installed. - - (3) Run the following commands within the ppremake directory, in - order: - - aclocal - autoheader - automake --foreign -a - autoconf - -(4) Now you have a tree that has been processed with autoconf, and you - are ready to run the resulting configure script. Type the - following command within the ppremake directory: - - ./configure - - This will examine the machine's environment for header files, - etc., and set up the Makefile to build ppremake appropriately. - The default path to copy the installed binary is within - /usr/local/panda; if you wish to install it somewhere else, for - instance /my/install/dir, use: - - ./configure --prefix=/my/install/dir - - Note that this is a Cygwin-style path, with forward slashes and no - drive letter; not a Windows-style path. - -(5) Type the following to build and install ppremake: - - make - make install diff --git a/ppremake/Makefile.am b/ppremake/Makefile.am deleted file mode 100644 index c993aed84d..0000000000 --- a/ppremake/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -bin_PROGRAMS = ppremake - -ppremake_SOURCES = \ - check_include.cxx check_include.h \ - dSearchPath.I dSearchPath.cxx dSearchPath.h \ - executionEnvironment.cxx executionEnvironment.h \ - filename.I filename.cxx filename.h \ - globPattern.I globPattern.cxx globPattern.h \ - gnu_getopt.c gnu_getopt.h gnu_regex.c gnu_regex.h \ - md5.c md5.h \ - ppCommandFile.cxx ppCommandFile.h ppDependableFile.cxx \ - ppDependableFile.h ppDirectory.cxx \ - ppDirectory.h ppDirectoryTree.cxx ppDirectoryTree.h \ - ppMain.cxx ppMain.h \ - ppFilenamePattern.cxx \ - ppFilenamePattern.h ppNamedScopes.cxx ppNamedScopes.h \ - ppScope.cxx ppScope.h ppSubroutine.cxx ppSubroutine.h \ - ppremake.cxx ppremake.h sedAddress.cxx sedAddress.h sedCommand.cxx \ - sedCommand.h sedContext.cxx sedContext.h sedProcess.cxx \ - sedProcess.h sedScript.cxx sedScript.h tokenize.cxx \ - tokenize.h vector_string.h - -# Extra files for VC++ project description -EXTRA_DIST = \ - ppremake.sln ppremake.vcproj ppremake.vsdir ppremake.vsz \ No newline at end of file diff --git a/ppremake/acinclude.m4 b/ppremake/acinclude.m4 deleted file mode 100644 index 7817888700..0000000000 --- a/ppremake/acinclude.m4 +++ /dev/null @@ -1,432 +0,0 @@ -AC_DEFUN(AC_HEADER_IOSTREAM, -[AC_CHECK_HEADERS(iostream,[have_iostream=yes],[have_iostream=no])]) - -AC_DEFUN(AC_HEADER_SSTREAM, -[AC_CHECK_HEADERS(sstream,[have_sstream=yes],[have_sstream=no])]) - -AC_DEFUN(AC_IOS_BINARY, -[AC_CACHE_CHECK([for ios::binary], - ac_cv_ios_binary, -[ -if test $have_iostream = yes; then - AC_TRY_COMPILE([ -#include - ],[ - int x; x = std::ios::binary; - ], ac_cv_ios_binary=yes, ac_cv_ios_binary=no) -else - AC_TRY_COMPILE([ -#include - ],[ - int x; x = ios::binary; - ], ac_cv_ios_binary=yes, ac_cv_ios_binary=no) -fi - -]) -if test $ac_cv_ios_binary = yes; then - AC_DEFINE(HAVE_IOS_BINARY, 1, [Define if the C++ iostream library supports ios::binary.]) -fi -]) - -AC_DEFUN(AC_OPEN_MASK, -[AC_CACHE_CHECK([for third umask parameter to open], - ac_cv_open_mask, -[ -if test $have_iostream = yes; then - AC_TRY_COMPILE([ -#include - ],[ - std::ofstream x; x.open("foo", std::ios::out, 0666); - ], ac_cv_open_mask=yes, ac_cv_open_mask=no) -else - AC_TRY_COMPILE([ -#include - ],[ - ofstream x; x.open("foo", ios::out, 0666); - ], ac_cv_open_mask=yes, ac_cv_open_mask=no) -fi - -]) -if test $ac_cv_open_mask = yes; then - AC_DEFINE(HAVE_OPEN_MASK, 1, [Define if fstream::open() accepts a third parameter for umask.]) -fi -]) - - -AC_DEFUN(AC_NAMESPACE, -[AC_CACHE_CHECK([for compiler namespace support], - ac_cv_namespace, -[AC_TRY_COMPILE( -[namespace std { }; -using namespace std;], -[], - ac_cv_namespace=yes, ac_cv_namespace=no)]) -if test $ac_cv_namespace = yes; then - AC_DEFINE(HAVE_NAMESPACE, 1, [Define if the C++ compiler uses namespaces]) -fi -]) - - -dnl A handy function to see if a library is in a particular directory. -dnl AC_CHECK_LIB_LOC(directory, library, function, action-if-found, action-if-not-found, other-libraries) -dnl -AC_DEFUN(AC_CHECK_LIB_LOC, -[AC_MSG_CHECKING([for lib$2 in $1]) -ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` -AC_CACHE_VAL(ac_cv_lib_loc_$ac_lib_var, -[ac_save_LIBS="$LIBS" -LIBS="-L$1 -l$2 $6 $LIBS" -AC_TRY_LINK(dnl -ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" -#endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $3(); -], - [$3()], - eval "ac_cv_lib_loc_$ac_lib_var=yes", - eval "ac_cv_lib_loc_$ac_lib_var=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test \"`echo '$ac_cv_lib_loc_'$ac_lib_var`\" = yes"; then - AC_MSG_RESULT(yes) - ifelse([$4], , -[LIBS="-L$1 -l$2 $LIBS" -], [$4]) -else - AC_MSG_RESULT(no) -ifelse([$5], , , [$5 -])dnl -fi -]) - -dnl A handy function to search a number of possible locations for a library. -dnl AC_SEARCH_LIB(search-dirs, library, function, package, other-libraries) -dnl -dnl Sets $package_LIB to the directory containing the library, or to the -dnl empty string if the library cannot be found. -AC_DEFUN(AC_SEARCH_LIB, [ -ac_found_lib="" -for ac_check_dir in $1; do - if test "$ac_found_lib" = ""; then - AC_CHECK_LIB_LOC($ac_check_dir, $2, $3, [ ac_found_lib="$ac_check_dir"; ],, $5) - fi -done -$4_LIB="$ac_found_lib" -]) - -dnl A handy function to see if a header file is in a particular directory. -dnl AC_CHECK_HEADER_LOC(directory, header, action-if-found, action-if-not-found) -dnl -AC_DEFUN(AC_CHECK_HEADER_LOC, [ - AC_MSG_CHECKING([for $2 in $1]) - ac_include_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` - AC_CACHE_VAL(ac_cv_include_loc_$ac_include_var, [ - ac_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-I$1 $CPPFLAGS" - AC_TRY_CPP([#include <$2>], ac_ch_found_it="yes", ac_ch_found_it="no") - if test "$ac_ch_found_it" = "yes"; then - AC_MSG_RESULT(yes) - ifelse([$3], , :, [$3]) - else - AC_MSG_RESULT(no) - ifelse([$4], , , [$4]) - fi - CPPFLAGS="$ac_save_CPPFLAGS" - ]) -]) - - -dnl A handy function to search a number of possible locations for a header -dnl file. -dnl -dnl AC_SEARCH_HEADER(search-dirs, header, package) -dnl -dnl Sets $package_INCLUDE to the directory containing the header, or to -dnl the empty string if the header cannot be found. -AC_DEFUN(AC_SEARCH_HEADER, [ -ac_found_header="" -for ac_check_dir in $1; do - if test "$ac_found_header" = ""; then - AC_CHECK_HEADER_LOC($ac_check_dir, $2, [ ac_found_header="$ac_check_dir";]) - fi -done -$3_INCLUDE="$ac_found_header" -]) - - -dnl A handy function to scan for a third-party package, consisting of at -dnl least a library and an include file. A few assumptions are made about -dnl the relationships between lib and include directories. -dnl -dnl AC_SEARCH_PACKAGE(search-dirs, package-names, header, library, function, package, other-libraries) -dnl -dnl search-dirs is the whitespace-separated list of directory prefixes to -dnl check. -dnl package-names is a whitespace-separated list of possible names the -dnl package may have been installed under. -dnl -dnl For each combination of ${search-dir} and ${package-name}, the following -dnl directories are searched: -dnl -dnl ${search-dir} -dnl ${search-dir}/lib -dnl ${search-dir}/${package-name} -dnl ${search-dir}/${package-name}/lib -dnl ${search-dir}/lib/${package-name} -dnl -dnl And similarly for include. -dnl -dnl Sets the variables $package_INCLUDE and $package_LIB to the directories -dnl containing the header file and library, respectively. If both pieces -dnl are located, also sets the variable $package_PKG to "yes"; otherwise, -dnl sets the variable $package_PKG to "no". -dnl -AC_DEFUN(AC_SEARCH_PACKAGE, [ -$6_LIB="" -$6_INCLUDE="" -$6_PKG="no" - -dnl Look for the library. -for ac_sp_dir in $1; do - if test "[$]$6_LIB" = ""; then - AC_SEARCH_LIB("$ac_sp_dir" "$ac_sp_dir/lib", $4, $5, $6, $7) - for ac_sp_pkg in $2; do - if test "[$]$6_LIB" = ""; then - AC_SEARCH_LIB("$ac_sp_dir/$ac_sp_pkg" "$ac_sp_dir/$ac_sp_pkg/lib" \ - "$ac_sp_dir/lib/$ac_sp_pkg", $4, $5, $6, $7) - fi - done - fi -done - -dnl Now look for the header file. Don't bother looking if the library -dnl wasn't found. -if test "[$]$6_LIB" != ""; then - dnl First look in the obvious directory corresponding to the lib dir. - ac_sp_testinc=`echo [$]$6_LIB | sed 's:/lib:/include:'` - AC_SEARCH_HEADER("$ac_sp_testinc", $3, $6) - - dnl If it wasn't found there, cast about. - if test "[$]$6_INCLUDE" = ""; then - for ac_sp_dir in $1; do - if test "[$]$6_INCLUDE" = ""; then - AC_SEARCH_HEADER("$ac_sp_dir" "$ac_sp_dir/include", $3, $6) - for ac_sp_pkg in $2; do - if test "[$]$6_INCLUDE" = ""; then - AC_SEARCH_HEADER("$ac_sp_dir/$ac_sp_pkg" \ - "$ac_sp_dir/$ac_sp_pkg/include" \ - "$ac_sp_dir/include/$ac_sp_pkg", $3, $6) - fi - done - fi - done - fi - - dnl If we got both a header and a library, set the PKG variable. - if test "[$]$6_INCLUDE" != ""; then - $6_PKG="yes" - fi -fi -]) - - - - -# Configure paths for GTK-- -# Erik Andersen 30 May 1998 -# Modified by Tero Pulkkinen (added the compiler checks... I hope they work..) - -dnl Test for GTKMM, and define GTKMM_CFLAGS and GTKMM_LIBS -dnl to be used as follows: -dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl -AC_DEFUN(AM_PATH_GTKMM, -[dnl -dnl Get the cflags and libraries from the gtkmm-config script -dnl -AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX - Prefix where GTK-- is installed (optional)], - gtkmm_config_prefix="$withval", gtkmm_config_prefix="") -AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX - Exec prefix where GTK-- is installed (optional)], - gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="") -AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program], - , enable_gtkmmtest=yes) - - if test x$gtkmm_config_exec_prefix != x ; then - gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix" - if test x${GTKMM_CONFIG+set} != xset ; then - GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config - fi - fi - if test x$gtkmm_config_prefix != x ; then - gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix" - if test x${GTKMM_CONFIG+set} != xset ; then - GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config - fi - fi - - AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no) - min_gtkmm_version=ifelse([$1], ,0.10.0,$1) - - AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version) - no_gtkmm="" - if test "$GTKMM_CONFIG" = "no" ; then - no_gtkmm=yes - else - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - - GTKMM_CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags` - GTKMM_LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs` - gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_gtkmmtest" = "xyes" ; then - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" - LIBS="$LIBS $GTKMM_LIBS" -dnl -dnl Now check if the installed GTK-- is sufficiently new. (Also sanity -dnl checks the results of gtkmm-config to some extent -dnl - rm -f conf.gtkmmtest - AC_TRY_RUN([ -#include -#include -#include - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.gtkmmtest"); - - /* HP/UX 0 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_gtkmm_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_gtkmm_version"); - exit(1); - } - - if ((gtkmm_major_version != $gtkmm_config_major_version) || - (gtkmm_minor_version != $gtkmm_config_minor_version) || - (gtkmm_micro_version != $gtkmm_config_micro_version)) - { - printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", - $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version, - gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); - printf ("*** was found! If gtkmm-config was correct, then it is best\n"); - printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n"); - printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); - } -/* GTK-- does not have the GTKMM_*_VERSION constants */ -/* - else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) || - (gtkmm_minor_version != GTKMM_MINOR_VERSION) || - (gtkmm_micro_version != GTKMM_MICRO_VERSION)) - { - printf("*** GTK-- header files (version %d.%d.%d) do not match\n", - GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); - } -*/ - else - { - if ((gtkmm_major_version > major) || - ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) || - ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n", - gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); - printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n"); - printf("*** correct copy of gtkmm-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_gtkmm" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$GTKMM_CONFIG" = "no" ; then - echo "*** The gtkmm-config script installed by GTK-- could not be found" - echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GTKMM_CONFIG environment variable to the" - echo "*** full path to gtkmm-config." - echo "*** The gtkmm-config script was not available in GTK-- versions" - echo "*** prior to 0.9.12. Perhaps you need to update your installed" - echo "*** version to 0.9.12 or later" - else - if test -f conf.gtkmmtest ; then - : - else - echo "*** Could not run GTK-- test program, checking why..." - CXXFLAGS="$CFLAGS $GTKMM_CXXFLAGS" - LIBS="$LIBS $GTKMM_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GTK-- or finding the wrong" - echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GTK-- was incorrectly installed" - echo "*** or that you have moved GTK-- since it was installed. In the latter case, you" - echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ]) - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GTKMM_CFLAGS="" - GTKMM_LIBS="" - ifelse([$3], , :, [$3]) - AC_LANG_RESTORE - fi - AC_SUBST(GTKMM_CFLAGS) - AC_SUBST(GTKMM_LIBS) - rm -f conf.gtkmmtest -]) - - diff --git a/ppremake/check_include.cxx b/ppremake/check_include.cxx deleted file mode 100644 index 6493ab467e..0000000000 --- a/ppremake/check_include.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: check_include.cxx -// Created by: drose (16Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "check_include.h" - -//////////////////////////////////////////////////////////////////// -// Function: check_include -// Description: Checks to see if the given line is a C/C++ #include -// directive. If it is, returns the named filename; -// otherwise, returns the empty string. -//////////////////////////////////////////////////////////////////// -string -check_include(const string &line) { - // Skip initial whitespace on the line. - size_t p = 0; - while (p < line.length() && isspace(line[p])) { - p++; - } - - if (p >= line.length() || line[p] != '#') { - // No hash mark. - return string(); - } - - // We have a hash mark! Skip more whitespace. - p++; - while (p < line.length() && isspace(line[p])) { - p++; - } - - if (p >= line.length() || !(line.substr(p, 7) == "include")) { - // Some other directive, not #include. - return string(); - } - - // It's an #include directive! Skip more whitespace. - p += 7; - while (p < line.length() && isspace(line[p])) { - p++; - } - - // note: ppremake cant expand cpp #define vars used as include targets yet - - if (p >= line.length() || (line[p] != '"' && line[p] != '<')) { - // if it starts with a capital, assume its a #define var used as - // include tgt, and don't print a warning - if(!((line[p]>='A')&&(line[p]<='Z'))) { - cerr << "Ignoring invalid #include directive: " << line << "\n"; - } - return string(); - } - - char close = (line[p] == '"') ? '"' : '>'; - - p++; - // Now get the filename. - size_t q = p; - while (q < line.length() && line[q] != close) { - q++; - } - - if (q >= line.length()) { - cerr << "Ignoring invalid #include directive: " << line << "\n"; - return string(); - } - - return line.substr(p, q - p); -} diff --git a/ppremake/check_include.h b/ppremake/check_include.h deleted file mode 100644 index ce80942624..0000000000 --- a/ppremake/check_include.h +++ /dev/null @@ -1,14 +0,0 @@ -// Filename: check_include.h -// Created by: drose (16Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef CHECK_INCLUDE_H -#define CHECK_INCLUDE_H - -#include "ppremake.h" - -string check_include(const string &line); - -#endif - diff --git a/ppremake/config_msvc.h b/ppremake/config_msvc.h deleted file mode 100644 index 3cdb82b7f8..0000000000 --- a/ppremake/config_msvc.h +++ /dev/null @@ -1,93 +0,0 @@ -/* config_msvc.h. - - This file was generated by hand for use on Win32 environments when - building with Microsoft Visual Studio. It will have to be kept - up-to-date by hand with the automatically-generated config.h on - other platforms. -*/ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if the C++ compiler uses namespaces. */ -#define HAVE_NAMESPACE 1 - -/* Define if the C++ iostream library supports ios::binary. */ -#define HAVE_IOS_BINARY 1 - -/* Define if fstream::open() accepts a third parameter for umask. */ -/* #undef HAVE_OPEN_MASK */ - -/* Define if we're compiling with Cygwin. */ -/* #undef HAVE_CYGWIN */ - -/* Define if we're compiling for OSX. */ -/* #undef HAVE_OSX */ - -/* Define if we're compiling using Windows Microsoft Visual C++. */ -#define WIN32_VC 1 - -/* The platform ppremake is compiled for. This primarily controls the - initial setting of the $[PLATFORM] variable. */ -#define PLATFORM "Win32" - -/* Define if you have the `getopt' function. */ -/* #undef HAVE_GETOPT */ - -/* Define if you have the header file. */ -/* #undef HAVE_ALLOCA_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_DIRENT_H */ - -/* Define if you have the header file. */ -#define HAVE_IO_H 1 - -/* Define if you have the header file. */ -#define HAVE_IOSTREAM 1 - -/* Define if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_MINMAX_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_REGEX_H */ - -/* Define if you have the header file. */ -#define HAVE_SSTREAM 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_TIME_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_TYPES_H 1 */ - -/* Define if you have the header file. */ -#define HAVE_SYS_UTIME_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_WAIT_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_UNISTD_H 1 */ - -/* Define if you have the header file. */ -/* #undef HAVE_UTIME_H 1 */ - -/* Name of package */ -#define PACKAGE "ppremake" - -/* The default value of INSTALL_DIR within ppremake. */ -#define INSTALL_DIR "C:/Panda3d" - -/**************** UPDATE VERSION NUMBER HERE **************** - ** Also be sure to change the version number ** - ** at the beginning of configure.in. ** - **************** ****************/ -#define VERSION "1.22" -/**************** UPDATE VERSION NUMBER HERE ****************/ diff --git a/ppremake/configure.in b/ppremake/configure.in deleted file mode 100644 index af2d4618b3..0000000000 --- a/ppremake/configure.in +++ /dev/null @@ -1,94 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(ppremake.cxx) - -dnl **************** UPDATE VERSION NUMBER HERE **************** -dnl ** Also be sure to change the version number ** -dnl ** at the end of config_msvc.h. ** -dnl **************** **************** -AM_INIT_AUTOMAKE(ppremake, 1.22) -dnl **************** UPDATE VERSION NUMBER HERE **************** - -AM_CONFIG_HEADER(config.h) - -AC_PREFIX_DEFAULT(/usr/local/panda) -AC_PROG_MAKE_SET -AC_CANONICAL_HOST - - -# If we have a CFLAGS variable but not a CXXFLAGS variable, let them -# be the same. -if test "${CXXFLAGS+set}" != set -a "${CFLAGS+set}" = set; then - CXXFLAGS=$CFLAGS -fi -CPPFLAGS="${CPPFLAGS} -DINSTALL_DIR='\""'$(prefix)'"\"'" - -# Save these variables for later, so we can easily append to them or -# change them. -user_ldflags=${LDFLAGS-} -user_cflags=${CFLAGS-} -user_cxxflags=${CXXFLAGS-} - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CXX - -dnl First, we'll test for C-specific features. -AC_LANG_C - -dnl Checks for libraries. -libdl= -libm= -AC_CHECK_LIB(m, sin, libm=-lm) -AC_SUBST(libm) - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(malloc.h alloca.h unistd.h utime.h io.h minmax.h dirent.h glob.h sys/types.h sys/time.h sys/utime.h sys/wait.h string.h regex.h getopt.h) - -dnl Checks for typedefs, structures, and compiler characteristics. - -dnl Checks for library functions. -AC_CHECK_FUNCS(getopt) - - -dnl Now we can test some C++-specific features. -AC_LANG_CPLUSPLUS -AC_HEADER_IOSTREAM -AC_HEADER_SSTREAM -AC_NAMESPACE -AC_IOS_BINARY -AC_OPEN_MASK - - -AC_LANG_C - -AC_ARG_WITH(platform, -[ --with-platform=platform Set the $[PLATFORM] predefined variable.]) - -if test "${with_platform-no}" != "no"; then - PLATFORM=$with_platform -else - case "$host_os" in - irix*) PLATFORM=Irix;; - linux*) PLATFORM=Linux;; - cygwin*) PLATFORM=Cygwin;; - darwin*) PLATFORM=OSX;; - freebsd*) PLATFORM=FreeBSD;; - *) echo "Cannot determine platform from $host_os; use --with-platform=name." - exit 1;; - esac -fi - -if test "$PLATFORM" = "Cygwin"; then - AC_DEFINE(HAVE_CYGWIN, 1, [Define if we're compiling with Cygwin.]) -fi - -if test "$PLATFORM" = "OSX"; then - AC_DEFINE(HAVE_OSX, 1, [Define if we're compiling for OSX.]) -fi - -AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM", - [The platform ppremake is compiled for. This primarily controls the - initial setting of the PLATFORM ppremake variable.]) - -AC_OUTPUT(Makefile) diff --git a/ppremake/dSearchPath.I b/ppremake/dSearchPath.I deleted file mode 100644 index 6829fa0f64..0000000000 --- a/ppremake/dSearchPath.I +++ /dev/null @@ -1,30 +0,0 @@ -// Filename: dSearchPath.I -// Created by: drose (01Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::search_path -// Access: Public, Static -// Description: A quick-and-easy way to search a searchpath for a -// file when you don't feel like building or keeping -// around a DSearchPath object. This simply -// constructs a temporary DSearchPath based on the -// indicated path string, and searches that. -//////////////////////////////////////////////////////////////////// -INLINE Filename DSearchPath:: -search_path(const Filename &filename, const string &path, - const string &delimiters) { - DSearchPath search(path, delimiters); - return search.find_file(filename); -} diff --git a/ppremake/dSearchPath.cxx b/ppremake/dSearchPath.cxx deleted file mode 100644 index c8627cda72..0000000000 --- a/ppremake/dSearchPath.cxx +++ /dev/null @@ -1,368 +0,0 @@ -// Filename: dSearchPath.cxx -// Created by: drose (01Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "dSearchPath.h" -#include "filename.h" - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -DSearchPath::Results:: -Results() { -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -DSearchPath::Results:: -Results(const DSearchPath::Results ©) : - _files(copy._files) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void DSearchPath::Results:: -operator = (const DSearchPath::Results ©) { - _files = copy._files; -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -DSearchPath::Results:: -~Results() { -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::clear -// Access: Public -// Description: Removes all the files from the list. -//////////////////////////////////////////////////////////////////// -void DSearchPath::Results:: -clear() { - _files.clear(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::get_num_files -// Access: Public -// Description: Returns the number of files on the result list. -//////////////////////////////////////////////////////////////////// -int DSearchPath::Results:: -get_num_files() const { - return _files.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::get_file -// Access: Public -// Description: Returns the nth file on the result list. -//////////////////////////////////////////////////////////////////// -const Filename &DSearchPath::Results:: -get_file(int n) const { - assert(n >= 0 && n < (int)_files.size()); - return _files[n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Results::add_file -// Access: Public -// Description: Adds a new file to the result list. -//////////////////////////////////////////////////////////////////// -void DSearchPath::Results:: -add_file(const Filename &file) { - _files.push_back(file); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Default Constructor -// Access: Public -// Description: Creates an empty search path. -//////////////////////////////////////////////////////////////////// -DSearchPath:: -DSearchPath() { -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -DSearchPath:: -DSearchPath(const string &path, const string &delimiters) { - append_path(path, delimiters); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -DSearchPath:: -DSearchPath(const DSearchPath ©) : - _directories(copy._directories) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -operator = (const DSearchPath ©) { - _directories = copy._directories; -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -DSearchPath:: -~DSearchPath() { -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::clear -// Access: Public -// Description: Removes all the directories from the search list. -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -clear() { - _directories.clear(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::append_directory -// Access: Public -// Description: Adds a new directory to the end of the search list. -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -append_directory(const Filename &directory) { - _directories.push_back(directory); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::prepend_directory -// Access: Public -// Description: Adds a new directory to the front of the search list. -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -prepend_directory(const Filename &directory) { - _directories.insert(_directories.begin(), directory); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::append_path -// Access: Public -// Description: Adds all of the directories listed in the search path -// to the end of the search list. -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -append_path(const string &path, const string &delimiters) { - size_t p = 0; - while (p < path.length()) { - size_t q = path.find_first_of(delimiters, p); - if (q == string::npos) { - _directories.push_back(path.substr(p)); - return; - } - if (q != p) { - _directories.push_back(path.substr(p, q - p)); - } - p = q + 1; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::append_path -// Access: Public -// Description: Adds all of the directories listed in the search path -// to the end of the search list. -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -append_path(const DSearchPath &path) { - copy(path._directories.begin(), path._directories.end(), - back_inserter(_directories)); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::prepend_path -// Access: Public -// Description: Adds all of the directories listed in the search path -// to the beginning of the search list. -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -prepend_path(const DSearchPath &path) { - if (!path._directories.empty()) { - Directories new_directories = path._directories; - copy(_directories.begin(), _directories.end(), - back_inserter(new_directories)); - _directories.swap(new_directories); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::is_empty -// Access: Public -// Description: Returns true if the search list is empty, false -// otherwise. -//////////////////////////////////////////////////////////////////// -bool DSearchPath:: -is_empty() const { - return _directories.empty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::get_num_directories -// Access: Public -// Description: Returns the number of directories on the search list. -//////////////////////////////////////////////////////////////////// -int DSearchPath:: -get_num_directories() const { - return _directories.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::get_directory -// Access: Public -// Description: Returns the nth directory on the search list. -//////////////////////////////////////////////////////////////////// -const Filename &DSearchPath:: -get_directory(int n) const { - assert(n >= 0 && n < (int)_directories.size()); - return _directories[n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::find_file -// Access: Public -// Description: Searches all the directories in the search list for -// the indicated file, in order. Returns the full -// matching pathname of the first match if found, or the -// empty string if not found. -//////////////////////////////////////////////////////////////////// -Filename DSearchPath:: -find_file(const Filename &filename) const { - if (filename.is_local()) { - Directories::const_iterator di; - for (di = _directories.begin(); di != _directories.end(); ++di) { - Filename match((*di), filename); - if (match.exists()) { - if ((*di) == "." && filename.is_fully_qualified()) { - // A special case for the "." directory: to avoid prefixing - // an endless stream of ./ in front of files, if the - // filename already has a ./ prefixed - // (i.e. is_fully_qualified() is true), we don't - // prefix another one. - return filename; - } else { - return match; - } - } - } - } - - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::find_all_files -// Access: Public -// Description: Searches all the directories in the search list for -// the indicated file, in order. Fills up the results -// list with *all* of the matching filenames found, if -// any. Returns the number of matches found. -// -// It is the responsibility of the the caller to clear -// the results list first; otherwise, the newly-found -// files will be appended to the list. -//////////////////////////////////////////////////////////////////// -int DSearchPath:: -find_all_files(const Filename &filename, - DSearchPath::Results &results) const { - int num_added = 0; - - if (filename.is_local()) { - Directories::const_iterator di; - for (di = _directories.begin(); di != _directories.end(); ++di) { - Filename match((*di), filename); - if (match.exists()) { - if ((*di) == "." && filename.is_fully_qualified()) { - // A special case for the "." directory: to avoid prefixing - // an endless stream of ./ in front of files, if the - // filename already has a ./ prefixed - // (i.e. is_fully_qualified() is true), we don't - // prefix another one. - results.add_file(filename); - } else { - results.add_file(match); - } - num_added++; - } - } - } - - return num_added; -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::output -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -output(ostream &out, const string &separator) const { - if (!_directories.empty()) { - Directories::const_iterator di = _directories.begin(); - out << (*di); - ++di; - while (di != _directories.end()) { - out << separator << (*di); - ++di; - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: DSearchPath::write -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void DSearchPath:: -write(ostream &out, int indent_level) const { - Directories::const_iterator di; - for (di = _directories.begin(); di != _directories.end(); ++di) { - for (int i = 0; i < indent_level; i++) { - out << ' '; - } - out << (*di) << "\n"; - } -} - - diff --git a/ppremake/dSearchPath.h b/ppremake/dSearchPath.h deleted file mode 100644 index d63fa446e4..0000000000 --- a/ppremake/dSearchPath.h +++ /dev/null @@ -1,94 +0,0 @@ -// Filename: dSearchPath.h -// Created by: drose (01Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef PANDASEARCHPATH_H -#define PANDASEARCHPATH_H - -#include "ppremake.h" - -#include "filename.h" -#include - -/////////////////////////////////////////////////////////////////// -// Class : DSearchPath -// Description : This class stores a list of directories that can be -// searched, in order, to locate a particular file. It -// is normally constructed by passing it a traditional -// searchpath-style string, e.g. a list of directory -// names delimited by spaces or colons, but it can also -// be built up explicitly. -//////////////////////////////////////////////////////////////////// -class EXPCL_DTOOL DSearchPath { -public: - class EXPCL_DTOOL Results { - PUBLISHED: - Results(); - Results(const Results ©); - void operator = (const Results ©); - ~Results(); - - void clear(); - int get_num_files() const; - const Filename &get_file(int n) const; - - public: - void add_file(const Filename &file); - - private: - typedef vector Files; - Files _files; - }; - -PUBLISHED: - DSearchPath(); - DSearchPath(const string &path, const string &delimiters = ": \n\t"); - DSearchPath(const DSearchPath ©); - void operator = (const DSearchPath ©); - ~DSearchPath(); - - void clear(); - void append_directory(const Filename &directory); - void prepend_directory(const Filename &directory); - void append_path(const string &path, - const string &delimiters = ": \n\t"); - void append_path(const DSearchPath &path); - void prepend_path(const DSearchPath &path); - - bool is_empty() const; - int get_num_directories() const; - const Filename &get_directory(int n) const; - - Filename find_file(const Filename &filename) const; - int find_all_files(const Filename &filename, Results &results) const; - - INLINE static Filename - search_path(const Filename &filename, const string &path, - const string &delimiters = ": \n\t"); - - void output(ostream &out, const string &separator = ":") const; - void write(ostream &out, int indent_level = 0) const; - -private: - typedef vector Directories; - Directories _directories; -}; - -INLINE ostream &operator << (ostream &out, const DSearchPath &sp) { - sp.output(out); - return out; -} - -#include "dSearchPath.I" - -#endif diff --git a/ppremake/executionEnvironment.cxx b/ppremake/executionEnvironment.cxx deleted file mode 100644 index bbe01d6be4..0000000000 --- a/ppremake/executionEnvironment.cxx +++ /dev/null @@ -1,133 +0,0 @@ -// Filename: executionEnvironment.cxx -// Created by: drose (15May00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "executionEnvironment.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include // for perror - -#ifdef WIN32_VC -// Windows requires this for getcwd(). -#include -#define getcwd _getcwd -#endif - -//////////////////////////////////////////////////////////////////// -// Function: ExecutionEnvironment::get_environment_variable -// Access: Public, Static -// Description: Returns the definition of the indicated environment -// variable, or the empty string if the variable is -// undefined. The nonstatic implementation. -//////////////////////////////////////////////////////////////////// -string ExecutionEnvironment:: -get_environment_variable(const string &var) { - const char *def = getenv(var.c_str()); - if (def != (char *)NULL) { - return def; - } - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ExecutionEnviroment::expand_string -// Access: Public, Static -// Description: Reads the string, looking for environment variable -// names marked by a $. Expands all such variable -// names. A repeated dollar sign ($$) is mapped to a -// single dollar sign. -// -// Returns the expanded string. -//////////////////////////////////////////////////////////////////// -string ExecutionEnvironment:: -expand_string(const string &str) { - string result; - - size_t last = 0; - size_t dollar = str.find('$'); - while (dollar != string::npos && dollar + 1 < str.length()) { - size_t start = dollar + 1; - - if (str[start] == '$') { - // A double dollar sign maps to a single dollar sign. - result += str.substr(last, start - last); - last = start + 1; - - } else { - string varname; - size_t end = start; - - if (str[start] == '{') { - // Curly braces delimit the variable name explicitly. - end = str.find('}', start + 1); - if (end != string::npos) { - varname = str.substr(start + 1, end - (start + 1)); - end++; - } - } - - if (end == start) { - // Scan for the end of the variable name. - while (end < str.length() && (isalnum(str[end]) || str[end] == '_')) { - end++; - } - varname = str.substr(start, end - start); - } - - string subst = - result += str.substr(last, dollar - last); - result += get_environment_variable(varname); - last = end; - } - - dollar = str.find('$', last); - } - - result += str.substr(last); - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: ExecutionEnviroment::get_cwd -// Access: Public, Static -// Description: Returns the name of the current working directory. -//////////////////////////////////////////////////////////////////// -Filename ExecutionEnvironment:: -get_cwd() { - // getcwd() requires us to allocate a dynamic buffer and grow it on - // demand. - static size_t bufsize = 1024; - static char *buffer = NULL; - - if (buffer == (char *)NULL) { - buffer = new char[bufsize]; - } - - while (getcwd(buffer, bufsize) == (char *)NULL) { - if (errno != ERANGE) { - perror("getcwd"); - return string(); - } - delete[] buffer; - bufsize = bufsize * 2; - buffer = new char[bufsize]; - assert(buffer != (char *)NULL); - } - - return Filename::from_os_specific(buffer); -} diff --git a/ppremake/executionEnvironment.h b/ppremake/executionEnvironment.h deleted file mode 100644 index 1874053635..0000000000 --- a/ppremake/executionEnvironment.h +++ /dev/null @@ -1,34 +0,0 @@ -// Filename: executionEnvironment.h -// Created by: drose (15May00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef EXECUTIONENVIRONMENT_H -#define EXECUTIONENVIRONMENT_H - -#include "ppremake.h" -#include "filename.h" - -//////////////////////////////////////////////////////////////////// -// Class : ExecutionEnvironment -// Description : This class is borrowed from dtool/src/dtoolutil, and -// stripped down to just the bare minimum that Filename -// needs; and also modified to build outside of Panda. -//////////////////////////////////////////////////////////////////// -class ExecutionEnvironment { -public: - static string get_environment_variable(const string &var); - static string expand_string(const string &str); - static Filename get_cwd(); -}; - -#endif diff --git a/ppremake/filename.I b/ppremake/filename.I deleted file mode 100644 index dc36755569..0000000000 --- a/ppremake/filename.I +++ /dev/null @@ -1,555 +0,0 @@ -// Filename: filename.I -// Created by: drose (18Jan99) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename:: -Filename(const string &filename) { - _flags = 0; - (*this) = filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename:: -Filename(const char *filename) { - _flags = 0; - (*this) = filename; -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Copy Constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename:: -Filename(const Filename ©) : - _filename(copy._filename), - _dirname_end(copy._dirname_end), - _basename_start(copy._basename_start), - _basename_end(copy._basename_end), - _extension_start(copy._extension_start), - _hash_start(copy._hash_start), - _hash_end(copy._hash_end), - _flags(copy._flags) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::text_filename named constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename Filename:: -text_filename(const string &filename) { - Filename result(filename); - result.set_text(); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::binary_filename named constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename Filename:: -binary_filename(const string &filename) { - Filename result(filename); - result.set_binary(); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::dso_filename named constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename Filename:: -dso_filename(const string &filename) { - Filename result(filename); - result.set_type(T_dso); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::executable_filename named constructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename Filename:: -executable_filename(const string &filename) { - Filename result(filename); - result.set_type(T_executable); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::pattern_filename named constructor -// Access: Published -// Description: Constructs a filename that represents a sequence of -// numbered files. See set_pattern(). -//////////////////////////////////////////////////////////////////// -INLINE Filename Filename:: -pattern_filename(const string &filename) { - Filename result(filename); - result.set_pattern(true); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Destructor -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename:: -~Filename() { -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Assignment operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename &Filename:: -operator = (const string &filename) { - _filename = filename; - - locate_basename(); - locate_extension(); - locate_hash(); - return *this; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Assignment operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename &Filename:: -operator = (const char *filename) { - assert(filename != NULL); - return (*this) = string(filename); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Copy assignment operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename &Filename:: -operator = (const Filename ©) { - _filename = copy._filename; - _dirname_end = copy._dirname_end; - _basename_start = copy._basename_start; - _basename_end = copy._basename_end; - _extension_start = copy._extension_start; - _hash_start = copy._hash_start; - _hash_end = copy._hash_end; - _flags = copy._flags; - return *this; -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::string typecast operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Filename:: -operator const string & () const { - return _filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::c_str -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE const char *Filename:: -c_str() const { - return _filename.c_str(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::empty -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -empty() const { - return _filename.empty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::length -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE size_t Filename:: -length() const { - return _filename.length(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Indexing operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE char Filename:: -operator [] (int n) const { - assert(n >= 0 && n < (int)_filename.length()); - return _filename[n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::substr -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -substr(size_t begin, size_t end) const { - return _filename.substr(begin, end); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_fullpath -// Access: Published -// Description: Returns the entire filename: directory, basename, -// extension. This is the same thing returned by the -// string typecast operator, so this function is a -// little redundant. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_fullpath() const { - return _filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_dirname -// Access: Published -// Description: Returns the directory part of the filename. This is -// everything in the filename up to, but not including -// the rightmost slash. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_dirname() const { - return _filename.substr(0, _dirname_end); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_basename -// Access: Published -// Description: Returns the basename part of the filename. This is -// everything in the filename after the rightmost slash, -// including any extensions. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_basename() const { - return _filename.substr(_basename_start); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_fullpath_wo_extension -// Access: Published -// Description: Returns the full filename--directory and basename -// parts--except for the extension. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_fullpath_wo_extension() const { - return _filename.substr(0, _basename_end); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_basename_wo_extension -// Access: Published -// Description: Returns the basename part of the filename, without -// the file extension. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_basename_wo_extension() const { - if (_basename_end == string::npos) { - return _filename.substr(_basename_start); - } else { - return _filename.substr(_basename_start, _basename_end - _basename_start); - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_extension -// Access: Published -// Description: Returns the file extension. This is everything after -// the rightmost dot, if there is one, or the empty -// string if there is not. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_extension() const { - if (_extension_start == string::npos) { - return string(); - } else { - return _filename.substr(_extension_start); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_binary -// Access: Published -// Description: Indicates that the filename represents a binary file. -// This is primarily relevant to the read_file() and -// write_file() methods, so they can set the appropriate -// flags to the OS. -//////////////////////////////////////////////////////////////////// -INLINE void Filename:: -set_binary() { - _flags = (_flags & ~F_text) | F_binary; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_text -// Access: Published -// Description: Indicates that the filename represents a text file. -// This is primarily relevant to the read_file() and -// write_file() methods, so they can set the appropriate -// flags to the OS. -//////////////////////////////////////////////////////////////////// -INLINE void Filename:: -set_text() { - _flags = (_flags & ~F_binary) | F_text; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_binary -// Access: Published -// Description: Returns true if the Filename has been indicated to -// represent a binary file via a previous call to -// set_binary(). It is possible that neither -// is_binary() nor is_text() will be true, if neither -// set_binary() nor set_text() was ever called. -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -is_binary() const { - return ((_flags & F_binary) != 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_text -// Access: Published -// Description: Returns true if the Filename has been indicated to -// represent a text file via a previous call to -// set_text(). It is possible that neither is_binary() -// nor is_text() will be true, if neither set_binary() -// nor set_text() was ever called. -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -is_text() const { - return ((_flags & F_text) != 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_type -// Access: Published -// Description: Sets the type of the file represented by the -// filename. This is useful for to_os_specific(), -// resolve_filename(), test_existence(), and all such -// real-world access functions. It helps the Filename -// know how to map the internal filename to the -// OS-specific filename (for instance, maybe executables -// should have an .exe extension). -//////////////////////////////////////////////////////////////////// -INLINE void Filename:: -set_type(Filename::Type type) { - _flags = (_flags & ~F_type) | type; - switch (type) { - case T_dso: - case T_executable: - set_binary(); - - case T_general: - break; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_type -// Access: Published -// Description: Returns the type of the file represented by the -// filename, as previously set by set_type(). -//////////////////////////////////////////////////////////////////// -INLINE Filename::Type Filename:: -get_type() const { - return (Type)(_flags & (int)F_type); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_pattern -// Access: Published -// Description: Sets the flag indicating whether this is a filename -// pattern. When this is true, the filename is -// understood to be a placeholder for a numbered -// sequence of filename, such as an image sequence. In -// this case, a sequence of one or more hash characters -// ("#") should appear in the filename string; these -// characters will be filled in with the corresponding -// number (or more) of digits representing the sequence -// number. Sequence numbers always begin counting at 0. -// -// When this is true, methods like has_hash() and -// get_hash_to_end() and get_filename_index() may be -// called. Methods like is_exists() will implicitly -// test for existance of filename sequence 0. -//////////////////////////////////////////////////////////////////// -INLINE void Filename:: -set_pattern(bool pattern) { - if (pattern != get_pattern()) { - if (pattern) { - _flags |= F_pattern; - } else { - _flags &= ~F_pattern; - } - locate_hash(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_pattern -// Access: Published -// Description: Returns the flag indicating whether this is a -// filename pattern. See set_pattern(). -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -get_pattern() const { - return (_flags & F_pattern) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::has_hash -// Access: Published -// Description: Returns true if the filename is indicated to be a -// filename pattern (that is, set_pattern(true) was -// called), and the filename pattern did include a -// sequence of hash marks, or false if it was not a -// filename pattern or did not include hash marks. If -// this is true, then get_filename_index() will return a -// different filename each time. -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -has_hash() const { - return (_hash_start != _hash_end); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_hash_to_end -// Access: Published -// Description: Returns the part of the filename beginning at the -// hash sequence (if any), and continuing to the end of -// the filename. -//////////////////////////////////////////////////////////////////// -INLINE string Filename:: -get_hash_to_end() const { - return _filename.substr(_hash_start); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_local -// Access: Published -// Description: Returns true if the filename is local, e.g. does not -// begin with a slash, or false if the filename is fully -// specified from the root. -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -is_local() const { - return _filename.empty() || _filename[0] != '/'; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_fully_qualified -// Access: Published -// Description: Returns true if the filename is fully qualified, -// e.g. begins with a slash. This is almost, but not -// quite, the same thing as !is_local(). It's not -// exactly the same because a special case is made for -// filenames that begin with a single dot followed by a -// slash--these are considered to be fully qualified -// (they are explicitly relative to the current -// directory, and do not refer to a filename on a search -// path somewhere). -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -is_fully_qualified() const { - return - (_filename.size() > 2 && _filename[0] == '.' && _filename[1] == '/') || - (!_filename.empty() && _filename[0] == '/'); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Equality operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -operator == (const string &other) const { - return (*(string *)this) == other; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Inequality operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -operator != (const string &other) const { - return (*(string *)this) != other; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Ordering operator -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool Filename:: -operator < (const string &other) const { - return (*(string *)this) < other; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::compare_to -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE int Filename:: -compare_to(const Filename &other) const { - return strcmp(_filename.c_str(), other._filename.c_str()); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::output -// Access: Published -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void Filename:: -output(ostream &out) const { - out << _filename; -} diff --git a/ppremake/filename.cxx b/ppremake/filename.cxx deleted file mode 100644 index a16bfd11d9..0000000000 --- a/ppremake/filename.cxx +++ /dev/null @@ -1,2461 +0,0 @@ -// Filename: filename.cxx -// Created by: drose (18Jan99) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "filename.h" -#include "dSearchPath.h" -#include "executionEnvironment.h" -#include "vector_string.h" - -#include // For rename() and tempnam() -#include // for clock() and time() -#include -#include - -#ifdef HAVE_UTIME_H -#include - -// We assume we have these too. -#include -#include -#endif - -#ifdef HAVE_GLOB_H - #include - #ifndef GLOB_NOMATCH - #define GLOB_NOMATCH -3 - #endif -#endif - -#ifdef HAVE_DIRENT_H -#include -#endif - -// It's true that dtoolbase.h includes this already, but we include -// this again in case we are building this file within ppremake. -#ifdef HAVE_UNISTD_H -#include -#endif - - -#ifdef WIN32 -/* begin Win32-specific code */ - -#ifdef WIN32_VC -#include -#include -#endif - -// The MSVC 6.0 Win32 SDK lacks the following definitions, so we define them -// here for compatibility. -#ifndef FILE_ATTRIBUTE_DEVICE -#define FILE_ATTRIBUTE_DEVICE 0x00000040 -#endif - -// We might have been linked with the Cygwin dll. This is ideal if it -// is available, because it allows Panda to access all the Cygwin -// mount definitions if they are in use. If the Cygwin dll is not -// available, we fall back to our own convention for converting -// pathnames. -#ifdef HAVE_CYGWIN -extern "C" void cygwin_conv_to_win32_path(const char *path, char *win32); -extern "C" void cygwin_conv_to_posix_path(const char *path, char *posix); -#endif - -// Windows uses the convention \\hostname\path\to\file to represent a -// pathname to a file on another share. This redefines a pathname to -// be something more complicated than a sequence of directory names -// separated by slashes. The Unix convention to represent the same -// thing is, like everything else, to graft the reference to the -// remote hostname into the one global filesystem, with something like -// /hosts/hostname/path/to/file. We observe the Unix convention for -// internal names used in Panda; this makes operations like -// Filename::get_dirname() simpler and more internally consistent. - -// This string hard-defines the prefix that we use internally to -// indicate that the next directory component name should be treated -// as a hostname. It might be nice to use a ConfigVariable for this, -// except that we haven't defined ConfigVariable by this point (and -// indeed we can't, since we need to have a Filename class already -// created in order to read the first config file). Windows purists -// might be tempted to define this to a double slash so that internal -// Panda filenames more closely resemble their Windows counterparts. -// That might actually work, but it will cause problems with -// Filename::standardize(). -static const string hosts_prefix = "/hosts/"; - -static string -front_to_back_slash(const string &str) { - string result = str; - string::iterator si; - for (si = result.begin(); si != result.end(); ++si) { - if ((*si) == '/') { - (*si) = '\\'; - } - } - - return result; -} - -static string -back_to_front_slash(const string &str) { - string result = str; - string::iterator si; - for (si = result.begin(); si != result.end(); ++si) { - if ((*si) == '\\') { - (*si) = '/'; - } - } - - return result; -} - -static const string & -get_panda_root() { - static string panda_root; - static bool got_panda_root = false; - - if (!got_panda_root) { - const char *envvar = getenv("PANDA_ROOT"); - if (envvar != (const char *)NULL) { - panda_root = front_to_back_slash(envvar); - } - - // Ensure the string ends in a backslash. If PANDA_ROOT is empty - // or undefined, this function must return a single backslash--not - // an empty string--since this prefix is used to replace a leading - // slash in Filename::to_os_specific(). - if (panda_root.empty() || panda_root[panda_root.length() - 1] != '\\') { - panda_root += '\\'; - } - - got_panda_root = true; - } - - return panda_root; -} - -static string -convert_pathname(const string &unix_style_pathname) { - if (unix_style_pathname.empty()) { - return string(); - } - - // To convert from a Unix-style pathname to a Windows-style - // pathname, we need to change all forward slashes to backslashes. - // We might need to add a prefix as well, since Windows pathnames - // typically begin with a drive letter. - - // By convention, if the top directory name consists of just one - // letter, we treat that as a drive letter and map the rest of the - // filename accordingly. On the other hand, if the top directory - // name consists of more than one letter, we assume this is a file - // within some predefined tree whose root is given by the - // environment variable "PANDA_ROOT", or if that is not defined, - // "CYGWIN_ROOT" (for backward compatibility). - string windows_pathname; - - if (unix_style_pathname[0] != '/') { - // It doesn't even start from the root, so we don't have to do - // anything fancy--relative pathnames are the same in Windows as - // in Unix, except for the direction of the slashes. - windows_pathname = front_to_back_slash(unix_style_pathname); - - } else if (unix_style_pathname.length() >= 2 && - isalpha(unix_style_pathname[1]) && - (unix_style_pathname.length() == 2 || unix_style_pathname[2] == '/')) { - // This pathname begins with a slash and a single letter. That - // must be the drive letter. - - string remainder = unix_style_pathname.substr(2); - if (remainder.empty()) { - // There's a difference between "C:" and "C:/". - remainder = "/"; - } - remainder = front_to_back_slash(remainder); - - // We have to cast the result of toupper() to (char) to help some - // compilers (e.g. Cygwin's gcc 2.95.3) happy; so that they do not - // confuse this string constructor with one that takes two - // iterators. - windows_pathname = - string(1, (char)toupper(unix_style_pathname[1])) + ":" + remainder; - - } else if (unix_style_pathname.length() > hosts_prefix.length() && - unix_style_pathname.substr(0, hosts_prefix.length()) == hosts_prefix) { - // A filename like /hosts/fooby gets turned into \\fooby. - windows_pathname = "\\\\" + front_to_back_slash(unix_style_pathname.substr(hosts_prefix.length())); - - } else { - // It starts with a slash, but the first part is not a single - // letter. - -#ifdef HAVE_CYGWIN - // Use Cygwin to convert it if possible. - char result[4096] = ""; - cygwin_conv_to_win32_path(unix_style_pathname.c_str(), result); - windows_pathname = result; - -#else // HAVE_CYGWIN - // Without Cygwin, just prefix $PANDA_ROOT. - windows_pathname = get_panda_root(); - windows_pathname += front_to_back_slash(unix_style_pathname.substr(1)); - -#endif // HAVE_CYGWIN - } - - return windows_pathname; -} - -static string -convert_dso_pathname(const string &unix_style_pathname) { - // If the extension is .so, change it to .dll. - size_t dot = unix_style_pathname.rfind('.'); - if (dot == string::npos || - unix_style_pathname.find('/', dot) != string::npos) { - // No filename extension. - return convert_pathname(unix_style_pathname); - } - if (unix_style_pathname.substr(dot) != ".so") { - // Some other extension. - return convert_pathname(unix_style_pathname); - } - - string dll_basename = unix_style_pathname.substr(0, dot); - -#ifdef _DEBUG - // If we're building a debug version, all the dso files we link in - // must be named file_d.dll. This does prohibit us from linking in - // external dso files, generated outside of the Panda build system, - // that don't follow this _d convention. Maybe we need a separate - // convert_system_dso_pathname() function. - - // We can't simply check to see if the file exists, because this - // might not be a full path to the dso filename--it might be - // somewhere on the LD_LIBRARY_PATH, or on PATH, or any of a number - // of nutty places. - - return convert_pathname(dll_basename + "_d.dll"); -#else - return convert_pathname(dll_basename + ".dll"); -#endif -} - -static string -convert_executable_pathname(const string &unix_style_pathname) { - // If the extension is not .exe, append .exe. - size_t dot = unix_style_pathname.rfind('.'); - if (dot == string::npos || - unix_style_pathname.find('/', dot) != string::npos) { - // No filename extension. - return convert_pathname(unix_style_pathname + ".exe"); - } - if (unix_style_pathname.substr(dot) != ".exe") { - // Some other extension. - return convert_pathname(unix_style_pathname + ".exe"); - } - - return convert_pathname(unix_style_pathname); -} -#endif //WIN32 - -//////////////////////////////////////////////////////////////////// -// Function: Filename::Constructor -// Access: Published -// Description: This constructor composes the filename out of a -// directory part and a basename part. It will insert -// an intervening '/' if necessary. -//////////////////////////////////////////////////////////////////// -Filename:: -Filename(const Filename &dirname, const Filename &basename) { - if (dirname.empty()) { - (*this) = basename; - } else { - _flags = basename._flags; - string dirpath = dirname.get_fullpath(); - if (dirpath[dirpath.length() - 1] == '/') { - (*this) = dirpath + basename.get_fullpath(); - } else { - (*this) = dirpath + "/" + basename.get_fullpath(); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::from_os_specific -// Access: Published, Static -// Description: This named constructor returns a Panda-style filename -// (that is, using forward slashes, and no drive letter) -// based on the supplied filename string that describes -// a filename in the local system conventions (for -// instance, on Windows, it may use backslashes or begin -// with a drive letter and a colon). -// -// Use this function to create a Filename from an -// externally-given filename string. Use -// to_os_specific() again later to reconvert it back to -// the local operating system's conventions. -// -// This function will do the right thing even if the -// filename is partially local conventions and partially -// Panda conventions; e.g. some backslashes and some -// forward slashes. -//////////////////////////////////////////////////////////////////// -Filename Filename:: -from_os_specific(const string &os_specific, Filename::Type type) { -#ifdef WIN32 - string result = back_to_front_slash(os_specific); - const string &panda_root = get_panda_root(); - - // If the initial prefix is the same as panda_root, remove it. - if (!panda_root.empty() && panda_root != string("\\") && - panda_root.length() < result.length()) { - bool matches = true; - size_t p; - for (p = 0; p < panda_root.length() && matches; ++p) { - char c = tolower(panda_root[p]); - if (c == '\\') { - c = '/'; - } - matches = (c == tolower(result[p])); - } - - if (matches) { - // The initial prefix matches! Replace the initial bit with a - // leading slash. - result = result.substr(panda_root.length()); - assert(!result.empty()); - if (result[0] != '/') { - result = '/' + result; - } - Filename filename(result); - filename.set_type(type); - return filename; - } - } - - // All right, the initial prefix was not under panda_root. But - // maybe it begins with a drive letter. - if (result.size() >= 3 && isalpha(result[0]) && - result[1] == ':' && result[2] == '/') { - result[1] = tolower(result[0]); - result[0] = '/'; - - // If there's *just* a slash following the drive letter, go ahead - // and trim it. - if (result.size() == 3) { - result = result.substr(0, 2); - } - - } else if (result.substr(0, 2) == "//") { - // If the initial prefix is a double slash, convert it to /hosts/. - result = hosts_prefix + result.substr(2); - } - - Filename filename(result); - filename.set_type(type); - return filename; -#else // WIN32 - // Generic Unix-style filenames--no conversion necessary. - Filename filename(os_specific); - filename.set_type(type); - return filename; -#endif // WIN32 -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::expand_from -// Access: Published, Static -// Description: Returns the same thing as from_os_specific(), but -// embedded environment variable references -// (e.g. "$DMODELS/foo.txt") are expanded out. -//////////////////////////////////////////////////////////////////// -Filename Filename:: -expand_from(const string &os_specific, Filename::Type type) { - return from_os_specific(ExecutionEnvironment::expand_string(os_specific), - type); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::temporary -// Access: Published, Static -// Description: Generates a temporary filename within the indicated -// directory, using the indicated prefix. If the -// directory is empty, a system-defined directory is -// chosen instead. -// -// The generated filename did not exist when the -// Filename checked, but since it does not specifically -// create the file, it is possible that another process -// could simultaneously create a file by the same name. -//////////////////////////////////////////////////////////////////// -Filename Filename:: -temporary(const string &dirname, const string &prefix, const string &suffix, - Type type) { - if (dirname.empty()) { - // If we are not given a dirname, use the system tempnam() - // function to create a system-defined temporary filename. - char *name = tempnam(NULL, prefix.c_str()); - Filename result(name); - free(name); - result.set_type(type); - return result; - } - - // If we *are* given a dirname, then use our own algorithm to make - // up a filename within that dirname. We do that because the system - // tempnam() (for instance, under Windows) may ignore the dirname. - - Filename result; - do { - // We take the time of day and multiply it by the process time. - // This will give us a very large number, of which we take the - // bottom 24 bits and generate a 6-character hex code. - int hash = (clock() * time(NULL)) & 0xffffff; - char hex_code[10]; - sprintf(hex_code, "%06x", hash); - result = Filename(dirname, Filename(prefix + hex_code + suffix)); - result.set_type(type); - } while (result.exists()); - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_fullpath -// Access: Published -// Description: Replaces the entire filename: directory, basename, -// extension. This can also be achieved with the -// assignment operator. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_fullpath(const string &s) { - (*this) = s; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_dirname -// Access: Published -// Description: Replaces the directory part of the filename. This is -// everything in the filename up to, but not including -// the rightmost slash. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_dirname(const string &s) { - if (s.empty()) { - // Remove the directory prefix altogether. - _filename.replace(0, _basename_start, ""); - - int length_change = - ((int)_basename_start); - - _dirname_end = 0; - _basename_start += length_change; - _basename_end += length_change; - _extension_start += length_change; - - } else { - // Replace the existing directory prefix, or insert a new one. - - // We build the string ss to include the terminal slash. - string ss; - if (s[s.length()-1] == '/') { - ss = s; - } else { - ss = s+'/'; - } - - int length_change = ss.length() - _basename_start; - - _filename.replace(0, _basename_start, ss); - - _dirname_end = ss.length() - 1; - - // An exception: if the dirname string was the single slash, the - // dirname includes that slash. - if (ss.length() == 1) { - _dirname_end = 1; - } - - _basename_start += length_change; - - if (_basename_end != string::npos) { - _basename_end += length_change; - _extension_start += length_change; - } - } - locate_hash(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_basename -// Access: Published -// Description: Replaces the basename part of the filename. This is -// everything in the filename after the rightmost slash, -// including any extensions. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_basename(const string &s) { - _filename.replace(_basename_start, string::npos, s); - locate_extension(); - locate_hash(); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_fullpath_wo_extension -// Access: Published -// Description: Replaces the full filename--directory and basename -// parts--except for the extension. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_fullpath_wo_extension(const string &s) { - int length_change = s.length() - _basename_end; - - _filename.replace(0, _basename_end, s); - - if (_basename_end != string::npos) { - _basename_end += length_change; - _extension_start += length_change; - } - locate_hash(); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_basename_wo_extension -// Access: Published -// Description: Replaces the basename part of the filename, without -// the file extension. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_basename_wo_extension(const string &s) { - int length_change = s.length() - (_basename_end - _basename_start); - - if (_basename_end == string::npos) { - _filename.replace(_basename_start, string::npos, s); - - } else { - _filename.replace(_basename_start, _basename_end - _basename_start, s); - - _basename_end += length_change; - _extension_start += length_change; - } - locate_hash(); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_extension -// Access: Published -// Description: Replaces the file extension. This is everything after -// the rightmost dot, if there is one, or the empty -// string if there is not. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_extension(const string &s) { - if (s.empty()) { - // Remove the extension altogether. - if (_basename_end != string::npos) { - _filename.replace(_basename_end, string::npos, ""); - _basename_end = string::npos; - _extension_start = string::npos; - } - - } else if (_basename_end == string::npos) { - // Insert an extension where there was none before. - _basename_end = _filename.length(); - _extension_start = _filename.length() + 1; - _filename += '.' + s; - - } else { - // Replace an existing extension. - _filename.replace(_extension_start, string::npos, s); - } - locate_hash(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_filename_index -// Access: Published -// Description: If the pattern flag is set for this Filename and the -// filename string actually includes a sequence of hash -// marks, then this returns a new Filename with the -// sequence of hash marks replaced by the indicated -// index number. -// -// If the pattern flag is not set for this Filename or -// it does not contain a sequence of hash marks, this -// quietly returns the original filename. -//////////////////////////////////////////////////////////////////// -Filename Filename:: -get_filename_index(int index) const { - Filename file(*this); - - if (_hash_end != _hash_start) { - ostringstream strm; - strm << _filename.substr(0, _hash_start) - << setw(_hash_end - _hash_start) << setfill('0') << index - << _filename.substr(_hash_end); - file.set_fullpath(strm.str()); - } - file.set_pattern(false); - - return file; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::set_hash_to_end -// Access: Published -// Description: Replaces the part of the filename from the beginning -// of the hash sequence to the end of the filename. -//////////////////////////////////////////////////////////////////// -void Filename:: -set_hash_to_end(const string &s) { - _filename.replace(_hash_start, string::npos, s); - - locate_basename(); - locate_extension(); - locate_hash(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::extract_components -// Access: Published -// Description: Extracts out the individual directory components of -// the path into a series of strings. get_basename() -// will be the last component stored in the vector. -// Note that no distinction is made by this method -// between a leading slash and no leading slash, but you -// can call is_local() to differentiate the two cases. -//////////////////////////////////////////////////////////////////// -void Filename:: -extract_components(vector_string &components) const { - components.clear(); - - size_t p = 0; - if (!_filename.empty() && _filename[0] == '/') { - // Skip the leading slash. - p = 1; - } - while (p < _filename.length()) { - size_t q = _filename.find('/', p); - if (q == string::npos) { - components.push_back(_filename.substr(p)); - return; - } - components.push_back(_filename.substr(p, q - p)); - p = q + 1; - } - - // A trailing slash means we have an empty get_basename(). - components.push_back(string()); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::standardize -// Access: Published -// Description: Converts the filename to standard form by replacing -// consecutive slashes with a single slash, removing a -// trailing slash if present, and backing up over ../ -// sequences within the filename where possible. -//////////////////////////////////////////////////////////////////// -void Filename:: -standardize() { - assert(!_filename.empty()); - if (_filename == ".") { - // Don't change a single dot; this refers to the current directory. - return; - } - - vector_string components; - - // Pull off the components of the filename one at a time. - bool global = (_filename[0] == '/'); - - size_t p = 0; - while (p < _filename.length() && _filename[p] == '/') { - p++; - } - while (p < _filename.length()) { - size_t slash = _filename.find('/', p); - string component = _filename.substr(p, slash - p); - if (component == ".") { - // Ignore /./. - } else if (component == ".." && !components.empty() && - !(components.back() == "..")) { - // Back up. - components.pop_back(); - } else { - components.push_back(component); - } - - p = slash; - while (p < _filename.length() && _filename[p] == '/') { - p++; - } - } - - // Now reassemble the filename. - string result; - if (global) { - result = "/"; - } - if (!components.empty()) { - result += components[0]; - for (int i = 1; i < (int)components.size(); i++) { - result += "/" + components[i]; - } - } - - (*this) = result; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::make_absolute -// Access: Published -// Description: Converts the filename to a fully-qualified pathname -// from the root (if it is a relative pathname), and -// then standardizes it (see standardize()). -// -// This is sometimes a little problematic, since it may -// convert the file to its 'true' absolute pathname, -// which could be an ugly NFS-named file, irrespective -// of symbolic links -// (e.g. /.automount/dimbo/root/usr2/fit/people/drose -// instead of /fit/people/drose); besides being ugly, -// filenames like this may not be consistent across -// multiple different platforms. -//////////////////////////////////////////////////////////////////// -void Filename:: -make_absolute() { - if (is_local()) { - make_absolute(ExecutionEnvironment::get_cwd()); - } else { - standardize(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::make_absolute -// Access: Published -// Description: Converts the filename to a fully-qualified filename -// from the root (if it is a relative filename), and -// then standardizes it (see standardize()). This -// flavor accepts a specific starting directory that the -// filename is known to be relative to. -//////////////////////////////////////////////////////////////////// -void Filename:: -make_absolute(const Filename &start_directory) { - if (is_local()) { - Filename new_filename(start_directory, _filename); - new_filename._flags = _flags; - (*this) = new_filename; - } - - standardize(); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::make_canonical -// Access: Published -// Description: Converts this filename to a canonical name by -// replacing the directory part with the fully-qualified -// directory part. This is done by changing to that -// directory and calling getcwd(). -// -// This has the effect of (a) converting relative paths -// to absolute paths (but see make_absolute() if this is -// the only effect you want), and (b) always resolving a -// given directory name to the same string, even if -// different symbolic links are traversed, and (c) -// changing nice symbolic-link paths like -// /fit/people/drose to ugly NFS automounter names like -// /hosts/dimbo/usr2/fit/people/drose. This can be -// troubling, but sometimes this is exactly what you -// want, particularly if you're about to call -// make_relative_to() between two filenames. -// -// The return value is true if successful, or false on -// failure (usually because the directory name does not -// exist or cannot be chdir'ed into). -//////////////////////////////////////////////////////////////////// -bool Filename:: -make_canonical() { - if (empty()) { - // An empty filename is a special case. This doesn't name - // anything. - return false; - } - - if (get_fullpath() == "/") { - // The root directory is a special case. - return true; - } - - Filename cwd = ExecutionEnvironment::get_cwd(); - return r_make_canonical(cwd); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::make_true_case -// Access: Published -// Description: On a case-insensitive operating system -// (e.g. Windows), this method looks up the file in the -// file system and resets the Filename to represent the -// actual case of the file as it exists on the disk. -// The return value is true if the file exists and the -// conversion can be made, or false if there is some -// error. -// -// On a case-sensitive operating system, this method -// does nothing and always returns true. -// -// An empty filename is considered to exist in this -// case. -//////////////////////////////////////////////////////////////////// -bool Filename:: -make_true_case() { - assert(!get_pattern()); - - if (empty()) { - return true; - } - -#ifdef WIN32 - string os_specific = to_os_specific(); - - // First, we have to convert it to its short name, then back to its - // long name--that seems to be the trick to force Windows to throw - // away the case we give it and get the actual file case. - - char short_name[MAX_PATH + 1]; - DWORD l = GetShortPathName(os_specific.c_str(), short_name, MAX_PATH + 1); - if (l == 0) { - // Couldn't query the path name for some reason. Probably the - // file didn't exist. - return false; - } - // According to the Windows docs, l will return a value greater than - // the specified length if the short_name length wasn't enough--but also - // according to the Windows docs, MAX_PATH will always be enough. - assert(l < MAX_PATH + 1); - - char long_name[MAX_PATH + 1]; - l = GetLongPathName(short_name, long_name, MAX_PATH + 1); - if (l == 0) { - // Couldn't query the path name for some reason. Probably the - // file didn't exist. - return false; - } - assert(l < MAX_PATH + 1); - - Filename true_case = Filename::from_os_specific(long_name); - - // Now sanity-check the true-case filename. If it's not the same as - // the source file, except for case, reject it. - string orig_filename = get_fullpath(); - string new_filename = true_case.get_fullpath(); - bool match = (orig_filename.length() == new_filename.length()); - for (size_t i = 0; i < orig_filename.length() && match; ++i) { - match = (tolower(orig_filename[i]) == tolower(new_filename[i])); - } - if (!match) { - // Something went wrong. Keep the original filename, assume it - // was the correct case after all. We return true because the - // filename is good. - return true; - } - - (*this) = true_case; - return true; - -#else // WIN32 - return true; -#endif // WIN32 -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::to_os_specific -// Access: Published -// Description: Converts the filename from our generic Unix-like -// convention (forward slashes starting with the root at -// '/') to the corresponding filename in the local -// operating system (slashes in the appropriate -// direction, starting with the root at C:\, for -// instance). Returns the string representing the -// converted filename, but does not change the Filename -// itself. -// -// See also from_os_specific(). -//////////////////////////////////////////////////////////////////// -string Filename:: -to_os_specific() const { - assert(!get_pattern()); - - if (empty()) { - return string(); - } - Filename standard(*this); - standard.standardize(); - -#ifdef IS_OSX - if (get_type() == T_dso) { - std::string workname = standard.get_fullpath(); - size_t dot = workname.rfind('.'); - if (dot != string::npos) { - if (workname.substr(dot) == ".so") { - string dyLibBase = workname.substr(0, dot)+".dylib"; - return dyLibBase; - } - } - } -#endif - -#ifdef WIN32 - switch (get_type()) { - case T_dso: - return convert_dso_pathname(standard.get_fullpath()); - case T_executable: - return convert_executable_pathname(standard.get_fullpath()); - default: - return convert_pathname(standard.get_fullpath()); - } -#else // WIN32 - return standard; -#endif // WIN32 -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::to_os_generic -// Access: Published -// Description: This is similar to to_os_specific(), but it is -// designed to generate a filename that can be -// understood on as many platforms as possible. Since -// Windows can usually understand a -// forward-slash-delimited filename, this means it does -// the same thing as to_os_specific(), but it uses -// forward slashes instead of backslashes. -// -// This method has a pretty limited use; it should -// generally be used for writing file references to a -// file that might be read on any operating system. -//////////////////////////////////////////////////////////////////// -string Filename:: -to_os_generic() const { - assert(!get_pattern()); - -#ifdef WIN32 - return back_to_front_slash(to_os_specific()); -#else // WIN32 - return to_os_specific(); -#endif // WIN32 -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::to_os_short_name -// Access: Published -// Description: This works like to_os_generic(), but it returns the -// "short name" version of the filename, if it exists, -// or the original filename otherwise. -// -// On Windows platforms, this returns the 8.3 filename -// version of the given filename, if the file exists, -// and the same thing as to_os_specific() otherwise. On -// non-Windows platforms, this always returns the same -// thing as to_os_specific(). -//////////////////////////////////////////////////////////////////// -string Filename:: -to_os_short_name() const { - assert(!get_pattern()); - -#ifdef WIN32 - string os_specific = to_os_specific(); - - char short_name[MAX_PATH + 1]; - DWORD l = GetShortPathName(os_specific.c_str(), short_name, MAX_PATH + 1); - if (l == 0) { - // Couldn't query the path name for some reason. Probably the - // file didn't exist. - return os_specific; - } - // According to the Windows docs, l will return a value greater than - // the specified length if the short_name length wasn't enough--but also - // according to the Windows docs, MAX_PATH will always be enough. - assert(l < MAX_PATH + 1); - - return string(short_name); - -#else // WIN32 - return to_os_specific(); -#endif // WIN32 -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::to_os_long_name -// Access: Published -// Description: This is the opposite of to_os_short_name(): it -// returns the "long name" of the filename, if the -// filename exists. On non-Windows platforms, this -// returns the same thing as to_os_specific(). -//////////////////////////////////////////////////////////////////// -string Filename:: -to_os_long_name() const { - assert(!get_pattern()); - -#ifdef WIN32 - string os_specific = to_os_specific(); - - char long_name[MAX_PATH + 1]; - DWORD l = GetLongPathName(os_specific.c_str(), long_name, MAX_PATH + 1); - if (l == 0) { - // Couldn't query the path name for some reason. Probably the - // file didn't exist. - return os_specific; - } - assert(l < MAX_PATH + 1); - - return string(long_name); - -#else // WIN32 - return to_os_specific(); -#endif // WIN32 -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::exists -// Access: Published -// Description: Returns true if the filename exists on the disk, -// false otherwise. If the type is indicated to be -// executable, this also tests that the file has execute -// permission. -//////////////////////////////////////////////////////////////////// -bool Filename:: -exists() const { - string os_specific = get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - bool exists = false; - - DWORD results = GetFileAttributes(os_specific.c_str()); - if (results != -1) { - exists = true; - } - -#else // WIN32_VC - struct stat this_buf; - bool exists = false; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - exists = true; - } -#endif - - return exists; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_regular_file -// Access: Published -// Description: Returns true if the filename exists and is the -// name of a regular file (i.e. not a directory or -// device), false otherwise. -//////////////////////////////////////////////////////////////////// -bool Filename:: -is_regular_file() const { - string os_specific = get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - bool isreg = false; - - DWORD results = GetFileAttributes(os_specific.c_str()); - if (results != -1) { - isreg = ((results & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0); - } - -#else // WIN32_VC - struct stat this_buf; - bool isreg = false; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - isreg = S_ISREG(this_buf.st_mode); - } -#endif - - return isreg; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_directory -// Access: Published -// Description: Returns true if the filename exists and is a -// directory name, false otherwise. -//////////////////////////////////////////////////////////////////// -bool Filename:: -is_directory() const { - string os_specific = get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - bool isdir = false; - - DWORD results = GetFileAttributes(os_specific.c_str()); - if (results != -1) { - isdir = (results & FILE_ATTRIBUTE_DIRECTORY) != 0; - } -#else // WIN32_VC - struct stat this_buf; - bool isdir = false; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - isdir = S_ISDIR(this_buf.st_mode); - } -#endif - - return isdir; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::is_executable -// Access: Published -// Description: Returns true if the filename exists and is -// executable -//////////////////////////////////////////////////////////////////// -bool Filename:: -is_executable() const { -#ifdef WIN32_VC - // no access() in windows, but to our advantage executables can only - // end in .exe or .com - string extension = get_extension(); - if (extension == "exe" || extension == "com") { - return exists(); - } - -#else /* WIN32_VC */ - string os_specific = get_filename_index(0).to_os_specific(); - if (access(os_specific.c_str(), X_OK) == 0) { - return true; - } -#endif /* WIN32_VC */ - - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::compare_timestamps -// Access: Published -// Description: Returns a number less than zero if the file named by -// this object is older than the given file, zero if -// they have the same timestamp, or greater than zero if -// this one is newer. -// -// If this_missing_is_old is true, it indicates that a -// missing file will be treated as if it were older than -// any other file; otherwise, a missing file will be -// treated as if it were newer than any other file. -// Similarly for other_missing_is_old. -//////////////////////////////////////////////////////////////////// -int Filename:: -compare_timestamps(const Filename &other, - bool this_missing_is_old, - bool other_missing_is_old) const { - string os_specific = get_filename_index(0).to_os_specific(); - string other_os_specific = other.get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - struct _stat this_buf; - bool this_exists = false; - - if (_stat(os_specific.c_str(), &this_buf) == 0) { - this_exists = true; - } - - struct _stat other_buf; - bool other_exists = false; - - if (_stat(other_os_specific.c_str(), &other_buf) == 0) { - other_exists = true; - } -#else // WIN32_VC - struct stat this_buf; - bool this_exists = false; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - this_exists = true; - } - - struct stat other_buf; - bool other_exists = false; - - if (stat(other_os_specific.c_str(), &other_buf) == 0) { - other_exists = true; - } -#endif - - if (this_exists && other_exists) { - // Both files exist, return the honest time comparison. - return (int)this_buf.st_mtime - (int)other_buf.st_mtime; - - } else if (!this_exists && !other_exists) { - // Neither file exists. - if (this_missing_is_old == other_missing_is_old) { - // Both files are either "very old" or "very new". - return 0; - } - if (this_missing_is_old) { - // This file is "very old", the other is "very new". - return -1; - } else { - // This file is "very new", the other is "very old". - return 1; - } - - } else if (!this_exists) { - // This file doesn't, the other one does. - return this_missing_is_old ? -1 : 1; - - } - // !other_exists - assert(!other_exists); - - // This file exists, the other one doesn't. - return other_missing_is_old ? 1 : -1; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_timestamp -// Access: Published -// Description: Returns a time_t value that represents the time the -// file was last modified, to within whatever precision -// the operating system records this information (on a -// Windows95 system, for instance, this may only be -// accurate to within 2 seconds). -// -// If the timestamp cannot be determined, either because -// it is not supported by the operating system or -// because there is some error (such as file not found), -// returns 0. -//////////////////////////////////////////////////////////////////// -time_t Filename:: -get_timestamp() const { - string os_specific = get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - struct _stat this_buf; - - if (_stat(os_specific.c_str(), &this_buf) == 0) { - return this_buf.st_mtime; - } -#else // WIN32_VC - struct stat this_buf; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - return this_buf.st_mtime; - } -#endif - - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_access_timestamp -// Access: Published -// Description: Returns a time_t value that represents the time the -// file was last accessed, if this information is -// available. See also get_timestamp(), which returns -// the last modification time. -//////////////////////////////////////////////////////////////////// -time_t Filename:: -get_access_timestamp() const { - string os_specific = get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - struct _stat this_buf; - - if (_stat(os_specific.c_str(), &this_buf) == 0) { - return this_buf.st_atime; - } -#else // WIN32_VC - struct stat this_buf; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - return this_buf.st_atime; - } -#endif - - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_file_size -// Access: Published -// Description: Returns the size of the file in bytes, or 0 if there -// is an error. -//////////////////////////////////////////////////////////////////// -off_t Filename:: -get_file_size() const { - string os_specific = get_filename_index(0).to_os_specific(); - -#ifdef WIN32_VC - struct _stat this_buf; - - if (_stat(os_specific.c_str(), &this_buf) == 0) { - return this_buf.st_size; - } -#else // WIN32_VC - struct stat this_buf; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - return this_buf.st_size; - } -#endif - - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::resolve_filename -// Access: Published -// Description: Searches the given search path for the filename. If -// it is found, updates the filename to the full -// pathname found and returns true; otherwise, returns -// false. -//////////////////////////////////////////////////////////////////// -bool Filename:: -resolve_filename(const DSearchPath &searchpath, - const string &default_extension) { - string found; - - if (is_local()) { - found = searchpath.find_file(*this); - - if (found.empty()) { - // We didn't find it with the given extension; can we try the - // default extension? - if (get_extension().empty() && !default_extension.empty()) { - Filename try_ext = *this; - try_ext.set_extension(default_extension); - found = searchpath.find_file(try_ext); - } - } - } else { - if (exists()) { - // The full pathname exists. Return true. - return true; - } else { - // The full pathname doesn't exist with the given extension; - // does it exist with the default extension? - if (get_extension().empty() && !default_extension.empty()) { - Filename try_ext = *this; - try_ext.set_extension(default_extension); - if (try_ext.exists()) { - found = try_ext; - } - } - } - } - - if (!found.empty()) { - (*this) = found; - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::make_relative_to -// Access: Published -// Description: Adjusts this filename, which must be a -// fully-specified pathname beginning with a slash, to -// make it a relative filename, relative to the -// fully-specified directory indicated (which must also -// begin with, and may or may not end with, a slash--a -// terminating slash is ignored). -// -// This only performs a string comparsion, so it may be -// wise to call make_canonical() on both filenames -// before calling make_relative_to(). -// -// If allow_backups is false, the filename will only be -// adjusted to be made relative if it is already -// somewhere within or below the indicated directory. -// If allow_backups is true, it will be adjusted in all -// cases, even if this requires putting a series of ../ -// characters before the filename--unless it would have -// to back all the way up to the root. -// -// Returns true if the file was adjusted, false if it -// was not. -//////////////////////////////////////////////////////////////////// -bool Filename:: -make_relative_to(Filename directory, bool allow_backups) { - if (_filename.empty() || directory.empty() || - _filename[0] != '/' || directory[0] != '/') { - return false; - } - - standardize(); - directory.standardize(); - - if (directory == "/") { - // Don't be silly. - return false; - } - - string rel_to_file = directory.get_fullpath() + "/."; - - size_t common = get_common_prefix(rel_to_file); - if (common < 2) { - // Oh, never mind. - return false; - } - - string result; - int slashes = count_slashes(rel_to_file.substr(common)); - if (slashes > 0 && !allow_backups) { - // Too bad; the file's not under the indicated directory. - return false; - } - - for (int i = 0; i < slashes; i++) { - result += "../"; - } - result += _filename.substr(common); - (*this) = result; - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::find_on_searchpath -// Access: Published -// Description: Performs the reverse of the resolve_filename() -// operation: assuming that the current filename is -// fully-specified pathname (i.e. beginning with '/'), -// look on the indicated search path for a directory -// under which the file can be found. When found, -// adjust the Filename to be relative to the indicated -// directory name. -// -// Returns the index of the directory on the searchpath -// at which the file was found, or -1 if it was not -// found. -//////////////////////////////////////////////////////////////////// -int Filename:: -find_on_searchpath(const DSearchPath &searchpath) { - if (_filename.empty() || _filename[0] != '/') { - return -1; - } - - int num_directories = searchpath.get_num_directories(); - for (int i = 0; i < num_directories; i++) { - Filename directory = searchpath.get_directory(i); - directory.make_absolute(); - if (make_relative_to(directory, false)) { - return i; - } - } - - return -1; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::scan_directory -// Access: Published -// Description: Attempts to open the named filename as if it were a -// directory and looks for the non-hidden files within -// the directory. Fills the given vector up with the -// sorted list of filenames that are local to this -// directory. -// -// It is the user's responsibility to ensure that the -// contents vector is empty before making this call; -// otherwise, the new files will be appended to it. -// -// Returns true on success, false if the directory could -// not be read for some reason. -//////////////////////////////////////////////////////////////////// -bool Filename:: -scan_directory(vector_string &contents) const { - assert(!get_pattern()); - -#if defined(WIN32_VC) - // Use Windows' FindFirstFile() / FindNextFile() to walk through the - // list of files in a directory. - size_t orig_size = contents.size(); - - string match; - if (empty()) { - match = "*.*"; - } else { - match = to_os_specific() + "\\*.*"; - } - WIN32_FIND_DATA find_data; - - HANDLE handle = FindFirstFile(match.c_str(), &find_data); - if (handle == INVALID_HANDLE_VALUE) { - if (GetLastError() == ERROR_NO_MORE_FILES) { - // No matching files is not an error. - return true; - } - return false; - } - - do { - string filename = find_data.cFileName; - if (filename != "." && filename != "..") { - contents.push_back(filename); - } - } while (FindNextFile(handle, &find_data)); - - bool scan_ok = (GetLastError() == ERROR_NO_MORE_FILES); - FindClose(handle); - - sort(contents.begin() + orig_size, contents.end()); - return scan_ok; - -#elif defined(HAVE_DIRENT_H) - // Use Posix's opendir() / readir() to walk through the list of - // files in a directory. - size_t orig_size = contents.size(); - - string dirname; - if (empty()) { - dirname = "."; - } else { - dirname = _filename; - } - DIR *root = opendir(dirname.c_str()); - if (root == (DIR *)NULL) { - perror(dirname.c_str()); - return false; - } - - struct dirent *d; - d = readdir(root); - while (d != (struct dirent *)NULL) { - if (d->d_name[0] != '.') { - contents.push_back(d->d_name); - } - d = readdir(root); - } - - // It turns out to be a mistake to check the value of errno after - // calling readdir(), since it might have been set to non-zero - // during some internal operation of readdir(), even though there - // wasn't really a problem with scanning the directory itself. - /* - if (errno != 0 && errno != ENOENT && errno != ENOTDIR) { - cerr << "Error occurred while scanning directory " << dirname << "\n"; - perror(dirname.c_str()); - closedir(root); - return false; - } - */ - closedir(root); - - sort(contents.begin() + orig_size, contents.end()); - return true; - -#elif defined(HAVE_GLOB_H) - // It's hard to imagine a system that provides glob.h but does not - // provide openddir() .. readdir(), but this code is leftover from a - // time when there was an undetected bug in the above readdir() - // loop, and it works, so we might as well keep it around for now. - string dirname; - if (empty()) { - dirname = "*"; - } else if (_filename[_filename.length() - 1] == '/') { - dirname = _filename + "*"; - } else { - dirname = _filename + "/*"; /* comment to fix emacs syntax hilight */ - } - - glob_t globbuf; - - int r = glob(dirname.c_str(), GLOB_ERR, NULL, &globbuf); - - if (r != 0) { - // Some error processing the match string. If our version of - // glob.h defines GLOB_NOMATCH, then we can differentiate an empty - // return result from some other kind of error. -#ifdef GLOB_NOMATCH - if (r != GLOB_NOMATCH) { - perror(dirname.c_str()); - return false; - } -#endif - - // Otherwise, all errors mean the same thing: no matches, but - // otherwise no problem. - return true; - } - - size_t offset = dirname.size() - 1; - - for (int i = 0; globbuf.gl_pathv[i] != NULL; i++) { - contents.push_back(globbuf.gl_pathv[i] + offset); - } - globfree(&globbuf); - - return true; - -#else - // Don't know how to scan directories! - return false; -#endif -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::open_read -// Access: Published -// Description: Opens the indicated ifstream for reading the file, if -// possible. Returns true if successful, false -// otherwise. This requires the setting of the -// set_text()/set_binary() flags to open the file -// appropriately as indicated; it is an error to call -// open_read() without first calling one of set_text() -// or set_binary(). -//////////////////////////////////////////////////////////////////// -bool Filename:: -open_read(ifstream &stream) const { - assert(!get_pattern()); - assert(is_text() || is_binary()); - - ios_openmode open_mode = ios::in; - -#ifdef HAVE_IOS_BINARY - // For some reason, some systems (like Irix) don't define - // ios::binary. - if (!is_text()) { - open_mode |= ios::binary; - } -#endif - - string os_specific = to_os_specific(); - stream.clear(); - stream.open(os_specific.c_str(), open_mode); - return (!stream.fail()); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::open_write -// Access: Published -// Description: Opens the indicated ifstream for writing the file, if -// possible. Returns true if successful, false -// otherwise. This requires the setting of the -// set_text()/set_binary() flags to open the file -// appropriately as indicated; it is an error to call -// open_read() without first calling one of set_text() -// or set_binary(). -// -// If truncate is true, the file is truncated to zero -// length upon opening it, if it already exists. -// Otherwise, the file is kept at its original length. -//////////////////////////////////////////////////////////////////// -bool Filename:: -open_write(ofstream &stream, bool truncate) const { - assert(!get_pattern()); - assert(is_text() || is_binary()); - - ios_openmode open_mode = ios::out; - - if (truncate) { - open_mode |= ios::trunc; - - } else { - // Some systems insist on having ios::in set to prevent the file - // from being truncated when we open it. Makes ios::trunc kind of - // pointless, doesn't it? On the other hand, setting ios::in also - // seems to imply ios::nocreate (!), so we should only set this if - // the file already exists. - if (exists()) { - open_mode |= ios::in; - } - } - -#ifdef HAVE_IOS_BINARY - // For some reason, some systems (like Irix) don't define - // ios::binary. - if (!is_text()) { - open_mode |= ios::binary; - } -#endif - - stream.clear(); - string os_specific = to_os_specific(); -#ifdef HAVE_OPEN_MASK - stream.open(os_specific.c_str(), open_mode, 0666); -#else - stream.open(os_specific.c_str(), open_mode); -#endif - - return (!stream.fail()); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::open_append -// Access: Published -// Description: Opens the indicated ifstream for writing the file, if -// possible. Returns true if successful, false -// otherwise. This requires the setting of the -// set_text()/set_binary() flags to open the file -// appropriately as indicated; it is an error to call -// open_read() without first calling one of set_text() -// or set_binary(). -//////////////////////////////////////////////////////////////////// -bool Filename:: -open_append(ofstream &stream) const { - assert(!get_pattern()); - assert(is_text() || is_binary()); - - ios_openmode open_mode = ios::app; - -#ifdef HAVE_IOS_BINARY - // For some reason, some systems (like Irix) don't define - // ios::binary. - if (!is_text()) { - open_mode |= ios::binary; - } -#endif - - stream.clear(); - string os_specific = to_os_specific(); -#ifdef HAVE_OPEN_MASK - stream.open(os_specific.c_str(), open_mode, 0666); -#else - stream.open(os_specific.c_str(), open_mode); -#endif - - return (!stream.fail()); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::open_read_write -// Access: Published -// Description: Opens the indicated fstream for read/write access to -// the file, if possible. Returns true if successful, -// false otherwise. This requires the setting of the -// set_text()/set_binary() flags to open the file -// appropriately as indicated; it is an error to call -// open_read_write() without first calling one of -// set_text() or set_binary(). -//////////////////////////////////////////////////////////////////// -bool Filename:: -open_read_write(fstream &stream) const { - assert(!get_pattern()); - assert(is_text() || is_binary()); - - ios_openmode open_mode = ios::out | ios::in; - - // Since ios::in also seems to imply ios::nocreate (!), we must - // guarantee the file already exists before we try to open it. - if (!exists()) { - touch(); - } - -#ifdef HAVE_IOS_BINARY - // For some reason, some systems (like Irix) don't define - // ios::binary. - if (!is_text()) { - open_mode |= ios::binary; - } -#endif - - stream.clear(); - string os_specific = to_os_specific(); -#ifdef HAVE_OPEN_MASK - stream.open(os_specific.c_str(), open_mode, 0666); -#else - stream.open(os_specific.c_str(), open_mode); -#endif - - return (!stream.fail()); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::touch -// Access: Published -// Description: Updates the modification time of the file to the -// current time. If the file does not already exist, it -// will be created. Returns true if successful, false -// if there is an error. -//////////////////////////////////////////////////////////////////// -bool Filename:: -touch() const { - assert(!get_pattern()); -#ifdef WIN32_VC - // In Windows, we have to use the Windows API to do this reliably. - - // First, guarantee the file exists (and also get its handle). - string os_specific = to_os_specific(); - HANDLE fhandle; - fhandle = CreateFile(os_specific.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, - NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (fhandle == INVALID_HANDLE_VALUE) { - return false; - } - - // Now update the file time and date. - SYSTEMTIME sysnow; - FILETIME ftnow; - GetSystemTime(&sysnow); - if (!SystemTimeToFileTime(&sysnow, &ftnow)) { - CloseHandle(fhandle); - return false; - } - - if (!SetFileTime(fhandle, NULL, NULL, &ftnow)) { - CloseHandle(fhandle); - return false; - } - - CloseHandle(fhandle); - return true; - -#elif defined(HAVE_UTIME_H) - // Most Unix systems can do this explicitly. - - string os_specific = to_os_specific(); -#ifdef HAVE_CYGWIN - // In the Cygwin case, it seems we need to be sure to use the - // Cygwin-style name; some broken utime() implementation. That's - // almost the same thing as the original Panda-style name, but not - // exactly, so we first convert the Panda name to a Windows name, - // then convert it back to Cygwin, to ensure we get it exactly right - // by Cygwin rules. - { - char result[4096] = ""; - cygwin_conv_to_posix_path(os_specific.c_str(), result); - os_specific = result; - } -#endif // HAVE_CYGWIN - int result = utime(os_specific.c_str(), NULL); - if (result < 0) { - if (errno == ENOENT) { - // So the file doesn't already exist; create it. - int fd = creat(os_specific.c_str(), 0666); - if (fd < 0) { - perror(os_specific.c_str()); - return false; - } - close(fd); - return true; - } - perror(os_specific.c_str()); - return false; - } - return true; -#else // WIN32, HAVE_UTIME_H - // Other systems may not have an explicit control over the - // modification time. For these systems, we'll just temporarily - // open the file in append mode, then close it again (it gets closed - // when the ofstream goes out of scope). - ofstream file; - return open_append(file); -#endif // WIN32, HAVE_UTIME_H -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::chdir -// Access: Published -// Description: Changes directory to the specified location. -// Returns true if successful, false if failure. -//////////////////////////////////////////////////////////////////// -bool Filename:: -chdir() const { - Filename os_specific = to_os_specific(); - return (::chdir(os_specific.c_str()) >= 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::unlink -// Access: Published -// Description: Permanently deletes the file associated with the -// filename, if possible. Returns true if successful, -// false if failure (for instance, because the file did -// not exist, or because permissions were inadequate). -//////////////////////////////////////////////////////////////////// -bool Filename:: -unlink() const { - assert(!get_pattern()); - string os_specific = to_os_specific(); - return (::unlink(os_specific.c_str()) == 0); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::rename_to -// Access: Published -// Description: Renames the file to the indicated new filename. If -// the new filename is in a different directory, this -// will perform a move. Returns true if successful, -// false if failure. -//////////////////////////////////////////////////////////////////// -bool Filename:: -rename_to(const Filename &other) const { - assert(!get_pattern()); - string os_specific = to_os_specific(); - string other_os_specific = other.to_os_specific(); - return (rename(os_specific.c_str(), - other_os_specific.c_str()) == 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::make_dir -// Access: Published -// Description: Creates all the directories in the path to the file -// specified in the filename, except for the basename -// itself. This assumes that the Filename contains the -// name of a file, not a directory name; it ensures that -// the directory containing the file exists. -// -// However, if the filename ends in a slash, it assumes -// the Filename represents the name of a directory, and -// creates all the paths. -//////////////////////////////////////////////////////////////////// -bool Filename:: -make_dir() const { - assert(!get_pattern()); - if (empty()) { - return false; - } - Filename path; - if (_filename[_filename.length() - 1] == '/') { - // The Filename ends in a slash; it represents a directory. - path = (*this); - - } else { - // The Filename does not end in a slash; it represents a file. - path = get_dirname(); - } - - if (path.empty()) { - return false; - } - string dirname = path.get_fullpath(); - - // First, make sure everything up to the last path is known. We - // don't care too much if any of these fail; maybe they failed - // because the directory was already there. - size_t slash = dirname.find('/'); - while (slash != string::npos) { - Filename component(dirname.substr(0, slash)); - string os_specific = component.to_os_specific(); -#ifndef WIN32_VC - mkdir(os_specific.c_str(), 0777); -#else - mkdir(os_specific.c_str()); -#endif - slash = dirname.find('/', slash + 1); - } - - // Now make the last one, and check the return value. - Filename component(dirname); - string os_specific = component.to_os_specific(); -#ifndef WIN32_VC - int result = mkdir(os_specific.c_str(), 0777); -#else - int result = mkdir(os_specific.c_str()); -#endif - - return (result == 0); -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::atomic_compare_and_exchange_contents -// Access: Public -// Description: Uses native file-locking mechanisms to atomically -// replace the contents of a (small) file with the -// specified contents, assuming it hasn't changed since -// the last time the file was read. -// -// This is designed to be similar to -// AtomicAdjust::compare_and_exchange(). The method -// writes new_contents to the file, completely replacing -// the original contents; but only if the original -// contents exactly matched old_contents. If the file -// was modified, returns true. If, however, the -// original contents of the file did not exactly match -// old_contents, then the file is not modified, and -// false is returned. In either case, orig_contents is -// filled with the original contents of the file. -// -// If the file does not exist, it is implicitly created, -// and its original contents are empty. -// -// If an I/O error occurs on write, some of the file may -// or may not have been written, and false is returned. -// -// Expressed in pseudo-code, the logic is: -// -// orig_contents = file.read(); -// if (orig_contents == old_contents) { -// file.write(new_contents); -// return true; -// } -// return false; -// -// The operation is guaranteed to be atomic only if the -// only operations that read and write to this file are -// atomic_compare_and_exchange_contents() and -// atomic_read_contents(). -//////////////////////////////////////////////////////////////////// -bool Filename:: -atomic_compare_and_exchange_contents(string &orig_contents, - const string &old_contents, - const string &new_contents) const { -#ifdef WIN32_VC - string os_specific = to_os_specific(); - HANDLE hfile = CreateFile(os_specific.c_str(), GENERIC_READ | GENERIC_WRITE, - 0, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - while (hfile == INVALID_HANDLE_VALUE) { - DWORD error = GetLastError(); - if (error == ERROR_SHARING_VIOLATION) { - // If the file is locked by another process, yield and try again. - Sleep(0); - hfile = CreateFile(os_specific.c_str(), GENERIC_READ | GENERIC_WRITE, - 0, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - } else { - cerr << "Couldn't open file: " << os_specific - << ", error " << error << "\n"; - return false; - } - } - - if (hfile == INVALID_HANDLE_VALUE) { - cerr << "Couldn't open file: " << os_specific - << ", error " << GetLastError() << "\n"; - return false; - } - - static const size_t buf_size = 512; - char buf[buf_size]; - - orig_contents = string(); - - DWORD bytes_read; - if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific - << ", error " << GetLastError() << "\n"; - CloseHandle(hfile); - return false; - } - while (bytes_read > 0) { - orig_contents += string(buf, bytes_read); - - if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific - << ", error " << GetLastError() << "\n"; - CloseHandle(hfile); - return false; - } - } - - bool match = false; - if (orig_contents == old_contents) { - match = true; - SetFilePointer(hfile, 0, 0, FILE_BEGIN); - DWORD bytes_written; - if (!WriteFile(hfile, new_contents.data(), new_contents.size(), - &bytes_written, NULL)) { - cerr << "Error writing file: " << os_specific - << ", error " << GetLastError() << "\n"; - CloseHandle(hfile); - return false; - } - } - - CloseHandle(hfile); - return match; - -#else // WIN32_VC - string os_specific = to_os_specific(); - int fd = open(os_specific.c_str(), O_RDWR | O_CREAT, 0666); - if (fd < 0) { - perror(os_specific.c_str()); - return false; - } - - static const size_t buf_size = 512; - char buf[buf_size]; - - orig_contents = string(); - - lockf(fd, F_LOCK, 0); - - size_t bytes_read = read(fd, buf, buf_size); - while (bytes_read > 0) { - orig_contents += string(buf, bytes_read); - bytes_read = read(fd, buf, buf_size); - } - - if (bytes_read < 0) { - perror(os_specific.c_str()); - close(fd); - return false; - } - - bool match = false; - if (orig_contents == old_contents) { - match = true; - lseek(fd, 0, SEEK_SET); - ssize_t bytes_written = write(fd, new_contents.data(), new_contents.size()); - if (bytes_written < 0) { - perror(os_specific.c_str()); - close(fd); - return false; - } - } - - if (close(fd) < 0) { - perror(os_specific.c_str()); - return false; - } - - return match; -#endif // WIN32_VC -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::atomic_read_contents -// Access: Public -// Description: Uses native file-locking mechanisms to atomically -// read the contents of a (small) file. This is the -// only way to read a file protected by -// atomic_compare_and_exchange_contents(), and be -// confident that the read operation is actually atomic -// with respect to that method. -// -// If the file does not exist, it is implicitly created, -// and its contents are empty. -// -// If the file is read successfully, fills its contents -// in the indicated string, and returns true. If the -// file cannot be read, returns false. -//////////////////////////////////////////////////////////////////// -bool Filename:: -atomic_read_contents(string &contents) const { -#ifdef WIN32_VC - string os_specific = to_os_specific(); - HANDLE hfile = CreateFile(os_specific.c_str(), GENERIC_READ, - FILE_SHARE_READ, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - while (hfile == INVALID_HANDLE_VALUE) { - DWORD error = GetLastError(); - if (error == ERROR_SHARING_VIOLATION) { - // If the file is locked by another process, yield and try again. - Sleep(0); - hfile = CreateFile(os_specific.c_str(), GENERIC_READ, - FILE_SHARE_READ, NULL, OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - } else { - cerr << "Couldn't open file: " << os_specific - << ", error " << error << "\n"; - return false; - } - } - - static const size_t buf_size = 512; - char buf[buf_size]; - - contents = string(); - - DWORD bytes_read; - if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific - << ", error " << GetLastError() << "\n"; - CloseHandle(hfile); - return false; - } - while (bytes_read > 0) { - contents += string(buf, bytes_read); - - if (!ReadFile(hfile, buf, buf_size, &bytes_read, NULL)) { - cerr << "Error reading file: " << os_specific - << ", error " << GetLastError() << "\n"; - CloseHandle(hfile); - return false; - } - } - - CloseHandle(hfile); - return true; - -#else // WIN32_VC - string os_specific = to_os_specific(); - int fd = open(os_specific.c_str(), O_RDONLY | O_CREAT, 0666); - if (fd < 0) { - perror(os_specific.c_str()); - return false; - } - - static const size_t buf_size = 512; - char buf[buf_size]; - - contents = string(); - - lockf(fd, F_LOCK, 0); - - size_t bytes_read = read(fd, buf, buf_size); - while (bytes_read > 0) { - contents += string(buf, bytes_read); - bytes_read = read(fd, buf, buf_size); - } - - if (bytes_read < 0) { - perror(os_specific.c_str()); - close(fd); - return false; - } - - close(fd); - return true; -#endif // WIN32_VC -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::locate_basename -// Access: Protected -// Description: After the string has been reassigned, search for the -// slash marking the beginning of the basename, and set -// _dirname_end and _basename_start correctly. -//////////////////////////////////////////////////////////////////// -void Filename:: -locate_basename() { - // Scan for the last slash, which marks the end of the directory - // part. - if (_filename.empty()) { - _dirname_end = 0; - _basename_start = 0; - - } else { - - string::size_type slash = _filename.rfind('/'); - if (slash != string::npos) { - _basename_start = slash + 1; - _dirname_end = _basename_start; - - // One exception: in case there are multiple slashes in a row, - // we want to treat them as a single slash. The directory - // therefore actually ends at the first of these; back up a bit. - while (_dirname_end > 0 && _filename[_dirname_end-1] == '/') { - _dirname_end--; - } - - // Another exception: if the dirname was nothing but slashes, it - // was the root directory, or / itself. In this case the dirname - // does include the terminal slash (of course). - if (_dirname_end == 0) { - _dirname_end = 1; - } - - } else { - _dirname_end = 0; - _basename_start = 0; - } - } - - // Now: - - // _dirname_end is the last slash character, or 0 if there are no - // slash characters. - - // _basename_start is the character after the last slash character, - // or 0 if there are no slash characters. -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::locate_extension -// Access: Protected -// Description: Once the end of the directory prefix has been found, -// and _dirname_end and _basename_start are set -// correctly, search for the dot marking the beginning -// of the extension, and set _basename_end and -// _extension_start correctly. -//////////////////////////////////////////////////////////////////// -void Filename:: -locate_extension() { - // Now scan for the last dot after that slash. - if (_filename.empty()) { - _basename_end = string::npos; - _extension_start = string::npos; - - } else { - string::size_type dot = _filename.length() - 1; - - while (dot+1 > _basename_start && _filename[dot] != '.') { - --dot; - } - - if (dot+1 > _basename_start) { - _basename_end = dot; - _extension_start = dot + 1; - } else { - _basename_end = string::npos; - _extension_start = string::npos; - } - } - - // Now: - - // _basename_end is the last dot, or npos if there is no dot. - - // _extension_start is the character after the last dot, or npos if - // there is no dot. -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::locate_hash -// Access: Protected -// Description: Identifies the part of the filename that contains the -// sequence of hash marks, if any. -//////////////////////////////////////////////////////////////////// -void Filename:: -locate_hash() { - if (!get_pattern()) { - // If it's not a pattern-type filename, these are always set to - // the end of the string. - _hash_end = string::npos; - _hash_start = string::npos; - - } else { - // If it is a pattern-type filename, we must search for the hash - // marks, which could be anywhere (but are usually toward the - // end). - _hash_end = _filename.rfind('#'); - if (_hash_end == string::npos) { - _hash_end = string::npos; - _hash_start = string::npos; - - } else { - _hash_start = _hash_end; - ++_hash_end; - while (_hash_start > 0 && _filename[_hash_start - 1] == '#') { - --_hash_start; - } - } - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::get_common_prefix -// Access: Protected -// Description: Returns the length of the longest common initial -// substring of this string and the other one that ends -// in a slash. This is the lowest directory common to -// both filenames. -//////////////////////////////////////////////////////////////////// -size_t Filename:: -get_common_prefix(const string &other) const { - size_t len = 0; - - // First, get the length of the common initial substring. - while (len < length() && len < other.length() && - _filename[len] == other[len]) { - len++; - } - - // Now insist that it ends in a slash. - while (len > 0 && _filename[len-1] != '/') { - len--; - } - - return len; -} - -//////////////////////////////////////////////////////////////////// -// Function: Filename::count_slashes -// Access: Protected, Static -// Description: Returns the number of non-consecutive slashes in the -// indicated string, not counting a terminal slash. -//////////////////////////////////////////////////////////////////// -int Filename:: -count_slashes(const string &str) { - int count = 0; - string::const_iterator si; - si = str.begin(); - - while (si != str.end()) { - if (*si == '/') { - count++; - - // Skip consecutive slashes. - ++si; - while (*si == '/') { - ++si; - } - if (si == str.end()) { - // Oops, that was a terminal slash. Don't count it. - count--; - } - - } else { - ++si; - } - } - - return count; -} - - -//////////////////////////////////////////////////////////////////// -// Function: Filename::r_make_canonical -// Access: Protected -// Description: The recursive implementation of make_canonical(). -//////////////////////////////////////////////////////////////////// -bool Filename:: -r_make_canonical(const Filename &cwd) { - if (get_fullpath() == "/") { - // If we reached the root, the whole path doesn't exist. Report - // failure. - return false; - } - - // First, try to cd to the filename directly. - string os_specific = to_os_specific(); - - if (::chdir(os_specific.c_str()) >= 0) { - // That worked, save the full path string. - (*this) = ExecutionEnvironment::get_cwd(); - - // And restore the current working directory. - string osdir = cwd.to_os_specific(); - if (::chdir(osdir.c_str()) < 0) { - cerr << "Error! Cannot change back to " << cwd << "\n"; - } - return true; - } - - // That didn't work; maybe it's not a directory. Recursively go to - // the directory above. - - Filename dir(get_dirname()); - - if (dir.empty()) { - // No dirname means the file is in this directory. - set_dirname(cwd); - return true; - } - - if (!dir.r_make_canonical(cwd)) { - return false; - } - set_dirname(dir); - return true; -} - diff --git a/ppremake/filename.h b/ppremake/filename.h deleted file mode 100644 index b8b09cafcc..0000000000 --- a/ppremake/filename.h +++ /dev/null @@ -1,227 +0,0 @@ -// Filename: filename.h -// Created by: drose (18Jan99) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef FILENAME_H -#define FILENAME_H - -#include "ppremake.h" - -#include "vector_string.h" - -#include - -class DSearchPath; - -//////////////////////////////////////////////////////////////////// -// Class : Filename -// Description : The name of a file, such as a texture file or an Egg -// file. Stores the full pathname, and includes -// functions for extracting out the directory prefix -// part and the file extension and stuff. -// -// A Filename is also aware of the mapping between the -// Unix-like filename convention we use internally, and -// the local OS's specific filename convention, and it -// knows how to perform basic OS-specific I/O, like -// testing for file existence and searching a -// searchpath, as well as the best way to open an -// fstream for reading or writing. -//////////////////////////////////////////////////////////////////// -class EXPCL_DTOOL Filename { -PUBLISHED: - enum Type { - // These type values must fit within the bits allocated for - // F_type, below. - T_general = 0x00, - T_dso = 0x01, - T_executable = 0x02, - // Perhaps other types will be added later. - }; - -public: - enum Flags { - F_type = 0x0f, - F_binary = 0x10, - F_text = 0x20, - F_pattern = 0x40, - }; - -PUBLISHED: - INLINE Filename(const string &filename = ""); - INLINE Filename(const char *filename); - INLINE Filename(const Filename ©); - Filename(const Filename &dirname, const Filename &basename); - INLINE ~Filename(); - - // Static constructors to explicitly create a filename that refers - // to a text or binary file. This is in lieu of calling set_text() - // or set_binary() or set_type(). - INLINE static Filename text_filename(const string &filename); - INLINE static Filename binary_filename(const string &filename); - INLINE static Filename dso_filename(const string &filename); - INLINE static Filename executable_filename(const string &filename); - - INLINE static Filename pattern_filename(const string &filename); - - static Filename from_os_specific(const string &os_specific, - Type type = T_general); - static Filename expand_from(const string &user_string, - Type type = T_general); - static Filename temporary(const string &dirname, const string &prefix, - const string &suffix = string(), - Type type = T_general); - - // Assignment is via the = operator. - INLINE Filename &operator = (const string &filename); - INLINE Filename &operator = (const char *filename); - INLINE Filename &operator = (const Filename ©); - - // And retrieval is by any of the classic string operations. - INLINE operator const string & () const; - INLINE const char *c_str() const; - INLINE bool empty() const; - INLINE size_t length() const; - INLINE char operator [] (int n) const; - - INLINE string substr(size_t begin, size_t end = string::npos) const; - - // Or, you can use any of these. - INLINE string get_fullpath() const; - INLINE string get_dirname() const; - INLINE string get_basename() const; - INLINE string get_fullpath_wo_extension() const; - INLINE string get_basename_wo_extension() const; - INLINE string get_extension() const; - - // You can also use any of these to reassign pieces of the filename. - void set_fullpath(const string &s); - void set_dirname(const string &s); - void set_basename(const string &s); - void set_fullpath_wo_extension(const string &s); - void set_basename_wo_extension(const string &s); - void set_extension(const string &s); - - // Setting these flags appropriately is helpful when opening or - // searching for a file; it helps the Filename resolve OS-specific - // conventions (for instance, that dynamic library names should - // perhaps be changed from .so to .dll). - INLINE void set_binary(); - INLINE void set_text(); - INLINE bool is_binary() const; - INLINE bool is_text() const; - - INLINE void set_type(Type type); - INLINE Type get_type() const; - - INLINE void set_pattern(bool pattern); - INLINE bool get_pattern() const; - - INLINE bool has_hash() const; - Filename get_filename_index(int index) const; - - INLINE string get_hash_to_end() const; - void set_hash_to_end(const string &s); - - void extract_components(vector_string &components) const; - void standardize(); - - // The following functions deal with the outside world. - - INLINE bool is_local() const; - INLINE bool is_fully_qualified() const; - void make_absolute(); - void make_absolute(const Filename &start_directory); - - bool make_canonical(); - bool make_true_case(); - - string to_os_specific() const; - string to_os_generic() const; - string to_os_short_name() const; - string to_os_long_name() const; - - bool exists() const; - bool is_regular_file() const; - bool is_directory() const; - bool is_executable() const; - int compare_timestamps(const Filename &other, - bool this_missing_is_old = true, - bool other_missing_is_old = true) const; - time_t get_timestamp() const; - time_t get_access_timestamp() const; - off_t get_file_size() const; - - bool resolve_filename(const DSearchPath &searchpath, - const string &default_extension = string()); - bool make_relative_to(Filename directory, bool allow_backups = true); - int find_on_searchpath(const DSearchPath &searchpath); - - bool scan_directory(vector_string &contents) const; - - bool open_read(ifstream &stream) const; - bool open_write(ofstream &stream, bool truncate = true) const; - bool open_append(ofstream &stream) const; - bool open_read_write(fstream &stream) const; - - bool chdir() const; - bool touch() const; - bool unlink() const; - bool rename_to(const Filename &other) const; - - bool make_dir() const; - - // Comparison operators are handy. - INLINE bool operator == (const string &other) const; - INLINE bool operator != (const string &other) const; - INLINE bool operator < (const string &other) const; - INLINE int compare_to(const Filename &other) const; - - INLINE void output(ostream &out) const; - -public: - bool atomic_compare_and_exchange_contents(string &orig_contents, const string &old_contents, const string &new_contents) const; - bool atomic_read_contents(string &contents) const; - -protected: - void locate_basename(); - void locate_extension(); - void locate_hash(); - size_t get_common_prefix(const string &other) const; - static int count_slashes(const string &str); - bool r_make_canonical(const Filename &cwd); - - string _filename; - // We'll make these size_t instead of string::size_type to help out - // cppParser. - size_t _dirname_end; - size_t _basename_start; - size_t _basename_end; - size_t _extension_start; - size_t _hash_start; - size_t _hash_end; - - int _flags; -}; - -INLINE ostream &operator << (ostream &out, const Filename &n) { - n.output(out); - return out; -} - -#include "filename.I" - -#endif - - - diff --git a/ppremake/globPattern.I b/ppremake/globPattern.I deleted file mode 100644 index 72d0c7e118..0000000000 --- a/ppremake/globPattern.I +++ /dev/null @@ -1,170 +0,0 @@ -// Filename: globPattern.I -// Created by: drose (30May00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE GlobPattern:: -GlobPattern(const string &pattern) : _pattern(pattern) { - _case_sensitive = true; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE GlobPattern:: -GlobPattern(const GlobPattern ©) : - _pattern(copy._pattern), - _case_sensitive(copy._case_sensitive) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void GlobPattern:: -operator = (const GlobPattern ©) { - _pattern = copy._pattern; - _case_sensitive = copy._case_sensitive; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::operator == -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool GlobPattern:: -operator == (const GlobPattern &other) const { - return (_pattern == other._pattern && _case_sensitive == other._case_sensitive); -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::operator != -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool GlobPattern:: -operator != (const GlobPattern &other) const { - return !operator == (other); -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::operator < -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool GlobPattern:: -operator < (const GlobPattern &other) const { - if (_case_sensitive != other._case_sensitive) { - return (int)_case_sensitive < (int)other._case_sensitive; - } - return _pattern < other._pattern; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::set_pattern -// Access: Public -// Description: Changes the pattern string that the GlobPattern -// object matches. -//////////////////////////////////////////////////////////////////// -INLINE void GlobPattern:: -set_pattern(const string &pattern) { - _pattern = pattern; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::get_pattern -// Access: Public -// Description: Returns the pattern string that the GlobPattern -// object matches. -//////////////////////////////////////////////////////////////////// -INLINE const string &GlobPattern:: -get_pattern() const { - return _pattern; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::set_case_sensitive -// Access: Public -// Description: Sets whether the match is case sensitive (true) or -// case insensitive (false). The default is case -// sensitive. -//////////////////////////////////////////////////////////////////// -INLINE void GlobPattern:: -set_case_sensitive(bool case_sensitive) { - _case_sensitive = case_sensitive; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::get_case_sensitive -// Access: Public -// Description: Returns whether the match is case sensitive (true) or -// case insensitive (false). The default is case -// sensitive. -//////////////////////////////////////////////////////////////////// -INLINE bool GlobPattern:: -get_case_sensitive() const { - return _case_sensitive; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::set_nomatch_chars -// Access: Public -// Description: Specifies a set of characters that are not matched by -// * or ?. -//////////////////////////////////////////////////////////////////// -INLINE void GlobPattern:: -set_nomatch_chars(const string &nomatch_chars) { - _nomatch_chars = nomatch_chars; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::get_nomatch_chars -// Access: Public -// Description: Returns the set of characters that are not matched by -// * or ?. -//////////////////////////////////////////////////////////////////// -INLINE const string &GlobPattern:: -get_nomatch_chars() const { - return _nomatch_chars; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::matches -// Access: Public -// Description: Returns true if the candidate string matches the -// pattern, false otherwise. -//////////////////////////////////////////////////////////////////// -INLINE bool GlobPattern:: -matches(const string &candidate) const { - return matches_substr(_pattern.begin(), _pattern.end(), - candidate.begin(), candidate.end()); -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::output -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void GlobPattern:: -output(ostream &out) const { - out << _pattern; -} diff --git a/ppremake/globPattern.cxx b/ppremake/globPattern.cxx deleted file mode 100644 index 911bc47c81..0000000000 --- a/ppremake/globPattern.cxx +++ /dev/null @@ -1,354 +0,0 @@ -// Filename: globPattern.cxx -// Created by: drose (30May00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#include "globPattern.h" -#include - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::has_glob_characters -// Access: Public -// Description: Returns true if the pattern includes any special -// globbing characters, or false if it is just a literal -// string. -//////////////////////////////////////////////////////////////////// -bool GlobPattern:: -has_glob_characters() const { - string::const_iterator pi; - pi = _pattern.begin(); - while (pi != _pattern.end()) { - switch (*pi) { - case '*': - case '?': - case '[': - return true; - - case '\\': - ++pi; - if (pi == _pattern.end()) { - return false; - } - } - ++pi; - } - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::get_const_prefix -// Access: Public -// Description: Returns the initial part of the pattern before the -// first glob character. Since many glob patterns begin -// with a sequence of static characters and end with one -// or more glob characters, this can be used to -// optimized searches through sorted indices. -//////////////////////////////////////////////////////////////////// -string GlobPattern:: -get_const_prefix() const { - string prefix; - - size_t p = 0; // current point - size_t q = 0; // starting point - while (p < _pattern.size()) { - switch (_pattern[p]) { - case '*': - case '?': - case '[': - return prefix + _pattern.substr(q, p - q); - - case '\\': - // Skip over the backslash. - prefix += _pattern.substr(q, p - q); - ++p; - q = p; - } - ++p; - } - return prefix += _pattern.substr(q, p - q); -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::match_files -// Access: Public -// Description: Treats the GlobPattern as a filename pattern, and -// returns a list of any actual files that match the -// pattern. This is the behavior of the standard Posix -// glob() function. Any part of the filename may -// contain glob characters, including intermediate -// directory names. -// -// If cwd is specified, it is the directory that -// relative filenames are taken to be relative to; -// otherwise, the actual current working directory is -// assumed. -// -// The return value is the number of files matched, -// which are added to the results vector. -//////////////////////////////////////////////////////////////////// -int GlobPattern:: -match_files(vector_string &results, const Filename &cwd) { - string prefix, pattern, suffix; - - string source = _pattern; - if (!source.empty() && source[0] == '/') { - // If the first character is a slash, that becomes the prefix. - prefix = "/"; - source = source.substr(1); - } - - size_t slash = source.find('/'); - if (slash == string::npos) { - pattern = source; - } else { - pattern = source.substr(0, slash); - suffix = source.substr(slash + 1); - } - - GlobPattern glob(pattern); - return glob.r_match_files(prefix, suffix, results, cwd); -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::r_match_files -// Access: Private -// Description: The recursive implementation of match_files(). -//////////////////////////////////////////////////////////////////// -int GlobPattern:: -r_match_files(const Filename &prefix, const string &suffix, - vector_string &results, const Filename &cwd) { - string next_pattern, next_suffix; - - size_t slash = suffix.find('/'); - if (slash == string::npos) { - next_pattern = suffix; - } else { - next_pattern = suffix.substr(0, slash); - next_suffix = suffix.substr(slash + 1); - } - - Filename parent_dir; - if (prefix.is_local() && !cwd.empty()) { - parent_dir = Filename(cwd, prefix); - } else { - parent_dir = prefix; - } - - GlobPattern next_glob(next_pattern); - - if (!has_glob_characters()) { - // If there are no special characters in the pattern, it's a - // literal match. - if (suffix.empty()) { - // Time to stop. - Filename single_filename(parent_dir, _pattern); - if (single_filename.exists()) { - results.push_back(Filename(prefix, _pattern)); - return 1; - } - return 0; - } - - return next_glob.r_match_files(Filename(prefix, _pattern), - next_suffix, results, cwd); - - } - - // If there *are* special glob characters, we must attempt to - // match the pattern against the files in this directory. - - vector_string dir_files; - if (!parent_dir.scan_directory(dir_files)) { - // Not a directory, or unable to read directory; stop here. - return 0; - } - - // Now go through each file in the directory looking for one that - // matches the pattern. - int num_matched = 0; - - vector_string::const_iterator fi; - for (fi = dir_files.begin(); fi != dir_files.end(); ++fi) { - const string &local_file = (*fi); - if (_pattern[0] == '.' || (local_file.empty() || local_file[0] != '.')) { - if (matches(local_file)) { - // We have a match; continue. - if (suffix.empty()) { - results.push_back(Filename(prefix, local_file)); - num_matched++; - } else { - num_matched += next_glob.r_match_files(Filename(prefix, local_file), - next_suffix, results, cwd); - } - } - } - } - - return num_matched; -} - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::matches_substr -// Access: Private -// Description: The recursive implementation of matches(). This -// returns true if the pattern substring [pi, pend) -// matches the candidate substring [ci, cend), false -// otherwise. -//////////////////////////////////////////////////////////////////// -bool GlobPattern:: -matches_substr(string::const_iterator pi, string::const_iterator pend, - string::const_iterator ci, string::const_iterator cend) const { - // If we run out of pattern or candidate string, it's a match only - // if they both ran out at the same time. - if (pi == pend || ci == cend) { - // A special exception: we allow ci to reach the end before pi, - // only if pi is one character before the end and that last - // character is '*'. - if ((ci == cend) && (std::distance(pi, pend) == 1) && (*pi) == '*') { - return true; - } - return (pi == pend && ci == cend); - } - - switch (*pi) { - - case '*': - // A '*' in the pattern string means to match any sequence of zero - // or more characters in the candidate string. This means we have - // to recurse twice: either consume one character of the candidate - // string and continue to try matching the *, or stop trying to - // match the * here. - if (_nomatch_chars.find(*ci) == string::npos) { - return - matches_substr(pi, pend, ci + 1, cend) || - matches_substr(pi + 1, pend, ci, cend); - } else { - // On the other hand, if this is one of the nomatch chars, we - // can only stop here. - return matches_substr(pi + 1, pend, ci, cend); - } - - case '?': - // A '?' in the pattern string means to match exactly one - // character in the candidate string. That's easy. - return matches_substr(pi + 1, pend, ci + 1, cend); - - case '[': - // An open square bracket begins a set. - ++pi; - if ((*pi) == '!') { - ++pi; - if (matches_set(pi, pend, *ci)) { - return false; - } - } else { - if (!matches_set(pi, pend, *ci)) { - return false; - } - } - if (pi == pend) { - // Oops, there wasn't a closing square bracket. - return false; - } - return matches_substr(pi + 1, pend, ci + 1, cend); - - case '\\': - // A backslash escapes the next special character. - ++pi; - if (pi == pend) { - return false; - } - // fall through. - - default: - // Anything else means to match exactly that. - if (_case_sensitive) { - if ((*pi) != (*ci)) { - return false; - } - } else { - if (tolower(*pi) != tolower(*ci)) { - return false; - } - } - return matches_substr(pi + 1, pend, ci + 1, cend); - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: GlobPattern::matches_set -// Access: Private -// Description: Called when an unescaped open square bracked is -// scanned, this is called with pi positioned after the -// opening square bracket, scans the set sequence, -// leaving pi positioned on the closing square bracket, -// and returns true if the indicated character matches -// the set of characters indicated, false otherwise. -//////////////////////////////////////////////////////////////////// -bool GlobPattern:: -matches_set(string::const_iterator &pi, string::const_iterator pend, - char ch) const { - bool matched = false; - - while (pi != pend && (*pi) != ']') { - if ((*pi) == '\\') { - // Backslash escapes the next character. - ++pi; - if (pi == pend) { - return false; - } - } - - if (ch == (*pi)) { - matched = true; - } - - // Maybe it's an a-z style range? - char start = (*pi); - ++pi; - if (pi != pend && (*pi) == '-') { - ++pi; - if (pi != pend && (*pi) != ']') { - // Yes, we have a range: start-end. - - if ((*pi) == '\\') { - // Backslash escapes. - ++pi; - if (pi == pend) { - return false; - } - } - - char end = (*pi); - ++pi; - - if (ch >= start && ch <= end || - (!_case_sensitive && - ((tolower(ch) >= start && tolower(ch) <= end) || - (toupper(ch) >= start && toupper(ch) <= end)))) { - matched = true; - } - } else { - // This was a - at the end of the string. - if (ch == '-') { - matched = true; - } - } - } - } - - return matched; -} - - - diff --git a/ppremake/globPattern.h b/ppremake/globPattern.h deleted file mode 100644 index 2c20452cd9..0000000000 --- a/ppremake/globPattern.h +++ /dev/null @@ -1,90 +0,0 @@ -// Filename: globPattern.h -// Created by: drose (30May00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef GLOBPATTERN_H -#define GLOBPATTERN_H - -#include "ppremake.h" -#include "filename.h" -#include "vector_string.h" - -//////////////////////////////////////////////////////////////////// -// Class : GlobPattern -// Description : This class can be used to test for string matches -// against standard Unix-shell filename globbing -// conventions. It serves as a portable standin for the -// Posix fnmatch() call. -// -// A GlobPattern is given a pattern string, which can -// contain operators like *, ?, and []. Then it can be -// tested against any number of candidate strings; for -// each candidate, it will indicate whether the string -// matches the pattern or not. It can be used, for -// example, to scan a directory for all files matching a -// particular pattern. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA GlobPattern { -public: - INLINE GlobPattern(const string &pattern = string()); - INLINE GlobPattern(const GlobPattern ©); - INLINE void operator = (const GlobPattern ©); - - INLINE bool operator == (const GlobPattern &other) const; - INLINE bool operator != (const GlobPattern &other) const; - INLINE bool operator < (const GlobPattern &other) const; - - INLINE void set_pattern(const string &pattern); - INLINE const string &get_pattern() const; - - INLINE void set_case_sensitive(bool case_sensitive); - INLINE bool get_case_sensitive() const; - - INLINE void set_nomatch_chars(const string &nomatch_chars); - INLINE const string &get_nomatch_chars() const; - - INLINE bool matches(const string &candidate) const; - - INLINE void output(ostream &out) const; - - bool has_glob_characters() const; - string get_const_prefix() const; - int match_files(vector_string &results, const Filename &cwd = Filename()); - -private: - bool matches_substr(string::const_iterator pi, - string::const_iterator pend, - string::const_iterator ci, - string::const_iterator cend) const; - - bool matches_set(string::const_iterator &pi, - string::const_iterator pend, - char ch) const; - - int r_match_files(const Filename &prefix, const string &suffix, - vector_string &results, const Filename &cwd); - - string _pattern; - bool _case_sensitive; - string _nomatch_chars; -}; - -INLINE ostream &operator << (ostream &out, const GlobPattern &glob) { - glob.output(out); - return out; -} - - -#include "globPattern.I" - -#endif diff --git a/ppremake/gnu_getopt.c b/ppremake/gnu_getopt.c deleted file mode 100644 index 7adc589e33..0000000000 --- a/ppremake/gnu_getopt.c +++ /dev/null @@ -1,755 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94 - 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 the - Free Software Foundation; either version 2, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. */ - - -#include "ppremake.h" - -#if !defined(HAVE_GETOPT) - -#ifdef WIN32_VC -/* This file seems particularly egregious with this particular warning, - but it's not clear why. Disable. */ -/* C4028: formal parameter N different from declaration */ -#pragma warning (disable : 4028) -#endif - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -#define _NO_PROTO -#endif - -#ifndef __STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -#include -#endif /* GNU C library. */ - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "gnu_getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg = NULL; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* XXX 1003.2 says this must be 1 before any call. */ -int optind = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return EOF with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -#include -#define my_index strchr -#else - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -char *getenv (); - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -#ifndef __STDC__ -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -#endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -static const char * -_getopt_initialize (optstring) - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind = 1; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns `EOF'. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0) - optstring = _getopt_initialize (optstring); - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc - && (argv[optind][0] != '-' || argv[optind][1] == '\0')) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return EOF; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if ((argv[optind][0] != '-' || argv[optind][1] == '\0')) - { - if (ordering == REQUIRE_ORDER) - return EOF; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if (nameend - nextchar == (int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, "%s: option `%s' is ambiguous\n", - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - "%s: option `--%s' doesn't allow an argument\n", - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - "%s: option `%c%s' doesn't allow an argument\n", - argv[0], argv[optind - 1][0], pfound->name); - } - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, "%s: option `%s' requires an argument\n", - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, "%s: unrecognized option `--%s'\n", - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, "%s: unrecognized option `%c%s'\n", - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); - else - fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c); - } - optopt = c; - return '?'; - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: option requires an argument -- %c\n", - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* _LIBC or not __GNU_LIBRARY__. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == EOF) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - -#endif /* HAVE_GETOPT */ diff --git a/ppremake/gnu_getopt.h b/ppremake/gnu_getopt.h deleted file mode 100644 index df9d85c005..0000000000 --- a/ppremake/gnu_getopt.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989, 1990, 1991, 1992, 1993 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 the - Free Software Foundation; either version 2, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. */ - -#ifndef _GNU_GETOPT_H -#define _GNU_GETOPT_H 1 - -/* We don't want to collide with a system getopt() it if it exists. - Redefine our symbols accordingly. */ - -#define getopt gnu_getopt -#define optind gnu_optind -#define opterr gnu_opterr -#define optopt gnu_optopt -#define optarg gnu_optarg -#define getopt_long gnu_getopt_long -#define getopt_long_only gnu_getopt_long_only - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -#if __STDC__ - const char *name; -#else - char *name; -#endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -extern int -getopt (int argc, char *const *argv, const char *shortopts); -extern int -getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *long_options, int *opt_index); -extern int -getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *long_options, - int *opt_index); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); - -#ifdef __cplusplus -} -#endif - -#endif /* _GETOPT_H */ diff --git a/ppremake/gnu_regex.c b/ppremake/gnu_regex.c deleted file mode 100644 index ae660560bb..0000000000 --- a/ppremake/gnu_regex.c +++ /dev/null @@ -1,4946 +0,0 @@ -/* Extended regular expression matching and search library, - version 0.12. - (Implements POSIX draft P10003.2/D11.2, except for - internationalization features.) - - Copyright (C) 1993 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* AIX requires this to be the first thing in the file. */ -#if defined (_AIX) && !defined (REGEX_MALLOC) - #pragma alloca -#endif - -#include "ppremake.h" - -#if !defined(HAVE_REGEX_H) - -#define _GNU_SOURCE - -/* We need this for `regex.h', and perhaps for the Emacs include files. */ -#include - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* The `emacs' switch turns on certain matching commands - that make sense only in Emacs. */ -#ifdef emacs - -#include "lisp.h" -#include "buffer.h" -#include "syntax.h" - -/* Emacs uses `NULL' as a predicate. */ -#undef NULL - -#else /* not emacs */ - -/* We used to test for `BSTRING' here, but only GCC and Emacs define - `BSTRING', as far as I know, and neither of them use this code. */ -#if HAVE_STRING_H || STDC_HEADERS -#include -#ifndef bcmp -#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) -#endif -#ifndef bcopy -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif -#ifndef bzero -#define bzero(s, n) memset ((s), 0, (n)) -#endif -#else -#include -#endif - -#ifdef STDC_HEADERS -#include -#else -char *malloc (); -char *realloc (); -#endif - - -/* Define the syntax stuff for \<, \>, etc. */ - -/* This must be nonzero for the wordchar and notwordchar pattern - commands in re_match_2. */ -#ifndef Sword -#define Sword 1 -#endif - -#ifdef SYNTAX_TABLE - -extern char *re_syntax_table; - -#else /* not SYNTAX_TABLE */ - -/* How many characters in the character set. */ -#define CHAR_SET_SIZE 256 - -static char re_syntax_table[CHAR_SET_SIZE]; - -static void -init_syntax_once () -{ - register int c; - static int done = 0; - - if (done) - return; - - bzero (re_syntax_table, sizeof re_syntax_table); - - for (c = 'a'; c <= 'z'; c++) - re_syntax_table[c] = Sword; - - for (c = 'A'; c <= 'Z'; c++) - re_syntax_table[c] = Sword; - - for (c = '0'; c <= '9'; c++) - re_syntax_table[c] = Sword; - - re_syntax_table['_'] = Sword; - - done = 1; -} - -#endif /* not SYNTAX_TABLE */ - -#define SYNTAX(c) re_syntax_table[c] - -#endif /* not emacs */ - -/* Get the interface, including the syntax bits. */ -#include "gnu_regex.h" - -/* isalpha etc. are used for the character classes. */ -#include - -#ifndef isascii -#define isascii(c) 1 -#endif - -#ifdef isblank -#define ISBLANK(c) (isascii (c) && isblank (c)) -#else -#define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -#ifdef isgraph -#define ISGRAPH(c) (isascii (c) && isgraph (c)) -#else -#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c)) -#endif - -#define ISPRINT(c) (isascii (c) && isprint (c)) -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#define ISALNUM(c) (isascii (c) && isalnum (c)) -#define ISALPHA(c) (isascii (c) && isalpha (c)) -#define ISCNTRL(c) (isascii (c) && iscntrl (c)) -#define ISLOWER(c) (isascii (c) && islower (c)) -#define ISPUNCT(c) (isascii (c) && ispunct (c)) -#define ISSPACE(c) (isascii (c) && isspace (c)) -#define ISUPPER(c) (isascii (c) && isupper (c)) -#define ISXDIGIT(c) (isascii (c) && isxdigit (c)) - -#ifndef NULL -#define NULL 0 -#endif - -/* We remove any previous definition of `SIGN_EXTEND_CHAR', - since ours (we hope) works properly with all combinations of - machines, compilers, `char' and `unsigned char' argument types. - (Per Bothner suggested the basic approach.) */ -#undef SIGN_EXTEND_CHAR -#if __STDC__ -#define SIGN_EXTEND_CHAR(c) ((signed char) (c)) -#else /* not __STDC__ */ -/* As in Harbison and Steele. */ -#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) -#endif - -/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we - use `alloca' instead of `malloc'. This is because using malloc in - re_search* or re_match* could cause memory leaks when C-g is used in - Emacs; also, malloc is slower and causes storage fragmentation. On - the other hand, malloc is more portable, and easier to debug. - - Because we sometimes use alloca, some routines have to be macros, - not functions -- `alloca'-allocated space disappears at the end of the - function it is called in. */ - -#ifdef REGEX_MALLOC - -#define REGEX_ALLOCATE malloc -#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize) - -#else /* not REGEX_MALLOC */ - -/* Emacs already defines alloca, sometimes. */ -#ifndef alloca - -/* Make alloca work the best possible way. */ -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not __GNUC__ */ -#if HAVE_ALLOCA_H -#include -#else /* not __GNUC__ or HAVE_ALLOCA_H */ -#ifndef _AIX /* Already did AIX, up at the top. */ -char *alloca (); -#endif /* not _AIX */ -#endif /* not HAVE_ALLOCA_H */ -#endif /* not __GNUC__ */ - -#endif /* not alloca */ - -#define REGEX_ALLOCATE alloca - -/* Assumes a `char *destination' variable. */ -#define REGEX_REALLOCATE(source, osize, nsize) \ - (destination = (char *) alloca (nsize), \ - bcopy (source, destination, osize), \ - destination) - -#endif /* not REGEX_MALLOC */ - - -/* True if `size1' is non-NULL and PTR is pointing anywhere inside - `string1' or just past its end. This works if PTR is NULL, which is - a good thing. */ -#define FIRST_STRING_P(ptr) \ - (size1 && string1 <= (ptr) && (ptr) <= string1 + size1) - -/* (Re)Allocate N items of type T using malloc, or fail. */ -#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) -#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) -#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) - -#define BYTEWIDTH 8 /* In bits. */ - -#define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) - -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - -typedef char boolean; -#define false 0 -#define true 1 - -/* These are the command codes that appear in compiled regular - expressions. Some opcodes are followed by argument bytes. A - command code can specify any interpretation whatsoever for its - arguments. Zero bytes may appear in the compiled regular expression. - - The value of `exactn' is needed in search.c (search_buffer) in Emacs. - So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of - `exactn' we use here must also be 1. */ - -typedef enum -{ - no_op = 0, - - /* Followed by one byte giving n, then by n literal bytes. */ - exactn = 1, - - /* Matches any (more or less) character. */ - anychar, - - /* Matches any one char belonging to specified set. First - following byte is number of bitmap bytes. Then come bytes - for a bitmap saying which chars are in. Bits in each byte - are ordered low-bit-first. A character is in the set if its - bit is 1. A character too large to have a bit in the map is - automatically not in the set. */ - charset, - - /* Same parameters as charset, but match any character that is - not one of those specified. */ - charset_not, - - /* Start remembering the text that is matched, for storing in a - register. Followed by one byte with the register number, in - the range 0 to one less than the pattern buffer's re_nsub - field. Then followed by one byte with the number of groups - inner to this one. (This last has to be part of the - start_memory only because we need it in the on_failure_jump - of re_match_2.) */ - start_memory, - - /* Stop remembering the text that is matched and store it in a - memory register. Followed by one byte with the register - number, in the range 0 to one less than `re_nsub' in the - pattern buffer, and one byte with the number of inner groups, - just like `start_memory'. (We need the number of inner - groups here because we don't have any easy way of finding the - corresponding start_memory when we're at a stop_memory.) */ - stop_memory, - - /* Match a duplicate of something remembered. Followed by one - byte containing the register number. */ - duplicate, - - /* Fail unless at beginning of line. */ - begline, - - /* Fail unless at end of line. */ - endline, - - /* Succeeds if at beginning of buffer (if emacs) or at beginning - of string to be matched (if not). */ - begbuf, - - /* Analogously, for end of buffer/string. */ - endbuf, - - /* Followed by two byte relative address to which to jump. */ - jump, - - /* Same as jump, but marks the end of an alternative. */ - jump_past_alt, - - /* Followed by two-byte relative address of place to resume at - in case of failure. */ - on_failure_jump, - - /* Like on_failure_jump, but pushes a placeholder instead of the - current string position when executed. */ - on_failure_keep_string_jump, - - /* Throw away latest failure point and then jump to following - two-byte relative address. */ - pop_failure_jump, - - /* Change to pop_failure_jump if know won't have to backtrack to - match; otherwise change to jump. This is used to jump - back to the beginning of a repeat. If what follows this jump - clearly won't match what the repeat does, such that we can be - sure that there is no use backtracking out of repetitions - already matched, then we change it to a pop_failure_jump. - Followed by two-byte address. */ - maybe_pop_jump, - - /* Jump to following two-byte address, and push a dummy failure - point. This failure point will be thrown away if an attempt - is made to use it for a failure. A `+' construct makes this - before the first repeat. Also used as an intermediary kind - of jump when compiling an alternative. */ - dummy_failure_jump, - - /* Push a dummy failure point and continue. Used at the end of - alternatives. */ - push_dummy_failure, - - /* Followed by two-byte relative address and two-byte number n. - After matching N times, jump to the address upon failure. */ - succeed_n, - - /* Followed by two-byte relative address, and two-byte number n. - Jump to the address N times, then fail. */ - jump_n, - - /* Set the following two-byte relative address to the - subsequent two-byte number. The address *includes* the two - bytes of number. */ - set_number_at, - - wordchar, /* Matches any word-constituent character. */ - notwordchar, /* Matches any char that is not a word-constituent. */ - - wordbeg, /* Succeeds if at word beginning. */ - wordend, /* Succeeds if at word end. */ - - wordbound, /* Succeeds if at a word boundary. */ - notwordbound /* Succeeds if not at a word boundary. */ - -#ifdef emacs - ,before_dot, /* Succeeds if before point. */ - at_dot, /* Succeeds if at point. */ - after_dot, /* Succeeds if after point. */ - - /* Matches any character whose syntax is specified. Followed by - a byte which contains a syntax code, e.g., Sword. */ - syntaxspec, - - /* Matches any character whose syntax is not that specified. */ - notsyntaxspec -#endif /* emacs */ -} re_opcode_t; - -/* Common operations on the compiled pattern. */ - -/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ - -#define STORE_NUMBER(destination, number) \ - do { \ - (destination)[0] = (number) & 0377; \ - (destination)[1] = (number) >> 8; \ - } while (0) - -/* Same as STORE_NUMBER, except increment DESTINATION to - the byte after where the number is stored. Therefore, DESTINATION - must be an lvalue. */ - -#define STORE_NUMBER_AND_INCR(destination, number) \ - do { \ - STORE_NUMBER (destination, number); \ - (destination) += 2; \ - } while (0) - -/* Put into DESTINATION a number stored in two contiguous bytes starting - at SOURCE. */ - -#define EXTRACT_NUMBER(destination, source) \ - do { \ - (destination) = *(source) & 0377; \ - (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ - } while (0) - -#ifdef DEBUG -static void -extract_number (dest, source) - int *dest; - unsigned char *source; -{ - int temp = SIGN_EXTEND_CHAR (*(source + 1)); - *dest = *source & 0377; - *dest += temp << 8; -} - -#ifndef EXTRACT_MACROS /* To debug the macros. */ -#undef EXTRACT_NUMBER -#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src) -#endif /* not EXTRACT_MACROS */ - -#endif /* DEBUG */ - -/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number. - SOURCE must be an lvalue. */ - -#define EXTRACT_NUMBER_AND_INCR(destination, source) \ - do { \ - EXTRACT_NUMBER (destination, source); \ - (source) += 2; \ - } while (0) - -#ifdef DEBUG -static void -extract_number_and_incr (destination, source) - int *destination; - unsigned char **source; -{ - extract_number (destination, *source); - *source += 2; -} - -#ifndef EXTRACT_MACROS -#undef EXTRACT_NUMBER_AND_INCR -#define EXTRACT_NUMBER_AND_INCR(dest, src) \ - extract_number_and_incr (&dest, &src) -#endif /* not EXTRACT_MACROS */ - -#endif /* DEBUG */ - -/* If DEBUG is defined, Regex prints many voluminous messages about what - it is doing (if the variable `debug' is nonzero). If linked with the - main program in `iregex.c', you can enter patterns and strings - interactively. And if linked with the main program in `main.c' and - the other test files, you can run the already-written tests. */ - -#ifdef DEBUG - -/* We use standard I/O for debugging. */ -#include - -/* It is useful to test things that ``must'' be true when debugging. */ -#include - -static int debug = 0; - -#define DEBUG_STATEMENT(e) e -#define DEBUG_PRINT1(x) if (debug) printf (x) -#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2) -#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3) -#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4) -#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ - if (debug) print_partial_compiled_pattern (s, e) -#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ - if (debug) print_double_string (w, s1, sz1, s2, sz2) - - -extern void printchar (); - -/* Print the fastmap in human-readable form. */ - -void -print_fastmap (fastmap) - char *fastmap; -{ - unsigned was_a_range = 0; - unsigned i = 0; - - while (i < (1 << BYTEWIDTH)) - { - if (fastmap[i++]) - { - was_a_range = 0; - printchar (i - 1); - while (i < (1 << BYTEWIDTH) && fastmap[i]) - { - was_a_range = 1; - i++; - } - if (was_a_range) - { - printf ("-"); - printchar (i - 1); - } - } - } - putchar ('\n'); -} - - -/* Print a compiled pattern string in human-readable form, starting at - the START pointer into it and ending just before the pointer END. */ - -void -print_partial_compiled_pattern (start, end) - unsigned char *start; - unsigned char *end; -{ - int mcnt, mcnt2; - unsigned char *p = start; - unsigned char *pend = end; - - if (start == NULL) - { - printf ("(null)\n"); - return; - } - - /* Loop over pattern commands. */ - while (p < pend) - { - switch ((re_opcode_t) *p++) - { - case no_op: - printf ("/no_op"); - break; - - case exactn: - mcnt = *p++; - printf ("/exactn/%d", mcnt); - do - { - putchar ('/'); - printchar (*p++); - } - while (--mcnt); - break; - - case start_memory: - mcnt = *p++; - printf ("/start_memory/%d/%d", mcnt, *p++); - break; - - case stop_memory: - mcnt = *p++; - printf ("/stop_memory/%d/%d", mcnt, *p++); - break; - - case duplicate: - printf ("/duplicate/%d", *p++); - break; - - case anychar: - printf ("/anychar"); - break; - - case charset: - case charset_not: - { - register int c; - - printf ("/charset%s", - (re_opcode_t) *(p - 1) == charset_not ? "_not" : ""); - - assert (p + *p < pend); - - for (c = 0; c < *p; c++) - { - unsigned bit; - unsigned char map_byte = p[1 + c]; - - putchar ('/'); - - for (bit = 0; bit < BYTEWIDTH; bit++) - if (map_byte & (1 << bit)) - printchar (c * BYTEWIDTH + bit); - } - p += 1 + *p; - break; - } - - case begline: - printf ("/begline"); - break; - - case endline: - printf ("/endline"); - break; - - case on_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_jump/0/%d", mcnt); - break; - - case on_failure_keep_string_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_keep_string_jump/0/%d", mcnt); - break; - - case dummy_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/dummy_failure_jump/0/%d", mcnt); - break; - - case push_dummy_failure: - printf ("/push_dummy_failure"); - break; - - case maybe_pop_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/maybe_pop_jump/0/%d", mcnt); - break; - - case pop_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/pop_failure_jump/0/%d", mcnt); - break; - - case jump_past_alt: - extract_number_and_incr (&mcnt, &p); - printf ("/jump_past_alt/0/%d", mcnt); - break; - - case jump: - extract_number_and_incr (&mcnt, &p); - printf ("/jump/0/%d", mcnt); - break; - - case succeed_n: - extract_number_and_incr (&mcnt, &p); - extract_number_and_incr (&mcnt2, &p); - printf ("/succeed_n/0/%d/0/%d", mcnt, mcnt2); - break; - - case jump_n: - extract_number_and_incr (&mcnt, &p); - extract_number_and_incr (&mcnt2, &p); - printf ("/jump_n/0/%d/0/%d", mcnt, mcnt2); - break; - - case set_number_at: - extract_number_and_incr (&mcnt, &p); - extract_number_and_incr (&mcnt2, &p); - printf ("/set_number_at/0/%d/0/%d", mcnt, mcnt2); - break; - - case wordbound: - printf ("/wordbound"); - break; - - case notwordbound: - printf ("/notwordbound"); - break; - - case wordbeg: - printf ("/wordbeg"); - break; - - case wordend: - printf ("/wordend"); - -#ifdef emacs - case before_dot: - printf ("/before_dot"); - break; - - case at_dot: - printf ("/at_dot"); - break; - - case after_dot: - printf ("/after_dot"); - break; - - case syntaxspec: - printf ("/syntaxspec"); - mcnt = *p++; - printf ("/%d", mcnt); - break; - - case notsyntaxspec: - printf ("/notsyntaxspec"); - mcnt = *p++; - printf ("/%d", mcnt); - break; -#endif /* emacs */ - - case wordchar: - printf ("/wordchar"); - break; - - case notwordchar: - printf ("/notwordchar"); - break; - - case begbuf: - printf ("/begbuf"); - break; - - case endbuf: - printf ("/endbuf"); - break; - - default: - printf ("?%d", *(p-1)); - } - } - printf ("/\n"); -} - - -void -print_compiled_pattern (bufp) - struct re_pattern_buffer *bufp; -{ - unsigned char *buffer = bufp->buffer; - - print_partial_compiled_pattern (buffer, buffer + bufp->used); - printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated); - - if (bufp->fastmap_accurate && bufp->fastmap) - { - printf ("fastmap: "); - print_fastmap (bufp->fastmap); - } - - printf ("re_nsub: %d\t", bufp->re_nsub); - printf ("regs_alloc: %d\t", bufp->regs_allocated); - printf ("can_be_null: %d\t", bufp->can_be_null); - printf ("newline_anchor: %d\n", bufp->newline_anchor); - printf ("no_sub: %d\t", bufp->no_sub); - printf ("not_bol: %d\t", bufp->not_bol); - printf ("not_eol: %d\t", bufp->not_eol); - printf ("syntax: %d\n", bufp->syntax); - /* Perhaps we should print the translate table? */ -} - - -void -print_double_string (where, string1, size1, string2, size2) - const char *where; - const char *string1; - const char *string2; - int size1; - int size2; -{ - unsigned this_char; - - if (where == NULL) - printf ("(null)"); - else - { - if (FIRST_STRING_P (where)) - { - for (this_char = where - string1; this_char < size1; this_char++) - printchar (string1[this_char]); - - where = string2; - } - - for (this_char = where - string2; this_char < size2; this_char++) - printchar (string2[this_char]); - } -} - -#else /* not DEBUG */ - -#undef assert -#define assert(e) - -#define DEBUG_STATEMENT(e) -#define DEBUG_PRINT1(x) -#define DEBUG_PRINT2(x1, x2) -#define DEBUG_PRINT3(x1, x2, x3) -#define DEBUG_PRINT4(x1, x2, x3, x4) -#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) -#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) - -#endif /* not DEBUG */ - -/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can - also be assigned to arbitrarily: each pattern buffer stores its own - syntax, so it can be changed between regex compilations. */ -reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS; - - -/* Specify the precise syntax of regexps for compilation. This provides - for compatibility for various utilities which historically have - different, incompatible syntaxes. - - The argument SYNTAX is a bit mask comprised of the various bits - defined in regex.h. We return the old syntax. */ - -reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; -{ - reg_syntax_t ret = re_syntax_options; - - re_syntax_options = syntax; - return ret; -} - -/* This table gives an error message for each of the error codes listed - in regex.h. Obviously the order here has to be same as there. */ - -static const char *re_error_msg[] = - { NULL, /* REG_NOERROR */ - "No match", /* REG_NOMATCH */ - "Invalid regular expression", /* REG_BADPAT */ - "Invalid collation character", /* REG_ECOLLATE */ - "Invalid character class name", /* REG_ECTYPE */ - "Trailing backslash", /* REG_EESCAPE */ - "Invalid back reference", /* REG_ESUBREG */ - "Unmatched [ or [^", /* REG_EBRACK */ - "Unmatched ( or \\(", /* REG_EPAREN */ - "Unmatched \\{", /* REG_EBRACE */ - "Invalid content of \\{\\}", /* REG_BADBR */ - "Invalid range end", /* REG_ERANGE */ - "Memory exhausted", /* REG_ESPACE */ - "Invalid preceding regular expression", /* REG_BADRPT */ - "Premature end of regular expression", /* REG_EEND */ - "Regular expression too big", /* REG_ESIZE */ - "Unmatched ) or \\)", /* REG_ERPAREN */ - }; - -/* Subroutine declarations and macros for regex_compile. */ - -static void store_op1 (), store_op2 (); -static void insert_op1 (), insert_op2 (); -static boolean at_begline_loc_p (), at_endline_loc_p (); -static boolean group_in_compile_stack (); -static reg_errcode_t compile_range (); - -/* Fetch the next character in the uncompiled pattern---translating it - if necessary. Also cast from a signed character in the constant - string passed to us by the user to an unsigned char that we can use - as an array index (in, e.g., `translate'). */ -#define PATFETCH(c) \ - do {if (p == pend) return REG_EEND; \ - c = (unsigned char) *p++; \ - if (translate) c = translate[c]; \ - } while (0) - -/* Fetch the next character in the uncompiled pattern, with no - translation. */ -#define PATFETCH_RAW(c) \ - do {if (p == pend) return REG_EEND; \ - c = (unsigned char) *p++; \ - } while (0) - -/* Go backwards one character in the pattern. */ -#define PATUNFETCH p-- - - -/* If `translate' is non-null, return translate[D], else just D. We - cast the subscript to translate because some data is declared as - `char *', to avoid warnings when a string constant is passed. But - when we use a character as a subscript we must make it unsigned. */ -#define TRANSLATE(d) (translate ? translate[(unsigned char) (d)] : (d)) - - -/* Macros for outputting the compiled pattern into `buffer'. */ - -/* If the buffer isn't allocated when it comes in, use this. */ -#define INIT_BUF_SIZE 32 - -/* Make sure we have at least N more bytes of space in buffer. */ -#define GET_BUFFER_SPACE(n) \ - while (b - bufp->buffer + (n) > bufp->allocated) \ - EXTEND_BUFFER () - -/* Make sure we have one more byte of buffer space and then add C to it. */ -#define BUF_PUSH(c) \ - do { \ - GET_BUFFER_SPACE (1); \ - *b++ = (unsigned char) (c); \ - } while (0) - - -/* Ensure we have two more bytes of buffer space and then append C1 and C2. */ -#define BUF_PUSH_2(c1, c2) \ - do { \ - GET_BUFFER_SPACE (2); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - } while (0) - - -/* As with BUF_PUSH_2, except for three bytes. */ -#define BUF_PUSH_3(c1, c2, c3) \ - do { \ - GET_BUFFER_SPACE (3); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - *b++ = (unsigned char) (c3); \ - } while (0) - - -/* Store a jump with opcode OP at LOC to location TO. We store a - relative address offset by the three bytes the jump itself occupies. */ -#define STORE_JUMP(op, loc, to) \ - store_op1 (op, loc, (to) - (loc) - 3) - -/* Likewise, for a two-argument jump. */ -#define STORE_JUMP2(op, loc, to, arg) \ - store_op2 (op, loc, (to) - (loc) - 3, arg) - -/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ -#define INSERT_JUMP(op, loc, to) \ - insert_op1 (op, loc, (to) - (loc) - 3, b) - -/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ -#define INSERT_JUMP2(op, loc, to, arg) \ - insert_op2 (op, loc, (to) - (loc) - 3, arg, b) - - -/* This is not an arbitrary limit: the arguments which represent offsets - into the pattern are two bytes long. So if 2^16 bytes turns out to - be too small, many things would have to change. */ -#define MAX_BUF_SIZE (1L << 16) - - -/* Extend the buffer by twice its current size via realloc and - reset the pointers that pointed into the old block to point to the - correct places in the new one. If extending the buffer results in it - being larger than MAX_BUF_SIZE, then flag memory exhausted. */ -#define EXTEND_BUFFER() \ - do { \ - unsigned char *old_buffer = bufp->buffer; \ - if (bufp->allocated == MAX_BUF_SIZE) \ - return REG_ESIZE; \ - bufp->allocated <<= 1; \ - if (bufp->allocated > MAX_BUF_SIZE) \ - bufp->allocated = MAX_BUF_SIZE; \ - bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\ - if (bufp->buffer == NULL) \ - return REG_ESPACE; \ - /* If the buffer moved, move all the pointers into it. */ \ - if (old_buffer != bufp->buffer) \ - { \ - b = (b - old_buffer) + bufp->buffer; \ - begalt = (begalt - old_buffer) + bufp->buffer; \ - if (fixup_alt_jump) \ - fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\ - if (laststart) \ - laststart = (laststart - old_buffer) + bufp->buffer; \ - if (pending_exact) \ - pending_exact = (pending_exact - old_buffer) + bufp->buffer; \ - } \ - } while (0) - - -/* Since we have one byte reserved for the register number argument to - {start,stop}_memory, the maximum number of groups we can report - things about is what fits in that byte. */ -#define MAX_REGNUM 255 - -/* But patterns can have more than `MAX_REGNUM' registers. We just - ignore the excess. */ -typedef unsigned regnum_t; - - -/* Macros for the compile stack. */ - -/* Since offsets can go either forwards or backwards, this type needs to - be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ -typedef int pattern_offset_t; - -typedef struct -{ - pattern_offset_t begalt_offset; - pattern_offset_t fixup_alt_jump; - pattern_offset_t inner_group_offset; - pattern_offset_t laststart_offset; - regnum_t regnum; -} compile_stack_elt_t; - - -typedef struct -{ - compile_stack_elt_t *stack; - unsigned size; - unsigned avail; /* Offset of next open position. */ -} compile_stack_type; - - -#define INIT_COMPILE_STACK_SIZE 32 - -#define COMPILE_STACK_EMPTY (compile_stack.avail == 0) -#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size) - -/* The next available element. */ -#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail]) - - -/* Set the bit for character C in a list. */ -#define SET_LIST_BIT(c) \ - (b[((unsigned char) (c)) / BYTEWIDTH] \ - |= 1 << (((unsigned char) c) % BYTEWIDTH)) - - -/* Get the next unsigned number in the uncompiled pattern. */ -#define GET_UNSIGNED_NUMBER(num) \ - { if (p != pend) \ - { \ - PATFETCH (c); \ - while (ISDIGIT (c)) \ - { \ - if (num < 0) \ - num = 0; \ - num = num * 10 + c - '0'; \ - if (p == pend) \ - break; \ - PATFETCH (c); \ - } \ - } \ - } - -#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ - -#define IS_CHAR_CLASS(string) \ - (STREQ (string, "alpha") || STREQ (string, "upper") \ - || STREQ (string, "lower") || STREQ (string, "digit") \ - || STREQ (string, "alnum") || STREQ (string, "xdigit") \ - || STREQ (string, "space") || STREQ (string, "print") \ - || STREQ (string, "punct") || STREQ (string, "graph") \ - || STREQ (string, "cntrl") || STREQ (string, "blank")) - -/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. - Returns one of error codes defined in `regex.h', or zero for success. - - Assumes the `allocated' (and perhaps `buffer') and `translate' - fields are set in BUFP on entry. - - If it succeeds, results are put in BUFP (if it returns an error, the - contents of BUFP are undefined): - `buffer' is the compiled pattern; - `syntax' is set to SYNTAX; - `used' is set to the length of the compiled pattern; - `fastmap_accurate' is zero; - `re_nsub' is the number of subexpressions in PATTERN; - `not_bol' and `not_eol' are zero; - - The `fastmap' and `newline_anchor' fields are neither - examined nor set. */ - -static reg_errcode_t -regex_compile (pattern, size, syntax, bufp) - const char *pattern; - int size; - reg_syntax_t syntax; - struct re_pattern_buffer *bufp; -{ - /* We fetch characters from PATTERN here. Even though PATTERN is - `char *' (i.e., signed), we declare these variables as unsigned, so - they can be reliably used as array indices. */ - register unsigned char c, c1; - - /* A random tempory spot in PATTERN. */ - const char *p1; - - /* Points to the end of the buffer, where we should append. */ - register unsigned char *b; - - /* Keeps track of unclosed groups. */ - compile_stack_type compile_stack; - - /* Points to the current (ending) position in the pattern. */ - const char *p = pattern; - const char *pend = pattern + size; - - /* How to translate the characters in the pattern. */ - char *translate = bufp->translate; - - /* Address of the count-byte of the most recently inserted `exactn' - command. This makes it possible to tell if a new exact-match - character can be added to that command or if the character requires - a new `exactn' command. */ - unsigned char *pending_exact = 0; - - /* Address of start of the most recently finished expression. - This tells, e.g., postfix * where to find the start of its - operand. Reset at the beginning of groups and alternatives. */ - unsigned char *laststart = 0; - - /* Address of beginning of regexp, or inside of last group. */ - unsigned char *begalt; - - /* Place in the uncompiled pattern (i.e., the {) to - which to go back if the interval is invalid. */ - const char *beg_interval; - - /* Address of the place where a forward jump should go to the end of - the containing expression. Each alternative of an `or' -- except the - last -- ends with a forward jump of this sort. */ - unsigned char *fixup_alt_jump = 0; - - /* Counts open-groups as they are encountered. Remembered for the - matching close-group on the compile stack, so the same register - number is put in the stop_memory as the start_memory. */ - regnum_t regnum = 0; - -#ifdef DEBUG - DEBUG_PRINT1 ("\nCompiling pattern: "); - if (debug) - { - unsigned debug_count; - - for (debug_count = 0; debug_count < size; debug_count++) - printchar (pattern[debug_count]); - putchar ('\n'); - } -#endif /* DEBUG */ - - /* Initialize the compile stack. */ - compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t); - if (compile_stack.stack == NULL) - return REG_ESPACE; - - compile_stack.size = INIT_COMPILE_STACK_SIZE; - compile_stack.avail = 0; - - /* Initialize the pattern buffer. */ - bufp->syntax = syntax; - bufp->fastmap_accurate = 0; - bufp->not_bol = bufp->not_eol = 0; - - /* Set `used' to zero, so that if we return an error, the pattern - printer (for debugging) will think there's no pattern. We reset it - at the end. */ - bufp->used = 0; - - /* Always count groups, whether or not bufp->no_sub is set. */ - bufp->re_nsub = 0; - -#if !defined (emacs) && !defined (SYNTAX_TABLE) - /* Initialize the syntax table. */ - init_syntax_once (); -#endif - - if (bufp->allocated == 0) - { - if (bufp->buffer) - { /* If zero allocated, but buffer is non-null, try to realloc - enough space. This loses if buffer's address is bogus, but - that is the user's responsibility. */ - RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); - } - else - { /* Caller did not allocate a buffer. Do it for them. */ - bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); - } - if (!bufp->buffer) return REG_ESPACE; - - bufp->allocated = INIT_BUF_SIZE; - } - - begalt = b = bufp->buffer; - - /* Loop through the uncompiled pattern until we're at the end. */ - while (p != pend) - { - PATFETCH (c); - - switch (c) - { - case '^': - { - if ( /* If at start of pattern, it's an operator. */ - p == pattern + 1 - /* If context independent, it's an operator. */ - || syntax & RE_CONTEXT_INDEP_ANCHORS - /* Otherwise, depends on what's come before. */ - || at_begline_loc_p (pattern, p, syntax)) - BUF_PUSH (begline); - else - goto normal_char; - } - break; - - - case '$': - { - if ( /* If at end of pattern, it's an operator. */ - p == pend - /* If context independent, it's an operator. */ - || syntax & RE_CONTEXT_INDEP_ANCHORS - /* Otherwise, depends on what's next. */ - || at_endline_loc_p (p, pend, syntax)) - BUF_PUSH (endline); - else - goto normal_char; - } - break; - - - case '+': - case '?': - if ((syntax & RE_BK_PLUS_QM) - || (syntax & RE_LIMITED_OPS)) - goto normal_char; - handle_plus: - case '*': - /* If there is no previous pattern... */ - if (!laststart) - { - if (syntax & RE_CONTEXT_INVALID_OPS) - return REG_BADRPT; - else if (!(syntax & RE_CONTEXT_INDEP_OPS)) - goto normal_char; - } - - { - /* Are we optimizing this jump? */ - boolean keep_string_p = false; - - /* 1 means zero (many) matches is allowed. */ - char zero_times_ok = 0, many_times_ok = 0; - - /* If there is a sequence of repetition chars, collapse it - down to just one (the right one). We can't combine - interval operators with these because of, e.g., `a{2}*', - which should only match an even number of `a's. */ - - for (;;) - { - zero_times_ok |= c != '+'; - many_times_ok |= c != '?'; - - if (p == pend) - break; - - PATFETCH (c); - - if (c == '*' - || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?'))) - ; - - else if (syntax & RE_BK_PLUS_QM && c == '\\') - { - if (p == pend) return REG_EESCAPE; - - PATFETCH (c1); - if (!(c1 == '+' || c1 == '?')) - { - PATUNFETCH; - PATUNFETCH; - break; - } - - c = c1; - } - else - { - PATUNFETCH; - break; - } - - /* If we get here, we found another repeat character. */ - } - - /* Star, etc. applied to an empty pattern is equivalent - to an empty pattern. */ - if (!laststart) - break; - - /* Now we know whether or not zero matches is allowed - and also whether or not two or more matches is allowed. */ - if (many_times_ok) - { /* More than one repetition is allowed, so put in at the - end a backward relative jump from `b' to before the next - jump we're going to put in below (which jumps from - laststart to after this jump). - - But if we are at the `*' in the exact sequence `.*\n', - insert an unconditional jump backwards to the ., - instead of the beginning of the loop. This way we only - push a failure point once, instead of every time - through the loop. */ - assert (p - 1 > pattern); - - /* Allocate the space for the jump. */ - GET_BUFFER_SPACE (3); - - /* We know we are not at the first character of the pattern, - because laststart was nonzero. And we've already - incremented `p', by the way, to be the character after - the `*'. Do we have to do something analogous here - for null bytes, because of RE_DOT_NOT_NULL? */ - if (TRANSLATE (*(p - 2)) == TRANSLATE ('.') - && zero_times_ok - && p < pend && TRANSLATE (*p) == TRANSLATE ('\n') - && !(syntax & RE_DOT_NEWLINE)) - { /* We have .*\n. */ - STORE_JUMP (jump, b, laststart); - keep_string_p = true; - } - else - /* Anything else. */ - STORE_JUMP (maybe_pop_jump, b, laststart - 3); - - /* We've added more stuff to the buffer. */ - b += 3; - } - - /* On failure, jump from laststart to b + 3, which will be the - end of the buffer after this jump is inserted. */ - GET_BUFFER_SPACE (3); - INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump - : on_failure_jump, - laststart, b + 3); - pending_exact = 0; - b += 3; - - if (!zero_times_ok) - { - /* At least one repetition is required, so insert a - `dummy_failure_jump' before the initial - `on_failure_jump' instruction of the loop. This - effects a skip over that instruction the first time - we hit that loop. */ - GET_BUFFER_SPACE (3); - INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6); - b += 3; - } - } - break; - - - case '.': - laststart = b; - BUF_PUSH (anychar); - break; - - - case '[': - { - boolean had_char_class = false; - - if (p == pend) return REG_EBRACK; - - /* Ensure that we have enough space to push a charset: the - opcode, the length count, and the bitset; 34 bytes in all. */ - GET_BUFFER_SPACE (34); - - laststart = b; - - /* We test `*p == '^' twice, instead of using an if - statement, so we only need one BUF_PUSH. */ - BUF_PUSH (*p == '^' ? charset_not : charset); - if (*p == '^') - p++; - - /* Remember the first position in the bracket expression. */ - p1 = p; - - /* Push the number of bytes in the bitmap. */ - BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); - - /* Clear the whole map. */ - bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); - - /* charset_not matches newline according to a syntax bit. */ - if ((re_opcode_t) b[-2] == charset_not - && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) - SET_LIST_BIT ('\n'); - - /* Read in characters and ranges, setting map bits. */ - for (;;) - { - if (p == pend) return REG_EBRACK; - - PATFETCH (c); - - /* \ might escape characters inside [...] and [^...]. */ - if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') - { - if (p == pend) return REG_EESCAPE; - - PATFETCH (c1); - SET_LIST_BIT (c1); - continue; - } - - /* Could be the end of the bracket expression. If it's - not (i.e., when the bracket expression is `[]' so - far), the ']' character bit gets set way below. */ - if (c == ']' && p != p1 + 1) - break; - - /* Look ahead to see if it's a range when the last thing - was a character class. */ - if (had_char_class && c == '-' && *p != ']') - return REG_ERANGE; - - /* Look ahead to see if it's a range when the last thing - was a character: if this is a hyphen not at the - beginning or the end of a list, then it's the range - operator. */ - if (c == '-' - && !(p - 2 >= pattern && p[-2] == '[') - && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') - && *p != ']') - { - reg_errcode_t ret - = compile_range (&p, pend, translate, syntax, b); - if (ret != REG_NOERROR) return ret; - } - - else if (p[0] == '-' && p[1] != ']') - { /* This handles ranges made up of characters only. */ - reg_errcode_t ret; - - /* Move past the `-'. */ - PATFETCH (c1); - - ret = compile_range (&p, pend, translate, syntax, b); - if (ret != REG_NOERROR) return ret; - } - - /* See if we're at the beginning of a possible character - class. */ - - else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') - { /* Leave room for the null. */ - char str[CHAR_CLASS_MAX_LENGTH + 1]; - - PATFETCH (c); - c1 = 0; - - /* If pattern is `[[:'. */ - if (p == pend) return REG_EBRACK; - - for (;;) - { - PATFETCH (c); - if (c == ':' || c == ']' || p == pend - || c1 == CHAR_CLASS_MAX_LENGTH) - break; - str[c1++] = c; - } - str[c1] = '\0'; - - /* If isn't a word bracketed by `[:' and:`]': - undo the ending character, the letters, and leave - the leading `:' and `[' (but set bits for them). */ - if (c == ':' && *p == ']') - { - int ch; - boolean is_alnum = STREQ (str, "alnum"); - boolean is_alpha = STREQ (str, "alpha"); - boolean is_blank = STREQ (str, "blank"); - boolean is_cntrl = STREQ (str, "cntrl"); - boolean is_digit = STREQ (str, "digit"); - boolean is_graph = STREQ (str, "graph"); - boolean is_lower = STREQ (str, "lower"); - boolean is_print = STREQ (str, "print"); - boolean is_punct = STREQ (str, "punct"); - boolean is_space = STREQ (str, "space"); - boolean is_upper = STREQ (str, "upper"); - boolean is_xdigit = STREQ (str, "xdigit"); - - if (!IS_CHAR_CLASS (str)) return REG_ECTYPE; - - /* Throw away the ] at the end of the character - class. */ - PATFETCH (c); - - if (p == pend) return REG_EBRACK; - - for (ch = 0; ch < 1 << BYTEWIDTH; ch++) - { - if ( (is_alnum && ISALNUM (ch)) - || (is_alpha && ISALPHA (ch)) - || (is_blank && ISBLANK (ch)) - || (is_cntrl && ISCNTRL (ch)) - || (is_digit && ISDIGIT (ch)) - || (is_graph && ISGRAPH (ch)) - || (is_lower && ISLOWER (ch)) - || (is_print && ISPRINT (ch)) - || (is_punct && ISPUNCT (ch)) - || (is_space && ISSPACE (ch)) - || (is_upper && ISUPPER (ch)) - || (is_xdigit && ISXDIGIT (ch))) - SET_LIST_BIT (ch); - } - had_char_class = true; - } - else - { - c1++; - while (c1--) - PATUNFETCH; - SET_LIST_BIT ('['); - SET_LIST_BIT (':'); - had_char_class = false; - } - } - else - { - had_char_class = false; - SET_LIST_BIT (c); - } - } - - /* Discard any (non)matching list bytes that are all 0 at the - end of the map. Decrease the map-length byte too. */ - while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) - b[-1]--; - b += b[-1]; - } - break; - - - case '(': - if (syntax & RE_NO_BK_PARENS) - goto handle_open; - else - goto normal_char; - - - case ')': - if (syntax & RE_NO_BK_PARENS) - goto handle_close; - else - goto normal_char; - - - case '\n': - if (syntax & RE_NEWLINE_ALT) - goto handle_alt; - else - goto normal_char; - - - case '|': - if (syntax & RE_NO_BK_VBAR) - goto handle_alt; - else - goto normal_char; - - - case '{': - if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES) - goto handle_interval; - else - goto normal_char; - - - case '\\': - if (p == pend) return REG_EESCAPE; - - /* Do not translate the character after the \, so that we can - distinguish, e.g., \B from \b, even if we normally would - translate, e.g., B to b. */ - PATFETCH_RAW (c); - - switch (c) - { - case '(': - if (syntax & RE_NO_BK_PARENS) - goto normal_backslash; - - handle_open: - bufp->re_nsub++; - regnum++; - - if (COMPILE_STACK_FULL) - { - RETALLOC (compile_stack.stack, compile_stack.size << 1, - compile_stack_elt_t); - if (compile_stack.stack == NULL) return REG_ESPACE; - - compile_stack.size <<= 1; - } - - /* These are the values to restore when we hit end of this - group. They are all relative offsets, so that if the - whole pattern moves because of realloc, they will still - be valid. */ - COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; - COMPILE_STACK_TOP.fixup_alt_jump - = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; - COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; - COMPILE_STACK_TOP.regnum = regnum; - - /* We will eventually replace the 0 with the number of - groups inner to this one. But do not push a - start_memory for groups beyond the last one we can - represent in the compiled pattern. */ - if (regnum <= MAX_REGNUM) - { - COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2; - BUF_PUSH_3 (start_memory, regnum, 0); - } - - compile_stack.avail++; - - fixup_alt_jump = 0; - laststart = 0; - begalt = b; - /* If we've reached MAX_REGNUM groups, then this open - won't actually generate any code, so we'll have to - clear pending_exact explicitly. */ - pending_exact = 0; - break; - - - case ')': - if (syntax & RE_NO_BK_PARENS) goto normal_backslash; - - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_backslash; - else - return REG_ERPAREN; - - handle_close: - if (fixup_alt_jump) - { /* Push a dummy failure point at the end of the - alternative for a possible future - `pop_failure_jump' to pop. See comments at - `push_dummy_failure' in `re_match_2'. */ - BUF_PUSH (push_dummy_failure); - - /* We allocated space for this jump when we assigned - to `fixup_alt_jump', in the `handle_alt' case below. */ - STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1); - } - - /* See similar code for backslashed left paren above. */ - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_char; - else - return REG_ERPAREN; - - /* Since we just checked for an empty stack above, this - ``can't happen''. */ - assert (compile_stack.avail != 0); - { - /* We don't just want to restore into `regnum', because - later groups should continue to be numbered higher, - as in `(ab)c(de)' -- the second group is #2. */ - regnum_t this_group_regnum; - - compile_stack.avail--; - begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; - fixup_alt_jump - = COMPILE_STACK_TOP.fixup_alt_jump - ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 - : 0; - laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; - this_group_regnum = COMPILE_STACK_TOP.regnum; - /* If we've reached MAX_REGNUM groups, then this open - won't actually generate any code, so we'll have to - clear pending_exact explicitly. */ - pending_exact = 0; - - /* We're at the end of the group, so now we know how many - groups were inside this one. */ - if (this_group_regnum <= MAX_REGNUM) - { - unsigned char *inner_group_loc - = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset; - - *inner_group_loc = regnum - this_group_regnum; - BUF_PUSH_3 (stop_memory, this_group_regnum, - regnum - this_group_regnum); - } - } - break; - - - case '|': /* `\|'. */ - if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR) - goto normal_backslash; - handle_alt: - if (syntax & RE_LIMITED_OPS) - goto normal_char; - - /* Insert before the previous alternative a jump which - jumps to this alternative if the former fails. */ - GET_BUFFER_SPACE (3); - INSERT_JUMP (on_failure_jump, begalt, b + 6); - pending_exact = 0; - b += 3; - - /* The alternative before this one has a jump after it - which gets executed if it gets matched. Adjust that - jump so it will jump to this alternative's analogous - jump (put in below, which in turn will jump to the next - (if any) alternative's such jump, etc.). The last such - jump jumps to the correct final destination. A picture: - _____ _____ - | | | | - | v | v - a | b | c - - If we are at `b', then fixup_alt_jump right now points to a - three-byte space after `a'. We'll put in the jump, set - fixup_alt_jump to right after `b', and leave behind three - bytes which we'll fill in when we get to after `c'. */ - - if (fixup_alt_jump) - STORE_JUMP (jump_past_alt, fixup_alt_jump, b); - - /* Mark and leave space for a jump after this alternative, - to be filled in later either by next alternative or - when know we're at the end of a series of alternatives. */ - fixup_alt_jump = b; - GET_BUFFER_SPACE (3); - b += 3; - - laststart = 0; - begalt = b; - break; - - - case '{': - /* If \{ is a literal. */ - if (!(syntax & RE_INTERVALS) - /* If we're at `\{' and it's not the open-interval - operator. */ - || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) - || (p - 2 == pattern && p == pend)) - goto normal_backslash; - - handle_interval: - { - /* If got here, then the syntax allows intervals. */ - - /* At least (most) this many matches must be made. */ - int lower_bound = -1, upper_bound = -1; - - beg_interval = p - 1; - - if (p == pend) - { - if (syntax & RE_NO_BK_BRACES) - goto unfetch_interval; - else - return REG_EBRACE; - } - - GET_UNSIGNED_NUMBER (lower_bound); - - if (c == ',') - { - GET_UNSIGNED_NUMBER (upper_bound); - if (upper_bound < 0) upper_bound = RE_DUP_MAX; - } - else - /* Interval such as `{1}' => match exactly once. */ - upper_bound = lower_bound; - - if (lower_bound < 0 || upper_bound > RE_DUP_MAX - || lower_bound > upper_bound) - { - if (syntax & RE_NO_BK_BRACES) - goto unfetch_interval; - else - return REG_BADBR; - } - - if (!(syntax & RE_NO_BK_BRACES)) - { - if (c != '\\') return REG_EBRACE; - - PATFETCH (c); - } - - if (c != '}') - { - if (syntax & RE_NO_BK_BRACES) - goto unfetch_interval; - else - return REG_BADBR; - } - - /* We just parsed a valid interval. */ - - /* If it's invalid to have no preceding re. */ - if (!laststart) - { - if (syntax & RE_CONTEXT_INVALID_OPS) - return REG_BADRPT; - else if (syntax & RE_CONTEXT_INDEP_OPS) - laststart = b; - else - goto unfetch_interval; - } - - /* If the upper bound is zero, don't want to succeed at - all; jump from `laststart' to `b + 3', which will be - the end of the buffer after we insert the jump. */ - if (upper_bound == 0) - { - GET_BUFFER_SPACE (3); - INSERT_JUMP (jump, laststart, b + 3); - b += 3; - } - - /* Otherwise, we have a nontrivial interval. When - we're all done, the pattern will look like: - set_number_at - set_number_at - succeed_n - - jump_n - (The upper bound and `jump_n' are omitted if - `upper_bound' is 1, though.) */ - else - { /* If the upper bound is > 1, we need to insert - more at the end of the loop. */ - unsigned nbytes = 10 + (upper_bound > 1) * 10; - - GET_BUFFER_SPACE (nbytes); - - /* Initialize lower bound of the `succeed_n', even - though it will be set during matching by its - attendant `set_number_at' (inserted next), - because `re_compile_fastmap' needs to know. - Jump to the `jump_n' we might insert below. */ - INSERT_JUMP2 (succeed_n, laststart, - b + 5 + (upper_bound > 1) * 5, - lower_bound); - b += 5; - - /* Code to initialize the lower bound. Insert - before the `succeed_n'. The `5' is the last two - bytes of this `set_number_at', plus 3 bytes of - the following `succeed_n'. */ - insert_op2 (set_number_at, laststart, 5, lower_bound, b); - b += 5; - - if (upper_bound > 1) - { /* More than one repetition is allowed, so - append a backward jump to the `succeed_n' - that starts this interval. - - When we've reached this during matching, - we'll have matched the interval once, so - jump back only `upper_bound - 1' times. */ - STORE_JUMP2 (jump_n, b, laststart + 5, - upper_bound - 1); - b += 5; - - /* The location we want to set is the second - parameter of the `jump_n'; that is `b-2' as - an absolute address. `laststart' will be - the `set_number_at' we're about to insert; - `laststart+3' the number to set, the source - for the relative address. But we are - inserting into the middle of the pattern -- - so everything is getting moved up by 5. - Conclusion: (b - 2) - (laststart + 3) + 5, - i.e., b - laststart. - - We insert this at the beginning of the loop - so that if we fail during matching, we'll - reinitialize the bounds. */ - insert_op2 (set_number_at, laststart, b - laststart, - upper_bound - 1, b); - b += 5; - } - } - pending_exact = 0; - beg_interval = NULL; - } - break; - - unfetch_interval: - /* If an invalid interval, match the characters as literals. */ - assert (beg_interval); - p = beg_interval; - beg_interval = NULL; - - /* normal_char and normal_backslash need `c'. */ - PATFETCH (c); - - if (!(syntax & RE_NO_BK_BRACES)) - { - if (p > pattern && p[-1] == '\\') - goto normal_backslash; - } - goto normal_char; - -#ifdef emacs - /* There is no way to specify the before_dot and after_dot - operators. rms says this is ok. --karl */ - case '=': - BUF_PUSH (at_dot); - break; - - case 's': - laststart = b; - PATFETCH (c); - BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]); - break; - - case 'S': - laststart = b; - PATFETCH (c); - BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]); - break; -#endif /* emacs */ - - - case 'w': - laststart = b; - BUF_PUSH (wordchar); - break; - - - case 'W': - laststart = b; - BUF_PUSH (notwordchar); - break; - - - case '<': - BUF_PUSH (wordbeg); - break; - - case '>': - BUF_PUSH (wordend); - break; - - case 'b': - BUF_PUSH (wordbound); - break; - - case 'B': - BUF_PUSH (notwordbound); - break; - - case '`': - BUF_PUSH (begbuf); - break; - - case '\'': - BUF_PUSH (endbuf); - break; - - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - if (syntax & RE_NO_BK_REFS) - goto normal_char; - - c1 = c - '0'; - - if (c1 > regnum) - return REG_ESUBREG; - - /* Can't back reference to a subexpression if inside of it. */ - if (group_in_compile_stack (compile_stack, c1)) - goto normal_char; - - laststart = b; - BUF_PUSH_2 (duplicate, c1); - break; - - - case '+': - case '?': - if (syntax & RE_BK_PLUS_QM) - goto handle_plus; - else - goto normal_backslash; - - default: - normal_backslash: - /* You might think it would be useful for \ to mean - not to translate; but if we don't translate it - it will never match anything. */ - c = TRANSLATE (c); - goto normal_char; - } - break; - - - default: - /* Expects the character in `c'. */ - normal_char: - /* If no exactn currently being built. */ - if (!pending_exact - - /* If last exactn not at current position. */ - || pending_exact + *pending_exact + 1 != b - - /* We have only one byte following the exactn for the count. */ - || *pending_exact == (1 << BYTEWIDTH) - 1 - - /* If followed by a repetition operator. */ - || *p == '*' || *p == '^' - || ((syntax & RE_BK_PLUS_QM) - ? *p == '\\' && (p[1] == '+' || p[1] == '?') - : (*p == '+' || *p == '?')) - || ((syntax & RE_INTERVALS) - && ((syntax & RE_NO_BK_BRACES) - ? *p == '{' - : (p[0] == '\\' && p[1] == '{')))) - { - /* Start building a new exactn. */ - - laststart = b; - - BUF_PUSH_2 (exactn, 0); - pending_exact = b - 1; - } - - BUF_PUSH (c); - (*pending_exact)++; - break; - } /* switch (c) */ - } /* while p != pend */ - - - /* Through the pattern now. */ - - if (fixup_alt_jump) - STORE_JUMP (jump_past_alt, fixup_alt_jump, b); - - if (!COMPILE_STACK_EMPTY) - return REG_EPAREN; - - free (compile_stack.stack); - - /* We have succeeded; set the length of the buffer. */ - bufp->used = b - bufp->buffer; - -#ifdef DEBUG - if (debug) - { - DEBUG_PRINT1 ("\nCompiled pattern: "); - print_compiled_pattern (bufp); - } -#endif /* DEBUG */ - - return REG_NOERROR; -} /* regex_compile */ - -/* Subroutines for `regex_compile'. */ - -/* Store OP at LOC followed by two-byte integer parameter ARG. */ - -static void -store_op1 (op, loc, arg) - re_opcode_t op; - unsigned char *loc; - int arg; -{ - *loc = (unsigned char) op; - STORE_NUMBER (loc + 1, arg); -} - - -/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */ - -static void -store_op2 (op, loc, arg1, arg2) - re_opcode_t op; - unsigned char *loc; - int arg1, arg2; -{ - *loc = (unsigned char) op; - STORE_NUMBER (loc + 1, arg1); - STORE_NUMBER (loc + 3, arg2); -} - - -/* Copy the bytes from LOC to END to open up three bytes of space at LOC - for OP followed by two-byte integer parameter ARG. */ - -static void -insert_op1 (op, loc, arg, end) - re_opcode_t op; - unsigned char *loc; - int arg; - unsigned char *end; -{ - register unsigned char *pfrom = end; - register unsigned char *pto = end + 3; - - while (pfrom != loc) - *--pto = *--pfrom; - - store_op1 (op, loc, arg); -} - - -/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */ - -static void -insert_op2 (op, loc, arg1, arg2, end) - re_opcode_t op; - unsigned char *loc; - int arg1, arg2; - unsigned char *end; -{ - register unsigned char *pfrom = end; - register unsigned char *pto = end + 5; - - while (pfrom != loc) - *--pto = *--pfrom; - - store_op2 (op, loc, arg1, arg2); -} - - -/* P points to just after a ^ in PATTERN. Return true if that ^ comes - after an alternative or a begin-subexpression. We assume there is at - least one character before the ^. */ - -static boolean -at_begline_loc_p (pattern, p, syntax) - const char *pattern, *p; - reg_syntax_t syntax; -{ - const char *prev = p - 2; - boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; - - return - /* After a subexpression? */ - (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) - /* After an alternative? */ - || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)); -} - - -/* The dual of at_begline_loc_p. This one is for $. We assume there is - at least one character after the $, i.e., `P < PEND'. */ - -static boolean -at_endline_loc_p (p, pend, syntax) - const char *p, *pend; - int syntax; -{ - const char *next = p; - boolean next_backslash = *next == '\\'; - const char *next_next = p + 1 < pend ? p + 1 : NULL; - - return - /* Before a subexpression? */ - (syntax & RE_NO_BK_PARENS ? *next == ')' - : next_backslash && next_next && *next_next == ')') - /* Before an alternative? */ - || (syntax & RE_NO_BK_VBAR ? *next == '|' - : next_backslash && next_next && *next_next == '|'); -} - - -/* Returns true if REGNUM is in one of COMPILE_STACK's elements and - false if it's not. */ - -static boolean -group_in_compile_stack (compile_stack, regnum) - compile_stack_type compile_stack; - regnum_t regnum; -{ - int this_element; - - for (this_element = compile_stack.avail - 1; - this_element >= 0; - this_element--) - if (compile_stack.stack[this_element].regnum == regnum) - return true; - - return false; -} - - -/* Read the ending character of a range (in a bracket expression) from the - uncompiled pattern *P_PTR (which ends at PEND). We assume the - starting character is in `P[-2]'. (`P[-1]' is the character `-'.) - Then we set the translation of all bits between the starting and - ending characters (inclusive) in the compiled pattern B. - - Return an error code. - - We use these short variable names so we can use the same macros as - `regex_compile' itself. */ - -static reg_errcode_t -compile_range (p_ptr, pend, translate, syntax, b) - const char **p_ptr, *pend; - char *translate; - reg_syntax_t syntax; - unsigned char *b; -{ - unsigned this_char; - - const char *p = *p_ptr; - int range_start, range_end; - - if (p == pend) - return REG_ERANGE; - - /* Even though the pattern is a signed `char *', we need to fetch - with unsigned char *'s; if the high bit of the pattern character - is set, the range endpoints will be negative if we fetch using a - signed char *. - - We also want to fetch the endpoints without translating them; the - appropriate translation is done in the bit-setting loop below. */ - range_start = ((unsigned char *) p)[-2]; - range_end = ((unsigned char *) p)[0]; - - /* Have to increment the pointer into the pattern string, so the - caller isn't still at the ending character. */ - (*p_ptr)++; - - /* If the start is after the end, the range is empty. */ - if (range_start > range_end) - return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; - - /* Here we see why `this_char' has to be larger than an `unsigned - char' -- the range is inclusive, so if `range_end' == 0xff - (assuming 8-bit characters), we would otherwise go into an infinite - loop, since all characters <= 0xff. */ - for (this_char = range_start; this_char <= range_end; this_char++) - { - SET_LIST_BIT (TRANSLATE (this_char)); - } - - return REG_NOERROR; -} - -/* Failure stack declarations and macros; both re_compile_fastmap and - re_match_2 use a failure stack. These have to be macros because of - REGEX_ALLOCATE. */ - - -/* Number of failure points for which to initially allocate space - when matching. If this number is exceeded, we allocate more - space, so it is not a hard limit. */ -#ifndef INIT_FAILURE_ALLOC -#define INIT_FAILURE_ALLOC 5 -#endif - -/* Roughly the maximum number of failure points on the stack. Would be - exactly that if always used MAX_FAILURE_SPACE each time we failed. - This is a variable only so users of regex can assign to it; we never - change it ourselves. */ -int re_max_failures = 2000; - -typedef const unsigned char *fail_stack_elt_t; - -typedef struct -{ - fail_stack_elt_t *stack; - unsigned size; - unsigned avail; /* Offset of next open position. */ -} fail_stack_type; - -#define FAIL_STACK_EMPTY() (fail_stack.avail == 0) -#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0) -#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) -#define FAIL_STACK_TOP() (fail_stack.stack[fail_stack.avail]) - - -/* Initialize `fail_stack'. Do `return -2' if the alloc fails. */ - -#define INIT_FAIL_STACK() \ - do { \ - fail_stack.stack = (fail_stack_elt_t *) \ - REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \ - \ - if (fail_stack.stack == NULL) \ - return -2; \ - \ - fail_stack.size = INIT_FAILURE_ALLOC; \ - fail_stack.avail = 0; \ - } while (0) - - -/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items. - - Return 1 if succeeds, and 0 if either ran out of memory - allocating space for it or it was already too large. - - REGEX_REALLOCATE requires `destination' be declared. */ - -#define DOUBLE_FAIL_STACK(fail_stack) \ - ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \ - ? 0 \ - : ((fail_stack).stack = (fail_stack_elt_t *) \ - REGEX_REALLOCATE ((fail_stack).stack, \ - (fail_stack).size * sizeof (fail_stack_elt_t), \ - ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ - \ - (fail_stack).stack == NULL \ - ? 0 \ - : ((fail_stack).size <<= 1, \ - 1))) - - -/* Push PATTERN_OP on FAIL_STACK. - - Return 1 if was able to do so and 0 if ran out of memory allocating - space to do so. */ -#define PUSH_PATTERN_OP(pattern_op, fail_stack) \ - ((FAIL_STACK_FULL () \ - && !DOUBLE_FAIL_STACK (fail_stack)) \ - ? 0 \ - : ((fail_stack).stack[(fail_stack).avail++] = pattern_op, \ - 1)) - -/* This pushes an item onto the failure stack. Must be a four-byte - value. Assumes the variable `fail_stack'. Probably should only - be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_ITEM(item) \ - fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item - -/* The complement operation. Assumes `fail_stack' is nonempty. */ -#define POP_FAILURE_ITEM() fail_stack.stack[--fail_stack.avail] - -/* Used to omit pushing failure point id's when we're not debugging. */ -#ifdef DEBUG -#define DEBUG_PUSH PUSH_FAILURE_ITEM -#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_ITEM () -#else -#define DEBUG_PUSH(item) -#define DEBUG_POP(item_addr) -#endif - - -/* Push the information about the state we will need - if we ever fail back to it. - - Requires variables fail_stack, regstart, regend, reg_info, and - num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be - declared. - - Does `return FAILURE_CODE' if runs out of memory. */ - -#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ - do { \ - char *destination; \ - /* Must be int, so when we don't save any registers, the arithmetic \ - of 0 + -1 isn't done as unsigned. */ \ - int this_reg; \ - \ - DEBUG_STATEMENT (failure_id++); \ - DEBUG_STATEMENT (nfailure_points_pushed++); \ - DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ - DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\ - DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\ - \ - DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \ - DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ - \ - /* Ensure we have enough space allocated for what we will push. */ \ - while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ - { \ - if (!DOUBLE_FAIL_STACK (fail_stack)) \ - return failure_code; \ - \ - DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ - (fail_stack).size); \ - DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ - } \ - \ - /* Push the info, starting with the registers. */ \ - DEBUG_PRINT1 ("\n"); \ - \ - for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ - this_reg++) \ - { \ - DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ - DEBUG_STATEMENT (num_regs_pushed++); \ - \ - DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ - PUSH_FAILURE_ITEM (regstart[this_reg]); \ - \ - DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ - PUSH_FAILURE_ITEM (regend[this_reg]); \ - \ - DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \ - DEBUG_PRINT2 (" match_null=%d", \ - REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ - DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ - DEBUG_PRINT2 (" matched_something=%d", \ - MATCHED_SOMETHING (reg_info[this_reg])); \ - DEBUG_PRINT2 (" ever_matched=%d", \ - EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ - DEBUG_PRINT1 ("\n"); \ - PUSH_FAILURE_ITEM (reg_info[this_reg].word); \ - } \ - \ - DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\ - PUSH_FAILURE_ITEM (lowest_active_reg); \ - \ - DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ - PUSH_FAILURE_ITEM (highest_active_reg); \ - \ - DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \ - DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ - PUSH_FAILURE_ITEM (pattern_place); \ - \ - DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \ - DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ - size2); \ - DEBUG_PRINT1 ("'\n"); \ - PUSH_FAILURE_ITEM (string_place); \ - \ - DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ - DEBUG_PUSH (failure_id); \ - } while (0) - -/* This is the number of items that are pushed and popped on the stack - for each register. */ -#define NUM_REG_ITEMS 3 - -/* Individual items aside from the registers. */ -#ifdef DEBUG -#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */ -#else -#define NUM_NONREG_ITEMS 4 -#endif - -/* We push at most this many items on the stack. */ -#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS) - -/* We actually push this many items. */ -#define NUM_FAILURE_ITEMS \ - ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \ - + NUM_NONREG_ITEMS) - -/* How many items can still be added to the stack without overflowing it. */ -#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) - - -/* Pops what PUSH_FAIL_STACK pushes. - - We restore into the parameters, all of which should be lvalues: - STR -- the saved data position. - PAT -- the saved pattern position. - LOW_REG, HIGH_REG -- the highest and lowest active registers. - REGSTART, REGEND -- arrays of string positions. - REG_INFO -- array of information about each subexpression. - - Also assumes the variables `fail_stack' and (if debugging), `bufp', - `pend', `string1', `size1', `string2', and `size2'. */ - -#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ -{ \ - DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \ - int this_reg; \ - const unsigned char *string_temp; \ - \ - assert (!FAIL_STACK_EMPTY ()); \ - \ - /* Remove failure points and point to how many regs pushed. */ \ - DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ - DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ - DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ - \ - assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ - \ - DEBUG_POP (&failure_id); \ - DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ - \ - /* If the saved string location is NULL, it came from an \ - on_failure_keep_string_jump opcode, and we want to throw away the \ - saved NULL, thus retaining our current position in the string. */ \ - string_temp = POP_FAILURE_ITEM (); \ - if (string_temp != NULL) \ - str = (const char *) string_temp; \ - \ - DEBUG_PRINT2 (" Popping string 0x%x: `", str); \ - DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ - DEBUG_PRINT1 ("'\n"); \ - \ - pat = (unsigned char *) POP_FAILURE_ITEM (); \ - DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \ - DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ - \ - /* Restore register info. */ \ - high_reg = (unsigned) POP_FAILURE_ITEM (); \ - DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ - \ - low_reg = (unsigned) POP_FAILURE_ITEM (); \ - DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ - \ - for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ - { \ - DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ - \ - reg_info[this_reg].word = POP_FAILURE_ITEM (); \ - DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \ - \ - regend[this_reg] = (const char *) POP_FAILURE_ITEM (); \ - DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ - \ - regstart[this_reg] = (const char *) POP_FAILURE_ITEM (); \ - DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ - } \ - \ - DEBUG_STATEMENT (nfailure_points_popped++); \ -} /* POP_FAILURE_POINT */ - -/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in - BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible - characters can start a string that matches the pattern. This fastmap - is used by re_search to skip quickly over impossible starting points. - - The caller must supply the address of a (1 << BYTEWIDTH)-byte data - area as BUFP->fastmap. - - We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in - the pattern buffer. - - Returns 0 if we succeed, -2 if an internal error. */ - -int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; -{ - int j, k; - fail_stack_type fail_stack; -#ifndef REGEX_MALLOC - char *destination; -#endif - /* We don't push any register information onto the failure stack. */ - unsigned num_regs = 0; - - register char *fastmap = bufp->fastmap; - unsigned char *pattern = bufp->buffer; - unsigned long size = bufp->used; - const unsigned char *p = pattern; - register unsigned char *pend = pattern + size; - - /* Assume that each path through the pattern can be null until - proven otherwise. We set this false at the bottom of switch - statement, to which we get only if a particular path doesn't - match the empty string. */ - boolean path_can_be_null = true; - - /* We aren't doing a `succeed_n' to begin with. */ - boolean succeed_n_p = false; - - assert (fastmap != NULL && p != NULL); - - INIT_FAIL_STACK (); - bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ - bufp->fastmap_accurate = 1; /* It will be when we're done. */ - bufp->can_be_null = 0; - - while (p != pend || !FAIL_STACK_EMPTY ()) - { - if (p == pend) - { - bufp->can_be_null |= path_can_be_null; - - /* Reset for next path. */ - path_can_be_null = true; - - p = fail_stack.stack[--fail_stack.avail]; - } - - /* We should never be about to go beyond the end of the pattern. */ - assert (p < pend); - -#ifdef SWITCH_ENUM_BUG - switch ((int) ((re_opcode_t) *p++)) -#else - switch ((re_opcode_t) *p++) -#endif - { - - /* I guess the idea here is to simply not bother with a fastmap - if a backreference is used, since it's too hard to figure out - the fastmap for the corresponding group. Setting - `can_be_null' stops `re_search_2' from using the fastmap, so - that is all we do. */ - case duplicate: - bufp->can_be_null = 1; - return 0; - - - /* Following are the cases which match a character. These end - with `break'. */ - - case exactn: - fastmap[p[1]] = 1; - break; - - - case charset: - for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) - if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) - fastmap[j] = 1; - break; - - - case charset_not: - /* Chars beyond end of map must be allowed. */ - for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) - fastmap[j] = 1; - - for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) - if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) - fastmap[j] = 1; - break; - - - case wordchar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) == Sword) - fastmap[j] = 1; - break; - - - case notwordchar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) != Sword) - fastmap[j] = 1; - break; - - - case anychar: - /* `.' matches anything ... */ - for (j = 0; j < (1 << BYTEWIDTH); j++) - fastmap[j] = 1; - - /* ... except perhaps newline. */ - if (!(bufp->syntax & RE_DOT_NEWLINE)) - fastmap['\n'] = 0; - - /* Return if we have already set `can_be_null'; if we have, - then the fastmap is irrelevant. Something's wrong here. */ - else if (bufp->can_be_null) - return 0; - - /* Otherwise, have to check alternative paths. */ - break; - - -#ifdef emacs - case syntaxspec: - k = *p++; - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) == (enum syntaxcode) k) - fastmap[j] = 1; - break; - - - case notsyntaxspec: - k = *p++; - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) != (enum syntaxcode) k) - fastmap[j] = 1; - break; - - - /* All cases after this match the empty string. These end with - `continue'. */ - - - case before_dot: - case at_dot: - case after_dot: - continue; -#endif /* not emacs */ - - - case no_op: - case begline: - case endline: - case begbuf: - case endbuf: - case wordbound: - case notwordbound: - case wordbeg: - case wordend: - case push_dummy_failure: - continue; - - - case jump_n: - case pop_failure_jump: - case maybe_pop_jump: - case jump: - case jump_past_alt: - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR (j, p); - p += j; - if (j > 0) - continue; - - /* Jump backward implies we just went through the body of a - loop and matched nothing. Opcode jumped to should be - `on_failure_jump' or `succeed_n'. Just treat it like an - ordinary jump. For a * loop, it has pushed its failure - point already; if so, discard that as redundant. */ - if ((re_opcode_t) *p != on_failure_jump - && (re_opcode_t) *p != succeed_n) - continue; - - p++; - EXTRACT_NUMBER_AND_INCR (j, p); - p += j; - - /* If what's on the stack is where we are now, pop it. */ - if (!FAIL_STACK_EMPTY () - && fail_stack.stack[fail_stack.avail - 1] == p) - fail_stack.avail--; - - continue; - - - case on_failure_jump: - case on_failure_keep_string_jump: - handle_on_failure_jump: - EXTRACT_NUMBER_AND_INCR (j, p); - - /* For some patterns, e.g., `(a?)?', `p+j' here points to the - end of the pattern. We don't want to push such a point, - since when we restore it above, entering the switch will - increment `p' past the end of the pattern. We don't need - to push such a point since we obviously won't find any more - fastmap entries beyond `pend'. Such a pattern can match - the null string, though. */ - if (p + j < pend) - { - if (!PUSH_PATTERN_OP (p + j, fail_stack)) - return -2; - } - else - bufp->can_be_null = 1; - - if (succeed_n_p) - { - EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ - succeed_n_p = false; - } - - continue; - - - case succeed_n: - /* Get to the number of times to succeed. */ - p += 2; - - /* Increment p past the n for when k != 0. */ - EXTRACT_NUMBER_AND_INCR (k, p); - if (k == 0) - { - p -= 4; - succeed_n_p = true; /* Spaghetti code alert. */ - goto handle_on_failure_jump; - } - continue; - - - case set_number_at: - p += 4; - continue; - - - case start_memory: - case stop_memory: - p += 2; - continue; - - - default: - abort (); /* We have listed all the cases. */ - } /* switch *p++ */ - - /* Getting here means we have found the possible starting - characters for one path of the pattern -- and that the empty - string does not match. We need not follow this path further. - Instead, look at the next alternative (remembered on the - stack), or quit if no more. The test at the top of the loop - does these things. */ - path_can_be_null = false; - p = pend; - } /* while p */ - - /* Set `can_be_null' for the last path (also the first path, if the - pattern is empty). */ - bufp->can_be_null |= path_can_be_null; - return 0; -} /* re_compile_fastmap */ - -/* Set REGS to hold NUM_REGS registers, storing them in STARTS and - ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use - this memory for recording register information. STARTS and ENDS - must be allocated using the malloc library routine, and must each - be at least NUM_REGS * sizeof (regoff_t) bytes long. - - If NUM_REGS == 0, then subsequent matches should allocate their own - register data. - - Unless this function is called, the first search or match using - PATTERN_BUFFER will allocate its own register data, without - freeing the old data. */ - -void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - unsigned num_regs; - regoff_t *starts, *ends; -{ - if (num_regs) - { - bufp->regs_allocated = REGS_REALLOCATE; - regs->num_regs = num_regs; - regs->start = starts; - regs->end = ends; - } - else - { - bufp->regs_allocated = REGS_UNALLOCATED; - regs->num_regs = 0; - regs->start = regs->end = (regoff_t *) 0; - } -} - -/* Searching routines. */ - -/* Like re_search_2, below, but only one string is specified, and - doesn't let you say where to stop matching. */ - -int -re_search (bufp, string, size, startpos, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, startpos, range; - struct re_registers *regs; -{ - return re_search_2 (bufp, NULL, 0, string, size, startpos, range, - regs, size); -} - - -/* Using the compiled pattern in BUFP->buffer, first tries to match the - virtual concatenation of STRING1 and STRING2, starting first at index - STARTPOS, then at STARTPOS + 1, and so on. - - STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. - - RANGE is how far to scan while trying to match. RANGE = 0 means try - only at STARTPOS; in general, the last start tried is STARTPOS + - RANGE. - - In REGS, return the indices of the virtual concatenation of STRING1 - and STRING2 that matched the entire BUFP->buffer and its contained - subexpressions. - - Do not consider matching one past the index STOP in the virtual - concatenation of STRING1 and STRING2. - - We return either the position in the strings at which the match was - found, -1 if no match, or -2 if error (such as failure - stack overflow). */ - -int -re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int startpos; - int range; - struct re_registers *regs; - int stop; -{ - int val; - register char *fastmap = bufp->fastmap; - register char *translate = bufp->translate; - int total_size = size1 + size2; - int endpos = startpos + range; - - /* Check for out-of-range STARTPOS. */ - if (startpos < 0 || startpos > total_size) - return -1; - - /* Fix up RANGE if it might eventually take us outside - the virtual concatenation of STRING1 and STRING2. */ - if (endpos < -1) - range = -1 - startpos; - else if (endpos > total_size) - range = total_size - startpos; - - /* If the search isn't to be a backwards one, don't waste time in a - search for a pattern that must be anchored. */ - if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0) - { - if (startpos > 0) - return -1; - else - range = 1; - } - - /* Update the fastmap now if not correct already. */ - if (fastmap && !bufp->fastmap_accurate) - if (re_compile_fastmap (bufp) == -2) - return -2; - - /* Loop through the string, looking for a place to start matching. */ - for (;;) - { - /* If a fastmap is supplied, skip quickly over characters that - cannot be the start of a match. If the pattern can match the - null string, however, we don't need to skip characters; we want - the first null string. */ - if (fastmap && startpos < total_size && !bufp->can_be_null) - { - if (range > 0) /* Searching forwards. */ - { - register const char *d; - register int lim = 0; - int irange = range; - - if (startpos < size1 && startpos + range >= size1) - lim = range - (size1 - startpos); - - d = (startpos >= size1 ? string2 - size1 : string1) + startpos; - - /* Written out as an if-else to avoid testing `translate' - inside the loop. */ - if (translate) - while (range > lim - && !fastmap[(unsigned char) - translate[(unsigned char) *d++]]) - range--; - else - while (range > lim && !fastmap[(unsigned char) *d++]) - range--; - - startpos += irange - range; - } - else /* Searching backwards. */ - { - register char c = (size1 == 0 || startpos >= size1 - ? string2[startpos - size1] - : string1[startpos]); - - if (!fastmap[(unsigned char) TRANSLATE (c)]) - goto advance; - } - } - - /* If can't match the null string, and that's all we have left, fail. */ - if (range >= 0 && startpos == total_size && fastmap - && !bufp->can_be_null) - return -1; - - val = re_match_2 (bufp, string1, size1, string2, size2, - startpos, regs, stop); - if (val >= 0) - return startpos; - - if (val == -2) - return -2; - - advance: - if (!range) - break; - else if (range > 0) - { - range--; - startpos++; - } - else - { - range++; - startpos--; - } - } - return -1; -} /* re_search_2 */ - -/* Declarations and macros for re_match_2. */ - -static int bcmp_translate (); -static boolean alt_match_null_string_p (), - common_op_match_null_string_p (), - group_match_null_string_p (); - -/* Structure for per-register (a.k.a. per-group) information. - This must not be longer than one word, because we push this value - onto the failure stack. Other register information, such as the - starting and ending positions (which are addresses), and the list of - inner groups (which is a bits list) are maintained in separate - variables. - - We are making a (strictly speaking) nonportable assumption here: that - the compiler will pack our bit fields into something that fits into - the type of `word', i.e., is something that fits into one item on the - failure stack. */ -typedef union -{ - fail_stack_elt_t word; - struct - { - /* This field is one if this group can match the empty string, - zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */ -#define MATCH_NULL_UNSET_VALUE 3 - unsigned match_null_string_p : 2; - unsigned is_active : 1; - unsigned matched_something : 1; - unsigned ever_matched_something : 1; - } bits; -} register_info_type; - -#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) -#define IS_ACTIVE(R) ((R).bits.is_active) -#define MATCHED_SOMETHING(R) ((R).bits.matched_something) -#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something) - - -/* Call this when have matched a real character; it sets `matched' flags - for the subexpressions which we are currently inside. Also records - that those subexprs have matched. */ -#define SET_REGS_MATCHED() \ - do \ - { \ - unsigned r; \ - for (r = lowest_active_reg; r <= highest_active_reg; r++) \ - { \ - MATCHED_SOMETHING (reg_info[r]) \ - = EVER_MATCHED_SOMETHING (reg_info[r]) \ - = 1; \ - } \ - } \ - while (0) - - -/* This converts PTR, a pointer into one of the search strings `string1' - and `string2' into an offset from the beginning of that string. */ -#define POINTER_TO_OFFSET(ptr) \ - (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1) - -/* Registers are set to a sentinel when they haven't yet matched. */ -#define REG_UNSET_VALUE ((char *) -1) -#define REG_UNSET(e) ((e) == REG_UNSET_VALUE) - - -/* Macros for dealing with the split strings in re_match_2. */ - -#define MATCHING_IN_FIRST_STRING (dend == end_match_1) - -/* Call before fetching a character with *d. This switches over to - string2 if necessary. */ -#define PREFETCH() \ - while (d == dend) \ - { \ - /* End of string2 => fail. */ \ - if (dend == end_match_2) \ - goto fail; \ - /* End of string1 => advance to string2. */ \ - d = string2; \ - dend = end_match_2; \ - } - - -/* Test if at very beginning or at very end of the virtual concatenation - of `string1' and `string2'. If only one string, it's `string2'. */ -#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) -#define AT_STRINGS_END(d) ((d) == end2) - - -/* Test if D points to a character which is word-constituent. We have - two special cases to check for: if past the end of string1, look at - the first character in string2; and if before the beginning of - string2, look at the last character in string1. */ -#define WORDCHAR_P(d) \ - (SYNTAX ((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ - == Sword) - -/* Test if the character before D and the one at D differ with respect - to being word-constituent. */ -#define AT_WORD_BOUNDARY(d) \ - (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ - || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) - - -/* Free everything we malloc. */ -#ifdef REGEX_MALLOC -#define FREE_VAR(var) if (var) free (var); var = NULL -#define FREE_VARIABLES() \ - do { \ - FREE_VAR (fail_stack.stack); \ - FREE_VAR (regstart); \ - FREE_VAR (regend); \ - FREE_VAR (old_regstart); \ - FREE_VAR (old_regend); \ - FREE_VAR (best_regstart); \ - FREE_VAR (best_regend); \ - FREE_VAR (reg_info); \ - FREE_VAR (reg_dummy); \ - FREE_VAR (reg_info_dummy); \ - } while (0) -#else /* not REGEX_MALLOC */ -/* Some MIPS systems (at least) want this to free alloca'd storage. */ -#define FREE_VARIABLES() alloca (0) -#endif /* not REGEX_MALLOC */ - - -/* These values must meet several constraints. They must not be valid - register values; since we have a limit of 255 registers (because - we use only one byte in the pattern for the register number), we can - use numbers larger than 255. They must differ by 1, because of - NUM_FAILURE_ITEMS above. And the value for the lowest register must - be larger than the value for the highest register, so we do not try - to actually save any registers when none are active. */ -#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) -#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) - -/* Matching routines. */ - -#ifndef emacs /* Emacs never uses this. */ -/* re_match is like re_match_2 except it takes only a single string. */ - -int -re_match (bufp, string, size, pos, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, pos; - struct re_registers *regs; - { - return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size); -} -#endif /* not emacs */ - - -/* re_match_2 matches the compiled pattern in BUFP against the - the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 - and SIZE2, respectively). We start matching at POS, and stop - matching at STOP. - - If REGS is non-null and the `no_sub' field of BUFP is nonzero, we - store offsets for the substring each group matched in REGS. See the - documentation for exactly how many groups we fill. - - We return -1 if no match, -2 if an internal error (such as the - failure stack overflowing). Otherwise, we return the length of the - matched substring. */ - -int -re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; -{ - /* General temporaries. */ - int mcnt; - unsigned char *p1; - - /* Just past the end of the corresponding string. */ - const char *end1, *end2; - - /* Pointers into string1 and string2, just past the last characters in - each to consider matching. */ - const char *end_match_1, *end_match_2; - - /* Where we are in the data, and the end of the current string. */ - const char *d, *dend; - - /* Where we are in the pattern, and the end of the pattern. */ - unsigned char *p = bufp->buffer; - register unsigned char *pend = p + bufp->used; - - /* We use this to map every character in the string. */ - char *translate = bufp->translate; - - /* Failure point stack. Each place that can handle a failure further - down the line pushes a failure point on this stack. It consists of - restart, regend, and reg_info for all registers corresponding to - the subexpressions we're currently inside, plus the number of such - registers, and, finally, two char *'s. The first char * is where - to resume scanning the pattern; the second one is where to resume - scanning the strings. If the latter is zero, the failure point is - a ``dummy''; if a failure happens and the failure point is a dummy, - it gets discarded and the next next one is tried. */ - fail_stack_type fail_stack; -#ifdef DEBUG - static unsigned failure_id = 0; - unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0; -#endif - - /* We fill all the registers internally, independent of what we - return, for use in backreferences. The number here includes - an element for register zero. */ - unsigned num_regs = bufp->re_nsub + 1; - - /* The currently active registers. */ - unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG; - unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG; - - /* Information on the contents of registers. These are pointers into - the input strings; they record just what was matched (on this - attempt) by a subexpression part of the pattern, that is, the - regnum-th regstart pointer points to where in the pattern we began - matching and the regnum-th regend points to right after where we - stopped matching the regnum-th subexpression. (The zeroth register - keeps track of what the whole pattern matches.) */ - const char **regstart, **regend; - - /* If a group that's operated upon by a repetition operator fails to - match anything, then the register for its start will need to be - restored because it will have been set to wherever in the string we - are when we last see its open-group operator. Similarly for a - register's end. */ - const char **old_regstart, **old_regend; - - /* The is_active field of reg_info helps us keep track of which (possibly - nested) subexpressions we are currently in. The matched_something - field of reg_info[reg_num] helps us tell whether or not we have - matched any of the pattern so far this time through the reg_num-th - subexpression. These two fields get reset each time through any - loop their register is in. */ - register_info_type *reg_info; - - /* The following record the register info as found in the above - variables when we find a match better than any we've seen before. - This happens as we backtrack through the failure points, which in - turn happens only if we have not yet matched the entire string. */ - unsigned best_regs_set = false; - const char **best_regstart, **best_regend; - - /* Logically, this is `best_regend[0]'. But we don't want to have to - allocate space for that if we're not allocating space for anything - else (see below). Also, we never need info about register 0 for - any of the other register vectors, and it seems rather a kludge to - treat `best_regend' differently than the rest. So we keep track of - the end of the best match so far in a separate variable. We - initialize this to NULL so that when we backtrack the first time - and need to test it, it's not garbage. */ - const char *match_end = NULL; - - /* Used when we pop values we don't care about. */ - const char **reg_dummy; - register_info_type *reg_info_dummy; - -#ifdef DEBUG - /* Counts the total number of registers pushed. */ - unsigned num_regs_pushed = 0; -#endif - - DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); - - INIT_FAIL_STACK (); - - /* Do not bother to initialize all the register variables if there are - no groups in the pattern, as it takes a fair amount of time. If - there are groups, we include space for register 0 (the whole - pattern), even though we never use it, since it simplifies the - array indexing. We should fix this. */ - if (bufp->re_nsub) - { - regstart = REGEX_TALLOC (num_regs, const char *); - regend = REGEX_TALLOC (num_regs, const char *); - old_regstart = REGEX_TALLOC (num_regs, const char *); - old_regend = REGEX_TALLOC (num_regs, const char *); - best_regstart = REGEX_TALLOC (num_regs, const char *); - best_regend = REGEX_TALLOC (num_regs, const char *); - reg_info = REGEX_TALLOC (num_regs, register_info_type); - reg_dummy = REGEX_TALLOC (num_regs, const char *); - reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type); - - if (!(regstart && regend && old_regstart && old_regend && reg_info - && best_regstart && best_regend && reg_dummy && reg_info_dummy)) - { - FREE_VARIABLES (); - return -2; - } - } -#ifdef REGEX_MALLOC - else - { - /* We must initialize all our variables to NULL, so that - `FREE_VARIABLES' doesn't try to free them. */ - regstart = regend = old_regstart = old_regend = best_regstart - = best_regend = reg_dummy = NULL; - reg_info = reg_info_dummy = (register_info_type *) NULL; - } -#endif /* REGEX_MALLOC */ - - /* The starting position is bogus. */ - if (pos < 0 || pos > size1 + size2) - { - FREE_VARIABLES (); - return -1; - } - - /* Initialize subexpression text positions to -1 to mark ones that no - start_memory/stop_memory has been seen for. Also initialize the - register information struct. */ - for (mcnt = 1; mcnt < num_regs; mcnt++) - { - regstart[mcnt] = regend[mcnt] - = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; - - REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; - IS_ACTIVE (reg_info[mcnt]) = 0; - MATCHED_SOMETHING (reg_info[mcnt]) = 0; - EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; - } - - /* We move `string1' into `string2' if the latter's empty -- but not if - `string1' is null. */ - if (size2 == 0 && string1 != NULL) - { - string2 = string1; - size2 = size1; - string1 = 0; - size1 = 0; - } - end1 = string1 + size1; - end2 = string2 + size2; - - /* Compute where to stop matching, within the two strings. */ - if (stop <= size1) - { - end_match_1 = string1 + stop; - end_match_2 = string2; - } - else - { - end_match_1 = end1; - end_match_2 = string2 + stop - size1; - } - - /* `p' scans through the pattern as `d' scans through the data. - `dend' is the end of the input string that `d' points within. `d' - is advanced into the following input string whenever necessary, but - this happens before fetching; therefore, at the beginning of the - loop, `d' can be pointing at the end of a string, but it cannot - equal `string2'. */ - if (size1 > 0 && pos <= size1) - { - d = string1 + pos; - dend = end_match_1; - } - else - { - d = string2 + pos - size1; - dend = end_match_2; - } - - DEBUG_PRINT1 ("The compiled pattern is: "); - DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); - DEBUG_PRINT1 ("The string to match is: `"); - DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); - DEBUG_PRINT1 ("'\n"); - - /* This loops over pattern commands. It exits by returning from the - function if the match is complete, or it drops through if the match - fails at this starting point in the input data. */ - for (;;) - { - DEBUG_PRINT2 ("\n0x%x: ", p); - - if (p == pend) - { /* End of pattern means we might have succeeded. */ - DEBUG_PRINT1 ("end of pattern ... "); - - /* If we haven't matched the entire string, and we want the - longest match, try backtracking. */ - if (d != end_match_2) - { - DEBUG_PRINT1 ("backtracking.\n"); - - if (!FAIL_STACK_EMPTY ()) - { /* More failure points to try. */ - boolean same_str_p = (FIRST_STRING_P (match_end) - == MATCHING_IN_FIRST_STRING); - - /* If exceeds best match so far, save it. */ - if (!best_regs_set - || (same_str_p && d > match_end) - || (!same_str_p && !MATCHING_IN_FIRST_STRING)) - { - best_regs_set = true; - match_end = d; - - DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); - - for (mcnt = 1; mcnt < num_regs; mcnt++) - { - best_regstart[mcnt] = regstart[mcnt]; - best_regend[mcnt] = regend[mcnt]; - } - } - goto fail; - } - - /* If no failure points, don't restore garbage. */ - else if (best_regs_set) - { - restore_best_regs: - /* Restore best match. It may happen that `dend == - end_match_1' while the restored d is in string2. - For example, the pattern `x.*y.*z' against the - strings `x-' and `y-z-', if the two strings are - not consecutive in memory. */ - DEBUG_PRINT1 ("Restoring best registers.\n"); - - d = match_end; - dend = ((d >= string1 && d <= end1) - ? end_match_1 : end_match_2); - - for (mcnt = 1; mcnt < num_regs; mcnt++) - { - regstart[mcnt] = best_regstart[mcnt]; - regend[mcnt] = best_regend[mcnt]; - } - } - } /* d != end_match_2 */ - - DEBUG_PRINT1 ("Accepting match.\n"); - - /* If caller wants register contents data back, do it. */ - if (regs && !bufp->no_sub) - { - /* Have the register data arrays been allocated? */ - if (bufp->regs_allocated == REGS_UNALLOCATED) - { /* No. So allocate them with malloc. We need one - extra element beyond `num_regs' for the `-1' marker - GNU code uses. */ - regs->num_regs = MAX (RE_NREGS, num_regs + 1); - regs->start = TALLOC (regs->num_regs, regoff_t); - regs->end = TALLOC (regs->num_regs, regoff_t); - if (regs->start == NULL || regs->end == NULL) - return -2; - bufp->regs_allocated = REGS_REALLOCATE; - } - else if (bufp->regs_allocated == REGS_REALLOCATE) - { /* Yes. If we need more elements than were already - allocated, reallocate them. If we need fewer, just - leave it alone. */ - if (regs->num_regs < num_regs + 1) - { - regs->num_regs = num_regs + 1; - RETALLOC (regs->start, regs->num_regs, regoff_t); - RETALLOC (regs->end, regs->num_regs, regoff_t); - if (regs->start == NULL || regs->end == NULL) - return -2; - } - } - else - assert (bufp->regs_allocated == REGS_FIXED); - - /* Convert the pointer data in `regstart' and `regend' to - indices. Register zero has to be set differently, - since we haven't kept track of any info for it. */ - if (regs->num_regs > 0) - { - regs->start[0] = pos; - regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1 - : d - string2 + size1); - } - - /* Go through the first `min (num_regs, regs->num_regs)' - registers, since that is all we initialized. */ - for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++) - { - if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) - regs->start[mcnt] = regs->end[mcnt] = -1; - else - { - regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]); - regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]); - } - } - - /* If the regs structure we return has more elements than - were in the pattern, set the extra elements to -1. If - we (re)allocated the registers, this is the case, - because we always allocate enough to have at least one - -1 at the end. */ - for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++) - regs->start[mcnt] = regs->end[mcnt] = -1; - } /* regs && !bufp->no_sub */ - - FREE_VARIABLES (); - DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n", - nfailure_points_pushed, nfailure_points_popped, - nfailure_points_pushed - nfailure_points_popped); - DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); - - mcnt = d - pos - (MATCHING_IN_FIRST_STRING - ? string1 - : string2 - size1); - - DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); - - return mcnt; - } - - /* Otherwise match next pattern command. */ -#ifdef SWITCH_ENUM_BUG - switch ((int) ((re_opcode_t) *p++)) -#else - switch ((re_opcode_t) *p++) -#endif - { - /* Ignore these. Used to ignore the n of succeed_n's which - currently have n == 0. */ - case no_op: - DEBUG_PRINT1 ("EXECUTING no_op.\n"); - break; - - - /* Match the next n pattern characters exactly. The following - byte in the pattern defines n, and the n bytes after that - are the characters to match. */ - case exactn: - mcnt = *p++; - DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); - - /* This is written out as an if-else so we don't waste time - testing `translate' inside the loop. */ - if (translate) - { - do - { - PREFETCH (); - if (translate[(unsigned char) *d++] != (char) *p++) - goto fail; - } - while (--mcnt); - } - else - { - do - { - PREFETCH (); - if (*d++ != (char) *p++) goto fail; - } - while (--mcnt); - } - SET_REGS_MATCHED (); - break; - - - /* Match any character except possibly a newline or a null. */ - case anychar: - DEBUG_PRINT1 ("EXECUTING anychar.\n"); - - PREFETCH (); - - if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') - || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) - goto fail; - - SET_REGS_MATCHED (); - DEBUG_PRINT2 (" Matched `%d'.\n", *d); - d++; - break; - - - case charset: - case charset_not: - { - register unsigned char c; - boolean not = (re_opcode_t) *(p - 1) == charset_not; - - DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); - - PREFETCH (); - c = TRANSLATE (*d); /* The character to match. */ - - /* Cast to `unsigned' instead of `unsigned char' in case the - bit list is a full 32 bytes long. */ - if (c < (unsigned) (*p * BYTEWIDTH) - && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; - - p += 1 + *p; - - if (!not) goto fail; - - SET_REGS_MATCHED (); - d++; - break; - } - - - /* The beginning of a group is represented by start_memory. - The arguments are the register number in the next byte, and the - number of groups inner to this one in the next. The text - matched within the group is recorded (in the internal - registers data structure) under the register number. */ - case start_memory: - DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); - - /* Find out if this group can match the empty string. */ - p1 = p; /* To send to group_match_null_string_p. */ - - if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[*p]) - = group_match_null_string_p (&p1, pend, reg_info); - - /* Save the position in the string where we were the last time - we were at this open-group operator in case the group is - operated upon by a repetition operator, e.g., with `(a*)*b' - against `ab'; then we want to ignore where we are now in - the string in case this attempt to match fails. */ - old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regstart[*p]) ? d : regstart[*p] - : regstart[*p]; - DEBUG_PRINT2 (" old_regstart: %d\n", - POINTER_TO_OFFSET (old_regstart[*p])); - - regstart[*p] = d; - DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); - - IS_ACTIVE (reg_info[*p]) = 1; - MATCHED_SOMETHING (reg_info[*p]) = 0; - - /* This is the new highest active register. */ - highest_active_reg = *p; - - /* If nothing was active before, this is the new lowest active - register. */ - if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) - lowest_active_reg = *p; - - /* Move past the register number and inner group count. */ - p += 2; - break; - - - /* The stop_memory opcode represents the end of a group. Its - arguments are the same as start_memory's: the register - number, and the number of inner groups. */ - case stop_memory: - DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); - - /* We need to save the string position the last time we were at - this close-group operator in case the group is operated - upon by a repetition operator, e.g., with `((a*)*(b*)*)*' - against `aba'; then we want to ignore where we are now in - the string in case this attempt to match fails. */ - old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regend[*p]) ? d : regend[*p] - : regend[*p]; - DEBUG_PRINT2 (" old_regend: %d\n", - POINTER_TO_OFFSET (old_regend[*p])); - - regend[*p] = d; - DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); - - /* This register isn't active anymore. */ - IS_ACTIVE (reg_info[*p]) = 0; - - /* If this was the only register active, nothing is active - anymore. */ - if (lowest_active_reg == highest_active_reg) - { - lowest_active_reg = NO_LOWEST_ACTIVE_REG; - highest_active_reg = NO_HIGHEST_ACTIVE_REG; - } - else - { /* We must scan for the new highest active register, since - it isn't necessarily one less than now: consider - (a(b)c(d(e)f)g). When group 3 ends, after the f), the - new highest active register is 1. */ - unsigned char r = *p - 1; - while (r > 0 && !IS_ACTIVE (reg_info[r])) - r--; - - /* If we end up at register zero, that means that we saved - the registers as the result of an `on_failure_jump', not - a `start_memory', and we jumped to past the innermost - `stop_memory'. For example, in ((.)*) we save - registers 1 and 2 as a result of the *, but when we pop - back to the second ), we are at the stop_memory 1. - Thus, nothing is active. */ - if (r == 0) - { - lowest_active_reg = NO_LOWEST_ACTIVE_REG; - highest_active_reg = NO_HIGHEST_ACTIVE_REG; - } - else - highest_active_reg = r; - } - - /* If just failed to match something this time around with a - group that's operated on by a repetition operator, try to - force exit from the ``loop'', and restore the register - information for this group that we had before trying this - last match. */ - if ((!MATCHED_SOMETHING (reg_info[*p]) - || (re_opcode_t) p[-3] == start_memory) - && (p + 2) < pend) - { - boolean is_a_jump_n = false; - - p1 = p + 2; - mcnt = 0; - switch ((re_opcode_t) *p1++) - { - case jump_n: - is_a_jump_n = true; - case pop_failure_jump: - case maybe_pop_jump: - case jump: - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if (is_a_jump_n) - p1 += 2; - break; - - default: - /* do nothing */ ; - } - p1 += mcnt; - - /* If the next operation is a jump backwards in the pattern - to an on_failure_jump right before the start_memory - corresponding to this stop_memory, exit from the loop - by forcing a failure after pushing on the stack the - on_failure_jump's jump in the pattern, and d. */ - if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump - && (re_opcode_t) p1[3] == start_memory && p1[4] == *p) - { - /* If this group ever matched anything, then restore - what its registers were before trying this last - failed match, e.g., with `(a*)*b' against `ab' for - regstart[1], and, e.g., with `((a*)*(b*)*)*' - against `aba' for regend[3]. - - Also restore the registers for inner groups for, - e.g., `((a*)(b*))*' against `aba' (register 3 would - otherwise get trashed). */ - - if (EVER_MATCHED_SOMETHING (reg_info[*p])) - { - unsigned r; - - EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; - - /* Restore this and inner groups' (if any) registers. */ - for (r = *p; r < *p + *(p + 1); r++) - { - regstart[r] = old_regstart[r]; - - /* xx why this test? */ - if ((int) old_regend[r] >= (int) regstart[r]) - regend[r] = old_regend[r]; - } - } - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - PUSH_FAILURE_POINT (p1 + mcnt, d, -2); - - goto fail; - } - } - - /* Move past the register number and the inner group count. */ - p += 2; - break; - - - /* \ has been turned into a `duplicate' command which is - followed by the numeric value of as the register number. */ - case duplicate: - { - register const char *d2, *dend2; - int regno = *p++; /* Get which register to match against. */ - DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); - - /* Can't back reference a group which we've never matched. */ - if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) - goto fail; - - /* Where in input to try to start matching. */ - d2 = regstart[regno]; - - /* Where to stop matching; if both the place to start and - the place to stop matching are in the same string, then - set to the place to stop, otherwise, for now have to use - the end of the first string. */ - - dend2 = ((FIRST_STRING_P (regstart[regno]) - == FIRST_STRING_P (regend[regno])) - ? regend[regno] : end_match_1); - for (;;) - { - /* If necessary, advance to next segment in register - contents. */ - while (d2 == dend2) - { - if (dend2 == end_match_2) break; - if (dend2 == regend[regno]) break; - - /* End of string1 => advance to string2. */ - d2 = string2; - dend2 = regend[regno]; - } - /* At end of register contents => success */ - if (d2 == dend2) break; - - /* If necessary, advance to next segment in data. */ - PREFETCH (); - - /* How many characters left in this segment to match. */ - mcnt = dend - d; - - /* Want how many consecutive characters we can match in - one shot, so, if necessary, adjust the count. */ - if (mcnt > dend2 - d2) - mcnt = dend2 - d2; - - /* Compare that many; failure if mismatch, else move - past them. */ - if (translate - ? bcmp_translate (d, d2, mcnt, translate) - : bcmp (d, d2, mcnt)) - goto fail; - d += mcnt, d2 += mcnt; - } - } - break; - - - /* begline matches the empty string at the beginning of the string - (unless `not_bol' is set in `bufp'), and, if - `newline_anchor' is set, after newlines. */ - case begline: - DEBUG_PRINT1 ("EXECUTING begline.\n"); - - if (AT_STRINGS_BEG (d)) - { - if (!bufp->not_bol) break; - } - else if (d[-1] == '\n' && bufp->newline_anchor) - { - break; - } - /* In all other cases, we fail. */ - goto fail; - - - /* endline is the dual of begline. */ - case endline: - DEBUG_PRINT1 ("EXECUTING endline.\n"); - - if (AT_STRINGS_END (d)) - { - if (!bufp->not_eol) break; - } - - /* We have to ``prefetch'' the next character. */ - else if ((d == end1 ? *string2 : *d) == '\n' - && bufp->newline_anchor) - { - break; - } - goto fail; - - - /* Match at the very beginning of the data. */ - case begbuf: - DEBUG_PRINT1 ("EXECUTING begbuf.\n"); - if (AT_STRINGS_BEG (d)) - break; - goto fail; - - - /* Match at the very end of the data. */ - case endbuf: - DEBUG_PRINT1 ("EXECUTING endbuf.\n"); - if (AT_STRINGS_END (d)) - break; - goto fail; - - - /* on_failure_keep_string_jump is used to optimize `.*\n'. It - pushes NULL as the value for the string on the stack. Then - `pop_failure_point' will keep the current value for the - string, instead of restoring it. To see why, consider - matching `foo\nbar' against `.*\n'. The .* matches the foo; - then the . fails against the \n. But the next thing we want - to do is match the \n against the \n; if we restored the - string value, we would be back at the foo. - - Because this is used only in specific cases, we don't need to - check all the things that `on_failure_jump' does, to make - sure the right things get saved on the stack. Hence we don't - share its code. The only reason to push anything on the - stack at all is that otherwise we would have to change - `anychar's code to do something besides goto fail in this - case; that seems worse than this. */ - case on_failure_keep_string_jump: - DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); - - EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); - - PUSH_FAILURE_POINT (p + mcnt, NULL, -2); - break; - - - /* Uses of on_failure_jump: - - Each alternative starts with an on_failure_jump that points - to the beginning of the next alternative. Each alternative - except the last ends with a jump that in effect jumps past - the rest of the alternatives. (They really jump to the - ending jump of the following alternative, because tensioning - these jumps is a hassle.) - - Repeats start with an on_failure_jump that points past both - the repetition text and either the following jump or - pop_failure_jump back to this on_failure_jump. */ - case on_failure_jump: - on_failure: - DEBUG_PRINT1 ("EXECUTING on_failure_jump"); - - EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); - - /* If this on_failure_jump comes right before a group (i.e., - the original * applied to a group), save the information - for that group and all inner ones, so that if we fail back - to this point, the group's information will be correct. - For example, in \(a*\)*\1, we need the preceding group, - and in \(\(a*\)b*\)\2, we need the inner group. */ - - /* We can't use `p' to check ahead because we push - a failure point to `p + mcnt' after we do this. */ - p1 = p; - - /* We need to skip no_op's before we look for the - start_memory in case this on_failure_jump is happening as - the result of a completed succeed_n, as in \(a\)\{1,3\}b\1 - against aba. */ - while (p1 < pend && (re_opcode_t) *p1 == no_op) - p1++; - - if (p1 < pend && (re_opcode_t) *p1 == start_memory) - { - /* We have a new highest active register now. This will - get reset at the start_memory we are about to get to, - but we will have saved all the registers relevant to - this repetition op, as described above. */ - highest_active_reg = *(p1 + 1) + *(p1 + 2); - if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) - lowest_active_reg = *(p1 + 1); - } - - DEBUG_PRINT1 (":\n"); - PUSH_FAILURE_POINT (p + mcnt, d, -2); - break; - - - /* A smart repeat ends with `maybe_pop_jump'. - We change it to either `pop_failure_jump' or `jump'. */ - case maybe_pop_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt); - { - register unsigned char *p2 = p; - - /* Compare the beginning of the repeat with what in the - pattern follows its end. If we can establish that there - is nothing that they would both match, i.e., that we - would have to backtrack because of (as in, e.g., `a*a') - then we can change to pop_failure_jump, because we'll - never have to backtrack. - - This is not true in the case of alternatives: in - `(a|ab)*' we do need to backtrack to the `ab' alternative - (e.g., if the string was `ab'). But instead of trying to - detect that here, the alternative has put on a dummy - failure point which is what we will end up popping. */ - - /* Skip over open/close-group commands. */ - while (p2 + 2 < pend - && ((re_opcode_t) *p2 == stop_memory - || (re_opcode_t) *p2 == start_memory)) - p2 += 3; /* Skip over args, too. */ - - /* If we're at the end of the pattern, we can change. */ - if (p2 == pend) - { - /* Consider what happens when matching ":\(.*\)" - against ":/". I don't really understand this code - yet. */ - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT1 - (" End of pattern: change to `pop_failure_jump'.\n"); - } - - else if ((re_opcode_t) *p2 == exactn - || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) - { - register unsigned char c - = *p2 == (unsigned char) endline ? '\n' : p2[2]; - p1 = p + mcnt; - - /* p1[0] ... p1[2] are the `on_failure_jump' corresponding - to the `maybe_finalize_jump' of this case. Examine what - follows. */ - if ((re_opcode_t) p1[3] == exactn && p1[5] != c) - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", - c, p1[5]); - } - - else if ((re_opcode_t) p1[3] == charset - || (re_opcode_t) p1[3] == charset_not) - { - int not = (re_opcode_t) p1[3] == charset_not; - - if (c < (unsigned char) (p1[4] * BYTEWIDTH) - && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; - - /* `not' is equal to 1 if c would match, which means - that we can't change to pop_failure_jump. */ - if (!not) - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); - } - } - } - } - p -= 2; /* Point at relative address again. */ - if ((re_opcode_t) p[-1] != pop_failure_jump) - { - p[-1] = (unsigned char) jump; - DEBUG_PRINT1 (" Match => jump.\n"); - goto unconditional_jump; - } - /* Note fall through. */ - - - /* The end of a simple repeat has a pop_failure_jump back to - its matching on_failure_jump, where the latter will push a - failure point. The pop_failure_jump takes off failure - points put on by this pop_failure_jump's matching - on_failure_jump; we got through the pattern to here from the - matching on_failure_jump, so didn't fail. */ - case pop_failure_jump: - { - /* We need to pass separate storage for the lowest and - highest registers, even though we don't care about the - actual values. Otherwise, we will restore only one - register from the stack, since lowest will == highest in - `pop_failure_point'. */ - unsigned dummy_low_reg, dummy_high_reg; - unsigned char *pdummy; - const char *sdummy; - - DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n"); - POP_FAILURE_POINT (sdummy, pdummy, - dummy_low_reg, dummy_high_reg, - reg_dummy, reg_dummy, reg_info_dummy); - } - /* Note fall through. */ - - - /* Unconditionally jump (without popping any failure points). */ - case jump: - unconditional_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ - DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); - p += mcnt; /* Do the jump. */ - DEBUG_PRINT2 ("(to 0x%x).\n", p); - break; - - - /* We need this opcode so we can detect where alternatives end - in `group_match_null_string_p' et al. */ - case jump_past_alt: - DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n"); - goto unconditional_jump; - - - /* Normally, the on_failure_jump pushes a failure point, which - then gets popped at pop_failure_jump. We will end up at - pop_failure_jump, also, and with a pattern of, say, `a+', we - are skipping over the on_failure_jump, so we have to push - something meaningless for pop_failure_jump to pop. */ - case dummy_failure_jump: - DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n"); - /* It doesn't matter what we push for the string here. What - the code at `fail' tests is the value for the pattern. */ - PUSH_FAILURE_POINT (0, 0, -2); - goto unconditional_jump; - - - /* At the end of an alternative, we need to push a dummy failure - point in case we are followed by a `pop_failure_jump', because - we don't want the failure point for the alternative to be - popped. For example, matching `(a|ab)*' against `aab' - requires that we match the `ab' alternative. */ - case push_dummy_failure: - DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n"); - /* See comments just above at `dummy_failure_jump' about the - two zeroes. */ - PUSH_FAILURE_POINT (0, 0, -2); - break; - - /* Have to succeed matching what follows at least n times. - After that, handle like `on_failure_jump'. */ - case succeed_n: - EXTRACT_NUMBER (mcnt, p + 2); - DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt); - - assert (mcnt >= 0); - /* Originally, this is how many times we HAVE to succeed. */ - if (mcnt > 0) - { - mcnt--; - p += 2; - STORE_NUMBER_AND_INCR (p, mcnt); - DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt); - } - else if (mcnt == 0) - { - DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); - p[2] = (unsigned char) no_op; - p[3] = (unsigned char) no_op; - goto on_failure; - } - break; - - case jump_n: - EXTRACT_NUMBER (mcnt, p + 2); - DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt); - - /* Originally, this is how many times we CAN jump. */ - if (mcnt) - { - mcnt--; - STORE_NUMBER (p + 2, mcnt); - goto unconditional_jump; - } - /* If don't have to jump any more, skip over the rest of command. */ - else - p += 4; - break; - - case set_number_at: - { - DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); - - EXTRACT_NUMBER_AND_INCR (mcnt, p); - p1 = p + mcnt; - EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); - STORE_NUMBER (p1, mcnt); - break; - } - - case wordbound: - DEBUG_PRINT1 ("EXECUTING wordbound.\n"); - if (AT_WORD_BOUNDARY (d)) - break; - goto fail; - - case notwordbound: - DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); - if (AT_WORD_BOUNDARY (d)) - goto fail; - break; - - case wordbeg: - DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); - if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) - break; - goto fail; - - case wordend: - DEBUG_PRINT1 ("EXECUTING wordend.\n"); - if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) - && (!WORDCHAR_P (d) || AT_STRINGS_END (d))) - break; - goto fail; - -#ifdef emacs -#ifdef emacs19 - case before_dot: - DEBUG_PRINT1 ("EXECUTING before_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) >= point) - goto fail; - break; - - case at_dot: - DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) != point) - goto fail; - break; - - case after_dot: - DEBUG_PRINT1 ("EXECUTING after_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) <= point) - goto fail; - break; -#else /* not emacs19 */ - case at_dot: - DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point) - goto fail; - break; -#endif /* not emacs19 */ - - case syntaxspec: - DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); - mcnt = *p++; - goto matchsyntax; - - case wordchar: - DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n"); - mcnt = (int) Sword; - matchsyntax: - PREFETCH (); - if (SYNTAX (*d++) != (enum syntaxcode) mcnt) - goto fail; - SET_REGS_MATCHED (); - break; - - case notsyntaxspec: - DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt); - mcnt = *p++; - goto matchnotsyntax; - - case notwordchar: - DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n"); - mcnt = (int) Sword; - matchnotsyntax: - PREFETCH (); - if (SYNTAX (*d++) == (enum syntaxcode) mcnt) - goto fail; - SET_REGS_MATCHED (); - break; - -#else /* not emacs */ - case wordchar: - DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); - PREFETCH (); - if (!WORDCHAR_P (d)) - goto fail; - SET_REGS_MATCHED (); - d++; - break; - - case notwordchar: - DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); - PREFETCH (); - if (WORDCHAR_P (d)) - goto fail; - SET_REGS_MATCHED (); - d++; - break; -#endif /* not emacs */ - - default: - abort (); - } - continue; /* Successfully executed one pattern command; keep going. */ - - - /* We goto here if a matching operation fails. */ - fail: - if (!FAIL_STACK_EMPTY ()) - { /* A restart point is known. Restore to that state. */ - DEBUG_PRINT1 ("\nFAIL:\n"); - POP_FAILURE_POINT (d, p, - lowest_active_reg, highest_active_reg, - regstart, regend, reg_info); - - /* If this failure point is a dummy, try the next one. */ - if (!p) - goto fail; - - /* If we failed to the end of the pattern, don't examine *p. */ - assert (p <= pend); - if (p < pend) - { - boolean is_a_jump_n = false; - - /* If failed to a backwards jump that's part of a repetition - loop, need to pop this failure point and use the next one. */ - switch ((re_opcode_t) *p) - { - case jump_n: - is_a_jump_n = true; - case maybe_pop_jump: - case pop_failure_jump: - case jump: - p1 = p + 1; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - - if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n) - || (!is_a_jump_n - && (re_opcode_t) *p1 == on_failure_jump)) - goto fail; - break; - default: - /* do nothing */ ; - } - } - - if (d >= string1 && d <= end1) - dend = end_match_1; - } - else - break; /* Matching at this starting point really fails. */ - } /* for (;;) */ - - if (best_regs_set) - goto restore_best_regs; - - FREE_VARIABLES (); - - return -1; /* Failure to match. */ -} /* re_match_2 */ - -/* Subroutine definitions for re_match_2. */ - - -/* We are passed P pointing to a register number after a start_memory. - - Return true if the pattern up to the corresponding stop_memory can - match the empty string, and false otherwise. - - If we find the matching stop_memory, sets P to point to one past its number. - Otherwise, sets P to an undefined byte less than or equal to END. - - We don't handle duplicates properly (yet). */ - -static boolean -group_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *reg_info; -{ - int mcnt; - /* Point to after the args to the start_memory. */ - unsigned char *p1 = *p + 2; - - while (p1 < end) - { - /* Skip over opcodes that can match nothing, and return true or - false, as appropriate, when we get to one that can't, or to the - matching stop_memory. */ - - switch ((re_opcode_t) *p1) - { - /* Could be either a loop or a series of alternatives. */ - case on_failure_jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - - /* If the next operation is not a jump backwards in the - pattern. */ - - if (mcnt >= 0) - { - /* Go through the on_failure_jumps of the alternatives, - seeing if any of the alternatives cannot match nothing. - The last alternative starts with only a jump, - whereas the rest start with on_failure_jump and end - with a jump, e.g., here is the pattern for `a|b|c': - - /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 - /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 - /exactn/1/c - - So, we have to first go through the first (n-1) - alternatives and then deal with the last one separately. */ - - - /* Deal with the first (n-1) alternatives, which start - with an on_failure_jump (see above) that jumps to right - past a jump_past_alt. */ - - while ((re_opcode_t) p1[mcnt-3] == jump_past_alt) - { - /* `mcnt' holds how many bytes long the alternative - is, including the ending `jump_past_alt' and - its number. */ - - if (!alt_match_null_string_p (p1, p1 + mcnt - 3, - reg_info)) - return false; - - /* Move to right after this alternative, including the - jump_past_alt. */ - p1 += mcnt; - - /* Break if it's the beginning of an n-th alternative - that doesn't begin with an on_failure_jump. */ - if ((re_opcode_t) *p1 != on_failure_jump) - break; - - /* Still have to check that it's not an n-th - alternative that starts with an on_failure_jump. */ - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if ((re_opcode_t) p1[mcnt-3] != jump_past_alt) - { - /* Get to the beginning of the n-th alternative. */ - p1 -= 3; - break; - } - } - - /* Deal with the last alternative: go back and get number - of the `jump_past_alt' just before it. `mcnt' contains - the length of the alternative. */ - EXTRACT_NUMBER (mcnt, p1 - 2); - - if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) - return false; - - p1 += mcnt; /* Get past the n-th alternative. */ - } /* if mcnt > 0 */ - break; - - - case stop_memory: - assert (p1[1] == **p); - *p = p1 + 2; - return true; - - - default: - if (!common_op_match_null_string_p (&p1, end, reg_info)) - return false; - } - } /* while p1 < end */ - - return false; -} /* group_match_null_string_p */ - - -/* Similar to group_match_null_string_p, but doesn't deal with alternatives: - It expects P to be the first byte of a single alternative and END one - byte past the last. The alternative can contain groups. */ - -static boolean -alt_match_null_string_p (p, end, reg_info) - unsigned char *p, *end; - register_info_type *reg_info; -{ - int mcnt; - unsigned char *p1 = p; - - while (p1 < end) - { - /* Skip over opcodes that can match nothing, and break when we get - to one that can't. */ - - switch ((re_opcode_t) *p1) - { - /* It's a loop. */ - case on_failure_jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - break; - - default: - if (!common_op_match_null_string_p (&p1, end, reg_info)) - return false; - } - } /* while p1 < end */ - - return true; -} /* alt_match_null_string_p */ - - -/* Deals with the ops common to group_match_null_string_p and - alt_match_null_string_p. - - Sets P to one after the op and its arguments, if any. */ - -static boolean -common_op_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *reg_info; -{ - int mcnt; - boolean ret; - int reg_no; - unsigned char *p1 = *p; - - switch ((re_opcode_t) *p1++) - { - case no_op: - case begline: - case endline: - case begbuf: - case endbuf: - case wordbeg: - case wordend: - case wordbound: - case notwordbound: -#ifdef emacs - case before_dot: - case at_dot: - case after_dot: -#endif - break; - - case start_memory: - reg_no = *p1; - assert (reg_no > 0 && reg_no <= MAX_REGNUM); - ret = group_match_null_string_p (&p1, end, reg_info); - - /* Have to set this here in case we're checking a group which - contains a group and a back reference to it. */ - - if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; - - if (!ret) - return false; - break; - - /* If this is an optimized succeed_n for zero times, make the jump. */ - case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if (mcnt >= 0) - p1 += mcnt; - else - return false; - break; - - case succeed_n: - /* Get to the number of times to succeed. */ - p1 += 2; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - - if (mcnt == 0) - { - p1 -= 4; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - } - else - return false; - break; - - case duplicate: - if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) - return false; - break; - - case set_number_at: - p1 += 4; - - default: - /* All other opcodes mean we cannot match the empty string. */ - return false; - } - - *p = p1; - return true; -} /* common_op_match_null_string_p */ - - -/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN - bytes; nonzero otherwise. */ - -static int -bcmp_translate (s1, s2, len, translate) - unsigned char *s1, *s2; - register int len; - char *translate; -{ - register unsigned char *p1 = s1, *p2 = s2; - while (len) - { - if (translate[*p1++] != translate[*p2++]) return 1; - len--; - } - return 0; -} - -/* Entry points for GNU code. */ - -/* re_compile_pattern is the GNU regular expression compiler: it - compiles PATTERN (of length SIZE) and puts the result in BUFP. - Returns 0 if the pattern was valid, otherwise an error string. - - Assumes the `allocated' (and perhaps `buffer') and `translate' fields - are set in BUFP on entry. - - We call regex_compile to do the actual compilation. */ - -const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - int length; - struct re_pattern_buffer *bufp; -{ - reg_errcode_t ret; - - /* GNU code is written to assume at least RE_NREGS registers will be set - (and at least one extra will be -1). */ - bufp->regs_allocated = REGS_UNALLOCATED; - - /* And GNU code determines whether or not to get register information - by passing null for the REGS argument to re_match, etc., not by - setting no_sub. */ - bufp->no_sub = 0; - - /* Match anchors at newline. */ - bufp->newline_anchor = 1; - - ret = regex_compile (pattern, length, re_syntax_options, bufp); - - return re_error_msg[(int) ret]; -} - -/* Entry points compatible with 4.2 BSD regex library. We don't define - them if this is an Emacs or POSIX compilation. */ - -#if !defined (emacs) && !defined (_POSIX_SOURCE) - -/* BSD has one and only one pattern buffer. */ -static struct re_pattern_buffer re_comp_buf; - -char * -re_comp (s) - const char *s; -{ - reg_errcode_t ret; - - if (!s) - { - if (!re_comp_buf.buffer) - return "No previous regular expression"; - return 0; - } - - if (!re_comp_buf.buffer) - { - re_comp_buf.buffer = (unsigned char *) malloc (200); - if (re_comp_buf.buffer == NULL) - return "Memory exhausted"; - re_comp_buf.allocated = 200; - - re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); - if (re_comp_buf.fastmap == NULL) - return "Memory exhausted"; - } - - /* Since `re_exec' always passes NULL for the `regs' argument, we - don't need to initialize the pattern buffer fields which affect it. */ - - /* Match anchors at newlines. */ - re_comp_buf.newline_anchor = 1; - - ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf); - - /* Yes, we're discarding `const' here. */ - return (char *) re_error_msg[(int) ret]; -} - - -int -re_exec (s) - const char *s; -{ - const int len = strlen (s); - return - 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); -} -#endif /* not emacs and not _POSIX_SOURCE */ - -/* POSIX.2 functions. Don't define these for Emacs. */ - -#ifndef emacs - -/* regcomp takes a regular expression as a string and compiles it. - - PREG is a regex_t *. We do not expect any fields to be initialized, - since POSIX says we shouldn't. Thus, we set - - `buffer' to the compiled pattern; - `used' to the length of the compiled pattern; - `syntax' to RE_SYNTAX_POSIX_EXTENDED if the - REG_EXTENDED bit in CFLAGS is set; otherwise, to - RE_SYNTAX_POSIX_BASIC; - `newline_anchor' to REG_NEWLINE being set in CFLAGS; - `fastmap' and `fastmap_accurate' to zero; - `re_nsub' to the number of subexpressions in PATTERN. - - PATTERN is the address of the pattern string. - - CFLAGS is a series of bits which affect compilation. - - If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we - use POSIX basic syntax. - - If REG_NEWLINE is set, then . and [^...] don't match newline. - Also, regexec will try a match beginning after every newline. - - If REG_ICASE is set, then we considers upper- and lowercase - versions of letters to be equivalent when matching. - - If REG_NOSUB is set, then when PREG is passed to regexec, that - routine will report only success or failure, and nothing about the - registers. - - It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for - the return codes and their meanings.) */ - -int -regcomp (preg, pattern, cflags) - regex_t *preg; - const char *pattern; - int cflags; -{ - reg_errcode_t ret; - unsigned syntax - = (cflags & REG_EXTENDED) ? - RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC; - - /* regex_compile will allocate the space for the compiled pattern. */ - preg->buffer = 0; - preg->allocated = 0; - - /* Don't bother to use a fastmap when searching. This simplifies the - REG_NEWLINE case: if we used a fastmap, we'd have to put all the - characters after newlines into the fastmap. This way, we just try - every character. */ - preg->fastmap = 0; - - if (cflags & REG_ICASE) - { - unsigned i; - - preg->translate = (char *) malloc (CHAR_SET_SIZE); - if (preg->translate == NULL) - return (int) REG_ESPACE; - - /* Map uppercase characters to corresponding lowercase ones. */ - for (i = 0; i < CHAR_SET_SIZE; i++) - preg->translate[i] = ISUPPER (i) ? tolower (i) : i; - } - else - preg->translate = NULL; - - /* If REG_NEWLINE is set, newlines are treated differently. */ - if (cflags & REG_NEWLINE) - { /* REG_NEWLINE implies neither . nor [^...] match newline. */ - syntax &= ~RE_DOT_NEWLINE; - syntax |= RE_HAT_LISTS_NOT_NEWLINE; - /* It also changes the matching behavior. */ - preg->newline_anchor = 1; - } - else - preg->newline_anchor = 0; - - preg->no_sub = !!(cflags & REG_NOSUB); - - /* POSIX says a null character in the pattern terminates it, so we - can use strlen here in compiling the pattern. */ - ret = regex_compile (pattern, strlen (pattern), syntax, preg); - - /* POSIX doesn't distinguish between an unmatched open-group and an - unmatched close-group: both are REG_EPAREN. */ - if (ret == REG_ERPAREN) ret = REG_EPAREN; - - return (int) ret; -} - - -/* regexec searches for a given pattern, specified by PREG, in the - string STRING. - - If NMATCH is zero or REG_NOSUB was set in the cflags argument to - `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at - least NMATCH elements, and we set them to the offsets of the - corresponding matched substrings. - - EFLAGS specifies `execution flags' which affect matching: if - REG_NOTBOL is set, then ^ does not match at the beginning of the - string; if REG_NOTEOL is set, then $ does not match at the end. - - We return 0 if we find a match and REG_NOMATCH if not. */ - -int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *preg; - const char *string; - size_t nmatch; - regmatch_t pmatch[]; - int eflags; -{ - int ret; - struct re_registers regs; - regex_t private_preg; - int len = strlen (string); - boolean want_reg_info = !preg->no_sub && nmatch > 0; - - private_preg = *preg; - - private_preg.not_bol = !!(eflags & REG_NOTBOL); - private_preg.not_eol = !!(eflags & REG_NOTEOL); - - /* The user has told us exactly how many registers to return - information about, via `nmatch'. We have to pass that on to the - matching routines. */ - private_preg.regs_allocated = REGS_FIXED; - - if (want_reg_info) - { - regs.num_regs = nmatch; - regs.start = TALLOC (nmatch, regoff_t); - regs.end = TALLOC (nmatch, regoff_t); - if (regs.start == NULL || regs.end == NULL) - return (int) REG_NOMATCH; - } - - /* Perform the searching operation. */ - ret = re_search (&private_preg, string, len, - /* start: */ 0, /* range: */ len, - want_reg_info ? ®s : (struct re_registers *) 0); - - /* Copy the register information to the POSIX structure. */ - if (want_reg_info) - { - if (ret >= 0) - { - unsigned r; - - for (r = 0; r < nmatch; r++) - { - pmatch[r].rm_so = regs.start[r]; - pmatch[r].rm_eo = regs.end[r]; - } - } - - /* If we needed the temporary register info, free the space now. */ - free (regs.start); - free (regs.end); - } - - /* We want zero return to mean success, unlike `re_search'. */ - return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; -} - - -/* Returns a message corresponding to an error code, ERRCODE, returned - from either regcomp or regexec. We don't use PREG here. */ - -size_t -regerror (error_code, preg, errbuf, errbuf_size) - int error_code; - const regex_t *preg; - char *errbuf; - size_t errbuf_size; -{ - const char *msg; - size_t msg_size; - - if (error_code < 0 - || error_code >= (sizeof (re_error_msg) / sizeof (re_error_msg[0]))) - /* Only error codes returned by the rest of the code should be passed - to this routine. If we are given anything else, or if other regex - code generates an invalid error code, then the program has a bug. - Dump core so we can fix it. */ - abort (); - - msg = re_error_msg[error_code]; - - /* POSIX doesn't require that we do anything in this case, but why - not be nice. */ - if (! msg) - msg = "Success"; - - msg_size = strlen (msg) + 1; /* Includes the null. */ - - if (errbuf_size != 0) - { - if (msg_size > errbuf_size) - { - strncpy (errbuf, msg, errbuf_size - 1); - errbuf[errbuf_size - 1] = 0; - } - else - strcpy (errbuf, msg); - } - - return msg_size; -} - - -/* Free dynamically allocated space used by PREG. */ - -void -regfree (preg) - regex_t *preg; -{ - if (preg->buffer != NULL) - free (preg->buffer); - preg->buffer = NULL; - - preg->allocated = 0; - preg->used = 0; - - if (preg->fastmap != NULL) - free (preg->fastmap); - preg->fastmap = NULL; - preg->fastmap_accurate = 0; - - if (preg->translate != NULL) - free (preg->translate); - preg->translate = NULL; -} - -#endif /* not emacs */ - -#endif /* HAVE_REGEX_H */ diff --git a/ppremake/gnu_regex.h b/ppremake/gnu_regex.h deleted file mode 100644 index 07e71e5eac..0000000000 --- a/ppremake/gnu_regex.h +++ /dev/null @@ -1,491 +0,0 @@ -/* Definitions for data structures and routines for the regular - expression library, version 0.12. - - Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef GNU_REGEX_H -#define GNU_REGEX_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* POSIX says that must be included (by the caller) before - . */ - -#ifdef VMS -/* VMS doesn't have `size_t' in , even though POSIX says it - should be there. */ -#include -#endif - - -/* The following bits are used to determine the regexp syntax we - recognize. The set/not-set meanings are chosen so that Emacs syntax - remains the value 0. The bits are given in alphabetical order, and - the definitions shifted by one from the previous bit; thus, when we - add or remove a bit, only one other definition need change. */ -typedef unsigned reg_syntax_t; - -/* If this bit is not set, then \ inside a bracket expression is literal. - If set, then such a \ quotes the following character. */ -#define RE_BACKSLASH_ESCAPE_IN_LISTS (1) - -/* If this bit is not set, then + and ? are operators, and \+ and \? are - literals. - If set, then \+ and \? are operators and + and ? are literals. */ -#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) - -/* If this bit is set, then character classes are supported. They are: - [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], - [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. - If not set, then character classes are not supported. */ -#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) - -/* If this bit is set, then ^ and $ are always anchors (outside bracket - expressions, of course). - If this bit is not set, then it depends: - ^ is an anchor if it is at the beginning of a regular - expression or after an open-group or an alternation operator; - $ is an anchor if it is at the end of a regular expression, or - before a close-group or an alternation operator. - - This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because - POSIX draft 11.2 says that * etc. in leading positions is undefined. - We already implemented a previous draft which made those constructs - invalid, though, so we haven't changed the code back. */ -#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) - -/* If this bit is set, then special characters are always special - regardless of where they are in the pattern. - If this bit is not set, then special characters are special only in - some contexts; otherwise they are ordinary. Specifically, - * + ? and intervals are only special when not after the beginning, - open-group, or alternation operator. */ -#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) - -/* If this bit is set, then *, +, ?, and { cannot be first in an re or - immediately after an alternation or begin-group operator. */ -#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) - -/* If this bit is set, then . matches newline. - If not set, then it doesn't. */ -#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) - -/* If this bit is set, then . doesn't match NUL. - If not set, then it does. */ -#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) - -/* If this bit is set, nonmatching lists [^...] do not match newline. - If not set, they do. */ -#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) - -/* If this bit is set, either \{...\} or {...} defines an - interval, depending on RE_NO_BK_BRACES. - If not set, \{, \}, {, and } are literals. */ -#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) - -/* If this bit is set, +, ? and | aren't recognized as operators. - If not set, they are. */ -#define RE_LIMITED_OPS (RE_INTERVALS << 1) - -/* If this bit is set, newline is an alternation operator. - If not set, newline is literal. */ -#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) - -/* If this bit is set, then `{...}' defines an interval, and \{ and \} - are literals. - If not set, then `\{...\}' defines an interval. */ -#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) - -/* If this bit is set, (...) defines a group, and \( and \) are literals. - If not set, \(...\) defines a group, and ( and ) are literals. */ -#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) - -/* If this bit is set, then \ matches . - If not set, then \ is a back-reference. */ -#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) - -/* If this bit is set, then | is an alternation operator, and \| is literal. - If not set, then \| is an alternation operator, and | is literal. */ -#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) - -/* If this bit is set, then an ending range point collating higher - than the starting range point, as in [z-a], is invalid. - If not set, then when ending range point collates higher than the - starting range point, the range is ignored. */ -#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) - -/* If this bit is set, then an unmatched ) is ordinary. - If not set, then an unmatched ) is invalid. */ -#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) - -/* This global variable defines the particular regexp syntax to use (for - some interfaces). When a regexp is compiled, the syntax used is - stored in the pattern buffer, so changing this does not affect - already-compiled regexps. */ -extern reg_syntax_t re_syntax_options; - -/* Define combinations of the above bits for the standard possibilities. - (The [[[ comments delimit what gets put into the Texinfo file, so - don't delete them!) */ -/* [[[begin syntaxes]]] */ -#define RE_SYNTAX_EMACS 0 - -#define RE_SYNTAX_AWK \ - (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ - | RE_NO_BK_PARENS | RE_NO_BK_REFS \ - | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ - | RE_UNMATCHED_RIGHT_PAREN_ORD) - -#define RE_SYNTAX_POSIX_AWK \ - (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) - -#define RE_SYNTAX_GREP \ - (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ - | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ - | RE_NEWLINE_ALT) - -#define RE_SYNTAX_EGREP \ - (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ - | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ - | RE_NO_BK_VBAR) - -#define RE_SYNTAX_POSIX_EGREP \ - (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES) - -/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ -#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC - -#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC - -/* Syntax bits common to both basic and extended POSIX regex syntax. */ -#define _RE_SYNTAX_POSIX_COMMON \ - (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ - | RE_INTERVALS | RE_NO_EMPTY_RANGES) - -#define RE_SYNTAX_POSIX_BASIC \ - (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) - -/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes - RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this - isn't minimal, since other operators, such as \`, aren't disabled. */ -#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ - (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) - -#define RE_SYNTAX_POSIX_EXTENDED \ - (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ - | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ - | RE_UNMATCHED_RIGHT_PAREN_ORD) - -/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS - replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */ -#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ - (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ - | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ - | RE_NO_BK_PARENS | RE_NO_BK_REFS \ - | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) -/* [[[end syntaxes]]] */ - -/* Maximum number of duplicates an interval can allow. Some systems - (erroneously) define this in other header files, but we want our - value, so remove any previous define. */ -#ifdef RE_DUP_MAX -#undef RE_DUP_MAX -#endif -#define RE_DUP_MAX ((1 << 15) - 1) - - -/* POSIX `cflags' bits (i.e., information for `regcomp'). */ - -/* If this bit is set, then use extended regular expression syntax. - If not set, then use basic regular expression syntax. */ -#define REG_EXTENDED 1 - -/* If this bit is set, then ignore case when matching. - If not set, then case is significant. */ -#define REG_ICASE (REG_EXTENDED << 1) - -/* If this bit is set, then anchors do not match at newline - characters in the string. - If not set, then anchors do match at newlines. */ -#define REG_NEWLINE (REG_ICASE << 1) - -/* If this bit is set, then report only success or fail in regexec. - If not set, then returns differ between not matching and errors. */ -#define REG_NOSUB (REG_NEWLINE << 1) - - -/* POSIX `eflags' bits (i.e., information for regexec). */ - -/* If this bit is set, then the beginning-of-line operator doesn't match - the beginning of the string (presumably because it's not the - beginning of a line). - If not set, then the beginning-of-line operator does match the - beginning of the string. */ -#define REG_NOTBOL 1 - -/* Like REG_NOTBOL, except for the end-of-line. */ -#define REG_NOTEOL (1 << 1) - - -/* If any error codes are removed, changed, or added, update the - `re_error_msg' table in regex.c. */ -typedef enum -{ - REG_NOERROR = 0, /* Success. */ - REG_NOMATCH, /* Didn't find a match (for regexec). */ - - /* POSIX regcomp return error codes. (In the order listed in the - standard.) */ - REG_BADPAT, /* Invalid pattern. */ - REG_ECOLLATE, /* Not implemented. */ - REG_ECTYPE, /* Invalid character class name. */ - REG_EESCAPE, /* Trailing backslash. */ - REG_ESUBREG, /* Invalid back reference. */ - REG_EBRACK, /* Unmatched left bracket. */ - REG_EPAREN, /* Parenthesis imbalance. */ - REG_EBRACE, /* Unmatched \{. */ - REG_BADBR, /* Invalid contents of \{\}. */ - REG_ERANGE, /* Invalid range end. */ - REG_ESPACE, /* Ran out of memory. */ - REG_BADRPT, /* No preceding re for repetition op. */ - - /* Error codes we've added. */ - REG_EEND, /* Premature end. */ - REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ - REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ -} reg_errcode_t; - -/* This data structure represents a compiled pattern. Before calling - the pattern compiler, the fields `buffer', `allocated', `fastmap', - `translate', and `no_sub' can be set. After the pattern has been - compiled, the `re_nsub' field is available. All other fields are - private to the regex routines. */ - -struct re_pattern_buffer -{ -/* [[[begin pattern_buffer]]] */ - /* Space that holds the compiled pattern. It is declared as - `unsigned char *' because its elements are - sometimes used as array indexes. */ - unsigned char *buffer; - - /* Number of bytes to which `buffer' points. */ - unsigned long allocated; - - /* Number of bytes actually used in `buffer'. */ - unsigned long used; - - /* Syntax setting with which the pattern was compiled. */ - reg_syntax_t syntax; - - /* Pointer to a fastmap, if any, otherwise zero. re_search uses - the fastmap, if there is one, to skip over impossible - starting points for matches. */ - char *fastmap; - - /* Either a translate table to apply to all characters before - comparing them, or zero for no translation. The translation - is applied to a pattern when it is compiled and to a string - when it is matched. */ - char *translate; - - /* Number of subexpressions found by the compiler. */ - size_t re_nsub; - - /* Zero if this pattern cannot match the empty string, one else. - Well, in truth it's used only in `re_search_2', to see - whether or not we should use the fastmap, so we don't set - this absolutely perfectly; see `re_compile_fastmap' (the - `duplicate' case). */ - unsigned can_be_null : 1; - - /* If REGS_UNALLOCATED, allocate space in the `regs' structure - for `max (RE_NREGS, re_nsub + 1)' groups. - If REGS_REALLOCATE, reallocate space if necessary. - If REGS_FIXED, use what's there. */ -#define REGS_UNALLOCATED 0 -#define REGS_REALLOCATE 1 -#define REGS_FIXED 2 - unsigned regs_allocated : 2; - - /* Set to zero when `regex_compile' compiles a pattern; set to one - by `re_compile_fastmap' if it updates the fastmap. */ - unsigned fastmap_accurate : 1; - - /* If set, `re_match_2' does not return information about - subexpressions. */ - unsigned no_sub : 1; - - /* If set, a beginning-of-line anchor doesn't match at the - beginning of the string. */ - unsigned not_bol : 1; - - /* Similarly for an end-of-line anchor. */ - unsigned not_eol : 1; - - /* If true, an anchor at a newline matches. */ - unsigned newline_anchor : 1; - -/* [[[end pattern_buffer]]] */ -}; - -typedef struct re_pattern_buffer regex_t; - - -/* search.c (search_buffer) in Emacs needs this one opcode value. It is - defined both in `regex.c' and here. */ -#define RE_EXACTN_VALUE 1 - -/* Type for byte offsets within the string. POSIX mandates this. */ -typedef int regoff_t; - - -/* This is the structure we store register match data in. See - regex.texinfo for a full description of what registers match. */ -struct re_registers -{ - unsigned num_regs; - regoff_t *start; - regoff_t *end; -}; - - -/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, - `re_match_2' returns information about at least this many registers - the first time a `regs' structure is passed. */ -#ifndef RE_NREGS -#define RE_NREGS 30 -#endif - - -/* POSIX specification for registers. Aside from the different names than - `re_registers', POSIX uses an array of structures, instead of a - structure of arrays. */ -typedef struct -{ - regoff_t rm_so; /* Byte offset from string's start to substring's start. */ - regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ -} regmatch_t; - -/* Declarations for routines. */ - -/* To avoid duplicating every routine declaration -- once with a - prototype (if we are ANSI), and once without (if we aren't) -- we - use the following macro to declare argument types. This - unfortunately clutters up the declarations a bit, but I think it's - worth it. */ - -#if defined(__STDC__) || defined(_MSC_VER) - -#define _RE_ARGS(args) args - -#else /* not __STDC__ */ - -#define _RE_ARGS(args) () - -#endif /* not __STDC__ */ - -/* Sets the current default syntax to SYNTAX, and return the old syntax. - You can also simply assign to the `re_syntax_options' variable. */ -extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); - -/* Compile the regular expression PATTERN, with length LENGTH - and syntax given by the global `re_syntax_options', into the buffer - BUFFER. Return NULL if successful, and an error string if not. */ -extern const char *re_compile_pattern - _RE_ARGS ((const char *pattern, int length, - struct re_pattern_buffer *buffer)); - - -/* Compile a fastmap for the compiled pattern in BUFFER; used to - accelerate searches. Return 0 if successful and -2 if was an - internal error. */ -extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); - - -/* Search in the string STRING (with length LENGTH) for the pattern - compiled into BUFFER. Start searching at position START, for RANGE - characters. Return the starting position of the match, -1 for no - match, or -2 for an internal error. Also return register - information in REGS (if REGS and BUFFER->no_sub are nonzero). */ -extern int re_search - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, - int length, int start, int range, struct re_registers *regs)); - - -/* Like `re_search', but search in the concatenation of STRING1 and - STRING2. Also, stop searching at index START + STOP. */ -extern int re_search_2 - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, int range, struct re_registers *regs, int stop)); - - -/* Like `re_search', but return how many characters in STRING the regexp - in BUFFER matched, starting at position START. */ -extern int re_match - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, - int length, int start, struct re_registers *regs)); - - -/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ -extern int re_match_2 - _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, - int length1, const char *string2, int length2, - int start, struct re_registers *regs, int stop)); - - -/* Set REGS to hold NUM_REGS registers, storing them in STARTS and - ENDS. Subsequent matches using BUFFER and REGS will use this memory - for recording register information. STARTS and ENDS must be - allocated with malloc, and must each be at least `NUM_REGS * sizeof - (regoff_t)' bytes long. - - If NUM_REGS == 0, then subsequent matches should allocate their own - register data. - - Unless this function is called, the first search or match using - PATTERN_BUFFER will allocate its own register data, without - freeing the old data. */ -extern void re_set_registers - _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, - unsigned num_regs, regoff_t *starts, regoff_t *ends)); - -/* 4.2 bsd compatibility. */ -extern char *re_comp _RE_ARGS ((const char *)); -extern int re_exec _RE_ARGS ((const char *)); - -/* POSIX compatibility. */ -extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags)); -extern int regexec - _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch, - regmatch_t pmatch[], int eflags)); -extern size_t regerror - _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf, - size_t errbuf_size)); -extern void regfree _RE_ARGS ((regex_t *preg)); - - -#ifdef __cplusplus -} -#endif - -#endif /* not __REGEXP_LIBRARY_H__ */ diff --git a/ppremake/md5.c b/ppremake/md5.c deleted file mode 100644 index 9cba49a9fd..0000000000 --- a/ppremake/md5.c +++ /dev/null @@ -1,318 +0,0 @@ -/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm -*/ -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -#include "md5.h" -#include - -/* Constants for MD5Transform routine. - */ - -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -static void MD5Transform(uint32[4], const unsigned char[64]); -static void Encode(unsigned char *, uint32 *, unsigned int); -static void Decode(uint32 *, const unsigned char *, unsigned int); - -static unsigned char PADDING[64] = -{ - 0x80, 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, 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, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. - Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (uint32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (uint32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (uint32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (uint32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* {{{ MD5Init - * MD5 initialization. Begins an MD5 operation, writing a new context. - */ -void MD5Init(PP_MD5_CTX * context) -{ - context->count[0] = context->count[1] = 0; - /* Load magic initialization constants. - */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} -/* }}} */ - -/* {{{ MD5Update - MD5 block update operation. Continues an MD5 message-digest - operation, processing another message block, and updating the - context. - */ -void MD5Update(PP_MD5_CTX * context, const unsigned char *input, - unsigned int inputLen) -{ - unsigned int i, index, partLen; - - /* Compute number of bytes mod 64 */ - index = (unsigned int) ((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((uint32) inputLen << 3)) - < ((uint32) inputLen << 3)) - context->count[1]++; - context->count[1] += ((uint32) inputLen >> 29); - - partLen = 64 - index; - - /* Transform as many times as possible. - */ - if (inputLen >= partLen) { - memcpy - ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen); - MD5Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform(context->state, &input[i]); - - index = 0; - } else - i = 0; - - /* Buffer remaining input */ - memcpy - ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i], - inputLen - i); -} -/* }}} */ - -/* {{{ MD5Final - MD5 finalization. Ends an MD5 message-digest operation, writing the - the message digest and zeroizing the context. - */ -void MD5Final(unsigned char digest[16], PP_MD5_CTX * context) -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode(bits, context->count, 8); - - /* Pad out to 56 mod 64. - */ - index = (unsigned int) ((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - MD5Update(context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update(context, bits, 8); - - /* Store state in digest */ - Encode(digest, context->state, 16); - - /* Zeroize sensitive information. - */ - memset((unsigned char*) context, 0, sizeof(*context)); -} -/* }}} */ - -/* {{{ MD5Transform - * MD5 basic transformation. Transforms state based on block. - */ -static void MD5Transform(state, block) -uint32 state[4]; -const unsigned char block[64]; -{ - uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode(x, block, 64); - - /* Round 1 */ - FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ - FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ - FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */ - FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ - FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ - FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ - FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ - FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ - FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ - FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ - FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ - GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ - GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ - GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ - GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ - GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ - GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ - GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ - GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ - GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ - GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ - HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ - HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ - HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ - HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ - HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ - HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ - HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ - HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ - HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ - II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ - II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ - II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ - II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ - II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ - II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ - II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ - II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ - II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. */ - memset((unsigned char*) x, 0, sizeof(x)); -} -/* }}} */ - -/* {{{ Encode - Encodes input (uint32) into output (unsigned char). Assumes len is - a multiple of 4. - */ -static void Encode(output, input, len) -unsigned char *output; -uint32 *input; -unsigned int len; -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char) (input[i] & 0xff); - output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); - output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); - output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); - } -} -/* }}} */ - -/* {{{ Decode - Decodes input (unsigned char) into output (uint32). Assumes len is - a multiple of 4. - */ -static void Decode(output, input, len) -uint32 *output; -const unsigned char *input; -unsigned int len; -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((uint32) input[j]) | (((uint32) input[j + 1]) << 8) | - (((uint32) input[j + 2]) << 16) | (((uint32) input[j + 3]) << 24); -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ppremake/md5.h b/ppremake/md5.h deleted file mode 100644 index f56456a7d8..0000000000 --- a/ppremake/md5.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MD5_H -#define MD5_H -/* MD5.H - header file for MD5C.C - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -#ifndef uint32 -typedef unsigned int uint32; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* MD5 context. */ -typedef struct { - uint32 state[4]; /* state (ABCD) */ - uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} PP_MD5_CTX; - -void MD5Init(PP_MD5_CTX *); -void MD5Update(PP_MD5_CTX *, const unsigned char *, unsigned int); -void MD5Final(unsigned char[16], PP_MD5_CTX *); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ppremake/ppCommandFile.cxx b/ppremake/ppCommandFile.cxx deleted file mode 100644 index 00e1c4ed6a..0000000000 --- a/ppremake/ppCommandFile.cxx +++ /dev/null @@ -1,2318 +0,0 @@ -// Filename: ppCommandFile.cxx -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppCommandFile.h" -#include "ppScope.h" -#include "ppNamedScopes.h" -#include "ppSubroutine.h" -#include "tokenize.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_UTIME_H -#include -#endif - -#ifdef HAVE_SYS_UTIME_H -#include -#endif - -#include -#include // for tempnam() -#include -#include - -static const string begin_comment(BEGIN_COMMENT); - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::IfNesting::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile::IfNesting:: -IfNesting(IfState state) : - _state(state) -{ - _block = (PPCommandFile::BlockNesting *)NULL; - _next = (PPCommandFile::IfNesting *)NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::IfNesting::push -// Access: Public -// Description: Adds this IfNesting object to the top of the -// nesting stack. -//////////////////////////////////////////////////////////////////// -void PPCommandFile::IfNesting:: -push(PPCommandFile *file) { - _block = file->_block_nesting; - _next = file->_if_nesting; - file->_if_nesting = this; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::IfNesting::pop -// Access: Public -// Description: Removes this IfNesting object from the top of the -// nesting stack, and restores the command file's -// nesting state. -//////////////////////////////////////////////////////////////////// -void PPCommandFile::IfNesting:: -pop(PPCommandFile *file) { - assert(file->_if_nesting == this); - file->_if_nesting = _next; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::WriteState::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile::WriteState:: -WriteState() { - _out = NULL; - _format = WF_collapse; - _last_blank = true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::WriteState::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile::WriteState:: -WriteState(const WriteState ©) : - _out(copy._out), - _format(copy._format), - _last_blank(copy._last_blank) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::WriteState::write_line -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -bool PPCommandFile::WriteState:: -write_line(const string &line) { - if (_out == (ostream *)NULL || _format == WF_error) { - if (!line.empty()) { - cerr << "Ignoring: " << line << "\n"; - } - return true; - - } else { - switch (_format) { - case WF_straight: - (*_out) << line << "\n"; - return true; - - case WF_collapse: - return write_collapse_line(line); - - case WF_makefile: - return write_makefile_line(line); - } - - cerr << "Unsupported write format: " << (int)_format << "\n"; - errors_occurred = true; - return false; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::WriteState::write_collapse_line -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -bool PPCommandFile::WriteState:: -write_collapse_line(const string &line) { - if (line.empty()) { - if (!_last_blank) { - (*_out) << "\n"; - _last_blank = true; - } - - } else { - _last_blank = false; - (*_out) << line << "\n"; - } - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::WriteState::write_makefile_line -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -bool PPCommandFile::WriteState:: -write_makefile_line(const string &line) { - if (line.length() <= 72) { - return write_collapse_line(line); - } - _last_blank = false; - - // In makefile mode, long variable assignment lines are folded after - // the assignment. - vector words; - tokenize_whitespace(line, words); - - if (words.size() > 2 && (words[1] == "=" || words[1] == ":")) { - // This appears to be a variable assignment or a dependency rule; - // fold it. - (*_out) << words[0] << " " << words[1]; - vector::const_iterator wi; - int col = 80; - wi = words.begin() + 2; - while (wi != words.end()) { - col += (*wi).length() + 1; - if (col > 72) { - (*_out) << " \\\n "; - col = 4 + (*wi).length(); - } - (*_out) << " " << (*wi); - ++wi; - } - (*_out) << "\n"; - - } else { - // This is not a variable assignment, so just write it out. - (*_out) << line << "\n"; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::BlockNesting::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile::BlockNesting:: -BlockNesting(BlockState state, const string &name) : - _state(state), - _name(name) -{ - _if = (PPCommandFile::IfNesting *)NULL; - _write_state = (PPCommandFile::WriteState *)NULL; - _scope = (PPScope *)NULL; - _flags = 0; - _next = (PPCommandFile::BlockNesting *)NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::BlockNesting::push -// Access: Public -// Description: Adds this BlockNesting object to the top of the -// nesting stack. -//////////////////////////////////////////////////////////////////// -void PPCommandFile::BlockNesting:: -push(PPCommandFile *file) { - _if = file->_if_nesting; - _write_state = file->_write_state; - _scope = file->_scope; - _next = file->_block_nesting; - file->_block_nesting = this; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::BlockNesting::pop -// Access: Public -// Description: Removes this BlockNesting object from the top of the -// nesting stack, and restores the command file's -// nesting state. -//////////////////////////////////////////////////////////////////// -void PPCommandFile::BlockNesting:: -pop(PPCommandFile *file) { - assert(file->_block_nesting == this); - - if (file->_write_state != _write_state) { - delete file->_write_state; - file->_write_state = _write_state; - } - file->_scope = _scope; - file->_block_nesting = _next; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile:: -PPCommandFile(PPScope *scope) { - _native_scope = scope; - _scope = scope; - _got_command = false; - _in_for = false; - _if_nesting = (IfNesting *)NULL; - _block_nesting = (BlockNesting *)NULL; - _write_state = new WriteState; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::Destructor -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile:: -~PPCommandFile() { - delete _write_state; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::set_output -// Access: Public -// Description: Changes the main output stream that will be written -// to when text appears outside of a #output .. #end -// block. This is cout by default. -//////////////////////////////////////////////////////////////////// -void PPCommandFile:: -set_output(ostream *out) { - _write_state->_out = out; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::set_scope -// Access: Public -// Description: Changes the command file to use the indicated scope. -// This scope will *not* be deleted when the command -// file destructs. -//////////////////////////////////////////////////////////////////// -void PPCommandFile:: -set_scope(PPScope *scope) { - _native_scope = scope; - _scope = scope; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::get_scope -// Access: Public -// Description: Returns the current scope associated with the command -// file. This may change as the command file is -// processed (e.g. between #begin .. #end sequences), -// and it may or may not be tied to the life of the -// PPCommandFile itself. -//////////////////////////////////////////////////////////////////// -PPScope *PPCommandFile:: -get_scope() const { - return _scope; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::read_file -// Access: Public -// Description: Reads input from the given filename. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -read_file(Filename filename) { - filename.set_text(); - ifstream in; - - if (!filename.open_read(in)) { - cerr << "Unable to open " << filename << ".\n"; - errors_occurred = true; - return false; - } - if (verbose) { - cerr << "Reading (cmd) \"" << filename << "\"\n"; - } - - return read_stream(in, filename); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::read_stream -// Access: Public -// Description: Reads input from the given stream. Each line is -// read, commands are processed, variables are expanded, -// and the resulting output is sent to write_line() -// one line at a time. The return value is true if the -// entire file is read with no errors, false if there is -// some problem. -// -// The filename is just informational; it is used to -// update the variables like THISFILENAME and -// THISDIRPREFIX as appropriate, and to report errors to -// the user. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -read_stream(istream &in, const string &filename) { - PushFilename pushed(_scope, filename); - - if (!read_stream(in)) { - if (!in.eof()) { - cerr << "Error reading " << filename << ".\n"; - errors_occurred = true; - } - return false; - } - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::read_stream -// Access: Public -// Description: Reads input from the given stream. Each line is -// read, commands are processed, variables are expanded, -// and the resulting output is sent to write_line() -// one line at a time. The return value is true if the -// entire file is read with no errors, false if there is -// some problem. -// -// This flavor of read_stream() does not take a -// filename. It does not, therefore, adjust -// THISFILENAME and THISDIRPREFIX. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -read_stream(istream &in) { - string line; - getline(in, line); - begin_read(); - while (!in.fail() && !in.eof()) { - if (!read_line(line)) { - return false; - } - getline(in, line); - } - - if (!end_read()) { - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::begin_read -// Access: Public -// Description: Resets to the beginning-of-the-stream state, in -// preparation for a sequence of read_line() calls. -//////////////////////////////////////////////////////////////////// -void PPCommandFile:: -begin_read() { - assert(_if_nesting == (IfNesting *)NULL); - assert(_block_nesting == (BlockNesting *)NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::read_line -// Access: Public -// Description: Reads one line at a time, as if from the input -// stream. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -read_line(string line) { - // First things first: strip off any comment in the line. - - // We only recognize comments that are proceeded by whitespace, or - // that start at the beginning of the line. - size_t comment = line.find(begin_comment); - while (comment != string::npos && - !(comment == 0 || isspace(line[comment - 1]))) { - comment = line.find(begin_comment, comment + begin_comment.length()); - } - - if (comment != string::npos) { - // Also strip any whitespace leading up to the comment. - while (comment > 0 && isspace(line[comment - 1])) { - comment--; - } - line = line.substr(0, comment); - } - - // If the comment was at the beginning of the line, ignore the whole - // line, including its whitespace. - if (comment != 0) { - // We also strip off whitespace at the end of the line, since this - // is generally invisible and almost always just leads to trouble. - size_t eol = line.length(); - while (eol > 0 && (isspace(line[eol - 1]) || line[eol - 1] == '\r')) { - eol--; - } - line = line.substr(0, eol); - - if (_in_for) { - // Save up the lines for later execution if we're within a #forscopes. - _saved_lines.push_back(line); - } - - if (_got_command) { - return handle_command(line); - - } else { - // Find the beginning of the line--skip initial whitespace. - size_t p = 0; - while (p < line.length() && isspace(line[p])) { - p++; - } - - if (p == line.length()) { - // The line is empty. Make it truly empty. - line = ""; - } else { - if (((p+1) < line.length()) && (line[p] == COMMAND_PREFIX) && - isalpha(line[p + 1])) { - // This is a special command. - return handle_command(line.substr(p + 1)); - } - } - - if (!_in_for && !failed_if()) { - if (line.length() > p + 1 && line[p + 1] == COMMAND_PREFIX) { - // double prefix at start of line indicates echo single prefix, like '\\' in C - line.erase(0, 1); - } - return _write_state->write_line(_scope->expand_string(line)); - } - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::end_read -// Access: Public -// Description: Finishes up the input stream, after a sequence of -// read_line() calls. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -end_read() { - bool okflag = true; - - if (_if_nesting != (IfNesting *)NULL) { - cerr << "Unclosed if\n"; - errors_occurred = true; - _if_nesting = (IfNesting *)NULL; - okflag = false; - } - - if (_block_nesting != (BlockNesting *)NULL) { - switch (_block_nesting->_state) { - case BS_begin: - cerr << "Unclosed begin " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_while: - case BS_nested_while: - cerr << "Unclosed while " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_forscopes: - case BS_nested_forscopes: - cerr << "Unclosed forscopes " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_foreach: - case BS_nested_foreach: - cerr << "Unclosed foreach " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_formap: - case BS_nested_formap: - cerr << "Unclosed formap " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_defsub: - cerr << "Unclosed defsub " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_defun: - cerr << "Unclosed defun " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - - case BS_output: - cerr << "Unclosed output " << _block_nesting->_name << "\n"; - errors_occurred = true; - break; - } - _block_nesting = (BlockNesting *)NULL; - okflag = false; - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_command -// Access: Protected -// Description: Handles a macro command. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_command(const string &line) { - if (_got_command) { - // If we were still processing a command from last time, keep - // going; this line is just a continuation. But skip any initial - // whitespace. - size_t p = 0; - while (p < line.length() && isspace(line[p])) { - p++; - } - _params += ' '; - _params += line.substr(p); - - } else { - // This is the first line of a new command. - - // Pull off the first word and the rest of the line. - size_t p = 0; - while (p < line.length() && !isspace(line[p])) { - p++; - } - _command = line.substr(0, p); - - // Skip whitespace between the command and its arguments. - while (p < line.length() && isspace(line[p])) { - p++; - } - _params = line.substr(p); - } - - if (!_params.empty() && _params[_params.length() - 1] == '\\') { - // If the line ends with a backslash, there's more to come before - // we can process the command. - _got_command = true; - - // Truncate off the backslash, and any whitespace before it. - size_t p = _params.length() - 1; - while (p > 0 && isspace(_params[p - 1])) { - p--; - } - _params = _params.substr(0, p); - return true; - } - - // We're completely done scanning the command now. - _got_command = false; - - if (_command == "if") { - return handle_if_command(); - - } else if (_command == "elif") { - return handle_elif_command(); - - } else if (_command == "else") { - return handle_else_command(); - - } else if (_command == "endif") { - return handle_endif_command(); - - } else if (failed_if()) { - // If we're in the middle of a failed #if, we ignore all commands - // except for the if-related commands, above. - return true; - - } else if (_command == "begin") { - return handle_begin_command(); - - } else if (_command == "while") { - return handle_while_command(); - - } else if (_command == "for") { - return handle_for_command(); - - } else if (_command == "forscopes") { - return handle_forscopes_command(); - - } else if (_command == "foreach") { - return handle_foreach_command(); - - } else if (_command == "formap") { - return handle_formap_command(); - - } else if (_command == "defsub") { - return handle_defsub_command(true); - - } else if (_command == "defun") { - return handle_defsub_command(false); - - } else if (_command == "output") { - return handle_output_command(); - - } else if (_command == "end") { - return handle_end_command(); - - } else if (_in_for) { - // If we're currently saving up lines within a block sequence, we - // ignore all commands except for the block-related commands, - // above. - return true; - - } else if (_command == "format") { - return handle_format_command(); - - } else if (_command == "print") { - return handle_print_command(); - - } else if (_command == "printvar") { - return handle_printvar_command(); - - } else if (_command == "include") { - return handle_include_command(); - - } else if (_command == "sinclude") { - return handle_sinclude_command(); - - } else if (_command == "copy") { - return handle_copy_command(); - - } else if (_command == "call") { - return handle_call_command(); - - } else if (_command == "error") { - return handle_error_command(); - - } else if (_command == "mkdir") { - return handle_mkdir_command(); - - } else if (_command == "defer") { - return handle_defer_command(); - - } else if (_command == "define") { - return handle_define_command(); - - } else if (_command == "set") { - return handle_set_command(); - - } else if (_command == "map") { - return handle_map_command(); - - } else if (_command == "addmap") { - return handle_addmap_command(); - - } else if (_command == "push") { - return handle_push_command(); - } - - cerr << "Invalid command: " << COMMAND_PREFIX << _command << "\n"; - errors_occurred = true; - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_if_command -// Access: Protected -// Description: Handles the #if command: conditionally evaluate the -// following code. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_if_command() { - if (failed_if()) { - // If we're *already* inside a failed if, we don't have to - // evaluate this one, but we do need to record the nesting level. - - IfNesting *nest = new IfNesting(IS_done); - nest->push(this); - - } else { - - // If the parameter string evaluates to empty, the case is false. - // Otherwise the case is true. However, if we're currently - // scanning #forscopes or something, we don't evaluate this at - // all, because it doesn't matter. - - bool is_empty = true; - if (!_in_for) { - _params = _scope->expand_string(_params); - string::const_iterator si; - for (si = _params.begin(); si != _params.end() && is_empty; ++si) { - is_empty = isspace(*si); - } - } - - IfState state = is_empty ? IS_off : IS_on; - IfNesting *nest = new IfNesting(state); - nest->push(this); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_elif_command -// Access: Protected -// Description: Handles the #elif command: conditionally evaluate -// the following code, following a failed #if command. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_elif_command() { - if (_if_nesting == (IfNesting *)NULL) { - cerr << "elif encountered without if.\n"; - errors_occurred = true; - return false; - } - if (_if_nesting->_state == IS_else) { - cerr << "elif encountered after else.\n"; - errors_occurred = true; - return false; - } - if (_if_nesting->_state == IS_on || _if_nesting->_state == IS_done) { - // If we passed the #if above, we don't need to evaluate the #elif. - _if_nesting->_state = IS_done; - return true; - } - - // If the parameter string evaluates to empty, the case is false. - // Otherwise the case is true. - bool is_empty = true; - if (!_in_for) { - _params = _scope->expand_string(_params); - string::const_iterator si; - for (si = _params.begin(); si != _params.end() && is_empty; ++si) { - is_empty = isspace(*si); - } - } - - _if_nesting->_state = is_empty ? IS_off : IS_on; - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_else_command -// Access: Protected -// Description: Handles the #else command: evaluate the following -// code following a failed #if command. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_else_command() { - if (_if_nesting == (IfNesting *)NULL) { - cerr << "else encountered without if.\n"; - errors_occurred = true; - return false; - } - if (_if_nesting->_state == IS_else) { - cerr << "else encountered after else.\n"; - errors_occurred = true; - return false; - } - if (_if_nesting->_state == IS_on || _if_nesting->_state == IS_done) { - _if_nesting->_state = IS_done; - return true; - } - - _if_nesting->_state = IS_else; - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_endif_command -// Access: Protected -// Description: Handles the #endif command: close a preceeding #if -// command. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_endif_command() { - if (_if_nesting == (IfNesting *)NULL) { - cerr << "endif encountered without if.\n"; - errors_occurred = true; - return false; - } - - IfNesting *nest = _if_nesting; - nest->pop(this); - - if (nest->_block != _block_nesting) { - if (nest->_block != (BlockNesting *)NULL) { - cerr << "If block not closed within scoping block " << nest->_block->_name << ".\n"; - errors_occurred = true; - } else { - cerr << "If block not closed within scoping block " << _block_nesting->_name << ".\n"; - errors_occurred = true; - } - return false; - } - - delete nest; - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_begin_command -// Access: Protected -// Description: Handles the #begin command: begin a named scope -// block. The variables defined between this command -// and the corresponding #end command will be local to -// this named scope. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_begin_command() { - string name = trim_blanks(_params); - BlockNesting *nest = new BlockNesting(BS_begin, name); - - if (contains_whitespace(name)) { - cerr << "Attempt to define scope named \"" << name - << "\".\nScope names may not contain whitespace.\n"; - errors_occurred = true; - return false; - } - - if (name.find(SCOPE_DIRNAME_SEPARATOR) != string::npos) { - cerr << "Attempt to define scope named \"" << name - << "\".\nScope names may not contain the '" - << SCOPE_DIRNAME_SEPARATOR << "' character.\n"; - errors_occurred = true; - return false; - } - - nest->push(this); - - PPScope *named_scope = _scope->get_named_scopes()->make_scope(name); - named_scope->set_parent(_scope); - _scope = named_scope; - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_while_command -// Access: Protected -// Description: Handles the #while command: repeat a block of -// commands while a condition is true (nonempty). -// Unlike many of the other block commands, this does -// not begin a new scope. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_while_command() { - BlockState state = _in_for ? BS_nested_while : BS_while; - string name = trim_blanks(_params); - BlockNesting *nest = new BlockNesting(state, name); - nest->push(this); - - if (!_in_for) { - _in_for = true; - _saved_lines.clear(); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_for_command -// Access: Protected -// Description: Handles the #for command: repeat a block of -// commands with a loop variable iterating over a range -// of numeric values. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_for_command() { - // We get the name of the variable out first. - size_t p = _scope->scan_to_whitespace(_params); - string name = _params.substr(0, p); - - if (name.empty()) { - cerr << "#for without varname\n"; - errors_occurred = true; - return false; - } - - // The rest is the comma-delimited range of values. - vector words; - _scope->tokenize_params(_params.substr(p), words, true); - if (words.size() != 2 && words.size() != 3) { - cerr << "Invalid numeric range: '" << _params.substr(p) - << "' for #for " << name << "\n"; - errors_occurred = true; - return false; - } - - BlockState state = _in_for ? BS_nested_for : BS_for; - BlockNesting *nest = new BlockNesting(state, name); - nest->push(this); - - if (!_in_for) { - _in_for = true; - _saved_lines.clear(); - - nest->_words.swap(words); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_forscopes_command -// Access: Protected -// Description: Handles the #forscopes command: interpret all the lines -// between this command and the corresponding #end -// command once for each occurrence of a named scope -// with the given name. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_forscopes_command() { - BlockState state = _in_for ? BS_nested_forscopes : BS_forscopes; - string name = trim_blanks(_params); - BlockNesting *nest = new BlockNesting(state, name); - nest->push(this); - - if (!_in_for) { - _in_for = true; - _saved_lines.clear(); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_foreach_command -// Access: Protected -// Description: Handles the #foreach command: interpret all the lines -// between this command and the corresponding #end -// command once for each word in the argument. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_foreach_command() { - // Get the parameters of the foreach command. The first word is the - // name of the variable to substitute in (and which should appear on - // the matching #end command), and the remaining words are the - // values to substitute in. - vector words; - tokenize_whitespace(_scope->expand_string(_params), words); - - if (words.empty()) { - cerr << "#foreach requires at least one parameter.\n"; - errors_occurred = true; - return false; - } - - string variable_name = words.front(); - - BlockState state = _in_for ? BS_nested_foreach : BS_foreach; - BlockNesting *nest = new BlockNesting(state, variable_name); - nest->push(this); - - // We insert in all but the first word in the words vector. - nest->_words.insert(nest->_words.end(), words.begin() + 1, words.end()); - - if (!_in_for) { - _in_for = true; - _saved_lines.clear(); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_formap_command -// Access: Protected -// Description: Handles the #formap command: interpret all the lines -// between this command and the corresponding #end -// command once for each key in the map, and also within -// the corresponding scope of that particular key. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_formap_command() { - // Get the parameters of the formap command. The first word is the - // name of the variable to substitute in (and which should appear on - // the matching #end command), and the second word is the name of - // the map variable. - vector words; - tokenize_whitespace(_scope->expand_string(_params), words); - - if (words.size() != 2) { - cerr << "#formap requires exactly two parameters.\n"; - errors_occurred = true; - return false; - } - - string variable_name = words.front(); - - BlockState state = _in_for ? BS_nested_formap : BS_formap; - BlockNesting *nest = new BlockNesting(state, words[0]); - nest->push(this); - - nest->_words.push_back(words[1]); - - if (!_in_for) { - _in_for = true; - _saved_lines.clear(); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_defsub_command -// Access: Protected -// Description: Handles the #defsub (or #defun) command: save all the -// lines between this command and the matching #end as a -// callable subroutine to be invoked by a later #call -// command. If is_defsub is false, it means this -// subroutine was actually defined via a #defun command, -// so it is to be invoked by a later variable reference, -// instead of by a #call command. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_defsub_command(bool is_defsub) { - string command = (is_defsub) ? "#defsub" : "#defun"; - - // The first word of the parameter list is the subroutine name; the - // rest is the comma-separated list of formal parameter names. - - // Pull off the first word and the rest of the params. - size_t p = 0; - while (p < _params.length() && !isspace(_params[p])) { - p++; - } - string subroutine_name = trim_blanks(_params.substr(0, p)); - - if (subroutine_name.empty()) { - cerr << command << " requires at least one parameter.\n"; - errors_occurred = true; - return false; - } - - vector formals; - _scope->tokenize_params(_params.substr(p), formals, false); - - vector::const_iterator fi; - for (fi = formals.begin(); fi != formals.end(); ++fi) { - if (!is_valid_formal(*fi)) { - cerr << command << " " << subroutine_name - << ": invalid formal parameter name '" << (*fi) << "'\n"; - errors_occurred = true; - return false; - } - } - - if (_in_for) { - cerr << command << " may not appear within another block scoping command like\n" - << "#forscopes, #foreach, #formap, #defsub, or #defun.\n"; - errors_occurred = true; - return false; - } - - BlockState state = is_defsub ? BS_defsub : BS_defun; - BlockNesting *nest = new BlockNesting(state, subroutine_name); - - nest->push(this); - nest->_words.swap(formals); - - _in_for = true; - _saved_lines.clear(); - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_output_command -// Access: Protected -// Description: Handles the #output command: all text between this -// command and the corresponding #end command will be -// sent to the indicated output file. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_output_command() { - // We must get the filename out (the first parameter) without - // expanding it, because it might involve a string that has to be - // expanded later. - size_t p = _scope->scan_to_whitespace(_params); - string name = _params.substr(0, p); - - if (name.empty()) { - cerr << "#output command requires one parameter.\n"; - errors_occurred = true; - return false; - } - - // Now get the remaining parameters out; these we will expand immediately. - vector words; - tokenize_whitespace(_scope->expand_string(_params.substr(p)), words); - - BlockNesting *nest = new BlockNesting(BS_output, name); - - // Also check the output flags. - for (int i = 0; i < (int)words.size(); i++) { - if (words[i] == "notouch") { - nest->_flags |= OF_notouch; - } else if (words[i] == "binary") { - nest->_flags |= OF_binary; - } else { - cerr << "Invalid output flag: " << words[i] << "\n"; - errors_occurred = true; - } - } - - nest->push(this); - - if (!_in_for) { - Filename filename = trim_blanks(_scope->expand_string(nest->_name)); - if (filename.empty()) { - cerr << "Attempt to output to empty filename\n"; - errors_occurred = true; - return false; - } - - if (filename.is_local()) { - string prefix = _scope->expand_variable("DIRPREFIX"); - filename = Filename(prefix, filename); - } - - nest->_params = filename; - - // Generate an in-memory copy of the file first. - _write_state = new WriteState(*_write_state); - _write_state->_out = &nest->_output; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_end_command -// Access: Protected -// Description: Handles the #end command. This closes a number of -// different kinds of blocks, like #begin and #forscopes. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_end_command() { - if (_block_nesting == (BlockNesting *)NULL) { - cerr << "Unmatched end " << _params << ".\n"; - errors_occurred = true; - return false; - } - - // We don't expand the closing name string, because we didn't expand - // the opening string. (This is especially true for an #output - // statement. On some of the other statements, we might have - // inadvertently expanded this string, but probably that was a - // mistake; and there's no reason for programmers to take advantage - // of an expansion there.) - string name = trim_blanks(_params); - if (name != _block_nesting->_name) { - cerr << "end " << name << " encountered where end " - << _block_nesting->_name << " expected.\n"; - errors_occurred = true; - return false; - } - - BlockNesting *nest = _block_nesting; - nest->pop(this); - - if (nest->_if != _if_nesting) { - cerr << "If block not closed within scoping block " << name << ".\n"; - errors_occurred = true; - return false; - } - - if (nest->_state == BS_while) { - // Now replay all of the saved lines. - _in_for = false; - if (!replay_while(nest->_name)) { - return false; - } - - } else if (nest->_state == BS_for) { - // Now replay all of the saved lines. - _in_for = false; - if (!replay_for(nest->_name, nest->_words)) { - return false; - } - - } else if (nest->_state == BS_forscopes) { - // Now replay all of the saved lines. - _in_for = false; - if (!replay_forscopes(nest->_name)) { - return false; - } - - } else if (nest->_state == BS_foreach) { - // Now replay all of the saved lines. - _in_for = false; - if (!replay_foreach(nest->_name, nest->_words)) { - return false; - } - - } else if (nest->_state == BS_formap) { - // Now replay all of the saved lines. - _in_for = false; - assert(nest->_words.size() == 1); - if (!replay_formap(nest->_name, nest->_words[0])) { - return false; - } - - } else if (nest->_state == BS_defsub || nest->_state == BS_defun) { - // Save all of the saved lines as a named subroutine. - _in_for = false; - PPSubroutine *sub = new PPSubroutine; - sub->_formals.swap(nest->_words); - sub->_lines.swap(_saved_lines); - - // Remove the #end command. This will fail if someone makes an - // #end command that spans multiple lines. Don't do that. - assert(!sub->_lines.empty()); - sub->_lines.pop_back(); - - if (nest->_state == BS_defsub) { - PPSubroutine::define_sub(nest->_name, sub); - } else { - PPSubroutine::define_func(nest->_name, sub); - } - - } else if (nest->_state == BS_output) { - if (!_in_for) { - if (!nest->_output) { - cerr << "Error while writing " << nest->_params << "\n"; - errors_occurred = true; - return false; - } - - // Now compare the file we generated to the file that's already - // there, if there is one. - -#ifdef HAVE_SSTREAM - string generated_file = nest->_output.str(); -#else - nest->_output << ends; - char *c_str = nest->_output.str(); - string generated_file = c_str; - delete[] c_str; -#endif // HAVE_SSTREAM - - if (!compare_output(generated_file, nest->_params, - (nest->_flags & OF_notouch) != 0, - (nest->_flags & OF_binary) != 0)) { - return false; - } - } - } - - - delete nest; - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_format_command -// Access: Protected -// Description: Handles the #format command: change the formatting -// mode of lines as they are output. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_format_command() { - _params = trim_blanks(_scope->expand_string(_params)); - if (_params == "straight") { - _write_state->_format = WF_straight; - - } else if (_params == "collapse") { - _write_state->_format = WF_collapse; - - } else if (_params == "makefile") { - _write_state->_format = WF_makefile; - - } else { - cerr << "Ignoring invalid write format: " << _params << "\n"; - errors_occurred = true; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_print_command -// Access: Protected -// Description: Handles the #print command: immediately output the -// arguments to this line to standard error. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_print_command() { - cerr << _scope->expand_string(_params) << "\n"; - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_printvar_command -// Access: Protected -// Description: Writes the literal contents of the named variable(s) -// (the variables are named directly without enclosing -// $[ ... ] syntax) to cerr, for debugging. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_printvar_command() { - size_t p = 0; - - while (p < _params.length()) { - // Pull off the next varname. - size_t q = _scope->scan_to_whitespace(_params, p); - string varname = trim_blanks(_scope->expand_string(_params.substr(p, q - p))); - - cerr << varname << " = \"" << _scope->get_variable(varname) - << "\" "; - p = q; - while (p < _params.length() && isspace(_params[p])) { - p++; - } - } - cerr << "\n"; - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_include_command -// Access: Protected -// Description: Handles the #include command: the indicated file is -// read and processed at this point. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_include_command() { - string filename = trim_blanks(_scope->expand_string(_params)); - - // We allow optional quotation marks around the filename. - if (filename.length() >= 2 && - filename[0] == '"' && - filename[filename.length() - 1] == '"') { - filename = filename.substr(1, filename.length() - 2); - } - - return include_file(filename); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_sinclude_command -// Access: Protected -// Description: Handles the #sinclude command: the indicated file is -// read and processed at this point. This is different -// from #include only in that if the file does not -// exist, there is no error; instead, nothing happens. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_sinclude_command() { - string filename = trim_blanks(_scope->expand_string(_params)); - - // We allow optional quotation marks around the filename. - if (filename.length() >= 2 && - filename[0] == '"' && - filename[filename.length() - 1] == '"') { - filename = filename.substr(1, filename.length() - 2); - } - - Filename fn(filename); - - if (!fn.exists()) { - // No such file; no error. - return true; - } - - return include_file(filename); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_copy_command -// Access: Protected -// Description: Handles the #copy command: the indicated file is -// read and output at this point. This is useful for -// inserting within an #output sequence, to copy the -// contents of some file into the target file. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_copy_command() { - string filename = trim_blanks(_scope->expand_string(_params)); - - // We allow optional quotation marks around the filename. - if (filename.length() >= 2 && - filename[0] == '"' && - filename[filename.length() - 1] == '"') { - filename = filename.substr(1, filename.length() - 2); - } - - Filename fn(filename); - fn.set_text(); - - ifstream in; - if (!fn.open_read(in)) { - cerr << "Unable to open copy file " << fn << ".\n"; - errors_occurred = true; - return false; - } - if (verbose) { - cerr << "Reading (copy) \"" << fn << "\"\n"; - } - - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - if (!_write_state->write_line(line)) { - return false; - } - getline(in, line); - } - - if (!in.eof()) { - cerr << "Error reading " << fn << ".\n"; - errors_occurred = true; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_call_command -// Access: Protected -// Description: Handles the #call command: the indicated named -// subroutine is read and processed at this point. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_call_command() { - // The first word is the name of the subroutine; the rest is the - // comma-separated list of expressions to substitute in for the - // subroutine's formal parameters. - - // Pull off the first word and the rest of the params. - size_t p = 0; - while (p < _params.length() && !isspace(_params[p])) { - p++; - } - string subroutine_name = trim_blanks(_params.substr(0, p)); - string params = _params.substr(p); - - if (subroutine_name.empty()) { - cerr << "#call requires at least one parameter.\n"; - errors_occurred = true; - return false; - } - - const PPSubroutine *sub = PPSubroutine::get_sub(subroutine_name); - if (sub == (const PPSubroutine *)NULL) { - cerr << "Attempt to call undefined subroutine " << subroutine_name << "\n"; - errors_occurred = true; - } - - PPScope *old_scope = _scope; - PPScope::push_scope(_scope); - PPScope nested_scope(_scope->get_named_scopes()); - _scope = &nested_scope; - nested_scope.define_formals(subroutine_name, sub->_formals, params); - - vector::const_iterator li; - for (li = sub->_lines.begin(); li != sub->_lines.end(); ++li) { - if (!read_line(*li)) { - PPScope::pop_scope(); - _scope = old_scope; - return false; - } - } - - PPScope::pop_scope(); - _scope = old_scope; - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_error_command -// Access: Protected -// Description: Handles the #error command: terminate immediately -// with the given error message. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_error_command() { - string message = trim_blanks(_scope->expand_string(_params)); - - if (!message.empty()) { - cerr << message << "\n"; - errors_occurred = true; - } - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_mkdir_command -// Access: Protected -// Description: Handles the #mkdir command: create a directory or -// directories. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_mkdir_command() { - vector words; - tokenize_whitespace(_scope->expand_string(_params), words); - - vector::const_iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - Filename dirname(*wi); - - if (dirname.is_local()) { - string prefix = _scope->expand_variable("DIRPREFIX"); - dirname = Filename(prefix, dirname); - } - - Filename filename(dirname, "file"); - if (!filename.make_dir()) { - if (!dirname.is_directory()) { - cerr << "Unable to create directory " << dirname << "\n"; - errors_occurred = true; - } - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_defer_command -// Access: Protected -// Description: Handles the #defer command: define a new variable or -// change the definition of an existing variable. This -// is different from #define in that the variable -// definition is not immediately expanded; it will be -// expanded when the variable is later used. This -// allows the definition of variables that depend on -// other variables whose values have not yet been -// defined. This is akin to GNU make's = assignment. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_defer_command() { - // Pull off the first word and the rest of the params. - size_t p = _scope->scan_to_whitespace(_params); - string varname = trim_blanks(_scope->expand_string(_params.substr(0, p))); - - if (PPSubroutine::get_func(varname) != (const PPSubroutine *)NULL) { - cerr << "Warning: variable " << varname - << " shadowed by function definition.\n"; - } - - // Skip whitespace between the variable name and its definition. - while (p < _params.length() && isspace(_params[p])) { - p++; - } - string def = _params.substr(p); - - // We don't expand the variable's definition immediately; it will be - // expanded when the variable is referenced later. However, we - // should expand any simple self-reference immediately, to allow for - // recursive definitions. - def = _scope->expand_self_reference(def, varname); - _scope->define_variable(varname, def); - - if (verbose >= 2) { - cerr << "#defer " << varname << " = " << _params.substr(p) << endl; - } - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_define_command -// Access: Protected -// Description: Handles the #define command: define a new variable or -// change the definition of an existing variable. The -// variable definition is immediately expanded. This is -// akin to GNU make's := assignment. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_define_command() { - // Pull off the first word and the rest of the params. - size_t p = _scope->scan_to_whitespace(_params); - string varname = trim_blanks(_scope->expand_string(_params.substr(0, p))); - - if (PPSubroutine::get_func(varname) != (const PPSubroutine *)NULL) { - cerr << "Warning: variable " << varname - << " shadowed by function definition.\n"; - } - - // Skip whitespace between the variable name and its definition. - while (p < _params.length() && isspace(_params[p])) { - p++; - } - string def = _scope->expand_string(_params.substr(p)); - _scope->define_variable(varname, def); - - if (verbose>=2) { - cerr << "#define " << varname << " = " << _params.substr(p) - << "\n \"" << def << "\"" <scan_to_whitespace(_params); - string varname = trim_blanks(_scope->expand_string(_params.substr(0, p))); - - if (PPSubroutine::get_func(varname) != (const PPSubroutine *)NULL) { - cerr << "Warning: variable " << varname - << " shadowed by function definition.\n"; - } - - // Skip whitespace between the variable name and its definition. - while (p < _params.length() && isspace(_params[p])) { - p++; - } - string def = _scope->expand_string(_params.substr(p)); - - if (!_scope->set_variable(varname, def)) { - cerr << "Attempt to set undefined variable " << varname << "\n"; - errors_occurred = true; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_map_command -// Access: Protected -// Description: Handles the #map command: define a new map variable. -// This is a special kind of variable declaration that -// creates a variable that can be used as a function to -// look up variable expansions within a number of -// different named scopes, accessed by keyword. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_map_command() { - // Pull off the first word and the rest of the params. - size_t p = _scope->scan_to_whitespace(_params); - string varname = trim_blanks(_scope->expand_string(_params.substr(0, p))); - - // Skip whitespace between the variable name and its definition. - while (p < _params.length() && isspace(_params[p])) { - p++; - } - string def = trim_blanks(_params.substr(p)); - _scope->define_map_variable(varname, def); - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_addmap_command -// Access: Protected -// Description: Handles the #addmap command: add a new key/scope pair -// to an existing map variable. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_addmap_command() { - // Pull off the first word and the rest of the params. - size_t p = _scope->scan_to_whitespace(_params); - string varname = trim_blanks(_scope->expand_string(_params.substr(0, p))); - - // Skip whitespace between the variable name and the key. - while (p < _params.length() && isspace(_params[p])) { - p++; - } - string key = trim_blanks(_scope->expand_string(_params.substr(p))); - - _scope->add_to_map_variable(varname, key, _scope); - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::handle_push_command -// Access: Protected -// Description: Handles the #push command: push a variable definition -// out to the enclosing scope. Useful for defining -// variables within a #forscopes block that you want to -// persist longer than the block itself. -// -// Syntax is: -// -// #push n varname [varname2 ... ] -// -// Where n is the number of levels out to push. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -handle_push_command() { - // The first word is the number of levels. - size_t p = _scope->scan_to_whitespace(_params); - string levels_str = trim_blanks(_scope->expand_string(_params.substr(0, p))); - - // Validate the number. - const char *param = levels_str.c_str(); - char *n; - int levels = strtol(param, &n, 10); - if (n == param || levels < 0) { - // Invalid integer. - cerr << "#push with invalid level count: " << levels_str << "\n"; - errors_occurred = true; - return false; - } - - PPScope *enclosing_scope = _scope; - if (levels > 0) { - enclosing_scope = _scope->get_enclosing_scope(levels - 1); - } - - // Skip whitespace to the first variable name. - while (p < _params.length() && isspace(_params[p])) { - p++; - } - - while (p < _params.length()) { - // Pull off the next varname. - size_t q = _scope->scan_to_whitespace(_params, p); - string varname = trim_blanks(_scope->expand_string(_params.substr(p, q - p))); - string def = _scope->get_variable(varname); - enclosing_scope->define_variable(varname, def); - - p = q; - while (p < _params.length() && isspace(_params[p])) { - p++; - } - } - return true; -} - - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::include_file -// Access: Protected -// Description: The internal implementation of #include: includes a -// particular named file at this point. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -include_file(Filename filename) { - filename.set_text(); - - ifstream in; - if (!filename.open_read(in)) { - cerr << "Unable to open include file " << filename << ".\n"; - errors_occurred = true; - return false; - } - if (verbose) { - cerr << "Reading (inc) \"" << filename << "\"\n"; - } - - PushFilename pushed(_scope, filename); - - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - if (!read_line(line)) { - return false; - } - getline(in, line); - } - - if (!in.eof()) { - cerr << "Error reading " << filename << ".\n"; - errors_occurred = true; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::replay_while -// Access: Protected -// Description: Replays all the lines that were saved during a -// previous #while..#end block. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -replay_while(const string &name) { - assert(!_in_for); - - bool okflag = true; - - vector lines; - lines.swap(_saved_lines); - - // Remove the #end command. This will fail if someone makes an #end - // command that spans multiple lines. Don't do that. - assert(!lines.empty()); - lines.pop_back(); - - // Now replay all of the saved lines. - BlockNesting *saved_block = _block_nesting; - IfNesting *saved_if = _if_nesting; - - while (!_scope->expand_string(name).empty()) { - vector::const_iterator li; - for (li = lines.begin(); li != lines.end() && okflag; ++li) { - okflag = read_line(*li); - } - } - - if (saved_block != _block_nesting || saved_if != _if_nesting) { - cerr << "Misplaced #end or #endif.\n"; - errors_occurred = true; - okflag = false; - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::replay_for -// Access: Protected -// Description: Replays all the lines that were saved during a -// previous #for..#end block. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -replay_for(const string &name, const vector &words) { - assert(!_in_for); - - bool okflag = true; - - vector lines; - lines.swap(_saved_lines); - - // Remove the #end command. This will fail if someone makes an #end - // command that spans multiple lines. Don't do that. - assert(!lines.empty()); - lines.pop_back(); - - // Expand the variable name. - string varname = _scope->expand_string(name); - - // Get out the numeric range. - int range[3] = {0, 0, 1}; - assert(words.size() <= 3); - for (int i = 0; i < (int)words.size(); i++) { - const char *param = words[i].c_str(); - char *n; - range[i] = strtol(param, &n, 10); - if (n == param) { - cerr << "Invalid integer in #for: " << param << "\n"; - errors_occurred = true; - return false; - } - } - - if (range[2] == 0) { - cerr << "Step by zero in #for " << name << "\n"; - errors_occurred = true; - return false; - } - - // Now replay all of the saved lines. - BlockNesting *saved_block = _block_nesting; - IfNesting *saved_if = _if_nesting; - int index_var; - - if (range[2] > 0) { - for (index_var = range[0]; index_var <= range[1]; index_var += range[2]) { - _scope->define_variable(varname, _scope->format_int(index_var)); - vector::const_iterator li; - for (li = lines.begin(); li != lines.end() && okflag; ++li) { - okflag = read_line(*li); - } - } - } else { - for (index_var = range[0]; index_var >= range[1]; index_var += range[2]) { - _scope->define_variable(varname, _scope->format_int(index_var)); - vector::const_iterator li; - for (li = lines.begin(); li != lines.end() && okflag; ++li) { - okflag = read_line(*li); - } - } - } - _scope->define_variable(varname, _scope->format_int(index_var)); - - if (saved_block != _block_nesting || saved_if != _if_nesting) { - cerr << "Misplaced #end or #endif.\n"; - errors_occurred = true; - okflag = false; - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::replay_forscopes -// Access: Protected -// Description: Replays all the lines that were saved during a -// previous #forscopes..#end block. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -replay_forscopes(const string &name) { - assert(!_in_for); - - bool okflag = true; - - vector lines; - lines.swap(_saved_lines); - - // Remove the #end command. This will fail if someone makes an #end - // command that spans multiple lines. Don't do that. - assert(!lines.empty()); - lines.pop_back(); - - PPNamedScopes *named_scopes = _scope->get_named_scopes(); - - // Extract out the scope names from the #forscopes .. #end name. This - // is a space-delimited list of scope names. - vector words; - tokenize_whitespace(_scope->expand_string(name), words); - - // Now build up the list of scopes with these names. - PPNamedScopes::Scopes scopes; - vector::const_iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - named_scopes->get_scopes(*wi, scopes); - } - PPNamedScopes::sort_by_dependency(scopes); - - // And finally, replay all of the saved lines. - BlockNesting *saved_block = _block_nesting; - IfNesting *saved_if = _if_nesting; - - PPNamedScopes::Scopes::const_iterator si; - for (si = scopes.begin(); si != scopes.end() && okflag; ++si) { - PPScope::push_scope(_scope); - _scope = (*si); - - vector::const_iterator li; - for (li = lines.begin(); li != lines.end() && okflag; ++li) { - okflag = read_line(*li); - } - _scope = PPScope::pop_scope(); - } - - if (saved_block != _block_nesting || saved_if != _if_nesting) { - cerr << "Misplaced #end or #endif.\n"; - errors_occurred = true; - okflag = false; - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::replay_foreach -// Access: Protected -// Description: Replays all the lines that were saved during a -// previous #foreach..#end block. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -replay_foreach(const string &varname, const vector &words) { - assert(!_in_for); - - bool okflag = true; - - vector lines; - lines.swap(_saved_lines); - - // Remove the #end command. This will fail if someone makes an #end - // command that spans multiple lines. Don't do that. - assert(!lines.empty()); - lines.pop_back(); - - // Now traverse through the saved words. - BlockNesting *saved_block = _block_nesting; - IfNesting *saved_if = _if_nesting; - - vector::const_iterator wi; - for (wi = words.begin(); wi != words.end() && okflag; ++wi) { - _scope->define_variable(varname, (*wi)); - vector::const_iterator li; - for (li = lines.begin(); li != lines.end() && okflag; ++li) { - okflag = read_line(*li); - } - } - - if (saved_block != _block_nesting || saved_if != _if_nesting) { - cerr << "Misplaced #end or #endif.\n"; - errors_occurred = true; - okflag = false; - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::replay_formap -// Access: Protected -// Description: Replays all the lines that were saved during a -// previous #formap..#end block. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -replay_formap(const string &varname, const string &mapvar) { - assert(!_in_for); - - bool okflag = true; - - vector lines; - lines.swap(_saved_lines); - - // Remove the #end command. This will fail if someone makes an #end - // command that spans multiple lines. Don't do that. - assert(!lines.empty()); - lines.pop_back(); - - // Now look up the map variable. - PPScope::MapVariableDefinition &def = _scope->find_map_variable(mapvar); - if (&def == &PPScope::_null_map_def) { - cerr << "Undefined map variable: #formap " << varname << " " - << mapvar << "\n"; - errors_occurred = true; - return false; - } - - // Now traverse through the map definition. - BlockNesting *saved_block = _block_nesting; - IfNesting *saved_if = _if_nesting; - - PPScope::MapVariableDefinition::const_iterator di; - for (di = def.begin(); di != def.end() && okflag; ++di) { - _scope->define_variable(varname, (*di).first); - - PPScope::push_scope(_scope); - _scope = (*di).second; - - vector::const_iterator li; - for (li = lines.begin(); li != lines.end() && okflag; ++li) { - okflag = read_line(*li); - } - - _scope = PPScope::pop_scope(); - } - - if (saved_block != _block_nesting || saved_if != _if_nesting) { - cerr << "Misplaced #end or #endif.\n"; - errors_occurred = true; - okflag = false; - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::compare_output -// Access: Protected -// Description: After a file has been written to a (potentially -// large) string via an #output command, compare the -// results to the original file. If they are different, -// remove the original file and replace it with the new -// contents; otherwise, leave the original alone. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -compare_output(const string &new_contents, Filename filename, - bool notouch, bool binary) { - if (binary) { - filename.set_binary(); - } else { - filename.set_text(); - } - bool exists = filename.exists(); - bool differ = false; - - if (exists) { - size_t len = new_contents.length(); - size_t want_bytes = len + 1; - - char *orig_contents = new char[want_bytes]; - ifstream in; - if (!filename.open_read(in)) { - cerr << "Cannot read existing " << filename << ", regenerating.\n"; - differ = true; - } else { - if (verbose) { - cerr << "Reading (cmp) \"" << filename << "\"\n"; - } - in.read(orig_contents, want_bytes); - - if (in.gcount() != len) { - // The wrong number of bytes. - differ = true; - - } else { - differ = !(new_contents == string(orig_contents, len)); - } - } - } - - if (differ || !exists) { -#ifndef WIN32_VC - if (verbose_dry_run) { - // Write our new contents to a file so we can run diff on both - // of them. - Filename temp_filename = filename.get_fullpath() + string(".ppd"); - if (binary) { - temp_filename.set_binary(); - } else { - temp_filename.set_text(); - } - ofstream out_b; - if (!temp_filename.open_write(out_b)) { - cerr << "Unable to open temporary file " << filename << " for writing.\n"; - errors_occurred = true; - return false; - } - - out_b.write(new_contents.data(), new_contents.length()); - - bool diff_ok = true; - if (!out_b) { - cerr << "Unable to write to temporary file " << filename << "\n"; - errors_occurred = true; - diff_ok = true; - } - out_b.close(); - string command = "diff -ub '" + filename.get_fullpath() + "' '" + - temp_filename.get_fullpath() + "'"; - int sys_result = system(command.c_str()); - if (sys_result < 0) { - cerr << "Unable to invoke diff\n"; - errors_occurred = true; - diff_ok = false; - } - out_b.close(); - temp_filename.unlink(); - - return diff_ok; - - } else -#endif - if (dry_run) { - cerr << "Would generate " << filename << "\n"; - } else { - cerr << "Generating " << filename << "\n"; - - if (exists) { - if (!filename.unlink()) { - cerr << "Unable to remove old " << filename << "\n"; - errors_occurred = true; - return false; - } - } - - ofstream out_b; - if (!filename.open_write(out_b)) { - cerr << "Unable to open file " << filename << " for writing.\n"; - errors_occurred = true; - return false; - } - - out_b.write(new_contents.data(), new_contents.length()); - - if (!out_b) { - cerr << "Unable to write to file " << filename << "\n"; - errors_occurred = true; - return false; - } - out_b.close(); - } - - } else { - // Even though the file is unchanged, unless the "notouch" flag is - // set, we want to update the modification time. This helps the - // makefiles know we did something. - if (!notouch && !dry_run) { - if (!filename.touch()) { - cerr << "Warning: unable to update timestamp for " << filename << "\n"; - } - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::failed_if -// Access: Protected -// Description: Returns true if we are currently within a failed #if -// block (or in an #else block for a passed #if block), -// or false otherwise. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -failed_if() const { - return (_if_nesting != (IfNesting *)NULL && - (_if_nesting->_state == IS_off || _if_nesting->_state == IS_done)); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::is_valid_formal_parameter_name -// Access: Protected -// Description: Returns true if the indicated name is an acceptable -// name for a formal parameter. This means it includes -// no whitespace or crazy punctuation. Mainly this is -// to protect the user from making some stupid syntax -// mistake. -//////////////////////////////////////////////////////////////////// -bool PPCommandFile:: -is_valid_formal(const string &formal_parameter_name) const { - if (formal_parameter_name.empty()) { - return false; - } - - string::const_iterator si; - for (si = formal_parameter_name.begin(); - si != formal_parameter_name.end(); - ++si) { - switch (*si) { - case ' ': - case '\n': - case '\t': - case '$': - case '[': - case ']': - case ',': - return false; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::PushFilename::Constructor -// Access: Public -// Description: This special class changes the current filename of -// the PPCommandFile. The idea is to create one of -// these when the filename is changed (for instance, to -// read in a new file via an #include directive); when -// the variable then goes out of scope, it will restore -// the previous filename. -// -// This updates the scope with the appropriate -// variables. -//////////////////////////////////////////////////////////////////// -PPCommandFile::PushFilename:: -PushFilename(PPScope *scope, const string &filename) { - _scope = scope; - _old_thisdirprefix = _scope->get_variable("THISDIRPREFIX"); - _old_thisfilename = _scope->get_variable("THISFILENAME"); - - string thisfilename = filename; - string thisdirprefix; - - size_t slash = filename.rfind('/'); - if (slash == string::npos) { - thisdirprefix = string(); - } else { - thisdirprefix = filename.substr(0, slash + 1); - } - - _scope->define_variable("THISFILENAME", thisfilename); - _scope->define_variable("THISDIRPREFIX", thisdirprefix); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPCommandFile::PushFilename::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPCommandFile::PushFilename:: -~PushFilename() { - _scope->define_variable("THISFILENAME", _old_thisfilename); - _scope->define_variable("THISDIRPREFIX", _old_thisdirprefix); -} diff --git a/ppremake/ppCommandFile.h b/ppremake/ppCommandFile.h deleted file mode 100644 index 965d72ab43..0000000000 --- a/ppremake/ppCommandFile.h +++ /dev/null @@ -1,200 +0,0 @@ -// Filename: ppCommandFile.h -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPCOMMANDFILE_H -#define PPCOMMANDFILE_H - -#include "ppremake.h" -#include "filename.h" - -#include -#include - -class PPScope; - -/////////////////////////////////////////////////////////////////// -// Class : PPCommandFile -// Description : This encapsulates a file that contains #commands to -// execute (like #define, #if, #begin .. #end), -// $[variables] to expand, and plain text to output. -//////////////////////////////////////////////////////////////////// -class PPCommandFile { -public: - PPCommandFile(PPScope *scope); - ~PPCommandFile(); - - void set_output(ostream *out); - - void set_scope(PPScope *scope); - PPScope *get_scope() const; - - bool read_file(Filename filename); - bool read_stream(istream &in, const string &filename); - bool read_stream(istream &in); - void begin_read(); - bool read_line(string line); - bool end_read(); - -protected: - bool handle_command(const string &line); - bool handle_if_command(); - bool handle_elif_command(); - bool handle_else_command(); - bool handle_endif_command(); - - bool handle_begin_command(); - bool handle_while_command(); - bool handle_for_command(); - bool handle_forscopes_command(); - bool handle_foreach_command(); - bool handle_formap_command(); - bool handle_defsub_command(bool is_defsub); - bool handle_output_command(); - bool handle_end_command(); - - bool handle_format_command(); - bool handle_print_command(); - bool handle_printvar_command(); - bool handle_include_command(); - bool handle_sinclude_command(); - bool handle_copy_command(); - bool handle_call_command(); - bool handle_error_command(); - bool handle_mkdir_command(); - - bool handle_defer_command(); - bool handle_define_command(); - bool handle_set_command(); - bool handle_map_command(); - bool handle_addmap_command(); - bool handle_push_command(); - - bool include_file(Filename filename); - bool replay_while(const string &name); - bool replay_for(const string &name, const vector &words); - bool replay_forscopes(const string &name); - bool replay_foreach(const string &varname, const vector &words); - bool replay_formap(const string &varname, const string &mapvar); - bool compare_output(const string &new_contents, Filename filename, - bool notouch, bool binary); - bool failed_if() const; - - bool is_valid_formal(const string &formal_parameter_name) const; - -private: - class PushFilename { - public: - PushFilename(PPScope *scope, const string &filename); - ~PushFilename(); - - PPScope *_scope; - string _old_thisdirprefix; - string _old_thisfilename; - }; - -private: - class BlockNesting; - - enum IfState { - IS_on, // e.g. a passed #if - IS_else, // after matching an #else - IS_off, // e.g. a failed #if - IS_done // e.g. after reaching an #else or #elif for a passed #if. - }; - - class IfNesting { - public: - IfNesting(IfState state); - void push(PPCommandFile *file); - void pop(PPCommandFile *file); - - IfState _state; - BlockNesting *_block; - IfNesting *_next; - }; - - enum BlockState { - BS_begin, - BS_while, - BS_nested_while, - BS_for, - BS_nested_for, - BS_forscopes, - BS_nested_forscopes, - BS_foreach, - BS_nested_foreach, - BS_formap, - BS_nested_formap, - BS_defsub, - BS_defun, - BS_output - }; - - enum WriteFormat { - WF_error, // anything other than whitespace is an error. - WF_straight, // write lines directly as they come in - WF_collapse, // collapse out consecutive blank lines - WF_makefile // fancy makefile formatting - }; - - class WriteState { - public: - WriteState(); - WriteState(const WriteState ©); - bool write_line(const string &line); - bool write_collapse_line(const string &line); - bool write_makefile_line(const string &line); - - ostream *_out; - WriteFormat _format; - bool _last_blank; - }; - - enum OutputFlags { - OF_notouch = 0x001, - OF_binary = 0x002, - }; - - class BlockNesting { - public: - BlockNesting(BlockState state, const string &name); - void push(PPCommandFile *file); - void pop(PPCommandFile *file); - - BlockState _state; - string _name; - IfNesting *_if; - WriteState *_write_state; - PPScope *_scope; - string _params; -#ifdef HAVE_SSTREAM - ostringstream _output; -#else - ostrstream _output; -#endif - vector _words; - int _flags; - BlockNesting *_next; - }; - - PPScope *_native_scope; - PPScope *_scope; - bool _got_command; - bool _in_for; - IfNesting *_if_nesting; - BlockNesting *_block_nesting; - string _command; - string _params; - WriteState *_write_state; - - vector _saved_lines; - - friend class PPCommandFile::IfNesting; - friend class PPCommandFile::WriteState; - friend class PPCommandFile::BlockNesting; -}; - - -#endif diff --git a/ppremake/ppDependableFile.cxx b/ppremake/ppDependableFile.cxx deleted file mode 100644 index 6382a4c46f..0000000000 --- a/ppremake/ppDependableFile.cxx +++ /dev/null @@ -1,534 +0,0 @@ -// Filename: ppDependableFile.cxx -// Created by: drose (15Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppDependableFile.h" -#include "ppDirectory.h" -#include "ppDirectoryTree.h" -#include "filename.h" -#include "check_include.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include -#include -#include - -class SortDependableFilesByName { -public: - bool operator () (PPDependableFile *a, PPDependableFile *b) const { - return a->get_filename() < b->get_filename(); - } -}; - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::Ordering Operator -// Access: Public -// Description: We provide this function so we can sort the -// dependency list into a consistent ordering, so that -// the makefiles won't get randomly regenerated between -// different sessions. -//////////////////////////////////////////////////////////////////// -bool PPDependableFile::Dependency:: -operator < (const Dependency &other) const { - return _file->get_filename() < other._file->get_filename(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPDependableFile:: -PPDependableFile(PPDirectory *directory, const string &filename) : - _directory(directory), - _filename(filename) -{ - _flags = 0; - _mtime = 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::update_from_cache -// Access: Public -// Description: Called as the dependency cache file is being read, -// this asks the file to update its information from the -// cache file if appropriate. This means comparing the -// cached modification time against the file's actual -// modification time, and storing the cached -// dependencies if they match. -// -// The return value is true if the cache is valid, false -// if something appears to be wrong. -//////////////////////////////////////////////////////////////////// -bool PPDependableFile:: -update_from_cache(const vector &words) { - // Shouldn't call this once the file has actually been read. - assert((_flags & F_updated) == 0); - assert((_flags & F_updating) == 0); - assert((_flags & F_from_cache) == 0); - assert(words.size() >= 2); - - if (!exists()) { - // The file doesn't even exist; clearly the cache is bad. - _flags |= F_bad_cache; - - } else { - // The second parameter is the cached modification time. - time_t mtime = strtol(words[1].c_str(), (char **)NULL, 10); - if (mtime == get_mtime()) { - // The modification matches; preserve the cache information. - PPDirectoryTree *tree = _directory->get_tree(); - - _dependencies.clear(); - vector::const_iterator wi; - for (wi = words.begin() + 2; wi != words.end(); ++wi) { - string dirpath = (*wi); - - Dependency dep; - dep._okcircular = false; - - if (dirpath.length() > 1 && dirpath[0] == '/') { - // If the first character is '/', it means that the file has - // been marked okcircular. - dep._okcircular = true; - dirpath = dirpath.substr(1); - } - - if (dirpath.length() > 2 && dirpath.substr(0, 2) == "*/") { - // This is an extra include file, not a file in this source - // tree. - _extra_includes.push_back(dirpath.substr(2)); - - } else { - dep._file = - tree->get_dependable_file_by_dirpath(dirpath, false); - if (dep._file != (PPDependableFile *)NULL) { - _dependencies.push_back(dep); - } - } - } - - _flags |= F_from_cache; - sort(_dependencies.begin(), _dependencies.end()); - } - } - - return ((_flags & F_bad_cache) == 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::clear_cache -// Access: Public -// Description: Forgets the cache we just read. -//////////////////////////////////////////////////////////////////// -void PPDependableFile:: -clear_cache() { - _dependencies.clear(); - _flags &= ~(F_bad_cache | F_from_cache); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::write_cache -// Access: Public -// Description: Writes the dependency information out as a single -// line to the indicated dependency cache file. -//////////////////////////////////////////////////////////////////// -void PPDependableFile:: -write_cache(ostream &out) { - out << _filename << " " << get_mtime(); - - Dependencies::const_iterator di; - for (di = _dependencies.begin(); di != _dependencies.end(); ++di) { - out << " "; - if ((*di)._okcircular) { - out << "/"; - } - if ((*di)._file->get_directory()->get_tree() != get_directory()->get_tree()) { - out << "+"; - } - out << (*di)._file->get_dirpath(); - } - - // Also write out the extra includes--those #include directives - // which do not reference a file within this source tree. We need - // those just for comparison's sake later, so we can tell whether - // the cache line is still current (without having to know which - // files are part of the tree). - ExtraIncludes::const_iterator ei; - for (ei = _extra_includes.begin(); ei != _extra_includes.end(); ++ei) { - out << " */" << (*ei); - } - - out << "\n"; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_directory -// Access: Public -// Description: Returns the directory that this file can be found in. -//////////////////////////////////////////////////////////////////// -PPDirectory *PPDependableFile:: -get_directory() const { - return _directory; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_filename -// Access: Public -// Description: Returns the local filename of this particular file -// within the directory. -//////////////////////////////////////////////////////////////////// -const string &PPDependableFile:: -get_filename() const { - return _filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_pathname -// Access: Public -// Description: Returns the relative pathname from the root of the -// source tree to this particular filename. -//////////////////////////////////////////////////////////////////// -string PPDependableFile:: -get_pathname() const { - return _directory->get_path() + "/" + _filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_fullpath -// Access: Public -// Description: Returns the full pathname to this particular filename. -//////////////////////////////////////////////////////////////////// -string PPDependableFile:: -get_fullpath() const { - return _directory->get_fullpath() + "/" + _filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_dirpath -// Access: Public -// Description: Returns an abbreviated pathname to this file, in the -// form dirname/filename. -//////////////////////////////////////////////////////////////////// -string PPDependableFile:: -get_dirpath() const { - return _directory->get_dirname() + "/" + _filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::exists -// Access: Public -// Description: Returns true if the file exists, false if it does -// not. -//////////////////////////////////////////////////////////////////// -bool PPDependableFile:: -exists() { - stat_file(); - return ((_flags & F_exists) != 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_mtime -// Access: Public -// Description: Returns the last modification time of the file. -//////////////////////////////////////////////////////////////////// -time_t PPDependableFile:: -get_mtime() { - stat_file(); - return _mtime; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_num_dependencies -// Access: Public -// Description: Returns the number of files this file depends on. -//////////////////////////////////////////////////////////////////// -int PPDependableFile:: -get_num_dependencies() { - update_dependencies(); - return _dependencies.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_dependency -// Access: Public -// Description: Returns the nth file this file depends on. -//////////////////////////////////////////////////////////////////// -PPDependableFile *PPDependableFile:: -get_dependency(int n) { - assert((_flags & F_updated) != 0); - assert(n >= 0 && n < (int)_dependencies.size()); - return _dependencies[n]._file; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_complete_dependencies -// Access: Public -// Description: This flavor of get_complete_dependencies() works like -// the one below, except it returns the results in a -// consistently-ordered vector. This allows us to keep -// the dependencies in the same order between sessions -// and prevent makefiles from being arbitrarily -// regenerated. -//////////////////////////////////////////////////////////////////// -void PPDependableFile:: -get_complete_dependencies(vector &files) { - set files_set; - get_complete_dependencies(files_set); - - copy(files_set.begin(), files_set.end(), back_inserter(files)); - sort(files.begin(), files.end(), SortDependableFilesByName()); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_complete_dependencies -// Access: Public -// Description: Recursively determines the complete set of files this -// file depends on. It is the user's responsibility to -// empty the set before calling this function; the -// results will simply be added to the existing set. -//////////////////////////////////////////////////////////////////// -void PPDependableFile:: -get_complete_dependencies(set &files) { - update_dependencies(); - Dependencies::const_iterator di; - for (di = _dependencies.begin(); di != _dependencies.end(); ++di) { - PPDependableFile *file = (*di)._file; - if (files.insert(file).second) { - file->get_complete_dependencies(files); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::is_circularity -// Access: Public -// Description: Returns true if a circular dependency exists between -// this file and one or more other files. -//////////////////////////////////////////////////////////////////// -bool PPDependableFile:: -is_circularity() { - update_dependencies(); - return (_flags & F_circularity) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::get_circularity -// Access: Public -// Description: If is_circularity() returns true, returns a string -// describing the circular dependency path for the user. -//////////////////////////////////////////////////////////////////// -string PPDependableFile:: -get_circularity() { - update_dependencies(); - return _circularity; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::was_examined -// Access: Public -// Description: Returns true if anyone ever asked this file for its -// list of dependencies, or false otherwise. -//////////////////////////////////////////////////////////////////// -bool PPDependableFile:: -was_examined() const { - return ((_flags & F_updated) != 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::was_cached -// Access: Public -// Description: Returns true if this file was found in the cache, -// false otherwise. -//////////////////////////////////////////////////////////////////// -bool PPDependableFile:: -was_cached() const { - return ((_flags & F_from_cache) != 0); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::update_dependencies -// Access: Private -// Description: Builds up the dependency list--the list of files this -// file depends on--if it hasn't already been built. If -// a circular dependency is detected during this -// process, _circularity and _circularity_detected will -// be updated accordingly. -//////////////////////////////////////////////////////////////////// -void PPDependableFile:: -update_dependencies() { - if ((_flags & F_updated) != 0) { - return; - } - - assert((_flags & F_updating) == 0); - string circularity; - compute_dependencies(circularity); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::compute_dependencies -// Access: Private -// Description: Builds up the dependency list--the list of files this -// file depends on--if it hasn't already been built. -// -// If a circularity is detected, e.g. two files depend -// on each other, a pointer to the offending file is -// returned and the string is updated to indicate the -// circularity. Otherwise, if there is no circularity, -// NULL is returned. -//////////////////////////////////////////////////////////////////// -PPDependableFile *PPDependableFile:: -compute_dependencies(string &circularity) { - if ((_flags & F_updated) != 0) { - return (PPDependableFile *)NULL; - - } else if ((_flags & F_updating) != 0) { - // Oh oh, a circular dependency! - circularity = get_dirpath(); - return this; - } - - _flags |= F_updating; - - if ((_flags & F_from_cache) == 0) { - // Now open the file and scan it for #include statements. - Filename filename(get_fullpath()); - filename.set_text(); - ifstream in; - if (!filename.open_read(in)) { - // Can't read the file, or the file doesn't exist. Interesting. - if (exists()) { - cerr << "Warning: dependent file " << filename - << " exists but cannot be read.\n"; - } else { - cerr << "Warning: dependent file " << filename - << " does not exist.\n"; - _flags |= F_bad_cache; - } - - } else { - if (verbose) { - cerr << "Reading (dep) \"" << filename << "\"\n"; - } - PPDirectoryTree *tree = _directory->get_tree()->get_main_tree(); - - bool okcircular = false; - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - if (line.substr(0, 16) == "/* okcircular */") { - okcircular = true; - } else { - string filename = check_include(line); - if (!filename.empty() && filename.find('/') == string::npos) { - Dependency dep; - dep._okcircular = okcircular; - dep._file = tree->find_dependable_file(filename); - if (dep._file != (PPDependableFile *)NULL) { - // All right! Here's a file we depend on. Add it to the - // list. - _dependencies.push_back(dep); - - } else { - // It's an include file from somewhere else, not from within - // our source tree. We don't care about it, but we do need - // to record it so we can easily check later if the cache - // file has gone stale. - _extra_includes.push_back(filename); - } - } - okcircular = false; - } - getline(in, line); - } - } - } - - // Now recursively expand all our dependent files, so we can check - // for circularities. - PPDependableFile *circ = (PPDependableFile *)NULL; - - Dependencies::iterator di; - for (di = _dependencies.begin(); - di != _dependencies.end() && circ == (PPDependableFile *)NULL; - ++di) { - // Skip this file if the user specifically marked it - // with an "okcircular" comment. - if (!(*di)._okcircular) { - circ = (*di)._file->compute_dependencies(circularity); - if (((*di)._file->_flags & F_bad_cache) != 0) { - // If our dependent file had a broken cache, our own cache is - // suspect. - _flags |= F_bad_cache; - } - - if (circ != (PPDependableFile *)NULL) { - // Oops, a circularity. Silly user. - circularity = get_dirpath() + " => " + circularity; - - if (circ == this) { - _flags |= F_circularity; - _circularity = circularity; - } - } - } - } - - _flags = (_flags & ~F_updating) | F_updated; - sort(_dependencies.begin(), _dependencies.end()); - - if ((_flags & (F_bad_cache | F_from_cache)) == (F_bad_cache | F_from_cache)) { - // Our cache is suspect. Re-read the file to flush the cache. - if (verbose) { - cerr << "Dependency cache for \"" << get_fullpath() << "\" is suspect.\n"; - } - - clear_cache(); - _flags &= ~F_updated; - - return compute_dependencies(circularity); - } - - return circ; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDependableFile::stat_file -// Access: Private -// Description: Performs a stat() on the file, if it has not already -// been performed, to check whether the file exists and -// to get its last-modification time. -//////////////////////////////////////////////////////////////////// -void PPDependableFile:: -stat_file() { - if ((_flags & F_statted) != 0) { - // Already done. - return; - } - - _flags |= F_statted; - struct stat st; - Filename pathname(get_fullpath()); - string ospath = pathname.to_os_specific(); - if (stat(ospath.c_str(), &st) < 0) { - // The file doesn't exist! - return; - } - -#ifdef S_ISREG - if (!S_ISREG(st.st_mode)) { - // The file exists, but it's not a regular file--we consider that - // not existing. - return; - } -#endif // S_ISREG - - _flags |= F_exists; - _mtime = st.st_mtime; -} diff --git a/ppremake/ppDependableFile.h b/ppremake/ppDependableFile.h deleted file mode 100644 index 84c959a323..0000000000 --- a/ppremake/ppDependableFile.h +++ /dev/null @@ -1,94 +0,0 @@ -// Filename: ppDependableFile.h -// Created by: drose (15Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPDEPENDABLEFILE_H -#define PPDEPENDABLEFILE_H - -#include "ppremake.h" -#include -#include -#include - -#ifdef HAVE_SYS_TIME_H -#include -#endif - -class PPDirectory; - -/////////////////////////////////////////////////////////////////// -// Class : PPDependableFile -// Description : Corresponds to a single C/C++ source file, either a -// .c file or a .h file, that can be scanned for a -// number of #include statements. This file may both -// depend on other files, as well as being depended upon -// in turn. This is used to resolved inter-file -// dependencies. -//////////////////////////////////////////////////////////////////// -class PPDependableFile { -public: - PPDependableFile(PPDirectory *directory, const string &filename); - bool update_from_cache(const vector &words); - void clear_cache(); - void write_cache(ostream &out); - - PPDirectory *get_directory() const; - const string &get_filename() const; - string get_pathname() const; - string get_fullpath() const; - string get_dirpath() const; - - bool exists(); - time_t get_mtime(); - - int get_num_dependencies(); - PPDependableFile *get_dependency(int n); - - void get_complete_dependencies(vector &files); - void get_complete_dependencies(set &files); - - bool is_circularity(); - string get_circularity(); - - bool was_examined() const; - bool was_cached() const; - -private: - void update_dependencies(); - PPDependableFile *compute_dependencies(string &circularity); - void stat_file(); - - PPDirectory *_directory; - string _filename; - - enum Flags { - F_updating = 0x001, - F_updated = 0x002, - F_circularity = 0x004, - F_statted = 0x008, - F_exists = 0x010, - F_from_cache = 0x020, - F_bad_cache = 0x040, - }; - int _flags; - string _circularity; - time_t _mtime; - - class Dependency { - public: - PPDependableFile *_file; - bool _okcircular; - - bool operator < (const Dependency &other) const; - }; - - typedef vector Dependencies; - Dependencies _dependencies; - - typedef vector ExtraIncludes; - ExtraIncludes _extra_includes; -}; - -#endif - diff --git a/ppremake/ppDirectory.cxx b/ppremake/ppDirectory.cxx deleted file mode 100644 index f9d102a8fd..0000000000 --- a/ppremake/ppDirectory.cxx +++ /dev/null @@ -1,962 +0,0 @@ -// Filename: ppDirectory.cxx -// Created by: drose (28Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppDirectory.h" -#include "ppDirectoryTree.h" -#include "ppScope.h" -#include "ppNamedScopes.h" -#include "ppCommandFile.h" -#include "ppDependableFile.h" -#include "tokenize.h" -#include "ppremake.h" - -#ifdef HAVE_DIRENT_H -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#include - -#include -#include -#include - -#ifdef WIN32_VC -#include -#include -#endif - -// How new must a pp.dep cache file be before we will believe it? -static const int max_cache_minutes = 60; - -PPDirectory *current_output_directory = (PPDirectory *)NULL; - -// An STL object to sort directories in order by dependency and then -// by name, used in get_child_dirnames(). -class SortDirectoriesByDependencyAndName { -public: - bool operator () (const PPDirectory *a, const PPDirectory *b) const { - if (a->get_depends_index() != b->get_depends_index()) { - return a->get_depends_index() < b->get_depends_index(); - } - return a->get_dirname() < b->get_dirname(); - } -}; - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::Constructor -// Access: Public -// Description: Creates the root directory. -//////////////////////////////////////////////////////////////////// -PPDirectory:: -PPDirectory(PPDirectoryTree *tree) { - _scope = (PPScope *)NULL; - _source = (PPCommandFile *)NULL; - _parent = (PPDirectory *)NULL; - _tree = tree; - _depth = 0; - _depends_index = 0; - _computing_depends_index = false; - - _dirname = "top"; - _tree->_dirnames.insert(PPDirectoryTree::Dirnames::value_type(_dirname, this)); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::Constructor -// Access: Public -// Description: Creates a new directory level that automatically adds -// itself to its parent's children list. -//////////////////////////////////////////////////////////////////// -PPDirectory:: -PPDirectory(const string &dirname, PPDirectory *parent) : - _dirname(dirname), - _parent(parent) -{ - assert(_parent != (PPDirectory *)NULL); - _scope = (PPScope *)NULL; - _source = (PPCommandFile *)NULL; - _parent->_children.push_back(this); - _tree = _parent->_tree; - _depth = _parent->_depth + 1; - _depends_index = 0; - _computing_depends_index = false; - - bool inserted = - _tree->_dirnames.insert(PPDirectoryTree::Dirnames::value_type(_dirname, this)).second; - if (!inserted) { - cerr << "Warning: multiple directories encountered named " - << _dirname << "\n"; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::Destructor -// Access: Public -// Description: When a tree root destructs, all of its children are -// also destroyed. -//////////////////////////////////////////////////////////////////// -PPDirectory:: -~PPDirectory() { - Children::iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - delete (*ci); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_tree -// Access: Public -// Description: Returns the PPDirectoryTree object corresponding to -// the source tree that this directory is a part of. -//////////////////////////////////////////////////////////////////// -PPDirectoryTree *PPDirectory:: -get_tree() const { - return _tree; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::count_source_files -// Access: Public -// Description: Returns the number of directories within the tree -// that actually have a Sources.pp file that was read. -//////////////////////////////////////////////////////////////////// -int PPDirectory:: -count_source_files() const { - int count = 0; - if (_source != (PPCommandFile *)NULL) { - count++; - } - - Children::const_iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - count += (*ci)->count_source_files(); - } - - return count; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_dirname -// Access: Public -// Description: Returns the name of this particular directory level. -//////////////////////////////////////////////////////////////////// -const string &PPDirectory:: -get_dirname() const { - return _dirname; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_depends_index -// Access: Public -// Description: Returns the dependency index associated with this -// directory. It is generally true that if directory A -// depends on B, then A.get_depends_index() > -// B.get_depends_index(). -//////////////////////////////////////////////////////////////////// -int PPDirectory:: -get_depends_index() const { - return _depends_index; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_path -// Access: Public -// Description: Returns the relative path from the root to this -// particular directory. This does not include the root -// name itself, and does not include a trailing slash. -//////////////////////////////////////////////////////////////////// -string PPDirectory:: -get_path() const { - if (_parent == (PPDirectory *)NULL) { - return "."; - } - if (_parent->_parent == (PPDirectory *)NULL) { - return _dirname; - } - return _parent->get_path() + "/" + _dirname; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_fullpath -// Access: Public -// Description: Returns the full path to this particular directory. -// This does not include a trailing slash. -//////////////////////////////////////////////////////////////////// -string PPDirectory:: -get_fullpath() const { - if (_parent == (PPDirectory *)NULL) { - return _tree->get_fullpath(); - } - return _tree->get_fullpath() + "/" + get_path(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_rel_to -// Access: Public -// Description: Returns the relative path to the other directory from -// this one. This does not include a trailing slash. -//////////////////////////////////////////////////////////////////// -string PPDirectory:: -get_rel_to(const PPDirectory *other) const { - const PPDirectory *a = this; - const PPDirectory *b = other; - - if (a == b) { - return "."; - } - - if (a->_tree != b->_tree) { - // If they're in different trees, just return the full path to b. - return b->get_fullpath(); - } - - string prefix, postfix; - while (a->_depth > b->_depth) { - prefix += "../"; - a = a->_parent; - assert(a != (PPDirectory *)NULL); - } - - while (b->_depth > a->_depth) { - postfix = b->_dirname + "/" + postfix; - b = b->_parent; - assert(b != (PPDirectory *)NULL); - } - - while (a != b) { - prefix += "../"; - postfix = b->_dirname + "/" + postfix; - a = a->_parent; - b = b->_parent; - assert(a != (PPDirectory *)NULL); - assert(b != (PPDirectory *)NULL); - } - - string result = prefix + postfix; - assert(!result.empty()); - return result.substr(0, result.length() - 1); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_source -// Access: Public -// Description: Returns the source file associated with this level -// of the directory hierarchy. This *might* be NULL. -//////////////////////////////////////////////////////////////////// -PPCommandFile *PPDirectory:: -get_source() const { - return _source; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_num_children -// Access: Public -// Description: Returns the number of subdirectories below this -// level. -//////////////////////////////////////////////////////////////////// -int PPDirectory:: -get_num_children() const { - return _children.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_child -// Access: Public -// Description: Returns the nth subdirectory below this level. -//////////////////////////////////////////////////////////////////// -PPDirectory *PPDirectory:: -get_child(int n) const { - assert(n >= 0 && n < (int)_children.size()); - return _children[n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_child_dirnames -// Access: Public -// Description: Returns a single string listing the names of all the -// subdirectories of this level, delimited by spaces. -// -// The list is sorted in dependency order such that a -// directory is listed after the other directories it -// might depend on. -//////////////////////////////////////////////////////////////////// -string PPDirectory:: -get_child_dirnames() const { - Children copy_children = _children; - sort(copy_children.begin(), copy_children.end(), - SortDirectoriesByDependencyAndName()); - - vector words; - Children::const_iterator ci; - for (ci = copy_children.begin(); ci != copy_children.end(); ++ci) { - words.push_back((*ci)->get_dirname()); - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_complete_subtree -// Access: Public -// Description: Returns a single string listing the relative path -// from the source root to each source directory at this -// level and below, delimited by spaces. -//////////////////////////////////////////////////////////////////// -string PPDirectory:: -get_complete_subtree() const { - Children copy_children = _children; - sort(copy_children.begin(), copy_children.end(), - SortDirectoriesByDependencyAndName()); - - vector words; - words.push_back(get_path()); - - Children::const_iterator ci; - for (ci = copy_children.begin(); ci != copy_children.end(); ++ci) { - words.push_back((*ci)->get_complete_subtree()); - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_dependable_file -// Access: Public -// Description: Returns a PPDependableFile object corresponding to -// the named filename, creating one if it does not -// already exist. This can be used to determine the -// inter-file dependencies between source files. -// -// If is_header is true, then the file will be added to -// the index at the top of the directory tree, so that -// other directories may include this file. In this -// case, if the filename is not unique, a warning -// message will be issued. -//////////////////////////////////////////////////////////////////// -PPDependableFile *PPDirectory:: -get_dependable_file(const string &filename, bool is_header) { - Dependables::iterator di; - di = _dependables.find(filename); - if (di != _dependables.end()) { - return (*di).second; - } - - // No such file found; create a new definition. - PPDependableFile *dependable = new PPDependableFile(this, filename); - _dependables.insert(Dependables::value_type(filename, dependable)); - - if (is_header) { - PPDirectoryTree *main_tree = _tree->get_main_tree(); - bool unique = main_tree->_dependables.insert - (PPDirectoryTree::Dependables::value_type(filename, dependable)).second; - - if (!unique) { - PPDependableFile *other = main_tree->find_dependable_file(filename); - if (_tree != main_tree && - other->get_directory()->get_tree() != main_tree) { - // Both files are in external dependable trees. - cerr << "Error: header file " << dependable->get_fullpath() - << " may be confused with " << other->get_fullpath() - << ".\n"; - errors_occurred = true; - - } else if (other->get_directory()->get_tree() != _tree) { - // This file is a source file in this tree, while the other - // one is an external file. This is not a warning condition, - // since maybe we've already installed the source file to the - // global install directory on some previous build. - - } else { - // Both files are within the same source tree. - cerr << "Error: source file " << dependable->get_pathname() - << " may be confused with " << other->get_pathname() - << ".\n"; - errors_occurred = true; - } - } - } - - return dependable; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::report_depends -// Access: Public -// Description: Reports all the directories that the current -// directory depends on. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -report_depends() const { - if (_i_depend_on.empty()) { - cerr << _dirname << " depends on no other directories.\n"; - - } else { - // Get the complete set of directories we depend on. - Depends dep; - get_complete_i_depend_on(dep); - - cerr << _dirname << " depends directly on the following directories:"; - show_directories(_i_depend_on); - - cerr << "and directly or indirectly on the following directories:"; - show_directories(dep); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::report_reverse_depends -// Access: Public -// Description: Reports all the directories that depend on the -// current directory. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -report_reverse_depends() const { - if (_depends_on_me.empty()) { - cerr << _dirname << " is needed by no other directories.\n"; - - } else { - // Get the complete set of directories we depend on. - Depends dep; - get_complete_depends_on_me(dep); - - cerr << _dirname << " is needed directly by the following directories:"; - show_directories(_depends_on_me); - - cerr << "and directly or indirectly by the following directories:"; - show_directories(dep); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::r_scan -// Access: Private -// Description: The recursive implementation of -// PPDirectoryTree::scan_source(). -//////////////////////////////////////////////////////////////////// -bool PPDirectory:: -r_scan(const string &prefix) { - Filename root_name = "."; - if (!prefix.empty()) { - root_name = prefix.substr(0, prefix.length() - 1); - } - - // Collect all the filenames in the directory in this vector first. - vector filenames; - if (!root_name.scan_directory(filenames)) { - cerr << "Unable to scan directory " << root_name << "\n"; - return false; - } - - vector::const_iterator fi; - for (fi = filenames.begin(); fi != filenames.end(); ++fi) { - string filename = (*fi); - - if (!filename.empty() && filename[0] != '.') { - // Is this possibly a subdirectory with its own Sources.pp - // within it? - string next_prefix = prefix + filename + "/"; - Filename source_filename = next_prefix + SOURCE_FILENAME; - if (source_filename.exists()) { - PPDirectory *subtree = new PPDirectory(filename, this); - - if (!subtree->r_scan(next_prefix)) { - return false; - } - } - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::scan_extra_depends -// Access: Private -// Description: The recursive implementation of -// PPDirectoryTree::scan_extra_depends(). This simply -// adds each *.h or *.I file in the directory as a -// dependable file. It is assumed to be called for an -// external directory named by DEPENDABLE_HEADER_DIRS. -//////////////////////////////////////////////////////////////////// -bool PPDirectory:: -scan_extra_depends(const string &cache_filename) { - Filename root_name = get_fullpath(); - - vector filenames; - if (!root_name.scan_directory(filenames)) { - cerr << "Unable to scan directory " << root_name << "\n"; - return false; - } - - if (verbose) { - cerr << "Scanning external directory " << get_fullpath() << "\n"; - } - - vector::const_iterator fi; - for (fi = filenames.begin(); fi != filenames.end(); ++fi) { - string filename = (*fi); - - if (!filename.empty() && filename[0] != '.' && - filename != string("CVS") && - filename != cache_filename) { - get_dependable_file(filename, true); - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::read_source_file -// Access: Private -// Description: Recursively reads in the source file at each level, -// if defined. -//////////////////////////////////////////////////////////////////// -bool PPDirectory:: -read_source_file(const string &prefix, PPNamedScopes *named_scopes) { - Filename source_filename = prefix + SOURCE_FILENAME; - source_filename.set_text(); - - ifstream in; - if (source_filename.open_read(in)) { - if (verbose) { - cerr << "Reading (dir) \"" << source_filename << "\"\n"; - } - - named_scopes->set_current(_dirname); - _scope = named_scopes->make_scope(""); - - _scope->define_variable("SOURCEFILE", SOURCE_FILENAME); - _scope->define_variable("DIRNAME", _dirname); - _scope->define_variable("DIRPREFIX", prefix); - _scope->define_variable("PATH", get_path()); - _scope->define_variable("SUBDIRS", get_child_dirnames()); - _scope->define_variable("SUBTREE", get_complete_subtree()); - _scope->set_directory(this); - - _source = new PPCommandFile(_scope); - - if (!_source->read_stream(in, source_filename)) { - return false; - } - } - - Children::iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - if (!(*ci)->read_source_file(prefix + (*ci)->get_dirname() + "/", - named_scopes)) { - return false; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::read_depends_file -// Access: Private -// Description: Recursively reads in the dependency definition file -// for each source file. -//////////////////////////////////////////////////////////////////// -bool PPDirectory:: -read_depends_file(PPNamedScopes *named_scopes) { - if (_scope != (PPScope *)NULL) { - // Read the depends file, so we can determine the relationship - // between this source file and all of the other source files. - - string depends_filename = _scope->expand_variable("DEPENDS_FILE"); - if (depends_filename.empty()) { - cerr << "No definition given for $[DEPENDS_FILE], cannot process.\n"; - return false; - } - - named_scopes->set_current(_dirname); - current_output_directory = this; - PPCommandFile depends(_scope); - if (!depends.read_file(depends_filename)) { - cerr << "Error reading dependency definition file " - << depends_filename << ".\n"; - return false; - } - - // This should have defined the variable DEPEND_DIRS, which lists - // the various dirnames this source file depends on. - - vector dirnames; - tokenize_whitespace(_scope->expand_variable("DEPEND_DIRS"), dirnames); - - vector::const_iterator ni; - for (ni = dirnames.begin(); ni != dirnames.end(); ++ni) { - const string &dirname = (*ni); - PPDirectory *dir = _tree->find_dirname(dirname); - if (dir == (PPDirectory *)NULL) { - cerr << "Could not find dependent dirname " << dirname << "\n"; - } else { - if (dir != this) { - _i_depend_on.insert(dir); - dir->_depends_on_me.insert(this); - } - } - } - - // This may also have defined the variable DEPENDABLE_HEADERS, - // which lists the header files in this directory that C/C++ - // source files in this and other directories might be including - // (and will therefore depend on). - vector headers; - tokenize_whitespace(_scope->expand_variable("DEPENDABLE_HEADERS"), headers); - for (ni = headers.begin(); ni != headers.end(); ++ni) { - get_dependable_file(*ni, true); - } - } - - Children::iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - if (!(*ci)->read_depends_file(named_scopes)) { - return false; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::resolve_dependencies -// Access: Private -// Description: Visits each directory and assigns a correct -// _depends_index to each one, such that if directory A -// depends on directory B then A._depends_index > -// B._depends_index. -// -// This also detects cycles in the directory dependency -// graph. -//////////////////////////////////////////////////////////////////// -bool PPDirectory:: -resolve_dependencies() { - if (!compute_depends_index()) { - return false; - } - - Children::iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - if (!(*ci)->resolve_dependencies()) { - return false; - } - } - - // Now that we've resolved all of our children's dependencies, - // redefine our SUBDIRS and SUBTREE variables to put things in the - // right order. - if (_scope != (PPScope *)NULL) { - _scope->define_variable("SUBDIRS", get_child_dirnames()); - _scope->define_variable("SUBTREE", get_complete_subtree()); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::compute_depends_index -// Access: Private -// Description: Computes the dependency score for a particular -// directory. See resolve_dependencies(). -//////////////////////////////////////////////////////////////////// -bool PPDirectory:: -compute_depends_index() { - if (_depends_index != 0) { - return true; - } - - if (_i_depend_on.empty()) { - _depends_index = 1; - return true; - } - - _computing_depends_index = true; - int max_index = 0; - - Depends::iterator di; - for (di = _i_depend_on.begin(); di != _i_depend_on.end(); ++di) { - if ((*di)->_computing_depends_index) { - // Oops, we have a cycle! - cerr << "Cycle detected in inter-directory dependencies!\n" - << _dirname << " depends on " << (*di)->_dirname << "\n"; - return false; - } - - if (!(*di)->compute_depends_index()) { - // Keep reporting the cycle as we unroll the recursion. - cerr << _dirname << " depends on " << (*di)->_dirname << "\n"; - return false; - } - - max_index = max(max_index, (*di)->_depends_index); - } - - _computing_depends_index = false; - _depends_index = max_index + 1; - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::read_file_dependencies -// Access: Private -// Description: Before processing the source files, makes a pass and -// reads in all of the dependency cache files so we'll -// have a heads-up on which files depend on the others. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -read_file_dependencies(const string &cache_filename) { - // Open up the dependency cache file in the directory. - Filename cache_pathname(get_fullpath(), cache_filename); - cache_pathname.set_text(); - ifstream in; - - // Does the cache file exist, and is it recent enough? We don't - // trust old cache files on principle. - - string os_specific = cache_pathname.to_os_specific(); - time_t now = time(NULL); - -#ifdef WIN32_VC - struct _stat this_buf; - bool this_exists = false; - - if (_stat(os_specific.c_str(), &this_buf) == 0) { - this_exists = true; - } -#else // WIN32_VC - struct stat this_buf; - bool this_exists = false; - - if (stat(os_specific.c_str(), &this_buf) == 0) { - this_exists = true; - } -#endif - - if (!this_exists) { - // The cache file doesn't exist. That's OK. - if (verbose) { - cerr << "No cache file: \"" << cache_pathname << "\"\n"; - } - - } else if (this_buf.st_mtime < now - 60 * max_cache_minutes) { - // It exists, but it's too old. - if (verbose) { - cerr << "Cache file too old: \"" << cache_pathname << "\"\n"; - } - - } else { - // It exists and is new enough; use it. - if (!cache_pathname.open_read(in)) { - cerr << "Couldn't read \"" << cache_pathname << "\"\n"; - - } else { - if (verbose) { - cerr << "Loading cache \"" << cache_pathname << "\"\n"; - } - - bool okcache = true; - - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - vector words; - tokenize_whitespace(line, words); - if (words.size() >= 2) { - PPDependableFile *file = get_dependable_file(words[0], false); - if (!file->update_from_cache(words)) { - // Hey, we asked for an invalid or absent file. Phooey. - // Invalidate the cache, and also make sure that this - // particular file (which maybe doesn't even exist) isn't - // mentioned in the cache file any more. - Dependables::iterator di; - di = _dependables.find(words[0]); - if (di != _dependables.end()) { - _dependables.erase(di); - } - - okcache = false; - break; - } - } - getline(in, line); - } - - if (!okcache) { - if (verbose) { - cerr << "Cache \"" << cache_pathname << "\" is stale.\n"; - } - Dependables::iterator di; - for (di = _dependables.begin(); di != _dependables.end(); ++di) { - (*di).second->clear_cache(); - } - } - } - } - - Children::iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - (*ci)->read_file_dependencies(cache_filename); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::update_file_dependencies -// Access: Private -// Description: After all source processing has completed, makes one -// more pass through the directory hierarchy and writes -// out the inter-file dependency cache. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -update_file_dependencies(const string &cache_filename) { - if (dry_run) { - // If this is just a dry run, just report circularities. - Dependables::const_iterator di; - for (di = _dependables.begin(); di != _dependables.end(); ++di) { - PPDependableFile *file = (*di).second; - if (file->was_examined()) { - if (file->is_circularity()) { - cerr << "Warning: circular #include directives:\n" - << " " << file->get_circularity() << "\n"; - } - } - } - - } else { - // Open up the dependency cache file in the directory. - Filename cache_pathname(get_fullpath(), cache_filename); - cache_pathname.set_text(); - cache_pathname.unlink(); - - // If we have no files, don't bother writing the cache. - bool wrote_anything = false; - if (!_dependables.empty()) { - ofstream out; - if (!cache_pathname.open_write(out)) { - cerr << "Cannot update cache dependency file " << cache_pathname << "\n"; - return; - } - - if (verbose) { - cerr << "Rewriting cache " << cache_pathname << "\n"; - } - - // Walk through our list of dependable files, writing them out the - // the cache file. - bool external_tree = (_tree->get_main_tree() != _tree); - Dependables::const_iterator di; - for (di = _dependables.begin(); di != _dependables.end(); ++di) { - PPDependableFile *file = (*di).second; - if (file->was_examined() || (external_tree && file->was_cached())) { - if (file->is_circularity()) { - cerr << "Warning: circular #include directives:\n" - << " " << file->get_circularity() << "\n"; - } - file->write_cache(out); - wrote_anything = true; - } - } - - out.close(); - } - - if (!wrote_anything) { - // Well, if we didn't write anything, remove the cache file - // after all. - cache_pathname.unlink(); - } - } - - Children::iterator ci; - for (ci = _children.begin(); ci != _children.end(); ++ci) { - (*ci)->update_file_dependencies(cache_filename); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_complete_i_depend_on -// Access: Private -// Description: Gets the transitive closure of i_depend_on. This -// fills the given set (which must have been empty -// before this call) with the complete set of all -// directories this directory depends on, directly or -// indirectly. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -get_complete_i_depend_on(Depends &dep) const { - Depends::const_iterator di; - for (di = _i_depend_on.begin(); di != _i_depend_on.end(); ++di) { - PPDirectory *dir = (*di); - bool inserted = dep.insert(dir).second; - if (inserted) { - dir->get_complete_i_depend_on(dep); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::get_complete_depends_on_me -// Access: Private -// Description: Gets the transitive closure of depends_on_me. This -// fills the given set (which must have been empty -// before this call) with the complete set of all -// directories this that depend on this directory, -// directly or indirectly. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -get_complete_depends_on_me(Depends &dep) const { - Depends::const_iterator di; - for (di = _depends_on_me.begin(); di != _depends_on_me.end(); ++di) { - PPDirectory *dir = (*di); - bool inserted = dep.insert(dir).second; - if (inserted) { - dir->get_complete_depends_on_me(dep); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectory::show_directories -// Access: Private -// Description: Writes a set of dependency directory names to -// standard error. The output begins with a newline. -//////////////////////////////////////////////////////////////////// -void PPDirectory:: -show_directories(const PPDirectory::Depends &dep) const { - // Copy the set into a vector, so we can sort it into a nice order - // for the user's pleasure. - vector dirs; - copy(dep.begin(), dep.end(), - back_insert_iterator >(dirs)); - - sort(dirs.begin(), dirs.end(), SortDirectoriesByDependencyAndName()); - - static const int max_col = 72; - int col = max_col; - vector::const_iterator di; - for (di = dirs.begin(); di != dirs.end(); ++di) { - const string &dirname = (*di)->_dirname; - col += dirname.length() + 1; - if (col >= max_col) { - col = dirname.length() + 2; - cerr << "\n " << dirname; - } else { - cerr << " " << dirname; - } - } - cerr << "\n"; -} diff --git a/ppremake/ppDirectory.h b/ppremake/ppDirectory.h deleted file mode 100644 index fc4033cc79..0000000000 --- a/ppremake/ppDirectory.h +++ /dev/null @@ -1,97 +0,0 @@ -// Filename: ppDirectory.h -// Created by: drose (28Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPDIRECTORY_H -#define PPDIRECTORY_H - -#include "ppremake.h" - -#include -#include -#include - -class PPCommandFile; -class PPScope; -class PPNamedScopes; -class PPDirectoryTree; -class PPDependableFile; - -/////////////////////////////////////////////////////////////////// -// Class : PPDirectory -// Description : Represents a single directory in the source -// hierarchy. Each PPDirectory object is one-to-one -// associated with a PPCommandFile object, that -// corresponds to the source file found within this -// directory. -//////////////////////////////////////////////////////////////////// -class PPDirectory { -public: - PPDirectory(PPDirectoryTree *tree); - PPDirectory(const string &dirname, PPDirectory *parent); - ~PPDirectory(); - - PPDirectoryTree *get_tree() const; - int count_source_files() const; - - const string &get_dirname() const; - int get_depends_index() const; - string get_path() const; - string get_fullpath() const; - string get_rel_to(const PPDirectory *other) const; - - PPCommandFile *get_source() const; - - int get_num_children() const; - PPDirectory *get_child(int n) const; - - string get_child_dirnames() const; - string get_complete_subtree() const; - - PPDependableFile *get_dependable_file(const string &filename, - bool is_header); - - void report_depends() const; - void report_reverse_depends() const; - -private: - typedef set Depends; - - bool r_scan(const string &prefix); - bool scan_extra_depends(const string &cache_filename); - bool read_source_file(const string &prefix, PPNamedScopes *named_scopes); - bool read_depends_file(PPNamedScopes *named_scopes); - bool resolve_dependencies(); - bool compute_depends_index(); - void read_file_dependencies(const string &cache_filename); - void update_file_dependencies(const string &cache_filename); - - void get_complete_i_depend_on(Depends &dep) const; - void get_complete_depends_on_me(Depends &dep) const; - void show_directories(const Depends &dep) const; - - string _dirname; - PPScope *_scope; - PPCommandFile *_source; - PPDirectory *_parent; - PPDirectoryTree *_tree; - typedef vector Children; - Children _children; - int _depth; - - Depends _i_depend_on; - Depends _depends_on_me; - int _depends_index; - bool _computing_depends_index; - - typedef map Dependables; - Dependables _dependables; - - friend class PPDirectoryTree; -}; - -extern PPDirectory *current_output_directory; - -#endif - diff --git a/ppremake/ppDirectoryTree.cxx b/ppremake/ppDirectoryTree.cxx deleted file mode 100644 index 2b7aa5efce..0000000000 --- a/ppremake/ppDirectoryTree.cxx +++ /dev/null @@ -1,316 +0,0 @@ -// Filename: ppDirectoryTree.cxx -// Created by: drose (28Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppDirectoryTree.h" -#include "ppDirectory.h" -#include "ppDependableFile.h" -#include "tokenize.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPDirectoryTree:: -PPDirectoryTree(PPDirectoryTree *main_tree) { - if (main_tree == NULL) { - _main_tree = this; - } else { - _main_tree = main_tree; - } - - _root = new PPDirectory(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPDirectoryTree:: -~PPDirectoryTree() { - delete _root; - - RelatedTrees::iterator ri; - for (ri = _related_trees.begin(); ri != _related_trees.end(); ++ri) { - delete (*ri); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::get_main_tree -// Access: Public -// Description: Returns the PPDirectoryTree that represents the -// actual source hierarchy. If the return value is -// something other than this, it indicates that this -// tree is an external dependable tree. -//////////////////////////////////////////////////////////////////// -PPDirectoryTree *PPDirectoryTree:: -get_main_tree() { - return _main_tree; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::set_fullpath -// Access: Public -// Description: Indicates the full path to the root of this -// particular tree. -//////////////////////////////////////////////////////////////////// -void PPDirectoryTree:: -set_fullpath(const string &fullpath) { - _fullpath = fullpath; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::scan_source -// Access: Public -// Description: Reads in the complete hierarchy of source files, -// beginning at the current directory. -//////////////////////////////////////////////////////////////////// -bool PPDirectoryTree:: -scan_source(PPNamedScopes *named_scopes) { - if (!_root->r_scan("")) { - return false; - } - - if (!_root->read_source_file("", named_scopes)) { - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::scan_depends -// Access: Public -// Description: Reads in the depends file for each source file, and -// then sorts the files into dependency order. -//////////////////////////////////////////////////////////////////// -bool PPDirectoryTree:: -scan_depends(PPNamedScopes *named_scopes) { - if (!_root->read_depends_file(named_scopes)) { - return false; - } - - if (!_root->resolve_dependencies()) { - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::scan_extra_depends -// Access: Public -// Description: Accepts the value of DEPENDABLE_HEADER_DIRS, which -// was presumably set by the various Config.pp and/or -// Depends.pp scripts that were read in, and treats each -// named filename there as the name of a directory that -// contains header files in a separate but related tree, -// for which we also need to generate dependency rules -// in this tree. -//////////////////////////////////////////////////////////////////// -bool PPDirectoryTree:: -scan_extra_depends(const string &dependable_header_dirs, - const string &cache_filename) { - bool okflag = true; - - vector dirnames; - tokenize_whitespace(dependable_header_dirs, dirnames); - - // Sort dirnames and remove duplicates. - sort(dirnames.begin(), dirnames.end()); - dirnames.erase(unique(dirnames.begin(), dirnames.end()), dirnames.end()); - - vector::const_iterator ni; - for (ni = dirnames.begin(); ni != dirnames.end(); ++ni) { - string dirname = (*ni); - - if (dirname[0] != '/') { - // Insist that the external dirname be a full pathname. - dirname = _fullpath + "/" + dirname; - } - - // Now we need to make up a different tree for each external - // dirname. - PPDirectoryTree *tree = new PPDirectoryTree(this); - tree->set_fullpath(dirname); - _related_trees.push_back(tree); - - if (!tree->get_root()->scan_extra_depends(cache_filename)) { - okflag = false; - } - } - - return okflag; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::count_source_files -// Access: Public -// Description: Returns the number of directories within the tree -// that actually have a Sources.pp file that was read. -//////////////////////////////////////////////////////////////////// -int PPDirectoryTree:: -count_source_files() const { - return _root->count_source_files(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::get_root -// Access: Public -// Description: Returns the root directory of the tree. -//////////////////////////////////////////////////////////////////// -PPDirectory *PPDirectoryTree:: -get_root() const { - return _root; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::get_fullpath -// Access: Public -// Description: Returns the full path to the root of the tree. -//////////////////////////////////////////////////////////////////// -const string &PPDirectoryTree:: -get_fullpath() const { - return _fullpath; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::get_complete_tree -// Access: Public -// Description: Returns a single string listing the relative path -// from the source root to each source directory in the -// tree, delimited by spaces. -//////////////////////////////////////////////////////////////////// -string PPDirectoryTree:: -get_complete_tree() const { - return _root->get_complete_subtree(); -} - - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::find_dirname -// Access: Public -// Description: Searches for the a source directory with the -// matching dirname. This is just the name of the -// directory itself, not the relative path to the -// directory. -//////////////////////////////////////////////////////////////////// -PPDirectory *PPDirectoryTree:: -find_dirname(const string &dirname) const { - Dirnames::const_iterator di; - di = _dirnames.find(dirname); - if (di != _dirnames.end()) { - return (*di).second; - } - - // No such dirname; too bad. - return (PPDirectory *)NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::find_dependable_file -// Access: Public -// Description: Returns a PPDependableFile object corresponding to -// the named filename, searching all of the known source -// subdirectories. This can only find files marked by a -// previous call to get_dependable_file() with is_header -// set to true. Unlike -// get_dependable_file_by_pathname() or -// PPDirectory::get_dependable_file(), this does not -// create an entry if it does not exist; instead, it -// returns NULL if no matching file can be found. -//////////////////////////////////////////////////////////////////// -PPDependableFile *PPDirectoryTree:: -find_dependable_file(const string &filename) const { - Dependables::const_iterator di; - di = _dependables.find(filename); - if (di != _dependables.end()) { - return (*di).second; - } - - return (PPDependableFile *)NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::get_dependable_file_by_pathname -// Access: Public -// Description: Given a dirname/filename for a particular dependable -// filename, return (or create and return) the -// corresponding PPDirectoryTree. This is different -// from find_dependable_file() in that an explicit -// dirname is given, and the entry will be created if -// it does not already exist. However, if the directory -// name does not exist, nothing is created, and NULL is -// returned. -//////////////////////////////////////////////////////////////////// -PPDependableFile *PPDirectoryTree:: -get_dependable_file_by_dirpath(const string &dirpath, bool is_header) { - size_t slash = dirpath.rfind('/'); - if (slash == string::npos) { - // No valid directory name. - return (PPDependableFile *)NULL; - } - - string dirname = dirpath.substr(0, slash); - string filename = dirpath.substr(slash + 1); - - if (!dirname.empty() && dirname[0] == '+') { - // "+dirname/filename" means to look first for the file as an - // external file, meaning it has no dirname. - dirname = dirname.substr(1); - PPDependableFile *result = get_main_tree()->find_dependable_file(filename); - if (result != (PPDependableFile *)NULL) { - return result; - } - } - - PPDirectory *dir = find_dirname(dirname); - if (dir == (PPDirectory *)NULL) { - // No valid directory name. - return (PPDependableFile *)NULL; - } - - return dir->get_dependable_file(filename, is_header); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::read_file_dependencies -// Access: Public -// Description: Before processing the source files, makes a pass and -// reads in all of the dependency cache files so we'll -// have a heads-up on which files depend on the others. -//////////////////////////////////////////////////////////////////// -void PPDirectoryTree:: -read_file_dependencies(const string &cache_filename) { - _root->read_file_dependencies(cache_filename); - - RelatedTrees::iterator ri; - for (ri = _related_trees.begin(); ri != _related_trees.end(); ++ri) { - (*ri)->read_file_dependencies(cache_filename); - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: PPDirectoryTree::update_file_dependencies -// Access: Public -// Description: After all source processing has completed, makes one -// more pass through the directory hierarchy and writes -// out the inter-file dependency cache. -//////////////////////////////////////////////////////////////////// -void PPDirectoryTree:: -update_file_dependencies(const string &cache_filename) { - _root->update_file_dependencies(cache_filename); - - RelatedTrees::iterator ri; - for (ri = _related_trees.begin(); ri != _related_trees.end(); ++ri) { - (*ri)->update_file_dependencies(cache_filename); - } -} - diff --git a/ppremake/ppDirectoryTree.h b/ppremake/ppDirectoryTree.h deleted file mode 100644 index c98e5e20d2..0000000000 --- a/ppremake/ppDirectoryTree.h +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: ppDirectoryTree.h -// Created by: drose (15Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPDIRECTORYTREE_H -#define PPDIRECTORYTREE_H - -#include "ppremake.h" - -#include -#include - -class PPNamedScopes; -class PPDirectory; -class PPDependableFile; - -/////////////////////////////////////////////////////////////////// -// Class : PPDirectoryTree -// Description : Stores the entire directory hierarchy relationship of the -// source tree. This is the root of a tree of -// PPDirectory objects, each of which corresponds to a -// particular directory. -//////////////////////////////////////////////////////////////////// -class PPDirectoryTree { -public: - PPDirectoryTree(PPDirectoryTree *main_tree = NULL); - ~PPDirectoryTree(); - - PPDirectoryTree *get_main_tree(); - - void set_fullpath(const string &fullpath); - bool scan_source(PPNamedScopes *named_scopes); - bool scan_depends(PPNamedScopes *named_scopes); - bool scan_extra_depends(const string &dependable_header_dirs, - const string &cache_filename); - - int count_source_files() const; - PPDirectory *get_root() const; - const string &get_fullpath() const; - - string get_complete_tree() const; - - PPDirectory *find_dirname(const string &dirname) const; - - PPDependableFile *find_dependable_file(const string &filename) const; - PPDependableFile *get_dependable_file_by_dirpath(const string &dirpath, - bool is_header); - - void read_file_dependencies(const string &cache_filename); - void update_file_dependencies(const string &cache_filename); - -private: - PPDirectoryTree *_main_tree; - PPDirectory *_root; - string _fullpath; - - typedef map Dirnames; - Dirnames _dirnames; - - typedef map Dependables; - Dependables _dependables; - - typedef vector RelatedTrees; - RelatedTrees _related_trees; - - friend class PPDirectory; -}; - -#endif diff --git a/ppremake/ppFilenamePattern.cxx b/ppremake/ppFilenamePattern.cxx deleted file mode 100644 index 4743d49472..0000000000 --- a/ppremake/ppFilenamePattern.cxx +++ /dev/null @@ -1,190 +0,0 @@ -// Filename: ppFilenamePattern.cxx -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppFilenamePattern.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPFilenamePattern:: -PPFilenamePattern(const string &pattern) { - size_t pct = pattern.find(PATTERN_WILDCARD); - _has_wildcard = (pct != string::npos); - - if (_has_wildcard) { - _prefix = pattern.substr(0, pct); - _suffix = pattern.substr(pct + 1); - } else { - _prefix = pattern; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPFilenamePattern:: -PPFilenamePattern(const PPFilenamePattern ©) : - _has_wildcard(copy._has_wildcard), - _prefix(copy._prefix), - _suffix(copy._suffix) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void PPFilenamePattern:: -operator = (const PPFilenamePattern ©) { - _has_wildcard = copy._has_wildcard; - _prefix = copy._prefix; - _suffix = copy._suffix; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::has_wildcard -// Access: Public -// Description: Returns true if the filename pattern contained a -// wildcard (and hence represents a pattern and not -// just a single particular filename), or false if it -// did not. -//////////////////////////////////////////////////////////////////// -bool PPFilenamePattern:: -has_wildcard() const { - return _has_wildcard; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::get_pattern -// Access: Public -// Description: Returns the filename pattern. -//////////////////////////////////////////////////////////////////// -string PPFilenamePattern:: -get_pattern() const { - if (_has_wildcard) { - return _prefix + PATTERN_WILDCARD + _suffix; - } else { - return _prefix; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::get_prefix -// Access: Public -// Description: Returns the part of the filename pattern before the -// wildcard. If the filename did not contain a -// wildcard, this returns the entire filename. -//////////////////////////////////////////////////////////////////// -const string &PPFilenamePattern:: -get_prefix() const { - return _prefix; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::get_suffix -// Access: Public -// Description: Returns the part of the filename pattern after the -// wildcard. If the filename did not contain a -// wildcard, this returns the empty string. -//////////////////////////////////////////////////////////////////// -const string &PPFilenamePattern:: -get_suffix() const { - return _suffix; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::matches_filename -// Access: Public -// Description: Returns true if the given filename matches the -// pattern, false otherwise. -//////////////////////////////////////////////////////////////////// -bool PPFilenamePattern:: -matches(const string &filename) const { - if (_has_wildcard) { - return - (filename.length() >= _prefix.length() + _suffix.length()) && - (filename.substr(0, _prefix.length()) == _prefix) && - (filename.substr(filename.length() - _suffix.length()) == _suffix); - - } else { - return (filename == _prefix); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::extract_body -// Access: Public -// Description: If the filename matches the pattern -// (e.g. matches_filename() returns true), return the -// portion of the filename that corresponds to the -// wildcard in the pattern: the part of the filename -// between the prefix and the suffix. If the filename -// does not match the pattern, or the pattern does not -// contain a wildcard, returns empty string. -//////////////////////////////////////////////////////////////////// -string PPFilenamePattern:: -extract_body(const string &filename) const { - if (_has_wildcard) { - size_t outside_length = _prefix.length() + _suffix.length(); - if ((filename.length() >= outside_length) && - (filename.substr(0, _prefix.length()) == _prefix) && - (filename.substr(filename.length() - _suffix.length()) == _suffix)) { - return filename.substr(_prefix.length(), filename.length() - outside_length); - } - } - - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPFilenamePattern::transform_filename -// Access: Public -// Description: Transforms a filename by replacing the parts of the -// filename described in the pattern transform_from with -// the corresponding parts of the filename described in -// this pattern. If the filename does not match -// transform_from, returns the untransformed filename. -// -// It is an error to call this unless both this pattern -// and transform_from include a wildcard. -//////////////////////////////////////////////////////////////////// -string PPFilenamePattern:: -transform(const string &filename, - const PPFilenamePattern &transform_from) const { - assert(transform_from._has_wildcard); - - if (transform_from.matches(filename)) { - if (!_has_wildcard) { - return _prefix; - } else { - string body = transform_from.extract_body(filename); - string result = _prefix + body; - - // Now the suffix might contain more % characters. Replace all - // of them. - size_t p = 0; - size_t pct = _suffix.find(PATTERN_WILDCARD, p); - while (pct != string::npos) { - result += _suffix.substr(p, pct - p); - result += body; - p = pct + 1; - pct = _suffix.find(PATTERN_WILDCARD, p); - } - result += _suffix.substr(p); - - return result; - } - } - - return filename; -} - diff --git a/ppremake/ppFilenamePattern.h b/ppremake/ppFilenamePattern.h deleted file mode 100644 index d240e51a55..0000000000 --- a/ppremake/ppFilenamePattern.h +++ /dev/null @@ -1,45 +0,0 @@ -// Filename: ppFilenamePattern.h -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPFILENAMEPATTERN_H -#define PPFILENAMEPATTERN_H - -#include "ppremake.h" - -/////////////////////////////////////////////////////////////////// -// Class : PPFilenamePattern -// Description : This is a string that represents a filename, or a -// family of filenames, using the make convention that a -// wildcard sign (PATTERN_WILDCARD, typically '%') in -// the filename represents any sequence of characters. -//////////////////////////////////////////////////////////////////// -class PPFilenamePattern { -public: - PPFilenamePattern(const string &pattern); - PPFilenamePattern(const PPFilenamePattern ©); - void operator = (const PPFilenamePattern ©); - - bool has_wildcard() const; - string get_pattern() const; - const string &get_prefix() const; - const string &get_suffix() const; - - bool matches(const string &filename) const; - string extract_body(const string &filename) const; - string transform(const string &filename, - const PPFilenamePattern &transform_from) const; - -private: - bool _has_wildcard; - string _prefix; - string _suffix; -}; - -inline ostream & -operator << (ostream &out, const PPFilenamePattern &pattern) { - return out << pattern.get_pattern(); -} - -#endif diff --git a/ppremake/ppMain.cxx b/ppremake/ppMain.cxx deleted file mode 100644 index c19772e4f9..0000000000 --- a/ppremake/ppMain.cxx +++ /dev/null @@ -1,421 +0,0 @@ -// Filename: ppMain.cxx -// Created by: drose (28Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppMain.h" -#include "ppScope.h" -#include "ppCommandFile.h" -#include "ppDirectory.h" -#include "tokenize.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include -#include // for perror - -#ifdef WIN32_VC -#include // Windows requires this for getcwd() -#define getcwd _getcwd -#endif // WIN32_VC - -Filename PPMain::_root; - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPMain:: -PPMain(PPScope *global_scope) { - _global_scope = global_scope; - PPScope::push_scope(_global_scope); - - _def_scope = (PPScope *)NULL; - _defs = (PPCommandFile *)NULL; - - // save current working directory name, so that "ppremake ." can map - // to the current directory. - Filename dirpath = get_cwd(); - _original_working_dir = dirpath.get_basename(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPMain:: -~PPMain() { - if (_def_scope != (PPScope *)NULL) { - delete _def_scope; - } - if (_defs != (PPCommandFile *)NULL) { - delete _defs; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::read_source -// Access: Public -// Description: Reads the directory hierarchy of Sources.pp files, at -// the indicated directory and below. -//////////////////////////////////////////////////////////////////// -bool PPMain:: -read_source(const string &root) { - // First, find the top of the source tree, as indicated by the - // presence of a Package.pp file. - Filename trydir = root; - - Filename package_file(trydir, PACKAGE_FILENAME); - bool any_source_files_found = false; - - while (!package_file.exists()) { - // We continue to walk up directories as long as we see a source - // file in each directory. When we stop seeing source files, we - // stop walking upstairs. - Filename source_file(trydir, SOURCE_FILENAME); - if (!source_file.exists()) { - if (!any_source_files_found) { - // If we never saw a single Sources.pp file, complain about that. - cerr << "Could not find ppremake source file " << SOURCE_FILENAME - << ".\n\n" - << "This file should be present at each level of the source directory tree;\n" - << "it defines how each directory should be processed by ppremake.\n\n"; - } else { - // If we found at least one Sources.pp file, but didn't find - // the Package.pp file at the top of the tree, complain about - // *that*. - cerr << "Could not find ppremake package file " << PACKAGE_FILENAME - << ".\n\n" - << "This file should be present in the top of the source directory tree;\n" - << "it defines implementation-specific variables to control the output\n" - << "of ppremake, as well as pointing out the installed location of\n" - << "important ppremake config files.\n\n"; - } - return false; - } - any_source_files_found = true; - trydir = Filename(trydir, ".."); - package_file = Filename(trydir, PACKAGE_FILENAME); - } - - // Now cd to the source root and get the actual path. - string osdir; -#ifdef HAVE_CYGWIN - osdir = trydir; -#else - osdir = trydir.to_os_specific(); -#endif - if (chdir(osdir.c_str()) < 0) { - perror("chdir"); - return false; - } - - _root = get_cwd(); - _tree.set_fullpath(_root); - cerr << "Root is " << _root << "\n"; - - _def_scope = new PPScope(&_named_scopes); - _def_scope->define_variable("PACKAGEFILE", package_file); - _def_scope->define_variable("TOPDIR", _root); - _def_scope->define_variable("DEPENDABLE_HEADER_DIRS", ""); - _defs = new PPCommandFile(_def_scope); - - if (!_defs->read_file(PACKAGE_FILENAME)) { - return false; - } - - // Now check the *_PLATFORM variables that System.pp was supposed to - // set. - if (!trim_blanks(_def_scope->expand_string("$[UNIX_PLATFORM]")).empty()) { - unix_platform = true; - } - if (!trim_blanks(_def_scope->expand_string("$[WINDOWS_PLATFORM]")).empty()) { - windows_platform = true; - } - - PPScope::push_scope(_def_scope); - - if (!_tree.scan_source(&_named_scopes)) { - return false; - } - - _def_scope->define_variable("TREE", _tree.get_complete_tree()); - - if (_tree.count_source_files() == 0) { - cerr << "Could not find any source definition files named " << SOURCE_FILENAME - << ".\n\n" - << "A file by this name should be present in each directory of the source\n" - << "hierarchy; it defines the source files and targets that should be\n" - << "built in each directory, as well as the relationships between the\n" - << "directories.\n\n"; - return false; - } - - cerr << "Read " << _tree.count_source_files() << " " << SOURCE_FILENAME - << " files.\n"; - - if (!read_global_file()) { - return false; - } - - if (!_tree.scan_depends(&_named_scopes)) { - return false; - } - - string dependable_header_dirs = - _def_scope->expand_variable("DEPENDABLE_HEADER_DIRS"); - string cache_filename = - _def_scope->expand_variable("DEPENDENCY_CACHE_FILENAME"); - - if (!_tree.scan_extra_depends(dependable_header_dirs, cache_filename)) { - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::process_all -// Access: Public -// Description: Does all the processing on all known directories. -// See process(). -//////////////////////////////////////////////////////////////////// -bool PPMain:: -process_all() { - string cache_filename = _def_scope->expand_variable("DEPENDENCY_CACHE_FILENAME"); - - if (cache_filename.empty()) { - cerr << "Warning: no definition given for $[DEPENDENCY_CACHE_FILENAME].\n"; - } else { - _tree.read_file_dependencies(cache_filename); - } - - if (!r_process_all(_tree.get_root())) { - return false; - } - - if (!cache_filename.empty()) { - _tree.update_file_dependencies(cache_filename); - } - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::process -// Access: Public -// Description: Does the processing associated with the source file -// in the indicated subdirectory name. This involves -// reading in the template file and generating whatever -// output the template file indicates. -//////////////////////////////////////////////////////////////////// -bool PPMain:: -process(string dirname) { - string cache_filename = _def_scope->expand_variable("DEPENDENCY_CACHE_FILENAME"); - if (cache_filename.empty()) { - cerr << "Warning: no definition given for $[DEPENDENCY_CACHE_FILENAME].\n"; - } else { - _tree.read_file_dependencies(cache_filename); - } - - if (dirname == ".") { - dirname = _original_working_dir; - } - - PPDirectory *dir = _tree.find_dirname(dirname); - if (dir == (PPDirectory *)NULL) { - cerr << "Unknown directory: " << dirname << "\n"; - return false; - } - - if (dir->get_source() == (PPCommandFile *)NULL) { - cerr << "No source file in " << dirname << "\n"; - return false; - } - - if (!p_process(dir)) { - return false; - } - - if (!cache_filename.empty()) { - _tree.update_file_dependencies(cache_filename); - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::report_depends -// Access: Public -// Description: Reports all the directories that the named directory -// depends on. -//////////////////////////////////////////////////////////////////// -void PPMain:: -report_depends(const string &dirname) const { - PPDirectory *dir = _tree.find_dirname(dirname); - if (dir == (PPDirectory *)NULL) { - cerr << "Unknown directory: " << dirname << "\n"; - return; - } - - dir->report_depends(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::report_reverse_depends -// Access: Public -// Description: Reports all the directories that depend on (need) the -// named directory. -//////////////////////////////////////////////////////////////////// -void PPMain:: -report_reverse_depends(const string &dirname) const { - PPDirectory *dir = _tree.find_dirname(dirname); - if (dir == (PPDirectory *)NULL) { - cerr << "Unknown directory: " << dirname << "\n"; - return; - } - - dir->report_reverse_depends(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::get_root -// Access: Public, Static -// Description: Returns the full path to the root directory of the -// source hierarchy; this is the directory in which the -// runs most of the time. -//////////////////////////////////////////////////////////////////// -string PPMain:: -get_root() { - return _root.get_fullpath(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::chdir_root -// Access: Public, Static -// Description: Changes the current directory to the root directory -// of the source hierarchy. This should be executed -// after a temporary change to another directory, to -// restore the current directory to a known state. -//////////////////////////////////////////////////////////////////// -void PPMain:: -chdir_root() { - if (chdir(_root.c_str()) < 0) { - perror("chdir"); - // This is a real error! We can't get back to our starting - // directory! - cerr << "Error! Source directory is invalid!\n"; - exit(1); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::r_process_all -// Access: Private -// Description: The recursive implementation of process_all(). -//////////////////////////////////////////////////////////////////// -bool PPMain:: -r_process_all(PPDirectory *dir) { - if (dir->get_source() != (PPCommandFile *)NULL) { - if (!p_process(dir)) { - return false; - } - } - - int num_children = dir->get_num_children(); - for (int i = 0; i < num_children; i++) { - if (!r_process_all(dir->get_child(i))) { - return false; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::p_process -// Access: Private -// Description: The private implementation of process(). -//////////////////////////////////////////////////////////////////// -bool PPMain:: -p_process(PPDirectory *dir) { - current_output_directory = dir; - _named_scopes.set_current(dir->get_dirname()); - PPCommandFile *source = dir->get_source(); - assert(source != (PPCommandFile *)NULL); - - PPScope *scope = source->get_scope(); - - string template_filename = scope->expand_variable("TEMPLATE_FILE"); - if (template_filename.empty()) { - cerr << "No definition given for $[TEMPLATE_FILE], cannot process.\n"; - return false; - } - - PPCommandFile template_file(scope); - if (!template_file.read_file(template_filename)) { - cerr << "Error reading template file " << template_filename << ".\n"; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::read_global_file -// Access: Private -// Description: Reads in the Global.pp file after all sources files -// have been read and sorted into dependency order. -//////////////////////////////////////////////////////////////////// -bool PPMain:: -read_global_file() { - assert(_def_scope != (PPScope *)NULL); - - string global_filename = _def_scope->expand_variable("GLOBAL_FILE"); - if (global_filename.empty()) { - cerr << "No definition given for $[GLOBAL_FILE], cannot process.\n"; - return false; - } - - PPCommandFile global(_def_scope); - if (!global.read_file(global_filename)) { - cerr << "Error reading global definition file " - << global_filename << ".\n"; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPMain::get_cwd -// Access: Private, Static -// Description: Calls the system getcwd(), automatically allocating a -// large enough string. -//////////////////////////////////////////////////////////////////// -Filename PPMain:: -get_cwd() { - static size_t bufsize = 1024; - static char *buffer = NULL; - - if (buffer == (char *)NULL) { - buffer = new char[bufsize]; - } - - while (getcwd(buffer, bufsize) == (char *)NULL) { - if (errno != ERANGE) { - perror("getcwd"); - return string(); - } - delete[] buffer; - bufsize = bufsize * 2; - buffer = new char[bufsize]; - assert(buffer != (char *)NULL); - } - - return Filename::from_os_specific(buffer); -} diff --git a/ppremake/ppMain.h b/ppremake/ppMain.h deleted file mode 100644 index 1f460c5dba..0000000000 --- a/ppremake/ppMain.h +++ /dev/null @@ -1,59 +0,0 @@ -// Filename: ppMain.h -// Created by: drose (28Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPMAIN_H -#define PPMAIN_H - -#include "ppremake.h" -#include "ppDirectoryTree.h" -#include "ppNamedScopes.h" -#include "filename.h" - -class PPScope; -class PPCommandFile; - -/////////////////////////////////////////////////////////////////// -// Class : PPMain -// Description : Handles the toplevel processing in this program: -// holds the tree of source files, and all the scopes, -// etc. Generally get the ball rolling. -//////////////////////////////////////////////////////////////////// -class PPMain { -public: - PPMain(PPScope *global_scope); - ~PPMain(); - - bool read_source(const string &root); - - bool process_all(); - bool process(string dirname); - - void report_depends(const string &dirname) const; - void report_reverse_depends(const string &dirname) const; - - static string get_root(); - static void chdir_root(); - -private: - bool r_process_all(PPDirectory *dir); - bool p_process(PPDirectory *dir); - bool read_global_file(); - static Filename get_cwd(); - - - PPScope *_global_scope; - PPScope *_def_scope; - PPCommandFile *_defs; - - PPDirectoryTree _tree; - PPNamedScopes _named_scopes; - PPScope *_parent_scope; - - static Filename _root; - string _original_working_dir; -}; - -#endif - diff --git a/ppremake/ppNamedScopes.cxx b/ppremake/ppNamedScopes.cxx deleted file mode 100644 index cc2e793017..0000000000 --- a/ppremake/ppNamedScopes.cxx +++ /dev/null @@ -1,173 +0,0 @@ -// Filename: ppNamedScopes.cxx -// Created by: drose (27Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppNamedScopes.h" -#include "ppScope.h" -#include "ppDirectory.h" - -#include -#include - -// An STL object to sort named scopes in order by dependency and then -// by directory name, used in sort_by_dependency(). -class SortScopesByDependencyAndName { -public: - bool operator () (PPScope *a, PPScope *b) const { - PPDirectory *da = a->get_directory(); - PPDirectory *db = b->get_directory(); - - // Scopes without associated directories appear first in the list. - bool da_is_null = (da == (PPDirectory *)NULL); - bool db_is_null = (db == (PPDirectory *)NULL); - - if (da_is_null != db_is_null) { - return da_is_null > db_is_null; - - } else if (da_is_null) { - // If two scopes have no associated directories (!) they are - // considered equivalent. - return false; - - } else { - // Otherwise, both scopes have associated directories, and we - // can properly put them in order by dependencies. - assert(da != (PPDirectory *)NULL); - assert(db != (PPDirectory *)NULL); - if (da->get_depends_index() != db->get_depends_index()) { - return da->get_depends_index() < db->get_depends_index(); - } - return da->get_dirname() < db->get_dirname(); - } - } -}; - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPNamedScopes:: -PPNamedScopes() { -} - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPNamedScopes:: -~PPNamedScopes() { -} - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::make_scope -// Access: Public -// Description: Creates a new scope in the current directory name -// with the indicated scope name. -//////////////////////////////////////////////////////////////////// -PPScope *PPNamedScopes:: -make_scope(const string &name) { - PPScope *scope = new PPScope(this); - _directories[_current][name].push_back(scope); - return scope; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::get_scopes -// Access: Public -// Description: Returns a list of all the named scopes matching the -// given scope name. The scope name may be of the form -// "dirname/scopename", in which case the dirname may be -// another directory name, or "." or "*". If the -// dirname is ".", it is the same as the current -// directory name; if it is "*", it represents all -// directory names. If omitted, the current directory -// name is implied. -// -// It is the responsibility of the user to ensure that -// scopes is empty before calling this function; this -// will append to the existing vector without first -// clearing it. -//////////////////////////////////////////////////////////////////// -void PPNamedScopes:: -get_scopes(const string &name, Scopes &scopes) const { - string dirname = _current; - string scopename = name; - - size_t slash = name.find(SCOPE_DIRNAME_SEPARATOR); - if (slash != string::npos) { - dirname = name.substr(0, slash); - scopename = name.substr(slash + 1); - if (dirname == SCOPE_DIRNAME_CURRENT) { - dirname = _current; - } - } - - Directories::const_iterator di; - - if (dirname == SCOPE_DIRNAME_WILDCARD) { - for (di = _directories.begin(); di != _directories.end(); ++di) { - p_get_scopes((*di).second, scopename, scopes); - } - - } else { - di = _directories.find(dirname); - if (di != _directories.end()) { - p_get_scopes((*di).second, scopename, scopes); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::sort_by_dependency -// Access: Public, Static -// Description: Sorts the previously-generated list of scopes into -// order such that the later scopes depend on the -// earlier scopes. -//////////////////////////////////////////////////////////////////// -void PPNamedScopes:: -sort_by_dependency(PPNamedScopes::Scopes &scopes) { - sort(scopes.begin(), scopes.end(), SortScopesByDependencyAndName()); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::set_current -// Access: Public -// Description: Changes the currently-active directory, i.e. the -// dirname represented by ".". -//////////////////////////////////////////////////////////////////// -void PPNamedScopes:: -set_current(const string &dirname) { - _current = dirname; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPNamedScopes::p_get_scopes -// Access: Private -// Description: Adds the scopes from the given directory with the -// matching name into the returned vector. -//////////////////////////////////////////////////////////////////// -void PPNamedScopes:: -p_get_scopes(const PPNamedScopes::Named &named, const string &name, - Scopes &scopes) const { - Named::const_iterator ni; - if (name == "*") { - // Scope name "*" means all nested scopes in this directory, - // except for the empty-name scope (which is the outer scope). - for (ni = named.begin(); ni != named.end(); ++ni) { - if (!(*ni).first.empty()) { - const Scopes &s = (*ni).second; - scopes.insert(scopes.end(), s.begin(), s.end()); - } - } - - } else { - ni = named.find(name); - if (ni != named.end()) { - const Scopes &s = (*ni).second; - scopes.insert(scopes.end(), s.begin(), s.end()); - } - } -} diff --git a/ppremake/ppNamedScopes.h b/ppremake/ppNamedScopes.h deleted file mode 100644 index 0d1a4d6b39..0000000000 --- a/ppremake/ppNamedScopes.h +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: ppNamedScopes.h -// Created by: drose (27Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPNAMEDSCOPES_H -#define PPNAMEDSCOPES_H - -#include "ppremake.h" - -#include -#include - -class PPScope; - -/////////////////////////////////////////////////////////////////// -// Class : PPNamedScopes -// Description : A collection of named scopes, as defined by #begin -// .. #end sequences within a series of command files, -// each associated with the directory name of the -// command file in which it was read. -//////////////////////////////////////////////////////////////////// -class PPNamedScopes { -public: - PPNamedScopes(); - ~PPNamedScopes(); - - typedef vector Scopes; - - PPScope *make_scope(const string &name); - void get_scopes(const string &name, Scopes &scopes) const; - static void sort_by_dependency(Scopes &scopes); - - void set_current(const string &dirname); - -private: - typedef map Named; - - void p_get_scopes(const Named &named, const string &name, - Scopes &scopes) const; - - typedef map Directories; - Directories _directories; - string _current; -}; - -#endif - diff --git a/ppremake/ppScope.cxx b/ppremake/ppScope.cxx deleted file mode 100644 index 1522f2483b..0000000000 --- a/ppremake/ppScope.cxx +++ /dev/null @@ -1,3469 +0,0 @@ -// Filename: ppScope.cxx -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppremake.h" -#include "ppScope.h" -#include "ppNamedScopes.h" -#include "ppFilenamePattern.h" -#include "ppDirectory.h" -#include "ppSubroutine.h" -#include "ppCommandFile.h" -#include "ppDependableFile.h" -#include "ppMain.h" -#include "tokenize.h" -#include "filename.h" -#include "dSearchPath.h" -#include "globPattern.h" -#include "md5.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#ifdef HAVE_SYS_WAIT_H -#include -#endif - -#include -#include -#include -#include -#include // for perror() and sprintf(). -#include -#include -#include - -#ifdef WIN32_VC -#include // for GetFileAttributes() -#endif // WIN32_VC - -static const string variable_patsubst(VARIABLE_PATSUBST); - -PPScope::MapVariableDefinition PPScope::_null_map_def; - -PPScope::ScopeStack PPScope::_scope_stack; - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PPScope:: -PPScope(PPNamedScopes *named_scopes) : - _named_scopes(named_scopes) -{ - _directory = (PPDirectory *)NULL; - _parent_scope = (PPScope *)NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::get_named_scopes -// Access: Public -// Description: Returns a pointer to the PPNamedScopes collection -// associated with this scope. This pointer could be -// NULL. -//////////////////////////////////////////////////////////////////// -PPNamedScopes *PPScope:: -get_named_scopes() { - return _named_scopes; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::set_parent -// Access: Public -// Description: Sets a static parent scope to this scope. When a -// variable reference is undefined in this scope, it -// will search first up the static parent chain before -// it searches the dynamic scope stack. -//////////////////////////////////////////////////////////////////// -void PPScope:: -set_parent(PPScope *parent) { - _parent_scope = parent; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::get_parent -// Access: Public -// Description: Returns the static parent scope to this scope, if -// any, or NULL if the static parent has not been set. -// See set_parent(). -//////////////////////////////////////////////////////////////////// -PPScope *PPScope:: -get_parent() { - return _parent_scope; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::define_variable -// Access: Public -// Description: Makes a new variable definition. If the variable -// does not already exist in this scope, a new variable -// is created, possibly shadowing a variable declaration -// in some parent scope. -//////////////////////////////////////////////////////////////////// -void PPScope:: -define_variable(const string &varname, const string &definition) { - _variables[varname] = definition; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::set_variable -// Access: Public -// Description: Changes the definition of an already-existing -// variable. The variable is changed in whichever scope -// it is defined. Returns false if the variable has not -// been defined. -//////////////////////////////////////////////////////////////////// -bool PPScope:: -set_variable(const string &varname, const string &definition) { - if (p_set_variable(varname, definition)) { - return true; - } - - // Check the scopes on the stack for the variable definition. - ScopeStack::reverse_iterator si; - for (si = _scope_stack.rbegin(); si != _scope_stack.rend(); ++si) { - if ((*si)->p_set_variable(varname, definition)) { - return true; - } - } - - // If the variable isn't defined, we check the environment. - const char *env = getenv(varname.c_str()); - if (env != (const char *)NULL) { - // It is defined in the environment; thus, it is implicitly - // defined here at the global scope: the bottom of the stack. - PPScope *bottom = this; - if (!_scope_stack.empty()) { - bottom = _scope_stack.front(); - } - bottom->define_variable(varname, definition); - return true; - } - - // The variable isn't defined anywhere. Too bad. - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::define_map_variable -// Access: Public -// Description: Makes a new map variable definition. This defines a -// new variable that can be used as a function to -// retrieve variables from within a named scope, based -// on a particular key variable. -// -// In this variant of define_map_variable(), the -// definition is a string of the form -// key_varname(scope_names). -//////////////////////////////////////////////////////////////////// -void PPScope:: -define_map_variable(const string &varname, const string &definition) { - size_t p = definition.find(VARIABLE_OPEN_NESTED); - if (p != string::npos && definition[definition.length() - 1] == VARIABLE_CLOSE_NESTED) { - size_t q = definition.length() - 1; - string scope_names = definition.substr(p + 1, q - (p + 1)); - string key_varname = definition.substr(0, p); - define_map_variable(varname, key_varname, scope_names); - } else { - // No scoping; not really a map variable. - define_map_variable(varname, definition, ""); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::define_map_variable -// Access: Public -// Description: Makes a new map variable definition. This defines a -// new variable that can be used as a function to -// retrieve variables from within a named scope, based -// on a particular key variable. -//////////////////////////////////////////////////////////////////// -void PPScope:: -define_map_variable(const string &varname, const string &key_varname, - const string &scope_names) { - MapVariableDefinition &def = _map_variables[varname]; - def.clear(); - define_variable(varname, ""); - - if (_named_scopes == (PPNamedScopes *)NULL) { - return; - } - - if (key_varname.empty()) { - return; - } - - vector names; - tokenize_whitespace(scope_names, names); - - // Get all of the named scopes. - PPNamedScopes::Scopes scopes; - - vector::const_iterator ni; - for (ni = names.begin(); ni != names.end(); ++ni) { - const string &name = (*ni); - _named_scopes->get_scopes(name, scopes); - } - - if (scopes.empty()) { - return; - } - - // Now go through the scopes and build up the results. - vector results; - - PPNamedScopes::Scopes::const_iterator si; - for (si = scopes.begin(); si != scopes.end(); ++si) { - PPScope *scope = (*si); - string key_string = scope->expand_variable(key_varname); - vector keys; - tokenize_whitespace(key_string, keys); - - if (!keys.empty()) { - vector::const_iterator ki; - results.insert(results.end(), keys.begin(), keys.end()); - for (ki = keys.begin(); ki != keys.end(); ++ki) { - def[*ki] = scope; - } - } - } - - // Also define a traditional variable along with the map variable. - define_variable(varname, repaste(results, " ")); -} - - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::add_to_map_variable -// Access: Public -// Description: Adds a new key/scope pair to a previous map variable -// definition. -//////////////////////////////////////////////////////////////////// -void PPScope:: -add_to_map_variable(const string &varname, const string &key, - PPScope *scope) { - MapVariableDefinition &def = find_map_variable(varname); - if (&def == &_null_map_def) { - cerr << "Warning: undefined map variable: " << varname << "\n"; - return; - } - - def[key] = scope; - - // We need to do all this work to define the traditional expansion. - // Maybe not a great idea. - vector results; - MapVariableDefinition::const_iterator di; - for (di = def.begin(); di != def.end(); ++di) { - results.push_back((*di).first); - } - - set_variable(varname, repaste(results, " ")); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::define_formals -// Access: Public -// Description: Supplies values to a slew of variables at once, -// typically to define actual values for a list of -// formal parameters to a user-defined subroutine or -// function. -// -// Formals is a vector of variable names to be defined, -// and actuals is a comma-separated list of expressions -// to be substituted in, one-per-one. The -// subroutine_name is used only for error reporting. -//////////////////////////////////////////////////////////////////// -void PPScope:: -define_formals(const string &subroutine_name, - const vector &formals, const string &actuals) { - vector actual_words; - tokenize_params(actuals, actual_words, true); - - if (actual_words.size() < formals.size()) { - cerr << "Warning: not all parameters defined for " << subroutine_name - << ": " << actuals << "\n"; - } else if (actual_words.size() > formals.size()) { - cerr << "Warning: more parameters defined for " << subroutine_name - << " than actually exist: " << actuals << "\n"; - } - - for (int i = 0; i < (int)formals.size(); i++) { - if (i < (int)actual_words.size()) { - define_variable(formals[i], actual_words[i]); - } else { - define_variable(formals[i], string()); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::get_variable -// Access: Public -// Description: Returns the variable definition associated with the -// indicated variable name. -//////////////////////////////////////////////////////////////////// -string PPScope:: -get_variable(const string &varname) { - // Is it a user-defined function? - const PPSubroutine *sub = PPSubroutine::get_func(varname); - if (sub != (const PPSubroutine *)NULL) { - return expand_function(varname, sub, string()); - } - - // cerr << "getvar arg is: '" << varname << "'" << endl; - - string result; - if (p_get_variable(varname, result)) { - return result; - } - - // Check the scopes on the stack for the variable definition. - ScopeStack::reverse_iterator si; - for (si = _scope_stack.rbegin(); si != _scope_stack.rend(); ++si) { - if ((*si)->p_get_variable(varname, result)) { - return result; - } - } - - // If the variable isn't defined, we check the environment. - const char *env = getenv(varname.c_str()); - if (env != (const char *)NULL) { - return env; - } - - // It's not defined anywhere, so it's implicitly empty. - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_defined -// Access: Private -// Description: Expands the "defined" function variable. Code mimics get_variable() -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_defined(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 1) { - cerr << "error: defined requires one parameter.\n"; - errors_occurred = true; - return string(); - } - - string varname = tokens[0]; - string falsestr; - string truestr = "1"; - - // Is it a user-defined function? - const PPSubroutine *sub = PPSubroutine::get_func(varname); - - string nullstr; - - if (sub != (const PPSubroutine *)NULL) { - if(nullstr != expand_function(varname, sub, string())) { - return truestr; - } - } - - string result; - - if (p_get_variable(varname, result)) { - return truestr; - } - - // Check the scopes on the stack for the variable definition. - ScopeStack::reverse_iterator si; - for (si = _scope_stack.rbegin(); si != _scope_stack.rend(); ++si) { - if ((*si)->p_get_variable(varname, result)) { - return truestr; - } - } - - // If the variable isn't defined, we check the environment. - const char *env = getenv(varname.c_str()); - if (env != (const char *)NULL) { - return truestr; - } - - // It's not defined anywhere, so it's implicitly empty. - return falsestr; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_variable -// Access: Public -// Description: Similar to get_variable(), except the variable -// definition is in turn expanded. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_variable(const string &varname) { - return expand_string(get_variable(varname)); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::find_map_variable -// Access: Public -// Description: Looks for the map variable definition in this scope -// or some ancestor scope. Returns the map variable -// definition if it is found, or _null_map_def if it is -// not. -//////////////////////////////////////////////////////////////////// -PPScope::MapVariableDefinition &PPScope:: -find_map_variable(const string &varname) { - MapVariableDefinition &def = p_find_map_variable(varname); - if (&def != &_null_map_def) { - return def; - } - - // No such map variable. Check the stack. - ScopeStack::reverse_iterator si; - for (si = _scope_stack.rbegin(); si != _scope_stack.rend(); ++si) { - MapVariableDefinition &def = (*si)->p_find_map_variable(varname); - if (&def != &_null_map_def) { - return def; - } - } - - // Nada. - return _null_map_def; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::get_directory -// Access: Public -// Description: Returns the directory level associated with this -// scope, if any, or with the nearest parent to this -// scope. -//////////////////////////////////////////////////////////////////// -PPDirectory *PPScope:: -get_directory() { - if (_directory != (PPDirectory *)NULL) { - return _directory; - } - - // Check the stack. - ScopeStack::reverse_iterator si; - for (si = _scope_stack.rbegin(); si != _scope_stack.rend(); ++si) { - if ((*si)->_directory != (PPDirectory *)NULL) { - return (*si)->_directory; - } - } - - return (PPDirectory *)NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::set_directory -// Access: Public -// Description: Associates this scope with the indicated directory -// level. Typically this is done when definition a -// scope for a particular source file which exists at a -// known directory level. -//////////////////////////////////////////////////////////////////// -void PPScope:: -set_directory(PPDirectory *directory) { - _directory = directory; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_string -// Access: Public -// Description: Expands out all the variable references in the given -// string. Variables are expanded recursively; that is, -// if a variable expansion includes a reference to -// another variable name, the second variable name is -// expanded. However, cyclical references are not -// expanded. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_string(const string &str) { - string result = r_expand_string(str, (ExpandedVariable *)NULL); - - if (debug_expansions > 0 && str != result) { - // Look for the str in our table--how many times has this - // particular string been expanded? - ExpandResultCount &result_count = debug_expand[str]; - - // Then, how many times has it expanded to this same result? - // First, assuming this is the first time it has expanded to this - // result, try to insert the result string with an initial count - // of 1. - pair r = - result_count.insert(ExpandResultCount::value_type(result, 1)); - - if (!r.second) { - // If the result string was not successfully inserted into the - // map, it was already there--so increment the count. - ExpandResultCount::iterator rci = r.first; - (*rci).second++; - } - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_self_reference -// Access: Public -// Description: Similar to expand_string(), except that only simple -// references to the named variable are expanded--other -// variable references are left unchanged. This allows -// us to define a variable in terms of its previous -// definition. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_self_reference(const string &str, const string &varname) { - // Look for a simple reference to the named variable. A more - // complex reference, like a computed variable name or something - // equally loopy, won't work with this simple test. Too bad. - string reference; - reference += VARIABLE_PREFIX; - reference += VARIABLE_OPEN_BRACE; - reference += varname; - reference += VARIABLE_CLOSE_BRACE; - - string result; - - size_t p = 0; - size_t q = str.find(reference, p); - while (q != string::npos) { - result += str.substr(p, q - p); - p = q; - result += r_expand_variable(str, p, (ExpandedVariable *)NULL); - q = str.find(reference, p); - } - - result += str.substr(p); - return result; -} - - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::push_scope -// Access: Public, Static -// Description: Pushes the indicated scope onto the top of the stack. -// When a variable reference is unresolved in the -// current scope, the scope stack is searched, in LIFO -// order. -//////////////////////////////////////////////////////////////////// -void PPScope:: -push_scope(PPScope *scope) { - _scope_stack.push_back(scope); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::pop_scope -// Access: Public, Static -// Description: Pops another level off the top of the stack. See -// push_scope(). -//////////////////////////////////////////////////////////////////// -PPScope *PPScope:: -pop_scope() { - assert(!_scope_stack.empty()); - PPScope *back = _scope_stack.back(); - _scope_stack.pop_back(); - return back; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::get_bottom_scope -// Access: Public, Static -// Description: Returns the scope on the bottom of the stack. This -// was the very first scope ever pushed, e.g. the global -// scope. -//////////////////////////////////////////////////////////////////// -PPScope *PPScope:: -get_bottom_scope() { - assert(!_scope_stack.empty()); - return _scope_stack.front(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::get_enclosing_scope -// Access: Public, Static -// Description: Returns the scope n below the top of the stack, or -// the bottom scope if the stack has exactly n or fewer -// scopes. -// -// This will be the scope associated with the nth -// enclosing syntax in the source file. -//////////////////////////////////////////////////////////////////// -PPScope *PPScope:: -get_enclosing_scope(int n) { - assert(n >= 0); - if (n >= _scope_stack.size()) { - return get_bottom_scope(); - } - return _scope_stack[_scope_stack.size() - 1 - n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::tokenize_params -// Access: Public -// Description: Separates a string into tokens based on comma -// delimiters, e.g. for parameters to a function. -// Nested variable references are skipped correctly, -// even if they include commas. Leading and trailing -// whitespace in each token is automatically stripped. -// -// If expand is true, the nested variables are -// automatically expanded as the string is tokenized; -// otherwise, they are left unexpanded. -//////////////////////////////////////////////////////////////////// -void PPScope:: -tokenize_params(const string &str, vector &tokens, - bool expand) { - size_t p = 0; - while (p < str.length()) { - // Skip initial whitespace. - while (p < str.length() && isspace(str[p])) { - p++; - } - - string token; - while (p < str.length() && str[p] != FUNCTION_PARAMETER_SEPARATOR) { - if (p + 1 < str.length() && str[p] == VARIABLE_PREFIX && - str[p + 1] == VARIABLE_OPEN_BRACE) { - // Skip a nested variable reference. - if (expand) { - token += r_expand_variable(str, p, (ExpandedVariable *)NULL); - } else { - token += r_scan_variable(str, p); - } - } else { - token += str[p]; - p++; - } - } - - // Back up past trailing whitespace. - size_t q = token.length(); - while (q > 0 && isspace(token[q - 1])) { - q--; - } - - tokens.push_back(token.substr(0, q)); - p++; - - if (p == str.length()) { - // In this case, we have just read past a trailing comma symbol - // at the end of the string, so we have one more empty token. - tokens.push_back(string()); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::tokenize_numeric_pair -// Access: Public -// Description: This function is used by all the numeric comparision -// functions, e.g. nne, nlt, etc. It splits the string -// up into two parameters based on commas, and evaluates -// each parameter as a number, into a and b. It returns -// true if successful, or false if there was some user -// error. -//////////////////////////////////////////////////////////////////// -bool PPScope:: -tokenize_numeric_pair(const string &str, double &a, double &b) { - vector words; - tokenize_params(str, words, true); - if (words.size() != 2) { - cerr << words.size() << " parameters supplied when two were expected:\n" - << str << "\n"; - errors_occurred = true; - return false; - } - - double results[2]; - - for (int i = 0; i < 2; i++) { - const char *param = words[i].c_str(); - char *n; - results[i] = strtod(param, &n); - if (*n != '\0') { - // strtod failed--not a numeric representation. - cerr << "Warning: " << words[i] << " is not a number.\n"; - if (n == param) { - results[i] = 0.0; - } - } - } - - a = results[0]; - b = results[1]; - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::tokenize_ints -// Access: Public -// Description: This function is used by the arithmetic functions +, -// -, etc. It separates the string into parameters -// based on the comma, interprets each parameter as an -// integer, and fills up the indicated vector. -//////////////////////////////////////////////////////////////////// -bool PPScope:: -tokenize_ints(const string &str, vector &tokens) { - vector words; - tokenize_params(str, words, true); - - vector::const_iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - const char *param = (*wi).c_str(); - char *n; - int result = strtol(param, &n, 0); - if (*n != '\0') { - // strtol failed--not an integer. - cerr << "Warning: " << param << " is not an integer.\n"; - if (n == param) { - result = 0; - } - } - - tokens.push_back(result); - } - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::scan_to_whitespace -// Access: Public -// Description: Scans to the end of the first whitespace-delimited -// word in the indicated string, even if it includes a -// nested variable reference (which is itself allowed to -// contain whitespace). -// -// On input, str is a string, and start is the starting -// position within the string of the scan; it should -// point to a non-whitespace character. -// -// The return value is the position within the string of -// the first whitespace character encountered at its -// original position or later, that is not part of a -// variable reference. All variable references are left -// unexpanded. -//////////////////////////////////////////////////////////////////// -size_t PPScope:: -scan_to_whitespace(const string &str, size_t start) { - size_t p = start; - while (p < str.length() && !isspace(str[p])) { - string token; - if (p + 1 < str.length() && str[p] == VARIABLE_PREFIX && - str[p + 1] == VARIABLE_OPEN_BRACE) { - // Skip a nested variable reference. - r_scan_variable(str, p); - - } else { - p++; - } - } - - return p; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::format_int -// Access: Private, Static -// Description: Formats the indicated integer as a string and returns -// the string. -//////////////////////////////////////////////////////////////////// -string PPScope:: -format_int(int num) { - char buffer[32]; - sprintf(buffer, "%d", num); - return buffer; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::p_set_variable -// Access: Private -// Description: The private implementation of p_set_variable. -// Returns true if the variable's definition is found -// and set, false otherwise. -//////////////////////////////////////////////////////////////////// -bool PPScope:: -p_set_variable(const string &varname, const string &definition) { - Variables::iterator vi; - vi = _variables.find(varname); - if (vi != _variables.end()) { - (*vi).second = definition; - return true; - } - - if (_parent_scope != (PPScope *)NULL) { - return _parent_scope->p_set_variable(varname, definition); - } - - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::p_get_variable -// Access: Private -// Description: The private implementation of get_variable(). This -// checks the local scope only; it does not check the -// stack. It returns true if the variable is defined, -// false otherwise.. -//////////////////////////////////////////////////////////////////// -bool PPScope:: -p_get_variable(const string &varname, string &result) { - Variables::const_iterator vi; - vi = _variables.find(varname); - if (vi != _variables.end()) { - result = (*vi).second; - return true; - } - - if (varname == "RELDIR" && - _directory != (PPDirectory *)NULL && - current_output_directory != (PPDirectory *)NULL) { - // $[RELDIR] is a special variable name that evaluates to the - // relative directory of the current scope to the current output - // directory. - result = current_output_directory->get_rel_to(_directory); - return true; - } - - if (varname == "DEPENDS_INDEX" && - _directory != (PPDirectory *)NULL) { - // $[DEPENDS_INDEX] is another special variable name that - // evaluates to the numeric sorting index assigned to this - // directory based on its dependency relationship with other - // directories. It's useful primarily for debugging. - char buffer[32]; - sprintf(buffer, "%d", _directory->get_depends_index()); - result = buffer; - return true; - } - - if (_parent_scope != (PPScope *)NULL) { - return _parent_scope->p_get_variable(varname, result); - } - - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::r_expand_string -// Access: Private -// Description: The recursive implementation of expand_string(). -// This function detects cycles in the variable -// expansion by storing the set of variable names that -// have thus far been expanded in the linked list. -//////////////////////////////////////////////////////////////////// -string PPScope:: -r_expand_string(const string &str, PPScope::ExpandedVariable *expanded) { - string result; - - // Search for a variable reference. - size_t p = 0; - while (p < str.length()) { - if (p + 1 < str.length() && str[p] == VARIABLE_PREFIX && - str[p + 1] == VARIABLE_OPEN_BRACE) { - // Here's a nested variable! Expand it fully. - result += r_expand_variable(str, p, expanded); - - } else { - result += str[p]; - p++; - } - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::r_scan_variable -// Access: Private -// Description: Scans past a single variable reference without -// expanding it. On input, str is a string containing a -// variable reference (among other stuff), and vp is the -// position within the string of the prefix character at -// the beginning of the variable reference. -// -// On output, vp is set to the position within the -// string of the first character after the variable -// reference's closing bracket. The variable reference -// itself is returned. -//////////////////////////////////////////////////////////////////// -string PPScope:: -r_scan_variable(const string &str, size_t &vp) { - - // Search for the end of the variable name: an unmatched square - // bracket. - size_t start = vp; - size_t p = vp + 2; - while (p < str.length() && str[p] != VARIABLE_CLOSE_BRACE) { - if (p + 1 < str.length() && str[p] == VARIABLE_PREFIX && - str[p + 1] == VARIABLE_OPEN_BRACE) { - // Here's a nested variable! Scan past it, matching braces - // properly. - r_scan_variable(str, p); - } else { - p++; - } - } - - if (p < str.length()) { - assert(str[p] == VARIABLE_CLOSE_BRACE); - p++; - } else { - cerr << "Warning! Unclosed variable reference:\n" - << str.substr(vp) << "\n"; - } - - vp = p; - return str.substr(start, vp - start); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::r_expand_variable -// Access: Private -// Description: Expands a single variable reference. On input, str -// is a string containing a variable reference (among -// other stuff), and vp is the position within the -// string of the prefix character at the beginning of -// the variable reference. -// -// On output, vp is set to the position within the -// string of the first character after the variable -// reference's closing bracket, and the string expansion -// of the variable reference is returned. -//////////////////////////////////////////////////////////////////// -string PPScope:: -r_expand_variable(const string &str, size_t &vp, - PPScope::ExpandedVariable *expanded) { - string varname; - - size_t whitespace_at = 0; - size_t open_nested_at = 0; - - // Search for the end of the variable name: an unmatched square - // bracket. - size_t p = vp + 2; - while (p < str.length() && str[p] != VARIABLE_CLOSE_BRACE) { - if (p + 1 < str.length() && str[p] == VARIABLE_PREFIX && - str[p + 1] == VARIABLE_OPEN_BRACE) { - if (whitespace_at != 0) { - // Once we have encountered whitespace, we don't expand - // variables inline anymore. These are now function - // parameters, and might need to be expanded in some other - // scope. - varname += r_scan_variable(str, p); - } else { - varname += r_expand_variable(str, p, expanded); - } - - } else { - if (open_nested_at == 0 && str[p] == VARIABLE_OPEN_NESTED) { - open_nested_at = p - (vp + 2); - } - if (open_nested_at == 0 && whitespace_at == 0 && isspace(str[p])) { - whitespace_at = p - (vp + 2); - } - varname += str[p]; - p++; - } - } - - if (p < str.length()) { - assert(str[p] == VARIABLE_CLOSE_BRACE); - p++; - } else { - cerr << "Warning! Unclosed variable reference:\n" - << str.substr(vp) << "\n"; - } - - vp = p; - - // Check for a function expansion. - if (whitespace_at != 0) { - string funcname = varname.substr(0, whitespace_at); - p = whitespace_at; - while (p < varname.length() && isspace(varname[p])) { - p++; - } - string params = varname.substr(p); - - // Is it a user-defined function? - const PPSubroutine *sub = PPSubroutine::get_func(funcname); - if (sub != (const PPSubroutine *)NULL) { - return expand_function(funcname, sub, params); - } - - // Is it a built-in function? - if (funcname == "isfullpath") { - return expand_isfullpath(params); - } else if (funcname == "osfilename") { - return expand_osfilename(params); - } else if (funcname == "unixfilename") { - return expand_unixfilename(params); - } else if (funcname == "unixshortname") { - return expand_unixshortname(params); - } else if (funcname == "cygpath_w") { - // This maps to osfilename for historical reasons. - return expand_osfilename(params); - } else if (funcname == "cygpath_p") { - // This maps to unixfilename for historical reasons. - return expand_unixfilename(params); - } else if (funcname == "wildcard") { - return expand_wildcard(params); - } else if (funcname == "isdir") { - return expand_isdir(params); - } else if (funcname == "isfile") { - return expand_isfile(params); - } else if (funcname == "libtest") { - return expand_libtest(params); - } else if (funcname == "bintest") { - return expand_bintest(params); - } else if (funcname == "shell") { - return expand_shell(params); - } else if (funcname == "standardize") { - return expand_standardize(params); - } else if (funcname == "canonical") { - return expand_canonical(params); - } else if (funcname == "length") { - return expand_length(params); - } else if (funcname == "substr") { - return expand_substr(params); - } else if (funcname == "findstring") { - return expand_findstring(params); - } else if (funcname == "dir") { - return expand_dir(params); - } else if (funcname == "notdir") { - return expand_notdir(params); - } else if (funcname == "suffix") { - return expand_suffix(params); - } else if (funcname == "basename") { - return expand_basename(params); - } else if (funcname == "makeguid") { - return expand_makeguid(params); - } else if (funcname == "word") { - return expand_word(params); - } else if (funcname == "wordlist") { - return expand_wordlist(params); - } else if (funcname == "words") { - return expand_words(params); - } else if (funcname == "firstword") { - return expand_firstword(params); - } else if (funcname == "patsubst") { - return expand_patsubst(params, true); - } else if (funcname == "patsubstw") { - return expand_patsubst(params, false); - } else if (funcname == "subst") { - return expand_subst(params); - } else if (funcname == "wordsubst") { - return expand_wordsubst(params); - } else if (funcname == "filter") { - return expand_filter(params); - } else if (funcname == "filter_out" || funcname == "filter-out") { - return expand_filter_out(params); - } else if (funcname == "join") { - return expand_join(params); - } else if (funcname == "sort") { - return expand_sort(params); - } else if (funcname == "unique") { - return expand_unique(params); - } else if (funcname == "matrix") { - return expand_matrix(params); - } else if (funcname == "if") { - return expand_if(params); - } else if (funcname == "eq") { - return expand_eq(params); - } else if (funcname == "defined") { - return expand_defined(params); - } else if (funcname == "ne") { - return expand_ne(params); - } else if (funcname == "=" || funcname == "==") { - return expand_eqn(params); - } else if (funcname == "!=") { - return expand_nen(params); - } else if (funcname == "<") { - return expand_ltn(params); - } else if (funcname == "<=") { - return expand_len(params); - } else if (funcname == ">") { - return expand_gtn(params); - } else if (funcname == ">=") { - return expand_gen(params); - } else if (funcname == "+") { - return expand_plus(params); - } else if (funcname == "-") { - return expand_minus(params); - } else if (funcname == "*") { - return expand_times(params); - } else if (funcname == "/") { - return expand_divide(params); - } else if (funcname == "%") { - return expand_modulo(params); - } else if (funcname == "not") { - return expand_not(params); - } else if (funcname == "or") { - return expand_or(params); - } else if (funcname == "and") { - return expand_and(params); - } else if (funcname == "upcase") { - return expand_upcase(params); - } else if (funcname == "downcase") { - return expand_downcase(params); - } else if (funcname == "cdefine") { - return expand_cdefine(params); - } else if (funcname == "closure") { - return expand_closure(params); - } else if (funcname == "unmapped") { - return expand_unmapped(params); - } else if (funcname == "dependencies") { - return expand_dependencies(params); - } else if (funcname == "foreach") { - return expand_foreach(params); - } else if (funcname == "forscopes") { - return expand_forscopes(params); - } - - // It must be a map variable. - return expand_map_variable(funcname, params); - } - - // Now we have the variable name; was it previously expanded? - ExpandedVariable *ev; - for (ev = expanded; ev != (ExpandedVariable *)NULL; ev = ev->_next) { - if (ev->_varname == varname) { - // Yes, this is a cyclical expansion. - cerr << "Ignoring cyclical expansion of " << varname << "\n"; - return string(); - } - } - - // And now expand the variable. - - string expansion; - - // Check for a special inline patsubst operation, like GNU make: - // $[varname:%.c=%.o] - string patsubst; - bool got_patsubst = false; - p = varname.find(variable_patsubst); - if (p != string::npos) { - got_patsubst = true; - patsubst = varname.substr(p + variable_patsubst.length()); - varname = varname.substr(0, p); - } - - // Check for special scoping operators in the variable name. - p = varname.find(VARIABLE_OPEN_NESTED); - if (p != string::npos && varname[varname.length() - 1] == VARIABLE_CLOSE_NESTED) { - size_t q = varname.length() - 1; - string scope_names = varname.substr(p + 1, q - (p + 1)); - varname = varname.substr(0, p); - expansion = expand_variable_nested(varname, scope_names); - - } else { - // No special scoping; just expand the variable name. - expansion = get_variable(varname); - } - - // Finally, recursively expand any variable references in the - // variable's expansion. - ExpandedVariable new_var; - new_var._varname = varname; - new_var._next = expanded; - string result = r_expand_string(expansion, &new_var); - - // And *then* apply any inline patsubst. - if (got_patsubst) { - vector tokens; - tokenize(patsubst, tokens, VARIABLE_PATSUBST_DELIM); - - if (tokens.size() != 2) { - cerr << "inline patsubst should be of the form " - << VARIABLE_PREFIX << VARIABLE_OPEN_BRACE << "varname" - << VARIABLE_PATSUBST << PATTERN_WILDCARD << ".c" - << VARIABLE_PATSUBST_DELIM << PATTERN_WILDCARD << ".o" - << VARIABLE_CLOSE_BRACE << ".\n"; - errors_occurred = true; - } else { - PPFilenamePattern from(tokens[0]); - PPFilenamePattern to(tokens[1]); - - if (!from.has_wildcard() || !to.has_wildcard()) { - cerr << "The two parameters of inline patsubst must both include " - << PATTERN_WILDCARD << ".\n"; - errors_occurred = true; - return string(); - } - - // Split the expansion into tokens based on the spaces. - vector words; - tokenize_whitespace(result, words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - (*wi) = to.transform(*wi, from); - } - - result = repaste(words, " "); - } - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_variable_nested -// Access: Private -// Description: Expands a variable reference of the form -// $[varname(scope scope scope)]. This means to -// concatenate the expansions of the variable in all of -// the named scopes. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_variable_nested(const string &varname, - const string &scope_names) { - if (_named_scopes == (PPNamedScopes *)NULL) { - return string(); - } - - vector names; - tokenize_whitespace(scope_names, names); - - // Get all of the named scopes. - PPNamedScopes::Scopes scopes; - - vector::const_iterator ni; - for (ni = names.begin(); ni != names.end(); ++ni) { - const string &name = (*ni); - _named_scopes->get_scopes(name, scopes); - } - - if (scopes.empty()) { - return string(); - } - - // Now go through the scopes and build up the results. - vector results; - - PPNamedScopes::Scopes::const_iterator si; - for (si = scopes.begin(); si != scopes.end(); ++si) { - PPScope *scope = (*si); - string nested = scope->expand_variable(varname); - if (!nested.empty()) { - results.push_back(nested); - } - } - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_isfullpath -// Access: Private -// Description: Expands the "isfullpath" function variable. This -// returns true (actually, the same as its input) if the -// input parameter is a fully-specified path name, -// meaning it begins with a slash for unix_platform, and -// it begins with a slash or backslash, with an optional -// drive leterr, for windows_platform. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_isfullpath(const string ¶ms) { - Filename filename = trim_blanks(expand_string(params)); - - string result; - if (filename.is_fully_qualified()) { - result = filename; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_osfilename -// Access: Private -// Description: Expands the "osfilename" function variable. This -// converts the filename from a Unix-style filename -// (e.g. with slash separators) to a platform-specific -// filename. -// -// This follows the same rules of Panda filename -// conversion; i.e. forward slashes become backslashes, -// and $PANDA_ROOT prefixes full pathnames, unless the -// topmost directory name is a single letter. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_osfilename(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - Filename filename = (*wi); - (*wi) = filename.to_os_specific(); - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_unixfilename -// Access: Private -// Description: Expands the "unixfilename" function variable. This -// converts the filename from a platform-specific -// filename to a Unix-style filename (e.g. with slash -// separators). -// -// This follows the rules of Panda filename conversion. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_unixfilename(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - Filename filename = Filename::from_os_specific(*wi); - (*wi) = filename; - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_unixshortname -// Access: Private -// Description: Expands the "unixshortname" function variable. This -// converts the filename from a platform-specific -// filename to a Unix-style filename (e.g. with slash -// separators), just like the unixfilename variable. -// -// On Windows, this also specifically converts the -// Windows-specific filename to 8.3 convention before -// converting it to Unix style. This can be a cheesy -// way to work around embedded spaces in the filename. -// -// Unlike unixfilename, this parameter accepts only one -// filename. However, the filename may contain embedded -// spaces. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_unixshortname(const string ¶ms) { - Filename filename = Filename::from_os_specific(params); - filename = Filename::from_os_specific(filename.to_os_short_name()); - - return filename; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_wildcard -// Access: Private -// Description: Expands the "wildcard" function variable. This -// returns the set of files matched by the parameters -// with shell matching characters. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_wildcard(const string ¶ms) { - vector results; - glob_string(expand_string(params), results); - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_isdir -// Access: Private -// Description: Expands the "isdir" function variable. This -// returns true if the parameter exists and is a -// directory, or false otherwise. This actually expands -// the parameter(s) with shell globbing characters, -// similar to the "wildcard" function, and looks only at -// the first expansion. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_isdir(const string ¶ms) { - vector results; - glob_string(expand_string(params), results); - - if (results.empty()) { - // No matching file, too bad. - return string(); - } - - Filename filename = results[0]; - if (filename.is_directory()) { - return filename.get_fullpath(); - } else { - return string(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_isfile -// Access: Private -// Description: Expands the "isfile" function variable. This -// returns true if the parameter exists and is a -// regular file, or false otherwise. This actually -// expands the parameter(s) with shell globbing -// characters, similar to the "wildcard" function, and -// looks only at the first expansion. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_isfile(const string ¶ms) { - vector results; - glob_string(expand_string(params), results); - - if (results.empty()) { - // No matching file, too bad. - return string(); - } - - Filename filename = results[0]; - if (filename.is_regular_file()) { - return filename.get_fullpath(); - } else { - return string(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_libtest -// Access: Private -// Description: Expands the "libtest" function variable. This -// serves as a poor man's autoconf feature to check to -// see if a library by the given name exists on the -// indicated search path, or on the system search path. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_libtest(const string ¶ms) { - // Get the parameters out based on commas. The first parameter is a - // space-separated set of directories to search, the second - // parameter is a space-separated set of library names. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "libtest requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - DSearchPath directories; - directories.append_path(tokens[0], " \n\t"); - - // Also add the system directories to the list, whatever we think - // those should be. Here we have to make a few assumptions. -#ifdef WIN32 - const char *windir = getenv("WINDIR"); - if (windir != (const char *)NULL) { - Filename windir_filename = Filename::from_os_specific(windir); - directories.append_directory(Filename(windir_filename, "System")); - directories.append_directory(Filename(windir_filename, "System32")); - } - - const char *lib = getenv("LIB"); - if (lib != (const char *)NULL) { - vector lib_dirs; - tokenize(lib, lib_dirs, ";"); - vector::const_iterator li; - for (li = lib_dirs.begin(); li != lib_dirs.end(); ++li) { - directories.append_directory(Filename::from_os_specific(*li)); - } - } -#endif - - // We'll also check the Unix standard places, even if we're building - // Windows, since we might be using Cygwin. - - // Check LD_LIBRARY_PATH. - const char *ld_library_path = getenv("LD_LIBRARY_PATH"); - if (ld_library_path != (const char *)NULL) { - directories.append_path(ld_library_path, ":"); - } - - directories.append_directory("/lib"); - directories.append_directory("/usr/lib"); - - vector libnames; - tokenize_whitespace(tokens[1], libnames); - - if (libnames.empty()) { - // No libraries is a default "false". - return string(); - } - - // We only bother to search for the first library name in the list. - Filename libname = libnames[0]; - - bool found = false; - -#ifdef WIN32 - if (libname.get_extension() != string("lib")) { - libname = "lib" + libname.get_basename() + ".lib"; - } - found = libname.resolve_filename(directories); - if (!found) { - libname.set_extension("dll"); - found = libname.resolve_filename(directories); - } - -#else // WIN32 - libname = "lib" + libname.get_basename() + ".a"; - found = libname.resolve_filename(directories); - if (!found) { - libname.set_extension("so"); - found = libname.resolve_filename(directories); - } -#ifdef HAVE_OSX - if (!found) { - libname.set_extension("dylib"); - found = libname.resolve_filename(directories); - } -#endif // HAVE_OSX -#endif // WIN32 - - if (found) { - return libname.get_fullpath(); - } else { - return string(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_bintest -// Access: Private -// Description: Expands the "bintest" function variable. This -// serves as a poor man's autoconf feature to check to -// see if an executable program by the given name exists -// on the indicated search path, or on the system search -// path. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_bintest(const string ¶ms) { - // We only have one parameter: the filename of the executable. We - // always search for it on the path. - Filename binname = Filename::from_os_specific(expand_string(params)); - - if (binname.empty()) { - // No binary, no exist. - return string(); - } - - // An explicit path from the root does not require a search. - if (binname.is_fully_qualified()) { - if (binname.exists()) { - return binname.get_fullpath(); - } else { - return string(); - } - } - - const char *path = getenv("PATH"); - if (path == (const char *)NULL) { - // If the path is undefined, too bad. - return string(); - } - - string pathvar(path); - - DSearchPath directories; - -#ifdef WIN32 - if (pathvar.find(';') != string::npos) { - // If the path contains semicolons, it's a native Windows-style - // path: split it up based on semicolons, and convert each - // directory from windows form. - vector path_dirs; - tokenize(path, path_dirs, ";"); - vector::const_iterator pi; - for (pi = path_dirs.begin(); pi != path_dirs.end(); ++pi) { - directories.append_directory(Filename::from_os_specific(*pi)); - } - - } else { - // Otherwise, assume it's a Cygwin-style path: split it up based - // on colons. - directories.append_path(pathvar, ":"); - } -#else - directories.append_path(pathvar, ":"); -#endif - -#ifdef WIN32 - bool found = binname.resolve_filename(directories, "exe"); -#else - bool found = binname.resolve_filename(directories); -#endif - - if (found) { - return binname.get_fullpath(); - } else { - return string(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_shell -// Access: Private -// Description: Expands the "shell" function variable. This executes -// the given command in a subprocess and returns the -// standard output. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_shell(const string ¶ms) { -#ifdef WIN32_VC - cerr << "$[shell] is not presently supported on Win32 without Cygwin.\n"; - errors_occurred = true; - string output; - -#else // WIN32_VC - // We run $[shell] commands within the directory indicated by - // $[THISDIRPREFIX]. This way, local filenames will be expanded the - // way we expect. - string dirname = trim_blanks(expand_variable("THISDIRPREFIX")); - - string command = expand_string(params); - int pid, status; - - int pd[2]; - if (pipe(pd) < 0) { - // pipe() failed. - perror("pipe"); - return string(); - } - - pid = fork(); - if (pid < 0) { - // fork() failed. - perror("fork"); - return string(); - } - - if (pid == 0) { - // Child. - - if (!dirname.empty()) { - // We don't have to restore the directory after we're done, - // because we're doing the chdir() call only within the child - // process. - if (chdir(dirname.c_str()) < 0) { - perror("chdir"); - } - } - - close(pd[0]); - dup2(pd[1], STDOUT_FILENO); - char *argv[4]; - argv[0] = (char *)"sh"; - argv[1] = (char *)"-c"; - argv[2] = (char *)command.c_str(); - argv[3] = (char *)NULL; - execv("/bin/sh", argv); - exit(127); - } - - // Parent. Wait for the child to terminate, and read from its - // output while we're waiting. - close(pd[1]); - bool child_done = false; - bool pipe_closed = false; - string output; - - while (!child_done && !pipe_closed) { - static const int buffer_size = 1024; - char buffer[buffer_size]; - int read_bytes = (int)read(pd[0], buffer, buffer_size); - if (read_bytes < 0) { - perror("read"); - } else if (read_bytes == 0) { - pipe_closed = true; - } else { - output += string(buffer, read_bytes); - } - - if (!child_done) { - int waitresult = waitpid(pid, &status, WNOHANG); - if (waitresult < 0) { - if (errno != EINTR) { - perror("waitpid"); - return string(); - } - } else if (waitresult > 0) { - child_done = true; - } - } - } - close(pd[0]); -#endif // WIN32_VC - - // Now get the output. We split it into words and then reconnect - // it, to simulate the shell's backpop operator. - vector results; - tokenize_whitespace(output, results); - - string result = repaste(results, " "); - - return result; -} - - - - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_standardize -// Access: Private -// Description: Expands the "standardize" function variable. This -// converts the filename to standard form by removing -// consecutive repeated slashes and collapsing /../ -// where possible. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_standardize(const string ¶ms) { - Filename filename = trim_blanks(expand_string(params)); - if (filename.empty()) { - return string(); - } - - filename.standardize(); - return filename.get_fullpath(); -} - - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_canonical -// Access: Private -// Description: Expands the "canonical" function variable. This -// converts this filename to a canonical name by -// replacing the directory part with the fully-qualified -// directory part. This is done by changing to that -// directory and calling getcwd(). -// -// See filename::make_canonical() for a complete -// explanation of the implications of this and of the -// difference between this and standardize, above. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_canonical(const string ¶ms) { - Filename filename = trim_blanks(expand_string(params)); - filename.make_canonical(); - return filename.get_fullpath(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_length -// Access: Private -// Description: Expands the "length" function variable. This returns -// the length of the argument in characters. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_length(const string ¶ms) { - string word = trim_blanks(expand_string(params)); - - char buffer[32]; - sprintf(buffer, "%d", (int) word.length()); - string result = buffer; - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_substr -// Access: Private -// Description: Expands the "substr" function variable. $[substr -// S,E,string] returns the substring of "string" -// beginning at character S (1-based) and continuing to -// character E, inclusive. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_substr(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 3) { - cerr << "substr requires three parameters.\n"; - errors_occurred = true; - return string(); - } - - int start = atoi(tokens[0].c_str()); - int end = atoi(tokens[1].c_str()); - - if (end < start) { - // Following GNU make's convention, we swap start and end if - // they're out of order. - int t = end; - end = start; - start = t; - } - - const string &word = tokens[2]; - - start = max(start, 1); - end = min(end, (int)word.length()); - - if (end < start) { - return string(); - } - - string result = word.substr(start - 1, end - start + 1); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_dir -// Access: Private -// Description: Expands the "dir" function variable. This returns -// the directory part of its filename argument(s), or ./ -// if the words contain no slash. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_dir(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - string &word = (*wi); - - size_t slash = word.rfind('/'); - if (slash != string::npos) { - word = word.substr(0, slash + 1); - } else { - word = "./"; - } - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_notdir -// Access: Private -// Description: Expands the "notdir" function variable. This returns -// everything following the rightmost slash, or the -// string itself if there is no slash. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_notdir(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - string &word = (*wi); - - size_t slash = word.rfind('/'); - if (slash != string::npos) { - word = word.substr(slash + 1); - } - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_suffix -// Access: Private -// Description: Expands the "suffix" function variable. This returns -// the filename extension, including a dot, if any. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_suffix(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - string &word = (*wi); - - size_t dot = word.rfind('.'); - if (dot != string::npos) { - string ext = word.substr(dot); - if (ext.find('/') == string::npos) { - word = ext; - } else { - word = string(); - } - } else { - word = string(); - } - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_basename -// Access: Private -// Description: Expands the "basename" function variable. This returns -// everything but the filename extension (including the -// directory, if any). -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_basename(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - string &word = (*wi); - - size_t dot = word.rfind('.'); - if (dot != string::npos) { - string ext = word.substr(dot); - if (ext.find('/') == string::npos) { - word = word.substr(0, dot); - } - } - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_makeguid -// Access: Private -// Description: Expands the GUID (global unique identifier) of the -// given name (generally a directory). A GUID looks -// like this: 398F2CC4-C683-26EB-3251-6FC996738F7F -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_makeguid(const string ¶ms) { - // Expand all of the parameters into a single string. - string expansion = trim_blanks(expand_string(params)); - - if (expansion.size() == 0) { - cerr << "makeguid requires an argument.\n"; - errors_occurred = true; - return string(); - } - - PP_MD5_CTX context; - unsigned char digest[16]; - - MD5Init(&context); - MD5Update(&context, reinterpret_cast(expansion.data()), - expansion.size()); - MD5Final(digest, &context); - - string guid; - char hex[2]; - int i; - - for (i = 0; i < 4; i++) { - sprintf(hex, "%02x", digest[i]); - guid.append(hex); - } - guid += "-"; - - for (i = 4; i < 6; i++) { - sprintf(hex, "%02x", digest[i]); - guid.append(hex); - } - guid += "-"; - - for (i = 6; i < 8; i++) { - sprintf(hex, "%02x", digest[i]); - guid.append(hex); - } - guid += "-"; - - for (i = 8; i < 10; i++) { - sprintf(hex, "%02x", digest[i]); - guid.append(hex); - } - guid += "-"; - - for (i = 10; i < 16; i++) { - sprintf(hex, "%02x", digest[i]); - guid.append(hex); - } - - // Convert the entire GUID string to uppercased letters. - string::iterator si; - for (si = guid.begin(); si != guid.end(); ++si) { - (*si) = toupper(*si); - } - - return guid; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_word -// Access: Private -// Description: Expands the "word" function variable. This returns -// the nth word, 1-based, of the space-separated list of -// words in the second parameter. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_word(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "word requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - int index = atoi(tokens[0].c_str()); - - // Split the second parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(tokens[1]), words); - - if (index < 1 || index > (int)words.size()) { - // Out of range. - return string(); - } - return words[index - 1]; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_wordlist -// Access: Private -// Description: Expands the "wordlist" function variable. This -// returns a range of words, 1-based, of the -// space-separated list of words in the third parameter. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_wordlist(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 3) { - cerr << "wordlist requires three parameters.\n"; - errors_occurred = true; - return string(); - } - - int start = atoi(tokens[0].c_str()); - int end = atoi(tokens[1].c_str()); - - if (end < start) { - // Following GNU make's convention, we swap start and end if - // they're out of order. - int t = end; - end = start; - start = t; - } - - // Split the third parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(tokens[2]), words); - - start = max(start, 1); - end = min(end, (int)words.size() + 1); - - if (end < start) { - return string(); - } - - vector results; - results.insert(results.end(), - words.begin() + start - 1, - words.begin() + end - 1); - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_words -// Access: Private -// Description: Expands the "words" function variable. This -// returns the number of space-separated words in the -// list. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_words(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - char buffer[32]; - sprintf(buffer, "%d", (int) words.size()); - string result = buffer; - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_firstword -// Access: Private -// Description: Expands the "firstword" function variable. This -// returns the first of several words separated by -// whitespace. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_firstword(const string ¶ms) { - // Split the parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - if (!words.empty()) { - return words[0]; - } - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_patsubst -// Access: Private -// Description: Expands the "patsubst" function variable. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_patsubst(const string ¶ms, bool separate_words) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, false); - - if (tokens.size() < 3) { - cerr << "patsubst requires at least three parameters.\n"; - errors_occurred = true; - return string(); - } - - if ((tokens.size() % 2) != 1) { - cerr << "patsubst requires an odd number of parameters.\n"; - errors_occurred = true; - return string(); - } - - // Split the last parameter into tokens based on the spaces--but - // only if separate_words is true. - vector words; - if (separate_words) { - tokenize_whitespace(expand_string(tokens.back()), words); - } else { - words.push_back(expand_string(tokens.back())); - } - - // Build up a vector of from/to patterns. - typedef vector Patterns; - typedef vector FromPatterns; - FromPatterns from; - Patterns to; - - size_t i; - for (i = 0; i < tokens.size() - 1; i += 2) { - // Each "from" pattern might be a collection of patterns separated - // by spaces, and it is expanded immediately. - from.push_back(Patterns()); - vector froms; - tokenize_whitespace(expand_string(tokens[i]), froms); - vector::const_iterator fi; - for (fi = froms.begin(); fi != froms.end(); ++fi) { - PPFilenamePattern pattern(*fi); - if (!pattern.has_wildcard()) { - cerr << "All the \"from\" parameters of patsubst must include " - << PATTERN_WILDCARD << ".\n"; - errors_occurred = true; - return string(); - } - from.back().push_back(pattern); - } - - // However, the corresponding "to" pattern is just one pattern, - // and it is expanded immediately only if it does not contain a - // wildcard character. - PPFilenamePattern to_pattern(tokens[i + 1]); - if (!to_pattern.has_wildcard()) { - to_pattern = PPFilenamePattern(expand_string(tokens[i + 1])); - } - to.push_back(to_pattern); - } - size_t num_patterns = from.size(); - assert(num_patterns == to.size()); - - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - bool matched = false; - for (i = 0; i < num_patterns && !matched; i++) { - Patterns::const_iterator pi; - for (pi = from[i].begin(); pi != from[i].end() && !matched; ++pi) { - if ((*pi).matches(*wi)) { - matched = true; - string transformed = to[i].transform(*wi, (*pi)); - (*wi) = expand_string(transformed); - } - } - } - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_filter -// Access: Private -// Description: Expands the "filter" function variable. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_filter(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "filter requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - // Split up the first parameter--the list of patterns to filter - // by--into tokens based on the spaces. - vector pattern_strings; - tokenize_whitespace(tokens[0], pattern_strings); - - vector patterns; - vector::const_iterator psi; - for (psi = pattern_strings.begin(); psi != pattern_strings.end(); ++psi) { - patterns.push_back(PPFilenamePattern(*psi)); - } - - // Split up the second parameter--the list of words to filter--into - // tokens based on the spaces. - vector words; - tokenize_whitespace(tokens[1], words); - - vector::iterator wi, wnext; - wnext = words.begin(); - for (wi = words.begin(); wi != words.end(); ++wi) { - const string &word = (*wi); - - bool matches_pattern = false; - vector::const_iterator pi; - for (pi = patterns.begin(); - pi != patterns.end() && !matches_pattern; - ++pi) { - matches_pattern = (*pi).matches(word); - } - - if (matches_pattern) { - *wnext++ = word; - } - } - - words.erase(wnext, words.end()); - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_filter_out -// Access: Private -// Description: Expands the "filter_out" function variable. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_filter_out(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "filter-out requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - // Split up the first parameter--the list of patterns to filter - // by--into tokens based on the spaces. - vector pattern_strings; - tokenize_whitespace(tokens[0], pattern_strings); - - vector patterns; - vector::const_iterator psi; - for (psi = pattern_strings.begin(); psi != pattern_strings.end(); ++psi) { - patterns.push_back(PPFilenamePattern(*psi)); - } - - // Split up the second parameter--the list of words to filter--into - // tokens based on the spaces. - vector words; - tokenize_whitespace(tokens[1], words); - - vector::iterator wi, wnext; - wnext = words.begin(); - for (wi = words.begin(); wi != words.end(); ++wi) { - const string &word = (*wi); - - bool matches_pattern = false; - vector::const_iterator pi; - for (pi = patterns.begin(); - pi != patterns.end() && !matches_pattern; - ++pi) { - matches_pattern = (*pi).matches(word); - } - - if (!matches_pattern) { - *wnext++ = word; - } - } - - words.erase(wnext, words.end()); - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_subst -// Access: Private -// Description: Expands the "subst" function variable. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_subst(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() < 3) { - cerr << "subst requires at least three parameters.\n"; - errors_occurred = true; - return string(); - } - - if ((tokens.size() % 2) != 1) { - cerr << "subst requires an odd number of parameters.\n"; - errors_occurred = true; - return string(); - } - - // Now substitute each of the substitute strings out for the - // replacement strings. - string str = tokens.back(); - for (size_t i = 0; i < tokens.size() - 1; i += 2) { - string new_str; - const string &subst = tokens[i]; - const string &repl = tokens[i + 1]; - size_t q = 0; - size_t p = str.find(subst, q); - while (p != string::npos) { - new_str += str.substr(q, p - q) + repl; - q = p + subst.length(); - p = str.find(subst, q); - } - str = new_str + str.substr(q); - } - return str; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_findstrnig -// Access: Private -// Description: Expands the "findstring" function variable. -// $[findstring a,b] returns b if and only if it is a -// substring of a; otherwise, it returns the empty -// string. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_findstring(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "findstring requires two parameters.\n"; - errors_occurred = true; - return string(); - } - string str = tokens.back(); - const string &srchstr = tokens[0]; - size_t q = 0; - size_t p = str.find(srchstr, q); - if(p == string::npos) - str = ""; - - return str; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_wordsubst -// Access: Private -// Description: Expands the "wordsubst" function variable. This is -// like "subst" except it only replaces whole words. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_wordsubst(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() < 3) { - cerr << "subst requires at least three parameters.\n"; - errors_occurred = true; - return string(); - } - - if ((tokens.size() % 2) != 1) { - cerr << "subst requires an odd number of parameters.\n"; - errors_occurred = true; - return string(); - } - - // Split the last parameter into tokens based on the spaces. - vector words; - tokenize_whitespace(tokens.back(), words); - - for (size_t i = 0; i < tokens.size() - 1; i += 2) { - const string &subst = tokens[i]; - const string &repl = tokens[i + 1]; - vector::iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - if ((*wi) == subst) { - (*wi) = repl; - } - } - } - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_join -// Access: Private -// Description: Expands the "join" function variable: joins the list -// of words using the specified separator. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_join(const string ¶ms) { - // Split the string up into tokens based on the spaces. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "join requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - const string &sep = tokens[0]; - vector words; - tokenize_whitespace(expand_string(tokens[1]), words); - - string result = repaste(words, sep); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_sort -// Access: Private -// Description: Expands the "sort" function variable: sort the words -// into alphabetical order, and also remove duplicates. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_sort(const string ¶ms) { - // Split the string up into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - sort(words.begin(), words.end()); - words.erase(unique(words.begin(), words.end()), words.end()); - - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_unique -// Access: Private -// Description: Expands the "unique" function variable: remove -// duplicates from the list of words without changing -// the order. The first appearance of each word -// remains. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_unique(const string ¶ms) { - // Split the string up into tokens based on the spaces. - vector words; - tokenize_whitespace(expand_string(params), words); - - vector::iterator win, wout; - set included_words; - - win = words.begin(); - wout = words.begin(); - while (win != words.end()) { - if (included_words.insert(*win).second) { - // This is a unique word so far. - *wout++ = *win; - } - ++win; - } - - words.erase(wout, words.end()); - string result = repaste(words, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_matrix -// Access: Private -// Description: Expands the "matrix" function variable. This -// combines the different words of the n parameters in -// all possible ways, like the shell {a,b,c} expansion -// characters. For example, $[matrix a b,c,10 20 30] -// expands to ac10 ac20 ac30 bc10 bc20 bc30. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_matrix(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - // Each token gets split up into words based on the spaces. - vector > words; - for (int i = 0; i < (int)tokens.size(); i++) { - words.push_back(vector()); - tokenize_whitespace(tokens[i], words.back()); - } - - // Now synthesize the results recursively. - vector results; - r_expand_matrix(results, words, 0, ""); - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_if -// Access: Private -// Description: Expands the "if" function variable. This evaluates -// the first parameter and returns the second parameter -// if the result is true (i.e. nonempty) and the third -// parameter (if present) if the result is false -// (i.e. empty). -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_if(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() == 2) { - if (!tokens[0].empty()) { - return tokens[1]; - } else { - return ""; - } - } else if (tokens.size() == 3) { - if (!tokens[0].empty()) { - return tokens[1]; - } else { - return tokens[2]; - } - } - - cerr << "if requires two or three parameters.\n"; - errors_occurred = true; - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_eq -// Access: Private -// Description: Expands the "eq" function variable. This tests -// string equivalence. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_eq(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "eq requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - string result; - if (tokens[0] == tokens[1]) { - result = "1"; - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_ne -// Access: Private -// Description: Expands the "ne" function variable. This tests -// string equivalence. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_ne(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 2) { - cerr << "ne requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - string result; - if (!(tokens[0] == tokens[1])) { - result = "1"; - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_eqn -// Access: Private -// Description: Expands the "=" function variable. This tests -// numeric equivalence. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_eqn(const string ¶ms) { - double a, b; - if (!tokenize_numeric_pair(params, a, b)) { - return string(); - } - - string result; - if (a == b) { - result = "1"; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_nen -// Access: Private -// Description: Expands the "!=" function variable. This tests -// numeric equivalence. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_nen(const string ¶ms) { - double a, b; - if (!tokenize_numeric_pair(params, a, b)) { - return string(); - } - - string result; - if (a != b) { - result = "1"; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_ltn -// Access: Private -// Description: Expands the "<" function variable. This tests -// numeric relationships. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_ltn(const string ¶ms) { - double a, b; - if (!tokenize_numeric_pair(params, a, b)) { - return string(); - } - - string result; - if (a < b) { - result = "1"; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_len -// Access: Private -// Description: Expands the "<=" function variable. This tests -// numeric relationships. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_len(const string ¶ms) { - double a, b; - if (!tokenize_numeric_pair(params, a, b)) { - return string(); - } - - string result; - if (a <= b) { - result = "1"; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_gtn -// Access: Private -// Description: Expands the ">" function variable. This tests -// numeric relationships. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_gtn(const string ¶ms) { - double a, b; - if (!tokenize_numeric_pair(params, a, b)) { - return string(); - } - - string result; - if (a > b) { - result = "1"; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_gen -// Access: Private -// Description: Expands the ">=" function variable. This tests -// numeric relationships. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_gen(const string ¶ms) { - double a, b; - if (!tokenize_numeric_pair(params, a, b)) { - return string(); - } - - string result; - if (a >= b) { - result = "1"; - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_plus -// Access: Private -// Description: Expands the "+" function variable. This operates -// on integer numbers. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_plus(const string ¶ms) { - vector tokens; - if (!tokenize_ints(params, tokens)) { - return string(); - } - - int result = 0; - vector::const_iterator ti; - for (ti = tokens.begin(); ti != tokens.end(); ++ti) { - result += (*ti); - } - - return format_int(result); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_minus -// Access: Private -// Description: Expands the "-" function variable. This operates -// on integer numbers. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_minus(const string ¶ms) { - vector tokens; - if (!tokenize_ints(params, tokens)) { - return string(); - } - - int result = 0; - - if (tokens.size() == 1) { - // A special case: unary minus. - result = -tokens[0]; - - } else if (tokens.size() > 1) { - result = tokens[0]; - for (int i = 1; i < (int)tokens.size(); i++) { - result -= tokens[i]; - } - } - - return format_int(result); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_times -// Access: Private -// Description: Expands the "*" function variable. This operates -// on integer numbers. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_times(const string ¶ms) { - vector tokens; - if (!tokenize_ints(params, tokens)) { - return string(); - } - - int result = 1; - vector::const_iterator ti; - for (ti = tokens.begin(); ti != tokens.end(); ++ti) { - result *= (*ti); - } - - return format_int(result); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_divide -// Access: Private -// Description: Expands the "/" function variable. This operates -// on integer numbers. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_divide(const string ¶ms) { - vector tokens; - if (!tokenize_ints(params, tokens)) { - return string(); - } - - if (tokens.size() != 2) { - cerr << tokens.size() << " parameters supplied when two were expected:\n" - << params << "\n"; - errors_occurred = true; - return string(); - } - - return format_int(tokens[0] / tokens[1]); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_modulo -// Access: Private -// Description: Expands the "%" function variable. This operates -// on integer numbers. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_modulo(const string ¶ms) { - vector tokens; - if (!tokenize_ints(params, tokens)) { - return string(); - } - - if (tokens.size() != 2) { - cerr << tokens.size() << " parameters supplied when two were expected:\n" - << params << "\n"; - errors_occurred = true; - return string(); - } - - return format_int(tokens[0] % tokens[1]); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_not -// Access: Private -// Description: Expands the "not" function variable. This returns -// nonempty if its argument is empty, empty if its -// argument is nonempty. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_not(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - if (tokens.size() != 1) { - cerr << "not requires one parameter.\n"; - errors_occurred = true; - return string(); - } - - string result; - if (tokens[0].empty()) { - result = "1"; - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_or -// Access: Private -// Description: Expands the "or" function variable. This returns -// nonempty if any of its arguments are nonempty. -// Specifically, it returns the first nonempty argument. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_or(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - vector::const_iterator ti; - for (ti = tokens.begin(); ti != tokens.end(); ++ti) { - if (!(*ti).empty()) { - return (*ti); - } - } - return string(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_and -// Access: Private -// Description: Expands the "and" function variable. This returns -// nonempty if all of its arguments are nonempty. -// Specifically, it returns the last argument. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_and(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, true); - - vector::const_iterator ti; - for (ti = tokens.begin(); ti != tokens.end(); ++ti) { - if ((*ti).empty()) { - return string(); - } - } - - string result = "1"; - if (!tokens.empty()) { - result = tokens.back(); - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_upcase -// Access: Private -// Description: Expands the "upcase" function variable. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_upcase(const string ¶ms) { - string result = expand_string(params); - string::iterator si; - for (si = result.begin(); si != result.end(); ++si) { - (*si) = toupper(*si); - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_downcase -// Access: Private -// Description: Expands the "downcase" function variable. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_downcase(const string ¶ms) { - string result = expand_string(params); - string::iterator si; - for (si = result.begin(); si != result.end(); ++si) { - (*si) = tolower(*si); - } - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_cdefine -// Access: Private -// Description: Expands the "cdefine" function variable. This is a -// convenience function to output a C-style #define or -// #undef statement based on the value of the named -// variable. If the named string is a variable whose -// definition is nonempty, this returns "#define varname -// definition". Otherwise, it returns "#undef varname". -// This is particularly useful for building up a -// config.h file. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_cdefine(const string ¶ms) { - string varname = trim_blanks(params); - string expansion = trim_blanks(expand_variable(varname)); - - string result; - if (expansion.empty()) { - result = "#undef " + varname; - } else { - result = "#define " + varname + " " + expansion; - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_closure -// Access: Private -// Description: Expands the "closure" function variable. This is a -// special function that recursively expands a map -// variable with the given parameter string until all -// definitions have been encountered. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_closure(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, false); - - if (tokens.size() != 2 && tokens.size() != 3) { - cerr << "closure requires two or three parameters.\n"; - errors_occurred = true; - return string(); - } - - // The first parameter is the map variable name, the second - // parameter is the expression to evaluate, and the third parameter - // (if present) is the expression that leads to the recursive - // evaluation of the map variable. - string varname = expand_string(tokens[0]); - string expression = tokens[1]; - string close_on = expression; - if (tokens.size() > 2) { - close_on = tokens[2]; - } - - const MapVariableDefinition &def = find_map_variable(varname); - if (&def == &_null_map_def) { - cerr << "Warning: undefined map variable: " << varname << "\n"; - return string(); - } - - // Now evaluate the expression within this scope, and then again - // within each scope indicated by the result, and then within each - // scope indicated by *that* result, and so on. We need to keep - // track of the words we have already evaluated (hence the set), and - // we also need to keep track of all the partial results we have yet - // to evaluate (hence the vector of strings). - set closure; - vector results; - vector next_pass; - - // Start off with the expression evaluated within the starting - // scope. - results.push_back(expand_string(expression)); - - next_pass.push_back(expand_string(close_on)); - - while (!next_pass.empty()) { - // Pull off one of the partial results (it doesn't matter which - // one), and chop it up into its constituent words. - vector pass; - tokenize_whitespace(next_pass.back(), pass); - next_pass.pop_back(); - - // And then map each of those words into scopes. - vector::const_iterator wi; - for (wi = pass.begin(); wi != pass.end(); ++wi) { - const string &word = (*wi); - bool inserted = closure.insert(word).second; - if (inserted) { - // This is a new word, which presumably maps to a scope. - MapVariableDefinition::const_iterator di; - di = def.find(word); - if (di != def.end()) { - PPScope *scope = (*di).second; - // Evaluate the expression within this scope. - results.push_back(scope->expand_string(expression)); - - // What does close_on evaluate to within this scope? That - // points us to the next scope(s). - next_pass.push_back(scope->expand_string(close_on)); - } - } - } - } - - // Now we have the complete transitive closure of $[mapvar close_on]. - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_unmapped -// Access: Private -// Description: Expands the "closure" function variable. This is a -// special function that returns all the arguments to a -// map variable, unchanged, that did *not* match any of -// the keys in the map. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_unmapped(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, false); - - if (tokens.size() != 2) { - cerr << "unmapped requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - // The first parameter is the map variable name, and the second - // parameter is the space-separated list of arguments to the map. - string varname = expand_string(tokens[0]); - vector keys; - tokenize_whitespace(expand_string(tokens[1]), keys); - - const MapVariableDefinition &def = find_map_variable(varname); - if (&def == &_null_map_def) { - cerr << "Warning: undefined map variable: " << varname << "\n"; - return string(); - } - - vector results; - vector::const_iterator ki; - for (ki = keys.begin(); ki != keys.end(); ++ki) { - MapVariableDefinition::const_iterator di; - di = def.find(*ki); - if (di == def.end()) { - // This key was undefined. - results.push_back(*ki); - } - } - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_dependencies -// Access: Private -// Description: Expands the "dependencies" function variable. This -// function returns all of the inter-file dependencies -// that the named file(s) depend on, as defined by the -// #include directives appearing within the files. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_dependencies(const string ¶ms) { - // Split the string up into filenames based on whitespace. - vector filenames; - tokenize_whitespace(expand_string(params), filenames); - - PPDirectory *directory = get_directory(); - assert(directory != (PPDirectory *)NULL); - - vector results; - vector::const_iterator fi; - for (fi = filenames.begin(); fi != filenames.end(); ++fi) { - PPDependableFile *file = directory->get_dependable_file(*fi, false); - assert(file != (PPDependableFile *)NULL); - - vector files; - file->get_complete_dependencies(files); - - vector::const_iterator dfi; - for (dfi = files.begin(); dfi != files.end(); ++dfi) { - PPDependableFile *df = (*dfi); - string rel_filename = - current_output_directory->get_rel_to(df->get_directory()) + "/" + - df->get_filename(); - results.push_back(rel_filename); - } - } - - sort(results.begin(), results.end()); - results.erase(unique(results.begin(), results.end()), results.end()); - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_foreach -// Access: Private -// Description: Expands the "foreach" function variable. This -// evaluates an expression once for each word of a list. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_foreach(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, false); - - if (tokens.size() != 3) { - cerr << "foreach requires three parameters.\n"; - errors_occurred = true; - return string(); - } - - // The first parameter is the temporary variable name that holds - // each word as it is expanded; the second parameter is the - // space-separated list of words. The third parameter is the - // expression to evaluate. - string varname = trim_blanks(expand_string(tokens[0])); - vector words; - tokenize_whitespace(expand_string(tokens[1]), words); - - vector results; - vector::const_iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - define_variable(varname, *wi); - results.push_back(expand_string(tokens[2])); - } - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_forscopes -// Access: Private -// Description: Expands the "forscopes" function variable. This -// evaluates an expression once within each of a number -// of named nested scopes. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_forscopes(const string ¶ms) { - // Split the string up into tokens based on the commas. - vector tokens; - tokenize_params(params, tokens, false); - - if (tokens.size() != 2) { - cerr << "forscopes requires two parameters.\n"; - errors_occurred = true; - return string(); - } - - // The first parameter is the space-separated list of nested scope - // names. The second parameter is the expression to evaluate. - vector scope_names; - tokenize_whitespace(expand_string(tokens[0]), scope_names); - - if (_named_scopes == (PPNamedScopes *)NULL) { - return string(); - } - - // Now build up the list of scopes with these names. - PPNamedScopes::Scopes scopes; - vector::const_iterator wi; - for (wi = scope_names.begin(); wi != scope_names.end(); ++wi) { - _named_scopes->get_scopes(*wi, scopes); - } - PPNamedScopes::sort_by_dependency(scopes); - - // Now evaluate the expression within each scope. - - vector results; - PPNamedScopes::Scopes::const_iterator si; - for (si = scopes.begin(); si != scopes.end(); ++si) { - PPScope *scope = *si; - results.push_back(scope->expand_string(tokens[1])); - } - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_function -// Access: Private -// Description: Expands the user-defined function reference. This -// invokes the nested commands within the function body, -// and returns all the output text as one line. Quite a -// job, really. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_function(const string &funcname, - const PPSubroutine *sub, const string ¶ms) { - PPScope::push_scope((PPScope *)this); - PPScope nested_scope(_named_scopes); - nested_scope.define_formals(funcname, sub->_formals, params); - -#ifdef HAVE_SSTREAM - ostringstream ostr; -#else - ostrstream ostr; -#endif - - PPCommandFile command(&nested_scope); - command.set_output(&ostr); - - command.begin_read(); - bool okflag = true; - vector::const_iterator li; - for (li = sub->_lines.begin(); li != sub->_lines.end() && okflag; ++li) { - okflag = command.read_line(*li); - } - if (okflag) { - okflag = command.end_read(); - } - // We don't do anything with okflag here. What can we do? - - PPScope::pop_scope(); - - // Now get the output. We split it into words and then reconnect - // it, to replace all whitespace with spaces. -#ifdef HAVE_SSTREAM - string str = ostr.str(); -#else - ostr << ends; - char *c_str = ostr.str(); - string str = c_str; - delete[] c_str; -#endif - - vector results; - tokenize_whitespace(str, results); - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_map_variable -// Access: Private -// Description: Expands a map variable function reference. This -// looks up the given keys in the map and expands the -// first parameter for each corresponding scope. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_map_variable(const string &varname, const string ¶ms) { - // Split the string up into tokens based on the commas, but don't - // expand the variables yet. - vector tokens; - tokenize_params(params, tokens, false); - - if (tokens.size() != 2) { - cerr << "map variable expansions require two parameters: $[" - << varname << " " << params << "]\n"; - errors_occurred = true; - return string(); - } - - // Split the second parameter into tokens based on the spaces. This - // is the set of keys. - vector keys; - tokenize_whitespace(expand_string(tokens[1]), keys); - - return expand_map_variable(varname, tokens[0], keys); -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::expand_map_variable -// Access: Private -// Description: Expands a map variable function reference. This -// looks up the given keys in the map and expands the -// expression for each corresponding scope. -//////////////////////////////////////////////////////////////////// -string PPScope:: -expand_map_variable(const string &varname, const string &expression, - const vector &keys) { - const MapVariableDefinition &def = find_map_variable(varname); - if (&def == &_null_map_def) { - cerr << "Warning: undefined map variable: " << varname << "\n"; - return string(); - } - - vector results; - - // Now build up the set of expansions of the expression in the - // various scopes indicated by the keys. - vector::const_iterator wi; - for (wi = keys.begin(); wi != keys.end(); ++wi) { - MapVariableDefinition::const_iterator di; - di = def.find(*wi); - if (di != def.end()) { - PPScope *scope = (*di).second; - string expansion = scope->expand_string(expression); - if (!expansion.empty()) { - results.push_back(expansion); - } - } - } - - string result = repaste(results, " "); - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::r_expand_matrix -// Access: Private -// Description: The recursive implementation of expand_matrix(). -// This generates all of the combinations from the -// indicated index into the words array, with the given -// prefix. -//////////////////////////////////////////////////////////////////// -void PPScope:: -r_expand_matrix(vector &results, const vector > &words, - int index, const string &prefix) { - if (index >= (int)words.size()) { - // This is the terminal condition. - results.push_back(prefix); - - } else { - // Otherwise, tack on the next set of words, and recurse. - const vector &w = words[index]; - vector::const_iterator wi; - for (wi = w.begin(); wi != w.end(); ++wi) { - r_expand_matrix(results, words, index + 1, prefix + (*wi)); - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::p_find_map_variable -// Access: Private -// Description: The implementation of find_map_variable() for a -// particular static scope, without checking the stack. -//////////////////////////////////////////////////////////////////// -PPScope::MapVariableDefinition &PPScope:: -p_find_map_variable(const string &varname) { - MapVariables::const_iterator mvi; - mvi = _map_variables.find(varname); - if (mvi != _map_variables.end()) { - return (MapVariableDefinition &)(*mvi).second; - } - - if (_parent_scope != (PPScope *)NULL) { - return _parent_scope->p_find_map_variable(varname); - } - - return _null_map_def; -} - -//////////////////////////////////////////////////////////////////// -// Function: PPScope::glob_string -// Access: Private -// Description: Expands the words in the string as if they were a set -// of filenames using the shell globbing characters. -// Fills up the results vector (which the user should -// ensure is empty before calling) with the set of all -// files that actually match the globbing characters. -//////////////////////////////////////////////////////////////////// -void PPScope:: -glob_string(const string &str, vector &results) { - // The globbing is relative to THISDIRPREFIX, not necessarily the - // current directory. - string dirname = trim_blanks(expand_variable("THISDIRPREFIX")); - - vector words; - tokenize_whitespace(str, words); - - vector::const_iterator wi; - for (wi = words.begin(); wi != words.end(); ++wi) { - GlobPattern glob(*wi); - glob.match_files(results, dirname); - } - - // Sort the results into alphabetical order. - sort(results.begin(), results.end()); -} diff --git a/ppremake/ppScope.h b/ppremake/ppScope.h deleted file mode 100644 index 699b874ab6..0000000000 --- a/ppremake/ppScope.h +++ /dev/null @@ -1,180 +0,0 @@ -// Filename: ppScope.h -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPSCOPE_H -#define PPSCOPE_H - -#include "ppremake.h" - -#include -#include - -class PPNamedScopes; -class PPDirectory; -class PPSubroutine; - -/////////////////////////////////////////////////////////////////// -// Class : PPScope -// Description : Defines a (possibly nested) scope for variable -// definitions. Variables may be defined in a -// system-wide variable file, in a template file, or in -// an individual source file. -//////////////////////////////////////////////////////////////////// -class PPScope { -public: - typedef map MapVariableDefinition; - - PPScope(PPNamedScopes *named_scopes); - - PPNamedScopes *get_named_scopes(); - - void set_parent(PPScope *parent); - PPScope *get_parent(); - - void define_variable(const string &varname, const string &definition); - bool set_variable(const string &varname, const string &definition); - void define_map_variable(const string &varname, const string &definition); - void define_map_variable(const string &varname, const string &key_varname, - const string &scope_names); - void add_to_map_variable(const string &varname, const string &key, - PPScope *scope); - void define_formals(const string &subroutine_name, - const vector &formals, const string &actuals); - - string get_variable(const string &varname); - string expand_variable(const string &varname); - MapVariableDefinition &find_map_variable(const string &varname); - - PPDirectory *get_directory(); - void set_directory(PPDirectory *directory); - - string expand_string(const string &str); - string expand_self_reference(const string &str, const string &varname); - - static void push_scope(PPScope *scope); - static PPScope *pop_scope(); - static PPScope *get_bottom_scope(); - static PPScope *get_enclosing_scope(int n); - - void tokenize_params(const string &str, vector &tokens, - bool expand); - bool tokenize_numeric_pair(const string &str, double &a, double &b); - bool tokenize_ints(const string &str, vector &tokens); - size_t scan_to_whitespace(const string &str, size_t start = 0); - static string format_int(int num); - - static MapVariableDefinition _null_map_def; - -private: - class ExpandedVariable { - public: - string _varname; - ExpandedVariable *_next; - }; - - bool p_set_variable(const string &varname, const string &definition); - bool p_get_variable(const string &varname, string &result); - - string r_expand_string(const string &str, ExpandedVariable *expanded); - string r_scan_variable(const string &str, size_t &vp); - string r_expand_variable(const string &str, size_t &vp, - PPScope::ExpandedVariable *expanded); - string expand_variable_nested(const string &varname, - const string &scope_names); - - string expand_isfullpath(const string ¶ms); - string expand_osfilename(const string ¶ms); - string expand_unixfilename(const string ¶ms); - string expand_unixshortname(const string ¶ms); - string expand_cygpath_w(const string ¶ms); - string expand_cygpath_p(const string ¶ms); - string expand_wildcard(const string ¶ms); - string expand_isdir(const string ¶ms); - string expand_isfile(const string ¶ms); - string expand_libtest(const string ¶ms); - string expand_bintest(const string ¶ms); - string expand_shell(const string ¶ms); - string expand_standardize(const string ¶ms); - string expand_canonical(const string ¶ms); - string expand_length(const string ¶ms); - string expand_substr(const string ¶ms); - string expand_findstring(const string ¶ms); - string expand_dir(const string ¶ms); - string expand_notdir(const string ¶ms); - string expand_suffix(const string ¶ms); - string expand_basename(const string ¶ms); - string expand_makeguid(const string ¶ms); - string expand_word(const string ¶ms); - string expand_wordlist(const string ¶ms); - string expand_words(const string ¶ms); - string expand_firstword(const string ¶ms); - string expand_patsubst(const string ¶ms, bool separate_words); - string expand_filter(const string ¶ms); - string expand_filter_out(const string ¶ms); - string expand_wordsubst(const string ¶ms); - string expand_subst(const string ¶ms); - string expand_join(const string ¶ms); - string expand_sort(const string ¶ms); - string expand_unique(const string ¶ms); - string expand_matrix(const string ¶ms); - string expand_if(const string ¶ms); - string expand_defined(const string ¶ms); - string expand_eq(const string ¶ms); - string expand_ne(const string ¶ms); - string expand_eqn(const string ¶ms); - string expand_nen(const string ¶ms); - string expand_ltn(const string ¶ms); - string expand_len(const string ¶ms); - string expand_gtn(const string ¶ms); - string expand_gen(const string ¶ms); - string expand_plus(const string ¶ms); - string expand_minus(const string ¶ms); - string expand_times(const string ¶ms); - string expand_divide(const string ¶ms); - string expand_modulo(const string ¶ms); - string expand_not(const string ¶ms); - string expand_or(const string ¶ms); - string expand_and(const string ¶ms); - string expand_upcase(const string ¶ms); - string expand_downcase(const string ¶ms); - string expand_cdefine(const string ¶ms); - string expand_closure(const string ¶ms); - string expand_unmapped(const string ¶ms); - string expand_dependencies(const string ¶ms); - string expand_foreach(const string ¶ms); - string expand_forscopes(const string ¶ms); - string expand_function(const string &funcname, const PPSubroutine *sub, - const string ¶ms); - string expand_map_variable(const string &varname, const string ¶ms); - string expand_map_variable(const string &varname, const string &expression, - const vector &keys); - - void - r_expand_matrix(vector &results, - const vector > &words, - int index, const string &prefix); - - MapVariableDefinition & - p_find_map_variable(const string &varname); - - void glob_string(const string &str, vector &results); - - PPNamedScopes *_named_scopes; - - PPDirectory *_directory; - - typedef map Variables; - Variables _variables; - - typedef map MapVariables; - MapVariables _map_variables; - - PPScope *_parent_scope; - typedef vector ScopeStack; - static ScopeStack _scope_stack; -}; - - -#endif diff --git a/ppremake/ppSubroutine.cxx b/ppremake/ppSubroutine.cxx deleted file mode 100644 index a6e97d6421..0000000000 --- a/ppremake/ppSubroutine.cxx +++ /dev/null @@ -1,94 +0,0 @@ -// Filename: ppSubroutine.cxx -// Created by: drose (10Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppSubroutine.h" - -PPSubroutine::Subroutines PPSubroutine::_subroutines; -PPSubroutine::Subroutines PPSubroutine::_functions; - -//////////////////////////////////////////////////////////////////// -// Function: PPSubroutine::define_sub -// Access: Public, Static -// Description: Adds a subroutine to the global list with the -// indicated name. The subroutine pointer must have -// been recently allocated, and ownership of the pointer -// will be passed to the global list; it may later -// delete it if another subroutine is defined with the -// same name. -//////////////////////////////////////////////////////////////////// -void PPSubroutine:: -define_sub(const string &name, PPSubroutine *sub) { - Subroutines::iterator si; - si = _subroutines.find(name); - if (si == _subroutines.end()) { - _subroutines.insert(Subroutines::value_type(name, sub)); - } else { - delete (*si).second; - (*si).second = sub; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPSubroutine::get_sub -// Access: Public, Static -// Description: Returns the previously-defined subroutine with the -// given name, or NULL if there is no such subroutine -// with that name. -//////////////////////////////////////////////////////////////////// -const PPSubroutine *PPSubroutine:: -get_sub(const string &name) { - Subroutines::const_iterator si; - si = _subroutines.find(name); - if (si == _subroutines.end()) { - return NULL; - } else { - return (*si).second; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPSubroutine::define_func -// Access: Public, Static -// Description: Adds a function to the global list with the -// indicated name. This is similar to a subroutine -// except it is to be invoked via a variable reference, -// instead of by a #call function. It cannot be -// shadowed by a local variable; it will always override -// any variable definition. -// -// The subroutine pointer must have been recently -// allocated, and ownership of the pointer will be -// passed to the global list; it may later delete it if -// another subroutine is defined with the same name. -//////////////////////////////////////////////////////////////////// -void PPSubroutine:: -define_func(const string &name, PPSubroutine *sub) { - Subroutines::iterator si; - si = _functions.find(name); - if (si == _functions.end()) { - _functions.insert(Subroutines::value_type(name, sub)); - } else { - delete (*si).second; - (*si).second = sub; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: PPSubroutine::get_func -// Access: Public, Static -// Description: Returns the previously-defined function with the -// given name, or NULL if there is no such function -// with that name. -//////////////////////////////////////////////////////////////////// -const PPSubroutine *PPSubroutine:: -get_func(const string &name) { - Subroutines::const_iterator si; - si = _functions.find(name); - if (si == _functions.end()) { - return NULL; - } else { - return (*si).second; - } -} diff --git a/ppremake/ppSubroutine.h b/ppremake/ppSubroutine.h deleted file mode 100644 index 84048edc08..0000000000 --- a/ppremake/ppSubroutine.h +++ /dev/null @@ -1,39 +0,0 @@ -// Filename: ppSubroutine.h -// Created by: drose (10Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef PPSUBROUTINE_H -#define PPSUBROUTINE_H - -#include "ppremake.h" - -#include -#include - -/////////////////////////////////////////////////////////////////// -// Class : PPSubroutine -// Description : This represents a named subroutine defined via the -// #defsub .. #end sequence that may be invoked at any -// time via #call. All subroutine definitions are -// global. -//////////////////////////////////////////////////////////////////// -class PPSubroutine { -public: - vector _formals; - vector _lines; - -public: - static void define_sub(const string &name, PPSubroutine *sub); - static const PPSubroutine *get_sub(const string &name); - - static void define_func(const string &name, PPSubroutine *sub); - static const PPSubroutine *get_func(const string &name); - - typedef map Subroutines; - static Subroutines _subroutines; - static Subroutines _functions; -}; - -#endif - diff --git a/ppremake/ppremake.cxx b/ppremake/ppremake.cxx deleted file mode 100644 index 3d3f79c954..0000000000 --- a/ppremake/ppremake.cxx +++ /dev/null @@ -1,490 +0,0 @@ -// Filename: ppremake.cxx -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "ppremake.h" -#include "ppMain.h" -#include "ppScope.h" -#include "check_include.h" -#include "tokenize.h" -#include "sedProcess.h" - -#ifdef HAVE_UNISTD_H - #include -#endif - -#if HAVE_GETOPT - #ifdef HAVE_GETOPT_H - #include - #endif // HAVE_GETOPT_H -#else - #include "gnu_getopt.h" -#endif // HAVE_GETOPT - -#include -#include -#include -#include -#include - -bool unix_platform = false; -bool windows_platform = false; -bool dry_run = false; -bool verbose_dry_run = false; -int verbose = 0; -int debug_expansions = 0; - -bool errors_occurred = false; - -DebugExpand debug_expand; - -class DebugExpandReport { -public: - DebugExpandReport(DebugExpand::const_iterator source, - ExpandResultCount::const_iterator result) : - _source(source), - _result(result) - { } - - const string &get_source() const { - return (*_source).first; - } - const string &get_result() const { - return (*_result).first; - } - int get_count() const { - return (*_result).second; - } - - bool operator < (const DebugExpandReport &other) const { - return get_count() > other.get_count(); - } - - DebugExpand::const_iterator _source; - ExpandResultCount::const_iterator _result; -}; - - -static void -usage() { - cerr << - "\n" - "ppremake [opts] subdir-name [subdir-name..]\n" - "ppremake\n" - "ppremake -s 'sed-command' output\n" - "\n" - "This is Panda pre-make: a script preprocessor that scans the source\n" - "directory hierarchy containing the current directory, looking for\n" - "directories that contain a file called " SOURCE_FILENAME ". At the top of the\n" - "directory tree must be a file called " PACKAGE_FILENAME ", which should define\n" - "key variable definitions for processing, as well as pointing out the\n" - "locations of further config files.\n\n" - - "The package file is read and interpreted, followed by each source file\n" - "in turn; after each source file is read, the template file (specified in\n" - "the config file) is read. The template file contains the actual statements\n" - "to be output and will typically be set up to generate Makefiles or whatever\n" - "is equivalent and appropriate to the particular build environment in use.\n\n" - - "The parameters are the names of the subdirectories (their local names, not\n" - "the relative or full paths to them) that are to be processed. All\n" - "subdirectories (that contain a file named " SOURCE_FILENAME ") will be\n" - "scanned, but only the named subdirectories will have output files\n" - "generated. If no parameter is given, then all directories will be\n" - "processed.\n\n" - - "ppremake -s is a special form of the command that runs as a very limited\n" - "sed. It has nothing to do with building makefiles, but is provided mainly\n" - "so platforms that don't have sed built in can still portably run simple sed\n" - "scripts.\n\n" - - "Options:\n\n" - - " -h Display this page.\n" - " -V Report the version of ppremake, and exit.\n" - " -I Report the compiled-in default for INSTALL_DIR, and exit.\n" - " -v Turn on verbose output (may help in debugging .pp files).\n" - " -vv Be very verbose (if you're getting desperate).\n" - " -x count Print a histogram of the count most-frequently expanded strings\n" - " and their results. Useful to optimize .pp scripts so that\n" - " variables are not needlessly repeatedly expanded.\n\n" - - " -P Report the current platform name, and exit.\n\n" - - " -D pp.dep Examine the given dependency file, and re-run ppremake\n" - " only if the dependency file is stale.\n\n" - - " -d Instead of generating makefiles, report the set of\n" - " subdirectories that the named subdirectory depends on.\n" - " Directories are named by their local name, not by the\n" - " path to them; e.g. util instead of src/util.\n" - " -r Reverse dependency. As above, but report instead the set\n" - " of directories that depend on the named subdirectory.\n" - " Options -d and -r may be combined, and you may also\n" - " name multiple subdirectories to scan at once.\n\n" - " -n Dry run: generate no output, but instead report the\n" - " files that would change.\n" - " -N Verbose dry run: show the output of diff for the files\n" - " that would change (not supported in Win32-only version).\n\n" - " -p platform Build as if for the indicated platform name. The default\n" - " for this build is \"" << PLATFORM << "\".\n" - " -c config.pp Read the indicated user-level config.pp file after reading\n" - " the system config.pp file. If this is omitted, the value\n" - " given in the environment variable PPREMAKE_CONFIG is used\n" - " instead.\n\n"; -} - -static void -report_version() { - cerr << "This is " << PACKAGE << " version " << VERSION - << " built on " << __DATE__ << " at " << __TIME__ - << ".\n" - << "Default platform is \"" << PLATFORM << "\".\n"; -} - -static void -report_install_dir() { - cerr << "Default value for INSTALL_DIR is " << INSTALL_DIR << ".\n"; -} - -static void -report_platform() { - cerr << "ppremake built for default platform " << PLATFORM << ".\n"; -} - -//////////////////////////////////////////////////////////////////// -// Function: check_one_file -// Description: Checks a single file listed in the dependency cache -// to see if it matches the cache. Returns true if it -// does, false if it does not. -//////////////////////////////////////////////////////////////////// -static bool -check_one_file(const string &dir_prefix, const vector &words) { - assert(words.size() >= 2); - - string pathname = dir_prefix + words[0]; - time_t mtime = strtol(words[1].c_str(), (char **)NULL, 10); - - struct stat st; - if (stat(pathname.c_str(), &st) < 0) { - // The file doesn't even exist! - return false; - } - - if (st.st_mtime == mtime) { - // The modification time matches; don't bother to read the file. - return true; - } - - // The modification time doesn't match, so we'll need to read the - // file and look for #include directives. First, get the complete - // set of files we're expecting to find. - - set expected_files; - for (int i = 2; i < (int)words.size(); i++) { - const string &word = words[i]; - size_t slash = word.rfind('/'); - if (slash == string::npos) { - // Every file is expected to include a slash. - return false; - } - expected_files.insert(word.substr(slash + 1)); - } - - // Now open the source file and read it for #include directives. - set found_files; - ifstream in(pathname.c_str()); - if (!in) { - // Can't read the file for some reason. - return false; - } - if (verbose) { - cerr << "Reading (one) \"" << pathname.c_str() << "\"\n"; - } - - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - string filename = check_include(line); - if (!filename.empty() && filename.find('/') == string::npos) { - found_files.insert(filename); - } - getline(in, line); - } - - // Now check that the two sets are equivalent. - return (expected_files == found_files); -} - -//////////////////////////////////////////////////////////////////// -// Function: check_dependencies -// Description: Read in the indicated dependency cache file, -// verifying that it is still current. If it is stale, -// return false; otherwise, return true. -//////////////////////////////////////////////////////////////////// -static bool -check_dependencies(const string &dep_filename) { - // Extract the directory prefix from the dependency filename. This - // is everything up until (and including) the last slash. - string dir_prefix; - size_t slash = dep_filename.rfind('/'); - if (slash != string::npos) { - dir_prefix = dep_filename.substr(0, slash + 1); - } - - ifstream in(dep_filename.c_str()); - if (!in) { - // The dependency filename doesn't even exist: it's definitely - // stale. - return false; - } - if (verbose) { - cerr << "Reading (chk) \"" << dep_filename.c_str() << "\"\n"; - } - - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - vector words; - tokenize_whitespace(line, words); - if (words.size() < 2) { - // Invalid file; return false. - return false; - } - if (!check_one_file(dir_prefix, words)) { - // This file is stale; return false. - return false; - } - getline(in, line); - } - - // All files are ok; return true. - return true; -} - -int -main(int argc, char *argv[]) { - string progname = argv[0]; - extern char *optarg; - extern int optind; - const char *optstr = "hVIvx:PD:drnNp:c:s:"; - - bool any_d = false; - bool dependencies_stale = false; - bool report_depends = false; - bool report_reverse_depends = false; - - string platform; - char *platform_env = getenv("PPREMAKE_PLATFORM"); - if(platform_env==NULL) { - platform=PLATFORM; - } else { - platform=platform_env; - } - - string ppremake_config; - bool got_ppremake_config = false; - string sed_command; - bool got_sed_command = false; - int flag = getopt(argc, argv, optstr); - - while (flag != EOF) { - switch (flag) { - case 'h': - usage(); - exit(0); - - case 'V': - report_version(); - exit(0); - break; - - case 'I': - report_install_dir(); - exit(0); - break; - - case 'v': - ++verbose; - break; - - case 'x': - debug_expansions = atoi(optarg); - break; - - case 'P': - report_platform(); - exit(0); - break; - - case 'D': - if (!check_dependencies(optarg)) { - dependencies_stale = true; - } - any_d = true; - break; - - case 'd': - report_depends = true; - break; - - case 'r': - report_reverse_depends = true; - break; - - case 'n': - dry_run = true; - break; - - case 'N': - dry_run = true; - verbose_dry_run = true; - break; - - case 'p': - platform = optarg; - break; - - case 'c': - ppremake_config = optarg; - got_ppremake_config = true; - break; - - case 's': - sed_command = optarg; - got_sed_command = true; - break; - - default: - exit(1); - } - flag = getopt(argc, argv, optstr); - } - - argc -= (optind-1); - argv += (optind-1); - - if (got_sed_command) { - SedProcess sp; - if (!sp.add_script_line(sed_command)) { - exit(1); - } - sp.run(cin, cout); - exit(0); - } - -#ifdef WIN32_VC - if (verbose_dry_run) { - cerr << "Option -N treated like -n when ppremake is built without Cygwin.\n"; - } -#endif - - // If the user supplied one or more -d parameters, then we should - // not continue unless some of the dependencies were stale. - if (any_d) { - if (!dependencies_stale) { - exit(0); - } - cout << progname << "\n"; - } - - PPScope global_scope((PPNamedScopes *)NULL); - global_scope.define_variable("PPREMAKE", PACKAGE); - global_scope.define_variable("PPREMAKE_VERSION", VERSION); - global_scope.define_variable("PLATFORM", platform); - global_scope.define_variable("PACKAGE_FILENAME", PACKAGE_FILENAME); - global_scope.define_variable("SOURCE_FILENAME", SOURCE_FILENAME); - global_scope.define_variable("INSTALL_DIR", INSTALL_DIR); - - if (got_ppremake_config) { - // If this came in on the command line, define a variable as such. - // Otherwise, the system scripts can pull this value in from the - // similarly-named environment variable. - global_scope.define_variable("PPREMAKE_CONFIG", ppremake_config); - } - - // Also, it's convenient to have a way to represent the literal tab - // character, without actually putting a literal tab character in - // the source file. Similarly with some other special characters. - global_scope.define_variable("TAB", "\t"); - global_scope.define_variable("SPACE", " "); - global_scope.define_variable("DOLLAR", "$"); - global_scope.define_variable("HASH", "#"); - - PPMain ppmain(&global_scope); - if (!ppmain.read_source(".")) { - exit(1); - } - - if (report_depends || report_reverse_depends) { - // With -d or -n, just report inter-directory dependency - // relationships. - if (argc < 2) { - cerr << "No named directories.\n"; - exit(1); - } - - for (int i = 1; i < argc; i++) { - cerr << "\n"; - if (report_depends) { - ppmain.report_depends(argv[i]); - } - cerr << "\n"; - if (report_reverse_depends) { - ppmain.report_reverse_depends(argv[i]); - } - } - - } else { - // Without -d or -n, do normal processing. - - if (argc < 2) { - if (!ppmain.process_all()) { - exit(1); - } - } else { - for (int i = 1; i < argc; i++) { - if (!ppmain.process(argv[i])) { - cerr << "Unable to process " << argv[i] << ".\n"; - exit(1); - } - } - } - } - - if (debug_expansions > 0) { - // Now report the worst expansion offenders. These are the - // strings that were most often expanded to the same thing. - cerr << "\nExpansion report:\n"; - vector report; - - DebugExpand::const_iterator dei; - for (dei = debug_expand.begin(); dei != debug_expand.end(); ++dei) { - const ExpandResultCount &result_count = (*dei).second; - ExpandResultCount::const_iterator rci; - for (rci = result_count.begin(); rci != result_count.end(); ++rci) { - report.push_back(DebugExpandReport(dei, rci)); - } - } - - sort(report.begin(), report.end()); - - int num_reports = min((int)report.size(), debug_expansions); - for (int i = 0; i < num_reports; i++) { - cerr << "\"" << report[i].get_source() << "\" -> \"" - << report[i].get_result() - << "\" (" << report[i].get_count() << ")\n"; - } - cerr << "\n"; - } - - if (errors_occurred) { - cerr << "Errors occurred during ppremake.\n"; - return (1); - - } else { - cerr << "No errors.\n"; - return (0); - } -} diff --git a/ppremake/ppremake.h b/ppremake/ppremake.h deleted file mode 100644 index e484ae479a..0000000000 --- a/ppremake/ppremake.h +++ /dev/null @@ -1,143 +0,0 @@ -/* -// Filename: ppremake.h -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// -*/ - -#ifndef PPREMAKE_H -#define PPREMAKE_H - -#ifdef _MSC_VER - /* For Visual C, include the special config.h file. */ - #include "config_msvc.h" -#else - /* Otherwise, include the normal automatically-generated file. */ - #include "config.h" -#endif - -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - -#ifdef __cplusplus -#ifdef HAVE_IOSTREAM -#include -#include -#include -#ifdef HAVE_SSTREAM -#include -#else /* HAVE_SSTREAM */ -#include -#endif /* HAVE_SSTREAM */ - -typedef std::ios::openmode ios_openmode; -typedef std::ios::fmtflags ios_fmtflags; -typedef std::ios::iostate ios_iostate; -typedef std::ios::seekdir ios_seekdir; - -#else /* HAVE_IOSTREAM */ -#include -#include -#include -#include - -typedef int ios_openmode; -typedef int ios_fmtflags; -typedef int ios_iostate; -/* Old iostream libraries used ios::seek_dir instead of ios::seekdir. */ -typedef ios::seek_dir ios_seekdir; - -#endif /* HAVE_IOSTREAM */ - -#if defined(HAVE_CYGWIN) || defined(WIN32_VC) -/* Either Cygwin or Visual C++ is a Win32 environment. */ -#define WIN32 -#endif - -#include -#include - -#ifdef HAVE_NAMESPACE -using namespace std; -#endif -#endif /* __cplusplus */ - -#ifndef HAVE_ALLOCA_H - /* If we don't have alloca.h, use malloc() to implement gnu_regex. */ - #define REGEX_MALLOC 1 -#endif - -#define PACKAGE_FILENAME "Package.pp" -#define SOURCE_FILENAME "Sources.pp" - -#define COMMAND_PREFIX '#' -#define VARIABLE_PREFIX '$' -#define VARIABLE_OPEN_BRACE '[' -#define VARIABLE_CLOSE_BRACE ']' -#define PATTERN_WILDCARD '%' -#define BEGIN_COMMENT "//" - -#define FUNCTION_PARAMETER_SEPARATOR ',' - -#define VARIABLE_OPEN_NESTED '(' -#define VARIABLE_CLOSE_NESTED ')' -#define VARIABLE_PATSUBST ":" -#define VARIABLE_PATSUBST_DELIM "=" - -#define SCOPE_DIRNAME_SEPARATOR '/' -#define SCOPE_DIRNAME_WILDCARD "*" -#define SCOPE_DIRNAME_CURRENT "." - -#ifdef __cplusplus -/* These are set from the similarly-named variables defined in - System.pp. */ -extern bool unix_platform; -extern bool windows_platform; - -/* This is a command-line global parameter. */ -extern bool dry_run; -extern bool verbose_dry_run; -extern int verbose; // 0..9 to set verbose level. 0 == off. -extern int debug_expansions; - -/* This is set true internally if an error occurred while processing - any of the scripts. */ -extern bool errors_occurred; - -/* This structure tracks the number of expansions that are performed - on a particular string, and the different values it produces, only - if debug_expansions (above) is set true by command-line parameter - -x. */ -typedef map ExpandResultCount; -typedef map DebugExpand; -extern DebugExpand debug_expand; - -#endif - -/* These are defined so that we may build Filename, DSearchPath, and - GlobPattern, which are copied from dtool and panda. We have to - copy these files in since ppremake must be built first, and stands - outside of Panda; but we want to minimize the changes we must make - to these files so that we can easily recopy them at need. - - These symbols just make the build environment a bit more - Panda-like. */ -#define PUBLISHED public -#define INLINE inline -#define EXPCL_DTOOL -#define EXPCL_PANDA - -#endif diff --git a/ppremake/ppremake.sln b/ppremake/ppremake.sln deleted file mode 100644 index 18746235a5..0000000000 --- a/ppremake/ppremake.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ppremake", "ppremake.vcproj", "{B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}.Debug.ActiveCfg = Debug|Win32 - {B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}.Debug.Build.0 = Debug|Win32 - {B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}.Release.ActiveCfg = Release|Win32 - {B2B6A5F5-4403-4386-9294-B10EE8B0B3E8}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/ppremake/ppremake.vcproj b/ppremake/ppremake.vcproj deleted file mode 100644 index 1e339d6aef..0000000000 --- a/ppremake/ppremake.vcproj +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ppremake/ppremake.vsdir b/ppremake/ppremake.vsdir deleted file mode 100644 index 756c0584e9..0000000000 --- a/ppremake/ppremake.vsdir +++ /dev/null @@ -1 +0,0 @@ -ppremake.vsz| |ppremake|1|TODO: Wizard Description.| |6777| |ppremake diff --git a/ppremake/ppremake.vsz b/ppremake/ppremake.vsz deleted file mode 100644 index 80460fe966..0000000000 --- a/ppremake/ppremake.vsz +++ /dev/null @@ -1,8 +0,0 @@ -VSWIZARD 7.0 -Wizard=VsWizard.VsWizardEngine - -Param="WIZARD_NAME = ppremake" -Param="ABSOLUTE_PATH = C:\Cygwin\home\drose\player\ppremake" -Param="FALLBACK_LCID = 1033" -Param="WIZARD_UI = FALSE" -Param="SOURCE_FILTER = txt" diff --git a/ppremake/sedAddress.cxx b/ppremake/sedAddress.cxx deleted file mode 100644 index f1d37a32c4..0000000000 --- a/ppremake/sedAddress.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Filename: sedAddress.cxx -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "sedAddress.h" -#include "sedContext.h" - -#include -#include -#include - -//////////////////////////////////////////////////////////////////// -// Function: SedAddress::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedAddress:: -SedAddress() { - _address_type = AT_invalid; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedAddress::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedAddress:: -~SedAddress() { - if (_address_type == AT_re) { - regfree(&_re); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: SedAddress::parse_address -// Access: Public -// Description: Scans the indicated string beginning at the indicated -// character position for an address specification, -// e.g. a number, $, or a regular expression. If a -// correct address is found, increments p to the first -// non-whitespace character past it and returns true; -// otherwise, returns false. -//////////////////////////////////////////////////////////////////// -bool SedAddress:: -parse_address(const string &line, size_t &p) { - assert(p < line.length()); - if (line[p] == '$') { - p++; - _address_type = AT_last; - - } else if (isdigit(line[p])) { - const char *str = line.c_str() + p; - char *end; - _number = strtol(str, &end, 10); - _address_type = AT_numeric; - p += (end - str); - - } else { - // It must be a regular expression. - size_t p0 = p; - char delimiter = line[p]; - p++; - if (p < line.length() && delimiter == '\\') { - // A backslash might escape the opening character. - delimiter = line[p]; - p++; - } - - size_t begin = p; - while (p < line.length() && line[p] != delimiter) { - if (line[p] == '\\') { - p++; - // A backslash could escape the closing character. - } - p++; - } - - if (p >= line.length()) { - cerr << "Could not find terminating character '" << delimiter - << "' in regular expression: " << line.substr(p0) << "\n"; - return false; - } - - string re = line.substr(begin, p - begin); - p++; - - int error = regcomp(&_re, re.c_str(), REG_NOSUB); - if (error != 0) { - static const int errbuf_size = 512; - char errbuf[errbuf_size]; - regerror(error, &_re, errbuf, errbuf_size); - - cerr << "Invalid regular expression: " << re << "\n" - << errbuf << "\n"; - return false; - } - - _address_type = AT_re; - } - - // Skip whitespace following the address. - while (p < line.length() && isspace(line[p])) { - p++; - } - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedAddress::matches -// Access: Public -// Description: Returns true if this address exactly matches the -// current pattern space. -//////////////////////////////////////////////////////////////////// -bool SedAddress:: -matches(const SedContext &context) const { - switch (_address_type) { - case AT_invalid: - cerr << "Internal error!\n"; - assert(false); - return false; - - case AT_numeric: - return (_number == context._line_number); - - case AT_last: - return context._is_last_line; - - case AT_re: - return (regexec(&_re, context._pattern_space.c_str(), 0, (regmatch_t *)NULL, 0) == 0); - } - - return false; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedAddress::precedes -// Access: Public -// Description: Returns true if this address exactly matches the -// current line or refers to a previous line. This -// never returns true if the address is a regular -// expression type. -//////////////////////////////////////////////////////////////////// -bool SedAddress:: -precedes(const SedContext &context) const { - if (_address_type == AT_numeric) { - return (_number <= context._line_number); - } - - return false; -} - diff --git a/ppremake/sedAddress.h b/ppremake/sedAddress.h deleted file mode 100644 index 284827ee97..0000000000 --- a/ppremake/sedAddress.h +++ /dev/null @@ -1,49 +0,0 @@ -// Filename: sedAddress.h -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef SEDADDRESS_H -#define SEDADDRESS_H - -#include "ppremake.h" - -#include - -#ifdef HAVE_REGEX_H -#include -#else -#include "gnu_regex.h" -#endif - -class SedContext; - -/////////////////////////////////////////////////////////////////// -// Class : SedAddress -// Description : This represents a single address in a sed command, -// something like a line number or a regular expression. -//////////////////////////////////////////////////////////////////// -class SedAddress { -public: - SedAddress(); - ~SedAddress(); - - bool parse_address(const string &line, size_t &p); - - bool matches(const SedContext &context) const; - bool precedes(const SedContext &context) const; - -private: - enum AddressType { - AT_invalid, - AT_numeric, - AT_last, - AT_re, - }; - AddressType _address_type; - - int _number; - regex_t _re; -}; - -#endif diff --git a/ppremake/sedCommand.cxx b/ppremake/sedCommand.cxx deleted file mode 100644 index c9f07434eb..0000000000 --- a/ppremake/sedCommand.cxx +++ /dev/null @@ -1,341 +0,0 @@ -// Filename: sedCommand.cxx -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "sedCommand.h" -#include "sedAddress.h" -#include "sedContext.h" -#include "sedScript.h" - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedCommand:: -SedCommand() { - _addr1 = (SedAddress *)NULL; - _addr2 = (SedAddress *)NULL; - _command = '\0'; - _flags = 0; - _active = false; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedCommand:: -~SedCommand() { - if (_addr1 != (SedAddress *)NULL) { - delete _addr1; - } - if (_addr2 != (SedAddress *)NULL) { - delete _addr2; - } - if ((_flags & F_have_re) != 0) { - regfree(&_re); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::parse_command -// Access: Public -// Description: Scans the indicated string at the given character -// position for a legal command. If a legal command is -// found, stores it and increments p to the first -// non-whitespace character after the command, returning -// true. Otherwise, returns false. -//////////////////////////////////////////////////////////////////// -bool SedCommand:: -parse_command(const string &line, size_t &p) { - // First, skip initial whitespace. - while (p < line.length() && isspace(line[p])) { - p++; - } - - // Now, check for an address. - if (p < line.length() && - (isdigit(line[p]) || line[p] == '/' || line[p] == '\\')) { - _addr1 = new SedAddress; - if (!_addr1->parse_address(line, p)) { - return false; - } - - if (p < line.length() && line[p] == ',') { - // Another address. - - // Skip the comma and more whitespace. - p++; - while (p < line.length() && isspace(line[p])) { - p++; - } - - _addr2 = new SedAddress; - if (!_addr2->parse_address(line, p)) { - return false; - } - } - } - - if (p >= line.length()) { - // It's a null command, which is acceptable; ignore it. - return true; - } - - _command = line[p]; - - // Skip more whitespace after the command letter. - p++; - while (p < line.length() && isspace(line[p])) { - p++; - } - - // At the moment, we only accept a small subset of sed commands. We - // can add more later as we see the need. - switch (_command) { - case 'd': - // No arguments. - return true; - - case 's': - // /regexp/repl/flags - return parse_s_params(line, p); - - default: - cerr << "Unknown command: " << _command << "\n"; - return false; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::run -// Access: Public -// Description: Runs the script command, modifying the context and/or -// the script position as appropriate. -//////////////////////////////////////////////////////////////////// -void SedCommand:: -run(SedScript &script, SedContext &context) { - // First, see if this command matches the pattern space. - bool matches = false; - - if (_addr1 != (SedAddress *)NULL && _addr2 != (SedAddress *)NULL) { - // If the user supplied two addresses, all lines inclusive between - // the lines matched by the two addresses are considered matching. - if (_active) { - // We have previously matched _addr1. Therefore this line is - // in, but are the rest of the lines following this one? - matches = true; - if (_addr2->matches(context)) { - // If this line matches addr2, that's the end of our range for - // next time. - _active = false; - } - } else { - // We have not yet matched _addr1. This line and subsequent - // lines are in only if we match now. - if (_addr1->matches(context)) { - matches = true; - if (!_addr2->precedes(context)) { - _active = true; - } - } - } - - } else if (_addr1 != (SedAddress *)NULL) { - // If the user supplied only one address, only those lines that - // exactly match the address are considered matching. - matches = _addr1->matches(context); - - } else { - // If the user supplied no addresses, all lines are considered - // matching. - matches = true; - } - - if (matches) { - do_command(script, context); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::parse_s_params -// Access: Private -// Description: Parses the /regexp/replacement/flags parameters that -// follow the 's' command. -//////////////////////////////////////////////////////////////////// -bool SedCommand:: -parse_s_params(const string &line, size_t &p) { - size_t p0 = p; - char delimiter = line[p]; - p++; - if (p < line.length() && delimiter == '\\') { - // A backslash might escape the opening character. - delimiter = line[p]; - p++; - } - - size_t begin = p; - while (p < line.length() && line[p] != delimiter) { - if (line[p] == '\\') { - p++; - // A backslash could escape the closing character. - } - p++; - } - - if (p >= line.length()) { - cerr << "Could not find terminating character '" << delimiter - << "' in regular expression: " << line.substr(p0) << "\n"; - return false; - } - - string re = line.substr(begin, p - begin); - p++; - - int error = regcomp(&_re, re.c_str(), 0); - if (error != 0) { - static const int errbuf_size = 512; - char errbuf[errbuf_size]; - regerror(error, &_re, errbuf, errbuf_size); - - cerr << "Invalid regular expression: " << re << "\n" - << errbuf << "\n"; - return false; - } - _flags |= F_have_re; - - // Get the replacement string. - begin = p; - while (p < line.length() && line[p] != delimiter) { - if (line[p] == '\\') { - p++; - // A backslash could escape the closing character. - } - p++; - } - - if (p >= line.length()) { - cerr << "Could not find terminating character '" << delimiter - << "' in replacement string: " << line.substr(p0) << "\n"; - return false; - } - - _string2 = line.substr(begin, p - begin); - - // Skip the final delimiter. - p++; - if (p < line.length() && line[p] == 'g') { - // Global flag. - p++; - _flags |= F_g; - } - - // Skip any more whitespace after the parameters. - while (p < line.length() && isspace(line[p])) { - p++; - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::do_command -// Access: Private -// Description: Actually invokes the command, once it has been -// determined that the command applied to the current -// pattern space. -//////////////////////////////////////////////////////////////////// -void SedCommand:: -do_command(SedScript &script, SedContext &context) { - switch (_command) { - case '\0': - // Null command. - return; - - case 'd': - // Delete line. - context._deleted = true; - script._next_command = script._commands.end(); - return; - - case 's': - // Substitute. - do_s_command(context); - return; - } - - cerr << "Undefined command: " << _command << "\n"; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedCommand::do_s_command -// Access: Private -// Description: Invokes the s command, which performs a -// pattern/replacement substitution. -//////////////////////////////////////////////////////////////////// -void SedCommand:: -do_s_command(SedContext &context) { - size_t nmatch = _re.re_nsub + 1; - regmatch_t *pmatch = new regmatch_t[nmatch]; - - string result; - const char *str = context._pattern_space.c_str(); - int error = regexec(&_re, str, nmatch, pmatch, 0); - while (error == 0) { - // Here's a match. Determine the replacement. - string repl; - - size_t p = 0; - while (p < _string2.length()) { - if (_string2[p] == '\\') { - p++; - if (p < _string2.length()) { - if (isdigit(_string2[p])) { - // Here's a subexpression reference. - const char *numstr = _string2.c_str() + p; - char *numend; - int ref = strtol(numstr, &numend, 10); - p += (numend - numstr); - if (ref <= 0 || ref >= (int)nmatch) { - cerr << "Invalid subexpression number: " << ref << "\n"; - } else { - repl += string(str + pmatch[ref].rm_so, - pmatch[ref].rm_eo - pmatch[ref].rm_so); - } - } else { - // Here's an escaped character. - repl += _string2[p]; - p++; - } - } - } else { - // Here's a normal character. - repl += _string2[p]; - p++; - } - } - - // Store the result so far. - result += string(str, pmatch[0].rm_so); - result += repl; - str += pmatch[0].rm_eo; - - if ((_flags & F_g) == 0) { - // If we don't have the global flag set, stop after the first iteration. - result += str; - context._pattern_space = result; - delete[] pmatch; - return; - } - - error = regexec(&_re, str, nmatch, pmatch, 0); - } - - // All done. - result += str; - context._pattern_space = result; - delete[] pmatch; -} diff --git a/ppremake/sedCommand.h b/ppremake/sedCommand.h deleted file mode 100644 index 0db78bc57f..0000000000 --- a/ppremake/sedCommand.h +++ /dev/null @@ -1,63 +0,0 @@ -// Filename: sedCommand.h -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef SEDCOMMAND_H -#define SEDCOMMAND_H - -#include "ppremake.h" - -#include - -#ifdef HAVE_REGEX_H -#include -#else -#include "gnu_regex.h" -#endif - - -class SedScript; -class SedContext; -class SedAddress; - -/////////////////////////////////////////////////////////////////// -// Class : SedCommand -// Description : This represents a single command (of several -// possible, separated by semicolons) to a SedProgram. -//////////////////////////////////////////////////////////////////// -class SedCommand { -public: - SedCommand(); - ~SedCommand(); - - bool parse_command(const string &line, size_t &p); - - void run(SedScript &script, SedContext &context); - -private: - bool parse_s_params(const string &line, size_t &p); - void do_command(SedScript &script, SedContext &context); - void do_s_command(SedContext &context); - - SedAddress *_addr1; - SedAddress *_addr2; - char _command; - - string _text; - - regex_t _re; - string _string1; - string _string2; - - enum Flags { - F_have_re = 0x001, - F_g = 0x002, - }; - - int _flags; - - bool _active; -}; - -#endif diff --git a/ppremake/sedContext.cxx b/ppremake/sedContext.cxx deleted file mode 100644 index 90d0fae4a7..0000000000 --- a/ppremake/sedContext.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// Filename: sedContext.cxx -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "sedContext.h" - - -//////////////////////////////////////////////////////////////////// -// Function: SedContext::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedContext:: -SedContext(ostream &out) : _out(out) { - _line_number = 0; - _is_last_line = false; - _deleted = false; -} diff --git a/ppremake/sedContext.h b/ppremake/sedContext.h deleted file mode 100644 index cb55f90f4c..0000000000 --- a/ppremake/sedContext.h +++ /dev/null @@ -1,31 +0,0 @@ -// Filename: sedContext.h -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef SEDCONTEXT_H -#define SEDCONTEXT_H - -#include "ppremake.h" - -/////////////////////////////////////////////////////////////////// -// Class : SedContext -// Description : This contains the current context of the sed process -// as it is running: the pattern space, the hold space, -// and the current line numbers, etc. It is updated as -// each line is read in and as each command is executed. -//////////////////////////////////////////////////////////////////// -class SedContext { -public: - SedContext(ostream &out); - - int _line_number; - bool _is_last_line; - string _pattern_space; - string _hold_space; - bool _deleted; - - ostream &_out; -}; - -#endif diff --git a/ppremake/sedProcess.cxx b/ppremake/sedProcess.cxx deleted file mode 100644 index 472a9e6f9d..0000000000 --- a/ppremake/sedProcess.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: sedProcess.cxx -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "sedProcess.h" -#include "sedContext.h" - -//////////////////////////////////////////////////////////////////// -// Function: SedProcess::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedProcess:: -SedProcess() { -} - -//////////////////////////////////////////////////////////////////// -// Function: SedProcess::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedProcess:: -~SedProcess() { -} - - -//////////////////////////////////////////////////////////////////// -// Function: SedProcess::add_script_line -// Access: Public -// Description: Appends the indicated line to the end of the script -// that will be executed for each line of the input -// stream. This may be called as many times as you -// like. -// -// The return value is true if the line was added -// successfully, or false if there was an error in the -// line (in which case, some commands on the line might -// have been added, and others not). -//////////////////////////////////////////////////////////////////// -bool SedProcess:: -add_script_line(const string &line) { - return _script.add_line(line); -} - - -//////////////////////////////////////////////////////////////////// -// Function: SedProcess::run -// Access: Public -// Description: Reads the input stream and executes the script once -// for each line on the input stream. Output is written -// to the indicated output stream. -//////////////////////////////////////////////////////////////////// -void SedProcess:: -run(istream &in, ostream &out) { - SedContext context(out); - - string line; - getline(in, line); - while (!in.fail() && !in.eof()) { - context._pattern_space = line; - context._line_number++; - getline(in, line); - - if (in.eof()) { - context._is_last_line = true; - } - _script.run(context); - } -} diff --git a/ppremake/sedProcess.h b/ppremake/sedProcess.h deleted file mode 100644 index 715bdf9845..0000000000 --- a/ppremake/sedProcess.h +++ /dev/null @@ -1,30 +0,0 @@ -// Filename: sedProcess.h -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef SEDPROCESS_H -#define SEDPROCESS_H - -#include "ppremake.h" -#include "sedScript.h" - -/////////////////////////////////////////////////////////////////// -// Class : SedProcess -// Description : This supervises the whole sed process, from beginning -// to end. -//////////////////////////////////////////////////////////////////// -class SedProcess { -public: - SedProcess(); - ~SedProcess(); - - bool add_script_line(const string &line); - - void run(istream &in, ostream &out); - -private: - SedScript _script; -}; - -#endif diff --git a/ppremake/sedScript.cxx b/ppremake/sedScript.cxx deleted file mode 100644 index 16d1c0809c..0000000000 --- a/ppremake/sedScript.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Filename: sedScript.cxx -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#include "sedScript.h" -#include "sedCommand.h" -#include "sedContext.h" - - -//////////////////////////////////////////////////////////////////// -// Function: SedScript::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedScript:: -SedScript() { - _quit = false; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedScript::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -SedScript:: -~SedScript() { - Commands::iterator ci; - for (ci = _commands.begin(); ci != _commands.end(); ++ci) { - delete (*ci); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: SedScript::add_line -// Access: Public -// Description: Adds the indicated script line to the script. -// Returns true if it is a valid line, false if there is -// an error. -//////////////////////////////////////////////////////////////////// -bool SedScript:: -add_line(const string &line) { - size_t p = 0; - SedCommand *command = new SedCommand; - if (!command->parse_command(line, p)) { - // That's an invalid command. - delete command; - return false; - } - _commands.push_back(command); - - while (p < line.length()) { - // There's more to the line. - if (line[p] != ';') { - // But it's an error. - cerr << "Invalid character at: " << line.substr(p) << "\n"; - return false; - } - p++; - - command = new SedCommand; - if (!command->parse_command(line, p)) { - // That's an invalid command. - delete command; - return false; - } - _commands.push_back(command); - } - - // Everything parsed ok. - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: SedScript::run -// Access: Public -// Description: Runs the script, modifying the context as -// appropriate. Returns true if the process should -// continue with the next line, or false if we have quit -// and we should terminate. -//////////////////////////////////////////////////////////////////// -bool SedScript:: -run(SedContext &context) { - context._deleted = false; - _next_command = _commands.begin(); - while (!_quit && _next_command != _commands.end()) { - SedCommand *command = (*_next_command); - ++_next_command; - command->run(*this, context); - } - - if (!context._deleted) { - context._out << context._pattern_space << "\n"; - } - - return !_quit; -} diff --git a/ppremake/sedScript.h b/ppremake/sedScript.h deleted file mode 100644 index e54514ba54..0000000000 --- a/ppremake/sedScript.h +++ /dev/null @@ -1,39 +0,0 @@ -// Filename: sedScript.h -// Created by: drose (24Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef SEDSCRIPT_H -#define SEDSCRIPT_H - -#include "ppremake.h" - -#include - -class SedCommand; -class SedContext; - -/////////////////////////////////////////////////////////////////// -// Class : SedScript -// Description : This is a complete sed script: a linear list of -// commands that are to be applied for each line read -// from input. -//////////////////////////////////////////////////////////////////// -class SedScript { -public: - SedScript(); - ~SedScript(); - - bool add_line(const string &line); - - bool run(SedContext &context); - -public: - bool _quit; - - typedef vector Commands; - Commands _commands; - Commands::const_iterator _next_command; -}; - -#endif diff --git a/ppremake/tokenize.cxx b/ppremake/tokenize.cxx deleted file mode 100644 index 64f804fc39..0000000000 --- a/ppremake/tokenize.cxx +++ /dev/null @@ -1,134 +0,0 @@ -// Filename: tokenize.cxx -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#include "tokenize.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Function: tokenize -// Description: Chops the source string up into pieces delimited by -// any of the characters specified in delimiters. -// Repeated delimiter characters represent zero-length -// tokens. -// -// It is the user's responsibility to ensure the output -// vector is cleared before calling this function; the -// results will simply be appended to the end of the -// vector. -//////////////////////////////////////////////////////////////////// -void -tokenize(const string &source, vector &tokens, - const string &delimiters) { - size_t p = 0; - while (p < source.length()) { - size_t q = source.find_first_of(delimiters, p); - if (q == string::npos) { - tokens.push_back(source.substr(p)); - return; - } - tokens.push_back(source.substr(p, q - p)); - p = q + 1; - } - tokens.push_back(string()); -} - -//////////////////////////////////////////////////////////////////// -// Function: tokenize_whitespace -// Description: Chops the source string up into pieces delimited by -// whitespace characters. It is different from -// tokenize() in that repeated whitespace characters are -// not significant. -// -// It is the user's responsibility to ensure the output -// vector is cleared before calling this function; the -// results will simply be appended to the end of the -// vector. -//////////////////////////////////////////////////////////////////// -void -tokenize_whitespace(const string &source, vector &tokens) { - // First, start at the first non-whitespace character. - size_t p = 0; - while (p < source.length() && isspace(source[p])) { - p++; - } - - while (p < source.length()) { - // Now scan to the end of the word. - size_t q = p; - while (q < source.length() && !isspace(source[q])) { - q++; - } - tokens.push_back(source.substr(p, q - p)); - p = q; - - while (p < source.length() && isspace(source[p])) { - p++; - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: repaste -// Description: Returns a string representing the given sequence of -// tokens concatenated together with the separator -// string between them. -//////////////////////////////////////////////////////////////////// -string -repaste(const vector &tokens, const string &separator) { - string result; - if (!tokens.empty()) { - vector::const_iterator ti; - ti = tokens.begin(); - result += (*ti); - ++ti; - - while (ti != tokens.end()) { - result += separator; - result += (*ti); - ++ti; - } - } - - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: trim_blanks -// Description: Returns a new string, equivalent to the source -// string, but with the leading and trailing whitespace -// removed. -//////////////////////////////////////////////////////////////////// -string -trim_blanks(const string &str) { - size_t p = 0; - while (p < str.length() && isspace(str[p])) { - p++; - } - - size_t q = str.length(); - while (q > p && isspace(str[q - 1])) { - q--; - } - - return str.substr(p, q - p); -} - -//////////////////////////////////////////////////////////////////// -// Function: contains_whitespace -// Description: Returns true if the string contains any whitespace -// characters, false if it does not. -//////////////////////////////////////////////////////////////////// -bool -contains_whitespace(const string &str) { - string::const_iterator si; - for (si = str.begin(); si != str.end(); ++si) { - if (isspace(*si)) { - return true; - } - } - - return false; -} diff --git a/ppremake/tokenize.h b/ppremake/tokenize.h deleted file mode 100644 index e574c997a5..0000000000 --- a/ppremake/tokenize.h +++ /dev/null @@ -1,30 +0,0 @@ -// Filename: tokenize.h -// Created by: drose (25Sep00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef TOKENIZE_H -#define TOKENIZE_H - -#include "ppremake.h" - -#include - -// A couple of handy functions for breaking up a string into tokens, -// and repasting the tokens back into a string. - -void tokenize(const string &source, vector &tokens, - const string &delimiters); - -void tokenize_whitespace(const string &source, vector &tokens); - -string repaste(const vector &tokens, const string &separator); - -// And this is just handy to have. -string trim_blanks(const string &str); - -// So is this. -bool contains_whitespace(const string &str); - -#endif - diff --git a/ppremake/vector_string.h b/ppremake/vector_string.h deleted file mode 100644 index 4918c0432b..0000000000 --- a/ppremake/vector_string.h +++ /dev/null @@ -1,31 +0,0 @@ -// Filename: vector_string.h -// Created by: drose (15May00) -// -//////////////////////////////////////////////////////////////////// -// -// 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." -// -//////////////////////////////////////////////////////////////////// - -#ifndef VECTOR_STRING_H -#define VECTOR_STRING_H - -#include "ppremake.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : vector_string -// Description : This typedef is borrowed from dtool/src/dtoolutil, and -// stripped down to just the bare minimum that Filename -// needs; and also modified to build outside of Panda. -//////////////////////////////////////////////////////////////////// - -typedef vector vector_string; - -#endif