guile.scm 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833
  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. ceiling-quotient
  500. ceiling-remainder
  501. ceiling/
  502. centered-quotient
  503. centered-remainder
  504. centered/
  505. char-general-category
  506. char-is-both?
  507. char-set-adjoin
  508. char-set-adjoin!
  509. char-set-any
  510. char-set-complement
  511. char-set-complement!
  512. char-set-copy
  513. char-set-count
  514. char-set-cursor
  515. char-set-cursor-next
  516. char-set-delete
  517. char-set-delete!
  518. char-set-diff+intersection
  519. char-set-diff+intersection!
  520. char-set-difference
  521. char-set-difference!
  522. char-set-every
  523. char-set-filter
  524. char-set-filter!
  525. char-set-fold
  526. char-set-for-each
  527. char-set-hash
  528. char-set-intersection
  529. char-set-intersection!
  530. char-set-map
  531. char-set-ref
  532. char-set-size
  533. char-set-unfold
  534. char-set-unfold!
  535. char-set-union!
  536. char-set-xor
  537. char-set-xor!
  538. char-set:designated
  539. char-set<=
  540. char-set=
  541. char-titlecase
  542. chdir
  543. chmod
  544. chmodat
  545. chown
  546. chown-at
  547. chroot
  548. close-fdes
  549. closedir
  550. compose
  551. connect
  552. cons-source
  553. const
  554. convert-assignment
  555. copy-file
  556. copy-random-state
  557. cosh
  558. crypt
  559. ctermid
  560. current-filename
  561. current-language
  562. current-load-port
  563. current-module
  564. current-reader
  565. current-source-location
  566. current-warning-port
  567. datum->random-state
  568. debug-disable
  569. debug-enable
  570. debug-options
  571. debug-options-interface
  572. debug-set!
  573. default-duplicate-binding-handler
  574. default-duplicate-binding-procedures
  575. define!
  576. define-library
  577. define-macro
  578. define-module
  579. define-module*
  580. define-once
  581. define-option-interface
  582. define-private
  583. define-public
  584. define-syntax-parameter
  585. defined?
  586. defmacro
  587. defmacro-public
  588. delete
  589. delete!
  590. delete-file
  591. delete-file-at
  592. delete1!
  593. delv
  594. delv!
  595. delv1!
  596. directory-stream?
  597. dirname
  598. display-application
  599. display-backtrace
  600. display-error
  601. dup
  602. dup->fdes
  603. dup->inport
  604. dup->outport
  605. dup->port
  606. dup2
  607. duplicate-handlers
  608. duplicate-port
  609. dynamic-call
  610. dynamic-func
  611. dynamic-link
  612. dynamic-object?
  613. dynamic-pointer
  614. dynamic-unlink
  615. effective-version
  616. end-of-char-set?
  617. endgrent
  618. endhostent
  619. endnetent
  620. endprotoent
  621. endpwent
  622. endservent
  623. ensure-batch-mode!
  624. environ
  625. euclidean-quotient
  626. euclidean-remainder
  627. euclidean/
  628. eval
  629. eval-string
  630. eval-when
  631. exception-accessor
  632. exception-args
  633. exception-kind
  634. exception-predicate
  635. exception-type?
  636. execl
  637. execle
  638. execlp
  639. exit-hook
  640. export
  641. export!
  642. export-syntax
  643. fcntl
  644. fdes->inport
  645. fdes->outport
  646. fdes->ports
  647. fdopen
  648. file-encoding
  649. file-exists?
  650. file-is-directory?
  651. file-name-separator-string
  652. file-name-separator?
  653. file-port?
  654. file-set-position
  655. fileno
  656. filter!
  657. flock
  658. fluid->parameter
  659. fluid-bound?
  660. fluid-ref*
  661. fluid-thread-local?
  662. fluid-unset!
  663. flush-all-ports
  664. frame-address
  665. frame-arguments
  666. frame-dynamic-link
  667. frame-instruction-pointer
  668. frame-previous
  669. frame-procedure-name
  670. frame-return-address
  671. frame-source
  672. frame-stack-pointer
  673. frame?
  674. fsync
  675. gai-strerror
  676. gc
  677. gc-disable
  678. gc-dump
  679. gc-enable
  680. gc-run-time
  681. gc-stats
  682. gensym
  683. get-internal-real-time
  684. get-internal-run-time
  685. get-print-state
  686. getaddrinfo
  687. getaffinity
  688. getcwd
  689. getegid
  690. getenv
  691. geteuid
  692. getgid
  693. getgr
  694. getgrent
  695. getgrgid
  696. getgrnam
  697. getgroups
  698. gethost
  699. gethostbyaddr
  700. gethostbyname
  701. gethostent
  702. gethostname
  703. getitimer
  704. getlogin
  705. getnet
  706. getnetbyaddr
  707. getnetbyname
  708. getnetent
  709. getpass
  710. getpeername
  711. getpgrp
  712. getpid
  713. getppid
  714. getpriority
  715. getproto
  716. getprotobyname
  717. getprotobynumber
  718. getprotoent
  719. getpw
  720. getpwent
  721. getpwnam
  722. getpwuid
  723. getrlimit
  724. getserv
  725. getservbyname
  726. getservbyport
  727. getservent
  728. getsid
  729. getsockname
  730. getsockopt
  731. gettext
  732. gettimeofday
  733. getuid
  734. gmtime
  735. group:gid
  736. group:mem
  737. group:name
  738. group:passwd
  739. has-shown-backtrace-hint?
  740. hook->list
  741. hook-empty?
  742. hook?
  743. hostent:addr-list
  744. hostent:addrtype
  745. hostent:aliases
  746. hostent:length
  747. hostent:name
  748. import
  749. in-vicinity
  750. include
  751. include-ci
  752. include-deprecated-features
  753. include-library-declarations
  754. inet-lnaof
  755. inet-makeaddr
  756. inet-netof
  757. inet-ntop
  758. inherit-print-state
  759. install-r6rs!
  760. install-r7rs!
  761. integer-expt
  762. integer-length
  763. interaction-environment
  764. internal-time-units-per-second
  765. iota
  766. isatty?
  767. issue-deprecation-warning
  768. keyword-like-symbol->keyword
  769. kill
  770. kw-arg-ref
  771. library
  772. link
  773. list->array
  774. list->bitvector
  775. list->char-set!
  776. list->symbol
  777. list->typed-array
  778. list-cdr-ref
  779. list-cdr-set!
  780. list-index
  781. listen
  782. load
  783. load-compiled
  784. load-extension
  785. load-from-path
  786. load-in-vicinity
  787. load-user-init
  788. local-define
  789. local-define-module
  790. local-ref
  791. local-ref-module
  792. local-remove
  793. local-set!
  794. localtime
  795. log10
  796. logcount
  797. lookup-duplicates-handlers
  798. lstat
  799. macro-binding
  800. macro-name
  801. macro-transformer
  802. macro-type
  803. macro?
  804. macroexpand
  805. macroexpanded?
  806. major-version
  807. make-array
  808. make-autoload-interface
  809. make-exception-type
  810. make-fresh-user-module
  811. make-generalized-vector
  812. make-guardian
  813. make-hook
  814. make-module
  815. make-modules-in
  816. make-mutable-parameter
  817. make-object-property
  818. make-procedure-with-setter
  819. make-record-type
  820. make-socket-address
  821. make-soft-port
  822. make-stack
  823. make-struct-layout
  824. make-struct/no-tail
  825. make-struct/simple
  826. make-syntax-transformer
  827. make-thread-local-fluid
  828. make-typed-array
  829. make-unbound-fluid
  830. make-undefined-variable
  831. make-variable-transformer
  832. make-vtable
  833. map-in-order
  834. memoize-expression
  835. memoized-typecode
  836. merge
  837. merge!
  838. micro-version
  839. minor-version
  840. mkdir
  841. mkdirat
  842. mkdtemp
  843. mknod
  844. mkstemp
  845. mkstemp!
  846. mktime
  847. module-add!
  848. module-autoload!
  849. module-binder
  850. module-bound?
  851. module-call-observers
  852. module-clear!
  853. module-constructor
  854. module-declarative?
  855. module-defer-observers
  856. module-define!
  857. module-define-submodule!
  858. module-defined-hook
  859. module-defined?
  860. module-duplicates-handlers
  861. module-ensure-local-variable!
  862. module-export!
  863. module-export-all!
  864. module-filename
  865. module-for-each
  866. module-generate-unique-id!
  867. module-gensym
  868. module-import-interface
  869. module-import-obarray
  870. module-inlinable-exports
  871. module-kind
  872. module-local-variable
  873. module-locally-bound?
  874. module-make-local-var!
  875. module-map
  876. module-modified
  877. module-name
  878. module-next-unique-id
  879. module-obarray
  880. module-obarray-get-handle
  881. module-obarray-ref
  882. module-obarray-remove!
  883. module-obarray-set!
  884. module-observe
  885. module-observe-weak
  886. module-observers
  887. module-public-interface
  888. module-re-export!
  889. module-ref
  890. module-ref-submodule
  891. module-remove!
  892. module-replace!
  893. module-replacements
  894. module-reverse-lookup
  895. module-search
  896. module-submodule-binder
  897. module-submodules
  898. module-symbol-binding
  899. module-symbol-interned?
  900. module-symbol-local-binding
  901. module-symbol-locally-interned?
  902. module-transformer
  903. module-type
  904. module-unobserve
  905. module-use!
  906. module-use-interfaces!
  907. module-uses
  908. module-variable
  909. module-version
  910. module-weak-observers
  911. module?
  912. modulo-expt
  913. move->fdes
  914. nested-define!
  915. nested-define-module!
  916. nested-ref
  917. nested-ref-module
  918. nested-remove!
  919. nested-set!
  920. netent:addrtype
  921. netent:aliases
  922. netent:name
  923. netent:net
  924. ngettext
  925. nice
  926. nil?
  927. noop
  928. object-properties
  929. object-property
  930. open
  931. open-fdes
  932. open-fdes-at
  933. open-file
  934. open-file
  935. open-io-file
  936. openat
  937. opendir
  938. parameter-converter
  939. parameter-fluid
  940. parse-path
  941. parse-path-with-ellipsis
  942. passwd:dir
  943. passwd:gecos
  944. passwd:gid
  945. passwd:name
  946. passwd:passwd
  947. passwd:shell
  948. passwd:uid
  949. pause
  950. pipe
  951. port->fdes
  952. port-for-each
  953. port-mode
  954. port-revealed
  955. port-with-print-state
  956. prefab-record-types
  957. primitive-_exit
  958. primitive-eval
  959. primitive-exit
  960. primitive-fork
  961. primitive-load
  962. primitive-load-path
  963. primitive-move->fdes
  964. primitive-read
  965. print-disable
  966. print-enable
  967. print-exception
  968. print-options
  969. print-options-interface
  970. print-set!
  971. procedure
  972. procedure-documentation
  973. procedure-minimum-arity
  974. procedure-properties
  975. procedure-property
  976. procedure-source
  977. procedure-with-setter?
  978. process-use-modules
  979. protoent:aliases
  980. protoent:name
  981. protoent:proto
  982. provide
  983. provided?
  984. purify-module!
  985. putenv
  986. raise
  987. random
  988. random-state->datum
  989. random-state-from-platform
  990. random:exp
  991. random:hollow-sphere!
  992. random:normal
  993. random:normal-vector!
  994. random:solid-sphere!
  995. random:uniform
  996. re-export
  997. re-export-syntax
  998. read-disable
  999. read-enable
  1000. read-eval?
  1001. read-hash-extend
  1002. read-hash-procedure
  1003. read-hash-procedures
  1004. read-options
  1005. read-options-interface
  1006. read-set!
  1007. read-syntax
  1008. readdir
  1009. readlink
  1010. record-accessor
  1011. record-constructor
  1012. record-modifier
  1013. record-predicate
  1014. record-type-constructor
  1015. record-type-descriptor
  1016. record-type-extensible?
  1017. record-type-fields
  1018. record-type-has-parent?
  1019. record-type-mutable-fields
  1020. record-type-name
  1021. record-type-opaque?
  1022. record-type-parent
  1023. record-type-properties
  1024. record-type-uid
  1025. record-type-vtable
  1026. record-type?
  1027. recv!
  1028. recvfrom!
  1029. redirect-port
  1030. release-port-handle
  1031. reload-module
  1032. remove-hook!
  1033. rename-file
  1034. rename-file-at
  1035. repl-reader
  1036. require-extension
  1037. reset-hook!
  1038. resolve-interface
  1039. resolve-module
  1040. resolve-r6rs-interface
  1041. restore-signals
  1042. reverse!
  1043. reverse-list->string
  1044. rewinddir
  1045. rmdir
  1046. round-ash
  1047. round-quotient
  1048. round-remainder
  1049. round/
  1050. run-hook
  1051. save-module-excursion
  1052. search-path
  1053. seed->random-state
  1054. select
  1055. self-evaluating?
  1056. send
  1057. sendfile
  1058. sendto
  1059. servent:aliases
  1060. servent:name
  1061. servent:port
  1062. servent:proto
  1063. set-autoloaded!
  1064. set-current-dynamic-state
  1065. set-current-error-port
  1066. set-current-input-port
  1067. set-current-module
  1068. set-current-output-port
  1069. set-exception-printer!
  1070. set-module-binder!
  1071. set-module-declarative?!
  1072. set-module-duplicates-handlers!
  1073. set-module-filename!
  1074. set-module-inlinable-exports!
  1075. set-module-kind!
  1076. set-module-name!
  1077. set-module-next-unique-id!
  1078. set-module-obarray!
  1079. set-module-observers!
  1080. set-module-public-interface!
  1081. set-module-submodule-binder!
  1082. set-module-submodules!
  1083. set-module-transformer!
  1084. set-module-uses!
  1085. set-module-version!
  1086. set-object-properties!
  1087. set-object-property!
  1088. set-port-column!
  1089. set-port-filename!
  1090. set-port-line!
  1091. set-port-revealed!
  1092. set-procedure-minimum-arity!
  1093. set-procedure-properties!
  1094. set-procedure-property!
  1095. set-program-arguments
  1096. set-source-properties!
  1097. set-source-property!
  1098. set-struct-vtable-name!
  1099. set-symbol-property!
  1100. set-tm:gmtoff
  1101. set-tm:hour
  1102. set-tm:isdst
  1103. set-tm:mday
  1104. set-tm:min
  1105. set-tm:mon
  1106. set-tm:sec
  1107. set-tm:wday
  1108. set-tm:yday
  1109. set-tm:year
  1110. set-tm:zone
  1111. setaffinity
  1112. setegid
  1113. setenv
  1114. seteuid
  1115. setgid
  1116. setgr
  1117. setgrent
  1118. setgroups
  1119. sethost
  1120. sethostent
  1121. sethostname
  1122. setitimer
  1123. setlocale
  1124. setnet
  1125. setnetent
  1126. setpgid
  1127. setpriority
  1128. setproto
  1129. setprotoent
  1130. setpw
  1131. setpwent
  1132. setrlimit
  1133. setserv
  1134. setservent
  1135. setsid
  1136. setsockopt
  1137. setter
  1138. setuid
  1139. shared-array-increments
  1140. shared-array-offset
  1141. shared-array-root
  1142. shutdown
  1143. sigaction
  1144. signal-handlers
  1145. sinh
  1146. sleep
  1147. sloppy-assoc
  1148. sloppy-assq
  1149. sloppy-assv
  1150. sockaddr:addr
  1151. sockaddr:fam
  1152. sockaddr:flowinfo
  1153. sockaddr:path
  1154. sockaddr:port
  1155. sockaddr:scopeid
  1156. socket
  1157. socketpair
  1158. sorted?
  1159. source-properties
  1160. source-property
  1161. source-whash
  1162. spawn
  1163. stack-id
  1164. stack-length
  1165. stack-ref
  1166. stack?
  1167. standard-vtable-fields
  1168. start-stack
  1169. stat
  1170. stat:atime
  1171. stat:atimensec
  1172. stat:blksize
  1173. stat:blocks
  1174. stat:ctime
  1175. stat:ctimensec
  1176. stat:dev
  1177. stat:gid
  1178. stat:ino
  1179. stat:mode
  1180. stat:mtime
  1181. stat:mtimensec
  1182. stat:nlink
  1183. stat:perms
  1184. stat:rdev
  1185. stat:size
  1186. stat:type
  1187. stat:uid
  1188. statat
  1189. status:exit-val
  1190. status:stop-sig
  1191. status:term-sig
  1192. strerror
  1193. strftime
  1194. string->char-set!
  1195. string-any
  1196. string-any-c-code
  1197. string-append/shared
  1198. string-bytes-per-char
  1199. string-capitalize
  1200. string-capitalize!
  1201. string-ci->symbol
  1202. string-ci<
  1203. string-ci<=
  1204. string-ci<>
  1205. string-ci=
  1206. string-ci>
  1207. string-ci>=
  1208. string-compare
  1209. string-compare-ci
  1210. string-concatenate-reverse/shared
  1211. string-concatenate/shared
  1212. string-contains
  1213. string-contains-ci
  1214. string-count
  1215. string-delete
  1216. string-downcase!
  1217. string-drop
  1218. string-drop-right
  1219. string-every
  1220. string-every-c-code
  1221. string-filter
  1222. string-fold
  1223. string-fold-right
  1224. string-for-each-index
  1225. string-hash
  1226. string-hash-ci
  1227. string-map!
  1228. string-normalize-nfc
  1229. string-normalize-nfd
  1230. string-normalize-nfkc
  1231. string-normalize-nfkd
  1232. string-pad
  1233. string-pad-right
  1234. string-prefix-length
  1235. string-prefix-length-ci
  1236. string-replace
  1237. string-reverse!
  1238. string-skip
  1239. string-skip-right
  1240. string-suffix-length
  1241. string-suffix-length-ci
  1242. string-tabulate
  1243. string-take
  1244. string-take-right
  1245. string-titlecase
  1246. string-titlecase!
  1247. string-tokenize
  1248. string-unfold
  1249. string-unfold-right
  1250. string-upcase!
  1251. string-utf8-length
  1252. string-xcopy!
  1253. string<
  1254. string<=
  1255. string<>
  1256. string=
  1257. string>
  1258. string>=
  1259. strptime
  1260. struct-layout
  1261. struct-ref
  1262. struct-ref/unboxed
  1263. struct-set!
  1264. struct-set!/unboxed
  1265. struct-vtable
  1266. struct-vtable-name
  1267. struct-vtable?
  1268. struct?
  1269. substring-fill!
  1270. substring-move!
  1271. substring/copy
  1272. substring/read-only
  1273. supports-source-properties?
  1274. symbol
  1275. symbol-append
  1276. symbol-fref
  1277. symbol-fset!
  1278. symbol-hash
  1279. symbol-interned?
  1280. symbol-pref
  1281. symbol-prefix-proc
  1282. symbol-property
  1283. symbol-property-remove!
  1284. symbol-pset!
  1285. symlink
  1286. symlinkat
  1287. sync
  1288. syntax-parameterize
  1289. syntax-source
  1290. system
  1291. system*
  1292. system-async-mark
  1293. system-error-errno
  1294. system-file-name-convention
  1295. tanh
  1296. tcgetpgrp
  1297. tcsetpgrp
  1298. textdomain
  1299. the-root-module
  1300. the-scm-module
  1301. thunk?
  1302. times
  1303. tm:gmtoff
  1304. tm:hour
  1305. tm:isdst
  1306. tm:mday
  1307. tm:min
  1308. tm:mon
  1309. tm:sec
  1310. tm:wday
  1311. tm:yday
  1312. tm:year
  1313. tm:zone
  1314. tmpfile
  1315. tmpnam
  1316. tms:clock
  1317. tms:cstime
  1318. tms:cutime
  1319. tms:stime
  1320. tms:utime
  1321. transpose-array
  1322. truncate
  1323. truncate-file
  1324. truncate-quotient
  1325. truncate-remainder
  1326. truncate/
  1327. try-load-module
  1328. try-module-autoload
  1329. ttyname
  1330. typed-array?
  1331. tzset
  1332. ucs-range->char-set
  1333. ucs-range->char-set!
  1334. umask
  1335. uname
  1336. unmemoize-expression
  1337. unsetenv
  1338. use-modules
  1339. use-srfis
  1340. user-modules-declarative?
  1341. using-readline?
  1342. usleep
  1343. utime
  1344. utsname:machine
  1345. utsname:nodename
  1346. utsname:release
  1347. utsname:sysname
  1348. utsname:version
  1349. variable-bound?
  1350. variable-unset!
  1351. vector-move-left!
  1352. vector-move-right!
  1353. version
  1354. version-matches?
  1355. vtable-index-layout
  1356. vtable-index-printer
  1357. vtable-offset-user
  1358. waitpid
  1359. warn
  1360. with-continuation-barrier
  1361. with-ellipsis
  1362. with-fluids*
  1363. xsubstring))
  1364. (library (guile)
  1365. (export %default-port-conversion-strategy
  1366. %default-port-encoding
  1367. %make-void-port
  1368. &compound-exception
  1369. &error
  1370. &exception
  1371. &non-continuable
  1372. *
  1373. *unspecified*
  1374. @@
  1375. +
  1376. -
  1377. ->bool
  1378. ...
  1379. /
  1380. 1+ 1-
  1381. <
  1382. <=
  1383. =
  1384. =>
  1385. >
  1386. >=
  1387. _
  1388. AF_INET
  1389. AF_INET6
  1390. SEEK_CUR
  1391. SEEK_END
  1392. SEEK_SET
  1393. abort-to-prompt
  1394. abs
  1395. acons
  1396. acos
  1397. and
  1398. and-map
  1399. and=>
  1400. angle
  1401. append
  1402. append!
  1403. apply
  1404. array?
  1405. array-cell-ref
  1406. array-for-each
  1407. array-length
  1408. array-rank
  1409. array-ref
  1410. array-shape
  1411. array-type
  1412. ash
  1413. asin
  1414. assoc
  1415. assoc-ref
  1416. assq
  1417. assq-ref
  1418. assv
  1419. assv-ref
  1420. atan
  1421. begin
  1422. bitvector
  1423. bitvector-length
  1424. bitvector-ref
  1425. bitvector-set!
  1426. bitvector?
  1427. boolean?
  1428. bound-identifier=?
  1429. caaaar
  1430. caaadr
  1431. caaar
  1432. caadar
  1433. caaddr
  1434. caadr
  1435. caar
  1436. cadaar
  1437. cadadr
  1438. cadar
  1439. caddar
  1440. cadddr
  1441. caddr
  1442. cadr
  1443. call-with-current-continuation
  1444. call-with-input-file
  1445. call-with-input-string
  1446. call-with-output-file
  1447. call-with-output-string
  1448. call-with-port
  1449. call-with-prompt
  1450. call-with-values
  1451. call/cc
  1452. car
  1453. case
  1454. case-lambda
  1455. case-lambda*
  1456. catch
  1457. cdaaar
  1458. cdaadr
  1459. cdaar
  1460. cdadar
  1461. cdaddr
  1462. cdadr
  1463. cdar
  1464. cddaar
  1465. cddadr
  1466. cddar
  1467. cdddar
  1468. cddddr
  1469. cdddr
  1470. cddr
  1471. cdr
  1472. ceiling
  1473. char->integer
  1474. char-alphabetic?
  1475. char-ci<=?
  1476. char-ci<?
  1477. char-ci=?
  1478. char-ci>=?
  1479. char-ci>?
  1480. char-downcase
  1481. char-lower-case?
  1482. char-numeric?
  1483. char-ready?
  1484. char-upcase
  1485. char-upper-case?
  1486. char-whitespace?
  1487. char<=?
  1488. char<?
  1489. char=?
  1490. char>=?
  1491. char>?
  1492. char?
  1493. char-set
  1494. char-set-union
  1495. char-set->list
  1496. char-set->string
  1497. char-set?
  1498. char-set-contains?
  1499. char-set:ascii
  1500. char-set:blank
  1501. char-set:digit
  1502. char-set:empty
  1503. char-set:full
  1504. char-set:graphic
  1505. char-set:hex-digit
  1506. char-set:iso-control
  1507. char-set:letter
  1508. char-set:letter+digit
  1509. char-set:lower-case
  1510. char-set:printing
  1511. char-set:punctuation
  1512. char-set:symbol
  1513. char-set:title-case
  1514. char-set:upper-case
  1515. char-set:whitespace
  1516. close
  1517. close-input-port
  1518. close-output-port
  1519. close-port
  1520. command-line
  1521. complex?
  1522. cond
  1523. cond-expand
  1524. cond-expand-provide
  1525. cons
  1526. cons*
  1527. cos
  1528. current-dynamic-state
  1529. current-error-port
  1530. current-input-port
  1531. current-output-port
  1532. current-time
  1533. datum->syntax
  1534. default-prompt-tag
  1535. define
  1536. define*
  1537. define-inlinable
  1538. define-syntax
  1539. define-syntax-rule
  1540. define-values
  1541. delay
  1542. delq
  1543. delq!
  1544. delq1!
  1545. denominator
  1546. display
  1547. do
  1548. doubly-weak-hash-table?
  1549. drain-input
  1550. dynamic-state?
  1551. dynamic-wind
  1552. else
  1553. eof-object?
  1554. eq?
  1555. equal?
  1556. eqv?
  1557. error
  1558. even?
  1559. (rename inexact exact->inexact)
  1560. exact-integer-sqrt
  1561. exact-integer?
  1562. exact?
  1563. exception?
  1564. exit
  1565. exp
  1566. expt
  1567. false-if-exception
  1568. file-position
  1569. filter
  1570. finite?
  1571. floor
  1572. floor-quotient
  1573. floor-remainder
  1574. floor/
  1575. fluid-ref
  1576. fluid-set!
  1577. fluid?
  1578. for-each
  1579. force
  1580. force-output
  1581. format
  1582. free-identifier=?
  1583. ftell
  1584. gcd
  1585. generate-temporaries
  1586. get-output-string
  1587. hash
  1588. hash-clear!
  1589. hash-count
  1590. hash-create-handle!
  1591. hash-fold
  1592. hash-for-each
  1593. hash-for-each-handle
  1594. hash-get-handle
  1595. hash-map->list
  1596. hash-ref
  1597. hash-remove!
  1598. hash-set!
  1599. hash-table?
  1600. hashq
  1601. hashq-create-handle!
  1602. hashq-get-handle
  1603. hashq-ref
  1604. hashq-remove!
  1605. hashq-set!
  1606. hashv
  1607. hashv-create-handle!
  1608. hashv-get-handle
  1609. hashv-ref
  1610. hashv-remove!
  1611. hashv-set!
  1612. hashx-create-handle!
  1613. hashx-get-handle
  1614. hashx-ref
  1615. hashx-remove!
  1616. hashx-set!
  1617. identifier-syntax
  1618. identifier?
  1619. identity
  1620. if
  1621. imag-part
  1622. include-from-path
  1623. (rename exact inexact->exact)
  1624. inet-pton
  1625. inexact?
  1626. inf
  1627. (rename infinite? inf?)
  1628. input-port?
  1629. integer->char
  1630. integer?
  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. ;; TODO: Implement arrays.
  1979. (define (array? obj) #f)
  1980. (define (make-shared-array array proc . dims)
  1981. (raise (make-unimplemented-error 'make-shared-array)))
  1982. (define (array-type array)
  1983. (raise (make-unimplemented-error 'array-type)))
  1984. (define (array-length array)
  1985. (raise (make-unimplemented-error 'array-length)))
  1986. (define (array-rank array)
  1987. (raise (make-unimplemented-error 'array-rank)))
  1988. (define (array-shape array)
  1989. (raise (make-unimplemented-error 'array-shape)))
  1990. (define (array-ref array . idx)
  1991. (raise (make-unimplemented-error 'array-ref)))
  1992. (define (array-cell-ref array . idx)
  1993. (raise (make-unimplemented-error 'array-cell-ref)))
  1994. (define (array-for-each proc . arrays)
  1995. (raise (make-unimplemented-error 'array-for-each)))
  1996. (define (%make-void-port mode)
  1997. (define (mode-prefix-match? test)
  1998. (call-with-input-string mode
  1999. (lambda (p)
  2000. (let lp ((c (read-char p)))
  2001. (cond
  2002. ((eof-object? c) #f)
  2003. ((or (test c)
  2004. (char-ci=? c #\+)) #t)
  2005. (else (lp (read-char p))))))))
  2006. (define %read
  2007. (and (mode-prefix-match? (lambda (c)
  2008. (char-ci=? c #\r)))
  2009. (lambda (bv start count) (eof-object))))
  2010. (define %write
  2011. (and (mode-prefix-match? (lambda (c)
  2012. (or (char-ci=? c #\w)
  2013. (char-ci=? c #\a))))
  2014. (lambda (bv start count) count)))
  2015. (make-port %read ; read
  2016. %write ; write
  2017. #f ; input-waiting?
  2018. #f ; seek
  2019. #f ; close
  2020. #f ; truncate
  2021. "void" ; repr
  2022. #f ; filename
  2023. 1024 ; read-buf-size
  2024. 1024 ; write-buf-size
  2025. #f ; r/w-random-access
  2026. #f ; fold-case?
  2027. #f ; private data
  2028. ))
  2029. (define-syntax *unspecified*
  2030. (identifier-syntax (if #f #f)))
  2031. (define (->bool x) (if x #t #f))
  2032. (define (and-map f l)
  2033. (match l
  2034. (() #t)
  2035. ((x . l)
  2036. (and (f x) (and-map f l)))))
  2037. (define (or-map f l)
  2038. (match l
  2039. (() #f)
  2040. ((x . l)
  2041. (or (f x) (or-map f l)))))
  2042. (define (filter pred l)
  2043. (match l
  2044. (() '())
  2045. ((head . tail)
  2046. (if (pred head)
  2047. (cons head (filter pred tail))
  2048. (filter pred tail)))))
  2049. (define (and=> x f) (and x (f x)))
  2050. (define (list-head lst k)
  2051. (if (zero? k)
  2052. '()
  2053. (cons (car lst) (list-head (cdr lst) (1- k)))))
  2054. (define (assq-ref alist x) (and=> (assq x alist) cdr))
  2055. (define (assv-ref alist x) (and=> (assv x alist) cdr))
  2056. (define (assoc-ref alist x) (and=> (assoc x alist) cdr))
  2057. ;; Guile's manual says that append! is not required to modify the
  2058. ;; list, so let's not!
  2059. (define append! append)
  2060. (define (delq item lst)
  2061. (match lst
  2062. (() '())
  2063. ((x . rest)
  2064. (if (eq? item x)
  2065. (delq item rest)
  2066. (cons x (delq item rest))))))
  2067. (define (delq! item lst)
  2068. (match lst
  2069. (() '())
  2070. ((x . rest)
  2071. (if (eq? item x)
  2072. (delq! item rest)
  2073. (let ((rest* (delq! item rest)))
  2074. (set-cdr! lst rest*)
  2075. lst)))))
  2076. (define (delq1! item lst)
  2077. (match lst
  2078. (() '())
  2079. ((x . rest)
  2080. (if (eq? item x)
  2081. rest
  2082. (let ((rest* (delq1! item rest)))
  2083. (set-cdr! lst rest*)
  2084. lst)))))
  2085. (define sort-list list:sort)
  2086. (define sort-list! sort-list)
  2087. (define (restricted-vector-sort! v less? start end)
  2088. (vector-sort! v less? start end))
  2089. (define (sort! items <)
  2090. (match items
  2091. (() '())
  2092. ((? pair?) (sort-list items <))
  2093. ((? vector?)
  2094. (restricted-vector-sort! items < 0 (vector-length items))
  2095. items)))
  2096. (define (sort items <)
  2097. (match items
  2098. (() '())
  2099. ((? pair?) (sort-list items <))
  2100. ((? vector?)
  2101. (let ((v (vector-copy items)))
  2102. (restricted-vector-sort! v < 0 (vector-length v))
  2103. v))))
  2104. ;; FIXME: vector-sort! is not stable.
  2105. (define stable-sort sort)
  2106. (define stable-sort! sort!)
  2107. (define (call-with-input-string str proc)
  2108. (proc (open-input-string str)))
  2109. (define (call-with-output-string proc)
  2110. (let ((port (open-output-string)))
  2111. (proc port)
  2112. (get-output-string port)))
  2113. (define (with-input-from-string str thunk)
  2114. (call-with-input-string str
  2115. (lambda (port)
  2116. (with-input-from-port port thunk))))
  2117. (define (with-output-to-string thunk)
  2118. (call-with-output-string
  2119. (lambda (port)
  2120. (with-output-to-port port thunk))))
  2121. (define (with-input-from-port port thunk)
  2122. (parameterize ((current-input-port port))
  2123. (thunk)))
  2124. (define (with-output-to-port port thunk)
  2125. (parameterize ((current-output-port port))
  2126. (thunk)))
  2127. (define (with-error-to-port port thunk)
  2128. (parameterize ((current-error-port port))
  2129. (thunk)))
  2130. (define (with-error-to-file filename thunk)
  2131. (call-with-port (open-output-file filename)
  2132. (lambda (port)
  2133. (with-error-to-port port thunk))))
  2134. (define (with-error-to-string thunk)
  2135. (call-with-output-string
  2136. (lambda (port) (with-error-to-port port thunk))))
  2137. (define (current-time) (current-jiffy))
  2138. (define (ftell port)
  2139. (seek port 0 'cur))
  2140. (define file-position ftell)
  2141. (define* (drain-input #:optional (port (current-input-port)))
  2142. (flush-input-port port))
  2143. (define* (force-output #:optional (port (current-output-port)))
  2144. (flush-output-port port))
  2145. (define (simple-format port template . args)
  2146. (define (do-format port)
  2147. (call-with-input-string
  2148. template
  2149. (lambda (in)
  2150. (let lp ((args args))
  2151. (match (read-char in)
  2152. ((? eof-object?)
  2153. (match args
  2154. (() (force-output port))
  2155. (_ (error "leftover format args" template args))))
  2156. (#\~
  2157. (match (read-char in)
  2158. ((or #\a #\A)
  2159. (match args
  2160. ((x . args) (display x port) (lp args))
  2161. (_ (error "not enough format args" template))))
  2162. ((or #\s #\S)
  2163. (match args
  2164. ((x . args) (write x port) (lp args))
  2165. (_ (error "not enough format args" template))))
  2166. (#\~ (write-char #\~ port) (lp args))
  2167. (#\% (newline port) (lp args))
  2168. (ch (error "unexpected format directive" template ch))))
  2169. (ch (write-char ch port) (lp args)))))))
  2170. (match port
  2171. (#t (do-format (current-output-port)))
  2172. (#f (call-with-output-string do-format))
  2173. ((? output-port?) (do-format port))
  2174. (_ (error "invalid format destination" port))))
  2175. (define format simple-format)
  2176. (define (inf) +inf.0)
  2177. (define (nan) +nan.0)
  2178. (define (negate x) (- x))
  2179. (define* (object->string obj #:optional (print write))
  2180. (call-with-output-string (lambda (port) (print obj port))))
  2181. ;; Object addresses are not visible in Wasm.
  2182. (define (object-address obj) 0)
  2183. (define (string-null? str) (string=? str ""))
  2184. (define (string-concatenate strs)
  2185. (apply string-append strs))
  2186. (define (string-split str char-pred)
  2187. (let ((char-pred (match char-pred
  2188. ((? char? a) (lambda (b) (char=? a b)))
  2189. ((? char-set? cs) (lambda (c) (char-set-contains? cs c)))
  2190. ((? procedure?) char-pred))))
  2191. (call-with-input-string str
  2192. (lambda (port)
  2193. (define (read-to-delimiter)
  2194. (match (let lp ()
  2195. (match (read-char port)
  2196. ((? eof-object?) '())
  2197. ((? char-pred) '())
  2198. (char (cons char (lp)))))
  2199. (() #f)
  2200. (chars (list->string chars))))
  2201. (let lp ()
  2202. (match (read-to-delimiter)
  2203. (#f '())
  2204. (substr (cons substr (lp)))))))))
  2205. (define* (string-join strs #:optional (delimiter " ") (grammar 'infix))
  2206. (define (prefix-join strs)
  2207. (match strs
  2208. (() '())
  2209. ((str . rest)
  2210. (cons* delimiter str (prefix-join rest)))))
  2211. (string-concatenate
  2212. (match grammar
  2213. ('infix
  2214. (match strs
  2215. (() '())
  2216. ((first . rest) (cons first (prefix-join rest)))))
  2217. ('strict-infix
  2218. (match strs
  2219. (() (error "strict-infix join with empty list"))
  2220. ((first . rest)
  2221. (cons first (prefix-join rest)))))
  2222. ('prefix (prefix-join strs))
  2223. ('suffix
  2224. (let lp ((strs strs))
  2225. (match strs
  2226. (() '())
  2227. ((str . rest) (cons* str delimiter (lp rest)))))))))
  2228. (define* (substring str start #:optional (end (string-length str)))
  2229. (hoot:substring str start end))
  2230. (define substring/shared substring)
  2231. (define* (string-concatenate-reverse strs #:optional final end)
  2232. (string-concatenate
  2233. (reverse
  2234. (if final
  2235. (cons (if end (substring final 0 end) final) strs)
  2236. strs))))
  2237. (define* (string-pad str len #:optional
  2238. (char #\space) (start 0) (end (string-length str)))
  2239. (let ((k (- len (- end start))))
  2240. (cond
  2241. ((zero? k) (substring str start end))
  2242. ((< k 0) (substring str (+ start (* k -1)) end))
  2243. (else
  2244. (string-append (make-string k char)
  2245. (substring str start end))))))
  2246. (define* (string-index s char-pred #:optional
  2247. (start 0) (end (string-length s)))
  2248. (let ((char-pred
  2249. (match char-pred
  2250. ((? char?) (lambda (c) (char=? c char-pred)))
  2251. ((? char-set? cs) (lambda (c) (char-set-contains? cs c)))
  2252. ((? procedure?) char-pred))))
  2253. (let lp ((i 0)
  2254. (sl (string->list (substring s start end))))
  2255. (match sl
  2256. (() #f)
  2257. (((? char-pred) . rest) (+ start i))
  2258. ((c . rest) (lp (1+ i) rest))))))
  2259. (define* (string-rindex s char-pred #:optional
  2260. (start 0) (end (string-length s)))
  2261. (let ((i (string-index (string-reverse (substring s start end))
  2262. char-pred)))
  2263. (and i (- end i 1))))
  2264. (define string-index-right string-rindex)
  2265. (define (%string-prefix? s1 s2 start1 end1 start2 end2 string-equal?)
  2266. (let ((k (- end1 start1)))
  2267. (and (<= k (- end2 start2))
  2268. (string-equal? (substring s1 start1 end1)
  2269. (substring s2 start2 (+ start2 k))))))
  2270. (define* (string-prefix? s1 s2 #:optional
  2271. (start1 0) (end1 (string-length s1))
  2272. (start2 0) (end2 (string-length s2)))
  2273. (%string-prefix? s1 s2 start1 end1 start2 end2 string=?))
  2274. (define* (string-prefix-ci? s1 s2 #:optional
  2275. (start1 0) (end1 (string-length s1))
  2276. (start2 0) (end2 (string-length s2)))
  2277. (%string-prefix? s1 s2 start1 end1 start2 end2 string-ci=?))
  2278. (define (%string-suffix? s1 s2 start1 end1 start2 end2 string-equal?)
  2279. (let ((k (- end1 start1)))
  2280. (and (<= k (- end2 start2))
  2281. (string-equal? (substring s1 start1 end1)
  2282. (substring s2 (- end2 k) end2)))))
  2283. (define* (string-suffix? s1 s2 #:optional
  2284. (start1 0) (end1 (string-length s1))
  2285. (start2 0) (end2 (string-length s2)))
  2286. (%string-suffix? s1 s2 start1 end1 start2 end2 string=?))
  2287. (define* (string-suffix-ci? s1 s2 #:optional
  2288. (start1 0) (end1 (string-length s1))
  2289. (start2 0) (end2 (string-length s2)))
  2290. (%string-suffix? s1 s2 start1 end1 start2 end2 string-ci=?))
  2291. (define* (string-reverse str #:optional (start 0) (end (string-length str)))
  2292. (let ((pre (substring str 0 start))
  2293. (post (substring str end (string-length str))))
  2294. (string-append
  2295. pre
  2296. (list->string
  2297. (reverse
  2298. (string->list
  2299. (substring str start end))))
  2300. post)))
  2301. (define (%string-trim sl char-pred)
  2302. (let ((char-pred
  2303. (match char-pred
  2304. ((? char?) (lambda (c) (char=? c char-pred)))
  2305. ((? char-set? cs) (lambda (c) (char-set-contains? cs c)))
  2306. ((? procedure?) char-pred))))
  2307. (let lp ((sl sl))
  2308. (match sl
  2309. (() "")
  2310. (((? char-pred c) . rest) (lp rest))
  2311. (_ sl)))))
  2312. (define* (string-trim s #:optional
  2313. (char-pred char-set:whitespace)
  2314. (start 0) (end (string-length s)))
  2315. (list->string
  2316. (%string-trim (string->list (substring s start end))
  2317. char-pred)))
  2318. (define* (string-trim-right s #:optional
  2319. (char-pred char-set:whitespace)
  2320. (start 0) (end (string-length s)))
  2321. (list->string
  2322. (reverse
  2323. (%string-trim (reverse (string->list (substring s start end)))
  2324. char-pred))))
  2325. (define* (string-trim-both s #:optional
  2326. (char-pred char-set:whitespace)
  2327. (start 0) (end (string-length s)))
  2328. (string-trim-right (string-trim s char-pred start end) char-pred))
  2329. (define (string-capitalize str)
  2330. (raise (make-unimplemented-error 'string-capitalize)))
  2331. (define (last-pair l)
  2332. (match l
  2333. ((_ . (and l (_ . _))) (last-pair l))
  2334. ((_ . _) l)
  2335. (_ (error "not a pair" l))))
  2336. (define (peek . stuff)
  2337. (newline)
  2338. (display ";;; ")
  2339. (write stuff)
  2340. (newline)
  2341. (flush-output-port (current-output-port))
  2342. (car (last-pair stuff)))
  2343. (define pk peek)
  2344. (define %default-port-conversion-strategy (make-fluid 'substitute))
  2345. (define %default-port-encoding (make-fluid "UTF-8"))
  2346. (define close close-port)
  2347. (define (port-closed? port) (not (port-open? port)))
  2348. (define SEEK_CUR 'cur)
  2349. (define SEEK_SET 'start)
  2350. (define SEEK_END 'end)
  2351. (define* (unread-char char #:optional (port (current-input-port)))
  2352. (raise (make-unimplemented-error 'unread-char)))
  2353. (define* (unread-string str port)
  2354. (raise (make-unimplemented-error 'unread-string)))
  2355. (define* (setvbuf port mode #:optional size)
  2356. (raise (make-unimplemented-error 'setvbuf)))
  2357. (define (program-arguments) (command-line))
  2358. (define quit exit)
  2359. (define the-eof-object (eof-object))
  2360. (define (unspecified? x) (eq? x *unspecified*))
  2361. (define-syntax-rule (λ formals body ...)
  2362. (lambda formals body ...))
  2363. (define* (catch key thunk handler #:optional pre-unwind-handler)
  2364. (raise (make-unimplemented-error 'catch)))
  2365. ;; TODO: Should we handle Guile's legacy key + args exception
  2366. ;; system?
  2367. (define (with-throw-handler key thunk handler)
  2368. (unless (eq? key #t)
  2369. (raise (make-unimplemented-error 'with-throw-handler)))
  2370. (with-exception-handler
  2371. (lambda (exn)
  2372. (apply handler #t '())
  2373. (raise-exception exn))
  2374. thunk))
  2375. ;; TODO: Implement Guile's conversions based on key.
  2376. (define (make-exception-from-throw key args)
  2377. (make-exception-with-irritants args))
  2378. (define (throw key . args)
  2379. (raise-exception (make-exception-from-throw key args)))
  2380. (define (scm-error key subr message args data)
  2381. (raise
  2382. (make-exception (make-exception-from-throw key args)
  2383. (make-exception-with-message
  2384. (apply format #f message args))
  2385. (make-exception-with-origin subr))))
  2386. (define-syntax-rule (false-if-exception expr)
  2387. (with-exception-handler (lambda (exn) #f)
  2388. (lambda () expr)
  2389. #:unwind? #t))
  2390. ;; Hash table API compatibility shim:
  2391. ;;
  2392. ;; Guile's legacy hash table API is not so great. It allows for
  2393. ;; mixing different hash functions in the same table, which is why
  2394. ;; there are *four* variants for ref/set!/remove! procedures. On
  2395. ;; top of that, the API is also polymorphic. Those same procedures
  2396. ;; are used on "normal", weak key, weak value, and doubly weak
  2397. ;; tables.
  2398. ;;
  2399. ;; We made a better interface in (hoot hashtables) that resembles
  2400. ;; the R6RS API and is monomorphic. However, in the interest of
  2401. ;; maximizing the amount of existing Guile code that can be compiled
  2402. ;; as-is with Hoot, we have provided this compatibility shim.
  2403. ;;
  2404. ;; Hoot does *not* provide full compatibility, just partial
  2405. ;; compatibility for common use-cases. Code that is mixing hash
  2406. ;; functions in the same table or using
  2407. ;; hash-get-handle/hash-create-handle! is not supported. Also,
  2408. ;; because hashx-* procedures use assoc and friends, which is
  2409. ;; incompatible with how (hoot hashtables) does equality testing, we
  2410. ;; force equal? as the equivalence function.
  2411. (define-record-type <hash-table>
  2412. (%make-hash-table type table)
  2413. hash-table?
  2414. (type hash-table-type) ; normal, weak-key, weak-value, doubly-weak
  2415. (table hash-table-table set-hash-table-table!)) ; lazily initialized
  2416. (define* (make-hash-table #:optional size)
  2417. "Return a new hash table. @var{size} is ignored."
  2418. (%make-hash-table 'normal #f))
  2419. (define* (make-weak-key-hash-table #:optional size)
  2420. "Return a new weak key hash table. @var{size} is ignored."
  2421. (%make-hash-table 'weak-key #f))
  2422. (define* (make-weak-value-hash-table #:optional size)
  2423. "Return a new weak value hash table. @var{size} is ignored."
  2424. (%make-hash-table 'weak-value #f))
  2425. (define* (make-doubly-weak-hash-table #:optional size)
  2426. "Return a new doubly weak hash table. @var{size} is ignored."
  2427. (%make-hash-table 'doubly-weak #f))
  2428. (define (weak-key-hash-table? obj)
  2429. "Return @code{#t} if @var{obj} is a weak key hash table."
  2430. (and (hash-table? obj) (eq? (hash-table-type obj) 'weak-key)))
  2431. (define (weak-value-hash-table? obj)
  2432. "Return @code{#t} if @var{obj} is a weak value hash table."
  2433. (and (hash-table? obj) (eq? (hash-table-type obj) 'weak-value)))
  2434. (define (doubly-weak-hash-table? obj)
  2435. "Return @code{#t} if @var{obj} is a doubly weak hash table."
  2436. (and (hash-table? obj) (eq? (hash-table-type obj) 'doubly-weak)))
  2437. ;; Should these assert that the hash and equiv functions are what we
  2438. ;; expect? Currently, mixing hash functions on the same table will
  2439. ;; just silently use the hash function of the first ref/set!/remove!
  2440. ;; call.
  2441. (define (maybe-init-equal-hashtable table)
  2442. (unless (hash-table-table table)
  2443. (match (hash-table-type table)
  2444. ('normal (set-hash-table-table! table (make-hashtable)))
  2445. ('weak-key (raise (make-unimplemented-error 'maybe-init-equal-hash-table)))
  2446. ('weak-value (raise (make-unimplemented-error 'maybe-init-equal-hash-table)))
  2447. ('doubly-weak (raise (make-unimplemented-error 'maybe-init-equal-hash-table))))))
  2448. (define (maybe-init-eq-hashtable table)
  2449. (unless (hash-table-table table)
  2450. (match (hash-table-type table)
  2451. ('normal (set-hash-table-table! table (make-eq-hashtable)))
  2452. ('weak-key (set-hash-table-table! table (make-weak-key-hashtable)))
  2453. ('weak-value (raise (make-unimplemented-error 'maybe-init-eq-hash-table)))
  2454. ('doubly-weak (raise (make-unimplemented-error 'maybe-init-eq-hash-table))))))
  2455. (define (maybe-init-eqv-hashtable table)
  2456. (unless (hash-table-table table)
  2457. (match (hash-table-type table)
  2458. ('normal (set-hash-table-table! table (make-eqv-hashtable)))
  2459. ('weak-key (raise (make-unimplemented-error 'maybe-init-eqv-hash-table)))
  2460. ('weak-value (raise (make-unimplemented-error 'maybe-init-eqv-hash-table)))
  2461. ('doubly-weak (raise (make-unimplemented-error 'maybe-init-eqv-hash-table))))))
  2462. (define (maybe-init-custom-hashtable table hash equiv)
  2463. (unless (hash-table-table table)
  2464. (match (hash-table-type table)
  2465. ('normal (set-hash-table-table! table (make-hashtable hash equiv)))
  2466. ('weak-key (raise (make-unimplemented-error 'maybe-init-custom-hash-table)))
  2467. ('weak-value (raise (make-unimplemented-error 'maybe-init-custom-hash-table)))
  2468. ('doubly-weak (raise (make-unimplemented-error 'maybe-init-custom-hash-table))))))
  2469. (define (%hash-ref who table key default)
  2470. (let ((table* (hash-table-table table)))
  2471. (match (hash-table-type table)
  2472. ('normal (hashtable-ref table* key default))
  2473. ('weak-key (weak-key-hashtable-ref table* key default))
  2474. ('weak-value (raise (make-unimplemented-error who)))
  2475. ('doubly-weak (raise (make-unimplemented-error who))))))
  2476. (define* (hash-ref table key #:optional default)
  2477. "Look up @var{key} in the hash table @var{table}, and return the
  2478. value associated with it. If @var{key} is not found, return
  2479. @var{default} (if specified) or @code{#f}. Uses @code{equal?} for
  2480. equality testing."
  2481. (maybe-init-equal-hashtable table)
  2482. (%hash-ref 'hash-ref table key default))
  2483. (define* (hashq-ref table key #:optional default)
  2484. "Look up @var{key} in the hash table @var{table}, and return the
  2485. value associated with it. If @var{key} is not found, return
  2486. @var{default} (if specified) or @code{#f}. Uses @code{eq?} for
  2487. equality testing."
  2488. (maybe-init-eq-hashtable table)
  2489. (%hash-ref 'hashq-ref table key default))
  2490. (define* (hashv-ref table key #:optional default)
  2491. "Look up @var{key} in the hash table @var{table}, and return the
  2492. value associated with it. If @var{key} is not found, return
  2493. @var{default} (if specified) or @code{#f}. Uses @code{eqv?} for
  2494. equality testing."
  2495. (maybe-init-eqv-hashtable table)
  2496. (%hash-ref 'hashv-ref table key default))
  2497. (define* (hashx-ref hash assoc table key #:optional default)
  2498. "Look up @var{key} in the hash table @var{table}, and return the
  2499. value associated with it. If @var{key} is not found, return
  2500. @var{default} (if specified) or @code{#f}. Uses @var{hash} as the
  2501. hash function. @var{assoc} is ignored and @code{equal?} is used for
  2502. equality testing."
  2503. (maybe-init-custom-hashtable table hash equal?)
  2504. (%hash-ref 'hashx-ref table key default))
  2505. (define (%hash-set! who table key val)
  2506. (let ((table* (hash-table-table table)))
  2507. (match (hash-table-type table)
  2508. ('normal (hashtable-set! table* key val))
  2509. ('weak-key (weak-key-hashtable-set! table* key val))
  2510. ('weak-value (raise (make-unimplemented-error who)))
  2511. ('doubly-weak (raise (make-unimplemented-error who))))))
  2512. (define (hash-set! table key val)
  2513. "Find the entry in @var{table} associated with @var{key} and store
  2514. @var{val} there. Uses @code{equal?} for equality testing."
  2515. (maybe-init-equal-hashtable table)
  2516. (%hash-set! 'hash-set! table key val))
  2517. (define (hashq-set! table key val)
  2518. "Find the entry in @var{table} associated with @var{key} and store
  2519. @var{val} there. Uses @code{eq?} for equality testing."
  2520. (maybe-init-eq-hashtable table)
  2521. (%hash-set! 'hashq-set! table key val))
  2522. (define (hashv-set! table key val)
  2523. "Find the entry in @var{table} associated with @var{key} and store
  2524. @var{val} there. Uses @code{eqv?} for equality testing."
  2525. (maybe-init-eqv-hashtable table)
  2526. (%hash-set! 'hashv-set! table key val))
  2527. (define (hashx-set! hash assoc table key val)
  2528. "Find the entry in @var{table} associated with @var{key} and store
  2529. @var{val} there. Uses @var{hash} as the hash function. @var{assoc}
  2530. is ignored and @code{equal?} is used for equality testing."
  2531. (maybe-init-custom-hashtable table hash equal?)
  2532. (%hash-set! 'hashx-set! table key val))
  2533. (define (%hash-remove! who table key)
  2534. (let ((table* (hash-table-table table)))
  2535. (match (hash-table-type table)
  2536. ('normal (hashtable-delete! table* key))
  2537. ('weak-key (weak-key-hashtable-delete! table* key))
  2538. ('weak-value (raise (make-unimplemented-error who)))
  2539. ('doubly-weak (raise (make-unimplemented-error who))))))
  2540. (define (hash-remove! table key)
  2541. "Remove @var{key} from @var{table}. Uses @code{equal?} for equality
  2542. testing."
  2543. (maybe-init-equal-hashtable table)
  2544. (%hash-remove! 'hash-remove! table key))
  2545. (define (hashq-remove! table key)
  2546. "Remove @var{key} from @var{table}. Uses @code{eq?} for equality
  2547. testing."
  2548. (maybe-init-eq-hashtable table)
  2549. (%hash-remove! 'hashq-remove! table key))
  2550. (define (hashv-remove! table key)
  2551. "Remove @var{key} from @var{table}. Uses @code{eqv?} for equality
  2552. testing."
  2553. (maybe-init-eqv-hashtable table)
  2554. (%hash-remove! 'hashv-remove! table key))
  2555. (define (hashx-remove! hash assoc table key)
  2556. "Remove @var{key} from @var{table}. Uses @var{hash} as the hash
  2557. function. @var{assoc} is ignored and @code{equal?} is used for
  2558. equality testing."
  2559. (maybe-init-custom-hashtable table hash equal?)
  2560. (%hash-remove! 'hashx-remove! table key))
  2561. (define (hash-get-handle table key)
  2562. (raise (make-unimplemented-error 'hash-get-handle)))
  2563. (define (hashq-get-handle table key)
  2564. (raise (make-unimplemented-error 'hashq-get-handle)))
  2565. (define (hashv-get-handle table key)
  2566. (raise (make-unimplemented-error 'hashv-get-handle)))
  2567. (define (hashx-get-handle hash assoc table key)
  2568. (raise (make-unimplemented-error 'hashx-get-handle)))
  2569. (define (hash-create-handle! table key init)
  2570. (raise (make-unimplemented-error 'hash-create-handle!)))
  2571. (define (hashq-create-handle! table key init)
  2572. (raise (make-unimplemented-error 'hashq-create-handle!)))
  2573. (define (hashv-create-handle! table key init)
  2574. (raise (make-unimplemented-error 'hashv-create-handle!)))
  2575. (define (hashx-create-handle! hash assoc table key init)
  2576. (raise (make-unimplemented-error 'hashx-create-handle!)))
  2577. (define (hash-clear! table)
  2578. "Remove all items from @var{table}."
  2579. (match (hash-table-table table)
  2580. (#f (values))
  2581. (table*
  2582. (match (hash-table-type table)
  2583. ('normal (hashtable-clear! table*))
  2584. ('weak-key (raise (make-unimplemented-error 'hash-clear!)))
  2585. ('weak-value (raise (make-unimplemented-error 'hash-clear!)))
  2586. ('doubly-weak (raise (make-unimplemented-error 'hash-clear!)))))))
  2587. (define (hash-fold proc init table)
  2588. "Accumulate a result by applying @var{proc} with each key/value
  2589. association in @var{table} and the result of the previous @var{proc}
  2590. call. Each call is of the form @code{(proc key value prev)}. For the
  2591. first call, @code{prev} is the initial value @var{init}."
  2592. (match (hash-table-table table)
  2593. (#f init)
  2594. (table*
  2595. (match (hash-table-type table)
  2596. ('normal (hashtable-fold proc init table*))
  2597. ('weak-key (raise (make-unimplemented-error 'hash-fold)))
  2598. ('weak-value (raise (make-unimplemented-error 'hash-fold)))
  2599. ('doubly-weak (raise (make-unimplemented-error 'hash-fold)))))))
  2600. (define (hash-map->list proc table)
  2601. "Return an association list of key/value mappings in @var{table}."
  2602. (hash-fold (lambda (key value result)
  2603. (cons (proc key value) result))
  2604. '() table))
  2605. (define (hash-count pred table)
  2606. "Return the number of elements in @var{table} that satisfy @code{(pred
  2607. key value)}."
  2608. (hash-fold (lambda (key val count)
  2609. (if (pred key val)
  2610. (1+ count)
  2611. count))
  2612. 0 table))
  2613. (define (hash-for-each proc table)
  2614. "Apply @var{proc} to each key/value association in @var{table}.
  2615. Each call is of the form @code{(proc key value)}."
  2616. (match (hash-table-table table)
  2617. (#f (values))
  2618. (table*
  2619. (match (hash-table-type table)
  2620. ('normal (hashtable-for-each proc table*))
  2621. ('weak-key (raise (make-unimplemented-error 'hash-for-each)))
  2622. ('weak-value (raise (make-unimplemented-error 'hash-for-each)))
  2623. ('doubly-weak (raise (make-unimplemented-error 'hash-for-each)))))))
  2624. (define (hash-for-each-handle proc table)
  2625. (raise (make-unimplemented-error 'hash-for-each-handle)))
  2626. ;; Regular expressions
  2627. (define regexp/basic 'basic)
  2628. (define regexp/extended 'extended)
  2629. (define regexp/icase 'case-insensitive)
  2630. (define regexp/newline 'multiline)
  2631. (define regexp/notbol 'notbol)
  2632. (define regexp/noteol 'noteol)
  2633. ;; Sockets
  2634. (define AF_INET 'ipv4)
  2635. (define AF_INET6 'ipv6)
  2636. (define (inet-pton family address)
  2637. (define (bad-address)
  2638. (error "bad address" family address))
  2639. (define (check-u8 x)
  2640. (unless (and x (<= 0 x 255)) (bad-address))
  2641. x)
  2642. (define (check-number x)
  2643. (unless (number? x) (bad-address))
  2644. x)
  2645. (define (read-decimal port)
  2646. (check-u8
  2647. (string->number
  2648. (list->string
  2649. (let lp ()
  2650. (match (peek-char port)
  2651. ((and char (or #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
  2652. (cons (read-char port) (lp)))
  2653. (_ '())))))))
  2654. (define (hex-digit? char)
  2655. (match char
  2656. ((or #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9
  2657. #\a #\b #\c #\d #\e #\f
  2658. #\A #\B #\C #\D #\E #\F)
  2659. #t)
  2660. (_ #f)))
  2661. (define (read-hexadecimal port)
  2662. (check-number
  2663. (string->number
  2664. (list->string
  2665. (let lp ((k 0))
  2666. (match (peek-char port)
  2667. ((? hex-digit?)
  2668. (if (= k 4)
  2669. (bad-address)
  2670. (cons (read-char port) (lp (1+ k)))))
  2671. (_ '()))))
  2672. 16)))
  2673. (define (read-dot port)
  2674. (match (read-char port)
  2675. (#\. (values))
  2676. (_ (bad-address))))
  2677. (define (read-colon port)
  2678. (match (read-char port)
  2679. (#\: (values))
  2680. (_ (bad-address))))
  2681. (define (read-decimal-and-dot port)
  2682. (let ((n (read-decimal port)))
  2683. (read-dot port)
  2684. n))
  2685. (define (read-hexadecimal-and-colon port)
  2686. (let ((n (read-hexadecimal port)))
  2687. (read-colon port)
  2688. n))
  2689. (define (read-ipv6-groups port)
  2690. (define (iter)
  2691. (match (peek-char port)
  2692. ((? eof-object?) '())
  2693. ((? hex-digit?)
  2694. (let ((x (read-hexadecimal port)))
  2695. (match (read-char port)
  2696. ((? eof-object?) (list x))
  2697. (#\: (cons x (iter))))))
  2698. (#\:
  2699. (read-char port)
  2700. '())))
  2701. (match (peek-char port)
  2702. ((? eof-object?) '())
  2703. ((? hex-digit?)
  2704. (iter))
  2705. (#\:
  2706. (read-char port)
  2707. (match (read-char port)
  2708. (#\: '())
  2709. (_ (bad-address))))))
  2710. (match family
  2711. ('ipv4
  2712. (call-with-input-string address
  2713. (lambda (port)
  2714. (let ((a (read-decimal-and-dot port))
  2715. (b (read-decimal-and-dot port))
  2716. (c (read-decimal-and-dot port))
  2717. (d (read-decimal port)))
  2718. (if (eof-object? (peek-char port))
  2719. (logior (ash a 24)
  2720. (ash b 16)
  2721. (ash c 8)
  2722. d)
  2723. (bad-address))))))
  2724. ;; TODO: IPv6 addresses with embedded IPv4 address.
  2725. ('ipv6
  2726. (call-with-input-string address
  2727. (lambda (port)
  2728. (let* ((pre (read-ipv6-groups port))
  2729. (post (read-ipv6-groups port))
  2730. (pad (- 8 (+ (length pre) (length post)))))
  2731. (if (> pad 0)
  2732. (match (append pre (make-list pad 0) post)
  2733. ((a b c d e f g h)
  2734. (logior (ash a 112)
  2735. (ash b 96)
  2736. (ash c 80)
  2737. (ash d 64)
  2738. (ash e 48)
  2739. (ash f 32)
  2740. (ash g 16)
  2741. h))
  2742. (_ (bad-address)))
  2743. (bad-address)))))))))