Crewes Seismic I/O Library File Index. Function Documentation. Functions to access seimic header definitions, страница 2

void * avltr_delete (avltr_tree * tree, const void * item)

Delete an item from a left-threaded AVL tree.

Searches AVL tree TREE for an item matching ITEM. If found, the item is removed from the tree and the actual item found is returned to the caller. If no item matching ITEM exists in the tree, returns NULL.

void avltr_destroy (avltr_tree * tree, avl_node_func free_func)

Destroy tree TREE.

Function FREE_FUNC is called for every node in the tree as it is destroyed.

No effect if the tree has an arena owner and free_func is NULL. The caller owns the arena and must destroy it itself.

Do not attempt to reuse the tree after it has been freed. Create a new one.

void ** avltr_find (const avltr_tree * tree, const void * item)

Search the left-threaded AVL tree for an item.

Search TREE for an item matching ITEM, and return a pointer to it if found.

void ** avltr_find_close (const avltr_tree * tree, const void * item)

Search a left-threaded AVL tree for an item close to a given value.

Search TREE for an item close to the value of ITEM, and return it. This function will return a null pointer only if TREE is empty.


An item close to the one sought, or NULL if the tree is empty.

void avltr_free (avltr_tree * tree)

Free a TREE.

avltr_destroy() (p.pagenum) with FREE_FUNC hardcoded as free().

void * avltr_insert (avltr_tree * tree, void * item)

Inserts ITEM into TREE.

Returns NULL if the item was inserted, otherwise a pointer to the duplicate item.

void ** avltr_next (const avltr_tree * tree, void ** item)

Return the next item in the left-threaded AVL tree.

Given ITEM, a pointer to a data item in TREE (or NULL), returns a pointer to the next item in the tree in comparison order, or NULL if ITEM is the last item.

void ** avltr_probe (avltr_tree * tree, void * item)

Insert an item into a left-threaded AVL tree if no matching item is found.

Search TREE for an item matching ITEM. If found, returns a pointer to the address of the item. If none is found, ITEM is inserted into the tree, and a pointer to the address of ITEM is returned. In either case, the pointer returned can be changed by the caller, or the returned data item can be directly edited, but the key data in the item must not be changed.


The item found, or the a pointer to the newly inserted item.

void * avltr_replace (avltr_tree * tree, void * item)

Replace an item in a left-threaded AVL tree.

If ITEM does not exist in TREE, inserts it and returns NULL. If a matching item does exist, it is replaced by ITEM and the item replaced is returned. The caller is responsible for freeing the item returned.

avltr_tree * avltr_thread (struct avl_tree * _tree)

Threads the unthreaded AVL tree TREE in-place.


TREE cast to avltr_tree (p.pagenum) (a threaded tree)

void * avltr_traverse (const avltr_tree * tree, avltr_traverser * trav)

Traverse a left threaded AVL tree.

Each call to this function for a given TREE and TRAV return the next item in the tree in inorder. Initialize the first element of TRAV (init) to 0 before calling the first time.


Next item in the tree in 'inorder'. NULL when out of elements.

struct avl_tree * avltr_unthread (avltr_tree * tree)

Unthreads the threaded tree TREE in-place.


An unthreded TREE cast to an avl_tree.

void avltr_walk (const avltr_tree * tree, avl_node_func walk_func, void * param)

Walk tree TREE in inorder, calling WALK_FUNC at each node.


tree   The tree

walk_func   Function to be called at each node along our path.

param   parameters for the walk_func function

Variable Documentation

void * avltr_force_delete

Delete ITEM from TREE when you know that ITEM must be in TREE.

For debugging purposes.

seisio.c File Reference

seisio File object.

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include "seisio.h"