Fixed some bugs in international files.

This commit is contained in:
slidedraw 2002-04-15 19:36:52 +00:00
parent 1862b0b4f4
commit 0f3cca5a24
5 changed files with 98 additions and 122 deletions

View File

@ -12,7 +12,7 @@ LDADD = ../cole/libcole.a
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
xldump_SOURCES = xldump.c xldump_SOURCES = xldump.c
xlcdump_SOURCES = xlcdump.c xlcdump_SOURCES = xlcdump.c
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith AM_CFLAGS = -Wall -ansi -pedantic -Wshadow -Wcast-align -Wpointer-arith
support.o: version.h support.o: version.h
doc: doc:

View File

@ -86,7 +86,7 @@ LDADD = ../cole/libcole.a
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
xldump_SOURCES = xldump.c xldump_SOURCES = xldump.c
xlcdump_SOURCES = xlcdump.c xlcdump_SOURCES = xlcdump.c
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith AM_CFLAGS = -Wall -ansi -pedantic -Wshadow -Wcast-align -Wpointer-arith
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =

View File

@ -1,55 +1,14 @@
#include "xlhtml.h" #include "xlhtml.h"
extern void do_cr(void); extern void do_cr(void);
extern int center_tables;
extern int first_sheet; extern int first_sheet;
extern int last_sheet; extern int last_sheet;
extern uni_string default_font;
extern void trim_sheet_edges(unsigned int);
extern int next_ws_title;
extern void update_default_font(unsigned int);
extern void OutputString(uni_string * ); extern void OutputString(uni_string * );
extern int default_fontsize;
extern char *default_alignment;
extern int aggressive;
extern char *lastUpdated;
extern int file_version;
extern int NoFormat;
extern int notAccurate;
extern int formula_warnings;
extern int NoHeaders;
extern int NotImplemented;
extern int Unsupported;
extern int MaxWorksheetsExceeded;
extern int MaxRowExceeded;
extern int MaxColExceeded;
extern int MaxStringsExceeded;
extern int MaxFontsExceeded;
extern int MaxPalExceeded;
extern int MaxXFExceeded;
extern int MaxFormatsExceeded;
extern char colorTab[MAX_COLORS];
extern char *default_text_color;
extern char *default_background_color;
extern char *default_image;
extern char filename[256]; extern char filename[256];
extern int UnicodeStrings;
extern int CodePage;
extern char *title;
extern void update_default_alignment(unsigned int, int);
extern void output_cell( cell *, int); extern void output_cell( cell *, int);
extern uni_string author;
extern int null_string(U8 *);
extern int Csv; extern int Csv;
work_sheet **ws_array; work_sheet **ws_array;
font_attr **font_array;
xf_attr **xf_array; xf_attr **xf_array;
extern int IsCellNumeric(cell *); extern int IsCellNumeric(cell *);

View File

@ -1144,7 +1144,7 @@ void main_line_processor(U16 opcode, U16 version, U32 count, U16 last, U8 data)
{ {
if ((file_version == EXCEL95)&&(bufidx == last)) if ((file_version == EXCEL95)&&(bufidx == last))
{ /* Microsoft doesn't stick to their documentation. Excel 97 is supposed { /* Microsoft doesn't stick to their documentation. Excel 97 is supposed
to be 0x0231...but its not. Have to use file_version to separate them. */ to be 0x0231...but it's not. Have to use file_version to separate them. */
unsigned int i; unsigned int i;
U16 size, attr, c_idx, b, su; U16 size, attr, c_idx, b, su;
U8 u; U8 u;
@ -1167,7 +1167,7 @@ void main_line_processor(U16 opcode, U16 version, U32 count, U16 last, U8 data)
} }
else if ((file_version == EXCEL97)&&(bufidx == last)) else if ((file_version == EXCEL97)&&(bufidx == last))
{ /* Microsoft doesn't stick to their documentation. Excel 97 is supposed { /* Microsoft doesn't stick to their documentation. Excel 97 is supposed
to be 0x0231...but its not. Have to use file_version to separate them. */ to be 0x0231...but it's not. Have to use file_version to separate them. */
unsigned int i; unsigned int i;
U16 len; U16 len;
U16 size, attr, c_idx, b, su; U16 size, attr, c_idx, b, su;
@ -1182,7 +1182,7 @@ void main_line_processor(U16 opcode, U16 version, U32 count, U16 last, U8 data)
buflast = working_buffer[14]; buflast = working_buffer[14];
for (i=0; i<(buflast-2); i++) for (i=0; i<(buflast-2); i++)
{ /* This looks at the 2nd byte to see if its unicode... */ { /* This looks at the 2nd byte to see if it's unicode... */
if (working_buffer[(i<<1)+17] != 0) if (working_buffer[(i<<1)+17] != 0)
uni = 2; uni = 2;
} }
@ -2517,7 +2517,7 @@ void output_cell(cell *c, int xml)
else if (c->spanned != 0) else if (c->spanned != 0)
return; return;
else else
{ /* Determine whether or not its of numeric origin.. */ { /* Determine whether or not it is of numeric origin.. */
int numeric = IsCellNumeric(c); /* 0=Text 1=Numeric */ int numeric = IsCellNumeric(c); /* 0=Text 1=Numeric */
html_flag_init(&h); html_flag_init(&h);
if (c->xfmt == 0) if (c->xfmt == 0)
@ -2652,7 +2652,7 @@ void output_cell(cell *c, int xml)
tcolor = xf_array[c->xfmt]->b_t_color & 0x007F; tcolor = xf_array[c->xfmt]->b_t_color & 0x007F;
bcolor = (xf_array[c->xfmt]->b_t_color & 0x3F80) >> 7; bcolor = (xf_array[c->xfmt]->b_t_color & 0x3F80) >> 7;
if (((lcolor & rcolor & tcolor & bcolor) == lcolor)&&(lcolor < MAX_COLORS)) if (((lcolor & rcolor & tcolor & bcolor) == lcolor)&&(lcolor < MAX_COLORS))
{ /* if they are all the same...do it...that is if its different from BLACK */ { /* if they are all the same...do it...that is if it's different from BLACK */
if (numCustomColors == 0) /* Don't do custom borders */ if (numCustomColors == 0) /* Don't do custom borders */
{ {
if ((strcmp(colorTab[lcolor], "000000") != 0)&&(strcmp(colorTab[lcolor], "FFFFFF") != 0)) if ((strcmp(colorTab[lcolor], "000000") != 0)&&(strcmp(colorTab[lcolor], "FFFFFF") != 0))
@ -2995,11 +2995,11 @@ void output_formatted_data(uni_string *u, U16 idx, int numeric, int formula)
if (Csv) if (Csv)
printf("\""); printf("\"");
break; break;
case 0x31: /* Text - if we are here...its a number */ case 0x31: /* Text - if we are here...it's a number */
dnum = atof((char *)u->str); dnum = atof((char *)u->str);
printf("%g", dnum); printf("%g", dnum);
break; break;
default: /* Unsupported...but, if we are here, its a number */ default: /* Unsupported...but, if we are here, it's a number */
{ {
char *ptr = strchr((char *)u->str, '.'); char *ptr = strchr((char *)u->str, '.');
if( OutputXML ) if( OutputXML )
@ -3016,7 +3016,7 @@ void output_formatted_data(uni_string *u, U16 idx, int numeric, int formula)
} }
else else
{ {
num = atol((char *)u->str); num = atol((char *)u->str);
if (Csv) if (Csv)
printf("%ld", num); printf("%ld", num);
else if (OutputXML) else if (OutputXML)
@ -3080,7 +3080,7 @@ void PrintFloatComma(char *fformat, int is_currency, F64 d)
else else
neg = 0; neg = 0;
/* reverse the string. Its easier to work this way. */ /* reverse the string. It's easier to work this way. */
for (i=0, j=len-1; i<len;i++, j--) for (i=0, j=len-1; i<len;i++, j--)
rbuf[i] = buf[j]; rbuf[i] = buf[j];
rbuf[len] = 0; rbuf[len] = 0;
@ -3319,7 +3319,7 @@ void update_default_font(unsigned int sheet)
for (r=0; r<7; r++) for (r=0; r<7; r++)
fnt_size_cnt[r] = 0; fnt_size_cnt[r] = 0;
/* Now check each cell to see what its using. */ /* Now check each cell to see what it's using. */
for (r=ws_array[sheet]->first_row; r<=ws_array[sheet]->biggest_row; r++) for (r=ws_array[sheet]->first_row; r<=ws_array[sheet]->biggest_row; r++)
{ {
for (c=ws_array[sheet]->first_col; c<=ws_array[sheet]->biggest_col; c++) for (c=ws_array[sheet]->first_col; c<=ws_array[sheet]->biggest_col; c++)
@ -3519,10 +3519,10 @@ void update_default_alignment(unsigned int sheet, int row)
} }
if ((center == 0)&&(left == 0)&&(right == 0)) if ((center == 0)&&(left == 0)&&(right == 0))
default_alignment = ""; default_alignment = "";
else if ((center >= left)&&(center >= right)) /* Favor center since its the longest word */ else if ((center >= left)&&(center >= right)) /* Favor center since it's the longest word */
default_alignment = "center"; default_alignment = "center";
else if ((right >= center)&&(right >= left)) else if ((right >= center)&&(right >= left))
default_alignment = "right"; /* Favor right since its second longest */ default_alignment = "right"; /* Favor right since it's second longest */
else else
default_alignment = "left"; default_alignment = "left";
} }
@ -3656,16 +3656,16 @@ void OutputCharCorrected(U8 c)
} }
switch (c) switch (c)
{ /* Special char handlers here... */ { /* Special char handlers here... */
case 0x3C: case 0x3C: /* '<' - less than */
printf("&lt;"); printf("&lt;");
break; break;
case 0x3E: case 0x3E: /* '>' - greater than */
printf("&gt;"); printf("&gt;");
break; break;
case 0x26: case 0x26: /* '&' - ampersand */
printf("&amp;"); printf("&amp;");
break; break;
case 0x22: case 0x22: /* '"' - double quote */
printf("&quot;"); printf("&quot;");
break; break;
/* Also need to cover 128-159 since MS uses this area... */ /* Also need to cover 128-159 since MS uses this area... */
@ -3685,89 +3685,107 @@ void OutputCharCorrected(U8 c)
printf("&#8230;"); printf("&#8230;");
break; break;
case 0x86: /* dagger */ case 0x86: /* dagger */
printf("&#8224;"); printf("&#8224;");
break; break;
case 0x87: /* double dagger */ case 0x87: /* double dagger */
printf("&#8225;"); printf("&#8225;");
break; break;
case 0x88: /* circumflex accent */ case 0x88: /* circumflex accent */
printf("&#710;"); printf("&#710;");
break; break;
case 0x89: /* permile */ case 0x89: /* permile */
printf("&#8240;"); printf("&#8240;");
break; break;
case 0x8A: /* S Hacek */ case 0x8A: /* S Hacek */
printf("&#352;"); printf("&#352;");
break; break;
case 0x8B: /* left single guillemet */ case 0x8B: /* left single guillemet */
printf("&#8249;"); printf("&#8249;");
break; break;
case 0x8C: /* OE ligature */ case 0x8C: /* OE ligature */
printf("&#338;"); printf("&#338;");
break; break;
case 0x8E: /* #LATIN CAPITAL LETTER Z WITH CARON */ case 0x8E: /* #LATIN CAPITAL LETTER Z WITH CARON */
printf("&#381;"); printf("&#381;");
break; break;
case 0x91: /* left single quote ? */ case 0x91: /* left single quote ? */
printf("&#8216;"); printf("&#8216;");
break; break;
case 0x92: /* right single quote ? */ case 0x92: /* right single quote ? */
printf("&#8217;"); printf("&#8217;");
break; break;
case 0x93: /* left double quote */ case 0x93: /* left double quote */
printf("&#8220;"); printf("&#8220;");
break; break;
case 0x94: /* right double quote */ case 0x94: /* right double quote */
printf("&#8221;"); printf("&#8221;");
break; break;
case 0x95: /* bullet */ case 0x95: /* bullet */
printf("&#8226;"); printf("&#8226;");
break; break;
case 0x96: /* endash */ case 0x96: /* endash */
printf("&#8211;"); printf("&#8211;");
break; break;
case 0x97: /* emdash */ case 0x97: /* emdash */
printf("&#8212;"); printf("&#8212;");
break; break;
case 0x98: /* tilde accent */ case 0x98: /* tilde accent */
printf("&#732;"); printf("&#732;");
break; break;
case 0x99: /* trademark ligature */ case 0x99: /* trademark ligature */
printf("&#8482;"); printf("&#8482;");
break; break;
case 0x9A: /* s Haceks Hacek */ case 0x9A: /* s Hacek */
printf("&#353;"); printf("&#353;");
break; break;
case 0x9B: /* right single guillemet */ case 0x9B: /* right single guillemet */
printf("&#8250;"); printf("&#8250;");
break; break;
case 0x9C: /* oe ligature */ case 0x9C: /* oe ligature */
printf("&#339;"); printf("&#339;");
break; break;
case 0x9F: /* Y Dieresis */ case 0x9F: /* Y Dieresis */
printf("&#376;"); printf("&#376;");
break; break;
case 0xE1: /* a acute */ case 0xE1: /* a acute */
printf("á"); printf("&#225;");
break; break;
case 0xE9: /* e acute */ case 0xE9: /* e acute */
printf("é"); printf("&#233;");
break; break;
case 0xED: /* i acute */ case 0xED: /* i acute */
printf("í"); printf("&#237;");
break; break;
case 0xF3: /* o acute */ case 0xF3: /* o acute */
printf("ó"); printf("&#243;");
break; break;
case 0xFA: /* u acute */ case 0xFA: /* u acute */
printf("ú"); printf("&#250;");
break; break;
case 0xFD: /* y acute */ case 0xFD: /* y acute */
printf("ý"); printf("&#253;");
break; break;
case 0xB0: /* degrees */ case 0xC1: /* A acute */
printf("deg."); printf("&#193;");
break; break;
case 0xC9: /* E acute */
printf("&#201;");
break;
case 0xCD: /* I acute */
printf("&#205;");
break;
case 0xD3: /* O acute */
printf("&#211;");
break;
case 0xDA: /* U acute */
printf("&#218;");
break;
case 0xDD: /* Y acute */
printf("&#221;");
break;
case 0xB0: /* degrees */
printf("deg.");
break;
default: default:
putchar(c); putchar(c);
break; break;

View File

@ -27,7 +27,6 @@ extern int MaxFormatsExceeded;
extern char colorTab[MAX_COLORS]; extern char colorTab[MAX_COLORS];
extern char filename[256]; extern char filename[256];
extern int UnicodeStrings; extern int UnicodeStrings;
extern int CodePage;
extern char *title; extern char *title;
extern void update_default_alignment(unsigned int, int); extern void update_default_alignment(unsigned int, int);
extern void output_cell( cell *, int); extern void output_cell( cell *, int);