Subversion Repositories tendra.SVN

Rev

Rev 7 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 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) 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
			    VERSION INFORMATION
61
			    ===================
62
 
63
--------------------------------------------------------------------------
64
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/common/special_exps.c,v 1.1.1.1 1998/01/17 15:55:50 release Exp $
65
--------------------------------------------------------------------------
66
$Log: special_exps.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.2  1997/10/29 10:22:29  ma
71
Replaced use_alloca with has_alloca.
72
 
73
Revision 1.1.1.1  1997/10/13 12:42:58  ma
74
First version.
75
 
76
Revision 1.1  1997/09/24 08:25:43  ma
77
First version
78
 
79
 
80
--------------------------------------------------------------------------
81
*/
82
 
83
 
84
#include "config.h"
85
#include "common_types.h"
86
#include "exp.h"
87
#include "expmacs.h"
88
#include "exptypes.h"
89
#include "shapemacs.h"
90
#include "tags.h"
91
#include "install_fns.h"
92
#include "instrs.h"
93
#include "special_exps.h"
94
#include "utility.h"
95
 
96
/************************************************************************
97
  Make an exp representing the contents of an external tag with
98
  name n of shape s and variable if v.
99
 ************************************************************************/
100
 
7 7u83 101
exp
102
make_extn(char* n, shape s, int v)
2 7u83 103
{
7 7u83 104
	dec * g = alloc_nof(dec, 1);
105
	exp id = getexp(s, 0, 1, 0, 0, 0, 0, ident_tag);
106
	exp nme = getexp(s, 0, 1, id, 0, 0, 0, name_tag);
107
	setglob(id);
108
	if (v) {
109
		setvar(id);
110
	}
111
	brog(id) = g;
112
	g -> dec_u.dec_val.dec_exp = id;
113
	g -> dec_u.dec_val.dec_id = n;
114
	g -> dec_u.dec_val.extnamed = 1;
115
	return (nme);
2 7u83 116
}
117
 
118
/************************************************************************
119
  Make an exp representing a dummy double destination used to force a
120
  floating point overflow (if any) for expression with zero destination.
121
 ************************************************************************/
7 7u83 122
exp
123
get_dummy_double_dest(void)
2 7u83 124
{
7 7u83 125
	return (make_extn("___m68k_dummy_double", doublesh, 1));
2 7u83 126
}
127
 
128
 
129
/************************************************************************
130
  Make an exp representing the stack limit
131
 ************************************************************************/
7 7u83 132
exp
133
get_stack_limit(void)
2 7u83 134
{
7 7u83 135
	return make_extn("___m68k_stack_limit", ulongsh, 1);
2 7u83 136
}
137
 
138
/************************************************************************
139
  Make an exp representing the error handler
140
 ************************************************************************/
7 7u83 141
exp
142
get_error_handler(void)
2 7u83 143
{
7 7u83 144
	return make_extn("___m68k_errhandler", ulongsh, 1);
2 7u83 145
}
146
/************************************************************************
147
  Make an exp representing env_size
148
 ************************************************************************/
7 7u83 149
exp
150
get_env_size(dec *decl)
2 7u83 151
{
7 7u83 152
	/* allocate space for 10 digits 2 prefix characters and a null */
153
	char* lab_name = alloc_nof(char, 13);
154
	sprintf(lab_name, "#%c%lu", LPREFIX,(unsigned long)decl);
155
	return make_extn(lab_name, ulongsh, 1);
2 7u83 156
}
157