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:
parent
95e2142347
commit
d974e9aced
21 changed files with 27 additions and 47 deletions
|
|
@ -515,6 +515,9 @@ guile_simple_cpp: $(SRCS)
|
||||||
guile_run:
|
guile_run:
|
||||||
$(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE)
|
$(RUNTOOL) $(GUILE) -l $(GUILE_SCRIPT) $(RUNPIPE)
|
||||||
|
|
||||||
|
guile_embedded_run:
|
||||||
|
$(RUNTOOL) ./$(TARGET) $(GUILE_RUNOPTIONS) -s $(GUILE_SCRIPT) $(RUNPIPE)
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Version display
|
# Version display
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# see top-level Makefile.in
|
# see top-level Makefile.in
|
||||||
constants
|
constants
|
||||||
|
class
|
||||||
port
|
port
|
||||||
simple
|
simple
|
||||||
std_vector
|
std_vector
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@ SWIG = $(TOP)/../preinst-swig
|
||||||
CXXSRCS = example.cxx
|
CXXSRCS = example.cxx
|
||||||
TARGET = example
|
TARGET = example
|
||||||
INTERFACE = example.i
|
INTERFACE = example.i
|
||||||
|
TOP = ../..
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
|
# $(MAKE) -f $(TOP)/Makefile guile_run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@ SRCS =
|
||||||
TARGET = my-guile
|
TARGET = my-guile
|
||||||
IFILE = example.i
|
IFILE = example.i
|
||||||
MKDIR = ..
|
MKDIR = ..
|
||||||
|
TOP = ../..
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
./my-guile -s constants.scm
|
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(MKDIR)/Makefile \
|
$(MAKE) -f $(MKDIR)/Makefile \
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
SRCS = matrix.c vector.c
|
SRCS = matrix.c vector.c
|
||||||
TARGET = matrix
|
TARGET = matrix
|
||||||
IFILE = package.i
|
IFILE = example.i
|
||||||
MKDIR = ..
|
MKDIR = ..
|
||||||
|
TOP = ../..
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
./$(TARGET) -e do-test -s matrix.scm
|
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_embedded_run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(MKDIR)/Makefile \
|
$(MAKE) -f $(MKDIR)/Makefile \
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
Matrix example. To run the example, execute the program 'matrix' and
|
Matrix example. To run the example, execute the program 'matrix' and
|
||||||
type the following :
|
type the following :
|
||||||
|
|
||||||
(load "matrix.scm")
|
(load "runme.scm")
|
||||||
(do-test 0)
|
(do-test 0)
|
||||||
|
|
||||||
Alternatively, use the command-line:
|
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:
|
Or, if your operating system is spiffy enough:
|
||||||
|
|
||||||
./matrix.scm
|
./runme.scm
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
// FILE : package.i
|
/*** Matrix and vector example ***/
|
||||||
// See the SWIG users manual
|
|
||||||
|
|
||||||
/*** Matrix and vector package ***/
|
|
||||||
|
|
||||||
%module Matrix
|
%module Matrix
|
||||||
%{
|
%{
|
||||||
|
|
@ -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 > ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1
Examples/guile/matrix/matrix.scm → Examples/guile/matrix/runme.scm
Normal file → Executable file
1
Examples/guile/matrix/matrix.scm → Examples/guile/matrix/runme.scm
Normal file → Executable file
|
|
@ -211,4 +211,3 @@
|
||||||
|
|
||||||
(cleanup M-list))
|
(cleanup M-list))
|
||||||
|
|
||||||
;;; matrix.scm ends here
|
|
||||||
|
|
@ -5,7 +5,7 @@ TARGET = example
|
||||||
INTERFACE = example.i
|
INTERFACE = example.i
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
$(MAKE) -f ../Makefile RUNSCRIPT=runme.scm run_example
|
$(MAKE) -f $(TOP)/Makefile guile_run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ TARGET = example
|
||||||
INTERFACE = example.i
|
INTERFACE = example.i
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
$(MAKE) -f ../Makefile RUNSCRIPT=runme.scm run_example
|
$(MAKE) -f $(TOP)/Makefile guile_run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
SRCS = port.c
|
SRCS = example.c
|
||||||
TARGET = port
|
TARGET = port
|
||||||
IFILE = port.i
|
IFILE = example.i
|
||||||
MKDIR = ..
|
MKDIR = ..
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
./$(TARGET) -s port.scm
|
./$(TARGET) -s runme.scm
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(MKDIR)/Makefile \
|
$(MAKE) -f $(MKDIR)/Makefile \
|
||||||
|
|
@ -16,3 +16,4 @@ build:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
|
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
|
||||||
|
rm -f test.out
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
This example illustrates the translation from Scheme file ports to
|
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
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,10 @@ SRCS = example.c
|
||||||
TARGET = my-guile
|
TARGET = my-guile
|
||||||
IFILE = example.i
|
IFILE = example.i
|
||||||
MKDIR = ..
|
MKDIR = ..
|
||||||
|
TOP = ../..
|
||||||
|
|
||||||
check: $(TARGET)
|
check: $(TARGET)
|
||||||
./$(TARGET) -s example.scm
|
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_embedded_run
|
||||||
|
|
||||||
build: $(TARGET)
|
build: $(TARGET)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ A very simple example.
|
||||||
|
|
||||||
To run it, start the program 'my-guile' and type:
|
To run it, start the program 'my-guile' and type:
|
||||||
|
|
||||||
(load "example.scm")
|
(load "runme.scm")
|
||||||
|
|
||||||
Alternatively, you can use the shell command:
|
Alternatively, you can use the shell command:
|
||||||
|
|
||||||
./my-guile -s example.scm
|
./my-guile -s runme.scm
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
;;; example.scm
|
|
||||||
|
|
||||||
(define (mdisplay-newline . args) ; does guile-1.3.4 have `format #t'?
|
(define (mdisplay-newline . args) ; does guile-1.3.4 have `format #t'?
|
||||||
(for-each display args)
|
(for-each display args)
|
||||||
|
|
@ -25,4 +24,3 @@
|
||||||
(exit (and (= 1932053504 (fact 13))
|
(exit (and (= 1932053504 (fact 13))
|
||||||
(= 745470.0 (My-variable))))
|
(= 745470.0 (My-variable))))
|
||||||
|
|
||||||
;;; example.scm ends here
|
|
||||||
|
|
@ -5,7 +5,7 @@ TARGET = example
|
||||||
INTERFACE = example.i
|
INTERFACE = example.i
|
||||||
|
|
||||||
check: build
|
check: build
|
||||||
$(MAKE) -f ../Makefile RUNSCRIPT=runme.scm run_example
|
$(MAKE) -f $(TOP)/Makefile guile_run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue