Some more code modularization.
This commit is contained in:
parent
4f2cdde40b
commit
117379f7a6
@ -9,7 +9,7 @@ man_MANS = xlhtml.1
|
||||
bin_SCRIPTS = nsopen nsxlview
|
||||
bin_PROGRAMS = xlhtml
|
||||
LDADD = ../cole/libcole.a -lm
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c engine.c
|
||||
xldump_SOURCES = xldump.c
|
||||
xlcdump_SOURCES = xlcdump.c
|
||||
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
|
||||
|
@ -83,9 +83,10 @@ man_MANS = xlhtml.1
|
||||
bin_SCRIPTS = nsopen nsxlview
|
||||
bin_PROGRAMS = xlhtml
|
||||
LDADD = ../cole/libcole.a -lm
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c engine.c
|
||||
xldump_SOURCES = xldump.c
|
||||
xlcdump_SOURCES = xlcdump.c
|
||||
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -96,7 +97,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
xlhtml_OBJECTS = support.o xlhtml.o html.o ascii.o xml.o
|
||||
xlhtml_OBJECTS = support.o xlhtml.o html.o ascii.o xml.o \
|
||||
setupExtraction.o engine.o
|
||||
xlhtml_LDADD = $(LDADD)
|
||||
xlhtml_DEPENDENCIES = ../cole/libcole.a
|
||||
xlhtml_LDFLAGS =
|
||||
@ -109,7 +111,6 @@ xlcdump_LDADD = $(LDADD)
|
||||
xlcdump_DEPENDENCIES = ../cole/libcole.a
|
||||
xlcdump_LDFLAGS =
|
||||
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
|
||||
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
@ -384,6 +385,7 @@ install-am install uninstall-am uninstall all-redirect all-am all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
doc: doxygen.conf xlhtml.c ascii.c xml.c html.c support.c xlhtml.h tuneable.h
|
||||
@echo Generating documentation...
|
||||
doxygen doxygen.conf
|
||||
|
@ -26,7 +26,8 @@
|
||||
|
||||
|
||||
|
||||
void OutputPartialTableAscii(void)
|
||||
void
|
||||
OutputPartialTableAscii (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
@ -37,7 +38,8 @@ void OutputPartialTableAscii(void)
|
||||
{
|
||||
if (ws_array[i] == 0)
|
||||
continue;
|
||||
if ((ws_array[i]->biggest_row == -1)||(ws_array[i]->biggest_col == -1))
|
||||
if ((ws_array[i]->biggest_row == -1)
|
||||
|| (ws_array[i]->biggest_col == -1))
|
||||
continue;
|
||||
if (ws_array[i]->c_array == 0)
|
||||
continue;
|
||||
@ -60,7 +62,9 @@ void OutputPartialTableAscii(void)
|
||||
if (c->ustr.str)
|
||||
{
|
||||
if (safe)
|
||||
output_formatted_data(&(c->ustr), xf_array[c->xfmt]->fmt_idx, numeric, IsCellFormula(c));
|
||||
output_formatted_data (&(c->ustr),
|
||||
xf_array[c->xfmt]->fmt_idx,
|
||||
numeric, IsCellFormula (c));
|
||||
else
|
||||
OutputString (&(c->ustr));
|
||||
}
|
||||
@ -76,8 +80,11 @@ void OutputPartialTableAscii(void)
|
||||
}
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]) /* Honor Column spanning ? */
|
||||
{
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan != 0)
|
||||
k += ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan-1;
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]->
|
||||
colspan != 0)
|
||||
k +=
|
||||
ws_array[i]->c_array[(j * ws_array[i]->max_cols) +
|
||||
k]->colspan - 1;
|
||||
}
|
||||
if (!numeric && Csv)
|
||||
printf ("\"");
|
||||
|
@ -32,7 +32,8 @@ void output_header(void);
|
||||
void output_footer (void);
|
||||
|
||||
|
||||
void OutputTableHTML(void)
|
||||
void
|
||||
OutputTableHTML (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
@ -51,7 +52,8 @@ void OutputTableHTML(void)
|
||||
update_default_font (i);
|
||||
if (ws_array[i] == 0)
|
||||
continue;
|
||||
if ((ws_array[i]->biggest_row == -1)||(ws_array[i]->biggest_col == -1))
|
||||
if ((ws_array[i]->biggest_row == -1)
|
||||
|| (ws_array[i]->biggest_col == -1))
|
||||
continue;
|
||||
if (ws_array[i]->c_array == 0)
|
||||
continue;
|
||||
@ -126,8 +128,11 @@ void OutputTableHTML(void)
|
||||
output_cell (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k], 0); /* This stuff happens for each cell... */
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k])
|
||||
{
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan != 0)
|
||||
k += ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan-1;
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]->
|
||||
colspan != 0)
|
||||
k +=
|
||||
ws_array[i]->c_array[(j * ws_array[i]->max_cols) +
|
||||
k]->colspan - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,7 +190,8 @@ void OutputTableHTML(void)
|
||||
}
|
||||
if (NotImplemented)
|
||||
{
|
||||
printf("<br>*** This cell's data type will be supported in the future.<br>");
|
||||
printf
|
||||
("<br>*** This cell's data type will be supported in the future.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (Unsupported)
|
||||
@ -195,65 +201,78 @@ void OutputTableHTML(void)
|
||||
}
|
||||
|
||||
/* Now out exceeded capacity warnings... */
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded || MaxStringsExceeded ||
|
||||
MaxFontsExceeded || MaxPalExceeded || MaxXFExceeded || MaxFormatsExceeded )
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded
|
||||
|| MaxStringsExceeded || MaxFontsExceeded || MaxPalExceeded
|
||||
|| MaxXFExceeded || MaxFormatsExceeded)
|
||||
printf ("<FONT COLOR=\"%s\">", colorTab[0x0A]);
|
||||
if (MaxWorksheetsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Worksheets was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Worksheets was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxRowExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Rows was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Rows was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxColExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Columns was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Columns was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxStringsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Strings was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Strings was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxFontsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Fonts was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Fonts was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxPalExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Color Palettes was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Color Palettes was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxXFExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Extended Formats was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Extended Formats was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxFormatsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Formats was exceeded, you might want to increase it.<br>");
|
||||
printf
|
||||
("The Maximum Number of Formats was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded || MaxStringsExceeded ||
|
||||
MaxFontsExceeded || MaxPalExceeded || MaxXFExceeded || MaxFormatsExceeded )
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded
|
||||
|| MaxStringsExceeded || MaxFontsExceeded || MaxPalExceeded
|
||||
|| MaxXFExceeded || MaxFormatsExceeded)
|
||||
printf ("</FONT>");
|
||||
|
||||
printf (" <br>");
|
||||
do_cr ();
|
||||
|
||||
/* Output Credit */
|
||||
printf("<hr><FONT SIZE=\"-1\">Created with <a href=\"http://chicago.sf.net/xlhtml\">xlhtml %s</a></FONT><br>", VERSION);
|
||||
printf
|
||||
("<hr><FONT SIZE=\"-1\">Created with <a href=\"http://chicago.sf.net/xlhtml\">xlhtml %s</a></FONT><br>",
|
||||
VERSION);
|
||||
do_cr ();
|
||||
|
||||
/* Output Tail */
|
||||
output_footer ();
|
||||
}
|
||||
|
||||
void output_header(void)
|
||||
void
|
||||
output_header (void)
|
||||
{ /* Ouput Header */
|
||||
if (NoHeaders)
|
||||
return;
|
||||
@ -310,7 +329,8 @@ void output_header(void)
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
void output_footer(void)
|
||||
void
|
||||
output_footer (void)
|
||||
{
|
||||
if (NoHeaders)
|
||||
return;
|
||||
@ -319,7 +339,9 @@ void output_footer(void)
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
void output_start_html_attr(html_attr *h, unsigned int fnt_idx, int do_underlines)
|
||||
void
|
||||
output_start_html_attr (html_attr * h, unsigned int fnt_idx,
|
||||
int do_underlines)
|
||||
{
|
||||
if (fnt_idx < next_font)
|
||||
{
|
||||
@ -356,7 +378,8 @@ void output_start_html_attr(html_attr *h, unsigned int fnt_idx, int do_underline
|
||||
}
|
||||
}
|
||||
|
||||
void output_end_html_attr(html_attr *h)
|
||||
void
|
||||
output_end_html_attr (html_attr * h)
|
||||
{
|
||||
if (h->sbflag)
|
||||
{
|
||||
|
94
xlhtml/setupExtraction.c
Normal file
94
xlhtml/setupExtraction.c
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xlhtml.h"
|
||||
#include "support.h"
|
||||
|
||||
extern int Xtract;
|
||||
extern int xp;
|
||||
extern int sheet_count;
|
||||
extern int xr1 ;
|
||||
extern int xr2 ;
|
||||
extern int xc1 ;
|
||||
extern int xc2 ;
|
||||
extern int Ascii;
|
||||
|
||||
|
||||
|
||||
void
|
||||
SetupExtraction (void)
|
||||
{
|
||||
if (Xtract)
|
||||
{ /* Revise the page settings... */
|
||||
/* printf("-%d %d %d %d %d<br>\n", xp, xr1, xr2, xc1, xc2); */
|
||||
if ((xp >= first_sheet) && (xp <= last_sheet) && (xp <= sheet_count))
|
||||
{
|
||||
first_sheet = xp;
|
||||
last_sheet = xp;
|
||||
if (xr1 < 0)
|
||||
{
|
||||
xr1 = (S16) ws_array[xp]->first_row;
|
||||
xr2 = (S16) ws_array[xp]->biggest_row;
|
||||
}
|
||||
else if ((xr1 >= ws_array[xp]->first_row)
|
||||
&& (xr1 <= ws_array[xp]->biggest_row)
|
||||
&& (xr2 >= ws_array[xp]->first_row)
|
||||
&& (xr2 <= ws_array[xp]->biggest_row))
|
||||
{
|
||||
ws_array[xp]->first_row = xr1;
|
||||
ws_array[xp]->biggest_row = xr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ascii)
|
||||
fprintf (stderr, "Error - Row not in range during extraction"
|
||||
" (%d or %d not in [%ld..%ld])\n", xr1, xr2,
|
||||
(long) ws_array[xp]->first_row,
|
||||
(long) ws_array[xp]->biggest_row);
|
||||
else
|
||||
{
|
||||
printf ("Error - Row not in range during extraction.");
|
||||
output_footer ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (xc1 < 0)
|
||||
{
|
||||
xc1 = ws_array[xp]->first_col;
|
||||
xc2 = ws_array[xp]->biggest_col;
|
||||
}
|
||||
else if ((xc1 >= ws_array[xp]->first_col)
|
||||
&& (xc1 <= ws_array[xp]->biggest_col)
|
||||
&& (xc2 >= ws_array[xp]->first_col)
|
||||
&& (xc2 <= ws_array[xp]->biggest_col))
|
||||
{
|
||||
ws_array[xp]->first_col = xc1;
|
||||
ws_array[xp]->biggest_col = xc2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ascii)
|
||||
fprintf (stderr, "Error - Col not in range during extraction"
|
||||
" (%d or %d not in [%d..%d])\n", xc1, xc2,
|
||||
ws_array[xp]->first_col, ws_array[xp]->biggest_col);
|
||||
else
|
||||
{
|
||||
printf ("Error - Col not in range during extraction.\n");
|
||||
output_footer ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ascii)
|
||||
fprintf (stderr, "Error - Page not in range during extraction.");
|
||||
else
|
||||
{
|
||||
printf ("Error - Page not in range during extraction.");
|
||||
output_footer ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -30,14 +30,16 @@
|
||||
|
||||
int DatesR1904 = 0; /*!< Flag that the dates are based on McIntosh Dates system */
|
||||
|
||||
void print_version(void)
|
||||
void
|
||||
print_version (void)
|
||||
{
|
||||
printf ("xlhtml %s \nCopyright (c) 1999-2002, Charles Wyble\n"
|
||||
"Released under GPL.\n", VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
void display_usage(void)
|
||||
void
|
||||
display_usage (void)
|
||||
{
|
||||
fprintf (stderr, "\nxlhtml converts excel files (.xls) to Html.\n"
|
||||
"Copyright (c) 1999-2001, Charles Wyble. Released under GPL.\n"
|
||||
@ -64,14 +66,16 @@ fprintf(stderr, "\nxlhtml converts excel files (.xls) to Html.\n"
|
||||
exit (1);
|
||||
}
|
||||
|
||||
void do_cr(void)
|
||||
void
|
||||
do_cr (void)
|
||||
{
|
||||
extern int aggressive;
|
||||
if (!aggressive)
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
U16 getShort(U8 *ptr)
|
||||
U16
|
||||
getShort (U8 * ptr)
|
||||
{
|
||||
if (ptr == 0)
|
||||
return (U16) 0;
|
||||
@ -80,18 +84,21 @@ U16 getShort(U8 *ptr)
|
||||
}
|
||||
|
||||
/*! This is used in the RK number, so signedness counts */
|
||||
S32 getLong(U8 *ptr)
|
||||
S32
|
||||
getLong (U8 * ptr)
|
||||
{
|
||||
if (ptr == 0)
|
||||
return (S32) 0;
|
||||
|
||||
return (S32)(*(ptr+3)<<24)+(*(ptr+2)<<16)+(*(ptr+1)<<8)+*ptr;
|
||||
return (S32) (*(ptr + 3) << 24) + (*(ptr + 2) << 16) + (*(ptr + 1) << 8) +
|
||||
*ptr;
|
||||
}
|
||||
|
||||
#ifndef WORDS_BIGENDIAN /* Defined in <config.h> */
|
||||
#ifdef __arm__
|
||||
/* cross-endian doubles in little endian ARM */
|
||||
void getDouble(U8 *ptr, F64 *d)
|
||||
void
|
||||
getDouble (U8 * ptr, F64 * d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
@ -104,7 +111,8 @@ void getDouble(U8 *ptr, F64 *d)
|
||||
}
|
||||
#else
|
||||
/*! Little Endian - 0x86 family */
|
||||
void getDouble(U8 *ptr, F64 *d)
|
||||
void
|
||||
getDouble (U8 * ptr, F64 * d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
@ -118,7 +126,8 @@ void getDouble(U8 *ptr, F64 *d)
|
||||
#endif
|
||||
#else
|
||||
/*! Big Endian version - UltraSparc's, etc. */
|
||||
void getDouble (U8 *ptr, F64 *d)
|
||||
void
|
||||
getDouble (U8 * ptr, F64 * d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
@ -131,7 +140,8 @@ void getDouble (U8 *ptr, F64 *d)
|
||||
}
|
||||
#endif
|
||||
|
||||
int null_string(U8 *str)
|
||||
int
|
||||
null_string (U8 * str)
|
||||
{ /* FIXME: This function may not be unicode safe */
|
||||
U8 *ptr;
|
||||
if ((str == NULL) || (*str == 0))
|
||||
@ -146,7 +156,8 @@ int null_string(U8 *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec)
|
||||
void
|
||||
FracToTime (U8 * cnum, int *hr, int *minut, int *sec, int *msec)
|
||||
{
|
||||
int Hr, Min, Sec, Msec;
|
||||
F64 fnum, tHr, tMin, tSec, tMsec;
|
||||
@ -178,7 +189,8 @@ void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec)
|
||||
}
|
||||
|
||||
|
||||
void NumToDate(long num, int *year, int *month, int *day)
|
||||
void
|
||||
NumToDate (long num, int *year, int *month, int *day)
|
||||
{
|
||||
const int ldays[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const int ndays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
@ -227,14 +239,16 @@ typedef S32 swords[2];
|
||||
#ifndef WORDS_BIGENDIAN /*! Defined in <config.h> */
|
||||
#ifdef __arm__
|
||||
/* cross-endian doubles in little endian ARM */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
void
|
||||
RKtoDouble (S32 n, F64 * d)
|
||||
{
|
||||
noaliasdub (swords, d)[0] = n << 2;
|
||||
noaliasdub (swords, d)[1] = 0;
|
||||
}
|
||||
#else
|
||||
/*! Little Endian - 0x86 family */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
void
|
||||
RKtoDouble (S32 n, F64 * d)
|
||||
{
|
||||
noaliasdub (swords, d)[0] = 0;
|
||||
noaliasdub (swords, d)[1] = n << 2;
|
||||
@ -242,12 +256,14 @@ void RKtoDouble(S32 n, F64 *d)
|
||||
#endif
|
||||
#else
|
||||
/*! Big Endian version - UltraSparc's, etc. */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
void
|
||||
RKtoDouble (S32 n, F64 * d)
|
||||
{
|
||||
U8 *ptr = (U8 *) & n;
|
||||
|
||||
noaliasdub (swords, d)[1] = 0;
|
||||
noaliasdub (swords, d)[0] =
|
||||
((*(ptr+0)<<24)+(*(ptr+1)<<16)+(*(ptr+2)<<8)+(*(ptr+3))) << 2;
|
||||
((*(ptr + 0) << 24) + (*(ptr + 1) << 16) + (*(ptr + 2) << 8) +
|
||||
(*(ptr + 3))) << 2;
|
||||
}
|
||||
#endif
|
||||
|
@ -48,7 +48,8 @@ static char filename[128];
|
||||
int aggressive = 0; /*!< Aggressive html optimization */
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int f_ptr = 0;
|
||||
COLEFS *cfs;
|
||||
@ -71,7 +72,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
while (cole_locate_filename
|
||||
(cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
{
|
||||
if (f_ptr)
|
||||
{
|
||||
@ -92,16 +94,16 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
void dump_file(COLEDIRENT *cde, void *_info)
|
||||
void
|
||||
dump_file (COLEDIRENT * cde, void *_info)
|
||||
{
|
||||
unsigned int length = 0, opcode = 0, target = 0, count = 0;
|
||||
unsigned char buf[16];
|
||||
COLEFILE *cf;
|
||||
COLERRNO err;
|
||||
|
||||
(void) _info; /*UNUSED*/
|
||||
|
||||
cf = cole_fopen_direntry(cde, &err);
|
||||
(void) _info;
|
||||
/*UNUSED*/ cf = cole_fopen_direntry (cde, &err);
|
||||
|
||||
/* Ouput Header */
|
||||
printf ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
|
||||
@ -155,13 +157,19 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
}
|
||||
else /* mode >= 1 */
|
||||
{
|
||||
printf("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(unsigned)buf[0], (unsigned)buf[1], (unsigned)buf[2], (unsigned)buf[3],
|
||||
(unsigned)buf[4], (unsigned)buf[5], (unsigned)buf[6], (unsigned)buf[7]);
|
||||
putchar(buf[0]); putchar(buf[1]);
|
||||
putchar(buf[2]); putchar(buf[3]);
|
||||
putchar(buf[4]); putchar(buf[5]);
|
||||
putchar(buf[6]); putchar(buf[7]);
|
||||
printf
|
||||
("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(unsigned) buf[0], (unsigned) buf[1], (unsigned) buf[2],
|
||||
(unsigned) buf[3], (unsigned) buf[4], (unsigned) buf[5],
|
||||
(unsigned) buf[6], (unsigned) buf[7]);
|
||||
putchar (buf[0]);
|
||||
putchar (buf[1]);
|
||||
putchar (buf[2]);
|
||||
putchar (buf[3]);
|
||||
putchar (buf[4]);
|
||||
putchar (buf[5]);
|
||||
putchar (buf[6]);
|
||||
putchar (buf[7]);
|
||||
printf ("<br>\n");
|
||||
}
|
||||
}
|
||||
@ -173,7 +181,8 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
|
||||
|
||||
|
||||
static void output_opcode_string(int opcode)
|
||||
static void
|
||||
output_opcode_string (int opcode)
|
||||
{
|
||||
switch (opcode & 0x00FF)
|
||||
{
|
||||
@ -367,4 +376,3 @@ static void output_opcode_string(int opcode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,8 @@ static char filename[128];
|
||||
int aggressive = 0; /*!< Aggressive html optimization */
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int f_ptr = 0;
|
||||
COLEFS *cfs;
|
||||
@ -72,7 +73,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
while (cole_locate_filename
|
||||
(cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
{
|
||||
if (f_ptr)
|
||||
{
|
||||
@ -93,16 +95,16 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
void dump_file(COLEDIRENT *cde, void *_info)
|
||||
void
|
||||
dump_file (COLEDIRENT * cde, void *_info)
|
||||
{
|
||||
unsigned int length = 0, opcode = 0, target = 0, count = 0;
|
||||
unsigned char buf[16];
|
||||
COLEFILE *cf;
|
||||
COLERRNO err;
|
||||
|
||||
(void) _info; /*UNUSED*/
|
||||
|
||||
cf = cole_fopen_direntry(cde, &err);
|
||||
(void) _info;
|
||||
/*UNUSED*/ cf = cole_fopen_direntry (cde, &err);
|
||||
|
||||
/* Ouput Header */
|
||||
printf ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
|
||||
@ -156,13 +158,19 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
}
|
||||
else /* mode >= 1 */
|
||||
{
|
||||
printf("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(unsigned)buf[0], (unsigned)buf[1], (unsigned)buf[2], (unsigned)buf[3],
|
||||
(unsigned)buf[4], (unsigned)buf[5], (unsigned)buf[6], (unsigned)buf[7]);
|
||||
putchar(buf[0]); putchar(buf[1]);
|
||||
putchar(buf[2]); putchar(buf[3]);
|
||||
putchar(buf[4]); putchar(buf[5]);
|
||||
putchar(buf[6]); putchar(buf[7]);
|
||||
printf
|
||||
("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(unsigned) buf[0], (unsigned) buf[1], (unsigned) buf[2],
|
||||
(unsigned) buf[3], (unsigned) buf[4], (unsigned) buf[5],
|
||||
(unsigned) buf[6], (unsigned) buf[7]);
|
||||
putchar (buf[0]);
|
||||
putchar (buf[1]);
|
||||
putchar (buf[2]);
|
||||
putchar (buf[3]);
|
||||
putchar (buf[4]);
|
||||
putchar (buf[5]);
|
||||
putchar (buf[6]);
|
||||
putchar (buf[7]);
|
||||
printf ("<br>\n");
|
||||
}
|
||||
}
|
||||
@ -177,7 +185,8 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
}
|
||||
*/
|
||||
|
||||
static void output_opcode_string(int opcode)
|
||||
static void
|
||||
output_opcode_string (int opcode)
|
||||
{
|
||||
switch (opcode & 0x00FF)
|
||||
{
|
||||
@ -585,4 +594,3 @@ static void output_opcode_string(int opcode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
4590
xlhtml/xlhtml.c
4590
xlhtml/xlhtml.c
File diff suppressed because it is too large
Load Diff
57
xlhtml/xml.c
57
xlhtml/xml.c
@ -25,7 +25,8 @@
|
||||
|
||||
|
||||
|
||||
void OutputTableXML(void)
|
||||
void
|
||||
OutputTableXML (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
@ -46,6 +47,14 @@ void OutputTableXML(void)
|
||||
SetupExtraction ();
|
||||
|
||||
printf ("<excel_workbook>\n");
|
||||
printf ("<workbook_title>");
|
||||
if (title)
|
||||
printf ("%s", title);
|
||||
else
|
||||
printf ("%s", filename);
|
||||
printf ("</workbook_title>\n");
|
||||
|
||||
|
||||
printf ("\t<sheets>\n");
|
||||
|
||||
/* Here's where we dump the Html Page out */
|
||||
@ -55,7 +64,8 @@ void OutputTableXML(void)
|
||||
update_default_font (i);
|
||||
if (ws_array[i] == 0)
|
||||
continue;
|
||||
if ((ws_array[i]->biggest_row == -1)||(ws_array[i]->biggest_col == -1))
|
||||
if ((ws_array[i]->biggest_row == -1)
|
||||
|| (ws_array[i]->biggest_col == -1))
|
||||
continue;
|
||||
if (ws_array[i]->c_array == 0)
|
||||
continue;
|
||||
@ -76,10 +86,14 @@ void OutputTableXML(void)
|
||||
printf ("\t\t\t<pagetitle>(Unknown Page)</pagetitle>\n");
|
||||
}
|
||||
|
||||
printf( "\t\t\t<firstrow>%ld</firstrow>\n", (unsigned long)ws_array[i]->first_row );
|
||||
printf( "\t\t\t<lastrow>%d</lastrow>\n", (int) ws_array[i]->biggest_row );
|
||||
printf( "\t\t\t<firstcol>%ld</firstcol>\n", (long) ws_array[i]->first_col );
|
||||
printf( "\t\t\t<lastcol>%d</lastcol>\n", (int)ws_array[i]->biggest_col );
|
||||
printf ("\t\t\t<firstrow>%ld</firstrow>\n",
|
||||
(unsigned long) ws_array[i]->first_row);
|
||||
printf ("\t\t\t<lastrow>%d</lastrow>\n",
|
||||
(int) ws_array[i]->biggest_row);
|
||||
printf ("\t\t\t<firstcol>%ld</firstcol>\n",
|
||||
(long) ws_array[i]->first_col);
|
||||
printf ("\t\t\t<lastcol>%d</lastcol>\n",
|
||||
(int) ws_array[i]->biggest_col);
|
||||
printf ("\t\t\t<rows>\n");
|
||||
|
||||
for (j = ws_array[i]->first_row; j <= ws_array[i]->biggest_row; j++)
|
||||
@ -93,8 +107,11 @@ void OutputTableXML(void)
|
||||
printf ("</cell>\n");
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k])
|
||||
{
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan != 0)
|
||||
k += ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan-1;
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]->
|
||||
colspan != 0)
|
||||
k +=
|
||||
ws_array[i]->c_array[(j * ws_array[i]->max_cols) +
|
||||
k]->colspan - 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -144,21 +161,29 @@ void OutputTableXML(void)
|
||||
|
||||
/* Now out exceeded capacity warnings... */
|
||||
if (MaxWorksheetsExceeded)
|
||||
printf("\t<MaxWorksheetsExceeded>The Maximum Number of Worksheets were exceeded, you might want to increase it.</MaxWorksheetsExceeded>\n ");
|
||||
printf
|
||||
("\t<MaxWorksheetsExceeded>The Maximum Number of Worksheets were exceeded, you might want to increase it.</MaxWorksheetsExceeded>\n ");
|
||||
if (MaxRowExceeded)
|
||||
printf("\t<MaxRowExceeded>The Maximum Number of Rows were exceeded, you might want to increase it.</MaxRowExceeded>\n ");
|
||||
printf
|
||||
("\t<MaxRowExceeded>The Maximum Number of Rows were exceeded, you might want to increase it.</MaxRowExceeded>\n ");
|
||||
if (MaxColExceeded)
|
||||
printf("\t<MaxColExceeded>The Maximum Number of Columns were exceeded, you might want to increase it.</MaxColExceeded>\n");
|
||||
printf
|
||||
("\t<MaxColExceeded>The Maximum Number of Columns were exceeded, you might want to increase it.</MaxColExceeded>\n");
|
||||
if (MaxStringsExceeded)
|
||||
printf("\t<MaxStringsExceeded>The Maximum Number of Strings were exceeded, you might want to increase it.</MaxStringsExceeded>\n");
|
||||
printf
|
||||
("\t<MaxStringsExceeded>The Maximum Number of Strings were exceeded, you might want to increase it.</MaxStringsExceeded>\n");
|
||||
if (MaxFontsExceeded)
|
||||
printf("\t<MaxFontsExceeded>The Maximum Number of Fonts were exceeded, you might want to increase it.</MaxFontsExceeded>\n");
|
||||
printf
|
||||
("\t<MaxFontsExceeded>The Maximum Number of Fonts were exceeded, you might want to increase it.</MaxFontsExceeded>\n");
|
||||
if (MaxPalExceeded)
|
||||
printf("\t<MaxPalExceeded>The Maximum Number of Color Palettes were exceeded, you might want to increase it.</MaxPalExceeded>\n");
|
||||
printf
|
||||
("\t<MaxPalExceeded>The Maximum Number of Color Palettes were exceeded, you might want to increase it.</MaxPalExceeded>\n");
|
||||
if (MaxXFExceeded)
|
||||
printf("\t<MaxXFExceeded>The Maximum Number of Extended Formats were exceeded, you might want to increase it.</MaxXFExceeded>\n");
|
||||
printf
|
||||
("\t<MaxXFExceeded>The Maximum Number of Extended Formats were exceeded, you might want to increase it.</MaxXFExceeded>\n");
|
||||
if (MaxFormatsExceeded)
|
||||
printf("\t<MaxFormatsExceeded>The Maximum Number of Formats were exceeded, you might want to increase it.</MaxFormatsExceeded>\n");
|
||||
printf
|
||||
("\t<MaxFormatsExceeded>The Maximum Number of Formats were exceeded, you might want to increase it.</MaxFormatsExceeded>\n");
|
||||
|
||||
/* Output Credit */
|
||||
printf ("\t<tool>Created with xlhtml %s</tool>\n", VERSION);
|
||||
|
Loading…
Reference in New Issue
Block a user