home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_06 / 9n06048a < prev    next >
Text File  |  1991-04-16  |  1KB  |  39 lines

  1.  
  2. /* -------------------------------------------------------------------- */
  3. /* Listing 1 - declarations */
  4.  
  5.  /* structure for function table */
  6.  struct func_list {
  7.    char *funcname;                 /* pointer to function's name */
  8.    struct param *(*func)();        /* pointer to function */
  9.    } ;
  10.  
  11.  /* structure to hold parameter & return values */
  12.   struct param {
  13.        int datatype;
  14.        union {
  15.          char cparam;
  16.          char *sparam;
  17.          int iparam;
  18.          long lparam;
  19.          float fparam;
  20.          /* other types could be added */
  21.          } value;
  22.        } ;
  23.  
  24.    /* data types */
  25. #define CHAR 1
  26. #define STRING 2
  27. #define INTEGER 3
  28.  /* etc. */
  29.  
  30.  /* function prototypes */
  31.   /* to call user function */
  32.  struct param *call_ufunc(char *ufuncname,struct param args[],int num_args);
  33.   /* to search function table */
  34.  struct param *(*lookup(char *funcname, struct func_list functab[]))();
  35.  
  36.  /* user function prototypes */
  37.  struct param *myfunc(struct param *sparm);
  38.  
  39.