home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 April / DPPCPRO0498.ISO / April / MathCad / SETUP / DATA.Z / MCADINCL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-25  |  2.8 KB  |  92 lines

  1. #ifndef _MCADINCL_H_
  2. #define _MCADINCL_H_
  3.  
  4. #include <windows.h>
  5.  
  6. #ifdef __cplusplus
  7. extern "C"
  8. {
  9. #endif // __cplusplus
  10.                            
  11. // complex scalar type
  12. typedef struct tagCOMPLEXSCALAR {
  13.     double real;
  14.     double imag;
  15. } COMPLEXSCALAR;
  16.     
  17. // this is the complex scalar type received from mathcad
  18. typedef const COMPLEXSCALAR * const LPCCOMPLEXSCALAR; 
  19. // this is the complex scalar type that should be returned to mathcad
  20. typedef COMPLEXSCALAR * const LPCOMPLEXSCALAR;
  21.     
  22.  
  23. // complex array type
  24. typedef struct tagCOMPLEXARRAY  {
  25.     unsigned int rows;
  26.     unsigned int cols;
  27.     double **hReal; // hReal[cols][rows],  == NULL when the real part is zero 
  28.     double **hImag; // hImag[cols][rows],  == NULL when the imaginary part is zero
  29. } COMPLEXARRAY;
  30.     
  31. // this is the complex array type received from mathcad
  32. typedef const COMPLEXARRAY * const LPCCOMPLEXARRAY;    
  33. // this is the complex array type that should be returned to mathcad
  34. typedef COMPLEXARRAY * const LPCOMPLEXARRAY;
  35.  
  36.                            
  37.     
  38. // types to be used in declaration of the function's
  39. // arguments and of the return value
  40. #define COMPLEX_SCALAR  1
  41. #define COMPLEX_ARRAY   2     
  42.  
  43. // use this structure to create a function
  44. #define MAX_ARGS        10
  45.  
  46. typedef LRESULT (* LPCFUNCTION ) ( void * const, const void * const, ... );    
  47.  
  48. typedef struct tagFUNCTIONINFO {
  49.     char *  lpstrName;
  50.     char *  lpstrParameters; 
  51.     char *  lpstrDescription;
  52.     LPCFUNCTION lpfnMyCFunction;
  53.     long unsigned int returnType;
  54.     unsigned int nArgs;
  55.     long unsigned int argType[MAX_ARGS];
  56. } FUNCTIONINFO;
  57.  
  58. const void * CreateUserFunction( HINSTANCE, FUNCTIONINFO * );
  59.     
  60. BOOL CreateUserErrorMessageTable(   HINSTANCE, 
  61.                                     unsigned int nErrorMessages,
  62.                                     char  * ErrorMessageTable[] );
  63.                                        
  64. // memory management routines
  65. char * MathcadAllocate( unsigned int size );
  66. void MathcadFree( char * address );
  67.  
  68.  
  69. // array allocation -- should be used to allocate
  70. // return array
  71. BOOL    MathcadArrayAllocate(   COMPLEXARRAY * const, 
  72.                                 unsigned int rows,  
  73.                                 unsigned int cols,
  74.                                 BOOL allocateReal, 
  75.                                 BOOL allocateImag );
  76. // should be used to free ( in case of an error )
  77. // Mathcad allocated return array
  78. void MathcadArrayFree( COMPLEXARRAY * const );
  79.     
  80.     
  81. // this routine can be used to find out 
  82. // whether the user has attempted to interrupt
  83. // Mathcad 
  84. // this routine slows down the execution -- so use judiciously
  85. BOOL isUserInterrupted( void );
  86.     
  87. #ifdef __cplusplus
  88. }
  89. #endif // __cplusplus
  90.     
  91. #endif // _MCADINCL_H_  
  92.