void test_BasicThrowAndCatch_WithMiniSyntax(void) { CEXCEPTION_T e; //Mini Throw and Catch Try Throw(0xEF); Catch(e) TEST_ASSERT_EQUAL(0xEF, e); TEST_ASSERT_EQUAL(0xEF, e); //Mini Passthrough Try e = 0; Catch(e) TEST_FAIL_MESSAGE("I shouldn't be caught because there was no throw"); TEST_ASSERT_EQUAL(0, e); }
nekoHWTexture::nekoHWTexture(nekoHWResourceManager *resMgr, const char8 *fileName) : nekoIHWResource(resMgr, EHRT_TEXTURE) , mDataLength(0) , mDynamicBuffer(false) , mHandle(NULL) , mColorKey(0) , mPreserveSize(false) { Catch(); mName = fileName; }
nekoHWTexture::nekoHWTexture(nekoHWResourceManager *resMgr, char8 *data, int32 length) : nekoIHWResource(resMgr, EHRT_TEXTURE) , mData(data) , mDataLength(length) , mDynamicBuffer(false) , mHandle(NULL) , mColorKey(0) , mPreserveSize(false) , mVideoSize(1, 1) { SetReleaseDelay(-1.0f); Catch(); }
nekoHWTexture::nekoHWTexture(nekoHWResourceManager *resMgr, int32 width, int32 height, bool dynamicBuffer) : nekoIHWResource(resMgr, EHRT_TEXTURE) , mImageSize(width, height) , mDataLength(0) , mDynamicBuffer(dynamicBuffer) , mHandle(NULL) , mColorKey(0) , mPreserveSize(false) { Catch(); mAutoDropping = false; SetReleaseDelay(-1.0f); }
/* --------------------------------------------------------------------------------- * LEdgeInfo_Delete * --------------------------------------------------------------------------------- * Destructor */ void LEdgeInfo_Delete(LEdgeInfo** ThisA) { LException* theException; if (ThisA == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER); if ((*ThisA) == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER); _LEdgeInfo_CallItemsDestructor((*ThisA)); Try LArray_Delete( &( (*ThisA)->mData ) ); Catch(theException) LException_Dump(theException); LMemory_DeleteObject(ThisA); }
/* --------------------------------------------------------------------------------- * _LEdgeInfo_AddInfo(); * --------------------------------------------------------------------------------- * Makes room for a new info in the Edge */ void _LEdgeInfo_AddInfo(LEdgeInfo* This, LGraph_TEdge* inEdge) { LException* theException; if (This == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER); Try LArray_ResizeBy(This->mData, 1); Catch(theException) LException_Dump(theException); /* if the newHandler has been registered, call it */ if (This->mAlloc) (*(This->mAlloc))(This, inEdge); }
/* --------------------------------------------------------------------------------- * LEdgeInfo_FetchItemAt * --------------------------------------------------------------------------------- * Returns the info of a specified Edge in the memory pointed by out item * * NOTE: only if the methods returns TRUE the data are valid */ Bool LEdgeInfo_FetchItemAt (LEdgeInfo* This, LGraph_TEdge* inEdge, void* outItem) { LException* theException; Bool theResult; if (This == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER); if (inEdge == NULL) Throw(LEdgeInfo_EDGE_NULL_POINTER); if (outItem == NULL) Throw(LEdgeInfo_ITEM_NULL_POINTER); Try theResult = LArray_FetchItemAt(This->mData, inEdge->mIndex, outItem); Catch(theException) LException_Dump(theException); return theResult; }
int main() { int e; Try { foo(0); foo(1); foo(2); } Catch (e) fprintf(stderr, "exception %d\n", e); Try foo(3); Catch_anonymous fprintf(stderr, "anonymous exception\n"); return EXIT_SUCCESS; }
WORD KappaDevelopment(LPSTR lpszCmdLine, int cmdShow, BOOL bMulti) { MSG msg; /* Process cmdLine */ KppLoadUserDLLs(hInstKappa, bMulti); #ifndef RUNTIME ProcessCmdLine(lpszCmdLine, bMulti); #else if (!ProcessCmdLine(lpszCmdLine, bMulti)) { HWND hWndSession = KpsGetMainSessionWindow(); if (!IsZoomed(hWndSession) && !IsIconic(hWndSession)) ShowWindow(hWndSession, cmdShow); KppSetAppChanged(FALSE); } #endif InitObjectBrowser(); Catch((LPCATCHBUF) initial_catch); while (GetMessage(&msg, NULL, 0, 0)) { HWND hWnd = GetActiveWindow(); #ifndef RUNTIME if (hWnd == hWndInterpret) hWnd = hWndKAL; #endif if (!TranslateAccelerator(hWnd, hAccelTable, &msg)) { /* Don't translate on interpreter window. Otherwise, * * <CR> gets translated as well */ TranslateMessage(&msg); if (KpsIsASessionWindow(hWnd) || hWnd == hWndBrowser) KpiIsButtonKeyMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; }
void jumpwireIo::parseJumpwireIo(String frame){ if(frame.charAt(2)=='f'){ //is f (float) frame? if(debug){ Serial.print("Catch key: "); Serial.print(frame.charAt(7)); Serial.print(" value: "); Serial.println(frame.substring(10,frame.length()-2).toFloat()); } //call Catch function Catch(frame.charAt(7), frame.substring(10,frame.length()-2).toFloat()); }else{ if(debug){ Serial.print("Unknown jwio frame "); Serial.println(frame); } } }
/* --------------------------------------------------------------------------------- * _LEdgeInfo_DeleteItemAt * --------------------------------------------------------------------------------- * Delete the info of a specified Edge*/ void _LEdgeInfo_DeleteItemAt(LEdgeInfo* This, LGraph_TEdge* inEdge) { LException* theException; ui4 theIndex; if (This == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER); /* if installed, calls the destructor handler */ if (This->mDealloc) (*(This->mDealloc))(This, inEdge); theIndex = inEdge->mIndex; LMemory_Copy(LArray_LastItem(This->mData), LArray_ItemAt(This->mData, theIndex), LArray_GetItemSize(This->mData)); Try LArray_ResizeBy(This->mData, -1); Catch(theException) LException_Dump(theException); }
/* --------------------------------------------------------------------------------- * LEdgeInfo_AssignItemAt * --------------------------------------------------------------------------------- * Assigns the data pointed by inItem to the Edge inEdge */ void LEdgeInfo_AssignItemAt(LEdgeInfo* This, LGraph_TEdge* inEdge, const void* inItem) { /*at this point there MUST be the allocated space for the item */ LException* theException; void* thePtr; ui4 theItemSize; if (This == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER); if (inEdge == NULL) Throw(LEdgeInfo_EDGE_NULL_POINTER); if (inItem == NULL) Throw(LEdgeInfo_ITEM_NULL_POINTER); Try { thePtr = LArray_ItemAt(This->mData, inEdge->mIndex); theItemSize = LArray_GetItemSize(This->mData); } Catch(theException) LException_Dump(theException); LMemory_Copy(inItem, thePtr, theItemSize); }
BOOL CWALVItems::Sort ( PFNWCOMPARE pfnCompareProc, LPARAM lParam ) { int ExceptionError; int * SaveCatchBuffer; pfnCompare = pfnCompareProc; #ifdef WEXCEPTIONS try { CWArray::Sort ( 0, WAD_SORTALL, lParam ); } catch ( int ExceptionError ) { ExceptionError = 0; return ( FALSE ); } #else SaveCatchBuffer = CatchBuffer; CatchBuffer = (int *)WinMalloc(sizeof(CATCHBUF)); ExceptionError = Catch(CatchBuffer); if (ExceptionError == 0) { CWArray::Sort ( 0, WAD_SORTALL, lParam ); } else { WinFree(CatchBuffer); CatchBuffer = SaveCatchBuffer; return FALSE; } WinFree(CatchBuffer); CatchBuffer = SaveCatchBuffer; #endif return ( TRUE ); }
void Enermy::action() { bool b = Collision(); MakeDecision(b); Catch(); }