Skip to content

Commit

Permalink
GLSupport: drop unused ErrorHandlerFunc abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Apr 2, 2019
1 parent e530c59 commit 856c276
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 48 deletions.
29 changes: 0 additions & 29 deletions RenderSystems/GLSupport/include/GLSL/OgreGLSLPreprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,35 +506,6 @@ namespace Ogre {
* string only if the returned address is not inside the source text.
*/
char *Parse (const char *iSource, size_t iLength, size_t &oLength);

/**
* An error handler function type.
* The default implementation just drops a note to stderr and
* then the parser ends, returning NULL.
* @param iData
* User-specific pointer from the corresponding CPreprocessor object.
* @param iLine
* The line at which the error happened.
* @param iError
* The error string.
* @param iToken
* If not NULL contains the erroneous token
* @param iTokenLen
* The length of iToken. iToken is never zero-terminated!
*/
typedef void (*ErrorHandlerFunc) (
void *iData, int iLine, const char *iError,
const char *iToken, size_t iTokenLen);

/**
* A pointer to the preprocessor's error handler.
* You can assign the address of your own function to this variable
* and implement your own error handling (e.g. throwing an exception etc).
*/
static ErrorHandlerFunc ErrorHandler;

/// User-specific storage, passed to Error()
void *ErrorData;
};

} // namespace Ogre
Expand Down
21 changes: 2 additions & 19 deletions RenderSystems/GLSupport/src/GLSL/OgreGLSLPreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,24 +225,17 @@ namespace Ogre {
return xt;
}


static void DefaultError (void *iData, int iLine, const char *iError,
const char *iToken, size_t iTokenLen)
void CPreprocessor::Error(int iLine, const char *iError, const Token *iToken)
{
(void)iData;
char line [1000];
if (iToken)
snprintf (line, sizeof (line), "line %d: %s: `%.*s'\n",
iLine, iError, int (iTokenLen), iToken);
iLine, iError, int (iToken->Length), iToken->String);
else
snprintf (line, sizeof (line), "line %d: %s\n", iLine, iError);
LogManager::getSingleton ().logMessage (line, LML_CRITICAL);
}


CPreprocessor::ErrorHandlerFunc CPreprocessor::ErrorHandler = DefaultError;


CPreprocessor::CPreprocessor (const Token &iToken, int iLine) : MacroList (NULL)
{
Source = iToken.String;
Expand All @@ -257,16 +250,6 @@ namespace Ogre {
delete MacroList;
}


void CPreprocessor::Error (int iLine, const char *iError, const Token *iToken)
{
if (iToken)
ErrorHandler (ErrorData, iLine, iError, iToken->String, iToken->Length);
else
ErrorHandler (ErrorData, iLine, iError, NULL, 0);
}


CPreprocessor::Token CPreprocessor::GetToken (bool iExpand)
{
if (Source >= SourceEnd)
Expand Down

0 comments on commit 856c276

Please sign in to comment.