55 SOM(
const SOM & ) =
delete;
57 SOM & operator=(
const SOM & ) =
delete;
58 SOM & operator=(
SOM && ) =
delete;
62 [[nodiscard]]
SOM *
dup()
const override {
return new SOM; }
65 std::string
opequal()
const override {
return "--nostringval--"; }
74 std::string_view
type()
const override {
return "marktype"; }
79 bool equal(
const SO * p_other )
const override {
102 SOL(
const SOL & ) =
delete;
104 SOL & operator=(
const SOL & ) =
delete;
105 SOL & operator=(
SOL && ) =
delete;
112 std::string
opequal()
const override {
return "--nostringval--"; }
121 std::string_view
type()
const override {
return "nulltype"; }
126 bool equal(
const SO * p_other )
const override {
155 explicit SOI( __int128 p_i ) :
i_(p_i) {}
163 SOI(
const SOI & ) =
delete;
165 SOI & operator=(
const SOI & ) =
delete;
166 SOI & operator=(
SOI && ) =
delete;
179 [[nodiscard]]
SOI *
dup()
const override {
return new SOI(
i_ ); }
188 std::string_view
type()
const override {
return "integertype"; }
193 bool equal(
const SO * p_other )
const override {
196 if( p_other->
ot() !=
ot() )
198 const auto o =
static_cast<const SOI *
>( p_other );
213 const auto o =
static_cast<const SOI *
>( p_other );
229 const auto o =
static_cast<const SOI *
>( p_other );
266 explicit SOB(
const std::string & p_s ) :
b_(p_s ==
"true") {}
271 explicit SOB(
bool p_b ) :
b_(p_b) {}
279 SOB(
const SOB & ) =
delete;
281 SOB & operator=(
const SOB & ) =
delete;
282 SOB & operator=(
SOB && ) =
delete;
295 [[nodiscard]]
SOB *
dup()
const override {
return new SOB(
b_ ); }
299 return b_ ?
"true" :
"false";
306 std::string_view
type()
const override {
return "booleantype"; }
311 bool equal(
const SO * p_other )
const override {
314 if( p_other->
ot() !=
ot() )
316 const auto o =
static_cast<const SOB *
>( p_other);
355 explicit SOR(
const std::string & p_s ) :
r_(
conversion::string_to___float128(p_s) ) {
362 explicit SOR( __float128 p_r ) :
r_(p_r) {
372 SOR(
const SOR & ) =
delete;
374 SOR & operator=(
const SOR & ) =
delete;
375 SOR & operator=(
SOR && ) =
delete;
398 [[nodiscard]]
SOR *
dup()
const override {
return new SOR(
r_ ); }
406 std::string
opequal()
const override;
412 std::string_view
type()
const override {
return "realtype"; }
417 bool equal(
const SO * p_other )
const override {
420 if( p_other->
ot() !=
ot() )
422 const auto o =
static_cast<const SOR *
>( p_other );
437 const auto o =
static_cast<const SOR *
>( p_other );
453 const auto o =
static_cast<const SOR *
>( p_other );
513 if( std::abs(
r_) > std::numeric_limits<__float128>::min() ) {
537 return !
name_.empty();
547 explicit SON( std::string p_name,
bool p_exec =
false )
549 name_( std::move(p_name) ) {
568 SON & operator=(
const SON & ) =
delete;
569 SON & operator=(
SON && ) =
delete;
578 [[nodiscard]]
SON *
dup()
const override {
return new SON( *
this ); }
598 std::string_view
type()
const override {
return "nametype"; }
603 bool equal(
const SO * p_other )
const override {
608 const auto o =
static_cast<const SON *
>( p_other );
645 if(
core_ ==
nullptr )
672 SOO(
const SOO & ) =
delete;
674 SOO & operator=(
const SOO & ) =
delete;
675 SOO & operator=(
SOO && ) =
delete;
688 return "--" +
opequal() +
"--";
695 std::string_view
type()
const override {
return "operatortype"; }
700 bool equal(
const SO * p_other )
const override {
705 const auto o =
static_cast<const SOO *
>( p_other );
755 SOo(
const SOo & ) =
delete;
757 SOo & operator=(
const SOo & ) =
delete;
758 SOo & operator=(
SOo && ) =
delete;
Adapters for 128 bit versions of standard functions.
The context of execution.
Definition context.h:46
Central registry for all core code entries.
Definition registry.h:36
static std::string_view lookUpName(core_t *p_core)
Finds the name of a core code.
Definition registry.cpp:46
static bool lookUp(core_t *p_core)
Checks if core code is in the static table.
Definition registry.h:69
Semantic Object Boolean.
Definition sosimp.h:256
std::string_view type() const override
Returns a type name.
Definition sosimp.h:306
SOB(bool p_b)
Ctor from a boolean.
Definition sosimp.h:271
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:303
void negation__1()
In place negation.
Definition sosimp.h:323
bool getB() const
Getter for boolean value.
Definition sosimp.h:287
~SOB() override=default
Dtor.
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sosimp.h:298
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:311
void setB(bool p_b)
Setter for boolean value.
Definition sosimp.h:291
bool b_
The boolean value.
Definition sosimp.h:258
SOB(const std::string &p_s)
Ctor from a string representation.
Definition sosimp.h:266
SOB * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:295
Semantic Object Integer.
Definition sosimp.h:139
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:193
SOI * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:179
~SOI() override=default
Dtor.
bool ge(OpError &p_ec, const SO *p_other) const override
Greater or equal.
Definition sosimp.h:222
void half__1()
In place half value.
Definition sosimp.h:249
bool gt(OpError &p_ec, const SO *p_other) const override
Greater than.
Definition sosimp.h:206
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:185
std::string_view type() const override
Returns a type name.
Definition sosimp.h:188
void sqr__1()
In place sqr.
Definition sosimp.h:245
SOI(const std::string &p_s)
Ctor from a string representation.
Definition sosimp.h:150
void setInteger(__int128 p_i)
Setter for the integer value.
Definition sosimp.h:175
__int128 i_
The 128 bit integer.
Definition sosimp.h:141
void increment__1()
In place increment.
Definition sosimp.h:241
SOI(__int128 p_i)
Ctor from an 128 bit integer.
Definition sosimp.h:155
void decrement__1()
In place decrement.
Definition sosimp.h:237
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sosimp.h:182
__int128 getInteger() const
Getter for the integer value.
Definition sosimp.h:171
Semantic Object nuLl.
Definition sosimp.h:90
SOL * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:109
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:118
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sosimp.h:112
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sosimp.h:115
~SOL() override=default
Dtor.
std::string_view type() const override
Returns a type name.
Definition sosimp.h:121
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:126
Semantic Object Mark.
Definition sosimp.h:43
SOM * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:62
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sosimp.h:68
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sosimp.h:65
~SOM() override=default
Dtor.
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:79
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:71
std::string_view type() const override
Returns a type name.
Definition sosimp.h:74
Semantic Object Name.
Definition sosimp.h:525
SON(std::string p_name, bool p_exec=false)
Ctor from a string as name.
Definition sosimp.h:547
SON * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:578
std::string getName() const
Getter for name_.
Definition sosimp.h:574
SON(const SON &p_other)
Copy ctor.
Definition sosimp.h:555
bool invariant() const noexcept override
Checks class invariants.
Definition sosimp.h:536
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sosimp.h:581
size_t getSize() const override
Returns the size of the SO.
Definition sosimp.h:613
static bool otcodeIsName(OTCode p_code)
Checks if an OTCode represents a name type (N or Nx).
Definition sosimp.h:621
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sosimp.h:588
~SON() override=default
Dtor.
std::string_view type() const override
Returns a type name.
Definition sosimp.h:598
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:593
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:603
std::string name_
The name.
Definition sosimp.h:527
Semantic Object core code Operator.
Definition sosimp.h:634
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:692
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sosimp.h:682
SOO * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:679
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sosimp.h:687
bool invariant() const noexcept override
Checks class invariants.
Definition sosimp.h:644
~SOO() override
Dtor.
Definition sosimp.h:666
SOO(core_t *p_fun)
Ctor.
Definition sosimp.h:657
core_t *const core_
The core code, a C++ implementation of the operator.
Definition sosimp.h:636
static bool otcodeIsCoreCode(OTCode p_code)
Checks if an OTCode represents a core code operator type (O or o).
Definition sosimp.h:720
std::string_view type() const override
Returns a type name.
Definition sosimp.h:695
void exec(Context &k) const
Call the core code.
Definition sosimp.h:713
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:700
Semantic Object Real.
Definition sosimp.h:334
bool setReal(__float128 p_r)
Setter for real value.
Definition sosimp.h:387
void half__1()
In place half value.
Definition sosimp.h:461
SOR(const std::string &p_s)
Ctor from a string representation.
Definition sosimp.h:355
void ceil__1()
In place ceil().
Definition sosimp.h:490
~SOR() override=default
Dtor.
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'. Reals are formated for output...
Definition sosimp.cpp:28
void floor__1()
In place floor().
Definition sosimp.h:498
__float128 r_
The real value as decimal number.
Definition sosimp.h:336
bool gt(OpError &p_ec, const SO *p_other) const override
Greater than.
Definition sosimp.h:430
bool ge(OpError &p_ec, const SO *p_other) const override
Greater or equal.
Definition sosimp.h:446
__float128 getReal() const
Getter for real value.
Definition sosimp.h:380
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sosimp.h:417
SOR(__float128 p_r)
Ctor from a float.
Definition sosimp.h:362
void trunc__1()
In place trunc().
Definition sosimp.h:482
OpError sqr__1()
In place square.
Definition sosimp.h:471
OpError reciprocal__1()
In place reciprocal.
Definition sosimp.h:510
SOR * dup() const override
Creates a new instance as copy following the red book definition.
Definition sosimp.h:398
bool invariant() const noexcept override
Checks class invariants.
Definition sosimp.h:344
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:409
std::string_view type() const override
Returns a type name.
Definition sosimp.h:412
Semantic Object.
Definition so.h:67
virtual OTCode ot() const =0
Returns an OTCode.
bool getExec() const
Getter for exec_.
Definition so.h:100
Semantic Object core code Operator - loop auxillary operators These unregistered operator objects are...
Definition sosimp.h:733
auto getStackusage() const
Getter for stackusage_.
Definition sosimp.h:763
~SOo() override=default
Dtor.
OTCode ot() const override
Returns an OTCode.
Definition sosimp.h:767
size_t stackusage_
The number of objects needed on the execution stack for execution.
Definition sosimp.h:736
SOo(core_t *p_fun)
Ctor.
Definition sosimp.h:744
Helpers for design by contract idioms.
#define DBC_INV_CTOR(T)
Assert for invariant checks in ctors and dtors.
Definition dbc.h:122
#define DBC_INV
Assert for invariant checks in member functions.
Definition dbc.h:114
#define DBC_PRE(XXX)
Assert for preconditions.
Definition dbc.h:104
#define DBC_INV_RAII(TT)
Defines an instance of the class DbCRAIIassert<>, which calls the invariant()-function at the return ...
Definition dbc.h:94
OpError
Operator error code enum.
Definition error.h:30
@ undefinedresult
operator error undefinedresult
Definition error.h:39
@ success
No operator error.
Definition error.h:32
@ typecheck
operator error typecheck
Definition error.h:36
Miscellaneous definitions and functions.
void(Context &) core_t
A shortcut for the core code function type.
Definition helper.h:82
constexpr __float128 SOR_MAX_SQR
__float128 maximum that can be squared.
Definition helper.h:38
__float128 floor(__float128 p_r)
__float128 overload of floor().
Definition adapter128.cpp:35
__float128 ceil(__float128 p_r)
__float128 overload of ceil().
Definition adapter128.cpp:30
__float128 trunc(__float128 p_r)
__float128 overload of trunc().
Definition adapter128.cpp:40
bool isfinite(__float128 p_r)
__float128 overload of isfinite().
Definition adapter128.cpp:25
Collection of conversion functions.
Definition conversion.h:26
std::string __int128_to_string(__int128 p_z)
Converts an __int128 to its string representation.
Definition conversion.cpp:37
The class SO - semantic object.
OTCode
OTCode - the Object Type Code.
Definition so.h:38