kclangc.h   kclangc.h 
skipping to change at line 46 skipping to change at line 46
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <stdint.h> #include <stdint.h>
/** /**
* C wrapper of polymorphic database. * C wrapper of polymorphic database.
*/ */
typedef union { typedef struct {
void* db; /**< dummy member */ void* db; /**< dummy member */
} KCDB; } KCDB;
/** /**
* C wrapper of polymorphic cursor. * C wrapper of polymorphic cursor.
*/ */
typedef union { typedef struct {
void* cur; /**< dummy member */ void* cur; /**< dummy member */
} KCCUR; } KCCUR;
/** /**
* Binary string of byte array. * Binary string of byte array.
*/ */
typedef struct { typedef struct {
char* buf; /**< pointer to the data region */ char* buf; /**< pointer to the data region */
size_t size; /**< size of the data region */ size_t size; /**< size of the data region */
} KCSTR; } KCSTR;
skipping to change at line 544 skipping to change at line 544
* @param knum specifies the number of the keys. * @param knum specifies the number of the keys.
* @param recs an array to contain the result. Its size must be sufficient . * @param recs an array to contain the result. Its size must be sufficient .
* @param atomic true to perform all operations atomically, or false for no n-atomic operations. * @param atomic true to perform all operations atomically, or false for no n-atomic operations.
* @return the number of retrieved records, or -1 on failure. * @return the number of retrieved records, or -1 on failure.
* @note The regions of the key and the value of each element of the result should be released * @note The regions of the key and the value of each element of the result should be released
* with the kcfree function when it is no longer in use. * with the kcfree function when it is no longer in use.
*/ */
int64_t kcdbgetbulk(KCDB* db, const KCSTR* keys, size_t knum, KCREC* recs, int32_t atomic); int64_t kcdbgetbulk(KCDB* db, const KCSTR* keys, size_t knum, KCREC* recs, int32_t atomic);
/** /**
* Remove all records.
* @param db a database object.
* @return true on success, or false on failure.
*/
int32_t kcdbclear(KCDB* db);
/**
* Synchronize updated contents with the file and the device. * Synchronize updated contents with the file and the device.
* @param db a database object. * @param db a database object.
* @param hard true for physical synchronization with the device, or false for logical * @param hard true for physical synchronization with the device, or false for logical
* synchronization with the file system. * synchronization with the file system.
* @param proc a postprocessor call back function. If it is NULL, no postp rocessing is * @param proc a postprocessor call back function. If it is NULL, no postp rocessing is
* performed. * performed.
* @param opq an opaque pointer to be given to the call back function. * @param opq an opaque pointer to be given to the call back function.
* @return true on success, or false on failure. * @return true on success, or false on failure.
* @note The operation of the postprocessor is performed atomically and oth er threads accessing * @note The operation of the postprocessor is performed atomically and oth er threads accessing
* the same record are blocked. To avoid deadlock, any explicit database o peration must not * the same record are blocked. To avoid deadlock, any explicit database o peration must not
skipping to change at line 613 skipping to change at line 606
/** /**
* End transaction. * End transaction.
* @param db a database object. * @param db a database object.
* @param commit true to commit the transaction, or false to abort the tran saction. * @param commit true to commit the transaction, or false to abort the tran saction.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
int32_t kcdbendtran(KCDB* db, int32_t commit); int32_t kcdbendtran(KCDB* db, int32_t commit);
/** /**
* Remove all records.
* @param db a database object.
* @return true on success, or false on failure.
*/
int32_t kcdbclear(KCDB* db);
/**
* Dump records into a file. * Dump records into a file.
* @param db a database object. * @param db a database object.
* @param dest the path of the destination file. * @param dest the path of the destination file.
* @return true on success, or false on failure. * @return true on success, or false on failure.
*/ */
int32_t kcdbdumpsnap(KCDB* db, const char* dest); int32_t kcdbdumpsnap(KCDB* db, const char* dest);
/** /**
* Load records from a file. * Load records from a file.
* @param db a database object. * @param db a database object.
skipping to change at line 866 skipping to change at line 866
int32_t kccurecode(KCCUR* cur); int32_t kccurecode(KCCUR* cur);
/** /**
* Get the supplement message of the last happened error. * Get the supplement message of the last happened error.
* @param cur a cursor object. * @param cur a cursor object.
* @return the supplement message of the last happened error. * @return the supplement message of the last happened error.
*/ */
const char* kccuremsg(KCCUR* cur); const char* kccuremsg(KCCUR* cur);
/** /**
* C wrapper of index database.
*/
typedef struct {
void* db; /**< dummy member */
} KCIDX;
/**
* Create an index database object.
* @return the created database object.
* @note The object of the return value should be released with the kcidxde
l function when it is
* no longer in use.
*/
KCIDX* kcidxnew(void);
/**
* Destroy a database object.
* @param idx the database object.
*/
void kcidxdel(KCIDX* idx);
/**
* Open a database file.
* @param idx a database object.
* @param path the path of a database file. The same as with the polymorph
ic database.
* @param mode the connection mode. The same as with the polymorphic datab
ase.
* @return true on success, or false on failure.
*/
int32_t kcidxopen(KCIDX* idx, const char* path, uint32_t mode);
/**
* Close the database file.
* @param idx a database object.
* @return true on success, or false on failure.
*/
int32_t kcidxclose(KCIDX* idx);
/**
* Get the code of the last happened error.
* @param idx a database object.
* @return the code of the last happened error.
*/
int32_t kcidxecode(KCIDX* idx);
/**
* Get the supplement message of the last happened error.
* @param idx a database object.
* @return the supplement message of the last happened error.
*/
const char* kcidxemsg(KCIDX* idx);
/**
* Set the value of a record.
* @param idx a database object.
* @param kbuf the pointer to the key region.
* @param ksiz the size of the key region.
* @param vbuf the pointer to the value region.
* @param vsiz the size of the value region.
* @return true on success, or false on failure.
* @note If no record corresponds to the key, a new record is created. If
the corresponding
* record exists, the value is overwritten.
*/
int32_t kcidxset(KCIDX* idx, const char* kbuf, size_t ksiz, const char* vbu
f, size_t vsiz);
/**
* Add a record.
* @param idx a database object.
* @param kbuf the pointer to the key region.
* @param ksiz the size of the key region.
* @param vbuf the pointer to the value region.
* @param vsiz the size of the value region.
* @return true on success, or false on failure.
* @note If no record corresponds to the key, a new record is created. If
the corresponding
* record exists, the record is not modified and false is returned.
*/
int32_t kcidxadd(KCIDX* idx, const char* kbuf, size_t ksiz, const char* vbu
f, size_t vsiz);
/**
* Replace the value of a record.
* @param idx a database object.
* @param kbuf the pointer to the key region.
* @param ksiz the size of the key region.
* @param vbuf the pointer to the value region.
* @param vsiz the size of the value region.
* @return true on success, or false on failure.
* @note If no record corresponds to the key, no new record is created and
false is returned.
* If the corresponding record exists, the value is modified.
*/
int32_t kcidxreplace(KCIDX* idx, const char* kbuf, size_t ksiz, const char*
vbuf, size_t vsiz);
/**
* Append the value of a record.
* @param idx a database object.
* @param kbuf the pointer to the key region.
* @param ksiz the size of the key region.
* @param vbuf the pointer to the value region.
* @param vsiz the size of the value region.
* @return true on success, or false on failure.
* @note If no record corresponds to the key, a new record is created. If
the corresponding
* record exists, the given value is appended at the end of the existing va
lue.
*/
int32_t kcidxappend(KCIDX* idx, const char* kbuf, size_t ksiz, const char*
vbuf, size_t vsiz);
/**
* Remove a record.
* @param idx a database object.
* @param kbuf the pointer to the key region.
* @param ksiz the size of the key region.
* @return true on success, or false on failure.
* @note If no record corresponds to the key, false is returned.
*/
int32_t kcidxremove(KCIDX* idx, const char* kbuf, size_t ksiz);
/**
* Retrieve the value of a record.
* @param idx a database object.
* @param kbuf the pointer to the key region.
* @param ksiz the size of the key region.
* @param sp the pointer to the variable into which the size of the region
of the return
* value is assigned.
* @return the pointer to the value region of the corresponding record, or
NULL on failure.
* @note If no record corresponds to the key, NULL is returned. Because an
additional zero
* code is appended at the end of the region of the return value, the retur
n value can be
* treated as a C-style string. The region of the return value should be r
eleased with the
* kcfree function when it is no longer in use.
*/
char* kcidxget(KCIDX* idx, const char* kbuf, size_t ksiz, size_t* sp);
/**
* Synchronize updated contents with the file and the device.
* @param idx a database object.
* @param hard true for physical synchronization with the device, or false
for logical
* synchronization with the file system.
* @param proc a postprocessor call back function. If it is NULL, no postp
rocessing is
* performed.
* @param opq an opaque pointer to be given to the call back function.
* @return true on success, or false on failure.
* @note The operation of the postprocessor is performed atomically and oth
er threads accessing
* the same record are blocked. To avoid deadlock, any explicit database o
peration must not
* be performed in this function.
*/
int32_t kcidxsync(KCIDX* idx, int32_t hard, KCFILEPROC proc, void* opq);
/**
* Remove all records.
* @param idx a database object.
* @return true on success, or false on failure.
*/
int32_t kcidxclear(KCIDX* idx);
/**
* Get the number of records.
* @param idx a database object.
* @return the number of records, or -1 on failure.
*/
int64_t kcidxcount(KCIDX* idx);
/**
* Get the size of the database file.
* @param idx a database object.
* @return the size of the database file in bytes, or -1 on failure.
*/
int64_t kcidxsize(KCIDX* idx);
/**
* Get the path of the database file.
* @param idx a database object.
* @return the path of the database file, or an empty string on failure.
* @note The region of the return value should be released with the kcfree
function when it is
* no longer in use.
*/
char* kcidxpath(KCIDX* idx);
/**
* Get the miscellaneous status information.
* @param idx a database object.
* @return the result string of tab saparated values, or NULL on failure.
Each line consists of
* the attribute name and its value separated by a tab character.
* @note The region of the return value should be released with the kcfree
function when it is
* no longer in use.
*/
char* kcidxstatus(KCIDX* idx);
/**
* Reveal the inner database object.
* @return the inner database object, or NULL on failure.
*/
KCDB* kcidxrevealinnerdb(KCIDX* idx);
/**
* C wrapper of memory-saving string hash map. * C wrapper of memory-saving string hash map.
*/ */
typedef union { typedef struct {
void* map; /**< dummy member */ void* map; /**< dummy member */
} KCMAP; } KCMAP;
/** /**
* C wrapper of iterator of memory-saving string hash map. * C wrapper of iterator of memory-saving string hash map.
*/ */
typedef union { typedef struct {
void* iter; /**< dummy member */ void* iter; /**< dummy member */
} KCMAPITER; } KCMAPITER;
/** /**
* C wrapper of sorter of memory-saving string hash map. * C wrapper of sorter of memory-saving string hash map.
*/ */
typedef union { typedef struct {
void* iter; /**< dummy member */ void* iter; /**< dummy member */
} KCMAPSORT; } KCMAPSORT;
/** /**
* Create a string hash map object. * Create a string hash map object.
* @param bnum the number of buckets of the hash table. If it is not more than 0, the default * @param bnum the number of buckets of the hash table. If it is not more than 0, the default
* setting 31 is specified. * setting 31 is specified.
* @return the created map object. * @return the created map object.
* @note The object of the return value should be released with the kcmapde l function when it is * @note The object of the return value should be released with the kcmapde l function when it is
* no longer in use. * no longer in use.
skipping to change at line 1097 skipping to change at line 1286
/** /**
* Step the cursor to the next record. * Step the cursor to the next record.
* @param sort the sorter object. * @param sort the sorter object.
*/ */
void kcmapsortstep(KCMAPSORT* sort); void kcmapsortstep(KCMAPSORT* sort);
/** /**
* C wrapper of memory-saving string hash map. * C wrapper of memory-saving string hash map.
*/ */
typedef union { typedef struct {
void* list; /**< dummy member */ void* list; /**< dummy member */
} KCLIST; } KCLIST;
/** /**
* Create a string array list object. * Create a string array list object.
* @return the created list object. * @return the created list object.
* @note The object of the return value should be released with the kclistd el function when it is * @note The object of the return value should be released with the kclistd el function when it is
* no longer in use. * no longer in use.
*/ */
KCLIST* kclistnew(); KCLIST* kclistnew();
 End of changes. 9 change blocks. 
13 lines changed or deleted 226 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/