next up previous contents
Next: Property List Functions Up: Generic Lists Previous: List and Ddlist functions   Contents

String Functions

This section provides prototypes and short descriptions of the useful functions available for tina string manipulation.

Tstring *str_alloc()

Tstring *str_make(int type, Ddlist * start, Ddlist * end)
Allocate NULL and filled string structures respectively.

void str_rm_links(Tstring * str)

void str_free(Tstring * str, void (*freefunc) ( /* ??? */ ))

void str_rm(Tstring * str, void (*freefunc) ( /* ??? */ ))

void    ddstr_rm_links(Ddlist * start, Ddlist * end)

void    ddstr_free(Ddlist * start, Ddlist * end, void (*freefunc) ( /* ??? */ ))

void    ddstr_rm(Ddlist * start, Ddlist * end, void (*freefunc) ( /* ??? */ ))

Respectively these functions: remove string elements alone; free up string references and set them to NULL; both free up references and remove elements. The str_ versions also free the Tstring data structure and its associated property list.

void str_rm_only_str(Tstring *string)

Frees the Tstring data structure and associated property list but nothing more. The function freefunc is of the form

void freefunc(void *ptr, int type)

void str_reverse(Tstring * str)

Tstring *str_copy(Tstring * str, void *(*copyfunc) ( /* ??? */ ), void *data)

Tstring *str_clone(Tstring * str) 

void ddstr_reverse(Ddlist **startp,Ddlist *endp)

void    ddstr_copy(Ddlist ** startp, Ddlist ** endp,
                   void *(*copyfunc) ( /* ??? */ ), void *data)
Functions to copy and reverse string structures. The copy has standard tina arguments

void *copy_func(void *ptr, int type, void *data)
A NULL copy function results in the generation of new link elements and/or lists which share reference data items with their originals. Likewise str_clone makes a new string structure ( Tstring and Ddlist) that points to the original data.

Note that string property lists are also copied.

Ddlist *str_link_get_by_ref(Tstring * str, void *ptr)

Tstring *str_list_get_by_ref(List * strings, void *ptr)

Ddlist *ddstr_link_get_by_ref(Ddlist * start, Ddlist * end, void *ptr)
Functions to identify the list element or string, from a list of strings, that references ptr.

void str_apply_func(Tstring * str, void (*func) ( /* ??? */ ), void *data)

void    ddstr_apply_func(Ddlist * start, Ddlist * end,
                         void (*func) ( /* ??? */ ), void *data)
Apply functions to elements of a string. Where func is of the form

void func(void *ptr, int type, void *data)

Ddlist *ddstr_mid_point(Ddlist * start, Ddlist * end)

Ddlist *ddstr_mid_point(Ddlist * start, Ddlist * end)
Appproximate middle point of the string.

Tstring *str_segment(Tstring * str, Ddlist * at)

Tstring *str_combine(Tstring * s1, Tstring * s2)
String segmentation and combination.

str_segment forms 2 strings from a single string. The original string is broken to make its end at. A new string is created starting at at-next. String segmentations that could create zero length strings return NULL and leave the original string unaffected.

str_combine creates a new string from pair of strings. The new string has s1-end adjacent to s2-start. The original strings structures are unaffected but list elements are shared with the combined version. The property list of the new string is NULL.

int str_length(Tstring * str)

int     ddstr_count(Ddlist * start, Ddlist * end)

Return the number of elements in a string.

next up previous contents
Next: Property List Functions Up: Generic Lists Previous: List and Ddlist functions   Contents
root 2019-03-24