📄 tcutil.3
字号:
`\fIstr\fR' specifies the string of the new element..RE.RE.PPThe function `tclistpop' is used in order to remove an element of the end of a list object..PP.RS.br\fBvoid *tclistpop(TCLIST *\fIlist\fB, int *\fIsp\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSThe return value is the pointer to the region of the removed element..RE.RSBecause 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 when it is no longer in use. If the list is empty, the return value is `NULL'..RE.RE.PPThe function `tclistpop2' is used in order to remove a string element of the end of a list object..PP.RS.br\fBchar *tclistpop2(TCLIST *\fIlist\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RSThe return value is the string of the removed element..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If the list is empty, the return value is `NULL'..RE.RE.PPThe function `tclistunshift' is used in order to add an element at the top of a list object..PP.RS.br\fBvoid tclistunshift(TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIptr\fR' specifies the pointer to the region of the new element..RE.RS`\fIsize\fR' specifies the size of the region..RE.RE.PPThe function `tclistunshift2' is used in order to add a string element at the top of a list object..PP.RS.br\fBvoid tclistunshift2(TCLIST *\fIlist\fB, const char *\fIstr\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIstr\fR' specifies the string of the new element..RE.RE.PPThe function `tclistshift' is used in order to remove an element of the top of a list object..PP.RS.br\fBvoid *tclistshift(TCLIST *\fIlist\fB, int *\fIsp\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSThe return value is the pointer to the region of the removed element..RE.RSBecause 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 when it is no longer in use. If the list is empty, the return value is `NULL'..RE.RE.PPThe function `tclistshift2' is used in order to remove a string element of the top of a list object..PP.RS.br\fBchar *tclistshift2(TCLIST *\fIlist\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RSThe return value is the string of the removed element..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. If the list is empty, the return value is `NULL'..RE.RE.PPThe function `tclistinsert' is used in order to add an element at the specified location of a list object..PP.RS.br\fBvoid tclistinsert(TCLIST *\fIlist\fB, int \fIindex\fB, const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIindex\fR' specifies the index of the new element..RE.RS`\fIptr\fR' specifies the pointer to the region of the new element..RE.RS`\fIsize\fR' specifies the size of the region..RE.RSIf `index' is equal to or more than the number of elements, this function has no effect..RE.RE.PPThe function `tclistinsert2' is used in order to add a string element at the specified location of a list object..PP.RS.br\fBvoid tclistinsert2(TCLIST *\fIlist\fB, int \fIindex\fB, const char *\fIstr\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIindex\fR' specifies the index of the new element..RE.RS`\fIstr\fR' specifies the string of the new element..RE.RSIf `index' is equal to or more than the number of elements, this function has no effect..RE.RE.PPThe function `tclistremove' is used in order to remove an element at the specified location of a list object..PP.RS.br\fBvoid *tclistremove(TCLIST *\fIlist\fB, int \fIindex\fB, int *\fIsp\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIindex\fR' specifies the index of the element to be removed..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSThe return value is the pointer to the region of the removed element..RE.RSBecause 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 when 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'..RE.RE.PPThe function `tclistremove2' is used in order to remove a string element at the specified location of a list object..PP.RS.br\fBchar *tclistremove2(TCLIST *\fIlist\fB, int \fIindex\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIindex\fR' specifies the index of the element to be removed..RE.RSThe return value is the string of the removed element..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when 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'..RE.RE.PPThe function `tclistover' is used in order to overwrite an element at the specified location of a list object..PP.RS.br\fBvoid tclistover(TCLIST *\fIlist\fB, int \fIindex\fB, const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIindex\fR' specifies the index of the element to be overwritten..RE.RS`\fIptr\fR' specifies the pointer to the region of the new content..RE.RS`\fIsize\fR' specifies the size of the new content..RE.RSIf `index' is equal to or more than the number of elements, this function has no effect..RE.RE.PPThe function `tclistover2' is used in order to overwrite a string element at the specified location of a list object..PP.RS.br\fBvoid tclistover2(TCLIST *\fIlist\fB, int \fIindex\fB, const char *\fIstr\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIindex\fR' specifies the index of the element to be overwritten..RE.RS`\fIstr\fR' specifies the string of the new content..RE.RSIf `index' is equal to or more than the number of elements, this function has no effect..RE.RE.PPThe function `tclistsort' is used in order to sort elements of a list object in lexical order..PP.RS.br\fBvoid tclistsort(TCLIST *\fIlist\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RE.PPThe function `tclistlsearch' is used in order to search a list object for an element using liner search..PP.RS.br\fBint tclistlsearch(const TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIptr\fR' specifies the pointer to the region of the key..RE.RS`\fIsize\fR' specifies the size of the region..RE.RSThe return value is the index of a corresponding element or \-1 if there is no corresponding element..RE.RSIf two or more elements correspond, the former returns..RE.RE.PPThe function `tclistbsearch' is used in order to search a list object for an element using binary search..PP.RS.br\fBint tclistbsearch(const TCLIST *\fIlist\fB, const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIlist\fR' specifies the list object. It should be sorted in lexical order..RE.RS`\fIptr\fR' specifies the pointer to the region of the key..RE.RS`\fIsize\fR' specifies the size of the region..RE.RSThe return value is the index of a corresponding element or \-1 if there is no corresponding element..RE.RSIf two or more elements correspond, which returns is not defined..RE.RE.PPThe function `tclistclear' is used in order to clear a list object..PP.RS.br\fBvoid tclistclear(TCLIST *\fIlist\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RSAll elements are removed..RE.RE.PPThe function `tclistdump' is used in order to serialize a list object into a byte array..PP.RS.br\fBvoid *tclistdump(const TCLIST *\fIlist\fB, int *\fIsp\fB);\fR.RS`\fIlist\fR' specifies the list object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSThe return value is the pointer to the region of the result serial region..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tclistload' is used in order to create a list object from a serialized byte array..PP.RS.br\fBTCLIST *tclistload(const void *\fIptr\fB, int \fIsize\fB);\fR.RS`\fIptr\fR' specifies the pointer to the region of serialized byte array..RE.RS`\fIsize\fR' specifies the size of the region..RE.RSThe return value is a new list object..RE.RSBecause the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use..RE.RE.SH API OF HASH MAP.PPThe function `tcmapnew' is used in order to create a map object..PP.RS.br\fBTCMAP *tcmapnew(void);\fR.RSThe return value is the new map object..RE.RE.PPThe function `tcmapnew2' is used in order to create a map object with specifying the number of the buckets..PP.RS.br\fBTCMAP *tcmapnew2(uint32_t \fIbnum\fB);\fR.RS`\fIbnum\fR' specifies the number of the buckets..RE.RSThe return value is the new map object..RE.RE.PPThe function `tcmapnew3' is used in order to create a map object with initial string elements..PP.RS.br\fBTCMAP *tcmapnew3(const char *\fIstr\fB, ...);\fR.RS`\fIstr\fR' specifies the string of the first element..RE.RSThe other arguments are other elements. They should be trailed by a `NULL' argument..RE.RSThe return value is the new map object..RE.RSThe key and the value of each record are situated one after the other..RE.RE.PPThe function `tcmapdup' is used in order to copy a map object..PP.RS.br\fBTCMAP *tcmapdup(const TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSThe return value is the new map object equivalent to the specified object..RE.RE.PPThe function `tcmapdel' is used in order to delete a map object..PP.RS.br\fBvoid tcmapdel(TCMAP *\fImap\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RSNote that the deleted object and its derivatives can not be used anymore..RE.RE.PPThe function `tcmapput' is used in order to store a record into a map object..PP.RS.br\fBvoid tcmapput(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RSIf a record with the same key exists in the map, it is overwritten..RE.RE.PPThe function `tcmapput2' is used in order to store a string record into a map object..PP.RS.br\fBvoid tcmapput2(TCMAP *\fImap\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RSIf a record with the same key exists in the map, it is overwritten..RE.RE.PPThe function `tcmapputkeep' is used in order to store a new record into a map object..PP.RS.br\fBbool tcmapputkeep(TCMAP *\fImap\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR.RS`\fImap\fR' specifies the map object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -