home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-16 | 2.6 KB | 117 lines | [TEXT/KAHL] |
- /*
- File: MathComponent.c
-
- Contains: Math component routines.
-
- Written by: Gary Woodcock
-
- Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- */
-
- //-----------------------------------------------------------------------
- // includes
-
- #include "MathComponent.h"
- #include "MathComponentPrivate.h"
- #include "MathComponentCommon.h"
- #include <Errors.h>
-
- //-----------------------------------------------------------------------
-
- #ifdef DEBUG_IT
-
- // Use this declaration when we're running linked (for debugging)
- pascal ComponentResult MathDispatcher (ComponentParameters *params,
- Handle storage)
-
- #else
-
- // Use this declaration when we're a standalone component
- pascal ComponentResult main (ComponentParameters *params,
- Handle storage)
-
- #endif DEBUG_IT
-
- {
- // This routine is the main dispatcher for the Math component
-
- ComponentResult result = noErr;
-
- // Did we get a Component Manager request code (< 0)?
- if (params->what < 0)
- {
- switch (params->what)
- {
- case kComponentOpenSelect: // Open request
- {
- result = CallComponentFunctionWithStorage (storage, params,
- (ComponentFunction) _MathOpen);
- break;
- }
- case kComponentCloseSelect: // Close request
- {
- result = CallComponentFunctionWithStorage (storage, params,
- (ComponentFunction) _MathClose);
- break;
- }
- case kComponentCanDoSelect: // Can Do request
- {
- result = CallComponentFunction (params,
- (ComponentFunction) _MathCanDo);
- break;
- }
- case kComponentVersionSelect: // Version request
- {
- result = CallComponentFunction (params,
- (ComponentFunction) _MathVersion);
- break;
- }
- case kComponentTargetSelect: // Target request
- {
- result = CallComponentFunctionWithStorage (storage, params,
- (ComponentFunction) _MathTarget);
- break;
- }
- case kComponentRegisterSelect: // Register request not supported
- default: // Unknown request
- {
- result = paramErr;
- break;
- }
- }
- }
- else // Was it one of our request codes?
- {
- switch (params->what)
- {
- case kDoDivideSelect: // Divide request
- {
- result = CallComponentFunction (params,
- (ComponentFunction) _MathDoDivide);
- break;
- }
-
- case kDoMultiplySelect: // Multiply request
- {
- result = CallComponentFunction (params,
- (ComponentFunction) _MathDoMultiply);
- break;
- }
-
- default: // Unknown request
- {
- result = paramErr;
- break;
- }
- }
- }
- return (result);
- }
-
- //-----------------------------------------------------------------------
-
-
-