123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376 |
- ;;; Copyright (C) 2024 Igalia, S.L.
- ;;; Copyright (C) 2024 David Thompson <dave@spritely.institute>
- ;;;
- ;;; Licensed under the Apache License, Version 2.0 (the "License");
- ;;; you may not use this file except in compliance with the License.
- ;;; You may obtain a copy of the License at
- ;;;
- ;;; http://www.apache.org/licenses/LICENSE-2.0
- ;;;
- ;;; Unless required by applicable law or agreed to in writing, software
- ;;; distributed under the License is distributed on an "AS IS" BASIS,
- ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ;;; See the License for the specific language governing permissions and
- ;;; limitations under the License.
- ;;; Commentary:
- ;;;
- ;;; Shim to implement Guile API on top of Hoot.
- ;;;
- ;;; Code:
- ;; bindings not supported:
- #;
- (define *unimplemented-bindings
- '($sc-dispatch
- %auto-compilation-options
- %char-set-dump
- %compile-fallback-path
- %cond-expand-features
- %cond-expand-table
- %default-port-conversion-strategy
- %default-port-encoding
- %expanded-vtables
- %file-port-name-canonicalization
- %fresh-auto-compile
- %get-pre-modules-obarray
- %get-stack-size
- %global-site-dir
- %guile-build-info
- %host-type
- %init-rdelim-builtins
- %init-rw-builtins
- %library-dir
- %load-announce
- %load-compiled-extensions
- %load-compiled-path
- %load-extensions
- %load-hook
- %load-path
- %load-should-auto-compile
- %load-verbosely
- %package-data-dir
- %port-property
- %print-module
- %read-hash-procedures
- %resolve-variable
- %search-load-path
- %set-port-property!
- %site-ccache-dir
- %site-dir
- %stacks
- %start-stack
- %string-dump
- %symbol-dump
- %warn-auto-compilation-enabled
- &exception-with-kind-and-args
- &programming-error
- &quit-exception
- *features*
- *null-device*
- *random-state*
- *repl-stack*
- ->char-set
- <applicable-struct-vtable>
- <applicable-struct-with-setter-vtable>
- <parameter>
- <standard-vtable>
- @
- @@
- AF_INET
- AF_INET6
- AF_UNIX
- AF_UNSPEC
- AI_ADDRCONFIG
- AI_ALL
- AI_CANONNAME
- AI_NUMERICHOST
- AI_NUMERICSERV
- AI_PASSIVE
- AI_V4MAPPED
- AT_EACCESS
- AT_EMPTY_PATH
- AT_NO_AUTOMOUNT
- AT_REMOVEDIR
- AT_SYMLINK_FOLLOW
- AT_SYMLINK_NOFOLLOW
- E2BIG
- EACCES
- EADDRINUSE
- EADDRNOTAVAIL
- EADV
- EAFNOSUPPORT
- EAGAIN
- EAI_ADDRFAMILY
- EAI_AGAIN
- EAI_ALLDONE
- EAI_BADFLAGS
- EAI_CANCELED
- EAI_FAIL
- EAI_FAMILY
- EAI_IDN_ENCODE
- EAI_INPROGRESS
- EAI_INTR
- EAI_MEMORY
- EAI_NODATA
- EAI_NONAME
- EAI_NOTCANCELED
- EAI_OVERFLOW
- EAI_SERVICE
- EAI_SOCKTYPE
- EAI_SYSTEM
- EALREADY
- EBADE
- EBADF
- EBADFD
- EBADMSG
- EBADR
- EBADRQC
- EBADSLT
- EBFONT
- EBUSY
- ECANCELED
- ECHILD
- ECHRNG
- ECOMM
- ECONNABORTED
- ECONNREFUSED
- ECONNRESET
- EDEADLK
- EDEADLOCK
- EDESTADDRREQ
- EDOM
- EDOTDOT
- EDQUOT
- EEXIST
- EFAULT
- EFBIG
- EHOSTDOWN
- EHOSTUNREACH
- EHWPOISON
- EIDRM
- EILSEQ
- EINPROGRESS
- EINTR
- EINVAL
- EIO
- EISCONN
- EISDIR
- EISNAM
- EKEYEXPIRED
- EKEYREJECTED
- EKEYREVOKED
- EL2HLT
- EL2NSYNC
- EL3HLT
- EL3RST
- ELIBACC
- ELIBBAD
- ELIBEXEC
- ELIBMAX
- ELIBSCN
- ELNRNG
- ELOOP
- EMEDIUMTYPE
- EMFILE
- EMLINK
- EMSGSIZE
- EMULTIHOP
- ENAMETOOLONG
- ENAVAIL
- ENETDOWN
- ENETRESET
- ENETUNREACH
- ENFILE
- ENOANO
- ENOBUFS
- ENOCSI
- ENODATA
- ENODEV
- ENOENT
- ENOEXEC
- ENOKEY
- ENOLCK
- ENOLINK
- ENOMEDIUM
- ENOMEM
- ENOMSG
- ENONET
- ENOPKG
- ENOPROTOOPT
- ENOSPC
- ENOSR
- ENOSTR
- ENOSYS
- ENOTBLK
- ENOTCONN
- ENOTDIR
- ENOTEMPTY
- ENOTNAM
- ENOTRECOVERABLE
- ENOTSOCK
- ENOTSUP
- ENOTTY
- ENOTUNIQ
- ENXIO
- EOPNOTSUPP
- EOVERFLOW
- EOWNERDEAD
- EPERM
- EPFNOSUPPORT
- EPIPE
- EPROTO
- EPROTONOSUPPORT
- EPROTOTYPE
- ERANGE
- EREMCHG
- EREMOTE
- EREMOTEIO
- ERESTART
- ERFKILL
- EROFS
- ESHUTDOWN
- ESOCKTNOSUPPORT
- ESPIPE
- ESRCH
- ESRMNT
- ESTALE
- ESTRPIPE
- ETIME
- ETIMEDOUT
- ETOOMANYREFS
- ETXTBSY
- EUCLEAN
- EUNATCH
- EUSERS
- EWOULDBLOCK
- EXDEV
- EXFULL
- EXIT_FAILURE
- EXIT_SUCCESS
- FD_CLOEXEC
- F_DUPFD
- F_GETFD
- F_GETFL
- F_GETOWN
- F_OK
- F_SETFD
- F_SETFL
- F_SETOWN
- IN6ADDR_ANY
- IN6ADDR_LOOPBACK
- INADDR_ANY
- INADDR_BROADCAST
- INADDR_LOOPBACK
- INADDR_NONE
- IPPROTO_IP
- IPPROTO_IPV6
- IPPROTO_TCP
- IPPROTO_UDP
- IPV6_V6ONLY
- IP_ADD_MEMBERSHIP
- IP_DROP_MEMBERSHIP
- IP_MULTICAST_IF
- IP_MULTICAST_TTL
- ITIMER_PROF
- ITIMER_REAL
- ITIMER_VIRTUAL
- LC_ADDRESS
- LC_ALL
- LC_COLLATE
- LC_CTYPE
- LC_IDENTIFICATION
- LC_MEASUREMENT
- LC_MESSAGES
- LC_MONETARY
- LC_NAME
- LC_NUMERIC
- LC_PAPER
- LC_TELEPHONE
- LC_TIME
- LOCK_EX
- LOCK_NB
- LOCK_SH
- LOCK_UN
- MSG_DONTROUTE
- MSG_DONTWAIT
- MSG_OOB
- MSG_PEEK
- NSIG
- OPEN_BOTH
- OPEN_READ
- OPEN_WRITE
- O_APPEND
- O_ASYNC
- O_CLOEXEC
- O_CREAT
- O_DIRECT
- O_DIRECTORY
- O_EXCL
- O_IGNORE_CTTY
- O_LARGEFILE
- O_NDELAY
- O_NOATIME
- O_NOCTTY
- O_NOFOLLOW
- O_NOLINK
- O_NONBLOCK
- O_NOTRANS
- O_PATH
- O_RDONLY
- O_RDWR
- O_SYNC
- O_TMPFILE
- O_TRUNC
- O_WRONLY
- PF_INET
- PF_INET6
- PF_UNIX
- PF_UNSPEC
- PIPE_BUF
- PRIO_PGRP
- PRIO_PROCESS
- PRIO_USER
- R_OK
- SA_NOCLDSTOP
- SA_RESTART
- SEEK_CUR
- SEEK_DATA
- SEEK_END
- SEEK_HOLE
- SEEK_SET
- SIGABRT
- SIGALRM
- SIGBUS
- SIGCHLD
- SIGCLD
- SIGCONT
- SIGFPE
- SIGHUP
- SIGILL
- SIGINT
- SIGIO
- SIGIOT
- SIGKILL
- SIGPIPE
- SIGPOLL
- SIGPROF
- SIGPWR
- SIGQUIT
- SIGRTMAX
- SIGRTMIN
- SIGSEGV
- SIGSTKFLT
- SIGSTKSZ
- SIGSTOP
- SIGSYS
- SIGTERM
- SIGTRAP
- SIGTSTP
- SIGTTIN
- SIGTTOU
- SIGURG
- SIGUSR1
- SIGUSR2
- SIGVTALRM
- SIGWINCH
- SIGXCPU
- SIGXFSZ
- SIG_DFL
- SIG_IGN
- SOCK_CLOEXEC
- SOCK_DGRAM
- SOCK_NONBLOCK
- SOCK_RAW
- SOCK_RDM
- SOCK_SEQPACKET
- SOCK_STREAM
- SOL_SOCKET
- SO_BROADCAST
- SO_DEBUG
- SO_DONTROUTE
- SO_ERROR
- SO_KEEPALIVE
- SO_LINGER
- SO_NO_CHECK
- SO_OOBINLINE
- SO_PRIORITY
- SO_RCVBUF
- SO_RCVTIMEO
- SO_REUSEADDR
- SO_REUSEPORT
- SO_SNDBUF
- SO_SNDTIMEO
- SO_TYPE
- TCP_CORK
- TCP_NODELAY
- WAIT_ANY
- WAIT_MYPGRP
- WNOHANG
- WUNTRACED
- W_OK
- X_OK
- abort-hook
- abort-to-prompt*
- absolute-file-name?
- accept
- access?
- acosh
- add-hook!
- add-to-load-path
- addrinfo:addr
- addrinfo:canonname
- addrinfo:fam
- addrinfo:flags
- addrinfo:protocol
- addrinfo:socktype
- adjust-port-revealed!
- after-backtrace-hook
- after-error-hook
- after-eval-hook
- after-gc-hook
- after-print-hook
- after-read-hook
- alarm
- allocate-struct
- append!
- array->list
- array-cell-ref
- array-cell-set!
- array-contents
- array-copy!
- array-copy-in-order!
- array-dimensions
- array-equal?
- array-fill!
- array-for-each
- array-in-bounds?
- array-index-map!
- array-length
- array-map!
- array-map-in-order!
- array-rank
- array-ref
- array-set!
- array-shape
- array-slice
- array-slice-for-each
- array-slice-for-each-in-order
- array-type
- array-type-code
- array?
- asinh
- assert-load-verbosity
- assoc-remove!
- assoc-set!
- assq-remove!
- assq-set!
- assv-remove!
- assv-set!
- atanh
- autoload-done!
- autoload-done-or-in-progress?
- autoload-in-progress!
- autoloads-done
- autoloads-in-progress
- backtrace
- basename
- batch-mode?
- beautify-user-module!
- before-backtrace-hook
- before-error-hook
- before-eval-hook
- before-print-hook
- before-read-hook
- begin-deprecated
- bind
- bind-textdomain-codeset
- bindtextdomain
- bit-count
- bit-count*
- bit-extract
- bit-invert!
- bit-position
- bit-set*!
- bitvector->list
- bitvector-bit-clear?
- bitvector-bit-set?
- bitvector-clear-all-bits!
- bitvector-clear-bit!
- bitvector-clear-bits!
- bitvector-copy
- bitvector-count
- bitvector-count-bits
- bitvector-fill!
- bitvector-flip-all-bits!
- bitvector-position
- bitvector-set-all-bits!
- bitvector-set-bit!
- bitvector-set-bits!
- call-with-blocked-asyncs
- call-with-deferred-observers
- call-with-include-port
- call-with-module-autoload-lock
- call-with-unblocked-asyncs
- canonicalize-path
- catch
- ceiling-quotient
- ceiling-remainder
- ceiling/
- centered-quotient
- centered-remainder
- centered/
- char-general-category
- char-is-both?
- char-set
- char-set->list
- char-set->string
- char-set-adjoin
- char-set-adjoin!
- char-set-any
- char-set-complement
- char-set-complement!
- char-set-contains?
- char-set-copy
- char-set-count
- char-set-cursor
- char-set-cursor-next
- char-set-delete
- char-set-delete!
- char-set-diff+intersection
- char-set-diff+intersection!
- char-set-difference
- char-set-difference!
- char-set-every
- char-set-filter
- char-set-filter!
- char-set-fold
- char-set-for-each
- char-set-hash
- char-set-intersection
- char-set-intersection!
- char-set-map
- char-set-ref
- char-set-size
- char-set-unfold
- char-set-unfold!
- char-set-union
- char-set-union!
- char-set-xor
- char-set-xor!
- char-set:ascii
- char-set:blank
- char-set:designated
- char-set:digit
- char-set:empty
- char-set:full
- char-set:graphic
- char-set:hex-digit
- char-set:iso-control
- char-set:letter
- char-set:letter+digit
- char-set:lower-case
- char-set:printing
- char-set:punctuation
- char-set:symbol
- char-set:title-case
- char-set:upper-case
- char-set:whitespace
- char-set<=
- char-set=
- char-set?
- char-titlecase
- chdir
- chmod
- chmodat
- chown
- chown-at
- chroot
- close
- close-fdes
- closedir
- compose
- cond-expand-provide
- connect
- cons-source
- const
- convert-assignment
- copy-file
- copy-random-state
- cosh
- crypt
- ctermid
- current-filename
- current-language
- current-load-port
- current-module
- current-reader
- current-source-location
- current-warning-port
- datum->random-state
- debug-disable
- debug-enable
- debug-options
- debug-options-interface
- debug-set!
- default-duplicate-binding-handler
- default-duplicate-binding-procedures
- define!
- define-inlinable
- define-library
- define-macro
- define-module
- define-module*
- define-once
- define-option-interface
- define-private
- define-public
- define-syntax-parameter
- defined?
- defmacro
- defmacro-public
- delete
- delete!
- delete-file
- delete-file-at
- delete1!
- delv
- delv!
- delv1!
- directory-stream?
- dirname
- display-application
- display-backtrace
- display-error
- dup
- dup->fdes
- dup->inport
- dup->outport
- dup->port
- dup2
- duplicate-handlers
- duplicate-port
- dynamic-call
- dynamic-func
- dynamic-link
- dynamic-object?
- dynamic-pointer
- dynamic-unlink
- effective-version
- end-of-char-set?
- endgrent
- endhostent
- endnetent
- endprotoent
- endpwent
- endservent
- ensure-batch-mode!
- environ
- euclidean-quotient
- euclidean-remainder
- euclidean/
- eval
- eval-string
- eval-when
- exception-accessor
- exception-args
- exception-kind
- exception-predicate
- exception-type?
- execl
- execle
- execlp
- exit-hook
- export
- export!
- export-syntax
- false-if-exception
- fcntl
- fdes->inport
- fdes->outport
- fdes->ports
- fdopen
- file-encoding
- file-exists?
- file-is-directory?
- file-name-separator-string
- file-name-separator?
- file-port?
- file-position
- file-set-position
- fileno
- filter
- filter!
- flock
- fluid->parameter
- fluid-bound?
- fluid-ref*
- fluid-thread-local?
- fluid-unset!
- flush-all-ports
- frame-address
- frame-arguments
- frame-dynamic-link
- frame-instruction-pointer
- frame-previous
- frame-procedure-name
- frame-return-address
- frame-source
- frame-stack-pointer
- frame?
- fsync
- ftell
- gai-strerror
- gc
- gc-disable
- gc-dump
- gc-enable
- gc-run-time
- gc-stats
- gensym
- get-internal-real-time
- get-internal-run-time
- get-print-state
- getaddrinfo
- getaffinity
- getcwd
- getegid
- getenv
- geteuid
- getgid
- getgr
- getgrent
- getgrgid
- getgrnam
- getgroups
- gethost
- gethostbyaddr
- gethostbyname
- gethostent
- gethostname
- getitimer
- getlogin
- getnet
- getnetbyaddr
- getnetbyname
- getnetent
- getpass
- getpeername
- getpgrp
- getpid
- getppid
- getpriority
- getproto
- getprotobyname
- getprotobynumber
- getprotoent
- getpw
- getpwent
- getpwnam
- getpwuid
- getrlimit
- getserv
- getservbyname
- getservbyport
- getservent
- getsid
- getsockname
- getsockopt
- gettext
- gettimeofday
- getuid
- gmtime
- group:gid
- group:mem
- group:name
- group:passwd
- has-shown-backtrace-hint?
- hook->list
- hook-empty?
- hook?
- hostent:addr-list
- hostent:addrtype
- hostent:aliases
- hostent:length
- hostent:name
- identity
- import
- in-vicinity
- include
- include-ci
- include-deprecated-features
- include-library-declarations
- inet-lnaof
- inet-makeaddr
- inet-netof
- inet-ntop
- inet-pton
- inherit-print-state
- install-r6rs!
- install-r7rs!
- integer-expt
- integer-length
- interaction-environment
- internal-time-units-per-second
- iota
- isatty?
- issue-deprecation-warning
- keyword-like-symbol->keyword
- kill
- kw-arg-ref
- library
- link
- list->array
- list->bitvector
- list->char-set
- list->char-set!
- list->symbol
- list->typed-array
- list-cdr-ref
- list-cdr-set!
- list-head
- list-index
- listen
- load
- load-compiled
- load-extension
- load-from-path
- load-in-vicinity
- load-user-init
- local-define
- local-define-module
- local-ref
- local-ref-module
- local-remove
- local-set!
- localtime
- log10
- logcount
- lookup-duplicates-handlers
- lstat
- macro-binding
- macro-name
- macro-transformer
- macro-type
- macro?
- macroexpand
- macroexpanded?
- major-version
- make-array
- make-autoload-interface
- make-exception-type
- make-fresh-user-module
- make-generalized-vector
- make-guardian
- make-hook
- make-module
- make-modules-in
- make-mutable-parameter
- make-object-property
- make-procedure-with-setter
- make-record-type
- make-regexp
- make-shared-array
- make-socket-address
- make-soft-port
- make-stack
- make-struct-layout
- make-struct/no-tail
- make-struct/simple
- make-syntax-transformer
- make-thread-local-fluid
- make-typed-array
- make-unbound-fluid
- make-undefined-variable
- make-variable-transformer
- make-vtable
- map-in-order
- memoize-expression
- memoized-typecode
- merge
- merge!
- micro-version
- minor-version
- mkdir
- mkdirat
- mkdtemp
- mknod
- mkstemp
- mkstemp!
- mktime
- module-add!
- module-autoload!
- module-binder
- module-bound?
- module-call-observers
- module-clear!
- module-constructor
- module-declarative?
- module-defer-observers
- module-define!
- module-define-submodule!
- module-defined-hook
- module-defined?
- module-duplicates-handlers
- module-ensure-local-variable!
- module-export!
- module-export-all!
- module-filename
- module-for-each
- module-generate-unique-id!
- module-gensym
- module-import-interface
- module-import-obarray
- module-inlinable-exports
- module-kind
- module-local-variable
- module-locally-bound?
- module-make-local-var!
- module-map
- module-modified
- module-name
- module-next-unique-id
- module-obarray
- module-obarray-get-handle
- module-obarray-ref
- module-obarray-remove!
- module-obarray-set!
- module-observe
- module-observe-weak
- module-observers
- module-public-interface
- module-re-export!
- module-ref
- module-ref-submodule
- module-remove!
- module-replace!
- module-replacements
- module-reverse-lookup
- module-search
- module-set!
- module-submodule-binder
- module-submodules
- module-symbol-binding
- module-symbol-interned?
- module-symbol-local-binding
- module-symbol-locally-interned?
- module-transformer
- module-type
- module-unobserve
- module-use!
- module-use-interfaces!
- module-uses
- module-variable
- module-version
- module-weak-observers
- module?
- modulo-expt
- move->fdes
- nested-define!
- nested-define-module!
- nested-ref
- nested-ref-module
- nested-remove!
- nested-set!
- netent:addrtype
- netent:aliases
- netent:name
- netent:net
- ngettext
- nice
- nil?
- noop
- object-address
- object-properties
- object-property
- open
- open-fdes
- open-fdes-at
- open-file
- open-file
- open-io-file
- openat
- opendir
- parameter-converter
- parameter-fluid
- parse-path
- parse-path-with-ellipsis
- passwd:dir
- passwd:gecos
- passwd:gid
- passwd:name
- passwd:passwd
- passwd:shell
- passwd:uid
- pause
- pipe
- port->fdes
- port-conversion-strategy
- port-encoding
- port-for-each
- port-mode
- port-revealed
- port-with-print-state
- prefab-record-types
- primitive-_exit
- primitive-eval
- primitive-exit
- primitive-fork
- primitive-load
- primitive-load-path
- primitive-move->fdes
- primitive-read
- print-disable
- print-enable
- print-exception
- print-options
- print-options-interface
- print-set!
- procedure
- procedure-documentation
- procedure-minimum-arity
- procedure-name
- procedure-properties
- procedure-property
- procedure-source
- procedure-with-setter?
- process-use-modules
- protoent:aliases
- protoent:name
- protoent:proto
- provide
- provided?
- purify-module!
- putenv
- raise
- random
- random-state->datum
- random-state-from-platform
- random:exp
- random:hollow-sphere!
- random:normal
- random:normal-vector!
- random:solid-sphere!
- random:uniform
- re-export
- re-export-syntax
- read-disable
- read-enable
- read-eval?
- read-hash-extend
- read-hash-procedure
- read-hash-procedures
- read-options
- read-options-interface
- read-set!
- read-syntax
- readdir
- readlink
- record-accessor
- record-constructor
- record-modifier
- record-predicate
- record-type-constructor
- record-type-descriptor
- record-type-extensible?
- record-type-fields
- record-type-has-parent?
- record-type-mutable-fields
- record-type-name
- record-type-opaque?
- record-type-parent
- record-type-properties
- record-type-uid
- record-type-vtable
- record-type?
- recv!
- recvfrom!
- redirect-port
- regexp-exec
- regexp/basic
- regexp/extended
- regexp/icase
- regexp/newline
- regexp/notbol
- regexp/noteol
- regexp?
- release-port-handle
- reload-module
- remove-hook!
- rename-file
- rename-file-at
- repl-reader
- require-extension
- reset-hook!
- resolve-interface
- resolve-module
- resolve-r6rs-interface
- restore-signals
- restricted-vector-sort!
- reverse!
- reverse-list->string
- rewinddir
- rmdir
- round-ash
- round-quotient
- round-remainder
- round/
- run-hook
- save-module-excursion
- scm-error
- search-path
- seed->random-state
- seek
- select
- self-evaluating?
- send
- sendfile
- sendto
- servent:aliases
- servent:name
- servent:port
- servent:proto
- set-autoloaded!
- set-current-dynamic-state
- set-current-error-port
- set-current-input-port
- set-current-module
- set-current-output-port
- set-exception-printer!
- set-module-binder!
- set-module-declarative?!
- set-module-duplicates-handlers!
- set-module-filename!
- set-module-inlinable-exports!
- set-module-kind!
- set-module-name!
- set-module-next-unique-id!
- set-module-obarray!
- set-module-observers!
- set-module-public-interface!
- set-module-submodule-binder!
- set-module-submodules!
- set-module-transformer!
- set-module-uses!
- set-module-version!
- set-object-properties!
- set-object-property!
- set-port-column!
- set-port-conversion-strategy!
- set-port-encoding!
- set-port-encoding!
- set-port-filename!
- set-port-line!
- set-port-revealed!
- set-procedure-minimum-arity!
- set-procedure-properties!
- set-procedure-property!
- set-program-arguments
- set-source-properties!
- set-source-property!
- set-struct-vtable-name!
- set-symbol-property!
- set-tm:gmtoff
- set-tm:hour
- set-tm:isdst
- set-tm:mday
- set-tm:min
- set-tm:mon
- set-tm:sec
- set-tm:wday
- set-tm:yday
- set-tm:year
- set-tm:zone
- setaffinity
- setegid
- setenv
- seteuid
- setgid
- setgr
- setgrent
- setgroups
- sethost
- sethostent
- sethostname
- setitimer
- setlocale
- setnet
- setnetent
- setpgid
- setpriority
- setproto
- setprotoent
- setpw
- setpwent
- setrlimit
- setserv
- setservent
- setsid
- setsockopt
- setter
- setuid
- setvbuf
- shared-array-increments
- shared-array-offset
- shared-array-root
- shutdown
- sigaction
- signal-handlers
- sinh
- sleep
- sloppy-assoc
- sloppy-assq
- sloppy-assv
- sockaddr:addr
- sockaddr:fam
- sockaddr:flowinfo
- sockaddr:path
- sockaddr:port
- sockaddr:scopeid
- socket
- socketpair
- sort
- sort!
- sort-list
- sort-list!
- sorted?
- source-properties
- source-property
- source-whash
- spawn
- stable-sort
- stable-sort!
- stack-id
- stack-length
- stack-ref
- stack?
- standard-vtable-fields
- start-stack
- stat
- stat:atime
- stat:atimensec
- stat:blksize
- stat:blocks
- stat:ctime
- stat:ctimensec
- stat:dev
- stat:gid
- stat:ino
- stat:mode
- stat:mtime
- stat:mtimensec
- stat:nlink
- stat:perms
- stat:rdev
- stat:size
- stat:type
- stat:uid
- statat
- status:exit-val
- status:stop-sig
- status:term-sig
- strerror
- strftime
- string->char-set
- string->char-set!
- string-any
- string-any-c-code
- string-append/shared
- string-bytes-per-char
- string-capitalize
- string-capitalize!
- string-ci->symbol
- string-ci<
- string-ci<=
- string-ci<>
- string-ci=
- string-ci>
- string-ci>=
- string-compare
- string-compare-ci
- string-concatenate
- string-concatenate-reverse
- string-concatenate-reverse/shared
- string-concatenate/shared
- string-contains
- string-contains-ci
- string-count
- string-delete
- string-downcase!
- string-drop
- string-drop-right
- string-every
- string-every-c-code
- string-filter
- string-fold
- string-fold-right
- string-for-each-index
- string-hash
- string-hash-ci
- string-index
- string-index-right
- string-join
- string-map
- string-map!
- string-normalize-nfc
- string-normalize-nfd
- string-normalize-nfkc
- string-normalize-nfkd
- string-null?
- string-pad
- string-pad-right
- string-prefix-ci?
- string-prefix-length
- string-prefix-length-ci
- string-prefix?
- string-replace
- string-reverse
- string-reverse!
- string-rindex
- string-skip
- string-skip-right
- string-split
- string-suffix-ci?
- string-suffix-length
- string-suffix-length-ci
- string-suffix?
- string-tabulate
- string-take
- string-take-right
- string-titlecase
- string-titlecase!
- string-tokenize
- string-trim
- string-trim-both
- string-trim-right
- string-unfold
- string-unfold-right
- string-upcase!
- string-utf8-length
- string-xcopy!
- string<
- string<=
- string<>
- string=
- string>
- string>=
- strptime
- struct-layout
- struct-ref
- struct-ref/unboxed
- struct-set!
- struct-set!/unboxed
- struct-vtable
- struct-vtable-name
- struct-vtable?
- struct?
- substring-fill!
- substring-move!
- substring/copy
- substring/read-only
- substring/shared
- supports-source-properties?
- symbol
- symbol-append
- symbol-fref
- symbol-fset!
- symbol-hash
- symbol-interned?
- symbol-pref
- symbol-prefix-proc
- symbol-property
- symbol-property-remove!
- symbol-pset!
- symlink
- symlinkat
- sync
- syntax-parameterize
- syntax-source
- syntax-violation
- system
- system*
- system-async-mark
- system-error-errno
- system-file-name-convention
- tanh
- tcgetpgrp
- tcsetpgrp
- textdomain
- the-root-module
- the-scm-module
- thunk?
- times
- tm:gmtoff
- tm:hour
- tm:isdst
- tm:mday
- tm:min
- tm:mon
- tm:sec
- tm:wday
- tm:yday
- tm:year
- tm:zone
- tmpfile
- tmpnam
- tms:clock
- tms:cstime
- tms:cutime
- tms:stime
- tms:utime
- transpose-array
- truncate
- truncate-file
- truncate-quotient
- truncate-remainder
- truncate/
- try-load-module
- try-module-autoload
- ttyname
- typed-array?
- tzset
- ucs-range->char-set
- ucs-range->char-set!
- umask
- uname
- unmemoize-expression
- unread-char
- unread-string
- unsetenv
- use-modules
- use-srfis
- user-modules-declarative?
- using-readline?
- usleep
- utime
- utsname:machine
- utsname:nodename
- utsname:release
- utsname:sysname
- utsname:version
- variable-bound?
- variable-unset!
- vector-move-left!
- vector-move-right!
- version
- version-matches?
- vtable-index-layout
- vtable-index-printer
- vtable-offset-user
- waitpid
- warn
- while
- with-continuation-barrier
- with-ellipsis
- with-fluids*
- with-throw-handler
- xsubstring))
- (library (guile)
- (export %make-void-port
- &compound-exception
- &error
- &exception
- &non-continuable
- *
- *unspecified*
- +
- -
- ->bool
- ...
- /
- 1+ 1-
- <
- <=
- =
- =>
- >
- >=
- _
- abort-to-prompt
- abs
- acons
- acos
- and
- and-map
- and=>
- angle
- append
- apply
- ash
- asin
- assoc
- assoc-ref
- assq
- assq-ref
- assv
- assv-ref
- atan
- begin
- bitvector
- bitvector-length
- bitvector-ref
- bitvector-set!
- bitvector?
- boolean?
- bound-identifier=?
- caaaar
- caaadr
- caaar
- caadar
- caaddr
- caadr
- caar
- cadaar
- cadadr
- cadar
- caddar
- cadddr
- caddr
- cadr
- call-with-current-continuation
- call-with-input-file
- call-with-input-string
- call-with-output-file
- call-with-output-string
- call-with-port
- call-with-prompt
- call-with-values
- call/cc
- car
- case
- case-lambda
- case-lambda*
- cdaaar
- cdaadr
- cdaar
- cdadar
- cdaddr
- cdadr
- cdar
- cddaar
- cddadr
- cddar
- cdddar
- cddddr
- cdddr
- cddr
- cdr
- ceiling
- char->integer
- char-alphabetic?
- char-ci<=?
- char-ci<?
- char-ci=?
- char-ci>=?
- char-ci>?
- char-downcase
- char-lower-case?
- char-numeric?
- char-ready?
- char-upcase
- char-upper-case?
- char-whitespace?
- char<=?
- char<?
- char=?
- char>=?
- char>?
- char?
- close-input-port
- close-output-port
- close-port
- command-line
- complex?
- cond
- cond-expand
- cons
- cons*
- cos
- current-dynamic-state
- current-error-port
- current-input-port
- current-output-port
- current-time
- datum->syntax
- default-prompt-tag
- define
- define*
- define-syntax
- define-syntax-rule
- define-values
- delay
- delq
- delq!
- delq1!
- denominator
- display
- do
- doubly-weak-hash-table?
- drain-input
- dynamic-state?
- dynamic-wind
- else
- eof-object?
- eq?
- equal?
- eqv?
- error
- even?
- (rename inexact exact->inexact)
- exact-integer-sqrt
- exact-integer?
- exact?
- exception?
- exit
- exp
- expt
- finite?
- floor
- floor-quotient
- floor-remainder
- floor/
- fluid-ref
- fluid-set!
- fluid?
- for-each
- force
- force-output
- format
- free-identifier=?
- gcd
- generate-temporaries
- get-output-string
- hash
- hash-clear!
- hash-count
- hash-create-handle!
- hash-fold
- hash-for-each
- hash-for-each-handle
- hash-get-handle
- hash-map->list
- hash-ref
- hash-remove!
- hash-set!
- hash-table?
- hashq
- hashq-create-handle!
- hashq-get-handle
- hashq-ref
- hashq-remove!
- hashq-set!
- hashv
- hashv-create-handle!
- hashv-get-handle
- hashv-ref
- hashv-remove!
- hashv-set!
- hashx-create-handle!
- hashx-get-handle
- hashx-ref
- hashx-remove!
- hashx-set!
- identifier-syntax
- identifier?
- if
- imag-part
- include-from-path
- (rename exact inexact->exact)
- inexact?
- inf
- (rename infinite? inf?)
- input-port?
- integer->char
- integer?
- keyword->symbol
- keyword?
- lambda
- lambda*
- last-pair
- lcm
- length
- let
- let*
- let-syntax
- letrec
- letrec*
- letrec-syntax
- list
- list->string
- list->vector
- list-copy
- list-ref
- list-set!
- list-tail
- list?
- log
- logand
- logbit?
- logior
- lognot
- logtest
- logxor
- magnitude
- make-bitvector
- make-doubly-weak-hash-table
- make-exception
- make-exception-from-throw
- make-fluid
- make-hash-table
- make-list
- make-parameter
- make-polar
- make-promise
- make-prompt-tag
- make-rectangular
- make-string
- make-symbol
- (rename make-box make-variable)
- make-vector
- make-weak-key-hash-table
- make-weak-value-hash-table
- map
- max
- member
- memq
- memv
- min
- modulo
- most-negative-fixnum
- most-positive-fixnum
- nan
- nan?
- negate
- negative?
- newline
- not
- null?
- number->string
- number?
- numerator
- object->string
- odd?
- open-input-file
- open-input-string
- open-output-file
- open-output-string
- or
- or-map
- output-port?
- pair?
- parameter?
- parameterize
- peek
- peek-char
- pk
- port-closed?
- port-column
- port-filename
- port-line
- port?
- positive?
- procedure?
- program-arguments
- promise?
- quasiquote
- quasisyntax
- quit
- quote
- quote-syntax
- quotient
- raise-exception
- rational?
- rationalize
- read
- read-char
- real-part
- real?
- record-type-parents
- record?
- remainder
- reverse
- round
- set!
- set-car!
- set-cdr!
- simple-exceptions
- simple-format
- sin
- sqrt
- string
- string->list
- string->number
- string->symbol
- string-append
- string-ci<=?
- string-ci<?
- string-ci=?
- string-ci>=?
- string-ci>?
- string-copy
- string-copy!
- string-downcase
- string-fill!
- string-for-each
- string-length
- string-ref
- string-set!
- string-upcase
- string<=?
- string<?
- string=?
- string>=?
- string>?
- string?
- substring
- symbol->keyword
- symbol->string
- symbol?
- syntax
- syntax->datum
- syntax-case
- syntax-error
- syntax-rules
- tan
- the-eof-object
- throw
- unless
- unquote
- unquote-splicing
- unspecified?
- unsyntax
- unsyntax-splicing
- values
- (rename box-ref variable-ref)
- (rename box-set! variable-set!)
- (rename box? variable?)
- vector
- vector->list
- vector-copy
- vector-copy!
- vector-fill!
- vector-length
- vector-ref
- vector-set!
- vector?
- weak-key-hash-table?
- weak-value-hash-table?
- when
- with-dynamic-state
- with-error-to-file
- with-error-to-port
- with-error-to-string
- with-exception-handler
- with-fluid*
- with-fluids
- with-input-from-file
- with-input-from-port
- with-input-from-string
- with-output-to-file
- with-output-to-port
- with-output-to-string
- with-syntax
- write
- write-char
- zero?
- λ)
- (import (hoot assoc)
- (hoot bitvectors)
- (hoot bitwise)
- (hoot boxes)
- (hoot bytevectors)
- (hoot char)
- (hoot cond-expand)
- (hoot control)
- (hoot dynamic-states)
- (hoot dynamic-wind)
- (hoot eq)
- (hoot equal)
- (hoot error-handling)
- (hoot errors)
- (hoot exceptions)
- (hoot features)
- (hoot fluids)
- (hoot hashtables)
- (hoot keywords)
- (hoot lists)
- (hoot not)
- (hoot numbers)
- (hoot pairs)
- (hoot parameters)
- (hoot ports)
- (only (hoot primitives) apply)
- (hoot procedures)
- (only (hoot read) read string->number)
- (hoot strings)
- (hoot syntax)
- (hoot symbols)
- (hoot values)
- (hoot vectors)
- (hoot write)
- (ice-9 match)
- (only (scheme base) boolean?)
- (only (scheme char)
- char-ci<? char-ci<=? char-ci=? char-ci>=? char-ci>?
- string-ci<? string-ci<=? string-ci=? string-ci>=? string-ci>?)
- (only (scheme file)
- open-input-file
- open-output-file
- call-with-input-file
- call-with-output-file
- with-input-from-file
- with-output-to-file)
- (scheme lazy)
- (scheme process-context)
- (scheme time)
- (srfi srfi-9))
- (define (%make-void-port mode)
- (define (mode-prefix-match? test)
- (call-with-input-string mode
- (lambda (p)
- (let lp ((c (read-char p)))
- (cond
- ((eof-object? c) #f)
- ((or (test c)
- (char-ci=? c #\+)) #t)
- (else (lp (read-char p))))))))
- (define %read
- (and (mode-prefix-match? (lambda (c)
- (char-ci=? c #\r)))
- (lambda (bv start count) (eof-object))))
- (define %write
- (and (mode-prefix-match? (lambda (c)
- (or (char-ci=? c #\w)
- (char-ci=? c #\a))))
- (lambda (bv start count) count)))
- (make-port %read ; read
- %write ; write
- #f ; input-waiting?
- #f ; seek
- #f ; close
- #f ; truncate
- "void" ; repr
- #f ; filename
- 1024 ; read-buf-size
- 1024 ; write-buf-size
- #f ; r/w-random-access
- #f ; fold-case?
- #f ; private data
- ))
- (define-syntax *unspecified*
- (identifier-syntax (if #f #f)))
- (define (->bool x) (if x #t #f))
- (define (and-map f l)
- (match l
- (() #t)
- ((x . l)
- (and (f x) (and-map f l)))))
- (define (or-map f l)
- (match l
- (() #f)
- ((x . l)
- (or (f x) (or-map f l)))))
- (define (and=> x f) (and x (f x)))
- (define (assq-ref alist x) (and=> (assq x alist) cdr))
- (define (assv-ref alist x) (and=> (assv x alist) cdr))
- (define (assoc-ref alist x) (and=> (assoc x alist) cdr))
- (define (delq item lst)
- (match lst
- (() '())
- ((x . rest)
- (if (eq? item x)
- (delq item rest)
- (cons x (delq item rest))))))
- (define (delq! item lst)
- (match lst
- (() '())
- ((x . rest)
- (if (eq? item x)
- (delq! item rest)
- (let ((rest* (delq! item rest)))
- (set-cdr! lst rest*)
- lst)))))
- (define (delq1! item lst)
- (match lst
- (() '())
- ((x . rest)
- (if (eq? item x)
- rest
- (let ((rest* (delq1! item rest)))
- (set-cdr! lst rest*)
- lst)))))
- (define (call-with-input-string str proc)
- (proc (open-input-string str)))
- (define (call-with-output-string proc)
- (let ((port (open-output-string)))
- (proc port)
- (get-output-string port)))
- (define (with-input-from-string str thunk)
- (call-with-input-string str
- (lambda (port)
- (with-input-from-port port thunk))))
- (define (with-output-to-string thunk)
- (call-with-output-string
- (lambda (port)
- (with-output-to-port port thunk))))
- (define (with-input-from-port port thunk)
- (parameterize ((current-input-port port))
- (thunk)))
- (define (with-output-to-port port thunk)
- (parameterize ((current-output-port port))
- (thunk)))
- (define (with-error-to-port port thunk)
- (parameterize ((current-error-port port))
- (thunk)))
- (define (with-error-to-file filename thunk)
- (call-with-port (open-output-file filename)
- (lambda (port)
- (with-error-to-port port thunk))))
- (define (with-error-to-string thunk)
- (call-with-output-string
- (lambda (port) (with-error-to-port port thunk))))
- (define (current-time) (current-jiffy))
- (define* (drain-input #:optional (port (current-input-port)))
- (flush-input-port port))
- (define* (force-output #:optional (port (current-output-port)))
- (flush-output-port port))
- (define (simple-format port template . args)
- (define (do-format port)
- (call-with-input-string
- template
- (lambda (in)
- (let lp ((args args))
- (match (read-char in)
- ((? eof-object?)
- (match args
- (() (force-output port))
- (_ (error "leftover format args" template args))))
- (#\~
- (match (read-char in)
- ((or #\a #\A)
- (match args
- ((x . args) (display x port) (lp args))
- (_ (error "not enough format args" template))))
- ((or #\s #\S)
- (match args
- ((x . args) (write x port) (lp args))
- (_ (error "not enough format args" template))))
- (#\~ (write-char #\~ port) (lp args))
- (#\% (newline port) (lp args))
- (ch (error "unexpected format directive" template ch))))
- (ch (write-char ch port) (lp args)))))))
- (match port
- (#t (do-format (current-output-port)))
- (#f (call-with-output-string do-format))
- ((? output-port?) (do-format port))
- (_ (error "invalid format destination" port))))
- (define format simple-format)
- (define (inf) +inf.0)
- (define (nan) +nan.0)
- (define (negate x) (- x))
- (define* (object->string obj #:optional (print write))
- (call-with-output-string (lambda (port) (print obj port))))
- (define (last-pair l)
- (match l
- ((_ . (and l (_ . _))) (last-pair l))
- ((_ . _) l)
- (_ (error "not a pair" l))))
- (define (peek . stuff)
- (newline)
- (display ";;; ")
- (write stuff)
- (newline)
- (flush-output-port (current-output-port))
- (car (last-pair stuff)))
- (define pk peek)
- (define (port-closed? port) (not (port-open? port)))
- (define (program-arguments) (command-line))
- (define quit exit)
- (define the-eof-object (eof-object))
- (define (unspecified? x) (eq? x *unspecified*))
- (define-syntax-rule (λ formals body ...)
- (lambda formals body ...))
- ;; TODO: Implement Guile's conversions based on key.
- (define (make-exception-from-throw key args)
- (make-exception-with-irritants args))
- (define (throw key . args)
- (raise-exception (make-exception-from-throw key args)))
- ;; Hash table API compatibility shim:
- ;;
- ;; Guile's legacy hash table API is not so great. It allows for
- ;; mixing different hash functions in the same table, which is why
- ;; there are *four* variants for ref/set!/remove! procedures. On
- ;; top of that, the API is also polymorphic. Those same procedures
- ;; are used on "normal", weak key, weak value, and doubly weak
- ;; tables.
- ;;
- ;; We made a better interface in (hoot hashtables) that resembles
- ;; the R6RS API and is monomorphic. However, in the interest of
- ;; maximizing the amount of existing Guile code that can be compiled
- ;; as-is with Hoot, we have provided this compatibility shim.
- ;;
- ;; Hoot does *not* provide full compatibility, just partial
- ;; compatibility for common use-cases. Code that is mixing hash
- ;; functions in the same table or using
- ;; hash-get-handle/hash-create-handle! is not supported. Also,
- ;; because hashx-* procedures use assoc and friends, which is
- ;; incompatible with how (hoot hashtables) does equality testing, we
- ;; force equal? as the equivalence function.
- (define-record-type <hash-table>
- (%make-hash-table type)
- hash-table?
- (type hash-table-type) ; normal, weak-key, weak-value, doubly-weak
- (table hash-table-table set-hash-table-table!)) ; lazily initialized
- (define* (make-hash-table #:optional size)
- "Return a new hash table. @var{size} is ignored."
- (%make-hash-table 'normal))
- (define* (make-weak-key-hash-table #:optional size)
- "Return a new weak key hash table. @var{size} is ignored."
- (%make-hash-table 'weak-key))
- (define* (make-weak-value-hash-table #:optional size)
- "Return a new weak value hash table. @var{size} is ignored."
- (%make-hash-table 'weak-value))
- (define* (make-doubly-weak-hash-table #:optional size)
- "Return a new doubly weak hash table. @var{size} is ignored."
- (%make-hash-table 'doubly-weak))
- (define (weak-key-hash-table? obj)
- "Return @code{#t} if @var{obj} is a weak key hash table."
- (and (hash-table? obj) (eq? (hash-table-type obj) 'weak-key)))
- (define (weak-value-hash-table? obj)
- "Return @code{#t} if @var{obj} is a weak value hash table."
- (and (hash-table? obj) (eq? (hash-table-type obj) 'weak-value)))
- (define (doubly-weak-hash-table? obj)
- "Return @code{#t} if @var{obj} is a doubly weak hash table."
- (and (hash-table? obj) (eq? (hash-table-type obj) 'doubly-weak)))
- ;; Should these assert that the hash and equiv functions are what we
- ;; expect? Currently, mixing hash functions on the same table will
- ;; just silently use the hash function of the first ref/set!/remove!
- ;; call.
- (define (maybe-init-equal-hashtable table)
- (unless (hash-table-table table)
- (match (hash-table-type table)
- ('normal (set-hash-table-table! table (make-hashtable)))
- ('weak-key (raise (make-unimplemented-error 'maybe-init-equal-hash-table)))
- ('weak-value (raise (make-unimplemented-error 'maybe-init-equal-hash-table)))
- ('doubly-weak (raise (make-unimplemented-error 'maybe-init-equal-hash-table))))))
- (define (maybe-init-eq-hashtable table)
- (unless (hash-table-table table)
- (match (hash-table-type table)
- ('normal (set-hash-table-table! table (make-eq-hashtable)))
- ('weak-key (set-hash-table-table! table (make-weak-key-hashtable)))
- ('weak-value (raise (make-unimplemented-error 'maybe-init-eq-hash-table)))
- ('doubly-weak (raise (make-unimplemented-error 'maybe-init-eq-hash-table))))))
- (define (maybe-init-eqv-hashtable table)
- (unless (hash-table-table table)
- (match (hash-table-type table)
- ('normal (set-hash-table-table! table (make-eqv-hashtable)))
- ('weak-key (raise (make-unimplemented-error 'maybe-init-eqv-hash-table)))
- ('weak-value (raise (make-unimplemented-error 'maybe-init-eqv-hash-table)))
- ('doubly-weak (raise (make-unimplemented-error 'maybe-init-eqv-hash-table))))))
- (define (maybe-init-custom-hashtable table hash equiv)
- (unless (hash-table-table table)
- (match (hash-table-type table)
- ('normal (set-hash-table-table! table (make-hashtable hash equiv)))
- ('weak-key (raise (make-unimplemented-error 'maybe-init-custom-hash-table)))
- ('weak-value (raise (make-unimplemented-error 'maybe-init-custom-hash-table)))
- ('doubly-weak (raise (make-unimplemented-error 'maybe-init-custom-hash-table))))))
- (define (%hash-ref who table key default)
- (let ((table* (hash-table-table table)))
- (match (hash-table-type table)
- ('normal (hashtable-ref table* key default))
- ('weak-key (weak-key-hashtable-ref table* key default))
- ('weak-value (raise (make-unimplemented-error who)))
- ('doubly-weak (raise (make-unimplemented-error who))))))
- (define* (hash-ref table key #:optional default)
- "Look up @var{key} in the hash table @var{table}, and return the
- value associated with it. If @var{key} is not found, return
- @var{default} (if specified) or @code{#f}. Uses @code{equal?} for
- equality testing."
- (maybe-init-equal-hashtable table)
- (%hash-ref 'hash-ref table key default))
- (define* (hashq-ref table key #:optional default)
- "Look up @var{key} in the hash table @var{table}, and return the
- value associated with it. If @var{key} is not found, return
- @var{default} (if specified) or @code{#f}. Uses @code{eq?} for
- equality testing."
- (maybe-init-eq-hashtable table)
- (%hash-ref 'hashq-ref table key default))
- (define* (hashv-ref table key #:optional default)
- "Look up @var{key} in the hash table @var{table}, and return the
- value associated with it. If @var{key} is not found, return
- @var{default} (if specified) or @code{#f}. Uses @code{eqv?} for
- equality testing."
- (maybe-init-eqv-hashtable table)
- (%hash-ref 'hashv-ref table key default))
- (define* (hashx-ref hash assoc table key #:optional default)
- "Look up @var{key} in the hash table @var{table}, and return the
- value associated with it. If @var{key} is not found, return
- @var{default} (if specified) or @code{#f}. Uses @var{hash} as the
- hash function. @var{assoc} is ignored and @code{equal?} is used for
- equality testing."
- (maybe-init-custom-hashtable table hash equal?)
- (%hash-ref 'hashx-ref table key default))
- (define (%hash-set! who table key val)
- (let ((table* (hash-table-table table)))
- (match (hash-table-type table)
- ('normal (hashtable-set! table* key val))
- ('weak-key (weak-key-hashtable-set! table* key val))
- ('weak-value (raise (make-unimplemented-error who)))
- ('doubly-weak (raise (make-unimplemented-error who))))))
- (define (hash-set! table key val)
- "Find the entry in @var{table} associated with @var{key} and store
- @var{val} there. Uses @code{equal?} for equality testing."
- (maybe-init-equal-hashtable table)
- (%hash-set! 'hash-set! table key val))
- (define (hashq-set! table key val)
- "Find the entry in @var{table} associated with @var{key} and store
- @var{val} there. Uses @code{eq?} for equality testing."
- (maybe-init-eq-hashtable table)
- (%hash-set! 'hashq-set! table key val))
- (define (hashv-set! table key val)
- "Find the entry in @var{table} associated with @var{key} and store
- @var{val} there. Uses @code{eqv?} for equality testing."
- (maybe-init-eqv-hashtable table)
- (%hash-set! 'hashv-set! table key val))
- (define (hashx-set! hash assoc table key val)
- "Find the entry in @var{table} associated with @var{key} and store
- @var{val} there. Uses @var{hash} as the hash function. @var{assoc}
- is ignored and @code{equal?} is used for equality testing."
- (maybe-init-custom-hashtable table hash equal?)
- (%hash-set! 'hashx-set! table key val))
- (define (%hash-remove! who table key)
- (let ((table* (hash-table-table table)))
- (match (hash-table-type table)
- ('normal (hashtable-delete! table* key))
- ('weak-key (weak-key-hashtable-delete! table* key))
- ('weak-value (raise (make-unimplemented-error who)))
- ('doubly-weak (raise (make-unimplemented-error who))))))
- (define (hash-remove! table key)
- "Remove @var{key} from @var{table}. Uses @code{equal?} for equality
- testing."
- (maybe-init-equal-hashtable table)
- (%hash-remove! 'hash-remove! table key))
- (define (hashq-remove! table key)
- "Remove @var{key} from @var{table}. Uses @code{eq?} for equality
- testing."
- (maybe-init-eq-hashtable table)
- (%hash-remove! 'hashq-remove! table key))
- (define (hashv-remove! table key)
- "Remove @var{key} from @var{table}. Uses @code{eqv?} for equality
- testing."
- (maybe-init-eqv-hashtable table)
- (%hash-remove! 'hashv-remove! table key))
- (define (hashx-remove! hash assoc table key)
- "Remove @var{key} from @var{table}. Uses @var{hash} as the hash
- function. @var{assoc} is ignored and @code{equal?} is used for
- equality testing."
- (maybe-init-custom-hashtable table hash equal?)
- (%hash-remove! 'hashx-remove! table key))
- (define (hash-get-handle table key)
- (raise (make-unimplemented-error 'hash-get-handle)))
- (define (hashq-get-handle table key)
- (raise (make-unimplemented-error 'hashq-get-handle)))
- (define (hashv-get-handle table key)
- (raise (make-unimplemented-error 'hashv-get-handle)))
- (define (hashx-get-handle hash assoc table key)
- (raise (make-unimplemented-error 'hashx-get-handle)))
- (define (hash-create-handle! table key init)
- (raise (make-unimplemented-error 'hash-create-handle!)))
- (define (hashq-create-handle! table key init)
- (raise (make-unimplemented-error 'hashq-create-handle!)))
- (define (hashv-create-handle! table key init)
- (raise (make-unimplemented-error 'hashv-create-handle!)))
- (define (hashx-create-handle! hash assoc table key init)
- (raise (make-unimplemented-error 'hashx-create-handle!)))
- (define (hash-clear! table)
- "Remove all items from @var{table}."
- (match (hash-table-table table)
- (#f (values))
- (table*
- (match (hash-table-type table)
- ('normal (hashtable-clear! table*))
- ('weak-key (raise (make-unimplemented-error 'hash-clear!)))
- ('weak-value (raise (make-unimplemented-error 'hash-clear!)))
- ('doubly-weak (raise (make-unimplemented-error 'hash-clear!)))))))
- (define (hash-fold proc init table)
- "Accumulate a result by applying @var{proc} with each key/value
- association in @var{table} and the result of the previous @var{proc}
- call. Each call is of the form @code{(proc key value prev)}. For the
- first call, @code{prev} is the initial value @var{init}."
- (match (hash-table-table table)
- (#f init)
- (table*
- (match (hash-table-type table)
- ('normal (hashtable-fold proc init table*))
- ('weak-key (raise (make-unimplemented-error 'hash-fold)))
- ('weak-value (raise (make-unimplemented-error 'hash-fold)))
- ('doubly-weak (raise (make-unimplemented-error 'hash-fold)))))))
- (define (hash-map->list proc table)
- "Return an association list of key/value mappings in @var{table}."
- (hash-fold (lambda (key value result)
- (cons (proc key value) result))
- '() table))
- (define (hash-count pred table)
- "Return the number of elements in @var{table} that satisfy @code{(pred
- key value)}."
- (hash-fold (lambda (key val count)
- (if (pred key val)
- (1+ count)
- count))
- 0 table))
- (define (hash-for-each proc table)
- "Apply @var{proc} to each key/value association in @var{table}.
- Each call is of the form @code{(proc key value)}."
- (match (hash-table-table table)
- (#f (values))
- (table*
- (match (hash-table-type table)
- ('normal (hashtable-for-each proc table*))
- ('weak-key (raise (make-unimplemented-error 'hash-for-each)))
- ('weak-value (raise (make-unimplemented-error 'hash-for-each)))
- ('doubly-weak (raise (make-unimplemented-error 'hash-for-each)))))))
- (define (hash-for-each-handle proc table)
- (raise (make-unimplemented-error 'hash-for-each-handle))))
|