compilation with 5.1.0 (no testing).

This commit is contained in:
Vitor Santos Costa 2017-07-24 18:14:57 +01:00
parent d91b06bb6c
commit 530d73c470
3 changed files with 42 additions and 19 deletions

View File

@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
//============================================================================= //=============================================================================
static YAP_Term gecode_RM_NONE; static YAP_Term gecode_RM_NONE;
static YAP_Term gecode_RM_CONSTANT; static YAP_Term gecode_RM_CONSTANT;
static YAP_Term gecode_RM_LINEAR; static YAP_Term gecode_RM_LINEAR;
@ -1397,33 +1398,29 @@ static YAP_Bool gecode_constraint_min_313(void)
static YAP_Bool gecode_constraint_when_456(void) static YAP_Bool gecode_constraint_when_456(void)
{ {
return YAP_Error("SYSTEN_ERROR", TermNil, "Unsupported"); /*
GenericSpace* space = gecode_Space_from_term(YAP_ARG1); GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
std::function<void(Space&home)> X3 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG3); std::function<void(Space&home)> X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4);
when(*space,X2,X3,X4); when(*space,X2,X3,X4);
return TRUE; */ return TRUE;
return false;
} }
static YAP_Bool gecode_constraint_when_457(void) static YAP_Bool gecode_constraint_when_457(void)
{ {
return YAP_Error("SYSTEN_ERROR", TermNil, "Unsupported"); /*
GenericSpace* space = gecode_Space_from_term(YAP_ARG1); GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
std::function<void(Space&home)> X3 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG3); std::function<void(Space&home)> X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
std::function<void(Space&home)> X4 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG4); std::function<void(Space&home)> X4 = gecode_StdFunctionSpace_from_term(YAP_ARG4);
when(*space,X2,X3,X4); when(*space,X2,X3,X4);
return TRUE;*/ return TRUE;
} }
static YAP_Bool gecode_constraint_cardinality_71(void) static YAP_Bool gecode_constraint_cardinality_71(void)
{ {
GenericSpace* space = gecode_Space_from_term(YAP_ARG1); GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2);
int X3 = gecode_int_from_term(YAP_ARG3)289; int X3 = gecode_int_from_term(YAP_ARG3);
int X4 = gecode_int_from_term(YAP_ARG4); int X4 = gecode_int_from_term(YAP_ARG4);
cardinality(*space,X2,X3,X4); cardinality(*space,X2,X3,X4);
return TRUE; return TRUE;
@ -2247,7 +2244,7 @@ static YAP_Bool gecode_constraint_when_455(void)
{ {
GenericSpace* space = gecode_Space_from_term(YAP_ARG1); GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
std::function<void(Space&home)> X3 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG3); std::function<void(Space&home)> X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
when(*space,X2,X3); when(*space,X2,X3);
return TRUE; return TRUE;
} }
@ -2888,11 +2885,10 @@ static YAP_Bool gecode_constraint_channel_74(void)
static YAP_Bool gecode_constraint_when_458(void) static YAP_Bool gecode_constraint_when_458(void)
{ {
GenericSpace* space = gecode_Space_from_term(YAP_ARG1); GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
std::function<void(Space&home)> X3 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG3); std::function<void(Space&home)> X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
std::function<void(Space&home)> X4 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG4); std::function<void(Space&home)> X4 = gecode_StdFunctionSpace_from_term(YAP_ARG4);
IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5);
when(*space,X2,X3,X4,X5); when(*space,X2,X3,X4,X5);
return TRUE; return TRUE;
@ -3145,7 +3141,7 @@ static YAP_Bool gecode_constraint_binpacking_40(void)
static YAP_Bool gecode_constraint_branch_1(void) static YAP_Bool gecode_constraint_branch_1(void)
{ {
GenericSpace* space = gecode_Space_from_term(YAP_ARG1); GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
std::function<void(Space&home)> X2 = gecode_std::function<void(Space&home)>_from_term(YAP_ARG2); std::function<void(Space&home)> X2 = gecode_StdFunctionSpace_from_term(YAP_ARG2);
branch(*space,X2); branch(*space,X2);
return TRUE; return TRUE;
} }
@ -5174,3 +5170,4 @@ static YAP_Bool gecode_constraint_ite_254(void)
ite(*space,X2,X3,X4,X5,X6); ite(*space,X2,X3,X4,X5,X6);
return TRUE; return TRUE;
} }

View File

@ -554,7 +554,11 @@ class YAPEnumImpl(object):
print print
def _generate_from_term(self): def _generate_from_term(self):
print "static %s gecode_%s_from_term(YAP_Term X)" % (self.TYPE,self.TYPE) if self.TYPE == "std::function<void(Space&home)>":
t2 = "StdFunctionSpace"
else:
t2 = self.TYPE
print "static %s gecode_%s_from_term(YAP_Term X)" % (self.TYPE,t2)
print "{" print "{"
for x in self.ENUM: for x in self.ENUM:
print " if (X==gecode_%s) return %s;" % (x,x) print " if (X==gecode_%s) return %s;" % (x,x)
@ -563,11 +567,16 @@ class YAPEnumImpl(object):
print print
def _generate_from_term_forward_decl(self): def _generate_from_term_forward_decl(self):
print "static %s gecode_%s_from_term(YAP_Term);" % (self.TYPE,self.TYPE) if self.TYPE == "std::function<void(Space&home)>":
t2 = "StdFunctionSpace"
else:
t2 = self.TYPE
print "static %s gecode_%s_from_term(YAP_Term);" % (self.TYPE,t2)
class YAPEnumImplGenerator(object): class YAPEnumImplGenerator(object):
def generate(self): def generate(self):
generate_space_function();
for c in enum_classes(): for c in enum_classes():
class C(c,YAPEnumImpl): pass class C(c,YAPEnumImpl): pass
o = C() o = C()
@ -576,6 +585,7 @@ class YAPEnumImplGenerator(object):
class YAPEnumForwardGenerator(object): class YAPEnumForwardGenerator(object):
def generate(self): def generate(self):
generate_space_function_forward();
for c in enum_classes(): for c in enum_classes():
class C(c,YAPEnumImpl): pass class C(c,YAPEnumImpl): pass
o = C() o = C()
@ -642,12 +652,16 @@ class CCDescriptor(object):
has_space = True has_space = True
else: else:
extra = "" extra = ""
t2 = t
if t in ("IntVar","BoolVar","SetVar","FloatVar","IntVarArgs","BoolVarArgs","SetVarArgs","FloatVarArgs"): if t in ("IntVar","BoolVar","SetVar","FloatVar","IntVarArgs","BoolVarArgs","SetVarArgs","FloatVarArgs"):
extra = "space," extra = "space,"
if has_space == False: if has_space == False:
print " GenericSpace* space = gecode_Space_from_term(%s);" % a print " GenericSpace* space = gecode_Space_from_term(%s);" % a
has_space = True has_space = True
print " %s %s = gecode_%s_from_term(%s%s);" % (t,v,t,extra,a) else:
if t == "std::function<void(Space&home)>":
t2 = "StdFunctionSpace"
print " %s %s = gecode_%s_from_term(%s%s);" % (t,v,t2,extra,a)
args.append(v) args.append(v)
i += 1 i += 1
print " %s(%s);" % (self.name, ",".join(args)) print " %s(%s);" % (self.name, ",".join(args))

View File

@ -186,6 +186,18 @@ static inline BoolAssign&
return *(DFA *) YAP_OpaqueObjectFromTerm(t); return *(DFA *) YAP_OpaqueObjectFromTerm(t);
} }
static inline Rnd&
gecode_Rnd_from_term(YAP_Term t)
{
return *(Rnd *) YAP_OpaqueObjectFromTerm(t);
}
static inline std::function<void(Space&home)>&
gecode_StdFunctionSpace_from_term(YAP_Term t)
{
return *(std::function<void(Space&home)> *) YAP_OpaqueObjectFromTerm(t);
}
static inline FloatNum static inline FloatNum
gecode_FloatNum_from_term(YAP_Term t) gecode_FloatNum_from_term(YAP_Term t)
{ {
@ -379,6 +391,7 @@ static YAP_Term gecode_BOOL_VAR_RND;
static YAP_Term gecode_FLOAT_VAR_SIZE_MIN; static YAP_Term gecode_FLOAT_VAR_SIZE_MIN;
static YAP_Term gecode_FLOAT_VAR_SIZE_MAX; static YAP_Term gecode_FLOAT_VAR_SIZE_MAX;
static YAP_Term gecode_FLOAT_VAR_DEGREE_SIZE_MAX; static YAP_Term gecode_FLOAT_VAR_DEGREE_SIZE_MAX;
static YAP_Term gecode_FLOAT_VAR_DEGREE_SIZE_MIN;
static inline FloatVarBranch static inline FloatVarBranch
gecode_FloatVarBranch_from_term(YAP_Term t) gecode_FloatVarBranch_from_term(YAP_Term t)
@ -386,7 +399,6 @@ static YAP_Term gecode_BOOL_VAR_RND;
if (YAP_IsAtomTerm(t)) { if (YAP_IsAtomTerm(t)) {
if ( t == gecode_FLOAT_VAR_SIZE_MIN) if ( t == gecode_FLOAT_VAR_SIZE_MIN)
return FLOAT_VAR_SIZE_MIN(); return FLOAT_VAR_SIZE_MIN();
static YAP_Term gecode_FLOAT_VAR_DEGREE_SIZE_MIN;
if ( t == gecode_FLOAT_VAR_SIZE_MAX) if ( t == gecode_FLOAT_VAR_SIZE_MAX)
return FLOAT_VAR_SIZE_MAX(); return FLOAT_VAR_SIZE_MAX();
if ( t == gecode_FLOAT_VAR_NONE) if ( t == gecode_FLOAT_VAR_NONE)