2020-08-06 04:51:30 -04:00
|
|
|
(import (scheme base) (scheme char) (scheme file)
|
|
|
|
(scheme read) (scheme write))
|
2020-08-05 05:39:36 -04:00
|
|
|
(import (srfi 132))
|
2020-08-05 03:03:43 -04:00
|
|
|
|
|
|
|
(define (read-all)
|
|
|
|
(let loop ((xs '()))
|
|
|
|
(let ((x (read)))
|
|
|
|
(if (eof-object? x) (reverse xs) (loop (cons x xs))))))
|
|
|
|
|
|
|
|
(define (group head xs)
|
|
|
|
(define (eject gs g) (if (null? g) gs (cons (reverse g) gs)))
|
|
|
|
(let loop ((xs xs) (gs '()) (g '()))
|
|
|
|
(cond ((null? xs)
|
|
|
|
(reverse (eject gs g)))
|
|
|
|
((and (pair? (car xs)) (equal? head (caar xs)))
|
|
|
|
(loop (cdr xs) (eject gs g) (list (car xs))))
|
|
|
|
(else
|
|
|
|
(loop (cdr xs) gs (cons (car xs) g))))))
|
|
|
|
|
2020-08-05 05:39:36 -04:00
|
|
|
(define (group-file head filename)
|
|
|
|
(group head (with-input-from-file filename read-all)))
|
|
|
|
|
|
|
|
(define (assoc? key alist)
|
|
|
|
(let ((x (assoc key alist)))
|
|
|
|
(cond ((not x) #f)
|
|
|
|
((and (list? x) (= 2 (length x))) (cadr x))
|
|
|
|
(else (error "Nope")))))
|
|
|
|
|
2020-08-05 03:03:43 -04:00
|
|
|
(define (assoc1 key alist)
|
|
|
|
(let ((x (assoc key alist)))
|
|
|
|
(if (and (list? x) (= 2 (length x))) (cadr x) (error "Nope"))))
|
|
|
|
|
|
|
|
(define (display-sxml x)
|
|
|
|
(define (display* . xs) (for-each display xs))
|
2020-08-05 05:39:36 -04:00
|
|
|
(define (display-char char)
|
|
|
|
(let* ((cc (char->integer char))
|
|
|
|
(ok? (case char ((#\& #\< #\> #\") #f) (else (<= #x20 cc #x7e)))))
|
|
|
|
(if ok? (display char) (display* "&#" cc ";"))))
|
2020-08-05 03:03:43 -04:00
|
|
|
(define (display-attribute attribute)
|
2020-08-05 05:39:36 -04:00
|
|
|
(display* " " (car attribute) "=\"")
|
|
|
|
(string-for-each display-char (cadr attribute))
|
|
|
|
(display "\""))
|
2020-08-05 03:03:43 -04:00
|
|
|
(cond ((pair? x)
|
|
|
|
(display* "<" (car x))
|
|
|
|
(let ((body (cond ((and (pair? (cdr x))
|
|
|
|
(pair? (cadr x))
|
|
|
|
(eq? '@ (car (cadr x))))
|
|
|
|
(for-each display-attribute (cdr (cadr x)))
|
|
|
|
(cddr x))
|
|
|
|
(else (cdr x)))))
|
|
|
|
(display ">")
|
|
|
|
(for-each display-sxml body)
|
|
|
|
(display* "</" (car x) ">")))
|
|
|
|
((string? x)
|
2020-08-05 05:39:36 -04:00
|
|
|
(string-for-each display-char x))
|
|
|
|
(else (error "Bad:" x))))
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
(define (sort-by-id entries)
|
|
|
|
(list-sort (lambda (a b)
|
|
|
|
(string<? (symbol->string (assoc1 'id a))
|
|
|
|
(symbol->string (assoc1 'id b))))
|
|
|
|
entries))
|
|
|
|
|
2020-08-06 16:46:25 -04:00
|
|
|
(define (sort-by-string-id entries)
|
|
|
|
(list-sort (lambda (a b) (string<? (assoc1 'id a) (assoc1 'id b)))
|
|
|
|
entries))
|
|
|
|
|
2020-08-05 05:39:36 -04:00
|
|
|
(define (classify class entries)
|
|
|
|
(map (lambda (entry) `((class ,class) ,@entry))
|
|
|
|
entries))
|
|
|
|
|
|
|
|
(define (tabulate column-headings rows)
|
|
|
|
`(table (tr ,@(map (lambda (heading) `(th ,heading))
|
|
|
|
column-headings))
|
|
|
|
,@(map (lambda (row)
|
|
|
|
(let ((class (car row))
|
2020-08-06 04:51:30 -04:00
|
|
|
(tds (map (lambda (column heading)
|
|
|
|
`(td (@ (class
|
|
|
|
,(string-append
|
|
|
|
"p-"
|
|
|
|
(string-downcase heading))))
|
|
|
|
,column))
|
|
|
|
(cdr row)
|
|
|
|
column-headings)))
|
|
|
|
`(tr (@ (class ,(if class
|
|
|
|
(string-append "h-x-entry" " " class)
|
|
|
|
"h-x-entry")))
|
|
|
|
,@tds)))
|
2020-08-05 05:39:36 -04:00
|
|
|
rows)))
|
2020-08-05 03:03:43 -04:00
|
|
|
|
2020-08-05 05:57:31 -04:00
|
|
|
(define (the-usual entry)
|
|
|
|
(cons (assoc? 'class entry)
|
|
|
|
`((code ,(symbol->string (assoc1 'id entry)))
|
|
|
|
,(assoc1 'description entry))))
|
|
|
|
|
2020-08-06 04:51:30 -04:00
|
|
|
(define (registry registry-title registry-id intro table)
|
|
|
|
`(section
|
|
|
|
(@ (class "h-x-registry")
|
|
|
|
(data-p-id ,registry-id))
|
|
|
|
(h2 (@ (class "p-title"))
|
|
|
|
,registry-title)
|
|
|
|
(p "Registry ID: " (code (@ (class "p-id")) ,registry-id))
|
|
|
|
,intro
|
|
|
|
,table))
|
|
|
|
|
2020-08-05 03:03:43 -04:00
|
|
|
;;
|
|
|
|
|
|
|
|
(define (scheme-id)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Scheme implementations"
|
|
|
|
"scheme-id"
|
|
|
|
'(p "Scheme IDs for use in "
|
2020-08-05 05:39:36 -04:00
|
|
|
(code "features") ", " (code "cond-expand") ", and many other places.")
|
2020-08-06 04:51:30 -04:00
|
|
|
(tabulate
|
|
|
|
'("ID" "Name" "Contact")
|
|
|
|
(map (lambda (entry)
|
|
|
|
(append (the-usual entry) (list (assoc1 'contact entry))))
|
|
|
|
(sort-by-id (group-file 'id "scheme-id.scm"))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (operating-system)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Operating systems"
|
|
|
|
"operating-system"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map the-usual (sort-by-id (group-file 'id "operating-system.scm"))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (machine)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Machines"
|
|
|
|
"machine"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map the-usual (sort-by-id (group-file 'id "machine.scm"))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (splice-implementations)
|
2020-08-05 05:51:41 -04:00
|
|
|
(classify "red" (group-file 'id "scheme-id.scm")))
|
|
|
|
|
|
|
|
(define (splice-operating-systems)
|
|
|
|
(classify "green" (group-file 'id "operating-system.scm")))
|
|
|
|
|
|
|
|
(define (splice-machines)
|
|
|
|
(classify "blue" (group-file 'id "machine.scm")))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (feature)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Feature identifiers"
|
|
|
|
"features"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map the-usual (sort-by-id (append (group-file 'id "features.scm")
|
|
|
|
(splice-implementations)
|
|
|
|
(splice-operating-systems)
|
|
|
|
(splice-machines)))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (library-name)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Library name prefixes"
|
|
|
|
"library-name"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map the-usual (sort-by-id
|
|
|
|
(append (group-file 'id "library-name.scm")
|
|
|
|
(splice-implementations)))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
2020-08-06 16:54:00 -04:00
|
|
|
(define (character-name)
|
|
|
|
(registry
|
2020-08-07 04:32:00 -04:00
|
|
|
"#\\ character names"
|
2020-08-06 16:54:00 -04:00
|
|
|
"character-name"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map the-usual (sort-by-id (group-file 'id "character-name.scm"))))))
|
|
|
|
|
2020-08-06 16:46:25 -04:00
|
|
|
(define (hash-syntax)
|
|
|
|
(registry
|
|
|
|
"# lexical syntax"
|
|
|
|
"hash-syntax"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map (lambda (entry)
|
|
|
|
(cons (assoc? 'class entry)
|
|
|
|
`((code ,(assoc1 'id entry))
|
|
|
|
,(assoc1 'description entry))))
|
|
|
|
(sort-by-string-id (group-file 'id "hash-syntax.scm"))))))
|
|
|
|
|
2020-08-06 15:31:53 -04:00
|
|
|
(define (hash-bang-syntax)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
2020-08-06 15:31:53 -04:00
|
|
|
"#! lexical syntax"
|
|
|
|
"hash-bang-syntax"
|
2020-08-06 04:51:30 -04:00
|
|
|
'(p)
|
|
|
|
(tabulate
|
2020-08-06 15:31:53 -04:00
|
|
|
'("ID" "Description")
|
2020-08-06 16:46:25 -04:00
|
|
|
(map the-usual (sort-by-id (group-file 'id "hash-bang-syntax.scm"))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (foreign-status-set)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Foreign status sets"
|
|
|
|
"foreign-status-set"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description")
|
|
|
|
(map the-usual
|
|
|
|
(sort-by-id (group-file 'id "foreign-status-set.scm"))))))
|
2020-08-05 05:39:36 -04:00
|
|
|
|
|
|
|
(define (foreign-status-property)
|
2020-08-06 04:51:30 -04:00
|
|
|
(registry
|
|
|
|
"Foreign status properties"
|
|
|
|
"foreign-status-property"
|
|
|
|
'(p)
|
|
|
|
(tabulate
|
|
|
|
'("ID" "Description" "Type")
|
|
|
|
(map (lambda (entry)
|
|
|
|
(append (the-usual entry) (list (assoc1 'type entry))))
|
|
|
|
(group-file 'id "foreign-status-property.scm")))))
|
2020-08-05 03:03:43 -04:00
|
|
|
|
|
|
|
(define (display-page)
|
2020-08-07 09:13:47 -04:00
|
|
|
(display (string-append
|
|
|
|
"<!doctype html>"
|
|
|
|
"<!-- SPDX-License-Identifier: CC0-1.0 -->"
|
|
|
|
"<!-- This page uses https://microformats.org/wiki/microformats2"
|
|
|
|
" tagging and can be parsed by machine. -->"))
|
2020-08-05 03:03:43 -04:00
|
|
|
(display-sxml
|
|
|
|
`(html
|
2020-08-05 06:03:51 -04:00
|
|
|
(@ (lang "en"))
|
2020-08-05 03:03:43 -04:00
|
|
|
(head
|
2020-08-05 05:39:36 -04:00
|
|
|
(title "Scheme Registry")
|
|
|
|
(style ""
|
2020-08-07 04:32:25 -04:00
|
|
|
"body { font-family: sans-serif; background-color: beige;"
|
|
|
|
" max-width: 40em; margin: 12px; }"
|
2020-08-05 05:39:36 -04:00
|
|
|
"table { border-collapse: collapse; }"
|
2020-08-05 03:03:43 -04:00
|
|
|
"table, th, td { border: 1px solid black; }"
|
2020-08-05 05:39:36 -04:00
|
|
|
"th, td { vertical-align: top; padding: 2px; }"
|
|
|
|
"code { white-space: nowrap; }"
|
|
|
|
"tr.red td { background-color: sandybrown; }"
|
|
|
|
"tr.green td { background-color: lightgreen; }"
|
|
|
|
"tr.blue td { background-color: lightblue; }"
|
2020-08-07 04:32:36 -04:00
|
|
|
".intro { background-color: lightyellow; padding: 12px;"
|
|
|
|
" border: 1px solid gray; border-radius: 10px; }"
|
2020-08-05 05:39:36 -04:00
|
|
|
))
|
2020-08-05 03:03:43 -04:00
|
|
|
(body
|
2020-08-05 05:39:36 -04:00
|
|
|
(h1 "Scheme Registry")
|
2020-08-07 04:32:36 -04:00
|
|
|
(p (@ (class "intro")) "A catalog of the defined symbols,"
|
|
|
|
" identifiers and other pieces of data used by Scheme"
|
|
|
|
" standards and implementations.")
|
|
|
|
(p "Administration happens on the " (code "schemeregistry")
|
|
|
|
" mailing list ("
|
|
|
|
(a (@ (href "https://srfi-email.schemers.org/schemeregistry/"))
|
|
|
|
"archives")
|
|
|
|
", "
|
|
|
|
(a (@ (href ,(string-append
|
|
|
|
"https://srfi.schemers.org/srfi-list-subscribe.html"
|
|
|
|
"#schemeregistry")))
|
|
|
|
"subscribe")
|
|
|
|
"). Feel free to suggest additions and corrections there."
|
|
|
|
" Source is in a "
|
|
|
|
(a (@ (href "https://github.com/srfi-explorations/registry"))
|
|
|
|
"git repository") ".")
|
2020-08-06 04:51:30 -04:00
|
|
|
,(scheme-id)
|
|
|
|
,(operating-system)
|
|
|
|
,(machine)
|
|
|
|
,(feature)
|
|
|
|
,(library-name)
|
2020-08-06 16:54:00 -04:00
|
|
|
,(character-name)
|
2020-08-06 16:46:25 -04:00
|
|
|
,(hash-syntax)
|
2020-08-06 15:31:53 -04:00
|
|
|
,(hash-bang-syntax)
|
2020-08-06 04:51:30 -04:00
|
|
|
,(foreign-status-set)
|
|
|
|
,(foreign-status-property)))))
|
2020-08-05 03:03:43 -04:00
|
|
|
|
|
|
|
(with-output-to-file "index.html" display-page)
|