add partcont library
This commit is contained in:
parent
10db8b9a2b
commit
5ba1d4eb39
|
@ -0,0 +1,2 @@
|
||||||
|
file(GLOB PARTCONT_FILES ${PROJECT_SOURCE_DIR}/contrib/partcont/piclib/*.scm)
|
||||||
|
list(APPEND PICLIB_CONTRIB_LIBS ${PARTCONT_FILES})
|
|
@ -0,0 +1,28 @@
|
||||||
|
(define-library (picrin control)
|
||||||
|
(import (scheme base))
|
||||||
|
|
||||||
|
(define m #f)
|
||||||
|
|
||||||
|
(define (reset t)
|
||||||
|
(call/cc
|
||||||
|
(lambda (k)
|
||||||
|
(let ((n m))
|
||||||
|
(set! m (lambda (r)
|
||||||
|
(set! m n)
|
||||||
|
(k r)))
|
||||||
|
(t)))))
|
||||||
|
|
||||||
|
(define (shift h)
|
||||||
|
(call/cc
|
||||||
|
(lambda (k)
|
||||||
|
(h (lambda (v)
|
||||||
|
(reset (lambda ()
|
||||||
|
(k v))))))))
|
||||||
|
|
||||||
|
(define prompt reset)
|
||||||
|
(define control shift)
|
||||||
|
|
||||||
|
(export shift
|
||||||
|
reset
|
||||||
|
control
|
||||||
|
prompt))
|
|
@ -9,6 +9,8 @@ set(XFILE_SOURCES extlib/xfile/xfile.c)
|
||||||
# piclib
|
# piclib
|
||||||
find_package(Perl REQUIRED)
|
find_package(Perl REQUIRED)
|
||||||
file(GLOB_RECURSE PICLIB_SCHEME_LIBS ${PROJECT_SOURCE_DIR}/piclib/*.scm)
|
file(GLOB_RECURSE PICLIB_SCHEME_LIBS ${PROJECT_SOURCE_DIR}/piclib/*.scm)
|
||||||
|
list(APPEND PICLIBS ${PICLIB_SCHEME_LIBS})
|
||||||
|
list(APPEND PICLIBS ${PICLIB_CONTRIB_LIBS})
|
||||||
set(PICLIB_SOURCES ${PROJECT_SOURCE_DIR}/src/load_piclib.c)
|
set(PICLIB_SOURCES ${PROJECT_SOURCE_DIR}/src/load_piclib.c)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${PICLIB_SOURCES}
|
OUTPUT ${PICLIB_SOURCES}
|
||||||
|
|
Loading…
Reference in New Issue