[Oberon] repair to HTMLDocs.Mod.

shark at gulfnet.sd64.bc.ca shark at gulfnet.sd64.bc.ca
Wed May 11 00:11:50 CEST 2005


Oberon users,

"TRAP 7  Index out of range (PC Native 05.01.2003)"
was turning up too often when viewing Web pages.

For example "Desktops.OpenDoc  http://www.debian.org/" 
yielded 
"TRAP 7  Index out of range (PC Native 05.01.2003)
HTMLDocs.WriteCharRef  PC = 17182"
and "Desktops.OpenDoc http://www.w3.org/MarkUp/" yielded
"TRAP 7  Index out of range (PC Native 05.01.2003)  
HTMLDocs.CharRefStr  PC = 18458"

A little study of HTMLDocs.Mod reveals that such 
a trap happens from an attempt to evaluate 
Strings.ISOToOberon[i] with i > 255 while ISOToOberon 
contains 256 characters.

The simple solution is to check the validity of 
the index before evaluating the array.  For 
characters not available in the system, nul character
0 can be substituted.  This doesn't allow us to 
see the non-english text on http://www.debian.org/
but at least the page can open without a trap.
My "repaired" HTMLDocs.Mod is available via  
Desktops.OpenDoc http://carnot.pathology.ubc.ca/oberon.html .
You might need to scroll down a little.  The 
commands are there to get the file, Diff it and 
Compile it. 

A more general observation.  HTMLDocs.Mod
recognizes HTML numeric character references for 
ISO 8859-1, Greek and Math characters.  The mapping
from numeric character references to Oberon fonts is 
implemented with three techniques. 
1. The mapping to ISO 8859-1 is by evaluating the 
array ISOToOberon.
2. The mapping to the Greek font is by the Consts
GreekCap = "0013 ..." and GreekMin = "0045 ...".
3. The mapping to the Math font is by a long CASE
statement.

Also, a few HTML character entity names are mapped 
to fonts by a CASE statement.

Incorporating the characters and font for another 
language, Arabic for example, is non-trivial task.

In principle, expansion of ISOToOberon to 
UnicodeToOberon would allow a simpler mapping of 
characters to fonts and would make the incorporation 
of Arabic much simpler.  Does this happen in Aos?

Thanks,           ... Peter

      Desktops.OpenDoc  http://carnot.pathology.ubc.ca/




More information about the Oberon mailing list