]> git.mxchange.org Git - simgear.git/blob - simgear/metar/Stspack3.cpp
MSVC warning fixes
[simgear.git] / simgear / metar / Stspack3.cpp
1 #include "Local.h"     /* standard header file */
2  
3 /********************************************************************/
4 /*                                                                  */
5 /*  Title:         stspack3                                         */
6 /*  Organization:  W/OSO242 - GRAPHICS AND DISPLAY SECTION          */
7 /*  Date:          05 Oct 1992                                      */
8 /*  Programmer:    ALLAN DARLING                                    */
9 /*  Language:      C/2                                              */
10 /*                                                                  */
11 /*  Abstract:      The stspack3 package contains functions to       */
12 /*                 perform the isalnum through isxdigit functions   */
13 /*                 on strings.  The functions come in four forms:   */
14 /*                 those that test NULL delimited strings and are   */
15 /*                 named in the form sxxxxxxx, those that test at   */
16 /*                 most n characters and are named in the form      */
17 /*                 nxxxxxxx, those that search forward in a string  */
18 /*                 and are named in the form nxtyyyyy, and those    */
19 /*                 that search backward in a string and are named   */
20 /*                 in the form lstyyyyy.                            */
21 /*                                                                  */
22 /*                 The xxxxxxx is the name of the test applied to   */
23 /*                 each character in the string, such as isalpha,   */
24 /*                 thus a function to test a NULL delimited string  */
25 /*                 an return a nonzero value if all characters in   */
26 /*                 the string are digits is named sisdigit.         */
27 /*                                                                  */
28 /*                 The yyyyy is the name of the test applied to     */
29 /*                 characters in a string, minus the 'is' prefix.   */
30 /*                 Thus a function to find the next digit in a NULL */
31 /*                 delimited string and return a pointer to it is   */
32 /*                 named nxtdigit.                                  */
33 /*                                                                  */
34 /*                 The only exception to the naming rule is for the */
35 /*                 functions that test for hexadecimal digits.      */
36 /*                 These are named sisxdigi, nisxdigi, nxtxdigi,    */
37 /*                 and lstxdigi because of the eight character      */
38 /*                 function name limitation.                        */
39 /*                                                                  */
40 /*                 The nxxxxxxx class of functions will test up to  */
41 /*                 n characters or the first NULL character         */
42 /*                 encountered, whichever comes first.  For all     */
43 /*                 classes of functions, the string sentinal is     */
44 /*                 not included in the test.                        */
45 /*                                                                  */
46 /*  External Functions Called:                                      */
47 /*                 isalnum, isalpha, iscntrl, isdigit, isgraph,     */
48 /*                 islower, isprint, ispunct, isspace, isupper,     */
49 /*                 isxdigit.                                        */
50 /*                                                                  */
51 /*  Input:         For sxxxxxxx class functions, a pointer to a     */
52 /*                 NULL delimited character string.                 */
53 /*                                                                  */
54 /*                 For nxtyyyyy class functions, a pointer to a     */
55 /*                 NULL delimited character string.                 */
56 /*                                                                  */
57 /*                 for nxxxxxxx class functions, a pointer to a     */
58 /*                 character array, and a positive, nonzero integer.*/
59 /*                                                                  */
60 /*                 for lstyyyyy class functions, a pointer to a     */
61 /*                 character array, and a positive, nonzero integer.*/
62 /*                                                                  */
63 /*  Output:        A nonzero value if the test is true for all      */
64 /*                 characters in the string, a zero value otherwise.*/
65 /*                                                                  */
66 /*  Modification History:                                           */
67 /*                 None.                                            */
68 /*                                                                  */
69 /********************************************************************/
70 char *nxtalnum(char *s) {
71  
72    for (; !isalnum(*s) && *s; s++) ;
73  
74    if (*s)
75       return (s);
76    else
77       return (NULL);
78  
79 } /* end nxtalnum */
80  
81  
82 char *nxtalpha(char *s) {
83  
84    for (; !isalpha(*s) && *s; s++) ;
85  
86    if (*s)
87       return (s);
88    else
89       return (NULL);
90  
91 } /* end nxtalpha */
92  
93  
94 char *nxtcntrl(char *s) {
95  
96    for (; !iscntrl(*s) && *s; s++) ;
97  
98    if (*s)
99       return (s);
100    else
101       return (NULL);
102  
103 } /* end nxtcntrl */
104  
105  
106 char *nxtdigit(char *s) {
107  
108    for (; !isdigit(*s) && *s; s++) ;
109  
110    if (*s)
111       return (s);
112    else
113       return (NULL);
114  
115 } /* end nxtdigit */
116  
117  
118 char *nxtgraph(char *s) {
119  
120    for (; !isgraph(*s) && *s; s++) ;
121  
122    if (*s)
123       return (s);
124    else
125       return (NULL);
126  
127 } /* end nxtgraph */
128  
129  
130 char *nxtlower(char *s) {
131  
132    for (; !islower(*s) && *s; s++) ;
133  
134    if (*s)
135       return (s);
136    else
137       return (NULL);
138  
139 } /* end nxtlower */
140  
141  
142 char *nxtprint(char *s) {
143  
144    for (; !isprint(*s) && *s; s++) ;
145  
146    if (*s)
147       return (s);
148    else
149       return (NULL);
150  
151 } /* end nxtprint */
152  
153  
154 char *nxtpunct(char *s) {
155  
156    for (; !ispunct(*s) && *s; s++) ;
157  
158    if (*s)
159       return (s);
160    else
161       return (NULL);
162  
163 } /* end nxtpunct */
164  
165  
166 char *nxtspace(char *s) {
167  
168    for (; !isspace(*s) && *s; s++) ;
169  
170    if (*s)
171       return (s);
172    else
173       return (NULL);
174  
175 } /* end nxtspace */
176  
177  
178 char *nxtupper(char *s) {
179  
180    for (; !isupper(*s) && *s; s++) ;
181  
182    if (*s)
183       return (s);
184    else
185       return (NULL);
186  
187 } /* end nxtupper */
188  
189  
190 char *nxtxdigi(char *s) {
191  
192    for (; !isxdigit(*s) && *s; s++) ;
193  
194    if (*s)
195       return (s);
196    else
197       return (NULL);
198  
199 } /* end nxtxdigi */
200  
201