[GRASS-dev] gis.m patch

Huidae Cho grass4u at gmail.com
Sat Sep 2 11:54:25 EDT 2006


Find attached the patch.

Huidae

On Sat, Sep 02, 2006 at 11:39:58AM +0200, Maciej Sieczka wrote:
> Huidae Cho wrote:
> > Hi,
> > 
> > I've patched gis.m so that it can run on Windows natively with the help
> > of direct rendering.  PDCurses lets the user to start in text mode, but
> > since there are no monitors available, gis.m is the only option for now.
> > 
> > http://geni.ath.cx/grass/native_wingrass.png shows gis.m running on
> > MS-Windows (not Cygwin).
> 
> Oh shoot, great!
> 
> Can you re-send the patch as an attachment?
> 
> Michael,
> 
> Aply it?
> 
> Maciek
-------------- next part --------------
Index: gui/tcltk/gis.m/gm.tcl
===================================================================
RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gm.tcl,v
retrieving revision 1.25
diff -u -r1.25 gm.tcl
--- gui/tcltk/gis.m/gm.tcl	24 Aug 2006 18:04:57 -0000	1.25
+++ gui/tcltk/gis.m/gm.tcl	2 Sep 2006 06:00:41 -0000
@@ -69,6 +69,12 @@
     set execom "spawn"
 }
 
+if {[info exists env(MSYSCON)]} {
+    set mingw "1"
+} {
+    set mingw "0"
+}
+
 #fetch GRASS Version number:
 set fp [open $env(GISBASE)/etc/VERSIONNUMBER r]
 set GRASSVERSION [read -nonewline $fp]
@@ -188,7 +194,13 @@
 # Determine if an element already exists
 
 proc Gm::element_exists {elem name} {
-	set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& /dev/null}]
+	global mingw
+
+	if { $mingw == "1" } {
+		set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& nul}]
+	} {
+		set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& /dev/null}]
+	}
 
 	return [expr {! $failure}]
 }
Index: gui/tcltk/gis.m/gmmenu.tcl
===================================================================
RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gmmenu.tcl,v
retrieving revision 1.15
diff -u -r1.15 gmmenu.tcl
--- gui/tcltk/gis.m/gmmenu.tcl	20 Jul 2006 17:43:19 -0000	1.15
+++ gui/tcltk/gis.m/gmmenu.tcl	2 Sep 2006 06:00:41 -0000
@@ -19,6 +19,7 @@
 global mon
 global filename
 global env
+global mingw
 
 # Put this at the top of the file menu.
 set GuiMenu::Menu_File_Top [subst  {
@@ -48,10 +49,20 @@
 lappend descmenu all
 lappend descmenu options
 lappend descmenu $tmenu
-lappend descmenu [subst {
-	{command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i > /dev/null & } }
-	{command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {} -command { exec g.manual gis.m > /dev/null & } }
-	{command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command { source $env(GISBASE)/etc/gm/grassabout.tcl} }
-	{command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
- }]
 
+# MinGW
+if { $mingw == "1" } {
+	lappend descmenu [subst {
+		{command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i >& nul } }
+		{command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {} -command { exec g.manual gis.m >& nul } }
+		{command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command { source $env(GISBASE)/etc/gm/grassabout.tcl} }
+		{command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
+	 }]
+} {
+	lappend descmenu [subst {
+		{command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i > /dev/null & } }
+		{command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {} -command { exec g.manual gis.m > /dev/null & } }
+		{command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command { source $env(GISBASE)/etc/gm/grassabout.tcl} }
+		{command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
+	 }]
+}
Index: gui/tcltk/gis.m/runandoutput.tcl
===================================================================
RCS file: /grassrepository/grass6/gui/tcltk/gis.m/runandoutput.tcl,v
retrieving revision 1.12
diff -u -r1.12 runandoutput.tcl
--- gui/tcltk/gis.m/runandoutput.tcl	27 Aug 2006 21:19:26 -0000	1.12
+++ gui/tcltk/gis.m/runandoutput.tcl	2 Sep 2006 06:00:41 -0000
@@ -169,11 +169,17 @@
 
 ###############################################################################
 proc run {cmd args} {
+	global mingw
+
 	# This and runcmd are being used to run command in the background
 	# These used to go to stdout and stderr
 	# but we don't want to pollute that console.
 	# eval exec -- $cmd $args >@ stdout 2>@ stderr
-	eval [list exec -- $cmd] $args >& /dev/null
+	if { $mingw == "1" } {
+		eval [list exec -- $cmd] $args >& nul
+	} {
+		eval [list exec -- $cmd] $args >& /dev/null
+	}
 }
 
 ###############################################################################
Index: lib/gtcltk/gronsole.tcl
===================================================================
RCS file: /grassrepository/grass6/lib/gtcltk/gronsole.tcl,v
retrieving revision 1.6
diff -u -r1.6 gronsole.tcl
--- lib/gtcltk/gronsole.tcl	27 Aug 2006 21:19:26 -0000	1.6
+++ lib/gtcltk/gronsole.tcl	2 Sep 2006 06:00:43 -0000
@@ -425,10 +425,16 @@
 
 proc Gronsole::execout {path cmd ci execcmd} {
 	global env
+	global mingw
+
 	set mark cmdinsert$ci
 
 	# Actually run the program
-	set cmd [concat | $cmd 2>@ stdout]
+	if { $mingw == "1" } {
+		set cmd [concat | $cmd]
+	} {
+		set cmd [concat | $cmd 2>@ stdout]
+	}
 
 	set message_env [exec g.gisenv get=GRASS_MESSAGE_FORMAT]
         set env(GRASS_MESSAGE_FORMAT) gui
Index: lib/gtcltk/options.tcl
===================================================================
RCS file: /grassrepository/grass6/lib/gtcltk/options.tcl,v
retrieving revision 1.7
diff -u -r1.7 options.tcl
--- lib/gtcltk/options.tcl	19 May 2006 21:19:16 -0000	1.7
+++ lib/gtcltk/options.tcl	2 Sep 2006 06:00:43 -0000
@@ -98,3 +98,9 @@
 if { $osxaqua == "1"} {
     set keycontrol "Command"
 }
+
+if {[info exists env(MSYSCON)]} {
+    set mingw "1"
+} else {
+    set mingw "0"
+}


More information about the grass-dev mailing list