10 |
|
#include "copyright.h" |
11 |
|
|
12 |
|
#include <ctype.h> |
13 |
– |
#include <string.h> |
13 |
|
|
14 |
|
#include "rtio.h" |
15 |
|
|
16 |
|
char * |
17 |
|
atos(char *rs, int nb, char *s) /* get word from string, returning rs */ |
18 |
|
{ |
19 |
< |
register char *cp = rs; |
19 |
> |
char *cp = rs; |
20 |
|
|
21 |
|
while (isspace(*s)) |
22 |
|
s++; |
82 |
|
{ |
83 |
|
while (isspace(*s)) |
84 |
|
s++; |
85 |
< |
if (*s == '-' || *s == '+') |
87 |
< |
s++; |
85 |
> |
s += (*s == '-') | (*s == '+'); |
86 |
|
if (!isdigit(*s)) |
87 |
|
return(NULL); |
88 |
|
do |
95 |
|
char * |
96 |
|
fskip(char *s) /* skip float in string */ |
97 |
|
{ |
98 |
< |
register char *cp; |
98 |
> |
char *cp; |
99 |
|
|
100 |
|
while (isspace(*s)) |
101 |
|
s++; |
102 |
< |
if (*s == '-' || *s == '+') |
105 |
< |
s++; |
102 |
> |
s += (*s == '-') | (*s == '+'); |
103 |
|
cp = s; |
104 |
|
while (isdigit(*cp)) |
105 |
|
cp++; |
110 |
|
} |
111 |
|
if (cp == s) |
112 |
|
return(NULL); |
113 |
< |
if (*cp == 'e' || *cp == 'E') |
114 |
< |
return(iskip(cp+1)); |
113 |
> |
if ((*cp == 'e') | (*cp == 'E')) |
114 |
> |
return(isspace(*++cp) ? NULL : iskip(cp)); |
115 |
|
return(cp); |
116 |
|
} |
117 |
|
|
119 |
|
int |
120 |
|
isint(char *s) /* check integer format */ |
121 |
|
{ |
122 |
< |
register char *cp; |
122 |
> |
char *cp; |
123 |
|
|
124 |
|
cp = iskip(s); |
125 |
|
return(cp != NULL && *cp == '\0'); |
129 |
|
int |
130 |
|
isintd(char *s, char *ds) /* check integer format with delimiter set */ |
131 |
|
{ |
132 |
< |
register char *cp; |
132 |
> |
char *cp; |
133 |
|
|
134 |
|
cp = iskip(s); |
135 |
|
return(cp != NULL && strchr(ds, *cp) != NULL); |
139 |
|
int |
140 |
|
isflt(char *s) /* check float format */ |
141 |
|
{ |
142 |
< |
register char *cp; |
142 |
> |
char *cp; |
143 |
|
|
144 |
|
cp = fskip(s); |
145 |
|
return(cp != NULL && *cp == '\0'); |
149 |
|
int |
150 |
|
isfltd(char *s, char *ds) /* check integer format with delimiter set */ |
151 |
|
{ |
152 |
< |
register char *cp; |
152 |
> |
char *cp; |
153 |
|
|
154 |
|
cp = fskip(s); |
155 |
|
return(cp != NULL && strchr(ds, *cp) != NULL); |
161 |
|
{ |
162 |
|
while (*s == '_') /* skip leading underscores */ |
163 |
|
s++; |
164 |
< |
if (!isascii(*s) || !isalpha(*s)) /* start with a letter */ |
164 |
> |
if (!isascii(*s) | !isalpha(*s)) /* start with a letter */ |
165 |
|
return(0); |
166 |
|
while (isascii(*++s) && isgraph(*s)) /* all visible characters */ |
167 |
|
; |