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
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
// FILE : package.i
|
||||
// See the SWIG users manual
|
||||
|
||||
/*** Matrix and vector package ***/
|
||||
/*** Matrix and vector example ***/
|
||||
|
||||
%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))
|
||||
|
||||
;;; matrix.scm ends here
|
||||
Loading…
Add table
Add a link
Reference in a new issue