|
KiCad PCB EDA Suite
|
#include <libeval_compiler.h>
Classes | |
| struct | STACK_OVERFLOW |
Public Types | |
| using | ERROR_CALLBACK = std::function<void( const wxString& aMessage, int aOffset )> |
Public Member Functions | |
| CONTEXT () | |
| virtual | ~CONTEXT () |
| CONTEXT (const CONTEXT &)=delete | |
| CONTEXT & | operator= (const CONTEXT &)=delete |
| virtual void | Reset () |
| Release every value allocated by the previous evaluation and rewind the stack so the same CONTEXT can be reused for another Run() without being reconstructed. | |
| VALUE * | AllocValue () |
| VALUE * | StoreValue (VALUE *aValue) |
| void | Push (VALUE *aValue) |
| VALUE * | Pop () |
| VALUE * | Top () |
| Peek the top of the stack without popping (used by the short-circuit jumps). | |
| int | SP () const |
| void | ClearStack () |
| Discard operands while retaining allocated values and context settings. | |
| void | SetErrorCallback (ERROR_CALLBACK aCallback) |
| ERROR_CALLBACK | ExchangeErrorCallback (ERROR_CALLBACK aCallback) |
| Install a callback and return the previous one. | |
| bool | HasErrorCallback () |
| void | ReportError (const wxString &aErrorMsg) |
Static Public Attributes | |
| static constexpr int | STACK_CAPACITY = 100 |
Private Member Functions | |
| void | stackOverflow () |
| VALUE * | inlineValue (std::size_t aIndex) |
Private Attributes | |
| std::vector< VALUE * > | m_ownedValues |
| VALUE * | m_stack [STACK_CAPACITY] |
| int | m_stackPtr |
| unsigned char | m_inlineStorage [INLINE_VALUE_COUNT *sizeof(VALUE)] |
| std::size_t | m_inlineUsed |
| ERROR_CALLBACK | m_errorCallback |
Static Private Attributes | |
| static constexpr std::size_t | INLINE_VALUE_COUNT = 32 |
Definition at line 352 of file libeval_compiler.h.
| using LIBEVAL::CONTEXT::ERROR_CALLBACK = std::function<void( const wxString& aMessage, int aOffset )> |
Definition at line 357 of file libeval_compiler.h.
|
inline |
Definition at line 361 of file libeval_compiler.h.
References m_inlineUsed, m_ownedValues, m_stack, and m_stackPtr.
Referenced by CONTEXT(), and operator=().
|
inlinevirtual |
Definition at line 369 of file libeval_compiler.h.
References Reset().
|
inline |
Definition at line 400 of file libeval_compiler.h.
References INLINE_VALUE_COUNT, inlineValue(), m_inlineUsed, m_ownedValues, and VALUE.
Referenced by customPropertyFunc(), doIntersectsAreaFunc(), enclosedByAreaFunc(), LIBEVAL::UOP::Exec(), existsOnLayerFunc(), fromToFunc(), LIBEVAL::COMPILER::generateUCode(), getFieldFunc(), hasComponentClassFunc(), hasCustomPropertyFunc(), hasExactNetclassFunc(), hasNetChainFunc(), hasNetclassFunc(), inDiffPairFunc(), inNetChainClassFunc(), inNetChainFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), isBlindBuriedViaFunc(), isBlindVia(), isBuriedVia(), isCoupledDiffPairFunc(), isMicroVia(), isPlatedFunc(), isStackedViaFunc(), memberOfFootprintFunc(), memberOfGroupFunc(), memberOfSheetFunc(), memberOfSheetOrChildrenFunc(), Pop(), and Top().
|
inline |
Discard operands while retaining allocated values and context settings.
Definition at line 460 of file libeval_compiler.h.
References m_stackPtr.
Referenced by LIBEVAL::COMPILER::generateUCode(), and LIBEVAL::UCODE::Run().
|
inline |
Install a callback and return the previous one.
Definition at line 471 of file libeval_compiler.h.
References m_errorCallback.
Referenced by LIBEVAL::COMPILER::generateUCode().
|
inline |
Definition at line 477 of file libeval_compiler.h.
References m_errorCallback.
Referenced by BOOST_AUTO_TEST_CASE(), collidesWithArea(), customPropertyFunc(), doIntersectsAreaFunc(), enclosedByAreaFunc(), LIBEVAL::UOP::Exec(), existsOnLayerFunc(), fromToFunc(), getFieldFunc(), hasComponentClassFunc(), hasCustomPropertyFunc(), hasExactNetclassFunc(), hasNetclassFunc(), inDiffPairFunc(), inNetChainClassFunc(), inNetChainFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), memberOfFootprintFunc(), memberOfGroupFunc(), memberOfSheetFunc(), and memberOfSheetOrChildrenFunc().
|
inlineprivate |
Definition at line 486 of file libeval_compiler.h.
References m_inlineStorage.
Referenced by AllocValue(), and Reset().
|
inline |
Definition at line 431 of file libeval_compiler.h.
References _, AllocValue(), m_stack, m_stackPtr, and ReportError().
Referenced by customPropertyFunc(), doIntersectsAreaFunc(), enclosedByAreaFunc(), LIBEVAL::UOP::Exec(), existsOnLayerFunc(), fromToFunc(), LIBEVAL::COMPILER::generateUCode(), getFieldFunc(), hasComponentClassFunc(), hasCustomPropertyFunc(), hasExactNetclassFunc(), hasNetclassFunc(), inDiffPairFunc(), inNetChainClassFunc(), inNetChainFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), memberOfFootprintFunc(), memberOfGroupFunc(), memberOfSheetFunc(), memberOfSheetOrChildrenFunc(), and LIBEVAL::UCODE::Run().
|
inline |
Definition at line 423 of file libeval_compiler.h.
References m_stack, m_stackPtr, STACK_CAPACITY, and stackOverflow().
Referenced by customPropertyFunc(), doIntersectsAreaFunc(), enclosedByAreaFunc(), LIBEVAL::UOP::Exec(), existsOnLayerFunc(), fromToFunc(), LIBEVAL::COMPILER::generateUCode(), getFieldFunc(), hasComponentClassFunc(), hasCustomPropertyFunc(), hasExactNetclassFunc(), hasNetChainFunc(), hasNetclassFunc(), inDiffPairFunc(), inNetChainClassFunc(), inNetChainFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), isBlindBuriedViaFunc(), isBlindVia(), isBuriedVia(), isCoupledDiffPairFunc(), isMicroVia(), isPlatedFunc(), isStackedViaFunc(), memberOfFootprintFunc(), memberOfGroupFunc(), memberOfSheetFunc(), and memberOfSheetOrChildrenFunc().
| void LIBEVAL::CONTEXT::ReportError | ( | const wxString & | aErrorMsg | ) |
Definition at line 711 of file libeval_compiler.cpp.
References m_errorCallback.
Referenced by collidesWithArea(), customPropertyFunc(), doIntersectsAreaFunc(), enclosedByAreaFunc(), LIBEVAL::UOP::Exec(), existsOnLayerFunc(), fromToFunc(), getFieldFunc(), hasComponentClassFunc(), hasCustomPropertyFunc(), hasExactNetclassFunc(), hasNetclassFunc(), inDiffPairFunc(), inNetChainClassFunc(), inNetChainFunc(), intersectsBackCourtyardFunc(), intersectsCourtyardFunc(), intersectsFrontCourtyardFunc(), memberOfFootprintFunc(), memberOfGroupFunc(), memberOfSheetFunc(), memberOfSheetOrChildrenFunc(), Pop(), LIBEVAL::UCODE::Run(), stackOverflow(), and Top().
|
inlinevirtual |
Release every value allocated by the previous evaluation and rewind the stack so the same CONTEXT can be reused for another Run() without being reconstructed.
This keeps the owned- value vector's buffer allocated, so a reused context performs zero heap allocation for the common evaluation. Overrides must chain to this base after rewinding their own per-run state.
Reimplemented in PCBEXPR_CONTEXT.
Definition at line 385 of file libeval_compiler.h.
References inlineValue(), m_errorCallback, m_inlineUsed, m_ownedValues, and m_stackPtr.
Referenced by PCBEXPR_CONTEXT::Reset(), and ~CONTEXT().
|
inline |
Definition at line 465 of file libeval_compiler.h.
References m_errorCallback.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DRC_RULE_CONDITION::EvaluateFor(), MULTICHANNEL_TOOL::findComponentsInRuleArea(), MULTICHANNEL_TOOL::findOtherItemsInRuleArea(), MULTICHANNEL_TOOL::findRoutingInRuleArea(), LIBEVAL::COMPILER::generateUCode(), and ITEM_EVAL_EXPECTATION::RunTest().
|
inline |
Definition at line 454 of file libeval_compiler.h.
References m_stackPtr.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and LIBEVAL::UCODE::Run().
|
private |
Definition at line 718 of file libeval_compiler.cpp.
References _, and ReportError().
Referenced by Push().
Definition at line 417 of file libeval_compiler.h.
References m_ownedValues.
Referenced by LIBEVAL::UOP::Exec(), and LIBEVAL::UCODE::Run().
|
inline |
Peek the top of the stack without popping (used by the short-circuit jumps).
Definition at line 443 of file libeval_compiler.h.
References _, AllocValue(), m_stack, m_stackPtr, and ReportError().
Referenced by LIBEVAL::UOP::Exec().
|
staticconstexprprivate |
Definition at line 482 of file libeval_compiler.h.
Referenced by AllocValue().
|
private |
Definition at line 498 of file libeval_compiler.h.
Referenced by ExchangeErrorCallback(), HasErrorCallback(), ReportError(), Reset(), and SetErrorCallback().
|
private |
Definition at line 495 of file libeval_compiler.h.
Referenced by inlineValue().
|
private |
Definition at line 496 of file libeval_compiler.h.
Referenced by AllocValue(), CONTEXT(), and Reset().
|
private |
Definition at line 491 of file libeval_compiler.h.
Referenced by AllocValue(), CONTEXT(), Reset(), and StoreValue().
|
private |
|
private |
Definition at line 493 of file libeval_compiler.h.
Referenced by ClearStack(), CONTEXT(), Pop(), Push(), Reset(), SP(), and Top().
|
staticconstexpr |
Definition at line 359 of file libeval_compiler.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and Push().