diff --git a/build/mac/Regal/Regal.xcodeproj/project.pbxproj b/build/mac/Regal/Regal.xcodeproj/project.pbxproj index ca81fac..fbef0d1 100644 --- a/build/mac/Regal/Regal.xcodeproj/project.pbxproj +++ b/build/mac/Regal/Regal.xcodeproj/project.pbxproj @@ -79,6 +79,10 @@ 433EC180187891D2007304B6 /* misc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 433EC17D187891D2007304B6 /* misc.cpp */; }; 433EC181187891D2007304B6 /* othersyms.c in Sources */ = {isa = PBXBuildFile; fileRef = 433EC17E187891D2007304B6 /* othersyms.c */; }; 433EC182187891D2007304B6 /* othersyms.c in Sources */ = {isa = PBXBuildFile; fileRef = 433EC17E187891D2007304B6 /* othersyms.c */; }; + 433EC1CF187C51F0007304B6 /* RegalPrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 433EC1CE187C51F0007304B6 /* RegalPrint.h */; }; + 433EC1D0187C51F0007304B6 /* RegalPrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 433EC1CE187C51F0007304B6 /* RegalPrint.h */; }; + 433EC1D1187C51F0007304B6 /* RegalPrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 433EC1CE187C51F0007304B6 /* RegalPrint.h */; }; + 433EC1D2187C51F0007304B6 /* RegalPrint.h in Headers */ = {isa = PBXBuildFile; fileRef = 433EC1CE187C51F0007304B6 /* RegalPrint.h */; }; 4359147D18293B32002CB92C /* libapitrace.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4359144B18293A5C002CB92C /* libapitrace.a */; }; 4359147E18293B32002CB92C /* libjsonsl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4359145118293A68002CB92C /* libjsonsl.a */; }; 4359147F18293B32002CB92C /* libmd5.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4359145718293A74002CB92C /* libmd5.a */; }; @@ -943,6 +947,7 @@ 433EC14D18788EC9007304B6 /* tessmono.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tessmono.h; path = ../../../src/glu/libtess/tessmono.h; sourceTree = ""; }; 433EC17D187891D2007304B6 /* misc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc.cpp; sourceTree = ""; }; 433EC17E187891D2007304B6 /* othersyms.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = othersyms.c; sourceTree = ""; }; + 433EC1CE187C51F0007304B6 /* RegalPrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegalPrint.h; path = ../../../src/regal/RegalPrint.h; sourceTree = ""; }; 4359144618293A5B002CB92C /* apitrace.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = apitrace.xcodeproj; path = ../apitrace/apitrace.xcodeproj; sourceTree = ""; }; 4359144C18293A68002CB92C /* jsonsl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = jsonsl.xcodeproj; path = ../jsonsl/jsonsl.xcodeproj; sourceTree = ""; }; 4359145218293A73002CB92C /* md5.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = md5.xcodeproj; path = ../md5/md5.xcodeproj; sourceTree = ""; }; @@ -1426,6 +1431,7 @@ 43A6C1F515C48D200063667E /* RegalPpa.h */, 438D2C2516DE668A005E03F6 /* RegalPpca.h */, 43A6C1F715C48D200063667E /* RegalPrecompile.h */, + 433EC1CE187C51F0007304B6 /* RegalPrint.h */, 43A6C1F815C48D200063667E /* RegalPrivate.h */, BCBEC6FF167AD72700B38E16 /* RegalPush.h */, BC4DBEC11804FB0600F6D226 /* RegalQuads.cpp */, @@ -1497,6 +1503,7 @@ 433EC12D18788E72007304B6 /* gluint.h in Headers */, 433EC16A18788EC9007304B6 /* priorityq.h in Headers */, 433EC16618788EC9007304B6 /* priorityq-sort.h in Headers */, + 433EC1D0187C51F0007304B6 /* RegalPrint.h in Headers */, 433EC15A18788EC9007304B6 /* memalloc.h in Headers */, 433EC14E18788EC9007304B6 /* dict-list.h in Headers */, 433EC15E18788EC9007304B6 /* mesh.h in Headers */, @@ -1588,6 +1595,7 @@ 435916D018367DEE002CB92C /* RegalNamespace.h in Headers */, 435916D118367DEE002CB92C /* RegalTexSto.h in Headers */, 435916D218367DEE002CB92C /* RegalEmuInfo.h in Headers */, + 433EC1D1187C51F0007304B6 /* RegalPrint.h in Headers */, 435916D318367DEE002CB92C /* RegalQuads.h in Headers */, 437B7CC3187A8BF700C863BB /* RegalOrigIff.h in Headers */, 435916D418367DEE002CB92C /* RegalLayerInfo.h in Headers */, @@ -1629,6 +1637,7 @@ 433EC12E18788E72007304B6 /* gluint.h in Headers */, 433EC16B18788EC9007304B6 /* priorityq.h in Headers */, 433EC16718788EC9007304B6 /* priorityq-sort.h in Headers */, + 433EC1D2187C51F0007304B6 /* RegalPrint.h in Headers */, 433EC15B18788EC9007304B6 /* memalloc.h in Headers */, 433EC14F18788EC9007304B6 /* dict-list.h in Headers */, 433EC15F18788EC9007304B6 /* mesh.h in Headers */, @@ -1668,6 +1677,7 @@ 43A6C22215C48D200063667E /* RegalPpa.h in Headers */, 437B7CB9187A8BF700C863BB /* RegalOrigFilter.h in Headers */, 43A6C22415C48D200063667E /* RegalPrecompile.h in Headers */, + 433EC1CF187C51F0007304B6 /* RegalPrint.h in Headers */, 43A6C22515C48D200063667E /* RegalPrivate.h in Headers */, 437B7CE5187A8BF700C863BB /* RegalOrigVao.h in Headers */, 43A6C22615C48D200063667E /* RegalState.h in Headers */, diff --git a/src/regal/RegalCacheShader.cpp b/src/regal/RegalCacheShader.cpp index 05e7db6..778a8bc 100644 --- a/src/regal/RegalCacheShader.cpp +++ b/src/regal/RegalCacheShader.cpp @@ -41,10 +41,10 @@ REGAL_GLOBAL_BEGIN #include #include -#include +#include "RegalPrint.h" using namespace ::std; -using ::boost::print::print_string; + REGAL_GLOBAL_END diff --git a/src/regal/RegalCacheTexture.cpp b/src/regal/RegalCacheTexture.cpp index 79c7195..85ba75b 100644 --- a/src/regal/RegalCacheTexture.cpp +++ b/src/regal/RegalCacheTexture.cpp @@ -49,7 +49,7 @@ REGAL_GLOBAL_BEGIN #include // 32-bit memory hashing function #include -#include +#include "RegalPrint.h" #if !REGAL_NO_PNG #include @@ -57,7 +57,7 @@ REGAL_GLOBAL_BEGIN #endif using namespace ::std; -using ::boost::print::print_string; + REGAL_GLOBAL_END diff --git a/src/regal/RegalClientState.h b/src/regal/RegalClientState.h index 083d060..ea325d5 100644 --- a/src/regal/RegalClientState.h +++ b/src/regal/RegalClientState.h @@ -42,7 +42,7 @@ REGAL_GLOBAL_BEGIN #include #include // For std::swap -#include +#include "RegalPrint.h" #include #include "RegalEmu.h" @@ -88,7 +88,7 @@ namespace ClientState { using ::boost::print::hex; - using ::boost::print::print_string; + typedef ::boost::print::string_list string_list; inline static void enable(Dispatch::GL &dt, const GLenum cap, const GLboolean enable) diff --git a/src/regal/RegalFrame.cpp b/src/regal/RegalFrame.cpp index 0203d13..8f82987 100644 --- a/src/regal/RegalFrame.cpp +++ b/src/regal/RegalFrame.cpp @@ -40,9 +40,9 @@ REGAL_GLOBAL_BEGIN #include #include #include -#include +#include "RegalPrint.h" using namespace ::std; -using ::boost::print::print_string; + #endif #include "RegalFrame.h" diff --git a/src/regal/RegalHttp.cpp b/src/regal/RegalHttp.cpp index 61e9c92..68a8d34 100644 --- a/src/regal/RegalHttp.cpp +++ b/src/regal/RegalHttp.cpp @@ -87,8 +87,8 @@ REGAL_GLOBAL_BEGIN #include using namespace std; -#include -using boost::print::print_string; +#include "RegalPrint.h" + #include "mongoose.h" diff --git a/src/regal/RegalIff.cpp b/src/regal/RegalIff.cpp index feae225..d610139 100644 --- a/src/regal/RegalIff.cpp +++ b/src/regal/RegalIff.cpp @@ -46,6 +46,8 @@ using std::string; #include typedef boost::print::string_list string_list; +#include "RegalPrint.h" + #include "RegalIff.h" #include "RegalLog.h" #include "RegalToken.h" @@ -1958,7 +1960,7 @@ void Program::Samplers( RegalContext * ctx, Dispatch::GL & tbl ) for ( GLint ii = 0; ii < REGAL_EMU_MAX_TEXTURE_UNITS; ii++ ) { - std::string samplerName = boost::print::print_string("rglSampler",ii); + std::string samplerName = print_string("rglSampler",ii); GLint slot = tbl.glGetUniformLocation( pg, samplerName.c_str() ); if ( slot >= 0 ) tbl.glUniform1i( slot, ii ); diff --git a/src/regal/RegalInit.cpp b/src/regal/RegalInit.cpp index 3ed91bc..7b552b6 100644 --- a/src/regal/RegalInit.cpp +++ b/src/regal/RegalInit.cpp @@ -35,8 +35,8 @@ REGAL_GLOBAL_BEGIN #include -#include -using boost::print::print_string; +#include "RegalPrint.h" + #include using namespace std; diff --git a/src/regal/RegalLog.cpp b/src/regal/RegalLog.cpp index e0fb680..0af5cc8 100644 --- a/src/regal/RegalLog.cpp +++ b/src/regal/RegalLog.cpp @@ -73,7 +73,7 @@ REGAL_NAMESPACE_BEGIN using ::std::string; using ::std::list; using ::boost::print::trim; -using ::boost::print::print_string; + using namespace ::boost::print; diff --git a/src/regal/RegalLog.h b/src/regal/RegalLog.h index 4a9adc2..dee9848 100644 --- a/src/regal/RegalLog.h +++ b/src/regal/RegalLog.h @@ -39,7 +39,7 @@ REGAL_GLOBAL_BEGIN #include #include -#include +#include "RegalPrint.h" REGAL_GLOBAL_END @@ -231,7 +231,7 @@ namespace Logging #if REGAL_LOG_ERROR #define Error(...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableError) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_ERROR, __FILE__, __LINE__, "error ", " | ", NULL, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_ERROR, __FILE__, __LINE__, "error ", " | ", NULL, print_string( __VA_ARGS__) ); } #else #define Error(...) {} #endif @@ -239,7 +239,7 @@ namespace Logging #if REGAL_LOG_WARNING #define Warning(...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableWarning) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_WARNING, __FILE__, __LINE__, "warning ", " | ", NULL, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_WARNING, __FILE__, __LINE__, "warning ", " | ", NULL, print_string( __VA_ARGS__) ); } #else #define Warning(...) {} #endif @@ -247,7 +247,7 @@ namespace Logging #if REGAL_LOG_INFO #define Info(...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableInfo) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_INFO, __FILE__, __LINE__, "info ", " | ", NULL, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_INFO, __FILE__, __LINE__, "info ", " | ", NULL, print_string( __VA_ARGS__) ); } #else #define Info(...) {} #endif @@ -255,7 +255,7 @@ namespace Logging #if REGAL_LOG_APP #define App(name,...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableApp) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_APP, __FILE__, __LINE__, "app ", " | ", name, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_APP, __FILE__, __LINE__, "app ", " | ", name, print_string( __VA_ARGS__) ); } #else #define App(...) {} #endif @@ -263,7 +263,7 @@ namespace Logging #if REGAL_LOG_DRIVER #define Driver(name,...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableDriver) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_DRIVER, __FILE__, __LINE__, "driver ", " | ", name, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_DRIVER, __FILE__, __LINE__, "driver ", " | ", name, print_string( __VA_ARGS__) ); } #else #define Driver(...) {} #endif @@ -271,7 +271,7 @@ namespace Logging #if REGAL_LOG_INTERNAL #define Internal(name,...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableInternal) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_INTERNAL, __FILE__, __LINE__, "internal", " | ", name, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_INTERNAL, __FILE__, __LINE__, "internal", " | ", name, print_string( __VA_ARGS__) ); } #else #define Internal(...) {} #endif @@ -279,7 +279,7 @@ namespace Logging #if REGAL_LOG_HTTP #define HTrace(...) { \ if (::REGAL_NAMESPACE_INTERNAL::Logging::enableHttp) \ - ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_HTTP, __FILE__, __LINE__, "http ", " | ", NULL, ::boost::print::print_string( __VA_ARGS__) ); } + ::REGAL_NAMESPACE_INTERNAL::Logging::Output( ::REGAL_NAMESPACE_INTERNAL::Logging::LOG_HTTP, __FILE__, __LINE__, "http ", " | ", NULL, print_string( __VA_ARGS__) ); } #else #define HTrace(...) {} #endif diff --git a/src/regal/RegalPrecompile.h b/src/regal/RegalPrecompile.h index 62a01c5..f1b21c6 100644 --- a/src/regal/RegalPrecompile.h +++ b/src/regal/RegalPrecompile.h @@ -45,7 +45,7 @@ REGAL_GLOBAL_BEGIN #include #include -#include +#include "RegalPrint.h" #include "linear.h" #include "RegalLog.h" diff --git a/src/regal/RegalPrint.h b/src/regal/RegalPrint.h new file mode 100644 index 0000000..0ca8d5f --- /dev/null +++ b/src/regal/RegalPrint.h @@ -0,0 +1,56 @@ +/* + Copyright (c) 2013 NVIDIA Corporation + Copyright (c) 2013 Cass Everitt + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __REGAL_PRINT_H__ +#define __REGAL_PRINT_H__ + +#include "RegalUtil.h" + +REGAL_GLOBAL_BEGIN + +#include + +#define REGAL_USE_BOOST 1 + +#if REGAL_USE_BOOST +#include + +using boost::print::print_string; + +#else + +#define print_string( ... ) std::string("x") + +#endif + +REGAL_GLOBAL_END + +REGAL_NAMESPACE_BEGIN + + +REGAL_NAMESPACE_END + +#endif // __REGAL_PRINT_H__ diff --git a/src/regal/RegalState.h b/src/regal/RegalState.h index 7982223..37afe65 100644 --- a/src/regal/RegalState.h +++ b/src/regal/RegalState.h @@ -42,7 +42,7 @@ REGAL_GLOBAL_BEGIN #include #include // For std::swap -#include +#include "RegalPrint.h" #include #include "RegalEmu.h" @@ -91,7 +91,7 @@ namespace State { using ::boost::print::hex; -using ::boost::print::print_string; + typedef ::boost::print::string_list string_list; inline static void setEnable(Dispatch::GL &dt, const GLenum cap, const GLboolean enable) diff --git a/src/regal/RegalTexC.cpp b/src/regal/RegalTexC.cpp index 9565787..dcb39f0 100644 --- a/src/regal/RegalTexC.cpp +++ b/src/regal/RegalTexC.cpp @@ -374,7 +374,7 @@ TexC::GetTexture_( GLuint texture ) if ( tfti == mapTextureToTextureState.end() ) { GenTexture_( texture ); tfti = mapTextureToTextureState.find( texture ); - assert( tfti != mapTextureToTextureState.end() ); + RegalAssert( tfti != mapTextureToTextureState.end() ); } return &tfti->second; diff --git a/src/regal/RegalToken.cpp b/src/regal/RegalToken.cpp index 9cbaade..ae63db5 100644 --- a/src/regal/RegalToken.cpp +++ b/src/regal/RegalToken.cpp @@ -48,7 +48,7 @@ REGAL_GLOBAL_BEGIN #include "RegalToken.h" #include -#include +#include "RegalPrint.h" using namespace ::boost::print; diff --git a/src/regal/RegalUtil.cpp b/src/regal/RegalUtil.cpp index 732db61..e1b0610 100644 --- a/src/regal/RegalUtil.cpp +++ b/src/regal/RegalUtil.cpp @@ -41,10 +41,10 @@ REGAL_GLOBAL_BEGIN #include using namespace std; -#include +#include "RegalPrint.h" #include -using boost::print::print_string; + using boost::print::string_list; #include "RegalConfig.h"