home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / DataScope 2.0.3 / Datafiles / externs / Mac_externs / DScope.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-04  |  1.4 KB  |  48 lines  |  [TEXT/MPS ]

  1. /*
  2.     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3.     Data structure for external functions.
  4.     
  5.     The field "kind" determines whether the array contains a valid
  6.     cval or a valid set of ncols,nrows,rows,cols,vals.
  7.     
  8.     External functions are called as:
  9.     your_fn(lft,rgt,answer)
  10.     scope_array *lft,             left parameter 
  11.                 *rgt,             right parameter 
  12.                 *answer;         place to put the answer 
  13.                 
  14.     Answer will always contain pre-allocated space for an array of
  15.     resulting values, including the rows and cols arrays.  You may
  16.     change any value (and should) in the rows,cols and vals arrays.
  17.     Do not change any values in the lft or rgt storage.
  18.     
  19.     If your routine returns only a constant, set kind == DS_CONSTANT
  20.     and put the answer in cval.
  21.     
  22.     DON'T allocate anything you don't free yourself.
  23.     FREE everything you allocate.
  24.     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. */
  26.  
  27. #define DS_ERROR    -1
  28. #define DS_CONSTANT  0
  29. #define DS_ARRAY     1
  30.  
  31. typedef struct 
  32.         {float    
  33.                 cval,    /* constant value when we are carrying a constant */
  34.                 *rows,    /* row labels, one for each column   */
  35.                 *cols,    /* col labels, one for each row   */
  36.                 *vals;    /* data values in the array, if there is an array 
  37.                             size = ncols*nrows                        */
  38.         
  39.          int    ncols,
  40.                 nrows;    /* dimensions of the array */
  41.     
  42.          char    
  43.                 kind;    /* DS_ERROR, DS_CONSTANT, DS_ARRAY */
  44.         } 
  45.         
  46.         scope_array;
  47.  
  48.