From e311d280705eb9229f8aa92fcd038be0efc58791 Mon Sep 17 00:00:00 2001
From: Etienne Brateau <etienne.brateau@ensiie.fr>
Date: Tue, 5 Feb 2019 00:06:20 +0100
Subject: [PATCH] Move some functions

---
 include/gate.h |  1 +
 include/node.h |  2 ++
 src/gate.c     | 15 +++++++++++++++
 src/log.c      | 38 --------------------------------------
 src/node.c     | 22 ++++++++++++++++++++++
 5 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/include/gate.h b/include/gate.h
index 7f09075..96bd11d 100644
--- a/include/gate.h
+++ b/include/gate.h
@@ -54,5 +54,6 @@ void frygate(log_grec *gate);
 void initpinpos(log_grec *gate);
 void addgate2(short x, short y, short gtype, short sig, log_gattrrec *attrs);
 void movexorgate(short x, short y, short g, short sig, short yy);
+void reportgateconflict(log_grec *g);
 
 #endif
diff --git a/include/node.h b/include/node.h
index 5325715..28b922c 100644
--- a/include/node.h
+++ b/include/node.h
@@ -49,5 +49,7 @@ void newnoderef(log_nrec **n, uchar st, long ref);
 void delgetnode(log_nrec **save, log_nrec **old, log_nrec **n);
 void checknode(log_nrec *n, struct LOC_checkcombine *LINK);
 int trycombinenodes(log_nrec **n1, log_nrec **n2);
+void reportnodeconflict(log_nrec *n);
+void getnodeval(log_nrec *n, double *val, char *opts);
 
 #endif
diff --git a/src/gate.c b/src/gate.c
index d9b6d36..553a6d5 100644
--- a/src/gate.c
+++ b/src/gate.c
@@ -13,6 +13,7 @@
 #include "label.h"
 #include "page.h"
 #include "tool.h"
+#include "keyboard.h"
 #include "box.h"
 
 /// Check if inside a gate's "yellow box."
@@ -792,3 +793,17 @@ int addgate(short gtype, short sig, log_gattrrec *attrs)
 	return Result;
 }
 
+void reportgateconflict(log_grec *g)
+{
+	if (g->conflict || !conflictenbl)
+		return;
+	if (!g->oconflict)
+	{
+		g->confnext = gateconflictbase;
+		gateconflictbase = g;
+		g->conflict1 = (3L - conflictdelay) & 1;
+		g->conflict2 = ((3L - conflictdelay) / 2) & 1;
+	}
+	g->conflict = true;
+}
+
diff --git a/src/log.c b/src/log.c
index 3dfda57..462f75b 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1145,36 +1145,6 @@ void enderror()
 }
 
 
-static void reportnodeconflict(log_nrec *n)
-{
-	if (n->conflict || !conflictenbl)
-		return;
-	if (!n->oconflict)
-	{
-		n->confnext = nodeconflictbase;
-		nodeconflictbase = n;
-		n->conflict1 = (3L - conflictdelay) & 1;
-		n->conflict2 = ((3L - conflictdelay) / 2) & 1;
-	}
-	n->conflict = true;
-}
-
-
-static void reportgateconflict(log_grec *g)
-{
-	if (g->conflict || !conflictenbl)
-		return;
-	if (!g->oconflict)
-	{
-		g->confnext = gateconflictbase;
-		gateconflictbase = g;
-		g->conflict1 = (3L - conflictdelay) & 1;
-		g->conflict2 = ((3L - conflictdelay) / 2) & 1;
-	}
-	g->conflict = true;
-}
-
-
 static void drawhistdivisions(short x1, short x2)
 {
 	short x, y;
@@ -1237,14 +1207,6 @@ static void historypointy(log_hnrec *hn, log_htrec *ht, short *y)
 }
 
 
-static void getnodeval(log_nrec *n, double *val, char *opts)
-{
-	gg.actval = 0.0;
-	strcpy(gg.actstr, opts);
-	calltoolnode(n, act_nodeval);
-	*val = gg.actval;
-}
-
 /** @brief Make one simulation pass through the circuit.
 			For each page, call the simulator(s) and do other simulation-related chores.
 */
diff --git a/src/node.c b/src/node.c
index 4db5d58..94b9be6 100644
--- a/src/node.c
+++ b/src/node.c
@@ -595,3 +595,25 @@ int trycombinenodes(log_nrec **n1, log_nrec **n2)
         return (checkcombine(&cnbase));
 }
 
+void reportnodeconflict(log_nrec *n)
+{
+	if (n->conflict || !conflictenbl)
+		return;
+	if (!n->oconflict)
+	{
+		n->confnext = nodeconflictbase;
+		nodeconflictbase = n;
+		n->conflict1 = (3L - conflictdelay) & 1;
+		n->conflict2 = ((3L - conflictdelay) / 2) & 1;
+	}
+	n->conflict = true;
+}
+
+void getnodeval(log_nrec *n, double *val, char *opts)
+{
+	gg.actval = 0.0;
+	strcpy(gg.actstr, opts);
+	calltoolnode(n, act_nodeval);
+	*val = gg.actval;
+}
+
-- 
GitLab