18 #include "precompiled.h"
32 std::map<CStrIntern, CStrIntern> map = defines.
GetMap();
33 for (std::map<CStrIntern, CStrIntern>::const_iterator it = map.begin(); it != map.end(); ++it)
34 m_Preprocessor.
Define(it->first.c_str(), it->first.length(), it->second.c_str(), it->second.length());
47 input +=
"\n1\n#endif\n";
54 LOGERROR(L
"Failed to parse conditional expression '%hs'", expr.c_str());
58 bool ret = (memchr(output,
'1', len) != NULL);
61 if (!(output >= input.c_str() && output < input.c_str() + input.size()))
75 LOGERROR(L
"Shader preprocessing failed");
79 CStr ret(output, len);
82 if (!(output >= input.c_str() && output < input.c_str() + input.size()))
void Define(const char *iMacroName, size_t iMacroNameLen, const char *iMacroValue, size_t iMacroValueLen)
Define a macro without parameters.
CPreprocessor m_Preprocessor
Token Parse(const Token &iSource)
Parse the input string and return a token containing the whole output.
bool TestConditional(const CStr &expr)
std::map< CStrIntern, value_t > GetMap() const
Return a copy of the current name/value mapping.
Represents a mapping of name strings to value strings, for use with #if and #ifdef and similar condit...
CStr Preprocess(const CStr &input)
void AddDefines(const CShaderDefines &defines)
void AddDefine(const char *name, const char *value)