Assemberist/string_tree
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
################################################################################
Description:
It is small library that creates Wordbook of c-links: #{ string => void* }.
If there is no need to modify tree it can be compressed to pack struct.
How to use it:
The library is presented as sources, so you free copy and compile it as a part
of your c-project. Or you can do 'make' and the files will be compiled and
linked to wb.o object file.
How to build templates:
If you want to build all templates: go to templates/ foulder and execute 'make'.
How to cleanup templates:
To cleanup all execute make clean.
To cleanup specific template foulder execute make clean.
NOTE! Don't use "" as key and NULL as value, it will brake internal logic.
################################################################################
STRUCTS | DESCRIPTION
################################################################################
struct token{}; | Minimal component of tree. Contains links to
| stored value, child and next token.
-----------------------------|--------------------------------------------------
struct pack{}; | String tree can be compressed and stored in to
| the struct.
--------------------------------------------------------------------------------
################################################################################
FUNCTIONS (tree) | DESCRIPTION
################################################################################
init_tree(); | Creates string tree.
| Returns dynamiaclly allocated void tree.
-----------------------------|--------------------------------------------------
set_value(); | Add new key-value to string tree. If the key
| already added just replace old value with new.
|
-----------------------------|--------------------------------------------------
get_value(); | Searh element of string_tree by key. Returns
| NULL if key not found.
-----------------------------|--------------------------------------------------
remove_tree(); | frees memory allocated for
-----------------------------|--------------------------------------------------
################################################################################
FUNCTIONS (pack) | DESCRIPTION
################################################################################
pack_tree(); | Compress string tree to pack struct. Memory
| allocated dynamically, but as single piece.
--------------------------------------------------------------------------------
find_pack_element(); | Search compressed wordbook for value.
--------------------------------------------------------------------------------
################################################################################
NOT REALYSED
################################################################################
delete_pair(); - As WA you can set value to NULL.
unpack_tree();
import_words();
import_tree();
export_tree();
update_pack();