📄 cabin.3
字号:
.TH CABIN 3 "2003-11-27" "Man Page" "Quick Database Manager".SH NAMECabin \- the utility API of QDBM.SH SYNOPSIS.PP.B #include <cabin.h>.br.B #include <stdlib.h>.PP.B extern void (*cbfatalfunc)(const char *message);.PP.B void *cbmalloc(size_t size);.PP.B void *cbrealloc(void *ptr, size_t size);.PP.B char *cbmemdup(const char *ptr, int size);.PP.B void cbglobalgc(void *ptr, void (*func)(void *));.PP.B void cbisort(void *base, int nmemb, int size, int(*compar)(const void *, const void *));.PP.B void cbssort(void *base, int nmemb, int size, int(*compar)(const void *, const void *));.PP.B void cbhsort(void *base, int nmemb, int size, int(*compar)(const void *, const void *));.PP.B void cbqsort(void *base, int nmemb, int size, int(*compar)(const void *, const void *));.PP.B CBDATUM *cbdatumopen(const char *ptr, int size);.PP.B CBDATUM *cbdatumdup(const CBDATUM *datum);.PP.B void cbdatumclose(CBDATUM *datum);.PP.B void cbdatumcat(CBDATUM *datum, const char *ptr, int size);.PP.B const char *cbdatumptr(const CBDATUM *datum);.PP.B int cbdatumsize(const CBDATUM *datum);.PP.B void cbdatumsetsize(CBDATUM *datum, int size);.PP.B CBLIST *cblistopen(void);.PP.B CBLIST *cblistdup(const CBLIST *list);.PP.B void cblistclose(CBLIST *list);.PP.B int cblistnum(const CBLIST *list);.PP.B const char *cblistval(const CBLIST *list, int index, int *sp);.PP.B void cblistpush(CBLIST *list, const char *ptr, int size);.PP.B char *cblistpop(CBLIST *list, int *sp);.PP.B void cblistunshift(CBLIST *list, const char *ptr, int size);.PP.B char *cblistshift(CBLIST *list, int *sp);.PP.B void cblistinsert(CBLIST *list, int index, const char *ptr, int size);.PP.B char *cblistremove(CBLIST *list, int index, int *sp);.PP.B void cblistsort(CBLIST *list);.PP.B int cblistlsearch(const CBLIST *list, const char *ptr, int size);.PP.B int cblistbsearch(const CBLIST *list, const char *ptr, int size);.PP.B char *cblistdump(const CBLIST *list, int *sp);.PP.B CBLIST *cblistload(const char *ptr, int size);.PP.B CBMAP *cbmapopen(void);.PP.B CBMAP *cbmapdup(CBMAP *map);.PP.B void cbmapclose(CBMAP *map);.PP.B int cbmapput(CBMAP *map, const char *kbuf, int ksiz, const char *vbuf, int vsiz, int over);.PP.B int cbmapout(CBMAP *map, const char *kbuf, int ksiz);.PP.B const char *cbmapget(const CBMAP *map, const char *kbuf, int ksiz, int *sp);.PP.B int cbmapmove(CBMAP *map, const char *kbuf, int ksiz, int head);.PP.B void cbmapiterinit(CBMAP *map);.PP.B const char *cbmapiternext(CBMAP *map, int *sp);.PP.B int cbmaprnum(const CBMAP *map);.PP.B CBLIST *cbmapkeys(CBMAP *map);.PP.B CBLIST *cbmapvals(CBMAP *map);.PP.B char *cbmapdump(const CBMAP *map, int *sp);.PP.B CBMAP *cbmapload(const char *ptr, int size);.PP.B char *cbsprintf(const char *format, ...);.PP.B char *cbreplace(const char *str, CBMAP *pairs);.PP.B CBLIST *cbsplit(const char *ptr, int size, const char *delim);.PP.B char *cbreadfile(const char *name, int *sp);.PP.B CBLIST *cbreadlines(const char *name);.PP.B CBLIST *cbdirlist(const char *name);.PP.B int cbfilestat(const char *name, int *isdirp, int *sizep, int *mtimep);.PP.B char *cburlencode(const char *ptr, int size);.PP.B char *cburldecode(const char *str, int *sp);.PP.B char *cbbaseencode(const char *ptr, int size);.PP.B char *cbbasedecode(const char *str, int *sp);.PP.B char *cbquoteencode(const char *ptr, int size);.PP.B char *cbquotedecode(const char *str, int *sp);.PP.B char *cbdeflate(const char *ptr, int size, int *sp);.PP.B char *cbinflate(const char *ptr, int size, int *sp);.SH DESCRIPTION.PPCabin is the utility API which provides memory allocating functions, sorting functions, extensible datum, array list, hash map, and so on for handling records easily on memory..PPIn order to use Cabin, you should include `cabin.h' and `stdlib.h' in the source files. Usually, the following description will be near the beginning of a source file..PP.RS.B #include <cabin.h>.br.B #include <stdlib.h>.RE.PPA pointer to `CBDATUM' is used as a handle of an extensible datum. A datum handle is opened with the function `cbdatumopen' and closed with `cbdatumclose'. A pointer to `CBLIST' is used as a handle of an array list. A list handle is opened with the function `cblistopen' and closed with `cblistclose'. A pointer to `CBMAP' is used as a handle of a hash map. A map handle is opened with the function `cbmapopen' and closed with `cbmapclose'. You should not refer directly to any member of each handles..PPThe external variable `cbfatalfunc' is the pointer to call back function for handling a fatal error..TP.B extern void (*cbfatalfunc)(const char *message);The argument specifies the error message. The initial value of this variable is `NULL'. If the value is `NULL', the default function is called when a fatal error occurs. A fatal error occures when memory allocation is failed..PPThe function `cbmalloc' is used in order to allocate a region on memory..TP.B void *cbmalloc(size_t size);`size' specifies the size of the region. The return value is the pointer to the allocated region. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -