TinyScheme Extensions Package

I created a package for LibreCMC / OpenWRT which seems to work well, though I have not had the chance yet to submit it to the official LibreCMC package repository. Here is my package commit:

https://gogs.librecmc.org/pi31415/librecmc-package-feed/commit/90ee4c484bfd46ff41358ee6668dab72985b061d

A build for for mips24_kc architecture is available here:

ftp://lavender.qlfiles.net/tinyscheme/tinyscheme-extensions_1.1-1_mips_24kc.ipk

That should install onto TPE-R1100, GL-AR150, GL-AR300M (NAND), and GL-AR300M16.

Here is a (trimmed down) sample program which comes with the TSX source code:

; load TinyScheme extension
(load-extension "/usr/lib/tinyscheme/tsx")

; get user's home dir from HOME environment var
(define homedir (getenv "HOME"))
(display "Listing contents of ") (display homedir) (newline)

; create directory stream to read dir entries
(define dirstream (open-dir-stream homedir))
(if (not dirstream)
 (begin
 (display "Unable to open home directory!! Check value of HOME environment var.")
 (quit)))

(let listentry ((entry (read-dir-entry dirstream)))
 (if (eof-object? entry)
 #t
 (begin
 (display entry)
 (newline)
 (listentry (read-dir-entry dirstream)))))

(close-dir-stream dirstream)

It lists the files in the home directory:

root@pathos:~# tinyscheme listhome.scm
Listing contents of /root
.
..
shellinabox_2.10-1_mips_24kc.ipk
luci-app-shellinabox_0.1-4_mips_24kc.ipk
tinyscheme-extensions_1.1-1_mips_24kc.ipk
tinyscheme-embedded_1.41-2_mips_24kc.ipk
srepl.scm
tinyscheme_1.41-2_mips_24kc.ipk
exercises
script.scm
zlib_1.2.11-1_mips_24kc.ipk
listhome.scm

Of course, this is a bit simpler:

(load-extension "/usr/lib/tinyscheme/tsx")
(system "ls ${HOME}")

As I mentioned previously, TinyScheme does not currently utilize ld.conf, so it is necessary to run (load-extension "/usr/lib/tinyscheme/tsx") with the full path to the TSX extension library.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s