guile.scm 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872
  1. ;;; Copyright (C) 2024 Igalia, S.L.
  2. ;;; Copyright (C) 2024 David Thompson <dave@spritely.institute>
  3. ;;;
  4. ;;; Licensed under the Apache License, Version 2.0 (the "License");
  5. ;;; you may not use this file except in compliance with the License.
  6. ;;; You may obtain a copy of the License at
  7. ;;;
  8. ;;; http://www.apache.org/licenses/LICENSE-2.0
  9. ;;;
  10. ;;; Unless required by applicable law or agreed to in writing, software
  11. ;;; distributed under the License is distributed on an "AS IS" BASIS,
  12. ;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. ;;; See the License for the specific language governing permissions and
  14. ;;; limitations under the License.
  15. ;;; Commentary:
  16. ;;;
  17. ;;; Shim to implement Guile API on top of Hoot.
  18. ;;;
  19. ;;; Code:
  20. ;; bindings not supported:
  21. #;
  22. (define *unimplemented-bindings
  23. '($sc-dispatch
  24. %auto-compilation-options
  25. %char-set-dump
  26. %compile-fallback-path
  27. %cond-expand-features
  28. %cond-expand-table
  29. %expanded-vtables
  30. %file-port-name-canonicalization
  31. %fresh-auto-compile
  32. %get-pre-modules-obarray
  33. %get-stack-size
  34. %global-site-dir
  35. %guile-build-info
  36. %host-type
  37. %init-rdelim-builtins
  38. %init-rw-builtins
  39. %library-dir
  40. %load-announce
  41. %load-compiled-extensions
  42. %load-compiled-path
  43. %load-extensions
  44. %load-hook
  45. %load-path
  46. %load-should-auto-compile
  47. %load-verbosely
  48. %package-data-dir
  49. %port-property
  50. %print-module
  51. %read-hash-procedures
  52. %resolve-variable
  53. %search-load-path
  54. %set-port-property!
  55. %site-ccache-dir
  56. %site-dir
  57. %stacks
  58. %start-stack
  59. %string-dump
  60. %symbol-dump
  61. %warn-auto-compilation-enabled
  62. &exception-with-kind-and-args
  63. &programming-error
  64. &quit-exception
  65. *features*
  66. *null-device*
  67. *random-state*
  68. *repl-stack*
  69. ->char-set
  70. <applicable-struct-vtable>
  71. <applicable-struct-with-setter-vtable>
  72. <parameter>
  73. <standard-vtable>
  74. @
  75. AF_INET
  76. AF_INET6
  77. AF_UNIX
  78. AF_UNSPEC
  79. AI_ADDRCONFIG
  80. AI_ALL
  81. AI_CANONNAME
  82. AI_NUMERICHOST
  83. AI_NUMERICSERV
  84. AI_PASSIVE
  85. AI_V4MAPPED
  86. AT_EACCESS
  87. AT_EMPTY_PATH
  88. AT_NO_AUTOMOUNT
  89. AT_REMOVEDIR
  90. AT_SYMLINK_FOLLOW
  91. AT_SYMLINK_NOFOLLOW
  92. E2BIG
  93. EACCES
  94. EADDRINUSE
  95. EADDRNOTAVAIL
  96. EADV
  97. EAFNOSUPPORT
  98. EAGAIN
  99. EAI_ADDRFAMILY
  100. EAI_AGAIN
  101. EAI_ALLDONE
  102. EAI_BADFLAGS
  103. EAI_CANCELED
  104. EAI_FAIL
  105. EAI_FAMILY
  106. EAI_IDN_ENCODE
  107. EAI_INPROGRESS
  108. EAI_INTR
  109. EAI_MEMORY
  110. EAI_NODATA
  111. EAI_NONAME
  112. EAI_NOTCANCELED
  113. EAI_OVERFLOW
  114. EAI_SERVICE
  115. EAI_SOCKTYPE
  116. EAI_SYSTEM
  117. EALREADY
  118. EBADE
  119. EBADF
  120. EBADFD
  121. EBADMSG
  122. EBADR
  123. EBADRQC
  124. EBADSLT
  125. EBFONT
  126. EBUSY
  127. ECANCELED
  128. ECHILD
  129. ECHRNG
  130. ECOMM
  131. ECONNABORTED
  132. ECONNREFUSED
  133. ECONNRESET
  134. EDEADLK
  135. EDEADLOCK
  136. EDESTADDRREQ
  137. EDOM
  138. EDOTDOT
  139. EDQUOT
  140. EEXIST
  141. EFAULT
  142. EFBIG
  143. EHOSTDOWN
  144. EHOSTUNREACH
  145. EHWPOISON
  146. EIDRM
  147. EILSEQ
  148. EINPROGRESS
  149. EINTR
  150. EINVAL
  151. EIO
  152. EISCONN
  153. EISDIR
  154. EISNAM
  155. EKEYEXPIRED
  156. EKEYREJECTED
  157. EKEYREVOKED
  158. EL2HLT
  159. EL2NSYNC
  160. EL3HLT
  161. EL3RST
  162. ELIBACC
  163. ELIBBAD
  164. ELIBEXEC
  165. ELIBMAX
  166. ELIBSCN
  167. ELNRNG
  168. ELOOP
  169. EMEDIUMTYPE
  170. EMFILE
  171. EMLINK
  172. EMSGSIZE
  173. EMULTIHOP
  174. ENAMETOOLONG
  175. ENAVAIL
  176. ENETDOWN
  177. ENETRESET
  178. ENETUNREACH
  179. ENFILE
  180. ENOANO
  181. ENOBUFS
  182. ENOCSI
  183. ENODATA
  184. ENODEV
  185. ENOENT
  186. ENOEXEC
  187. ENOKEY
  188. ENOLCK
  189. ENOLINK
  190. ENOMEDIUM
  191. ENOMEM
  192. ENOMSG
  193. ENONET
  194. ENOPKG
  195. ENOPROTOOPT
  196. ENOSPC
  197. ENOSR
  198. ENOSTR
  199. ENOSYS
  200. ENOTBLK
  201. ENOTCONN
  202. ENOTDIR
  203. ENOTEMPTY
  204. ENOTNAM
  205. ENOTRECOVERABLE
  206. ENOTSOCK
  207. ENOTSUP
  208. ENOTTY
  209. ENOTUNIQ
  210. ENXIO
  211. EOPNOTSUPP
  212. EOVERFLOW
  213. EOWNERDEAD
  214. EPERM
  215. EPFNOSUPPORT
  216. EPIPE
  217. EPROTO
  218. EPROTONOSUPPORT
  219. EPROTOTYPE
  220. ERANGE
  221. EREMCHG
  222. EREMOTE
  223. EREMOTEIO
  224. ERESTART
  225. ERFKILL
  226. EROFS
  227. ESHUTDOWN
  228. ESOCKTNOSUPPORT
  229. ESPIPE
  230. ESRCH
  231. ESRMNT
  232. ESTALE
  233. ESTRPIPE
  234. ETIME
  235. ETIMEDOUT
  236. ETOOMANYREFS
  237. ETXTBSY
  238. EUCLEAN
  239. EUNATCH
  240. EUSERS
  241. EWOULDBLOCK
  242. EXDEV
  243. EXFULL
  244. EXIT_FAILURE
  245. EXIT_SUCCESS
  246. FD_CLOEXEC
  247. F_DUPFD
  248. F_GETFD
  249. F_GETFL
  250. F_GETOWN
  251. F_OK
  252. F_SETFD
  253. F_SETFL
  254. F_SETOWN
  255. IN6ADDR_ANY
  256. IN6ADDR_LOOPBACK
  257. INADDR_ANY
  258. INADDR_BROADCAST
  259. INADDR_LOOPBACK
  260. INADDR_NONE
  261. IPPROTO_IP
  262. IPPROTO_IPV6
  263. IPPROTO_TCP
  264. IPPROTO_UDP
  265. IPV6_V6ONLY
  266. IP_ADD_MEMBERSHIP
  267. IP_DROP_MEMBERSHIP
  268. IP_MULTICAST_IF
  269. IP_MULTICAST_TTL
  270. ITIMER_PROF
  271. ITIMER_REAL
  272. ITIMER_VIRTUAL
  273. LC_ADDRESS
  274. LC_ALL
  275. LC_COLLATE
  276. LC_CTYPE
  277. LC_IDENTIFICATION
  278. LC_MEASUREMENT
  279. LC_MESSAGES
  280. LC_MONETARY
  281. LC_NAME
  282. LC_NUMERIC
  283. LC_PAPER
  284. LC_TELEPHONE
  285. LC_TIME
  286. LOCK_EX
  287. LOCK_NB
  288. LOCK_SH
  289. LOCK_UN
  290. MSG_DONTROUTE
  291. MSG_DONTWAIT
  292. MSG_OOB
  293. MSG_PEEK
  294. NSIG
  295. OPEN_BOTH
  296. OPEN_READ
  297. OPEN_WRITE
  298. O_APPEND
  299. O_ASYNC
  300. O_CLOEXEC
  301. O_CREAT
  302. O_DIRECT
  303. O_DIRECTORY
  304. O_EXCL
  305. O_IGNORE_CTTY
  306. O_LARGEFILE
  307. O_NDELAY
  308. O_NOATIME
  309. O_NOCTTY
  310. O_NOFOLLOW
  311. O_NOLINK
  312. O_NONBLOCK
  313. O_NOTRANS
  314. O_PATH
  315. O_RDONLY
  316. O_RDWR
  317. O_SYNC
  318. O_TMPFILE
  319. O_TRUNC
  320. O_WRONLY
  321. PF_INET
  322. PF_INET6
  323. PF_UNIX
  324. PF_UNSPEC
  325. PIPE_BUF
  326. PRIO_PGRP
  327. PRIO_PROCESS
  328. PRIO_USER
  329. R_OK
  330. SA_NOCLDSTOP
  331. SA_RESTART
  332. SEEK_DATA
  333. SEEK_HOLE
  334. SIGABRT
  335. SIGALRM
  336. SIGBUS
  337. SIGCHLD
  338. SIGCLD
  339. SIGCONT
  340. SIGFPE
  341. SIGHUP
  342. SIGILL
  343. SIGINT
  344. SIGIO
  345. SIGIOT
  346. SIGKILL
  347. SIGPIPE
  348. SIGPOLL
  349. SIGPROF
  350. SIGPWR
  351. SIGQUIT
  352. SIGRTMAX
  353. SIGRTMIN
  354. SIGSEGV
  355. SIGSTKFLT
  356. SIGSTKSZ
  357. SIGSTOP
  358. SIGSYS
  359. SIGTERM
  360. SIGTRAP
  361. SIGTSTP
  362. SIGTTIN
  363. SIGTTOU
  364. SIGURG
  365. SIGUSR1
  366. SIGUSR2
  367. SIGVTALRM
  368. SIGWINCH
  369. SIGXCPU
  370. SIGXFSZ
  371. SIG_DFL
  372. SIG_IGN
  373. SOCK_CLOEXEC
  374. SOCK_DGRAM
  375. SOCK_NONBLOCK
  376. SOCK_RAW
  377. SOCK_RDM
  378. SOCK_SEQPACKET
  379. SOCK_STREAM
  380. SOL_SOCKET
  381. SO_BROADCAST
  382. SO_DEBUG
  383. SO_DONTROUTE
  384. SO_ERROR
  385. SO_KEEPALIVE
  386. SO_LINGER
  387. SO_NO_CHECK
  388. SO_OOBINLINE
  389. SO_PRIORITY
  390. SO_RCVBUF
  391. SO_RCVTIMEO
  392. SO_REUSEADDR
  393. SO_REUSEPORT
  394. SO_SNDBUF
  395. SO_SNDTIMEO
  396. SO_TYPE
  397. TCP_CORK
  398. TCP_NODELAY
  399. WAIT_ANY
  400. WAIT_MYPGRP
  401. WNOHANG
  402. WUNTRACED
  403. W_OK
  404. X_OK
  405. abort-hook
  406. abort-to-prompt*
  407. absolute-file-name?
  408. accept
  409. access?
  410. acosh
  411. add-hook!
  412. add-to-load-path
  413. addrinfo:addr
  414. addrinfo:canonname
  415. addrinfo:fam
  416. addrinfo:flags
  417. addrinfo:protocol
  418. addrinfo:socktype
  419. adjust-port-revealed!
  420. after-backtrace-hook
  421. after-error-hook
  422. after-eval-hook
  423. after-gc-hook
  424. after-print-hook
  425. after-read-hook
  426. alarm
  427. allocate-struct
  428. array->list
  429. array-cell-set!
  430. array-contents
  431. array-copy!
  432. array-copy-in-order!
  433. array-dimensions
  434. array-equal?
  435. array-fill!
  436. array-in-bounds?
  437. array-index-map!
  438. array-map!
  439. array-map-in-order!
  440. array-set!
  441. array-slice
  442. array-slice-for-each
  443. array-slice-for-each-in-order
  444. array-type-code
  445. asinh
  446. assert-load-verbosity
  447. assoc-remove!
  448. assoc-set!
  449. assq-remove!
  450. assq-set!
  451. assv-remove!
  452. assv-set!
  453. atanh
  454. autoload-done!
  455. autoload-done-or-in-progress?
  456. autoload-in-progress!
  457. autoloads-done
  458. autoloads-in-progress
  459. backtrace
  460. basename
  461. batch-mode?
  462. beautify-user-module!
  463. before-backtrace-hook
  464. before-error-hook
  465. before-eval-hook
  466. before-print-hook
  467. before-read-hook
  468. begin-deprecated
  469. bind
  470. bind-textdomain-codeset
  471. bindtextdomain
  472. bit-count
  473. bit-count*
  474. bit-extract
  475. bit-invert!
  476. bit-position
  477. bit-set*!
  478. bitvector->list
  479. bitvector-bit-clear?
  480. bitvector-bit-set?
  481. bitvector-clear-all-bits!
  482. bitvector-clear-bit!
  483. bitvector-clear-bits!
  484. bitvector-copy
  485. bitvector-count
  486. bitvector-count-bits
  487. bitvector-fill!
  488. bitvector-flip-all-bits!
  489. bitvector-position
  490. bitvector-set-all-bits!
  491. bitvector-set-bit!
  492. bitvector-set-bits!
  493. call-with-blocked-asyncs
  494. call-with-deferred-observers
  495. call-with-include-port
  496. call-with-module-autoload-lock
  497. call-with-unblocked-asyncs
  498. canonicalize-path
  499. centered-quotient
  500. centered-remainder
  501. centered/
  502. char-general-category
  503. char-is-both?
  504. char-set-adjoin
  505. char-set-adjoin!
  506. char-set-any
  507. char-set-complement
  508. char-set-complement!
  509. char-set-copy
  510. char-set-count
  511. char-set-cursor
  512. char-set-cursor-next
  513. char-set-delete
  514. char-set-delete!
  515. char-set-diff+intersection
  516. char-set-diff+intersection!
  517. char-set-difference
  518. char-set-difference!
  519. char-set-every
  520. char-set-filter
  521. char-set-filter!
  522. char-set-fold
  523. char-set-for-each
  524. char-set-hash
  525. char-set-intersection
  526. char-set-intersection!
  527. char-set-map
  528. char-set-ref
  529. char-set-size
  530. char-set-unfold
  531. char-set-unfold!
  532. char-set-union!
  533. char-set-xor
  534. char-set-xor!
  535. char-set:designated
  536. char-set<=
  537. char-set=
  538. char-titlecase
  539. chdir
  540. chmod
  541. chmodat
  542. chown
  543. chown-at
  544. chroot
  545. close-fdes
  546. closedir
  547. compose
  548. connect
  549. cons-source
  550. convert-assignment
  551. copy-file
  552. copy-random-state
  553. cosh
  554. crypt
  555. ctermid
  556. current-filename
  557. current-language
  558. current-load-port
  559. current-module
  560. current-reader
  561. current-source-location
  562. current-warning-port
  563. datum->random-state
  564. debug-disable
  565. debug-enable
  566. debug-options
  567. debug-options-interface
  568. debug-set!
  569. default-duplicate-binding-handler
  570. default-duplicate-binding-procedures
  571. define!
  572. define-library
  573. define-macro
  574. define-module
  575. define-module*
  576. define-once
  577. define-option-interface
  578. define-private
  579. define-public
  580. define-syntax-parameter
  581. defined?
  582. defmacro
  583. defmacro-public
  584. delete
  585. delete!
  586. delete-file
  587. delete-file-at
  588. delete1!
  589. delv
  590. delv!
  591. delv1!
  592. directory-stream?
  593. dirname
  594. display-application
  595. display-backtrace
  596. display-error
  597. dup
  598. dup->fdes
  599. dup->inport
  600. dup->outport
  601. dup->port
  602. dup2
  603. duplicate-handlers
  604. duplicate-port
  605. dynamic-call
  606. dynamic-func
  607. dynamic-link
  608. dynamic-object?
  609. dynamic-pointer
  610. dynamic-unlink
  611. effective-version
  612. end-of-char-set?
  613. endgrent
  614. endhostent
  615. endnetent
  616. endprotoent
  617. endpwent
  618. endservent
  619. ensure-batch-mode!
  620. environ
  621. eval
  622. eval-string
  623. eval-when
  624. exception-accessor
  625. exception-args
  626. exception-kind
  627. exception-predicate
  628. exception-type?
  629. execl
  630. execle
  631. execlp
  632. exit-hook
  633. export
  634. export!
  635. export-syntax
  636. fcntl
  637. fdes->inport
  638. fdes->outport
  639. fdes->ports
  640. fdopen
  641. file-encoding
  642. file-exists?
  643. file-is-directory?
  644. file-name-separator-string
  645. file-name-separator?
  646. file-port?
  647. file-set-position
  648. fileno
  649. filter!
  650. flock
  651. fluid->parameter
  652. fluid-bound?
  653. fluid-ref*
  654. fluid-thread-local?
  655. fluid-unset!
  656. flush-all-ports
  657. frame-address
  658. frame-arguments
  659. frame-dynamic-link
  660. frame-instruction-pointer
  661. frame-previous
  662. frame-procedure-name
  663. frame-return-address
  664. frame-source
  665. frame-stack-pointer
  666. frame?
  667. fsync
  668. gai-strerror
  669. gc
  670. gc-disable
  671. gc-dump
  672. gc-enable
  673. gc-run-time
  674. gc-stats
  675. gensym
  676. get-internal-real-time
  677. get-internal-run-time
  678. get-print-state
  679. getaddrinfo
  680. getaffinity
  681. getcwd
  682. getegid
  683. getenv
  684. geteuid
  685. getgid
  686. getgr
  687. getgrent
  688. getgrgid
  689. getgrnam
  690. getgroups
  691. gethost
  692. gethostbyaddr
  693. gethostbyname
  694. gethostent
  695. gethostname
  696. getitimer
  697. getlogin
  698. getnet
  699. getnetbyaddr
  700. getnetbyname
  701. getnetent
  702. getpass
  703. getpeername
  704. getpgrp
  705. getpid
  706. getppid
  707. getpriority
  708. getproto
  709. getprotobyname
  710. getprotobynumber
  711. getprotoent
  712. getpw
  713. getpwent
  714. getpwnam
  715. getpwuid
  716. getrlimit
  717. getserv
  718. getservbyname
  719. getservbyport
  720. getservent
  721. getsid
  722. getsockname
  723. getsockopt
  724. gettext
  725. gettimeofday
  726. getuid
  727. gmtime
  728. group:gid
  729. group:mem
  730. group:name
  731. group:passwd
  732. has-shown-backtrace-hint?
  733. hook->list
  734. hook-empty?
  735. hook?
  736. hostent:addr-list
  737. hostent:addrtype
  738. hostent:aliases
  739. hostent:length
  740. hostent:name
  741. import
  742. in-vicinity
  743. include
  744. include-ci
  745. include-deprecated-features
  746. include-library-declarations
  747. inet-lnaof
  748. inet-makeaddr
  749. inet-netof
  750. inet-ntop
  751. inherit-print-state
  752. install-r6rs!
  753. install-r7rs!
  754. integer-expt
  755. integer-length
  756. interaction-environment
  757. internal-time-units-per-second
  758. isatty?
  759. keyword-like-symbol->keyword
  760. kill
  761. kw-arg-ref
  762. library
  763. link
  764. list->array
  765. list->bitvector
  766. list->char-set!
  767. list->symbol
  768. list->typed-array
  769. list-cdr-ref
  770. list-cdr-set!
  771. list-index
  772. listen
  773. load
  774. load-compiled
  775. load-extension
  776. load-from-path
  777. load-in-vicinity
  778. load-user-init
  779. local-define
  780. local-define-module
  781. local-ref
  782. local-ref-module
  783. local-remove
  784. local-set!
  785. localtime
  786. log10
  787. logcount
  788. lookup-duplicates-handlers
  789. lstat
  790. macro-binding
  791. macro-name
  792. macro-transformer
  793. macro-type
  794. macro?
  795. macroexpand
  796. macroexpanded?
  797. major-version
  798. make-array
  799. make-autoload-interface
  800. make-exception-type
  801. make-fresh-user-module
  802. make-generalized-vector
  803. make-guardian
  804. make-hook
  805. make-module
  806. make-modules-in
  807. make-mutable-parameter
  808. make-object-property
  809. make-procedure-with-setter
  810. make-record-type
  811. make-socket-address
  812. make-soft-port
  813. make-stack
  814. make-struct-layout
  815. make-struct/no-tail
  816. make-struct/simple
  817. make-syntax-transformer
  818. make-thread-local-fluid
  819. make-typed-array
  820. make-unbound-fluid
  821. make-undefined-variable
  822. make-variable-transformer
  823. make-vtable
  824. map-in-order
  825. memoize-expression
  826. memoized-typecode
  827. merge
  828. merge!
  829. micro-version
  830. minor-version
  831. mkdir
  832. mkdirat
  833. mkdtemp
  834. mknod
  835. mkstemp
  836. mkstemp!
  837. mktime
  838. module-add!
  839. module-autoload!
  840. module-binder
  841. module-bound?
  842. module-call-observers
  843. module-clear!
  844. module-constructor
  845. module-declarative?
  846. module-defer-observers
  847. module-define!
  848. module-define-submodule!
  849. module-defined-hook
  850. module-defined?
  851. module-duplicates-handlers
  852. module-ensure-local-variable!
  853. module-export!
  854. module-export-all!
  855. module-filename
  856. module-for-each
  857. module-generate-unique-id!
  858. module-gensym
  859. module-import-interface
  860. module-import-obarray
  861. module-inlinable-exports
  862. module-kind
  863. module-local-variable
  864. module-locally-bound?
  865. module-make-local-var!
  866. module-map
  867. module-modified
  868. module-name
  869. module-next-unique-id
  870. module-obarray
  871. module-obarray-get-handle
  872. module-obarray-ref
  873. module-obarray-remove!
  874. module-obarray-set!
  875. module-observe
  876. module-observe-weak
  877. module-observers
  878. module-public-interface
  879. module-re-export!
  880. module-ref
  881. module-ref-submodule
  882. module-remove!
  883. module-replace!
  884. module-replacements
  885. module-reverse-lookup
  886. module-search
  887. module-submodule-binder
  888. module-submodules
  889. module-symbol-binding
  890. module-symbol-interned?
  891. module-symbol-local-binding
  892. module-symbol-locally-interned?
  893. module-transformer
  894. module-type
  895. module-unobserve
  896. module-use!
  897. module-use-interfaces!
  898. module-uses
  899. module-variable
  900. module-version
  901. module-weak-observers
  902. module?
  903. modulo-expt
  904. move->fdes
  905. nested-define!
  906. nested-define-module!
  907. nested-ref
  908. nested-ref-module
  909. nested-remove!
  910. nested-set!
  911. netent:addrtype
  912. netent:aliases
  913. netent:name
  914. netent:net
  915. ngettext
  916. nice
  917. nil?
  918. noop
  919. object-properties
  920. object-property
  921. open
  922. open-fdes
  923. open-fdes-at
  924. open-file
  925. open-file
  926. open-io-file
  927. openat
  928. opendir
  929. parameter-converter
  930. parameter-fluid
  931. parse-path
  932. parse-path-with-ellipsis
  933. passwd:dir
  934. passwd:gecos
  935. passwd:gid
  936. passwd:name
  937. passwd:passwd
  938. passwd:shell
  939. passwd:uid
  940. pause
  941. pipe
  942. port->fdes
  943. port-for-each
  944. port-mode
  945. port-revealed
  946. port-with-print-state
  947. prefab-record-types
  948. primitive-_exit
  949. primitive-eval
  950. primitive-exit
  951. primitive-fork
  952. primitive-load
  953. primitive-load-path
  954. primitive-move->fdes
  955. primitive-read
  956. print-disable
  957. print-enable
  958. print-exception
  959. print-options
  960. print-options-interface
  961. print-set!
  962. procedure
  963. procedure-documentation
  964. procedure-minimum-arity
  965. procedure-properties
  966. procedure-property
  967. procedure-source
  968. procedure-with-setter?
  969. process-use-modules
  970. protoent:aliases
  971. protoent:name
  972. protoent:proto
  973. provide
  974. provided?
  975. purify-module!
  976. putenv
  977. raise
  978. random
  979. random-state->datum
  980. random-state-from-platform
  981. random:exp
  982. random:hollow-sphere!
  983. random:normal
  984. random:normal-vector!
  985. random:solid-sphere!
  986. random:uniform
  987. re-export
  988. re-export-syntax
  989. read-disable
  990. read-enable
  991. read-eval?
  992. read-hash-extend
  993. read-hash-procedure
  994. read-hash-procedures
  995. read-options
  996. read-options-interface
  997. read-set!
  998. read-syntax
  999. readdir
  1000. readlink
  1001. record-accessor
  1002. record-constructor
  1003. record-modifier
  1004. record-predicate
  1005. record-type-constructor
  1006. record-type-descriptor
  1007. record-type-extensible?
  1008. record-type-fields
  1009. record-type-has-parent?
  1010. record-type-mutable-fields
  1011. record-type-name
  1012. record-type-opaque?
  1013. record-type-parent
  1014. record-type-properties
  1015. record-type-uid
  1016. record-type-vtable
  1017. record-type?
  1018. recv!
  1019. recvfrom!
  1020. redirect-port
  1021. release-port-handle
  1022. reload-module
  1023. remove-hook!
  1024. rename-file
  1025. rename-file-at
  1026. repl-reader
  1027. require-extension
  1028. reset-hook!
  1029. resolve-interface
  1030. resolve-module
  1031. resolve-r6rs-interface
  1032. restore-signals
  1033. reverse!
  1034. reverse-list->string
  1035. rewinddir
  1036. rmdir
  1037. round-ash
  1038. round-quotient
  1039. round-remainder
  1040. round/
  1041. run-hook
  1042. save-module-excursion
  1043. search-path
  1044. seed->random-state
  1045. select
  1046. self-evaluating?
  1047. send
  1048. sendfile
  1049. sendto
  1050. servent:aliases
  1051. servent:name
  1052. servent:port
  1053. servent:proto
  1054. set-autoloaded!
  1055. set-current-dynamic-state
  1056. set-current-error-port
  1057. set-current-input-port
  1058. set-current-module
  1059. set-current-output-port
  1060. set-exception-printer!
  1061. set-module-binder!
  1062. set-module-declarative?!
  1063. set-module-duplicates-handlers!
  1064. set-module-filename!
  1065. set-module-inlinable-exports!
  1066. set-module-kind!
  1067. set-module-name!
  1068. set-module-next-unique-id!
  1069. set-module-obarray!
  1070. set-module-observers!
  1071. set-module-public-interface!
  1072. set-module-submodule-binder!
  1073. set-module-submodules!
  1074. set-module-transformer!
  1075. set-module-uses!
  1076. set-module-version!
  1077. set-object-properties!
  1078. set-object-property!
  1079. set-port-column!
  1080. set-port-filename!
  1081. set-port-line!
  1082. set-port-revealed!
  1083. set-procedure-minimum-arity!
  1084. set-procedure-properties!
  1085. set-procedure-property!
  1086. set-program-arguments
  1087. set-source-properties!
  1088. set-source-property!
  1089. set-struct-vtable-name!
  1090. set-symbol-property!
  1091. set-tm:gmtoff
  1092. set-tm:hour
  1093. set-tm:isdst
  1094. set-tm:mday
  1095. set-tm:min
  1096. set-tm:mon
  1097. set-tm:sec
  1098. set-tm:wday
  1099. set-tm:yday
  1100. set-tm:year
  1101. set-tm:zone
  1102. setaffinity
  1103. setegid
  1104. setenv
  1105. seteuid
  1106. setgid
  1107. setgr
  1108. setgrent
  1109. setgroups
  1110. sethost
  1111. sethostent
  1112. sethostname
  1113. setitimer
  1114. setlocale
  1115. setnet
  1116. setnetent
  1117. setpgid
  1118. setpriority
  1119. setproto
  1120. setprotoent
  1121. setpw
  1122. setpwent
  1123. setrlimit
  1124. setserv
  1125. setservent
  1126. setsid
  1127. setsockopt
  1128. setter
  1129. setuid
  1130. shared-array-increments
  1131. shared-array-offset
  1132. shared-array-root
  1133. shutdown
  1134. sigaction
  1135. signal-handlers
  1136. sinh
  1137. sleep
  1138. sloppy-assoc
  1139. sloppy-assq
  1140. sloppy-assv
  1141. sockaddr:addr
  1142. sockaddr:fam
  1143. sockaddr:flowinfo
  1144. sockaddr:path
  1145. sockaddr:port
  1146. sockaddr:scopeid
  1147. socket
  1148. socketpair
  1149. sorted?
  1150. source-properties
  1151. source-property
  1152. source-whash
  1153. spawn
  1154. stack-id
  1155. stack-length
  1156. stack-ref
  1157. stack?
  1158. standard-vtable-fields
  1159. start-stack
  1160. stat
  1161. stat:atime
  1162. stat:atimensec
  1163. stat:blksize
  1164. stat:blocks
  1165. stat:ctime
  1166. stat:ctimensec
  1167. stat:dev
  1168. stat:gid
  1169. stat:ino
  1170. stat:mode
  1171. stat:mtime
  1172. stat:mtimensec
  1173. stat:nlink
  1174. stat:perms
  1175. stat:rdev
  1176. stat:size
  1177. stat:type
  1178. stat:uid
  1179. statat
  1180. status:exit-val
  1181. status:stop-sig
  1182. status:term-sig
  1183. strerror
  1184. strftime
  1185. string->char-set!
  1186. string-any
  1187. string-any-c-code
  1188. string-append/shared
  1189. string-bytes-per-char
  1190. string-capitalize
  1191. string-capitalize!
  1192. string-ci->symbol
  1193. string-ci<
  1194. string-ci<=
  1195. string-ci<>
  1196. string-ci=
  1197. string-ci>
  1198. string-ci>=
  1199. string-compare
  1200. string-compare-ci
  1201. string-concatenate-reverse/shared
  1202. string-concatenate/shared
  1203. string-contains
  1204. string-contains-ci
  1205. string-count
  1206. string-delete
  1207. string-downcase!
  1208. string-drop
  1209. string-drop-right
  1210. string-every
  1211. string-every-c-code
  1212. string-filter
  1213. string-fold
  1214. string-fold-right
  1215. string-for-each-index
  1216. string-hash
  1217. string-hash-ci
  1218. string-map!
  1219. string-normalize-nfc
  1220. string-normalize-nfd
  1221. string-normalize-nfkc
  1222. string-normalize-nfkd
  1223. string-pad
  1224. string-pad-right
  1225. string-prefix-length
  1226. string-prefix-length-ci
  1227. string-replace
  1228. string-reverse!
  1229. string-skip
  1230. string-skip-right
  1231. string-suffix-length
  1232. string-suffix-length-ci
  1233. string-tabulate
  1234. string-take
  1235. string-take-right
  1236. string-titlecase
  1237. string-titlecase!
  1238. string-tokenize
  1239. string-unfold
  1240. string-unfold-right
  1241. string-upcase!
  1242. string-utf8-length
  1243. string-xcopy!
  1244. string<
  1245. string<=
  1246. string<>
  1247. string=
  1248. string>
  1249. string>=
  1250. strptime
  1251. struct-layout
  1252. struct-ref
  1253. struct-ref/unboxed
  1254. struct-set!
  1255. struct-set!/unboxed
  1256. struct-vtable
  1257. struct-vtable-name
  1258. struct-vtable?
  1259. struct?
  1260. substring-fill!
  1261. substring-move!
  1262. substring/copy
  1263. substring/read-only
  1264. supports-source-properties?
  1265. symbol
  1266. symbol-append
  1267. symbol-fref
  1268. symbol-fset!
  1269. symbol-hash
  1270. symbol-interned?
  1271. symbol-pref
  1272. symbol-prefix-proc
  1273. symbol-property
  1274. symbol-property-remove!
  1275. symbol-pset!
  1276. symlink
  1277. symlinkat
  1278. sync
  1279. syntax-parameterize
  1280. syntax-source
  1281. system
  1282. system*
  1283. system-async-mark
  1284. system-error-errno
  1285. system-file-name-convention
  1286. tanh
  1287. tcgetpgrp
  1288. tcsetpgrp
  1289. textdomain
  1290. the-root-module
  1291. the-scm-module
  1292. thunk?
  1293. times
  1294. tm:gmtoff
  1295. tm:hour
  1296. tm:isdst
  1297. tm:mday
  1298. tm:min
  1299. tm:mon
  1300. tm:sec
  1301. tm:wday
  1302. tm:yday
  1303. tm:year
  1304. tm:zone
  1305. tmpfile
  1306. tmpnam
  1307. tms:clock
  1308. tms:cstime
  1309. tms:cutime
  1310. tms:stime
  1311. tms:utime
  1312. transpose-array
  1313. truncate
  1314. truncate-file
  1315. truncate-quotient
  1316. truncate-remainder
  1317. truncate/
  1318. try-load-module
  1319. try-module-autoload
  1320. ttyname
  1321. typed-array?
  1322. tzset
  1323. ucs-range->char-set
  1324. ucs-range->char-set!
  1325. umask
  1326. uname
  1327. unmemoize-expression
  1328. unsetenv
  1329. use-modules
  1330. use-srfis
  1331. user-modules-declarative?
  1332. using-readline?
  1333. usleep
  1334. utime
  1335. utsname:machine
  1336. utsname:nodename
  1337. utsname:release
  1338. utsname:sysname
  1339. utsname:version
  1340. variable-bound?
  1341. variable-unset!
  1342. vector-move-left!
  1343. vector-move-right!
  1344. version
  1345. version-matches?
  1346. vtable-index-layout
  1347. vtable-index-printer
  1348. vtable-offset-user
  1349. waitpid
  1350. warn
  1351. with-continuation-barrier
  1352. with-ellipsis
  1353. with-fluids*
  1354. xsubstring))
  1355. (library (guile)
  1356. (export %default-port-conversion-strategy
  1357. %default-port-encoding
  1358. %make-void-port
  1359. &compound-exception
  1360. &error
  1361. &exception
  1362. &non-continuable
  1363. *
  1364. *unspecified*
  1365. @@
  1366. +
  1367. -
  1368. ->bool
  1369. ...
  1370. /
  1371. 1+ 1-
  1372. <
  1373. <=
  1374. =
  1375. =>
  1376. >
  1377. >=
  1378. _
  1379. AF_INET
  1380. AF_INET6
  1381. SEEK_CUR
  1382. SEEK_END
  1383. SEEK_SET
  1384. abort-to-prompt
  1385. abs
  1386. acons
  1387. acos
  1388. and
  1389. and-map
  1390. and=>
  1391. angle
  1392. append
  1393. append!
  1394. apply
  1395. array?
  1396. array-cell-ref
  1397. array-for-each
  1398. array-length
  1399. array-rank
  1400. array-ref
  1401. array-shape
  1402. array-type
  1403. ash
  1404. asin
  1405. assoc
  1406. assoc-ref
  1407. assq
  1408. assq-ref
  1409. assv
  1410. assv-ref
  1411. atan
  1412. begin
  1413. bitvector
  1414. bitvector-length
  1415. bitvector-ref
  1416. bitvector-set!
  1417. bitvector?
  1418. boolean?
  1419. bound-identifier=?
  1420. caaaar
  1421. caaadr
  1422. caaar
  1423. caadar
  1424. caaddr
  1425. caadr
  1426. caar
  1427. cadaar
  1428. cadadr
  1429. cadar
  1430. caddar
  1431. cadddr
  1432. caddr
  1433. cadr
  1434. call-with-current-continuation
  1435. call-with-input-file
  1436. call-with-input-string
  1437. call-with-output-file
  1438. call-with-output-string
  1439. call-with-port
  1440. call-with-prompt
  1441. call-with-values
  1442. call/cc
  1443. car
  1444. case
  1445. case-lambda
  1446. case-lambda*
  1447. catch
  1448. cdaaar
  1449. cdaadr
  1450. cdaar
  1451. cdadar
  1452. cdaddr
  1453. cdadr
  1454. cdar
  1455. cddaar
  1456. cddadr
  1457. cddar
  1458. cdddar
  1459. cddddr
  1460. cdddr
  1461. cddr
  1462. cdr
  1463. ceiling
  1464. ceiling-quotient
  1465. ceiling-remainder
  1466. ceiling/
  1467. char->integer
  1468. char-alphabetic?
  1469. char-ci<=?
  1470. char-ci<?
  1471. char-ci=?
  1472. char-ci>=?
  1473. char-ci>?
  1474. char-downcase
  1475. char-lower-case?
  1476. char-numeric?
  1477. char-ready?
  1478. char-upcase
  1479. char-upper-case?
  1480. char-whitespace?
  1481. char<=?
  1482. char<?
  1483. char=?
  1484. char>=?
  1485. char>?
  1486. char?
  1487. char-set
  1488. char-set-union
  1489. char-set->list
  1490. char-set->string
  1491. char-set?
  1492. char-set-contains?
  1493. char-set:ascii
  1494. char-set:blank
  1495. char-set:digit
  1496. char-set:empty
  1497. char-set:full
  1498. char-set:graphic
  1499. char-set:hex-digit
  1500. char-set:iso-control
  1501. char-set:letter
  1502. char-set:letter+digit
  1503. char-set:lower-case
  1504. char-set:printing
  1505. char-set:punctuation
  1506. char-set:symbol
  1507. char-set:title-case
  1508. char-set:upper-case
  1509. char-set:whitespace
  1510. close
  1511. close-input-port
  1512. close-output-port
  1513. close-port
  1514. command-line
  1515. complex?
  1516. cond
  1517. cond-expand
  1518. cond-expand-provide
  1519. cons
  1520. cons*
  1521. const
  1522. cos
  1523. current-dynamic-state
  1524. current-error-port
  1525. current-input-port
  1526. current-output-port
  1527. current-time
  1528. datum->syntax
  1529. default-prompt-tag
  1530. define
  1531. define*
  1532. define-inlinable
  1533. define-syntax
  1534. define-syntax-rule
  1535. define-values
  1536. delay
  1537. delq
  1538. delq!
  1539. delq1!
  1540. denominator
  1541. display
  1542. do
  1543. doubly-weak-hash-table?
  1544. drain-input
  1545. dynamic-state?
  1546. dynamic-wind
  1547. else
  1548. eof-object?
  1549. eq?
  1550. equal?
  1551. eqv?
  1552. error
  1553. euclidean-quotient
  1554. euclidean-remainder
  1555. euclidean/
  1556. even?
  1557. (rename inexact exact->inexact)
  1558. exact-integer-sqrt
  1559. exact-integer?
  1560. exact?
  1561. exception?
  1562. exit
  1563. exp
  1564. expt
  1565. false-if-exception
  1566. file-position
  1567. filter
  1568. finite?
  1569. floor
  1570. floor-quotient
  1571. floor-remainder
  1572. floor/
  1573. fluid-ref
  1574. fluid-set!
  1575. fluid?
  1576. for-each
  1577. force
  1578. force-output
  1579. format
  1580. free-identifier=?
  1581. ftell
  1582. gcd
  1583. generate-temporaries
  1584. get-output-string
  1585. hash
  1586. hash-clear!
  1587. hash-count
  1588. hash-create-handle!
  1589. hash-fold
  1590. hash-for-each
  1591. hash-for-each-handle
  1592. hash-get-handle
  1593. hash-map->list
  1594. hash-ref
  1595. hash-remove!
  1596. hash-set!
  1597. hash-table?
  1598. hashq
  1599. hashq-create-handle!
  1600. hashq-get-handle
  1601. hashq-ref
  1602. hashq-remove!
  1603. hashq-set!
  1604. hashv
  1605. hashv-create-handle!
  1606. hashv-get-handle
  1607. hashv-ref
  1608. hashv-remove!
  1609. hashv-set!
  1610. hashx-create-handle!
  1611. hashx-get-handle
  1612. hashx-ref
  1613. hashx-remove!
  1614. hashx-set!
  1615. identifier-syntax
  1616. identifier?
  1617. identity
  1618. if
  1619. imag-part
  1620. include-from-path
  1621. (rename exact inexact->exact)
  1622. inet-pton
  1623. inexact?
  1624. inf
  1625. (rename infinite? inf?)
  1626. input-port?
  1627. integer->char
  1628. integer?
  1629. iota
  1630. issue-deprecation-warning
  1631. keyword->symbol
  1632. keyword?
  1633. lambda
  1634. lambda*
  1635. last-pair
  1636. lcm
  1637. length
  1638. let
  1639. let*
  1640. let-syntax
  1641. letrec
  1642. letrec*
  1643. letrec-syntax
  1644. list
  1645. list->char-set
  1646. list->string
  1647. list->vector
  1648. list-copy
  1649. list-head
  1650. list-ref
  1651. list-set!
  1652. list-tail
  1653. list?
  1654. log
  1655. logand
  1656. logbit?
  1657. logior
  1658. lognot
  1659. logtest
  1660. logxor
  1661. magnitude
  1662. make-bitvector
  1663. make-doubly-weak-hash-table
  1664. make-exception
  1665. make-exception-from-throw
  1666. make-fluid
  1667. make-hash-table
  1668. make-list
  1669. make-parameter
  1670. make-polar
  1671. make-promise
  1672. make-prompt-tag
  1673. make-rectangular
  1674. make-regexp
  1675. make-shared-array
  1676. make-string
  1677. make-symbol
  1678. (rename make-box make-variable)
  1679. make-vector
  1680. make-weak-key-hash-table
  1681. make-weak-value-hash-table
  1682. map
  1683. max
  1684. member
  1685. memq
  1686. memv
  1687. min
  1688. module-set!
  1689. modulo
  1690. most-negative-fixnum
  1691. most-positive-fixnum
  1692. nan
  1693. nan?
  1694. negate
  1695. negative?
  1696. newline
  1697. not
  1698. null?
  1699. number->string
  1700. number?
  1701. numerator
  1702. object->string
  1703. object-address
  1704. odd?
  1705. open-input-file
  1706. open-input-string
  1707. open-output-file
  1708. open-output-string
  1709. or
  1710. or-map
  1711. output-port?
  1712. pair?
  1713. parameter?
  1714. parameterize
  1715. peek
  1716. peek-char
  1717. pk
  1718. port-closed?
  1719. port-column
  1720. port-conversion-strategy
  1721. port-encoding
  1722. port-filename
  1723. port-line
  1724. port?
  1725. positive?
  1726. procedure?
  1727. procedure-name
  1728. program-arguments
  1729. promise?
  1730. quasiquote
  1731. quasisyntax
  1732. quit
  1733. quote
  1734. quote-syntax
  1735. quotient
  1736. raise-exception
  1737. rational?
  1738. rationalize
  1739. read
  1740. read-char
  1741. real-part
  1742. real?
  1743. record-type-parents
  1744. record?
  1745. regexp-exec
  1746. regexp/basic
  1747. regexp/extended
  1748. regexp/icase
  1749. regexp/newline
  1750. regexp/notbol
  1751. regexp/noteol
  1752. regexp?
  1753. remainder
  1754. restricted-vector-sort!
  1755. reverse
  1756. round
  1757. seek
  1758. scm-error
  1759. set!
  1760. set-car!
  1761. set-cdr!
  1762. set-port-conversion-strategy!
  1763. set-port-encoding!
  1764. setvbuf
  1765. simple-exceptions
  1766. simple-format
  1767. sin
  1768. sort
  1769. sort!
  1770. sort-list
  1771. sort-list!
  1772. sqrt
  1773. stable-sort
  1774. stable-sort!
  1775. string
  1776. string->char-set
  1777. string->list
  1778. string->number
  1779. string->symbol
  1780. string-append
  1781. string-capitalize
  1782. string-ci<=?
  1783. string-ci<?
  1784. string-ci=?
  1785. string-ci>=?
  1786. string-ci>?
  1787. string-concatenate
  1788. string-concatenate-reverse
  1789. string-copy
  1790. string-copy!
  1791. string-downcase
  1792. string-fill!
  1793. string-for-each
  1794. string-index
  1795. string-index-right
  1796. string-join
  1797. string-length
  1798. string-map
  1799. string-null?
  1800. string-prefix-ci?
  1801. string-prefix?
  1802. string-pad
  1803. string-ref
  1804. string-reverse
  1805. string-rindex
  1806. string-trim
  1807. string-trim-both
  1808. string-trim-right
  1809. string-set!
  1810. string-split
  1811. string-suffix-ci?
  1812. string-suffix?
  1813. string-upcase
  1814. string<=?
  1815. string<?
  1816. string=?
  1817. string>=?
  1818. string>?
  1819. string?
  1820. substring
  1821. substring/shared
  1822. symbol->keyword
  1823. symbol->string
  1824. symbol?
  1825. syntax
  1826. syntax->datum
  1827. syntax-case
  1828. syntax-error
  1829. syntax-rules
  1830. syntax-violation
  1831. tan
  1832. the-eof-object
  1833. throw
  1834. unless
  1835. unquote
  1836. unquote-splicing
  1837. unread-char
  1838. unread-string
  1839. unspecified?
  1840. unsyntax
  1841. unsyntax-splicing
  1842. values
  1843. (rename box-ref variable-ref)
  1844. (rename box-set! variable-set!)
  1845. (rename box? variable?)
  1846. vector
  1847. vector->list
  1848. vector-copy
  1849. vector-copy!
  1850. vector-fill!
  1851. vector-length
  1852. vector-ref
  1853. vector-set!
  1854. vector?
  1855. weak-key-hash-table?
  1856. weak-value-hash-table?
  1857. when
  1858. while
  1859. with-dynamic-state
  1860. with-error-to-file
  1861. with-error-to-port
  1862. with-error-to-string
  1863. with-exception-handler
  1864. with-fluid*
  1865. with-fluids
  1866. with-input-from-file
  1867. with-input-from-port
  1868. with-input-from-string
  1869. with-output-to-file
  1870. with-output-to-port
  1871. with-output-to-string
  1872. with-syntax
  1873. with-throw-handler
  1874. write
  1875. write-char
  1876. zero?
  1877. λ)
  1878. (import (hoot assoc)
  1879. (hoot bitvectors)
  1880. (hoot bitwise)
  1881. (hoot boxes)
  1882. (hoot bytevectors)
  1883. (hoot char)
  1884. (hoot cond-expand)
  1885. (hoot control)
  1886. (hoot dynamic-states)
  1887. (hoot dynamic-wind)
  1888. (hoot eq)
  1889. (hoot equal)
  1890. (hoot error-handling)
  1891. (hoot errors)
  1892. (hoot exceptions)
  1893. (hoot features)
  1894. (hoot fluids)
  1895. (hoot hashtables)
  1896. (hoot keywords)
  1897. (except (hoot lists) sort)
  1898. (prefix (only (hoot lists) sort) list:)
  1899. (hoot not)
  1900. (hoot numbers)
  1901. (hoot pairs)
  1902. (hoot parameters)
  1903. (hoot ports)
  1904. (hoot apply)
  1905. (hoot procedures)
  1906. (only (hoot read) read string->number)
  1907. (hoot records)
  1908. (hoot regexps)
  1909. (except (hoot strings) substring)
  1910. (prefix (only (hoot strings) substring) hoot:)
  1911. (hoot syntax)
  1912. (hoot syntax-objects)
  1913. (hoot symbols)
  1914. (hoot values)
  1915. (hoot vectors)
  1916. (hoot write)
  1917. (ice-9 match)
  1918. (only (scheme base) boolean?)
  1919. (only (scheme char)
  1920. char-ci<? char-ci<=? char-ci=? char-ci>=? char-ci>?
  1921. string-ci<? string-ci<=? string-ci=? string-ci>=? string-ci>?)
  1922. (only (scheme file)
  1923. open-input-file
  1924. open-output-file
  1925. call-with-input-file
  1926. call-with-output-file
  1927. with-input-from-file
  1928. with-output-to-file)
  1929. (scheme lazy)
  1930. (scheme process-context)
  1931. (scheme time)
  1932. (srfi srfi-14))
  1933. ;; FIXME: Guile's SRFI modules use this but it relies on the module
  1934. ;; API which we don't implement.
  1935. (define-syntax-rule (cond-expand-provide module feature)
  1936. (values))
  1937. ;; FIXME: @@ is unsupported, but there are modules in Guile that we
  1938. ;; want to be able to import and expand even if they are partially
  1939. ;; unusable at runtime. So, we don't throw an error at expansion
  1940. ;; time but rather runtime if the procedure is ever called. We need
  1941. ;; to fix modules in Guile so that they don't use @@.
  1942. (define-syntax-rule (@@ module name)
  1943. (lambda args (raise (make-unimplemented-error '@@))))
  1944. ;; FIXME: No-op for now to get modules like (ice-9 format) working.
  1945. (define-syntax-rule (module-set! module name value)
  1946. (values))
  1947. (define-syntax define-inlinable
  1948. (lambda (stx)
  1949. (syntax-case stx ()
  1950. ((_ (name formals ...) body0 body ...)
  1951. (identifier? #'name)
  1952. (let ((proc-name (string->symbol
  1953. (string-append "% "
  1954. (symbol->string
  1955. (syntax->datum #'name))
  1956. "-procedure"))))
  1957. (with-syntax ((proc-name (datum->syntax #'name proc-name))
  1958. ((args ...) (generate-temporaries #'(formals ...))))
  1959. #'(begin
  1960. (define (proc-name formals ...)
  1961. body0 body ...)
  1962. (define-syntax name
  1963. (lambda (stx)
  1964. (syntax-case stx ()
  1965. ((_ args ...)
  1966. #'((lambda (formals ...) body0 body ...) args ...))
  1967. ((_ bad-arg (... ...))
  1968. (syntax-violation 'name "wrong number of arguments" stx))
  1969. (_
  1970. (identifier? stx)
  1971. #'proc-name)))))))))))
  1972. ;; FIXME: Doesn't support break/continue due to compiler bug.
  1973. ;;
  1974. ;; See https://gitlab.com/spritely/guile-hoot/-/issues/316
  1975. (define-syntax-rule (while cond body ...)
  1976. (let lp () (and cond (begin body ... (lp)))))
  1977. (define (identity x) x)
  1978. (define (const x) (lambda args x))
  1979. ;; TODO: Implement arrays.
  1980. (define (array? obj) #f)
  1981. (define (make-shared-array array proc . dims)
  1982. (raise (make-unimplemented-error 'make-shared-array)))
  1983. (define (array-type array)
  1984. (raise (make-unimplemented-error 'array-type)))
  1985. (define (array-length array)
  1986. (raise (make-unimplemented-error 'array-length)))
  1987. (define (array-rank array)
  1988. (raise (make-unimplemented-error 'array-rank)))
  1989. (define (array-shape array)
  1990. (raise (make-unimplemented-error 'array-shape)))
  1991. (define (array-ref array . idx)
  1992. (raise (make-unimplemented-error 'array-ref)))
  1993. (define (array-cell-ref array . idx)
  1994. (raise (make-unimplemented-error 'array-cell-ref)))
  1995. (define (array-for-each proc . arrays)
  1996. (raise (make-unimplemented-error 'array-for-each)))
  1997. (define (%make-void-port mode)
  1998. (define (mode-prefix-match? test)
  1999. (call-with-input-string mode
  2000. (lambda (p)
  2001. (let lp ((c (read-char p)))
  2002. (cond
  2003. ((eof-object? c) #f)
  2004. ((or (test c)
  2005. (char-ci=? c #\+)) #t)
  2006. (else (lp (read-char p))))))))
  2007. (define %read
  2008. (and (mode-prefix-match? (lambda (c)
  2009. (char-ci=? c #\r)))
  2010. (lambda (bv start count) (eof-object))))
  2011. (define %write
  2012. (and (mode-prefix-match? (lambda (c)
  2013. (or (char-ci=? c #\w)
  2014. (char-ci=? c #\a))))
  2015. (lambda (bv start count) count)))
  2016. (make-port %read ; read
  2017. %write ; write
  2018. #f ; input-waiting?
  2019. #f ; seek
  2020. #f ; close
  2021. #f ; truncate
  2022. "void" ; repr
  2023. #f ; filename
  2024. 1024 ; read-buf-size
  2025. 1024 ; write-buf-size
  2026. #f ; r/w-random-access
  2027. #f ; fold-case?
  2028. #f ; private data
  2029. ))
  2030. (define-syntax *unspecified*
  2031. (identifier-syntax (if #f #f)))
  2032. (define (->bool x) (if x #t #f))
  2033. (define (and-map f l)
  2034. (match l
  2035. (() #t)
  2036. ((x . l)
  2037. (and (f x) (and-map f l)))))
  2038. (define (or-map f l)
  2039. (match l
  2040. (() #f)
  2041. ((x . l)
  2042. (or (f x) (or-map f l)))))
  2043. (define (filter pred l)
  2044. (match l
  2045. (() '())
  2046. ((head . tail)
  2047. (if (pred head)
  2048. (cons head (filter pred tail))
  2049. (filter pred tail)))))
  2050. (define* (iota count #:optional (start 0) (step 1))
  2051. "Return a list of length @var{count} containing numbers starting with
  2052. @var{start} and incrementing by @var{step}. @var{start} defaults to 0 and
  2053. @var{step} to 1."
  2054. (assert (>= count 0) 'iota)
  2055. (if (zero? count)
  2056. '()
  2057. (cons start (iota (1- count) (+ start step) step))))
  2058. (define (and=> x f) (and x (f x)))
  2059. (define (list-head lst k)
  2060. (if (zero? k)
  2061. '()
  2062. (cons (car lst) (list-head (cdr lst) (1- k)))))
  2063. ;; Guile's manual says that append! is not required to modify the
  2064. ;; list, so let's not!
  2065. (define append! append)
  2066. (define (delq item lst)
  2067. (match lst
  2068. (() '())
  2069. ((x . rest)
  2070. (if (eq? item x)
  2071. (delq item rest)
  2072. (cons x (delq item rest))))))
  2073. (define (delq! item lst)
  2074. (match lst
  2075. (() '())
  2076. ((x . rest)
  2077. (if (eq? item x)
  2078. (delq! item rest)
  2079. (let ((rest* (delq! item rest)))
  2080. (set-cdr! lst rest*)
  2081. lst)))))
  2082. (define (delq1! item lst)
  2083. (match lst
  2084. (() '())
  2085. ((x . rest)
  2086. (if (eq? item x)
  2087. rest
  2088. (let ((rest* (delq1! item rest)))
  2089. (set-cdr! lst rest*)
  2090. lst)))))
  2091. (define sort-list list:sort)
  2092. (define sort-list! sort-list)
  2093. (define (restricted-vector-sort! v less? start end)
  2094. (vector-sort! v less? start end))
  2095. (define (sort! items <)
  2096. (match items
  2097. (() '())
  2098. ((? pair?) (sort-list items <))
  2099. ((? vector?)
  2100. (restricted-vector-sort! items < 0 (vector-length items))
  2101. items)))
  2102. (define (sort items <)
  2103. (match items
  2104. (() '())
  2105. ((? pair?) (sort-list items <))
  2106. ((? vector?)
  2107. (let ((v (vector-copy items)))
  2108. (restricted-vector-sort! v < 0 (vector-length v))
  2109. v))))
  2110. ;; FIXME: vector-sort! is not stable.
  2111. (define stable-sort sort)
  2112. (define stable-sort! sort!)
  2113. (define (call-with-input-string str proc)
  2114. (proc (open-input-string str)))
  2115. (define (call-with-output-string proc)
  2116. (let ((port (open-output-string)))
  2117. (proc port)
  2118. (get-output-string port)))
  2119. (define (with-input-from-string str thunk)
  2120. (call-with-input-string str
  2121. (lambda (port)
  2122. (with-input-from-port port thunk))))
  2123. (define (with-output-to-string thunk)
  2124. (call-with-output-string
  2125. (lambda (port)
  2126. (with-output-to-port port thunk))))
  2127. (define (with-input-from-port port thunk)
  2128. (parameterize ((current-input-port port))
  2129. (thunk)))
  2130. (define (with-output-to-port port thunk)
  2131. (parameterize ((current-output-port port))
  2132. (thunk)))
  2133. (define (with-error-to-port port thunk)
  2134. (parameterize ((current-error-port port))
  2135. (thunk)))
  2136. (define (with-error-to-file filename thunk)
  2137. (call-with-port (open-output-file filename)
  2138. (lambda (port)
  2139. (with-error-to-port port thunk))))
  2140. (define (with-error-to-string thunk)
  2141. (call-with-output-string
  2142. (lambda (port) (with-error-to-port port thunk))))
  2143. (define (current-time) (current-jiffy))
  2144. (define (ftell port)
  2145. (seek port 0 'cur))
  2146. (define file-position ftell)
  2147. (define* (drain-input #:optional (port (current-input-port)))
  2148. (flush-input-port port))
  2149. (define* (force-output #:optional (port (current-output-port)))
  2150. (flush-output-port port))
  2151. (define (simple-format port template . args)
  2152. (define (do-format port)
  2153. (call-with-input-string
  2154. template
  2155. (lambda (in)
  2156. (let lp ((args args))
  2157. (match (read-char in)
  2158. ((? eof-object?)
  2159. (match args
  2160. (() (force-output port))
  2161. (_ (error "leftover format args" template args))))
  2162. (#\~
  2163. (match (read-char in)
  2164. ((or #\a #\A)
  2165. (match args
  2166. ((x . args) (display x port) (lp args))
  2167. (_ (error "not enough format args" template))))
  2168. ((or #\s #\S)
  2169. (match args
  2170. ((x . args) (write x port) (lp args))
  2171. (_ (error "not enough format args" template))))
  2172. (#\~ (write-char #\~ port) (lp args))
  2173. (#\% (newline port) (lp args))
  2174. (ch (error "unexpected format directive" template ch))))
  2175. (ch (write-char ch port) (lp args)))))))
  2176. (match port
  2177. (#t (do-format (current-output-port)))
  2178. (#f (call-with-output-string do-format))
  2179. ((? output-port?) (do-format port))
  2180. (_ (error "invalid format destination" port))))
  2181. (define format simple-format)
  2182. (define (inf) +inf.0)
  2183. (define (nan) +nan.0)
  2184. (define (negate x) (- x))
  2185. (define* (object->string obj #:optional (print write))
  2186. (call-with-output-string (lambda (port) (print obj port))))
  2187. ;; Object addresses are not visible in Wasm.
  2188. (define (object-address obj) 0)
  2189. (define (string-null? str) (string=? str ""))
  2190. (define (string-concatenate strs)
  2191. (apply string-append strs))
  2192. (define (string-split str char-pred)
  2193. (let ((char-pred (match char-pred
  2194. ((? char? a) (lambda (b) (char=? a b)))
  2195. ((? char-set? cs) (lambda (c) (char-set-contains? cs c)))
  2196. ((? procedure?) char-pred))))
  2197. (call-with-input-string str
  2198. (lambda (port)
  2199. (define (read-to-delimiter)
  2200. (match (let lp ()
  2201. (match (read-char port)
  2202. ((? eof-object?) '())
  2203. ((? char-pred) '())
  2204. (char (cons char (lp)))))
  2205. (() #f)
  2206. (chars (list->string chars))))
  2207. (let lp ()
  2208. (match (read-to-delimiter)
  2209. (#f '())
  2210. (substr (cons substr (lp)))))))))
  2211. (define* (string-join strs #:optional (delimiter " ") (grammar 'infix))
  2212. (define (prefix-join strs)
  2213. (match strs
  2214. (() '())
  2215. ((str . rest)
  2216. (cons* delimiter str (prefix-join rest)))))
  2217. (string-concatenate
  2218. (match grammar
  2219. ('infix
  2220. (match strs
  2221. (() '())
  2222. ((first . rest) (cons first (prefix-join rest)))))
  2223. ('strict-infix
  2224. (match strs
  2225. (() (error "strict-infix join with empty list"))
  2226. ((first . rest)
  2227. (cons first (prefix-join rest)))))
  2228. ('prefix (prefix-join strs))
  2229. ('suffix
  2230. (let lp ((strs strs))
  2231. (match strs
  2232. (() '())
  2233. ((str . rest) (cons* str delimiter (lp rest)))))))))
  2234. (define* (substring str start #:optional (end (string-length str)))
  2235. (hoot:substring str start end))
  2236. (define substring/shared substring)
  2237. (define* (string-concatenate-reverse strs #:optional final end)
  2238. (string-concatenate
  2239. (reverse
  2240. (if final
  2241. (cons (if end (substring final 0 end) final) strs)
  2242. strs))))
  2243. (define* (string-pad str len #:optional
  2244. (char #\space) (start 0) (end (string-length str)))
  2245. (let ((k (- len (- end start))))
  2246. (cond
  2247. ((zero? k) (substring str start end))
  2248. ((< k 0) (substring str (+ start (* k -1)) end))
  2249. (else
  2250. (string-append (make-string k char)
  2251. (substring str start end))))))
  2252. (define* (string-index s char-pred #:optional
  2253. (start 0) (end (string-length s)))
  2254. (let ((char-pred
  2255. (match char-pred
  2256. ((? char?) (lambda (c) (char=? c char-pred)))
  2257. ((? char-set? cs) (lambda (c) (char-set-contains? cs c)))
  2258. ((? procedure?) char-pred))))
  2259. (let lp ((i 0)
  2260. (sl (string->list (substring s start end))))
  2261. (match sl
  2262. (() #f)
  2263. (((? char-pred) . rest) (+ start i))
  2264. ((c . rest) (lp (1+ i) rest))))))
  2265. (define* (string-rindex s char-pred #:optional
  2266. (start 0) (end (string-length s)))
  2267. (let ((i (string-index (string-reverse (substring s start end))
  2268. char-pred)))
  2269. (and i (- end i 1))))
  2270. (define string-index-right string-rindex)
  2271. (define (%string-prefix? s1 s2 start1 end1 start2 end2 string-equal?)
  2272. (let ((k (- end1 start1)))
  2273. (and (<= k (- end2 start2))
  2274. (string-equal? (substring s1 start1 end1)
  2275. (substring s2 start2 (+ start2 k))))))
  2276. (define* (string-prefix? s1 s2 #:optional
  2277. (start1 0) (end1 (string-length s1))
  2278. (start2 0) (end2 (string-length s2)))
  2279. (%string-prefix? s1 s2 start1 end1 start2 end2 string=?))
  2280. (define* (string-prefix-ci? s1 s2 #:optional
  2281. (start1 0) (end1 (string-length s1))
  2282. (start2 0) (end2 (string-length s2)))
  2283. (%string-prefix? s1 s2 start1 end1 start2 end2 string-ci=?))
  2284. (define (%string-suffix? s1 s2 start1 end1 start2 end2 string-equal?)
  2285. (let ((k (- end1 start1)))
  2286. (and (<= k (- end2 start2))
  2287. (string-equal? (substring s1 start1 end1)
  2288. (substring s2 (- end2 k) end2)))))
  2289. (define* (string-suffix? s1 s2 #:optional
  2290. (start1 0) (end1 (string-length s1))
  2291. (start2 0) (end2 (string-length s2)))
  2292. (%string-suffix? s1 s2 start1 end1 start2 end2 string=?))
  2293. (define* (string-suffix-ci? s1 s2 #:optional
  2294. (start1 0) (end1 (string-length s1))
  2295. (start2 0) (end2 (string-length s2)))
  2296. (%string-suffix? s1 s2 start1 end1 start2 end2 string-ci=?))
  2297. (define* (string-reverse str #:optional (start 0) (end (string-length str)))
  2298. (let ((pre (substring str 0 start))
  2299. (post (substring str end (string-length str))))
  2300. (string-append
  2301. pre
  2302. (list->string
  2303. (reverse
  2304. (string->list
  2305. (substring str start end))))
  2306. post)))
  2307. (define (%string-trim sl char-pred)
  2308. (let ((char-pred
  2309. (match char-pred
  2310. ((? char?) (lambda (c) (char=? c char-pred)))
  2311. ((? char-set? cs) (lambda (c) (char-set-contains? cs c)))
  2312. ((? procedure?) char-pred))))
  2313. (let lp ((sl sl))
  2314. (match sl
  2315. (() "")
  2316. (((? char-pred c) . rest) (lp rest))
  2317. (_ sl)))))
  2318. (define* (string-trim s #:optional
  2319. (char-pred char-set:whitespace)
  2320. (start 0) (end (string-length s)))
  2321. (list->string
  2322. (%string-trim (string->list (substring s start end))
  2323. char-pred)))
  2324. (define* (string-trim-right s #:optional
  2325. (char-pred char-set:whitespace)
  2326. (start 0) (end (string-length s)))
  2327. (list->string
  2328. (reverse
  2329. (%string-trim (reverse (string->list (substring s start end)))
  2330. char-pred))))
  2331. (define* (string-trim-both s #:optional
  2332. (char-pred char-set:whitespace)
  2333. (start 0) (end (string-length s)))
  2334. (string-trim-right (string-trim s char-pred start end) char-pred))
  2335. (define (string-capitalize str)
  2336. (raise (make-unimplemented-error 'string-capitalize)))
  2337. (define (last-pair l)
  2338. (match l
  2339. ((_ . (and l (_ . _))) (last-pair l))
  2340. ((_ . _) l)
  2341. (_ (error "not a pair" l))))
  2342. (define (peek . stuff)
  2343. (newline)
  2344. (display ";;; ")
  2345. (write stuff)
  2346. (newline)
  2347. (flush-output-port (current-output-port))
  2348. (car (last-pair stuff)))
  2349. (define pk peek)
  2350. (define %default-port-conversion-strategy (make-fluid 'substitute))
  2351. (define %default-port-encoding (make-fluid "UTF-8"))
  2352. (define close close-port)
  2353. (define (port-closed? port) (not (port-open? port)))
  2354. (define SEEK_CUR 'cur)
  2355. (define SEEK_SET 'start)
  2356. (define SEEK_END 'end)
  2357. (define* (unread-char char #:optional (port (current-input-port)))
  2358. (raise (make-unimplemented-error 'unread-char)))
  2359. (define* (unread-string str port)
  2360. (raise (make-unimplemented-error 'unread-string)))
  2361. (define* (setvbuf port mode #:optional size)
  2362. (raise (make-unimplemented-error 'setvbuf)))
  2363. (define (program-arguments) (command-line))
  2364. (define quit exit)
  2365. (define the-eof-object (eof-object))
  2366. (define (unspecified? x) (eq? x *unspecified*))
  2367. (define-syntax-rule (λ formals body ...)
  2368. (lambda formals body ...))
  2369. (define* (catch key thunk handler #:optional pre-unwind-handler)
  2370. (raise (make-unimplemented-error 'catch)))
  2371. ;; TODO: Should we handle Guile's legacy key + args exception
  2372. ;; system?
  2373. (define (with-throw-handler key thunk handler)
  2374. (unless (eq? key #t)
  2375. (raise (make-unimplemented-error 'with-throw-handler)))
  2376. (with-exception-handler
  2377. (lambda (exn)
  2378. (apply handler #t '())
  2379. (raise-exception exn))
  2380. thunk))
  2381. ;; TODO: Implement Guile's conversions based on key.
  2382. (define (make-exception-from-throw key args)
  2383. (make-exception-with-irritants args))
  2384. (define (throw key . args)
  2385. (raise-exception (make-exception-from-throw key args)))
  2386. (define (scm-error key subr message args data)
  2387. (raise
  2388. (make-exception (make-exception-from-throw key args)
  2389. (make-exception-with-message
  2390. (apply format #f message args))
  2391. (make-exception-with-origin subr))))
  2392. (define-syntax-rule (false-if-exception expr)
  2393. (with-exception-handler (lambda (exn) #f)
  2394. (lambda () expr)
  2395. #:unwind? #t))
  2396. (define issue-deprecation-warning
  2397. (let ((past-messages (make-hashtable)))
  2398. (lambda msgs
  2399. (let ((msgs-str (string-concatenate msgs)))
  2400. (unless (hashtable-contains? past-messages msgs-str)
  2401. (hashtable-set! past-messages msgs-str #t)
  2402. (display msgs-str (current-error-port))
  2403. (newline (current-error-port)))))))
  2404. ;; Hash table API compatibility shim:
  2405. ;;
  2406. ;; Guile's legacy hash table API is not so great. It allows for
  2407. ;; mixing different hash functions in the same table, which is why
  2408. ;; there are *four* variants for ref/set!/remove! procedures. On
  2409. ;; top of that, the API is also polymorphic. Those same procedures
  2410. ;; are used on "normal", weak key, weak value, and doubly weak
  2411. ;; tables.
  2412. ;;
  2413. ;; We made a better interface in (hoot hashtables) that resembles
  2414. ;; the R6RS API and is monomorphic. However, in the interest of
  2415. ;; maximizing the amount of existing Guile code that can be compiled
  2416. ;; as-is with Hoot, we have provided this compatibility shim.
  2417. ;;
  2418. ;; Hoot does *not* provide full compatibility, just partial
  2419. ;; compatibility for common use-cases. Code that is mixing hash
  2420. ;; functions in the same table or using
  2421. ;; hash-get-handle/hash-create-handle! is not supported. Also,
  2422. ;; because hashx-* procedures use assoc and friends, which is
  2423. ;; incompatible with how (hoot hashtables) does equality testing, we
  2424. ;; force equal? as the equivalence function.
  2425. (define-record-type <hash-table>
  2426. (%make-hash-table type table)
  2427. hash-table?
  2428. (type hash-table-type) ; normal, weak-key, weak-value, doubly-weak
  2429. (table hash-table-table set-hash-table-table!)) ; lazily initialized
  2430. (define* (make-hash-table #:optional size)
  2431. "Return a new hash table. @var{size} is ignored."
  2432. (%make-hash-table 'normal #f))
  2433. (define* (make-weak-key-hash-table #:optional size)
  2434. "Return a new weak key hash table. @var{size} is ignored."
  2435. (%make-hash-table 'weak-key #f))
  2436. (define* (make-weak-value-hash-table #:optional size)
  2437. "Return a new weak value hash table. @var{size} is ignored."
  2438. (%make-hash-table 'weak-value #f))
  2439. (define* (make-doubly-weak-hash-table #:optional size)
  2440. "Return a new doubly weak hash table. @var{size} is ignored."
  2441. (%make-hash-table 'doubly-weak #f))
  2442. (define (weak-key-hash-table? obj)
  2443. "Return @code{#t} if @var{obj} is a weak key hash table."
  2444. (and (hash-table? obj) (eq? (hash-table-type obj) 'weak-key)))
  2445. (define (weak-value-hash-table? obj)
  2446. "Return @code{#t} if @var{obj} is a weak value hash table."
  2447. (and (hash-table? obj) (eq? (hash-table-type obj) 'weak-value)))
  2448. (define (doubly-weak-hash-table? obj)
  2449. "Return @code{#t} if @var{obj} is a doubly weak hash table."
  2450. (and (hash-table? obj) (eq? (hash-table-type obj) 'doubly-weak)))
  2451. ;; Should these assert that the hash and equiv functions are what we
  2452. ;; expect? Currently, mixing hash functions on the same table will
  2453. ;; just silently use the hash function of the first ref/set!/remove!
  2454. ;; call.
  2455. (define (maybe-init-equal-hashtable table)
  2456. (unless (hash-table-table table)
  2457. (set-hash-table-table! table
  2458. (match (hash-table-type table)
  2459. ('normal
  2460. (make-hashtable))
  2461. ('weak-key
  2462. (make-weak-key-hashtable))
  2463. ('weak-value
  2464. (make-weak-value-hashtable))
  2465. ('doubly-weak
  2466. (make-doubly-weak-hashtable))))))
  2467. (define (maybe-init-eq-hashtable table)
  2468. (unless (hash-table-table table)
  2469. (set-hash-table-table! table
  2470. (match (hash-table-type table)
  2471. ('normal
  2472. (make-eq-hashtable))
  2473. ('weak-key
  2474. (make-eq-weak-key-hashtable))
  2475. ('weak-value
  2476. (make-eq-weak-value-hashtable))
  2477. ('doubly-weak
  2478. (make-eq-doubly-weak-hashtable))))))
  2479. (define (maybe-init-eqv-hashtable table)
  2480. (unless (hash-table-table table)
  2481. (set-hash-table-table! table
  2482. (match (hash-table-type table)
  2483. ('normal
  2484. (make-eqv-hashtable))
  2485. ('weak-key
  2486. (make-eqv-weak-key-hashtable))
  2487. ('weak-value
  2488. (make-eqv-weak-value-hashtable))
  2489. ('doubly-weak
  2490. (make-eqv-doubly-weak-hashtable))))))
  2491. (define (maybe-init-custom-hashtable table hash equiv)
  2492. (unless (hash-table-table table)
  2493. (set-hash-table-table! table
  2494. (match (hash-table-type table)
  2495. ('normal
  2496. (make-hashtable hash equiv))
  2497. ('weak-key
  2498. (make-weak-key-hashtable hash equiv))
  2499. ('weak-value
  2500. (make-weak-value-hashtable hash equiv))
  2501. ('doubly-weak
  2502. (make-doubly-weak-hashtable hash equiv))))))
  2503. (define (%hash-ref table key default)
  2504. (let ((table* (hash-table-table table)))
  2505. (match (hash-table-type table)
  2506. ('normal (hashtable-ref table* key default))
  2507. ('weak-key (weak-key-hashtable-ref table* key default))
  2508. ('weak-value (weak-value-hashtable-ref table* key default))
  2509. ('doubly-weak (doubly-weak-hashtable-ref table* key default)))))
  2510. (define* (hash-ref table key #:optional default)
  2511. "Look up @var{key} in the hash table @var{table}, and return the
  2512. value associated with it. If @var{key} is not found, return
  2513. @var{default} (if specified) or @code{#f}. Uses @code{equal?} for
  2514. equality testing."
  2515. (maybe-init-equal-hashtable table)
  2516. (%hash-ref table key default))
  2517. (define* (hashq-ref table key #:optional default)
  2518. "Look up @var{key} in the hash table @var{table}, and return the
  2519. value associated with it. If @var{key} is not found, return
  2520. @var{default} (if specified) or @code{#f}. Uses @code{eq?} for
  2521. equality testing."
  2522. (maybe-init-eq-hashtable table)
  2523. (%hash-ref table key default))
  2524. (define* (hashv-ref table key #:optional default)
  2525. "Look up @var{key} in the hash table @var{table}, and return the
  2526. value associated with it. If @var{key} is not found, return
  2527. @var{default} (if specified) or @code{#f}. Uses @code{eqv?} for
  2528. equality testing."
  2529. (maybe-init-eqv-hashtable table)
  2530. (%hash-ref table key default))
  2531. (define* (hashx-ref hash assoc table key #:optional default)
  2532. "Look up @var{key} in the hash table @var{table}, and return the
  2533. value associated with it. If @var{key} is not found, return
  2534. @var{default} (if specified) or @code{#f}. Uses @var{hash} as the
  2535. hash function. @var{assoc} is ignored and @code{equal?} is used for
  2536. equality testing."
  2537. (maybe-init-custom-hashtable table hash equal?)
  2538. (%hash-ref table key default))
  2539. (define (%hash-set! table key val)
  2540. (let ((table* (hash-table-table table)))
  2541. (match (hash-table-type table)
  2542. ('normal (hashtable-set! table* key val))
  2543. ('weak-key (weak-key-hashtable-set! table* key val))
  2544. ('weak-value (weak-value-hashtable-set! table* key val))
  2545. ('doubly-weak (doubly-weak-hashtable-set! table* key val)))
  2546. (if #f #f)))
  2547. (define (hash-set! table key val)
  2548. "Find the entry in @var{table} associated with @var{key} and store
  2549. @var{val} there. Uses @code{equal?} for equality testing."
  2550. (maybe-init-equal-hashtable table)
  2551. (%hash-set! table key val))
  2552. (define (hashq-set! table key val)
  2553. "Find the entry in @var{table} associated with @var{key} and store
  2554. @var{val} there. Uses @code{eq?} for equality testing."
  2555. (maybe-init-eq-hashtable table)
  2556. (%hash-set! table key val))
  2557. (define (hashv-set! table key val)
  2558. "Find the entry in @var{table} associated with @var{key} and store
  2559. @var{val} there. Uses @code{eqv?} for equality testing."
  2560. (maybe-init-eqv-hashtable table)
  2561. (%hash-set! table key val))
  2562. (define (hashx-set! hash assoc table key val)
  2563. "Find the entry in @var{table} associated with @var{key} and store
  2564. @var{val} there. Uses @var{hash} as the hash function. @var{assoc}
  2565. is ignored and @code{equal?} is used for equality testing."
  2566. (maybe-init-custom-hashtable table hash equal?)
  2567. (%hash-set! table key val))
  2568. (define (%hash-remove! table key)
  2569. (let ((table* (hash-table-table table)))
  2570. (match (hash-table-type table)
  2571. ('normal (hashtable-delete! table* key))
  2572. ('weak-key (weak-key-hashtable-delete! table* key))
  2573. ('weak-value (weak-value-hashtable-delete! table* key))
  2574. ('doubly-weak (doubly-weak-hashtable-delete! table* key)))
  2575. (if #f #f)))
  2576. (define (hash-remove! table key)
  2577. "Remove @var{key} from @var{table}. Uses @code{equal?} for equality
  2578. testing."
  2579. (maybe-init-equal-hashtable table)
  2580. (%hash-remove! table key))
  2581. (define (hashq-remove! table key)
  2582. "Remove @var{key} from @var{table}. Uses @code{eq?} for equality
  2583. testing."
  2584. (maybe-init-eq-hashtable table)
  2585. (%hash-remove! table key))
  2586. (define (hashv-remove! table key)
  2587. "Remove @var{key} from @var{table}. Uses @code{eqv?} for equality
  2588. testing."
  2589. (maybe-init-eqv-hashtable table)
  2590. (%hash-remove! table key))
  2591. (define (hashx-remove! hash assoc table key)
  2592. "Remove @var{key} from @var{table}. Uses @var{hash} as the hash
  2593. function. @var{assoc} is ignored and @code{equal?} is used for
  2594. equality testing."
  2595. (maybe-init-custom-hashtable table hash equal?)
  2596. (%hash-remove! table key))
  2597. (define (hash-get-handle table key)
  2598. (raise (make-unimplemented-error 'hash-get-handle)))
  2599. (define (hashq-get-handle table key)
  2600. (raise (make-unimplemented-error 'hashq-get-handle)))
  2601. (define (hashv-get-handle table key)
  2602. (raise (make-unimplemented-error 'hashv-get-handle)))
  2603. (define (hashx-get-handle hash assoc table key)
  2604. (raise (make-unimplemented-error 'hashx-get-handle)))
  2605. (define (hash-create-handle! table key init)
  2606. (raise (make-unimplemented-error 'hash-create-handle!)))
  2607. (define (hashq-create-handle! table key init)
  2608. (raise (make-unimplemented-error 'hashq-create-handle!)))
  2609. (define (hashv-create-handle! table key init)
  2610. (raise (make-unimplemented-error 'hashv-create-handle!)))
  2611. (define (hashx-create-handle! hash assoc table key init)
  2612. (raise (make-unimplemented-error 'hashx-create-handle!)))
  2613. (define (hash-clear! table)
  2614. "Remove all items from @var{table}."
  2615. (match (hash-table-table table)
  2616. (#f (values))
  2617. (table*
  2618. (match (hash-table-type table)
  2619. ('normal (hashtable-clear! table*))
  2620. ('weak-key (weak-key-hashtable-clear! table*))
  2621. ('weak-value (weak-value-hashtable-clear! table*))
  2622. ('doubly-weak (doubly-weak-hashtable-clear! table*)))))
  2623. (if #f #f))
  2624. (define (hash-fold proc init table)
  2625. "Accumulate a result by applying @var{proc} with each key/value
  2626. association in @var{table} and the result of the previous @var{proc}
  2627. call. Each call is of the form @code{(proc key value prev)}. For the
  2628. first call, @code{prev} is the initial value @var{init}."
  2629. (match (hash-table-table table)
  2630. (#f init)
  2631. (table*
  2632. (match (hash-table-type table)
  2633. ('normal (hashtable-fold proc init table*))
  2634. ('weak-key (weak-key-hashtable-fold proc init table*))
  2635. ('weak-value (weak-value-hashtable-fold proc init table*))
  2636. ('doubly-weak (doubly-weak-hashtable-fold proc init table*))))))
  2637. (define (hash-map->list proc table)
  2638. "Return an association list of key/value mappings in @var{table}."
  2639. (hash-fold (lambda (key value result)
  2640. (cons (proc key value) result))
  2641. '() table))
  2642. (define (hash-count pred table)
  2643. "Return the number of elements in @var{table} that satisfy @code{(pred
  2644. key value)}."
  2645. (hash-fold (lambda (key val count)
  2646. (if (pred key val)
  2647. (1+ count)
  2648. count))
  2649. 0 table))
  2650. (define (hash-for-each proc table)
  2651. "Apply @var{proc} to each key/value association in @var{table}.
  2652. Each call is of the form @code{(proc key value)}."
  2653. (match (hash-table-table table)
  2654. (#f (values))
  2655. (table*
  2656. (match (hash-table-type table)
  2657. ('normal (hashtable-for-each proc table*))
  2658. ('weak-key (weak-key-hashtable-for-each proc table*))
  2659. ('weak-value (weak-value-hashtable-for-each proc table*))
  2660. ('doubly-weak (doubly-weak-hashtable-for-each proc table*))))))
  2661. (define (hash-for-each-handle proc table)
  2662. (raise (make-unimplemented-error 'hash-for-each-handle)))
  2663. ;; Regular expressions
  2664. (define regexp/basic 'basic)
  2665. (define regexp/extended 'extended)
  2666. (define regexp/icase 'case-insensitive)
  2667. (define regexp/newline 'multiline)
  2668. (define regexp/notbol 'notbol)
  2669. (define regexp/noteol 'noteol)
  2670. ;; Sockets
  2671. (define AF_INET 'ipv4)
  2672. (define AF_INET6 'ipv6)
  2673. (define (inet-pton family address)
  2674. (define (bad-address)
  2675. (error "bad address" family address))
  2676. (define (check-u8 x)
  2677. (unless (and x (<= 0 x 255)) (bad-address))
  2678. x)
  2679. (define (check-number x)
  2680. (unless (number? x) (bad-address))
  2681. x)
  2682. (define (read-decimal port)
  2683. (check-u8
  2684. (string->number
  2685. (list->string
  2686. (let lp ()
  2687. (match (peek-char port)
  2688. ((and char (or #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
  2689. (cons (read-char port) (lp)))
  2690. (_ '())))))))
  2691. (define (hex-digit? char)
  2692. (match char
  2693. ((or #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9
  2694. #\a #\b #\c #\d #\e #\f
  2695. #\A #\B #\C #\D #\E #\F)
  2696. #t)
  2697. (_ #f)))
  2698. (define (read-hexadecimal port)
  2699. (check-number
  2700. (string->number
  2701. (list->string
  2702. (let lp ((k 0))
  2703. (match (peek-char port)
  2704. ((? hex-digit?)
  2705. (if (= k 4)
  2706. (bad-address)
  2707. (cons (read-char port) (lp (1+ k)))))
  2708. (_ '()))))
  2709. 16)))
  2710. (define (read-dot port)
  2711. (match (read-char port)
  2712. (#\. (values))
  2713. (_ (bad-address))))
  2714. (define (read-colon port)
  2715. (match (read-char port)
  2716. (#\: (values))
  2717. (_ (bad-address))))
  2718. (define (read-decimal-and-dot port)
  2719. (let ((n (read-decimal port)))
  2720. (read-dot port)
  2721. n))
  2722. (define (read-hexadecimal-and-colon port)
  2723. (let ((n (read-hexadecimal port)))
  2724. (read-colon port)
  2725. n))
  2726. (define (read-ipv6-groups port)
  2727. (define (iter)
  2728. (match (peek-char port)
  2729. ((? eof-object?) '())
  2730. ((? hex-digit?)
  2731. (let ((x (read-hexadecimal port)))
  2732. (match (read-char port)
  2733. ((? eof-object?) (list x))
  2734. (#\: (cons x (iter))))))
  2735. (#\:
  2736. (read-char port)
  2737. '())))
  2738. (match (peek-char port)
  2739. ((? eof-object?) '())
  2740. ((? hex-digit?)
  2741. (iter))
  2742. (#\:
  2743. (read-char port)
  2744. (match (read-char port)
  2745. (#\: '())
  2746. (_ (bad-address))))))
  2747. (match family
  2748. ('ipv4
  2749. (call-with-input-string address
  2750. (lambda (port)
  2751. (let ((a (read-decimal-and-dot port))
  2752. (b (read-decimal-and-dot port))
  2753. (c (read-decimal-and-dot port))
  2754. (d (read-decimal port)))
  2755. (if (eof-object? (peek-char port))
  2756. (logior (ash a 24)
  2757. (ash b 16)
  2758. (ash c 8)
  2759. d)
  2760. (bad-address))))))
  2761. ;; TODO: IPv6 addresses with embedded IPv4 address.
  2762. ('ipv6
  2763. (call-with-input-string address
  2764. (lambda (port)
  2765. (let* ((pre (read-ipv6-groups port))
  2766. (post (read-ipv6-groups port))
  2767. (pad (- 8 (+ (length pre) (length post)))))
  2768. (if (> pad 0)
  2769. (match (append pre (make-list pad 0) post)
  2770. ((a b c d e f g h)
  2771. (logior (ash a 112)
  2772. (ash b 96)
  2773. (ash c 80)
  2774. (ash d 64)
  2775. (ash e 48)
  2776. (ash f 32)
  2777. (ash g 16)
  2778. h))
  2779. (_ (bad-address)))
  2780. (bad-address)))))))))