* Removed all Id tags.
[cacao.git] / src / toolbox / list.h
index 8e33d6b112c0ce8d9d5d2c32c0369a54ffa5dc17..f84f5e39806621f3beb446ae14408164f6d9f121 100644 (file)
@@ -1,46 +1,40 @@
-/************************** toolbox/list.h *************************************
+/* src/toolbox/list.h - synchronized linked list
 
-       Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
-       See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-       Management of doubly linked lists
+   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
-
-*******************************************************************************/
-
-#ifndef LIST_H
-#define LIST_H
-
-typedef struct listnode {           /* structure for list element */
-       struct listnode *next,*prev;
-       } listnode;
-
-typedef struct list {               /* structure for list head */
-       listnode *first,*last;
-       int nodeoffset;
-       } list;
+   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., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
+*/
 
-void list_init (list *l, int nodeoffset);
 
-void list_addlast (list *l, void *element);
-void list_addfirst (list *l, void *element);
+#ifndef _LIST_H
+#define _LIST_H
 
-void list_remove (list *l, void *element);
-void *list_first (list *l);
-void *list_last (list *l);
+#include "config.h"
+#include "vm/types.h"
 
-void *list_next (list *l, void *element);
-void *list_prev (list *l, void *element);
+#include "vm/global.h"
 
 
-/*
----------------------- interface description -----------------------------
+/* ---------------------- interface description -----------------------------
 
 The list management with this module works like this:
        
@@ -97,4 +91,71 @@ distinct list).
 
 */
 
+/* listnode_t *****************************************************************/
+
+typedef struct listnode_t listnode_t;
+
+struct listnode_t {
+       listnode_t *next;
+       listnode_t *prev;
+};
+
+
+/* list_t *********************************************************************/
+
+typedef struct list_t list_t;
+
+struct list_t {
+#if defined(ENABLE_THREADS)
+       java_object_t      lock;            /* threads lock object                */
 #endif
+       listnode_t        *first;
+       listnode_t        *last;
+       s4                 nodeoffset;
+       s4                 size;            /* number of elements in the list     */
+};
+
+
+/* function prototypes ********************************************************/
+
+list_t *list_create(s4 nodeoffset);
+list_t *list_create_dump(s4 nodeoffset);
+
+void    list_add_first(list_t *l, void *element);
+void    list_add_first_unsynced(list_t *l, void *element);
+
+void    list_add_last(list_t *l, void *element);
+void    list_add_last_unsynced(list_t *l, void *element);
+
+void    list_add_before(list_t *l, void *element, void *newelement);
+
+void    list_remove(list_t *l, void *element);
+void    list_remove_unsynced(list_t *l, void *element);
+
+void   *list_first(list_t *l);
+void   *list_first_unsynced(list_t *l);
+
+void   *list_last(list_t *l);
+void   *list_last_unsynced(list_t *l);
+
+void   *list_next(list_t *l, void *element);
+void   *list_next_unsynced(list_t *l, void *element);
+
+void   *list_prev(list_t *l, void *element);
+void   *list_prev_unsynced(list_t *l, void *element);
+
+#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:
+ */