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
xldump_SOURCES = xldump.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
doc:

View File

@ -86,7 +86,7 @@ LDADD = ../cole/libcole.a
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
xldump_SOURCES = xldump.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
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =

View File

@ -1,55 +1,14 @@
#include "xlhtml.h"
extern void do_cr(void);
extern int center_tables;
extern int first_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 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 int UnicodeStrings;
extern int CodePage;
extern char *title;
extern void update_default_alignment(unsigned int, int);
extern void output_cell( cell *, int);
extern uni_string author;
extern int null_string(U8 *);
extern int Csv;
work_sheet **ws_array;
font_attr **font_array;
xf_attr **xf_array;
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))
{ /* 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;
U16 size, attr, c_idx, b, su;
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))
{ /* 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;
U16 len;
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];
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)
uni = 2;
}
@ -2517,7 +2517,7 @@ void output_cell(cell *c, int xml)
else if (c->spanned != 0)
return;
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 */
html_flag_init(&h);
if (c->xfmt == 0)
@ -2652,7 +2652,7 @@ void output_cell(cell *c, int xml)
tcolor = xf_array[c->xfmt]->b_t_color & 0x007F;
bcolor = (xf_array[c->xfmt]->b_t_color & 0x3F80) >> 7;
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 ((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)
printf("\"");
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);
printf("%g", dnum);
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, '.');
if( OutputXML )
@ -3080,7 +3080,7 @@ void PrintFloatComma(char *fformat, int is_currency, F64 d)
else
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--)
rbuf[i] = buf[j];
rbuf[len] = 0;
@ -3319,7 +3319,7 @@ void update_default_font(unsigned int sheet)
for (r=0; r<7; r++)
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 (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))
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";
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
default_alignment = "left";
}
@ -3656,16 +3656,16 @@ void OutputCharCorrected(U8 c)
}
switch (c)
{ /* Special char handlers here... */
case 0x3C:
case 0x3C: /* '<' - less than */
printf("&lt;");
break;
case 0x3E:
case 0x3E: /* '>' - greater than */
printf("&gt;");
break;
case 0x26:
case 0x26: /* '&' - ampersand */
printf("&amp;");
break;
case 0x22:
case 0x22: /* '"' - double quote */
printf("&quot;");
break;
/* Also need to cover 128-159 since MS uses this area... */
@ -3735,7 +3735,7 @@ void OutputCharCorrected(U8 c)
case 0x99: /* trademark ligature */
printf("&#8482;");
break;
case 0x9A: /* s Haceks Hacek */
case 0x9A: /* s Hacek */
printf("&#353;");
break;
case 0x9B: /* right single guillemet */
@ -3748,22 +3748,40 @@ void OutputCharCorrected(U8 c)
printf("&#376;");
break;
case 0xE1: /* a acute */
printf("á");
printf("&#225;");
break;
case 0xE9: /* e acute */
printf("é");
printf("&#233;");
break;
case 0xED: /* i acute */
printf("í");
printf("&#237;");
break;
case 0xF3: /* o acute */
printf("ó");
printf("&#243;");
break;
case 0xFA: /* u acute */
printf("ú");
printf("&#250;");
break;
case 0xFD: /* y acute */
printf("ý");
printf("&#253;");
break;
case 0xC1: /* A acute */
printf("&#193;");
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.");

View File

@ -27,7 +27,6 @@ extern int MaxFormatsExceeded;
extern char colorTab[MAX_COLORS];
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);