xo-procedure2: work on Primitive.apply_nocheck() + ARuntimeContext [WIP]
This commit is contained in:
parent
a4dd872a15
commit
f2139feafb
22 changed files with 667 additions and 25 deletions
|
|
@ -5,6 +5,9 @@ set(SELF_SRCS
|
|||
init_procedure2.cpp
|
||||
init_primitives.cpp
|
||||
DPrimitive.cpp
|
||||
IRuntimeContext_Any.cpp
|
||||
IProcedure_Any.cpp
|
||||
IProcedure_DPrimitive_gco_2_gco_gco.cpp
|
||||
# Add source files here, e.g.:
|
||||
# procedure2.cpp
|
||||
)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ IProcedure_Any::_valid
|
|||
// nonconst methods
|
||||
|
||||
auto
|
||||
IProcedure_Any::apply_nocheck(Opaque, obj<AAllocator>, const DArray *) -> obj<AGCObject>
|
||||
IProcedure_Any::apply_nocheck(Opaque, obj<ARuntimeContext>, const DArray *) -> obj<AGCObject>
|
||||
{
|
||||
_fatal();
|
||||
}
|
||||
|
|
|
|||
39
src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp
Normal file
39
src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IProcedure_DPrimitive_gco_2_gco_gco.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IProcedure_DPrimitive_gco_2_gco_gco::is_nary(const DPrimitive_gco_2_gco_gco & self) noexcept -> bool
|
||||
{
|
||||
return self.is_nary();
|
||||
}
|
||||
|
||||
auto
|
||||
IProcedure_DPrimitive_gco_2_gco_gco::n_args(const DPrimitive_gco_2_gco_gco & self) noexcept -> std::int32_t
|
||||
{
|
||||
return self.n_args();
|
||||
}
|
||||
|
||||
auto
|
||||
IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj<ARuntimeContext> rcx, const DArray * args) -> obj<AGCObject>
|
||||
{
|
||||
return self.apply_nocheck(rcx, args);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IProcedure_DPrimitive_gco_2_gco_gco.cpp */
|
||||
41
src/procedure2/IRuntimeContext_Any.cpp
Normal file
41
src/procedure2/IRuntimeContext_Any.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/** @file IRuntimeContext_Any.cpp
|
||||
*
|
||||
**/
|
||||
|
||||
#include "detail/IRuntimeContext_Any.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
using xo::facet::DVariantPlaceholder;
|
||||
using xo::facet::typeseq;
|
||||
using xo::facet::valid_facet_implementation;
|
||||
|
||||
void
|
||||
IRuntimeContext_Any::_fatal()
|
||||
{
|
||||
/* control here on uninitialized IAllocator_Any.
|
||||
* Initialized instance will have specific implementation type
|
||||
*/
|
||||
std::cerr << "fatal"
|
||||
<< ": attempt to call uninitialized"
|
||||
<< " IRuntimeContext_Any method"
|
||||
<< std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
typeseq
|
||||
IRuntimeContext_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
|
||||
|
||||
bool
|
||||
IRuntimeContext_Any::_valid
|
||||
= valid_facet_implementation<ARuntimeContext, IRuntimeContext_Any>();
|
||||
|
||||
// nonconst methods
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IRuntimeContext_Any.cpp */
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "init_primitives.hpp"
|
||||
#include "DPrimitive.hpp"
|
||||
#include <cmath>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
|
@ -23,6 +24,40 @@ namespace xo {
|
|||
return x - y;
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
obj<AGCObject>
|
||||
mul_any_any(obj<AGCObject> x_gco, obj<AGCObject> y_gco)
|
||||
{
|
||||
// PLACEHOLDER
|
||||
|
||||
// TODO:
|
||||
// 1. move this to xo-numeric2/ when available
|
||||
// 2. at that point will require polymorphic dispatch
|
||||
// on argument representations, analogous to dispatch
|
||||
// in FacetRegistry
|
||||
// 3. Need concept of a 'runtime context'.
|
||||
// This will need to be part of the AProcedure api
|
||||
// e.g. passed to apply_nocheck
|
||||
|
||||
typeseq x_tseq = x_gco._typeseq();
|
||||
typeseq y_tseq = y_gco._typeseq();
|
||||
|
||||
// FOR NOW: just test runtime values
|
||||
//
|
||||
if (x_tseq == typeseq::id<DFloat>()) {
|
||||
if (y_tseq == typeseq::id<DFloat>()) {
|
||||
// unusable placeholder allocator;
|
||||
obj<AAllocator> placeholder_mm;
|
||||
|
||||
// f64 * f64.
|
||||
double x = GCObjectConversion<double>::from_gco(placeholder_mm, x_gco);
|
||||
double y = GCObjectConversion<double>::from_gco(placeholder_mm, y_gco);
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
double
|
||||
mul_f64_f64(double x, double y) {
|
||||
return x * y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue