Changeset View
Changeset View
Standalone View
Standalone View
source/third_party/ogre3d_preprocessor/OgreGLSLPreprocessor.cpp
- This file was moved from source/ps/Preprocessor.cpp.
Show All 28 Lines | |||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
THE SOFTWARE. | THE SOFTWARE. | ||||
----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "Preprocessor.h" | #include "OgreGLSLPreprocessor.h" | ||||
elexis: Probably necessary change:
I suppose third party libs should not depend on Pyrogenesis code. | |||||
#include "ps/CLogger.h" | |||||
// Limit max number of macro arguments to this | // Limit max number of macro arguments to this | ||||
#define MAX_MACRO_ARGS 16 | #define MAX_MACRO_ARGS 16 | ||||
//---------------------------------------------------------------------------// | //---------------------------------------------------------------------------// | ||||
/// Return closest power of two not smaller than given number | /// Return closest power of two not smaller than given number | ||||
static size_t ClosestPow2 (size_t x) | static size_t ClosestPow2 (size_t x) | ||||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
//---------------------------------------------------------------------------// | //---------------------------------------------------------------------------// | ||||
static void DefaultError (void *iData, int iLine, const char *iError, | static void DefaultError (void *iData, int iLine, const char *iError, | ||||
const char *iToken, size_t iTokenLen) | const char *iToken, size_t iTokenLen) | ||||
{ | { | ||||
(void)iData; | (void)iData; | ||||
char line [1000]; | |||||
if (iToken) | if (iToken) | ||||
LOGERROR("Preprocessor error: line %d: %s: '%s'\n", | snprintf (line, sizeof (line), "line %d: %s: `%.*s'\n", | ||||
iLine, iError, std::string (iToken, iTokenLen)); | iLine, iError, int (iTokenLen), iToken); | ||||
Done Inline Actionsstatic cast iTokenLen? Silier: static cast iTokenLen? | |||||
Done Inline ActionsOriginal code, that was restored. Stan: Original code, that was restored. | |||||
else | else | ||||
LOGERROR("Preprocessor error: line %d: %s\n", iLine, iError); | snprintf (line, sizeof (line), "line %d: %s\n", iLine, iError); | ||||
Done Inline ActionsLOGERROR is missing :) Silier: LOGERROR is missing :) | |||||
Done Inline ActionsOriginal code, that was restored. Stan: Original code, that was restored. | |||||
} | } | ||||
//---------------------------------------------------------------------------// | //---------------------------------------------------------------------------// | ||||
CPreprocessor::ErrorHandlerFunc CPreprocessor::ErrorHandler = DefaultError; | CPreprocessor::ErrorHandlerFunc CPreprocessor::ErrorHandler = DefaultError; | ||||
CPreprocessor::CPreprocessor (const Token &iToken, int iLine) : MacroList (NULL) | CPreprocessor::CPreprocessor (const Token &iToken, int iLine) : MacroList (NULL) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,071 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Probably necessary change:
I suppose third party libs should not depend on Pyrogenesis code.
So this pyrogenesis specific addition should be superseded somehow.
It appears like one could overwrite the error reporter in a Pyrogenesis file, see L242