/[pcre]/code/tags/pcre-8.10/pcre_printint.src
ViewVC logotype

Diff of /code/tags/pcre-8.10/pcre_printint.src

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 116 by ph10, Fri Mar 9 15:23:02 2007 UTC revision 475 by ph10, Sat Jan 2 18:21:30 2010 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2005 University of Cambridge             Copyright (c) 1997-2010 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 43  internal form of a compiled regular expr Line 43  internal form of a compiled regular expr
43  local functions. This source file is used in two places:  local functions. This source file is used in two places:
44    
45  (1) It is #included by pcre_compile.c when it is compiled in debugging mode  (1) It is #included by pcre_compile.c when it is compiled in debugging mode
46  (DEBUG defined in pcre_internal.h). It is not included in production compiles.  (PCRE_DEBUG defined in pcre_internal.h). It is not included in production
47    compiles.
48    
49  (2) It is always #included by pcretest.c, which can be asked to print out a  (2) It is always #included by pcretest.c, which can be asked to print out a
50  compiled regex for debugging purposes. */  compiled regex for debugging purposes. */
# Line 54  hexadecimal. We don't use isprint() beca Line 55  hexadecimal. We don't use isprint() beca
55  (even without the use of locales) and we want the output always to be the same,  (even without the use of locales) and we want the output always to be the same,
56  for testing purposes. This macro is used in pcretest as well as in this file. */  for testing purposes. This macro is used in pcretest as well as in this file. */
57    
58    #ifdef EBCDIC
59    #define PRINTABLE(c) ((c) >= 64 && (c) < 255)
60    #else
61  #define PRINTABLE(c) ((c) >= 32 && (c) < 127)  #define PRINTABLE(c) ((c) >= 32 && (c) < 127)
62    #endif
63    
64  /* The table of operator names. */  /* The table of operator names. */
65    
# Line 122  get_ucpname(int ptype, int pvalue) Line 127  get_ucpname(int ptype, int pvalue)
127  {  {
128  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
129  int i;  int i;
130  for (i = _pcre_utt_size; i >= 0; i--)  for (i = _pcre_utt_size - 1; i >= 0; i--)
131    {    {
132    if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break;    if (ptype == _pcre_utt[i].type && pvalue == _pcre_utt[i].value) break;
133    }    }
134  return (i >= 0)? _pcre_utt[i].name : "??";  return (i >= 0)? _pcre_utt_names + _pcre_utt[i].name_offset : "??";
135  #else  #else
136  /* It gets harder and harder to shut off unwanted compiler warnings. */  /* It gets harder and harder to shut off unwanted compiler warnings. */
137  ptype = ptype * pvalue;  ptype = ptype * pvalue;
# Line 142  return (ptype == pvalue)? "??" : "??"; Line 147  return (ptype == pvalue)? "??" : "??";
147    
148  /* Make this function work for a regex with integers either byte order.  /* Make this function work for a regex with integers either byte order.
149  However, we assume that what we are passed is a compiled regex. The  However, we assume that what we are passed is a compiled regex. The
150  print_lengths flag controls whether offsets and lengths of items are printed.  print_lengths flag controls whether offsets and lengths of items are printed.
151  They can be turned off from pcretest so that automatic tests on bytecode can be  They can be turned off from pcretest so that automatic tests on bytecode can be
152  written that do not depend on the value of LINK_SIZE. */  written that do not depend on the value of LINK_SIZE. */
153    
# Line 181  for(;;) Line 186  for(;;)
186    if (print_lengths)    if (print_lengths)
187      fprintf(f, "%3d ", (int)(code - codestart));      fprintf(f, "%3d ", (int)(code - codestart));
188    else    else
189      fprintf(f, "    ");      fprintf(f, "    ");
190    
191    switch(*code)    switch(*code)
192      {      {
# Line 219  for(;;) Line 224  for(;;)
224      case OP_CBRA:      case OP_CBRA:
225      case OP_SCBRA:      case OP_SCBRA:
226      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
227        else fprintf(f, "    ");        else fprintf(f, "    ");
228      fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));      fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
229      break;      break;
230    
# Line 238  for(;;) Line 243  for(;;)
243      case OP_SCOND:      case OP_SCOND:
244      case OP_REVERSE:      case OP_REVERSE:
245      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
246        else fprintf(f, "    ");        else fprintf(f, "    ");
247      fprintf(f, "%s", OP_names[*code]);      fprintf(f, "%s", OP_names[*code]);
248      break;      break;
249    
250        case OP_CLOSE:
251        fprintf(f, "    %s %d", OP_names[*code], GET2(code, 1));
252        break;
253    
254      case OP_CREF:      case OP_CREF:
255        case OP_NCREF:
256      fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);      fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
257      break;      break;
258    
# Line 254  for(;;) Line 264  for(;;)
264        fprintf(f, "    Cond recurse %d", c);        fprintf(f, "    Cond recurse %d", c);
265      break;      break;
266    
267        case OP_NRREF:
268        c = GET2(code, 1);
269        if (c == RREF_ANY)
270          fprintf(f, "    Cond nrecurse any");
271        else
272          fprintf(f, "    Cond nrecurse %d", c);
273        break;
274    
275      case OP_DEF:      case OP_DEF:
276      fprintf(f, "    Cond def");      fprintf(f, "    Cond def");
277      break;      break;
# Line 356  for(;;) Line 374  for(;;)
374    
375      case OP_RECURSE:      case OP_RECURSE:
376      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
377        else fprintf(f, "    ");        else fprintf(f, "    ");
378      fprintf(f, "%s", OP_names[*code]);      fprintf(f, "%s", OP_names[*code]);
379      break;      break;
380    

Legend:
Removed from v.116  
changed lines
  Added in v.475

  ViewVC Help
Powered by ViewVC 1.1.5