PASCAL_RTN ComponentResult COMPONENT_DISPATCH_ENTRY(ComponentParameters *params,COMPONENT_GLOBALS())
	{
		ComponentFunctionUPP theProc;
		ComponentResult result = badComponentSelector;
		ProcInfoType theProcInfo;
		
	#ifdef GET_OVERRIDE_COMPONENT
		if ((params->what != kComponentOpenSelect) && (params->what != kComponentCloseSelect)) {   
			if (GET_OVERRIDE_COMPONENT() != NULL) {
				return DelegateComponentCall(params, GET_OVERRIDE_COMPONENT());
			}
		}
	#endif // GET_OVERRIDE_COMPONENT
		theProc = COMPONENTSELECTORLOOKUP(params->what, &theProcInfo);

		if (theProc) {
			if ( (theProc != kCOMPONENT_ERROR) && (theProc != kCOMPONENT_NOERROR) ) {
				if (theProcInfo != 0) {
					result = CallComponentFunctionWithStorageProcInfo((Handle) storage, params, (ProcPtr)theProc, theProcInfo);
				}
			}
			else if ( theProc == kCOMPONENT_NOERROR ) {
				result = noErr;
			}
		}
	#ifdef GET_DELEGATE_COMPONENT
		else
			return DelegateComponentCall(params, GET_DELEGATE_COMPONENT());
	#endif
		return result;
	}
示例#2
0
static ComponentResult volume_catcher_component_entry(ComponentParameters *cp, Handle componentStorage)
{
	ComponentResult result = badComponentSelector;
	VolumeCatcherStorage *storage = (VolumeCatcherStorage*)componentStorage;
	
	switch(cp->what)
	{
		case kComponentOpenSelect:
//			std::cerr << "kComponentOpenSelect" << std::endl;
			result = CallComponentFunctionWithStorageProcInfo((Handle)storage, cp, (ProcPtr)volume_catcher_component_open, uppCallComponentOpenProcInfo);
		break;

		case kComponentCloseSelect:
//			std::cerr << "kComponentCloseSelect" << std::endl;
			result = CallComponentFunctionWithStorageProcInfo((Handle)storage, cp, (ProcPtr)volume_catcher_component_close, uppCallComponentCloseProcInfo);
			// CallComponentFunctionWithStorageProcInfo
		break;
		
		default:
//			std::cerr << "Delegating selector: " << cp->what << " to component instance " << storage->delegate << std::endl;
			result = DelegateComponentCall(cp, storage->delegate);
		break;
	}
	
	return result;
}
	PASCAL_RTN ComponentResult COMPONENT_DISPATCH_ENTRY( ComponentParameters *params, COMPONENT_GLOBALS() )
		{
		ComponentFunctionUPP theProc;
		
		ComponentResult result = badComponentSelector;
		theProc = COMPONENTSELECTORLOOKUP(params->what);

		if (theProc) {
			if ( (theProc != kCOMPONENT_ERROR) && (theProc != kCOMPONENT_NOERROR) ) {
				result = CallComponentFunctionWithStorage((Handle) storage, params, theProc);
			}
			else if ( theProc == kCOMPONENT_NOERROR ) {
				result = noErr;
			}
		}
	#ifdef GET_DELEGATE_COMPONENT
		else
			result = DelegateComponentCall(params, GET_DELEGATE_COMPONENT());
	#endif
		return result;
		}