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