if (qcdr)
newMNodeCdr (cell);
x = new MNode;
- mlenv->push_linenum (x, linenum);
+ if (mlenv)
+ mlenv->push_linenum (x, linenum);
if (! scanCar (linenum, b, e, x)) {
status = S_MISSING_PAREN;
}
status = S_MISSING_PAREN;
Ep1:
if (l.isCons ()) {
- mlenv->push_linenum (l.cdr (), n);
+ if (mlenv)
+ mlenv->push_linenum (l.cdr (), n);
cell->set_car (l.cdr ());
}
}
newMNodeCdr (cell);
x = new MNode;
cell->set_car (x);
- mlenv->push_linenum (x, linenum);
+ if (mlenv)
+ mlenv->push_linenum (x, linenum);
scanQuote (linenum, b, e, x);
break;
case YYREN:
cons.cdr = NULL;
refcount = 0;
};
- MNode (bool v) {
- };
+ MNode (bool v) {};
~MNode () {
fdelete ();
};
return newMNode_str (new ustring (randomKey ()));
}
+
+/*DOC:
+===to-string===
+ (to-string OBJECT) -> STRING
+
+*/
+//#AFUNC to-string ml_to_string
+//#WIKIFUNC to-string
+MNode* ml_to_string (MNode* cell, MlEnv* mlenv) {
+ MNode* arg = cell->cdr ();
+ ustring text;
+
+ if (! arg)
+ throw (uErrorWrongNumber);
+ text = eval_str (arg->car (), mlenv);
+ nextNode (arg);
+ if (arg)
+ throw (uErrorWrongNumber);
+
+ return newMNode_str (new ustring (text));
+}
+
+/*DOC:
+===to-lisp===
+ (to-lisp STRING) -> OBJECT
+
+*/
+//#AFUNC to-lisp ml_to_lisp
+//#WIKIFUNC to-lisp
+MNode* ml_to_lisp (MNode* cell, MlEnv* mlenv) {
+ MNode* arg = cell->cdr ();
+ ustring text;
+ MotorSexp ml (NULL);
+
+ if (! arg)
+ throw (uErrorWrongNumber);
+ text = eval_str (arg->car (), mlenv);
+ nextNode (arg);
+ if (arg)
+ throw (uErrorWrongNumber);
+
+ ml.scan (text);
+
+ return mlenv->retval = ml.top.cdr ();
+}
MNode* ml_ellipsis (MNode* cell, MlEnv* mlenv);
MNode* ml_string_format (MNode* cell, MlEnv* mlenv);
MNode* ml_random_key (MNode* cell, MlEnv* mlenv);
+MNode* ml_to_string (MNode* cell, MlEnv* mlenv);
+MNode* ml_to_lisp (MNode* cell, MlEnv* mlenv);
#endif /* ML_STRING_H */