home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09964.iso / program / mc.exe / WRITE_C.H < prev   
Encoding:
C/C++ Source or Header  |  1996-05-05  |  2.4 KB  |  129 lines

  1. /*
  2. * this header file can be used when writing C functions that:
  3. *
  4. *     either 1) call MOAL C functions
  5. *         or 2) are called by MOAL C functions
  6. *
  7. * see chapter 8 in the MOAL C Reference Manual for instructions
  8. *
  9. *    Copyright (c) 1996, MOAL Languages. All rights reserved.
  10. */
  11.  
  12. #ifndef _INC_WRITE_C
  13. #define _INC_WRITE_C
  14.  
  15.  
  16. /* type of the metadata occurs and limit numbers */
  17.  
  18. #define moal_t  unsigned int
  19.  
  20.  
  21. /* define the metadata structures for the first 7 dimensions */
  22.  
  23. struct meta_1 {
  24.    void *ptr;
  25.    moal_t occurs;
  26.    moal_t limit;
  27. };
  28.  
  29. struct meta_2 {
  30.    void *ptr;
  31.    moal_t limit1;
  32.    moal_t limit2;
  33. };
  34.  
  35. struct meta_3 {
  36.    void *ptr;
  37.    moal_t limit1;
  38.    moal_t limit2;
  39.    moal_t limit3;
  40. };
  41.  
  42. struct meta_4 {
  43.    void *ptr;
  44.    moal_t limit1;
  45.    moal_t limit2;
  46.    moal_t limit3;
  47.    moal_t limit4;
  48. };
  49.  
  50. struct meta_5 {
  51.    void *ptr;
  52.    moal_t limit1;
  53.    moal_t limit2;
  54.    moal_t limit3;
  55.    moal_t limit4;
  56.    moal_t limit5;
  57. };
  58.  
  59. struct meta_6 {
  60.    void *ptr;
  61.    moal_t limit1;
  62.    moal_t limit2;
  63.    moal_t limit3;
  64.    moal_t limit4;
  65.    moal_t limit5;
  66.    moal_t limit6;
  67. };
  68.  
  69. struct meta_7 {
  70.    void *ptr;
  71.    moal_t limit1;
  72.    moal_t limit2;
  73.    moal_t limit3;
  74.    moal_t limit4;
  75.    moal_t limit5;
  76.    moal_t limit6;
  77.    moal_t limit7;
  78. };
  79.  
  80.  
  81. /* define the metadata pointer types */
  82.  
  83. typedef struct meta_1 * DIM1;
  84. typedef struct meta_2 * DIM2;
  85. typedef struct meta_3 * DIM3;
  86. typedef struct meta_4 * DIM4;
  87. typedef struct meta_5 * DIM5;
  88. typedef struct meta_6 * DIM6;
  89. typedef struct meta_7 * DIM7;
  90.  
  91.  
  92. /* define the first parameter */
  93.  
  94. #define FIRST_PARAM  void *return_ptr[]
  95.  
  96.  
  97. /* MOAL C's one predefined exception */
  98.  
  99. #define MEMORY_FAILURE  32000
  100.  
  101.  
  102. /* macros for setting return values */
  103.  
  104. #define SETRET_EXCEPTION(value) \
  105.   (*((int *)(return_ptr[0])) = (value))
  106.  
  107. #define SETRET_ENUM(sub, value) \
  108.   (*((int *)(return_ptr[sub])) = (value))
  109.  
  110. #define SETRET_ARITHMETIC(sub, formal_type, value) \
  111.   (*((formal_type *)(return_ptr[sub])) = (value))
  112.  
  113. #define SETRET_FUNC_PTR(sub, value) \
  114.   (*((void (**)())(return_ptr[sub])) = (void (*)())(value))
  115.  
  116. #define SETRET_STRUCTURE(sub, structure_tag, value) \
  117.   (*((struct structure_tag *)(return_ptr[sub])) = (value))
  118.  
  119.  
  120. /* macro for declaring a return array */
  121.  
  122. #define DECLARE_RET_ARRAY(array_size) \
  123.   int exception = 0; \
  124.   void *returns[array_size + 1]; \
  125.   returns[0] = (void *)(&exception);
  126.  
  127.  
  128. #endif  /* _INC_WRITE_C */
  129.