34 #ifdef HAVE_STDARG_PROTOTYPES
36 #define va_init_list(a,b) va_start(a,b)
39 #define va_init_list(a,b) va_start(a)
47 if (code >= 0)
return (
UChar* )0;
51 p =
"mismatch";
break;
53 p =
"no support in this configuration";
break;
55 p =
"failed to allocate memory";
break;
57 p =
"match-stack limit over";
break;
59 p =
"undefined type (bug)";
break;
61 p =
"internal parser error (bug)";
break;
63 p =
"stack error (bug)";
break;
65 p =
"undefined bytecode (bug)";
break;
67 p =
"unexpected bytecode (bug)";
break;
69 p =
"default multibyte-encoding is not set";
break;
71 p =
"can't convert to wide-char on specified multibyte-encoding";
break;
73 p =
"invalid argument";
break;
75 p =
"end pattern at left brace";
break;
77 p =
"end pattern at left bracket";
break;
79 p =
"empty char-class";
break;
81 p =
"premature end of char-class";
break;
83 p =
"end pattern at escape";
break;
85 p =
"end pattern at meta";
break;
87 p =
"end pattern at control";
break;
89 p =
"invalid meta-code syntax";
break;
91 p =
"invalid control-code syntax";
break;
93 p =
"char-class value at end of range";
break;
95 p =
"char-class value at start of range";
break;
97 p =
"unmatched range specifier in char-class";
break;
99 p =
"target of repeat operator is not specified";
break;
101 p =
"target of repeat operator is invalid";
break;
103 p =
"nested repeat operator";
break;
105 p =
"unmatched close parenthesis";
break;
107 p =
"end pattern with unmatched parenthesis";
break;
109 p =
"end pattern in group";
break;
111 p =
"undefined group option";
break;
113 p =
"invalid POSIX bracket type";
break;
115 p =
"invalid pattern in look-behind";
break;
117 p =
"invalid repeat range {lower,upper}";
break;
119 p =
"invalid conditional pattern";
break;
121 p =
"too big number";
break;
123 p =
"too big number for repeat range";
break;
125 p =
"upper is smaller than lower in repeat range";
break;
127 p =
"empty range in char class";
break;
129 p =
"mismatch multibyte code length in char-class range";
break;
131 p =
"too many multibyte code ranges are specified";
break;
133 p =
"too short multibyte code string";
break;
135 p =
"too big backref number";
break;
137 p =
"too many capture groups are specified";
break;
139 #ifdef USE_NAMED_GROUP
140 p =
"invalid backref number/name";
break;
142 p =
"invalid backref number";
break;
145 p =
"numbered backref/call is not allowed. (use name)";
break;
147 p =
"too big wide-char value";
break;
149 p =
"too short digits";
break;
151 p =
"too long wide-char value";
break;
153 p =
"invalid code point value";
break;
155 p =
"group name is empty";
break;
157 p =
"invalid group name <%n>";
break;
159 #ifdef USE_NAMED_GROUP
160 p =
"invalid char in group name <%n>";
break;
162 p =
"invalid char in group number <%n>";
break;
165 p =
"undefined name <%n> reference";
break;
167 p =
"undefined group <%n> reference";
break;
169 p =
"multiplex defined name <%n>";
break;
171 p =
"multiplex definition name <%n> call";
break;
173 p =
"never ending recursion";
break;
175 p =
"group number is too big for capture history";
break;
177 p =
"invalid character property name {%n}";
break;
179 p =
"not supported encoding combination";
break;
181 p =
"invalid combination of options";
break;
183 p =
"over thread pass limit count";
break;
186 p =
"undefined error code";
break;
194 sprintf(s,
"%02x", (v & 0377));
199 sprintf(s,
"\\x%02x", (v & 0377));
203 UChar
buf[],
int buf_size,
int *is_over)
215 if (code > 0xffff && len + 10 <= buf_size) {
217 sprint_byte((
char*)(&(buf[len+4])), (
unsigned int)(code >> 16));
218 sprint_byte((
char*)(&(buf[len+6])), (
unsigned int)(code >> 8));
219 sprint_byte((
char*)(&(buf[len+8])), (
unsigned int)code);
222 else if (len + 6 <= buf_size) {
224 sprint_byte((
char*)(&(buf[len+4])), (
unsigned int)code);
232 buf[len++] = (
UChar )code;
236 if (len >= buf_size)
break;
239 *is_over = ((p < end) ? 1 : 0);
242 len = (int )
MIN((end - s), buf_size);
244 *is_over = ((buf_size < (end - s)) ? 1 : 0);
252 #define MAX_ERROR_PAR_LEN 30
255 #ifdef HAVE_STDARG_PROTOTYPES
324 UChar* pat, UChar* pat_end,
const UChar *fmt, va_list args)
331 n =
xvsnprintf((
char* )buf, bufsize, (
const char* )fmt, args);
333 need = (pat_end - pat) * 4 + 4;
335 if (n + need < (
size_t )bufsize) {
336 strcat((
char* )buf,
": /");
340 while (p < pat_end) {
343 len =
enclen(enc, p, pat_end);
344 while (len-- > 0) *s++ = *p++;
346 else if (*p ==
'/') {
347 *s++ = (
unsigned char )
'\\';
351 len =
enclen(enc, p, pat_end);
353 while (len-- > 0) *s++ = *p++;
362 while (blen-- > 0) *s++ = *bp++;
371 while (len-- > 0) *s++ = *bp++;
384 #ifdef HAVE_STDARG_PROTOTYPES
386 UChar* pat, UChar* pat_end,
const UChar *fmt, ...)
401 pat, pat_end, fmt, args);