mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Moving common functions to util module
This commit is contained in:
parent
321995c914
commit
e15fd3619d
4 changed files with 11 additions and 6 deletions
5
Makefile
5
Makefile
|
@ -21,6 +21,9 @@ scheme/read.o: cyclone scheme/read.sld parser.scm
|
||||||
scheme/write.o: cyclone scheme/write.sld
|
scheme/write.o: cyclone scheme/write.sld
|
||||||
./cyclone scheme/write.sld
|
./cyclone scheme/write.sld
|
||||||
|
|
||||||
|
util.so: util.scm
|
||||||
|
csc -s util.scm
|
||||||
|
|
||||||
transforms.so: transforms.scm
|
transforms.so: transforms.scm
|
||||||
csc -s transforms.scm
|
csc -s transforms.scm
|
||||||
|
|
||||||
|
@ -53,7 +56,7 @@ debug:
|
||||||
debug2: libcyclone.so.1
|
debug2: libcyclone.so.1
|
||||||
gcc test.c -L. -lcyclone -I. -g -o test
|
gcc test.c -L. -lcyclone -I. -g -o test
|
||||||
|
|
||||||
cyclone: cyclone.scm transforms.so cgen.so libraries.so parser.so libcyclone.a
|
cyclone: cyclone.scm transforms.so util.so cgen.so libraries.so parser.so libcyclone.a
|
||||||
csc cyclone.scm
|
csc cyclone.scm
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
(require-extension chicken-syntax) ;; when
|
(require-extension chicken-syntax) ;; when
|
||||||
(require-extension srfi-1) ;; every
|
(require-extension srfi-1) ;; every
|
||||||
(load (string-append (cyc:get-lib-dir) "parser.so"))
|
(load (string-append (cyc:get-lib-dir) "parser.so"))
|
||||||
|
(load (string-append (cyc:get-lib-dir) "util.so"))
|
||||||
(load (string-append (cyc:get-lib-dir) "libraries.so"))
|
(load (string-append (cyc:get-lib-dir) "libraries.so"))
|
||||||
(load (string-append (cyc:get-lib-dir) "transforms.so"))
|
(load (string-append (cyc:get-lib-dir) "transforms.so"))
|
||||||
(load (string-append (cyc:get-lib-dir) "cgen.so")))
|
(load (string-append (cyc:get-lib-dir) "cgen.so")))
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
; )
|
; )
|
||||||
(else
|
(else
|
||||||
(load (string-append (cyc:get-lib-dir) "parser.scm"))
|
(load (string-append (cyc:get-lib-dir) "parser.scm"))
|
||||||
|
(load (string-append (cyc:get-lib-dir) "util.scm"))
|
||||||
(load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
(load (string-append (cyc:get-lib-dir) "libraries.scm"))
|
||||||
(load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
(load (string-append (cyc:get-lib-dir) "transforms.scm"))
|
||||||
(load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
(load (string-append (cyc:get-lib-dir) "cgen.scm"))))
|
||||||
|
|
|
@ -190,11 +190,6 @@
|
||||||
(define (void) (if #f #t)))
|
(define (void) (if #f #t)))
|
||||||
(else #f))
|
(else #f))
|
||||||
|
|
||||||
; tagged-list? : symbol value -> boolean
|
|
||||||
(define (tagged-list? tag l)
|
|
||||||
(and (pair? l)
|
|
||||||
(eq? tag (car l))))
|
|
||||||
|
|
||||||
; char->natural : char -> natural
|
; char->natural : char -> natural
|
||||||
(define (char->natural c)
|
(define (char->natural c)
|
||||||
(let ((i (char->integer c)))
|
(let ((i (char->integer c)))
|
||||||
|
|
5
util.scm
Normal file
5
util.scm
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
(define (tagged-list? tag exp)
|
||||||
|
(if (pair? exp)
|
||||||
|
(equal? (car exp) tag)
|
||||||
|
#f))
|
Loading…
Add table
Reference in a new issue