KiCad PCB EDA Suite
Loading...
Searching...
No Matches
am_param.cpp File Reference
#include <am_param.h>
#include <am_primitive.h>
#include <aperture_macro.h>
#include <macros.h>

Go to the source code of this file.

Functions

int ReadInt (char *&text, bool aSkipSeparator=true)
 Read an integer from an ASCII character buffer.
 
double ReadDouble (char *&text, bool aSkipSeparator=true)
 Read a double precision floating point number from an ASCII character buffer.
 
double Evaluate (AM_PARAM_EVAL_STACK &aExp)
 Evaluate an basic arithmetic expression (infix notation) with precedence The expression is a sequence of numbers (double) and arith operators: operators are + - x / ( and ) the expression is stored in a std::vector each item is a AM_PARAM_EVAL (each item is an operator or a double)
 

Function Documentation

◆ Evaluate()

double Evaluate ( AM_PARAM_EVAL_STACK aExp)

Evaluate an basic arithmetic expression (infix notation) with precedence The expression is a sequence of numbers (double) and arith operators: operators are + - x / ( and ) the expression is stored in a std::vector each item is a AM_PARAM_EVAL (each item is an operator or a double)

Parameters
aExp= the arithmetic expression to evaluate
Returns
the value

Definition at line 102 of file evaluate.cpp.

References ADD, CLOSE_PAR, DIV, AM_PARAM_EVAL::GetOperator(), AM_PARAM_EVAL::GetPriority(), AM_PARAM_EVAL::GetValue(), AM_PARAM_EVAL::IsOperator(), MUL, OPEN_PAR, POPVALUE, and SUB.

Referenced by AM_PARAM::GetValueFromMacro().

◆ ReadDouble()

double ReadDouble ( char *&  text,
bool  aSkipSeparator = true 
)

Read a double precision floating point number from an ASCII character buffer.

If there is a comma after the number, then skip over that.

Parameters
textis a reference to a character pointer from which the ASCII double is read from and the pointer advanced for each character read.
aSkipSeparatorset to true (default) to skip comma.
Returns
number read.

Definition at line 303 of file rs274_read_XY_and_IJ_coordinates.cpp.

References text.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), AM_PARAM::ReadParamFromAmDef(), and EXCELLON_IMAGE::readToolInformation().

◆ ReadInt()

int ReadInt ( char *&  text,
bool  aSkipSeparator = true 
)

Read an integer from an ASCII character buffer.

If there is a comma after the integer, then skip over that.

Parameters
textis a reference to a character pointer from which bytes are read and the pointer is advanced for each byte read.
aSkipSeparatorset to true (default) to skip comma.
Returns
The integer read in.

Definition at line 266 of file rs274_read_XY_and_IJ_coordinates.cpp.

References text.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GERBER_FILE_IMAGE::ReadApertureMacro(), AM_PARAM::ReadParamFromAmDef(), and EXCELLON_IMAGE::readToolInformation().