⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cabin.h

📁 harvest是一个下载html网页得机器人
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Get the number of elements of a list.   `list' specifies a list handle.   The return value is the number of elements of the list. */int cblistnum(const CBLIST *list);/* Get the pointer to the region of an element.   `list' specifies a list handle.   `index' specifies the index of an element.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   The return value is the pointer to the region of the value.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string.  If `index' is equal to or more than   the number of elements, the return value is `NULL'. */const char *cblistval(const CBLIST *list, int index, int *sp);/* Add an element at the end of a list.   `list' specifies a list handle.   `ptr' specifies the pointer to the region of an element.   `size' specifies the size of the region.  If it is negative, the size is assigned with   `strlen(ptr)'. */void cblistpush(CBLIST *list, const char *ptr, int size);/* Remove an element of the end of a list.   `list' specifies a list handle.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   The return value is the pointer to the region of the value.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string.  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.  If the list is empty, the return value is `NULL'. */char *cblistpop(CBLIST *list, int *sp);/* Add an element at the top of a list.   `list' specifies a list handle.   `ptr' specifies the pointer to the region of an element.   `size' specifies the size of the region.  If it is negative, the size is assigned with   `strlen(ptr)'. */void cblistunshift(CBLIST *list, const char *ptr, int size);/* Remove an element of the top of a list.   `list' specifies a list handle.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   The return value is the pointer to the region of the value.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string.  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.  If the list is empty, the return value is `NULL'. */char *cblistshift(CBLIST *list, int *sp);/* Add an element at the specified location of a list.   `list' specifies a list handle.   `index' specifies the index of an element.   `ptr' specifies the pointer to the region of the element.   `size' specifies the size of the region.  If it is negative, the size is assigned with   `strlen(ptr)'. */void cblistinsert(CBLIST *list, int index, const char *ptr, int size);/* Remove an element at the specified location of a list.   `list' specifies a list handle.   `index' specifies the index of an element.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   The return value is the pointer to the region of the value.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string.  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.  If `index' is equal to or more than the number of elements, no element   is removed and the return value is `NULL'. */char *cblistremove(CBLIST *list, int index, int *sp);/* Sort elements of a list in lexical order.   `list' specifies a list handle.   Quick sort is used for sorting. */void cblistsort(CBLIST *list);/* Search a list for an element using liner search.   `list' specifies a list handle.   `ptr' specifies the pointer to the region of a key.   `size' specifies the size of the region.  If it is negative, the size is assigned with   `strlen(ptr)'.   The return value is the index of a corresponding element or -1 if there is no corresponding   element.  If two or more elements corresponds, the former returns. */int cblistlsearch(const CBLIST *list, const char *ptr, int size);/* Search a list for an element using binary search.   `list' specifies a list handle.  It should be sorted in lexical order.   `ptr' specifies the pointer to the region of a key.   `size' specifies the size of the region.  If it is negative, the size is assigned with   `strlen(ptr)'.   The return value is the index of a corresponding element or -1 if there is no corresponding   element.  If two or more elements corresponds, which returnes is not defined. */int cblistbsearch(const CBLIST *list, const char *ptr, int size);/* Serialize a list into a byte array.   `list' specifies a list handle.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.   The return value is the pointer to the region of the result serial 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. */char *cblistdump(const CBLIST *list, int *sp);/* Redintegrate a serialized list.   `ptr' specifies the pointer to a byte array.   `size' specifies the size of the region.   The return value is a new list handle. */CBLIST *cblistload(const char *ptr, int size);/* Get a map handle.   The return value is a map handle. */CBMAP *cbmapopen(void);/* Copy a map.   `map' specifies a map handle.   The return value is a new map handle.   The iterator of the source map is initialized. */CBMAP *cbmapdup(CBMAP *map);/* Close a map handle.   `map' specifies a map handle.   Because the region of a closed handle is released, it becomes impossible to use the handle. */void cbmapclose(CBMAP *map);/* Store a record.   `map' specifies a map handle.   `kbuf' specifies the pointer to the region of a key.   `ksiz' specifies the size of the region of the key.  If it is negative, the size is assigned   with `strlen(kbuf)'.   `vbuf' specifies the pointer to the region of a value.   `vsiz' specifies the size of the region of the value.  If it is negative, the size is   assigned with `strlen(vbuf)'.   `over' specifies whether the value of the duplicated record is overwritten or not.   If `over' is false and the key is duplicated, the return value is false, else, it is true. */int cbmapput(CBMAP *map, const char *kbuf, int ksiz, const char *vbuf, int vsiz, int over);/* Delete a record.   `map' specifies a map handle.   `kbuf' specifies the pointer to the region of a key.   `ksiz' specifies the size of the region of the key.  If it is negative, the size is assigned   with `strlen(kbuf)'.   If successful, the return value is true.  False is returned when no record corresponds to   the specified key. */int cbmapout(CBMAP *map, const char *kbuf, int ksiz);/* Retrieve a record.   `map' specifies a map handle.   `kbuf' specifies the pointer to the region of a key.   `ksiz' specifies the size of the region of the key.  If it is negative, the size is assigned   with `strlen(kbuf)'.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   If successful, the return value is the pointer to the region of the value of the   corresponding record.  `NULL' is returned when no record corresponds.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string. */const char *cbmapget(const CBMAP *map, const char *kbuf, int ksiz, int *sp);/* Move a record to the edge.   `map' specifies a map handle.   `kbuf' specifies the pointer to the region of a key.   `ksiz' specifies the size of the region of the key.  If it is negative, the size is assigned   with `strlen(kbuf)'.   `head' specifies the destination which is head if it is true or tail if else.   If successful, the return value is true.  False is returned when no record corresponds to   the specified key. */int cbmapmove(CBMAP *map, const char *kbuf, int ksiz, int head);/* Initialize the iterator of a map handle.   `map' specifies a map handle.   The iterator is used in order to access the key of every record stored in a map. */void cbmapiterinit(CBMAP *map);/* Get the next key of the iterator.   `map' specifies a map handle.   `sp' specifies the pointer to a variable to which the size of the region of the return   value is assigned.  If it is `NULL', it is not used.   If successful, the return value is the pointer to the region of the next key, else, it is   `NULL'.  `NULL' is returned when no record is to be get out of the iterator.   Because an additional zero code is appended at the end of the region of the return value,   the return value can be treated as a character string.  The order of iteration is assured   to be the same of the one of storing. */const char *cbmapiternext(CBMAP *map, int *sp);/* Get the number of the records stored in a map.   `map' specifies a map handle.   The return value is the number of the records stored in the map. */int cbmaprnum(const CBMAP *map);/* Get the list hanele contains all keys in a map.   `map' specifies a map handle.   The return value is the list handle contains all keys in the map.   Because the handle of the return value is opened with the function `cblistopen', it should   be closed with the function `cblistclose' if it is no longer in use. */CBLIST *cbmapkeys(CBMAP *map);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -