github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/database/vedis/vedis.h (about)

     1  /* This file was automatically generated.  Do not edit (Except for compile time directives)! */ 
     2  #ifndef  _VEDIS_H_
     3  #define  _VEDIS_H_
     4  /*
     5   * Symisc Vedis: A Highly Efficient Embeddable Data Store Engine.
     6   * Copyright (C) 2013, Symisc Systems http://vedis.symisc.net/
     7   * Version 1.2.6
     8   * For information on licensing, redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES
     9   * please contact Symisc Systems via:
    10   *       legal@symisc.net
    11   *       licensing@symisc.net
    12   *       contact@symisc.net
    13   * or visit:
    14   *      http://vedis.symisc.net/
    15   */
    16  /*
    17   * Copyright (C) 2013 Symisc Systems, S.U.A.R.L [M.I.A.G Mrad Chems Eddine <chm@symisc.net>].
    18   * All rights reserved.
    19   *
    20   * Redistribution and use in source and binary forms, with or without
    21   * modification, are permitted provided that the following conditions
    22   * are met:
    23   * 1. Redistributions of source code must retain the above copyright
    24   *    notice, this list of conditions and the following disclaimer.
    25   * 2. Redistributions in binary form must reproduce the above copyright
    26   *    notice, this list of conditions and the following disclaimer in the
    27   *    documentation and/or other materials provided with the distribution.
    28   * 3. Redistributions in any form must be accompanied by information on
    29   *    how to obtain complete source code for the Vedis engine and any 
    30   *    accompanying software that uses the Vedis engine software.
    31   *    The source code must either be included in the distribution
    32   *    or be available for no more than the cost of distribution plus
    33   *    a nominal fee, and must be freely redistributable under reasonable
    34   *    conditions. For an executable file, complete source code means
    35   *    the source code for all modules it contains.It does not include
    36   *    source code for modules or files that typically accompany the major
    37   *    components of the operating system on which the executable file runs.
    38   *
    39   * THIS SOFTWARE IS PROVIDED BY SYMISC SYSTEMS ``AS IS'' AND ANY EXPRESS
    40   * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    41   * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
    42   * NON-INFRINGEMENT, ARE DISCLAIMED.  IN NO EVENT SHALL SYMISC SYSTEMS
    43   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    44   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    45   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    46   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    47   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    48   * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    49   * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    50   */
    51  /* Make sure we can call this stuff from C++ */
    52  #ifdef __cplusplus
    53  extern "C" { 
    54  #endif
    55   /* $SymiscID: vedis.h v1.2 Unix 2013-09-16 00:38 stable <chm@symisc.net> $ */
    56  #include <stdarg.h> /* needed for the definition of va_list */
    57  /*
    58   * Compile time engine version, signature, identification in the symisc source tree
    59   * and copyright notice.
    60   * Each macro have an equivalent C interface associated with it that provide the same
    61   * information but are associated with the library instead of the header file.
    62   * Refer to [vedis_lib_version()], [vedis_lib_signature()], [vedis_lib_ident()] and
    63   * [vedis_lib_copyright()] for more information.
    64   */
    65  /*
    66   * The VEDIS_VERSION C preprocessor macroevaluates to a string literal
    67   * that is the vedis version in the format "X.Y.Z" where X is the major
    68   * version number and Y is the minor version number and Z is the release
    69   * number.
    70   */
    71  #define VEDIS_VERSION "1.2.6"
    72  /*
    73   * The VEDIS_VERSION_NUMBER C preprocessor macro resolves to an integer
    74   * with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
    75   * numbers used in [VEDIS_VERSION].
    76   */
    77  #define VEDIS_VERSION_NUMBER 1002006
    78  /*
    79   * The VEDIS_SIG C preprocessor macro evaluates to a string
    80   * literal which is the public signature of the vedis engine.
    81   */
    82  #define VEDIS_SIG "vedis/1.2.6"
    83  /*
    84   * Vedis identification in the Symisc source tree:
    85   * Each particular check-in of a particular software released
    86   * by symisc systems have an unique identifier associated with it.
    87   * This macro hold the one associated with vedis.
    88   */
    89  #define VEDIS_IDENT "vedis:e361b2f3d4a71ac17e9f2ac1876232a13467dea1"
    90  /*
    91   * Copyright notice.
    92   * If you have any questions about the licensing situation, please
    93   * visit http://vedis.symisc.net/licensing.html
    94   * or contact Symisc Systems via:
    95   *   legal@symisc.net
    96   *   licensing@symisc.net
    97   *   contact@symisc.net
    98   */
    99  #define VEDIS_COPYRIGHT "Copyright (C) Symisc Systems, S.U.A.R.L [Mrad Chems Eddine <chm@symisc.net>] 2013, http://vedis.symisc.net/"
   100  /* Forward declaration to public objects */
   101  typedef struct vedis_io_methods vedis_io_methods;
   102  typedef struct vedis_kv_methods vedis_kv_methods;
   103  typedef struct vedis_kv_engine vedis_kv_engine;
   104  typedef struct vedis_context vedis_context;
   105  typedef struct vedis_value vedis_value;
   106  typedef struct vedis_vfs vedis_vfs;
   107  typedef struct vedis vedis;
   108  /*
   109   * ------------------------------
   110   * Compile time directives
   111   * ------------------------------
   112   * For most purposes, Vedis can be built just fine using the default compilation options.
   113   * However, if required, the compile-time options documented below can be used to omit Vedis
   114   * features (resulting in a smaller compiled library size) or to change the default values
   115   * of some parameters.
   116   * Every effort has been made to ensure that the various combinations of compilation options
   117   * work harmoniously and produce a working library.
   118   *
   119   * VEDIS_ENABLE_THREADS
   120   *  This option controls whether or not code is included in Vedis to enable it to operate
   121   *  safely in a multithreaded environment. The default is not. All mutexing code is omitted
   122   *  and it is unsafe to use Vedis in a multithreaded program. When compiled with the
   123   *  VEDIS_ENABLE_THREADS directive enabled, Vedis can be used in a multithreaded program
   124   *  and it is safe to share the same virtual machine and engine handle between two or more threads.
   125   *  The value of VEDIS_ENABLE_THREADS can be determined at run-time using the vedis_lib_is_threadsafe()
   126   *  interface.
   127   *  When Vedis has been compiled with threading support then the threading mode can be altered
   128   * at run-time using the vedis_lib_config() interface together with one of these verbs:
   129   *    VEDIS_LIB_CONFIG_THREAD_LEVEL_SINGLE
   130   *    VEDIS_LIB_CONFIG_THREAD_LEVEL_MULTI
   131   *  Platforms others than Windows and UNIX systems must install their own mutex subsystem via 
   132   *  vedis_lib_config() with a configuration verb set to VEDIS_LIB_CONFIG_USER_MUTEX.
   133   *  Otherwise the library is not threadsafe.
   134   *  Note that you must link Vedis with the POSIX threads library under UNIX systems (i.e: -lpthread).
   135   *
   136   */
   137  /* Symisc public definitions */
   138  #if !defined(SYMISC_STANDARD_DEFS)
   139  #define SYMISC_STANDARD_DEFS
   140  #if defined (_WIN32) || defined (WIN32) || defined(__MINGW32__) || defined (_MSC_VER) || defined (_WIN32_WCE)
   141  /* Windows Systems */
   142  #if !defined(__WINNT__)
   143  #define __WINNT__
   144  #endif 
   145  /*
   146   * Determine if we are dealing with WindowsCE - which has a much
   147   * reduced API.
   148   */
   149  #if defined(_WIN32_WCE)
   150  #ifndef __WIN_CE__
   151  #define __WIN_CE__
   152  #endif /* __WIN_CE__ */
   153  #endif /* _WIN32_WCE */
   154  #else
   155  /*
   156   * By default we will assume that we are compiling on a UNIX systems.
   157   * Otherwise the OS_OTHER directive must be defined.
   158   */
   159  #if !defined(OS_OTHER)
   160  #if !defined(__UNIXES__)
   161  #define __UNIXES__
   162  #endif /* __UNIXES__ */
   163  #else
   164  #endif /* OS_OTHER */
   165  #endif /* __WINNT__/__UNIXES__ */
   166  #if defined(_MSC_VER) || defined(__BORLANDC__)
   167  typedef signed __int64     sxi64; /* 64 bits(8 bytes) signed int64 */
   168  typedef unsigned __int64   sxu64; /* 64 bits(8 bytes) unsigned int64 */
   169  #else
   170  typedef signed long long int   sxi64; /* 64 bits(8 bytes) signed int64 */
   171  typedef unsigned long long int sxu64; /* 64 bits(8 bytes) unsigned int64 */
   172  #endif /* _MSC_VER */
   173  /* Signature of the consumer routine */
   174  typedef int (*ProcConsumer)(const void *, unsigned int, void *);
   175  /* Forward reference */
   176  typedef struct SyMutexMethods SyMutexMethods;
   177  typedef struct SyMemMethods SyMemMethods;
   178  typedef struct SyString SyString;
   179  typedef struct syiovec syiovec;
   180  typedef struct SyMutex SyMutex;
   181  typedef struct Sytm Sytm;
   182  /* Scatter and gather array. */
   183  struct syiovec
   184  {
   185  #if defined (__WINNT__)
   186  	/* Same fields type and offset as WSABUF structure defined one winsock2 header */
   187  	unsigned long nLen;
   188  	char *pBase;
   189  #else
   190  	void *pBase;
   191  	unsigned long nLen;
   192  #endif
   193  };
   194  struct SyString
   195  {
   196  	const char *zString;  /* Raw string (may not be null terminated) */
   197  	unsigned int nByte;   /* Raw string length */
   198  };
   199  /* Time structure. */
   200  struct Sytm
   201  {
   202    int tm_sec;     /* seconds (0 - 60) */
   203    int tm_min;     /* minutes (0 - 59) */
   204    int tm_hour;    /* hours (0 - 23) */
   205    int tm_mday;    /* day of month (1 - 31) */
   206    int tm_mon;     /* month of year (0 - 11) */
   207    int tm_year;    /* year + 1900 */
   208    int tm_wday;    /* day of week (Sunday = 0) */
   209    int tm_yday;    /* day of year (0 - 365) */
   210    int tm_isdst;   /* is summer time in effect? */
   211    char *tm_zone;  /* abbreviation of timezone name */
   212    long tm_gmtoff; /* offset from UTC in seconds */
   213  };
   214  /* Convert a tm structure (struct tm *) found in <time.h> to a Sytm structure */
   215  #define STRUCT_TM_TO_SYTM(pTM, pSYTM) \
   216  	(pSYTM)->tm_hour = (pTM)->tm_hour;\
   217  	(pSYTM)->tm_min	 = (pTM)->tm_min;\
   218  	(pSYTM)->tm_sec	 = (pTM)->tm_sec;\
   219  	(pSYTM)->tm_mon	 = (pTM)->tm_mon;\
   220  	(pSYTM)->tm_mday = (pTM)->tm_mday;\
   221  	(pSYTM)->tm_year = (pTM)->tm_year + 1900;\
   222  	(pSYTM)->tm_yday = (pTM)->tm_yday;\
   223  	(pSYTM)->tm_wday = (pTM)->tm_wday;\
   224  	(pSYTM)->tm_isdst = (pTM)->tm_isdst;\
   225  	(pSYTM)->tm_gmtoff = 0;\
   226  	(pSYTM)->tm_zone = 0;
   227  
   228  /* Convert a SYSTEMTIME structure (LPSYSTEMTIME: Windows Systems only ) to a Sytm structure */
   229  #define SYSTEMTIME_TO_SYTM(pSYSTIME, pSYTM) \
   230  	 (pSYTM)->tm_hour = (pSYSTIME)->wHour;\
   231  	 (pSYTM)->tm_min  = (pSYSTIME)->wMinute;\
   232  	 (pSYTM)->tm_sec  = (pSYSTIME)->wSecond;\
   233  	 (pSYTM)->tm_mon  = (pSYSTIME)->wMonth - 1;\
   234  	 (pSYTM)->tm_mday = (pSYSTIME)->wDay;\
   235  	 (pSYTM)->tm_year = (pSYSTIME)->wYear;\
   236  	 (pSYTM)->tm_yday = 0;\
   237  	 (pSYTM)->tm_wday = (pSYSTIME)->wDayOfWeek;\
   238  	 (pSYTM)->tm_gmtoff = 0;\
   239  	 (pSYTM)->tm_isdst = -1;\
   240  	 (pSYTM)->tm_zone = 0;
   241  
   242  /* Dynamic memory allocation methods. */
   243  struct SyMemMethods 
   244  {
   245  	void * (*xAlloc)(unsigned int);          /* [Required:] Allocate a memory chunk */
   246  	void * (*xRealloc)(void *, unsigned int); /* [Required:] Re-allocate a memory chunk */
   247  	void   (*xFree)(void *);                 /* [Required:] Release a memory chunk */
   248  	unsigned int  (*xChunkSize)(void *);     /* [Optional:] Return chunk size */
   249  	int    (*xInit)(void *);                 /* [Optional:] Initialization callback */
   250  	void   (*xRelease)(void *);              /* [Optional:] Release callback */
   251  	void  *pUserData;                        /* [Optional:] First argument to xInit() and xRelease() */
   252  };
   253  /* Out of memory callback signature. */
   254  typedef int (*ProcMemError)(void *);
   255  /* Mutex methods. */
   256  struct SyMutexMethods 
   257  {
   258  	int (*xGlobalInit)(void);		/* [Optional:] Global mutex initialization */
   259  	void  (*xGlobalRelease)(void);	/* [Optional:] Global Release callback () */
   260  	SyMutex * (*xNew)(int);	        /* [Required:] Request a new mutex */
   261  	void  (*xRelease)(SyMutex *);	/* [Optional:] Release a mutex  */
   262  	void  (*xEnter)(SyMutex *);	    /* [Required:] Enter mutex */
   263  	int (*xTryEnter)(SyMutex *);    /* [Optional:] Try to enter a mutex */
   264  	void  (*xLeave)(SyMutex *);	    /* [Required:] Leave a locked mutex */
   265  };
   266  #if defined (_MSC_VER) || defined (__MINGW32__) ||  defined (__GNUC__) && defined (__declspec)
   267  #define SX_APIIMPORT	__declspec(dllimport)
   268  #define SX_APIEXPORT	__declspec(dllexport)
   269  #else
   270  #define	SX_APIIMPORT
   271  #define	SX_APIEXPORT
   272  #endif
   273  /* Standard return values from Symisc public interfaces */
   274  #define SXRET_OK       0      /* Not an error */	
   275  #define SXERR_MEM      (-1)   /* Out of memory */
   276  #define SXERR_IO       (-2)   /* IO error */
   277  #define SXERR_EMPTY    (-3)   /* Empty field */
   278  #define SXERR_LOCKED   (-4)   /* Locked operation */
   279  #define SXERR_ORANGE   (-5)   /* Out of range value */
   280  #define SXERR_NOTFOUND (-6)   /* Item not found */
   281  #define SXERR_LIMIT    (-7)   /* Limit reached */
   282  #define SXERR_MORE     (-8)   /* Need more input */
   283  #define SXERR_INVALID  (-9)   /* Invalid parameter */
   284  #define SXERR_ABORT    (-10)  /* User callback request an operation abort */
   285  #define SXERR_EXISTS   (-11)  /* Item exists */
   286  #define SXERR_SYNTAX   (-12)  /* Syntax error */
   287  #define SXERR_UNKNOWN  (-13)  /* Unknown error */
   288  #define SXERR_BUSY     (-14)  /* Busy operation */
   289  #define SXERR_OVERFLOW (-15)  /* Stack or buffer overflow */
   290  #define SXERR_WILLBLOCK (-16) /* Operation will block */
   291  #define SXERR_NOTIMPLEMENTED  (-17) /* Operation not implemented */
   292  #define SXERR_EOF      (-18) /* End of input */
   293  #define SXERR_PERM     (-19) /* Permission error */
   294  #define SXERR_NOOP     (-20) /* No-op */	
   295  #define SXERR_FORMAT   (-21) /* Invalid format */
   296  #define SXERR_NEXT     (-22) /* Not an error */
   297  #define SXERR_OS       (-23) /* System call return an error */
   298  #define SXERR_CORRUPT  (-24) /* Corrupted pointer */
   299  #define SXERR_CONTINUE (-25) /* Not an error: Operation in progress */
   300  #define SXERR_NOMATCH  (-26) /* No match */
   301  #define SXERR_RESET    (-27) /* Operation reset */
   302  #define SXERR_DONE     (-28) /* Not an error */
   303  #define SXERR_SHORT    (-29) /* Buffer too short */
   304  #define SXERR_PATH     (-30) /* Path error */
   305  #define SXERR_TIMEOUT  (-31) /* Timeout */
   306  #define SXERR_BIG      (-32) /* Too big for processing */
   307  #define SXERR_RETRY    (-33) /* Retry your call */
   308  #define SXERR_IGNORE   (-63) /* Ignore */
   309  #endif /* SYMISC_PUBLIC_DEFS */
   310  /* 
   311   * Marker for exported interfaces. 
   312   */
   313  #define VEDIS_APIEXPORT SX_APIEXPORT
   314  /* Standard Vedis return values */
   315  #define VEDIS_OK      SXRET_OK      /* Successful result */
   316  /* Beginning of error codes */
   317  #define VEDIS_NOMEM    SXERR_MEM     /* Out of memory */
   318  #define VEDIS_ABORT    SXERR_ABORT   /* Another thread have released this instance */
   319  #define VEDIS_IOERR    SXERR_IO      /* IO error */
   320  #define VEDIS_CORRUPT  SXERR_CORRUPT /* Corrupt pointer */
   321  #define VEDIS_LOCKED   SXERR_LOCKED  /* Forbidden Operation */ 
   322  #define VEDIS_BUSY	 SXERR_BUSY    /* The database file is locked */
   323  #define VEDIS_DONE	 SXERR_DONE    /* Operation done */
   324  #define VEDIS_PERM     SXERR_PERM    /* Permission error */
   325  #define VEDIS_NOTIMPLEMENTED SXERR_NOTIMPLEMENTED /* Method not implemented by the underlying Key/Value storage engine */
   326  #define VEDIS_NOTFOUND SXERR_NOTFOUND /* No such record */
   327  #define VEDIS_NOOP     SXERR_NOOP     /* No such method */
   328  #define VEDIS_INVALID  SXERR_INVALID  /* Invalid parameter */
   329  #define VEDIS_EOF      SXERR_EOF      /* End Of Input */
   330  #define VEDIS_UNKNOWN  SXERR_UNKNOWN  /* Unknown configuration option */
   331  #define VEDIS_LIMIT    SXERR_LIMIT    /* Database limit reached */
   332  #define VEDIS_EXISTS   SXERR_EXISTS   /* Record exists */
   333  #define VEDIS_EMPTY    SXERR_EMPTY    /* Empty record */
   334  #define VEDIS_FULL        (-73)       /* Full database (unlikely) */
   335  #define VEDIS_CANTOPEN    (-74)       /* Unable to open the database file */
   336  #define VEDIS_READ_ONLY   (-75)       /* Read only Key/Value storage engine */
   337  #define VEDIS_LOCKERR     (-76)       /* Locking protocol error */
   338  /* end-of-error-codes */
   339  /*
   340   * If compiling for a processor that lacks floating point
   341   * support, substitute integer for floating-point.
   342   */
   343  #ifdef VEDIS_OMIT_FLOATING_POINT
   344  typedef sxi64 vedis_real;
   345  #else
   346  typedef double vedis_real;
   347  #endif
   348  typedef sxi64 vedis_int64;
   349  /*
   350   * Vedis Configuration Commands.
   351   *
   352   * The following set of constants are the available configuration verbs that can
   353   * be used by the host-application to configure a Vedis datastore handle.
   354   * These constants must be passed as the second argument to [vedis_config()].
   355   *
   356   * Each options require a variable number of arguments.
   357   * The [vedis_config()] interface will return VEDIS_OK on success, any other
   358   * return value indicates failure.
   359   * For a full discussion on the configuration verbs and their expected 
   360   * parameters, please refer to this page:
   361   *      http://vedis.symisc.net/c_api/vedis_config.html
   362   */
   363  #define VEDIS_CONFIG_ERR_LOG             1  /* TWO ARGUMENTS: const char **pzBuf, int *pLen */
   364  #define VEDIS_CONFIG_MAX_PAGE_CACHE      2  /* ONE ARGUMENT: int nMaxPage */
   365  #define VEDIS_CONFIG_KV_ENGINE           4  /* ONE ARGUMENT: const char *zKvName */
   366  #define VEDIS_CONFIG_DISABLE_AUTO_COMMIT 5  /* NO ARGUMENTS */
   367  #define VEDIS_CONFIG_GET_KV_NAME         6  /* ONE ARGUMENT: const char **pzPtr */
   368  #define VEDIS_CONFIG_DUP_EXEC_VALUE      7  /* ONE ARGUMENT: vedis_value **ppOut */
   369  #define VEDIS_CONFIG_RELEASE_DUP_VALUE   8  /* ONE ARGUMENT: vedis_value *pIn */
   370  #define VEDIS_CONFIG_OUTPUT_CONSUMER     9  /* TWO ARGUMENTS: int (*xConsumer)(vedis_value *pOut,void *pUserdata), void *pUserdata */
   371  /*
   372   * Storage engine configuration commands.
   373   *
   374   * The following set of constants are the available configuration verbs that can
   375   * be used by the host-application to configure the underlying storage engine (i.e Hash, B+tree, R+tree).
   376   * These constants must be passed as the first argument to [vedis_kv_config()].
   377   * Each options require a variable number of arguments.
   378   * The [vedis_kv_config()] interface will return VEDIS_OK on success, any other return
   379   * value indicates failure.
   380   * For a full discussion on the configuration verbs and their expected parameters, please
   381   * refer to this page:
   382   *      http://vedis.symisc.net/c_api/vedis_kv_config.html
   383   */
   384  #define VEDIS_KV_CONFIG_HASH_FUNC  1 /* ONE ARGUMENT: unsigned int (*xHash)(const void *,unsigned int) */
   385  #define VEDIS_KV_CONFIG_CMP_FUNC   2 /* ONE ARGUMENT: int (*xCmp)(const void *,const void *,unsigned int) */
   386  /*
   387   * Global Library Configuration Commands.
   388   *
   389   * The following set of constants are the available configuration verbs that can
   390   * be used by the host-application to configure the whole library.
   391   * These constants must be passed as the first argument to [vedis_lib_config()].
   392   *
   393   * Each options require a variable number of arguments.
   394   * The [vedis_lib_config()] interface will return VEDIS_OK on success, any other return
   395   * value indicates failure.
   396   * Notes:
   397   * The default configuration is recommended for most applications and so the call to
   398   * [vedis_lib_config()] is usually not necessary. It is provided to support rare 
   399   * applications with unusual needs. 
   400   * The [vedis_lib_config()] interface is not threadsafe. The application must insure that
   401   * no other [vedis_*()] interfaces are invoked by other threads while [vedis_lib_config()]
   402   * is running. Furthermore, [vedis_lib_config()] may only be invoked prior to library
   403   * initialization using [vedis_lib_init()] or [vedis_init()] or after shutdown
   404   * by [vedis_lib_shutdown()]. If [vedis_lib_config()] is called after [vedis_lib_init()]
   405   * or [vedis_init()] and before [vedis_lib_shutdown()] then it will return VEDIS_LOCKED.
   406   * For a full discussion on the configuration verbs and their expected parameters, please
   407   * refer to this page:
   408   *      http://vedis.symisc.net/c_api/vedis_lib.html
   409   */
   410  #define VEDIS_LIB_CONFIG_USER_MALLOC            1 /* ONE ARGUMENT: const SyMemMethods *pMemMethods */ 
   411  #define VEDIS_LIB_CONFIG_MEM_ERR_CALLBACK       2 /* TWO ARGUMENTS: int (*xMemError)(void *), void *pUserData */
   412  #define VEDIS_LIB_CONFIG_USER_MUTEX             3 /* ONE ARGUMENT: const SyMutexMethods *pMutexMethods */ 
   413  #define VEDIS_LIB_CONFIG_THREAD_LEVEL_SINGLE    4 /* NO ARGUMENTS */ 
   414  #define VEDIS_LIB_CONFIG_THREAD_LEVEL_MULTI     5 /* NO ARGUMENTS */ 
   415  #define VEDIS_LIB_CONFIG_VFS                    6 /* ONE ARGUMENT: const vedis_vfs *pVfs */
   416  #define VEDIS_LIB_CONFIG_STORAGE_ENGINE         7 /* ONE ARGUMENT: vedis_kv_methods *pStorage */
   417  #define VEDIS_LIB_CONFIG_PAGE_SIZE              8 /* ONE ARGUMENT: int iPageSize */
   418  /*
   419   * Synchronization Type Flags
   420   *
   421   * When Vedis invokes the xSync() method of an [vedis_io_methods] object it uses
   422   * a combination of these integer values as the second argument.
   423   *
   424   * When the VEDIS_SYNC_DATAONLY flag is used, it means that the sync operation only
   425   * needs to flush data to mass storage.  Inode information need not be flushed.
   426   * If the lower four bits of the flag equal VEDIS_SYNC_NORMAL, that means to use normal
   427   * fsync() semantics. If the lower four bits equal VEDIS_SYNC_FULL, that means to use
   428   * Mac OS X style fullsync instead of fsync().
   429   */
   430  #define VEDIS_SYNC_NORMAL        0x00002
   431  #define VEDIS_SYNC_FULL          0x00003
   432  #define VEDIS_SYNC_DATAONLY      0x00010
   433  /*
   434   * File Locking Levels
   435   *
   436   * Vedis uses one of these integer values as the second
   437   * argument to calls it makes to the xLock() and xUnlock() methods
   438   * of an [vedis_io_methods] object.
   439   */
   440  #define VEDIS_LOCK_NONE          0
   441  #define VEDIS_LOCK_SHARED        1
   442  #define VEDIS_LOCK_RESERVED      2
   443  #define VEDIS_LOCK_PENDING       3
   444  #define VEDIS_LOCK_EXCLUSIVE     4
   445  /*
   446   * CAPIREF: OS Interface: Open File Handle
   447   *
   448   * An [vedis_file] object represents an open file in the [vedis_vfs] OS interface
   449   * layer.
   450   * Individual OS interface implementations will want to subclass this object by appending
   451   * additional fields for their own use. The pMethods entry is a pointer to an
   452   * [vedis_io_methods] object that defines methods for performing
   453   * I/O operations on the open file.
   454  */
   455  typedef struct vedis_file vedis_file;
   456  struct vedis_file {
   457    const vedis_io_methods *pMethods;  /* Methods for an open file. MUST BE FIRST */
   458  };
   459  /*
   460   * CAPIREF: OS Interface: File Methods Object
   461   *
   462   * Every file opened by the [vedis_vfs] xOpen method populates an
   463   * [vedis_file] object (or, more commonly, a subclass of the
   464   * [vedis_file] object) with a pointer to an instance of this object.
   465   * This object defines the methods used to perform various operations
   466   * against the open file represented by the [vedis_file] object.
   467   *
   468   * If the xOpen method sets the vedis_file.pMethods element 
   469   * to a non-NULL pointer, then the vedis_io_methods.xClose method
   470   * may be invoked even if the xOpen reported that it failed.  The
   471   * only way to prevent a call to xClose following a failed xOpen
   472   * is for the xOpen to set the vedis_file.pMethods element to NULL.
   473   *
   474   * The flags argument to xSync may be one of [VEDIS_SYNC_NORMAL] or
   475   * [VEDIS_SYNC_FULL]. The first choice is the normal fsync().
   476   * The second choice is a Mac OS X style fullsync. The [VEDIS_SYNC_DATAONLY]
   477   * flag may be ORed in to indicate that only the data of the file
   478   * and not its inode needs to be synced.
   479   *
   480   * The integer values to xLock() and xUnlock() are one of
   481   *
   482   * VEDIS_LOCK_NONE
   483   * VEDIS_LOCK_SHARED
   484   * VEDIS_LOCK_RESERVED
   485   * VEDIS_LOCK_PENDING
   486   * VEDIS_LOCK_EXCLUSIVE
   487   * 
   488   * xLock() increases the lock. xUnlock() decreases the lock.
   489   * The xCheckReservedLock() method checks whether any database connection,
   490   * either in this process or in some other process, is holding a RESERVED,
   491   * PENDING, or EXCLUSIVE lock on the file. It returns true if such a lock exists
   492   * and false otherwise.
   493   * 
   494   * The xSectorSize() method returns the sector size of the device that underlies
   495   * the file. The sector size is the minimum write that can be performed without
   496   * disturbing other bytes in the file.
   497   */
   498  struct vedis_io_methods {
   499    int iVersion;                 /* Structure version number (currently 1) */
   500    int (*xClose)(vedis_file*);
   501    int (*xRead)(vedis_file*, void*, vedis_int64 iAmt, vedis_int64 iOfst);
   502    int (*xWrite)(vedis_file*, const void*, vedis_int64 iAmt, vedis_int64 iOfst);
   503    int (*xTruncate)(vedis_file*, vedis_int64 size);
   504    int (*xSync)(vedis_file*, int flags);
   505    int (*xFileSize)(vedis_file*, vedis_int64 *pSize);
   506    int (*xLock)(vedis_file*, int);
   507    int (*xUnlock)(vedis_file*, int);
   508    int (*xCheckReservedLock)(vedis_file*, int *pResOut);
   509    int (*xSectorSize)(vedis_file*);
   510  };
   511  /*
   512   * CAPIREF: OS Interface Object
   513   *
   514   * An instance of the vedis_vfs object defines the interface between
   515   * the Vedis core and the underlying operating system.  The "vfs"
   516   * in the name of the object stands for "Virtual File System".
   517   *
   518   * Only a single vfs can be registered within the Vedis core.
   519   * Vfs registration is done using the [vedis_lib_config()] interface
   520   * with a configuration verb set to VEDIS_LIB_CONFIG_VFS.
   521   * Note that Windows and UNIX (Linux, FreeBSD, Solaris, Mac OS X, etc.) users
   522   * does not have to worry about registering and installing a vfs since Vedis
   523   * come with a built-in vfs for these platforms that implements most the methods
   524   * defined below.
   525   *
   526   * Clients running on exotic systems (ie: Other than Windows and UNIX systems)
   527   * must register their own vfs in order to be able to use the Vedis library.
   528   *
   529   * The value of the iVersion field is initially 1 but may be larger in
   530   * future versions of Vedis. 
   531   *
   532   * The szOsFile field is the size of the subclassed [vedis_file] structure
   533   * used by this VFS. mxPathname is the maximum length of a pathname in this VFS.
   534   * 
   535   * At least szOsFile bytes of memory are allocated by Vedis to hold the [vedis_file]
   536   * structure passed as the third argument to xOpen. The xOpen method does not have to
   537   * allocate the structure; it should just fill it in. Note that the xOpen method must
   538   * set the vedis_file.pMethods to either a valid [vedis_io_methods] object or to NULL.
   539   * xOpen must do this even if the open fails. Vedis expects that the vedis_file.pMethods
   540   * element will be valid after xOpen returns regardless of the success or failure of the
   541   * xOpen call.
   542   */
   543  struct vedis_vfs {
   544    const char *zName;       /* Name of this virtual file system [i.e: Windows, UNIX, etc.] */
   545    int iVersion;            /* Structure version number (currently 1) */
   546    int szOsFile;            /* Size of subclassed vedis_file */
   547    int mxPathname;          /* Maximum file pathname length */
   548    int (*xOpen)(vedis_vfs*, const char *zName, vedis_file*,unsigned int flags);
   549    int (*xDelete)(vedis_vfs*, const char *zName, int syncDir);
   550    int (*xAccess)(vedis_vfs*, const char *zName, int flags, int *pResOut);
   551    int (*xFullPathname)(vedis_vfs*, const char *zName,int buf_len,char *zBuf);
   552    int (*xTmpDir)(vedis_vfs*,char *zBuf,int buf_len);
   553    int (*xSleep)(vedis_vfs*, int microseconds);
   554    int (*xCurrentTime)(vedis_vfs*,Sytm *pOut);
   555    int (*xGetLastError)(vedis_vfs*, int, char *);
   556    int (*xMmap)(const char *, void **, vedis_int64 *);  
   557    void (*xUnmap)(void *,vedis_int64);
   558  };
   559  /*
   560   * Flags for the xAccess VFS method
   561   *
   562   * These integer constants can be used as the third parameter to
   563   * the xAccess method of an [vedis_vfs] object.  They determine
   564   * what kind of permissions the xAccess method is looking for.
   565   * With VEDIS_ACCESS_EXISTS, the xAccess method
   566   * simply checks whether the file exists.
   567   * With VEDIS_ACCESS_READWRITE, the xAccess method
   568   * checks whether the named directory is both readable and writable
   569   * (in other words, if files can be added, removed, and renamed within
   570   * the directory).
   571   * The VEDIS_ACCESS_READWRITE constant is currently used only by the
   572   * [temp_store_directory pragma], though this could change in a future
   573   * release of Vedis.
   574   * With VEDIS_ACCESS_READ, the xAccess method
   575   * checks whether the file is readable.  The VEDIS_ACCESS_READ constant is
   576   * currently unused, though it might be used in a future release of
   577   * Vedis.
   578   */
   579  #define VEDIS_ACCESS_EXISTS    0
   580  #define VEDIS_ACCESS_READWRITE 1   
   581  #define VEDIS_ACCESS_READ      2 
   582  /*
   583   * The type used to represent a page number.  The first page in a file
   584   * is called page 1.  0 is used to represent "not a page".
   585   * A page number is an unsigned 64-bit integer.
   586   */
   587  typedef sxu64 pgno;
   588  /*
   589   * A database disk page is represented by an instance
   590   * of the follwoing structure.
   591   */
   592  typedef struct vedis_page vedis_page;
   593  struct vedis_page
   594  {
   595    unsigned char *zData;       /* Content of this page */
   596    void *pUserData;            /* Extra content */
   597    pgno pgno;                  /* Page number for this page */
   598  };
   599  /*
   600   * Vedis handle to the underlying Key/Value Storage Engine (See below).
   601   */
   602  typedef void * vedis_kv_handle;
   603  /*
   604   * Vedis pager IO methods.
   605   *
   606   * An instance of the following structure define the exported methods of the Vedis pager
   607   * to the underlying Key/Value storage engine.
   608   */
   609  typedef struct vedis_kv_io vedis_kv_io;
   610  struct vedis_kv_io
   611  {
   612  	vedis_kv_handle  pHandle;     /* Vedis handle passed as the first parameter to the
   613  									 * method defined below.
   614  									 */
   615  	vedis_kv_methods *pMethods;   /* Underlying storage engine */
   616  	/* Pager methods */
   617  	int (*xGet)(vedis_kv_handle,pgno,vedis_page **);
   618  	int (*xLookup)(vedis_kv_handle,pgno,vedis_page **);
   619  	int (*xNew)(vedis_kv_handle,vedis_page **);
   620  	int (*xWrite)(vedis_page *);
   621  	int (*xDontWrite)(vedis_page *);
   622  	int (*xDontJournal)(vedis_page *);
   623  	int (*xDontMkHot)(vedis_page *);
   624  	int (*xPageRef)(vedis_page *);
   625  	int (*xPageUnref)(vedis_page *);
   626  	int (*xPageSize)(vedis_kv_handle);
   627  	int (*xReadOnly)(vedis_kv_handle);
   628  	unsigned char * (*xTmpPage)(vedis_kv_handle);
   629  	void (*xSetUnpin)(vedis_kv_handle,void (*xPageUnpin)(void *)); 
   630  	void (*xSetReload)(vedis_kv_handle,void (*xPageReload)(void *));
   631  	void (*xErr)(vedis_kv_handle,const char *);
   632  };
   633  /*
   634   * Key/Value Cursor Object.
   635   *
   636   * An instance of a subclass of the following object defines a cursor
   637   * used to scan through a key-value storage engine.
   638   */
   639  typedef struct vedis_kv_cursor vedis_kv_cursor;
   640  struct vedis_kv_cursor
   641  {
   642    vedis_kv_engine *pStore; /* Must be first */
   643    /* Subclasses will typically add additional fields */
   644  };
   645  /*
   646   * Possible seek positions.
   647   */
   648  #define VEDIS_CURSOR_MATCH_EXACT  1
   649  #define VEDIS_CURSOR_MATCH_LE     2
   650  #define VEDIS_CURSOR_MATCH_GE     3
   651  /*
   652   * Key/Value Storage Engine.
   653   *
   654   * A Key-Value storage engine is defined by an instance of the following
   655   * object.
   656   * Vedis works with run-time interchangeable storage engines (i.e. Hash, B+Tree, R+Tree, LSM, etc.).
   657   * The storage engine works with key/value pairs where both the key
   658   * and the value are byte arrays of arbitrary length and with no restrictions on content.
   659   * Vedis come with two built-in KV storage engine: A Virtual Linear Hash (VLH) storage
   660   * engine is used for persistent on-disk databases with O(1) lookup time and an in-memory
   661   * hash-table or Red-black tree storage engine is used for in-memory databases.
   662   * Future versions of Vedis might add other built-in storage engines (i.e. LSM). 
   663   * Registration of a Key/Value storage engine at run-time is done via [vedis_lib_config()]
   664   * with a configuration verb set to VEDIS_LIB_CONFIG_STORAGE_ENGINE.
   665   */
   666  struct vedis_kv_engine
   667  {
   668    const vedis_kv_io *pIo; /* IO methods: MUST be first */
   669     /* Subclasses will typically add additional fields */
   670  };
   671  /*
   672   * Key/Value Storage Engine Virtual Method Table.
   673   *
   674   * Key/Value storage engine methods is defined by an instance of the following
   675   * object.
   676   * Registration of a Key/Value storage engine at run-time is done via [vedis_lib_config()]
   677   * with a configuration verb set to VEDIS_LIB_CONFIG_STORAGE_ENGINE.
   678   */
   679  struct vedis_kv_methods
   680  {
   681    const char *zName; /* Storage engine name [i.e. Hash, B+tree, LSM, R-tree, Mem, etc.]*/
   682    int szKv;          /* 'vedis_kv_engine' subclass size */
   683    int szCursor;      /* 'vedis_kv_cursor' subclass size */
   684    int iVersion;      /* Structure version, currently 1 */
   685    /* Storage engine methods */
   686    int (*xInit)(vedis_kv_engine *,int iPageSize);
   687    void (*xRelease)(vedis_kv_engine *);
   688    int (*xConfig)(vedis_kv_engine *,int op,va_list ap);
   689    int (*xOpen)(vedis_kv_engine *,pgno);
   690    int (*xReplace)(
   691  	  vedis_kv_engine *,
   692  	  const void *pKey,int nKeyLen,
   693  	  const void *pData,vedis_int64 nDataLen
   694  	  ); 
   695      int (*xAppend)(
   696  	  vedis_kv_engine *,
   697  	  const void *pKey,int nKeyLen,
   698  	  const void *pData,vedis_int64 nDataLen
   699  	  );
   700    void (*xCursorInit)(vedis_kv_cursor *);
   701    int (*xSeek)(vedis_kv_cursor *,const void *pKey,int nByte,int iPos); /* Mandatory */
   702    int (*xFirst)(vedis_kv_cursor *);
   703    int (*xLast)(vedis_kv_cursor *);
   704    int (*xValid)(vedis_kv_cursor *);
   705    int (*xNext)(vedis_kv_cursor *);
   706    int (*xPrev)(vedis_kv_cursor *);
   707    int (*xDelete)(vedis_kv_cursor *);
   708    int (*xKeyLength)(vedis_kv_cursor *,int *);
   709    int (*xKey)(vedis_kv_cursor *,int (*xConsumer)(const void *,unsigned int,void *),void *pUserData);
   710    int (*xDataLength)(vedis_kv_cursor *,vedis_int64 *);
   711    int (*xData)(vedis_kv_cursor *,int (*xConsumer)(const void *,unsigned int,void *),void *pUserData);
   712    void (*xReset)(vedis_kv_cursor *);
   713    void (*xCursorRelease)(vedis_kv_cursor *);
   714  };
   715  /*
   716   * Vedis journal file suffix.
   717   */
   718  #ifndef VEDIS_JOURNAL_FILE_SUFFIX
   719  #define VEDIS_JOURNAL_FILE_SUFFIX "_vedis_journal"
   720  #endif
   721  /*
   722   * Call Context - Error Message Serverity Level.
   723   *
   724   * The following constans are the allowed severity level that can
   725   * passed as the second argument to the [vedis_context_throw_error()] or
   726   * [vedis_context_throw_error_format()] interfaces.
   727   * Refer to the official documentation for additional information.
   728   */
   729  #define VEDIS_CTX_ERR       1 /* Call context error such as unexpected number of arguments, invalid types and so on. */
   730  #define VEDIS_CTX_WARNING   2 /* Call context Warning */
   731  #define VEDIS_CTX_NOTICE    3 /* Call context Notice */
   732  /* 
   733   * C-API-REF: Please refer to the official documentation for interfaces
   734   * purpose and expected parameters. 
   735   */
   736  /* Vedis Datastore Handle */
   737  VEDIS_APIEXPORT int vedis_open(vedis **ppStore,const char *zStorage);
   738  VEDIS_APIEXPORT int vedis_config(vedis *pStore,int iOp,...);
   739  VEDIS_APIEXPORT int vedis_close(vedis *pStore);
   740  
   741  /* Command Execution Interfaces */
   742  VEDIS_APIEXPORT int vedis_exec(vedis *pStore,const char *zCmd,int nLen);
   743  VEDIS_APIEXPORT int vedis_exec_fmt(vedis *pStore,const char *zFmt,...);
   744  VEDIS_APIEXPORT int vedis_exec_result(vedis *pStore,vedis_value **ppOut);
   745  
   746  /* Foreign Command Registar */
   747  VEDIS_APIEXPORT int vedis_register_command(vedis *pStore,const char *zName,int (*xCmd)(vedis_context *,int,vedis_value **),void *pUserdata);
   748  VEDIS_APIEXPORT int vedis_delete_command(vedis *pStore,const char *zName);
   749  
   750  /* Raw Data Store/Fetch (http://vedis.org) */
   751  VEDIS_APIEXPORT int vedis_kv_store(vedis *pStore,const void *pKey,int nKeyLen,const void *pData,vedis_int64 nDataLen);
   752  VEDIS_APIEXPORT int vedis_kv_append(vedis *pStore,const void *pKey,int nKeyLen,const void *pData,vedis_int64 nDataLen);
   753  VEDIS_APIEXPORT int vedis_kv_store_fmt(vedis *pStore,const void *pKey,int nKeyLen,const char *zFormat,...);
   754  VEDIS_APIEXPORT int vedis_kv_append_fmt(vedis *pStore,const void *pKey,int nKeyLen,const char *zFormat,...);
   755  VEDIS_APIEXPORT int vedis_kv_fetch(vedis *pStore,const void *pKey,int nKeyLen,void *pBuf,vedis_int64 /* in|out */*pBufLen);
   756  VEDIS_APIEXPORT int vedis_kv_fetch_callback(vedis *pStore,const void *pKey,
   757  	                    int nKeyLen,int (*xConsumer)(const void *,unsigned int,void *),void *pUserData);
   758  VEDIS_APIEXPORT int vedis_kv_config(vedis *pStore,int iOp,...);
   759  VEDIS_APIEXPORT int vedis_kv_delete(vedis *pStore,const void *pKey,int nKeyLen);
   760  
   761  /* Manual Transaction Manager */
   762  VEDIS_APIEXPORT int vedis_begin(vedis *pStore);
   763  VEDIS_APIEXPORT int vedis_commit(vedis *pStore);
   764  VEDIS_APIEXPORT int vedis_rollback(vedis *pStore);
   765  
   766  /* Utility interfaces */
   767  VEDIS_APIEXPORT int vedis_util_random_string(vedis *pStore,char *zBuf,unsigned int buf_size);
   768  VEDIS_APIEXPORT unsigned int vedis_util_random_num(vedis *pStore);
   769  
   770  /* Call Context Key/Value Store Interfaces */
   771  VEDIS_APIEXPORT int vedis_context_kv_store(vedis_context *pCtx,const void *pKey,int nKeyLen,const void *pData,vedis_int64 nDataLen);
   772  VEDIS_APIEXPORT int vedis_context_kv_append(vedis_context *pCtx,const void *pKey,int nKeyLen,const void *pData,vedis_int64 nDataLen);
   773  VEDIS_APIEXPORT int vedis_context_kv_store_fmt(vedis_context *pCtx,const void *pKey,int nKeyLen,const char *zFormat,...);
   774  VEDIS_APIEXPORT int vedis_context_kv_append_fmt(vedis_context *pCtx,const void *pKey,int nKeyLen,const char *zFormat,...);
   775  VEDIS_APIEXPORT int vedis_context_kv_fetch(vedis_context *pCtx,const void *pKey,int nKeyLen,void *pBuf,vedis_int64 /* in|out */*pBufLen);
   776  VEDIS_APIEXPORT int vedis_context_kv_fetch_callback(vedis_context *pCtx,const void *pKey,
   777  	                    int nKeyLen,int (*xConsumer)(const void *,unsigned int,void *),void *pUserData);
   778  VEDIS_APIEXPORT int vedis_context_kv_delete(vedis_context *pCtx,const void *pKey,int nKeyLen);
   779  
   780  /* Command Execution Context Interfaces */
   781  VEDIS_APIEXPORT int vedis_context_throw_error(vedis_context *pCtx, int iErr, const char *zErr);
   782  VEDIS_APIEXPORT int vedis_context_throw_error_format(vedis_context *pCtx, int iErr, const char *zFormat, ...);
   783  VEDIS_APIEXPORT unsigned int vedis_context_random_num(vedis_context *pCtx);
   784  VEDIS_APIEXPORT int vedis_context_random_string(vedis_context *pCtx, char *zBuf, int nBuflen);
   785  VEDIS_APIEXPORT void * vedis_context_user_data(vedis_context *pCtx);
   786  VEDIS_APIEXPORT int    vedis_context_push_aux_data(vedis_context *pCtx, void *pUserData);
   787  VEDIS_APIEXPORT void * vedis_context_peek_aux_data(vedis_context *pCtx);
   788  VEDIS_APIEXPORT void * vedis_context_pop_aux_data(vedis_context *pCtx);
   789  
   790  /* Setting The Return Value Of A Vedis Command */
   791  VEDIS_APIEXPORT int vedis_result_int(vedis_context *pCtx, int iValue);
   792  VEDIS_APIEXPORT int vedis_result_int64(vedis_context *pCtx, vedis_int64 iValue);
   793  VEDIS_APIEXPORT int vedis_result_bool(vedis_context *pCtx, int iBool);
   794  VEDIS_APIEXPORT int vedis_result_double(vedis_context *pCtx, double Value);
   795  VEDIS_APIEXPORT int vedis_result_null(vedis_context *pCtx);
   796  VEDIS_APIEXPORT int vedis_result_string(vedis_context *pCtx, const char *zString, int nLen);
   797  VEDIS_APIEXPORT int vedis_result_string_format(vedis_context *pCtx, const char *zFormat, ...);
   798  VEDIS_APIEXPORT int vedis_result_value(vedis_context *pCtx, vedis_value *pValue);
   799  
   800  /* Extracting Vedis Commands Parameter/Return Values */
   801  VEDIS_APIEXPORT int vedis_value_to_int(vedis_value *pValue);
   802  VEDIS_APIEXPORT int vedis_value_to_bool(vedis_value *pValue);
   803  VEDIS_APIEXPORT vedis_int64 vedis_value_to_int64(vedis_value *pValue);
   804  VEDIS_APIEXPORT double vedis_value_to_double(vedis_value *pValue);
   805  VEDIS_APIEXPORT const char * vedis_value_to_string(vedis_value *pValue, int *pLen);
   806  
   807  /* Dynamically Typed Value Object Query Interfaces */
   808  VEDIS_APIEXPORT int vedis_value_is_int(vedis_value *pVal);
   809  VEDIS_APIEXPORT int vedis_value_is_float(vedis_value *pVal);
   810  VEDIS_APIEXPORT int vedis_value_is_bool(vedis_value *pVal);
   811  VEDIS_APIEXPORT int vedis_value_is_string(vedis_value *pVal);
   812  VEDIS_APIEXPORT int vedis_value_is_null(vedis_value *pVal);
   813  VEDIS_APIEXPORT int vedis_value_is_numeric(vedis_value *pVal);
   814  VEDIS_APIEXPORT int vedis_value_is_scalar(vedis_value *pVal);
   815  VEDIS_APIEXPORT int vedis_value_is_array(vedis_value *pVal);
   816  
   817  /* Populating dynamically Typed Objects  */
   818  VEDIS_APIEXPORT int vedis_value_int(vedis_value *pVal, int iValue);
   819  VEDIS_APIEXPORT int vedis_value_int64(vedis_value *pVal, vedis_int64 iValue);
   820  VEDIS_APIEXPORT int vedis_value_bool(vedis_value *pVal, int iBool);
   821  VEDIS_APIEXPORT int vedis_value_null(vedis_value *pVal);
   822  VEDIS_APIEXPORT int vedis_value_double(vedis_value *pVal, double Value);
   823  VEDIS_APIEXPORT int vedis_value_string(vedis_value *pVal, const char *zString, int nLen);
   824  VEDIS_APIEXPORT int vedis_value_string_format(vedis_value *pVal, const char *zFormat, ...);
   825  VEDIS_APIEXPORT int vedis_value_reset_string_cursor(vedis_value *pVal);
   826  VEDIS_APIEXPORT int vedis_value_release(vedis_value *pVal);
   827  
   828  /* On-demand Object Value Allocation */
   829  VEDIS_APIEXPORT vedis_value * vedis_context_new_scalar(vedis_context *pCtx);
   830  VEDIS_APIEXPORT vedis_value * vedis_context_new_array(vedis_context *pCtx);
   831  VEDIS_APIEXPORT void vedis_context_release_value(vedis_context *pCtx, vedis_value *pValue);
   832  
   833  /* Working with Vedis Arrays */
   834  VEDIS_APIEXPORT vedis_value * vedis_array_fetch(vedis_value *pArray,unsigned int index);
   835  VEDIS_APIEXPORT int vedis_array_walk(vedis_value *pArray, int (*xWalk)(vedis_value *, void *), void *pUserData);
   836  VEDIS_APIEXPORT int vedis_array_insert(vedis_value *pArray,vedis_value *pValue);
   837  VEDIS_APIEXPORT unsigned int vedis_array_count(vedis_value *pArray);
   838  VEDIS_APIEXPORT int vedis_array_reset(vedis_value *pArray);
   839  VEDIS_APIEXPORT vedis_value * vedis_array_next_elem(vedis_value *pArray);
   840  
   841  /* Global Library Management Interfaces */
   842  VEDIS_APIEXPORT int vedis_lib_init(void);
   843  VEDIS_APIEXPORT int vedis_lib_config(int nConfigOp, ...);
   844  VEDIS_APIEXPORT int vedis_lib_shutdown(void);
   845  VEDIS_APIEXPORT int vedis_lib_is_threadsafe(void);
   846  VEDIS_APIEXPORT const char * vedis_lib_version(void);
   847  VEDIS_APIEXPORT const char * vedis_lib_signature(void);
   848  VEDIS_APIEXPORT const char * vedis_lib_ident(void);
   849  VEDIS_APIEXPORT const char * vedis_lib_copyright(void);
   850  
   851  #ifdef __cplusplus
   852  }
   853  #endif /* __cplusplus */
   854  #endif /* _VEDIS_H_ */