ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
calculus.cpp
1//##################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2025 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6//##################################################################################################
7#include "alib_precompile.hpp"
8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
10#endif
11#if ALIB_C20_MODULES
12 module;
13#endif
14//========================================= Global Fragment ========================================
16#include <vector>
17//============================================== Module ============================================
18#if ALIB_C20_MODULES
19 module ALib.Expressions.Impl;
20 import ALib.Characters.Functions;
21 import ALib.Strings;
22#else
24# include "ALib.Strings.H"
26#endif
27//========================================== Implementation ========================================
29
30namespace alib { namespace expressions { namespace plugins {
31
32//##################################################################################################
33// Operator setup helpers (unary and binary)
34//##################################################################################################
36 Type lhsType,
37 Type rhsType,
38 CallbackDecl callback,
39 #if ALIB_DEBUG
40 const char* dbgCallbackName,
41 #endif
42 Type resultType,
43 CTInvokable cti )
44{
45 #if ALIB_DEBUG
46 auto result=
47 Operators.EmplaceIfNotExistent(
48 OperatorKey { op, lhsType.TypeID(), rhsType.TypeID() },
49 std::make_tuple( callback, resultType, cti ALIB_DBG(, dbgCallbackName) ) );
50
51 ALIB_ASSERT_ERROR( result.second == true, "EXPR", // assert this was an insert!
52 "Binary operator '{}' already defined for types <{}> (aka {})\n"
53 " and <{}> (aka {}).",
54 op, Cmplr.TypeName( lhsType ), &lhsType.TypeID(),
55 Cmplr.TypeName( rhsType ), &rhsType.TypeID() )
56 #else
57 Operators.EmplaceUnique(
58 OperatorKey { op, lhsType.TypeID(), rhsType.TypeID() },
59 std::make_tuple( callback, resultType, cti ALIB_DBG(, dbgCallbackName) ) );
60 #endif
61}
62
63void Calculus::AddOperators( OperatorTableEntry* table, size_t length ) {
65 ALIB_DBG( auto actBucketCount= Operators.BucketCount(); )
66
67 #define OP std::get<0>( *(table + i) )
68 #define LHS_TYPE std::get<1>( *(table + i) ).TypeID()
69 #define RHS_TYPE std::get<2>( *(table + i) ).TypeID()
70 #define CBFUNC std::get<3>( *(table + i) )
71 #define RESULTTYPE std::get<ALIB_REL_DBG(4,5)>( *(table + i) )
72 #define CTINVOKE std::get<ALIB_REL_DBG(5,6)>( *(table + i) )
73
74 for( size_t i= 0 ; i < length ; ++i ) {
75 #if ALIB_DEBUG
76 auto result=
77 Operators.EmplaceIfNotExistent(
78 OperatorKey { OP, LHS_TYPE, RHS_TYPE },
79 std::make_tuple( CBFUNC, RESULTTYPE, CTINVOKE
80 ALIB_DBG(, std::get<4>( *(table + i) )) ) );
81
82 ALIB_ASSERT_ERROR( result.second == true, "EXPR",// assert this was an insert!
83 "Binary operator '{}' already defined for types <{}> (aka {})\n"
84 " and <{}> (aka {}).",
85 OP, Cmplr.TypeName(std::get<1>( *(table+i))), &LHS_TYPE,
86 Cmplr.TypeName(std::get<2>( *(table+i))), &RHS_TYPE )
87 #else
88 Operators.EmplaceUnique(
89 OperatorKey { OP, LHS_TYPE, RHS_TYPE },
90 std::make_tuple( CBFUNC, RESULTTYPE, CTINVOKE
91 ALIB_DBG(, std::get<4>( *(table + i) )) ) );
92 #endif
93 }
94
95 ALIB_ASSERT_ERROR( actBucketCount == Operators.BucketCount(), "EXPR",
96 "This is rather an internal error of HashTable: The number of buckets "
97 "of hash map 'Operators' increased, although it was reserved above." )
98
99 #undef OP
100 #undef LHS_TYPE
101 #undef RHS_TYPE
102 #undef CBFUNC
103 #undef RESULTTYPE
104 #undef CTINVOKE
105}
106
107void Calculus::AddOperatorAlias( const String& alias, Type lhs, Type rhs, const String& op ) {
108 #if ALIB_DEBUG
109 auto result=
110 OperatorAliases.EmplaceIfNotExistent( OperatorKey { alias, lhs.TypeID(), rhs.TypeID() },
111 op );
112
113 ALIB_ASSERT_ERROR( result.second == true, "EXPR",// assert this was an insert!
114 "Binary operator alias '{}' already defined for types <{}> (aka {})\n"
115 "and <{}> (aka {}).",
116 alias, Cmplr.TypeName( lhs ), &lhs.TypeID(),
117 Cmplr.TypeName( rhs ), &rhs.TypeID() )
118 #else
119 OperatorAliases.EmplaceUnique( OperatorKey { alias, lhs.TypeID(), rhs.TypeID() },
120 op );
121 #endif
122}
123
126
127 #define ALIAS std::get<0>( *(table + i) )
128 #define LHS_TYPE std::get<1>( *(table + i) ).TypeID()
129 #define RHS_TYPE std::get<2>( *(table + i) ).TypeID()
130 #define OP std::get<3>( *(table + i) )
131
132 for( size_t i= 0 ; i < length ; ++i ) {
133 #if ALIB_DEBUG
134 auto result=
135 OperatorAliases.EmplaceIfNotExistent( OperatorKey { ALIAS, LHS_TYPE, RHS_TYPE }, OP );
136
137 ALIB_ASSERT_ERROR( result.second == true, "EXPR",// assert this was an insert!
138 "Binary operator alias '{}' already defined for types <{}> (aka {})\n"
139 "and <{}> (aka {}).",
140 ALIAS, Cmplr.TypeName( std::get<1>( *(table + i) ) ), &LHS_TYPE,
141 Cmplr.TypeName( std::get<2>( *(table + i) ) ), &RHS_TYPE )
142 #else
143 OperatorAliases.EmplaceUnique( OperatorKey { ALIAS, LHS_TYPE, RHS_TYPE },
144 OP );
145 #endif
146 }
147
148 #undef ALIAS
149 #undef LHS_TYPE
150 #undef RHS_TYPE
151 #undef OP
152}
153
154//##################################################################################################
155// Unary operators
156//##################################################################################################
158 Box& arg= ciUnaryOp.CompileTimeScope.Stack->at(0);
159 OperatorKey key = { ciUnaryOp.Operator, arg.TypeID(), typeid(void) };
160 auto hashCode= OperatorKey::Hash()( key );
161
162 // search alias first
163 {
164 auto aliasIt= OperatorAliases.Find( key, hashCode );
165 if( aliasIt != OperatorAliases.end() )
166 ciUnaryOp.Operator= aliasIt.Mapped();
167 }
168
169
170 // search callback
171 auto opIt= Operators.Find( key, hashCode );
172 if( opIt == Operators.end() )
173 return false;
174
175 auto& op= opIt.Mapped();
176
177 // for constants, the callback might b invoked right away (optimizing cal out)
178 if( ciUnaryOp.ArgIsConst && std::get<2>(op) ) {
179 // calculate constant value
180 ciUnaryOp.TypeOrValue= std::get<0>(op)( ciUnaryOp.CompileTimeScope,
181 ciUnaryOp.ArgsBegin,
182 ciUnaryOp.ArgsEnd );
183ALIB_DBG(ciUnaryOp.DbgCallbackName= std::get<3>(op);)
184 ALIB_ASSERT_ERROR(ciUnaryOp.TypeOrValue.IsSameType(std::get<1>(op)), "EXPR",
185 "Type mismatch in definition of unary operator \"{}\" ({}) in plugin \"{}\".\n"
186 " Type specified: <{}> (aka {})\n"
187 " Type returned by callback: <{}> (aka {})",
188 ciUnaryOp.Operator, ciUnaryOp.DbgCallbackName, CompilerPlugin::Name,
189 CompilerPlugin::Cmplr.TypeName(std::get<1>(op)),
190 &std::get<1>(op).TypeID(),
191 CompilerPlugin::Cmplr.TypeName(ciUnaryOp.TypeOrValue),
192 &ciUnaryOp.TypeOrValue.TypeID() )
193 return true;
194 }
195 ciUnaryOp.Callback = std::get<0>(op);
196 ciUnaryOp.TypeOrValue = std::get<1>(op);
197ALIB_DBG(ciUnaryOp.DbgCallbackName= std::get<3>(op);)
198
199 return true;
200}
201
202//##################################################################################################
203// Binary operators
204//##################################################################################################
207
208 #define OP std::get<0>( *(table + i) )
209 #define SIDE std::get<1>( *(table + i) )
210 #define CONSTVAL std::get<2>( *(table + i) )
211 #define CONSTTYPE std::get<2>( *(table + i) ).TypeID()
212 #define OTHERBOX std::get<3>( *(table + i) )
213 #define OTHERTYPE std::get<3>( *(table + i) ).TypeID()
214 #define RESULT std::get<4>( *(table + i) )
215
216 for( size_t i= 0 ; i < length ; ++i ) {
217 #if ALIB_DEBUG
218 auto result=
219 BinaryOperatorOptimizations.EmplaceIfNotExistent( BinOpOptKey { OP, SIDE, CONSTVAL, OTHERTYPE }, RESULT );
220
221 ALIB_ASSERT_ERROR( result.second == true, "EXPR", // assert this was an insert!
222 "Optimization already defined for operator \"{}\" with {!Lower}-hand "
223 "constant value \"{}\" of type <{}> (aka {}) and with "
224 "{!L}-hand type <{}> (aka {}).",
225 OP, SIDE, CONSTVAL, Cmplr.TypeName(CONSTVAL), &CONSTTYPE,
227 : lang::Side::Left, Cmplr.TypeName(OTHERBOX), &OTHERTYPE )
228 #else
229 BinaryOperatorOptimizations.EmplaceUnique( BinOpOptKey { OP, SIDE, CONSTVAL, OTHERTYPE },
230 RESULT );
231 #endif
232 }
233
234 #undef OP
235 #undef TYPE
236 #undef CONSTVAL
237 #undef RESULT
238}
239
240
242 Box& lhs= * ciBinaryOp.ArgsBegin;
243 Box& rhs= *(ciBinaryOp.ArgsBegin + 1);
244
245 OperatorKey key = { ciBinaryOp.Operator, lhs.TypeID(), rhs.TypeID() };
246 auto hashCode= OperatorKey::Hash()( key );
247
248 // search alias first
249 if( ciBinaryOp.Operator == A_CHAR("=")
250 && HasBits( Cmplr.CfgCompilation, Compilation::AliasEqualsOperatorWithAssignOperator ) )
251 {
252 ciBinaryOp.Operator= A_CHAR("==");
253 } else {
254 auto aliasIt = OperatorAliases.Find( key, hashCode );
255 if( aliasIt != OperatorAliases.end() )
256 ciBinaryOp.Operator= aliasIt.Mapped();
257 }
258
259 #define CBFUNC std::get<0>(op)
260 #define RESULTTYPE std::get<1>(op)
261 #define CT_INVOKABLE std::get<2>(op)
262 #if ALIB_DEBUG
263 # define DBG_CB_NAME std::get<3>(op)
264 #endif
265
266// search callback
267 auto opIt = Operators.Find( key, hashCode );
268 if( opIt == Operators.end() )
269 return false;
270
271 auto& op= opIt.Mapped();
272
273 // if both are constant, the callback might be invoked right away (optimizing the call out)
274 if( ciBinaryOp.LhsIsConst && ciBinaryOp.RhsIsConst ) {
275 if( CT_INVOKABLE ) {
276 // calculate constant value
277 ciBinaryOp.TypeOrValue= CBFUNC ( ciBinaryOp.CompileTimeScope,
278 ciBinaryOp.ArgsBegin,
279 ciBinaryOp.ArgsEnd );
280ALIB_DBG( ciBinaryOp.DbgCallbackName= DBG_CB_NAME; )
281 ALIB_ASSERT_ERROR(ciBinaryOp.TypeOrValue.IsSameType(RESULTTYPE), "EXPR",
282 "Type mismatch in definition of binary operator \"{}\" ({}) of plugin \"{}\".\n"
283 " Type specified: <{}> (aka {})\n"
284 " Type returned by callback: <{}> (aka {})",
285 ciBinaryOp.Operator, ciBinaryOp.DbgCallbackName, CompilerPlugin::Name,
286 CompilerPlugin::Cmplr.TypeName(RESULTTYPE ),
287 &RESULTTYPE .TypeID(),
288 CompilerPlugin::Cmplr.TypeName(ciBinaryOp.TypeOrValue),
289 &ciBinaryOp.TypeOrValue.TypeID() )
290 return true;
291 } }
292
293
294 // if one is constant, we may find an entry in BinaryOpConsL/RHSOptimizations
295 else if( ciBinaryOp.LhsIsConst || ciBinaryOp.RhsIsConst ) {
296 auto& nonConstType= (ciBinaryOp.LhsIsConst ? *(ciBinaryOp.ArgsBegin + 1 )
297 : *(ciBinaryOp.ArgsBegin ) ).TypeID();
298 auto& constValue= ciBinaryOp.LhsIsConst ? *(ciBinaryOp.ArgsBegin )
299 : *(ciBinaryOp.ArgsBegin + 1 );
300
301 auto entryIt= BinaryOperatorOptimizations.Find( { ciBinaryOp.Operator,
303 constValue,
304 nonConstType
305 } );
306 if( entryIt != BinaryOperatorOptimizations.end() ) {
307 // found! If it is an unset box, this tells us, that the result is the other side
308 // (identity operation). Otherwise it is a constant.
309 if( entryIt.Mapped().IsType<void>() )
310 ciBinaryOp.NonConstArgIsResult= true;
311 else
312 ciBinaryOp.TypeOrValue = entryIt.Mapped();
313 return true;
314 } }
315
316
317 ciBinaryOp.Callback = CBFUNC;
318 ciBinaryOp.TypeOrValue = RESULTTYPE;
320 ciBinaryOp.DbgCallbackName= DBG_CB_NAME; )
321 return true;
322
323
324 #undef CBFUNC
325 #undef RESULTTYPE
326 #undef CT_INVOKABLE
327 #if ALIB_DEBUG
328 #undef DBG_CB_NAME
329 #endif
330}
331
332
333//##################################################################################################
334// Functions
335//##################################################################################################
337 String& name= ciFunction.Name;
338
339 // search in constant identifiers
340 if( ciFunction.QtyArgs() == 0 ) {
341 for( auto& entry : ConstantIdentifiers ) {
342 if ( entry.Descriptor.Match( name ) ) {
343 // check for wrong parentheses
344 if( ciFunction.IsIdentifier
347 entry.Descriptor );
348
349 if( !ciFunction.IsIdentifier
352 entry.Descriptor );
353
354
355 // accept
356 ciFunction.Name.Reset( entry.Descriptor );
357 ciFunction.TypeOrValue= entry.Result;
358 return true;
359 } } }
360
361 // search in functions
362 for( auto& entry : Functions ) {
363 if( entry.Descriptor.Match( name ) ) {
364 // collect information about given and requested parameters
365 size_t qtyGiven = ciFunction.QtyArgs();
366 size_t qtyRequired = entry.SignatureLength;
367 bool isVariadic = false;
368 if( entry.SignatureLength > 0 && ( entry.Signature[entry.SignatureLength - 1] == nullptr
369 || entry.Signature[entry.SignatureLength - 1]->IsType<void>() ) )
370 {
371 isVariadic= true;
372 --qtyRequired;
373 }
374
375 size_t qtyShared = (std::min)( qtyGiven, qtyRequired );
376 bool sharedAreSameType = true;
377 for( size_t i= 0; i != qtyShared ; ++i )
378 sharedAreSameType&= ciFunction.Arg(i).IsSameType( *entry.Signature[i] );
379
380 // check if given parameter don't match
381 if( !sharedAreSameType
382 || ( isVariadic ? qtyGiven < qtyRequired
383 : qtyGiven != qtyRequired ) )
384 {
385 String256 buffer( entry.Descriptor );
386 if( qtyRequired )
387 Cmplr.WriteFunctionSignature( entry.Signature,
388 entry.SignatureLength,
389 buffer );
390 ciFunction.AddFunctionsWithNonMatchingArguments( buffer );
391
392 // search next
393 continue;
394 }
395
396 // check for wrong parentheses
397 if( ciFunction.IsIdentifier
398 && entry.Signature != nullptr
401 entry.Descriptor );
402
403 if( !ciFunction.IsIdentifier
404 && entry.Signature == nullptr
407 entry.Descriptor );
408
409 // accept
410 ciFunction.Name.Reset( entry.Descriptor );
411
412 if( !entry.Callback ) {
413 ciFunction.TypeOrValue = *entry.ResultType;
414 ALIB_DBG( ciFunction.DbgCallbackName = entry.DbgCallbackName; )
415 return true;
416 }
417
418 // for constants, the callback might b invoked right away (optimizing cal out)
419 if( ciFunction.AllArgsAreConst && entry.IsCTInvokable ) {
420 // calculate constant value
421 ciFunction.TypeOrValue = entry.Callback( ciFunction.CompileTimeScope,
422 ciFunction.ArgsBegin,
423 ciFunction.ArgsEnd );
424 ALIB_ASSERT_ERROR(ciFunction.TypeOrValue.IsSameType(*entry.ResultType), "EXPR",
425 "Type mismatch in definition of function \"{}\" ({}) in plugin \"{}\".\n"
426 " Type specified: <{}> (aka {})\n"
427 " Type returned by callback: <{}> (aka {})",
428 entry.Descriptor, entry.DbgCallbackName, CompilerPlugin::Name,
429 CompilerPlugin::Cmplr.TypeName(*entry.ResultType),
430 &entry.ResultType->TypeID(),
431 CompilerPlugin::Cmplr.TypeName(ciFunction.TypeOrValue),
432 &ciFunction.TypeOrValue.TypeID() )
433 ALIB_DBG( ciFunction.DbgCallbackName = entry.DbgCallbackName; )
434 return true;
435 }
436
437 ciFunction.Callback = entry.Callback;
438 ciFunction.TypeOrValue = *entry.ResultType;
439 ALIB_DBG( ciFunction.DbgCallbackName = entry.DbgCallbackName; )
440 return true;
441 } }
442
443 return false;
444}
445
446//##################################################################################################
447// Auto-Casts
448//##################################################################################################
449//! @cond NO_DOX
450namespace {
451Calculus::AutoCastEntry* findAutoCastEntry( std::vector<Calculus::AutoCastEntry>& table,
452 Calculus::CIAutoCast& ciAutoCast,
453 int argNo ) {
454 Box& valueToCast= *(ciAutoCast.ArgsBegin + argNo);
455
456 // main loop over all table entries
457 for( auto& entry : table ) {
458 // first check for source type
459 if( !entry.Type.IsSameType( valueToCast ) )
460 continue;
461
462 // operator included in list of accepted (if list given)?
463 bool operatorIsIn= true;
464 if( entry.OperatorsAccepted != nullptr
465 && entry.OperatorsAccepted->size() > 0 )
466 {
467 operatorIsIn= false;
468 for( auto& op : *entry.OperatorsAccepted )
469 if( op.Equals<NC>( ciAutoCast.Operator ) ) {
470 operatorIsIn= true;
471 break;
472 } }
473
474 // operator included in decline list?
475 if( operatorIsIn
476 && entry.OperatorsDeclined != nullptr
477 && entry.OperatorsDeclined->size() > 0 )
478 {
479 for( auto& op : *entry.OperatorsDeclined )
480 if( op.Equals<NC>( ciAutoCast.Operator ) ) {
481 operatorIsIn= false;
482 break;
483 } }
484
485 // found?
486 if( operatorIsIn )
487 return &entry;
488 }
489
490 return nullptr;
491}
492
493Box any2Int ( expressions::Scope&, ArgIterator argsBegin, ArgIterator )
494{ return argsBegin->Data().Integrals.Array[0]; }
495
496} //anonymous namespace
497//! @endcond
498
499
501 bool result= false;
502
503 //----------------------------------------- cast first arg ---------------------------------------
504 AutoCastEntry* entry= findAutoCastEntry( AutoCasts, ciAutoCast, 0 );
505 if( entry != nullptr ) {
506 result= true;
508
509 CallbackDecl callback;
510 if( entry->Callback == nullptr ) {
511 callback = any2Int;
512ALIB_DBG( ciAutoCast.DbgCallbackName= "any2Int"; )
513 ciAutoCast.TypeOrValue = Types::Integer;
514 } else {
515 callback = entry->Callback;
516ALIB_DBG( ciAutoCast.DbgCallbackName= entry->DbgCallbackName; )
517 ciAutoCast.TypeOrValue = entry->ResultType;
518 }
519
520 if( ciAutoCast.IsConst )
521 ciAutoCast.TypeOrValue= callback( ciAutoCast.CompileTimeScope,
522 ciAutoCast.ArgsBegin,
523 ciAutoCast.ArgsEnd );
524 else
525 ciAutoCast.Callback = callback;
526 }
527
528 // no RHS given?
529 if( ciAutoCast.ArgsBegin + 1 >= ciAutoCast.ArgsEnd )
530 return result;
531
532 //------------------------------------- cast second arg (rhs) ------------------------------------
533 entry= findAutoCastEntry( AutoCasts, ciAutoCast, 1 );
534 if( entry != nullptr ) {
535 //
536 result= true;
538
539 CallbackDecl callback;
540 if( entry->Callback == nullptr ) {
541 callback = any2Int;
542ALIB_DBG( ciAutoCast.DbgCallbackNameRhs= "any2Int"; )
543 ciAutoCast.TypeOrValueRhs = Types::Integer;
544 } else {
545 callback = entry->Callback;
546ALIB_DBG( ciAutoCast.DbgCallbackNameRhs= entry->DbgCallbackName; )
547 ciAutoCast.TypeOrValueRhs = entry->ResultType;
548 }
549
550 if( ciAutoCast.RhsIsConst )
551 ciAutoCast.TypeOrValueRhs= callback( ciAutoCast.CompileTimeScope,
552 ciAutoCast.ArgsBegin + 1,
553 ciAutoCast.ArgsEnd );
554 else
555 ciAutoCast.CallbackRhs = callback;
556 }
557
558
559 return result;
560}
561
562}}} // namespace [alib::expressions::plugin]
563
bool IsSameType(const Box &other) const
Definition box.inl:580
const std::type_info & TypeID() const
Definition box.inl:780
const Placeholder & Data() const
Definition box.inl:692
#define ALIB_CALLER_NULLED
Definition alib.inl:1027
#define A_CHAR(STR)
#define ALIB_WARNINGS_RESTORE
Definition alib.inl:719
#define ALIB_WARNINGS_IGNORE_UNUSED_MACRO
Definition alib.inl:665
#define ALIB_DBG(...)
Definition alib.inl:853
#define ALIB_ASSERT_ERROR(cond, domain,...)
Definition alib.inl:1066
#define ALIB_DEBUG
Definition prepro.dox.md:21
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
const alib::boxing::Box & Type
StdVectorMA< Box >::iterator ArgIterator
@ Right
Denotes the right side of something.
@ Left
Denotes the left side of something.
@ Relative
Referring to a relative value.
LocalString< 256 > String256
Type alias name for TLocalString<character,256>.
lang::integer integer
Type alias in namespace alib.
Definition integers.inl:149
boxing::Box Box
Type alias in namespace alib.
Definition box.inl:1149
exceptions::Exception Exception
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2189
bool RhsIsConst
Input: denotes if rhs argument is constant value.
bool LhsIsConst
Input: Denotes if the lhs-argument is a constant value.
bool NonConstArgIsResult
Output: Used with optimization, see this struct's documentation for more information.
bool RhsIsConst
Input: Denotes if the rhs-argument is a constant value.
String & Operator
Input/Output: The binary operator symbol.
AString & Name
Input: The identifier name to search.
void AddFunctionsWithNonMatchingArguments(const String &signature)
String & Operator
Input/Output: The unary operator.
CallbackDecl Callback
Output: The native C++ callback function to be set by one of the plug-ins.
Compiler & Cmplr
The compiler that this plug-in is attached to.
StdVectorMA< Box > * Stack
Definition scope.inl:106
static ALIB_DLL Box Integer
Sample type-box for integer types. (Precisely for type integer.)
An entry of the field AutoCasts. Defines auto-casts for custom types.
Definition calculus.inl:699
Key type for operator hash maps Operators and OperatorAliases.
Definition calculus.inl:565
Key type for operator hash maps Operators and OperatorAliases.
Definition calculus.inl:358
void AddOperatorAlias(const String &alias, Type lhsType, Type rhsType, const String &op)
Definition calculus.cpp:107
HashMap< MonoAllocator, OperatorKey, std::tuple< CallbackDecl, Box, CTInvokable ALIB_DBG(, const char *) >, OperatorKey::Hash, OperatorKey::EqualTo > Operators
Definition calculus.inl:418
virtual ALIB_DLL bool TryCompilation(CIFunction &ciFunction) override
Definition calculus.cpp:336
void AddOperatorAliases(OperatorAliasTableEntry(&table)[TCapacity])
Definition calculus.inl:543
const std::tuple< String, lang::Side, Type, const Box &, const Box & > BinaryOpOptimizationsTableEntry
Definition calculus.inl:627
std::vector< ConstantIdentifierEntry > ConstantIdentifiers
List of identifiers that return constant values to be compiled by this plug-in.
Definition calculus.inl:277
void AddBinaryOpOptimizations(BinaryOpOptimizationsTableEntry(&table)[TCapacity])
Definition calculus.inl:636
HashMap< MonoAllocator, BinOpOptKey, Box, BinOpOptKey::Hash, BinOpOptKey::EqualTo > BinaryOperatorOptimizations
Definition calculus.inl:614
std::vector< AutoCastEntry > AutoCasts
List of auto-casts to be compiled by this plug-in.
Definition calculus.inl:763
void AddOperators(OperatorTableEntry(&table)[TCapacity])
Definition calculus.inl:510
std::vector< FunctionEntry > Functions
List of functions to be compiled by this plug-in.
Definition calculus.inl:337
void AddOperator(const String &op, Type lhsType, Type rhsType, CallbackDecl callback, const char *dbgCallbackName, Type resultType, CTInvokable cti)
Definition calculus.cpp:35
HashMap< MonoAllocator, OperatorKey, String, OperatorKey::Hash, OperatorKey::EqualTo > OperatorAliases
Definition calculus.inl:431
const std::tuple< String, Type, Type, String > OperatorAliasTableEntry
Definition calculus.inl:462
const std::tuple< String, Type, Type, CallbackDecl, Type, CTInvokable > OperatorTableEntry
Definition calculus.inl:449
detail::UnionIntegrals Integrals
Collection of integrals of different sizes, placed next to each other.
integer Array[2]
Array of 64-bit signed integrals of length two on 64-bit platform, one on a 32-bit platform.