2 |
7u83 |
1 |
/*
|
7 |
7u83 |
2 |
* Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
*
|
|
|
5 |
* Redistribution and use in source and binary forms, with or without
|
|
|
6 |
* modification, are permitted provided that the following conditions are met:
|
|
|
7 |
*
|
|
|
8 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
9 |
* this list of conditions and the following disclaimer.
|
|
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
11 |
* this list of conditions and the following disclaimer in the documentation
|
|
|
12 |
* and/or other materials provided with the distribution.
|
|
|
13 |
* 3. Neither the name of The TenDRA Project nor the names of its contributors
|
|
|
14 |
* may be used to endorse or promote products derived from this software
|
|
|
15 |
* without specific, prior written permission.
|
|
|
16 |
*
|
|
|
17 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
|
|
18 |
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
19 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
|
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
22 |
* EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
23 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
24 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
25 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
26 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
27 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
28 |
*
|
|
|
29 |
* $Id$
|
|
|
30 |
*/
|
|
|
31 |
/*
|
2 |
7u83 |
32 |
Crown Copyright (c) 1997
|
7 |
7u83 |
33 |
|
2 |
7u83 |
34 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
35 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
36 |
acting through the Defence Evaluation and Research Agency
|
|
|
37 |
(DERA). It is made available to Recipients with a
|
|
|
38 |
royalty-free licence for its use, reproduction, transfer
|
|
|
39 |
to other parties and amendment for any purpose not excluding
|
|
|
40 |
product development provided that any such use et cetera
|
|
|
41 |
shall be deemed to be acceptance of the following conditions:-
|
7 |
7u83 |
42 |
|
2 |
7u83 |
43 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
44 |
reproduced upon any copies or amended versions of it;
|
7 |
7u83 |
45 |
|
2 |
7u83 |
46 |
(2) Any amended version of it shall be clearly marked to
|
|
|
47 |
show both the nature of and the organisation responsible
|
|
|
48 |
for the relevant amendment or amendments;
|
7 |
7u83 |
49 |
|
2 |
7u83 |
50 |
(3) Its onward transfer from a recipient to another
|
|
|
51 |
party shall be deemed to be that party's acceptance of
|
|
|
52 |
these conditions;
|
7 |
7u83 |
53 |
|
2 |
7u83 |
54 |
(4) DERA gives no warranty or assurance as to its
|
|
|
55 |
quality or suitability for any purpose and DERA accepts
|
|
|
56 |
no liability whatsoever in relation to any use to which
|
|
|
57 |
it may be put.
|
|
|
58 |
*/
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/**** cstring-list.h --- String list ADT.
|
|
|
62 |
*
|
|
|
63 |
** Author: Steve Folkes <smf@hermes.mod.uk>
|
|
|
64 |
*
|
|
|
65 |
**** Commentary:
|
|
|
66 |
*
|
|
|
67 |
***=== INTRODUCTION =========================================================
|
|
|
68 |
*
|
|
|
69 |
* This file specifies the interface to a string list facility. This
|
|
|
70 |
* particular facility allows lists of cstrings (defined in the files
|
|
|
71 |
* "cstring.[ch]") to be created.
|
|
|
72 |
*
|
|
|
73 |
***=== TYPES ================================================================
|
|
|
74 |
*
|
|
|
75 |
** Type: CStringListEntryT
|
|
|
76 |
** Type: CStringListEntryP
|
|
|
77 |
** Repr: <private>
|
|
|
78 |
*
|
|
|
79 |
* This is the cstring list entry type.
|
|
|
80 |
*
|
|
|
81 |
** Type: CStringListT
|
|
|
82 |
** Type: CStringListP
|
|
|
83 |
** Repr: <private>
|
|
|
84 |
*
|
|
|
85 |
* This is the cstring list type.
|
|
|
86 |
*
|
|
|
87 |
***=== FUNCTIONS ============================================================
|
|
|
88 |
*
|
|
|
89 |
** Function: void cstring_list_init
|
7 |
7u83 |
90 |
* (CStringListP list)
|
2 |
7u83 |
91 |
** Exceptions:
|
|
|
92 |
*
|
|
|
93 |
* This function initialises the specified cstring list to be an empty list.
|
|
|
94 |
*
|
|
|
95 |
** Function: void cstring_list_append
|
7 |
7u83 |
96 |
* (CStringListP list, CStringP cstring)
|
2 |
7u83 |
97 |
** Exceptions: XX_dalloc_no_memory
|
|
|
98 |
*
|
|
|
99 |
* This function appends the specified cstring onto the specified list.
|
|
|
100 |
*
|
|
|
101 |
** Function: CStringListEntryP cstring_list_head
|
7 |
7u83 |
102 |
* (CStringListP list)
|
2 |
7u83 |
103 |
** Exceptions:
|
|
|
104 |
*
|
|
|
105 |
* This function returns a pointer to the first entry in the specified list.
|
|
|
106 |
*
|
|
|
107 |
** Function: CStringP cstring_list_entry_string
|
7 |
7u83 |
108 |
* (CStringListEntryP entry)
|
2 |
7u83 |
109 |
** Exceptions:
|
|
|
110 |
*
|
|
|
111 |
* This function returns a pointer to the cstring stored in the specified
|
|
|
112 |
* list entry.
|
|
|
113 |
*
|
|
|
114 |
** Function: CStringListEntryP cstring_list_entry_deallocate
|
7 |
7u83 |
115 |
* (CStringListEntryP entry)
|
2 |
7u83 |
116 |
** Exceptions:
|
|
|
117 |
*
|
|
|
118 |
* This function deallocates the specified list entry (without deallocating
|
|
|
119 |
* the string - this must be done by the calling function) and returns a
|
|
|
120 |
* pointer to the next entry in the list. Once this function has been called,
|
|
|
121 |
* the state of the list that the entry is a member of is undefined. It is
|
|
|
122 |
* only useful for deallocating the entire list in a loop.
|
|
|
123 |
*
|
|
|
124 |
**** Change log:
|
|
|
125 |
* $Log: cstring-list.h,v $
|
|
|
126 |
* Revision 1.1.1.1 1998/01/17 15:57:45 release
|
|
|
127 |
* First version to be checked into rolling release.
|
|
|
128 |
*
|
|
|
129 |
* Revision 1.2 1994/12/12 11:44:32 smf
|
|
|
130 |
* Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
|
|
|
131 |
* OSSG C Coding Standards.
|
|
|
132 |
*
|
|
|
133 |
* Revision 1.1.1.1 1994/07/25 16:05:48 smf
|
|
|
134 |
* Initial import of library shared files.
|
|
|
135 |
*
|
|
|
136 |
**/
|
|
|
137 |
|
|
|
138 |
/****************************************************************************/
|
|
|
139 |
|
|
|
140 |
#ifndef H_CSTRING_LIST
|
|
|
141 |
#define H_CSTRING_LIST
|
|
|
142 |
|
|
|
143 |
#include "os-interface.h"
|
|
|
144 |
#include "cstring.h"
|
|
|
145 |
#include "dalloc.h"
|
|
|
146 |
|
|
|
147 |
/*--------------------------------------------------------------------------*/
|
|
|
148 |
|
|
|
149 |
typedef struct CStringListEntryT {
|
|
|
150 |
struct CStringListEntryT *next;
|
|
|
151 |
CStringP string;
|
|
|
152 |
} CStringListEntryT, *CStringListEntryP;
|
|
|
153 |
|
|
|
154 |
typedef struct CStringListT {
|
|
|
155 |
CStringListEntryP head;
|
|
|
156 |
CStringListEntryP *tail;
|
|
|
157 |
} CStringListT, *CStringListP;
|
|
|
158 |
|
|
|
159 |
/*--------------------------------------------------------------------------*/
|
|
|
160 |
|
7 |
7u83 |
161 |
extern void cstring_list_init(CStringListP);
|
|
|
162 |
extern void cstring_list_append(CStringListP, CStringP);
|
|
|
163 |
extern CStringListEntryP cstring_list_head(CStringListP);
|
|
|
164 |
extern CStringP cstring_list_entry_string(CStringListEntryP);
|
|
|
165 |
extern CStringListEntryP cstring_list_entry_deallocate(CStringListEntryP);
|
2 |
7u83 |
166 |
|
|
|
167 |
#endif /* !defined (H_CSTRING_LIST) */
|
|
|
168 |
|
|
|
169 |
/*
|
|
|
170 |
* Local variables(smf):
|
|
|
171 |
* eval: (include::add-path-entry "../os-interface" "../generated")
|
|
|
172 |
* end:
|
|
|
173 |
**/
|