aafc09463716efd43e42ec4d35ebc74a38549e2a
[oweals/cde.git] / cde / programs / dtksh / ksh93 / src / cmd / ksh93 / include / streval.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: streval.h /main/3 1995/11/01 16:43:32 rswiston $ */
24 /***************************************************************
25 *                                                              *
26 *                      AT&T - PROPRIETARY                      *
27 *                                                              *
28 *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF        *
29 *                    AT&T BELL LABORATORIES                    *
30 *         AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN         *
31 *            ACCORDANCE WITH APPLICABLE AGREEMENTS             *
32 *                                                              *
33 *                Copyright (c) 1995 AT&T Corp.                 *
34 *              Unpublished & Not for Publication               *
35 *                     All Rights Reserved                      *
36 *                                                              *
37 *       The copyright notice above does not evidence any       *
38 *      actual or intended publication of such source code      *
39 *                                                              *
40 *               This software was created by the               *
41 *           Advanced Software Technology Department            *
42 *                    AT&T Bell Laboratories                    *
43 *                                                              *
44 *               For further information contact                *
45 *                    {research,attmail}!dgk                    *
46 *                                                              *
47 ***************************************************************/
48
49 /* : : generated by proto : : */
50                   
51 #ifndef SEQPOINT
52 #if !defined(__PROTO__)
53 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
54 #if defined(__cplusplus)
55 #define __MANGLE__      "C"
56 #else
57 #define __MANGLE__
58 #endif
59 #define __STDARG__
60 #define __PROTO__(x)    x
61 #define __OTORP__(x)
62 #define __PARAM__(n,o)  n
63 #if !defined(__STDC__) && !defined(__cplusplus)
64 #if !defined(c_plusplus)
65 #define const
66 #endif
67 #define signed
68 #define void            int
69 #define volatile
70 #define __V_            char
71 #else
72 #define __V_            void
73 #endif
74 #else
75 #define __PROTO__(x)    ()
76 #define __OTORP__(x)    x
77 #define __PARAM__(n,o)  o
78 #define __MANGLE__
79 #define __V_            char
80 #define const
81 #define signed
82 #define void            int
83 #define volatile
84 #endif
85 #if defined(__cplusplus) || defined(c_plusplus)
86 #define __VARARG__      ...
87 #else
88 #define __VARARG__
89 #endif
90 #if defined(__STDARG__)
91 #define __VA_START__(p,a)       va_start(p,a)
92 #else
93 #define __VA_START__(p,a)       va_start(p)
94 #endif
95 #endif
96
97 /*
98  * G. S. Fowler
99  * D. G. Korn
100  * AT&T Bell Laboratories
101  *
102  * long integer arithmetic expression evaluator
103  */
104
105 /* The following only is needed for const */
106 #include        <ast.h>
107 #include        <math.h>
108
109 struct lval
110 {
111         char    *value;
112         double  (*fun) __PROTO__((double));
113         short   flag;
114         char    isfloat;
115 };
116
117 struct mathtab
118 {
119         char    fname[4];
120         double  (*fnptr) __PROTO__((double));
121 };
122
123 #define MAXPREC         15      /* maximum precision level */
124 #define SEQPOINT        0200    /* sequence point */
125 #define NOASSIGN        0100    /* assignment legal with this operator */
126 #define RASSOC          040     /* right associative */
127 #define NOFLOAT         020     /* illegal with floating point */
128 #define PRECMASK        017     /* precision bit mask */
129
130 #define A_EOF           1
131 #define A_NEQ           2
132 #define A_NOT           3
133 #define A_MOD           4
134 #define A_ANDAND        5
135 #define A_AND           6
136 #define A_LPAR          7
137 #define A_RPAR          8
138 #define A_TIMES         9
139 #define A_PLUSPLUS      10
140 #define A_PLUS          11
141 #define A_COMMA         12
142 #define A_MINUSMINUS    13
143 #define A_MINUS         14
144 #define A_DIV           15
145 #define A_LSHIFT        16
146 #define A_LE            17
147 #define A_LT            18
148 #define A_EQ            19
149 #define A_ASSIGN        20
150 #define A_COLON         21
151 #define A_RSHIFT        22
152 #define A_GE            23
153 #define A_GT            24
154 #define A_QCOLON        25
155 #define A_QUEST         26
156 #define A_XOR           27
157 #define A_OROR          28
158 #define A_OR            29
159 #define A_REG           30
160 #define A_DIG           31
161 #define A_DOT           32
162
163
164 /* define error messages */
165 extern __MANGLE__ const unsigned char   strval_precedence[33];
166 extern __MANGLE__ const char            strval_states[64];
167 extern __MANGLE__ const char            e_moretokens[];
168 extern __MANGLE__ const char            e_paren[];
169 extern __MANGLE__ const char            e_badnum[];
170 extern __MANGLE__ const char            e_badcolon[];
171 extern __MANGLE__ const char            e_recursive[];
172 extern __MANGLE__ const char            e_divzero[];
173 extern __MANGLE__ const char            e_synbad[];
174 extern __MANGLE__ const char            e_notlvalue[];
175 extern __MANGLE__ const char            e_function[];
176 extern __MANGLE__ const char            e_questcolon[];
177 extern __MANGLE__ const char            e_incompatible[];
178 extern __MANGLE__ const char            e_domain[];
179 extern __MANGLE__ const char            e_overflow[];
180 extern __MANGLE__ const char            e_singularity[];
181 extern __MANGLE__ const struct          mathtab shtab_math[];
182
183 /* function code for the convert function */
184
185 #define LOOKUP  0
186 #define ASSIGN  1
187 #define VALUE   2
188 #define ERRMSG  3
189
190 extern __MANGLE__ double strval __PROTO__((const char*,char**,double(*)(const char**,struct lval*,int,double)));
191
192 #endif /* !SEQPOINT */