Types
HsAllocFunc = proc (size: csize_t): pointer {.cdecl.}
HsCompileError {.importc: "hs_compile_error_t", header: "hs/hs_compile.h", bycopy.} = object message*: cstring expression*: cint
HsDatabase {.importc: "hs_database_t", header: "hs/hs.h", incompleteStruct, byCopy.} = object
HsDatabasePtr = ptr HsDatabase
HsError = cint
HsExprExt {.importc: "hs_expr_ext_t", header: "hs/hs_compile.h", bycopy.} = object flags*: culonglong min_offset*: culonglong max_offset*: culonglong min_length*: culonglong edit_distance*: cuint hamming_distance*: cuint
HsExprExtPtr = ptr HsExprExt
HsExprInfo {.importc: "hs_expr_info_t", header: "hs/hs_compile.h", bycopy.} = object min_width*: cuint max_width*: cuint unordered_matches*: cchar matches_at_eod*: cchar matches_only_at_eod*: cchar
HsExprInfoPtr = ptr HsExprInfo
HsFreeFunc = proc (p: pointer) {.cdecl.}
HsPlatformInfo {.importc: "hs_platform_info_t", header: "hs/hs_compile.h", bycopy.} = object tune*: cuint cpu_features*: culonglong reserved1*: culonglong reserved2*: culonglong
HsScratch {.importc: "hs_scratch_t", header: "hs/hs_runtime.h", incompleteStruct.} = object
HsScratchPtr = ptr HsScratch
HsStream {.importc: "hs_stream_t", header: "hs/hs_runtime.h", incompleteStruct.} = object
HsStreamPtr = ptr HsStream
MatchEventHandler = proc (id: cuint; fromOffset: culonglong; toOffset: culonglong; flags: cuint; context: pointer): cint {. cdecl.}
Consts
HS_ARCH_ERROR = -11'i32
HS_BAD_ALIGN = -8'i32
HS_BAD_ALLOC = -9'i32
HS_COMPILER_ERROR = -4'i32
HS_CPU_FEATURES_AVX2 = 4'u64
HS_CPU_FEATURES_AVX512 = 8'u64
HS_CPU_FEATURES_AVX512VBMI = 16'u64
HS_DB_MODE_ERROR = -7'i32
HS_DB_PLATFORM_ERROR = -6'i32
HS_DB_VERSION_ERROR = -5'i32
HS_EXT_FLAG_HAMMING_DISTANCE = 16'u
HS_EXT_FLAG_MAX_OFFSET = 2'u
HS_EXT_FLAG_MIN_LENGTH = 4'u
HS_EXT_FLAG_MIN_OFFSET = 1'u
HS_FLAG_ALLOWEMPTY = 16'u
HS_FLAG_CASELESS = 1'u
HS_FLAG_COMBINATION = 512'u
HS_FLAG_DOTALL = 2'u
HS_FLAG_MULTILINE = 4'u
HS_FLAG_PREFILTER = 128'u
HS_FLAG_QUIET = 1024'u
HS_FLAG_SINGLEMATCH = 8'u
HS_FLAG_SOM_LEFTMOST = 256'u
HS_FLAG_UCP = 64'u
HS_FLAG_UTF8 = 32'u
HS_INSUFFICIENT_SPACE = -12'i32
HS_INVALID = -1'i32
HS_MODE_BLOCK = 1'u
HS_MODE_NOSTREAM = 1'u
HS_MODE_SOM_HORIZON_LARGE = 16777216'u32
HS_MODE_SOM_HORIZON_MEDIUM = 33554432'u32
HS_MODE_SOM_HORIZON_SMALL = 67108864'u32
HS_MODE_STREAM = 2'u
HS_MODE_VECTORED = 4'u
HS_NOMEM = -2'i32
HS_OFFSET_PAST_HORIZON = 18446744073709551615'u64
HS_SCAN_TERMINATED = -3'i32
HS_SCRATCH_IN_USE = -10'i32
HS_SUCCESS = 0'i32
HS_TUNE_FAMILY_BDW = 5'u
HS_TUNE_FAMILY_GENERIC = 0'u
HS_TUNE_FAMILY_GLM = 8'u
HS_TUNE_FAMILY_HSW = 3'u
HS_TUNE_FAMILY_ICL = 9'u
HS_TUNE_FAMILY_ICX = 10'u
HS_TUNE_FAMILY_IVB = 2'u
HS_TUNE_FAMILY_SKL = 6'u
HS_TUNE_FAMILY_SKX = 7'u
HS_TUNE_FAMILY_SLM = 4'u
HS_TUNE_FAMILY_SNB = 1'u
HS_UNKNOWN_ERROR = -13'i32
Procs
proc hs_alloc_scratch(db: HsDatabasePtr; scratch: ptr HsScratchPtr): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_clone_scratch(src: HsScratchPtr; dest: ptr HsScratchPtr): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_close_stream(id: HsStreamPtr; scratch: HsScratchPtr; onEvent: MatchEventHandler; ctxt: pointer): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_compile(expression: cstring; flags: cuint; mode: cuint; platform: HsPlatformInfoPtr; db: ptr HsDatabasePtr; error: ptr HsCompileErrorPtr): HsError {.importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_compile_ext_multi(expressions: ptr cstring; flags: ptr cuint; ids: ptr cuint; ext: ptr ptr HsExprExt; elements: cuint; mode: cuint; platform: HsPlatformInfoPtr; db: ptr HsDatabasePtr; error: ptr HsCompileErrorPtr): HsError {.importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_compile_lit(expression: cstring; flags: cuint; len: csize_t; mode: cuint; platform: HsPlatformInfoPtr; db: ptr HsDatabasePtr; error: ptr HsCompileErrorPtr): HsError {. importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_compile_lit_multi(expressions: ptr cstring; flags: ptr cuint; ids: ptr cuint; lens: ptr csize_t; elements: cuint; mode: cuint; platform: HsPlatformInfoPtr; db: ptr HsDatabasePtr; error: ptr HsCompileErrorPtr): HsError {. importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_compile_multi(expressions: ptr cstring; flags: ptr cuint; ids: ptr cuint; elements: cuint; mode: cuint; platform: HsPlatformInfoPtr; db: ptr HsDatabasePtr; error: ptr HsCompileErrorPtr): HsError {.importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_compress_stream(stream: HsStreamPtr; buf: ptr UncheckedArray[byte]; buf_space: csize_t; used_space: ptr csize_t): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_copy_stream(to_id: ptr HsStreamPtr; from_id: HsStreamPtr): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_database_info(database: HsDatabasePtr; info: ptr cstring): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_database_size(database: HsDatabasePtr; database_size: ptr csize_t): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_deserialize_database(bytes: cstring; length: csize_t; db: ptr HsDatabasePtr): HsError {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_deserialize_database_at(bytes: cstring; length: csize_t; db: HsDatabasePtr): HsError {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_expand_stream(db: HsDatabasePtr; stream: ptr HsStreamPtr; buf: ptr UncheckedArray[byte]; buf_size: csize_t): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_expression_ext_info(expression: cstring; flags: cuint; ext: HsExprExtPtr; info: ptr HsExprInfoPtr; error: ptr HsCompileErrorPtr): HsError {.importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_expression_info(expression: cstring; flags: cuint; info: ptr HsExprInfoPtr; error: ptr HsCompileErrorPtr): HsError {. importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_free_compile_error(error: HsCompileErrorPtr): HsError {.importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_free_database(db: HsDatabasePtr): HsError {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_free_scratch(scratch: HsScratchPtr): HsError {.importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_open_stream(db: HsDatabasePtr; flags: cuint; stream: ptr HsStreamPtr): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_populate_platform(platform: HsPlatformInfoPtr): HsError {.importc, header: "hs/hs_compile.h", ...raises: [], tags: [], forbids: [].}
proc hs_reset_and_copy_stream(to_id: HsStreamPtr; from_id: HsStreamPtr; scratch: HsScratchPtr; onEvent: MatchEventHandler; context: pointer): HsError {.importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_reset_and_expand_stream(to_stream: HsStreamPtr; buf: ptr UncheckedArray[byte]; buf_size: csize_t; scratch: HsScratchPtr; onEvent: MatchEventHandler; context: pointer): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_reset_stream(id: HsStreamPtr; flags: cuint; scratch: HsScratchPtr; onEvent: MatchEventHandler; context: pointer): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_scan(db: HsDatabasePtr; data: cstring; length: cuint; flags: cuint; scratch: HsScratchPtr; onEvent: MatchEventHandler; context: pointer): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_scan_stream(id: HsStreamPtr; data: cstring; length: cuint; flags: cuint; scratch: HsScratchPtr; onEvent: MatchEventHandler; ctxt: pointer): HsError {.importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_scan_vector(db: HsDatabasePtr; data: ptr cstring; length: ptr cuint; count: cuint; flags: cuint; scratch: HsScratchPtr; onEvent: MatchEventHandler; context: pointer): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_scratch_size(scratch: HsScratchPtr; scratch_size: ptr csize_t): HsError {. importc, header: "hs/hs_runtime.h", ...raises: [], tags: [], forbids: [].}
proc hs_serialize_database(db: HsDatabasePtr; bytes: ptr cstring; length: ptr csize_t): HsError {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_serialized_database_info(bytes: cstring; length: csize_t; info: ptr cstring): HsError {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_serialized_database_size(bytes: cstring; length: csize_t; deserialized_size: ptr csize_t): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_set_allocator(alloc_func: HsAllocFunc; free_func: HsFreeFunc): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_set_database_allocator(alloc_func: HsAllocFunc; free_func: HsFreeFunc): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_set_misc_allocator(alloc_func: HsAllocFunc; free_func: HsFreeFunc): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_set_scratch_allocator(alloc_func: HsAllocFunc; free_func: HsFreeFunc): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_set_stream_allocator(alloc_func: HsAllocFunc; free_func: HsFreeFunc): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_stream_size(database: HsDatabasePtr; stream_size: ptr csize_t): HsError {. importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_valid_platform(): HsError {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}
proc hs_version(): cstring {.importc, header: "hs/hs.h", ...raises: [], tags: [], forbids: [].}