![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "osiUnistd.h"
#include "dbDefs.h"
#include "epicsMath.h"
#include "epicsTypes.h"
#include "errlog.h"
#include "postfix.h"
#include "postfixPvt.h"
Go to the source code of this file.
Macros | |
#define | PI 3.14159265358979323 |
#define | d2i(x) ((x)<0?(epicsInt32)(x):(epicsInt32)(epicsUInt32)(x)) |
#define | d2ui(x) ((x)<0?(epicsUInt32)(epicsInt32)(x):(epicsUInt32)(x)) |
Functions | |
LIBCOM_API long | calcPerform (double *parg, double *presult, const char *pinst) |
Run the calculation engine. More... | |
LIBCOM_API long | calcArgUsage (const char *pinst, unsigned long *pinputs, unsigned long *pstores) |
Find the inputs and outputs of an expression. More... | |
#define d2i | ( | x | ) | ((x)<0?(epicsInt32)(x):(epicsInt32)(epicsUInt32)(x)) |
#define d2ui | ( | x | ) | ((x)<0?(epicsUInt32)(epicsInt32)(x):(epicsUInt32)(x)) |
#define PI 3.14159265358979323 |
Definition at line 32 of file calcPerform.c.
LIBCOM_API long calcArgUsage | ( | const char * | ppostfix, |
unsigned long * | pinputs, | ||
unsigned long * | pstores | ||
) |
Find the inputs and outputs of an expression.
Software using the calc subsystem may need to know what expression arguments are used and/or modified by a particular expression. It can discover this from the postfix string by calling calcArgUsage(), which takes two pointers pinputs
and pstores
to a pair of unsigned long bitmaps which return that information to the caller. Passing a NULL value for either of these pointers is legal if only the other is needed.
The least signficant bit (bit 0) of the bitmap at *pinputs
will be set if the expression depends on the argument A, and so on through bit 11 for the argument L. An argument that is not used until after a value has been assigned to it will not be set in the pinputs bitmap, thus the bits can be used to determine whether a value needs to be supplied for their associated argument or not for the purposes of evaluating the expression.
Bit 0 of the bitmap at *pstores
will be set if the expression assigns a value to the argument A, bit 1 for argument B etc.
ppostfix | A postfix expression created by postfix(). |
pinputs | Bitmap pointer. |
pstores | Bitmap pointer. |
Definition at line 405 of file calcPerform.c.
LIBCOM_API long calcPerform | ( | double * | parg, |
double * | presult, | ||
const char * | ppostfix | ||
) |
Run the calculation engine.
Evaluates the postfix expression against a set ot input values.
parg | Pointer to an array of double values for the arguments A-L that can appear in the expression. Note that the argument values may be modified if the expression uses the assignment operator. |
presult | Where to put the calculated result, which may be a NaN or Infinity. |
ppostfix | The postfix expression created by postfix(). |
Definition at line 45 of file calcPerform.c.