]> gitweb.factorcode.org Git - factor.git/blob - extra/pcre/ffi/ffi.factor
factor: more top level forms.
[factor.git] / extra / pcre / ffi / ffi.factor
1 USING: alien alien.c-types alien.libraries alien.syntax
2 classes.struct combinators system vocabs.platforms ;
3 IN: pcre.ffi
4
5 LIBRARY-UNIX: pcre cdecl "pcre.so"
6 LIBRARY-MACOSX: pcre cdecl "libpcre.dylib"
7 LIBRARY-WINDOWS: pcre cdecl "libpcre.dll"
8
9 LIBRARY: pcre
10
11 CONSTANT: PCRE_CASELESS           0x00000001
12 CONSTANT: PCRE_MULTILINE          0x00000002
13 CONSTANT: PCRE_DOTALL             0x00000004
14 CONSTANT: PCRE_EXTENDED           0x00000008
15 CONSTANT: PCRE_ANCHORED           0x00000010
16 CONSTANT: PCRE_DOLLAR_ENDONLY     0x00000020
17 CONSTANT: PCRE_EXTRA              0x00000040
18 CONSTANT: PCRE_NOTBOL             0x00000080
19 CONSTANT: PCRE_NOTEOL             0x00000100
20 CONSTANT: PCRE_UNGREEDY           0x00000200
21 CONSTANT: PCRE_NOTEMPTY           0x00000400
22 CONSTANT: PCRE_UTF8               0x00000800
23 CONSTANT: PCRE_NO_AUTO_CAPTURE    0x00001000
24 CONSTANT: PCRE_NO_UTF8_CHECK      0x00002000
25 CONSTANT: PCRE_AUTO_CALLOUT       0x00004000
26 CONSTANT: PCRE_PARTIAL_SOFT       0x00008000
27 CONSTANT: PCRE_PARTIAL            0x00008000
28 CONSTANT: PCRE_DFA_SHORTEST       0x00010000
29 CONSTANT: PCRE_DFA_RESTART        0x00020000
30 CONSTANT: PCRE_FIRSTLINE          0x00040000
31 CONSTANT: PCRE_DUPNAMES           0x00080000
32 CONSTANT: PCRE_NEWLINE_CR         0x00100000
33 CONSTANT: PCRE_NEWLINE_LF         0x00200000
34 CONSTANT: PCRE_NEWLINE_CRLF       0x00300000
35 CONSTANT: PCRE_NEWLINE_ANY        0x00400000
36 CONSTANT: PCRE_NEWLINE_ANYCRLF    0x00500000
37 CONSTANT: PCRE_BSR_ANYCRLF        0x00800000
38 CONSTANT: PCRE_BSR_UNICODE        0x01000000
39 CONSTANT: PCRE_JAVASCRIPT_COMPAT  0x02000000
40 CONSTANT: PCRE_NO_START_OPTIMIZE  0x04000000
41 CONSTANT: PCRE_NO_START_OPTIMISE  0x04000000
42 CONSTANT: PCRE_PARTIAL_HARD       0x08000000
43 CONSTANT: PCRE_NOTEMPTY_ATSTART   0x10000000
44 ! New in 8.10
45 CONSTANT: PCRE_UCP                0x20000000
46
47 ENUM: PCRE_ERRORS
48     { PCRE_ERROR_NOMATCH         -1 }
49     { PCRE_ERROR_NULL            -2 }
50     { PCRE_ERROR_BADOPTION       -3 }
51     { PCRE_ERROR_BADMAGIC        -4 }
52     { PCRE_ERROR_UNKNOWN_OPCODE  -5 }
53     { PCRE_ERROR_UNKNOWN_NODE    -5 }
54     { PCRE_ERROR_NOMEMORY        -6 }
55     { PCRE_ERROR_NOSUBSTRING     -7 }
56     { PCRE_ERROR_MATCHLIMIT      -8 }
57     { PCRE_ERROR_CALLOUT         -9 }
58     { PCRE_ERROR_BADUTF8        -10 }
59     { PCRE_ERROR_BADUTF8_OFFSET -11 }
60     { PCRE_ERROR_PARTIAL        -12 }
61     { PCRE_ERROR_BADPARTIAL     -13 }
62     { PCRE_ERROR_INTERNAL       -14 }
63     { PCRE_ERROR_BADCOUNT       -15 }
64     { PCRE_ERROR_DFA_UITEM      -16 }
65     { PCRE_ERROR_DFA_UCOND      -17 }
66     { PCRE_ERROR_DFA_UMLIMIT    -18 }
67     { PCRE_ERROR_DFA_WSSIZE     -19 }
68     { PCRE_ERROR_DFA_RECURSE    -20 }
69     { PCRE_ERROR_RECURSIONLIMIT -21 }
70     { PCRE_ERROR_NULLWSLIMIT    -22 }
71     { PCRE_ERROR_BADNEWLINE     -23 }
72     { PCRE_ERROR_BADOFFSET      -24 }
73     { PCRE_ERROR_SHORTUTF8      -25 } ;
74
75 CONSTANT: PCRE_INFO_OPTIONS            0
76 CONSTANT: PCRE_INFO_SIZE               1
77 CONSTANT: PCRE_INFO_CAPTURECOUNT       2
78 CONSTANT: PCRE_INFO_BACKREFMAX         3
79 CONSTANT: PCRE_INFO_FIRSTBYTE          4
80 CONSTANT: PCRE_INFO_FIRSTCHAR          4
81 CONSTANT: PCRE_INFO_FIRSTTABLE         5
82 CONSTANT: PCRE_INFO_LASTLITERAL        6
83 CONSTANT: PCRE_INFO_NAMEENTRYSIZE      7
84 CONSTANT: PCRE_INFO_NAMECOUNT          8
85 CONSTANT: PCRE_INFO_NAMETABLE          9
86 CONSTANT: PCRE_INFO_STUDYSIZE         10
87 CONSTANT: PCRE_INFO_DEFAULT_TABLES    11
88 CONSTANT: PCRE_INFO_OKPARTIAL         12
89 CONSTANT: PCRE_INFO_JCHANGED          13
90 CONSTANT: PCRE_INFO_HASCRORLF         14
91 CONSTANT: PCRE_INFO_MINLENGTH         15
92
93 CONSTANT: PCRE_CONFIG_UTF8                    0
94 CONSTANT: PCRE_CONFIG_NEWLINE                 1
95 CONSTANT: PCRE_CONFIG_LINK_SIZE               2
96 CONSTANT: PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
97 CONSTANT: PCRE_CONFIG_MATCH_LIMIT             4
98 CONSTANT: PCRE_CONFIG_STACKRECURSE            5
99 CONSTANT: PCRE_CONFIG_UNICODE_PROPERTIES      6
100 CONSTANT: PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
101 CONSTANT: PCRE_CONFIG_BSR                     8
102 CONSTANT: PCRE_CONFIG_JIT                     9
103 CONSTANT: PCRE_CONFIG_UTF16                  10
104 CONSTANT: PCRE_CONFIG_JITTARGET              11
105 CONSTANT: PCRE_CONFIG_UTF32                  12
106
107 STRUCT: pcre_extra
108     { flags ulonglong }
109     { study_data void* }
110     { match_limit ulonglong }
111     { callout_data void* }
112     { tables uchar* }
113     { match_limit_recursion ulonglong }
114     { mark uchar** }
115     { executable_jit void* } ;
116
117 FUNCTION: int pcre_config ( int what, void* where )
118
119 FUNCTION: void* pcre_compile ( c-string pattern,
120                                int options,
121                                char** errptr,
122                                int* erroffset,
123                                char* tableptr )
124
125 FUNCTION: void* pcre_compile2 ( c-string pattern,
126                                 int options,
127                                 int* errcodeptr,
128                                 char** errptr,
129                                 int* erroffset,
130                                 char* tableptr )
131
132 FUNCTION: int pcre_info ( void* pcre, int* optptr, int* first_byte )
133 FUNCTION: int pcre_fullinfo ( void* pcre,
134                               pcre_extra* extra,
135                               int what, void *where )
136
137 FUNCTION: pcre_extra* pcre_study ( void* pcre, int options, char** errptr )
138 FUNCTION: int pcre_exec ( void* pcre,
139                           pcre_extra* extra,
140                           c-string subject,
141                           int length,
142                           int startoffset,
143                           int options,
144                           int* ovector,
145                           int ovecsize )
146
147 FUNCTION: int pcre_get_stringnumber ( void* pcre, c-string name )
148
149 FUNCTION: int pcre_get_substring ( c-string subject,
150                                    int* ovector,
151                                    int stringcount,
152                                    int stringnumber,
153                                    void *stringptr )
154
155 FUNCTION: int pcre_get_substring_list ( c-string subject,
156                                         int* ovector,
157                                         int stringcount,
158                                         void *stringptr )
159
160 FUNCTION: c-string pcre_version ( )
161
162 FUNCTION: uchar* pcre_maketables ( )
163
164 FUNCTION: void pcre_free ( void* pcre )