--- code/trunk/pcre_printint.src 2007/03/08 16:53:09 111 +++ code/trunk/pcre_printint.src 2007/03/09 15:23:02 116 @@ -141,10 +141,13 @@ *************************************************/ /* Make this function work for a regex with integers either byte order. -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 +print_lengths flag controls whether offsets and lengths of items are printed. +They can be turned off from pcretest so that automatic tests on bytecode can be +written that do not depend on the value of LINK_SIZE. */ static void -pcre_printint(pcre *external_re, FILE *f) +pcre_printint(pcre *external_re, FILE *f, BOOL print_lengths) { real_pcre *re = (real_pcre *)external_re; uschar *codestart, *code; @@ -175,7 +178,10 @@ int c; int extra = 0; - fprintf(f, "%3d ", (int)(code - codestart)); + if (print_lengths) + fprintf(f, "%3d ", (int)(code - codestart)); + else + fprintf(f, " "); switch(*code) { @@ -212,8 +218,9 @@ case OP_CBRA: case OP_SCBRA: - fprintf(f, "%3d %s %d", GET(code, 1), OP_names[*code], - GET2(code, 1+LINK_SIZE)); + if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); + else fprintf(f, " "); + fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE)); break; case OP_BRA: @@ -230,7 +237,9 @@ case OP_COND: case OP_SCOND: case OP_REVERSE: - fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]); + if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); + else fprintf(f, " "); + fprintf(f, "%s", OP_names[*code]); break; case OP_CREF: @@ -346,7 +355,9 @@ break; case OP_RECURSE: - fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]); + if (print_lengths) fprintf(f, "%3d ", GET(code, 1)); + else fprintf(f, " "); + fprintf(f, "%s", OP_names[*code]); break; case OP_REF: