First save
[cacao.git] / toolbox / list.h
index 22f7ec061b0f81c9cceea9d17ba536fd3a052007..328e2d8c5bb21cc19a6fe08c9df2012e224f0179 100644 (file)
@@ -1,59 +1,87 @@
-/************************** toolbox/list.h *************************************
+/* toolbox/list.h - 
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Institut f. Computersprachen, TU Wien
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
+   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
+   J. Wenninger
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Verwaltung von doppelt verketteten Listen. 
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-       Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-       Last Change: 1996/10/03
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
 
-*******************************************************************************/
+   Contact: cacao@complang.tuwien.ac.at
 
-typedef struct listnode {           /* Struktur f"ur ein Listenelement */
-       struct listnode *next,*prev;
-       } listnode;
+   Authors: Reinhard Grafl
 
-typedef struct list {               /* Struktur f"ur den Listenkopf */
-       listnode *first,*last;
+   $Id: list.h 684 2003-12-02 16:50:17Z twisti $
+
+*/
+
+
+#ifndef _LIST_H
+#define _LIST_H
+
+typedef struct listnode {           /* structure for list element */
+       struct listnode *next;
+       struct listnode *prev;
+} listnode;
+
+
+typedef struct list {               /* structure for list head */
+       listnode *first;
+       listnode *last;
        int nodeoffset;
-       } list;
+} list;
+
 
+/* function prototypes */
 
-void list_init (list *l, int nodeoffset);
+void list_init(list *l, int nodeoffset);
 
-void list_addlast (list *l, void *element);
-void list_addfirst (list *l, void *element);
+void list_addlast(list *l, void *element);
+void list_addfirst(list *l, void *element);
 
-void list_remove (list *l, void *element);
+void list_remove(list *l, void *element);
  
-void *list_first (list *l);
-void *list_last (list *l);
+void *list_first(list *l);
+void *list_last(list *l);
 
-void *list_next (list *l, void *element);
-void *list_prev (list *l, void *element);
+void *list_next(list *l, void *element);
+void *list_prev(list *l, void *element);
 
 
 /*
----------------------- Schnittstellenbeschreibung -----------------------------
+---------------------- interface description -----------------------------
 
-Die Listenverwaltung mit diesem Modul geht so vor sich:
+The list management with this module works like this:
        
-       - jede Struktur, die in die Liste eingeh"angt werden soll, mu"s 
-         eine Komponente vom Typ 'listnode' haben.
+       - to be used in a list, a structure must have an element of type
+         'listnode'.
          
-       - es mu"s ein Struktur vom Typ 'list' bereitgestellt werden.
+       - there needs to be a structure of type 'list'.
        
-       - die Funktion list_init (l, nodeoffset) initialisiert diese Struktur,
-         dabei gibt der nodeoffset den Offset der 'listnode'-Komponente in
-         den Knotenstrukturen an.
+       - the function list_init(l, nodeoffset) initializes the structure.
+         nodeoffset is the offset of the 'listnode' from the start of the
+         structure in bytes.
          
-       - Einf"ugen, Aush"angen und Suchen von Elementen der Liste geht mit
-         den "ubrigen Funktionen.
+       - The remaining functions provide inserting, removing and searching.
          
-Zum besseren Verst"andnis ein kleines Beispiel:
+This small example aims to demonstrate correct usage:
+
 
 
        void bsp() {
@@ -81,17 +109,31 @@ Zum besseren Verst"andnis ein kleines Beispiel:
        }
        
        
-       Dieses Programm w"urde also folgendes ausgeben:
+       The output from this program should be:
                7
                9
                11
 
 
 
-Der Grund, warum beim Initialisieren der Liste der Offset mitangegeben
-werden mu"s, ist der da"s ein und das selbe Datenelement gleichzeitig
-in verschiedenen Listen eingeh"angt werden kann (f"ur jede Liste mu"s
-also eine Komponente vom Typ 'listnode' im Element enthalten sein).
+The reason for the usage of 'nodeoffset' is that this way, the same node can
+part of different lists (there must be one 'listnode' element for every
+distinct list).
 
 */
 
+#endif /* _LIST_H */
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ */