Simple utility to turn swipes into words -- "plugin" for wvkbd to enable swipe-typing under wayland SXMO.
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
PREFIX?=/usr/local

all: swipeGuess mapScore docs words-qwerty-en
swipeGuess: swipeGuess.c
	$(CC) swipeGuess.c -o swipeGuess
mapScore: mapScore.c
	$(CC) mapScore.c -o mapScore
docs: swipeGuess.1 mapScore.1
swipeGuess.1: swipeGuess.1.scd
	scdoc < swipeGuess.1.scd > $@.tmp
	mv $@.tmp $@
mapScore.1: mapScore.1.scd
	scdoc < mapScore.1.scd > $@.tmp
	mv $@.tmp $@

words-qwerty-en: /usr/share/dict/american-english mapScore
	grep ..  /usr/share/dict/american-english | ./mapScore map.qwerty.noapos.tsv bee  | sort -nr | cut -f2 > words-qwerty-en
/usr/share/dict/american-english:
	apk add words-en

test: words-qwerty-en swipeGuess
	test "`echo "asdfghjkl" | ./swipeGuess words-qwerty-en`" = "all"
	test "`echo "dfghuiokmnhyt" | ./swipeGuess words-qwerty-en 1 "'"`" = "don't"
	test "`echo "tyuiopoiuytrewertyuiuytrer" | ./swipeGuess words-qwerty-en 2`" = "`printf "typewriter\ttorturer"`"

install: all
	install -m755 swipeGuess -D -t "$(DESTDIR)/$(PREFIX)/bin/"
	install -m755 mapScore -D -t "$(DESTDIR)/$(PREFIX)/bin/"
	install -m644 swipeGuess.1 -D -t "$(DESTDIR)/$(PREFIX)/share/man/man1/"
	install -m644 mapScore.1 -D -t "$(DESTDIR)/$(PREFIX)/share/man/man1/"
	install -m644 words-qwerty-en -D -t "$(DESTDIR)/$(PREFIX)/share/swipeGuess/words/"
uninstall:
	rm -f "$(DESTDIR)/$(PREFIX)/bin/swipeGuess"
	rm -f "$(DESTDIR)/$(PREFIX)/bin/mapScore"
	rm -f "$(DESTDIR)/$(PREFIX)/share/man/man1/swipeGuess.1"
	rm -f "$(DESTDIR)/$(PREFIX)/share/man/man1/mapScore.1"
	rm -f "$(DESTDIR)/$(PREFIX)/share/swipeGuess/words/words-qwerty-en"