49 if (ptr ==
sigAdd)
return "+";
50 if (ptr ==
sigSub)
return "-";
51 if (ptr ==
sigMul)
return "*";
52 if (ptr ==
sigDiv)
return "/";
53 if (ptr ==
sigRem)
return "%";
55 if (ptr ==
sigAND)
return "&";
56 if (ptr ==
sigOR )
return "|";
57 if (ptr ==
sigXOR)
return "^";
62 if (ptr ==
sigLT)
return "<";
63 if (ptr ==
sigLE)
return "<=";
64 if (ptr ==
sigGT)
return ">";
65 if (ptr ==
sigGE)
return ">=";
66 if (ptr ==
sigEQ)
return "==";
67 if (ptr ==
sigNE)
return "!=";
96 static void streambinop(ostream& fout,
Tree t1,
const char* op,
Tree t2,
int curPriority,
int upPriority)
98 if (upPriority > curPriority) fout <<
'(';
99 fout <<
boxpp(t1,curPriority) << op <<
boxpp(t2,curPriority);
100 if (upPriority > curPriority) fout <<
')';
108 while (!
isNil(lhs)) {
113 fout <<
") => " <<
boxpp(rhs) <<
"; ";
123 return "\"" + string(
tree2str(t)) +
"\"";
155 Tree t1, t2, t3, ff, label, cur,
min,
max, step, type,
name, file, arg,
156 body, fun, args, abstr, genv, vis, lenv, ldef, slot,
157 ident, rules, filename;
164 if (xt) fout << xt->
name();
192 for (
int i = 0; i <
ffarity(ff); i++) {
225 <<
boxpp(cur) <<
", "
226 <<
boxpp(min) <<
", "
227 <<
boxpp(max) <<
", "
228 <<
boxpp(step)<<
')';
233 <<
boxpp(cur) <<
", "
234 <<
boxpp(min) <<
", "
235 <<
boxpp(max) <<
", "
236 <<
boxpp(step)<<
')';
250 <<
boxpp(min) <<
", "
251 <<
boxpp(max) <<
')';
256 <<
boxpp(min) <<
", "
257 <<
boxpp(max) <<
')';
262 <<
boxpp(cur) <<
", "
263 <<
boxpp(min) <<
", "
264 <<
boxpp(max) <<
", "
265 <<
boxpp(step)<<
')';
287 for (
size_t i=0; i<
box->
arity(); i++) {
312 fout <<
"environment";
315 fout <<
"closure[" <<
boxpp(abstr)
316 <<
", genv = " <<
envpp(genv)
317 <<
", lenv = " <<
envpp(lenv)
336 fout <<
"\\(" <<
boxpp(slot) <<
").(" <<
boxpp(body) <<
")";
342 while (!
isNil(rules)) {
351 fout <<
"<" <<
boxpp(ident) <<
">";
356 fout <<
boxpp(ident);
361 fout <<
"PM[" <<
box <<
"]";
375 cerr <<
"Error in box::print() : " << *
box <<
" is not a valid box" << endl;
388 const char* sep =
"";
Tree(* prim2)(Tree x, Tree y)
bool isBoxIPar(Tree t, Tree &x, Tree &y, Tree &z)
Tree sigAND(Tree x, Tree y)
bool isImportFile(Tree s, Tree &filename)
const char * prim3name(CTree *(*ptr)(CTree *, CTree *, CTree *))
bool isBoxSeq(Tree t, Tree &x, Tree &y)
bool isBoxWithLocalDef(Tree t, Tree &body, Tree &ldef)
const char * prim2name(CTree *(*ptr)(CTree *, CTree *))
bool isBoxOutputs(Tree t, Tree &x)
bool isBoxIProd(Tree t, Tree &x, Tree &y, Tree &z)
bool isBoxPatternMatcher(Tree s)
Tree sigEQ(Tree x, Tree y)
int tree2int(Tree t)
if t has a node of type int, return it otherwise error
bool isBoxSplit(Tree t, Tree &x, Tree &y)
Tree sigXOR(Tree x, Tree y)
Tree sigGT(Tree x, Tree y)
ostream & print(ostream &fout) const
bool isBoxComponent(Tree s, Tree &filename)
Tree sigGE(Tree x, Tree y)
Tree(* prim4)(Tree w, Tree x, Tree y, Tree z)
Tree sigSelect2(Tree selector, Tree s1, Tree s2)
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Tree sigWriteReadTable(Tree n, Tree init, Tree widx, Tree wsig, Tree ridx)
Tree sigPrefix(Tree t0, Tree t1)
bool isBoxAccess(Tree t, Tree &exp, Tree &id)
bool isBoxHBargraph(Tree s)
bool isBoxRec(Tree t, Tree &x, Tree &y)
double max(double x, double y)
Tree ffsignature(Tree ff)
Tree(* prim3)(Tree x, Tree y, Tree z)
Tree(* prim5)(Tree v, Tree w, Tree x, Tree y, Tree z)
const char * ffincfile(Tree ff)
static string type2str(int type)
bool isBoxSymbolic(Tree t)
Tree sigSub(Tree x, Tree y)
bool isBoxISum(Tree t, Tree &x, Tree &y, Tree &z)
bool isBoxEnvironment(Tree s)
Tree sigLeftShift(Tree x, Tree y)
Tree sigRightShift(Tree x, Tree y)
static string tree2quotedstr(Tree t)
bool isBoxPar(Tree t, Tree &x, Tree &y)
bool isBoxHSlider(Tree s)
Tree sigNE(Tree x, Tree y)
static void printRule(ostream &fout, Tree rule)
bool isBoxVBargraph(Tree s)
bool isBoxWaveform(Tree s)
bool isClosure(Tree t, Tree &abstr, Tree &genv, Tree &vis, Tree &lenv)
Tree sigAdd(Tree x, Tree y)
Tree sigAttach(Tree t0, Tree t1)
bool isBoxCheckbox(Tree s)
virtual ostream & print(ostream &fout) const
static void streambinop(ostream &fout, Tree t1, const char *op, Tree t2, int curPriority, int upPriority)
Tree sigLE(Tree x, Tree y)
Tree sigFloatCast(Tree t)
Tree sigFixDelay(Tree t0, Tree t1)
int arity() const
return the number of branches (subtrees) of a tree
Tree sigLT(Tree x, Tree y)
const char * name(Symbol *sym)
Returns the name of a symbol.
Tree sigRem(Tree x, Tree y)
bool isBoxVSlider(Tree s)
const char * fflibfile(Tree ff)
bool isBoxNumEntry(Tree s)
bool isBoxInputs(Tree t, Tree &x)
void * getUserData(Symbol *sym)
Returns user data.
bool isBoxISeq(Tree t, Tree &x, Tree &y, Tree &z)
bool isBoxPatternVar(Tree s, Tree &id)
Tree sigMul(Tree x, Tree y)
int ffargtype(Tree t, int i)
Tree sigSelect3(Tree selector, Tree s1, Tree s2, Tree s3)
Tree sigOR(Tree x, Tree y)
const char * prim5name(CTree *(*ptr)(CTree *, CTree *, CTree *, CTree *, CTree *))
const char * prim1name(CTree *(*ptr)(CTree *))
bool isBoxMerge(Tree t, Tree &x, Tree &y)
Tree sigReadOnlyTable(Tree n, Tree init, Tree ridx)
double min(double x, double y)
Tree sigDiv(Tree x, Tree y)
const char * prim0name(CTree *(*ptr)())
const char * tree2str(Tree t)
if t has a node of type symbol, return its name otherwise error
Tree branch(int i) const
return the ith branch (subtree) of a tree
const char * prim4name(CTree *(*ptr)(CTree *, CTree *, CTree *, CTree *))