37 bool doJ(
const std::string s);
61 const static int RMAX=10000;
93 bool defScript(std::string name,
int type, std::string code,
C++ representation of J array.
Definition jarray.h:25
long I
integer type, equivalent to J
Definition jarray.h:36
Interface to dynamically loaded J engine.
Definition jengine.h:13
jarray::I EPILOG(jarray::I oldtop)
Frees all memory, allocated since ttop was recorded.
bool isBuiltin(std::string name) const
Checks if given name was defined via defScript.
bool defAdverb(std::string name, amonad mf, adyad df)
defines J adverb, calling one (or both) of specified C++ functions.
static const int RMAX
Constant to denote the infinite rank.
Definition jengine.h:61
std::set< std::string > getBuiltins() const
Returns set of all names defined via defScript.
jarray(* adyad)(monad um, dyad ud, jarray x, jarray y)
Pointer to function, implementing dyadic variant of an adverb.
Definition jengine.h:23
static void initJlibrary(std::ostream &)
Loads and links J dynamic library, must be called once before this class is instantiated.
~jengine()
Frees J engine memory.
void * EPILOG(jarray::I oldtop, void *hdr)
Frees all memory, allocated since ttop was recorded.
jengine()
Initializes J engine.
bool doJ(const std::string s)
Executes J sentence.
const jarray get(const std::string name)
Retrieves a named array from J.
void FR(void *hdr)
Frees J array memory.
void * GA(const jarray::I t, const jarray::I n, const jarray::I r, const jarray::I *s)
Allocates J array.
jarray(* dyad)(jarray x, jarray y)
Pointer to function, implementing dyadic variant of a verb.
Definition jengine.h:19
bool set(const std::string name, jarray &value)
Assigns J name to the specified array.
bool defScript(std::string name, int type, std::string code, int mr=jengine::RMAX, int lr=jengine::RMAX, int rr=jengine::RMAX)
Defines a J script, given by a (possibly multi-line) string.
jarray(* amonad)(monad um, dyad ud, jarray y)
Pointer to function, implementing monadic variant of an adverb.
Definition jengine.h:21
jarray::I PROLOG()
Returns the top of J garbage collection stack.
friend class jarray
Definition jengine.h:15
bool defVerb(std::string name, monad mf, dyad df, int mr=RMAX, int lr=RMAX, int rr=RMAX)
Defines J verb, calling one (or both) of specified C++ functions.
jarray(* monad)(jarray y)
Pointer to function, implementing monadic variant of a verb.
Definition jengine.h:17
int getError()
J error code for the last unsuccessful operation.
bool ok()
Conveniently check that there was no error.
Definition jengine.h:56