home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 12.img / ADS1.LIB / CALMNGF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-27  |  4.3 KB  |  108 lines

  1. /*****************************************************************************
  2.       CALMNGF.H
  3.       (C) Copyright 1988-1992 by Autodesk, Inc.
  4.  
  5.       This program is copyrighted by Autodesk, Inc. and is  licensed
  6.       to you under the following conditions.  You may not distribute
  7.       or  publish the source code of this program in any form.   You
  8.       may  incorporate this code in object form in derivative  works
  9.       provided  such  derivative  works  are  (i.) are  designed and 
  10.       intended  to  work  solely  with  Autodesk, Inc. products, and 
  11.       (ii.)  contain  Autodesk's  copyright  notice  "(C)  Copyright  
  12.       1988-1992 by Autodesk, Inc."
  13.  
  14.       AUTODESK  PROVIDES THIS PROGRAM "AS IS" AND WITH  ALL  FAULTS.
  15.       AUTODESK  SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF  MER-
  16.       CHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK,  INC.
  17.       DOES  NOT  WARRANT THAT THE OPERATION OF THE PROGRAM  WILL  BE
  18.       UNINTERRUPTED OR ERROR FREE.
  19.  
  20.   Description: header file for calmngf.c.
  21.  
  22. *****************************************************************************/
  23.  
  24.  
  25. /****************************************************************************/
  26. /*  DEFINES                                                                 */
  27. /****************************************************************************/
  28.  
  29. #define MAX_CAL_FUNC    200           /* Max number of calculator functions */
  30. #define MAX_FUNC_PARAM   20           /* Max number of function parameters  */
  31.  
  32. /* Checking the type of input parameters to calculator functions */
  33.  
  34. #define IS_VECTOR(i) (params[i].type==vector_type)
  35. #define IS_REAL(i)   ((params[i].type==real_type)||(params[i].type==int_type))
  36. #define IS_INT(i)    (params[i].type==int_type)
  37.  
  38.  
  39. /****************************************************************************/
  40. /*  TYPEDEFS                                                                */
  41. /****************************************************************************/
  42.  
  43.  
  44. /* The table of calculator functions */
  45.  
  46. typedef struct
  47. {
  48.     char name[MAX_SYMBOL_LENGTH+1];
  49.     void (*func)();
  50. } cft[MAX_CAL_FUNC];
  51.  
  52.  
  53. /****************************************************************************/
  54. /*  EXPORTED VARIABLES AND FUNCTIONS                                        */
  55. /****************************************************************************/
  56.  
  57. extern cft cal_funcs_table;           /* Table of calculator functions  */
  58. extern int cal_funcs_number;          /* Number of calculator functions */
  59.  
  60. /* Variables for passing actual parameters to calculator functions 
  61.    and returning the value from the function:
  62.  
  63.    Before a calculator function is called, its acutal parameters must 
  64.    be stored in global array 'params[]' and the number of parameters in
  65.    'no_of_params. The function returns its result in global variable 
  66.    'result'.
  67. */
  68.  
  69. extern int             no_of_params;
  70. extern vector_real_int params[MAX_FUNC_PARAM];
  71. extern vector_real_int result;
  72.  
  73.  
  74. /****************************************************************************/
  75. /*.doc cal_register_function(external)*/
  76. /*+
  77.   Function registers new calculator function. 'func_name' is the
  78.   name of the function which will be used to refer to this function
  79.   in arithmetic expressions, 'func_ptr' is a pointer to the function 
  80.   definition. If the function fails, it prints an error message
  81.   and terminates the ADS application.
  82. -*/
  83. /****************************************************************************/
  84.  
  85. void cal_register_function _((char *func_name, void (*func_ptr)()));
  86.  
  87.  
  88. /****************************************************************************/
  89. /*.doc cal_invoke_function(external)*/
  90. /*+
  91.   Invoke calculator function whose name is 'func_name'. 
  92.  
  93.   Before a function is invoked, the function parameters must be stored in 
  94.   array'params[]', the number of actual parameters in 'no_of_params'. The 
  95.   invoked function returns its result in 'result'. 
  96.  
  97.   Function returns TRUE if function 'func_name' was successfully invoked
  98.   and the invoked function succeeded, otherwise FALSE is returned. You can
  99.   use 'cal_err' variable to check the reason why the invocation failed.
  100. -*/
  101. /****************************************************************************/
  102.  
  103. int cal_invoke_function _((char *func_name));
  104.  
  105.  
  106.  
  107.  
  108.