00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef SU_H
00012 #define SU_H
00013
00014 #include "par.h"
00015
00016
00017 typedef union {
00018 char s[8];
00019 short h;
00020 unsigned short u;
00021 long l;
00022 unsigned long v;
00023 int i;
00024 unsigned int p;
00025 float f;
00026 double d;
00027 unsigned int U:16;
00028 unsigned int P:32;
00029 } Value;
00030
00031
00032
00033 #define CHECK_NT(label,nt) \
00034 if(nt > SU_NFLTS) suerr("%s=%d must not exceed %d",label,nt,SU_NFLTS)
00035 #define NALLOC (524288)
00036 #define NFALLOC (NALLOC/FSIZE)
00037 #define NIALLOC (NALLOC/ISIZE)
00038 #define NDALLOC (NALLOC/DSIZE)
00039 #define LOWBYTE(w) ((w) & 0xFF)
00040 #define HIGHBYTE(w) LOWBYTE((w) >>8)
00041 #define LOWWORD(w) ((w) & 0xFFFF)
00042 #define HIGHWORD(w) LOWWORD((w) >>16)
00043 #define ISNEGCHAR(c) ((c) & 0x80)
00044 #define SIGNEXTEND(c) (~0xFF | (int) (c))
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #define READ_OK 4
00058 #define WRITE_OK 2
00059 #define EXEC_OK 1
00060 #define FILE_OK 0
00061
00062
00063 #define IS_DEPTH(str) (( STREQ(str,"gelev") || \
00064 STREQ(str,"selev") || \
00065 STREQ(str,"sdepth") || \
00066 STREQ(str,"gdel") || \
00067 STREQ(str,"sdel") || \
00068 STREQ(str,"swdep") || \
00069 STREQ(str,"gwdep") )?cwp_true:cwp_false)
00070
00071 #define IS_COORD(str) (( STREQ(str,"sx") || \
00072 STREQ(str,"sy") || \
00073 STREQ(str,"gx") || \
00074 STREQ(str,"gy") )?cwp_true:cwp_false)
00075
00076
00077 #ifdef __cplusplus
00078 extern "C" {
00079 #endif
00080
00081
00082 int vtoi(register cwp_String type, Value val);
00083 long vtol(register cwp_String type, Value val);
00084 float vtof(register cwp_String type, Value val);
00085 double vtod(register cwp_String type, Value val);
00086 int valcmp(register cwp_String type, Value val1, Value val2);
00087 void printfval(register cwp_String type, Value val);
00088 void fprintfval(FILE *stream, register cwp_String type, Value val);
00089 void scanfval(register cwp_String type, Value *valp);
00090 void atoval(cwp_String type, cwp_String keyval, Value *valp);
00091 void getparval(cwp_String name, cwp_String type, int n, Value *valp);
00092 Value valtoabs(cwp_String type, Value val);
00093
00094 #ifdef __cplusplus
00095 }
00096 #endif
00097
00098 #endif