Subversion Repositories tendra.SVN

Rev

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

Rev Author Line No. Line
2 7u83 1
/*
6 7u83 2
 * Copyright (c) 2002-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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
33
 
34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
42
 
43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
45
 
46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
49
 
50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
53
 
54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/**********************************************************************
62
$Author: pwe $
63
$Date: 1998/03/11 11:03:40 $
64
$Revision: 1.2 $
65
$Log: dw2_common.c,v $
66
 * Revision 1.2  1998/03/11  11:03:40  pwe
67
 * DWARF optimisation info
68
 *
69
 * Revision 1.1.1.1  1998/01/17  15:55:48  release
70
 * First version to be checked into rolling release.
71
 *
72
 * Revision 1.4  1997/12/04  19:42:02  pwe
73
 * ANDF-DE V1.9
74
 *
75
 * Revision 1.3  1997/11/06  09:22:39  pwe
76
 * ANDF-DE V1.8
77
 *
78
 * Revision 1.2  1997/10/23  09:28:05  pwe
79
 * ANDF-DE v1.7, extra diags
80
 *
81
 * Revision 1.1  1997/10/10  18:19:06  pwe
82
 * prep ANDF-DE revision
83
 *
84
**********************************************************************/
85
 
86
#include "config.h"
87
#include "common_types.h"
88
#include "basicread.h"
89
#include "install_fns.h"
90
#include "xalloc.h"
91
#include "dg_aux.h"
92
#include "externs.h"
93
#include "dg_globs.h"
94
#include "shapemacs.h"
95
#include "dw2_common.h"
96
 
97
 
98
static dg_name_list capnames;
99
static int cni = 0;
100
 
6 7u83 101
static void
102
make_bastype(char *s, dg_type t)
2 7u83 103
{
6 7u83 104
	dg_name this_name;
105
	dg_tag ans = (dgtag_struct *)xmalloc(sizeof(dgtag_struct));
106
	init_dgtag(ans);
107
	ans->outref.k = LAB_STR;
108
	ans->outref.u.s = s;
109
	this_name = f_dg_tag_name(ans,
110
				  f_dg_type_name(no_dg_idname_option,
111
						 f_dg_null_sourcepos,
112
						 no_dg_accessibility_option,
113
						 yes_dg_type_option(t), f_false,
114
						 no_bool_option,
115
						 no_dg_constraint_list_option));
116
	capnames = add_dg_name_list(capnames, this_name, cni++);
2 7u83 117
}
118
 
119
 
6 7u83 120
static dg_idname
121
m_id(char *s)
2 7u83 122
{
6 7u83 123
	dg_idname ans;
124
	ans.id_key = DG_ID_SRC;
125
	ans.idd.nam = s;
126
	return ans;
2 7u83 127
}
128
 
129
 
6 7u83 130
static void
131
make_basic_types(void)
2 7u83 132
{
6 7u83 133
	make_bastype("__D_void_star",
134
		     f_dg_address_type(m_id("void *"),
135
				       f_pointer(f_alignment(scharsh))));
136
	make_bastype("__D_signed_char", f_dg_char_type(m_id("signed char"),
137
						       scharsh));
138
	make_bastype("__D_unsigned_char", f_dg_char_type(m_id("unsigned char"),
139
							 ucharsh));
140
	make_bastype("__D_short", f_dg_integer_type(m_id("short"), swordsh));
141
	make_bastype("__D_unsigned_short",
142
		     f_dg_integer_type(m_id("unsigned short"), uwordsh));
143
	make_bastype("__D_int", f_dg_integer_type(m_id("int"), slongsh));
144
	make_bastype("__D_unsigned_int", f_dg_integer_type(m_id("unsigned int"),
145
							   ulongsh));
146
	make_bastype("__D_long", f_dg_integer_type(m_id("long"), slongsh));
147
	make_bastype("__D_unsigned_long",
148
		     f_dg_integer_type(m_id("unsigned long"), ulongsh));
149
	make_bastype("__D_long_long", f_dg_integer_type(m_id("long long"),
150
							s64sh));
151
	make_bastype("__D_unsigned_long_long",
152
		     f_dg_integer_type(m_id("unsigned long long"), u64sh));
153
	make_bastype("__D_float", f_dg_float_type(m_id("float"), shrealfv));
154
	make_bastype("__D_double", f_dg_float_type(m_id("double"), realfv));
155
	make_bastype("__D_long_double", f_dg_float_type(m_id("long double"),
156
							doublefv));
157
	make_bastype("__D_complex", f_dg_complex_float_type(m_id("complex"),
158
							    shcomplexfv));
159
	make_bastype("__D_double_complex",
160
		     f_dg_complex_float_type(m_id("double complex"),
161
					     complexfv));
162
	make_bastype("__D_long_double_complex",
163
		     f_dg_complex_float_type(m_id("long double complex"),
164
					     complexdoublefv));
2 7u83 165
}
166
 
167
 
6 7u83 168
void
169
make_dwarf_common(void)
2 7u83 170
{
6 7u83 171
	dg_compilation ans;
172
	capnames = new_dg_name_list(15);
173
	make_basic_types();
174
	ans = (dg_compilation)xmalloc(sizeof(struct dg_comp_t));
175
	ans->prim_file = get_filename((long)0, "", "", "");
176
	ans->comp_deps = new_string_list(0);
177
	ans->date = 0;
178
	ans->language = 1;	/* assume ANSI C */
179
	ans->id_case = 0;	/* case sensitive */
180
	ans->producer = "TenDRA";
181
	ans->comp_dir = get_filename((long)0, "", "", "");
182
	ans->options = new_string_list(0);
183
	ans->dn_list = capnames;
184
	ans->macros = new_dg_macro_list(0);
185
	ans->another = (dg_compilation)0;
186
	all_comp_units = ans;
2 7u83 187
}