KiCad PCB EDA Suite
numeric_evaluator.cpp File Reference
#include <libeval/numeric_evaluator.h>
#include "grammar.c"
#include "grammar.h"

Go to the source code of this file.


struct  numEval::VECTOR2_TRAITS< T >
 Class VECTOR2_TRAITS traits class for VECTOR2. More...
struct  numEval::VECTOR2_TRAITS< int >
class  numEval::VECTOR2< T >
 Class VECTOR2 defines a general 2D-vector/point. More...
class  numEval::VECTOR2< T >
 Class VECTOR2 defines a general 2D-vector/point. More...
class  numEval::UTF8
 Class UTF8 is an 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and from wxString, to and from std::string, and has non-mutating iteration over unicode characters. More...
class  numEval::UTF8::uni_iter
 class uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string. More...
class  numEval::KI_PARAM_ERROR
 class KI_PARAM_ERROR is a class used to hold a translatable error message and may be used when throwing exceptions containing a translated error message. More...
class  numEval::IO_ERROR
 Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions containing meaningful error messages. More...
struct  numEval::PARSE_ERROR
 Struct PARSE_ERROR contains a filename or source description, a problem input line, a line number, a byte offset, and an error message which contains the the caller's report and his call site information: CPP source file, function, and line number. More...
struct  numEval::FUTURE_FORMAT_ERROR
 Struct FUTURE_FORMAT_ERROR variant of PARSE_ERROR indicating that a syntax or related error was likely caused by a file generated by a newer version of KiCad than this. More...
class  numEval::LINE_READER
 Class LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to read single lines of text and manage a line number counter. More...
class  numEval::FILE_LINE_READER
 Class FILE_LINE_READER is a LINE_READER that reads from an open file. More...
class  numEval::STRING_LINE_READER
 Class STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string. More...
 Class INPUTSTREAM_LINE_READER is a LINE_READER that reads from a wxInputStream object. More...
 Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a convenient way. More...
class  numEval::STRING_FORMATTER
 Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer. More...
 Class FILE_OUTPUTFORMATTER may be used for text file output. More...
 Class STREAM_OUTPUTFORMATTER implements OUTPUTFORMATTER to a wxWidgets wxOutputStream. More...
struct  numEval::StructColors
class  numEval::KIGFX::COLOR4D
 Class COLOR4D is the color representation with 4 components: red, green, blue, alpha. More...
class  numEval::LOCALE_IO
 Instantiate the current locale within a scope in which you are expecting exceptions to be thrown. More...
struct  numEval::std::hash< wxString >
struct  numEval::std::hash< wxPoint >
struct  numEval::std::less< wxPoint >
class  numEval::WX_FILENAME
 A wrapper around a wxFileName which is much more performant with a subset of the API. More...
struct  numEval::numEval::TokenType
struct  numEval::NUMERIC_EVALUATOR::Token
struct  numEval::NUMERIC_EVALUATOR::TokenStat
union  numEval::YYMINORTYPE
struct  numEval::yyStackEntry
struct  numEval::yyParser



Template specialization to enable wxStrings for certain containers (e.g. unordered_map)



typedef VECTOR2< double > numEval::VECTOR2D
typedef VECTOR2< int > numEval::VECTOR2I
typedef VECTOR2< unsigned int > numEval::VECTOR2U
typedef VECTOR2< double > numEval::DPOINT
typedef DPOINT numEval::DSIZE
typedef uint32_t numEval::timestamp_t
 timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the timestamp when they were created. More...
typedef uint32_t numEval::EDA_KEY
typedef struct yyStackEntry numEval::yyStackEntry
typedef struct yyParser numEval::yyParser


enum  numEval::EDA_COLOR_T {
  numEval::UNSPECIFIED_COLOR = -1, numEval::BLACK = 0, numEval::DARKDARKGRAY, numEval::DARKGRAY,
  numEval::LIGHTGRAY, numEval::WHITE, numEval::LIGHTYELLOW, numEval::DARKBLUE,
  numEval::DARKGREEN, numEval::DARKCYAN, numEval::DARKRED, numEval::DARKMAGENTA,
  numEval::DARKBROWN, numEval::BLUE, numEval::GREEN, numEval::CYAN,
  numEval::RED, numEval::MAGENTA, numEval::BROWN, numEval::LIGHTBLUE,
  numEval::YELLOW, numEval::PUREBLUE, numEval::PUREGREEN, numEval::PURECYAN,
  numEval::PURERED, numEval::PUREMAGENTA, numEval::PUREYELLOW, numEval::NBCOLORS,
  numEval::HIGHLIGHT_FLAG = ( 1<<19 ), numEval::MASKCOLOR = 31
 The color enumeration. More...
enum  numEval::pseudokeys {
 Pseudo key codes for command panning. More...
enum  numEval::EDA_UNITS_T {
  numEval::INCHES = 0, numEval::MILLIMETRES = 1, numEval::UNSCALED_UNITS = 2, numEval::DEGREES = 3,
  numEval::PERCENT = 4


template<typename T >
numEval::rescale (T aNumerator, T aValue, T aDenominator)
 Function rescale() More...
template<typename T >
int numEval::sign (T val)
int numEval::rescale (int aNumerator, int aValue, int aDenominator)
int64_t numEval::rescale (int64_t aNumerator, int64_t aValue, int64_t aDenominator)
static int numEval::round_nearest (double v)
template<class T >
std::ostream & numEval::operator<< (std::ostream &aStream, const VECTOR2< T > &aVector)
template<class T >
VECTOR2< T > numEval::operator * (const T &aFactor, const VECTOR2< T > &aVector)
template<class T >
const VECTOR2< T > numEval::LexicographicalMax (const VECTOR2< T > &aA, const VECTOR2< T > &aB)
template<class T >
const VECTOR2< T > numEval::LexicographicalMin (const VECTOR2< T > &aA, const VECTOR2< T > &aB)
template<class T >
const int numEval::LexicographicalCompare (const VECTOR2< T > &aA, const VECTOR2< T > &aB)
bool numEval::IsUTF8 (const char *aString)
 Function IsUTF8 tests a c-string to see if it is UTF8 encoded. More...
int numEval::StrPrintf (std::string *aResult, const char *aFormat,...)
 Function StrPrintf is like sprintf() but the output is appended to a std::string instead of to a character array. More...
std::string numEval::StrPrintf (const char *format,...)
 Function StrPrintf is like sprintf() but the output is returned in a std::string instead of to a character array. More...
EDA_COLOR_T numEval::ColorFromInt (int aColor)
 Checked cast. Use only when necessary (usually I/O) More...
EDA_COLOR_T numEval::NextColor (EDA_COLOR_T &aColor)
EDA_COLOR_T numEval::ColorGetBase (EDA_COLOR_T aColor)
 Return only the plain color part. More...
EDA_COLOR_T numEval::ColorMix (EDA_COLOR_T aColor1, EDA_COLOR_T aColor2)
 Mix two colors in some way (hopefully like a logical OR) More...
void numEval::ColorTurnToDarkDarkGray (EDA_COLOR_T *aColor)
 Force the color part of a color to darkdarkgray. More...
void numEval::ColorChangeHighlightFlag (EDA_COLOR_T *aColor, bool flag)
void numEval::SetAlpha (EDA_COLOR_T *aColor, unsigned char aBlend)
 Function SetAlpha ORs in the alpha blend parameter in to a color index. More...
unsigned char numEval::GetAlpha (EDA_COLOR_T aColor)
 Function GetAlpha returns the alpha blend parameter from a color index. More...
void numEval::ColorApplyHighlightFlag (EDA_COLOR_T *aColor)
 Step a color to the highlighted version if the highlight flag is set. More...
EDA_COLOR_T numEval::ColorByName (const wxString &aName)
 Find a color by name. More...
EDA_COLOR_T numEval::ColorFindNearest (const wxColour &aColor)
 Find the nearest color match. More...
EDA_COLOR_T numEval::ColorFindNearest (int aR, int aG, int aB)
 Find the nearest color match. More...
bool numEval::ColorIsLight (EDA_COLOR_T aColor)
 Check if a color is light i.e. More...
const wxChar * numEval::ColorGetName (EDA_COLOR_T aColor)
void numEval::ColorSetBrush (wxBrush *aBrush, EDA_COLOR_T aColor)
wxColour numEval::MakeColour (EDA_COLOR_T aColor)
 Function MakeColour returns a wxWidgets wxColor from a KiCad color index with alpha value. More...
const bool numEval::KIGFX::operator== (const COLOR4D &lhs, const COLOR4D &rhs)
 Equality operator, are two colors equal. More...
const bool numEval::KIGFX::operator!= (const COLOR4D &lhs, const COLOR4D &rhs)
 Not equality operator, are two colors not equal. More...
std::ostream & numEval::KIGFX::operator<< (std::ostream &aStream, COLOR4D const &aColor)
 Syntactic sugar for outputting colors to strings. More...
template<typename fp_type , typename ret_type = int>
constexpr ret_type numEval::KiROUND (fp_type v)
 Round a floating point number to an integer using "round halfway cases away from zero". More...
wxSize numEval::GetTextSize (const wxString &aSingleLine, wxWindow *aWindow)
 Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currently set in that window. More...
bool numEval::EnsureTextCtrlWidth (wxTextCtrl *aCtrl, const wxString *aString=NULL)
 Set the minimum pixel width on a text control in order to make a text string be fully visible within it. More...
void numEval::SelectReferenceNumber (wxTextEntry *aTextEntry)
 Select the number (or "?") in a reference for ease of editing. More...
int numEval::ProcessExecute (const wxString &aCommandLine, int aFlags=wxEXEC_ASYNC, wxProcess *callback=NULL)
 Run a command in a child process. More...
timestamp_t numEval::GetNewTimeStamp ()
int numEval::GetCommandOptions (const int argc, const char **argv, const char *stringtst, const char **optarg, int *optind)
double numEval::RoundTo0 (double x, double precision)
 Round to the nearest precision. More...
void numEval::wxStringSplit (const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
 Split aString to a string list separated at aSplitter. More...
wxString numEval::SearchHelpFileFullPath (const SEARCH_STACK &aSearchStack, const wxString &aBaseName)
 Return the help file's full path. More...
bool numEval::EnsureFileDirectoryExists (wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter=NULL)
 Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist. More...
const wxString numEval::PrePendPath (const wxString &aEnvVar, const wxString &aPriorityPath)
 Put aPriorityPath in front of all paths in the value of aEnvVar. More...
std::unique_ptr< wxConfigBase > numEval::GetNewConfig (const wxString &aProgName)
 Create a new wxConfig so we can put configuration files in a more proper place for each platform. More...
wxString numEval::GetKicadConfigPath ()
 Return the user configuration path used to store KiCad's configuration files. More...
const wxString numEval::ExpandEnvVarSubstitutions (const wxString &aString)
 Replace any environment variable references with their values. More...
const wxString numEval::ResolveUriByEnvVars (const wxString &aUri)
 Replace any environment variables in file-path uris (leaving network-path URIs alone). More...
std::ostream & numEval::operator<< (std::ostream &out, const wxSize &size)
 Helper function to print the given wxSize to a stream. More...
std::ostream & numEval::operator<< (std::ostream &out, const wxPoint &pt)
 Helper function to print the given wxPoint to a stream. More...
long long numEval::TimestampDir (const wxString &aDirPath, const wxString &aFilespec)
 A copy of ConvertFileTimeToWx() because wxWidgets left it as a static function private to src/common/filename.cpp. More...
int numEval::Mm2mils (double x)
 Convert mm to mils. More...
int numEval::Mils2mm (double x)
 Convert mils to mm. More...
std::string numEval::Double2Str (double aValue)
 Helper function Double2Str to print a float number without using scientific notation and no trailing 0 We want to avoid scientific notation in S-expr files (not easy to read) for floating numbers. More...
void numEval::StripTrailingZeros (wxString &aStringValue, unsigned aTrailingZeroAllowed=1)
 Function StripTrailingZeros Remove trailing 0 from a string containing a converted float number. More...
double numEval::To_User_Unit (EDA_UNITS_T aUnit, double aValue, bool aUseMils=false)
 Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit. More...
wxString numEval::AngleToStringDegrees (double aAngle)
 Function AngleToStringDegrees is a helper to convert the double aAngle (in internal unit) to a string in degrees. More...
wxString numEval::MessageTextFromValue (EDA_UNITS_T aUnits, double aValue, bool aUseMils=false)
 Function MessageTextFromValue is a helper to convert the double length aValue to a string in inches, millimeters, or unscaled units. More...
wxString numEval::MessageTextFromValue (EDA_UNITS_T aUnits, int aValue, bool aUseMils=false)
wxString numEval::MessageTextFromValue (EDA_UNITS_T aUnits, long long int aValue, bool aUseMils=false)
wxString numEval::StringFromValue (EDA_UNITS_T aUnit, double aValue, bool aAddUnitSymbol=false, bool aUseMils=false)
 Function StringFromValue returns the string from aValue according to units (inch, mm ...) for display, and the initial unit for value. More...
double numEval::From_User_Unit (EDA_UNITS_T aUnit, double aValue, bool aUseMils=false)
 Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg". More...
double numEval::DoubleValueFromString (EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils=false)
 Function DoubleValueFromString converts aTextValue to a double. More...
long long int numEval::ValueFromString (EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils=false)
 Function ValueFromString converts aTextValue in aUnits to internal units used by the application. More...
void numEval::FetchUnitsFromString (const wxString &aTextValue, EDA_UNITS_T &aUnits, bool &aUseMils)
 Function FetchUnitsFromString writes any unit info found in the string to aUnits and aUseMils. More...
wxString numEval::GetAbbreviatedUnitsLabel (EDA_UNITS_T aUnit, bool aUseMils=false)
 Get the units string for a given units type. More...
std::string numEval::FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from internal units to a string appropriate for writing to file. More...
std::string numEval::FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. More...
std::string numEval::FormatInternalUnits (const wxPoint &aPoint)
std::string numEval::FormatInternalUnits (const wxSize &aSize)
std::string numEval::FormatInternalUnits (const VECTOR2I &aPoint)
void numEval::ParseTrace (FILE *TraceFILE, char *zTracePrompt)
void * numEval::ParseAlloc (void *(*mallocProc)(size_t))
static void numEval::yy_destructor (yyParser *yypParser, YYCODETYPE yymajor, YYMINORTYPE *yypminor)
static int numEval::yy_pop_parser_stack (yyParser *pParser)
void numEval::ParseFree (void *p, void(*freeProc)(void *))
static int numEval::yy_find_shift_action (yyParser *pParser, YYCODETYPE iLookAhead)
static int numEval::yy_find_reduce_action (int stateno, YYCODETYPE iLookAhead)
static void numEval::yyStackOverflow (yyParser *yypParser, YYMINORTYPE *yypMinor)
static void numEval::yy_shift (yyParser *yypParser, int yyNewState, int yyMajor, YYMINORTYPE *yypMinor)
static void numEval::yy_accept (yyParser *)
static void numEval::yy_reduce (yyParser *yypParser, int yyruleno)
static void numEval::yy_parse_failed (yyParser *yypParser)
static void numEval::yy_syntax_error (yyParser *yypParser, int yymajor, YYMINORTYPE yyminor)
void numEval::Parse (void *yyp, int yymajor, ParseTOKENTYPE yyminor ParseARG_PDECL)


const StructColors numEval::g_ColorRefs [NBCOLORS]
 list of existing Colors More...
KIGFX::COLOR4D numEval::g_GhostColor
 Draw color for moving objects. More...
static const YYMINORTYPE numEval::yyzerominor = { 0 }
static const YYACTIONTYPE numEval::yy_action []
static const YYCODETYPE numEval::yy_lookahead []
static const signed char numEval::yy_shift_ofst []
static const signed char numEval::yy_reduce_ofst []
static const YYACTIONTYPE numEval::yy_default []
static FILE * numEval::yyTraceFILE = 0
static char * numEval::yyTracePrompt = 0
static const char *const numEval::yyTokenName []
static const char *const numEval::yyRuleName []
struct {
   YYCODETYPE   numEval::lhs
   unsigned char   numEval::nrhs
numEval::yyRuleInfo []