Home | History | Annotate | Download | only in utils

Lines Matching refs:str

57 static const char* skip_ws(const char str[])
59 SkASSERT(str);
60 while (is_ws(*str))
61 str++;
62 return str;
65 static const char* skip_sep(const char str[])
67 SkASSERT(str);
68 while (is_sep(*str))
69 str++;
70 return str;
73 int SkParse::Count(const char str[])
81 if ((c = *str++) == '\0')
86 if ((c = *str++) == '\0')
94 int SkParse::Count(const char str[], char separator)
102 if ((c = *str++) == '\0')
107 if ((c = *str++) == '\0')
115 const char* SkParse::FindHex(const char str[], uint32_t* value)
117 SkASSERT(str);
118 str = skip_ws(str);
120 if (!is_hex(*str))
127 while ((digit = to_hex(*str)) >= 0)
132 str += 1;
135 if (*str == 0 || is_ws(*str))
139 return str;
144 const char* SkParse::FindS32(const char str[], int32_t* value)
146 SkASSERT(str);
147 str = skip_ws(str);
150 if (*str == '-')
153 str += 1;
156 if (!is_digit(*str))
160 while (is_digit(*str))
162 n = 10*n + *str - '0';
163 str += 1;
167 return str;
170 const char* SkParse::FindMSec(const char str[], SkMSec* value)
172 SkASSERT(str);
173 str = skip_ws(str);
176 if (*str == '-')
179 str += 1;
182 if (!is_digit(*str))
186 while (is_digit(*str))
188 n = 10*n + *str - '0';
189 str += 1;
192 if (*str == '.') {
193 str++;
194 while (is_digit(*str))
196 n = 10*n + *str - '0';
197 str += 1;
206 return str;
209 const char* SkParse::FindScalar(const char str[], SkScalar* value) {
210 SkASSERT(str);
211 str = skip_ws(str);
214 float v = (float)strtod(str, &stop);
215 if (str == stop) {
224 if (*str == '-')
227 str += 1;
230 if (!is_digit(*str) && *str != '.')
234 while (is_digit(*str))
236 n = 10*n + *str - '0';
239 str += 1;
243 if (*str == '.')
247 str += 1;
251 while (is_digit(*str) && fraction < end)
252 d += (*str++ - '0') * *fraction++;
256 while (is_digit(*str))
257 str += 1;
264 return str;
267 const char* SkParse::FindScalars(const char str[], SkScalar value[], int count)
275 str = SkParse::FindScalar(str, value);
276 if (--count == 0 || str == NULL)
280 str = skip_sep(str);
285 return str;
288 static bool lookup_str(const char str[], const char** table, int count)
291 if (!strcmp(str, table[count]))
296 bool SkParse::FindBool(const char str[], bool* value)
301 if (lookup_str(str, gYes, SK_ARRAY_COUNT(gYes)))
306 else if (lookup_str(str, gNo, SK_ARRAY_COUNT(gNo)))