Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
lists.h
Go to the documentation of this file.
1 //
2 // Project: Lhogho
3 // File: lists.h
4 //
5 // Copyright (C) 2007 P.Boytchev
6 //
7 // Revision history:
8 // 2007-06-09 - file created from atoms.h
9 // 2007-08-13 - support for PRINTDEPTHLIMIT, PRINTWIDTHLIMIT
10 // 2007-09-21 - list_copy_n, list_copy_but_last, list_length, get_at_list
11 // 2008-01-17 - extended list atoms
12 // 2008-08-14 - added FLAG_WAS_LIST_CONST
13 //
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; either version 2 of the License, or
18 // (at your option) any later version.
19 //
20 // This program is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with this program; if not, write to the Free Software
27 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 //
29 
30 #ifndef LHOGHO_LISTS_H
31 #define LHOGHO_LISTS_H
32 
33 #include "globals.h"
34 
35 
36 //===================================================
42 //===================================================
43 // @{
44 #define FLAG_NEWLINE 0x0001
45 #define FLAG_AFTER_SPACE 0x0002
46 #define FLAG_BEFORE_SPACE 0x0004
47 #define FLAG_EXPRESSION 0x0008
48 #define FLAG_TOKENIZED_DATA 0x0010
49 #define FLAG_TOKENIZED_COMMANDS 0x0020
50 #define FLAG_EXTENDED_NODE 0x0040
51 #define FLAG_WAS_LIST_CONST 0x0080
52 
53 #define IS_EXPRESSION(a) GET_FLAGS(a,FLAG_EXPRESSION)
54 #define IS_EXTENDED(a) GET_FLAGS(a,FLAG_EXTENDED_NODE)
55 // @}
56 
57 
58 #define CAR(x) ((x)->unode.a[2])
59 #define CDR(x) ((x)->unode.a[3])
60 #define POS(x) (((atom_ex_t)(x))->unode_ex.a[4])
61 #define IS_LIST(x) (ID(x)==LIST_ID)
62 #define IS_EMPTY(a) ((a)==empty_list)
63 #define IS_NOT_EMPTY(a) ((a)!=empty_list)
64 
65 
66 #define CAR_OFFSET 8
67 
68 
69 
70 extern atom_t empty_list;
71 extern int print_width_limit;
72 extern int print_depth_limit;
73 extern atom_t new_list( atom_t car, atom_t cdr );
74 extern atom_t new_list_ex( atom_t car, atom_t cdr );
75 extern void delete_list( atom_t a );
76 extern void dump_list( atom_t a, int level );
77 extern void append( atom_t element, atom_t *first, atom_t *last );
78 extern void append_ex( atom_t element, atom_t *first, atom_t *last );
79 extern atom_t copy_append( atom_t list, atom_t element);
80 extern atom_t behead( atom_t a );
81 extern atom_t list_copy_n( atom_t a, unsigned int n );
82 extern atom_t list_copy_but_last( atom_t a );
83 extern int list_length( atom_t a );
84 extern atom_t get_at_list( atom_t a, int n );
85 #endif //LHOGHO_LISTS_H

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013