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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (hide annotations) (download) (as text)
Mon Dec 19 06:59:40 2005 UTC (14 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 7760 byte(s)
Changing 'log' function to 'log10'
1 aw0a 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 jds 54 /** @file
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.<br><br>
37 aw0a 1 *
38 jds 54 * Don't put anything in this prolog which requires access to
39     * other ASCEND sources. This header must be shipped with the
40     * binary distribution in some lib directory.<br><br>
41     *
42     * bintoken.c also includes this so we maintain 1 definition
43     * of our structs. bintoken.h must include it AFTER func.h
44     * in bintoken.c.
45     * <pre>
46     * When #including btprolog.h, make sure these files are #included first:
47     * #include "utilities/ascConfig.h"
48     * #include "instance_enum.h"
49     * <pre>
50     *
51     * @todo Complete documentation of btprolog.h.
52 aw0a 1 */
53 jds 54
54 aw0a 1 #ifndef __BTPROLOG_H_SEEN__
55     #define __BTPROLOG_H_SEEN__
56    
57 johnpye 62 #include <utilities/ascConfig.h>
58     #include <compiler/instance_enum.h>
59 aw0a 1 #include <math.h>
60 johnpye 62
61 aw0a 1 #ifndef NULL
62     #ifdef __alpha
63     #define NULL 0L
64     #else
65     #define NULL 0
66     #endif
67     #endif
68    
69     #define BinTokenGRADIENT 0
70     #define BinTokenRESIDUAL 1
71    
72     #ifdef __STDC__
73 jds 54 /** Residual evaluation function pointer. F(vars,resid); */
74 aw0a 1 typedef void (*BinTokenFPtr)(double *, double *);
75 jds 54 /** Gradient evaluation function pointer. G(vars,grad,resid); */
76 aw0a 1 typedef void (*BinTokenGPtr)(double *, double *, double *);
77 jds 54 /**
78     * F77 style interface code (if and big goto required inside).
79     * S(vars,grad,resid,ForG,bindex,status);
80     */
81 aw0a 1 typedef void (*BinTokenSPtr)(double *, double *, double *, int *, int *, int *);
82     #else
83 jds 54 /** Residual evaluation function pointer. F(vars,resid); */
84 aw0a 1 typedef void (*BinTokenFPtr)();
85 jds 54 /** Gradient evaluation function pointer. G(vars,grad,resid); */
86 aw0a 1 typedef void (*BinTokenGPtr)();
87 jds 54 /**
88     * F77 style interface code (if and big goto required inside).
89     * S(vars,grad,resid,ForG,bindex,status);
90     */
91 aw0a 1 typedef void (*BinTokenSPtr)();
92     #endif /* __STDC__ */
93    
94     struct TableC {
95     BinTokenFPtr F;
96     BinTokenGPtr G;
97     };
98    
99     struct TableF {
100     BinTokenSPtr S;
101     };
102    
103     union TableUnion {
104     struct TableC c;
105     struct TableF f;
106     };
107    
108     #ifdef __STDC__
109 jds 54 extern int DLEXPORT ExportBinTokenCTable(struct TableC *t, int size);
110 aw0a 1 #else
111     extern int DLEXPORT ExportBinTokenCTable();
112     #endif /* __STDC__ */
113    
114     #ifndef __FUNC_H_SEEN__
115     /* The following is stripped from compiler func.h.
116     * If a new function is introduced into ASCEND and func.h, fix this.
117     */
118    
119     #ifdef __STDC__
120     #if __STDC__
121     /*
122     * stdc==1 --> erf, cbrt not defined in headers. user should link
123     * against a library that does provide them. ASCEND is research
124     * code: we aren't going to waste time reimplementing these basic
125     * functions.
126     */
127 jds 54 extern double DLEXPORT cbrt(double x);
128 aw0a 1 #ifdef HAVE_ERF
129 jds 54 extern double DLEXPORT erf(double x);
130 aw0a 1 #endif /* HAVE_ERF */
131     #endif /* __STDC__ == 1 */
132     /*
133     * in the case where __STDC__ is defined but == 0, system headers
134     * should provide cbrt, erf.
135     */
136 jds 54 extern int DLEXPORT ascnintF(double x);
137     extern double DLEXPORT dln(double x);
138     extern double DLEXPORT dln2(double x);
139 johnpye 123 extern double DLEXPORT dlog10(double x);
140     extern double DLEXPORT dlog102(double x);
141 jds 54 extern double DLEXPORT lnm(double x);
142     extern double DLEXPORT dlnm(double x);
143     extern double DLEXPORT dlnm2(double x);
144     extern double DLEXPORT dtanh(double x);
145     extern double DLEXPORT dtanh2(double x);
146     extern double DLEXPORT arcsinh(double x);
147     extern double DLEXPORT arccosh(double x);
148     extern double DLEXPORT arctanh(double x);
149     extern double DLEXPORT darcsinh(double x);
150     extern double DLEXPORT darcsinh2(double x);
151     extern double DLEXPORT darccosh(double x);
152     extern double DLEXPORT darccosh2(double x);
153     extern double DLEXPORT darctanh(double x);
154     extern double DLEXPORT darctanh2(double x);
155     extern double DLEXPORT sqr(double x);
156     extern double DLEXPORT dsqr(double x);
157     extern double DLEXPORT dsqr2(double x);
158     extern double DLEXPORT cube(double x);
159     extern double DLEXPORT dcube(double x);
160     extern double DLEXPORT dcube2(double x);
161     extern double DLEXPORT asc_ipow(double x, int y);
162     extern double DLEXPORT asc_d1ipow(double x, int y);
163     extern double DLEXPORT asc_d2ipow(double x, int y);
164     extern double DLEXPORT hold(double x);
165     extern double DLEXPORT dsqrt(double x);
166     extern double DLEXPORT dsqrt2(double x);
167     extern double DLEXPORT dcbrt(double x);
168     extern double DLEXPORT dcbrt2(double x);
169     extern double DLEXPORT dfabs(double x);
170     extern double DLEXPORT dfabs2(double x);
171     extern double DLEXPORT dhold(double x);
172     extern double DLEXPORT dasin(double x);
173     extern double DLEXPORT dasin2(double x);
174     extern double DLEXPORT dcos(double x);
175     extern double DLEXPORT dcos2(double x);
176     extern double DLEXPORT dacos(double x);
177     extern double DLEXPORT dacos2(double x);
178     extern double DLEXPORT dtan(double x);
179     extern double DLEXPORT dtan2(double x);
180     extern double DLEXPORT datan(double x);
181     extern double DLEXPORT datan2(double x);
182     extern double DLEXPORT derf(double x);
183     extern double DLEXPORT derf2(double x);
184 aw0a 1
185     #else /* no stdc */
186    
187     extern double DLEXPORT cbrt();
188     #ifdef HAVE_ERF
189     extern double DLEXPORT erf();
190     #endif /* HAVE_ERF */
191     extern int DLEXPORT ascnintF();
192     extern double DLEXPORT dln();
193     extern double DLEXPORT dln2();
194     extern double DLEXPORT dlog();
195     extern double DLEXPORT dlog2();
196     extern double DLEXPORT lnm();
197     extern double DLEXPORT dlnm();
198     extern double DLEXPORT dlnm2();
199     extern double DLEXPORT dtanh();
200     extern double DLEXPORT dtanh2();
201     extern double DLEXPORT arcsinh();
202     extern double DLEXPORT arccosh();
203     extern double DLEXPORT arctanh();
204     extern double DLEXPORT darcsinh();
205     extern double DLEXPORT darcsinh2();
206     extern double DLEXPORT darccosh();
207     extern double DLEXPORT darccosh2();
208     extern double DLEXPORT darctanh();
209     extern double DLEXPORT darctanh2();
210     extern double DLEXPORT sqr();
211     extern double DLEXPORT dsqr();
212     extern double DLEXPORT dsqr2();
213     extern double DLEXPORT cube();
214     extern double DLEXPORT dcube();
215     extern double DLEXPORT dcube2();
216     extern double DLEXPORT asc_ipow();
217     extern double DLEXPORT asc_d1ipow();
218     extern double DLEXPORT asc_d2ipow();
219     extern double DLEXPORT hold();
220     extern double DLEXPORT dsqrt();
221     extern double DLEXPORT dsqrt2();
222     extern double DLEXPORT dcbrt();
223     extern double DLEXPORT dcbrt2();
224     extern double DLEXPORT dfabs();
225     extern double DLEXPORT dfabs2();
226     extern double DLEXPORT dhold();
227     extern double DLEXPORT dasin();
228     extern double DLEXPORT dasin2();
229     extern double DLEXPORT dcos();
230     extern double DLEXPORT dcos2();
231     extern double DLEXPORT dacos();
232     extern double DLEXPORT dacos2();
233     extern double DLEXPORT dtan();
234     extern double DLEXPORT dtan2();
235     extern double DLEXPORT datan();
236     extern double DLEXPORT datan2();
237     extern double DLEXPORT derf();
238     extern double DLEXPORT derf2();
239    
240 jds 54 #endif /* no stdc */
241     #endif /* fake__FUNC_H_SEEN__ */
242     #endif /* __BTPROLOG_H_SEEN__ */
243    

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