/[ascend]/trunk/base/generic/compiler/btprolog.h
ViewVC logotype

Contents of /trunk/base/generic/compiler/btprolog.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download) (as text)
Sat Nov 13 16:45:56 2004 UTC (15 years, 10 months ago) by aw0a
File MIME type: text/x-chdr
File size: 7668 byte(s)
moving things to base/generic
1 /*
2 * btprolog.h
3 * By Benjamin A. Allan
4 * Jan 7, 1998.
5 * Part of ASCEND
6 * Version: $Revision: 1.3 $
7 * Version control file: $RCSfile: btprolog.h,v $
8 * Date last modified: $Date: 1998/06/16 16:38:40 $
9 * Last modified by: $Author: mthomas $
10 *
11 * This file is part of the Ascend Language Interpreter.
12 *
13 * Copyright (C) 1998 Carnegie Mellon University
14 *
15 * The Ascend Language Interpreter is free software; you can
16 * redistribute it and/or modify it under the terms of the GNU
17 * General Public License as published by the Free Software
18 * Foundation; either version 2 of the License, or (at your option)
19 * any later version.
20 *
21 * The Ascend Language Interpreter is distributed in hope that it
22 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
23 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 * See the GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with the program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
29 * the file named COPYING.
30 */
31
32 /*
33 * prolog for C to be compiled and dynamically loaded to provide
34 * residuals and gradients to token relations. This defines the
35 * math functions ascend will provide after loading the
36 * necessary system headers.
37 * Don't put anything in this prolog which requires access to
38 * other ascend sources. This header must be shipped with the
39 * binary distribution in some lib directory.
40 *
41 * bintoken.c also includes this so we maintain 1 definition
42 * of our structs. bintoken.h must include it AFTER func.h
43 * in bintoken.c.
44 */
45 #ifndef __BTPROLOG_H_SEEN__
46 #define __BTPROLOG_H_SEEN__
47
48 #ifndef _ASCCONFIG_H /* then this is being used to build a dynamic library,
49 * so we reverse the import/export definitions.
50 */
51 #ifdef WIN32
52 /* two for use in this file */
53 #define DLEXPORT __declspec(dllimport)
54 #define DLIMPORT __declspec(dllexport)
55 /* two for use in the generated file */
56 #define IMPORT __declspec(dllimport)
57 #define EXPORT __declspec(dllexport)
58 #else /* not win32 */
59 /* four for use in either file when the operating system is not brain dead */
60 #define DLEXPORT
61 #define DLIMPORT
62 #define EXPORT
63 #define IMPORT
64 #endif /* WIN32 */
65 #endif /* _ASCCONFIG_H */
66
67 #include <math.h>
68 #ifndef NULL
69 #ifdef __alpha
70 #define NULL 0L
71 #else
72 #define NULL 0
73 #endif
74 #endif
75
76 #define BinTokenGRADIENT 0
77 #define BinTokenRESIDUAL 1
78
79 /*
80 * residual evaluation function pointer.
81 * F(vars,resid);
82 * gradient evaluation function pointer.
83 * G(vars,grad,resid);
84 * F77 style interface code (if and big goto required inside)
85 * S(vars,grad,resid,ForG,bindex,status);
86 */
87 #ifdef __STDC__
88 typedef void (*BinTokenFPtr)(double *, double *);
89 typedef void (*BinTokenGPtr)(double *, double *, double *);
90 typedef void (*BinTokenSPtr)(double *, double *, double *, int *, int *, int *);
91 #else
92 typedef void (*BinTokenFPtr)();
93 typedef void (*BinTokenGPtr)();
94 typedef void (*BinTokenSPtr)();
95 #endif /* __STDC__ */
96
97 struct TableC {
98 BinTokenFPtr F;
99 BinTokenGPtr G;
100 };
101
102 struct TableF {
103 BinTokenSPtr S;
104 };
105
106 union TableUnion {
107 struct TableC c;
108 struct TableF f;
109 };
110
111 #ifdef __STDC__
112 extern int DLEXPORT ExportBinTokenCTable(struct TableC *, int);
113 #else
114 extern int DLEXPORT ExportBinTokenCTable();
115 #endif /* __STDC__ */
116
117 #ifndef __FUNC_H_SEEN__
118 /* The following is stripped from compiler func.h.
119 * If a new function is introduced into ASCEND and func.h, fix this.
120 */
121
122 #ifdef __STDC__
123 #if __STDC__
124 /*
125 * stdc==1 --> erf, cbrt not defined in headers. user should link
126 * against a library that does provide them. ASCEND is research
127 * code: we aren't going to waste time reimplementing these basic
128 * functions.
129 */
130 extern double DLEXPORT cbrt(double);
131 #ifdef HAVE_ERF
132 extern double DLEXPORT erf(double);
133 #endif /* HAVE_ERF */
134 #endif /* __STDC__ == 1 */
135 /*
136 * in the case where __STDC__ is defined but == 0, system headers
137 * should provide cbrt, erf.
138 */
139 extern int DLEXPORT ascnintF(double);
140 extern double DLEXPORT dln(double);
141 extern double DLEXPORT dln2(double);
142 extern double DLEXPORT dlog(double);
143 extern double DLEXPORT dlog2(double);
144 extern double DLEXPORT lnm(double);
145 extern double DLEXPORT dlnm(double);
146 extern double DLEXPORT dlnm2(double);
147 extern double DLEXPORT dtanh(double);
148 extern double DLEXPORT dtanh2(double);
149 extern double DLEXPORT arcsinh(double);
150 extern double DLEXPORT arccosh(double);
151 extern double DLEXPORT arctanh(double);
152 extern double DLEXPORT darcsinh(double);
153 extern double DLEXPORT darcsinh2(double);
154 extern double DLEXPORT darccosh(double);
155 extern double DLEXPORT darccosh2(double);
156 extern double DLEXPORT darctanh(double);
157 extern double DLEXPORT darctanh2(double);
158 extern double DLEXPORT sqr(double);
159 extern double DLEXPORT dsqr(double);
160 extern double DLEXPORT dsqr2(double);
161 extern double DLEXPORT cube(double);
162 extern double DLEXPORT dcube(double);
163 extern double DLEXPORT dcube2(double);
164 extern double DLEXPORT asc_ipow(double,int);
165 extern double DLEXPORT asc_d1ipow(double,int);
166 extern double DLEXPORT asc_d2ipow(double,int);
167 extern double DLEXPORT hold(double);
168 extern double DLEXPORT dsqrt(double);
169 extern double DLEXPORT dsqrt2(double);
170 extern double DLEXPORT dcbrt(double);
171 extern double DLEXPORT dcbrt2(double);
172 extern double DLEXPORT dfabs(double);
173 extern double DLEXPORT dfabs2(double);
174 extern double DLEXPORT dhold(double);
175 extern double DLEXPORT dasin(double);
176 extern double DLEXPORT dasin2(double);
177 extern double DLEXPORT dcos(double);
178 extern double DLEXPORT dcos2(double);
179 extern double DLEXPORT dacos(double);
180 extern double DLEXPORT dacos2(double);
181 extern double DLEXPORT dtan(double);
182 extern double DLEXPORT dtan2(double);
183 extern double DLEXPORT datan(double);
184 extern double DLEXPORT datan2(double);
185 extern double DLEXPORT derf(double);
186 extern double DLEXPORT derf2(double);
187
188 #else /* no stdc */
189
190 extern double DLEXPORT cbrt();
191 #ifdef HAVE_ERF
192 extern double DLEXPORT erf();
193 #endif /* HAVE_ERF */
194 extern int DLEXPORT ascnintF();
195 extern double DLEXPORT dln();
196 extern double DLEXPORT dln2();
197 extern double DLEXPORT dlog();
198 extern double DLEXPORT dlog2();
199 extern double DLEXPORT lnm();
200 extern double DLEXPORT dlnm();
201 extern double DLEXPORT dlnm2();
202 extern double DLEXPORT dtanh();
203 extern double DLEXPORT dtanh2();
204 extern double DLEXPORT arcsinh();
205 extern double DLEXPORT arccosh();
206 extern double DLEXPORT arctanh();
207 extern double DLEXPORT darcsinh();
208 extern double DLEXPORT darcsinh2();
209 extern double DLEXPORT darccosh();
210 extern double DLEXPORT darccosh2();
211 extern double DLEXPORT darctanh();
212 extern double DLEXPORT darctanh2();
213 extern double DLEXPORT sqr();
214 extern double DLEXPORT dsqr();
215 extern double DLEXPORT dsqr2();
216 extern double DLEXPORT cube();
217 extern double DLEXPORT dcube();
218 extern double DLEXPORT dcube2();
219 extern double DLEXPORT asc_ipow();
220 extern double DLEXPORT asc_d1ipow();
221 extern double DLEXPORT asc_d2ipow();
222 extern double DLEXPORT hold();
223 extern double DLEXPORT dsqrt();
224 extern double DLEXPORT dsqrt2();
225 extern double DLEXPORT dcbrt();
226 extern double DLEXPORT dcbrt2();
227 extern double DLEXPORT dfabs();
228 extern double DLEXPORT dfabs2();
229 extern double DLEXPORT dhold();
230 extern double DLEXPORT dasin();
231 extern double DLEXPORT dasin2();
232 extern double DLEXPORT dcos();
233 extern double DLEXPORT dcos2();
234 extern double DLEXPORT dacos();
235 extern double DLEXPORT dacos2();
236 extern double DLEXPORT dtan();
237 extern double DLEXPORT dtan2();
238 extern double DLEXPORT datan();
239 extern double DLEXPORT datan2();
240 extern double DLEXPORT derf();
241 extern double DLEXPORT derf2();
242
243 #endif /* no stdc */
244 #endif /* fake__FUNC_H_SEEN__ */
245 #endif /* __BTPROLOG_H_SEEN__ */

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22