liblouis-rb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +520 -0
- data/README.md +100 -0
- data/Rakefile +80 -0
- data/ext/liblouis/braille_character.c +200 -0
- data/ext/liblouis/braille_table.c +198 -0
- data/ext/liblouis/braille_text.c +223 -0
- data/ext/liblouis/extconf.rb +73 -0
- data/ext/liblouis/liblouis.c +168 -0
- data/ext/liblouis/liblouis_ext.h +49 -0
- data/ext/liblouis/table_source.c +161 -0
- data/ext/liblouis/translation.c +443 -0
- data/liblouis-rb.gemspec +49 -0
- data/spec/liblouis_spec.rb +62 -0
- data/test/integration/packaging_test.rb +82 -0
- data/test/table_source_cases.rb +9 -0
- data/test/test_braille_character.rb +62 -0
- data/test/test_braille_table.rb +379 -0
- data/test/test_braille_text.rb +30 -0
- data/test/test_helper.rb +7 -0
- data/test/translation_cases.rb +33 -0
- data/vendor/liblouis/COPYING +674 -0
- data/vendor/liblouis/COPYING.LESSER +502 -0
- data/vendor/liblouis/configure.ac +290 -0
- data/vendor/liblouis/liblouis/commonTranslationFunctions.c +95 -0
- data/vendor/liblouis/liblouis/compileTranslationTable.c +5515 -0
- data/vendor/liblouis/liblouis/internal.h +781 -0
- data/vendor/liblouis/liblouis/liblouis.h.in +514 -0
- data/vendor/liblouis/liblouis/logging.c +233 -0
- data/vendor/liblouis/liblouis/lou_backTranslateString.c +1855 -0
- data/vendor/liblouis/liblouis/lou_translateString.c +4177 -0
- data/vendor/liblouis/liblouis/maketable.c +463 -0
- data/vendor/liblouis/liblouis/metadata.c +1258 -0
- data/vendor/liblouis/liblouis/pattern.c +1632 -0
- data/vendor/liblouis/liblouis/utils.c +448 -0
- data/vendor/liblouis/tables/Es-Es-G0.utb +248 -0
- data/vendor/liblouis/tables/IPA-unicode-range.uti +200 -0
- data/vendor/liblouis/tables/IPA.utb +164 -0
- data/vendor/liblouis/tables/Lv-Lv-g1.utb +509 -0
- data/vendor/liblouis/tables/Makefile.am +503 -0
- data/vendor/liblouis/tables/Pl-Pl-g1.utb +312 -0
- data/vendor/liblouis/tables/README +6 -0
- data/vendor/liblouis/tables/afr-za-g1.ctb +63 -0
- data/vendor/liblouis/tables/afr-za-g2.ctb +1050 -0
- data/vendor/liblouis/tables/akk-borger.utb +997 -0
- data/vendor/liblouis/tables/akk.utb +1002 -0
- data/vendor/liblouis/tables/ancient-languages-borger.utb +114 -0
- data/vendor/liblouis/tables/ancient-languages-us.utb +114 -0
- data/vendor/liblouis/tables/ar-ar-comp8.utb +293 -0
- data/vendor/liblouis/tables/ar-ar-g1-core.uti +291 -0
- data/vendor/liblouis/tables/ar-ar-g1.utb +26 -0
- data/vendor/liblouis/tables/ar-ar-g2.ctb +447 -0
- data/vendor/liblouis/tables/ar-ar-math.uti +501 -0
- data/vendor/liblouis/tables/ar.tbl +17 -0
- data/vendor/liblouis/tables/as-in-g1.utb +27 -0
- data/vendor/liblouis/tables/as.tbl +18 -0
- data/vendor/liblouis/tables/aw-in-g1.utb +27 -0
- data/vendor/liblouis/tables/awa.tbl +18 -0
- data/vendor/liblouis/tables/ba.utb +64 -0
- data/vendor/liblouis/tables/be-in-g1.utb +27 -0
- data/vendor/liblouis/tables/bel-comp.utb +42 -0
- data/vendor/liblouis/tables/bel-detailed.utb +32 -0
- data/vendor/liblouis/tables/bel.utb +61 -0
- data/vendor/liblouis/tables/bengali.cti +238 -0
- data/vendor/liblouis/tables/bg.ctb +215 -0
- data/vendor/liblouis/tables/bg.dis +84 -0
- data/vendor/liblouis/tables/bg.tbl +21 -0
- data/vendor/liblouis/tables/bg.utb +454 -0
- data/vendor/liblouis/tables/bh.ctb +24 -0
- data/vendor/liblouis/tables/bh.tbl +17 -0
- data/vendor/liblouis/tables/bn.tbl +18 -0
- data/vendor/liblouis/tables/bo.ctb +184 -0
- data/vendor/liblouis/tables/bo.tbl +21 -0
- data/vendor/liblouis/tables/boxes.ctb +162 -0
- data/vendor/liblouis/tables/br-in-g1.utb +27 -0
- data/vendor/liblouis/tables/bra.tbl +18 -0
- data/vendor/liblouis/tables/braille-patterns.cti +287 -0
- data/vendor/liblouis/tables/ca-chardefs.cti +225 -0
- data/vendor/liblouis/tables/ca-g1.ctb +46 -0
- data/vendor/liblouis/tables/ca.tbl +18 -0
- data/vendor/liblouis/tables/chr-us-g1.ctb +180 -0
- data/vendor/liblouis/tables/ckb-chardefs.cti +219 -0
- data/vendor/liblouis/tables/ckb-g1.ctb +31 -0
- data/vendor/liblouis/tables/ckb-translation.cti +131 -0
- data/vendor/liblouis/tables/ckb.tbl +18 -0
- data/vendor/liblouis/tables/compress.cti +44 -0
- data/vendor/liblouis/tables/controlchars.cti +27 -0
- data/vendor/liblouis/tables/cop-eg-comp8.utb +255 -0
- data/vendor/liblouis/tables/cop.utb +231 -0
- data/vendor/liblouis/tables/corrections.cti +47 -0
- data/vendor/liblouis/tables/countries.cti +263 -0
- data/vendor/liblouis/tables/critical-apparatus.uti +54 -0
- data/vendor/liblouis/tables/cs-chardefs.cti +385 -0
- data/vendor/liblouis/tables/cs-comp8.utb +405 -0
- data/vendor/liblouis/tables/cs-g1.ctb +37 -0
- data/vendor/liblouis/tables/cs-translation.cti +63 -0
- data/vendor/liblouis/tables/cs.tbl +20 -0
- data/vendor/liblouis/tables/cuneiform-transliterated-compact.utb +432 -0
- data/vendor/liblouis/tables/cuneiform-transliterated.utb +160 -0
- data/vendor/liblouis/tables/cy-cy-g1.utb +487 -0
- data/vendor/liblouis/tables/cy-cy-g2.ctb +199 -0
- data/vendor/liblouis/tables/cy.tbl +19 -0
- data/vendor/liblouis/tables/da-dk-6miscChars.cti +385 -0
- data/vendor/liblouis/tables/da-dk-6miscChars_1993.cti +412 -0
- data/vendor/liblouis/tables/da-dk-8miscChars.cti +90 -0
- data/vendor/liblouis/tables/da-dk-8miscChars_1993.cti +102 -0
- data/vendor/liblouis/tables/da-dk-g08.ctb +290 -0
- data/vendor/liblouis/tables/da-dk-g08_1993.ctb +331 -0
- data/vendor/liblouis/tables/da-dk-g16-lit_1993.ctb +294 -0
- data/vendor/liblouis/tables/da-dk-g16.ctb +289 -0
- data/vendor/liblouis/tables/da-dk-g16_1993.ctb +305 -0
- data/vendor/liblouis/tables/da-dk-g18.ctb +545 -0
- data/vendor/liblouis/tables/da-dk-g18_1993.ctb +563 -0
- data/vendor/liblouis/tables/da-dk-g2.dic +7439 -0
- data/vendor/liblouis/tables/da-dk-g26-lit_1993.ctb +898 -0
- data/vendor/liblouis/tables/da-dk-g26.ctb +1345 -0
- data/vendor/liblouis/tables/da-dk-g26_1993.ctb +1127 -0
- data/vendor/liblouis/tables/da-dk-g26l-lit_1993.ctb +588 -0
- data/vendor/liblouis/tables/da-dk-g26l_1993.ctb +604 -0
- data/vendor/liblouis/tables/da-dk-g28.ctb +2426 -0
- data/vendor/liblouis/tables/da-dk-g28_1993.ctb +2063 -0
- data/vendor/liblouis/tables/da-dk-g28l_1993.ctb +1594 -0
- data/vendor/liblouis/tables/da-dk-octobraille.dis +316 -0
- data/vendor/liblouis/tables/da-dk-octobraille_1993.dis +313 -0
- data/vendor/liblouis/tables/de-accents-detailed.cti +214 -0
- data/vendor/liblouis/tables/de-accents.cti +214 -0
- data/vendor/liblouis/tables/de-chardefs6.cti +289 -0
- data/vendor/liblouis/tables/de-chardefs8.cti +278 -0
- data/vendor/liblouis/tables/de-chess.ctb +37 -0
- data/vendor/liblouis/tables/de-comp6.utb +226 -0
- data/vendor/liblouis/tables/de-de-comp8.ctb +492 -0
- data/vendor/liblouis/tables/de-de.dis +331 -0
- data/vendor/liblouis/tables/de-eurobrl6.dis +101 -0
- data/vendor/liblouis/tables/de-eurobrl6u.dis +96 -0
- data/vendor/liblouis/tables/de-g0-core.uti +732 -0
- data/vendor/liblouis/tables/de-g0-detailed.utb +84 -0
- data/vendor/liblouis/tables/de-g0.utb +57 -0
- data/vendor/liblouis/tables/de-g1-core-patterns.dic +4863 -0
- data/vendor/liblouis/tables/de-g1-core.cti +67 -0
- data/vendor/liblouis/tables/de-g1-detailed.ctb +79 -0
- data/vendor/liblouis/tables/de-g1.ctb +54 -0
- data/vendor/liblouis/tables/de-g2-core-patterns.dic +26711 -0
- data/vendor/liblouis/tables/de-g2-core.cti +607 -0
- data/vendor/liblouis/tables/de-g2-detailed.ctb +60 -0
- data/vendor/liblouis/tables/de-g2.ctb +57 -0
- data/vendor/liblouis/tables/devanagari.cti +325 -0
- data/vendor/liblouis/tables/digits6Dots.uti +30 -0
- data/vendor/liblouis/tables/digits6DotsPlusDot6.uti +30 -0
- data/vendor/liblouis/tables/digits8Dots.uti +30 -0
- data/vendor/liblouis/tables/dra.ctb +23 -0
- data/vendor/liblouis/tables/dra.tbl +21 -0
- data/vendor/liblouis/tables/el.ctb +775 -0
- data/vendor/liblouis/tables/en-GB-g2.ctb +829 -0
- data/vendor/liblouis/tables/en-chardefs.cti +193 -0
- data/vendor/liblouis/tables/en-chess.ctb +37 -0
- data/vendor/liblouis/tables/en-g3-patterns.dic +11194 -0
- data/vendor/liblouis/tables/en-g3.ctb +2261 -0
- data/vendor/liblouis/tables/en-gb-comp8.ctb +282 -0
- data/vendor/liblouis/tables/en-gb-g1.utb +527 -0
- data/vendor/liblouis/tables/en-in-g1.ctb +162 -0
- data/vendor/liblouis/tables/en-nabcc.utb +166 -0
- data/vendor/liblouis/tables/en-nz-g1.utb +65 -0
- data/vendor/liblouis/tables/en-nz-g2.ctb +46 -0
- data/vendor/liblouis/tables/en-ueb-chardefs.uti +938 -0
- data/vendor/liblouis/tables/en-ueb-g1.ctb +167 -0
- data/vendor/liblouis/tables/en-ueb-g2.ctb +3925 -0
- data/vendor/liblouis/tables/en-ueb-math.ctb +71 -0
- data/vendor/liblouis/tables/en-us-brf.dis +102 -0
- data/vendor/liblouis/tables/en-us-comp6.ctb +149 -0
- data/vendor/liblouis/tables/en-us-comp8-ext.utb +626 -0
- data/vendor/liblouis/tables/en-us-comp8.ctb +62 -0
- data/vendor/liblouis/tables/en-us-compbrl.uti +69 -0
- data/vendor/liblouis/tables/en-us-emphasis.uti +45 -0
- data/vendor/liblouis/tables/en-us-g1.ctb +199 -0
- data/vendor/liblouis/tables/en-us-g2.ctb +1081 -0
- data/vendor/liblouis/tables/en-us-interline.ctb +1126 -0
- data/vendor/liblouis/tables/en-us-mathtext.ctb +880 -0
- data/vendor/liblouis/tables/en_CA.ctb +195 -0
- data/vendor/liblouis/tables/en_CA.tbl +21 -0
- data/vendor/liblouis/tables/en_GB.tbl +26 -0
- data/vendor/liblouis/tables/en_US-comp8-ext.tbl +15 -0
- data/vendor/liblouis/tables/en_US.tbl +26 -0
- data/vendor/liblouis/tables/eo-g1-x-system.ctb +85 -0
- data/vendor/liblouis/tables/eo-g1.ctb +165 -0
- data/vendor/liblouis/tables/eo.tbl +14 -0
- data/vendor/liblouis/tables/es-chardefs.cti +206 -0
- data/vendor/liblouis/tables/es-g1.ctb +36 -0
- data/vendor/liblouis/tables/es-g2.ctb +955 -0
- data/vendor/liblouis/tables/es-new.dis +284 -0
- data/vendor/liblouis/tables/es-no.utb +79 -0
- data/vendor/liblouis/tables/es-old.dis +284 -0
- data/vendor/liblouis/tables/es.tbl +19 -0
- data/vendor/liblouis/tables/et-6dot.utb +269 -0
- data/vendor/liblouis/tables/et-g0.utb +139 -0
- data/vendor/liblouis/tables/ethio-g1.ctb +335 -0
- data/vendor/liblouis/tables/eurodefs.cti +107 -0
- data/vendor/liblouis/tables/fa-ir-comp8.ctb +250 -0
- data/vendor/liblouis/tables/fa-ir-g1.utb +311 -0
- data/vendor/liblouis/tables/fi-fi-8dot.ctb +278 -0
- data/vendor/liblouis/tables/fi.utb +354 -0
- data/vendor/liblouis/tables/fil-g2.ctb +491 -0
- data/vendor/liblouis/tables/fr-bfu-comp6-puncs-math.uti +351 -0
- data/vendor/liblouis/tables/fr-bfu-comp6.utb +238 -0
- data/vendor/liblouis/tables/fr-bfu-comp68.cti +251 -0
- data/vendor/liblouis/tables/fr-bfu-comp8.utb +323 -0
- data/vendor/liblouis/tables/fr-bfu-g2.ctb +4644 -0
- data/vendor/liblouis/tables/ga-g1.utb +95 -0
- data/vendor/liblouis/tables/ga-g2.ctb +231 -0
- data/vendor/liblouis/tables/gd.ctb +123 -0
- data/vendor/liblouis/tables/gd.tbl +21 -0
- data/vendor/liblouis/tables/gez.tbl +21 -0
- data/vendor/liblouis/tables/gon.ctb +25 -0
- data/vendor/liblouis/tables/gon.tbl +17 -0
- data/vendor/liblouis/tables/gr-pl-comp8.uti +256 -0
- data/vendor/liblouis/tables/grc-international-common.uti +104 -0
- data/vendor/liblouis/tables/grc-international-composed.uti +268 -0
- data/vendor/liblouis/tables/grc-international-decomposed.uti +268 -0
- data/vendor/liblouis/tables/grc-international-en-composed.utb +54 -0
- data/vendor/liblouis/tables/grc-international-en.utb +206 -0
- data/vendor/liblouis/tables/grc-international-es.utb +228 -0
- data/vendor/liblouis/tables/gu-in-g1.utb +27 -0
- data/vendor/liblouis/tables/gu.tbl +18 -0
- data/vendor/liblouis/tables/gujarati.cti +221 -0
- data/vendor/liblouis/tables/gurumuki.cti +393 -0
- data/vendor/liblouis/tables/haw-us-g1.ctb +54 -0
- data/vendor/liblouis/tables/hbo-cantillated-rules.uti +71 -0
- data/vendor/liblouis/tables/hbo-cantillated.utb +109 -0
- data/vendor/liblouis/tables/hbo-common-rules.uti +152 -0
- data/vendor/liblouis/tables/hbo-ihbc-rules.uti +58 -0
- data/vendor/liblouis/tables/hbo-slim-rules.uti +68 -0
- data/vendor/liblouis/tables/hbo-slim.utb +100 -0
- data/vendor/liblouis/tables/hbo.utb +107 -0
- data/vendor/liblouis/tables/he-IL-comp8.utb +464 -0
- data/vendor/liblouis/tables/he-IL.utb +406 -0
- data/vendor/liblouis/tables/he-common-consonants.uti +102 -0
- data/vendor/liblouis/tables/he-common-vowels-ihbc.uti +161 -0
- data/vendor/liblouis/tables/hi-in-g1.utb +27 -0
- data/vendor/liblouis/tables/hi.tbl +18 -0
- data/vendor/liblouis/tables/hr-chardefs.cti +278 -0
- data/vendor/liblouis/tables/hr-comp8.tbl +21 -0
- data/vendor/liblouis/tables/hr-comp8.utb +239 -0
- data/vendor/liblouis/tables/hr-digits.uti +40 -0
- data/vendor/liblouis/tables/hr-g1.ctb +36 -0
- data/vendor/liblouis/tables/hr-g1.tbl +9 -0
- data/vendor/liblouis/tables/hr-translation.cti +364 -0
- data/vendor/liblouis/tables/ht-frenchcompatibility.uti +61 -0
- data/vendor/liblouis/tables/ht-g1.utb +114 -0
- data/vendor/liblouis/tables/hu-backtranslate-correction.dis +38 -0
- data/vendor/liblouis/tables/hu-backtranslate-word-corrections.cti +4293 -0
- data/vendor/liblouis/tables/hu-chardefs.cti +298 -0
- data/vendor/liblouis/tables/hu-exceptionwords.cti +3204 -0
- data/vendor/liblouis/tables/hu-hu-comp8.ctb +183 -0
- data/vendor/liblouis/tables/hu-hu-g1.ctb +129 -0
- data/vendor/liblouis/tables/hu-hu-g1_braille_input.cti +486 -0
- data/vendor/liblouis/tables/hu-hu-g2.ctb +270 -0
- data/vendor/liblouis/tables/hu-hu-g2_exceptions.cti +1164 -0
- data/vendor/liblouis/tables/hy.ctb +121 -0
- data/vendor/liblouis/tables/hy.tbl +21 -0
- data/vendor/liblouis/tables/hyph_cs_CZ.dic +3637 -0
- data/vendor/liblouis/tables/hyph_da_DK.dic +8896 -0
- data/vendor/liblouis/tables/hyph_de_DE.dic +5799 -0
- data/vendor/liblouis/tables/hyph_en_US.dic +5537 -0
- data/vendor/liblouis/tables/hyph_eo.dic +1024 -0
- data/vendor/liblouis/tables/hyph_es_ES.dic +877 -0
- data/vendor/liblouis/tables/hyph_fr_FR.dic +1067 -0
- data/vendor/liblouis/tables/hyph_hu_HU.dic +98519 -0
- data/vendor/liblouis/tables/hyph_it_IT.dic +410 -0
- data/vendor/liblouis/tables/hyph_nb_NO.dic +27142 -0
- data/vendor/liblouis/tables/hyph_nl_NL.dic +12725 -0
- data/vendor/liblouis/tables/hyph_nn_NO.dic +27142 -0
- data/vendor/liblouis/tables/hyph_pl_PL.dic +4074 -0
- data/vendor/liblouis/tables/hyph_pt_PT.dic +308 -0
- data/vendor/liblouis/tables/hyph_ru.dic +6480 -0
- data/vendor/liblouis/tables/hyph_sv_SE.dic +4697 -0
- data/vendor/liblouis/tables/is-chardefs6.cti +170 -0
- data/vendor/liblouis/tables/is-chardefs8.cti +293 -0
- data/vendor/liblouis/tables/is.ctb +157 -0
- data/vendor/liblouis/tables/is.tbl +18 -0
- data/vendor/liblouis/tables/it-it-comp6.utb +404 -0
- data/vendor/liblouis/tables/it-it-comp8.utb +663 -0
- data/vendor/liblouis/tables/iu-ca-g1.ctb +236 -0
- data/vendor/liblouis/tables/ja-kantenji-ucs2.utb +11448 -0
- data/vendor/liblouis/tables/ja-kantenji.utb +53 -0
- data/vendor/liblouis/tables/ja-rokutenkanji.utb +8710 -0
- data/vendor/liblouis/tables/ka-in-g1.utb +27 -0
- data/vendor/liblouis/tables/ka.utb +128 -0
- data/vendor/liblouis/tables/kannada.cti +282 -0
- data/vendor/liblouis/tables/kh-in-g1.utb +26 -0
- data/vendor/liblouis/tables/kha.tbl +18 -0
- data/vendor/liblouis/tables/kk.utb +77 -0
- data/vendor/liblouis/tables/km-g1.utb +412 -0
- data/vendor/liblouis/tables/kmr.tbl +108 -0
- data/vendor/liblouis/tables/kn.tbl +18 -0
- data/vendor/liblouis/tables/ko-2006-g1.ctb +49 -0
- data/vendor/liblouis/tables/ko-2006-g2.ctb +53 -0
- data/vendor/liblouis/tables/ko-2006.cti +190 -0
- data/vendor/liblouis/tables/ko-chars.cti +15140 -0
- data/vendor/liblouis/tables/ko-g1-rules.cti +634 -0
- data/vendor/liblouis/tables/ko-g1.ctb +48 -0
- data/vendor/liblouis/tables/ko-g2-rules.cti +9263 -0
- data/vendor/liblouis/tables/ko-g2.ctb +52 -0
- data/vendor/liblouis/tables/ko.cti +223 -0
- data/vendor/liblouis/tables/kok.ctb +24 -0
- data/vendor/liblouis/tables/kok.tbl +17 -0
- data/vendor/liblouis/tables/kru.ctb +24 -0
- data/vendor/liblouis/tables/kru.tbl +17 -0
- data/vendor/liblouis/tables/ks-in-g1.utb +27 -0
- data/vendor/liblouis/tables/latinLetterDef6Dots.uti +78 -0
- data/vendor/liblouis/tables/latinLetterDef8Dots.uti +75 -0
- data/vendor/liblouis/tables/latinLowercase.uti +389 -0
- data/vendor/liblouis/tables/latinUppercaseComp6.uti +78 -0
- data/vendor/liblouis/tables/lg-ug-g1.utb +60 -0
- data/vendor/liblouis/tables/litdigits6Dots.uti +30 -0
- data/vendor/liblouis/tables/litdigits6DotsPlusDot6.uti +30 -0
- data/vendor/liblouis/tables/lo-g1.utb +3127 -0
- data/vendor/liblouis/tables/loweredDigits6Dots.uti +30 -0
- data/vendor/liblouis/tables/loweredDigits8Dots.uti +30 -0
- data/vendor/liblouis/tables/lt-6dot.utb +308 -0
- data/vendor/liblouis/tables/lt-8dot.utb +281 -0
- data/vendor/liblouis/tables/lt.ctb +313 -0
- data/vendor/liblouis/tables/lv.tbl +22 -0
- data/vendor/liblouis/tables/maketablelist.sh +52 -0
- data/vendor/liblouis/tables/malayalam.cti +674 -0
- data/vendor/liblouis/tables/mao-nz-g1.ctb +65 -0
- data/vendor/liblouis/tables/marburg_single_cell_defs.cti +66 -0
- data/vendor/liblouis/tables/marburg_unicode_defs.cti +297 -0
- data/vendor/liblouis/tables/mk-g1.utb +240 -0
- data/vendor/liblouis/tables/ml-in-g1.utb +27 -0
- data/vendor/liblouis/tables/ml.tbl +21 -0
- data/vendor/liblouis/tables/mn-MN-common.cti +110 -0
- data/vendor/liblouis/tables/mn-MN-g1.utb +52 -0
- data/vendor/liblouis/tables/mn-MN-g2.ctb +50 -0
- data/vendor/liblouis/tables/mn-in-g1.utb +27 -0
- data/vendor/liblouis/tables/mni.tbl +18 -0
- data/vendor/liblouis/tables/mr-in-g1.utb +27 -0
- data/vendor/liblouis/tables/mr.tbl +18 -0
- data/vendor/liblouis/tables/ms-my-g2.ctb +4897 -0
- data/vendor/liblouis/tables/mt.ctb +114 -0
- data/vendor/liblouis/tables/mt.tbl +21 -0
- data/vendor/liblouis/tables/mun.ctb +24 -0
- data/vendor/liblouis/tables/mun.tbl +17 -0
- data/vendor/liblouis/tables/mwr.ctb +24 -0
- data/vendor/liblouis/tables/mwr.tbl +17 -0
- data/vendor/liblouis/tables/my-g1.utb +771 -0
- data/vendor/liblouis/tables/my-g2.ctb +3805 -0
- data/vendor/liblouis/tables/ne.ctb +22 -0
- data/vendor/liblouis/tables/ne.tbl +18 -0
- data/vendor/liblouis/tables/nemethdefs.cti +382 -0
- data/vendor/liblouis/tables/nl-BE.dis +532 -0
- data/vendor/liblouis/tables/nl-NL-g0.utb.in +646 -0
- data/vendor/liblouis/tables/nl-chardefs.uti.in +455 -0
- data/vendor/liblouis/tables/nl-comp8.utb +411 -0
- data/vendor/liblouis/tables/nl-print.dis +551 -0
- data/vendor/liblouis/tables/nl-unicode.dis +540 -0
- data/vendor/liblouis/tables/no-no-8dot-fallback-6dot-g0.utb +59 -0
- data/vendor/liblouis/tables/no-no-8dot.utb +629 -0
- data/vendor/liblouis/tables/no-no-braillo-047-01.dis +247 -0
- data/vendor/liblouis/tables/no-no-chardefs6.uti +305 -0
- data/vendor/liblouis/tables/no-no-comp8.ctb +323 -0
- data/vendor/liblouis/tables/no-no-cyrillic6dot.uti +95 -0
- data/vendor/liblouis/tables/no-no-g0.utb +320 -0
- data/vendor/liblouis/tables/no-no-g1.ctb +272 -0
- data/vendor/liblouis/tables/no-no-g2.ctb +737 -0
- data/vendor/liblouis/tables/no-no-g3.ctb +3597 -0
- data/vendor/liblouis/tables/no-no-generic.ctb +295 -0
- data/vendor/liblouis/tables/no-no-generic.dis +295 -0
- data/vendor/liblouis/tables/no-no-latinLetterDef6Dots_diacritics.uti +852 -0
- data/vendor/liblouis/tables/no-no.dis +291 -0
- data/vendor/liblouis/tables/np-in-g1.utb +27 -0
- data/vendor/liblouis/tables/nso-za-g1.utb +38 -0
- data/vendor/liblouis/tables/nso-za-g2.ctb +38 -0
- data/vendor/liblouis/tables/ny-mw.utb +70 -0
- data/vendor/liblouis/tables/or-in-g1.utb +27 -0
- data/vendor/liblouis/tables/or.tbl +18 -0
- data/vendor/liblouis/tables/oriya.cti +238 -0
- data/vendor/liblouis/tables/ovd-6g0.utb +64 -0
- data/vendor/liblouis/tables/ovd-8g0.utb +81 -0
- data/vendor/liblouis/tables/pa.tbl +18 -0
- data/vendor/liblouis/tables/pi.ctb +24 -0
- data/vendor/liblouis/tables/pi.tbl +17 -0
- data/vendor/liblouis/tables/pl-pl-comp8.ctb +658 -0
- data/vendor/liblouis/tables/pl.tbl +12 -0
- data/vendor/liblouis/tables/printables.cti +70 -0
- data/vendor/liblouis/tables/pt-comp6.utb +299 -0
- data/vendor/liblouis/tables/pt-pt-comp8.ctb +395 -0
- data/vendor/liblouis/tables/pt-pt-g1.utb +1312 -0
- data/vendor/liblouis/tables/pt-pt-g2.ctb +874 -0
- data/vendor/liblouis/tables/pt.tbl +20 -0
- data/vendor/liblouis/tables/pu-in-g1.utb +42 -0
- data/vendor/liblouis/tables/quotation-marks.uti +30 -0
- data/vendor/liblouis/tables/ro-g0.utb +85 -0
- data/vendor/liblouis/tables/ro.ctb +126 -0
- data/vendor/liblouis/tables/ro.tbl +21 -0
- data/vendor/liblouis/tables/ru-brf.dis +116 -0
- data/vendor/liblouis/tables/ru-comp6.utb +258 -0
- data/vendor/liblouis/tables/ru-comp8.utb +740 -0
- data/vendor/liblouis/tables/ru-letters.dis +145 -0
- data/vendor/liblouis/tables/ru-litbrl-detailed.utb +77 -0
- data/vendor/liblouis/tables/ru-litbrl.ctb +857 -0
- data/vendor/liblouis/tables/ru-math.uti +395 -0
- data/vendor/liblouis/tables/ru-ru-g1.ctb +804 -0
- data/vendor/liblouis/tables/ru-unicode.dis +121 -0
- data/vendor/liblouis/tables/rw-rw-g1.utb +133 -0
- data/vendor/liblouis/tables/sa-in-g1.utb +27 -0
- data/vendor/liblouis/tables/sa.tbl +18 -0
- data/vendor/liblouis/tables/sah.utb +72 -0
- data/vendor/liblouis/tables/sd.tbl +18 -0
- data/vendor/liblouis/tables/se-se.ctb +246 -0
- data/vendor/liblouis/tables/se-se.dis +334 -0
- data/vendor/liblouis/tables/si-in-g1.utb +27 -0
- data/vendor/liblouis/tables/sin.cti +213 -0
- data/vendor/liblouis/tables/sin.utb +35 -0
- data/vendor/liblouis/tables/sk-g1.ctb +1019 -0
- data/vendor/liblouis/tables/sk-sk-g1.utb +206 -0
- data/vendor/liblouis/tables/sk-sk.utb +112 -0
- data/vendor/liblouis/tables/sl-si-comp8.ctb +204 -0
- data/vendor/liblouis/tables/sl-si-g1.utb +471 -0
- data/vendor/liblouis/tables/sl.tbl +20 -0
- data/vendor/liblouis/tables/smi-6g0.utb +64 -0
- data/vendor/liblouis/tables/smi-8g0.utb +61 -0
- data/vendor/liblouis/tables/sot-za-g1.ctb +72 -0
- data/vendor/liblouis/tables/sot-za-g2.ctb +244 -0
- data/vendor/liblouis/tables/spaces.uti +62 -0
- data/vendor/liblouis/tables/sr-Cyrl.ctb +59 -0
- data/vendor/liblouis/tables/sr-common.cti +161 -0
- data/vendor/liblouis/tables/sr-cyrletters.cti +92 -0
- data/vendor/liblouis/tables/sr-g1.ctb +57 -0
- data/vendor/liblouis/tables/sr-latletters.cti +45 -0
- data/vendor/liblouis/tables/sv-1989.ctb +241 -0
- data/vendor/liblouis/tables/sv-1996.ctb +180 -0
- data/vendor/liblouis/tables/sv-6common.uti +1199 -0
- data/vendor/liblouis/tables/sv-6g0d.utb +508 -0
- data/vendor/liblouis/tables/sv-6g0p.utb +61 -0
- data/vendor/liblouis/tables/sv-6g1.uti +106 -0
- data/vendor/liblouis/tables/sv-6g1d.ctb +57 -0
- data/vendor/liblouis/tables/sv-6g2.uti +254 -0
- data/vendor/liblouis/tables/sv-6g2d.ctb +57 -0
- data/vendor/liblouis/tables/sv-8g0d.utb +495 -0
- data/vendor/liblouis/tables/sv-8g0n.utb +1236 -0
- data/vendor/liblouis/tables/sv-8g1.uti +199 -0
- data/vendor/liblouis/tables/sv-8g1d.ctb +73 -0
- data/vendor/liblouis/tables/sv-8g1n.ctb +73 -0
- data/vendor/liblouis/tables/sv-8g2.uti +486 -0
- data/vendor/liblouis/tables/sv-8g2d.ctb +73 -0
- data/vendor/liblouis/tables/sv-8g2n.ctb +73 -0
- data/vendor/liblouis/tables/sv-g0.utb +65 -0
- data/vendor/liblouis/tables/sv-g1.ctb +57 -0
- data/vendor/liblouis/tables/sv-g2.ctb +57 -0
- data/vendor/liblouis/tables/sv-phon.uti +241 -0
- data/vendor/liblouis/tables/sw-ke-g1-2.ctb +90 -0
- data/vendor/liblouis/tables/sw-ke-g1-3.ctb +109 -0
- data/vendor/liblouis/tables/sw-ke-g1-4.ctb +107 -0
- data/vendor/liblouis/tables/sw-ke-g1-5.ctb +73 -0
- data/vendor/liblouis/tables/sw-ke-g1.utb +278 -0
- data/vendor/liblouis/tables/sw-ke-g2.ctb +276 -0
- data/vendor/liblouis/tables/syc.utb +195 -0
- data/vendor/liblouis/tables/ta-ta-g1.ctb +167 -0
- data/vendor/liblouis/tables/ta.ctb +24 -0
- data/vendor/liblouis/tables/ta.tbl +21 -0
- data/vendor/liblouis/tables/tamil.cti +86 -0
- data/vendor/liblouis/tables/te-in-g1.utb +27 -0
- data/vendor/liblouis/tables/te.tbl +18 -0
- data/vendor/liblouis/tables/telugu.cti +239 -0
- data/vendor/liblouis/tables/text_nabcc.dis +426 -0
- data/vendor/liblouis/tables/th-comp8-backward.utb +226 -0
- data/vendor/liblouis/tables/th-g0.utb +177 -0
- data/vendor/liblouis/tables/th-g1.utb +89 -0
- data/vendor/liblouis/tables/th-g1.uti +315 -0
- data/vendor/liblouis/tables/th-g2.ctb +616 -0
- data/vendor/liblouis/tables/tr-g1.ctb +254 -0
- data/vendor/liblouis/tables/tr-g2.ctb +863 -0
- data/vendor/liblouis/tables/tr-g2.tbl +20 -0
- data/vendor/liblouis/tables/tr.ctb +324 -0
- data/vendor/liblouis/tables/tr.tbl +21 -0
- data/vendor/liblouis/tables/tsn-za-g1.ctb +33 -0
- data/vendor/liblouis/tables/tsn-za-g2.ctb +33 -0
- data/vendor/liblouis/tables/tt.utb +74 -0
- data/vendor/liblouis/tables/uga.utb +86 -0
- data/vendor/liblouis/tables/uk-comp.utb +53 -0
- data/vendor/liblouis/tables/uk-detailed.utb +32 -0
- data/vendor/liblouis/tables/uk.utb +101 -0
- data/vendor/liblouis/tables/ukchardefs.cti +106 -0
- data/vendor/liblouis/tables/ukmaths_single_cell_defs.cti +65 -0
- data/vendor/liblouis/tables/ukmaths_unicode_defs.cti +298 -0
- data/vendor/liblouis/tables/uni-text.dis +330 -0
- data/vendor/liblouis/tables/unicode-braille.utb +291 -0
- data/vendor/liblouis/tables/unicode-without-blank.dis +24 -0
- data/vendor/liblouis/tables/unicode.dis +278 -0
- data/vendor/liblouis/tables/ur-pk-g1.utb +248 -0
- data/vendor/liblouis/tables/ur-pk-g2.ctb +641 -0
- data/vendor/liblouis/tables/us-table.dis +67 -0
- data/vendor/liblouis/tables/uz-g1.utb +117 -0
- data/vendor/liblouis/tables/ve-za-g1.utb +69 -0
- data/vendor/liblouis/tables/ve-za-g2.ctb +208 -0
- data/vendor/liblouis/tables/vi-cb8.utb +49 -0
- data/vendor/liblouis/tables/vi-charsdef.uti +36 -0
- data/vendor/liblouis/tables/vi-lettersdef.uti +401 -0
- data/vendor/liblouis/tables/vi-puncsdef.uti +446 -0
- data/vendor/liblouis/tables/vi-saigon-g1.ctb +530 -0
- data/vendor/liblouis/tables/vi-vn-g0.utb +135 -0
- data/vendor/liblouis/tables/vi-vn-g1.ctb +574 -0
- data/vendor/liblouis/tables/vi-vn-g2.ctb +743 -0
- data/vendor/liblouis/tables/wiskunde-chardefs.cti +261 -0
- data/vendor/liblouis/tables/wordcx.dis +91 -0
- data/vendor/liblouis/tables/xh-za-g1.utb +61 -0
- data/vendor/liblouis/tables/xh-za-g2.ctb +386 -0
- data/vendor/liblouis/tables/yi.utb +236 -0
- data/vendor/liblouis/tables/zh-chn.ctb +45011 -0
- data/vendor/liblouis/tables/zh-hk.ctb +10461 -0
- data/vendor/liblouis/tables/zh-tw.ctb +53810 -0
- data/vendor/liblouis/tables/zh_CHN.tbl +23 -0
- data/vendor/liblouis/tables/zhcn-cbs.ctb +31523 -0
- data/vendor/liblouis/tables/zhcn-g1.ctb +26523 -0
- data/vendor/liblouis/tables/zhcn-g2.ctb +26519 -0
- data/vendor/liblouis/tables/zu-za-g1.utb +33 -0
- data/vendor/liblouis/tables/zu-za-g2.ctb +33 -0
- metadata +558 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
#include "liblouis_ext.h"
|
|
2
|
+
|
|
3
|
+
#include <stddef.h>
|
|
4
|
+
|
|
5
|
+
#define LL_ARRAY_LENGTH(array) (sizeof(array) / sizeof((array)[0]))
|
|
6
|
+
|
|
7
|
+
static ID id_mode;
|
|
8
|
+
static ID id_cursor_position;
|
|
9
|
+
static ID id_typeform;
|
|
10
|
+
static ID id_translated;
|
|
11
|
+
|
|
12
|
+
typedef struct {
|
|
13
|
+
const char *name;
|
|
14
|
+
int value;
|
|
15
|
+
} ll_named_value_t;
|
|
16
|
+
|
|
17
|
+
static void
|
|
18
|
+
ll_get_keywords(VALUE keywords, const ID *allowed, int count, VALUE *values)
|
|
19
|
+
{
|
|
20
|
+
int index;
|
|
21
|
+
|
|
22
|
+
for (index = 0; index < count; index++)
|
|
23
|
+
values[index] = Qundef;
|
|
24
|
+
if (!NIL_P(keywords))
|
|
25
|
+
rb_get_kwargs(rb_hash_dup(keywords), allowed, 0, count, values);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static int
|
|
29
|
+
ll_named_symbol(VALUE symbol, const ll_named_value_t *named, size_t count,
|
|
30
|
+
const char *kind, const char **name, int *value)
|
|
31
|
+
{
|
|
32
|
+
size_t index;
|
|
33
|
+
|
|
34
|
+
if (!SYMBOL_P(symbol))
|
|
35
|
+
rb_raise(rb_eTypeError, "%s entries must be symbols", kind);
|
|
36
|
+
*name = rb_id2name(SYM2ID(symbol));
|
|
37
|
+
for (index = 0; index < count; index++) {
|
|
38
|
+
if (strcmp(*name, named[index].name) != 0)
|
|
39
|
+
continue;
|
|
40
|
+
*value = named[index].value;
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static formtype
|
|
47
|
+
ll_typeform_symbol(VALUE table, VALUE symbol)
|
|
48
|
+
{
|
|
49
|
+
static const ll_named_value_t named[] = {
|
|
50
|
+
{"plain_text", plain_text},
|
|
51
|
+
{"computer_braille", computer_braille},
|
|
52
|
+
{"no_translate", no_translate},
|
|
53
|
+
{"no_contract", no_contract}
|
|
54
|
+
};
|
|
55
|
+
const char *name;
|
|
56
|
+
int value;
|
|
57
|
+
formtype typeform;
|
|
58
|
+
|
|
59
|
+
if (ll_named_symbol(symbol, named, LL_ARRAY_LENGTH(named),
|
|
60
|
+
"typeform", &name, &value))
|
|
61
|
+
return (formtype)value;
|
|
62
|
+
typeform = lou_getTypeformForEmphClass(ll_table_name(table), name);
|
|
63
|
+
if (typeform == plain_text)
|
|
64
|
+
rb_raise(rb_eArgError, "unknown typeform symbol: :%s", name);
|
|
65
|
+
return typeform;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static formtype
|
|
69
|
+
ll_typeform_value(VALUE table, VALUE value)
|
|
70
|
+
{
|
|
71
|
+
formtype typeform = plain_text;
|
|
72
|
+
long index;
|
|
73
|
+
|
|
74
|
+
if (SYMBOL_P(value))
|
|
75
|
+
return ll_typeform_symbol(table, value);
|
|
76
|
+
if (!RB_TYPE_P(value, T_ARRAY))
|
|
77
|
+
rb_raise(rb_eTypeError,
|
|
78
|
+
"typeform entries must be symbols or arrays of symbols");
|
|
79
|
+
|
|
80
|
+
for (index = 0; index < RARRAY_LEN(value); index++)
|
|
81
|
+
typeform |= ll_typeform_symbol(table, rb_ary_entry(value, index));
|
|
82
|
+
return typeform;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static VALUE
|
|
86
|
+
ll_typeform_storage(VALUE table, VALUE typeforms, int input_length,
|
|
87
|
+
int output_capacity)
|
|
88
|
+
{
|
|
89
|
+
VALUE storage;
|
|
90
|
+
long index;
|
|
91
|
+
|
|
92
|
+
if (typeforms == Qundef || NIL_P(typeforms))
|
|
93
|
+
return Qnil;
|
|
94
|
+
Check_Type(typeforms, T_ARRAY);
|
|
95
|
+
if (RARRAY_LEN(typeforms) != input_length)
|
|
96
|
+
rb_raise(rb_eArgError, "typeform length (%ld) must equal input length (%d)",
|
|
97
|
+
RARRAY_LEN(typeforms), input_length);
|
|
98
|
+
|
|
99
|
+
/* Liblouis writes output-cell markers back into this input buffer. */
|
|
100
|
+
storage = ll_binary_storage((size_t)output_capacity * sizeof(formtype));
|
|
101
|
+
for (index = 0; index < input_length; index++)
|
|
102
|
+
LL_PTR(formtype, storage)[index] =
|
|
103
|
+
ll_typeform_value(table, rb_ary_entry(typeforms, index));
|
|
104
|
+
return storage;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static int
|
|
108
|
+
ll_mode_symbol(VALUE symbol, int allowed, const char *direction)
|
|
109
|
+
{
|
|
110
|
+
static const ll_named_value_t named[] = {
|
|
111
|
+
{"no_contractions", noContractions},
|
|
112
|
+
{"computer_braille_at_cursor", compbrlAtCursor},
|
|
113
|
+
{"computer_braille_before_cursor", compbrlLeftCursor},
|
|
114
|
+
{"suppress_undefined", noUndefined},
|
|
115
|
+
{"partial_translation", partialTrans}
|
|
116
|
+
};
|
|
117
|
+
const char *name;
|
|
118
|
+
int mode;
|
|
119
|
+
|
|
120
|
+
if (!ll_named_symbol(symbol, named, LL_ARRAY_LENGTH(named),
|
|
121
|
+
"mode", &name, &mode))
|
|
122
|
+
rb_raise(rb_eArgError, "unknown translation mode: :%s", name);
|
|
123
|
+
if ((mode & allowed) == 0)
|
|
124
|
+
rb_raise(rb_eArgError, "mode :%s is not available for %s translation",
|
|
125
|
+
name, direction);
|
|
126
|
+
return mode;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static int
|
|
130
|
+
ll_translation_mode(VALUE value, int allowed, const char *direction)
|
|
131
|
+
{
|
|
132
|
+
int mode = 0;
|
|
133
|
+
long index;
|
|
134
|
+
|
|
135
|
+
if (value == Qundef || NIL_P(value))
|
|
136
|
+
return 0;
|
|
137
|
+
if (SYMBOL_P(value))
|
|
138
|
+
return ll_mode_symbol(value, allowed, direction);
|
|
139
|
+
if (!RB_TYPE_P(value, T_ARRAY))
|
|
140
|
+
rb_raise(rb_eTypeError, "mode must be a symbol or an array of symbols");
|
|
141
|
+
for (index = 0; index < RARRAY_LEN(value); index++)
|
|
142
|
+
mode |= ll_mode_symbol(rb_ary_entry(value, index), allowed, direction);
|
|
143
|
+
return mode;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
static int
|
|
147
|
+
ll_max_output_capacity(void)
|
|
148
|
+
{
|
|
149
|
+
size_t maximum = (size_t)LONG_MAX / sizeof(widechar) - 1;
|
|
150
|
+
|
|
151
|
+
if (maximum > (size_t)INT_MAX - 1)
|
|
152
|
+
maximum = (size_t)INT_MAX - 1;
|
|
153
|
+
return (int)maximum;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static int
|
|
157
|
+
ll_output_capacity(int input_length)
|
|
158
|
+
{
|
|
159
|
+
if (input_length > (ll_max_output_capacity() - 16) / 12)
|
|
160
|
+
rb_raise(rb_eArgError, "input is too long");
|
|
161
|
+
return input_length * 12 + 16;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
static int
|
|
165
|
+
ll_larger_output_capacity(int capacity)
|
|
166
|
+
{
|
|
167
|
+
int maximum = ll_max_output_capacity();
|
|
168
|
+
|
|
169
|
+
if (capacity >= maximum)
|
|
170
|
+
rb_raise(ll_eTranslationError, "translation output is too long");
|
|
171
|
+
return capacity > maximum / 2 ? maximum : capacity * 2;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
static void
|
|
175
|
+
ll_check_translation_input(VALUE storage, int length)
|
|
176
|
+
{
|
|
177
|
+
int index;
|
|
178
|
+
|
|
179
|
+
/* Liblouis treats NUL as the end of input, even with an explicit length. */
|
|
180
|
+
for (index = 0; index < length; index++)
|
|
181
|
+
if (LL_PTR(widechar, storage)[index] == 0)
|
|
182
|
+
rb_raise(rb_eArgError, "translation input must not contain NUL characters");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static int
|
|
186
|
+
ll_unicode_braille_to_dots(VALUE storage, int length)
|
|
187
|
+
{
|
|
188
|
+
int index;
|
|
189
|
+
|
|
190
|
+
if (length == 0)
|
|
191
|
+
return 0;
|
|
192
|
+
for (index = 0; index < length; index++) {
|
|
193
|
+
unsigned int codepoint = LL_PTR(widechar, storage)[index];
|
|
194
|
+
|
|
195
|
+
if (codepoint < 0x2800 || codepoint > 0x28ff)
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
for (index = 0; index < length; index++)
|
|
199
|
+
LL_PTR(widechar, storage)[index] =
|
|
200
|
+
(widechar)(LOU_DOTS | (LL_PTR(widechar, storage)[index] - 0x2800u));
|
|
201
|
+
return 1;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
static VALUE
|
|
205
|
+
ll_back_input_storage(VALUE input, int *length, int *dots_io)
|
|
206
|
+
{
|
|
207
|
+
VALUE storage;
|
|
208
|
+
|
|
209
|
+
if (ll_braille_text_p(input)) {
|
|
210
|
+
if (dots_io)
|
|
211
|
+
*dots_io = 1;
|
|
212
|
+
return ll_braille_text_to_dot_storage(input, length);
|
|
213
|
+
}
|
|
214
|
+
if (rb_obj_is_kind_of(input, ll_cBrailleCharacter)) {
|
|
215
|
+
storage = ll_binary_storage(sizeof(widechar));
|
|
216
|
+
LL_PTR(widechar, storage)[0] =
|
|
217
|
+
(widechar)(LOU_DOTS | ll_character_mask(input));
|
|
218
|
+
*length = 1;
|
|
219
|
+
if (dots_io)
|
|
220
|
+
*dots_io = 1;
|
|
221
|
+
return storage;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
storage = ll_wide_storage_from_string(input, length);
|
|
225
|
+
if (dots_io)
|
|
226
|
+
*dots_io = ll_unicode_braille_to_dots(storage, *length);
|
|
227
|
+
else
|
|
228
|
+
ll_unicode_braille_to_dots(storage, *length);
|
|
229
|
+
return storage;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
static VALUE
|
|
233
|
+
ll_table_translate(int argc, VALUE *argv, VALUE self)
|
|
234
|
+
{
|
|
235
|
+
const ID allowed[] = {id_mode, id_cursor_position, id_typeform};
|
|
236
|
+
const int allowed_modes = noContractions | compbrlAtCursor |
|
|
237
|
+
compbrlLeftCursor | noUndefined;
|
|
238
|
+
VALUE input;
|
|
239
|
+
VALUE keywords = Qnil;
|
|
240
|
+
VALUE values[3];
|
|
241
|
+
VALUE input_storage;
|
|
242
|
+
VALUE output_storage;
|
|
243
|
+
VALUE typeform_storage;
|
|
244
|
+
VALUE input_positions_storage;
|
|
245
|
+
VALUE output_positions_storage;
|
|
246
|
+
VALUE dots_storage;
|
|
247
|
+
int input_length;
|
|
248
|
+
int translated_input_length;
|
|
249
|
+
int output_length;
|
|
250
|
+
int output_capacity;
|
|
251
|
+
int cursor_given;
|
|
252
|
+
int cursor_position = 0;
|
|
253
|
+
int input_cursor_position;
|
|
254
|
+
int mode;
|
|
255
|
+
|
|
256
|
+
rb_scan_args(argc, argv, "1:", &input, &keywords);
|
|
257
|
+
input_storage = ll_wide_storage_from_string(input, &input_length);
|
|
258
|
+
ll_check_translation_input(input_storage, input_length);
|
|
259
|
+
ll_get_keywords(keywords, allowed, 3, values);
|
|
260
|
+
mode = ll_translation_mode(values[0], allowed_modes, "forward");
|
|
261
|
+
|
|
262
|
+
cursor_given = values[1] != Qundef && !NIL_P(values[1]);
|
|
263
|
+
if (cursor_given) {
|
|
264
|
+
cursor_position = NUM2INT(values[1]);
|
|
265
|
+
if (cursor_position < 0 || cursor_position > input_length)
|
|
266
|
+
rb_raise(rb_eRangeError,
|
|
267
|
+
"cursor_position must be between 0 and the input length");
|
|
268
|
+
}
|
|
269
|
+
if ((mode & (compbrlAtCursor | compbrlLeftCursor)) && !cursor_given)
|
|
270
|
+
rb_raise(rb_eArgError,
|
|
271
|
+
"computer-braille cursor modes require cursor_position");
|
|
272
|
+
|
|
273
|
+
input_cursor_position = cursor_position;
|
|
274
|
+
output_capacity = ll_output_capacity(input_length);
|
|
275
|
+
for (;;) {
|
|
276
|
+
/* Liblouis changes lengths, cursor and typeforms on every attempt. */
|
|
277
|
+
typeform_storage = ll_typeform_storage(self, values[2], input_length,
|
|
278
|
+
output_capacity);
|
|
279
|
+
output_storage = ll_binary_storage((size_t)output_capacity * sizeof(widechar));
|
|
280
|
+
input_positions_storage = ll_binary_storage(
|
|
281
|
+
(size_t)output_capacity * sizeof(int));
|
|
282
|
+
output_positions_storage = ll_binary_storage(
|
|
283
|
+
(size_t)(input_length + 1) * sizeof(int));
|
|
284
|
+
|
|
285
|
+
translated_input_length = input_length;
|
|
286
|
+
output_length = output_capacity;
|
|
287
|
+
cursor_position = input_cursor_position;
|
|
288
|
+
if (!lou_translate(
|
|
289
|
+
ll_table_name(self), LL_PTR(widechar, input_storage),
|
|
290
|
+
&translated_input_length, LL_PTR(widechar, output_storage), &output_length,
|
|
291
|
+
NIL_P(typeform_storage) ? NULL : LL_PTR(formtype, typeform_storage),
|
|
292
|
+
NULL, LL_PTR(int, output_positions_storage),
|
|
293
|
+
LL_PTR(int, input_positions_storage),
|
|
294
|
+
cursor_given ? &cursor_position : NULL, mode))
|
|
295
|
+
rb_raise(ll_eTranslationError, "forward translation failed for table %s",
|
|
296
|
+
ll_table_name(self));
|
|
297
|
+
if (translated_input_length == input_length)
|
|
298
|
+
break;
|
|
299
|
+
output_capacity = ll_larger_output_capacity(output_capacity);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
dots_storage = ll_binary_storage((size_t)output_length * sizeof(widechar));
|
|
303
|
+
if (output_length > 0 &&
|
|
304
|
+
!lou_charToDots(ll_table_name(self), LL_PTR(widechar, output_storage),
|
|
305
|
+
LL_PTR(widechar, dots_storage), output_length, mode))
|
|
306
|
+
rb_raise(ll_eTranslationError,
|
|
307
|
+
"could not convert translated cells to dots for table %s",
|
|
308
|
+
ll_table_name(self));
|
|
309
|
+
|
|
310
|
+
return ll_braille_text_from_translation(
|
|
311
|
+
dots_storage, output_length, input_positions_storage,
|
|
312
|
+
output_positions_storage, translated_input_length,
|
|
313
|
+
cursor_given, cursor_position);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
static VALUE
|
|
317
|
+
ll_table_back_translate(int argc, VALUE *argv, VALUE self)
|
|
318
|
+
{
|
|
319
|
+
const ID allowed[] = {id_mode};
|
|
320
|
+
VALUE input;
|
|
321
|
+
VALUE keywords = Qnil;
|
|
322
|
+
VALUE values[1];
|
|
323
|
+
VALUE input_storage;
|
|
324
|
+
VALUE output_storage;
|
|
325
|
+
int input_length;
|
|
326
|
+
int translated_input_length;
|
|
327
|
+
int output_length;
|
|
328
|
+
int dots_io = 0;
|
|
329
|
+
int output_capacity;
|
|
330
|
+
int mode;
|
|
331
|
+
|
|
332
|
+
rb_scan_args(argc, argv, "1:", &input, &keywords);
|
|
333
|
+
input_storage = ll_back_input_storage(input, &input_length, &dots_io);
|
|
334
|
+
ll_check_translation_input(input_storage, input_length);
|
|
335
|
+
ll_get_keywords(keywords, allowed, 1, values);
|
|
336
|
+
mode = ll_translation_mode(values[0], noUndefined | partialTrans, "back");
|
|
337
|
+
if (dots_io)
|
|
338
|
+
mode |= dotsIO;
|
|
339
|
+
|
|
340
|
+
output_capacity = ll_output_capacity(input_length);
|
|
341
|
+
for (;;) {
|
|
342
|
+
translated_input_length = input_length;
|
|
343
|
+
output_length = output_capacity;
|
|
344
|
+
output_storage = ll_binary_storage((size_t)output_capacity * sizeof(widechar));
|
|
345
|
+
if (!lou_backTranslate(
|
|
346
|
+
ll_table_name(self), LL_PTR(widechar, input_storage),
|
|
347
|
+
&translated_input_length, LL_PTR(widechar, output_storage), &output_length,
|
|
348
|
+
NULL, NULL, NULL, NULL, NULL, mode))
|
|
349
|
+
rb_raise(ll_eTranslationError, "back translation failed for table %s",
|
|
350
|
+
ll_table_name(self));
|
|
351
|
+
if (translated_input_length == input_length)
|
|
352
|
+
break;
|
|
353
|
+
output_capacity = ll_larger_output_capacity(output_capacity);
|
|
354
|
+
}
|
|
355
|
+
return ll_string_from_wide_storage(output_storage, output_length);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
static VALUE
|
|
359
|
+
ll_table_hyphenate(int argc, VALUE *argv, VALUE self)
|
|
360
|
+
{
|
|
361
|
+
const ID allowed[] = {id_translated};
|
|
362
|
+
VALUE input;
|
|
363
|
+
VALUE keywords = Qnil;
|
|
364
|
+
VALUE values[1];
|
|
365
|
+
VALUE input_storage;
|
|
366
|
+
VALUE hyphens;
|
|
367
|
+
int input_length;
|
|
368
|
+
int mode;
|
|
369
|
+
|
|
370
|
+
rb_scan_args(argc, argv, "1:", &input, &keywords);
|
|
371
|
+
ll_get_keywords(keywords, allowed, 1, values);
|
|
372
|
+
if (values[0] == Qundef || NIL_P(values[0]) || values[0] == Qfalse)
|
|
373
|
+
mode = 0;
|
|
374
|
+
else if (values[0] == Qtrue)
|
|
375
|
+
mode = 1;
|
|
376
|
+
else
|
|
377
|
+
rb_raise(rb_eTypeError, "translated must be true or false");
|
|
378
|
+
|
|
379
|
+
input_storage = ll_wide_storage_from_string(input, &input_length);
|
|
380
|
+
hyphens = ll_binary_storage((size_t)input_length + 1);
|
|
381
|
+
if (!lou_hyphenate(ll_table_name(self), LL_PTR(widechar, input_storage),
|
|
382
|
+
input_length, RSTRING_PTR(hyphens), mode))
|
|
383
|
+
rb_raise(ll_eTranslationError, "hyphenation failed for table %s",
|
|
384
|
+
ll_table_name(self));
|
|
385
|
+
rb_str_resize(hyphens, input_length);
|
|
386
|
+
rb_enc_associate(hyphens, rb_usascii_encoding());
|
|
387
|
+
return hyphens;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
static VALUE
|
|
391
|
+
ll_table_characters_to_dots(VALUE self, VALUE input)
|
|
392
|
+
{
|
|
393
|
+
VALUE input_storage;
|
|
394
|
+
VALUE output_storage;
|
|
395
|
+
int length;
|
|
396
|
+
|
|
397
|
+
input_storage = ll_wide_storage_from_string(input, &length);
|
|
398
|
+
output_storage = ll_binary_storage((size_t)length * sizeof(widechar));
|
|
399
|
+
if (length > 0 &&
|
|
400
|
+
!lou_charToDots(ll_table_name(self), LL_PTR(widechar, input_storage),
|
|
401
|
+
LL_PTR(widechar, output_storage), length, 0))
|
|
402
|
+
rb_raise(ll_eTranslationError,
|
|
403
|
+
"character-to-dots conversion failed for table %s",
|
|
404
|
+
ll_table_name(self));
|
|
405
|
+
return ll_braille_text_from_dot_storage(output_storage, length);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
static VALUE
|
|
409
|
+
ll_table_dots_to_characters(VALUE self, VALUE input)
|
|
410
|
+
{
|
|
411
|
+
VALUE input_storage;
|
|
412
|
+
VALUE output_storage;
|
|
413
|
+
int length;
|
|
414
|
+
|
|
415
|
+
input_storage = ll_back_input_storage(input, &length, NULL);
|
|
416
|
+
output_storage = ll_binary_storage((size_t)length * sizeof(widechar));
|
|
417
|
+
if (length > 0 &&
|
|
418
|
+
!lou_dotsToChar(ll_table_name(self), LL_PTR(widechar, input_storage),
|
|
419
|
+
LL_PTR(widechar, output_storage), length, 0))
|
|
420
|
+
rb_raise(ll_eTranslationError,
|
|
421
|
+
"dots-to-character conversion failed for table %s",
|
|
422
|
+
ll_table_name(self));
|
|
423
|
+
return ll_string_from_wide_storage(output_storage, length);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
void
|
|
427
|
+
ll_init_translation(void)
|
|
428
|
+
{
|
|
429
|
+
id_mode = rb_intern("mode");
|
|
430
|
+
id_cursor_position = rb_intern("cursor_position");
|
|
431
|
+
id_typeform = rb_intern("typeform");
|
|
432
|
+
id_translated = rb_intern("translated");
|
|
433
|
+
|
|
434
|
+
rb_define_method(ll_cBrailleTable, "translate", ll_table_translate, -1);
|
|
435
|
+
rb_define_alias(ll_cBrailleTable, "get_braille", "translate");
|
|
436
|
+
rb_define_method(ll_cBrailleTable, "back_translate", ll_table_back_translate, -1);
|
|
437
|
+
rb_define_alias(ll_cBrailleTable, "get_text", "back_translate");
|
|
438
|
+
rb_define_method(ll_cBrailleTable, "hyphenate", ll_table_hyphenate, -1);
|
|
439
|
+
rb_define_method(ll_cBrailleTable, "characters_to_dots",
|
|
440
|
+
ll_table_characters_to_dots, 1);
|
|
441
|
+
rb_define_method(ll_cBrailleTable, "dots_to_characters",
|
|
442
|
+
ll_table_dots_to_characters, 1);
|
|
443
|
+
}
|
data/liblouis-rb.gemspec
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
vendor_root = File.expand_path("vendor/liblouis", __dir__)
|
|
4
|
+
unless File.file?(File.join(vendor_root, "liblouis/liblouis.h.in")) &&
|
|
5
|
+
File.file?(File.join(vendor_root, "configure.ac")) &&
|
|
6
|
+
Dir.exist?(File.join(vendor_root, "tables"))
|
|
7
|
+
raise "Liblouis sources are missing. Run: git submodule update --init --recursive"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Gem::Specification.new do |spec|
|
|
11
|
+
spec.name = "liblouis-rb"
|
|
12
|
+
spec.version = "0.1.0"
|
|
13
|
+
spec.authors = ["Dawid Pieper", "liblouis contributors"]
|
|
14
|
+
spec.summary = "Native Ruby bindings for Liblouis"
|
|
15
|
+
spec.description = <<~DESCRIPTION.strip
|
|
16
|
+
A single native Ruby extension that embeds Liblouis library, allowing translations from and to Braille notation.
|
|
17
|
+
DESCRIPTION
|
|
18
|
+
spec.licenses = ["LGPL-2.1-or-later"]
|
|
19
|
+
spec.required_ruby_version = ">= 3.1"
|
|
20
|
+
spec.email = ["dawidpieper@o2.pl"]
|
|
21
|
+
spec.homepage = "https://github.com/dawidpieper/liblouis-rb"
|
|
22
|
+
|
|
23
|
+
extension_files = %w[
|
|
24
|
+
ext/liblouis/extconf.rb
|
|
25
|
+
ext/liblouis/liblouis_ext.h
|
|
26
|
+
ext/liblouis/liblouis.c
|
|
27
|
+
ext/liblouis/braille_character.c
|
|
28
|
+
ext/liblouis/braille_text.c
|
|
29
|
+
ext/liblouis/braille_table.c
|
|
30
|
+
ext/liblouis/translation.c
|
|
31
|
+
ext/liblouis/table_source.c
|
|
32
|
+
]
|
|
33
|
+
vendor_files = Dir[
|
|
34
|
+
"vendor/liblouis/liblouis/*.{c,h,h.in}",
|
|
35
|
+
"vendor/liblouis/tables/**/*",
|
|
36
|
+
"vendor/liblouis/configure.ac",
|
|
37
|
+
"vendor/liblouis/COPYING*"
|
|
38
|
+
].select { |file| File.file?(file) }
|
|
39
|
+
test_files = Dir["test/**/*.rb", "spec/**/*.rb"]
|
|
40
|
+
|
|
41
|
+
spec.files = extension_files + vendor_files + test_files + %w[
|
|
42
|
+
README.md
|
|
43
|
+
LICENSE
|
|
44
|
+
liblouis-rb.gemspec
|
|
45
|
+
Rakefile
|
|
46
|
+
]
|
|
47
|
+
spec.extensions = ["ext/liblouis/extconf.rb"]
|
|
48
|
+
spec.require_paths = ["lib"]
|
|
49
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "minitest/autorun"
|
|
4
|
+
|
|
5
|
+
$LOAD_PATH.unshift(File.expand_path("../ext/liblouis", __dir__))
|
|
6
|
+
require "liblouis"
|
|
7
|
+
require_relative "../test/translation_cases"
|
|
8
|
+
require_relative "../test/table_source_cases"
|
|
9
|
+
require "stringio"
|
|
10
|
+
|
|
11
|
+
describe LibLouis do
|
|
12
|
+
it "translates the requested regression corpus" do
|
|
13
|
+
TranslationCases::CASES.each do |test_case|
|
|
14
|
+
table = LibLouis::BrailleTable.new(test_case[:table])
|
|
15
|
+
braille = table.translate(test_case[:source])
|
|
16
|
+
|
|
17
|
+
_(braille).must_be_instance_of LibLouis::BrailleText
|
|
18
|
+
_(braille.to_s).must_equal test_case[:braille]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "round-trips the bidirectional requested tables" do
|
|
23
|
+
TranslationCases::CASES.each do |test_case|
|
|
24
|
+
next unless test_case.key?(:back_translation)
|
|
25
|
+
|
|
26
|
+
table = LibLouis::BrailleTable.new(test_case[:table])
|
|
27
|
+
braille = table.translate(test_case[:source])
|
|
28
|
+
|
|
29
|
+
_(table.back_translate(braille)).must_equal test_case[:back_translation]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "exposes eight-dot cells without a Ruby implementation layer" do
|
|
34
|
+
cell = LibLouis::BrailleCharacter.new(255)
|
|
35
|
+
|
|
36
|
+
_(cell.dots).must_equal((1..8).to_a)
|
|
37
|
+
_(cell.unicode_character).must_equal "⣿"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "accepts IO sources inside a table list" do
|
|
41
|
+
source = StringIO.new(TableSourceCases::CUSTOM_TABLE)
|
|
42
|
+
table = LibLouis::BrailleTable.new([source])
|
|
43
|
+
|
|
44
|
+
_(table).must_be :valid?
|
|
45
|
+
_(table.translate("a").to_s).must_equal "⠿"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "uses semantic symbols for typeforms" do
|
|
49
|
+
table = LibLouis::BrailleTable.new("en-GB-g2.ctb")
|
|
50
|
+
text = "Test"
|
|
51
|
+
|
|
52
|
+
_(table.emphasis_classes).must_include :italic
|
|
53
|
+
_(table.translate(text, typeform: Array.new(text.length, :plain_text)))
|
|
54
|
+
.must_be_instance_of LibLouis::BrailleText
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "uses semantic symbols for translation modes" do
|
|
58
|
+
table = LibLouis::BrailleTable.new("en-GB-g2.ctb")
|
|
59
|
+
|
|
60
|
+
_(table.translate("the", mode: :no_contractions).to_s).must_equal "⠞⠓⠑"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "minitest/autorun"
|
|
4
|
+
require "fileutils"
|
|
5
|
+
require "open3"
|
|
6
|
+
require "rbconfig"
|
|
7
|
+
require "rubygems/package"
|
|
8
|
+
require "tmpdir"
|
|
9
|
+
|
|
10
|
+
class PackagingTest < Minitest::Test
|
|
11
|
+
ROOT = File.expand_path("../..", __dir__)
|
|
12
|
+
PACKAGE_ROOT = File.join(ROOT, "pkg")
|
|
13
|
+
|
|
14
|
+
def test_gem_installs_in_a_path_with_spaces_without_submodule_metadata
|
|
15
|
+
with_package_directory do |directory|
|
|
16
|
+
gem_path = File.join(directory, "liblouis-rb.gem")
|
|
17
|
+
run_ruby("-S", "gem", "build", "liblouis-rb.gemspec", "--output", gem_path)
|
|
18
|
+
package = Gem::Package.new(gem_path)
|
|
19
|
+
package.verify
|
|
20
|
+
%w[configure.ac COPYING COPYING.LESSER liblouis/liblouis.h.in tables/en-gb-comp8.ctb].each do |file|
|
|
21
|
+
assert_includes package.spec.files, "vendor/liblouis/#{file}"
|
|
22
|
+
end
|
|
23
|
+
refute package.spec.files.any? { |file| file.split("/").include?(".git") || file.end_with?(".gitmodules") }
|
|
24
|
+
|
|
25
|
+
install_dir = File.join(directory, "gem home")
|
|
26
|
+
run_ruby("-S", "gem", "install", gem_path, "--local", "--no-document",
|
|
27
|
+
"--ignore-dependencies", "--no-user-install",
|
|
28
|
+
"--install-dir", install_dir, "--bindir", File.join(directory, "bin"))
|
|
29
|
+
smoke_test = <<~'CODE'
|
|
30
|
+
Gem.use_paths(ARGV.fetch(0), [ARGV.fetch(0)])
|
|
31
|
+
require "liblouis"
|
|
32
|
+
installed = Gem.loaded_specs.fetch("liblouis-rb").full_gem_path
|
|
33
|
+
abort "Git metadata was packaged" if File.exist?(File.join(installed, ".git"))
|
|
34
|
+
table = LibLouis::BrailleTable.new("en-gb-comp8.ctb")
|
|
35
|
+
abort "Bundled tables failed" unless table.back_translate(table.translate("hello")) == "hello"
|
|
36
|
+
abort "Copy lost its mask" unless LibLouis::BrailleCharacter.new(137).dup.mask == 137
|
|
37
|
+
puts LibLouis.version
|
|
38
|
+
CODE
|
|
39
|
+
expected_version = File.read(File.join(ROOT, "vendor/liblouis/configure.ac"))[
|
|
40
|
+
/AC_INIT\(\[Liblouis\],\s*\[([0-9.]+)\]/, 1
|
|
41
|
+
]
|
|
42
|
+
assert_equal expected_version, run_ruby("-e", smoke_test, install_dir, chdir: directory).strip
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_missing_submodule_stops_packaging_and_compilation_with_instructions
|
|
47
|
+
with_package_directory do |directory|
|
|
48
|
+
FileUtils.cp(File.join(ROOT, "liblouis-rb.gemspec"), directory)
|
|
49
|
+
extension_dir = File.join(directory, "ext/liblouis")
|
|
50
|
+
FileUtils.mkdir_p(extension_dir)
|
|
51
|
+
FileUtils.cp(File.join(ROOT, "ext/liblouis/extconf.rb"), extension_dir)
|
|
52
|
+
commands = [
|
|
53
|
+
[directory, ["-S", "gem", "build", "liblouis-rb.gemspec"]],
|
|
54
|
+
[extension_dir, ["extconf.rb"]]
|
|
55
|
+
]
|
|
56
|
+
commands.each do |working_dir, arguments|
|
|
57
|
+
output, status = Open3.capture2e(RbConfig.ruby, *arguments, chdir: working_dir)
|
|
58
|
+
refute status.success?, output
|
|
59
|
+
assert_includes output, "git submodule update --init --recursive"
|
|
60
|
+
end
|
|
61
|
+
assert_empty Dir[File.join(directory, "*.gem")]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def run_ruby(*arguments, chdir: ROOT)
|
|
68
|
+
output, status = Open3.capture2e(RbConfig.ruby, *arguments, chdir: chdir)
|
|
69
|
+
assert status.success?, output
|
|
70
|
+
output
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def with_package_directory
|
|
74
|
+
FileUtils.mkdir_p(PACKAGE_ROOT)
|
|
75
|
+
Dir.mktmpdir("package-test ", PACKAGE_ROOT) do |directory|
|
|
76
|
+
unless File.realpath(directory).start_with?(File.realpath(PACKAGE_ROOT) + "/")
|
|
77
|
+
raise "Unexpected package test directory"
|
|
78
|
+
end
|
|
79
|
+
yield directory
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|