diff --git a/log/include/gate.h b/log/include/gate.h
index 325afb6480515414471308f9611b0f785f61332e..1840c4571f6f5aa361f767493b2b59e414169e6b 100644
--- a/log/include/gate.h
+++ b/log/include/gate.h
@@ -1,8 +1,25 @@
 #ifndef GATE_H
 #define GATE_H
 
+#include <p2c/mylib.h>
+#include <p2c/newasm.h>
 #include "logdef.h"
 
+typedef struct log_grec {
+  struct log_grec *next, *confnext;
+  na_long info;
+  log_nrec **pin;
+  log_pinposrec *pinpos;
+  log_gattrrec *attr;
+  na_long vars;
+  log_krec *kind;
+  short g, x, y, gc, sig;
+  na_long temp;
+  uchar rot;
+  unsigned conflict : 1, oconflict : 1, dimcolor : 1, conflict1 : 1,
+	   conflict2 : 1, f2 : 1, f1 : 1, f0 : 1;
+} log_grec;   /* Gate */
+
 void uaddgate(short x, short y, short gtype);
 
 void addgate1(short x, short y, short gtype);
diff --git a/log/include/log_action.h b/log/include/log_action.h
index e2ce1054dd40354a2775f53dd9be11db7acdb88e..a7a37ab907bce7ca3148da2d0d650cb6416a94ca 100644
--- a/log/include/log_action.h
+++ b/log/include/log_action.h
@@ -2,6 +2,8 @@
 #define LOG_ACTION_H
 
 #include"logdef.h"
+#include "gate.h"
+#include "wire.h"
 #include<limits.h>
 
 typedef enum
diff --git a/log/include/logdef.h b/log/include/logdef.h
index 435ac959c6f79c67acd0d2e4486a974d73647da0..34d1c04291675d25edb195c867c9fe83c03f6b88 100644
--- a/log/include/logdef.h
+++ b/log/include/logdef.h
@@ -235,48 +235,6 @@ typedef struct log_hnrec {
   struct log_hnrec *next;
 } log_hnrec;   /* History name */
 
-typedef struct log_hwrec {
-  short x1, x2, y;   /* Position of wire */
-  log_nrec *node;   /* Node of wire */
-  struct log_hwrec *next;   /* Next wire in list */
-  na_long temp;
-  uchar wcolr;   /* Color of wire */
-  unsigned f7 : 1, f6 : 1, f5 : 1, f4 : 1, f3 : 1, f2 : 1, f1 : 1, f0 : 1;
-} log_hwrec;   /* Horizontal wire */
-
-typedef struct log_vwrec {
-  short x, y1, y2;   /* Position of wire */
-  log_nrec *node;   /* Node of wire */
-  struct log_vwrec *next;   /* Next wire in list */
-  na_long temp;
-  uchar wcolr;   /* Color of wire */
-  unsigned f7 : 1, f6 : 1, f5 : 1, f4 : 1, f3 : 1, f2 : 1, f1 : 1, f0 : 1;
-} log_vwrec;   /* Vertical wire */
-
-typedef struct log_srec {
-  short x, y;   /* Position of solder point */
-  log_hwrec *hwire, *hwire2;   /* Horizontal wire(s) being soldered */
-  log_vwrec *vwire, *vwire2;   /* Vertical wire(s) being soldered */
-  struct log_srec *next;   /* Next solder point in list */
-  na_long temp;
-  unsigned f7 : 1, f6 : 1, f5 : 1, f4 : 1, f3 : 1, f2 : 1, f1 : 1, f0 : 1;
-} log_srec;   /* Solder point */
-
-typedef struct log_grec {
-  struct log_grec *next, *confnext;
-  na_long info;
-  log_nrec **pin;
-  log_pinposrec *pinpos;
-  log_gattrrec *attr;
-  na_long vars;
-  log_krec *kind;
-  short g, x, y, gc, sig;
-  na_long temp;
-  uchar rot;
-  unsigned conflict : 1, oconflict : 1, dimcolor : 1, conflict1 : 1,
-	   conflict2 : 1, f2 : 1, f1 : 1, f0 : 1;
-} log_grec;   /* Gate */
-
 typedef struct log_lrec {
   short x, y, w;
   char name[log_lablen + 1];
diff --git a/log/include/wire.h b/log/include/wire.h
index 7b73ed57a153d4f3019e6a81f8f967dfc2e070d6..6271973b2553ba6ee191a743b01252fdf25378dd 100644
--- a/log/include/wire.h
+++ b/log/include/wire.h
@@ -3,6 +3,33 @@
 
 #include "logdef.h"
 
+typedef struct log_hwrec {
+  short x1, x2, y;   /* Position of wire */
+  log_nrec *node;   /* Node of wire */
+  struct log_hwrec *next;   /* Next wire in list */
+  na_long temp;
+  uchar wcolr;   /* Color of wire */
+  unsigned f7 : 1, f6 : 1, f5 : 1, f4 : 1, f3 : 1, f2 : 1, f1 : 1, f0 : 1;
+} log_hwrec;   /* Horizontal wire */
+
+typedef struct log_vwrec {
+  short x, y1, y2;   /* Position of wire */
+  log_nrec *node;   /* Node of wire */
+  struct log_vwrec *next;   /* Next wire in list */
+  na_long temp;
+  uchar wcolr;   /* Color of wire */
+  unsigned f7 : 1, f6 : 1, f5 : 1, f4 : 1, f3 : 1, f2 : 1, f1 : 1, f0 : 1;
+} log_vwrec;   /* Vertical wire */
+
+typedef struct log_srec {
+  short x, y;   /* Position of solder point */
+  log_hwrec *hwire, *hwire2;   /* Horizontal wire(s) being soldered */
+  log_vwrec *vwire, *vwire2;   /* Vertical wire(s) being soldered */
+  struct log_srec *next;   /* Next solder point in list */
+  na_long temp;
+  unsigned f7 : 1, f6 : 1, f5 : 1, f4 : 1, f3 : 1, f2 : 1, f1 : 1, f0 : 1;
+} log_srec;   /* Solder point */
+
 void addvwire2(short x, short y1, short y2);
 
 void addhwire2(short x1, short x2, short y);