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 66... Line 96...
66
 
96
 
67
 
97
 
68
static dg_name_list capnames;
98
static dg_name_list capnames;
69
static int cni = 0;
99
static int cni = 0;
70
 
100
 
71
static void make_bastype
101
static void
72
    PROTO_N ( (s, t) )
-
 
73
    PROTO_T ( char * s X dg_type t )
102
make_bastype(char *s, dg_type t)
74
{
103
{
75
  dg_name this_name;
104
	dg_name this_name;
76
  dg_tag ans = (dgtag_struct *) xmalloc (sizeof(dgtag_struct));
105
	dg_tag ans = (dgtag_struct *)xmalloc(sizeof(dgtag_struct));
77
  init_dgtag (ans);
106
	init_dgtag(ans);
78
  ans->outref.k = LAB_STR;
107
	ans->outref.k = LAB_STR;
79
  ans->outref.u.s = s;
108
	ans->outref.u.s = s;
80
  this_name = f_dg_tag_name (ans, f_dg_type_name (
109
	this_name = f_dg_tag_name(ans,
81
	no_dg_idname_option,
110
				  f_dg_type_name(no_dg_idname_option,
82
	f_dg_null_sourcepos,
111
						 f_dg_null_sourcepos,
83
	no_dg_accessibility_option,
112
						 no_dg_accessibility_option,
84
	yes_dg_type_option (t),
113
						 yes_dg_type_option(t), f_false,
85
	f_false,
-
 
86
	no_bool_option,
114
						 no_bool_option,
87
	no_dg_constraint_list_option));
115
						 no_dg_constraint_list_option));
88
  capnames = add_dg_name_list (capnames, this_name, cni++);
116
	capnames = add_dg_name_list(capnames, this_name, cni++);
89
}
117
}
90
 
118
 
91
 
119
 
92
static dg_idname m_id
120
static dg_idname
93
    PROTO_N ( (s) )
-
 
94
    PROTO_T ( char * s )
121
m_id(char *s)
95
{
122
{
96
  dg_idname ans;
123
	dg_idname ans;
97
  ans.id_key = DG_ID_SRC;
124
	ans.id_key = DG_ID_SRC;
98
  ans.idd.nam = s;
125
	ans.idd.nam = s;
99
  return ans;
126
	return ans;
100
}
127
}
101
 
128
 
102
 
129
 
103
static void make_basic_types
130
static void
104
    PROTO_Z ()
131
make_basic_types(void)
105
{
132
{
106
  make_bastype ("__D_void_star", f_dg_address_type (
133
	make_bastype("__D_void_star",
-
 
134
		     f_dg_address_type(m_id("void *"),
107
		m_id ("void *"), f_pointer (f_alignment (scharsh))));
135
				       f_pointer(f_alignment(scharsh))));
108
  make_bastype ("__D_signed_char", f_dg_char_type (
136
	make_bastype("__D_signed_char", f_dg_char_type(m_id("signed char"),
109
		m_id ("signed char"), scharsh));
137
						       scharsh));
110
  make_bastype ("__D_unsigned_char", f_dg_char_type (
138
	make_bastype("__D_unsigned_char", f_dg_char_type(m_id("unsigned char"),
111
		m_id ("unsigned char"), ucharsh));
139
							 ucharsh));
112
  make_bastype ("__D_short", f_dg_integer_type (
140
	make_bastype("__D_short", f_dg_integer_type(m_id("short"), swordsh));
113
		m_id ("short"), swordsh));
-
 
114
  make_bastype ("__D_unsigned_short", f_dg_integer_type (
141
	make_bastype("__D_unsigned_short",
115
		m_id ("unsigned short"), uwordsh));
142
		     f_dg_integer_type(m_id("unsigned short"), uwordsh));
116
  make_bastype ("__D_int", f_dg_integer_type (
143
	make_bastype("__D_int", f_dg_integer_type(m_id("int"), slongsh));
117
		m_id ("int"), slongsh));
-
 
118
  make_bastype ("__D_unsigned_int", f_dg_integer_type (
144
	make_bastype("__D_unsigned_int", f_dg_integer_type(m_id("unsigned int"),
119
		m_id ("unsigned int"), ulongsh));
145
							   ulongsh));
120
  make_bastype ("__D_long", f_dg_integer_type (
146
	make_bastype("__D_long", f_dg_integer_type(m_id("long"), slongsh));
121
		m_id ("long"), slongsh));
-
 
122
  make_bastype ("__D_unsigned_long", f_dg_integer_type (
147
	make_bastype("__D_unsigned_long",
123
		m_id ("unsigned long"), ulongsh));
148
		     f_dg_integer_type(m_id("unsigned long"), ulongsh));
124
  make_bastype ("__D_long_long", f_dg_integer_type (
149
	make_bastype("__D_long_long", f_dg_integer_type(m_id("long long"),
125
		m_id ("long long"), s64sh));
150
							s64sh));
126
  make_bastype ("__D_unsigned_long_long", f_dg_integer_type (
151
	make_bastype("__D_unsigned_long_long",
127
		m_id ("unsigned long long"), u64sh));
152
		     f_dg_integer_type(m_id("unsigned long long"), u64sh));
128
  make_bastype ("__D_float", f_dg_float_type (
153
	make_bastype("__D_float", f_dg_float_type(m_id("float"), shrealfv));
129
		m_id ("float"), shrealfv));
-
 
130
  make_bastype ("__D_double", f_dg_float_type (
154
	make_bastype("__D_double", f_dg_float_type(m_id("double"), realfv));
131
		m_id ("double"), realfv));
-
 
132
  make_bastype ("__D_long_double", f_dg_float_type (
155
	make_bastype("__D_long_double", f_dg_float_type(m_id("long double"),
133
		m_id ("long double"), doublefv));
156
							doublefv));
134
  make_bastype ("__D_complex", f_dg_complex_float_type (
157
	make_bastype("__D_complex", f_dg_complex_float_type(m_id("complex"),
135
		m_id ("complex"), shcomplexfv));
158
							    shcomplexfv));
136
  make_bastype ("__D_double_complex", f_dg_complex_float_type (
159
	make_bastype("__D_double_complex",
-
 
160
		     f_dg_complex_float_type(m_id("double complex"),
137
		m_id ("double complex"), complexfv));
161
					     complexfv));
138
  make_bastype ("__D_long_double_complex", f_dg_complex_float_type (
162
	make_bastype("__D_long_double_complex",
-
 
163
		     f_dg_complex_float_type(m_id("long double complex"),
139
		m_id ("long double complex"), complexdoublefv));
164
					     complexdoublefv));
140
}
165
}
141
 
166
 
142
 
167
 
-
 
168
void
143
void make_dwarf_common
169
make_dwarf_common(void)
144
    PROTO_Z ()
-
 
145
{
170
{
146
  dg_compilation ans;
171
	dg_compilation ans;
147
  capnames = new_dg_name_list (15);
172
	capnames = new_dg_name_list(15);
148
  make_basic_types ();
173
	make_basic_types();
149
  ans = (dg_compilation) xmalloc (sizeof (struct dg_comp_t));
174
	ans = (dg_compilation)xmalloc(sizeof(struct dg_comp_t));
150
  ans->prim_file = get_filename ((long)0, "", "", "");
175
	ans->prim_file = get_filename((long)0, "", "", "");
151
  ans->comp_deps = new_string_list (0);
176
	ans->comp_deps = new_string_list(0);
152
  ans->date = 0;
177
	ans->date = 0;
153
  ans->language = 1;	/* assume ANSI C */
178
	ans->language = 1;	/* assume ANSI C */
154
  ans->id_case = 0;	/* case sensitive */
179
	ans->id_case = 0;	/* case sensitive */
155
  ans->producer = "TenDRA";
180
	ans->producer = "TenDRA";
156
  ans->comp_dir = get_filename ((long)0, "", "", "");
181
	ans->comp_dir = get_filename((long)0, "", "", "");
157
  ans->options = new_string_list (0);
182
	ans->options = new_string_list(0);
158
  ans->dn_list = capnames;
183
	ans->dn_list = capnames;
159
  ans->macros = new_dg_macro_list (0);
184
	ans->macros = new_dg_macro_list(0);
160
  ans->another = (dg_compilation)0;
185
	ans->another = (dg_compilation)0;
161
  all_comp_units = ans;
186
	all_comp_units = ans;
162
}
187
}