From 453d0b0ad27f7d135ec993fe976652eb1287d2f9 Mon Sep 17 00:00:00 2001 From: Ben Zinberg Date: Tue, 20 Apr 2021 14:46:35 -0400 Subject: [PATCH 1/2] Make `FirstTime` `extern` See https://github.com/JuliaPolyhedra/lrslib/issues/2 --- lrsnashlib.c | 3 +++ lrsnashlib.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lrsnashlib.c b/lrsnashlib.c index a9f3ff5..03052a8 100644 --- a/lrsnashlib.c +++ b/lrsnashlib.c @@ -1118,4 +1118,7 @@ void updateFwidth(game *g, int col, int pos, char *str) { ((gInfo *)g->aux)->fwidth[col][pos] = len; } +// Definition of extern variable declared in the .h +long FirstTime; + /******************** end of lrsnashlib.c ***************************/ diff --git a/lrsnashlib.h b/lrsnashlib.h index 893a5f9..e8a4c12 100644 --- a/lrsnashlib.h +++ b/lrsnashlib.h @@ -67,7 +67,7 @@ void initFwidth(game *g); void updateFwidth(game *g, int col, int pos, char *str); -long FirstTime; /* set this to true for every new game to be solved */ +extern long FirstTime; /* set this to true for every new game to be solved */ static long Debug_flag; static long Verbose_flag; From dd906267aad961999d217f7be2a6bfe654a0daf5 Mon Sep 17 00:00:00 2001 From: Ben Zinberg Date: Thu, 22 Apr 2021 17:35:58 -0400 Subject: [PATCH 2/2] Instead of exposing `FirstTime` directly, expose a reset function In preparation for rebasing this PR onto https://github.com/JuliaPolyhedra/lrslib/pull/4 This is a backward-incompatible change that will break earlier versions of LRSLib.jl. --- lrsnashlib.c | 4 ++-- lrsnashlib.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lrsnashlib.c b/lrsnashlib.c index 03052a8..6c874e4 100644 --- a/lrsnashlib.c +++ b/lrsnashlib.c @@ -1118,7 +1118,7 @@ void updateFwidth(game *g, int col, int pos, char *str) { ((gInfo *)g->aux)->fwidth[col][pos] = len; } -// Definition of extern variable declared in the .h -long FirstTime; +static long FirstTime; +void resetNashSolver() { FirstTime = TRUE; } /******************** end of lrsnashlib.c ***************************/ diff --git a/lrsnashlib.h b/lrsnashlib.h index e8a4c12..e82a6e0 100644 --- a/lrsnashlib.h +++ b/lrsnashlib.h @@ -65,9 +65,9 @@ void printGame(game * g); void setFwidth(game *g, int len); void initFwidth(game *g); void updateFwidth(game *g, int col, int pos, char *str); +void resetNashSolver(); /* Call this function for every new game to be solved */ -extern long FirstTime; /* set this to true for every new game to be solved */ static long Debug_flag; static long Verbose_flag;