public class hyperscan extends hyperscan
Modifier and Type | Field and Description |
---|---|
static int |
HS_ARCH_ERROR
Unsupported CPU architecture.
|
static int |
HS_BAD_ALIGN
A parameter passed to this function was not correctly aligned.
|
static int |
HS_BAD_ALLOC
The memory allocator (either malloc() or the allocator set with \ref
hs_set_allocator()) did not correctly return memory suitably aligned for the
largest representable data type on this platform.
|
static int |
HS_COMPILER_ERROR
The pattern compiler failed, and the \ref hs_compile_error_t should be
inspected for more detail.
|
static long |
HS_CPU_FEATURES_AVX2
CPU features flag - Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2)
Setting this flag indicates that the target platform supports AVX2
instructions.
|
static long |
HS_CPU_FEATURES_AVX512
CPU features flag - Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX512)
Setting this flag indicates that the target platform supports AVX512
instructions, specifically AVX-512BW.
|
static long |
HS_CPU_FEATURES_AVX512VBMI
CPU features flag - Intel(R) Advanced Vector Extensions 512
Vector Byte Manipulation Instructions (Intel(R) AVX512VBMI)
Setting this flag indicates that the target platform supports AVX512VBMI
instructions.
|
static int |
HS_DB_MODE_ERROR
The given database was built for a different mode of operation.
|
static int |
HS_DB_PLATFORM_ERROR
The given database was built for a different platform (i.e., CPU type).
|
static int |
HS_DB_VERSION_ERROR
The given database was built for a different version of Hyperscan.
|
static long |
HS_EXT_FLAG_EDIT_DISTANCE
Flag indicating that the hs_expr_ext::edit_distance field is used.
|
static long |
HS_EXT_FLAG_HAMMING_DISTANCE
Flag indicating that the hs_expr_ext::hamming_distance field is used.
|
static long |
HS_EXT_FLAG_MAX_OFFSET
Flag indicating that the hs_expr_ext::max_offset field is used.
|
static long |
HS_EXT_FLAG_MIN_LENGTH
Flag indicating that the hs_expr_ext::min_length field is used.
|
static long |
HS_EXT_FLAG_MIN_OFFSET
Flag indicating that the hs_expr_ext::min_offset field is used.
|
static int |
HS_FLAG_ALLOWEMPTY
Compile flag: Allow expressions that can match against empty buffers.
|
static int |
HS_FLAG_CASELESS
Compile flag: Set case-insensitive matching.
|
static int |
HS_FLAG_COMBINATION
Compile flag: Logical combination.
|
static int |
HS_FLAG_DOTALL
Compile flag: Matching a
. will not exclude newlines. |
static int |
HS_FLAG_MULTILINE
Compile flag: Set multi-line anchoring.
|
static int |
HS_FLAG_PREFILTER
Compile flag: Enable prefiltering mode for this expression.
|
static int |
HS_FLAG_QUIET
Compile flag: Don't do any match reporting.
|
static int |
HS_FLAG_SINGLEMATCH
Compile flag: Set single-match only mode.
|
static int |
HS_FLAG_SOM_LEFTMOST
Compile flag: Enable leftmost start of match reporting.
|
static int |
HS_FLAG_UCP
Compile flag: Enable Unicode property support for this expression.
|
static int |
HS_FLAG_UTF8
Compile flag: Enable UTF-8 mode for this expression.
|
static int |
HS_INSUFFICIENT_SPACE
Provided buffer was too small.
|
static int |
HS_INVALID
A parameter passed to this function was invalid.
|
static int |
HS_MAJOR
\file
\brief The complete Hyperscan API definition.
|
static int |
HS_MINOR |
static int |
HS_MODE_BLOCK
Compiler mode flag: Block scan (non-streaming) database.
|
static int |
HS_MODE_NOSTREAM
Compiler mode flag: Alias for \ref HS_MODE_BLOCK.
|
static int |
HS_MODE_SOM_HORIZON_LARGE
Compiler mode flag: use full precision to track start of match offsets in
stream state.
|
static int |
HS_MODE_SOM_HORIZON_MEDIUM
Compiler mode flag: use medium precision to track start of match offsets in
stream state.
|
static int |
HS_MODE_SOM_HORIZON_SMALL
Compiler mode flag: use limited precision to track start of match offsets in
stream state.
|
static int |
HS_MODE_STREAM
Compiler mode flag: Streaming database.
|
static int |
HS_MODE_VECTORED
Compiler mode flag: Vectored scanning database.
|
static int |
HS_NOMEM
A memory allocation failed.
|
static long |
HS_OFFSET_PAST_HORIZON
Callback 'from' return value, indicating that the start of this match was
too early to be tracked with the requested SOM_HORIZON precision.
|
static int |
HS_PATCH |
static int |
HS_SCAN_TERMINATED
The engine was terminated by callback.
|
static int |
HS_SCRATCH_IN_USE
The scratch region was already in use.
|
static int |
HS_SUCCESS
The engine completed normally.
|
static int |
HS_TUNE_FAMILY_BDW
Tuning Parameter - Intel(R) microarchitecture code name Broadwell
This indicates that the compiled database should be tuned for the
Broadwell microarchitecture.
|
static int |
HS_TUNE_FAMILY_GENERIC
Tuning Parameter - Generic
This indicates that the compiled database should not be tuned for any
particular target platform.
|
static int |
HS_TUNE_FAMILY_GLM
Tuning Parameter - Intel(R) microarchitecture code name Goldmont
This indicates that the compiled database should be tuned for the
Goldmont microarchitecture.
|
static int |
HS_TUNE_FAMILY_HSW
Tuning Parameter - Intel(R) microarchitecture code name Haswell
This indicates that the compiled database should be tuned for the
Haswell microarchitecture.
|
static int |
HS_TUNE_FAMILY_ICL
Tuning Parameter - Intel(R) microarchitecture code name Icelake
This indicates that the compiled database should be tuned for the
Icelake microarchitecture.
|
static int |
HS_TUNE_FAMILY_ICX
Tuning Parameter - Intel(R) microarchitecture code name Icelake Server
This indicates that the compiled database should be tuned for the
Icelake Server microarchitecture.
|
static int |
HS_TUNE_FAMILY_IVB
Tuning Parameter - Intel(R) microarchitecture code name Ivy Bridge
This indicates that the compiled database should be tuned for the
Ivy Bridge microarchitecture.
|
static int |
HS_TUNE_FAMILY_SKL
Tuning Parameter - Intel(R) microarchitecture code name Skylake
This indicates that the compiled database should be tuned for the
Skylake microarchitecture.
|
static int |
HS_TUNE_FAMILY_SKX
Tuning Parameter - Intel(R) microarchitecture code name Skylake Server
This indicates that the compiled database should be tuned for the
Skylake Server microarchitecture.
|
static int |
HS_TUNE_FAMILY_SLM
Tuning Parameter - Intel(R) microarchitecture code name Silvermont
This indicates that the compiled database should be tuned for the
Silvermont microarchitecture.
|
static int |
HS_TUNE_FAMILY_SNB
Tuning Parameter - Intel(R) microarchitecture code name Sandy Bridge
This indicates that the compiled database should be tuned for the
Sandy Bridge microarchitecture.
|
static int |
HS_UNKNOWN_ERROR
Unexpected internal error.
|
Constructor and Description |
---|
hyperscan() |
Modifier and Type | Method and Description |
---|---|
static int |
hs_alloc_scratch(hs_database_t db,
hs_scratch_t scratch) |
static int |
hs_alloc_scratch(hs_database_t db,
PointerPointer scratch)
Allocate a "scratch" space for use by Hyperscan.
|
static int |
hs_clone_scratch(hs_scratch_t src,
hs_scratch_t dest) |
static int |
hs_clone_scratch(hs_scratch_t src,
PointerPointer dest)
Allocate a scratch space that is a clone of an existing scratch space.
|
static int |
hs_close_stream(hs_stream_t id,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer ctxt)
Close a stream.
|
static int |
hs_compile_ext_multi(byte[] expressions,
int[] flags,
int[] ids,
hs_expr_ext_t ext,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_ext_multi(ByteBuffer expressions,
IntBuffer flags,
IntBuffer ids,
hs_expr_ext_t ext,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_ext_multi(BytePointer expressions,
IntPointer flags,
IntPointer ids,
hs_expr_ext_t ext,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_ext_multi(PointerPointer expressions,
IntPointer flags,
IntPointer ids,
PointerPointer ext,
int elements,
int mode,
hs_platform_info_t platform,
PointerPointer db,
PointerPointer error)
The multiple regular expression compiler with extended parameter support.
|
static int |
hs_compile_lit_multi(byte[] expressions,
int[] flags,
int[] ids,
SizeTPointer lens,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_lit_multi(ByteBuffer expressions,
IntBuffer flags,
IntBuffer ids,
SizeTPointer lens,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_lit_multi(BytePointer expressions,
IntPointer flags,
IntPointer ids,
SizeTPointer lens,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_lit_multi(PointerPointer expressions,
IntPointer flags,
IntPointer ids,
SizeTPointer lens,
int elements,
int mode,
hs_platform_info_t platform,
PointerPointer db,
PointerPointer error)
The multiple pure literal expression compiler.
|
static int |
hs_compile_lit(BytePointer expression,
int flags,
long len,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_lit(BytePointer expression,
int flags,
long len,
int mode,
hs_platform_info_t platform,
PointerPointer db,
PointerPointer error)
The basic pure literal expression compiler.
|
static int |
hs_compile_lit(String expression,
int flags,
long len,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_multi(byte[] expressions,
int[] flags,
int[] ids,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_multi(ByteBuffer expressions,
IntBuffer flags,
IntBuffer ids,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_multi(BytePointer expressions,
IntPointer flags,
IntPointer ids,
int elements,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile_multi(PointerPointer expressions,
IntPointer flags,
IntPointer ids,
int elements,
int mode,
hs_platform_info_t platform,
PointerPointer db,
PointerPointer error)
The multiple regular expression compiler.
|
static int |
hs_compile(BytePointer expression,
int flags,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compile(BytePointer expression,
int flags,
int mode,
hs_platform_info_t platform,
PointerPointer db,
PointerPointer error)
The basic regular expression compiler.
|
static int |
hs_compile(String expression,
int flags,
int mode,
hs_platform_info_t platform,
hs_database_t db,
hs_compile_error_t error) |
static int |
hs_compress_stream(hs_stream_t stream,
byte[] buf,
long buf_space,
SizeTPointer used_space) |
static int |
hs_compress_stream(hs_stream_t stream,
ByteBuffer buf,
long buf_space,
SizeTPointer used_space) |
static int |
hs_compress_stream(hs_stream_t stream,
BytePointer buf,
long buf_space,
SizeTPointer used_space)
Creates a compressed representation of the provided stream in the buffer
provided.
|
static int |
hs_copy_stream(hs_stream_t to_id,
hs_stream_t from_id) |
static int |
hs_copy_stream(PointerPointer to_id,
hs_stream_t from_id)
Duplicate the given stream.
|
static int |
hs_database_info(hs_database_t database,
byte[] info) |
static int |
hs_database_info(hs_database_t database,
ByteBuffer info) |
static int |
hs_database_info(hs_database_t database,
BytePointer info) |
static int |
hs_database_info(hs_database_t database,
PointerPointer info)
Utility function providing information about a database.
|
static int |
hs_database_size(hs_database_t database,
SizeTPointer database_size)
Provides the size of the given database in bytes.
|
static int |
hs_deserialize_database_at(BytePointer bytes,
long length,
hs_database_t db)
Reconstruct a pattern database from a stream of bytes previously generated
by \ref hs_serialize_database() at a given memory location.
|
static int |
hs_deserialize_database_at(String bytes,
long length,
hs_database_t db) |
static int |
hs_deserialize_database(BytePointer bytes,
long length,
hs_database_t db) |
static int |
hs_deserialize_database(BytePointer bytes,
long length,
PointerPointer db)
Reconstruct a pattern database from a stream of bytes previously generated
by \ref hs_serialize_database().
|
static int |
hs_deserialize_database(String bytes,
long length,
hs_database_t db) |
static int |
hs_expand_stream(hs_database_t db,
hs_stream_t stream,
BytePointer buf,
long buf_size) |
static int |
hs_expand_stream(hs_database_t db,
hs_stream_t stream,
String buf,
long buf_size) |
static int |
hs_expand_stream(hs_database_t db,
PointerPointer stream,
BytePointer buf,
long buf_size)
Decompresses a compressed representation created by \ref hs_compress_stream()
into a new stream.
|
static int |
hs_expression_ext_info(BytePointer expression,
int flags,
hs_expr_ext_t ext,
hs_expr_info_t info,
hs_compile_error_t error) |
static int |
hs_expression_ext_info(BytePointer expression,
int flags,
hs_expr_ext_t ext,
PointerPointer info,
PointerPointer error)
Utility function providing information about a regular expression, with
extended parameter support.
|
static int |
hs_expression_ext_info(String expression,
int flags,
hs_expr_ext_t ext,
hs_expr_info_t info,
hs_compile_error_t error) |
static int |
hs_expression_info(BytePointer expression,
int flags,
hs_expr_info_t info,
hs_compile_error_t error) |
static int |
hs_expression_info(BytePointer expression,
int flags,
PointerPointer info,
PointerPointer error)
Utility function providing information about a regular expression.
|
static int |
hs_expression_info(String expression,
int flags,
hs_expr_info_t info,
hs_compile_error_t error) |
static int |
hs_free_compile_error(hs_compile_error_t error)
Free an error structure generated by \ref hs_compile(), \ref
hs_compile_multi() or \ref hs_compile_ext_multi().
|
static int |
hs_free_database(hs_database_t db)
Free a compiled pattern database.
|
static int |
hs_free_scratch(hs_scratch_t scratch)
Free a scratch block previously allocated by \ref hs_alloc_scratch() or \ref
hs_clone_scratch().
|
static int |
hs_open_stream(hs_database_t db,
int flags,
hs_stream_t stream) |
static int |
hs_open_stream(hs_database_t db,
int flags,
PointerPointer stream)
Open and initialise a stream.
|
static int |
hs_populate_platform(hs_platform_info_t platform)
Populates the platform information based on the current host.
|
static int |
hs_reset_and_copy_stream(hs_stream_t to_id,
hs_stream_t from_id,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context)
Duplicate the given 'from' stream state onto the 'to' stream.
|
static int |
hs_reset_and_expand_stream(hs_stream_t to_stream,
BytePointer buf,
long buf_size,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context)
Decompresses a compressed representation created by \ref hs_compress_stream()
on top of the 'to' stream.
|
static int |
hs_reset_and_expand_stream(hs_stream_t to_stream,
String buf,
long buf_size,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context) |
static int |
hs_reset_stream(hs_stream_t id,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context)
Reset a stream to an initial state.
|
static int |
hs_scan_stream(hs_stream_t id,
BytePointer data,
int length,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer ctxt)
Write data to be scanned to the opened stream.
|
static int |
hs_scan_stream(hs_stream_t id,
String data,
int length,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer ctxt) |
static int |
hs_scan_vector(hs_database_t db,
byte[] data,
int[] length,
int count,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context) |
static int |
hs_scan_vector(hs_database_t db,
ByteBuffer data,
IntBuffer length,
int count,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context) |
static int |
hs_scan_vector(hs_database_t db,
BytePointer data,
IntPointer length,
int count,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context) |
static int |
hs_scan_vector(hs_database_t db,
PointerPointer data,
IntPointer length,
int count,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context)
The vectored regular expression scanner.
|
static int |
hs_scan(hs_database_t db,
BytePointer data,
int length,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context)
The block (non-streaming) regular expression scanner.
|
static int |
hs_scan(hs_database_t db,
String data,
int length,
int flags,
hs_scratch_t scratch,
match_event_handler onEvent,
Pointer context) |
static int |
hs_scratch_size(hs_scratch_t scratch,
SizeTPointer scratch_size)
Provides the size of the given scratch space.
|
static int |
hs_serialize_database(hs_database_t db,
byte[] bytes,
SizeTPointer length) |
static int |
hs_serialize_database(hs_database_t db,
ByteBuffer bytes,
SizeTPointer length) |
static int |
hs_serialize_database(hs_database_t db,
BytePointer bytes,
SizeTPointer length) |
static int |
hs_serialize_database(hs_database_t db,
PointerPointer bytes,
SizeTPointer length)
Serialize a pattern database to a stream of bytes.
|
static int |
hs_serialized_database_info(BytePointer bytes,
long length,
byte[] info) |
static int |
hs_serialized_database_info(BytePointer bytes,
long length,
ByteBuffer info) |
static int |
hs_serialized_database_info(BytePointer bytes,
long length,
BytePointer info) |
static int |
hs_serialized_database_info(BytePointer bytes,
long length,
PointerPointer info)
Utility function providing information about a serialized database.
|
static int |
hs_serialized_database_info(String bytes,
long length,
byte[] info) |
static int |
hs_serialized_database_info(String bytes,
long length,
ByteBuffer info) |
static int |
hs_serialized_database_info(String bytes,
long length,
BytePointer info) |
static int |
hs_serialized_database_size(BytePointer bytes,
long length,
SizeTPointer deserialized_size)
Utility function for reporting the size that would be required by a
database if it were deserialized.
|
static int |
hs_serialized_database_size(String bytes,
long length,
SizeTPointer deserialized_size) |
static int |
hs_set_allocator(hs_alloc_t alloc_func,
hs_free_t free_func)
Set the allocate and free functions used by Hyperscan for allocating
memory at runtime for stream state, scratch space, database bytecode,
and various other data structure returned by the Hyperscan API.
|
static int |
hs_set_database_allocator(hs_alloc_t alloc_func,
hs_free_t free_func)
Set the allocate and free functions used by Hyperscan for allocating memory
for database bytecode produced by the compile calls (\ref hs_compile(), \ref
hs_compile_multi(), \ref hs_compile_ext_multi()) and by database
deserialization (\ref hs_deserialize_database()).
|
static int |
hs_set_misc_allocator(hs_alloc_t alloc_func,
hs_free_t free_func)
Set the allocate and free functions used by Hyperscan for allocating memory
for items returned by the Hyperscan API such as \ref hs_compile_error_t, \ref
hs_expr_info_t and serialized databases.
|
static int |
hs_set_scratch_allocator(hs_alloc_t alloc_func,
hs_free_t free_func)
Set the allocate and free functions used by Hyperscan for allocating memory
for scratch space by \ref hs_alloc_scratch() and \ref hs_clone_scratch().
|
static int |
hs_set_stream_allocator(hs_alloc_t alloc_func,
hs_free_t free_func)
Set the allocate and free functions used by Hyperscan for allocating memory
for stream state by \ref hs_open_stream().
|
static int |
hs_stream_size(hs_database_t database,
SizeTPointer stream_size)
Provides the size of the stream state allocated by a single stream opened
against the given database.
|
static int |
hs_valid_platform()
Utility function to test the current system architecture.
|
static BytePointer |
hs_version()
Utility function for identifying this release version.
|
public static final int HS_SUCCESS
public static final int HS_INVALID
public static final int HS_NOMEM
public static final int HS_SCAN_TERMINATED
public static final int HS_COMPILER_ERROR
public static final int HS_DB_VERSION_ERROR
public static final int HS_DB_PLATFORM_ERROR
public static final int HS_DB_MODE_ERROR
public static final int HS_BAD_ALIGN
public static final int HS_BAD_ALLOC
public static final int HS_SCRATCH_IN_USE
public static final int HS_ARCH_ERROR
public static final int HS_INSUFFICIENT_SPACE
public static final int HS_UNKNOWN_ERROR
public static final long HS_EXT_FLAG_MIN_OFFSET
public static final long HS_EXT_FLAG_MAX_OFFSET
public static final long HS_EXT_FLAG_MIN_LENGTH
public static final long HS_EXT_FLAG_EDIT_DISTANCE
public static final long HS_EXT_FLAG_HAMMING_DISTANCE
public static final int HS_FLAG_CASELESS
(?i)
and
(?-i)
) to switch case-insensitive matching on and off.public static final int HS_FLAG_DOTALL
.
will not exclude newlines.
This flag sets any instances of the .
token to match newline characters as
well as all other characters. The PCRE specification states that the .
token does not match newline characters by default, so without this flag the
.
token will not cross line boundaries.public static final int HS_FLAG_MULTILINE
^
and $
tokens match
newline characters as well as the start and end of the stream. If this flag
is not specified, the ^
token will only ever match at the start of a
stream, and the $
token will only ever match at the end of a stream within
the guidelines of the PCRE specification.public static final int HS_FLAG_SINGLEMATCH
public static final int HS_FLAG_ALLOWEMPTY
.?
, .*
, (a|)
. Since Hyperscan can return every
possible match for an expression, such expressions generally execute very
slowly; the default behaviour is to return an error when an attempt to
compile one is made. Using this flag will force the compiler to allow such
an expression.public static final int HS_FLAG_UTF8
public static final int HS_FLAG_UCP
\w
and \s
as
well as the POSIX character classes. It is only meaningful in conjunction
with \ref HS_FLAG_UTF8.public static final int HS_FLAG_PREFILTER
public static final int HS_FLAG_SOM_LEFTMOST
public static final int HS_FLAG_COMBINATION
public static final int HS_FLAG_QUIET
public static final long HS_CPU_FEATURES_AVX2
public static final long HS_CPU_FEATURES_AVX512
public static final long HS_CPU_FEATURES_AVX512VBMI
public static final int HS_TUNE_FAMILY_GENERIC
public static final int HS_TUNE_FAMILY_SNB
public static final int HS_TUNE_FAMILY_IVB
public static final int HS_TUNE_FAMILY_HSW
public static final int HS_TUNE_FAMILY_SLM
public static final int HS_TUNE_FAMILY_BDW
public static final int HS_TUNE_FAMILY_SKL
public static final int HS_TUNE_FAMILY_SKX
public static final int HS_TUNE_FAMILY_GLM
public static final int HS_TUNE_FAMILY_ICL
public static final int HS_TUNE_FAMILY_ICX
public static final int HS_MODE_BLOCK
public static final int HS_MODE_NOSTREAM
public static final int HS_MODE_STREAM
public static final int HS_MODE_VECTORED
public static final int HS_MODE_SOM_HORIZON_LARGE
public static final int HS_MODE_SOM_HORIZON_MEDIUM
public static final int HS_MODE_SOM_HORIZON_SMALL
public static final long HS_OFFSET_PAST_HORIZON
public static final int HS_MAJOR
public static final int HS_MINOR
public static final int HS_PATCH
@Cast(value="hs_error_t") public static int hs_free_database(hs_database_t db)
db
- A compiled pattern database. NULL may also be safely provided, in which
case the function does nothing.@Cast(value="hs_error_t") public static int hs_serialize_database(@Const hs_database_t db, @Cast(value="char**") PointerPointer bytes, @Cast(value="size_t*") SizeTPointer length)
db
- A compiled pattern database.bytes
- On success, a pointer to an array of bytes will be returned here.
These bytes can be subsequently relocated or written to disk. The
caller is responsible for freeing this block.length
- On success, the number of bytes in the generated byte array will be
returned here.@Cast(value="hs_error_t") public static int hs_serialize_database(@Const hs_database_t db, @Cast(value="char**") @ByPtrPtr BytePointer bytes, @Cast(value="size_t*") SizeTPointer length)
@Cast(value="hs_error_t") public static int hs_serialize_database(@Const hs_database_t db, @Cast(value="char**") @ByPtrPtr ByteBuffer bytes, @Cast(value="size_t*") SizeTPointer length)
@Cast(value="hs_error_t") public static int hs_serialize_database(@Const hs_database_t db, @Cast(value="char**") @ByPtrPtr byte[] bytes, @Cast(value="size_t*") SizeTPointer length)
@Cast(value="hs_error_t") public static int hs_deserialize_database(@Cast(value="const char*") BytePointer bytes, @Cast(value="const size_t") long length, @Cast(value="hs_database_t**") PointerPointer db)
bytes
- A byte array generated by \ref hs_serialize_database() representing a
compiled pattern database.length
- The length of the byte array generated by \ref hs_serialize_database().
This should be the same value as that returned by \ref
hs_serialize_database().db
- On success, a pointer to a newly allocated \ref hs_database_t will be
returned here. This database can then be used for scanning, and
eventually freed by the caller using \ref hs_free_database().@Cast(value="hs_error_t") public static int hs_deserialize_database(@Cast(value="const char*") BytePointer bytes, @Cast(value="const size_t") long length, @ByPtrPtr hs_database_t db)
@Cast(value="hs_error_t") public static int hs_deserialize_database(String bytes, @Cast(value="const size_t") long length, @ByPtrPtr hs_database_t db)
@Cast(value="hs_error_t") public static int hs_deserialize_database_at(@Cast(value="const char*") BytePointer bytes, @Cast(value="const size_t") long length, hs_database_t db)
bytes
- A byte array generated by \ref hs_serialize_database() representing a
compiled pattern database.length
- The length of the byte array generated by \ref hs_serialize_database().
This should be the same value as that returned by \ref
hs_serialize_database().db
- Pointer to an 8-byte aligned block of memory of sufficient size to hold
the deserialized database. On success, the reconstructed database will
be written to this location. This database can then be used for pattern
matching. The user is responsible for freeing this memory; the \ref
hs_free_database() call should not be used.@Cast(value="hs_error_t") public static int hs_deserialize_database_at(String bytes, @Cast(value="const size_t") long length, hs_database_t db)
@Cast(value="hs_error_t") public static int hs_stream_size(@Const hs_database_t database, @Cast(value="size_t*") SizeTPointer stream_size)
database
- Pointer to a compiled (streaming mode) pattern database.stream_size
- On success, the size in bytes of an individual stream opened against the
given database is placed in this parameter.@Cast(value="hs_error_t") public static int hs_database_size(@Const hs_database_t database, @Cast(value="size_t*") SizeTPointer database_size)
database
- Pointer to compiled pattern database.database_size
- On success, the size of the compiled database in bytes is placed in this
parameter.@Cast(value="hs_error_t") public static int hs_serialized_database_size(@Cast(value="const char*") BytePointer bytes, @Cast(value="const size_t") long length, @Cast(value="size_t*") SizeTPointer deserialized_size)
bytes
- Pointer to a byte array generated by \ref hs_serialize_database()
representing a compiled pattern database.length
- The length of the byte array generated by \ref hs_serialize_database().
This should be the same value as that returned by \ref
hs_serialize_database().deserialized_size
- On success, the size of the compiled database that would be generated
by \ref hs_deserialize_database_at() is returned here.@Cast(value="hs_error_t") public static int hs_serialized_database_size(String bytes, @Cast(value="const size_t") long length, @Cast(value="size_t*") SizeTPointer deserialized_size)
@Cast(value="hs_error_t") public static int hs_database_info(@Const hs_database_t database, @Cast(value="char**") PointerPointer info)
database
- Pointer to a compiled database.info
- On success, a string containing the version and platform information for
the supplied database is placed in the parameter. The string is
allocated using the allocator supplied in \ref hs_set_misc_allocator()
(or malloc() if no allocator was set) and should be freed by the caller.@Cast(value="hs_error_t") public static int hs_database_info(@Const hs_database_t database, @Cast(value="char**") @ByPtrPtr BytePointer info)
@Cast(value="hs_error_t") public static int hs_database_info(@Const hs_database_t database, @Cast(value="char**") @ByPtrPtr ByteBuffer info)
@Cast(value="hs_error_t") public static int hs_database_info(@Const hs_database_t database, @Cast(value="char**") @ByPtrPtr byte[] info)
@Cast(value="hs_error_t") public static int hs_serialized_database_info(@Cast(value="const char*") BytePointer bytes, @Cast(value="size_t") long length, @Cast(value="char**") PointerPointer info)
bytes
- Pointer to a serialized database.length
- Length in bytes of the serialized database.info
- On success, a string containing the version and platform information
for the supplied serialized database is placed in the parameter. The
string is allocated using the allocator supplied in \ref
hs_set_misc_allocator() (or malloc() if no allocator was set) and
should be freed by the caller.@Cast(value="hs_error_t") public static int hs_serialized_database_info(@Cast(value="const char*") BytePointer bytes, @Cast(value="size_t") long length, @Cast(value="char**") @ByPtrPtr BytePointer info)
@Cast(value="hs_error_t") public static int hs_serialized_database_info(String bytes, @Cast(value="size_t") long length, @Cast(value="char**") @ByPtrPtr ByteBuffer info)
@Cast(value="hs_error_t") public static int hs_serialized_database_info(@Cast(value="const char*") BytePointer bytes, @Cast(value="size_t") long length, @Cast(value="char**") @ByPtrPtr byte[] info)
@Cast(value="hs_error_t") public static int hs_serialized_database_info(String bytes, @Cast(value="size_t") long length, @Cast(value="char**") @ByPtrPtr BytePointer info)
@Cast(value="hs_error_t") public static int hs_serialized_database_info(@Cast(value="const char*") BytePointer bytes, @Cast(value="size_t") long length, @Cast(value="char**") @ByPtrPtr ByteBuffer info)
@Cast(value="hs_error_t") public static int hs_serialized_database_info(String bytes, @Cast(value="size_t") long length, @Cast(value="char**") @ByPtrPtr byte[] info)
@Cast(value="hs_error_t") public static int hs_set_allocator(hs_alloc_t alloc_func, hs_free_t free_func)
alloc_func
- A callback function pointer that allocates memory. This function must
return memory suitably aligned for the largest representable data type
on this platform.free_func
- A callback function pointer that frees allocated memory.@Cast(value="hs_error_t") public static int hs_set_database_allocator(hs_alloc_t alloc_func, hs_free_t free_func)
alloc_func
- A callback function pointer that allocates memory. This function must
return memory suitably aligned for the largest representable data type
on this platform.free_func
- A callback function pointer that frees allocated memory.@Cast(value="hs_error_t") public static int hs_set_misc_allocator(hs_alloc_t alloc_func, hs_free_t free_func)
alloc_func
- A callback function pointer that allocates memory. This function must
return memory suitably aligned for the largest representable data type
on this platform.free_func
- A callback function pointer that frees allocated memory.@Cast(value="hs_error_t") public static int hs_set_scratch_allocator(hs_alloc_t alloc_func, hs_free_t free_func)
alloc_func
- A callback function pointer that allocates memory. This function must
return memory suitably aligned for the largest representable data type
on this platform.free_func
- A callback function pointer that frees allocated memory.@Cast(value="hs_error_t") public static int hs_set_stream_allocator(hs_alloc_t alloc_func, hs_free_t free_func)
alloc_func
- A callback function pointer that allocates memory. This function must
return memory suitably aligned for the largest representable data type
on this platform.free_func
- A callback function pointer that frees allocated memory.@Cast(value="const char*") public static BytePointer hs_version()
@Cast(value="hs_error_t") public static int hs_valid_platform()
@Cast(value="hs_error_t") public static int hs_compile(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned int") int flags, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @Cast(value="hs_database_t**") PointerPointer db, @Cast(value="hs_compile_error_t**") PointerPointer error)
expression
- The NULL-terminated expression to parse. Note that this string must
represent ONLY the pattern to be matched, with no delimiters or flags;
any global flags should be specified with the \p flags argument. For
example, the expression /abc?def/i
should be compiled by providing
abc?def
as the \p expression, and \ref HS_FLAG_CASELESS as the \a
flags.flags
- Flags which modify the behaviour of the expression. Multiple flags may
be used by ORing them together. Valid values are:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_DOTALL - Matching a .
will not exclude newlines.
- HS_FLAG_MULTILINE - ^
and $
anchors match any newlines in data.
- HS_FLAG_SINGLEMATCH - Only one match will be generated for the
expression per stream.
- HS_FLAG_ALLOWEMPTY - Allow expressions which can match against an
empty string, such as .*
.
- HS_FLAG_UTF8 - Treat this pattern as a sequence of UTF-8 characters.
- HS_FLAG_UCP - Use Unicode properties for character classes.
- HS_FLAG_PREFILTER - Compile pattern in prefiltering mode.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.
- HS_FLAG_COMBINATION - Parse the expression in logical combination
syntax.
- HS_FLAG_QUIET - Ignore match reporting for this expression. Used for
the sub-expressions in logical combinations.mode
- Compiler mode flags that affect the database as a whole. One of \ref
HS_MODE_STREAM or \ref HS_MODE_BLOCK or \ref HS_MODE_VECTORED must be
supplied, to select between the generation of a streaming, block or
vectored database. In addition, other flags (beginning with HS_MODE_)
may be supplied to enable specific features. See \ref HS_MODE_FLAG for
more details.platform
- If not NULL, the platform structure is used to determine the target
platform for the database. If NULL, a database suitable for running
on the current host platform is produced.db
- On success, a pointer to the generated database will be returned in
this parameter, or NULL on failure. The caller is responsible for
deallocating the buffer using the \ref hs_free_database() function.error
- If the compile fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_compile(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned int") int flags, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile(String expression, @Cast(value="unsigned int") int flags, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_multi(@Cast(value="const char*const*") PointerPointer expressions, @Cast(value="const unsigned int*") IntPointer flags, @Cast(value="const unsigned int*") IntPointer ids, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @Cast(value="hs_database_t**") PointerPointer db, @Cast(value="hs_compile_error_t**") PointerPointer error)
expressions
- Array of NULL-terminated expressions to compile. Note that (as for \ref
hs_compile()) these strings must contain only the pattern to be
matched, with no delimiters or flags. For example, the expression
/abc?def/i
should be compiled by providing abc?def
as the first
string in the \p expressions array, and \ref HS_FLAG_CASELESS as the
first value in the \p flags array.flags
- Array of flags which modify the behaviour of each expression. Multiple
flags may be used by ORing them together. Specifying the NULL pointer
in place of an array will set the flags value for all patterns to zero.
Valid values are:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_DOTALL - Matching a .
will not exclude newlines.
- HS_FLAG_MULTILINE - ^
and $
anchors match any newlines in data.
- HS_FLAG_SINGLEMATCH - Only one match will be generated by patterns
with this match id per stream.
- HS_FLAG_ALLOWEMPTY - Allow expressions which can match against an
empty string, such as .*
.
- HS_FLAG_UTF8 - Treat this pattern as a sequence of UTF-8 characters.
- HS_FLAG_UCP - Use Unicode properties for character classes.
- HS_FLAG_PREFILTER - Compile pattern in prefiltering mode.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.
- HS_FLAG_COMBINATION - Parse the expression in logical combination
syntax.
- HS_FLAG_QUIET - Ignore match reporting for this expression. Used for
the sub-expressions in logical combinations.ids
- An array of integers specifying the ID number to be associated with the
corresponding pattern in the expressions array. Specifying the NULL
pointer in place of an array will set the ID value for all patterns to
zero.elements
- The number of elements in the input arrays.mode
- Compiler mode flags that affect the database as a whole. One of \ref
HS_MODE_STREAM or \ref HS_MODE_BLOCK or \ref HS_MODE_VECTORED must be
supplied, to select between the generation of a streaming, block or
vectored database. In addition, other flags (beginning with HS_MODE_)
may be supplied to enable specific features. See \ref HS_MODE_FLAG for
more details.platform
- If not NULL, the platform structure is used to determine the target
platform for the database. If NULL, a database suitable for running
on the current host platform is produced.db
- On success, a pointer to the generated database will be returned in
this parameter, or NULL on failure. The caller is responsible for
deallocating the buffer using the \ref hs_free_database() function.error
- If the compile fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_compile_multi(@Cast(value="const char*const*") @ByPtrPtr BytePointer expressions, @Cast(value="const unsigned int*") IntPointer flags, @Cast(value="const unsigned int*") IntPointer ids, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_multi(@Cast(value="const char*const*") @ByPtrPtr ByteBuffer expressions, @Cast(value="const unsigned int*") IntBuffer flags, @Cast(value="const unsigned int*") IntBuffer ids, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_multi(@Cast(value="const char*const*") @ByPtrPtr byte[] expressions, @Cast(value="const unsigned int*") int[] flags, @Cast(value="const unsigned int*") int[] ids, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_ext_multi(@Cast(value="const char*const*") PointerPointer expressions, @Cast(value="const unsigned int*") IntPointer flags, @Cast(value="const unsigned int*") IntPointer ids, @Cast(value="const hs_expr_ext_t*const*") PointerPointer ext, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @Cast(value="hs_database_t**") PointerPointer db, @Cast(value="hs_compile_error_t**") PointerPointer error)
expressions
- Array of NULL-terminated expressions to compile. Note that (as for \ref
hs_compile()) these strings must contain only the pattern to be
matched, with no delimiters or flags. For example, the expression
/abc?def/i
should be compiled by providing abc?def
as the first
string in the \p expressions array, and \ref HS_FLAG_CASELESS as the
first value in the \p flags array.flags
- Array of flags which modify the behaviour of each expression. Multiple
flags may be used by ORing them together. Specifying the NULL pointer
in place of an array will set the flags value for all patterns to zero.
Valid values are:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_DOTALL - Matching a .
will not exclude newlines.
- HS_FLAG_MULTILINE - ^
and $
anchors match any newlines in data.
- HS_FLAG_SINGLEMATCH - Only one match will be generated by patterns
with this match id per stream.
- HS_FLAG_ALLOWEMPTY - Allow expressions which can match against an
empty string, such as .*
.
- HS_FLAG_UTF8 - Treat this pattern as a sequence of UTF-8 characters.
- HS_FLAG_UCP - Use Unicode properties for character classes.
- HS_FLAG_PREFILTER - Compile pattern in prefiltering mode.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.
- HS_FLAG_COMBINATION - Parse the expression in logical combination
syntax.
- HS_FLAG_QUIET - Ignore match reporting for this expression. Used for
the sub-expressions in logical combinations.ids
- An array of integers specifying the ID number to be associated with the
corresponding pattern in the expressions array. Specifying the NULL
pointer in place of an array will set the ID value for all patterns to
zero.ext
- An array of pointers to filled \ref hs_expr_ext_t structures that
define extended behaviour for each pattern. NULL may be specified if no
extended behaviour is needed for an individual pattern, or in place of
the whole array if it is not needed for any expressions. Memory used by
these structures must be both allocated and freed by the caller.elements
- The number of elements in the input arrays.mode
- Compiler mode flags that affect the database as a whole. One of \ref
HS_MODE_STREAM, \ref HS_MODE_BLOCK or \ref HS_MODE_VECTORED must be
supplied, to select between the generation of a streaming, block or
vectored database. In addition, other flags (beginning with HS_MODE_)
may be supplied to enable specific features. See \ref HS_MODE_FLAG for
more details.platform
- If not NULL, the platform structure is used to determine the target
platform for the database. If NULL, a database suitable for running
on the current host platform is produced.db
- On success, a pointer to the generated database will be returned in
this parameter, or NULL on failure. The caller is responsible for
deallocating the buffer using the \ref hs_free_database() function.error
- If the compile fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_compile_ext_multi(@Cast(value="const char*const*") @ByPtrPtr BytePointer expressions, @Cast(value="const unsigned int*") IntPointer flags, @Cast(value="const unsigned int*") IntPointer ids, @Const @ByPtrPtr hs_expr_ext_t ext, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_ext_multi(@Cast(value="const char*const*") @ByPtrPtr ByteBuffer expressions, @Cast(value="const unsigned int*") IntBuffer flags, @Cast(value="const unsigned int*") IntBuffer ids, @Const @ByPtrPtr hs_expr_ext_t ext, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_ext_multi(@Cast(value="const char*const*") @ByPtrPtr byte[] expressions, @Cast(value="const unsigned int*") int[] flags, @Cast(value="const unsigned int*") int[] ids, @Const @ByPtrPtr hs_expr_ext_t ext, @Cast(value="unsigned int") int elements, @Cast(value="unsigned int") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_lit(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned") int flags, @Cast(value="const size_t") long len, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @Cast(value="hs_database_t**") PointerPointer db, @Cast(value="hs_compile_error_t**") PointerPointer error)
expression
- The NULL-terminated expression to parse. Note that this string must
represent ONLY the pattern to be matched, with no delimiters or flags;
any global flags should be specified with the \p flags argument. For
example, the expression /abc?def/i
should be compiled by providing
abc?def
as the \p expression, and \ref HS_FLAG_CASELESS as the \a
flags. Meanwhile, the string content shall be fully parsed in a literal
sense without any regular grammars. For example, the \p expression
abc?
simply means a char sequence of a
, b
, c
, and ?
. The ?
here doesn't mean 0 or 1 quantifier under regular semantics.flags
- Flags which modify the behaviour of the expression. Multiple flags may
be used by ORing them together. Compared to \ref hs_compile(), fewer
valid values are provided:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_SINGLEMATCH - Only one match will be generated for the
expression per stream.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.len
- The length of the text content of the pure literal expression. As the
text content indicated by \p expression is treated as single character
one by one, the special terminating character \0
should be allowed
to appear in expression, and not treated as a terminator for a string.
Thus, the end of a pure literal expression cannot be indicated by
identifying \0
, but by counting to the expression length.mode
- Compiler mode flags that affect the database as a whole. One of \ref
HS_MODE_STREAM or \ref HS_MODE_BLOCK or \ref HS_MODE_VECTORED must be
supplied, to select between the generation of a streaming, block or
vectored database. In addition, other flags (beginning with HS_MODE_)
may be supplied to enable specific features. See \ref HS_MODE_FLAG for
more details.platform
- If not NULL, the platform structure is used to determine the target
platform for the database. If NULL, a database suitable for running
on the current host platform is produced.db
- On success, a pointer to the generated database will be returned in
this parameter, or NULL on failure. The caller is responsible for
deallocating the buffer using the \ref hs_free_database() function.error
- If the compile fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_compile_lit(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned") int flags, @Cast(value="const size_t") long len, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_lit(String expression, @Cast(value="unsigned") int flags, @Cast(value="const size_t") long len, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_lit_multi(@Cast(value="const char*const*") PointerPointer expressions, @Cast(value="const unsigned*") IntPointer flags, @Cast(value="const unsigned*") IntPointer ids, @Cast(value="const size_t*") SizeTPointer lens, @Cast(value="unsigned") int elements, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @Cast(value="hs_database_t**") PointerPointer db, @Cast(value="hs_compile_error_t**") PointerPointer error)
expressions
- The NULL-terminated expression to parse. Note that this string must
represent ONLY the pattern to be matched, with no delimiters or flags;
any global flags should be specified with the \p flags argument. For
example, the expression /abc?def/i
should be compiled by providing
abc?def
as the \p expression, and \ref HS_FLAG_CASELESS as the \a
flags. Meanwhile, the string content shall be fully parsed in a literal
sense without any regular grammars. For example, the \p expression
abc?
simply means a char sequence of a
, b
, c
, and ?
. The ?
here doesn't mean 0 or 1 quantifier under regular semantics.flags
- Array of flags which modify the behaviour of each expression. Multiple
flags may be used by ORing them together. Specifying the NULL pointer
in place of an array will set the flags value for all patterns to zero.
Compared to \ref hs_compile_multi(), fewer valid values are provided:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_SINGLEMATCH - Only one match will be generated for the
expression per stream.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.ids
- An array of integers specifying the ID number to be associated with the
corresponding pattern in the expressions array. Specifying the NULL
pointer in place of an array will set the ID value for all patterns to
zero.lens
- Array of lengths of the text content of each pure literal expression.
As the text content indicated by \p expression is treated as single
character one by one, the special terminating character \0
should be
allowed to appear in expression, and not treated as a terminator for a
string. Thus, the end of a pure literal expression cannot be indicated
by identifying \0
, but by counting to the expression length.elements
- The number of elements in the input arrays.mode
- Compiler mode flags that affect the database as a whole. One of \ref
HS_MODE_STREAM or \ref HS_MODE_BLOCK or \ref HS_MODE_VECTORED must be
supplied, to select between the generation of a streaming, block or
vectored database. In addition, other flags (beginning with HS_MODE_)
may be supplied to enable specific features. See \ref HS_MODE_FLAG for
more details.platform
- If not NULL, the platform structure is used to determine the target
platform for the database. If NULL, a database suitable for running
on the current host platform is produced.db
- On success, a pointer to the generated database will be returned in
this parameter, or NULL on failure. The caller is responsible for
deallocating the buffer using the \ref hs_free_database() function.error
- If the compile fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_compile_lit_multi(@Cast(value="const char*const*") @ByPtrPtr BytePointer expressions, @Cast(value="const unsigned*") IntPointer flags, @Cast(value="const unsigned*") IntPointer ids, @Cast(value="const size_t*") SizeTPointer lens, @Cast(value="unsigned") int elements, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_lit_multi(@Cast(value="const char*const*") @ByPtrPtr ByteBuffer expressions, @Cast(value="const unsigned*") IntBuffer flags, @Cast(value="const unsigned*") IntBuffer ids, @Cast(value="const size_t*") SizeTPointer lens, @Cast(value="unsigned") int elements, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_compile_lit_multi(@Cast(value="const char*const*") @ByPtrPtr byte[] expressions, @Cast(value="const unsigned*") int[] flags, @Cast(value="const unsigned*") int[] ids, @Cast(value="const size_t*") SizeTPointer lens, @Cast(value="unsigned") int elements, @Cast(value="unsigned") int mode, @Const hs_platform_info_t platform, @ByPtrPtr hs_database_t db, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_free_compile_error(hs_compile_error_t error)
error
- The \ref hs_compile_error_t to be freed. NULL may also be safely
provided.@Cast(value="hs_error_t") public static int hs_expression_info(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned int") int flags, @Cast(value="hs_expr_info_t**") PointerPointer info, @Cast(value="hs_compile_error_t**") PointerPointer error)
expression
- The NULL-terminated expression to parse. Note that this string must
represent ONLY the pattern to be matched, with no delimiters or flags;
any global flags should be specified with the \p flags argument. For
example, the expression /abc?def/i
should be compiled by providing
abc?def
as the \p expression, and \ref HS_FLAG_CASELESS as the \a
flags.flags
- Flags which modify the behaviour of the expression. Multiple flags may
be used by ORing them together. Valid values are:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_DOTALL - Matching a .
will not exclude newlines.
- HS_FLAG_MULTILINE - ^
and $
anchors match any newlines in data.
- HS_FLAG_SINGLEMATCH - Only one match will be generated by the
expression per stream.
- HS_FLAG_ALLOWEMPTY - Allow expressions which can match against an
empty string, such as .*
.
- HS_FLAG_UTF8 - Treat this pattern as a sequence of UTF-8 characters.
- HS_FLAG_UCP - Use Unicode properties for character classes.
- HS_FLAG_PREFILTER - Compile pattern in prefiltering mode.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.
- HS_FLAG_QUIET - This flag will be ignored.info
- On success, a pointer to the pattern information will be returned in
this parameter, or NULL on failure. This structure is allocated using
the allocator supplied in \ref hs_set_allocator() (or malloc() if no
allocator was set) and should be freed by the caller.error
- If the call fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_expression_info(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned int") int flags, @ByPtrPtr hs_expr_info_t info, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_expression_info(String expression, @Cast(value="unsigned int") int flags, @ByPtrPtr hs_expr_info_t info, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_expression_ext_info(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned int") int flags, @Const hs_expr_ext_t ext, @Cast(value="hs_expr_info_t**") PointerPointer info, @Cast(value="hs_compile_error_t**") PointerPointer error)
expression
- The NULL-terminated expression to parse. Note that this string must
represent ONLY the pattern to be matched, with no delimiters or flags;
any global flags should be specified with the \p flags argument. For
example, the expression /abc?def/i
should be compiled by providing
abc?def
as the \p expression, and \ref HS_FLAG_CASELESS as the \a
flags.flags
- Flags which modify the behaviour of the expression. Multiple flags may
be used by ORing them together. Valid values are:
- HS_FLAG_CASELESS - Matching will be performed case-insensitively.
- HS_FLAG_DOTALL - Matching a .
will not exclude newlines.
- HS_FLAG_MULTILINE - ^
and $
anchors match any newlines in data.
- HS_FLAG_SINGLEMATCH - Only one match will be generated by the
expression per stream.
- HS_FLAG_ALLOWEMPTY - Allow expressions which can match against an
empty string, such as .*
.
- HS_FLAG_UTF8 - Treat this pattern as a sequence of UTF-8 characters.
- HS_FLAG_UCP - Use Unicode properties for character classes.
- HS_FLAG_PREFILTER - Compile pattern in prefiltering mode.
- HS_FLAG_SOM_LEFTMOST - Report the leftmost start of match offset
when a match is found.
- HS_FLAG_QUIET - This flag will be ignored.ext
- A pointer to a filled \ref hs_expr_ext_t structure that defines
extended behaviour for this pattern. NULL may be specified if no
extended parameters are needed.info
- On success, a pointer to the pattern information will be returned in
this parameter, or NULL on failure. This structure is allocated using
the allocator supplied in \ref hs_set_allocator() (or malloc() if no
allocator was set) and should be freed by the caller.error
- If the call fails, a pointer to a \ref hs_compile_error_t will be
returned, providing details of the error condition. The caller is
responsible for deallocating the buffer using the \ref
hs_free_compile_error() function.@Cast(value="hs_error_t") public static int hs_expression_ext_info(@Cast(value="const char*") BytePointer expression, @Cast(value="unsigned int") int flags, @Const hs_expr_ext_t ext, @ByPtrPtr hs_expr_info_t info, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_expression_ext_info(String expression, @Cast(value="unsigned int") int flags, @Const hs_expr_ext_t ext, @ByPtrPtr hs_expr_info_t info, @ByPtrPtr hs_compile_error_t error)
@Cast(value="hs_error_t") public static int hs_populate_platform(hs_platform_info_t platform)
platform
- On success, the pointed to structure is populated based on the current
host.@Cast(value="hs_error_t") public static int hs_open_stream(@Const hs_database_t db, @Cast(value="unsigned int") int flags, @Cast(value="hs_stream_t**") PointerPointer stream)
db
- A compiled pattern database.flags
- Flags modifying the behaviour of the stream. This parameter is provided
for future use and is unused at present.stream
- On success, a pointer to the generated \ref hs_stream_t will be
returned; NULL on failure.@Cast(value="hs_error_t") public static int hs_open_stream(@Const hs_database_t db, @Cast(value="unsigned int") int flags, @ByPtrPtr hs_stream_t stream)
@Cast(value="hs_error_t") public static int hs_scan_stream(hs_stream_t id, @Cast(value="const char*") BytePointer data, @Cast(value="unsigned int") int length, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer ctxt)
id
- The stream ID (returned by \ref hs_open_stream()) to which the data
will be written.data
- Pointer to the data to be scanned.length
- The number of bytes to scan.flags
- Flags modifying the behaviour of the stream. This parameter is provided
for future use and is unused at present.scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch().onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.ctxt
- The user defined pointer which will be passed to the callback function
when a match occurs.@Cast(value="hs_error_t") public static int hs_scan_stream(hs_stream_t id, String data, @Cast(value="unsigned int") int length, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer ctxt)
@Cast(value="hs_error_t") public static int hs_close_stream(hs_stream_t id, hs_scratch_t scratch, match_event_handler onEvent, Pointer ctxt)
$
meta-character). If these matches are
not desired, NULL may be provided as the \ref match_event_handler callback.
If NULL is provided as the \ref match_event_handler callback, it is
permissible to provide a NULL scratch.id
- The stream ID returned by \ref hs_open_stream().scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch(). This is
allowed to be NULL only if the \p onEvent callback is also NULL.onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.ctxt
- The user defined pointer which will be passed to the callback function
when a match occurs.@Cast(value="hs_error_t") public static int hs_reset_stream(hs_stream_t id, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
$
meta-character). If these
matches are not desired, NULL may be provided as the \ref match_event_handler
callback.
Note: the stream will also be tied to the same database.id
- The stream (as created by \ref hs_open_stream()) to be replaced.flags
- Flags modifying the behaviour of the stream. This parameter is provided
for future use and is unused at present.scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch(). This is
allowed to be NULL only if the \p onEvent callback is also NULL.onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.context
- The user defined pointer which will be passed to the callback function
when a match occurs.@Cast(value="hs_error_t") public static int hs_copy_stream(@Cast(value="hs_stream_t**") PointerPointer to_id, @Const hs_stream_t from_id)
to_id
- On success, a pointer to the new, copied \ref hs_stream_t will be
returned; NULL on failure.from_id
- The stream (as created by \ref hs_open_stream()) to be copied.@Cast(value="hs_error_t") public static int hs_copy_stream(@ByPtrPtr hs_stream_t to_id, @Const hs_stream_t from_id)
@Cast(value="hs_error_t") public static int hs_reset_and_copy_stream(hs_stream_t to_id, @Const hs_stream_t from_id, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
to_id
- On success, a pointer to the new, copied \ref hs_stream_t will be
returned; NULL on failure.from_id
- The stream (as created by \ref hs_open_stream()) to be copied.scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch(). This is
allowed to be NULL only if the \p onEvent callback is also NULL.onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.context
- The user defined pointer which will be passed to the callback function
when a match occurs.@Cast(value="hs_error_t") public static int hs_compress_stream(@Const hs_stream_t stream, @Cast(value="char*") BytePointer buf, @Cast(value="size_t") long buf_space, @Cast(value="size_t*") SizeTPointer used_space)
stream
- The stream (as created by \ref hs_open_stream()) to be compressed.buf
- Buffer to write the compressed representation into. Note: if the call is
just being used to determine the amount of space required, it is allowed
to pass NULL here and \p buf_space as 0.buf_space
- The number of bytes in \p buf. If buf_space is too small, the call will
fail with \ref HS_INSUFFICIENT_SPACE.used_space
- Pointer to where the amount of used space will be written to. The used
buffer space is always less than or equal to \p buf_space. If the call
fails with \ref HS_INSUFFICIENT_SPACE, this pointer will be used to
write out the amount of buffer space required.@Cast(value="hs_error_t") public static int hs_compress_stream(@Const hs_stream_t stream, @Cast(value="char*") ByteBuffer buf, @Cast(value="size_t") long buf_space, @Cast(value="size_t*") SizeTPointer used_space)
@Cast(value="hs_error_t") public static int hs_compress_stream(@Const hs_stream_t stream, @Cast(value="char*") byte[] buf, @Cast(value="size_t") long buf_space, @Cast(value="size_t*") SizeTPointer used_space)
@Cast(value="hs_error_t") public static int hs_expand_stream(@Const hs_database_t db, @Cast(value="hs_stream_t**") PointerPointer stream, @Cast(value="const char*") BytePointer buf, @Cast(value="size_t") long buf_size)
db
- The compiled pattern database that the compressed stream was opened
against.stream
- On success, a pointer to the expanded \ref hs_stream_t will be
returned; NULL on failure.buf
- A compressed representation of a stream. These compressed forms are
created by \ref hs_compress_stream().buf_size
- The size in bytes of the compressed representation.@Cast(value="hs_error_t") public static int hs_expand_stream(@Const hs_database_t db, @ByPtrPtr hs_stream_t stream, @Cast(value="const char*") BytePointer buf, @Cast(value="size_t") long buf_size)
@Cast(value="hs_error_t") public static int hs_expand_stream(@Const hs_database_t db, @ByPtrPtr hs_stream_t stream, String buf, @Cast(value="size_t") long buf_size)
@Cast(value="hs_error_t") public static int hs_reset_and_expand_stream(hs_stream_t to_stream, @Cast(value="const char*") BytePointer buf, @Cast(value="size_t") long buf_size, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
to_stream
- A pointer to a valid stream state. A pointer to the expanded \ref
hs_stream_t will be returned; NULL on failure.buf
- A compressed representation of a stream. These compressed forms are
created by \ref hs_compress_stream().buf_size
- The size in bytes of the compressed representation.scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch(). This is
allowed to be NULL only if the \p onEvent callback is also NULL.onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.context
- The user defined pointer which will be passed to the callback function
when a match occurs.@Cast(value="hs_error_t") public static int hs_reset_and_expand_stream(hs_stream_t to_stream, String buf, @Cast(value="size_t") long buf_size, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
@Cast(value="hs_error_t") public static int hs_scan(@Const hs_database_t db, @Cast(value="const char*") BytePointer data, @Cast(value="unsigned int") int length, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
db
- A compiled pattern database.data
- Pointer to the data to be scanned.length
- The number of bytes to scan.flags
- Flags modifying the behaviour of this function. This parameter is
provided for future use and is unused at present.scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch() for this
database.onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.context
- The user defined pointer which will be passed to the callback function.@Cast(value="hs_error_t") public static int hs_scan(@Const hs_database_t db, String data, @Cast(value="unsigned int") int length, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
@Cast(value="hs_error_t") public static int hs_scan_vector(@Const hs_database_t db, @Cast(value="const char*const*") PointerPointer data, @Cast(value="const unsigned int*") IntPointer length, @Cast(value="unsigned int") int count, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
db
- A compiled pattern database.data
- An array of pointers to the data blocks to be scanned.length
- An array of lengths (in bytes) of each data block to scan.count
- Number of data blocks to scan. This should correspond to the size of
of the \p data and \p length arrays.flags
- Flags modifying the behaviour of this function. This parameter is
provided for future use and is unused at present.scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch() for
this database.onEvent
- Pointer to a match event callback function. If a NULL pointer is given,
no matches will be returned.context
- The user defined pointer which will be passed to the callback function.@Cast(value="hs_error_t") public static int hs_scan_vector(@Const hs_database_t db, @Cast(value="const char*const*") @ByPtrPtr BytePointer data, @Cast(value="const unsigned int*") IntPointer length, @Cast(value="unsigned int") int count, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
@Cast(value="hs_error_t") public static int hs_scan_vector(@Const hs_database_t db, @Cast(value="const char*const*") @ByPtrPtr ByteBuffer data, @Cast(value="const unsigned int*") IntBuffer length, @Cast(value="unsigned int") int count, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
@Cast(value="hs_error_t") public static int hs_scan_vector(@Const hs_database_t db, @Cast(value="const char*const*") @ByPtrPtr byte[] data, @Cast(value="const unsigned int*") int[] length, @Cast(value="unsigned int") int count, @Cast(value="unsigned int") int flags, hs_scratch_t scratch, match_event_handler onEvent, Pointer context)
@Cast(value="hs_error_t") public static int hs_alloc_scratch(@Const hs_database_t db, @Cast(value="hs_scratch_t**") PointerPointer scratch)
db
- The database, as produced by \ref hs_compile().scratch
- On first allocation, a pointer to NULL should be provided so a new
scratch can be allocated. If a scratch block has been previously
allocated, then a pointer to it should be passed back in to see if it
is valid for this database block. If a new scratch block is required,
the original will be freed and the new one returned, otherwise the
previous scratch block will be returned. On success, the scratch block
will be suitable for use with the provided database in addition to any
databases that original scratch space was suitable for.@Cast(value="hs_error_t") public static int hs_alloc_scratch(@Const hs_database_t db, @ByPtrPtr hs_scratch_t scratch)
@Cast(value="hs_error_t") public static int hs_clone_scratch(@Const hs_scratch_t src, @Cast(value="hs_scratch_t**") PointerPointer dest)
src
- The existing \ref hs_scratch_t to be cloned.dest
- A pointer to the new scratch space will be returned here.@Cast(value="hs_error_t") public static int hs_clone_scratch(@Const hs_scratch_t src, @ByPtrPtr hs_scratch_t dest)
@Cast(value="hs_error_t") public static int hs_scratch_size(@Const hs_scratch_t scratch, @Cast(value="size_t*") SizeTPointer scratch_size)
scratch
- A per-thread scratch space allocated by \ref hs_alloc_scratch() or \ref
hs_clone_scratch().scratch_size
- On success, the size of the scratch space in bytes is placed in this
parameter.@Cast(value="hs_error_t") public static int hs_free_scratch(hs_scratch_t scratch)
scratch
- The scratch block to be freed. NULL may also be safely provided.Copyright © 2024. All rights reserved.