• R/O
  • SSH
  • HTTPS

adp: Commit


Commit MetaInfo

Revision287 (tree)
Time2012-06-06 10:55:31
Authorohfuji

Log Message

unify系のメソッドの整理(1)

Change Summary

Incremental Difference

--- trunk/adp_unify.cpp (revision 286)
+++ trunk/adp_unify.cpp (revision 287)
@@ -18,6 +18,13 @@
1818 */
1919 #include "adp.h"
2020
21+/*************************************** unify系テンプレート ******************************************/
22+#if 0
23+template<class _InIt,
24+ class _Fn1> inline
25+#endif
26+
27+
2128 /*************************************** getPridicate() ******************************************/
2229 const PPredicate *PVeriable::getPredicate(VLocal *local) const
2330 {
@@ -67,11 +74,11 @@
6774 /*************************************** unify ******************************************/
6875
6976 // 変項のunify本体で使うテンプレート関数
70-template <class T> bool PVeriable::vunify(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
77+template <class V, class T> bool inline vunify(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
7178 {
72- const PObject *gitem = (*glocal)[idx];
79+ const PObject *gitem = (*glocal)[goal.idx];
7380 if ( gitem == 0 ) {
74- (*glocal)[idx] = &horn;
81+ (*glocal)[goal.idx] = &horn;
7582 return true;
7683 } else {
7784 return gitem->unify( horn, c, glocal, hlocal);
@@ -79,12 +86,12 @@
7986 return true;
8087 }
8188
82-template <class T> bool PVeriable::vunify_getval(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
89+template <class V, class T> bool inline vunify_getval(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
8390 {
84- const PObject *gitem = (*glocal)[idx];
91+ const PObject *gitem = (*glocal)[goal.idx];
8592 if ( gitem == 0 ) {
8693 const PObject *p = horn.getval(c, hlocal);
87- (*glocal)[idx] = p;
94+ (*glocal)[goal.idx] = p;
8895 if ( p->isc() ) return true;
8996 } else {
9097 return gitem->unify( horn, c, glocal, hlocal);
@@ -98,9 +105,9 @@
98105 return true;
99106 }
100107
101-template <class T> bool PVeriable::vunify_ver(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
108+template <class V, class T> bool inline vunify_ver(const V &goal, const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal)
102109 {
103- const PObject *gval = (*glocal)[idx];
110+ const PObject *gval = (*glocal)[goal.idx];
104111 const PObject *hval = (*hlocal)[horn.idx];
105112 if ( gval != 0 ) {
106113 if ( hval != 0 ) {
@@ -112,7 +119,7 @@
112119 }
113120 } else if ( hval != 0 ) {
114121 const PObject *p = hval->getval(c, hlocal);
115- (*glocal)[idx] = p;
122+ (*glocal)[goal.idx] = p;
116123 if ( p->isc() ) return true;
117124 }
118125
@@ -125,106 +132,51 @@
125132 }
126133
127134
128-template <class T> bool PEVeriable::vunify(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
129-{
130- const PObject *gitem = (*glocal)[idx];
131- if ( gitem == 0 ) {
132- (*glocal)[idx] = &horn;
133- } else {
134- return gitem->unify( horn, c, glocal, hlocal);
135- }
136- return true;
137-}
138-
139-template <class T> bool PEVeriable::vunify_getval(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
140-{
141- const PObject *gitem = (*glocal)[idx];
142- if ( gitem == 0 ) {
143- const PObject *p = horn.getval(c, hlocal);
144- (*glocal)[idx] = p;
145- if ( p->isc() ) return true;
146- } else {
147- return gitem->unify( horn, c, glocal, hlocal);
148- }
149-
150-#if 1
151- if ( c->pafterunify != 0 ) {
152- c->pafterunify->push_back(c->uidx);
153- }
154-#endif
155- return true;
156-}
157-
158-template <class T> bool PEVeriable::vunify_ver(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
159-{
160- const PObject *gval = (*glocal)[idx];
161- const PObject *hval = (*hlocal)[horn.idx];
162- if ( gval != 0 ) {
163- if ( hval != 0 ) {
164- return hval->unify( *gval, c, hlocal, glocal);
165- } else {
166- const PObject *p = gval->getval(c, glocal);
167- (*hlocal)[horn.idx] = p;
168- if ( p->isc() ) return true;
169- }
170- } else if ( hval != 0 ) {
171- const PObject *p = hval->getval(c, hlocal);
172- (*glocal)[idx] = p;
173- if ( p->isc() ) return true;
174- }
175-#if 1
176- if ( c->pafterunify != 0 ) {
177- c->pafterunify->push_back(c->uidx);
178- }
179-#endif
180- return true;
181-}
182-
183135 bool PNil::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
184136 bool PNil::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return true; }
185137 bool PNil::unify(const PList &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.unify( *this, c, hlocal, glocal); }
186-bool PNil::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PNil>(*this, c, hlocal, glocal); }
187-bool PNil::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PNil>(*this, c, horn.vl, glocal); }
138+bool PNil::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, hlocal, glocal); }
139+bool PNil::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, horn.vl, glocal); }
188140
189141 bool PNil::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
190142 bool PNil::unify(const PNil &horn, ExecContextRoot *c) const { return true; }
191143 bool PNil::unify(const PList &horn, ExecContextRoot *c) const { return horn.unify( *this, c); }
192-bool PNil::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PNil>(*this, c, c->hl, c->gl); }
193-bool PNil::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PNil>(*this, c, horn.vl, c->gl); }
144+bool PNil::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
145+bool PNil::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
194146
195147 bool PString::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
196148 bool PString::unify(const PString &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return strcmp( value.c_str(), horn.value.c_str()) == 0; }
197-bool PString::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PString>(*this, c, hlocal, glocal); }
198-bool PString::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PString>(*this, c, horn.vl, glocal); }
149+bool PString::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, hlocal, glocal); }
150+bool PString::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, horn.vl, glocal); }
199151
200152 bool PString::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
201153 bool PString::unify(const PString &horn, ExecContextRoot *c) const { return strcmp( value.c_str(), horn.value.c_str()) == 0; }
202-bool PString::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PString>(*this, c, c->hl, c->gl); }
203-bool PString::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PString>(*this, c, horn.vl, c->gl); }
154+bool PString::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
155+bool PString::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
204156
205157 bool PDouble::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
206158 bool PDouble::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
207159 bool PDouble::unify(const PInteger &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
208-bool PDouble::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PDouble>(*this, c, hlocal, glocal); }
209-bool PDouble::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PDouble>(*this, c, horn.vl, glocal); }
160+bool PDouble::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, hlocal, glocal); }
161+bool PDouble::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, horn.vl, glocal); }
210162
211163 bool PDouble::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
212164 bool PDouble::unify(const PDouble &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
213165 bool PDouble::unify(const PInteger &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
214-bool PDouble::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PDouble>(*this, c, c->hl, c->gl); }
215-bool PDouble::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PDouble>(*this, c, horn.vl, c->gl); }
166+bool PDouble::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
167+bool PDouble::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
216168
217169 bool PInteger::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
218170 bool PInteger::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
219171 bool PInteger::unify(const PInteger &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return value == horn.value; }
220-bool PInteger::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PInteger>(*this, c, hlocal, glocal); }
221-bool PInteger::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify<PInteger>(*this, c, horn.vl, glocal); }
172+bool PInteger::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, hlocal, glocal); }
173+bool PInteger::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(horn, *this, c, horn.vl, glocal); }
222174
223175 bool PInteger::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
224176 bool PInteger::unify(const PDouble &horn, ExecContextRoot *c) const { return fabs(value - (double)horn.value) < DBL_EPSILON; }
225177 bool PInteger::unify(const PInteger &horn, ExecContextRoot *c) const { return value == horn.value; }
226-bool PInteger::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PInteger>(*this, c, c->hl, c->gl); }
227-bool PInteger::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify<PInteger>(*this, c, horn.vl, c->gl); }
178+bool PInteger::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, c->hl, c->gl); }
179+bool PInteger::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify(horn, *this, c, horn.vl, c->gl); }
228180
229181 bool PList::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
230182 bool PList::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const {
@@ -236,8 +188,8 @@
236188 if ( horn.lvalue->unify( *lvalue, c, hlocal, glocal) && horn.rvalue->unify( *rvalue, c, hlocal, glocal) ) return true;
237189 return false;
238190 }
239-bool PList::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify_getval<PList>(*this, c, hlocal, glocal); }
240-bool PList::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify_getval<PList>(*this, c, horn.vl, glocal); }
191+bool PList::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, hlocal, glocal); }
192+bool PList::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, horn.vl, glocal); }
241193
242194 bool PList::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
243195 bool PList::unify(const PNil &horn, ExecContextRoot *c) const {
@@ -249,8 +201,8 @@
249201 if ( horn.lvalue->unify( *lvalue, c) && horn.rvalue->unify( *rvalue, c) ) return true;
250202 return false;
251203 }
252-bool PList::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify_getval<PList>(*this, c, c->hl, c->gl); }
253-bool PList::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify_getval<PList>(*this, c, horn.vl, c->gl); }
204+bool PList::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, c->hl, c->gl); }
205+bool PList::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, horn.vl, c->gl); }
254206
255207 bool PArray::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
256208 bool PArray::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { if ( value.empty() ) return true; return false; }
@@ -303,14 +255,14 @@
303255
304256 return true;
305257 }
306-bool PArray::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify_getval<PArray>(*this, c, hlocal, glocal); }
307-bool PArray::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify_getval<PArray>(*this, c, horn.vl, glocal); }
258+bool PArray::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, hlocal, glocal); }
259+bool PArray::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, horn.vl, glocal); }
308260
309261 bool PArray::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
310262 bool PArray::unify(const PNil &horn, ExecContextRoot *c) const { if ( value.empty() ) return true; return false; }
311263 bool PArray::unify(const PArray &horn, ExecContextRoot *c) const { return unify( horn, c, c->gl, c->hl);}
312-bool PArray::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify_getval<PArray>(*this, c, c->hl, c->gl); }
313-bool PArray::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify_getval<PArray>(*this, c, horn.vl, c->gl); }
264+bool PArray::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, c->hl, c->gl); }
265+bool PArray::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, horn.vl, c->gl); }
314266
315267 bool PPredicate::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
316268 bool PPredicate::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const
@@ -321,8 +273,8 @@
321273 if ( !horn.name->unify( *name, c, hlocal, glocal) ) { return false; }
322274 return arglist.unify( horn.arglist, c, glocal, hlocal); // horn.arglistがPObjectでない場合はこのように呼び出す
323275 }
324-bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify_getval<PPredicate>(*this, c, hlocal, glocal); }
325-bool PPredicate::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return horn.vunify_getval<PPredicate>(*this, c, horn.vl, glocal); }
276+bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, hlocal, glocal); }
277+bool PPredicate::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(horn, *this, c, horn.vl, glocal); }
326278
327279 bool PPredicate::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
328280 bool PPredicate::unify(const PPredicate &horn, ExecContextRoot *c) const
@@ -333,51 +285,51 @@
333285 if ( !horn.name->unify( *name, c) ) { return false; }
334286 return arglist.unify( horn.arglist, c); // horn.arglistがPObjectでない場合はこのように呼び出す
335287 }
336-bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c) const { return horn.vunify_getval<PPredicate>(*this, c, c->hl, c->gl); }
337-bool PPredicate::unify(const PEVeriable &horn, ExecContextRoot *c) const { return horn.vunify_getval<PPredicate>(*this, c, horn.vl, c->gl); }
288+bool PPredicate::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, c->hl, c->gl); }
289+bool PPredicate::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_getval(horn, *this, c, horn.vl, c->gl); }
338290
339291
340292 bool PVeriable::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
341-bool PVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify<PNil>(horn, c, glocal, hlocal); }
342-bool PVeriable::unify(const PString &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify<PString>(horn, c, glocal, hlocal); }
343-bool PVeriable::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify<PDouble>(horn, c, glocal, hlocal); }
344-bool PVeriable::unify(const PInteger &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify<PInteger>(horn, c, glocal, hlocal); }
345-bool PVeriable::unify(const PList &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval<PList>(horn, c, glocal, hlocal); }
346-bool PVeriable::unify(const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval<PArray>(horn, c, glocal, hlocal); }
347-bool PVeriable::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval<PPredicate>(horn, c, glocal, hlocal); }
348-bool PVeriable::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_ver<PVeriable>(horn, c, glocal, hlocal); }
349-bool PVeriable::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *) const { return vunify_ver<PEVeriable>(horn, c, glocal, horn.vl); }
293+bool PVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(*this, horn, c, glocal, hlocal); }
294+bool PVeriable::unify(const PString &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(*this, horn, c, glocal, hlocal); }
295+bool PVeriable::unify(const PDouble &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(*this, horn, c, glocal, hlocal); }
296+bool PVeriable::unify(const PInteger &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify(*this, horn, c, glocal, hlocal); }
297+bool PVeriable::unify(const PList &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(*this, horn, c, glocal, hlocal); }
298+bool PVeriable::unify(const PArray &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(*this, horn, c, glocal, hlocal); }
299+bool PVeriable::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_getval(*this, horn, c, glocal, hlocal); }
300+bool PVeriable::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const { return vunify_ver(*this, horn, c, glocal, hlocal); }
301+bool PVeriable::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *glocal, VLocal *) const { return vunify_ver(*this, horn, c, glocal, horn.vl); }
350302 bool PVeriable::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
351-bool PVeriable::unify(const PNil &horn, ExecContextRoot *c) const { return vunify<PNil>(horn, c, c->gl, c->hl); }
352-bool PVeriable::unify(const PString &horn, ExecContextRoot *c) const { return vunify<PString>(horn, c, c->gl, c->hl); }
353-bool PVeriable::unify(const PDouble &horn, ExecContextRoot *c) const { return vunify<PDouble>(horn, c, c->gl, c->hl); }
354-bool PVeriable::unify(const PInteger &horn, ExecContextRoot *c) const { return vunify<PInteger>(horn, c, c->gl, c->hl); }
355-bool PVeriable::unify(const PList &horn, ExecContextRoot *c) const { return vunify_getval<PList>(horn, c, c->gl, c->hl); }
356-bool PVeriable::unify(const PArray &horn, ExecContextRoot *c) const { return vunify_getval<PArray>(horn, c, c->gl, c->hl); }
357-bool PVeriable::unify(const PPredicate &horn, ExecContextRoot *c) const { return vunify_getval<PPredicate>(horn, c, c->gl, c->hl); }
358-bool PVeriable::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_ver<PVeriable>(horn, c, c->gl, c->hl); }
359-bool PVeriable::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_ver<PEVeriable>(horn, c, c->gl, horn.vl); }
303+bool PVeriable::unify(const PNil &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, c->gl, c->hl); }
304+bool PVeriable::unify(const PString &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, c->gl, c->hl); }
305+bool PVeriable::unify(const PDouble &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, c->gl, c->hl); }
306+bool PVeriable::unify(const PInteger &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, c->gl, c->hl); }
307+bool PVeriable::unify(const PList &horn, ExecContextRoot *c) const { return vunify_getval(*this, horn, c, c->gl, c->hl); }
308+bool PVeriable::unify(const PArray &horn, ExecContextRoot *c) const { return vunify_getval(*this, horn, c, c->gl, c->hl); }
309+bool PVeriable::unify(const PPredicate &horn, ExecContextRoot *c) const { return vunify_getval(*this, horn, c, c->gl, c->hl); }
310+bool PVeriable::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, c->gl, c->hl); }
311+bool PVeriable::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, c->gl, horn.vl); }
360312
361313 bool PEVeriable::unify(const PObject &goal, ExecContextRoot *c, VLocal *hlocal, VLocal *glocal) const { return goal.unify(*this, c, glocal, hlocal); }
362-bool PEVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify<PNil>(horn, c, vl, hlocal); }
363-bool PEVeriable::unify(const PString &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify<PString>(horn, c, vl, hlocal); }
364-bool PEVeriable::unify(const PDouble &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify<PDouble>(horn, c, vl, hlocal); }
365-bool PEVeriable::unify(const PInteger &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify<PInteger>(horn, c, vl, hlocal); }
366-bool PEVeriable::unify(const PList &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_getval<PList>(horn, c, vl, hlocal); }
367-bool PEVeriable::unify(const PArray &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_getval<PArray>(horn, c, vl, hlocal); }
368-bool PEVeriable::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_getval<PPredicate>(horn, c, vl, hlocal); }
369-bool PEVeriable::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_ver<PVeriable>(horn, c, vl, hlocal); }
370-bool PEVeriable::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *, VLocal *) const { return vunify_ver<PEVeriable>(horn, c, vl, horn.vl); }
314+bool PEVeriable::unify(const PNil &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify(*this, horn, c, vl, hlocal); }
315+bool PEVeriable::unify(const PString &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify(*this, horn, c, vl, hlocal); }
316+bool PEVeriable::unify(const PDouble &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify(*this, horn, c, vl, hlocal); }
317+bool PEVeriable::unify(const PInteger &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify(*this, horn, c, vl, hlocal); }
318+bool PEVeriable::unify(const PList &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_getval(*this, horn, c, vl, hlocal); }
319+bool PEVeriable::unify(const PArray &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_getval(*this, horn, c, vl, hlocal); }
320+bool PEVeriable::unify(const PPredicate &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_getval(*this, horn, c, vl, hlocal); }
321+bool PEVeriable::unify(const PVeriable &horn, ExecContextRoot *c, VLocal *, VLocal *hlocal) const { return vunify_ver(*this, horn, c, vl, hlocal); }
322+bool PEVeriable::unify(const PEVeriable &horn, ExecContextRoot *c, VLocal *, VLocal *) const { return vunify_ver(*this, horn, c, vl, horn.vl); }
371323 bool PEVeriable::unify(const PObject &goal, ExecContextRoot *c) const { return goal.unify(*this, c); }
372-bool PEVeriable::unify(const PNil &horn, ExecContextRoot *c) const { return vunify<PNil>(horn, c, vl, c->hl); }
373-bool PEVeriable::unify(const PString &horn, ExecContextRoot *c) const { return vunify<PString>(horn, c, vl, c->hl); }
374-bool PEVeriable::unify(const PDouble &horn, ExecContextRoot *c) const { return vunify<PDouble>(horn, c, vl, c->hl); }
375-bool PEVeriable::unify(const PInteger &horn, ExecContextRoot *c) const { return vunify<PInteger>(horn, c, vl, c->hl); }
376-bool PEVeriable::unify(const PList &horn, ExecContextRoot *c) const { return vunify_getval<PList>(horn, c, vl, c->hl); }
377-bool PEVeriable::unify(const PArray &horn, ExecContextRoot *c) const { return vunify_getval<PArray>(horn, c, vl, c->hl); }
378-bool PEVeriable::unify(const PPredicate &horn, ExecContextRoot *c) const { return vunify_getval<PPredicate>(horn, c, vl, c->hl); }
379-bool PEVeriable::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_ver<PVeriable>(horn, c, vl, c->hl); }
380-bool PEVeriable::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_ver<PEVeriable>(horn, c, vl, horn.vl); }
324+bool PEVeriable::unify(const PNil &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, vl, c->hl); }
325+bool PEVeriable::unify(const PString &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, vl, c->hl); }
326+bool PEVeriable::unify(const PDouble &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, vl, c->hl); }
327+bool PEVeriable::unify(const PInteger &horn, ExecContextRoot *c) const { return vunify(*this, horn, c, vl, c->hl); }
328+bool PEVeriable::unify(const PList &horn, ExecContextRoot *c) const { return vunify_getval(*this, horn, c, vl, c->hl); }
329+bool PEVeriable::unify(const PArray &horn, ExecContextRoot *c) const { return vunify_getval(*this, horn, c, vl, c->hl); }
330+bool PEVeriable::unify(const PPredicate &horn, ExecContextRoot *c) const { return vunify_getval(*this, horn, c, vl, c->hl); }
331+bool PEVeriable::unify(const PVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, vl, c->hl); }
332+bool PEVeriable::unify(const PEVeriable &horn, ExecContextRoot *c) const { return vunify_ver(*this, horn, c, vl, horn.vl); }
381333
382334 /*************************************** uphorn ******************************************/
383335 bool PHorn::upHorn(const PPredicate &goal, ExecContext &c, bool skipnamechk)
--- trunk/adp_compile.h (revision 286)
+++ trunk/adp_compile.h (revision 287)
@@ -1494,11 +1494,6 @@
14941494 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
14951495 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
14961496
1497- // 変項のunify本体で使うテンプレート関数
1498- template <class T> bool vunify(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const;
1499- template <class T> bool vunify_getval(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const;
1500- template <class T> bool vunify_ver(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const;
1501-
15021497 // 値の取得
15031498 virtual const PObject *getval( ExecContextRoot *c) const ;
15041499 virtual const PObject *getval( ExecContextRoot *c, VLocal *vlocal) const ;
@@ -1670,11 +1665,6 @@
16701665 virtual bool unify(const PVeriable &horn, ExecContextRoot *c) const;
16711666 virtual bool unify(const PEVeriable &horn, ExecContextRoot *c) const;
16721667
1673- // 変項のunify本体で使うテンプレート関数
1674- template <class T> bool vunify(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const;
1675- template <class T> bool vunify_getval(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const;
1676- template <class T> bool vunify_ver(const T &horn, ExecContextRoot *c, VLocal *glocal, VLocal *hlocal) const;
1677-
16781668 // 値の取得
16791669 virtual const PObject *getval( ExecContextRoot *c) const;
16801670 virtual const PObject *getval( ExecContextRoot *c, VLocal *) const;
--- trunk/adp.cpp (revision 286)
+++ trunk/adp.cpp (revision 287)
@@ -23,12 +23,12 @@
2323
2424 // 定数
2525 #ifdef ___X64____
26-#define VERSION_TEXT "ADP Ver 0.82.0286 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.0287 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.0286 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.0287 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.0286 (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.0287 (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