Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /trunk/src/installers/amd64/common/spec_tok.c – Rev 6

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 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
 */
31
/*
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
/* 80x86/spec_tok.c */
62
 
63
/**********************************************************************
64
$Author: release $
65
$Date: 1998/01/17 15:55:52 $
66
$Revision: 1.1.1.1 $
67
$Log: spec_tok.c,v $
68
 * Revision 1.1.1.1  1998/01/17  15:55:52  release
69
 * First version to be checked into rolling release.
70
 *
71
 * Revision 1.9  1997/10/10  18:25:29  pwe
72
 * prep ANDF-DE revision
73
 *
74
 * Revision 1.8  1997/08/23  13:45:42  pwe
75
 * initial ANDF-DE
76
 *
77
 * Revision 1.7  1997/03/20  16:24:07  pwe
78
 * dwarf2
79
 *
80
 * Revision 1.6  1997/02/18  11:43:08  pwe
81
 * NEWDIAGS for debugging optimised code
82
 *
83
 * Revision 1.5  1996/12/13  14:39:33  pwe
84
 * prep NEWDIAGS
85
 *
86
 * Revision 1.4  1996/12/10  15:11:52  pwe
87
 * prep NEWDIAGS
88
 *
89
 * Revision 1.3  1996/10/29  14:04:49  pwe
90
 * remove inbuilt C promote etc, for inclusion of long long
91
 *
92
 * Revision 1.2  1995/01/30  12:56:52  pwe
93
 * Ownership -> PWE, tidy banners
94
 *
95
 * Revision 1.1  1994/10/27  14:15:22  jmf
96
 * Initial revision
97
 *
98
 * Revision 1.1  1994/07/12  14:41:50  jmf
99
 * Initial revision
100
 *
101
**********************************************************************/
102
 
103
 
104
#include "config.h"
105
#include "common_types.h"
106
#include "basicread.h"
107
#include "tags.h"
108
#include "exp.h"
109
#include "expmacs.h"
110
#include "diag_fns.h"
111
#include "flags.h"
112
#include "check.h"
113
#include "me_fns.h"
114
#include "externs.h"
115
#include "installglob.h"
116
#include "messages_r.h"
117
#include "main_reads.h"
118
#include "install_fns.h"
119
#include "c_arith_type.h"
120
#include "natmacs.h"
121
#include "spec_tok.h"
122
#include "dg_fns.h"
123
 
124
 
125
/* intercepts specially defined tokens */
126
 
127
tokval special_token
128
(token t, bitstream pars, int sortcode, int * done)
129
{
130
  tokval tkv;
131
  UNUSED(sortcode);
132
 
133
  if (t -> tok_name == (char*)0) {
134
    SET(tkv); /* call looks at done to see if result is meaningful */
135
    return tkv;
136
  };
137
 
138
  if (!strcmp(t -> tok_name, "JMFprofile")) {
139
      nat n;
140
      place old_place;
141
      old_place = keep_place();
142
      set_place(pars);
143
      n = d_nat();
144
 
145
      set_place(old_place);
146
      tkv.tk_exp = f_profile(n);
147
      *done = 1;
148
      return tkv;
149
  };
150
  if (!strcmp(t -> tok_name, "JMFinline")) {
151
      exp s;
152
      place old_place;
153
      old_place = keep_place();
154
      set_place(pars);
155
      IGNORE d_shape();
156
      s = d_exp();
157
      if (name(s) == apply_tag)
158
	settoinline(s);
159
      if (name(s) == ident_tag && name(son(s)) == clear_tag &&
160
		name(bro(son(s))) == seq_tag &&
161
		name(son(son(bro(son(s))))) == apply_tag)
162
	settoinline(son(son(bro(son(s)))));
163
 
164
 
165
      s = hold_check(s);
166
 
167
      set_place(old_place);
168
      tkv.tk_exp = s;
169
      *done = 1;
170
      return tkv;
171
  };
172
  if (!strcmp(t -> tok_name, "~div")) {
173
      exp arg1, arg2;
174
      place old_place;
175
      old_place = keep_place();
176
      set_place(pars);
177
      arg1 = hold_check(d_exp());
178
      arg2 = hold_check(d_exp());
179
 
180
      set_place(old_place);
181
      tkv.tk_exp = me_b2(arg1, arg2, div0_tag);
182
      *done = 1;
183
      return tkv;
184
  };
185
  if (!strcmp(t -> tok_name, "~rem")) {
186
      exp arg1, arg2;
187
      place old_place;
188
      old_place = keep_place();
189
      set_place(pars);
190
      arg1 = hold_check(d_exp());
191
      arg2 = hold_check(d_exp());
192
 
193
      set_place(old_place);
194
      tkv.tk_exp = me_b2(arg1, arg2, rem0_tag);
195
      *done = 1;
196
      return tkv;
197
  };
198
#ifdef INBUILT_PROMOTE
199
  if (!strcmp(t -> tok_name, "~arith_type")) {
200
    int a, b;
201
    place old_place;
202
    signed_nat sn;
203
    old_place = keep_place();
204
    set_place(pars);
205
    sn = d_signed_nat();
206
    a = snatint(sn);
207
    sn = d_signed_nat();
208
    b = snatint(sn);
209
    set_place(old_place);
210
    snatint(sn) = arith_type(a, b);
211
    tkv.tk_signed_nat = sn;
212
    *done = 1;
213
    return tkv;
214
  };
215
  if (!strcmp(t -> tok_name, "~promote")) {
216
    int a;
217
    place old_place;
218
    signed_nat sn;
219
    old_place = keep_place();
220
    set_place(pars);
221
    sn = d_signed_nat();
222
    a = snatint(sn);
223
    set_place(old_place);
224
    snatint(sn) = promote(a);
225
    tkv.tk_signed_nat = sn;
226
    *done = 1;
227
    return tkv;
228
  };
229
  if (!strcmp(t -> tok_name, "~sign_promote")) {
230
    int a;
231
    place old_place;
232
    signed_nat sn;
233
    old_place = keep_place();
234
    set_place(pars);
235
    sn = d_signed_nat();
236
    a = snatint(sn);
237
    set_place(old_place);
238
    snatint(sn) = sign_promote(a);
239
    tkv.tk_signed_nat = sn;
240
    *done = 1;
241
    return tkv;
242
  };
243
  if (!strcmp(t -> tok_name, "~convert")) {
244
    int a;
245
    place old_place;
246
    signed_nat sn;
247
    old_place = keep_place();
248
    set_place(pars);
249
    sn = d_signed_nat();
250
    a = snatint(sn);
251
    set_place(old_place);
252
    tkv.tk_variety = convert((unsigned)a);
253
    *done = 1;
254
    return tkv;
255
  };
256
#endif
257
  if (!strcmp(t -> tok_name, "~alloca")) {
258
      exp arg1;
259
      place old_place;
260
      old_place = keep_place();
261
      set_place(pars);
262
      arg1 = hold_check(d_exp());
263
      set_place(old_place);
264
      tkv.tk_exp = hold_check(me_u3(f_pointer(long_to_al(8)),
265
			   arg1, alloca_tag));
266
      *done = 1;
267
      has_alloca = 1;
268
      return tkv;
269
  };
270
 
271
  if (!strcmp(t -> tok_name, "~exp_to_source") ||
272
      !strcmp(t -> tok_name, "~diag_id_scope") ||
273
      !strcmp(t -> tok_name, "~diag_type_scope") ||
274
      !strcmp(t -> tok_name, "~diag_tag_scope")
275
#ifdef NEWDIAGS
276
	|| !strcmp(t -> tok_name, "~dg_exp")
277
#endif
278
    ) {
279
 
280
      place old_place;
281
      old_place = keep_place();
282
      set_place(pars);
283
      tkv.tk_exp = hold_check(d_exp());
284
      *done = 1;
285
 
286
      if (!diagnose)
287
        {
288
          set_place(old_place);
289
          return tkv;
290
        };
291
 
292
     if (!strcmp(t -> tok_name, "~exp_to_source"))
293
       {
294
#ifdef NEWDIAGS
295
	tkv.tk_exp = read_exp_to_source(tkv.tk_exp);
296
#else
297
        diag_info * di = read_exp_to_source();
298
        exp r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp, nilexp,
299
                   1, 0, diagnose_tag);
300
        setfather(r, tkv.tk_exp);
301
        dno(r) = di;
302
        tkv.tk_exp = r;
303
	crt_lno = natint(di -> data.source.end.line_no);
304
	crt_charno = natint(di -> data.source.end.char_off);
305
	crt_flnm = di -> data.source.beg.file->file.ints.chars;
306
#endif
307
        set_place(old_place);
308
        return tkv;
309
       };
310
 
311
     if (!strcmp(t -> tok_name, "~diag_id_scope"))
312
       {
313
#ifdef NEWDIAGS
314
        tkv.tk_exp = read_diag_id_scope(tkv.tk_exp);
315
#else
316
        diag_info * di = read_diag_id_scope();
317
        exp r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp, nilexp,
318
                   2, 0, diagnose_tag);
319
        setfather(r, tkv.tk_exp);
320
        dno(r) = di;
321
        tkv.tk_exp = r;
322
#endif
323
        set_place(old_place);
324
        return tkv;
325
       };
326
 
327
     if (!strcmp(t -> tok_name, "~diag_type_scope"))
328
       {
329
#ifdef NEWDIAGS
330
        tkv.tk_exp = read_diag_type_scope(tkv.tk_exp);
331
#else
332
        diag_info * di = read_diag_type_scope();
333
        exp r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp, nilexp,
334
                   3, 0, diagnose_tag);
335
        setfather(r, tkv.tk_exp);
336
        dno(r) = di;
337
        tkv.tk_exp = r;
338
#endif
339
        set_place(old_place);
340
        return tkv;
341
       };
342
 
343
     if (!strcmp(t -> tok_name, "~diag_tag_scope"))
344
       {
345
#ifndef NEWDIAGS
346
        diag_info * di = read_diag_tag_scope();
347
        exp r = getexp(sh(tkv.tk_exp), nilexp, 0, tkv.tk_exp, nilexp,
348
                   4, 0, diagnose_tag);
349
        setfather(r, tkv.tk_exp);
350
        dno(r) = di;
351
        tkv.tk_exp = r;
352
#endif
353
        set_place(old_place);
354
        return tkv;
355
       };
356
 
357
#ifdef NEWDIAGS
358
     if (!strcmp(t -> tok_name, "~dg_exp"))
359
       {
360
        tkv.tk_exp = read_dg_exp(tkv.tk_exp);
361
        set_place(old_place);
362
        return tkv;
363
       };
364
#endif
365
 
366
  };
367
 
368
  if (!strncmp(t -> tok_name, "~asm", 4)) {
369
    int prp;
370
    exp arg1;
371
    place old_place;
372
    old_place = keep_place();
373
    if (!strcmp(t -> tok_name, "~asm")) {
374
      set_place(pars);
375
      arg1 = hold_check(f_make_nof_int(ucharsh, d_string()));
376
      prp = 1;
377
    }
378
    else {
379
      if (!strcmp(t -> tok_name, "~asm_sequence"))
380
	prp = 0;
381
      else
382
      if (!strcmp(t -> tok_name, "~asm_exp_input"))
383
	prp = 2;
384
      else
385
      if (!strcmp(t -> tok_name, "~asm_exp_output"))
386
	prp = 4;
387
      else
388
      if (!strcmp(t -> tok_name, "~asm_exp_address"))
389
	prp = 8;
390
      else
391
	return tkv;
392
      set_place(pars);
393
      arg1 = hold_check(d_exp());
394
    }
395
    set_place(old_place);
396
    tkv.tk_exp = getexp(f_top, nilexp, 0, arg1, nilexp, prp, 0, asm_tag);
397
    setfather(tkv.tk_exp, arg1);
398
    *done = 1;
399
    return tkv;
400
  }
401
 
402
  SET(tkv); /* call looks at done to see if result is meaningful */
403
  return tkv;
404
}