Volksdata 1.0b7
RDF library
Loading...
Searching...
No Matches
core.h File Reference
#include <ctype.h>
#include <dirent.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <uuid/uuid.h>
#include "log.h"
#include "xxhash.h"
Include dependency graph for core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOG_USE_COLOR
#define BREAKPOINT
#define LIKELY(x)
#define UNLIKELY(x)
#define TMPDIR   "/tmp"
#define VOLK_VERSION   "1.0b7"
#define VOLK_NS   "info:volksdata:"
#define KLEN   sizeof(VOLK_Key)
#define DBL_KLEN   sizeof(VOLK_DoubleKey)
#define TRP_KLEN   sizeof(VOLK_TripleKey)
#define QUAD_KLEN   sizeof(VOLK_QuadKey)
#define UUIDSTR_SIZE   37
#define NULL_TRP   {NULL_KEY, NULL_KEY, NULL_KEY}
 "NULL" triple, a value that is never user-provided.
#define VOLK_OK   0
 Generic success return code.
#define VOLK_NOACTION   88801
 No action taken.
#define VOLK_NORESULT   88802
 No result yielded.
#define VOLK_END   88803
 Loop end.
#define VOLK_CONFLICT   88804
 Conflict warning.
#define VOLK_ERROR   -88899
 Generic error return code.
#define VOLK_PARSE_ERR   -88898
 Codec parser error.
#define VOLK_VALUE_ERR   -88897
 An invalid input value was provided.
#define VOLK_TXN_ERR   -88896
 Error handling a store transaction.
#define VOLK_DB_ERR   -88895
 Low-level database error.
#define VOLK_NOT_IMPL_ERR   -88894
 Functionality is not implemented.
#define VOLK_IO_ERR   -88893
 I/O error.
#define VOLK_MEM_ERR   -88892
 Memory allocation error.
#define VOLK_CONFLICT_ERR   -88891
 Conflict error.
#define VOLK_ENV_ERR   -88890
 Error while handling environment setup; or environment not initialized.
#define VOLK_HASH_SEED   0
 Seed used for all hashing. Compile-time configurable.
#define VOLK_HASH32(buf, size, seed)
 Default 32-bit hashing function.
#define VOLK_HASH64(buf, size, seed)
 Default 64-bit hashing function.
#define VOLK_HASH128(buf, size, seed)
 Default 128-bit hashing function.
#define VOLK_HASH(...)
 Default hashing function. Depends on architecture.
#define VOLK_MIN_ERROR   -88899
 Minimum error value.
#define VOLK_MAX_ERROR   -88000
#define VOLK_MIN_WARNING   88800
 First warning value.
#define VOLK_MAX_WARNING   88899
#define LOG_DEBUG(...)
#define LOG_TRACE(...)
#define LOG_RC(rc)
 Log an error or warning for return codes that are not VOLK_OK.
#define CHECK(exp, marker)
 Jump to marker if exp does not return VOLK_OK.
#define PCHECK(exp, marker)
 Jump to marker if exp returns a negative value (skip warnings).
#define NLCHECK(exp, marker)
 Log error and jump to marker if exp is NULL.
#define RCCK(exp)
 Return exp return value if it is of VOLK_rc type and nonzero.
#define PRCCK(exp)
 Return exp return value if it is of VOLK_rc type and negative (=error).
#define RCNL(exp)
 Return NULL if exp returns a nonzero value.
#define PRCNL(exp)
 Return NULL if exp returns a negative value (=error).
#define NLNL(exp)
 Log error and return NULL if exp is NULL.
#define MALLOC_GUARD(var, rc)
 Allocate one pointer with malloc and return rc if it fails.
#define CALLOC_GUARD(var, rc)
 Allocate one pointer with calloc and return rc if it fails.

Typedefs

typedef int VOLK_rc
typedef XXH32_hash_t VOLK_Hash32
 32-bit hash data type.
typedef XXH64_hash_t VOLK_Hash64
 64-bit hash data type.
typedef XXH128_hash_t VOLK_Hash128
 128-bit hash data type.
typedef VOLK_Hash64 VOLK_Hash
 Default hash data type.
typedef size_t VOLK_Key
 Term key, i.e., hash of a serialized term.
typedef VOLK_Key VOLK_DoubleKey[2]
 Array of two VOLK_Key values.
typedef VOLK_Key VOLK_TripleKey[3]
 Array of three VOLK_Key values, representing a triple.
typedef VOLK_Key VOLK_QuadKey[4]
 Array of three VOLK_Key values, representing a triple with context.
typedef char uuid_str_t[UUIDSTR_SIZE]
 UUID string tpe.

Enumerations

enum  VOLK_bool_op { VOLK_BOOL_UNION , VOLK_BOOL_SUBTRACTION , VOLK_BOOL_INTERSECTION , VOLK_BOOL_XOR }
 Boolean operations that can be performed on a graph. More...

Functions

const char * VOLK_strerror (VOLK_rc rc)
 Return an error message for a return code.
char * strndup (const char *src, size_t max)
 Replacement for GNU strndup.
char * strdup (const char *src)
 Replacement for GNU strdup.
VOLK_rc mkdir_p (const char *path, mode_t mode)
 Make recursive directories.
VOLK_rc rm_r (const char *path)
 Remove a directory recursively, as in Unix "rm -r".
int utf8_encode (const uint32_t utf, unsigned char *out)
 Encode a code point using UTF-8.

Variables

char * warning_msg []
 Warning messages.
char * error_msg []
char * VOLK_root_path
bool VOLK_env_is_init
 Whether the environment is initialized.

Macro Definition Documentation

◆ LOG_USE_COLOR

#define LOG_USE_COLOR

Definition at line 5 of file core.h.

◆ BREAKPOINT

#define BREAKPOINT

Definition at line 33 of file core.h.

◆ LIKELY

#define LIKELY ( x)
Value:
__builtin_expect(!!(x), true)

Definition at line 38 of file core.h.

◆ UNLIKELY

#define UNLIKELY ( x)
Value:
__builtin_expect(!!(x), false)

Definition at line 39 of file core.h.

◆ TMPDIR

#define TMPDIR   "/tmp"

Definition at line 42 of file core.h.