EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
postfix.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * SPDX-License-Identifier: EPICS
7 * EPICS BASE is distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
20 #ifndef INCpostfixh
21 #define INCpostfixh
22 
23 #include "libComAPI.h"
24 
26 #define CALCPERFORM_NARGS 12
27 
28 #define CALCPERFORM_STACK 80
29 
59 #define INFIX_TO_POSTFIX_SIZE(n) ((n)*21/6)
60 
66 #define MAX_INFIX_SIZE 100
67 
72 #define MAX_POSTFIX_SIZE INFIX_TO_POSTFIX_SIZE(MAX_INFIX_SIZE)
73 
82 #define CALC_ERR_NONE 0
83 
84 #define CALC_ERR_TOOMANY 1
85 
86 #define CALC_ERR_BAD_LITERAL 2
87 
88 #define CALC_ERR_BAD_ASSIGNMENT 3
89 
90 #define CALC_ERR_BAD_SEPERATOR 4
91 
92 #define CALC_ERR_PAREN_NOT_OPEN 5
93 
94 #define CALC_ERR_PAREN_OPEN 6
95 
96 #define CALC_ERR_CONDITIONAL 7
97 
98 #define CALC_ERR_INCOMPLETE 8
99 
100 #define CALC_ERR_UNDERFLOW 9
101 
102 #define CALC_ERR_OVERFLOW 10
103 
104 #define CALC_ERR_SYNTAX 11
105 
106 #define CALC_ERR_NULL_ARG 12
107 
108 #define CALC_ERR_INTERNAL 13
109 
112 #ifdef __cplusplus
113 extern "C" {
114 #endif
115 
299 LIBCOM_API long
300  postfix(const char *pinfix, char *ppostfix, short *perror);
301 
314 LIBCOM_API long
315  calcPerform(double *parg, double *presult, const char *ppostfix);
316 
341 LIBCOM_API long
342  calcArgUsage(const char *ppostfix, unsigned long *pinputs, unsigned long *pstores);
343 
351 LIBCOM_API const char *
352  calcErrorStr(short error);
353 
359 LIBCOM_API void
360  calcExprDump(const char *pinst);
361 
362 #ifdef __cplusplus
363 }
364 #endif
365 
366 #endif /* INCpostfixh */
LIBCOM_API const char * calcErrorStr(short error)
Convert an error code to a string.
LIBCOM_API void calcExprDump(const char *pinst)
Disassemble a postfix expression.
LIBCOM_API long calcArgUsage(const char *ppostfix, unsigned long *pinputs, unsigned long *pstores)
Find the inputs and outputs of an expression.
LIBCOM_API long calcPerform(double *parg, double *presult, const char *ppostfix)
Run the calculation engine.
LIBCOM_API long postfix(const char *pinfix, char *ppostfix, short *perror)
Compile an infix expression into postfix byte-code.