Added patches that were uploaded to Chicago patch area.
This commit is contained in:
parent
358e24c07b
commit
4f2cdde40b
42
cole/cole.c
42
cole/cole.c
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
/*
|
||||
cole - A free C OLE library.
|
||||
Copyright 1998, 1999 Roberto Arturo Tena Sanchez
|
||||
@ -20,8 +22,12 @@
|
||||
Arturo Tena <arturo@directmail.org>
|
||||
*/
|
||||
|
||||
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
|
||||
#include "config.h"
|
||||
#include "cole.h"
|
||||
#else
|
||||
#include "cole.h.in"
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdlib.h>
|
||||
@ -189,7 +195,7 @@ cole_umount (COLEFS *colefilesystem, COLERRNO *colerrno)
|
||||
if (colerrno != NULL) *colerrno = COLE_ECLOSEFILE;
|
||||
ret = 1;
|
||||
}
|
||||
#if defined(WIN32)
|
||||
#if defined(__WIN32__) || (__BORLANDC__)
|
||||
if (remove (colefilesystem->sbfilename) && !ret) {
|
||||
if (colerrno != NULL) *colerrno = COLE_EREMOVE;
|
||||
ret = 1;
|
||||
@ -243,9 +249,6 @@ __cole_print_tree_indir(COLEDIR *cd, void *info, COLERRNO *colerrno)
|
||||
* Modify colerrno comment in the functions that call it,
|
||||
* ie. cole_print_tree().
|
||||
*/
|
||||
(void) cd; /*UNUSED*/
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
(*((long*)info))++;
|
||||
return 0;
|
||||
}
|
||||
@ -258,9 +261,6 @@ __cole_print_tree_outdir(COLEDIR *cd, void *info, COLERRNO *colerrno)
|
||||
* Modify colerrno comment in the functions that call it,
|
||||
* ie. cole_print_tree().
|
||||
*/
|
||||
(void) cd; /*UNUSED*/
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
(*((long*)info))--;
|
||||
return 0;
|
||||
}
|
||||
@ -275,9 +275,6 @@ __cole_print_tree_inroot(COLEDIR *cd, void *info, COLERRNO *colerrno)
|
||||
*/
|
||||
char *entry_name;
|
||||
|
||||
(void) info; /*UNUSED*/
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
printf ("DIR ");
|
||||
printf (" %7zu", cole_dir_getsize (cd));
|
||||
printf (" %08lx-%08lx %08lx-%08lx",
|
||||
@ -306,8 +303,6 @@ __cole_print_tree_indirentry(COLEDIRENT *cde, void *info, COLERRNO *colerrno)
|
||||
long level;
|
||||
long i;
|
||||
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
level = *((long*)info);
|
||||
for (i = 0; i < level; i++) {
|
||||
if (i == level - 1)
|
||||
@ -412,8 +407,6 @@ cole_opendir_direntry (COLEDIRENT *coledirentry, COLERRNO *colerrno)
|
||||
int
|
||||
cole_closedir (COLEDIR *coledir, COLERRNO *colerrno)
|
||||
{
|
||||
(void) colerrno; /*UNUSED*/
|
||||
|
||||
free (coledir);
|
||||
|
||||
return 0;
|
||||
@ -624,13 +617,15 @@ _cole_fopen_action (COLEDIRENT *cde, void *_info)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
info->file = cole_fopen_direntry (cde, &info->colerrno);
|
||||
|
||||
if (info->file == NULL) {
|
||||
/* colerrno is set */
|
||||
info->succ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
info->succ = 1;
|
||||
}
|
||||
|
||||
@ -838,39 +833,46 @@ cole_fseek (COLEFILE *colefile, size_t delta, COLE_SEEK_FLAG direction,
|
||||
case COLE_SEEK_SET:
|
||||
if (delta <= colefile->filesize) {
|
||||
colefile->pos = delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case COLE_SEEK_END:
|
||||
if (delta <= colefile->filesize) {
|
||||
colefile->pos = colefile->filesize - delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case COLE_SEEK_BACKWARD:
|
||||
if (delta <= colefile->pos) {
|
||||
colefile->pos = colefile->pos - delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case COLE_SEEK_FORWARD:
|
||||
if (delta <= colefile->filesize - colefile->pos) {
|
||||
colefile->pos = colefile->pos + delta;
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKDELTA;
|
||||
return 1;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
if (colerrno != NULL) *colerrno = COLE_EFSEEKFLAG;
|
||||
return 1;
|
||||
}
|
||||
|
||||
fseek(colefile->file,colefile->pos,SEEK_SET);
|
||||
}
|
||||
|
||||
|
||||
@ -1145,8 +1147,6 @@ cole_locate_filename (COLEFS *colefilesystem, char *filename,
|
||||
static int
|
||||
__cole_locate_filename_visitdir (COLEDIR *cd, void *info)
|
||||
{
|
||||
(void) cd; /*UNUSED*/
|
||||
|
||||
return ((struct __cole_locate_filenameinfo *)info)->visitdir;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
@ -9,5 +9,5 @@ man_MANS = ppthtml.1
|
||||
bin_SCRIPTS = nspptview
|
||||
bin_PROGRAMS = ppthtml
|
||||
LDADD = ../cole/libcole.a
|
||||
ppthtml_SOURCES = ppthtml.c
|
||||
ppthtml_SOURCES = ppthtml.c vector.c
|
||||
#AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
|
||||
|
@ -83,7 +83,7 @@ man_MANS = ppthtml.1
|
||||
bin_SCRIPTS = nspptview
|
||||
bin_PROGRAMS = ppthtml
|
||||
LDADD = ../cole/libcole.a
|
||||
ppthtml_SOURCES = ppthtml.c
|
||||
ppthtml_SOURCES = ppthtml.c vector.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -94,7 +94,7 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
ppthtml_OBJECTS = ppthtml.o
|
||||
ppthtml_OBJECTS = ppthtml.o vector.o
|
||||
ppthtml_LDADD = $(LDADD)
|
||||
ppthtml_DEPENDENCIES = ../cole/libcole.a
|
||||
ppthtml_LDFLAGS =
|
||||
|
@ -17,23 +17,37 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* The code used to extract title, author, subject and keywords was based
|
||||
on original code from libcole2 written by
|
||||
|
||||
Michael Meeks (michael@helixcode.com)
|
||||
Arturo Tena (arturo@directmail.org)
|
||||
*/
|
||||
|
||||
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
|
||||
#include "config.h" /* Created by ./configure script */
|
||||
#include "support.h" /* Needs to be before internal.h */
|
||||
#include "internal.h" /* Needs to be before cole */
|
||||
#include "cole.h"
|
||||
#if defined(WIN32)
|
||||
#include <direct.h> /* _chdrive() */
|
||||
#else
|
||||
#include "config.h.in" /* Created by ./configure script */
|
||||
#include "support.h" /* Needs to be before internal.h */
|
||||
#include "internal.h" /* Needs to be before cole */
|
||||
#include "cole.h.in"
|
||||
#include <dir.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "vector.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for strcpy() */
|
||||
#include <string.h> /* For strcpy() */
|
||||
#include <ctype.h> /* For isprint */
|
||||
#include <stdlib.h> /* For exitt() */
|
||||
#include <limits.h> /* For MAX_PATH */
|
||||
#include "ppthtml.h" /* For SummaryInfo things*/
|
||||
|
||||
|
||||
#define PRGNAME "pptHtml"
|
||||
#if defined(VERSION)
|
||||
#if !(defined( __WIN32__ ) || defined( __BORLANDC__ ))
|
||||
#define PRGVER VERSION
|
||||
#else
|
||||
#define PRGVER "0.4"
|
||||
@ -45,6 +59,8 @@ static char FileName[2][32] = /* The section of the PowerPoint File we read */
|
||||
"/PP40" /* Everything else ? */
|
||||
};
|
||||
|
||||
#define BUFFER_SIZE 128
|
||||
|
||||
|
||||
/* Function Prototypes */
|
||||
COLE_LOCATE_ACTION_FUNC dump_file;
|
||||
@ -53,6 +69,10 @@ static void atom_processor(int, int, int, unsigned char);
|
||||
static void print_unicode(unsigned char *, int);
|
||||
static void print_utf8(unsigned short c);
|
||||
static void put_utf8(unsigned short c);
|
||||
static OleSummary *summary_open_stream(COLEFILE *cf, const PropertySetID psid);
|
||||
static void close_summary(OleSummary *si);
|
||||
static gboolean read_items(OleSummary *si, PropertySetID ps_id);
|
||||
static char *summary_get_string (OleSummary *si,OleSummaryPID id,gboolean *available);
|
||||
|
||||
/* Global data */
|
||||
static char filename[128];
|
||||
@ -61,12 +81,23 @@ static int buf_idx=0;
|
||||
static int output_this_container = 0;
|
||||
static int past_first_slide = 0;
|
||||
static int last_container = 0;
|
||||
static char *title;
|
||||
static char *author;
|
||||
static char *subject;
|
||||
static char *keywords;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int f_ptr = 0;
|
||||
COLEFS * cfs;
|
||||
COLEFILE * cf;
|
||||
COLERRNO colerrno;
|
||||
char buffer[BUFFER_SIZE];
|
||||
size_t char_read;
|
||||
size_t char_read_total;
|
||||
|
||||
gboolean ok;
|
||||
OleSummary *si;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
@ -77,14 +108,6 @@ int main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
strncpy(filename, argv[1], 124);
|
||||
#if 1 && defined(WIN32)
|
||||
if( 0 != filename[0] && ':' == filename[1] )
|
||||
{
|
||||
_chdrive(tolower((unsigned char)filename[0]) - 'a' + 1);
|
||||
/* cut the drive from the filename */
|
||||
memmove(filename,filename+2,strlen(filename+2)+1);
|
||||
}
|
||||
#endif
|
||||
cfs = cole_mount (filename, &colerrno);
|
||||
if (cfs == NULL)
|
||||
{
|
||||
@ -93,6 +116,52 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
cf = cole_fopen (cfs, "/\005SummaryInformation", &colerrno);
|
||||
|
||||
if (!cf) {
|
||||
printf("ERROR-No Summary Information available for this document\n");
|
||||
cole_umount (cfs, NULL);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
si = summary_open_stream(cf, OLE_PS_SUMMARY_INFO);
|
||||
if (!si) {
|
||||
printf ("Could not open SummaryInformation\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
title = summary_get_string(si, OLE_SUMMARY_TITLE, &ok);
|
||||
/* if (ok) */
|
||||
/* printf ("The title is %s\n", title); */
|
||||
/* else */
|
||||
/* printf ("no title found\n"); */
|
||||
|
||||
subject = summary_get_string (si, OLE_SUMMARY_SUBJECT, &ok);
|
||||
/* if (ok) */
|
||||
/* printf ("The subject is %s\n", subject); */
|
||||
/* else */
|
||||
/* printf ("no subject found\n"); */
|
||||
|
||||
|
||||
author =summary_get_string (si, OLE_SUMMARY_AUTHOR, &ok);
|
||||
/* if (ok) */
|
||||
/* printf ("The author is %s\n", author); */
|
||||
/* else */
|
||||
/* printf ("no author found\n"); */
|
||||
|
||||
|
||||
keywords = summary_get_string (si, OLE_SUMMARY_KEYWORDS, &ok);
|
||||
/* if (ok) */
|
||||
/* printf ("The keywords are %s\n", keywords); */
|
||||
/* else */
|
||||
/* printf ("no keywords found\n"); */
|
||||
|
||||
cole_fclose (cf, &colerrno);
|
||||
|
||||
|
||||
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
{
|
||||
if (f_ptr)
|
||||
@ -106,6 +175,11 @@ int main (int argc, char **argv)
|
||||
f_ptr++;
|
||||
}
|
||||
|
||||
free (title);
|
||||
free (subject);
|
||||
free (author);
|
||||
free (keywords);
|
||||
|
||||
if (cole_umount (cfs, &colerrno))
|
||||
{
|
||||
cole_perror ("travel", colerrno);
|
||||
@ -115,22 +189,25 @@ int main (int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void dump_file(COLEDIRENT *cde, void *_info)
|
||||
{
|
||||
|
||||
unsigned long version=0, instance=0, type=0, length=0, target=0, count=0;
|
||||
unsigned char buf[16];
|
||||
COLEFILE *cf;
|
||||
COLERRNO err;
|
||||
|
||||
(void) _info; /*UNUSED*/
|
||||
|
||||
cf = cole_fopen_direntry(cde, &err);
|
||||
|
||||
/* Ouput Header */
|
||||
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n");
|
||||
printf("<HTML><HEAD><TITLE>%s", filename);
|
||||
printf("</TITLE></HEAD><BODY>\n");
|
||||
printf("<HTML><HEAD><TITLE>%s</TITLE>\n", title);
|
||||
if(subject)
|
||||
printf("<meta name=\"description\" content=\"%s\">\n", subject);
|
||||
if(author)
|
||||
printf("<meta name=\"author\" content=\"%s\">\n", author);
|
||||
if(keywords)
|
||||
printf("<meta name=\"keywords\" content=\"%s\">\n", keywords);
|
||||
printf("</HEAD><BODY>\n");
|
||||
|
||||
/* Output body */
|
||||
while (cole_fread(cf, buf, 1, &err))
|
||||
@ -414,3 +491,218 @@ static void put_utf8(unsigned short c)
|
||||
putchar(0x0080 | ((short)c & 0x003F));
|
||||
}
|
||||
|
||||
OleSummary *
|
||||
summary_open_stream (COLEFILE *cf, const PropertySetID psid)
|
||||
{
|
||||
uint8_t data[64];
|
||||
uint16_t byte_order;
|
||||
gboolean panic=FALSE;
|
||||
uint32_t os_version;
|
||||
OleSummary *si;
|
||||
int i, sections;
|
||||
COLERRNO colerrno;
|
||||
|
||||
if (cf == NULL){
|
||||
printf("No cole file info available\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* reading data */
|
||||
cole_fread (cf, data, 28, &colerrno);
|
||||
|
||||
si = malloc(sizeof(OleSummary));
|
||||
si->sections = malloc(sizeof(ole_vector));
|
||||
si->items = malloc(sizeof(item_vector));
|
||||
|
||||
si->s = cf;
|
||||
si->write_items = NULL;
|
||||
si->read_mode = TRUE;
|
||||
|
||||
byte_order = GET_UINT16(data);
|
||||
if (byte_order != 0xfffe)
|
||||
panic = TRUE;
|
||||
|
||||
if (GET_UINT16 (data + 2) != 0) /* Format */
|
||||
panic = TRUE;
|
||||
|
||||
os_version = GET_UINT32 (data + 4);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
si->class_id[i] = data[8 + i];
|
||||
|
||||
sections = GET_UINT32 (data + 24);
|
||||
|
||||
if (panic) {
|
||||
close_summary(si);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
create_ole_vector(si->sections);
|
||||
|
||||
for (i = 0; i < sections; i++) {
|
||||
OleSummarySection sect;
|
||||
if (!cole_fread (cf, data, 16 + 4, &colerrno)){
|
||||
close_summary(si);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (psid == OLE_PS_SUMMARY_INFO) {
|
||||
if (GET_UINT32 (data + 0) == sum_fmtid[0] &&
|
||||
GET_UINT32 (data + 4) == sum_fmtid[1] &&
|
||||
GET_UINT32 (data + 8) == sum_fmtid[2] &&
|
||||
GET_UINT32 (data + 12) == sum_fmtid[3]) {
|
||||
si->ps_id = OLE_PS_SUMMARY_INFO;
|
||||
sect.ps_id = OLE_PS_SUMMARY_INFO;
|
||||
|
||||
} else {
|
||||
close_summary(si);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
sect.offset = GET_UINT32 (data + 16);
|
||||
append_ole(si->sections,sect);
|
||||
}
|
||||
|
||||
create_item_vector(si->items);
|
||||
|
||||
for (i = 0; i < sections; i++) {
|
||||
OleSummarySection st;
|
||||
|
||||
st = ole_at(si->sections,i);
|
||||
if (!read_items(si, st.ps_id)) {
|
||||
printf("Serious error reading items\n");
|
||||
close_summary(si);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return si;
|
||||
}
|
||||
|
||||
void
|
||||
close_summary(OleSummary *si)
|
||||
{
|
||||
|
||||
if(si->sections)
|
||||
free(si->sections);
|
||||
destroy_ole_vector(si->sections);
|
||||
si->sections = NULL;
|
||||
|
||||
if(si->items)
|
||||
free(si->items);
|
||||
destroy_item_vector(si->items);
|
||||
si->items=NULL;
|
||||
|
||||
free(si);
|
||||
|
||||
}
|
||||
|
||||
gboolean
|
||||
read_items (OleSummary *si, PropertySetID ps_id)
|
||||
{
|
||||
int sect;
|
||||
COLERRNO colerrno;
|
||||
|
||||
for (sect = 0; sect < si->sections->index; sect++) {
|
||||
OleSummarySection st;
|
||||
uint8_t data[8];
|
||||
int i;
|
||||
|
||||
st = ole_at(si->sections,sect);
|
||||
|
||||
if (st.ps_id != ps_id)
|
||||
continue;
|
||||
|
||||
cole_fseek(si->s, st.offset, COLE_SEEK_SET, &colerrno);
|
||||
if (!cole_fread (si->s, data, 8, &colerrno))
|
||||
return FALSE;
|
||||
|
||||
st.bytes = GET_UINT32 (data);
|
||||
st.props = GET_UINT32 (data + 4);
|
||||
|
||||
if (st.props == 0)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < st.props; i++) {
|
||||
item_t item;
|
||||
if (!cole_fread (si->s, data, 8, &colerrno))
|
||||
return FALSE;
|
||||
|
||||
item.id = GET_UINT32 (data);
|
||||
item.offset = GET_UINT32 (data + 4);
|
||||
item.offset = item.offset + st.offset;
|
||||
item.ps_id = ps_id;
|
||||
append_item(si->items, item);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Seeks to the correct place, and returns a handle or NULL on failure */
|
||||
static item_t *
|
||||
seek_to_record (OleSummary *si, OleSummaryPID id)
|
||||
{
|
||||
int i;
|
||||
COLERRNO colerrno;
|
||||
|
||||
for (i = 0; i < si->items->index; i++) {
|
||||
item_t *item = &item_at(si->items,i);
|
||||
if (item->id == SUMMARY_ID(id)) {
|
||||
gboolean is_summary;
|
||||
|
||||
is_summary = ((si->ps_id == OLE_PS_SUMMARY_INFO) &&
|
||||
(item->ps_id == OLE_PS_SUMMARY_INFO));
|
||||
|
||||
if (is_summary) {
|
||||
cole_fseek(si->s, item->offset, COLE_SEEK_SET, &colerrno);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
summary_get_string (OleSummary *si, OleSummaryPID id, gboolean *available)
|
||||
{
|
||||
uint8_t data[8];
|
||||
uint32_t type, len;
|
||||
char *ans;
|
||||
item_t *item;
|
||||
COLERRNO colerrno;
|
||||
|
||||
*available = FALSE;
|
||||
|
||||
if (!(item = seek_to_record (si, id)))
|
||||
return NULL;
|
||||
|
||||
if (!cole_fread(si->s, data, 8, &colerrno))
|
||||
return NULL;
|
||||
|
||||
type = GET_UINT32 (data);
|
||||
len = GET_UINT32 (data + 4);
|
||||
|
||||
if (type != TYPE_STRING) {
|
||||
printf("Summary string type mismatch\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ans = allocate_mem(char, len + 1);
|
||||
|
||||
if (!cole_fread(si->s, ans, len,&colerrno)) {
|
||||
free (ans);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ans[len] = '\0';
|
||||
|
||||
*available = TRUE;
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -83,6 +83,27 @@ void OutputTableHTML(void)
|
||||
do_cr();
|
||||
printf("<TABLE BORDER=\"1\" CELLSPACING=\"2\">");
|
||||
do_cr();
|
||||
if (TableHeaders)
|
||||
{
|
||||
printf("<TR><TH></TH>");
|
||||
for (k=ws_array[i]->first_col; k<=ws_array[i]->biggest_col; k++)
|
||||
{
|
||||
char col_hdr[3];
|
||||
if (k < 26)
|
||||
{
|
||||
col_hdr[0]='A' + (k % 26);
|
||||
col_hdr[1]='\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
col_hdr[0]='A' - 1 + (k / 26);
|
||||
col_hdr[1]='A' + (k % 26);
|
||||
col_hdr[2]='\0';
|
||||
}
|
||||
printf("<TH>%s%s",col_hdr,(aggressive ? "" : "</TH>"));
|
||||
}
|
||||
printf("</TR>\n");
|
||||
}
|
||||
for (j=ws_array[i]->first_row; j<=ws_array[i]->biggest_row; j++)
|
||||
{
|
||||
update_default_alignment(i, j);
|
||||
@ -98,6 +119,8 @@ void OutputTableHTML(void)
|
||||
else
|
||||
printf(">");
|
||||
}
|
||||
if (TableHeaders)
|
||||
printf("<TH>%d%s",j+1,(aggressive ? "" : "</TH>"));
|
||||
for (k=ws_array[i]->first_col; k<=ws_array[i]->biggest_col; k++)
|
||||
{
|
||||
output_cell(ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k],0); /* This stuff happens for each cell... */
|
||||
|
@ -89,6 +89,20 @@ S32 getLong(U8 *ptr)
|
||||
}
|
||||
|
||||
#ifndef WORDS_BIGENDIAN /* Defined in <config.h> */
|
||||
#ifdef __arm__
|
||||
/* cross-endian doubles in little endian ARM */
|
||||
void getDouble(U8 *ptr, F64 *d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
U8 *t = (U8 *)ⅆ
|
||||
|
||||
for (i=0; i<sizeof(F64); i++)
|
||||
*(t+i) = *(ptr+(i^4));
|
||||
|
||||
*d = (F64)dd;
|
||||
}
|
||||
#else
|
||||
/*! Little Endian - 0x86 family */
|
||||
void getDouble(U8 *ptr, F64 *d)
|
||||
{
|
||||
@ -101,6 +115,7 @@ void getDouble(U8 *ptr, F64 *d)
|
||||
|
||||
*d = (F64)dd;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/*! Big Endian version - UltraSparc's, etc. */
|
||||
void getDouble (U8 *ptr, F64 *d)
|
||||
@ -210,12 +225,21 @@ typedef S32 swords[2];
|
||||
(((union{swords sw; F64 dub;} *)(ptr))->sw)
|
||||
|
||||
#ifndef WORDS_BIGENDIAN /*! Defined in <config.h> */
|
||||
#ifdef __arm__
|
||||
/* cross-endian doubles in little endian ARM */
|
||||
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)
|
||||
{
|
||||
noaliasdub(swords,d)[0] = 0;
|
||||
noaliasdub(swords,d)[1] = n << 2;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/*! Big Endian version - UltraSparc's, etc. */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
|
@ -211,6 +211,7 @@ int DumpPage = 0; /*!< Dump page count & max cols & rows */
|
||||
int Xtract = 0; /*!< Extract a range on a page. */
|
||||
int MultiByte = 0; /*!< Output as multibyte */
|
||||
int NoHeaders = 0; /*!< Don't output html header */
|
||||
int TableHeaders = 0; /*!< Output row/column headers */
|
||||
|
||||
|
||||
/* Some Global Flags */
|
||||
@ -299,6 +300,8 @@ int main (int argc, char **argv)
|
||||
print_version();
|
||||
else if(strcmp(argv[i], "-nh") == 0 )
|
||||
NoHeaders = 1;
|
||||
else if(strcmp(argv[i], "-th") == 0 )
|
||||
TableHeaders = 1;
|
||||
else if (strncmp(argv[i], "-xc:", 4) == 0)
|
||||
{
|
||||
int d1, d2;
|
||||
|
@ -152,6 +152,7 @@ extern char *default_image;
|
||||
extern int aggressive;
|
||||
extern int center_tables;
|
||||
extern int NoHeaders;
|
||||
extern int TableHeaders;
|
||||
extern int formula_warnings;
|
||||
extern int Csv;
|
||||
extern xf_attr **xf_array;
|
||||
|
Loading…
Reference in New Issue
Block a user