modularize sex
Also rename macros to sex-macros, module-system to sex-modules for clarity, uniformity, and to avoid name clashes with Chicken's units/modules named "macros" and "modules"
This commit is contained in:
@@ -1 +1,40 @@
|
||||
CHICKEN_C = csc
|
||||
CSC_FLAGS += -K prefix
|
||||
|
||||
MODULES = utils macros reader module-system semen sex-fmt-c fmt-c-writer sexc
|
||||
TESTS = basic semen reader fmt-c-writer utils
|
||||
IMPORTS = $(MODULES:%=%.import.scm)
|
||||
OBJ = $(MODULES:%=%.o)
|
||||
|
||||
sex-tests: $(OBJ) sex-tests.o
|
||||
$(CHICKEN_C) $(CSC_FLAGS) $(OBJ) sex-tests.o -o sex-tests
|
||||
|
||||
sex-tests.o: run.scm basic.scm semen.scm reader.scm fmt-c-writer.scm utils.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) run.scm -c -o ./sex-tests.o -link semen,fmt-c-writer,reader,utils
|
||||
|
||||
utils.o: utils.module.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) utils.module.scm -e -c -J -o utils.o -unit utils
|
||||
|
||||
macros.o: macros.module.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) macros.module.scm -e -c -J -o macros.o -unit macros
|
||||
|
||||
reader.o: reader.module.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) reader.module.scm -e -c -J -o reader.o -unit reader
|
||||
|
||||
module-system.o: module-system.module.scm reader.import.scm utils.import.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) module-system.module.scm -e -c -J -o module-system.o -unit module-system -link reader,utils
|
||||
|
||||
semen.o: semen.module.scm macros.import.scm module-system.import.scm utils.import.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) semen.module.scm -e -c -J -o semen.o -unit semen -link macros,module-system,utils
|
||||
|
||||
fmt-c-writer.o: fmt-c-writer.module.scm fmt-c-writer.scm sex-fmt-c.import.scm utils.import.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) fmt-c-writer.module.scm -e -c -J -o fmt-c-writer.o -unit fmt-c-writer -link sex-fmt-c,utils
|
||||
|
||||
sex-fmt-c.o: ../sex-fmt-c.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) $< -e -c -J -o $@ -unit sex-fmt-c
|
||||
|
||||
sexc.o: sexc.module.scm fmt-c-writer.import.scm macros.import.scm module-system.import.scm reader.import.scm semen.import.scm utils.import.scm
|
||||
$(CHICKEN_C) $(CSC_FLAGS) sexc.module.scm -e -c -J -o sexc.o -unit sexc -link fmt-c-writer,macros,module-system,reader,semen,utils
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(IMPORTS) sex-tests.o sex-tests
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
(import fmt-c-writer)
|
||||
|
||||
(test-group "basic"
|
||||
|
||||
;; unkebabify
|
||||
|
||||
3
tests/fmt-c-writer.module.scm
Normal file
3
tests/fmt-c-writer.module.scm
Normal file
@@ -0,0 +1,3 @@
|
||||
(module fmt-c-writer
|
||||
*
|
||||
"../fmt-c-writer.scm")
|
||||
3
tests/macros.module.scm
Normal file
3
tests/macros.module.scm
Normal file
@@ -0,0 +1,3 @@
|
||||
(module macros
|
||||
*
|
||||
"../macros.scm")
|
||||
3
tests/module-system.module.scm
Normal file
3
tests/module-system.module.scm
Normal file
@@ -0,0 +1,3 @@
|
||||
(module module-system
|
||||
*
|
||||
"../module-system.scm")
|
||||
3
tests/reader.module.scm
Normal file
3
tests/reader.module.scm
Normal file
@@ -0,0 +1,3 @@
|
||||
(module reader
|
||||
*
|
||||
"../reader.scm")
|
||||
@@ -1,4 +1,5 @@
|
||||
(import (chicken port))
|
||||
(import (chicken port)
|
||||
reader)
|
||||
|
||||
(define-syntax reader-test
|
||||
(syntax-rules ()
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
(declare (uses fmt-c-writer
|
||||
semen))
|
||||
|
||||
(import
|
||||
(chicken process)
|
||||
(chicken process-context)
|
||||
srfi-1
|
||||
test)
|
||||
|
||||
(include "basic.scm")
|
||||
|
||||
2
tests/semen.module.scm
Normal file
2
tests/semen.module.scm
Normal file
@@ -0,0 +1,2 @@
|
||||
(module semen *
|
||||
"../semen.scm")
|
||||
@@ -1,4 +1,5 @@
|
||||
(import srfi-69)
|
||||
(import srfi-69
|
||||
semen)
|
||||
|
||||
(define print-str-fn
|
||||
'(fn void print-str ((string s))
|
||||
@@ -38,11 +39,11 @@
|
||||
(define (form-identity form env)
|
||||
form)
|
||||
|
||||
(test 'a (semen-walk-form 'a form-identity (make-hash-table)))
|
||||
(test '(a b c) (semen-walk-form '(a b c) form-identity (make-hash-table)))
|
||||
(test 'a (walk-form 'a form-identity (make-hash-table)))
|
||||
(test '(a b c) (walk-form '(a b c) form-identity (make-hash-table)))
|
||||
|
||||
(test 'a (semen-macro-expand 'a))
|
||||
(test '(a b c) (semen-macro-expand '(a b c)))
|
||||
(test 'a (macro-expand 'a))
|
||||
(test '(a b c) (macro-expand '(a b c)))
|
||||
|
||||
(let ((sex-code-macro
|
||||
'((defmacro (x10 a)
|
||||
|
||||
1
tests/sexc.module.scm
Normal file
1
tests/sexc.module.scm
Normal file
@@ -0,0 +1 @@
|
||||
(module sexc (main) "../sexc.scm")
|
||||
3
tests/utils.module.scm
Normal file
3
tests/utils.module.scm
Normal file
@@ -0,0 +1,3 @@
|
||||
(module utils
|
||||
*
|
||||
"../utils.scm")
|
||||
@@ -1,3 +1,5 @@
|
||||
(import utils)
|
||||
|
||||
(test-group "utils"
|
||||
|
||||
(test
|
||||
|
||||
Reference in New Issue
Block a user