The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
|
|
@ -1,18 +1,19 @@
|
|||
CC = gcc
|
||||
SRCS = example.c
|
||||
TARGET = my-guile
|
||||
IFILE = example.i
|
||||
MKDIR = ..
|
||||
|
||||
all::
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET):
|
||||
$(MAKE) -f $(MKDIR)/Makefile \
|
||||
SRCS='$(SRCS)' \
|
||||
TARGET=$(TARGET) \
|
||||
IFILE=$(IFILE) \
|
||||
CC=$(CC) \
|
||||
sub-all
|
||||
|
||||
clean::
|
||||
rm -f *_wrap* my-guile *~ .~* core
|
||||
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
|
||||
|
||||
check: all
|
||||
check: $(TARGET)
|
||||
./$(TARGET) -s example.scm > /dev/null
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ A very simple example.
|
|||
|
||||
To run it, start the program 'my-guile' and type:
|
||||
|
||||
(load 'example.scm)
|
||||
(load "example.scm")
|
||||
|
||||
Alternatively, you can use the shell command:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* Simple example from documentation */
|
||||
/* File : example.c */
|
||||
|
||||
#include </usr/include/time.h>
|
||||
#include <time.h>
|
||||
|
||||
double My_variable = 3.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,14 @@
|
|||
;;;
|
||||
;;; Guile script for simple example.
|
||||
;;; Is a little clumsy since I'm not the greatest scheme programmer.
|
||||
;;;
|
||||
;;; example.scm
|
||||
|
||||
(display (get-time))
|
||||
(display "My variable = ")
|
||||
(display (My-variable))
|
||||
(newline)
|
||||
(define (mdisplay-newline . args) ; does guile-1.3.4 have `format #t'?
|
||||
(for-each display args)
|
||||
(newline))
|
||||
|
||||
(define (facts x max)
|
||||
(if (< x max)
|
||||
(begin
|
||||
(display (string-append (number->string x) " factorial is "
|
||||
(number->string (fact x))))
|
||||
(newline)
|
||||
(facts (+ x 1) max))))
|
||||
|
||||
(facts 0 14)
|
||||
(mdisplay-newline (get-time) "My variable = " (My-variable))
|
||||
|
||||
(do ((i 0 (1+ i)))
|
||||
((= 14 i))
|
||||
(mdisplay-newline i " factorial is " (fact i)))
|
||||
|
||||
(define (mods i imax j jmax)
|
||||
(if (< i imax)
|
||||
|
|
@ -27,9 +18,11 @@
|
|||
(mods i imax (+ j 1) jmax))
|
||||
(mods (+ i 1) imax 1 jmax))))
|
||||
|
||||
(mods 1 250 1 250)
|
||||
(mods 1 150 1 150)
|
||||
|
||||
(display (string-append "My-variable = " (number->string (My-variable))))
|
||||
(newline)
|
||||
(mdisplay-newline "My-variable = " (My-variable))
|
||||
|
||||
(exit (and (= 1932053504 (fact 13))
|
||||
(= 745470.0 (My-variable))))
|
||||
|
||||
;;; example.scm ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue