home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / Cobol32 / CRW / 32BIT / DISK6 / UFDLL.H_ / UFDLL.H
C/C++ Source or Header  |  1995-08-29  |  8KB  |  343 lines

  1. /*
  2. ** File:    UFDll.h
  3. ** Author:  Rex Benning, Rick Cameron
  4. ** Date:    3 Mar 93
  5. **
  6. ** Purpose: Declarations for a user-defined function DLL
  7. */
  8.  
  9. #if !defined (UFDLL_H)
  10. #define UFDLL_H
  11.  
  12. #if defined (__cplusplus)
  13.   #define ExternC extern "C"
  14. #else
  15.   #define ExternC
  16. #endif
  17.  
  18. #if defined(WIN32)
  19.   #define _export 
  20. #endif 
  21.  
  22. #pragma pack(1)
  23.  
  24. #define UFMaxNArguments 50
  25.  
  26. #define UFMaxStringLength 254
  27. #define UFUnknownStringLength MaxInt16u
  28.  
  29. typedef signed   char  UFTInt8s;
  30. typedef unsigned char  UFTInt8u;
  31.  
  32. typedef signed   short UFTInt16s;
  33. typedef unsigned short UFTInt16u;
  34.  
  35. typedef signed   long  UFTInt32s;
  36. typedef unsigned long  UFTInt32u;
  37.  
  38. typedef double UFTNumber;
  39. typedef UFTNumber UFTCurrency;
  40.  
  41. typedef UFTInt32s UFTDate;
  42. typedef UFTInt32s UFTTime;
  43.  
  44. typedef UFTInt16s UFTBoolean;
  45.  
  46. #define UFNumberScalingFactor ((UFTNumber) 100.00)
  47.  
  48. typedef enum
  49. {
  50.     UFUserError = -1,
  51.     UFNoError,
  52.     UFNoMemory,
  53.     UFStringTooBig,
  54.     UFDivideByZero,
  55.     UFArrayIndexTooBig,
  56.     UFStringIndexTooBig,
  57.     UFNotEnoughParameters,
  58.     UFMemCalcFail
  59. }
  60.     UFError;
  61.  
  62. typedef enum
  63. {
  64.     UFUndefinedReturn,
  65.     UFStringReturn,
  66.     UFNumberReturn,
  67.     UFDateReturn,
  68.     UFBooleanReturn,
  69.     UFCurrencyReturn,
  70.     UFDateRangeReturn,
  71.     UFNumberRangeReturn,
  72.     UFCurrencyRangeReturn,
  73.     UFStringRangeReturn,
  74.     UFStringArrayReturn,
  75.     UFNumberArrayReturn,
  76.     UFDateArrayReturn,
  77.     UFBooleanArrayReturn,
  78.     UFCurrencyArrayReturn,
  79.     UFLastReturnType
  80. }
  81.     UFReturnTypes;
  82.  
  83. typedef enum
  84. {
  85.     UFUndefinedType,
  86.     UFNumber,
  87.     UFCurrency,
  88.     UFNumberToCurrency,
  89.     UFInteger,
  90.     UFBoolean,
  91.     UFDate,
  92.     UFStringArg,
  93.     UFNumberRange,
  94.     UFCurrencyRange,
  95.     UFNumberToCurrencyRange,
  96.     UFIntegerRange,
  97.     UFBooleanRange, // ... for completeness, not likely used
  98.     UFDateRange,
  99.     UFStringRange,
  100.     UFNumberArray,
  101.     UFCurrencyArray,
  102.     UFNumberToCurrencyArray,
  103.     UFIntegerArray,
  104.     UFBooleanArray,
  105.     UFDateArray,
  106.     UFStringArray,
  107.     UFField
  108. }
  109.     UFTypeDefs;
  110.  
  111.  
  112. typedef union
  113. {
  114.     UFTInt32s   ParamInteger;
  115.     UFTNumber   ParamNumber;
  116.     UFTDate     ParamDate;
  117.     UFTBoolean  ParamBoolean;
  118.     UFTCurrency ParamCurrency;
  119.     char        FAR *ParamString;
  120.     UFTNumber   FAR *ParamNumberArray;
  121.     UFTInt32s   FAR *ParamIntegerArray;
  122.     UFTDate     FAR *ParamDateArray;
  123.     UFTBoolean  FAR *ParamBooleanArray;
  124.     UFTCurrency FAR *ParamCurrencyArray;
  125.     char        FAR * FAR *ParamStringArray;
  126.     void        FAR *ParamArrayPointer;
  127.  
  128.     struct
  129.     {
  130.         UFTInt32s ParamIntStart;
  131.         UFTInt32s ParamIntEnd;
  132.     }
  133.         ParamIntRange;
  134.  
  135.     struct
  136.     {
  137.         UFTDate    ParamDateStart;
  138.         UFTDate    ParamDateEnd;
  139.     }
  140.         ParamDateRange;
  141.  
  142.     struct
  143.     {
  144.         UFTNumber  ParamNumberStart;
  145.         UFTNumber  ParamNumberEnd;
  146.     }
  147.         ParamNumberRange;
  148.  
  149.     struct
  150.     {
  151.         UFTNumber  ParamCurrencyStart;
  152.         UFTNumber  ParamCurrencyEnd;
  153.     }
  154.         ParamCurrencyRange;
  155.  
  156.     struct
  157.     {
  158.         char FAR *ParamStringStart;
  159.         char FAR *ParamStringEnd;
  160.     }
  161.         ParamStringRange;
  162.  
  163.     struct _UFMemCalcParam FAR *MemCalcSubParam;
  164. } UFParamUnion;
  165.  
  166. typedef struct _UFParamListElement
  167. {
  168.     UFTInt16u StructSize;
  169.     struct _UFParamListElement FAR *NextParam;
  170.     UFTInt16s ParamLength;
  171.     UFTypeDefs ParamType;
  172.     UFParamUnion Parameter;
  173. }
  174.     UFParamListElement;
  175.  
  176. typedef enum
  177. {
  178.     UFLiteral,
  179.     UFArray,
  180.     UFVariable,
  181.     UFExpression
  182. }
  183.     UFMemCalcParmTypes;
  184.  
  185. typedef struct _UFMemCalcParam // For use when asking the DLL how much memory to allocate
  186.                                // for a returned string or array.
  187. {
  188.     UFTInt16u StructSize;
  189.     struct _UFMemCalcParam FAR *NextMemCalcParam;
  190.     UFTInt16s MemCalcParamLength; // Array or String length
  191.     UFMemCalcParmTypes MemCalcLiteralFlag;
  192.     UFTypeDefs MemCalcParamType;
  193.     UFParamUnion MemCalcParameter;
  194. }
  195.     UFMemCalcParam;
  196.  
  197. typedef union
  198. {
  199.     UFTNumber   ReturnNumber;
  200.     UFTDate     ReturnDate;
  201.     UFTBoolean  ReturnBoolean;
  202.     UFTCurrency ReturnCurrency;
  203.     char        FAR *ReturnString;
  204.  
  205.     struct
  206.     {
  207.         UFTInt32s ReturnIntStart;
  208.         UFTInt32s ReturnIntEnd;
  209.     }
  210.         ReturnIntRange;
  211.  
  212.     struct
  213.     {
  214.         UFTDate ReturnDateStart;
  215.         UFTDate ReturnDateEnd;
  216.     }
  217.         ReturnDateRange;
  218.  
  219.     struct
  220.     {
  221.         UFTNumber ReturnNumberStart;
  222.         UFTNumber ReturnNumberEnd;
  223.     }
  224.         ReturnNumberRange;
  225.  
  226.     struct
  227.     {
  228.         char FAR *ReturnStringStart;
  229.         char FAR *ReturnStringEnd;
  230.     }
  231.         ReturnStringRange;
  232.  
  233.     UFTInt32s UFReturnUserError;
  234.  
  235.     UFTNumber   FAR *ReturnNumberArray;
  236.     UFTDate     FAR *ReturnDateArray;
  237.     UFTBoolean  FAR *ReturnBooleanArray;
  238.     UFTCurrency FAR *ReturnCurrencyArray;
  239.     char        FAR * FAR *ReturnStringArray;
  240. }
  241.     UFReturnUnion;
  242.  
  243. typedef enum
  244. {
  245.     UFCalcStringLength,
  246.     UFCalcArraySize
  247. }
  248.     UFMemCalcType;
  249.  
  250. typedef struct
  251. {
  252.     UFTInt16u StructSize;
  253.     UFReturnUnion ReturnValue;
  254.     UFTInt16s ReturnValueLength;
  255.     UFTInt16s FunctionNumber;
  256.     void (FAR PASCAL *UFErrorHandler) (UFError);
  257.     UFParamListElement FAR *UFParamList;
  258.     UFTInt32u JobId;
  259. }
  260.     UFParamBlock;
  261.  
  262. typedef struct // For use when asking the DLL how much memory to allocate
  263.                // for a returned string or array.
  264. {
  265.     UFTInt16u StructSize;
  266.     UFMemCalcType MemCalcCommand;
  267.     UFTInt16s UFMemCalcArrayLength;
  268.     UFTInt16s UFMemCalcStringLength;
  269.     UFMemCalcParam FAR *UFMemCalcParamList; // For calculating string sizes
  270.     UFParamListElement FAR *UFParamList;    // For calculating array sizes.
  271. }
  272.     UFMemCalcBlock;
  273.  
  274.  
  275. typedef struct
  276. {
  277.     char FAR *FuncDef;                               // The Ascii name of the function
  278.     UFReturnTypes UFReturnKind;                      // Return Type
  279.     UFError (FAR PASCAL *UFEntry) (UFParamBlock FAR *); // Pointer to the entry address in the library
  280.     UFError (FAR PASCAL *UFMemCalcFunc) (UFMemCalcBlock FAR *); // Pointer to a function that will
  281.                                                             // calculate how big a string or array
  282.                                                             // this function will return.
  283.     UFTInt16s ParamCount;                            // The number of parameters
  284.     UFTypeDefs ParamTypeArray [UFMaxNArguments];     // An array of type indicators corresponding
  285.                                                      // to each parameter.
  286. }
  287.     UFFunctionDefinitions;
  288.  
  289. typedef struct
  290. {
  291.     char FAR *FuncDefString;
  292.     UFError (FAR PASCAL *UFEntry) (UFParamBlock FAR *);
  293.     UFError (FAR PASCAL *UFMemCalcFunc) (UFMemCalcBlock FAR *);
  294. }
  295.     UFFunctionDefStrings;
  296.  
  297. typedef struct  // An encasing structure for extendability,
  298.                 // the first element will indicate, and check, which
  299.                 // version of the interface is in use. It is set by
  300.                 // the compiler using the sizeof operator. Any changes
  301.                 // to the interface must change the size of this structure.
  302. {
  303.     UFTInt16u StructSize;
  304.     UFFunctionDefStrings FAR *UFFunctionDefStrPtr;
  305. }
  306.     UFFunctionDefStringList;
  307.  
  308. typedef struct
  309. {
  310.     char FAR *FuncTemplate;
  311. }
  312.     UFFunctionTemplates;
  313.  
  314. typedef struct  // An encasing structure for extendability,
  315.                 // the first element will indicate, and check, which
  316.                 // version of the interface is in use. It is set by
  317.                 // the compiler using the sizeof operator. Any changes
  318.                 // to the interface must change the size of this structure.
  319. {
  320.     UFTInt16u StructSize;
  321.     UFFunctionTemplates FAR *UFFuncTemplatePtr;
  322. }
  323.     UFFunctionTemplateList;
  324.  
  325. typedef struct
  326. {
  327.     char FAR *FuncExample;
  328. }
  329.     UFFunctionExamples;
  330.  
  331. typedef struct  // An encasing structure for extendability,
  332.                 // the first element will indicate, and check, which
  333.                 // version of the interface is in use. It is set by
  334.                 // the compiler using the sizeof operator. Any changes
  335.                 // to the interface must change the size of this structure.
  336. {
  337.     UFTInt16u StructSize;
  338.     UFFunctionExamples FAR *FuncExample;
  339. }
  340.     UFFunctionExampleList;
  341.  
  342. #endif // UFDLL_H
  343.