OSDN Git Service

fix.
authorvisor <visor@users.sourceforge.jp>
Sat, 8 Oct 2011 04:50:15 +0000 (13:50 +0900)
committervisor <visor@users.sourceforge.jp>
Sat, 22 Oct 2011 00:55:33 +0000 (09:55 +0900)
14 files changed:
config.h
ext/Makefile
ext/cdblib/Makefile
ext/ml-sqlite3.cc
lib/mlenv.h
lib/motorenv.h
lib/util_string.cc
lib/util_string.h
modules/ml-formvar.cc
modules/ml-string.cc
wiki/wikiformat.cc
wiki/wikiline.cc
wiki/wikimotor.cc
wiki/wikimotor.h

index 7ceb7d5..a8a9722 100644 (file)
--- a/config.h
+++ b/config.h
@@ -21,6 +21,7 @@
 #define  SHARE_AUTHDB          1
 //#define  WIKICOMPAT          1
 //#define  TABLECOMPATFLAG     1
+//#define  WIKIMOTORPRE                1
 //#define  COMPAT_STORAGE_CREATE       1
 //#define  HTTPS_NOCACHE       1
 
index fc745c7..6cd3a77 100644 (file)
@@ -5,5 +5,7 @@
 SUBDIR += sqlite
 .endif
 SUBDIR += cdblib
+
 .include <bsd.subdir.mk>
+
 dist:
index 44cbbf5..8a0051f 100644 (file)
@@ -33,7 +33,7 @@ NOPROFILE=
 NO_PIC=
 NO_PROFILE=
 
-CLEANFILES += .depend
+CLEANFILES += .depend ../cdb.h ../libcdbl.a
 
 .PATH:../cdb-0.75
 
@@ -45,6 +45,8 @@ all: ../cdb.h ../libcdbl.a
 ../libcdbl.a: libcdbl.a
        cp libcdbl.a ..
 
+beforedepend: ../cdb.h
+
 dist:
 
 .include <bsd.lib.mk>
index 7c7b827..fac6096 100644 (file)
@@ -338,7 +338,9 @@ void  MLSqlite3::setBreak () {
 static void  setDirFunc (MLFunc* mobj) {
     MLSqlite3*  obj = MObjRef<MLSqlite3> (mobj, cMLSqlite3ID);
     ustring  u = mobj->mlenv->env->path_to_db ();
+#ifndef BDB5SQLITE /* XXX */
     sqlite3_set_dbdir (obj->dbh, u.c_str ());
+#endif
 }
 
 /*DOC:
index 76cb26e..e29609c 100644 (file)
@@ -97,6 +97,8 @@ class  MlEnv {
     MlPool*  mlPool;
     MlFTable*  mlFTable;
     std::vector<std::pair<MLFunc*,datastoreFunc_t> >  datastoreFuncStack;
+    std::wstring  regtext;
+    boost::wsmatch  regmatch;
     MNodePtr  retval;
     MNodePtr  currentCell;
     MotorEnv*  env;
index cb8bed2..d0fb2b2 100644 (file)
@@ -41,8 +41,6 @@ class  MotorEnv {
     MotorErrorVar  errorvar;
     ustring  storedir;
     ustring  storagedir;
-    std::wstring  regtext;
-    boost::wsmatch  regmatch;
     MotorVar  motorCall;
     bool  errflag;
     bool  responseDone;
index e78523a..9fcd9a0 100644 (file)
@@ -698,12 +698,12 @@ bool  wsearch (const ustring& text, boost::wsmatch& m, const ustring& reg, boost
     }
 }
 
-bool  wsearch_env (MlEnv* mlenv, const ustring& text, boost::wsmatch& m, const ustring& reg, boost::wregex::flag_type reg_flags, boost::match_flag_type search_flags) {
+bool  wsearch_env (MlEnv* mlenv, const ustring& text, const ustring& reg, boost::wregex::flag_type reg_flags, boost::match_flag_type search_flags) {
     try {
-       mlenv->env->regtext = utow (text);
+       mlenv->regtext = utow (text);
        std::wstring  wreg = utow (reg);
        boost::wregex  wre (wreg, reg_flags);
-       return regex_search (mlenv->env->regtext, m, wre, search_flags);
+       return regex_search (mlenv->regtext, mlenv->regmatch, wre, search_flags);
     } catch (boost::regex_error& err) {
        throw (uErrorRegexp);
     }
index b1291ce..df6139c 100644 (file)
@@ -78,7 +78,7 @@ ustring  clipWhite (const ustring& str);
 ustring  getenvString (const char* key);
 ustring  zeroPad (int n, const ustring& src);
 bool  wsearch (const ustring& text, boost::wsmatch& m, const ustring& reg, boost::wregex::flag_type reg_flags = boost::regex_constants::normal, boost::match_flag_type search_flags = boost::regex_constants::match_single_line);
-bool  wsearch_env (MlEnv* mlenv, const ustring& text, boost::wsmatch& m, const ustring& reg, boost::wregex::flag_type reg_flags = boost::regex_constants::normal, boost::match_flag_type search_flags = boost::regex_constants::match_single_line);
+bool  wsearch_env (MlEnv* mlenv, const ustring& text, const ustring& reg, boost::wregex::flag_type reg_flags = boost::regex_constants::normal, boost::match_flag_type search_flags = boost::regex_constants::match_single_line);
 ustring  wreplace (const ustring& text, const ustring& reg, const ustring& fmt, boost::wregex::flag_type reg_flags = boost::regex_constants::normal, boost::match_flag_type match_flags = boost::regex_constants::match_single_line);
 ustring  uiconv (const ustring& src, const char* tocode, const char* fromcode);
 ustring  padEmpty (const ustring& name);
index 71c9b62..922830b 100644 (file)
@@ -101,9 +101,8 @@ bool  FormVarOp::optFilter (const ustring& name, ustring& val, MlEnv* mlenv) {
     bool  ans = true;
 
     if (filter.size () > 0) {
-       boost::wsmatch  m;
-       if (wsearch_env (mlenv, val, m, filter)) {
-           val = wtou (std::wstring (m[0].first, m[0].second));
+       if (wsearch_env (mlenv, val, filter)) {
+           val = wtou (std::wstring (mlenv->regmatch[0].first, mlenv->regmatch[0].second));
        } else {
            val.resize (0);
            ans = false;
@@ -390,9 +389,8 @@ MNode*  ml_formvar_input_file (MNode* cell, MlEnv* mlenv) {
        tgt = mlenv->env->path_store_file (fname);
 //     mlenv->env->form->at (var, filename);
        if (opt.filter.size () > 0) {
-           boost::wsmatch  m;
-           if (wsearch_env (mlenv, filename, m, opt.filter)) {
-               filename.assign (m[0].first, m[0].second);
+           if (wsearch_env (mlenv, filename, opt.filter)) {
+               filename.assign (mlenv->regmatch[0].first, mlenv->regmatch[0].second);
            } else {
                filename.resize (0);
            }
index c7ff800..f7f62cf 100644 (file)
@@ -145,7 +145,7 @@ MNode*  ml_regexp_match (MNode* cell, MlEnv* mlenv) {
     if (eval_bool (keywords[0], mlenv))
        f |= boost::regex_constants::icase;
 
-    ans = wsearch_env (mlenv, text, mlenv->env->regmatch, reg, f);
+    ans = wsearch_env (mlenv, text, reg, f);
 
     return newMNode_bool (ans);
 }
@@ -169,8 +169,8 @@ MNode*  ml_match_string (MNode* cell, MlEnv* mlenv) {
     if (arg)
        throw (uErrorWrongNumber);
 
-    if (0 <= n && n < mlenv->env->regmatch.size ()) {
-       ans = newMNode_str (new ustring (wtou (std::wstring (mlenv->env->regmatch[n].first, mlenv->env->regmatch[n].second))));
+    if (0 <= n && n < mlenv->regmatch.size ()) {
+       ans = newMNode_str (new ustring (wtou (std::wstring (mlenv->regmatch[n].first, mlenv->regmatch[n].second))));
     }
 
     return ans;
@@ -186,12 +186,12 @@ MNode*  ml_match_string (MNode* cell, MlEnv* mlenv) {
 MNode*  ml_prematch (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
     MNode*  ans = NULL;
-    std::wstring::const_iterator  b = mlenv->env->regtext.begin ();
+    std::wstring::const_iterator  b = mlenv->regtext.begin ();
 
     if (arg)
        throw (uErrorWrongNumber);
 
-    ans = newMNode_str (new ustring (wtou (std::wstring (b, mlenv->env->regmatch[0].first))));
+    ans = newMNode_str (new ustring (wtou (std::wstring (b, mlenv->regmatch[0].first))));
 
     return ans;
 }
@@ -206,12 +206,12 @@ MNode*  ml_prematch (MNode* cell, MlEnv* mlenv) {
 MNode*  ml_postmatch (MNode* cell, MlEnv* mlenv) {
     MNode*  arg = cell->cdr ();
     MNode*  ans = NULL;
-    std::wstring::const_iterator  e = mlenv->env->regtext.end ();
+    std::wstring::const_iterator  e = mlenv->regtext.end ();
 
     if (arg)
        throw (uErrorWrongNumber);
 
-    ans = newMNode_str (new ustring (wtou (std::wstring (mlenv->env->regmatch[0].second, e))));
+    ans = newMNode_str (new ustring (wtou (std::wstring (mlenv->regmatch[0].second, e))));
 
     return ans;
 }
@@ -248,8 +248,8 @@ MNode*  ml_string_filter (MNode* cell, MlEnv* mlenv) {
            max = 0;
     }
 
-    if (wsearch_env (mlenv, t, mlenv->env->regmatch, reg, f)) {
-       ustring  ans = wtou (std::wstring (mlenv->env->regmatch[0].first, mlenv->env->regmatch[0].second));
+    if (wsearch_env (mlenv, t, reg, f)) {
+       ustring  ans = wtou (std::wstring (mlenv->regmatch[0].first, mlenv->regmatch[0].second));
        if (max > 0) {
            substring (ans, 0, max, true, ans);
        }
@@ -328,11 +328,11 @@ MNode*  ml_regexp_split (MNode* cell, MlEnv* mlenv) {
     if (eval_bool (keywords[0], mlenv))
        f |= boost::regex_constants::icase;
 
-    if (wsearch_env (mlenv, text, mlenv->env->regmatch, reg, f)) {
-       std::wstring::const_iterator  b = mlenv->env->regtext.begin ();
-       std::wstring::const_iterator  e = mlenv->env->regtext.end ();
-       ans.append (newMNode_str (new ustring (wtou (std::wstring (b, mlenv->env->regmatch[0].first)))));
-       ans.append (newMNode_str (new ustring (wtou (std::wstring (mlenv->env->regmatch[0].second, e)))));
+    if (wsearch_env (mlenv, text, reg, f)) {
+       std::wstring::const_iterator  b = mlenv->regtext.begin ();
+       std::wstring::const_iterator  e = mlenv->regtext.end ();
+       ans.append (newMNode_str (new ustring (wtou (std::wstring (b, mlenv->regmatch[0].first)))));
+       ans.append (newMNode_str (new ustring (wtou (std::wstring (mlenv->regmatch[0].second, e)))));
     } else {
        ans.append (newMNode_str (new ustring (text)));
        ans.append (NULL);
index 462e5f0..0c95168 100644 (file)
 #include "ustring.h"
 #include <boost/ptr_container/ptr_vector.hpp>
 
-// config.h <-- #define TABLECOMPATFLAG        1
-#define  WIKIMOTORPRE  1
+/*
+  WIKIMOTORPRE: セットすると,フォーマット済みテキストブロックの中でインライン要素の解釈を行う。
+  UTF8JP: セットすると,条件によりパラグラフ内の改行を空白に置き換えない。
+  TABLECOMPATFLAG: セットすると,旧形式の表の継続記号もゆるす。
+*/
 
 #define  kComment      "//"
 #define  kWikiP                '^'
index 9169120..8a82bce 100644 (file)
@@ -41,7 +41,6 @@ static void  errorBadParam (WikiMotorObjVec* param, WikiFormat* wiki) {
  [[variable/]]
  [[variable~]]
  [[variable,]]
- [[variable^]]
 
 */
 /*DOC:
@@ -59,7 +58,6 @@ static void  errorBadParam (WikiMotorObjVec* param, WikiFormat* wiki) {
  [[getvar:NAME:/]]
  [[getvar:NAME:~]]
  [[getvar:NAME:,]]
- [[getvar:NAME:^]]
 
 */
 //#WIKILINE    getvar  wl_getvar
@@ -80,21 +78,17 @@ bool  wl_getvar (WikiMotorObjVecVec* args, WikiMotorObjVec& out, WikiFormat* wik
        if (opt.length () == 1) {
            switch (opt[0]) {
            case '/':
-//             out->outamp_br (val);
                o.outamp_br (val);
                break;
            case '~':
-//             out->outamp_nw (val);
                o.outamp_nw (val);
                break;
            case ',':
-//             out->outamp_c3 (val);
                o.outamp_c3 (val);
                break;
-           case '^':
-//             out->outamp_wbr (val);
-               o.outamp_wbr (val);
-               break;
+//         case '^':
+//             o.outamp_wbr (val);
+//             break;
            default:
                return false;
            }
@@ -102,7 +96,6 @@ bool  wl_getvar (WikiMotorObjVecVec* args, WikiMotorObjVec& out, WikiFormat* wik
            return false;
        }
     } else {
-//     out->outamp (val);
        o.outamp (val);
     }
 
index 30caab4..8c9856c 100644 (file)
@@ -19,7 +19,8 @@ uregex  re_wiki1 (
                "\\[\\["
                "(\\+?" rWIKIVAR ")"            // 2
                "("                             // 3
-                       "(/|~|,|\\^)?"          // 4
+//                     "(/|~|,|\\^)?"          // 4
+                       "(/|~|,)?"              // 4
                        "\\]\\]"
                "|"
                        "(:|!?\\?| )"           // 5
@@ -621,11 +622,13 @@ MotorOutput*  MotorOutputWiki::outamp_br (const ustring& t) {
     return this;
 }
 
+#if 0
 MotorOutput*  MotorOutputWiki::outamp_wbr (const ustring& t) {
 //    ans->push_back (WikiMotorObjPtr (new WikiMotorObjHtml (o.ans)));
     MotorOutput::outamp_wbr (t);
     return this;
 }
+#endif
 
 MotorOutput*  MotorOutputWiki::outamp_nw (const ustring& t) {
     if (t.size () > 0) {
@@ -763,9 +766,9 @@ void  WikiMotorObjVar::eval (WikiMotorObjVec& ans, const WikiMotorObjPtr* self,
     case opt_c3:
        o.outamp_c3 (val);
        break;
-    case opt_wbr:
-       o.outamp_wbr (val);
-       break;
+//    case opt_wbr:
+//     o.outamp_wbr (val);
+//     break;
     default:
        assert (0);
     }
@@ -794,9 +797,9 @@ ustring  WikiMotorObjVar::htmlOut (WikiFormat* wiki) {
     case opt_c3:
        o.outamp_c3 (val);
        return o.ans;
-    case opt_wbr:
-       o.outamp_wbr (val);
-       return o.ans;
+//    case opt_wbr:
+//     o.outamp_wbr (val);
+//     return o.ans;
     default:
        assert (0);
     }
@@ -819,9 +822,9 @@ ustring  WikiMotorObjVar::dump () {
     case opt_c3:
        ans.append (CharConst (",]]"));
        break;
-    case opt_wbr:
-       ans.append (CharConst ("^]]"));
-       break;
+//    case opt_wbr:
+//     ans.append (CharConst ("^]]"));
+//     break;
     default:
        assert (0);
     }
@@ -1288,9 +1291,9 @@ void  WikiMotor::compile_2 (WikiMotorObjVec& out) { // [[
        case ',':
            out.push_back (WikiMotorObjPtr (new WikiMotorObjVar (sp.matchBegin (re_wiki1_wikivar), sp.matchEnd (re_wiki1_wikivar), WikiMotorObjVar::opt_c3)));
            break;
-       case '^':
-           out.push_back (WikiMotorObjPtr (new WikiMotorObjVar (sp.matchBegin (re_wiki1_wikivar), sp.matchEnd (re_wiki1_wikivar), WikiMotorObjVar::opt_wbr)));
-           break;
+//     case '^':
+//         out.push_back (WikiMotorObjPtr (new WikiMotorObjVar (sp.matchBegin (re_wiki1_wikivar), sp.matchEnd (re_wiki1_wikivar), WikiMotorObjVar::opt_wbr)));
+//         break;
        default:
            assert (0);
        }
index c560232..a8a3e16 100644 (file)
@@ -74,7 +74,7 @@ class  MotorOutputWiki: public MotorOutput {
     virtual  ~MotorOutputWiki () {};
     virtual MotorOutput*  outamp (const ustring& t);
     virtual MotorOutput*  outamp_br (const ustring& t);
-    virtual MotorOutput*  outamp_wbr (const ustring& t);
+//    virtual MotorOutput*  outamp_wbr (const ustring& t);
     virtual MotorOutput*  outamp_nw (const ustring& t);
     virtual MotorOutput*  outamp_c3 (const ustring& t);
  protected:
@@ -219,7 +219,7 @@ class  WikiMotorObjVar: public WikiMotorObj {
        opt_br,
        opt_nbsp,
        opt_c3,
-       opt_wbr,
+//     opt_wbr,
     }  vopt;
 
     WikiMotorObjVar (uiterator b, uiterator e, opt op): WikiMotorObj (wiki_var) {