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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 89 - (show annotations) (download) (as text)
Wed Dec 7 15:44:43 2005 UTC (18 years, 10 months ago) by johnpye
File MIME type: text/x-chdr
File size: 3950 byte(s)
Small changes to eliminate GCC warnings
1 /*
2 * Function module
3 * by Tom Epperly
4 * Version: $Revision: 1.8 $
5 * Version control file: $RCSfile: functype.h,v $
6 * Date last modified: $Date: 2001/01/31 22:23:58 $
7 * Last modified by: $Author: ballan $
8 *
9 * This file is part of the Ascend Language Interpreter.
10 *
11 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
12 *
13 * The Ascend Language Interpreter is free software; you can redistribute
14 * it and/or modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of the
16 * License, or (at your option) any later version.
17 *
18 * The Ascend Language Interpreter is distributed in hope that it will be
19 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with the program; if not, write to the Free Software Foundation,
25 * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
26 * COPYING. Revision notes:
27 *
28 * If CHRIS_FUNC defined, auxillary quantities to func structure.
29 * 2/96 baa Probably somebody should properly set these evaluation
30 * defined below based on math.h when possible.
31 * 10/96 moved safe_err definition into here.
32 */
33
34 /** @file
35 * Function module types and data structures.
36 * <pre>
37 * When #including functype.h, make sure these files are #included first:
38 * #include "compiler.h"
39 * </pre>
40 */
41
42 #ifndef ASC_FUNCTYPE_H
43 #define ASC_FUNCTYPE_H
44
45 /**
46 * Safe math error codes.
47 * If you add to this enum be sure to add to safe_error_to_stderr
48 */
49 enum safe_err {
50 safe_problem = -1,
51 safe_ok = 0,
52 safe_div_by_zero = 1,
53 safe_complex_result = 2,
54 safe_overflow = 3,
55 safe_underflow = 4,
56 safe_range_error = 5
57 };
58
59 /** Function enumeration. */
60 enum Func_enum {
61 F_LOG, F_LN, F_EXP,
62 F_SIN, F_COS, F_TAN,
63 F_ARCSIN, F_ARCCOS, F_ARCTAN,
64 F_SQR, F_SQRT,
65 #ifdef HAVE_ERF
66 F_ERF,
67 #endif
68 F_LNM, F_SINH, F_COSH, F_TANH,
69 F_ARCSINH, F_ARCCOSH, F_ARCTANH,
70 F_CUBE, F_CBRT, F_ABS, F_HOLD
71 };
72
73 /** Function data structure. */
74 struct Func {
75 CONST char *name; /**< ASCEND name of function. not symchar */
76 CONST char *cname; /**< C name of function. not symchar */
77 CONST char *deriv1cname; /**< C name of first derivative. not symchar */
78 CONST char *deriv2cname; /**< C name of second derivative. not symchar */
79 enum Func_enum id; /**< identification of function */
80 double (*value)(double); /**< pointer to function evaluation */
81 double (*deriv)(double); /**< pointer to derivative evaluation */
82 double (*deriv2)(double); /**< pointer to a second derivative evaluation */
83 double (*safevalue)(double,enum safe_err *); /**< pointer to function evaluation */
84 double (*safederiv)(double,enum safe_err *); /**< pointer to derivative evaluation */
85 double (*safederiv2)(double,enum safe_err *); /**< pointer to a second derivative evaluation */
86 #ifdef CHRIS_FUNC
87 struct Interval (*ivalue)(); /**< interval evaluation of function */
88 void (*slope)(unsigned long,struct Interval *,struct Interval *,
89 struct Interval *); /**< pointer to slope evaluation routine */
90 struct Interval (*ideriv)(struct Interval);
91 /**< interval derivative evaluation routine */
92 double (*tmin)(double,double); /**< return the point where the func is a min */
93 double (*tmax)(double,double); /**< return the point where the func is a max */
94 double (*e)(double,double,double,double (*)(double)); /**< convex envelope */
95 double (*ed)(double,double,double,double (*)(double)); /**< convex envelope derivative */
96 double (*E)(double,double,double,double (*)(double)); /**< concave envelope */
97 double (*Ed)(double,double,double,double (*)(double)); /**< concave envelope derivative */
98 #endif
99 };
100
101 #endif /* ASC_FUNCTYPE_H */
102

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