• R/O
  • SSH
  • HTTPS

adp: Commit


Commit MetaInfo

Revisión295 (tree)
Tiempo2012-06-07 13:50:11
Autorohfuji

Log Message

match系(Horn節の検索時のunifyを切り離した)の関数を追加
Cut述語のパフォーマンスが悪いがとりあえずコミット

Cambiar Resumen

Diferencia incremental

--- trunk/adp_unify.cpp (revision 294)
+++ trunk/adp_unify.cpp (revision 295)
@@ -65,6 +65,30 @@
6565 return true;
6666 }
6767
68+template <class V, class T> bool inline vmatch_h_g(const V &horn, const T &goal, ExecContextRoot *c, VLocal *hlocal)
69+{
70+ const PObject *item = (*hlocal)[horn.idx];
71+ if ( item == 0 ) {
72+ (*hlocal)[horn.idx] = &goal;
73+ return true;
74+ } else {
75+ return item->match_h_g(goal, c);
76+ }
77+ return true;
78+}
79+
80+template <class V, class T> bool inline vmatch_g_h(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal)
81+{
82+ const PObject *item = (*glocal)[goal.idx];
83+ if ( item == 0 ) {
84+ (*glocal)[goal.idx] = &horn;
85+ return true;
86+ } else {
87+ return item->match_g_h(horn, c);
88+ }
89+ return true;
90+}
91+
6892 template <class V, class T> bool inline vunify_getval(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
6993 {
7094 const PObject *gitem = (*glocal)[goal.idx];
@@ -75,15 +99,45 @@
7599 } else {
76100 return gitem->unify( horn, c, glocal, hlocal);
77101 }
102+ return true;
103+}
78104
79-#if 1
105+template <class V, class T> bool inline vmatch_getval_h_g(const V &horn, const T &goal, ExecContextRoot *c, VLocal *hlocal)
106+{
107+ const PObject *item = (*hlocal)[horn.idx];
108+ if ( item == 0 ) {
109+ const PObject *p = goal.getval2(c, c->gl); // getvalに置き換え可能(getval_gl,getval_hlを作成後置き換える
110+ (*hlocal)[horn.idx] = p;
111+ if ( p->isc() ) {
112+ return true;
113+ }
114+ } else {
115+ return item->match_h_g( goal, c);
116+ }
80117 if ( c->pafterunify != 0 ) {
81118 c->pafterunify->push_back(c->uidx);
82119 }
83-#endif
84120 return true;
85121 }
86122
123+template <class V, class T> bool inline vmatch_getval_g_h(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal)
124+{
125+ const PObject *item = (*glocal)[goal.idx];
126+ if ( item == 0 ) {
127+ const PObject *p = horn.getval2(c, c->hl);
128+ if ( p->isc() ) {
129+ (*glocal)[goal.idx] = p;
130+ return true;
131+ }
132+ } else {
133+ return item->match_g_h( horn, c);
134+ }
135+ if ( c->pafterunify != 0 ) {
136+ c->pafterunify->push_back(c->uidx);
137+ }
138+ return true;
139+}
140+
87141 template <class V, class T> bool inline vunify_ver(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
88142 {
89143 const PObject *gval = (*glocal)[goal.idx];
@@ -92,21 +146,39 @@
92146 if ( hval != 0 ) {
93147 return hval->unify( *gval, c, hlocal, glocal);
94148 } else {
95- const PObject *p = gval->getval2(c, glocal);
149+ const PObject *p = gval->getval2(c, c->gl);
96150 (*hlocal)[horn.idx] = p;
97151 if ( p->isc() ) return true;
98152 }
99153 } else if ( hval != 0 ) {
100- const PObject *p = hval->getval2(c, hlocal);
154+ const PObject *p = hval->getval2(c, c->hl); // hlocal -> c->hl?
101155 (*glocal)[goal.idx] = p;
102156 if ( p->isc() ) return true;
103157 }
158+ return true;
159+}
104160
105-#if 1
161+template <class V, class T> bool inline vmatch_ver_g_h(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
162+{
163+ const PObject *gval = (*glocal)[goal.idx];
164+ const PObject *hval = (*hlocal)[horn.idx];
165+ if ( gval != 0 ) {
166+ if ( hval != 0 ) {
167+ return hval->match_h_g( *gval, c);
168+ } else {
169+ const PObject *p = gval->getval2(c, c->gl); // getvalに置き換え可能(getval_gl,getval_hlを作成後置き換える
170+ (*hlocal)[horn.idx] = p;
171+ if ( p->isc() ) return true;
172+ }
173+ } else if ( hval != 0 ) {
174+ const PObject *p = hval->getval2(c, c->hl);
175+ (*glocal)[goal.idx] = p;
176+ if ( p->isc() ) return true;
177+ }
178+
106179 if ( c->pafterunify != 0 ) {
107180 c->pafterunify->push_back(c->uidx);
108181 }
109-#endif
110182 return true;
111183 }
112184
@@ -122,6 +194,17 @@
122194 bool PNil::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
123195 bool PNil::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
124196
197+bool PNil::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
198+bool PNil::match_h_g(const PNil &goal, ExecContextRoot *c) const { return true; }
199+bool PNil::match_h_g(const PList &goal, ExecContextRoot *c) const { return goal.match_g_h( *this, c); }
200+bool PNil::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, c->hl); }
201+bool PNil::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, goal.vl); }
202+
203+bool PNil::match_g_h(const PNil &horn, ExecContextRoot *c) const { return true; }
204+bool PNil::match_g_h(const PList &horn, ExecContextRoot *c) const { return horn.match_h_g( *this, c); }
205+bool PNil::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, c->hl); }
206+bool PNil::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, horn.vl); }
207+
125208 /*************************************** PString ******************************************/
126209 bool PString::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
127210 bool PString::unify(const PString &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return strcmp( value.c_str(), horn.value.c_str()) == 0; }
@@ -132,6 +215,15 @@
132215 bool PString::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
133216 bool PString::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
134217
218+bool PString::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
219+bool PString::match_h_g(const PString &goal, ExecContextRoot *c) const { return strcmp( value.c_str(), goal.value.c_str()) == 0; }
220+bool PString::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, c->hl); }
221+bool PString::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, goal.vl); }
222+
223+bool PString::match_g_h(const PString &horn, ExecContextRoot *c) const { return strcmp( value.c_str(), horn.value.c_str()) == 0; }
224+bool PString::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, c->hl); }
225+bool PString::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const{ return vmatch_h_g(horn, *this, c, horn.vl); }
226+
135227 /*************************************** PDouble ******************************************/
136228 bool PDouble::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
137229 bool PDouble::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
@@ -138,6 +230,7 @@
138230 bool PDouble::unify(const PInteger &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
139231 bool PDouble::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, hlocal, glocal); }
140232 bool PDouble::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, horn.vl, glocal); }
233+
141234 bool PDouble::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
142235 bool PDouble::unify(const PDouble &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
143236 bool PDouble::unify(const PInteger &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
@@ -144,6 +237,18 @@
144237 bool PDouble::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
145238 bool PDouble::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
146239
240+bool PDouble::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
241+bool PDouble::match_h_g(const PDouble &goal, ExecContextRoot *c) const { return fabs(value - (double)goal.value) < DBL_EPSILON; }
242+bool PDouble::match_h_g(const PInteger &goal, ExecContextRoot *c) const { return fabs(value - (double)goal.value) < DBL_EPSILON; }
243+bool PDouble::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, c->hl); }
244+bool PDouble::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, goal.vl); }
245+
246+bool PDouble::match_g_h(const PDouble &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
247+bool PDouble::match_g_h(const PInteger &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
248+bool PDouble::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, c->hl); }
249+bool PDouble::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, horn.vl); }
250+
251+
147252 /*************************************** PInteger ******************************************/
148253 bool PInteger::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
149254 bool PInteger::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
@@ -150,6 +255,7 @@
150255 bool PInteger::unify(const PInteger &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return value == horn.value; }
151256 bool PInteger::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, hlocal, glocal); }
152257 bool PInteger::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, horn.vl, glocal); }
258+
153259 bool PInteger::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
154260 bool PInteger::unify(const PDouble &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
155261 bool PInteger::unify(const PInteger &horn, ExecContextRoot *c) const { return value == horn.value; }
@@ -156,10 +262,21 @@
156262 bool PInteger::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
157263 bool PInteger::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
158264
265+bool PInteger::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
266+bool PInteger::match_h_g(const PDouble &goal, ExecContextRoot *c) const { return fabs(value - (double)goal.value) < DBL_EPSILON; }
267+bool PInteger::match_h_g(const PInteger &goal, ExecContextRoot *c) const { return value == goal.value; }
268+bool PInteger::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, c->hl); }
269+bool PInteger::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_g_h(goal, *this, c, goal.vl); }
270+
271+bool PInteger::match_g_h(const PDouble &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
272+bool PInteger::match_g_h(const PInteger &horn, ExecContextRoot *c) const { return value == horn.value; }
273+bool PInteger::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, c->hl); }
274+bool PInteger::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_h_g(horn, *this, c, horn.vl); }
275+
159276 /*************************************** PList ******************************************/
160-static inline bool PList_unify(const PList &goal, const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
277+static inline bool PList_unify(const PList &list)
161278 {
162- if ( typeid(*goal.lvalue) == typeid(PNil) && typeid(*goal.rvalue) == typeid(PNil) ) return true;
279+ if ( typeid(*list.lvalue) == typeid(PNil) && typeid(*list.rvalue) == typeid(PNil) ) return true;
163280 return false;
164281 }
165282 static inline bool PList_unify(const PList &goal, const PList &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
@@ -168,18 +285,35 @@
168285 return false;
169286 }
170287
288+static inline bool PList_match(const PList &goal, const PList &horn, ExecContextRoot *c)
289+{
290+ if ( horn.lvalue->match_h_g( *goal.lvalue, c) && horn.rvalue->match_h_g( *goal.rvalue, c) ) return true;
291+ return false;
292+}
293+
294+
171295 bool PList::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
172-bool PList::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PList_unify( *this, horn, c, glocal, hlocal); }
296+bool PList::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PList_unify(*this); }
173297 bool PList::unify(const PList &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const{ return PList_unify( *this, horn, c, glocal, hlocal); }
174298 bool PList::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, hlocal, glocal); }
175299 bool PList::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, horn.vl, glocal); }
176300 bool PList::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
177-bool PList::unify(const PNil &horn, ExecContextRoot *c) const { return PList_unify( *this, horn, c, c->gl, c->hl); }
301+bool PList::unify(const PNil &horn, ExecContextRoot *c) const { return PList_unify( *this); }
178302 bool PList::unify(const PList &horn, ExecContextRoot *c) const { return PList_unify( *this, horn, c, c->gl, c->hl); }
179303 bool PList::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, c->hl, c->gl); }
180304 bool PList::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, horn.vl, c->gl); }
181305
306+bool PList::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
307+bool PList::match_h_g(const PNil &goal, ExecContextRoot *c) const { return PList_unify( *this); }
308+bool PList::match_h_g(const PList &goal, ExecContextRoot *c) const { return PList_match( goal, *this, c); }
309+bool PList::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_getval_g_h(goal, *this, c, c->hl); }
310+bool PList::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_getval_g_h(goal, *this, c, goal.vl); }
182311
312+bool PList::match_g_h(const PNil &horn, ExecContextRoot *c) const { return PList_unify( *this); }
313+bool PList::match_g_h(const PList &horn, ExecContextRoot *c) const { return PList_match( *this, horn, c); }
314+bool PList::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_getval_h_g(horn, *this, c, c->hl); }
315+bool PList::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_getval_h_g(horn, *this, c, horn.vl); }
316+
183317 /*************************************** PArray ******************************************/
184318 static inline bool PArray_unify(const PArray &goal, const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
185319 {
@@ -231,6 +365,56 @@
231365 return true;
232366 }
233367
368+static inline bool PArray_match(const PArray &goal, const PArray &horn, ExecContextRoot *c)
369+{
370+ size_t gsiz = goal.value.size();
371+ size_t hsiz = horn.value.size();
372+
373+ c->ao = 0;
374+ // 引数の数が同じ場合
375+ if ( gsiz == hsiz ) {
376+ for ( size_t i = 0; i < gsiz; i++ ) {
377+ c->uidx = i;
378+ if ( !horn.value[i]->match_h_g( *goal.value[i], c) ) {
379+ return false;
380+ }
381+ }
382+ } else if ( gsiz < hsiz && goal.args == true && horn.args == false ) {
383+ // 引数の数が異なる場合、片方に@がある場合、可変長引数の対応を行う。
384+ size_t m = gsiz - 1;
385+ // @変数の前まで普通にマッチングさせる
386+ for ( size_t i = 0; i < m; i++ ) {
387+ c->uidx = i;
388+ if ( !horn.value[i]->match_h_g( *goal.value[i], c) ) {
389+ return false;
390+ }
391+ }
392+ // @用の配列を作成する
393+ c->uidx = m;
394+ c->ao = pmm.newPArray(c->pobjs, horn, m, hsiz);
395+ return goal.value[m]->match_g_h( *c->ao, c);
396+
397+ } else if ( gsiz > hsiz && goal.args == false && horn.args == true ) {
398+ // 引数の数が異なる場合、片方に@がある場合、可変長引数の対応を行う。
399+ size_t m = hsiz - 1;
400+ // @変数の前まで普通にマッチングさせる
401+ for ( size_t i = 0; i < m; i++ ) {
402+ c->uidx = i;
403+ if ( !horn.value[i]->match_h_g( *goal.value[i], c) ) {
404+ return false;
405+ }
406+ }
407+ // @用の配列を作成する
408+ c->uidx = m;
409+ c->ao = pmm.newPArray(c->pobjs, goal, m, gsiz);
410+ return horn.value[m]->match_h_g( *c->ao, c);
411+ } else {
412+ return false;
413+ }
414+
415+ return true;
416+}
417+
234418 bool PArray::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
235419 bool PArray::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { if ( value.empty() ) return true; return false; }
236420 bool PArray::unify(const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PArray_unify( *this, horn, c, glocal, hlocal); }
@@ -242,6 +426,17 @@
242426 bool PArray::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, c->hl, c->gl); }
243427 bool PArray::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, horn.vl, c->gl); }
244428
429+bool PArray::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
430+bool PArray::match_h_g(const PNil &goal, ExecContextRoot *c) const { if ( value.empty() ) return true; return false; }
431+bool PArray::match_h_g(const PArray &goal, ExecContextRoot *c) const { return PArray_match( goal, *this, c); }
432+bool PArray::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_getval_g_h(goal, *this, c, c->hl); }
433+bool PArray::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_getval_g_h(goal, *this, c, goal.vl); }
434+
435+bool PArray::match_g_h(const PNil &horn, ExecContextRoot *c) const { if ( value.empty() ) return true; return false; }
436+bool PArray::match_g_h(const PArray &horn, ExecContextRoot *c) const { return PArray_match( *this, horn, c); }
437+bool PArray::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_getval_h_g(horn, *this, c, c->hl); }
438+bool PArray::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_getval_h_g(horn, *this, c, horn.vl); }
439+
245440 /*************************************** PPredicate ******************************************/
246441 static inline bool PPredicate_unify(const PPredicate &goal, const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
247442 {
@@ -252,6 +447,15 @@
252447 return goal.arglist.unify( horn.arglist, c, glocal, hlocal); // horn.arglistがPObjectでない場合はこのように呼び出す
253448 }
254449
450+static inline bool PPredicate_match(const PPredicate &goal, const PPredicate &horn, ExecContextRoot *c)
451+{
452+ // 呼び出し側(goal)がnamespaceを指定した場合、namespaceが一致している必要がある。
453+ if ( !goal.nspace.empty() && strcmp( horn.nspace.c_str(), goal.nspace.c_str()) != 0 ) { return false; }
454+
455+ if ( !horn.name->match_h_g( *goal.name, c) ) { return false; }
456+ return goal.arglist.match_g_h( horn.arglist, c); // horn.arglistがPObjectでない場合はこのように呼び出す
457+}
458+
255459 bool PPredicate::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
256460 bool PPredicate::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PPredicate_unify( *this, horn, c, glocal, hlocal); }
257461 bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, hlocal, glocal); }
@@ -261,7 +465,15 @@
261465 bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, c->hl, c->gl); }
262466 bool PPredicate::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, horn.vl, c->gl); }
263467
468+bool PPredicate::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
469+bool PPredicate::match_h_g(const PPredicate &goal, ExecContextRoot *c) const { return PPredicate_match( goal, *this, c); }
470+bool PPredicate::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_getval_g_h(goal, *this, c, c->hl); }
471+bool PPredicate::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_getval_g_h(goal, *this, c, goal.vl); }
264472
473+bool PPredicate::match_g_h(const PPredicate &horn, ExecContextRoot *c) const { return PPredicate_match( *this, horn, c); }
474+bool PPredicate::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_getval_h_g(horn, *this, c, c->hl); }
475+bool PPredicate::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_getval_h_g(horn, *this, c, horn.vl); }
476+
265477 /*************************************** PVeriable ******************************************/
266478 bool PVeriable::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
267479 bool PVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(*this, horn, c, glocal, hlocal); }
@@ -284,6 +496,27 @@
284496 bool PVeriable::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, c->gl, c->hl); }
285497 bool PVeriable::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, c->gl, horn.vl); }
286498
499+bool PVeriable::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
500+bool PVeriable::match_h_g(const PNil &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, c->hl); }
501+bool PVeriable::match_h_g(const PString &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, c->hl); }
502+bool PVeriable::match_h_g(const PDouble &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, c->hl); }
503+bool PVeriable::match_h_g(const PInteger &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, c->hl); }
504+bool PVeriable::match_h_g(const PList &goal, ExecContextRoot *c) const { return vmatch_getval_h_g(*this, goal, c, c->hl); }
505+bool PVeriable::match_h_g(const PArray &goal, ExecContextRoot *c) const { return vmatch_getval_h_g(*this, goal, c, c->hl); }
506+bool PVeriable::match_h_g(const PPredicate &goal, ExecContextRoot *c) const { return vmatch_getval_h_g(*this, goal, c, c->hl); }
507+bool PVeriable::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_ver_g_h(goal, *this, c, c->gl, c->hl); }
508+bool PVeriable::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_ver_g_h(goal, *this, c, goal.vl, c->hl); }
509+
510+bool PVeriable::match_g_h(const PNil &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, c->gl); }
511+bool PVeriable::match_g_h(const PString &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, c->gl); }
512+bool PVeriable::match_g_h(const PDouble &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, c->gl); }
513+bool PVeriable::match_g_h(const PInteger &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, c->gl); }
514+bool PVeriable::match_g_h(const PList &horn, ExecContextRoot *c) const { return vmatch_getval_g_h(*this, horn, c, c->gl); }
515+bool PVeriable::match_g_h(const PArray &horn, ExecContextRoot *c) const { return vmatch_getval_g_h(*this, horn, c, c->gl); }
516+bool PVeriable::match_g_h(const PPredicate &horn, ExecContextRoot *c) const { return vmatch_getval_g_h(*this, horn, c, c->gl); }
517+bool PVeriable::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_ver_g_h(*this, horn, c, c->gl, c->hl); }
518+bool PVeriable::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_ver_g_h(*this, horn, c, c->gl, horn.vl); }
519+
287520 /*************************************** PEVeriable ******************************************/
288521 bool PEVeriable::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
289522 bool PEVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify(*this, horn, c, vl, hlocal); }
@@ -306,14 +539,36 @@
306539 bool PEVeriable::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, vl, c->hl); }
307540 bool PEVeriable::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, vl, horn.vl); }
308541
542+bool PEVeriable::match_h_g(const PObject &goal, ExecContextRoot *c) const { return goal.match_g_h(*this, c); }
543+bool PEVeriable::match_h_g(const PNil &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, vl); }
544+bool PEVeriable::match_h_g(const PString &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, vl); }
545+bool PEVeriable::match_h_g(const PDouble &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, vl); }
546+bool PEVeriable::match_h_g(const PInteger &goal, ExecContextRoot *c) const { return vmatch_h_g(*this, goal, c, vl); }
547+bool PEVeriable::match_h_g(const PList &goal, ExecContextRoot *c) const { return vmatch_getval_h_g(*this, goal, c, vl); }
548+bool PEVeriable::match_h_g(const PArray &goal, ExecContextRoot *c) const { return vmatch_getval_h_g(*this, goal, c, vl); }
549+bool PEVeriable::match_h_g(const PPredicate &goal, ExecContextRoot *c) const { return vmatch_getval_h_g(*this, goal, c, vl); }
550+bool PEVeriable::match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return vmatch_ver_g_h(goal, *this, c, c->gl, vl); }
551+bool PEVeriable::match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return vmatch_ver_g_h(goal, *this, c, goal.vl, vl); }
552+
553+bool PEVeriable::match_g_h(const PNil &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, vl); }
554+bool PEVeriable::match_g_h(const PString &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, vl); }
555+bool PEVeriable::match_g_h(const PDouble &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, vl); }
556+bool PEVeriable::match_g_h(const PInteger &horn, ExecContextRoot *c) const { return vmatch_g_h(*this, horn, c, vl); }
557+bool PEVeriable::match_g_h(const PList &horn, ExecContextRoot *c) const { return vmatch_getval_g_h(*this, horn, c, vl); }
558+bool PEVeriable::match_g_h(const PArray &horn, ExecContextRoot *c) const { return vmatch_getval_g_h(*this, horn, c, vl); }
559+bool PEVeriable::match_g_h(const PPredicate &horn, ExecContextRoot *c) const { return vmatch_getval_g_h(*this, horn, c, vl); }
560+bool PEVeriable::match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return vmatch_ver_g_h(*this, horn, c, vl, c->hl); }
561+bool PEVeriable::match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return vmatch_ver_g_h(*this, horn, c, vl, horn.vl); }
562+
563+
309564 /*************************************** uphorn ******************************************/
310565 bool PHorn::upHorn(const PPredicate &goal, ExecContext &c, bool skipnamechk)
311566 {
312567 if ( skipnamechk ) {
313568 // ホーン節頭部の述語名の確認は既に終わっている
314- return goal.arglist.unify( head.arglist, &c, c.gl, c.hl ); // horn.arglistがPObjextでない場合はこのように呼び出す
569+ return goal.arglist.match_g_h( head.arglist, &c); // horn.arglistがPObjectでない場合はこのように呼び出す
315570 } else {
316- return goal.unify(head, &c, c.gl, c.hl);
571+ return goal.match_g_h(head, &c); // horn.arglistがPObjectでない場合はこのように呼び出す
317572 }
318573 }
319574
--- trunk/adp_compile.h (revision 294)
+++ trunk/adp_compile.h (revision 295)
@@ -172,10 +172,32 @@
172172 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const { return false; }
173173 virtual bool unify(const PWildCard &horn, ExecContextRoot *c) const { return true; }
174174
175+ //ホーン節検索時のマッチング
176+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const { return false; }
177+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const { return false; }
178+ virtual bool match_h_g(const PString &goal, ExecContextRoot *c) const { return false; }
179+ virtual bool match_h_g(const PDouble &goal, ExecContextRoot *c) const { return false; }
180+ virtual bool match_h_g(const PInteger &goal, ExecContextRoot *c) const { return false; }
181+ virtual bool match_h_g(const PList &goal, ExecContextRoot *c) const { return false; }
182+ virtual bool match_h_g(const PArray &goal, ExecContextRoot *c) const { return false; }
183+ virtual bool match_h_g(const PPredicate &goal, ExecContextRoot *c) const { return false; }
184+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return false; }
185+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const { return false; }
186+ virtual bool match_h_g(const PWildCard &goal, ExecContextRoot *c) const { return true; }
187+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const { return false; }
188+ virtual bool match_g_h(const PString &horn, ExecContextRoot *c) const { return false; }
189+ virtual bool match_g_h(const PDouble &horn, ExecContextRoot *c) const { return false; }
190+ virtual bool match_g_h(const PInteger &horn, ExecContextRoot *c) const { return false; }
191+ virtual bool match_g_h(const PList &horn, ExecContextRoot *c) const { return false; }
192+ virtual bool match_g_h(const PArray &horn, ExecContextRoot *c) const { return false; }
193+ virtual bool match_g_h(const PPredicate &horn, ExecContextRoot *c) const { return false; }
194+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return false; }
195+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const { return false; }
196+ virtual bool match_g_h(const PWildCard &horn, ExecContextRoot *c) const { return true; }
175197
176198 // 値の取得(unify時に使用、必要なら代入用の変更PEVariableを作成する)
177199 virtual const PObject *getval( ExecContextRoot *) const { return this; }
178- virtual const PObject *getval2( ExecContextRoot *, VLocal *) const { return this; }
200+ virtual const PObject *getval2( ExecContextRoot *, VLocal *) const { return this; }
179201
180202 // 値の取得
181203 virtual const char *c_str() const { return 0; };
@@ -298,6 +320,17 @@
298320 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
299321 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
300322
323+ //ホーン節検索時のマッチング
324+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
325+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const;
326+ virtual bool match_h_g(const PList &goal, ExecContextRoot *c) const;
327+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
328+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
329+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const;
330+ virtual bool match_g_h(const PList &horn, ExecContextRoot *c) const;
331+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
332+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
333+
301334 // 変換して値を取得
302335 virtual bool cnv_string(string &value) const { return true; };
303336
@@ -391,6 +424,15 @@
391424 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
392425 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
393426
427+ //ホーン節検索時のマッチング
428+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
429+ virtual bool match_h_g(const PString &goal, ExecContextRoot *c) const;
430+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
431+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
432+ virtual bool match_g_h(const PString &horn, ExecContextRoot *c) const;
433+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
434+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
435+
394436 // 値の取得
395437 virtual const char *c_str() const { return value.c_str(); };
396438
@@ -504,6 +546,17 @@
504546 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
505547 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
506548
549+ //ホーン節検索時のマッチング
550+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
551+ virtual bool match_h_g(const PDouble &goal, ExecContextRoot *c) const;
552+ virtual bool match_h_g(const PInteger &goal, ExecContextRoot *c) const;
553+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
554+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
555+ virtual bool match_g_h(const PDouble &horn, ExecContextRoot *c) const;
556+ virtual bool match_g_h(const PInteger &horn, ExecContextRoot *c) const;
557+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
558+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
559+
507560 //値の取得
508561 virtual const double *c_double() const { return &value; };
509562
@@ -624,6 +677,18 @@
624677 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
625678 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
626679
680+ //ホーン節検索時のマッチング
681+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
682+ virtual bool match_h_g(const PDouble &goal, ExecContextRoot *c) const;
683+ virtual bool match_h_g(const PInteger &goal, ExecContextRoot *c) const;
684+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
685+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
686+ virtual bool match_g_h(const PDouble &horn, ExecContextRoot *c) const;
687+ virtual bool match_g_h(const PInteger &horn, ExecContextRoot *c) const;
688+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
689+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
690+
691+
627692 // 値の取得
628693 mutable PINTEGER32 value32;
629694 virtual const PINTEGER32 *p_integer32(ExecContextRoot *) const {
@@ -828,6 +893,17 @@
828893 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
829894 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
830895
896+ //ホーン節検索時のマッチング
897+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
898+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const;
899+ virtual bool match_h_g(const PList &goal, ExecContextRoot *c) const;
900+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
901+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
902+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const;
903+ virtual bool match_g_h(const PList &horn, ExecContextRoot *c) const;
904+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
905+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
906+
831907 // 値の取得
832908 virtual const PObject *getval( ExecContextRoot *) const;
833909 virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const;
@@ -1135,6 +1211,18 @@
11351211 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
11361212 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
11371213
1214+ //ホーン節検索時のマッチング
1215+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
1216+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const;
1217+ virtual bool match_h_g(const PArray &goal, ExecContextRoot *c) const;
1218+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
1219+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
1220+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const;
1221+ virtual bool match_g_h(const PArray &horn, ExecContextRoot *c) const;
1222+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
1223+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
1224+
1225+
11381226 // 値の取得
11391227 virtual const PObject *getval( ExecContextRoot *c) const;
11401228 virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const;
@@ -1372,6 +1460,15 @@
13721460 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
13731461 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
13741462
1463+ //ホーン節検索時のマッチング
1464+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
1465+ virtual bool match_h_g(const PPredicate &goal, ExecContextRoot *c) const;
1466+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
1467+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
1468+ virtual bool match_g_h(const PPredicate &horn, ExecContextRoot *c) const;
1469+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
1470+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
1471+
13751472 // 値の取得
13761473 virtual const PObject *getval( ExecContextRoot *c) const;
13771474 virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const;
@@ -1470,6 +1567,27 @@
14701567 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
14711568 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
14721569
1570+ //ホーン節検索時のマッチング
1571+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
1572+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const;
1573+ virtual bool match_h_g(const PString &goal, ExecContextRoot *c) const;
1574+ virtual bool match_h_g(const PDouble &goal, ExecContextRoot *c) const;
1575+ virtual bool match_h_g(const PInteger &goal, ExecContextRoot *c) const;
1576+ virtual bool match_h_g(const PList &goal, ExecContextRoot *c) const;
1577+ virtual bool match_h_g(const PArray &goal, ExecContextRoot *c) const;
1578+ virtual bool match_h_g(const PPredicate &goal, ExecContextRoot *c) const;
1579+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
1580+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
1581+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const;
1582+ virtual bool match_g_h(const PString &horn, ExecContextRoot *c) const;
1583+ virtual bool match_g_h(const PDouble &horn, ExecContextRoot *c) const;
1584+ virtual bool match_g_h(const PInteger &horn, ExecContextRoot *c) const;
1585+ virtual bool match_g_h(const PList &horn, ExecContextRoot *c) const;
1586+ virtual bool match_g_h(const PArray &horn, ExecContextRoot *c) const;
1587+ virtual bool match_g_h(const PPredicate &horn, ExecContextRoot *c) const;
1588+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
1589+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
1590+
14731591 // 値の取得
14741592 virtual const PObject *getval( ExecContextRoot *c) const ;
14751593 virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const ;
@@ -1558,6 +1676,29 @@
15581676 virtual bool unify(const PWildCard &horn, ExecContextRoot *c) const { return true; }
15591677 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const{ return true; }
15601678
1679+ //ホーン節検索時のマッチング
1680+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const { return true; }
1681+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const { return true; }
1682+ virtual bool match_h_g(const PString &goal, ExecContextRoot *c) const { return true; }
1683+ virtual bool match_h_g(const PDouble &goal, ExecContextRoot *c) const { return true; }
1684+ virtual bool match_h_g(const PInteger &goal, ExecContextRoot *c) const { return true; }
1685+ virtual bool match_h_g(const PList &goal, ExecContextRoot *c) const { return true; }
1686+ virtual bool match_h_g(const PArray &goal, ExecContextRoot *c) const { return true; }
1687+ virtual bool match_h_g(const PPredicate &goal, ExecContextRoot *c) const { return true; }
1688+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const { return true; }
1689+ virtual bool match_h_g(const PWildCard &goal, ExecContextRoot *c) const { return true; }
1690+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const{ return true; }
1691+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const { return true; }
1692+ virtual bool match_g_h(const PString &horn, ExecContextRoot *c) const { return true; }
1693+ virtual bool match_g_h(const PDouble &horn, ExecContextRoot *c) const { return true; }
1694+ virtual bool match_g_h(const PInteger &horn, ExecContextRoot *c) const { return true; }
1695+ virtual bool match_g_h(const PList &horn, ExecContextRoot *c) const { return true; }
1696+ virtual bool match_g_h(const PArray &horn, ExecContextRoot *c) const { return true; }
1697+ virtual bool match_g_h(const PPredicate &horn, ExecContextRoot *c) const { return true; }
1698+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const { return true; }
1699+ virtual bool match_g_h(const PWildCard &horn, ExecContextRoot *c) const { return true; }
1700+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const{ return true; }
1701+
15611702 // 値の取得
15621703 // 代入
15631704
@@ -1638,6 +1779,27 @@
16381779 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
16391780 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
16401781
1782+ //ホーン節検索時のマッチング
1783+ virtual bool match_h_g(const PObject &goal, ExecContextRoot *c) const;
1784+ virtual bool match_h_g(const PNil &goal, ExecContextRoot *c) const;
1785+ virtual bool match_h_g(const PString &goal, ExecContextRoot *c) const;
1786+ virtual bool match_h_g(const PDouble &goal, ExecContextRoot *c) const;
1787+ virtual bool match_h_g(const PInteger &goal, ExecContextRoot *c) const;
1788+ virtual bool match_h_g(const PList &goal, ExecContextRoot *c) const;
1789+ virtual bool match_h_g(const PArray &goal, ExecContextRoot *c) const;
1790+ virtual bool match_h_g(const PPredicate &goal, ExecContextRoot *c) const;
1791+ virtual bool match_h_g(const PVeriable &goal, ExecContextRoot *c) const;
1792+ virtual bool match_h_g(const PEVeriable &goal, ExecContextRoot *c) const;
1793+ virtual bool match_g_h(const PNil &horn, ExecContextRoot *c) const;
1794+ virtual bool match_g_h(const PString &horn, ExecContextRoot *c) const;
1795+ virtual bool match_g_h(const PDouble &horn, ExecContextRoot *c) const;
1796+ virtual bool match_g_h(const PInteger &horn, ExecContextRoot *c) const;
1797+ virtual bool match_g_h(const PList &horn, ExecContextRoot *c) const;
1798+ virtual bool match_g_h(const PArray &horn, ExecContextRoot *c) const;
1799+ virtual bool match_g_h(const PPredicate &horn, ExecContextRoot *c) const;
1800+ virtual bool match_g_h(const PVeriable &horn, ExecContextRoot *c) const;
1801+ virtual bool match_g_h(const PEVeriable &horn, ExecContextRoot *c) const;
1802+
16411803 // 値の取得
16421804 virtual const PObject *getval( ExecContextRoot *c) const;
16431805 virtual const PObject *getval2( ExecContextRoot *c, VLocal *) const;
--- trunk/adp_execute.h (revision 294)
+++ trunk/adp_execute.h (revision 295)
@@ -705,10 +705,11 @@
705705 // 親のローカル変数の値をcloneする、
706706 for ( size_t i = 0; i < p->hlocal.size(); i++ ) {
707707 const PObject *o = p->hlocal[i];
708- if ( o != 0 && !o->isc() ) {
708+ if ( o != 0 /*&& !o->isc()*/ ) {
709709 p->hlocal[i] = o->getval2(p,&p->hlocal)->clone(&p->objs);
710710 }
711711 }
712+
712713 for ( size_t i = 0; i < p->goalidx; i++ ) {
713714 ExecContextRoot *e = p->ecs[i];
714715 if ( e ) {
--- trunk/adp.cpp (revision 294)
+++ trunk/adp.cpp (revision 295)
@@ -23,12 +23,12 @@
2323
2424 // 定数
2525 #ifdef ___X64____
26-#define VERSION_TEXT "ADP Ver 0.82.0294 X64 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
26+#define VERSION_TEXT "ADP Ver 0.82.0295 X64 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
2727 #else
2828 #if _WIN32
29-#define VERSION_TEXT "ADP Ver 0.82.0294 x86 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
29+#define VERSION_TEXT "ADP Ver 0.82.0295 x86 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
3030 #else
31-#define VERSION_TEXT "ADP Ver 0.82.0294 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
31+#define VERSION_TEXT "ADP Ver 0.82.0295 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n"
3232 #endif
3333 #endif
3434
Show on old repository browser