From: Andy Spencer Date: Sun, 28 Aug 2011 22:16:31 +0000 (+0000) Subject: Change RSL variables from static to extern X-Git-Url: http://pileus.org/git/?p=~andy%2Frsl;a=commitdiff_plain;h=b294c71ba03b0d864e4a98652a259de3f5df7d25 Change RSL variables from static to extern --- diff --git a/examples/any_to_gif.c b/examples/any_to_gif.c index 7493029..dcb971e 100644 --- a/examples/any_to_gif.c +++ b/examples/any_to_gif.c @@ -10,7 +10,6 @@ * */ -#define USE_RSL_VARS #include "rsl.h" /* Example use for getopt; argument processing */ diff --git a/examples/any_to_ppm.c b/examples/any_to_ppm.c index 42a41b4..9f70201 100644 --- a/examples/any_to_ppm.c +++ b/examples/any_to_ppm.c @@ -11,7 +11,6 @@ */ #include -#define USE_RSL_VARS #include "rsl.h" int main(int argc, char **argv) diff --git a/examples/qlook.c b/examples/qlook.c index ec53373..eb90b00 100644 --- a/examples/qlook.c +++ b/examples/qlook.c @@ -6,7 +6,6 @@ #include #include #include -#define USE_RSL_VARS #include "rsl.h" #define ZDR_WIDTH 10 diff --git a/src/dorade_to_radar.c b/src/dorade_to_radar.c index 4af897a..b3c8c66 100644 --- a/src/dorade_to_radar.c +++ b/src/dorade_to_radar.c @@ -25,7 +25,6 @@ #include #include #include -#define USE_RSL_VARS #include "rsl.h" #include "dorade.h" diff --git a/src/lassen_to_radar.c b/src/lassen_to_radar.c index a7ae48d..7925c50 100644 --- a/src/lassen_to_radar.c +++ b/src/lassen_to_radar.c @@ -36,7 +36,6 @@ #include #include -#define USE_RSL_VARS #include "rsl.h" #ifdef HAVE_LASSEN diff --git a/src/radar_to_uf.c b/src/radar_to_uf.c index f5a18ab..fae49a2 100644 --- a/src/radar_to_uf.c +++ b/src/radar_to_uf.c @@ -25,7 +25,6 @@ #include #include -#define USE_RSL_VARS #include "rsl.h" extern int radar_verbose_flag; /* Missing data flag : -32768 when a signed short. */ @@ -186,7 +185,7 @@ void RSL_radar_to_uf_fp(Radar *r, FILE *fp) fprintf(stderr,"Maximum # of volumes for UF is %d\n", nvolumes); } - max_field_names = sizeof(RSL_ftype) / 4; + max_field_names = MAX_RADAR_VOLUMES; /*-------- * LOOP for all sweeps (typically 11 or 16 for wsr88d data. diff --git a/src/rsl.h b/src/rsl.h index b3ea1f4..de6de71 100644 --- a/src/rsl.h +++ b/src/rsl.h @@ -843,36 +843,11 @@ Range HC_INVF(float x); Range VC_INVF(float x); Range SD_INVF(float x); +/* Type identifiers and function tables */ +extern char *RSL_ftype[]; +extern float (*RSL_f_list[])(Range x); +extern Range (*RSL_invf_list[])(float x); -/* If you like these variables, you can use them in your application - * by defining USE_RSL_VARS before #include "rsl.h" - */ -#ifdef USE_RSL_VARS -static char *RSL_ftype[] = {"DZ", "VR", "SW", "CZ", "ZT", "DR", - "LR", "ZD", "DM", "RH", "PH", "XZ", - "CD", "MZ", "MD", "ZE", "VE", "KD", - "TI", "DX", "CH", "AH", "CV", "AV", - "SQ", "VS", "VL", "VG", "VT", "NP", - "HC", "VC", "V2", "S2", "V3", "S3", - "CR", "CC", "PR", "SD", "ZZ", "RD"}; - -static float (*RSL_f_list[])(Range x) = {DZ_F, VR_F, SW_F, CZ_F, ZT_F, DR_F, - LR_F, ZD_F, DM_F, RH_F, PH_F, XZ_F, - CD_F, MZ_F, MD_F, ZE_F, VE_F, KD_F, - TI_F, DX_F, CH_F, AH_F, CV_F, AV_F, - SQ_F, VS_F, VL_F, VG_F, VT_F, NP_F, - HC_F, VC_F, VR_F, SW_F, VR_F, SW_F, - DZ_F, CZ_F, PH_F, SD_F, DZ_F, DZ_F}; - -static Range (*RSL_invf_list[])(float x) - = {DZ_INVF, VR_INVF, SW_INVF, CZ_INVF, ZT_INVF, DR_INVF, - LR_INVF, ZD_INVF, DM_INVF, RH_INVF, PH_INVF, XZ_INVF, - CD_INVF, MZ_INVF, MD_INVF, ZE_INVF, VE_INVF, KD_INVF, - TI_INVF, DX_INVF, CH_INVF, AH_INVF, CV_INVF, AV_INVF, - SQ_INVF, VS_INVF, VL_INVF, VG_INVF, VT_INVF, NP_INVF, - HC_INVF, VC_INVF, VR_INVF, SW_INVF, VR_INVF, SW_INVF, - DZ_INVF, CZ_INVF, PH_INVF, SD_INVF, DZ_INVF, DZ_INVF}; -#endif /* Secret routines that are quite useful and useful to developers. */ void radar_load_date_time(Radar *radar); int big_endian(void); diff --git a/src/uf_to_radar.c b/src/uf_to_radar.c index 870f5ed..d9d0673 100644 --- a/src/uf_to_radar.c +++ b/src/uf_to_radar.c @@ -24,9 +24,6 @@ #include #include #include - -/* This allows us to use RSL_ftype, RSL_f_list, RSL_invf_list from rsl.h. */ -#define USE_RSL_VARS #include "rsl.h" extern int radar_verbose_flag; diff --git a/src/volume.c b/src/volume.c index a30368b..eddcc1d 100644 --- a/src/volume.c +++ b/src/volume.c @@ -67,7 +67,6 @@ #include int strcasecmp(const char *s1, const char *s2); -#define USE_RSL_VARS #include "rsl.h" #define bin_azimuth(x, dx) (float)((float)x/dx) @@ -111,6 +110,30 @@ extern int radar_verbose_flag; */ #define F_OFFSET 4 +char *RSL_ftype[] = {"DZ", "VR", "SW", "CZ", "ZT", "DR", + "LR", "ZD", "DM", "RH", "PH", "XZ", + "CD", "MZ", "MD", "ZE", "VE", "KD", + "TI", "DX", "CH", "AH", "CV", "AV", + "SQ", "VS", "VL", "VG", "VT", "NP", + "HC", "VC", "V2", "S2", "V3", "S3", + "CR", "CC", "PR", "SD", "ZZ", "RD"}; + +float (*RSL_f_list[])(Range x) = {DZ_F, VR_F, SW_F, CZ_F, ZT_F, DR_F, + LR_F, ZD_F, DM_F, RH_F, PH_F, XZ_F, + CD_F, MZ_F, MD_F, ZE_F, VE_F, KD_F, + TI_F, DX_F, CH_F, AH_F, CV_F, AV_F, + SQ_F, VS_F, VL_F, VG_F, VT_F, NP_F, + HC_F, VC_F, VR_F, SW_F, VR_F, SW_F, + DZ_F, CZ_F, PH_F, SD_F, DZ_F, DZ_F}; + +Range (*RSL_invf_list[])(float x) + = {DZ_INVF, VR_INVF, SW_INVF, CZ_INVF, ZT_INVF, DR_INVF, + LR_INVF, ZD_INVF, DM_INVF, RH_INVF, PH_INVF, XZ_INVF, + CD_INVF, MZ_INVF, MD_INVF, ZE_INVF, VE_INVF, KD_INVF, + TI_INVF, DX_INVF, CH_INVF, AH_INVF, CV_INVF, AV_INVF, + SQ_INVF, VS_INVF, VL_INVF, VG_INVF, VT_INVF, NP_INVF, + HC_INVF, VC_INVF, VR_INVF, SW_INVF, VR_INVF, SW_INVF, + DZ_INVF, CZ_INVF, PH_INVF, SD_INVF, DZ_INVF, DZ_INVF}; float DZ_F(Range x) { if (x >= F_OFFSET) /* This test works when Range is unsigned. */