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.
This commit is contained in:
William S Fulton 2013-05-09 08:21:02 +01:00
commit d974e9aced
21 changed files with 27 additions and 47 deletions

View file

@ -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
# -----------------------------------------------------------------

View file

@ -1,5 +1,6 @@
# see top-level Makefile.in
constants
class
port
simple
std_vector

View file

@ -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)' \

View file

@ -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 \

View file

@ -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 \

View file

@ -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

View file

@ -1,7 +1,4 @@
// FILE : package.i
// See the SWIG users manual
/*** Matrix and vector package ***/
/*** Matrix and vector example ***/
%module Matrix
%{

View file

@ -1,24 +0,0 @@
#include <tcl.h>
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 > ");
}
}

View file

@ -211,4 +211,3 @@
(cleanup M-list))
;;; matrix.scm ends here

View file

@ -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)' \

View file

@ -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)' \

View file

@ -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

View file

@ -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

View file

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

View file

@ -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

View file

@ -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

View file

@ -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)' \