From 0f3cca5a24df74ba9b6b944904f60a41cf2a7a6c Mon Sep 17 00:00:00 2001 From: slidedraw Date: Mon, 15 Apr 2002 19:36:52 +0000 Subject: [PATCH] Fixed some bugs in international files. --- xlhtml/Makefile.am | 2 +- xlhtml/Makefile.in | 2 +- xlhtml/ascii.c | 41 ----------- xlhtml/xlhtml.c | 174 +++++++++++++++++++++++++-------------------- xlhtml/xml.c | 1 - 5 files changed, 98 insertions(+), 122 deletions(-) diff --git a/xlhtml/Makefile.am b/xlhtml/Makefile.am index 519715c..724a1c6 100644 --- a/xlhtml/Makefile.am +++ b/xlhtml/Makefile.am @@ -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: diff --git a/xlhtml/Makefile.in b/xlhtml/Makefile.in index ae26537..768421d 100644 --- a/xlhtml/Makefile.in +++ b/xlhtml/Makefile.in @@ -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 = diff --git a/xlhtml/ascii.c b/xlhtml/ascii.c index 8288fdf..1657bbc 100644 --- a/xlhtml/ascii.c +++ b/xlhtml/ascii.c @@ -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 *); diff --git a/xlhtml/xlhtml.c b/xlhtml/xlhtml.c index ede8ecc..c3424dc 100644 --- a/xlhtml/xlhtml.c +++ b/xlhtml/xlhtml.c @@ -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 ) @@ -3016,7 +3016,7 @@ void output_formatted_data(uni_string *u, U16 idx, int numeric, int formula) } else { - num = atol((char *)u->str); + num = atol((char *)u->str); if (Csv) printf("%ld", num); else 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; ifirst_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("<"); break; - case 0x3E: + case 0x3E: /* '>' - greater than */ printf(">"); break; - case 0x26: + case 0x26: /* '&' - ampersand */ printf("&"); break; - case 0x22: + case 0x22: /* '"' - double quote */ printf("""); break; /* Also need to cover 128-159 since MS uses this area... */ @@ -3685,89 +3685,107 @@ void OutputCharCorrected(U8 c) printf("…"); break; case 0x86: /* dagger */ - printf("†"); - break; + printf("†"); + break; case 0x87: /* double dagger */ - printf("‡"); - break; + printf("‡"); + break; case 0x88: /* circumflex accent */ - printf("ˆ"); - break; + printf("ˆ"); + break; case 0x89: /* permile */ - printf("‰"); - break; + printf("‰"); + break; case 0x8A: /* S Hacek */ - printf("Š"); - break; + printf("Š"); + break; case 0x8B: /* left single guillemet */ - printf("‹"); - break; + printf("‹"); + break; case 0x8C: /* OE ligature */ - printf("Œ"); - break; + printf("Œ"); + break; case 0x8E: /* #LATIN CAPITAL LETTER Z WITH CARON */ printf("Ž"); break; case 0x91: /* left single quote ? */ - printf("‘"); - break; + printf("‘"); + break; case 0x92: /* right single quote ? */ - printf("’"); - break; + printf("’"); + break; case 0x93: /* left double quote */ - printf("“"); - break; + printf("“"); + break; case 0x94: /* right double quote */ - printf("”"); - break; + printf("”"); + break; case 0x95: /* bullet */ - printf("•"); - break; + printf("•"); + break; case 0x96: /* endash */ - printf("–"); - break; + printf("–"); + break; case 0x97: /* emdash */ - printf("—"); - break; + printf("—"); + break; case 0x98: /* tilde accent */ - printf("˜"); - break; + printf("˜"); + break; case 0x99: /* trademark ligature */ - printf("™"); - break; - case 0x9A: /* s Haceks Hacek */ - printf("š"); - break; + printf("™"); + break; + case 0x9A: /* s Hacek */ + printf("š"); + break; case 0x9B: /* right single guillemet */ - printf("›"); - break; + printf("›"); + break; case 0x9C: /* oe ligature */ - printf("œ"); - break; + printf("œ"); + break; case 0x9F: /* Y Dieresis */ - printf("Ÿ"); - break; - case 0xE1: /* a acute */ - printf("á"); - break; - case 0xE9: /* e acute */ - printf("é"); - break; - case 0xED: /* i acute */ - printf("í"); - break; - case 0xF3: /* o acute */ - printf("ó"); - break; - case 0xFA: /* u acute */ - printf("ú"); - break; - case 0xFD: /* y acute */ - printf("ý"); - break; - case 0xB0: /* degrees */ - printf("deg."); - break; + printf("Ÿ"); + break; + case 0xE1: /* a acute */ + printf("á"); + break; + case 0xE9: /* e acute */ + printf("é"); + break; + case 0xED: /* i acute */ + printf("í"); + break; + case 0xF3: /* o acute */ + printf("ó"); + break; + case 0xFA: /* u acute */ + printf("ú"); + break; + case 0xFD: /* y acute */ + printf("ý"); + break; + case 0xC1: /* A acute */ + printf("Á"); + break; + case 0xC9: /* E acute */ + printf("É"); + break; + case 0xCD: /* I acute */ + printf("Í"); + break; + case 0xD3: /* O acute */ + printf("Ó"); + break; + case 0xDA: /* U acute */ + printf("Ú"); + break; + case 0xDD: /* Y acute */ + printf("Ý"); + break; + case 0xB0: /* degrees */ + printf("deg."); + break; default: putchar(c); break; diff --git a/xlhtml/xml.c b/xlhtml/xml.c index 6f0c29f..c873f10 100644 --- a/xlhtml/xml.c +++ b/xlhtml/xml.c @@ -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);