forked from aegis/pyserveX
209 lines
5.8 KiB
Cython
209 lines
5.8 KiB
Cython
# cython: language_level=3
|
|
|
|
from libc.stdint cimport uint8_t, uint32_t, int32_t
|
|
from libc.stddef cimport size_t
|
|
|
|
cdef extern from "pcre2.h":
|
|
pass
|
|
|
|
cdef extern from *:
|
|
ctypedef struct pcre2_code_8:
|
|
pass
|
|
ctypedef pcre2_code_8 pcre2_code
|
|
|
|
ctypedef struct pcre2_match_data_8:
|
|
pass
|
|
ctypedef pcre2_match_data_8 pcre2_match_data
|
|
|
|
ctypedef struct pcre2_compile_context_8:
|
|
pass
|
|
ctypedef pcre2_compile_context_8 pcre2_compile_context
|
|
|
|
ctypedef struct pcre2_match_context_8:
|
|
pass
|
|
ctypedef pcre2_match_context_8 pcre2_match_context
|
|
|
|
ctypedef struct pcre2_general_context_8:
|
|
pass
|
|
ctypedef pcre2_general_context_8 pcre2_general_context
|
|
|
|
ctypedef uint8_t PCRE2_UCHAR
|
|
ctypedef const uint8_t* PCRE2_SPTR
|
|
ctypedef size_t PCRE2_SIZE
|
|
|
|
uint32_t PCRE2_CASELESS
|
|
uint32_t PCRE2_MULTILINE
|
|
uint32_t PCRE2_DOTALL
|
|
uint32_t PCRE2_UTF
|
|
uint32_t PCRE2_UCP
|
|
uint32_t PCRE2_NO_UTF_CHECK
|
|
uint32_t PCRE2_ANCHORED
|
|
uint32_t PCRE2_ENDANCHORED
|
|
|
|
uint32_t PCRE2_JIT_COMPLETE
|
|
uint32_t PCRE2_JIT_PARTIAL_SOFT
|
|
uint32_t PCRE2_JIT_PARTIAL_HARD
|
|
|
|
int PCRE2_ERROR_NOMATCH
|
|
int PCRE2_ERROR_PARTIAL
|
|
int PCRE2_ERROR_JIT_STACKLIMIT
|
|
|
|
PCRE2_SIZE PCRE2_UNSET
|
|
PCRE2_SIZE PCRE2_ZERO_TERMINATED
|
|
|
|
pcre2_code* pcre2_compile_8(
|
|
PCRE2_SPTR pattern,
|
|
PCRE2_SIZE length,
|
|
uint32_t options,
|
|
int* errorcode,
|
|
PCRE2_SIZE* erroroffset,
|
|
pcre2_compile_context* ccontext
|
|
)
|
|
|
|
void pcre2_code_free_8(pcre2_code* code)
|
|
|
|
int pcre2_jit_compile_8(pcre2_code* code, uint32_t options)
|
|
|
|
pcre2_match_data* pcre2_match_data_create_from_pattern_8(
|
|
const pcre2_code* code,
|
|
pcre2_general_context* gcontext
|
|
)
|
|
|
|
pcre2_match_data* pcre2_match_data_create_8(
|
|
uint32_t ovecsize,
|
|
pcre2_general_context* gcontext
|
|
)
|
|
|
|
void pcre2_match_data_free_8(pcre2_match_data* match_data)
|
|
|
|
int pcre2_match_8(
|
|
const pcre2_code* code,
|
|
PCRE2_SPTR subject,
|
|
PCRE2_SIZE length,
|
|
PCRE2_SIZE startoffset,
|
|
uint32_t options,
|
|
pcre2_match_data* match_data,
|
|
pcre2_match_context* mcontext
|
|
)
|
|
|
|
int pcre2_jit_match_8(
|
|
const pcre2_code* code,
|
|
PCRE2_SPTR subject,
|
|
PCRE2_SIZE length,
|
|
PCRE2_SIZE startoffset,
|
|
uint32_t options,
|
|
pcre2_match_data* match_data,
|
|
pcre2_match_context* mcontext
|
|
)
|
|
|
|
PCRE2_SIZE* pcre2_get_ovector_pointer_8(pcre2_match_data* match_data)
|
|
uint32_t pcre2_get_ovector_count_8(pcre2_match_data* match_data)
|
|
|
|
int pcre2_pattern_info_8(
|
|
const pcre2_code* code,
|
|
uint32_t what,
|
|
void* where
|
|
)
|
|
|
|
uint32_t PCRE2_INFO_CAPTURECOUNT
|
|
uint32_t PCRE2_INFO_NAMECOUNT
|
|
uint32_t PCRE2_INFO_NAMETABLE
|
|
uint32_t PCRE2_INFO_NAMEENTRYSIZE
|
|
uint32_t PCRE2_INFO_JITSIZE
|
|
|
|
int pcre2_get_error_message_8(
|
|
int errorcode,
|
|
PCRE2_UCHAR* buffer,
|
|
PCRE2_SIZE bufflen
|
|
)
|
|
|
|
int pcre2_substring_copy_byname_8(
|
|
pcre2_match_data* match_data,
|
|
PCRE2_SPTR name,
|
|
PCRE2_UCHAR* buffer,
|
|
PCRE2_SIZE* bufflen
|
|
)
|
|
|
|
int pcre2_substring_copy_bynumber_8(
|
|
pcre2_match_data* match_data,
|
|
uint32_t number,
|
|
PCRE2_UCHAR* buffer,
|
|
PCRE2_SIZE* bufflen
|
|
)
|
|
|
|
int pcre2_substring_get_byname_8(
|
|
pcre2_match_data* match_data,
|
|
PCRE2_SPTR name,
|
|
PCRE2_UCHAR** bufferptr,
|
|
PCRE2_SIZE* bufflen
|
|
)
|
|
|
|
int pcre2_substring_get_bynumber_8(
|
|
pcre2_match_data* match_data,
|
|
uint32_t number,
|
|
PCRE2_UCHAR** bufferptr,
|
|
PCRE2_SIZE* bufflen
|
|
)
|
|
|
|
void pcre2_substring_free_8(PCRE2_UCHAR* buffer)
|
|
|
|
|
|
cdef inline pcre2_code* pcre2_compile(
|
|
PCRE2_SPTR pattern,
|
|
PCRE2_SIZE length,
|
|
uint32_t options,
|
|
int* errorcode,
|
|
PCRE2_SIZE* erroroffset,
|
|
pcre2_compile_context* ccontext
|
|
) noexcept:
|
|
return pcre2_compile_8(pattern, length, options, errorcode, erroroffset, ccontext)
|
|
|
|
cdef inline void pcre2_code_free(pcre2_code* code) noexcept:
|
|
pcre2_code_free_8(code)
|
|
|
|
cdef inline int pcre2_jit_compile(pcre2_code* code, uint32_t options) noexcept:
|
|
return pcre2_jit_compile_8(code, options)
|
|
|
|
cdef inline pcre2_match_data* pcre2_match_data_create_from_pattern(
|
|
const pcre2_code* code,
|
|
pcre2_general_context* gcontext
|
|
) noexcept:
|
|
return pcre2_match_data_create_from_pattern_8(code, gcontext)
|
|
|
|
cdef inline void pcre2_match_data_free(pcre2_match_data* match_data) noexcept:
|
|
pcre2_match_data_free_8(match_data)
|
|
|
|
cdef inline int pcre2_match(
|
|
const pcre2_code* code,
|
|
PCRE2_SPTR subject,
|
|
PCRE2_SIZE length,
|
|
PCRE2_SIZE startoffset,
|
|
uint32_t options,
|
|
pcre2_match_data* match_data,
|
|
pcre2_match_context* mcontext
|
|
) noexcept:
|
|
return pcre2_match_8(code, subject, length, startoffset, options, match_data, mcontext)
|
|
|
|
cdef inline int pcre2_jit_match(
|
|
const pcre2_code* code,
|
|
PCRE2_SPTR subject,
|
|
PCRE2_SIZE length,
|
|
PCRE2_SIZE startoffset,
|
|
uint32_t options,
|
|
pcre2_match_data* match_data,
|
|
pcre2_match_context* mcontext
|
|
) noexcept:
|
|
return pcre2_jit_match_8(code, subject, length, startoffset, options, match_data, mcontext)
|
|
|
|
cdef inline PCRE2_SIZE* pcre2_get_ovector_pointer(pcre2_match_data* match_data) noexcept:
|
|
return pcre2_get_ovector_pointer_8(match_data)
|
|
|
|
cdef inline uint32_t pcre2_get_ovector_count(pcre2_match_data* match_data) noexcept:
|
|
return pcre2_get_ovector_count_8(match_data)
|
|
|
|
cdef inline int pcre2_pattern_info(const pcre2_code* code, uint32_t what, void* where) noexcept:
|
|
return pcre2_pattern_info_8(code, what, where)
|
|
|
|
cdef inline int pcre2_get_error_message(int errorcode, PCRE2_UCHAR* buffer, PCRE2_SIZE bufflen) noexcept:
|
|
return pcre2_get_error_message_8(errorcode, buffer, bufflen)
|