[GRASS-dev] gis.m patch

Huidae Cho grass4u at gmail.com
Sat Sep 2 02:32:19 EDT 2006


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).

Huidae

GRASS is now configured for:  i686-pc-mingw32

 Source directory:            /home/song/usr/grass/grass6
 Build directory:             /home/song/usr/grass/grass6
 Installation directory:      /usr/local/grass-6.3.cvs
 Startup script in directory: ${exec_prefix}/bin
 C compiler:                  gcc -g -O2  -D__W98__
 C++ compiler:                c++ -g -O2
 FORTRAN compiler:            
 Building shared libraries:   yes
 64bit support:               no
 OpenGL platform:             Windows

  NVIZ:                       yes

  BLAS support:               no
  C++ support:                yes
  DWG support:                no
  FFMPEG support:             no
  FFTW support:               yes
  FreeType support:           yes
  GDAL support:               yes
  GLw support:                no
  JPEG support:               yes
  LAPACK support:             no
  Large File Support (LFS):   no
  Motif support:              no
  MySQL support:              no
  NLS support:                no
  ODBC support:               no
  OGR support:                yes
  OpenGL support:             yes
  PNG support:                yes
  PostgreSQL support:         yes
  Python support:             no
  Readline support:           yes
  SQLite support:             yes
  Tcl/Tk support:             yes
  TIFF support:               yes
  X11 support:                yes


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