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

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/dg_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 33... Line 63...
33
$Date: 1998/03/11 11:03:30 $
63
$Date: 1998/03/11 11:03:30 $
34
$Revision: 1.2 $
64
$Revision: 1.2 $
35
$Log: dg_fns.c,v $
65
$Log: dg_fns.c,v $
36
 * Revision 1.2  1998/03/11  11:03:30  pwe
66
 * Revision 1.2  1998/03/11  11:03:30  pwe
37
 * DWARF optimisation info
67
 * DWARF optimisation info
38
 *
68
 *
39
 * Revision 1.1.1.1  1998/01/17  15:55:46  release
69
 * Revision 1.1.1.1  1998/01/17  15:55:46  release
40
 * First version to be checked into rolling release.
70
 * First version to be checked into rolling release.
41
 *
71
 *
42
 * Revision 1.9  1998/01/11  18:44:53  pwe
72
 * Revision 1.9  1998/01/11  18:44:53  pwe
43
 * consistent new/old diags
73
 * consistent new/old diags
Line 60... Line 90...
60
 * Revision 1.3  1997/10/23  09:21:04  pwe
90
 * Revision 1.3  1997/10/23  09:21:04  pwe
61
 * ANDF-DE V1.7 and extra diags
91
 * ANDF-DE V1.7 and extra diags
62
 *
92
 *
63
 * Revision 1.2  1997/10/10  18:16:37  pwe
93
 * Revision 1.2  1997/10/10  18:16:37  pwe
64
 * prep ANDF-DE revision
94
 * prep ANDF-DE revision
65
 *
95
 *
66
 * Revision 1.1  1997/08/23  13:26:46  pwe
96
 * Revision 1.1  1997/08/23  13:26:46  pwe
67
 * initial ANDF-DE
97
 * initial ANDF-DE
68
 *
98
 *
69
***********************************************************************/
99
***********************************************************************/
70
 
100
 
Line 92... Line 122...
92
dg_filename all_files = (dg_filename)0;
122
dg_filename all_files = (dg_filename)0;
93
dg_compilation all_comp_units = (dg_compilation)0;
123
dg_compilation all_comp_units = (dg_compilation)0;
94
 
124
 
95
 
125
 
96
 
126
 
97
string_list new_string_list
127
string_list
98
    PROTO_N ( (n) )
-
 
99
    PROTO_T ( int n )
128
new_string_list(int n)
100
{
129
{
101
  string_list ans;
130
	string_list ans;
102
  ans.len = n;
131
	ans.len = n;
103
  ans.array = (char **)xcalloc(n, sizeof(char *));
132
	ans.array = (char **)xcalloc(n, sizeof(char *));
104
  return ans;
133
	return ans;
105
}
134
}
106
 
135
 
107
string_list add_string_list
-
 
108
    PROTO_N ( (list, elem, index) )
-
 
109
    PROTO_T ( string_list list X string elem X int index )
-
 
110
{
-
 
111
  list.array[index] = elem.ints.chars;
-
 
112
  return list;
-
 
113
}
-
 
114
 
-
 
115
bool_option no_bool_option;
-
 
116
 
-
 
117
bool_option yes_bool_option
-
 
118
    PROTO_N ( (elem) )
-
 
119
    PROTO_T ( bool elem )
-
 
120
{
-
 
121
  bool_option res;
-
 
122
  res.val = elem;
-
 
123
  res.present = 1;
-
 
124
  return res;
-
 
125
}
-
 
126
 
-
 
127
void init_bool_option
-
 
128
    PROTO_Z ()
-
 
129
{
-
 
130
  no_bool_option.present = 0;
-
 
131
  return;
-
 
132
}
-
 
133
 
-
 
134
shape_option no_shape_option;
-
 
135
 
-
 
136
shape_option yes_shape_option
-
 
137
    PROTO_N ( (elem) )
-
 
138
    PROTO_T ( shape elem )
-
 
139
{
-
 
140
  shape_option res;
-
 
141
  res.val = elem;
-
 
142
  res.present = 1;
-
 
143
  return res;
-
 
144
}
-
 
145
 
-
 
146
void init_shape_option
-
 
147
    PROTO_Z ()
-
 
148
{
-
 
149
  no_shape_option.present = 0;
-
 
150
  return;
-
 
151
}
-
 
152
 
-
 
153
token_option no_token_option;
-
 
154
 
136
 
155
token_option yes_token_option
-
 
156
    PROTO_N ( (elem) )
137
string_list
157
    PROTO_T ( token elem )
138
add_string_list(string_list list, string elem, int index)
158
{
139
{
159
  token_option res;
-
 
160
  res.val = elem;
140
	list.array[index] = elem.ints.chars;
161
  res.present = 1;
-
 
162
  return res;
141
	return list;
163
}
142
}
164
 
143
 
-
 
144
 
165
void init_token_option
145
bool_option no_bool_option;
-
 
146
 
166
    PROTO_Z ()
147
bool_option
-
 
148
yes_bool_option(bool elem)
167
{
149
{
-
 
150
	bool_option res;
-
 
151
	res.val = elem;
168
  no_token_option.present = 0;
152
	res.present = 1;
169
  return;
153
	return res;
170
}
154
}
171
 
155
 
172
 
156
 
173
 
157
void
174
int unit_no_of_dgtags;
158
init_bool_option(void)
175
dgtag_struct ** unit_ind_dgtags;
-
 
176
dgtag_struct * 	unit_dgtagtab;
-
 
177
 
-
 
178
 
-
 
179
dg f_dg_apply_token
-
 
180
    PROTO_N ( (token_value, token_args) )
-
 
181
    PROTO_T ( token token_value X bitstream token_args )
-
 
182
{
159
{
-
 
160
	no_bool_option.present = 0;
-
 
161
	return;
-
 
162
}
-
 
163
 
-
 
164
 
-
 
165
shape_option no_shape_option;
-
 
166
 
-
 
167
shape_option
-
 
168
yes_shape_option(shape elem)
-
 
169
{
-
 
170
	shape_option res;
-
 
171
	res.val = elem;
-
 
172
	res.present = 1;
183
   tokval v;
173
	return res;
-
 
174
}
-
 
175
 
-
 
176
 
-
 
177
void
-
 
178
init_shape_option(void)
-
 
179
{
-
 
180
	no_shape_option.present = 0;
-
 
181
	return;
-
 
182
}
-
 
183
 
-
 
184
 
-
 
185
token_option no_token_option;
-
 
186
 
-
 
187
token_option
184
   v = apply_tok(token_value, token_args,  DG_SORT, (tokval*)0);
188
yes_token_option(token elem)
-
 
189
{
-
 
190
	token_option res;
-
 
191
	res.val = elem;
-
 
192
	res.present = 1;
185
   return v.tk_dg;
193
	return res;
-
 
194
}
-
 
195
 
-
 
196
 
-
 
197
void
-
 
198
init_token_option(void)
-
 
199
{
-
 
200
	no_token_option.present = 0;
-
 
201
	return;
186
}
202
}
187
 
203
 
188
dg f_dummy_dg;
-
 
189
 
-
 
190
dg f_make_tag_dg
-
 
191
    PROTO_N ( (tg, diag) )
-
 
192
    PROTO_T ( dg_tag tg X dg diag )
-
 
193
{
-
 
194
  if (tg->key) failer ("dg_tag defined twice");
-
 
195
  tg->key = DGK_INFO;
-
 
196
  tg->p.info = diag;
-
 
197
  diag->this_tag = tg;
-
 
198
  return diag;
-
 
199
}
-
 
200
 
204
 
201
dg f_list_dg
-
 
202
    PROTO_N ( (args) )
-
 
203
    PROTO_T ( dg_list args )
-
 
204
{
-
 
205
  return args;
-
 
206
}
-
 
207
 
-
 
208
dg f_params_dg
-
 
209
    PROTO_N ( (params, outer_env) )
-
 
210
    PROTO_T ( dg_name_list params X exp_option outer_env )
-
 
211
{
-
 
212
  dg ans = new_dg_info(DGA_PARAMS);
-
 
213
  ans->data.i_param.args = params;
-
 
214
  if (outer_env.present)
-
 
215
    ans->data.i_param.o_env = diaginfo_exp (outer_env.val);
-
 
216
  else
-
 
217
    ans->data.i_param.o_env = nilexp;
-
 
218
  ans->data.i_param.b_start = 0;
-
 
219
  return ans;
-
 
220
}
-
 
221
 
-
 
222
dg f_source_language_dg
-
 
223
    PROTO_N ( (language) )
-
 
224
    PROTO_T ( nat language )
-
 
225
{
-
 
226
  dg ans = new_dg_info(DGA_COMP);
-
 
227
  ans->data.i_comp.is_tag = 0;
-
 
228
  ans->data.i_comp.corl.comp_lang = language.nat_val.small_nat;
-
 
229
  return ans;
-
 
230
}
-
 
231
 
-
 
232
dg f_compilation_dg
-
 
233
    PROTO_N ( (comp_unit) )
-
 
234
    PROTO_T ( dg_tag comp_unit )
-
 
235
{
-
 
236
  dg ans = new_dg_info(DGA_COMP);
-
 
237
  ans->data.i_comp.is_tag = 1;
-
 
238
  ans->data.i_comp.corl.comp_tag = comp_unit;
-
 
239
  return ans;
-
 
240
}
-
 
241
 
-
 
242
dg f_sourcepos_dg
-
 
243
    PROTO_N ( (span) )
-
 
244
    PROTO_T ( dg_sourcepos span )
-
 
245
{
-
 
246
  dg ans = new_dg_info(DGA_SRC);
-
 
247
  ans->data.i_src.is_stmt = 0;
-
 
248
  ans->data.i_src.startpos = shorten_sourcepos(span);
-
 
249
  ans->data.i_src.endpos = end_sourcepos(span);
-
 
250
  return ans;
-
 
251
}
-
 
252
 
-
 
253
dg f_name_decl_dg
-
 
254
    PROTO_N ( (dname) )
-
 
255
    PROTO_T ( dg_name dname )
-
 
256
{
-
 
257
  dg ans = new_dg_info(DGA_NAME);
-
 
258
  ans->data.i_nam.dnam = dname;
-
 
259
  return ans;
-
 
260
}
-
 
261
 
-
 
262
dg f_lexical_block_dg
-
 
263
    PROTO_N ( (idname, src_pos) )
-
 
264
    PROTO_T ( dg_idname_option idname X dg_sourcepos src_pos )
-
 
265
{
-
 
266
  dg ans = new_dg_info(DGA_SCOPE);
-
 
267
  ans->data.i_scope.lexname = idname_chars(idname);
-
 
268
  ans->data.i_scope.lexpos = shorten_sourcepos(src_pos);
-
 
269
  ans->data.i_scope.endpos = end_sourcepos(src_pos);
-
 
270
  ans->data.i_scope.begin_st = (long)0;
-
 
271
  return ans;
-
 
272
}
-
 
273
 
-
 
274
dg f_inline_call_dg
-
 
275
    PROTO_N ( (proc, act_params, call_kind) )
-
 
276
    PROTO_T ( dg_tag proc X dg_name_list act_params X nat_option call_kind )
-
 
277
{
-
 
278
  dg ans = new_dg_info(DGA_INL_CALL);
-
 
279
  ans->data.i_inl.proc = proc;
-
 
280
  ans->data.i_inl.args = act_params;
-
 
281
  if (call_kind.present)
-
 
282
    ans->data.i_inl.ck = call_kind.val.nat_val.small_nat;
-
 
283
  else
-
 
284
    ans->data.i_inl.ck = 0;
-
 
285
  ans->data.i_inl.resref = nildiag;
-
 
286
  proc->any_inl = 1;
-
 
287
  return ans;
-
 
288
}
-
 
289
 
-
 
290
dg f_inline_result_dg
205
int unit_no_of_dgtags;
291
    PROTO_N ( (inline_id) )
-
 
292
    PROTO_T ( dg_tag inline_id )
-
 
293
{
-
 
294
  dg ans = new_dg_info(DGA_INL_RES);
-
 
295
  ans->data.i_res.call = inline_id;
-
 
296
  ans->data.i_res.res.k = NO_WH;
-
 
297
  ans->data.i_res.next = (dg_info)0;
-
 
298
  return ans;
-
 
299
}
-
 
300
 
-
 
301
dg f_singlestep_dg
-
 
302
    PROTO_N ( (src_pos) )
-
 
303
    PROTO_T ( dg_sourcepos src_pos )
-
 
304
{
-
 
305
  dg ans = new_dg_info(DGA_SRC);
-
 
306
  ans->data.i_src.is_stmt = 1;
-
 
307
  ans->data.i_src.startpos = shorten_sourcepos(src_pos);
-
 
308
  ans->data.i_src.endpos.file = 0;
-
 
309
  return ans;
-
 
310
}
-
 
311
 
-
 
312
dg f_with_dg
-
 
313
    PROTO_N ( (type, obtain_value) )
-
 
314
    PROTO_T ( dg_type type X exp obtain_value )
-
 
315
{
-
 
316
  dg ans = new_dg_info(DGA_SRC);
-
 
317
  ans->data.i_with.w_typ = type;
-
 
318
  ans->data.i_with.w_exp = diaginfo_exp (obtain_value);
-
 
319
  return ans;
-
 
320
}
-
 
321
 
-
 
322
dg f_exception_scope_dg
-
 
323
    PROTO_N ( (handlers) )
-
 
324
    PROTO_T ( dg_tag_list handlers )
-
 
325
{
-
 
326
  dg ans = new_dg_info(DGA_X_TRY);
-
 
327
  ans->data.i_try.hl = handlers;
-
 
328
  return ans;
-
 
329
}
-
 
330
 
-
 
331
dg f_exception_handler_dg
-
 
332
    PROTO_N ( (ex) )
-
 
333
    PROTO_T ( dg_name_option ex )
-
 
334
{
-
 
335
  dg ans = new_dg_info(DGA_X_CATCH);
-
 
336
  ans->data.i_catch.ex = ex;
-
 
337
  return ans;
-
 
338
}
-
 
339
 
-
 
340
dg f_abortable_part_dg
-
 
341
    PROTO_N ( (src_pos, no_code) )
-
 
342
    PROTO_T ( dg_sourcepos src_pos X bool no_code )
-
 
343
{
-
 
344
  dg ans = new_dg_info(DGA_RVS);
-
 
345
  ans->data.i_rvs.rvs_key = DGR_ABTL;
-
 
346
  ans->data.i_rvs.n_code = (no_code ? 0 : 2);
-
 
347
  ans->data.i_rvs.has_iv = 0;
-
 
348
  ans->data.i_rvs.alt = 0;
-
 
349
  ans->data.i_rvs.pos = shorten_sourcepos (src_pos);
-
 
350
  ans->data.i_rvs.u.tg = (dg_tag)0;
-
 
351
  ans->data.i_rvs.en = (dg_tag)0;
206
dgtag_struct **unit_ind_dgtags;
352
  return ans;
-
 
353
}
-
 
354
 
-
 
355
dg f_accept_dg
-
 
356
    PROTO_N ( (src_pos, entry, params, no_code, alt) )
-
 
357
    PROTO_T ( dg_sourcepos src_pos X dg_tag entry X dg_name_list params X
-
 
358
	      bool no_code X dg_tag_option alt )
-
 
359
{
-
 
360
  dg ans = new_dg_info(DGA_RVS);
-
 
361
  ans->data.i_rvs.rvs_key = DGR_ACC;
-
 
362
  ans->data.i_rvs.n_code = (no_code ? 0 : 2);
-
 
363
  ans->data.i_rvs.has_iv = 0;
-
 
364
  ans->data.i_rvs.alt = (alt ? 1 : 0);
-
 
365
  ans->data.i_rvs.pos = shorten_sourcepos (src_pos);
-
 
366
  ans->data.i_rvs.u.tg = alt;
-
 
367
  ans->data.i_rvs.en = entry;
-
 
368
  ans->data.i_rvs.u2.p = params;
-
 
369
  return ans;
-
 
370
}
-
 
371
 
-
 
372
dg f_barrier_dg
-
 
373
    PROTO_N ( (src_pos, entry) )
-
 
374
    PROTO_T ( dg_sourcepos src_pos X dg_tag entry )
-
 
375
{
-
 
376
  dg ans = new_dg_info(DGA_BAR);
-
 
377
  ans->data.i_bar.pos = shorten_sourcepos (src_pos);
-
 
378
  ans->data.i_bar.entry = entry;
-
 
379
  return ans;
-
 
380
}
-
 
381
 
-
 
382
dg f_branch_dg
-
 
383
    PROTO_N ( (stmt_src_pos) )
-
 
384
    PROTO_T ( dg_sourcepos stmt_src_pos )
-
 
385
{
-
 
386
  dg ans = new_dg_info(DGA_BRANCH);
-
 
387
  ans->data.i_brn.pos = shorten_sourcepos(stmt_src_pos);
-
 
388
  return ans;
-
 
389
}
-
 
390
 
-
 
391
dg f_call_dg
-
 
392
    PROTO_N ( (idname, src_pos, call_kind, module, basetype) )
-
 
393
    PROTO_T ( dg_idname_option idname X dg_sourcepos src_pos X
-
 
394
	      nat_option call_kind X dg_tag_option module X
-
 
395
	      dg_tag_option basetype )
-
 
396
{
-
 
397
  dg ans = new_dg_info(DGA_CALL);
-
 
398
  ans->data.i_call.clnam = idname_chars (idname);
-
 
399
  ans->data.i_call.pos = shorten_sourcepos(src_pos);
-
 
400
  if (call_kind.present)
-
 
401
    ans->data.i_call.ck = call_kind.val.nat_val.small_nat;
-
 
402
  else
-
 
403
    ans->data.i_call.ck = 0;
-
 
404
  ans->data.i_call.p.k = NO_WH;
-
 
405
  UNUSED (module);
-
 
406
  UNUSED (basetype);
-
 
407
  return ans;
-
 
408
}
-
 
409
 
-
 
410
dg f_destructor_dg
207
dgtag_struct *unit_dgtagtab;
411
    PROTO_N ( (whence, obtain_value) )
-
 
412
    PROTO_T ( dg_sourcepos whence X exp_option obtain_value )
-
 
413
{
-
 
414
  dg ans = new_dg_info(DGA_DEST);
-
 
415
  ans->data.i_dest.pos = shorten_sourcepos(whence);
-
 
416
  if (obtain_value.present)
-
 
417
    ans->data.i_dest.val = diaginfo_exp (obtain_value.val);
-
 
418
  else
-
 
419
    ans->data.i_dest.val = nilexp;
-
 
420
  return ans;
-
 
421
}
-
 
422
 
-
 
423
dg f_inlined_dg
-
 
424
    PROTO_N ( (d, origin) )
-
 
425
    PROTO_T ( dg d X dg_tag origin )
-
 
426
{
-
 
427
  UNUSED (origin);
-
 
428
	/* inlined_dg not yet supported */
-
 
429
  return d;
-
 
430
}
-
 
431
 
-
 
432
dg f_jump_dg
-
 
433
    PROTO_N ( (stmt_src_pos) )
-
 
434
    PROTO_T ( dg_sourcepos stmt_src_pos )
-
 
435
{
-
 
436
  dg ans = new_dg_info(DGA_JUMP);
-
 
437
  ans->data.i_tst.pos = shorten_sourcepos(stmt_src_pos);
-
 
438
  return ans;
-
 
439
}
-
 
440
 
-
 
441
dg f_label_dg
-
 
442
    PROTO_N ( (idname, src_pos) )
-
 
443
    PROTO_T ( dg_idname idname X dg_sourcepos src_pos )
-
 
444
{
-
 
445
  dg ans = new_dg_info(DGA_LAB);
-
 
446
  ans->data.i_scope.lexname = idname_chars(idname);
-
 
447
  ans->data.i_scope.lexpos = shorten_sourcepos(src_pos);
-
 
448
  return ans;
-
 
449
}
-
 
450
 
-
 
451
dg f_long_jump_dg
-
 
452
    PROTO_N ( (stmt_src_pos) )
-
 
453
    PROTO_T ( dg_sourcepos stmt_src_pos )
-
 
454
{
-
 
455
  dg ans = new_dg_info(DGA_LJ);
-
 
456
  ans->data.i_lj.pos = shorten_sourcepos(stmt_src_pos);
-
 
457
  return ans;
-
 
458
}
-
 
459
 
-
 
460
dg f_raise_dg
-
 
461
    PROTO_N ( (stmt_src_pos, ex, value) )
-
 
462
    PROTO_T ( dg_sourcepos stmt_src_pos X dg_type_option ex X exp_option value )
-
 
463
{
-
 
464
  dg ans = new_dg_info(DGA_X_RAISE);
-
 
465
  ans->data.i_raise.pos = shorten_sourcepos(stmt_src_pos);
-
 
466
  ans->data.i_raise.x_typ = ex;
-
 
467
  if (value.present)
-
 
468
    ans->data.i_raise.x_val = diaginfo_exp (value.val);
-
 
469
  else
-
 
470
    ans->data.i_raise.x_val = nilexp;
-
 
471
  return ans;
-
 
472
}
-
 
473
 
-
 
474
dg f_requeue_dg
-
 
475
    PROTO_N ( (stmt_src_pos, entry, with_abort) )
-
 
476
    PROTO_T ( dg_sourcepos stmt_src_pos X dg_tag entry X bool with_abort )
-
 
477
{
-
 
478
  dg ans = new_dg_info(DGA_RVS);
-
 
479
  ans->data.i_rvs.rvs_key = DGR_REQUE;
-
 
480
  ans->data.i_rvs.n_code = 2;
-
 
481
  ans->data.i_rvs.has_iv = 0;
-
 
482
  ans->data.i_rvs.alt = 0;
-
 
483
  ans->data.i_rvs.w_abort = with_abort;
-
 
484
  ans->data.i_rvs.pos = shorten_sourcepos (stmt_src_pos);
-
 
485
  ans->data.i_rvs.u.tg = (dg_tag)0;
-
 
486
  ans->data.i_rvs.en = entry;
-
 
487
  return ans;
-
 
488
}
-
 
489
 
208
 
525
{
601
{
526
  dg ans = new_dg_info(DGA_RVS);
602
	dg ans = new_dg_info(DGA_TEST);
527
  ans->data.i_rvs.rvs_key = DGR_ALT;
-
 
528
  ans->data.i_rvs.n_code = (no_code ? 0 : 2);
-
 
529
  ans->data.i_rvs.has_iv = 0;
-
 
530
  ans->data.i_rvs.alt = 0;
-
 
531
  ans->data.i_rvs.kind = alt_kind.nat_val.small_nat;
-
 
532
  ans->data.i_rvs.pos = shorten_sourcepos (src_pos);
603
	ans->data.i_tst.pos = shorten_sourcepos(src_pos);
533
  ans->data.i_rvs.u.tg = (dg_tag)0;
604
	ans->data.i_tst.inv = inverted;
534
  ans->data.i_rvs.u2.e = diaginfo_exp (alt_value);
-
 
535
  return ans;
605
	return ans;
536
}
606
}
537
 
607
 
-
 
608
 
538
dg f_select_guard_dg
609
dg
539
    PROTO_N ( (src_pos, alt) )
-
 
540
    PROTO_T ( dg_sourcepos src_pos X dg_tag alt )
610
f_triggering_alternative_dg(dg_sourcepos src_pos, nat alt_kind, bool no_code)
541
{
611
{
542
  dg ans = new_dg_info(DGA_RVS);
612
	dg ans = new_dg_info(DGA_RVS);
543
  ans->data.i_rvs.rvs_key = DGR_SGD;
613
	ans->data.i_rvs.rvs_key = DGR_TRIG;
544
  ans->data.i_rvs.n_code = 2;
614
	ans->data.i_rvs.n_code = (no_code ? 0 : 2);
545
  ans->data.i_rvs.has_iv = 0;
615
	ans->data.i_rvs.has_iv = 0;
546
  ans->data.i_rvs.alt = (alt ? 1 : 0);
616
	ans->data.i_rvs.alt = 0;
-
 
617
	ans->data.i_rvs.kind = alt_kind.nat_val.small_nat;
547
  ans->data.i_rvs.pos = shorten_sourcepos (src_pos);
618
	ans->data.i_rvs.pos = shorten_sourcepos(src_pos);
548
  ans->data.i_rvs.u.tg = alt;
619
	ans->data.i_rvs.u.tg = (dg_tag)0;
549
  return ans;
620
	return ans;
550
}
621
}
551
 
622
 
552
dg f_statement_part_dg
-
 
553
    PROTO_N ( (lb) )
-
 
554
    PROTO_T ( dg_tag lb )
-
 
555
{
-
 
556
  dg ans = new_dg_info(DGA_BEG);
-
 
557
  ans->data.i_tg = lb;
-
 
558
  return ans;
-
 
559
}
-
 
560
 
623
 
561
dg f_test_dg
-
 
562
    PROTO_N ( (src_pos, inverted) )
-
 
563
    PROTO_T ( dg_sourcepos src_pos X bool inverted )
-
 
564
{
-
 
565
  dg ans = new_dg_info(DGA_TEST);
-
 
566
  ans->data.i_tst.pos = shorten_sourcepos (src_pos);
-
 
567
  ans->data.i_tst.inv = inverted;
-
 
568
  return ans;
-
 
569
}
-
 
570
 
-
 
571
dg f_triggering_alternative_dg
-
 
572
    PROTO_N ( (src_pos, alt_kind, no_code) )
-
 
573
    PROTO_T ( dg_sourcepos src_pos X nat alt_kind X bool no_code )
-
 
574
{
-
 
575
  dg ans = new_dg_info(DGA_RVS);
-
 
576
  ans->data.i_rvs.rvs_key = DGR_TRIG;
-
 
577
  ans->data.i_rvs.n_code = (no_code ? 0 : 2);
-
 
578
  ans->data.i_rvs.has_iv = 0;
-
 
579
  ans->data.i_rvs.alt = 0;
-
 
580
  ans->data.i_rvs.kind = alt_kind.nat_val.small_nat;
-
 
581
  ans->data.i_rvs.pos = shorten_sourcepos (src_pos);
-
 
582
  ans->data.i_rvs.u.tg = (dg_tag)0;
-
 
583
  return ans;
-
 
584
}
-
 
585
 
-
 
586
void init_dg
624
void
587
    PROTO_Z ()
625
init_dg(void)
588
{
-
 
589
  return;
-
 
590
}
-
 
591
 
-
 
592
dg_comp_props f_dummy_dg_comp_props;
-
 
593
 
-
 
594
dg_comp_props f_make_dg_compunit
-
 
595
    PROTO_N ( (no_labels, comp_unit, l) )
-
 
596
    PROTO_T ( tdfint no_labels X dg_compilation comp_unit X dg_append_list l )
-
 
597
{
626
{
598
  UNUSED (no_labels);
-
 
599
  UNUSED (comp_unit);
-
 
600
  UNUSED (l);
627
	return;
601
  return f_dummy_dg_comp_props;	/* dummy, never called */
-
 
602
}
628
}
603
 
629
 
-
 
630
 
604
void init_dg_comp_props
631
dg_comp_props f_dummy_dg_comp_props;
-
 
632
 
605
    PROTO_Z ()
633
dg_comp_props
-
 
634
f_make_dg_compunit(tdfint no_labels, dg_compilation comp_unit, dg_append_list l)
606
{
635
{
607
  return;
-
 
608
}
-
 
609
 
-
 
610
dg_tag f_dummy_dg_tag;
636
	UNUSED(no_labels);
611
 
-
 
612
dg_tag f_make_dg_tag
637
	UNUSED(comp_unit);
613
    PROTO_N ( (num) )
638
	UNUSED(l);
614
    PROTO_T ( tdfint num )
-
 
615
{
-
 
616
  int index = natint(num);
-
 
617
  if (index >= unit_no_of_dgtags)
-
 
618
    failer("make_dg_tag out of range");
639
	return f_dummy_dg_comp_props;	/* dummy, never called */
619
  return unit_ind_dgtags[index];
-
 
620
}
-
 
621
 
-
 
622
void init_dg_tag
-
 
623
    PROTO_Z ()
-
 
624
{
-
 
625
  return;
-
 
626
}
640
}
-
 
641
 
-
 
642
 
-
 
643
void
-
 
644
init_dg_comp_props(void)
-
 
645
{
-
 
646
	return;
-
 
647
}
-
 
648
 
-
 
649
 
-
 
650
dg_tag f_dummy_dg_tag;
-
 
651
 
-
 
652
dg_tag
-
 
653
f_make_dg_tag(tdfint num)
-
 
654
{
-
 
655
	int index = natint(num);
-
 
656
	if (index >= unit_no_of_dgtags) {
-
 
657
		failer("make_dg_tag out of range");
-
 
658
	}
-
 
659
	return unit_ind_dgtags[index];
-
 
660
}
-
 
661
 
-
 
662
 
-
 
663
void
-
 
664
init_dg_tag(void)
-
 
665
{
-
 
666
	return;
-
 
667
}
-
 
668
 
627
 
669
 
628
dg_name f_dummy_dg_name;
670
dg_name f_dummy_dg_name;
629
 
671
 
630
dg_name f_dg_name_apply_token
-
 
631
    PROTO_N ( (token_value, token_args) )
-
 
632
    PROTO_T ( token token_value X bitstream token_args )
-
 
633
{
-
 
634
   tokval v;
-
 
635
   v = apply_tok(token_value, token_args,  DG_NAME_SORT, (tokval*)0);
-
 
636
   return v.tk_dg_name;
-
 
637
}
-
 
638
 
-
 
639
dg_name f_dg_tag_name
-
 
640
    PROTO_N ( (tg, nam) )
-
 
641
    PROTO_T ( dg_tag tg X dg_name nam )
-
 
642
{
-
 
643
  if (tg->key) failer ("dg_tag defined twice");
-
 
644
  tg->key = DGK_NAME;
-
 
645
  tg->p.nam = nam;
-
 
646
  if (!nam->mor)
-
 
647
    extend_dg_name (nam);
-
 
648
  nam->mor->this_tag = tg;
-
 
649
  return nam;
-
 
650
}
-
 
651
 
-
 
652
dg_name f_dg_object_name
-
 
653
    PROTO_N ( (idname, whence, type, obtain_value, accessibility) )
-
 
654
    PROTO_T ( dg_idname idname X dg_sourcepos whence X dg_type type X
-
 
655
	      exp_option obtain_value X dg_accessibility_option accessibility )
-
 
656
{
-
 
657
  dg_name ans = new_dg_name(DGN_OBJECT);
-
 
658
  ans->idnam = idname;
-
 
659
  ans->whence = shorten_sourcepos (whence);
-
 
660
  ans->data.n_obj.typ = type;
-
 
661
#ifdef NEWDIAGS
-
 
662
  if (obtain_value.present) {
-
 
663
    exp acc = obtain_value.val;
-
 
664
    ans->data.n_obj.obtain_val = diaginfo_exp (acc);
-
 
665
    set_obj_ref (ans);		/* globals only */
-
 
666
#if 0
-
 
667
    if (name(acc) == cont_tag && name(son(acc)) == name_tag &&
-
 
668
		isglob(son(son(acc))) && isvar(son(son(acc))))
-
 
669
      brog(son(son(acc)))->dec_u.dec_val.diag_info = ans;
-
 
670
#endif
-
 
671
  }
-
 
672
  else
-
 
673
    ans->data.n_obj.obtain_val = nilexp;
-
 
674
#endif
-
 
675
  if (accessibility != DG_ACC_NONE) {
-
 
676
    extend_dg_name (ans);
-
 
677
    ans->mor->acc = accessibility;
-
 
678
  }
-
 
679
  return ans;
-
 
680
}
-
 
681
 
-
 
682
dg_name f_dg_proc_name
-
 
683
    PROTO_N ( (idname, whence, type, obtain_value, accessibility,
-
 
684
		virtuality, isinline, exceptions, elaboration) )
-
 
685
    PROTO_T ( dg_idname idname X dg_sourcepos whence X dg_type type X
-
 
686
	      exp_option obtain_value X dg_accessibility_option accessibility X
-
 
687
	      dg_virtuality_option virtuality X bool isinline X
-
 
688
	      dg_type_list_option exceptions X dg_tag_option elaboration )
-
 
689
{
-
 
690
  dg_name ans = new_dg_name(DGN_PROC);
-
 
691
  ans->idnam = idname;
-
 
692
  ans->whence = shorten_sourcepos (whence);
-
 
693
  ans->data.n_proc.typ = type;
-
 
694
#ifdef NEWDIAGS
-
 
695
  if (obtain_value.present) {
-
 
696
    exp acc = obtain_value.val;
-
 
697
    ans->data.n_proc.obtain_val = diaginfo_exp (acc);
-
 
698
    if (name(acc) == name_tag && isglob(son(acc)))
-
 
699
      brog(son(acc))->dec_u.dec_val.diag_info = ans;
-
 
700
  }
-
 
701
  else
-
 
702
    ans->data.n_proc.obtain_val = nilexp;
-
 
703
  ans->data.n_proc.params = (dg_info)0;
-
 
704
  if (accessibility != DG_ACC_NONE || virtuality != DG_VIRT_NONE
-
 
705
	|| isinline || extra_diags || elaboration || exceptions.len >= 0) {
-
 
706
    extend_dg_name (ans);
-
 
707
    ans->mor->acc = accessibility;
-
 
708
    ans->mor->virt = virtuality;
-
 
709
    ans->mor->isinline = isinline;
-
 
710
    ans->mor->end_pos = end_sourcepos (whence);
-
 
711
    ans->mor->elabn = elaboration;
-
 
712
    ans->mor->exptns = exceptions;
-
 
713
  }
-
 
714
#endif
-
 
715
  return ans;
-
 
716
}
-
 
717
 
-
 
718
dg_name f_dg_inlined_name
-
 
719
    PROTO_N ( (nam, origin) )
-
 
720
    PROTO_T ( dg_name nam X dg_tag origin )
-
 
721
{
-
 
722
  if (!nam->mor)
-
 
723
    extend_dg_name (nam);
-
 
724
  nam->mor->inline_ref = origin;
-
 
725
  return nam;
-
 
726
}
-
 
727
 
-
 
728
dg_name f_dg_constant_name
-
 
729
    PROTO_N ( (nam) )
-
 
730
    PROTO_T ( dg_name nam )
-
 
731
{
-
 
732
  if (!nam->mor)
-
 
733
    extend_dg_name (nam);
-
 
734
  nam->mor->isconst = 1;
-
 
735
  return nam;
-
 
736
}
-
 
737
 
-
 
738
dg_name f_dg_type_name
-
 
739
    PROTO_N ( (idname, whence, accessibility, type, new_type,
-
 
740
		ada_derived, constraints) )
-
 
741
    PROTO_T ( dg_idname_option idname X dg_sourcepos whence X
-
 
742
	      dg_accessibility_option accessibility X dg_type_option type X
-
 
743
	      bool new_type X bool_option ada_derived X
-
 
744
	      dg_constraint_list_option constraints )
-
 
745
{
-
 
746
  dg_name ans = new_dg_name(DGN_TYPE);
-
 
747
  ans->idnam = idname;
-
 
748
  ans->whence = shorten_sourcepos (whence);
-
 
749
  ans->data.n_typ.raw = type;
-
 
750
  if (idname.id_key == DG_ID_NONE)
-
 
751
    ans->data.n_typ.named = type;
-
 
752
  else
672
dg_name
753
    ans->data.n_typ.named = (dg_type)0;
-
 
754
  if (accessibility != DG_ACC_NONE || new_type ||
-
 
755
	(ada_derived.present && ada_derived.val)) {
-
 
756
    extend_dg_name (ans);
-
 
757
    ans->mor->acc = accessibility;
-
 
758
    ans->mor->isnew = new_type;
-
 
759
    if (ada_derived.present)
-
 
760
      ans->mor->aderiv = ada_derived.val;
-
 
761
  }
-
 
762
  ans->data.n_typ.constraints = constraints;
-
 
763
  return ans;
-
 
764
}
-
 
765
 
-
 
766
dg_name f_dg_subunit_name
-
 
767
    PROTO_N ( (parent, nam, subunit_kind, accessibility) )
-
 
768
    PROTO_T ( dg_tag parent X dg_name nam X nat subunit_kind X dg_accessibility_option accessibility )
-
 
769
{
-
 
770
  dg_name ans = new_dg_name(DGN_SUBUNIT);
-
 
771
  ans->data.n_sub.parent = parent;
-
 
772
  ans->data.n_sub.sub = nam;
-
 
773
  switch (subunit_kind.nat_val.small_nat) {
-
 
774
    case 1:	/* SUK_child */
-
 
775
      ans->data.n_sub.child = 1;
-
 
776
      ans->data.n_sub.split = 0;
-
 
777
      break;
-
 
778
    case 2:	/* SUK_separate */
-
 
779
      ans->data.n_sub.child = 0;
-
 
780
      ans->data.n_sub.split = 0;
-
 
781
      ans->data.n_sub.acc = accessibility;
-
 
782
      break;
-
 
783
    case 3:	/* SUK_split_module */
-
 
784
      ans->data.n_sub.child = 0;
-
 
785
      ans->data.n_sub.split = 1;
-
 
786
      break;
-
 
787
    default:
-
 
788
      failer ("unexpected SUK_kind");
-
 
789
  }
-
 
790
  return ans;
-
 
791
}
-
 
792
 
-
 
793
dg_name f_dg_program_name
-
 
794
    PROTO_N ( (idname, whence, obtain_value) )
-
 
795
    PROTO_T ( dg_idname idname X dg_sourcepos whence X exp obtain_value )
-
 
796
{
-
 
797
  dg_name ans = new_dg_name(DGN_PROC);
-
 
798
  ans->idnam = idname;
-
 
799
  ans->whence = shorten_sourcepos (whence);
-
 
800
  ans->data.n_proc.typ = (dg_type)0;
-
 
801
  ans->data.n_proc.obtain_val = diaginfo_exp (obtain_value);
-
 
802
  ans->data.n_proc.params = (dg_info)0;
-
 
803
  extend_dg_name (ans);
-
 
804
  ans->mor->prognm = 1;
-
 
805
  return ans;
-
 
806
}
-
 
807
 
-
 
808
dg_name f_dg_entry_family_name
-
 
809
    PROTO_N ( (proc, family) )
-
 
810
    PROTO_T ( dg_name proc X dg_dim family )
-
 
811
{
-
 
812
  if (!proc->mor)
-
 
813
    extend_dg_name (proc);
-
 
814
  proc->mor->en_family = (dg_dim *)xmalloc (sizeof(dg_dim));
-
 
815
  *(proc->mor->en_family) = family;
-
 
816
  return proc;
-
 
817
}
-
 
818
 
-
 
819
dg_name f_dg_entry_name
-
 
820
    PROTO_N ( (idname, whence, type, accessibility, family) )
-
 
821
    PROTO_T ( dg_idname idname X dg_sourcepos whence X dg_type type X
-
 
822
	      dg_accessibility_option accessibility X dg_dim_option family )
-
 
823
{
-
 
824
  dg_name ans = new_dg_name(DGN_ENTRY);
-
 
825
  ans->idnam = idname;
-
 
826
  ans->whence = shorten_sourcepos (whence);
-
 
827
  ans->data.n_proc.typ = type;
-
 
828
  if (accessibility != DG_ACC_NONE || family.d_key != DG_DIM_NONE) {
-
 
829
    extend_dg_name (ans);
-
 
830
    ans->mor->acc = accessibility;
-
 
831
    if (family.d_key != DG_DIM_NONE) {
-
 
832
      ans->mor->en_family = (dg_dim *)xmalloc (sizeof(dg_dim));
-
 
833
      *(ans->mor->en_family) = family;
-
 
834
    }
-
 
835
  }
-
 
836
  return ans;
-
 
837
}
-
 
838
 
-
 
839
dg_name f_dg_is_spec_name
-
 
840
    PROTO_N ( (nam, is_separate) )
-
 
841
    PROTO_T ( dg_name nam X bool_option is_separate )
-
 
842
{
-
 
843
  if (!nam->mor)
-
 
844
    extend_dg_name (nam);
-
 
845
  nam->mor->isspec = 1;
-
 
846
  if (is_separate.present && is_separate.val)
-
 
847
    nam->mor->issep = 1;
-
 
848
  return nam;
-
 
849
}
-
 
850
 
-
 
851
 
-
 
852
dg_name f_dg_module_name
-
 
853
    PROTO_N ( (idname, whence, memlist, init, elaboration) )
-
 
854
    PROTO_T ( dg_idname idname X dg_sourcepos whence X dg_namelist memlist X
-
 
855
	      exp_option init X dg_tag_option elaboration )
-
 
856
{
-
 
857
  dg_name ans = new_dg_name(DGN_MODULE);
-
 
858
  ans->idnam = idname;
-
 
859
  ans->whence = shorten_sourcepos (whence);
-
 
860
  ans->data.n_mod.members = memlist.list;
-
 
861
#ifdef NEWDIAGS
-
 
862
  if (memlist.tg)
-
 
863
    memlist.tg->p.nl = &(ans->data.n_mod.members);
-
 
864
  if (init.present) {
-
 
865
    exp acc = init.val;
-
 
866
    ans->data.n_mod.init = diaginfo_exp (acc);
-
 
867
    if (name(acc) == name_tag && isglob(son(acc)))
-
 
868
      brog(son(acc))->dec_u.dec_val.diag_info = ans;
-
 
869
  }
-
 
870
  else
-
 
871
    ans->data.n_mod.init = nilexp;
-
 
872
#endif
-
 
873
  if (elaboration) {
-
 
874
    extend_dg_name (ans);
-
 
875
    ans->mor->elabn = elaboration;
-
 
876
  }
-
 
877
  return ans;
-
 
878
}
-
 
879
 
-
 
880
dg_name f_dg_namespace_name
-
 
881
    PROTO_N ( (idname, whence, members) )
-
 
882
    PROTO_T ( dg_idname idname X dg_sourcepos whence X dg_namelist members )
-
 
883
{
-
 
884
  dg_name ans = new_dg_name(DGN_NSP);
-
 
885
  ans->idnam = idname;
-
 
886
  ans->whence = shorten_sourcepos (whence);
-
 
887
  ans->data.n_mod.members = members.list;
-
 
888
  if (members.tg)
-
 
889
    members.tg->p.nl = &(ans->data.n_mod.members);
-
 
890
  ans->data.n_mod.init = nilexp;
-
 
891
  return ans;
-
 
892
}
-
 
893
 
-
 
894
dg_name f_dg_rep_clause_name
-
 
895
    PROTO_N ( (item, location) )
-
 
896
    PROTO_T ( dg_name item X exp location )
-
 
897
{
-
 
898
  if (!item->mor)
-
 
899
    extend_dg_name (item);
-
 
900
  item->mor->repn = diaginfo_exp (location);
-
 
901
  return item;
-
 
902
}
-
 
903
 
-
 
904
dg_name f_dg_spec_ref_name
-
 
905
    PROTO_N ( (specification, nam) )
-
 
906
    PROTO_T ( dg_tag specification X dg_name nam )
-
 
907
{
-
 
908
  if (!nam->mor)
-
 
909
    extend_dg_name (nam);
-
 
910
  nam->mor->refspec = specification;
-
 
911
  return nam;
-
 
912
}
-
 
913
 
-
 
914
dg_name f_dg_visibility_name
-
 
915
    PROTO_N ( (dname, import_kind, idname, src_pos, accessibility, type) )
-
 
916
    PROTO_T ( dg_tag dname X nat import_kind X dg_idname_option idname X
-
 
917
	      dg_sourcepos_option src_pos X
-
 
918
	      dg_accessibility_option accessibility X dg_type_option type )
-
 
919
{
-
 
920
  dg_name ans = new_dg_name(DGN_IMPORT);
-
 
921
  ans->idnam = idname;
-
 
922
  ans->whence = shorten_sourcepos (src_pos);
-
 
923
  ans->data.n_imp.import = dname;
-
 
924
  ans->data.n_imp.ik = import_kind.nat_val.small_nat;
-
 
925
  if (accessibility != DG_ACC_NONE ) {
-
 
926
    extend_dg_name (ans);
-
 
927
    ans->mor->acc = accessibility;
-
 
928
  }
-
 
929
  ans->data.n_imp.i_typ = type;
-
 
930
  return ans;
-
 
931
}
-
 
932
 
-
 
933
void init_dg_name
-
 
934
    PROTO_Z ()
-
 
935
{
-
 
936
  return;
-
 
937
}
-
 
938
 
-
 
939
dg_type f_dummy_dg_type;
-
 
940
 
-
 
941
dg_type f_dg_type_apply_token
-
 
942
    PROTO_N ( (token_value, token_args) )
-
 
943
    PROTO_T ( token token_value X bitstream token_args )
673
f_dg_name_apply_token(token token_value, bitstream token_args)
944
{
-
 
945
   tokval v;
-
 
946
   v = apply_tok(token_value, token_args,  DG_TYPE_SORT, (tokval*)0);
-
 
947
   return v.tk_dg_type;
-
 
948
}
-
 
949
 
-
 
950
dg_type f_dg_tag_type
-
 
951
    PROTO_N ( (tg, type) )
-
 
952
    PROTO_T ( dg_tag tg X dg_type type )
-
 
953
{
-
 
954
  if (tg->key && tg->key != DGK_TYPE) failer ("dg_tag defined twice");
-
 
955
  tg->key = DGK_TYPE;
-
 
956
  tg->p.typ = type;
-
 
957
  return type;
-
 
958
}
-
 
959
 
-
 
960
dg_type f_dg_named_type
-
 
961
    PROTO_N ( (dname) )
-
 
962
    PROTO_T ( dg_tag dname )
-
 
963
{
-
 
964
  dg_type ans;
-
 
965
  if (dname->key == DGK_TYPE)
-
 
966
    return dname->p.typ;
-
 
967
  if (dname->key == DGK_NAME && dname->p.nam->key == DGN_TYPE
-
 
968
	&& dname->p.nam->data.n_typ.named)
-
 
969
    return dname->p.nam->data.n_typ.named;
-
 
970
  ans = new_dg_type(DGT_TAGGED);
-
 
971
  ans->data.t_tag = dname;
-
 
972
  if (dname->key == DGK_NONE && dname->outref.k == LAB_STR) {
-
 
973
    dname->key = DGK_TYPE;
-
 
974
    dname->p.typ = ans;
-
 
975
    ans->outref = dname->outref;
-
 
976
  }
-
 
977
  else
-
 
978
  if (dname->key == DGK_NAME && dname->p.nam->key == DGN_TYPE)
-
 
979
    dname->p.nam->data.n_typ.named = ans;
-
 
980
  return ans;
-
 
981
}
-
 
982
 
-
 
983
dg_type f_dg_is_spec_type
-
 
984
    PROTO_N ( (type) )
-
 
985
    PROTO_T ( dg_type type )
-
 
986
{
-
 
987
  if (!type->mor)
-
 
988
    extend_dg_type (type);
-
 
989
  type->mor->isspec = 1;
-
 
990
  return type;
-
 
991
}
-
 
992
 
-
 
993
dg_type f_dg_spec_ref_type
-
 
994
    PROTO_N ( (specification, type) )
-
 
995
    PROTO_T ( dg_tag specification X dg_type type )
-
 
996
{
-
 
997
  if (!type->mor)
-
 
998
    extend_dg_type (type);
-
 
999
  type->mor->refspec = specification;
-
 
1000
  return type;
-
 
1001
}
-
 
1002
 
-
 
1003
dg_type f_dg_modular_type
-
 
1004
    PROTO_N ( (rep_type, size) )
-
 
1005
    PROTO_T ( dg_type rep_type X exp size )
-
 
1006
{
-
 
1007
  dg_type ans = new_dg_type(DGT_MOD);
-
 
1008
  ans->data.t_adanum.rept = rep_type;
-
 
1009
  ans->data.t_adanum.digits = diaginfo_exp (size);
-
 
1010
  return ans;
-
 
1011
}
-
 
1012
 
-
 
1013
dg_type f_dg_qualified_type
-
 
1014
    PROTO_N ( (qualifier, type) )
-
 
1015
    PROTO_T ( dg_qualifier qualifier X dg_type type )
-
 
1016
{
-
 
1017
  return get_qual_dg_type (qualifier, type);
-
 
1018
}
-
 
1019
 
-
 
1020
dg_type f_dg_pointer_type
-
 
1021
    PROTO_N ( (type, heap_only) )
-
 
1022
    PROTO_T ( dg_type type X bool_option heap_only )
-
 
1023
{
-
 
1024
  if (heap_only.present && heap_only.val)
-
 
1025
    return get_qual_dg_type (DG_HPPTR_T, type);
-
 
1026
  return get_qual_dg_type (DG_PTR_T, type);
-
 
1027
}
-
 
1028
 
-
 
1029
dg_type f_dg_reference_type
-
 
1030
    PROTO_N ( (type) )
-
 
1031
    PROTO_T ( dg_type type )
-
 
1032
{
-
 
1033
  return get_qual_dg_type (DG_REF_T, type);
-
 
1034
}
-
 
1035
 
-
 
1036
dg_type f_dg_packed_type
-
 
1037
    PROTO_N ( (type, sha) )
-
 
1038
    PROTO_T ( dg_type type X shape sha )
-
 
1039
{
-
 
1040
  UNUSED (sha);
-
 
1041
  return get_qual_dg_type (DG_PACK_T, type);
-
 
1042
}
-
 
1043
 
-
 
1044
dg_type f_dg_array_type
-
 
1045
    PROTO_N ( (element_type, stride, row_major, dimensions) )
-
 
1046
    PROTO_T ( dg_type element_type X exp stride X bool_option row_major X
-
 
1047
	      dg_dim_list dimensions )
-
 
1048
{
-
 
1049
  dg_type ans = new_dg_type(DGT_ARRAY);
-
 
1050
  ans->data.t_arr.elem_type = element_type;
-
 
1051
  ans->data.t_arr.stride = diaginfo_exp (stride);
-
 
1052
  ans->data.t_arr.rowm = (row_major.present ? row_major.val : 1);
-
 
1053
  ans->data.t_arr.dims = dimensions;
-
 
1054
  return ans;
-
 
1055
}
-
 
1056
 
-
 
1057
dg_type f_dg_bitfield_type
-
 
1058
    PROTO_N ( (type, bv, sha) )
-
 
1059
    PROTO_T ( dg_type type X bitfield_variety bv X shape sha )
-
 
1060
{
-
 
1061
  return get_dg_bitfield_type (type, sha, bv);
-
 
1062
}
-
 
1063
 
-
 
1064
dg_type f_dg_enum_type
-
 
1065
    PROTO_N ( (values, tagname, src_pos, sha, new_type) )
-
 
1066
    PROTO_T ( dg_enum_list values X dg_idname_option tagname X
-
 
1067
	      dg_sourcepos_option src_pos X shape sha X bool new_type )
-
 
1068
{
-
 
1069
  dg_type ans = new_dg_type(DGT_ENUM);
-
 
1070
  ans->data.t_enum.tnam = idname_chars (tagname);
-
 
1071
  ans->data.t_enum.tpos = shorten_sourcepos (src_pos);
-
 
1072
  ans->data.t_enum.values = values;
-
 
1073
  ans->data.t_enum.sha = sha;
-
 
1074
  if (new_type) {
-
 
1075
    extend_dg_type (ans);
-
 
1076
    ans->mor->isnew = new_type;
-
 
1077
  }
-
 
1078
  return ans;
-
 
1079
}
-
 
1080
 
-
 
1081
dg_type f_dg_string_type
-
 
1082
    PROTO_N ( (character_type, lower_bound, length) )
-
 
1083
    PROTO_T ( dg_tag character_type X exp lower_bound X exp length )
-
 
1084
{
674
{
1085
  dg_type ans = new_dg_type(DGT_STRING);
675
	tokval v;
1086
  ans->data.t_string.ct = character_type;
-
 
1087
  ans->data.t_string.lb = diaginfo_exp (lower_bound);
676
	v = apply_tok(token_value, token_args, DG_NAME_SORT, (tokval *)0);
1088
  ans->data.t_string.length = diaginfo_exp (length);
-
 
1089
  return ans;
677
	return v.tk_dg_name;
1090
}
678
}
1091
 
679
 
1422
{
1528
{
1423
  return;
1529
	return;
1424
}
1530
}
1425
 
1531
 
1426
dg_class_base f_dummy_dg_class_base;
-
 
1427
 
-
 
1428
dg_class_base f_make_dg_class_base
-
 
1429
    PROTO_N ( (base, whence, location, accessibility, virtuality) )
-
 
1430
    PROTO_T ( dg_tag base X dg_sourcepos_option whence X
-
 
1431
	      token_option location X dg_accessibility_option accessibility X
-
 
1432
	      dg_virtuality_option virtuality )
-
 
1433
{
-
 
1434
  dg_class_base ans;
-
 
1435
  ans.base = base;
-
 
1436
  ans.pos = shorten_sourcepos (whence);
-
 
1437
  if (location.present) {
-
 
1438
    shape ptr_sh = f_pointer (f_alignment (ulongsh));
-
 
1439
    ans.location = relative_exp (ptr_sh, location.val);
-
 
1440
  }
-
 
1441
  else
-
 
1442
    ans.location = nilexp;
-
 
1443
  ans.acc = accessibility;
-
 
1444
  ans.virt = virtuality;
-
 
1445
  return ans;
-
 
1446
}
-
 
1447
 
-
 
1448
void init_dg_class_base
-
 
1449
    PROTO_Z ()
-
 
1450
{
-
 
1451
  return;
-
 
1452
}
-
 
1453
 
1532
 
1454
dg_classmem f_dummy_dg_classmem;
1533
dg_classmem f_dummy_dg_classmem;
1455
 
1534
 
1456
dg_classmem f_dg_tag_classmem
1535
dg_classmem
1457
    PROTO_N ( (tg, mem) )
-
 
1458
    PROTO_T ( dg_tag tg X dg_classmem mem )
1536
f_dg_tag_classmem(dg_tag tg, dg_classmem mem)
1459
{
1537
{
-
 
1538
	if (tg->key) {
1460
  if (tg->key) failer ("dg_tag defined twice");
1539
		failer("dg_tag defined twice");
-
 
1540
	}
1461
  tg->key = DGK_CLASSMEM;
1541
	tg->key = DGK_CLASSMEM;
1462
  mem.tg = tg;
1542
	mem.tg = tg;
1463
  return mem;
1543
	return mem;
1464
}
1544
}
-
 
1545
 
1465
 
1546
 
1466
dg_classmem f_dg_field_classmem
1547
dg_classmem
1467
    PROTO_N ( (idname, src_pos, offset, field_type, accessibility,
-
 
1468
		discr, deflt) )
-
 
1469
    PROTO_T ( dg_idname idname X dg_sourcepos src_pos X exp offset X
1548
f_dg_field_classmem(dg_idname idname, dg_sourcepos src_pos, exp offset,
1470
	      dg_type field_type X dg_accessibility_option accessibility X
1549
		    dg_type field_type, dg_accessibility_option accessibility,
1471
	      bool_option discr X dg_default_option deflt )
1550
		    bool_option discr, dg_default_option deflt)
1472
{
1551
{
1473
  int is_discr = 0;
1552
	int is_discr = 0;
1474
  dg_classmem ans;
1553
	dg_classmem ans;
1475
  ans.cm_key = DG_CM_FIELD;
1554
	ans.cm_key = DG_CM_FIELD;
1476
  ans.d.cm_f.fnam = idname_chars (idname);
1555
	ans.d.cm_f.fnam = idname_chars(idname);
1477
  ans.d.cm_f.f_pos = shorten_sourcepos (src_pos);
1556
	ans.d.cm_f.f_pos = shorten_sourcepos(src_pos);
1478
  ans.d.cm_f.f_typ = field_type;
1557
	ans.d.cm_f.f_typ = field_type;
1479
  ans.d.cm_f.f_offset = diaginfo_exp (offset);
1558
	ans.d.cm_f.f_offset = diaginfo_exp(offset);
1480
  ans.d.cm_f.acc = accessibility;
1559
	ans.d.cm_f.acc = accessibility;
1481
  if (discr.present)
1560
	if (discr.present) {
1482
    is_discr = discr.val;
1561
		is_discr = discr.val;
-
 
1562
	}
1483
  ans.d.cm_f.discr = is_discr;
1563
	ans.d.cm_f.discr = is_discr;
1484
  ans.d.cm_f.dflt = deflt;
1564
	ans.d.cm_f.dflt = deflt;
1485
  ans.tg = (dg_tag)0;
1565
	ans.tg = (dg_tag)0;
1486
  return ans;
1566
	return ans;
1487
}
1567
}
-
 
1568
 
1488
 
1569
 
1489
dg_classmem f_dg_function_classmem
1570
dg_classmem
1490
    PROTO_N ( (fn, vtable_slot) )
-
 
1491
    PROTO_T ( dg_name fn X exp_option vtable_slot )
1571
f_dg_function_classmem(dg_name fn, exp_option vtable_slot)
1492
{
1572
{
1493
  dg_classmem ans;
1573
	dg_classmem ans;
1494
  ans.cm_key = DG_CM_FN;
1574
	ans.cm_key = DG_CM_FN;
1495
  ans.d.cm_fn.fn = fn;
1575
	ans.d.cm_fn.fn = fn;
1496
  if (vtable_slot.present)
1576
	if (vtable_slot.present) {
1497
    ans.d.cm_fn.slot = diaginfo_exp (vtable_slot.val);
1577
		ans.d.cm_fn.slot = diaginfo_exp(vtable_slot.val);
1498
  else
1578
	} else {
1499
    ans.d.cm_fn.slot = nilexp;
1579
		ans.d.cm_fn.slot = nilexp;
-
 
1580
	}
1500
  ans.tg = (dg_tag)0;
1581
	ans.tg = (dg_tag)0;
1501
  return ans;
1582
	return ans;
1502
}
1583
}
-
 
1584
 
1503
 
1585
 
1504
dg_classmem f_dg_indirect_classmem
1586
dg_classmem
1505
    PROTO_N ( (idname, src_pos, location, cmem_type) )
-
 
1506
    PROTO_T ( dg_idname idname X dg_sourcepos src_pos X token location X
1587
f_dg_indirect_classmem(dg_idname idname, dg_sourcepos src_pos, token location,
1507
	      dg_type cmem_type )
1588
		       dg_type cmem_type)
1508
{
1589
{
1509
  dg_classmem ans;
1590
	dg_classmem ans;
1510
  ans.cm_key = DG_CM_INDIRECT;
1591
	ans.cm_key = DG_CM_INDIRECT;
1511
  ans.d.cm_ind.nam = idname_chars (idname);
1592
	ans.d.cm_ind.nam = idname_chars(idname);
1512
  ans.d.cm_ind.pos = shorten_sourcepos (src_pos);
1593
	ans.d.cm_ind.pos = shorten_sourcepos(src_pos);
1513
  ans.d.cm_ind.typ = cmem_type;
1594
	ans.d.cm_ind.typ = cmem_type;
1514
  ans.d.cm_ind.ind_loc = relative_exp (f_pointer (f_alignment (ulongsh)), location);
1595
	ans.d.cm_ind.ind_loc = relative_exp(f_pointer(f_alignment(ulongsh)),
-
 
1596
					    location);
1515
  ans.tg = (dg_tag)0;
1597
	ans.tg = (dg_tag)0;
1516
  return ans;
1598
	return ans;
1517
}
1599
}
-
 
1600
 
1518
 
1601
 
1519
dg_classmem f_dg_name_classmem
1602
dg_classmem
1520
    PROTO_N ( (nam) )
-
 
1521
    PROTO_T ( dg_name nam )
1603
f_dg_name_classmem(dg_name nam)
1522
{
1604
{
1523
  dg_classmem ans;
1605
	dg_classmem ans;
1524
  ans.cm_key = DG_CM_STAT;
1606
	ans.cm_key = DG_CM_STAT;
1525
  ans.d.cm_stat = nam;
1607
	ans.d.cm_stat = nam;
1526
  ans.tg = (dg_tag)0;
1608
	ans.tg = (dg_tag)0;
1527
  return ans;
1609
	return ans;
1528
}
1610
}
-
 
1611
 
1529
 
1612
 
-
 
1613
void
1530
void init_dg_classmem
1614
init_dg_classmem(void)
1531
    PROTO_Z ()
-
 
1532
{
1615
{
1533
  return;
1616
	return;
1534
}
1617
}
-
 
1618
 
1535
 
1619
 
1536
dg_qualifier f_dummy_dg_qualifier;
1620
dg_qualifier f_dummy_dg_qualifier;
1537
 
1621
 
1538
dg_qualifier f_dg_const_qualifier = DG_CONST_T;
1622
dg_qualifier f_dg_const_qualifier = DG_CONST_T;
1539
 
1623
 
Line 1542... Line 1626...
1542
dg_qualifier f_dg_aliased_qualifier = DG_ALIAS_T;
1626
dg_qualifier f_dg_aliased_qualifier = DG_ALIAS_T;
1543
 
1627
 
1544
dg_qualifier f_dg_class_wide_qualifier = DG_CLWID_T;
1628
dg_qualifier f_dg_class_wide_qualifier = DG_CLWID_T;
1545
 
1629
 
1546
dg_qualifier f_dg_limited_qualifier = DG_LIM_T;
1630
dg_qualifier f_dg_limited_qualifier = DG_LIM_T;
1547
 
1631
 
1548
void init_dg_qualifier
-
 
1549
    PROTO_Z ()
-
 
1550
{
-
 
1551
  return;
-
 
1552
}
-
 
1553
 
-
 
1554
dg_bound f_dummy_dg_bound;
-
 
1555
 
-
 
1556
dg_bound f_dg_dynamic_bound
-
 
1557
    PROTO_N ( (bound, sha) )
-
 
1558
    PROTO_T ( dg_tag bound X shape sha )
-
 
1559
{
-
 
1560
  dg_bound ans;
-
 
1561
  ans.is_ref = 1;
-
 
1562
  ans.u.tg = bound;
-
 
1563
  ans.sha = sha;
-
 
1564
  return ans;
-
 
1565
}
1632
void
1566
 
-
 
1567
dg_bound f_dg_static_bound
1633
init_dg_qualifier(void)
1568
    PROTO_N ( (bound) )
-
 
1569
    PROTO_T ( exp bound )
-
 
1570
{
-
 
1571
  dg_bound ans;
-
 
1572
  if (name(bound) != val_tag)
-
 
1573
    failer ("not a constant");
-
 
1574
  ans.is_ref = 0;
-
 
1575
  ans.u.x = diaginfo_exp (bound);
-
 
1576
  ans.sha = sh(bound);
-
 
1577
  return ans;
-
 
1578
}
-
 
1579
 
-
 
1580
dg_bound f_dg_unknown_bound
-
 
1581
    PROTO_N ( (sha) )
-
 
1582
    PROTO_T ( shape sha )
-
 
1583
{
1634
{
1584
  dg_bound ans;
-
 
1585
  ans.is_ref = 1;
-
 
1586
  ans.u.tg = (dg_tag)0;
-
 
1587
  ans.sha = sha;
-
 
1588
  return ans;
1635
	return;
1589
}
1636
}
1590
 
1637
 
1591
void init_dg_bound
-
 
1592
    PROTO_Z ()
-
 
1593
{
-
 
1594
  return;
-
 
1595
}
-
 
1596
 
-
 
1597
dg_dim f_dummy_dg_dim;
-
 
1598
 
-
 
1599
dg_dim f_dg_dim_apply_token
-
 
1600
    PROTO_N ( (token_value, token_args) )
-
 
1601
    PROTO_T ( token token_value X bitstream token_args )
-
 
1602
{
-
 
1603
   tokval v;
-
 
1604
   v = apply_tok(token_value, token_args,  DG_DIM_SORT, (tokval*)0);
-
 
1605
   return v.tk_dg_dim;
-
 
1606
}
-
 
1607
 
-
 
1608
dg_dim f_dg_tag_dim
-
 
1609
    PROTO_N ( (tg, d) )
-
 
1610
    PROTO_T ( dg_tag tg X dg_dim d )
-
 
1611
{
-
 
1612
  if (tg->key) failer ("dg_tag defined twice");
-
 
1613
  tg->key = DGK_DIM;
-
 
1614
  d.tg = tg;
-
 
1615
  return d;
-
 
1616
}
-
 
1617
 
-
 
1618
dg_dim f_dg_bounds_dim
-
 
1619
    PROTO_N ( (low, high, index_type) )
-
 
1620
    PROTO_T ( dg_bound low X dg_bound high X dg_type index_type )
-
 
1621
{
-
 
1622
  dg_dim ans;
-
 
1623
  ans.d_key = DG_DIM_BOUNDS;
-
 
1624
  ans.low_ref = low.is_ref;
-
 
1625
  ans.hi_ref = high.is_ref;
-
 
1626
  ans.hi_cnt = 0;
-
 
1627
  ans.d_typ = index_type;
-
 
1628
  ans.sha = low.sha;
-
 
1629
  ans.lower = low.u;
-
 
1630
  ans.upper = high.u;
-
 
1631
  if (low.is_ref || high.is_ref)
-
 
1632
    ans.count = -1;
-
 
1633
  else
-
 
1634
    ans.count = (long)(no(son(high.u.x)) - no(son(low.u.x)) + 1);
-
 
1635
  ans.tg = (dg_tag)0;
-
 
1636
  return ans;
-
 
1637
}
-
 
1638
 
-
 
1639
dg_dim f_dg_count_dim
-
 
1640
    PROTO_N ( (low, count, index_type) )
-
 
1641
    PROTO_T ( dg_bound low X dg_bound count X dg_type index_type )
-
 
1642
{
-
 
1643
  dg_dim ans;
-
 
1644
  ans.d_key = DG_DIM_BOUNDS;
-
 
1645
  ans.low_ref = low.is_ref;
-
 
1646
  ans.hi_ref = count.is_ref;
-
 
1647
  ans.hi_cnt = 1;
-
 
1648
  ans.d_typ = index_type;
-
 
1649
  ans.sha = low.sha;
-
 
1650
  ans.lower = low.u;
-
 
1651
  ans.upper = count.u;
-
 
1652
  if (count.is_ref)
-
 
1653
    ans.count = -1;
-
 
1654
  else
-
 
1655
    ans.count = (long)(no(son(count.u.x)));
-
 
1656
  ans.tg = (dg_tag)0;
-
 
1657
  return ans;
-
 
1658
}
-
 
1659
 
-
 
1660
dg_dim f_dg_type_dim
-
 
1661
    PROTO_N ( (type, n) )
-
 
1662
    PROTO_T ( dg_type type X nat_option n )
-
 
1663
{
-
 
1664
  dg_dim ans;
-
 
1665
  ans.d_key = DG_DIM_TYPE;
-
 
1666
  ans.d_typ = type;
-
 
1667
  if (n.present)
-
 
1668
    ans.count = (long)n.val.nat_val.small_nat;
-
 
1669
  else
-
 
1670
    ans.count = -1;
-
 
1671
  ans.tg = (dg_tag)0;
-
 
1672
  return ans;
-
 
1673
}
-
 
1674
 
-
 
1675
dg_dim f_dg_unspecified_dim;
-
 
1676
 
-
 
1677
void init_dg_dim
-
 
1678
    PROTO_Z ()
-
 
1679
{
-
 
1680
  f_dg_unspecified_dim.d_key = DG_DIM_NONE;
-
 
1681
  f_dg_unspecified_dim.low_ref = f_dg_unspecified_dim.hi_ref = 1;
-
 
1682
  f_dg_unspecified_dim.hi_cnt = 0;
-
 
1683
  f_dg_unspecified_dim.count = -1;
-
 
1684
  f_dg_unspecified_dim.d_typ = (dg_type)0;
-
 
1685
  f_dg_unspecified_dim.sha = f_top;
-
 
1686
  f_dg_unspecified_dim.lower.tg = f_dg_unspecified_dim.upper.tg = (dg_tag)0;
-
 
1687
  f_dg_unspecified_dim.tg = (dg_tag)0;
-
 
1688
  return;
-
 
1689
}
-
 
1690
 
-
 
1691
dg_enum f_dummy_dg_enum;
-
 
1692
 
-
 
1693
dg_enum f_make_dg_enum
-
 
1694
    PROTO_N ( (value, idname, src_pos) )
-
 
1695
    PROTO_T ( exp value X dg_idname idname X dg_sourcepos src_pos )
-
 
1696
{
-
 
1697
  dg_enum ans;
-
 
1698
  if (!value || name(value) != val_tag)
-
 
1699
    failer ("enum value not const");
-
 
1700
  ans.enam = idname_chars (idname);
-
 
1701
  ans.pos = shorten_sourcepos (src_pos);
-
 
1702
  ans.value = diaginfo_exp (value);
-
 
1703
  ans.is_chn = 0;
-
 
1704
  ans.tg = (dg_tag)0;
-
 
1705
  return ans;
-
 
1706
}
-
 
1707
 
-
 
1708
dg_enum f_dg_char_enum
-
 
1709
    PROTO_N ( (value, idchar, src_pos) )
-
 
1710
    PROTO_T ( exp value X nat idchar X dg_sourcepos src_pos )
-
 
1711
{
-
 
1712
  dg_enum ans;
-
 
1713
  if (!value || name(value) != val_tag)
-
 
1714
    failer ("enum value not const");
-
 
1715
  ans.chn = idchar.nat_val.small_nat;
-
 
1716
  ans.pos = shorten_sourcepos (src_pos);
-
 
1717
  ans.value = diaginfo_exp (value);
-
 
1718
  ans.is_chn = 1;
-
 
1719
  ans.tg = (dg_tag)0;
-
 
1720
  return ans;
-
 
1721
}
-
 
1722
 
1638
 
1723
dg_enum f_dg_tag_enum
1639
dg_bound f_dummy_dg_bound;
-
 
1640
 
1724
    PROTO_N ( (tg, e) )
1641
dg_bound
1725
    PROTO_T ( dg_tag tg X dg_enum e )
1642
f_dg_dynamic_bound(dg_tag bound, shape sha)
1726
{
1643
{
-
 
1644
	dg_bound ans;
-
 
1645
	ans.is_ref = 1;
-
 
1646
	ans.u.tg = bound;
-
 
1647
	ans.sha = sha;
-
 
1648
	return ans;
-
 
1649
}
-
 
1650
 
-
 
1651
 
-
 
1652
dg_bound
-
 
1653
f_dg_static_bound(exp bound)
-
 
1654
{
-
 
1655
	dg_bound ans;
-
 
1656
	if (name(bound) != val_tag) {
-
 
1657
		failer("not a constant");
-
 
1658
	}
-
 
1659
	ans.is_ref = 0;
-
 
1660
	ans.u.x = diaginfo_exp(bound);
-
 
1661
	ans.sha = sh(bound);
-
 
1662
	return ans;
-
 
1663
}
-
 
1664
 
-
 
1665
 
-
 
1666
dg_bound
-
 
1667
f_dg_unknown_bound(shape sha)
-
 
1668
{
-
 
1669
	dg_bound ans;
-
 
1670
	ans.is_ref = 1;
-
 
1671
	ans.u.tg = (dg_tag)0;
-
 
1672
	ans.sha = sha;
-
 
1673
	return ans;
-
 
1674
}
-
 
1675
 
-
 
1676
 
-
 
1677
void
-
 
1678
init_dg_bound(void)
-
 
1679
{
-
 
1680
	return;
-
 
1681
}
-
 
1682
 
-
 
1683
 
-
 
1684
dg_dim f_dummy_dg_dim;
-
 
1685
 
-
 
1686
dg_dim
-
 
1687
f_dg_dim_apply_token(token token_value, bitstream token_args)
-
 
1688
{
-
 
1689
	tokval v;
-
 
1690
	v = apply_tok(token_value, token_args, DG_DIM_SORT, (tokval *)0);
-
 
1691
	return v.tk_dg_dim;
-
 
1692
}
-
 
1693
 
-
 
1694
 
-
 
1695
dg_dim
-
 
1696
f_dg_tag_dim(dg_tag tg, dg_dim d)
-
 
1697
{
-
 
1698
	if (tg->key) {
1727
  if (tg->key) failer ("dg_tag defined twice");
1699
		failer("dg_tag defined twice");
-
 
1700
	}
-
 
1701
	tg->key = DGK_DIM;
-
 
1702
	d.tg = tg;
-
 
1703
	return d;
-
 
1704
}
-
 
1705
 
-
 
1706
 
-
 
1707
dg_dim
-
 
1708
f_dg_bounds_dim(dg_bound low, dg_bound high, dg_type index_type)
-
 
1709
{
-
 
1710
	dg_dim ans;
-
 
1711
	ans.d_key = DG_DIM_BOUNDS;
-
 
1712
	ans.low_ref = low.is_ref;
-
 
1713
	ans.hi_ref = high.is_ref;
-
 
1714
	ans.hi_cnt = 0;
-
 
1715
	ans.d_typ = index_type;
-
 
1716
	ans.sha = low.sha;
-
 
1717
	ans.lower = low.u;
-
 
1718
	ans.upper = high.u;
-
 
1719
	if (low.is_ref || high.is_ref) {
-
 
1720
		ans.count = -1;
-
 
1721
	} else {
-
 
1722
		ans.count = (long)(no(son(high.u.x)) - no(son(low.u.x)) + 1);
-
 
1723
	}
-
 
1724
	ans.tg = (dg_tag)0;
-
 
1725
	return ans;
-
 
1726
}
-
 
1727
 
-
 
1728
 
-
 
1729
dg_dim
-
 
1730
f_dg_count_dim(dg_bound low, dg_bound count, dg_type index_type)
-
 
1731
{
-
 
1732
	dg_dim ans;
-
 
1733
	ans.d_key = DG_DIM_BOUNDS;
-
 
1734
	ans.low_ref = low.is_ref;
-
 
1735
	ans.hi_ref = count.is_ref;
-
 
1736
	ans.hi_cnt = 1;
-
 
1737
	ans.d_typ = index_type;
-
 
1738
	ans.sha = low.sha;
-
 
1739
	ans.lower = low.u;
-
 
1740
	ans.upper = count.u;
-
 
1741
	if (count.is_ref) {
-
 
1742
		ans.count = -1;
-
 
1743
	} else {
-
 
1744
		ans.count = (long)(no(son(count.u.x)));
-
 
1745
	}
-
 
1746
	ans.tg = (dg_tag)0;
-
 
1747
	return ans;
-
 
1748
}
-
 
1749
 
-
 
1750
 
-
 
1751
dg_dim
-
 
1752
f_dg_type_dim(dg_type type, nat_option n)
-
 
1753
{
-
 
1754
	dg_dim ans;
-
 
1755
	ans.d_key = DG_DIM_TYPE;
-
 
1756
	ans.d_typ = type;
-
 
1757
	if (n.present) {
-
 
1758
		ans.count = (long)n.val.nat_val.small_nat;
-
 
1759
	} else {
-
 
1760
		ans.count = -1;
-
 
1761
	}
-
 
1762
	ans.tg = (dg_tag)0;
-
 
1763
	return ans;
-
 
1764
}
-
 
1765
 
-
 
1766
 
-
 
1767
dg_dim f_dg_unspecified_dim;
-
 
1768
 
-
 
1769
void
-
 
1770
init_dg_dim(void)
-
 
1771
{
-
 
1772
	f_dg_unspecified_dim.d_key = DG_DIM_NONE;
-
 
1773
	f_dg_unspecified_dim.low_ref = f_dg_unspecified_dim.hi_ref = 1;
-
 
1774
	f_dg_unspecified_dim.hi_cnt = 0;
-
 
1775
	f_dg_unspecified_dim.count = -1;
-
 
1776
	f_dg_unspecified_dim.d_typ = (dg_type)0;
-
 
1777
	f_dg_unspecified_dim.sha = f_top;
-
 
1778
	f_dg_unspecified_dim.lower.tg = f_dg_unspecified_dim.upper.tg =
-
 
1779
	    (dg_tag)0;
-
 
1780
	f_dg_unspecified_dim.tg = (dg_tag)0;
-
 
1781
	return;
-
 
1782
}
-
 
1783
 
-
 
1784
 
-
 
1785
dg_enum f_dummy_dg_enum;
-
 
1786
 
-
 
1787
dg_enum
-
 
1788
f_make_dg_enum(exp value, dg_idname idname, dg_sourcepos src_pos)
-
 
1789
{
-
 
1790
	dg_enum ans;
-
 
1791
	if (!value || name(value) != val_tag) {
-
 
1792
		failer("enum value not const");
-
 
1793
	}
-
 
1794
	ans.enam = idname_chars(idname);
-
 
1795
	ans.pos = shorten_sourcepos(src_pos);
-
 
1796
	ans.value = diaginfo_exp(value);
-
 
1797
	ans.is_chn = 0;
-
 
1798
	ans.tg = (dg_tag)0;
-
 
1799
	return ans;
-
 
1800
}
-
 
1801
 
-
 
1802
 
-
 
1803
dg_enum
-
 
1804
f_dg_char_enum(exp value, nat idchar, dg_sourcepos src_pos)
-
 
1805
{
-
 
1806
	dg_enum ans;
-
 
1807
	if (!value || name(value) != val_tag) {
-
 
1808
		failer("enum value not const");
-
 
1809
	}
-
 
1810
	ans.chn = idchar.nat_val.small_nat;
-
 
1811
	ans.pos = shorten_sourcepos(src_pos);
-
 
1812
	ans.value = diaginfo_exp(value);
-
 
1813
	ans.is_chn = 1;
-
 
1814
	ans.tg = (dg_tag)0;
-
 
1815
	return ans;
-
 
1816
}
-
 
1817
 
-
 
1818
 
-
 
1819
dg_enum
-
 
1820
f_dg_tag_enum(dg_tag tg, dg_enum e)
-
 
1821
{
-
 
1822
	if (tg->key) {
-
 
1823
		failer("dg_tag defined twice");
-
 
1824
	}
1728
  tg->key = DGK_ENUM;
1825
	tg->key = DGK_ENUM;
1729
  e.tg = tg;
1826
	e.tg = tg;
1730
  return e;
1827
	return e;
1731
}
1828
}
1732
 
1829
 
1733
void init_dg_enum
-
 
1734
    PROTO_Z ()
-
 
1735
{
-
 
1736
  return;
-
 
1737
}
-
 
1738
 
-
 
1739
dg_param f_dummy_dg_param;
-
 
1740
 
1830
 
1741
dg_param f_dg_object_param
1831
void
1742
    PROTO_N ( (idname, src_pos, mode, param_type, deflt) )
-
 
1743
    PROTO_T ( dg_idname_option idname X dg_sourcepos_option src_pos X
-
 
1744
	      dg_param_mode_option mode X dg_type param_type X
-
 
1745
	      dg_default_option deflt )
1832
init_dg_enum(void)
1746
{
1833
{
1747
  dg_param ans;
-
 
1748
  ans.pnam = idname_chars (idname);
-
 
1749
  ans.ppos = shorten_sourcepos (src_pos);
-
 
1750
  ans.pmode = mode;
-
 
1751
  ans.p_typ = param_type;
-
 
1752
  ans.p_dflt = deflt;
-
 
1753
  return ans;
1834
	return;
1754
}
1835
}
1755
 
1836
 
1756
dg_param f_dg_type_param
1837
dg_param f_dummy_dg_param;
-
 
1838
 
-
 
1839
dg_param
-
 
1840
f_dg_object_param(dg_idname_option idname, dg_sourcepos_option src_pos,
-
 
1841
		  dg_param_mode_option mode, dg_type param_type,
-
 
1842
		  dg_default_option deflt)
-
 
1843
{
-
 
1844
	dg_param ans;
1757
    PROTO_N ( (idname, src_pos, fparams) )
1845
	ans.pnam = idname_chars(idname);
-
 
1846
	ans.ppos = shorten_sourcepos(src_pos);
-
 
1847
	ans.pmode = mode;
-
 
1848
	ans.p_typ = param_type;
-
 
1849
	ans.p_dflt = deflt;
-
 
1850
	return ans;
-
 
1851
}
-
 
1852
 
-
 
1853
 
-
 
1854
dg_param
1758
    PROTO_T ( dg_idname_option idname X dg_sourcepos_option src_pos X dg_param_list fparams )
1855
f_dg_type_param(dg_idname_option idname, dg_sourcepos_option src_pos,
-
 
1856
		dg_param_list fparams)
1759
{
1857
{
1760
  failer ("dg_type_param not yet supported");
1858
	failer("dg_type_param not yet supported");
1761
  UNUSED (idname);
1859
	UNUSED(idname);
1762
  UNUSED (src_pos);
1860
	UNUSED(src_pos);
1763
  UNUSED (fparams);
1861
	UNUSED(fparams);
1764
  return f_dummy_dg_param;
1862
	return f_dummy_dg_param;
1765
}
1863
}
-
 
1864
 
1766
 
1865
 
1767
void init_dg_param
1866
void
1768
    PROTO_Z ()
1867
init_dg_param(void)
1769
{
1868
{
1770
  return;
1869
	return;
1771
}
1870
}
1772
 
1871
 
1773
dg_param_mode f_dummy_dg_param_mode;
1872
dg_param_mode f_dummy_dg_param_mode;
1774
 
1873
 
1775
dg_param_mode f_dg_in_mode = DG_IN_MODE;
1874
dg_param_mode f_dg_in_mode = DG_IN_MODE;
1776
 
1875
 
1777
dg_param_mode f_dg_out_mode = DG_OUT_MODE;
1876
dg_param_mode f_dg_out_mode = DG_OUT_MODE;
1778
 
1877
 
1779
dg_param_mode f_dg_inout_mode = DG_INOUT_MODE;
1878
dg_param_mode f_dg_inout_mode = DG_INOUT_MODE;
-
 
1879
 
1780
 
1880
 
-
 
1881
void
1781
void init_dg_param_mode
1882
init_dg_param_mode(void)
1782
    PROTO_Z ()
-
 
1783
{
1883
{
1784
  return;
1884
	return;
1785
}
1885
}
1786
 
1886
 
1787
dg_accessibility f_dummy_dg_accessibility;
1887
dg_accessibility f_dummy_dg_accessibility;
1788
 
1888
 
1789
dg_accessibility f_dg_public_accessibility = DG_ACC_PUB;
1889
dg_accessibility f_dg_public_accessibility = DG_ACC_PUB;
1790
 
1890
 
1791
dg_accessibility f_dg_private_accessibility = DG_ACC_PRIV;
1891
dg_accessibility f_dg_private_accessibility = DG_ACC_PRIV;
1792
 
1892
 
1793
dg_accessibility f_dg_protected_accessibility = DG_ACC_PROT;
1893
dg_accessibility f_dg_protected_accessibility = DG_ACC_PROT;
1794
 
1894
 
1795
dg_accessibility f_dg_local_accessibility = DG_ACC_LOC;
1895
dg_accessibility f_dg_local_accessibility = DG_ACC_LOC;
1796
 
1896
 
-
 
1897
 
-
 
1898
void
1797
void init_dg_accessibility
1899
init_dg_accessibility(void)
1798
    PROTO_Z ()
-
 
1799
{
1900
{
1800
  return;
1901
	return;
1801
}
1902
}
1802
 
1903
 
1803
dg_virtuality f_dummy_dg_virtuality;
1904
dg_virtuality f_dummy_dg_virtuality;
1804
 
1905
 
1805
dg_virtuality f_dg_virtual_virtuality = DG_VIRT_VIRT;
1906
dg_virtuality f_dg_virtual_virtuality = DG_VIRT_VIRT;
1806
 
1907
 
1807
dg_virtuality f_dg_abstract_virtuality = DG_VIRT_PURE;
1908
dg_virtuality f_dg_abstract_virtuality = DG_VIRT_PURE;
-
 
1909
 
1808
 
1910
 
-
 
1911
void
1809
void init_dg_virtuality
1912
init_dg_virtuality(void)
1810
    PROTO_Z ()
-
 
1811
{
1913
{
1812
  return;
1914
	return;
1813
}
1915
}
-
 
1916
 
1814
 
1917
 
1815
dg_filename f_dummy_dg_filename;
1918
dg_filename f_dummy_dg_filename;
1816
 
1919
 
1817
dg_filename f_dg_filename_apply_token
1920
dg_filename
1818
    PROTO_N ( (token_value, token_args) )
-
 
1819
    PROTO_T ( token token_value X bitstream token_args )
1921
f_dg_filename_apply_token(token token_value, bitstream token_args)
1820
{
1922
{
1821
   tokval v;
1923
	tokval v;
1822
   v = apply_tok(token_value, token_args,  DG_FILENAME_SORT, (tokval*)0);
1924
	v = apply_tok(token_value, token_args, DG_FILENAME_SORT, (tokval *)0);
1823
   return v.tk_dg_filename;
1925
	return v.tk_dg_filename;
1824
}
1926
}
-
 
1927
 
1825
 
1928
 
1826
dg_filename f_make_dg_filename
1929
dg_filename
1827
    PROTO_N ( (date, machine, path, file) )
-
 
1828
    PROTO_T ( nat date X string machine X string path X string file )
1930
f_make_dg_filename(nat date, string machine, string path, string file)
1829
{
1931
{
1830
  return get_filename ((long)(date.nat_val.small_nat), machine.ints.chars,
1932
	return get_filename((long)(date.nat_val.small_nat), machine.ints.chars,
1831
	path.ints.chars, file.ints.chars);
1933
			    path.ints.chars, file.ints.chars);
1832
}
1934
}
-
 
1935
 
1833
 
1936
 
-
 
1937
void
1834
void init_dg_filename
1938
init_dg_filename(void)
1835
    PROTO_Z ()
-
 
1836
{
1939
{
1837
  return;
1940
	return;
1838
}
1941
}
-
 
1942
 
1839
 
1943
 
1840
dg_sourcepos f_dummy_dg_sourcepos;
1944
dg_sourcepos f_dummy_dg_sourcepos;
1841
 
1945
 
1842
dg_sourcepos f_dg_span_sourcepos
1946
dg_sourcepos f_dg_span_sourcepos(dg_filename file, nat from_line,
1843
    PROTO_N ( (file, from_line, from_column, to_file, to_line, to_column) )
1947
				 nat from_column, dg_filename_option to_file,
-
 
1948
				 nat to_line, nat to_column)
-
 
1949
{
-
 
1950
	dg_sourcepos ans;
-
 
1951
	ans.sp_key = SP_SPAN;
-
 
1952
	ans.file = file;
-
 
1953
	if (!(ans.to_file = to_file)) {
-
 
1954
		ans.to_file = file;
-
 
1955
	}
-
 
1956
	ans.from_line = from_line.nat_val.small_nat;
-
 
1957
	ans.from_column = (short)from_column.nat_val.small_nat;
-
 
1958
	ans.to_line = to_line.nat_val.small_nat;
-
 
1959
	ans.to_column = (short)to_column.nat_val.small_nat;
-
 
1960
	return ans;
-
 
1961
}
-
 
1962
 
-
 
1963
 
-
 
1964
dg_sourcepos
1844
    PROTO_T ( dg_filename file X nat from_line X nat from_column X
1965
f_dg_mark_sourcepos(dg_filename file, nat line, nat column)
-
 
1966
{
-
 
1967
	dg_sourcepos ans;
-
 
1968
	ans.sp_key = SP_SHORT;
-
 
1969
	ans.file = file;
-
 
1970
	ans.from_line = line.nat_val.small_nat;
-
 
1971
	ans.from_column = (short)column.nat_val.small_nat;
-
 
1972
	return ans;
-
 
1973
}
-
 
1974
 
-
 
1975
 
-
 
1976
dg_sourcepos
1845
	      dg_filename_option to_file X nat to_line X nat to_column )
1977
f_dg_file_sourcepos(dg_filename file)
1846
{
1978
{
1847
  dg_sourcepos ans;
1979
	dg_sourcepos ans;
1848
  ans.sp_key = SP_SPAN;
1980
	ans.sp_key = SP_FILE;
1849
  ans.file = file;
1981
	ans.file = file;
1850
  if (!(ans.to_file = to_file))
-
 
1851
    ans.to_file = file;
-
 
1852
  ans.from_line = from_line.nat_val.small_nat;
-
 
1853
  ans.from_column = (short)from_column.nat_val.small_nat;
-
 
1854
  ans.to_line = to_line.nat_val.small_nat;
-
 
1855
  ans.to_column = (short)to_column.nat_val.small_nat;
-
 
1856
  return ans;
1982
	return ans;
1857
}
1983
}
1858
 
1984
 
1859
dg_sourcepos f_dg_mark_sourcepos
-
 
1860
    PROTO_N ( (file, line, column) )
-
 
1861
    PROTO_T ( dg_filename file X nat line X nat column )
-
 
1862
{
-
 
1863
  dg_sourcepos ans;
-
 
1864
  ans.sp_key = SP_SHORT;
-
 
1865
  ans.file = file;
-
 
1866
  ans.from_line = line.nat_val.small_nat;
-
 
1867
  ans.from_column = (short)column.nat_val.small_nat;
-
 
1868
  return ans;
-
 
1869
}
-
 
1870
 
-
 
1871
dg_sourcepos f_dg_file_sourcepos
-
 
1872
    PROTO_N ( (file) )
-
 
1873
    PROTO_T ( dg_filename file )
-
 
1874
{
-
 
1875
  dg_sourcepos ans;
-
 
1876
  ans.sp_key = SP_FILE;
-
 
1877
  ans.file = file;
-
 
1878
  return ans;
-
 
1879
}
-
 
1880
 
1985
 
1881
dg_sourcepos f_dg_global_sourcepos;
1986
dg_sourcepos f_dg_global_sourcepos;
1882
 
1987
 
1883
dg_sourcepos f_dg_null_sourcepos;
1988
dg_sourcepos f_dg_null_sourcepos;
1884
 
1989
 
2278
 
2057
 
2279
dg_type_list add_dg_type_list
-
 
2280
    PROTO_N ( (list, elem, index) )
-
 
2281
    PROTO_T ( dg_type_list list X dg_type elem X int index )
-
 
2282
{
-
 
2283
  list.array[index] = elem;
-
 
2284
  return list;
-
 
2285
}
-
 
2286
 
2058
 
2287
dg_param_list new_dg_param_list
2059
dg_constraint
2288
    PROTO_N ( (n) )
-
 
2289
    PROTO_T ( int n )
2060
f_dg_value_constraint(dg_tag_option ref_member, exp value)
2290
{
2061
{
-
 
2062
	dg_constraint ans = (dg_constraint)xcalloc(1, sizeof(struct dg_con));
-
 
2063
	ans->refmem = ref_member;
2291
  dg_param_list ans;
2064
	ans->is_val = 1;
2292
  ans.len = n;
2065
	ans->u.val = value;
2293
  ans.array = (dg_param *) xcalloc (n, sizeof (dg_param));
2066
	ans->next = (dg_constraint)0;
2294
  return ans;
2067
	return ans;
2295
}
2068
}
2296
 
2069
 
-
 
2070
 
2297
dg_param_list add_dg_param_list
2071
void
2298
    PROTO_N ( (list, elem, index) )
2072
init_dg_constraint(void)
2299
    PROTO_T ( dg_param_list list X dg_param elem X int index )
-
 
2300
{
2073
{
-
 
2074
	return;
-
 
2075
}
-
 
2076
 
-
 
2077
 
-
 
2078
dg_default f_dummy_dg_default;
-
 
2079
 
-
 
2080
dg_default
-
 
2081
f_make_dg_default(exp_option value, dg_sourcepos_option src_span)
-
 
2082
{
-
 
2083
	dg_default ans;
-
 
2084
	if (value.present) {
-
 
2085
		ans.val = diaginfo_exp(value.val);
-
 
2086
	} else {
2301
  list.array[index] = elem;
2087
		ans.val = nilexp;
-
 
2088
	}
-
 
2089
	ans.span = src_span;
-
 
2090
	ans.lab = (long)0;
-
 
2091
	return ans;
-
 
2092
}
-
 
2093
 
-
 
2094
 
-
 
2095
void
-
 
2096
init_dg_default(void)
-
 
2097
{
-
 
2098
	return;
-
 
2099
}
-
 
2100
 
-
 
2101
 
-
 
2102
dg_idname f_dummy_dg_idname;
-
 
2103
 
-
 
2104
dg_idname
-
 
2105
f_dg_idname_apply_token(token token_value, bitstream token_args)
-
 
2106
{
-
 
2107
	tokval v;
-
 
2108
	v = apply_tok(token_value, token_args, DG_IDNAME_SORT, (tokval *)0);
-
 
2109
	return v.tk_dg_idname;
-
 
2110
}
-
 
2111
 
-
 
2112
 
-
 
2113
dg_idname
-
 
2114
f_dg_sourcestring_idname(string src_name)
-
 
2115
{
-
 
2116
	dg_idname ans;
-
 
2117
	ans.id_key = DG_ID_SRC;
-
 
2118
	ans.idd.nam = src_name.ints.chars;
-
 
2119
	return ans;
-
 
2120
}
-
 
2121
 
-
 
2122
 
-
 
2123
dg_idname
-
 
2124
f_dg_anonymous_idname(string_option descr)
-
 
2125
{
-
 
2126
	dg_idname ans;
-
 
2127
	ans.id_key = DG_ID_ANON;
-
 
2128
	UNUSED(descr);
-
 
2129
	ans.idd.nam = "";
2302
  return list;
2130
	return ans;
2303
}
2131
}
2304
 
2132
 
-
 
2133
 
-
 
2134
dg_idname
-
 
2135
f_dg_artificial_idname(string_option aname)
-
 
2136
{
-
 
2137
	dg_idname ans;
2305
dg_dim_list new_dg_dim_list
2138
	ans.id_key = DG_ID_ARTFL;
2306
    PROTO_N ( (n) )
2139
	if (aname.present) {
-
 
2140
		ans.idd.nam = aname.val.ints.chars;
-
 
2141
	} else {
2307
    PROTO_T ( int n )
2142
		ans.idd.nam = "";
-
 
2143
	}
-
 
2144
	return ans;
-
 
2145
}
-
 
2146
 
-
 
2147
 
-
 
2148
dg_idname
-
 
2149
f_dg_instance_idname(dg_idname_option idname, dg_idname spec,
-
 
2150
		     dg_sourcepos whence, dg_name_list aparams)
-
 
2151
{
-
 
2152
	dg_idname ans;
-
 
2153
	ans.id_key = DG_ID_INST;
-
 
2154
	ans.idd.instance = (dg_instantn *)xcalloc(1, sizeof(dg_instantn));
-
 
2155
	ans.idd.instance->nam = idname;
-
 
2156
	ans.idd.instance->spec = spec;
-
 
2157
	ans.idd.instance->whence = shorten_sourcepos(whence);
-
 
2158
	ans.idd.instance->params = aparams;
-
 
2159
	if (ans.idd.instance->nam.id_key == DG_ID_INST ||
-
 
2160
	    ans.idd.instance->spec.id_key == DG_ID_INST) {
-
 
2161
		failer("multiple instantiation");
-
 
2162
	}
-
 
2163
	return ans;
-
 
2164
}
-
 
2165
 
-
 
2166
 
-
 
2167
dg_idname
-
 
2168
f_dg_external_idname(string src_name)
2308
{
2169
{
2460
 
2589
 
2461
dg_append f_dummy_dg_append;
2590
dg_append f_dummy_dg_append;
2462
 
2591
 
2463
dg_append f_dg_name_append
2592
dg_append
2464
    PROTO_N ( (tg, nam) )
-
 
2465
    PROTO_T ( dg_tag tg X dg_name nam )
2593
f_dg_name_append(dg_tag tg, dg_name nam)
2466
{
2594
{
2467
  if (tg->key != DGK_NAMELIST) failer("wrong dg_tag");
2595
	if (tg->key != DGK_NAMELIST) {
-
 
2596
		failer("wrong dg_tag");
-
 
2597
	}
2468
  *(tg->p.nl) = add_dg_name_list (*(tg->p.nl), nam, 0);
2598
	*(tg->p.nl) = add_dg_name_list(*(tg->p.nl), nam, 0);
2469
  return f_dummy_dg_append;
2599
	return f_dummy_dg_append;
-
 
2600
}
-
 
2601
 
-
 
2602
 
-
 
2603
void
-
 
2604
init_dg_append(void)
-
 
2605
{
-
 
2606
	return;
-
 
2607
}
-
 
2608
 
-
 
2609
 
-
 
2610
dg_append_list
-
 
2611
new_dg_append_list(int n)
-
 
2612
{
-
 
2613
	return(dg_append_list)0;
-
 
2614
}
-
 
2615
 
-
 
2616
 
-
 
2617
dg_append_list
-
 
2618
add_dg_append_list(dg_append_list list, dg_append elem, int index)
-
 
2619
{
-
 
2620
	return list;
-
 
2621
}
-
 
2622
 
-
 
2623
 
-
 
2624
dg_macro_list
-
 
2625
new_dg_macro_list(int n)
-
 
2626
{
-
 
2627
	dg_macro_list ans;
-
 
2628
	ans.len = n;
-
 
2629
	ans.array = (dg_macro *)xcalloc(n, sizeof(dg_macro));
-
 
2630
	return ans;
-
 
2631
}
-
 
2632
 
-
 
2633
 
-
 
2634
dg_macro_list
-
 
2635
add_dg_macro_list(dg_macro_list list, dg_macro elem, int index)
-
 
2636
{
-
 
2637
	list.array[index] = elem;
-
 
2638
	return list;
-
 
2639
}
-
 
2640
 
-
 
2641
 
-
 
2642
dg_idname_list
-
 
2643
new_dg_idname_list(int n)
-
 
2644
{
-
 
2645
	return new_string_list(n);
2470
}
2646
}
2471
 
2647
 
2472
void init_dg_append
-
 
2473
    PROTO_Z ()
-
 
2474
{
-
 
2475
  return;
-
 
2476
}
-
 
2477
 
2648
 
2478
dg_append_list new_dg_append_list
2649
dg_idname_list
2479
    PROTO_N ( (n) )
-
 
2480
    PROTO_T ( int n )
2650
add_dg_idname_list(dg_idname_list list, dg_idname elem, int index)
2481
{
2651
{
2482
  return (dg_append_list)0;
-
 
2483
}
-
 
2484
 
-
 
2485
dg_append_list add_dg_append_list
-
 
2486
    PROTO_N ( (list, elem, index) )
-
 
2487
    PROTO_T ( dg_append_list list X dg_append elem X int index )
-
 
2488
{
-
 
2489
  return list;
-
 
2490
}
-
 
2491
 
-
 
2492
dg_macro_list new_dg_macro_list
-
 
2493
    PROTO_N ( (n) )
-
 
2494
    PROTO_T ( int n )
-
 
2495
{
-
 
2496
  dg_macro_list ans;
-
 
2497
  ans.len = n;
-
 
2498
  ans.array = (dg_macro *)xcalloc(n, sizeof(dg_macro));
-
 
2499
  return ans;
-
 
2500
}
-
 
2501
 
-
 
2502
dg_macro_list add_dg_macro_list
-
 
2503
    PROTO_N ( (list, elem, index) )
-
 
2504
    PROTO_T ( dg_macro_list list X dg_macro elem X int index )
-
 
2505
{
-
 
2506
  list.array[index] = elem;
-
 
2507
  return list;
-
 
2508
}
-
 
2509
 
-
 
2510
dg_idname_list new_dg_idname_list
-
 
2511
    PROTO_N ( (n) )
-
 
2512
    PROTO_T ( int n )
-
 
2513
{
-
 
2514
  return new_string_list (n);
-
 
2515
}
-
 
2516
 
-
 
2517
dg_idname_list add_dg_idname_list
-
 
2518
    PROTO_N ( (list, elem, index) )
-
 
2519
    PROTO_T ( dg_idname_list list X dg_idname elem X int index )
-
 
2520
{
-
 
2521
  list.array[index] = idname_chars (elem);
2652
	list.array[index] = idname_chars(elem);
2522
  return list;
2653
	return list;
2523
}
2654
}
-
 
2655
 
2524
 
2656
 
2525
dg_idname_option no_dg_idname_option;
2657
dg_idname_option no_dg_idname_option;
2526
 
2658
 
2527
dg_idname_option yes_dg_idname_option
-
 
2528
    PROTO_N ( (elem) )
-
 
2529
    PROTO_T ( dg_idname elem )
-
 
2530
{
-
 
2531
  return elem;
-
 
2532
}
-
 
2533
 
-
 
2534
void init_dg_idname_option
2659
dg_idname_option
2535
    PROTO_Z ()
-
 
2536
{
-
 
2537
  no_dg_idname_option.id_key = DG_ID_NONE;
-
 
2538
  no_dg_idname_option.idd.nam = "";
2660
yes_dg_idname_option(dg_idname elem)
2539
  return;
-
 
2540
}
-
 
2541
 
-
 
2542
dg_name_option no_dg_name_option = (dg_name)0;
-
 
2543
 
-
 
2544
dg_name_option yes_dg_name_option
-
 
2545
    PROTO_N ( (elem) )
-
 
2546
    PROTO_T ( dg_name elem )
-
 
2547
{
2661
{
2548
  return elem;
2662
	return elem;
2549
}
-
 
2550
 
-
 
2551
void init_dg_name_option
-
 
2552
    PROTO_Z ()
-
 
2553
{
-
 
2554
  return;
-
 
2555
}
-
 
2556
 
-
 
2557
dg_accessibility_option no_dg_accessibility_option = DG_ACC_NONE;
-
 
2558
 
-
 
2559
dg_accessibility_option yes_dg_accessibility_option
-
 
2560
    PROTO_N ( (elem) )
-
 
2561
    PROTO_T ( dg_accessibility elem )
-
 
2562
{
-
 
2563
  return elem;
-
 
2564
}
-
 
2565
 
-
 
2566
void init_dg_accessibility_option
-
 
2567
    PROTO_Z ()
-
 
2568
{
-
 
2569
  return;
-
 
2570
}
2663
}
2571
 
2664
 
2572
dg_tag_option no_dg_tag_option = (dg_tag)0;
-
 
2573
 
2665
 
2574
dg_tag_option yes_dg_tag_option
2666
void
2575
    PROTO_N ( (elem) )
-
 
2576
    PROTO_T ( dg_tag elem )
2667
init_dg_idname_option(void)
2577
{
2668
{
-
 
2669
	no_dg_idname_option.id_key = DG_ID_NONE;
-
 
2670
	no_dg_idname_option.idd.nam = "";
2578
  return elem;
2671
	return;
2579
}
2672
}
2580
 
2673
 
2581
void init_dg_tag_option
-
 
2582
    PROTO_Z ()
-
 
2583
{
-
 
2584
  return;
-
 
2585
}
-
 
2586
 
-
 
2587
dg_virtuality_option no_dg_virtuality_option = DG_VIRT_NONE;
-
 
2588
 
-
 
2589
dg_virtuality_option yes_dg_virtuality_option
-
 
2590
    PROTO_N ( (elem) )
-
 
2591
    PROTO_T ( dg_virtuality elem )
-
 
2592
{
-
 
2593
  return elem;
-
 
2594
}
-
 
2595
 
-
 
2596
void init_dg_virtuality_option
-
 
2597
    PROTO_Z ()
-
 
2598
{
-
 
2599
  return;
-
 
2600
}
-
 
2601
 
-
 
2602
dg_sourcepos_option no_dg_sourcepos_option;
-
 
2603
 
-
 
2604
dg_sourcepos_option yes_dg_sourcepos_option
-
 
2605
    PROTO_N ( (elem) )
-
 
2606
    PROTO_T ( dg_sourcepos elem )
-
 
2607
{
-
 
2608
  return elem;
-
 
2609
}
-
 
2610
 
-
 
2611
void init_dg_sourcepos_option
-
 
2612
    PROTO_Z ()
-
 
2613
{
-
 
2614
  no_dg_sourcepos_option.sp_key = SP_NULL;
-
 
2615
  no_short_sourcepos = shorten_sourcepos (no_dg_sourcepos_option);
-
 
2616
  return;
-
 
2617
}
-
 
2618
 
-
 
2619
dg_type_option no_dg_type_option = (dg_type)0;
-
 
2620
 
-
 
2621
dg_type_option yes_dg_type_option
-
 
2622
    PROTO_N ( (elem) )
-
 
2623
    PROTO_T ( dg_type elem )
-
 
2624
{
-
 
2625
  return elem;
-
 
2626
}
-
 
2627
 
2674
 
-
 
2675
dg_name_option no_dg_name_option = (dg_name)0;
-
 
2676
 
-
 
2677
dg_name_option
-
 
2678
yes_dg_name_option(dg_name elem)
-
 
2679
{
-
 
2680
	return elem;
-
 
2681
}
-
 
2682
 
-
 
2683
 
-
 
2684
void
2628
void init_dg_type_option
2685
init_dg_name_option(void)
-
 
2686
{
-
 
2687
	return;
-
 
2688
}
-
 
2689
 
-
 
2690
 
-
 
2691
dg_accessibility_option no_dg_accessibility_option = DG_ACC_NONE;
-
 
2692
 
-
 
2693
dg_accessibility_option
-
 
2694
yes_dg_accessibility_option(dg_accessibility elem)
-
 
2695
{
-
 
2696
	return elem;
-
 
2697
}
-
 
2698
 
-
 
2699
 
-
 
2700
void
-
 
2701
init_dg_accessibility_option(void)
-
 
2702
{
-
 
2703
	return;
-
 
2704
}
-
 
2705
 
-
 
2706
 
-
 
2707
dg_tag_option no_dg_tag_option = (dg_tag)0;
-
 
2708
 
-
 
2709
dg_tag_option
-
 
2710
yes_dg_tag_option(dg_tag elem)
-
 
2711
{
-
 
2712
	return elem;
-
 
2713
}
-
 
2714
 
-
 
2715
 
-
 
2716
void
-
 
2717
init_dg_tag_option(void)
-
 
2718
{
-
 
2719
	return;
-
 
2720
}
-
 
2721
 
-
 
2722
 
-
 
2723
dg_virtuality_option no_dg_virtuality_option = DG_VIRT_NONE;
-
 
2724
 
-
 
2725
dg_virtuality_option
-
 
2726
yes_dg_virtuality_option(dg_virtuality elem)
-
 
2727
{
-
 
2728
	return elem;
-
 
2729
}
-
 
2730
 
-
 
2731
 
-
 
2732
void
-
 
2733
init_dg_virtuality_option(void)
-
 
2734
{
-
 
2735
	return;
-
 
2736
}
-
 
2737
 
-
 
2738
 
-
 
2739
dg_sourcepos_option no_dg_sourcepos_option;
-
 
2740
 
-
 
2741
dg_sourcepos_option
-
 
2742
yes_dg_sourcepos_option(dg_sourcepos elem)
-
 
2743
{
2629
    PROTO_Z ()
2744
	return elem;
-
 
2745
}
-
 
2746
 
-
 
2747
 
-
 
2748
void
-
 
2749
init_dg_sourcepos_option(void)
2630
{
2750
{
-
 
2751
	no_dg_sourcepos_option.sp_key = SP_NULL;
-
 
2752
	no_short_sourcepos = shorten_sourcepos(no_dg_sourcepos_option);
2631
  return;
2753
	return;
2632
}
2754
}
2633
 
2755
 
2634
dg_type_list_option no_dg_type_list_option;
-
 
2635
 
-
 
2636
dg_type_list_option yes_dg_type_list_option
-
 
2637
    PROTO_N ( (elem) )
-
 
2638
    PROTO_T ( dg_type_list elem )
-
 
2639
{
-
 
2640
  return elem;
-
 
2641
}
-
 
2642
 
-
 
2643
void init_dg_type_list_option
-
 
2644
    PROTO_Z ()
-
 
2645
{
-
 
2646
  no_dg_type_list_option.len = -1;
-
 
2647
  no_dg_type_list_option.array = (dg_type *)0;
-
 
2648
  return;
-
 
2649
}
-
 
2650
 
-
 
2651
dg_constraint_list_option no_dg_constraint_list_option = (dg_constraint)0;
-
 
2652
 
-
 
2653
dg_constraint_list_option yes_dg_constraint_list_option
-
 
2654
    PROTO_N ( (elem) )
-
 
2655
    PROTO_T ( dg_constraint_list elem )
-
 
2656
{
-
 
2657
  return elem;
-
 
2658
}
-
 
2659
 
-
 
2660
void init_dg_constraint_list_option
-
 
2661
    PROTO_Z ()
-
 
2662
{
-
 
2663
  return;
-
 
2664
}
-
 
2665
 
-
 
2666
dg_varpart_option no_dg_varpart_option = (dg_varpart_option)0;
-
 
2667
 
-
 
2668
dg_varpart_option yes_dg_varpart_option
-
 
2669
    PROTO_N ( (elem) )
-
 
2670
    PROTO_T ( dg_varpart elem )
-
 
2671
{
-
 
2672
  dg_varpart_option ans = (dg_varpart_option)xcalloc(1, sizeof(dg_varpart));
-
 
2673
  *ans = elem;
-
 
2674
  return ans;
-
 
2675
}
-
 
2676
 
-
 
2677
void init_dg_varpart_option
-
 
2678
    PROTO_Z ()
-
 
2679
{
-
 
2680
  return;
-
 
2681
}
-
 
2682
 
-
 
2683
dg_param_mode_option no_dg_param_mode_option = DG_NO_MODE;
-
 
2684
 
-
 
2685
dg_param_mode_option yes_dg_param_mode_option
-
 
2686
    PROTO_N ( (elem) )
-
 
2687
    PROTO_T ( dg_param_mode elem )
-
 
2688
{
-
 
2689
  return elem;
-
 
2690
}
-
 
2691
 
-
 
2692
void init_dg_param_mode_option
-
 
2693
    PROTO_Z ()
-
 
2694
{
-
 
2695
  return;
-
 
2696
}
-
 
2697
 
-
 
2698
dg_dim_option no_dg_dim_option;
-
 
2699
 
-
 
2700
dg_dim_option yes_dg_dim_option
-
 
2701
    PROTO_N ( (elem) )
-
 
2702
    PROTO_T ( dg_dim elem )
-
 
2703
{
-
 
2704
  failer ("dg_dim_option not done yet");
-
 
2705
  return no_dg_dim_option;
-
 
2706
}
-
 
2707
 
-
 
2708
void init_dg_dim_option
-
 
2709
    PROTO_Z ()
-
 
2710
{
-
 
2711
  return;
-
 
2712
}
-
 
2713
 
-
 
2714
dg_filename_option no_dg_filename_option = (dg_filename)0;
-
 
2715
 
-
 
2716
dg_filename_option yes_dg_filename_option
-
 
2717
    PROTO_N ( (elem) )
-
 
2718
    PROTO_T ( dg_filename elem )
-
 
2719
{
-
 
2720
  return elem;
-
 
2721
}
-
 
2722
 
-
 
2723
void init_dg_filename_option
-
 
2724
    PROTO_Z ()
-
 
2725
{
-
 
2726
  return;
-
 
2727
}
-
 
2728
 
2756
 
-
 
2757
dg_type_option no_dg_type_option = (dg_type)0;
2729
 
2758
 
2730
dg_default_option no_dg_default_option = (dg_default *)0;
-
 
2731
 
-
 
2732
dg_default_option yes_dg_default_option
2759
dg_type_option
2733
    PROTO_N ( (elem) )
-
 
2734
    PROTO_T ( dg_default elem )
2760
yes_dg_type_option(dg_type elem)
2735
{
2761
{
-
 
2762
	return elem;
-
 
2763
}
-
 
2764
 
-
 
2765
 
-
 
2766
void
-
 
2767
init_dg_type_option(void)
-
 
2768
{
-
 
2769
	return;
-
 
2770
}
-
 
2771
 
-
 
2772
 
-
 
2773
dg_type_list_option no_dg_type_list_option;
-
 
2774
 
-
 
2775
dg_type_list_option
-
 
2776
yes_dg_type_list_option(dg_type_list elem)
-
 
2777
{
-
 
2778
	return elem;
-
 
2779
}
-
 
2780
 
-
 
2781
 
-
 
2782
void
-
 
2783
init_dg_type_list_option(void)
-
 
2784
{
-
 
2785
	no_dg_type_list_option.len = -1;
-
 
2786
	no_dg_type_list_option.array = (dg_type *)0;
-
 
2787
	return;
-
 
2788
}
-
 
2789
 
-
 
2790
 
-
 
2791
dg_constraint_list_option no_dg_constraint_list_option = (dg_constraint)0;
-
 
2792
 
-
 
2793
dg_constraint_list_option
-
 
2794
yes_dg_constraint_list_option(dg_constraint_list elem)
-
 
2795
{
-
 
2796
	return elem;
-
 
2797
}
-
 
2798
 
-
 
2799
 
-
 
2800
void
-
 
2801
init_dg_constraint_list_option(void)
-
 
2802
{
-
 
2803
	return;
-
 
2804
}
-
 
2805
 
-
 
2806
 
-
 
2807
dg_varpart_option no_dg_varpart_option = (dg_varpart_option)0;
-
 
2808
 
-
 
2809
dg_varpart_option
-
 
2810
yes_dg_varpart_option(dg_varpart elem)
-
 
2811
{
-
 
2812
	dg_varpart_option ans =
2736
  dg_default_option ans = (dg_default_option)xcalloc(1, sizeof(dg_default));
2813
	    (dg_varpart_option)xcalloc(1, sizeof(dg_varpart));
2737
  *ans = elem;
2814
	*ans = elem;
2738
  return ans;
2815
	return ans;
-
 
2816
}
-
 
2817
 
-
 
2818
 
-
 
2819
void
-
 
2820
init_dg_varpart_option(void)
-
 
2821
{
-
 
2822
	return;
-
 
2823
}
-
 
2824
 
-
 
2825
 
-
 
2826
dg_param_mode_option no_dg_param_mode_option = DG_NO_MODE;
-
 
2827
 
-
 
2828
dg_param_mode_option
-
 
2829
yes_dg_param_mode_option(dg_param_mode elem)
-
 
2830
{
-
 
2831
	return elem;
-
 
2832
}
-
 
2833
 
-
 
2834
 
-
 
2835
void
-
 
2836
init_dg_param_mode_option(void)
-
 
2837
{
-
 
2838
	return;
2739
}
2839
}
-
 
2840
 
-
 
2841
 
-
 
2842
dg_dim_option no_dg_dim_option;
2740
 
2843
 
-
 
2844
dg_dim_option
-
 
2845
yes_dg_dim_option(dg_dim elem)
-
 
2846
{
-
 
2847
	failer("dg_dim_option not done yet");
2741
void init_dg_default_option
2848
	return no_dg_dim_option;
-
 
2849
}
-
 
2850
 
-
 
2851
 
-
 
2852
void
-
 
2853
init_dg_dim_option(void)
-
 
2854
{
-
 
2855
	return;
-
 
2856
}
-
 
2857
 
-
 
2858
 
-
 
2859
dg_filename_option no_dg_filename_option = (dg_filename)0;
-
 
2860
 
-
 
2861
dg_filename_option
-
 
2862
yes_dg_filename_option(dg_filename elem)
-
 
2863
{
2742
    PROTO_Z ()
2864
	return elem;
-
 
2865
}
-
 
2866
 
-
 
2867
 
-
 
2868
void
-
 
2869
init_dg_filename_option(void)
2743
{
2870
{
2744
  return;
2871
	return;
2745
}
2872
}
2746
 
2873
 
2747
 
2874
 
-
 
2875
dg_default_option no_dg_default_option = (dg_default *)0;
2748
 
2876
 
2749
void init_capsule_dgtags
2877
dg_default_option
-
 
2878
yes_dg_default_option(dg_default elem)
-
 
2879
{
-
 
2880
	dg_default_option ans =
-
 
2881
	    (dg_default_option)xcalloc(1, sizeof(dg_default));
2750
    PROTO_Z ()
2882
	*ans = elem;
-
 
2883
	return ans;
-
 
2884
}
-
 
2885
 
-
 
2886
 
-
 
2887
void
-
 
2888
init_dg_default_option(void)
-
 
2889
{
-
 
2890
	return;
-
 
2891
}
-
 
2892
 
-
 
2893
 
-
 
2894
void
-
 
2895
init_capsule_dgtags(void)
2751
{
2896
{
2752
  /* the space has been calloced in read_fns */
2897
	/* the space has been calloced in read_fns */
2753
 
2898
 
2754
  int i;
2899
	int i;
2755
  for (i = 0; i < capsule_no_of_dgtags; ++i)
2900
	for (i = 0; i < capsule_no_of_dgtags; ++i) {
2756
  {
-
 
2757
    init_dgtag (&capsule_dgtab[i]);
2901
		init_dgtag(&capsule_dgtab[i]);
2758
  }
2902
	}
2759
  return;
2903
	return;
2760
}
2904
}
-
 
2905
 
2761
 
2906
 
-
 
2907
void
2762
void init_unit_dgtags
2908
init_unit_dgtags(int n)
-
 
2909
{
-
 
2910
 
-
 
2911
	int i;
-
 
2912
 
-
 
2913
	unit_dgtagtab = (dgtag_struct *)xcalloc(unit_no_of_dgtags - n,
2763
    PROTO_N ( (n) )
2914
						sizeof(dgtag_struct));
-
 
2915
 
-
 
2916
	for (i = 0; i < unit_no_of_dgtags - n; ++i) {
2764
    PROTO_T ( int n )
2917
		init_dgtag(&unit_dgtagtab[i]);
-
 
2918
	}
-
 
2919
	return;
2765
{
2920
}
-
 
2921
 
2766
 
2922
 
-
 
2923
void
-
 
2924
start_make_dg_comp_unit(int toks, int tags, int als, int dgnames)
-
 
2925
{
2767
  int i;
2926
	int i;
-
 
2927
 
-
 
2928
	unit_no_of_tokens = toks;
-
 
2929
	unit_ind_tokens = (tok_define **)xcalloc(unit_no_of_tokens,
-
 
2930
						 sizeof(tok_define *));
-
 
2931
	for (i = 0; i < unit_no_of_tokens; ++i) {
-
 
2932
		unit_ind_tokens[i] = (tok_define *)0;
-
 
2933
	}
-
 
2934
 
-
 
2935
	unit_no_of_tags = tags;
-
 
2936
	unit_ind_tags = (dec **)xcalloc(unit_no_of_tags, sizeof(dec *));
-
 
2937
	for (i = 0; i < unit_no_of_tags; ++i) {
-
 
2938
		unit_ind_tags[i] = (dec *)0;
-
 
2939
	}
-
 
2940
 
-
 
2941
	unit_no_of_als = als;
-
 
2942
	unit_ind_als = (aldef **)xcalloc(unit_no_of_als, sizeof(aldef *));
-
 
2943
	for (i = 0; i < unit_no_of_als; ++i) {
-
 
2944
		unit_ind_als[i] = (aldef *)0;
-
 
2945
	}
2768
 
2946
 
-
 
2947
	unit_no_of_dgtags = dgnames;
2769
  unit_dgtagtab = (dgtag_struct *) xcalloc(unit_no_of_dgtags - n,
2948
	unit_ind_dgtags = (dgtag_struct **)xcalloc(unit_no_of_dgtags,
2770
					sizeof(dgtag_struct));
2949
						   sizeof(dgtag_struct *));
-
 
2950
	for (i = 0; i < unit_no_of_dgtags; ++i) {
-
 
2951
		unit_ind_dgtags[i] = (dgtag_struct *)0;
-
 
2952
	}
-
 
2953
 
-
 
2954
	return;
-
 
2955
}
-
 
2956
 
-
 
2957
 
-
 
2958
void
-
 
2959
f_make_dg_comp_unit(void)
-
 
2960
{
-
 
2961
	int i;
-
 
2962
	int j = 0;
-
 
2963
	int no_of_labels;
-
 
2964
#ifdef NEWDIAGS
-
 
2965
	int was_within_diags;
-
 
2966
#endif
-
 
2967
 
-
 
2968
	for (i = 0; i < unit_no_of_tokens; ++i) {
-
 
2969
		if (unit_ind_tokens[i] == (tok_define *)0) {
-
 
2970
			unit_ind_tokens[i] = &unit_toktab[j++];
-
 
2971
		}
-
 
2972
	}
2771
 
2973
 
-
 
2974
	j = 0;
2772
  for (i = 0; i < unit_no_of_dgtags - n; ++i)
2975
	for (i = 0; i < unit_no_of_tags; ++i) {
-
 
2976
		if (unit_ind_tags[i] == (dec *)0) {
-
 
2977
			unit_ind_tags[i] = &unit_tagtab[j++];
2773
  {
2978
		}
-
 
2979
	}
-
 
2980
 
-
 
2981
	j = 0;
-
 
2982
	for (i = 0; i < unit_no_of_als; ++i) {
-
 
2983
		if (unit_ind_als[i] == (aldef *)0)
-
 
2984
			unit_ind_als[i] = &unit_altab[j++];
-
 
2985
	}
-
 
2986
 
-
 
2987
	j=0;
-
 
2988
	for (i = 0; i < unit_no_of_dgtags; ++i) {
-
 
2989
		if (unit_ind_dgtags[i] == (dgtag_struct *)0) {
2774
    init_dgtag (&unit_dgtagtab[i]);
2990
			unit_ind_dgtags[i] = &unit_dgtagtab[j++];
-
 
2991
		}
-
 
2992
	}
-
 
2993
 
-
 
2994
#ifdef NEWDIAGS
-
 
2995
	was_within_diags = within_diags;
-
 
2996
	within_diags = 1;
-
 
2997
#endif
-
 
2998
	{
-
 
2999
		dg_compilation *comp_unit_ptr = &all_comp_units;
-
 
3000
		while (*comp_unit_ptr) {
-
 
3001
			comp_unit_ptr = &(*comp_unit_ptr)->another;
2775
  }
3002
		}
-
 
3003
		start_bytestream();
-
 
3004
		no_of_labels = small_dtdfint();
-
 
3005
		unit_no_of_labels = no_of_labels;
-
 
3006
		unit_labtab = (exp *)xcalloc(unit_no_of_labels, sizeof(exp));
-
 
3007
		(*comp_unit_ptr) = d_dg_compilation();
-
 
3008
		IGNORE d_dg_append_list();
-
 
3009
		end_bytestream();
-
 
3010
	}
-
 
3011
#ifdef NEWDIAGS
-
 
3012
	within_diags = was_within_diags;
-
 
3013
#endif
-
 
3014
	return;
-
 
3015
}
-
 
3016
 
-
 
3017
 
-
 
3018
void
-
 
3019
f_make_dglink(tdfint i, tdfint ext)
-
 
3020
{
-
 
3021
	unit_ind_dgtags[natint(i)] = &capsule_dgtab[natint(ext)];
2776
  return;
3022
	return;
2777
}
3023
}
2778
 
3024
 
-
 
3025
 
2779
void start_make_dg_comp_unit
3026
linkextern
2780
    PROTO_N ( (toks, tags, als, dgnames) )
-
 
2781
    PROTO_T ( int toks X int tags X int als X int dgnames )
3027
f_make_dgtagextern(tdfint internal, external ext)
2782
{
3028
{
-
 
3029
	dg_tag tg = &capsule_dgtab[natint(internal)];
-
 
3030
	tg->outref.k = LAB_STR;
-
 
3031
	tg->outref.u.s = external_to_string(ext);
2783
  int i;
3032
	return 0;
-
 
3033
}
2784
 
3034
 
2785
  unit_no_of_tokens = toks;
-
 
2786
  unit_ind_tokens = (tok_define * *)xcalloc(unit_no_of_tokens,
-
 
2787
                    sizeof(tok_define *));
-
 
2788
  for (i = 0; i < unit_no_of_tokens; ++i)
-
 
2789
    unit_ind_tokens[i] = (tok_define*)0;
-
 
2790
 
-
 
2791
  unit_no_of_tags = tags;
-
 
2792
  unit_ind_tags = (dec * *)xcalloc(unit_no_of_tags,
-
 
2793
                    sizeof(dec *));
-
 
2794
  for (i = 0; i < unit_no_of_tags; ++i)
-
 
2795
    unit_ind_tags[i] = (dec*)0;
-
 
2796
 
-
 
2797
  unit_no_of_als = als;
-
 
2798
  unit_ind_als = (aldef * *)xcalloc(unit_no_of_als,
-
 
2799
                    sizeof(aldef *));
-
 
2800
  for (i = 0; i < unit_no_of_als; ++i)
-
 
2801
    unit_ind_als[i] = (aldef*)0;
-
 
2802
 
3035
 
2803
  unit_no_of_dgtags = dgnames;
-
 
2804
  unit_ind_dgtags = (dgtag_struct * *)xcalloc(unit_no_of_dgtags,
-
 
2805
                    sizeof(dgtag_struct *));
-
 
2806
  for (i = 0; i < unit_no_of_dgtags; ++i)
-
 
2807
    unit_ind_dgtags[i] = (dgtag_struct *)0;
-
 
2808
 
-
 
2809
  return;
-
 
2810
}
3036
exp
2811
 
-
 
2812
void f_make_dg_comp_unit
3037
f_dg_exp(exp body, dg diagnostic)
2813
    PROTO_Z ()
-
 
2814
{
3038
{
2815
  int i;
-
 
2816
  int j = 0;
-
 
2817
  int no_of_labels;
-
 
2818
#ifdef NEWDIAGS
3039
#ifdef NEWDIAGS
-
 
3040
	dgf(body) = add_dg_list(add_dg_list(new_dg_list(2), diagnostic, 0),
2819
  int was_within_diags;
3041
				dgf(body), 1);
2820
#endif
3042
#endif
2821
 
-
 
2822
  for (i = 0; i < unit_no_of_tokens; ++i)
-
 
2823
  {
-
 
2824
    if (unit_ind_tokens[i] == (tok_define*)0)
-
 
2825
      unit_ind_tokens[i] = &unit_toktab[j++];
-
 
2826
  };
-
 
2827
 
-
 
2828
  j = 0;
3043
	return body;
2829
  for (i = 0; i < unit_no_of_tags; ++i)
-
 
2830
  {
-
 
2831
    if (unit_ind_tags[i] == (dec*)0)
-
 
2832
      unit_ind_tags[i] = &unit_tagtab[j++];
-
 
2833
  };
-
 
2834
 
3044
}
2835
  j = 0;
-
 
2836
  for (i = 0; i < unit_no_of_als; ++i)
-
 
2837
  {
-
 
2838
    if (unit_ind_als[i] == (aldef*)0)
-
 
2839
      unit_ind_als[i] = &unit_altab[j++];
-
 
2840
  };
-
 
2841
 
3045
 
2842
  j=0;
-
 
2843
  for (i = 0; i < unit_no_of_dgtags; ++i)
-
 
2844
  {
-
 
2845
    if (unit_ind_dgtags[i] == (dgtag_struct *)0)
-
 
2846
      unit_ind_dgtags[i] = &unit_dgtagtab[j++];
-
 
2847
  };
-
 
2848
 
3046
 
2849
#ifdef NEWDIAGS
-
 
2850
  was_within_diags = within_diags;
-
 
2851
  within_diags = 1;
-
 
2852
#endif
-
 
2853
  {
3047
exp
2854
    dg_compilation * comp_unit_ptr = &all_comp_units;
-
 
2855
    while (* comp_unit_ptr)
-
 
2856
      comp_unit_ptr = &(* comp_unit_ptr)->another;
-
 
2857
    start_bytestream();
-
 
2858
    no_of_labels = small_dtdfint();
-
 
2859
    unit_no_of_labels = no_of_labels;
-
 
2860
    unit_labtab = (exp*)xcalloc(unit_no_of_labels, sizeof(exp));
-
 
2861
    (* comp_unit_ptr) = d_dg_compilation();
-
 
2862
    IGNORE d_dg_append_list();
-
 
2863
    end_bytestream();
-
 
2864
  }
-
 
2865
#ifdef NEWDIAGS
-
 
2866
  within_diags = was_within_diags;
-
 
2867
#endif
-
 
2868
  return;
-
 
2869
}
-
 
2870
 
-
 
2871
void f_make_dglink
-
 
2872
    PROTO_N ( (i, ext) )
-
 
2873
    PROTO_T ( tdfint i X tdfint ext )
-
 
2874
{
-
 
2875
  unit_ind_dgtags[natint(i)] =
-
 
2876
      &capsule_dgtab[natint(ext)];
-
 
2877
  return;
-
 
2878
}
-
 
2879
 
-
 
2880
linkextern f_make_dgtagextern
-
 
2881
    PROTO_N ( (internal, ext) )
-
 
2882
    PROTO_T ( tdfint internal X external ext )
-
 
2883
{
-
 
2884
  dg_tag tg = &capsule_dgtab[natint(internal)];
-
 
2885
  tg->outref.k = LAB_STR;
-
 
2886
  tg->outref.u.s = external_to_string(ext);
-
 
2887
  return 0;
-
 
2888
}
-
 
2889
 
-
 
2890
 
-
 
2891
exp f_dg_exp
-
 
2892
    PROTO_N ( (body, diagnostic) )
-
 
2893
    PROTO_T ( exp body X dg diagnostic )
-
 
2894
{
-
 
2895
#ifdef NEWDIAGS
-
 
2896
  dgf(body) = add_dg_list (add_dg_list (new_dg_list (2), diagnostic, 0), dgf(body), 1);
-
 
2897
#endif
-
 
2898
  return body;
-
 
2899
}
-
 
2900
 
-
 
2901
exp read_dg_exp
-
 
2902
    PROTO_N ( (body) )
-
 
2903
    PROTO_T ( exp body )
3048
read_dg_exp(exp body)
2904
{
3049
{
2905
  dg diag;
3050
	dg diag;
2906
#ifdef NEWDIAGS
3051
#ifdef NEWDIAGS
2907
  int was_within_diags = within_diags;
3052
	int was_within_diags = within_diags;
2908
  within_diags = 1;
3053
	within_diags = 1;
2909
  diag = d_dg();
3054
	diag = d_dg();
2910
  within_diags = was_within_diags;
3055
	within_diags = was_within_diags;
2911
#endif
3056
#endif
2912
  return f_dg_exp (body, diag);
3057
	return f_dg_exp(body, diag);
2913
}
3058
}
2914
 
-