AMU Library 3.0
C/C++ library for communicating with AMU (Aerospace Measurement Unit) devices
Loading...
Searching...
No Matches
expression.c File Reference

Expressions handling. More...

#include "expression.h"
#include "error.h"
#include "parser.h"
#include "lexer_private.h"

Go to the source code of this file.

Functions

static scpi_expr_result_t numericRange (lex_state_t *state, scpi_bool_t *isRange, scpi_token_t *valueFrom, scpi_token_t *valueTo)
scpi_expr_result_t SCPI_ExprNumericListEntry (scpi_t *context, scpi_parameter_t *param, int index, scpi_bool_t *isRange, scpi_parameter_t *valueFrom, scpi_parameter_t *valueTo)
scpi_expr_result_t SCPI_ExprNumericListEntryInt (scpi_t *context, scpi_parameter_t *param, int index, scpi_bool_t *isRange, int32_t *valueFrom, int32_t *valueTo)
scpi_expr_result_t SCPI_ExprNumericListEntryDouble (scpi_t *context, scpi_parameter_t *param, int index, scpi_bool_t *isRange, double *valueFrom, double *valueTo)
static scpi_expr_result_t channelSpec (scpi_t *context, lex_state_t *state, int32_t *values, size_t length, size_t *dimensions)
static scpi_expr_result_t channelRange (scpi_t *context, lex_state_t *state, scpi_bool_t *isRange, int32_t *valuesFrom, int32_t *valuesTo, size_t length, size_t *dimensions)
scpi_expr_result_t SCPI_ExprChannelListEntry (scpi_t *context, scpi_parameter_t *param, int index, scpi_bool_t *isRange, int32_t *valuesFrom, int32_t *valuesTo, size_t length, size_t *dimensions)

Detailed Description

Expressions handling.

Definition in file expression.c.

Function Documentation

◆ channelRange()

scpi_expr_result_t channelRange ( scpi_t * context,
lex_state_t * state,
scpi_bool_t * isRange,
int32_t * valuesFrom,
int32_t * valuesTo,
size_t length,
size_t * dimensions )
static

Parse channel_range e.g. "1!2:5!6"

Parameters
context
statelexer state
isRangereturn true if it is range
valuesFromreturn array of values from
valuesToreturn array of values to
lengthlength of values arrays
dimensionsreal number of dimensions

Definition at line 225 of file expression.c.

◆ channelSpec()

scpi_expr_result_t channelSpec ( scpi_t * context,
lex_state_t * state,
int32_t * values,
size_t length,
size_t * dimensions )
static

Parse one channel_spec e.g. "1!5!8"

Parameters
context
statelexer state
valuesrange values
lengthlength of values array
dimensionsreal number of dimensions

Definition at line 191 of file expression.c.

◆ numericRange()

scpi_expr_result_t numericRange ( lex_state_t * state,
scpi_bool_t * isRange,
scpi_token_t * valueFrom,
scpi_token_t * valueTo )
static

Parse one range or single value

Parameters
statelexer state
isRangereturn true if parsed expression is range
valueFromreturn parsed value from
valueToreturn parsed value to
Returns
SCPI_EXPR_OK - parsing was succesful SCPI_EXPR_ERROR - parser error SCPI_EXPR_NO_MORE - no more data

Definition at line 52 of file expression.c.

◆ SCPI_ExprChannelListEntry()

scpi_expr_result_t SCPI_ExprChannelListEntry ( scpi_t * context,
scpi_parameter_t * param,
int index,
scpi_bool_t * isRange,
int32_t * valuesFrom,
int32_t * valuesTo,
size_t length,
size_t * dimensions )

Parse one list entry at specific position e.g. "1!2:5!6"

Parameters
context
param
index
isRangereturn true if it is range
valuesFromreturn array of values from
valuesToreturn array of values to
lengthlength of values arrays
dimensionsreal number of dimensions

Definition at line 266 of file expression.c.

◆ SCPI_ExprNumericListEntry()

scpi_expr_result_t SCPI_ExprNumericListEntry ( scpi_t * context,
scpi_parameter_t * param,
int index,
scpi_bool_t * isRange,
scpi_parameter_t * valueFrom,
scpi_parameter_t * valueTo )

Parse entry on specified position

Parameters
contextscpi context
paraminput parameter
indexindex of position (start from 0)
isRangereturn true if expression at index was range
valueFromreturn value from
valueToreturn value to
Returns
SCPI_EXPR_OK - parsing was succesful SCPI_EXPR_ERROR - parser error SCPI_EXPR_NO_MORE - no more data
See also
SCPI_ExprNumericListEntryInt, SCPI_ExprNumericListEntryDouble

Definition at line 83 of file expression.c.

◆ SCPI_ExprNumericListEntryDouble()

scpi_expr_result_t SCPI_ExprNumericListEntryDouble ( scpi_t * context,
scpi_parameter_t * param,
int index,
scpi_bool_t * isRange,
double * valueFrom,
double * valueTo )

Parse entry on specified position and convert result to double

Parameters
contextscpi context
paraminput parameter
indexindex of position (start from 0)
isRangereturn true if expression at index was range
valueFromreturn value from
valueToreturn value to
Returns
SCPI_EXPR_OK - parsing was succesful SCPI_EXPR_ERROR - parser error SCPI_EXPR_NO_MORE - no more data
See also
SCPI_ExprNumericListEntry, SCPI_ExprNumericListEntryInt

Definition at line 165 of file expression.c.

◆ SCPI_ExprNumericListEntryInt()

scpi_expr_result_t SCPI_ExprNumericListEntryInt ( scpi_t * context,
scpi_parameter_t * param,
int index,
scpi_bool_t * isRange,
int32_t * valueFrom,
int32_t * valueTo )

Parse entry on specified position and convert result to int32_t

Parameters
contextscpi context
paraminput parameter
indexindex of position (start from 0)
isRangereturn true if expression at index was range
valueFromreturn value from
valueToreturn value to
Returns
SCPI_EXPR_OK - parsing was succesful SCPI_EXPR_ERROR - parser error SCPI_EXPR_NO_MORE - no more data
See also
SCPI_ExprNumericListEntry, SCPI_ExprNumericListEntryDouble

Definition at line 134 of file expression.c.