*/
/*DOC:
===error===
- (error [#continue | :continue BOOL]) -> NIL
+ (error [#continue | :continue BOOL] [:error-var VARIABLE]) -> NIL
*/
//#AFUNC error ml_error
MNode* ml_error (MNode* cell, MlEnv* mlenv) {
MNode* arg = cell->cdr ();
bool cflag = false;
+ MNodePtr ev;
std::vector<MNode*> params;
std::vector<MNode*> keywords;
static paramList kwlist[] = {
{CharConst ("continue"), true},
+ {CharConst ("error-var"), false},
{NULL, 0, 0}
};
setParams (arg, 0, ¶ms, kwlist, &keywords, NULL);
if (keywords[0] && eval_bool (keywords[0], mlenv))
cflag = true;
+ if (keywords[1]) {
+ ev = eval (keywords[1], mlenv);
+ }
- mlenv->env->setErrorFlag ();
+ if (mlenv->env) {
+ mlenv->env->setErrorFlag ();
+ if (ev ()) {
+ if (ev ()->isCons ()) {
+ MNode* a = ev ();
+ while (a && a->isCons ()) {
+ mlenv->env->setErrorVar (to_string (a->car ()));
+ nextNode (a);
+ }
+ } else {
+ mlenv->env->setErrorVar (to_string (ev ()));
+ }
+ }
+ }
if (! cflag)
mlenv->breakProg ();
}
if (type.empty ()) {
- type = mimetype (getExt (filename));
+ if (! fmotor && dispname.length () > 0) {
+ type = mimetype (getExt (dispname));
+ } else {
+ type = mimetype (getExt (filename));
+ }
} else if (! checkMimeType (type)) {
type = mimetype (type);
}
bool ferr = false;
bool rc;
WikiMotorObjVec* cell;
+ static uregex re (CharConst ("^[a-z]{3,6}$"));
if (b == e)
return false;
fscript = true;
b ++;
return true;
- } else if (rc && cell->match (CharConst ("http"), CharConst ("https"))) {
+// } else if (rc && cell->match (CharConst ("http"), CharConst ("https"))) {
+ } else if (rc && cell->regmatch (re)) {
ustring proto = cell->dump ();
b ++;
cell = b->get ();
return false;
}
+bool WikiMotorObjVec::regmatch (const uregex& re) {
+ if (size () == 1) {
+ WikiMotorObj* a = operator [] (0).get ();
+ return a->regmatch (re);
+ }
+ return false;
+}
+
void WikiMotorObjVec::splitCharA (ustring::value_type ch, WikiMotorObjVecVec& out) {
int i;
WikiMotorObjVecPtr v;
virtual bool match (const ustring& t);
virtual bool match (const ustring& t1, const ustring& t2);
virtual bool matchHead (const char* t, size_t s);
+ virtual bool regmatch (const uregex& re);
virtual void splitCharA (ustring::value_type ch, WikiMotorObjVecVec& out);
virtual bool splitChar_keyword (ustring::value_type ch, ustring& name, WikiMotorObjVec& vvalue);
virtual ustring::value_type splitChar_keyword (ustring::value_type ch1, ustring::value_type ch2, ustring& name, WikiMotorObjVec& vvalue);
virtual bool matchHead (const char* t, size_t s) {
return false;
};
+ virtual bool regmatch (const uregex& re) {
+ return false;
+ };
virtual ustring typeName () = 0;
};
virtual bool matchHead (const char* t, size_t s) {
return ::matchHead (text, t, s);
};
+ virtual bool regmatch (const uregex& re) {
+ umatch m;
+ return usearch (text, m, re);
+ };
virtual ustring typeName () {
return ustring (CharConst ("text"));
};
virtual bool matchHead (const char* t, size_t s) {
return ::matchHead (html, t, s);
};
+ virtual bool regmatch (const uregex& re) {
+ umatch m;
+ return usearch (html, m, re);
+ };
virtual ustring typeName () {
return ustring (CharConst ("html"));
};