/[pcre]/code/trunk/doc/pcre16.3
ViewVC logotype

Diff of /code/trunk/doc/pcre16.3

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

revision 846 by ph10, Tue Jan 3 13:57:27 2012 UTC revision 855 by ph10, Fri Jan 6 15:08:49 2012 UTC
# Line 1  Line 1 
1  .TH PCRE 3  .TH PCRE 3
2  .SH NAME  .SH NAME
3  PCRE - Perl-compatible regular expressions  PCRE - Perl-compatible regular expressions
4    .SH "PCRE 16-BIT API BASIC FUNCTIONS"
5    .rs
6    .sp
7    .B #include <pcre16.h>
8    .PP
9    .SM
10    .B pcre16 *pcre16_compile(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
11    .ti +5n
12    .B const char **\fIerrptr\fP, int *\fIerroffset\fP,
13    .ti +5n
14    .B const unsigned char *\fItableptr\fP);
15    .PP
16    .B pcre16 *pcre16_compile2(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
17    .ti +5n
18    .B int *\fIerrorcodeptr\fP,
19    .ti +5n
20    .B const char **\fIerrptr\fP, int *\fIerroffset\fP,
21    .ti +5n
22    .B const unsigned char *\fItableptr\fP);
23    .PP
24    .B pcre16_extra *pcre16_study(const pcre16 *\fIcode\fP, int \fIoptions\fP,
25    .ti +5n
26    .B const char **\fIerrptr\fP);
27    .PP
28    .B void pcre16_free_study(pcre16_extra *\fIextra\fP);
29    .PP
30    .B int pcre16_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
31    .ti +5n
32    .B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
33    .ti +5n
34    .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
35    .
36    .
37    .SH "PCRE 16-BIT API AUXILIARY FUNCTIONS"
38    .rs
39    .sp
40    .B pcre16_jit_stack *pcre16_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
41    .PP
42    .B void pcre16_jit_stack_free(pcre16_jit_stack *\fIstack\fP);
43    .PP
44    .B void pcre16_assign_jit_stack(pcre16_extra *\fIextra\fP,
45    .ti +5n
46    .B pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);
47    .PP
48    .B int pcre16_dfa_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
49    .ti +5n
50    .B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
51    .ti +5n
52    .B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
53    .ti +5n
54    .B int *\fIworkspace\fP, int \fIwscount\fP);
55    .PP
56    .B int pcre16_copy_named_substring(const pcre16 *\fIcode\fP,
57    .ti +5n
58    .B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
59    .ti +5n
60    .B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
61    .ti +5n
62    .B PCRE_SCHAR16 *\fIbuffer\fP, int \fIbuffersize\fP);
63    .PP
64    .B int pcre16_copy_substring(PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
65    .ti +5n
66    .B int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_SCHAR16 *\fIbuffer\fP,
67    .ti +5n
68    .B int \fIbuffersize\fP);
69    .PP
70    .B int pcre16_get_named_substring(const pcre16 *\fIcode\fP,
71    .ti +5n
72    .B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
73    .ti +5n
74    .B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
75    .ti +5n
76    .B PCRE_SPTR16 *\fIstringptr\fP);
77    .PP
78    .B int pcre16_get_stringnumber(const pcre16 *\fIcode\fP,
79    .ti +5n
80    .B PCRE_SPTR16 \fIname\fP);
81    .PP
82    .B int pcre16_get_stringtable_entries(const pcre16 *\fIcode\fP,
83    .ti +5n
84    .B PCRE_SPTR16 \fIname\fP, PCRE_SCHAR16 **\fIfirst\fP, PCRE_SCHAR16 **\fIlast\fP);
85    .PP
86    .B int pcre16_get_substring(PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
87    .ti +5n
88    .B int \fIstringcount\fP, int \fIstringnumber\fP,
89    .ti +5n
90    .B PCRE_SPTR16 *\fIstringptr\fP);
91    .PP
92    .B int pcre16_get_substring_list(PCRE_SPTR16 \fIsubject\fP,
93    .ti +5n
94    .B int *\fIovector\fP, int \fIstringcount\fP, "PCRE_SPTR16 **\fIlistptr\fP);"
95    .PP
96    .B void pcre16_free_substring(PCRE_SPTR16 \fIstringptr\fP);
97    .PP
98    .B void pcre16_free_substring_list(PCRE_SPTR16 *\fIstringptr\fP);
99    .PP
100    .B const unsigned char *pcre16_maketables(void);
101    .PP
102    .B int pcre16_fullinfo(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
103    .ti +5n
104    .B int \fIwhat\fP, void *\fIwhere\fP);
105    .PP
106    .B int pcre16_refcount(pcre16 *\fIcode\fP, int \fIadjust\fP);
107    .PP
108    .B int pcre16_config(int \fIwhat\fP, void *\fIwhere\fP);
109    .PP
110    .B const char *pcre16_version(void);
111    .
112    .
113    .SH "PCRE 16-BIT API INDIRECTED FUNCTIONS"
114    .rs
115    .sp
116    .B void *(*pcre16_malloc)(size_t);
117    .PP
118    .B void (*pcre16_free)(void *);
119    .PP
120    .B void *(*pcre16_stack_malloc)(size_t);
121    .PP
122    .B void (*pcre16_stack_free)(void *);
123    .PP
124    .B int (*pcre16_callout)(pcre16_callout_block *);
125    .
126    .
127    .SH "PCRE 16-BIT API 16-BIT-ONLY FUNCTION"
128    .rs
129    .sp
130    .B int pcre16_utf16_to_host_byte_order(PCRE_SCHAR16 *\fIoutput\fP,
131    .ti +5n
132    .B PCRE_SPTR16 \fIinput\fP, int \fIlength\fP, int *\fIbyte_order\fP,
133    .ti +5n
134    .B int \fIkeep_boms\fP);
135    .
136    .
137  .SH "THE PCRE 16-BIT LIBRARY"  .SH "THE PCRE 16-BIT LIBRARY"
138  .rs  .rs
139  .sp  .sp
# Line 9  supports 16-bit character strings, inclu Line 142  supports 16-bit character strings, inclu
142  instead of the original 8-bit library. The majority of the work to make this  instead of the original 8-bit library. The majority of the work to make this
143  possible was done by Zoltan Herczeg. The two libraries contain identical sets  possible was done by Zoltan Herczeg. The two libraries contain identical sets
144  of functions, used in exactly the same way. Only the names of the functions and  of functions, used in exactly the same way. Only the names of the functions and
145  the data types of their string arguments are different. To avoid  the data types of their arguments and results are different. To avoid
146  over-complication and reduce the documentation maintenance load, most of the  over-complication and reduce the documentation maintenance load, most of the
147  documentation describes the 8-bit library, with only occasional references to  PCRE documentation describes the 8-bit library, with only occasional references
148  the 16-bit library. This page describes what is different when you use the  to the 16-bit library. This page describes what is different when you use the
149  16-bit library.  16-bit library.
150  .P  .P
151  WARNING: A single application can be linked with both libraries, but you must  WARNING: A single application can be linked with both libraries, but you must
# Line 27  library. For example, if you want to stu Line 160  library. For example, if you want to stu
160  .rs  .rs
161  .sp  .sp
162  There is only one header file, \fBpcre.h\fP. It contains prototypes for all the  There is only one header file, \fBpcre.h\fP. It contains prototypes for all the
163  functions in both libraries, as well as definitions of flags, error codes, etc.  functions in both libraries, as well as definitions of flags, structures, error
164    codes, etc.
165    .
166    .
167    .SH "THE LIBRARY NAME"
168    .rs
169    .sp
170    In Unix-like systems, the 16-bit library is called \fBlibpcre16\fP, and can
171    normally be accesss by adding \fB-lpcre16\fP to the command for linking an
172    application that uses PCRE.
173  .  .
174  .  .
175  .SH "STRING TYPES"  .SH "STRING TYPES"
# Line 43  data type. If it is not, the build fails Line 185  data type. If it is not, the build fails
185  maintainer to modify the definition appropriately.  maintainer to modify the definition appropriately.
186  .  .
187  .  .
188  .SH "16-BIT FUNCTIONS WITH DIFFERING ARGUMENT TYPES"  .SH "STRUCTURE TYPES"
189    .rs
190    .sp
191    The types of the opaque structures that are used for compiled 16-bit patterns
192    and JIT stacks are \fBpcre16\fP and \fBpcre16_jit_stack\fP respectively. The
193    type of the user-accessible structure that is returned by \fBpcre16_study()\fP
194    is \fBpcre16_extra\fP, and the type of the structure that is used for passing
195    data to a callout function is \fBpcre16_callout_block\fP. These structures
196    contain the same fields, with the same names, as their 8-bit counterparts. The
197    only difference is that pointers to character strings are 16-bit instead of
198    8-bit types.
199    .
200    .
201    .SH "16-BIT FUNCTIONS"
202  .rs  .rs
203  .sp  .sp
204  For every function in the 8-bit library there is a corresponding function in  For every function in the 8-bit library there is a corresponding function in
205  the 16-bit library with a name that starts with \fBpcre16_\fP instead of  the 16-bit library with a name that starts with \fBpcre16_\fP instead of
206  \fBpcre_\fP. All of these functions have the same number of arguments, and  \fBpcre_\fP. The prototypes are listed above. In addition, there is one extra
207  yield the same results. Many of them also have exactly the same argument types.  function, \fBpcre16_utf16_to_host_byte_order()\fP. This is a utility function
208  Those that differ are as follows:  that converts a UTF-16 character string to host byte order if necessary. The
209    other 16-bit functions expect the strings they are passed to be in host byte
210  \fBpcre16_compile()\fP and \fBpcre16_compile2()\fP: the type of the first  order.
211  argument must be PCRE_SPTR16 instead of "const char *".  .P
212    The \fIlength\fP argument specifies the number of 16-bit data units in the
213  \fBpcre16_exec()\fP and \fBpcre16_dfa_exec()\fP: the type of the third argument  input string; a negative value specifies a zero-terminated string.
214  must be PCRE_SPTR16 instead of "const char *".  .P
215    If \fIbyte_order\fP is NULL, it is assumed that the string starts off in host
216  \fBpcre16_copy_named_substring()\fP: the type of the second and fifth agruments  byte order. This may be changed by byte-order marks (BOMs) anywhere in the
217  must be PCRE_SPTR16 instead of "const char *" and the type of the sixth  string (commonly as the first character).
218  argument must be "PCRE_SCHAR16 *" instead of "char *".  .P
219    If \fIbyte_order\fP is not NULL, a non-zero value of the integer to which it
220  \fBpcre16_copy_substring()\fP: the type of the first argument must be  points means that the input starts off in host byte order, otherwise the
221  PCRE_SPTR16 instead of "const char *" and the type of the fifth argument must  opposite order is assumed. Again, BOMs in the string can change this. The final
222  be "PCRE_SCHAR16 *" instead of "char *".  byte order is passed back at the end of processing.
223    .P
224  \fBpcre16_get_named_substring()\fP: the type of the second and fifth agruments  If \fIkeep_boms\fP is non zero, byte-order mark characters (0xfeff) are copied
225  must be PCRE_SPTR16 instead of "const char *" and the type of the sixth  into the output string. Otherwise they are discarded.
226  argument must be "PCRE_SPTR16 *" instead of "const char **".  .P
227    The result of the function is the number of 16-bit units placed into the output
228  \fBpcre16_get_substring()\fP: the type of the first argument must be  buffer, including the zero terminator if the string was zero-terminated.
 PCRE_SPTR16 instead of "const char *" and the type of the fifth argument must  
 be "PCRE_SPTR16 *" intead of "const char **".  
   
 \fBpcre16_free_substring()\fP: the type of the argument must be PCRE_SPTR16  
 instead of "const char *".  
   
 \fBpcre16_get_substring_list()\fP: the type of the first argument must be  
 PCRE_SPTR16 intead of "const char *", and the type of the fourth argument must  
 be "PCRE_SPTR16 **" intead of "const char ***".  
   
 \fBpcre16_free_substring_list()\fP: the type of the argument must be  
 "PCRE_SPTR16 *" instead of "const char **".  
   
 \fBpcre16_get_stringnumber()\fP: the type of the second argument must be  
 PCRE_SPTR16 instead of "const char *".  
   
 \fBpcre16_get_stringtable_entries()\fP: the types of the second, third, and  
 fourth arguments must be PCRE_SPTR16, "PCRE_SCHAR16 **", and "PCRE_SCHAR16 **"  
 intead of "const char *", "char **", and "char **".  
229  .  .
230  .  .
231  .SH "SUBJECT STRING OFFSETS"  .SH "SUBJECT STRING OFFSETS"
# Line 105  are in 16-bit units rather than bytes. Line 241  are in 16-bit units rather than bytes.
241  The name-to-number translation table that is maintained for named subpatterns  The name-to-number translation table that is maintained for named subpatterns
242  uses 16-bit characters. The \fBpcre16_get_stringtable_entries()\fP function  uses 16-bit characters. The \fBpcre16_get_stringtable_entries()\fP function
243  returns the length of each entry in the table as the number of 16-bit data  returns the length of each entry in the table as the number of 16-bit data
244  items.  units.
245  .  .
246  .  .
247  .SH "OPTION NAMES"  .SH "OPTION NAMES"
# Line 126  given to \fBpcre_config()\fP, or if the Line 262  given to \fBpcre_config()\fP, or if the
262  .sp  .sp
263  In 16-bit mode, when PCRE_UTF16 is not set, character values are treated in the  In 16-bit mode, when PCRE_UTF16 is not set, character values are treated in the
264  same way as in 8-bit, non UTF-8 mode, except, of course, that they can range  same way as in 8-bit, non UTF-8 mode, except, of course, that they can range
265  from 0 to 0xFFFF instead of 0 to 0xFF. Character types for characters less than  from 0 to 0xffff instead of 0 to 0xff. Character types for characters less than
266  0xFF can therefore be influenced by the locale in the same way as before.  0xff can therefore be influenced by the locale in the same way as before.
267  Characters greater than 0xFF have only one case, and no "type" (such as letter  Characters greater than 0xff have only one case, and no "type" (such as letter
268  or digit).  or digit).
269  .P  .P
270  In UTF-16 mode, the character code is Unicode, in the range 0 to 0x10FFFF, with  In UTF-16 mode, the character code is Unicode, in the range 0 to 0x10ffff, with
271  the exception of values in the range 0xD800 to 0xDFFF because those are  the exception of values in the range 0xd800 to 0xdfff because those are
272  "surrogate" values that are used in pairs to encode values greater than 0xFFFF.  "surrogate" values that are used in pairs to encode values greater than 0xffff.
273  .P  .P
274  A UTF-16 string can indicate its endianness by special code knows as BOM at its  A UTF-16 string can indicate its endianness by special code knows as a
275  start. The PCRE functions do not handle this. However a function called  byte-order mark (BOM). The PCRE functions do not handle this, expecting strings
276  \fBpcre16_utf16_to_host_byte_order()\fP is provided. It checks the byte order  to be in host byte order. A utility function called
277  of a UTF-16 string and converts it if necessary, optionally removing the BOM  \fBpcre16_utf16_to_host_byte_order()\fP is provided to help with this (see
278  data. It is documented with all the other functions in the  above).
 .\" HREF  
 \fBpcreapi\fP  
 .\"  
 page.  
279  .  .
280  .  .
281  .SH "ERROR NAMES"  .SH "ERROR NAMES"
# Line 156  mode, for example, if a pattern compiled Line 288  mode, for example, if a pattern compiled
288  \fBpcre16_exec()\fP.  \fBpcre16_exec()\fP.
289  .P  .P
290  There are new error codes whose names begin with PCRE_UTF16_ERR for invalid  There are new error codes whose names begin with PCRE_UTF16_ERR for invalid
291  UTF-16 strings, corresponding to the PCRE_UTF8_ERR codes for UTF-8 strings.  UTF-16 strings, corresponding to the PCRE_UTF8_ERR codes for UTF-8 strings that
292  They are documented in the  are described in the section entitled
293    .\" HTML <a href="pcreapi.html#badutf8reasons">
294    .\" </a>
295    "Reason codes for invalid UTF-8 strings"
296    .\"
297    in the main
298  .\" HREF  .\" HREF
299  \fBpcreapi\fP  \fBpcreapi\fP
300  .\"  .\"
301  page.  page. The UTF-16 errors are:
302    .sp
303      PCRE_UTF16_ERR1  Missing low surrogate at end of string
304      PCRE_UTF16_ERR2  Invalid low surrogate follows high surrogate
305      PCRE_UTF16_ERR3  Isolated low surrogate
306      PCRE_UTF16_ERR4  Invalid character 0xfffe
307  .  .
308  .  .
309  .SH "ERROR TEXTS"  .SH "ERROR TEXTS"
# Line 217  Cambridge CB2 3QH, England. Line 359  Cambridge CB2 3QH, England.
359  .rs  .rs
360  .sp  .sp
361  .nf  .nf
362  Last updated: 03 January 2012  Last updated: 06 January 2012
363  Copyright (c) 1997-2012 University of Cambridge.  Copyright (c) 1997-2012 University of Cambridge.
364  .fi  .fi

Legend:
Removed from v.846  
changed lines
  Added in v.855

  ViewVC Help
Powered by ViewVC 1.1.5