Skip to content

Commit

Permalink
Script for generating "display-name" metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
bertfrees committed Apr 12, 2018
1 parent b8e551b commit 84f9dbf
Show file tree
Hide file tree
Showing 9 changed files with 571 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,16 @@ output.txt
/windows/utils/Makefile
/windows/utils/Makefile.in

# /extra/generate-display-names

/extra/generate-display-names/.go-packages/
/extra/generate-display-names/.libs/
/extra/generate-display-names/displayLanguage.a
/extra/generate-display-names/displayLanguage.h
/extra/generate-display-names/generate
/extra/generate-display-names/generate.o
/extra/generate-display-names/generate.log

# stuff for local development
local/
local
10 changes: 9 additions & 1 deletion .travis/script/gcc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
./autogen.sh &&
./configure $ENABLE_UCS4 --with-yaml &&
make &&
make check
make check &&
# check display names
if [[ -n ${ENABLE_UCS4+x} ]]; then
cd extra/generate-display-names &&
if ! make; then
cat generate.log
false
fi
fi
23 changes: 23 additions & 0 deletions extra/generate-display-names/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CC := gcc
DISPLAY_NAMES_FILE := display-names

export LOUIS_TABLEPATH = $(CURDIR)/../../tables
export GOPATH = $(CURDIR)/.go-packages

.PHONY : check
check : generate
./$< $(DISPLAY_NAMES_FILE) >$<.log 2>$<.log

generate : generate.o displayLanguage.a ../../liblouis/liblouis.la
../../libtool --tag=CC --mode=link $(CC) -o $@ $^ -lpthread

generate.o : generate.c displayLanguage.h
$(CC) -I. -I../../liblouis -g -O2 -c -o $@ $<

displayLanguage.a displayLanguage.h : displayLanguage.go
go get golang.org/x/text/language/display
go build -buildmode=c-archive $<

.PHONY : clean
clean :
rm -rf displayLanguage.a displayLanguage.h $(GOPATH)
126 changes: 126 additions & 0 deletions extra/generate-display-names/display-names
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
* ../../tables/afr-za-g1.ctb Afrikaans braille
* ../../tables/ar.tbl Arabic braille
* ../../tables/as.tbl Assamese braille
* ../../tables/awa.tbl Awadhi braille
* ../../tables/bg.tbl Bulgarian computer braille
* ../../tables/bh.tbl Bihari braille
* ../../tables/bn.tbl Bengali braille
* ../../tables/bo.tbl Tibetan computer braille
* ../../tables/bra.tbl Braj braille
* ../../tables/ca.tbl Catalan braille
* ../../tables/chr-us-g1.ctb Cherokee braille
* ../../tables/ckb.tbl Kurdish braille
* ../../tables/cs.tbl Czech braille
* ../../tables/cy-cy-g1.utb Welsh uncontracted braille
* ../../tables/cy.tbl Welsh contracted braille
* ../../tables/da-dk-g08.ctb Danish computer braille
* ../../tables/da-dk-g16-lit.ctb Danish 6-dot uncontracted braille
* ../../tables/da-dk-g16.ctb Danish 6-dot uncontracted braille
* ../../tables/da-dk-g18.ctb Danish 8-dot uncontracted braille
* ../../tables/da-dk-g26-lit.ctb Danish 6-dot fully contracted braille
* ../../tables/da-dk-g26.ctb Danish 6-dot fully contracted braille
* ../../tables/da-dk-g26l-lit.ctb Danish 6-dot partially contracted braille
* ../../tables/da-dk-g26l.ctb Danish 6-dot partially contracted braille
* ../../tables/da-dk-g28.ctb Danish 8-dot fully contracted braille
* ../../tables/da-dk-g28l.ctb Danish 8-dot partially contracted braille
* ../../tables/de.tbl German fully contracted braille
* ../../tables/de-de-g0.utb German uncontracted braille
* ../../tables/de-de-g1.ctb German partially contracted braille
* ../../tables/de_CH.tbl Swiss High German fully contracted braille
* ../../tables/de-ch-g0.utb Swiss High German uncontracted braille
* ../../tables/de-ch-g1.ctb Swiss High German partially contracted braille
* ../../tables/dra.tbl Dravidian computer braille
* ../../tables/el.tbl Greek braille
* ../../tables/gr-bb.ctb Ancient Greek braille
* ../../tables/ar-fa.utb Persian braille
* ../../tables/fa-ir-comp8.ctb Persian computer braille
* ../../tables/fa-ir-g1.utb Persian braille
../../tables/en-ueb-g1.ctb English (UEB) uncontracted braille
../../tables/en-ueb-g2.ctb English (UEB) contracted braille
* ../../tables/en_CA.tbl Canadian English computer braille
* ../../tables/en-gb-g1.utb U.K. English uncontracted braille
* ../../tables/en_GB.tbl U.K. English contracted braille
* ../../tables/en-gb-comp8.ctb U.K. English computer braille
../../tables/en-us-g1.ctb U.S. English (EBAE) uncontracted braille
../../tables/en_US-comp8-ext.tbl U.S. English (EBAE) computer braille
../../tables/en_US.tbl U.S. English (EBAE) contracted braille
* ../../tables/eo.tbl Esperanto braille
* ../../tables/eo-g1-x-system.ctb Esperanto x-system braille
* ../../tables/es.tbl Spanish braille
* ../../tables/et.tbl Estonian computer braille
* ../../tables/fi.tbl Finnish computer braille
* ../../tables/fi.utb Finnish braille
* ../../tables/fi-fi-8dot.ctb Finnish computer braille
../../tables/fr-bfu-comp6.utb Unified French 6 dots braille
../../tables/fr-bfu-comp8.utb Unified French 8 dots braille
../../tables/fr-bfu-g2.ctb Unified French contracted braille
* ../../tables/ga-g1.utb Irish uncontracted braille
* ../../tables/ga.tbl Irish contracted braille
* ../../tables/gd.tbl Scottish Gaelic computer braille
* ../../tables/gez.tbl Ethiopic braille
* ../../tables/gon.tbl Gondi braille
* ../../tables/gu.tbl Gujarati braille
* ../../tables/haw-us-g1.ctb Hawaiian braille
* ../../tables/he.tbl Hebrew computer braille
* ../../tables/hi.tbl Hindi braille
* ../../tables/hr-g1.tbl Croatian braille
* ../../tables/hr-comp8.tbl Croatian computer braille
* ../../tables/hu-hu-comp8.ctb Hungarian computer braille
* ../../tables/hu.tbl Hungarian partially contracted braille
* ../../tables/hu-hu-g2.ctb Hungarian fully contracted braille
* ../../tables/hy.tbl Armenian computer braille
* ../../tables/is.tbl Icelandic braille
* ../../tables/it.tbl Italian braille
* ../../tables/it-it-comp8.utb Italian computer braille
* ../../tables/iu-ca-g1.ctb Inuktitut braille
* ../../tables/kha.tbl Khasi braille
* ../../tables/kn.tbl Kannada braille
* ../../tables/ko-2006-g2.ctb Korean contracted braille (2006 standard)
* ../../tables/ko-2006-g1.ctb Korean uncontracted braille (2006 standard)
* ../../tables/ko-g2.ctb Korean contracted braille
* ../../tables/ko-g1.ctb Korean uncontracted braille
* ../../tables/kok.tbl Konkani braille
* ../../tables/kru.tbl Kurukh braille
* ../../tables/lt.tbl Lithuanian 8-dot braille
* ../../tables/lt-6dot.tbl Lithuanian braille
* ../../tables/lv.tbl Latvian braille
* ../../tables/mao-nz-g1.ctb Maori braille
* ../../tables/ml.tbl Malayalam braille
* ../../tables/mni.tbl Manipuri braille
* ../../tables/mr.tbl Marathi braille
* ../../tables/mt.tbl Maltese computer braille
* ../../tables/mun.tbl Munda braille
* ../../tables/mwr.tbl Marwari braille
* ../../tables/no-no-g0.utb Norwegian uncontracted braille
* ../../tables/no-no-g1.ctb Norwegian grade 1 contracted braille
* ../../tables/no-no-g2.ctb Norwegian grade 2 contracted braille
* ../../tables/no.tbl Norwegian grade 3 contracted braille
* ../../tables/ne.tbl Nepali braille
../../tables/nl.tbl Dutch braille as used in the Netherlands
../../tables/nl_BE.tbl Dutch braille as used in Belgium
* ../../tables/or.tbl Oriya braille
* ../../tables/pa.tbl Punjabi braille
* ../../tables/pi.tbl Pali braille
* ../../tables/pl-pl-comp8.ctb Polish computer braille
* ../../tables/pl.tbl Polish braille
* ../../tables/pt.tbl Portuguese contracted braille
* ../../tables/pt-pt-g1.utb Portuguese uncontracted braille
* ../../tables/pt-pt-comp8.ctb Portuguese computer braille
* ../../tables/ro.tbl Romanian computer braille
* ../../tables/ru.tbl Russian braille
* ../../tables/ru-compbrl.ctb Russian computer braille
* ../../tables/sa.tbl Sanskrit braille
* ../../tables/sd.tbl Sindhi braille
* ../../tables/sv.tbl Swedish braille
* ../../tables/sv-1996.ctb Swedish computer braille (1996 standard)
* ../../tables/sv-1989.ctb Swedish computer braille (1989 standard)
* ../../tables/sk.tbl Slovak braille
* ../../tables/sl.tbl Slovenian braille
* ../../tables/sl-si-comp8.ctb Slovenian computer braille
* ../../tables/sr.tbl Serbian braille
* ../../tables/ta-ta-g1.ctb Tamil braille
* ../../tables/ta.tbl Tamil computer braille
* ../../tables/te.tbl Telugu braille
* ../../tables/tr.tbl Turkish computer braille
* ../../tables/vi.ctb Vietnamese computer braille
* ../../tables/vi.tbl Vietnamese braille
68 changes: 68 additions & 0 deletions extra/generate-display-names/displayLanguage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package main

import (
"C"
"golang.org/x/text/language"
"golang.org/x/text/language/display"
)

//export DisplayLanguage
func DisplayLanguage(lang_c *C.char) *C.char {
var lang string
var ret string
lang = C.GoString(lang_c)
switch (lang) {
case "bh":
ret = "Bihari";
break;
case "bn":
ret = "Bengali";
break;
case "ckb":
ret = "Kurdish";
break;
case "dra":
ret = "Dravidian";
break;
case "en-GB":
ret = "U.K. English";
break;
case "en-US":
ret = "U.S. English";
break;
case "eo-xsistemo":
ret = "Esperanto x-system";;
break;
case "gez":
ret = "Ethiopic";
break;
case "mun":
ret = "Munda";
break;
case "no":
ret = "Norwegian";
break;
case "or":
ret = "Oriya";
break;
default:
var namer display.Namer
namer = display.English.Languages()
ret = namer.Name(language.MustParse(lang))
}
return C.CString(ret)
}

//export NativeLanguage
func NativeLanguage(lang_c *C.char) *C.char {
var lang string
var ret string
var namer display.Namer
lang = C.GoString(lang_c)
namer = display.Self
ret = namer.Name(language.MustParse(lang))
return C.CString(ret)
}

// main function required for interfacing with C
func main() {}
Loading

0 comments on commit 84f9dbf

Please sign in to comment.