/[pcre]/code/trunk/pcretest.c
ViewVC logotype

Diff of /code/trunk/pcretest.c

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

revision 336 by ph10, Sat Apr 12 15:59:03 2008 UTC revision 363 by ph10, Thu Jul 10 16:24:33 2008 UTC
# Line 49  POSSIBILITY OF SUCH DAMAGE. Line 49  POSSIBILITY OF SUCH DAMAGE.
49  #include <errno.h>  #include <errno.h>
50    
51  #ifdef SUPPORT_LIBREADLINE  #ifdef SUPPORT_LIBREADLINE
52    #ifdef HAVE_UNISTD_H
53  #include <unistd.h>  #include <unistd.h>
54    #endif
55  #include <readline/readline.h>  #include <readline/readline.h>
56  #include <readline/history.h>  #include <readline/history.h>
57  #endif  #endif
# Line 69  input mode under Windows. */ Line 71  input mode under Windows. */
71  #define INPUT_MODE   "r"  #define INPUT_MODE   "r"
72  #define OUTPUT_MODE  "wb"  #define OUTPUT_MODE  "wb"
73    
74    #define isatty _isatty         /* This is what Windows calls them, I'm told */
75    #define fileno _fileno
76    
77  #else  #else
78  #include <sys/time.h>          /* These two includes are needed */  #include <sys/time.h>          /* These two includes are needed */
79  #include <sys/resource.h>      /* for setrlimit(). */  #include <sys/resource.h>      /* for setrlimit(). */
# Line 89  appropriately for an application, not fo Line 94  appropriately for an application, not fo
94  #include "pcre.h"  #include "pcre.h"
95  #include "pcre_internal.h"  #include "pcre_internal.h"
96    
97  /* We need access to the data tables that PCRE uses. So as not to have to keep  /* We need access to some of the data tables that PCRE uses. So as not to have
98  two copies, we include the source file here, changing the names of the external  to keep two copies, we include the source file here, changing the names of the
99  symbols to prevent clashes. */  external symbols to prevent clashes. */
100    
101    #define _pcre_ucp_gentype      ucp_gentype
102  #define _pcre_utf8_table1      utf8_table1  #define _pcre_utf8_table1      utf8_table1
103  #define _pcre_utf8_table1_size utf8_table1_size  #define _pcre_utf8_table1_size utf8_table1_size
104  #define _pcre_utf8_table2      utf8_table2  #define _pcre_utf8_table2      utf8_table2
# Line 1250  while (!done) Line 1256  while (!done)
1256          if (strncmp((char *)pp, "JS>", 3) == 0)          if (strncmp((char *)pp, "JS>", 3) == 0)
1257            {            {
1258            options |= PCRE_JAVASCRIPT_COMPAT;            options |= PCRE_JAVASCRIPT_COMPAT;
1259            pp += 3;            pp += 3;
1260            }            }
1261          else          else
1262            {            {
1263            int x = check_newline(pp, outfile);            int x = check_newline(pp, outfile);
1264            if (x == 0) goto SKIP_DATA;            if (x == 0) goto SKIP_DATA;
1265            options |= x;            options |= x;
1266            while (*pp++ != '>');            while (*pp++ != '>');
1267            }            }
1268          }          }
1269        break;        break;
1270    
# Line 1800  while (!done) Line 1806  while (!done)
1806              {              {
1807              unsigned char buff8[8];              unsigned char buff8[8];
1808              int ii, utn;              int ii, utn;
1809              utn = ord2utf8(c, buff8);              if (use_utf8)
1810              for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii];                {
1811              c = buff8[ii];   /* Last byte */                utn = ord2utf8(c, buff8);
1812                  for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii];
1813                  c = buff8[ii];   /* Last byte */
1814                  }
1815                else
1816                 {
1817                 if (c > 255)
1818                   fprintf(outfile, "** Character \\x{%x} is greater than 255 and "
1819                     "UTF-8 mode is not enabled.\n"
1820                     "** Truncation will probably give the wrong result.\n", c);
1821                 }
1822              p = pt + 1;              p = pt + 1;
1823              break;              break;
1824              }              }
# Line 2011  while (!done) Line 2027  while (!done)
2027        }        }
2028      *q = 0;      *q = 0;
2029      len = q - dbuffer;      len = q - dbuffer;
2030    
2031        /* Move the data to the end of the buffer so that a read over the end of
2032        the buffer will be seen by valgrind, even if it doesn't cause a crash. If
2033        we are using the POSIX interface, we must include the terminating zero. */
2034    
2035    #if !defined NOPOSIX
2036        if (posix || do_posix)
2037          {
2038          memmove(bptr + buffer_size - len - 1, bptr, len + 1);
2039          bptr += buffer_size - len - 1;
2040          }
2041        else
2042    #endif
2043          {
2044          memmove(bptr + buffer_size - len, bptr, len);
2045          bptr += buffer_size - len;
2046          }
2047    
2048      if ((all_use_dfa || use_dfa) && find_match_limit)      if ((all_use_dfa || use_dfa) && find_match_limit)
2049        {        {

Legend:
Removed from v.336  
changed lines
  Added in v.363

  ViewVC Help
Powered by ViewVC 1.1.5