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-2006 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) 1996
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
			    VERSION INFORMATION
61
			    ===================
62
 
63
--------------------------------------------------------------------------
64
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/common/spec_tok.c,v 1.1.1.1 1998/01/17 15:55:50 release Exp $
65
--------------------------------------------------------------------------
66
$Log: spec_tok.c,v $
67
 * Revision 1.1.1.1  1998/01/17  15:55:50  release
68
 * First version to be checked into rolling release.
69
 *
70
Revision 1.1.1.1  1997/10/13 12:42:58  ma
71
First version.
72
 
73
Revision 1.1.1.1  1997/03/14 07:50:18  ma
74
Imported from DRA
75
 
76
 * Revision 1.1.1.1  1996/09/20  10:56:58  john
77
 *
78
 * Revision 1.1.1.1  1996/03/26  15:45:17  john
79
 *
80
 * Revision 1.1  94/06/29  14:25:55  14:25:55  ra (Robert Andrews)
81
 * Initial revision
82
 *
83
--------------------------------------------------------------------------
84
*/
85
 
86
 
87
#include "config.h"
88
#include "common_types.h"
89
#include "basicread.h"
90
#include "tags.h"
91
#include "exp.h"
92
#include "expmacs.h"
93
#include "diag_fns.h"
94
#include "flags.h"
95
#include "check.h"
96
#include "me_fns.h"
97
#include "externs.h"
98
#include "installglob.h"
99
#include "messages_r.h"
100
#include "main_reads.h"
101
#include "install_fns.h"
102
#include "c_arith_type.h"
103
#include "natmacs.h"
104
#include "spec_tok.h"
105
 
106
 
107
/*
108
    INTERCEPT SPECIAL TOKENS
109
*/
110
 
6 7u83 111
tokval
112
special_token(token t, bitstream pars, int sortcode, int *done)
2 7u83 113
{
6 7u83 114
	tokval tkv;
115
	UNUSED(sortcode);
2 7u83 116
 
6 7u83 117
	if (t->tok_name == NULL) {
118
		/* call looks at done to see if result is meaningful */
119
		SET(tkv);
120
		return (tkv);
121
	}
2 7u83 122
 
6 7u83 123
	/* alloca */
124
	if (!strcmp(t->tok_name, "~alloca")) {
125
		exp arg1;
126
		place old_place;
127
		old_place = keep_place();
128
		set_place(pars);
129
		arg1 = hold_check(d_exp());
130
		set_place(old_place);
131
		tkv.tk_exp = hold_check(me_u3(f_pointer(long_to_al(8)),
132
					      arg1, alloca_tag));
133
		*done = 1;
134
		has_alloca = 1;
135
		return (tkv);
136
	}
2 7u83 137
 
6 7u83 138
	/* diagnostic tokens */
139
	if (!strcmp(t->tok_name, "~exp_to_source") ||
140
	    !strcmp(t->tok_name, "~diag_id_scope") ||
141
	    !strcmp(t->tok_name, "~diag_type_scope") ||
142
	    !strcmp(t->tok_name, "~diag_tag_scope")) {
143
		place old_place;
144
		old_place = keep_place();
145
		set_place(pars);
146
		tkv.tk_exp = hold_check(d_exp());
147
		*done = 1;
148
		if (!diagnose) {
149
			set_place(old_place);
150
			return (tkv);
151
		}
152
		if (!strcmp(t->tok_name, "~exp_to_source")) {
153
			exp r;
154
			diag_info *di = read_exp_to_source();
155
			crt_lno = natint(di->data.source.end.line_no);
156
			crt_charno = natint(di->data.source.end.char_off);
157
			crt_flnm = di->data.source.beg.file->file.ints.chars;
158
			r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp,
159
				   nilexp, 1, 0, diagnose_tag);
160
			setfather(r, tkv.tk_exp);
161
			dno(r) = di;
162
			tkv.tk_exp = r;
163
			set_place(old_place);
164
			return (tkv);
165
		}
166
		if (!strcmp(t->tok_name, "~diag_id_scope")) {
167
			exp r;
168
			diag_info *di = read_diag_id_scope();
169
			r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp,
170
				   nilexp, 2, 0, diagnose_tag);
171
			setfather(r, tkv.tk_exp);
172
			dno(r) = di;
173
			tkv.tk_exp = r;
174
			set_place(old_place);
175
			return (tkv);
176
		}
177
		if (!strcmp(t->tok_name, "~diag_type_scope")) {
178
			exp r;
179
			diag_info *di = read_diag_type_scope();
180
			r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp,
181
				   nilexp, 3, 0, diagnose_tag);
182
			setfather(r, tkv.tk_exp);
183
			dno(r) = di;
184
			tkv.tk_exp = r;
185
			set_place(old_place);
186
			return (tkv);
187
		}
188
		if (!strcmp(t->tok_name, "~diag_tag_scope")) {
189
			exp r;
190
			diag_info *di = read_diag_tag_scope();
191
			r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp,
192
				   nilexp, 4, 0, diagnose_tag);
193
			setfather(r, tkv.tk_exp);
194
			dno(r) = di;
195
			tkv.tk_exp = r;
196
			set_place(old_place);
197
			return (tkv);
198
		}
2 7u83 199
	}
200
 
6 7u83 201
	/* call looks at done to see if result is meaningful */
202
	SET(tkv);
203
	return (tkv);
2 7u83 204
}
205
 
206
 
207
/*
208
    CHECK FOR MACHINE DEPENDENT TOKENS
209
*/
210
 
6 7u83 211
int
212
machine_toks(char *s)
2 7u83 213
{
6 7u83 214
	return (0);
2 7u83 215
}