]> git.mxchange.org Git - simgear.git/blob - simgear/metar/Dcdmtrmk.cpp
Tidy up the autoconf/automake configuration a bit.
[simgear.git] / simgear / metar / Dcdmtrmk.cpp
1 #include <simgear/compiler.h>
2
3 #include "Local.h"     /* standard header file */
4 #include "Metar.h"
5  
6 #define SKY1_len 50
7 float fracPart( char * );
8  
9 /********************************************************************/
10 /*                                                                  */
11 /*  Title:         isTS_LOC                                         */
12 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
13 /*  Date:          06 May 1996                                      */
14 /*  Programmer:    CARL MCCALLA                                     */
15 /*  Language:      C/370                                            */
16 /*                                                                  */
17 /*  Abstract:   Identify the input character string as a thunder-   */
18 /*              storm location.  If the input string is a thunder-  */
19 /*              storm location, then return TRUE.  Otherwise,       */
20 /*              return FALSE.                                       */
21 /*                                                                  */
22 /*                                                                  */
23 /*  External Functions Called:                                      */
24 /*                 None.                                            */
25 /*                                                                  */
26 /*  Input:         string    - a pointer to a pointer to a charac-  */
27 /*                             ter string from a METAR report.      */
28 /*                                                                  */
29 /*                 Mptr - a pointer to a structure that has the     */
30 /*                        data type Decoded_METAR.                  */
31 /*                                                                  */
32 /*                 NDEX - a pointer to an integer that is the index */
33 /*                        into an array that contains the indi-     */
34 /*                        vidual groups of the METAR report being   */
35 /*                        decoded.  Upon entry, NDEX is the index   */
36 /*                        of the current group of the METAR report  */
37 /*                        that is to be indentified.                */
38 /*                                                                  */
39 /*  Output:        TRUE - if the input string is a thunderstorm     */
40 /*                        location.                                 */
41 /*                 FALSE - the input string is not a thunderstorm   */
42 /*                         location.                                */
43 /*                                                                  */
44 /*  Modification History:                                           */
45 /*                 None.                                            */
46 /*                                                                  */
47 /********************************************************************/
48  
49 static bool isTS_LOC( char **string, Decoded_METAR *Mptr,
50                            int *NDEX )
51 {
52  
53    /***************************/
54    /* DECLARE LOCAL VARIABLES */
55    /***************************/
56  
57    int i;
58  
59    /*************************/
60    /* START BODY OF ROUTINE */
61    /*************************/
62    /*******************************************/
63    /* COMPARE THE INPUT CHARACTER STRING WITH */
64    /* VALID AUTOMATED STATION CODE TYPE.  IF  */
65    /* A MATCH IS FOUND, RETURN TRUE.  OTHER-  */
66    /*           WISE, RETURN FALSE            */
67    /*******************************************/
68  
69    if( *string == NULL )
70       return FALSE;
71  
72    i = 0;
73  
74    if( strcmp( *string, "TS") != 0 )
75       return FALSE;
76    else {
77       string++;
78  
79       if( *string == NULL )
80          return FALSE;
81  
82       if(    strcmp(*string,"N")  == 0  ||
83              strcmp(*string,"NE") == 0  ||
84              strcmp(*string,"NW") == 0  ||
85              strcmp(*string,"S")  == 0  ||
86              strcmp(*string,"SE") == 0  ||
87              strcmp(*string,"SW") == 0  ||
88              strcmp(*string,"E")  == 0  ||
89              strcmp(*string,"W")  == 0   ) {
90          strcpy( Mptr->TS_LOC, *string );
91          (*NDEX)++;
92          (*NDEX)++;
93          string++;
94  
95          if( *string == NULL )
96             return TRUE;
97  
98          if( strcmp( *string, "MOV" ) == 0 ) {
99             string++;
100  
101             if( *string == NULL ) {
102                (*NDEX)++;
103                return TRUE;
104             }
105  
106             if(    strcmp(*string,"N")  == 0  ||
107                    strcmp(*string,"NE") == 0  ||
108                    strcmp(*string,"NW") == 0  ||
109                    strcmp(*string,"S")  == 0  ||
110                    strcmp(*string,"SE") == 0  ||
111                    strcmp(*string,"SW") == 0  ||
112                    strcmp(*string,"E")  == 0  ||
113                    strcmp(*string,"W")  == 0   ) {
114                strcpy( Mptr->TS_MOVMNT, *string );
115                (*NDEX)++;
116                (*NDEX)++;
117                string++;
118                return TRUE;
119             }
120          }
121          else
122             return TRUE;
123  
124       }
125       else {
126          (*NDEX)++;
127          return FALSE;
128       }
129    }
130    return FALSE;
131 }
132  
133 /********************************************************************/
134 /*                                                                  */
135 /*  Title:         isDVR                                            */
136 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
137 /*  Date:          15 Sep 1994                                      */
138 /*  Programmer:    CARL MCCALLA                                     */
139 /*  Language:      C/370                                            */
140 /*                                                                  */
141 /*  Abstract:                                                       */
142 /*                                                                  */
143 /*  External Functions Called:                                      */
144 /*                 None.                                            */
145 /*                                                                  */
146 /*  Input:         x                                                */
147 /*                                                                  */
148 /*  Output:        x                                                */
149 /*                                                                  */
150 /*  Modification History:                                           */
151 /*                 None.                                            */
152 /*                                                                  */
153 /********************************************************************/
154  
155 static bool isDVR( char *token, Decoded_METAR *Mptr, int *NDEX )
156 {
157    char *slashPtr, *FT_ptr;
158    char *vPtr;
159    int length;
160  
161    if( token == NULL )
162       return FALSE;
163  
164    if( (length = strlen( token )) < 4 )
165       return FALSE;
166  
167    if( strncmp( token, "DVR", 3 ) != 0 )
168       return FALSE;
169  
170    if( *(slashPtr = token+3) != '/' ) {
171       (*NDEX)++;
172       return FALSE;
173    }
174  
175    if( strcmp(token+(strlen(token)-2),"FT") != 0 )
176       return FALSE;
177    else
178       FT_ptr = token + (strlen(token)-2);
179  
180    if( strchr(slashPtr+1, 'P' ) != NULL )
181       Mptr->DVR.above_max_DVR = TRUE;
182  
183    if( strchr(slashPtr+1, 'M' ) != NULL )
184       Mptr->DVR.below_min_DVR = TRUE;
185  
186  
187    if( (vPtr = strchr(slashPtr, 'V' )) != NULL )
188    {
189       Mptr->DVR.vrbl_visRange = TRUE;
190       Mptr->DVR.Min_visRange = antoi(slashPtr+1,
191                               (vPtr-(slashPtr+1)) );
192       Mptr->DVR.Max_visRange = antoi(vPtr+1,
193                               (FT_ptr - (vPtr+1)) );
194       (*NDEX)++;
195       return TRUE;
196    }
197    else
198    {
199       if( Mptr->DVR.below_min_DVR ||
200           Mptr->DVR.above_max_DVR    )
201          Mptr->DVR.visRange = antoi(slashPtr+2,
202                            (FT_ptr - (slashPtr+2)) );
203       else
204          Mptr->DVR.visRange = antoi(slashPtr+1,
205                            (FT_ptr - (slashPtr+1)) );
206  
207       (*NDEX)++;
208       return TRUE;
209    }
210  
211 }
212 /********************************************************************/
213 /*                                                                  */
214 /*  Title:         isTornadicActiv                                  */
215 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
216 /*  Date:          15 Sep 1994                                      */
217 /*  Programmer:    CARL MCCALLA                                     */
218 /*  Language:      C/370                                            */
219 /*                                                                  */
220 /*  Abstract:   Determines whether or not the input character       */
221 /*              string is signals the beginning of TORNADIC         */
222 /*              ACTIVITY data.  If it is, then interrogate subse-   */
223 /*              quent report groups for time, location, and movement*/
224 /*              of tornado.  Return TRUE, if TORNADIC ACTIVITY is   */
225 /*              found.  Otherwise, return FALSE.                    */
226 /*                                                                  */
227 /*                                                                  */
228 /*  External Functions Called:                                      */
229 /*                 None.                                            */
230 /*                                                                  */
231 /*  Input:         string - the address of a pointer to a charac-   */
232 /*                          ter string that may or may not signal   */
233 /*                          TORNADIC ACTIVITY.                      */
234 /*                                                                  */
235 /*                 Mptr - a pointer to a structure that has the     */
236 /*                        data type Decoded_METAR.                  */
237 /*                                                                  */
238 /*                 NDEX - a pointer to an integer that is the index */
239 /*                        into an array that contains the indi-     */
240 /*                        vidual groups of the METAR report being   */
241 /*                        decoded.  Upon entry, NDEX is the index   */
242 /*                        of the current group of the METAR report  */
243 /*                        that is to be indentified.                */
244 /*                                                                  */
245 /*  Output:        TRUE - if TORNADIC ACTIVITY is found.            */
246 /*                 FALSE - if no TORNADIC ACTIVITY is found.        */
247 /*                                                                  */
248 /*  Modification History:                                           */
249 /*                 None.                                            */
250 /*                                                                  */
251 /********************************************************************/
252  
253 static bool isTornadicActiv( char **string, Decoded_METAR *Mptr,
254                              int *NDEX )
255 {
256    int saveNdex,
257        TornadicTime;
258    bool Completion_flag;
259    char *B_stringPtr,
260         *E_stringPtr;
261  
262  
263    /*************************/
264    /* START BODY OF ROUTINE */
265    /*************************/
266  
267  
268    saveNdex = *NDEX;
269  
270    B_stringPtr = NULL;
271    E_stringPtr = NULL;
272  
273    if( *string == NULL )
274       return FALSE;
275  
276    if( !( strcmp(*string, "TORNADO")         == 0 ||
277           strcmp(*string, "TORNADOS")        == 0 ||
278           strcmp(*string, "TORNADOES")       == 0 ||
279           strcmp(*string, "WATERSPOUT")      == 0 ||
280           strcmp(*string, "WATERSPOUTS")     == 0 ||
281           strcmp(*string, "FUNNEL")     == 0  ) )
282          return FALSE;
283    else {
284       if( strcmp(*string, "FUNNEL") == 0 ) {
285          (++string);
286  
287          if( *string == NULL )
288             return FALSE;
289  
290          if( !(strcmp(*string,"CLOUD") == 0 ||
291                strcmp(*string,"CLOUDS") == 0 ) ) {
292             (*NDEX)++;
293             return FALSE;
294          }
295          else
296                strcpy(Mptr->TornadicType,"FUNNEL CLOUD");
297       }
298       else {
299          strcpy(Mptr->TornadicType, *string);
300          (*NDEX)++;
301          (++string);
302       }
303  
304       Completion_flag = FALSE;
305  
306       if( *string == NULL )
307          return FALSE;
308  
309       while( !Completion_flag ) {
310  
311 /*       printf("isTornadicActivity:  current *string = %s\n",
312                         *string);    */
313  
314          if( *(*string) =='B' || *(*string) == 'E') {
315             if( *(*string) == 'B' ) {
316                B_stringPtr = *string;
317                E_stringPtr = strchr((*string)+1,'E');
318             }
319             else {
320                B_stringPtr = strchr((*string)+1,'B');
321                E_stringPtr = *string;
322             }
323 /*
324          if( B_stringPtr != NULL )
325             printf("isTornadicActivity:  B_stringPtr = %x\n",
326                         B_stringPtr);
327          else
328             printf("isTornadicActivity:  B_stringPtr = NULL\n");
329  
330          if( E_stringPtr != NULL )
331             printf("isTornadicActivity:  E_stringPtr = %x\n",
332                         E_stringPtr);
333          else
334             printf("isTornadicActivity:  E_stringPtr = NULL\n");
335 */
336             if( B_stringPtr != NULL && E_stringPtr == NULL ) {
337                if( nisdigit((*string)+1, strlen((*string)+1)) &&
338                      strlen((*string)+1) <= 4 ) {
339                   TornadicTime = antoi((*string)+1,
340                                       strlen((*string)+1));
341                   if( TornadicTime > 99 ) {
342                      Mptr->BTornadicHour = TornadicTime / 100;
343                      Mptr->BTornadicMinute = TornadicTime % 100;
344                      (*NDEX)++;
345                      (++string);
346                   }
347                   else {
348                      Mptr->BTornadicHour = TornadicTime;
349                      (*NDEX)++;
350                      (++string);
351                   }
352                }
353                else {
354                   (*NDEX)++;
355                   (++string);
356                }
357             }
358             else if( B_stringPtr == NULL && E_stringPtr != NULL ) {
359                if( nisdigit((*string)+1,strlen((*string)+1)) &&
360                         strlen((*string)+1) <= 4 ) {
361                   TornadicTime = antoi((*string)+1,
362                                      strlen((*string)+1));
363                   if( TornadicTime > 99 ) {
364                      Mptr->ETornadicHour = TornadicTime / 100;
365                      Mptr->ETornadicMinute = TornadicTime % 100;
366                      (*NDEX)++;
367                      (++string);
368                   }
369                   else {
370                      Mptr->ETornadicHour = TornadicTime;
371                      (*NDEX)++;
372                      (++string);
373                   }
374                }
375                else {
376                   (*NDEX)++;
377                   (++string);
378                }
379             }
380             else {
381 /*          printf("isTornadicActivity:  B_stringPtr != NULL"
382                    " and E_stringPtr != NULL\n");  */
383                if( nisdigit((B_stringPtr+1),(E_stringPtr -
384                                      (B_stringPtr+1)))) {
385                   TornadicTime = antoi(( B_stringPtr+1),
386                                      (E_stringPtr-(B_stringPtr+1)));
387                   if( TornadicTime > 99 ) {
388                      Mptr->BTornadicHour = TornadicTime / 100;
389                      Mptr->BTornadicMinute = TornadicTime % 100;
390                      (*NDEX)++;
391                      (++string);
392                   }
393                   else {
394                      Mptr->BTornadicHour = TornadicTime;
395                      (*NDEX)++;
396                      (++string);
397                   }
398  
399                   TornadicTime = antoi(( E_stringPtr+1),
400                                         strlen(E_stringPtr+1));
401  
402                   if( TornadicTime > 99 ) {
403                      Mptr->ETornadicHour = TornadicTime / 100;
404                      Mptr->ETornadicMinute = TornadicTime % 100;
405                      (*NDEX)++;
406                      (++string);
407                   }
408                   else {
409                      Mptr->ETornadicHour = TornadicTime;
410                      (*NDEX)++;
411                      (++string);
412                   }
413                }
414                else {
415                   (*NDEX)++;
416                   (++string);
417                }
418             }
419          }
420          else if( nisdigit(*string, strlen(*string))) {
421             (++string);
422  
423             if( *string == NULL )
424                return FALSE;
425  
426             if(  strcmp(*string,"N")  == 0  ||
427                  strcmp(*string,"NE") == 0  ||
428                  strcmp(*string,"NW") == 0  ||
429                  strcmp(*string,"S")  == 0  ||
430                  strcmp(*string,"SE") == 0  ||
431                  strcmp(*string,"SW") == 0  ||
432                  strcmp(*string,"E")  == 0  ||
433                  strcmp(*string,"W")  == 0   ) {
434                  (--string);
435                  Mptr->TornadicDistance = antoi(*string,
436                                   strlen(*string));
437                  (*NDEX)++;
438                  (++string);
439             }
440             else {
441                (--string);
442  
443                if( saveNdex == *NDEX )
444                   return FALSE;
445                else
446                   return TRUE;
447             }
448  
449          }
450          else if(strcmp(*string,"DSNT")  == 0 ||
451                  strcmp(*string,"VC")    == 0 ||
452                  strcmp(*string,"VCY")   == 0 ) {
453             if( strcmp(*string,"VCY") == 0 ||
454                   strcmp(*string,"VC") == 0  ) {
455                (++string);
456  
457                if( *string == NULL )
458                   return FALSE;
459  
460                if( strcmp(*string,"STN") == 0 ){
461                   strcpy(Mptr->TornadicLOC,"VC STN");
462                   (*NDEX)++;
463                   (*NDEX)++;
464                   (++string);
465                }
466                else {
467                   strcpy(Mptr->TornadicLOC,"VC");
468                   (*NDEX)++;
469                }
470             }
471             else {
472                strcpy(Mptr->TornadicLOC,"DSNT");
473                (*NDEX)++;
474                (++string);
475             }
476          }
477          else if(strcmp(*string,"N")  == 0  ||
478                  strcmp(*string,"NE") == 0  ||
479                  strcmp(*string,"NW") == 0  ||
480                  strcmp(*string,"S")  == 0  ||
481                  strcmp(*string,"SE") == 0  ||
482                  strcmp(*string,"SW") == 0  ||
483                  strcmp(*string,"E")  == 0  ||
484                  strcmp(*string,"W")  == 0   ) {
485             strcpy(Mptr->TornadicDIR, *string);
486             (*NDEX)++;
487             (++string);
488          }
489          else if( strcmp(*string, "MOV" ) == 0 ) {
490             (*NDEX)++;
491             (++string);
492  
493             if( *string == NULL )
494                return FALSE;
495  
496             if(   strcmp(*string, "N")  == 0  ||
497                   strcmp(*string, "S")  == 0  ||
498                   strcmp(*string, "E")  == 0  ||
499                   strcmp(*string, "W")  == 0  ||
500                   strcmp(*string, "NE")  == 0 ||
501                   strcmp(*string, "NW")  == 0 ||
502                   strcmp(*string, "SE")  == 0 ||
503                   strcmp(*string, "SW")  == 0     ) {
504                strcpy( Mptr->TornadicMovDir, *string );
505                (*NDEX)++;
506                (++string);
507  
508             }
509          }
510          else
511             Completion_flag = TRUE;
512       }
513  
514       if( saveNdex == *NDEX )
515          return FALSE;
516       else
517          return TRUE;
518  
519    }
520  
521 }
522 /********************************************************************/
523 /*                                                                  */
524 /*  Title:         isPartObscur                                     */
525 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
526 /*  Date:          15 Sep 1994                                      */
527 /*  Programmer:    CARL MCCALLA                                     */
528 /*  Language:      C/370                                            */
529 /*                                                                  */
530 /*  Abstract:   Determine whether or not the input character string */
531 /*              is a partial obscuration phenomenon.  If a partial  */
532 /*              obscuration is found, then take the preceding group */
533 /*              as the obscuring phenomenon.  If a partial obscura- */
534 /*              tion is found, then return TRUE.  Otherwise, return */
535 /*              false.                                              */
536 /*                                                                  */
537 /*                                                                  */
538 /*  External Functions Called:                                      */
539 /*                 None.                                            */
540 /*                                                                  */
541 /*  Input:         string - the address of a pointer to a group     */
542 /*                          in a METAR report that may or may not   */
543 /*                          be a partial obscuration indicator.     */
544 /*                                                                  */
545 /*                 Mptr - a pointer to a structure that has the     */
546 /*                        data type Decoded_METAR.                  */
547 /*                                                                  */
548 /*                 NDEX - a pointer to an integer that is the index */
549 /*                        into an array that contains the indi-     */
550 /*                        vidual groups of the METAR report being   */
551 /*                        decoded.  Upon entry, NDEX is the index   */
552 /*                        of the current group of the METAR report  */
553 /*                        that is to be indentified.                */
554 /*                                                                  */
555 /*  Output:        TRUE - if the input string is a partial obscura- */
556 /*                        tion.                                     */
557 /*                 FALSE - if the input string is not a partial ob- */
558 /*                         scuration.                               */
559 /*                                                                  */
560 /*  Modification History:                                           */
561 /*                 None.                                            */
562 /*                                                                  */
563 /********************************************************************/
564 static bool isPartObscur( char **string, Decoded_METAR *Mptr,
565                           int ndex, int *NDEX )
566 {
567  
568    /***************************/
569    /* DECLARE LOCAL VARIABLES */
570    /***************************/
571  
572    int i;
573  
574    static char *phenom[] = {"-DZ", "DZ", "+DZ",
575    "FZDZ", "-RA", "RA", "+RA",
576    "SHRA", "TSRA", "FZRA", "-SN", "SN", "+SN", "DRSN", "BLSN",
577    "SHSN", "TSSN", "-SG", "SG", "+SG", "IC", "-PE", "PE", "+PE",
578    "SHPE", "TSPE", "GR", "SHGR", "TSGR", "GS", "SHGS", "TSGS", "-GS",
579    "+GS", "TS", "VCTS", "-TSRA", "TSRA", "+TSRA", "-TSSN", "TSSN",
580    "+TSSN", "-TSPE", "TSPE", "+TSPE", "-TSGS", "TSGS", "+TSGS",
581    "VCSH", "-SHRA", "+SHRA", "-SHSN", "+SHSN", "-SHPE", "+SHPE",
582    "-SHGS", "+SHGS", "-FZDZ", "+FZDZ", "-FZRA", "+FZRA", "FZFG",
583    "+FZFG", "BR", "FG", "VCFG", "MIFG", "PRFG", "BCFG", "FU",
584    "VA", "DU", "DRDU", "BLDU", "SA", "DRSA", "BLSA", "HZ",
585    "BLPY", "BLSN", "+BLSN", "VCBLSN", "BLSA", "+BLSA",
586    "VCBLSA", "+BLDU", "VCBLDU", "PO", "VCPO", "SQ", "FC", "+FC",
587    "VCFC", "SS", "+SS", "VCSS", "DS", "+DS", "VCDS", NULL};
588  
589  
590 #ifdef DEBUGXX
591    printf("isPartObscur:  Routine Entered...\n");
592    printf("isPartObscur:  *string = %s\n",*string);
593    if( Mptr->PartialObscurationAmt[ndex][0] != '\0' ) {
594       printf("PartialObscurationAmt = %s\n",
595                 &(Mptr->PartialObscurationAmt[ndex][0]));
596       if( strcmp( *string, "FEW///" ) == 0 ||
597           strcmp( *string, "SCT///" ) == 0 ||
598           strcmp( *string, "BKN///" ) == 0 ||
599           strcmp( *string, "FEW000" ) == 0 ||
600           strcmp( *string, "SCT000" ) == 0 ||
601           strcmp( *string, "BKN000" ) == 0   ) {
602  
603           --string;
604          printf("isPartObscur:  Preceding group = %s\n",
605                   *string);
606          ++string;
607       }
608    }
609 #endif
610  
611    if( *string == NULL )
612       return FALSE;
613  
614    if( strcmp( *string, "FEW///" ) == 0 ||
615        strcmp( *string, "SCT///" ) == 0 ||
616        strcmp( *string, "BKN///" ) == 0 ||
617        strcmp( *string, "FEW000" ) == 0 ||
618        strcmp( *string, "SCT000" ) == 0 ||
619        strcmp( *string, "BKN000" ) == 0   ) {
620       if( Mptr->PartialObscurationAmt[ndex][0] == '\0' )
621       {
622          (*NDEX)++;
623          return FALSE;
624       }
625       else {
626          if( strcmp( *string,
627                      &(Mptr->PartialObscurationAmt[ndex][0]) ) == 0 )
628          {
629             --string;
630  
631             if( *string == NULL )
632                return FALSE;
633  
634             i = 0;
635             while( phenom[i] != NULL ) {
636                if( strcmp( *string, phenom[i] ) == 0 ) {
637                   strcpy(&(Mptr->PartialObscurationPhenom[ndex][0]),
638                          *string);
639  
640                   (*NDEX)++;
641                   return TRUE;
642                }
643                else
644                   i++;
645             }
646  
647             (*NDEX)++;
648             return FALSE;
649  
650          }
651          else {
652             (*NDEX)++;
653             return FALSE;
654          }
655  
656       }
657  
658    }
659    else
660       return FALSE;
661  
662 }
663  
664 /********************************************************************/
665 /*                                                                  */
666 /*  Title:         isA0indicator                                    */
667 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
668 /*  Date:          15 Sep 1994                                      */
669 /*  Programmer:    CARL MCCALLA                                     */
670 /*  Language:      C/370                                            */
671 /*                                                                  */
672 /*  Abstract:   Identify the input character string as an automated */
673 /*              station code type.  If the input character string   */
674 /*              is an automated station code type, then return      */
675 /*              TRUE.  Otherwise, return FALSE.                     */
676 /*                                                                  */
677 /*                                                                  */
678 /*  External Functions Called:                                      */
679 /*                 None.                                            */
680 /*                                                                  */
681 /*  Input:         indicator - a pointer to a character string      */
682 /*                             that may or may not be an ASOS       */
683 /*                             automated station code type.         */
684 /*                                                                  */
685 /*                 Mptr - a pointer to a structure that has the     */
686 /*                        data type Decoded_METAR.                  */
687 /*                                                                  */
688 /*                 NDEX - a pointer to an integer that is the index */
689 /*                        into an array that contains the indi-     */
690 /*                        vidual groups of the METAR report being   */
691 /*                        decoded.  Upon entry, NDEX is the index   */
692 /*                        of the current group of the METAR report  */
693 /*                        that is to be indentified.                */
694 /*                                                                  */
695 /*  Output:        TRUE - if the input string matches one of the    */
696 /*                        valid ASOS automated station indicators.  */
697 /*                 FALSE - the input string did not match one of the*/
698 /*                        valid ASOS automated station indicators.  */
699 /*                                                                  */
700 /*  Modification History:                                           */
701 /*                 None.                                            */
702 /*                                                                  */
703 /********************************************************************/
704  
705 static bool isA0indicator( char *indicator, Decoded_METAR *Mptr,
706                            int *NDEX )
707 {
708  
709    /***************************/
710    /* DECLARE LOCAL VARIABLES */
711    /***************************/
712  
713    char *autoFlag[] = {"A01", "A01A", "A02", "A02A", "AOA",
714                        "A0A", "AO1", "AO1A", "AO2", "AO2A", NULL};
715    int i;
716  
717    /*************************/
718    /* START BODY OF ROUTINE */
719    /*************************/
720    /*******************************************/
721    /* COMPARE THE INPUT CHARACTER STRING WITH */
722    /* VALID AUTOMATED STATION CODE TYPE.  IF  */
723    /* A MATCH IS FOUND, RETURN TRUE.  OTHER-  */
724    /*           WISE, RETURN FALSE            */
725    /*******************************************/
726  
727    if( indicator == NULL )
728       return FALSE;
729  
730    i = 0;
731  
732    while( autoFlag[ i ] != NULL )
733    {
734       if( strcmp( indicator, autoFlag[ i ]) == 0 )
735       {
736          (*NDEX)++;
737          strcpy(Mptr->autoIndicator, indicator);
738          return TRUE;
739       }
740       i++;
741    }
742  
743    return FALSE;
744 }
745  
746 /********************************************************************/
747 /*                                                                  */
748 /*  Title:         isPeakWind                                       */
749 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
750 /*  Date:          15 Sep 1994                                      */
751 /*  Programmer:    CARL MCCALLA                                     */
752 /*  Language:      C/370                                            */
753 /*                                                                  */
754 /*  Abstract:  Determine whether or not the current and subsequent  */
755 /*             groups from the METAR report make up a valid report  */
756 /*             of peak wind.                                        */
757 /*                                                                  */
758 /*                                                                  */
759 /*  Input:         string - the addr of a ptr to a character string */
760 /*                             that may or may not be the indicator */
761 /*                             for a peak wind data group.          */
762 /*                                                                  */
763 /*                 Mptr - a pointer to a structure that has the     */
764 /*                        data type Decoded_METAR.                  */
765 /*                                                                  */
766 /*                 NDEX - a pointer to an integer that is the index */
767 /*                        into an array that contains the indi-     */
768 /*                        vidual groups of the METAR report being   */
769 /*                        decoded.  Upon entry, NDEX is the index   */
770 /*                        of the current group of the METAR report  */
771 /*                        that is to be indentified.                */
772 /*                                                                  */
773 /*  Output:        TRUE - if the input string (and subsequent grps) */
774 /*                        are decoded as peak wind.                 */
775 /*                 FALSE - if the input string (and subsequent grps)*/
776 /*                         are not decoded as peak wind.            */
777 /*  External Functions Called:                                      */
778 /*                 nisdigit                                         */
779 /*                                                                  */
780 /*                                                                  */
781 /*  Modification History:                                           */
782 /*                 None.                                            */
783 /*                                                                  */
784 /********************************************************************/
785 static bool isPeakWind( char **string, Decoded_METAR *Mptr,
786                         int *NDEX )
787 {
788  
789    /***************************/
790    /* DECLARE LOCAL VARIABLES */
791    /***************************/
792  
793    char buf[ 6 ];
794    char *slash;
795    int temp;
796  
797    /*************************/
798    /* START BODY OF ROUTINE */
799    /*************************/
800  
801  
802  
803    /******************************************************/
804    /* IF THE CURRENT AND NEXT GROUPS ARE "PK WND", THEN  */
805    /* DETERMINE WHETHER OR NOT THE GROUP THAT FOLLOWS IS */
806    /* A VALID PK WND GROUP.  IF IT IS, THEN DECODE THE   */
807    /* GROUP AND RETURN TRUE.  OTHERWISE, RETURN FALSE.   */
808    /******************************************************/
809  
810    if( *string == NULL )
811       return FALSE;
812  
813    if( strcmp(*string,"PK") != 0 )
814       return FALSE;
815    else
816       (++string);
817  
818    if( *string == NULL )
819       return FALSE;
820    if( strcmp(*string,"WND") != 0 ) {
821       (*NDEX)++;
822       return FALSE;
823    }
824    else
825       (++string);
826  
827    if( *string == NULL )
828       return FALSE;
829  
830    if( (slash = strchr(*string,'/')) == NULL ) {
831                               /********************************/
832                               /* INVALID PEAK WIND. BUMP PAST */
833                               /* PK AND WND GROUP AND RETURN  */
834                               /*             FALSE.           */
835                               /********************************/
836       (*NDEX)++;
837       (*NDEX)++;
838       return FALSE;
839    }
840    else if( strlen(*string) >= 8 && strlen(*string) <= 11 &&
841              nisdigit(slash+1,strlen(slash+1)) &&
842              nisdigit(*string, (slash - *string)) &&
843              (slash - *string) <= 6 )
844    {
845       memset( buf, '\0', 4);
846       strncpy( buf, *string, 3 );
847       Mptr->PKWND_dir = atoi( buf );
848  
849       memset( buf, '\0', 4);
850       strncpy( buf, *string+3, slash-(*string+3) );
851       Mptr->PKWND_speed =  atoi( buf );
852  
853       memset( buf, '\0', 5);
854       strcpy( buf, slash+1 );
855       temp             =  atoi( buf );
856  
857       if( temp > 99 )
858       {
859          Mptr->PKWND_hour = atoi(buf)/100;
860          Mptr->PKWND_minute = (atoi(buf)) % 100;
861       }
862       else
863          Mptr->PKWND_minute =  atoi( buf );
864                               /********************************/
865                               /* VALID PEAK WIND FOUND.  BUMP */
866                               /* PAST PK, WND, AND PEAK WIND  */
867                               /* GROUPS AND RETURN TRUE.      */
868                               /********************************/
869       (*NDEX)++;
870       (*NDEX)++;
871       (*NDEX)++;
872       return TRUE;
873    }
874    else
875       return FALSE;
876 }
877 /********************************************************************/
878 /*                                                                  */
879 /*  Title:         isWindShift                                      */
880 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
881 /*  Date:          15 Sep 1994                                      */
882 /*  Programmer:    CARL MCCALLA                                     */
883 /*  Language:      C/370                                            */
884 /*                                                                  */
885 /*  Abstract:  Determine whether or not the current and subsequent  */
886 /*             groups from the METAR report make up a valid report  */
887 /*             of wind shift and frontal passage, if included.      */
888 /*                                                                  */
889 /*                                                                  */
890 /*  Input:         string - the addr of a ptr to a character string */
891 /*                           that may or may not be the indicator   */
892 /*                           for a wind shift data group.           */
893 /*                                                                  */
894 /*                 Mptr - a pointer to a structure that has the     */
895 /*                        data type Decoded_METAR.                  */
896 /*                                                                  */
897 /*                 NDEX - a pointer to an integer that is the index */
898 /*                        into an array that contains the indi-     */
899 /*                        vidual groups of the METAR report being   */
900 /*                        decoded.  Upon entry, NDEX is the index   */
901 /*                        of the current group of the METAR report  */
902 /*                        that is to be indentified.                */
903 /*                                                                  */
904 /*  Output:        TRUE - if the input string (and subsequent grps) */
905 /*                        are decoded as wind shift.                */
906 /*                 FALSE - if the input string (and subsequent grps)*/
907 /*                         are not decoded as wind shift.           */
908 /*  External Functions Called:                                      */
909 /*                 nisdigit                                         */
910 /*                                                                  */
911 /*                                                                  */
912 /*  Modification History:                                           */
913 /*                 None.                                            */
914 /*                                                                  */
915 /********************************************************************/
916 static bool isWindShift( char **string, Decoded_METAR *Mptr,
917                         int *NDEX)
918 {
919  
920    /***************************/
921    /* DECLARE LOCAL VARIABLES */
922    /***************************/
923  
924    int temp;
925  
926    /*************************/
927    /* START BODY OF ROUTINE */
928    /*************************/
929  
930  
931    /****************************************************/
932    /* IF THE CURRENT GROUP IS "WSHFT", THEN DETERMINE  */
933    /* WHETHER OR NOT THE GROUP THAT FOLLOWS IS A VALID */
934    /* WSHFT GROUP.  IF IT IS, THEN DECODE THE GROUP    */
935    /* GROUP AND RETURN TRUE.  OTHERWISE, RETURN FALSE. */
936    /****************************************************/
937  
938    if( *string == NULL )
939       return FALSE;
940  
941    if( strcmp( *string, "WSHFT" ) != 0 )
942       return FALSE;
943    else
944       (++string);
945  
946    if( *string == NULL )
947       return FALSE;
948  
949    if( nisdigit(*string,strlen(*string)) && strlen(*string) <= 4)
950    {
951       temp = atoi( *string );
952  
953       if( temp > 100 )
954       {
955          Mptr->WshfTime_hour = (atoi(*string))/100;
956          Mptr->WshfTime_minute = (atoi(*string)) % 100;
957       }
958       else
959          Mptr->WshfTime_minute = (atoi(*string)) % 100;
960  
961       (++string);
962  
963       if( *string == NULL )
964          return FALSE;
965  
966  
967       if( **string == '\0') {
968          (*NDEX)++;
969          (*NDEX)++;
970          return TRUE;
971       }
972       else if( strcmp( *string, "FROPA") == 0 )
973       {
974          Mptr->Wshft_FROPA = TRUE;
975                               /********************************/
976                               /* VALID WIND SHIFT FOUND. BUMP */
977                               /* PAST WSHFT, WSHFT GROUP, AND */
978                               /* FROPA GROUPS AND RETURN TRUE.*/
979                               /********************************/
980          (*NDEX)++;
981          (*NDEX)++;
982          (*NDEX)++;
983          return TRUE;
984       }
985       else {
986                               /********************************/
987                               /* VALID WIND SHIFT FOUND. BUMP */
988                               /* PAST WSHFT AND WSHFT GROUP   */
989                               /*       AND RETURN TRUE.       */
990                               /********************************/
991          (*NDEX)++;
992          (*NDEX)++;
993          return TRUE;
994       }
995    }
996    else {
997                               /**********************************/
998                               /* INVALID WIND SHIFT FOUND. BUMP */
999                               /* PAST WSHFT AND RETURN FALSE.   */
1000                               /********************************/
1001       (*NDEX)++;
1002       return FALSE;
1003    }
1004 }
1005 /********************************************************************/
1006 /*                                                                  */
1007 /*  Title:         isTowerVsby                                      */
1008 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
1009 /*  Date:          15 Sep 1994                                      */
1010 /*  Programmer:    CARL MCCALLA                                     */
1011 /*  Language:      C/370                                            */
1012 /*                                                                  */
1013 /*  Abstract:  Determine whether or not the current and subsequent  */
1014 /*             groups from the METAR report make up a valid report  */
1015 /*             of tower visibility.                                 */
1016 /*                                                                  */
1017 /*                                                                  */
1018 /*  Input:         string - the addr of a ptr to a character string */
1019 /*                          that may or may not be the indicator    */
1020 /*                          for tower visibility.                   */
1021 /*                                                                  */
1022 /*                 Mptr - a pointer to a structure that has the     */
1023 /*                        data type Decoded_METAR.                  */
1024 /*                                                                  */
1025 /*                 NDEX - a pointer to an integer that is the index */
1026 /*                        into an array that contains the indi-     */
1027 /*                        vidual groups of the METAR report being   */
1028 /*                        decoded.  Upon entry, NDEX is the index   */
1029 /*                        of the current group of the METAR report  */
1030 /*                        that is to be indentified.                */
1031 /*                                                                  */
1032 /*  Output:        TRUE - if the input string (and subsequent grps) */
1033 /*                        are decoded as tower visibility.          */
1034 /*                 FALSE - if the input string (and subsequent grps)*/
1035 /*                         are not decoded as tower visibility      */
1036 /*  External Functions Called:                                      */
1037 /*                 nisdigit                                         */
1038 /*                                                                  */
1039 /*  Modification History:                                           */
1040 /*                 None.                                            */
1041 /*                                                                  */
1042 /********************************************************************/
1043 static bool isTowerVsby( char **token, Decoded_METAR *Mptr, int *NDEX)
1044 {
1045  
1046    /***************************/
1047    /* DECLARE LOCAL VARIABLES */
1048    /***************************/
1049  
1050    char *slash;
1051    float T_vsby;
1052  
1053    /*************************/
1054    /* START BODY OF ROUTINE */
1055    /*************************/
1056  
1057  
1058    /****************************************************************/
1059    /* IF THE CURRENT AND NEXT GROUPS ARE "TWR VIS", THEN DETERMINE */
1060    /* WHETHER OR NOT THE GROUP(S) THAT FOLLOWS IS(ARE) A VALID     */
1061    /* TOWER VISIBILITY  GROUP.  IF IT IS, THEN DECODE THE GROUP    */
1062    /* GROUP AND RETURN TRUE.  OTHERWISE, RETURN FALSE.             */
1063    /****************************************************************/
1064  
1065    if( *token == NULL )
1066       return FALSE;
1067  
1068    if(strcmp(*token,"TWR") != 0)
1069       return FALSE;
1070    else
1071       (++token);
1072  
1073    if( *token == NULL )
1074       return FALSE;
1075  
1076    if( strcmp(*token,"VIS") != 0) {
1077       (*NDEX)++;
1078       return FALSE;
1079    }
1080    else
1081       (++token);
1082  
1083    if( *token == NULL )
1084       return FALSE;
1085  
1086    if( nisdigit(*token,
1087               strlen(*token)))
1088    {
1089       Mptr->TWR_VSBY = (float) atoi(*token);
1090       (++token);
1091       if( *token != NULL )
1092       {
1093          if( (slash = strchr(*token, '/'))
1094                              != NULL )
1095          {
1096             if( nisdigit(slash+1,strlen(slash+1)) &&
1097                          nisdigit(*token,
1098                              (slash-*token)))
1099             {
1100                T_vsby = fracPart(*token);
1101                Mptr->TWR_VSBY += T_vsby;
1102                (*NDEX)++;
1103                (*NDEX)++;
1104                (*NDEX)++;
1105                (*NDEX)++;
1106                return TRUE;
1107             }
1108             else {
1109                (*NDEX)++;
1110                (*NDEX)++;
1111                (*NDEX)++;
1112                return TRUE;
1113             }
1114  
1115          }
1116          else {
1117             (*NDEX)++;
1118             (*NDEX)++;
1119             (*NDEX)++;
1120             return TRUE;
1121          }
1122       }
1123       else {
1124          (*NDEX)++;
1125          (*NDEX)++;
1126          (*NDEX)++;
1127          return TRUE;
1128       }
1129  
1130    }
1131    else if( (slash = strchr(*token, '/'))
1132                              != NULL )
1133    {
1134       if( nisdigit(slash+1,strlen(slash+1)) &&
1135                          nisdigit(*token,
1136                              (slash-*token)))
1137       {
1138          Mptr->TWR_VSBY = fracPart(*token);
1139          (*NDEX)++;
1140          (*NDEX)++;
1141          (*NDEX)++;
1142          return TRUE;
1143       }
1144       else {
1145          (*NDEX)++;
1146          (*NDEX)++;
1147          return FALSE;
1148       }
1149    }
1150    else {
1151       (*NDEX)++;
1152       (*NDEX)++;
1153       return FALSE;
1154    }
1155  
1156 }
1157 /********************************************************************/
1158 /*                                                                  */
1159 /*  Title:         isSurfaceVsby                                    */
1160 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
1161 /*  Date:          15 Sep 1994                                      */
1162 /*  Programmer:    CARL MCCALLA                                     */
1163 /*  Language:      C/370                                            */
1164 /*                                                                  */
1165 /*  Abstract:  Determine whether or not the current and subsequent  */
1166 /*             groups from the METAR report make up a valid report  */
1167 /*             of surface visibility.                               */
1168 /*                                                                  */
1169 /*                                                                  */
1170 /*  Input:         string - the addr of a ptr to a character string */
1171 /*                          that may or may not be the indicator    */
1172 /*                          for surface visibility.                 */
1173 /*                                                                  */
1174 /*                 Mptr - a pointer to a structure that has the     */
1175 /*                        data type Decoded_METAR.                  */
1176 /*                                                                  */
1177 /*                 NDEX - a pointer to an integer that is the index */
1178 /*                        into an array that contains the indi-     */
1179 /*                        vidual groups of the METAR report being   */
1180 /*                        decoded.  Upon entry, NDEX is the index   */
1181 /*                        of the current group of the METAR report  */
1182 /*                        that is to be indentified.                */
1183 /*                                                                  */
1184 /*  Output:        TRUE - if the input string (and subsequent grps) */
1185 /*                        are decoded as surface visibility.        */
1186 /*                 FALSE - if the input string (and subsequent grps)*/
1187 /*                         are not decoded as surface visibility.   */
1188 /*  External Functions Called:                                      */
1189 /*                 nisdigit                                         */
1190 /*                                                                  */
1191 /*  Modification History:                                           */
1192 /*                 None.                                            */
1193 /*                                                                  */
1194 /********************************************************************/
1195 static bool isSurfaceVsby( char **token, Decoded_METAR *Mptr,
1196                            int *NDEX)
1197 {
1198  
1199    /***************************/
1200    /* DECLARE LOCAL VARIABLES */
1201    /***************************/
1202  
1203    char *slash;
1204    float S_vsby;
1205  
1206  
1207    /*************************/
1208    /* START BODY OF ROUTINE */
1209    /*************************/
1210  
1211  
1212    /****************************************************************/
1213    /* IF THE CURRENT AND NEXT GROUPS ARE "SFC VIS", THEN DETERMINE */
1214    /* WHETHER OR NOT THE GROUP(S) THAT FOLLOWS IS(ARE) A VALID     */
1215    /* SURFACE VISIBILITY  GROUP.  IF IT IS, THEN DECODE THE GROUP  */
1216    /* GROUP AND RETURN TRUE.  OTHERWISE, RETURN FALSE.             */
1217    /****************************************************************/
1218  
1219    if( *token == NULL )
1220       return FALSE;
1221  
1222    if(strcmp(*token,"SFC") != 0)
1223       return FALSE;
1224    else
1225       (++token);
1226  
1227    if( strcmp(*token,"VIS") != 0) {
1228       (*NDEX)++;
1229       return FALSE;
1230    }
1231    else
1232       (++token);
1233  
1234  
1235    if( *token == NULL )
1236       return FALSE;
1237  
1238  
1239    if( nisdigit(*token,
1240               strlen(*token)))
1241    {
1242       Mptr->SFC_VSBY = (float) atoi(*token);
1243       (++token);
1244       if( *token != NULL )
1245       {
1246          if( (slash = strchr(*token, '/'))
1247                              != NULL )
1248          {
1249             if( nisdigit(slash+1,strlen(slash+1)) &&
1250                          nisdigit(*token,
1251                              (slash-*token)))
1252             {
1253                S_vsby = fracPart(*token);
1254                Mptr->SFC_VSBY += S_vsby;
1255                (*NDEX)++;
1256                (*NDEX)++;
1257                (*NDEX)++;
1258                (*NDEX)++;
1259                return TRUE;
1260             }
1261             else {
1262                (*NDEX)++;
1263                (*NDEX)++;
1264                (*NDEX)++;
1265                return TRUE;
1266             }
1267  
1268          }
1269          else {
1270             (*NDEX)++;
1271             (*NDEX)++;
1272             (*NDEX)++;
1273             return TRUE;
1274          }
1275       }
1276       else {
1277          (*NDEX)++;
1278          (*NDEX)++;
1279          (*NDEX)++;
1280          return TRUE;
1281       }
1282  
1283    }
1284    else if( (slash = strchr(*token, '/'))
1285                              != NULL )
1286    {
1287       if( nisdigit(slash+1,strlen(slash+1)) &&
1288                          nisdigit(*token,
1289                              (slash-*token)))
1290       {
1291          Mptr->SFC_VSBY = fracPart(*token);
1292          (*NDEX)++;
1293          (*NDEX)++;
1294          (*NDEX)++;
1295          return TRUE;
1296       }
1297       else {
1298          (*NDEX)++;
1299          (*NDEX)++;
1300          return FALSE;
1301       }
1302    }
1303    else {
1304       (*NDEX)++;
1305       (*NDEX)++;
1306       return FALSE;
1307    }
1308  
1309 }
1310  
1311 /********************************************************************/
1312 /*                                                                  */
1313 /*  Title:         isVariableVsby                                   */
1314 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
1315 /*  Date:          21 Nov 1994                                      */
1316 /*  Programmer:    CARL MCCALLA                                     */
1317 /*  Language:      C/370                                            */
1318 /*                                                                  */
1319 /*  Abstract:  Determine whether or not the current and subsequent  */
1320 /*             groups from the METAR report make up a valid report  */
1321 /*             of variable prevailing visibility.                   */
1322 /*                                                                  */
1323 /*                                                                  */
1324 /*  Input:         string - the addr of a ptr to a character string */
1325 /*                          that may or may not be the indicator    */
1326 /*                          for variable prevailing visibility.     */
1327 /*                                                                  */
1328 /*                 Mptr - a pointer to a structure that has the     */
1329 /*                        data type Decoded_METAR.                  */
1330 /*                                                                  */
1331 /*                 NDEX - a pointer to an integer that is the index */
1332 /*                        into an array that contains the indi-     */
1333 /*                        vidual groups of the METAR report being   */
1334 /*                        decoded.  Upon entry, NDEX is the index   */
1335 /*                        of the current group of the METAR report  */
1336 /*                        that is to be indentified.                */
1337 /*                                                                  */
1338 /*  Output:        TRUE - if the input string (and subsequent grps) */
1339 /*                        are decoded as variable prevailing vsby.  */
1340 /*                 FALSE - if the input string (and subsequent grps)*/
1341 /*                         are not decoded as variable prevailing   */
1342 /*                         vsby.                                    */
1343 /*  External Functions Called:                                      */
1344 /*                 nisdigit                                         */
1345 /*                                                                  */
1346 /*  Modification History:                                           */
1347 /*                 None.                                            */
1348 /*                                                                  */
1349 /********************************************************************/
1350 static bool isVariableVsby( char **string, Decoded_METAR *Mptr,
1351                               int *NDEX )
1352 {
1353  
1354    /***************************/
1355    /* DECLARE LOCAL VARIABLES */
1356    /***************************/
1357  
1358    char *slash = NULL,
1359         *slash1 = NULL,
1360         *slash2 = NULL,
1361         buf[ 5 ],
1362         *V_char;
1363    float minimumVsby,
1364          maximumVsby;
1365  
1366  
1367  
1368    /*************************/
1369    /* START BODY OF ROUTINE */
1370    /*************************/
1371  
1372  
1373    /***************************************************/
1374    /* IF THE CURRENT GROUP IS  "VIS", THEN DETERMINE  */
1375    /* WHETHER OR NOT THE GROUPS THAT FOLLOW ARE VALID */
1376    /* VARIABLE PREVAILING VSBY.  IF THEY ARE, THEN    */
1377    /* DECODE THE GROUPS AND RETURN TRUE.  OTHERWISE,  */
1378    /* RETURN FALSE.                                   */
1379    /***************************************************/
1380  
1381    if( *string == NULL )
1382       return FALSE;
1383  
1384    if( strcmp(*string, "VIS") != 0 )
1385       return FALSE;
1386    else
1387       (++string);
1388  
1389    if( *string == NULL )
1390       return FALSE;
1391  
1392    if( !((V_char = strchr(*string, 'V')) != NULL ||
1393          nisdigit(*string,strlen(*string))) )
1394       return FALSE;
1395    else if( nisdigit(*string,strlen(*string)) ) {
1396       minimumVsby = (float) atoi(*string);
1397       (++string);
1398  
1399       if( *string == NULL )
1400          return FALSE;
1401  
1402       if( (V_char = strchr(*string,'V')) == NULL )
1403          return FALSE;
1404       else {
1405          if( (slash = strchr(*string,'/')) == NULL )
1406             return FALSE;
1407          else {
1408             if( nisdigit(*string,(slash - *string)) &&
1409                   nisdigit(slash+1,(V_char-(slash+1))) &&
1410                   nisdigit(V_char+1,strlen(V_char+1)) ) {
1411                if( (V_char - *string) > 4 )
1412                   return FALSE;
1413                else {
1414                   memset(buf,'\0',5);
1415                   strncpy(buf,*string,(V_char - *string));
1416                   Mptr->minVsby = minimumVsby + fracPart(buf);
1417                   maximumVsby = (float) atoi(V_char+1);
1418                }
1419  
1420                (++string);
1421  
1422                if( *string == NULL )
1423                   return FALSE;
1424  
1425                if( (slash = strchr(*string,'/')) == NULL ) {
1426                   Mptr->maxVsby = maximumVsby;
1427                   (*NDEX)++;
1428                   (*NDEX)++;
1429                   (*NDEX)++;
1430                   return TRUE;
1431                }
1432                else if( nisdigit(*string,(slash - *string)) &&
1433                            nisdigit(slash+1, strlen(slash+1)) ) {
1434                   Mptr->maxVsby = maximumVsby + fracPart(*string);
1435                   (*NDEX)++;
1436                   (*NDEX)++;
1437                   (*NDEX)++;
1438                   (*NDEX)++;
1439                   return TRUE;
1440                }
1441                else {
1442                   Mptr->maxVsby = maximumVsby;
1443                   (*NDEX)++;
1444                   (*NDEX)++;
1445                   (*NDEX)++;
1446                   return TRUE;
1447                }
1448             }
1449             else
1450                return FALSE;
1451          }
1452       }
1453    }
1454    else {
1455       if( (V_char = strchr(*string,'V')) == NULL )
1456          return FALSE;
1457       if(nisdigit(*string,(V_char - *string)) &&
1458             nisdigit(V_char+1,strlen(V_char+1)) ) {
1459          Mptr->minVsby = (float) antoi(*string,(V_char - *string));
1460          maximumVsby = (float) atoi(V_char+1);
1461  
1462          (++string);
1463  
1464          if( *string == NULL )
1465             return FALSE;
1466  
1467          if( (slash = strchr(*string,'/')) == NULL ) {
1468             Mptr->maxVsby = maximumVsby;
1469             (*NDEX)++;
1470             (*NDEX)++;
1471             return TRUE;
1472          }
1473          else if( nisdigit(*string, (slash - *string)) &&
1474                      nisdigit(slash+1,strlen(slash+1)) ) {
1475             Mptr->maxVsby = maximumVsby + fracPart( *string );
1476             (*NDEX)++;
1477             (*NDEX)++;
1478             (*NDEX)++;
1479             return TRUE;
1480          }
1481          else {
1482             Mptr->maxVsby = maximumVsby;
1483             (*NDEX)++;
1484             (*NDEX)++;
1485             return TRUE;
1486          }
1487       }
1488       else {
1489          if( (slash2 = strchr(V_char+1,'/')) == NULL &&
1490                (slash1 = strchr(*string,'/')) == NULL )
1491             return FALSE;
1492          else if( slash1 == NULL )
1493             return FALSE;
1494          else if( slash == slash2 )
1495             return FALSE;
1496          else if( nisdigit(*string,(slash1 - *string)) &&
1497                      nisdigit((slash1+1),(V_char-(slash1+1))) ) {
1498             if( (V_char - *string) > 4 )
1499                return FALSE;
1500             else {
1501                memset(buf,'\0',5);
1502                strncpy(buf,*string,(V_char - *string));
1503                minimumVsby = fracPart(buf);
1504             }
1505             if( slash2 == NULL) {
1506                if( nisdigit(V_char+1, strlen(V_char+1)) ) {
1507                   maximumVsby = (float) atoi(V_char+1);
1508  
1509                   (++string);
1510  
1511                   if( *string == NULL )
1512                      return FALSE;
1513  
1514                   if( (slash = strchr(*string,'/')) == NULL ) {
1515                      Mptr->minVsby = minimumVsby;
1516                      Mptr->maxVsby = maximumVsby;
1517                      (*NDEX)++;
1518                      (*NDEX)++;
1519                      return TRUE;
1520                   }
1521                   else if( nisdigit(*string,(slash-*string)) &&
1522                          nisdigit((slash+1),strlen(slash+1)) ) {
1523                      Mptr->minVsby = minimumVsby;
1524                      Mptr->maxVsby = maximumVsby +
1525                                         fracPart(*string);
1526                      (*NDEX)++;
1527                      (*NDEX)++;
1528                      (*NDEX)++;
1529                      return TRUE;
1530                   }
1531                   else{
1532                      Mptr->minVsby = minimumVsby;
1533                      Mptr->maxVsby = maximumVsby;
1534                      (*NDEX)++;
1535                      (*NDEX)++;
1536                      return TRUE;
1537                   }
1538                }
1539                else
1540                   return FALSE;
1541             }
1542             else {
1543                if( nisdigit(V_char+1,(slash2-V_char+1)) &&
1544                      nisdigit((slash2+1),strlen(slash2+1)) ) {
1545                   Mptr->minVsby = minimumVsby;
1546                   Mptr->maxVsby = fracPart(V_char+1);
1547                   (*NDEX)++;
1548                   (*NDEX)++;
1549                   return TRUE;
1550                }
1551                else
1552                   return FALSE;
1553             }
1554          }
1555       }
1556    }
1557    return FALSE;
1558 }
1559 /********************************************************************/
1560 /*                                                                  */
1561 /*  Title:         isVsby2ndSite                                    */
1562 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
1563 /*  Date:          15 Sep 1994                                      */
1564 /*  Programmer:    CARL MCCALLA                                     */
1565 /*  Language:      C/370                                            */
1566 /*                                                                  */
1567 /*  Abstract:  Determine whether or not the current and subsequent  */
1568 /*             groups from the METAR report make up a valid report  */
1569 /*             of visibility at a secondary site.                   */
1570 /*                                                                  */
1571 /*                                                                  */
1572 /*  Input:         token  - the addr of a ptr to a character string */
1573 /*                          that may or may not be the indicator    */
1574 /*                          for visibility at a secondary site.     */
1575 /*                                                                  */
1576 /*                 Mptr - a pointer to a structure that has the     */
1577 /*                        data type Decoded_METAR.                  */
1578 /*                                                                  */
1579 /*                 NDEX - a pointer to an integer that is the index */
1580 /*                        into an array that contains the indi-     */
1581 /*                        vidual groups of the METAR report being   */
1582 /*                        decoded.  Upon entry, NDEX is the index   */
1583 /*                        of the current group of the METAR report  */
1584 /*                        that is to be indentified.                */
1585 /*                                                                  */
1586 /*  Output:        TRUE - if the input string (and subsequent grps) */
1587 /*                        are decoded as visibility at a 2ndry site.*/
1588 /*                 FALSE - if the input string (and subsequent grps)*/
1589 /*                         are not decoded as visibility at a 2ndry */
1590 /*                         site.                                    */
1591 /*                                                                  */
1592 /*  External Functions Called:                                      */
1593 /*                 nisalnum                                         */
1594 /*                 fracPart                                         */
1595 /*                 nisdigit                                         */
1596 /*                                                                  */
1597 /*                                                                  */
1598 /*  Modification History:                                           */
1599 /*                 None.                                            */
1600 /*                                                                  */
1601 /********************************************************************/
1602 static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr,
1603                            int *NDEX)
1604 {
1605  
1606    /***************************/
1607    /* DECLARE LOCAL VARIABLES */
1608    /***************************/
1609  
1610    char *slash;
1611    float S_vsby,
1612          VSBY_2ndSite;
1613  
1614  
1615    /*************************/
1616    /* START BODY OF ROUTINE */
1617    /*************************/
1618  
1619  
1620    /***************************************************/
1621    /* IF THE CURRENT GROUP IS  "VIS", THEN DETERMINE  */
1622    /* WHETHER OR NOT THE GROUPS THAT FOLLOW ARE VALID */
1623    /* VSBILITY AT A 2NDRY SITE.  IF THEY ARE, THEN    */
1624    /* DECODE THE GROUPS AND RETURN TRUE.  OTHERWISE,  */
1625    /* RETURN FALSE.                                   */
1626    /***************************************************/
1627  
1628    if( *token == NULL )
1629       return FALSE;
1630  
1631    if(strcmp(*token,"VIS") != 0)
1632       return FALSE;
1633    else
1634       (++token);
1635  
1636    if( *token == NULL )
1637       return FALSE;
1638  
1639    if( nisdigit(*token,
1640               strlen(*token)))
1641    {
1642       VSBY_2ndSite = (float) atoi(*token);
1643       (++token);
1644       if( *token != NULL )
1645       {
1646          if( (slash = strchr(*token, '/'))
1647                              != NULL )
1648          {
1649             if( nisdigit(slash+1,strlen(slash+1)) &&
1650                          nisdigit(*token,
1651                              (slash-*token)))
1652             {
1653                S_vsby = fracPart(*token);
1654  
1655                (++token);
1656  
1657                if( *token == NULL )
1658                   return FALSE;
1659  
1660                if( strncmp( *token, "RY", 2 ) == 0) {
1661                   if( nisalnum( *token, strlen(*token) ) ) {
1662                      strcpy(Mptr->VSBY_2ndSite_LOC, *token);
1663                      Mptr->VSBY_2ndSite = VSBY_2ndSite + S_vsby;
1664                      (*NDEX)++;
1665                      (*NDEX)++;
1666                      (*NDEX)++;
1667                      (*NDEX)++;
1668                      return TRUE;
1669                   }
1670                   else
1671                      return FALSE;
1672                }
1673                else
1674                   return FALSE;
1675             }
1676             else {
1677                if( strncmp( *token, "RY", 2 ) == 0) {
1678                   if( nisalnum( *token, strlen(*token) ) ) {
1679                      strcpy(Mptr->VSBY_2ndSite_LOC, *token);
1680                      Mptr->VSBY_2ndSite = VSBY_2ndSite;
1681                      (*NDEX)++;
1682                      (*NDEX)++;
1683                      (*NDEX)++;
1684                      return TRUE;
1685                   }
1686                   else
1687                      return FALSE;
1688                }
1689                else
1690                   return FALSE;
1691             }
1692  
1693          }
1694          else {
1695             if( strncmp( *token, "RY", 2 ) == 0) {
1696                if( nisalnum( *token, strlen(*token) ) ) {
1697                   strcpy(Mptr->VSBY_2ndSite_LOC, *token);
1698                   Mptr->VSBY_2ndSite = VSBY_2ndSite;
1699                   (*NDEX)++;
1700                   (*NDEX)++;
1701                   (*NDEX)++;
1702                   return TRUE;
1703                }
1704                else
1705                   return TRUE;
1706             }
1707             else
1708                return FALSE;
1709          }
1710       }
1711       else {
1712          if( strncmp( *token, "RY", 2 ) == 0) {
1713             if( nisalnum( *token, strlen(*token) ) ) {
1714                strcpy(Mptr->VSBY_2ndSite_LOC, *token);
1715                Mptr->VSBY_2ndSite = VSBY_2ndSite;
1716                (*NDEX)++;
1717                (*NDEX)++;
1718                (*NDEX)++;
1719                return TRUE;
1720             }
1721             else
1722                return FALSE;
1723          }
1724          else
1725             return FALSE;
1726       }
1727  
1728    }
1729    else if( (slash = strchr(*token, '/'))
1730                              != NULL )
1731    {
1732       if( nisdigit(slash+1,strlen(slash+1)) &&
1733                          nisdigit(*token,
1734                              (slash-*token)))
1735       {
1736          VSBY_2ndSite = fracPart(*token);
1737          if( strncmp( *(++token), "RY", 2 ) == 0) {
1738             if( nisalnum( *token, strlen(*token) ) ) {
1739                Mptr->VSBY_2ndSite = VSBY_2ndSite;
1740                strcpy(Mptr->VSBY_2ndSite_LOC, *token);
1741                (*NDEX)++;
1742                (*NDEX)++;
1743                (*NDEX)++;
1744                return TRUE;
1745             }
1746             else
1747                return FALSE;
1748          }
1749          else
1750             return FALSE;
1751       }
1752       else
1753          return FALSE;
1754    }
1755    else
1756       return FALSE;
1757  
1758 }
1759  
1760 /********************************************************************/
1761 /*                                                                  */
1762 /*  Title:         isLTGfreq                                        */
1763 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
1764 /*  Date:          15 Sep 1994                                      */
1765 /*  Programmer:    CARL MCCALLA                                     */
1766 /*  Language:      C/370                                            */
1767 /*                                                                  */
1768 /*  Abstract:  Determine whether or not the current and subsequent  */
1769 /*             groups from the METAR report make up a valid report  */
1770 /*             of lightning.                                        */
1771 /*                                                                  */
1772 /*                                                                  */
1773 /*  Input:        string  - the addr of a ptr to a character string */
1774 /*                          that may or may not be the indicator    */
1775 /*                          for lightning.                          */
1776 /*                                                                  */
1777 /*                 Mptr - a pointer to a structure that has the     */
1778 /*                        data type Decoded_METAR.                  */
1779 /*                                                                  */
1780 /*                 NDEX - a pointer to an integer that is the index */
1781 /*                        into an array that contains the indi-     */
1782 /*                        vidual groups of the METAR report being   */
1783 /*                        decoded.  Upon entry, NDEX is the index   */
1784 /*                        of the current group of the METAR report  */
1785 /*                        that is to be indentified.                */
1786 /*                                                                  */
1787 /*  Output:        TRUE - if the input string (and subsequent grps) */
1788 /*                        are decoded as lightning.                 */
1789 /*                 FALSE - if the input string (and subsequent grps)*/
1790 /*                         are not decoded as lightning.            */
1791 /*                                                                  */
1792 /*  External Functions Called:                                      */
1793 /*                 NONE.                                            */
1794 /*                                                                  */
1795 /*                                                                  */
1796 /*  Modification History:                                           */
1797 /*                 09 May 1996:  Software modified to properly      */
1798 /*                               decode lightning types.            */
1799 /*                                                                  */
1800 /*                                                                  */
1801 /*                                                                  */
1802 /********************************************************************/
1803  
1804 bool static isLTGfreq( char **string, Decoded_METAR *Mptr, int *NDEX )
1805 {
1806  
1807    /***************************/
1808    /* DECLARE LOCAL VARIABLES */
1809    /***************************/
1810  
1811    bool LTG_FREQ_FLAG,
1812         LTG_TYPE_FLAG,
1813         LTG_LOC_FLAG,
1814         LTG_DIR_FLAG,
1815         TYPE_NOT_FOUND;
1816    char *temp;
1817  
1818    /*************************/
1819    /* START BODY OF ROUTINE */
1820    /*************************/
1821  
1822  
1823  
1824    /***************************************************/
1825    /* IF THE CURRENT GROUP IS  "LTG", THEN DETERMINE  */
1826    /* WHETHER OR NOT THE PREVIOUS GROUP AS WELL AS    */
1827    /* GROUPS THAT FOLLOW ARE VALID LIGHTNING REPORT   */
1828    /* PARAMETERS.  IF THEY ARE, THEN DECODE THE       */
1829    /* GROUPS AND RETURN TRUE.  OTHERWISE, RETURN      */
1830    /*                   FALSE.                        */
1831    /***************************************************/
1832  
1833    if( *string == NULL )
1834       return FALSE;
1835  
1836    if( strcmp(*string,"VCTS") == 0 ) {
1837       Mptr->LightningVCTS = TRUE;
1838       (++string);
1839       (*NDEX)++;
1840       return TRUE;
1841    }
1842  
1843    if( *string == NULL )
1844       return FALSE;
1845  
1846    if( strncmp( *string, "LTG", 3 ) != 0 ) {
1847       return FALSE;
1848    }
1849    else {
1850  
1851       if( *string == NULL )
1852          return FALSE;
1853  
1854       (--string);
1855  
1856  
1857       LTG_FREQ_FLAG = FALSE;
1858                         /*-- CHECK FOR LIGHTNING FREQUENCY -----------*/
1859       if( strcmp( *string, "OCNL" ) == 0 ) {
1860          Mptr->OCNL_LTG = TRUE;
1861          LTG_FREQ_FLAG = TRUE;
1862       }
1863       else if( strcmp( *string, "FRQ" ) == 0 ) {
1864          Mptr->FRQ_LTG = TRUE;
1865          LTG_FREQ_FLAG = TRUE;
1866       }
1867       else if( strcmp( *string, "CNS" ) == 0 ) {
1868          Mptr->CNS_LTG = TRUE;
1869          LTG_FREQ_FLAG = TRUE;
1870       }
1871  
1872  
1873       (++string);
1874  
1875       if( *string == NULL )
1876          return FALSE;
1877  
1878  
1879       if( strcmp( *string, "LTG") == 0 ) {
1880          (++string);
1881  
1882          if( *string == NULL )
1883             return FALSE;
1884  
1885          (*NDEX)++;
1886  
1887          LTG_LOC_FLAG = FALSE;
1888                         /*-- CHECK FOR LIGHTNING LOCATION ------------*/
1889          if( strcmp( *string, "DSNT" ) == 0 ) {
1890             Mptr->DSNT_LTG = TRUE;
1891             LTG_LOC_FLAG = TRUE;
1892          }
1893          else if( strcmp( *string, "AP" ) == 0 ) {
1894             Mptr->AP_LTG = TRUE;
1895             LTG_LOC_FLAG = TRUE;
1896          }
1897          else if( strcmp( *string, "VCY" ) == 0 ||
1898                   strcmp( *string, "VC"  ) == 0 ) {
1899             Mptr->VcyStn_LTG = TRUE;
1900             LTG_LOC_FLAG = TRUE;
1901          }
1902          else if( strcmp( *string, "OVHD" ) == 0 ||
1903                   strcmp( *string, "OHD"  ) == 0 ) {
1904             Mptr->OVHD_LTG = TRUE;
1905             LTG_LOC_FLAG = TRUE;
1906          }
1907  
1908          if( LTG_LOC_FLAG )
1909             (++string);
1910  
1911          if( *string == NULL ) {
1912             if( LTG_LOC_FLAG )
1913                (*NDEX)++;
1914             return TRUE;
1915          }
1916  
1917          LTG_DIR_FLAG = FALSE;
1918                         /*-- CHECK FOR LIGHTNING DIRECTION -----------*/
1919          if( strcmp( *string, "N" ) == 0 ||
1920              strcmp( *string, "NE" ) == 0 ||
1921              strcmp( *string, "NW" ) == 0 ||
1922              strcmp( *string, "S" ) == 0 ||
1923              strcmp( *string, "SE" ) == 0 ||
1924              strcmp( *string, "SW" ) == 0 ||
1925              strcmp( *string, "E" ) == 0 ||
1926              strcmp( *string, "W" ) == 0    ) {
1927             strcpy( Mptr->LTG_DIR, *string);
1928             LTG_DIR_FLAG = TRUE;
1929          }
1930  
1931  
1932          if( LTG_LOC_FLAG )
1933             (*NDEX)++;
1934          if( LTG_DIR_FLAG )
1935             (*NDEX)++;
1936  
1937          return TRUE;
1938       }
1939       else {
1940  
1941          LTG_TYPE_FLAG = FALSE;
1942                         /*-- CHECK FOR LIGHTNING TYPE ----------------*/
1943          TYPE_NOT_FOUND = FALSE;
1944          temp = (*string) + 3;
1945          while( *temp != '\0' && !TYPE_NOT_FOUND ) {
1946             if( strncmp( temp, "CG", 2 ) == 0 ) {
1947                Mptr->CG_LTG = TRUE;
1948                LTG_TYPE_FLAG = TRUE;
1949                temp++;
1950                temp++;
1951             }
1952             else if( strncmp( temp, "IC", 2 ) == 0 ) {
1953                Mptr->IC_LTG = TRUE;
1954                LTG_TYPE_FLAG = TRUE;
1955                temp++;
1956                temp++;
1957             }
1958             else if( strncmp( temp, "CC", 2 ) == 0 ) {
1959                Mptr->CC_LTG = TRUE;
1960                LTG_TYPE_FLAG = TRUE;
1961                temp++;
1962                temp++;
1963             }
1964             else if( strncmp( temp, "CA", 2 ) == 0 ) {
1965                Mptr->CA_LTG = TRUE;
1966                LTG_TYPE_FLAG = TRUE;
1967                temp++;
1968                temp++;
1969             }
1970             else
1971                TYPE_NOT_FOUND = TRUE;
1972          }
1973  
1974          (++string);
1975  
1976          if( *string == NULL ) {
1977             (*NDEX)++;
1978             return TRUE;
1979          }
1980          else
1981             (*NDEX)++;
1982  
1983          LTG_LOC_FLAG = FALSE;
1984                         /*-- CHECK FOR LIGHTNING LOCATION ------------*/
1985          if( strcmp( *string, "DSNT" ) == 0 ) {
1986             Mptr->DSNT_LTG = TRUE;
1987             LTG_LOC_FLAG = TRUE;
1988          }
1989          else if( strcmp( *string, "AP" ) == 0 ) {
1990             Mptr->AP_LTG = TRUE;
1991             LTG_LOC_FLAG = TRUE;
1992          }
1993          else if( strcmp( *string, "VCY" ) == 0 ||
1994                   strcmp( *string, "VC"  ) == 0 ) {
1995             Mptr->VcyStn_LTG = TRUE;
1996             LTG_LOC_FLAG = TRUE;
1997          }
1998          else if( strcmp( *string, "OVHD" ) == 0 ) {
1999             Mptr->OVHD_LTG = TRUE;
2000             LTG_LOC_FLAG = TRUE;
2001          }
2002  
2003          if( LTG_LOC_FLAG )
2004             (++string);
2005  
2006          if( *string == NULL ) {
2007             if( LTG_LOC_FLAG )
2008                (*NDEX)++;
2009             if( LTG_TYPE_FLAG )
2010                (*NDEX)++;
2011             return TRUE;
2012          }
2013  
2014          LTG_DIR_FLAG = FALSE;
2015                         /*-- CHECK FOR LIGHTNING DIRECTION -----------*/
2016          if( strcmp( *string, "N" ) == 0 ||
2017              strcmp( *string, "NE" ) == 0 ||
2018              strcmp( *string, "NW" ) == 0 ||
2019              strcmp( *string, "S" ) == 0 ||
2020              strcmp( *string, "SE" ) == 0 ||
2021              strcmp( *string, "SW" ) == 0 ||
2022              strcmp( *string, "E" ) == 0 ||
2023              strcmp( *string, "W" ) == 0    ) {
2024             strcpy( Mptr->LTG_DIR, *string);
2025             LTG_DIR_FLAG = TRUE;
2026          }
2027  
2028  
2029          if( LTG_TYPE_FLAG )
2030             (*NDEX)++;
2031          if( LTG_LOC_FLAG )
2032             (*NDEX)++;
2033          if( LTG_DIR_FLAG )
2034             (*NDEX)++;
2035  
2036          return TRUE;
2037       }
2038    }
2039 }
2040  
2041  
2042  
2043 #include "Metar.h"     /* standard header file */
2044  
2045 /********************************************************************/
2046 /*                                                                  */
2047 /*  Title:         isRecentWx                                       */
2048 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2049 /*  Date:          15 Sep 1994                                      */
2050 /*  Programmer:    CARL MCCALLA                                     */
2051 /*  Language:      C/370                                            */
2052 /*                                                                  */
2053 /*  Abstract:  Determine whether or not the current and subsequent  */
2054 /*             groups from the METAR report make up a valid report  */
2055 /*             recent weather.                                      */
2056 /*                                                                  */
2057 /*  Input:         token  - the addr of a ptr to a character token */
2058 /*                          that may or may not be a recent weather */
2059 /*                          group.                                  */
2060 /*                                                                  */
2061 /*                 Mptr - a pointer to a structure that has the     */
2062 /*                        data type Decoded_METAR.                  */
2063 /*                                                                  */
2064 /*                 NDEX - a pointer to an integer that is the i*NDEX */
2065 /*                        into an array that contains the indi-     */
2066 /*                        vidual groups of the METAR report being   */
2067 /*                        decoded.  Upon entry, NDEX is the i*NDEX   */
2068 /*                        of the current group of the METAR report  */
2069 /*                        that is to be indentified.                */
2070 /*                                                                  */
2071 /*  Output:        TRUE - if the input token (and possibly subse-  */
2072 /*                        quent groups) are decoded as recent wx.   */
2073 /*                 FALSE - if the input token (and possibly subse- */
2074 /*                         quent groups) are not decoded as recent  */
2075 /*                         wx.                                      */
2076 /*                                                                  */
2077 /*  External Functions Called:                                      */
2078 /*                 nisdigit                                         */
2079 /*                                                                  */
2080 /*  Input:         x                                                */
2081 /*                                                                  */
2082 /*  Output:        x                                                */
2083 /*                                                                  */
2084 /*  Modification History:                                           */
2085 /*                 None.                                            */
2086 /*                                                                  */
2087 /********************************************************************/
2088 static bool isRecentWX( char **token, Decoded_METAR *Mptr,
2089                         int *NDEX )
2090 {
2091    static char *phenom[] = {"-DZB", "DZB", "+DZB",
2092    "FZDZB", "-RAB", "RAB", "+RAB",
2093    "SHRAB", "TSRAB", "FZRAB", "-SNB",
2094    "SNB", "+SNB", "DRSNB", "BLSNB",
2095    "SHSNB", "TSSNB", "-SGB", "SGB",
2096    "+SGB", "ICB", "-PEB", "PEB", "+PEB",
2097    "SHPEB", "TSPEB", "GRB", "SHGRB",
2098    "TSGRB", "GSB", "SHGSB", "TSGSB", "-GSB",
2099    "+GSB", "TSB", "VCTSB", "-TSRAB",
2100    "TSRAB", "+TSRAB", "-TSSNB", "TSSNB",
2101    "+TSSNB", "-TSPEB", "TSPEB", "+TSPEB",
2102    "-TSGSB", "TSGSB", "+TSGSB",
2103    "VCSHB", "-SHRAB", "+SHRAB", "-SHSNB",
2104    "+SHSNB", "-SHPEB", "+SHPEB",
2105    "-SHGSB", "+SHGSB", "-FZDZB", "+FZDZB",
2106    "-FZRAB", "+FZRAB", "FZFGB",
2107    "+FZFGB", "BRB", "FGB", "VCFGB", "MIFGB",
2108    "PRFGB", "BCFGB", "FUB",
2109    "VAB", "DUB", "DRDUB", "BLDUB", "SAB",
2110    "DRSAB", "BLSAB", "HZB",
2111    "BLPYB", "BLSNB", "+BLSNB", "VCBLSNB",
2112    "BLSAB", "+BLSAB",
2113    "VCBLSAB", "+BLDUB", "VCBLDUB", "POB",
2114    "VCPOB", "SQB", "FCB", "+FCB",
2115    "VCFCB", "SSB", "+SSB", "VCSSB", "DSB",
2116    "+DSB", "VCDSB",
2117  
2118  
2119    "-DZE", "DZE", "+DZE",
2120    "FZDZE", "-RAE", "RAE", "+RAE",
2121    "SHRAE", "TSRAE", "FZRAE", "-SNE",
2122    "SNE", "+SNE", "DRSNE", "BLSNE",
2123    "SHSNE", "TSSNE", "-SGE", "SGE",
2124    "+SGE", "ICE", "-PEE", "PEE", "+PEE",
2125    "SHPEE", "TSPEE", "GRE", "SHGRE",
2126    "TSGRE", "GSE", "SHGSE", "TSGSE", "-GSE",
2127    "+GSE", "TSE", "VCTSE", "-TSRAE",
2128    "TSRAE", "+TSRAE", "-TSSNE", "TSSNE",
2129    "+TSSNE", "-TSPEE", "TSPEE", "+TSPEE",
2130    "-TSGSE", "TSGSE", "+TSGSE",
2131    "VCSHE", "-SHRAE", "+SHRAE", "-SHSNE",
2132    "+SHSNE", "-SHPEE", "+SHPEE",
2133    "-SHGSE", "+SHGSE", "-FZDZE", "+FZDZE",
2134    "-FZRAE", "+FZRAE", "FZFGE",
2135    "+FZFGE", "BRE", "FGE", "VCFGE", "MIFGE",
2136    "PRFGE", "BCFGE", "FUE",
2137    "VAE", "DUE", "DRDUE", "BLDUE", "SAE",
2138    "DRSAE", "BLSAE", "HZE",
2139    "BLPYE", "BLSNE", "+BLSNE", "VCBLSNE",
2140    "BLSAE", "+BLSAE",
2141    "VCBLSAE", "+BLDUE", "VCBLDUE", "POE",
2142    "VCPOE", "SQE", "FCE", "+FCE",
2143    "VCFCE", "SSE", "+SSE", "VCSSE", "DSE",
2144    "+DSE", "VCDSE", "4-Zs"};
2145  
2146    int i,
2147        beg_hour,
2148        beg_min,
2149        end_hour,
2150        end_min;
2151  
2152    char *temp,
2153         *free_temp,
2154         *numb_char,
2155         *C_char;
2156  
2157  
2158    if( *token == NULL )
2159       return FALSE;
2160  
2161    if( (free_temp = temp = (char *) malloc(sizeof(char) *
2162              (strlen(*token) + 1))) == NULL ) {
2163       return FALSE;
2164    }
2165    else
2166       strcpy(temp,*token);
2167  
2168    while ( *temp != '\0' ) {
2169  
2170       i = 0;
2171  
2172       beg_hour = beg_min = end_hour = end_min = MAXINT;
2173  
2174       while( strncmp(temp, phenom[i],strlen(phenom[i])) != 0 &&
2175                     strcmp(phenom[i],"4-Zs") != 0 )
2176          i++;
2177  
2178       if( strcmp(phenom[i],"4-Zs") != 0 ) {
2179 #ifdef PRECENX
2180          printf("PHENOM = %s\n",phenom[i]);
2181 #endif
2182          C_char = (strlen(phenom[i]) - 1) + temp;
2183          numb_char = C_char + 1;
2184  
2185          if( *numb_char == '\0')
2186             return FALSE;
2187  
2188          if( nisdigit(numb_char,4) && strlen(numb_char) >= 4) {
2189             if( *C_char == 'B' ) {
2190                beg_hour = antoi( numb_char, 2 );
2191                beg_min = antoi( numb_char+2,2 );
2192 #ifdef PRECENT
2193                printf("BEG_HOUR1 = %d\n",beg_hour);
2194                printf("BEG_MIN1  = %d\n",beg_min );
2195 #endif
2196                temp = numb_char+4;
2197  
2198                if( *NDEX <= 3 ) {
2199                   Mptr->ReWx[*NDEX].Bmm = beg_min;
2200                   Mptr->ReWx[*NDEX].Bhh = beg_hour;
2201                }
2202  
2203                if( *(numb_char+4) == 'E' ) {
2204                   numb_char += 5;
2205                   if( nisdigit(numb_char,4) &&
2206                               strlen(numb_char) >= 4 ) {
2207                      end_hour = antoi( numb_char, 2 );
2208                      end_min = antoi( numb_char+2,2 );
2209 #ifdef PRECENT
2210                      printf("END_HOUR2 = %d\n",end_hour);
2211                      printf("END_MIN2  = %d\n",end_min );
2212 #endif
2213                      temp = numb_char+4;
2214  
2215                      if( *NDEX <= 3 ) {
2216                         Mptr->ReWx[*NDEX].Emm = end_min;
2217                         Mptr->ReWx[*NDEX].Ehh = end_hour;
2218                      }
2219                   }
2220                   else if( nisdigit(numb_char,2) &&
2221                             strlen(numb_char) >= 2 ) {
2222                      end_min = antoi( numb_char,2 );
2223  
2224                      if( *NDEX <= 3 ) {
2225                         Mptr->ReWx[*NDEX].Emm = end_min;
2226 #ifdef PRECENT
2227                         printf("END_MIN3  = %d\n",end_min );
2228 #endif
2229                      }
2230                      temp = numb_char+2;
2231                   }
2232  
2233                }
2234  
2235                if( *NDEX <= 3 )
2236                   strncpy(Mptr->ReWx[*NDEX].Recent_weather,
2237                              phenom[i], (strlen(phenom[i])-1) );
2238  
2239                free( free_temp );
2240                return TRUE;
2241  
2242             }
2243             else {
2244                end_hour = antoi( numb_char, 2 );
2245                end_min = antoi( numb_char+2,2 );
2246  
2247                if( *NDEX <= 3 ) {
2248                   Mptr->ReWx[*NDEX].Emm = end_min;
2249                   Mptr->ReWx[*NDEX].Ehh = end_hour;
2250  
2251 #ifdef PRECENT
2252                   printf("END_HOUR4 = %d\n",end_hour);
2253                   printf("END_MIN4  = %d\n",end_min );
2254 #endif
2255                }
2256  
2257                temp = numb_char+4;
2258  
2259                if( *(numb_char+4) == 'B' ) {
2260                   numb_char += 5;
2261                   if( nisdigit(numb_char,4) &&
2262                              strlen(numb_char) >= 4 ) {
2263 /*                   beg_hour = antoi( numb_char, 2 );
2264                      beg_min = antoi( numb_char+2,2 );  */
2265  
2266                      if( *NDEX <= 3 ) {
2267                         Mptr->ReWx[*NDEX].Bmm = beg_min;
2268                         Mptr->ReWx[*NDEX].Bhh = beg_hour;
2269  
2270 #ifdef PRECENT
2271                         printf("BEG_HOUR5 = %d\n",beg_hour);
2272                         printf("BEG_MIN5  = %d\n",beg_min );
2273 #endif
2274                      }
2275  
2276                      temp = numb_char+4;
2277                   }
2278                   else if( nisdigit(numb_char,2) &&
2279                            strlen(numb_char) >= 2 ) {
2280                      beg_min = antoi( numb_char,2 );
2281  
2282                      if( *NDEX <= 3 ) {
2283                         Mptr->ReWx[*NDEX].Bmm = beg_min;
2284 #ifdef PRECENT
2285                         printf("BEG_MIN6  = %d\n",beg_min );
2286 #endif
2287                      }
2288  
2289                      temp = numb_char+2;
2290                   }
2291  
2292                }
2293  
2294                   if( *NDEX <= 3 )
2295                      strncpy(Mptr->ReWx[*NDEX].Recent_weather,
2296                              phenom[i], (strlen(phenom[i])-1) );
2297  
2298                   free( free_temp );
2299                   return TRUE;
2300  
2301             }
2302  
2303          }
2304          else if(nisdigit(numb_char,2) && strlen(numb_char) >= 2 ) {
2305             if( *C_char == 'B' ) {
2306                beg_min = antoi( numb_char,2 );
2307  
2308                if( *NDEX <= 3 ) {
2309                   Mptr->ReWx[*NDEX].Bmm = beg_min;
2310 #ifdef PRECENT
2311                   printf("BEG_MIN7  = %d\n",beg_min );
2312 #endif
2313                }
2314  
2315                temp = numb_char+2;
2316  
2317                if( *(numb_char+2) == 'E' ) {
2318                   numb_char += 3;
2319                   if( nisdigit(numb_char,4) &&
2320                            strlen(numb_char) >= 4 ) {
2321                      end_hour = antoi( numb_char,2 );
2322                      end_min = antoi( numb_char+2,2 );
2323  
2324                      if( *NDEX <= 3 ) {
2325                         Mptr->ReWx[*NDEX].Emm = end_min;
2326                         Mptr->ReWx[*NDEX].Ehh = end_hour;
2327  
2328 #ifdef PRECENT
2329                         printf("END_HOUR8 = %d\n",end_hour);
2330                         printf("END_MIN8  = %d\n",end_min );
2331 #endif
2332                      }
2333  
2334                      temp = numb_char+4;
2335                   }
2336                   else if( nisdigit(numb_char,2) &&
2337                              strlen(numb_char) >= 2 ) {
2338                      end_min = antoi( numb_char,2 );
2339  
2340                      if( *NDEX <= 3 ) {
2341                         Mptr->ReWx[*NDEX].Emm = end_min;
2342 #ifdef PRECENT
2343                         printf("END_MIN9  = %d\n",end_min );
2344 #endif
2345                      }
2346  
2347                      temp = numb_char+2;
2348                   }
2349                }
2350             }
2351             else {
2352                end_min = antoi( numb_char, 2 );
2353  
2354                if( *NDEX <= 3 ) {
2355                   Mptr->ReWx[*NDEX].Emm = end_min;
2356 #ifdef PRECENT
2357                   printf("END_MIN10  = %d\n",end_min );
2358 #endif
2359                }
2360  
2361                temp = numb_char+2;
2362  
2363                if( *(numb_char+2) == 'B' ) {
2364                   numb_char += 3;
2365                   if( nisdigit(numb_char,4) &&
2366                                strlen(numb_char) >= 4 ) {
2367                      beg_hour = antoi( numb_char,2 );
2368                      beg_min = antoi( numb_char+2,2 );
2369  
2370                      if( *NDEX <= 3 ) {
2371                         Mptr->ReWx[*NDEX].Bmm = beg_min;
2372                         Mptr->ReWx[*NDEX].Bhh = beg_hour;
2373  
2374 #ifdef PRECENT
2375                         printf("BEG_HOUR11 = %d\n",beg_hour);
2376                         printf("BEG_MIN11  = %d\n",beg_min );
2377 #endif
2378                      }
2379  
2380                      temp = numb_char+4;
2381                   }
2382                   else if( nisdigit(numb_char,2) &&
2383                              strlen(numb_char) >= 2 ) {
2384                      beg_min = antoi( numb_char,2 );
2385  
2386                      if( *NDEX <= 3 ) {
2387                         Mptr->ReWx[*NDEX].Bmm = beg_min;
2388 #ifdef PRECENT
2389                         printf("BEG_MIN12  = %d\n",beg_min );
2390 #endif
2391                      }
2392  
2393                      temp = numb_char+2;
2394                   }
2395  
2396                }
2397  
2398             }
2399  
2400             if( *NDEX <= 3 )
2401                strncpy(Mptr->ReWx[*NDEX].Recent_weather,
2402                        phenom[i], (strlen(phenom[i])-1) );
2403  
2404             free( free_temp );
2405             return TRUE;
2406  
2407          }
2408          else {
2409             free( free_temp );
2410             return FALSE;
2411          }
2412  
2413       }
2414       else {
2415          free( free_temp );
2416          return FALSE;
2417       }
2418  
2419    }
2420         return FALSE; 
2421 }
2422  
2423  
2424 /********************************************************************/
2425 /*                                                                  */
2426 /*  Title:         isVariableCIG                                    */
2427 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2428 /*  Date:          21 Nov 1994                                      */
2429 /*  Programmer:    CARL MCCALLA                                     */
2430 /*  Language:      C/370                                            */
2431 /*                                                                  */
2432 /*  Abstract:      isVariableCIG determines whether or not the      */
2433 /*                 current group in combination with the next       */
2434 /*                 one or more groups is a report of variable       */
2435 /*                 ceiling.                                         */
2436 /*                                                                  */
2437 /*  External Functions Called:                                      */
2438 /*                 nisdigit                                         */
2439 /*                                                                  */
2440 /*  Input:         token - a pointer to an array of METAR report    */
2441 /*                           groups.                                */
2442 /*                 Mptr - a pointer to a decoded_METAR structure    */
2443 /*                 NDEX - the index value of the current METAR      */
2444 /*                        report group array element.               */
2445 /*                                                                  */
2446 /*  Output:        TRUE, if the token is currently pointing to      */
2447 /*                 METAR report group(s) that a report of vari-     */
2448 /*                 ble ceiling.                                     */
2449 /*                                                                  */
2450 /*  Modification History:                                           */
2451 /*                 None.                                            */
2452 /*                                                                  */
2453 /********************************************************************/
2454 static bool isVariableCIG( char **token, Decoded_METAR *Mptr,
2455                            int *NDEX )
2456 {
2457    char *V_char;
2458  
2459    if( *token == NULL )
2460       return FALSE;
2461  
2462    if( strcmp(*token, "CIG") != 0 )
2463       return FALSE;
2464    else
2465       (++token);
2466  
2467    if( *token == NULL )
2468       return FALSE;
2469  
2470    if( (V_char = strchr(*token,'V')) != NULL ) {
2471       if( nisdigit(*token, (V_char - *token)) &&
2472             nisdigit( V_char+1, strlen(V_char+1)) ) {
2473          Mptr->minCeiling = antoi(*token, (V_char - *token));
2474          Mptr->maxCeiling = atoi(V_char+1);
2475  
2476          (*NDEX)++;
2477          (*NDEX)++;
2478          return TRUE;
2479       }
2480       else
2481          return FALSE;
2482    }
2483    else
2484       return FALSE;
2485 }
2486 /********************************************************************/
2487 /*                                                                  */
2488 /*  Title:         isCeil2ndSite                                    */
2489 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2490 /*  Date:          15 Sep 1994                                      */
2491 /*  Programmer:    CARL MCCALLA                                     */
2492 /*  Language:      C/370                                            */
2493 /*                                                                  */
2494 /*  Abstract:      isCeil2ndSite determines whether or not the      */
2495 /*                 current group in combination with the next       */
2496 /*                 one or more groups is a report of a ceiling      */
2497 /*                 at a secondary site.                             */
2498 /*                                                                  */
2499 /*  External Functions Called:                                      */
2500 /*                 nisdigit                                         */
2501 /*                                                                  */
2502 /*  Input:         token - a pointer to an array of METAR report    */
2503 /*                           groups.                                */
2504 /*                 Mptr - a pointer to a decoded_METAR structure    */
2505 /*                 NDEX - the index value of the current METAR      */
2506 /*                        report group array element.               */
2507 /*                                                                  */
2508 /*  Output:        TRUE, if the token is currently pointing to      */
2509 /*                 METAR report group(s) that are reporting         */
2510 /*                 ceiling at a secondary site.                     */
2511 /*                                                                  */
2512 /*  External Functions Called:                                      */
2513 /*                 nisdigit                                         */
2514 /*                                                                  */
2515 /*                                                                  */
2516 /*  Modification History:                                           */
2517 /*                 None.                                            */
2518 /*                                                                  */
2519 /********************************************************************/
2520 static bool isCIG2ndSite( char **token, Decoded_METAR *Mptr,
2521                            int *NDEX)
2522 {
2523    int CIG2ndSite;
2524  
2525    if( (*token) == NULL )
2526       return FALSE;
2527  
2528    if(strcmp(*token,"CIG") != 0)
2529       return FALSE;
2530    else
2531       (++token);
2532  
2533    if( (*token) == NULL )
2534       return FALSE;
2535  
2536    if( strlen(*token) != 3 )
2537       return FALSE;
2538  
2539    if( nisdigit(*token,3) )
2540    {
2541       CIG2ndSite = atoi(*token ) * 10;
2542  
2543       if( strncmp(*(++token),"RY",2) != 0)
2544          return FALSE;
2545       else {
2546          strcpy(Mptr->CIG_2ndSite_LOC, *token );
2547          Mptr->CIG_2ndSite_Meters = CIG2ndSite;
2548          (*NDEX)++;
2549          (*NDEX)++;
2550          (*NDEX)++;
2551          return TRUE;
2552       }
2553    }
2554    else
2555       return FALSE;
2556 }
2557  
2558 /********************************************************************/
2559 /*                                                                  */
2560 /*  Title:         isPRESFR                                         */
2561 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2562 /*  Date:          20 Nov 1994                                      */
2563 /*  Programmer:    CARL MCCALLA                                     */
2564 /*  Language:      C/370                                            */
2565 /*                                                                  */
2566 /*  Abstract:      x                                                */
2567 /*                 x                                                */
2568 /*                 x                                                */
2569 /*                 x                                                */
2570 /*                 x                                                */
2571 /*                 x                                                */
2572 /*                 x                                                */
2573 /*                 x                                                */
2574 /*                 x                                                */
2575 /*                 x                                                */
2576 /*                                                                  */
2577 /*  External Functions Called:                                      */
2578 /*                 None.                                            */
2579 /*                 x                                                */
2580 /*                 x                                                */
2581 /*                 x                                                */
2582 /*                 x                                                */
2583 /*                 x                                                */
2584 /*                 x                                                */
2585 /*                                                                  */
2586 /*  Input:         x                                                */
2587 /*                 x                                                */
2588 /*                 x                                                */
2589 /*                 x                                                */
2590 /*                 x                                                */
2591 /*                 x                                                */
2592 /*                 x                                                */
2593 /*                                                                  */
2594 /*  Output:        x                                                */
2595 /*                 x                                                */
2596 /*                 x                                                */
2597 /*                 x                                                */
2598 /*                 x                                                */
2599 /*                 x                                                */
2600 /*                 x                                                */
2601 /*                                                                  */
2602 /*  Modification History:                                           */
2603 /*                 None.                                            */
2604 /*                                                                  */
2605 /********************************************************************/
2606  
2607 static bool isPRESFR( char *string, Decoded_METAR *Mptr, int *NDEX)
2608 {
2609  
2610    if( string == NULL )
2611       return FALSE;
2612  
2613    if( strcmp(string, "PRESFR") != 0 )
2614       return FALSE;
2615    else {
2616       Mptr->PRESFR = TRUE;
2617       (*NDEX)++;
2618       return TRUE;
2619    }
2620  
2621 }
2622 /********************************************************************/
2623 /*                                                                  */
2624 /*  Title:         isPRESRR                                         */
2625 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2626 /*  Date:          20 Nov 1994                                      */
2627 /*  Programmer:    CARL MCCALLA                                     */
2628 /*  Language:      C/370                                            */
2629 /*                                                                  */
2630 /*  Abstract:      x                                                */
2631 /*                 x                                                */
2632 /*                 x                                                */
2633 /*                 x                                                */
2634 /*                 x                                                */
2635 /*                 x                                                */
2636 /*                 x                                                */
2637 /*                 x                                                */
2638 /*                 x                                                */
2639 /*                 x                                                */
2640 /*                                                                  */
2641 /*  External Functions Called:                                      */
2642 /*                 None.                                            */
2643 /*                 x                                                */
2644 /*                 x                                                */
2645 /*                 x                                                */
2646 /*                 x                                                */
2647 /*                 x                                                */
2648 /*                 x                                                */
2649 /*                                                                  */
2650 /*  Input:         x                                                */
2651 /*                 x                                                */
2652 /*                 x                                                */
2653 /*                 x                                                */
2654 /*                 x                                                */
2655 /*                 x                                                */
2656 /*                 x                                                */
2657 /*                                                                  */
2658 /*  Output:        x                                                */
2659 /*                 x                                                */
2660 /*                 x                                                */
2661 /*                 x                                                */
2662 /*                 x                                                */
2663 /*                 x                                                */
2664 /*                 x                                                */
2665 /*                                                                  */
2666 /*  Modification History:                                           */
2667 /*                 None.                                            */
2668 /*                                                                  */
2669 /********************************************************************/
2670  
2671 static bool isPRESRR( char *string, Decoded_METAR *Mptr, int *NDEX)
2672 {
2673  
2674    if( string == NULL )
2675       return FALSE;
2676  
2677    if( strcmp(string, "PRESRR") != 0 )
2678       return FALSE;
2679    else {
2680       Mptr->PRESRR = TRUE;
2681       (*NDEX)++;
2682       return TRUE;
2683    }
2684  
2685 }
2686  
2687 /********************************************************************/
2688 /*                                                                  */
2689 /*  Title:         isSLP                                            */
2690 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2691 /*  Date:          15 Sep 1994                                      */
2692 /*  Programmer:    CARL MCCALLA                                     */
2693 /*  Language:      C/370                                            */
2694 /*                                                                  */
2695 /*  Abstract:                                                       */
2696 /*                                                                  */
2697 /*  External Functions Called:                                      */
2698 /*                 None.                                            */
2699 /*                                                                  */
2700 /*  Input:         x                                                */
2701 /*                                                                  */
2702 /*  Output:        x                                                */
2703 /*                                                                  */
2704 /*  Modification History:                                           */
2705 /*                 None.                                            */
2706 /*                                                                  */
2707 /********************************************************************/
2708  
2709 static bool isSLP( char **token, Decoded_METAR *Mptr, int *NDEX )
2710 {
2711  
2712    /***************************/
2713    /* DECLARE LOCAL VARIABLES */
2714    /***************************/
2715  
2716    int pressure;
2717    // int ndex;
2718  
2719    /*************************/
2720    /* BEGIN BODY OF ROUTINE */
2721    /*************************/
2722  
2723    if( *token == NULL )
2724       return FALSE;
2725  
2726    if( strcmp(*token, "SLPNO") == 0 ) {
2727       Mptr->SLPNO = TRUE;
2728       (*NDEX)++;
2729       return TRUE;
2730    }
2731  
2732  
2733    if( strncmp(*token, "SLP", 3) != 0 )
2734       return FALSE;
2735    else
2736    {
2737       if( strncmp(*token, "SLP", 3) == 0 &&
2738                   strcmp(*token,"SLP") != 0 )
2739       {
2740          if( nisdigit( *token+3, 3) )
2741          {
2742             pressure = atoi(*token+3);
2743  
2744             if(pressure >= 550 )
2745                Mptr->SLP = ((float) pressure)/10. + 900.;
2746             else
2747                Mptr->SLP = ((float) pressure)/10. + 1000.;
2748             (*NDEX)++;
2749             return TRUE;
2750          }
2751          else
2752             return FALSE;
2753       }
2754       else
2755       {
2756          (++token);
2757  
2758          if( *token == NULL )
2759             return FALSE;
2760  
2761          if( nisdigit( *token, 3) )
2762          {
2763             pressure = atoi(*token);
2764  
2765             if(pressure >= 550 )
2766                Mptr->SLP = ((float) pressure)/10. + 900.;
2767             else
2768                Mptr->SLP = ((float) pressure)/10. + 1000.;
2769  
2770             (*NDEX)++;
2771             (*NDEX)++;
2772             return TRUE;
2773          }
2774          else
2775             return FALSE;
2776       }
2777  
2778    }
2779  
2780 }
2781 static bool isSectorVsby( char **string, Decoded_METAR *Mptr,
2782                           int  *NDEX )
2783 {
2784    /***************************/
2785    /* DECLARE LOCAL VARIABLES */
2786    /***************************/
2787  
2788    float vsby = 0.0f;
2789    char  dd[3],
2790          *slash;
2791  
2792    /*************************/
2793    /* START BODY OF ROUTINE */
2794    /*************************/
2795  
2796    if( *string == NULL )
2797       return FALSE;
2798  
2799    memset( dd, '\0', 3 );
2800  
2801    if( strcmp(*string, "VIS") != 0 )
2802       return FALSE;
2803    else {
2804       ++string;
2805  
2806       if( *string == NULL )
2807          return FALSE;
2808  
2809       if( strncmp(*string,"NE", 2) == 0 )
2810          strncpy(dd,*string,2);
2811       else if( strncmp(*string,"SE",2) == 0 )
2812          strncpy(dd,*string,2);
2813       else if( strncmp(*string,"NW",2) == 0 )
2814          strncpy(dd,*string,2);
2815       else if( strncmp(*string,"SW",2) == 0 )
2816          strncpy(dd,*string,2);
2817       else if( strncmp(*string,"N",1) == 0 )
2818          strncpy(dd,*string,1);
2819       else if( strncmp(*string,"E",1) == 0 )
2820          strncpy(dd,*string,1);
2821       else if( strncmp(*string,"S",1) == 0 )
2822          strncpy(dd,*string,1);
2823       else if( strncmp(*string,"W",1) == 0 )
2824          strncpy(dd,*string,1);
2825       else
2826          return FALSE;
2827  
2828       if(nisdigit((*string+strlen(dd)),(strlen(*string)-strlen(dd))))
2829          vsby = atoi((*string+strlen(dd)));
2830  
2831       (++string);
2832       if( *string == NULL )
2833          return FALSE;
2834  
2835       if( (slash = strchr(*string,'/')) == NULL ) {
2836          strcpy(Mptr->SectorVsby_Dir,dd);
2837          Mptr->SectorVsby = vsby;
2838          (*NDEX)++;
2839          (*NDEX)++;
2840          return TRUE;
2841       }
2842       else if( nisdigit(*string,(slash-*string)) &&
2843                nisdigit(slash+1,strlen(slash+1)) ) {
2844          vsby += fracPart(*string);
2845          strcpy( Mptr->SectorVsby_Dir, dd );
2846          Mptr->SectorVsby = vsby;
2847          (*NDEX)++;
2848          (*NDEX)++;
2849          (*NDEX)++;
2850          return TRUE;
2851       }
2852       else
2853          return FALSE;
2854    }
2855  
2856 }
2857  
2858 /********************************************************************/
2859 /*                                                                  */
2860 /*  Title:         isGR                                             */
2861 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2862 /*  Date:          20 Nov 1994                                      */
2863 /*  Programmer:    CARL MCCALLA                                     */
2864 /*  Language:      C/370                                            */
2865 /*                                                                  */
2866 /*  Abstract:      x                                                */
2867 /*                 x                                                */
2868 /*                 x                                                */
2869 /*                 x                                                */
2870 /*                 x                                                */
2871 /*                 x                                                */
2872 /*                 x                                                */
2873 /*                 x                                                */
2874 /*                 x                                                */
2875 /*                 x                                                */
2876 /*                                                                  */
2877 /*  External Functions Called:                                      */
2878 /*                 None.                                            */
2879 /*                 x                                                */
2880 /*                 x                                                */
2881 /*                 x                                                */
2882 /*                 x                                                */
2883 /*                 x                                                */
2884 /*                 x                                                */
2885 /*                                                                  */
2886 /*  Input:         x                                                */
2887 /*                 x                                                */
2888 /*                 x                                                */
2889 /*                 x                                                */
2890 /*                 x                                                */
2891 /*                 x                                                */
2892 /*                 x                                                */
2893 /*                                                                  */
2894 /*  Output:        x                                                */
2895 /*                 x                                                */
2896 /*                 x                                                */
2897 /*                 x                                                */
2898 /*                 x                                                */
2899 /*                 x                                                */
2900 /*                 x                                                */
2901 /*                                                                  */
2902 /*  Modification History:                                           */
2903 /*                 None.                                            */
2904 /*                                                                  */
2905 /********************************************************************/
2906 static bool isGR( char **string, Decoded_METAR *Mptr, int *NDEX)
2907 {
2908    char *slash;
2909  
2910    if( *string == NULL )
2911       return FALSE;
2912  
2913    if( strcmp(*string, "GS") == 0 ) {
2914       Mptr->GR = TRUE;
2915       (*NDEX)++;
2916       return TRUE;
2917    }
2918  
2919  
2920    if( strcmp(*string, "GR") != 0 )
2921       return FALSE;
2922    else {
2923       (++string);
2924  
2925       if( *string == NULL )
2926          return FALSE;
2927  
2928       if( (slash = strchr( *string, '/' )) != NULL ) {
2929          if( strcmp( *string, "M1/4" ) == 0 ) {
2930             Mptr->GR_Size = 1./8.;
2931             Mptr->GR = TRUE;
2932             (*NDEX)++;
2933             (*NDEX)++;
2934             return TRUE;
2935          }
2936          else if( nisdigit( *string, (slash - *string) ) &&
2937                nisdigit( slash+1, strlen(slash+1)) ) {
2938             Mptr->GR_Size = fracPart( *string );
2939             Mptr->GR = TRUE;
2940             (*NDEX)++;
2941             (*NDEX)++;
2942             return TRUE;
2943          }
2944          else {
2945             Mptr->GR = TRUE;
2946             (*NDEX)++;
2947             return TRUE;
2948          }
2949       }
2950       else if( nisdigit( *string, strlen(*string) ) ) {
2951          Mptr->GR_Size = antoi( *string, strlen(*string) );
2952          Mptr->GR = TRUE;
2953  
2954          (++string);
2955  
2956          if( *string == NULL )
2957             return FALSE;
2958  
2959          if( (slash = strchr( *string, '/' )) != NULL ) {
2960             if( nisdigit( *string, (slash - *string) ) &&
2961                      nisdigit( slash+1, strlen(slash+1)) ) {
2962                Mptr->GR_Size += fracPart( *string );
2963                (*NDEX)++;
2964                (*NDEX)++;
2965                (*NDEX)++;
2966                return TRUE;
2967             }
2968             else {
2969                (*NDEX)++;
2970                (*NDEX)++;
2971                return TRUE;
2972             }
2973          }
2974          else {
2975             (*NDEX)++;
2976             (*NDEX)++;
2977             return TRUE;
2978          }
2979       }
2980       else {
2981          Mptr->GR = TRUE;
2982          (*NDEX)++;
2983          return TRUE;
2984       }
2985    }
2986 }
2987  
2988 /********************************************************************/
2989 /*                                                                  */
2990 /*  Title:         isVIRGA                                          */
2991 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
2992 /*  Date:          20 Nov 1994                                      */
2993 /*  Programmer:    CARL MCCALLA                                     */
2994 /*  Language:      C/370                                            */
2995 /*                                                                  */
2996 /*  Abstract:      x                                                */
2997 /*                 x                                                */
2998 /*                 x                                                */
2999 /*                 x                                                */
3000 /*                 x                                                */
3001 /*                 x                                                */
3002 /*                 x                                                */
3003 /*                 x                                                */
3004 /*                 x                                                */
3005 /*                 x                                                */
3006 /*                                                                  */
3007 /*  External Functions Called:                                      */
3008 /*                 None.                                            */
3009 /*                 x                                                */
3010 /*                 x                                                */
3011 /*                 x                                                */
3012 /*                 x                                                */
3013 /*                 x                                                */
3014 /*                 x                                                */
3015 /*                                                                  */
3016 /*  Input:         x                                                */
3017 /*                 x                                                */
3018 /*                 x                                                */
3019 /*                 x                                                */
3020 /*                 x                                                */
3021 /*                 x                                                */
3022 /*                 x                                                */
3023 /*                                                                  */
3024 /*  Output:        x                                                */
3025 /*                 x                                                */
3026 /*                 x                                                */
3027 /*                 x                                                */
3028 /*                 x                                                */
3029 /*                 x                                                */
3030 /*                 x                                                */
3031 /*                                                                  */
3032 /*  Modification History:                                           */
3033 /*                 None.                                            */
3034 /*                                                                  */
3035 /********************************************************************/
3036  
3037 static bool isVIRGA( char **string, Decoded_METAR *Mptr, int *NDEX)
3038 {
3039  
3040    if( *string == NULL )
3041       return FALSE;
3042  
3043    if( strcmp(*string, "VIRGA") != 0 )
3044       return FALSE;
3045    else {
3046       Mptr->VIRGA = TRUE;
3047       (*NDEX)++;
3048  
3049       (++string);
3050  
3051       if( *string == NULL )
3052          return FALSE;
3053  
3054  
3055       if( strcmp( *string, "N" ) == 0 ||
3056           strcmp( *string, "S" ) == 0 ||
3057           strcmp( *string, "E" ) == 0 ||
3058           strcmp( *string, "W" ) == 0 ||
3059           strcmp( *string, "NE" ) == 0 ||
3060           strcmp( *string, "NW" ) == 0 ||
3061           strcmp( *string, "SE" ) == 0 ||
3062           strcmp( *string, "SW" ) == 0    ) {
3063          strcpy(Mptr->VIRGA_DIR, *string);
3064          (*NDEX)++;
3065       }
3066       return TRUE;
3067    }
3068  
3069 }
3070  
3071 static bool isSfcObscuration( char *string, Decoded_METAR *Mptr,
3072                               int *NDEX )
3073 {
3074    /***************************/
3075    /* DECLARE LOCAL VARIABLES */
3076    /***************************/
3077  
3078    static char *WxSymbols[] = {"BCFG", "BLDU", "BLSA", "BLPY",
3079           "DRDU", "DRSA", "DRSN", "DZ", "DS", "FZFG", "FZDZ", "FZRA",
3080           "FG", "FC", "FU", "GS", "GR", "HZ", "IC", "MIFG",
3081           "PE", "PO", "RA", "SHRA", "SHSN", "SHPE", "SHGS",
3082           "SHGR", "SN", "SG", "SQ", "SA", "SS", "TSRA",
3083           "TSSN", "TSPE", "TSGS", "TSGR", "TS",
3084           "VCSH", "VCPO", "VCBLDU", "VCBLSA", "VCBLSN",
3085           "VCFG", "VCFC","VA", NULL};
3086    int i,
3087        ndex;
3088    char *numLoc,
3089         ww[12],
3090         *temp;
3091  
3092    bool IS_NOT_FOUND;
3093  
3094    /*************************/
3095    /* START BODY OF ROUTINE */
3096    /*************************/
3097  
3098    if( string == NULL )
3099       return FALSE;
3100  
3101    memset( ww, '\0', sizeof(ww) );
3102  
3103    if( strlen(string) < 4 )
3104       return FALSE;
3105  
3106    if( strncmp(string, "-X",2 ) != 0 )
3107       return FALSE;
3108  
3109    if( !(nisdigit(string+(strlen(string)-1), 1)) )
3110       return FALSE;
3111    else {
3112       temp = string + 2;
3113       strncpy( ww, temp, (strlen(string)-2) );
3114  
3115       ndex = 0;
3116       temp = ww;
3117       numLoc = temp + (strlen(temp) - 1 );
3118  
3119       while( temp < numLoc && ndex < 6 ) {
3120          i = 0;
3121  
3122          IS_NOT_FOUND = TRUE;
3123  
3124          while( WxSymbols[i] != NULL && IS_NOT_FOUND ) {
3125             if( strncmp( WxSymbols[i], temp, strlen(WxSymbols[i]))
3126                  != 0 )
3127                i++;
3128             else
3129                IS_NOT_FOUND = FALSE;
3130          }
3131  
3132          if( WxSymbols[i] == NULL ) {
3133             (*NDEX)++;
3134             return FALSE;
3135          }
3136          else {
3137             strcpy(&(Mptr->SfcObscuration[ndex][0]),WxSymbols[i]);
3138             temp += strlen(WxSymbols[i]);
3139             ndex++;
3140          }
3141  
3142       }
3143  
3144       if( ndex > 0 ) {
3145          Mptr->Num8thsSkyObscured = antoi( numLoc,1 );
3146          (*NDEX)++;
3147          return TRUE;
3148       }
3149       else {
3150          (*NDEX)++;
3151          return FALSE;
3152       }
3153  
3154    }
3155  
3156 }
3157  
3158 static bool isCeiling( char *string, Decoded_METAR *Mptr, int *NDEX )
3159 {
3160  
3161    if( string == NULL )
3162       return FALSE;
3163  
3164    if( !(strncmp(string,"CIG",3) == 0 && strlen(string) >= 5) )
3165       return FALSE;
3166    else {
3167       if( strcmp(string, "CIGNO") == 0 ) {
3168          Mptr->CIGNO = TRUE;
3169          (*NDEX)++;
3170          return TRUE;
3171       }
3172       else if( strlen( string+3 ) == 3 ) {
3173          if( nisdigit(string+3, strlen(string+3)) &&
3174                     strlen(string+3) == 3 ) {
3175             Mptr->Ceiling = atoi(string+3) * 100;
3176             (*NDEX)++;
3177             return TRUE;
3178          }
3179          else
3180             return FALSE;
3181       }
3182       else if( strlen(string+3) == 4 ) {
3183          if( *(string+3) == 'E' && nisdigit(string+4,3) ) {
3184             Mptr->Estimated_Ceiling = antoi(string+4,3) * 100;
3185             (*NDEX)++;
3186             return TRUE;
3187          }
3188          else
3189             return FALSE;
3190       }
3191       else
3192          return FALSE;
3193  
3194    }
3195  
3196 }
3197 static bool isVrbSky( char **string, Decoded_METAR *Mptr, int *NDEX )
3198 {
3199    static char *cldPtr[] = {"FEW", "SCT", "BKN", "OVC", NULL };
3200    bool IS_NOT_FOUND;
3201    int i;
3202    char SKY1[ SKY1_len ];
3203  
3204  
3205    if( *string == NULL )
3206       return FALSE;
3207  
3208  
3209    memset( SKY1, '\0', SKY1_len );
3210    i = 0;
3211    IS_NOT_FOUND = TRUE;
3212  
3213    while( cldPtr[i] != NULL && IS_NOT_FOUND ) {
3214 #ifdef DEBUGQQ
3215    printf("isVrbSky: *string = %s cldPtr[%d] = %s\n",
3216                             *string,i,cldPtr[i]);
3217 #endif
3218       if( strncmp(*string, cldPtr[i], strlen(cldPtr[i])) != 0 )
3219          i++;
3220       else
3221          IS_NOT_FOUND = FALSE;
3222    }
3223  
3224    if( cldPtr[i] == NULL )
3225       return FALSE;
3226    else {
3227 #ifdef DEBUGQQ
3228    printf("isVrbSky: *string = %s = cldPtr[%d] = %s\n",
3229                             *string,i,cldPtr[i]);
3230 #endif
3231       strcpy( SKY1, cldPtr[i] );
3232  
3233       (++string);
3234  
3235       if( *string == NULL )
3236          return FALSE;
3237  
3238  
3239       if( strcmp(*string, "V") != 0 )
3240          return FALSE;
3241       else {
3242          (++string);
3243  
3244          if( *string == NULL )
3245             return FALSE;
3246  
3247          i = 0;
3248          IS_NOT_FOUND = TRUE;
3249          while( cldPtr[i] != NULL && IS_NOT_FOUND ) {
3250 #ifdef DEBUGQQ
3251    printf("isVrbSky: *string = %s cldPtr[%d] = %s\n",
3252                             *string,i,cldPtr[i]);
3253 #endif
3254             if( strncmp(*string, cldPtr[i], strlen(cldPtr[i])) != 0 )
3255                i++;
3256             else
3257                IS_NOT_FOUND = FALSE;
3258          }
3259  
3260          if( cldPtr[i] == NULL ) {
3261             (*NDEX)++;
3262             (*NDEX)++;
3263             return FALSE;
3264          }
3265          else {
3266             if(strlen(SKY1) == 6 ) {
3267                if( nisdigit(SKY1+3,3)) {
3268                   strncpy(Mptr->VrbSkyBelow,SKY1,3);
3269                   strcpy(Mptr->VrbSkyAbove,cldPtr[i]);
3270                   Mptr->VrbSkyLayerHgt = antoi(SKY1+3,3)*100;
3271                   (*NDEX)++;
3272                   (*NDEX)++;
3273                   (*NDEX)++;
3274                   return TRUE;
3275                }
3276                else {
3277                   (*NDEX)++;
3278                   (*NDEX)++;
3279                   (*NDEX)++;
3280                   return TRUE;
3281                }
3282             }
3283             else {
3284                strcpy(Mptr->VrbSkyBelow,SKY1);
3285                strcpy(Mptr->VrbSkyAbove,cldPtr[i]);
3286                (*NDEX)++;
3287                (*NDEX)++;
3288                (*NDEX)++;
3289                return TRUE;
3290             }
3291  
3292          }
3293  
3294       }
3295  
3296    }
3297  
3298 }
3299  
3300 static bool isObscurAloft( char **string, Decoded_METAR *Mptr,
3301                            int *NDEX )
3302 {
3303  
3304    /***************************/
3305    /* DECLARE LOCAL VARIABLES */
3306    /***************************/
3307  
3308    static char *WxSymbols[] = {"BCFG", "BLDU", "BLSA", "BLPY",
3309           "DRDU", "DRSA", "DRSN", "DZ", "DS", "FZFG", "FZDZ", "FZRA",
3310           "FG", "FC", "FU", "GS", "GR", "HZ", "IC", "MIFG",
3311           "PE", "PO", "RA", "SHRA", "SHSN", "SHPE", "SHGS",
3312           "SHGR", "SN", "SG", "SQ", "SA", "SS", "TSRA",
3313           "TSSN", "TSPE", "TSGS", "TSGR", "TS",
3314           "VCSH", "VCPO", "VCBLDU", "VCBLSA", "VCBLSN",
3315           "VCFG", "VCFC","VA", NULL};
3316    int i;
3317    char *saveTemp,
3318         *temp;
3319  
3320    bool IS_NOT_FOUND;
3321  
3322    /*************************/
3323    /* START BODY OF ROUTINE */
3324    /*************************/
3325  
3326    if( *string == NULL )
3327       return FALSE;
3328  
3329    saveTemp = temp = *string;
3330  
3331    if( *temp == '\0' )
3332       return FALSE;
3333  
3334    while( *temp != '\0' ) {
3335       i = 0;
3336  
3337       IS_NOT_FOUND = TRUE;
3338  
3339       while( WxSymbols[i] != NULL && IS_NOT_FOUND ) {
3340          if( strncmp(temp,WxSymbols[i],strlen(WxSymbols[i])) != 0 )
3341             i++;
3342          else
3343             IS_NOT_FOUND = FALSE;
3344       }
3345  
3346       if( WxSymbols[i] == NULL ) {
3347          return FALSE;
3348       }
3349       else
3350          temp += strlen(WxSymbols[i]);
3351    }
3352  
3353    (++string);
3354  
3355    if( *string == NULL )
3356       return FALSE;
3357  
3358    if( strlen(*string) != 6 )
3359       return FALSE;
3360    else {
3361       if((strncmp(*string,"FEW",3) == 0 ||
3362           strncmp(*string,"SCT",3) == 0 ||
3363           strncmp(*string,"BKN",3) == 0 ||
3364           strncmp(*string,"OVC",3) == 0  ) &&
3365                  (nisdigit(*string+3,3) &&
3366                   strcmp(*string+3,"000") != 0  )) {
3367          strcpy(Mptr->ObscurAloft,saveTemp);
3368          strncpy(Mptr->ObscurAloftSkyCond, *string,3);
3369          Mptr->ObscurAloftHgt = atoi(*string+3)*100;
3370          (*NDEX)++;
3371          (*NDEX)++;
3372          (*NDEX)++;
3373          return TRUE;
3374       }
3375       else {
3376          (*NDEX)++;
3377          return TRUE;
3378       }
3379  
3380    }
3381  
3382 }
3383 static bool isNOSPECI( char *string, Decoded_METAR *Mptr, int *NDEX )
3384 {
3385  
3386    if( string == NULL )
3387       return FALSE;
3388  
3389    if( strcmp(string,"NOSPECI") != 0 )
3390       return FALSE;
3391    else {
3392       Mptr->NOSPECI = TRUE;
3393       (*NDEX)++;
3394       return TRUE;
3395    }
3396 }
3397 static bool isLAST( char *string, Decoded_METAR *Mptr, int *NDEX )
3398 {
3399  
3400    if( string == NULL )
3401       return FALSE;
3402  
3403    if( strcmp(string,"LAST") != 0 )
3404       return FALSE;
3405    else {
3406       Mptr->LAST = TRUE;
3407       (*NDEX)++;
3408       return TRUE;
3409    }
3410 }
3411 /********************************************************************/
3412 /*                                                                  */
3413 /*  Title:         isSynopClouds                                    */
3414 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3415 /*  Date:          15 Sep 1994                                      */
3416 /*  Programmer:    CARL MCCALLA                                     */
3417 /*  Language:      C/370                                            */
3418 /*                                                                  */
3419 /*  Abstract:                                                       */
3420 /*                                                                  */
3421 /*  External Functions Called:                                      */
3422 /*                 None.                                            */
3423 /*                                                                  */
3424 /*  Input:         x                                                */
3425 /*                                                                  */
3426 /*  Output:        x                                                */
3427 /*                                                                  */
3428 /*  Modification History:                                           */
3429 /*                 None.                                            */
3430 /*                                                                  */
3431 /********************************************************************/
3432 static bool isSynopClouds( char *token, Decoded_METAR *Mptr,
3433                            int *NDEX )
3434 {
3435  
3436  
3437    if( token == NULL )
3438       return FALSE;
3439  
3440    if(strlen(token) != 5)
3441       return FALSE;
3442  
3443    if( *token == '8' &&
3444        *(token+1) == '/'  &&
3445        ((*(token+2) <= '9' && *(token+2) >= '0') || *(token+2) == '/')
3446                           &&
3447        ((*(token+3) <= '9' && *(token+3) >= '0') || *(token+3) == '/')
3448                           &&
3449        ((*(token+4) <= '9' && *(token+4) >= '0') || *(token+4) == '/'))
3450    {
3451       strcpy(Mptr->synoptic_cloud_type,token);
3452  
3453       Mptr->CloudLow    = *(token+2);
3454       Mptr->CloudMedium = *(token+3);
3455       Mptr->CloudHigh   = *(token+4);
3456  
3457       (*NDEX)++;
3458       return TRUE;
3459    }
3460    else
3461       return FALSE;
3462 }
3463  
3464 static bool isSNINCR( char **string, Decoded_METAR *Mptr, int *NDEX )
3465 {
3466  
3467    char *slash;
3468  
3469    if( *string == NULL )
3470       return FALSE;
3471  
3472    if( strcmp( *string, "SNINCR") != 0 )
3473       return FALSE;
3474    else {
3475       (++string);
3476  
3477       if( *string == NULL )
3478          return FALSE;
3479  
3480  
3481       if( (slash = strchr(*string,'/')) == NULL ) {
3482          (*NDEX)++;
3483          return FALSE;
3484       }
3485       else if( nisdigit (*string,(slash-*string)) &&
3486                  nisdigit(slash+1,strlen(slash+1)) ) {
3487          Mptr->SNINCR = antoi(*string,(slash-*string));
3488          Mptr->SNINCR_TotalDepth = antoi(slash+1,strlen(slash+1));
3489          (*NDEX)++;
3490          (*NDEX)++;
3491          return TRUE;
3492       }
3493       else {
3494          (*NDEX)++;
3495          return FALSE;
3496       }
3497  
3498    }
3499  
3500 }
3501  
3502 /********************************************************************/
3503 /*                                                                  */
3504 /*  Title:         isSnowDepth                                      */
3505 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3506 /*  Date:          15 Sep 1994                                      */
3507 /*  Programmer:    CARL MCCALLA                                     */
3508 /*  Language:      C/370                                            */
3509 /*                                                                  */
3510 /*  Abstract:                                                       */
3511 /*                                                                  */
3512 /*  External Functions Called:                                      */
3513 /*                 None.                                            */
3514 /*                                                                  */
3515 /*  Input:         x                                                */
3516 /*                                                                  */
3517 /*  Output:        x                                                */
3518 /*                                                                  */
3519 /*  Modification History:                                           */
3520 /*                 None.                                            */
3521 /*                                                                  */
3522 /********************************************************************/
3523 static bool isSnowDepth( char *token, Decoded_METAR *Mptr,
3524                          int *NDEX )
3525 {
3526  
3527    if( token == NULL )
3528       return FALSE;
3529  
3530    if(strlen(token) != 5)
3531       return FALSE;
3532  
3533    if( *token == '4' &&
3534        *(token+1) == '/'  &&
3535        nisdigit( (token+2),3) )
3536    {
3537       strcpy(Mptr->snow_depth_group,token);
3538       Mptr->snow_depth = antoi(token+2,3);
3539       (*NDEX)++;
3540       return TRUE;
3541    }
3542    else
3543       return FALSE;
3544 }
3545  
3546 static bool isWaterEquivSnow( char *string,
3547                                Decoded_METAR *Mptr,
3548                                int *NDEX )
3549 {
3550  
3551    if( string == NULL )
3552       return FALSE;
3553  
3554    if( strlen(string) != 6 )
3555       return FALSE;
3556    else if( !(nisdigit(string,6)) )
3557       return FALSE;
3558    else if( strncmp(string, "933", 3) != 0 )
3559       return FALSE;
3560    else {
3561       Mptr->WaterEquivSnow = ((float) atoi(string+3))/10.;
3562       (*NDEX)++;
3563       return TRUE;
3564    }
3565  
3566 }
3567 static bool isSunshineDur( char *string, Decoded_METAR *Mptr,
3568                            int *NDEX )
3569 {
3570  
3571    if( string == NULL )
3572       return FALSE;
3573  
3574    if( strlen(string) != 5 )
3575       return FALSE;
3576    else if( strncmp(string, "98", 2) != 0 )
3577       return FALSE;
3578    else if(nisdigit(string+2,3)) {
3579       Mptr->SunshineDur = atoi(string+2);
3580       (*NDEX)++;
3581       return TRUE;
3582    }
3583    else if( strncmp(string+2, "///", 3) == 0 ) {
3584       Mptr->SunSensorOut = TRUE;
3585       (*NDEX)++;
3586       return TRUE;
3587    }
3588    else
3589       return FALSE;
3590 }
3591  
3592 /********************************************************************/
3593 /*                                                                  */
3594 /*  Title:         isHourlyPrecip                                   */
3595 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3596 /*  Date:          20 Nov 1994                                      */
3597 /*  Programmer:    CARL MCCALLA                                     */
3598 /*  Language:      C/370                                            */
3599 /*                                                                  */
3600 /*  Abstract:      x                                                */
3601 /*                 x                                                */
3602 /*                 x                                                */
3603 /*                 x                                                */
3604 /*                 x                                                */
3605 /*                 x                                                */
3606 /*                 x                                                */
3607 /*                 x                                                */
3608 /*                 x                                                */
3609 /*                 x                                                */
3610 /*                                                                  */
3611 /*  External Functions Called:                                      */
3612 /*                 None.                                            */
3613 /*                 x                                                */
3614 /*                 x                                                */
3615 /*                 x                                                */
3616 /*                 x                                                */
3617 /*                 x                                                */
3618 /*                 x                                                */
3619 /*                                                                  */
3620 /*  Input:         x                                                */
3621 /*                 x                                                */
3622 /*                 x                                                */
3623 /*                 x                                                */
3624 /*                 x                                                */
3625 /*                 x                                                */
3626 /*                 x                                                */
3627 /*                                                                  */
3628 /*  Output:        x                                                */
3629 /*                 x                                                */
3630 /*                 x                                                */
3631 /*                 x                                                */
3632 /*                 x                                                */
3633 /*                 x                                                */
3634 /*                 x                                                */
3635 /*                                                                  */
3636 /*  Modification History:                                           */
3637 /*                 None.                                            */
3638 /*                                                                  */
3639 /********************************************************************/
3640  
3641 static bool isHourlyPrecip( char **string, Decoded_METAR *Mptr,
3642                             int *NDEX)
3643 {
3644  
3645  
3646    if( *string == NULL )
3647       return FALSE;
3648  
3649    if( !(strcmp(*string, "P") == 0 || charcmp(*string, "'P'dddd") ||
3650                   charcmp(*string, "'P'ddd") ) )
3651       return FALSE;
3652    else if( strcmp(*string, "P") != 0 ) {
3653       if( nisdigit((*string+1), strlen(*string+1)) ) {
3654          Mptr->hourlyPrecip = ((float)
3655                                  atoi(*string+1)) * 0.01;
3656          (*NDEX)++;
3657          return TRUE;
3658       }
3659       else {
3660          (*NDEX)++;
3661          return FALSE;
3662       }
3663    }
3664    else {
3665  
3666       (++string);
3667  
3668       if( *string == NULL )
3669          return FALSE;
3670  
3671  
3672       if( nisdigit(*string,strlen(*string)) ) {
3673          Mptr->hourlyPrecip =  ((float)
3674                         atoi(*string)) * 0.01;
3675          (*NDEX)++;
3676          (*NDEX)++;
3677          return TRUE;
3678       }
3679       else {
3680          (*NDEX)++;
3681          return FALSE;
3682       }
3683    }
3684 }
3685  
3686 /********************************************************************/
3687 /*                                                                  */
3688 /*  Title:         isP6Precip                                       */
3689 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3690 /*  Date:          20 Nov 1994                                      */
3691 /*  Programmer:    CARL MCCALLA                                     */
3692 /*  Language:      C/370                                            */
3693 /*                                                                  */
3694 /*  Abstract:      x                                                */
3695 /*                 x                                                */
3696 /*                 x                                                */
3697 /*                 x                                                */
3698 /*                 x                                                */
3699 /*                 x                                                */
3700 /*                 x                                                */
3701 /*                 x                                                */
3702 /*                 x                                                */
3703 /*                 x                                                */
3704 /*                                                                  */
3705 /*  External Functions Called:                                      */
3706 /*                 None.                                            */
3707 /*                 x                                                */
3708 /*                 x                                                */
3709 /*                 x                                                */
3710 /*                 x                                                */
3711 /*                 x                                                */
3712 /*                 x                                                */
3713 /*                                                                  */
3714 /*  Input:         x                                                */
3715 /*                 x                                                */
3716 /*                 x                                                */
3717 /*                 x                                                */
3718 /*                 x                                                */
3719 /*                 x                                                */
3720 /*                 x                                                */
3721 /*                                                                  */
3722 /*  Output:        x                                                */
3723 /*                 x                                                */
3724 /*                 x                                                */
3725 /*                 x                                                */
3726 /*                 x                                                */
3727 /*                 x                                                */
3728 /*                 x                                                */
3729 /*                                                                  */
3730 /*  Modification History:                                           */
3731 /*                 None.                                            */
3732 /*                                                                  */
3733 /********************************************************************/
3734  
3735 static bool isP6Precip( char *string, Decoded_METAR *Mptr,
3736                         int *NDEX )
3737 {
3738  
3739    if( string == NULL )
3740       return FALSE;
3741  
3742    if( *string == '6' && (nisdigit(string+1,4) ||
3743                           strcmp(string+1,"////") == 0) ) {
3744       if( strcmp(string+1, "////") == 0 ) {
3745          Mptr->precip_amt = (float) MAXINT;
3746          Mptr->Indeterminant3_6HrPrecip = TRUE;
3747          (*NDEX)++;
3748          return TRUE;
3749       }
3750       else {
3751          Mptr->precip_amt = ((float) atoi(string+1)) / 100;
3752          (*NDEX)++;
3753          return TRUE;
3754       }
3755    }
3756    else
3757       return FALSE;
3758  
3759 }
3760  
3761 /********************************************************************/
3762 /*                                                                  */
3763 /*  Title:         isP24Precip                                      */
3764 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3765 /*  Date:          20 Nov 1994                                      */
3766 /*  Programmer:    CARL MCCALLA                                     */
3767 /*  Language:      C/370                                            */
3768 /*                                                                  */
3769 /*  Abstract:      x                                                */
3770 /*                 x                                                */
3771 /*                 x                                                */
3772 /*                 x                                                */
3773 /*                 x                                                */
3774 /*                 x                                                */
3775 /*                 x                                                */
3776 /*                 x                                                */
3777 /*                 x                                                */
3778 /*                 x                                                */
3779 /*                                                                  */
3780 /*  External Functions Called:                                      */
3781 /*                 None.                                            */
3782 /*                 x                                                */
3783 /*                 x                                                */
3784 /*                 x                                                */
3785 /*                 x                                                */
3786 /*                 x                                                */
3787 /*                 x                                                */
3788 /*                                                                  */
3789 /*  Input:         x                                                */
3790 /*                 x                                                */
3791 /*                 x                                                */
3792 /*                 x                                                */
3793 /*                 x                                                */
3794 /*                 x                                                */
3795 /*                 x                                                */
3796 /*                                                                  */
3797 /*  Output:        x                                                */
3798 /*                 x                                                */
3799 /*                 x                                                */
3800 /*                 x                                                */
3801 /*                 x                                                */
3802 /*                 x                                                */
3803 /*                 x                                                */
3804 /*                                                                  */
3805 /*  Modification History:                                           */
3806 /*                 None.                                            */
3807 /*                                                                  */
3808 /********************************************************************/
3809  
3810 static bool isP24Precip( char *string, Decoded_METAR *Mptr,
3811                         int *NDEX )
3812 {
3813  
3814    if( string == NULL )
3815       return FALSE;
3816  
3817    if( *string == '7' && (nisdigit(string+1,4) ||
3818                           strcmp(string+1,"////") == 0) ) {
3819       if( strcmp(string+1, "////") == 0 ) {
3820          Mptr->precip_24_amt = (float) MAXINT;
3821          (*NDEX)++;
3822          return TRUE;
3823       }
3824       else {
3825          Mptr->precip_24_amt = ((float) atoi(string+1)) / 100.;
3826          (*NDEX)++;
3827          return TRUE;
3828       }
3829    }
3830    else
3831       return FALSE;
3832  
3833 }
3834 /********************************************************************/
3835 /*                                                                  */
3836 /*  Title:         isTTdTenths                                      */
3837 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3838 /*  Date:          16 Nov 1994                                      */
3839 /*  Programmer:    CARL MCCALLA                                     */
3840 /*  Language:      C/370                                            */
3841 /*                                                                  */
3842 /*  Abstract:      x                                                */
3843 /*                 x                                                */
3844 /*                 x                                                */
3845 /*                 x                                                */
3846 /*                 x                                                */
3847 /*                 x                                                */
3848 /*                 x                                                */
3849 /*                 x                                                */
3850 /*                 x                                                */
3851 /*                 x                                                */
3852 /*                                                                  */
3853 /*  External Functions Called:                                      */
3854 /*                 None.                                            */
3855 /*                 x                                                */
3856 /*                 x                                                */
3857 /*                 x                                                */
3858 /*                 x                                                */
3859 /*                 x                                                */
3860 /*                 x                                                */
3861 /*                                                                  */
3862 /*  Input:         x                                                */
3863 /*                 x                                                */
3864 /*                 x                                                */
3865 /*                 x                                                */
3866 /*                 x                                                */
3867 /*                 x                                                */
3868 /*                 x                                                */
3869 /*                                                                  */
3870 /*  Output:        x                                                */
3871 /*                 x                                                */
3872 /*                 x                                                */
3873 /*                 x                                                */
3874 /*                 x                                                */
3875 /*                 x                                                */
3876 /*                 x                                                */
3877 /*                                                                  */
3878 /*  Modification History:                                           */
3879 /*                 None.                                            */
3880 /*                                                                  */
3881 /********************************************************************/
3882  
3883 static bool isTTdTenths( char *token, Decoded_METAR *Mptr, int *NDEX)
3884 {
3885  
3886    /***************************/
3887    /* DECLARE LOCAL VARIABLES */
3888    /***************************/
3889  
3890    bool returnFlag = FALSE;
3891    float sign;
3892  
3893    if( token == NULL )
3894       return FALSE;
3895  
3896    if( *token != 'T' )
3897       return FALSE;
3898    else if( !(strlen(token) == 5 || strlen(token) == 9) )
3899       return FALSE;
3900    else
3901    {
3902       if( (*(token+1) == '0' || *(token+1) == '1') &&
3903                  nisdigit(token+2,3) )
3904       {
3905          if( *(token+1) == '0' )
3906             sign = 0.1;
3907          else
3908             sign = -0.1;
3909  
3910          Mptr->Temp_2_tenths = sign * ((float) antoi(token+2,3));
3911          returnFlag = TRUE;
3912       }
3913       else
3914         return FALSE;
3915  
3916       if( (*(token+5) == '0' || *(token+5) == '1') &&
3917                  nisdigit(token+6,3) )
3918       {
3919          if( *(token+5) == '0' )
3920             sign = 0.1;
3921          else
3922             sign = -0.1;
3923  
3924          Mptr->DP_Temp_2_tenths = sign * ((float) atoi(token+6));
3925          (*NDEX)++;
3926          return TRUE;
3927  
3928       }
3929       else
3930       {
3931          if( returnFlag )
3932          {
3933             (*NDEX)++;
3934             return TRUE;
3935          }
3936          else
3937             return FALSE;
3938       }
3939    }
3940 }
3941  
3942 /********************************************************************/
3943 /*                                                                  */
3944 /*  Title:         isMaxTemp                                        */
3945 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
3946 /*  Date:          15 Sep 1994                                      */
3947 /*  Programmer:    CARL MCCALLA                                     */
3948 /*  Language:      C/370                                            */
3949 /*                                                                  */
3950 /*  Abstract:                                                       */
3951 /*                                                                  */
3952 /*  External Functions Called:                                      */
3953 /*                 None.                                            */
3954 /*                                                                  */
3955 /*  Input:         x                                                */
3956 /*                                                                  */
3957 /*  Output:        x                                                */
3958 /*                                                                  */
3959 /*  Modification History:                                           */
3960 /*                 None.                                            */
3961 /*                                                                  */
3962 /********************************************************************/
3963 static bool isMaxTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
3964 {
3965    char buf[ 6 ];
3966  
3967    if( string == NULL )
3968       return FALSE;
3969  
3970    if(strlen(string) != 5 )
3971       return FALSE;
3972    else if(*string == '1' && (*(string+1) == '0' ||
3973                               *(string+1) == '1' ||
3974                               *(string+1) == '/'   ) &&
3975           (nisdigit((string+2),3) ||
3976             strncmp(string+2,"///",3) == 0) )
3977    {
3978       if(nisdigit(string+2,3))
3979       {
3980          memset(buf,'\0',6);
3981          strncpy(buf,string+2,3);
3982          Mptr->maxtemp = ( (float) atoi(buf))/10.;
3983  
3984          if( *(string+1) == '1' )
3985             Mptr->maxtemp *= (-1.0);
3986  
3987          (*NDEX)++;
3988          return TRUE;
3989       }
3990       else
3991       {
3992          Mptr->maxtemp = (float) MAXINT;
3993          (*NDEX)++;
3994          return TRUE;
3995       }
3996    }
3997    else
3998       return FALSE;
3999  
4000 }
4001  
4002 /********************************************************************/
4003 /*                                                                  */
4004 /*  Title:         isMinTemp                                        */
4005 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4006 /*  Date:          15 Sep 1994                                      */
4007 /*  Programmer:    CARL MCCALLA                                     */
4008 /*  Language:      C/370                                            */
4009 /*                                                                  */
4010 /*  Abstract:                                                       */
4011 /*                                                                  */
4012 /*  External Functions Called:                                      */
4013 /*                 None.                                            */
4014 /*                                                                  */
4015 /*  Input:         x                                                */
4016 /*                                                                  */
4017 /*  Output:        x                                                */
4018 /*                                                                  */
4019 /*  Modification History:                                           */
4020 /*                 None.                                            */
4021 /*                                                                  */
4022 /********************************************************************/
4023 static bool isMinTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
4024 {
4025    char buf[ 6 ];
4026  
4027    if( string == NULL )
4028       return FALSE;
4029  
4030    if(strlen(string) != 5 )
4031       return FALSE;
4032    else if(*string == '2' && (*(string+1) == '0' ||
4033                               *(string+1) == '1' ||
4034                               *(string+1) == '/'   ) &&
4035           (nisdigit((string+2),3) ||
4036               strncmp(string+2,"///",3) == 0) )
4037    {
4038       if(nisdigit(string+2,3))
4039       {
4040          memset(buf,'\0',6);
4041          strncpy(buf,string+2,3);
4042          Mptr->mintemp = ( (float) atoi(buf) )/10.;
4043  
4044          if( *(string+1) == '1' )
4045             Mptr->mintemp *= (-1.0);
4046          (*NDEX)++;
4047          return TRUE;
4048       }
4049       else
4050       {
4051          Mptr->mintemp = (float) MAXINT;
4052          (*NDEX)++;
4053          return TRUE;
4054       }
4055    }
4056    else
4057       return FALSE;
4058  
4059 }
4060  
4061 /********************************************************************/
4062 /*                                                                  */
4063 /*  Title:         isT24MaxMinTemp                                  */
4064 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4065 /*  Date:          15 Sep 1994                                      */
4066 /*  Programmer:    CARL MCCALLA                                     */
4067 /*  Language:      C/370                                            */
4068 /*                                                                  */
4069 /*  Abstract:                                                       */
4070 /*                                                                  */
4071 /*  External Functions Called:                                      */
4072 /*                 None.                                            */
4073 /*                                                                  */
4074 /*  Input:         x                                                */
4075 /*                                                                  */
4076 /*  Output:        x                                                */
4077 /*                                                                  */
4078 /*  Modification History:                                           */
4079 /*                 None.                                            */
4080 /*                                                                  */
4081 /********************************************************************/
4082 static bool isT24MaxMinTemp( char *string, Decoded_METAR *Mptr,
4083                              int *NDEX )
4084 {
4085    char buf[ 6 ];
4086  
4087    if( string == NULL )
4088       return FALSE;
4089  
4090    if( strlen(string) != 9 )
4091       return FALSE;
4092    else if( (*string == '4' && (*(string+1) == '0' ||
4093                                 *(string+1) == '1' ||
4094                                 *(string+1) == '/')     &&
4095              (nisdigit((string+2),3) || strncmp(string+2,"///",3)))
4096                               &&
4097              ((*(string+5) == '0' || *(string+5) == '1' ||
4098               *(string+5) == '/') &&
4099               (nisdigit((string+6),3) ||
4100                strncmp(string+6,"///",3) == 0 )) )
4101    {
4102       if(nisdigit(string+1,4) && (*(string+1) == '0' ||
4103                                   *(string+1) == '1')   )
4104       {
4105          memset(buf, '\0', 6);
4106          strncpy(buf, string+2, 3);
4107          Mptr->max24temp = ( (float) atoi( buf ) )/10.;
4108  
4109          if( *(string+1) == '1' )
4110             Mptr->max24temp *= -1.;
4111       }
4112       else
4113          Mptr->max24temp = (float) MAXINT;
4114  
4115  
4116       if(nisdigit(string+5,4) && (*(string+5) == '0' ||
4117                                   *(string+5) == '1' )  )
4118       {
4119          memset(buf, '\0', 6);
4120          strncpy(buf, string+6, 3);
4121          Mptr->min24temp = ( (float) atoi(buf) )/10.;
4122  
4123          if( *(string+5) == '1' )
4124             Mptr->min24temp *= -1.;
4125       }
4126       else
4127          Mptr->min24temp = (float) MAXINT;
4128  
4129       (*NDEX)++;
4130       return TRUE;
4131  
4132    }
4133    else
4134       return FALSE;
4135 }
4136  
4137 /********************************************************************/
4138 /*                                                                  */
4139 /*  Title:         isPtendency                                      */
4140 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4141 /*  Date:          15 Sep 1994                                      */
4142 /*  Programmer:    CARL MCCALLA                                     */
4143 /*  Language:      C/370                                            */
4144 /*                                                                  */
4145 /*  Abstract:                                                       */
4146 /*                                                                  */
4147 /*  External Functions Called:                                      */
4148 /*                 None.                                            */
4149 /*                                                                  */
4150 /*  Input:         x                                                */
4151 /*                                                                  */
4152 /*  Output:        x                                                */
4153 /*                                                                  */
4154 /*  Modification History:                                           */
4155 /*                 None.                                            */
4156 /*                                                                  */
4157 /********************************************************************/
4158  
4159 static bool isPtendency(char *string, Decoded_METAR *Mptr, int *NDEX)
4160 {
4161    char buf[ 6 ];
4162  
4163    if( string == NULL )
4164       return FALSE;
4165  
4166    if(strlen(string) != 5)
4167       return FALSE;
4168    else if(*string == '5' && ('0' <= *(string+1) <= '8') &&
4169              (nisdigit(string+2,3) || strncmp(string+2,"///",3)
4170                                              == 0) )
4171    {
4172       if( !(nisdigit(string+2,3)) )
4173       {
4174          memset(buf,'\0',6);
4175          strncpy(buf,(string+1),1);
4176          Mptr->char_prestndcy = atoi(buf);
4177          (*NDEX)++;
4178          return TRUE;
4179       }
4180       else
4181       {
4182          memset(buf,'\0',6);
4183          strncpy(buf,(string+1),1);
4184          Mptr->char_prestndcy = atoi(buf);
4185  
4186          Mptr->prestndcy = ((float) atoi(string+2)) * 0.1;
4187  
4188          (*NDEX)++;
4189          return TRUE;
4190       }
4191  
4192    }
4193    else
4194       return FALSE;
4195  
4196 }
4197  
4198 /********************************************************************/
4199 /*                                                                  */
4200 /*  Title:         isPWINO                                          */
4201 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4202 /*  Date:          20 Nov 1994                                      */
4203 /*  Programmer:    CARL MCCALLA                                     */
4204 /*  Language:      C/370                                            */
4205 /*                                                                  */
4206 /*  Abstract:      x                                                */
4207 /*                                                                  */
4208 /*  External Functions Called:                                      */
4209 /*                 None.                                            */
4210 /*                                                                  */
4211 /*  Input:         x                                                */
4212 /*                                                                  */
4213 /*  Output:        x                                                */
4214 /*                                                                  */
4215 /*  Modification History:                                           */
4216 /*                 None.                                            */
4217 /*                                                                  */
4218 /********************************************************************/
4219  
4220 static bool isPWINO( char *string, Decoded_METAR *Mptr, int *NDEX)
4221 {
4222  
4223    if( string == NULL )
4224       return FALSE;
4225  
4226  
4227    if( strcmp(string, "PWINO") != 0 )
4228       return FALSE;
4229    else {
4230       Mptr->PWINO = TRUE;
4231       (*NDEX)++;
4232       return TRUE;
4233    }
4234  
4235 }
4236  
4237 /********************************************************************/
4238 /*                                                                  */
4239 /*  Title:         isPNO                                            */
4240 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4241 /*  Date:          20 Nov 1994                                      */
4242 /*  Programmer:    CARL MCCALLA                                     */
4243 /*  Language:      C/370                                            */
4244 /*                                                                  */
4245 /*  Abstract:      x                                                */
4246 /*                                                                  */
4247 /*  External Functions Called:                                      */
4248 /*                 None.                                            */
4249 /*                                                                  */
4250 /*  Input:         x                                                */
4251 /*                                                                  */
4252 /*  Output:        x                                                */
4253 /*                                                                  */
4254 /*  Modification History:                                           */
4255 /*                 None.                                            */
4256 /*                                                                  */
4257 /********************************************************************/
4258  
4259 static bool isPNO( char *string, Decoded_METAR *Mptr, int *NDEX)
4260 {
4261  
4262  
4263    if( string == NULL )
4264       return FALSE;
4265  
4266    if( strcmp(string, "PNO") != 0 )
4267       return FALSE;
4268    else {
4269       Mptr->PNO = TRUE;
4270       (*NDEX)++;
4271       return TRUE;
4272    }
4273  
4274 }
4275  
4276 /********************************************************************/
4277 /*                                                                  */
4278 /*  Title:         isRVRNO                                          */
4279 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4280 /*  Date:          20 Nov 1994                                      */
4281 /*  Programmer:    CARL MCCALLA                                     */
4282 /*  Language:      C/370                                            */
4283 /*                                                                  */
4284 /*  Abstract:      x                                                */
4285 /*                                                                  */
4286 /*  External Functions Called:                                      */
4287 /*                 None.                                            */
4288 /*                                                                  */
4289 /*  Input:         x                                                */
4290 /*                                                                  */
4291 /*  Output:        x                                                */
4292 /*                                                                  */
4293 /*  Modification History:                                           */
4294 /*                 None.                                            */
4295 /*                                                                  */
4296 /********************************************************************/
4297  
4298 static bool isRVRNO( char *string, Decoded_METAR *Mptr, int *NDEX)
4299 {
4300  
4301    if( string == NULL )
4302       return FALSE;
4303  
4304    if( strcmp(string, "RVRNO") != 0 )
4305       return FALSE;
4306    else {
4307       Mptr->RVRNO = TRUE;
4308       (*NDEX)++;
4309       return TRUE;
4310    }
4311  
4312 }
4313  
4314 /********************************************************************/
4315 /*                                                                  */
4316 /*  Title:         isCHINO                                          */
4317 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4318 /*  Date:          20 Nov 1994                                      */
4319 /*  Programmer:    CARL MCCALLA                                     */
4320 /*  Language:      C/370                                            */
4321 /*                                                                  */
4322 /*  Abstract:      x                                                */
4323 /*                                                                  */
4324 /*  External Functions Called:                                      */
4325 /*                 None.                                            */
4326 /*                                                                  */
4327 /*  Input:         x                                                */
4328 /*                                                                  */
4329 /*  Output:        x                                                */
4330 /*                                                                  */
4331 /*  Modification History:                                           */
4332 /*                 None.                                            */
4333 /*                                                                  */
4334 /********************************************************************/
4335  
4336 static bool isCHINO( char **string, Decoded_METAR *Mptr, int *NDEX)
4337 {
4338  
4339  
4340    if( *string == NULL )
4341       return FALSE;
4342  
4343    if( strcmp(*string, "CHINO") != 0 )
4344       return FALSE;
4345    else
4346       string++;
4347  
4348    if( *string == NULL )
4349       return FALSE;
4350  
4351    if( strlen(*string) <= 2 ) {
4352       (*NDEX)++;
4353       return FALSE;
4354    }
4355    else {
4356       if( strncmp( *string, "RY", 2 ) == 0 &&
4357             nisdigit(*string+2,strlen(*string+2)) ) {
4358          Mptr->CHINO = TRUE;
4359          strcpy(Mptr->CHINO_LOC, *string);
4360          (*NDEX)++;
4361          (*NDEX)++;
4362          return TRUE;
4363       }
4364       else {
4365          (*NDEX)++;
4366          return FALSE;
4367       }
4368    }
4369  
4370 }
4371  
4372 /********************************************************************/
4373 /*                                                                  */
4374 /*  Title:         isVISNO                                          */
4375 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4376 /*  Date:          20 Nov 1994                                      */
4377 /*  Programmer:    CARL MCCALLA                                     */
4378 /*  Language:      C/370                                            */
4379 /*                                                                  */
4380 /*  Abstract:      x                                                */
4381 /*                                                                  */
4382 /*  External Functions Called:                                      */
4383 /*                 None.                                            */
4384 /*                                                                  */
4385 /*  Input:         x                                                */
4386 /*                                                                  */
4387 /*  Output:        x                                                */
4388 /*                                                                  */
4389 /*  Modification History:                                           */
4390 /*                 None.                                            */
4391 /*                                                                  */
4392 /********************************************************************/
4393  
4394 static bool isVISNO( char **string, Decoded_METAR *Mptr, int *NDEX)
4395 {
4396  
4397    if( *string == NULL )
4398       return FALSE;
4399  
4400    if( strcmp(*string, "VISNO") != 0 )
4401       return FALSE;
4402    else
4403       string++;
4404  
4405    if( *string == NULL )
4406       return FALSE;
4407  
4408    if( strlen(*string) <= 2 ) {
4409       (*NDEX)++;
4410       return FALSE;
4411    }
4412    else {
4413       if( strncmp( *string, "RY", 2 ) == 0 &&
4414             nisdigit(*string+2,strlen(*string+2))) {
4415          Mptr->VISNO = TRUE;
4416          strcpy(Mptr->VISNO_LOC, *string);
4417          (*NDEX)++;
4418          (*NDEX)++;
4419          return TRUE;
4420       }
4421       else {
4422          (*NDEX)++;
4423          return FALSE;
4424       }
4425    }
4426  
4427 }
4428  
4429 /********************************************************************/
4430 /*                                                                  */
4431 /*  Title:         isFZRANO                                         */
4432 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4433 /*  Date:          20 Nov 1994                                      */
4434 /*  Programmer:    CARL MCCALLA                                     */
4435 /*  Language:      C/370                                            */
4436 /*                                                                  */
4437 /*  Abstract:      x                                                */
4438 /*                                                                  */
4439 /*  External Functions Called:                                      */
4440 /*                 None.                                            */
4441 /*                                                                  */
4442 /*  Input:         x                                                */
4443 /*                                                                  */
4444 /*  Output:        x                                                */
4445 /*                                                                  */
4446 /*  Modification History:                                           */
4447 /*                 None.                                            */
4448 /*                                                                  */
4449 /********************************************************************/
4450  
4451 static bool isFZRANO( char *string, Decoded_METAR *Mptr, int *NDEX)
4452 {
4453  
4454  
4455    if( string == NULL )
4456       return FALSE;
4457  
4458    if( strcmp(string, "FZRANO") != 0 )
4459       return FALSE;
4460    else {
4461       Mptr->FZRANO = TRUE;
4462       (*NDEX)++;
4463       return TRUE;
4464    }
4465  
4466 }
4467  
4468 /********************************************************************/
4469 /*                                                                  */
4470 /*  Title:         isTSNO                                            */
4471 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4472 /*  Date:          20 Nov 1994                                      */
4473 /*  Programmer:    CARL MCCALLA                                     */
4474 /*  Language:      C/370                                            */
4475 /*                                                                  */
4476 /*  Abstract:      x                                                */
4477 /*                 x                                                */
4478 /*                 x                                                */
4479 /*                 x                                                */
4480 /*                 x                                                */
4481 /*                 x                                                */
4482 /*                 x                                                */
4483 /*                 x                                                */
4484 /*                 x                                                */
4485 /*                 x                                                */
4486 /*                                                                  */
4487 /*  External Functions Called:                                      */
4488 /*                 None.                                            */
4489 /*                 x                                                */
4490 /*                 x                                                */
4491 /*                 x                                                */
4492 /*                 x                                                */
4493 /*                 x                                                */
4494 /*                 x                                                */
4495 /*                                                                  */
4496 /*  Input:         x                                                */
4497 /*                 x                                                */
4498 /*                 x                                                */
4499 /*                 x                                                */
4500 /*                 x                                                */
4501 /*                 x                                                */
4502 /*                 x                                                */
4503 /*                                                                  */
4504 /*  Output:        x                                                */
4505 /*                 x                                                */
4506 /*                 x                                                */
4507 /*                 x                                                */
4508 /*                 x                                                */
4509 /*                 x                                                */
4510 /*                 x                                                */
4511 /*                                                                  */
4512 /*  Modification History:                                           */
4513 /*                 None.                                            */
4514 /*                                                                  */
4515 /********************************************************************/
4516  
4517 static bool isTSNO( char *string, Decoded_METAR *Mptr, int *NDEX)
4518 {
4519  
4520    if( string == NULL )
4521       return FALSE;
4522  
4523    if( strcmp(string, "TSNO") != 0 )
4524       return FALSE;
4525    else {
4526       Mptr->TSNO = TRUE;
4527       (*NDEX)++;
4528       return TRUE;
4529    }
4530  
4531 }
4532  
4533 /********************************************************************/
4534 /*                                                                  */
4535 /*  Title:         isDollarSign                                 */
4536 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4537 /*  Date:          15 Sep 1994                                      */
4538 /*  Programmer:    CARL MCCALLA                                     */
4539 /*  Language:      C/370                                            */
4540 /*                                                                  */
4541 /*  Abstract:                                                       */
4542 /*                                                                  */
4543 /*  External Functions Called:                                      */
4544 /*                 None.                                            */
4545 /*                                                                  */
4546 /*  Input:         x                                                */
4547 /*                                                                  */
4548 /*  Output:        x                                                */
4549 /*                                                                  */
4550 /*  Modification History:                                           */
4551 /*                 None.                                            */
4552 /*                                                                  */
4553 /********************************************************************/
4554  
4555 static bool isDollarSign( char *indicator, Decoded_METAR *Mptr,
4556                               int *NDEX )
4557 {
4558  
4559    if( indicator == NULL )
4560       return FALSE;
4561  
4562    if( strcmp(indicator,"$") != 0 )
4563       return FALSE;
4564    else
4565    {
4566       (*NDEX)++;
4567       Mptr->DollarSign = TRUE;
4568       return TRUE;
4569    }
4570 }
4571  
4572 /********************************************************************/
4573 /*                                                                  */
4574 /*  Title:         DcdMTRmk                                         */
4575 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
4576 /*  Date:          15 Sep 1994                                      */
4577 /*  Programmer:    CARL MCCALLA                                     */
4578 /*  Language:      C/370                                            */
4579 /*                                                                  */
4580 /*  Abstract:      DcdMTRmk takes a pointer to a METAR              */
4581 /*                 report and parses/decodes data elements from     */
4582 /*                 the remarks section of the report.               */
4583 /*                                                                  */
4584 /*                                                                  */
4585 /*                                                                  */
4586 /*  External Functions Called:                                      */
4587 /*                 None.                                            */
4588 /*                                                                  */
4589 /*  Input:         token - the address of a pointer to a METAR      */
4590 /*                         report character string.                 */
4591 /*                 Mptr  - a pointer to a structure of the vari-    */
4592 /*                         able type Decoded_METAR.                 */
4593 /*                                                                  */
4594 /*                                                                  */
4595 /*  Output:        x                                                */
4596 /*                                                                  */
4597 /*  Modification History:                                           */
4598 /*                 None.                                            */
4599 /*                                                                  */
4600 /********************************************************************/
4601 void DcdMTRmk( char **token, Decoded_METAR *Mptr )
4602 {
4603  
4604    /***************************/
4605    /* DECLARE LOCAL VARIABLES */
4606    /***************************/
4607  
4608    int TornadicActvty = 0, A0indicator = 0,
4609        peakwind = 0, windshift = 0, towerVsby = 0, surfaceVsby = 0,
4610        variableVsby = 0, LTGfreq = 0,
4611        TS_LOC = 0,
4612        recentWX = 0, variableCIG = 0, PRESFR = 0,
4613        Vsby2ndSite = 0, CIG2ndSite = 0,
4614        PRESRR = 0, SLP = 0, PartObscur = 0,
4615        SectorVsby = 0, GR = 0, Virga = 0,
4616        SfcObscur = 0, Ceiling = 0, VrbSkyCond = 0, ObscurAloft = 0,
4617        NoSPECI = 0, Last = 0, SynopClouds = 0, Snincr = 0,
4618        SnowDepth = 0, WaterEquivSnow = 0, SunshineDur = 0,
4619        hourlyPrecip = 0, P6Precip = 0, P24Precip = 0,
4620        TTdTenths = 0, MaxTemp = 0, MinTemp = 0, T24MaxMinTemp = 0,
4621        Ptendency = 0, PWINO = 0,
4622        FZRANO = 0, TSNO = 0, maintIndicator = 0, CHINO = 0, RVRNO = 0,
4623        VISNO = 0, PNO = 0, DVR = 0;
4624  
4625    int  NDEX;
4626    // int ndex;
4627    int i;
4628    // char *slash;
4629    // char *tokenX;
4630    // char *V_char;
4631    // char *temp_token;
4632  
4633    // bool extra_token;
4634    bool IS_NOT_RMKS;
4635  
4636    // float T_vsby;
4637  
4638    /*************************/
4639    /* START BODY OF ROUTINE */
4640    /*************************/
4641  
4642    NDEX = 0;
4643  
4644    /*************************************************/
4645    /* LOCATE THE START OF THE METAR REMARKS SECTION */
4646    /*************************************************/
4647  
4648    IS_NOT_RMKS = TRUE;
4649  
4650    while( token[ NDEX ] != NULL && IS_NOT_RMKS) {
4651 #ifdef DEBUGZZ
4652    printf("DcdMTRmk:  token[%d] = %s\n",NDEX,token[NDEX]);
4653 #endif
4654       if( strcmp(token[ NDEX ], "RMK") != 0 )
4655          NDEX++;
4656       else
4657          IS_NOT_RMKS = FALSE;
4658    }
4659  
4660    /***********************************************/
4661    /* IF THE METAR REPORT CONTAINS NO REMARKS     */
4662    /* SECTION, THEN RETURN TO THE CALLING ROUTINE */
4663    /***********************************************/
4664  
4665    if( token[ NDEX ] != NULL ) {
4666 #ifdef DEBUGZZ
4667    printf("DcdMTRmk:  RMK found, token[%d] = %s\n",
4668                    NDEX,token[NDEX]);
4669 #endif
4670       NDEX++;
4671 #ifdef DEBUGZZ
4672    printf("DcdMTRmk:  Bump NDEX, token[%d] = %s\n",
4673                    NDEX,token[NDEX]);
4674 #endif
4675    }
4676    else {
4677 #ifdef DEBUGZZ
4678    printf("DcdMTRmk:  No RMK found.  NULL ptr encountered\n");
4679 #endif
4680       return;
4681    }
4682    /*****************************************/
4683    /* IDENTIFY AND VALIDATE REMARKS SECTION */
4684    /*   DATA GROUPS FOR PARSING/DECODING    */
4685    /*****************************************/
4686  
4687    while(token[NDEX] != NULL) {
4688  
4689 #ifdef DEBUGZZ
4690    printf("DcdMTRmk:  DECODE RMKS: token[%d] = %s\n",NDEX,token[NDEX]);
4691 #endif
4692  
4693  
4694       if( isTornadicActiv( &(token[NDEX]), Mptr, &NDEX ) ) {
4695          TornadicActvty++;
4696          if( TornadicActvty > 1 ) {
4697             memset(Mptr->TornadicType,'\0',15);
4698             memset(Mptr->TornadicLOC,'\0',10);
4699             memset(Mptr->TornadicDIR,'\0',4);
4700             Mptr->BTornadicHour = MAXINT;
4701             Mptr->BTornadicMinute = MAXINT;
4702             Mptr->ETornadicHour = MAXINT;
4703             Mptr->ETornadicMinute = MAXINT;
4704          }
4705       }
4706       else if( isA0indicator( token[NDEX], Mptr, &NDEX ) ) {
4707          A0indicator++;
4708          if( A0indicator > 1 )
4709             memset(Mptr->autoIndicator,'\0',5);
4710       }
4711       else if( isPeakWind( &(token[NDEX]), Mptr, &NDEX ) ) {
4712          peakwind++;
4713          if( peakwind > 1 ) {
4714             Mptr->PKWND_dir = MAXINT;
4715             Mptr->PKWND_speed = MAXINT;
4716             Mptr->PKWND_hour = MAXINT;
4717             Mptr->PKWND_minute = MAXINT;
4718          }
4719       }
4720       else if( isWindShift( &(token[NDEX]), Mptr, &NDEX ) ) {
4721          windshift++;
4722          if( windshift > 1 ) {
4723             Mptr->WshfTime_hour = MAXINT;
4724             Mptr->WshfTime_minute = MAXINT;
4725          }
4726       }
4727       else if( isTowerVsby( &(token[NDEX]), Mptr, &NDEX ) ) {
4728          towerVsby++;
4729          if( towerVsby > 1 )
4730             Mptr->TWR_VSBY = (float) MAXINT;
4731       }
4732       else if( isSurfaceVsby( &(token[NDEX]), Mptr, &NDEX ) ) {
4733          surfaceVsby++;
4734          if( surfaceVsby > 1 )
4735             Mptr->TWR_VSBY = (float) MAXINT;
4736       }
4737       else if( isVariableVsby( &(token[NDEX]), Mptr, &NDEX ) ) {
4738          variableVsby++;
4739          if( variableVsby > 1 ) {
4740             Mptr->minVsby = (float) MAXINT;
4741             Mptr->maxVsby = (float) MAXINT;
4742          }
4743       }
4744       else if( isVsby2ndSite( &(token[NDEX]), Mptr, &NDEX ) ) {
4745          Vsby2ndSite++;
4746          if( Vsby2ndSite > 1 ) {
4747             Mptr->VSBY_2ndSite = (float) MAXINT;
4748             memset(Mptr->VSBY_2ndSite_LOC,'\0',10);
4749          }
4750       }
4751       else if( isLTGfreq( &(token[NDEX]), Mptr, &NDEX ) ) {
4752          LTGfreq++;
4753          if( LTGfreq > 1 ) {
4754             Mptr->OCNL_LTG = FALSE;
4755             Mptr->FRQ_LTG = FALSE;
4756             Mptr->CNS_LTG = FALSE;
4757             Mptr->CG_LTG = FALSE;
4758             Mptr->IC_LTG = FALSE;
4759             Mptr->CC_LTG = FALSE;
4760             Mptr->CA_LTG = FALSE;
4761             Mptr->DSNT_LTG = FALSE;
4762             Mptr->OVHD_LTG = FALSE;
4763             Mptr->VcyStn_LTG = FALSE;
4764             Mptr->LightningVCTS = FALSE;
4765             Mptr->LightningTS = FALSE;
4766             memset(Mptr->LTG_DIR,'\0',3 );
4767          }
4768       }
4769       else if( isTS_LOC( &(token[NDEX]), Mptr, &NDEX ) ) {
4770          TS_LOC++;
4771          if( TS_LOC > 1 ) {
4772             memset(Mptr->TS_LOC, '\0', 3);
4773             memset(Mptr->TS_MOVMNT, '\0', 3);
4774          }
4775       }
4776       else if( isRecentWX( &(token[NDEX]), Mptr, &recentWX ) ) {
4777          recentWX++;
4778 /*       if( recentWX > 3 ) {
4779             for( i = 0; i < 3; i++ ) {
4780                memset(Mptr->ReWx[i].Recent_weather, '\0', 5);
4781  
4782                Mptr->ReWx[i].Bhh = MAXINT;
4783                Mptr->ReWx[i].Bmm = MAXINT;
4784  
4785                Mptr->ReWx[i].Ehh = MAXINT;
4786                Mptr->ReWx[i].Emm = MAXINT;
4787             }
4788  
4789             NDEX++;
4790          }
4791          else   */
4792             NDEX++;
4793       }
4794       else if( isVariableCIG( &(token[NDEX]), Mptr, &NDEX ) ) {
4795          variableCIG++;
4796          if( variableCIG > 1) {
4797             Mptr->minCeiling = MAXINT;
4798             Mptr->maxCeiling = MAXINT;
4799          }
4800       }
4801       else if( isCIG2ndSite( &(token[NDEX]), Mptr, &NDEX ) ) {
4802          CIG2ndSite++;
4803          if( CIG2ndSite > 1) {
4804             Mptr->CIG_2ndSite_Meters = MAXINT;
4805             memset( Mptr->CIG_2ndSite_LOC, '\0', 10);
4806          }
4807       }
4808       else if( isPRESFR( token[NDEX], Mptr, &NDEX ) ) {
4809          PRESFR++;
4810          if( PRESFR > 1 )
4811             Mptr->PRESFR = FALSE;
4812       }
4813       else if( isPRESRR( token[NDEX], Mptr, &NDEX ) ) {
4814          PRESRR++;
4815          if( PRESRR > 1 )
4816             Mptr->PRESRR = FALSE;
4817       }
4818       else if( isSLP( &(token[NDEX]), Mptr, &NDEX ) ) {
4819          SLP++;
4820          if( SLP > 1 )
4821             Mptr->SLP = (float) MAXINT;
4822       }
4823       else if( isPartObscur( &(token[NDEX]), Mptr, PartObscur,
4824                &NDEX ) ) {
4825          PartObscur++;
4826          if( PartObscur > 2 ) {
4827             memset(&(Mptr->PartialObscurationAmt[0][0]), '\0', 7 );
4828             memset(&(Mptr->PartialObscurationPhenom[0][0]),'\0',12 );
4829  
4830             memset(&(Mptr->PartialObscurationAmt[1][0]), '\0', 7 );
4831             memset(&(Mptr->PartialObscurationPhenom[1][0]),'\0',12 );
4832          }
4833       }
4834       else if( isSectorVsby( &(token[NDEX]), Mptr, &NDEX ) ) {
4835          SectorVsby++;
4836          if( SectorVsby > 1 ) {
4837             Mptr->SectorVsby = (float) MAXINT;
4838             memset(Mptr->SectorVsby_Dir, '\0', 3);
4839          }
4840       }
4841       else if( isGR( &(token[NDEX]), Mptr, &NDEX ) ) {
4842          GR++;
4843          if( GR > 1 ) {
4844             Mptr->GR_Size = (float) MAXINT;
4845             Mptr->GR = FALSE;
4846          }
4847       }
4848       else if( isVIRGA( &(token[NDEX]), Mptr, &NDEX ) ) {
4849          Virga++;
4850          if( Virga > 1 ) {
4851             Mptr->VIRGA = FALSE;
4852             memset(Mptr->VIRGA_DIR, '\0', 3);
4853          }
4854       }
4855       else if( isSfcObscuration( token[NDEX], Mptr, &NDEX ) ) {
4856          SfcObscur++;
4857          if( SfcObscur > 1 ) {
4858             for( i = 0; i < 6; i++ ) {
4859                memset(&(Mptr->SfcObscuration[i][0]), '\0', 10);
4860                Mptr->Num8thsSkyObscured = MAXINT;
4861             }
4862          }
4863       }
4864       else if( isCeiling( token[NDEX], Mptr, &NDEX ) ) {
4865          Ceiling++;
4866          if( Ceiling > 1 ) {
4867             Mptr->CIGNO = FALSE;
4868             Mptr->Ceiling = MAXINT;
4869             Mptr->Estimated_Ceiling = FALSE;
4870          }
4871       }
4872       else if( isVrbSky( &(token[NDEX]), Mptr, &NDEX ) ) {
4873          VrbSkyCond++;
4874          if( VrbSkyCond > 1 ) {
4875             memset(Mptr->VrbSkyBelow, '\0', 4);
4876             memset(Mptr->VrbSkyAbove, '\0', 4);
4877             Mptr->VrbSkyLayerHgt = MAXINT;
4878          }
4879       }
4880       else if( isObscurAloft( &(token[NDEX]), Mptr, &NDEX ) ) {
4881          ObscurAloft++;
4882          if( ObscurAloft > 1 ) {
4883             Mptr->ObscurAloftHgt = MAXINT;
4884             memset( Mptr->ObscurAloft, '\0', 12 );
4885             memset( Mptr->ObscurAloftSkyCond, '\0', 12 );
4886          }
4887       }
4888       else if( isNOSPECI( token[NDEX], Mptr, &NDEX ) ) {
4889          NoSPECI++;
4890          if( NoSPECI > 1 )
4891             Mptr->NOSPECI = FALSE;
4892       }
4893       else if( isLAST( token[NDEX], Mptr, &NDEX ) ) {
4894          Last++;
4895          if( Last > 1 )
4896             Mptr->LAST = FALSE;
4897       }
4898       else if( isSynopClouds( token[NDEX], Mptr, &NDEX ) ) {
4899          SynopClouds++;
4900          if( SynopClouds > 1 ) {
4901             memset( Mptr->synoptic_cloud_type, '\0', 6 );
4902             Mptr->CloudLow    = '\0';
4903             Mptr->CloudMedium = '\0';
4904             Mptr->CloudHigh   = '\0';
4905          }
4906       }
4907       else if( isSNINCR( &(token[NDEX]), Mptr, &NDEX ) ) {
4908          Snincr++;
4909          if( Snincr > 1 ) {
4910             Mptr->SNINCR = MAXINT;
4911             Mptr->SNINCR_TotalDepth = MAXINT;
4912          }
4913       }
4914       else if( isSnowDepth( token[NDEX], Mptr, &NDEX ) ) {
4915          SnowDepth++;
4916          if( SnowDepth > 1 ) {
4917             memset( Mptr->snow_depth_group, '\0', 6 );
4918             Mptr->snow_depth = MAXINT;
4919          }
4920       }
4921       else if( isWaterEquivSnow( token[NDEX], Mptr, &NDEX ) ) {
4922          WaterEquivSnow++;
4923          if( WaterEquivSnow > 1 )
4924             Mptr->WaterEquivSnow = (float) MAXINT;
4925       }
4926       else if( isSunshineDur( token[NDEX], Mptr, &NDEX ) ) {
4927          SunshineDur++;
4928          if( SunshineDur > 1 ) {
4929             Mptr->SunshineDur = MAXINT;
4930             Mptr->SunSensorOut = FALSE;
4931          }
4932       }
4933       else if( isHourlyPrecip( &(token[NDEX]), Mptr, &NDEX ) ) {
4934          hourlyPrecip++;
4935          if( hourlyPrecip > 1 )
4936             Mptr->hourlyPrecip = (float) MAXINT;
4937       }
4938       else if( isP6Precip( token[NDEX], Mptr, &NDEX ) ) {
4939          P6Precip++;
4940          if( P6Precip > 1 )
4941             Mptr->precip_amt = (float) MAXINT;
4942       }
4943       else if( isP24Precip( token[NDEX], Mptr, &NDEX ) ) {
4944          P24Precip++;
4945          if( P24Precip > 1 )
4946             Mptr->precip_24_amt = (float) MAXINT;
4947       }
4948       else  if( isTTdTenths( token[NDEX], Mptr, &NDEX ) ) {
4949          TTdTenths++;
4950          if( TTdTenths > 1 ) {
4951             Mptr->Temp_2_tenths = (float) MAXINT;
4952             Mptr->DP_Temp_2_tenths = (float) MAXINT;
4953          }
4954       }
4955       else if( isMaxTemp( token[NDEX], Mptr, &NDEX ) ) {
4956          MaxTemp++;
4957          if( MaxTemp > 1 )
4958             Mptr->maxtemp = (float) MAXINT;
4959       }
4960       else if( isMinTemp( token[NDEX], Mptr, &NDEX ) ) {
4961          MinTemp++;
4962          if( MinTemp > 1 )
4963             Mptr->mintemp = (float) MAXINT;
4964       }
4965       else if( isT24MaxMinTemp( token[NDEX],
4966                                           Mptr, &NDEX ) ) {
4967          T24MaxMinTemp++;
4968          if( T24MaxMinTemp > 1 ) {
4969             Mptr->max24temp = (float) MAXINT;
4970             Mptr->min24temp = (float) MAXINT;
4971          }
4972       }
4973       else if( isPtendency( token[NDEX], Mptr, &NDEX ) ) {
4974          Ptendency++;
4975          if( Ptendency > 1 ) {
4976             Mptr->char_prestndcy = MAXINT;
4977             Mptr->prestndcy = (float) MAXINT;
4978          }
4979       }
4980       else if( isPWINO( token[NDEX], Mptr, &NDEX ) ) {
4981          PWINO++;
4982          if( PWINO > 1 )
4983             Mptr->PWINO = FALSE;
4984       }
4985       else if( isFZRANO( token[NDEX], Mptr, &NDEX ) ) {
4986          FZRANO++;
4987          if( FZRANO > 1 )
4988             Mptr->FZRANO = FALSE;
4989       }
4990       else if( isTSNO( token[NDEX], Mptr, &NDEX ) ) {
4991          TSNO++;
4992          if( TSNO > 1 )
4993             Mptr->TSNO = FALSE;
4994       }
4995       else if( isDollarSign( token[NDEX], Mptr, &NDEX ) ) {
4996          maintIndicator++;
4997          if( maintIndicator > 1 )
4998             Mptr->DollarSign = FALSE;
4999       }
5000       else if( isRVRNO( token[NDEX], Mptr, &NDEX ) ) {
5001          RVRNO++;
5002          if( RVRNO > 1 )
5003             Mptr->RVRNO = FALSE;
5004       }
5005       else if( isPNO( token[NDEX], Mptr, &NDEX ) ) {
5006          PNO++;
5007          if( PNO > 1 )
5008             Mptr->PNO = FALSE;
5009       }
5010       else if( isVISNO( &(token[NDEX]), Mptr, &NDEX ) ) {
5011          VISNO++;
5012          if( VISNO > 1 ) {
5013             Mptr->VISNO = FALSE;
5014             memset(Mptr->VISNO_LOC, '\0', 6);
5015          }
5016       }
5017       else if( isCHINO( &(token[NDEX]), Mptr, &NDEX ) ) {
5018          CHINO++;
5019          if( CHINO > 1 ) {
5020             Mptr->CHINO = FALSE;
5021             memset(Mptr->CHINO_LOC, '\0', 6);
5022          }
5023       }
5024       else if( isDVR( token[NDEX], Mptr, &NDEX ) ) {
5025          DVR++;
5026          if( DVR > 1 ) {
5027             Mptr->DVR.Min_visRange = MAXINT;
5028             Mptr->DVR.Max_visRange = MAXINT;
5029             Mptr->DVR.visRange = MAXINT;
5030             Mptr->DVR.vrbl_visRange = FALSE;
5031             Mptr->DVR.below_min_DVR = FALSE;
5032             Mptr->DVR.above_max_DVR = FALSE;
5033          }
5034       }
5035       else
5036          NDEX++;
5037  
5038    }
5039  
5040    return;
5041 }