[sword-devel] for the love of unicode

Stuart D. Gathman sword-devel@crosswire.org
Sat, 16 Jun 2001 12:08:00 -0400


Chris Little wrote:

> The per-character encoding filters are not going too well.  I tried an
> STL map and after about 15 minutes, gcc crashed.  So I tried a simple
> array, even though it would have to be 21000 shorts in size despite
> containing only 7000 actual codepoints.  After about 15 minutes, gcc
> crashed with that too.  So that leaves me with a giant switch as the
> only option I can think of that actually works.  Breaking it up into a
> high-byte switch and numerous smaller low-byte switches might ease the
> compiler's workload somewhat and simplify the jump tables, but I don't
> know anything about compilers so I'm just guessing.

For large tables, use a "resource" file.  Read the array of short from a
file.  Parsing a text file is the simplest for cross platform, but a binary
file can be preparsed as part of the build.

--
                        Stuart D. Gathman
      Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
                "Microsoft is the QWERTY of Operating Systems" - SDG
      "Confutatis maledictis, flamis acribus addictis" - background song for
      a Microsoft sponsored "Where do you want to go from here?" commercial.
  (HINT: The song is "Dies Irae" from the Mozart Requiem.)