# Utilities

This document covers the basic programming utilities that can be used in the client or server to make life easier.

## Container Modules

These modules are generic data object storage modules that might be used wherever convenient. The general rule for freeing memory from these modules is that free methods handles data object generated within the modules whereas user data is for the caller to free. The modules consist of:

Binary Trees
  This is a complete balanced binary tree that might be used for storage and sort of a large number of data objects, e.g. filenames in directory listings etc.
Dynamic Strings
  A Chunk is a block wise expandable array of type (char *) and is a sort of apology for real strings in C. Chunks make it easier to handle dynamic strings of unknown size. It is often faster than using the String Copy Routines.
Linked Lists
  This module provides the functionality for managing a generic list of data objects. The module is implemented as a single linked list using the scheme first in - last out (FILO).
Association Lists
  This is a small module build on top of HTList that provides a way to store Name-Value pairs in an easy way.
Strings
  Routines for dynamic arrays of characters include string copy, case insensitive comparison etc. It also contains functions for generating date and time stamps, MessageID etc.
Atoms
  Atoms are strings which are given representative pointer values so that they can be stored more efficiently, and comparisons for equality done more efficiently. The pointer values are in fact entries into a hash table.

## Basic Utilities

Look into these modules before you start defining system dependent stuff. Most things are already defined here! The list of basic utility modules are currently as follows

System specifics
  The sysdep.h file includes system-specific include files and flags for I/O to network and disk. The only reason for this file is that the Internet world is more complicated than Posix and ANSI.
Platform Independent macros
  The HTUtil.h include file contains things we need everywhere, generally macros for declarations, booleans, etc.