/[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 461 by ph10, Mon Oct 5 10:59:35 2009 UTC revision 550 by ph10, Sun Oct 10 16:24:11 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-2009 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 189  for(;;) Line 190  for(;;)
190    
191    switch(*code)    switch(*code)
192      {      {
193    /* ========================================================================== */
194          /* These cases are never obeyed. This is a fudge that causes a compile-
195          time error if the vectors OP_names or _pcre_OP_lengths, which are indexed
196          by opcode, are not the correct length. It seems to be the only way to do
197          such a check at compile time, as the sizeof() operator does not work in
198          the C preprocessor. We do this while compiling pcretest, because that
199          #includes pcre_tables.c, which holds _pcre_OP_lengths. We can't do this
200          when building pcre_compile.c with PCRE_DEBUG set, because it doesn't then
201          know the size of _pcre_OP_lengths. */
202    
203    #ifdef COMPILING_PCRETEST
204          case OP_TABLE_LENGTH:
205          case OP_TABLE_LENGTH +
206            ((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) &&
207            (sizeof(_pcre_OP_lengths) == OP_TABLE_LENGTH)):
208          break;
209    #endif
210    /* ========================================================================== */
211    
212      case OP_END:      case OP_END:
213      fprintf(f, "    %s\n", OP_names[*code]);      fprintf(f, "    %s\n", OP_names[*code]);
214      fprintf(f, "------------------------------------------------------------------\n");      fprintf(f, "------------------------------------------------------------------\n");
# Line 514  for(;;) Line 534  for(;;)
534        }        }
535      break;      break;
536    
537        case OP_MARK:
538        case OP_PRUNE_ARG:
539        case OP_SKIP_ARG:
540        fprintf(f, "    %s %s", OP_names[*code], code + 2);
541        extra += code[1];
542        break;
543    
544        case OP_THEN:
545        if (print_lengths)
546          fprintf(f, "    %s %d", OP_names[*code], GET(code, 1));
547        else
548          fprintf(f, "    %s", OP_names[*code]);
549        break;
550    
551        case OP_THEN_ARG:
552        if (print_lengths)
553          fprintf(f, "    %s %d %s", OP_names[*code], GET(code, 1),
554            code + 2 + LINK_SIZE);
555        else
556          fprintf(f, "    %s %s", OP_names[*code], code + 2 + LINK_SIZE);
557        extra += code[1+LINK_SIZE];
558        break;
559    
560      /* Anything else is just an item with no data*/      /* Anything else is just an item with no data*/
561    
562      default:      default:

Legend:
Removed from v.461  
changed lines
  Added in v.550

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12