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