[GRASS-dev] Re: [GRASS-user] Nviz on native Windows

Paul Kelly paul-grass at stjohnspoint.co.uk
Sat May 19 05:06:12 EDT 2007


On Fri, 18 May 2007, Michael Barton wrote:

> You can do *almost* anything from the GUI that you can do from the command
> line. Apparently, nviz is the biggest problem--but I don't know why it
> shouldn't run.

Nviz was working great on Windows until early December (even with
Michael's new improvments and tidying of the GUI) when Bob changed it
back to use a shell script-based startup instead of starting the binary 
directly. Obviously that doesn't work on Windows and that meant it no 
longer got regularly tested on Windows. Now, if I switch it back to 
generate the binary directly (see attachment) it still doesn't work - gets 
stuck on the Please Wait stage again - so I guess some other incompatible 
thing was changed in the meantime. I suppose worth trying with different 
Tcl/Tk versions though.

I don't like committing patches that seem like the best way to solve a 
problem but are only part of the solution (i.e. its still broken after 
the patch but the patch was my best effort sort of thing), as it may 
hinder somebody else's efforts to fix things in the future, so have 
attached to this e-mail.

Paul
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/grass/grassrepository/grass6/visualization/nviz/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile	24 Jan 2007 15:42:34 -0000	1.13
+++ Makefile	19 May 2007 08:57:21 -0000
@@ -8,7 +8,7 @@
 VER=2.2
 NV_VER=nviz$(VER)
 PROG=nviz
-NVWISH_VER=$(PROG)
+NVWISH_VER=NVWISH$(VER)
 INSTALL_DIR=$(GISBASE)/etc/$(NV_VER)
 
 SCRIPTDIR=$(NV_VER)/scripts
@@ -39,9 +39,6 @@
 	$(INSTALL) scripts/nviz_params $(INSTALL_DIR)/scripts/nviz_params
 ### ACS - END #################################################################
 	$(INSTALL) scripts/*Index $(INSTALL_DIR)/scripts
-	$(INSTALL) -m 755 scripts/$(PROG) $(GISBASE)/bin
-	if test -f "src/nvwish.exe" ; then mv src/nvwish.exe $(INSTALL_DIR)/$(NVWISH_VER) ; fi
-	if test -f "src/nvwish" ; then mv src/nvwish $(INSTALL_DIR)/$(NVWISH_VER) ; fi
 	(cd bitmaps; tar -cf - *  | (cd $(INSTALL_DIR)/bitmaps; tar  -xf - 2>/dev/null ); true)
 	$(INSTALL) scripts/$(NV_VER)_script $(INSTALL_DIR)/scripts
 	(cd html ; $(MAKE) )
Index: src/Makefile
===================================================================
RCS file: /home/grass/grassrepository/grass6/visualization/nviz/src/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- src/Makefile	10 May 2007 19:18:48 -0000	1.22
+++ src/Makefile	19 May 2007 08:57:21 -0000
@@ -53,16 +53,15 @@
 
 ARCH_OBJS := $(foreach obj,$(OBJS),$(OBJDIR)/$(obj)) 
 
-#PGM = nviz
-#default: $(BIN)/$(PGM) htmlcmd
-default: nvwish
+PGM = nviz
+default: $(BIN)/$(PGM) htmlcmd
 
 
 #gsf: 
 #	cd $(SURF_INCDIR) ; $(GMAKE)
 #	touch nviz_init.c
 
-nvwish: $(ARCH_OBJS) $(VECTDEP) $(BITMAPDEP) $(LINKMDEP) $(FORMDEP) $(DBMIDEP $(GISDEP)
+$(BIN)/$(PGM): $(ARCH_OBJS) $(VECTDEP) $(BITMAPDEP) $(LINKMDEP) $(FORMDEP) $(DBMIDEP $(GISDEP)
 	$(CC) $(LDFLAGS) -o $@ $(ARCH_OBJS) $(FMODE_OBJ) $(SURFLIB) \
 	$(BITMAPLIB) $(LINKMLIB) $(VECTLIB) $(SITESLIB) $(FORMLIB) $(DBMILIB) \
 	$(G3DLIB) $(GISLIB) $(XDRLIB) \
Index: src/nvizMain.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/visualization/nviz/src/nvizMain.c,v
retrieving revision 2.11
diff -u -r2.11 nvizMain.c
--- src/nvizMain.c	26 Apr 2007 20:42:38 -0000	2.11
+++ src/nvizMain.c	19 May 2007 08:57:21 -0000
@@ -52,13 +52,30 @@
     )
 {
 	int i;
+	int passed_count;
+	char **passed_args;
 
 	Tcl_FindExecutable(argv[0]);
-	if (argc > 1) {
-		if (strstr(argv[argc-1], "-h") != NULL) 
-                        sprintf(argv[argc-1], "--h");
+   
+	/* I suppose what this is doing is inserting "--" into the stream of
+	 * command-line arguments to tell Tcl it's the end of the arguments
+	 * meant for it and the start of those meant for nviz?? PK */
+	if (argc > 1 && strncmp(argv[1], "-f", 2) != 0 )
+	{ 	
+	    passed_count = argc + 1;
+	    passed_args = (char **) G_malloc(passed_count * sizeof(char *));
+   
+	    for (i = argc; i > 1; i--)
+		passed_args[i] = G_store(argv[i-1]);
+	    passed_args[1] = G_store("--");
+	    passed_args[0] = G_store(argv[0]);
 	}
+	else
+	{
+		passed_count = argc;
+		passed_args = argv;
+	}  
 
-    Tk_Main(argc, argv, NVIZ_AppInit);
+    Tk_Main(passed_count, passed_args, NVIZ_AppInit);
     return 0;			/* Needed only to prevent compiler warning. */
 }


More information about the grass-dev mailing list