| 1 |
#charset "win1251" |
| 2 |
#include <tads.h> |
| 3 |
#include <strcomp.h> |
| 4 |
|
| 5 |
main(args) |
| 6 |
{ |
| 7 |
local comp = new StringComparator(6, nil, |
| 8 |
[ |
| 9 |
['\u00DF', 'ss', 0x0100, 0x0200], // Eszett, DOS Alt+225 |
| 10 |
['\u00E0', 'a', 0x1000, 0x2000], // a-grave, DOS Alt+133 |
| 11 |
['\u00E1', 'a', 0x4000, 0x8000], // a-acute, DOS Alt+160 |
| 12 |
['\u00FC', 'ue', 0x4000, 0x8000] // u-umlaut, DOS Alt+129 |
| 13 |
]); |
| 14 |
|
| 15 |
"Type QUIT to quit.\n"; |
| 16 |
for (;;) |
| 17 |
{ |
| 18 |
local s1, s2; |
| 19 |
local m, h1, h2; |
| 20 |
|
| 21 |
|
| 22 |
"\bDictionary string: "; |
| 23 |
s1 = inputLine(); |
| 24 |
if (s1.toLower() == 'quit') |
| 25 |
break; |
| 26 |
|
| 27 |
"Input string: "; |
| 28 |
s2 = inputLine(); |
| 29 |
|
| 30 |
m = comp.matchValues(s2, s1); |
| 31 |
h1 = comp.calcHash(s1); |
| 32 |
h2 = comp.calcHash(s2); |
| 33 |
"Match = <<toString(m, 16)>>, |
| 34 |
hash(<<s1>>) = <<h1>>, hash(<<s2>>) = <<h2>>"; |
| 35 |
|
| 36 |
if (m != 0 && h1 != h2) |
| 37 |
"\n*** HASH MISMATCH!!! ***\n"; |
| 38 |
} |
| 39 |
} |
| 40 |
|