home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Documentation / develop / develop Issue 12 / develop 12 code / Components / MathComponent.c < prev    next >
Encoding:
Text File  |  1992-10-16  |  2.6 KB  |  117 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        MathComponent.c
  3.  
  4.     Contains:    Math component routines.
  5.  
  6.     Written by:    Gary Woodcock
  7.  
  8.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12. */
  13.  
  14. //-----------------------------------------------------------------------
  15. // includes
  16.  
  17. #include "MathComponent.h"
  18. #include "MathComponentPrivate.h"
  19. #include "MathComponentCommon.h"
  20. #include <Errors.h>
  21.  
  22. //-----------------------------------------------------------------------
  23.  
  24. #ifdef DEBUG_IT
  25.  
  26. // Use this declaration when we're running linked (for debugging)
  27. pascal    ComponentResult    MathDispatcher    (ComponentParameters    *params,
  28.                                          Handle                    storage)
  29.                                              
  30. #else
  31.  
  32. // Use this declaration when we're a standalone component
  33. pascal    ComponentResult    main    (ComponentParameters    *params,
  34.                                  Handle                    storage)
  35.  
  36. #endif DEBUG_IT
  37.  
  38. {
  39.     // This routine is the main dispatcher for the Math component
  40.     
  41.     ComponentResult    result = noErr;
  42.     
  43.     // Did we get a Component Manager request code (< 0)?
  44.     if (params->what < 0)
  45.     {
  46.         switch (params->what)
  47.         {
  48.             case kComponentOpenSelect:        // Open request
  49.             {
  50.                 result = CallComponentFunctionWithStorage (storage, params,
  51.                     (ComponentFunction) _MathOpen);
  52.                 break;
  53.             }
  54.             case kComponentCloseSelect:        // Close request
  55.             {
  56.                 result = CallComponentFunctionWithStorage (storage, params,
  57.                     (ComponentFunction) _MathClose);
  58.                 break;
  59.             }
  60.             case kComponentCanDoSelect:        // Can Do request
  61.             {
  62.                 result = CallComponentFunction (params, 
  63.                     (ComponentFunction) _MathCanDo);
  64.                 break;
  65.             }
  66.             case kComponentVersionSelect:    // Version request
  67.             {
  68.                 result = CallComponentFunction (params,
  69.                     (ComponentFunction) _MathVersion);
  70.                 break;
  71.             }
  72.             case kComponentTargetSelect:    // Target request
  73.             {
  74.                 result = CallComponentFunctionWithStorage (storage, params,
  75.                     (ComponentFunction) _MathTarget);
  76.                 break;
  77.             }
  78.             case kComponentRegisterSelect:    // Register request not supported
  79.             default:                        // Unknown request
  80.             {
  81.                 result = paramErr;
  82.                 break;
  83.             }
  84.         }
  85.     }
  86.     else    // Was it one of our request codes?
  87.     {
  88.         switch (params->what)
  89.         {
  90.             case kDoDivideSelect:            // Divide request
  91.             {
  92.                 result = CallComponentFunction (params, 
  93.                     (ComponentFunction) _MathDoDivide);
  94.                 break;
  95.             }
  96.             
  97.             case kDoMultiplySelect:            // Multiply request
  98.             {    
  99.                 result = CallComponentFunction (params,
  100.                     (ComponentFunction) _MathDoMultiply);
  101.                 break;
  102.             }
  103.             
  104.             default:                        // Unknown request
  105.             {
  106.                 result = paramErr;
  107.                 break;
  108.             }
  109.         }
  110.     }
  111.     return (result);
  112. }
  113.                                              
  114. //-----------------------------------------------------------------------
  115.  
  116.  
  117.