From 5a9fc83695c89ba6699cd5e7ab83bdb84a4a2e20 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Thu, 16 Jul 2020 17:07:22 +0200
Subject: [PATCH] Manual merge with John's updates.

---
 band.h     | 4 ++--
 midi.h     | 4 ++--
 midi2.c    | 5 ++++-
 mode.h     | 2 +-
 new_menu.h | 2 +-
 vfo.c      | 2 ++
 vfo.h      | 7 +++++--
 7 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/band.h b/band.h
index 4163ce5..b312440 100644
--- a/band.h
+++ b/band.h
@@ -87,8 +87,8 @@ typedef struct _CHANNEL CHANNEL;
 
 
 
-int band;
-gboolean displayHF;
+extern int band;
+extern gboolean displayHF;
 
 #define UK_CHANNEL_ENTRIES 11
 #define OTHER_CHANNEL_ENTRIES 5
diff --git a/midi.h b/midi.h
index 55ed533..bfe6230 100644
--- a/midi.h
+++ b/midi.h
@@ -199,10 +199,10 @@ struct desc {
    struct desc       *next;       // Next defined action for a controller/key with that note value (NULL for end of list)
 };
 
-struct {
+struct cmdtable{
    struct desc *desc[128];    // description for Note On/Off and ControllerChange
    struct desc *pitch;        // description for PitchChanges
-} MidiCommandsTable;
+};
 
 //
 // Layer-1 entry point, called once for all the MIDI devices
diff --git a/midi2.c b/midi2.c
index 871559c..5bbc4ec 100644
--- a/midi2.c
+++ b/midi2.c
@@ -7,6 +7,7 @@
  * MIDI events into MIDI actions in the SDR console.
  */
 
+#include <gtk/gtk.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -17,6 +18,8 @@
 
 #include "midi.h"
 
+struct cmdtable MidiCommandsTable;
+
 void NewMidiEvent(enum MIDIevent event, int channel, int note, int val) {
 
     struct desc *desc;
@@ -25,7 +28,7 @@ void NewMidiEvent(enum MIDIevent event, int channel, int note, int val) {
     static struct timespec tp, last_wheel_tp={0,0};
     long delta;
 
-//fprintf(stderr,"MIDI:EVENT=%d CHAN=%d NOTE=%d VAL=%d\n",event,channel,note,val);
+//g_print("%s:EVENT=%d CHAN=%d NOTE=%d VAL=%d\n",__FUNCTION__,event,channel,note,val);
     if (event == MIDI_PITCH) {
 	desc=MidiCommandsTable.pitch;
     } else {
diff --git a/mode.h b/mode.h
index e566eee..41ce9fe 100644
--- a/mode.h
+++ b/mode.h
@@ -34,6 +34,6 @@
 #define modeDRM 11
 #define MODES 12
 
-char *mode_string[MODES];
+extern char *mode_string[MODES];
 
 #endif
diff --git a/new_menu.h b/new_menu.h
index 78699d2..977c564 100644
--- a/new_menu.h
+++ b/new_menu.h
@@ -1,4 +1,4 @@
-GtkWidget *sub_menu;
+extern GtkWidget *sub_menu;
 
 extern void new_menu();
 
diff --git a/vfo.c b/vfo.c
index 47b22fd..b5e500e 100644
--- a/vfo.c
+++ b/vfo.c
@@ -70,6 +70,8 @@ char *step_labels[]={"1Hz","10Hz","25Hz","50Hz","100Hz","250Hz","500Hz","1kHz","
 static GtkWidget* menu=NULL;
 static GtkWidget* band_menu=NULL;
 
+struct _vfo vfo[MAX_VFOS];
+struct _mode_settings mode_settings[MODES];
 
 static void vfo_save_bandstack() {
   BANDSTACK *bandstack=bandstack_get_bandstack(vfo[0].band);
diff --git a/vfo.h b/vfo.h
index 4204c3a..55e0562 100644
--- a/vfo.h
+++ b/vfo.h
@@ -44,7 +44,9 @@ struct _vfo {
   long long lo;
   long long offset;
 
-} vfo[MAX_VFOS];
+};
+
+extern struct _vfo vfo[MAX_VFOS];
 
 //
 // Store filter and NR settings on a per-mode basis
@@ -57,8 +59,9 @@ struct _mode_settings {
   int nr2;
   int anf;
   int snb;
-} mode_settings[MODES];
+};
 
+extern struct _mode_settings mode_settings[];
 
 typedef struct _set_frequency {
   int vfo;
-- 
2.45.2