From 9a1f1a68c5d09d876fe9dc9042ebf497e748cf73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorsten=20Wi=C3=9Fmann?= <edu@thorsten-wissmann.de>
Date: Thu, 30 Jan 2014 16:19:57 +0100
Subject: [PATCH] Fixup GML-GMLMIP conversion

Variable numbers should not be 0, so shift them by 1 on conversion, then
shift them back.
---
 gmlmip_stub.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gmlmip_stub.cc b/gmlmip_stub.cc
index bf83b18..e059907 100644
--- a/gmlmip_stub.cc
+++ b/gmlmip_stub.cc
@@ -47,7 +47,7 @@ static CAMLprim value pair2caml(const int& t) {
     CAMLlocal1( abc );
     abc = caml_alloc(2, 0);
     bool neg = t < 0;
-    Store_field( abc, 0, Val_int(neg ?(-t) : t));
+    Store_field( abc, 0, Val_int((neg ?(-t) : t) - 1));
     Store_field( abc, 1, Val_bool(!neg));
     return abc;
 }
@@ -74,7 +74,7 @@ CAMLprim value gmlRules_stub(value modalities) {
         modvec.push_back(make_pair(make_pair(
             Bool_val(vpos),
             Int_val(vcnt)),
-            Int_val(vformula)));
+            1+Int_val(vformula)));
         block = Field(block, 1);
     }
     // Do one rule step and save result in rulevec
-- 
GitLab