Skip to content

Commit

Permalink
Reorder typeform bits (BREAKS BACKWARDS COMPATIBILITY), remove word-r…
Browse files Browse the repository at this point in the history
…eset typeform.

This removes tests from tests/yaml/en-ueb-08-capitalization.yaml that used the word_reset typeform.
  • Loading branch information
dkager committed Jun 23, 2016
1 parent 6612beb commit 5d8b833
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 99 deletions.
21 changes: 10 additions & 11 deletions liblouis/liblouis.h.in
Expand Up @@ -48,17 +48,16 @@ typedef unsigned short formtype;
italic = 0x0001, // emph_1
underline = 0x0002, // emph_2
bold = 0x0004, // emph_3
computer_braille = 0x0008,
no_translate = 0x0010,
word_reset = 0x0020,
emph_4 = 0x0040,
emph_5 = 0x0080,
emph_6 = 0x0100,
emph_7 = 0x0200,
emph_8 = 0x0400,
emph_9 = 0x0800,
emph_10 = 0x1000,
no_contract = 0x2000,
emph_4 = 0x0008,
emph_5 = 0x0010,
emph_6 = 0x0020,
emph_7 = 0x0040,
emph_8 = 0x0080,
emph_9 = 0x0100,
emph_10 = 0x0200,
computer_braille = 0x0400,
no_translate = 0x0800,
no_contract = 0x1000,
// used by syllable 0x4000,
// used by syllable 0x8000,
} typeforms;
Expand Down
2 changes: 1 addition & 1 deletion liblouis/lou_backTranslateString.c
Expand Up @@ -320,7 +320,7 @@ backTranslateWithTracing (const char *tableList, const widechar * inbuf,
return goodTrans;
}

static char currentTypeform = plain_text;
static formtype currentTypeform = plain_text;
static int nextUpper = 0;
static int allUpper = 0;
static int allUpperPhrase = 0;
Expand Down
3 changes: 0 additions & 3 deletions liblouis/lou_translateString.c
Expand Up @@ -3261,9 +3261,6 @@ markEmphases()
caps_cnt = 0;
}

if(typebuf[i] & word_reset)
wordBuffer[i] |= WORD_RESET;

if(checkAttr(currentInput[i], CTC_UpperCase, 0))
{
if(caps_start < 0)
Expand Down
27 changes: 13 additions & 14 deletions python/louis/__init__.py.in
Expand Up @@ -309,20 +309,19 @@ def compileString(tableList, inString):

#{ Typeforms
plain_text = 0x0000
italic = 0x0001
underline = 0x0002
bold = 0x0004
computer_braille = 0x0008
no_translate = 0x0010
word_reset = 0x0020
emph_4 = 0x0040
emph_5 = 0x0080
emph_6 = 0x0100
emph_7 = 0x0200
emph_8 = 0x0400
emph_9 = 0x0800
emph_10 = 0x1000
no_contract = 0x2000
italic = 0x0001 # emph_1
underline = 0x0002 # emph_2
bold = 0x0004 # emph_3
emph_4 = 0x0008
emph_5 = 0x0010
emph_6 = 0x0020
emph_7 = 0x0040
emph_8 = 0x0080
emph_9 = 0x0100
emph_10 = 0x0200
computer_braille = 0x0400
no_translate = 0x0800
no_contract = 0x1000
#}

#{ Translation modes
Expand Down
45 changes: 0 additions & 45 deletions tests/yaml/en-ueb-08-capitalization.yaml
Expand Up @@ -46,14 +46,6 @@ tests:
- ',,.p.b.f'
- - DipTP
- ',dip,,tp'
- - NEW YORK
- ',,new ,,york'
- typeform:
word_reset: " + "
- - TVOntario
- ',,tv,ont>io'
- typeform:
word_reset: " + "
- - '"GO quickly and TAKE CARE!"'
- 8,,g qkly & ,,take ,,c>e60
- - ANGLO-SAXON
Expand Down Expand Up @@ -105,16 +97,6 @@ tests:
- - SWIFT & CO.
- ',,swift `& ,,co4'
- xfail: true
- - FREEform
- ',,free~1=m'
- typeform:
word_reset: " + "
bold: " ++++"
- - EXAMINE
- ',e.2,,xam9e'
- typeform:
word_reset: " + "
italic: " + "

# 8.5.3 page 83

Expand Down Expand Up @@ -213,30 +195,11 @@ tests:
- ;,,cd ,,cd,'s
- - 'RV: Recreational Vehicle–Let''s go RVing.'
- ',,rv3 ,recr1;nal ,vehicle,-,let''s g ,,rv,''+4'
- - www.BLASTSoundMachine.com
- www4,,bla/,s.d,ma*9e4com
- typeform:
word_reset: " + "
- - www.BLASTsoundmachine.com
- www4,,bla/,'s.dma*9e4com

# 8.8.2 page 88

- - KBr (potassium bromide)
- ',k,br "<potassium bromide">'
- typeform:
word_reset: " + "

- - BSc (Bachelor of Science)
- ',b,sc "<,ba*elor ( ,sci;e">'
- typeform:
word_reset: " + "

- - TVOntario
- ',,tv,ont>io'
- typeform:
word_reset: " + "

- - preSENT
- pre,,s5t

Expand All @@ -245,11 +208,3 @@ tests:

- - WoooooooOOOOOOOOooooooo (a ghostly sound)
- ',wooooooo,,oooooooo,''ooooooo "<a <o/ly s.d">'

- - MHz
- ',m,hz'
- typeform: {word_reset: " + "}

- - ATandT
- ',a,t&,t'
- typeform: {word_reset: " + "}
3 changes: 0 additions & 3 deletions tools/lou_checkyaml.c
Expand Up @@ -308,9 +308,6 @@ read_typeforms (yaml_parser_t *parser, int len) {
if (!strcmp(event.data.scalar.value, "computer_braille")) {
yaml_event_delete(&event);
read_typeform_string(parser, typeform, computer_braille, len);
} else if (!strcmp(event.data.scalar.value, "word_reset")) {
yaml_event_delete(&event);
read_typeform_string(parser, typeform, word_reset, len);
} else {
int i;
typeforms kind = plain_text;
Expand Down
8 changes: 0 additions & 8 deletions tools/lou_compare.c
Expand Up @@ -344,12 +344,6 @@ int main(int argn, char **args)
else
return 1;

if(!strncmp("~word_reset", inputLine, 11))
if(inputEmphasis(word_reset, resetLine, resetText, &resetLen))
continue;
else
return 1;

if(!strncmp("~trans_note_1", inputLine, 13))
if(inputEmphasis(emph_6, tnote1Line, tnote1Text, &tnote1Len))
continue;
Expand Down Expand Up @@ -471,8 +465,6 @@ int main(int argn, char **args)
outputEmphasis(outFile, 0, "~italic", italicText, italicLen);
if(scriptLen)
outputEmphasis(outFile, 0, "~script", scriptText, scriptLen);
if(resetLen)
outputEmphasis(outFile, 0, "~word_reset", resetText, resetLen);
if(tnoteLen)
outputEmphasis(outFile, 0, "~trans_note", tnoteText, tnoteLen);

Expand Down
26 changes: 12 additions & 14 deletions windows/include/liblouis.h
Expand Up @@ -35,9 +35,8 @@ extern "C"
#define UNICODEBITS 16
#endif

#define widechar WIDECHAR_TYPE
#define formtype unsigned char

typedef WIDECHAR_TYPE widechar;
typedef unsigned short formtype;

#ifdef _WIN32
#define EXPORT_CALL __stdcall
Expand All @@ -52,17 +51,16 @@ char * EXPORT_CALL lou_getProgramPath (void);
italic = 0x0001, // emph_1
underline = 0x0002, // emph_2
bold = 0x0004, // emph_3
computer_braille = 0x0008,
no_translate = 0x0010,
word_reset = 0x0020,
emph_4 = 0x0040,
emph_5 = 0x0080,
emph_6 = 0x0100,
emph_7 = 0x0200,
emph_8 = 0x0400,
emph_9 = 0x0800,
emph_10 = 0x1000,
no_contract = 0x2000,
emph_4 = 0x0008,
emph_5 = 0x0010,
emph_6 = 0x0020,
emph_7 = 0x0040,
emph_8 = 0x0080,
emph_9 = 0x0100,
emph_10 = 0x0200,
computer_braille = 0x0400,
no_translate = 0x0800,
no_contract = 0x1000,
// used by syllable 0x4000,
// used by syllable 0x8000,
} typeforms;
Expand Down

0 comments on commit 5d8b833

Please sign in to comment.