Mapper
shdrive.c
Go to the documentation of this file.
1 /*Translated by FOR_C, v3.4.2 (-), on 06/07/94 at 17:00:30 */
2 /*FOR_C Options SET: c=2 com=u do=r4 ftn=2ln6k op=iv s=dvn str=l sq=i */
3 
4 #define _POSIX_SOURCE
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <ctype.h>
8 #include <dirent.h>
9 #include <unistd.h>
10 #include <math.h>
11 #include <string.h>
12 #include <fcntl.h>
13 #include <sys/stat.h>
14 #include "shef_structs_external.h"
15 
16 /*---------------------------------------------------------------------
17 
18  SUBROUTINE SHDRIVE
19 
20  PURPOSE
21  Controls the appropriate decode routine needed
22 
23  VERSION and UPDATES
24  1.0 APR 82 Geoffrey M. Bonnin
25  Original Version
26  1.1 AUG 84
27  Count non-fatal errors
28  1.2 JUN 89 David G. Brandon
29  Adapted to QNX Hydromet
30  2.0 JUN 94 David G. Brandon
31  Also Translated to 'C' using FOR_C
32  Removed alternate returns in subroutines
33  2.1 OCT 95 DGB
34  Add PE_SIZE and TS_SIZE macros for dimensioning.
35 
36  *--------------------------------------------------------------------- */
37 
38 
39 void shdrive()
40 {
41  int DEBUG1;
42  static short int iflag, irev, status;
43 
44 
45  /* OFFSET Vectors w/subscript range: 1 to dimension */
46  short *const Ibuf = &buffer_.ibuf[0] - 1;
47  short *const Idate = &datim_.idate[0] - 1;
48 
49  DEBUG1 = 0;
50 
51  if ( DEBUG1 ) printf("\nshdrive: begin");
52  status = 0;
53  buffer_.nblnk = 0;
54  format_.iform = 0;
55  format_.nerr = 0;
56  error_.nerror = 0;
57  error_.nwarn = 0;
58  goto L_25;
59 
60  /* Look for a SHEF Format and Get the Type */
61 
62 L_23:
63  iflag = 0;
64  goto L_30;
65 L_25:
66  iflag = 1;
67 L_30:
68 
70  shfor( &format_.iform, &iflag, &status );
71  if( status == 1 )
72  {
73  status = 0;
74  goto L_9000;
75  }
76 
77  sendflg_.nsflag = 0;
78 
79  /* Decode this Format Type */
80  switch( abs(format_.iform) )
81  {
82  case 1: goto L_100;
83  case 2: goto L_110;
84  case 3: goto L_120;
85  case 4: goto L_130;
86  case 5: goto L_140;
87  case 6: goto L_150;
88  }
89 
90 L_100:
91  if ( DEBUG1 ) printf("\nshdrive:calling shdeca");
92  irev = 0;
93 
94  shdeca( &irev, &status ); /* .A FORMAT */
95  if( status == 1 )
96  {
97  status = 0;
98  goto L_25;
99  }
100  else if( status == 2 )
101  {
102  status = 0;
103  goto L_9000;
104  }
105 
106  iflag = 0;
107  goto L_30;
108 
109 L_110:
110 
111  if ( DEBUG1 ) printf("\nshdrive:calling shdeca");
112 
113  irev = 1;
114 
115  shdeca( &irev, &status ); /* .AR FORMAT */
116  if( status == 1 )
117  {
118  status = 0;
119  goto L_25;
120  }
121  else if( status == 2 )
122  {
123  status = 0;
124  goto L_9000;
125  }
126 
127  iflag = 0;
128  goto L_30;
129 
130 L_120:
131  if ( DEBUG1 ) printf("\nshdrive:calling shdecb");
132 
133  irev = 0;
134 
135  shdecb( &irev, &status ); /* .B FORMAT */
136  if( status == 1 )
137  {
138  status = 0;
139  goto L_25;
140  }
141  else if( status == 2 )
142  {
143  status = 0;
144  goto L_9000;
145  }
146  else if( status == 3 )
147  {
148  status = 0;
149  goto L_23;
150  }
151 
152  iflag = 1;
153  goto L_30;
154 
155 L_130:
156  if ( DEBUG1 ) printf("\nshdrive:calling shdecb");
157 
158  irev = 1;
159  shdecb( &irev, &status ); /* .BR FORMAT */
160  if( status == 1 )
161  {
162  status = 0;
163  goto L_25;
164  }
165  else if( status == 2 )
166  {
167  status = 0;
168  goto L_9000;
169  }
170  else if( status == 3 )
171  {
172  status = 0;
173  goto L_23;
174  }
175 
176  iflag = 1;
177  goto L_30;
178 
179 L_140:
180 
181  if ( DEBUG1 ) printf("\nshdrive:calling shdece");
182 
183  irev = 0;
184  shdece( &irev, &status ); /* .E FORMAT */
185  if( status == 1 )
186  {
187  status = 0;
188  goto L_25;
189  }
190  else if( status == 2 )
191  {
192  status = 0;
193  goto L_9000;
194  }
195 
196  iflag = 0;
197  goto L_30;
198 
199 
200 L_150:
201 
202  if ( DEBUG1 ) printf("\nshdrive:calling shdece");
203 
204  irev = 1;
205  shdece( &irev, &status ); /* .ER FORMAT */
206  if( status == 1 )
207  {
208  status = 0;
209  goto L_25;
210  }
211  else if( status == 2 )
212  {
213  status = 0;
214  goto L_9000;
215  }
216 
217  iflag = 0;
218  goto L_30;
219 
220  /* Write Error Stats */
221 
222 L_9000:
223 
226  fprintf( fp_.icher,
227  " NUMBER OF WARNING ERRORS IS %d \n NUMBER OF FATAL ERRORS IS %d",
229  return;
230 
231 }
232 
printf("fbuf is %s\n", fbuf)
fprintf(fp,"%d %d %d %d 1\n", iminx, iminy, maxi, maxj)
void shdeca(short int *irev, short int *status)
Definition: shdeca.c:73
void shdecb(short int *irev, short int *status)
Definition: shdecb.c:52
void shdece(short int *irev, short int *status)
Definition: shdece.c:101
void shdrive()
Definition: shdrive.c:39
struct t_stats_ stats_
struct t_error_ error_
struct t_datim_ datim_
struct t_pointers_ fp_
struct t_buffer_ buffer_
struct t_format_ format_
struct t_sendflg_ sendflg_
void shfor(short int *itype, short int *iflag, short int *status)
Definition: shfor.c:58
short int ibuf[MAX_SHEF_INPUT]
Definition: shef_structs.h:109
short int nblnk
Definition: shef_structs.h:109
short int idate[6]
Definition: shef_structs.h:100
short int nerror
Definition: shef_structs.h:103
short int nwarn
Definition: shef_structs.h:103
short int lform
Definition: shef_structs.h:129
short int nerr
Definition: shef_structs.h:129
short int iform
Definition: shef_structs.h:129
FILE * icher
Definition: shef_structs.h:72
short int nsflag
Definition: shef_structs.h:115
int parse_stats[MAX_ACCEPTABLE_CATEGORIES+1]
Definition: shef_structs.h:201