home *** CD-ROM | disk | FTP | other *** search
- /*
- * this header file can be used when writing C functions that:
- *
- * either 1) call MOAL C functions
- * or 2) are called by MOAL C functions
- *
- * see chapter 8 in the MOAL C Reference Manual for instructions
- *
- * Copyright (c) 1996, MOAL Languages. All rights reserved.
- */
-
- #ifndef _INC_WRITE_C
- #define _INC_WRITE_C
-
-
- /* type of the metadata occurs and limit numbers */
-
- #define moal_t unsigned int
-
-
- /* define the metadata structures for the first 7 dimensions */
-
- struct meta_1 {
- void *ptr;
- moal_t occurs;
- moal_t limit;
- };
-
- struct meta_2 {
- void *ptr;
- moal_t limit1;
- moal_t limit2;
- };
-
- struct meta_3 {
- void *ptr;
- moal_t limit1;
- moal_t limit2;
- moal_t limit3;
- };
-
- struct meta_4 {
- void *ptr;
- moal_t limit1;
- moal_t limit2;
- moal_t limit3;
- moal_t limit4;
- };
-
- struct meta_5 {
- void *ptr;
- moal_t limit1;
- moal_t limit2;
- moal_t limit3;
- moal_t limit4;
- moal_t limit5;
- };
-
- struct meta_6 {
- void *ptr;
- moal_t limit1;
- moal_t limit2;
- moal_t limit3;
- moal_t limit4;
- moal_t limit5;
- moal_t limit6;
- };
-
- struct meta_7 {
- void *ptr;
- moal_t limit1;
- moal_t limit2;
- moal_t limit3;
- moal_t limit4;
- moal_t limit5;
- moal_t limit6;
- moal_t limit7;
- };
-
-
- /* define the metadata pointer types */
-
- typedef struct meta_1 * DIM1;
- typedef struct meta_2 * DIM2;
- typedef struct meta_3 * DIM3;
- typedef struct meta_4 * DIM4;
- typedef struct meta_5 * DIM5;
- typedef struct meta_6 * DIM6;
- typedef struct meta_7 * DIM7;
-
-
- /* define the first parameter */
-
- #define FIRST_PARAM void *return_ptr[]
-
-
- /* MOAL C's one predefined exception */
-
- #define MEMORY_FAILURE 32000
-
-
- /* macros for setting return values */
-
- #define SETRET_EXCEPTION(value) \
- (*((int *)(return_ptr[0])) = (value))
-
- #define SETRET_ENUM(sub, value) \
- (*((int *)(return_ptr[sub])) = (value))
-
- #define SETRET_ARITHMETIC(sub, formal_type, value) \
- (*((formal_type *)(return_ptr[sub])) = (value))
-
- #define SETRET_FUNC_PTR(sub, value) \
- (*((void (**)())(return_ptr[sub])) = (void (*)())(value))
-
- #define SETRET_STRUCTURE(sub, structure_tag, value) \
- (*((struct structure_tag *)(return_ptr[sub])) = (value))
-
-
- /* macro for declaring a return array */
-
- #define DECLARE_RET_ARRAY(array_size) \
- int exception = 0; \
- void *returns[array_size + 1]; \
- returns[0] = (void *)(&exception);
-
-
- #endif /* _INC_WRITE_C */
-