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

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/diag/diag_fns.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 106... Line 136...
106
diag_tq f_dummy_diag_tq;
136
diag_tq f_dummy_diag_tq;
107
filename f_dummy_filename;
137
filename f_dummy_filename;
108
sourcemark f_dummy_sourcemark;
138
sourcemark f_dummy_sourcemark;
109
 
139
 
110
 
140
 
111
#define DEBUG(x) x
141
#define DEBUG(x)	x
112
 
142
 
113
 
143
 
114
static dg_filename primary_file = (dg_filename)0;
144
static dg_filename primary_file = (dg_filename)0;
115
 
145
 
116
static nat zero_nat;
146
static nat zero_nat;
117
 
147
 
118
 
148
 
119
static dg_tag
-
 
120
	dg_tag_void_star,
-
 
121
	dg_tag_signed_char, dg_tag_unsigned_char,
149
static dg_tag dg_tag_void_star, dg_tag_signed_char, dg_tag_unsigned_char,
122
	dg_tag_short, dg_tag_unsigned_short,
150
	      dg_tag_short, dg_tag_unsigned_short, dg_tag_int,
123
	dg_tag_int, dg_tag_unsigned_int,
-
 
124
	dg_tag_long_long, dg_tag_unsigned_long_long,
151
	      dg_tag_unsigned_int, dg_tag_long_long, dg_tag_unsigned_long_long,
125
	dg_tag_float, dg_tag_double, dg_tag_long_double,
152
	      dg_tag_float, dg_tag_double, dg_tag_long_double, dg_tag_complex,
126
	dg_tag_complex, dg_tag_double_complex, dg_tag_long_double_complex;
153
	      dg_tag_double_complex, dg_tag_long_double_complex;
127
 
154
 
128
 
155
 
129
extern shape shcomplexsh;
156
extern shape shcomplexsh;
130
extern shape complexsh;
157
extern shape complexsh;
131
extern shape complexdoublesh;
158
extern shape complexdoublesh;
132
 
159
 
133
static dg_tag make_bastype
160
static dg_tag
134
    PROTO_N ( (s) )
-
 
135
    PROTO_T ( char * s )
161
make_bastype(char *s)
136
{
-
 
137
  dg_tag ans = (dgtag_struct *) xmalloc (sizeof(dgtag_struct));
-
 
138
  init_dgtag (ans);
-
 
139
  ans->outref.k = LAB_STR;
-
 
140
  ans->outref.u.s = s;
-
 
141
  return ans;
-
 
142
}
-
 
143
 
-
 
144
static int tags_initialised = 0;
-
 
145
 
-
 
146
static void init_basic_diag_tags
-
 
147
    PROTO_Z ()
-
 
148
{
-
 
149
  dg_tag_void_star		= make_bastype ("__D_void_star");
-
 
150
  dg_tag_signed_char		= make_bastype ("__D_signed_char");
-
 
151
  dg_tag_unsigned_char		= make_bastype ("__D_unsigned_char");
-
 
152
  dg_tag_short			= make_bastype ("__D_short");
-
 
153
  dg_tag_unsigned_short		= make_bastype ("__D_unsigned_short");
-
 
154
  dg_tag_int			= make_bastype ("__D_int");
-
 
155
  dg_tag_unsigned_int		= make_bastype ("__D_unsigned_int");
-
 
156
  dg_tag_long_long		= make_bastype ("__D_long_long");
-
 
157
  dg_tag_unsigned_long_long	= make_bastype ("__D_unsigned_long_long");
-
 
158
  dg_tag_float			= make_bastype ("__D_float");
-
 
159
  dg_tag_double			= make_bastype ("__D_double");
-
 
160
  dg_tag_long_double		= make_bastype ("__D_long_double");
-
 
161
  dg_tag_complex		= make_bastype ("__D_complex");
-
 
162
  dg_tag_double_complex		= make_bastype ("__D_double_complex");
-
 
163
  dg_tag_long_double_complex	= make_bastype ("__D_long double_complex");
-
 
164
  tags_initialised = 1;
-
 
165
}
-
 
166
 
-
 
167
static shape basic_tag_shape
-
 
168
    PROTO_N ( (t) )
-
 
169
    PROTO_T ( dg_tag t )
-
 
170
{
-
 
171
  if (t == dg_tag_void_star)
-
 
172
    return f_pointer (f_alignment (scharsh));
-
 
173
  if (t == dg_tag_signed_char)
-
 
174
    return scharsh;
-
 
175
  if (t == dg_tag_unsigned_char)
-
 
176
    return ucharsh;
-
 
177
  if (t == dg_tag_short)
-
 
178
    return swordsh;
-
 
179
  if (t == dg_tag_unsigned_short)
-
 
180
    return uwordsh;
-
 
181
  if (t == dg_tag_int)
-
 
182
    return slongsh;
-
 
183
  if (t == dg_tag_unsigned_int)
-
 
184
    return ulongsh;
-
 
185
  if (t == dg_tag_long_long)
-
 
186
    return s64sh;
-
 
187
  if (t == dg_tag_unsigned_long_long)
-
 
188
    return u64sh;
-
 
189
  if (t == dg_tag_float)
-
 
190
    return shrealsh;
-
 
191
  if (t == dg_tag_double)
-
 
192
    return realsh;
-
 
193
  if (t == dg_tag_long_double)
-
 
194
    return doublesh;
-
 
195
  if (t == dg_tag_complex)
-
 
196
    return shcomplexsh;
-
 
197
  if (t == dg_tag_double_complex)
-
 
198
    return complexsh;
-
 
199
  if (t == dg_tag_long_double_complex)
-
 
200
    return complexdoublesh;
-
 
201
  failer ("unexpected bitfield type");
-
 
202
  return slongsh;
-
 
203
}
-
 
204
 
-
 
205
 
-
 
206
 
-
 
207
 
-
 
208
 
-
 
209
/*----------------------- diagdef and diag_descriptor  lists ----------------*/
-
 
210
 
-
 
211
void start_make_diagdef_unit
-
 
212
    PROTO_N ( (toks, tags, als, diagtags) )
-
 
213
    PROTO_T ( int toks X int tags X int als X int diagtags )
-
 
214
{
-
 
215
  int i;
-
 
216
 
-
 
217
  if (!tags_initialised)
-
 
218
    init_basic_diag_tags ();
-
 
219
 
-
 
220
  unit_no_of_tokens = toks;
-
 
221
  unit_ind_tokens = (tok_define * *)xcalloc(unit_no_of_tokens,
-
 
222
                    sizeof(tok_define *));
-
 
223
  for (i = 0; i < unit_no_of_tokens; ++i)
-
 
224
    unit_ind_tokens[i] = (tok_define*)0;
-
 
225
 
-
 
226
  unit_no_of_tags = tags;
-
 
227
  unit_ind_tags = (dec * *)xcalloc(unit_no_of_tags,
-
 
228
                    sizeof(dec *));
-
 
229
  for (i = 0; i < unit_no_of_tags; ++i)
-
 
230
    unit_ind_tags[i] = (dec*)0;
-
 
231
 
-
 
232
  unit_no_of_als = als;
-
 
233
  unit_ind_als = (aldef * *)xcalloc(unit_no_of_als,
-
 
234
                    sizeof(aldef *));
-
 
235
  for (i = 0; i < unit_no_of_als; ++i)
-
 
236
    unit_ind_als[i] = (aldef*)0;
-
 
237
 
-
 
238
  unit_no_of_diagtags = diagtags;
-
 
239
  unit_ind_diagtags = (diag_tagdef * *)xcalloc(unit_no_of_diagtags,
-
 
240
                    sizeof(diag_tagdef *));
-
 
241
  for (i = 0; i < unit_no_of_diagtags; ++i)
-
 
242
    unit_ind_diagtags[i] = (diag_tagdef *)0;
-
 
243
 
-
 
244
  return;
-
 
245
}
-
 
246
 
-
 
247
void init_diag_unit
-
 
248
    PROTO_Z ()
-
 
249
{
-
 
250
  return;
-
 
251
}
-
 
252
 
-
 
253
diag_unit f_build_diag_unit
-
 
254
    PROTO_N ( (labels, descriptors) )
-
 
255
    PROTO_T ( tdfint labels X diag_descriptor_list descriptors )
-
 
256
{
-
 
257
  UNUSED(labels); UNUSED(descriptors);
-
 
258
  failer("f_build_diag_unit isn't really here");
-
 
259
  exit(EXIT_FAILURE);
-
 
260
}
-
 
261
 
-
 
262
diag_type_unit f_build_diagtype_unit
-
 
263
    PROTO_N ( (labels, descriptors) )
-
 
264
    PROTO_T ( tdfint labels X diag_tagdef_list descriptors )
-
 
265
{
-
 
266
  UNUSED(labels); UNUSED(descriptors);
-
 
267
  failer("f_build_diagtype_unit isn't really here");
-
 
268
  exit(EXIT_FAILURE);
-
 
269
}
-
 
270
 
-
 
271
 
-
 
272
void f_make_diagdef_unit
-
 
273
    PROTO_Z ()
-
 
274
{
-
 
275
  int i;
-
 
276
  int j = 0;
-
 
277
  int no_of_labels;
-
 
278
  int was_within_diags;
-
 
279
 
-
 
280
  for (i = 0; i < unit_no_of_tokens; ++i)
-
 
281
  {
-
 
282
    if (unit_ind_tokens[i] == (tok_define*)0)
-
 
283
      unit_ind_tokens[i] = &unit_toktab[j++];
-
 
284
  };
-
 
285
 
-
 
286
  j = 0;
-
 
287
  for (i = 0; i < unit_no_of_tags; ++i)
-
 
288
  {
-
 
289
    if (unit_ind_tags[i] == (dec*)0)
-
 
290
      unit_ind_tags[i] = &unit_tagtab[j++];
-
 
291
  };
-
 
292
 
-
 
293
  j = 0;
-
 
294
  for (i = 0; i < unit_no_of_als; ++i)
-
 
295
  {
-
 
296
    if (unit_ind_als[i] == (aldef*)0)
-
 
297
      unit_ind_als[i] = &unit_altab[j++];
-
 
298
  };
-
 
299
 
-
 
300
  j=0;
-
 
301
  for (i = 0; i < unit_no_of_diagtags; ++i)
-
 
302
  {
-
 
303
    if (unit_ind_diagtags[i] == (diag_tagdef *)0)
-
 
304
      unit_ind_diagtags[i] = &unit_diag_tagdeftab[j++];
-
 
305
  };
-
 
306
 
-
 
307
  was_within_diags = within_diags;
-
 
308
  within_diags = 1;
-
 
309
  {
-
 
310
    dg_compilation * comp_unit_ptr = &all_comp_units;
-
 
311
    dg_compilation ans;
-
 
312
    dg_name_list desc_list;
-
 
313
    while (* comp_unit_ptr)
-
 
314
      comp_unit_ptr = &(* comp_unit_ptr)->another;
-
 
315
    primary_file = (dg_filename)0;
-
 
316
    start_bytestream();
-
 
317
    no_of_labels = small_dtdfint();
-
 
318
    unit_no_of_labels = no_of_labels;
-
 
319
    unit_labtab = (exp*)xcalloc(unit_no_of_labels, sizeof(exp));
-
 
320
    desc_list = d_diag_descriptor_list();
-
 
321
    end_bytestream();
-
 
322
    if (!primary_file)
-
 
323
      primary_file = get_filename ((long)0, "", "", "no_source_file");
-
 
324
    (* comp_unit_ptr) = ans = (dg_compilation) xmalloc (sizeof (struct dg_comp_t));
-
 
325
    ans->prim_file = primary_file;
-
 
326
    ans->comp_deps = new_string_list (0);
-
 
327
    ans->date = 0;
-
 
328
    ans->language = 1;	/* assume ANSI C */
-
 
329
    ans->id_case = 0;	/* case sensitive */
-
 
330
    ans->producer = "TenDRA";
-
 
331
    ans->comp_dir = get_filename ((long)0, "", "unknown directory", "");
-
 
332
    ans->options = new_string_list (0);
-
 
333
    ans->dn_list = desc_list;
-
 
334
    ans->macros = new_dg_macro_list (0);
-
 
335
    ans->another = (dg_compilation)0;
-
 
336
  }
-
 
337
  within_diags = was_within_diags;
-
 
338
  return;
-
 
339
}
-
 
340
 
-
 
341
 
-
 
342
diag_descriptor f_diag_desc_id
-
 
343
    PROTO_N ( (n, whence, acc, new_type) )
-
 
344
    PROTO_T ( tdfstring n X sourcemark whence X exp acc X diag_type new_type )
-
 
345
{
-
 
346
  dg_idname nid;
-
 
347
  if (brog(son(acc))->dec_u.dec_val.extnamed)
-
 
348
    nid = f_dg_external_idname (n);
-
 
349
  else
-
 
350
    nid = f_dg_sourcestring_idname (n);
-
 
351
  if (new_type->key == DGT_PROC && !isvar(son(acc)))
-
 
352
    return f_dg_proc_name (
-
 
353
	nid,
-
 
354
	whence,
-
 
355
	new_type,
-
 
356
	yes_exp_option (diag_locate (acc)),
-
 
357
	no_dg_accessibility_option,
-
 
358
	no_dg_virtuality_option,
-
 
359
	f_false,
-
 
360
	no_dg_type_list_option,
-
 
361
	no_dg_tag_option);
-
 
362
  else
-
 
363
    return f_dg_object_name (
-
 
364
	nid,
-
 
365
	whence,
-
 
366
	new_type,
-
 
367
	yes_exp_option (diag_locate (acc)),
-
 
368
	no_dg_accessibility_option);
-
 
369
}
-
 
370
 
-
 
371
diag_descriptor f_diag_desc_struct
-
 
372
    PROTO_N ( (n, whence, new_type) )
-
 
373
    PROTO_T ( tdfstring n X sourcemark whence X diag_type new_type )
-
 
374
{
-
 
375
  UNUSED (n);
-
 
376
  UNUSED (whence);
-
 
377
  UNUSED (new_type);
-
 
378
  failer ("diag_desc_struct is obsolete");
-
 
379
  return f_dummy_diag_descriptor;
-
 
380
}
-
 
381
 
-
 
382
diag_descriptor f_diag_desc_typedef
-
 
383
    PROTO_N ( (n, whence, new_type) )
-
 
384
    PROTO_T ( tdfstring n X sourcemark whence X diag_type new_type )
-
 
385
{
162
{
-
 
163
	dg_tag ans = (dgtag_struct *)xmalloc(sizeof(dgtag_struct));
-
 
164
	init_dgtag(ans);
-
 
165
	ans->outref.k = LAB_STR;
-
 
166
	ans->outref.u.s = s;
-
 
167
	return ans;
-
 
168
}
-
 
169
 
-
 
170
 
-
 
171
static int tags_initialised = 0;
-
 
172
 
-
 
173
static void
-
 
174
init_basic_diag_tags(void)
-
 
175
{
-
 
176
	dg_tag_void_star	   = make_bastype("__D_void_star");
386
  if (!new_type || (new_type->key == DGT_TAGGED &&
177
	dg_tag_signed_char	   = make_bastype("__D_signed_char");
-
 
178
	dg_tag_unsigned_char	   = make_bastype("__D_unsigned_char");
-
 
179
	dg_tag_short		   = make_bastype("__D_short");
-
 
180
	dg_tag_unsigned_short	   = make_bastype("__D_unsigned_short");
387
		    new_type->data.t_tag->key == DGK_NONE))
181
	dg_tag_int		   = make_bastype("__D_int");
-
 
182
	dg_tag_unsigned_int	   = make_bastype("__D_unsigned_int");
-
 
183
	dg_tag_long_long	   = make_bastype("__D_long_long");
-
 
184
	dg_tag_unsigned_long_long  = make_bastype("__D_unsigned_long_long");
-
 
185
	dg_tag_float		   = make_bastype("__D_float");
-
 
186
	dg_tag_double		   = make_bastype("__D_double");
-
 
187
	dg_tag_long_double	   = make_bastype("__D_long_double");
-
 
188
	dg_tag_complex		   = make_bastype("__D_complex");
-
 
189
	dg_tag_double_complex	   = make_bastype("__D_double_complex");
388
    return (dg_name)0;		/* no type definition for __va_list etc */
190
	dg_tag_long_double_complex = make_bastype("__D_long double_complex");
-
 
191
	tags_initialised = 1;
-
 
192
}
-
 
193
 
-
 
194
 
-
 
195
static
-
 
196
shape basic_tag_shape(dg_tag t)
-
 
197
{
-
 
198
	if (t == dg_tag_void_star) {
-
 
199
		return f_pointer(f_alignment(scharsh));
-
 
200
	}
-
 
201
	if (t == dg_tag_signed_char) {
-
 
202
		return scharsh;
-
 
203
	}
-
 
204
	if (t == dg_tag_unsigned_char) {
-
 
205
		return ucharsh;
-
 
206
	}
-
 
207
	if (t == dg_tag_short) {
-
 
208
		return swordsh;
-
 
209
	}
-
 
210
	if (t == dg_tag_unsigned_short) {
-
 
211
		return uwordsh;
-
 
212
	}
389
  return f_dg_type_name (
213
	if (t == dg_tag_int) {
-
 
214
		return slongsh;
-
 
215
	}
-
 
216
	if (t == dg_tag_unsigned_int) {
-
 
217
		return ulongsh;
-
 
218
	}
390
	f_dg_sourcestring_idname (n),
219
	if (t == dg_tag_long_long) {
-
 
220
		return s64sh;
-
 
221
	}
-
 
222
	if (t == dg_tag_unsigned_long_long) {
-
 
223
		return u64sh;
-
 
224
	}
-
 
225
	if (t == dg_tag_float) {
-
 
226
		return shrealsh;
-
 
227
	}
-
 
228
	if (t == dg_tag_double) {
-
 
229
		return realsh;
-
 
230
	}
-
 
231
	if (t == dg_tag_long_double) {
-
 
232
		return doublesh;
-
 
233
	}
-
 
234
	if (t == dg_tag_complex) {
-
 
235
		return shcomplexsh;
-
 
236
	}
-
 
237
	if (t == dg_tag_double_complex) {
-
 
238
		return complexsh;
-
 
239
	}
-
 
240
	if (t == dg_tag_long_double_complex) {
-
 
241
		return complexdoublesh;
-
 
242
	}
-
 
243
	failer("unexpected bitfield type");
-
 
244
	return slongsh;
-
 
245
}
-
 
246
 
-
 
247
 
-
 
248
/*----------------------- diagdef and diag_descriptor  lists ----------------*/
-
 
249
 
-
 
250
void
-
 
251
start_make_diagdef_unit(int toks, int tags, int als, int diagtags)
-
 
252
{
391
	whence,
253
	int i;
-
 
254
 
-
 
255
	if (!tags_initialised) {
392
	no_dg_accessibility_option,
256
		init_basic_diag_tags();
-
 
257
	}
-
 
258
 
-
 
259
	unit_no_of_tokens = toks;
-
 
260
	unit_ind_tokens = (tok_define **)xcalloc(unit_no_of_tokens,
-
 
261
						 sizeof(tok_define *));
-
 
262
	for (i = 0; i < unit_no_of_tokens; ++i) {
393
	yes_dg_type_option (new_type),
263
		unit_ind_tokens[i] = (tok_define *)0;
-
 
264
	}
-
 
265
 
-
 
266
	unit_no_of_tags = tags;
-
 
267
	unit_ind_tags = (dec **)xcalloc(unit_no_of_tags, sizeof(dec *));
-
 
268
	for (i = 0; i < unit_no_of_tags; ++i) {
-
 
269
		unit_ind_tags[i] = (dec *)0;
-
 
270
	}
-
 
271
 
-
 
272
	unit_no_of_als = als;
-
 
273
	unit_ind_als = (aldef **)xcalloc(unit_no_of_als, sizeof(aldef *));
-
 
274
	for (i = 0; i < unit_no_of_als; ++i) {
-
 
275
		unit_ind_als[i] = (aldef *)0;
-
 
276
	}
-
 
277
 
-
 
278
	unit_no_of_diagtags = diagtags;
-
 
279
	unit_ind_diagtags = (diag_tagdef **)xcalloc(unit_no_of_diagtags,
-
 
280
						    sizeof(diag_tagdef *));
-
 
281
	for (i = 0; i < unit_no_of_diagtags; ++i)
-
 
282
		unit_ind_diagtags[i] = (diag_tagdef *)0;
-
 
283
 
394
	f_false,
284
	return;
-
 
285
}
-
 
286
 
-
 
287
 
-
 
288
void
395
	no_bool_option,
289
init_diag_unit(void)
-
 
290
{
-
 
291
	return;
-
 
292
}
-
 
293
 
-
 
294
 
-
 
295
diag_unit
-
 
296
f_build_diag_unit(tdfint labels, diag_descriptor_list descriptors)
-
 
297
{
-
 
298
	UNUSED(labels);
396
	no_dg_constraint_list_option);
299
	UNUSED(descriptors);
-
 
300
	failer("f_build_diag_unit isn't really here");
-
 
301
	exit(EXIT_FAILURE);
397
}
302
}
398
 
303
 
399
void init_diag_descriptor
-
 
400
    PROTO_Z ()
-
 
401
{
-
 
402
  return;
-
 
403
}
-
 
404
 
-
 
405
diag_descriptor_list new_diag_descriptor_list
-
 
406
    PROTO_N ( (n) )
-
 
407
    PROTO_T ( int n )
-
 
408
{
-
 
409
  return new_dg_name_list (n);
-
 
410
}
-
 
411
 
-
 
412
diag_descriptor_list add_diag_descriptor_list
-
 
413
    PROTO_N ( (list, elem,index) )
-
 
414
    PROTO_T ( diag_descriptor_list list X diag_descriptor elem X int index )
-
 
415
{
-
 
416
  if (!elem)		/* no type definition for __va_list etc */
-
 
417
    return list;
-
 
418
  return add_dg_name_list (list, elem, index);
-
 
419
}
-
 
420
 
-
 
421
/*---------------------------- diag_tq--------------------------*/
-
 
422
 
-
 
423
diag_tq f_diag_tq_null = 0;
-
 
424
 
-
 
425
diag_tq f_add_diag_const
-
 
426
    PROTO_N ( (qual) )
-
 
427
    PROTO_T ( diag_tq qual )
-
 
428
{
-
 
429
  return (qual | (1 << DG_CONST_T));
-
 
430
}
-
 
431
 
-
 
432
diag_tq f_add_diag_volatile
-
 
433
    PROTO_N ( (qual) )
-
 
434
    PROTO_T ( diag_tq qual )
-
 
435
{
-
 
436
  return (qual | (1 << DG_VOL_T));
-
 
437
}
-
 
438
 
-
 
439
/*--------------------------diag_type -----------------------------*/
-
 
440
 
-
 
441
diag_type f_diag_type_null = (dg_type)0;
-
 
442
 
-
 
443
diag_type f_diag_type_apply_token
-
 
444
    PROTO_N ( (token_value, token_args) )
-
 
445
    PROTO_T ( token token_value X bitstream token_args )
-
 
446
{
-
 
447
   tokval v;
-
 
448
   v = apply_tok(token_value, token_args,  DIAG_TYPE_SORT, (tokval*)0);
-
 
449
   return v.tk_diag_type;
-
 
450
}
-
 
451
 
-
 
452
diag_type f_diag_array
-
 
453
    PROTO_N ( (element_type, stride, lower_bound, upper_bound, index_type) )
-
 
454
    PROTO_T ( diag_type element_type X exp stride X exp lower_bound X exp upper_bound X diag_type index_type )
-
 
455
{
-
 
456
  return f_dg_array_type (
-
 
457
	element_type,
-
 
458
	stride,
-
 
459
	no_bool_option,
-
 
460
	add_dg_dim_list (new_dg_dim_list (1),
-
 
461
		f_dg_bounds_dim (
-
 
462
			f_dg_static_bound (lower_bound),
-
 
463
			f_dg_static_bound (upper_bound),
-
 
464
			index_type),
-
 
465
		0));
-
 
466
}
-
 
467
 
-
 
468
diag_type f_diag_bitfield
-
 
469
    PROTO_N ( (typ, number_of_bits) )
-
 
470
    PROTO_T ( diag_type typ X nat number_of_bits )
-
 
471
{
-
 
472
  shape sha;
-
 
473
  if (typ->key == DGT_BASIC)
-
 
474
    sha = typ->data.t_bas.b_sh;
-
 
475
  else
-
 
476
  if (typ->key == DGT_ENUM)
-
 
477
    sha = typ->data.t_enum.sha;
-
 
478
  else
-
 
479
  if (typ->key == DGT_TAGGED && typ->data.t_tag->outref.k == LAB_STR)
-
 
480
    sha = basic_tag_shape (typ->data.t_tag);
-
 
481
  else {
-
 
482
    failer ("unexpected bitfield type");
-
 
483
    sha = slongsh;
-
 
484
  }
-
 
485
  return f_dg_bitfield_type (
-
 
486
	typ,
-
 
487
	f_bfvar_bits (((name(sha) & 1) ? 1 : 0), number_of_bits),
-
 
488
	sha);
-
 
489
}
-
 
490
 
-
 
491
 
-
 
492
diag_type f_diag_enum
-
 
493
    PROTO_N ( (base_type, enum_name, values) )
-
 
494
    PROTO_T ( diag_type base_type X tdfstring enum_name X enum_values_list values )
-
 
495
{
-
 
496
  UNUSED (base_type);
-
 
497
  return f_dg_enum_type (
-
 
498
	values,
-
 
499
	yes_dg_idname_option (f_dg_sourcestring_idname (enum_name)),
-
 
500
	no_dg_sourcepos_option,
-
 
501
	sh(son(values.array->value)),
-
 
502
	f_false);
-
 
503
}
-
 
504
 
-
 
505
 
-
 
506
diag_type f_diag_floating_variety
-
 
507
    PROTO_N ( (var) )
-
 
508
    PROTO_T ( floating_variety var )
-
 
509
{
-
 
510
  switch (var) {
-
 
511
    case shrealfv:
-
 
512
      return (f_dg_named_type (dg_tag_float));
-
 
513
    case realfv:
-
 
514
      return (f_dg_named_type (dg_tag_double));
-
 
515
    case doublefv:
-
 
516
      return (f_dg_named_type (dg_tag_long_double));
-
 
517
    case shcomplexfv:
-
 
518
      return (f_dg_named_type (dg_tag_complex));
-
 
519
    case complexfv:
-
 
520
      return (f_dg_named_type (dg_tag_double_complex));
-
 
521
    case complexdoublefv:
-
 
522
      return (f_dg_named_type (dg_tag_long_double_complex));
-
 
523
  }
-
 
524
  failer ("bad variety");
-
 
525
  return f_dummy_diag_type;
-
 
526
}
-
 
527
 
-
 
528
diag_type f_diag_loc
-
 
529
    PROTO_N ( (object, qualifier) )
-
 
530
    PROTO_T ( diag_type object X diag_tq qualifier )
-
 
531
{
-
 
532
  if (qualifier & (1 << DG_CONST_T))
-
 
533
    object = f_dg_qualified_type (DG_CONST_T, object);
-
 
534
  if (qualifier & (1 << DG_VOL_T))
-
 
535
    object = f_dg_qualified_type (DG_VOL_T, object);
-
 
536
  return object;
-
 
537
}
-
 
538
 
-
 
539
diag_type f_diag_proc
-
 
540
    PROTO_N ( (params, optional_args, result_type) )
-
 
541
    PROTO_T ( diag_type_list params X bool optional_args X diag_type result_type )
-
 
542
{
-
 
543
  int i;
-
 
544
  dg_param_list plist;
-
 
545
  dg_param thispar;
-
 
546
  procprops_option prps = no_procprops_option;
-
 
547
  if (params.len == 1 && !params.array[0])
-
 
548
    params.len = 0;
-
 
549
  plist = new_dg_param_list (params.len);
-
 
550
  for (i=0; i<params.len; i++) {
-
 
551
    if (!params.array[i])
-
 
552
      failer ("dummy parameter?");
-
 
553
    thispar = f_dg_object_param (
-
 
554
	no_dg_idname_option,
-
 
555
	no_dg_sourcepos_option,
-
 
556
	no_dg_param_mode_option,
-
 
557
	params.array[i],
-
 
558
	no_dg_default_option);
-
 
559
    plist = add_dg_param_list (plist, thispar, i);
-
 
560
  }
-
 
561
  if (optional_args)
-
 
562
    prps = yes_procprops_option (f_var_callers);
-
 
563
  return f_dg_proc_type (plist, result_type, no_bool_option,
-
 
564
	no_nat_option, no_nat_option, prps);
-
 
565
}
-
 
566
 
-
 
567
 
-
 
568
diag_type f_diag_ptr
-
 
569
    PROTO_N ( (object, qualifier) )
-
 
570
    PROTO_T ( diag_type object X diag_tq qualifier )
-
 
571
{
-
 
572
  dg_type ptr = (object ? f_dg_pointer_type (object, no_bool_option)
-
 
573
			: f_dg_named_type (dg_tag_void_star));
-
 
574
  return f_diag_loc (ptr, qualifier);
-
 
575
}
-
 
576
 
-
 
577
diag_type f_diag_struct
-
 
578
    PROTO_N ( (tdf_shape, n, fields) )
-
 
579
    PROTO_T ( shape tdf_shape X tdfstring n X diag_field_list fields )
-
 
580
{
-
 
581
  return f_dg_struct_type (
-
 
582
	fields,
-
 
583
	yes_shape_option (tdf_shape),
-
 
584
	yes_dg_idname_option (f_dg_sourcestring_idname (n)),
-
 
585
	no_dg_sourcepos_option,
-
 
586
	no_dg_varpart_option,
-
 
587
	f_false,
-
 
588
	f_false);
-
 
589
}
-
 
590
 
-
 
591
diag_type f_diag_union
-
 
592
    PROTO_N ( (tdf_shape, n, fields) )
-
 
593
    PROTO_T ( shape tdf_shape X tdfstring n X diag_field_list fields )
-
 
594
{
-
 
595
  return f_dg_struct_type (
-
 
596
	fields,
-
 
597
	yes_shape_option (tdf_shape),
-
 
598
	yes_dg_idname_option (f_dg_sourcestring_idname (n)),
-
 
599
	no_dg_sourcepos_option,
-
 
600
	no_dg_varpart_option,
-
 
601
	f_true,
-
 
602
	f_false);
-
 
603
}
-
 
604
 
-
 
605
diag_type f_diag_variety
-
 
606
    PROTO_N ( (var) )
-
 
607
    PROTO_T ( variety var )
-
 
608
{
-
 
609
  switch (name(var)) {
-
 
610
    case scharhd:
-
 
611
      return (f_dg_named_type (dg_tag_signed_char));
-
 
612
    case ucharhd:
-
 
613
      return (f_dg_named_type (dg_tag_unsigned_char));
-
 
614
    case swordhd:
-
 
615
      return (f_dg_named_type (dg_tag_short));
-
 
616
    case uwordhd:
-
 
617
      return (f_dg_named_type (dg_tag_unsigned_short));
-
 
618
    case slonghd:
-
 
619
      return (f_dg_named_type (dg_tag_int));
-
 
620
    case ulonghd:
-
 
621
      return (f_dg_named_type (dg_tag_unsigned_int));
-
 
622
    case s64hd:
-
 
623
      return (f_dg_named_type (dg_tag_long_long));
-
 
624
    case u64hd:
-
 
625
      return (f_dg_named_type (dg_tag_unsigned_long_long));
-
 
626
  }
-
 
627
  failer ("bad variety");
-
 
628
  return f_dummy_diag_type;
-
 
629
}
-
 
630
 
-
 
631
void init_diag_type
-
 
632
    PROTO_Z ()
-
 
633
{
-
 
634
  zero_nat.nat_val.small_nat = 0;
-
 
635
  zero_nat.issmall = 1;
-
 
636
  return;
-
 
637
}
-
 
638
 
-
 
639
/*-------------------------- DIAG TYPE HELPERS ---------------------*/
-
 
640
/*---------------------------enum_values ---------------------------*/
-
 
641
 
-
 
642
enum_values f_make_enum_values
-
 
643
    PROTO_N ( (value, n) )
-
 
644
    PROTO_T ( exp value X tdfstring n )
-
 
645
{
-
 
646
  return f_make_dg_enum (
-
 
647
	value,
-
 
648
	f_dg_sourcestring_idname (n),
-
 
649
	f_dg_null_sourcepos);
-
 
650
}
-
 
651
 
-
 
652
void init_enum_values
-
 
653
    PROTO_Z ()
-
 
654
{
-
 
655
  return;
-
 
656
}
-
 
657
 
-
 
658
enum_values_list new_enum_values_list
-
 
659
    PROTO_N ( (n) )
-
 
660
    PROTO_T ( int n )
-
 
661
{
-
 
662
  return new_dg_enum_list (n);
-
 
663
}
-
 
664
 
-
 
665
enum_values_list add_enum_values_list
-
 
666
    PROTO_N ( (list, elem, index) )
-
 
667
    PROTO_T ( enum_values_list list X enum_values elem X int index )
-
 
668
{
-
 
669
  return add_dg_enum_list (list, elem, index);
-
 
670
}
-
 
671
 
304
 
672
/*--------------------------struct fields-------------------------*/
-
 
673
diag_field f_make_diag_field
305
diag_type_unit
674
    PROTO_N ( (field_name, wh, field_type) )
-
 
675
    PROTO_T ( tdfstring field_name X exp wh X diag_type field_type )
306
f_build_diagtype_unit(tdfint labels, diag_tagdef_list descriptors)
676
{
-
 
677
  return f_dg_field_classmem (
-
 
678
	f_dg_sourcestring_idname (field_name),
-
 
679
	f_dg_null_sourcepos,
-
 
680
	wh,
-
 
681
	field_type,
-
 
682
	no_dg_accessibility_option,
-
 
683
	no_bool_option,
-
 
684
	no_dg_default_option);
-
 
685
}
-
 
686
 
-
 
687
void init_diag_field
-
 
688
    PROTO_Z ()
-
 
689
{
307
{
-
 
308
	UNUSED(labels);
690
  return;
309
	UNUSED(descriptors);
-
 
310
	failer("f_build_diagtype_unit isn't really here");
-
 
311
	exit(EXIT_FAILURE);
691
}
312
}
692
 
313
 
693
diag_field_list new_diag_field_list
-
 
-
 
314
 
694
    PROTO_N ( (n) )
315
void
695
    PROTO_T ( int n )
316
f_make_diagdef_unit(void)
696
{
317
{
-
 
318
	int i;
-
 
319
	int j = 0;
-
 
320
	int no_of_labels;
-
 
321
	int was_within_diags;
-
 
322
 
-
 
323
	for (i = 0; i < unit_no_of_tokens; ++i) {
-
 
324
		if (unit_ind_tokens[i] == (tok_define *)0) {
-
 
325
			unit_ind_tokens[i] = &unit_toktab[j++];
-
 
326
		}
-
 
327
	}
-
 
328
 
-
 
329
	j = 0;
-
 
330
	for (i = 0; i < unit_no_of_tags; ++i) {
-
 
331
		if (unit_ind_tags[i] == (dec *)0) {
-
 
332
			unit_ind_tags[i] = &unit_tagtab[j++];
-
 
333
		}
-
 
334
	}
-
 
335
 
-
 
336
	j = 0;
-
 
337
	for (i = 0; i < unit_no_of_als; ++i) {
-
 
338
		if (unit_ind_als[i] == (aldef*)0) {
-
 
339
			unit_ind_als[i] = &unit_altab[j++];
-
 
340
		}
-
 
341
	}
-
 
342
 
-
 
343
	j=0;
-
 
344
	for (i = 0; i < unit_no_of_diagtags; ++i) {
-
 
345
		if (unit_ind_diagtags[i] == (diag_tagdef *)0) {
-
 
346
			unit_ind_diagtags[i] = &unit_diag_tagdeftab[j++];
-
 
347
		}
-
 
348
	}
-
 
349
 
-
 
350
	was_within_diags = within_diags;
-
 
351
	within_diags = 1;
-
 
352
	{
-
 
353
		dg_compilation *comp_unit_ptr = &all_comp_units;
-
 
354
		dg_compilation ans;
-
 
355
		dg_name_list desc_list;
-
 
356
		while (* comp_unit_ptr) {
-
 
357
			comp_unit_ptr = &(* comp_unit_ptr)->another;
-
 
358
		}
-
 
359
		primary_file = (dg_filename)0;
-
 
360
		start_bytestream();
-
 
361
		no_of_labels = small_dtdfint();
-
 
362
		unit_no_of_labels = no_of_labels;
-
 
363
		unit_labtab = (exp*)xcalloc(unit_no_of_labels, sizeof(exp));
-
 
364
		desc_list = d_diag_descriptor_list();
-
 
365
		end_bytestream();
-
 
366
		if (!primary_file) {
-
 
367
			primary_file = get_filename((long)0, "", "",
-
 
368
						    "no_source_file");
-
 
369
		}
-
 
370
		(*comp_unit_ptr) = ans =
-
 
371
		    (dg_compilation)xmalloc(sizeof(struct dg_comp_t));
-
 
372
		ans->prim_file = primary_file;
-
 
373
		ans->comp_deps = new_string_list(0);
-
 
374
		ans->date = 0;
-
 
375
		ans->language = 1;	/* assume ANSI C */
-
 
376
		ans->id_case = 0;	/* case sensitive */
-
 
377
		ans->producer = "TenDRA";
-
 
378
		ans->comp_dir = get_filename((long)0, "", "unknown directory",
-
 
379
					     "");
-
 
380
		ans->options = new_string_list(0);
-
 
381
		ans->dn_list = desc_list;
697
  return new_dg_classmem_list (n);
382
		ans->macros = new_dg_macro_list(0);
-
 
383
		ans->another = (dg_compilation)0;
-
 
384
	}
-
 
385
	within_diags = was_within_diags;
-
 
386
	return;
698
}
387
}
699
 
388
 
-
 
389
 
-
 
390
diag_descriptor
-
 
391
f_diag_desc_id(tdfstring n, sourcemark whence, exp acc, diag_type new_type)
-
 
392
{
-
 
393
	dg_idname nid;
-
 
394
	if (brog(son(acc))->dec_u.dec_val.extnamed) {
-
 
395
		nid = f_dg_external_idname(n);
-
 
396
	} else {
-
 
397
		nid = f_dg_sourcestring_idname(n);
-
 
398
	}
-
 
399
	if (new_type->key == DGT_PROC && !isvar(son(acc))) {
-
 
400
		return f_dg_proc_name(nid, whence, new_type,
-
 
401
				      yes_exp_option(diag_locate(acc)),
-
 
402
				      no_dg_accessibility_option,
-
 
403
				      no_dg_virtuality_option, f_false,
-
 
404
				      no_dg_type_list_option,
-
 
405
				      no_dg_tag_option);
-
 
406
	} else {
-
 
407
		return f_dg_object_name(nid, whence, new_type,
-
 
408
					yes_exp_option(diag_locate(acc)),
-
 
409
					no_dg_accessibility_option);
-
 
410
	}
-
 
411
}
-
 
412
 
-
 
413
 
-
 
414
diag_descriptor
-
 
415
f_diag_desc_struct(tdfstring n, sourcemark whence, diag_type new_type)
-
 
416
{
-
 
417
	UNUSED(n);
-
 
418
	UNUSED(whence);
-
 
419
	UNUSED(new_type);
-
 
420
	failer("diag_desc_struct is obsolete");
700
diag_field_list add_diag_field_list
421
	return f_dummy_diag_descriptor;
-
 
422
}
-
 
423
 
-
 
424
 
-
 
425
diag_descriptor
-
 
426
f_diag_desc_typedef(tdfstring n, sourcemark whence, diag_type new_type)
-
 
427
{
-
 
428
	if (!new_type ||
701
    PROTO_N ( (list, elem, index) )
429
	    (new_type->key == DGT_TAGGED &&
-
 
430
	     new_type->data.t_tag->key == DGK_NONE)) {
-
 
431
		/* no type definition for __va_list etc */
-
 
432
		return (dg_name)0;
-
 
433
	}
702
    PROTO_T ( diag_field_list list X diag_field elem X int index )
434
	return f_dg_type_name(f_dg_sourcestring_idname(n), whence,
-
 
435
			      no_dg_accessibility_option,
-
 
436
			      yes_dg_type_option(new_type), f_false,
-
 
437
			      no_bool_option, no_dg_constraint_list_option);
-
 
438
}
-
 
439
 
-
 
440
 
-
 
441
void
-
 
442
init_diag_descriptor(void)
-
 
443
{
-
 
444
	return;
-
 
445
}
-
 
446
 
-
 
447
 
-
 
448
diag_descriptor_list
-
 
449
new_diag_descriptor_list(int n)
703
{
450
{
1017
}
1051
}
1018
 
1052
 
1019
 
1053
 
1020
 
1054
 
1021
#else
1055
#else
1022
	/* !NEWDIAGS */
1056
	/* !NEWDIAGS */
1023
 
1057
 
1024
#if issparc
1058
#if issparc
1025
#include "sparcdiags.h"
1059
#include "sparcdiags.h"
1026
#endif
1060
#endif
1027
 
1061
 
1028
#if is68000
1062
#if is68000
1029
#include "xdb_basics.h"
1063
#include "xdb_basics.h"
1030
#endif
1064
#endif
1031
 
1065
 
Line 1040... Line 1074...
1040
 
1074
 
1041
/* allocate space in this file */
1075
/* allocate space in this file */
1042
#define EXTERN_DIAG
1076
#define EXTERN_DIAG
1043
 
1077
 
1044
#include "diagglob.h"
1078
#include "diagglob.h"
1045
 
1079
 
1046
#define DEBUG(x) x
1080
#define DEBUG(x)	x
1047
 
1081
 
1048
/* VARIABLES */
1082
/* VARIABLES */
1049
/* All variables initialised */
1083
/* All variables initialised */
1050
 
1084
 
1051
diag_tq f_diag_tq_null;	/* no need to initialise. Not really used. */
1085
diag_tq f_diag_tq_null;	/* no need to initialise. Not really used. */
1052
 
1086
 
1053
/* IDENTITIES */
1087
/* IDENTITIES */
1054
 
1088
 
1055
struct diag_type_t f_diag_type_null_obj = { DIAG_TYPE_NULL };
1089
struct diag_type_t f_diag_type_null_obj = { DIAG_TYPE_NULL };
1056
 
1090
 
1057
diag_type f_diag_type_null = &f_diag_type_null_obj;
1091
diag_type f_diag_type_null = &f_diag_type_null_obj;
1058
 
1092
 
1059
 
1093
 
1060
/* PROCEDURES */
1094
/* PROCEDURES */
1061
 
1095
 
1062
/*----------------------- diagdef and diag_descriptor  lists ----------------*/
1096
/*----------------------- diagdef and diag_descriptor  lists ----------------*/
1063
 
1097
 
1064
void start_make_diagdef_unit
1098
void
1065
    PROTO_N ( (toks, tags, als, diagtags) )
-
 
1066
    PROTO_T ( int toks X int tags X int als X int diagtags )
1099
start_make_diagdef_unit(int toks, int tags, int als, int diagtags)
1067
{
1100
{
1068
  int i;
1101
	int i;
1069
 
1102
 
1070
  unit_no_of_tokens = toks;
1103
	unit_no_of_tokens = toks;
1071
  unit_ind_tokens = (tok_define * *)xcalloc(unit_no_of_tokens,
1104
	unit_ind_tokens = (tok_define **)xcalloc(unit_no_of_tokens,
1072
                    sizeof(tok_define *));
1105
						 sizeof(tok_define *));
1073
  for (i = 0; i < unit_no_of_tokens; ++i)
1106
	for (i = 0; i < unit_no_of_tokens; ++i) {
1074
    unit_ind_tokens[i] = (tok_define*)0;
1107
		unit_ind_tokens[i] = (tok_define *)0;
-
 
1108
	}
-
 
1109
 
-
 
1110
	unit_no_of_tags = tags;
-
 
1111
	unit_ind_tags = (dec **)xcalloc(unit_no_of_tags, sizeof(dec *));
-
 
1112
	for (i = 0; i < unit_no_of_tags; ++i) {
-
 
1113
		unit_ind_tags[i] = (dec *)0;
-
 
1114
	}
-
 
1115
 
-
 
1116
	unit_no_of_als = als;
-
 
1117
	unit_ind_als = (aldef **)xcalloc(unit_no_of_als, sizeof(aldef *));
-
 
1118
	for (i = 0; i < unit_no_of_als; ++i) {
-
 
1119
		unit_ind_als[i] = (aldef *)0;
-
 
1120
	}
-
 
1121
 
-
 
1122
	unit_no_of_diagtags = diagtags;
-
 
1123
	unit_ind_diagtags = (diag_tagdef **)xcalloc(unit_no_of_diagtags,
-
 
1124
						    sizeof(diag_tagdef *));
-
 
1125
	for (i = 0; i < unit_no_of_diagtags; ++i) {
-
 
1126
		unit_ind_diagtags[i] = (diag_tagdef *)0;
-
 
1127
	}
-
 
1128
 
-
 
1129
	return;
-
 
1130
}
-
 
1131
 
-
 
1132
 
-
 
1133
void
-
 
1134
init_diag_unit(void)
-
 
1135
{
-
 
1136
	return;
-
 
1137
}
-
 
1138
 
-
 
1139
 
-
 
1140
diag_unit
-
 
1141
f_build_diag_unit(tdfint labels, diag_descriptor_list descriptors)
-
 
1142
{
-
 
1143
	UNUSED(labels);
-
 
1144
	UNUSED(descriptors);
-
 
1145
	failer("f_build_diag_unit isn't really here");
-
 
1146
	exit(EXIT_FAILURE);
-
 
1147
}
-
 
1148
 
-
 
1149
 
-
 
1150
diag_type_unit
-
 
1151
f_build_diagtype_unit(tdfint labels, diag_tagdef_list descriptors)
-
 
1152
{
-
 
1153
	UNUSED(labels);
-
 
1154
	UNUSED(descriptors);
-
 
1155
	failer("f_build_diagtype_unit isn't really here");
-
 
1156
	exit(EXIT_FAILURE);
-
 
1157
}
-
 
1158
 
1075
 
1159
 
1076
  unit_no_of_tags = tags;
1160
void
1077
  unit_ind_tags = (dec * *)xcalloc(unit_no_of_tags,
-
 
1078
                    sizeof(dec *));
-
 
1079
  for (i = 0; i < unit_no_of_tags; ++i)
-
 
1080
    unit_ind_tags[i] = (dec*)0;
1161
f_make_diagdef_unit(void)
1081
 
1162
{
1082
  unit_no_of_als = als;
1163
	int i;
1083
  unit_ind_als = (aldef * *)xcalloc(unit_no_of_als,
-
 
1084
                    sizeof(aldef *));
-
 
1085
  for (i = 0; i < unit_no_of_als; ++i)
-
 
1086
    unit_ind_als[i] = (aldef*)0;
1164
	int j = 0;
1087
 
-
 
1088
  unit_no_of_diagtags = diagtags;
1165
	int no_of_labels;
1089
  unit_ind_diagtags = (diag_tagdef * *)xcalloc(unit_no_of_diagtags,
-
 
1090
                    sizeof(diag_tagdef *));
-
 
1091
  for (i = 0; i < unit_no_of_diagtags; ++i)
-
 
1092
    unit_ind_diagtags[i] = (diag_tagdef *)0;
-
 
1093
 
1166
 
-
 
1167
	for (i = 0; i < unit_no_of_tokens; ++i) {
-
 
1168
		if (unit_ind_tokens[i] == (tok_define *)0)
-
 
1169
			unit_ind_tokens[i] = &unit_toktab[j++];
-
 
1170
	}
-
 
1171
 
1094
  return;
1172
	j = 0;
-
 
1173
	for (i = 0; i < unit_no_of_tags; ++i) {
-
 
1174
		if (unit_ind_tags[i] == (dec *)0) {
-
 
1175
			unit_ind_tags[i] = &unit_tagtab[j++];
-
 
1176
		}
-
 
1177
	}
-
 
1178
 
-
 
1179
	j = 0;
-
 
1180
	for (i = 0; i < unit_no_of_als; ++i) {
-
 
1181
		if (unit_ind_als[i] == (aldef *)0) {
-
 
1182
			unit_ind_als[i] = &unit_altab[j++];
-
 
1183
		}
-
 
1184
	}
-
 
1185
 
-
 
1186
	j=0;
-
 
1187
	for (i = 0; i < unit_no_of_diagtags; ++i) {
-
 
1188
		if (unit_ind_diagtags[i] == (diag_tagdef *)0) {
-
 
1189
			unit_ind_diagtags[i] = &unit_diag_tagdeftab[j++];
-
 
1190
		}
1095
}
1191
	}
1096
 
1192
 
1097
void init_diag_unit
1193
	start_bytestream();
1098
    PROTO_Z ()
-
 
1099
{
-
 
1100
  return;
-
 
1101
}
-
 
1102
 
-
 
1103
diag_unit f_build_diag_unit
1194
	no_of_labels = small_dtdfint();
1104
    PROTO_N ( (labels, descriptors) )
1195
	unit_no_of_labels = no_of_labels;
1105
    PROTO_T ( tdfint labels X diag_descriptor_list descriptors )
1196
	unit_labtab = (exp *)xcalloc(unit_no_of_labels, sizeof(exp));
1106
{
-
 
1107
  UNUSED(labels); UNUSED(descriptors);
1197
	unit_diagvar_tab = d_diag_descriptor_list();
1108
  failer("f_build_diag_unit isn't really here");
1198
	end_bytestream();
1109
  exit(EXIT_FAILURE);
1199
	OUTPUT_GLOBALS_TAB();
-
 
1200
	return;
1110
}
1201
}
1111
 
1202
 
1112
diag_type_unit f_build_diagtype_unit
-
 
1113
    PROTO_N ( (labels, descriptors) )
-
 
1114
    PROTO_T ( tdfint labels X diag_tagdef_list descriptors )
-
 
1115
{
-
 
1116
  UNUSED(labels); UNUSED(descriptors);
-
 
1117
  failer("f_build_diagtype_unit isn't really here");
-
 
1118
  exit(EXIT_FAILURE);
-
 
1119
}
-
 
1120
 
-
 
1121
 
-
 
1122
void f_make_diagdef_unit
-
 
1123
    PROTO_Z ()
-
 
1124
{
-
 
1125
  int i;
-
 
1126
  int j = 0;
-
 
1127
  int no_of_labels;
-
 
1128
 
-
 
1129
  for (i = 0; i < unit_no_of_tokens; ++i)
-
 
1130
  {
-
 
1131
    if (unit_ind_tokens[i] == (tok_define*)0)
-
 
1132
      unit_ind_tokens[i] = &unit_toktab[j++];
-
 
1133
  };
-
 
1134
 
-
 
1135
  j = 0;
-
 
1136
  for (i = 0; i < unit_no_of_tags; ++i)
-
 
1137
  {
-
 
1138
    if (unit_ind_tags[i] == (dec*)0)
-
 
1139
      unit_ind_tags[i] = &unit_tagtab[j++];
-
 
1140
  };
-
 
1141
 
-
 
1142
  j = 0;
-
 
1143
  for (i = 0; i < unit_no_of_als; ++i)
-
 
1144
  {
-
 
1145
    if (unit_ind_als[i] == (aldef*)0)
-
 
1146
      unit_ind_als[i] = &unit_altab[j++];
-
 
1147
  };
-
 
1148
 
-
 
1149
  j=0;
-
 
1150
  for (i = 0; i < unit_no_of_diagtags; ++i)
-
 
1151
  {
-
 
1152
    if (unit_ind_diagtags[i] == (diag_tagdef *)0)
-
 
1153
      unit_ind_diagtags[i] = &unit_diag_tagdeftab[j++];
-
 
1154
  };
-
 
1155
 
-
 
1156
  start_bytestream();
-
 
1157
  no_of_labels = small_dtdfint();
-
 
1158
  unit_no_of_labels = no_of_labels;
-
 
1159
  unit_labtab = (exp*)xcalloc(unit_no_of_labels, sizeof(exp));
-
 
1160
  unit_diagvar_tab = d_diag_descriptor_list();
-
 
1161
  end_bytestream();
-
 
1162
  OUTPUT_GLOBALS_TAB();
-
 
1163
  return;
-
 
1164
}
-
 
1165
 
1203
 
1166
/*---------------------- diag_descriptor fns --------------------*/
1204
/*---------------------- diag_descriptor fns --------------------*/
1167
 
1205
 
1168
				/* HACK attack */
1206
				/* HACK attack */
1169
				/* since diag_descriptor are not a pointer
1207
				/* since diag_descriptor are not a pointer
1170
				 type we cant set the diag_global field
1208
				 type we cant set the diag_global field
1171
				 easily, so we CHEAT via a global */
1209
				 easily, so we CHEAT via a global */
1172
 
1210
 
1173
static diag_descriptor * last_diag_desc;
1211
static diag_descriptor *last_diag_desc;
1174
 
1212
 
1175
diag_descriptor f_diag_desc_id
1213
diag_descriptor
1176
    PROTO_N ( (n, whence, acc, new_type) )
-
 
1177
    PROTO_T ( tdfstring n X sourcemark whence X exp acc X diag_type new_type )
1214
f_diag_desc_id(tdfstring n, sourcemark whence, exp acc, diag_type new_type)
1178
{
1215
{
1179
  diag_descriptor new;
1216
	diag_descriptor new;
1180
 
1217
 
1181
  if (name(acc) != name_tag)
1218
	if (name(acc) != name_tag) {
1182
    failer("No name in f_diag_desc_id");
1219
		failer("No name in f_diag_desc_id");
-
 
1220
	}
1183
 
1221
 
1184
  new.key	 	= DIAG_ID_KEY;
1222
	new.key	= DIAG_ID_KEY;
1185
  new.data.id.nme 	= n;
1223
	new.data.id.nme = n;
1186
  new.data.id.whence	= whence;
1224
	new.data.id.whence = whence;
1187
  new.data.id.access	= acc;
1225
	new.data.id.access = acc;
1188
  new.data.id.new_type	= new_type;
1226
	new.data.id.new_type = new_type;
1189
 
1227
 
1190
  brog(son(acc))->dec_u.dec_val.diag_info =
1228
	brog(son(acc))->dec_u.dec_val.diag_info =
1191
    NEW_DIAG_GLOBAL(last_diag_desc);
1229
	    NEW_DIAG_GLOBAL(last_diag_desc);
1192
 
1230
 
1193
  return new;
1231
	return new;
1194
}
1232
}
1195
 
1233
 
-
 
1234
 
-
 
1235
diag_descriptor
-
 
1236
f_diag_desc_struct(tdfstring n, sourcemark whence, diag_type new_type)
-
 
1237
{
1196
diag_descriptor f_diag_desc_struct
1238
	diag_descriptor new;
-
 
1239
 
-
 
1240
	new.key = DIAG_STRUCT_KEY;
-
 
1241
	new.data.struc.nme = n;
-
 
1242
	new.data.struc.whence = whence;
1197
    PROTO_N ( (n, whence, new_type) )
1243
	new.data.struc.new_type = new_type;
-
 
1244
 
-
 
1245
	return new;
-
 
1246
}
-
 
1247
 
-
 
1248
 
-
 
1249
diag_descriptor
1198
    PROTO_T ( tdfstring n X sourcemark whence X diag_type new_type )
1250
f_diag_desc_typedef(tdfstring n, sourcemark whence, diag_type new_type)
-
 
1251
{
-
 
1252
	diag_descriptor new;
-
 
1253
 
-
 
1254
	new.key = DIAG_TYPEDEF_KEY;
-
 
1255
	new.data.typ.nme = n;
-
 
1256
	new.data.typ.whence = whence;
-
 
1257
	new.data.typ.new_type = new_type;
-
 
1258
 
-
 
1259
	return new;
-
 
1260
}
-
 
1261
 
-
 
1262
 
-
 
1263
void
-
 
1264
init_diag_descriptor(void)
-
 
1265
{
-
 
1266
	return;
-
 
1267
}
-
 
1268
 
-
 
1269
 
-
 
1270
diag_descriptor_list
-
 
1271
new_diag_descriptor_list(int n)
-
 
1272
{
-
 
1273
	diag_descriptor_list new;
-
 
1274
 
-
 
1275
	new.len = n;
-
 
1276
	new.lastused = 0;
-
 
1277
	new.array = (diag_descriptor *)xcalloc(n, sizeof(diag_descriptor));
-
 
1278
	last_diag_desc = new.array;
-
 
1279
	return new;
-
 
1280
}
-
 
1281
 
-
 
1282
 
-
 
1283
diag_descriptor_list
-
 
1284
add_diag_descriptor_list(diag_descriptor_list list, diag_descriptor elem,
-
 
1285
			 int index)
1199
{
1286
{
1200
  diag_descriptor new;
-
 
1201
 
-
 
1202
  new.key	 	= DIAG_STRUCT_KEY;
-
 
1203
  new.data.struc.nme 	= n;
-
 
1204
  new.data.struc.whence	= whence;
-
 
1205
  new.data.struc.new_type	= new_type;
-
 
1206
 
-
 
1207
  return new;
-
 
1208
}
-
 
1209
 
-
 
1210
diag_descriptor f_diag_desc_typedef
-
 
1211
    PROTO_N ( (n, whence, new_type) )
-
 
1212
    PROTO_T ( tdfstring n X sourcemark whence X diag_type new_type )
-
 
1213
{
-
 
1214
  diag_descriptor new;
-
 
1215
 
-
 
1216
  new.key	 	= DIAG_TYPEDEF_KEY;
-
 
1217
  new.data.typ.nme 	= n;
-
 
1218
  new.data.typ.whence	= whence;
-
 
1219
  new.data.typ.new_type	= new_type;
-
 
1220
 
-
 
1221
  return new;
-
 
1222
}
-
 
1223
 
-
 
1224
void init_diag_descriptor
-
 
1225
    PROTO_Z ()
-
 
1226
{
-
 
1227
  return;
-
 
1228
}
-
 
1229
 
-
 
1230
diag_descriptor_list new_diag_descriptor_list
-
 
1231
    PROTO_N ( (n) )
-
 
1232
    PROTO_T ( int n )
-
 
1233
{
-
 
1234
  diag_descriptor_list new;
-
 
1235
 
-
 
1236
  new.len = n;
-
 
1237
  new.lastused = 0;
-
 
1238
  new.array = (diag_descriptor *) xcalloc(n,sizeof( diag_descriptor ));
-
 
1239
  last_diag_desc = new.array;
-
 
1240
  return new;
-
 
1241
}
-
 
1242
 
-
 
1243
diag_descriptor_list add_diag_descriptor_list
-
 
1244
    PROTO_N ( (list, elem,index) )
-
 
1245
    PROTO_T ( diag_descriptor_list list X diag_descriptor elem X int index )
-
 
1246
{
-
 
1247
  UNUSED(index);
1287
	UNUSED(index);
1248
  last_diag_desc++;
1288
	last_diag_desc++;
1249
  list.array[list.lastused++] = elem;
1289
	list.array[list.lastused++] = elem;
1250
  return list;
1290
	return list;
1251
}
1291
}
1252
 
1292
 
1253
/*---------------------------- diag_tq--------------------------*/
1293
/*---------------------------- diag_tq--------------------------*/
1254
 
1294
 
1255
 
1295
 
1256
diag_tq f_add_diag_const
-
 
1257
    PROTO_N ( (qual) )
-
 
1258
    PROTO_T ( diag_tq qual )
-
 
1259
{
-
 
1260
  diag_tq new;
1296
diag_tq
1261
  new = qual;
-
 
1262
  new.is_const = 1;
-
 
1263
  return new;
-
 
1264
}
-
 
1265
 
-
 
1266
diag_tq f_add_diag_volatile
-
 
1267
    PROTO_N ( (qual) )
-
 
1268
    PROTO_T ( diag_tq qual )
1297
f_add_diag_const(diag_tq qual)
1269
{
1298
{
1270
  diag_tq new;
1299
	diag_tq new;
1271
  new = qual;
1300
	new = qual;
1272
  new.is_volatile = 1;
1301
	new.is_const = 1;
1273
  return new;
-
 
1274
}
-
 
1275
 
-
 
1276
/*--------------------------diag_type -----------------------------*/
-
 
1277
 
-
 
1278
diag_type f_diag_type_apply_token
-
 
1279
    PROTO_N ( (token_value, token_args) )
-
 
1280
    PROTO_T ( token token_value X bitstream token_args )
-
 
1281
{
-
 
1282
   tokval v;
-
 
1283
   v = apply_tok(token_value, token_args,  DIAG_TYPE_SORT, (tokval*)0);
-
 
1284
   return v.tk_diag_type;
-
 
1285
}
-
 
1286
 
-
 
1287
#ifndef NULL
-
 
1288
#define NULL ((OUTPUT_REC)0)
-
 
1289
#endif
-
 
1290
 
-
 
1291
diag_type f_diag_array
-
 
1292
    PROTO_N ( (element_type, stride, lower_bound, upper_bound, index_type) )
-
 
1293
    PROTO_T ( diag_type element_type X exp stride X exp lower_bound X exp upper_bound X diag_type index_type )
-
 
1294
{
-
 
1295
  diag_type new = (diag_type) xcalloc(1,sizeof(struct diag_type_t));
-
 
1296
 
-
 
1297
  new->key	= DIAG_TYPE_ARRAY;
-
 
1298
  new->been_outed = 0;
-
 
1299
 
-
 
1300
  new->data.array.element_type	= element_type;
-
 
1301
  new->data.array.stride	= stride;
-
 
1302
  new->data.array.lower_b	= lower_bound;
-
 
1303
  new->data.array.upper_b	= upper_bound;
-
 
1304
  new->data.array.index_type	= index_type;
-
 
1305
 
-
 
1306
  return new;
-
 
1307
}
-
 
1308
 
-
 
1309
diag_type f_diag_bitfield
-
 
1310
    PROTO_N ( (type, number_of_bits) )
-
 
1311
    PROTO_T ( diag_type type X nat number_of_bits )
-
 
1312
{
-
 
1313
  diag_type new = (diag_type) xcalloc(1,sizeof(struct diag_type_t));
-
 
1314
 
-
 
1315
  new->key      = DIAG_TYPE_BITFIELD;
-
 
1316
  new->been_outed = 0;
-
 
1317
 
-
 
1318
  new->data.bitfield.result_type	= type;
-
 
1319
  new->data.bitfield.no_of_bits		= number_of_bits;
-
 
1320
 
-
 
1321
  return new;
-
 
1322
}
-
 
1323
 
-
 
1324
 
-
 
1325
diag_type f_diag_enum
-
 
1326
    PROTO_N ( (base_type, enum_name, values) )
-
 
1327
    PROTO_T ( diag_type base_type X tdfstring enum_name X enum_values_list values )
-
 
1328
{
-
 
1329
  diag_type new = (diag_type) xcalloc(1,sizeof(struct diag_type_t));
-
 
1330
 
-
 
1331
  new->key      = DIAG_TYPE_ENUM;
-
 
1332
  new->been_outed = 0;
-
 
1333
 
-
 
1334
  new->data.t_enum.base_type	= base_type;
-
 
1335
  new->data.t_enum.nme		= enum_name;
-
 
1336
  new->data.t_enum.values	= values;
-
 
1337
 
-
 
1338
  return new;
1302
	return new;
1339
}
-
 
1340
 
-
 
1341
 
-
 
1342
diag_type f_diag_floating_variety
-
 
1343
    PROTO_N ( (var) )
-
 
1344
    PROTO_T ( floating_variety var )
-
 
1345
{
-
 
1346
  diag_type new = (diag_type) xcalloc(1,sizeof(struct diag_type_t));
-
 
1347
 
-
 
1348
  new->key      = DIAG_TYPE_FLOAT;
-
 
1349
  new->been_outed = 0;
-
 
1350
 
-
 
1351
  new->data.f_var	= var;
-
 
1352
 
-
 
1353
  return new;
-
 
1354
}
-
 
1355
 
-
 
1356
diag_type f_diag_loc
-
 
1357
    PROTO_N ( (object, qualifier) )
-
 
1358
    PROTO_T ( diag_type object X diag_tq qualifier )
-
 
1359
{
-
 
1360
  diag_type new = (diag_type) xcalloc(1,sizeof(struct diag_type_t));
-
 
1361
 
-
 
1362
  new->key      = DIAG_TYPE_LOC;
-
 
1363
  new->been_outed = 0;
-
 
1364
 
-
 
1365
  new->data.loc.object		= object;
-
 
1366
  new->data.loc.qualifier	= qualifier;
-
 
1367
 
-
 
1368
  return new;
-
 
1369
}
1303
}
1370
 
1304
 
1371
diag_type f_diag_proc
-
 
1372
    PROTO_N ( (params, optional_args, result_type) )
-
 
1373
    PROTO_T ( diag_type_list params X bool optional_args X diag_type result_type )
-
 
1374
{
-
 
1375
  diag_type new = (diag_type) xcalloc(1,sizeof(struct diag_type_t));
-
 
1376
 
-
 
1377
  new->key      = DIAG_TYPE_PROC;
-
 
1378
  new->been_outed = 0;
-
 
1379
 
1305
 
-
 
1306
diag_tq
1380
  new->data.proc.params		= params;
1307
f_add_diag_volatile(diag_tq qual)
-
 
1308
{
-
 
1309
	diag_tq new;
1381
  new->data.proc.opt_args	= optional_args;
1310
	new = qual;
1382
  new->data.proc.result_type	= result_type;
1311
	new.is_volatile = 1;
-
 
1312
	return new;
-
 
1313
}
-
 
1314
 
1383
 
1315
 
1384
  return new;
1316
/*--------------------------diag_type -----------------------------*/
1385
}
-
 
1386
 
1317
 
1387
 
-
 
1388
diag_type f_diag_ptr
1318
diag_type
1389
    PROTO_N ( (object, qualifier) )
-
 
1390
    PROTO_T ( diag_type object X diag_tq qualifier )
1319
f_diag_type_apply_token(token token_value, bitstream token_args)
1391
{
1320
{
1454
 
1492
 
1455
/*-------------------------- DIAG TYPE HELPERS ---------------------*/
1493
/*-------------------------- DIAG TYPE HELPERS ---------------------*/
1456
/*---------------------------enum_values ---------------------------*/
1494
/*---------------------------enum_values ---------------------------*/
1457
 
1495
 
-
 
1496
enum_values
1458
enum_values f_make_enum_values
1497
f_make_enum_values(exp value, tdfstring n)
-
 
1498
{
-
 
1499
	enum_values new = (enum_values)xcalloc(1, sizeof(struct enum_values_t));
-
 
1500
 
-
 
1501
	new->val = value;
-
 
1502
	new->nme = n;
-
 
1503
 
-
 
1504
	return new;
-
 
1505
}
-
 
1506
 
-
 
1507
 
-
 
1508
void
1459
    PROTO_N ( (value, n) )
1509
init_enum_values(void)
-
 
1510
{
-
 
1511
	return;
-
 
1512
}
-
 
1513
 
-
 
1514
 
-
 
1515
enum_values_list
1460
    PROTO_T ( exp value X tdfstring n )
1516
new_enum_values_list(int n)
-
 
1517
{
-
 
1518
	enum_values_list new =
-
 
1519
	    (enum_values_list)xcalloc(1, sizeof(struct enum_values_list_t));
-
 
1520
 
-
 
1521
	new->len = n;
-
 
1522
	new->lastused = 0;
-
 
1523
	new->array = (enum_values *)xcalloc(n, sizeof(enum_values));
-
 
1524
	return new;
-
 
1525
}
-
 
1526
 
-
 
1527
 
-
 
1528
enum_values_list
-
 
1529
add_enum_values_list(enum_values_list list, enum_values elem, int index)
-
 
1530
{
-
 
1531
	UNUSED(index);
-
 
1532
	list->array[list->lastused++] = elem;
-
 
1533
	return list;
-
 
1534
}
-
 
1535
 
-
 
1536
 
-
 
1537
/*--------------------------struct fields-------------------------*/
-
 
1538
 
-
 
1539
diag_field
-
 
1540
f_make_diag_field(tdfstring field_name, exp wh, diag_type field_type)
-
 
1541
{
-
 
1542
	diag_field new = (diag_field)xcalloc(1, sizeof(struct diag_field_t));
-
 
1543
 
-
 
1544
	new->field_name	= field_name;
-
 
1545
	new->where = wh;
-
 
1546
	new->field_type	= field_type;
-
 
1547
 
-
 
1548
	return new;
-
 
1549
}
-
 
1550
 
-
 
1551
 
-
 
1552
void
-
 
1553
init_diag_field(void)
-
 
1554
{
-
 
1555
	return;
-
 
1556
}
-
 
1557
 
-
 
1558
 
-
 
1559
diag_field_list
-
 
1560
new_diag_field_list(int n)
-
 
1561
{
-
 
1562
	diag_field_list new =
-
 
1563
	    (diag_field_list)xcalloc(1, sizeof(struct diag_field_list_t));
-
 
1564
 
-
 
1565
	new->len = n;
-
 
1566
	new->lastused = 0;
-
 
1567
	new->array = (diag_field *)xcalloc(n, sizeof(diag_field));
-
 
1568
	return new;
-
 
1569
}
-
 
1570
 
-
 
1571
 
-
 
1572
diag_field_list
-
 
1573
add_diag_field_list(diag_field_list list, diag_field elem, int index)
-
 
1574
{
-
 
1575
	UNUSED(index);
-
 
1576
	list->array[list->lastused++] = elem;
-
 
1577
	return list;
-
 
1578
}
-
 
1579
 
-
 
1580
 
-
 
1581
/*----------------------diag type list----------------------*/
-
 
1582
 
-
 
1583
diag_type_list
-
 
1584
new_diag_type_list(int n)
1461
{
1585
{
-
 
1586
	diag_type_list new =
1462
  enum_values new = (enum_values) xcalloc(1,sizeof(struct enum_values_t));
1587
	    (diag_type_list)xcalloc(1, sizeof(struct diag_type_list_t));
1463
 
-
 
1464
  new->val	= value;
-
 
1465
  new->nme 	= n;
-
 
1466
 
1588
 
-
 
1589
	new->len = n;
-
 
1590
	new->lastused = 0;
-
 
1591
	new->array = (diag_type *)xcalloc(n, sizeof(diag_type));
1467
  return new;
1592
	return new;
1468
}
1593
}
1469
 
1594
 
-
 
1595
 
1470
void init_enum_values
1596
diag_type_list
1471
    PROTO_Z ()
1597
add_diag_type_list(diag_type_list list, diag_type elem, int index)
1472
{
1598
{
-
 
1599
	UNUSED(index);
-
 
1600
	list->array[list->lastused++] = elem;
1473
  return;
1601
	return list;
1474
}
1602
}
1475
 
1603
 
1476
enum_values_list new_enum_values_list
-
 
1477
    PROTO_N ( (n) )
-
 
1478
    PROTO_T ( int n )
-
 
1479
{
-
 
1480
  enum_values_list new = (enum_values_list)
-
 
1481
    xcalloc(1,sizeof(struct enum_values_list_t));
-
 
1482
 
-
 
1483
  new->len = n;
-
 
1484
  new->lastused = 0;
-
 
1485
  new->array = (enum_values *) xcalloc(n,sizeof( enum_values ));
-
 
1486
  return new;
-
 
1487
}
-
 
1488
 
-
 
1489
enum_values_list add_enum_values_list
-
 
1490
    PROTO_N ( (list, elem, index) )
-
 
1491
    PROTO_T ( enum_values_list list X enum_values elem X int index )
-
 
1492
{
-
 
1493
  UNUSED(index);
-
 
1494
  list->array[list->lastused++] = elem;
-
 
1495
  return list;
-
 
1496
}
-
 
1497
 
-
 
1498
/*--------------------------struct fields-------------------------*/
1604
/*----------------------------END HELPERS------------------------------------*/
1499
diag_field f_make_diag_field
-
 
1500
    PROTO_N ( (field_name, wh, field_type) )
-
 
1501
    PROTO_T ( tdfstring field_name X exp wh X diag_type field_type )
-
 
1502
{
-
 
1503
  diag_field new = (diag_field) xcalloc(1,sizeof(struct diag_field_t));
-
 
1504
 
-
 
1505
  new->field_name	= field_name;
-
 
1506
  new->where		= wh;
-
 
1507
  new->field_type	= field_type;
-
 
1508
 
-
 
1509
  return new;
-
 
1510
 
-
 
1511
}
-
 
1512
 
-
 
1513
void init_diag_field
-
 
1514
    PROTO_Z ()
-
 
1515
{
-
 
1516
  return;
-
 
1517
}
-
 
1518
 
-
 
1519
diag_field_list new_diag_field_list
-
 
1520
    PROTO_N ( (n) )
-
 
1521
    PROTO_T ( int n )
-
 
1522
{
-
 
1523
  diag_field_list new = (diag_field_list)
-
 
1524
    xcalloc(1,sizeof(struct diag_field_list_t));
-
 
1525
 
-
 
1526
  new->len = n;
-
 
1527
  new->lastused = 0;
-
 
1528
  new->array = (diag_field*) xcalloc(n,sizeof( diag_field));
-
 
1529
  return new;
-
 
1530
}
-
 
1531
 
-
 
1532
diag_field_list add_diag_field_list
-
 
1533
    PROTO_N ( (list, elem, index) )
-
 
1534
    PROTO_T ( diag_field_list list X diag_field elem X int index )
-
 
1535
{
-
 
1536
  UNUSED(index);
-
 
1537
  list->array[list->lastused++] = elem;
-
 
1538
  return list;
-
 
1539
}
-
 
1540
 
-
 
1541
/*----------------------diag type list----------------------*/
-
 
1542
diag_type_list new_diag_type_list
-
 
1543
    PROTO_N ( (n) )
-
 
1544
    PROTO_T ( int n )
-
 
1545
{
-
 
1546
  diag_type_list new = (diag_type_list)
-
 
1547
    xcalloc(1,sizeof(struct diag_type_list_t));
-
 
1548
 
-
 
1549
  new->len = n;
-
 
1550
  new->lastused = 0;
-
 
1551
  new->array = (diag_type *) xcalloc(n,sizeof( diag_type ));
-
 
1552
  return new;
-
 
1553
}
-
 
1554
 
1605
 
1555
diag_type_list add_diag_type_list
-
 
1556
    PROTO_N ( (list, elem,index) )
-
 
1557
    PROTO_T ( diag_type_list list X diag_type elem X int index )
-
 
1558
{
-
 
1559
  UNUSED(index);
-
 
1560
  list->array[list->lastused++] = elem;
-
 
1561
  return list;
-
 
1562
}
-
 
1563
/*----------------------------END HELPERS------------------------------------*/
-
 
1564
 
1606
 
1565
/*-------------------------- sourcemark ---------------------------------*/
1607
/*-------------------------- sourcemark ---------------------------------*/
1566
 
1608
 
1567
sourcemark f_make_sourcemark
1609
sourcemark
1568
    PROTO_N ( (file, line_no, char_offset) )
-
 
1569
    PROTO_T ( filename file X nat line_no X nat char_offset )
1610
f_make_sourcemark(filename file, nat line_no, nat char_offset)
1570
{
1611
{
1571
  sourcemark new;
1612
	sourcemark new;
1572
  new.file	= file;
1613
	new.file = file;
1573
  new.line_no	= line_no;
1614
	new.line_no = line_no;
1574
  new.char_off	= char_offset;
1615
	new.char_off = char_offset;
1575
 
1616
 
1576
  return new;
1617
	return new;
1577
}
1618
}
-
 
1619
 
1578
 
1620
 
-
 
1621
void
1579
void init_sourcemark
1622
init_sourcemark(void)
1580
    PROTO_Z ()
-
 
1581
{
1623
{
1582
  return;
1624
	return;
1583
}
1625
}
-
 
1626
 
1584
 
1627
 
1585
/*------------------------------filename ------------------------*/
1628
/*------------------------------filename ------------------------*/
1586
 
1629
 
1587
filename f_make_filename
1630
filename
1588
    PROTO_N ( (date, machine, file) )
-
 
1589
    PROTO_T ( nat date X tdfstring machine X tdfstring file )
1631
f_make_filename(nat date, tdfstring machine, tdfstring file)
1590
{
1632
{
1591
  filename new;
1633
	filename new;
1592
  new 	= (filename) xcalloc(1,sizeof(struct filename_t));
1634
	new = (filename)xcalloc(1, sizeof(struct filename_t));
1593
  new->date 	= date;
1635
	new->date = date;
1594
  new->machine	= machine;
1636
	new->machine = machine;
1595
  new->file 	= file;
1637
	new->file  = file;
1596
 
1638
 
1597
  INSPECT_FILENAME(new);
1639
	INSPECT_FILENAME(new);
1598
  return new;
1640
	return new;
1599
}
1641
}
1600
 
1642
 
1601
 
1643
 
1602
filename f_filename_apply_token
1644
filename
1603
    PROTO_N ( (token_value, token_args) )
-
 
1604
    PROTO_T ( token token_value X bitstream token_args )
1645
f_filename_apply_token(token token_value, bitstream token_args)
1605
{
1646
{
1606
   tokval v;
1647
	tokval v;
1607
   v = apply_tok(token_value, token_args, DIAG_FILENAME, (tokval*)0);
1648
	v = apply_tok(token_value, token_args, DIAG_FILENAME, (tokval *)0);
1608
   return v.tk_filename;
1649
	return v.tk_filename;
1609
}
1650
}
-
 
1651
 
1610
 
1652
 
1611
/*----------------------------- diag tag ------------------------------*/
1653
/*----------------------------- diag tag ------------------------------*/
-
 
1654
 
-
 
1655
void
-
 
1656
init_diag_tag(void)
-
 
1657
{
-
 
1658
	return;
-
 
1659
}
1612
 
1660
 
1613
 
1661
 
1614
void init_diag_tag
1662
diag_tag
1615
    PROTO_Z ()
1663
f_make_diag_tag(tdfint num)
1616
{
1664
{
1617
  return;
-
 
1618
}
-
 
1619
 
-
 
1620
diag_tag f_make_diag_tag
-
 
1621
    PROTO_N ( (num) )
-
 
1622
    PROTO_T ( tdfint num )
-
 
1623
{
-
 
1624
  return num;
1665
	return num;
1625
}
1666
}
1626
 
1667
 
1627
 
1668
 
1628
/*---------------------------- diag_tagdef =diag_typeunit ------------------*/
1669
/*---------------------------- diag_tagdef =diag_typeunit ------------------*/
1629
 
1670
 
1821
diag_descriptor f_dummy_diag_descriptor;
1862
diag_descriptor f_dummy_diag_descriptor;
1822
diag_tag f_dummy_diag_tag;
1863
diag_tag f_dummy_diag_tag;
1823
diag_tagdef f_dummy_diag_tagdef;
1864
diag_tagdef f_dummy_diag_tagdef;
1824
diag_type f_dummy_diag_type;
1865
diag_type f_dummy_diag_type;
1825
diag_tq f_dummy_diag_tq;
1866
diag_tq f_dummy_diag_tq;
1826
filename f_dummy_filename;
1867
filename f_dummy_filename;
1827
sourcemark f_dummy_sourcemark;
1868
sourcemark f_dummy_sourcemark;
1828
 
1869
 
1829
void init_diag_tq
-
 
1830
    PROTO_Z ()
-
 
1831
{
-
 
1832
  return;
-
 
1833
}
1870
void
1834
 
-
 
1835
void init_filename
1871
init_diag_tq(void)
1836
    PROTO_Z ()
-
 
1837
{
1872
{
1838
  return;
1873
	return;
1839
}
1874
}
1840
 
1875
 
1841
void init_diag_type_unit
-
 
1842
    PROTO_Z ()
-
 
1843
{
-
 
1844
  return;
-
 
1845
}
-
 
1846
 
1876
 
-
 
1877
void
1847
void init_linkinfo_props
1878
init_filename(void)
-
 
1879
{
-
 
1880
	return;
-
 
1881
}
-
 
1882
 
-
 
1883
 
-
 
1884
void
-
 
1885
init_diag_type_unit(void)
-
 
1886
{
-
 
1887
	return;
-
 
1888
}
-
 
1889
 
-
 
1890
 
-
 
1891
void
1848
    PROTO_Z ()
1892
init_linkinfo_props(void)
1849
{
1893
{
1850
  return;
1894
	return;
1851
}
1895
}
1852
 
-
 
1853
 
1896
 
1854
#endif
1897
#endif