void ooc_end_try( void ) { if( try_pt ) { assert( try_pt->managed == NULL ); if( try_pt->exc_obj != NULL ) { /* If there was an exception */ if ( !( try_pt->status & CAUGHT ) || ( try_pt->status & RETHROWN ) ) { /* if we have not caught the exception or has been rethrown, then rethrow it again */ Exception tmp = try_pt->exc_obj; try_pt = try_pt->previous; ooc_throw( tmp ); } else { /* if we have caught, and handled, just rewind the buffer stack */ #ifndef OOC_NO_DYNAMIC_MEM if( try_pt->exc_obj != & static_exception ) ooc_delete( (Object) try_pt->exc_obj ); #else ooc_release( (Object) try_pt->exc_obj ); #endif try_pt = try_pt->previous; } } else /* If there was no exception, we simply unlink the try block pointer */ try_pt = try_pt->previous; } }
static OMX_ERRORTYPE virtual_Deinit( OMX_IN OMX_HANDLETYPE hComponent){ OMX_HANDLETYPE vdecInPort; OMX_HANDLETYPE dispOutPort; MagOmxComponentImpl vdecCompImpl; AGILE_LOGV("vdec enter!"); vdecCompImpl = ooc_cast(hComponent, MagOmxComponentImpl); vdecInPort = vdecCompImpl->getPort(vdecCompImpl, START_PORT_INDEX + 0); dispOutPort = vdecCompImpl->getPort(vdecCompImpl, START_PORT_INDEX + 1); ooc_delete((Object)vdecInPort); ooc_delete((Object)dispOutPort); return OMX_ErrorNone; }
int main( int argc, char * argv[] ) { Desktop desktop; ooc_init_class( Exception ); srand ( time(NULL) ); /* initialize random seed */ desktop = desktop_new(); { ooc_manage_object( desktop ); ooc_get_interface_must_have( desktop, Serializable )->serialize( (Object) desktop, 0 ); ooc_delete( (Object) ooc_pass( desktop ) ); } ooc_finalize_all(); return 0; }
void ooc_throw( Exception exc_obj_ptr ) { if( exc_obj_ptr == NULL ) exc_obj_ptr = exception_new( err_bad_throw ); /* Throwing Exception clears the managed stack */ clear_managed_stack(); if( try_pt ) { /* if we are in an exception handling, then its a rethrow with the new Exception */ if( try_pt->exc_obj != NULL && try_pt->exc_obj != exc_obj_ptr ) { #ifndef OOC_NO_DYNAMIC_MEM if( try_pt->exc_obj != & static_exception ) ooc_delete( (Object) try_pt->exc_obj ); #else ooc_release( (Object) try_pt->exc_obj ); #endif try_pt->exc_obj = exc_obj_ptr; try_pt->status |= RETHROWN; } else { try_pt->exc_obj = exc_obj_ptr; LONGJMP( try_pt->buffer, !0 ); } } else { /* if no error handler was set, we call the system to handle the error */ /* fprintf(stderr, "*** Unhandled exception! Exception object is:\n\n" ); //dump_item( exc_obj_ptr, 128 ); //dump_item( exc_obj_ptr->_vtab->_class, 16 ); //dump_item( exc_obj_ptr->_vtab->_class->name, 16 ); */ abort(); } }