[Gpredict-svn] SF.net SVN: gpredict:[507] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2009-11-06 23:04:29
|
Revision: 507
http://gpredict.svn.sourceforge.net/gpredict/?rev=507&view=rev
Author: csete
Date: 2009-11-06 23:04:11 +0000 (Fri, 06 Nov 2009)
Log Message:
-----------
Applied patch 2893617 from Valentin Yakovenkov fixing various windows issues.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/gtk-rig-ctrl.c
trunk/src/gtk-rot-ctrl.c
trunk/src/main.c
trunk/win32/Makefile
trunk/win32/config.mk
trunk/win32/gpredict.rc
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/ChangeLog 2009-11-06 23:04:11 UTC (rev 507)
@@ -1,3 +1,17 @@
+2009-11-06 Alexandru Csete <oz9aec at gmail.com>
+
+ * src/gtk-rig-ctrl.c:
+ * src/gtk-rot-ctrl.c:
+ * src/main.c:
+ * win32/Makefile:
+ * win32/build-config.h:
+ * win32/config.mk:
+ * win32/gpredict.exe.manifest:
+ * win32/gpredict.rc:
+ Applied patch 2893617 from Valentin Yakovenkov fixing various windows issues.
+
+
+
2009-10-27 Alexandru Csete <oz9aec at gmail.com>
* src/tle-update.c:
Modified: trunk/src/gtk-rig-ctrl.c
===================================================================
--- trunk/src/gtk-rig-ctrl.c 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/src/gtk-rig-ctrl.c 2009-11-06 23:04:11 UTC (rev 507)
@@ -56,10 +56,14 @@
/* NETWORK */
//#include <sys/types.h>
+#ifndef WIN32
#include <sys/socket.h> /* socket(), connect(), send() */
#include <netinet/in.h> /* struct sockaddr_in */
#include <arpa/inet.h> /* htons() */
#include <netdb.h> /* gethostbyname() */
+#else
+#include <winsock2.h>
+#endif
/* END */
#include "gtk-rig-ctrl.h"
@@ -1880,8 +1884,14 @@
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s:%s: Failed to allocate 128 bytes (yes, this means trouble)"),
__FILE__, __FUNCTION__);
- shutdown (sock, SHUT_RDWR);
- close (sock);
+
+#ifndef WIN32
+ shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
+ close (sock);
return FALSE;
}
@@ -1903,8 +1913,13 @@
g_free (buff);
g_strfreev (vbuff);
}
+
+#ifndef WIN32
+ shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
- shutdown (sock, SHUT_RDWR);
close (sock);
@@ -1977,7 +1992,13 @@
__FUNCTION__, written, size);
}
g_free (buff);
+
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
ctrl->wrops++;
@@ -2062,7 +2083,13 @@
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s:%s: Failed to allocate 128 bytes (yes, this means trouble)"),
__FILE__, __FUNCTION__);
+
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
return FALSE;
}
@@ -2086,7 +2113,12 @@
g_strfreev (vbuff);
}
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
@@ -2182,7 +2214,13 @@
__FUNCTION__, written, size);
}
g_free (buff);
+
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
ctrl->wrops++;
Modified: trunk/src/gtk-rot-ctrl.c
===================================================================
--- trunk/src/gtk-rot-ctrl.c 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/src/gtk-rot-ctrl.c 2009-11-06 23:04:11 UTC (rev 507)
@@ -50,10 +50,14 @@
/* NETWORK */
//#include <sys/types.h>
+#ifndef WIN32
#include <sys/socket.h> /* socket(), connect(), send() */
#include <netinet/in.h> /* struct sockaddr_in */
#include <arpa/inet.h> /* htons() */
#include <netdb.h> /* gethostbyname() */
+#else
+#include <winsock2.h>
+#endif
/* END */
#define FMTSTR "%7.2f\302\260"
@@ -1005,7 +1009,13 @@
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s:%s: Failed to allocate 128 bytes (yes, this means trouble)"),
__FILE__, __FUNCTION__);
+
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
return FALSE;
}
@@ -1031,7 +1041,12 @@
g_free (buff);
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
ctrl->wrops++;
@@ -1113,7 +1128,12 @@
g_free (buff);
+#ifndef WIN32
shutdown (sock, SHUT_RDWR);
+#else
+ shutdown (sock, SD_BOTH);
+#endif
+
close (sock);
ctrl->wrops++;
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/src/main.c 2009-11-06 23:04:11 UTC (rev 507)
@@ -53,6 +53,10 @@
#include "sat-cfg.h"
#include "sat-debugger.h"
+#ifdef WIN32
+#include <winsock2.h>
+#endif
+
/** \brief Main application widget. */
GtkWidget *app;
@@ -81,8 +85,9 @@
static gpointer update_tle_thread (gpointer data);
static void test_ui (void);
+static void InitWinSock2(void);
+static void CloseWinSock2(void);
-
int main (int argc, char *argv[])
{
guint error = 0;
@@ -135,12 +140,59 @@
tle_mon_id = g_timeout_add (600000, tle_mon_task, NULL);
//test_ui ();
+
+#ifdef WIN32
+ // Initializing Windozze Sockets
+ InitWinSock2();
+#endif
gtk_main ();
+#ifdef WIN32
+ // Cleanup Windozze Sockets
+ CloseWinSock2();
+#endif
return 0;
}
+#ifdef WIN32
+/* This code was given from MSDN */
+static void InitWinSock2(void)
+{
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+
+ wVersionRequested = MAKEWORD( 2, 2 );
+
+ err = WSAStartup( wVersionRequested, &wsaData );
+ if ( err != 0 ) {
+ /* Tell the user that we could not find a usable */
+ /* WinSock DLL. */
+ return;
+ }
+
+ /* Confirm that the WinSock DLL supports 2.2.*/
+ /* Note that if the DLL supports versions later */
+ /* than 2.2 in addition to 2.2, it will still return */
+ /* 2.2 in wVersion since that is the version we */
+ /* requested. */
+
+ if ( LOBYTE( wsaData.wVersion ) != 2 ||
+ HIBYTE( wsaData.wVersion ) != 2 ) {
+ /* Tell the user that we could not find a usable */
+ /* WinSock DLL. */
+ WSACleanup( );
+ return;
+ }
+}
+
+static void CloseWinSock2(void)
+{
+ WSACleanup();
+}
+#endif
+
static void test_ui (void)
{
gchar *fnam;
Modified: trunk/win32/Makefile
===================================================================
--- trunk/win32/Makefile 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/win32/Makefile 2009-11-06 23:04:11 UTC (rev 507)
@@ -5,7 +5,7 @@
# directories
topsrc = ..
-gcincdir = $(topsrc)/goocanv8
+gcincdir = c:/mingw/include/goocanvas-0.10/goocanvas/
gcsrcdir = $(topsrc)/goocanv8/src
gpreddir = $(topsrc)/src
sgpsdpdir = $(gpreddir)/sgpsdp
@@ -22,7 +22,7 @@
# libraries
GTKLIBS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs gtk+-win32-2.0)
GLIBLIB := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs glib-2.0 gthread-2.0)
-GUI_LIBS = $(GTKLIBS) $(GLIBLIB) libgoocanvas.lib libsgpsdp.lib -lcurl -lwinmm -lws2_32
+GUI_LIBS = $(GTKLIBS) $(GLIBLIB) -lgoocanvas libsgpsdp.lib -lcurldll -lwinmm -lws2_32
LIBS = -lm
@@ -90,10 +90,12 @@
gtk-polar-plot.c \
gtk-polar-view.c \
gtk-polar-view-popup.c \
+ gtk-rig-ctrl.c \
gtk-rot-ctrl.c \
gtk-rot-knob.c \
gtk-sat-data.c \
gtk-sat-list.c \
+ gtk-sat-list-popup.c \
gtk-sat-list-col-sel.c \
gtk-sat-map.c \
gtk-sat-map-ground-track.c \
@@ -101,7 +103,7 @@
gtk-sat-module.c \
gtk-sat-module-popup.c \
gtk-sat-module-tmg.c \
- gtk-sat-tree.c \
+ gtk-sat-selector.c \
gtk-single-sat.c \
gtk-sky-glance.c \
gui.c \
@@ -117,18 +119,17 @@
pass-popup-menu.c \
pass-to-txt.c \
predict-tools.c \
+ qth-data.c \
qth-editor.c \
radio-conf.c \
- rig-io.c \
rotor-conf.c \
- rdv.c \
sat-cfg.c \
sat-debugger.c \
+ sat-info.c \
sat-log.c \
sat-log-browser.c \
sat-monitor.c \
sat-pass-dialogs.c \
- sat-popup-menu.c \
sat-pref.c \
sat-pref-conditions.c \
sat-pref-debug.c \
@@ -157,13 +158,13 @@
sat-vis.c \
save-pass.c \
time-tools.c \
- tle-lookup.c \
tle-tools.c \
tle-update.c \
+ trsp-conf.c \
GPREDICTOBJ = $(GPREDICTSRC:.c=.o)
-OBJS = $(GOOCANVOBJ) $(SGPSDPOBJ) $(GPREDICTOBJ)
+OBJS = $(SGPSDPOBJ) $(GPREDICTOBJ)
%.o: %.c
$(CC) -c $(CFLAGS) $(GTK_CFLAGS) $<
@@ -172,13 +173,13 @@
# targets begin
-all: libgoocanvas.dll libsgpsdp.dll gpredict.exe
+all: libsgpsdp.dll gpredict.exe
# Use -mconsole to always open a console window when gpredicxt is started
# Use -mwindows for no copnsole
gpredict.exe: $(OBJS) gpredict_res.o
- $(CC) -mconsole -o $@ $^ $(CFLAGS) $(GTK_CFLAGS) $(LIBS) $(GUI_LIBS) -lmingwex -s
+ $(CC) -mconsole -mthread -o $@ $^ $(CFLAGS) $(GTK_CFLAGS) $(LIBS) $(GUI_LIBS) -lmingwex -s
gpredict_res.o: gpredict.rc
$(RC) $(RCFLAGS) $< $@
Modified: trunk/win32/config.mk
===================================================================
--- trunk/win32/config.mk 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/win32/config.mk 2009-11-06 23:04:11 UTC (rev 507)
@@ -1,10 +1,10 @@
# Configuration variables governing the build of grig for win32
# directory containing the cross tools
-CROSSDIR = /grga/mingw32/buildenv
+#CROSSDIR = /grga/mingw32/buildenv
# prefix for mingw tools (e.g. i586-mingw32msvc-gcc)
-MGW_PREFIX = i586-mingw32msvc-
+#MGW_PREFIX = i586-mingw32msvc-
# mingw include dir
MGW_INC = $(CROSSDIR)/include
Modified: trunk/win32/gpredict.rc
===================================================================
--- trunk/win32/gpredict.rc 2009-10-30 16:43:19 UTC (rev 506)
+++ trunk/win32/gpredict.rc 2009-11-06 23:04:11 UTC (rev 507)
@@ -1,5 +1,7 @@
#include <windows.h>
+#include <winuser.h>
/* icon for the program itself */
icon_0 ICON "icons/gpredict-icon.ico"
+2 RT_MANIFEST gpredict.exe.manifest
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|