101 |
*************************************************/ |
*************************************************/ |
102 |
|
|
103 |
static const char * |
static const char * |
104 |
get_ucpname(int property) |
get_ucpname(int ptype, int pvalue) |
105 |
{ |
{ |
106 |
#ifdef SUPPORT_UCP |
#ifdef SUPPORT_UCP |
107 |
int i; |
int i; |
108 |
for (i = _pcre_utt_size; i >= 0; i--) |
for (i = _pcre_utt_size; i >= 0; i--) |
109 |
{ |
{ |
110 |
if (property == _pcre_utt[i].value) break; |
if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break; |
111 |
} |
} |
112 |
return (i >= 0)? _pcre_utt[i].name : "??"; |
return (i >= 0)? _pcre_utt[i].name : "??"; |
113 |
#else |
#else |
114 |
|
ptype = ptype; /* Avoid compiler warning */ |
115 |
|
pvalue = pvalue; |
116 |
return "??"; |
return "??"; |
117 |
#endif |
#endif |
118 |
} |
} |
252 |
fprintf(f, "%s", OP_names[code[1]]); |
fprintf(f, "%s", OP_names[code[1]]); |
253 |
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) |
if (code[1] == OP_PROP || code[1] == OP_NOTPROP) |
254 |
{ |
{ |
255 |
fprintf(f, " %s ", get_ucpname(code[2])); |
fprintf(f, " %s ", get_ucpname(code[2], code[3])); |
256 |
extra = 1; |
extra = 2; |
257 |
} |
} |
258 |
} |
} |
259 |
else extra = print_char(f, code+1, utf8); |
else extra = print_char(f, code+1, utf8); |
277 |
fprintf(f, " %s", OP_names[code[3]]); |
fprintf(f, " %s", OP_names[code[3]]); |
278 |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) |
if (code[3] == OP_PROP || code[3] == OP_NOTPROP) |
279 |
{ |
{ |
280 |
fprintf(f, " %s ", get_ucpname(code[4])); |
fprintf(f, " %s ", get_ucpname(code[4], code[5])); |
281 |
extra = 1; |
extra = 2; |
282 |
} |
} |
283 |
fprintf(f, "{"); |
fprintf(f, "{"); |
284 |
if (*code != OP_TYPEEXACT) fprintf(f, "0,"); |
if (*code != OP_TYPEEXACT) fprintf(f, "0,"); |
328 |
|
|
329 |
case OP_PROP: |
case OP_PROP: |
330 |
case OP_NOTPROP: |
case OP_NOTPROP: |
331 |
fprintf(f, " %s %s", OP_names[*code], get_ucpname(code[1])); |
fprintf(f, " %s %s", OP_names[*code], get_ucpname(code[1], code[2])); |
332 |
break; |
break; |
333 |
|
|
334 |
/* OP_XCLASS can only occur in UTF-8 mode. However, there's no harm in |
/* OP_XCLASS can only occur in UTF-8 mode. However, there's no harm in |
391 |
{ |
{ |
392 |
if (ch == XCL_PROP) |
if (ch == XCL_PROP) |
393 |
{ |
{ |
394 |
fprintf(f, "\\p{%s}", get_ucpname(*ccode++)); |
int ptype = *ccode++; |
395 |
|
int pvalue = *ccode++; |
396 |
|
fprintf(f, "\\p{%s}", get_ucpname(ptype, pvalue)); |
397 |
} |
} |
398 |
else if (ch == XCL_NOTPROP) |
else if (ch == XCL_NOTPROP) |
399 |
{ |
{ |
400 |
fprintf(f, "\\P{%s}", get_ucpname(*ccode++)); |
int ptype = *ccode++; |
401 |
|
int pvalue = *ccode++; |
402 |
|
fprintf(f, "\\P{%s}", get_ucpname(ptype, pvalue)); |
403 |
} |
} |
404 |
else |
else |
405 |
{ |
{ |
441 |
if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); |
if (*ccode == OP_CRMINRANGE) fprintf(f, "?"); |
442 |
extra += _pcre_OP_lengths[*ccode]; |
extra += _pcre_OP_lengths[*ccode]; |
443 |
break; |
break; |
444 |
|
|
445 |
|
/* Do nothing if it's not a repeat; this code stops picky compilers |
446 |
|
warning about the lack of a default code path. */ |
447 |
|
|
448 |
|
default: |
449 |
|
break; |
450 |
} |
} |
451 |
} |
} |
452 |
break; |
break; |