/[pcre]/code/trunk/pcre_printint.src
ViewVC logotype

Diff of /code/trunk/pcre_printint.src

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

revision 115 by ph10, Thu Mar 8 16:53:09 2007 UTC revision 116 by ph10, Fri Mar 9 15:23:02 2007 UTC
# Line 141  return (ptype == pvalue)? "??" : "??"; Line 141  return (ptype == pvalue)? "??" : "??";
141  *************************************************/  *************************************************/
142    
143  /* Make this function work for a regex with integers either byte order.  /* Make this function work for a regex with integers either byte order.
144  However, we assume that what we are passed is a compiled regex. */  However, we assume that what we are passed is a compiled regex. The
145    print_lengths flag controls whether offsets and lengths of items are printed.
146    They can be turned off from pcretest so that automatic tests on bytecode can be
147    written that do not depend on the value of LINK_SIZE. */
148    
149  static void  static void
150  pcre_printint(pcre *external_re, FILE *f)  pcre_printint(pcre *external_re, FILE *f, BOOL print_lengths)
151  {  {
152  real_pcre *re = (real_pcre *)external_re;  real_pcre *re = (real_pcre *)external_re;
153  uschar *codestart, *code;  uschar *codestart, *code;
# Line 175  for(;;) Line 178  for(;;)
178    int c;    int c;
179    int extra = 0;    int extra = 0;
180    
181    fprintf(f, "%3d ", (int)(code - codestart));    if (print_lengths)
182        fprintf(f, "%3d ", (int)(code - codestart));
183      else
184        fprintf(f, "    ");
185    
186    switch(*code)    switch(*code)
187      {      {
# Line 212  for(;;) Line 218  for(;;)
218    
219      case OP_CBRA:      case OP_CBRA:
220      case OP_SCBRA:      case OP_SCBRA:
221      fprintf(f, "%3d %s %d", GET(code, 1), OP_names[*code],      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
222        GET2(code, 1+LINK_SIZE));        else fprintf(f, "    ");
223        fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
224      break;      break;
225    
226      case OP_BRA:      case OP_BRA:
# Line 230  for(;;) Line 237  for(;;)
237      case OP_COND:      case OP_COND:
238      case OP_SCOND:      case OP_SCOND:
239      case OP_REVERSE:      case OP_REVERSE:
240      fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
241          else fprintf(f, "    ");
242        fprintf(f, "%s", OP_names[*code]);
243      break;      break;
244    
245      case OP_CREF:      case OP_CREF:
# Line 346  for(;;) Line 355  for(;;)
355      break;      break;
356    
357      case OP_RECURSE:      case OP_RECURSE:
358      fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);      if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
359          else fprintf(f, "    ");
360        fprintf(f, "%s", OP_names[*code]);
361      break;      break;
362    
363      case OP_REF:      case OP_REF:

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12