Sha256: 05a2bcddcb5d1feb5dbb63ef43b1ec5cf2473780a5013dc8140e37b847d80972
Contents?: true
Size: 902 Bytes
Versions: 9
Compression:
Stored size: 902 Bytes
Contents
#include "tester.h" #include <vector> #include "rucy.h" using namespace Rucy; static std::vector<Xot::String> logs; void log (const char* str) { logs.push_back(str); } /* return all logs. */ RUCY_DEF0(all_logs) { std::vector<Value> a; for (size_t i = 0; i < logs.size(); ++i) a.push_back(logs[i].c_str()); return value(a.size(), &a[0]); } RUCY_END /* clcear all logs. */ RUCY_DEF0(clear_logs) { logs.clear(); } RUCY_END void Init_value (); void Init_exception (); void Init_function (); void Init_struct (); void Init_class (); extern "C" void Init_tester () { RUCY_TRY init(); Module mRucy = define_module("Rucy"); Module mTester = mRucy.define_module("Tester"); mTester.define_function("all_logs", all_logs); mTester.define_function("clear_logs", clear_logs); Init_value(); Init_exception(); Init_function(); Init_struct (); Init_class (); RUCY_CATCH }
Version data entries
9 entries across 9 versions & 1 rubygems