diff --git a/packages/gecode/5.1.0/gecode_yap_cc_impl_auto_generated.icc b/packages/gecode/5.1.0/gecode_yap_cc_impl_auto_generated.icc
index 7806fddd6..4f831012d 100644
--- a/packages/gecode/5.1.0/gecode_yap_cc_impl_auto_generated.icc
+++ b/packages/gecode/5.1.0/gecode_yap_cc_impl_auto_generated.icc
@@ -16,6 +16,7 @@
// along with this program. If not, see .
//=============================================================================
+
static YAP_Term gecode_RM_NONE;
static YAP_Term gecode_RM_CONSTANT;
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)
{
- return YAP_Error("SYSTEN_ERROR", TermNil, "Unsupported"); /*
GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
- std::function X3 = gecode_std::function_from_term(YAP_ARG3);
+ std::function X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4);
when(*space,X2,X3,X4);
- return TRUE; */
- return false;
+ return TRUE;
}
static YAP_Bool gecode_constraint_when_457(void)
{
- return YAP_Error("SYSTEN_ERROR", TermNil, "Unsupported"); /*
-
GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
- std::function X3 = gecode_std::function_from_term(YAP_ARG3);
- std::function X4 = gecode_std::function_from_term(YAP_ARG4);
+ std::function X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
+ std::function X4 = gecode_StdFunctionSpace_from_term(YAP_ARG4);
when(*space,X2,X3,X4);
- return TRUE;*/
+ return TRUE;
}
static YAP_Bool gecode_constraint_cardinality_71(void)
{
GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
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);
cardinality(*space,X2,X3,X4);
return TRUE;
@@ -2247,7 +2244,7 @@ static YAP_Bool gecode_constraint_when_455(void)
{
GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
- std::function X3 = gecode_std::function_from_term(YAP_ARG3);
+ std::function X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
when(*space,X2,X3);
return TRUE;
}
@@ -2888,11 +2885,10 @@ static YAP_Bool gecode_constraint_channel_74(void)
static YAP_Bool gecode_constraint_when_458(void)
{
-
GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2);
- std::function X3 = gecode_std::function_from_term(YAP_ARG3);
- std::function X4 = gecode_std::function_from_term(YAP_ARG4);
+ std::function X3 = gecode_StdFunctionSpace_from_term(YAP_ARG3);
+ std::function X4 = gecode_StdFunctionSpace_from_term(YAP_ARG4);
IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5);
when(*space,X2,X3,X4,X5);
return TRUE;
@@ -3145,7 +3141,7 @@ static YAP_Bool gecode_constraint_binpacking_40(void)
static YAP_Bool gecode_constraint_branch_1(void)
{
GenericSpace* space = gecode_Space_from_term(YAP_ARG1);
- std::function X2 = gecode_std::function_from_term(YAP_ARG2);
+ std::function X2 = gecode_StdFunctionSpace_from_term(YAP_ARG2);
branch(*space,X2);
return TRUE;
}
@@ -5174,3 +5170,4 @@ static YAP_Bool gecode_constraint_ite_254(void)
ite(*space,X2,X3,X4,X5,X6);
return TRUE;
}
+
diff --git a/packages/gecode/dev/code-generator.py b/packages/gecode/dev/code-generator.py
index 3e9acc8b1..09efedb79 100755
--- a/packages/gecode/dev/code-generator.py
+++ b/packages/gecode/dev/code-generator.py
@@ -554,7 +554,11 @@ class YAPEnumImpl(object):
print
def _generate_from_term(self):
- print "static %s gecode_%s_from_term(YAP_Term X)" % (self.TYPE,self.TYPE)
+ if self.TYPE == "std::function":
+ t2 = "StdFunctionSpace"
+ else:
+ t2 = self.TYPE
+ print "static %s gecode_%s_from_term(YAP_Term X)" % (self.TYPE,t2)
print "{"
for x in self.ENUM:
print " if (X==gecode_%s) return %s;" % (x,x)
@@ -563,11 +567,16 @@ class YAPEnumImpl(object):
print
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":
+ t2 = "StdFunctionSpace"
+ else:
+ t2 = self.TYPE
+ print "static %s gecode_%s_from_term(YAP_Term);" % (self.TYPE,t2)
class YAPEnumImplGenerator(object):
def generate(self):
+ generate_space_function();
for c in enum_classes():
class C(c,YAPEnumImpl): pass
o = C()
@@ -576,6 +585,7 @@ class YAPEnumImplGenerator(object):
class YAPEnumForwardGenerator(object):
def generate(self):
+ generate_space_function_forward();
for c in enum_classes():
class C(c,YAPEnumImpl): pass
o = C()
@@ -642,12 +652,16 @@ class CCDescriptor(object):
has_space = True
else:
extra = ""
+ t2 = t
if t in ("IntVar","BoolVar","SetVar","FloatVar","IntVarArgs","BoolVarArgs","SetVarArgs","FloatVarArgs"):
extra = "space,"
if has_space == False:
print " GenericSpace* space = gecode_Space_from_term(%s);" % a
has_space = True
- print " %s %s = gecode_%s_from_term(%s%s);" % (t,v,t,extra,a)
+ else:
+ if t == "std::function":
+ t2 = "StdFunctionSpace"
+ print " %s %s = gecode_%s_from_term(%s%s);" % (t,v,t2,extra,a)
args.append(v)
i += 1
print " %s(%s);" % (self.name, ",".join(args))
diff --git a/packages/gecode/gecode5_yap.cc b/packages/gecode/gecode5_yap.cc
index 8238b8f82..8fdf4ddf4 100644
--- a/packages/gecode/gecode5_yap.cc
+++ b/packages/gecode/gecode5_yap.cc
@@ -186,6 +186,18 @@ static inline BoolAssign&
return *(DFA *) YAP_OpaqueObjectFromTerm(t);
}
+ static inline Rnd&
+ gecode_Rnd_from_term(YAP_Term t)
+ {
+ return *(Rnd *) YAP_OpaqueObjectFromTerm(t);
+ }
+
+ static inline std::function&
+ gecode_StdFunctionSpace_from_term(YAP_Term t)
+ {
+ return *(std::function *) YAP_OpaqueObjectFromTerm(t);
+ }
+
static inline FloatNum
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_MAX;
static YAP_Term gecode_FLOAT_VAR_DEGREE_SIZE_MAX;
+ static YAP_Term gecode_FLOAT_VAR_DEGREE_SIZE_MIN;
static inline FloatVarBranch
gecode_FloatVarBranch_from_term(YAP_Term t)
@@ -386,7 +399,6 @@ static YAP_Term gecode_BOOL_VAR_RND;
if (YAP_IsAtomTerm(t)) {
if ( t == gecode_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)
return FLOAT_VAR_SIZE_MAX();
if ( t == gecode_FLOAT_VAR_NONE)