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.


class  numEval::UTF8
 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
 uni_iter is a non-mutating iterator that walks through unicode code points in the UTF8 encoded string. More...
class  numEval::KI_PARAM_ERROR
 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
 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
 FILE_LINE_READER is a LINE_READER that reads from an open file. More...
class  numEval::STRING_LINE_READER
 STRING_LINE_READER is a LINE_READER that reads from a multiline 8 bit wide std::string. More...
 INPUTSTREAM_LINE_READER is a LINE_READER that reads from a wxInputStream object. More...
 OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a convenient way. More...
class  numEval::STRING_FORMATTER
 STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer. More...
 FILE_OUTPUTFORMATTER may be used for text file output. More...
 STREAM_OUTPUTFORMATTER implements OUTPUTFORMATTER to a wxWidgets wxOutputStream. More...
struct  numEval::StructColors
class  numEval::KIGFX::COLOR4D
 COLOR4D is the color representation with 4 components: red, green, blue, alpha. More...
class  numEval::KIID
class  numEval::KIID_PATH
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 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 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
 Legacy color enumeration. More...
enum  numEval::EDA_DATA_TYPE { numEval::EDA_DATA_TYPE::DISTANCE = 0, numEval::EDA_DATA_TYPE::AREA = 1, numEval::EDA_DATA_TYPE::VOLUME = 2 }
 The type of unit. More...
enum  numEval::EDA_UNITS {
  numEval::EDA_UNITS::INCHES = 0, numEval::EDA_UNITS::MILLIMETRES = 1, numEval::EDA_UNITS::UNSCALED = 2, numEval::EDA_UNITS::DEGREES = 3,
  numEval::EDA_UNITS::PERCENT = 4


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...
const StructColorsnumEval::colorRefs ()
 Global list of legacy color names, still used all over the place for constructing COLOR4D's. 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...
const bool numEval::KIGFX::operator< (const COLOR4D &lhs, const COLOR4D &rhs)
std::ostream & numEval::KIGFX::operator<< (std::ostream &aStream, COLOR4D const &aColor)
 Syntactic sugar for outputting colors to strings. More...
void numEval::KIGFX::to_json (nlohmann::json &aJson, const COLOR4D &aColor)
void numEval::KIGFX::from_json (const nlohmann::json &aJson, COLOR4D &aColor)
static wxString numEval::FROM_UTF8 (const char *cstring)
 function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes. More...
void numEval::AccumulateDescription (wxString &aDesc, const wxString &aItem)
 Utility to build comma separated lists in messages. More...
static const wxChar * numEval::GetChars (const wxString &s)
 Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for passing strings to wxString::Printf() and wxString::Format(). More...
template<typename T , std::size_t N>
constexpr std::size_t numEval::arrayDim (T const (&)[N]) noexcept
template<typename T >
numEval::Mirror (T aPoint, T aMirrorRef)
 Function MIRROR Mirror aPoint in aMirrorRef. More...
template<typename T >
void numEval::MIRROR (T &aPoint, const T &aMirrorRef)
KIIDnumEval::NilUuid ()
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...
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...
const wxString numEval::ExpandEnvVarSubstitutions (const wxString &aString, PROJECT *aProject)
 Replace any environment variable & text variable references with their values. More...
wxString numEval::ExpandTextVars (const wxString &aSource, const std::function< bool(wxString *)> *aLocalResolver, const PROJECT *aProject)
 Expand '${var-name}' templates in text. More...
const wxString numEval::ResolveUriByEnvVars (const wxString &aUri, PROJECT *aProject)
 Replace any environment and/or text 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 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 aUnits, double aValue, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 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 aUnits, int aValue, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
wxString numEval::MessageTextFromValue (EDA_UNITS aUnits, long long int aValue, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
wxString numEval::StringFromValue (EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol=false, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 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 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 aUnits, const wxString &aTextValue, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 Function DoubleValueFromString converts aTextValue to a double. More...
long long int numEval::ValueFromString (EDA_UNITS aUnits, const wxString &aTextValue, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 Function ValueFromString converts aTextValue in aUnits to internal units used by the application. More...
void numEval::FetchUnitsFromString (const wxString &aTextValue, EDA_UNITS &aUnits, bool &aUseMils)
 Function FetchUnitsFromString writes any unit info found in the string to aUnits and aUseMils. More...
wxString numEval::GetAbbreviatedUnitsLabel (EDA_UNITS aUnit, bool aUseMils=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
 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)


KIID numEval::niluuid
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 []