table of contents
TCUTIL(3) | Tokyo Cabinet | TCUTIL(3) |
NAME¶
tcutil - the utility APIDESCRIPTION¶
The utility API is a set of routines to handle records on memory easily. Especially, extensible string, array list, hash map, and ordered tree are useful. To use the utility API, include ` tcutil.h' and related standard header files. Usually, write the following description near the front of a source file.API OF BASIC UTILITIES¶
The constant `tcversion' is the string containing the version information.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 occurs when memory allocation is failed.
`size' specifies the size of the
region.
The return value is the pointer to the
allocated region.
This function handles failure of memory
allocation implicitly. 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.
`nmemb' specifies the number of
elements.
`size' specifies the size of each
element.
The return value is the pointer to the
allocated nullified region.
This function handles failure of memory
allocation implicitly. Because the region of the return value is allocated
with the `calloc' call, it should be released with the `free' call when it is
no longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the pointer to the
re-allocated region.
This function handles failure of memory
allocation implicitly. Because the region of the return value is allocated
with the `realloc' call, it should be released with the `free' call when it is
no longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the pointer to the
allocated region of the duplicate.
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 when it is no
longer in use.
`str' specifies the string.
The return value is the allocated string
equivalent to the specified 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.
`ptr' specifies the pointer to the
region. If it is `NULL', this function has no effect.
Although this function is just a wrapper of
`free' call, this is useful in applications using another package of the
`malloc' series.
API OF EXTENSIBLE STRING¶
The function `tcxstrnew' is used in order to create an extensible string object.The return value is the new extensible string
object.
`str' specifies the string of the
initial content.
The return value is the new extensible string
object containing the specified string.
`asiz' specifies the initial allocation
size.
The return value is the new extensible string
object.
`xstr' specifies the extensible string
object.
The return value is the new extensible string
object equivalent to the specified object.
`xstr' specifies the extensible string
object.
Note that the deleted object and its
derivatives can not be used anymore.
`xstr' specifies the extensible string
object.
`ptr' specifies the pointer to the
region to be appended.
`size' specifies the size of the
region.
`xstr' specifies the extensible string
object.
`str' specifies the string to be
appended.
`xstr' specifies the extensible string
object.
The return value is the pointer of the region
of the object.
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.
`xstr' specifies the extensible string
object.
The return value is the size of the region of
the object.
`xstr' specifies the extensible string
object.
The internal buffer of the object is cleared
and the size is set zero.
`xstr' specifies the extensible string
object.
`format' specifies the printf-like
format string. The conversion character `%' can be used with such flag
characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', `@',
`?', `b', and `%'. `@' works as with `s' but escapes meta characters of XML.
`?' works as with `s' but escapes meta characters of URL. `b' converts an
integer to the string as binary numbers. The other conversion character work
as with each original.
The other arguments are used according to the
format string.
`format' specifies the printf-like
format string. The conversion character `%' can be used with such flag
characters as `s', `d', `o', `u', `x', `X', `c', `e', `E', `f', `g', `G', `@',
`?', `b', and `%'. `@' works as with `s' but escapes meta characters of XML.
`?' works as with `s' but escapes meta characters of URL. `b' converts an
integer to the string as binary numbers. The other conversion character work
as with each original.
The other arguments are used according to the
format string.
The return value is the pointer to the region
of the result 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.
API OF ARRAY LIST¶
The function `tclistnew' is used in order to create a list object.The return value is the new list object.
`anum' specifies the number of elements
expected to be stored in the list.
The return value is the new list object.
`str' specifies the string of the first
element.
The other arguments are other elements. They
should be trailed by a `NULL' argument.
The return value is the new list object.
`list' specifies the list object.
The return value is the new list object
equivalent to the specified object.
`list' specifies the list object.
Note that the deleted object and its
derivatives can not be used anymore.
`list' specifies the list object.
The return value is the number of elements of
the list.
`list' specifies the list object.
`index' specifies the index of the
element.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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'.
`list' specifies the list object.
`index' specifies the index of the
element.
The return value is the string of the
value.
If `index' is equal to or more than the number
of elements, the return value is `NULL'.
`list' specifies the list object.
`ptr' specifies the pointer to the
region of the new element.
`size' specifies the size of the
region.
`list' specifies the list object.
`str' specifies the string of the new
element.
`list' specifies the list object.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the removed element.
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 when it is no
longer in use. If the list is empty, the return value is `NULL'.
`list' specifies the list object.
The return value is the string of the removed
element.
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'.
`list' specifies the list object.
`ptr' specifies the pointer to the
region of the new element.
`size' specifies the size of the
region.
`list' specifies the list object.
`str' specifies the string of the new
element.
`list' specifies the list object.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the removed element.
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 when it is no
longer in use. If the list is empty, the return value is `NULL'.
`list' specifies the list object.
The return value is the string of the removed
element.
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'.
`list' specifies the list object.
`index' specifies the index of the new
element.
`ptr' specifies the pointer to the
region of the new element.
`size' specifies the size of the
region.
If `index' is equal to or more than the number
of elements, this function has no effect.
`list' specifies the list object.
`index' specifies the index of the new
element.
`str' specifies the string of the new
element.
If `index' is equal to or more than the number
of elements, this function has no effect.
`list' specifies the list object.
`index' specifies the index of the
element to be removed.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the removed element.
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 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'.
`list' specifies the list object.
`index' specifies the index of the
element to be removed.
The return value is the string of the removed
element.
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'.
`list' specifies the list object.
`index' specifies the index of the
element to be overwritten.
`ptr' specifies the pointer to the
region of the new content.
`size' specifies the size of the new
content.
If `index' is equal to or more than the number
of elements, this function has no effect.
`list' specifies the list object.
`index' specifies the index of the
element to be overwritten.
`str' specifies the string of the new
content.
If `index' is equal to or more than the number
of elements, this function has no effect.
`list' specifies the list object.
`list' specifies the list object.
`ptr' specifies the pointer to the
region of the key.
`size' specifies the size of the
region.
The return value is the index of a
corresponding element or -1 if there is no corresponding element.
If two or more elements correspond, the former
returns.
`list' specifies the list object. It
should be sorted in lexical order.
`ptr' specifies the pointer to the
region of the key.
`size' specifies the size of the
region.
The return value is the index of a
corresponding element or -1 if there is no corresponding element.
If two or more elements correspond, which
returns is not defined.
`list' specifies the list object.
All elements are removed.
`list' specifies the list object.
`sp' specifies the pointer to the
variable into 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
when it is no longer in use.
`ptr' specifies the pointer to the
region of serialized byte array.
`size' specifies the size of the
region.
The return value is a new list object.
Because 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.
API OF HASH MAP¶
The function `tcmapnew' is used in order to create a map object.The return value is the new map object.
`bnum' specifies the number of the
buckets.
The return value is the new map object.
`str' specifies the string of the first
element.
The other arguments are other elements. They
should be trailed by a `NULL' argument.
The return value is the new map object.
The key and the value of each record are
situated one after the other.
`map' specifies the map object.
The return value is the new map object
equivalent to the specified object.
`map' specifies the map object.
Note that the deleted object and its
derivatives can not be used anymore.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If a record with the same key exists in the
map, it is overwritten.
`map' specifies the map object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If a record with the same key exists in the
map, it is overwritten.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
map, this function has no effect.
`map' specifies the map object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
map, this function has no effect.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If there is no corresponding record, a new
record is created.
`map' specifies the map object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If there is no corresponding record, a new
record is created.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`map' specifies the map object.
`kstr' specifies the string of the
key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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.
`map' specifies the map object.
`kstr' specifies the string of the
key.
If successful, the return value is the string
of the value of the corresponding record. `NULL' is returned when no record
corresponds.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of a key.
`ksiz' specifies the size of the region
of the key.
`head' specifies the destination which
is the head if it is true or the tail if else.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`map' specifies the map object.
`kstr' specifies the string of a
key.
`head' specifies the destination which
is the head if it is true or the tail if else.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`map' specifies the map object.
The iterator is used in order to access the
key of every record stored in the map object.
`map' specifies the map object.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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 can be fetched from 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 as the
stored order.
`map' specifies the map object.
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 can be fetched from the iterator.
The order of iteration is assured to be the
same as the stored order.
`map' specifies the map object.
The return value is the number of the records
stored in the map object.
`map' specifies the map object.
The return value is the total size of memory
used in a map object.
`map' specifies the map object.
The return value is the new list object
containing all keys in the map object.
Because 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.
`map' specifies the map object.
The return value is the new list object
containing all values in the map object.
Because 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.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as an integer and is added to. If no record corresponds, a new
record of the additional value is stored.
`map' specifies the map object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as a real number and is added to. If no record corresponds, a new
record of the additional value is stored.
`map' specifies the map object.
All records are removed.
`map' specifies the map object.
`num' specifies the number of records
to be removed.
`map' specifies the map object.
`sp' specifies the pointer to the
variable into 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
when it is no longer in use.
`ptr' specifies the pointer to the
region of serialized byte array.
`size' specifies the size of the
region.
The return value is a new map object.
Because the object of the return value is
created with the function `tcmapnew', it should be deleted with the function
`tcmapdel' when it is no longer in use.
API OF ORDERED TREE¶
The function `tctreenew' is used in order to create a tree object.The return value is the new tree object.
`cmp' specifies the pointer to the
custom comparison function. It receives five parameters. The first parameter
is the pointer to the region of one key. The second parameter is the size of
the region of one key. The third parameter is the pointer to the region of the
other key. The fourth parameter is the size of the region of the other key.
The fifth parameter is the pointer to the optional opaque object. It returns
positive if the former is big, negative if the latter is big, 0 if both are
equivalent.
`cmpop' specifies an arbitrary pointer
to be given as a parameter of the comparison function. If it is not needed,
`NULL' can be specified.
The return value is the new tree object.
The default comparison function compares keys
of two records by lexical order. The functions `tccmplexical' (default),
`tccmpdecimal', `tccmpint32', and `tccmpint64' are built-in.
`tree' specifies the tree object.
The return value is the new tree object
equivalent to the specified object.
`tree' specifies the tree object.
Note that the deleted object and its
derivatives can not be used anymore.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If a record with the same key exists in the
tree, it is overwritten.
`tree' specifies the tree object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If a record with the same key exists in the
tree, it is overwritten.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
tree, this function has no effect.
`tree' specifies the tree object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
tree, this function has no effect.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If there is no corresponding record, a new
record is created.
`tree' specifies the tree object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If there is no corresponding record, a new
record is created.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`tree' specifies the tree object.
`kstr' specifies the string of the
key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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.
`tree' specifies the tree object.
`kstr' specifies the string of the
key.
If successful, the return value is the string
of the value of the corresponding record. `NULL' is returned when no record
corresponds.
`tree' specifies the tree object.
The iterator is used in order to access the
key of every record stored in the tree object.
`tree' specifies the tree object.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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 can be fetched from 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 ascending of the
keys.
`tree' specifies the tree object.
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 can be fetched from the iterator.
The order of iteration is assured to be
ascending of the keys.
`tree' specifies the tree object.
The return value is the number of the records
stored in the tree object.
`tree' specifies the tree object.
The return value is the total size of memory
used in a tree object.
`tree' specifies the tree object.
The return value is the new list object
containing all keys in the tree object.
Because 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.
`tree' specifies the tree object.
The return value is the new list object
containing all values in the tree object.
Because 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.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as an integer and is added to. If no record corresponds, a new
record of the additional value is stored.
`tree' specifies the tree object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as a real number and is added to. If no record corresponds, a new
record of the additional value is stored.
`tree' specifies the tree object.
All records are removed.
`tree' specifies the tree object.
`num' specifies the number of records
to be removed.
`tree' specifies the tree object.
`sp' specifies the pointer to the
variable into 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
when it is no longer in use.
`ptr' specifies the pointer to the
region of serialized byte array.
`size' specifies the size of the
region.
`cmp' specifies the pointer to the
custom comparison function.
`cmpop' specifies an arbitrary pointer
to be given as a parameter of the comparison function.
If it is not needed, `NULL' can be
specified.
The return value is a new tree object.
Because the object of the return value is
created with the function `tctreenew', it should be deleted with the function
`tctreedel' when it is no longer in use.
API OF ON-MEMORY HASH DATABASE¶
The function `tcmdbnew' is used in order to create an on-memory hash database object.The return value is the new on-memory hash
database object.
The object can be shared by plural threads
because of the internal mutex.
`bnum' specifies the number of the
buckets.
The return value is the new on-memory hash
database object.
The object can be shared by plural threads
because of the internal mutex.
`mdb' specifies the on-memory hash
database object.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If a record with the same key exists in the
database, it is overwritten.
`mdb' specifies the on-memory hash
database object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If a record with the same key exists in the
database, it is overwritten.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
database, this function has no effect.
`mdb' specifies the on-memory hash
database object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
database, this function has no effect.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If there is no corresponding record, a new
record is created.
`mdb' specifies the on-memory hash
database object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If there is no corresponding record, a new
record is created.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`mdb' specifies the on-memory hash
database object.
`kstr' specifies the string of the
key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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. 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.
`mdb' specifies the on-memory hash
database object.
`kstr' specifies the string of the
key.
If successful, the return value is the string
of the value of the corresponding record. `NULL' is returned when no record
corresponds.
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.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
If successful, the return value is the size of
the value of the corresponding record, else, it is -1.
`mdb' specifies the on-memory hash
database object.
`kstr' specifies the string of the
key.
If successful, the return value is the size of
the value of the corresponding record, else, it is -1.
`mdb' specifies the on-memory hash
database object.
The iterator is used in order to access the
key of every record stored in the on-memory hash database.
`mdb' specifies the on-memory hash
database object.
`sp' specifies the pointer to the
variable into which the size of the region of the return
value is assigned.
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 can be fetched from 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. 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. The order of iteration is assured to be the same as the stored
order.
`mdb' specifies the on-memory hash
database object.
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 can be fetched from the iterator.
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. The order of iteration is assured to be the same
as the stored order.
`mdb' specifies the on-memory hash
database object.
`pbuf' specifies the pointer to the
region of the prefix.
`psiz' specifies the size of the region
of the prefix.
`max' specifies the maximum number of
keys to be fetched. If it is negative, no limit is specified.
The return value is a list object of the
corresponding keys. This function does never fail. It returns an empty list
even if no key corresponds.
Because 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. Note that this function may be very
slow because every key in the database is scanned.
`mdb' specifies the on-memory hash
database object.
`pstr' specifies the string of the
prefix.
`max' specifies the maximum number of
keys to be fetched. If it is negative, no limit is specified.
The return value is a list object of the
corresponding keys. This function does never fail. It returns an empty list
even if no key corresponds.
Because 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. Note that this function may be very
slow because every key in the database is scanned.
`mdb' specifies the on-memory hash
database object.
The return value is the number of the records
stored in the database.
`mdb' specifies the on-memory hash
database object.
The return value is the total size of memory
used in the database.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as an integer and is added to. If no record corresponds, a new
record of the additional value is stored.
`mdb' specifies the on-memory hash
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as a real number and is added to. If no record corresponds, a new
record of the additional value is stored.
`mdb' specifies the on-memory hash
database object.
All records are removed.
`mdb' specifies the on-memory hash
database object.
`num' specifies the number of records
to be removed.
API OF ON-MEMORY TREE DATABASE¶
The function `tcndbnew' is used in order to create an on-memory tree database object.The return value is the new on-memory tree
database object.
The object can be shared by plural threads
because of the internal mutex.
`cmp' specifies the pointer to the
custom comparison function.
`cmpop' specifies an arbitrary pointer
to be given as a parameter of the comparison function. If it is not needed,
`NULL' can be specified.
The return value is the new on-memory tree
database object.
The default comparison function compares keys
of two records by lexical order. The functions `tccmplexical' (default),
`tccmpdecimal', `tccmpint32', and `tccmpint64' are built-in. The object can be
shared by plural threads because of the internal mutex.
`ndb' specifies the on-memory tree
database object.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If a record with the same key exists in the
database, it is overwritten.
`ndb' specifies the on-memory tree
database object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If a record with the same key exists in the
database, it is overwritten.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
database, this function has no effect.
`ndb' specifies the on-memory tree
database object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If successful, the return value is true, else,
it is false.
If a record with the same key exists in the
database, this function has no effect.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`vbuf' specifies the pointer to the
region of the value.
`vsiz' specifies the size of the region
of the value.
If there is no corresponding record, a new
record is created.
`ndb' specifies the on-memory tree
database object.
`kstr' specifies the string of the
key.
`vstr' specifies the string of the
value.
If there is no corresponding record, a new
record is created.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`ndb' specifies the on-memory tree
database object.
`kstr' specifies the string of the
key.
If successful, the return value is true. False
is returned when no record corresponds to the specified key.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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. 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.
`ndb' specifies the on-memory tree
database object.
`kstr' specifies the string of the
key.
If successful, the return value is the string
of the value of the corresponding record. `NULL' is returned when no record
corresponds.
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.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
If successful, the return value is the size of
the value of the corresponding record, else, it is -1.
`ndb' specifies the on-memory tree
database object.
`kstr' specifies the string of the
key.
If successful, the return value is the size of
the value of the corresponding record, else, it is -1.
`ndb' specifies the on-memory tree
database object.
The iterator is used in order to access the
key of every record stored in the on-memory database.
`ndb' specifies the on-memory tree
database object.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
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 can be fetched from 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. 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. The order of iteration is assured to be the same as the stored
order.
`ndb' specifies the on-memory tree
database object.
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 can be fetched from the iterator.
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. The order of iteration is assured to be the same
as the stored order.
`ndb' specifies the on-memory tree
database object.
`pbuf' specifies the pointer to the
region of the prefix.
`psiz' specifies the size of the region
of the prefix.
`max' specifies the maximum number of
keys to be fetched. If it is negative, no limit is specified.
The return value is a list object of the
corresponding keys. This function does never fail. It returns an empty list
even if no key corresponds.
Because 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.
`ndb' specifies the on-memory tree
database object.
`pstr' specifies the string of the
prefix.
`max' specifies the maximum number of
keys to be fetched. If it is negative, no limit is specified.
The return value is a list object of the
corresponding keys. This function does never fail. It returns an empty list
even if no key corresponds.
Because 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.
`ndb' specifies the on-memory tree
database object.
The return value is the number of the records
stored in the database.
`ndb' specifies the on-memory tree
database object.
The return value is the total size of memory
used in the database.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as an integer and is added to. If no record corresponds, a new
record of the additional value is stored.
`ndb' specifies the on-memory tree
database object.
`kbuf' specifies the pointer to the
region of the key.
`ksiz' specifies the size of the region
of the key.
`num' specifies the additional
value.
The return value is the summation value.
If the corresponding record exists, the value
is treated as a real number and is added to. If no record corresponds, a new
record of the additional value is stored.
`ndb' specifies the on-memory tree
database object.
All records are removed.
`ndb' specifies the on-memory tree
database object.
`num' specifies the number of records
to be removed.
API OF MEMORY POOL¶
The function `tcmpoolnew' is used in order to create a memory pool object.The return value is the new memory pool
object.
`mpool' specifies the memory pool
object.
Note that the deleted object and its
derivatives can not be used anymore.
`mpool' specifies the memory pool
object.
`ptr' specifies the pointer to the
object to be relegated. If it is `NULL', this function has no effect.
`del' specifies the pointer to the
function to delete the object.
The return value is the pointer to the given
object.
This function assures that the specified
object is deleted when the memory pool object is deleted.
`mpool' specifies the memory pool
object.
`ptr' specifies the pointer to the
region to be relegated. If it is `NULL', this function has no effect.
The return value is the pointer to the given
object.
This function assures that the specified
region is released when the memory pool object is deleted.
`mpool' specifies the memory pool
object.
`xstr' specifies the extensible string
object. If it is `NULL', this function has no effect.
The return value is the pointer to the given
object.
This function assures that the specified
object is deleted when the memory pool object is deleted.
`mpool' specifies the memory pool
object.
`list' specifies the list object. If it
is `NULL', this function has no effect.
The return value is the pointer to the given
object.
This function assures that the specified
object is deleted when the memory pool object is deleted.
`mpool' specifies the memory pool
object.
`map' specifies the map object. If it
is `NULL', this function has no effect.
The return value is the pointer to the given
object.
This function assures that the specified
object is deleted when the memory pool object is deleted.
`mpool' specifies the memory pool
object.
`tree' specifies the tree object. If it
is `NULL', this function has no effect.
The return value is the pointer to the given
object.
This function assures that the specified
object is deleted when the memory pool object is deleted.
`mpool' specifies the memory pool
object.
The return value is the pointer to the
allocated region under the memory pool.
The return value is the new extensible string
object under the memory pool.
The return value is the new list object under
the memory pool.
The return value is the new map object under
the memory pool.
The return value is the new tree object under
the memory pool.
`mpool' specifies the memory pool
object.
`exe' specifies whether to execute the
destructor of the removed handler.
`mpool' specifies the memory pool
object.
`exe' specifies whether to execute the
destructors of the removed handlers.
The return value is the global memory pool
object.
The global memory pool object is a singleton
and assured to be deleted when the process is terminating normally.
API OF MISCELLANEOUS UTILITIES¶
The function `tclmax' is used in order to get the larger value of two integers.`a' specifies an integer.
`b' specifies the other integer.
The return value is the larger value of the
two.
`a' specifies an integer.
`b' specifies the other integer.
The return value is the lesser value of the
two.
The return value is the random number between
0 and `ULONG_MAX'.
This function uses the random number source
device and generates a real random number if possible.
The return value is the random number equal to
or greater than 0, and less than 1.0.
This function uses the random number source
device and generates a real random number if possible.
`avg' specifies the average.
`sd' specifies the standard
deviation.
The return value is the random number.
This function uses the random number source
device and generates a real random number if possible.
`astr' specifies a string.
`bstr' specifies of the other
string.
The return value is positive if the former is
big, negative if the latter is big, 0 if both are equivalent.
`str' specifies the target
string.
`key' specifies the forward matching
key string.
The return value is true if the target string
begins with the key, else, it is false.
`str' specifies the target
string.
`key' specifies the forward matching
key string.
The return value is true if the target string
begins with the key, else, it is false.
`str' specifies the target
string.
`key' specifies the backward matching
key string.
The return value is true if the target string
ends with the key, else, it is false.
`str' specifies the target
string.
`key' specifies the backward matching
key string.
The return value is true if the target string
ends with the key, else, it is false.
`astr' specifies a string.
`bstr' specifies of the other
string.
The return value is the edit distance which is
known as the Levenshtein distance. The cost is calculated by byte.
`astr' specifies a string.
`bstr' specifies of the other
string.
The return value is the edit distance which is
known as the Levenshtein distance. The cost is calculated by Unicode
character.
`str' specifies the string to be
converted.
The return value is the string itself.
`str' specifies the string to be
converted.
The return value is the string itself.
`str' specifies the string to be
converted.
The return value is the string itself.
`str' specifies the string to be
converted.
The return value is the string itself.
`str' specifies the string to be
converted.
`rstr' specifies the string containing
characters to be replaced.
`sstr' specifies the string containing
characters to be substituted.
If the substitute string is shorter then the
replacement string, corresponding characters are removed.
`str' specifies the string of
UTF-8.
The return value is the number of characters
in the string.
`str' specifies the string of
UTF-8.
`num' specifies the number of
characters to be kept.
The return value is the string itself.
`str' specifies the UTF-8 string.
`ary' specifies the pointer to the
region into which the result UCS-2 codes are written. The size of the buffer
should be sufficient.
`np' specifies the pointer to a
variable into which the number of elements of the result array is
assigned.
`ary' specifies the array of UCS-2
codes.
`num' specifies the number of the
array.
`str' specifies the pointer to the
region into which the result UTF-8 string is written. The size of the buffer
should be sufficient.
The return value is the length of the result
string.
`str' specifies the source
string.
`delims' specifies a string containing
delimiting characters.
The return value is a list object of the split
elements.
If two delimiters are successive, it is
assumed that an empty element is between the two. Because 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.
`list' specifies a list object.
`delim' specifies a delimiting
character.
The return value is the result 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.
`str' specifies the string.
The return value is the integer. If the string
does not contain numeric expression, 0 is returned.
This function is equivalent to `atoll' except
that it does not depend on the locale.
`str' specifies the string, which can
be trailed by a binary metric prefix. "K", "M",
"G", "T", "P", and "E" are supported.
They are case-insensitive.
The return value is the integer. If the string
does not contain numeric expression, 0 is returned. If the integer overflows
the domain, `INT64_MAX' or `INT64_MIN' is returned according to the
sign.
`str' specifies the string.
The return value is the real number. If the
string does not contain numeric expression, 0.0 is returned.
This function is equivalent to `atof' except
that it does not depend on the locale.
`str' specifies the target
string.
`regex' specifies the regular
expression string. If it begins with `*', the trailing substring is used as a
case-insensitive regular expression.
The return value is true if matching is
success, else, it is false.
`str' specifies the target
string.
`regex' specifies the regular
expression string for substrings. If it begins with `*', the trailing
substring is used as a case-insensitive regular expression.
`alt' specifies the alternative string
with which each substrings is replaced. Each `&' in the string is replaced
with the matched substring. Each `´ in the string escapes the following
character. Special escapes "1" through "9" referring to
the corresponding matching sub-expressions in the regular expression string
are supported.
The return value is a new converted string.
Even if the regular expression is invalid, a copy of the original string is
returned.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`buf' specifies the pointer to the
region into which the result string is written. The size of the buffer should
be equal to or more than 48 bytes.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`kbuf' specifies the pointer to the
region of the cipher key.
`ksiz' specifies the size of the region
of the cipher key.
`obuf' specifies the pointer to the
region into which the result data is written. The size of the buffer should be
equal to or more than the input region.
The return value is the time of day in
seconds. The accuracy is in microseconds.
`t' specifies the source time in
seconds from the epoch. If it is `INT64_MAX', the current time is
specified.
`jl' specifies the jet lag of a
location in seconds. If it is `INT_MAX', the local jet lag is specified.
`yearp' specifies the pointer to a
variable to which the year is assigned. If it is `NULL', it is not used.
`monp' specifies the pointer to a
variable to which the month is assigned. If it is `NULL', it is not used. 1
means January and 12 means December.
`dayp' specifies the pointer to a
variable to which the day of the month is assigned. If it is `NULL', it is not
used.
`hourp' specifies the pointer to a
variable to which the hours is assigned. If it is `NULL', it is not
used.
`minp' specifies the pointer to a
variable to which the minutes is assigned. If it is `NULL', it is not
used.
`secp' specifies the pointer to a
variable to which the seconds is assigned. If it is `NULL', it is not
used.
`t' specifies the source time in
seconds from the epoch. If it is `INT64_MAX', the current time is
specified.
`jl' specifies the jet lag of a
location in seconds. If it is `INT_MAX', the local jet lag is specified.
`buf' specifies the pointer to the
region into which the result string is written. The size of the buffer should
be equal to or more than 48 bytes.
W3CDTF represents a date as
"YYYY-MM-DDThh:mm:ddTZD".
`t' specifies the source time in
seconds from the epoch. If it is `INT64_MAX', the current time is
specified.
`jl' specifies the jet lag of a
location in seconds. If it is `INT_MAX', the local jet lag is specified.
`buf' specifies the pointer to the
region into which the result string is written. The size of the buffer should
be equal to or more than 48 bytes.
RFC 1123 format represents a date as
"Wdy, DD-Mon-YYYY hh:mm:dd TZD".
`str' specifies the date string in
decimal, hexadecimal, W3CDTF, or RFC 822 (1123). Decimal can be trailed by
"s" for in seconds, "m" for in minutes, "h" for
in hours, and "d" for in days.
The return value is the time value of the date
or `INT64_MIN' if the format is invalid.
The return value is the jet lag of the local
time in seconds.
`year' specifies the year of a
date.
`mon' specifies the month of the
date.
`day' specifies the day of the
date.
The return value is the day of week of the
date. 0 means Sunday and 6 means Saturday.
API OF FILESYSTEM UTILITIES¶
The function `tcrealpath' is used in order to get the canonicalized absolute path of a file.`path' specifies the path of the
file.
The return value is the canonicalized absolute
path of a file, or `NULL' if the path is invalid.
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.
`path' specifies the path of the
file.
`isdirp' specifies the pointer to a
variable into which whether the file is a directory is assigned. If it is
`NULL', it is ignored.
`sizep' specifies the pointer to a
variable into which the size of the file is assigned. If it is `NULL', it is
ignored.
`ntimep' specifies the pointer to a
variable into which the size of the file is assigned. If it is `NULL', it is
ignored.
If successful, the return value is true, else,
it is false.
`path' specifies the path of the file.
If it is `NULL', the standard input is specified.
`limit' specifies the limiting size of
reading data. If it is not more than 0, the limitation is not specified.
`sp' specifies the pointer to the
variable into 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
allocated region of the read data, or `NULL' if the file could not be
opened.
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 when when is no
longer in use.
`path' specifies the path of the file.
If it is `NULL', the standard input is specified.
The return value is a list object of every
lines if successful, else it is `NULL'.
Line separators are cut out. Because 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.
`path' specifies the path of the file.
If it is `NULL', the standard output is specified.
`ptr' specifies the pointer to the data
region.
`size' specifies the size of the
region.
If successful, the return value is true, else,
it is false.
`src' specifies the path of the source
file.
`dest' specifies the path of the
destination file.
The return value is true if successful, else,
it is false.
If the destination file exists, it is
overwritten.
`path' specifies the path of the
directory.
The return value is a list object of names if
successful, else it is `NULL'.
Links to the directory itself and to the
parent directory are ignored.
Because 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.
`pattern' specifies the matching
pattern.
The return value is a list object of matched
paths. If no path is matched, an empty list is returned.
Because 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.
`path' specifies the path of the
link.
If successful, the return value is true, else,
it is false. False is returned when the link does not exist or the permission
is denied.
`fd' specifies the file
descriptor.
`buf' specifies the buffer to be
written.
`size' specifies the size of the
buffer.
The return value is true if successful, else,
it is false.
`fd' specifies the file
descriptor.
`buf' specifies the buffer to store
into.
`size' specifies the size of the
buffer.
The return value is true if successful, else,
it is false.
`fd' specifies the file
descriptor.
`ex' specifies whether an exclusive
lock or a shared lock is performed.
`nb' specifies whether to request with
non-blocking.
The return value is true if successful, else,
it is false.
`fd' specifies the file
descriptor.
The return value is true if successful, else,
it is false.
`args' specifies an array of the
command name and its arguments.
`anum' specifies the number of elements
of the array.
The return value is the exit code of the
command or `INT_MAX' on failure.
The command name and the arguments are quoted
and meta characters are escaped.
API OF ENCODING UTILITIES¶
The function `tcurlencode' is used in order to encode a serial object with URL encoding.`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the result string.
Because the region of the return value is
allocated with the `malloc' call, it should be released with the `free' call
if when is no longer in use.
`str' specifies the encoded
string.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the result.
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 when it is no
longer in use.
`str' specifies the URL string.
The return value is the map object whose keys
are the name of elements. The key "self" indicates the URL itself.
The key "scheme" indicates the scheme. The key "host"
indicates the host of the server. The key "port" indicates the port
number of the server. The key "authority" indicates the authority
information. The key "path" indicates the path of the resource. The
key "file" indicates the file name without the directory section.
The key "query" indicates the query string. The key
"fragment" indicates the fragment string.
Supported schema are HTTP, HTTPS, FTP, and
FILE. Absolute URL and relative URL are supported. Because the object of the
return value is created with the function `tcmapnew', it should be deleted
with the function `tcmapdel' when it is no longer in use.
`base' specifies the absolute URL of
the base location.
`target' specifies the URL to be
resolved.
The return value is the resolved URL. If the
target URL is relative, a new URL of relative location from the base location
is returned. Else, a copy of the target URL is returned.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the result string.
Because the region of the return value is
allocated with the `malloc' call, it should be released with the `free' call
if when is no longer in use.
`str' specifies the encoded
string.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the result.
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 when it is no
longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the result string.
Because the region of the return value is
allocated with the `malloc' call, it should be released with the `free' call
if when is no longer in use.
`str' specifies the encoded
string.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the result.
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 when it is no
longer in use.
`str' specifies the string.
`encname' specifies the string of the
name of the character encoding.
`base' specifies whether to use Base64
encoding. If it is false, Quoted-printable is used.
The return value is the result 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.
`str' specifies the encoded
string.
`enp' specifies the pointer to the
region into which the name of encoding is written. If it is `NULL', it is not
used. The size of the buffer should be equal to or more than 32 bytes.
The return value is the result 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.
`ptr' specifies the pointer to the
region of MIME data.
`size' specifies the size of the
region.
`headers' specifies a map object to
store headers. If it is `NULL', it is not used. Each key of the map is an
uncapitalized header name.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the body data.
If the content type is defined, the header map
has the key "TYPE" specifying the type. If the character encoding is
defined, the key "CHARSET" indicates the encoding name. If the
boundary string of multipart is defined, the key "BOUNDARY"
indicates the string. If the content disposition is defined, the key
"DISPOSITION" indicates the direction. If the file name is defined,
the key "FILENAME" indicates the name. If the attribute name is
defined, the key "NAME" indicates the name. 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.
`ptr' specifies the pointer to the
region of multipart data of MIME.
`size' specifies the size of the
region.
`boundary' specifies the boundary
string.
The return value is a list object. Each
element of the list is the data of a part.
Because 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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the result string.
Because the region of the return value is
allocated with the `malloc' call, it should be released with the `free' call
if when is no longer in use.
`str' specifies the encoded
string.
`sp' specifies the pointer to a
variable into which the size of the region of the return
value is assigned.
The return value is the pointer to the region
of the result.
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 when it is no
longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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 when it is no
longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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 when it is no
longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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 when it is no
longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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 when it is no
longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
The return value is the CRC32 checksum of the
object.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to the
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
If successful, the return value is the pointer
to the result object, else, it is `NULL'.
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 when it is no
longer in use.
`ary' specifies the pointer to the
array of nonnegative integers.
`anum' specifies the size of the
array.
`sp' specifies the pointer to a
variable into which the size of the region of the return value is
assigned.
The return value is the pointer to the region
of the result.
Because the region of the return value is
allocated with the `malloc' call, it should be released with the `free' call
if when is no longer in use.
`ptr' specifies the pointer to the
region.
`size' specifies the size of the
region.
`np' specifies the pointer to a
variable into which the number of elements of the return value is
assigned.
The return value is the pointer to the array
of the result.
Because the region of the return value is
allocated with the `malloc' call, it should be released with the `free' call
if when is no longer in use.
`str' specifies the string.
The return value is the pointer to the escaped
string.
This function escapes only `&', `<',
`>', and `"'. 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.
`str' specifies the string.
The return value is the unescaped
string.
This function restores only `&',
`<', `>', and `"'. 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.
SEE ALSO¶
tcutest(1), tcucodec(1), tokyocabinet(3)2011-02-12 | Man Page |