1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
27 * return the next character in the string s
28 * \ character constants are converted
29 * p is updated to point to the next character in s
41 chresc(register const char* s
, char** p
)
43 register const char* q
;
51 switch (c
= mbchar(s
))
59 case '0': case '1': case '2': case '3':
60 case '4': case '5': case '6': case '7':
66 case '0': case '1': case '2': case '3':
67 case '4': case '5': case '6': case '7':
68 c
= (c
<< 3) + *s
++ - '0';
89 c
= ccmapc(c
, CC_NATIVE
, CC_ASCII
);
91 c
= ccmapc(c
, CC_ASCII
, CC_NATIVE
);
94 if (*s
== '-' && *(s
+ 1))
100 if (*s
== '[' && (n
= regcollate(s
+ 1, (char**)&e
, buf
, sizeof(buf
))) >= 0)
138 q
= c
== 'u' ? (s
+ 4) : c
== 'U' ? (s
+ 8) : (char*)0;
140 while (!e
|| !q
|| s
< q
)
144 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
145 c
= (c
<< 4) + *s
++ - 'a' + 10;
147 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
148 c
= (c
<< 4) + *s
++ - 'A' + 10;
150 case '0': case '1': case '2': case '3': case '4':
151 case '5': case '6': case '7': case '8': case '9':
152 c
= (c
<< 4) + *s
++ - '0';