Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 243

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 247

Warning: Undefined variable $m in /usr/local/www/websvn.planix.org/include/diff_util.php on line 251

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 243

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 247

Warning: Undefined variable $m in /usr/local/www/websvn.planix.org/include/diff_util.php on line 251
WebSVN – tendra.SVN – Diff – /trunk/src/installers/common/dwarf2/dw2_types.c – Rev 2 and 7

Subversion Repositories tendra.SVN

Rev

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

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
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
 */
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
Line 98... Line 128...
98
#include "basicread.h"
128
#include "basicread.h"
99
#include "szs_als.h"
129
#include "szs_als.h"
100
#include "tags.h"
130
#include "tags.h"
101
 
131
 
102
 
132
 
103
static void fail_unimplemented
133
static void
104
    PROTO_N ( (a1, a2) )
-
 
105
    PROTO_T ( long a1 X long a2 )
-
 
106
{
-
 
107
  IGNORE fprintf (stderr, "%lx  %lx\n", a1, a2);
-
 
108
  failer ("unimplemented attribute");
134
fail_unimplemented(long a1, long a2)
109
  return;
-
 
110
}
-
 
111
 
-
 
112
static dg_type needed_types = (dg_type)0;
-
 
113
 
-
 
114
static char * sep =  ", ";
-
 
115
 
-
 
116
 
-
 
117
ext_lab dw2_find_type_label
-
 
118
    PROTO_N ( (t) )
-
 
119
    PROTO_T ( dg_type t )
-
 
120
{
135
{
-
 
136
	IGNORE fprintf(stderr, "%lx  %lx\n", a1, a2);
-
 
137
	failer("unimplemented attribute");
-
 
138
	return;
-
 
139
}
-
 
140
 
-
 
141
static dg_type needed_types = (dg_type)0;
-
 
142
 
-
 
143
static char *sep =  ", ";
-
 
144
 
-
 
145
 
-
 
146
ext_lab
-
 
147
dw2_find_type_label(dg_type t)
-
 
148
{
121
  if (!(t->outref.u.l)) {
149
	if (!(t->outref.u.l)) {
122
    if (t->key == DGT_TAGGED) {
150
		if (t->key == DGT_TAGGED) {
123
      dg_tag tg = t->data.t_tag;
151
			dg_tag tg = t->data.t_tag;
124
      if (tg->done || tg->needed || tg->key == DGK_NONE) {
152
			if (tg->done || tg->needed || tg->key == DGK_NONE) {
125
	t->outref = tg->outref;
153
				t->outref = tg->outref;
126
	return t->outref;
154
				return t->outref;
127
      }
155
			}
128
      if (tg->key == DGK_TYPE) {
156
			if (tg->key == DGK_TYPE) {
129
	dg_type ref_t = tg->p.typ;
157
				dg_type ref_t = tg->p.typ;
130
	t->outref = dw2_find_type_label (ref_t);
158
				t->outref = dw2_find_type_label(ref_t);
131
	tg->outref = t->outref;
159
				tg->outref = t->outref;
132
	tg->done = 1;
160
				tg->done = 1;
133
	return t->outref;
161
				return t->outref;
134
      }
162
			}
135
      if (tg->key == DGK_NAME) {
163
			if (tg->key == DGK_NAME) {
136
	dg_name ref_n = tg->p.nam;
164
				dg_name ref_n = tg->p.nam;
-
 
165
				if (ref_n->key == DGN_TYPE &&
137
	if (ref_n->key == DGN_TYPE && ref_n->idnam.id_key == DG_ID_NONE) {
166
				    ref_n->idnam.id_key == DG_ID_NONE) {
-
 
167
					dg_type ref_t =
138
	  dg_type ref_t = tg->p.nam->data.n_typ.raw;
168
					    tg->p.nam->data.n_typ.raw;
139
	  t->outref = dw2_find_type_label (ref_t);
169
					t->outref = dw2_find_type_label(ref_t);
140
	  tg->outref = t->outref;
170
					tg->outref = t->outref;
141
	  tg->done = 1;
171
					tg->done = 1;
142
	  return t->outref;
172
					return t->outref;
-
 
173
				}
-
 
174
			}
-
 
175
			tg->needed = 1;
-
 
176
			t->outref.u.l = tg->outref.u.l = next_dwarf_label();
-
 
177
			t->outref.k = tg->outref.k = LAB_D;
-
 
178
		} else {
-
 
179
			t->outref.u.l = next_dwarf_label();
-
 
180
			t->outref.k = LAB_D;
-
 
181
		}
-
 
182
		t->type_queue = needed_types;
-
 
183
		needed_types = t;
143
	}
184
	}
144
      }
-
 
145
      tg->needed = 1;
-
 
146
      t->outref.u.l = tg->outref.u.l = next_dwarf_label();
-
 
147
      t->outref.k = tg->outref.k = LAB_D;
-
 
148
    }
-
 
149
    else {
-
 
150
      t->outref.u.l = next_dwarf_label();
-
 
151
      t->outref.k = LAB_D;
-
 
152
    }
-
 
153
    t->type_queue = needed_types;
-
 
154
    needed_types = t;
-
 
155
  }
-
 
156
  return t->outref;
185
	return t->outref;
157
}
186
}
158
 
187
 
159
 
188
 
160
static void out_classmem
189
static void
161
    PROTO_N ( (m) )
-
 
162
    PROTO_T ( dg_classmem m )
190
out_classmem(dg_classmem m)
163
{
191
{
164
  /* within info section */
192
	/* within info section */
165
  if (m.tg)
193
	if (m.tg) {
166
    set_ext_address (m.tg);
194
		set_ext_address(m.tg);
-
 
195
	}
167
  switch (m.cm_key) {
196
	switch (m.cm_key) {
168
    case DG_CM_FIELD: {
197
	case DG_CM_FIELD: {
169
      dg_type f = m.d.cm_f.f_typ;
198
		dg_type f = m.d.cm_f.f_typ;
170
      exp off = son (m.d.cm_f.f_offset);
199
		exp off = son(m.d.cm_f.f_offset);
171
      dg_type base = f;
200
		dg_type base = f;
172
      int base_sz = 1;
201
		int base_sz = 1;
173
      long attr1 = H_TP, attr2;
202
		long attr1 = H_TP, attr2;
174
      if (m.d.cm_f.fnam[0])
203
		if (m.d.cm_f.fnam[0]) {
175
	attr1 |= H_NM;
204
			attr1 |= H_NM;
-
 
205
		}
176
      if (m.d.cm_f.f_pos.file)
206
		if (m.d.cm_f.f_pos.file) {
177
	attr1 |= H_XY;
207
			attr1 |= H_XY;
-
 
208
		}
178
      if (name(off) == val_tag)
209
		if (name(off) == val_tag) {
179
	attr1 |= H_LC;
210
			attr1 |= H_LC;
-
 
211
		}
180
      if (f->key == DGT_BITF) {
212
		if (f->key == DGT_BITF) {
181
	attr1 |= H_BF;
213
			attr1 |= H_BF;
182
	base = f->data.t_bitf.expanded;
214
			base = f->data.t_bitf.expanded;
183
	base_sz = shape_size (f->data.t_bitf.sha);
215
			base_sz = shape_size(f->data.t_bitf.sha);
184
      }
216
		}
185
      if (m.d.cm_f.acc)
217
		if (m.d.cm_f.acc) {
186
	attr1 |= H_AC;
218
			attr1 |= H_AC;
-
 
219
		}
187
      if (m.d.cm_f.discr)
220
		if (m.d.cm_f.discr) {
188
	attr1 |= H_DS;
221
			attr1 |= H_DS;
-
 
222
		}
189
#ifdef H_DX
223
#ifdef H_DX
190
      if (m.d.cm_f.dflt) {
224
		if (m.d.cm_f.dflt) {
191
	if (m.d.cm_f.dflt->span.sp_key == SP_SPAN ||
225
			if (m.d.cm_f.dflt->span.sp_key == SP_SPAN ||
-
 
226
			    (m.d.cm_f.dflt->val &&
192
	      (m.d.cm_f.dflt->val && dw_is_const (son(m.d.cm_f.dflt->val)) ))
227
			     dw_is_const(son(m.d.cm_f.dflt->val)))) {
193
	  attr1 |= H_DF;
228
				attr1 |= H_DF;
194
	else
229
			} else {
195
	  attr1 |= H_DX;
230
				attr1 |= H_DX;
196
      }
231
			}
-
 
232
		}
197
#else
233
#else
198
      if (m.d.cm_f.dflt)
234
		if (m.d.cm_f.dflt) {
199
	attr1 |= H_DF;
235
			attr1 |= H_DF;
-
 
236
		}
200
#endif
237
#endif
201
 
238
 
202
      attr2 = dw_entry (dwe_member, attr1);
239
		attr2 = dw_entry(dwe_member, attr1);
203
#ifdef H_DX
240
#ifdef H_DX
204
      if (attr2 & ~(H_NM|H_XY|H_AC|H_TP|H_LC|H_BF|H_DS|H_DF|H_DX))
241
		if (attr2 & ~(H_NM|H_XY|H_AC|H_TP|H_LC|H_BF|H_DS|H_DF|H_DX)) {
205
#else
242
#else
206
      if (attr2 & ~(H_NM|H_XY|H_AC|H_TP|H_LC|H_BF|H_DS|H_DF))
243
		if (attr2 & ~(H_NM|H_XY|H_AC|H_TP|H_LC|H_BF|H_DS|H_DF)) {
207
#endif
244
#endif
208
	fail_unimplemented (attr1, attr2);
245
			fail_unimplemented(attr1, attr2);
-
 
246
		}
209
      if (attr2 & H_NM)
247
		if (attr2 & H_NM) {
210
	dw_at_string (m.d.cm_f.fnam);
248
			dw_at_string(m.d.cm_f.fnam);
-
 
249
		}
211
      if (attr2 & H_XY)
250
		if (attr2 & H_XY) {
212
	dw_at_decl (m.d.cm_f.f_pos);
251
			dw_at_decl(m.d.cm_f.f_pos);
-
 
252
		}
213
      if (attr2 & H_AC)
253
		if (attr2 & H_AC) {
214
	dw_at_data (1, (long)m.d.cm_f.acc);
254
			dw_at_data(1, (long)m.d.cm_f.acc);
-
 
255
		}
215
      if (attr2 & H_TP)
256
		if (attr2 & H_TP) {
216
	dw_at_ext_lab (dw2_find_type_label (base));
257
			dw_at_ext_lab(dw2_find_type_label(base));
-
 
258
		}
217
      if (attr2 & H_LC)
259
		if (attr2 & H_LC) {
218
	dw_locate_offset (((no (off)) & -base_sz) >> 3);
260
			dw_locate_offset(((no(off)) & -base_sz) >> 3);
-
 
261
		}
219
      if (attr2 & H_BF) {
262
		if (attr2 & H_BF) {
220
#if !little_end
263
#if !little_end
221
	dw_at_data (1, (long)(no (off) & (base_sz - 1)));
264
			dw_at_data(1, (long)(no(off) & (base_sz - 1)));
222
#else
265
#else
223
	dw_at_data (1, (long)(base_sz - f->data.t_bitf.bv.bits
266
			dw_at_data(1, (long)(base_sz - f->data.t_bitf.bv.bits -
224
				- (no (off) & (base_sz - 1))));
267
					     (no(off) & (base_sz - 1))));
225
#endif
268
#endif
226
	dw_at_data (1, (long)f->data.t_bitf.bv.bits);
269
			dw_at_data(1, (long)f->data.t_bitf.bv.bits);
227
      }
270
		}
228
      if (attr2 & H_DS)
271
		if (attr2 & H_DS) {
229
	dw_at_flag (m.d.cm_f.discr);
272
			dw_at_flag(m.d.cm_f.discr);
-
 
273
		}
230
#ifdef H_DX
274
#ifdef H_DX
231
      if (attr2 & H_DX)
275
		if (attr2 & H_DX) {
232
	dw_at_flag ((m.d.cm_f.dflt && !(attr2 & H_DF)) ? 1 : 0);
276
			dw_at_flag((m.d.cm_f.dflt && !(attr2 & H_DF))? 1 : 0);
-
 
277
		}
233
#endif
278
#endif
341
 
503
 
342
static void out_task_sync_data
504
static void
343
    PROTO_N ( (td) )
-
 
344
    PROTO_T ( task_data * td )
505
out_ref_bound(dg_tag tg)
345
{
506
{
346
  /* within info section */
507
	dw_at_form(DW_FORM_ref_addr);
347
  int i;
508
	d_outnl();
348
  dg_name en = td->entries;
509
	dw_at_ext_address(tg);
349
  while (en) {
-
 
350
    dw2_out_name (en, GLOBAL_NAME);
-
 
351
    en = en->next;
-
 
352
  }
-
 
353
  for (i = 0; i < td->members.len; i++) {
-
 
354
    out_classmem (td->members.array[i]);
-
 
355
  }
-
 
356
  return;
510
	return;
357
}
511
}
358
 
512
 
359
 
513
 
360
 
514
void
361
static void out_variant_part
-
 
362
    PROTO_N ( (v) )
515
dw_out_dim(dg_dim d)
363
    PROTO_T ( dg_varpart * v )
-
 
364
{
516
{
365
  /* within info section */
517
	/* within info section */
366
  int i, j;
518
	long attr1 = 0, attr2;
367
  dg_variant * v_el = v->vnts.array;
519
	if (d.d_key == DG_DIM_TYPE) {
368
  switch (v->v_key) {
520
		/* must be array dimension */
369
    case DG_V_D: {
521
		if ((d.d_typ->key == DGT_SUBR || d.d_typ->key == DGT_ENUM) &&
370
      long l = next_dwarf_label();
522
		    !(d.d_typ->outref.u.l)) {
371
      IGNORE dw_entry (dwe_varpart, (long)0);
523
			d.d_typ->outref.u.l = next_dwarf_label();
372
      dw_at_address (l);
-
 
373
      out_dwf_label (l, 1);
524
			d.d_typ->outref.k = LAB_D;
374
      out_classmem (v->u.d);
525
			dw_out_type(d.d_typ);
375
      break;
526
		} else {
376
    }
-
 
377
    case DG_V_S: {
527
			attr1 = H_TP;
378
      IGNORE dw_entry (dwe_varpart, (long)0);
528
			attr2 = dw_entry(dwe_typedef, attr1);
379
      dw_at_ext_address (v->u.s);
529
			if (attr2 != attr1) {
380
      break;
530
				fail_unimplemented(attr1, attr2);
381
    }
531
			}
382
    case DG_V_T: {
-
 
383
      IGNORE dw_entry (dwe_varpart_t, (long)0);
-
 
384
      dw_at_ext_lab (dw2_find_type_label (v->u.t));
532
			dw_at_ext_lab(dw2_find_type_label(d.d_typ));
385
      break;
533
		}
386
    }
534
		return;
387
  }
535
	}
388
  for (i = 0; i < v->vnts.len; i++) {
-
 
389
    dg_discrim * d_el = v_el[i].discr.array;
-
 
390
    dg_classmem * f_el = v_el[i].fields.array;
-
 
391
    if (v_el[i].discr.len == 0)
536
	if (d.d_typ) {
392
      IGNORE dw_entry (dwe_variant_0, (long)0);
537
		attr1 |= (H_TP | H_SZ);
393
    else
538
	}
394
    if (v_el[i].discr.len == 1 && no(d_el->lower) == no(d_el->upper)) {
-
 
395
      IGNORE dw_entry (dwe_variant_1, (long)0);
539
	if (!d.low_ref || d.lower.tg) {
396
      dw_out_const (d_el->lower);
540
		attr1 |= H_LB;
397
    }
541
	}
398
    else {
-
 
399
      long block_end = next_dwarf_label ();
542
	if (!d.hi_ref || d.upper.tg) {
400
      int ss = (name(sh(d_el->lower)) & 1);
543
		attr1 |= (d.hi_cnt ? H_CN : H_UB);
-
 
544
	}
401
      IGNORE dw_entry (dwe_variant_n, (long)0);
545
	attr2 = dw_entry(dwe_subr_type, attr1);
402
      out16 (); out_dwf_dist_to_label (block_end); d_outnl();
546
	if (attr2 & ~(H_TP|H_SZ|H_LB|H_UB|H_CN)) {
403
      for (j = 0; j < v_el[i].discr.len; j++) {
547
		fail_unimplemented(attr1, attr2);
404
	out8 ();
548
	}
405
	if (no(d_el[i].lower) == no(d_el[i].upper)) {
549
	if (attr2 & H_TP) {
406
	  outn ((long)DW_DSC_label); outs (sep);
550
		dw_at_ext_lab(dw2_find_type_label(d.d_typ));
407
	  if (ss)
551
	}
408
	    sleb128 ((long)no(d_el[i].lower));
552
	if (attr2 & H_SZ) {
409
	  else
-
 
410
	    uleb128 ((unsigned long)no(d_el[i].lower));
553
		dw_at_udata((unsigned long)(shape_size(d.sha) >> 3));
411
	}
554
	}
412
	else {
-
 
413
	  outn ((long)DW_DSC_range); outs (sep);
-
 
414
	  if (ss) {
555
	if (attr2 & H_LB) {
415
	    sleb128 ((long)no(d_el[i].lower));
-
 
416
	    outs (sep);
556
		if (d.low_ref) {
417
	    sleb128 ((long)no(d_el[i].upper));
557
			out_ref_bound(d.lower.tg);
418
	  }
-
 
419
	  else {
558
		} else {
420
	    uleb128 ((unsigned long)no(d_el[i].lower));
559
			dw_out_const(son(d.lower.x));
421
	    outs (sep);
-
 
422
	    uleb128 ((unsigned long)no(d_el[i].upper));
-
 
423
	  }
560
		}
424
	}
561
	}
425
	d_outnl();
-
 
426
      }
-
 
427
      out_dwf_label (block_end, 1);
-
 
428
    }
-
 
429
    for (j = 0; j < v_el[i].fields.len; j++) {
-
 
430
      out_classmem (f_el[j]);
-
 
431
    }
-
 
432
    dw_sibling_end ();
-
 
433
  }
-
 
434
  dw_sibling_end ();
-
 
435
  return;
-
 
436
}
-
 
437
 
-
 
438
 
-
 
439
static void out_ref_bound
-
 
440
    PROTO_N ( (tg) )
-
 
441
    PROTO_T ( dg_tag tg )
-
 
442
{
-
 
443
  dw_at_form (DW_FORM_ref_addr); d_outnl ();
-
 
444
  dw_at_ext_address (tg);
-
 
445
  return;
-
 
446
}
-
 
447
 
-
 
448
 
-
 
449
void dw_out_dim
-
 
450
    PROTO_N ( (d) )
-
 
451
    PROTO_T ( dg_dim d )
-
 
452
{
-
 
453
  /* within info section */
-
 
454
  long attr1 = 0, attr2;
-
 
455
  if (d.d_key == DG_DIM_TYPE) {		/* must be array dimension */
-
 
456
    if ((d.d_typ->key == DGT_SUBR || d.d_typ->key == DGT_ENUM) &&
-
 
457
		!(d.d_typ->outref.u.l)) {
-
 
458
      d.d_typ->outref.u.l = next_dwarf_label();
-
 
459
      d.d_typ->outref.k = LAB_D;
-
 
460
      dw_out_type (d.d_typ);
-
 
461
    }
-
 
462
    else {
-
 
463
      attr1 = H_TP;
-
 
464
      attr2 = dw_entry (dwe_typedef, attr1);
-
 
465
      if (attr2 != attr1)
-
 
466
	fail_unimplemented (attr1, attr2);
-
 
467
      dw_at_ext_lab (dw2_find_type_label (d.d_typ));
-
 
468
    }
-
 
469
    return;
-
 
470
  }
-
 
471
  if (d.d_typ)
-
 
472
    attr1 |= (H_TP | H_SZ);
-
 
473
  if (!d.low_ref || d.lower.tg)
-
 
474
    attr1 |= H_LB;
-
 
475
  if (!d.hi_ref || d.upper.tg)
-
 
476
    attr1 |= (d.hi_cnt ? H_CN : H_UB);
-
 
477
  attr2 = dw_entry (dwe_subr_type, attr1);
-
 
478
  if (attr2 & ~(H_TP|H_SZ|H_LB|H_UB|H_CN))
-
 
479
    fail_unimplemented (attr1, attr2);
-
 
480
  if (attr2 & H_TP)
-
 
481
    dw_at_ext_lab (dw2_find_type_label (d.d_typ));
-
 
482
  if (attr2 & H_SZ)
-
 
483
    dw_at_udata ((unsigned long)(shape_size (d.sha) >> 3));
-
 
484
  if (attr2 & H_LB) {
562
	if (attr2 & (H_UB | H_CN)) {
485
    if (d.low_ref)
563
		if (d.hi_ref) {
486
      out_ref_bound (d.lower.tg);
564
			out_ref_bound(d.upper.tg);
487
    else
565
		} else {
488
      dw_out_const (son(d.lower.x));
566
			dw_out_const(son(d.upper.x));
489
  }
567
		}
490
  if (attr2 & (H_UB | H_CN)) {
-
 
491
    if (d.hi_ref)
-
 
492
      out_ref_bound (d.upper.tg);
-
 
493
    else
-
 
494
      dw_out_const (son(d.upper.x));
-
 
495
  }
568
	}
496
  return;
569
	return;
497
}
570
}
554
	}
765
	}
555
	case DG_HPPTR_T: {
-
 
556
	  dwe = dwe_hpptr_t;
-
 
557
	  flg = 1;
-
 
558
	  break;
-
 
559
	}
-
 
560
	case DG_REF_T: {
-
 
561
	  dwe = dwe_ref_type;
-
 
562
	  break;
-
 
563
	}
-
 
564
	case DG_PACK_T: {
-
 
565
	  dwe = dwe_pack_type;
-
 
566
	  break;
-
 
567
	}
-
 
568
	case DG_CONST_T: {
-
 
569
	  dwe = dwe_cnst_type;
-
 
570
	  break;
-
 
571
	}
-
 
572
	case DG_VOL_T: {
-
 
573
	  dwe = dwe_vol_type;
-
 
574
	  break;
-
 
575
	}
-
 
576
	case DG_ALIAS_T: {
-
 
577
	  dwe = dwe_als_type;
-
 
578
	  break;
-
 
579
	}
-
 
580
	case DG_CLWID_T: {
-
 
581
	  dwe = dwe_clwd_type;
-
 
582
	  break;
-
 
583
	}
-
 
584
	case DG_LIM_T: {
-
 
585
	  dwe = dwe_lim_type;
-
 
586
	  break;
-
 
587
	}
-
 
588
	case N_DG_QUAL_TYPES:
-
 
589
	  break;	/* dummy */
-
 
590
      }
-
 
591
      IGNORE dw_entry (dwe, (long)0);
-
 
592
      dw_at_ext_lab (dw2_find_type_label (t->data.t_qual.typ));
-
 
593
      if (flg)
-
 
594
	dw_at_flag (flg);
-
 
595
      break;
-
 
596
    }
-
 
597
 
-
 
598
    case DGT_ARRAY: {
-
 
599
      exp stride_e = son(t->data.t_arr.stride);
-
 
600
      dg_dim * el = t->data.t_arr.dims.array;
-
 
601
      int stride_known = (name(stride_e) == val_tag);
-
 
602
      int size_known = stride_known;
-
 
603
      unsigned long tot_size = (unsigned long) no(stride_e);
-
 
604
      int i;
-
 
605
      for (i = 0; i < t->data.t_arr.dims.len && size_known; i++) {
-
 
606
	if (el[i].count >= 0)
-
 
607
	  tot_size *= (unsigned long) el[i].count;
-
 
608
	else
-
 
609
	  size_known = 0;
-
 
610
      }
-
 
611
 
-
 
612
      IGNORE dw_entry ((size_known ? dwe_arr_type : dwe_arr_dyn), (long)0);
-
 
613
      dw_at_ext_lab (dw2_find_type_label (t->data.t_arr.elem_type));
-
 
614
      if (stride_known)
-
 
615
	dw_out_const (stride_e);
-
 
616
      else
-
 
617
	dw2_offset_exp (stride_e);
-
 
618
      dw_at_data (1, (long)(t->data.t_arr.rowm ? DW_ORD_row_major : DW_ORD_col_major));
-
 
619
      if (size_known)
-
 
620
	dw_at_udata ((tot_size + 7) >> 3);
-
 
621
 
-
 
622
      for (i = 0; i < t->data.t_arr.dims.len; i++)
-
 
623
	dw_out_dim (el[i]);
-
 
624
      dw_sibling_end ();
-
 
625
      break;
-
 
626
    }
-
 
627
 
-
 
628
    case DGT_SUBR: {
-
 
629
      dw_out_dim (t->data.t_subr);
-
 
630
      break;
-
 
631
    }
-
 
632
 
-
 
633
    case DGT_ENUM: {
-
 
634
      long attr1 = H_SZ, attr2;
-
 
635
      int i;
-
 
636
      dg_enum * el = t->data.t_enum.values.array;
-
 
637
      if (t->mor && t->mor->refspec)
-
 
638
	attr1 |= H_SP;
-
 
639
      if (t->mor && t->mor->isspec)
-
 
640
	attr1 |= H_DC;
-
 
641
      if (t->data.t_enum.tnam[0])
-
 
642
	attr1 |= H_NM;
-
 
643
      if (t->data.t_enum.tpos.file)
-
 
644
	attr1 |= H_XY;
-
 
645
      if (t->mor && t->mor->isnew)
-
 
646
	attr1 |= H_NW;
-
 
647
      attr2 = dw_entry (dwe_enum_type, attr1);
-
 
648
      if (attr2 & ~(H_SP|H_DC|H_NM|H_XY|H_SZ|H_NW))
-
 
649
	fail_unimplemented (attr1, attr2);
-
 
650
      if (attr2 & H_SP)
-
 
651
	dw_at_ext_lab (dw2_find_type_label (t->mor->refspec->p.typ));
-
 
652
      if (attr2 & H_DC)
-
 
653
	dw_at_flag ((t->mor && t->mor->isspec ? 1 : 0));
-
 
654
      if (attr2 & H_NM)
-
 
655
	dw_at_string (t->data.t_enum.tnam);
-
 
656
      if (attr2 & H_XY)
-
 
657
	dw_at_decl (t->data.t_enum.tpos);
-
 
658
      if (attr2 & H_SZ)
-
 
659
	dw_at_udata ((unsigned long)(shape_size (sh (son(el[0].value))) >> 3));
-
 
660
      if (attr2 & H_NW)
-
 
661
	dw_at_flag ((t->mor && t->mor->isnew ? 1 : 0));
-
 
662
 
-
 
663
      for (i = 0; i < t->data.t_enum.values.len; i++) {
-
 
664
	if (el[i].tg)
-
 
665
	  set_ext_address (el[i].tg);
-
 
666
	if (el[i].is_chn) {
-
 
667
	  IGNORE dw_entry (dwe_enum_char, (long)0);
-
 
668
	  out8(); uleb128 ((unsigned long)el[i].chn); d_outnl();
-
 
669
	}
-
 
670
	else {
-
 
671
	  IGNORE dw_entry (dwe_enum_tor, (long)0);
-
 
672
	  dw_at_string (el[i].enam);
-
 
673
	}
-
 
674
	dw_out_const (son(el[i].value));
-
 
675
      }
-
 
676
      dw_sibling_end ();
-
 
677
      break;
-
 
678
    }
-
 
679
 
766
 
680
    case DGT_STRUCT:
-
 
681
    case DGT_CLASS:
-
 
682
    case DGT_A_TASK:
-
 
683
    case DGT_A_SYNCH: {
-
 
684
      abbrev_entry dwe;
-
 
685
      int ada_derived = 0;
-
 
686
      char* nam;
-
 
687
      char* gnam = "";
-
 
688
      long attr1 = 0, attr2;
-
 
689
      dg_instantn * generic = (dg_instantn *)0;
-
 
690
      if (t->data.t_struct.is_union)
-
 
691
	dwe = dwe_union_t;
-
 
692
      else
-
 
693
      switch (t->key) {
-
 
694
	case DGT_STRUCT:
767
	case DGT_STRUCT:
695
	  dwe = dwe_struct_t;
-
 
696
	  break;
-
 
697
	case DGT_CLASS:
768
	case DGT_CLASS:
698
	  dwe = dwe_class_t;
-
 
699
	  break;
-
 
700
	case DGT_A_TASK:
769
	case DGT_A_TASK:
701
	  dwe = dwe_task_t;
770
	case DGT_A_SYNCH: {
702
	  break;
771
		abbrev_entry dwe;
703
	default:
-
 
704
	  dwe = dwe_synch_t;
772
		int ada_derived = 0;
705
	  break;
773
		char* nam;
706
      }
-
 
707
      if (t->data.t_struct.idnam.id_key == DG_ID_INST) {
-
 
708
	generic = t->data.t_struct.idnam.idd.instance;
-
 
709
	if (generic->nam.id_key == DG_ID_NONE ||
-
 
710
		generic->nam.id_key == DG_ID_ANON)
-
 
711
	  nam = generic->spec.idd.nam;
-
 
712
        else {
774
		char* gnam = "";
713
	  nam = generic->nam.idd.nam;
775
		long attr1 = 0, attr2;
714
	  gnam = generic->spec.idd.nam;
776
		dg_instantn * generic = (dg_instantn *)0;
715
	}
-
 
716
      }
-
 
717
      else
-
 
718
	nam = t->data.t_struct.idnam.idd.nam;
777
		if (t->data.t_struct.is_union) {
719
 
-
 
720
      if (t->data.t_struct.tpos.file)
-
 
721
	attr1 |= H_XY;
-
 
722
      if (t->mor && t->mor->refspec)
-
 
723
	attr1 |= H_SP;
778
			dwe = dwe_union_t;
724
      else {
779
		} else {
725
	if (nam[0])
780
			switch (t->key) {
726
	  attr1 |= H_NM;
781
			case DGT_STRUCT:
727
	if (gnam[0])
-
 
728
	  attr1 |= H_GN;
782
				dwe = dwe_struct_t;
729
      }
783
				break;
730
      if (t->mor && t->mor->isspec)
-
 
731
	attr1 |= H_DC;
784
			case DGT_CLASS:
732
      if (t->mor && t->mor->issep)
785
				dwe = dwe_class_t;
733
	attr1 |= H_SE;
786
				break;
734
      if (t->data.t_struct.sha)
787
			case DGT_A_TASK:
735
	attr1 |= H_SZ;
788
				dwe = dwe_task_t;
736
      if (t->mor && t->mor->elabn)
-
 
737
	attr1 |= H_EL;
789
				break;
738
      if (t->mor && t->mor->isnew)
-
 
739
	attr1 |= H_NW;
790
			default:
740
      if (t->mor && t->mor->aderiv) {
-
 
741
	attr1 |= H_AD;
791
				dwe = dwe_synch_t;
742
	ada_derived = 1;
792
				break;
743
      }
793
			}
744
 
-
 
745
      if (t->key == DGT_CLASS) {
794
		if (t->data.t_struct.idnam.id_key == DG_ID_INST) {
746
	if (t->data.t_struct.u.cd->vt_s)
795
			generic = t->data.t_struct.idnam.idd.instance;
747
	  attr1 |= H_VS;
-
 
748
	if (t->data.t_struct.u.cd->vt_d)
796
			if (generic->nam.id_key == DG_ID_NONE ||
749
	  attr1 |= H_VD;
797
			    generic->nam.id_key == DG_ID_ANON) {
750
	if (t->data.t_struct.u.cd->rtti_s)
798
				nam = generic->spec.idd.nam;
751
	  attr1 |= H_RS;
799
			} else {
752
	if (t->data.t_struct.u.cd->rtti_d)
800
				nam = generic->nam.idd.nam;
753
	  attr1 |= H_RD;
801
				gnam = generic->spec.idd.nam;
754
      }
802
			}
755
      else
803
		} else {
756
      if (t->key != DGT_STRUCT) {
-
 
757
	if (t->data.t_struct.u.td->cb)
-
 
758
	  attr1 |= H_CB;
-
 
759
	if (t->data.t_struct.u.td->id)
804
			nam = t->data.t_struct.idnam.idd.nam;
760
	  attr1 |= H_ID;
-
 
761
      }
-
 
762
 
805
		}
763
      attr2 = dw_entry (dwe, attr1);
-
 
764
      if (attr2 & ~(H_SP|H_DC|H_NM|H_XY|H_SZ|H_NW|H_EXTN))
-
 
765
	fail_unimplemented (attr1, attr2);
-
 
766
      if (attr2 & H_SP)
-
 
767
	dw_at_ext_lab (dw2_find_type_label (t->mor->refspec->p.typ));
-
 
768
      if (attr2 & H_DC)
-
 
769
	dw_at_flag ((t->mor && t->mor->isspec ? 1 : 0));
-
 
770
      if (attr2 & H_NM)
-
 
771
	dw_at_string (nam);
-
 
772
      if (attr2 & H_XY)
-
 
773
	dw_at_decl (t->data.t_struct.tpos);
-
 
774
      if (attr2 & H_SZ)
-
 
775
	dw_at_udata ((unsigned long)(shape_size (t->data.t_struct.sha) >> 3));
-
 
776
      if (attr2 & H_NW)
-
 
777
	dw_at_flag ((t->mor && t->mor->isnew ? 1 : 0));
-
 
778
 
806
 
779
      if (attr2 & H_EXTN) {
807
		if (t->data.t_struct.tpos.file) {
780
	long block_end = next_dwarf_label ();
-
 
781
	out16 (); out_dwf_dist_to_label (block_end); d_outnl();
-
 
782
	attr1 &= ~attr2;
808
			attr1 |= H_XY;
783
	if (attr1 & H_NW) {
-
 
784
	  set_attribute (DW_AT_DD_newtype, DW_FORM_flag);
-
 
785
	  dw_at_flag ((t->mor && t->mor->isnew ? 1 : ada_derived));
-
 
786
	}
-
 
787
	if (attr1 & H_AD) {
-
 
788
	  set_attribute (DW_AT_DD_ada_derived, DW_FORM_flag);
-
 
789
	  dw_at_flag (ada_derived);
-
 
790
	}
809
		}
791
	if (attr1 & H_SE) {
-
 
792
	  set_attribute (DW_AT_DD_ada_derived, DW_FORM_flag);
-
 
793
	  dw_at_flag ((t->mor && t->mor->issep ? 1 : 0));
810
		if (t->mor && t->mor->refspec) {
794
	}
-
 
795
	switch (t->key) {
-
 
796
	  case DGT_STRUCT: {
-
 
797
	    fail_unimplemented (attr1, attr1);
-
 
798
	    break;
-
 
799
	  }
-
 
800
	  case DGT_CLASS: {
-
 
801
	    if (attr1 & ~(H_NW|H_VS|H_VD|H_RS|H_RD|H_EL|H_GN|H_AD))
-
 
802
	      fail_unimplemented (attr1, attr1);
-
 
803
	    if (attr1 & H_VS) {
-
 
804
	      set_attribute (DW_AT_DD_vtable_static, DW_FORM_ref_addr);
-
 
805
	      dw_at_ext_address (t->data.t_struct.u.cd->vt_s);
-
 
806
	    }
-
 
807
	    if (attr1 & H_VD) {
-
 
808
	      set_attribute (DW_AT_DD_vtable_dynamic, DW_FORM_ref_addr);
-
 
809
	      dw_at_ext_address (t->data.t_struct.u.cd->vt_d);
-
 
810
	    }
-
 
811
	    if (attr1 & H_RS) {
811
			attr1 |= H_SP;
812
	      set_attribute (DW_AT_DD_rtti_static, DW_FORM_ref_addr);
-
 
813
	      dw_at_ext_address (t->data.t_struct.u.cd->rtti_s);
-
 
814
	    }
-
 
815
	    if (attr1 & H_RD) {
-
 
816
	      set_attribute (DW_AT_DD_rtti_dynamic, DW_FORM_ref_addr);
-
 
817
	      dw_at_ext_address (t->data.t_struct.u.cd->rtti_d);
-
 
818
	    }
-
 
819
	    break;
812
		} else {
820
	  }
-
 
821
	  case DGT_A_TASK: {
-
 
822
	    if (attr1 & ~(H_NW|H_ID|H_CB|H_EL|H_GN|H_SE))
-
 
823
	      fail_unimplemented (attr1, attr1);
-
 
824
	    if (attr1 & H_ID) {
813
			if (nam[0]) {
825
	      set_attribute (DW_AT_DD_task_id, DW_FORM_ref_addr);
-
 
826
	      dw_at_ext_address (t->data.t_struct.u.td->id);
-
 
827
	    }
-
 
828
	    if (attr1 & H_CB) {
814
				attr1 |= H_NM;
829
	      set_attribute (DW_AT_DD_task_control_block, DW_FORM_ref_addr);
-
 
830
	      dw_at_ext_address (t->data.t_struct.u.td->cb);
-
 
831
	    }
-
 
832
	    break;
-
 
833
	  }
815
			}
834
	  default: {
816
			if (gnam[0]) {
835
	    if (attr1 & ~(H_NW|H_CB|H_EL|H_GN|H_SE))
-
 
836
	      fail_unimplemented (attr1, attr1);
-
 
837
	    if (attr1 & H_CB) {
817
				attr1 |= H_GN;
838
	      set_attribute (DW_AT_DD_so_control_block, DW_FORM_ref_addr);
-
 
839
	      dw_at_ext_address (t->data.t_struct.u.td->cb);
-
 
840
	    }
-
 
841
	    break;
-
 
842
	  }
818
			}
843
	}
819
		}
844
	if (attr1 & H_EL) {
-
 
845
	  set_attribute (DW_AT_DD_elaboration, DW_FORM_ref_addr);
-
 
846
	  dw_at_ext_address (t->mor->elabn);
820
		if (t->mor && t->mor->isspec) {
847
	}
-
 
848
	if (attr1 & H_GN) {
821
			attr1 |= H_DC;
849
	  set_attribute (DW_AT_DD_generic_name, DW_FORM_string);
-
 
850
	  dw_at_string (gnam);
-
 
851
	}
822
		}
852
      }
-
 
853
 
-
 
854
      if (generic)
-
 
855
	dw2_out_generic (generic->params);
-
 
856
      switch (t->key) {
823
		if (t->mor && t->mor->issep) {
857
	case DGT_STRUCT: {
-
 
858
	  int i;
824
			attr1 |= H_SE;
859
	  dg_classmem * el = t->data.t_struct.u.fields.array;
-
 
860
	  for (i = 0; i < t->data.t_struct.u.fields.len; i++)
-
 
861
	    out_classmem (el[i]);
-
 
862
	  break;
-
 
863
	}
825
		}
864
	case DGT_CLASS: {
-
 
865
	  out_class_data (t->data.t_struct.u.cd);
826
		if (t->data.t_struct.sha) {
866
	  break;
827
			attr1 |= H_SZ;
867
	}
828
		}
868
	default: {
-
 
869
	  out_task_sync_data (t->data.t_struct.u.td);
829
		if (t->mor && t->mor->elabn) {
870
	  break;
830
			attr1 |= H_EL;
871
	}
831
		}
872
      }
-
 
873
      if (t->data.t_struct.vpart)
-
 
874
	out_variant_part (t->data.t_struct.vpart);
-
 
875
      dw_sibling_end ();
-
 
876
      break;
-
 
877
    }
-
 
878
 
-
 
879
    case DGT_PMEM: {
-
 
880
      IGNORE dw_entry (dwe_ptrmem_t, (long)0);
-
 
881
      dw_at_ext_address (t->data.t_pmem.pclass);
-
 
882
      dw_at_ext_lab (dw2_find_type_label (t->data.t_pmem.memtyp));
-
 
883
      dw_at_udata ((unsigned long)(shape_size (t->data.t_pmem.sha) >> 3));
-
 
884
      break;
-
 
885
    }
-
 
886
 
-
 
887
    case DGT_CONS: {
-
 
888
      abbrev_entry dwe;
-
 
889
      long attr1 = (H_TP | H_SZ), attr2 = 0;
-
 
890
      if (t->data.t_cons.c_key == DG_SET_T)
-
 
891
	dwe = dwe_set_t;
-
 
892
      else
-
 
893
	dwe = dwe_file_t;
-
 
894
      if (t->mor && t->mor->refspec)
-
 
895
	attr1 |= H_SP;
-
 
896
      if (t->mor && t->mor->isspec)
832
		if (t->mor && t->mor->isnew) {
897
	attr1 |= H_DC;
833
			attr1 |= H_NW;
898
      if (t->data.t_enum.tnam[0])
-
 
899
      attr2 = dw_entry (dwe, attr1);
-
 
900
      if (attr2 & ~(H_SP|H_DC|H_TP|H_SZ))
-
 
901
	fail_unimplemented (attr1, attr2);
-
 
902
      if (attr2 & H_SP)
-
 
903
	dw_at_ext_lab (dw2_find_type_label (t->mor->refspec->p.typ));
-
 
904
      if (attr2 & H_DC)
-
 
905
	dw_at_flag ((t->mor && t->mor->isspec ? 1 : 0));
-
 
906
      if (attr2 & H_TP)
-
 
907
	dw_at_ext_lab (dw2_find_type_label (t->data.t_cons.typ));
-
 
908
      if (attr2 & H_SZ)
-
 
909
	dw_at_udata ((unsigned long)(shape_size (t->data.t_cons.sha) >> 3));
-
 
910
      break;
-
 
911
    }
-
 
912
 
-
 
913
    case DGT_PROC: {
-
 
914
      int i;
-
 
915
      dg_param * el = t->data.t_proc.params.array;
-
 
916
      dg_type res_t = t->data.t_proc.res_type;
-
 
917
      if (res_t) {
-
 
918
	IGNORE dw_entry (dwe_proc_type, (long)0);
-
 
919
	dw_at_ext_lab (dw2_find_type_label (res_t));
-
 
920
      }
-
 
921
      else
-
 
922
	IGNORE dw_entry (dwe_procv_t, (long)0);
-
 
923
      for (i = 0; i < t->data.t_proc.params.len; i++) {
-
 
924
	IGNORE dw_entry (dwe_formal, (long)0);
-
 
925
	dw_at_ext_lab (dw2_find_type_label (el[i].p_typ));
-
 
926
      }
-
 
927
      if (t->data.t_proc.prps & f_var_callers)
-
 
928
	IGNORE dw_entry (dwe_opt_par, (long)0);
-
 
929
      dw_sibling_end ();
-
 
930
      break;
-
 
931
    }
-
 
932
 
-
 
933
    case DGT_BITF: {
-
 
934
      failer ("bitfields shouldn't occur here");
-
 
935
      break;
-
 
936
    }
834
		}
937
 
-
 
938
    case DGT_FIXED: {
-
 
939
      long attr1 = 0, attr2;
-
 
940
      if (t->data.t_adanum.delta)
835
		if (t->mor && t->mor->aderiv) {
941
	attr1 |= H_DF;
836
			attr1 |= H_AD;
942
      if (t->data.t_adanum.digits)
-
 
943
	attr1 |= H_DS;
837
			ada_derived = 1;
944
      attr2 = dw_entry (dwe_fixpt_t, attr1);
-
 
945
      if (attr2 & ~(H_DF|H_DS))
-
 
946
	fail_unimplemented (attr1, attr2);
-
 
947
      dw_at_ext_lab (dw2_find_type_label (t->data.t_adanum.rept));
-
 
948
      dw_out_const (son(t->data.t_adanum.small));
-
 
949
      if (attr2 & H_DF)
-
 
950
	dw_out_const (son(t->data.t_adanum.delta));
-
 
951
      if (attr2 & H_DS)
-
 
952
	dw_out_const (son(t->data.t_adanum.digits));
-
 
953
      break;
-
 
954
    }
-
 
955
 
-
 
956
    case DGT_FLDIG: {
-
 
957
      IGNORE dw_entry (dwe_fldg_t, (long)0);
-
 
958
      dw_at_ext_lab (dw2_find_type_label (t->data.t_adanum.rept));
-
 
959
      dw_out_const (son(t->data.t_adanum.digits));
-
 
960
      break;
-
 
961
    }
-
 
962
 
-
 
963
    case DGT_MOD: {
-
 
964
      IGNORE dw_entry (dwe_modular_t, (long)0);
-
 
965
      dw_at_ext_lab (dw2_find_type_label (t->data.t_adanum.rept));
-
 
966
      dw_out_const (son(t->data.t_adanum.digits));
-
 
967
      break;
-
 
968
    }
-
 
969
 
-
 
970
    case DGT_STRING: {
-
 
971
      exp l_e = son(t->data.t_string.length);	/* other fields ignored */
-
 
972
      if (name(l_e) == val_tag) {
-
 
973
	IGNORE dw_entry (dwe_stringc_t, (long)0);
-
 
974
	dw_at_udata ((unsigned long)no(l_e));
-
 
975
      }
-
 
976
      else {
-
 
977
	IGNORE dw_entry (dwe_string_t, (long)0);
-
 
978
	dw2_locate_exp (l_e, 0, 0);
-
 
979
	dw_at_udata ((unsigned long)(shape_size (sh(l_e)) >> 3));
-
 
980
      }
-
 
981
      break;
-
 
982
    }
838
		}
983
 
839
 
984
    case DGT_UNKNOWN: {
840
		if (t->key == DGT_CLASS) {
-
 
841
			if (t->data.t_struct.u.cd->vt_s) {
-
 
842
				attr1 |= H_VS;
-
 
843
			}
-
 
844
			if (t->data.t_struct.u.cd->vt_d) {
-
 
845
				attr1 |= H_VD;
-
 
846
			}
985
      IGNORE dw_entry (dwe_unknown_t, (long)0);
847
			if (t->data.t_struct.u.cd->rtti_s) {
986
      break;
848
				attr1 |= H_RS;
-
 
849
			}
-
 
850
			if (t->data.t_struct.u.cd->rtti_d) {
-
 
851
				attr1 |= H_RD;
-
 
852
			}
-
 
853
		} else if (t->key != DGT_STRUCT) {
-
 
854
			if (t->data.t_struct.u.td->cb) {
-
 
855
				attr1 |= H_CB;
-
 
856
			}
-
 
857
			if (t->data.t_struct.u.td->id) {
-
 
858
				attr1 |= H_ID;
987
    }
859
			}
-
 
860
		}
988
 
861
 
-
 
862
		attr2 = dw_entry(dwe, attr1);
-
 
863
		if (attr2 & ~(H_SP|H_DC|H_NM|H_XY|H_SZ|H_NW|H_EXTN)) {
-
 
864
			fail_unimplemented(attr1, attr2);
-
 
865
		}
-
 
866
		if (attr2 & H_SP) {
-
 
867
			dw_at_ext_lab(dw2_find_type_label(t->mor->refspec->p.typ));
-
 
868
		}
-
 
869
		if (attr2 & H_DC) {
-
 
870
			dw_at_flag((t->mor && t->mor->isspec ? 1 : 0));
-
 
871
		}
-
 
872
		if (attr2 & H_NM) {
-
 
873
			dw_at_string(nam);
-
 
874
		}
-
 
875
		if (attr2 & H_XY) {
-
 
876
			dw_at_decl(t->data.t_struct.tpos);
-
 
877
		}
-
 
878
		if (attr2 & H_SZ) {
-
 
879
			dw_at_udata((unsigned long)(shape_size(t->data.t_struct.sha) >> 3));
-
 
880
		}
-
 
881
		if (attr2 & H_NW) {
-
 
882
			dw_at_flag((t->mor && t->mor->isnew ? 1 : 0));
-
 
883
		}
-
 
884
 
-
 
885
		if (attr2 & H_EXTN) {
-
 
886
			long block_end = next_dwarf_label();
-
 
887
			out16();
-
 
888
			out_dwf_dist_to_label(block_end);
-
 
889
			d_outnl();
-
 
890
			attr1 &= ~attr2;
-
 
891
			if (attr1 & H_NW) {
-
 
892
				set_attribute(DW_AT_DD_newtype, DW_FORM_flag);
-
 
893
				dw_at_flag((t->mor &&
-
 
894
					    t->mor->isnew ? 1 : ada_derived));
-
 
895
			}
-
 
896
			if (attr1 & H_AD) {
-
 
897
				set_attribute(DW_AT_DD_ada_derived,
-
 
898
					      DW_FORM_flag);
-
 
899
				dw_at_flag(ada_derived);
-
 
900
			}
-
 
901
			if (attr1 & H_SE) {
-
 
902
				set_attribute(DW_AT_DD_ada_derived,
-
 
903
					      DW_FORM_flag);
-
 
904
				dw_at_flag((t->mor && t->mor->issep ? 1 : 0));
-
 
905
			}
-
 
906
			switch (t->key) {
-
 
907
			case DGT_STRUCT:
-
 
908
				fail_unimplemented(attr1, attr1);
-
 
909
				break;
-
 
910
			case DGT_CLASS:
-
 
911
				if (attr1 & ~(H_NW|H_VS|H_VD|H_RS|H_RD|H_EL|H_GN|H_AD)) {
-
 
912
					fail_unimplemented(attr1, attr1);
-
 
913
				}
-
 
914
				if (attr1 & H_VS) {
-
 
915
					set_attribute(DW_AT_DD_vtable_static,
-
 
916
						      DW_FORM_ref_addr);
-
 
917
					dw_at_ext_address(t->data.t_struct.u.cd->vt_s);
-
 
918
				}
-
 
919
				if (attr1 & H_VD) {
-
 
920
					set_attribute(DW_AT_DD_vtable_dynamic,
-
 
921
						      DW_FORM_ref_addr);
-
 
922
					dw_at_ext_address(t->data.t_struct.u.cd->vt_d);
-
 
923
				}
-
 
924
				if (attr1 & H_RS) {
-
 
925
					set_attribute(DW_AT_DD_rtti_static,
-
 
926
						      DW_FORM_ref_addr);
-
 
927
					dw_at_ext_address(t->data.t_struct.u.cd->rtti_s);
-
 
928
				}
-
 
929
				if (attr1 & H_RD) {
-
 
930
					set_attribute(DW_AT_DD_rtti_dynamic,
-
 
931
						      DW_FORM_ref_addr);
-
 
932
					dw_at_ext_address(t->data.t_struct.u.cd->rtti_d);
-
 
933
				}
-
 
934
				break;
-
 
935
			case DGT_A_TASK:
-
 
936
				if (attr1 & ~(H_NW|H_ID|H_CB|H_EL|H_GN|H_SE)) {
-
 
937
					fail_unimplemented(attr1, attr1);
-
 
938
				}
-
 
939
				if (attr1 & H_ID) {
-
 
940
					set_attribute(DW_AT_DD_task_id,
-
 
941
						      DW_FORM_ref_addr);
-
 
942
					dw_at_ext_address(t->data.t_struct.u.td->id);
-
 
943
				}
-
 
944
				if (attr1 & H_CB) {
-
 
945
					set_attribute(DW_AT_DD_task_control_block, DW_FORM_ref_addr);
-
 
946
					dw_at_ext_address(t->data.t_struct.u.td->cb);
-
 
947
				}
-
 
948
				break;
989
    default:
949
			default:
-
 
950
				if (attr1 & ~(H_NW|H_CB|H_EL|H_GN|H_SE)) {
-
 
951
					fail_unimplemented(attr1, attr1);
-
 
952
				}
-
 
953
				if (attr1 & H_CB) {
-
 
954
					set_attribute(DW_AT_DD_so_control_block,
-
 
955
						      DW_FORM_ref_addr);
-
 
956
					dw_at_ext_address(t->data.t_struct.u.td->cb);
-
 
957
				}
-
 
958
				break;
-
 
959
			}
-
 
960
			if (attr1 & H_EL) {
-
 
961
				set_attribute(DW_AT_DD_elaboration,
-
 
962
					      DW_FORM_ref_addr);
-
 
963
				dw_at_ext_address(t->mor->elabn);
-
 
964
			}
-
 
965
			if (attr1 & H_GN) {
-
 
966
				set_attribute(DW_AT_DD_generic_name,
-
 
967
					      DW_FORM_string);
-
 
968
				dw_at_string(gnam);
-
 
969
			}
-
 
970
		}
-
 
971
 
-
 
972
		if (generic) {
-
 
973
			dw2_out_generic(generic->params);
-
 
974
		}
-
 
975
		switch (t->key) {
-
 
976
		case DGT_STRUCT: {
-
 
977
			int i;
-
 
978
			dg_classmem *el = t->data.t_struct.u.fields.array;
-
 
979
			for (i = 0; i < t->data.t_struct.u.fields.len; i++) {
-
 
980
				out_classmem(el[i]);
-
 
981
			}
-
 
982
			break;
-
 
983
		}
-
 
984
		case DGT_CLASS:
-
 
985
			out_class_data(t->data.t_struct.u.cd);
-
 
986
			break;
-
 
987
		default:
-
 
988
			out_task_sync_data(t->data.t_struct.u.td);
-
 
989
			break;
-
 
990
		}
-
 
991
		if (t->data.t_struct.vpart) {
-
 
992
			out_variant_part(t->data.t_struct.vpart);
-
 
993
		}
-
 
994
		dw_sibling_end();
-
 
995
		break;
-
 
996
	}
-
 
997
 
-
 
998
	case DGT_PMEM:
-
 
999
		IGNORE dw_entry(dwe_ptrmem_t, (long)0);
-
 
1000
		dw_at_ext_address(t->data.t_pmem.pclass);
-
 
1001
		dw_at_ext_lab(dw2_find_type_label(t->data.t_pmem.memtyp));
-
 
1002
		dw_at_udata((unsigned long)(shape_size(t->data.t_pmem.sha) >> 3));
-
 
1003
		break;
-
 
1004
 
-
 
1005
	case DGT_CONS: {
-
 
1006
		abbrev_entry dwe;
-
 
1007
		long attr1 = (H_TP | H_SZ), attr2 = 0;
-
 
1008
		if (t->data.t_cons.c_key == DG_SET_T) {
-
 
1009
			dwe = dwe_set_t;
-
 
1010
		} else {
-
 
1011
			dwe = dwe_file_t;
-
 
1012
		}
-
 
1013
		if (t->mor && t->mor->refspec) {
-
 
1014
			attr1 |= H_SP;
-
 
1015
		}
-
 
1016
		if (t->mor && t->mor->isspec) {
-
 
1017
			attr1 |= H_DC;
-
 
1018
		}
-
 
1019
		if (t->data.t_enum.tnam[0]) {
-
 
1020
			attr2 = dw_entry(dwe, attr1);
-
 
1021
		}
-
 
1022
		if (attr2 & ~(H_SP|H_DC|H_TP|H_SZ)) {
-
 
1023
			fail_unimplemented(attr1, attr2);
-
 
1024
		}
-
 
1025
		if (attr2 & H_SP) {
-
 
1026
			dw_at_ext_lab(dw2_find_type_label(t->mor->refspec->p.typ));
-
 
1027
		}
-
 
1028
		if (attr2 & H_DC) {
-
 
1029
			dw_at_flag((t->mor && t->mor->isspec ? 1 : 0));
-
 
1030
		}
-
 
1031
		if (attr2 & H_TP) {
-
 
1032
			dw_at_ext_lab(dw2_find_type_label(t->data.t_cons.typ));
-
 
1033
		}
-
 
1034
		if (attr2 & H_SZ) {
-
 
1035
			dw_at_udata((unsigned long)(shape_size(t->data.t_cons.sha) >> 3));
-
 
1036
		}
-
 
1037
		break;
-
 
1038
	}
-
 
1039
 
-
 
1040
	case DGT_PROC: {
-
 
1041
		int i;
-
 
1042
		dg_param *el = t->data.t_proc.params.array;
-
 
1043
		dg_type res_t = t->data.t_proc.res_type;
-
 
1044
		if (res_t) {
-
 
1045
			IGNORE dw_entry(dwe_proc_type, (long)0);
-
 
1046
			dw_at_ext_lab(dw2_find_type_label(res_t));
-
 
1047
		} else {
-
 
1048
			IGNORE dw_entry(dwe_procv_t, (long)0);
-
 
1049
		}
-
 
1050
		for (i = 0; i < t->data.t_proc.params.len; i++) {
-
 
1051
			IGNORE dw_entry(dwe_formal, (long)0);
-
 
1052
			dw_at_ext_lab(dw2_find_type_label(el[i].p_typ));
-
 
1053
		}
-
 
1054
		if (t->data.t_proc.prps & f_var_callers)
-
 
1055
			IGNORE dw_entry(dwe_opt_par, (long)0);
-
 
1056
		dw_sibling_end();
-
 
1057
		break;
-
 
1058
	}
-
 
1059
 
-
 
1060
	case DGT_BITF:
-
 
1061
		failer("bitfields shouldn't occur here");
-
 
1062
		break;
-
 
1063
 
-
 
1064
	case DGT_FIXED: {
-
 
1065
		long attr1 = 0, attr2;
-
 
1066
		if (t->data.t_adanum.delta) {
-
 
1067
			attr1 |= H_DF;
-
 
1068
		}
-
 
1069
		if (t->data.t_adanum.digits) {
-
 
1070
			attr1 |= H_DS;
-
 
1071
		}
-
 
1072
		attr2 = dw_entry(dwe_fixpt_t, attr1);
-
 
1073
		if (attr2 & ~(H_DF|H_DS)) {
-
 
1074
			fail_unimplemented(attr1, attr2);
-
 
1075
		}
-
 
1076
		dw_at_ext_lab(dw2_find_type_label(t->data.t_adanum.rept));
-
 
1077
		dw_out_const(son(t->data.t_adanum.small));
-
 
1078
		if (attr2 & H_DF) {
-
 
1079
			dw_out_const(son(t->data.t_adanum.delta));
-
 
1080
		}
-
 
1081
		if (attr2 & H_DS) {
-
 
1082
			dw_out_const(son(t->data.t_adanum.digits));
-
 
1083
		}
-
 
1084
		break;
-
 
1085
	}
-
 
1086
 
-
 
1087
	case DGT_FLDIG:
-
 
1088
		IGNORE dw_entry(dwe_fldg_t, (long)0);
-
 
1089
		dw_at_ext_lab(dw2_find_type_label(t->data.t_adanum.rept));
-
 
1090
		dw_out_const(son(t->data.t_adanum.digits));
-
 
1091
		break;
-
 
1092
 
-
 
1093
	case DGT_MOD:
-
 
1094
		IGNORE dw_entry(dwe_modular_t, (long)0);
-
 
1095
		dw_at_ext_lab(dw2_find_type_label(t->data.t_adanum.rept));
-
 
1096
		dw_out_const(son(t->data.t_adanum.digits));
-
 
1097
		break;
-
 
1098
 
-
 
1099
	case DGT_STRING: {
-
 
1100
		/* other fields ignored */
-
 
1101
		exp l_e = son(t->data.t_string.length);
-
 
1102
 
-
 
1103
		if (name(l_e) == val_tag) {
-
 
1104
			IGNORE dw_entry(dwe_stringc_t, (long)0);
-
 
1105
			dw_at_udata((unsigned long)no(l_e));
-
 
1106
		} else {
-
 
1107
			IGNORE dw_entry(dwe_string_t, (long)0);
-
 
1108
			dw2_locate_exp(l_e, 0, 0);
-
 
1109
			dw_at_udata((unsigned long)(shape_size(sh(l_e)) >> 3));
-
 
1110
		}
-
 
1111
		break;
-
 
1112
	}
-
 
1113
 
-
 
1114
	case DGT_UNKNOWN: {
-
 
1115
		IGNORE dw_entry(dwe_unknown_t, (long)0);
-
 
1116
		break;
-
 
1117
	}
-
 
1118
 
-
 
1119
	default:
990
      failer ("illegal type");
1120
		failer("illegal type");
991
  }
1121
	}
992
  return;
1122
	return;
993
}
1123
}
994
 
1124
 
995
 
1125
 
-
 
1126
void
996
void dw2_out_all_types
1127
dw2_out_all_types(void)
997
    PROTO_Z ()
-
 
998
{
1128
{
999
  while (needed_types) {
1129
	while (needed_types) {
1000
    dg_type dt = needed_types;
1130
		dg_type dt = needed_types;
1001
    needed_types = needed_types->type_queue;
1131
		needed_types = needed_types->type_queue;
1002
    if (dt->key != DGT_TAGGED || !dt->data.t_tag->done)
1132
		if (dt->key != DGT_TAGGED || !dt->data.t_tag->done) {
1003
      dw_out_type (dt);
1133
			dw_out_type(dt);
1004
  }
1134
		}
-
 
1135
	}
1005
  return;
1136
	return;
1006
}
1137
}