From ab7e69e688e7868349c1db922fde8dc3da2a4ac8 Mon Sep 17 00:00:00 2001
From: sgtell <sgtell@9168a026-1b44-0410-911b-d774ca5fe8d3>
Date: Thu, 11 Apr 2019 20:24:27 +0000
Subject: [PATCH 1/2] multiple little bugfixes missing "return SCM_UNSPECIFIED"
 causes crash in some guile environments fix gwave -s scriptname commandline
 startup usage; fix script loading finish testing & fixing the new waveform
 status popup

git-svn-id: https://svn.code.sf.net/p/gwave/code/branches/no-ggp-branch@270 9168a026-1b44-0410-911b-d774ca5fe8d3
---
 scheme/cmds.scm            | 2 +-
 scheme/extra-menus.scm     | 4 ++++
 scheme/std-args.scm        | 2 +-
 scheme/visiblewave-ops.scm | 4 +---
 spicefile/wavefile.c       | 2 --
 src/gtkmisc.c              | 2 ++
 src/wavelist.c             | 1 +
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/scheme/cmds.scm b/scheme/cmds.scm
index 2f94a09..75a41cf 100644
--- a/scheme/cmds.scm
+++ b/scheme/cmds.scm
@@ -351,7 +351,7 @@
 
 ;; execute a guile script, ignoring any errors.
 (define-public (execute-script fname)
-  (false-if-exception (load fname))
+  (false-if-exception (primitive-load fname))
 )
 
 ; global to pass target datafile smob to scripts executed
diff --git a/scheme/extra-menus.scm b/scheme/extra-menus.scm
index 0f72e25..d1edf6b 100644
--- a/scheme/extra-menus.scm
+++ b/scheme/extra-menus.scm
@@ -35,6 +35,10 @@
 
 (define (debug-list-files)
   (format #t "wavefile-list: ~a\n" (wavefile-list))
+  (for-each (lambda (wf)
+	        (format #t "wavefile ~a " wf)
+		(format #t "file ~s\n" (wavefile-file-name wf)))
+	    (wavefile-list))
 )
 
 (define (debug-wave-calc)
diff --git a/scheme/std-args.scm b/scheme/std-args.scm
index bed74d4..d6dddf2 100644
--- a/scheme/std-args.scm
+++ b/scheme/std-args.scm
@@ -83,7 +83,7 @@
 
    ; execute script specified with -s 
    (if startup-script
-       (load startup-script))
+       (execute-script startup-script))
 ))
 
 
diff --git a/scheme/visiblewave-ops.scm b/scheme/visiblewave-ops.scm
index f800770..42faeff 100644
--- a/scheme/visiblewave-ops.scm
+++ b/scheme/visiblewave-ops.scm
@@ -23,12 +23,10 @@
 (define (popup-vw-stats vw)
   (popup-text-dialog "wave stats"
 		     (string-append
-		      (format #f "file:     ~s\n" ((wavefile-file-name visiblewave-file vw)))
+		      (format #f "file:     ~s\n" (wavefile-file-name (visiblewave-file vw)))
 		      (format #f "variable: ~s\n" (visiblewave-varname vw))
 		      (format #f "minimum:  ~f\n" (wavevar-min vw))
 		      (format #f "maximum:  ~f\n" (wavevar-max vw)))))
-		      
-  
 
 ; hook called when new VisibleWave is added.
 (add-hook! 
diff --git a/spicefile/wavefile.c b/spicefile/wavefile.c
index 6a35c04..83f2a8b 100644
--- a/spicefile/wavefile.c
+++ b/spicefile/wavefile.c
@@ -657,8 +657,6 @@ int wf_add_var(WaveFile *wf, char *varname, int ncols, VarType type,
 
 		for(i = 0; i < ncols; i++) {
 			wf_init_dataset_size(&wv->wds[i], wt->nvalues);
-			wds->min = 0.0;
-			wds->max = 0.0;
 		}
 	}
 	return 0;
diff --git a/src/gtkmisc.c b/src/gtkmisc.c
index b0484ad..04bfde5 100644
--- a/src/gtkmisc.c
+++ b/src/gtkmisc.c
@@ -392,6 +392,7 @@ SCM_DEFINE(gwgtk_menu_popup, "gwgtk-menu-popup", 3, 0, 0,
 //	printf("gwgtk_menu_popup %d\n", mbutton);
 	menu = build_menu_from_scmlist(list);
 	gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, mbutton, activate_time);
+	return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME	   
 
@@ -458,6 +459,7 @@ SCM_DEFINE(popup_text_dialog, "popup-text-dialog", 2, 0, 0,
 	VALIDATE_ARG_STR_NEWCOPY_USE_NULL(1,title,ctitle);
 	VALIDATE_ARG_STR_NEWCOPY_USE_NULL(2,text,ctext);
 	create_gtktextdialog(ctitle, ctext);
+	return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
 
diff --git a/src/wavelist.c b/src/wavelist.c
index 142e229..20cf84d 100644
--- a/src/wavelist.c
+++ b/src/wavelist.c
@@ -859,6 +859,7 @@ SCM_DEFINE(new_wavevar_calc_x, "new-wavevar-calc!", 3, 1, 0,
 	if(df->wlist_win) {
 		gwfile_add_wv_to_list(wvnew, df);
 	}
+	return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
 
-- 
2.21.0