ALib C++ Library
Library Version: 2510 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
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 )
64{
66 ALIB_DBG( auto actBucketCount= Operators.BucketCount(); )
67
68 #define OP std::get<0>( *(table + i) )
69 #define LHS_TYPE std::get<1>( *(table + i) ).TypeID()
70 #define RHS_TYPE std::get<2>( *(table + i) ).TypeID()
71 #define CBFUNC std::get<3>( *(table + i) )
72 #define RESULTTYPE std::get<ALIB_REL_DBG(4,5)>( *(table + i) )
73 #define CTINVOKE std::get<ALIB_REL_DBG(5,6)>( *(table + i) )
74
75 for( size_t i= 0 ; i < length ; ++i )
76 {
77 #if ALIB_DEBUG
78 auto result=
79 Operators.EmplaceIfNotExistent(
80 OperatorKey { OP, LHS_TYPE, RHS_TYPE },
81 std::make_tuple( CBFUNC, RESULTTYPE, CTINVOKE
82 ALIB_DBG(, std::get<4>( *(table + i) )) ) );
83
84 ALIB_ASSERT_ERROR( result.second == true, "EXPR",// assert this was an insert!
85 "Binary operator '{}' already defined for types <{}> (aka {})\n"
86 " and <{}> (aka {}).",
87 OP, Cmplr.TypeName(std::get<1>( *(table+i))), &LHS_TYPE,
88 Cmplr.TypeName(std::get<2>( *(table+i))), &RHS_TYPE )
89 #else
90 Operators.EmplaceUnique(
91 OperatorKey { OP, LHS_TYPE, RHS_TYPE },
92 std::make_tuple( CBFUNC, RESULTTYPE, CTINVOKE
93 ALIB_DBG(, std::get<4>( *(table + i) )) ) );
94 #endif
95 }
96
97 ALIB_ASSERT_ERROR( actBucketCount == Operators.BucketCount(), "EXPR",
98 "This is rather an internal error of HashTable: The number of buckets "
99 "of hash map 'Operators' increased, although it was reserved above." )
100
101 #undef OP
102 #undef LHS_TYPE
103 #undef RHS_TYPE
104 #undef CBFUNC
105 #undef RESULTTYPE
106 #undef CTINVOKE
107}
108
109void Calculus::AddOperatorAlias( const String& alias, Type lhs, Type rhs, const String& op )
110{
111 #if ALIB_DEBUG
112 auto result=
113 OperatorAliases.EmplaceIfNotExistent( OperatorKey { alias, lhs.TypeID(), rhs.TypeID() },
114 op );
115
116 ALIB_ASSERT_ERROR( result.second == true, "EXPR",// assert this was an insert!
117 "Binary operator alias '{}' already defined for types <{}> (aka {})\n"
118 "and <{}> (aka {}).",
119 alias, Cmplr.TypeName( lhs ), &lhs.TypeID(),
120 Cmplr.TypeName( rhs ), &rhs.TypeID() )
121 #else
122 OperatorAliases.EmplaceUnique( OperatorKey { alias, lhs.TypeID(), rhs.TypeID() },
123 op );
124 #endif
125}
126
128{
130
131 #define ALIAS std::get<0>( *(table + i) )
132 #define LHS_TYPE std::get<1>( *(table + i) ).TypeID()
133 #define RHS_TYPE std::get<2>( *(table + i) ).TypeID()
134 #define OP std::get<3>( *(table + i) )
135
136 for( size_t i= 0 ; i < length ; ++i )
137 {
138 #if ALIB_DEBUG
139 auto result=
140 OperatorAliases.EmplaceIfNotExistent( OperatorKey { ALIAS, LHS_TYPE, RHS_TYPE }, OP );
141
142 ALIB_ASSERT_ERROR( result.second == true, "EXPR",// assert this was an insert!
143 "Binary operator alias '{}' already defined for types <{}> (aka {})\n"
144 "and <{}> (aka {}).",
145 ALIAS, Cmplr.TypeName( std::get<1>( *(table + i) ) ), &LHS_TYPE,
146 Cmplr.TypeName( std::get<2>( *(table + i) ) ), &RHS_TYPE )
147 #else
148 OperatorAliases.EmplaceUnique( OperatorKey { ALIAS, LHS_TYPE, RHS_TYPE },
149 OP );
150 #endif
151 }
152
153 #undef ALIAS
154 #undef LHS_TYPE
155 #undef RHS_TYPE
156 #undef OP
157}
158
159// #################################################################################################
160// Unary operators
161// #################################################################################################
163{
164 Box& arg= ciUnaryOp.CompileTimeScope.Stack->at(0);
165 OperatorKey key = { ciUnaryOp.Operator, arg.TypeID(), typeid(void) };
166 auto hashCode= OperatorKey::Hash()( key );
167
168 // search alias first
169 {
170 auto aliasIt= OperatorAliases.Find( key, hashCode );
171 if( aliasIt != OperatorAliases.end() )
172 ciUnaryOp.Operator= aliasIt.Mapped();
173 }
174
175
176 // search callback
177 auto opIt= Operators.Find( key, hashCode );
178 if( opIt == Operators.end() )
179 return false;
180
181 auto& op= opIt.Mapped();
182
183 // for constants, the callback might b invoked right away (optimizing cal out)
184 if( ciUnaryOp.ArgIsConst && std::get<2>(op) )
185 {
186 // calculate constant value
187 ciUnaryOp.TypeOrValue= std::get<0>(op)( ciUnaryOp.CompileTimeScope,
188 ciUnaryOp.ArgsBegin,
189 ciUnaryOp.ArgsEnd );
190ALIB_DBG(ciUnaryOp.DbgCallbackName= std::get<3>(op);)
191 ALIB_ASSERT_ERROR(ciUnaryOp.TypeOrValue.IsSameType(std::get<1>(op)), "EXPR",
192 "Type mismatch in definition of unary operator \"{}\" ({}) in plugin \"{}\".\n"
193 " Type specified: <{}> (aka {})\n"
194 " Type returned by callback: <{}> (aka {})",
195 ciUnaryOp.Operator, ciUnaryOp.DbgCallbackName, CompilerPlugin::Name,
196 CompilerPlugin::Cmplr.TypeName(std::get<1>(op)),
197 &std::get<1>(op).TypeID(),
198 CompilerPlugin::Cmplr.TypeName(ciUnaryOp.TypeOrValue),
199 &ciUnaryOp.TypeOrValue.TypeID() )
200 return true;
201 }
202 ciUnaryOp.Callback = std::get<0>(op);
203 ciUnaryOp.TypeOrValue = std::get<1>(op);
204ALIB_DBG(ciUnaryOp.DbgCallbackName= std::get<3>(op);)
205
206 return true;
207}
208
209// #################################################################################################
210// Binary operators
211// #################################################################################################
213{
215
216 #define OP std::get<0>( *(table + i) )
217 #define SIDE std::get<1>( *(table + i) )
218 #define CONSTVAL std::get<2>( *(table + i) )
219 #define CONSTTYPE std::get<2>( *(table + i) ).TypeID()
220 #define OTHERBOX std::get<3>( *(table + i) )
221 #define OTHERTYPE std::get<3>( *(table + i) ).TypeID()
222 #define RESULT std::get<4>( *(table + i) )
223
224 for( size_t i= 0 ; i < length ; ++i )
225 {
226 #if ALIB_DEBUG
227 auto result=
228 BinaryOperatorOptimizations.EmplaceIfNotExistent( BinOpOptKey { OP, SIDE, CONSTVAL, OTHERTYPE }, RESULT );
229
230 ALIB_ASSERT_ERROR( result.second == true, "EXPR", // assert this was an insert!
231 "Optimization already defined for operator \"{}\" with {!Lower}-hand "
232 "constant value \"{}\" of type <{}> (aka {}) and with "
233 "{!L}-hand type <{}> (aka {}).",
234 OP, SIDE, CONSTVAL, Cmplr.TypeName(CONSTVAL), &CONSTTYPE,
236 : lang::Side::Left, Cmplr.TypeName(OTHERBOX), &OTHERTYPE )
237 #else
238 BinaryOperatorOptimizations.EmplaceUnique( BinOpOptKey { OP, SIDE, CONSTVAL, OTHERTYPE },
239 RESULT );
240 #endif
241 }
242
243 #undef OP
244 #undef TYPE
245 #undef CONSTVAL
246 #undef RESULT
247}
248
249
251{
252 Box& lhs= * ciBinaryOp.ArgsBegin;
253 Box& rhs= *(ciBinaryOp.ArgsBegin + 1);
254
255 OperatorKey key = { ciBinaryOp.Operator, lhs.TypeID(), rhs.TypeID() };
256 auto hashCode= OperatorKey::Hash()( key );
257
258 // search alias first
259 if( ciBinaryOp.Operator == A_CHAR("=")
260 && HasBits( Cmplr.CfgCompilation, Compilation::AliasEqualsOperatorWithAssignOperator ) )
261 {
262 ciBinaryOp.Operator= A_CHAR("==");
263 }
264 else
265 {
266 auto aliasIt = OperatorAliases.Find( key, hashCode );
267 if( aliasIt != OperatorAliases.end() )
268 ciBinaryOp.Operator= aliasIt.Mapped();
269 }
270
271 #define CBFUNC std::get<0>(op)
272 #define RESULTTYPE std::get<1>(op)
273 #define CT_INVOKABLE std::get<2>(op)
274 #if ALIB_DEBUG
275 # define DBG_CB_NAME std::get<3>(op)
276 #endif
277
278// search callback
279 auto opIt = Operators.Find( key, hashCode );
280 if( opIt == Operators.end() )
281 return false;
282
283 auto& op= opIt.Mapped();
284
285 // if both are constant, the callback might be invoked right away (optimizing the call out)
286 if( ciBinaryOp.LhsIsConst && ciBinaryOp.RhsIsConst )
287 {
288 if( CT_INVOKABLE )
289 {
290 // calculate constant value
291 ciBinaryOp.TypeOrValue= CBFUNC ( ciBinaryOp.CompileTimeScope,
292 ciBinaryOp.ArgsBegin,
293 ciBinaryOp.ArgsEnd );
294ALIB_DBG( ciBinaryOp.DbgCallbackName= DBG_CB_NAME; )
295 ALIB_ASSERT_ERROR(ciBinaryOp.TypeOrValue.IsSameType(RESULTTYPE), "EXPR",
296 "Type mismatch in definition of binary operator \"{}\" ({}) of plugin \"{}\".\n"
297 " Type specified: <{}> (aka {})\n"
298 " Type returned by callback: <{}> (aka {})",
299 ciBinaryOp.Operator, ciBinaryOp.DbgCallbackName, CompilerPlugin::Name,
300 CompilerPlugin::Cmplr.TypeName(RESULTTYPE ),
301 &RESULTTYPE .TypeID(),
302 CompilerPlugin::Cmplr.TypeName(ciBinaryOp.TypeOrValue),
303 &ciBinaryOp.TypeOrValue.TypeID() )
304 return true;
305 }
306 }
307
308
309 // if one is constant, we may find an entry in BinaryOpConsL/RHSOptimizations
310 else if( ciBinaryOp.LhsIsConst || ciBinaryOp.RhsIsConst )
311 {
312 auto& nonConstType= (ciBinaryOp.LhsIsConst ? *(ciBinaryOp.ArgsBegin + 1 )
313 : *(ciBinaryOp.ArgsBegin ) ).TypeID();
314 auto& constValue= ciBinaryOp.LhsIsConst ? *(ciBinaryOp.ArgsBegin )
315 : *(ciBinaryOp.ArgsBegin + 1 );
316
317 auto entryIt= BinaryOperatorOptimizations.Find( { ciBinaryOp.Operator,
319 constValue,
320 nonConstType
321 } );
322 if( entryIt != BinaryOperatorOptimizations.end() )
323 {
324 // found! If it is an unset box, this tells us, that the result is the other side
325 // (identity operation). Otherwise it is a constant.
326 if( entryIt.Mapped().IsType<void>() )
327 ciBinaryOp.NonConstArgIsResult= true;
328 else
329 ciBinaryOp.TypeOrValue = entryIt.Mapped();
330 return true;
331 }
332 }
333
334
335 ciBinaryOp.Callback = CBFUNC;
336 ciBinaryOp.TypeOrValue = RESULTTYPE;
338 ciBinaryOp.DbgCallbackName= DBG_CB_NAME; )
339 return true;
340
341
342 #undef CBFUNC
343 #undef RESULTTYPE
344 #undef CT_INVOKABLE
345 #if ALIB_DEBUG
346 #undef DBG_CB_NAME
347 #endif
348}
349
350
351// #################################################################################################
352// Functions
353// #################################################################################################
355{
356 String& name= ciFunction.Name;
357
358 // search in constant identifiers
359 if( ciFunction.QtyArgs() == 0 )
360 {
361 for( auto& entry : ConstantIdentifiers )
362 {
363 if ( entry.Descriptor.Match( name ) )
364 {
365 // check for wrong parentheses
366 if( ciFunction.IsIdentifier
369 entry.Descriptor );
370
371 if( !ciFunction.IsIdentifier
374 entry.Descriptor );
375
376
377 // accept
378 ciFunction.Name.Reset( entry.Descriptor );
379 ciFunction.TypeOrValue= entry.Result;
380 return true;
381 }
382 }
383 }
384
385 // search in functions
386 for( auto& entry : Functions )
387 {
388 if( entry.Descriptor.Match( name ) )
389 {
390 // collect information about given and requested parameters
391 size_t qtyGiven = ciFunction.QtyArgs();
392 size_t qtyRequired = entry.SignatureLength;
393 bool isVariadic = false;
394 if( entry.SignatureLength > 0 && ( entry.Signature[entry.SignatureLength - 1] == nullptr
395 || entry.Signature[entry.SignatureLength - 1]->IsType<void>() ) )
396 {
397 isVariadic= true;
398 --qtyRequired;
399 }
400
401 size_t qtyShared = (std::min)( qtyGiven, qtyRequired );
402 bool sharedAreSameType = true;
403 for( size_t i= 0; i != qtyShared ; ++i )
404 sharedAreSameType&= ciFunction.Arg(i).IsSameType( *entry.Signature[i] );
405
406 // check if given parameter don't match
407 if( !sharedAreSameType
408 || ( isVariadic ? qtyGiven < qtyRequired
409 : qtyGiven != qtyRequired ) )
410 {
411 String256 buffer( entry.Descriptor );
412 if( qtyRequired )
413 Cmplr.WriteFunctionSignature( entry.Signature,
414 entry.SignatureLength,
415 buffer );
416 ciFunction.AddFunctionsWithNonMatchingArguments( buffer );
417
418 // search next
419 continue;
420 }
421
422 // check for wrong parentheses
423 if( ciFunction.IsIdentifier
424 && entry.Signature != nullptr
427 entry.Descriptor );
428
429 if( !ciFunction.IsIdentifier
430 && entry.Signature == nullptr
433 entry.Descriptor );
434
435 // accept
436 ciFunction.Name.Reset( entry.Descriptor );
437
438 if( !entry.Callback )
439 {
440 ciFunction.TypeOrValue = *entry.ResultType;
441 ALIB_DBG( ciFunction.DbgCallbackName = entry.DbgCallbackName; )
442 return true;
443 }
444
445 // for constants, the callback might b invoked right away (optimizing cal out)
446 if( ciFunction.AllArgsAreConst && entry.IsCTInvokable )
447 {
448 // calculate constant value
449 ciFunction.TypeOrValue = entry.Callback( ciFunction.CompileTimeScope,
450 ciFunction.ArgsBegin,
451 ciFunction.ArgsEnd );
452 ALIB_ASSERT_ERROR(ciFunction.TypeOrValue.IsSameType(*entry.ResultType), "EXPR",
453 "Type mismatch in definition of function \"{}\" ({}) in plugin \"{}\".\n"
454 " Type specified: <{}> (aka {})\n"
455 " Type returned by callback: <{}> (aka {})",
456 entry.Descriptor, entry.DbgCallbackName, CompilerPlugin::Name,
457 CompilerPlugin::Cmplr.TypeName(*entry.ResultType),
458 &entry.ResultType->TypeID(),
459 CompilerPlugin::Cmplr.TypeName(ciFunction.TypeOrValue),
460 &ciFunction.TypeOrValue.TypeID() )
461 ALIB_DBG( ciFunction.DbgCallbackName = entry.DbgCallbackName; )
462 return true;
463 }
464
465 ciFunction.Callback = entry.Callback;
466 ciFunction.TypeOrValue = *entry.ResultType;
467 ALIB_DBG( ciFunction.DbgCallbackName = entry.DbgCallbackName; )
468 return true;
469 }
470 }
471
472 return false;
473}
474
475// #################################################################################################
476// Auto-Casts
477// #################################################################################################
478//! @cond NO_DOX
479namespace {
480 Calculus::AutoCastEntry* findAutoCastEntry( std::vector<Calculus::AutoCastEntry>& table,
481 Calculus::CIAutoCast& ciAutoCast,
482 int argNo )
483 {
484 Box& valueToCast= *(ciAutoCast.ArgsBegin + argNo);
485
486 // main loop over all table entries
487 for( auto& entry : table )
488 {
489 // first check for source type
490 if( !entry.Type.IsSameType( valueToCast ) )
491 continue;
492
493 // operator included in list of accepted (if list given)?
494 bool operatorIsIn= true;
495 if( entry.OperatorsAccepted != nullptr
496 && entry.OperatorsAccepted->size() > 0 )
497 {
498 operatorIsIn= false;
499 for( auto& op : *entry.OperatorsAccepted )
500 if( op.Equals<NC>( ciAutoCast.Operator ) )
501 {
502 operatorIsIn= true;
503 break;
504 }
505 }
506
507 // operator included in decline list?
508 if( operatorIsIn
509 && entry.OperatorsDeclined != nullptr
510 && entry.OperatorsDeclined->size() > 0 )
511 {
512 for( auto& op : *entry.OperatorsDeclined )
513 if( op.Equals<NC>( ciAutoCast.Operator ) )
514 {
515 operatorIsIn= false;
516 break;
517 }
518 }
519
520 // found?
521 if( operatorIsIn )
522 return &entry;
523 }
524
525 return nullptr;
526 }
527
528 Box any2Int ( expressions::Scope&, ArgIterator argsBegin, ArgIterator )
529 {
530 return argsBegin->Data().Integrals.Array[0];
531 }
532
533} //anonymous namespace
534//! @endcond
535
536
538{
539 bool result= false;
540
541 //-------- cast first arg -------
542 AutoCastEntry* entry= findAutoCastEntry( AutoCasts, ciAutoCast, 0 );
543 if( entry != nullptr )
544 {
545 result= true;
547
548 CallbackDecl callback;
549 if( entry->Callback == nullptr )
550 {
551 callback = any2Int;
552ALIB_DBG( ciAutoCast.DbgCallbackName= "any2Int"; )
553 ciAutoCast.TypeOrValue = Types::Integer;
554 }
555 else
556 {
557 callback = entry->Callback;
558ALIB_DBG( ciAutoCast.DbgCallbackName= entry->DbgCallbackName; )
559 ciAutoCast.TypeOrValue = entry->ResultType;
560 }
561
562 if( ciAutoCast.IsConst )
563 ciAutoCast.TypeOrValue= callback( ciAutoCast.CompileTimeScope,
564 ciAutoCast.ArgsBegin,
565 ciAutoCast.ArgsEnd );
566 else
567 ciAutoCast.Callback = callback;
568 }
569
570 // no RHS given?
571 if( ciAutoCast.ArgsBegin + 1 >= ciAutoCast.ArgsEnd )
572 return result;
573
574 //-------- cast second arg (rhs) -------
575 entry= findAutoCastEntry( AutoCasts, ciAutoCast, 1 );
576 if( entry != nullptr )
577 {
578 //
579 result= true;
581
582 CallbackDecl callback;
583 if( entry->Callback == nullptr )
584 {
585 callback = any2Int;
586ALIB_DBG( ciAutoCast.DbgCallbackNameRhs= "any2Int"; )
587 ciAutoCast.TypeOrValueRhs = Types::Integer;
588 }
589 else
590 {
591 callback = entry->Callback;
592ALIB_DBG( ciAutoCast.DbgCallbackNameRhs= entry->DbgCallbackName; )
593 ciAutoCast.TypeOrValueRhs = entry->ResultType;
594 }
595
596 if( ciAutoCast.RhsIsConst )
597 ciAutoCast.TypeOrValueRhs= callback( ciAutoCast.CompileTimeScope,
598 ciAutoCast.ArgsBegin + 1,
599 ciAutoCast.ArgsEnd );
600 else
601 ciAutoCast.CallbackRhs = callback;
602 }
603
604
605 return result;
606}
607
608}}} // namespace [alib::expressions::plugin]
609
bool IsSameType(const Box &other) const
Definition box.inl:618
const std::type_info & TypeID() const
Definition box.inl:827
const Placeholder & Data() const
Definition box.inl:736
#define ALIB_CALLER_NULLED
Definition alib.inl:1010
#define A_CHAR(STR)
#define ALIB_WARNINGS_RESTORE
Definition alib.inl:705
#define ALIB_WARNINGS_IGNORE_UNUSED_MACRO
Definition alib.inl:655
#define ALIB_DBG(...)
Definition alib.inl:836
#define ALIB_ASSERT_ERROR(cond, domain,...)
Definition alib.inl:1049
#define ALIB_DEBUG
Definition prepro.md:21
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
StdVectorMono< Box >::iterator ArgIterator
const alib::boxing::Box & Type
@ 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:1216
exceptions::Exception Exception
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2381
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.
StdVectorMono< 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:734
Key type for operator hash maps Operators and OperatorAliases.
Definition calculus.inl:588
Key type for operator hash maps Operators and OperatorAliases.
Definition calculus.inl:365
void AddOperatorAlias(const String &alias, Type lhsType, Type rhsType, const String &op)
Definition calculus.cpp:109
HashMap< MonoAllocator, OperatorKey, std::tuple< CallbackDecl, Box, CTInvokable ALIB_DBG(, const char *) >, OperatorKey::Hash, OperatorKey::EqualTo > Operators
Definition calculus.inl:427
virtual ALIB_DLL bool TryCompilation(CIFunction &ciFunction) override
Definition calculus.cpp:354
void AddOperatorAliases(OperatorAliasTableEntry(&table)[TCapacity])
Definition calculus.inl:562
const std::tuple< String, lang::Side, Type, const Box &, const Box & > BinaryOpOptimizationsTableEntry
Definition calculus.inl:652
std::vector< ConstantIdentifierEntry > ConstantIdentifiers
List of identifiers that return constant values to be compiled by this plug-in.
Definition calculus.inl:282
void AddBinaryOpOptimizations(BinaryOpOptimizationsTableEntry(&table)[TCapacity])
Definition calculus.inl:663
HashMap< MonoAllocator, BinOpOptKey, Box, BinOpOptKey::Hash, BinOpOptKey::EqualTo > BinaryOperatorOptimizations
Definition calculus.inl:639
std::vector< AutoCastEntry > AutoCasts
List of auto-casts to be compiled by this plug-in.
Definition calculus.inl:798
void AddOperators(OperatorTableEntry(&table)[TCapacity])
Definition calculus.inl:521
std::vector< FunctionEntry > Functions
List of functions to be compiled by this plug-in.
Definition calculus.inl:342
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:440
const std::tuple< String, Type, Type, String > OperatorAliasTableEntry
Definition calculus.inl:471
const std::tuple< String, Type, Type, CallbackDecl, Type, CTInvokable > OperatorTableEntry
Definition calculus.inl:458
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 2 on 64-bit platform, 1 on a 32-bit platform.