2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997
|
|
|
3 |
|
|
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
6 |
acting through the Defence Evaluation and Research Agency
|
|
|
7 |
(DERA). It is made available to Recipients with a
|
|
|
8 |
royalty-free licence for its use, reproduction, transfer
|
|
|
9 |
to other parties and amendment for any purpose not excluding
|
|
|
10 |
product development provided that any such use et cetera
|
|
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
12 |
|
|
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
14 |
reproduced upon any copies or amended versions of it;
|
|
|
15 |
|
|
|
16 |
(2) Any amended version of it shall be clearly marked to
|
|
|
17 |
show both the nature of and the organisation responsible
|
|
|
18 |
for the relevant amendment or amendments;
|
|
|
19 |
|
|
|
20 |
(3) Its onward transfer from a recipient to another
|
|
|
21 |
party shall be deemed to be that party's acceptance of
|
|
|
22 |
these conditions;
|
|
|
23 |
|
|
|
24 |
(4) DERA gives no warranty or assurance as to its
|
|
|
25 |
quality or suitability for any purpose and DERA accepts
|
|
|
26 |
no liability whatsoever in relation to any use to which
|
|
|
27 |
it may be put.
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
/**********************************************************************
|
|
|
32 |
$Author: release $
|
|
|
33 |
$Date: 1998/01/17 15:56:06 $
|
|
|
34 |
$Revision: 1.1.1.1 $
|
|
|
35 |
$Log: spec.c,v $
|
|
|
36 |
* Revision 1.1.1.1 1998/01/17 15:56:06 release
|
|
|
37 |
* First version to be checked into rolling release.
|
|
|
38 |
*
|
|
|
39 |
* Revision 1.1 1995/04/13 09:08:06 currie
|
|
|
40 |
* Initial revision
|
|
|
41 |
*
|
|
|
42 |
***********************************************************************/
|
|
|
43 |
|
|
|
44 |
/**********************************************************************
|
|
|
45 |
|
|
|
46 |
spec.c
|
|
|
47 |
|
|
|
48 |
Defines special_fn which recognises and replaces some special
|
|
|
49 |
function calls.
|
|
|
50 |
|
|
|
51 |
**********************************************************************/
|
|
|
52 |
|
|
|
53 |
#include "config.h"
|
|
|
54 |
#include "common_types.h"
|
|
|
55 |
#include "tags.h"
|
|
|
56 |
#include "externs.h"
|
|
|
57 |
#include "expmacs.h"
|
|
|
58 |
#include "shapemacs.h"
|
|
|
59 |
#include "exp.h"
|
|
|
60 |
#include "basicread.h"
|
|
|
61 |
#include "flags.h"
|
|
|
62 |
#include "table_fns.h"
|
|
|
63 |
#include "installglob.h"
|
|
|
64 |
#include "spec.h"
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
speci special_fn
|
|
|
68 |
PROTO_N ( (a1, a2, s) )
|
|
|
69 |
PROTO_T ( exp a1 X exp a2 X shape s )
|
|
|
70 |
{ /* look for special functions */
|
|
|
71 |
speci spr;
|
|
|
72 |
dec* dp = brog (son (a1));
|
|
|
73 |
char *id = dp -> dec_u.dec_val.dec_id;
|
|
|
74 |
spr.is_special = 0;
|
|
|
75 |
if (id == (char *) 0)
|
|
|
76 |
return (spr);
|
|
|
77 |
/* at present the detection of special cases is done on the identifiers,
|
|
|
78 |
but it really ought to be on special tokens, as for diagnostics */
|
|
|
79 |
|
|
|
80 |
if (!strcmp (id, "setjmp"))
|
|
|
81 |
has_setjmp = 1;
|
|
|
82 |
|
|
|
83 |
if (a2 != nilexp && last(a2) && ( (do_alloca && !strcmp (id, "alloca"))
|
|
|
84 |
|| !strcmp (id, "__builtin_alloca"))) {
|
|
|
85 |
exp r = getexp (s, nilexp, 0, a2, nilexp, 0,
|
|
|
86 |
(long) 0, alloca_tag);
|
|
|
87 |
setfather(r, son(r));
|
|
|
88 |
has_alloca = 1;
|
|
|
89 |
spr.is_special = 1;
|
|
|
90 |
spr.special_exp = r;
|
|
|
91 |
kill_exp (a1, a1);
|
|
|
92 |
return (spr);
|
|
|
93 |
};
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
return (spr);
|
|
|
98 |
}
|