Documentation - C API
host.h File Reference

Host. More...

Macros

Configuration options
#define VL_DISABLE_THREADS
 Defined if multi-threading support is disabled.
#define VL_DISABLE_SSE2
 Defined if SSE2 support if disabled.
#define VL_DISABLE_OPENMP
 Defined if OpenMP support is disabled.
Defining functions
#define VL_EXPORT
 Declares a DLL exported symbol.
#define VL_INLINE
 Adds appropriate inline function qualifier.
C preprocessor helper macros
#define VL_STRINGIFY(x)   # x
 Convert the argument to a string.
#define VL_XSTRINGIFY(x)   VL_STRINGIFY(x)
 Expand and then convert the argument to a string.
#define VL_CAT(x, y)   x ## y
 Concatenate two arguments into a lexical unit.
#define VL_XCAT(x, y)   VL_CAT(x,y)
 Expand and then concatenate two arguments into a lexical unit.
#define VL_XCAT3(x, y, z)   VL_XCAT(VL_XCAT(x,y),z)
 Expand and then concatenate three arguments into a lexical unit.
#define VL_XCAT4(x, y, z, u)   VL_XCAT(VL_XCAT3(x,y,z),u)
 Expand and then concatenate four arguments into a lexical unit.
#define VL_XCAT5(x, y, z, u, v)   VL_XCAT(VL_XCAT4(x,y,z,u),v)
 Expand and then concatenate five arguments into a lexical unit.
#define VL_YESNO(x)   ((x)?"yes":"no")
 Convert a boolean to "yes" or "no" strings.
Identifying the host operating system
#define VL_OS_LINUX   1
 Defined if the host operating system is Linux.
#define VL_OS_MACOSX   1
 Defined if the host operating system is Mac OS X.
#define VL_OS_WIN   1
 Defined if the host operating system is Windows (32 or 64)
#define VL_OS_WIN64   1
 Defined if the host operating system is Windows-64.
Identifying the host threading library
#define VL_THREADS_POSIX   1
 Defiend if the host uses POISX threads.
#define VL_THREADS_WIN   1
 Defined if the host uses Windows threads.
Identifying the host compiler
#define VL_COMPILER_GNUC
 Defined if the host compiler is GNU C.
#define VL_COMPILER_MSC   _MSC_VER
 Defined if the host compiler is Microsoft Visual C++.
#define VL_COMPILER_LCC   1
 Defined if the host compiler is LCC.
Identifying the host CPU architecture
#define VL_ARCH_IX86   300
 Defined if the host CPU is of the Intel x86 family.
#define VL_ARCH_IA64
 Defined if the host CPU is of the Intel Architecture-64 family.
Identifying the host data model
#define VL_COMPILER_LLP64
 Defined if the host compiler data model is LLP64.
#define VL_COMPILER_LP64
 Defined if the host compiler data model is LP64.
#define VL_COMPILER_ILP32
 Defined if the host compiler data model is ILP32.
Identifying the host endianness
#define VL_ARCH_LITTLE_ENDIAN
 Defined if the host CPU is little endian.
#define VL_ARCH_BIG_ENDIAN
 Defined if the host CPU is big endian.
Creating integer constants
#define VL_INT8_C(x)   x
 Create an integer constant of the specified width and sign.
#define VL_INT16_C(x)   x
 Create an integer constant of the specified width and sign.
#define VL_INT32_C(x)   x
 Create an integer constant of the specified width and sign.
#define VL_INT64_C(x)   x ## L
 Create an integer constant of the specified width and sign.
#define VL_UINT8_C(x)   x
 Create an integer constant of the specified width and sign.
#define VL_UINT16_C(x)   x
 Create an integer constant of the specified width and sign.
#define VL_UINT32_C(x)   x ## U
 Create an integer constant of the specified width and sign.
#define VL_UINT64_C(x)   x ## UL
 Create an integer constant of the specified width and sign.
Printing the atomic data types
#define VL_FL_INT64   "I64"
 printf length flag for vl_int64 and vl_uint64.
#define VL_FL_INT32   ""
 printf length flag for vl_int32 and vl_uint32.
#define VL_FL_INT16   "h"
 printf length flag for vl_int16 and vl_uint16.
#define VL_FL_INT8   "hh"
 printf length flag for vl_int8 and vl_uint8.
#define VL_FL_INDEX   VL_FL_INT64
 printf length flag for vl_index and vl_uindex
#define VL_FL_INDEX   VL_FL_INT32
 printf length flag for vl_index and vl_uindex
#define VL_FMT_INDEX   VL_FL_INDEX "d"
 printf flag for vl_index
#define VL_FMT_INTPTR   VL_FMT_INDEX
 printf flag for vl_intptr
#define VL_FMT_UINDEX   VL_FL_INDEX "u"
 printf flag for vl_uindex
#define VL_FMT_SIZE   VL_FMT_UINDEX
 printf flag for vl_size
#define VL_FMT_UINTPTR   VL_FMT_UINDEX
 printf flag for vl_uintptr
Atomic data types limits
#define VL_BIG_INT   0x7FFFFFFFL
 Largest integer (math constant)
#define VL_SMALL_INT   (- VL_BIG_INT - 1)
 Smallest integer (math constant)
#define VL_BIG_UINT   0xFFFFFFFFUL
 Largest unsigned integer (math constant)

Functions

char * vl_static_configuration_to_string_copy ()
 Human readable static library configuration.
Endianness detection and conversion
void vl_swap_host_big_endianness_8 (void *dst, void *src)
 Host <-> big endian transformation for 8-bytes value.
void vl_swap_host_big_endianness_4 (void *dst, void *src)
 Host <-> big endian transformation for 4-bytes value.
void vl_swap_host_big_endianness_2 (void *dst, void *src)
 Host <-> big endian transformation for 2-bytes value.
Obtaining host info at run time
void _vl_x86cpu_info_init (VlX86CpuInfo *self)
char * _vl_x86cpu_info_to_string_copy (VlX86CpuInfo const *self)

Atomic data types

#define VL_TRUE   1
 true (1) constant
#define VL_FALSE   0
 false (0) constant
typedef long long vl_int64
 Signed 64-bit integer.
typedef int vl_int32
 Signed 32-bit integer.
typedef short vl_int16
 Signed 16-bit integer.
typedef char vl_int8
 Signed 8-bit integer.
typedef long long unsigned vl_uint64
 Unsigned 64-bit integer.
typedef int unsigned vl_uint32
 Unsigned 32-bit integer.
typedef short unsigned vl_uint16
 Unsigned 16-bit integer.
typedef char unsigned vl_uint8
 Unsigned 8-bit integer.
typedef int vl_int
 Same as int.
typedef unsigned int vl_uint
 Same as unsigned int.
typedef int vl_bool
 Boolean.
typedef vl_int64 vl_intptr
 Integer holding a pointer.
typedef vl_uint64 vl_uintptr
 Unsigned integer holding a pointer.
typedef vl_uint64 vl_size
 Unsigned integer holding the size of a memory block.
typedef vl_int64 vl_index
 Signed version of vl_size and vl_uindex.
typedef vl_uint64 vl_uindex
 Same as vl_size.

Detailed Description

Author:
Andrea Vedaldi
See also:
Portability features

Macro Definition Documentation

#define VL_ARCH_BIG_ENDIAN
See also:
Endianness
#define VL_ARCH_IA64
#define VL_ARCH_IX86   300
#define VL_ARCH_LITTLE_ENDIAN
See also:
Endianness
#define VL_CAT (   x,
 
)    x ## y
Parameters:
xfirst argument to be concatenated.
ysecond argument to be concatenated.

This macro concatenates its arguments into a single lexical unit by means of the ## preprocessor operator. Notice that arguments concatenated by ## are not pre-expanded by the C preprocessor. To macro-expand the arguments and then concatenate them,use VL_XCAT.

See also:
VL_XCAT
#define VL_COMPILER_GNUC
Value:
(__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100)

This macro is defined if the compiler is GNUC. Its value is calculated as

10000 * MAJOR + 100 * MINOR + PATCHLEVEL
See also:
Host compiler
#define VL_COMPILER_ILP32
See also:
Data models
#define VL_COMPILER_LCC   1
Deprecated:
The LCC is not supported anymore.
See also:
Host compiler
#define VL_COMPILER_LLP64
See also:
Data models
#define VL_COMPILER_LP64
See also:
Data models
#define VL_COMPILER_MSC   _MSC_VER
See also:
Host compiler
#define VL_DISABLE_OPENMP

Define this symbol during compilation of the library and linking to another project to disable VLFeat OpenMP support.

#define VL_DISABLE_SSE2

Define this symbol during compliation of the library and linking to another project to disable VLFeat SSE2 support.

#define VL_DISABLE_THREADS

Define this symbol during compilation of the library and linking to another project to disable VLFeat multi-threading support.

#define VL_EXPORT
#define VL_INLINE
#define VL_INT16_C (   x)    x

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_INT32_C (   x)    x

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_INT64_C (   x)    x ## L

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_INT8_C (   x)    x
Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.
#define VL_STRINGIFY (   x)    # x
Parameters:
xvalue to be stringified.

This macro stringifies the argument x by means of the # prerpocessor operator.

The standard C preprocessor does not prescan arguments which are stringified, so

#define A B
char const * str = VL_STRINGIFY(A) ;

initializes str with a pointer to the string "A", which mihgt be unexpected. To fix this issue, you can use VL_XSTRINGIFY.

See also:
VL_XSTRINGIFY
#define VL_THREADS_POSIX   1
See also:
Multi-threading
#define VL_THREADS_WIN   1
See also:
Multi-threading
#define VL_UINT16_C (   x)    x

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_UINT32_C (   x)    x ## U

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_UINT64_C (   x)    x ## UL

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_UINT8_C (   x)    x

Parameters:
xinteger constant.
Returns:
x with the correct suffix for the given sign and size. The suffix used depends on the Data models.
Example:
The macro VL_INT64_C(1234) is expanded as 123L in a LP64 system and as 123LL in a LLP64 system.

#define VL_XCAT (   x,
 
)    VL_CAT(x,y)
Parameters:
xfirst argument to be concatenated.
ysecond argument to be concatenated.

This macro is the same as VL_CAT, except that the arguments are macro expanded before being concatenated.

See also:
VL_CAT
#define VL_XCAT3 (   x,
  y,
 
)    VL_XCAT(VL_XCAT(x,y),z)
Parameters:
xfirst argument to be concatenated.
ysecond argument to be concatenated.
zthird argument to be concatenated.

This macro is the same as VL_XCAT, except that it has three arguments.

See also:
VL_XCAT
#define VL_XCAT4 (   x,
  y,
  z,
 
)    VL_XCAT(VL_XCAT3(x,y,z),u)
Parameters:
xfirst argument to be concatenated.
ysecond argument to be concatenated.
zthird argument to be concatenated.
ufourth argument to be concatenated.

This macro is the same as VL_XCAT, except that it has four arguments.

See also:
VL_XCAT
#define VL_XCAT5 (   x,
  y,
  z,
  u,
 
)    VL_XCAT(VL_XCAT4(x,y,z,u),v)
Parameters:
xfirst argument to be concatenated.
ysecond argument to be concatenated.
zthird argument to be concatenated.
ufourth argument to be concatenated.
vfifth argument to be concatenated.

This macro is the same as VL_XCAT, except that it has five arguments.

See also:
VL_XCAT
#define VL_XSTRINGIFY (   x)    VL_STRINGIFY(x)
Parameters:
xvalue to be macro-expanded and converted.

This macro macro-expands the argument x and stringifies the result of the expansion. For instance

#define A B
char const * str = VL_STRINGIFY(A) ;

initializes str with a pointer to the string "B".

See also:
VL_STRINGIFY
#define VL_YESNO (   x)    ((x)?"yes":"no")
Parameters:
xboolean to convert.

A pointer to either the string "yes" (if x is true) or the string "no".

Example
VL_PRINTF("Is x true? %s.", VL_YESNO(x))

Function Documentation

char* vl_static_configuration_to_string_copy ( )
Returns:
a new string with the static configuration.

The string includes information about the compiler, the host, and other static configuration parameters. The string must be released by vl_free.

void vl_swap_host_big_endianness_2 ( void *  dst,
void *  src 
)
inline
Parameters:
dstdestination 2-byte buffer.
srcsource 2-byte bufffer.
See also:
Endianness.
void vl_swap_host_big_endianness_4 ( void *  dst,
void *  src 
)
inline
Parameters:
dstdestination 4-byte buffer.
srcsource 4-byte bufffer.
See also:
Endianness.
void vl_swap_host_big_endianness_8 ( void *  dst,
void *  src 
)
inline
Parameters:
dstdestination 8-byte buffer.
srcsource 8-byte bufffer.
See also:
Endianness.