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