OSDN Git Service

Change the allowed resource file path name.
authorvisor <visor@users.sourceforge.jp>
Sun, 9 Sep 2012 15:28:59 +0000 (00:28 +0900)
committervisor <visor@users.sourceforge.jp>
Sun, 9 Sep 2012 15:28:59 +0000 (00:28 +0900)
Change the eq function specification.
Bug fix in wiki.
Update the motor-file function.

22 files changed:
ext/ml-memcached.cc
ext/ml-sqlite3.cc
ext/ml-tcpserver.cc
lib/expr.cc
lib/ml.cc
lib/ml.h
lib/mlenv.h
lib/motorenv.cc
lib/motorenv.h
lib/util_check.cc
modules/ml-bool.cc
modules/ml-cookielogin.cc
modules/ml-db.cc
modules/ml-debug.cc
modules/ml-http.cc
modules/ml-include.cc
modules/ml-motor.cc
modules/ml-sendmail.cc
modules/ml-store.cc
modules/ml-struct.cc
modules/ml-variable.cc
wiki/wikiformat.cc

index f043159..5fa5a65 100644 (file)
@@ -53,10 +53,8 @@ MNode*  ml_memcached (MNode* cell, MlEnv* mlenv) {
 
     mlenv->setMStack (&obj);
     ans = progn (rest, mlenv);
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
 
     return mlenv->retval = ans ();
 }
index 9ffbebf..f285d7b 100644 (file)
@@ -369,10 +369,8 @@ MNode*  ml_sqlite3 (MNode* cell, MlEnv* mlenv) {
            obj.finit = false;
        }
        ans = progn (rest, mlenv);
-       if (mlenv->breaksym ()
-           && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-           mlenv->setBreaksym (NULL);
-       }
+//     if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+       mlenv->stopBreak (cell->car ());
     }
 
     return mlenv->retval = ans ();
@@ -614,8 +612,9 @@ MNode*  ml_sqlite3_begin_transaction (MNode* cell, MlEnv* mlenv, MLFunc* mobj) {
                static const ustring  q (CharConst ("rollback"));
                obj->fbegin = false;
                obj->sql_s (q);
-               if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) {
-                   mlenv->setBreaksym (NULL);
+//             if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) {
+//                 mlenv->setBreaksym (NULL);
+               if (mlenv->stopBreak (cell->car ())) {
                    obj->retry --;
                    if (obj->retry > 0) {
                        fexit = false;
index f392430..a59f46d 100644 (file)
@@ -165,10 +165,8 @@ MNode*  ml_dbtcpserver (MNode* cell, MlEnv* mlenv) {
        mlenv->setMStack (&obj);
        obj.opendb ();
        ans = progn (arg, mlenv);
-       if (mlenv->breaksym ()
-           && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-           mlenv->setBreaksym (NULL);
-       }
+//     if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+       mlenv->stopBreak (cell->car ());
        obj.closedb ();
     }
 
index 7950caa..fff0675 100644 (file)
@@ -479,11 +479,8 @@ MNode*  execDefun (MlEnv* mlenv, MNode* lambda, MNode* values, const ustring& na
     }
 
     ans = progn (body, mlenv);
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil ()
-           || eq (mlenv->breaksym (), lambda->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), lambda->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (lambda->car ());
     mlenv->endLocal ();
 
     return ans.release ();
index b7695ae..7db498f 100644 (file)
--- a/lib/ml.cc
+++ b/lib/ml.cc
@@ -270,6 +270,49 @@ ustring  MNode::dump_string_short () {
     return ellipsis (u, cLOGSHORTSIZE);
 }
 
+bool  equal (MNode* a, MNode* b) {
+    if (a && b) {
+       if (a->type == b->type) {
+           switch (a->type) {
+           case MNode::MC_NIL:
+               return true;
+           case MNode::MC_CONS:
+               if (a->car () == b->car () && a->cdr () == b->cdr ())
+                   return true;
+               else
+                   return false;
+           case MNode::MC_STR:
+               if (*a->str == *b->str)
+                   return true;
+               else
+                   return false;
+           case MNode::MC_SYM:
+               if (*a->sym == *b->sym)
+                   return true;
+               else
+                   return false;
+           case MNode::MC_DOUBLE:
+               if (a->real == b->real)
+                   return true;
+               else
+                   return false;
+           default:
+               assert (0);
+           }
+       } else {
+           return false;
+       }
+    } else if (a == NULL) {
+       if (b == NULL) {
+           return true;
+       } else {
+           return b->isNil ();
+       }
+    } else {                   /* b == NULL */
+       return a->isNil ();
+    }
+}
+
 void  MotorSexp::scan (const ustring& text, bool skip) {
     uiterator  b = text.begin ();
     uiterator  e = text.end ();
index bfc590e..3fe6c84 100644 (file)
--- a/lib/ml.h
+++ b/lib/ml.h
@@ -158,44 +158,7 @@ inline bool  isNil (MNode* a) {
     return (a == NULL || a->isNil ());
 }
 
-inline bool  eq (MNode* a, MNode* b) {
-    if (a && b) {
-       if (a->type == b->type) {
-           switch (a->type) {
-           case MNode::MC_NIL:
-               return true;
-           case MNode::MC_CONS:
-               if (a->car () == b->car () && a->cdr () == b->cdr ())
-                   return true;
-               else
-                   return false;
-           case MNode::MC_STR:
-               if (*a->str == *b->str)
-                   return true;
-               else
-                   return false;
-           case MNode::MC_SYM:
-               if (*a->sym == *b->sym)
-                   return true;
-               else
-                   return false;
-           case MNode::MC_DOUBLE:
-               if (a->real == b->real)
-                   return true;
-               else
-                   return false;
-           default:
-               assert (0);
-           }
-       } else {
-           return false;
-       }
-    } else if (a == NULL && b == NULL) {
-       return true;
-    } else {
-       return false;
-    }
-};
+extern bool  equal (MNode* a, MNode* b);
 
 inline double  to_double (MNode* c) {
     if (c)
index e29609c..a0de12e 100644 (file)
@@ -191,6 +191,16 @@ class  MlEnv {
     virtual void  setBreakval (MNode* p) {
        mlPool->breakval = p;
     };
+    virtual bool  stopBreak (MNode* fnname) {
+       if (breaksym ()
+           && (breaksym ()->isNil ()
+//             || eq (breaksym (), fnname))) {
+               || equal (breaksym (), fnname))) {
+           setBreaksym (NULL);
+           return true;
+       }
+       return false;
+    };
 #ifdef DEBUG
     virtual void  setNodebugFunc (const ustring& name) {
        mlPool->nodebugFunc.set (name);
index b8529cf..7cd3b20 100644 (file)
@@ -408,15 +408,6 @@ void  MotorEnv::doML (const ustring& file) {
                progn_ex (&ml.top, mlenv);
            }
            catch (ustring& msg) {
-#if 0
-               if (log) {
-                   if (mlenv->currentCell ()) {
-                       mlenv->logLinenum (mlenv->currentCell ());
-                       *log << mlenv->currentCell ()->dump_string_short () << ": ";
-                   }
-                   *log << logText (msg) << "\n";
-               }
-#endif
                logMessage (msg);
                mlenv->currentCell = NULL;
            }
@@ -446,34 +437,32 @@ void  MotorEnv::doMotor () {
 void  MotorEnv::doMotor (const ustring& file, const ustring& type, MotorOutput* out) {
     ustring  f;
 
-    if (out == NULL)
-       out = output;
     if (file == uDash) {
        f = appenv->scriptName ();
        if (f.size () == 0)
            return;
-       motor->compile_file (f, true);
+//     motor->compile_file (f, true);
+       doMotorFile (f, true, type, out);
     } else if (path_resource (file, f)) {
        if (f.size () == 0)
            return;
-       motor->compile_file (f);
+//     motor->compile_file (f);
+       doMotorFile (f, false, type, out);
     } else {
        return;
     }
+}
+
+void  MotorEnv::doMotorFile (const ustring& file, bool skipHead, const ustring& type, MotorOutput* out) {
+    if (out == NULL)
+       out = output;
+
+    motor->compile_file (file, skipHead);
 
     try {
        standardResponse (type, out->charset (), uEmpty, false);
        motor->output (out, this);
     } catch (ustring& msg) {
-#if 0
-       if (log) {
-           if (mlenv->currentCell ()) {
-               mlenv->logLinenum (mlenv->currentCell ());
-               *log << mlenv->currentCell ()->dump_string_short () << ": ";
-           }
-           *log << logText (msg) << "\n";
-       }
-#endif
        logMessage (msg);
        mlenv->currentCell = NULL;
     }
index 2ff334f..a55f820 100644 (file)
@@ -85,6 +85,7 @@ class  MotorEnv {
        doMotor (file, mimetype);
     };
     virtual void  doMotor (const ustring& file, const ustring& type, MotorOutput* out = NULL);
+    virtual void  doMotorFile (const ustring& file, bool skipHead, const ustring& type, MotorOutput* out = NULL);
     virtual void  outputFile (const ustring& src, const ustring& type);
     virtual void  outputFile (const ustring& src, const ustring& type, bool finline, const ustring& dispname);
     virtual void  standardResponse () {
index 8f8f260..b005eef 100644 (file)
@@ -38,7 +38,8 @@ bool  checkFilename (const ustring& name) {
 }
 
 bool  checkResourceName (const ustring& name) {
-    static uregex  re ("^(" kWNAME "{0,127}/)*" kWNAME "{0,127}(\\." kWORD "{1,16})?$");
+//    static uregex  re ("^(" kWNAME "{0,127}/)*" kWNAME "{0,127}(\\." kWORD "{1,16})?$");
+    static uregex  re ("^([a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}/)*[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}(\\." kWORD "{1,16})?$");
 
     return (checkRe (name, re));
 }
index 8002227..12915a3 100644 (file)
@@ -402,26 +402,25 @@ MNode*  ml_le (MNode* cell, MlEnv* mlenv) {
 
 /*DOC:
 ===eq===
- (eq TEXT TEXT...) -> 1 or NIL
+ (eq OBJECT OBJECT...) -> 1 or NIL
 
-string equal
+Check if all args are the same lisp object.
 
 */
 //#AFUNC       eq      ml_eq
 //#WIKIFUNC    eq
 MNode*  ml_eq (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
-    ustring  v1, v2;
+    MNodePtr  v1, v2;
 
     if (! arg)
        throw (uErrorWrongNumber);
 
-    v1 = eval_str (arg->car (), mlenv);
+    v1 = eval (arg->car (), mlenv);
     nextNode (arg);
     while (arg) {
-       v2 = eval_str (arg->car (), mlenv);
-       if (v1 == v2) {
-           v1 = v2;
+       v2 = eval (arg->car (), mlenv);
+       if (equal (v1 (), v2 ())) {
        } else {
            return newMNode_bool (false);
        }
@@ -432,30 +431,30 @@ MNode*  ml_eq (MNode* cell, MlEnv* mlenv) {
 
 /*DOC:
 ===ne===
- (ne TEXT TEXT) -> 1 or NIL
+ (ne OBJECT OBJECT) -> 1 or NIL
 
-string not equal
+object not equal
 
 */
 //#AFUNC       ne      ml_ne
 //#WIKIFUNC    ne
 MNode*  ml_ne (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
-    ustring  v1, v2;
+    MNodePtr  v1, v2;
 
     if (! arg)
        throw (uErrorWrongNumber);
 
-    v1 = eval_str (arg->car (), mlenv);
+    v1 = eval (arg->car (), mlenv);
     nextNode (arg);
     if (! arg)
        throw (uErrorWrongNumber);
-    v2 = eval_str (arg->car (), mlenv);
+    v2 = eval (arg->car (), mlenv);
     nextNode (arg);
     if (arg)
        throw (uErrorWrongNumber);
 
-    return newMNode_bool (v1 != v2);
+    return newMNode_bool (! equal (v1 (), v2 ()));
 }
 
 /*DOC:
index ba027cf..cac4e36 100644 (file)
@@ -168,10 +168,8 @@ MNode*  ml_cookielogin (MNode* cell, MlEnv* mlenv) {
                throw (msg);
            }
        }
-       if (mlenv->breaksym ()
-           && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-           mlenv->setBreaksym (NULL);
-       }
+//     if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+       mlenv->stopBreak (cell->car ());
     }
 
     return ans.release ();
index 6f67002..45b16c7 100644 (file)
@@ -181,10 +181,8 @@ static MNode*  ml_db_sub (MNode* cell, MlEnv* mlenv, MLDb* obj, DBFUNC fn) {
            throw (msg);
        }
     }
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
     return mlenv->retval = ans ();
 }
 
index 3dce15f..d95e37b 100644 (file)
@@ -44,10 +44,8 @@ MNode*  ml_no_debug (MNode* cell, MlEnv* mlenv) {
            }
        }
     }
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
 
     return ans.release ();
 }
index 715076f..4836cf8 100644 (file)
@@ -503,10 +503,8 @@ MNode*  ml_http_get (MNode* cell, MlEnv* mlenv) {
            throw (msg);
        }
     }
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
 
     return ans.release ();
 }
index de10628..7c7842c 100644 (file)
@@ -60,8 +60,8 @@ MNode*  ml_include (MNode* cell, MlEnv* mlenv) {
                    if (ml.top.isCons ()) {
                        ans = progn (&ml.top, mlenv);
                        if (mlenv->breaksym ()) {
-                           if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-                               mlenv->setBreaksym (NULL);
+//                         if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL);
+                           mlenv->stopBreak (cell->car ());
                            rest = NULL;
                        }
                    }
index 6f48616..7135826 100644 (file)
@@ -1,5 +1,6 @@
 #include "ml-motor.h"
 #include "ml.h"
+#include "ml-store.h"
 #include "mlenv.h"
 #include "motorenv.h"
 #include "motoroutput.h"
@@ -53,14 +54,6 @@ MNode*  ml_output_header (MNode* cell, MlEnv* mlenv) {
        type = mimetype (type);
 
     if (! mlenv->env->responseDone) {
-#if 0
-       if (name.length () > 0)
-           mlenv->env->standardResponse (type, finline, name);
-       else if (matchHead (type, CharConst ("text/")) && charset.length () > 0)
-           mlenv->env->standardResponse (type, charset);
-       else
-           mlenv->env->standardResponse (type);
-#endif
        mlenv->env->standardResponse (type, charset, name, finline);
     }
 
@@ -69,7 +62,8 @@ MNode*  ml_output_header (MNode* cell, MlEnv* mlenv) {
 
 /*DOC:
 ===motor-file===
- (motor-file HTMLFILE [:type MIMETYPE] [#error | :error BOOL] [:code ENCODING] [#continue | :continue BOOL]) -> NIL
+ (motor-file HTMLFILE [:type MIMETYPE] [#error | :error BOOL] [:code ENCODING] [#continue | :continue BOOL]
+               [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL]) -> NIL
 
 
 */
@@ -81,49 +75,65 @@ MNode*  ml_motor_file (MNode* cell, MlEnv* mlenv) {
     bool  ferr = false;
     ustring  encoding;
     bool  cflag = false;
+    StoreType  storetype (mlenv);
     std::vector<MNode*>  params;
     std::vector<MNode*>  keywords;
     static paramList  kwlist[] = {
-       {CharConst ("type"), false},
-       {CharConst ("error"), true},
-       {CharConst ("code"), false},
-       {CharConst ("continue"), true},
+       {CharConst ("type"), false}, // 0
+       {CharConst ("error"), true}, // 1
+       {CharConst ("code"), false}, // 2
+       {CharConst ("continue"), true}, // 3
+       {CharConst ("serial"), true}, // 4
+       {CharConst ("named"), true}, // 5
+       {CharConst ("static"), true}, // 6
        {NULL, 0, 0}
     };
 
+    storetype.setStatic ();
     setParams (arg, 1, &params, kwlist, &keywords, NULL, true);
     file = eval_str (params[0], mlenv);
-    if (keywords[0]) {
+    if (keywords[0]) {         // type
        type = eval_asciiword (keywords[0], mlenv);
        if (! checkMimeType (type))
            type.resize (0);
     }
-    if (keywords[1])
+    if (keywords[1])           // error
        ferr = eval_bool (keywords[1], mlenv);
-    if (keywords[2])
+    if (keywords[2])           // code
        encoding = eval_str (keywords[2], mlenv);
-    if (keywords[3] && eval_bool (keywords[3], mlenv))
+    if (keywords[3] && eval_bool (keywords[3], mlenv)) // continue
        cflag = true;
+    if (eval_bool (keywords[4], mlenv))        // serial
+       storetype.setSerial ();
+    if (eval_bool (keywords[5], mlenv))        // named
+       storetype.setNamed ();
+    if (eval_bool (keywords[6], mlenv))        // static
+       storetype.setStatic ();
 
     if (file.size () == 0)
        throw (uErrorFilenameEmpty);
-    if (!checkResourceName (file))
-       throw (file + uErrorBadFile);
+//    if (!checkResourceName (file))
+//     throw (file + uErrorBadFile);
+    file = storetype.src (mlenv, file);
 
     if (ferr)
        mlenv->env->setErrorFlag ();
     if (encoding.empty ()) {
        if (type.size () == 0) {
-           mlenv->env->doMotor (file);
+//         mlenv->env->doMotor (file);
+           mlenv->env->doMotorFile (file, false, mlenv->env->mimetype);
        } else {
-           mlenv->env->doMotor (file, type);
+//         mlenv->env->doMotor (file, type);
+           mlenv->env->doMotorFile (file, false, type);
        }
     } else {
        MotorOutputIConvOStream  out (encoding.c_str ());
        if (type.size () == 0) {
-           mlenv->env->doMotor (file, mlenv->env->mimetype, &out);
+//         mlenv->env->doMotor (file, mlenv->env->mimetype, &out);
+           mlenv->env->doMotorFile (file, false, mlenv->env->mimetype, &out);
        } else {
-           mlenv->env->doMotor (file, type, &out);
+//         mlenv->env->doMotor (file, type, &out);
+           mlenv->env->doMotorFile (file, false, type, &out);
        }
     }
 
index c37a94d..107600c 100644 (file)
@@ -261,6 +261,7 @@ MNode*  ml_mail (MNode* cell, MlEnv* mlenv) {
 
 */
 //#AFUNC       mail-address-p  ml_mail_address_p
+//#WIKIFUNC    mail-address-p
 MNode*  ml_mail_address_p (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
     ustring  str;
index e9cf3cf..e8d91d4 100644 (file)
@@ -604,7 +604,8 @@ MNode*  ml_read_file (MNode* cell, MlEnv* mlenv) {
 
 /*DOC:
 ===write-file===
- (write-file FILENAME STRING [#serial | #named | :serial BOOL | :named BOOL] [:code ENCODING] [#crlf | :crlf BOOL]) -> NIL
+ (write-file FILENAME STRING [#serial | #named | :serial BOOL | :named BOOL] [:code ENCODING]
+               [#crlf | :crlf BOOL]) -> NIL
 
 */
 //#AFUNC       write-file      ml_write_file
@@ -757,10 +758,8 @@ MNode*  ml_datastore_progn (MNode* cell, MlEnv* mlenv) {
            throw (msg);
        }
     }
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
 
     return ans.release ();
 }
@@ -1058,13 +1057,10 @@ public:
            setParams (arg, 1, &params, kwlist_file, &keywords, NULL);
        filename = eval_str (params[0], mlenv);
        if (eval_bool (keywords[0], mlenv))     // serial
-//         storetype = F_SERIAL;
            storetype.setSerial ();
        if (eval_bool (keywords[1], mlenv))     // named
-//         storetype = F_NAMED;
            storetype.setNamed ();
        if (eval_bool (keywords[2], mlenv))     // static
-//         storetype = F_STATIC;
            storetype.setStatic ();
        if (keywords[3])                        // type
            type = eval_str (keywords[3], mlenv);
@@ -1084,32 +1080,14 @@ public:
        } else if (! checkMimeType (type)) {
            type = mimetype (type);
        }
-
-#if 0
-       switch (storetype) {
-       case F_SERIAL:
-           src = mlenv->env->path_store_file (filename);
-           break;
-       case F_NAMED:
-           src = mlenv->env->path_storage_file (filename);
-           break;
-       case F_STATIC:
-           if (mlenv->env->path_resource (filename, src)) {
-           } else {
-               throw (filename + uErrorNotFound);
-           }
-           break;
-       default:
-           throw (uErrorNoStore);
-       }
-#endif
        src = storetype.src (mlenv, filename);
     };
 };
 
 /*DOC:
 ===response-motor===
- (response-motor HTMLFILE [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL] [:type MIME_TYPE] [#continue | :continue BOOL]) -> NIL
+ (response-motor HTMLFILE [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL]
+               [:type MIME_TYPE] [#continue | :continue BOOL]) -> NIL
 
 */
 //#AFUNC       response-motor  ml_response_motor
@@ -1131,7 +1109,8 @@ MNode*  ml_response_motor (MNode* cell, MlEnv* mlenv) {
 }
 /*DOC:
 ===response-file===
- (response-file FILENAME [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL] [:type MIME_TYPE] [#inline | :inline BOOL] [:name NAME]) -> NIL
+ (response-file FILENAME [#serial | #named | #static | :serial BOOL | :named BOOL | :static BOOL]
+               [:type MIME_TYPE] [#inline | :inline BOOL] [:name NAME]) -> NIL
 
 */
 //#AFUNC       response-file   ml_response_file
index c630bbb..eba67f9 100644 (file)
@@ -99,9 +99,8 @@ MNode*  ml_if (MNode* cell, MlEnv* mlenv) {
            nextNode (arg);
            if (arg) {
                ans = progn (arg, mlenv);
-               if (mlenv->breaksym ()
-                   && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())))
-                   mlenv->setBreaksym (NULL);
+//             if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) mlenv->setBreaksym (NULL);
+               mlenv->stopBreak (cell->car ());
            }
        }
     }
@@ -128,9 +127,8 @@ MNode*  ml_cond (MNode* cell, MlEnv* mlenv) {
            throw (a->dump_string () + uErrorBadType);
        if (eval_bool (a->car (), mlenv)) {
            ans = progn (a->cdr (), mlenv);
-           if (mlenv->breaksym ()
-               && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())))
-               mlenv->setBreaksym (NULL);
+//         if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) mlenv->setBreaksym (NULL);
+           mlenv->stopBreak (cell->car ());
            break;
        }
        nextNode (arg);
@@ -170,10 +168,8 @@ MNode*  ml_progn (MNode* cell, MlEnv* mlenv) {
            throw (msg);
        }
     }
-    if (mlenv->breaksym ()
-       && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-       mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
 
     return ans.release ();
 }
@@ -202,9 +198,8 @@ MNode*  ml_select (MNode* cell, MlEnv* mlenv) {
 #endif /* DEBUG */
        ans = eval (arg->car (), mlenv);
        if (mlenv->breaksym ()) {
-           if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) {
-               mlenv->setBreaksym (NULL);
-           }
+//         if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) { mlenv->setBreaksym (NULL); }
+           mlenv->stopBreak (cell->car ());
            return mlenv->breakval ();
        }
        nextNode (arg);
@@ -234,10 +229,8 @@ MNode*  ml_case (MNode* cell, MlEnv* mlenv) {
     if (r) {
        ans ()->set_car (newMNode_bool (true));
        ans ()->set_cdr (progn (arg, mlenv));
-       if (mlenv->breaksym ()) {
-           if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-               mlenv->setBreaksym (NULL);
-       }
+//     if (mlenv->breaksym ()) { if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL); }
+       mlenv->stopBreak (cell->car ());
     }
 
     return ans.release ();
@@ -250,10 +243,8 @@ MNode*  ml_otherwise (MNode* cell, MlEnv* mlenv) {
     ans = new MNode;
     ans ()->set_car (newMNode_bool (true));
     ans ()->set_cdr (progn (arg, mlenv));
-    if (mlenv->breaksym ()) {
-       if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-           mlenv->setBreaksym (NULL);
-    }
+//    if (mlenv->breaksym ()) { if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL); }
+    mlenv->stopBreak (cell->car ());
 
     return ans.release ();
 }
@@ -324,8 +315,8 @@ MNode*  ml_repeat (MNode* cell, MlEnv* mlenv) {
                        mlenv->setVar (lv[j], mlenv->getAry (lv[j], (size_t)i));
                ans = progn (rest, mlenv);
                if (mlenv->breaksym ()) {
-                   if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-                       mlenv->setBreaksym (NULL);
+//                 if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL);
+                   mlenv->stopBreak (cell->car ());
                    kp = false;
                }
                if (i > 0)
@@ -344,8 +335,8 @@ MNode*  ml_repeat (MNode* cell, MlEnv* mlenv) {
                        mlenv->setVar (lv[j], mlenv->getAry (lv[j], (size_t)i));
                ans = progn (rest, mlenv);
                if (mlenv->breaksym ()) {
-                   if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-                       mlenv->setBreaksym (NULL);
+//                 if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL);
+                   mlenv->stopBreak (cell->car ());
                    kp = false;
                }
                if (i > 0)
@@ -452,8 +443,8 @@ MNode*  ml_doarray (MNode* cell, MlEnv* mlenv) {
                }
                ans = progn (rest, mlenv);
                if (mlenv->breaksym ()) {
-                   if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-                       mlenv->setBreaksym (NULL);
+//                 if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL);
+                   mlenv->stopBreak (cell->car ());
                    kp = false;
                }
                if (nsv == 0) {
@@ -554,8 +545,8 @@ MNode*  ml_dolist (MNode* cell, MlEnv* mlenv) {
                }
                ans = progn (rest, mlenv);
                if (mlenv->breaksym ()) {
-                   if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-                       mlenv->setBreaksym (NULL);
+//                 if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL);
+                   mlenv->stopBreak (cell->car ());
                    kp = false;
                }
            }
@@ -582,8 +573,8 @@ MNode*  ml_while (MNode* cell, MlEnv* mlenv) {
        while (eval_bool (exp, mlenv)) {
            ans = progn (arg, mlenv);
            if (mlenv->breaksym ()) {
-               if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))
-                   mlenv->setBreaksym (NULL);
+//             if (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ())) mlenv->setBreaksym (NULL);
+               mlenv->stopBreak (cell->car ());
                break;
            }
        }
index 4696c3c..df0d481 100644 (file)
@@ -211,10 +211,8 @@ MNode*  ml_let (MNode* cell, MlEnv* mlenv) {
        }
 
        ans = progn (arg, mlenv);
-       if (mlenv->breaksym ()
-           && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) {
-           mlenv->setBreaksym (NULL);
-       }
+//     if (mlenv->breaksym () && (mlenv->breaksym ()->isNil () || eq (mlenv->breaksym (), cell->car ()))) { mlenv->setBreaksym (NULL); }
+       mlenv->stopBreak (cell->car ());
     }
 
     return mlenv->retval = ans ();
@@ -462,7 +460,7 @@ MNode*  ml_array_index (MNode* cell, MlEnv* mlenv) {
     n = mlenv->getArySize (var);
     if (n > 0) {
        for (i = 1; i <= n; i ++) {
-           if (eq (mlenv->getAry (var, i), value ())) {
+           if (equal (mlenv->getAry (var, i), value ())) {
                return newMNode_num (i);
            }
        }
index 7a4113e..2d6870f 100644 (file)
@@ -857,10 +857,12 @@ void  WikiBlockTable::addLine_head (uiterator b, uiterator e) {
     objv.splitCharA ('|', objvv);
     if (objvv.size () > 0 && objvv.back ()->size () == 0)
        objvv.pop_back ();
-    attrib.shiftAttrib (objvv[0]);
+    if (objvv.size () > 0)
+       attrib.shiftAttrib (objvv[0]);
 
     cell = new TableCell (wiki, WikiAttrib1::M_NORMAL);
-    cell->cellBody (objvv[0].get (), this, 0);
+    if (objvv.size () > 0)
+       cell->cellBody (objvv[0].get (), this, 0);
     captionHtml = cell->html;
     delete cell;