/[ascend]/trunk/ascend/bintokens/btprolog.h
ViewVC logotype

Contents of /trunk/ascend/bintokens/btprolog.h

Parent Directory Parent Directory | Revision Log Revision Log


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

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