Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
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
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 44... Line 74...
44
#include "macro.h"
74
#include "macro.h"
45
#include "preproc.h"
75
#include "preproc.h"
46
#include "syntax.h"
76
#include "syntax.h"
47
#include "table.h"
77
#include "table.h"
48
#include "ustring.h"
78
#include "ustring.h"
49
 
79
 
50
 
80
 
51
/*
81
/*
52
    PORTABILITY TABLE ENTRIES
82
    PORTABILITY TABLE ENTRIES
53
 
83
 
54
    This table describes the portability table entries.  The entries need
84
    This table describes the portability table entries.  The entries need
55
    to be keep in one-to-one correspondence with the PORT_* macros defined
85
    to be keep in one-to-one correspondence with the PORT_* macros defined
56
    in table.h.
86
    in table.h.
57
*/
87
*/
58
 
88
 
59
PORT_ENTRY port_entry [] = {
89
PORT_ENTRY port_entry[] = {
60
    { "char_bits", 0, 0, btype_none },			/* 0 */
90
	{ "char_bits", 0, 0, btype_none },		/* 0 */
61
    { "short_bits", 0, 0, btype_none },			/* 1 */
91
	{ "short_bits", 0, 0, btype_none },		/* 1 */
62
    { "int_bits", 0, 0, btype_none },			/* 2 */
92
	{ "int_bits", 0, 0, btype_none },		/* 2 */
63
    { "long_bits", 0, 0, btype_none },			/* 3 */
93
	{ "long_bits", 0, 0, btype_none },		/* 3 */
64
    { "longlong_bits", 1, 0, btype_none },		/* 4 */
94
	{ "longlong_bits", 1, 0, btype_none },		/* 4 */
65
    { "max_bits", 1, UINT_MAX, btype_none },		/* 5 */
95
	{ "max_bits", 1, UINT_MAX, btype_none },	/* 5 */
66
    { "signed_range", 0, 0, btype_none },		/* 6 */
96
	{ "signed_range", 0, 0, btype_none },		/* 6 */
67
    { "char_type", 0, 0, btype_none },			/* 7 */
97
	{ "char_type", 0, 0, btype_none },		/* 7 */
68
    { "exact_range", 1, 0, btype_none },		/* 8 */
98
	{ "exact_range", 1, 0, btype_none },		/* 8 */
69
    { "ptr_int", 1, 0, btype_none },			/* 9 */
99
	{ "ptr_int", 1, 0, btype_none },		/* 9 */
70
    { "ptr_fn", 1, 0, btype_none },			/* 10 */
100
	{ "ptr_fn", 1, 0, btype_none },			/* 10 */
71
    { "non_prototype_checks", 1, 0, btype_none },	/* 11 */
101
	{ "non_prototype_checks", 1, 0, btype_none },	/* 11 */
72
    { "multibyte", 1, 0, btype_none }			/* 12 */
102
	{ "multibyte", 1, 0, btype_none }		/* 12 */
73
} ;
103
};
-
 
104
 
-
 
105
 
-
 
106
/*
-
 
107
    PARSE A PORTABILITY TABLE
-
 
108
 
-
 
109
    This routine parses and processes the portability table.  It returns
-
 
110
    the last token read.
-
 
111
*/
74
 
112
 
-
 
113
static int
-
 
114
parse_table(void)
-
 
115
{
-
 
116
	int t;
-
 
117
	PORT_ENTRY *p = port_entry;
-
 
118
	while (t = read_token(), t == lex_identifier) {
-
 
119
		int i;
-
 
120
		unsigned n = 0;
-
 
121
		HASHID nm = token_hashid;
-
 
122
		BASE_TYPE bt = btype_none;
-
 
123
		string us = DEREF_string(hashid_name_etc_text(nm));
-
 
124
		update_column();
-
 
125
 
-
 
126
		/* Check through table entries */
-
 
127
		for (i = 0; i < PORT_size; i++) {
-
 
128
			string ut = ustrlit(p[i].name);
-
 
129
			if (ustreq(us, ut)) {
-
 
130
				/* Entry found */
-
 
131
				if (p[i].set == 2) {
-
 
132
					report(crt_loc,
-
 
133
					       ERR_port_entry_redef(ut));
-
 
134
				}
-
 
135
				p[i].set = 2;
-
 
136
				break;
-
 
137
			}
-
 
138
		}
-
 
139
 
-
 
140
		/* Perform appropriate action */
-
 
141
		switch (i) {
-
 
142
 
-
 
143
		case PORT_char_bits:
-
 
144
		case PORT_short_bits:
-
 
145
		case PORT_int_bits:
-
 
146
		case PORT_long_bits:
-
 
147
		case PORT_llong_bits:
-
 
148
		case PORT_max_bits:
-
 
149
		case PORT_multibyte: {
-
 
150
			/* Deal with integral values */
-
 
151
			unsigned err = 0;
-
 
152
			t = read_token();
-
 
153
			update_column();
-
 
154
			if (t != lex_integer_Hlit) {
-
 
155
				return(t);
-
 
156
			}
-
 
157
			us = token_buff.start;
-
 
158
			n = (unsigned)eval_line_digits(us, &err);
-
 
159
			if (err) {
-
 
160
				report(crt_loc, ERR_lex_literal_bad(us));
-
 
161
			}
-
 
162
			break;
-
 
163
		}
-
 
164
 
-
 
165
		case PORT_signed_range:
-
 
166
			/* Deal with range values */
-
 
167
			t = read_token();
-
 
168
			update_column();
-
 
169
			if (t != lex_identifier) {
-
 
170
				return(t);
-
 
171
			}
-
 
172
			nm = token_hashid;
-
 
173
			us = DEREF_string(hashid_name_etc_text(nm));
-
 
174
			if (ustrseq(us, "maximum")) {
-
 
175
				bt = (btype_signed | btype_long);
-
 
176
			} else if (ustrseq(us, "symmetric")) {
-
 
177
				bt = btype_signed;
-
 
178
			} else {
-
 
179
				return(t);
-
 
180
			}
-
 
181
			break;
75
 
182
 
76
/*
-
 
77
    PARSE A PORTABILITY TABLE
-
 
78
 
-
 
79
    This routine parses and processes the portability table.  It returns
-
 
80
    the last token read.
-
 
81
*/
-
 
82
 
-
 
83
static int parse_table
-
 
84
    PROTO_Z ()
-
 
85
{
-
 
86
    int t ;
-
 
87
    PORT_ENTRY *p = port_entry ;
-
 
88
    while ( t = read_token (), t == lex_identifier ) {
-
 
89
	int i ;
-
 
90
	unsigned n = 0 ;
-
 
91
	HASHID nm = token_hashid ;
-
 
92
	BASE_TYPE bt = btype_none ;
-
 
93
	string us = DEREF_string ( hashid_name_etc_text ( nm ) ) ;
-
 
94
	update_column () ;
-
 
95
 
-
 
96
	/* Check through table entries */
-
 
97
	for ( i = 0 ; i < PORT_size ; i++ ) {
-
 
98
	    string ut = ustrlit ( p [i].name ) ;
-
 
99
	    if ( ustreq ( us, ut ) ) {
-
 
100
		/* Entry found */
-
 
101
		if ( p [i].set == 2 ) {
-
 
102
		    report ( crt_loc, ERR_port_entry_redef ( ut ) ) ;
-
 
103
		}
-
 
104
		p [i].set = 2 ;
-
 
105
		break ;
-
 
106
	    }
-
 
107
	}
-
 
108
 
-
 
109
	/* Perform appropriate action */
-
 
110
	switch ( i ) {
-
 
111
 
-
 
112
	    case PORT_char_bits :
183
		case PORT_char_type:
113
	    case PORT_short_bits :
-
 
114
	    case PORT_int_bits :
-
 
115
	    case PORT_long_bits :
-
 
116
	    case PORT_llong_bits :
-
 
117
	    case PORT_max_bits :
-
 
118
	    case PORT_multibyte : {
-
 
119
		/* Deal with integral values */
-
 
120
		unsigned err = 0 ;
-
 
121
		t = read_token () ;
-
 
122
		update_column () ;
-
 
123
		if ( t != lex_integer_Hlit ) return ( t ) ;
-
 
124
		us = token_buff.start ;
-
 
125
		n = ( unsigned ) eval_line_digits ( us, &err ) ;
-
 
126
		if ( err ) report ( crt_loc, ERR_lex_literal_bad ( us ) ) ;
-
 
127
		break ;
-
 
128
	    }
-
 
129
 
-
 
130
	    case PORT_signed_range : {
-
 
131
		/* Deal with range values */
184
			/* Deal with sign values */
132
		t = read_token () ;
185
			t = read_token();
133
		update_column () ;
186
			update_column();
134
		if ( t != lex_identifier ) return ( t ) ;
187
			if (t != lex_identifier) {
135
		nm = token_hashid ;
-
 
136
		us = DEREF_string ( hashid_name_etc_text ( nm ) ) ;
-
 
137
		if ( ustrseq ( us, "maximum" ) ) {
-
 
138
		    bt = ( btype_signed | btype_long ) ;
-
 
139
		} else if ( ustrseq ( us, "symmetric" ) ) {
-
 
140
		    bt = btype_signed ;
-
 
141
		} else {
-
 
142
		    return ( t ) ;
188
				return(t);
143
		}
189
			}
144
		break ;
-
 
145
	    }
-
 
146
 
-
 
147
	    case PORT_char_type : {
-
 
148
		/* Deal with sign values */
-
 
149
		t = read_token () ;
-
 
150
		update_column () ;
-
 
151
		if ( t != lex_identifier ) return ( t ) ;
-
 
152
		nm = token_hashid ;
190
			nm = token_hashid;
153
		us = DEREF_string ( hashid_name_etc_text ( nm ) ) ;
191
			us = DEREF_string(hashid_name_etc_text(nm));
154
		if ( ustrseq ( us, "signed" ) ) {
192
			if (ustrseq(us, "signed")) {
155
		    bt = btype_signed ;
193
				bt = btype_signed;
156
		} else if ( ustrseq ( us, "unsigned" ) ) {
194
			} else if (ustrseq(us, "unsigned")) {
157
		    bt = btype_unsigned ;
195
				bt = btype_unsigned;
158
		} else if ( ustrseq ( us, "either" ) ) {
196
			} else if (ustrseq(us, "either")) {
159
		    bt = btype_none ;
197
				bt = btype_none;
160
		} else {
198
			} else {
161
		    return ( t ) ;
199
				return(t);
162
		}
200
			}
163
		break ;
201
			break;
164
	    }
-
 
165
 
202
 
166
	    case PORT_ptr_int : {
203
		case PORT_ptr_int:
167
		/* Deal with type values */
204
			/* Deal with type values */
168
		t = read_token () ;
205
			t = read_token();
169
		update_column () ;
206
			update_column();
170
		if ( t != lex_identifier ) return ( t ) ;
207
			if (t != lex_identifier) {
-
 
208
				return(t);
-
 
209
			}
171
		nm = token_hashid ;
210
			nm = token_hashid;
172
		us = DEREF_string ( hashid_name_etc_text ( nm ) ) ;
211
			us = DEREF_string(hashid_name_etc_text(nm));
173
		if ( ustrseq ( us, "char" ) ) {
212
			if (ustrseq(us, "char")) {
174
		    bt = btype_char ;
213
				bt = btype_char;
175
		} else if ( ustrseq ( us, "short" ) ) {
214
			} else if (ustrseq(us, "short")) {
176
		    bt = btype_short ;
215
				bt = btype_short;
177
		} else if ( ustrseq ( us, "int" ) ) {
216
			} else if (ustrseq(us, "int")) {
178
		    bt = btype_int ;
217
				bt = btype_int;
179
		} else if ( ustrseq ( us, "long" ) ) {
218
			} else if (ustrseq(us, "long")) {
180
		    bt = btype_long ;
219
				bt = btype_long;
181
		} else if ( ustrseq ( us, "none" ) ) {
220
			} else if (ustrseq(us, "none")) {
182
		    bt = btype_none ;
221
				bt = btype_none;
183
		} else {
222
			} else {
184
		    return ( t ) ;
223
				return(t);
185
		}
224
			}
186
		break ;
225
			break;
187
	    }
-
 
188
 
226
 
189
	    case PORT_exact_range :
227
		case PORT_exact_range:
190
	    case PORT_ptr_fn :
228
		case PORT_ptr_fn:
191
	    case PORT_non_proto : {
229
		case PORT_non_proto:
192
		/* Deal with boolean values */
230
			/* Deal with boolean values */
193
		t = read_token () ;
231
			t = read_token();
194
		update_column () ;
232
			update_column();
195
		if ( t != lex_identifier ) return ( t ) ;
233
			if (t != lex_identifier) {
-
 
234
				return(t);
-
 
235
			}
196
		nm = token_hashid ;
236
			nm = token_hashid;
197
		us = DEREF_string ( hashid_name_etc_text ( nm ) ) ;
237
			us = DEREF_string(hashid_name_etc_text(nm));
198
		if ( ustrseq ( us, "no" ) ) {
238
			if (ustrseq(us, "no")) {
199
		    n = 0 ;
239
				n = 0;
200
		} else if ( ustrseq ( us, "yes" ) ) {
240
			} else if (ustrseq(us, "yes")) {
201
		    n = 1 ;
241
				n = 1;
202
		} else {
242
			} else {
203
		    return ( t ) ;
243
				return(t);
-
 
244
			}
-
 
245
			break;
-
 
246
 
-
 
247
		default:
-
 
248
			/* Unknown entry identifier */
-
 
249
			return(t);
204
		}
250
		}
205
		break ;
-
 
206
	    }
-
 
207
 
-
 
208
	    default : {
251
		p[i].value = n;
209
		/* Unknown entry identifier */
-
 
210
		return ( t ) ;
252
		p[i].type = bt;
211
	    }
-
 
212
	}
253
	}
213
	p [i].value = n ;
-
 
214
	p [i].type = bt ;
-
 
215
    }
-
 
216
    return ( t ) ;
254
	return(t);
217
}
255
}
218
 
256
 
219
 
257
 
220
/*
258
/*
221
    READ THE PORTABILITY TABLE
259
    READ THE PORTABILITY TABLE
222
 
260
 
223
    This routine reads and processes the portability table given by nm.
261
    This routine reads and processes the portability table given by nm.
224
*/
262
*/
225
 
263
 
226
void read_table
264
void
227
    PROTO_N ( ( nm ) )
-
 
228
    PROTO_T ( string nm )
265
read_table(string nm)
229
{
266
{
230
    int set = 0 ;
267
	int set = 0;
231
    PORT_ENTRY *p = port_entry ;
268
	PORT_ENTRY *p = port_entry;
232
 
269
 
233
    /* Read table */
270
	/* Read table */
234
    if ( nm ) {
271
	if (nm) {
235
	int i, t ;
272
		int i, t;
236
	input_name = nm ;
273
		input_name = nm;
237
	if ( !open_input ( text_mode ) ) {
274
		if (!open_input(text_mode)) {
238
	    /* Can't open portability table */
275
			/* Can't open portability table */
239
	    fail ( ERR_fail_port ( nm ) ) ;
276
			fail(ERR_fail_port(nm));
240
	} else {
277
		} else {
241
	    /* Read portability table */
278
			/* Read portability table */
242
	    set = 1 ;
279
			set = 1;
243
	    pragma_number = 1 ;
280
			pragma_number = 1;
244
	    no_preproc_dir = 1 ;
281
			no_preproc_dir = 1;
245
	    crt_buff_no = 0 ;
282
			crt_buff_no = 0;
246
	    IGNORE init_buffer ( crt_buff_no ) ;
283
			IGNORE init_buffer(crt_buff_no);
247
	    unread_char ( char_newline ) ;
284
			unread_char(char_newline);
248
	    crt_loc.line-- ;
285
			crt_loc.line--;
249
	    t = parse_table () ;
286
			t = parse_table();
250
	    update_column () ;
287
			update_column();
251
	    if ( t != lex_eof ) {
288
			if (t != lex_eof) {
252
		/* Parse error in portability table */
289
				/* Parse error in portability table */
253
		PPTOKEN *r = new_pptok () ;
290
				PPTOKEN *r = new_pptok();
254
		r->tok = t ;
291
				r->tok = t;
255
		token_parts ( t, r ) ;
292
				token_parts(t, r);
256
		report ( crt_loc, ERR_lex_parse ( r ) ) ;
293
				report(crt_loc, ERR_lex_parse(r));
257
		set = 0 ;
294
				set = 0;
258
	    } else {
295
			} else {
259
		/* Check for undefined values */
296
				/* Check for undefined values */
260
		for ( i = 0 ; i < PORT_size ; i++ ) {
297
				for (i = 0; i < PORT_size; i++) {
261
		    if ( p [i].set == 0 ) {
298
					if (p[i].set == 0) {
262
			string nt = ustrlit ( p [i].name ) ;
299
						string nt = ustrlit(p[i].name);
263
			report ( crt_loc, ERR_port_entry_undef ( nt ) ) ;
300
						report(crt_loc, ERR_port_entry_undef(nt));
264
			set = 0 ;
301
						set = 0;
265
		    }
302
					}
266
		}
303
				}
267
	    }
304
			}
268
	    no_preproc_dir = 0 ;
305
			no_preproc_dir = 0;
269
	    pragma_number = 0 ;
306
			pragma_number = 0;
270
	    close_input () ;
307
			close_input();
271
	}
308
		}
272
    }
309
	}
273
 
310
 
274
    /* Set values from table */
311
	/* Set values from table */
275
    if ( set ) {
312
	if (set) {
276
	unsigned m ;
313
		unsigned m;
277
	unsigned long n ;
314
		unsigned long n;
278
	BASE_INFO *q = basetype_info ;
315
		BASE_INFO *q = basetype_info;
279
	set_char_sign ( p [ PORT_char_type ].type ) ;
316
		set_char_sign(p[PORT_char_type].type);
280
	if ( p [ PORT_llong_bits ].set == 2 ) {
317
		if (p[PORT_llong_bits].set == 2) {
281
	    /* 'long long' types are allowed */
318
			/* 'long long' types are allowed */
282
	    set_option ( OPT_longlong, ( unsigned ) OPTION_ALLOW ) ;
319
			set_option(OPT_longlong, (unsigned)OPTION_ALLOW);
283
	    m = p [ PORT_llong_bits ].value ;
320
			m = p[PORT_llong_bits].value;
284
	} else {
321
		} else {
285
	    /* 'long long' types are not allowed */
322
			/* 'long long' types are not allowed */
286
	    m = p [ PORT_long_bits ].value ;
323
			m = p[PORT_long_bits].value;
287
	    p [ PORT_llong_bits ].value = m ;
324
			p[PORT_llong_bits].value = m;
288
	}
325
		}
289
	if ( p [ PORT_exact_range ].value == 0 ) {
326
		if (p[PORT_exact_range].value == 0) {
290
	    /* Find maximum number of bits in an integer */
327
			/* Find maximum number of bits in an integer */
291
	    m = p [ PORT_max_bits ].value ;
328
			m = p[PORT_max_bits].value;
292
	}
-
 
293
	for ( n = 0 ; n < ORDER_ntype ; n++ ) {
-
 
294
	    unsigned exact = p [ PORT_exact_range ].value ;
-
 
295
	    switch ( n ) {
-
 
296
		case ntype_char :
-
 
297
		case ntype_schar :
-
 
298
		case ntype_uchar : {
-
 
299
		    q [n].min_bits = p [ PORT_char_bits ].value ;
-
 
300
		    q [n].max_bits = m ;
-
 
301
		    break ;
-
 
302
		}
-
 
303
		case ntype_sshort :
-
 
304
		case ntype_ushort : {
-
 
305
		    q [n].min_bits = p [ PORT_short_bits ].value ;
-
 
306
		    q [n].max_bits = m ;
-
 
307
		    break ;
-
 
308
		}
-
 
309
		case ntype_sint :
-
 
310
		case ntype_uint :
-
 
311
		case ntype_none : {
-
 
312
		    q [n].min_bits = p [ PORT_int_bits ].value ;
-
 
313
		    q [n].max_bits = m ;
-
 
314
		    break ;
-
 
315
		}
-
 
316
		case ntype_slong :
-
 
317
		case ntype_ulong : {
-
 
318
		    q [n].min_bits = p [ PORT_long_bits ].value ;
-
 
319
		    q [n].max_bits = m ;
-
 
320
		    break ;
-
 
321
		}
-
 
322
		case ntype_sllong :
-
 
323
		case ntype_ullong : {
-
 
324
		    q [n].min_bits = p [ PORT_llong_bits ].value ;
-
 
325
		    q [n].max_bits = m ;
-
 
326
		    break ;
-
 
327
		}
-
 
328
		case ntype_ptrdiff_t :
-
 
329
		case ntype_size_t : {
-
 
330
		    q [n].min_bits = p [ PORT_int_bits ].value ;
-
 
331
		    q [n].max_bits = m ;
-
 
332
		    exact = 0 ;
-
 
333
		    break ;
-
 
334
		}
329
		}
-
 
330
		for (n = 0; n < ORDER_ntype; n++) {
-
 
331
			unsigned exact = p[PORT_exact_range].value;
-
 
332
			switch (n) {
-
 
333
			case ntype_char:
-
 
334
			case ntype_schar:
-
 
335
			case ntype_uchar:
-
 
336
				q[n].min_bits = p[PORT_char_bits].value;
-
 
337
				q[n].max_bits = m;
-
 
338
				break;
-
 
339
			case ntype_sshort:
-
 
340
			case ntype_ushort:
-
 
341
				q[n].min_bits = p[PORT_short_bits].value;
-
 
342
				q[n].max_bits = m;
-
 
343
				break;
-
 
344
			case ntype_sint:
-
 
345
			case ntype_uint:
-
 
346
			case ntype_none:
-
 
347
				q[n].min_bits = p[PORT_int_bits].value;
-
 
348
				q[n].max_bits = m;
-
 
349
				break;
-
 
350
			case ntype_slong:
-
 
351
			case ntype_ulong:
-
 
352
				q[n].min_bits = p[PORT_long_bits].value;
-
 
353
				q[n].max_bits = m;
-
 
354
				break;
-
 
355
			case ntype_sllong:
-
 
356
			case ntype_ullong:
-
 
357
				q[n].min_bits = p[PORT_llong_bits].value;
-
 
358
				q[n].max_bits = m;
-
 
359
				break;
-
 
360
			case ntype_ptrdiff_t:
-
 
361
			case ntype_size_t:
-
 
362
				q[n].min_bits = p[PORT_int_bits].value;
-
 
363
				q[n].max_bits = m;
-
 
364
				exact = 0;
-
 
365
				break;
335
		case ntype_wchar_t :
366
			case ntype_wchar_t:
336
		case ntype_ellipsis : {
367
			case ntype_ellipsis:
337
		    q [n].min_bits = p [ PORT_char_bits ].value ;
368
				q[n].min_bits = p[PORT_char_bits].value;
338
		    q [n].max_bits = m ;
369
				q[n].max_bits = m;
339
		    exact = 0 ;
370
				exact = 0;
340
		    break ;
371
				break;
-
 
372
			}
-
 
373
			if (exact) {
-
 
374
				/* Exact integer range known */
-
 
375
				q[n].max_bits = q[n].min_bits;
-
 
376
			}
-
 
377
			if (q[n].sign & btype_signed) {
-
 
378
				/* Set signed type range */
-
 
379
				q[n].sign = p[PORT_signed_range].type;
-
 
380
			}
-
 
381
		}
-
 
382
		if (p[PORT_exact_range].value) {
-
 
383
			/* Set exact type ranges */
-
 
384
			set_exact_types();
341
		}
385
		}
342
	    }
-
 
343
	    if ( exact ) {
-
 
344
		/* Exact integer range known */
-
 
345
		q [n].max_bits = q [n].min_bits ;
-
 
346
	    }
-
 
347
	    if ( q [n].sign & btype_signed ) {
-
 
348
		/* Set signed type range */
-
 
349
		q [n].sign = p [ PORT_signed_range ].type ;
-
 
350
	    }
-
 
351
	}
-
 
352
	if ( p [ PORT_exact_range ].value ) {
-
 
353
	    /* Set exact type ranges */
-
 
354
	    set_exact_types () ;
-
 
355
	}
386
	}
356
    }
-
 
357
    return ;
387
	return;
358
}
388
}