lihata test_tree

Test_tree executes a script that generates direct calls to functions in tree.c. It is designed to be a minimalistic test suite for the library calls.

scripting

The script language is a simple line based tab, most similar to assembly. It is explicitly not turing-complete.

Lines starting with # and empty lines are ignored. The rest of the lines start with a command followed by varying amount of arguments.

Global states are stored in pointer arrays. There are 32 node pointers (N0..N31) and 32 document pointers (D0..D31). These can be regarded as registers or variables. They are all initialized to NULL on startup. Most commands will modify one of the node or document pointers, usually supplied as the first argument. Those that take a singe node argument usually work 'in place': they modify the pointer they are called with.

commands

document manipulation

syntax description
load_doc Dtarget filename load a lihata document from a file into Dtarget
free_doc Dtarget uninitialize and free all resources of document Dtarget

pointer manipulation

syntax description
equ_node Ntarget Nsource copies the pointer from Nsource to Ntarget; Nsource is not changed
equ_doc Dtarget Dsource copies the pointer from Dsource to Dtarget; Dsource is not changed

output and debug functions

syntax description
print_doc Dsource prints the document found in Dsource
print_node Nsource prints node summary for Nsource (not recursive)
print_tree Nsource prints the subtree from Nsource (recursive)
echo string prints string

manual tree traverse

syntax description
root Ntarget Dsource copy the root pointer of Dsource to Ntarget (similar effect as equ_node)
list_child Ntarget if Ntarget is a list the pointer is replaced with the first children of the list, or with NULL
list_next Ntarget if the parent of Ntarget is a list the pointer is replaced with the next brother of Ntarget, or with NULL

lib test: list

syntax description
list_nth Ntarget num if Ntarget is a list the pointer is replaced with the result of lht_tree_list_nth()
list_nthname Ntarget num name if Ntarget is a list the pointer is replaced with the result of lht_tree_list_nthname()
list_del_nth Nlist num the numth child of list Nlist is deleted using lht_tree_list_del_nth(); the result (int) is printed
list_del_nth_name Nlist num name the numth child called name of list Nlist is deleted using lht_tree_list_del_nthname(); the result (int) is printed

lib test: table

syntax description
table_cell Ntarget row col Ntarget is a table which is replaced by the cell at row
table_insert_row Ntarget row insert an empty row at row in Ntarget and print result
table_insert_col Ntarget col insert an empty column at col in Ntarget and print result
table_del_row Ntarget row delete a row at row in Ntarget and print result
table_del_col Ntarget col delete a column at col in Ntarget and print result