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

Diff of /code/trunk/pcre_newline.c

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

revision 149 by ph10, Mon Apr 16 15:28:08 2007 UTC revision 305 by ph10, Sun Jan 20 20:07:32 2008 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-2007 University of Cambridge             Copyright (c) 1997-2008 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 38  POSSIBILITY OF SUCH DAMAGE. Line 38  POSSIBILITY OF SUCH DAMAGE.
38  */  */
39    
40    
41  /* This module contains internal functions for testing newlines when more than  /* This module contains internal functions for testing newlines when more than
42  one kind of newline is to be recognized. When a newline is found, its length is  one kind of newline is to be recognized. When a newline is found, its length is
43  returned. In principle, we could implement several newline "types", each  returned. In principle, we could implement several newline "types", each
44  referring to a different set of newline characters. At present, PCRE supports  referring to a different set of newline characters. At present, PCRE supports
45  only NLTYPE_FIXED, which gets handled without these functions, NLTYPE_ANYCRLF,  only NLTYPE_FIXED, which gets handled without these functions, NLTYPE_ANYCRLF,
46  and NLTYPE_ANY. The full list of Unicode newline characters is taken from  and NLTYPE_ANY. The full list of Unicode newline characters is taken from
47  http://unicode.org/unicode/reports/tr18/. */  http://unicode.org/unicode/reports/tr18/. */
48    
49    
50    #ifdef HAVE_CONFIG_H
51    #include "config.h"
52    #endif
53    
54  #include "pcre_internal.h"  #include "pcre_internal.h"
55    
56    
# Line 69  Returns: TRUE or FALSE Line 73  Returns: TRUE or FALSE
73  */  */
74    
75  BOOL  BOOL
76  _pcre_is_newline(const uschar *ptr, int type, const uschar *endptr,  _pcre_is_newline(const uschar *ptr, int type, const uschar *endptr,
77    int *lenptr, BOOL utf8)    int *lenptr, BOOL utf8)
78  {  {
79  int c;  int c;
# Line 119  Returns: TRUE or FALSE Line 123  Returns: TRUE or FALSE
123  */  */
124    
125  BOOL  BOOL
126  _pcre_was_newline(const uschar *ptr, int type, const uschar *startptr,  _pcre_was_newline(const uschar *ptr, int type, const uschar *startptr,
127    int *lenptr, BOOL utf8)    int *lenptr, BOOL utf8)
128  {  {
129  int c;  int c;
130  ptr--;  ptr--;
131    #ifdef SUPPORT_UTF8
132  if (utf8)  if (utf8)
133    {    {
134    BACKCHAR(ptr);    BACKCHAR(ptr);
135    GETCHAR(c, ptr);    GETCHAR(c, ptr);
136    }    }
137  else c = *ptr;  else c = *ptr;
138    #else   /* no UTF-8 support */
139    c = *ptr;
140    #endif  /* SUPPORT_UTF8 */
141    
142  if (type == NLTYPE_ANYCRLF) switch(c)  if (type == NLTYPE_ANYCRLF) switch(c)
143    {    {

Legend:
Removed from v.149  
changed lines
  Added in v.305

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12