Mapper
checkparm.c
Go to the documentation of this file.
1 /*Translated by FOR_C, v3.4.2 (-), on 04/06/95 at 14:16:27 */
2 /*FOR_C Options SET: c=2 com=u do=r44 ftn=ln6kk op=iv s=dvnk str=l sq=i */
3 #define _POSIX_SOURCE
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <ctype.h>
7 #include <dirent.h>
8 #include <unistd.h>
9 #include <math.h>
10 #include <string.h>
11 #include <fcntl.h>
12 #include <sys/stat.h>
13 #include "shef_structs_external.h"
14 
15 /*---------------------------------------------------------------------
16 
17  NAME
18  CHECKPARM
19 
20  PURPOSE
21  To validate the PEDSTEP codes read into memory from inputparm
22 
23  VERSION and UPDATES
24  1.0 MAY 94 David G. Brandon
25  Original Version
26  Also translated to 'C' using FOR_C
27  1.1 OCT 95 DGB
28  Change from fixed array sizes to values read out of the
29  header file. Add iscore to t_codes array.
30  1.2 JAN 96 DGB
31  Remove the FORC functions such as f_strncpy and
32  replace them with standard C functions.
33  *--------------------------------------------------------------------- */
34 
35 void checkparm(kodp, kode, kodd, kodt, kods, kodex, kodpr, value, ival, inum)
36 short int *kodp, *kode, *kodd, *kodt, *kods, *kodex, *kodpr;
37 double *value;
38 short int *ival, *inum;
39 {
40  static char headr[3];
41  static short int i;
42 
43  /* OFFSET Vectors w/subscript range: 1 to dimension */
44  short *const Durvalue = &parms2_.durvalue[0] - 1;
45  short *const Exvalue = &parms2_.exvalue[0] - 1;
46  short *const Numval = &parms2_.numval[0] - 1;
47  double *const Pevalue = &parms3_.pevalue[0] - 1;
48  double *const Provalue = &parms3_.provalue[0] - 1;
49  short *const Sendflag = &parms2_.sendflag[0] - 1;
50  short *const Tsvalue = &parms2_.tsvalue[0] - 1;
51 
52  *value = -9.0e0;
53  *ival = -9;
54 
55  /* Validate PE code */
56  if( *inum == 1 )
57  {
58  memset(headr,0,sizeof(headr));
59  headr[0] = (char) *kodp;
60  headr[1] = (char) *kode;
61  i = 1;
62  while( i <= Numval[1] )
63  {
64  if ( strcmp(headr,parms1_.peval[i-1]) == 0 )
65  {
66  *value = Pevalue[i];
67  return;
68  }
69  i = i + 1;
70  }
71  return;
72 
73  }
74 
75  /* Duration codes */
76 
77  if( *inum == 2 )
78  {
79 
80  i = 1;
81  while( i <= Numval[2] )
82  {
83  if ( parms1_.durval[i-1][0] == (char) *kodd )
84  {
85  *ival = Durvalue[i];
86  return;
87  }
88  i = i + 1;
89  }
90  return;
91  }
92 
93  /* Type Source Codes */
94 
95  if( *inum == 3 )
96  {
97 
98  memset(headr,0,sizeof(headr));
99  headr[0] = (char) *kodt;
100  headr[1] = (char) *kods;
101 
102  i = 1;
103  while( i <= Numval[3] )
104  {
105  if ( strcmp(headr,parms1_.tsval[i-1]) == 0 )
106  {
107  *ival = Tsvalue[i];
108  return;
109  }
110  i = i + 1;
111  }
112  return;
113 
114  }
115 
116  /* Extremum Codes */
117 
118  if( *inum == 4 )
119  {
120 
121  i = 1;
122  while( i <= Numval[4] )
123  {
124  if( parms1_.exval[i - 1][0] == (char) *kodex )
125  {
126  *ival = Exvalue[i];
127  return;
128  }
129  i = i + 1;
130  }
131  return;
132 
133  }
134 
135  /* Probability Codes */
136 
137  if( *inum == 5 )
138  {
139 
140  i = 1;
141  while( i <= Numval[5] )
142  {
143  if( parms1_.proval[i - 1][0] == (char) *kodpr )
144  {
145  *value = Provalue[i];
146  return;
147  }
148  i = i + 1;
149  }
150  return;
151 
152  }
153 
154  /* Send Codes */
155 
156  if( *inum == 6 )
157  {
158 
159  memset(headr,0,sizeof(headr));
160  headr[0] = (char) *kodp;
161  headr[1] = (char) *kode;
162  i = 1;
163  while( i <= Numval[6] )
164  {
165  if ( strcmp(headr,parms1_.senval[i - 1]) == 0 )
166  {
167  *ival = i;
168  return;
169  }
170  i = i + 1;
171  }
172  return;
173 
174  }
175 
176  return;
177 }
178 
static int i
void checkparm(short int *kodp, short int *kode, short int *kodd, short int *kodt, short int *kods, short int *kodex, short int *kodpr, double *value, short int *ival, short int *inum)
Definition: checkparm.c:35
float value
struct t_parms1_ parms1_
struct t_parms2_ parms2_
struct t_parms3_ parms3_
char senval[NUM_SENVAL][3]
Definition: shef_structs.h:86
char exval[NUM_EXVAL][3]
Definition: shef_structs.h:86
char peval[NUM_PEVAL][3]
Definition: shef_structs.h:85
char tsval[NUM_TSVAL][3]
Definition: shef_structs.h:85
char proval[NUM_PROVAL][3]
Definition: shef_structs.h:86
char durval[NUM_DURVAL][3]
Definition: shef_structs.h:85
short int numval[7]
Definition: shef_structs.h:90
short int exvalue[NUM_EXVAL]
Definition: shef_structs.h:89
short int durvalue[NUM_DURVAL]
Definition: shef_structs.h:89
short int tsvalue[NUM_TSVAL]
Definition: shef_structs.h:89
short int sendflag[NUM_SENVAL]
Definition: shef_structs.h:90
double provalue[NUM_PROVAL]
Definition: shef_structs.h:94
double pevalue[NUM_PEVAL]
Definition: shef_structs.h:94