Replace single large enum with several simple lists
This commit is contained in:
parent
55a251642f
commit
34e57d8dcc
1 changed files with 150 additions and 121 deletions
|
@ -1,62 +1,102 @@
|
|||
(define-module (sloth interface)
|
||||
#:use-module (ice-9 exceptions)
|
||||
#:use-module (oop goops)
|
||||
#:use-module (rnrs enums)
|
||||
#:use-module (sloth common)
|
||||
#:use-module (sloth ncurses)
|
||||
#:export (insertable-char->sloth-input-code
|
||||
insertable-characters
|
||||
sloth-input-code->insertable-char
|
||||
sloth-input-keys
|
||||
init-frontend))
|
||||
#:use-module (sloth ncurses))
|
||||
|
||||
(define sloth-input-keys
|
||||
(make-enumeration
|
||||
(define-public sloth-key-alphanumeric
|
||||
'(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
|
||||
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-o s-p s-q s-r s-s s-t s-u
|
||||
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
|
||||
backtick ! @ hash $ % ^ & * lparen rparen dash _
|
||||
(define-public sloth-key-punctuation
|
||||
'(backtick ! @ hash $ % ^ & * lparen rparen dash _
|
||||
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
|
||||
'(esc home end insert delete page-up page-down
|
||||
print-screen ret backspace tab space
|
||||
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
|
||||
left right up down))
|
||||
|
||||
(define-public sloth-key-s-function
|
||||
'(s-esc s-home s-end s-insert s-delete
|
||||
s-page-up s-page-down s-print-screen s-ret
|
||||
s-backspace s-tab s-space
|
||||
s-f1 s-f2 s-f3 s-f4 s-f5 s-f6 s-f7
|
||||
s-f8 s-f9 s-f10 s-f11 s-f12
|
||||
s-left s-right s-up s-down))
|
||||
|
||||
(define-public sloth-key-c-alphanumeric
|
||||
'(c-a c-b c-c c-d c-e c-f c-g c-h
|
||||
c-i c-j c-k c-l c-m c-n c-o c-p
|
||||
c-q c-r c-s c-t c-u c-v c-w c-x
|
||||
c-y c-z
|
||||
|
||||
c-q c-r c-s c-t c-u c-v c-w c-x c-y c-z
|
||||
c-s-a c-s-b c-s-c c-s-d c-s-e c-s-f c-s-g
|
||||
c-s-h c-s-i c-s-j c-s-k c-s-l c-s-m c-s-n
|
||||
c-s-o c-s-p c-s-q c-s-r c-s-s c-s-t c-s-u
|
||||
c-s-v c-s-w c-s-x c-s-y c-s-z
|
||||
c-one c-two c-three c-four c-five c-six
|
||||
c-seven c-eight c-nine c-zero
|
||||
c-~ c-backtick c-! @ c-hash c-$ c-%
|
||||
c-seven c-eight c-nine c-zero))
|
||||
|
||||
(define-public sloth-key-c-punctuation
|
||||
'(c-~ c-backtick c-! @ c-hash c-$ c-%
|
||||
c-^ c-& c-* c-lparen c-rparen c-dash
|
||||
c-_ c-lbrace c-rbrace c-lbracket c-rbracket
|
||||
c-pipe c-backslash c-/ c-? c-< c->
|
||||
c-comma c-dot c-: c-semicolon c-+ c-=
|
||||
c-apostrophe c-quote
|
||||
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-function
|
||||
'(c-esc c-home c-end c-insert c-delete c-page-up
|
||||
c-page-down c-print-screen c-ret c-backspace c-tab c-space
|
||||
c-f1 c-f2 c-f3 c-f4 c-f5 c-f6 c-f7 c-f8 c-f9
|
||||
c-f10 c-f11 c-f12
|
||||
c-left c-right c-up c-down))
|
||||
|
||||
(define-public sloth-key-c-s-function
|
||||
'(c-s-esc c-s-home c-s-end c-s-insert
|
||||
c-s-delete c-s-page-up c-s-page-down
|
||||
c-s-print-screen c-s-ret c-s-backspace
|
||||
c-s-tab
|
||||
c-s-f1 c-s-f2 c-s-f3 c-s-f4 c-s-f5
|
||||
c-s-f6 c-s-f7 c-s-f8 c-s-f9 c-s-f10
|
||||
c-s-f11 c-s-f12
|
||||
c-s-left c-s-right c-s-up c-s-down))
|
||||
|
||||
(define-public sloth-key-m-alphanumeric
|
||||
'(m-a m-b m-c m-d m-e m-f m-g m-h m-i m-j
|
||||
m-k m-l m-m m-n m-o m-p m-q m-r m-s m-t
|
||||
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-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
|
||||
m-~ m-backtick m-! @ m-hash m-$ m-% m-^ m-&
|
||||
m-eight m-nine m-zero))
|
||||
|
||||
(define-public sloth-key-m-punctuation
|
||||
'(m-~ m-backtick m-! @ m-hash m-$ m-% m-^ m-&
|
||||
m-* m-lparen m-rparen m-dash m-_ m-lbrace
|
||||
m-rbrace m-lbracket m-rbracket m-pipe m-backslash
|
||||
m-/ m-? m-< m-> m-comma m-dot m-: m-semicolon m-+ m-=
|
||||
m-apostrophe m-quote
|
||||
m-apostrophe m-quote))
|
||||
|
||||
c-m-a c-m-b c-m-c c-m-d c-m-e
|
||||
(define-public sloth-key-m-function
|
||||
'(m-esc m-home m-end m-insert m-delete m-page-up m-page-down
|
||||
m-print-screen m-ret m-backspace m-tab m-space
|
||||
m-f1 m-f2 m-f3 m-f4 m-f5 m-f6 m-f7 m-f8 m-f9 m-f10
|
||||
m-f11 m-f12
|
||||
m-left m-right m-up m-down))
|
||||
|
||||
(define-public sloth-key-c-m-alphanumeric
|
||||
'(c-m-a c-m-b c-m-c c-m-d c-m-e
|
||||
c-m-f c-m-g c-m-h c-m-i c-m-j
|
||||
c-m-k c-m-l c-m-m c-m-n c-m-o
|
||||
c-m-p c-m-q c-m-r c-m-s c-m-t
|
||||
|
@ -69,74 +109,63 @@
|
|||
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-m-~ c-m-backtick c-m-! @ c-m-hash c-m-$
|
||||
c-m-six c-m-seven c-m-eight c-m-nine c-m-zero))
|
||||
|
||||
(define-public sloth-key-c-m-punctuation
|
||||
'(c-m-~ c-m-backtick c-m-! @ c-m-hash c-m-$
|
||||
c-m-% c-m-^ c-m-& c-m-* c-m-lparen
|
||||
c-m-rparen c-m-dash c-m-_ c-m-lbrace c-m-rbrace
|
||||
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-m-: c-m-semicolon c-m-+ c-m-= c-m-apostrophe c-m-quote))
|
||||
|
||||
esc home end insert delete page-up page-down print-screen ret
|
||||
backspace tab space
|
||||
f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
|
||||
left right up down
|
||||
(define-public sloth-key-c-m-function
|
||||
'(c-m-esc c-m-home c-m-end c-m-insert c-m-delete
|
||||
c-m-page-up c-m-page-down c-m-print-screen c-m-ret
|
||||
c-m-backspace c-m-tab c-m-space
|
||||
c-m-f1 c-m-f2 c-m-f3 c-m-f4 c-m-f5 c-m-f6
|
||||
c-m-f7 c-m-f8 c-m-f9 c-m-f10 c-m-f11 c-m-f12
|
||||
c-m-left c-m-right c-m-up c-m-down))
|
||||
|
||||
s-esc s-home s-end s-insert s-delete
|
||||
s-page-up s-page-down s-print-screen s-ret
|
||||
s-backspace s-tab s-space
|
||||
s-f1 s-f2 s-f3 s-f4 s-f5 s-f6 s-f7
|
||||
s-f8 s-f9 s-f10 s-f11 s-f12
|
||||
s-left s-right s-up s-down
|
||||
|
||||
m-esc m-home m-end m-insert m-delete m-page-up m-page-down
|
||||
m-print-screen m-ret m-backspace m-tab m-space
|
||||
m-f1 m-f2 m-f3 m-f4 m-f5 m-f6 m-f7 m-f8 m-f9 m-f10
|
||||
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-m-s-function
|
||||
'(m-s-esc m-s-home m-s-end m-s-insert
|
||||
m-s-delete m-s-page-up m-s-page-down
|
||||
m-s-print-screen m-s-ret m-s-backspace m-s-tab m-s-space
|
||||
m-s-f1 m-s-f2 m-s-f3 m-s-f4 m-s-f5
|
||||
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
|
||||
m-s-left m-s-right m-s-up m-s-down))
|
||||
|
||||
c-esc c-home c-end c-insert c-delete c-page-up
|
||||
c-page-down c-print-screen c-ret c-backspace c-tab c-space
|
||||
c-f1 c-f2 c-f3 c-f4 c-f5 c-f6 c-f7 c-f8 c-f9
|
||||
c-f10 c-f11 c-f12
|
||||
c-left c-right c-up c-down
|
||||
|
||||
c-s-esc c-s-home c-s-end c-s-insert
|
||||
c-s-delete c-s-page-up c-s-page-down
|
||||
c-s-print-screen c-s-ret c-s-backspace
|
||||
c-s-tab
|
||||
c-s-f1 c-s-f2 c-s-f3 c-s-f4 c-s-f5
|
||||
c-s-f6 c-s-f7 c-s-f8 c-s-f9 c-s-f10
|
||||
c-s-f11 c-s-f12
|
||||
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
|
||||
c-m-page-up c-m-page-down c-m-print-screen c-m-ret
|
||||
c-m-backspace c-m-tab c-m-space
|
||||
c-m-f1 c-m-f2 c-m-f3 c-m-f4 c-m-f5 c-m-f6
|
||||
c-m-f7 c-m-f8 c-m-f9 c-m-f10 c-m-f11 c-m-f12
|
||||
c-m-left c-m-right c-m-up c-m-down
|
||||
|
||||
c-m-s-esc c-m-s-home c-m-s-end
|
||||
(define-public sloth-key-c-m-s-function
|
||||
'(c-m-s-esc c-m-s-home c-m-s-end
|
||||
c-m-s-insert c-m-s-delete c-m-s-page-up
|
||||
c-m-s-page-down c-m-s-print-screen c-m-s-ret
|
||||
c-m-s-backspace c-m-s-tab c-m-s-space
|
||||
c-m-s-f1 c-m-s-f2 c-m-s-f3 c-m-s-f4
|
||||
c-m-s-f5 c-m-s-f6 c-m-s-f7 c-m-s-f8
|
||||
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)))
|
||||
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
|
||||
#\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
|
||||
|
@ -153,7 +182,7 @@
|
|||
= + lbracket rbracket lbrace rbrace pipe backslash
|
||||
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
|
||||
((#\a) 'a)
|
||||
((#\b) 'b)
|
||||
|
@ -253,7 +282,7 @@
|
|||
((#\space) 'space)
|
||||
((#\tab) 'tab)))
|
||||
|
||||
(define (sloth-input-code->insertable-char code)
|
||||
(define-public (sloth-input-code->insertable-char code)
|
||||
(case code
|
||||
((a) #\a)
|
||||
((b) #\b)
|
||||
|
@ -353,7 +382,7 @@
|
|||
((space) #\space)
|
||||
((tab) #\tab)))
|
||||
|
||||
(define (init-frontend frontend)
|
||||
(define-public (init-frontend frontend)
|
||||
(case frontend
|
||||
((ncurses) (init-ncurses))
|
||||
(else (raise-exception
|
||||
|
|
Loading…
Reference in a new issue