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