repayの実装
@@ -92,6 +92,36 @@ | ||
92 | 92 | return true; |
93 | 93 | } |
94 | 94 | |
95 | +template <class V, class T> bool __forceinline vrepay_h_g(const V &horn, const T &goal, ExecContext *c, VLocal *hlocal) __attribute__((always_inline)); | |
96 | +template <class V, class T> bool __forceinline vrepay_h_g(const V &horn, const T &goal, ExecContext *c, VLocal *hlocal) | |
97 | +{ | |
98 | + const PObject *item = (*hlocal)[horn.idx]; | |
99 | + if ( item == 0 ) { | |
100 | + // 代入しても無意味 | |
101 | + return true; | |
102 | + } else { | |
103 | + return item->repay_h_g(goal, c); | |
104 | + } | |
105 | + return true; | |
106 | +} | |
107 | + | |
108 | +template <class V, class T> bool __forceinline vrepay_g_h(const V &goal, const T &horn, ExecContext *c, VLocal *glocal) __attribute__((always_inline)); | |
109 | +template <class V, class T> bool __forceinline vrepay_g_h(const V &goal, const T &horn, ExecContext *c, VLocal *glocal) | |
110 | +{ | |
111 | + const PObject *item = (*glocal)[goal.idx]; | |
112 | + if ( item == 0 ) { | |
113 | + if ( c->goal->nobacktrack ) { | |
114 | + (*glocal)[goal.idx] = horn.clone(&c->p->objs); | |
115 | + } else { | |
116 | + (*glocal)[goal.idx] = &horn; | |
117 | + } | |
118 | + return true; | |
119 | + } else { | |
120 | + return item->repay_g_h(horn, c); | |
121 | + } | |
122 | + return true; | |
123 | +} | |
124 | + | |
95 | 125 | template <class V, class T> bool __forceinline vunify_getval(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) __attribute__((always_inline)); |
96 | 126 | template <class V, class T> bool __forceinline vunify_getval(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) |
97 | 127 | { |
@@ -142,6 +172,37 @@ | ||
142 | 172 | return true; |
143 | 173 | } |
144 | 174 | |
175 | +template <class V, class T> bool __forceinline vrepay_getval_h_g(const V &horn, const T &goal, ExecContext *c, VLocal *hlocal) __attribute__((always_inline)); | |
176 | +template <class V, class T> bool __forceinline vrepay_getval_h_g(const V &horn, const T &goal, ExecContext *c, VLocal *hlocal) | |
177 | +{ | |
178 | + const PObject *item = (*hlocal)[horn.idx]; | |
179 | + if ( item == 0 ) { | |
180 | + // 代入しても無意味 | |
181 | + return true; | |
182 | + } else { | |
183 | + return item->repay_h_g( goal, c); | |
184 | + } | |
185 | + return true; | |
186 | +} | |
187 | + | |
188 | +template <class V, class T> bool __forceinline vrepay_getval_g_h(const V &goal, const T &horn, ExecContext *c, VLocal *glocal) __attribute__((always_inline)); | |
189 | +template <class V, class T> bool __forceinline vrepay_getval_g_h(const V &goal, const T &horn, ExecContext *c, VLocal *glocal) | |
190 | +{ | |
191 | + const PObject *item = (*glocal)[goal.idx]; | |
192 | + if ( item == 0 ) { | |
193 | + const PObject *p = horn.getval2(c, c->hl); | |
194 | + if ( c->goal->nobacktrack ) { | |
195 | + p = p->clone(&c->p->objs); | |
196 | + } | |
197 | + (*glocal)[goal.idx] = p; | |
198 | + return true; | |
199 | + } else { | |
200 | + return item->repay_g_h( horn, c); | |
201 | + } | |
202 | + return true; | |
203 | +} | |
204 | + | |
205 | + | |
145 | 206 | template <class V, class T> bool __forceinline vunify_ver(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) __attribute__((always_inline)); |
146 | 207 | template <class V, class T> bool __forceinline vunify_ver(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) |
147 | 208 | { |
@@ -191,6 +252,29 @@ | ||
191 | 252 | return true; |
192 | 253 | } |
193 | 254 | |
255 | +template <class V, class T> bool __forceinline vrepay_ver_g_h(const V &goal, const T &horn, ExecContext *c, VLocal *glocal, VLocal *hlocal) __attribute__((always_inline)); | |
256 | +template <class V, class T> bool __forceinline vrepay_ver_g_h(const V &goal, const T &horn, ExecContext *c, VLocal *glocal, VLocal *hlocal) | |
257 | +{ | |
258 | + const PObject *gval = (*glocal)[goal.idx]; | |
259 | + const PObject *hval = (*hlocal)[horn.idx]; | |
260 | + if ( gval != 0 ) { | |
261 | + if ( hval != 0 ) { | |
262 | + return hval->repay_h_g( *gval, c); | |
263 | + } else { | |
264 | + // 代入は無意味 | |
265 | + return true; | |
266 | + } | |
267 | + } else if ( hval != 0 ) { | |
268 | + const PObject *p = hval->getval2(c, c->hl); | |
269 | + if ( c->goal->nobacktrack ) { | |
270 | + p = p->clone(&c->p->objs); | |
271 | + } | |
272 | + (*glocal)[goal.idx] = p; | |
273 | + return true; | |
274 | + } | |
275 | + return true; | |
276 | +} | |
277 | + | |
194 | 278 | /*************************************** PNil ******************************************/ |
195 | 279 | bool PNil::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
196 | 280 | bool PNil::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return true; } |
@@ -213,6 +297,16 @@ | ||
213 | 297 | bool PNil::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, c->hl); } |
214 | 298 | bool PNil::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, horn.vl); } |
215 | 299 | |
300 | +bool PNil::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
301 | +bool PNil::repay_h_g(const PNil &goal, ExecContext *c) const { return true; } | |
302 | +bool PNil::repay_h_g(const PList &goal, ExecContext *c) const { return goal.repay_g_h( *this, c); } | |
303 | +bool PNil::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, c->hl); } | |
304 | +bool PNil::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, goal.vl); } | |
305 | +bool PNil::repay_g_h(const PNil &horn, ExecContext *c) const { return true; } | |
306 | +bool PNil::repay_g_h(const PList &horn, ExecContext *c) const { return horn.repay_h_g( *this, c); } | |
307 | +bool PNil::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, c->hl); } | |
308 | +bool PNil::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, horn.vl); } | |
309 | + | |
216 | 310 | /*************************************** PString ******************************************/ |
217 | 311 | bool PString::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
218 | 312 | bool PString::unify(const PString &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return strcmp( value.c_str(), horn.value.c_str()) == 0; } |
@@ -231,6 +325,14 @@ | ||
231 | 325 | bool PString::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, c->hl); } |
232 | 326 | bool PString::match_g_h(const PEVeriable &horn, ExecContext *c) const{ return vmatch_h_g(horn, *this, c, horn.vl); } |
233 | 327 | |
328 | +bool PString::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
329 | +bool PString::repay_h_g(const PString &goal, ExecContext *c) const { return strcmp( value.c_str(), goal.value.c_str()) == 0; } | |
330 | +bool PString::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, c->hl); } | |
331 | +bool PString::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, goal.vl); } | |
332 | +bool PString::repay_g_h(const PString &horn, ExecContext *c) const { return strcmp( value.c_str(), horn.value.c_str()) == 0; } | |
333 | +bool PString::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, c->hl); } | |
334 | +bool PString::repay_g_h(const PEVeriable &horn, ExecContext *c) const{ return vrepay_h_g(horn, *this, c, horn.vl); } | |
335 | + | |
234 | 336 | /*************************************** PDouble ******************************************/ |
235 | 337 | bool PDouble::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
236 | 338 | bool PDouble::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; } |
@@ -254,6 +356,15 @@ | ||
254 | 356 | bool PDouble::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, c->hl); } |
255 | 357 | bool PDouble::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, horn.vl); } |
256 | 358 | |
359 | +bool PDouble::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
360 | +bool PDouble::repay_h_g(const PDouble &goal, ExecContext *c) const { return fabs(value - (double)goal.value) < DBL_EPSILON; } | |
361 | +bool PDouble::repay_h_g(const PInteger &goal, ExecContext *c) const { return fabs(value - (double)goal.value) < DBL_EPSILON; } | |
362 | +bool PDouble::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, c->hl); } | |
363 | +bool PDouble::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, goal.vl); } | |
364 | +bool PDouble::repay_g_h(const PDouble &horn, ExecContext *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; } | |
365 | +bool PDouble::repay_g_h(const PInteger &horn, ExecContext *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; } | |
366 | +bool PDouble::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, c->hl); } | |
367 | +bool PDouble::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, horn.vl); } | |
257 | 368 | |
258 | 369 | /*************************************** PInteger ******************************************/ |
259 | 370 | bool PInteger::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
@@ -278,6 +389,16 @@ | ||
278 | 389 | bool PInteger::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, c->hl); } |
279 | 390 | bool PInteger::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_h_g(horn, *this, c, horn.vl); } |
280 | 391 | |
392 | +bool PInteger::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
393 | +bool PInteger::repay_h_g(const PDouble &goal, ExecContext *c) const { return fabs(value - (double)goal.value) < DBL_EPSILON; } | |
394 | +bool PInteger::repay_h_g(const PInteger &goal, ExecContext *c) const { return value == goal.value; } | |
395 | +bool PInteger::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, c->hl); } | |
396 | +bool PInteger::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_g_h(goal, *this, c, goal.vl); } | |
397 | +bool PInteger::repay_g_h(const PDouble &horn, ExecContext *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; } | |
398 | +bool PInteger::repay_g_h(const PInteger &horn, ExecContext *c) const { return value == horn.value; } | |
399 | +bool PInteger::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, c->hl); } | |
400 | +bool PInteger::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_h_g(horn, *this, c, horn.vl); } | |
401 | + | |
281 | 402 | /*************************************** PList ******************************************/ |
282 | 403 | static __forceinline bool PList_unify(const PList &list) __attribute__((always_inline)); |
283 | 404 | static __forceinline bool PList_unify(const PList &list) |
@@ -299,6 +420,12 @@ | ||
299 | 420 | return false; |
300 | 421 | } |
301 | 422 | |
423 | +static __forceinline bool PList_repay(const PList &goal, const PList &horn, ExecContext *c) __attribute__((always_inline)); | |
424 | +static __forceinline bool PList_repay(const PList &goal, const PList &horn, ExecContext *c) | |
425 | +{ | |
426 | + if ( horn.lvalue->repay_h_g( *goal.lvalue, c) && horn.rvalue->repay_h_g( *goal.rvalue, c) ) return true; | |
427 | + return false; | |
428 | +} | |
302 | 429 | |
303 | 430 | bool PList::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
304 | 431 | bool PList::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PList_unify(*this); } |
@@ -321,6 +448,16 @@ | ||
321 | 448 | bool PList::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_getval_h_g(horn, *this, c, c->hl); } |
322 | 449 | bool PList::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_getval_h_g(horn, *this, c, horn.vl); } |
323 | 450 | |
451 | +bool PList::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
452 | +bool PList::repay_h_g(const PNil &goal, ExecContext *c) const { return PList_unify( *this); } | |
453 | +bool PList::repay_h_g(const PList &goal, ExecContext *c) const { return PList_repay( goal, *this, c); } | |
454 | +bool PList::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_getval_g_h(goal, *this, c, c->hl); } | |
455 | +bool PList::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_getval_g_h(goal, *this, c, goal.vl); } | |
456 | +bool PList::repay_g_h(const PNil &horn, ExecContext *c) const { return PList_unify( *this); } | |
457 | +bool PList::repay_g_h(const PList &horn, ExecContext *c) const { return PList_repay( *this, horn, c); } | |
458 | +bool PList::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_getval_h_g(horn, *this, c, c->hl); } | |
459 | +bool PList::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_getval_h_g(horn, *this, c, horn.vl); } | |
460 | + | |
324 | 461 | /*************************************** PArray ******************************************/ |
325 | 462 | static __forceinline bool PArray_unify(const PArray &goal, const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) __attribute__((always_inline)); |
326 | 463 | static __forceinline bool PArray_unify(const PArray &goal, const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) |
@@ -424,6 +561,57 @@ | ||
424 | 561 | return true; |
425 | 562 | } |
426 | 563 | |
564 | +static __forceinline bool PArray_repay(const PArray &goal, const PArray &horn, ExecContext *c) __attribute__((always_inline)); | |
565 | +static __forceinline bool PArray_repay(const PArray &goal, const PArray &horn, ExecContext *c) | |
566 | +{ | |
567 | + size_t gsiz = goal.value.size(); | |
568 | + size_t hsiz = horn.value.size(); | |
569 | + | |
570 | + c->ao = 0; | |
571 | + // 引数の数が同じ場合 | |
572 | + if ( gsiz == hsiz ) { | |
573 | + for ( size_t i = 0; i < gsiz; i++ ) { | |
574 | + c->uidx = i; | |
575 | + if ( !horn.value[i]->repay_h_g( *goal.value[i], c) ) { | |
576 | + return false; | |
577 | + } | |
578 | + } | |
579 | + } else if ( gsiz < hsiz && goal.args == true && horn.args == false ) { | |
580 | + // 引数の数が異なる場合、片方に@がある場合、可変長引数の対応を行う。 | |
581 | + size_t m = gsiz - 1; | |
582 | + // @変数の前まで普通にマッチングさせる | |
583 | + for ( size_t i = 0; i < m; i++ ) { | |
584 | + c->uidx = i; | |
585 | + if ( !horn.value[i]->repay_h_g( *goal.value[i], c) ) { | |
586 | + return false; | |
587 | + } | |
588 | + } | |
589 | + // @用の配列を作成する | |
590 | + c->uidx = m; | |
591 | + c->ao = pmm.newPArray(c->pobjs, horn, m, hsiz); | |
592 | + return goal.value[m]->repay_g_h( *c->ao, c); | |
593 | + | |
594 | + } else if ( gsiz > hsiz && goal.args == false && horn.args == true ) { | |
595 | + // 引数の数が異なる場合、片方に@がある場合、可変長引数の対応を行う。 | |
596 | + size_t m = hsiz - 1; | |
597 | + // @変数の前まで普通にマッチングさせる | |
598 | + for ( size_t i = 0; i < m; i++ ) { | |
599 | + c->uidx = i; | |
600 | + if ( !horn.value[i]->repay_h_g( *goal.value[i], c) ) { | |
601 | + return false; | |
602 | + } | |
603 | + } | |
604 | + // @用の配列を作成する | |
605 | + c->uidx = m; | |
606 | + c->ao = pmm.newPArray(c->pobjs, goal, m, gsiz); | |
607 | + return horn.value[m]->repay_h_g( *c->ao, c); | |
608 | + } else { | |
609 | + return false; | |
610 | + } | |
611 | + | |
612 | + return true; | |
613 | +} | |
614 | + | |
427 | 615 | bool PArray::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
428 | 616 | bool PArray::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { if ( value.empty() ) return true; return false; } |
429 | 617 | bool PArray::unify(const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PArray_unify( *this, horn, c, glocal, hlocal); } |
@@ -445,6 +633,16 @@ | ||
445 | 633 | bool PArray::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_getval_h_g(horn, *this, c, c->hl); } |
446 | 634 | bool PArray::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_getval_h_g(horn, *this, c, horn.vl); } |
447 | 635 | |
636 | +bool PArray::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
637 | +bool PArray::repay_h_g(const PNil &goal, ExecContext *c) const { if ( value.empty() ) return true; return false; } | |
638 | +bool PArray::repay_h_g(const PArray &goal, ExecContext *c) const { return PArray_repay( goal, *this, c); } | |
639 | +bool PArray::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_getval_g_h(goal, *this, c, c->hl); } | |
640 | +bool PArray::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_getval_g_h(goal, *this, c, goal.vl); } | |
641 | +bool PArray::repay_g_h(const PNil &horn, ExecContext *c) const { if ( value.empty() ) return true; return false; } | |
642 | +bool PArray::repay_g_h(const PArray &horn, ExecContext *c) const { return PArray_repay( *this, horn, c); } | |
643 | +bool PArray::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_getval_h_g(horn, *this, c, c->hl); } | |
644 | +bool PArray::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_getval_h_g(horn, *this, c, horn.vl); } | |
645 | + | |
448 | 646 | /*************************************** PPredicate ******************************************/ |
449 | 647 | static __forceinline bool PPredicate_unify(const PPredicate &goal, const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) __attribute__((always_inline)); |
450 | 648 | static __forceinline bool PPredicate_unify(const PPredicate &goal, const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) |
@@ -466,6 +664,16 @@ | ||
466 | 664 | return goal.arglist.match_g_h( horn.arglist, c); // horn.arglistがPObjectでない場合はこのように呼び出す |
467 | 665 | } |
468 | 666 | |
667 | +static __forceinline bool PPredicate_repay(const PPredicate &goal, const PPredicate &horn, ExecContext *c) __attribute__((always_inline)); | |
668 | +static __forceinline bool PPredicate_repay(const PPredicate &goal, const PPredicate &horn, ExecContext *c) | |
669 | +{ | |
670 | + // 呼び出し側(goal)がnamespaceを指定した場合、namespaceが一致している必要がある。 | |
671 | + if ( !goal.nspace.empty() && strcmp( horn.nspace.c_str(), goal.nspace.c_str()) != 0 ) { return false; } | |
672 | + | |
673 | + if ( !horn.name->repay_h_g( *goal.name, c) ) { return false; } | |
674 | + return goal.arglist.repay_g_h( horn.arglist, c); // horn.arglistがPObjectでない場合はこのように呼び出す | |
675 | +} | |
676 | + | |
469 | 677 | bool PPredicate::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
470 | 678 | bool PPredicate::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return PPredicate_unify( *this, horn, c, glocal, hlocal); } |
471 | 679 | bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, hlocal, glocal); } |
@@ -483,6 +691,14 @@ | ||
483 | 691 | bool PPredicate::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_getval_h_g(horn, *this, c, c->hl); } |
484 | 692 | bool PPredicate::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_getval_h_g(horn, *this, c, horn.vl); } |
485 | 693 | |
694 | +bool PPredicate::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
695 | +bool PPredicate::repay_h_g(const PPredicate &goal, ExecContext *c) const { return PPredicate_repay( goal, *this, c); } | |
696 | +bool PPredicate::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_getval_g_h(goal, *this, c, c->hl); } | |
697 | +bool PPredicate::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_getval_g_h(goal, *this, c, goal.vl); } | |
698 | +bool PPredicate::repay_g_h(const PPredicate &horn, ExecContext *c) const { return PPredicate_repay( *this, horn, c); } | |
699 | +bool PPredicate::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_getval_h_g(horn, *this, c, c->hl); } | |
700 | +bool PPredicate::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_getval_h_g(horn, *this, c, horn.vl); } | |
701 | + | |
486 | 702 | /*************************************** PVeriable ******************************************/ |
487 | 703 | bool PVeriable::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
488 | 704 | bool PVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(*this, horn, c, glocal, hlocal); } |
@@ -525,6 +741,26 @@ | ||
525 | 741 | bool PVeriable::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_ver_g_h(*this, horn, c, c->gl, c->hl); } |
526 | 742 | bool PVeriable::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_ver_g_h(*this, horn, c, c->gl, horn.vl); } |
527 | 743 | |
744 | +bool PVeriable::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
745 | +bool PVeriable::repay_h_g(const PNil &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, c->hl); } | |
746 | +bool PVeriable::repay_h_g(const PString &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, c->hl); } | |
747 | +bool PVeriable::repay_h_g(const PDouble &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, c->hl); } | |
748 | +bool PVeriable::repay_h_g(const PInteger &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, c->hl); } | |
749 | +bool PVeriable::repay_h_g(const PList &goal, ExecContext *c) const { return vrepay_getval_h_g(*this, goal, c, c->hl); } | |
750 | +bool PVeriable::repay_h_g(const PArray &goal, ExecContext *c) const { return vrepay_getval_h_g(*this, goal, c, c->hl); } | |
751 | +bool PVeriable::repay_h_g(const PPredicate &goal, ExecContext *c) const { return vrepay_getval_h_g(*this, goal, c, c->hl); } | |
752 | +bool PVeriable::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_ver_g_h(goal, *this, c, c->gl, c->hl); } | |
753 | +bool PVeriable::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_ver_g_h(goal, *this, c, goal.vl, c->hl); } | |
754 | +bool PVeriable::repay_g_h(const PNil &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, c->gl); } | |
755 | +bool PVeriable::repay_g_h(const PString &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, c->gl); } | |
756 | +bool PVeriable::repay_g_h(const PDouble &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, c->gl); } | |
757 | +bool PVeriable::repay_g_h(const PInteger &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, c->gl); } | |
758 | +bool PVeriable::repay_g_h(const PList &horn, ExecContext *c) const { return vrepay_getval_g_h(*this, horn, c, c->gl); } | |
759 | +bool PVeriable::repay_g_h(const PArray &horn, ExecContext *c) const { return vrepay_getval_g_h(*this, horn, c, c->gl); } | |
760 | +bool PVeriable::repay_g_h(const PPredicate &horn, ExecContext *c) const { return vrepay_getval_g_h(*this, horn, c, c->gl); } | |
761 | +bool PVeriable::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_ver_g_h(*this, horn, c, c->gl, c->hl); } | |
762 | +bool PVeriable::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_ver_g_h(*this, horn, c, c->gl, horn.vl); } | |
763 | + | |
528 | 764 | /*************************************** PEVeriable ******************************************/ |
529 | 765 | bool PEVeriable::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); } |
530 | 766 | bool PEVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify(*this, horn, c, vl, hlocal); } |
@@ -567,6 +803,25 @@ | ||
567 | 803 | bool PEVeriable::match_g_h(const PVeriable &horn, ExecContext *c) const { return vmatch_ver_g_h(*this, horn, c, vl, c->hl); } |
568 | 804 | bool PEVeriable::match_g_h(const PEVeriable &horn, ExecContext *c) const { return vmatch_ver_g_h(*this, horn, c, vl, horn.vl); } |
569 | 805 | |
806 | +bool PEVeriable::repay_h_g(const PObject &goal, ExecContext *c) const { return goal.repay_g_h(*this, c); } | |
807 | +bool PEVeriable::repay_h_g(const PNil &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, vl); } | |
808 | +bool PEVeriable::repay_h_g(const PString &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, vl); } | |
809 | +bool PEVeriable::repay_h_g(const PDouble &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, vl); } | |
810 | +bool PEVeriable::repay_h_g(const PInteger &goal, ExecContext *c) const { return vrepay_h_g(*this, goal, c, vl); } | |
811 | +bool PEVeriable::repay_h_g(const PList &goal, ExecContext *c) const { return vrepay_getval_h_g(*this, goal, c, vl); } | |
812 | +bool PEVeriable::repay_h_g(const PArray &goal, ExecContext *c) const { return vrepay_getval_h_g(*this, goal, c, vl); } | |
813 | +bool PEVeriable::repay_h_g(const PPredicate &goal, ExecContext *c) const { return vrepay_getval_h_g(*this, goal, c, vl); } | |
814 | +bool PEVeriable::repay_h_g(const PVeriable &goal, ExecContext *c) const { return vrepay_ver_g_h(goal, *this, c, c->gl, vl); } | |
815 | +bool PEVeriable::repay_h_g(const PEVeriable &goal, ExecContext *c) const { return vrepay_ver_g_h(goal, *this, c, goal.vl, vl); } | |
816 | +bool PEVeriable::repay_g_h(const PNil &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, vl); } | |
817 | +bool PEVeriable::repay_g_h(const PString &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, vl); } | |
818 | +bool PEVeriable::repay_g_h(const PDouble &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, vl); } | |
819 | +bool PEVeriable::repay_g_h(const PInteger &horn, ExecContext *c) const { return vrepay_g_h(*this, horn, c, vl); } | |
820 | +bool PEVeriable::repay_g_h(const PList &horn, ExecContext *c) const { return vrepay_getval_g_h(*this, horn, c, vl); } | |
821 | +bool PEVeriable::repay_g_h(const PArray &horn, ExecContext *c) const { return vrepay_getval_g_h(*this, horn, c, vl); } | |
822 | +bool PEVeriable::repay_g_h(const PPredicate &horn, ExecContext *c) const { return vrepay_getval_g_h(*this, horn, c, vl); } | |
823 | +bool PEVeriable::repay_g_h(const PVeriable &horn, ExecContext *c) const { return vrepay_ver_g_h(*this, horn, c, vl, c->hl); } | |
824 | +bool PEVeriable::repay_g_h(const PEVeriable &horn, ExecContext *c) const { return vrepay_ver_g_h(*this, horn, c, vl, horn.vl); } | |
570 | 825 | /*************************************** getval ******************************************/ |
571 | 826 | const PObject *PList::getval( ExecContextRoot *c) const |
572 | 827 | { |
@@ -195,6 +195,29 @@ | ||
195 | 195 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const { return false; } |
196 | 196 | virtual bool match_g_h(const PWildCard &horn, ExecContext *c) const { return true; } |
197 | 197 | |
198 | + // execute後の戻り値の設定 | |
199 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const { return false; } | |
200 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const { return false; } | |
201 | + virtual bool repay_h_g(const PString &goal, ExecContext *c) const { return false; } | |
202 | + virtual bool repay_h_g(const PDouble &goal, ExecContext *c) const { return false; } | |
203 | + virtual bool repay_h_g(const PInteger &goal, ExecContext *c) const { return false; } | |
204 | + virtual bool repay_h_g(const PList &goal, ExecContext *c) const { return false; } | |
205 | + virtual bool repay_h_g(const PArray &goal, ExecContext *c) const { return false; } | |
206 | + virtual bool repay_h_g(const PPredicate &goal, ExecContext *c) const { return false; } | |
207 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const { return false; } | |
208 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const { return false; } | |
209 | + virtual bool repay_h_g(const PWildCard &goal, ExecContext *c) const { return true; } | |
210 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const { return false; } | |
211 | + virtual bool repay_g_h(const PString &horn, ExecContext *c) const { return false; } | |
212 | + virtual bool repay_g_h(const PDouble &horn, ExecContext *c) const { return false; } | |
213 | + virtual bool repay_g_h(const PInteger &horn, ExecContext *c) const { return false; } | |
214 | + virtual bool repay_g_h(const PList &horn, ExecContext *c) const { return false; } | |
215 | + virtual bool repay_g_h(const PArray &horn, ExecContext *c) const { return false; } | |
216 | + virtual bool repay_g_h(const PPredicate &horn, ExecContext *c) const { return false; } | |
217 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const { return false; } | |
218 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const { return false; } | |
219 | + virtual bool repay_g_h(const PWildCard &horn, ExecContext *c) const { return true; } | |
220 | + | |
198 | 221 | // 値の取得(unify時に使用、必要なら代入用の変更PEVariableを作成する) |
199 | 222 | virtual const PObject *getval( ExecContextRoot *) const { return this; } |
200 | 223 | virtual const PObject *getval2( ExecContextRoot *, VLocal *) const { return this; } |
@@ -327,7 +350,7 @@ | ||
327 | 350 | virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const; |
328 | 351 | virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const; |
329 | 352 | |
330 | - //ホーン節検索時のマッチング | |
353 | + // ホーン節検索時のマッチング | |
331 | 354 | virtual bool match_h_g(const PObject &goal, ExecContext *c) const; |
332 | 355 | virtual bool match_h_g(const PNil &goal, ExecContext *c) const; |
333 | 356 | virtual bool match_h_g(const PList &goal, ExecContext *c) const; |
@@ -338,6 +361,17 @@ | ||
338 | 361 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
339 | 362 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
340 | 363 | |
364 | + // execute後の戻り値の設定 | |
365 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
366 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const; | |
367 | + virtual bool repay_h_g(const PList &goal, ExecContext *c) const; | |
368 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
369 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
370 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const; | |
371 | + virtual bool repay_g_h(const PList &horn, ExecContext *c) const; | |
372 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
373 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
374 | + | |
341 | 375 | // 変換して値を取得 |
342 | 376 | virtual bool cnv_string(string &value) const { return true; }; |
343 | 377 |
@@ -440,6 +474,15 @@ | ||
440 | 474 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
441 | 475 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
442 | 476 | |
477 | + // execute後の戻り値の設定 | |
478 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
479 | + virtual bool repay_h_g(const PString &goal, ExecContext *c) const; | |
480 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
481 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
482 | + virtual bool repay_g_h(const PString &horn, ExecContext *c) const; | |
483 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
484 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
485 | + | |
443 | 486 | // 値の取得 |
444 | 487 | virtual const char *c_str() const { return value.c_str(); }; |
445 | 488 |
@@ -563,7 +606,18 @@ | ||
563 | 606 | virtual bool match_g_h(const PInteger &horn, ExecContext *c) const; |
564 | 607 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
565 | 608 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
566 | - | |
609 | + | |
610 | + // execute後の戻り値の設定 | |
611 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
612 | + virtual bool repay_h_g(const PDouble &goal, ExecContext *c) const; | |
613 | + virtual bool repay_h_g(const PInteger &goal, ExecContext *c) const; | |
614 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
615 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
616 | + virtual bool repay_g_h(const PDouble &horn, ExecContext *c) const; | |
617 | + virtual bool repay_g_h(const PInteger &horn, ExecContext *c) const; | |
618 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
619 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
620 | + | |
567 | 621 | //値の取得 |
568 | 622 | virtual const double *c_double() const { return &value; }; |
569 | 623 |
@@ -695,6 +749,16 @@ | ||
695 | 749 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
696 | 750 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
697 | 751 | |
752 | + // execute後の戻り値の設定 | |
753 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
754 | + virtual bool repay_h_g(const PDouble &goal, ExecContext *c) const; | |
755 | + virtual bool repay_h_g(const PInteger &goal, ExecContext *c) const; | |
756 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
757 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
758 | + virtual bool repay_g_h(const PDouble &horn, ExecContext *c) const; | |
759 | + virtual bool repay_g_h(const PInteger &horn, ExecContext *c) const; | |
760 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
761 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
698 | 762 | |
699 | 763 | // 値の取得 |
700 | 764 | mutable PINTEGER32 value32; |
@@ -911,6 +975,17 @@ | ||
911 | 975 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
912 | 976 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
913 | 977 | |
978 | + // execute後の戻り値の設定 | |
979 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
980 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const; | |
981 | + virtual bool repay_h_g(const PList &goal, ExecContext *c) const; | |
982 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
983 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
984 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const; | |
985 | + virtual bool repay_g_h(const PList &horn, ExecContext *c) const; | |
986 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
987 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
988 | + | |
914 | 989 | // 値の取得 |
915 | 990 | virtual const PObject *getval( ExecContextRoot *) const; |
916 | 991 | virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const; |
@@ -1234,7 +1309,18 @@ | ||
1234 | 1309 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
1235 | 1310 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
1236 | 1311 | |
1312 | + // execute後の戻り値の設定 | |
1313 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
1314 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const; | |
1315 | + virtual bool repay_h_g(const PArray &goal, ExecContext *c) const; | |
1316 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
1317 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
1318 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const; | |
1319 | + virtual bool repay_g_h(const PArray &horn, ExecContext *c) const; | |
1320 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
1321 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
1237 | 1322 | |
1323 | + | |
1238 | 1324 | // 値の取得 |
1239 | 1325 | virtual const PObject *getval( ExecContextRoot *c) const; |
1240 | 1326 | virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const; |
@@ -1487,6 +1573,15 @@ | ||
1487 | 1573 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
1488 | 1574 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
1489 | 1575 | |
1576 | + // execute後の戻り値の設定 | |
1577 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
1578 | + virtual bool repay_h_g(const PPredicate &goal, ExecContext *c) const; | |
1579 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
1580 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
1581 | + virtual bool repay_g_h(const PPredicate &horn, ExecContext *c) const; | |
1582 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
1583 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
1584 | + | |
1490 | 1585 | // 値の取得 |
1491 | 1586 | virtual const PObject *getval( ExecContextRoot *c) const; |
1492 | 1587 | virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const; |
@@ -1612,6 +1707,27 @@ | ||
1612 | 1707 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
1613 | 1708 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
1614 | 1709 | |
1710 | + // execute後の戻り値の設定 | |
1711 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
1712 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const; | |
1713 | + virtual bool repay_h_g(const PString &goal, ExecContext *c) const; | |
1714 | + virtual bool repay_h_g(const PDouble &goal, ExecContext *c) const; | |
1715 | + virtual bool repay_h_g(const PInteger &goal, ExecContext *c) const; | |
1716 | + virtual bool repay_h_g(const PList &goal, ExecContext *c) const; | |
1717 | + virtual bool repay_h_g(const PArray &goal, ExecContext *c) const; | |
1718 | + virtual bool repay_h_g(const PPredicate &goal, ExecContext *c) const; | |
1719 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
1720 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
1721 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const; | |
1722 | + virtual bool repay_g_h(const PString &horn, ExecContext *c) const; | |
1723 | + virtual bool repay_g_h(const PDouble &horn, ExecContext *c) const; | |
1724 | + virtual bool repay_g_h(const PInteger &horn, ExecContext *c) const; | |
1725 | + virtual bool repay_g_h(const PList &horn, ExecContext *c) const; | |
1726 | + virtual bool repay_g_h(const PArray &horn, ExecContext *c) const; | |
1727 | + virtual bool repay_g_h(const PPredicate &horn, ExecContext *c) const; | |
1728 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
1729 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
1730 | + | |
1615 | 1731 | // 値の取得 |
1616 | 1732 | virtual const PObject *getval( ExecContextRoot *c) const ; |
1617 | 1733 | virtual const PObject *getval2( ExecContextRoot *c, VLocal *vlocal) const ; |
@@ -1730,9 +1846,29 @@ | ||
1730 | 1846 | virtual bool match_g_h(const PWildCard &horn, ExecContext *c) const { return true; } |
1731 | 1847 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const{ return true; } |
1732 | 1848 | |
1733 | - // 値の取得 | |
1734 | - // 代入 | |
1735 | - | |
1849 | + // execute後の戻り値の設定 | |
1850 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const { return true; } | |
1851 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const { return true; } | |
1852 | + virtual bool repay_h_g(const PString &goal, ExecContext *c) const { return true; } | |
1853 | + virtual bool repay_h_g(const PDouble &goal, ExecContext *c) const { return true; } | |
1854 | + virtual bool repay_h_g(const PInteger &goal, ExecContext *c) const { return true; } | |
1855 | + virtual bool repay_h_g(const PList &goal, ExecContext *c) const { return true; } | |
1856 | + virtual bool repay_h_g(const PArray &goal, ExecContext *c) const { return true; } | |
1857 | + virtual bool repay_h_g(const PPredicate &goal, ExecContext *c) const { return true; } | |
1858 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const { return true; } | |
1859 | + virtual bool repay_h_g(const PWildCard &goal, ExecContext *c) const { return true; } | |
1860 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const{ return true; } | |
1861 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const { return true; } | |
1862 | + virtual bool repay_g_h(const PString &horn, ExecContext *c) const { return true; } | |
1863 | + virtual bool repay_g_h(const PDouble &horn, ExecContext *c) const { return true; } | |
1864 | + virtual bool repay_g_h(const PInteger &horn, ExecContext *c) const { return true; } | |
1865 | + virtual bool repay_g_h(const PList &horn, ExecContext *c) const { return true; } | |
1866 | + virtual bool repay_g_h(const PArray &horn, ExecContext *c) const { return true; } | |
1867 | + virtual bool repay_g_h(const PPredicate &horn, ExecContext *c) const { return true; } | |
1868 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const { return true; } | |
1869 | + virtual bool repay_g_h(const PWildCard &horn, ExecContext *c) const { return true; } | |
1870 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const{ return true; } | |
1871 | + | |
1736 | 1872 | // メモリマネージャによるdelete |
1737 | 1873 | virtual void del(); |
1738 | 1874 | virtual void deltree(PObjectArray *objs); // objsに関係しているメモリを削除(持っているオブジェクトも合わせて削除する) |
@@ -1831,6 +1967,27 @@ | ||
1831 | 1967 | virtual bool match_g_h(const PVeriable &horn, ExecContext *c) const; |
1832 | 1968 | virtual bool match_g_h(const PEVeriable &horn, ExecContext *c) const; |
1833 | 1969 | |
1970 | + // execute後の戻り値の設定 | |
1971 | + virtual bool repay_h_g(const PObject &goal, ExecContext *c) const; | |
1972 | + virtual bool repay_h_g(const PNil &goal, ExecContext *c) const; | |
1973 | + virtual bool repay_h_g(const PString &goal, ExecContext *c) const; | |
1974 | + virtual bool repay_h_g(const PDouble &goal, ExecContext *c) const; | |
1975 | + virtual bool repay_h_g(const PInteger &goal, ExecContext *c) const; | |
1976 | + virtual bool repay_h_g(const PList &goal, ExecContext *c) const; | |
1977 | + virtual bool repay_h_g(const PArray &goal, ExecContext *c) const; | |
1978 | + virtual bool repay_h_g(const PPredicate &goal, ExecContext *c) const; | |
1979 | + virtual bool repay_h_g(const PVeriable &goal, ExecContext *c) const; | |
1980 | + virtual bool repay_h_g(const PEVeriable &goal, ExecContext *c) const; | |
1981 | + virtual bool repay_g_h(const PNil &horn, ExecContext *c) const; | |
1982 | + virtual bool repay_g_h(const PString &horn, ExecContext *c) const; | |
1983 | + virtual bool repay_g_h(const PDouble &horn, ExecContext *c) const; | |
1984 | + virtual bool repay_g_h(const PInteger &horn, ExecContext *c) const; | |
1985 | + virtual bool repay_g_h(const PList &horn, ExecContext *c) const; | |
1986 | + virtual bool repay_g_h(const PArray &horn, ExecContext *c) const; | |
1987 | + virtual bool repay_g_h(const PPredicate &horn, ExecContext *c) const; | |
1988 | + virtual bool repay_g_h(const PVeriable &horn, ExecContext *c) const; | |
1989 | + virtual bool repay_g_h(const PEVeriable &horn, ExecContext *c) const; | |
1990 | + | |
1834 | 1991 | // 値の取得 |
1835 | 1992 | virtual const PObject *getval( ExecContextRoot *c) const; |
1836 | 1993 | virtual const PObject *getval2( ExecContextRoot *c, VLocal *) const; |
@@ -23,12 +23,12 @@ | ||
23 | 23 | |
24 | 24 | // 定数 |
25 | 25 | #ifdef ___X64____ |
26 | -#define VERSION_TEXT "ADP Ver 0.82.0307 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.0308 X64 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
27 | 27 | #else |
28 | 28 | #if _WIN32 |
29 | -#define VERSION_TEXT "ADP Ver 0.82.0307 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.0308 x86 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
30 | 30 | #else |
31 | -#define VERSION_TEXT "ADP Ver 0.82.0307 (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.0308 (http://www.adp.la/)\nCopyright (C) 2010-2012 Katsuhisa Ohfuji. This progman is distributed under GPL.\n" | |
32 | 32 | #endif |
33 | 33 | #endif |
34 | 34 |
@@ -645,21 +645,19 @@ | ||
645 | 645 | // 実行後の代入処理 |
646 | 646 | for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) { |
647 | 647 | if ( hsiz == gsiz || ((*i) < hsiz - 1 && (*i) < gsiz - 1) ) { |
648 | - flg = horn->head.arglist.value[*i]->unify( *pred->arglist.value[*i], this, hl, gl); | |
648 | + flg = horn->head.arglist.value[*i]->repay_h_g( *pred->arglist.value[*i], this); | |
649 | 649 | } else if ( gsiz < hsiz ) { |
650 | - flg = ao->unify( *pred->arglist.value[*i], this, hl, gl); | |
650 | + flg = ao->repay_h_g( *pred->arglist.value[*i], this); | |
651 | 651 | } else { |
652 | - flg = horn->head.arglist.value[*i]->unify( *ao, this, hl, gl); | |
652 | + flg = horn->head.arglist.value[*i]->repay_h_g( *ao, this); | |
653 | 653 | } |
654 | - if ( !flg ) { | |
655 | - break; | |
656 | - } | |
654 | + if ( !flg ) break; | |
657 | 655 | } |
658 | 656 | if ( flg ) { |
659 | 657 | if ( goal->nobacktrack == true ) { |
660 | 658 | // ↓変数の受け渡しをclone/deleteで行っているが、objs間の移動の方が効率はよくないか?(検索が入るのでこちらの方が早い?) |
661 | 659 | // バグフィックス |
662 | -#if 1 | |
660 | +#if 0 | |
663 | 661 | for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) { |
664 | 662 | const PVeriable *v = dynamic_cast<const PVeriable*>((*pred)[*i]); |
665 | 663 | if ( v ) { |
@@ -727,11 +725,11 @@ | ||
727 | 725 | // 実行後の代入処理 |
728 | 726 | for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) { |
729 | 727 | if ( hsiz == gsiz || ((*i) < hsiz - 1 && (*i) < gsiz - 1) ) { |
730 | - flg = horn->head.arglist.value[*i]->unify( *pred->arglist.value[*i], this, hl, gl); | |
728 | + flg = horn->head.arglist.value[*i]->repay_h_g( *pred->arglist.value[*i], this); | |
731 | 729 | } else if ( gsiz < hsiz ) { |
732 | - flg = ao->unify( *pred->arglist.value[*i], this, hl, gl); | |
730 | + flg = ao->repay_h_g( *pred->arglist.value[*i], this); | |
733 | 731 | } else { |
734 | - flg = horn->head.arglist.value[*i]->unify( *ao, this, hl, gl); | |
732 | + flg = horn->head.arglist.value[*i]->repay_h_g( *ao, this); | |
735 | 733 | } |
736 | 734 | if ( !flg ) break; |
737 | 735 | } |
@@ -739,7 +737,7 @@ | ||
739 | 737 | if ( goal->nobacktrack == true ) { |
740 | 738 | // ↓変数の受け渡しをclone/deleteで行っているが、objs間の移動の方が効率はよくないか?(検索が入るのでこちらの方が早い?) |
741 | 739 | // バグフィックス |
742 | -#if 1 | |
740 | +#if 0 | |
743 | 741 | for ( ArrayNoexpand<size_t>::iterator i = afterunify.begin(); i < afterunify.end(); i++ ) { |
744 | 742 | const PVeriable *v = dynamic_cast<const PVeriable*>((*pred)[*i]); |
745 | 743 | if ( v ) { |