API Documentation

August 25, 2021 ยท View on GitHub

cyclone-scheme

API Documentation

Standard Libraries

This section of the Cyclone API is based on the R7RS Scheme Specification:

Library NameDescription
PrimitivesThis is not actually a library but rather a summary of all of the built-in functions (AKA primitives).
scheme baseThe R7RS base library. This is quite extensive and will be required by most programs.
scheme case-lambdaExports the case-lambda syntax.
scheme charProvides procedures for dealing with characters.
scheme complexExports procedures for working with non-real numbers.
scheme cxrExports twenty-four procedures which are the compositions of from three to four car and cdr operations.
scheme evalExports procedures for evaluating Scheme data as programs.
scheme fileProvides procedures for accessing files.
scheme inexactProcedures which are typically only useful with inexact values.
scheme lazyProcedures and syntax keywords for lazy evaluation.
scheme loadProcedures for loading Scheme expressions from files.
scheme process-contextProcedures for accessing with the program's calling context.
scheme readProvides procedures for reading Scheme objects.
scheme replProvides functions related to Read-Eval-Print-Loops.
scheme timeProvides access to time-related values.
scheme writeProvides procedures for writing Scheme objects.

SRFI Libraries

Cyclone supports the following Scheme Requests for Implementation (SRFI) libraries. Detailed information is available in the linked SRFI page as well as the provided Cyclone API.

Note that these libraries may be imported using either the SRFI number, such as (srfi 1), or a descriptive name: (scheme list). These descriptive names follow the recommendations from R7RS Large where available.

Library NameSRFI NumberDescriptionExternal Documentation
scheme listsrfi 1List libraryLink
cyclone and-let*srfi 2AND-LET*: an AND with local bindings, a guarded LET* special formLink
N/Asrfi 8Binding to multiple values - Included as part of scheme base.Link
cyclone threadssrfi 18Multithreading supportLink
cyclone randomsrfi 27Sources of random bitsLink
cyclone formatsrfi 28Basic format stringsLink
cyclone integer-bitssrfi 60Integers as bitsLink
scheme hash-tablesrfi 69Basic hash tablesLink
cyclone socketsrfi 106Basic socket interfaceLink
scheme boxsrfi 111BoxesLink
scheme setsrfi 113Sets and bagsLink
scheme list-queuesrfi 117Mutable queuesLink
scheme generatorsrfi 121GeneratorsLink
scheme comparatorsrfi 128ComparatorsLink
scheme sortsrfi 132Sort librariesLink
scheme vectorsrfi 133Vector library (R7RS-compatible)Link
cyclone fixnumsrfi 143FixnumsLink

Cyclone Libraries

These libraries are provided as Cyclone-specific extensions:

Library NameDescription
cyclone concurrentA helper library for writing concurrent code.
cyclone foreignProvides a convenient interface for integrating with C code. It is recommended to use this library if possible rather than our lower-level FFI.
cyclone matchA hygienic pattern matcher based on Alex Shinn's portable match.scm.
cyclone testA unit testing framework ported from (chibi test).
scheme cyclone pretty-printA pretty printer.

Internal Compiler API

These libraries are used by the Cyclone compiler. Some of these are stable and unlikely to change, whereas others could change as the compiler evolves.

Library NameDescription
scheme cyclone astAbstract syntax tree types used during compilation.
scheme cyclone cgenC code generation
scheme cyclone commonMostly version numbers and header comments
scheme cyclone cps-optimizationsCompiler optimizations, analysis, and related transformations
scheme cyclone librariesCompiler support for R7RS libraries
scheme cyclone primitivesCompiler support for primitives
scheme cyclone transformsVarious Scheme-to-Scheme transformations of the intermediate code
scheme cyclone utilUtility functions used internally by the compiler

C API

This documentation covers the C API provided by Cyclone Scheme. It is intended both to help understand how the Cyclone runtime works as well as to provide a useful reference manual when working with the Cyclone FFI.

Index

This section is an alphabetic listing of all the functions, objects, and macros provided by the previous libraries.


%adb:make-fnc %adb:make-var


*Cyc-version-banner* * *af-inet* *af-inet6* *af-unspec* *ai-addrconfig* *ai-all* *ai-canonname* *ai-numerichost* *ai-v4mapped* *c-file-header-comment* *defined-macros* *do-code-gen* *ipproto-ip* *ipproto-tcp* *ipproto-udp* *msg-oob* *msg-peek* *msg-waitall* *primitives* *primitives* *primitives-num-args* *shut-rd* *shut-rdwr* *shut-wr* *sock-dgram* *sock-stream* *trace-level* *version* *version-banner* *version-name* *version-number*


+


->heap -


/


<=? <= <? <


=? =


>=? >= >? >


Cyc-er-compare? Cyc-er-rename Cyc-minor-gc


abs acos adb:clear! adbf:set-simple! adbf:set-unused-params! adbf:simple adb:function? adbf:unused-params adb:get adb:get-db adb:get/default adb:make-fnc adb:make-var adb:set! adb:variable? adbv:assigned-value adbv:const? adbv:const-value adbv:defined-by adbv:global? adbv:reassigned? adbv:ref-by adbv:set-assigned-value! adbv:set-const! adbv:set-const-value! adbv:set-defined-by! adbv:set-global! adbv:set-reassigned! adbv:set-ref-by! address-family address-info alist->bag alist-cons alist-copy alist-delete alist-delete! alist->hash-table alpha-convert analyze-cps analyze-mutable-variables and and-let* angle any any any-bits-set? app? app->args append append! append-map append-map! append-reverse append-reverse! app->fun apply arithmetic-shift ash asin assoc assq assq-remove-key assq-remove-keys assv ast:ast->pp-sexp ast:ast->sexp ast:lambda? ast:lambda-args ast:lambda-body ast:lambda-formals->list ast:lambda-formals-type ast:lambda-id ast:make-lambda ast:set-lambda-args! ast:set-lambda-body! ast:sexp->ast atan atom atom? azip


%adb:make-fnc %adb:make-var


*af-inet6* *af-inet* *af-unspec* *ai-addrconfig* *ai-all* *ai-canonname* *ai-numerichost* *ai-v4mapped*


-


*


+


/


< <=


=


> >=


=?


<?


>?


<=?


>=?


bag-adjoin bag-adjoin! bag->alist bag-any? bag bag? bag=? bag<? bag>? bag<=? bag>=? bag-comparator bag-contains? bag-copy bag-count bag-decrement! bag-delete-all bag-delete-all! bag-delete bag-delete! bag-difference bag-difference! bag-disjoint? bag-element-comparator bag-element-count bag-empty? bag-every? bag-filter bag-filter! bag-find bag-fold bag-fold-unique bag-for-each bag-for-each-unique bag-increment! bag-intersection bag-intersection! bag->list bag-map bag-member bag-partition bag-partition! bag-product bag-product! bag-remove bag-remove! bag-replace bag-replace! bag-search! bag->set bag-size bag-sum bag-sum! bag-unfold bag-union bag-union! bag-unique-size bag-xor bag-xor! basename begin begin? begin->exps bit-count bit-field bit-set? bitwise-and bitwise-if bitwise-ior bitwise-merge bitwise-not bitwise-xor boolean? boolean=? boolean-hash booleans->integer box box? break break! built-in-syms bytevector bytevector? bytevector-append bytevector-copy bytevector-copy! bytevector->generator bytevector-length bytevector-u8-ref bytevector-u8-set!


caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr call/cc call-with-current-continuation call-with-input-file call-with-output-file call-with-port call-with-socket call-with-values car car+cdr case case-lambda c-code cdaaar cdaadr cdaar cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr c-define c-define-type cdr ceiling cell? cell-get? cell-get->cell cell->value char-alphabetic? char? char<=? char<? char=? char>=? char>? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-ci-hash char-downcase char-foldcase char-hash char->integer char-lower-case? char-numeric? char-upcase char-upper-case? char-whitespace? circular-list? circular-list clear-mutables close-input-port close-output-port close-port closure? closure-convert closure->env closure->fv closure->lam command-line command-line-arguments comparator? comparator-check-type comparator-equality-predicate comparator-hashable? comparator-hash comparator-hash-function comparator-if<=> comparator-ordered? comparator-ordering-predicate comparator-register-default! comparator-test-type comparator-type-test-predicate compare-and-set! complex? concatenate concatenate! cond cond-expand condition-variable? condition-variable-broadcast! condition-variable-signal! condition-variable-wait! cons cons* const? copy-bit copy-bit-field cos count cps-convert create-environment current-error-port current-input-port current-jiffy current-output-port current-second current-test-applier current-test-comparator current-test-epsilon current-test-group current-test-group-reporter current-test-skipper current-test-verbosity current-thread current-thread-data c-value


Cyc-er-compare? Cyc-er-rename


cyc:error


Cyc-minor-gc


*c-file-header-comment* *Cyc-version-banner*


default-hash default-random-source define? define-c? define->exp define->lambda define-lambda? define-record-type define->var delay delay-force delete delete delete! delete-duplicates delete-duplicates delete-duplicates! delete-file deliver denominator deref difference digit-value display do dotted-list? drop drop-right drop-right! drop-while dynamic-wind


*defined-macros* *do-code-gen*


eighth emergency-exit emit emit* emit-newline emits emits* env:add-binding-to-frame! env:all-values env:all-variables env:define-variable! env:enclosing-environment env:extend-environment env:first-frame env:frame-values env:frame-variables env-get? env-get->env env-get->field env-get->id env:lookup env:_lookup-variable-value env:lookup-variable-value env-make? env-make->fields env:make-frame env-make->id env-make->values env:set-variable-value! env:the-empty-environment eof-object? eof-object eq? equal? eqv? error error eval even? every every exact exact? exact-integer? exit expand exp expt


features fifth file-exists? filter filter filter! filter-map filter-unused-variables find find-tail finite? first first-set-bit fixnum? flatten floor floor/ floor-quotient floor-remainder floor-remainder flush-output-port fold foldl foldr fold-right force for-each formals->list fourth free-vars future? future future-call future-deref future-done? fxabs fxand fx=? fx- fx<? fx>? fx<=? fx>=? fx+ fx* fxarithmetic-shift fxarithmetic-shift-left fxarithmetic-shift-right fxbit-count fxbit-field fxbit-field-reverse fxbit-field-rotate fxbit-set? fxcopy-bit fxeven? fxfirst-set-bit fx-greatest fxif fxior fx-least fxlength fxmax fxmin fxneg fxnegative? fxnot fxodd? fxpositive? fxquotient fxremainder fxsqrt fxsquare fx-width fxxor fxzero?


gappend gcd gcombine gcons* gdelete gdelete-neighbor-dups gdrop gdrop-while generator-any generator generator-count generator-every generator-find generator-fold generator-for-each generator->list generator->reverse-list generator->string generator-unfold generator->vector generator->vector! gensym get-environment-variable get-environment-variables get-macros get-output-bytevector get-output-string gfilter gindex global-vars gremove gselect gtake gtake-while guard


->heap


has-global? hash hash-bound hash-by-identity hash-salt hash-table->alist hash-table? hash-table-copy hash-table-delete! hash-table-equivalence-function hash-table-exists? hash-table-fold hash-table-hash-function hash-table-keys hash-table-merge! hash-table-ref hash-table-ref/default hash-table-set! hash-table-size hash-table-update! hash-table-update!/default hash-table-values hash-table-walk


identifier=? identifier? identifier->symbol if? if->condition if->else if-else? if->then imag-part immutable? inexact inexact? infinite? input-port? input-port-open? insert integer? integer->char integer-length integer->list interaction-environment iota ip-protocol is-mutable? isolate-globals


*ipproto-ip* *ipproto-tcp* *ipproto-udp*


jiffies-per-second


lambda? lambda->exp lambda->formals lambda-formals->list lambda-formals-type lambda-num-args lambda-varargs? lambda-varargs-var last last-pair lcm length length+ length/obj let let* let? let->args let->bindings let->bound-vars let->exp let=>lambda letrec letrec* letrec? letrec->args letrec->bindings letrec->bound-vars letrec->exp let*-values let-values lib:body lib:exports lib:get-all lib:get-all-import-deps lib:get-dep-list lib:idb:ids lib:import->export-list lib:import->filename lib:import->metalist lib:import->path lib:imports lib:imports->idb lib:include-c-headers lib:includes lib:list->import-set lib:name lib:name->string lib:name->symbol lib:name->unique-string library? library-exists? lib:read-imports lib:rename-exports lib:resolve-meta lib:result list list? list= list->bag list->bag! list-copy list-copy list-delete-neighbor-dups list-delete-neighbor-dups! list->generator list-index2 list-index list-index list-insert-at! list->integer list->lambda-formals list-merge list-merge! list->pair list-prefix? list-queue-add-back! list-queue-add-front! list-queue list-queue? list-queue-append list-queue-append! list-queue-back list-queue-concatenate list-queue-copy list-queue-empty? list-queue-first-last list-queue-for-each list-queue-front list-queue-list list-queue-map list-queue-map! list-queue-remove-all! list-queue-remove-back! list-queue-remove-front! list-queue-set-list! list-queue-unfold list-queue-unfold-right list-ref list-set! list->set list->set! list-sort list-sort! list-sorted? list-stable-sort list-stable-sort! list->string list-tabulate list-tail list->vector load log2-binary-factors logand log logbit? logcount logior lognot logtest logxor lset-adjoin lset<= lset= lset-difference lset-difference! lset-diff+intersection lset-diff+intersection! lset-intersection lset-intersection! lset-union lset-union! lset-xor lset-xor!


magnitude make-atom make-bytevector make-client-socket make-comparator make-condition-variable make-constructor make-coroutine-generator make-default-comparator make-eq-comparator make-equal-comparator make-eqv-comparator make-for-each-generator make-getter make-hash-table make-iota-generator make-list make-list make-list-comparator make-list-queue make-mutex make-pair-comparator make-parameter make-polar make-promise make-random-source make-range-generator make-rectangular make-server-socket make-setter make-shared-delay make-shared-promise make-shared-queue make-string make-thread make-thread-pool make-type-predicate make-unfold-generator make-vector make-vector-comparator mangle mangle-global map map! map-in-order mark-mutable match match-lambda match-lambda* match-let match-let* match-letrec max member memq memv message-type min modulo mta:code-gen mutex? mutex-lock! mutex-unlock!


*msg-oob* *msg-peek* *msg-waitall*


nan? negative? newline ninth not not-pair? null? null-list? number? number-hash number->string numerator


odd? one-instance-of-new-mutable-obj? open-input-bytevector open-input-file open-input-string open-output-bytevector open-output-file open-output-string opt:contract optimize-cps opt:inline-prims or output-port? output-port-open?


pack-lambda-arguments pair? pair-fold pair-fold-right pair-for-each pair->list parameterize partition partition! peek-char port? pos-in-list positive? precompute-prim-app? pretty-print prim:allocates-object?) prim? prim:arg-count? prim-call? prim->c-func prim:check-arg-count prim:cont? prim:cont/no-args? prim/cvar? prim/c-var-assign prim/data-arg? prim:mutates? procedure? promise? proper-list?


*primitives*


quasiquote quote? quotient


raise raise-continuable random-integer random-real random-source? random-source-make-integers random-source-make-reals random-source-pseudo-randomize! random-source-randomize! random-source-state-ref random-source-state-set! rational? read-all read read-char read-line read-string real? realized? real-part receive record? reduce reduce reduce-right ref? remainder remove remove remove! repl reverse reverse! reverse-list->vector reverse-vector->generator reverse-vector->list rotate-bit-field round


*shut-rd* *shut-rdwr* *shut-wr* *sock-dgram* *sock-stream*


second set-adjoin set-adjoin! set-any? set!? set set? set=? set<? set>? set<=? set>=? set->bag set->bag! set-box! set-car! set-cdr! set-cell!? set-cell!->cell set-cell!->value set-comparator set-contains? set-copy set-count set-delete-all set-delete-all! set-delete set-delete! set-difference set-difference! set-disjoint? set-element-comparator set-empty? set-every? set!->exp set-filter set-filter! set-find set-fold set-for-each set-intersection set-intersection! set->list set-map set-member set-partition set-partition! set-remove set-remove! set-replace set-replace! set-search! set-size set-unfold set-union set-union! setup-environment set!->var set-xor set-xor! seventh shared-delay? shared-delay shared-promise? shared-queue-add! shared-queue shared-queue? shared-queue-capacity shared-queue-clear! shared-queue-empty? shared-queue-remove! shared-queue-size shared-queue-wait-count shutdown-method simple-lambda? sin sixth slot-set! socket-accept socket? socket-close socket-domain socket-input-port socket-merge-flags socket-output-port socket-purge-flags socket-recv socket-send socket-shutdown span span! split-at split-at! sqrt square string? string string<=? string<? string=? string>=? string>? string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-ci-hash string-ci-hash string-cmp string-copy string-copy! string-downcase string-fill! string-foldcase string-for-each string->generator string-hash string-hash string-join string-length string->list string-map string->number string-ref string-replace-all string-set! string-split string->symbol string-upcase string->utf8 string->vector substring swap! symbol? symbol=? symbol<? symbol-hash symbol->string syntax-error system


*trace-level*


tagged-list? take take take! take-right take-while take-while! tan tenth test test-assert test-begin test-end test-equal test-error test-exit test-failure-count test-group test-not test-propagate-info test-run test-values third thread? thread-join! thread-name thread-pool? thread-pool-idling? thread-pool-idling-count thread-pool-push-task! thread-pool-release! thread-pool-size thread-sleep! thread-specific thread-specific-set! thread-start! thread-terminate! thread-yield! trace trace:debug trace:error trace:info trace:warn truncate truncate/ truncate-quotient truncate-remainder type-slot-offset


unbox unfold unfold-right union unless unzip1 unzip2 unzip3 unzip4 unzip5 utf8->string


*version* *version-banner* *version-name* *version-number*


values vector-any vector? vector vector= vector-append vector-append-subvectors vector-binary-search vector-concatenate vector-copy vector-copy! vector-count vector-cumulate vector-delete-neighbor-dups vector-delete-neighbor-dups! vector-empty? vector-every vector-fill! vector-find-median vector-find-median! vector-fold vector-fold-right vector-for-each vector->generator vector-index vector-index-right vector-length vector->list vector-map vector-map! vector-merge vector-merge! vector-partition vector-ref vector-reverse! vector-reverse-copy vector-reverse-copy! vector-select! vector-separate! vector-set! vector-skip vector-skip-right vector-sort vector-sort! vector-sorted? vector-stable-sort vector-stable-sort! vector->string vector-swap! vector-unfold vector-unfold! vector-unfold-right vector-unfold-right!


when with-exception-handler with-handler with-input-from-file with-output-to-file wrap-mutables write write-char write-shared write-simple write-string


xcons


zero? zip