Hi,
Here's some more patches.
The first one adds the plusminus sign to the list of special
treatment characters which the latin1 input encoding should handle
properly, but doesn't (in my tetex installation). It just puts an
explicit $\pm$ which does work.
(This patch also contains the "bit flip" of the Swedish code page
from 1250 to 1252, which was submitted earlier, but never committed
or remarked upon except by Caolan).
Then the second patch. It contains a rewriting of part of the
routine mySpecCharProc, which among other things handles the
"special characters" known as embedded graphics.
What I did was put the handling of embedded graphics, and the handling of
erroneous such, into two separate subroutines: wvStrangeNoGraphicData()
and wvPrintGraphics. This is in preparation for allowing graphic output on
the LaTeX side. Currently LaTeX documents contain the inappropriate HTML
graphics codes <img alt= ... src= ... > you know the drill.
This patch has no effect on functionality for HTML, but with
--config wvLaTeX.xml placeholder strings are embedded in the output.
As this also makes the code a little cleaner, I hope it is acceptable.
Martin
--
Martin Vermeer [EMAIL PROTECTED] Phone +358 9 295 55 215 Fax +358 9 295 55 200
Finnish Geodetic Institute Geodeetinrinne 2 FIN-02430 Masala FINLAND
:wq
Index: text.c
===================================================================
RCS file: /cvsroot/wv/text.c,v
retrieving revision 1.46
diff -u -r1.46 text.c
--- text.c 2000/08/23 02:19:38 1.46
+++ text.c 2000/08/24 08:16:54
@@ -135,7 +135,7 @@
return("CP1252");
case 0x041b: /*Slovak*/ return("CP1250");
case 0x041c: /*Albanian*/ return("CP1251");
- case 0x041d: /*Swedish*/ return("CP1250");
+ case 0x041d: /*Swedish*/ return("CP1252");
case 0x041e: /*Thai*/ return("CP874");
case 0x041f: /*Turkish*/ return("CP1254");
case 0x0420: /*Urdu*/ return("CP1256");
@@ -555,6 +555,9 @@
switch(char16)
{
/* Fix up these as math characters: */
+ case 0xb1:
+ printf("$\\pm$");
+ return(1);
case 0xb2:
printf("$\\mathtwosuperior$");
return(1);
Index: wvHtml.c
===================================================================
RCS file: /cvsroot/wv/wvHtml.c,v
retrieving revision 1.43
diff -u -r1.43 wvHtml.c
--- wvHtml.c 2000/06/06 00:55:16 1.43
+++ wvHtml.c 2000/08/24 08:17:16
@@ -26,6 +26,8 @@
0 on success
*/
+char *config=NULL;
+
int myelehandler(wvParseStruct *ps,wvTag tag, void *props, int dirty);
int mydochandler(wvParseStruct *ps,wvTag tag);
int myCharProc(wvParseStruct *ps,U16 eachchar,U8 chartype,U16 lid);
@@ -174,7 +176,6 @@
{
FILE *input;
char *password=NULL;
- char *config=NULL;
char *dir=NULL;
int ret;
state_data myhandle;
@@ -484,7 +485,30 @@
return(0);
}
+void wvStrangeNoGraphicData(char *config, int graphicstype)
+ {
+ wvError(("Strange No Graphic Data in the 0x01 graphic\n"));
+ if (strcmp(config, "wvLaTeX.xml") == 0)
+ printf("\n -- 0x%2x graphic: StrangeNoGraphicData -- \n",
+graphicstype);
+ else
+ printf("<img alt=\"0x%2x graphic\" src=\"%s\"><br>", graphicstype,
+ "StrangeNoGraphicData");
+ return;
+ }
+
+void wvPrintGraphics(char *config, int graphicstype, int width, int height,
+ char* source)
+ {
+ if (strcmp(config, "wvLaTeX.xml") == 0)
+ printf("\n -- width %d, height %d graphic of type 0x%2x: file \"%s\"
+-- \n",
+ width, height, graphicstype, source);
+ else
+ printf("<img width=\"%d\" height=\"%d\" alt=\"0x%2x graphic\"
+src=\"%s\"><br>",
+ width, height, graphicstype, source);
+ return;
+ }
+
int mySpecCharProc(wvParseStruct *ps,U16 eachchar,CHP *achp)
{
static int message,state;
@@ -552,14 +576,14 @@
{
wvTrace(("Here\n"));
name = wvHtmlGraphic(ps,&blip);
- printf("<img width=\"%d\" height=\"%d\" alt=\"0x01
graphic\"
src=\"%s\"><br>",(int)wvTwipsToHPixels(picf.dxaGoal),(int)wvTwipsToVPixels(picf.dyaGoal),name);
+ wvPrintGraphics(config, 0x01,
+ (int)wvTwipsToHPixels(picf.dxaGoal),
+ (int)wvTwipsToVPixels(picf.dyaGoal),
+ name);
wvFree(name);
}
else
- {
- wvError(("Strange No Graphic Data in the 0x01
graphic\n"));
- printf("<img alt=\"0x08 graphic\"
src=\"%s\"><br>","StrangeNoGraphicData");
- }
+ wvStrangeNoGraphicData(config, 0x01);
wvStream_goto(ps->data,p);
return(0);
}
@@ -577,16 +601,14 @@
{
wvTrace(("Here\n"));
name = wvHtmlGraphic(ps,&blip);
- printf("<img width=\"%d\"
height=\"%d\" alt=\"0x08 graphic\" src=\"%s\"><br>",
-
(int)wvTwipsToHPixels(fspa->xaRight-fspa->xaLeft),(int)wvTwipsToVPixels(fspa->yaBottom-fspa->yaTop),
+ wvPrintGraphics(config, 0x08,
+
+(int)wvTwipsToHPixels(fspa->xaRight-fspa->xaLeft),
+
+(int)wvTwipsToVPixels(fspa->yaBottom-fspa->yaTop),
name);
wvFree(name);
}
else
- {
- wvError(("Strange No Graphic Data in
the 0x01 graphic\n"));
- printf("<img alt=\"0x08 graphic\"
src=\"%s\"><br>","StrangeNoGraphicData");
- }
+ wvStrangeNoGraphicData(config, 0x08);
}
else
{