Subversion Repositories tendra.SVN

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
6 7u83 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
6 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:-
6 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
6 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;
6 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;
6 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
/**** debug.c --- Debugging routines.
62
 *
63
 ** Author: Steve Folkes <smf@hermes.mod.uk>
64
 *
65
 **** Commentary:
66
 *
67
 * This file implements the tracing routines for use with the TDF linker.
68
 *
69
 **** Change Log:
70
 * $Log: debug.c,v $
71
 * Revision 1.1.1.1  1998/01/17  15:57:18  release
72
 * First version to be checked into rolling release.
73
 *
74
 * Revision 1.4  1995/09/22  08:39:15  smf
75
 * Fixed problems with incomplete structures (to shut "tcc" up).
76
 * Fixed some problems in "name-key.c" (no real problems, but rewritten to
77
 * reduce the warnings that were output by "tcc" and "gcc").
78
 * Fixed bug CR95_354.tld-common-id-problem (library capsules could be loaded
79
 * more than once).
80
 *
81
 * Revision 1.3  1995/07/07  15:32:22  smf
82
 * Updated to support TDF specification 4.0.
83
 *
84
 * Revision 1.2  1994/12/12  11:46:18  smf
85
 * Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
86
 * OSSG C Coding Standards.
87
 *
88
 * Revision 1.1.1.1  1994/07/25  16:03:31  smf
89
 * Initial import of TDF linker 3.5 non shared files.
90
 *
91
**/
92
 
93
/****************************************************************************/
94
 
95
#include "debug.h"
96
#include "tdf.h"
97
 
98
#include "solve-cycles.h"
99
 
100
/*--------------------------------------------------------------------------*/
101
 
6 7u83 102
static OStreamP	debug_file   = NIL(OStreamP);
2 7u83 103
 
104
/*--------------------------------------------------------------------------*/
105
 
106
void
6 7u83 107
debug_set_file(OStreamP file)
2 7u83 108
{
6 7u83 109
    if (ostream_is_open(file)) {
2 7u83 110
	debug_file = file;
111
    } else {
6 7u83 112
	debug_file = NIL(OStreamP);
2 7u83 113
    }
114
}
115
 
116
/*--------------------------------------------------------------------------*/
117
 
118
void
6 7u83 119
debug_info_u_name(NStringP name)
2 7u83 120
{
121
    if (debug_file) {
6 7u83 122
	write_cstring(debug_file, "Using unit set name '");
123
	write_nstring(debug_file, name);
124
	write_char(debug_file, '\'');
125
	write_newline(debug_file);
2 7u83 126
    }
127
}
128
 
129
/*--------------------------------------------------------------------------*/
130
 
131
void
6 7u83 132
debug_info_r_start_capsule(CStringP name)
2 7u83 133
{
134
    if (debug_file) {
6 7u83 135
	write_cstring(debug_file, "Reading capsule '");
136
	write_cstring(debug_file, name);
137
	write_cstring(debug_file, "':");
138
	write_newline(debug_file);
2 7u83 139
    }
140
}
141
 
142
void
6 7u83 143
debug_info_r_versions(unsigned major, unsigned minor)
2 7u83 144
{
145
    if (debug_file) {
6 7u83 146
	write_cstring (debug_file, "  Read major version: ");
147
	write_unsigned(debug_file, major);
148
	write_cstring (debug_file, "; minor version:");
149
	write_unsigned(debug_file, minor);
150
	write_newline (debug_file);
2 7u83 151
    }
152
}
153
 
154
void
6 7u83 155
debug_info_r_start_unit_decs(unsigned num_unit_sets)
2 7u83 156
{
157
    if (debug_file) {
6 7u83 158
	write_cstring(debug_file, "  Reading ");
159
	write_unsigned(debug_file, num_unit_sets);
160
	write_cstring(debug_file, " unit set names:");
161
	write_newline(debug_file);
2 7u83 162
    }
163
}
164
 
165
void
6 7u83 166
debug_info_r_unit_dec(NStringP name)
2 7u83 167
{
168
    if (debug_file) {
6 7u83 169
	write_cstring(debug_file, "    ");
170
	write_nstring(debug_file, name);
171
	write_newline(debug_file);
2 7u83 172
    }
173
}
174
 
175
void
6 7u83 176
debug_info_r_start_shapes(unsigned num_shapes)
2 7u83 177
{
178
    if (debug_file) {
6 7u83 179
	write_cstring(debug_file, "  Reading ");
180
	write_unsigned(debug_file, num_shapes);
181
	write_cstring(debug_file, " shape names:");
182
	write_newline(debug_file);
2 7u83 183
    }
184
}
185
 
186
void
6 7u83 187
debug_info_r_shape(NStringP name,			    unsigned num_ids)
2 7u83 188
{
189
    if (debug_file) {
6 7u83 190
	write_cstring(debug_file, "    ");
191
	write_nstring(debug_file, name);
192
	write_cstring(debug_file, ", ");
193
	write_unsigned(debug_file, num_ids);
194
	write_newline(debug_file);
2 7u83 195
    }
196
}
197
 
198
void
6 7u83 199
debug_info_r_start_names(unsigned num_names)
2 7u83 200
{
201
    if (debug_file) {
6 7u83 202
	write_cstring(debug_file, "  Reading ");
203
	write_unsigned(debug_file, num_names);
204
	write_cstring(debug_file, " external name categories:");
205
	write_newline(debug_file);
2 7u83 206
    }
207
}
208
 
209
void
6 7u83 210
debug_info_r_start_shape_names(NStringP shape,					unsigned num_names)
2 7u83 211
{
212
    if (debug_file) {
6 7u83 213
	write_cstring(debug_file, "    Reading ");
214
	write_unsigned(debug_file, num_names);
215
	write_cstring(debug_file, " external ");
216
	write_nstring(debug_file, shape);
217
	write_cstring(debug_file, " names:");
218
	write_newline(debug_file);
2 7u83 219
    }
220
}
221
 
222
void
6 7u83 223
debug_info_r_name(NameKeyP name,			   unsigned old_id, 
224
			   unsigned new_id, 
2 7u83 225
			   NameKeyP key)
226
{
227
    if (debug_file) {
6 7u83 228
	write_cstring(debug_file, "      ");
229
	write_name_key(debug_file, name);
230
	write_cstring(debug_file, ", ");
231
	write_unsigned(debug_file, old_id);
232
	write_cstring(debug_file, " -> ");
233
	write_unsigned(debug_file, new_id);
234
	write_cstring(debug_file, " (");
235
	write_name_key(debug_file, key);
236
	write_char(debug_file, ')');
237
	write_newline(debug_file);
2 7u83 238
    }
239
}
240
 
241
void
6 7u83 242
debug_info_r_start_unit_sets(unsigned num_unit_sets)
2 7u83 243
{
244
    if (debug_file) {
6 7u83 245
	write_cstring(debug_file, "  Reading ");
246
	write_unsigned(debug_file, num_unit_sets);
247
	write_cstring(debug_file, " unit sets:");
248
	write_newline(debug_file);
2 7u83 249
    }
250
}
251
 
252
void
6 7u83 253
debug_info_r_start_units(NStringP unit_set,				  unsigned num_units)
2 7u83 254
{
255
    if (debug_file) {
6 7u83 256
	write_cstring(debug_file, "    Reading ");
257
	write_unsigned(debug_file, num_units);
258
	write_char(debug_file, ' ');
259
	write_nstring(debug_file, unit_set);
260
	write_cstring(debug_file, " units:");
261
	write_newline(debug_file);
2 7u83 262
    }
263
}
264
 
265
void
6 7u83 266
debug_info_r_start_unit(NStringP unit_set,				 unsigned unit, 
2 7u83 267
				 unsigned num_units)
268
{
269
    if (debug_file) {
6 7u83 270
	write_cstring(debug_file, "      Reading ");
271
	write_nstring(debug_file, unit_set);
272
	write_cstring(debug_file, " unit ");
273
	write_unsigned(debug_file, unit);
274
	write_cstring(debug_file, " of ");
275
	write_unsigned(debug_file, num_units);
276
	write_char(debug_file, ':');
277
	write_newline(debug_file);
2 7u83 278
    }
279
}
280
 
281
void
6 7u83 282
debug_info_r_start_counts(unsigned num_counts)
2 7u83 283
{
284
    if (debug_file) {
6 7u83 285
	write_cstring(debug_file, "        Reading ");
286
	write_unsigned(debug_file, num_counts);
287
	write_cstring(debug_file, " counts:");
288
	write_newline(debug_file);
2 7u83 289
    }
290
}
291
 
292
void
6 7u83 293
debug_info_r_count(unsigned count,			    NStringP shape)
2 7u83 294
{
295
    if (debug_file) {
6 7u83 296
	write_cstring(debug_file, "          ");
297
	write_unsigned(debug_file, count);
298
	write_cstring(debug_file, " (");
299
	write_nstring(debug_file, shape);
300
	write_char(debug_file, ')');
301
	write_newline(debug_file);
2 7u83 302
    }
303
}
304
 
305
void
6 7u83 306
debug_info_r_start_maps(unsigned num_maps)
2 7u83 307
{
308
    if (debug_file) {
6 7u83 309
	write_cstring(debug_file, "        Reading ");
310
	write_unsigned(debug_file, num_maps);
311
	write_cstring(debug_file, " mapping categories:");
312
	write_newline(debug_file);
2 7u83 313
    }
314
}
315
 
316
void
6 7u83 317
debug_info_r_start_shape_maps(NStringP shape,				       unsigned num_maps)
2 7u83 318
{
319
    if (debug_file) {
6 7u83 320
	write_cstring(debug_file, "          Reading ");
321
	write_unsigned(debug_file, num_maps);
322
	write_char(debug_file, ' ');
323
	write_nstring(debug_file, shape);
324
	write_cstring(debug_file, " mappings:");
325
	write_newline(debug_file);
2 7u83 326
    }
327
}
328
 
329
void
6 7u83 330
debug_info_r_map(unsigned internal,			  unsigned old_external, 
2 7u83 331
			  unsigned new_external)
332
{
333
    if (debug_file) {
6 7u83 334
	write_cstring(debug_file, "            ");
335
	write_unsigned(debug_file, internal);
336
	write_cstring(debug_file, ", ");
337
	write_unsigned(debug_file, old_external);
338
	write_cstring(debug_file, " -> ");
339
	write_unsigned(debug_file, new_external);
340
	write_newline(debug_file);
2 7u83 341
    }
342
}
343
 
344
void
6 7u83 345
debug_info_r_unit_body(unsigned size)
2 7u83 346
{
347
    if (debug_file) {
6 7u83 348
	write_cstring(debug_file, "        Reading ");
349
	write_unsigned(debug_file, size);
350
	write_cstring(debug_file, " bytes of unit body");
351
	write_newline(debug_file);
2 7u83 352
    }
353
}
354
 
355
void
6 7u83 356
debug_info_r_tld_version(unsigned version)
2 7u83 357
{
358
    if (debug_file) {
6 7u83 359
	write_cstring(debug_file, "          Reading version ");
360
	write_unsigned(debug_file, version);
361
	write_cstring(debug_file, " linker information unit:");
362
	write_newline(debug_file);
2 7u83 363
    }
364
}
365
 
366
void
6 7u83 367
debug_info_r_start_usages(NStringP shape,				   unsigned num_names)
2 7u83 368
{
369
    if (debug_file) {
6 7u83 370
	write_cstring(debug_file, "            Reading ");
371
	write_unsigned(debug_file, num_names);
372
	write_cstring(debug_file, " external ");
373
	write_nstring(debug_file, shape);
374
	write_cstring(debug_file, " name usages:");
375
	write_newline(debug_file);
2 7u83 376
    }
377
}
378
 
379
void
6 7u83 380
debug_info_r_usage(unsigned use,			    unsigned name_use, 
2 7u83 381
			    NameKeyP key)
382
{
383
    if (debug_file) {
6 7u83 384
	write_cstring(debug_file, "              ");
385
	write_usage(debug_file, use);
386
	write_cstring(debug_file, " (");
387
	write_name_key(debug_file, key);
388
	write_cstring(debug_file, ", ");
389
	write_usage(debug_file, name_use);
390
	write_char(debug_file, ')');
391
	write_newline(debug_file);
2 7u83 392
    }
393
}
394
 
395
void
6 7u83 396
debug_info_r_end_capsule(void)
2 7u83 397
{
398
    if (debug_file) {
6 7u83 399
	write_cstring(debug_file, "Finished reading capsule");
400
	write_newline(debug_file);
2 7u83 401
    }
402
}
403
 
404
void
6 7u83 405
debug_info_r_abort_capsule(void)
2 7u83 406
{
407
    if (debug_file) {
6 7u83 408
	write_cstring(debug_file, "Aborted reading capsule");
409
	write_newline(debug_file);
2 7u83 410
    }
411
}
412
 
413
/*--------------------------------------------------------------------------*/
414
 
415
void
6 7u83 416
debug_info_w_start_capsule(CStringP name)
2 7u83 417
{
418
    if (debug_file) {
6 7u83 419
	write_cstring(debug_file, "Writing capsule '");
420
	write_cstring(debug_file, name);
421
	write_cstring(debug_file, "':");
422
	write_newline(debug_file);
2 7u83 423
    }
424
}
425
 
426
void
6 7u83 427
debug_info_w_versions(unsigned major, unsigned minor)
2 7u83 428
{
429
    if (debug_file) {
6 7u83 430
	write_cstring (debug_file, "  Writing major version: ");
431
	write_unsigned(debug_file, major);
432
	write_cstring (debug_file, "; minor version:");
433
	write_unsigned(debug_file, minor);
434
	write_newline (debug_file);
2 7u83 435
    }
436
}
437
 
438
void
6 7u83 439
debug_info_w_start_unit_decs(unsigned num_unit_sets)
2 7u83 440
{
441
    if (debug_file) {
6 7u83 442
	write_cstring(debug_file, "  Writing ");
443
	write_unsigned(debug_file, num_unit_sets);
444
	write_cstring(debug_file, " unit set names:");
445
	write_newline(debug_file);
2 7u83 446
    }
447
}
448
 
449
void
6 7u83 450
debug_info_w_unit_dec(NStringP name)
2 7u83 451
{
452
    if (debug_file) {
6 7u83 453
	write_cstring(debug_file, "    ");
454
	write_nstring(debug_file, name);
455
	write_newline(debug_file);
2 7u83 456
    }
457
}
458
 
459
void
6 7u83 460
debug_info_w_start_shapes(unsigned num_shapes)
2 7u83 461
{
462
    if (debug_file) {
6 7u83 463
	write_cstring(debug_file, "  Writing ");
464
	write_unsigned(debug_file, num_shapes);
465
	write_cstring(debug_file, " shape names:");
466
	write_newline(debug_file);
2 7u83 467
    }
468
}
469
 
470
void
6 7u83 471
debug_info_w_shape(NStringP name,			    unsigned num_ids)
2 7u83 472
{
473
    if (debug_file) {
6 7u83 474
	write_cstring(debug_file, "    ");
475
	write_nstring(debug_file, name);
476
	write_cstring(debug_file, ", ");
477
	write_unsigned(debug_file, num_ids);
478
	write_newline(debug_file);
2 7u83 479
    }
480
}
481
 
482
void
6 7u83 483
debug_info_w_start_names(unsigned num_names)
2 7u83 484
{
485
    if (debug_file) {
6 7u83 486
	write_cstring(debug_file, "  Writing ");
487
	write_unsigned(debug_file, num_names);
488
	write_cstring(debug_file, " external name categories:");
489
	write_newline(debug_file);
2 7u83 490
    }
491
}
492
 
493
void
6 7u83 494
debug_info_w_start_shape_names(NStringP shape,					unsigned num_names)
2 7u83 495
{
496
    if (debug_file) {
6 7u83 497
	write_cstring(debug_file, "    Writing ");
498
	write_unsigned(debug_file, num_names);
499
	write_cstring(debug_file, " external ");
500
	write_nstring(debug_file, shape);
501
	write_cstring(debug_file, " names:");
502
	write_newline(debug_file);
2 7u83 503
    }
504
}
505
 
506
void
6 7u83 507
debug_info_w_name(NameKeyP name,			   unsigned id)
2 7u83 508
{
509
    if (debug_file) {
6 7u83 510
	write_cstring(debug_file, "      ");
511
	write_name_key(debug_file, name);
512
	write_cstring(debug_file, ", ");
513
	write_unsigned(debug_file, id);
514
	write_newline(debug_file);
2 7u83 515
    }
516
}
517
 
518
void
6 7u83 519
debug_info_w_start_unit_sets(unsigned num_unit_sets)
2 7u83 520
{
521
    if (debug_file) {
6 7u83 522
	write_cstring(debug_file, "  Writing ");
523
	write_unsigned(debug_file, num_unit_sets);
524
	write_cstring(debug_file, " unit sets:");
525
	write_newline(debug_file);
2 7u83 526
    }
527
}
528
 
529
void
6 7u83 530
debug_info_w_start_units(NStringP unit_set,				  unsigned num_units)
2 7u83 531
{
532
    if (debug_file) {
6 7u83 533
	write_cstring(debug_file, "    Writing ");
534
	write_unsigned(debug_file, num_units);
535
	write_char(debug_file, ' ');
536
	write_nstring(debug_file, unit_set);
537
	write_cstring(debug_file, " units:");
538
	write_newline(debug_file);
2 7u83 539
    }
540
}
541
 
542
void
6 7u83 543
debug_info_w_start_unit(NStringP unit_set,				 unsigned unit, 
2 7u83 544
				 unsigned num_units)
545
{
546
    if (debug_file) {
6 7u83 547
	write_cstring(debug_file, "      Writing ");
548
	write_nstring(debug_file, unit_set);
549
	write_cstring(debug_file, " unit ");
550
	write_unsigned(debug_file, unit);
551
	write_cstring(debug_file, " of ");
552
	write_unsigned(debug_file, num_units);
553
	write_char(debug_file, ':');
554
	write_newline(debug_file);
2 7u83 555
    }
556
}
557
 
558
void
6 7u83 559
debug_info_w_start_counts(unsigned num_counts)
2 7u83 560
{
561
    if (debug_file) {
6 7u83 562
	write_cstring(debug_file, "        Writing ");
563
	write_unsigned(debug_file, num_counts);
564
	write_cstring(debug_file, " counts:");
565
	write_newline(debug_file);
2 7u83 566
    }
567
}
568
 
569
void
6 7u83 570
debug_info_w_count(unsigned count,			    NStringP shape)
2 7u83 571
{
572
    if (debug_file) {
6 7u83 573
	write_cstring(debug_file, "          ");
574
	write_unsigned(debug_file, count);
575
	write_cstring(debug_file, " (");
576
	write_nstring(debug_file, shape);
577
	write_char(debug_file, ')');
578
	write_newline(debug_file);
2 7u83 579
    }
580
}
581
 
582
void
6 7u83 583
debug_info_w_start_maps(unsigned num_maps)
2 7u83 584
{
585
    if (debug_file) {
6 7u83 586
	write_cstring(debug_file, "        Writing ");
587
	write_unsigned(debug_file, num_maps);
588
	write_cstring(debug_file, " mapping categories:");
589
	write_newline(debug_file);
2 7u83 590
    }
591
}
592
 
593
void
6 7u83 594
debug_info_w_start_shape_maps(NStringP shape,				       unsigned num_maps)
2 7u83 595
{
596
    if (debug_file) {
6 7u83 597
	write_cstring(debug_file, "          Writing ");
598
	write_unsigned(debug_file, num_maps);
599
	write_char(debug_file, ' ');
600
	write_nstring(debug_file, shape);
601
	write_cstring(debug_file, " mappings:");
602
	write_newline(debug_file);
2 7u83 603
    }
604
}
605
 
606
void
6 7u83 607
debug_info_w_map(unsigned internal,			  unsigned external)
2 7u83 608
{
609
    if (debug_file) {
6 7u83 610
	write_cstring(debug_file, "            ");
611
	write_unsigned(debug_file, internal);
612
	write_cstring(debug_file, ", ");
613
	write_unsigned(debug_file, external);
614
	write_newline(debug_file);
2 7u83 615
    }
616
}
617
 
618
void
6 7u83 619
debug_info_w_unit_body(unsigned size)
2 7u83 620
{
621
    if (debug_file) {
6 7u83 622
	write_cstring(debug_file, "        Writing ");
623
	write_unsigned(debug_file, size);
624
	write_cstring(debug_file, " bytes of unit body");
625
	write_newline(debug_file);
2 7u83 626
    }
627
}
628
 
629
void
6 7u83 630
debug_info_w_tld_version(unsigned version)
2 7u83 631
{
632
    if (debug_file) {
6 7u83 633
	write_cstring(debug_file, "          Writing version ");
634
	write_unsigned(debug_file, version);
635
	write_cstring(debug_file, " linker information unit:");
636
	write_newline(debug_file);
2 7u83 637
    }
638
}
639
 
640
void
6 7u83 641
debug_info_w_start_usages(NStringP shape)
2 7u83 642
{
643
    if (debug_file) {
6 7u83 644
	write_cstring(debug_file, "            Writing external ");
645
	write_nstring(debug_file, shape);
646
	write_cstring(debug_file, " name usages:");
647
	write_newline(debug_file);
2 7u83 648
    }
649
}
650
 
651
void
6 7u83 652
debug_info_w_usage(unsigned use,			    NameKeyP key)
2 7u83 653
{
654
    if (debug_file) {
6 7u83 655
	write_cstring(debug_file, "              ");
656
	write_usage(debug_file, use);
657
	write_cstring(debug_file, " (");
658
	write_name_key(debug_file, key);
659
	write_char(debug_file, ')');
660
	write_newline(debug_file);
2 7u83 661
    }
662
}
663
 
664
void
6 7u83 665
debug_info_w_end_capsule(void)
2 7u83 666
{
667
    if (debug_file) {
6 7u83 668
	write_cstring(debug_file, "Finished writing capsule");
669
	write_newline(debug_file);
2 7u83 670
    }
671
}
672
 
673
/*--------------------------------------------------------------------------*/
674
 
675
void
6 7u83 676
debug_info_r_start_library(CStringP name)
2 7u83 677
{
678
    if (debug_file) {
6 7u83 679
	write_cstring(debug_file, "Reading library '");
680
	write_cstring(debug_file, name);
681
	write_cstring(debug_file, "':");
682
	write_newline(debug_file);
2 7u83 683
    }
684
}
685
 
686
void
6 7u83 687
debug_info_r_lib_versions(unsigned major, unsigned minor)
2 7u83 688
{
689
    if (debug_file) {
6 7u83 690
	write_cstring (debug_file, "  Reading major version: ");
691
	write_unsigned(debug_file, major);
692
	write_cstring (debug_file, "; minor version: ");
693
	write_unsigned(debug_file, minor);
694
	write_newline (debug_file);
2 7u83 695
    }
696
}
697
 
698
void
6 7u83 699
debug_info_r_library_version(unsigned version)
2 7u83 700
{
701
    if (debug_file) {
6 7u83 702
	write_cstring(debug_file, "  Reading type ");
703
	write_unsigned(debug_file, version);
704
	write_cstring(debug_file, " library:");
705
	write_newline(debug_file);
2 7u83 706
    }
707
}
708
 
709
void
6 7u83 710
debug_info_r_start_capsules(unsigned num_capsules)
2 7u83 711
{
712
    if (debug_file) {
6 7u83 713
	write_cstring(debug_file, "    Reading ");
714
	write_unsigned(debug_file, num_capsules);
715
	write_cstring(debug_file, " capsules:");
716
	write_newline(debug_file);
2 7u83 717
    }
718
}
719
 
720
void
6 7u83 721
debug_info_r_capsule(NStringP name,			      unsigned length)
2 7u83 722
{
723
    if (debug_file) {
6 7u83 724
	write_cstring(debug_file, "      Loaded '");
725
	write_nstring(debug_file, name);
726
	write_cstring(debug_file, "', ");
727
	write_unsigned(debug_file, length);
728
	write_cstring(debug_file, " bytes");
729
	write_newline(debug_file);
2 7u83 730
    }
731
}
732
 
733
void
6 7u83 734
debug_info_r_start_index(unsigned num_shapes)
2 7u83 735
{
736
    if (debug_file) {
6 7u83 737
	write_cstring(debug_file, "    Reading ");
738
	write_unsigned(debug_file, num_shapes);
739
	write_cstring(debug_file, " shape indices:");
740
	write_newline(debug_file);
2 7u83 741
    }
742
}
743
 
744
void
6 7u83 745
debug_info_r_start_shape_index(NStringP shape,					unsigned num_names)
2 7u83 746
{
747
    if (debug_file) {
6 7u83 748
	write_cstring(debug_file, "      Reading ");
749
	write_unsigned(debug_file, num_names);
750
	write_cstring(debug_file, " entries in ");
751
	write_nstring(debug_file, shape);
752
	write_cstring(debug_file, " external name index:");
753
	write_newline(debug_file);
2 7u83 754
    }
755
}
756
 
757
void
6 7u83 758
debug_info_r_index_entry(NameKeyP name,				  unsigned use, 
759
				  unsigned name_use, 
760
				  NameKeyP key, 
2 7u83 761
				  CStringP cap_name)
762
{
763
    if (debug_file) {
6 7u83 764
	write_cstring(debug_file, "        ");
765
	write_name_key(debug_file, name);
766
	write_cstring(debug_file, ", ");
767
	write_usage(debug_file, use);
768
	write_cstring(debug_file, ", '");
769
	write_cstring(debug_file, cap_name);
770
	write_cstring(debug_file, "' (");
771
	write_name_key(debug_file, key);
772
	write_cstring(debug_file, ", ");
773
	write_usage(debug_file, name_use);
774
	write_char(debug_file, ')');
775
	write_newline(debug_file);
2 7u83 776
    }
777
}
778
 
779
void
6 7u83 780
debug_info_r_end_library(void)
2 7u83 781
{
782
    if (debug_file) {
6 7u83 783
	write_cstring(debug_file, "Finished reading library");
784
	write_newline(debug_file);
2 7u83 785
    }
786
}
787
 
788
void
6 7u83 789
debug_info_r_abort_library(void)
2 7u83 790
{
791
    if (debug_file) {
6 7u83 792
	write_cstring(debug_file, "Aborted reading library");
793
	write_newline(debug_file);
2 7u83 794
    }
795
}
796
 
797
/*--------------------------------------------------------------------------*/
798
 
799
void
6 7u83 800
debug_info_w_start_library(CStringP name)
2 7u83 801
{
802
    if (debug_file) {
6 7u83 803
	write_cstring(debug_file, "Writing library '");
804
	write_cstring(debug_file, name);
805
	write_cstring(debug_file, "':");
806
	write_newline(debug_file);
2 7u83 807
    }
808
}
809
 
810
void
6 7u83 811
debug_info_w_lib_versions(unsigned major, unsigned minor)
2 7u83 812
{
813
    if (debug_file) {
6 7u83 814
	write_cstring (debug_file, "  Writing major version: ");
815
	write_unsigned(debug_file, major);
816
	write_cstring (debug_file, "; minor version: ");
817
	write_unsigned(debug_file, minor);
818
	write_newline (debug_file);
2 7u83 819
    }
820
}
821
 
822
void
6 7u83 823
debug_info_w_library_version(unsigned version)
2 7u83 824
{
825
    if (debug_file) {
6 7u83 826
	write_cstring(debug_file, "  Writing type ");
827
	write_unsigned(debug_file, version);
828
	write_cstring(debug_file, " library:");
829
	write_newline(debug_file);
2 7u83 830
    }
831
}
832
 
833
void
6 7u83 834
debug_info_w_start_capsules(unsigned num_capsules)
2 7u83 835
{
836
    if (debug_file) {
6 7u83 837
	write_cstring(debug_file, "    Writing ");
838
	write_unsigned(debug_file, num_capsules);
839
	write_cstring(debug_file, " capsules:");
840
	write_newline(debug_file);
2 7u83 841
    }
842
}
843
 
844
void
6 7u83 845
debug_info_w_capsule(CStringP name,			      unsigned length)
2 7u83 846
{
847
    if (debug_file) {
6 7u83 848
	write_cstring(debug_file, "      Saved '");
849
	write_cstring(debug_file, name);
850
	write_cstring(debug_file, "', ");
851
	write_unsigned(debug_file, length);
852
	write_cstring(debug_file, " bytes");
853
	write_newline(debug_file);
2 7u83 854
    }
855
}
856
 
857
void
6 7u83 858
debug_info_w_start_index(unsigned num_shapes)
2 7u83 859
{
860
    if (debug_file) {
6 7u83 861
	write_cstring(debug_file, "    Writing ");
862
	write_unsigned(debug_file, num_shapes);
863
	write_cstring(debug_file, " shape indices:");
864
	write_newline(debug_file);
2 7u83 865
    }
866
}
867
 
868
void
6 7u83 869
debug_info_w_start_shape_index(NStringP shape,					unsigned num_names)
2 7u83 870
{
871
    if (debug_file) {
6 7u83 872
	write_cstring(debug_file, "      Writing ");
873
	write_unsigned(debug_file, num_names);
874
	write_cstring(debug_file, " entries in ");
875
	write_nstring(debug_file, shape);
876
	write_cstring(debug_file, " external name index:");
877
	write_newline(debug_file);
2 7u83 878
    }
879
}
880
 
881
void
6 7u83 882
debug_info_w_index_entry(NameKeyP key,				  unsigned use, 
883
				  CStringP cap_name, 
2 7u83 884
				  unsigned cap_index)
885
{
886
    if (debug_file) {
6 7u83 887
	write_cstring(debug_file, "        ");
888
	write_name_key(debug_file, key);
889
	write_cstring(debug_file, ", ");
890
	write_usage(debug_file, use);
891
	write_cstring(debug_file, ", '");
892
	write_cstring(debug_file, cap_name);
893
	write_cstring(debug_file, "' (");
894
	write_unsigned(debug_file, cap_index);
895
	write_char(debug_file, ')');
896
	write_newline(debug_file);
2 7u83 897
    }
898
}
899
 
900
void
6 7u83 901
debug_info_w_end_library(void)
2 7u83 902
{
903
    if (debug_file) {
6 7u83 904
	write_cstring(debug_file, "Finished writing library");
905
	write_newline(debug_file);
2 7u83 906
    }
907
}
908
 
909
/*--------------------------------------------------------------------------*/
910
 
911
void
6 7u83 912
debug_info_l_not_needed(NameKeyP key,				 NStringP shape_key, 
2 7u83 913
				 unsigned use)
914
{
915
    if (debug_file) {
6 7u83 916
	write_cstring(debug_file, "No definition needed for ");
917
	write_nstring(debug_file, shape_key);
918
	write_cstring(debug_file, " '");
919
	write_name_key(debug_file, key);
920
	write_cstring(debug_file, "' (");
921
	write_usage(debug_file, use);
922
	write_char(debug_file, ')');
923
	write_newline(debug_file);
2 7u83 924
    }
925
}
926
 
927
void
6 7u83 928
debug_info_l_not_found(NameKeyP key,				NStringP shape_key, 
2 7u83 929
				unsigned use)
930
{
931
    if (debug_file) {
6 7u83 932
	write_cstring(debug_file, "No definition found for ");
933
	write_nstring(debug_file, shape_key);
934
	write_cstring(debug_file, " '");
935
	write_name_key(debug_file, key);
936
	write_cstring(debug_file, "' (");
937
	write_usage(debug_file, use);
938
	write_char(debug_file, ')');
939
	write_newline(debug_file);
2 7u83 940
    }
941
}
942
 
943
void
6 7u83 944
debug_info_l_found(NameKeyP key,			    NStringP shape_key, 
945
			    unsigned use, 
2 7u83 946
			    CStringP name)
947
{
948
    if (debug_file) {
6 7u83 949
	write_cstring(debug_file, "Definition found for ");
950
	write_nstring(debug_file, shape_key);
951
	write_cstring(debug_file, " '");
952
	write_name_key(debug_file, key);
953
	write_cstring(debug_file, "' (");
954
	write_usage(debug_file, use);
955
	write_cstring(debug_file, ") in file '");
956
	write_cstring(debug_file, name);
957
	write_char(debug_file, '\'');
958
	write_newline(debug_file);
2 7u83 959
    }
960
}
961
 
962
void
6 7u83 963
debug_info_l_hide(NStringP shape,			   NameKeyP key)
2 7u83 964
{
965
    if (debug_file) {
6 7u83 966
	write_cstring(debug_file, "Hid external ");
967
	write_nstring(debug_file, shape);
968
	write_cstring(debug_file, " '");
969
	write_name_key(debug_file, key);
970
	write_char(debug_file, '\'');
971
	write_newline(debug_file);
2 7u83 972
    }
973
}
974
 
975
void
6 7u83 976
debug_info_l_keep(NStringP shape,			   NameKeyP key)
2 7u83 977
{
978
    if (debug_file) {
6 7u83 979
	write_cstring(debug_file, "Kept external ");
980
	write_nstring(debug_file, shape);
981
	write_cstring(debug_file, " '");
982
	write_name_key(debug_file, key);
983
	write_char(debug_file, '\'');
984
	write_newline(debug_file);
2 7u83 985
    }
986
}
987
 
988
void
6 7u83 989
debug_info_l_suppress(NStringP shape,			       NameKeyP key)
2 7u83 990
{
991
    if (debug_file) {
6 7u83 992
	write_cstring(debug_file, "Suppressed external ");
993
	write_nstring(debug_file, shape);
994
	write_cstring(debug_file, " '");
995
	write_name_key(debug_file, key);
996
	write_char(debug_file, '\'');
997
	write_newline(debug_file);
2 7u83 998
    }
999
}
1000
 
1001
void
6 7u83 1002
debug_info_l_rename(NStringP shape,			     NameKeyP from, 
2 7u83 1003
			     NameKeyP to)
1004
{
1005
    if (debug_file) {
6 7u83 1006
	write_cstring(debug_file, "Renamed external ");
1007
	write_nstring(debug_file, shape);
1008
	write_cstring(debug_file, " '");
1009
	write_name_key(debug_file, from);
1010
	write_cstring(debug_file, "' to '");
1011
	write_name_key(debug_file, to);
1012
	write_char(debug_file, '\'');
1013
	write_newline(debug_file);
2 7u83 1014
    }
1015
}
1016
 
1017
/*
1018
 * Local variables(smf):
1019
 * eval: (include::add-path-entry "os-interface" "library" "generated")
1020
 * End:
1021
**/