1 /********************************************************************/
2 /*                                                                  */
3 /*  s7   Seed7 interpreter                                          */
4 /*  Copyright (C) 1990 - 2000  Thomas Mertes                        */
5 /*                                                                  */
6 /*  This program is free software; you can redistribute it and/or   */
7 /*  modify it under the terms of the GNU General Public License as  */
8 /*  published by the Free Software Foundation; either version 2 of  */
9 /*  the License, or (at your option) any later version.             */
10 /*                                                                  */
11 /*  This program is distributed in the hope that it will be useful, */
12 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of  */
13 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   */
14 /*  GNU General Public License for more details.                    */
15 /*                                                                  */
16 /*  You should have received a copy of the GNU General Public       */
17 /*  License along with this program; if not, write to the           */
18 /*  Free Software Foundation, Inc., 51 Franklin Street,             */
19 /*  Fifth Floor, Boston, MA  02110-1301, USA.                       */
20 /*                                                                  */
21 /*  Module: General                                                 */
22 /*  File: seed7/src/listutl.h                                       */
23 /*  Changes: 1990, 1991, 1992, 1993, 1994, 2002  Thomas Mertes      */
24 /*  Content: Procedures to maintain objects of type listType.       */
25 /*                                                                  */
26 /********************************************************************/
27 
28 #define append_to_list(insert_place, object, act_param_list) { \
29     listType help_element;                                     \
30     if (ALLOC_L_ELEM(help_element)) {                          \
31       help_element->next = NULL;                               \
32       help_element->obj = object;                              \
33       *insert_place = help_element;                            \
34       insert_place = &help_element->next;                      \
35     } else if (!fail_flag) {                                   \
36       raise_with_arguments(SYS_MEM_EXCEPTION, act_param_list); \
37     } }
38 
39 #if WITH_LIST_FREELIST
40 #define free_list2(list_begin, list_end) { \
41     list_end->next = flist.list_elems;        \
42     flist.list_elems = list_begin;            \
43     }
44 #else
45 #define free_list2(list_begin, list_end) free_list(list_begin)
46 #endif
47 
48 
49 void free_list (listType list);
50 memSizeType list_length (const_listType list);
51 listType *append_element_to_list (listType *list_insert_place, objectType object,
52                                   errInfoType *err_info);
53 objectType copy_expression (objectType object_from, errInfoType *err_info);
54 void free_expression (objectType object);
55 void concat_lists (listType *list1, listType list2);
56 void incl_list (listType *list, objectType element_object,
57                 errInfoType *err_info);
58 void excl_list (listType *list, const_objectType elementobject);
59 void pop_list (listType *list);
60 void replace_list_elem (listType list, const_objectType elem1,
61                         objectType elem2);
62 listType copy_list (const_listType list_from, errInfoType *err_info);
63 listType array_to_list (arrayType arr_from, errInfoType *err_info);
64 listType struct_to_list (structType stru_from, errInfoType *err_info);
65 listType hash_data_to_list (hashType hash, errInfoType *err_info);
66 listType hash_keys_to_list (hashType hash, errInfoType *err_info);
67