OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
This is a simplistic C/C++-like preprocessor. More...
#include <OgreGLSLESPreprocessor.h>
Public Types | |
typedef void(* | ErrorHandlerFunc) (void *iData, int iLine, const char *iError, const char *iToken, size_t iTokenLen) |
An error handler function type. More... | |
typedef void(* | ErrorHandlerFunc) (void *iData, int iLine, const char *iError, const char *iToken, size_t iTokenLen) |
An error handler function type. More... | |
Public Member Functions | |
CPreprocessor () | |
Create an empty preprocessor object. More... | |
CPreprocessor () | |
Create an empty preprocessor object. More... | |
virtual | ~CPreprocessor () |
Destroy the preprocessor object. More... | |
virtual | ~CPreprocessor () |
Destroy the preprocessor object. More... | |
void | Define (const char *iMacroName, size_t iMacroNameLen, const char *iMacroValue, size_t iMacroValueLen) |
Define a macro without parameters. More... | |
void | Define (const char *iMacroName, size_t iMacroNameLen, const char *iMacroValue, size_t iMacroValueLen) |
Define a macro without parameters. More... | |
void | Define (const char *iMacroName, size_t iMacroNameLen, long iMacroValue) |
Define a numerical macro. More... | |
void | Define (const char *iMacroName, size_t iMacroNameLen, long iMacroValue) |
Define a numerical macro. More... | |
char * | Parse (const char *iSource, size_t iLength, size_t &oLength) |
Parse the input string and return a newly-allocated output string. More... | |
char * | Parse (const char *iSource, size_t iLength, size_t &oLength) |
Parse the input string and return a newly-allocated output string. More... | |
bool | ParsePreamble (const char *iSource, size_t iLength) |
Parse the input string as a preamble (i.e. More... | |
bool | Undef (const char *iMacroName, size_t iMacroNameLen) |
Undefine a macro. More... | |
bool | Undef (const char *iMacroName, size_t iMacroNameLen) |
Undefine a macro. More... | |
Public Attributes | |
void * | ErrorData |
User-specific storage, passed to Error() More... | |
Static Public Attributes | |
static ErrorHandlerFunc | ErrorHandler |
A pointer to the preprocessor's error handler. More... | |
This is a simplistic C/C++-like preprocessor.
It takes an non-zero-terminated string on input and outputs a non-zero-terminated string buffer.
This preprocessor was designed specifically for GLSL shaders, so if you want to use it for other purposes you might want to check if the feature set it provides is enough for you.
Here's a list of supported features:
typedef void( * Ogre::CPreprocessor::ErrorHandlerFunc) (void *iData, int iLine, const char *iError, const char *iToken, size_t iTokenLen) |
An error handler function type.
The default implementation just drops a note to stderr and then the parser ends, returning NULL.
iData | User-specific pointer from the corresponding CPreprocessor object. |
iLine | The line at which the error happened. |
iError | The error string. |
iToken | If not NULL contains the erroneous token |
iTokenLen | The length of iToken. iToken is never zero-terminated! |
typedef void(* Ogre::CPreprocessor::ErrorHandlerFunc) (void *iData, int iLine, const char *iError, const char *iToken, size_t iTokenLen) |
An error handler function type.
The default implementation just drops a note to stderr and then the parser ends, returning NULL.
iData | User-specific pointer from the corresponding CPreprocessor object. |
iLine | The line at which the error happened. |
iError | The error string. |
iToken | If not NULL contains the erroneous token |
iTokenLen | The length of iToken. iToken is never zero-terminated! |
Ogre::CPreprocessor::CPreprocessor | ( | ) |
Create an empty preprocessor object.
|
virtual |
Destroy the preprocessor object.
|
inline |
Create an empty preprocessor object.
|
virtual |
Destroy the preprocessor object.
void Ogre::CPreprocessor::Define | ( | const char * | iMacroName, |
size_t | iMacroNameLen, | ||
const char * | iMacroValue, | ||
size_t | iMacroValueLen | ||
) |
Define a macro without parameters.
iMacroName | The name of the defined macro |
iMacroNameLen | The length of the name of the defined macro |
iMacroValue | The value of the defined macro |
iMacroValueLen | The length of the value of the defined macro |
void Ogre::CPreprocessor::Define | ( | const char * | iMacroName, |
size_t | iMacroNameLen, | ||
const char * | iMacroValue, | ||
size_t | iMacroValueLen | ||
) |
Define a macro without parameters.
iMacroName | The name of the defined macro |
iMacroNameLen | The length of the name of the defined macro |
iMacroValue | The value of the defined macro |
iMacroValueLen | The length of the value of the defined macro |
void Ogre::CPreprocessor::Define | ( | const char * | iMacroName, |
size_t | iMacroNameLen, | ||
long | iMacroValue | ||
) |
Define a numerical macro.
iMacroName | The name of the defined macro |
iMacroNameLen | The length of the name of the defined macro |
iMacroValue | The value of the defined macro |
void Ogre::CPreprocessor::Define | ( | const char * | iMacroName, |
size_t | iMacroNameLen, | ||
long | iMacroValue | ||
) |
Define a numerical macro.
iMacroName | The name of the defined macro |
iMacroNameLen | The length of the name of the defined macro |
iMacroValue | The value of the defined macro |
char* Ogre::CPreprocessor::Parse | ( | const char * | iSource, |
size_t | iLength, | ||
size_t & | oLength | ||
) |
Parse the input string and return a newly-allocated output string.
iSource | The source text |
iLength | The length of the source text in characters |
oLength | The length of the output string. |
char* Ogre::CPreprocessor::Parse | ( | const char * | iSource, |
size_t | iLength, | ||
size_t & | oLength | ||
) |
Parse the input string and return a newly-allocated output string.
iSource | The source text |
iLength | The length of the source text in characters |
oLength | The length of the output string. |
bool Ogre::CPreprocessor::ParsePreamble | ( | const char * | iSource, |
size_t | iLength | ||
) |
Parse the input string as a preamble (i.e.
to define a lot of enums).
iSource | The source text containing preamble macros. |
iLength | The length of iSource text in characters. |
bool Ogre::CPreprocessor::Undef | ( | const char * | iMacroName, |
size_t | iMacroNameLen | ||
) |
Undefine a macro.
iMacroName | The name of the macro to undefine |
iMacroNameLen | The length of the name of the macro to undefine |
bool Ogre::CPreprocessor::Undef | ( | const char * | iMacroName, |
size_t | iMacroNameLen | ||
) |
Undefine a macro.
iMacroName | The name of the macro to undefine |
iMacroNameLen | The length of the name of the macro to undefine |
void * Ogre::CPreprocessor::ErrorData |
User-specific storage, passed to Error()
|
static |
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).