mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-09 15:52:27 +03:00
msvc: use the vectorcall calling convention
This requires declaring external interfaces with the cdecl calling convention.
This commit is contained in:
@@ -29,6 +29,11 @@
|
||||
#ifndef HS_COMMON_H_
|
||||
#define HS_COMMON_H_
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define HS_CDECL __cdecl
|
||||
#else
|
||||
#define HS_CDECL
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
@@ -76,7 +81,7 @@ typedef int hs_error_t;
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_free_database(hs_database_t *db);
|
||||
hs_error_t HS_CDECL hs_free_database(hs_database_t *db);
|
||||
|
||||
/**
|
||||
* Serialize a pattern database to a stream of bytes.
|
||||
@@ -100,8 +105,8 @@ hs_error_t hs_free_database(hs_database_t *db);
|
||||
* @ref HS_SUCCESS on success, @ref HS_NOMEM if the byte array cannot be
|
||||
* allocated, other values may be returned if errors are detected.
|
||||
*/
|
||||
hs_error_t hs_serialize_database(const hs_database_t *db, char **bytes,
|
||||
size_t *length);
|
||||
hs_error_t HS_CDECL hs_serialize_database(const hs_database_t *db, char **bytes,
|
||||
size_t *length);
|
||||
|
||||
/**
|
||||
* Reconstruct a pattern database from a stream of bytes previously generated
|
||||
@@ -129,8 +134,9 @@ hs_error_t hs_serialize_database(const hs_database_t *db, char **bytes,
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_deserialize_database(const char *bytes, const size_t length,
|
||||
hs_database_t **db);
|
||||
hs_error_t HS_CDECL hs_deserialize_database(const char *bytes,
|
||||
const size_t length,
|
||||
hs_database_t **db);
|
||||
|
||||
/**
|
||||
* Reconstruct a pattern database from a stream of bytes previously generated
|
||||
@@ -160,8 +166,9 @@ hs_error_t hs_deserialize_database(const char *bytes, const size_t length,
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_deserialize_database_at(const char *bytes, const size_t length,
|
||||
hs_database_t *db);
|
||||
hs_error_t HS_CDECL hs_deserialize_database_at(const char *bytes,
|
||||
const size_t length,
|
||||
hs_database_t *db);
|
||||
|
||||
/**
|
||||
* Provides the size of the stream state allocated by a single stream opened
|
||||
@@ -177,7 +184,8 @@ hs_error_t hs_deserialize_database_at(const char *bytes, const size_t length,
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_stream_size(const hs_database_t *database, size_t *stream_size);
|
||||
hs_error_t HS_CDECL hs_stream_size(const hs_database_t *database,
|
||||
size_t *stream_size);
|
||||
|
||||
/**
|
||||
* Provides the size of the given database in bytes.
|
||||
@@ -192,8 +200,8 @@ hs_error_t hs_stream_size(const hs_database_t *database, size_t *stream_size);
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_database_size(const hs_database_t *database,
|
||||
size_t *database_size);
|
||||
hs_error_t HS_CDECL hs_database_size(const hs_database_t *database,
|
||||
size_t *database_size);
|
||||
|
||||
/**
|
||||
* Utility function for reporting the size that would be required by a
|
||||
@@ -219,8 +227,9 @@ hs_error_t hs_database_size(const hs_database_t *database,
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_serialized_database_size(const char *bytes, const size_t length,
|
||||
size_t *deserialized_size);
|
||||
hs_error_t HS_CDECL hs_serialized_database_size(const char *bytes,
|
||||
const size_t length,
|
||||
size_t *deserialized_size);
|
||||
|
||||
/**
|
||||
* Utility function providing information about a database.
|
||||
@@ -237,7 +246,8 @@ hs_error_t hs_serialized_database_size(const char *bytes, const size_t length,
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_database_info(const hs_database_t *database, char **info);
|
||||
hs_error_t HS_CDECL hs_database_info(const hs_database_t *database,
|
||||
char **info);
|
||||
|
||||
/**
|
||||
* Utility function providing information about a serialized database.
|
||||
@@ -258,8 +268,8 @@ hs_error_t hs_database_info(const hs_database_t *database, char **info);
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_serialized_database_info(const char *bytes, size_t length,
|
||||
char **info);
|
||||
hs_error_t HS_CDECL hs_serialized_database_info(const char *bytes,
|
||||
size_t length, char **info);
|
||||
|
||||
/**
|
||||
* The type of the callback function that will be used by Hyperscan to allocate
|
||||
@@ -275,7 +285,7 @@ hs_error_t hs_serialized_database_info(const char *bytes, size_t length,
|
||||
* @return
|
||||
* A pointer to the region of memory allocated, or NULL on error.
|
||||
*/
|
||||
typedef void *(*hs_alloc_t)(size_t size);
|
||||
typedef void *(HS_CDECL *hs_alloc_t)(size_t size);
|
||||
|
||||
/**
|
||||
* The type of the callback function that will be used by Hyperscan to free
|
||||
@@ -284,7 +294,7 @@ typedef void *(*hs_alloc_t)(size_t size);
|
||||
* @param ptr
|
||||
* The region of memory to be freed.
|
||||
*/
|
||||
typedef void (*hs_free_t)(void *ptr);
|
||||
typedef void (HS_CDECL *hs_free_t)(void *ptr);
|
||||
|
||||
/**
|
||||
* Set the allocate and free functions used by Hyperscan for allocating
|
||||
@@ -312,7 +322,8 @@ typedef void (*hs_free_t)(void *ptr);
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_set_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
hs_error_t HS_CDECL 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
|
||||
@@ -344,8 +355,8 @@ hs_error_t hs_set_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_set_database_allocator(hs_alloc_t alloc_func,
|
||||
hs_free_t free_func);
|
||||
hs_error_t HS_CDECL 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
|
||||
@@ -371,7 +382,8 @@ hs_error_t hs_set_database_allocator(hs_alloc_t alloc_func,
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_set_misc_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
hs_error_t HS_CDECL 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
|
||||
@@ -397,7 +409,8 @@ hs_error_t hs_set_misc_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_set_scratch_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
hs_error_t HS_CDECL 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
|
||||
@@ -423,7 +436,8 @@ hs_error_t hs_set_scratch_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
* @return
|
||||
* @ref HS_SUCCESS on success, other values on failure.
|
||||
*/
|
||||
hs_error_t hs_set_stream_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
hs_error_t HS_CDECL hs_set_stream_allocator(hs_alloc_t alloc_func,
|
||||
hs_free_t free_func);
|
||||
|
||||
/**
|
||||
* Utility function for identifying this release version.
|
||||
@@ -433,7 +447,7 @@ hs_error_t hs_set_stream_allocator(hs_alloc_t alloc_func, hs_free_t free_func);
|
||||
* date of the build. It is allocated statically, so it does not need to
|
||||
* be freed by the caller.
|
||||
*/
|
||||
const char *hs_version(void);
|
||||
const char * HS_CDECL hs_version(void);
|
||||
|
||||
/**
|
||||
* Utility function to test the current system architecture.
|
||||
@@ -450,7 +464,7 @@ const char *hs_version(void);
|
||||
* @ref HS_SUCCESS on success, @ref HS_ARCH_ERROR if system does not
|
||||
* support Hyperscan.
|
||||
*/
|
||||
hs_error_t hs_valid_platform(void);
|
||||
hs_error_t HS_CDECL hs_valid_platform(void);
|
||||
|
||||
/**
|
||||
* @defgroup HS_ERROR hs_error_t values
|
||||
|
Reference in New Issue
Block a user