/********* header file for tios.c sio.c io-system ***************/ #define ABS(x) ((x)>=0?(x):-(x)) #define MIN(x,y) ((x)>(y)?(y):(x)) #define MAX(x,y) ((x)>(y)?(x):(y)) #define APPROX_EQ(x,y,e) ((float)ABS((x)-(y)) < 0.5*e) #define ENSO_DAY (12./365.) #define REAL float #define UINT unsigned int #define FRST_WORD "first" #define LAST_WORD "last" #define AUTO_FLAG (-987654.) #define MAX_SLICES 50 typedef struct ADDR { UINT val; REAL time; struct ADDR *next; } ADDR; typedef struct RG_ST { int num, fmt, absolute; REAL sta, end, step; }RG_ST; typedef struct RANGE { struct RG_ST x, y, z, t; int range_nu; struct RANGE *next; }RANGE; typedef struct MAP { int map_nu; int NMAP, NXY; int *cmp; struct MAP *next; }MAP; typedef struct GRID { int grid_nu; int NX, NY, NZ; REAL *xx, *yy, *zz; struct GRID *next; }GRID; typedef struct GR_MAP { int gmap_nu; struct GRID *grid; struct RANGE *range; int MX, MY, MZ; int *mapx, *mapy, *mapz; struct GR_MAP *next; }GR_MAP; #define LABEL_STREAM_LEN 48 #define MAX_ADJS 20 typedef struct STREAM { int stream_nu; char label[LABEL_STREAM_LEN]; struct { char id; int num, *adr; REAL *val; } slice; struct { int count, init, fmt, absolute; REAL sta, end, step, next, *data; } time; int size; struct GR_MAP *gmap; struct { int count, num[MAX_ADJS]; struct VAR *adr[MAX_ADJS]; } vars; UINT *laddr; struct ADDR *addr, *curr; struct STREAM *next; } STREAM; #define STR_VAR_LEN 12 typedef struct VAR { int var_nu, type, blength, used; char label[STR_VAR_LEN]; REAL *var; REAL flag; void (*func)(); struct MAP *map; struct GRID *grid; struct { int count, num[MAX_ADJS]; struct STREAM *adr[MAX_ADJS]; } strs; struct VAR *next; } VAR; #define TITLE_TIOS_LEN 128 typedef struct TIOS { int map_count; int grid_count; int gmap_count; int rang_count; int str_count; int var_count; int time_fmt; struct { int everystep; int debug; int updated; int restart; } cntrl; REAL time_begin, time_end, time_resolution; struct MAP *maps; struct GRID *grids; struct GR_MAP *gr_maps; struct RANGE *ranges; struct VAR *vars; struct STREAM *streams; char tios_name[TITLE_TIOS_LEN]; long addr_start; long addr_grids; long addr_vars; long addr_strs; long addr_end; }TIOS; VAR *var_curr; GRID *grid_curr; GR_MAP *gmap_curr; STREAM *str_curr; ADDR *addr_curr; RANGE *rang_curr; MAP *map_curr; FILE *indx_file, *data_file, *tios_file, *ingr_file; TIOS tios; /********************************************/