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