├── .gitattributes ├── .github └── workflows │ ├── Release.yml │ ├── ci.yml │ └── docker-image.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE-APACHE-2.0.txt ├── LICENSE-LGPL.txt ├── Makefile ├── README.md ├── build.sh ├── configure ├── dist ├── README.org ├── docker │ ├── Dockerfile │ └── Makefile ├── guix │ ├── README.org │ ├── gambit-build-utils.scm │ ├── gambit-stamp.scm │ ├── gerbil-build-utils.scm │ ├── gerbil-package.scm │ ├── gerbil-stamp.scm │ ├── gerbil.scm │ ├── update-gambit-stamp.sh │ └── update-gerbil-stamp.sh └── macos │ ├── README.org │ └── homebrew │ ├── .github │ └── workflows │ │ ├── publish.yml │ │ └── tests.yml │ ├── Formula │ └── gerbil-scheme.rb │ └── README.org ├── doc ├── .vuepress │ ├── config.js │ ├── public │ │ └── img │ │ │ ├── gerbil-detailed-consio_OPT.svg │ │ │ ├── gerbil-detailed_INK.svg │ │ │ ├── gerbil-detailed_OPT.svg │ │ │ ├── gerbil-flat-colored-consio_OPT.svg │ │ │ ├── gerbil-flat-colored_INK.svg │ │ │ └── gerbil-flat-colored_OPT.svg │ └── styles │ │ └── index.styl ├── build.sh ├── guide │ ├── README.md │ ├── docker.md │ ├── emacs.md │ ├── env-vars.md │ ├── eval.md │ ├── ffi.md │ ├── getting-started.md │ ├── hacking-on-the-stdlib.md │ ├── homebrew │ │ └── README.md │ ├── intro.md │ ├── macos.md │ ├── nix.md │ ├── package-manager.md │ ├── r7rs.md │ ├── shell.md │ └── srfi.md ├── ox-gfm.el ├── package-lock.json ├── package.json ├── readme.md ├── reference │ ├── README.md │ ├── dev │ │ ├── README.md │ │ ├── bach.md │ │ ├── bootstrap.md │ │ ├── build.md │ │ ├── debug.md │ │ ├── optimizing.md │ │ ├── profiler.md │ │ ├── release.md │ │ └── test.md │ ├── gerbil │ │ ├── expander │ │ │ ├── README.md │ │ │ ├── identifiers.md │ │ │ ├── syntax-errors.md │ │ │ ├── syntax-objects.md │ │ │ └── utilities.md │ │ ├── prelude │ │ │ ├── README.md │ │ │ ├── core-expander-syntax.md │ │ │ ├── macros.md │ │ │ └── runtime-bindings.md │ │ └── runtime │ │ │ ├── MOP.md │ │ │ ├── README.md │ │ │ ├── c3.md │ │ │ ├── control-flow.md │ │ │ ├── exception-objects.md │ │ │ ├── hash-tables.md │ │ │ ├── lists.md │ │ │ ├── misc-procedures.md │ │ │ ├── numerics.md │ │ │ ├── special-objects.md │ │ │ ├── strings.md │ │ │ ├── symbols.md │ │ │ ├── syntax-objects.md │ │ │ ├── system-information.md │ │ │ └── thread-primitives.md │ ├── srfi │ │ └── README.md │ └── std │ │ ├── README.md │ │ ├── actor.md │ │ ├── amb.md │ │ ├── assert.md │ │ ├── cli │ │ ├── README.md │ │ ├── getopt.md │ │ ├── multicall.md │ │ ├── print-exit.md │ │ └── shell.md │ │ ├── config.md │ │ ├── contract.md │ │ ├── coroutine.md │ │ ├── crypto.md │ │ ├── db │ │ ├── README.md │ │ ├── conpool.md │ │ ├── dbi.md │ │ ├── postgresql.md │ │ └── sqlite.md │ │ ├── debug.md │ │ ├── errors.md │ │ ├── events.md │ │ ├── foreign.md │ │ ├── format.md │ │ ├── generic.md │ │ ├── getopt.md │ │ ├── instance.md │ │ ├── instance.org │ │ ├── interface.md │ │ ├── iterators.md │ │ ├── lazy.md │ │ ├── logger.md │ │ ├── make.md │ │ ├── markup │ │ ├── README.md │ │ ├── sxml.md │ │ └── sxml │ │ │ ├── README.md │ │ │ ├── html │ │ │ └── README.md │ │ │ ├── tal │ │ │ └── README.md │ │ │ └── xml.md │ │ ├── mime │ │ └── README.md │ │ ├── misc │ │ ├── README.md │ │ ├── alist.md │ │ ├── atom.md │ │ ├── barrier.md │ │ ├── bytes.md │ │ ├── channel.md │ │ ├── completion.md │ │ ├── dag.md │ │ ├── decimal.md │ │ ├── deque.md │ │ ├── evector.md │ │ ├── func.md │ │ ├── hash.md │ │ ├── list-builder.md │ │ ├── list.md │ │ ├── lru.md │ │ ├── number.md │ │ ├── path.md │ │ ├── plist.md │ │ ├── ports.md │ │ ├── pqueue.md │ │ ├── prime.md │ │ ├── process.md │ │ ├── queue.md │ │ ├── rbtree.md │ │ ├── repr.md │ │ ├── rwlock.md │ │ ├── shared.md │ │ ├── shuffle.md │ │ ├── string.md │ │ ├── sync.md │ │ ├── template.md │ │ ├── text.md │ │ ├── threads.md │ │ ├── timeout.md │ │ ├── uuid.md │ │ ├── vector.md │ │ └── walist.md │ │ ├── net │ │ ├── README.md │ │ ├── address.md │ │ ├── httpd.md │ │ ├── json-rpc.md │ │ ├── repl.md │ │ ├── request.md │ │ ├── s3.md │ │ ├── sasl.md │ │ ├── smtp.md │ │ ├── socks.md │ │ ├── ssl.md │ │ ├── uri.md │ │ └── websocket.md │ │ ├── os │ │ ├── README.md │ │ ├── epoll.md │ │ ├── error.md │ │ ├── fcntl.md │ │ ├── fd.md │ │ ├── fdio.md │ │ ├── flock.md │ │ ├── hostname.md │ │ ├── inotify.md │ │ ├── kqueue.md │ │ ├── pid.md │ │ ├── pipe.md │ │ ├── signal-handler.md │ │ ├── signal.md │ │ ├── signalfd.md │ │ ├── socket.md │ │ └── temporaries.md │ │ ├── parser.md │ │ ├── parser │ │ ├── README.md │ │ └── ll1.md │ │ ├── protobuf.md │ │ ├── ref.md │ │ ├── regexp.md │ │ ├── sort.md │ │ ├── source.md │ │ ├── stdio.md │ │ ├── stxparam.md │ │ ├── stxutil.md │ │ ├── sugar.md │ │ ├── test.md │ │ ├── text │ │ ├── README.md │ │ ├── base58.md │ │ ├── base64.md │ │ ├── basic-printers.md │ │ ├── char-set.md │ │ ├── csv.md │ │ ├── hex.md │ │ ├── json.md │ │ ├── utf16.md │ │ ├── utf32.md │ │ ├── utf8.md │ │ └── zlib.md │ │ ├── values.md │ │ └── web.md └── tutorials │ ├── README.md │ ├── advanced-ensemble.md │ ├── ensemble.md │ ├── httpd.md │ ├── kvstore.md │ ├── languages.md │ └── proxy.md ├── etc └── gerbil-mode.el ├── install.sh ├── manifest.sh └── src ├── bootstrap.sh ├── bootstrap └── gerbil │ ├── builtin-inline-rules.ssxi.ss │ ├── builtin.ssxi.ss │ ├── compiler.scm │ ├── compiler.ssi │ ├── compiler.ssxi.ss │ ├── compiler │ ├── base.scm │ ├── base.ssi │ ├── base.ssxi.ss │ ├── base~0.scm │ ├── base~1.scm │ ├── compile.scm │ ├── compile.ssi │ ├── compile.ssxi.ss │ ├── compile~0.scm │ ├── compile~1.scm │ ├── driver.scm │ ├── driver.ssi │ ├── driver.ssxi.ss │ ├── driver~0.scm │ ├── driver~1.scm │ ├── method.scm │ ├── method.ssi │ ├── method.ssxi.ss │ ├── method~0.scm │ ├── method~1.scm │ ├── optimize-ann.scm │ ├── optimize-ann.ssi │ ├── optimize-ann.ssxi.ss │ ├── optimize-ann~0.scm │ ├── optimize-ann~1.scm │ ├── optimize-base.scm │ ├── optimize-base.ssi │ ├── optimize-base.ssxi.ss │ ├── optimize-base~0.scm │ ├── optimize-base~1.scm │ ├── optimize-call.scm │ ├── optimize-call.ssi │ ├── optimize-call.ssxi.ss │ ├── optimize-call~0.scm │ ├── optimize-call~1.scm │ ├── optimize-spec.scm │ ├── optimize-spec.ssi │ ├── optimize-spec.ssxi.ss │ ├── optimize-spec~0.scm │ ├── optimize-spec~1.scm │ ├── optimize-top.scm │ ├── optimize-top.ssi │ ├── optimize-top.ssxi.ss │ ├── optimize-top~0.scm │ ├── optimize-top~1.scm │ ├── optimize-xform.scm │ ├── optimize-xform.ssi │ ├── optimize-xform.ssxi.ss │ ├── optimize-xform~0.scm │ ├── optimize-xform~1.scm │ ├── optimize.scm │ ├── optimize.ssi │ ├── optimize.ssxi.ss │ ├── optimize~0.scm │ ├── optimize~1.scm │ ├── ssxi.scm │ ├── ssxi.ssi │ ├── ssxi.ssxi.ss │ └── ssxi~1.scm │ ├── core.scm │ ├── core.ssi │ ├── core.ssxi.ss │ ├── core │ ├── contract.scm │ ├── contract.ssi │ ├── contract.ssxi.ss │ ├── contract~1.scm │ ├── contract~2.scm │ ├── contract~3.scm │ ├── contract~4.scm │ ├── contract~5.scm │ ├── contract~6.scm │ ├── contract~7.scm │ ├── contract~8.scm │ ├── contract~9.scm │ ├── contract~ClassMeta.scm │ ├── contract~ClassMeta~0.scm │ ├── contract~ContractRules.scm │ ├── contract~Interface.scm │ ├── contract~InterfaceInfo.scm │ ├── contract~InterfaceInfo~0.scm │ ├── contract~TypeCast.scm │ ├── contract~TypeEnv.scm │ ├── contract~TypeEnv~0.scm │ ├── contract~TypeReference.scm │ ├── contract~TypedDefinitions.scm │ ├── contract~Using.scm │ ├── expander.scm │ ├── expander.ssi │ ├── expander.ssxi.ss │ ├── expander~1.scm │ ├── expander~2.scm │ ├── expander~ExpanderRuntime.scm │ ├── expander~SyntaxCase.scm │ ├── expander~SyntaxSugar.scm │ ├── macro-object.scm │ ├── macro-object.ssi │ ├── macro-object.ssxi.ss │ ├── macro-object~0.scm │ ├── macro-object~1.scm │ ├── match.scm │ ├── match.ssi │ ├── match.ssxi.ss │ ├── match~1.scm │ ├── match~2.scm │ ├── module-sugar.scm │ ├── module-sugar.ssi │ ├── module-sugar.ssxi.ss │ ├── module-sugar~1.scm │ ├── mop.scm │ ├── mop.ssi │ ├── mop.ssxi.ss │ ├── mop~1.scm │ ├── mop~2.scm │ ├── mop~3.scm │ ├── mop~4.scm │ ├── mop~MOP-1.scm │ ├── mop~MOP-2.scm │ ├── mop~MOP-2~0.scm │ ├── mop~MOP-3.scm │ ├── mop~MOP-4.scm │ ├── mop~MOP-5.scm │ ├── more-sugar.scm │ ├── more-sugar.ssi │ ├── more-sugar.ssxi.ss │ ├── more-sugar~1.scm │ ├── more-sugar~2.scm │ ├── more-syntax-sugar.scm │ ├── more-syntax-sugar.ssi │ ├── more-syntax-sugar.ssxi.ss │ ├── more-syntax-sugar~1.scm │ ├── runtime.scm │ ├── runtime.ssi │ ├── runtime.ssxi.ss │ ├── runtime~GambitRuntime.scm │ ├── runtime~GerbilRuntime.scm │ ├── runtime~R5RSRuntime.scm │ ├── runtime~R7RSRuntime.scm │ ├── runtime~Runtime.scm │ ├── runtime~RuntimeAliases.scm │ ├── sugar.scm │ ├── sugar.ssi │ ├── sugar.ssxi.ss │ ├── sugar~1.scm │ ├── sugar~2.scm │ ├── sugar~3.scm │ ├── sugar~Sugar-1.scm │ ├── sugar~Sugar-2.scm │ └── sugar~Sugar-3.scm │ ├── expander.scm │ ├── expander.ssi │ ├── expander.ssxi.ss │ ├── expander │ ├── common.scm │ ├── common.ssi │ ├── common.ssxi.ss │ ├── common~0.scm │ ├── common~1.scm │ ├── compile.scm │ ├── compile.ssi │ ├── compile.ssxi.ss │ ├── compile~0.scm │ ├── core.scm │ ├── core.ssi │ ├── core.ssxi.ss │ ├── core~0.scm │ ├── core~1.scm │ ├── init.scm │ ├── init.ssi │ ├── init.ssxi.ss │ ├── init~0.scm │ ├── module.scm │ ├── module.ssi │ ├── module.ssxi.ss │ ├── module~0.scm │ ├── module~1.scm │ ├── root.scm │ ├── root.ssi │ ├── root.ssxi.ss │ ├── root~0.scm │ ├── stx.scm │ ├── stx.ssi │ ├── stx.ssxi.ss │ ├── stxcase.scm │ ├── stxcase.ssi │ ├── stxcase.ssxi.ss │ ├── stxcase~0.scm │ ├── stxcase~1.scm │ ├── stx~0.scm │ ├── stx~1.scm │ ├── top.scm │ ├── top.ssi │ ├── top.ssxi.ss │ └── top~0.scm │ ├── gambit.scm │ ├── gambit.ssi │ ├── gambit.ssxi.ss │ ├── runtime.scm │ ├── runtime.ssi │ ├── runtime.ssxi.ss │ ├── runtime │ ├── c3.scm │ ├── c3.ssi │ ├── c3.ssxi.ss │ ├── c3~0.scm │ ├── control.scm │ ├── control.ssi │ ├── control.ssxi.ss │ ├── control~0.scm │ ├── error.scm │ ├── error.ssi │ ├── error.ssxi.ss │ ├── error~0.scm │ ├── error~1.scm │ ├── eval.scm │ ├── eval.ssi │ ├── eval.ssxi.ss │ ├── eval~0.scm │ ├── eval~1.scm │ ├── gambit.scm │ ├── gambit.ssi │ ├── gambit.ssxi.ss │ ├── gambit~0.scm │ ├── hash.scm │ ├── hash.ssi │ ├── hash.ssxi.ss │ ├── hash~0.scm │ ├── hash~1.scm │ ├── init.scm │ ├── init.ssi │ ├── init.ssxi.ss │ ├── init~0.scm │ ├── interface.scm │ ├── interface.ssi │ ├── interface.ssxi.ss │ ├── interface~0.scm │ ├── interface~1.scm │ ├── loader.scm │ ├── loader.ssi │ ├── loader.ssxi.ss │ ├── loader~0.scm │ ├── mop-system-classes.scm │ ├── mop-system-classes.ssi │ ├── mop-system-classes.ssxi.ss │ ├── mop-system-classes~0.scm │ ├── mop-system-classes~1.scm │ ├── mop.scm │ ├── mop.ssi │ ├── mop.ssxi.ss │ ├── mop~0.scm │ ├── mop~1.scm │ ├── repl.scm │ ├── repl.ssi │ ├── repl.ssxi.ss │ ├── repl~0.scm │ ├── syntax.scm │ ├── syntax.ssi │ ├── syntax.ssxi.ss │ ├── syntax~0.scm │ ├── syntax~1.scm │ ├── system.scm │ ├── system.ssi │ ├── system.ssxi.ss │ ├── system~0.scm │ ├── table.scm │ ├── table.ssi │ ├── table.ssxi.ss │ ├── table~0.scm │ ├── table~1.scm │ ├── thread.scm │ ├── thread.ssi │ ├── thread.ssxi.ss │ ├── thread~0.scm │ ├── util.scm │ ├── util.ssi │ ├── util.ssxi.ss │ ├── util~0.scm │ └── util~1.scm │ └── runtime~0.scm ├── build.sh ├── build ├── build-bach.ss ├── build-libgerbil.ss ├── build-release.ss ├── build-version.scm ├── build0-lib.scm ├── build0.scm └── build1.ss ├── gerbil ├── boot-gxi.c ├── boot │ └── gerbil-boot.scm ├── builtin-inline-rules.ssxi.ss ├── builtin.ssxi.ss ├── compiler.ss ├── compiler │ ├── base.ss │ ├── compile.ss │ ├── driver.ss │ ├── method.ss │ ├── optimize-ann.ss │ ├── optimize-base.ss │ ├── optimize-call.ss │ ├── optimize-spec.ss │ ├── optimize-top.ss │ ├── optimize-xform.ss │ ├── optimize.ss │ └── ssxi.ss ├── core.ss ├── core │ ├── contract.ss │ ├── expander.ss │ ├── macro-object.ss │ ├── match.ss │ ├── module-sugar.ss │ ├── mop.ss │ ├── more-sugar.ss │ ├── more-syntax-sugar.ss │ ├── runtime.ss │ └── sugar.ss ├── expander.ss ├── expander │ ├── common.ss │ ├── compile.ss │ ├── core.ss │ ├── init.ss │ ├── module.ss │ ├── root.ss │ ├── stx.ss │ ├── stxcase.ss │ └── top.ss ├── gambit.ss ├── gxc-main.ss ├── gxi-main.ss ├── interactive │ ├── init.ss │ └── r7rs-init.ss ├── main.ss ├── runtime.ss ├── runtime │ ├── c3.ss │ ├── control.ss │ ├── error.ss │ ├── eval.ss │ ├── gambit.ss │ ├── hash.ss │ ├── init.ss │ ├── interface.ss │ ├── loader.ss │ ├── mop-system-classes.ss │ ├── mop.ss │ ├── repl.ss │ ├── syntax.ss │ ├── system.ss │ ├── table.ss │ ├── thread.ss │ └── util.ss └── test │ ├── c3-test.ss │ ├── compiler-test-support │ ├── bad-return-type.ss │ ├── class-after-use.ss │ ├── deep-dots.ss │ ├── gerbil.pkg │ ├── interface-mixin.ss │ ├── issue-1144.ss │ ├── mutable-binding-type-2.ss │ ├── mutable-binding-type-3.ss │ ├── mutable-binding-type.ss │ ├── non-procedure-1.ss │ ├── non-procedure-2.ss │ ├── non-procedure-3.ss │ ├── non-procedure-4.ss │ └── specializer-methods.ss │ ├── compiler-test.ss │ ├── gerbil.pkg │ ├── gxc-test.ss │ ├── interface-bench.ss │ ├── interface-specialization-bench.ss │ ├── interface-test.ss │ ├── metaclass-test.ss │ ├── mop-test.ss │ ├── table-bench.ss │ ├── table-test.ss │ ├── test-build-exe.ss │ ├── test-build-optimized-exe.ss │ ├── test-build-optimized-static-exe.ss │ ├── test-build-static-exe.ss │ ├── test-lib.ss │ └── test-program.ss ├── lang ├── build.ss ├── gerbil.pkg ├── gerbil │ └── polydactyl.ss └── scheme │ ├── base-impl.ss │ ├── base.ss │ ├── case-lambda.ss │ ├── char.ss │ ├── complex.ss │ ├── cxr.ss │ ├── eval-impl.ss │ ├── eval.ss │ ├── file.ss │ ├── inexact.ss │ ├── lazy-impl.ss │ ├── lazy.ss │ ├── load-impl.ss │ ├── load.ss │ ├── process-context-impl.ss │ ├── process-context.ss │ ├── r5rs-null.ss │ ├── r5rs.ss │ ├── r7rs.ss │ ├── read.ss │ ├── repl-impl.ss │ ├── repl.ss │ ├── scheme-test.ss │ ├── time.ss │ └── write.ss ├── misc ├── http-perf │ ├── .gitignore │ ├── ab100k │ ├── ab10k │ ├── baseline.ss │ ├── build.ss │ ├── gerbil.pkg │ ├── hellod.ss │ ├── httperf100k │ ├── httperf100kses │ └── httperf10k ├── rpc-perf │ ├── baseline-buffer.ss │ ├── baseline-buffer100k │ ├── baseline-buffer1M │ ├── baseline-io.ss │ ├── baseline-io1M │ ├── baseline-port.ss │ ├── baseline-port100k │ ├── build.ss │ ├── gerbil.pkg │ ├── nullproto.ss │ ├── nullproto100k │ └── nullproto1M └── scripts │ ├── docsnarf.ss │ ├── docstub.ss │ └── docsyms.ss ├── r7rs-large ├── build.ss ├── gerbil.pkg └── scheme │ ├── bitwise.ss │ ├── box.ss │ ├── bytevector.ss │ ├── charset.ss │ ├── comparator.ss │ ├── division.ss │ ├── ephemeron.ss │ ├── fixnum.ss │ ├── flonum.ss │ ├── generator.ss │ ├── hash-table.ss │ ├── ideque.ss │ ├── ilist.ss │ ├── list-queue.ss │ ├── list.ss │ ├── lseq.ss │ ├── mapping.ss │ ├── mapping │ └── hash.ss │ ├── regex.ss │ ├── rlist.ss │ ├── set.ss │ ├── show.ss │ ├── sort.ss │ ├── stream.ss │ ├── text.ss │ ├── vector.ss │ └── vector │ ├── base.ss │ ├── c128.ss │ ├── c64.ss │ ├── f32.ss │ ├── f64.ss │ ├── s16.ss │ ├── s32.ss │ ├── s64.ss │ ├── s8.ss │ ├── u16.ss │ ├── u32.ss │ ├── u64.ss │ └── u8.ss ├── srfi ├── 146 │ ├── hamt-map.ss │ ├── hamt-misc.ss │ ├── hamt.ss │ ├── hash.ss │ └── vector-edit.ss ├── 159 │ ├── base.ss │ ├── color.ss │ ├── columnar.ss │ ├── environment.ss │ ├── pretty.ss │ ├── show.ss │ ├── string.ss │ └── unicode.ss ├── 160 │ ├── base.ss │ ├── c128.ss │ ├── c64.ss │ ├── f32.ss │ ├── f64.ss │ ├── s16.ss │ ├── s32.ss │ ├── s64.ss │ ├── s8.ss │ ├── u16.ss │ ├── u32.ss │ ├── u64.ss │ └── u8.ss ├── 1.ss ├── 101.ss ├── 113.ss ├── 115.ss ├── 116.ss ├── 117.ss ├── 121.ss ├── 124.ss ├── 127.ss ├── 128.ss ├── 13.ss ├── 130.ss ├── 132.ss ├── 133.ss ├── 134.ss ├── 135.ss ├── 14.ss ├── 141.ss ├── 143.ss ├── 144.ss ├── 145.ss ├── 146.ss ├── 151.ss ├── 158.ss ├── 159.ss ├── 19.ss ├── 212.ss ├── 41.ss ├── 42.ss ├── 43.ss ├── 78.ss ├── 8.ss ├── 9.ss ├── 95.ss ├── build.ss └── gerbil.pkg ├── std ├── actor-v13.ss ├── actor-v13 │ ├── message.ss │ ├── proto.ss │ ├── rpc-test.ss │ ├── rpc.ss │ ├── rpc │ │ ├── base.ss │ │ ├── connection.ss │ │ ├── proto │ │ │ ├── cipher.ss │ │ │ ├── cookie.ss │ │ │ ├── message.ss │ │ │ └── null.ss │ │ └── server.ss │ ├── xdr-test.ss │ └── xdr.ss ├── actor-v18 │ ├── admin-test.ss │ ├── admin.ss │ ├── api.ss │ ├── connection.ss │ ├── cookie.ss │ ├── ensemble-config.ss │ ├── ensemble-server.ss │ ├── ensemble-supervisor.ss │ ├── ensemble-test.ss │ ├── ensemble-util.ss │ ├── ensemble.ss │ ├── executor.ss │ ├── filesystem.ss │ ├── io-test.ss │ ├── io.ss │ ├── loader-test-server.ss │ ├── loader-test-support.ss │ ├── loader-test.ss │ ├── loader.ss │ ├── logger.ss │ ├── message-test.ss │ ├── message.ss │ ├── path.ss │ ├── proto.ss │ ├── registry.ss │ ├── server-identifier.ss │ ├── server-test.ss │ ├── server.ss │ ├── supervisor.ss │ ├── test-util.ss │ ├── tls-test.ss │ └── tls.ss ├── actor.ss ├── amb-test.ss ├── amb.ss ├── assert-test.ss ├── assert.ss ├── build-config.ss ├── build-features.ss ├── build-script.ss ├── build-spec.ss ├── build-std.ss ├── build.ss ├── cli │ ├── getopt.ss │ ├── multicall.ss │ ├── print-exit.ss │ ├── shell-test.ss │ └── shell.ss ├── config.ss ├── contract.ss ├── coroutine-test.ss ├── coroutine.ss ├── crypto-test.ss ├── crypto.ss ├── crypto │ ├── bn.ss │ ├── cipher.ss │ ├── dh.ss │ ├── digest-test.ss │ ├── digest.ss │ ├── etc.ss │ ├── hmac.ss │ ├── kdf.ss │ ├── libcrypto-rfc5114.c │ ├── libcrypto.ss │ ├── pkey-test.ss │ └── pkey.ss ├── db │ ├── _sqlite.scm │ ├── _sqlite.ssi │ ├── conpool.ss │ ├── dbi.ss │ ├── postgresql-driver.ss │ ├── postgresql-test.ss │ ├── postgresql.ss │ ├── sqlite-test.ss │ └── sqlite.ss ├── debug │ ├── DBG.ss │ ├── heap.ss │ ├── memleak.ss │ └── threads.ss ├── deprecation.ss ├── error.ss ├── event-test.ss ├── event.ss ├── foreign-test-support.ss ├── foreign-test.ss ├── foreign.ss ├── format.ss ├── generic.ss ├── generic │ ├── dispatch.ss │ ├── generic-test.ss │ └── macros.ss ├── gerbil.pkg ├── getopt.ss ├── hash-table.ss ├── instance-test.ss ├── instance.ss ├── interactive.ss ├── interface.ss ├── io.ss ├── io │ ├── api.ss │ ├── bio │ │ ├── api.ss │ │ ├── bio-test.ss │ │ ├── chunked.ss │ │ ├── delimited.ss │ │ ├── inline.ss │ │ ├── input.ss │ │ ├── output.ss │ │ ├── types.ss │ │ └── util.ss │ ├── delimited.ss │ ├── dummy.ss │ ├── file-benchmark.ss │ ├── file-test.ss │ ├── file.ss │ ├── interface.ss │ ├── port-test.ss │ ├── port.ss │ ├── socket │ │ ├── api.ss │ │ ├── basic.ss │ │ ├── datagram.ss │ │ ├── server.ss │ │ ├── socket-test.ss │ │ ├── socket.ss │ │ ├── stream.ss │ │ └── types.ss │ ├── strio │ │ ├── api.ss │ │ ├── chunked.ss │ │ ├── delimited.ss │ │ ├── inline.ss │ │ ├── input.ss │ │ ├── output.ss │ │ ├── packed.ss │ │ ├── reader.ss │ │ ├── strio-test.ss │ │ ├── types.ss │ │ ├── utf8.ss │ │ ├── util.ss │ │ └── writer.ss │ ├── util-test.ss │ └── util.ss ├── iter-test.ss ├── iter.ss ├── lazy.ss ├── logger.ss ├── make.ss ├── markup │ ├── README.org │ ├── html.ss │ ├── sxml-test.ss │ ├── sxml.ss │ ├── sxml │ │ ├── README.org │ │ ├── html │ │ │ ├── README.org │ │ │ ├── html-parser.scm │ │ │ ├── parser.ss │ │ │ └── tal.ss │ │ ├── oleg │ │ │ ├── README.md │ │ │ ├── SSAX.scm │ │ │ ├── SXPath.scm │ │ │ ├── char-encoding.scm │ │ │ ├── define-opt.scm │ │ │ ├── input-parse.scm │ │ │ ├── look-for-str.scm │ │ │ ├── myenv-gerbil.scm │ │ │ └── parser-errors-vanilla.scm │ │ ├── print.ss │ │ ├── ssax.ss │ │ ├── sxml-inf.ss │ │ ├── sxpath.ss │ │ ├── tal │ │ │ ├── README.org │ │ │ ├── expander.ss │ │ │ ├── iter.ss │ │ │ ├── parser.ss │ │ │ ├── syntax.ss │ │ │ └── toplevel.ss │ │ ├── xml.org │ │ └── xml.ss │ ├── tal.ss │ └── xml.ss ├── metaclass.ss ├── mime │ ├── README.org │ ├── mime.types │ ├── struct.ss │ └── types.ss ├── misc │ ├── alist-test.ss │ ├── alist.ss │ ├── atom-test.ss │ ├── atom.ss │ ├── barrier-test.ss │ ├── barrier.ss │ ├── bytes-test.ss │ ├── bytes.ss │ ├── channel-test.ss │ ├── channel.ss │ ├── completion-test.ss │ ├── completion.ss │ ├── concurrent-plan.ss │ ├── dag-test.ss │ ├── dag.ss │ ├── decimal-test.ss │ ├── decimal.ss │ ├── deque-test.ss │ ├── deque.ss │ ├── evector-test.ss │ ├── evector.ss │ ├── func-test.ss │ ├── func.ss │ ├── hash-test.ss │ ├── hash.ss │ ├── list-builder-test.ss │ ├── list-builder.ss │ ├── list-test.ss │ ├── list.ss │ ├── lru-test.ss │ ├── lru.ss │ ├── number-test.ss │ ├── number.ss │ ├── path-test.ss │ ├── path.ss │ ├── plist-test.ss │ ├── plist.ss │ ├── ports-test.data │ ├── ports-test.ss │ ├── ports.ss │ ├── pqueue-test.ss │ ├── pqueue.ss │ ├── prime-test.ss │ ├── prime.ss │ ├── process-test.ss │ ├── process.ss │ ├── queue-test.ss │ ├── queue.ss │ ├── rbtree-test.ss │ ├── rbtree.ss │ ├── repr-test.ss │ ├── repr.ss │ ├── rwlock-test.ss │ ├── rwlock.ss │ ├── shared.ss │ ├── shuffle.ss │ ├── string-test.ss │ ├── string.ss │ ├── symbol.ss │ ├── sync.ss │ ├── template-test.ss │ ├── template.ss │ ├── text.ss │ ├── threads.ss │ ├── timeout.ss │ ├── uuid.ss │ ├── vector-test.ss │ ├── vector.ss │ ├── walist-test.ss │ ├── walist.ss │ └── wg.ss ├── net │ ├── address-test.ss │ ├── address.ss │ ├── bio.ss │ ├── bio │ │ ├── buffer.ss │ │ ├── file.ss │ │ ├── input.ss │ │ └── output.ss │ ├── httpd-test.ss │ ├── httpd.ss │ ├── httpd │ │ ├── api.ss │ │ ├── base.ss │ │ ├── control.ss │ │ ├── file.ss │ │ ├── handler.ss │ │ ├── logger.ss │ │ ├── mux.ss │ │ └── server.ss │ ├── json-rpc-test.ss │ ├── json-rpc.ss │ ├── repl-test.ss │ ├── repl.ss │ ├── request.ss │ ├── s3.ss │ ├── s3 │ │ ├── api.ss │ │ ├── interface.ss │ │ ├── sigv4-test.ss │ │ └── sigv4.ss │ ├── sasl-test.ss │ ├── sasl.ss │ ├── smtp.ss │ ├── smtp │ │ ├── README.org │ │ ├── api.ss │ │ ├── client.ss │ │ ├── connection.ss │ │ ├── data.ss │ │ ├── headers.ss │ │ ├── interface.ss │ │ └── session.ss │ ├── socket.ss │ ├── socket │ │ ├── api.ss │ │ ├── base.ss │ │ ├── basic-server.ss │ │ ├── basic-socket.ss │ │ ├── buffer.ss │ │ ├── epoll-server.ss │ │ ├── kqueue-server.ss │ │ ├── server-test.ss │ │ └── server.ss │ ├── socks.ss │ ├── socks │ │ ├── api.ss │ │ ├── client.ss │ │ ├── interface.ss │ │ ├── server.ss │ │ └── socks-test.ss │ ├── ssl-test.ss │ ├── ssl.ss │ ├── ssl │ │ ├── api.ss │ │ ├── client.ss │ │ ├── error.ss │ │ ├── interface.ss │ │ ├── libssl.ss │ │ ├── server.ss │ │ └── socket.ss │ ├── uri.ss │ ├── websocket.ss │ └── websocket │ │ ├── api.ss │ │ ├── client.ss │ │ ├── interface.ss │ │ ├── server.ss │ │ ├── socket-test.ss │ │ ├── socket.ss │ │ └── websocket-test.ss ├── os │ ├── _socket.scm │ ├── _socket.ssi │ ├── epoll.ss │ ├── error.ss │ ├── fcntl.ss │ ├── fd.ss │ ├── fdio.ss │ ├── flock.ss │ ├── hostname.ss │ ├── inotify.ss │ ├── kqueue.ss │ ├── pid.ss │ ├── pipe.ss │ ├── signal-00-signalfd-test.ss │ ├── signal-01-signal-handler-test.ss │ ├── signal-handler.ss │ ├── signal.ss │ ├── signalfd.ss │ ├── socket.ss │ └── temporaries.ss ├── parser.ss ├── parser │ ├── base.ss │ ├── deflexer.ss │ ├── defparser.ss │ ├── grammar-reader.ss │ ├── grammar.ss │ ├── lexer.ss │ ├── ll1-test.ss │ ├── ll1.ss │ ├── rlang.ss │ ├── rx-parser.ss │ └── stream.ss ├── pregexp.ss ├── pregexp │ ├── COPYING │ ├── INSTALL │ ├── README │ ├── dialects │ │ ├── cl-pregexp.scm │ │ ├── dialects-supported.scm │ │ ├── files-to-be-ported.scm │ │ ├── gauche-pregexp.scm │ │ ├── guile-pregexp.scm │ │ ├── plt-pregexp.scm │ │ └── scsh-pregexp.scm │ ├── history │ ├── index.tex │ ├── known-bugs │ │ ├── 6115 │ │ └── scott │ ├── manifest │ ├── pregexp-test.scm │ ├── pregexp-test.ss │ ├── pregexp.lisp │ ├── pregexp.scm │ ├── tester.lisp │ └── tester.scm ├── protobuf │ ├── io.ss │ ├── macros.ss │ ├── potpourri-test.proto │ ├── potpourri-test2.proto │ ├── proto-grammar.ss │ ├── proto.ss │ └── protobuf-test.ss ├── ref.ss ├── sort.ss ├── sort │ ├── lmsort.scm │ ├── sort-support.scm │ ├── sort.scm │ ├── sortp.scm │ ├── test.scm │ ├── vbinsearch.scm │ ├── vhsort.scm │ ├── visort.scm │ ├── vmsort.scm │ └── vqsort.scm ├── source-test.ss ├── source.ss ├── srfi │ ├── 146 │ │ ├── hamt-map.scm │ │ ├── hamt-map.ss │ │ ├── hamt-misc.scm │ │ ├── hamt-misc.ss │ │ ├── hamt.scm │ │ ├── hamt.ss │ │ ├── hash.scm │ │ ├── hash.ss │ │ ├── vector-edit.scm │ │ └── vector-edit.ss │ ├── 159 │ │ ├── base.scm │ │ ├── base.ss │ │ ├── color.scm │ │ ├── color.ss │ │ ├── column.scm │ │ ├── columnar.ss │ │ ├── environment.scm │ │ ├── environment.ss │ │ ├── pretty.scm │ │ ├── pretty.ss │ │ ├── show.scm │ │ ├── show.ss │ │ ├── string.ss │ │ ├── unicode.scm │ │ ├── unicode.ss │ │ └── write.scm │ ├── 160 │ │ ├── base.ss │ │ ├── c128.ss │ │ ├── c64.ss │ │ ├── cvector.ss │ │ ├── f32.ss │ │ ├── f64.ss │ │ ├── macros.ss │ │ ├── s16.ss │ │ ├── s32.ss │ │ ├── s64.ss │ │ ├── s8.ss │ │ ├── u16.ss │ │ ├── u32.ss │ │ ├── u64.ss │ │ └── u8.ss │ ├── 1-test.ss │ ├── 1.ss │ ├── 101.ss │ ├── 113.ss │ ├── 115.ss │ ├── 116.ss │ ├── 117.ss │ ├── 121-iter.ss │ ├── 121.ss │ ├── 124.ss │ ├── 125.ss │ ├── 127-iter.ss │ ├── 127.ss │ ├── 128.ss │ ├── 13.ss │ ├── 130.ss │ ├── 132.ss │ ├── 133.ss │ ├── 134.ss │ ├── 135.ss │ ├── 14.ss │ ├── 141.ss │ ├── 143.ss │ ├── 144.ss │ ├── 145.ss │ ├── 146.ss │ ├── 151.ss │ ├── 158-iter.ss │ ├── 158.ss │ ├── 159.ss │ ├── 19.ss │ ├── 212.ss │ ├── 41-iter.ss │ ├── 41.ss │ ├── 42.ss │ ├── 43.ss │ ├── 78.ss │ ├── 8.ss │ ├── 9.ss │ ├── 95.ss │ ├── srfi-1.scm │ ├── srfi-101.scm │ ├── srfi-113.scm │ ├── srfi-115 │ │ ├── charsets.scm │ │ └── regexp.scm │ ├── srfi-116 │ │ ├── ilists-base.scm │ │ ├── ilists-impl.scm │ │ ├── ilists-test.scm │ │ ├── ilists.scm │ │ └── ilists.sld │ ├── srfi-117.scm │ ├── srfi-121.scm │ ├── srfi-127.scm │ ├── srfi-13.scm │ ├── srfi-130.scm │ ├── srfi-132 │ │ ├── 132.sld │ │ ├── delndups.scm │ │ ├── lmsort.scm │ │ ├── merge.scm │ │ ├── select.scm │ │ ├── sort.scm │ │ ├── sortfaster.scm │ │ ├── sorting-test.scm │ │ ├── sortp.scm │ │ ├── srfi-132-test.sps │ │ ├── vector-util.scm │ │ ├── vhsort.scm │ │ ├── visort.scm │ │ ├── vmsort.scm │ │ ├── vqsort2.scm │ │ └── vqsort3.scm │ ├── srfi-133.scm │ ├── srfi-134.scm │ ├── srfi-135 │ │ ├── binary.scm │ │ ├── binary.ss │ │ ├── etc.ss │ │ ├── kernel8.scm │ │ ├── kernel8.ss │ │ ├── macros.scm │ │ ├── macros.ss │ │ ├── text.scm │ │ └── text.ss │ ├── srfi-14.scm │ ├── srfi-143 │ │ └── carries.scm │ ├── srfi-144 │ │ ├── 144.body.scm │ │ ├── 144.body0.scm │ │ ├── 144.constants.scm │ │ └── 144.special.scm │ ├── srfi-146.scm │ ├── srfi-151 │ │ ├── bitwise-33.scm │ │ ├── bitwise-60.scm │ │ ├── bitwise-core.scm │ │ └── bitwise-other.scm │ ├── srfi-158.scm │ ├── srfi-19.scm │ ├── srfi-41.scm │ ├── srfi-42.scm │ ├── srfi-43.scm │ ├── srfi-78.scm │ ├── srfi-95.scm │ └── srfi-support.ss ├── ssi.ss ├── stxparam.ss ├── stxutil.ss ├── sugar-test.ss ├── sugar.ss ├── test.ss ├── text │ ├── _zlib.scm │ ├── _zlib.ssi │ ├── base58-test.ss │ ├── base58.ss │ ├── base64.scm │ ├── base64.ssi │ ├── basic-printers-test.ss │ ├── basic-printers.ss │ ├── char-set-test.ss │ ├── char-set.ss │ ├── csv-test.ss │ ├── csv.ss │ ├── hex-test.ss │ ├── hex.ss │ ├── json.ss │ ├── json │ │ ├── api.ss │ │ ├── env.ss │ │ ├── input.ss │ │ ├── json-benchmark.ss │ │ ├── json-test.ss │ │ ├── output.ss │ │ └── util.ss │ ├── utf16-test.ss │ ├── utf16.ss │ ├── utf32-test.ss │ ├── utf32.ss │ ├── utf8-test.ss │ ├── utf8.ss │ └── zlib.ss ├── values-test.ss ├── values.ss ├── web │ ├── fastcgi-test.ss │ ├── fastcgi.ss │ ├── rack-test.ss │ └── rack.ss └── xml.ss ├── tools ├── build.ss ├── env.ss ├── gerbil.pkg ├── gxensemble-test.ss ├── gxensemble-test │ ├── echo.config │ └── project │ │ ├── build.ss │ │ ├── echo │ │ ├── main.ss │ │ └── server.ss │ │ └── gerbil.pkg ├── gxensemble.ss ├── gxensemble │ ├── admin.ss │ ├── ca.ss │ ├── cmd.ss │ ├── config.ss │ ├── control.ss │ ├── env.ss │ ├── list.ss │ ├── misc.ss │ ├── opt.ss │ ├── repl.ss │ ├── srv.ss │ └── util.ss ├── gxhttpd-ensemble-test.ss ├── gxhttpd-test.ss ├── gxhttpd-test │ ├── .gitignore │ ├── build.ss │ ├── content │ │ ├── files │ │ │ └── hello.txt │ │ ├── index.html │ │ ├── index.txt │ │ └── servlets │ │ │ └── hello.ss │ ├── gerbil.pkg │ └── site │ │ └── handler.ss ├── gxhttpd.ss ├── gxhttpd │ ├── config.ss │ ├── opt.ss │ └── server.ss ├── gxpkg.ss ├── gxprof.ss ├── gxtags.ss └── gxtest.ss └── tutorial ├── advanced-ensemble ├── rlb │ ├── build.ss │ ├── gerbil.pkg │ └── rlb.ss └── site │ ├── project │ ├── build.ss │ ├── gerbil.pkg │ └── handler.ss │ └── www │ ├── files │ └── hello.txt │ ├── index.html │ ├── index.txt │ └── servlets │ └── hello.ss ├── ensemble ├── Makefile ├── build.ss ├── gerbil.pkg ├── handler.ss ├── httpd-exe.ss ├── httpd-prod-exe.ss ├── httpd-svc.ss ├── registry-prod-exe.ss └── server.ss ├── gerbil.pkg ├── httpd ├── build.ss ├── gerbil.pkg └── simpled.ss ├── kvstore ├── build.ss ├── gerbil.pkg ├── kvstore-svc.ss ├── kvstorec.ss ├── proto.ss └── server.ss ├── lang ├── auto-export.ss ├── build.ss ├── dot-app.ss ├── example │ ├── my-app.ss │ ├── my-auto-export.ss │ ├── my-scuby.ss │ └── my-sexp.ss ├── gerbil.pkg ├── scuby-etc.ss ├── scuby-grammar.ss ├── scuby.ss └── sexp.ss └── proxy ├── build.ss ├── gerbil.pkg ├── tcp-proxy1.ss ├── tcp-proxy2.ss └── tcp-proxy3.ss /.gitattributes: -------------------------------------------------------------------------------- 1 | src/bootstrap/** linguist-generated 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | scratch 3 | gambit-source 4 | attic 5 | bin 6 | lib 7 | /build 8 | *.o 9 | *.o? 10 | *.so 11 | 12 | src/TAGS 13 | .build* 14 | doc/node_modules 15 | doc/.vuepress/dist 16 | src/gerbil/runtime/version.ss 17 | src/gerbil/boot-gxi 18 | src/bootstrap/static 19 | 20 | build-deps 21 | build-env.sh 22 | 23 | .gerbil 24 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/gambit"] 2 | path = src/gambit 3 | url = https://github.com/gambit/gambit.git 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: build 2 | 3 | build: 4 | GERBIL_BUILD_FLAGS="$(MAKEFLAGS)" ./build.sh 5 | 6 | install: 7 | DESTDIR="$(DESTDIR)" ./install.sh 8 | 9 | check: 10 | ./build.sh env gxtest ./... 11 | 12 | clean: 13 | rm -rf build 14 | rm -rf bootstrap 15 | cd src/gambit && make clean 16 | 17 | .PHONY: all build install check clean 18 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | cd $(dirname "$0") 4 | 5 | die() { 6 | echo "build failed" 7 | exit 1 8 | } 9 | 10 | if [ -e build-env.sh ]; then 11 | . ./build-env.sh 12 | else 13 | echo "build-env.sh does not exist; did you run configure?" 14 | die 15 | fi 16 | 17 | (cd src && ./build.sh "$@") || die 18 | -------------------------------------------------------------------------------- /dist/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Distributing Gerbil 2 | 3 | Gerbil is a simple language and runtime that can be distributed many 4 | ways. This is where any extra items exist in the source tree so anyone 5 | can see how things work in other streams. 6 | 7 | * MacOS 8 | 9 | There are those of us that got sucked into MacOS. It's a UNIX, so 10 | there's that. Anyway there's a few different approaches and they're 11 | outlined [[file:macos/README.org][here]]. 12 | 13 | * Docker 14 | 15 | There's some docker things that I don't understand (lol) [[file:docker][here]]. 16 | 17 | * Guix 18 | 19 | At one point I(drewc) was using Guix. My work on it is [[file:guix/README.org][here]]. 20 | 21 | -------------------------------------------------------------------------------- /dist/guix/gambit-stamp.scm: -------------------------------------------------------------------------------- 1 | (define gambit-stamp-version "v4.9.5-78-g8b18ab69") 2 | (define gambit-stamp-ymd "20231029") 3 | (define gambit-stamp-hms "203035") 4 | -------------------------------------------------------------------------------- /dist/guix/gerbil-build-utils.scm: -------------------------------------------------------------------------------- 1 | (include "gerbil-stamp.scm") 2 | 3 | (define gerbil-build-version 4 | `(with-output-to-file "src/build/build-version.scm" 5 | (lambda () 6 | (write 7 | '(let* ((gerbil-version-path 8 | (path-expand "gerbil/runtime/version.ss" (getenv "GERBIL_SOURCE"))) 9 | (gerbil-version-text 10 | (string-append "(def (gerbil-version-string) \"" ,gerbil-stamp-version "\")\n"))) 11 | (display "... write ") (display gerbil-version-path) (newline) 12 | (call-with-output-file `(path: ,gerbil-version-path create: maybe append: #f truncate: #t) 13 | (lambda (port) (display gerbil-version-text port)))))))) 14 | 15 | (define gerbil-conf-sub-git 16 | `(substitute* "configure" 17 | (("set -e") (string-append "set -e ; git () { echo \"",gerbil-stamp-version"\" ;}\n")))) 18 | -------------------------------------------------------------------------------- /dist/guix/gerbil-stamp.scm: -------------------------------------------------------------------------------- 1 | (define gerbil-stamp-version "v0.18-47-g0917172a") 2 | -------------------------------------------------------------------------------- /dist/guix/gerbil.scm: -------------------------------------------------------------------------------- 1 | (define-module (gerbil packages) 2 | #:use-module (gnu packages commencement) 3 | #:use-module (gnu packages linux) 4 | #:use-module (guix packages) 5 | #:use-module (guix build-system gnu) 6 | #:use-module ((guix licenses) #:prefix l:) 7 | #:use-module (gnu packages compression) 8 | #:use-module (gnu packages) 9 | #:use-module (gnu packages version-control) 10 | #:use-module (gnu packages base) 11 | #:use-module (guix git-download) 12 | #:use-module (guix derivations) 13 | #:use-module (gnu packages tls) 14 | #:use-module (gnu packages web) 15 | #:use-module (gnu packages serialization) 16 | #:use-module (gnu packages sqlite) 17 | #:use-module (gnu packages xml) 18 | #:use-module (gnu packages databases) 19 | #:use-module (guix store)) 20 | 21 | (include "gambit-build-utils.scm") 22 | (include "gerbil-build-utils.scm") 23 | 24 | (include "gerbil-package.scm") 25 | -------------------------------------------------------------------------------- /dist/guix/update-gambit-stamp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eu 3 | cd $(dirname "$0") # Change to this directory 4 | GS_FILE="$(pwd)/gambit-stamp.scm" 5 | 6 | cd ../src/gambit 7 | 8 | STAMP_VERSION=$(git describe --tag --always) 9 | STAMP_YMD=$(TZ=UTC git show --quiet --date='format-local:%Y%m%d' --format=%cd) 10 | STAMP_HMS=$(TZ=UTC git show --quiet --date='format-local:%H%M%S' --format=%cd) 11 | 12 | echo "(define gambit-stamp-version \"$STAMP_VERSION\")" | tee "$GS_FILE" 13 | echo "(define gambit-stamp-ymd \"$STAMP_YMD\")" | tee -a "$GS_FILE" 14 | echo "(define gambit-stamp-hms \"$STAMP_HMS\")" | tee -a "$GS_FILE" 15 | -------------------------------------------------------------------------------- /dist/guix/update-gerbil-stamp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eu 3 | cd $(dirname "$0") # Change to this directory 4 | GS_FILE="$(pwd)/gerbil-stamp.scm" 5 | 6 | STAMP_VERSION=$(git describe --tag --always) 7 | 8 | echo "(define gerbil-stamp-version \"$STAMP_VERSION\")" | tee "$GS_FILE" 9 | -------------------------------------------------------------------------------- /dist/macos/homebrew/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Gerbil Homebrew Tap 2 | #+EXPORT_FILE_NAME: ../../doc/guide/homebrew/README.md 3 | #+OPTIONS: toc:nil 4 | 5 | * The Gerbil Homebrew Tap 6 | 7 | #+begin_src sh 8 | brew install mighty-gerbils/gerbil/gerbil-scheme 9 | #+end_src 10 | 11 | That will install the last point release + any fixes or updates. 12 | 13 | ** HEAD of master 14 | 15 | If you want to install the HEAD of master that can be done. 16 | 17 | #+begin_src sh 18 | brew install --debug --verbose --HEAD mighty-gerbils/gerbil/gerbil-scheme 19 | #+end_src 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /doc/.vuepress/styles/index.styl: -------------------------------------------------------------------------------- 1 | div[class~=language-scheme]:before { 2 | content:"scheme" 3 | } 4 | 5 | div[class~=language-docker]:before { 6 | content:"docker" 7 | } 8 | 9 | .home .hero img { 10 | padding-left: 2.8rem 11 | } 12 | -------------------------------------------------------------------------------- /doc/guide/homebrew/README.md: -------------------------------------------------------------------------------- 1 | # The Gerbil Homebrew Tap 2 | 3 | ```sh 4 | brew install mighty-gerbils/gerbil/gerbil-scheme 5 | ``` 6 | 7 | That will install the last point release + any fixes or updates. 8 | 9 | 10 | ## HEAD of master 11 | 12 | If you want to install the HEAD of master that can be done. 13 | 14 | ```sh 15 | brew install --debug --verbose --HEAD mighty-gerbils/gerbil/gerbil-scheme 16 | ``` 17 | -------------------------------------------------------------------------------- /doc/guide/srfi.md: -------------------------------------------------------------------------------- 1 | # SRFIs 2 | 3 | See [SRFI Support](../reference/srfi/) for an overview of all the SRFIs supported by Gerbil. 4 | Reference documentation can be found in the [SRFI Repository](https://srfi.schemers.org/). 5 | 6 | In the [Reference](../reference/) we document all supported SRFI 7 | bindings by linking to their specification anchors. 8 | -------------------------------------------------------------------------------- /doc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gerbil-docs", 3 | "version": "1.0.0", 4 | "description": "--- home: true tagline: Gerbil is a meta-dialect of Scheme with post-modern features actionText: Get Started → actionLink: /guide/ # footer: XYZ Licensed | Copyright © 2018-present Zyx ---", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "build": "vuepress build", 9 | "dev": "vuepress dev" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/mighty-gerbils/gerbil.git" 14 | }, 15 | "author": "", 16 | "license": "ISC", 17 | "bugs": { 18 | "url": "https://github.com/mighty-gerbils/gerbil/issues" 19 | }, 20 | "homepage": "https://github.com/mighty-gerbils/gerbil#readme", 21 | "dependencies": { 22 | "vuepress": "^1.1.0" 23 | }, 24 | "devDependencies": { 25 | "vue-svg-loader": "^0.12.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /doc/reference/gerbil/expander/syntax-errors.md: -------------------------------------------------------------------------------- 1 | # Syntax Errors 2 | 3 | ## raise-syntax-error 4 | ``` 5 | (raise-syntax-error ...) 6 | ``` 7 | 8 | Please document me! 9 | 10 | ## syntax-error? 11 | ``` 12 | (syntax-error? ...) 13 | ``` 14 | 15 | Please document me! 16 | -------------------------------------------------------------------------------- /doc/reference/gerbil/expander/syntax-objects.md: -------------------------------------------------------------------------------- 1 | # Syntax Objects 2 | 3 | ## datum->syntax 4 | ``` 5 | (datum->syntax ...) 6 | ``` 7 | 8 | Please document me! 9 | 10 | ## syntax->datum 11 | ``` 12 | (syntax->datum ...) 13 | ``` 14 | 15 | Please document me! 16 | 17 | ## syntax-e 18 | ``` 19 | (syntax-e ...) 20 | ``` 21 | 22 | Please document me! 23 | 24 | ## syntax->list 25 | ``` 26 | (syntax->list ...) 27 | ``` 28 | 29 | Please document me! 30 | -------------------------------------------------------------------------------- /doc/reference/gerbil/runtime/README.md: -------------------------------------------------------------------------------- 1 | # Runtime Builtins 2 | 3 | The following procedures are available in the Gerbil runtime in 4 | addition to all core Scheme and Gambit primitives. 5 | 6 | -------------------------------------------------------------------------------- /doc/reference/gerbil/runtime/system-information.md: -------------------------------------------------------------------------------- 1 | # System Information 2 | 3 | ## gerbil-system-version-string 4 | ``` scheme 5 | (gerbil-system-version-string) -> string 6 | ``` 7 | 8 | The full Gerbil system version. 9 | 10 | ## gerbil-system 11 | ``` scheme 12 | (gerbil-system) -> symbol 13 | ``` 14 | 15 | Symbolic name of the gerbil system; this is defined as a `cond-expand` feature by the 16 | expander. 17 | 18 | ## gerbil-runtime-smp? 19 | ``` scheme 20 | (gerbil-runtime-smp?) -> boolean 21 | ``` 22 | 23 | Returns true if the SMP scheduler is detected at runtime. 24 | 25 | ## gerbil-greeting 26 | ``` 27 | (def gerbil-greeting) 28 | ``` 29 | 30 | The greeting displayed by the interpreter at interactive load; a string. 31 | 32 | -------------------------------------------------------------------------------- /doc/reference/std/README.md: -------------------------------------------------------------------------------- 1 | # The Standard Library 2 | 3 | Gerbil comes bundled with an extensive standard library. This section is just for reference. Have a look at the [guide](../../guide/intro.md#standard-library) for an overview. 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /doc/reference/std/assert.md: -------------------------------------------------------------------------------- 1 | # Assertions 2 | 3 | The `:std/assert` module provides the `assert!` macro which can be used to certify certain 4 | conditions in a program and fail with a useful error message if the condition is not satisfied. 5 | 6 | ::: tip To use the bindings from this module: 7 | ```scheme 8 | (import :std/assert) 9 | ``` 10 | ::: 11 | 12 | ## assert! 13 | ```scheme 14 | (assert! condition-expr [message-expr extra-expr ...]) 15 | ``` 16 | 17 | Raises an error when the `condition-expr` evaluates to false. 18 | If the `message-expr` and `extra-expr`s are provided, their 19 | values will be included in the error message. 20 | 21 | ## Example 22 | 23 | ```scheme 24 | > (assert! #f) 25 | *** ERROR -- Assertion failed (console)@9.10: #f 26 | 27 | > (assert! (< 42 0) "that's an impossibility") 28 | *** ERROR -- Assertion failed that's an impossibility: (< 42 0) 29 | 42 => 42 30 | 0 => 0 31 | 32 | ``` 33 | -------------------------------------------------------------------------------- /doc/reference/std/cli/README.md: -------------------------------------------------------------------------------- 1 | # Command Line Interface 2 | 3 | The following libraries are provided to support the Command Line Interface (CLI): 4 | - [:std/cli/getopt](getopt.md) 5 | - [:std/cli/shell](shell.md) 6 | - [:std/cli/print-exit](print-exit.md) 7 | - [:std/cli/multicall](multicall.md) 8 | -------------------------------------------------------------------------------- /doc/reference/std/db/README.md: -------------------------------------------------------------------------------- 1 | # Databases and Key/Value Stores 2 | 3 | SQL Databases: 4 | - [:std/db/dbi](dbi.md) 5 | - [:std/db/sqlite](sqlite.md) 6 | - [:std/db/postgres](postgres.md) 7 | - [:std/db/conpool](conpool.md) 8 | 9 | Additional (external) drivers: 10 | - [:clan/db/mysql](https://github.com/mighty-gerbils/gerbil-mysql) 11 | 12 | Key/Value store (external) drivers: 13 | - [:clan/db/leveldb](https://github.com/mighty-gerbils/gerbil-leveldb) 14 | - [:clan/db/lmdb](https://github.com/mighty-gerbils/gerbil-leveldb) 15 | -------------------------------------------------------------------------------- /doc/reference/std/db/sqlite.md: -------------------------------------------------------------------------------- 1 | # SQLite driver 2 | 3 | ::: tip usage 4 | (import :std/db/sqlite) 5 | ::: 6 | 7 | ## sqlite-open 8 | ``` 9 | (sql-connect sqlite-open ...) 10 | (sqlite-open file (flags (fxior SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE))) 11 | ``` 12 | 13 | Please document me! 14 | -------------------------------------------------------------------------------- /doc/reference/std/generic.md: -------------------------------------------------------------------------------- 1 | # Generics 2 | 3 | The `:std/generic` library provides support for generic methods. 4 | 5 | ::: tip usage 6 | (import :std/generic) 7 | ::: 8 | 9 | ## Overview 10 | 11 | Please write me! 12 | 13 | ## Macros 14 | 15 | ### defgeneric 16 | ``` 17 | (defgeneric ...) 18 | ``` 19 | 20 | Please document me! 21 | 22 | ### defmethod 23 | ``` 24 | (defmethod ...) 25 | ``` 26 | 27 | Please document me! 28 | 29 | ## Predefined Types 30 | 31 | Please document me! 32 | -------------------------------------------------------------------------------- /doc/reference/std/getopt.md: -------------------------------------------------------------------------------- 1 | # Command Line Argument Parsing 2 | 3 | This is the old name of the [`:std/cli/getopt`](cli/getopt.md) module, 4 | that provides facilities for command line argument parsing. 5 | 6 | Up to Gerbil v0.18, `:std/getopt` was the only name for this module. 7 | As of Gerbil v0.19, both names are supported. 8 | However, we recommend you use the new name `:std/cli/getopt` from now on, 9 | as we may remove the old name at some point in the future. 10 | 11 | ::: tip usage 12 | ```scheme 13 | (import :std/cli/getopt) 14 | ``` 15 | ::: 16 | -------------------------------------------------------------------------------- /doc/reference/std/lazy.md: -------------------------------------------------------------------------------- 1 | # Primitives for Lazy Evaluation 2 | 3 | Primitives for iterative lazy algorithms, as specified in R7RS; see also 4 | [SRFI-45](https://srfi.schemers.org/srfi-45/) 5 | 6 | ::: tip usage 7 | (import :std/lazy) 8 | ::: 9 | 10 | ### lazy 11 | ``` 12 | (lazy ...) 13 | ``` 14 | 15 | Please document me! 16 | 17 | ### delay 18 | ``` 19 | (delay ...) 20 | ``` 21 | 22 | Please document me! 23 | 24 | ### force 25 | ``` 26 | (force ...) 27 | ``` 28 | 29 | Please document me! 30 | 31 | ### lazy? 32 | ``` 33 | (lazy? ...) 34 | ``` 35 | 36 | Please document me! 37 | 38 | ### eager 39 | ``` 40 | (eager ...) 41 | ``` 42 | 43 | Please document me! 44 | -------------------------------------------------------------------------------- /doc/reference/std/markup/README.md: -------------------------------------------------------------------------------- 1 | # Markup Languages 2 | 3 | Gerbil supports many different markup languages using [SXML](README.md) for parsing, searching, manipulating and printing. 4 | 5 | - **[XML](sxml/xml.md) :** eXtensible Markup Language 6 | - **[HTML](sxml/html/README.md):** Hyper Text Markup Language 7 | - **[TAL](sxml/tal/README.md) :** Template Attribute Language 8 | -------------------------------------------------------------------------------- /doc/reference/std/misc/shared.md: -------------------------------------------------------------------------------- 1 | # Shared-structure Equality. 2 | ::: tip To use the bindings from this module: 3 | ``` scheme 4 | (import :std/misc/shared) 5 | ``` 6 | ::: 7 | 8 | ## equal-shared? 9 | ``` scheme 10 | (equal-shared? a b) -> boolean 11 | 12 | a, b := structures to check 13 | ``` 14 | 15 | Checks whether *a* and *b*, two potentially recursive, cyclic or otherwise 16 | infinite shared structures, e.g. trees or graphs, are equal. 17 | 18 | ::: warning Deprecation note: 19 | Gambit 4.9.3 (released 2019-02-05) added similar support for handling shared 20 | structures with `equal?`, superseding `equal-shared?`. 21 | ::: 22 | -------------------------------------------------------------------------------- /doc/reference/std/misc/template.md: -------------------------------------------------------------------------------- 1 | # String Templates 2 | -------------------------------------------------------------------------------- /doc/reference/std/misc/text.md: -------------------------------------------------------------------------------- 1 | # Text Utilities 2 | ::: tip To use the bindings from this module: 3 | ``` scheme 4 | (import :std/misc/text) 5 | ``` 6 | ::: 7 | 8 | ## include-text 9 | ``` scheme 10 | (include-text path) -> string 11 | 12 | path := path to file to include, string 13 | ``` 14 | 15 | Macro that expands to file contents of *path* at compile-time. 16 | 17 | ::: tip Examples: 18 | ``` scheme 19 | > (def vert-shader-src (include-text "/home/user/dev/opengl/minimal.vert")) 20 | 21 | ;; instead of here strings: 22 | > (def vert-shader-src #< vert-shader-src ; same string in both cases 33 | "#version 420 core\n\nvoid main(void)\n{\n gl_Position = gl_Vertex;\n}" 34 | ``` 35 | ::: 36 | -------------------------------------------------------------------------------- /doc/reference/std/net/README.md: -------------------------------------------------------------------------------- 1 | # Networking Libraries 2 | 3 | These are libraries related to network programming: 4 | - [:std/net/request](request.md) 5 | - [:std/net/json-rpc](json-rpc.md) 6 | - [:std/net/websocket](websocket.md) 7 | - [:std/net/socks](socks.md) 8 | - [:std/net/httpd](httpd.md) 9 | - [:std/net/ssl](ssl.md) 10 | - [:std/net/uri](uri.md) 11 | - [:std/net/address](net.md) 12 | - [:std/net/sasl](sasl.md) 13 | - [:std/net/repl](repl.md) 14 | - [:std/net/s3](s3.md) 15 | -------------------------------------------------------------------------------- /doc/reference/std/net/smtp.md: -------------------------------------------------------------------------------- 1 | # SMTP: Simple Mail Tranfser Protocol 2 | 3 | (import :std/net/smtp) 4 | 5 | > (def mail (smtp-connect "localhost:8025")) 6 | > (send-mail mail "" "me@drewc.ca" 7 | To: "All Users " 8 | From: "No Reply " 9 | Subject: "This is a subject" 10 | "Body not by itself") 11 | ("250 2.0.0 Ok: queued as 1E29D10201C2") 12 | 13 | > (send-mail mail "" "me@drewc.ca" "No headers just body") 14 | ("250 2.0.0 Ok: queued as 1111A10201C2") 15 | 16 | > (send-mail mail "" "me@drewc.ca" 17 | [Subject: "Headers can be a plist"] From: "Nested even!" 18 | "because who knows") 19 | ("250 2.0.0 Ok: queued as 5C4F810201C2") 20 | 21 | > (SMTP-QUIT mail) 22 | ("221 2.0.0 Bye") 23 | 24 | -------------------------------------------------------------------------------- /doc/reference/std/net/uri.md: -------------------------------------------------------------------------------- 1 | # URIs [RFC3986] 2 | 3 | ::: tip usage 4 | (import :std/net/uri) 5 | ::: 6 | 7 | ## uri-encode 8 | ``` 9 | (uri-encode ...) 10 | ``` 11 | 12 | Please document me! 13 | 14 | ## uri-decode 15 | ``` 16 | (uri-decode ...) 17 | ``` 18 | 19 | Please document me! 20 | 21 | ## form-url-encode 22 | ``` 23 | (form-url-encode ...) 24 | ``` 25 | 26 | Please document me! 27 | 28 | ## form-url-decode 29 | ``` 30 | (form-url-decode ...) 31 | ``` 32 | 33 | Please document me! 34 | -------------------------------------------------------------------------------- /doc/reference/std/os/README.md: -------------------------------------------------------------------------------- 1 | # Operating System Interfaces 2 | 3 | The following library modules provide interfaces to the Operating System, 4 | through system calls. 5 | 6 | POSIX: 7 | - [:std/os/error](error.md) 8 | - [:std/os/socket](socket.md) 9 | - [:std/os/fd](fd.md) 10 | - [:std/os/fdio](fdio.md) 11 | - [:std/os/fcntl](fcntl.md) 12 | - [:std/os/flock](flock.md) 13 | - [:std/os/socket](socket.md) 14 | - [:std/os/pipe](pipe.md) 15 | - [:std/os/signal](signal.md) 16 | - [:std/os/signal-handler](signal-handler.md) 17 | - [:std/os/hostname](hostname.md) 18 | - [:std/os/temporaries](temporaries.md) 19 | 20 | OS-specific: 21 | - [:std/os/signalfd](signalfd.md) (Linux) 22 | - [:std/os/inotfy](inotify.md) (Linux) 23 | - [:std/os/epoll](epoll.md) (Linux) 24 | - [:std/os/kqueue](kqueue.md) (BSD, Darwin) 25 | -------------------------------------------------------------------------------- /doc/reference/std/os/epoll.md: -------------------------------------------------------------------------------- 1 | # epoll 2 | ::: tip usage 3 | (require linux) 4 | (import :std/os/epoll) 5 | ::: 6 | 7 | Please document me! 8 | -------------------------------------------------------------------------------- /doc/reference/std/os/fd.md: -------------------------------------------------------------------------------- 1 | # File Descriptors 2 | ::: tip usage 3 | (import :std/os/fd) 4 | ::: 5 | 6 | ## fdopen 7 | ``` 8 | (fdopen fd dir t) 9 | ``` 10 | 11 | Please document me! 12 | 13 | ## fdopen-port 14 | ``` 15 | (fdopen-port fd dir name) 16 | ``` 17 | 18 | Please document me! 19 | 20 | ## fd-e 21 | ``` 22 | (fd-e raw) 23 | ``` 24 | 25 | Please document me! 26 | 27 | ## fd-io-in 28 | ``` 29 | (fd-io-in raw) 30 | ``` 31 | 32 | Please document me! 33 | 34 | ## fd-io-out 35 | ``` 36 | (fd-io-out raw) 37 | ``` 38 | 39 | Please document me! 40 | 41 | ## fd? 42 | ``` 43 | (fd? obj) 44 | ``` 45 | 46 | Please document me! 47 | 48 | ## fd-type? 49 | ``` 50 | (fd-type? obj t) 51 | ``` 52 | 53 | Please document me! 54 | 55 | ## fd-type 56 | ``` 57 | (fd-type raw) 58 | ``` 59 | 60 | Please document me! 61 | -------------------------------------------------------------------------------- /doc/reference/std/os/fdio.md: -------------------------------------------------------------------------------- 1 | # File Descriptor I/O 2 | ::: tip To Use bindings from this module 3 | (import :std/os/fdio) 4 | ::: 5 | 6 | ## open 7 | ``` 8 | (open path flags (mode 0)) 9 | ``` 10 | 11 | Please document me! 12 | 13 | ## close 14 | ``` 15 | (close raw) 16 | ``` 17 | 18 | Please document me! 19 | 20 | ## fdread 21 | ``` 22 | (fdread raw bytes (start 0) (end (u8vector-length bytes))) 23 | ``` 24 | 25 | Please document me! 26 | 27 | ## fdwrite 28 | ``` 29 | (fdwrite raw bytes (start 0) (end (u8vector-length bytes))) 30 | ``` 31 | 32 | Please document me! 33 | 34 | 35 | ## Constants 36 | ``` 37 | S_IRWXU S_IWUSR S_IRUSR S_IXUSR 38 | S_IRWXG S_IRGRP S_IWGRP S_IXGRP 39 | S_IRWXO S_IROTH S_IWOTH S_IXOTH 40 | ``` 41 | -------------------------------------------------------------------------------- /doc/reference/std/os/flock.md: -------------------------------------------------------------------------------- 1 | # Advisory File Locking 2 | 3 | Please document me! 4 | -------------------------------------------------------------------------------- /doc/reference/std/os/hostname.md: -------------------------------------------------------------------------------- 1 | # Hostnames 2 | -------------------------------------------------------------------------------- /doc/reference/std/os/inotify.md: -------------------------------------------------------------------------------- 1 | # inotify 2 | ::: tip usage 3 | (require linux) 4 | (import :std/os/inotify) 5 | ::: 6 | 7 | Please document me! 8 | -------------------------------------------------------------------------------- /doc/reference/std/os/kqueue.md: -------------------------------------------------------------------------------- 1 | # kqueue 2 | ::: tip usage 3 | (require bsd) 4 | (import :std/os/kqueue) 5 | ::: 6 | 7 | Please document me! 8 | -------------------------------------------------------------------------------- /doc/reference/std/os/pid.md: -------------------------------------------------------------------------------- 1 | # PIDs 2 | ::: tip usage 3 | (import :std/os/pid) 4 | ::: 5 | 6 | ## getpid 7 | ``` 8 | (define-c-lambda getpid () int) 9 | ``` 10 | 11 | Please document me! 12 | 13 | ## getppid 14 | ``` 15 | (define-c-lambda getppid () int) 16 | ``` 17 | 18 | Please document me! 19 | -------------------------------------------------------------------------------- /doc/reference/std/os/pipe.md: -------------------------------------------------------------------------------- 1 | # Pipes 2 | ::: tip usage 3 | (import :std/os/pipe) 4 | ::: 5 | 6 | ## pipe 7 | ::: tip usage 8 | ``` 9 | (pipe [direction = 'inout] [closeonexec = #t]) 10 | => (values in out) 11 | ``` 12 | ::: 13 | 14 | Creates a pipe. 15 | 16 | The parameter `direction` controls the returned values: 17 | - if the direction is `inout`, it returns two raw devices for input and output 18 | - if the direction is `in`, it returns a raw device for input and a file descriptor for output 19 | - if the direction is `out`, it returns a file descriptor for input and a raw device for output 20 | - if the direction is `none`, it returns two file descriptors for input and output. 21 | 22 | If the `closeonexec` parameter is true, then the raw devices are set to close on exec. 23 | Note that the file descriptors are not affected by the option, and they are not set to nonblocking 24 | either. 25 | -------------------------------------------------------------------------------- /doc/reference/std/os/signal-handler.md: -------------------------------------------------------------------------------- 1 | # Signal Handling 2 | ::: tip usage 3 | (import :std/os/signal-handler) 4 | ::: 5 | 6 | ## add-signal-handler! 7 | ``` 8 | (add-signal-handler! signo thunk) 9 | ``` 10 | 11 | Please document me! 12 | 13 | ## remove-signal-handler! 14 | ``` 15 | (remove-signal-handler! signo) 16 | ``` 17 | 18 | Please document me! 19 | -------------------------------------------------------------------------------- /doc/reference/std/os/signalfd.md: -------------------------------------------------------------------------------- 1 | # signalfd 2 | ::: tip usage 3 | (require linux) 4 | (import :std/os/signal-handler) 5 | ::: 6 | -------------------------------------------------------------------------------- /doc/reference/std/os/temporaries.md: -------------------------------------------------------------------------------- 1 | # Temporary Files 2 | ::: tip usage 3 | ```scheme 4 | (import :std/os/temporaries) 5 | ``` 6 | ::: 7 | 8 | ## make-temporary-file-name 9 | ```scheme 10 | (make-temporary-file-name name) -> string 11 | 12 | name := string; prefix of temporary filename in /tmp 13 | ``` 14 | 15 | Creates a new temporary file name in /tmp and with name prefix `name`. 16 | It makes `mktemp` sane by appending the current timestamp in nanosecods. 17 | 18 | ## call-with-temporary-file-name 19 | ```scheme 20 | (call-with-temporary-file-name name fun) -> any 21 | name := string; prefix of temporary filename in /tmp 22 | fun := lambda (string) -> any 23 | ``` 24 | 25 | Creates a temporary filename and invokes `fun` with it, deleting the 26 | temporary file on unwind if it has been created. 27 | -------------------------------------------------------------------------------- /doc/reference/std/parser/README.md: -------------------------------------------------------------------------------- 1 | # The Parser Library 2 | 3 | Gerbil comes with a variety of tools for parsing. 4 | For the main parser interface see [std/parser](../parser). 5 | 6 | But for the most simple parsing needs, you may want to use our 7 | LL(1) parser library [std/parser/ll1](ll1). 8 | -------------------------------------------------------------------------------- /doc/reference/std/text/README.md: -------------------------------------------------------------------------------- 1 | # Text Encoding and Decoding Libraries 2 | 3 | The following libraries are provided for text encoding and decoding tasks: 4 | - [:std/text/json](json.md) 5 | - [:std/text/csv](csv.md) 6 | - [:std/text/utf8](utf8.md) 7 | - [:std/text/utf16](utf16.md) 8 | - [:std/text/utf32](utf32.md) 9 | - [:std/text/base64](base64.md) 10 | - [:std/text/base58](base58.md) 11 | - [:std/text/hex](hex.md) 12 | - [:std/text/zlib](zlib.md) 13 | 14 | External Packages: 15 | - [:clan/text/yaml](https://github.com/mighty-gerbils/gerbil-libyaml) 16 | -------------------------------------------------------------------------------- /doc/tutorials/README.md: -------------------------------------------------------------------------------- 1 | # Gerbil Tutorials 2 | 3 | - [Custom Languages in Gerbil](languages.md) 4 | - [A Key-Value Store Server](kvstore.md) 5 | - [Proxies: Network Programming in Gerbil](proxy.md) 6 | - [Web programming with the Gerbil http server](httpd.md) 7 | - [Working with Actor Ensembles](ensemble.md) 8 | - [Advanced Actor Ensembles](advanced-ensemble.md) 9 | -------------------------------------------------------------------------------- /manifest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Create a version MANIFEST so you can build a git-less tarball of Gerbil. 3 | # 4 | # Given an argument $1, use it as the gerbil_stamp_version, e.g. for a release. 5 | # Otherwise, extract the gerbil_stamp_version from git. 6 | # 7 | # Commit the MANIFEST to git for a release and a release only. 8 | # Delete it from git immediately after release. 9 | # See doc/reference/dev/release.md for instructions. 10 | # 11 | # git grep MANIFEST will tell you which files care about the MANIFEST 12 | 13 | cat > MANIFEST < 2 | package: gerbil/core 3 | namespace: gerbil/core/more-syntax-sugar 4 | 5 | (%#begin (%#import 6 | :gerbil/core/expander 7 | :gerbil/core/sugar 8 | :gerbil/core/more-sugar 9 | (phi: 1 :gerbil/core/runtime)) 10 | (%#export #t) 11 | (%#begin (%#begin-syntax 12 | (%#call (%#ref load-module) 13 | (%#quote "gerbil/core/more-syntax-sugar~1"))) 14 | (%#define-syntax 15 | identifier-rules 16 | |gerbil/core/more-syntax-sugar[:0:]#identifier-rules|)) 17 | (%#define-syntax 18 | quasisyntax 19 | |gerbil/core/more-syntax-sugar[:0:]#quasisyntax|)) 20 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/more-syntax-sugar.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/core 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (load-module "gerbil/core/runtime~Runtime") (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/core 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime~GambitRuntime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime~GerbilRuntime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime~R5RSRuntime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime~R7RSRuntime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime~Runtime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/core/runtime~R5RSRuntime") 5 | (load-module "gerbil/core/runtime~R7RSRuntime") 6 | (load-module "gerbil/core/runtime~GambitRuntime") 7 | (load-module "gerbil/core/runtime~GerbilRuntime") 8 | (load-module "gerbil/core/runtime~RuntimeAliases")) 9 | (begin)) 10 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/runtime~RuntimeAliases.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/sugar.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/core/runtime") 5 | (load-module "gerbil/core/sugar~Sugar-1") 6 | (load-module "gerbil/core/sugar~Sugar-2") 7 | (load-module "gerbil/core/sugar~Sugar-3")) 8 | (begin)) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/sugar.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/core 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/sugar~Sugar-1.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/sugar~Sugar-2.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (load-module "gerbil/core/sugar~Sugar-1") (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/core/sugar~Sugar-3.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/core/sugar~Sugar-1") 5 | (load-module "gerbil/core/sugar~Sugar-2")) 6 | (begin)) 7 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/stx") 6 | (load-module "gerbil/expander/core") 7 | (load-module "gerbil/expander/top") 8 | (load-module "gerbil/expander/module") 9 | (load-module "gerbil/expander/compile") 10 | (load-module "gerbil/expander/root") 11 | (load-module "gerbil/expander/stxcase") 12 | (load-module "gerbil/expander/init")) 13 | (begin)) 14 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander.ssi: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/core 2 | package: gerbil 3 | namespace: gerbil/expander 4 | 5 | (%#begin (%#provide gerbil-expander) 6 | (%#import 7 | :gerbil/expander/common 8 | :gerbil/expander/stx 9 | :gerbil/expander/core 10 | :gerbil/expander/top 11 | :gerbil/expander/module 12 | :gerbil/expander/compile 13 | :gerbil/expander/root 14 | :gerbil/expander/stxcase 15 | :gerbil/expander/init) 16 | (%#export 17 | (import: :gerbil/expander/common) 18 | (import: :gerbil/expander/stx) 19 | (import: :gerbil/expander/core) 20 | (import: :gerbil/expander/top) 21 | (import: :gerbil/expander/module) 22 | (import: :gerbil/expander/compile) 23 | (import: :gerbil/expander/root) 24 | (import: :gerbil/expander/stxcase))) 25 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/common.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (load-module "gerbil/core/expander") 4 | (load-module "gerbil/expander/common~0")) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/compile.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/stx") 6 | (load-module "gerbil/expander/core")) 7 | (load-module "gerbil/expander/compile~0")) 8 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/core.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/stx")) 6 | (load-module "gerbil/expander/core~0")) 7 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/init.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime") 5 | (load-module "gerbil/expander/core") 6 | (load-module "gerbil/expander/module") 7 | (load-module "gerbil/expander/top") 8 | (load-module "gerbil/expander/root")) 9 | (load-module "gerbil/expander/init~0")) 10 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/init.ssi: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/core 2 | package: gerbil/expander 3 | namespace: gx 4 | 5 | (%#begin (%#import 6 | :gerbil/runtime 7 | :gerbil/expander/core 8 | :gerbil/expander/module 9 | :gerbil/expander/top 10 | :gerbil/expander/root)) 11 | (%#call (%#ref load-module) (%#quote "gerbil/expander/init~0")) 12 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/init.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/expander 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/module.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/stx") 6 | (load-module "gerbil/expander/core") 7 | (load-module "gerbil/expander/top")) 8 | (load-module "gerbil/expander/module~0")) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/root.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/core") 6 | (load-module "gerbil/expander/top") 7 | (load-module "gerbil/expander/module") 8 | (load-module "gerbil/expander/compile")) 9 | (load-module "gerbil/expander/root~0")) 10 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/stx.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (load-module "gerbil/expander/common") 4 | (load-module "gerbil/expander/stx~0")) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/stxcase.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/stx") 6 | (load-module "gerbil/expander/core") 7 | (load-module "gerbil/expander/top")) 8 | (load-module "gerbil/expander/stxcase~0")) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/expander/top.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/expander/common") 5 | (load-module "gerbil/expander/stx") 6 | (load-module "gerbil/expander/core")) 7 | (load-module "gerbil/expander/top~0")) 8 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/gambit.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (begin)) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/gambit.ssi: -------------------------------------------------------------------------------- 1 | prelude: : 2 | package: gerbil 3 | namespace: gerbil/gambit 4 | 5 | (%#begin) 6 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/gambit.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/util") 5 | (load-module "gerbil/runtime/table") 6 | (load-module "gerbil/runtime/control") 7 | (load-module "gerbil/runtime/system") 8 | (load-module "gerbil/runtime/c3") 9 | (load-module "gerbil/runtime/mop") 10 | (load-module "gerbil/runtime/error") 11 | (load-module "gerbil/runtime/interface") 12 | (load-module "gerbil/runtime/hash") 13 | (load-module "gerbil/runtime/thread") 14 | (load-module "gerbil/runtime/syntax") 15 | (load-module "gerbil/runtime/eval") 16 | (load-module "gerbil/runtime/repl") 17 | (load-module "gerbil/runtime/loader") 18 | (load-module "gerbil/runtime/init")) 19 | (load-module "gerbil/runtime~0")) 20 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/c3.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (load-module "gerbil/runtime/util") (load-module "gerbil/runtime/c3~0")) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/c3.ssi: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/core 2 | package: gerbil/runtime 3 | namespace: #f 4 | 5 | (%#begin (%#export (spec: 0 c4-linearize c4-linearize)) 6 | (%#import :gerbil/runtime/util) 7 | (%#begin (%#define-runtime c4-linearize__% c4-linearize__%) 8 | (%#define-runtime c4-linearize__@ c4-linearize__@) 9 | (%#define-runtime c4-linearize c4-linearize))) 10 | (%#call (%#ref load-module) (%#quote "gerbil/runtime/c3~0")) 11 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/c3.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/runtime 3 | 4 | (begin 5 | (declare-type 6 | c4-linearize__% 7 | (@lambda 7 8 | #f 9 | signature: 10 | (return: 11 | values::t 12 | effect: 13 | #f 14 | arguments: 15 | #f 16 | unchecked: 17 | #f 18 | origin: 19 | gerbil/runtime/c3))) 20 | (declare-type 21 | c4-linearize__@ 22 | (@kw-lambda-dispatch 23 | (get-precedence-list: struct: eq: get-name:) 24 | c4-linearize__%)) 25 | (declare-type 26 | c4-linearize 27 | (@kw-lambda (get-name: struct: get-precedence-list: eq:) c4-linearize__@))) 28 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/control.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/table")) 7 | (load-module "gerbil/runtime/control~0")) 8 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/control.ssi: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/core 2 | package: gerbil/runtime 3 | namespace: #f 4 | 5 | (%#begin (%#import 6 | :gerbil/runtime/gambit 7 | :gerbil/runtime/util 8 | :gerbil/runtime/table) 9 | (%#export #t) 10 | (%#define-runtime make-promise make-promise) 11 | (%#define-runtime __make-promise __make-promise) 12 | (%#define-runtime call-with-parameters call-with-parameters) 13 | (%#define-runtime __call-with-parameters __call-with-parameters) 14 | (%#define-runtime with-unwind-protect with-unwind-protect) 15 | (%#define-runtime __with-unwind-protect __with-unwind-protect) 16 | (%#define-runtime keyword-dispatch keyword-dispatch) 17 | (%#define-runtime keyword-rest keyword-rest)) 18 | (%#call (%#ref load-module) (%#quote "gerbil/runtime/control~0")) 19 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/error.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/mop")) 7 | (load-module "gerbil/runtime/error~0")) 8 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/eval.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/mop") 7 | (load-module "gerbil/runtime/error") 8 | (load-module "gerbil/runtime/hash") 9 | (load-module "gerbil/runtime/syntax")) 10 | (load-module "gerbil/runtime/eval~0")) 11 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/gambit.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (begin) (load-module "gerbil/runtime/gambit~0")) 3 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/gambit.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/runtime 3 | 4 | (begin) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/gambit~0.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (define gerbil/runtime/gambit::timestamp 1742237310) 4 | (let () (declare (not safe)) (##void))) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/hash.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/table") 7 | (load-module "gerbil/runtime/mop") 8 | (load-module "gerbil/runtime/error") 9 | (load-module "gerbil/runtime/interface")) 10 | (load-module "gerbil/runtime/hash~0")) 11 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/init.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/system") 6 | (load-module "gerbil/runtime/util") 7 | (load-module "gerbil/runtime/loader") 8 | (load-module "gerbil/runtime/control") 9 | (load-module "gerbil/runtime/mop") 10 | (load-module "gerbil/runtime/mop-system-classes") 11 | (load-module "gerbil/runtime/error") 12 | (load-module "gerbil/runtime/interface") 13 | (load-module "gerbil/runtime/hash") 14 | (load-module "gerbil/runtime/thread") 15 | (load-module "gerbil/runtime/syntax") 16 | (load-module "gerbil/runtime/eval") 17 | (load-module "gerbil/runtime/repl")) 18 | (load-module "gerbil/runtime/init~0")) 19 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/interface.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/table") 7 | (load-module "gerbil/runtime/mop") 8 | (load-module "gerbil/runtime/error")) 9 | (load-module "gerbil/runtime/interface~0")) 10 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/loader.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/hash") 7 | (load-module "gerbil/runtime/thread")) 8 | (load-module "gerbil/runtime/loader~0")) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/mop-system-classes.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/mop")) 6 | (load-module "gerbil/runtime/mop-system-classes~0")) 7 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/mop.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/table") 7 | (load-module "gerbil/runtime/c3")) 8 | (load-module "gerbil/runtime/mop~0")) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/repl.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (load-module "gerbil/runtime/error") 4 | (load-module "gerbil/runtime/repl~0")) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/repl.ssi: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/core 2 | package: gerbil/runtime 3 | namespace: #f 4 | 5 | (%#begin (%#import :gerbil/runtime/error) (%#define-runtime replx replx)) 6 | (%#call (%#ref load-module) (%#quote "gerbil/runtime/repl~0")) 7 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/repl.ssxi.ss: -------------------------------------------------------------------------------- 1 | prelude: :gerbil/compiler/ssxi 2 | package: gerbil/runtime 3 | 4 | (declare-type 5 | replx 6 | (@lambda 0 7 | #f 8 | signature: 9 | (return: 10 | t::t 11 | effect: 12 | #f 13 | arguments: 14 | #f 15 | unchecked: 16 | #f 17 | origin: 18 | gerbil/runtime/repl))) 19 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/syntax.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/mop") 7 | (load-module "gerbil/runtime/error")) 8 | (load-module "gerbil/runtime/syntax~0")) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/system.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/control")) 7 | (load-module "gerbil/runtime/system~0")) 8 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/table.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util")) 6 | (load-module "gerbil/runtime/table~0")) 7 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/thread.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (begin 4 | (load-module "gerbil/runtime/gambit") 5 | (load-module "gerbil/runtime/util") 6 | (load-module "gerbil/runtime/error") 7 | (load-module "gerbil/runtime/hash")) 8 | (load-module "gerbil/runtime/thread~0")) 9 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime/util.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin 3 | (load-module "gerbil/runtime/gambit") 4 | (load-module "gerbil/runtime/util~0")) 5 | -------------------------------------------------------------------------------- /src/bootstrap/gerbil/runtime~0.scm: -------------------------------------------------------------------------------- 1 | (declare (block) (standard-bindings) (extended-bindings)) 2 | (begin (define gerbil/runtime::timestamp 1742237312) '#!void) 3 | -------------------------------------------------------------------------------- /src/build/build0.scm: -------------------------------------------------------------------------------- 1 | (load "build/build0-lib.scm") 2 | 3 | (parallel-build 4 | (call-with-input-file ".build.stage0" read-all-as-lines) 5 | (compiler '("-e" "(include \"~~lib/_gambit#.scm\")")) 6 | false) 7 | -------------------------------------------------------------------------------- /src/gerbil/builtin-inline-rules.ssxi.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; :gerbil/core prelude ssxi 4 | prelude: :gerbil/compiler/ssxi 5 | package: gerbil 6 | 7 | ;; inline rules for runtime primitives 8 | (declare-inline-rules! 9 | (identity 10 | (ast-rules (%#call) 11 | ((%#call _ arg) 12 | arg))) 13 | (cons* 14 | (ast-rules (%#call) 15 | ((%#call _ x y) 16 | (%#call (%#ref cons) x y)) 17 | ((%#call recur x y rest ...) 18 | (%#call (%#ref cons) x (%#call recur y rest ...)))))) 19 | -------------------------------------------------------------------------------- /src/gerbil/compiler.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; gerbil -> gambc compiler 4 | prelude: "core" 5 | package: gerbil 6 | namespace: gxc 7 | 8 | (import "compiler/driver" 9 | "compiler/base") 10 | (export (import: "compiler/driver") 11 | add-compile-job! 12 | execute-pending-compile-jobs!) 13 | -------------------------------------------------------------------------------- /src/gerbil/core/macro-object.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; gerbil core prelude: macro objects 4 | ;;; 5 | prelude: : 6 | package: gerbil/core 7 | 8 | (import "runtime" "expander" "sugar" "mop" 9 | (phi: +1 "runtime")) 10 | (export #t) 11 | 12 | (defclass macro-object (macro) 13 | id: gerbil.core#macro-object::t) 14 | 15 | (defmethod {apply-macro-expander macro-object} 16 | (lambda (self stx) 17 | (core-apply-expander (macro-object-macro self) stx))) 18 | -------------------------------------------------------------------------------- /src/gerbil/core/more-syntax-sugar.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; gerbil core prelude: more syntactic sugar 4 | ;;; 5 | prelude: : 6 | package: gerbil/core 7 | 8 | (import "expander" "sugar" "more-sugar" 9 | (phi: +1 "runtime")) 10 | (export #t) 11 | 12 | (defrules identifier-rules () 13 | ((_ . body) 14 | (make-setq-macro 15 | macro: (syntax-rules . body)))) 16 | 17 | ;; TODO Not Implemented Yet -- barf 18 | (defrules quasisyntax ()) 19 | -------------------------------------------------------------------------------- /src/gerbil/expander/init.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; gerbil.expander initialization 4 | prelude: "../core" 5 | package: gerbil/expander 6 | namespace: gx 7 | 8 | (import "../runtime" "core" "module" "top" "root") 9 | 10 | (current-expander-context (make-top-context)) 11 | (current-expander-module-import core-import-module) 12 | (current-expander-module-eval core-eval-module) 13 | (current-expander-compile __compile-top) 14 | (current-expander-eval ##eval) 15 | (core-bind-root-syntax! ': (make-prelude-context #f) #t) 16 | -------------------------------------------------------------------------------- /src/gerbil/gambit.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; Compatibility shim until release. 4 | ;;; TODO this module can be removed after v0.18.2 5 | ;;; 6 | prelude: : 7 | package: gerbil 8 | -------------------------------------------------------------------------------- /src/gerbil/interactive/init.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Gerbil interactive environment initialization 4 | 5 | ;; Pleasantly greet user 6 | (displayln (gerbil-greeting)) 7 | 8 | ;; Interactive development utilities 9 | (import :std/interactive) 10 | 11 | ;; hook the repl path normalization -- it breaks buffer location popping 12 | ;; in gerbil mode for out of tree sources 13 | (when (getenv "EMACS" #f) 14 | (set! ##repl-path-normalize-hook identity)) 15 | -------------------------------------------------------------------------------- /src/gerbil/interactive/r7rs-init.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Gerbil interactive environment initialization 4 | 5 | ;; Pleasantly greet user 6 | (displayln "R7RS Scheme in " (gerbil-system-version-string)) 7 | -------------------------------------------------------------------------------- /src/gerbil/runtime/repl.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; Gerbil runtime repl utilities 4 | prelude: "../core" 5 | package: gerbil/runtime 6 | namespace: #f 7 | 8 | (import "error") 9 | 10 | ;; introspection repl: this is part of the runtime so that it is 11 | ;; available to all binaries. 12 | ;; Starts a nested repl with an exception handler that nests a repl 13 | ;; within, so that it can handle introspection exceptions regardless of 14 | ;; exception handler in the inspsected thread 15 | (define (replx) 16 | (define (write-reason exn) 17 | (lambda (cont port) 18 | (##display-exception-in-context exn cont port) 19 | #f)) 20 | 21 | (with-exception-handler 22 | (lambda (exn) 23 | (##continuation-capture 24 | (lambda (cont) 25 | (##repl-within cont (write-reason exn) exn)))) 26 | ##repl)) 27 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/bad-return-type.ss: -------------------------------------------------------------------------------- 1 | (def (bad x y) => :procedure 2 | (cons x y)) 3 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/class-after-use.ss: -------------------------------------------------------------------------------- 1 | (def (use-it) 2 | (lambda ((obj : A)) 3 | => A 4 | obj.x)) 5 | 6 | (deftype @A A) 7 | (defclass A ((x :? @A))) 8 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/deep-dots.ss: -------------------------------------------------------------------------------- 1 | (import :std/test) 2 | 3 | (deftype @B B) 4 | (deftype @C C) 5 | (defclass A ((x : @B))) 6 | (defclass B ((y : @C))) 7 | (defclass C (z)) 8 | 9 | (defmethod {do-it C} 10 | (lambda (self a b) 11 | (+ (* a self.z) b))) 12 | 13 | (def (main) 14 | (let* ((c (C z: 3)) 15 | (b (B y: c)) 16 | (a (A x: b))) 17 | (using (a :- A) 18 | (check a.x => b) 19 | (check a.x.y => c) 20 | (check {a.x.y.do-it 1 2} => 5)))) 21 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: test) 2 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/interface-mixin.ss: -------------------------------------------------------------------------------- 1 | (import :std/io) 2 | 3 | (interface (TestMixin Reader Writer)) 4 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/issue-1144.ss: -------------------------------------------------------------------------------- 1 | (defstruct Foo (a b)) 2 | (defmethod {frob Foo} 3 | (lambda (self) 4 | (Foo-b self) 5 | (def x (Foo-a self)) 6 | 0)) 7 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/mutable-binding-type-2.ss: -------------------------------------------------------------------------------- 1 | (import :std/test) 2 | (def *nums* #f) 3 | 4 | (def (get-nums) 5 | (unless *nums* 6 | (set! *nums* (list->vector (iota 10)))) 7 | *nums*) 8 | 9 | (def (foo) 10 | (let* ((nums (get-nums)) 11 | (len (vector-length nums)) 12 | (i (random-integer len))) 13 | (vector-ref nums i))) 14 | 15 | (def (main) 16 | (check (foo) ? integer?)) 17 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/mutable-binding-type-3.ss: -------------------------------------------------------------------------------- 1 | (import :std/test) 2 | (def *nums* #f) 3 | 4 | (def (get-nums) 5 | (unless *nums* 6 | (set! *nums* (list->vector (iota 10)))) 7 | *nums*) 8 | 9 | (def (foo) 10 | (let* ((nums (get-nums2)) 11 | (len (vector-length nums)) 12 | (i (random-integer len))) 13 | (vector-ref nums i))) 14 | 15 | (def (get-nums2) 16 | (apply get-nums [])) 17 | 18 | (def (main) 19 | (check (foo) ? integer?)) 20 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/mutable-binding-type.ss: -------------------------------------------------------------------------------- 1 | (def var []) 2 | 3 | (def (get-var) => :list 4 | var) 5 | 6 | (def (set-var! (o : :list)) 7 | (set! var o)) 8 | 9 | (def (set-vars! . args) 10 | (set! var args)) 11 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/non-procedure-1.ss: -------------------------------------------------------------------------------- 1 | (let (bad 1) 2 | (bad 1 2 3)) 3 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/non-procedure-2.ss: -------------------------------------------------------------------------------- 1 | (let (bad (cons 1 2)) 2 | (bad 1 2 3)) 3 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/non-procedure-3.ss: -------------------------------------------------------------------------------- 1 | (def (bad (p : :fixnum)) 2 | (p 1 2 3)) 3 | -------------------------------------------------------------------------------- /src/gerbil/test/compiler-test-support/non-procedure-4.ss: -------------------------------------------------------------------------------- 1 | (def (bad) 2 | ((badder) 1 2 3)) 3 | 4 | (def (badder) 5 | (cons 1 2)) 6 | -------------------------------------------------------------------------------- /src/gerbil/test/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: test) 2 | -------------------------------------------------------------------------------- /src/gerbil/test/test-build-exe.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | (defbuild-script 4 | '("test-lib" 5 | (exe: "test-program"))) 6 | -------------------------------------------------------------------------------- /src/gerbil/test/test-build-optimized-exe.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | (defbuild-script 4 | '("test-lib" 5 | (optimized-exe: "test-program"))) 6 | -------------------------------------------------------------------------------- /src/gerbil/test/test-build-optimized-static-exe.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | (defbuild-script 4 | '("test-lib" 5 | (optimized-static-exe: "test-program"))) 6 | -------------------------------------------------------------------------------- /src/gerbil/test/test-build-static-exe.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | (defbuild-script 4 | '("test-lib" 5 | (static-exe: "test-program"))) 6 | -------------------------------------------------------------------------------- /src/gerbil/test/test-lib.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; gxc compilation test program 4 | (export #t) 5 | 6 | (def (greeting what) 7 | (displayln "hello " what)) 8 | -------------------------------------------------------------------------------- /src/gerbil/test/test-program.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; gxc compilation test program 4 | (import "test-lib") 5 | (export main) 6 | 7 | (def (main) 8 | (greeting (gerbil-system-version-string))) 9 | -------------------------------------------------------------------------------- /src/lang/gerbil.pkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mighty-gerbils/gerbil/e55e0806a77f7364c649dbd99ada5972b6f90689/src/lang/gerbil.pkg -------------------------------------------------------------------------------- /src/lang/scheme/case-lambda.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme case-lambda) library 4 | (export case-lambda) 5 | -------------------------------------------------------------------------------- /src/lang/scheme/char.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme char) library 4 | (extern namespace: #f 5 | digit-value 6 | char-foldcase 7 | string-foldcase 8 | string-upcase 9 | string-downcase) 10 | (export 11 | char-alphabetic? 12 | char-ci<=? 13 | char-ci=? 16 | char-ci>? 17 | char-downcase 18 | char-foldcase 19 | char-lower-case? 20 | char-numeric? 21 | char-upcase 22 | char-upper-case? 23 | char-whitespace? 24 | digit-value 25 | string-ci<=? 26 | string-ci=? 29 | string-ci>? 30 | string-downcase 31 | string-foldcase 32 | string-upcase) 33 | -------------------------------------------------------------------------------- /src/lang/scheme/complex.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme complex) library 4 | (export 5 | angle 6 | magnitude 7 | make-rectangular 8 | imag-part 9 | make-polar 10 | real-part 11 | ) 12 | -------------------------------------------------------------------------------- /src/lang/scheme/cxr.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme cxr) library 4 | (export 5 | caaaar 6 | caaadr 7 | caaar 8 | caadar 9 | caaddr 10 | caadr 11 | cadaar 12 | cadadr 13 | cadar 14 | caddar 15 | cadddr 16 | caddr 17 | cdaaar 18 | cdaadr 19 | cdaar 20 | cdadar 21 | cdaddr 22 | cdadr 23 | cddaar 24 | cddadr 25 | cddar 26 | cdddar 27 | cddddr 28 | cdddr 29 | ) 30 | -------------------------------------------------------------------------------- /src/lang/scheme/eval.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme eval) library 4 | (import ./eval-impl) 5 | 6 | (export 7 | (rename: r7rs-eval eval) 8 | (rename: r7rs-environment environment)) 9 | -------------------------------------------------------------------------------- /src/lang/scheme/file.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme file) library 4 | (export 5 | call-with-input-file 6 | call-with-output-file 7 | delete-file 8 | file-exists? 9 | open-binary-input-file 10 | open-binary-output-file 11 | open-input-file 12 | open-output-file 13 | with-input-from-file 14 | with-output-to-file 15 | ) 16 | 17 | (cond-expand 18 | (,(> (system-version) 409002) 19 | (extern namespace: #f 20 | open-binary-input-file 21 | open-binary-output-file)) 22 | (else 23 | (defalias open-binary-input-file open-input-file) 24 | (defalias open-binary-output-file open-output-file))) 25 | -------------------------------------------------------------------------------- /src/lang/scheme/inexact.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme inexact) library 4 | (export 5 | acos 6 | asin 7 | atan 8 | cos 9 | exp 10 | finite? 11 | infinite? 12 | log 13 | nan? 14 | sin 15 | sqrt 16 | tan 17 | ) -------------------------------------------------------------------------------- /src/lang/scheme/lazy-impl.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme lazy) library -- implementation details 4 | (import :std/lazy) 5 | (export #t force delay (rename: lazy delay-force)) 6 | 7 | (def (r7rs-make-promise obj) 8 | (eager obj)) 9 | 10 | (def (r7rs-promise? obj) 11 | (or (lazy? obj) (promise? obj))) 12 | -------------------------------------------------------------------------------- /src/lang/scheme/lazy.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme inexact) library 4 | (import ./lazy-impl) 5 | (export 6 | force delay delay-force 7 | (rename: r7rs-make-promise make-promise) 8 | (rename: r7rs-promise? promise?)) 9 | -------------------------------------------------------------------------------- /src/lang/scheme/load-impl.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme load) library -- implementation details 4 | (import ./repl-impl 5 | :gerbil/expander) 6 | (export #t) 7 | 8 | (def (r7rs-load path (env (r7rs-interaction-environment))) 9 | ;; bypass the load hook (used for loading raw Gambit source) 10 | (parameterize ((current-expander-context env)) 11 | (##load path (lambda args #f) #t #t #f))) 12 | -------------------------------------------------------------------------------- /src/lang/scheme/load.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme load) library 4 | (import ./load-impl) 5 | (export 6 | (rename: r7rs-load load)) 7 | -------------------------------------------------------------------------------- /src/lang/scheme/process-context-impl.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme process-context) library -- implementation details 4 | (export #t) 5 | 6 | (def (r7rs-exit (normally? #t)) 7 | (exit (if normally? 0 1))) 8 | -------------------------------------------------------------------------------- /src/lang/scheme/process-context.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme process-context) library 4 | (import :gerbil/gambit 5 | ./process-context-impl) 6 | 7 | (extern namespace: #f 8 | emergency-exit 9 | get-environment-variable 10 | get-environment-variables) 11 | (export 12 | command-line 13 | emergency-exit 14 | (rename: r7rs-exit exit) 15 | get-environment-variable 16 | get-environment-variables) 17 | -------------------------------------------------------------------------------- /src/lang/scheme/r5rs-null.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS r5rs-null environment imports 4 | (import ./r5rs) 5 | (export 6 | begin define lambda if let let* letrec set! quote 7 | and or case cond do delay 8 | define-syntax let-syntax letrec-syntax 9 | (phi: +1 syntax-rules)) 10 | -------------------------------------------------------------------------------- /src/lang/scheme/read.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme read) library 4 | (export read) 5 | -------------------------------------------------------------------------------- /src/lang/scheme/repl.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme repl) library 4 | (import ./repl-impl) 5 | (export 6 | (rename: r7rs-interaction-environment interaction-environment) 7 | (rename: r7rs-null-environment null-environment) 8 | (rename: r7rs-scheme-report-environment scheme-report-environment)) 9 | -------------------------------------------------------------------------------- /src/lang/scheme/time.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme time) library 4 | (extern namespace: #f 5 | current-jiffy 6 | current-second 7 | jiffies-per-second) 8 | (export #t) 9 | -------------------------------------------------------------------------------- /src/lang/scheme/write.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; R7RS (scheme write) library 4 | (extern namespace: #f 5 | write-simple write-shared) 6 | (export 7 | display 8 | write 9 | write-shared 10 | write-simple) 11 | -------------------------------------------------------------------------------- /src/misc/http-perf/.gitignore: -------------------------------------------------------------------------------- 1 | baseline 2 | hellod 3 | -------------------------------------------------------------------------------- /src/misc/http-perf/ab100k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ab -c 10 -n 100000 127.0.0.1:8080/ 4 | -------------------------------------------------------------------------------- /src/misc/http-perf/ab10k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ab -c 10 -n 10000 127.0.0.1:8080/ 4 | -------------------------------------------------------------------------------- /src/misc/http-perf/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | 4 | (import :std/make) 5 | 6 | (def build-spec 7 | '((exe: "hellod") 8 | (exe: "baseline"))) 9 | 10 | (def build-spec-static 11 | '((static-exe: "hellod" 12 | "-cc-options" "--param max-gcse-memory=300000000" 13 | "-prelude" "(declare (not safe))") 14 | (static-exe: "baseline" 15 | "-prelude" "(declare (not safe))"))) 16 | 17 | (def srcdir (path-normalize (path-directory (this-source-file)))) 18 | 19 | (def (main . args) 20 | (match args 21 | (["static"] 22 | (make srcdir: srcdir 23 | bindir: srcdir 24 | build-spec-static)) 25 | ([] 26 | (make srcdir: srcdir 27 | bindir: srcdir 28 | build-spec)))) 29 | -------------------------------------------------------------------------------- /src/misc/http-perf/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: misc/http-perf) 2 | -------------------------------------------------------------------------------- /src/misc/http-perf/httperf100k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | httperf --hog --server localhost --port 8080 --num-conn 100000 4 | -------------------------------------------------------------------------------- /src/misc/http-perf/httperf100kses: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | httperf --hog --server localhost --port 8080 --wsess 1000,100,0 4 | -------------------------------------------------------------------------------- /src/misc/http-perf/httperf10k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | httperf --hog --server localhost --port 8080 --num-conn 10000 4 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/baseline-buffer100k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for x in {1..10}; do 3 | ./baseline-buffer client 10000 & 4 | done 5 | wait 6 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/baseline-buffer1M: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for x in {1..10}; do 3 | ./baseline-buffer client 100000 & 4 | done 5 | wait 6 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/baseline-io1M: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for x in {1..10}; do 3 | ./baseline-io client 100000 & 4 | done 5 | wait 6 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/baseline-port100k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for x in {1..10}; do 3 | ./baseline-port client 10000 & 4 | done 5 | wait 6 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | 4 | (import :std/make) 5 | 6 | (def build-spec 7 | '((exe: "baseline-port") 8 | (exe: "baseline-buffer") 9 | (exe: "baseline-io") 10 | (exe: "nullproto"))) 11 | 12 | (def build-spec-static 13 | '((static-exe: "nullproto" 14 | "-ld-options" "-lcrypto" 15 | "-prelude" "(declare (not safe))"))) 16 | 17 | (def srcdir (path-normalize (path-directory (this-source-file)))) 18 | 19 | (def (main . args) 20 | (match args 21 | (["static"] 22 | (make srcdir: srcdir 23 | bindir: srcdir 24 | build-spec-static)) 25 | ([] 26 | (make srcdir: srcdir 27 | bindir: srcdir 28 | build-spec)))) 29 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: misc/rpc-perf) 2 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/nullproto100k: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for x in {1..10}; do 3 | ./nullproto client 10000 & 4 | done 5 | wait 6 | -------------------------------------------------------------------------------- /src/misc/rpc-perf/nullproto1M: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for x in {1..10}; do 3 | ./nullproto client 100000 & 4 | done 5 | wait 6 | -------------------------------------------------------------------------------- /src/misc/scripts/docsnarf.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;;; -*- Gerbil -*- 3 | ;;; Given a scheme source file, dump the defined symbols 4 | ;;; It could be clever and only dump exports, but kiss. 5 | 6 | (def (main file) 7 | (call-with-input-file file 8 | (lambda (port) 9 | (for-each 10 | snarf-symbol! 11 | (read-all port read))))) 12 | 13 | (def (snarf-symbol! token) 14 | (def (snarf! head) 15 | (match head 16 | ([(? symbol? id) . args] 17 | (displayln id)) 18 | ((? symbol? id) 19 | (displayln id)) 20 | (else (void)))) 21 | 22 | (match token 23 | ([defn head . body] 24 | (case defn 25 | ((def def* define defstruct defclass defsyntax defrules) 26 | (snarf! head)))) 27 | (else (void)))) 28 | -------------------------------------------------------------------------------- /src/misc/scripts/docsyms.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;;; -*- Gerbil -*- 3 | ;;; Given a module, list the exported symbols 4 | 5 | (import 6 | :std/iter) 7 | 8 | (def (main mod) 9 | (let* ((seen (make-hash-table-eq)) 10 | (ctx (import-module (string->symbol mod))) 11 | (exports (module-context-export ctx))) 12 | (for (x (reverse exports)) 13 | (let (name (module-export-name x)) 14 | (unless (hash-key? seen name) 15 | (hash-put! seen name #t) 16 | (displayln name)))))) 17 | -------------------------------------------------------------------------------- /src/r7rs-large/gerbil.pkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mighty-gerbils/gerbil/e55e0806a77f7364c649dbd99ada5972b6f90689/src/r7rs-large/gerbil.pkg -------------------------------------------------------------------------------- /src/r7rs-large/scheme/bitwise.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/bitwise -- R7RS TANGERINE bitwise operations library 4 | 5 | (import :std/srfi/151) 6 | (export (import: :std/srfi/151)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/box.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/box -- R7RS RED box library 4 | 5 | (export box box? unbox set-box!) 6 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/charset.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/charset -- R7RS RED charset library 4 | 5 | (import :std/srfi/14) 6 | (export (import: :std/srfi/14)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/comparator.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/comparator -- R7RS RED comparator library 4 | 5 | (import :std/srfi/128) 6 | (export (import: :std/srfi/128)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/division.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/division -- R7RS TANGERINE integer division library 4 | 5 | (import :std/srfi/141) 6 | (export (import: :std/srfi/141)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/ephemeron.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/ephemeron -- R7RS RED ephemeron library 4 | 5 | (import :std/srfi/124) 6 | (export (import: :std/srfi/124)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/fixnum.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/fixnum -- R7RS TANGERINE fixnum library 4 | 5 | (import :std/srfi/143) 6 | (export (import: :std/srfi/143)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/flonum.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/flonum -- R7RS TANGERINE flonum library 4 | 5 | (import :std/srfi/144) 6 | (export (import: :std/srfi/144)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/generator.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/generator -- R7RS RED/TANGERINE generator library 4 | 5 | (import :std/srfi/158) 6 | (export (import: :std/srfi/158)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/hash-table.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/hash-table -- R7RS RED hash table library 4 | 5 | (import :std/srfi/125) 6 | (export (import: :std/srfi/125)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/ideque.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/ideque -- R7RS RED immutable deque library 4 | 5 | (import :std/srfi/134) 6 | (export (import: :std/srfi/134)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/ilist.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/ilist -- R7RS RED immutable list library 4 | 5 | (import :std/srfi/116) 6 | (export (import: :std/srfi/116)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/list-queue.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/list-queue -- R7RS RED list queue library 4 | 5 | (import :std/srfi/117) 6 | (export (import: :std/srfi/117)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/list.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/list -- R7RS RED list library 4 | 5 | (import :std/srfi/1) 6 | (export (import: :std/srfi/1)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/lseq.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/lseq -- R7RS RED lazy sequence library 4 | 5 | (import :std/srfi/127) 6 | (export (import: :std/srfi/127)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/mapping.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/mapping -- R7RS TANGERINE mappings library 4 | 5 | (import :std/srfi/146) 6 | (export (import: :std/srfi/146)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/mapping/hash.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/mapping/hash -- R7RS TANGERINE hash mappings library 4 | 5 | (import :std/srfi/146/hash) 6 | (export (import: :std/srfi/146/hash)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/regex.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/regex -- R7RS TANGERINE regular expressions library 4 | 5 | (import :std/srfi/115) 6 | (export (import: :std/srfi/115)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/rlist.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/rlist -- R7RS RED random access list library 4 | 5 | (import :std/srfi/101) 6 | (export (import: :std/srfi/101)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/set.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/set -- R7RS RED set library 4 | 5 | (import :std/srfi/113) 6 | (export (import: :std/srfi/113)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/show.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/show -- R7RS TANGERINE combinator formatting library 4 | 5 | (import :std/srfi/159) 6 | (export (import: :std/srfi/159)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/sort.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/sort -- R7RS RED sort library 4 | 5 | (import :std/srfi/132) 6 | (export (import: :std/srfi/132)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/stream.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/stream -- R7RS RED stream library 4 | 5 | (import :std/srfi/41) 6 | (export (import: :std/srfi/41)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/text.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/text -- R7RS RED immutable text library 4 | 5 | (import :std/srfi/135) 6 | (export (import: :std/srfi/135)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; :scheme/vector -- R7RS RED vector library 4 | 5 | (import :std/srfi/133) 6 | (export (import: :std/srfi/133)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/base.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/bitwise -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/base) 6 | (export (import: :std/srfi/160/base)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/c128.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/c128 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/c128) 6 | (export (import: :std/srfi/160/c128)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/c64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/c64 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/c64) 6 | (export (import: :std/srfi/160/c64)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/f32.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/f32 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/f32) 6 | (export (import: :std/srfi/160/f32)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/f64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/f64 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/f64) 6 | (export (import: :std/srfi/160/f64)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/s16.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/s16 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/s16) 6 | (export (import: :std/srfi/160/s16)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/s32.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/s32 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/s32) 6 | (export (import: :std/srfi/160/s32)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/s64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/s64 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/s64) 6 | (export (import: :std/srfi/160/s64)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/s8.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/s8 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/s8) 6 | (export (import: :std/srfi/160/s8)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/u16.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/u16 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/u16) 6 | (export (import: :std/srfi/160/u16)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/u32.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/u32 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/u32) 6 | (export (import: :std/srfi/160/u32)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/u64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/u64 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/u64) 6 | (export (import: :std/srfi/160/u64)) 7 | -------------------------------------------------------------------------------- /src/r7rs-large/scheme/vector/u8.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :scheme/vector/u8 -- R7RS TANGERINE Numeric vectors library 4 | 5 | (import :std/srfi/160/u8) 6 | (export (import: :std/srfi/160/u8)) 7 | -------------------------------------------------------------------------------- /src/srfi/1.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/1) (export (import: :std/srfi/1)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/101.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/101) (export (import: :std/srfi/101)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/113.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/113) (export (import: :std/srfi/113)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/115.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/115) (export (import: :std/srfi/115)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/116.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/116) (export (import: :std/srfi/116)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/117.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/117) (export (import: :std/srfi/117)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/121.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/121) (export (import: :std/srfi/121)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/124.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/124) (export (import: :std/srfi/124)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/127.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/127) (export (import: :std/srfi/127)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/128.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/128) (export (import: :std/srfi/128)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/13.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/13) (export (import: :std/srfi/13)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/130.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/130) (export (import: :std/srfi/130)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/132.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/132) (export (import: :std/srfi/132)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/133.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/133) (export (import: :std/srfi/133)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/134.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/134) (export (import: :std/srfi/134)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/135.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/135) (export (import: :std/srfi/135)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/14.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/14) (export (import: :std/srfi/14)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/141.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/141) (export (import: :std/srfi/141)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/143.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/143) (export (import: :std/srfi/143)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/144.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/144) (export (import: :std/srfi/144)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/145.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/145) (export (import: :std/srfi/145)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/146.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/146) (export (import: :std/srfi/146)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/146/hamt-map.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/146/hamt-map) (export (import: :std/srfi/146/hamt-map)) 2 | -------------------------------------------------------------------------------- /src/srfi/146/hamt-misc.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/146/hamt-misc) (export (import: :std/srfi/146/hamt-misc)) 2 | -------------------------------------------------------------------------------- /src/srfi/146/hamt.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/146/hamt) (export (import: :std/srfi/146/hamt)) 2 | -------------------------------------------------------------------------------- /src/srfi/146/hash.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/146/hash) (export (import: :std/srfi/146/hash)) 2 | -------------------------------------------------------------------------------- /src/srfi/146/vector-edit.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/146/vector-edit) (export (import: :std/srfi/146/vector-edit)) 2 | -------------------------------------------------------------------------------- /src/srfi/151.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/151) (export (import: :std/srfi/151)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/158.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/158) (export (import: :std/srfi/158)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/159.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159) (export (import: :std/srfi/159)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/159/base.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/base) (export (import: :std/srfi/159/base)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/color.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/color) (export (import: :std/srfi/159/color)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/columnar.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/columnar) (export (import: :std/srfi/159/columnar)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/environment.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/environment) (export (import: :std/srfi/159/environment)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/pretty.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/pretty) (export (import: :std/srfi/159/pretty)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/show.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/show) (export (import: :std/srfi/159/show)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/string.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/string) (export (import: :std/srfi/159/string)) 2 | -------------------------------------------------------------------------------- /src/srfi/159/unicode.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/159/unicode) (export (import: :std/srfi/159/unicode)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/base.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/base) (export (import: :std/srfi/160/base)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/c128.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/c128) (export (import: :std/srfi/160/c128)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/c64.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/c64) (export (import: :std/srfi/160/c64)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/f32.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/f32) (export (import: :std/srfi/160/f32)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/f64.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/f64) (export (import: :std/srfi/160/f64)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/s16.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/s16) (export (import: :std/srfi/160/s16)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/s32.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/s32) (export (import: :std/srfi/160/s32)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/s64.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/s64) (export (import: :std/srfi/160/s64)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/s8.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/s8) (export (import: :std/srfi/160/s8)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/u16.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/u16) (export (import: :std/srfi/160/u16)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/u32.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/u32) (export (import: :std/srfi/160/u32)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/u64.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/u64) (export (import: :std/srfi/160/u64)) 2 | -------------------------------------------------------------------------------- /src/srfi/160/u8.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/160/u8) (export (import: :std/srfi/160/u8)) 2 | -------------------------------------------------------------------------------- /src/srfi/19.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/19) (export (import: :std/srfi/19)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/212.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/212) (export (import: :std/srfi/212)) -------------------------------------------------------------------------------- /src/srfi/41.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/41) (export (import: :std/srfi/41)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/42.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/42) (export (import: :std/srfi/42)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/43.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/43) (export (import: :std/srfi/43)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/78.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/78) (export (import: :std/srfi/78)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/8.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/8) (export (import: :std/srfi/8)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/9.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/9) (export (import: :std/srfi/9)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/95.ss: -------------------------------------------------------------------------------- 1 | (import :std/srfi/95) (export (import: :std/srfi/95)) 2 | 3 | -------------------------------------------------------------------------------- /src/srfi/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: srfi) 2 | -------------------------------------------------------------------------------- /src/std/actor-v13.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo 3 | ;;; v13 actor package interface; DEPRECATED. 4 | 5 | (import ./deprecation 6 | ./actor-v13/message 7 | ./actor-v13/proto 8 | ./actor-v13/rpc) 9 | (export (import: ./actor-v13/message 10 | ./actor-v13/proto 11 | ./actor-v13/rpc)) 12 | 13 | (package-deprecation-warning!) 14 | -------------------------------------------------------------------------------- /src/std/actor-v13/rpc.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo 3 | ;;; actor rpc interface 4 | 5 | ;;; --- DEPRECATED ---- 6 | 7 | (import ./rpc/server) 8 | (export (import: ./rpc/server)) 9 | -------------------------------------------------------------------------------- /src/std/actor-v18/loader-test-support.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; actor loader test compiled support 4 | package: test/actor-v18 5 | (def (hello greeting) 6 | (cons 'hello greeting)) 7 | -------------------------------------------------------------------------------- /src/std/actor-v18/logger.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; actor ensemble logger 4 | (import :std/logger) 5 | (export #t) 6 | 7 | (deflogger ensemble) 8 | -------------------------------------------------------------------------------- /src/std/actor.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; actor package 4 | (import ./actor-v18/api) 5 | (export (import: ./actor-v18/api)) 6 | -------------------------------------------------------------------------------- /src/std/assert-test.ss: -------------------------------------------------------------------------------- 1 | (export assert-test) 2 | (import :std/test 3 | :std/assert 4 | :std/pregexp) 5 | 6 | (def assert-test 7 | (test-suite "test :std/assert" 8 | (test-case "test assert! failure message" 9 | (def e 'needle) 10 | (def l ['stack 'of 'hay]) 11 | (check-exception (assert! (member e l)) 12 | (lambda (e) (string-prefix? "Assertion failed" (error-message e)))) 13 | 14 | (test-case "test assert! on keyword functions" 15 | (assert! (true 0 a: 1)) 16 | (check-exception (assert! (false 0 a: 1)) 17 | (lambda (e) 18 | (string-prefix? "Assertion failed" (error-message e)))))))) 19 | -------------------------------------------------------------------------------- /src/std/build-features.ss: -------------------------------------------------------------------------------- 1 | ;; This file is meant to be include'd by build-config.ss 2 | 3 | ;; build deprecated packaages 4 | (enable deprecated #f) 5 | 6 | ;; build std/text/zlib library - requires zlib 7 | (enable zlib #t) 8 | 9 | ;; build std/db/sqlite library -- requires sqlite3 10 | (enable sqlite #t) 11 | -------------------------------------------------------------------------------- /src/std/build-std.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) fare 3 | ;;; Inner build file for std, as specially imported and called by ./build.ss for bootstrap reasons 4 | 5 | (import "build-config" "make") 6 | (include "build-spec.ss") 7 | 8 | (def (build . args) (apply make (apply build-spec args) args)) 9 | -------------------------------------------------------------------------------- /src/std/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | 4 | (def srcdir (path-normalize (path-directory (this-source-file)))) 5 | (def libdir (path-expand "lib" (getenv "GERBIL_BUILD_PREFIX" (gerbil-home)))) 6 | (add-load-path! srcdir) 7 | 8 | (let (gambit-sharp 9 | (path-expand "lib/_gambit#.scm" 10 | (getenv "GERBIL_BUILD_PREFIX" (gerbil-home)))) 11 | (eval `(begin-foreign (include ,gambit-sharp)))) 12 | 13 | ;; The indirection below allows the build-std to do its imports in a module context, transitively 14 | (gx#import-module "build-std.ss" #t #t) 15 | ((eval 'std/build-std#build) 16 | srcdir: srcdir libdir: libdir debug: #t) 17 | -------------------------------------------------------------------------------- /src/std/contract.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; backwards compatibilty shim; will be removed for v0.19 4 | (export using 5 | with-interface with-class with-contract 6 | maybe list-of? in-range? in-range-inclusive? nonnegative-fixnum?) 7 | -------------------------------------------------------------------------------- /src/std/coroutine-test.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :std/coroutine unit-test 4 | 5 | (import :std/test 6 | :std/coroutine) 7 | (export coroutine-test) 8 | 9 | (def (1-to-n n) 10 | (let lp ((i 1)) 11 | (when (<= i n) 12 | (yield i) 13 | (lp (1+ i)))) 14 | 'end) 15 | 16 | (def (collect co) 17 | (let lp ((r [])) 18 | (let (next (continue co)) 19 | (if (eq? next 'end) 20 | (reverse r) 21 | (lp (cons next r)))))) 22 | 23 | (def coroutine-test 24 | (test-suite "test :std/coroutine" 25 | (test-case "test coroutine" 26 | (check (collect (coroutine 1-to-n 10)) => '(1 2 3 4 5 6 7 8 9 10))) 27 | (test-case "test cothread" 28 | (check (collect (cothread 1-to-n 10)) => '(1 2 3 4 5 6 7 8 9 10))))) 29 | -------------------------------------------------------------------------------- /src/std/crypto.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo 3 | ;;; std libcrypto interface 4 | 5 | (import (only-in :std/crypto/etc random-bytes random-bytes! libcrypto-error?) 6 | :std/crypto/digest 7 | :std/crypto/cipher 8 | :std/crypto/hmac 9 | :std/crypto/dh 10 | :std/crypto/bn 11 | :std/crypto/pkey 12 | :std/crypto/kdf) 13 | (export (import: :std/crypto/etc 14 | :std/crypto/digest 15 | :std/crypto/cipher 16 | :std/crypto/hmac 17 | :std/crypto/dh 18 | :std/crypto/bn 19 | :std/crypto/pkey 20 | :std/crypto/kdf)) 21 | -------------------------------------------------------------------------------- /src/std/crypto/bn.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; libcrypto bignum utils 4 | 5 | (import :std/error 6 | ./libcrypto 7 | ./etc) 8 | (export #t) 9 | 10 | (def (BN->bytes bn) 11 | (let* ((bytes (make-u8vector (BN_num_bytes bn))) 12 | (count (BN_bn2bin bn bytes))) 13 | (if (##fx< count (u8vector-length bytes)) 14 | (u8vector-shrink! bytes count) 15 | bytes))) 16 | 17 | (def (bytes->BN bytes (start 0) (end #f)) 18 | (if (u8vector? bytes) 19 | (let (end (or end (u8vector-length bytes))) 20 | (or (BN_bin2bn bytes start end) 21 | (error "error decoding BN; NULL pointer" bytes))) 22 | (error "bad argument; expected bytes" bytes))) 23 | -------------------------------------------------------------------------------- /src/std/crypto/dh.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; libcrypto DH key exchage 4 | 5 | (import :std/error 6 | ./libcrypto 7 | ./etc) 8 | (export 9 | (except-out #t with-null-check) 10 | (rename: DH_pub_key DH-pub-key)) 11 | 12 | (def (with-null-check makef) 13 | (or (makef) 14 | (error "error allocating key; NULL POINTER"))) 15 | 16 | (def (DH-get-1024-160) 17 | (with-null-check DH_get_1024_160)) 18 | (def (DH-get-2048-224) 19 | (with-null-check DH_get_2048_224)) 20 | (def (DH-get-2048-256) 21 | (with-null-check DH_get_2048_256)) 22 | 23 | (def (DH-generate-key dh) 24 | (with-libcrypto-error 25 | (DH_generate_key dh))) 26 | 27 | (def (DH-compute-key dh bn) 28 | (let* ((len (DH_size dh)) 29 | (secret (make-u8vector len)) 30 | (count (DH_compute_key secret bn dh))) 31 | (when (##fx< count len) 32 | (u8vector-shrink! secret count)) 33 | secret)) 34 | -------------------------------------------------------------------------------- /src/std/debug/DBG.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © fare 3 | ;;; DBG utility 4 | 5 | (export DBG DBG-printer DBG-helper) 6 | 7 | (import 8 | (only-in :gerbil/runtime DBG DBG-printer DBG-helper) 9 | (only-in :std/misc/repr pr)) 10 | 11 | (DBG-printer pr) 12 | -------------------------------------------------------------------------------- /src/std/generic.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo 3 | ;;; Generics package 4 | 5 | (import ./generic/dispatch 6 | ./generic/macros) 7 | (export (import: ./generic/dispatch 8 | ./generic/macros)) 9 | -------------------------------------------------------------------------------- /src/std/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: std) 2 | -------------------------------------------------------------------------------- /src/std/getopt.ss: -------------------------------------------------------------------------------- 1 | ;; Compatibility module for v0.18 2 | (import :std/cli/getopt) 3 | (export (import: :std/cli/getopt)) 4 | 5 | ;; TODO: as a (begin-syntax (warnf ...)) compile-time deprecation warning at some point. 6 | -------------------------------------------------------------------------------- /src/std/hash-table.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; hash-table interface type meta 4 | (import :gerbil/runtime/hash) 5 | (export HashTable 6 | HashTable? is-HashTable? 7 | make-HashTable try-HashTable) 8 | -------------------------------------------------------------------------------- /src/std/interface.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; backwards compatibilty shim; will be removed for v0.19 4 | (import :gerbil/runtime/interface) 5 | (export interface 6 | interface-out 7 | cast try-cast satisfies? 8 | interface-instance? interface-instance-object &interface-instance-object 9 | interface-descriptor? interface-descriptor-type interface-descriptor-methods 10 | interface-cast-error?) 11 | -------------------------------------------------------------------------------- /src/std/io.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; stdio package 4 | (import ./io/interface 5 | ./io/api) 6 | (export (import: ./io/interface) 7 | (import: ./io/api)) 8 | -------------------------------------------------------------------------------- /src/std/io/api.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; stdio api 4 | (import ./bio/api 5 | ./strio/api 6 | ./socket/api 7 | ./delimited 8 | ./file 9 | ./util 10 | ./port) 11 | (export (import: ./bio/api) 12 | (import: ./strio/api) 13 | (import: ./socket/api) 14 | (import: ./delimited) 15 | (import: ./file) 16 | (import: ./util) 17 | (import: ./port)) 18 | -------------------------------------------------------------------------------- /src/std/io/bio/chunked.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; chunked buffers 4 | (import :std/error 5 | :std/srfi/1 6 | ../interface 7 | ./types) 8 | (export #t) 9 | (declare (not safe)) 10 | 11 | (def (bio-chunked-write-bytes bio input input-start input-end) 12 | (using (bio :- chunked-output-buffer) 13 | (let (chunk (subu8vector input input-start input-end)) 14 | (set! bio.chunks 15 | (cons chunk bio.chunks)) 16 | (void)))) 17 | 18 | (def (bio-chunked-close bio) 19 | (using (bio :- chunked-output-buffer) 20 | (unless bio.output ; already closed 21 | (set! bio.output 22 | (reverse! bio.chunks)) 23 | (set! bio.chunks []) 24 | (void)))) 25 | -------------------------------------------------------------------------------- /src/std/io/strio/chunked.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; chunked string writer 4 | (import :std/error 5 | :std/srfi/1 6 | ../interface 7 | ./types) 8 | (export #t) 9 | (declare (not safe)) 10 | 11 | (def (strio-chunked-write-string strio input input-start input-end) 12 | (using (strio :- chunked-string-output-buffer) 13 | (let (chunk (substring input input-start input-end)) 14 | (set! strio.chunks (cons chunk strio.chunks)) 15 | (void)))) 16 | 17 | (def (strio-chunked-close strio) 18 | (using (strio :- chunked-string-output-buffer) 19 | (unless strio.output ; already closed 20 | (set! strio.output (reverse! strio.chunks)) 21 | (set! strio.chunks []) 22 | (void)))) 23 | -------------------------------------------------------------------------------- /src/std/io/strio/packed.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; packed small fixnum pairs 4 | (import :gerbil/gambit 5 | :std/sugar) 6 | (export #t) 7 | 8 | (cond-expand 9 | (,(fixnum? (expt 2 32)) 10 | ;; 64bit arch; max buffer size is 256MB, we can safely pack 11 | (defrule (pack i o) 12 | (fxior (fxarithmetic-shift-left i 32) o)) 13 | (defrule (unpack-first result) 14 | (fxarithmetic-shift-right result 32)) 15 | (defrule (unpack-second result) 16 | (fxand result #xffffffff))) 17 | (else 18 | ;; 32bit arch or less; we can't safely pack, so use a pair 19 | (defrule (pack i o) 20 | (cons i o)) 21 | (defrule (unpack-first result) 22 | (car result)) 23 | (defrule (unpack-second result) 24 | (cdr result)))) 25 | -------------------------------------------------------------------------------- /src/std/markup/README.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Markup languages 2 | #+EXPORT_FILE_NAME: ../../../doc/reference/std/markup/README.md 3 | #+OPTIONS: toc:nil 4 | 5 | * Markup Languages 6 | 7 | Gerbil supports many different markup languages using [[file:README.org][SXML]] for 8 | parsing, searching, manipulating and printing. 9 | 10 | - [[file:sxml/xml.org][XML]] :: eXtensible Markup Language 11 | - [[file:sxml/html/README.org][HTML]] :: Hyper Text Markup Language 12 | - [[file:sxml/tal/README.org][TAL]] :: Template Attribute Language 13 | -------------------------------------------------------------------------------- /src/std/markup/html.ss: -------------------------------------------------------------------------------- 1 | (import :std/markup/sxml/html/parser :std/markup/sxml/print) 2 | (export (import: :std/markup/sxml/html/parser) 3 | current-html-void-tags 4 | html-void-tag? 5 | current-html-raw-tags 6 | html-raw-tag?) 7 | ;;; This library is tangled from sxml/html/README.org 8 | -------------------------------------------------------------------------------- /src/std/markup/sxml.ss: -------------------------------------------------------------------------------- 1 | (import :std/build-config 2 | :std/markup/sxml/print 3 | :std/markup/sxml/sxpath 4 | :std/markup/sxml/sxml-inf) 5 | (export (import: 6 | :std/markup/sxml/print 7 | :std/markup/sxml/sxpath 8 | :std/markup/sxml/sxml-inf)) 9 | -------------------------------------------------------------------------------- /src/std/markup/sxml/html/tal.ss: -------------------------------------------------------------------------------- 1 | ;; See ./tal/README.org for the implementation. 2 | (import (only-in :std/html/tal/syntax 3 | define-TAL current-tal-output-port 4 | current-tal:on-error tal:write)) 5 | (export define-TAL current-tal-output-port current-tal:on-error tal:write) 6 | -------------------------------------------------------------------------------- /src/std/markup/sxml/oleg/README.md: -------------------------------------------------------------------------------- 1 | This is Oleg's Scheme XML package, cherry-picked ported to Gerbil. 2 | See http://okmij.org/ftp/Scheme/xml.html 3 | 4 | The code is in the public domain. 5 | -------------------------------------------------------------------------------- /src/std/markup/sxml/oleg/parser-errors-vanilla.scm: -------------------------------------------------------------------------------- 1 | ; Implementation of the structure parser-errors-vanilla 2 | ; for systems other than Scheme48 and PLT Scheme 3 | ; $Id: parser-errors-vanilla.scm,v 1.1 2004/08/06 23:01:09 oleg Exp $ 4 | 5 | (define (parser-error port message . rest) 6 | (apply error message rest)) 7 | -------------------------------------------------------------------------------- /src/std/markup/sxml/sxpath.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; SXPath interface 4 | 5 | (import :std/error) 6 | (export sxpath) 7 | 8 | (extern namespace: #f pretty-print) 9 | (include "oleg/myenv-gerbil.scm") 10 | (include "oleg/SXPath.scm") 11 | -------------------------------------------------------------------------------- /src/std/markup/sxml/tal/parser.ss: -------------------------------------------------------------------------------- 1 | (def (tal:repeat? attrs) (tal-attr? 'tal:repeat attrs)) 2 | -------------------------------------------------------------------------------- /src/std/markup/sxml/xml.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; (C) me at drewc.ca 4 | ;;; XML interface 5 | 6 | (import :std/build-config 7 | :std/markup/sxml/ssax 8 | :std/markup/sxml/print) 9 | 10 | (export (import: :std/markup/sxml/ssax) 11 | #t) 12 | 13 | (def (write-xml sxml (port (current-output-port))) 14 | (write-sxml sxml xml?: #t port: port)) 15 | 16 | (def (print-sxml->xml sxml (port (current-output-port)) 17 | indent: (maybe-indent 1)) 18 | (write-sxml sxml xml?: #t port: port indent: maybe-indent)) 19 | -------------------------------------------------------------------------------- /src/std/markup/tal.ss: -------------------------------------------------------------------------------- 1 | (import (only-in :std/markup/sxml/tal/syntax 2 | define-TAL current-tal-output-port 3 | current-tal:on-error tal:write)) 4 | (export define-TAL current-tal-output-port current-tal:on-error tal:write) 5 | -------------------------------------------------------------------------------- /src/std/markup/xml.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; XML interface 4 | 5 | (import :std/build-config 6 | :std/markup/sxml/sxpath 7 | :std/markup/sxml/sxml-inf 8 | :std/markup/sxml/ssax 9 | :std/markup/sxml/xml) 10 | (export (import: 11 | :std/markup/sxml/ssax 12 | :std/markup/sxml/sxpath 13 | :std/markup/sxml/sxml-inf 14 | :std/markup/sxml/xml)) 15 | -------------------------------------------------------------------------------- /src/std/metaclass.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; backwards compatibilty shim; will be removed for v0.19 4 | (export class) 5 | -------------------------------------------------------------------------------- /src/std/mime/types.ss: -------------------------------------------------------------------------------- 1 | (import :std/mime/struct :std/srfi/13) 2 | (export #t (import: :std/mime/struct)) 3 | 4 | (def list-mime-types (cut hash->list mime-types)) 5 | (def list-mime-exensions (cut hash->list mime-extensions)) 6 | 7 | (def (get-mime-type name) (hash-get mime-types name)) 8 | (def (extension->mime-type ext) (hash-get mime-extensions ext)) 9 | 10 | (def (path-extension->mime-type-name path) 11 | (alet (ext (path-extension path)) 12 | (let (ext (substring ext 1 (string-length ext))) 13 | (alet (mt (extension->mime-type ext)) 14 | (&mime-type-name mt))))) 15 | 16 | (define-mime-types 17 | "./mime.types" 18 | ("text/x-scheme" "scm" "sps" "sls" "sld") 19 | ("text/x-scheme.gerbil" "ss") 20 | ("application/vnd.ms-outlook" "msg")) 21 | -------------------------------------------------------------------------------- /src/std/misc/barrier-test.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :std/misc/barrier test 4 | 5 | (import :std/test 6 | ./barrier) 7 | (export barrier-test) 8 | 9 | (def barrier-test 10 | (test-suite "test :std/misc/barrier" 11 | (test-case "test barrier wait" 12 | (def b (make-barrier 2)) 13 | (def thr1 (spawn barrier-post! b)) 14 | (def thr2 (spawn barrier-post! b)) 15 | (check (barrier-wait! b) => (void))) 16 | (test-case "test barrier error" 17 | (def b (make-barrier 2)) 18 | (def thr (spawn barrier-error! b 'fail)) 19 | (check-exception (barrier-wait! b) (cut eq? <> 'fail))))) 20 | -------------------------------------------------------------------------------- /src/std/misc/completion-test.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :std/misc/completion test 4 | 5 | (import :gerbil/gambit 6 | :std/test 7 | ./completion) 8 | (export completion-test) 9 | 10 | (def completion-test 11 | (test-suite "test :std/misc/completion" 12 | (test-case "test completion wait" 13 | (def c (make-completion)) 14 | (def thr (spawn completion-post! c 'done)) 15 | (check (completion-wait! c) => 'done)) 16 | (test-case "test completion error" 17 | (def c (make-completion 'error-test)) 18 | (def thr (spawn completion-error! c 'fail)) 19 | (check-exception (completion-wait! c) (cut eq? <> 'fail))))) 20 | -------------------------------------------------------------------------------- /src/std/misc/dag-test.ss: -------------------------------------------------------------------------------- 1 | (export dag-test) 2 | 3 | (import 4 | :std/sugar 5 | :std/test 6 | ./dag) 7 | 8 | (def dag-test 9 | (test-suite "test :std/misc/dag" 10 | (test-case "walk-dag" 11 | (def operators (hash (+ +) (* *) (- -) (/ /))) 12 | (def (simple-eval expr) 13 | (walk-dag 14 | (cut <> expr) 15 | arrows: 16 | (lambda (x) (if (pair? x) (cdr x) [])) 17 | synthetic-attribute: 18 | (lambda (expr _subexpr values) 19 | (cond 20 | ((and (pair? expr) (hash-get operators (car expr))) => 21 | (cut apply <> values)) 22 | ((number? expr) expr) 23 | (else (error "invalid expression" expr)))))) 24 | (check (simple-eval '(- (* (+ (* 4 5) (/ 18 3)) 2) 10)) => 42)))) 25 | -------------------------------------------------------------------------------- /src/std/misc/deque-test.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; :std/misc/deque test 4 | 5 | (import :std/misc/deque 6 | :std/test) 7 | (export deque-test) 8 | 9 | (def deque-test 10 | (test-suite "test :std/misc/deque" 11 | (test-case "test deque ops" 12 | (def dq (make-deque)) 13 | (check (deque-empty? dq) => #t) 14 | (push-back! dq 1) 15 | (push-back! dq 2) 16 | (push-back! dq 3) 17 | (check (deque-empty? dq) => #f) 18 | (check (deque-length dq) => 3) 19 | (check (deque->list dq) => '(1 2 3)) 20 | (check (pop-front! dq) => 1) 21 | (check (deque->list dq) => '(2 3)) 22 | (check (pop-back! dq) => 3) 23 | (check (deque->list dq) => '(2)) 24 | (check (deque-length dq) => 1) 25 | (check (pop-front! dq) => 2) 26 | (check (deque->list dq) => '()) 27 | (check (deque-length dq) => 0) 28 | (check (deque-empty? dq) => #t)))) -------------------------------------------------------------------------------- /src/std/misc/list-builder-test.ss: -------------------------------------------------------------------------------- 1 | (export list-builder-test) 2 | 3 | (import 4 | :std/misc/list-builder :std/test) 5 | 6 | (def (copy-list lst) (foldr cons '() lst)) 7 | 8 | (def list-builder-test 9 | (test-suite "test :std/misc/list-builder" 10 | (test-case "test with-list-builder" 11 | (check-equal? 12 | (with-list-builder (put!) 13 | (put! 1) (put! 2) (put! 3)) 14 | '(1 2 3)) 15 | (check-equal? 16 | (call-with-list-builder (lambda (put! _) (put! 1) (put! 2) (put! 3))) 17 | '(1 2 3)) 18 | (check-equal? 19 | (with-list-builder (put! get-list-so-far) 20 | (put! 1) 21 | (put! 2) 22 | (put! (copy-list (get-list-so-far))) 23 | (put! 3)) 24 | '(1 2 (1 2) 3))))) 25 | -------------------------------------------------------------------------------- /src/std/misc/ports-test.data: -------------------------------------------------------------------------------- 1 | "This test file is used by ports-test.ss" 2 | (Don't remove or modify it ... without fixing the test.) 3 | 42 4 | -------------------------------------------------------------------------------- /src/std/misc/shared.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; equality for shared structures 4 | (export (rename: equal? equal-shared?)) 5 | -------------------------------------------------------------------------------- /src/std/misc/shuffle.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; shuffling 4 | 5 | (export shuffle vector-shuffle vector-shuffle!) 6 | (import :gerbil/gambit) 7 | 8 | (def (shuffle lst (rng default-random-source)) 9 | (vector->list 10 | (vector-shuffle! 11 | (list->vector lst) 12 | rng))) 13 | 14 | (def (vector-shuffle vec (rng default-random-source)) 15 | (vector-shuffle! (vector-copy vec) rng)) 16 | 17 | (def (vector-shuffle! vec (rng default-random-source)) 18 | (def random-integer 19 | (random-source-make-integers rng)) 20 | (let (len (vector-length vec)) 21 | (do ((i 0 (##fx+ i 1))) 22 | ((##fx= i len) vec) 23 | (let* ((j (##fx+ i (random-integer (##fx- len i)))) 24 | (iv (##vector-ref vec i))) 25 | (##vector-set! vec i (##vector-ref vec j)) 26 | (##vector-set! vec j iv))))) 27 | -------------------------------------------------------------------------------- /src/std/misc/template-test.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; string template tests 4 | (import :std/test 5 | ./template) 6 | (export template-test) 7 | 8 | (def template-test 9 | (test-suite "string templates" 10 | (test-case "variable substitutions" 11 | (def template 12 | "The quick ${color} fox jumped over the lazy ${adversary}") 13 | (check (apply-template template color: "brown" adversary: "dog") 14 | => "The quick brown fox jumped over the lazy dog") 15 | (check (apply-template template color: "golden" adversary: "aligator") 16 | => "The quick golden fox jumped over the lazy aligator")) 17 | (test-case "character escape" 18 | (def template 19 | "the quick \\$\\$\\$\\\\ $\\{\\}") 20 | (check (apply-template template) 21 | => "the quick $$$\\ ${}")))) 22 | -------------------------------------------------------------------------------- /src/std/misc/text.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo 3 | ;;; textual template related utilities 4 | 5 | (import (for-syntax :std/misc/ports)) 6 | (export include-text) 7 | 8 | ;; compile-time include a file as text (a string) 9 | (defsyntax (include-text stx) 10 | (syntax-case stx () 11 | ((_ path) 12 | (stx-string? #'path) 13 | (let (path (gx#core-resolve-path #'path (stx-source stx))) 14 | (with-syntax ((txt (call-with-input-file path read-all-as-string))) 15 | #'(quote txt)))))) 16 | -------------------------------------------------------------------------------- /src/std/misc/timeout.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; timeouts 4 | 5 | (import :std/error 6 | :std/sugar) 7 | (export #t) 8 | 9 | (def (make-timeout t (none absent-value)) 10 | (cond 11 | ((not t) (if (eq? none absent-value) absent-obj none)) 12 | ((time? t) t) 13 | ((real? t) 14 | (seconds->time (+ (##current-time-point) t))) 15 | (else 16 | (raise-bad-argument make-timeout "real, time or #f" t)))) 17 | 18 | (defrule (timeout? o) 19 | (or (real? o) (time? o))) 20 | -------------------------------------------------------------------------------- /src/std/net/httpd.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; ̧© vyzo 3 | ;;; embedded HTTP/1.1 server 4 | (import ./httpd/api) 5 | (export (import: ./httpd/api)) 6 | -------------------------------------------------------------------------------- /src/std/net/httpd/base.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; ̧© vyzo 3 | ;;; embedded HTTP/1.1 server base 4 | (import :std/actor 5 | :std/logger) 6 | (export #t) 7 | 8 | (deflogger httpd) 9 | 10 | ;; handler registration 11 | (defmessage !register-handler (host path handler)) 12 | 13 | (def current-http-server 14 | (make-parameter #f)) 15 | -------------------------------------------------------------------------------- /src/std/net/repl-test.ss: -------------------------------------------------------------------------------- 1 | (export repl-test test-setup! test-cleanup!) 2 | 3 | (import :std/test 4 | :std/sugar 5 | ./repl) 6 | 7 | (def server-address "127.0.0.1:7000") 8 | (def repld #f) 9 | 10 | (def (test-setup!) 11 | (set! repld (start-repl-server! address: server-address))) 12 | 13 | (def (test-cleanup!) 14 | (when repld 15 | (stop-repl-server! repld) 16 | (set! repld #f))) 17 | 18 | (def repl-test 19 | (test-suite "test :std/net/repl" 20 | (test-case "repl connection" 21 | (let ((client (open-tcp-client server-address))) 22 | (with-destroy client 23 | (display "(+ 1 2)\r" client) 24 | (force-output client) 25 | (check (read-line client) => "> 3\r")))))) 26 | -------------------------------------------------------------------------------- /src/std/net/s3.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo, ngp 3 | ;;; AWS S3 Client 4 | (import ./s3/api ./s3/interface) 5 | (export (import: ./s3/api ./s3/interface)) 6 | -------------------------------------------------------------------------------- /src/std/net/s3/interface.ss: -------------------------------------------------------------------------------- 1 | (import :std/misc/alist) 2 | 3 | (export #t) 4 | 5 | 6 | ;; TODO return types 7 | (interface S3 8 | (get-bucket (name : :string)) 9 | (create-bucket! (name : :string)) 10 | (delete-bucket! (name : :string)) 11 | (bucket-exists? (name : :string)) 12 | (list-buckets)) 13 | 14 | ;; TODO return types 15 | (interface S3Bucket 16 | (get (name : :string)) 17 | (exists? (name : :string)) 18 | (put! (name : :string) 19 | (data : :u8vector)) 20 | (delete! (name : :string)) 21 | ; src should follow `bucket/file/path` format. Destination should just be `file/path`. 22 | ; Copies *from* src to *dest* in this ObjectMap. 23 | (copy-to! (src : :string) (dest : :string)) 24 | (list-objects)) 25 | -------------------------------------------------------------------------------- /src/std/net/smtp.ss: -------------------------------------------------------------------------------- 1 | (import ./smtp/api) (export (import: ./smtp/api)) 2 | -------------------------------------------------------------------------------- /src/std/net/smtp/headers.ss: -------------------------------------------------------------------------------- 1 | (import ./session) (export #t) 2 | 3 | (def (headers->alist hlist) 4 | (let lp ((hs hlist) (alist [])) 5 | (if (null? hs) (reverse alist) 6 | (with ([item rest ...] hs) 7 | (if (pair? item) (lp rest [item alist ...]) 8 | (with ([key val rest ...] hs) 9 | (lp rest [[key . val] alist ...]))))))) 10 | 11 | (def (send-headers headers send-one) 12 | (set! headers (headers->alist headers)) 13 | (def (key->string key) 14 | (cond ((string? key) key) 15 | ((or (keyword? key) 16 | (symbol? key)) 17 | (with-output-to-string "" (cut write key))) 18 | (else (error "Header key must be a keyword, symbol or string")))) 19 | (def header->string 20 | (cut match <> 21 | ([k . v] (string-append (key->string k) " " v)))) 22 | 23 | (for-each send-one (map header->string headers))) 24 | -------------------------------------------------------------------------------- /src/std/net/smtp/interface.ss: -------------------------------------------------------------------------------- 1 | (import :std/io) 2 | (export #t) 3 | 4 | (interface (SMTP Socket) 5 | (send-mail return-path forward-path . data) 6 | (send-command cmd) 7 | (read-all) (read-lines) (keywords) 8 | (socket) (reader) (writer) 9 | (EHLO domain-or-address) 10 | (HELO domain) 11 | (MAIL from) 12 | (RCPT to) 13 | (DATA) 14 | (RSET) 15 | (NOOP (str "")) 16 | (QUIT) 17 | (VRFY address) 18 | (STARTTLS)) 19 | -------------------------------------------------------------------------------- /src/std/net/socket.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; synchronous sockets package 4 | 5 | (import :std/deprecation 6 | :std/net/socket/api 7 | :std/net/socket/buffer 8 | :std/net/socket/server) 9 | 10 | (export (import: :std/net/socket/api 11 | :std/net/socket/buffer 12 | :std/net/socket/server)) 13 | 14 | (package-deprecation-warning!) 15 | -------------------------------------------------------------------------------- /src/std/net/socks.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SOCKS 4/4a/5 support 4 | 5 | (import ./socks/api) 6 | (export (import: ./socks/api)) 7 | -------------------------------------------------------------------------------- /src/std/net/socks/api.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SOCKS API 4 | (import :std/error 5 | ./interface 6 | ./client 7 | ./server) 8 | (export (import: ./interface 9 | ./server) 10 | socks-proxy 11 | socks-connect) 12 | 13 | (def (socks-proxy proxy-address (protocol 'SOCKS4)) 14 | (SOCKS 15 | (case protocol 16 | ((SOCKS4) (socks4-open proxy-address)) 17 | ((SOCKS4a) (socks4a-open proxy-address)) 18 | ((SOCKS5) (socks5-open proxy-address)) 19 | (else 20 | (raise-bad-argument socks-connect 21 | "socks protocol; 4 or SOCKS4, 4a orSOCKS4a, 5 or SOCKS5" 22 | protocol))))) 23 | 24 | 25 | (def (socks-connect proxy-address (protocol 'SOCKS4)) 26 | (lambda (address) 27 | (SOCKS-connect (socks-proxy proxy-address protocol) 28 | address))) 29 | -------------------------------------------------------------------------------- /src/std/net/socks/interface.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SOCKS v4/4a/5 interface 4 | (import :std/io/interface) 5 | (export #t) 6 | 7 | ;; SOCKS client interface 8 | (interface SOCKS 9 | ;; protocol version used by the proxy 10 | ;; :-symbol? (one-of 'SOCKS4 'SOCKS4a 'SOCKS5) 11 | (protocol) 12 | 13 | ;; proxy address 14 | ;; :- inet-address? 15 | (proxy-address) 16 | 17 | ;; open a connection through the proxy 18 | ;; :- StreamSocket 19 | (connect (address :~ address?)) 20 | => StreamSocket 21 | 22 | ;; Bind an address at the proxy 23 | ;; :- ServerSocket 24 | (bind (address :~ (maybe address?) := #f)) 25 | => ServerSocket) 26 | -------------------------------------------------------------------------------- /src/std/net/ssl.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SSL package 4 | (import ./ssl/api) 5 | (export (import: ./ssl/api)) 6 | -------------------------------------------------------------------------------- /src/std/net/ssl/api.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SSL API 4 | (import ./interface 5 | ./libssl 6 | ./socket 7 | ./client 8 | ./server 9 | ./error) 10 | (export (import: ./interface) 11 | default-client-ssl-context 12 | insecure-client-ssl-context 13 | make-client-ssl-context 14 | make-server-ssl-context 15 | ssl-connect 16 | ssl-listen 17 | ssl-client-upgrade 18 | ssl-server-upgrade 19 | ssl-error?) 20 | -------------------------------------------------------------------------------- /src/std/net/ssl/interface.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SSL socket interface 4 | (export #t) 5 | (import :std/io) 6 | 7 | (interface TLS 8 | (peer-certificate)) 9 | 10 | (interface (SSLSocket StreamSocket TLS)) 11 | -------------------------------------------------------------------------------- /src/std/net/websocket.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; websockets 4 | (import ./websocket/api) 5 | (export (import: ./websocket/api)) 6 | -------------------------------------------------------------------------------- /src/std/os/hostname.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; actor server hostnames 4 | (import :std/foreign) 5 | (export hostname) 6 | 7 | (def +hostname+ #f) 8 | 9 | (def (hostname) 10 | (if +hostname+ 11 | +hostname+ 12 | (let (name (gethostname)) 13 | (set! +hostname+ name) 14 | name))) 15 | 16 | (begin-ffi (gethostname) 17 | (define-c-lambda gethostname () char-string "ffi_gethostname") 18 | (c-declare " 19 | #include 20 | 21 | __thread char hostname_buf[1024]; 22 | static char* ffi_gethostname() { 23 | gethostname(hostname_buf, sizeof(hostname_buf)); 24 | return hostname_buf; 25 | } 26 | ")) 27 | -------------------------------------------------------------------------------- /src/std/os/pid.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; OS pid 4 | 5 | (import :std/foreign) 6 | (export getpid getppid) 7 | 8 | (begin-ffi (getpid getppid) 9 | (c-declare "#include ") 10 | (c-declare "#include ") 11 | 12 | (define-c-lambda getpid () int) 13 | (define-c-lambda getppid () int)) 14 | -------------------------------------------------------------------------------- /src/std/os/signal-00-signalfd-test.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; :std/os/signalfd unit-test 4 | (cond-expand 5 | ((and enable-signalfd-test linux) 6 | (import :std/test 7 | ./signal 8 | ./signalfd 9 | ./pid) 10 | (export signalfd-test) 11 | 12 | (def signalfd-test 13 | (test-suite "signalfd" 14 | (test-case "basic signal handling" 15 | (def ss (make_sigset)) 16 | (sigaddset ss SIGHUP) 17 | (sigprocmask SIG_BLOCK ss #f) 18 | (def sfd (signalfd ss)) 19 | 20 | (spawn 21 | (lambda () 22 | (thread-sleep! 1) 23 | (kill (getpid) SIGHUP))) 24 | 25 | (let (r (signalfd-read sfd)) 26 | (check (signalfd-siginfo-signo r) => SIGHUP))))))) 27 | -------------------------------------------------------------------------------- /src/std/parser.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo 3 | ;;; std parser api 4 | 5 | (import :std/parser/rlang 6 | :std/parser/base 7 | :std/parser/stream 8 | :std/parser/lexer 9 | :std/parser/defparser 10 | :std/parser/deflexer) 11 | 12 | (export 13 | (import: :std/parser/rlang 14 | :std/parser/base 15 | :std/parser/stream 16 | :std/parser/lexer 17 | :std/parser/defparser 18 | :std/parser/deflexer)) 19 | -------------------------------------------------------------------------------- /src/std/pregexp.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Dorai Sitaram's pregexp, slightly modified 4 | (import :std/error 5 | :std/sugar) 6 | (export pregexp 7 | pregexp-match-positions 8 | pregexp-match 9 | pregexp-split 10 | pregexp-replace 11 | pregexp-replace* 12 | pregexp-quote) 13 | 14 | (declare (fixnum)) 15 | (include "pregexp/pregexp.scm") 16 | -------------------------------------------------------------------------------- /src/std/pregexp/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 1999-2005, Dorai Sitaram. 2 | All rights reserved. 3 | 4 | Permission to copy, modify, distribute, and use this work or 5 | a modified copy of this work, for any purpose, is hereby 6 | granted, provided that the copy includes this copyright 7 | notice, and in the case of a modified copy, also includes a 8 | notice of modification. This work is provided as is, with 9 | no warranty of any kind. 10 | -------------------------------------------------------------------------------- /src/std/pregexp/dialects/cl-pregexp.scm: -------------------------------------------------------------------------------- 1 | (scmxlate-rename-define 2 | (pregexp-reverse! #'nreverse) 3 | ) 4 | 5 | (scmxlate-postprocess 6 | (if (probe-file "pregexp.cl") (delete-file "pregexp.cl")) 7 | 8 | (rename-file "my-pregexp.scm" "pregexp.cl") 9 | ) 10 | -------------------------------------------------------------------------------- /src/std/pregexp/dialects/dialects-supported.scm: -------------------------------------------------------------------------------- 1 | ;last change: 2003-06-03 2 | 3 | ;pregexp.scm will load without configuration in any 4 | ;R[45]RS Scheme, including but not restricted to 5 | ;the dialects mentioned below. The configuration 6 | ;process for which this file is used is solely to 7 | ;create "module" versions of pregexp. 8 | 9 | guile 10 | gauche 11 | plt 12 | scsh 13 | -------------------------------------------------------------------------------- /src/std/pregexp/dialects/files-to-be-ported.scm: -------------------------------------------------------------------------------- 1 | pregexp.scm 2 | -------------------------------------------------------------------------------- /src/std/pregexp/known-bugs/6115: -------------------------------------------------------------------------------- 1 | ?m: 2 | -------------------------------------------------------------------------------- /src/std/pregexp/manifest: -------------------------------------------------------------------------------- 1 | COPYING 2 | README 3 | INSTALL 4 | manifest 5 | pregexp.scm 6 | pregexp.lisp 7 | index.tex 8 | history 9 | pregexp-test.scm 10 | tester.scm 11 | tester.lisp 12 | 13 | dialects/*.scm 14 | known-bugs/[s0-9]* 15 | -------------------------------------------------------------------------------- /src/std/pregexp/pregexp-test.ss: -------------------------------------------------------------------------------- 1 | (export pregexp-test) 2 | 3 | (import 4 | :std/pregexp 5 | :std/sugar 6 | :std/test) 7 | 8 | (defrules test () 9 | ((_ ee rr . tt) 10 | (begin (check ee => 'rr) (test . tt))) 11 | ((_) 12 | (void))) 13 | 14 | (def load void) 15 | (def bottomline void) 16 | 17 | (def pregexp-test 18 | (test-suite "test :std/pregexp" 19 | (test-case "pregexp-test.scm" 20 | (include "pregexp-test.scm")))) 21 | -------------------------------------------------------------------------------- /src/std/protobuf/potpourri-test.proto: -------------------------------------------------------------------------------- 1 | #lang :std/protobuf/proto 2 | 3 | package potpourri; 4 | 5 | message A { 6 | optional int32 a = 1; 7 | optional string b = 2; 8 | reserved 4, 10 to 20; 9 | reserved "c"; 10 | extensions 20 to 100; 11 | } 12 | 13 | message B { 14 | enum T { 15 | FOO = 1; 16 | BAR = 2; 17 | } 18 | 19 | message C { 20 | optional string x = 1; 21 | optional A y = 2; 22 | } 23 | 24 | required T t = 1; 25 | oneof stuff { 26 | string foo = 2; 27 | A bar = 3; 28 | } 29 | 30 | map aMap = 4; 31 | 32 | optional C c = 5; 33 | } 34 | 35 | 36 | service C { 37 | rpc DoStuff (A) returns (B); 38 | } 39 | 40 | extend A { 41 | optional string blah = 20; 42 | } 43 | -------------------------------------------------------------------------------- /src/std/protobuf/potpourri-test2.proto: -------------------------------------------------------------------------------- 1 | #lang :std/protobuf/proto 2 | 3 | import "potpourri-test.proto"; 4 | 5 | message D { 6 | optional potpourri.A a = 1; 7 | } 8 | -------------------------------------------------------------------------------- /src/std/sort/vbinsearch.scm: -------------------------------------------------------------------------------- 1 | ;;; Vector binary search 2 | ;;; Olin Shivers 98/11. 3 | 4 | ;;; Returns the index of the matching element. 5 | ;;; (vector-binary-search '#((1 . one) (3 . three) (4 . four) (25 . twenty-five)) 6 | ;;; < car 4) 7 | ;;; => 2 8 | 9 | (define (vector-binary-search v key< elt->key key . maybe-start+end) 10 | (let-vector-start+end (start end) vector-binary-search v maybe-start+end 11 | (let lp ((left start) (right end)) 12 | (and (< left right) 13 | (let* ((m (quotient (+ left right) 2)) 14 | (elt (vector-ref v m)) 15 | (elt-key (elt->key elt))) 16 | (cond ((key< key elt-key) (lp left m)) 17 | ((key< elt-key key) (lp (+ m 1) right)) 18 | (else m))))))) 19 | -------------------------------------------------------------------------------- /src/std/srfi/1-test.ss: -------------------------------------------------------------------------------- 1 | (export 1-test) 2 | 3 | (import :std/test 4 | :std/srfi/1) 5 | 6 | (def (compare x y) (= (inexact->exact (truncate x)) y)) 7 | 8 | (def 1-test 9 | (test-suite "test :std/srfi/1" 10 | (test-case "lset=" 11 | (check-equal? 12 | (lset= compare '(1.2 0.1 2.3) '(2 1 0)) 13 | #t)))) 14 | -------------------------------------------------------------------------------- /src/std/srfi/117.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-117: List Queues 4 | 5 | (import :std/error 6 | :std/srfi/9) 7 | (export 8 | make-list-queue list-queue list-queue-copy list-queue-unfold list-queue-unfold-right 9 | list-queue? list-queue-empty? 10 | list-queue-front list-queue-back list-queue-list list-queue-first-last 11 | list-queue-add-front! list-queue-add-back! list-queue-remove-front! list-queue-remove-back! 12 | list-queue-remove-all! list-queue-set-list! 13 | list-queue-append list-queue-append! list-queue-concatenate 14 | list-queue-map list-queue-map! list-queue-for-each) 15 | 16 | (include "srfi-117.scm") 17 | -------------------------------------------------------------------------------- /src/std/srfi/121-iter.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; Iterators for SRFI-121 generators 4 | 5 | (import :std/iter 6 | :std/srfi/121) 7 | (export in-generator) 8 | 9 | (def (in-generator g) 10 | (def (next it) 11 | (with ((iterator e) it) 12 | (let (v (e)) 13 | (if (eof-object? v) 14 | iter-end 15 | v)))) 16 | (make-iterator g next)) 17 | -------------------------------------------------------------------------------- /src/std/srfi/121.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-121: Generator library 4 | 5 | (export 6 | generator make-iota-generator make-range-generator 7 | make-coroutine-generator list->generator vector->generator 8 | reverse-vector->generator string->generator 9 | bytevector->generator 10 | make-for-each-generator make-unfold-generator 11 | gcons* gappend gcombine gfilter gremove 12 | gtake gdrop gtake-while gdrop-while 13 | gdelete gdelete-neighbor-dups gindex gselect 14 | generator->list generator->reverse-list 15 | generator->vector generator->vector! generator->string 16 | generator-fold generator-for-each generator-find 17 | generator-count generator-any generator-every generator-unfold) 18 | 19 | (defalias bytevector-length u8vector-length) 20 | (defalias bytevector-u8-ref u8vector-ref) 21 | 22 | (include "srfi-121.scm") 23 | -------------------------------------------------------------------------------- /src/std/srfi/127-iter.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; Iterators for SRFI-127 lazy sequences 4 | 5 | (import :std/iter 6 | :std/srfi/127) 7 | (export in-lseq) 8 | 9 | (def (in-lseq ls) 10 | (def (next it) 11 | (with ((iterator e) it) 12 | (if (pair? e) 13 | (let ((first (car e)) 14 | (rest (lseq-cdr e))) 15 | (set! (iterator-e it) rest) 16 | first) 17 | iter-end))) 18 | (make-iterator ls next)) 19 | -------------------------------------------------------------------------------- /src/std/srfi/127.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-127: Lazy sequences 4 | 5 | (export 6 | generator->lseq lseq? lseq=? 7 | lseq-car lseq-first lseq-cdr lseq-rest lseq-ref lseq-take lseq-drop 8 | lseq-realize lseq->generator lseq-length lseq-append lseq-zip 9 | lseq-map lseq-for-each lseq-filter lseq-remove 10 | lseq-find lseq-find-tail lseq-take-while lseq-drop-while 11 | lseq-any lseq-every lseq-index lseq-member lseq-memq lseq-memv) 12 | 13 | (include "srfi-127.scm") 14 | -------------------------------------------------------------------------------- /src/std/srfi/141.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-141: Integer Division 4 | 5 | (export ceiling/ ceiling-quotient ceiling-remainder 6 | floor/ floor-quotient floor-remainder 7 | truncate/ truncate-quotient truncate-remainder 8 | round/ round-quotient round-remainder 9 | euclidean/ euclidean-quotient euclidean-remainder 10 | balanced/ balanced-quotient balanced-remainder) 11 | 12 | ;; All SRFI-141 operators are already implemented by Gambit 13 | (extern namespace: #f 14 | floor/ floor-quotient floor-remainder 15 | ceiling/ ceiling-quotient ceiling-remainder 16 | truncate/ truncate-quotient truncate-remainder 17 | round/ round-quotient round-remainder 18 | euclidean/ euclidean-quotient euclidean-remainder 19 | balanced/ balanced-quotient balanced-remainder) 20 | -------------------------------------------------------------------------------- /src/std/srfi/145.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-145: Assumptions 4 | 5 | (import :std/error) 6 | (export assume) 7 | 8 | (defrules assume () 9 | ((_ expr) 10 | (assume expr "broken assumption")) 11 | ((_ expr message ...) 12 | (let (val expr) 13 | (if val val (BUG 'assumption message ...))))) 14 | -------------------------------------------------------------------------------- /src/std/srfi/146/hamt-map.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-146: A. Gleckler's HAMT 4 | 5 | (import (only-in :std/srfi/1 fold) 6 | :std/srfi/9 7 | ./hamt 8 | ./hamt-misc) 9 | 10 | (export make-phm phm? 11 | phm->alist 12 | phm/add-alist phm/add-alist! 13 | phm/contains? 14 | phm/count 15 | phm/empty? 16 | phm/for-each 17 | phm/get 18 | phm/immutable 19 | phm/keys 20 | phm/mutable phm/mutable? 21 | phm/put 22 | phm/put! 23 | phm/remove phm/remove! 24 | phm/replace phm/replace! 25 | 26 | ;; This is only needed by tests: 27 | ;;phm/data 28 | ) 29 | 30 | (include "hamt-map.scm") 31 | -------------------------------------------------------------------------------- /src/std/srfi/146/hamt-misc.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-146: A. Gleckler's HAMT 4 | 5 | (import :std/error 6 | (only-in :std/srfi/125 make-hash-table string-hash) 7 | (only-in :std/srfi/128 make-comparator)) 8 | (export assert do-list 9 | make-string-hash-table 10 | with-output-to-string) 11 | (include "hamt-misc.scm") 12 | -------------------------------------------------------------------------------- /src/std/srfi/146/vector-edit.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-146: A. Gleckler's HAMT 4 | 5 | (export vector-edit vector-replace-one vector-without) 6 | (include "vector-edit.scm") 7 | -------------------------------------------------------------------------------- /src/std/srfi/158-iter.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; Iterators for SRFI-158 generators 4 | 5 | (import ./121-iter) 6 | (export in-generator) 7 | -------------------------------------------------------------------------------- /src/std/srfi/159.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: Combinator Formatting 4 | 5 | (import ./159/base 6 | ./159/show 7 | ./159/columnar 8 | ./159/unicode 9 | ./159/color 10 | ./159/pretty) 11 | (export 12 | (except-out (import: ./159/base 13 | ./159/show 14 | ./159/columnar 15 | ./159/unicode 16 | ./159/color 17 | ./159/pretty) 18 | written-shared 19 | pretty-shared)) 20 | -------------------------------------------------------------------------------- /src/std/srfi/159/base.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: base library 4 | 5 | (import :gerbil/gambit 6 | :std/error 7 | ../srfi-support 8 | ../1 9 | ../9 10 | ../125 11 | ../130 12 | ./environment 13 | ./string) 14 | (export 15 | show fn forked with with! each each-in-list call-with-output 16 | displayed written written-shared written-simply numeric nothing 17 | escaped maybe-escaped numeric/si numeric/fitted numeric/comma 18 | ;; internal 19 | output-default extract-shared-objects write-to-string write-with-shares 20 | call-with-shared-ref call-with-shared-ref/cdr) 21 | 22 | (include "base.scm") 23 | (include "write.scm") 24 | -------------------------------------------------------------------------------- /src/std/srfi/159/color.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: unnicode 4 | 5 | (import :std/error 6 | ../13 7 | ./base) 8 | (export as-red as-blue as-green as-cyan as-yellow 9 | as-magenta as-white as-black 10 | as-bold as-underline) 11 | (include "color.scm") 12 | -------------------------------------------------------------------------------- /src/std/srfi/159/columnar.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: columanr formatting 4 | 5 | (import :gerbil/gambit 6 | :std/error 7 | ../srfi-support 8 | ../1 9 | ../9 10 | ../117 11 | ../130 12 | ./base 13 | ./show) 14 | (export 15 | call-with-output-generator call-with-output-generators 16 | string->line-generator 17 | tabular columnar show-columns wrapped wrapped/list wrapped/char 18 | justified line-numbers from-file) 19 | (include "column.scm") 20 | -------------------------------------------------------------------------------- /src/std/srfi/159/environment.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: environment monads [implementation detail] 4 | 5 | (import :std/error ../9) 6 | (export define-environment-monad) 7 | (include "environment.scm") 8 | -------------------------------------------------------------------------------- /src/std/srfi/159/pretty.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: pretty printing format combinator 4 | 5 | (import :std/error 6 | ../1 7 | ../125 8 | ../130 9 | ./base 10 | ./show 11 | ./string) 12 | (export 13 | pretty pretty-shared pretty-simply 14 | joined/shares try-fitted) 15 | (include "pretty.scm") 16 | -------------------------------------------------------------------------------- /src/std/srfi/159/show.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: show stuffs 4 | 5 | (import :std/error 6 | ../13 7 | ./string 8 | ./base) 9 | (export 10 | show fn forked with with! each each-in-list call-with-output 11 | displayed written written-shared written-simply 12 | numeric numeric/comma numeric/si numeric/fitted 13 | nothing nl fl space-to tab-to escaped maybe-escaped 14 | padded padded/left padded/right padded/both 15 | trimmed trimmed/left trimmed/right trimmed/both trimmed/lazy 16 | fitted fitted/left fitted/right fitted/both 17 | joined joined/prefix joined/suffix joined/last joined/dot joined/range 18 | upcased downcased) 19 | 20 | (defalias substring substring*) 21 | (include "show.scm") 22 | -------------------------------------------------------------------------------- /src/std/srfi/159/unicode.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-159: unicode 4 | 5 | (import :std/error 6 | ../151 7 | ./base) 8 | (export as-unicode unicode-terminal-width) 9 | 10 | (defalias bytevector u8vector) 11 | (defalias bytevector-u8-ref u8vector-ref) 12 | (include "unicode.scm") 13 | -------------------------------------------------------------------------------- /src/std/srfi/160/c128.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib c128) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/c64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib c64) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/f32.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib f32) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/f64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib f64) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/s16.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib s16) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/s32.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib s32) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/s64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib s64) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/s8.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib s8) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/u16.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib u16) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/u32.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib u32) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/u64.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib u64) 9 | -------------------------------------------------------------------------------- /src/std/srfi/160/u8.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; SRFI-160: Homogeneous Numeric Vector Libraries 4 | 5 | (import ./base 6 | ./macros) 7 | 8 | (deflib u8) 9 | -------------------------------------------------------------------------------- /src/std/srfi/212.ss: -------------------------------------------------------------------------------- 1 | (export (rename: defalias alias)) 2 | -------------------------------------------------------------------------------- /src/std/srfi/41-iter.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; Iterators for SRFI-41 streams 4 | 5 | (import :std/generic 6 | :std/iter 7 | :std/srfi/41) 8 | (export in-stream) 9 | 10 | (defmethod (:iter (s stream-type)) 11 | (in-stream s)) 12 | 13 | (def (in-stream s) 14 | (def (next it) 15 | (with ((iterator e) it) 16 | (if (stream-pair? e) 17 | (let ((first (stream-car e)) 18 | (rest (stream-cdr e))) 19 | (set! (iterator-e it) rest) 20 | first) 21 | iter-end))) 22 | (make-iterator s next)) 23 | -------------------------------------------------------------------------------- /src/std/srfi/41.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-41: streams library 4 | 5 | (import :std/error 6 | :std/srfi/9) 7 | (export 8 | stream-type 9 | stream-lazy stream-eager stream-delay stream-force 10 | stream-null stream-pair? stream-null? 11 | stream-cons stream-car stream-cdr 12 | stream-lambda 13 | define-stream 14 | list->stream port->stream 15 | stream 16 | stream? 17 | stream->list 18 | stream-append stream-concat 19 | stream-constant 20 | stream-drop stream-drop-while 21 | stream-filter 22 | stream-fold 23 | stream-for-each 24 | stream-from 25 | stream-iterate 26 | stream-length 27 | stream-let 28 | stream-map 29 | stream-match 30 | stream-of 31 | stream-range 32 | stream-ref 33 | stream-reverse 34 | stream-scan 35 | stream-take stream-take-while 36 | stream-unfold stream-unfolds 37 | stream-zip 38 | ) 39 | (include "srfi-41.scm") 40 | -------------------------------------------------------------------------------- /src/std/srfi/42.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-42: Eager Comprehensions 4 | (import :std/error) 5 | (export 6 | do-ec 7 | list-ec append-ec 8 | string-ec string-append-ec 9 | vector-ec 10 | sum-ec product-ec 11 | min-ec max-ec 12 | any?-ec every?-ec 13 | first-ec last-ec 14 | fold-ec fold3-ec 15 | : :list :string :vector :integers 16 | :range :real-range :char-range 17 | :port 18 | :dispatched 19 | :do :let :parallel :while :until) 20 | 21 | (include "srfi-42.scm") 22 | -------------------------------------------------------------------------------- /src/std/srfi/78.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-78: Lightweight testing 4 | 5 | (import :std/error 6 | :std/srfi/42) 7 | (export check check-ec 8 | check-report 9 | check-set-mode! 10 | check-reset! 11 | check-passed?) 12 | 13 | (include "srfi-78.scm") 14 | -------------------------------------------------------------------------------- /src/std/srfi/8.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-8: receive 4 | 5 | (export #t) 6 | 7 | (defrules receive () 8 | ((_ formals expr body ...) 9 | (let-values ((formals expr)) 10 | body ...))) 11 | -------------------------------------------------------------------------------- /src/std/srfi/95.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-95: srfi consensus sorting 4 | 5 | (export sort 6 | sort! 7 | merge! 8 | merge 9 | sorted?) 10 | 11 | (include "srfi-95.scm") 12 | -------------------------------------------------------------------------------- /src/std/srfi/srfi-135/binary.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-135: Immutable Texts 4 | 5 | (import :gerbil/gambit 6 | :std/error 7 | :std/text/utf8 8 | :std/srfi/srfi-135/kernel8 9 | :std/srfi/srfi-135/etc 10 | :std/srfi/srfi-135/macros 11 | :std/srfi/srfi-135/text) 12 | (export #t) 13 | (include "binary.scm") 14 | -------------------------------------------------------------------------------- /src/std/srfi/srfi-135/kernel8.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-135: Immutable Texts 4 | 5 | (import :gerbil/gambit 6 | :std/error 7 | :std/srfi/9 8 | :std/srfi/srfi-135/etc) 9 | (export #t) 10 | (include "kernel8.scm") 11 | -------------------------------------------------------------------------------- /src/std/srfi/srfi-135/macros.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-135: Immutable Texts 4 | 5 | (import :gerbil/gambit 6 | :std/srfi/srfi-135/kernel8 7 | :std/srfi/srfi-135/etc) 8 | (export #t) 9 | (include "macros.scm") 10 | -------------------------------------------------------------------------------- /src/std/srfi/srfi-135/text.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (c) vyzo at hackzen.org 3 | ;;; SRFI-135: Immutable Texts 4 | 5 | (import :gerbil/gambit 6 | :std/error 7 | (only-in :std/srfi/13 string-upcase string-downcase string-titlecase) 8 | :std/srfi/srfi-135/kernel8 9 | :std/srfi/srfi-135/etc 10 | :std/srfi/srfi-135/macros) 11 | (export #t) 12 | (include "text.scm") 13 | -------------------------------------------------------------------------------- /src/std/ssi.ss: -------------------------------------------------------------------------------- 1 | ;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; prelude for hand-written .ssi's 4 | (export begin module import export defruntime defalias load-module quote) 5 | 6 | (defsyntax (defruntime stx) 7 | (syntax-case stx () 8 | ((_ id ...) 9 | (identifier-list? #'(id ...)) 10 | (let (ns (module-context-ns (current-expander-context))) 11 | (with-syntax (((bind-id ...) 12 | (stx-map (lambda (id) 13 | (syntax-local-introduce 14 | (make-symbol ns "#" (stx-e id)))) 15 | #'(id ...)))) 16 | #'(begin 17 | (%#define-runtime id bind-id) 18 | ...)))))) 19 | -------------------------------------------------------------------------------- /src/std/text/_zlib.ssi: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; zlib FFI 4 | prelude: :std/ssi 5 | package: std/text 6 | 7 | (export #t) 8 | (defruntime 9 | Z_OK Z_STREAM_END Z_NEED_DICT 10 | Z_NO_COMPRESSION Z_BEST_SPEED Z_BEST_COMPRESSION Z_DEFAULT_COMPRESSION 11 | Z_FINISH Z_NO_FLUSH 12 | make_z_stream 13 | z_stream_total_in z_stream_total_out 14 | z_stream_avail_in z_stream_avail_out 15 | z_stream_msg 16 | compressBound compress2 17 | inflateInit inflate inflateEnd 18 | deflateInit deflateInit_gz deflate deflateEnd deflateBound 19 | ) 20 | (load-module "std/text/_zlib") 21 | -------------------------------------------------------------------------------- /src/std/text/base64.ssi: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; base64 encoding 4 | prelude: :std/ssi 5 | package: std/text 6 | 7 | (import :std/error) 8 | (export #t) 9 | (defruntime 10 | base64-string->u8vector 11 | base64-substring->u8vector 12 | u8vector->base64-string 13 | subu8vector->base64-string) 14 | (defalias base64-decode base64-string->u8vector) 15 | (defalias base64-decode-substring base64-substring->u8vector) 16 | (defalias base64-encode u8vector->base64-string) 17 | (defalias base64-encode-subu8vector subu8vector->base64-string) 18 | (load-module "std/text/base64") 19 | -------------------------------------------------------------------------------- /src/std/text/json.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; json library 4 | ;;; JSON - scheme correspondence: 5 | ;;; JSON encoding: the following objects can be converted to json: 6 | ;;; - booleans 7 | ;;; - void (corresponding to js's null) 8 | ;;; - real numbers 9 | ;;; - strings 10 | ;;; - proper lists 11 | ;;; - vectors (encoded as lists) 12 | ;;; - hashes with symbolic or string keys mapping to json encodable objects 13 | ;;; - any object that defines a :json method producing a json encodable objects 14 | ;;; JSON decoding produces JSON-encodable objects with the following. 15 | ;;; Note that JSON null is decoded as #!void and JSON lists are decoded as 16 | ;;; Scheme lists 17 | (import ./json/api) 18 | (export (import: ./json/api)) 19 | -------------------------------------------------------------------------------- /src/std/text/json/api.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; json api 4 | (import ./env ./input ./output ./util) 5 | (export read-json write-json 6 | string->json-object json-object->string 7 | bytes->json-object json-object->bytes port->json-object 8 | read-json-key-as-symbol? read-json-object-as-walist? read-json-array-as-vector? 9 | write-json-sort-keys? 10 | ;; The following line is old names / aliases, TO BE REMOVED as early as v0.19 11 | json-symbolic-keys json-sort-keys json-list-wrapper ;; <-- TO BE REMOVED 12 | trivial-class->json-object trivial-json-object->class 13 | trivial-struct->json-object trivial-json-object->struct 14 | JSON JSON::t pretty-json) 15 | -------------------------------------------------------------------------------- /src/std/xml.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; XML interface 4 | 5 | ;;; DEPRECATED: Please use :std/markup/xml 6 | (import :std/markup/xml) 7 | (export (import: :std/markup/xml)) 8 | -------------------------------------------------------------------------------- /src/tools/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | (import :std/build-script) 4 | 5 | (defbuild-script 6 | '("env" 7 | "gxprof" 8 | "gxtags" 9 | "gxpkg" 10 | "gxtest" 11 | "gxensemble/opt" 12 | "gxensemble/util" 13 | "gxensemble/cmd" 14 | "gxensemble/admin" 15 | "gxensemble/env" 16 | "gxensemble/control" 17 | "gxensemble/config" 18 | "gxensemble/ca" 19 | "gxensemble/list" 20 | "gxensemble/misc" 21 | "gxensemble/repl" 22 | "gxensemble/srv" 23 | "gxensemble" 24 | "gxhttpd/opt" 25 | "gxhttpd/config" 26 | "gxhttpd/server" 27 | "gxhttpd") 28 | libdir: (path-expand "lib" (getenv "GERBIL_BUILD_PREFIX" (gerbil-home))) 29 | bindir: (path-expand "bin" (getenv "GERBIL_BUILD_PREFIX" (gerbil-home))) 30 | debug: #f) 31 | -------------------------------------------------------------------------------- /src/tools/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: gerbil/tools) 2 | -------------------------------------------------------------------------------- /src/tools/gxensemble-test/echo.config: -------------------------------------------------------------------------------- 1 | config: test-echo-v0 2 | listen: ":8090" 3 | -------------------------------------------------------------------------------- /src/tools/gxensemble-test/project/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | 4 | (defbuild-script 5 | '("echo/server" 6 | (exe: "echo/main" bin: "echod"))) 7 | -------------------------------------------------------------------------------- /src/tools/gxensemble-test/project/echo/main.ss: -------------------------------------------------------------------------------- 1 | (import :std/cli/getopt 2 | :std/actor 3 | :std/config 4 | :std/logger 5 | :std/sugar 6 | :std/io 7 | :std/misc/shuffle 8 | :std/os/socket 9 | (rename-in ./server (main server-main))) 10 | (export main) 11 | 12 | (deflogger echo) 13 | 14 | (def (main . args) 15 | (call-with-getopt echo-main args 16 | program: "echo" 17 | help: "A simple echo server" 18 | (argument 'server-id 19 | help: "the server id"))) 20 | 21 | (def (echo-main opt) 22 | (let* ((server-id (hash-ref opt 'server-id)) 23 | (cfg (load-ensemble-server-config (string->server-identifier server-id)))) 24 | (become-ensemble-server! cfg server-main))) 25 | -------------------------------------------------------------------------------- /src/tools/gxensemble-test/project/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: test) 2 | -------------------------------------------------------------------------------- /src/tools/gxensemble/cmd.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; actor ensemble management tool 4 | (import ./util 5 | ./admin 6 | ./env 7 | ./control 8 | ./config 9 | ./ca 10 | ./list 11 | ./misc 12 | ./repl 13 | ./srv) 14 | (export 15 | (import: ./admin 16 | ./env 17 | ./control 18 | ./config 19 | ./ca 20 | ./list 21 | ./misc 22 | ./repl 23 | ./srv)) 24 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/.gitignore: -------------------------------------------------------------------------------- 1 | .gerbil 2 | manifest.ss 3 | *~ 4 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | 4 | (defbuild-script 5 | '("site/handler")) 6 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/content/files/hello.txt: -------------------------------------------------------------------------------- 1 | hello, world! 2 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/content/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello 4 | 5 | 6 | hello, world! 7 | 8 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/content/index.txt: -------------------------------------------------------------------------------- 1 | hello, world! 2 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/content/servlets/hello.ss: -------------------------------------------------------------------------------- 1 | (import :std/net/httpd 2 | :std/format) 3 | (export handler-init! handle-request) 4 | 5 | (def state "not initialized") 6 | 7 | (def (handler-init! cfg) 8 | (set! state 'initialized)) 9 | 10 | (def (handle-request req res) 11 | (http-response-write res 200 '(("Content-Type" . "text/plain")) 12 | (format "hello! I am a servlet and my state is ~a~n" state))) 13 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: test) 2 | -------------------------------------------------------------------------------- /src/tools/gxhttpd-test/site/handler.ss: -------------------------------------------------------------------------------- 1 | (import :std/net/httpd 2 | :std/format) 3 | (export handler-init! handle-request) 4 | 5 | (def state "not initialized") 6 | 7 | (def (handler-init! cfg) 8 | (set! state 'initialized)) 9 | 10 | (def (handle-request req res) 11 | (http-response-write res 200 '(("Content-Type" . "text/plain")) 12 | (format "hello! I am a dynamic handler and my state is ~a~n" state))) 13 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/rlb/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | 4 | (defbuild-script 5 | '((exe: "rlb"))) 6 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/rlb/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: demo) 2 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/project/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | (import :std/build-script) 3 | 4 | (defbuild-script 5 | '("handler")) 6 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/project/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: demo) 2 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/project/handler.ss: -------------------------------------------------------------------------------- 1 | (import :std/net/httpd 2 | :std/format 3 | :std/actor) 4 | (export handle-request) 5 | 6 | (def (handle-request req res) 7 | (http-response-write res 200 '(("Content-Type" . "text/plain")) 8 | (format "hello! I am a dynamic handler and in ~a~n" 9 | (if (current-actor-server) 10 | (actor-server-identifier) 11 | '(unknown))))) 12 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/www/files/hello.txt: -------------------------------------------------------------------------------- 1 | hello, world! 2 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello 4 | 5 | 6 | hello, world! 7 | 8 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/www/index.txt: -------------------------------------------------------------------------------- 1 | hello, world! 2 | -------------------------------------------------------------------------------- /src/tutorial/advanced-ensemble/site/www/servlets/hello.ss: -------------------------------------------------------------------------------- 1 | (import :std/net/httpd 2 | :std/format 3 | :std/actor) 4 | (export handle-request) 5 | 6 | (def (handle-request req res) 7 | (http-response-write res 200 '(("Content-Type" . "text/plain")) 8 | (format "hello! I am a servlet in ~a~n" 9 | (if (current-actor-server) 10 | (actor-server-identifier) 11 | '(unknown))))) 12 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/Makefile: -------------------------------------------------------------------------------- 1 | ARCH :=$(shell uname -m) 2 | DOCKER_IMAGE := "gerbil/gerbil:$(ARCH)" 3 | default: linux-static 4 | 5 | build-release: 6 | /opt/gerbil/bin/gxpkg build --release 7 | 8 | linux-static: 9 | docker run -it \ 10 | -e USER=$(USER) \ 11 | -e GERBIL_PATH=/src/.gerbil \ 12 | -v $(PWD):/src:z \ 13 | $(DOCKER_IMAGE) \ 14 | make -C /src/ build-release 15 | 16 | clean: 17 | gerbil clean 18 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | (import :std/build-script) 4 | 5 | (defbuild-script 6 | '("server" 7 | "handler" 8 | "httpd-svc" 9 | (exe: "httpd-exe") 10 | (exe: "httpd-prod-exe") 11 | (exe: "registry-prod-exe"))) 12 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: tutorial/ensemble) -------------------------------------------------------------------------------- /src/tutorial/ensemble/handler.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; dynamic httpd handlers 4 | (import :std/net/httpd) 5 | (export #t) 6 | 7 | (def greeting 8 | "hello there!\n") 9 | 10 | (def (set-greeting! what) 11 | (set! greeting what)) 12 | 13 | (def (write-simple-handler req res) 14 | (http-response-write res 200 '(("Content-Type" . "text/plain")) 15 | greeting)) 16 | 17 | (def (write-chunked-handler req res) 18 | (http-response-begin res 200 '(("Content-Type" . "text/plain"))) 19 | (http-response-chunk res "hello ") 20 | (http-response-chunk res "there!\n") 21 | (http-response-end res)) 22 | 23 | (def (root-handler req res) 24 | (http-response-write res 200 [] "the world is not flat but round!\n")) 25 | 26 | (http-register-handler (current-http-server) "/" root-handler) 27 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/httpd-exe.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; static httpd executable 4 | (import :std/actor 5 | ./server) 6 | (export main) 7 | 8 | (def (main server-id (port "8080")) 9 | (let ((port (string->number port)) 10 | (server-id (string->symbol server-id))) 11 | (call-with-ensemble-server 12 | server-id (cut run! port) 13 | roles: '(httpd)))) 14 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/httpd-svc.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; dynamic httpd executable 4 | (import ./server) 5 | (export main) 6 | 7 | (def (main (port "8080")) 8 | (run! (string->number port))) 9 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/registry-prod-exe.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; "production httpd executable 4 | (import :std/actor 5 | :std/actor-v18/registry 6 | :std/cli/getopt 7 | :std/sugar) 8 | (export main) 9 | 10 | (def (main . args) 11 | (call-with-getopt httpd-main args 12 | program: "registry" 13 | help: "registry server" 14 | (argument 'listen 15 | help: "TLS address to listen to"))) 16 | 17 | (def (httpd-main opt) 18 | (let-hash opt 19 | (call-with-ensemble-server 'registry (cut start-ensemble-registry!) 20 | listen: [(call-with-input-string .listen read)]))) 21 | -------------------------------------------------------------------------------- /src/tutorial/ensemble/server.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; dynamic httpd for ensemble tutorial 4 | (import :std/net/httpd 5 | :std/io) 6 | (export run!) 7 | 8 | (def (run! port) 9 | (let* ((addr (cons inaddr-any4 port)) 10 | (httpd (start-http-server! addr))) 11 | (thread-join! httpd))) 12 | -------------------------------------------------------------------------------- /src/tutorial/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: tutorial) 2 | -------------------------------------------------------------------------------- /src/tutorial/httpd/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | 4 | (import :std/build-script) 5 | (import :std/make) 6 | 7 | (defbuild-script 8 | (cond-expand 9 | (darwin 10 | `((exe: "simpled" 11 | "-cc-options" ,(cppflags "openssl" "") 12 | "-cc-options" "-Wno-implicit-function-declaration" 13 | "-cc-options" "-Wno-deprecated-declarations" 14 | "-ld-options" ,(ldflags "openssl" "")))) 15 | (else 16 | '((exe: "simpled"))))) 17 | -------------------------------------------------------------------------------- /src/tutorial/httpd/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: tutorial/httpd) 2 | -------------------------------------------------------------------------------- /src/tutorial/kvstore/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | (import :std/build-script) 4 | 5 | (defbuild-script 6 | '("proto" 7 | "server" 8 | "kvstore-svc" 9 | (exe: "kvstorec"))) 10 | -------------------------------------------------------------------------------- /src/tutorial/kvstore/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: tutorial/kvstore depend: ("github.com/mighty-gerbils/gerbil-lmdb")) 2 | -------------------------------------------------------------------------------- /src/tutorial/kvstore/kvstore-svc.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; © vyzo 3 | ;;; kvstore ensemble service 4 | (import :std/actor 5 | :clan/db/lmdb 6 | ./server) 7 | (export main) 8 | 9 | (def (main (path #f)) 10 | (let* ((path 11 | (if path 12 | (path-expand path) 13 | (path-expand 14 | (path-expand "kvstore.db" 15 | (ensemble-server-path (actor-server-identifier)))))) 16 | (env (lmdb-open path))) 17 | (thread-join! (spawn/name 'kvstore run env)))) 18 | -------------------------------------------------------------------------------- /src/tutorial/lang/auto-export.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Custom prelude that rebinds %%begin-module 4 | (import :gerbil/core) ;; so that we can re-export 5 | (export (import: :gerbil/core) 6 | (rename: my-%%begin-module %%begin-module)) 7 | 8 | ;; custom %%begin-module that automatically exports all module bindings 9 | (defrules my-%%begin-module () 10 | ((_ . body) 11 | (%%begin-module (export #t) . body))) 12 | -------------------------------------------------------------------------------- /src/tutorial/lang/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | 4 | (import :std/build-script) 5 | 6 | (defbuild-script 7 | '("dot-app" 8 | "auto-export" 9 | "sexp" 10 | "scuby-etc" 11 | "scuby-grammar" 12 | "scuby")) 13 | -------------------------------------------------------------------------------- /src/tutorial/lang/example/my-app.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Simple example that uses the dot-app prelude 4 | prelude: :tutorial/lang/dot-app 5 | 6 | (export #t) 7 | 8 | (defstruct A (x)) 9 | (defmethod {add-x A} 10 | (lambda (self y) 11 | (with ((A x) self) 12 | (+ x y)))) 13 | 14 | ;; use the dotted %%app from dot-app prelude 15 | (def (add-x a y) 16 | (a.add-x y)) 17 | 18 | (def (a-add-x a) 19 | a.add-x) 20 | -------------------------------------------------------------------------------- /src/tutorial/lang/example/my-auto-export.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Simple example that uses the auto-export prelude 4 | prelude: :tutorial/lang/auto-export 5 | 6 | ;; everything is automagically exported, so no export directive needed 7 | (def (greet x) 8 | (displayln "hello " x)) 9 | -------------------------------------------------------------------------------- /src/tutorial/lang/example/my-scuby.ss: -------------------------------------------------------------------------------- 1 | #lang :tutorial/lang/scuby 2 | 3 | def (fibo n) 4 | def (fibo-r x y k) 5 | if (< k n) 6 | (fibo-r (+ x y) x (1+ k)) 7 | else x 8 | end 9 | end 10 | (fibo-r 1 0 1) 11 | end 12 | 13 | def (make-counter x) 14 | def (counter) 15 | def next = x 16 | (set! x (1+ x)) 17 | next 18 | end 19 | counter 20 | end 21 | 22 | def (make-string-prepender pre) 23 | def (prepend str) 24 | (string-append pre str) 25 | end 26 | prepend 27 | end 28 | 29 | def (make-foo-prepender) 30 | (make-string-prepender "foo: ") 31 | end 32 | -------------------------------------------------------------------------------- /src/tutorial/lang/example/my-sexp.ss: -------------------------------------------------------------------------------- 1 | #lang :tutorial/lang/sexp 2 | ;;; -*- Gerbil -*- 3 | ;;; (C) vyzo at hackzen.org 4 | ;;; Simple example that uses the sexp #lang 5 | 6 | (export #t) 7 | 8 | (def (greet x) 9 | (displayln "hello " x)) 10 | -------------------------------------------------------------------------------- /src/tutorial/lang/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: tutorial/lang) 2 | -------------------------------------------------------------------------------- /src/tutorial/lang/sexp.ss: -------------------------------------------------------------------------------- 1 | ;;; -*- Gerbil -*- 2 | ;;; (C) vyzo at hackzen.org 3 | ;;; Custom #lang prelude for an sexp language identical to gerbil 4 | (import :gerbil/core) ;; so that we can re-export 5 | (export (import: :gerbil/core) 6 | (phi: +1 read-module-body)) 7 | 8 | (begin-syntax 9 | (def (read-module-body port) 10 | (let lp ((body [])) 11 | (let (next (read-syntax port)) 12 | (if (eof-object? next) 13 | (reverse body) 14 | (lp (cons next body))))))) 15 | -------------------------------------------------------------------------------- /src/tutorial/proxy/build.ss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gxi 2 | ;; -*- Gerbil -*- 3 | 4 | (import :std/build-script) 5 | 6 | (defbuild-script 7 | '((exe: "tcp-proxy1") 8 | (exe: "tcp-proxy2") 9 | (exe: "tcp-proxy3"))) 10 | -------------------------------------------------------------------------------- /src/tutorial/proxy/gerbil.pkg: -------------------------------------------------------------------------------- 1 | (package: tutorial/proxy) 2 | --------------------------------------------------------------------------------