]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/engine/lists.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / build / src / engine / lists.h
CommitLineData
7c673cae
FG
1/*
2 * Copyright 1993, 1995 Christopher Seiwald.
3 *
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6
7/* This file is ALSO:
8 * Copyright 2001-2004 David Abrahams.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
11 */
12
13/*
14 * lists.h - the LIST structure and routines to manipulate them
15 *
16 * The whole of jam relies on lists of objects as a datatype. This module, in
17 * conjunction with object.c, handles these relatively efficiently.
18 *
19 * Structures defined:
20 *
21 * LIST - list of OBJECTs
22 * LOL - list of LISTs
23 *
24 * External routines:
25 *
26 * list_append() - append a list onto another one, returning total
27 * list_new() - tack an object onto the end of a list of objects
28 * list_copy() - copy a whole list of objects
29 * list_sublist() - copy a subset of a list of objects
30 * list_free() - free a list of objects
31 * list_print() - print a list of objects to stdout
32 * list_length() - return the number of items in the list
33 *
34 * lol_init() - initialize a LOL (list of lists)
35 * lol_add() - append a LIST onto an LOL
36 * lol_free() - free the LOL and its LISTs
37 * lol_get() - return one of the LISTs in the LOL
38 * lol_print() - debug print LISTS separated by ":"
39 */
40
41#ifndef LISTS_DWA20011022_H
42#define LISTS_DWA20011022_H
43
44#include "object.h"
45
46#ifdef HAVE_PYTHON
47# include <Python.h>
48#endif
49
50/*
51 * LIST - list of strings
52 */
53
54typedef struct _list {
55 union {
56 int size;
57 struct _list * next;
58 OBJECT * align;
59 } impl;
60} LIST;
61
62typedef OBJECT * * LISTITER;
63
64/*
65 * LOL - list of LISTs
66 */
67
68#define LOL_MAX 19
69typedef struct _lol {
70 int count;
71 LIST * list[ LOL_MAX ];
72} LOL;
73
74LIST * list_new( OBJECT * value );
75LIST * list_append( LIST * destination, LIST * source );
76LIST * list_copy( LIST * );
77LIST * list_copy_range( LIST * destination, LISTITER first, LISTITER last );
78void list_free( LIST * head );
79LIST * list_push_back( LIST * head, OBJECT * value );
80void list_print( LIST * );
81int list_length( LIST * );
82LIST * list_sublist( LIST *, int start, int count );
83LIST * list_pop_front( LIST * );
84LIST * list_sort( LIST * );
85LIST * list_unique( LIST * sorted_list );
86int list_in( LIST *, OBJECT * value );
87LIST * list_reverse( LIST * );
88int list_cmp( LIST * lhs, LIST * rhs );
89int list_is_sublist( LIST * sub, LIST * l );
90void list_done();
91
92LISTITER list_begin( LIST * );
93LISTITER list_end( LIST * );
94#define list_next( it ) ((it) + 1)
95#define list_item( it ) (*(it))
96#define list_empty( l ) ((l) == L0)
97#define list_front( l ) list_item( list_begin( l ) )
98
99#define L0 ((LIST *)0)
100
101void lol_add( LOL *, LIST * );
102void lol_init( LOL * );
103void lol_free( LOL * );
104LIST * lol_get( LOL *, int i );
105void lol_print( LOL * );
106void lol_build( LOL *, char const * * elements );
107
108#ifdef HAVE_PYTHON
109PyObject * list_to_python( LIST * );
110LIST * list_from_python( PyObject * );
111#endif
112
113#endif