Next: Memory De/Allocation, Previous: Ferret Booleans, Up: Ferret C Libraries
String processing is a very important task in any interactive tool. Definitely, Ferret should support more than the traditional (and english-like languages oriented) ASCII character set. These multilingual functionality should also be portable. The obvious alternative is to use the ISO/IEC 10640 standard, also known as the Unicode standard. Altought there exist several implementations of Unicode, Ferret uses the implementation found on the Tcl library. In that way, both Tcl and C Ferret components can share string data without many conversions.
Since the use by Ferret of the Unicode facilities implemented on the
Tcl library could change some day, all other Ferret components access
such facilities via an abstract data type: ferret_string_t.
This abstract data type implement a variable-size multilingual string, to be used on all Ferret components that manage strings.
This data type is composed by the following fields:
Tcl_DString *tcl_string- A Tcl string as implemented by the Tcl library.
This abstract data type implement a multipurpose list of ferret strings.
This data type is composed by the following fields:
struct _ferret_string_list_t *next- Link to the next ferret string into the list.
Determine if two ferret string have the same content.
Returns a ferret boolean.
Determine if the ferret string fstring has a copy of string as its internal content.
Create a new ferret string.
Returns an empty newly created ferret string.
Destroy a ferret string, freeing used memory.
fstring should be a properly initialized ferret string.
Make a copy of fstring and return it as a new ferret string.
Set string as the new content of fstring, destroying any previous contents.
Try to match the ferret string pattern in fstring, and return a boolean value indicating the result of the matching process.
If the ferret boolean nocase is
TRUE, then the matching process is case-insensitive.
Append the length prefix of fstring2 to fstring1.
Append the length prefix of string (a C string) to fstring.
Append the length prefix of the number string representation to fstring.
Create and return a new empty ferret string list.
Return a boolean value indicating if fslist is empty.
Append a new ferret string with a copy of string (a C string) as its value to fslist.
Return a pointer to the indexth element of fslist.
Replace the contents of the indexth ferret string contained on fslist with string (a C string).
Replace the indexth string contained into fslist with fstring.
Search into fslist for fstring.
If the string is found, return the index of the string into the list. Else, return
-1.