"
/* Default names for RTF's default fonts */
#define FONTNIL_STR "Times,TimesRoman,TimesNewRoman"
#define FONTROMAN_STR "Times,Palatino"
#define FONTSWISS_STR "Helvetica,Arial"
#define FONTMODERN_STR "Courier,Verdana"
#define FONTSCRIPT_STR "Cursive,ZapfChancery"
#define FONTDECOR_STR "ZapfChancery"
#define FONTTECH_STR "Symbol"
./unrtf-0.19.2/doc/ 0002755 0001750 0001750 00000000000 07741254407 015273 5 ustar msamaral msamaral 0000000 0000000 ./unrtf-0.19.2/doc/unrtf.html 0000644 0001750 0001750 00000030361 10014300255 017274 0 ustar msamaral msamaral 0000000 0000000
GNU UnRTF User's Manual
GNU UnRTF User's Manual
For program version 0.19.2
(A work in progress.)
Copyright (C) 2001
by Zachary Thayer Smith.
All rights reserved.
Document begun 18 Sept 01.
Last updated 08 Oct 03.
Preface
Once upon a time, GNU UnRTF was a program that I wrote called
"rtf2htm". This seemed too generic a name, since many free programs
of varying quality exist with that name. So I finally settled on
a new name, UnRTF. This name reflects a desire to convert away
from the RTF format, to various other formats.
When it came time to include the program into the GNU software suite,
the program name was changed to GNU UnRTF.
This document is also provided AS-IS and without any warranty of any kind.
The user shall utilize the program and/or this document
at his or her own risk.
I am the primary engineer behind UnRTF, however I have
received comments and bug reports from various people.
These contributors are identified in the source code,
when they desired to be mentioned.
Program License
UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
Introduction
UnRTF is a program to convert RTF (Rich Text) documents to
other formats. At present, conversion to HTML is the most
complete. I am presently adding LaTeX, plain text,
text with VT100 codes, and PostScript conversion.
I will later add my own format, WPML (word processor markup language),
to that list.
Converting to HTML
The program supports many features of the current RTF standard
when converting to HTML.
Character Attributes
| Feature Name | Supported? |
| Text font change | yes |
| Text font sizes | yes |
| Text bold, italic | yes |
| Text single-underline | yes |
| Other text underlining modes (double, dashed etc) | converted to basic underline |
| Text shadow, outline, emboss, engrave | converted to bold or italic |
| Text (single-line) strikethrough | yes |
| Text double-strikethrough | converted to single-strikethrough |
| Text all-caps | yes |
| Text small-caps | yes |
| Text superscript, subscript | yes |
| Text expand/condense | yes (not all browsers supported) |
| Text foreground color change | yes |
| Text background color change | yes |
Character Sets
RTF supports at least four character sets, probably more.
These four are: ANSI, Macintosh(TM), PC codepage 437, and PC codepage 850.
In order to be able to read each of these, a converter can use one
of two strategies: either have conversion tables from each of
these four to each potential output format, or convert from
each of these four to an intermediate, and then have one conversion
table from the intermediate to each output format.
The first approach requires 2n tables, whereas
the second requires 4+n tables where n is the number of output
formats.
Obviously the second approach is
better, but implementing it requires research to find
out what the maximal set of characters is. I haven't gotten around to
that, so for the time being,
UnRTF uses the first approach.
In addition, existing open source software may already
be available to perform such conversions based on a larger
library of character sets. If so, it would be wiser to
utilize an existing system such as that.
Text Blocks
| Feature Name | Supported? |
| Tables | yes |
| Table cell background patterns e.g. diagonal lines | no |
| Paragraph left-align | yes |
| Paragraph right-align | yes |
| Paragraph centered | yes |
| Paragraph justify | yes |
| Paragraph center within table | buggy? |
Converting to LaTeX
LaTeX is a tricky format to convert to, for several reasons.
It's a very specialized system of macros. One could argue that it
would be easier to convert to raw TeX than bother with the
idiosyncrices of LaTeX. It has its own character set and fonts. It has
some commands which are unstable, such as \underline.
Some commonplace items are not for use outside of equations,
e.g. superscripting. I've made an initial effort at getting
the converter to work, with improvements later.
Character Attributes
| Feature Name | Supported? |
| Text font change | not yet |
| Text font sizes | yes |
| Text bold, italic | yes |
| Text single-underline | no |
| Other text underlining modes (double, dashed etc) | no |
| Text shadow, outline, emboss, engrave | no |
| Text (single-line) strikethrough | no |
| Text double-strikethrough | no |
| Text all-caps | yes |
| Text small-caps | yes |
| Text superscript, subscript | yes |
| Text expand/condense | no |
| Text foreground color change | no |
| Text background color change | no |
Character Sets
Under construction.
Text Blocks
| Feature Name | Supported? |
| Tables | yes |
| Table cell background patterns e.g. diagonal lines | no |
| Paragraph left-align | yes? |
| Paragraph right-align | no |
| Paragraph centered | yes? |
| Paragraph justify | yes |
| Paragraph center within table | no |
Converting to PostScript
Converting to PostScript is a tricky because it is not actually
a document format. PostScript is in fact a stack-based programming
language that is executed in the printer.
It lacks such concepts are paragraphs and tables or anything document-related
really, but it does have drawing primitives, mechanisms for accessing
built-in fonts, and can print pages.
Still, at first it would that conversion to this format is a very large
obstacle. Actually, PostScript
is a robust and enjoyable programming language and I am enjoying
the task of writing the PostScript code. Presently my
text renderer is limited, since it is quite new. I will be improving it soon.
Character Attributes
| Feature Name | Supported? |
| Text font change | not yet |
| Text font sizes | yes |
| Text bold, italic | yes |
| Text single-underline | yes |
| Other text underlining modes (double, dashed etc) | converted to basic underline |
| Text shadow, outline, emboss, engrave | shadow only |
| Text (single-line) strikethrough | yes |
| Text double-strikethrough | converted to single-strikethrough |
| Text all-caps | yes |
| Text small-caps | not yet |
| Text superscript, subscript | not yet |
| Text expand/condense | yes | |
| Text foreground color change | not yet |
| Text background color change | not yet |
Character Sets
Under construction.
Text Blocks
Paragraph alignment and tables are not yet supported for PostScript
output.
Extra Features
None yet.
Converting to Plain Text
Under construction.
Converting to Text with VT100 control codes
Under construction.
Converting to WPML
Under construction.
Features Not Yet Supported
As development continues, I will try to add support
for other features. Some that I know are not
covered but that I would like to address include:
- numbered lists and point lists
- shapes (objects composed of lines, circles etc)
- index entries and index generation
- tables of contents entries and generation
- automatic conversion of embedded images to PNG
Using UnRTF
Please refer to the manual page (unrtf.1).
Compilation
Please see the README file.
Theory of Operation
This program essentially reads the entire
RTF file into memory and works on it.
Because of this, it may require that you run
the program on a computer that has virtual
memory enabled. With smaller input files
it should be possible to use the program under DOS,
so long as it is compiled with the
DOS version of GCC, called DJGPP.
The program operates by dealing with each
RTF word in order, and interpreting those
which are commands. Some RTF command words
have parameters in a subtree. The command
\info is an example. The program has separate
routines to handle such cases. In fact,
most commands have separate functions which
handle their execution.
When the program was called rtf2htm (up through
version 0.17 or so), the output mechanism was
based on the production of HTML exclusively.
This has now changed, and the abstraction of an
OutputPersonality is used allow other output
formats. Each format has its own C file,
in which all the basic strings for producing
text are stored, as well as character conversion
tables. Note, RTF itself allows several character
sets to be used, so for each output personality
there are that many conversion tables.
One or two things that UnRTF does are fairly
tricky, such as the conversion of tabular data.
RTF encodes tables in an odd way compared
to HTML or LaTeX, so the code is accordingly
complicated. Suffice it to say that it works,
so don't touch it. Do note, PostScript does not
have concept of a table, since it is not
a document format but a programming language.
I will eventually get tables working under PS
anyway, by porting my table rendering code
over from my HTML viewer, Beest.
I have implemented at least three optimizations to
reduce the amount of memory required
by the program and the time used for the conversion.
- Text words and RTF command-words are stored in a
hash table. This has the effect of saving memory
since commonly occurring words such as "the" and "\par"
are not repeated in memory. When the program
finishes doing the conversion, it reports the
number of words hashed.
- RTF command-words and pointers to the functions
that interpret them are stored in a static hash
so that execution can be speedy. This replaces the
long if-else sequence once used and greatly speeds
up the program.
- Input data are buffered, to eliminate the large
number of calls to the fgetc function. In a modern
OS such as Linux this has only a small impact, but
under DOS it can really help.
Notes
-
LaTeX is a system of macros for TeX originated by Leslie Lamport
-
WPML is a tentative document format by Zachary Thayer Smith
-
PostScript is a stack-based programming language for printers.
./unrtf-0.19.2/entity.c 0000644 0001750 0001750 00000001615 07702022074 016175 0 ustar msamaral msamaral 0000000 0000000 #include
char *entity(int symbol)
{
switch(symbol)
{
case 97:
return("α");
case 98:
return("β");
case 99:
return("χ");
case 100:
return("δ");
case 101:
return("ε");
case 102:
return("φ");
case 103:
return("γ");
case 109:
return("μ");
case 110:
return("ν");
case 111:
return("ο");
case 112:
return("π");
case 113:
return("θ");
case 114:
return("ρ");
case 115:
return("σ");
case 116:
return("τ");
case 117:
return("υ");
case 118:
return("&omega1;");
case 119:
return("ω");
case 120:
return("ξ");
case 121:
return("ψ");
case 122:
return("ζ");
case 177:
return("±");
default:
fprintf(stderr, "symbol %d missing in entity.c\n",
symbol);
return("&UnknownEntity;");
}
}
./unrtf-0.19.2/error.c 0000644 0001750 0001750 00000005712 07741252175 016026 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: error
* Author name: Zach Smith
* Create date: 01 Sep 00
* Purpose: Management of errors and warnings, when reporting
* the source code file/line is not necessary.
*----------------------------------------------------------------------
* Changes
* 10 Oct 00, tuorfa@yahoo.com: added usage()
* 15 Oct 00, tuorfa@yahoo.com: improved output readability
* 22 Sep 01, tuorfa@yahoo.com: removed mention of line number in handlers
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
*--------------------------------------------------------------------*/
#include
#if linux /* daved - 0.19.1 */
#include
#endif
#include "defs.h"
#include "main.h"
/*========================================================================
* Name: usage
* Purpose: Prints usage information and exits with an error.
* Args: None.
* Returns: None.
*=======================================================================*/
void
usage ()
{
fprintf (stderr, "Usage: %s\n", USAGE);
exit(-3);
}
/*========================================================================
* Name: error_handler
* Purpose: Prints error message and other useful info, then exits.
* Args: Message.
* Returns: None.
*=======================================================================*/
void
error_handler (char* message)
{
fprintf (stderr, "Error: %s\n", message);
exit(10);
}
/*========================================================================
* Name: warning_handler
* Purpose: Prints useful info to stderr, but doesn't exit.
* Args: Message.
* Returns: None.
*=======================================================================*/
void
warning_handler (char* message)
{
fprintf (stderr, "Warning: %s\n", message);
}
./unrtf-0.19.2/error.h 0000644 0001750 0001750 00000003627 07356513561 016037 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: error.h
* Author name: Zach Smith
* Create date: 1 Sept 2000
* Purpose: Macros to be executed at the start of a function,
* when reporting source code file/line is useful.
*----------------------------------------------------------------------
* Changes
*--------------------------------------------------------------------*/
#define CHECK_PARAM_NOT_NULL(XX) { if ((XX)==NULL) { fprintf (stderr, "internal error: null pointer param in %s at %d\n", __FILE__, __LINE__); exit (1); }}
#define CHECK_MALLOC_SUCCESS(XX) { if ((XX)==NULL) { fprintf (stderr, "internal error: cannot allocate memory in %s at %d\n", __FILE__, __LINE__); exit (1); }}
extern void usage(void);
extern void error_handler (char*);
extern void warning_handler (char*);
./unrtf-0.19.2/hash.c 0000644 0001750 0001750 00000012262 07741252272 015614 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: hash
* Author name: Zach Smith
* Create date: 01 Sep 00
* Purpose: Word-hash management. Words are put into a hash and an
* identifier is returned. This is used to save us from
* doing multiple mallocs for recurring strings such as
* 'the' and \par. This is not a big issue under Unix,
* but it is under other OSes and anyway, waste not want not.
*----------------------------------------------------------------------
* Changes:
* 08 Apr 01, tuorfa@yahoo.com: check for out of memory after malloc.
* 21 Apr 01, tuorfa@yahoo.com: signed to conversion unsigned bug
* 03 Aug 01, tuorfa@yahoo.com: fixes for using 16-bit compiler
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 08 Oct 03, daved@physiol.usyd.edu.au: some type fixes
*--------------------------------------------------------------------*/
#include
#include
#include "error.h"
#include "main.h"
#include "malloc.h"
typedef struct _hi {
struct _hi *next;
char *str;
unsigned long value;
}
HashItem;
/* Index by first char of string */
static HashItem *hash[256];
static unsigned long hash_length[256];
static unsigned long hash_value=0;
/*========================================================================
* Name: hash_init
* Purpose: Clear the hash table.
* Args: None.
* Returns: None.
*=======================================================================*/
void
hash_init ()
{
int i;
for (i=0; i<256; i++) {
hash[i]=NULL;
hash_length[i]=0;
}
}
/*========================================================================
* Name: hash_stats
* Purpose: Prints to stderr the number of words stored.
* Args: None.
* Returns: None.
*=======================================================================*/
void
hash_stats ()
{
int i;
unsigned long total=0;
for (i=0; i<256; i++) {
total += hash_length[i];
}
fprintf (stderr,"%lu words were hashed.\n", total);
}
/*========================================================================
* Name: hashitem_new
* Purpose: Creates a new linked list item for the hash table.
* Args: String.
* Returns: HashItem.
*=======================================================================*/
static HashItem *
hashitem_new (char *str)
{
HashItem *hi;
unsigned long i;
hi=(HashItem*) my_malloc(sizeof(HashItem));
if (!hi)
error_handler ("out of memory");
memset ((void*)hi, 0, sizeof (HashItem));
hi->str = my_strdup(str);
i = *str;
if (i=='\\') i=str[1];
i <<= 24;
hi->value = i | (hash_value++ & 0xffffff);
hi->next = NULL;
#if 0
if (debug_mode) {
printf ("\n",
hi->value, hi->str);
}
#endif
return hi;
}
/*========================================================================
* Name: hash_get_index
* Purpose: Given a string, returns the "index" i.e. the word identifier.
* Args: String.
* Returns: Index.
*=======================================================================*/
unsigned long
hash_get_index (char *str)
{
#if 1 /* daved - 0.19.1 */
unsigned short index;
unsigned char ch;
#else
int index;
char ch;
#endif
HashItem *hi;
#if 1 /* daved - 0.19.1 */
ch = (unsigned char)*str;
#else
ch = *str;
#endif
if (ch=='\\' && *(str+1))
ch = *(str+1);
index = ch;
hi = hash[index];
while (hi) {
if (!strcmp(hi->str,str))
return hi->value;
hi=hi->next;
}
/* not in hash */
hi = hashitem_new (str);
hi->next = hash[index];
hash [index] = hi;
++hash_length [index];
return hi->value;
}
/*========================================================================
* Name: hash_get_string
* Purpose: Given the index (word identifier) returns the word string.
* Args: Index.
* Returns: String, or NULL if not found.
*=======================================================================*/
char*
hash_get_string (unsigned long value)
{
int index;
HashItem *hi;
index = value >> 24;
hi = hash[index];
while (hi) {
if (hi->value == value)
return hi->str;
hi=hi->next;
}
warning_handler ("word not in hash");
return NULL;
}
./unrtf-0.19.2/hash.h 0000644 0001750 0001750 00000003076 07356513561 015627 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: hash.h
* Author name: Zach Smith
* Create date: 1 Sept 2000
* Purpose: Definitions for the hash module.
*----------------------------------------------------------------------
* Changes:
*--------------------------------------------------------------------*/
extern void hash_init (void);
extern void hash_stats (void);
extern unsigned long hash_get_index (char *);
extern char* hash_get_string (unsigned long );
./unrtf-0.19.2/html.c 0000644 0001750 0001750 00000043174 07741252366 015647 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: html
* Author name: Zach Smith
* Create date: 18 Sep 01
* Purpose: HTML-specific output module
*----------------------------------------------------------------------
* Changes:
* 01 Aug 01, tuorfa@yahoo.com: code moved over from convert.c
* 03 Aug 01, tuorfa@yahoo.com: removed null entries to save space
* 08 Aug 01, tuorfa@yahoo.com, gommer@gmx.net: fixed/added some ANSI chars
* 18 Sep 01, tuorfa@yahoo.com: moved character sets into html.c etc
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 08 Oct 03, daved@physiol.usyd.edu.au: mac special character fixes
*--------------------------------------------------------------------*/
#include
#include
#include "malloc.h"
#include "defs.h"
#include "error.h"
#include "main.h"
#include "output.h"
static char* ascii [96] = {
/* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'",
/* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
/* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
/* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
/* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
/* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
/* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
/* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_",
/* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
/* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
/* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
/* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "",
};
static char* ansi [] = {
/* 0x82 */ "‚", "ƒ",
"„", "…", "†", "‡",
"ˆ", "‰", "Š", "‹",
"Œ", NULL, NULL, NULL,
/* 0x90 */ NULL,"`","'","``","''","•","–","—",
/* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xa0 */ " ","¡","¢","£","¤","¥","¦","§",
/* 0xa8 */ "¨","©","ª","«","¬","","®","¯",
/* 0xb0 */ "°", "±","²","³","´","µ","¶","·",
/* 0xb8 */ "¸","¹", "º","»", "¼", "½","¾","¿",
/* 0xc0 */ "À","Á","Â","Ã","Ä","Å","Æ","Ç",
/* 0xc8 */ "È","É","Ê","Ë","Ì","Í","Î","Ï",
/* 0xd0 */ "Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×",
/* 0xd8 */ "Ø","Ù","Ú","Û","Ü","Ý","Þ","ß",
/* 0xe0 */ "à","á","â","ã","ä","å","æ","ç",
/* 0xe8 */ "è","é","ê","ë","ì","í","î","ï",
/* 0xf0 */ "ð","ñ","ò","ó","ô","õ","ö","÷",
/* 0xf8 */ "ø","ù","ú","û","ü","ý","þ","ÿ",
};
#if 1 /* daved - 0.19.1 */
static char* mac [] = {
/* 0xa4 */ "•", NULL,NULL,NULL,
/* 0xa8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xb0 */ NULL,NULL,NULL,NULL,NULL,"μ",NULL,NULL,
/* 0xb8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xc8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xd0 */ "—","–","“","”","&lquo;","&rquo;",
};
#else
static char* mac [] = {
/* 0xa4 */ "•", NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xb0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xd0 */ "—","–","“","”","&lquo;","&rquo;",
};
#endif
static char* cp437 [] = {
/* 0x80 */ "ç",
/* 0x81 */ "ü",
/* 0x82 */ "é",
/* 0x83 */ "â",
/* 0x84 */ "ä",
/* 0x85 */ "à",
/* 0x86 */ "å",
/* 0x87 */ "ç",
/* 0x88 */ "ê",
/* 0x89 */ "ë",
/* 0x8a */ "è",
/* 0x8b */ "ï",
/* 0x8c */ "î",
/* 0x8d */ "ì",
/* 0x8e */ "ä",
/* 0x8f */ "å",
/* 0x90 */ "é",
/* 0x91 */ "æ",
/* 0x92 */ "æ",
/* 0x93 */ "ô",
/* 0x94 */ "ö",
/* 0x95 */ "ò",
/* 0x96 */ "û",
/* 0x97 */ "ù",
/* 0x98 */ "ÿ",
/* 0x99 */ "ö",
/* 0x9a */ "ü",
/* 0x9b */ "¢",
/* 0x9c */ "£",
/* 0x9d */ "¥",
/* 0x9e */ "₧", /* peseta */
/* 0x9f */ "ƒ", /* small f with hook */
/* 0xa0 */ "á",
/* 0xa1 */ "í",
/* 0xa2 */ "ó",
/* 0xa3 */ "ú",
/* 0xa4 */ "ñ",
/* 0xa5 */ "ñ",
/* 0xa6 */ "ª",
/* 0xa7 */ "¼",
/* 0xa8 */ "¿",
/* 0xa9 */ "⌐", /* reversed not */
/* 0xaa */ "¬",
/* 0xab */ "½",
/* 0xac */ "»",
/* 0xad */ "¡",
/* 0xae */ "«",
/* 0xaf */ "º",
/* 0xb0 */ "░", /* light shade */
/* 0xb1 */ "▒", /* med. shade */
/* 0xb2 */ "▓", /* dark shade */
/* 0xb3 */ "│", /* box-draw light vert. */
/* 0xb4 */ "┤", /* box-draw light vert. + lt. */
/* 0xb5 */ "╡", /* box-draw vert. sgl. + lt. dbl. */
/* 0xb6 */ "╢", /* box-draw vert. dbl. + lt. sgl. */
/* 0xb7 */ "╖", /* box-draw dn. dbl. + lt. sgl. */
/* 0xb8 */ "╕", /* box-draw dn. sgl. + lt. dbl. */
/* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */
/* 0xba */ "║", /* box-draw dbl. vert. */
/* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */
/* 0xbc */ "╝", /* box-draw dbl. up + lt. */
/* 0xbd */ "╜", /* box-draw up dbl. + lt. sgl. */
/* 0xbe */ "╛", /* box-draw up sgl. + lt. dbl. */
/* 0xbf */ "┐", /* box-draw light dn. + lt. */
/* 0xc0 */ "└", /* box-draw light up + rt. */
/* 0xc1 */ "┴", /* box-draw light up + horiz. */
/* 0xc2 */ "┬", /* box-draw light dn. + horiz. */
/* 0xc3 */ "├", /* box-draw light vert. + rt. */
/* 0xc4 */ "─", /* box-draw light horiz. */
/* 0xc5 */ "┼", /* box-draw light vert. + horiz. */
/* 0xc6 */ "╞", /* box-draw vert. sgl. + rt. dbl. */
/* 0xc7 */ "╟", /* box-draw vert. dbl. + rt. sgl. */
/* 0xc8 */ "╚", /* box-draw dbl. up + rt. */
/* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */
/* 0xca */ "╩", /* box-draw dbl. up + horiz. */
/* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */
/* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */
/* 0xcd */ "═", /* box-draw dbl. horiz. */
/* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */
/* 0xcf */ "╧", /* box-draw up sgl. + horiz. dbl. */
/* 0xd0 */ "╨", /* box-draw up dbl. + horiz. sgl. */
/* 0xd1 */ "╤", /* box-draw dn. sgl. + horiz. dbl. */
/* 0xd2 */ "╥", /* box-draw dn. dbl. + horiz. sgl. */
/* 0xd3 */ "╙", /* box-draw up dbl. + rt. sgl. */
/* 0xd4 */ "╘", /* box-draw up sgl. + rt. dbl. */
/* 0xd5 */ "╒", /* box-draw dn. sgl. + rt. dbl. */
/* 0xd6 */ "╓", /* box-draw dn. dbl. + rt. sgl. */
/* 0xd7 */ "╫", /* box-draw vert. dbl. + horiz. sgl. */
/* 0xd8 */ "╪", /* box-draw vert. sgl. + horiz. dbl. */
/* 0xd9 */ "┘", /* box-draw light up + lt. */
/* 0xda */ "┌", /* box-draw light dn. + rt. */
/* 0xdb */ "█", /* full block */
/* 0xdc */ "▄", /* lower 1/2 block */
/* 0xdd */ "▌", /* lt. 1/2 block */
/* 0xde */ "▐", /* rt. 1/2 block */
/* 0xdf */ "▀", /* upper 1/2 block */
/* 0xe0 */ "α", /* greek small alpha */
/* 0xe1 */ "ß",
/* 0xe2 */ "Γ", /* greek cap gamma */
/* 0xe3 */ "π", /* greek small pi */
/* 0xe4 */ "Σ", /* greek cap sigma */
/* 0xe5 */ "σ", /* greek small sigma */
/* 0xe6 */ "µ",
/* 0xe7 */ "τ", /* greek small tau */
/* 0xe8 */ "Φ", /* greek cap phi */
/* 0xe9 */ "Θ", /* greek cap theta */
/* 0xea */ "Ω", /* greek cap omega */
/* 0xeb */ "δ", /* greek small delta */
/* 0xec */ "∞", /* inf. */
/* 0xed */ "φ", /* greek small phi */
/* 0xee */ "ε", /* greek small epsilon */
/* 0xef */ "∩", /* intersect */
/* 0xf0 */ "≡", /* identical */
/* 0xf1 */ "±",
/* 0xf2 */ "≥", /* greater-than or equal to */
/* 0xf3 */ "≤", /* less-than or equal to */
/* 0xf4 */ "⌠", /* top 1/2 integral */
/* 0xf5 */ "⌡", /* bottom 1/2 integral */
/* 0xf6 */ "÷",
/* 0xf7 */ "≈", /* almost = */
/* 0xf8 */ "+",
/* 0xf9 */ "∙", /* bullet op */
/* 0xfa */ "·",
/* 0xfb */ "√", /* sqrt */
/* 0xfc */ "ⁿ", /* super-script small n */
/* 0xfd */ "²",
/* 0xfe */ "■", /* black square */
/* 0xff */ " ",
};
static char* cp850 [] = {
/* 0x80 */ "ç",
/* 0x81 */ "ü",
/* 0x82 */ "é",
/* 0x83 */ "â",
/* 0x84 */ "ä",
/* 0x85 */ "à",
/* 0x86 */ "å",
/* 0x87 */ "ç",
/* 0x88 */ "ê",
/* 0x89 */ "ë",
/* 0x8a */ "è",
/* 0x8b */ "ï",
/* 0x8c */ "î",
/* 0x8d */ "ì",
/* 0x8e */ "ä",
/* 0x8f */ "å",
/* 0x90 */ "é",
/* 0x91 */ "æ",
/* 0x92 */ "æ",
/* 0x93 */ "ô",
/* 0x94 */ "ö",
/* 0x95 */ "ò",
/* 0x96 */ "û",
/* 0x97 */ "ù",
/* 0x98 */ "ÿ",
/* 0x99 */ "ö",
/* 0x9a */ "ü",
/* 0x9b */ "ø",
/* 0x9c */ "£",
/* 0x9d */ "ø",
/* 0x9e */ "×",
/* 0x9f */ "ƒ", /* small f with hook */
/* 0xa0 */ "á",
/* 0xa1 */ "í",
/* 0xa2 */ "ó",
/* 0xa3 */ "ú",
/* 0xa4 */ "ñ",
/* 0xa5 */ "ñ",
/* 0xa6 */ "ª",
/* 0xa7 */ "¼",
/* 0xa8 */ "¿",
/* 0xa9 */ "®",
/* 0xaa */ "¬",
/* 0xab */ "½",
/* 0xac */ "»",
/* 0xad */ "¡",
/* 0xae */ "«",
/* 0xaf */ "º",
/* 0xb0 */ "░", /* light shade */
/* 0xb1 */ "▒", /* med. shade */
/* 0xb2 */ "▓", /* dark shade */
/* 0xb3 */ "│", /* box-draw light vert. */
/* 0xb4 */ "┤", /* box-draw light vert. + lt. */
/* 0xb5 */ "á",
/* 0xb6 */ "â",
/* 0xb7 */ "à",
/* 0xb8 */ "©",
/* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */
/* 0xba */ "║", /* box-draw dbl. vert. */
/* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */
/* 0xbc */ "╝", /* box-draw dbl. up + lt. */
/* 0xbd */ "¢",
/* 0xbe */ "¥",
/* 0xbf */ "┐", /* box-draw light dn. + lt. */
/* 0xc0 */ "└", /* box-draw light up + rt. */
/* 0xc1 */ "┴", /* box-draw light up + horiz. */
/* 0xc2 */ "┬", /* box-draw light dn. + horiz. */
/* 0xc3 */ "├", /* box-draw light vert. + rt. */
/* 0xc4 */ "─", /* box-draw light horiz. */
/* 0xc5 */ "┼", /* box-draw light vert. + horiz. */
/* 0xc6 */ "ã",
/* 0xc7 */ "ã",
/* 0xc8 */ "╚", /* box-draw dbl. up + rt. */
/* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */
/* 0xca */ "╩", /* box-draw dbl. up + horiz. */
/* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */
/* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */
/* 0xcd */ "═", /* box-draw dbl. horiz. */
/* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */
/* 0xcf */ "¤",
/* 0xd0 */ "ð",
/* 0xd1 */ "ð",
/* 0xd2 */ "ê",
/* 0xd3 */ "ë",
/* 0xd4 */ "è",
/* 0xd5 */ "ı", /* small dotless i */
/* 0xd6 */ "í",
/* 0xd7 */ "î",
/* 0xd8 */ "ï",
/* 0xd9 */ "┘", /* box-draw light up + lt. */
/* 0xda */ "┌", /* box-draw light dn. + rt. */
/* 0xdb */ "█", /* full-block */
/* 0xdc */ "▄", /* lower 1/2 block */
/* 0xdd */ "¦",
/* 0xde */ "ì",
/* 0xdf */ "▀", /* upper 1/2 block */
/* 0xe0 */ "ó",
/* 0xe1 */ "ß",
/* 0xe2 */ "ô",
/* 0xe3 */ "ò",
/* 0xe4 */ "õ",
/* 0xe5 */ "õ",
/* 0xe6 */ "µ",
/* 0xe7 */ "þ",
/* 0xe8 */ "þ",
/* 0xe9 */ "ú",
/* 0xea */ "û",
/* 0xeb */ "ù",
/* 0xec */ "ý",
/* 0xed */ "ý",
/* 0xee */ "¯",
/* 0xef */ "´",
/* 0xf0 */ "",
/* 0xf1 */ "±",
/* 0xf2 */ "‗", /* dbl. lowline */
/* 0xf3 */ "¾",
/* 0xf4 */ "¶",
/* 0xf5 */ "§",
/* 0xf6 */ "÷",
/* 0xf7 */ "¸",
/* 0xf8 */ "+",
/* 0xf9 */ "¨",
/* 0xfa */ "·",
/* 0xfb */ "¹",
/* 0xfc */ "³",
/* 0xfd */ "²",
/* 0xfe */ "■", /* black square */
/* 0xff */ " ",
};
/*========================================================================
* Name: html_init
* Purpose: Generates the HTML output personality.
* Args: None.
* Returns: OutputPersonality.
*=======================================================================*/
OutputPersonality *
html_init (void)
{
OutputPersonality* op;
op = op_create();
op->comment_begin = "\n";
op->document_begin = "\n";
op->document_end = "\n";
op->header_begin = "\n";
op->header_end = "\n";
op->document_title_begin = "";
op->document_title_end = "\n";
op->document_author_begin = "\n";
op->document_changedate_begin = "\n";
op->body_begin = "";
op->body_end = "\n";
op->paragraph_begin = "";
op->paragraph_end = "
\n";
op->center_begin = "";
op->center_end = "\n";
op->justify_begin = "\n";
op->justify_end = "
\n";
op->align_left_begin = "\n";
op->align_left_end = "
\n";
op->align_right_begin = "\n";
op->align_right_end = "
\n";
op->forced_space = " ";
op->line_break = "
\n";
op->page_break = "
\n";
op->hyperlink_begin = "hyperlink_end = "\">hyperlink";
op->imagelink_begin = "
imagelink_end = "\">";
op->table_begin = "
\n";
op->table_row_begin = "";
op->table_row_end = "
\n";
op->table_cell_begin = "";
op->table_cell_end = " | \n";
/* Character attributes */
op->font_begin = "";
op->font_end = "";
op->fontsize_begin = "";
op->fontsize_end = "";
op->fontsize8_begin = "";
op->fontsize8_end = "";
op->fontsize10_begin = "";
op->fontsize10_end = "";
op->fontsize12_begin = "";
op->fontsize12_end = "";
op->fontsize14_begin = "";
op->fontsize14_end = "";
op->fontsize18_begin = "";
op->fontsize18_end = "";
op->fontsize24_begin = "";
op->fontsize24_end = "";
op->smaller_begin = "";
op->smaller_end = "";
op->bigger_begin = "";
op->bigger_end = "";
op->foreground_begin = "";
op->foreground_end = "";
op->background_begin = "";
op->background_end = "";
op->bold_begin = "";
op->bold_end = "";
op->italic_begin = "";
op->italic_end = "";
op->underline_begin = "";
op->underline_end = "";
op->dbl_underline_begin = "";
op->dbl_underline_end = "";
op->superscript_begin = "";
op->superscript_end = "";
op->subscript_begin = "";
op->subscript_end = "";
op->strikethru_begin = "";
op->strikethru_end = "";
op->dbl_strikethru_begin = "";
op->dbl_strikethru_end = "";
op->emboss_begin="";
op->emboss_end = "";
op->engrave_begin = "";
op->engrave_end = "";
op->shadow_begin= "";
op->shadow_end= "";
op->outline_begin= "";
op->outline_end= "";
op->expand_begin = "";
op->expand_end = "";
op->pointlist_begin = "\n";
op->pointlist_end = "
\n";
op->pointlist_item_begin = "";
op->pointlist_item_end = "\n";
op->numericlist_begin = "\n";
op->numericlist_end = "
\n";
op->numericlist_item_begin = "";
op->numericlist_item_end = "\n";
op->simulate_small_caps = TRUE;
op->simulate_all_caps = TRUE;
op->simulate_word_underline = TRUE;
op->ascii_translation_table = ascii;
op->ansi_translation_table = ansi;
op->ansi_first_char = 0x82;
op->ansi_last_char = 0xff;
op->cp437_translation_table = cp437;
op->cp437_first_char = 0x80;
op->cp437_last_char = 0xff;
op->cp850_translation_table = cp850;
op->cp850_first_char = 0x80;
op->cp850_last_char = 0xff;
op->mac_translation_table = mac;
op->mac_first_char = 0xa4;
op->mac_last_char = 0xd5;
op->chars.right_quote = "'";
op->chars.left_quote = "`";
op->chars.right_dbl_quote = "''";
op->chars.left_dbl_quote = "``";
return op;
}
./unrtf-0.19.2/html.h 0000644 0001750 0001750 00000002773 07356513561 015653 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: html
* Author name: Zach Smith
* Create date: 19 Sep 01
* Purpose: Definitions for the HTML output personality
*----------------------------------------------------------------------
* Changes:
*--------------------------------------------------------------------*/
#ifndef _HTML
extern OutputPersonality* html_init(void);
#define _HTML
#endif
./unrtf-0.19.2/latex.c 0000644 0001750 0001750 00000017366 07356513561 016023 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: latex
* Author name: Zach Smith
* Create date: 18 Sep 01
* Purpose: LaTeX-specific output module
*----------------------------------------------------------------------
* Changes:
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 23 Sep 01, tuorfa@yahoo.com: fixed accented characters
*--------------------------------------------------------------------*/
#include
#include
#include "malloc.h"
#include "defs.h"
#include "error.h"
#include "main.h"
#include "output.h"
static char* ascii [96] = {
/* 0x20 */ " ", "!", "''", "\\#", "{\\$}", "\\%", "\\&", "'",
/* 0x28 */ "(", ")", "{\ast}", "+", ",", "-", ".", "/",
/* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
/* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?",
/* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G",
/* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O",
/* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W",
/* 0x58 */ "X", "Y", "Z", "[", "{\\slash}", "]", "{\\caret}", "\\_",
/* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g",
/* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o",
/* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w",
/* 0x78 */ "x", "y", "z", "\\{", "$\\mid$", "\\}", "\\~{ }", "",
};
static char* ansi [] = {
/* 0x82 */ "?", "?",
"?", "{\\ldots}", "{\\dag}", "{\\ddag}",
"?", "?", "?", "?",
"{\\OE}", NULL, NULL, NULL,
/* 0x90 */ NULL,"`","'","``","''","{\\bullet}","--","---",
/* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xa0 */ "\\:","?","?","{\\pounds}","?","\\Y","?","?",
/* 0xa8 */ "?","{\\copyright}","?","?","?","?","?","?",
/* 0xb0 */ "\\o ", "\\+- ","$^{2}$","$^{3}$","?","?","\\P ","?",
/* 0xb8 */ "?","$^{1}$", "?","?", "\\frac{1}{4}", "\\frac{1}{2}","\\frac{3}{4}",
"?",
/* 0xc0 */ "\\`{A}","\\'{A}","\\o{A}",
"\\~{A}","\\\"{A}","?","\\AE ","\\c{C}",
/* 0xc8 */ "\\`{E}","\\'{E}","\\o{E}","\\\"{E}",
"\\`{I}","\\'{I}","\\o{I}","\\\"{I}",
/* 0xd0 */ "\\ETH ","\\~{N}","\\`{O}","\\'{O}",
"\\o{O}","\\~{O}","\\\"{O}","\\mult ",
/* 0xd8 */ "?","\\`{U}","\\'{U}","\\o{U}",
"\\\"{U}","\\'{Y}","\\THORN","?",
/* 0xe0 */ "\\`{a}","\\'{a}","\\o{a}",
"\\~{a}","\\\"{a}","?","\\ae ","\\c{c}",
/* 0xe8 */ "\\`{e}","\\'{e}","\\o{e}","\\\"{e}",
"\\`{i}","\\'{i}","\\o{i}","\\\"{i}",
/* 0xf0 */ "\\eth ","\\~{n}","\\`{o}","\\'{o}",
"\\o{o}","\\~{o}","\\\"{o}","\\div ",
/* 0xf8 */ "\\slash{o}","\\`{u}","\\'{u}","\\o{u}",
"\\\"{u}","\\'{y}","\\thorn ","\\\"{y}",
};
static char* mac [] = {
"?",
};
static char* cp437 [] = {
"?",
};
static char* cp850 [] = {
"?",
};
/*========================================================================
* Name: latex_init
* Purpose: Generates the output personality for LaTeX.
* Args: None.
* Returns: OutputPersonality.
*=======================================================================*/
OutputPersonality *
latex_init (void)
{
OutputPersonality* op;
op = op_create();
op->comment_begin = "%% ";
op->comment_end = "\n";
op->document_begin = "\\documentclass[11pt]{article}\n";
op->document_end = "\\end{document}";
op->header_begin = "";
op->header_end = "";
op->document_title_begin = "\\title{";
op->document_title_end = "}\n";
op->document_author_begin = "\\author{";
op->document_author_end = "}\n";
op->document_changedate_begin = "\\date{";
op->document_changedate_end = "}\n";
op->body_begin = "\n\n\\begin{document}\n\\maketitle\n";
op->body_end = "\\end{document}\n";
op->paragraph_begin = "\\par\n";
op->paragraph_end = "";
op->center_begin = "\\center{\n";
op->center_end = "}\n";
op->justify_begin = "";
op->justify_end = "";
op->align_left_begin = "\\begin{sloppy}\n";
op->align_left_end = "\\end{sloppy}\n";
op->align_right_begin = "";
op->align_right_end = "";
op->forced_space = "";
op->line_break = "\\par\n";
op->page_break = "\\pagebreak ";
op->hyperlink_begin = "";
op->hyperlink_end = "";
op->imagelink_begin = "";
op->imagelink_end = "";
op->table_begin = "\\begin{tabular}{|lllll}\n";
op->table_end = "\n\\end{tabular}\n";
op->table_row_begin = "";
op->table_row_end = "\\hline \\\\\n";
op->table_cell_begin = "";
op->table_cell_end = " & ";
/* Character attributes */
op->font_begin = "";
op->font_end = "";
op->fontsize_begin = "";
op->fontsize_end = "";
op->fontsize8_begin = "\\tiny{";
op->fontsize8_end = "}";
op->fontsize10_begin = "\\small{";
op->fontsize10_end = "}";
op->fontsize12_begin = "\\normalsize{";
op->fontsize12_end = "}";
op->fontsize14_begin = "{\\large ";
op->fontsize14_end = "}";
op->fontsize18_begin = "{\\Large ";
op->fontsize18_end = "}";
op->fontsize24_begin = "{\\LARGE ";
op->fontsize24_end = "}";
op->fontsize36_begin = "{\\huge ";
op->fontsize36_end = "}";
op->fontsize48_begin = "{\\Huge ";
op->fontsize48_end = "}";
op->smaller_begin = "";
op->smaller_end = "";
op->bigger_begin = "";
op->bigger_end = "";
op->foreground_begin = "";
op->foreground_end = "";
op->background_begin = "";
op->background_end = "";
op->bold_begin = "{\\bf ";
op->bold_end = "}";
op->italic_begin = "{\\it ";
op->italic_end = "}";
op->underline_begin = "";
op->underline_end = "\n";
op->dbl_underline_begin = "{\\ul ";
op->dbl_underline_end = "}";
op->pointlist_begin = "\\begin{itemize}\n";
op->pointlist_end = "\\end{itemize}\n";
op->pointlist_item_begin = "\\item ";
op->pointlist_item_end = "";
op->numericlist_begin = "\\begin{enumerate}\n";
op->numericlist_end = "\\end{enumerate}\n";
op->numericlist_item_begin = "\\item ";
op->numericlist_item_end = "";
op->superscript_begin = "$^{";
op->superscript_end = "}$";
op->subscript_begin = "$_{";
op->subscript_end = "}$";
op->strikethru_begin = "{";
op->strikethru_end = "}";
op->dbl_strikethru_begin = "{";
op->dbl_strikethru_end = "}";
op->emboss_begin="";
op->emboss_end = "";
op->engrave_begin = "";
op->engrave_end = "";
op->shadow_begin= "";
op->shadow_end= "";
op->small_caps_begin= "\\textsc{";
op->small_caps_end= "}";
op->outline_begin= "";
op->outline_end= "";
op->expand_begin = "";
op->expand_end = "";
op->simulate_small_caps = FALSE;
op->simulate_all_caps = TRUE;
op->simulate_word_underline = TRUE;
op->ascii_translation_table = ascii;
op->ansi_translation_table = ansi;
op->ansi_first_char = 0x80;
op->ansi_last_char = 0x80;
op->cp437_translation_table = cp437;
op->cp437_first_char = 0x80;
op->cp437_last_char = 0x80;
op->cp850_translation_table = cp850;
op->cp850_first_char = 0x80;
op->cp850_last_char = 0x80;
op->mac_translation_table = mac;
op->mac_first_char = 0x80;
op->mac_last_char = 0x80;
op->chars.right_quote = "'";
op->chars.left_quote = "`";
op->chars.right_dbl_quote = "''";
op->chars.left_dbl_quote = "``";
return op;
}
./unrtf-0.19.2/latex.h 0000644 0001750 0001750 00000003011 07356513561 016006 0 ustar msamaral msamaral 0000000 0000000
/*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: latex
* Author name: Zach Smith
* Create date: 19 Sep 01
* Purpose: Definitions for the PostScript(TM) output personality
*----------------------------------------------------------------------
* Changes:
*--------------------------------------------------------------------*/
#ifndef _LATEX
extern OutputPersonality* latex_init(void);
#define _LATEX
#endif
./unrtf-0.19.2/main.c 0000644 0001750 0001750 00000013742 10014303366 015605 0 ustar msamaral msamaral 0000000 0000000 /*=============================================================================
GNU UnRTF, a command-line program to convert RTF documents to other formats.
Copyright (C) 2000,2001 Zachary Thayer Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
The author is reachable by electronic mail at tuorfa@yahoo.com.
=============================================================================*/
/*----------------------------------------------------------------------
* Module name: main.c
* Author name: Zach Smith
* Create date: 01 Sep 00
* Purpose: main() routine with file open/close.
*----------------------------------------------------------------------
* Changes:
* 14 Oct 00, tuorfa@yahoo.com: added -nopict option
* 15 Oct 00, tuorfa@yahoo.com: added verify_file_type()
* 08 Apr 01, tuorfa@yahoo.com: more GNU-like switches implemented
* 24 Jul 01, tuorfa@yahoo.com: removed verify_file_type()
* 03 Aug 01, tuorfa@yahoo.com: added --inline switch
* 08 Sep 01, tuorfa@yahoo.com: added use of PROGRAM_NAME
* 19 Sep 01, tuorfa@yahoo.com: addition of output personalities
* 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
* 23 Sep 01, tuorfa@yahoo.com: added wpml switch
* 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
*--------------------------------------------------------------------*/
#include
#include
#if linux /* daved - 0.19.0 */
#include
#endif
#include "defs.h"
#include "error.h"
#include "word.h"
#include "convert.h"
#include "parse.h"
#include "hash.h"
#include "malloc.h"
#include "output.h"
#include "html.h"
#include "text.h"
#include "vt.h"
#include "ps.h"
#include "latex.h"
#include "wpml.h"
int nopict_mode; /* TRUE => do not write \pict's to files */
int dump_mode; /* TRUE => output a dump of the word tree */
int debug_mode; /* TRUE => output comments within HTML */
int lineno; /* used for error reporting */
int simple_mode; /* TRUE => output HTML without SPAN/DIV tags */
int inline_mode; /* TRUE => output HTML without HTML/BODY/HEAD */
OutputPersonality *op;
enum {
OP_HTML, OP_TEXT, OP_LATEX, OP_PS, OP_VT, OP_WPML
};
/*========================================================================
* Name: main
* Purpose: Main control function.
* Args: Args.
* Returns: Exit code.
*=======================================================================*/
int
main (int argc, char **argv)
{
FILE *f;
Word * word;
char *path=NULL;
int i;
int output_format = OP_HTML;
nopict_mode = debug_mode = dump_mode = inline_mode = FALSE;
if (argc<2 || argc>7) usage();
for (i=1; i