Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**********************************************************************
32
$Author: release $
33
$Date: 1998/01/17 15:55:46 $
34
$Revision: 1.1.1.1 $
35
$Log: diag_info.c,v $
36
 * Revision 1.1.1.1  1998/01/17  15:55:46  release
37
 * First version to be checked into rolling release.
38
 *
39
 * Revision 1.9  1998/01/11  18:45:07  pwe
40
 * consistent new/old diags
41
 *
42
 * Revision 1.8  1998/01/09  09:30:04  pwe
43
 * prep restructure
44
 *
45
 * Revision 1.7  1997/12/04  19:36:41  pwe
46
 * ANDF-DE V1.9
47
 *
48
 * Revision 1.6  1997/11/06  09:17:56  pwe
49
 * ANDF-DE V1.8
50
 *
51
 * Revision 1.5  1997/10/23  09:21:23  pwe
52
 * ANDF-DE V1.7 and extra diags
53
 *
54
 * Revision 1.4  1997/08/23  13:27:06  pwe
55
 * initial ANDF-DE
56
 *
57
 * Revision 1.3  1997/03/20  17:04:52  currie
58
 * Dwarf2 diags
59
 *
60
Revision 1.2  1997/02/18 12:55:51  currie
61
NEW DIAG STRUCTURE
62
 
63
 * Revision 1.1  1995/04/06  10:42:55  currie
64
 * Initial revision
65
 *
66
***********************************************************************/
67
 
68
 
69
#include "config.h"
70
#include "common_types.h"
71
#include "readglob.h"
72
#include "table_fns.h"
73
#include "basicread.h"
74
#include "sortmacs.h"
75
#include "xalloc.h"
76
#ifdef NEWDIAGS
77
#include "exp.h"
78
#include "expmacs.h"
79
#include "tags.h"
80
#include "externs.h"
81
#include "dg_aux.h"
82
#include "mark_scope.h"
83
#endif
84
 
85
#include "main_reads.h"
86
#include "check.h"
87
#include "dg_fns.h"
88
#include "diag_fns.h"
89
 
90
 
91
/* PROCEDURES */
92
 
93
 
94
#ifdef NEWDIAGS
95
 
96
 
97
exp diag_locate
98
    PROTO_N ( (e) )
99
    PROTO_T ( exp e )
100
{
101
  /* need contents for var locations, old diags */
102
  exp id = son(e);
103
  if (isglob (id)) {
104
    if (brog(id)->dec_u.dec_val.dec_var)
105
      e = f_contents (brog(id)->dec_u.dec_val.dec_shape, e);
106
  }
107
  else {
108
    if (isvar (id))
109
      e = f_contents (sh(son(id)), e);
110
  }
111
  return e;
112
}
113
 
114
 
115
 
116
exp read_exp_to_source
117
    PROTO_N ( (body) )
118
    PROTO_T ( exp body )
119
{
120
  dg_sourcepos s1, s2;
121
  int was_within_diags = within_diags;
122
  within_diags = 1;
123
  s1 = d_sourcemark();
124
  s2 = d_sourcemark();
125
  within_diags = was_within_diags;
126
  if (s1.file == s2.file) {
127
    s2.sp_key = SP_SPAN;
128
    s2.to_file = s2.file;
129
    s2.to_line = s2.from_line;
130
    s2.to_column = s2.from_column;
131
    s2.from_line = s1.from_line;
132
    s2.from_column = s1.from_column;
133
  }
134
  if (name(body) == proc_tag || name(body) == general_proc_tag)
135
    return body;
136
  body = f_dg_exp (body, f_singlestep_dg (s1));
137
  body = f_dg_exp (body, f_sourcepos_dg (s2));
138
  return body;
139
}
140
 
141
 
142
exp read_diag_id_scope
143
    PROTO_N ( (body) )
144
    PROTO_T ( exp body )
145
{
146
  dg_idname nam;
147
  exp acc;
148
  dg_type typ;
149
  dg_name dgn;
150
  int was_within_diags = within_diags;
151
  within_diags = 1;
152
  nam = f_dg_sourcestring_idname (d_tdfstring());
153
  acc = hold_check (d_exp());
154
  typ = d_diag_type();
155
  within_diags = was_within_diags;
156
  dgn = f_dg_object_name (
157
	nam,
158
	f_dg_null_sourcepos,
159
	typ,
160
	yes_exp_option (diag_locate (acc)),
161
	no_dg_accessibility_option);
162
 
163
  if (isparam(son(acc)) || (son(son(acc)) != nilexp &&
164
		name(son(son(acc))) == chvar_tag &&
165
		shape_size(sh(son(son(acc)))) < 32 &&
166
		name(son(son(son(acc)))) == cont_tag &&
167
		name(son(son(son(son(acc))))) == name_tag &&
168
		isparam (son(son(son(son(son(acc)))))) )) {
169
    dg_info x = dgf(body);
170
    if (x && x->key == DGA_PARAMS) {
171
      dgn->next = x->data.i_param.args;
172
      x->data.i_param.args = dgn;
173
    }
174
    else {
175
      body = f_dg_exp (body, f_params_dg (dgn, no_exp_option));
176
    }
177
  }
178
  else {
179
    body = f_dg_exp (body, f_name_decl_dg (dgn));
180
    mark_scope (body);
181
  }
182
  return (body);
183
}
184
 
185
 
186
exp read_diag_type_scope
187
    PROTO_N ( (body) )
188
    PROTO_T ( exp body )
189
{
190
  dg_idname nam;
191
  dg_type typ;
192
  dg_name dgn;
193
  int was_within_diags = within_diags;
194
  within_diags = 1;
195
  nam = f_dg_sourcestring_idname (d_tdfstring());
196
  typ = d_diag_type();
197
  within_diags = was_within_diags;
198
  dgn = f_dg_type_name (
199
	nam,
200
	f_dg_null_sourcepos,
201
	no_dg_accessibility_option,
202
	typ,
203
	f_false,
204
	no_bool_option,
205
	no_dg_constraint_list_option);
206
  body = f_dg_exp (body, f_name_decl_dg (dgn));
207
  mark_scope2 (body);
208
  return body;
209
}
210
 
211
 
212
#else
213
 
214
diag_info * read_exp_to_source
215
    PROTO_Z ()
216
{
217
  diag_info * new = (diag_info *) xcalloc(1,sizeof(diag_info));
218
 
219
  new->key = DIAG_INFO_SOURCE;
220
  new->data.source.beg 	= d_sourcemark();
221
  new->data.source.end 	= d_sourcemark();
222
 
223
  return new;
224
}
225
 
226
diag_info * read_diag_id_scope
227
    PROTO_Z ()
228
{
229
  diag_info * new = (diag_info *) xcalloc(1,sizeof(diag_info));
230
 
231
  new->key 		= DIAG_INFO_ID;
232
  new->data.id_scope.nme = d_tdfstring();
233
  new->data.id_scope.access = hold_check(d_exp());
234
  IGNORE hold(hold(new->data.id_scope.access));
235
  new->data.id_scope.typ = d_diag_type();
236
  return (new);
237
}
238
 
239
diag_info * read_diag_type_scope
240
    PROTO_Z ()
241
{
242
  diag_info * new = (diag_info *) xcalloc(1,sizeof(diag_info));
243
 
244
  new->key 		= DIAG_INFO_TYPE;
245
  new->data.type_scope.nme = d_tdfstring();
246
  new->data.type_scope.typ = d_diag_type();
247
  return (new);
248
}
249
 
250
diag_info * read_diag_tag_scope
251
    PROTO_Z ()
252
{
253
  diag_info * new = (diag_info *) xcalloc(1,sizeof(diag_info));
254
 
255
  new->key 		= DIAG_INFO_TAG;
256
  new->data.tag_scope.nme = d_tdfstring();
257
  new->data.tag_scope.typ = d_diag_type();
258
  return (new);
259
}
260
 
261
 
262
#endif