/usr/share/scsh-0.6/scsh/enumconst.scm is in scsh-common-0.6 0.6.7-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ;;; Copyright (c) 1994 by Olin Shivers.
;;; Handy for defining random flags and constants.
;;; (define-enum-constant "errno" intr 9) => (define errno/intr 9)
;;; This is deeply bogus code. It merely serves to demonstrate what a loser
;;; I am when it comes to serious modern-tech macrology.
;;; The question: is / the best separator? Alternates: $ . |
;;; (define-enum-constant fruit apple 1) =>
;;; (define fruit/apple 1)
(define-syntax define-enum-constant
(lambda (form rename compare)
(let* ((%define (rename 'define))
(base (let ((b (cadr form)))
(cond ((string? b) b)
((symbol? b) (symbol->string b))
(else (error "Enum constant base must be symbol or string"
b )))))
(var (string->symbol (string-append base "/"
(symbol->string (caddr form)))))
(value (cadddr form)))
`(,%define ,var ,value))))
;;; (define-enum-constants fruit (apple 1) (orange 2))
;;; => (begin (define-enum-constant fruit apple 1)
;;; (define-enum-constant fruit orange 2))
(define-syntax define-enum-constants
(syntax-rules ()
((define-enum-constants set (elt val) ...)
(begin (define-enum-constant set elt val) ...))))
(define-syntax define-enum-constants-from-x
(syntax-rules
()
((define-enum-constants-from-zero x set ())
(begin))
((define-enum-constants-from-zero x set (elt1 elt2 ...))
(begin (define-enum-constant set elt1 x)
(define-enum-constants-from-x (+ x 1) set (elt2 ...))))))
(define-syntax define-enum-constants-from-zero
(syntax-rules
()
((define-enum-constants-from-zero set (elt ...))
(define-enum-constants-from-x 0 set (elt ...)))))
|