From 7dfcc480ba1e19bd3232349fc733caef94034292 Mon Sep 17 00:00:00 2001 From: stainer_t Date: Mon, 8 Sep 2025 13:48:49 +0200 Subject: Initial commit from Polytechnique Montreal --- Yacs++/src/FACT.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 Yacs++/src/FACT.cxx (limited to 'Yacs++/src/FACT.cxx') diff --git a/Yacs++/src/FACT.cxx b/Yacs++/src/FACT.cxx new file mode 100755 index 0000000..1b25937 --- /dev/null +++ b/Yacs++/src/FACT.cxx @@ -0,0 +1,28 @@ +#include "FACT.hxx" +#include "Cle2000.hxx" +using namespace boost; using namespace std; using namespace ganlib; + +FACT::FACT() { + cout << "New FACT object constructed.'" << endl; +} + +void FACT::run(long a, long& b) { + // construct the lifo stack + LifoPtr ipLifo = LifoPtr(new Lifo()); + ipLifo->push("input_val",int_32(a)); + ipLifo->pushEmpty("output_val","I"); + + // call the procedure with in-out CLE-2000 variables + Cle2000Ptr ipCle2000 = Cle2000Ptr(new Cle2000("fact", 0, ipLifo)); + ipCle2000->exec(); + + // recover and erase the lifo stack + int_32 output_val; ipLifo->pop(output_val); + b = (long)output_val; + + // empty the lifo stack + while (ipLifo->getMax() > 0) ipLifo->pop(); + + // end of case ----------------------------------------------------------- + cout << "FACT::run: successful end of execution" << endl; +} -- cgit v1.2.3