The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

lists.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1993, 1995 Christopher Seiwald.
00003  *
00004  * This file is part of Jam - see jam.c for Copyright information.
00005  */
00006 
00007 /*  This file is ALSO:
00008  *  (C) Copyright David Abrahams 2001. Permission to copy, use,
00009  *  modify, sell and distribute this software is granted provided this
00010  *  copyright notice appears in all copies. This software is provided
00011  *  "as is" without express or implied warranty, and with no claim as
00012  *  to its suitability for any purpose.
00013  */
00014 
00015 /*
00016  * lists.h - the LIST structure and routines to manipulate them
00017  *
00018  * The whole of jam relies on lists of strings as a datatype.  This
00019  * module, in conjunction with newstr.c, handles these relatively
00020  * efficiently.
00021  *
00022  * Structures defined:
00023  *
00024  *      LIST - list of strings
00025  *      LOL - list of LISTs
00026  *
00027  * External routines:
00028  *
00029  *      list_append() - append a list onto another one, returning total
00030  *      list_new() - tack a string onto the end of a list of strings
00031  *      list_copy() - copy a whole list of strings
00032  *      list_sublist() - copy a subset of a list of strings
00033  *      list_free() - free a list of strings
00034  *      list_print() - print a list of strings to stdout
00035  *      list_length() - return the number of items in the list
00036  *
00037  *      lol_init() - initialize a LOL (list of lists)
00038  *      lol_add() - append a LIST onto an LOL
00039  *      lol_free() - free the LOL and its LISTs
00040  *      lol_get() - return one of the LISTs in the LOL
00041  *      lol_print() - debug print LISTS separated by ":"
00042  *
00043  * 04/13/94 (seiwald) - added shorthand L0 for null list pointer
00044  * 08/23/94 (seiwald) - new list_append()
00045  */
00046 
00047 #ifndef LISTS_DWA20011022_H
00048 # define LISTS_DWA20011022_H
00049 
00050 /*
00051  * LIST - list of strings
00052  */
00053 
00054 typedef struct _list LIST;
00055 
00056 struct _list {
00057         LIST    *next;
00058         LIST    *tail;          /* only valid in head node */
00059         char    *string;        /* private copy */
00060 } ;
00061 
00062 /*
00063  * LOL - list of LISTs
00064  */
00065 
00066 typedef struct _lol LOL;
00067 
00068 # define LOL_MAX 9
00069 
00070 struct _lol {
00071         int     count;
00072         LIST    *list[ LOL_MAX ];
00073 } ;
00074 
00075 LIST *  list_append( LIST *l, LIST *nl );
00076 LIST *  list_copy( LIST *l, LIST  *nl );
00077 void    list_free( LIST *head );
00078 LIST *  list_new( LIST *head, char *string );
00079 void    list_print( LIST *l );
00080 int     list_length( LIST *l );
00081 LIST *  list_sublist( LIST *l, int start, int count );
00082 LIST *  list_pop_front( LIST *l );
00083 LIST *  list_sort( LIST *l);
00084 
00085 # define list_next( l ) ((l)->next)
00086 
00087 # define L0 ((LIST *)0)
00088 
00089 void    lol_add( LOL *lol, LIST *l );
00090 void    lol_init( LOL *lol );
00091 void    lol_free( LOL *lol );
00092 LIST *  lol_get( LOL *lol, int i );
00093 void    lol_print( LOL *lol );
00094 
00095 #endif
00096 

Generated on Mon Nov 8 17:07:41 2004 for MPT by  doxygen 1.3.9.1