same one. \r
\r
I've made some attempts to compile catdoc with Watcom C (16-bit),\r
-but haven't completely socceeded. If you do, let me know. \r
+but haven't completely succeeded. If you do, let me know. \r
\r
-1. With 16-bit compilier, use COMPACT memory model\r
+1. With 16-bit compiler, use COMPACT memory model\r
If you are using Turbo C make -fmakefile.tc in src directory\r
should be enough. If you have to change anything in\r
the makefile.tc, please let me know.\r
\r
2. If you are using compilier other than Turbo C /Borland C or\r
Watcom, you should take look on fileutil.c file and possible\r
- add couple of #ifdefs here. If your succed with it, send me a\r
+ add couple of #ifdefs here. If your succeed with it, send me a\r
patch (or entire modified file, if you don't know how to make\r
a good unix-like patch). \r
\r
\r
-3. With 32-bit compilier you are on your own. I don't think that\r
+3. With 32-bit compiler you are on your own. I don't think that\r
small utilities like catdoc should require extender or DPMI host,\r
so I've never tried to build 32-bit version of catdoc for DOS,\r
But if you mix buffer sizes from UNIX version and file-name\r
and unistd.h which is provided in compat directory.\r
Compile getopt.c and add it to cc.lib and put unistd.h in\r
your include directory. Later it might help you to port other\r
- unix software. With other compilier you can also make use\r
+ unix software. With other compiler you can also make use\r
of getopt.c in compat directory (which is from GNU), but I was\r
unable to make it work with Watcom 10.0\r
\r
5. It is probably good idea to link wildargs.obj (or wildargv.obj)\r
- with catdoc. I didn't do it myself becouse I use korn shell on\r
+ with catdoc. I didn't do it myself because I use korn shell on\r
machine where I've developed catdoc, so I don't need to include\r
parameter expansion in program.\r
-CATDOC version 0.93
+CATDOC version 0.95
CATDOC is program which reads MS-Word file and prints readable
ASCII text to stdout, just like Unix cat command.
charachers have to be represented specially in your typesetting system
such as (La)TeX.
-This is completely new version of catdoc, rewritten from scratch.
It features runtime configuration, proper charset handling,
user-definable output formats and support
for Word97 files, which contain UNICODE internally.
So, if you are looking for purely authomatic way to convert Word to LaTeX,
you can better investigate word2x, wvware or LAOLA.
-
Catdoc is distributed under GNU Public License version 2 or above.
for accented latin letters into tex.specchars file and commands
for mathematical symbols (unicode 20xx-25xx).
-
Contributions are welcome.
See files INSTALL and INSTALL.dos for information about compiling and
break;
case 'm': {
char *endptr;
- wrap_margin = strtol(optarg,&endptr,0);
+ wrap_margin = (int)strtol(optarg,&endptr,0);
if (*endptr) {
fprintf(stderr,"Invalid wrap margin value `%s'\n",optarg);
exit(1);
extern int get_word8_char (FILE *f,long *offset,long fileend);
extern const char *charset_from_codepage(unsigned int codepage);
-extern short int *read_charset(const char *filename);
+extern uint16_t *read_charset(const char *filename);
extern CHARSET make_reverse_map (short int *charset);
-extern int to_unicode (short int *charset, int c) ;
+extern int to_unicode (uint16_t *charset, int c) ;
extern int from_unicode (CHARSET charset, int u) ;
/* Converts char in input charset into unicode representation */
/* Should be converted to macro */
/************************************************************************/
-int to_unicode (short int *charset, int c) {
+int to_unicode (uint16_t *charset, int c) {
return charset[c];
}
/************************************************************************/
/* Reads charset file (as got from ftp.unicode.org) and returns array of*/
/* 256 short ints (malloced) mapping from charset t unicode */
/************************************************************************/
-short int * read_charset(const char *filename) {
+uint16_t * read_charset(const char *filename) {
char *path;
FILE *f;
- short int *new;
+ uint16_t *new;
int c;
long int uc;
path= find_file(stradd(filename,CHARSET_EXT),charset_path);
return 0xfeff; /*skip corrupted sequebces*/
if (c <0xE0) {
if (catdoc_read(buf+1, 1, 1, f)<=0) return EOF;
- return ((c & 0x1F)<<6 | ((char)buf[1] & 0x3F));
+ return (((c & 0x1F)<<6) | ((char)buf[1] & 0x3F));
}
if (c <0xF0) {
if (catdoc_read(buf+1, 1, 2, f)<=2) return (int)EOF;
}
struct cp_map {
- int codepage;
+ uint16_t codepage;
char *charset_name;
};
/************************************************************************/
int check_charset(char **filename,const char *charset) {
char *tmppath;
+ if (charset == NULL ) {
+ return 0;
+ }
if (!strncmp(charset,"utf-8",6)) {
*filename=strdup("utf-8");
return 1;
}
tmppath=find_file(stradd(charset,CHARSET_EXT),charset_path);
- /* Some compilers evalate both arguments of && before
- applying, so let's not use && as in the shell */
- if (tmppath) {
- if (*tmppath) {
+ if (tmppath && *tmppath) {
*filename=strdup(charset);
free(tmppath);
return 1;
- } else {
- free(tmppath);
- }
- }
+ }
return 0;
}
CC=tcc
TCDIR=c:\tc
LIB=$(TCDIR)\lib
-CFLAGS=-v -w -mc -DHAVE_LANGINFO -DHAVE_STRDUP -DCATDOC_VERSION="0.94.3"
+CFLAGS=-v -w -mc -DHAVE_LANGINFO -DHAVE_STRDUP -DCATDOC_VERSION="0.95"
OBJ=charsets.obj substmap.obj reader.obj writer.obj fileutil.obj langinfo.obj analyze.obj confutil.obj rtfread.obj numutils.obj sheet.obj xlsparse.obj ole.obj strftime.obj pptparse.obj
.c.obj:
$(CC) -v -c -mc -I../compat $(CFLAGS) $*
*/
if ((unsigned char)header[0]==0xFE && (unsigned char)header[1]==0xFF) {
get_unicode_char = get_utf16msb;
- fputs(convert_char(header[2]<<8|header[3]),stdout);
- fputs(convert_char(header[4]<<8|header[5]),stdout);
- fputs(convert_char(header[6]<<8|header[7]),stdout);
+ fputs(convert_char((header[2]<<8)|header[3]),stdout);
+ fputs(convert_char((header[4]<<8)|header[5]),stdout);
+ fputs(convert_char((header[6]<<8)|header[7]),stdout);
} else if ((unsigned char)header[0]!=0xFF ||
(unsigned char)header[1]!=0xFE) {
int c,j,d;
} else {
d=fgetc(f);
}
- c=c<<6 | (d & 0x3F);
+ c=(c<<6) | (d & 0x3F);
}
}
fputs (convert_char(c),stdout);
}
} else {
get_unicode_char = get_utf16lsb;
- fputs(convert_char(header[3]<<8|header[2]),stdout);
- fputs(convert_char(header[5]<<8|header[4]),stdout);
- fputs(convert_char(header[7]<<8|header[6]),stdout);
+ fputs(convert_char((header[3]<<8)|header[2]),stdout);
+ fputs(convert_char((header[5]<<8)|header[4]),stdout);
+ fputs(convert_char((header[7]<<8)|header[6]),stdout);
}
while (!catdoc_eof(f)) {
i=get_unicode_char(f,&offset,0x7FFFFFFF);
char s[256];
char stopchar;
int escaped, lineno=0, i;
- unsigned int uc;
+ int32_t uc;
path=find_file(filename,add_exe_path(map_path));
if (!path) {
free(map);