From d974e9aced1d371e156deca25fcc22f65d15a3f8 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 9 May 2013 08:21:02 +0100 Subject: [PATCH] Guile examples consistency changes Use new guile_embedded_run target or guile_run target for running the examples like the other target languages (for suppressing stdout if run from top level). Consistency with other target language file renames: use runme.scm for scripts and example.i, example.c for example code. Add class example to examples being tested. --- Examples/Makefile.in | 3 +++ Examples/guile/check.list | 1 + Examples/guile/class/Makefile | 2 ++ Examples/guile/constants/Makefile | 3 ++- .../constants/{constants.scm => runme.scm} | 0 Examples/guile/matrix/Makefile | 5 ++-- Examples/guile/matrix/README | 6 ++--- .../guile/matrix/{package.i => example.i} | 5 +--- Examples/guile/matrix/main.c | 24 ------------------- .../guile/matrix/{matrix.scm => runme.scm} | 1 - Examples/guile/multimap/Makefile | 2 +- Examples/guile/multivalue/Makefile | 2 +- Examples/guile/port/Makefile | 7 +++--- Examples/guile/port/README | 2 +- Examples/guile/port/{port.c => example.c} | 0 Examples/guile/port/{port.i => example.i} | 0 Examples/guile/port/{port.scm => runme.scm} | 0 Examples/guile/simple/Makefile | 3 ++- Examples/guile/simple/README | 4 ++-- .../guile/simple/{example.scm => runme.scm} | 2 -- Examples/guile/std_vector/Makefile | 2 +- 21 files changed, 27 insertions(+), 47 deletions(-) rename Examples/guile/constants/{constants.scm => runme.scm} (100%) rename Examples/guile/matrix/{package.i => example.i} (72%) delete mode 100644 Examples/guile/matrix/main.c rename Examples/guile/matrix/{matrix.scm => runme.scm} (99%) mode change 100644 => 100755 rename Examples/guile/port/{port.c => example.c} (100%) rename Examples/guile/port/{port.i => example.i} (100%) rename Examples/guile/port/{port.scm => runme.scm} (100%) rename Examples/guile/simple/{example.scm => runme.scm} (93%) diff --git a/Examples/Makefile.in b/Examples/Makefile.in index a255db4c9..20f1cfea6 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -515,6 +515,9 @@ guile_simple_cpp: $(SRCS) guile_run: $(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE) +guile_embedded_run: + $(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE) + # ----------------------------------------------------------------- # Version display # ----------------------------------------------------------------- diff --git a/Examples/guile/check.list b/Examples/guile/check.list index 08524a8f7..726e6ab75 100644 --- a/Examples/guile/check.list +++ b/Examples/guile/check.list @@ -1,5 +1,6 @@ # see top-level Makefile.in constants +class port simple std_vector diff --git a/Examples/guile/class/Makefile b/Examples/guile/class/Makefile index 827b2fe03..189610800 100644 --- a/Examples/guile/class/Makefile +++ b/Examples/guile/class/Makefile @@ -3,8 +3,10 @@ SWIG = $(TOP)/../preinst-swig CXXSRCS = example.cxx TARGET = example INTERFACE = example.i +TOP = ../.. check: build +# $(MAKE) -f $(TOP)/Makefile guile_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/guile/constants/Makefile b/Examples/guile/constants/Makefile index 946323b89..5e60d9b34 100644 --- a/Examples/guile/constants/Makefile +++ b/Examples/guile/constants/Makefile @@ -2,9 +2,10 @@ SRCS = TARGET = my-guile IFILE = example.i MKDIR = .. +TOP = ../.. check: build - ./my-guile -s constants.scm + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run build: $(MAKE) -f $(MKDIR)/Makefile \ diff --git a/Examples/guile/constants/constants.scm b/Examples/guile/constants/runme.scm similarity index 100% rename from Examples/guile/constants/constants.scm rename to Examples/guile/constants/runme.scm diff --git a/Examples/guile/matrix/Makefile b/Examples/guile/matrix/Makefile index 988a0ee5c..3d488f6f6 100644 --- a/Examples/guile/matrix/Makefile +++ b/Examples/guile/matrix/Makefile @@ -1,10 +1,11 @@ SRCS = matrix.c vector.c TARGET = matrix -IFILE = package.i +IFILE = example.i MKDIR = .. +TOP = ../.. check: build - ./$(TARGET) -e do-test -s matrix.scm + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_embedded_run build: $(MAKE) -f $(MKDIR)/Makefile \ diff --git a/Examples/guile/matrix/README b/Examples/guile/matrix/README index dc1957719..db7395b70 100644 --- a/Examples/guile/matrix/README +++ b/Examples/guile/matrix/README @@ -1,13 +1,13 @@ Matrix example. To run the example, execute the program 'matrix' and type the following : - (load "matrix.scm") + (load "runme.scm") (do-test 0) Alternatively, use the command-line: - ./matrix -e do-test -s matrix.scm + ./matrix -e do-test -s runme.scm Or, if your operating system is spiffy enough: - ./matrix.scm + ./runme.scm diff --git a/Examples/guile/matrix/package.i b/Examples/guile/matrix/example.i similarity index 72% rename from Examples/guile/matrix/package.i rename to Examples/guile/matrix/example.i index aaa55511c..3f801dcdf 100644 --- a/Examples/guile/matrix/package.i +++ b/Examples/guile/matrix/example.i @@ -1,7 +1,4 @@ -// FILE : package.i -// See the SWIG users manual - -/*** Matrix and vector package ***/ +/*** Matrix and vector example ***/ %module Matrix %{ diff --git a/Examples/guile/matrix/main.c b/Examples/guile/matrix/main.c deleted file mode 100644 index 88209aea7..000000000 --- a/Examples/guile/matrix/main.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -extern int matrix_init(Tcl_Interp *); /* Init function from matrix.i */ - -int main() { - - int code; - char input[1024]; - Tcl_Interp *interp; - - interp = Tcl_CreateInterp(); - - /* Initialize the wrappers */ - - if (matrix_init(interp) == TCL_ERROR) - exit(0); - - fprintf(stdout,"matrix > "); - while(fgets(input, 1024, stdin) != NULL) { - code = Tcl_Eval(interp, input); - fprintf(stdout,"%s\n",interp->result); - fprintf(stdout,"matrix > "); - } -} - diff --git a/Examples/guile/matrix/matrix.scm b/Examples/guile/matrix/runme.scm old mode 100644 new mode 100755 similarity index 99% rename from Examples/guile/matrix/matrix.scm rename to Examples/guile/matrix/runme.scm index d7cab84f4..f11061e56 --- a/Examples/guile/matrix/matrix.scm +++ b/Examples/guile/matrix/runme.scm @@ -211,4 +211,3 @@ (cleanup M-list)) -;;; matrix.scm ends here diff --git a/Examples/guile/multimap/Makefile b/Examples/guile/multimap/Makefile index 7b2f264ba..4ca82a3d3 100644 --- a/Examples/guile/multimap/Makefile +++ b/Examples/guile/multimap/Makefile @@ -5,7 +5,7 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f ../Makefile RUNSCRIPT=runme.scm run_example + $(MAKE) -f $(TOP)/Makefile guile_run build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/guile/multivalue/Makefile b/Examples/guile/multivalue/Makefile index 7b2f264ba..4ca82a3d3 100644 --- a/Examples/guile/multivalue/Makefile +++ b/Examples/guile/multivalue/Makefile @@ -5,7 +5,7 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f ../Makefile RUNSCRIPT=runme.scm run_example + $(MAKE) -f $(TOP)/Makefile guile_run build: $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/guile/port/Makefile b/Examples/guile/port/Makefile index 33eeab2e9..0088dd92f 100644 --- a/Examples/guile/port/Makefile +++ b/Examples/guile/port/Makefile @@ -1,10 +1,10 @@ -SRCS = port.c +SRCS = example.c TARGET = port -IFILE = port.i +IFILE = example.i MKDIR = .. check: build - ./$(TARGET) -s port.scm + ./$(TARGET) -s runme.scm build: $(MAKE) -f $(MKDIR)/Makefile \ @@ -16,3 +16,4 @@ build: clean: $(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean + rm -f test.out diff --git a/Examples/guile/port/README b/Examples/guile/port/README index 5ed0199e2..784e39e5d 100644 --- a/Examples/guile/port/README +++ b/Examples/guile/port/README @@ -1,2 +1,2 @@ This example illustrates the translation from Scheme file ports to -temporary FILE streams. Read the source and run ./port -s port.scm +temporary FILE streams. Read the source and run ./port -s runme.scm diff --git a/Examples/guile/port/port.c b/Examples/guile/port/example.c similarity index 100% rename from Examples/guile/port/port.c rename to Examples/guile/port/example.c diff --git a/Examples/guile/port/port.i b/Examples/guile/port/example.i similarity index 100% rename from Examples/guile/port/port.i rename to Examples/guile/port/example.i diff --git a/Examples/guile/port/port.scm b/Examples/guile/port/runme.scm similarity index 100% rename from Examples/guile/port/port.scm rename to Examples/guile/port/runme.scm diff --git a/Examples/guile/simple/Makefile b/Examples/guile/simple/Makefile index d4021073e..66c7e26af 100644 --- a/Examples/guile/simple/Makefile +++ b/Examples/guile/simple/Makefile @@ -2,9 +2,10 @@ SRCS = example.c TARGET = my-guile IFILE = example.i MKDIR = .. +TOP = ../.. check: $(TARGET) - ./$(TARGET) -s example.scm + $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run build: $(TARGET) diff --git a/Examples/guile/simple/README b/Examples/guile/simple/README index 982216eaa..27b54dc5b 100644 --- a/Examples/guile/simple/README +++ b/Examples/guile/simple/README @@ -2,8 +2,8 @@ A very simple example. To run it, start the program 'my-guile' and type: - (load "example.scm") + (load "runme.scm") Alternatively, you can use the shell command: - ./my-guile -s example.scm + ./my-guile -s runme.scm diff --git a/Examples/guile/simple/example.scm b/Examples/guile/simple/runme.scm similarity index 93% rename from Examples/guile/simple/example.scm rename to Examples/guile/simple/runme.scm index 9408b1aa6..c3fd0b41f 100644 --- a/Examples/guile/simple/example.scm +++ b/Examples/guile/simple/runme.scm @@ -1,4 +1,3 @@ -;;; example.scm (define (mdisplay-newline . args) ; does guile-1.3.4 have `format #t'? (for-each display args) @@ -25,4 +24,3 @@ (exit (and (= 1932053504 (fact 13)) (= 745470.0 (My-variable)))) -;;; example.scm ends here diff --git a/Examples/guile/std_vector/Makefile b/Examples/guile/std_vector/Makefile index 6eca67519..fd7a8439a 100644 --- a/Examples/guile/std_vector/Makefile +++ b/Examples/guile/std_vector/Makefile @@ -5,7 +5,7 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f ../Makefile RUNSCRIPT=runme.scm run_example + $(MAKE) -f $(TOP)/Makefile guile_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \