本文整理汇总了C++中Environment::SetError方法的典型用法代码示例。如果您正苦于以下问题:C++ Environment::SetError方法的具体用法?C++ Environment::SetError怎么用?C++ Environment::SetError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::SetError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoCall
Value Callable::DoCall(
Environment &env, const CallerInfo &callerInfo, ULong flags,
const Value &valueThis, const Iterator *pIteratorThis,
const TrailCtrlHolder *pTrailCtrlHolder)
{
env.SetError(ERR_TypeError, "object is not callable");
return Value::Nil;
}
示例2: SetupGLEW
bool SetupGLEW(Environment &env)
{
static bool setupFlag = false;
if (setupFlag) return true;
setupFlag = true;
GLenum err = glewInit();
if (err == GLEW_OK) return true;
env.SetError(ERR_RuntimeError, "%s", glewGetErrorString(err));
return false;
}
示例3: GetImageFormat
GLenum GetImageFormat(Environment &env, const Image *pImage)
{
GLenum format = 0;
Image::Format fmt = pImage->GetFormat();
format =
(fmt == Image::FORMAT_RGB)? GL_BGR_EXT :
(fmt == Image::FORMAT_RGBA)? GL_BGRA_EXT : 0;
if (format == 0) {
env.SetError(ERR_ValueError, "unsupported image type");
}
return format;
}
示例4: Advance
bool Pointer::Advance(Environment &env, int distance)
{
if (distance >= 0) {
_offset += distance;
return true;
}
if (_offset >= static_cast<size_t>(-distance)) {
_offset += distance;
return true;
}
env.SetError(ERR_IndexError, "pointer offset becomes negative");
return false;
}
示例5: SetError_RequiredGLVersion
void SetError_RequiredGLVersion(Environment &env, const char *version)
{
env.SetError(ERR_NotImplementedError, "available in OpenGL %s or later", version);
}
示例6: SetError_NotImpFunction
void SetError_NotImpFunction(Environment &env, const char *funcName)
{
env.SetError(ERR_NotImplementedError, "not implemented function %s", funcName);
}
示例7: FeedChar
bool Parser::FeedChar(Environment &env, char ch)
{
BeginPushbackRegion(ch);
//::printf("%p ch=%c, stat=%d\n", this, ch, _stat);
switch (_stat) {
case STAT_Init: {
if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\0') {
// nothing to do
} else {
Pushback(ch);
_str.clear();
_stat = STAT_String;
}
break;
}
case STAT_String: {
if (ch == '\0') {
FlushElemString(_str.c_str());
_str.clear();
} else if (IsCommandMark(ch)) {
_cmdName.clear();
_stat = STAT_AcceptCommandInString;
} else {
_str += ch;
}
break;
}
case STAT_AcceptCommandInString: {
if (IsCommandEnd(_cmdName, ch)) {
if (_cmdName.empty()) {
env.SetError(ERR_SyntaxError, "command name is not specified");
return false;
}
const CommandFormat *pCmdFmt = CommandFormat::Lookup(_cmdName.c_str());
if (pCmdFmt == nullptr) {
// custom command
FlushElemString(_str.c_str());
_stat = STAT_CommandCustom;
} else {
// special command
if (pCmdFmt->IsVisual() || !IsBlank(_str.c_str())) {
FlushElemString(_str.c_str());
}
_pElemCmdCur.reset(new Elem_Command(pCmdFmt));
_stat = STAT_CommandSpecial;
}
_str.clear();
Pushback(ch);
} else {
_cmdName += ch;
}
break;
}
case STAT_AcceptCommandInArgLine:
case STAT_AcceptCommandInArgPara: {
if (_pParserChild.get() != nullptr) {
if (!_pParserChild->FeedChar(env, ch)) return false;
if (_pParserChild->IsComplete()) {
AutoPtr<Elem_Text> pElemResult(
new Elem_Text(_pParserChild->GetElemOwner().Reference()));
_pElemArg->GetElemChildren().AddElem(pElemResult->ReduceContent()->Reference());
_pParserChild.reset();
_stat = (_stat == STAT_AcceptCommandInArgLine)? STAT_ArgLine : STAT_ArgPara;
}
} else if (IsCommandEnd(_cmdName, ch)) {
if (_cmdName.empty()) {
env.SetError(ERR_SyntaxError, "command name is not specified");
return false;
}
const CommandFormat *pCmdFmt = CommandFormat::Lookup(_cmdName.c_str());
if (pCmdFmt == nullptr) {
// custom command
_pParserChild.reset(new Parser(_pAliases, this));
_pParserChild->SetCommandCustom(_cmdName.c_str());
Pushback(ch);
} else if (pCmdFmt->IsSectionIndicator()) {
if (_stat == STAT_AcceptCommandInArgLine ||
_stat == STAT_AcceptCommandInArgCustom) {
env.SetError(ERR_SyntaxError,
"section indicator can not appear in line argument");
return false;
}
// finish the previous command
if (!_strArg.empty()) {
_pElemArg->GetElemChildren().AddElem(new Elem_String(_strArg));
_strArg.clear();
}
_pElemCmdCur->GetElemArgs().AddElem(_pElemArg->ReduceContent()->Reference());
FlushElemCommand(_pElemCmdCur.release());
// special command (section indicator)
_pElemCmdCur.reset(new Elem_Command(pCmdFmt));
Pushback(ch);
_stat = STAT_CommandSpecial;
} else {
// special command (not section indicator)
_pParserChild.reset(new Parser(_pAliases, this));
_pParserChild->SetCommandSpecial(pCmdFmt);
}
} else {
_cmdName += ch;
//.........这里部分代码省略.........