Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2006 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
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 66... Line 96...
66
#include "solve-cycles.h"
96
#include "solve-cycles.h"
67
 
97
 
68
/*--------------------------------------------------------------------------*/
98
/*--------------------------------------------------------------------------*/
69
 
99
 
70
static void
100
static void
71
shape_control_init PROTO_N ((control))
101
shape_control_init(ShapeControlP control)
72
		   PROTO_T (ShapeControlP control)
-
 
73
{
102
{
74
    control->head = NIL (ShapeControlEntryP);
103
    control->head = NIL(ShapeControlEntryP);
75
}
104
}
76
 
105
 
77
static ShapeControlEntryP
106
static ShapeControlEntryP
78
shape_control_find PROTO_N ((control, shape))
107
shape_control_find(ShapeControlP control,			    CStringP      shape)
79
		   PROTO_T (ShapeControlP control X
-
 
80
			    CStringP      shape)
-
 
81
{
108
{
82
    NStringT           nstring;
109
    NStringT           nstring;
83
    ShapeControlEntryP entry;
110
    ShapeControlEntryP entry;
84
 
111
 
85
    nstring_copy_cstring (&nstring, shape);
112
    nstring_copy_cstring(&nstring, shape);
86
    for (entry = control->head; entry; entry = entry->next) {
113
    for (entry = control->head; entry; entry = entry->next) {
87
	if (nstring_equal (&nstring, &(entry->shape))) {
114
	if (nstring_equal(&nstring, & (entry->shape))) {
88
	    nstring_destroy (&nstring);
115
	    nstring_destroy(&nstring);
89
	    return (entry);
116
	    return(entry);
90
	}
117
	}
91
    }
118
    }
92
    entry             = ALLOCATE (ShapeControlEntryT);
119
    entry             = ALLOCATE(ShapeControlEntryT);
93
    entry->next       = control->head;
120
    entry->next       = control->head;
94
    nstring_assign (&(entry->shape), &nstring);
121
    nstring_assign(& (entry->shape), &nstring);
95
    entry->all        = FALSE;
122
    entry->all        = FALSE;
96
    name_key_list_init (&(entry->names));
123
    name_key_list_init(& (entry->names));
97
    control->head     = entry;
124
    control->head     = entry;
98
    return (entry);
125
    return(entry);
99
}
126
}
100
 
127
 
101
static void
128
static void
102
shape_control_entry_add_name PROTO_N ((entry, name))
129
shape_control_entry_add_name(ShapeControlEntryP entry,				      CStringP           name)
103
			     PROTO_T (ShapeControlEntryP entry X
-
 
104
				      CStringP           name)
-
 
105
{
130
{
106
    NameKeyT key;
131
    NameKeyT key;
107
 
132
 
108
    if (name_key_parse_cstring (&key, name)) {
133
    if (name_key_parse_cstring(&key, name)) {
109
	name_key_list_add (&(entry->names), &key);
134
	name_key_list_add(& (entry->names), &key);
110
    } else {
135
    } else {
111
	E_illegal_external_name (name);
136
	E_illegal_external_name(name);
112
    }
137
    }
113
}
138
}
114
 
139
 
115
static void
140
static void
116
shape_control_entry_set PROTO_N ((entry))
141
shape_control_entry_set(ShapeControlEntryP entry)
117
			PROTO_T (ShapeControlEntryP entry)
-
 
118
{
142
{
119
    entry->all = TRUE;
143
    entry->all = TRUE;
120
}
144
}
121
 
145
 
122
/*--------------------------------------------------------------------------*/
146
/*--------------------------------------------------------------------------*/
123
 
147
 
124
static void
148
static void
125
rename_control_init PROTO_N ((control))
149
rename_control_init(RenameControlP control)
126
		    PROTO_T (RenameControlP control)
-
 
127
{
150
{
128
    control->head = NIL (RenameControlEntryP);
151
    control->head = NIL(RenameControlEntryP);
129
}
152
}
130
 
153
 
131
static RenameControlEntryP
154
static RenameControlEntryP
132
rename_control_find PROTO_N ((control, shape))
155
rename_control_find(RenameControlP control,			     NStringP       shape)
133
		    PROTO_T (RenameControlP control X
-
 
134
			     NStringP       shape)
-
 
135
{
156
{
136
    RenameControlEntryP entry;
157
    RenameControlEntryP entry;
137
 
158
 
138
    for (entry = control->head; entry; entry = entry->next) {
159
    for (entry = control->head; entry; entry = entry->next) {
139
	if (nstring_equal (shape, &(entry->shape))) {
160
	if (nstring_equal(shape, & (entry->shape))) {
140
	    return (entry);
161
	    return(entry);
141
	}
162
	}
142
    }
163
    }
143
    entry             = ALLOCATE (RenameControlEntryT);
164
    entry             = ALLOCATE(RenameControlEntryT);
144
    entry->next       = control->head;
165
    entry->next       = control->head;
145
    nstring_copy (&(entry->shape), shape);
166
    nstring_copy(& (entry->shape), shape);
146
    name_key_pair_list_init (&(entry->names));
167
    name_key_pair_list_init(& (entry->names));
147
    control->head     = entry;
168
    control->head     = entry;
148
    return (entry);
169
    return(entry);
149
}
170
}
150
 
171
 
151
static NameKeyPairListP
172
static NameKeyPairListP
152
rename_control_entry_names PROTO_N ((entry))
173
rename_control_entry_names(RenameControlEntryP entry)
153
			   PROTO_T (RenameControlEntryP entry)
-
 
154
{
174
{
155
    return (&(entry->names));
175
    return(& (entry->names));
156
}
176
}
157
 
177
 
158
static void
178
static void
159
rename_control_entry_parse_pair PROTO_N ((entry, from, to))
179
rename_control_entry_parse_pair(RenameControlEntryP entry,					 CStringP            from ,
160
				PROTO_T (RenameControlEntryP entry X
-
 
161
					 CStringP            from X
-
 
162
					 CStringP            to)
180
					 CStringP            to)
163
{
181
{
164
    NStringP shape = &(entry->shape);
182
    NStringP shape = & (entry->shape);
165
    NameKeyT from_key;
183
    NameKeyT from_key;
166
    NameKeyT to_key;
184
    NameKeyT to_key;
167
 
185
 
168
    if (!name_key_parse_cstring (&from_key, from)) {
186
    if (!name_key_parse_cstring(&from_key, from)) {
169
	E_illegal_external_name (from);
187
	E_illegal_external_name(from);
170
    } else if (!name_key_parse_cstring (&to_key, to)) {
188
    } else if (!name_key_parse_cstring(&to_key, to)) {
171
	E_illegal_external_name (to);
189
	E_illegal_external_name(to);
172
    } else if (!name_key_pair_list_add (&(entry->names), &from_key, &to_key)) {
190
    } else if (!name_key_pair_list_add(& (entry->names), &from_key, &to_key)) {
173
	E_multiply_renamed_name (shape, &from_key);
191
	E_multiply_renamed_name(shape, &from_key);
174
	name_key_destroy (&from_key);
192
	name_key_destroy(&from_key);
175
	name_key_destroy (&to_key);
193
	name_key_destroy(&to_key);
176
    }
194
    }
177
}
195
}
178
 
196
 
179
/*--------------------------------------------------------------------------*/
197
/*--------------------------------------------------------------------------*/
180
 
198
 
181
void
199
void
182
shape_control_iter PROTO_N ((control, proc, closure))
-
 
183
		   PROTO_T (ShapeControlP control X
-
 
184
			    void        (*proc) PROTO_S ((NStringP, BoolT,
200
shape_control_iter(ShapeControlP control,			    void       (*proc)(NStringP, BoolT,
185
							  NameKeyListP,
201
							  NameKeyListP,
186
							  GenericP)) X
202
							  GenericP),
187
			    GenericP      closure)
203
			    GenericP      closure)
188
{
204
{
189
    ShapeControlEntryP entry;
205
    ShapeControlEntryP entry;
190
 
206
 
191
    for (entry = control->head; entry; entry = entry->next) {
207
    for (entry = control->head; entry; entry = entry->next) {
192
	(*proc) (&(entry->shape), entry->all, &(entry->names), closure);
208
	(*proc)(& (entry->shape), entry->all, & (entry->names), closure);
193
    }
209
    }
194
}
210
}
195
 
211
 
196
void
212
void
197
rename_control_iter PROTO_N ((control, proc, closure))
213
rename_control_iter(RenameControlP control,			     void        (*proc)(NStringP,
198
		    PROTO_T (RenameControlP control X
-
 
199
			     void         (*proc) PROTO_S ((NStringP,
-
 
200
							    NameKeyPairListP,
214
							    NameKeyPairListP,
201
							    GenericP)) X
215
							    GenericP),
202
			     GenericP       closure)
216
			     GenericP       closure)
203
{
217
{
204
    RenameControlEntryP entry;
218
    RenameControlEntryP entry;
205
 
219
 
206
    for (entry = control->head; entry; entry = entry->next) {
220
    for (entry = control->head; entry; entry = entry->next) {
207
	(*proc) (&(entry->shape), &(entry->names), closure);
221
	(*proc)(& (entry->shape), & (entry->names), closure);
208
    }
222
    }
209
}
223
}
210
 
224
 
211
/*--------------------------------------------------------------------------*/
225
/*--------------------------------------------------------------------------*/
212
 
226
 
213
void
227
void
214
arg_data_init PROTO_N ((arg_data, default_output_file))
228
arg_data_init(ArgDataP arg_data,		       CStringP default_output_file)
215
	      PROTO_T (ArgDataP arg_data X
-
 
216
		       CStringP default_output_file)
-
 
217
{
229
{
218
    arg_data->all_hide_defined    = FALSE;
230
    arg_data->all_hide_defined    = FALSE;
219
    arg_data->suppress_mult       = FALSE;
231
    arg_data->suppress_mult       = FALSE;
220
    shape_control_init (&(arg_data->hides));
232
    shape_control_init(& (arg_data->hides));
221
    shape_control_init (&(arg_data->keeps));
233
    shape_control_init(& (arg_data->keeps));
222
    shape_control_init (&(arg_data->suppresses));
234
    shape_control_init(& (arg_data->suppresses));
223
    rename_control_init (&(arg_data->renames));
235
    rename_control_init(& (arg_data->renames));
224
    arg_data->extract_all         = FALSE;
236
    arg_data->extract_all         = FALSE;
225
    arg_data->extract_basename    = FALSE;
237
    arg_data->extract_basename    = FALSE;
226
    arg_data->extract_match_base  = FALSE;
238
    arg_data->extract_match_base  = FALSE;
227
    arg_data->content_index       = FALSE;
239
    arg_data->content_index       = FALSE;
228
    arg_data->content_size        = FALSE;
240
    arg_data->content_size        = FALSE;
229
    arg_data->content_version     = FALSE;
241
    arg_data->content_version     = FALSE;
230
    ostream_init (&(arg_data->debug_file));
242
    ostream_init(& (arg_data->debug_file));
231
    arg_data->default_output_file = default_output_file;
243
    arg_data->default_output_file = default_output_file;
232
    arg_data->output_file         = NIL (CStringP);
244
    arg_data->output_file         = NIL(CStringP);
233
    arg_data->num_library_files   = 0;
245
    arg_data->num_library_files   = 0;
234
    arg_data->num_library_paths   = 0;
246
    arg_data->num_library_paths   = 0;
235
    cstring_list_init (&arg_data->library.list.file);
247
    cstring_list_init(&arg_data->library.list.file);
236
    cstring_list_init (&(arg_data->library.list.path));
248
    cstring_list_init(& (arg_data->library.list.path));
237
    arg_data->unit_file           = NIL (CStringP);
249
    arg_data->unit_file           = NIL(CStringP);
238
    arg_data->num_files           = 0;
250
    arg_data->num_files           = 0;
239
}
251
}
240
 
252
 
241
void
253
void
242
arg_data_set_all_hide_defd PROTO_N ((arg_data, enable))
254
arg_data_set_all_hide_defd(ArgDataP arg_data,				    BoolT    enable)
243
			   PROTO_T (ArgDataP arg_data X
-
 
244
				    BoolT    enable)
-
 
245
{
255
{
246
    arg_data->all_hide_defined = enable;
256
    arg_data->all_hide_defined = enable;
247
}
257
}
248
 
258
 
249
BoolT
259
BoolT
250
arg_data_get_all_hide_defd PROTO_N ((arg_data))
260
arg_data_get_all_hide_defd(ArgDataP arg_data)
251
			   PROTO_T (ArgDataP arg_data)
-
 
252
{
261
{
253
    return (arg_data->all_hide_defined);
262
    return(arg_data->all_hide_defined);
254
}
263
}
255
 
264
 
256
void
265
void
257
arg_data_set_suppress_mult PROTO_N ((arg_data, enable))
266
arg_data_set_suppress_mult(ArgDataP arg_data,				    BoolT    enable)
258
			   PROTO_T (ArgDataP arg_data X
-
 
259
				    BoolT    enable)
-
 
260
{
267
{
261
    arg_data->suppress_mult = enable;
268
    arg_data->suppress_mult = enable;
262
}
269
}
263
 
270
 
264
BoolT
271
BoolT
265
arg_data_get_suppress_mult PROTO_N ((arg_data))
272
arg_data_get_suppress_mult(ArgDataP arg_data)
266
			   PROTO_T (ArgDataP arg_data)
-
 
267
{
273
{
268
    return (arg_data->suppress_mult);
274
    return(arg_data->suppress_mult);
269
}
275
}
270
 
276
 
271
void
277
void
272
arg_data_add_hide PROTO_N ((arg_data, shape, name))
278
arg_data_add_hide(ArgDataP arg_data,			   CStringP shape ,
273
		  PROTO_T (ArgDataP arg_data X
-
 
274
			   CStringP shape X
-
 
275
			   CStringP name)
279
			   CStringP name)
276
{
280
{
277
    ShapeControlEntryP entry = shape_control_find (&(arg_data->hides), shape);
281
    ShapeControlEntryP entry = shape_control_find(& (arg_data->hides), shape);
278
 
282
 
279
    shape_control_entry_add_name (entry, name);
283
    shape_control_entry_add_name(entry, name);
280
}
284
}
281
 
285
 
282
void
286
void
283
arg_data_add_hide_defined PROTO_N ((arg_data, shape))
287
arg_data_add_hide_defined(ArgDataP arg_data,				   CStringP shape)
284
			  PROTO_T (ArgDataP arg_data X
-
 
285
				   CStringP shape)
-
 
286
{
288
{
287
    ShapeControlEntryP entry = shape_control_find (&(arg_data->hides), shape);
289
    ShapeControlEntryP entry = shape_control_find(& (arg_data->hides), shape);
288
 
290
 
289
    shape_control_entry_set (entry);
291
    shape_control_entry_set(entry);
290
}
292
}
291
 
293
 
292
ShapeControlP
294
ShapeControlP
293
arg_data_get_hides PROTO_N ((arg_data))
295
arg_data_get_hides(ArgDataP arg_data)
294
		   PROTO_T (ArgDataP arg_data)
-
 
295
{
296
{
296
    return (&(arg_data->hides));
297
    return(& (arg_data->hides));
297
}
298
}
298
 
299
 
299
void
300
void
300
arg_data_add_keep PROTO_N ((arg_data, shape, name))
301
arg_data_add_keep(ArgDataP arg_data,			   CStringP shape ,
301
		  PROTO_T (ArgDataP arg_data X
-
 
302
			   CStringP shape X
-
 
303
			   CStringP name)
302
			   CStringP name)
304
{
303
{
305
    ShapeControlEntryP entry = shape_control_find (&(arg_data->keeps), shape);
304
    ShapeControlEntryP entry = shape_control_find(& (arg_data->keeps), shape);
306
 
305
 
307
    shape_control_entry_add_name (entry, name);
306
    shape_control_entry_add_name(entry, name);
308
}
307
}
309
 
308
 
310
void
309
void
311
arg_data_add_keep_all PROTO_N ((arg_data, shape))
310
arg_data_add_keep_all(ArgDataP arg_data,			       CStringP shape)
312
		      PROTO_T (ArgDataP arg_data X
-
 
313
			       CStringP shape)
-
 
314
{
311
{
315
    ShapeControlEntryP entry = shape_control_find (&(arg_data->keeps), shape);
312
    ShapeControlEntryP entry = shape_control_find(& (arg_data->keeps), shape);
316
 
313
 
317
    shape_control_entry_set (entry);
314
    shape_control_entry_set(entry);
318
}
315
}
319
 
316
 
320
ShapeControlP
317
ShapeControlP
321
arg_data_get_keeps PROTO_N ((arg_data))
318
arg_data_get_keeps(ArgDataP arg_data)
322
		   PROTO_T (ArgDataP arg_data)
-
 
323
{
319
{
324
    return (&(arg_data->keeps));
320
    return(& (arg_data->keeps));
325
}
321
}
326
 
322
 
327
void
323
void
328
arg_data_add_suppress PROTO_N ((arg_data, shape, name))
324
arg_data_add_suppress(ArgDataP arg_data,			       CStringP shape ,
329
		      PROTO_T (ArgDataP arg_data X
-
 
330
			       CStringP shape X
-
 
331
			       CStringP name)
325
			       CStringP name)
332
{
326
{
333
    ShapeControlEntryP entry = shape_control_find (&(arg_data->suppresses),
327
    ShapeControlEntryP entry = shape_control_find(& (arg_data->suppresses),
334
						   shape);
328
						   shape);
335
 
329
 
336
    shape_control_entry_add_name (entry, name);
330
    shape_control_entry_add_name(entry, name);
337
}
331
}
338
 
332
 
339
void
333
void
340
arg_data_add_suppress_all PROTO_N ((arg_data, shape))
334
arg_data_add_suppress_all(ArgDataP arg_data,				   CStringP shape)
341
			  PROTO_T (ArgDataP arg_data X
-
 
342
				   CStringP shape)
-
 
343
{
335
{
344
    ShapeControlEntryP entry = shape_control_find (&(arg_data->suppresses),
336
    ShapeControlEntryP entry = shape_control_find(& (arg_data->suppresses),
345
						   shape);
337
						   shape);
346
 
338
 
347
    shape_control_entry_set (entry);
339
    shape_control_entry_set(entry);
348
}
340
}
349
 
341
 
350
ShapeControlP
342
ShapeControlP
351
arg_data_get_suppresses PROTO_N ((arg_data))
343
arg_data_get_suppresses(ArgDataP arg_data)
352
			PROTO_T (ArgDataP arg_data)
-
 
353
{
344
{
354
    return (&(arg_data->suppresses));
345
    return(& (arg_data->suppresses));
355
}
346
}
356
 
347
 
357
void
348
void
358
arg_data_add_rename PROTO_N ((arg_data, shape, from, to))
349
arg_data_add_rename(ArgDataP arg_data,			     NStringP shape ,
359
		    PROTO_T (ArgDataP arg_data X
-
 
360
			     NStringP shape X
-
 
361
			     NameKeyP from X
350
			     NameKeyP from ,
362
			     NameKeyP to)
351
			     NameKeyP to)
363
{
352
{
364
    RenameControlEntryP entry;
353
    RenameControlEntryP entry;
365
    NameKeyPairListP    names;
354
    NameKeyPairListP    names;
366
 
355
 
367
    entry = rename_control_find (&(arg_data->renames), shape);
356
    entry = rename_control_find(& (arg_data->renames), shape);
368
    names = rename_control_entry_names (entry);
357
    names = rename_control_entry_names(entry);
369
    if (!name_key_pair_list_add (names, from, to)) {
358
    if (!name_key_pair_list_add(names, from, to)) {
370
	E_multiply_renamed_name (shape, from);
359
	E_multiply_renamed_name(shape, from);
371
	name_key_destroy (from);
360
	name_key_destroy(from);
372
	name_key_destroy (to);
361
	name_key_destroy(to);
373
    }
362
    }
374
}
363
}
375
 
364
 
376
void
365
void
377
arg_data_parse_rename PROTO_N ((arg_data, shape, from, to))
366
arg_data_parse_rename(ArgDataP arg_data,			       CStringP shape ,
378
		      PROTO_T (ArgDataP arg_data X
-
 
379
			       CStringP shape X
-
 
380
			       CStringP from X
367
			       CStringP from ,
381
			       CStringP to)
368
			       CStringP to)
382
{
369
{
383
    NStringT            nstring;
370
    NStringT            nstring;
384
    RenameControlEntryP entry;
371
    RenameControlEntryP entry;
385
 
372
 
386
    nstring_copy_cstring (&nstring, shape);
373
    nstring_copy_cstring(&nstring, shape);
387
    entry = rename_control_find (&(arg_data->renames), &nstring);
374
    entry = rename_control_find(& (arg_data->renames), &nstring);
388
    nstring_destroy (&nstring);
375
    nstring_destroy(&nstring);
389
    rename_control_entry_parse_pair (entry, from, to);
376
    rename_control_entry_parse_pair(entry, from, to);
390
}
377
}
391
 
378
 
392
RenameControlP
379
RenameControlP
393
arg_data_get_renames PROTO_N ((arg_data))
380
arg_data_get_renames(ArgDataP arg_data)
394
		     PROTO_T (ArgDataP arg_data)
-
 
395
{
381
{
396
    return (&(arg_data->renames));
382
    return(& (arg_data->renames));
397
}
383
}
398
 
384
 
399
void
385
void
400
arg_data_set_extract_all PROTO_N ((arg_data, enable))
386
arg_data_set_extract_all(ArgDataP arg_data,				  BoolT    enable)
401
			 PROTO_T (ArgDataP arg_data X
-
 
402
				  BoolT    enable)
-
 
403
{
387
{
404
    arg_data->extract_all = enable;
388
    arg_data->extract_all = enable;
405
}
389
}
406
 
390
 
407
BoolT
391
BoolT
408
arg_data_get_extract_all PROTO_N ((arg_data))
392
arg_data_get_extract_all(ArgDataP arg_data)
409
			 PROTO_T (ArgDataP arg_data)
-
 
410
{
393
{
411
    return (arg_data->extract_all);
394
    return(arg_data->extract_all);
412
}
395
}
413
 
396
 
414
void
397
void
415
arg_data_set_extract_basename PROTO_N ((arg_data, enable))
398
arg_data_set_extract_basename(ArgDataP arg_data,				       BoolT    enable)
416
			      PROTO_T (ArgDataP arg_data X
-
 
417
				       BoolT    enable)
-
 
418
{
399
{
419
    arg_data->extract_basename = enable;
400
    arg_data->extract_basename = enable;
420
}
401
}
421
 
402
 
422
BoolT
403
BoolT
423
arg_data_get_extract_basename PROTO_N ((arg_data))
404
arg_data_get_extract_basename(ArgDataP arg_data)
424
			      PROTO_T (ArgDataP arg_data)
-
 
425
{
405
{
426
    return (arg_data->extract_basename);
406
    return(arg_data->extract_basename);
427
}
407
}
428
 
408
 
429
void
409
void
430
arg_data_set_extract_match_base PROTO_N ((arg_data, enable))
410
arg_data_set_extract_match_base(ArgDataP arg_data,					 BoolT    enable)
431
				PROTO_T (ArgDataP arg_data X
-
 
432
					 BoolT    enable)
-
 
433
{
411
{
434
    arg_data->extract_match_base = enable;
412
    arg_data->extract_match_base = enable;
435
}
413
}
436
 
414
 
437
BoolT
415
BoolT
438
arg_data_get_extract_match_base PROTO_N ((arg_data))
416
arg_data_get_extract_match_base(ArgDataP arg_data)
439
				PROTO_T (ArgDataP arg_data)
-
 
440
{
417
{
441
    return (arg_data->extract_match_base);
418
    return(arg_data->extract_match_base);
442
}
419
}
443
 
420
 
444
void
421
void
445
arg_data_set_content_index PROTO_N ((arg_data, enable))
422
arg_data_set_content_index(ArgDataP arg_data,				    BoolT    enable)
446
			   PROTO_T (ArgDataP arg_data X
-
 
447
				    BoolT    enable)
-
 
448
{
423
{
449
    arg_data->content_index = enable;
424
    arg_data->content_index = enable;
450
}
425
}
451
 
426
 
452
BoolT
427
BoolT
453
arg_data_get_content_index PROTO_N ((arg_data))
428
arg_data_get_content_index(ArgDataP arg_data)
454
			   PROTO_T (ArgDataP arg_data)
-
 
455
{
429
{
456
    return (arg_data->content_index);
430
    return(arg_data->content_index);
457
}
431
}
458
 
432
 
459
void
433
void
460
arg_data_set_content_size PROTO_N ((arg_data, enable))
434
arg_data_set_content_size(ArgDataP arg_data,				   BoolT    enable)
461
			  PROTO_T (ArgDataP arg_data X
-
 
462
				   BoolT    enable)
-
 
463
{
435
{
464
    arg_data->content_size = enable;
436
    arg_data->content_size = enable;
465
}
437
}
466
 
438
 
467
BoolT
439
BoolT
468
arg_data_get_content_size PROTO_N ((arg_data))
440
arg_data_get_content_size(ArgDataP arg_data)
469
			  PROTO_T (ArgDataP arg_data)
-
 
470
{
441
{
471
    return (arg_data->content_size);
442
    return(arg_data->content_size);
472
}
443
}
473
 
444
 
474
void
445
void
475
arg_data_set_content_version PROTO_N ((arg_data, enable))
446
arg_data_set_content_version(ArgDataP arg_data,				      BoolT    enable)
476
    			     PROTO_T (ArgDataP arg_data X
-
 
477
				      BoolT    enable)
-
 
478
{
447
{
479
    arg_data->content_version = enable;
448
    arg_data->content_version = enable;
480
}
449
}
481
 
450
 
482
BoolT
451
BoolT
483
arg_data_get_content_version PROTO_N ((arg_data))
452
arg_data_get_content_version(ArgDataP arg_data)
484
    			     PROTO_T (ArgDataP arg_data)
-
 
485
{
453
{
486
    return (arg_data->content_version);
454
    return(arg_data->content_version);
487
}
455
}
488
 
456
 
489
void
457
void
490
arg_data_set_debug_file PROTO_N ((arg_data, debug_file))
458
arg_data_set_debug_file(ArgDataP arg_data,				 CStringP debug_file)
491
			PROTO_T (ArgDataP arg_data X
-
 
492
				 CStringP debug_file)
-
 
493
{
459
{
494
    if (ostream_is_open (&(arg_data->debug_file))) {
460
    if (ostream_is_open(& (arg_data->debug_file))) {
495
	E_tld_multiple_debug_files ();
461
	E_tld_multiple_debug_files();
496
	UNREACHED;
462
	UNREACHED;
497
    }
463
    }
498
    if (!ostream_open (&(arg_data->debug_file), debug_file)) {
464
    if (!ostream_open(& (arg_data->debug_file), debug_file)) {
499
	E_tld_cannot_open_debug_file (debug_file);
465
	E_tld_cannot_open_debug_file(debug_file);
500
	UNREACHED;
466
	UNREACHED;
501
    }
467
    }
502
}
468
}
503
 
469
 
504
OStreamP
470
OStreamP
505
arg_data_get_debug_file PROTO_N ((arg_data))
471
arg_data_get_debug_file(ArgDataP arg_data)
506
			PROTO_T (ArgDataP arg_data)
-
 
507
{
472
{
508
    return (&(arg_data->debug_file));
473
    return(& (arg_data->debug_file));
509
}
474
}
510
 
475
 
511
void
476
void
512
arg_data_set_output_file PROTO_N ((arg_data, output_file))
477
arg_data_set_output_file(ArgDataP arg_data,				  CStringP output_file)
513
			 PROTO_T (ArgDataP arg_data X
-
 
514
				  CStringP output_file)
-
 
515
{
478
{
516
    if (arg_data->output_file) {
479
    if (arg_data->output_file) {
517
	E_tld_multiple_output_files ();
480
	E_tld_multiple_output_files();
518
	UNREACHED;
481
	UNREACHED;
519
    }
482
    }
520
    arg_data->output_file = output_file;
483
    arg_data->output_file = output_file;
521
}
484
}
522
 
485
 
523
CStringP
486
CStringP
524
arg_data_get_output_file PROTO_N ((arg_data))
487
arg_data_get_output_file(ArgDataP arg_data)
525
			 PROTO_T (ArgDataP arg_data)
-
 
526
{
488
{
527
    if (arg_data->output_file) {
489
    if (arg_data->output_file) {
528
	return (arg_data->output_file);
490
	return(arg_data->output_file);
529
    } else {
491
    } else {
530
	return (arg_data->default_output_file);
492
	return(arg_data->default_output_file);
531
    }
493
    }
532
}
494
}
533
 
495
 
534
void
496
void
535
arg_data_add_library_file PROTO_N ((arg_data, library_file))
497
arg_data_add_library_file(ArgDataP arg_data,				   CStringP library_file)
536
			  PROTO_T (ArgDataP arg_data X
-
 
537
				   CStringP library_file)
-
 
538
{
498
{
539
    CStringListP libraries = &(arg_data->library.list.file);
499
    CStringListP libraries = & (arg_data->library.list.file);
540
    if (!cstring_list_contains (libraries, library_file)) {
500
    if (!cstring_list_contains(libraries, library_file)) {
541
	arg_data->num_library_files ++;
501
	arg_data->num_library_files++;
542
	cstring_list_append (libraries, library_file);
502
	cstring_list_append(libraries, library_file);
543
    }
503
    }
544
}
504
}
545
 
505
 
546
void
506
void
547
arg_data_add_library_path PROTO_N ((arg_data, directory))
507
arg_data_add_library_path(ArgDataP arg_data,				   CStringP directory)
548
			  PROTO_T (ArgDataP arg_data X
-
 
549
				   CStringP directory)
-
 
550
{
508
{
551
    arg_data->num_library_paths ++;
509
    arg_data->num_library_paths++;
552
    cstring_list_append (&(arg_data->library.list.path), directory);
510
    cstring_list_append(& (arg_data->library.list.path), directory);
553
}
511
}
554
 
512
 
555
void
513
void
556
arg_data_vector_libraries PROTO_N ((arg_data))
514
arg_data_vector_libraries(ArgDataP arg_data)
557
			  PROTO_T (ArgDataP arg_data)
-
 
558
{
515
{
559
    unsigned          num_files = arg_data->num_library_files;
516
    unsigned          num_files = arg_data->num_library_files;
560
    unsigned          num_paths = arg_data->num_library_paths;
517
    unsigned          num_paths = arg_data->num_library_paths;
561
    CStringP         *files     = ALLOCATE_VECTOR (CStringP, num_files);
518
    CStringP         *files     = ALLOCATE_VECTOR(CStringP, num_files);
562
    CStringP         *paths     = ALLOCATE_VECTOR (CStringP, num_paths);
519
    CStringP         *paths     = ALLOCATE_VECTOR(CStringP, num_paths);
563
    CStringListEntryP entry;
520
    CStringListEntryP entry;
564
    unsigned          i;
521
    unsigned          i;
565
 
522
 
566
    for (i = 0, entry = cstring_list_head (&(arg_data->library.list.file));
523
    for (i = 0, entry = cstring_list_head(& (arg_data->library.list.file));
567
	 i < num_files; i ++, entry = cstring_list_entry_deallocate (entry)) {
524
	 i < num_files; i++, entry = cstring_list_entry_deallocate(entry)) {
568
	files [i] = cstring_list_entry_string (entry);
525
	files[i] = cstring_list_entry_string(entry);
569
    }
526
    }
570
    for (i = 0, entry = cstring_list_head (&(arg_data->library.list.path));
527
    for (i = 0, entry = cstring_list_head(& (arg_data->library.list.path));
571
	 i < num_paths; i ++, entry = cstring_list_entry_deallocate (entry)) {
528
	 i < num_paths; i++, entry = cstring_list_entry_deallocate(entry)) {
572
	paths [i] = cstring_list_entry_string (entry);
529
	paths[i] = cstring_list_entry_string(entry);
573
    }
530
    }
574
    arg_data->library.vector.file = files;
531
    arg_data->library.vector.file = files;
575
    arg_data->library.vector.path = paths;
532
    arg_data->library.vector.path = paths;
576
}
533
}
577
 
534
 
578
unsigned
535
unsigned
579
arg_data_num_library_files PROTO_N ((arg_data))
536
arg_data_num_library_files(ArgDataP arg_data)
580
			   PROTO_T (ArgDataP arg_data)
-
 
581
{
537
{
582
    return (arg_data->num_library_files);
538
    return(arg_data->num_library_files);
583
}
539
}
584
 
540
 
585
unsigned
541
unsigned
586
arg_data_num_library_paths PROTO_N ((arg_data))
542
arg_data_num_library_paths(ArgDataP arg_data)
587
			   PROTO_T (ArgDataP arg_data)
-
 
588
{
543
{
589
    return (arg_data->num_library_paths);
544
    return(arg_data->num_library_paths);
590
}
545
}
591
 
546
 
592
CStringP *
547
CStringP *
593
arg_data_library_files PROTO_N ((arg_data))
548
arg_data_library_files(ArgDataP arg_data)
594
		       PROTO_T (ArgDataP arg_data)
-
 
595
{
549
{
596
    return (arg_data->library.vector.file);
550
    return(arg_data->library.vector.file);
597
}
551
}
598
 
552
 
599
CStringP *
553
CStringP *
600
arg_data_library_paths PROTO_N ((arg_data))
554
arg_data_library_paths(ArgDataP arg_data)
601
		       PROTO_T (ArgDataP arg_data)
-
 
602
{
555
{
603
    return (arg_data->library.vector.path);
556
    return(arg_data->library.vector.path);
604
}
557
}
605
 
558
 
606
void
559
void
607
arg_data_set_unit_file PROTO_N ((arg_data, unit_file))
560
arg_data_set_unit_file(ArgDataP arg_data,				CStringP unit_file)
608
		       PROTO_T (ArgDataP arg_data X
-
 
609
				CStringP unit_file)
-
 
610
{
561
{
611
    if (arg_data->unit_file) {
562
    if (arg_data->unit_file) {
612
	E_tld_multiple_unit_files ();
563
	E_tld_multiple_unit_files();
613
	UNREACHED;
564
	UNREACHED;
614
    }
565
    }
615
    arg_data->unit_file = unit_file;
566
    arg_data->unit_file = unit_file;
616
    capsule_read_unit_set_file (unit_file);
567
    capsule_read_unit_set_file(unit_file);
617
}
568
}
618
 
569
 
619
void
570
void
620
arg_data_set_files PROTO_N ((arg_data, num_files, files))
571
arg_data_set_files(ArgDataP  arg_data,			    int       num_files ,
621
		   PROTO_T (ArgDataP  arg_data X
-
 
622
			    int       num_files X
-
 
623
			    CStringP *files)
572
			    CStringP *files)
624
{
573
{
625
    arg_data->num_files = (unsigned) num_files;
574
    arg_data->num_files = (unsigned)num_files;
626
    arg_data->files     = files;
575
    arg_data->files     = files;
627
}
576
}
628
 
577
 
629
unsigned
578
unsigned
630
arg_data_get_num_files PROTO_N ((arg_data))
579
arg_data_get_num_files(ArgDataP arg_data)
631
		       PROTO_T (ArgDataP arg_data)
-
 
632
{
580
{
633
    return (arg_data->num_files);
581
    return(arg_data->num_files);
634
}
582
}
635
 
583
 
636
CStringP *
584
CStringP *
637
arg_data_get_files PROTO_N ((arg_data))
585
arg_data_get_files(ArgDataP arg_data)
638
		   PROTO_T (ArgDataP arg_data)
-
 
639
{
586
{
640
    return (arg_data->files);
587
    return(arg_data->files);
641
}
588
}
642

589

643
/*
590
/*
644
 * Local variables(smf):
591
 * Local variables(smf):
645
 * eval: (include::add-path-entry "../os-interface" "../library" "../tdf")
592
 * eval: (include::add-path-entry "../os-interface" "../library" "../tdf")