#define SHARE_AUTHDB 1
//#define WIKICOMPAT 1
//#define TABLECOMPATFLAG 1
+//#define WIKIMOTORPRE 1
//#define COMPAT_STORAGE_CREATE 1
//#define HTTPS_NOCACHE 1
SUBDIR += sqlite
.endif
SUBDIR += cdblib
+
.include <bsd.subdir.mk>
+
dist:
NO_PIC=
NO_PROFILE=
-CLEANFILES += .depend
+CLEANFILES += .depend ../cdb.h ../libcdbl.a
.PATH:../cdb-0.75
../libcdbl.a: libcdbl.a
cp libcdbl.a ..
+beforedepend: ../cdb.h
+
dist:
.include <bsd.lib.mk>
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:
MlPool* mlPool;
MlFTable* mlFTable;
std::vector<std::pair<MLFunc*,datastoreFunc_t> > datastoreFuncStack;
+ std::wstring regtext;
+ boost::wsmatch regmatch;
MNodePtr retval;
MNodePtr currentCell;
MotorEnv* env;
MotorErrorVar errorvar;
ustring storedir;
ustring storagedir;
- std::wstring regtext;
- boost::wsmatch regmatch;
MotorVar motorCall;
bool errflag;
bool responseDone;
}
}
-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);
}
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);
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;
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);
}
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);
}
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;
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;
}
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;
}
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);
}
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);
#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 '^'
[[variable/]]
[[variable~]]
[[variable,]]
- [[variable^]]
*/
/*DOC:
[[getvar:NAME:/]]
[[getvar:NAME:~]]
[[getvar:NAME:,]]
- [[getvar:NAME:^]]
*/
//#WIKILINE getvar wl_getvar
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;
}
return false;
}
} else {
-// out->outamp (val);
o.outamp (val);
}
"\\[\\["
"(\\+?" rWIKIVAR ")" // 2
"(" // 3
- "(/|~|,|\\^)?" // 4
+// "(/|~|,|\\^)?" // 4
+ "(/|~|,)?" // 4
"\\]\\]"
"|"
"(:|!?\\?| )" // 5
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) {
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);
}
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);
}
case opt_c3:
ans.append (CharConst (",]]"));
break;
- case opt_wbr:
- ans.append (CharConst ("^]]"));
- break;
+// case opt_wbr:
+// ans.append (CharConst ("^]]"));
+// break;
default:
assert (0);
}
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);
}
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:
opt_br,
opt_nbsp,
opt_c3,
- opt_wbr,
+// opt_wbr,
} vopt;
WikiMotorObjVar (uiterator b, uiterator e, opt op): WikiMotorObj (wiki_var) {