├── .gitignore ├── CMakeLists.txt ├── COPYING.CC0 ├── README.md ├── _sanity.sps ├── cmake ├── YuniBaseGenRunners.cmake ├── YuniRsrcBuild.cmake ├── YuniRsrcSchemeImplementations.cmake ├── YuniRsrcSchemeRunners.cmake ├── YuniRuntimeDeploy.cmake └── public │ ├── CMakeLists.txt │ ├── YuniBuild.cmake │ ├── YuniDetectBootstrapScheme.cmake │ ├── YuniDetectPlatform.cmake │ ├── YuniDetectScheme.cmake │ ├── YuniSdk.cmake │ └── YuniWinSupport.cmake ├── config ├── config.scm ├── generic-runtime.scm └── implinfo.cmake ├── doc ├── Files.md ├── PortingNotes │ ├── AppLaunch.md │ ├── CommandLine.md │ ├── Generic.md │ ├── README.md │ ├── StubLibrary.md │ ├── biwascheme.md │ ├── chez.md │ ├── chibi-scheme.md │ ├── chicken.md │ ├── gambit.md │ ├── gauche.md │ ├── guile.md │ ├── ironscheme.md │ ├── kawa.md │ ├── larceny.md │ ├── mit-scheme.md │ ├── nmosh.md │ ├── picrin.md │ ├── racket.md │ ├── s7.md │ ├── sagittarius.md │ └── vicare.md ├── README.md ├── dryscheme │ └── drypack.md ├── features │ └── YuniLimitations.md ├── sibr │ ├── SIBR0001-AUX-KEYWORDS.md │ ├── SIBR0002-SYNRULE-DOTTED-TAIL.md │ ├── SIBR0003-SYNRULE-LIT-UNDERSCORE.md │ ├── SIBR0004-INCLUDE-AS-LIBRARY.md │ ├── SIBR0005-C-STYLE-INCLUDEPATH.md │ ├── SIBR0006-EXPORT-AS-LIBRARY.md │ ├── SIBR0007-LIBNAME-COMPONENT.md │ ├── SIBR0008-SYNRULE-ON-SOURCE.md │ ├── SIBR0009-DEFAULT-KEYWORD-SYNTAX.md │ ├── SIBR0010-ZERO-SIZE-STORAGE.md │ ├── SIBR0011-FILE-EXISTS-DIR.md │ ├── SIBR0012-ZERO-LENGTH-READ-EOF.md │ ├── SIBR0013-INEXACT-NEGATIVE-ZERO.md │ └── SIBR0014-ZERO-VALUE-RETURN.md ├── std │ ├── r6-symbols.scm │ └── r7-symbols.scm └── yunife │ ├── INTERNALMEMO │ ├── LIBMEMO │ ├── MEMO │ ├── nmosh │ ├── nmosh027-cprocs.syms.scm │ ├── nmosh027-global-defs.syms.scm │ └── nmosh027-runtime-defs.syms.scm │ ├── r7c-prim.scm │ └── r7c-std.scm ├── external ├── README.md ├── yuni-synrules.scm └── yuniexternal │ └── chibi-scheme │ └── synrules.sls ├── integration ├── buildhost-docker-linux │ └── test-on-docker.cmake ├── buildhost-qemu-static │ ├── LICENSE │ ├── README.md │ └── register.sh ├── buildhost-win │ └── test-on-admin.cmake └── buildhost-yunibase │ └── test-on-root.cmake ├── lib-compat ├── README.md ├── bigloo-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── biwascheme-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── chez-r7b-util │ ├── bytevector-buffer.sls │ └── string-buffer.sls ├── chez-r7b │ ├── define-values.sls │ ├── i0.sls │ ├── i1.sls │ ├── i19.sls │ ├── i23.sls │ ├── i39.sls │ ├── i6.sls │ ├── i6bv.sls │ ├── i9.sls │ ├── i98.sls │ └── write.sls ├── chez-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── ident.sls │ │ └── serialize.sls ├── chibi-scheme-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── macro │ │ └── primitives.sls ├── chicken-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ ├── lighteval.sls │ │ └── macro │ │ └── primitives.sls ├── cyclone-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ ├── lighteval.sls │ │ └── macro │ │ └── primitives.sls ├── digamma-yuni │ └── compat │ │ ├── file-ops.sls │ │ └── ident.sls ├── foment-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ └── ident.sls ├── gambit-compat-scheme │ ├── base.sls │ ├── case-lambda.sls │ ├── cxr.sls │ ├── eval.sls │ ├── file.sls │ ├── inexact.sls │ ├── lazy.sls │ ├── process-context.sls │ ├── read.sls │ ├── time.sls │ └── write.sls ├── gambit-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── ffi │ │ ├── primitives-phase0.sls │ │ ├── primitives-phase1.sls │ │ ├── primitives-phase2.sls │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── gauche-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ ├── keywords.sls │ │ ├── macro │ │ └── primitives.sls │ │ └── simple-struct.sls ├── guile-r7b │ ├── define-values.sls │ ├── i0.sls │ ├── i1.sls │ ├── i19.sls │ ├── i23.sls │ ├── i39.sls │ ├── i6.sls │ ├── i6bv.sls │ ├── i9.sls │ ├── i98.sls │ └── write.sls ├── guile-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ └── ident.sls ├── ironscheme-r7b │ ├── define-values.sls │ ├── i0.sls │ ├── i1.sls │ ├── i19.sls │ ├── i23.sls │ ├── i39.sls │ ├── i6.sls │ ├── i6bv.sls │ ├── i9.sls │ ├── i98.sls │ └── write.sls ├── ironscheme-yuni │ └── compat │ │ ├── file-ops.sls │ │ └── ident.sls ├── kawa-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ └── ident.sls ├── larceny-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ └── ident.sls ├── mit-scheme-compat-scheme │ ├── base.sls │ ├── case-lambda.sls │ ├── cxr.sls │ ├── eval.sls │ ├── file.sls │ ├── inexact.sls │ ├── lazy.sls │ ├── process-context.sls │ ├── read.sls │ ├── time.sls │ └── write.sls ├── mit-scheme-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── nmosh-r7b-util │ ├── eval.nmosh.sls │ ├── features.nmosh.sls │ └── weak-box.nmosh.sls ├── nmosh-r7b │ ├── define-values.sls │ ├── i0.sls │ ├── i1.sls │ ├── i19.sls │ ├── i23.sls │ ├── i39.sls │ ├── i6.sls │ ├── i6bv.sls │ ├── i9.sls │ ├── i98.sls │ └── write.sls ├── nmosh-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ └── ident.sls ├── picrin-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── ffi │ │ └── primitives.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── macro │ │ └── primitives.sls ├── r6rs-common-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── eval.sls │ │ ├── hashtables.sls │ │ ├── keywords.sls │ │ ├── keywords0.sls │ │ ├── lighteval.sls │ │ ├── macro │ │ ├── primitives.sls │ │ └── primitives0.sls │ │ ├── serialize.sls │ │ └── simple-struct.sls ├── r7b-yuni │ └── compat │ │ ├── eval.sls │ │ └── scheme.sls ├── r7rs-common-yuni │ └── compat │ │ ├── eval.sls │ │ ├── keywords.sls │ │ ├── lighteval.sls │ │ ├── scheme.sls │ │ └── simple-struct.sls ├── racket-r7b │ ├── define-values.sls │ ├── i0.sls │ ├── i1.sls │ ├── i19.sls │ ├── i23.sls │ ├── i39.sls │ ├── i6.sls │ ├── i6bv.sls │ ├── i9.sls │ ├── i98.sls │ └── write.sls ├── racket-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── rapid-gambit-yuni │ └── compat │ │ ├── bitwise │ │ └── primitives.sls │ │ ├── ffi │ │ └── primitives.sls │ │ ├── hashtables.sls │ │ └── ident.sls ├── s7-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ ├── keywords.sls │ │ ├── lighteval.sls │ │ └── simple-struct.sls ├── sagittarius-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ ├── ident.sls │ │ ├── keywords.sls │ │ └── keywords0.sls ├── scm-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── stklos-yuni │ └── compat │ │ ├── file-ops.sls │ │ ├── hashtables.sls │ │ ├── ident.sls │ │ └── lighteval.sls ├── vicare-r7b │ ├── define-values.sls │ ├── i0.sls │ ├── i1.sls │ ├── i19.sls │ ├── i23.sls │ ├── i39.sls │ ├── i6.sls │ ├── i6bv.sls │ ├── i9.sls │ ├── i98.sls │ └── write.sls ├── vicare-yuni │ └── compat │ │ ├── ffi │ │ └── primitives.sls │ │ ├── file-ops.sls │ │ └── ident.sls ├── yunifake-util │ ├── core-syntax.sls │ ├── define-values.sls │ ├── expander-callbacks.sls │ └── scheme-syntax.sls ├── yunife-yuni │ └── compat │ │ └── scheme.sls └── yunife-yunivm │ └── runtime │ ├── case-lambda.sls │ ├── define.sls │ ├── let-values.sls │ ├── let.sls │ ├── qq.sls │ ├── syntax.sls │ └── unsupported.sls ├── lib-r6rs ├── README.md ├── r7b-impl │ ├── base.sls │ ├── case-lambda.sls │ ├── char.sls │ ├── complex.sls │ ├── cxr.sls │ ├── eval.sls │ ├── file.sls │ ├── inexact.sls │ ├── lazy.sls │ ├── load.sls │ ├── process-context.sls │ ├── r5rs.sls │ ├── read.sls │ ├── repl.sls │ ├── time.sls │ └── write.sls └── r7b-util │ ├── buffer-port.sls │ ├── bytevector-buffer.sls │ ├── case.sls │ ├── char-ready.sls │ ├── define-values.sls │ ├── emergency-exit.sls │ ├── eval.sls │ ├── features.sls │ ├── metadata.sls │ ├── port-open.sls │ ├── s45.sls │ ├── string-buffer.sls │ ├── syntax-rules.sls │ ├── time.sls │ ├── u8-ready.sls │ ├── weak-box.sls │ └── weak-eq-hashtable.sls ├── lib-r7c ├── r7c-basic │ ├── lib │ │ ├── boolean.sls │ │ ├── bytevectors.sls │ │ ├── char.sls │ │ ├── cxr.sls │ │ ├── lists.sls │ │ ├── mapforeach.sls │ │ ├── strings.sls │ │ └── vectors.sls │ └── syntax │ │ ├── define.sls │ │ ├── definecore.sls │ │ ├── if.sls │ │ ├── lambda.sls │ │ ├── letcore.sls │ │ └── quasiquote.sls ├── r7c-equiv │ └── std │ │ ├── equal.sls │ │ └── lists.sls ├── r7c-io │ ├── port │ │ ├── buffers.sls │ │ ├── control.sls │ │ ├── core.sls │ │ ├── defaults.sls │ │ ├── files.sls │ │ └── objects.sls │ └── writer │ │ └── datum.sls ├── r7c-numeric │ └── std │ │ ├── division.sls │ │ ├── generic.sls │ │ ├── inexact.sls │ │ └── misc.sls ├── r7c-report │ ├── binding-construct │ │ ├── define-values.sls │ │ ├── let-values.sls │ │ ├── let.sls │ │ └── letrec.sls │ ├── conditional │ │ ├── and.sls │ │ ├── case.sls │ │ ├── cond.sls │ │ ├── or.sls │ │ ├── unless.sls │ │ └── when.sls │ └── misc │ │ ├── case-lambda.sls │ │ ├── do.sls │ │ ├── guard.sls │ │ ├── lazy.sls │ │ └── parameterize.sls ├── r7c-system │ ├── auxsyntax.sls │ ├── core.sls │ ├── expander.sls │ ├── let-syntax.sls │ └── synrules.sls └── r7c-yunicore │ ├── simple-struct.sls │ └── yuniport.sls ├── lib-runtime ├── README.md ├── bigloo │ └── prelib.scm ├── biwascheme │ └── prelib.scm ├── chibi-scheme │ └── yuniffi-runtime.sld ├── gambit │ └── prelib.scm ├── gauche │ └── yuni-runtime │ │ └── gauche │ │ ├── loadpath.scm │ │ └── macro-primitives.scm ├── generic │ ├── libmgr-core.scm │ ├── libmgr-file.scm │ ├── libmgr-macro.scm │ ├── std │ │ ├── boolean_eqp.scm │ │ ├── floor-quotient.scm │ │ ├── floor-remainder.scm │ │ ├── floor_div.scm │ │ ├── list-copy.scm │ │ ├── list-set_x.scm │ │ ├── make-list.scm │ │ ├── modulo.scm │ │ ├── quotient.scm │ │ ├── remainder.scm │ │ ├── string-copy.scm │ │ ├── string-for-each.scm │ │ ├── string-map.scm │ │ ├── string_to_list.scm │ │ ├── string_to_vector.scm │ │ ├── truncate-quotient.scm │ │ ├── truncate-remainder.scm │ │ ├── truncate_div.scm │ │ ├── vector-append.scm │ │ ├── vector-copy.scm │ │ ├── vector-copy_x.scm │ │ ├── vector-fill_x.scm │ │ ├── vector-for-each.scm │ │ ├── vector-map.scm │ │ ├── vector_to_list.scm │ │ └── vector_to_string.scm │ ├── synrules.scm │ ├── verboselib.scm │ └── yuniloader-generic.scm ├── guile │ └── yuni-runtime │ │ └── guile.scm ├── mit-scheme │ └── prelib.scm ├── nmosh │ └── yuni-nmosh │ │ └── primitives.sls ├── r7rs │ └── yuni-runtime │ │ ├── chicken.scm │ │ ├── picrin.scm │ │ ├── r7rs.scm │ │ └── r7rs.sld ├── racket │ └── yuni-runtime │ │ ├── racket-ffi.mzscheme.sls │ │ └── racket.mzscheme.sls ├── s7 │ └── prelib.scm ├── scm │ ├── hashtable.scm │ ├── prelib.scm │ └── string-output-port.scm └── selfboot │ ├── bigloo │ ├── overrides.scm │ └── selfboot-entry.scm │ ├── biwascheme │ ├── run-genfilelist.scm │ ├── selfboot-entry.scm │ ├── selfboot-runtime.scm │ └── selfboot-yunipkg.scm │ ├── chez │ ├── selfboot-entry.sps │ └── selfboot-runtime.scm │ ├── chibi-scheme │ ├── selfboot-entry.scm │ └── selfboot-runtime.scm │ ├── chicken │ ├── selfboot-entry.scm │ └── selfboot-runtime.scm │ ├── common │ ├── common.scm │ ├── genfilelist.scm │ ├── library-parser.scm │ ├── library-walk.scm │ ├── pathname.scm │ ├── polyfills.scm │ ├── run-program.scm │ └── yuniconfig.scm │ ├── cyclone │ └── selfboot-entry.scm │ ├── digamma │ ├── selfboot-entry.sps │ └── selfboot-runtime.scm │ ├── foment │ ├── selfboot-entry.scm │ └── selfboot-runtime.scm │ ├── gambit │ └── selfboot-entry.scm │ ├── gauche │ ├── selfboot-entry.scm │ └── selfboot-runtime.scm │ ├── guile │ ├── selfboot-entry.sps │ └── selfboot-runtime.scm │ ├── guile3 │ ├── selfboot-entry.sps │ └── selfboot-runtime.scm │ ├── ironscheme │ ├── selfboot-entry.sps │ └── selfboot-runtime.scm │ ├── kawa │ ├── selfboot-entry.scm │ ├── selfboot-prog.scm │ └── selfboot-runtime.scm │ ├── mit-scheme │ └── selfboot-entry.scm │ ├── racket │ ├── selfboot-entry.rkt │ └── selfboot-runtime.scm │ ├── s7 │ ├── selfboot-entry.scm │ └── selfboot-runtime.scm │ ├── sagittarius │ ├── selfboot-entry.sps │ └── selfboot-runtime.scm │ ├── scm │ └── selfboot-entry.scm │ └── stklos │ └── selfboot-entry.scm ├── lib ├── dryscheme │ └── frontend │ │ └── compilercore.sls ├── yuni │ ├── async.sls │ ├── base │ │ ├── binding-constructs.sls │ │ ├── combinators.sls │ │ ├── dispatch.sls │ │ ├── match.sls │ │ └── shorten.sls │ ├── core.sls │ ├── ffi │ │ ├── abi │ │ │ ├── abiv0-runtime.sls │ │ │ └── abiv0.sls │ │ ├── ctemplate │ │ │ ├── constants.sls │ │ │ ├── functions.sls │ │ │ ├── prologue.sls │ │ │ ├── root.sls │ │ │ └── util.sls │ │ ├── database │ │ │ ├── config.sls │ │ │ ├── constraints.sls │ │ │ ├── exports.sls │ │ │ ├── flatten.sls │ │ │ ├── functions.sls │ │ │ ├── layouts.sls │ │ │ ├── libinfo.sls │ │ │ ├── prologue.sls │ │ │ ├── root.sls │ │ │ ├── stubir0.sls │ │ │ └── types.sls │ │ ├── nccc.sls │ │ ├── runtime │ │ │ ├── bootstraploader.sls │ │ │ ├── simpleloader.sls │ │ │ ├── simplepatcher.sls │ │ │ ├── simplestrings.sls │ │ │ ├── yunistub-abiv0.sls │ │ │ ├── yunistub-layout.sls │ │ │ └── yunistub-procs-layout.sls │ │ └── scmtemplate │ │ │ └── root.sls │ ├── hashtables.sls │ ├── io │ │ ├── drypack.sls │ │ └── leb128.sls │ ├── lighteval.sls │ ├── minife │ │ ├── environments.sls │ │ ├── expander.sls │ │ ├── identifiers.sls │ │ ├── interfacelib.sls │ │ ├── libfilepath.sls │ │ ├── libparse.sls │ │ └── libprimitivehandler.sls │ ├── miniobj.sls │ ├── miniobj │ │ ├── base.sls │ │ ├── minidispatch.sls │ │ ├── minitype.sls │ │ └── rnrs.sls │ ├── miniread │ │ ├── charclasses.sls │ │ ├── reader-main.sls │ │ ├── reader.sls │ │ └── tokens.sls │ ├── scheme.sls │ ├── serialize.sls │ ├── testing │ │ └── testeval.sls │ └── util │ │ ├── files.sls │ │ └── invalid-form.sls ├── yuniapp │ ├── phase │ │ ├── generate.sls │ │ └── yuniffistub.sls │ ├── tmpl │ │ ├── cmdline.sls │ │ ├── r6rs.sls │ │ └── r7rs.sls │ └── util │ │ ├── enumlibfiles.sls │ │ ├── openlibfile.sls │ │ └── tmplutils.sls ├── yunife │ ├── core-transformers.sls │ ├── core.sls │ ├── debugging.sls │ ├── libmgr.sls │ ├── runtime │ │ └── synrules.sls │ └── sourcereader.sls ├── yunitest │ └── mini.sls ├── yunivm │ ├── compiler │ │ └── compilercore.sls │ ├── expander │ │ ├── corelangfilter.sls │ │ └── expandcore.sls │ ├── heap │ │ ├── core.sls │ │ ├── fake │ │ │ └── coreops.sls │ │ ├── fixnum │ │ │ ├── allocator.sls │ │ │ ├── bits32.sls │ │ │ ├── bitvector.sls │ │ │ ├── coreops.sls │ │ │ ├── objpool.sls │ │ │ └── objtags.sls │ │ ├── hostbridge.sls │ │ ├── pass.sls │ │ ├── r7cfallback.sls │ │ └── r7clib.sls │ ├── loader │ │ └── generator.sls │ ├── util │ │ ├── basiclibs.sls │ │ ├── compatlibs.sls │ │ ├── r7cmapping.sls │ │ └── simplerunner.sls │ └── vm │ │ ├── seq-treeir.sls │ │ └── vmcore.sls └── yunivmrt │ ├── coresyntax.sls │ ├── expander-callbacks.sls │ ├── keywords.sls │ ├── scheme-proc.sls │ ├── scheme-syntax.sls │ ├── scheme.sls │ └── yunicore-proc.sls ├── samples ├── helloffi │ ├── CMakeLists.txt │ ├── app.sps │ ├── helloffi.c │ ├── helloffi.h │ └── helloffi_stub.scm └── hellolib │ ├── A.sls │ ├── B.sls │ ├── README.md │ ├── app.sps │ └── sub │ └── A.sls ├── scripts ├── build-apistubs-nmosh.sps ├── nmosh │ ├── rip-cprocs.sps │ ├── rip-global-defs.sps │ └── rip-nmosh-defs.sps ├── run-all.cmake └── run.cmake ├── tests ├── README.md ├── app │ ├── CMakeLists.txt │ ├── TestRunner.cmake │ ├── basic │ │ ├── A.sls │ │ ├── B.sls │ │ ├── app.sps │ │ └── sub │ │ │ └── A.sls │ ├── ffitrivial │ │ ├── CMakeLists.txt │ │ ├── app.sps │ │ └── stub │ │ │ ├── testfunc.c │ │ │ ├── testing.h │ │ │ ├── testing_trivial.scm │ │ │ ├── testinterface.h │ │ │ └── unnamed.scm │ └── hello │ │ ├── app.sps │ │ └── yunilib │ │ └── sub │ │ └── hello.sls ├── err │ ├── fail0.sps │ ├── fail1.sps │ ├── fail2.sps │ ├── fail3.sps │ ├── fail4.sps │ ├── fail5.sps │ ├── fail6.sps │ ├── fail7.sps │ └── fail8.sps ├── fails.cmake ├── lib │ ├── hashtables0.sps │ ├── hashtables1.sps │ ├── ident0.sps │ ├── lighteval0.sps │ ├── miniread0.sps │ ├── minitest0.sps │ ├── yuniio0.sps │ └── yuniio1.sps ├── newboot │ ├── testarg0.sps │ └── testarg1.sps ├── scheme │ ├── bytevectors0.sps │ ├── core0.sps │ ├── core1.sps │ ├── core2.sps │ ├── exact0.sps │ ├── exp0.sps │ ├── exp1.sps │ ├── exp2.sps │ ├── inexact0.sps │ ├── inexact1.sps │ ├── inexact2.sps │ ├── inexact3.sps │ ├── io0.sps │ ├── iter0.sps │ ├── qq0.sps │ ├── qq1.sps │ ├── strings0.sps │ ├── stx0.sps │ ├── synrule0.sps │ ├── synrule1.sps │ ├── values0.sps │ ├── values1.sps │ ├── values2.sps │ ├── values3.sps │ └── vectors0.sps ├── sibr │ ├── err-sibr0012string.sps │ ├── err-sibr0014.sps │ ├── sibr0010string.sps │ ├── sibr0010vector.sps │ ├── sibr0011.sps │ ├── sibr0012gen.sps │ ├── sibr0013.sps │ └── sibr0014.sps ├── tests.cmake ├── vm │ ├── _launcher.sps │ ├── heaptest.sps │ ├── vmtest.sps │ ├── vmtest2.sps │ ├── vmtest3.sps │ └── vmtest8.sps ├── yunibase │ ├── CMakeLists.txt │ ├── _fileops.sps │ ├── _negative.sps │ ├── _negative2.txt │ ├── negative.cmake │ └── runwithcleandir.cmake ├── yunife │ └── fecore0.sps └── yunistub │ ├── CMakeLists.txt │ ├── primitives │ ├── CMakeLists.txt │ └── primitives.c │ └── trivial │ ├── CMakeLists.txt │ ├── dummy.cpp │ ├── hand.inc.c │ ├── stdlibc_core.scm │ ├── testhand.c │ └── testhand.cpp ├── yuniruntime ├── CMakeLists.txt ├── generate.sps └── yuniffistub.sps └── yunistub ├── CMakeLists.txt ├── chibi-scheme ├── CMakeLists.txt ├── README.md ├── chibi_scheme_yuniffi_bridge.c ├── yuniffi.stub.scm └── yuniffi_stub.inc.c ├── chicken ├── CMakeLists.txt └── yuniffi-chicken.scm ├── common └── bootstrap.inc.c ├── gambit ├── CMakeLists.txt └── yuniffi-gambit.scm ├── gauche ├── CMakeLists.txt ├── callgenstub.scm.in ├── yuniffi.c ├── yuniffi.h ├── yuniffi.scm └── yuniffilib.stub ├── include └── yuniffi │ ├── abiv0 │ ├── bootstrap.h │ ├── symflags.h │ └── yuniword.h │ ├── stub │ ├── _begin_bridge.h │ ├── _begin_constants.h │ ├── _end.h │ ├── _top.h │ ├── templates.h │ ├── yunidefs.h │ └── yunitypes.h │ └── util │ └── bits.h ├── picrin ├── nitro.mk.in ├── yuniffi-config.scm └── yuniffi_picrin.c └── s7yuni ├── CMakeLists.txt ├── mus-config.h.in ├── s7yuni.c └── s7yuniboot.scm /.gitignore: -------------------------------------------------------------------------------- 1 | lib-stub 2 | _testing_liblist.txt 3 | yunistub/picrin/yuniffi_picrin.o 4 | -------------------------------------------------------------------------------- /cmake/YuniRuntimeDeploy.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeParseArguments) 2 | 3 | function(yuni_runtime_deploy) 4 | set(_opts) 5 | set(_one) 6 | set(_multi TARGETS FILES PROGRAMS) 7 | cmake_parse_arguments(ARG "${_opts}" "${_one}" "${_multi}" ${ARGN}) 8 | 9 | if(ARG_TARGETS) 10 | install(TARGETS ${ARG_TARGETS} 11 | DESTINATION ${YUNI_PLATFORM_LIBDIR}) 12 | endif() 13 | 14 | if(ARG_FILES) 15 | install(FILES ${ARG_FILES} 16 | DESTINATION ${YUNI_PLATFORM_LIBDIR}) 17 | endif() 18 | 19 | if(ARG_PROGRAMS) 20 | install(PROGRAMS ${ARG_PROGRAMS} 21 | DESTINATION ${YUNI_PLATFORM_LIBDIR}) 22 | endif() 23 | 24 | endfunction() 25 | -------------------------------------------------------------------------------- /cmake/public/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | install(FILES 3 | YuniBuild.cmake 4 | YuniDetectBootstrapScheme.cmake 5 | YuniDetectPlatform.cmake 6 | YuniDetectScheme.cmake 7 | YuniSdk.cmake 8 | YuniWinSupport.cmake 9 | DESTINATION 10 | ${YUNISDK_ROOT}/cmake/yuni) 11 | -------------------------------------------------------------------------------- /cmake/public/YuniDetectBootstrapScheme.cmake: -------------------------------------------------------------------------------- 1 | include(YuniDetectPlatform) 2 | 3 | yuni_detect_platform(ydbs__PLATFORM) 4 | 5 | if(${YUNI_BOOTSTRAP_USE} STREQUAL chez-scheme) 6 | set(ydbs__runner chez-scheme) 7 | elseif(${YUNI_BOOTSTRAP_USE} STREQUAL gauche) 8 | set(ydbs__runner gosh) 9 | elseif(${YUNI_BOOTSTRAP_USE} STREQUAL sagittarius) 10 | set(ydbs__runner sagittarius) 11 | elseif(${YUNI_BOOTSTRAP_USE} STREQUAL chibi-scheme) 12 | set(ydbs__runner chibi-scheme) 13 | elseif(${YUNI_BOOTSTRAP_USE} STREQUAL racket) 14 | set(ydbs__runner racket) 15 | elseif(${YUNI_BOOTSTRAP_USE} STREQUAL ironscheme) 16 | set(ydbs__runner ironscheme) 17 | else() 18 | message(FATAL_ERROR "???") 19 | endif() 20 | 21 | if(${ydbs__PLATFORM} STREQUAL WIN32) 22 | set(ydbs__ext ".bat") 23 | elseif(${ydbs__PLATFORM} STREQUAL WIN64) 24 | set(ydbs__ext ".bat") 25 | else() 26 | set(ydbs__ext) 27 | endif() 28 | 29 | set(YUNIBUILD_BOOTSTRAP_COMMAND 30 | ${YUNIBUILD_RUNTIME_ROOT}/${ydbs__runner}${ydbs__ext}) 31 | -------------------------------------------------------------------------------- /cmake/public/YuniDetectPlatform.cmake: -------------------------------------------------------------------------------- 1 | # Detect target platform 2 | 3 | macro(yuni_detect_platform var) 4 | if(NOT CMAKE_SIZEOF_VOID_P) 5 | message(SEND_ERROR "WHY") 6 | endif() 7 | 8 | if(WIN32) 9 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 10 | set(${var} WIN64) 11 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) 12 | set(${var} WIN32) 13 | else() 14 | message(SEND_ERROR "WHY") 15 | endif() 16 | elseif(CYGWIN) 17 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 18 | set(${var} CYG64) 19 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) 20 | set(${var} CYG32) 21 | else() 22 | message(SEND_ERROR "WHY") 23 | endif() 24 | else() 25 | set(${var} UNKNOWN) 26 | endif() 27 | endmacro() 28 | -------------------------------------------------------------------------------- /cmake/public/YuniSdk.cmake: -------------------------------------------------------------------------------- 1 | # Root module for external projects 2 | 3 | if(__YUNI_YUNISDK_INCLUDED) 4 | return() 5 | endif() 6 | 7 | set(__YUNI_YUNISDK_INCLUDED) 8 | 9 | set(YUNIBUILD_RUNTIME_ROOT ${YUNISDK_ROOT}) 10 | set(YUNIBUILD_RUNTIME_DEPENDS) 11 | 12 | include(YuniDetectScheme) 13 | 14 | yunidetectscheme_guess_bootstrap() 15 | 16 | include(YuniDetectBootstrapScheme) 17 | 18 | include(YuniBuild) 19 | 20 | function(yuniapp_add_generate tgt dir impl) 21 | yunidetectscheme_calc_batchsuffix(sufx) 22 | add_custom_target(${tgt} ALL 23 | COMMAND 24 | ${YUNIBUILD_RUNTIME_ROOT}/gen-${impl}${sufx} 25 | ${dir}) 26 | endfunction() 27 | 28 | -------------------------------------------------------------------------------- /doc/PortingNotes/chez.md: -------------------------------------------------------------------------------- 1 | ChezScheme support 2 | ================== 3 | 4 | * [GitHub](https://github.com/cisco/ChezScheme) 5 | * [Official document](http://cisco.github.io/ChezScheme/csug9.4/csug.html) 6 | 7 | YuniFFI 8 | ------- 9 | 10 | YuniFFI is implemented with Chez's native FFI framework. Thus, YuniFFI is not supported on Petite- (interpreted) variant of Chez. 11 | 12 | 13 | Debugging 14 | --------- 15 | 16 | By default, Chez does not break into debugger on CTRL+C. `debug-on-exception` paramter allows overriding this behaviour. 17 | 18 | Say `(debug-on-exception #t)` and `(keyboard-interrupt-handler (lambda () (error "Interrupt")))` on the top level. 19 | -------------------------------------------------------------------------------- /doc/PortingNotes/chibi-scheme.md: -------------------------------------------------------------------------------- 1 | Chibi-scheme support 2 | ==================== 3 | 4 | * [Official site](http://synthcode.com/wiki/chibi-scheme) 5 | * [GitHub](https://github.com/ashinn/chibi-scheme/) 6 | * [Official document](http://synthcode.com/scheme/chibi/) 7 | 8 | YuniFFI 9 | ------- 10 | 11 | YuniFFI supported through C extension. 12 | -------------------------------------------------------------------------------- /doc/PortingNotes/chicken.md: -------------------------------------------------------------------------------- 1 | Chicken support 2 | =============== 3 | 4 | * [Official site](https://www.call-cc.org/) 5 | * [Documents](http://wiki.call-cc.org/man/4/The%20User%27s%20Manual) 6 | 7 | Caveats 8 | ------- 9 | 10 | * Yuni is not wrapped into an `egg` yet. Since `snow-chibi` seems to support R7RS packaging, it would be the way to go... 11 | 12 | YuniFFI support 13 | --------------- 14 | 15 | Yuniffi is supported through [embedded C code][] which required to be pre-compiled. 16 | 17 | [embedded C code]: https://github.com/okuoku/yuni/tree/master/yunistub 18 | 19 | -------------------------------------------------------------------------------- /doc/PortingNotes/gambit.md: -------------------------------------------------------------------------------- 1 | Gambit support 2 | ============== 3 | 4 | * [Official site](http://gambitscheme.org) 5 | * [GitHub](https://github.com/gambit/gambit) 6 | * [Document](http://www.iro.umontreal.ca/~gambit/doc/gambit.html) 7 | 8 | Caveats 9 | ------- 10 | 11 | Gambit support requires Alexpander which is licensed under BSD3/GPL2+. 12 | 13 | YuniFFI 14 | ------- 15 | 16 | YuniFFI is supported through [embedded C code][]. 17 | 18 | [embedded C code]: https://github.com/okuoku/yuni/tree/master/yunistub/gambit 19 | -------------------------------------------------------------------------------- /doc/PortingNotes/gauche.md: -------------------------------------------------------------------------------- 1 | Gauche support 2 | ============== 3 | 4 | - [Official site](http://practical-scheme.net/gauche/) 5 | - [GitHub](https://github.com/shirok/Gauche) 6 | - [Reference](http://practical-scheme.net/gauche/man/gauche-refe.html) 7 | 8 | YuniFFI 9 | ------- 10 | 11 | Yuniffi supported though [C extension][]. 12 | 13 | [C extension]: https://github.com/okuoku/yuni/tree/master/yunistub/gauche 14 | -------------------------------------------------------------------------------- /doc/PortingNotes/guile.md: -------------------------------------------------------------------------------- 1 | Guile support 2 | ============= 3 | 4 | * [Official site](http://www.gnu.org/software/guile/) 5 | * [Reference](https://www.gnu.org/software/guile/docs/master/guile.html) 6 | 7 | Caveats 8 | ------- 9 | 10 | For some historical reasons, Yuni uses `.guile.sls` suffix for stub library. Thus, Guile cannot execute Yuni applications directly. 11 | 12 | YuniFFI 13 | ------- 14 | 15 | YuniFFI is implemented with Guile's native FFI framework. 16 | -------------------------------------------------------------------------------- /doc/PortingNotes/ironscheme.md: -------------------------------------------------------------------------------- 1 | IronScheme support 2 | ================== 3 | 4 | * [GitHub](https://github.com/leppie/IronScheme) 5 | * [Documentation](http://ironscheme.codeplex.com/documentation) 6 | 7 | Caveats 8 | ------- 9 | 10 | Currently, IronScheme cannot compile Yuni libraries and applications into .dll. Not sure why. 11 | 12 | YuniFFI 13 | ------- 14 | 15 | YuniFFI is not supported yet. 16 | -------------------------------------------------------------------------------- /doc/PortingNotes/kawa.md: -------------------------------------------------------------------------------- 1 | Kawa support 2 | ============ 3 | 4 | * [Official site](https://www.gnu.org/software/kawa/) 5 | 6 | Yuniffi is not supported yet. 7 | -------------------------------------------------------------------------------- /doc/PortingNotes/larceny.md: -------------------------------------------------------------------------------- 1 | Larceny support 2 | =============== 3 | 4 | * [GitHub](https://github.com/larcenists/larceny) 5 | * [Documentation](http://larcenists.org/Documentation/Documentation0.99/index.html) 6 | 7 | Caveats 8 | ------- 9 | 10 | * .slfasl modtime check is too inaccurate: https://github.com/okuoku/yuni/issues/64 11 | 12 | YuniFFI 13 | ------- 14 | 15 | YuniFFI support is incomplete. 16 | 17 | * It seems `foreign-procedure-pointer` is undocumented 18 | -------------------------------------------------------------------------------- /doc/PortingNotes/mit-scheme.md: -------------------------------------------------------------------------------- 1 | MIT/GNU Scheme support 2 | ====================== 3 | 4 | * [Official site](https://www.gnu.org/software/mit-scheme/) 5 | * [Reference](https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/index.html) 6 | 7 | Caveats 8 | ------- 9 | 10 | MIT-Scheme support requires Alexpander which is licensed under BSD3/GPL2+. 11 | 12 | Debugging 13 | --------- 14 | 15 | 1. (Specify `-DEBUG` option on yuniloader) 16 | 2. Say `(debug)` on `error>` prompt 17 | 3. `?` for help, `h` for trace, `q` for exit debugger 18 | 19 | |Letter|Command| 20 | |:----:|:------| 21 | |? |Help | 22 | |I |Redisplay error message| 23 | |H |Backtrace| 24 | |G frame-number|Select frame| 25 | |L |Show current expression| 26 | |V expr|Print variable/expression| 27 | 28 | -------------------------------------------------------------------------------- /doc/PortingNotes/nmosh.md: -------------------------------------------------------------------------------- 1 | NMosh support 2 | ============= 3 | 4 | Caveats 5 | ------- 6 | 7 | Currently, it is not supported well. Since yuni is a part of NMosh itself, it has bootstrap problem.. 8 | -------------------------------------------------------------------------------- /doc/PortingNotes/picrin.md: -------------------------------------------------------------------------------- 1 | Picrin support 2 | ============== 3 | 4 | Not yet. See [upstream bug #345](https://github.com/picrin-scheme/picrin/issues/345). 5 | 6 | Picrin has no native FFI. Yuni has a module to support to enable yuniffi on it. 7 | 8 | -------------------------------------------------------------------------------- /doc/PortingNotes/racket.md: -------------------------------------------------------------------------------- 1 | Racket support 2 | ============== 3 | 4 | * [Official site](http://racket-lang.org/) 5 | * [Reference](https://docs.racket-lang.org/) 6 | 7 | Compatibility 8 | ------------- 9 | 10 | Yuni is *not* compatible with [racket-r7rs](https://github.com/lexi-lambda/racket-r7rs). 11 | 12 | Entire Yuni framework is implemented using Racket's `r6rs-lib` package. 13 | 14 | Object mapping 15 | -------------- 16 | 17 | |R6RS/R7RS |Racket | 18 | |:----------|:-----------| 19 | |bytevectors|byte strings| 20 | 21 | 22 | YuniFFI 23 | ------- 24 | 25 | YuniFFI implemented on Racket's native FFI framework. 26 | -------------------------------------------------------------------------------- /doc/PortingNotes/sagittarius.md: -------------------------------------------------------------------------------- 1 | Sagittarius support 2 | =================== 3 | 4 | * [Bitbucket](https://bitbucket.org/ktakashi/sagittarius-scheme/overview) 5 | * [Wiki](https://bitbucket.org/ktakashi/sagittarius-scheme/wiki/Home) 6 | * [Reference](http://ktakashi.github.io/sagittarius-online-ref.html) 7 | 8 | YuniFFI 9 | ------- 10 | 11 | YuniFFI implemented with Sagittarius' native FFI framework. 12 | -------------------------------------------------------------------------------- /doc/PortingNotes/vicare.md: -------------------------------------------------------------------------------- 1 | Vicare Scheme support 2 | ===================== 3 | 4 | * [Official site](http://marcomaggi.github.io/vicare.html) 5 | * [GitHub](https://github.com/marcomaggi/vicare) 6 | * [Reference](http://marcomaggi.github.io/docs/vicare-libs.html/) 7 | 8 | Caveats 9 | ------- 10 | 11 | * Vicare cannot compile Yuni. Not sure why. 12 | * Sometimes crashes during FFI app execution. 13 | 14 | Debugging 15 | --------- 16 | 17 | Specify `-g` option to enter debugger. 18 | 19 | YuniFFI 20 | ------- 21 | 22 | YuniFFI is implemented with Vicare's native FFI framework. 23 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | Documentation Index 2 | =================== 3 | 4 | Note: No API doc yet! (uh) 5 | 6 | 7 | Porting notes 8 | ============= 9 | 10 | * [StubLibrary][] - List of "stub library" formats 11 | * [CommandLine][] - Command line formats 12 | * [AppLaunch][] - Yuni application launch strategy 13 | 14 | 15 | [StubLibrary]: https://github.com/okuoku/yuni/blob/master/doc/PortingNotes/StubLibrary.md 16 | [CommandLine]: https://github.com/okuoku/yuni/blob/master/doc/PortingNotes/CommandLine.md 17 | [AppLaunch]: https://github.com/okuoku/yuni/blob/master/doc/PortingNotes/AppLaunch.md 18 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0001-AUX-KEYWORDS.md: -------------------------------------------------------------------------------- 1 | SIBR0001: Aux keywords are not bound in standard library 2 | ======================================================== 3 | 4 | Affected: `Chicken` `Guile`(2.0.11+ or later but not 3.x) 5 | 6 | Some aux keywords/syntaxes are not bound in these implementations so we cannot rename or re-export them. 7 | 8 | Yuni requires following aux keywords are bound in `(scheme base)`. 9 | 10 | * `...` 11 | * `=>` 12 | * `else` 13 | * `unquote` 14 | * `unquote-splicing` 15 | 16 | Workaround 17 | ========== 18 | 19 | Yuni does not rename these aux keywords. 20 | 21 | Yuni build script removes these aux keywords from library export on affected implementation. 22 | 23 | Reference 24 | ========= 25 | 26 | * https://github.com/okuoku/yuni/issues/11 27 | * https://github.com/okuoku/yuni/issues/29 28 | * http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=374c1e5807a35b16170ed7686abcd5c407554d78 -- Guile 3.0 have these bindings 29 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0002-SYNRULE-DOTTED-TAIL.md: -------------------------------------------------------------------------------- 1 | SIBR0002: Syntax-rules does not accept dotted tail patttern 2 | =========================================================== 3 | 4 | Affected: `Chicken` 5 | 6 | `syntax-rules` may not accept dotted-tail pattern described as below. 7 | 8 | ``` 9 | (define-syntax lambda*1 10 | (syntax-rules () 11 | ((_ sym (spec0 ... . last) body ...) 12 | (lambda*1-itr sym () () (spec0 ...) last body ...)))) 13 | ``` 14 | 15 | Workaround 16 | ========== 17 | 18 | Do not use the pattern. It is not allowed in the standard. 19 | 20 | 21 | Reference 22 | ========= 23 | 24 | * https://github.com/okuoku/yuni/issues/26 25 | 26 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0003-SYNRULE-LIT-UNDERSCORE.md: -------------------------------------------------------------------------------- 1 | SIBR0003: Underscore as literal in syntax-rules 2 | =============================================== 3 | 4 | Affected: Every `R6RS` 5 | 6 | R6RS does not allow underscore as `syntax-rules` literal. 7 | 8 | Workaround 9 | ========== 10 | 11 | Do not use underscore as `syntax-rules` literal. 12 | 13 | Reference 14 | ========= 15 | 16 | * https://github.com/okuoku/yuni/issues/13 17 | * https://github.com/larcenists/larceny/issues/720 18 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0004-INCLUDE-AS-LIBRARY.md: -------------------------------------------------------------------------------- 1 | SIBR0004: include may be implemented as a library syntax 2 | ======================================================== 3 | 4 | Affected: `Picrin` 5 | 6 | In `Picrin`, `include` is implemented as a library syntax. 7 | 8 | Workaround 9 | ========== 10 | 11 | Yuni does not use R7RS library feature. 12 | 13 | Yuni build script reorders generated R7RS library stub. 14 | 15 | Reference 16 | ========= 17 | 18 | * https://github.com/okuoku/yuni/issues/5 19 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0005-C-STYLE-INCLUDEPATH.md: -------------------------------------------------------------------------------- 1 | SIBR0005: C style include path behaviour 2 | ======================================== 3 | 4 | Affected: `Picrin` 5 | 6 | Some R7RS implementations does not implement C-styled include path behaviour. 7 | 8 | For example, if the library was organised as: 9 | 10 | ``` 11 | common/theLibrary.sld 12 | source/body.scm 13 | ``` 14 | 15 | `common/theLibrary.sld` would have `(include "../source/body.scm")` line but it won't work on these implementations. 16 | 17 | Workaround 18 | ========== 19 | 20 | Yuni does not use R7RS library features. 21 | 22 | Reference 23 | ========= 24 | 25 | * https://github.com/okuoku/yuni/issues/6 26 | * https://github.com/okuoku/yuni/issues/7 27 | 28 | History 29 | ======= 30 | 31 | * `Gauche` adopted C-style include path behaviour in 0.9.5. 32 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0006-EXPORT-AS-LIBRARY.md: -------------------------------------------------------------------------------- 1 | SIBR0006: export may be implemented as a library syntax 2 | ======================================================= 3 | 4 | Affected: `Picrin` 5 | 6 | In `Picrin`, `export` needs to be appeared in some specific order. 7 | 8 | Workaround 9 | ========== 10 | 11 | Yuni build script have dedicated workaround on this behaviour. 12 | 13 | Reference 14 | ========= 15 | 16 | * SIBR0004 17 | * https://github.com/okuoku/yuni/issues/4 18 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0007-LIBNAME-COMPONENT.md: -------------------------------------------------------------------------------- 1 | SIBR0007: Library name component restriction 2 | ============================================ 3 | 4 | Affected: `Vicare` 5 | 6 | `Vicare` implements special handling on library name component `main`. 7 | 8 | Workaround 9 | ========== 10 | 11 | Do not use `main` as library name component. 12 | 13 | Reference 14 | ========= 15 | 16 | * https://github.com/okuoku/yuni/issues/27 17 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0008-SYNRULE-ON-SOURCE.md: -------------------------------------------------------------------------------- 1 | SIBR0008: Notation restriction on syntax-rules and define-syntax 2 | ================================================================ 3 | 4 | Affected: `Chicken` 5 | 6 | Chicken requires `syntax-rules` should be written just after `define-syntax` 7 | thus macro expands to `syntax-rules` cannot be used. 8 | 9 | Workaround 10 | ========== 11 | 12 | Yuni has integrated macro that expands into `define-syntax` and `syntax-rules` 13 | at once. 14 | 15 | ``` 16 | (define-syntax define-syntax-rules/keywords 17 | (syntax-rules () 18 | ((_ nam (symlit ...) (keylit ...) clauses ...) 19 | (define-syntax nam 20 | (syntax-rules (symlit ... keylit ...) 21 | clauses ...))))) 22 | ``` 23 | 24 | Reference 25 | ========= 26 | 27 | * http://wiki.call-cc.org/man/4/Macros 28 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0009-DEFAULT-KEYWORD-SYNTAX.md: -------------------------------------------------------------------------------- 1 | SIBR0009: Keyword syntax may be enabled by default 2 | ================================================== 3 | 4 | Affected: `Gauche` (< 0.9.8) `Sagittarius` 5 | 6 | Some Scheme implementation would enable common-lisp styled keyword syntax by 7 | default. It would result colon(:) prefixed symbols may not be read as symbols. 8 | 9 | Gauche 0.9.8 changed default behaviour that we can use keywords as same as 10 | symbols. 11 | 12 | 13 | Workaround 14 | ========== 15 | 16 | Yuni never use colon prefixed symbols except aux-keywords. New libraries should 17 | never add colon prefixed symbols as exports. 18 | 19 | For these implementations, Yuni build script removes colon prefixed symbols 20 | and use them as keywords. 21 | 22 | Reference 23 | ========= 24 | 25 | * SRFI-88 26 | * https://github.com/shirok/Gauche/commit/5b968f158e42b5d4575bebb175790d0e570d0fa0 -- Gauche 0.9.8 made `GAUCHE_KEYWORD_IS_SYMBOL` default 27 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0011-FILE-EXISTS-DIR.md: -------------------------------------------------------------------------------- 1 | SIBR0011: file-exists? can be #f on directory 2 | ============================================= 3 | 4 | Affected: `Racket` `IronScheme` 5 | 6 | On Racket/IronScheme `file-exists?` procedure return `#f` for directories, 7 | because it requires the path to be a regular file. 8 | 9 | ```scheme 10 | (file-exists? ".") ;; => #f on affected implementations, otherwise #t 11 | ``` 12 | 13 | Other implementations will return `#t` for both files and directories. 14 | 15 | Workaround 16 | ========== 17 | 18 | Avoid `file-exists?` where possible (ref. TOCTTOU problem.) 19 | 20 | `(yuni util files)` provides `file-regular?` and `file-directory?` 21 | to detect directory availablity, with additional syscall cost. 22 | 23 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0012-ZERO-LENGTH-READ-EOF.md: -------------------------------------------------------------------------------- 1 | SIBR0012: Zero length read can return eof-object 2 | ================================================ 3 | 4 | Disallow: `STklos` 5 | 6 | Early-cut: `Cyclone` 7 | 8 | EOF: `Gambit` `Foment` 9 | 10 | Nil: (otherwise) 11 | 12 | Some Scheme do not return "" (null-string) for zero-length `read-string` procedure. 13 | 14 | ```scheme 15 | (read-string 0 (open-input-string "xxxx")) ;; => "" / #!eof / ERROR 16 | ``` 17 | 18 | On Gambit, it will always return `#!eof` thus a textual port can return 19 | valid datum after `#!eof` if subsequent reads had non-zero length. 20 | 21 | Notes 22 | ===== 23 | 24 | Cyclone will prefer `#!eof` over null string if the port reached to the end(Early-cut). 25 | 26 | STklos do not allow zero-length reads from buffered port(Disallow). 27 | 28 | 29 | Reference 30 | ========= 31 | 32 | * https://github.com/okuoku/yuni/issues/132 33 | -------------------------------------------------------------------------------- /doc/sibr/SIBR0014-ZERO-VALUE-RETURN.md: -------------------------------------------------------------------------------- 1 | SIBR0014: Cannot consume zero return values 2 | =========================================== 3 | 4 | Affected: `s7` 5 | 6 | s7 cannot consume zero return values due to its values handling. 7 | 8 | ```scheme 9 | (call-with-values 10 | (lambda () (values)) 11 | (lambda () 'bogus)) ;; => throws error 12 | ``` 13 | 14 | Workaround 15 | ========== 16 | 17 | Receive `#` with N-ary lambda. Implementations other than s7 18 | will receive nil. 19 | 20 | 21 | ```scheme 22 | (call-with-values 23 | (lambda () (values)) 24 | (lambda a (length a)) ;; => 1 on s7, otherwise 0 25 | ``` 26 | 27 | 28 | Reference 29 | ========= 30 | 31 | * https://github.com/okuoku/yuni/issues/167 32 | -------------------------------------------------------------------------------- /doc/yunife/r7c-prim.scm: -------------------------------------------------------------------------------- 1 | ((r7c heap core) 2 | $unspecified 3 | $undefined) 4 | 5 | ((r7c heap fixnum) 6 | $fx>= 7 | $fx=) 8 | 9 | ((r7c heap listloop) 10 | $fx-length) 11 | 12 | -------------------------------------------------------------------------------- /doc/yunife/r7c-std.scm: -------------------------------------------------------------------------------- 1 | ((r7c heap core) 2 | eq?) 3 | 4 | ((r7c heap eqv) 5 | eqv?) 6 | 7 | ((r7c heap equal) 8 | equal?) 9 | 10 | ((r7c heap pair) 11 | pair? 12 | null? 13 | cons 14 | car 15 | cdr 16 | set-car! 17 | set-cdr!) 18 | 19 | ((r7c heap vector) 20 | list->vector 21 | vector->list) 22 | 23 | ((r7c heap list) 24 | list 25 | append) 26 | 27 | ((r7c heap listloop) 28 | memv) 29 | 30 | ((r7c core values) 31 | values 32 | call-with-values) 33 | 34 | ((r7c core callcc) 35 | call/cc 36 | call-with-current-continuation) 37 | 38 | ((r7c core boolean) 39 | not) 40 | 41 | ((r7c core dynamic-wind) 42 | dynamic-wind) 43 | 44 | ((r7c core exception) 45 | with-exception-handler 46 | raise 47 | raise-continuable) 48 | 49 | ((r7c core apply) 50 | apply) 51 | -------------------------------------------------------------------------------- /external/README.md: -------------------------------------------------------------------------------- 1 | External projects 2 | ================= 3 | 4 | This directory external copyrighted materials from other projects. 5 | 6 | * `yuni-alexpander.scm` - Alexpander modified to support yuni library 7 | * `yuni-synrules.scm` - Chibi-scheme's synrule implementation 8 | modified to support yuni library 9 | -------------------------------------------------------------------------------- /integration/buildhost-qemu-static/README.md: -------------------------------------------------------------------------------- 1 | `register.sh` took from http://github.com/multiarch/qemu-user-static 2 | -------------------------------------------------------------------------------- /lib-compat/README.md: -------------------------------------------------------------------------------- 1 | lib-compat 2 | ========== 3 | 4 | This directory includes implementation specific yuni libraries which will provide actual compatibility layer. 5 | 6 | -------------------------------------------------------------------------------- /lib-compat/bigloo-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | ;; FIXME: stub 2 | (library (bigloo-yuni compat file-ops) 3 | (export 4 | ;; chez like file-ops 5 | file-regular? 6 | file-directory? 7 | directory-list 8 | current-directory 9 | 10 | ;; mosh directory procedure 11 | create-directory 12 | delete-directory 13 | ) 14 | (import (yuni scheme) 15 | ) 16 | 17 | (define file-regular? "UNIMPL") 18 | (define file-directory? "UNIMPL") 19 | (define directory-list "UNIMPL") 20 | (define current-directory "UNIMPL") 21 | (define create-directory "UNIMPL") 22 | (define delete-directory "UNIMPL") 23 | 24 | ) 25 | 26 | -------------------------------------------------------------------------------- /lib-compat/bigloo-yuni/compat/hashtables.sls: -------------------------------------------------------------------------------- 1 | (library (bigloo-yuni compat hashtables) 2 | (export 3 | ;; Yuni extension 4 | ; Constructors 5 | make-integer-hashtable 6 | make-string-hashtable 7 | make-symbol-hashtable 8 | ; Iter 9 | hashtable-for-each ;; Bigloo 10 | hashtable-fold 11 | 12 | ;; R6RS 13 | ; Constructor 14 | make-eq-hashtable 15 | make-eqv-hashtable 16 | ; Mutators 17 | hashtable-set! 18 | hashtable-update! ;; Bigloo 19 | ; Accessor 20 | hashtable-entries 21 | hashtable-ref 22 | ; Query 23 | hashtable-keys 24 | hashtable-size ;; Bigloo 25 | ) 26 | (import (yuni scheme)) 27 | 28 | ;; Implemented in prelib 29 | (error "This library should not be loaded") 30 | 31 | ) 32 | -------------------------------------------------------------------------------- /lib-compat/bigloo-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (bigloo-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'bigloo) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/bigloo-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (bigloo-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (yuni scheme)) 4 | 5 | (define (eval/yuni frm) 6 | (eval frm (interaction-environment))) 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/biwascheme-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (biwascheme-yuni compat file-ops) 2 | (export dummy) 3 | (import (yuni scheme)) 4 | ) 5 | -------------------------------------------------------------------------------- /lib-compat/biwascheme-yuni/compat/hashtables.sls: -------------------------------------------------------------------------------- 1 | (library (biwascheme-yuni compat hashtables) 2 | (export 3 | ;; Yuni extension 4 | ; Constructors 5 | make-integer-hashtable 6 | make-string-hashtable 7 | make-symbol-hashtable 8 | ; Iter 9 | hashtable-for-each 10 | hashtable-fold 11 | 12 | ;; R6RS 13 | ; Constructor 14 | make-eq-hashtable 15 | ; Mutators 16 | hashtable-set! 17 | hashtable-update! 18 | ; Accessor 19 | hashtable-entries 20 | hashtable-ref 21 | ; Query 22 | hashtable-size) 23 | (import (yuni scheme)) 24 | 25 | (define (make-integer-hashtable) 26 | (make-eqv-hashtable)) 27 | (define (make-string-hashtable) 28 | (make-hashtable string-hash string=?)) 29 | (define (make-symbol-hashtable) 30 | (make-hashtable symbol-hash eq?)) 31 | 32 | (define (hashtable-for-each . _) (error "unimpl")) 33 | (define (hashtable-fold . _) (error "unimpl")) 34 | 35 | ) 36 | -------------------------------------------------------------------------------- /lib-compat/biwascheme-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (biwascheme-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'biwascheme) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/biwascheme-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (biwascheme-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (yuni scheme)) 4 | 5 | (define eval/yuni eval) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b-util/bytevector-buffer.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b-util bytevector-buffer) 2 | (export get-output-bytevector 3 | open-output-bytevector) 4 | (import (chezscheme)) 5 | 6 | (define (open-output-bytevector) 7 | (call-with-values 8 | (lambda () (open-bytevector-output-port)) 9 | (lambda (p proc) p))) 10 | 11 | (define (get-output-bytevector p) 12 | ;; NB: Depends on implementation details 13 | (let ((cur (binary-port-output-buffer p)) 14 | (curlen (port-length p))) 15 | (let ((out (bytevector-truncate! (bytevector-copy cur) curlen))) 16 | (set-port-length! p 0) 17 | out))) 18 | 19 | ) 20 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b-util/string-buffer.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b-util string-buffer) 2 | (export get-output-string 3 | open-output-string) 4 | (import (only (chezscheme) 5 | get-output-string 6 | open-output-string))) 7 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/define-values.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b define-values) 2 | (export define-values) 3 | (import (only (chezscheme) define-values))) 4 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i0.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i0) 2 | (export cond-expand) 3 | (import (rnrs)) 4 | ;; FIXME: Implement it! 5 | (define cond-expand #f) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i1.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i1) 2 | (export map for-each member assoc list-copy) 3 | (import (rename (except (chezscheme) list-copy) 4 | (member r6:member) 5 | (assoc r6:assoc))) 6 | 7 | (define member 8 | (case-lambda 9 | ((x lis) (r6:member x lis)) 10 | ((x lis eqv) (memp (lambda (e) (eqv x e)) lis)))) 11 | 12 | (define assoc 13 | (case-lambda 14 | ((key alist) (r6:assoc key alist)) 15 | ((key alist eqv) (assp (lambda (e) (eqv key e)) alist)))) 16 | 17 | (define (list-copy/itr! cur lis) 18 | (cond 19 | ((pair? lis) 20 | (let ((c (cons (car lis) '()))) 21 | (set-cdr! cur c) 22 | (list-copy/itr! c (cdr lis)))) 23 | (else 24 | (set-cdr! cur lis)))) 25 | 26 | (define (list-copy obj) 27 | (if (pair? obj) 28 | (let ((c (cons (car obj) '()))) 29 | (list-copy/itr! c (cdr obj)) 30 | c) 31 | obj)) 32 | 33 | ) 34 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i19.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i19) 2 | (export 3 | time-monotonic 4 | time-tai 5 | current-time 6 | time-second 7 | time-nanosecond) 8 | (import (chezscheme)) 9 | 10 | (define time-monotonic 'time-monotonic) 11 | (define time-tai 'time-utc)) 12 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i23.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i23) 2 | (export error) 3 | (import (except (rnrs) error) 4 | (rename (rnrs) (error error:r6))) 5 | (define (error msg . x) 6 | (apply error:r6 #f msg x))) 7 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i39.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i39) 2 | (export make-parameter parameterize) 3 | (import (chezscheme))) 4 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i6.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i6) 2 | (export 3 | open-input-string 4 | open-output-string 5 | get-output-string) 6 | (import (only (chezscheme) 7 | open-input-string 8 | open-output-string 9 | get-output-string))) 10 | 11 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i6bv.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i6bv) 2 | (export 3 | ;;open-input-bytevector 4 | open-output-bytevector 5 | get-output-bytevector) 6 | (import (r7b-util bytevector-buffer))) 7 | 8 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/i98.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b i98) 2 | (export get-environment-variable 3 | get-environment-variables) 4 | (import (rename (chezscheme) (getenv get-environment-variable))) 5 | 6 | (define (get-environment-variables) 7 | '(("QQQ_ERROR" . "FIXME: Chez scheme do not have get-environment-variables"))) 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /lib-compat/chez-r7b/write.sls: -------------------------------------------------------------------------------- 1 | (library (chez-r7b write) 2 | (export display write write-shared write-simple) 3 | (import (rnrs)) 4 | 5 | (define write-shared write) 6 | (define write-simple write) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/chez-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (chez-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (chezscheme)) 14 | 15 | 16 | (define create-directory mkdir) 17 | 18 | ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib-compat/chez-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (chez-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'chez) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/chez-yuni/compat/serialize.sls: -------------------------------------------------------------------------------- 1 | (library (chez-yuni compat serialize) 2 | (export 3 | put-object/serialize 4 | get-object/deserialize 5 | serialize-object 6 | deserialize-object) 7 | (import (only (chezscheme) 8 | fasl-write 9 | fasl-read) 10 | (yuni scheme)) 11 | 12 | ;; 13 | 14 | (define (put-object/serialize port obj) 15 | (fasl-write obj port)) 16 | (define (get-object/deserialize port) 17 | (fasl-read port)) 18 | 19 | (define (serialize-object obj) ;; => bv 20 | (let ((p (open-output-bytevector))) 21 | (fasl-write obj p) 22 | (let ((bv (get-output-bytevector p))) 23 | (close-port p) 24 | bv))) 25 | 26 | (define (deserialize-object bv) 27 | (let ((p (open-input-bytevector bv))) 28 | (let ((obj (fasl-read p))) 29 | (close-port p) 30 | obj))) 31 | ) 32 | -------------------------------------------------------------------------------- /lib-compat/chibi-scheme-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (chibi-scheme-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (scheme base) 14 | (chibi filesystem)) 15 | 16 | 17 | (define directory-list directory-files) 18 | 19 | ) 20 | 21 | 22 | -------------------------------------------------------------------------------- /lib-compat/chibi-scheme-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (chibi-scheme-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'chibi-scheme) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/chicken-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (chicken-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (scheme base) 14 | (chicken file) 15 | (chicken file posix) 16 | (chicken process-context)) 17 | 18 | (define file-regular? regular-file?) 19 | 20 | (define file-directory? directory?) 21 | 22 | (define (directory-list pth) 23 | (glob (string-append pth "/*"))) 24 | 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /lib-compat/chicken-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (chicken-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'chicken) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/chicken-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (chicken-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (yuni scheme) 4 | (chicken eval)) 5 | 6 | (define (eval/yuni code) 7 | ((eval-handler) code)) 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /lib-compat/cyclone-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (chibi-scheme-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (scheme base)) 14 | 15 | 16 | ;; Cyclone uses remove(3) to delete-file 17 | (define delete-directory delete-file) 18 | 19 | ;; 20 | (define create-directory "UNIMPL") 21 | (define file-regular? "UNIMPL") 22 | (define file-directory? "UNIMPL") 23 | (define current-directory "UNIMPL") 24 | 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /lib-compat/cyclone-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (cyclone-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'cyclone) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/cyclone-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (cyclone-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (scheme eval) 4 | (only (scheme base) define quote)) 5 | 6 | (define (eval/yuni frm) 7 | (eval frm)) 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/digamma-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (digamma-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory) 12 | (import (yuni scheme) 13 | (only (core) 14 | create-directory 15 | file-regular? 16 | file-directory?) 17 | (core files)) 18 | 19 | ;; Digamma uses remove(3) for `delete-file` which is also applicable on dirs 20 | (define delete-directory delete-file) 21 | 22 | ) 23 | -------------------------------------------------------------------------------- /lib-compat/digamma-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (digamma-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'digamma) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/foment-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (foment-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (scheme base) 14 | (foment base)) 15 | 16 | 17 | (define directory-list list-directory) 18 | 19 | ) 20 | 21 | 22 | -------------------------------------------------------------------------------- /lib-compat/foment-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (foment-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'foment) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/cxr.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme cxr) 2 | (export 3 | caaaar caaadr caaar caadar caaddr caadr 4 | cadaar cadadr cadar caddar cadddr caddr 5 | cdaaar cdaadr cdaar cdadar cdaddr cdadr 6 | cddaar cddadr cddar cdddar cddddr cdddr) 7 | (import) 8 | 9 | (define-primitive-names/yunifake 10 | caaaar caaadr caaar caadar caaddr caadr 11 | cadaar cadadr cadar caddar cadddr caddr 12 | cdaaar cdaadr cdaar cdadar cdaddr cdadr 13 | cddaar cddadr cddar cdddar cddddr cdddr)) 14 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/eval.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme eval) 2 | (export environment eval) 3 | (import) 4 | 5 | (define-primitive-names/yunifake 6 | eval environment) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/file.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme file) 2 | (export 3 | call-with-input-file call-with-output-file 4 | delete-file file-exists? 5 | open-binary-input-file open-binary-output-file 6 | open-input-file open-output-file 7 | with-input-from-file with-output-to-file 8 | ) 9 | (import) 10 | 11 | (define-primitive-names/yunifake 12 | call-with-input-file call-with-output-file 13 | delete-file file-exists? 14 | open-input-file open-output-file 15 | with-input-from-file with-output-to-file) 16 | 17 | (define open-binary-input-file open-input-file) 18 | (define open-binary-output-file open-output-file) 19 | 20 | ) 21 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/inexact.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme inexact) 2 | (export 3 | cos asin 4 | atan acos 5 | exp finite? 6 | infinite? log 7 | nan? sin 8 | sqrt tan) 9 | (import) 10 | 11 | (define log 12 | (case-lambda ((a) ($log a)) 13 | ((a b) (inexact (/ ($log a) ($log b)))))) 14 | 15 | (define-primitive-names/yunifake 16 | cos asin 17 | atan acos 18 | exp finite? 19 | infinite? 20 | nan? sin 21 | sqrt tan) 22 | 23 | ) 24 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/lazy.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme lazy) 2 | (export 3 | delay delay-force 4 | force make-promise 5 | promise?) 6 | (import) 7 | 8 | (define-primitive-names/yunifake 9 | force make-promise promise?) 10 | 11 | (define-syntax-names/yunifake 12 | delay delay-force) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/process-context.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme process-context) 2 | (export 3 | command-line emergency-exit 4 | exit 5 | get-environment-variable 6 | get-environment-variables 7 | ) 8 | (import) 9 | 10 | (define-primitive-names/yunifake 11 | command-line emergency-exit 12 | exit 13 | get-environment-variables) 14 | 15 | (define get-environment-variable 'YUNIFAKE-UNIMPLEMENTED) 16 | 17 | ) 18 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/read.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme read) 2 | (export read) 3 | (import) 4 | 5 | (define-primitive-names/yunifake 6 | read) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/time.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme time) 2 | (export 3 | current-jiffy current-second jiffies-per-second) 4 | (import) 5 | 6 | (define-primitive-names/yunifake 7 | current-jiffy current-second jiffies-per-second) 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/gambit-compat-scheme/write.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-compat-scheme write) 2 | (export 3 | display write write-shared write-simple ) 4 | (import) 5 | 6 | (define-primitive-names/yunifake 7 | display write write-shared) 8 | 9 | (define write-simple 'YUNIFAKE-UNIMPLEMENTED) 10 | 11 | ) 12 | -------------------------------------------------------------------------------- /lib-compat/gambit-yuni/compat/ffi/primitives-phase2.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-yuni compat ffi primitives-phase2) 2 | (export 3 | yuniffi-module-load 4 | yuniffi-module-lookup) 5 | (import (yuni scheme) 6 | (yuni ffi runtime bootstraploader) 7 | (yuni ffi runtime simpleloader) 8 | (yuni ffi runtime simplestrings) 9 | (yuni compat bitwise primitives) 10 | (gambit-yuni compat ffi primitives-phase0) 11 | (gambit-yuni compat ffi primitives-phase1)) 12 | 13 | (define-primitive-names/yunifake 14 | %%yuniffi-gambit-modpath) 15 | 16 | (define yuniffi-module-load (make-simpleloader 17 | (lambda () 18 | (list %%yuniffi-gambit-modpath)) 19 | (lambda (pth) 20 | (dlopen pth)))) 21 | 22 | (define (yuniffi-module-lookup handle str) (dlsym handle str)) 23 | 24 | ) 25 | -------------------------------------------------------------------------------- /lib-compat/gambit-yuni/compat/ffi/primitives.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-yuni compat ffi primitives) 2 | (export 3 | yuniffi-nccc-call 4 | yuniffi-module-load 5 | yuniffi-module-lookup 6 | yuniffi-nccc-ptr->callable 7 | 8 | ;; Memory OPs (pointers) 9 | ptr? 10 | ptr-read/w64ptr 11 | ptr-write/w64ptr! 12 | ptr-read/s8 ptr-read/u8 ptr-read/s16 ptr-read/u16 13 | ptr-read/s32 ptr-read/u32 ptr-read/s64 ptr-read/u64 14 | ptr-read/asciiz 15 | ptr-write/s8! ptr-write/u8! ptr-write/s16! ptr-write/u16! 16 | ptr-write/s32! ptr-write/u32! ptr-write/s64! ptr-write/u64! 17 | ptr-write/asciiz! 18 | 19 | bv-read/w64ptr 20 | bv-write/w64ptr! 21 | ) 22 | (import 23 | (gambit-yuni compat ffi primitives-phase0) 24 | (gambit-yuni compat ffi primitives-phase1) 25 | (gambit-yuni compat ffi primitives-phase2)) 26 | 27 | ) 28 | -------------------------------------------------------------------------------- /lib-compat/gambit-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (yuni scheme)) 14 | 15 | 16 | (define (%%file-type-eq? pth sym) 17 | (let ((ifo (file-info pth))) 18 | (eq? sym (file-info-type ifo)))) 19 | 20 | (define (file-regular? pth) 21 | (%%file-type-eq? pth 'regular)) 22 | 23 | (define (file-directory? pth) 24 | (%%file-type-eq? pth 'directory)) 25 | 26 | (define (directory-list pth) 27 | (let ((p (open-directory pth))) 28 | (read-all p))) 29 | 30 | ) 31 | 32 | 33 | -------------------------------------------------------------------------------- /lib-compat/gambit-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'gambit) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/gambit-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (gambit-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import) 4 | (define eval/yuni eval) 5 | ) 6 | -------------------------------------------------------------------------------- /lib-compat/gauche-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (gauche-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (gauche base) (file util)) 14 | 15 | (define file-regular? file-is-regular?) 16 | (define file-directory? file-is-directory?) 17 | 18 | ;; FIXME: it's mkdir -p 19 | (define create-directory create-directory*) 20 | 21 | ;; FIXME: it's rm -r 22 | (define delete-directory delete-directory*) 23 | 24 | 25 | ) 26 | 27 | 28 | -------------------------------------------------------------------------------- /lib-compat/gauche-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (gauche-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'gauche) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/gauche-yuni/compat/keywords.sls: -------------------------------------------------------------------------------- 1 | (library (gauche-yuni compat keywords) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (yuni scheme)) 5 | 6 | (define-syntax define-syntax-rules/keywords 7 | (syntax-rules () 8 | ((_ nam symlit* keylit* clauses ...) 9 | (define-syntax nam (syntax-rules symlit* 10 | clauses ...))))) 11 | 12 | (define-syntax define-keywords 13 | (syntax-rules () 14 | ((_ bogus ...) (begin)))) 15 | 16 | ) 17 | -------------------------------------------------------------------------------- /lib-compat/gauche-yuni/compat/macro/primitives.sls: -------------------------------------------------------------------------------- 1 | (library (gauche-yuni compat macro primitives) 2 | (export define-inject-syntax) 3 | (import (yuni-runtime gauche macro-primitives))) 4 | -------------------------------------------------------------------------------- /lib-compat/gauche-yuni/compat/simple-struct.sls: -------------------------------------------------------------------------------- 1 | (library (gauche-yuni compat simple-struct) 2 | (export 3 | make-simple-struct 4 | simple-struct-name 5 | simple-struct-ref 6 | simple-struct-set! 7 | simple-struct?) 8 | (import (yuni scheme)) 9 | 10 | (define-record-type 11 | (%make-simple-struct0 name object) 12 | simple-struct? 13 | (name simple-struct-name) 14 | (object %simple-struct-obj)) 15 | 16 | (define (simple-struct-ref obj idx) 17 | (vector-ref (%simple-struct-obj obj) idx)) 18 | (define (simple-struct-set! obj idx v) 19 | (vector-set! (%simple-struct-obj obj) idx v)) 20 | 21 | (define (make-simple-struct name len lis) 22 | (%make-simple-struct0 23 | name 24 | (list->vector lis))) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/define-values.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b define-values) 2 | (export define-values) 3 | (import (only (guile) define-values))) 4 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i0.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i0) 2 | (export cond-expand) 3 | (import (rnrs)) 4 | ;; FIXME: Implement it! 5 | (define cond-expand #f) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i1.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i1) 2 | (export map for-each member assoc list-copy) 3 | (import (srfi :1))) 4 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i19.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i19) 2 | (export 3 | time-monotonic 4 | time-tai 5 | current-time 6 | time-second 7 | time-nanosecond) 8 | (import (srfi :19))) 9 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i23.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i23) 2 | (export error) 3 | (import (only (guile) error))) 4 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i39.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i39) 2 | (export make-parameter parameterize) 3 | (import (srfi :39))) 4 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i6.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i6) 2 | (export 3 | open-input-string 4 | open-output-string 5 | get-output-string) 6 | (import (only (guile) 7 | open-input-string 8 | open-output-string 9 | get-output-string))) 10 | 11 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i6bv.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i6bv) 2 | (export 3 | ;;open-input-bytevector 4 | open-output-bytevector 5 | get-output-bytevector) 6 | (import (r7b-util bytevector-buffer))) 7 | 8 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i9.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i9) 2 | (export define-record-type) 3 | (import (srfi :9))) 4 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/i98.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b i98) 2 | (export get-environment-variable 3 | get-environment-variables) 4 | (import (srfi :98))) 5 | -------------------------------------------------------------------------------- /lib-compat/guile-r7b/write.sls: -------------------------------------------------------------------------------- 1 | (library (guile-r7b write) 2 | (export display write write-shared write-simple) 3 | (import (rnrs)) 4 | 5 | (define write-shared write) 6 | (define write-simple write) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/guile-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (guile-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'guile) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/define-values.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b define-values) 2 | (export define-values) 3 | (import (r7b-util define-values))) 4 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i0.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i0) 2 | (export cond-expand) 3 | (import (rnrs)) 4 | ;; FIXME: Implement it! 5 | (define cond-expand #f) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i1.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i1) 2 | (export map for-each member assoc list-copy) 3 | (import (srfi :1))) 4 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i19.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i19) 2 | (export 3 | time-monotonic 4 | time-tai 5 | current-time 6 | time-second 7 | time-nanosecond) 8 | (import (srfi :19))) 9 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i23.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i23) 2 | (export error) 3 | (import (except (rnrs) error) 4 | (rename (rnrs) (error error:r6))) 5 | (define (error msg . x) 6 | (apply error:r6 #f msg x))) 7 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i39.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i39) 2 | (export make-parameter parameterize) 3 | (import (srfi :39))) 4 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i6.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i6) 2 | (export 3 | open-input-string 4 | open-output-string 5 | get-output-string) 6 | (import (srfi :6))) 7 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i6bv.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i6bv) 2 | (export 3 | ;;open-input-bytevector 4 | open-output-bytevector 5 | get-output-bytevector) 6 | (import (r7b-util bytevector-buffer))) 7 | 8 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i9.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i9) 2 | (export define-record-type) 3 | (import (srfi :9))) 4 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/i98.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b i98) 2 | (export get-environment-variable 3 | get-environment-variables) 4 | (import (srfi :98)) 5 | ) 6 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-r7b/write.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-r7b write) 2 | (export display write write-shared write-simple) 3 | (import (rnrs)) 4 | 5 | (define write-shared write) 6 | (define write-simple write) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (rnrs) 14 | (ironscheme environment) ;; Current directory 15 | (ironscheme files)) 16 | 17 | 18 | ;; 19 | 20 | (define (file-regular? pth) 21 | (error #f "Unimpl")) 22 | 23 | (define (file-directory? pth) 24 | (error #f "Unimpl")) 25 | 26 | (define (directory-list pth) 27 | (append 28 | (get-files pth) 29 | (get-directories pth))) 30 | 31 | ) 32 | 33 | 34 | -------------------------------------------------------------------------------- /lib-compat/ironscheme-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (ironscheme-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'ironscheme) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/kawa-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (kawa-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (scheme base) 14 | (kawa lib ports) 15 | (kawa lib files) 16 | ) 17 | 18 | 19 | (define (file-regular? pth) (not (file-directory? pth))) 20 | 21 | (define delete-directory delete-file) 22 | 23 | ;; FIXME: Undocumented? 24 | (define directory-list directory-files) 25 | 26 | (define current-directory current-path) 27 | 28 | ) 29 | 30 | 31 | -------------------------------------------------------------------------------- /lib-compat/kawa-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (kawa-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'kawa) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/larceny-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (larceny-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'larceny) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/cxr.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme cxr) 2 | (export 3 | caaaar caaadr caaar caadar caaddr caadr 4 | cadaar cadadr cadar caddar cadddr caddr 5 | cdaaar cdaadr cdaar cdadar cdaddr cdadr 6 | cddaar cddadr cddar cdddar cddddr cdddr) 7 | (import) 8 | 9 | (define-primitive-names/yunifake 10 | caaaar caaadr caaar caadar caaddr caadr 11 | cadaar cadadr cadar caddar cadddr caddr 12 | cdaaar cdaadr cdaar cdadar cdaddr cdadr 13 | cddaar cddadr cddar cdddar cddddr cdddr)) 14 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/eval.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme eval) 2 | (export environment eval) 3 | (import) 4 | 5 | (define-primitive-names/yunifake 6 | eval environment) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/file.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme file) 2 | (export 3 | call-with-input-file call-with-output-file 4 | delete-file file-exists? 5 | open-binary-input-file open-binary-output-file 6 | open-input-file open-output-file 7 | with-input-from-file with-output-to-file 8 | ) 9 | (import) 10 | 11 | (define-primitive-names/yunifake 12 | call-with-input-file call-with-output-file 13 | delete-file file-exists? 14 | open-binary-input-file open-binary-output-file 15 | open-input-file open-output-file 16 | with-input-from-file with-output-to-file) 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/inexact.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme inexact) 2 | (export 3 | cos asin 4 | atan acos 5 | exp finite? 6 | infinite? log 7 | nan? sin 8 | sqrt tan) 9 | (import) 10 | 11 | (define log 12 | (case-lambda ((a) ($log a)) 13 | ((a b) (inexact (/ ($log a) ($log b)))))) 14 | 15 | (define-primitive-names/yunifake 16 | cos asin 17 | atan acos 18 | exp 19 | infinite? 20 | sin 21 | sqrt tan) 22 | 23 | (define nan? 'YUNIFAKE-UNIMPLEMENTED) 24 | (define (finite? x) (or (and (number? x) (integer? x)) 25 | (flo:finite? x))) 26 | 27 | ) 28 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/lazy.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme lazy) 2 | (export 3 | delay delay-force 4 | force make-promise 5 | promise?) 6 | (import) 7 | 8 | (define-primitive-names/yunifake 9 | force make-promise promise?) 10 | 11 | (define-syntax-names/yunifake 12 | delay delay-force) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/process-context.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme process-context) 2 | (export 3 | command-line emergency-exit 4 | exit 5 | get-environment-variable 6 | get-environment-variables 7 | ) 8 | (import) 9 | 10 | (define-primitive-names/yunifake 11 | command-line emergency-exit 12 | exit 13 | get-environment-variable 14 | get-environment-variables) 15 | 16 | ) 17 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/read.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme read) 2 | (export read) 3 | (import) 4 | 5 | (define-primitive-names/yunifake 6 | read) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/time.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme time) 2 | (export 3 | current-jiffy current-second jiffies-per-second) 4 | (import) 5 | 6 | (define-primitive-names/yunifake 7 | current-jiffy current-second jiffies-per-second) 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-compat-scheme/write.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-compat-scheme write) 2 | (export 3 | display write write-shared write-simple ) 4 | (import) 5 | 6 | (define-primitive-names/yunifake 7 | display write write-shared write-simple ) 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (yuni scheme)) 14 | 15 | (define-primitive-names/yunifake 16 | file-regular? 17 | file-directory? 18 | delete-directory) 19 | 20 | (define current-directory working-directory-pathname) 21 | 22 | ;; FIXME: It returns absolute paths 23 | (define directory-list directory-read) 24 | 25 | (define create-directory make-directory) 26 | 27 | ) 28 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'mit-scheme) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/mit-scheme-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (mit-scheme-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import) 4 | 5 | (define (eval/yuni sexp) (eval sexp (interaction-environment))) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b-util/features.nmosh.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b-util features) 2 | (export features) 3 | (import (nmosh r7rs condexpand-symbols))) 4 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b-util/weak-box.nmosh.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b-util weak-box) 2 | (export make-weak-box 3 | weak-box-ref 4 | weak-box-set!) 5 | (import (rnrs) (nmosh weak-vectors)) 6 | (define (make-weak-box) 7 | (make-weak-vector 1)) 8 | (define (weak-box-ref wb) 9 | (weak-vector-ref wb 0)) 10 | (define (weak-box-set! wb obj) 11 | (weak-vector-set! wb 0 obj)) 12 | ) 13 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/define-values.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b define-values) 2 | (export define-values) 3 | (import (r7b-util define-values))) 4 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i0.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i0) 2 | (export cond-expand) 3 | (import (rnrs)) 4 | ;; FIXME: Implement it! 5 | (define cond-expand #f) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i1.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i1) 2 | (export map for-each member assoc list-copy) 3 | (import (srfi :1))) 4 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i19.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i19) 2 | (export 3 | time-monotonic 4 | time-tai 5 | current-time 6 | time-second 7 | time-nanosecond) 8 | (import (srfi :19))) 9 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i23.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i23) 2 | (export error) 3 | (import (except (rnrs) error) 4 | (rename (rnrs) (error error:r6))) 5 | (define (error msg . x) 6 | (apply error:r6 #f msg x))) 7 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i39.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i39) 2 | (export make-parameter parameterize) 3 | (import (srfi :39))) 4 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i6.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i6) 2 | (export 3 | open-input-string 4 | open-output-string 5 | get-output-string) 6 | (import (srfi :6))) 7 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i6bv.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i6bv) 2 | (export 3 | get-output-bytevector 4 | open-output-bytevector) 5 | (import (rnrs) 6 | (yuni-nmosh primitives)) 7 | 8 | (define get-output-bytevector sys-get-bytevector) 9 | (define (open-output-bytevector) (sys-open-bytevector-output-port)) 10 | 11 | ) 12 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i9.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i9) 2 | (export define-record-type) 3 | (import (srfi :9))) 4 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/i98.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b i98) 2 | (export get-environment-variable 3 | get-environment-variables) 4 | (import (srfi :98)) 5 | ) 6 | -------------------------------------------------------------------------------- /lib-compat/nmosh-r7b/write.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-r7b write) 2 | (export display write write-shared write-simple) 3 | (import (rename (rnrs) 4 | (write write-simple)) 5 | (mosh)) 6 | (define write write/ss) 7 | (define write-shared write/ss)) 8 | -------------------------------------------------------------------------------- /lib-compat/nmosh-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (nmosh-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'nmosh) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/picrin-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (picrin-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'picrin) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/eval.sls: -------------------------------------------------------------------------------- 1 | (library (r6rs-common-yuni compat eval) 2 | (export eval environment) 3 | (import (rnrs eval))) 4 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/keywords.sls: -------------------------------------------------------------------------------- 1 | (library (r6rs-common-yuni compat keywords) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (for (yuni compat keywords0) run expand)) 5 | ) 6 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/keywords0.sls: -------------------------------------------------------------------------------- 1 | (library (r6rs-common-yuni compat keywords0) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (for (yuni scheme) run (meta -1)) 5 | (yuni util invalid-form)) 6 | 7 | 8 | (define-syntax define-syntax-rules/keywords 9 | (syntax-rules () 10 | ((_ nam (symlit ...) (keylit ...) clauses ...) 11 | (define-syntax nam 12 | (syntax-rules (symlit ... keylit ...) 13 | clauses ...))))) 14 | 15 | (define-syntax define-keywords 16 | (syntax-rules () 17 | ((_ key ...) 18 | (define-invalid-forms key ...)))) 19 | 20 | ) 21 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (r6rs-common-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (rnrs eval) 4 | (only (rnrs) 5 | define quote)) 6 | 7 | (define (eval/yuni frm) 8 | (eval frm (environment '(yuni scheme)))) 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/macro/primitives.sls: -------------------------------------------------------------------------------- 1 | ;; Bridge library to export identifiers on multiple meta-levels 2 | (library (r6rs-common-yuni compat macro primitives) 3 | (export define-inject-syntax) 4 | (import 5 | (rnrs) 6 | (for (r6rs-common-yuni compat macro primitives0) run expand)) 7 | 8 | (define-syntax define-inject-syntax 9 | (syntax-rules () 10 | ((_ name sym k) 11 | (define-syntax name (syntax-inject sym k))))) 12 | 13 | ) 14 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/serialize.sls: -------------------------------------------------------------------------------- 1 | (library (r6rs-common-yuni compat serialize) 2 | (export 3 | put-object/serialize 4 | get-object/deserialize 5 | serialize-object 6 | deserialize-object) 7 | (import (rnrs)) 8 | 9 | ;; FIXME: Implement it 10 | (define put-object/serialize 'UNIMPL) 11 | (define get-object/deserialize 'UNIMPL) 12 | (define serialize-object 'UNIMPL) 13 | (define deserialize-object 'UNIMPL) 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /lib-compat/r6rs-common-yuni/compat/simple-struct.sls: -------------------------------------------------------------------------------- 1 | (library (r6rs-common-yuni compat simple-struct) 2 | (export 3 | make-simple-struct 4 | simple-struct-name 5 | simple-struct-ref 6 | simple-struct-set! 7 | simple-struct?) 8 | (import (yuni scheme)) 9 | 10 | (define-record-type 11 | (%make-simple-struct0 name object) 12 | simple-struct? 13 | (name simple-struct-name) 14 | (object %simple-struct-obj)) 15 | 16 | (define (simple-struct-ref obj idx) 17 | (vector-ref (%simple-struct-obj obj) idx)) 18 | (define (simple-struct-set! obj idx v) 19 | (vector-set! (%simple-struct-obj obj) idx v)) 20 | 21 | (define (make-simple-struct name len lis) 22 | (%make-simple-struct0 23 | name 24 | (list->vector lis))) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib-compat/r7b-yuni/compat/eval.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-yuni compat eval) 2 | (export eval environment) 3 | (import (r7b-impl eval))) 4 | -------------------------------------------------------------------------------- /lib-compat/r7rs-common-yuni/compat/eval.sls: -------------------------------------------------------------------------------- 1 | (library (r7rs-common-yuni compat eval) 2 | (export eval environment) 3 | (import (scheme eval))) 4 | -------------------------------------------------------------------------------- /lib-compat/r7rs-common-yuni/compat/keywords.sls: -------------------------------------------------------------------------------- 1 | (library (r7rs-common-yuni compat keywords) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (yuni scheme) 5 | (yuni util invalid-form)) 6 | 7 | 8 | (define-syntax define-syntax-rules/keywords 9 | (syntax-rules () 10 | ((_ nam (symlit ...) (keylit ...) clauses ...) 11 | (define-syntax nam 12 | (syntax-rules (symlit ... keylit ...) 13 | clauses ...))))) 14 | 15 | (define-syntax define-keywords 16 | (syntax-rules () 17 | ((_ key ...) 18 | (define-invalid-forms key ...)))) 19 | 20 | ) 21 | -------------------------------------------------------------------------------- /lib-compat/r7rs-common-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (r7rs-common-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (scheme eval) 4 | (only (scheme base) define quote)) 5 | 6 | (define (eval/yuni frm) 7 | (eval frm (environment '(yuni scheme)))) 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /lib-compat/r7rs-common-yuni/compat/simple-struct.sls: -------------------------------------------------------------------------------- 1 | (library (r7rs-common-yuni compat simple-struct) 2 | (export 3 | make-simple-struct 4 | simple-struct-name 5 | simple-struct-ref 6 | simple-struct-set! 7 | simple-struct?) 8 | (import (yuni scheme)) 9 | 10 | (define-record-type 11 | (%make-simple-struct0 name object) 12 | simple-struct? 13 | (name simple-struct-name) 14 | (object %simple-struct-obj)) 15 | 16 | (define (simple-struct-ref obj idx) 17 | (vector-ref (%simple-struct-obj obj) idx)) 18 | (define (simple-struct-set! obj idx v) 19 | (vector-set! (%simple-struct-obj obj) idx v)) 20 | 21 | (define (make-simple-struct name len lis) 22 | (%make-simple-struct0 23 | name 24 | (list->vector lis))) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/define-values.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b define-values) 2 | (export define-values) 3 | ;; FIXME: Racket define-values do not support (define-values x ...) 4 | ;; form. 5 | (import (r7b-util define-values))) 6 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i0.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i0) 2 | (export cond-expand) 3 | (import (rnrs)) 4 | ;; FIXME: Implement it! 5 | (define cond-expand #f) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i1.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i1) 2 | (export map for-each member assoc list-copy) 3 | (import (srfi :1))) 4 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i19.sls: -------------------------------------------------------------------------------- 1 | ;; FIXME: Tentative... 2 | ;; FIXME: Racket do not have MONOTONIC time... 3 | (library (racket-r7b i19) 4 | (export 5 | time-monotonic 6 | time-tai 7 | current-time 8 | time-second 9 | time-nanosecond) 10 | (import (rnrs) (only (racket base) current-inexact-milliseconds)) 11 | 12 | (define time-tai 'time-tai) 13 | (define time-monotonic 'time-monotonic) 14 | 15 | (define (time-second ms) 16 | (floor (/ ms 1000.0))) 17 | 18 | (define (time-nanosecond ms) 19 | (let ((sec (/ ms 1000.0))) 20 | (let ((residue (- sec (floor sec)))) 21 | (* residue 1000000000.0)))) 22 | 23 | (define (current-time sym) 24 | (case sym 25 | ((time-tai time-monotonic) 26 | (current-inexact-milliseconds)) 27 | (else #f))) 28 | 29 | ) 30 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i23.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i23) 2 | (export error) 3 | (import (only (racket base) error))) 4 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i39.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i39) 2 | (export make-parameter parameterize) 3 | (import (srfi :39))) 4 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i6.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i6) 2 | (export 3 | open-output-string 4 | open-input-string 5 | open-output-string 6 | get-output-string) 7 | (import (rnrs) 8 | (rename (only (racket base) 9 | open-output-string 10 | open-input-string 11 | get-output-string) 12 | (open-output-string base:open-output-string) 13 | (open-input-string base:open-input-string))) 14 | 15 | ;; Racket requires every R6RS port transcoded.. 16 | (define (open-output-string) 17 | (define p (base:open-output-string)) 18 | (transcoded-port p (native-transcoder))) 19 | (define (open-input-string str) 20 | (define p (base:open-input-string str)) 21 | (transcoded-port p (native-transcoder))) 22 | 23 | ) 24 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i6bv.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i6bv) 2 | (export 3 | ;;open-input-bytevector 4 | open-output-bytevector 5 | get-output-bytevector) 6 | (import (rename 7 | (only (racket base) open-output-bytes get-output-bytes) 8 | (open-output-bytes open-output-bytevector) 9 | (get-output-bytes get-output-bytevector)))) 10 | 11 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i9.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i9) 2 | (export define-record-type) 3 | (import (srfi :9))) 4 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/i98.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b i98) 2 | (export get-environment-variable 3 | get-environment-variables) 4 | (import (srfi :98))) 5 | -------------------------------------------------------------------------------- /lib-compat/racket-r7b/write.sls: -------------------------------------------------------------------------------- 1 | (library (racket-r7b write) 2 | (export display write write-shared write-simple) 3 | (import (rnrs)) 4 | 5 | (define write-shared write) 6 | (define write-simple write) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/racket-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (racket-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'racket) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/racket-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (racket-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import 4 | (rnrs) 5 | (only (racket base) 6 | current-namespace 7 | namespace-variable-value)) 8 | 9 | (define eval/yuni 10 | (namespace-variable-value 11 | 'eval/yuni 12 | #t 13 | #f 14 | (current-namespace)) 15 | ) 16 | 17 | ) 18 | -------------------------------------------------------------------------------- /lib-compat/rapid-gambit-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (rapid-gambit-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'rapid-gambit) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/s7-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (s7-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory) 12 | (import (yuni scheme) ;; not really 13 | ) 14 | 15 | (define (file-regular? x) (not (file-directory? x))) 16 | (define (directory-list x) (directory->list x)) 17 | (define (file-directory? x) (directory? x)) 18 | ;; FIXME: Insecure 19 | (define (create-directory x) (system (format #f "mkdir ~A" x))) 20 | (define (delete-directory x) (system (format #f "rmdir ~A" x))) 21 | (define (current-directory) #f) 22 | ) 23 | -------------------------------------------------------------------------------- /lib-compat/s7-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (s7-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 's7) 6 | 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/s7-yuni/compat/keywords.sls: -------------------------------------------------------------------------------- 1 | (library (s7-yuni compat keywords) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (yuni scheme) 5 | (yuni util invalid-form) 6 | ) 7 | 8 | ;; 9 | 10 | (define-syntax define-syntax-rules/keywords 11 | (syntax-rules () 12 | ((_ nam (symlit ...) (keylit ...) clauses ...) 13 | (define-syntax nam 14 | (syntax-rules (symlit ... keylit ...) 15 | clauses ...))))) 16 | 17 | (define-syntax define-keywords 18 | (syntax-rules () 19 | ((_ key ...) 20 | ;; Ignore keywords 21 | (begin)))) 22 | 23 | ) 24 | -------------------------------------------------------------------------------- /lib-compat/s7-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (s7-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import (yuni scheme)) 4 | 5 | (define eval/yuni eval) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/s7-yuni/compat/simple-struct.sls: -------------------------------------------------------------------------------- 1 | (library (s7-yuni compat simple-struct) 2 | (export 3 | make-simple-struct 4 | simple-struct-name 5 | simple-struct-ref 6 | simple-struct-set! 7 | simple-struct?) 8 | (import (yuni scheme)) 9 | 10 | 11 | ;; simple-struct0 is defined at prelib.scm 12 | 13 | (define (simple-struct-name obj) (obj 'name)) 14 | (define (simple-struct-ref obj idx) (vector-ref (obj 'v) idx)) 15 | (define (simple-struct-set! obj idx v) (vector-set! (obj 'v) idx v)) 16 | 17 | (define (make-simple-struct name len lis) 18 | (let ((x (make-simple-struct0)) 19 | (v (list->vector lis))) 20 | (set! (x 'name) name) 21 | (set! (x 'v) v) 22 | x)) 23 | 24 | (define simple-struct? simple-struct0?) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib-compat/sagittarius-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | (library (sagittarius-yuni compat file-ops) 2 | (export 3 | ;; chez like file-ops 4 | file-regular? 5 | file-directory? 6 | directory-list 7 | current-directory 8 | 9 | ;; mosh directory procedure 10 | create-directory 11 | delete-directory 12 | ) 13 | (import (sagittarius) (rnrs)) 14 | 15 | (define (directory-list x) (read-directory x)) 16 | 17 | ) 18 | 19 | 20 | -------------------------------------------------------------------------------- /lib-compat/sagittarius-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (sagittarius-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'sagittarius) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/sagittarius-yuni/compat/keywords.sls: -------------------------------------------------------------------------------- 1 | (library (sagittarius-yuni compat keywords) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (for (yuni compat keywords0) run expand)) 5 | ) 6 | -------------------------------------------------------------------------------- /lib-compat/sagittarius-yuni/compat/keywords0.sls: -------------------------------------------------------------------------------- 1 | (library (sagittarius-yuni compat keywords0) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (yuni scheme)) 5 | 6 | ;; Same as (gauche-yuni compat keywords) 7 | (define-syntax define-syntax-rules/keywords 8 | (syntax-rules () 9 | ((_ nam symlit* keylit* clauses ...) 10 | (define-syntax nam 11 | (syntax-rules symlit* 12 | clauses ...))))) 13 | 14 | (define-syntax define-keywords 15 | (syntax-rules () 16 | ((_ bogus ...) (begin)))) 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /lib-compat/scm-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (scm-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'scm) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/scm-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (scm-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import) 4 | 5 | (define (eval/yuni sexp) (eval sexp (interaction-environment))) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/stklos-yuni/compat/file-ops.sls: -------------------------------------------------------------------------------- 1 | ;; STUB 2 | (library (stklos-yuni compat file-ops) 3 | (export 4 | ;; chez like file-ops 5 | file-regular? 6 | file-directory? 7 | directory-list 8 | current-directory 9 | 10 | ;; mosh directory procedure 11 | create-directory 12 | delete-directory 13 | ) 14 | (import (yuni scheme)) 15 | 16 | (define file-regular? "UNIMPL") 17 | (define file-directory? "UNIMPL") 18 | (define directory-list "UNIMPL") 19 | (define current-directory "UNIMPL") 20 | (define create-directory "UNIMPL") 21 | (define delete-directory "UNIMPL") 22 | 23 | ) 24 | -------------------------------------------------------------------------------- /lib-compat/stklos-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (stklos-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'stklos) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/stklos-yuni/compat/lighteval.sls: -------------------------------------------------------------------------------- 1 | (library (stklos-yuni compat lighteval) 2 | (export eval/yuni) 3 | (import) 4 | 5 | (define (eval/yuni sexp) (eval sexp (interaction-environment))) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/define-values.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b define-values) 2 | (export define-values) 3 | (import (r7b-util define-values))) 4 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i0.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i0) 2 | (export cond-expand) 3 | (import (rnrs)) 4 | ;; FIXME: Implement it! 5 | (define cond-expand #f) 6 | ) 7 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i1.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i1) 2 | (export map for-each member assoc list-copy) 3 | (import (srfi :1))) 4 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i19.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i19) 2 | (export 3 | time-monotonic 4 | time-tai 5 | current-time 6 | time-second 7 | time-nanosecond) 8 | (import (srfi :19))) 9 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i23.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i23) 2 | (export error) 3 | (import (except (rnrs) error) 4 | (rename (rnrs) (error error:r6))) 5 | (define (error msg . x) 6 | (apply error:r6 #f msg x))) 7 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i39.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i39) 2 | (export make-parameter parameterize) 3 | (import (srfi :39))) 4 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i6.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i6) 2 | (export 3 | open-input-string 4 | open-output-string 5 | get-output-string) 6 | (import (srfi :6))) 7 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i6bv.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i6bv) 2 | (export 3 | ;;open-input-bytevector 4 | open-output-bytevector 5 | get-output-bytevector) 6 | (import (r7b-util bytevector-buffer))) 7 | 8 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i9.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i9) 2 | (export define-record-type) 3 | (import (srfi :9))) 4 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/i98.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b i98) 2 | (export get-environment-variable 3 | get-environment-variables) 4 | (import (srfi :98)) 5 | ) 6 | -------------------------------------------------------------------------------- /lib-compat/vicare-r7b/write.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-r7b write) 2 | (export display write write-shared write-simple) 3 | (import (rnrs)) 4 | 5 | (define write-shared write) 6 | (define write-simple write) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-compat/vicare-yuni/compat/ident.sls: -------------------------------------------------------------------------------- 1 | (library (vicare-yuni compat ident) 2 | (export ident-impl) 3 | (import (yuni scheme)) 4 | 5 | (define (ident-impl) 'vicare) 6 | 7 | ) 8 | -------------------------------------------------------------------------------- /lib-compat/yunifake-util/scheme-syntax.sls: -------------------------------------------------------------------------------- 1 | (library (yunifake-util scheme-syntax) 2 | (export 3 | let 4 | let* 5 | do 6 | case 7 | cond 8 | and 9 | or 10 | quasiquote) 11 | (import (yunifake-util core-syntax))) 12 | -------------------------------------------------------------------------------- /lib-compat/yunife-yunivm/runtime/define.sls: -------------------------------------------------------------------------------- 1 | (library (yunife-yunivm runtime define) 2 | (export define) 3 | (import (yunivm-core-syntax)) 4 | 5 | (define-syntax define 6 | (syntax-rules () 7 | ((_ name body0) 8 | ($define/core name body0)) 9 | ((_ (name . args) body0 body1 ...) 10 | ($define/core name (lambda args body0 body1 ...))))) 11 | 12 | ) 13 | -------------------------------------------------------------------------------- /lib-r6rs/README.md: -------------------------------------------------------------------------------- 1 | lib-r6rs 2 | ======== 3 | 4 | This directory includes R7RS small implementation for R6RS. 5 | 6 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/case-lambda.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl case-lambda) 2 | (export case-lambda) 3 | (import (rnrs))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/char.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl char) 2 | (export 3 | 4 | ;; from R7RS draft 7 5 | char-alphabetic? char-ci<=? char-ci=? char-ci>? 6 | char-downcase char-foldcase char-lower-case? char-numeric? char-upcase 7 | char-upper-case? char-whitespace? digit-value string-ci<=? string-ci=? string-ci>? string-downcase string-foldcase 9 | string-upcase 10 | ) 11 | (import (rnrs)) 12 | (define (digit-value char) 13 | (and (char-numeric? char) 14 | (case char 15 | ((#\0) 0) 16 | ((#\1) 1) 17 | ((#\2) 2) 18 | ((#\3) 3) 19 | ((#\4) 4) 20 | ((#\5) 5) 21 | ((#\6) 6) 22 | ((#\7) 7) 23 | ((#\8) 8) 24 | ((#\9) 9) 25 | (else #f)))) 26 | ) 27 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/complex.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl complex) 2 | (export 3 | ;; from R7RS draft 7 4 | angle imag-part magnitude make-polar make-rectangular real-part 5 | ) 6 | (import (rnrs))) 7 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/cxr.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl cxr) 2 | (export 3 | ;; from R7RS draft 7 4 | caaaar caaadr caaar caadar caaddr caadr cadaar cadadr cadar caddar cadddr caddr 5 | cdaaar cdaadr cdaar cdadar cdaddr cdadr cddaar cddadr cddar cdddar cddddr cdddr 6 | ) 7 | (import (rnrs))) 8 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/eval.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl eval) 2 | (export environment eval) 3 | (import (r7b-util eval))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/file.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl file) 2 | (export 3 | ;; from R7RS draft 4 4 | call-with-input-file call-with-output-file delete-file file-exists? 5 | open-binary-input-file open-binary-output-file open-input-file 6 | open-output-file with-input-from-file with-output-to-file 7 | ) 8 | (import (rnrs)) 9 | (define (open-binary-input-file file) 10 | (open-file-input-port file)) 11 | 12 | (define (open-binary-output-file file) 13 | (open-file-output-port file)) 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/inexact.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl inexact) 2 | (export 3 | ;; from R7RS draft 7 4 | acos asin atan cos exp finite? infinite? log nan? sin sqrt tan 5 | ) 6 | (import (rnrs))) 7 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/lazy.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl lazy) 2 | (export delay force 3 | (rename (eager make-promise) 4 | (lazy delay-force)) 5 | promise?) 6 | (import (r7b-util s45)) 7 | ) 8 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/load.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl load) 2 | (export load) 3 | (import (r7b-util eval))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/process-context.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl process-context) 2 | (export 3 | ;; from R7RS draft 7 4 | command-line emergency-exit exit 5 | get-environment-variable get-environment-variables 6 | ) 7 | (import (rnrs) (r7b-compat i98) (r7b-util emergency-exit))) 8 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/read.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl read) 2 | (export read) 3 | (import (rnrs))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/repl.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl repl) 2 | (export interaction-environment) 3 | (import (r7b-util eval))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/time.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl time) 2 | (export current-jiffy current-second jiffies-per-second) 3 | (import (r7b-util time))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-impl/write.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-impl write) 2 | (export display write write-shared write-simple) 3 | (import (r7b-compat write))) 4 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/buffer-port.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util buffer-port) 2 | (export 3 | %get-buffered-data 4 | %create-buffer) 5 | (import (rnrs) (r7b-util metadata)) 6 | 7 | (define %buffer-port-id '*buffer-port*) 8 | (define (%get-buffered-data port) 9 | (let ((d (metadata-ref port))) 10 | (unless d 11 | (assertion-violation '%get-buffered-data 12 | "Lost accumulated data...(premature collection?)" 13 | port)) 14 | (unless (eq? (car d) %buffer-port-id) 15 | (assertion-violation '%get-buffered-data 16 | "something wrong with the metadata" 17 | d)) 18 | ((cdr d)))) 19 | 20 | (define (%create-buffer proc) 21 | (lambda () 22 | (let-values (((port getter) (proc))) 23 | (metadata-set! port (cons %buffer-port-id getter)) 24 | port))) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/bytevector-buffer.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util bytevector-buffer) 2 | (export 3 | get-output-bytevector 4 | open-output-bytevector 5 | ) 6 | (import (rnrs) (r7b-util buffer-port)) 7 | 8 | 9 | 10 | (define get-output-bytevector %get-buffered-data) 11 | 12 | (define open-output-bytevector (%create-buffer open-bytevector-output-port)) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/case.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util case) 2 | (export case) 3 | (import (rename (rnrs) 4 | (case r6:case))) 5 | 6 | (define-syntax %r7case-clause 7 | (syntax-rules (else =>) 8 | ((_ obj (translated ...) ()) 9 | (r6:case obj translated ...)) 10 | ((_ obj (translated ...) (((e0 e1 ...) => f) rest ...)) 11 | (%r7case-clause obj (translated ... ((e0 e1 ...) (f obj))) (rest ...))) 12 | ((_ obj (translated ...) ((else => f) rest ...)) 13 | (%r7case-clause obj (translated ... (else (f obj))) (rest ...))) 14 | ((_ obj (translated ...) (otherwise rest ...)) 15 | (%r7case-clause obj (translated ... otherwise) (rest ...))))) 16 | 17 | (define-syntax case 18 | (syntax-rules () 19 | ((_ key clause ...) 20 | (let ((obj key)) 21 | (%r7case-clause obj () (clause ...)))))) 22 | ) 23 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/char-ready.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util char-ready) 2 | (export char-ready?) 3 | (import (rnrs)) 4 | 5 | ;; FIXME: 6 | (define (char-ready? p) #f) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/emergency-exit.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util emergency-exit) 2 | (export emergency-exit) 3 | (import (rnrs)) 4 | ;; FIXME: it should map to _exit 5 | (define (emergency-exit . obj) 6 | (apply exit obj)) 7 | ) 8 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/eval.sls: -------------------------------------------------------------------------------- 1 | ;; FAKE 2 | (library (r7b-util eval) 3 | (export interaction-environment 4 | load 5 | environment 6 | eval 7 | null-environment scheme-report-environment) 8 | (import (rnrs) (rnrs eval)) 9 | 10 | (define interaction-environment "FIXME yuni: interaction environment UNIMPLEMENTED") 11 | (define load "FIXME yuni: load UNIMPLEMENTED") 12 | (define null-environment "FIXME yuni: null-environment UNIMPLEMENTED") 13 | (define scheme-report-environment "FIXME yuni: scheme-report-environment UNIMPLEMENTED") 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/features.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util features) 2 | (export features) 3 | (import (rnrs)) 4 | 5 | (define (features) ;; FIXME: ??? 6 | '(r7rs ratios exact-complex full-unicode)) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/metadata.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util metadata) 2 | (export metadata-set! 3 | metadata-ref) 4 | (import (rnrs) (r7b-util weak-eq-hashtable)) 5 | (define store (make-weak-eq-hashtable)) 6 | (define (metadata-set! obj datum) 7 | (weak-hashtable-set! store obj datum)) 8 | (define (metadata-ref obj) 9 | (weak-hashtable-ref store obj)) 10 | ) 11 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/port-open.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util port-open) 2 | (export input-port-open? 3 | output-port-open?) 4 | (import (rnrs)) 5 | 6 | ;; FIXME: 7 | (define (input-port-open? p) #t) 8 | (define (output-port-open? p) #t) 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/string-buffer.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util string-buffer) 2 | (export 3 | get-output-string 4 | open-output-string 5 | ) 6 | (import (rnrs) 7 | (r7b-util buffer-port)) 8 | 9 | 10 | (define get-output-string %get-buffered-data) 11 | (define open-output-string (%create-buffer open-string-output-port)) 12 | 13 | ) 14 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/time.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util time) 2 | (export current-jiffy current-second jiffies-per-second) 3 | (import (rnrs) 4 | (r7b-compat i19)) 5 | 6 | (define scale 1000000000.0) 7 | 8 | (define (jiffies-per-second) (exact scale)) 9 | (define (current-jiffy) (exact (return-sec time-monotonic))) 10 | (define (current-second) (return-sec time-tai)) 11 | 12 | (define (return-sec sym) 13 | (let ((t (current-time sym))) 14 | (+ (* scale (time-second t)) 15 | (time-nanosecond t)))) 16 | 17 | ) 18 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/u8-ready.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util u8-ready) 2 | (export u8-ready?) 3 | (import (rnrs)) 4 | 5 | ;; FIXME: 6 | (define (u8-ready? p) #f) 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /lib-r6rs/r7b-util/weak-box.sls: -------------------------------------------------------------------------------- 1 | (library (r7b-util weak-box) 2 | (export make-weak-box 3 | weak-box-ref 4 | weak-box-set!) 5 | (import (rnrs) (rnrs mutable-pairs)) 6 | 7 | (define (make-weak-box) (cons #f #f)) 8 | (define (weak-box-ref wb) (car wb)) 9 | (define (weak-box-set! wb obj) (set-car! wb obj)) 10 | 11 | (display "WARNING: Using FAKE implementation of weak-box\n" 12 | (current-error-port)) 13 | (display "WARNING: MEMORY LEAK will occur\n" 14 | (current-error-port)) 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r7c/r7c-basic/lib/boolean.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-basic lib boolean) 2 | (export boolean=?) 3 | (import (r7c-basic syntax define) 4 | (r7c-system core) 5 | (r7c heap boolean) 6 | (r7c syntax and) 7 | (r7c syntax or)) 8 | 9 | (define (boolean=?/itr b queue) 10 | (or (null? queue) 11 | (let ((a (car queue))) 12 | (and (boolean? a) 13 | ($boolean=? b a) 14 | (boolean=?/itr b (cdr queue)))))) 15 | 16 | (define (boolean=? a b . queue) 17 | (and (boolean? a) 18 | (boolean? b) 19 | ($boolean=? a b) 20 | (or (null? queue) 21 | (boolean=?/itr b queue)))) 22 | 23 | ) 24 | -------------------------------------------------------------------------------- /lib-r7c/r7c-basic/syntax/define.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-basic syntax define) 2 | (export define) 3 | (import (r7c-system core) 4 | (r7c-system synrules) 5 | (r7c syntax lambda) 6 | (r7c syntax definecore)) 7 | 8 | (define-syntax define 9 | (syntax-rules () 10 | ((_ (nam . frm) body ...) 11 | ($define/core nam (lambda frm body ...))) 12 | ((_ nam body) 13 | ($define/core nam body)))) 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r7c/r7c-basic/syntax/definecore.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-basic syntax definecore) 2 | (export $define/core) 3 | (import (r7c-system expander) 4 | (r7c-system synrules) 5 | (r7c-system core)) 6 | 7 | (define-syntax $define/core 8 | (syntax-rules () 9 | ((_ nam obj) 10 | ($inject define 11 | ($bind-definition nam) 12 | ($extend-env (nam) obj))))) 13 | ) 14 | -------------------------------------------------------------------------------- /lib-r7c/r7c-basic/syntax/if.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-basic syntax if) 2 | (export if) 3 | (import (r7c-system core) 4 | (r7c-system expander) 5 | (r7c-system synrules)) 6 | 7 | (define-syntax if 8 | (syntax-rules () 9 | ((_ a b) 10 | ($inject if a b)) 11 | ((_ a b c) 12 | ($inject if a b c)))) 13 | 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r7c/r7c-basic/syntax/lambda.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-basic syntax lambda) 2 | (export lambda) 3 | (import (r7c-system core) 4 | (r7c-system expander) 5 | (r7c-system synrules)) 6 | 7 | (define-syntax lambda 8 | (syntax-rules () 9 | ((_ frm body ...) 10 | ($inject lambda 11 | ($extend-env frm body ...))))) 12 | 13 | ) 14 | -------------------------------------------------------------------------------- /lib-r7c/r7c-basic/syntax/letcore.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-basic syntax letcore) 2 | (export $let/core) 3 | (import (r7c-system expander) 4 | (r7c-system synrules) 5 | (r7c-system core)) 6 | 7 | (define-syntax $let/core 8 | (syntax-rules () 9 | ((_ ((nam frm) ...) body ...) 10 | ($inject let 11 | ((($bind-variable nam) frm) ...) 12 | ($extend-env (nam ...) 13 | body ...))))) 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r7c/r7c-io/port/control.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-io port control) 2 | (export 3 | flush-output-port 4 | input-port-open? 5 | output-port-open? 6 | close-port 7 | close-input-port 8 | close-output-port 9 | ) 10 | (import (r7c-basic syntax define) 11 | (r7c-system core) 12 | (r7c heap fixnum) 13 | (r7c syntax and) 14 | (r7c-yunicore yuniport)) 15 | 16 | 17 | (define flush-output-port yuniport-flush) 18 | (define input-port-open? yuniport-input-port-open?) 19 | (define output-port-open? yuniport-output-port-open?) 20 | (define close-port yuniport-close) 21 | (define close-input-port yuniport-close-input-port) 22 | (define close-output-port yuniport-close-output-port) 23 | ) 24 | -------------------------------------------------------------------------------- /lib-r7c/r7c-io/port/core.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-io port core) 2 | (export 3 | port? 4 | input-port? 5 | output-port? 6 | textual-port? 7 | binary-port?) 8 | (import (r7c-basic syntax define) 9 | (r7c-system core) 10 | (r7c heap fixnum) 11 | (r7c syntax and) 12 | (r7c-yunicore yuniport)) 13 | 14 | (define port? yuniport?) 15 | (define input-port? yuniport-input-port?) 16 | (define output-port? yuniport-output-port?) 17 | (define textual-port? yuniport-textual-port?) 18 | (define binary-port? yuniport-binary-port?) 19 | 20 | ) 21 | -------------------------------------------------------------------------------- /lib-r7c/r7c-report/binding-construct/let.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-report binding-construct let) 2 | (export let let*) 3 | (import (r7c-system core) 4 | (r7c-system synrules) 5 | (r7c syntax letcore) 6 | (r7c syntax lambda) 7 | (r7c-report binding-construct letrec)) 8 | 9 | 10 | ;; Took from 7.3 Derived expression types 11 | ;; lambda => $let/core 12 | (define-syntax let 13 | (syntax-rules () 14 | ((let ((name val) ...) body1 body2 ...) 15 | ($let/core ((name val) ...) body1 body2 ...)) 16 | ((let tag ((name val) ...) body1 body2 ...) 17 | ((letrec ((tag (lambda (name ...) 18 | body1 body2 ...))) 19 | tag) 20 | val ...)))) 21 | 22 | (define-syntax let* 23 | (syntax-rules () 24 | ((let* () body1 body2 ...) 25 | (let () body1 body2 ...)) 26 | ((let* ((name1 val1) (name2 val2) ...) body1 body2 ...) 27 | (let ((name1 val1)) 28 | (let* ((name2 val2) ...) 29 | body1 body2 ...))))) 30 | ) 31 | -------------------------------------------------------------------------------- /lib-r7c/r7c-report/conditional/and.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-report conditional and) 2 | (export and) 3 | (import 4 | (r7c syntax if) 5 | (r7c-system synrules) 6 | (r7c-system core)) 7 | 8 | 9 | ;; Took from 7.3 Derived expression types 10 | (define-syntax and 11 | (syntax-rules () 12 | ((and) '#t) 13 | ((and test) test) 14 | ((and test1 test2 ...) 15 | (if test1 (and test2 ...) '#f)))) 16 | ) 17 | -------------------------------------------------------------------------------- /lib-r7c/r7c-report/conditional/or.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-report conditional or) 2 | (export or) 3 | (import 4 | (r7c syntax if) 5 | (r7c syntax letcore) 6 | (r7c-system synrules) 7 | (r7c-system core)) 8 | 9 | 10 | ;; Took from 7.3 Derived expression types 11 | (define-syntax or 12 | (syntax-rules () 13 | ((or) '#f) 14 | ((or test) test) 15 | ((or test1 test2 ...) 16 | ($let/core ((x test1)) 17 | (if x x (or test2 ...)))))) 18 | ) 19 | -------------------------------------------------------------------------------- /lib-r7c/r7c-report/conditional/unless.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-report conditional unless) 2 | (export unless) 3 | (import (r7c-system core) 4 | (r7c-system synrules) 5 | (r7c syntax if) 6 | (r7c heap boolean)) 7 | 8 | 9 | ;; Took from 7.3 Derived expression types 10 | (define-syntax unless 11 | (syntax-rules () 12 | ((unless test result1 result2 ...) 13 | (if (not test) 14 | (begin result1 result2 ...))))) 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r7c/r7c-report/conditional/when.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-report conditional when) 2 | (export when) 3 | (import 4 | (r7c syntax if) 5 | (r7c-system synrules) 6 | (r7c-system core)) 7 | 8 | 9 | ;; Took from 7.3 Derived expression types 10 | (define-syntax when 11 | (syntax-rules () 12 | ((when test result1 result2 ...) 13 | (if test 14 | (begin result1 result2 ...))))) 15 | ) 16 | -------------------------------------------------------------------------------- /lib-r7c/r7c-report/misc/do.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-report misc do) 2 | (export do) 3 | (import (r7c-system core) 4 | (r7c-system synrules) 5 | (r7c syntax if) 6 | (r7c syntax letrec)) 7 | 8 | ;; Took from 7.3 Derived expression types 9 | (define-syntax do 10 | (syntax-rules () 11 | ((do ((var init step ...) ...) 12 | (test expr ...) 13 | command ...) 14 | (letrec 15 | ((loop 16 | (lambda (var ...) 17 | (if test 18 | (begin 19 | (if '#f '#f) 20 | expr ...) 21 | (begin 22 | command 23 | ... 24 | (loop (do "step" var step ...) 25 | ...)))))) 26 | (loop init ...))) 27 | ((do "step" x) 28 | x) 29 | ((do "step" x y) 30 | y))) 31 | 32 | ) 33 | -------------------------------------------------------------------------------- /lib-r7c/r7c-system/auxsyntax.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-system auxsyntax) 2 | (export _ ... => 3 | unquote unquote-splicing 4 | else) 5 | (import (r7c-expander-interface)) 6 | 7 | ($define-aux-syntax _) 8 | ($define-aux-syntax ...) 9 | ($define-aux-syntax =>) 10 | ($define-aux-syntax unquote) 11 | ($define-aux-syntax unquote-splicing) 12 | ($define-aux-syntax else) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /lib-r7c/r7c-system/core.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-system core) 2 | (export define-syntax 3 | syntax-rules 4 | syntax-error 5 | quote 6 | begin set!) 7 | (import (r7c-expander-interface)) 8 | 9 | ;; FIXME: We do not have quote _ or ... here. 10 | 11 | (define-syntax begin 12 | (syntax-rules () 13 | ((begin? . rest) ($inject/splice begin . rest)))) 14 | 15 | (define-syntax set! 16 | (syntax-rules () 17 | ((set!? var arg) ($inject set! var arg)))) 18 | 19 | (define-syntax quote 20 | (syntax-rules () 21 | ((quote? obj) ($inject quote ($quote obj))))) 22 | 23 | ) 24 | -------------------------------------------------------------------------------- /lib-r7c/r7c-system/expander.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-system expander) 2 | (export $define/primitive 3 | $bind-definition 4 | $bind-variable 5 | $extend-env 6 | $inject 7 | $quote 8 | $alias) 9 | (import (r7c-expander-interface))) 10 | -------------------------------------------------------------------------------- /lib-r7c/r7c-system/let-syntax.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-system let-syntax) 2 | (export let-syntax 3 | letrec-syntax) 4 | (import (r7c-system core) 5 | (r7c-expander-interface) 6 | (r7c syntax letcore) 7 | (r7c-system synrules)) 8 | 9 | (define-syntax letrec-syntax 10 | (syntax-rules () 11 | ((_ ((nam trans) ...) body ...) 12 | ($let/core () 13 | (define-syntax nam trans) 14 | ... 15 | ($let/core () body ...))))) 16 | 17 | (define-syntax let-syntax 18 | (syntax-rules () 19 | ((_ () body ...) ;; term 20 | ($let/core () body ...)) 21 | ((_ ((nam trans) . rest) body ...) 22 | ;; Rename this step 23 | ($let/core () 24 | (define-syntax temp trans) 25 | (let-syntax rest 26 | ($alias nam temp) 27 | body ...))))) 28 | 29 | ) 30 | -------------------------------------------------------------------------------- /lib-r7c/r7c-system/synrules.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-system synrules) 2 | (export syntax-rules _ ...) 3 | (import (r7c-expander-interface) 4 | (r7c-system auxsyntax))) 5 | -------------------------------------------------------------------------------- /lib-r7c/r7c-yunicore/simple-struct.sls: -------------------------------------------------------------------------------- 1 | (library (r7c-yunicore simple-struct) 2 | (export 3 | make-simple-struct 4 | simple-struct? 5 | simple-struct-ref 6 | simple-struct-set! 7 | simple-struct-name) 8 | (import (r7c-basic syntax define) 9 | (r7c-ext simple-struct) 10 | (r7c-system core) 11 | (r7c syntax unless) 12 | (r7c heap fixnum) 13 | (r7c heap pair)) 14 | 15 | 16 | (define (make-simple-struct/inititr! cur len ss queue) 17 | (unless (null? queue) 18 | (simple-struct-set! ss cur (car queue)) 19 | (make-simple-struct/inititr! ($fx+ cur 1) len ss (cdr queue)))) 20 | 21 | (define (make-simple-struct name len lis) 22 | (let ((ss ($make-simple-struct name len))) 23 | (make-simple-struct/inititr! 0 ($fx-length lis) ss lis) 24 | ss)) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib-runtime/README.md: -------------------------------------------------------------------------------- 1 | lib-runtime 2 | =========== 3 | 4 | This directory includes *implementation specific* libraries as runtime library of yuni applications. 5 | 6 | Libraries in this directory should be written in implementation's native library format. 7 | -------------------------------------------------------------------------------- /lib-runtime/gambit/prelib.scm: -------------------------------------------------------------------------------- 1 | (define (yuni/gensym sym) (gensym sym)) 2 | (define (yuni/identifier? x) (symbol? x)) 3 | (define *yuni/libalias* 4 | '((yuni . gambit-yuni) 5 | (scheme . gambit-compat-scheme))) 6 | 7 | (define-macro (let-values cls* . body) 8 | (if (pair? cls*) 9 | (let ((c (car cls*)) 10 | (d (cdr cls*))) 11 | `(receive ,(car c) ,(cadr c) 12 | (let-values ,d ,@body))) 13 | `(let () ,@body))) 14 | 15 | ;; FIXME: yunifake leftover 16 | (define-macro (define-primitive-names/yunifake . bogus) 17 | `(begin)) 18 | -------------------------------------------------------------------------------- /lib-runtime/gauche/yuni-runtime/gauche/loadpath.scm: -------------------------------------------------------------------------------- 1 | (define-module yuni-runtime.gauche.loadpath 2 | (export loadpath)) 3 | 4 | (select-module yuni-runtime.gauche.loadpath) 5 | 6 | (define (loadpath) *load-path*) 7 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/boolean_eqp.scm: -------------------------------------------------------------------------------- 1 | (define (boolean=? first next . rest) 2 | (unless (boolean? first) 3 | (error "Boolean required" first)) 4 | (unless (boolean? next) 5 | (error "Boolean required" next)) 6 | (and (eqv? first next) 7 | (or (null? rest) 8 | (apply boolean=? next rest)))) 9 | 10 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/floor-quotient.scm: -------------------------------------------------------------------------------- 1 | (define (floor-quotient a b) (exact (floor (/ a b)))) 2 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/floor-remainder.scm: -------------------------------------------------------------------------------- 1 | (define floor-remainder modulo) 2 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/floor_div.scm: -------------------------------------------------------------------------------- 1 | (define (floor/ a b) 2 | (values (floor-quotient a b) 3 | (modulo a b))) 4 | 5 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/list-copy.scm: -------------------------------------------------------------------------------- 1 | (define (list-copy/itr! cur lis) 2 | (cond 3 | ((pair? lis) 4 | (let ((c (cons (car lis) '()))) 5 | (set-cdr! cur c) 6 | (list-copy/itr! c (cdr lis)))) 7 | (else 8 | (set-cdr! cur lis)))) 9 | 10 | (define (list-copy obj) 11 | (if (pair? obj) 12 | (let ((c (cons (car obj) '()))) 13 | (list-copy/itr! c (cdr obj)) 14 | c) 15 | obj)) 16 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/list-set_x.scm: -------------------------------------------------------------------------------- 1 | (define (list-set! lis k v) 2 | (set-car! (list-tail lis k) v)) 3 | 4 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/make-list.scm: -------------------------------------------------------------------------------- 1 | (define (make-list/fill cur k fil) 2 | (if (>= 0 k) 3 | cur 4 | (make-list/fill (cons fil cur) (- k 1) fil))) 5 | 6 | (define (make-list k . fill?) 7 | (if (null? fill?) 8 | (make-list/fill '() k #f) 9 | (make-list/fill '() k (car fill?)))) 10 | 11 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/modulo.scm: -------------------------------------------------------------------------------- 1 | (define (modulo x y) (- x (* (exact (floor (/ x y))) y))) 2 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/quotient.scm: -------------------------------------------------------------------------------- 1 | (define (quotient x y) 2 | (exact (truncate (/ x y)))) 3 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/remainder.scm: -------------------------------------------------------------------------------- 1 | (define (remainder x y) 2 | (- x (* (quotient x y) y))) 3 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/string-copy.scm: -------------------------------------------------------------------------------- 1 | (define string-copy 2 | (case-lambda 3 | ((s) (string-copy s 0 (string-length s))) 4 | ((s start) (string-copy s start (string-length s))) 5 | ((s start end) (list->string (string->list s start end))))) 6 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/string_to_list.scm: -------------------------------------------------------------------------------- 1 | (define (string->list/itr acc s start end) 2 | (if (= start end) 3 | (reverse acc) 4 | (string->list/itr (cons (string-ref s start) acc) s (+ 1 start) end))) 5 | 6 | (define string->list 7 | (case-lambda 8 | ((s) (string->list s 0 (string-length s))) 9 | ((s start) (string->list s start (string-length s))) 10 | ((s start end) 11 | (string->list/itr '() s start end)))) 12 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/string_to_vector.scm: -------------------------------------------------------------------------------- 1 | (define (string->vector/itr! v s off cur end) 2 | (unless (= end cur) 3 | (vector-set! v off (string-ref s cur)) 4 | (string->vector/itr! v s (+ 1 off) (+ 1 cur) end))) 5 | 6 | (define string->vector 7 | (case-lambda 8 | ((s) (string->vector s 0 (string-length s))) 9 | ((s start) (string->vector s start (string-length s))) 10 | ((s start end) 11 | (let* ((len (- end start)) 12 | (v (make-vector len))) 13 | (string->vector/itr! v s 0 start end) 14 | v)))) 15 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/truncate-quotient.scm: -------------------------------------------------------------------------------- 1 | (define truncate-quotient quotient) 2 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/truncate-remainder.scm: -------------------------------------------------------------------------------- 1 | (define truncate-remainder remainder) 2 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/truncate_div.scm: -------------------------------------------------------------------------------- 1 | (define (truncate/ x y) 2 | (values (truncate-quotient x y) 3 | (truncate-remainder x y))) 4 | 5 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/vector-append.scm: -------------------------------------------------------------------------------- 1 | (define (vector-append . q) 2 | (define totallen 0) 3 | ;; Calc totallen 4 | (for-each (lambda (v) (set! totallen (+ totallen (vector-length v)))) q) 5 | (let ((out (make-vector totallen)) 6 | (off 0)) 7 | (for-each (lambda (v) 8 | (vector-copy! out off v) 9 | (set! off (+ off (vector-length v)))) 10 | q) 11 | out)) 12 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/vector-copy.scm: -------------------------------------------------------------------------------- 1 | (define vector-copy 2 | (case-lambda 3 | ((v) (vector-copy v 0 (vector-length v))) 4 | ((v start) (vector-copy v start (vector-length v))) 5 | ((v start end) 6 | (let ((out (make-vector (- end start)))) 7 | (vector-copy! out 0 v start end) 8 | out)))) 9 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/vector-fill_x.scm: -------------------------------------------------------------------------------- 1 | (define (vector-fill!/itr v fill start end) 2 | (unless (= start end) 3 | (vector-set! v start fill) 4 | (vector-fill!/itr v fill (+ start 1) end))) 5 | (define vector-fill! 6 | (case-lambda 7 | ((v fill) 8 | (vector-fill! v fill 0 (vector-length v))) 9 | ((v fill start) 10 | (vector-fill! v fill start (vector-length v))) 11 | ((v fill start end) 12 | (vector-fill!/itr v fill start end)))) 13 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/vector_to_list.scm: -------------------------------------------------------------------------------- 1 | (define (vector->list/itr acc v cur start end) 2 | (if (= end cur) 3 | (reverse acc) 4 | (vector->list/itr (cons (vector-ref v cur) acc) v (+ 1 cur) start end))) 5 | 6 | (define vector->list 7 | (case-lambda 8 | ((v) (vector->list v 0 (vector-length v))) 9 | ((v start) (vector->list v start (vector-length v))) 10 | ((v start end) 11 | (let ((len (- end start))) 12 | (vector->list/itr '() v 0 start end))))) 13 | -------------------------------------------------------------------------------- /lib-runtime/generic/std/vector_to_string.scm: -------------------------------------------------------------------------------- 1 | (define (vector->string/itr! s v off cur end) 2 | (unless (= end cur) 3 | (string-set! s off (vector-ref v cur)) 4 | (vector->string/itr! s v (+ 1 off) (+ 1 cur) end))) 5 | 6 | (define vector->string 7 | (case-lambda 8 | ((v) (vector->string v 0 (vector-length v))) 9 | ((v start) (vector->string v start (vector-length v))) 10 | ((v start end) 11 | (let* ((len (- end start)) 12 | (s (make-string len))) 13 | (vector->string/itr! s v 0 start end) 14 | s)))) 15 | -------------------------------------------------------------------------------- /lib-runtime/generic/verboselib.scm: -------------------------------------------------------------------------------- 1 | (define yuni/%verbose #t) 2 | (define ERRPORT current-error-port) 3 | (define (PCK . obj) 4 | (cond 5 | (yuni/%verbose 6 | (display "-> " (ERRPORT)) 7 | (for-each (lambda (e) 8 | (write e (ERRPORT)) 9 | (display " " (ERRPORT))) 10 | obj) 11 | (newline (ERRPORT))))) 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib-runtime/guile/yuni-runtime/guile.scm: -------------------------------------------------------------------------------- 1 | ;; FIXME: This is currently a pure-R6RS... 2 | ;; We should be able to retain source information with 3 | ;; source-properties 4 | #!r6rs 5 | (library (yuni-runtime guile) 6 | (export library) 7 | (import (rnrs)) 8 | 9 | (define-syntax library 10 | (syntax-rules () 11 | ((here name export import body ...) 12 | (begin body ...)))) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /lib-runtime/mit-scheme/prelib.scm: -------------------------------------------------------------------------------- 1 | ;; MIT/GNU Scheme prelib 2 | ;; FIXME: Override 3 | (define log/r5rs log) 4 | (define (log x . y?) 5 | (if (null? y?) 6 | (log/r5rs x) 7 | (/ (log/r5rs x) (log/r5rs (car y?))))) 8 | 9 | ;; FIXME: yunifake leftover 10 | (define-macro (define-primitive-names/yunifake . bogus) 11 | `(begin)) 12 | 13 | -------------------------------------------------------------------------------- /lib-runtime/nmosh/yuni-nmosh/primitives.sls: -------------------------------------------------------------------------------- 1 | (library (yuni-nmosh primitives) 2 | (export 3 | sys-get-bytevector 4 | sys-open-bytevector-output-port 5 | prefix-list 6 | bytevector-pointer) 7 | (import (primitives 8 | sys-get-bytevector sys-open-bytevector-output-port 9 | prefix-list bytevector-pointer))) 10 | -------------------------------------------------------------------------------- /lib-runtime/r7rs/yuni-runtime/chicken.scm: -------------------------------------------------------------------------------- 1 | (define-library (yuni-runtime chicken) 2 | (export library quote) 3 | (import (scheme base)) 4 | (begin 5 | 6 | (define-syntax library 7 | (syntax-rules () 8 | ((_ libname (export ...) (import ...) body ...) 9 | (begin body ...)))))) 10 | -------------------------------------------------------------------------------- /lib-runtime/r7rs/yuni-runtime/picrin.scm: -------------------------------------------------------------------------------- 1 | (define-library (yuni-runtime picrin) 2 | (import (scheme base)) 3 | (begin 4 | 5 | (define-syntax library 6 | (syntax-rules () 7 | ((_ libname (export ...) (import ...) body ...) 8 | (begin body ...))))) 9 | (export library 10 | ;; picrin's include seems like a library procedure 11 | include 12 | )) 13 | -------------------------------------------------------------------------------- /lib-runtime/r7rs/yuni-runtime/r7rs.scm: -------------------------------------------------------------------------------- 1 | (define-library (yuni-runtime r7rs) 2 | (export library) 3 | (import (scheme base)) 4 | (begin 5 | 6 | (define-syntax library 7 | (syntax-rules () 8 | ((_ libname (export ...) (import ...) body ...) 9 | (begin body ...)))))) 10 | -------------------------------------------------------------------------------- /lib-runtime/r7rs/yuni-runtime/r7rs.sld: -------------------------------------------------------------------------------- 1 | (define-library (yuni-runtime r7rs) 2 | (export library) 3 | (import (scheme base)) 4 | (begin 5 | 6 | (define-syntax library 7 | (syntax-rules () 8 | ((_ libname (export ...) (import ...) body ...) 9 | (begin body ...)))))) 10 | -------------------------------------------------------------------------------- /lib-runtime/racket/yuni-runtime/racket-ffi.mzscheme.sls: -------------------------------------------------------------------------------- 1 | #!r6rs 2 | (library (yuni-runtime racket-ffi) 3 | (export nccc-func 4 | ptr-ref/cpointer 5 | ptr-set/cpointer!) 6 | (import (rnrs) 7 | (ffi unsafe)) 8 | 9 | (define nccc-func 10 | (_fun _gcpointer _int _gcpointer _int -> _void)) 11 | 12 | ;; FIXME: Assumes little endian 13 | (define (%calc-ptr-offset off) 14 | (define size (ctype-sizeof _pointer)) 15 | (case size 16 | ((4) 17 | (bitwise-arithmetic-shift-right off 2)) 18 | ((8) 19 | (bitwise-arithmetic-shift-right off 3)) 20 | (else (assertion-violation '%calc-ptr-offset 21 | "Unknown pointer size" size)))) 22 | (define (ptr-ref/cpointer p off) 23 | (define o (%calc-ptr-offset off)) 24 | (ptr-ref p _pointer o)) 25 | (define (ptr-set/cpointer! p off v) 26 | (define o (%calc-ptr-offset off)) 27 | (ptr-set! p _pointer o v)) 28 | 29 | ) 30 | -------------------------------------------------------------------------------- /lib-runtime/racket/yuni-runtime/racket.mzscheme.sls: -------------------------------------------------------------------------------- 1 | #!r6rs 2 | (library (yuni-runtime racket) 3 | (export library) 4 | (import (rnrs)) 5 | 6 | (define-syntax library 7 | (syntax-rules () 8 | ((here name export import body ...) 9 | (begin body ...)))) 10 | 11 | ) 12 | -------------------------------------------------------------------------------- /lib-runtime/scm/string-output-port.scm: -------------------------------------------------------------------------------- 1 | (define %ht-string-ports (make-eq-hashtable)) 2 | 3 | (define (open-output-string) 4 | (let* ((buf '()) 5 | (p (make-soft-port 6 | (vector 7 | (lambda (c) (set! buf (append buf (list c)))) 8 | (lambda (s) (set! buf (append buf (string->list s)))) 9 | (lambda () 'do-nothing) 10 | (lambda () (error "This is an output port")) 11 | (lambda () 'do-nothing)) 12 | "w"))) 13 | (hashtable-set! %ht-string-ports p 14 | (lambda () 15 | (let ((s (list->string buf))) 16 | (set! buf '()) 17 | s))) 18 | (add-finalizer 19 | p 20 | (lambda () (hashtable-delete! %ht-string-ports p))) 21 | p)) 22 | 23 | (define (get-output-string p) 24 | (let ((t (hashtable-ref %ht-string-ports p))) 25 | (t))) 26 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/biwascheme/run-genfilelist.scm: -------------------------------------------------------------------------------- 1 | (define (filelist->js-obj lis) 2 | (define (libname->string libname) 3 | (let loop ((q (cdr libname)) 4 | (cur (symbol->string (car libname)))) 5 | (if (null? q) 6 | cur 7 | (loop (cdr q) 8 | (string-append cur " " (symbol->string (car q))))))) 9 | (define (libname->array libname) 10 | (list->js-array (map symbol->string libname))) 11 | (list->js-array 12 | (map (lambda (e) 13 | (let ((libname (car e)) 14 | (dir (cadr e)) 15 | (pth (caddr e)) 16 | (a (cadddr e))) 17 | (js-obj "libname" (and libname (libname->array libname)) 18 | "dir" dir "pth" pth 19 | "alias" (and a (libname->array a))))) 20 | lis))) 21 | 22 | (define entrypoints* (js-array->list (yuni/js-import "entrypoints"))) 23 | (define loadpath* (js-array->list (yuni/js-import "loadpaths"))) 24 | 25 | (filelist->js-obj (%%selfboot-gen-filelist loadpath* entrypoints*)) 26 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/biwascheme/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define %%selfboot-fs (yuni/js-import "fs")) 6 | 7 | (define (%%selfboot-load-aliaslib truename alias* export*) 8 | ;; Call library runtime 9 | (let ((lib (yuni/library-lookup truename))) 10 | (for-each (lambda (name) 11 | (yuni/library-add-alias! lib name)) 12 | alias*))) 13 | 14 | (define (%selfboot-file->sexp-list fn) 15 | (define (wrap-paren str) 16 | (string-append "(" str ")")) 17 | (read 18 | (open-input-string 19 | (wrap-paren 20 | (js-invoke %%selfboot-fs "readFileSync" fn "utf8"))))) 21 | 22 | (define %selfboot-file-exists? file-exists?) 23 | 24 | (define (%%selfboot-loadlib pth libname imports exports) 25 | (load pth)) 26 | (define (%%selfboot-load-program pth) (load pth)) 27 | 28 | (define (%selfboot-load prefix files) 29 | (for-each (lambda (e) 30 | (load (string-append %%selfboot-yuniroot "/" 31 | prefix "/" e))) 32 | files)) 33 | 34 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/chez/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/chibi-scheme/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/chicken/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | ;(write (list 'RUNTIME: e)) (newline) 20 | (load (string-append %%selfboot-yuniroot "/" 21 | prefix "/" e))) 22 | files)) 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/common/common.scm: -------------------------------------------------------------------------------- 1 | (%selfboot-load "lib-runtime/selfboot/common" 2 | '("pathname.scm" 3 | "library-walk.scm" 4 | "library-parser.scm" 5 | "polyfills.scm" 6 | "yuniconfig.scm" 7 | "genfilelist.scm")) 8 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/common/library-parser.scm: -------------------------------------------------------------------------------- 1 | (define (%selfboot-library-name sexp) 2 | (cadr sexp)) 3 | 4 | (define (%selfboot-library-depends sexp) 5 | (cdr (cadddr sexp))) 6 | 7 | (define (%selfboot-library-exports sexp) 8 | (cdr (caddr sexp))) 9 | 10 | (define (%selfboot-program-depends sexp) 11 | (cdr (car sexp))) 12 | 13 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/common/pathname.scm: -------------------------------------------------------------------------------- 1 | (define (%selfboot-match-ext? ext fn) 2 | (let ((len (string-length fn))) 3 | (and (< 3 len) 4 | (string=? ext (stubstring fn (- len 4) len))))) 5 | 6 | (define (%selfboot-is-sls? fn) (%selfboot-match-ext? ".sls" fn)) 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/digamma/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/foment/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | #| 6 | (define-syntax library 7 | (syntax-rules () 8 | ((_ name (export ...) (import ...) body ...) 9 | (begin body ...)))) 10 | |# 11 | 12 | (define (%selfboot-file->sexp-list fn) 13 | (call-with-input-file 14 | fn 15 | (lambda (p) 16 | (let loop ((cur '())) 17 | (let ((r (read p))) 18 | (if (eof-object? r) 19 | (reverse cur) 20 | (loop (cons r cur)))))))) 21 | 22 | (define %selfboot-file-exists? file-exists?) 23 | 24 | (define (%selfboot-load prefix files) 25 | (for-each (lambda (e) 26 | (load (string-append %%selfboot-yuniroot "/" 27 | prefix "/" e) 28 | %%myenv)) 29 | files)) 30 | 31 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/gauche/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/guile/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/guile3/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/ironscheme/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/kawa/selfboot-entry.scm: -------------------------------------------------------------------------------- 1 | (load-relative "selfboot-prog.scm") 2 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/kawa/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/racket/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib-runtime/selfboot/sagittarius/selfboot-runtime.scm: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Runtime for selfboot 3 | ;; 4 | 5 | (define (%selfboot-file->sexp-list fn) 6 | (call-with-input-file 7 | fn 8 | (lambda (p) 9 | (let loop ((cur '())) 10 | (let ((r (read p))) 11 | (if (eof-object? r) 12 | (reverse cur) 13 | (loop (cons r cur)))))))) 14 | 15 | (define %selfboot-file-exists? file-exists?) 16 | 17 | (define (%selfboot-load prefix files) 18 | (for-each (lambda (e) 19 | (load (string-append %%selfboot-yuniroot "/" 20 | prefix "/" e))) 21 | files)) 22 | 23 | -------------------------------------------------------------------------------- /lib/yuni/base/combinators.sls: -------------------------------------------------------------------------------- 1 | (library (yuni base combinators) 2 | (export compose) 3 | (import (yuni scheme)) 4 | 5 | ;; gauche .$, compose 6 | (define (compose . args) 7 | ;; from Gauche manual: 8 | ;; (compose f g) == 9 | ;; (lambda args 10 | ;; (call-with-values 11 | ;; (lambda () (apply g args)) 12 | ;; f)) 13 | ;; 14 | ;; expanded. 15 | (if (pair? args) 16 | (let ((f (car args)) 17 | (next (cdr args))) 18 | (if (pair? next) 19 | (let ((g (car next)) 20 | (rest (cdr next))) 21 | (let ((q (lambda X 22 | (call-with-values (lambda () (apply g X)) f)))) 23 | (if (null? rest) 24 | q 25 | (apply compose (cons q rest))))) 26 | f)) 27 | values)) 28 | 29 | ) 30 | -------------------------------------------------------------------------------- /lib/yuni/ffi/abi/abiv0.sls: -------------------------------------------------------------------------------- 1 | (library (yuni ffi abi abiv0) 2 | (export 3 | yuniffi-abiv0-export-suffix/constants 4 | yuniffi-abiv0-export-suffix/bridgestubs 5 | YUNIFFI_SYMBOL__TERMINATE 6 | YUNIFFI_SYMBOL__VALID) 7 | (import (yuni scheme)) 8 | 9 | (define yuniffi-abiv0-export-suffix/constants 10 | "_export_constants") 11 | (define yuniffi-abiv0-export-suffix/bridgestubs 12 | "_export_bridgestubs") 13 | 14 | (define YUNIFFI_SYMBOL__TERMINATE 1) 15 | (define YUNIFFI_SYMBOL__VALID 2) 16 | (define YUNIFFI_SYMBOL__HAS_SIZE 4) 17 | (define YUNIFFI_SYMBOL__HAS_OFFSET 8) 18 | 19 | ) 20 | -------------------------------------------------------------------------------- /lib/yuni/ffi/ctemplate/root.sls: -------------------------------------------------------------------------------- 1 | (library (yuni ffi ctemplate root) 2 | (export put-c-stubsource) 3 | (import (yuni scheme) 4 | (yuni ffi ctemplate util) 5 | (yuni ffi ctemplate prologue) 6 | (yuni ffi ctemplate constants) 7 | (yuni ffi ctemplate functions)) 8 | 9 | (define (put-c-stubsource port db) 10 | (define (p . obj) (apply put-obj port (append obj (list "\n")))) 11 | (put-c-prologue port db) 12 | (p "#include ") 13 | (p) 14 | (put-c-constants port db) 15 | (p) 16 | (p "#include ") 17 | (p) 18 | (put-c-functions port db) 19 | (p) 20 | (p "#include ")) 21 | 22 | ) 23 | -------------------------------------------------------------------------------- /lib/yuni/ffi/ctemplate/util.sls: -------------------------------------------------------------------------------- 1 | ;; Port output utility. FIXME: Move this as public library 2 | 3 | (library (yuni ffi ctemplate util) 4 | (export 5 | put-obj) 6 | (import (yuni scheme)) 7 | 8 | (define (recons obj) 9 | ;; FIXME: To prevent Racket's { } list output 10 | (define (listproc p obj) 11 | (if (pair? obj) 12 | (let ((a (car obj)) 13 | (d (cdr obj))) 14 | (put-obj p a) 15 | (when (pair? d) 16 | (display " " p)) 17 | (listproc p d)) 18 | (get-output-string p))) 19 | 20 | (cond 21 | ((list? obj) 22 | (string-append "(" 23 | (listproc (open-output-string) obj) 24 | ")")) 25 | (else obj))) 26 | 27 | (define (put-obj port . objs) 28 | (for-each (lambda (e) (display (recons e) port)) objs)) 29 | 30 | ) 31 | -------------------------------------------------------------------------------- /lib/yuni/ffi/database/config.sls: -------------------------------------------------------------------------------- 1 | (library (yuni ffi database config) 2 | (export make-config 3 | config-stub-c 4 | config-stub-cxx) 5 | (import (yuni scheme) 6 | (yuni core)) 7 | 8 | ;; config object (for stubir0) 9 | (define* config (stub-c stub-cxx)) 10 | 11 | (define (make-config stub-c stub-cxx) 12 | (make config 13 | (stub-c stub-c) 14 | (stub-cxx stub-cxx))) 15 | 16 | (define* (config-stub-c (config)) 17 | (~ config 'stub-c)) 18 | 19 | (define* (config-stub-cxx (config)) 20 | (~ config 'stub-cxx)) 21 | ) 22 | -------------------------------------------------------------------------------- /lib/yuni/ffi/database/libinfo.sls: -------------------------------------------------------------------------------- 1 | (library (yuni ffi database libinfo) 2 | (export make-libinfo 3 | libinfo-c-name 4 | libinfo-scheme-name) 5 | (import (yuni scheme) 6 | (yuni core)) 7 | 8 | ;; libinfo object 9 | (define* libinfo (c-name scheme-name)) 10 | 11 | (define (make-libinfo c-name scheme-name) 12 | (make libinfo 13 | (c-name c-name) 14 | (scheme-name scheme-name))) 15 | 16 | (define* (libinfo-c-name (libinfo)) 17 | (~ libinfo 'c-name)) 18 | 19 | (define* (libinfo-scheme-name (libinfo)) 20 | (~ libinfo 'scheme-name)) 21 | ) 22 | -------------------------------------------------------------------------------- /lib/yuni/ffi/database/prologue.sls: -------------------------------------------------------------------------------- 1 | (library (yuni ffi database prologue) 2 | (export make-prologue 3 | prologue-source 4 | prologue-symbols 5 | prologue-add-symbol!) 6 | (import (yuni scheme) 7 | (yuni core)) 8 | 9 | ;; prologue. There is no information for scheme runtime. 10 | 11 | (define* prologue (source symbols*)) 12 | 13 | (define (make-prologue src) 14 | (make prologue 15 | (source src) 16 | (symbols* '()))) 17 | 18 | (define* (prologue-source (prologue)) 19 | (~ prologue 'source)) 20 | 21 | (define* (prologue-symbols (prologue)) 22 | (~ prologue 'symbols*)) 23 | 24 | (define* (prologue-add-symbol! (prologue) sym) 25 | (~ prologue 'symbols* := (cons sym (prologue-symbols prologue)))) 26 | 27 | ) 28 | -------------------------------------------------------------------------------- /lib/yuni/hashtables.sls: -------------------------------------------------------------------------------- 1 | (library (yuni hashtables) 2 | (export 3 | ;; Yuni extension 4 | ; Constructors 5 | make-integer-hashtable 6 | make-string-hashtable 7 | make-symbol-hashtable 8 | ; Iter 9 | hashtable-for-each 10 | hashtable-fold 11 | 12 | ;; R6RS 13 | ; Constructor 14 | make-eq-hashtable 15 | make-eqv-hashtable 16 | ; Mutators 17 | hashtable-set! 18 | hashtable-update! 19 | ; Accessor 20 | hashtable-entries 21 | hashtable-ref 22 | ; Query 23 | hashtable-keys 24 | hashtable-size) 25 | (import (yuni compat hashtables))) 26 | -------------------------------------------------------------------------------- /lib/yuni/io/leb128.sls: -------------------------------------------------------------------------------- 1 | (library (yuni io leb128) 2 | (export 3 | ;; Unsigned 4 | leb128-put 5 | leb128-get) 6 | (import (yuni scheme)) 7 | 8 | ;; 9 | 10 | (define (leb128-put port i) 11 | (when (negative? i) 12 | (error "Negative number")) 13 | (unless (integer? i) 14 | (error "non-integer")) 15 | 16 | (let loop ((acc i)) 17 | (cond 18 | ((< acc 128) ;; Term 19 | (write-u8 acc port)) 20 | (else 21 | (let* ((d (exact (floor (/ acc 128)))) 22 | (r (- acc (* d 128)))) 23 | (write-u8 (+ r 128) port) 24 | (loop d)))))) 25 | 26 | (define (leb128-get port) 27 | (let loop ((acc 0) 28 | (mult 1) 29 | (b (read-u8 port))) 30 | (when (eof-object? b) 31 | (error "Premature end-of-file")) 32 | (cond 33 | ((< b 128) ;; Term 34 | (+ (* b mult) acc)) 35 | (else 36 | (loop (+ (* (- b 128) mult) acc) (* mult 128) (read-u8 port)))))) 37 | 38 | ) 39 | -------------------------------------------------------------------------------- /lib/yuni/minife/libprimitivehandler.sls: -------------------------------------------------------------------------------- 1 | (library (yuni minife libprimitivehandler) 2 | (export make-libprimitivehandler) 3 | (import (yuni scheme) 4 | (yuni minife interfacelib)) 5 | 6 | (define (make-libprimitivehandler) 7 | (lambda (op lib) 8 | (unless (eq? op 'lookup) 9 | (error "Unknown op" op)) 10 | (and (equal? '(r7c-expander-interface) lib) 11 | (cadr (interfacelib))))) 12 | 13 | ) 14 | -------------------------------------------------------------------------------- /lib/yuni/miniobj.sls: -------------------------------------------------------------------------------- 1 | (library (yuni miniobj) 2 | (export miniobj-ref 3 | miniobj-set! 4 | miniobj-typeof) 5 | (import (yuni scheme) 6 | (yuni miniobj rnrs) 7 | (yuni miniobj minitype) 8 | (yuni miniobj minidispatch) 9 | (yuni miniobj base)) 10 | 11 | (define-miniobj-typeof miniobj-typeof 12 | miniobj-minidispatch-typeof 13 | miniobj-minitype-typeof 14 | (lambda (_) #f)) 15 | 16 | (define-miniobj-ref miniobj-ref 17 | miniobj-minidispatch-ref 18 | miniobj-minitype-ref 19 | miniobj-rnrs-ref-error) 20 | 21 | (define-miniobj-set! miniobj-set! 22 | miniobj-minidispatch-set! 23 | miniobj-minitype-set! 24 | miniobj-rnrs-set!-error) 25 | 26 | ) 27 | -------------------------------------------------------------------------------- /lib/yuni/miniobj/base.sls: -------------------------------------------------------------------------------- 1 | (library (yuni miniobj base) 2 | (export define-miniobj-typeof define-miniobj-ref define-miniobj-set!) 3 | (import (yuni scheme)) 4 | 5 | (define-syntax define-miniobj-typeof 6 | (syntax-rules () 7 | ((_ name ref0 ref1 ... refnext term) 8 | (define-miniobj-typeof name ref0 ref1 ... (lambda (obj) (refnext obj term)))) 9 | ((_ name ref0 term) 10 | (define (name obj) (ref0 obj term))))) 11 | 12 | (define-syntax define-miniobj-ref 13 | (syntax-rules () 14 | ((_ name ref0 ref1 ... refnext term) 15 | (define-miniobj-ref name ref0 ref1 ... (lambda (obj slot) (refnext obj slot term)))) 16 | ((_ name ref0 term) 17 | (define (name obj slot) (ref0 obj slot term))))) 18 | 19 | (define-syntax define-miniobj-set! 20 | (syntax-rules () 21 | ((_ name set0 set1 ... setnext term) 22 | (define-miniobj-set! name set0 set1 ... (lambda (obj slot value) (setnext obj slot value term)))) 23 | ((_ name set0 term) 24 | (define (name obj slot value) (set0 obj slot value term))))) 25 | ) 26 | -------------------------------------------------------------------------------- /lib/yuni/miniobj/rnrs.sls: -------------------------------------------------------------------------------- 1 | (library (yuni miniobj rnrs) 2 | (export miniobj-rnrs-ref-error 3 | miniobj-rnrs-set!-error) 4 | (import (yuni scheme)) 5 | 6 | (define (miniobj-rnrs-ref-error obj slot) 7 | (error "miniobj: unsupported object" (list obj slot))) 8 | (define (miniobj-rnrs-set!-error obj slot value) 9 | (error "miniobj: unsupported object" (list obj slot value))) 10 | 11 | ) 12 | -------------------------------------------------------------------------------- /lib/yuni/serialize.sls: -------------------------------------------------------------------------------- 1 | (library (yuni serialize) 2 | (export 3 | put-object/serialize 4 | get-object/deserialize 5 | serialize-object 6 | deserialize-object) 7 | (import (yuni compat serialize))) 8 | -------------------------------------------------------------------------------- /lib/yuni/util/invalid-form.sls: -------------------------------------------------------------------------------- 1 | (library (yuni util invalid-form) 2 | (export define-invalid-form define-invalid-forms) 3 | (import (yuni scheme)) 4 | 5 | (define-syntax define-invalid-form 6 | (syntax-rules () 7 | ((_ sym) 8 | (define-syntax sym 9 | (syntax-rules () 10 | ((_) 11 | (syntax-error "Invalid form (for aux keyword)"))))))) 12 | 13 | (define-syntax define-invalid-forms 14 | (syntax-rules () 15 | ((_ sym) 16 | (define-invalid-form sym)) 17 | ((_ sym0 sym1 ...) 18 | (begin 19 | (define-invalid-form sym0) 20 | (define-invalid-forms sym1 ...))))) 21 | 22 | ) 23 | -------------------------------------------------------------------------------- /lib/yunife/core-transformers.sls: -------------------------------------------------------------------------------- 1 | (library (yunife core-transformers) 2 | (export 3 | ;; Macro 4 | define-syntax/macro 5 | ;let-syntax/macro 6 | ) 7 | (import (yuni scheme) 8 | (yunife runtime synrules) 9 | (yuniexternal chibi-scheme synrules)) 10 | 11 | ;; 12 | 13 | (define (define-syntax/macro name synrule) 14 | (let ((tran (yuni/syntax-rules-transformer 15 | synrule 16 | yuni/gensym (yuni/make-synrule-baselib) yuni/synrule-compare)) 17 | (args (yuni/gensym 'args)) 18 | (a (yuni/gensym 'output))) 19 | `(define-macro (,name . ,args) 20 | (let ((,a (,tran (cons (quote ,name) ,args) 21 | yuni/gensym 22 | (yuni/make-synrule-baselib) yuni/synrule-compare))) 23 | ;(display (list 'OUT: ,a)) 24 | ;(newline) 25 | ,a)))) 26 | 27 | ) 28 | -------------------------------------------------------------------------------- /lib/yunife/debugging.sls: -------------------------------------------------------------------------------- 1 | (library (yunife debugging) 2 | (export PCK) 3 | (import (yuni scheme)) 4 | 5 | (define ERRPORT current-error-port) 6 | (define (PCK . obj) 7 | (if #t ;; %verbose 8 | (begin 9 | (if #t ;; (not DEBUGGING) 10 | (begin 11 | (display "-> " (ERRPORT)) 12 | (for-each (lambda (e) 13 | (write e (ERRPORT)) 14 | (display " " (ERRPORT))) 15 | obj) 16 | (newline (ERRPORT))))))) 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /lib/yunife/sourcereader.sls: -------------------------------------------------------------------------------- 1 | (library (yunife sourcereader) 2 | (export read-source) 3 | (import (yuni scheme)) 4 | 5 | ;; 6 | 7 | (define (read-source pth) 8 | (call-with-input-file 9 | pth 10 | (lambda (p) 11 | (define (itr cur) 12 | (let ((r (read p))) 13 | (if (eof-object? r) 14 | (reverse cur) 15 | (itr (cons r cur))))) 16 | (itr '())))) 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /lib/yunivm/expander/expandcore.sls: -------------------------------------------------------------------------------- 1 | (library (yunivm expander expandcore) 2 | (export 3 | get-core-library0 4 | expand0) 5 | (import (yuni scheme) 6 | (yuniexternal alexpander)) 7 | 8 | (define (get-core-library0) (yuniexternal-alexpander-get-init)) 9 | 10 | (define (expand0 frm) 11 | (let ((myenv (yuniexternal-alexpander-newenv))) 12 | (yuniexternal-alexpander-expand-top-level-forms! 13 | frm 14 | myenv))) 15 | 16 | ) 17 | -------------------------------------------------------------------------------- /lib/yunivmrt/keywords.sls: -------------------------------------------------------------------------------- 1 | (library (yunivmrt keywords) 2 | (export define-keywords 3 | define-syntax-rules/keywords) 4 | (import (yunifake scheme)) 5 | 6 | (define-syntax define-syntax-rules/keywords 7 | (syntax-rules () 8 | ((_ nam (symlit ...) (keylit ...) clauses ...) 9 | (define-syntax nam 10 | (syntax-rules (symlit ... keylit ...) 11 | clauses ...))))) 12 | 13 | (define-syntax define-keywords 14 | (syntax-rules () 15 | ((_ key ...) 16 | (begin 'do-nothing-define-keywords)))) 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /lib/yunivmrt/yunicore-proc.sls: -------------------------------------------------------------------------------- 1 | (library (yunivmrt yunicore-proc) 2 | (export 3 | make-simple-struct 4 | simple-struct? 5 | simple-struct-ref 6 | simple-struct-set! 7 | simple-struct-name 8 | %%yunifake-dummy-syntax-yunicore-procs 9 | ) 10 | (import (r7c-yunicore simple-struct)) 11 | 12 | ;; Mark explicitly as a macro-library 13 | (define-syntax-names/yunifake %%yunifake-dummy-syntax-yunicore-procs) 14 | ) 15 | -------------------------------------------------------------------------------- /samples/helloffi/app.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yuni compat bitwise primitives) ;; bv- 3 | (yuni compat ffi primitives) ;; yuniffi-nccc-call 4 | (yunistub helloffi_stub-constants)) 5 | 6 | (define (forward0stub obj) 7 | (let ((x (assq 'forward-0 obj))) 8 | (and x 9 | (cdr x)))) 10 | 11 | (define (call2 proc arg1 arg2) 12 | ;; Generate call packet 13 | (define in (make-bytevector (* 8 2) 0)) 14 | (define out (make-bytevector 8 0)) 15 | (bv-write/u64! in 0 arg1) 16 | (bv-write/s64! in 8 arg2) 17 | 18 | (yuniffi-nccc-call proc in 0 2 out 0 1) 19 | 20 | (bv-read/s64 out 0)) 21 | 22 | (call2 (forward0stub testfunc) 1234 -1234) 23 | 24 | (close-port (current-output-port)) 25 | -------------------------------------------------------------------------------- /samples/helloffi/helloffi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "helloffi.h" 3 | 4 | int 5 | testfunc(int arg1, int arg2){ 6 | printf("Hello. arg1 = %d, arg2 = %d\n", 7 | arg1, arg2); 8 | } 9 | -------------------------------------------------------------------------------- /samples/helloffi/helloffi.h: -------------------------------------------------------------------------------- 1 | #ifndef __HELLOFFI_H 2 | #define __HELLOFFI_H 3 | 4 | int testfunc(int arg1, int arg2); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /samples/helloffi/helloffi_stub.scm: -------------------------------------------------------------------------------- 1 | (stubir0 2 | helloffi_stub 3 | (config 4 | (stubs (c "helloffi.stub.c"))) 5 | 6 | (prologue 7 | (cpp-include "helloffi.h")) 8 | 9 | (types) 10 | (layouts) 11 | (exports) 12 | (functions 13 | (int testfunc ((int arg1) (int arg2))))) 14 | -------------------------------------------------------------------------------- /samples/hellolib/A.sls: -------------------------------------------------------------------------------- 1 | (library (A) 2 | (export A stxA) 3 | (import (yuni scheme)) 4 | 5 | (define-syntax stxA 6 | (syntax-rules () 7 | ((_ sym) 8 | (begin 9 | (display "stxA: Symbol ") 10 | (display 'sym) 11 | (display " value is: ") 12 | (write sym) 13 | (display "\n"))))) 14 | 15 | (define (test) 16 | (display "This is `test` in library (A)\n") 17 | 'A) 18 | 19 | (define (A) 20 | (let ((a (test))) 21 | (unless (eq? 'A a) 22 | (error "something wrong (A)")))) 23 | 24 | 25 | ) 26 | -------------------------------------------------------------------------------- /samples/hellolib/B.sls: -------------------------------------------------------------------------------- 1 | (library (B) 2 | (export B) 3 | (import (yuni scheme)) 4 | 5 | #| 6 | ;; On Generic Scheme implementations, 7 | ;; un-commenting following `stxB` definition 8 | ;; will break (test) definition, because 9 | ;; yuni runtime will "promote" every globals 10 | ;; on these impementations. 11 | ;; 12 | (define-syntax stxB 13 | (syntax-rules () 14 | ((_ sym) 15 | (begin 16 | (display "stxB: Symbol ") 17 | (display 'sym) 18 | (display " value is: ") 19 | (write sym) 20 | (display "\n"))))) 21 | |# 22 | 23 | (define (test) 24 | (display "This is `test` in library (B)\n") 25 | 'B) 26 | 27 | (define (B) 28 | (let ((a (test))) 29 | (unless (eq? 'B a) 30 | (error "something wrong (B)")))) 31 | 32 | ) 33 | -------------------------------------------------------------------------------- /samples/hellolib/app.sps: -------------------------------------------------------------------------------- 1 | (import (A) 2 | (sub A) 3 | (B) 4 | (yuni scheme)) 5 | 6 | (define v 10) 7 | 8 | (A) 9 | 10 | (stxA v) 11 | 12 | (sub-A) 13 | 14 | (B) 15 | -------------------------------------------------------------------------------- /samples/hellolib/sub/A.sls: -------------------------------------------------------------------------------- 1 | (library (sub A) 2 | (export sub-A) 3 | (import (yuni scheme)) 4 | 5 | (define (test) 6 | (display "This is `test` in library (sub A)\n") 7 | 'sub-A) 8 | 9 | (define (sub-A) 10 | (let ((a (test))) 11 | (unless (eq? 'sub-A a) 12 | (error "something wrong (sub A)")))) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /scripts/nmosh/rip-cprocs.sps: -------------------------------------------------------------------------------- 1 | (import (rnrs) (match) (yuni util files)) 2 | #| 3 | (import (yuni scheme) 4 | (yuni util files) 5 | (yuni base match)) 6 | |# 7 | 8 | (define CPROCS-FILE "../../../mosh/boot/free-vars.scm") 9 | (define cprocs (cdar (file->sexp-list CPROCS-FILE))) 10 | 11 | (define names '()) 12 | 13 | (define (proc e) 14 | (match e 15 | ((name . bogus) 16 | (set! names (cons name names))) 17 | (name 18 | (set! names (cons name names))))) 19 | 20 | (for-each proc cprocs) 21 | 22 | (for-each (lambda (e) (display e)(newline)) names) 23 | (newline) 24 | -------------------------------------------------------------------------------- /scripts/nmosh/rip-global-defs.sps: -------------------------------------------------------------------------------- 1 | (import (rnrs) (match) (yuni util files)) 2 | #| 3 | (import (yuni scheme) 4 | (yuni util files) 5 | (yuni base match)) 6 | |# 7 | 8 | (define BASELIB-FILE "../../../mosh/boot/baselib.scm") 9 | (define baselib (file->sexp-list BASELIB-FILE)) 10 | 11 | (define names '()) 12 | 13 | (define (proc e) 14 | (match e 15 | (('define (name . bogus1) . bogus2) 16 | (set! names (cons name names))) 17 | (('define name . bogus) 18 | (set! names (cons name names))) 19 | (else 'do-nothing))) 20 | 21 | (for-each proc baselib) 22 | 23 | (for-each (lambda (e) (display e)(newline)) names) 24 | (newline) 25 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | Tests 2 | ===== 3 | 4 | This directory contains test codes. 5 | 6 | 7 | License 8 | ------- 9 | 10 | Several test codes imported from other projects. 11 | 12 | -------------------------------------------------------------------------------- /tests/app/TestRunner.cmake: -------------------------------------------------------------------------------- 1 | # YuniApp test runner 2 | # 3 | # INPUT: 4 | # GEN: gen 5 | # RUN: run 6 | # APPDIR: appdir 7 | # WORKDIR: workdir 8 | # SH: /bin/sh if required 9 | 10 | execute_process( 11 | COMMAND ${GEN} ${APPDIR} 12 | WORKING_DIRECTORY ${WORKDIR} 13 | RESULT_VARIABLE rr) 14 | 15 | if(rr) 16 | message(FATAL_ERROR "Failed to generate ${APPDIR} (${GEN})") 17 | endif() 18 | 19 | execute_process( 20 | COMMAND ${SH} ${RUN} 21 | WORKING_DIRECTORY ${WORKDIR} 22 | RESULT_VARIABLE rr) 23 | 24 | if(rr) 25 | message(FATAL_ERROR "Failed to run ${APPDIR} (${RUN})") 26 | endif() 27 | 28 | -------------------------------------------------------------------------------- /tests/app/basic/B.sls: -------------------------------------------------------------------------------- 1 | (library (B) 2 | (export B) 3 | (import (yuni scheme)) 4 | 5 | #| 6 | ;; On Generic Scheme implementations, 7 | ;; un-commenting following `stxB` definition 8 | ;; will break (test) definition, because 9 | ;; yuni runtime will "promote" every globals 10 | ;; on these impementations. 11 | ;; 12 | (define-syntax stxB 13 | (syntax-rules () 14 | ((_ sym) 15 | (begin 16 | (display "stxB: Symbol ") 17 | (display 'sym) 18 | (display " value is: ") 19 | (write sym) 20 | (display "\n"))))) 21 | |# 22 | 23 | (define (test) 24 | (display "This is `test` in library (B)\n") 25 | 'B) 26 | 27 | (define (B) 28 | (let ((a (test))) 29 | (unless (eq? 'B a) 30 | (error "something wrong (B)")))) 31 | 32 | ) 33 | -------------------------------------------------------------------------------- /tests/app/basic/app.sps: -------------------------------------------------------------------------------- 1 | (import (A) 2 | (sub A) 3 | (B) 4 | (yuni scheme) 5 | (yunitest mini)) 6 | 7 | (define v 10) 8 | 9 | (A) 10 | 11 | (stxA v) 12 | 13 | (sub-A) 14 | 15 | (B) 16 | 17 | (check-finish) 18 | -------------------------------------------------------------------------------- /tests/app/basic/sub/A.sls: -------------------------------------------------------------------------------- 1 | (library (sub A) 2 | (export sub-A) 3 | (import (yuni scheme)) 4 | 5 | (define (test) 6 | (display "This is `test` in library (sub A)\n") 7 | 'sub-A) 8 | 9 | (define (sub-A) 10 | (let ((a (test))) 11 | (unless (eq? 'sub-A a) 12 | (error "something wrong (sub A)")))) 13 | 14 | ) 15 | -------------------------------------------------------------------------------- /tests/app/ffitrivial/stub/testing.h: -------------------------------------------------------------------------------- 1 | /* test code */ 2 | 3 | #ifndef MUST_BE_DEFINED 4 | #error bailout 5 | #endif 6 | 7 | #ifndef MUST_BE_DEFINED2 8 | #error bailout 9 | #endif 10 | 11 | #ifndef MUST_BE_DEFINED3 12 | #error bailout 13 | #endif 14 | 15 | #ifndef MUST_BE_DEFINED4 16 | #error bailout 17 | #endif 18 | 19 | #ifndef MUST_BE_DEFINED5 20 | #error bailout 21 | #endif 22 | 23 | #ifndef MUST_BE_DEFINED6 24 | #error bailout 25 | #endif 26 | 27 | #ifdef MUST_NOT_BE_DEFINED 28 | #error bailout 29 | #endif 30 | 31 | #ifdef MUST_NOT_BE_DEFINED2 32 | #error bailout 33 | #endif 34 | 35 | 36 | #define TESTING_H_INCLUDED 37 | -------------------------------------------------------------------------------- /tests/app/ffitrivial/stub/unnamed.scm: -------------------------------------------------------------------------------- 1 | (stubir0 2 | unnamed 3 | (config 4 | (stubs (c "unnamed.stub.c"))) 5 | (prologue) 6 | (types 7 | (integer hoge_e c-enum) 8 | (blob hoge_s c-struct) 9 | (blob hoge_t) 10 | (enum-group hoge_e 11 | (members E_A E_B))) 12 | (layouts 13 | (aggregate hoge_s 14 | (int m_a) 15 | (char m_b) 16 | (hoge_e m_c array) 17 | (aggregate m_d 18 | (char mm_a) 19 | (int mm_b)))) 20 | (exports 21 | (int D macro))) 22 | 23 | -------------------------------------------------------------------------------- /tests/app/hello/app.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (sub hello)) 3 | 4 | (let ((h (subhello))) 5 | (unless h 6 | (error "Unexpected.")) 7 | ;; For Vicare 8 | (close-port (current-output-port)) 9 | (exit)) 10 | 11 | -------------------------------------------------------------------------------- /tests/app/hello/yunilib/sub/hello.sls: -------------------------------------------------------------------------------- 1 | (library (sub hello) 2 | (export subhello) 3 | (import (yuni scheme)) 4 | 5 | (define (subhello) 6 | (display "Hello (sub)\n") 7 | #t) 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /tests/err/fail0.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (exit 1) 4 | -------------------------------------------------------------------------------- /tests/err/fail1.sps: -------------------------------------------------------------------------------- 1 | (import (NEVERLAND)) 2 | 3 | (exit 0) 4 | -------------------------------------------------------------------------------- /tests/err/fail2.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (exit #f) 4 | -------------------------------------------------------------------------------- /tests/err/fail3.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (car #f) 4 | -------------------------------------------------------------------------------- /tests/err/fail4.sps: -------------------------------------------------------------------------------- 1 | (import (yuni 2 | 3 | -------------------------------------------------------------------------------- /tests/err/fail5.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (error "Some error") 4 | -------------------------------------------------------------------------------- /tests/err/fail6.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (error "Some error" "with arguments") 4 | -------------------------------------------------------------------------------- /tests/err/fail7.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (check-equal #t #f) 5 | 6 | (check-finish) 7 | -------------------------------------------------------------------------------- /tests/err/fail8.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (raise "uncaught exception") 4 | -------------------------------------------------------------------------------- /tests/lib/ident0.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini) 3 | (yuni compat ident)) 4 | 5 | (define (getname) 6 | (let loop ((l (command-line))) 7 | (and (pair? l) 8 | (if (string=? "-IMPLNAME" (car l)) 9 | (cadr l) 10 | (loop (cdr l)))))) 11 | 12 | (check-equal (ident-impl) (string->symbol (getname))) 13 | 14 | (check-finish) 15 | -------------------------------------------------------------------------------- /tests/lib/minitest0.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (check-equal #t #t) 5 | (check-equal #f #f) 6 | (check-equal 1234 1234) 7 | (check-equal (bytevector 0 1 2 3) (bytevector 0 1 2 3)) 8 | (check-equal #\newline #\newline) 9 | (check-equal (eof-object) (eof-object)) 10 | (let ((a (lambda () 'ok))) 11 | (check-equal a a)) 12 | (check-equal 'symbol (string->symbol "symbol")) 13 | (check-equal "symbol" (symbol->string 'symbol)) 14 | (check-equal "abc" (list->string (list #\a #\b #\c))) 15 | (check-equal #\\ #\\) 16 | 17 | (check-finish) 18 | -------------------------------------------------------------------------------- /tests/newboot/testarg0.sps: -------------------------------------------------------------------------------- 1 | ;; Run me with "SPLITHERE" arg 2 | (import (yuni scheme) 3 | (yunitest mini)) 4 | 5 | (define cmd (command-line)) 6 | 7 | (check-equal #t (and (member "SPLITHERE" cmd) #t)) 8 | 9 | (check-finish) 10 | 11 | -------------------------------------------------------------------------------- /tests/newboot/testarg1.sps: -------------------------------------------------------------------------------- 1 | ;; Run me with "SPLITHERE" "a" "1" "c" arg 2 | (import (yuni scheme) 3 | (yunitest mini)) 4 | 5 | (define cmd (command-line)) 6 | 7 | (check-equal '("SPLITHERE" "a" "1" "c") (member "SPLITHERE" cmd)) 8 | 9 | (check-finish) 10 | 11 | -------------------------------------------------------------------------------- /tests/scheme/core2.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | ;; lists 5 | 6 | ;; list-copy (non-pair) 7 | (check-equal 'a (list-copy 'a)) 8 | (check-equal '() (list-copy '())) 9 | (check-equal '(10 . 20) (list-copy '(10 . 20))) 10 | 11 | (check-finish) 12 | -------------------------------------------------------------------------------- /tests/scheme/exact0.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (check-equal 1 (* 1 1)) 5 | (check-equal 4 (- 5 1)) 6 | 7 | (check-equal #t (= 0 0)) 8 | (check-equal #t (= 123 123)) 9 | (check-equal #t (< 1 2)) 10 | (check-equal #f (> 1 2)) 11 | (check-equal #f (>= 1 2)) 12 | (check-equal #f (> 3 3)) 13 | (check-equal #f (< 3 3)) 14 | (check-equal #t (>= 3 3)) 15 | (check-equal #t (<= 3 3)) 16 | 17 | (check-equal 1 (+ 1)) 18 | (check-equal 3 (+ 1 1 1)) 19 | (check-equal 0 (+)) 20 | (check-equal 1 (*)) 21 | (check-equal 0 (* 1 123 0)) 22 | 23 | (check-finish) 24 | -------------------------------------------------------------------------------- /tests/scheme/exp2.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | ; Guile and MIT/GNU Scheme does not follow dynamic-scoping rule 5 | 6 | (define p0 (make-parameter 0)) 7 | 8 | (check-equal 'done4 9 | (parameterize 10 | ((p0 1)) 11 | (check-equal 1 (p0)) 12 | (guard 13 | (cnd (#t 14 | (check-equal 1 (p0)) 15 | 'done4)) 16 | (check-equal 1 (p0)) 17 | (parameterize 18 | ((p0 2)) 19 | (check-equal 2 (p0)) 20 | (raise 'bogus))))) 21 | 22 | (check-finish) 23 | -------------------------------------------------------------------------------- /tests/scheme/inexact2.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (define-syntax check-eps 5 | (syntax-rules () 6 | ((_ obj form) 7 | (begin 8 | ;(display (list 'obj 'form)) (newline) 9 | (let ((e form)) 10 | (cond ((let* ((diff (- obj e)) 11 | (rate 12 | (cond 13 | ((> 0.000001 (abs diff)) diff) 14 | (else (inexact (/ (abs diff) (abs obj))))))) 15 | ;; Match epsilon and sign 16 | (and (> 0.0001 rate) 17 | (if (negative? obj) 18 | (negative? e) 19 | #t))) 20 | (check-equal #t #t)) 21 | (else 22 | (check-equal #t 'form)))))))) 23 | 24 | (unless (eqv? 0.0 -0.0) 25 | (check-eps 3.14159265358979 (atan 0.0 -1.0)) 26 | (check-eps -3.14159265358979 (atan -0.0 -1.0))) 27 | 28 | (check-finish) 29 | -------------------------------------------------------------------------------- /tests/scheme/inexact3.sps: -------------------------------------------------------------------------------- 1 | ;; Negative zero and arithmetics 2 | 3 | (import (yuni scheme) 4 | (yunitest mini)) 5 | 6 | (define (signbit x) 7 | ;; FIXME: This doesn't work on SCM (SIBR0013) 8 | (char=? #\- 9 | (string-ref (number->string x) 0))) 10 | 11 | (check-equal #t (= 0.0 (abs -0.0))) 12 | (check-equal #f (signbit (abs -0.0))) 13 | (check-equal #t (signbit (atan -0.0 1.0))) 14 | 15 | (check-finish) 16 | -------------------------------------------------------------------------------- /tests/scheme/qq1.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | ;; R7RS 5 | (define (sqrt0 x) 6 | (case x 7 | ((4) 2) 8 | ((9) 3) 9 | ((16) 4) 10 | (else #f))) 11 | 12 | (check-equal '#(10 5 2 4 3 8) `#(10 5 ,(sqrt0 4) ,@(map sqrt0 '(16 9)) 8)) ;; S7 13 | 14 | (check-finish) 15 | -------------------------------------------------------------------------------- /tests/scheme/stx0.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (define ax 0) 5 | 6 | ;; NMosh scoping issue: https://github.com/okuoku/yuni/issues/83 7 | (begin 8 | (let ((ax 0)) 9 | (set! ax 1) 10 | (check-equal ax 1)) 11 | (check-equal ax 0)) 12 | 13 | (let ((ay 0)) 14 | (let ((ay 0)) 15 | (define ay 1) 16 | (set! ay 1) 17 | (check-equal ay 1)) 18 | (check-equal ay 0)) 19 | 20 | (check-finish) 21 | -------------------------------------------------------------------------------- /tests/scheme/synrule0.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (define-syntax chk 5 | (syntax-rules () 6 | ((_ nam val) 7 | (begin 8 | ;; `tmp` should be renamed 9 | (define tmp val) 10 | (define (nam) tmp))))) 11 | 12 | (chk a 10) 13 | (chk b 20) 14 | 15 | (check-equal (a) 10) 16 | (check-equal (b) 20) 17 | 18 | (check-finish) 19 | -------------------------------------------------------------------------------- /tests/scheme/synrule1.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini)) 3 | 4 | (define-syntax chk0 5 | (syntax-rules () 6 | ((_ nam val) 7 | (begin 8 | (define nam val))))) 9 | 10 | (define-syntax chk1 11 | (syntax-rules () 12 | ((_ nam val) 13 | (define nam val)))) 14 | 15 | (chk0 a 10) 16 | (chk1 b 20) 17 | 18 | (check-equal a 10) 19 | (check-equal b 20) 20 | 21 | (let ((a 30)) 22 | (let () 23 | (chk0 a 40) 24 | (check-equal a 40)) 25 | (check-equal a 30)) 26 | 27 | (check-finish) 28 | -------------------------------------------------------------------------------- /tests/scheme/values0.sps: -------------------------------------------------------------------------------- 1 | ;; values 2 | (import (yuni scheme) 3 | (yunitest mini)) 4 | 5 | ;; 1 values, 1 arity 6 | (call-with-values (lambda () (values 'ok)) 7 | (lambda (check) 8 | (check-equal check 'ok))) 9 | 10 | ;; 1 values, N arity 11 | (call-with-values (lambda () (values 'ok)) 12 | (lambda x 13 | (check-equal '(ok) x))) 14 | 15 | ;; 2 values, 1.N arity 16 | (call-with-values (lambda () (values 'ok 'ok)) 17 | (lambda (a . b) 18 | (check-equal 'ok a) 19 | (check-equal '(ok) b))) 20 | 21 | 22 | 23 | (check-finish) 24 | -------------------------------------------------------------------------------- /tests/scheme/values1.sps: -------------------------------------------------------------------------------- 1 | ;; let-values 2 | 3 | (import (yuni scheme) 4 | (yunitest mini)) 5 | 6 | (define term0 'fail) 7 | (let-values () 8 | (set! term0 'ok)) 9 | 10 | (check-equal term0 'ok) 11 | 12 | (let-values (((a) 'ok) 13 | ((b) 'ok2)) 14 | (check-equal a 'ok) 15 | (check-equal b 'ok2)) 16 | 17 | (define (v2) (values 'ok0 'ok3)) 18 | 19 | (let-values (((a b) (v2))) 20 | (check-equal a 'ok0) 21 | (check-equal b 'ok3)) 22 | 23 | (check-finish) 24 | -------------------------------------------------------------------------------- /tests/scheme/values2.sps: -------------------------------------------------------------------------------- 1 | ;; zero values 2 | (import (yuni scheme) 3 | (yunitest mini)) 4 | 5 | ;; 0 values, 0 arity 6 | (define term0 'fail) 7 | (call-with-values (lambda () (values)) 8 | (lambda () 9 | (set! term0 'ok))) 10 | (check-equal term0 'ok) 11 | 12 | ;; 0 values, N arity 13 | (call-with-values (lambda () (values)) 14 | (lambda x 15 | (check-equal 0 (length x)))) 16 | 17 | (check-finish) 18 | -------------------------------------------------------------------------------- /tests/scheme/values3.sps: -------------------------------------------------------------------------------- 1 | ;; non-values object 2 | (import (yuni scheme) 3 | (yunitest mini)) 4 | 5 | (call-with-values 6 | (lambda () 1) 7 | (lambda a (check-equal a '(1)))) 8 | 9 | (check-finish) 10 | -------------------------------------------------------------------------------- /tests/sibr/err-sibr0012string.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (read-string 0 (open-input-string "")) 4 | -------------------------------------------------------------------------------- /tests/sibr/err-sibr0014.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (call-with-values 4 | (lambda () (values)) 5 | (lambda () 'bogus)) 6 | -------------------------------------------------------------------------------- /tests/sibr/sibr0010string.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini) 3 | (yuni compat ident)) 4 | 5 | (define (expected-result) 6 | (case (ident-impl) 7 | ((digamma chez racket s7) 8 | #t) 9 | (else 10 | #f))) 11 | 12 | (define a (make-string 0)) 13 | (define b (make-string 0)) 14 | 15 | (check-equal (expected-result) (eq? a b)) 16 | 17 | (check-finish) 18 | -------------------------------------------------------------------------------- /tests/sibr/sibr0010vector.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yunitest mini) 3 | (yuni compat ident)) 4 | 5 | (define (expected-result) 6 | (case (ident-impl) 7 | ((digamma chez chibi-scheme racket) 8 | #t) 9 | (else 10 | #f))) 11 | 12 | (define a (make-vector 0)) 13 | (define b (make-vector 0)) 14 | 15 | (check-equal (expected-result) (eq? a b)) 16 | 17 | (check-finish) 18 | -------------------------------------------------------------------------------- /tests/sibr/sibr0011.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yuni compat ident) 3 | (yunitest mini)) 4 | 5 | (define (expected-result) 6 | (case (ident-impl) 7 | ((racket ironscheme) #f) 8 | (else #t))) 9 | 10 | (check-equal (expected-result) (file-exists? ".")) 11 | 12 | (check-finish) 13 | -------------------------------------------------------------------------------- /tests/sibr/sibr0012gen.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yuni compat ident) 3 | (yunitest mini)) 4 | 5 | (define (str-nonterm) 6 | (case (ident-impl) 7 | ((gambit foment) #t) 8 | (else #f))) 9 | 10 | (define (str-term) 11 | (case (ident-impl) 12 | ((gambit cyclone foment ribbon) #t) 13 | (else #f))) 14 | 15 | (define (checkans s) 16 | (cond 17 | ((and (string? s) (string=? s "")) 18 | #f) 19 | ((eof-object? s) 20 | #t) 21 | (else "Unexpected response!"))) 22 | 23 | (check-equal (str-nonterm) 24 | (checkans 25 | (let ((p (open-input-string "xxxx"))) 26 | (read-string 0 p)))) 27 | 28 | (check-equal (str-term) 29 | (checkans 30 | (let ((p (open-input-string ""))) 31 | (read-string 0 p)))) 32 | 33 | (check-finish) 34 | -------------------------------------------------------------------------------- /tests/sibr/sibr0014.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yuni compat ident) 3 | (yunitest mini)) 4 | 5 | (define (expected-result) 6 | (case (ident-impl) 7 | ((s7) 1) 8 | (else 0))) 9 | 10 | (call-with-values 11 | (lambda () (values)) 12 | (lambda a (check-equal (length a) (expected-result)))) 13 | 14 | (check-finish) 15 | -------------------------------------------------------------------------------- /tests/yunibase/_fileops.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme) 2 | (yuni util files) 3 | (yuni compat ident)) 4 | 5 | (define myname (symbol->string (ident-impl))) 6 | 7 | (when (file-exists? myname) 8 | (error "File exists...")) 9 | 10 | (create-directory myname) 11 | 12 | (unless (or (eq? (ident-impl) 'ironscheme) 13 | (eq? (ident-impl) 'kawa) 14 | (file-directory? myname)) 15 | (error "Not a directory")) 16 | 17 | (delete-directory myname) 18 | 19 | (when (file-exists? myname) 20 | (error "File exists...")) 21 | -------------------------------------------------------------------------------- /tests/yunibase/_negative.sps: -------------------------------------------------------------------------------- 1 | (import (yuni scheme)) 2 | 3 | (error "Wow. It's an error. (expected, just for test)") 4 | -------------------------------------------------------------------------------- /tests/yunibase/_negative2.txt: -------------------------------------------------------------------------------- 1 | hoge( 2 | -------------------------------------------------------------------------------- /tests/yunibase/negative.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # negative test stub 3 | # 4 | # INPUTs: 5 | # 6 | # PROG: Full path to program 7 | # ARG: Argument (single) 8 | 9 | if(NOT PROG) 10 | message(FATAL_ERROR "Oh.") 11 | endif() 12 | 13 | execute_process( 14 | COMMAND ${PROG} ${ARG} 15 | RESULT_VARIABLE rr) 16 | 17 | if(rr) 18 | message(STATUS "OK: ${rr}") 19 | else() 20 | message(FATAL_ERROR "Unexpected: ${rr}") 21 | endif() 22 | 23 | -------------------------------------------------------------------------------- /tests/yunibase/runwithcleandir.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Run test with clean directory 3 | # 4 | # INPUTs: 5 | # 6 | # PROG: Full path to program 7 | # DIRNAME: Directory name 8 | # ARG: Argument (single) 9 | # LAUNCH: Launch script for yunivm 10 | # SCRIPT: Script for yunivm 11 | 12 | if(NOT PROG) 13 | message(FATAL_ERROR "Oh.") 14 | endif() 15 | 16 | if(NOT DIRNAME) 17 | message(FATAL_ERROR "Oh.") 18 | endif() 19 | 20 | if(EXISTS ${DIRNAME}) 21 | if(NOT IS_DIRECTORY ${DIRNAME}) 22 | message(FATAL_ERROR "Why?") 23 | endif() 24 | endif() 25 | 26 | file(REMOVE_RECURSE ${DIRNAME}) 27 | 28 | file(MAKE_DIRECTORY ${DIRNAME}) 29 | 30 | if(LAUNCH) 31 | execute_process( 32 | COMMAND ${PROG} ${LAUNCH} -PROG ${SCRIPT} ${ARG} 33 | RESULT_VARIABLE rr 34 | WORKING_DIRECTORY ${DIRNAME}) 35 | else() 36 | execute_process( 37 | COMMAND ${PROG} ${ARG} 38 | RESULT_VARIABLE rr 39 | WORKING_DIRECTORY ${DIRNAME}) 40 | endif() 41 | 42 | if(rr) 43 | message(FATAL_ERROR "Unexpected: ${rr}") 44 | endif() 45 | 46 | -------------------------------------------------------------------------------- /tests/yunistub/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(primitives) 2 | add_subdirectory(trivial) 3 | -------------------------------------------------------------------------------- /tests/yunistub/primitives/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(yunistub_test_primitives 2 | MODULE 3 | primitives.c) 4 | -------------------------------------------------------------------------------- /tests/yunistub/primitives/primitives.c: -------------------------------------------------------------------------------- 1 | /* Primitives test */ 2 | 3 | #include 4 | #include 5 | 6 | #if defined(_WIN32)||defined(__CYGWIN__) 7 | #define EXPORT __declspec(dllexport) 8 | #else 9 | #define EXPORT 10 | #endif 11 | 12 | EXPORT 13 | void 14 | test0_print_and_fill(uint64_t* in, int in_len, uint64_t* out, int out_len){ 15 | int i; 16 | printf("test0_print_and_fill: in:%p in_len:%d out:%p out_len: %d\n", 17 | in,in_len,out,out_len); 18 | for(i = 0;i != in_len;i++){ 19 | printf("in[%d] = %ld\n",i,in[i]); 20 | } 21 | for(i = 0; i != out_len; i++){ 22 | out[i] = i+1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/yunistub/trivial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Prefer CXX version 2 | 3 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 4 | 5 | gen_yuniffi_stub(stub_yunistub_testing_trivial 6 | ${CMAKE_CURRENT_LIST_DIR}/testing_trivial.scm 7 | testing.stub.cpp testing.stub.c) 8 | 9 | add_library(yunistub_testing_trivial MODULE 10 | ${CMAKE_CURRENT_BINARY_DIR}/testing.stub.cpp 11 | testfunc.c 12 | testing.h 13 | testinterface.h) 14 | 15 | add_library(yunistub_testing_trivial_plainc MODULE 16 | ${CMAKE_CURRENT_BINARY_DIR}/testing.stub.c 17 | testfunc.c 18 | testing.h 19 | testinterface.h) 20 | 21 | -------------------------------------------------------------------------------- /tests/yunistub/trivial/dummy.cpp: -------------------------------------------------------------------------------- 1 | #if 1 2 | 3 | #include /* For NULL */ 4 | #define TESTING_H_INCLUDED /* Fake */ 5 | #include "testinterface.h" 6 | 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /tests/yunistub/trivial/stdlibc_core.scm: -------------------------------------------------------------------------------- 1 | (stubir0 2 | stdlibc_core 3 | 4 | ;; No import 5 | ;; No prologue 6 | (types 7 | (integer char) 8 | (integer int) 9 | (integer long) 10 | (integer short) 11 | (real float) 12 | (real double)) 13 | 14 | ;; No layouts 15 | ;; No functions 16 | ) 17 | -------------------------------------------------------------------------------- /tests/yunistub/trivial/testhand.c: -------------------------------------------------------------------------------- 1 | #include "hand.inc.c" 2 | -------------------------------------------------------------------------------- /tests/yunistub/trivial/testhand.cpp: -------------------------------------------------------------------------------- 1 | #include "hand.inc.c" 2 | -------------------------------------------------------------------------------- /yuniruntime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Always perform copy on MSBuild... 2 | # We have no way to avoid BYPRODUCTS here. 3 | 4 | set(runtimefiles) 5 | 6 | function(installdep f) 7 | set(out ${YUNIBASE_YUNIFIED_PATH}/loader/${f}) 8 | add_custom_command(OUTPUT ${out} 9 | COMMAND ${CMAKE_COMMAND} -E copy_if_different 10 | ${CMAKE_CURRENT_LIST_DIR}/${f} 11 | ${out} 12 | COMMENT "Copy ${f} to runtime path" 13 | DEPENDS ${f}) 14 | list(APPEND runtimefiles ${out}) 15 | set(runtimefiles ${runtimefiles} PARENT_SCOPE) 16 | endfunction() 17 | 18 | set(deps 19 | generate.sps 20 | yuniffistub.sps) 21 | 22 | foreach(e ${deps}) 23 | installdep(${e}) 24 | endforeach() 25 | 26 | add_custom_target(yuniruntime-copy 27 | COMMENT "Copying runtime files (yuniruntime)" 28 | DEPENDS ${runtimefiles}) 29 | -------------------------------------------------------------------------------- /yuniruntime/generate.sps: -------------------------------------------------------------------------------- 1 | (import (yuniapp phase generate)) 2 | 3 | (generate-app-cmd) 4 | -------------------------------------------------------------------------------- /yuniruntime/yuniffistub.sps: -------------------------------------------------------------------------------- 1 | (import (yuniapp phase yuniffistub)) 2 | 3 | (yuniffistub-app-cmd) 4 | -------------------------------------------------------------------------------- /yunistub/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(chibi-scheme) 2 | add_subdirectory(gauche) 3 | add_subdirectory(chicken) 4 | add_subdirectory(gambit) 5 | # Currently, picrin cannot be built here. 6 | 7 | # Headers 8 | install(DIRECTORY include 9 | DESTINATION ${YUNISDK_ROOT}) 10 | -------------------------------------------------------------------------------- /yunistub/chibi-scheme/README.md: -------------------------------------------------------------------------------- 1 | yuniFFI module for chibi-scheme 2 | =============================== 3 | 4 | Compile with 5 | 6 | chibi-ffi yuniffi.stub.c 7 | cc -L/usr/local/bin -shared yuniffi.stub.c yuniffi_stub.c -lchibi-scheme -o chibi-yuniffi.dll 8 | 9 | (obviously, Linux/BSD should use /usr/local/lib etc.) 10 | -------------------------------------------------------------------------------- /yunistub/chicken/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(srcs 2 | ${CMAKE_CURRENT_LIST_DIR}/yuniffi-chicken.scm) 3 | set(c_srcs 4 | ${CMAKE_CURRENT_LIST_DIR}/../common/bootstrap.inc.c) 5 | 6 | if(YUNI_CHICKEN AND YUNI_CHICKEN_CSC) 7 | if(CYGWIN OR WIN32) 8 | set(module_sufx "dll") 9 | else() 10 | set(module_sufx "so") 11 | endif() 12 | set(output_name ${CMAKE_CURRENT_BINARY_DIR}/yuniffi-chicken.${module_sufx}) 13 | include_directories(${CMAKE_CURRENT_LIST_DIR}/../include) 14 | add_custom_command(OUTPUT ${output_name} 15 | COMMAND ${YUNI_CHICKEN_CSC} 16 | -dynamic 17 | -o ${output_name} 18 | -I${CMAKE_CURRENT_LIST_DIR}/../include 19 | ${srcs} 20 | DEPENDS 21 | ${srcs} 22 | IMPLICIT_DEPENDS C 23 | ${c_srcs}) 24 | add_custom_target(yuniffi-chicken ALL DEPENDS ${output_name}) 25 | yuni_runtime_deploy(PROGRAMS ${output_name}) 26 | endif() 27 | -------------------------------------------------------------------------------- /yunistub/gambit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(srcs 2 | ${CMAKE_CURRENT_LIST_DIR}/yuniffi-gambit.scm) 3 | set(c_srcs 4 | ${CMAKE_CURRENT_LIST_DIR}/../common/bootstrap.inc.c) 5 | 6 | set(gambit_available) 7 | if(WIN32) 8 | if(YUNI_GSC AND YUNI_GCC) 9 | set(gambit_available ON) 10 | endif() 11 | else() 12 | if(YUNI_GSC) 13 | set(gambit_available ON) 14 | endif() 15 | endif() 16 | 17 | if(gambit_available) 18 | set(output_name ${CMAKE_CURRENT_BINARY_DIR}/yuniffi-gambit.o1) 19 | include_directories(${CMAKE_CURRENT_LIST_DIR}/../include) 20 | add_custom_command(OUTPUT ${output_name} 21 | COMMAND ${YUNI_GSC} 22 | -dynamic 23 | -cc-options -I${CMAKE_CURRENT_LIST_DIR}/../include 24 | -o ${output_name} 25 | ${srcs} 26 | DEPENDS 27 | ${srcs} 28 | IMPLICIT_DEPENDS C 29 | ${c_srcs}) 30 | add_custom_target(yuniffi-gambit ALL DEPENDS ${output_name}) 31 | yuni_runtime_deploy(PROGRAMS ${output_name}) 32 | endif() 33 | -------------------------------------------------------------------------------- /yunistub/gauche/callgenstub.scm.in: -------------------------------------------------------------------------------- 1 | (use gauche.cgen.stub) 2 | 3 | (cgen-genstub "@stubfile@") 4 | -------------------------------------------------------------------------------- /yunistub/gauche/yuniffi.scm: -------------------------------------------------------------------------------- 1 | (define-module yuniffi 2 | (export yuniffi-nccc-call 3 | yuniffi-nccc-bootstrap 4 | yuniffi-nccc-proc-register 5 | yuniffi-nccc-proc-release 6 | yuniffi-nccc-get-callback-bridge 7 | yuniffi-pointer-fetch-signed 8 | yuniffi-pointer-fetch-unsigned 9 | yuniffi-pointer-store 10 | yuniffi-pointer-fromint 11 | yuniffi-pointer-fetch-p64 12 | yuniffi-pointer-store-p64 13 | yuniffi-pointer-fetch-p64/bv 14 | yuniffi-pointer-store-p64/bv 15 | yuniptr?)) 16 | (select-module yuniffi) 17 | 18 | (dynamic-load "yuniffi") 19 | 20 | (define (yuniptr? x) (is-a? x )) 21 | 22 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/abiv0/bootstrap.h: -------------------------------------------------------------------------------- 1 | #ifndef YUNIFFI_ABIV0_BOOTSTRAP_H 2 | #define YUNIFFI_ABIV0_BOOTSTRAP_H 3 | 4 | /* malloc(0:func 1:size => 0:ptr/null) */ 5 | #define YUNIBOOTSTRAP0_MALLOC 1 6 | /* free(0:func 1:ptr =>) */ 7 | #define YUNIBOOTSTRAP0_FREE 2 8 | /* dlopen(0:func 1:nameptr => 0:error 1:ptr) */ 9 | #define YUNIBOOTSTRAP0_DLOPEN 3 10 | /* dlsym(0:func 1:ptr 2:nameptr => 0:error 1:ptr) */ 11 | #define YUNIBOOTSTRAP0_DLSYM 4 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/abiv0/symflags.h: -------------------------------------------------------------------------------- 1 | #ifndef YUNIFFI_ABIV0_SYMFLAGS_H 2 | #define YUNIFFI_ABIV0_SYMFLAGS_H 3 | 4 | #include 5 | 6 | /* Symbol flags */ 7 | 8 | /* Core flags */ 9 | #define YUNIFFI_SYMBOL__TERMINATE YUNIFFI_BIT(0) 10 | #define YUNIFFI_SYMBOL__VALID YUNIFFI_BIT(1) 11 | #define YUNIFFI_SYMBOL__HAS_SIZE YUNIFFI_BIT(2) 12 | #define YUNIFFI_SYMBOL__HAS_OFFSET YUNIFFI_BIT(3) 13 | #define YUNIFFI_SYMBOL__HAS_RESVD0 YUNIFFI_BIT(4) 14 | #define YUNIFFI_SYMBOL__HAS_RESVD1 YUNIFFI_BIT(5) 15 | 16 | /* Common classes */ 17 | #define YUNIFFI_SYMBOL_AGGREGATE_MEMBER \ 18 | (YUNIFFI_SYMBOL__VALID | \ 19 | YUNIFFI_SYMBOL__HAS_SIZE | YUNIFFI_SYMBOL__HAS_OFFSET) 20 | #define YUNIFFI_SYMBOL_TYPE \ 21 | (YUNIFFI_SYMBOL__VALID | YUNIFFI_SYMBOL__HAS_SIZE) 22 | #define YUNIFFI_SYMBOL_CONSTANT \ 23 | (YUNIFFI_SYMBOL__VALID) 24 | #define YUNIFFI_SYMBOL_CONSTANT_BLOB \ 25 | (YUNIFFI_SYMBOL__VALID | YUNIFFI_SYMBOL__HAS_SIZE) 26 | 27 | #define YUNIFFI_SYMBOL_TERMINATE YUNIFFI_SYMBOL__TERMINATE 28 | 29 | #endif /* YUNIFFI_ABIV0_SYMFLAGS_H */ 30 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/abiv0/yuniword.h: -------------------------------------------------------------------------------- 1 | #ifndef YUNIFFI_ABIV0_YUNIWORD_H 2 | #define YUNIFFI_ABIV0_YUNIWORD_H 3 | 4 | /* FIXME: Support legacy compilers... */ 5 | 6 | #include 7 | 8 | typedef uint64_t yuniword_t; 9 | typedef int yunioffs_t; 10 | 11 | #define YUNIWORD_REF_SINT(words,offs) \ 12 | (int64_t)(words[offs]) 13 | 14 | #define YUNIWORD_REF_UINT(words,offs) \ 15 | (uint64_t)(words[offs]) 16 | 17 | #define YUNIWORD_REF_PTR(words,offs) \ 18 | (void*)(uintptr_t)(words[offs]) 19 | 20 | #define YUNIWORD_REF_DOUBLE(words,offs) \ 21 | (*((double *)(char*)(&words[offs]))) 22 | 23 | #define YUNIWORD_SET_SINT(words,offs,v) \ 24 | (*(int64_t*)(&words[offs]) = (int64_t)v) 25 | 26 | #define YUNIWORD_SET_UINT(words,offs,v) \ 27 | (words[offs] = (uint64_t)v) 28 | 29 | #define YUNIWORD_SET_PTR(words,offs,v) \ 30 | (words[offs] = (uint64_t)(uintptr_t)v) 31 | 32 | #define YUNIWORD_SET_DOUBLE(words,offs,v) \ 33 | (*((double *)(char*)(&words[offs])) = (double)v) 34 | 35 | #endif /* YUNIFFI_ABIV0_YUNIWORD_H */ 36 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/stub/_begin_bridge.h: -------------------------------------------------------------------------------- 1 | /* Bridge functions */ 2 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/stub/_begin_constants.h: -------------------------------------------------------------------------------- 1 | /* constants */ 2 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/stub/_end.h: -------------------------------------------------------------------------------- 1 | /* end of the source */ 2 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/stub/_top.h: -------------------------------------------------------------------------------- 1 | /* Top of the source */ 2 | 3 | #include 4 | #include 5 | #include 6 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/stub/yunidefs.h: -------------------------------------------------------------------------------- 1 | #ifndef YUNIFFI_STUB_YUNIDEFS_H 2 | #define YUNIFFI_STUB_YUNIDEFS_H 3 | 4 | #include 5 | 6 | #endif /* YUNIFFI_STUB_YUNIDEFS_H */ 7 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/stub/yunitypes.h: -------------------------------------------------------------------------------- 1 | #ifndef YUNIFFI_STUB_YUNITYPES_H 2 | #define YUNIFFI_STUB_YUNITYPES_H 3 | 4 | #include 5 | 6 | #endif /* YUNIFFI_STUB_YUNITYPES_H */ 7 | -------------------------------------------------------------------------------- /yunistub/include/yuniffi/util/bits.h: -------------------------------------------------------------------------------- 1 | #ifndef YUNIFFI_UTIL_BITS_H 2 | #define YUNIFFI_UTIL_BITS_H 3 | 4 | #define YUNIFFI_BIT(x) (1< 2 | #include 3 | #include 4 | 5 | #include "s7.h" 6 | 7 | int 8 | main(int ac, char** av){ 9 | int i; 10 | int add_default_loadpath = 1; 11 | s7_scheme* s7; 12 | s7_pointer cur; 13 | s7 = s7_init(); 14 | 15 | /* Check for -NOSTDLIBPATH */ 16 | if(ac > 1){ 17 | if(! strncmp("-NOSTDLIBPATH", av[1], sizeof("-NOSTDLIBPATH"))){ 18 | add_default_loadpath = 0; 19 | } 20 | } 21 | 22 | if(add_default_loadpath){ 23 | s7_add_to_load_path(s7, S7YUNI_DEFAULT_LOAD_PATH); 24 | } 25 | 26 | /* Generate and bind *command-line* */ 27 | cur = s7_nil(s7); 28 | for(i = 0; i != ac; i++){ 29 | cur = s7_cons(s7, s7_make_string(s7, av[ac-i-1]), cur); 30 | } 31 | (void) s7_define_variable(s7, "*command-line*", cur); 32 | 33 | s7_load(s7, "s7yuniboot.scm"); 34 | 35 | /* by-default, return unsuccessful */ 36 | return 1; 37 | } 38 | --------------------------------------------------------------------------------