Replace single large enum with several simple lists

This commit is contained in:
Skylar Hill 2023-11-09 22:02:48 -06:00
parent 55a251642f
commit 34e57d8dcc

View file

@ -1,142 +1,171 @@
(define-module (sloth interface) (define-module (sloth interface)
#:use-module (ice-9 exceptions) #:use-module (ice-9 exceptions)
#:use-module (oop goops) #:use-module (oop goops)
#:use-module (rnrs enums)
#:use-module (sloth common) #:use-module (sloth common)
#:use-module (sloth ncurses) #:use-module (sloth ncurses))
#:export (insertable-char->sloth-input-code
insertable-characters
sloth-input-code->insertable-char
sloth-input-keys
init-frontend))
(define sloth-input-keys (define-public sloth-key-alphanumeric
(make-enumeration '(a b c d e f g h i j k l m n o
'(a b c d e f g h i j k l m n o p q r s t u v w x y z
p q r s t u v w x y z s-a s-b s-c s-d s-e s-f s-g
s-a s-b s-c s-d s-e s-f s-g s-h s-i s-j s-k s-l s-m s-n
s-h s-i s-j s-k s-l s-m s-n s-o s-p s-q s-r s-s s-t s-u
s-o s-p s-q s-r s-s s-t s-u s-v s-w s-x s-y s-z
s-v s-w s-x s-y s-z one two three four five six seven
eight nine zero))
one two three four five six seven eight nine zero (define-public sloth-key-punctuation
backtick ! @ hash $ % ^ & * lparen rparen dash _ '(backtick ! @ hash $ % ^ & * lparen rparen dash _
lbrace rbrace lbracket rbracket pipe backslash / ? lbrace rbrace lbracket rbracket pipe backslash / ?
< > comma dot : semicolon + = apostrophe quote < > comma dot : semicolon + = apostrophe quote))
c-a c-b c-c c-d c-e c-f c-g c-h (define-public sloth-key-function
c-i c-j c-k c-l c-m c-n c-o c-p '(esc home end insert delete page-up page-down
c-q c-r c-s c-t c-u c-v c-w c-x print-screen ret backspace tab space
c-y c-z f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
left right up down))
c-one c-two c-three c-four c-five c-six (define-public sloth-key-s-function
c-seven c-eight c-nine c-zero '(s-esc s-home s-end s-insert s-delete
c-~ c-backtick c-! @ c-hash c-$ c-% s-page-up s-page-down s-print-screen s-ret
c-^ c-& c-* c-lparen c-rparen c-dash s-backspace s-tab s-space
c-_ c-lbrace c-rbrace c-lbracket c-rbracket s-f1 s-f2 s-f3 s-f4 s-f5 s-f6 s-f7
c-pipe c-backslash c-/ c-? c-< c-> s-f8 s-f9 s-f10 s-f11 s-f12
c-comma c-dot c-: c-semicolon c-+ c-= s-left s-right s-up s-down))
c-apostrophe c-quote
m-a m-b m-c m-d m-e m-f m-g m-h m-i m-j (define-public sloth-key-c-alphanumeric
m-k m-l m-m m-n m-o m-p m-q m-r m-s m-t '(c-a c-b c-c c-d c-e c-f c-g c-h
m-u m-v m-w m-x m-y m-z c-i c-j c-k c-l c-m c-n c-o c-p
m-s-a m-s-b m-s-c m-s-d m-s-e c-q c-r c-s c-t c-u c-v c-w c-x c-y c-z
m-s-f m-s-g m-s-h m-s-i m-s-j c-s-a c-s-b c-s-c c-s-d c-s-e c-s-f c-s-g
m-s-k m-s-l m-s-m m-s-n m-s-o c-s-h c-s-i c-s-j c-s-k c-s-l c-s-m c-s-n
m-s-p m-s-q m-s-r m-s-s m-s-t c-s-o c-s-p c-s-q c-s-r c-s-s c-s-t c-s-u
m-s-u m-s-v m-s-w m-s-x m-s-y c-s-v c-s-w c-s-x c-s-y c-s-z
m-s-z c-one c-two c-three c-four c-five c-six
c-seven c-eight c-nine c-zero))
m-one m-two m-three m-four m-five m-six m-seven (define-public sloth-key-c-punctuation
m-eight m-nine m-zero '(c-~ c-backtick c-! @ c-hash c-$ c-%
m-~ m-backtick m-! @ m-hash m-$ m-% m-^ m-& c-^ c-& c-* c-lparen c-rparen c-dash
m-* m-lparen m-rparen m-dash m-_ m-lbrace c-_ c-lbrace c-rbrace c-lbracket c-rbracket
m-rbrace m-lbracket m-rbracket m-pipe m-backslash c-pipe c-backslash c-/ c-? c-< c->
m-/ m-? m-< m-> m-comma m-dot m-: m-semicolon m-+ m-= c-comma c-dot c-: c-semicolon c-+ c-=
m-apostrophe m-quote c-apostrophe c-quote))
c-m-a c-m-b c-m-c c-m-d c-m-e (define-public sloth-key-c-function
c-m-f c-m-g c-m-h c-m-i c-m-j '(c-esc c-home c-end c-insert c-delete c-page-up
c-m-k c-m-l c-m-m c-m-n c-m-o c-page-down c-print-screen c-ret c-backspace c-tab c-space
c-m-p c-m-q c-m-r c-m-s c-m-t c-f1 c-f2 c-f3 c-f4 c-f5 c-f6 c-f7 c-f8 c-f9
c-m-u c-m-v c-m-w c-m-x c-m-y c-f10 c-f11 c-f12
c-m-z c-left c-right c-up c-down))
c-m-s-a c-m-s-b c-m-s-c c-m-s-d
c-m-s-e c-m-s-f c-m-s-g c-m-s-h
c-m-s-i c-m-s-j c-m-s-k c-m-s-l
c-m-s-m c-m-s-n c-m-s-o c-m-s-p
c-m-s-q c-m-s-r c-m-s-s c-m-s-t
c-m-s-u c-m-s-v c-m-s-w c-m-s-x
c-m-s-y c-m-s-z
c-m-one c-m-two c-m-three c-m-four c-m-five (define-public sloth-key-c-s-function
c-m-six c-m-seven c-m-eight c-m-nine c-m-zero '(c-s-esc c-s-home c-s-end c-s-insert
c-m-~ c-m-backtick c-m-! @ c-m-hash c-m-$ c-s-delete c-s-page-up c-s-page-down
c-m-% c-m-^ c-m-& c-m-* c-m-lparen c-s-print-screen c-s-ret c-s-backspace
c-m-rparen c-m-dash c-m-_ c-m-lbrace c-m-rbrace c-s-tab
c-m-lbracket c-m-rbracket c-m-pipe c-m-backslash c-s-f1 c-s-f2 c-s-f3 c-s-f4 c-s-f5
c-m-/ c-m-? c-m-< c-m-> c-m-comma c-m-dot c-s-f6 c-s-f7 c-s-f8 c-s-f9 c-s-f10
c-m-: c-m-semicolon c-m-+ c-m-= c-m-apostrophe c-m-quote c-s-f11 c-s-f12
c-s-left c-s-right c-s-up c-s-down))
esc home end insert delete page-up page-down print-screen ret (define-public sloth-key-m-alphanumeric
backspace tab space '(m-a m-b m-c m-d m-e m-f m-g m-h m-i m-j
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 m-k m-l m-m m-n m-o m-p m-q m-r m-s m-t
left right up down m-u m-v m-w m-x m-y m-z
m-s-a m-s-b m-s-c m-s-d m-s-e
m-s-f m-s-g m-s-h m-s-i m-s-j
m-s-k m-s-l m-s-m m-s-n m-s-o
m-s-p m-s-q m-s-r m-s-s m-s-t
m-s-u m-s-v m-s-w m-s-x m-s-y m-s-z
m-one m-two m-three m-four m-five m-six m-seven
m-eight m-nine m-zero))
s-esc s-home s-end s-insert s-delete (define-public sloth-key-m-punctuation
s-page-up s-page-down s-print-screen s-ret '(m-~ m-backtick m-! @ m-hash m-$ m-% m-^ m-&
s-backspace s-tab s-space m-* m-lparen m-rparen m-dash m-_ m-lbrace
s-f1 s-f2 s-f3 s-f4 s-f5 s-f6 s-f7 m-rbrace m-lbracket m-rbracket m-pipe m-backslash
s-f8 s-f9 s-f10 s-f11 s-f12 m-/ m-? m-< m-> m-comma m-dot m-: m-semicolon m-+ m-=
s-left s-right s-up s-down m-apostrophe m-quote))
m-esc m-home m-end m-insert m-delete m-page-up m-page-down (define-public sloth-key-m-function
m-print-screen m-ret m-backspace m-tab m-space '(m-esc m-home m-end m-insert m-delete m-page-up m-page-down
m-f1 m-f2 m-f3 m-f4 m-f5 m-f6 m-f7 m-f8 m-f9 m-f10 m-print-screen m-ret m-backspace m-tab m-space
m-f11 m-f12 m-f1 m-f2 m-f3 m-f4 m-f5 m-f6 m-f7 m-f8 m-f9 m-f10
m-left m-right m-up m-down m-f11 m-f12
m-left m-right m-up m-down))
m-s-esc m-s-home m-s-end m-s-insert (define-public sloth-key-c-m-alphanumeric
m-s-delete m-s-page-up m-s-page-down '(c-m-a c-m-b c-m-c c-m-d c-m-e
m-s-print-screen m-s-ret m-s-backspace m-s-tab m-s-space c-m-f c-m-g c-m-h c-m-i c-m-j
m-s-f1 m-s-f2 m-s-f3 m-s-f4 m-s-f5 c-m-k c-m-l c-m-m c-m-n c-m-o
m-s-f6 m-s-f7 m-s-f8 m-s-f9 m-s-f10 c-m-p c-m-q c-m-r c-m-s c-m-t
m-s-f11 m-s-f12 c-m-u c-m-v c-m-w c-m-x c-m-y
m-s-left m-s-right m-s-up m-s-down c-m-z
c-m-s-a c-m-s-b c-m-s-c c-m-s-d
c-m-s-e c-m-s-f c-m-s-g c-m-s-h
c-m-s-i c-m-s-j c-m-s-k c-m-s-l
c-m-s-m c-m-s-n c-m-s-o c-m-s-p
c-m-s-q c-m-s-r c-m-s-s c-m-s-t
c-m-s-u c-m-s-v c-m-s-w c-m-s-x
c-m-s-y c-m-s-z
c-m-one c-m-two c-m-three c-m-four c-m-five
c-m-six c-m-seven c-m-eight c-m-nine c-m-zero))
c-esc c-home c-end c-insert c-delete c-page-up (define-public sloth-key-c-m-punctuation
c-page-down c-print-screen c-ret c-backspace c-tab c-space '(c-m-~ c-m-backtick c-m-! @ c-m-hash c-m-$
c-f1 c-f2 c-f3 c-f4 c-f5 c-f6 c-f7 c-f8 c-f9 c-m-% c-m-^ c-m-& c-m-* c-m-lparen
c-f10 c-f11 c-f12 c-m-rparen c-m-dash c-m-_ c-m-lbrace c-m-rbrace
c-left c-right c-up c-down c-m-lbracket c-m-rbracket c-m-pipe c-m-backslash
c-m-/ c-m-? c-m-< c-m-> c-m-comma c-m-dot
c-m-: c-m-semicolon c-m-+ c-m-= c-m-apostrophe c-m-quote))
c-s-esc c-s-home c-s-end c-s-insert (define-public sloth-key-c-m-function
c-s-delete c-s-page-up c-s-page-down '(c-m-esc c-m-home c-m-end c-m-insert c-m-delete
c-s-print-screen c-s-ret c-s-backspace c-m-page-up c-m-page-down c-m-print-screen c-m-ret
c-s-tab c-m-backspace c-m-tab c-m-space
c-s-f1 c-s-f2 c-s-f3 c-s-f4 c-s-f5 c-m-f1 c-m-f2 c-m-f3 c-m-f4 c-m-f5 c-m-f6
c-s-f6 c-s-f7 c-s-f8 c-s-f9 c-s-f10 c-m-f7 c-m-f8 c-m-f9 c-m-f10 c-m-f11 c-m-f12
c-s-f11 c-s-f12 c-m-left c-m-right c-m-up c-m-down))
c-s-left c-s-right c-s-up c-s-down
c-m-esc c-m-home c-m-end c-m-insert c-m-delete (define-public sloth-key-m-s-function
c-m-page-up c-m-page-down c-m-print-screen c-m-ret '(m-s-esc m-s-home m-s-end m-s-insert
c-m-backspace c-m-tab c-m-space m-s-delete m-s-page-up m-s-page-down
c-m-f1 c-m-f2 c-m-f3 c-m-f4 c-m-f5 c-m-f6 m-s-print-screen m-s-ret m-s-backspace m-s-tab m-s-space
c-m-f7 c-m-f8 c-m-f9 c-m-f10 c-m-f11 c-m-f12 m-s-f1 m-s-f2 m-s-f3 m-s-f4 m-s-f5
c-m-left c-m-right c-m-up c-m-down m-s-f6 m-s-f7 m-s-f8 m-s-f9 m-s-f10
m-s-f11 m-s-f12
m-s-left m-s-right m-s-up m-s-down))
c-m-s-esc c-m-s-home c-m-s-end (define-public sloth-key-c-m-s-function
c-m-s-insert c-m-s-delete c-m-s-page-up '(c-m-s-esc c-m-s-home c-m-s-end
c-m-s-page-down c-m-s-print-screen c-m-s-ret c-m-s-insert c-m-s-delete c-m-s-page-up
c-m-s-backspace c-m-s-tab c-m-s-space c-m-s-page-down c-m-s-print-screen c-m-s-ret
c-m-s-f1 c-m-s-f2 c-m-s-f3 c-m-s-f4 c-m-s-backspace c-m-s-tab c-m-s-space
c-m-s-f5 c-m-s-f6 c-m-s-f7 c-m-s-f8 c-m-s-f1 c-m-s-f2 c-m-s-f3 c-m-s-f4
c-m-s-f9 c-m-s-f10 c-m-s-f11 c-m-s-f12 c-m-s-f5 c-m-s-f6 c-m-s-f7 c-m-s-f8
c-m-s-left c-m-s-right c-m-s-up c-m-s-down))) c-m-s-f9 c-m-s-f10 c-m-s-f11 c-m-s-f12
c-m-s-left c-m-s-right c-m-s-up c-m-s-down))
(define insertable-characters (define-public sloth-keys
(append sloth-key-alphanumeric
sloth-key-punctuation
sloth-key-function
sloth-key-s-function
sloth-key-c-alphanumeric
sloth-key-c-punctuation
sloth-key-c-function
sloth-key-c-s-function
sloth-key-m-alphanumeric
sloth-key-m-punctuation
sloth-key-m-function
sloth-key-c-m-alphanumeric
sloth-key-c-m-punctuation
sloth-key-c-m-function
sloth-key-m-s-function
sloth-key-c-m-s-function))
(define-public insertable-characters
'(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m '(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m
#\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z
#\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M #\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M
@ -153,7 +182,7 @@
= + lbracket rbracket lbrace rbrace pipe backslash = + lbracket rbracket lbrace rbrace pipe backslash
semicolon : apostrophe quote comma < > dot / ? ret space tab)) semicolon : apostrophe quote comma < > dot / ? ret space tab))
(define (insertable-char->sloth-input-code char) (define-public (insertable-char->sloth-input-code char)
(case char (case char
((#\a) 'a) ((#\a) 'a)
((#\b) 'b) ((#\b) 'b)
@ -253,7 +282,7 @@
((#\space) 'space) ((#\space) 'space)
((#\tab) 'tab))) ((#\tab) 'tab)))
(define (sloth-input-code->insertable-char code) (define-public (sloth-input-code->insertable-char code)
(case code (case code
((a) #\a) ((a) #\a)
((b) #\b) ((b) #\b)
@ -353,7 +382,7 @@
((space) #\space) ((space) #\space)
((tab) #\tab))) ((tab) #\tab)))
(define (init-frontend frontend) (define-public (init-frontend frontend)
(case frontend (case frontend
((ncurses) (init-ncurses)) ((ncurses) (init-ncurses))
(else (raise-exception (else (raise-exception