本文整理汇总了C++中Crash函数的典型用法代码示例。如果您正苦于以下问题:C++ Crash函数的具体用法?C++ Crash怎么用?C++ Crash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Crash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// expected string: "content", returned string: content
ItTokenizer::Token ItTokenizer::ExpectStr(std::string& str) {
const char* cur = end;
while('\0' != *cur && IsDelim(delim, *cur)) cur++;
const char *nstart = cur;
if('\"' != *cur++) {
char tokBuf[512] = { 0 };
strncpy(tokBuf, nstart, 1);
common.printf("ERROR - %s: ", this->name);
common.printf("expecting STRING, got '%s'\n",
tokBuf);
Crash();
}
while('\0' != *cur) {
if('\"' == *cur) {
str = std::string(nstart + 1, cur - nstart - 1);
start = nstart;
end = cur + 1;
return Token(start, end);
}
cur++;
}
char tokBuf[512] = { 0 };
strncpy(tokBuf, nstart, 512);
common.printf("ERROR - %s: ", this->name);
common.printf("expecting STRING, got '%s'\n",
tokBuf);
Crash();
// unreachable
return Token(NULL, NULL);
}
示例2: MetaData_GetMethodDefFromDefRefOrSpec
tMD_MethodDef* MetaData_GetMethodDefFromDefRefOrSpec(tMetaData *pMetaData, IDX_TABLE token, tMD_TypeDef **ppClassTypeArgs, tMD_TypeDef **ppMethodTypeArgs) {
void *pTableEntry;
pTableEntry = MetaData_GetTableRow(pMetaData, token);
if (((tMDC_ToMethodDef*)pTableEntry)->pMethodDef != NULL) {
return ((tMDC_ToMethodDef*)pTableEntry)->pMethodDef;
}
switch (TABLE_ID(token)) {
case MD_TABLE_METHODDEF:
((tMDC_ToMethodDef*)pTableEntry)->pMethodDef = (tMD_MethodDef*)pTableEntry;
return (tMD_MethodDef*)pTableEntry;
case MD_TABLE_MEMBERREF:
{
tMD_MemberRef *pMemberRef;
pMemberRef = (tMD_MemberRef*)pTableEntry;
switch (TABLE_ID(pMemberRef->class_))
{
case MD_TABLE_TYPEREF:
case MD_TABLE_TYPESPEC:
{
tMD_TypeDef *pTypeDef;
tMD_MethodDef *pMethodDef;
pTypeDef = MetaData_GetTypeDefFromDefRefOrSpec(pMetaData, pMemberRef->class_, ppClassTypeArgs, ppMethodTypeArgs);
MetaData_Fill_TypeDef(pTypeDef, NULL, NULL);
pMethodDef = FindMethodInType(pTypeDef, pMemberRef->name, pMetaData, pMemberRef->signature, pTypeDef->ppClassTypeArgs, ppMethodTypeArgs);
//pMethodDef->pMethodDef = pMethodDef;
return pMethodDef;
}
default:
Crash("MetaData_GetMethodDefFromMethodDefOrRef(): Cannot handle pMemberRef->class_=0x%08x", pMemberRef->class_);
}
}
case MD_TABLE_METHODSPEC:
{
tMD_MethodSpec *pMethodSpec;
tMD_MethodDef *pMethodDef;
pMethodSpec = (tMD_MethodSpec*)pTableEntry;
pMethodDef = Generics_GetMethodDefFromSpec(pMethodSpec, ppClassTypeArgs, ppMethodTypeArgs);
// Note: Cannot cache the MethodDef from the MethodSpec, as class generic arguments
// may be different.
return pMethodDef;
}
}
Crash("MetaData_GetMethodDefFromMethodDefOrRef(): Cannot handle token: 0x%08x", token);
FAKE_RETURN;
}
示例3: Wifi_Connect
void Wifi_Connect(char *pConfig, SlSecParams_t *secParams) {
int32_t retVal;
retVal = configureSimpleLinkToDefaultState(pConfig); // set policies
if(retVal < 0)Crash(4000000);
retVal = sl_Start(0, pConfig, 0);
if((retVal < 0) || (ROLE_STA != retVal) ) Crash(8000000);
secParams->Key = PASSKEY;
secParams->KeyLen = strlen(PASSKEY);
secParams->Type = SEC_TYPE; // OPEN, WPA, or WEP
sl_WlanConnect(SSID_NAME, strlen(SSID_NAME), 0, secParams, 0);
while((0 == (g_Status&CONNECTED)) || (0 == (g_Status&IP_AQUIRED))){
_SlNonOsMainLoopTask();
}
UARTprintf("Connected\n");
}
示例4: main
int main(int argc, char* argv[]) {
google_breakpad::MinidumpDescriptor descriptor(".");
google_breakpad::ExceptionHandler eh(descriptor, NULL, DumpCallback,
NULL, true, -1);
Crash();
return 0;
}
示例5: InternalCall_Map
fnInternalCall InternalCall_Map(tMD_MethodDef *pMethod) {
tInternalCall *pCall;
STRING curNameSpace;
STRING curType;
if (pMethod->pParentType->pParent == types[TYPE_SYSTEM_MULTICASTDELEGATE]) {
// Special case to handle delegates
fnInternalCall fn = Map_Delegate(pMethod);
if (fn != NULL) {
return fn;
}
} else {
for (pCall = internalCalls; pCall->method != NULL; pCall++) {
if (pCall->nameSpace != NULL) {
curNameSpace = pCall->nameSpace;
}
if (pCall->type != NULL) {
curType = pCall->type;
}
if (strcmp(pMethod->pParentType->nameSpace, curNameSpace) == 0) {
if (strcmp(pMethod->pParentType->name, curType) == 0) {
if (Type_IsMethod(pMethod, pCall->method, types[pCall->returnType], pCall->numParameters, pCall->parameterTypes)) {
return pCall->fn;
}
}
}
}
}
Crash("InternalCall_Map(): Cannot map [%s]%s.%s", pMethod->pParentType->nameSpace, pMethod->pParentType->name, pMethod->name);
FAKE_RETURN;
}
示例6:
*/ REBSER *Make_Error(REBINT code, REBVAL *arg1, REBVAL *arg2, REBVAL *arg3)
/*
** Create and init a new error object.
**
***********************************************************************/
{
REBSER *err; // Error object
ERROR_OBJ *error; // Error object values
if (PG_Boot_Phase < BOOT_ERRORS) Crash(RP_EARLY_ERROR, code); // Not far enough!
// Make a copy of the error object template:
err = CLONE_OBJECT(VAL_OBJ_FRAME(ROOT_ERROBJ));
error = ERR_VALUES(err);
// Set error number:
SET_INTEGER(&error->code, (REBINT)code);
Set_Error_Type(error);
// Set error argument values:
if (arg1) error->arg1 = *arg1;
if (arg2) error->arg2 = *arg2;
if (arg3) error->arg3 = *arg3;
// Set backtrace and location information:
if (DSF > 0) {
// Where (what function) is the error:
Set_Block(&error->where, Make_Backtrace(0));
// Nearby location of the error (in block being evaluated):
error->nearest = *DSF_BACK(DSF);
}
return err;
}
示例7: CLIFile_Load
tCLIFile* CLIFile_Load(char *pFileName) {
void *pRawFile;
tCLIFile *pRet;
tFilesLoaded *pNewFile;
pRawFile = LoadFileFromDisk(pFileName);
if (pRawFile == NULL) {
Crash("Cannot load file: %s", pFileName);
}
log_f(1, "\n\n\nLoading file: %s\n", pFileName);
pRet = LoadPEFile(pRawFile);
pRet->pFileName = (char*)mallocForever((U32)strlen(pFileName) + 1);
strcpy(pRet->pFileName, pFileName);
// Record that we've loaded this file
pNewFile = TMALLOCFOREVER(tFilesLoaded);
pNewFile->pCLIFile = pRet;
pNewFile->pNext = pFilesLoaded;
pFilesLoaded = pNewFile;
return pRet;
}
示例8: if
*/ void Reset_Mold(REB_MOLD *mold)
/*
***********************************************************************/
{
REBSER *buf = BUF_MOLD;
REBINT len;
if (!buf) Crash(RP_NO_BUFFER);
if (SERIES_REST(buf) > MAX_COMMON)
Shrink_Series(buf, MIN_COMMON);
BLK_RESET(MOLD_LOOP);
RESET_SERIES(buf);
mold->series = buf;
// This is not needed every time, but w/o a functional way to set the option,
// it must be done like this and each time.
if (GET_MOPT(mold, MOPT_MOLD_ALL)) len = MAX_DIGITS;
else {
len = Get_System_Int(SYS_OPTIONS, OPTIONS_DECIMAL_DIGITS, MAX_DIGITS);
if (len > MAX_DIGITS) len = MAX_DIGITS;
else if (len < 0) len = 0;
}
mold->digits = len;
}
示例9: WORDS_HEAD
*/ REBSER *Collect_Block_Words(REBVAL *block, REBVAL *prior, REBCNT modes)
/*
** Collect words from a prior block and new block.
**
***********************************************************************/
{
REBSER *series;
REBCNT start;
REBINT *binds = WORDS_HEAD(Bind_Table); // GC safe to do here
CHECK_BIND_TABLE;
if (SERIES_TAIL(BUF_WORDS)) Crash(RP_WORD_LIST); // still in use
if (prior)
Collect_Simple_Words(prior, BIND_ALL);
start = SERIES_TAIL(BUF_WORDS);
Collect_Simple_Words(block, modes);
// Reset word markers:
for (block = BLK_HEAD(BUF_WORDS); NOT_END(block); block++)
binds[VAL_WORD_CANON(block)] = 0;
series = Copy_Series_Part(BUF_WORDS, start, SERIES_TAIL(BUF_WORDS)-start);
RESET_TAIL(BUF_WORDS); // allow reuse
CHECK_BIND_TABLE;
return series;
}
示例10: if
VkImageView VulkanRenderManager::BindFramebufferAsTexture(VKRFramebuffer *fb, int binding, int aspectBit, int attachment) {
// Should just mark the dependency and return the image.
for (int i = (int)steps_.size() - 1; i >= 0; i--) {
if (steps_[i]->stepType == VKRStepType::RENDER && steps_[i]->render.framebuffer == fb) {
// If this framebuffer was rendered to earlier in this frame, make sure to pre-transition it to the correct layout.
if (steps_[i]->render.finalColorLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
steps_[i]->render.finalColorLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
break;
}
else if (steps_[i]->render.finalColorLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
Crash();
// May need to shadow the framebuffer if we re-order passes later.
}
}
}
if (!curRenderStep_->preTransitions.empty() &&
curRenderStep_->preTransitions.back().fb == fb &&
curRenderStep_->preTransitions.back().targetLayout == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
// We're done.
return fb->color.imageView;
}
curRenderStep_->preTransitions.push_back({ fb, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL });
return fb->color.imageView;
}
示例11: while
void ScanAddress::ScanAddressesInRegion(PolyWord *region, PolyWord *end)
{
PolyWord *pt = region;
while (pt < end)
{
pt++; // Skip length word.
// pt actually points AT the object here.
PolyObject *obj = (PolyObject*)pt;
if (obj->ContainsForwardingPtr()) /* skip over moved object */
{
// We can now get multiple forwarding pointers as a result
// of applying ShareData repeatedly. Perhaps we should
// turn the forwarding pointers back into normal words in
// an extra pass.
while (obj->ContainsForwardingPtr())
obj = obj->GetForwardingPtr();
ASSERT(obj->ContainsNormalLengthWord());
CheckObject(obj);
pt += obj->Length();
}
else
{
ASSERT(obj->ContainsNormalLengthWord());
POLYUNSIGNED length = obj->Length();
if (pt+length > end)
Crash("Malformed object at %p - length %lu\n", pt, length);
if (length != 0)
ScanAddressesInObject(obj);
pt += length;
}
}
}
示例12: Construct_Object
*/ void Init_Errors(REBVAL *errors)
/*
***********************************************************************/
{
REBSER *errs;
REBVAL *val;
// Create error objects and error type objects:
*ROOT_ERROBJ = *Get_System(SYS_STANDARD, STD_ERROR);
errs = Construct_Object(0, VAL_BLK(errors), 0);
Set_Object(Get_System(SYS_CATALOG, CAT_ERRORS), errs);
Set_Root_Series(TASK_ERR_TEMPS, Make_Block(3));
// Create objects for all error types:
for (val = BLK_SKIP(errs, 1); NOT_END(val); val++) {
errs = Construct_Object(0, VAL_BLK(val), 0);
SET_OBJECT(val, errs);
}
// Catch top level errors, to provide decent output:
PUSH_STATE(Top_State, Saved_State);
if (SET_JUMP(Top_State)) {
POP_STATE(Top_State, Saved_State);
DSP++; // Room for return value
Catch_Error(DS_TOP); // Stores error value here
Print_Value(DS_TOP, 0, FALSE);
Crash(RP_NO_CATCH);
}
SET_STATE(Top_State, Saved_State);
}
示例13: Get_System
*/ REBVAL *Append_Event()
/*
** Append an event to the end of the current event port queue.
** Return a pointer to the event value.
**
** Note: this function may be called from out of environment,
** so do NOT extend the event queue here. If it does not have
** space, return 0. (Should it overwrite or wrap???)
**
***********************************************************************/
{
REBVAL *port;
REBVAL *value;
REBVAL *state;
port = Get_System(SYS_PORTS, PORTS_SYSTEM);
if (!IS_PORT(port)) return 0; // verify it is a port object
// Get queue block:
state = VAL_BLK_SKIP(port, STD_PORT_STATE);
if (!IS_BLOCK(state)) return 0;
// Append to tail if room:
if (SERIES_FULL(VAL_SERIES(state))) Crash(RP_MAX_EVENTS);
VAL_TAIL(state)++;
value = VAL_BLK_TAIL(state);
SET_END(value);
value--;
SET_NONE(value);
//Dump_Series(VAL_SERIES(state), "state");
//Print("Tail: %d %d", VAL_TAIL(state), nn++);
return value;
}
示例14: Crash
*/ void NA(void)
/*
** Feature not available.
**
***********************************************************************/
{
Crash(RP_NA);
}
示例15: E32Main
GLDEF_C TInt E32Main()
{
test.Title();
Crash();
return 0;
}