Corrected memory.cpp checkpoint bug; added Tex2RTF

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 1999-01-02 00:45:39 +00:00
parent 07c5641a93
commit 9a29912f60
60 changed files with 23137 additions and 22 deletions

View File

@ -98,25 +98,6 @@ utils/wxhelp/src/*.ico
utils/wxhelp/src/*.def
utils/wxhelp/src/*.rc
utils/tex2rtf/src/wxwin/*.*
utils/tex2rtf/src/*.cpp
utils/tex2rtf/src/*.h
utils/tex2rtf/src/make*.*
utils/tex2rtf/src/*.xbm
utils/tex2rtf/src/*.xpm
utils/tex2rtf/src/*.sty
utils/tex2rtf/src/*.ini
utils/tex2rtf/src/*.inf
utils/tex2rtf/lib/dummy
utils/tex2rtf/src/*.bmp
utils/tex2rtf/src/*.ico
utils/tex2rtf/src/*.def
utils/tex2rtf/src/*.rc
utils/tex2rtf/tools/lacheck/*.*
utils/tex2rtf/tools/tcheck/*.awk
utils/tex2rtf/tools/tcheck/*.pl
utils/tex2rtf/tools/tcheck/*.bat
utils/wxtree/src/*.cpp
utils/wxtree/src/*.h
utils/wxtree/src/makefile*

View File

@ -35,6 +35,9 @@ zip32 -@ %dest\wx200cw.zip < %src\distrib\msw\cw.rsp
zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp
rem Tex2RTF
zip32 -@ %dest\tex2rtf.zip < %src\distrib\msw\tex2rtf.rsp
cd %dest
echo wxWindows archived.

View File

@ -20,7 +20,7 @@ window class.
for this style.}
\twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows only.}
\twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.}
\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a sunken border.}
\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border.}
\twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control.}
\twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint
events. Windows only.}

View File

@ -13,5 +13,5 @@ PROGRAM=bombs
OBJECTS = bombs.o bombs1.o game.o
include ../../src/makeprog.env
include ../../../src/makeprog.env

View File

@ -909,7 +909,7 @@ int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint)
wxMemStruct *from = NULL;
if (sinceCheckpoint && checkPoint)
from = checkPoint->m_next;
if (from == (wxMemStruct*) NULL)
else
from = wxDebugContext::GetHead () ;
for (wxMemStruct * st = from; st != 0; st = st->m_next)

BIN
utils/tex2rtf/docs/back.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

View File

@ -0,0 +1,145 @@
% fancyheadings.sty version 1.92
% Fancy headers and footers.
% Piet van Oostrum, Dept of Computer Science, University of Utrecht
% Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
% Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!sun4nl!ruuinf!piet)
% Sep 16, 1994
% version 1.4: Correction for use with \reversemargin
% Sep 29, 1994:
% version 1.5: Added the \iftopfloat, \ifbotfloat and \iffloatpage commands
% Oct 4, 1994:
% version 1.6: Reset single spacing in headers/footers for use with
% setspace.sty or doublespace.sty
% Oct 4, 1994:
% version 1.7: changed \let\@mkboth\markboth to
% \def\@mkboth{\protect\markboth} to make it more robust
% Dec 5, 1994:
% version 1.8: corrections for amsbook/amsart: define \@chapapp and (more
% importantly) use the \chapter/sectionmark definitions from ps@headings if
% they exist (which should be true for all standard classes).
% May 31, 1995:
% version 1.9: The proposed \renewcommand{\headrulewidth}{\iffloatpage...
% construction in the doc did not work properly with the fancyplain style.
% June 1, 1995:
% version 1.91: The definition of \@mkboth wasn't restored on subsequent
% \pagestyle{fancy}'s.
% June 1, 1995:
% version 1.92: The sequence \pagestyle{fancyplain} \pagestyle{plain}
% \pagestyle{fancy} would erroneously select the plain version.
\def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}}
\def\@xlhead[#1]#2{\gdef\@elhead{#1}\gdef\@olhead{#2}}
\def\@ylhead#1{\gdef\@elhead{#1}\gdef\@olhead{#1}}
\def\chead{\@ifnextchar[{\@xchead}{\@ychead}}
\def\@xchead[#1]#2{\gdef\@echead{#1}\gdef\@ochead{#2}}
\def\@ychead#1{\gdef\@echead{#1}\gdef\@ochead{#1}}
\def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}}
\def\@xrhead[#1]#2{\gdef\@erhead{#1}\gdef\@orhead{#2}}
\def\@yrhead#1{\gdef\@erhead{#1}\gdef\@orhead{#1}}
\def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
\def\@xlfoot[#1]#2{\gdef\@elfoot{#1}\gdef\@olfoot{#2}}
\def\@ylfoot#1{\gdef\@elfoot{#1}\gdef\@olfoot{#1}}
\def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
\def\@xcfoot[#1]#2{\gdef\@ecfoot{#1}\gdef\@ocfoot{#2}}
\def\@ycfoot#1{\gdef\@ecfoot{#1}\gdef\@ocfoot{#1}}
\def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
\def\@xrfoot[#1]#2{\gdef\@erfoot{#1}\gdef\@orfoot{#2}}
\def\@yrfoot#1{\gdef\@erfoot{#1}\gdef\@orfoot{#1}}
\newdimen\headrulewidth
\newdimen\footrulewidth
\newdimen\plainheadrulewidth
\newdimen\plainfootrulewidth
\newdimen\headwidth
\newif\if@fancyplain
\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}
% Command to reset various things in the headers:
% a.o. single spacing (taken from setspace.sty)
% and the catcode of ^^M (so that epsf files in the header work if a
% verbatim crosses a page boundary)
\def\fancy@reset{\restorecr
\def\baselinestretch{1}%
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else% NFSS (2.09) present
\@newbaseline%
\fi}
% Initialization of the head and foot text.
\headrulewidth 0.4pt
\footrulewidth\z@
\plainheadrulewidth\z@
\plainfootrulewidth\z@
\lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
% i.e. empty on ``plain'' pages, \rightmark on even, \leftmark on odd pages
\chead{}
\rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
% i.e. empty on ``plain'' pages, \leftmark on even, \rightmark on odd pages
\lfoot{}
\cfoot{\rm\thepage} % page number
\rfoot{}
% Put together a header or footer given the left, center and
% right text, fillers at left and right and a rule.
% The \lap commands put the text into an hbox of zero size,
% so overlapping text does not generate an errormessage.
\def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\hbox
{\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill
\parbox[b]{\headwidth}{\centering#3\strut}\hfill
\llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5}
\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\footrule
\hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill
\parbox[t]{\headwidth}{\centering#3\strut}\hfill
\llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5}
\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}
\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
\vskip-0.3\normalbaselineskip\vskip-\footrulewidth
\hrule\@width\headwidth\@height\footrulewidth\vskip0.3\normalbaselineskip}}
\def\ps@fancy{%
\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%for amsbook
\@ifundefined{chapter}{\def\sectionmark##1{\markboth
{\uppercase{\ifnum \c@secnumdepth>\z@
\thesection\hskip 1em\relax \fi ##1}}{}}%
\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
\thesubsection\hskip 1em\relax \fi ##1}}}%
{\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth>\m@ne
\@chapapp\ \thechapter. \ \fi ##1}}{}}
\def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@
\thesection. \ \fi ##1}}}}%
\csname ps@headings\endcsname % use \ps@headings defaults if they exist
\ps@@fancy
\gdef\ps@fancy{\@fancyplainfalse\ps@@fancy}%
\headwidth\textwidth}
\def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
\def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
\def\ps@@fancy{%
\def\@mkboth{\protect\markboth}%
\def\@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd}%
\def\@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd}%
\def\@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd}%
\def\@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd}%
}
\def\@lodd{\if@reversemargin\hss\else\relax\fi}
\def\@rodd{\if@reversemargin\relax\else\hss\fi}
\let\latex@makecol\@makecol
\def\@makecol{\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
\def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
\def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
\def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

View File

@ -0,0 +1,43 @@
Installation Instructions for Tex2RTF
-------------------------------------
Binaries are supplied for Windows 3.1 and for Sun workstations.
If these don't work for you, or you are using a different system, you
will need to compile Tex2RTF. There are several options for doing this.
(1) GUI version
If you want to have a graphical interface for Tex2RTF
(not essential for a conversion utility!) then you
will need to download wxWindows from skye.aiai.ed.ac.uk
(192.41.104.6) in the directory /pub/wxwin/beta, files
wx150?_*.tar.Z (or .gz) where ? is the latest beta letter,
currently i.
On UNIX, you will then need to decide whether you want to produce
an XView or Motif version (provided you have one of these
toolkits), and change the makefiles in accordingly,
in wx/src/x, wx/src/base and wx/utils/tex2rtf/src.
Use the makefile target 'xview' or 'motif' from each of the directories
wx/src/x and wx/utils/tex2rtf/src.
Under Windows, just type 'nmake -f makefile.dos' if you're
using a Microsoft-compatible compiler (you'll need to
change the makefiles or build project files for other compilers.)
(2) Non-GUI version
Under UNIX, simply use the target 'nogui'. The supplied files in the
src/wxwin directory supply the essential utilities from wxWindows, and
Tex2RTF will be built as a command-line program.
On a PC, add 'NOGUI=1' to the makefile command line. Note that the small
amount of memory available under DOS can cause catastrophic crashes for
large input files, due to the lack of memory checking, so be warned! The
Windows version is a more sensible choice.
-------------------------------------------------------------------------
Julian Smart, February 1993
J.Smart@ed.ac.uk

View File

@ -0,0 +1,11 @@
% makeidx.sty 20-Jan-87 modified for international usage
%
% Modified by J.Schrod (TeXsys).
% according to the suggestion of H.Partl (TU Wien) in german.sty
% to make caption names adaptable to other languages.
\@ifundefined{seeterm}{\def\seeterm{see}}{} % <-----------
\def\see#1#2{{\em \seeterm\/} #1}
\def\printindex{\@input{\jobname.ind}}

View File

@ -0,0 +1,154 @@
% SOBER.STY van Nico Poppelier
% Adapted by Julian Smart for his own
% nefarious purposes
% --------------------------------------
% Koppen van secties, subsecties, ...
% --------------------------------------
%
% --------------------------------------
% fontgrootte en regelafstand
% (met de notatie X/Y wordt bedoeld
% 'letter X op regelafstand Y')
% --------------------------------------
%
% 10pt 11pt 12pt
% \scriptsize 7/ 8 8/ 9.5 8/ 9.5
% \tiny 5/ 6 6/ 7 6/ 7
% \small 9/11 10/12 11/13.6
% \footnotesize 8/ 9.5 9/11 10/12
% \@normalsize 10/12 11/13.6 12/15
% \large 12/14 12/14 14/18
% \Large 14/18 14/18 17/22
% \LARGE 17/22 17/22 20/25
% \huge 20/25 20/25 25/30
% \Huge 25/30 25/30 25/30
%
% de syntax van \@startsection is:
% \@startsection
% {Name}{Level}{Indent}{Before_skip}{After_Skip}{Type_face}
% Indent : inspring van kop vanaf linkermarge
% Before_skip: wit boven kopje
% (< 0 geeft aan dat eerste alinea niet inspringt)
% After_skip : wit onder kopje indien >= 0
% horizontaal wit na kopje,
% met kopje op de regel indien < 0
%
% notatie voor <glue>: <dimen>(<stretch>)(<shrink>)
%
% in LaTeX's standaard-stijlen (onafhankelijk van \@ptsize):
%
% Indent Before_skip After_skip Type_face
% section 0 -3.5ex (-1ex)(-0.2ex) 2.3ex(0.2ex) \Large\bf
% subsection 0 -3.25ex(-1ex)(-0.2ex) 1.5ex(0.2ex) \large\bf
% subsubsection 0 -3.25ex(-1ex)(-0.2ex) 1.5ex(0.2ex) \normalsize\bf
% paragraph 0 3.25ex( 1ex)( 0.2ex) -1em()() \normalsize\bf
% subparagraph \parindent 3.25ex( 1ex)( 0.2ex) -1em()() \normalsize\bf
%
%
% in een soberder uitvoering (onafhankelijk van \@ptsize):
%
\def\section{\@startsection{section}{1}
%{\z@}{-2.5ex plus -0.5ex minus -0.1ex}{0.5ex plus 0.1ex}{\large\bf}}
{\z@}{-2.5ex plus -0.5ex minus -0.1ex}{0.5ex plus 0.1ex}{\large\bf}}
\def\subsection{\@startsection{subsection}{2}
{\z@}{-2.25ex plus -0.3ex minus -0.2ex}{0.05ex plus 0.05ex}{\normalsize\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}
{\z@}{-2.25ex plus -0.3ex minus -0.2ex}{0.05ex plus 0.05ex}{\normalsize\sc}}
\def\paragraph{\@startsection{paragraph}{4}
{\z@}{2ex plus 0.5ex minus 0.1ex}{-0.7em}{\normalsize\it}}
\def\subparagraph{\@startsection{subparagraph}{4}
{\parindent}{2ex plus 0.5ex minus 0.1ex}{-0.7em}{\normalsize\it}}
%
% --------------------------------------
% Hoofdstuk-koppen
% --------------------------------------
%
% LaTeX's book style (standaard documentstijl) definieert
% de hoofdstuk-koppen onafhankelijk van \@ptsize
%
\def\@makechapterhead#1{\vspace*{20pt}%
% Next line repaired by Piet van Oostrum - June 14, 1991.
%{\parindent 0pt\Large\bf \ifnum\c@secnumdepth>\m@ne\thechapter \fi
{\parindent 0pt\LARGE\bf \ifnum\c@secnumdepth>\m@ne\thechapter. \hskip 1em \fi%
{\raggedright\LARGE\bf #1}\\\rule[10pt]{\textwidth}{0.3mm}\par\nobreak \vskip25pt} }
\def\@makeschapterhead#1{
\vspace*{20pt} { \parindent 0pt \raggedright
\LARGE\bf#1\par\nobreak\vskip25pt } }
%
% --------------------------------------
% List-omgevingen (itemize en enumerate)
% --------------------------------------
%
% De volgende parameters zijn relevant in een list-omgeving:
%
% \labelsep : afstand tussen label en item
% \labelwidth : breedte van label
% \leftmargin : afstand tussen linkermarge en item
% \rightmargin : afstand tussen item en rechtermarge
% \listparindent: indentatie voor vervolg-alinea's in item
% \parsep : verticaal wit tussen vervolg-alinea's in item
% \itemsep : verticaal wit tussen opeenvolgende item's
% \topsep,
% \partopsep : wit boven item 1 = \topsep + \parskip
% (geen alinea-overgang boven lijst)
% wit boven item 1 = \topsep + \parskip + \partopsep
% (alinea-overgang boven lijst)
%
% zie verder LaTeX-boek 5.7.1 en C.5.3
% --------------------------------------
%
% De parameters voor niveau 1 worden gedefinieerd op top-niveau en
% \@listi definieert uitsluitend \leftmargin
%
% size = small (9pt, 10pt, 11pt)
\def\@listi{\topsep 0.4ex \parsep 0pt \itemsep \parsep}
% \topsep 4pt(2pt)(2pt) 6pt(2pt)(2pt) 9pt(3pt)(5pt)
% \parsep 2pt(1pt)(1pt) 3pt(2pt)(1pt) 4.5pt(2pt)(1pt)
%
% size = footnotesize (8pt, 9pt, 10pt)
\def\@listi{\topsep 0.4ex \parsep 0pt \itemsep \parsep}
% \topsep 3pt(1pt)(1pt) 4pt(2pt)(2pt) 6pt(2pt)(2pt)
% \parsep 2pt(1pt)(1pt) 2pt(1pt)(1pt) 3pt(2pt)(1pt)
%
% size = normalsize (and bigger)
% \parskip 0pt(1pt) 0pt(1pt) 0pt(1pt)
% \parindent 15pt 17pt 1.5em
% \topsep 8pt(2pt)(4pt) 9pt(3pt)(5pt) 10pt(4pt)(6pt)
% \partopsep 2pt(1pt)(1pt) 3pt(1pt)(2pt) 3pt(2pt)(2pt)
% \itemsep 4pt(2pt)(1pt) 4.5pt(2pt)(1pt) 5pt(2.5pt)(1pt
% \parsep 4pt(2pt)(1pt) 4.5pt(2pt)(1pt) 5pt(2.5pt)(1pt)
\topsep 0.4ex \partopsep 0pt \itemsep 0pt \parsep 0pt
%
% \leftmargini 2.5em \leftmarginii 2.2em \leftmarginiii 1.87em
% \leftmarginiv 1.7em \leftmarginv 1.0em \leftmarginvi 1.0em
%
% \leftmargin\leftmargini
% \labelwidth\leftmargini\advance\labelwidth-\labelsep
% \labelsep 0.5em
%
% \def\@listi{\leftmargin\leftmargini}
%
\def\@listii{\leftmargin\leftmarginii
\labelwidth\leftmarginii\advance\labelwidth-\labelsep
% \topsep 4pt(2pt)(1pt) 4.5pt(2pt)(1pt) 5pt(2.5pt)(1pt)
% \parsep 2pt(1pt)(1pt) 2pt(1pt)(1pt) 2.5pt(1pt)(1pt)
\topsep 0pt \parsep 0pt \itemsep \parsep}
%
\def\@listiii{\leftmargin\leftmarginiii
\labelwidth\leftmarginiii\advance\labelwidth-\labelsep
% \topsep 2pt(1pt)(1pt) 2pt(1pt)(1pt) 2.5pt(1pt)(1pt)
% \partopsep 1pt(0pt)(1pt) 1pt(0pt)(1pt) 1pt(0pt)(1pt)
\parsep \z@ \topsep 0pt \partopsep 0pt \itemsep \topsep}
%
% \def\@listiv{\leftmargin\leftmarginiv
% \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
%
% \def\@listv{ \leftmargin\leftmarginv
% \labelwidth\leftmarginv\advance\labelwidth-\labelsep}
%
% \def\@listvi{\leftmargin\leftmarginvi
% \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}

View File

@ -0,0 +1,33 @@
% mytitle.sty
% Julian Smart's Enhanced Titlepage
\def\maketitle{\begin{titlepage}
\let\footnotesize\small \let\footnoterule\relax \setcounter{page}{0}
%\null
%\vfil
\vspace*{2cm}\begin{flushleft}
{\huge \sf\@title\\\rule{\textwidth}{0.5mm}} \vskip 3em {\large \lineskip .75em
{\sf\@author}
\par}
\vskip 1.5em {\large\sf \@date \par} \end{flushleft} \par
\@thanks
\vfill
{\sf\small\begin{flushright}%
Artificial Intelligence Applications Institute\\
University of Edinburgh\\
80 South Bridge\\
EH1 1HN\\
Tel. 0131-650-2746
\end{flushright}}
\null
\end{titlepage}
\setcounter{footnote}{0} \let\thanks\relax
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\maketitle\relax}
\def\abstractname{Abstract} % <----------
\def\abstract{\titlepage
\null\vfil
\begin{center}
{\bf \abstractname} % <----------
% {\bf Abstract}
\end{center}}
\def\endabstract{\par\vfil\null\endtitlepage}

View File

@ -0,0 +1,140 @@
Implementation notes
--------------------
Files
-----
The library tex2any.lib contains the generic Latex parser.
It comprises tex2any.cc, tex2any.h and texutils.cc.
The executable Tex2RTF is made up of tex2any.lib,
tex2rtf.cc (main driver and user interface), and specific
drivers for generating output: rtfutils.cc, htmlutil.cc
and xlputils.cc.
Data structures
---------------
Class declarations are found in tex2any.h.
TexMacroDef holds a macro (Latex command) definition: name, identifier,
number of arguments, whether it should be ignored, etc. Integer
identifiers are used for each Latex command for efficiency when
generating output. A hash table MacroDefs stores all the TexMacroDefs,
indexed on command name.
Each unit of a Latex file is stored in a TexChunk. A TexChunk can be
a macro, argument or just a string: a TexChunk macro has child
chunks for the arguments, and each argument will have one or more
children for representing another command or a simple string.
Parsing
-------
Parsing is relatively add hoc. read_a_line reads in a line at a time,
doing some processing for file commands (e.g. input, verbatiminclude).
File handles are stored in a stack so file input commands may be nested.
ParseArg parses an argument (which might be the whole Latex input,
which is treated as an argument) or a single command, or a command
argument. The parsing gets a little hairy because an environment,
a normal command and bracketed commands (e.g. {\bf thing}) all get
parsed into the same format. An environment, for example,
is usually a one-argument command, as is {\bf thing}. It also
deals with user-defined macros.
Whilst parsing, the function MatchMacro gets called to
attempt to find a command following a backslash (or the
start of an environment). ParseMacroBody parses the
arguments of a command when one is found.
Generation
----------
The upshot of parsing is a hierarchy of TexChunks.
TraverseFromDocument calls the recursive TraverseFromChunk,
and is called by the 'client' converter application to
start the generation process. TraverseFromChunk
calls the two functions OnMacro and OnArgument,
twice for each chunk to allow for preprocessing
and postprocessing of each macro or argument.
The client defines OnMacro and OnArgument to test
the command identifier, and output the appropriate
code. To help do this, the function TexOutput
outputs to the current stream(s), and
SetCurrentOutput(s) allows the setting of one
or two output streams for the output to be sent to.
Usually two outputs at a time are sufficient for
hypertext applications where a title is likely
to appear in an index and as a section header.
There are support functions for getting the string
data for the current chunk (GetArgData) and the
current chunk (GetArgChunk). If you have a handle
on a chunk, you can output it several times by calling
TraverseChildrenFromChunk (not TraverseFromChunk because
that causes infinite recursion).
The client (here, Tex2RTF) also defines OnError and OnInform output
functions appropriate to the desired user interface.
References
----------
Adding, finding and resolving references are supported
with functions from texutils.cc. WriteTexReferences
and ReadTexReferences allow saving and reading references
between conversion processes, rather like real LaTeX.
Bibliography
------------
Again texutils.cc provides functions for reading in .bib files and
resolving references. The function OutputBibItem gives a generic way
outputting bibliography items, by 'faking' calls to OnMacro and
OnArgument, allowing the existing low-level client code to take care of
formatting.
Units
-----
Unit parsing code is in texutils.cc as ParseUnitArgument. It converts
units to points.
Common errors
-------------
1) Macro not found: \end{center} ...
Rewrite:
\begin{center}
{\large{\underline{A}}}
\end{center}
as:
\begin{center}
{\large \underline{A}}
\end{center}
2) Tables crash RTF. Set 'compatibility ' to TRUE in .ini file; also
check for \\ end of row characters on their own on a line, insert
correct number of ampersands for the number of columns. E.g.
hello & world\\
\\
becomes
hello & world\\
&\\
3) If list items indent erratically, try increasing
listItemIndent to give more space between label and following text.
A global replace of '\item [' to '\item[' may also be helpful to remove
unnecessary space before the item label.
4) Missing figure or section references: ensure all labels _directly_ follow captions
or sections (no intervening white space).

View File

@ -0,0 +1,520 @@
%
% %%%%%%% %%%%% %%%%%% %%%%% % %
% % % % % % % % % %
% % % % % % % % % %
% %%%%%%% %%%%% %%%%%% % % %
% % % % % % % % %
% % % % % % % % %
% % %%%%%% %%%%%% %%%%% % %
%
% By Jean Orloff
% Comments & suggestions by e-mail: ORLOFF@surya11.cern.ch
% No modification of this file allowed if not e-sent to me.
%
% A simple way to measure the size of encapsulated postscript figures
% from inside TeX, and to use it for automatically formatting texts
% with inserted figures. Works both under Plain TeX-based macros
% (Phyzzx, Harvmac, Psizzl, ...) and LaTeX environment.
% Provides exactly the same result on any PostScript printer provided
% the single instruction \psfor... is changed to fit the needs of the
% particular dvi->ps translator used.
% History:
% 1.31: adds \psforDVIALW(?)
% 1.30: adds \splitfile & \joinfiles for multi-file management
% 1.24: fix error handling & add \psonlyboxes
% 1.23: adds \putsp@ce for OzTeX fix
% 1.22: makes \drawingBox \global for use in Phyzzx
% 1.21: accepts %%BoundingBox: (atend)
% 1.20: tries to add \psfordvitps for the TeXPS package.
% 1.10: adds \psforoztex, error handling...
%2345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 2345678 7 23456789
%
\def\temp{1.31}
\let\tempp=\relax
\expandafter\ifx\csname psboxversion\endcsname\relax
\message{version: \temp}
\else
\ifdim\temp cm>\psboxversion cm
\message{version: \temp}
\else
\message{psbox(\psboxversion) is already loaded: I won't load
psbox(\temp)!}
\let\temp=\psboxversion
\let\tempp=\endinput
\fi
\fi
\tempp
\let\psboxversion=\temp
\catcode`\@=11
% Every macro likes a little privacy...
%
% Some common defs
%
\def\execute#1{#1}% NOT stupid: cs in #1 are then identified BEFORE execution
\def\psm@keother#1{\catcode`#112\relax}% borrowed from latex
\def\executeinspecs#1{%
\execute{\begingroup\let\do\psm@keother\dospecials\catcode`\^^M=9#1\endgroup}}
%
%Trying to tame the variety of \special commands for Postscript: the
% universal internal command \PSspeci@l##1##2 takes ##1 to be the
% filename and ##2 to be the integer scale factor*1000 (as for usual
% TeX \scale commands)
%
\def\psfortextures{% For TeXtures on the Macintosh
%-----------------
\def\PSspeci@l##1##2{%
\special{illustration ##1\space scaled ##2}%
}}
%
\def\psfordvitops{% For the DVItoPS converter on IBM mainframes
%----------------
\def\PSspeci@l##1##2{%
\special{dvitops: import ##1\space \the\drawingwd \the\drawinght}%
}}
%
\def\psfordvips{% For DVIPS converter on VAX, UNIX and PC's
%--------------
\def\PSspeci@l##1##2{%
% \special{/@scaleunit 1000 def}% never read dox without trying!
\d@my=0.1bp \d@mx=\drawingwd \divide\d@mx by\d@my%
\special{PSfile=##1\space llx=\psllx\space lly=\pslly\space%
urx=\psurx\space ury=\psury\space rwi=\number\d@mx}%
}}
%
\def\psforoztex{% For the OzTeX shareware on the Macintosh
%--------------
\def\PSspeci@l##1##2{%
\special{##1 \space
##2 1000 div dup scale
\putsp@ce{\number-\psllx} \putsp@ce{\number-\pslly} translate
}%
}}
\def\putsp@ce#1{#1 }
%
\def\psfordvitps{% From the UNIX TeXPS package, vers.>3.12
%---------------
% Convert a dimension into the number \psn@sp (in scaled points)
\def\psdimt@n@sp##1{\d@mx=##1\relax\edef\psn@sp{\number\d@mx}}
\def\PSspeci@l##1##2{%
% psfig.psr contains the def of "startTexFig": if you can locate it
% and include the correct pathname, it should work
\special{dvitps: Include0 "psfig.psr"}% contains def of "startTexFig"
\psdimt@n@sp{\drawingwd}
\special{dvitps: Literal "\psn@sp\space"}
\psdimt@n@sp{\drawinght}
\special{dvitps: Literal "\psn@sp\space"}
\psdimt@n@sp{\psllx bp}
\special{dvitps: Literal "\psn@sp\space"}
\psdimt@n@sp{\pslly bp}
\special{dvitps: Literal "\psn@sp\space"}
\psdimt@n@sp{\psurx bp}
\special{dvitps: Literal "\psn@sp\space"}
\psdimt@n@sp{\psury bp}
\special{dvitps: Literal "\psn@sp\space startTexFig\space"}
\special{dvitps: Include1 "##1"}
\special{dvitps: Literal "endTexFig\space"}
}}
\def\psforDVIALW{% Try for dvialw, a UNIX public domain
%---------------
\def\PSspeci@l##1##2{
\special{language "PS"
literal "##2 1000 div dup scale"
include "##1"}}}
\def\psonlyboxes{% Draft-like behaviour if none of the others works
%---------------
\def\PSspeci@l##1##2{%
\at(0cm;0cm){\boxit{\vbox to\drawinght
{\vss
\hbox to\drawingwd{\at(0cm;0cm){\hbox{(##1)}}\hss}
}}}
}%
}
%
\def\psloc@lerr#1{%
\let\savedPSspeci@l=\PSspeci@l%
\def\PSspeci@l##1##2{%
\at(0cm;0cm){\boxit{\vbox to\drawinght
{\vss
\hbox to\drawingwd{\at(0cm;0cm){\hbox{(##1) #1}}\hss}
}}}
\let\PSspeci@l=\savedPSspeci@l% restore normal output for other figs!
}%
}
%
%\def\psfor... add your own!
%
% \ReadPSize{PSfilename} reads the dimensions of a PostScript drawing
% and stores it in \drawinght(wd)
\newread\pst@mpin
\newdimen\drawinght\newdimen\drawingwd
\newdimen\psxoffset\newdimen\psyoffset
\newbox\drawingBox
\newif\ifNotB@undingBox
\newhelp\PShelp{Proceed: you'll have a 5cm square blank box instead of
your graphics (Jean Orloff).}
\def\@mpty{}
\def\s@tsize#1 #2 #3 #4\@ndsize{
\def\psllx{#1}\def\pslly{#2}%
\def\psurx{#3}\def\psury{#4}% needed by a crazyness of dvips!
\ifx\psurx\@mpty\NotB@undingBoxtrue% this is not a valid one!
\else
\drawinght=#4bp\advance\drawinght by-#2bp
\drawingwd=#3bp\advance\drawingwd by-#1bp
% !Units related by crazy factors as bp/pt=72.27/72 should be BANNED!
\fi
}
\def\sc@nline#1:#2\@ndline{\edef\p@rameter{#1}\edef\v@lue{#2}}
\def\g@bblefirstblank#1#2:{\ifx#1 \else#1\fi#2}
\def\psm@keother#1{\catcode`#112\relax}% borrowed from latex
\def\execute#1{#1}% Seems stupid, but cs are identified BEFORE execution
{\catcode`\%=12
\xdef\B@undingBox{%%BoundingBox}
} %% is not a true comment in PostScript, even if % is!
\def\ReadPSize#1{
\edef\PSfilename{#1}
\openin\pst@mpin=#1\relax
\ifeof\pst@mpin \errhelp=\PShelp
\errmessage{I haven't found your postscript file (\PSfilename)}
\psloc@lerr{was not found}
\s@tsize 0 0 142 142\@ndsize
\closein\pst@mpin
\else
\immediate\write\psbj@inaux{#1,}
\loop
\executeinspecs{\catcode`\ =10\global\read\pst@mpin to\n@xtline}
\ifeof\pst@mpin
\errhelp=\PShelp
\errmessage{(\PSfilename) is not an Encapsulated PostScript File:
I could not find any \B@undingBox: line.}
\edef\v@lue{0 0 142 142:}
\psloc@lerr{is not an EPSFile}
\NotB@undingBoxfalse
\else
\expandafter\sc@nline\n@xtline:\@ndline
\ifx\p@rameter\B@undingBox\NotB@undingBoxfalse
\edef\t@mp{%
\expandafter\g@bblefirstblank\v@lue\space\space\space}
\expandafter\s@tsize\t@mp\@ndsize
\else\NotB@undingBoxtrue
\fi
\fi
\ifNotB@undingBox\repeat
\closein\pst@mpin
\fi
\message{#1}
}
%
% \psboxto(xdim;ydim){psfilename}: you specify the dimensions and
% TeX uniformly scales to fit the largest one. If xdim=0pt, the
% scale is fully determined by ydim and vice versa.
% Notice: psboxes are a real vboxes; couldn't take hbox otherwise all
% indentation and all cr's would be interpreted as spaces (hugh!).
%
\newcount\xscale \newcount\yscale \newdimen\pscm\pscm=1cm
\newdimen\d@mx \newdimen\d@my
\let\ps@nnotation=\relax
\def\psboxto(#1;#2)#3{\vbox{
\ReadPSize{#3}
\divide\drawingwd by 1000
\divide\drawinght by 1000
\d@mx=#1
\ifdim\d@mx=0pt\xscale=1000
\else \xscale=\d@mx \divide \xscale by \drawingwd\fi
\d@my=#2
\ifdim\d@my=0pt\yscale=1000
\else \yscale=\d@my \divide \yscale by \drawinght\fi
\ifnum\yscale=1000
\else\ifnum\xscale=1000\xscale=\yscale
\else\ifnum\yscale<\xscale\xscale=\yscale\fi
\fi
\fi
\divide \psxoffset by 1000\multiply\psxoffset by \xscale
\divide \psyoffset by 1000\multiply\psyoffset by \xscale
\global\divide\pscm by 1000
\global\multiply\pscm by\xscale
\multiply\drawingwd by\xscale \multiply\drawinght by\xscale
\ifdim\d@mx=0pt\d@mx=\drawingwd\fi
\ifdim\d@my=0pt\d@my=\drawinght\fi
\message{scaled \the\xscale}
\hbox to\d@mx{\hss\vbox to\d@my{\vss
\global\setbox\drawingBox=\hbox to 0pt{\kern\psxoffset\vbox to 0pt{
\kern-\psyoffset
\PSspeci@l{\PSfilename}{\the\xscale}
\vss}\hss\ps@nnotation}
\global\ht\drawingBox=\the\drawinght
\global\wd\drawingBox=\the\drawingwd
\baselineskip=0pt
\copy\drawingBox
\vss}\hss}
\global\psxoffset=0pt
\global\psyoffset=0pt% These are local to one figure
\global\pscm=1cm
\global\drawingwd=\drawingwd
\global\drawinght=\drawinght
}}
%
% \psboxscaled{scalefactor*1000}{PSfilename} allows to bypass the
% rounding errors of TeX integer divisions for situations where the
% TeX box should fit the original BoundingBox with a precision better
% than 1/1000.
%
\def\psboxscaled#1#2{\vbox{
\ReadPSize{#2}
\xscale=#1
\message{scaled \the\xscale}
\divide\drawingwd by 1000\multiply\drawingwd by\xscale
\divide\drawinght by 1000\multiply\drawinght by\xscale
\divide \psxoffset by 1000\multiply\psxoffset by \xscale
\divide \psyoffset by 1000\multiply\psyoffset by \xscale
\global\divide\pscm by 1000
\global\multiply\pscm by\xscale
\global\setbox\drawingBox=\hbox to 0pt{\kern\psxoffset\vbox to 0pt{
\kern-\psyoffset
\PSspeci@l{\PSfilename}{\the\xscale}
\vss}\hss\ps@nnotation}
\global\ht\drawingBox=\the\drawinght
\global\wd\drawingBox=\the\drawingwd
\baselineskip=0pt
\copy\drawingBox
\global\psxoffset=0pt
\global\psyoffset=0pt% These are local to one figure
\global\pscm=1cm
\global\drawingwd=\drawingwd
\global\drawinght=\drawinght
}}
%
% \psbox{PSfilename} makes a TeX box having the minimal size to
% enclose the picture
\def\psbox#1{\psboxscaled{1000}{#1}}
%
%
% \joinfiles file1, file2, ...n \into joinedfilename .
% makes one file out of many
% \splitfile joinedfilename
% the opposite
%
%\def\execute#1{#1}% NOT stupid: cs in #1 are then identified BEFORE execution
%\def\psm@keother#1{\catcode`#112\relax}% borrowed from latex
%\def\executeinspecs#1{%
%\execute{\begingroup\let\do\psm@keother\dospecials\catcode`\^^M=9#1\endgroup}}
%\newread\pst@mpin
\newif\ifn@teof\n@teoftrue
\newif\ifc@ntrolline
\newif\ifmatch
\newread\j@insplitin
\newwrite\j@insplitout
\newwrite\psbj@inaux
\immediate\openout\psbj@inaux=psbjoin.aux
\immediate\write\psbj@inaux{\string\joinfiles}
\immediate\write\psbj@inaux{\jobname,}
%
% We redefine input to keep track of the various files inputted
%
\immediate\let\oldinput=\input
\def\input#1 {
\immediate\write\psbj@inaux{#1,}
\oldinput #1 }
\def\empty{}
\def\setmatchif#1\contains#2{
\def\match##1#2##2\endmatch{
\def\tmp{##2}
\ifx\empty\tmp
\matchfalse
\else
\matchtrue
\fi}
\match#1#2\endmatch}
\def\warnopenout#1#2{
\setmatchif{TrashMe,psbjoin.aux,psbjoin.all}\contains{#2}
\ifmatch
\else
\immediate\openin\pst@mpin=#2
\ifeof\pst@mpin
\else
\errhelp{If the content of this file is so precious to you, abort (ie
press x or e) and rename it before retrying.}
\errmessage{I'm just about to replace your file named #2}
\fi
\immediate\closein\pst@mpin
\fi
\message{#2}
\immediate\openout#1=#2}
% No comments allowed below: % will have an unusual catcode
{
\catcode`\%=12
\gdef\splitfile#1 {
\immediate\openin\j@insplitin=#1
\message{Splitting file #1 into:}
\warnopenout\j@insplitout{TrashMe}
\loop
\ifeof
\j@insplitin\immediate\closein\j@insplitin\n@teoffalse
\else
\n@teoftrue
\executeinspecs{\global\read\j@insplitin to\spl@tinline\expandafter
\ch@ckbeginnewfile\spl@tinline%Beginning-Of-File-Named:%\endcheck}
\ifc@ntrolline
\else
\toks0=\expandafter{\spl@tinline}
\immediate\write\j@insplitout{\the\toks0}
\fi
\fi
\ifn@teof\repeat
\immediate\closeout\j@insplitout}
\gdef\ch@ckbeginnewfile#1%Beginning-Of-File-Named:#2%#3\endcheck{
\def\t@mp{#1}
\ifx\empty\t@mp
\def\t@mp{#3}
\ifx\empty\t@mp
\global\c@ntrollinefalse
\else
\immediate\closeout\j@insplitout
\warnopenout\j@insplitout{#2}
\global\c@ntrollinetrue
\fi
\else
\global\c@ntrollinefalse
\fi}
\gdef\joinfiles#1\into#2 {
\message{Joining following files into}
\warnopenout\j@insplitout{#2}
\message{:}
{
\edef\w@##1{\immediate\write\j@insplitout{##1}}
\w@{% This text was produced with psbox's \string\joinfiles.}
\w@{% To decompose and tex it:}
\w@{%-save this with a filename CONTAINING ONLY LETTERS, and no extensions}
\w@{% (say, JOINTFIL), in some uncrowded directory;}
\w@{%-make sure you can \string\input\space psbox.tex (version>=1.3);}
\w@{%-tex JOINTFIL using Plain, or LaTeX, or whatever is needed by}
\w@{% the first part in the joining (after splitting JOINTFIL into}
\w@{% it's constituents, TeX will try to process it as it stands).}
\w@{\string\input\space psbox.tex}
\w@{\string\splitfile{\string\jobname}}
}
\tre@tfilelist#1, \endtre@t
\immediate\closeout\j@insplitout}
\gdef\tre@tfilelist#1, #2\endtre@t{
\def\t@mp{#1}
\ifx\empty\t@mp
\else
\llj@in{#1}
\tre@tfilelist#2, \endtre@t
\fi}
\gdef\llj@in#1{
\immediate\openin\j@insplitin=#1
\ifeof\j@insplitin
\errmessage{I couldn't find file #1.}
\else
\message{#1}
\toks0={%Beginning-Of-File-Named:#1}
\immediate\write\j@insplitout{\the\toks0}
\executeinspecs{\global\read\j@insplitin to\oldj@ininline}
\loop
\ifeof\j@insplitin\immediate\closein\j@insplitin\n@teoffalse
\else\n@teoftrue
\executeinspecs{\global\read\j@insplitin to\j@ininline}
\toks0=\expandafter{\oldj@ininline}
\let\oldj@ininline=\j@ininline
\immediate\write\j@insplitout{\the\toks0}
\fi
\ifn@teof
\repeat
\immediate\closein\j@insplitin
\fi}
}
% To be put at the end of a file, for making an tar-like file containing
% everything it used.
\def\autojoin{
\immediate\write\psbj@inaux{\string\into\space psbjoin.all}
\immediate\closeout\psbj@inaux
\input psbjoin.aux
}
%
% Annotations & Captions etc...
%
%
% \centinsert{anybox} is just a centered \midinsert, but is included as
% people barely use the original inserts from TeX.
%
\def\centinsert#1{\midinsert\line{\hss#1\hss}\endinsert}
\def\psannotate#1#2{\def\ps@nnotation{#2\global\let\ps@nnotation=\relax}#1}
\def\pscaption#1#2{\vbox{
\setbox\drawingBox=#1
\copy\drawingBox
\vskip\baselineskip
\vbox{\hsize=\wd\drawingBox\setbox0=\hbox{#2}
\ifdim\wd0>\hsize
\noindent\unhbox0\tolerance=5000
\else\centerline{\box0}
\fi
}}}
% for compatibility with older versions
\def\psfig#1#2#3{\pscaption{\psannotate{#1}{#2}}{#3}}
\def\psfigurebox#1#2#3{\pscaption{\psannotate{\psbox{#1}}{#2}}{#3}}
%
% \at(#1;#2)#3 puts #3 at #1-higher and #2-right of the current
% position without moving it (to be used in annotations).
\def\at(#1;#2)#3{\setbox0=\hbox{#3}\ht0=0pt\dp0=0pt
\rlap{\kern#1\vbox to0pt{\kern-#2\box0\vss}}}
%
% \gridfill(ht;wd) makes a 1cm*1cm grid of ht by wd whose lower-left
% corner is the current point
\newdimen\gridht \newdimen\gridwd
\def\gridfill(#1;#2){
\setbox0=\hbox to 1\pscm
{\vrule height1\pscm width.4pt\leaders\hrule\hfill}
\gridht=#1
\divide\gridht by \ht0
\multiply\gridht by \ht0
\gridwd=#2
\divide\gridwd by \wd0
\multiply\gridwd by \wd0
\advance \gridwd by \wd0
\vbox to \gridht{\leaders\hbox to\gridwd{\leaders\box0\hfill}\vfill}}
%
% Useful to measure where to put annotations
\def\fillinggrid{\at(0cm;0cm){\vbox{
\gridfill(\drawinght;\drawingwd)}}}
%
% \textleftof\anybox: Sample text\endtext
% inserts "Sample text" on the left of \anybox ie \vbox, \psbox.
% \textrightof is the symmetric (not documented, too uggly)
% Welcome any suggestion about clean wraparound macros from
% TeXhackers reading this
%
\def\textleftof#1:{
\setbox1=#1
\setbox0=\vbox\bgroup
\advance\hsize by -\wd1 \advance\hsize by -2em}
\def\textrightof#1:{
\setbox0=#1
\setbox1=\vbox\bgroup
\advance\hsize by -\wd0 \advance\hsize by -2em}
\def\endtext{
\egroup
\hbox to \hsize{\valign{\vfil##\vfil\cr%
\box0\cr%
\noalign{\hss}\box1\cr}}}
%
% \frameit{\thick}{\skip}{\anybox}
% draws with thickness \thick a box around \anybox, leaving \skip of
% blank around it. eg \frameit{0.5pt}{1pt}{\hbox{hello}}
% \boxit{\anybox} is a shortcut.
\def\frameit#1#2#3{\hbox{\vrule width#1\vbox{
\hrule height#1\vskip#2\hbox{\hskip#2\vbox{#3}\hskip#2}%
\vskip#2\hrule height#1}\vrule width#1}}
\def\boxit#1{\frameit{0.4pt}{0pt}{#1}}
%
%
\catcode`\@=12 % cs containing @ are unreachable
%
% CUSTOMIZE YOUR DEFAULT DRIVER:
% Uncomment the line corresponding to your TeX system:
%\psfortextures% For TeXtures on the Macintosh
%\psforoztex % For OzTeX shareware on the Macintosh
%\psfordvitops % For the DVItoPS converter for TeX on IBM mainframes
\psfordvips % For DVIPS converter on VAX and UNIX
%\psfordvitps % For dvitps from TeXPS package under UNIX
%\psforDVIALW % For DVIALW, UNIX public domain
%\psonlyboxes % Blank Boxes (when all else fails).

View File

@ -0,0 +1,81 @@
+++++ Announcing Tex2RTF +++++
+++++ A Free LaTeX to RTF, Windows Help RTF, HTML & wxHelp converter +++++
Purpose
=======
* Allows you to maintain manuals in printed and hypertext formats.
* Allows conversion of existing LaTeX documents to word processor
formats (usually some 'tweaking' is required to conform to
Tex2RTF restrictions).
Input
=====
A LaTeX subset with some additional hypertext macros; no maths,
minimal table support.
Caveat: Please do not expect to convert arbitrary LaTex files without
editing: this is not the primary intention of Tex2RTF. Success converting
existing LaTeX depends on your expectations and the style in which
the LaTeX was written. Tex2RTF does not accept pure TeX (non-LaTeX)
documents.
Output
======
* ordinary RTF
* Windows Help hypertext RTF
* HTML (the World Wide Web hypertext format)
* wxHelp (the wxWindows GUI library help file format)
Installation
============
Under Windows, please run the supplied install.exe program. The Tex2RTF
manual itself serves as an example input file, in the docs subdirectory
with various .sty, .ini, and .gif files that you may need for your
own documents. See the online manual for further details.
Platforms supported
===================
* SPARC Open Look
* SPARC Motif
* Windows 3.1
Where to get it
===============
The latest version of Tex2RTF can be accessed by anonymous ftp from
ftp.aiai.ed.ac.uk in the directory /pub/packages/tex2rtf.
The WWW pages are at http://www.aiai.ed.ac.uk/~jacs/tex2rtf.html.
Tex2RTF was developed using the free Open Look/Motif/Windows 3.1 C++
class library wxWindows, also available from the above FTP site in the
/pub/packages/wxwin directory.
The wxWindows WWW pages are at http://www.aiai.ed.ac.uk/~jacs/wxwin.html.
------------------------------------------------------------------
Julian Smart, November 1995
Artificial Intelligence Applications Institute
University of Edinburgh
80 South Bridge
Edinburgh
Scotland
EH1 1HN
EMAIL: J.Smart@ed.ac.uk
TEL: 0131 650 2746

View File

@ -0,0 +1,35 @@
@techreport{robins87,
author = {Robins, Gabriel},
title = {The {ISI} grapher: a portable tool for displaying graphs pictorially (ISI/RS-87-196)},
institution = {University of South California},
year = {1987},
month = {September}
}
@book{helpbook,
author = {Boggan, Scott and Fakas, David and Welinske, Joe}
, title = {Developing on-line help for {W}indows}
, publisher = {Sams Publishing}
, address = {11711 North College, Carmel, Indiana 46032, USA}
, year = {1993}
}
@book{kopka,
author = {Kopka, Helmut and Daly, Patrick W.}
, title = {A Guide to LaTeX}
, publisher = {Addison-Wesley}
, year = {1993}
}
@book{pfeiffer,
author = {Pfeiffer, Katherine Shelly}
, title = {Word for Windows Design Companion}
, publisher = {Ventana Press}
, year = {1994}
}
@manual{smart93a,
author = {Smart, Julian}
, title = {wxWindows 1.50 User Manual}
, publisher = {Artificial Intelligence Applications Institute}
, organization = {University of Edinburgh}
, address = {80 South Bridge, Edinburgh, EH1 1HN}
, year = {1993}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

View File

@ -0,0 +1,17 @@
[OPTIONS]
BMROOT=.
TITLE=Tex2RTF Manual
CONTENTS=Contents
COMPRESS=HIGH
[FILES]
tex2rtf.rtf
[CONFIG]
CreateButton("Up", "&Up", "JumpId(`tex2rtf.hlp', `Contents')")
BrowseButtons()
[MAP]
[BITMAPS]

View File

@ -0,0 +1,21 @@
; Tex2RTF initialisation file for 16-bit WinHelp
runTwice = yes
titleFontSize = 12
authorFontSize = 10
chapterFontSize = 12
sectionFontSize = 12
subsectionFontSize = 12
headerRule = yes
footerRule = yes
useHeadingStyles = yes
contentsDepth = 2
listItemIndent=40
winHelpContents = yes
winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95
generateHPJ = yes
htmlBrowseButtons = bitmap
winHelpTitle = "Tex2RTF Manual"
truncateFilenames = yes
combineSubSections = yes
htmlIndex = yes
htmlFrameContents = no

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,282 @@
% LaTeX style file
% Name: texhelp.sty
% Author: Julian Smart
%
% Purpose
% -------
% Style file to enable the simultaneous preparation of printed LaTeX and on-line
% hypertext manuals.
% Use in conjunction with Tex2RTF (see Tex2RTF documentation).
%
% Note that if a non-ASCII character starts a newline and there should be a space
% between the last word on the previous line and the first word on this line,
% you need to use \rtfsp to generate a space in Windows Help. \rtfsp is ignored
% in all other formats.
%
% Julian Smart
% Artificial Intelligence Applications Institute
%
%
% ============== C++/CLIPS Documentation Facilities ==============
%
% Each class definition should be typeset with e.g.
%
% \section{\class{Name}: Parent}
%
% followed by a description of the class.
% Each member should follow:
%
% \membersection{wxName::Member}
%
% with a description of what this member does.
% Then, one (or more if overloaded) member (function) in detail:
%
% \func{return type}{name}{args}
% or
% \member{type}{name}
%
% where args is a list of \param{type}{name}, ...
% Function, e.g.
% e.g. to typeset
%
% void DoIt(char *string);
%
% write:
%
% \func{void}{DoIt}{\param{char *}{string}}
%
\newcommand{\func}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} {\bf #2}\index{#2}}(#3)}
% For function/type definition where the name is a pointer,
% e.g. to typeset
%
% typedef void (*wxFunction)(wxObject&)
%
% write:
%
% \pfunc{typedef void}{wxFunction}{param{wxObject&}}
\newcommand{\pfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} ({\bf *#2})\index{#2}}(#3)}
% Use an ordinary \section command for class name definitions.
% This is used for a member, such as wxBitmap: GetDepth
\newcommand{\membersection}[1]{\subsection*{#1}\index{#1}}
% CLIPS function
\newcommand{\clipsfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\bf #1} ({\bf #2}\index{#2}}#3)}
\newcommand{\clipssection}[1]{\chapter{#1}}
% This is used for a CLIPS function name
\newcommand{\functionsection}[1]{\subsection*{#1}}
% Member: a type and a name
\newcommand{\member}[2]{{\bf #1 \it #2}}
% C++ Parameter: a type and a name (no intervening space)
\newcommand{\param}[2]{{\it #1}{\bf #2}}
% CLIPS Parameter: a type and a name (one intervening space)
\newcommand{\cparam}[2]{{\bf #1} {\it #2}}
% Class: puts in index
\newcommand{\class}[1]{#1\index{#1}}
% Void type
\newcommand{\void}{{\it void}}
% Typeset destructor
\newcommand{\destruct}[1]{{$\sim$}#1}
% Typeset insert/extract operators
\newcommand{\cinsert}{$<<$}
\newcommand{\cextract}{$>>$}
% =================== Hypertext facilities ===================
%
% To insert hyperlinks (or references, in Latex), \label the sections
% or membersections \label{ref-label} immediately after the section, on the same line,
% and use \helpref{text-to-show}{ref-label} to make a reference.
%
% Type text with section reference
\newcommand{\helpref}[2]{{\it #1} (section \ref{#2}) }
% Type text with URL in verbatim mode
\newcommand{\urlref}[2]{#1 (\verb$#2$)}
% Don't typeset section number in LaTeX
\newcommand{\helprefn}[2]{{\it #1}}
% Like helpref, but popup text in WinHelp instead of hyperlinked
\newcommand{\popref}[2]{{\it #1}}
% Like footnote, but popup text.
\newcommand{\footnotepopup}[2]{{\it #1}\footnote{#2}}
% =================== On-line help specific macros ===================
%
% Global document font size/family, help only.
\newcommand{\helpfontsize}[1]{}
\newcommand{\helpfontfamily}[1]{}
% Ignore in all on-line help
\newcommand{\helpignore}[1]{#1}
% Only print in all on-line help
\newcommand{\helponly}[1]{}
% Ignore in LaTeX
\newcommand{\latexignore}[1]{}
% Only print in LaTeX
\newcommand{\latexonly}[1]{#1}
% Ignore in linear RTF
\newcommand{\rtfignore}[1]{#1}
% Only print in linear RTF
\newcommand{\rtfonly}[1]{}
% Ignore in WinHelp RTF
\newcommand{\winhelpignore}[1]{#1}
% Only print in WinHelp RTF
\newcommand{\winhelponly}[1]{}
% Ignore in wxHelp
\newcommand{\xlpignore}[1]{#1}
% Only print in wxHelp
\newcommand{\xlponly}[1]{}
% Ignore in HTML
\newcommand{\htmlignore}[1]{#1}
% Only print in HTML
\newcommand{\htmlonly}[1]{}
% Input a file only for help system (binder thickness is not a limitation
% in help systems!)
\newcommand{\helpinput}[1]{}
\newcommand{\rtfsp}{ } % Force a space in RTF, ignore in Latex
% =================== Miscellaneous macros ===================
%
% Headings consistent with generated ones
\newcommand{\myheading}[1]{\vspace*{25pt}
\begin{flushleft}
{\LARGE \bf #1}
\end{flushleft}
\vskip 20pt
}
% Heading with entry in contents page.
\newcommand{\chapterheading}[1]{\myheading{#1}
\addcontentsline{toc}{chapter}{#1}}
\newcommand{\sectionheading}[1]{\myheading{#1}
\addcontentsline{toc}{section}{#1}}
% Glossary environment
\newenvironment{helpglossary}{\newpage\chapterheading{Glossary}\begin{description}}{\end{description}}
% Glossary entry
\newcommand{\gloss}[1]{\item[#1]\index{#1}}
% Image: EPS in Latex, BMP or MF (whatever's available) in RTF. Requires psbox.
\newcommand{\image}[2]{\psboxto(#1){#2}}
% Image, left aligned (HTML)
\newcommand{\imager}[2]{\psboxto(#1){#2}}
% Image, right aligned (HTML)
\newcommand{\imagel}[2]{\psboxto(#1){#2}}
% Imagemap: principally for HTML only. In Latex,
% acts like \image.
\newcommand{\imagemap}[3]{\psboxto(#1){#2}}
% Headers and footers
% \setheader{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setheader}[6]{
\lhead[\fancyplain{}{#1}]{\fancyplain{}{#4}}
\chead[\fancyplain{}{#2}]{\fancyplain{}{#5}}
\rhead[\fancyplain{}{#3}]{\fancyplain{}{#6}}
}
% \setfooter{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setfooter}[6]{
\lfoot[\fancyplain{#1}{#1}]{\fancyplain{#4}{#4}}
\cfoot[\fancyplain{#2}{#2}]{\fancyplain{#5}{#5}}
\rfoot[\fancyplain{#3}{#3}]{\fancyplain{#6}{#6}}
}
% Needed for telling RTF where margin paragraph should go
% in mirrored margins mode.
\newcommand{\marginpareven}[1]{\hspace*{0pt}\marginpar{#1}}
\newcommand{\marginparodd}[1]{\hspace*{0pt}\marginpar{#1}}
% Environment for two-column table popular in WinHelp and manuals.
\newcommand{\twocolwidtha}[1]{\def\twocolwidthaval{#1}}
\newcommand{\twocolwidthb}[1]{\def\twocolwidthbval{#1}}
\newcommand{\twocolspacing}[1]{\def\twocolspacingval{#1}}
\twocolwidtha{3cm}
\twocolwidthb{8.5cm}
\twocolspacing{2}
\newcommand{\twocolitem}[2]{#1 & #2\\}
\newcommand{\twocolitemruled}[2]{#1 & #2\\\hline}
\newenvironment{twocollist}{\renewcommand{\arraystretch}{\twocolspacingval}\begin{tabular}{lp{\twocolwidthbval}}}%
{\end{tabular}\renewcommand{\arraystretch}{1}}
% Specifying table rows for RTF compatibility
\newcommand{\row}[1]{#1\\}
% Use for the last ruled row for correct RTF generation.
\newcommand{\ruledrow}[1]{#1\\\hline}
% Indentation environment. Arg1 is left margin size
\newenvironment{indented}[1]{\begin{list}{}{\leftmargin=#1}\item[]}%
{\end{list}}
% Framed box of text, normal formatting.
\newcommand{\normalbox}[1]{\fbox{\vbox{#1}}}
% Double-framed box of text.
\newcommand{\normalboxd}[1]{\fbox{\fbox{\vbox{#1}}}}
% WITHDRAWN -- can't do in RTF, easily.
% Framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredbox}[2]{\begin{center}\fbox{\parbox{#1}{\raggedright#2}}\end{center}}
% Double-framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredboxd}[2]{\begin{center}\fbox{\fbox{\parbox{#1}{\raggedright#2}}}\end{center}}
% toocomplex environment: simply prints the argument in LaTeX,
% comes out verbatim in all generated formats.
\newenvironment{toocomplex}{}{}
% Colour: dummy commands since LaTeX doesn't support colour.
% \definecolour{name}{red}{blue}{green}
% \fcol{name}{text} ; Foreground
% \bcol{name}{text} ; Background
\newcommand{\definecolour}[4]{}
\newcommand{\definecolor}[4]{}
\newcommand{\fcol}[2]{#2}
\newcommand{\bcol}[2]{#2}
\newcommand{\sethotspotcolour}[1]{}
\newcommand{\sethotspotunderline}[1]{}
\newcommand{\settransparency}[1]{}
\newcommand{\backslashraw}[0]{}
\newcommand{\lbraceraw}[0]{}
\newcommand{\rbraceraw}[0]{}
\newcommand{\registered}[0]{(r)}
\newcommand{\background}[1]{}
\newcommand{\textcolour}[1]{}
\newcommand{\overview}[2]{See \helpref{#1}{#2}.}

BIN
utils/tex2rtf/docs/up.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View File

@ -0,0 +1,212 @@
%%
%% This is file `verbatim.sty' generated
%% on <1991/9/3> with the docstrip utility (v1.1l test).
%%
%% The original source file was `verbatim.doc'.
%%
%%
%% Copyright (C) 1989,1990,1991 by Rainer Schoepf. All rights reserved.
%%
%% IMPORTANT NOTICE:
%%
%% You are not allowed to change this file. You may however copy this file
%% to a different name and then change this copy.
%%
%% You are allowed to distribute this file under the condition that it is
%% distributed together with all files mentioned in readme.mz4. If you
%% receive only some of these files from someone, complain!
%%
%% You are NOT ALLOWED to distribute this file alone. You are NOT ALLOWED
%% to take money for the distribution or use of this file (or a changed
%% version) except for some nominal charge for copying etc.
%%
%% Error Reports in case of UNCHANGED versions to
%%
%% Rainer Schoepf
%% Konrad-Zuse-Zentrum fuer Informationstechnik Berlin
%% Heilbronner Str. 10
%% W-1000 Berlin 31
%% Federal Republic of Germany
%% Internet: <SCHOEPF@SC.ZIB-Berlin.DE>
%%
\def\fileversion{v1.4f}
\def\filedate{91/08/05}
\def\docdate{91/08/05}
%% \CheckSum{439}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
%% Style-option `verbatim' to use with LaTeX v2.09
%% Copyright (C) 1989, 1990, 1991 by Rainer Sch\"opf, all rights reserved.
\@ifundefined{verbatim@@@}{}{\endinput}
\typeout{Style-Option: `verbatim'
\fileversion \space <\filedate> (RmS)}
\typeout{English Documentation
\@spaces \@spaces \space <\docdate> (RmS)}
\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
\newtoks\every@verbatim
\every@verbatim={}
\def\@makeother#1{\catcode`#112\relax}
\begingroup
\catcode`\ =\active%
\gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}%
\endgroup
\def\@xobeysp{\leavevmode\penalty\@M\ }
\newtoks\verbatim@line
\def\verbatim@startline{\verbatim@line{}}
\def\verbatim@addtoline#1{%
\verbatim@line\expandafter{\the\verbatim@line#1}}
\def\verbatim@processline{\the\verbatim@line\par}
\def\verbatim@finish{\ifcat$\the\verbatim@line$\else
\verbatim@processline\fi}
\begingroup
\catcode`\`=\active
\gdef\verbatim@font{\tt \catcode96\active
\def`{\leavevmode\kern\z@\char96 }}
\endgroup
\def\@verbatim{\the\every@verbatim
\trivlist \item[]%
\leftskip\@totalleftmargin\rightskip\z@
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@@par
\def\par{\leavevmode\null\@@par\penalty\interlinepenalty}%
\obeylines
\verbatim@font
\let\do\@makeother \dospecials}
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces\verbatim@start}
\@namedef{verbatim*}{\@verbatim\verbatim@start}
\let\endverbatim=\endtrivlist
\expandafter\let\csname endverbatim*\endcsname =\endtrivlist
\def\comment{\@bsphack
\let\do\@makeother\dospecials\catcode`\^^M\active
\let\verbatim@startline\relax
\let\verbatim@addtoline\@gobble
\let\verbatim@processline\relax
\let\verbatim@finish\relax
\verbatim@}
\let\endcomment=\@esphack
\@ifundefined{vrb@catcodes}%
{\def\vrb@catcodes{%
\catcode`\!12\catcode`\[12\catcode`\]12}}{}
\begingroup
\vrb@catcodes
\lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
\catcode`\~=\active \lccode`\~=`\^^M
\lccode`\C=`\C
\lowercase{%
\gdef\verbatim@start#1{%
\verbatim@startline
\if\noexpand#1\noexpand~%
\let\next\verbatim@
\else \def\next{\verbatim@#1}\fi
\next}%
\gdef\verbatim@#1~{\verbatim@@#1!end\@nil}%
\gdef\verbatim@@#1!end{%
\verbatim@addtoline{#1}%
\futurelet\next\verbatim@@@}%
\gdef\verbatim@@@#1\@nil{%
\ifx\next\@nil
\verbatim@processline
\verbatim@startline
\let\next\verbatim@
\else
\def\@tempa##1!end\@nil{\toks@{##1}}%
\@tempa#1\@nil
\@temptokena{!end}%
\edef\next{\noexpand\verbatim@test\the\toks@\noexpand~}%
\fi \next}%
\gdef\verbatim@test#1{%
\let\next\verbatim@test
\if\noexpand#1\noexpand~%
\expandafter\verbatim@addtoline
\expandafter{\the\@temptokena}%
\verbatim@processline
\verbatim@startline
\let\next\verbatim@
\else \if\noexpand#1
\@temptokena\expandafter{\the\@temptokena#1}%
\else \if\noexpand#1\noexpand[%
\let\@tempc\@empty
\let\next\verbatim@testend
\else
\expandafter\verbatim@addtoline
\expandafter{\the\@temptokena}%
\def\next{\verbatim@#1}%
\fi\fi\fi
\next}%
\gdef\verbatim@testend#1{%
\if\noexpand#1\noexpand~%
\expandafter\verbatim@addtoline
\expandafter{\the\@temptokena[}%
\expandafter\verbatim@addtoline
\expandafter{\@tempc}%
\verbatim@processline
\verbatim@startline
\let\next\verbatim@
\else\if\noexpand#1\noexpand]%
\let\next\verbatim@@testend
\else\if\noexpand#1\noexpand!%
\expandafter\verbatim@addtoline
\expandafter{\the\@temptokena[}%
\expandafter\verbatim@addtoline
\expandafter{\@tempc}%
\def\next{\verbatim@!}%
\else \expandafter\def\expandafter\@tempc\expandafter
{\@tempc#1}\fi\fi\fi
\next}%
\gdef\verbatim@@testend{%
\ifx\@tempc\@currenvir
\verbatim@finish
\edef\next{\noexpand\end{\@currenvir}%
\noexpand\verbatim@rescan{\@currenvir}}%
\else
\expandafter\verbatim@addtoline
\expandafter{\the\@temptokena[}%
\expandafter\verbatim@addtoline
\expandafter{\@tempc]}%
\let\next\verbatim@
\fi
\next}%
\gdef\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else
\@warning{Characters dropped after `\string\end{#1}'}\fi}}
\endgroup
\def\verbatiminput{\begingroup
\@ifstar\sverbatim@input\verbatim@input}
\def\sverbatim@input#1{\@verbatim
\@input{#1}\endtrivlist\endgroup\@doendpe}
\def\verbatim@input#1{\@verbatim
\frenchspacing \@vobeyspaces
\@input{#1}\endtrivlist\endgroup\@doendpe}
\begingroup
\lccode`\~=`\^^M
\lowercase{%
\gdef\verb{\begingroup
\verbatim@font
\catcode`\^^M\active
\def~{\endgroup\@latexerr{\string\verb\space command ended by
end of line.}\@ehc}%
\let\do\@makeother \dospecials
\@ifstar\@sverb{\@vobeyspaces \frenchspacing \@sverb}}}
\endgroup
\def\@sverb#1{%
\catcode`#1\active
\lccode`\~`#1%
\lowercase{\let~\endgroup}%
\leavevmode\null}
\endinput
%%
%% End of file `verbatim.sty'.

View File

@ -0,0 +1,227 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bmputils.h
// Purpose: Utilities for manipulating bitmap and metafile images for
// the purposes of conversion to RTF
// Author: Julian Smart
// Modified by:
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
'C', 'D', 'E', 'F' };
void DecToHex(int dec, char *buf)
{
int firstDigit = (int)(dec/16.0);
int secondDigit = (int)(dec - (firstDigit*16.0));
buf[0] = hexArray[firstDigit];
buf[1] = hexArray[secondDigit];
buf[2] = 0;
}
static unsigned int getshort(FILE *fp)
{
int c, c1;
c = getc(fp); c1 = getc(fp);
return ((unsigned int) c) + (((unsigned int) c1) << 8);
}
static unsigned long getint(FILE *fp)
{
int c, c1, c2, c3;
c = getc(fp); c1 = getc(fp); c2 = getc(fp); c3 = getc(fp);
return (long)((long) c) +
(((long) c1) << 8) +
(((long) c2) << 16) +
(((long) c3) << 24);
}
bool GetBMPHeader(FILE *fp, int *Width, int *Height, int *Planes, int *BitsPerPixel)
{
unsigned long bfSize, bfOffBits, biSize, biWidth, biHeight, biPlanes;
unsigned long biBitCount, biCompression, biSizeImage, biXPelsPerMeter;
unsigned long biYPelsPerMeter, biClrUsed, biClrImportant;
/* read the file type (first two bytes) */
int c = getc(fp); int c1 = getc(fp);
if (c!='B' || c1!='M') { return FALSE; }
bfSize = getint(fp);
getshort(fp); /* reserved and ignored */
getshort(fp);
bfOffBits = getint(fp);
biSize = getint(fp);
biWidth = getint(fp);
biHeight = getint(fp);
biPlanes = getshort(fp);
biBitCount = getshort(fp);
biCompression = getint(fp);
biSizeImage = getint(fp);
biXPelsPerMeter = getint(fp);
biYPelsPerMeter = getint(fp);
biClrUsed = getint(fp);
biClrImportant = getint(fp);
*Width = (int)biWidth;
*Height = (int)biHeight;
*Planes = (int)biPlanes;
*BitsPerPixel = (int)biBitCount;
// fseek(fp, bfOffBits, SEEK_SET);
return TRUE;
}
static int scanLineWidth = 0;
bool OutputBitmapHeader(FILE *fd, bool isWinHelp = FALSE)
{
int Width, Height, Planes, BitsPerPixel;
if (!GetBMPHeader(fd, &Width, &Height, &Planes, &BitsPerPixel))
return FALSE;
scanLineWidth = (int)((float)Width/(8.0/(float)BitsPerPixel));
if ((float)((int)(scanLineWidth/2.0)) != (float)(scanLineWidth/2.0))
scanLineWidth ++;
int goalW = 15*Width;
int goalH = 15*Height;
TexOutput("{\\pict");
if (isWinHelp) TexOutput("\\wbitmap0");
else TexOutput("\\dibitmap");
char buf[50];
TexOutput("\\picw"); sprintf(buf, "%d", Width); TexOutput(buf);
TexOutput("\\pich"); sprintf(buf, "%d", Height); TexOutput(buf);
TexOutput("\\wbmbitspixel"); sprintf(buf, "%d", BitsPerPixel); TexOutput(buf);
TexOutput("\\wbmplanes"); sprintf(buf, "%d", Planes); TexOutput(buf);
TexOutput("\\wbmwidthbytes"); sprintf(buf, "%d", scanLineWidth); TexOutput(buf);
TexOutput("\\picwgoal"); sprintf(buf, "%d", goalW); TexOutput(buf);
TexOutput("\\pichgoal"); sprintf(buf, "%d", goalH); TexOutput(buf);
TexOutput("\n");
return TRUE;
}
bool OutputBitmapData(FILE *fd)
{
fseek(fd, 14, SEEK_SET);
int bytesSoFar = 0;
int ch = getc(fd);
char hexBuf[3];
while (ch != EOF)
{
if (bytesSoFar == scanLineWidth)
{
bytesSoFar = 0;
TexOutput("\n");
}
DecToHex(ch, hexBuf);
TexOutput(hexBuf);
bytesSoFar ++;
ch = getc(fd);
}
TexOutput("\n}\n");
return TRUE;
}
#ifdef __WXMSW__
struct mfPLACEABLEHEADER {
DWORD key;
HANDLE hmf;
RECT bbox;
WORD inch;
DWORD reserved;
WORD checksum;
};
// Returns size in TWIPS
bool GetMetafileHeader(FILE *handle, int *width, int *height)
{
char buffer[40];
mfPLACEABLEHEADER *theHeader = (mfPLACEABLEHEADER *)&buffer;
fread((void *)theHeader, sizeof(char), sizeof(mfPLACEABLEHEADER), handle);
if (theHeader->key != 0x9AC6CDD7)
{
return FALSE;
}
float widthInUnits = (float)theHeader->bbox.right - theHeader->bbox.left;
float heightInUnits = (float)theHeader->bbox.bottom - theHeader->bbox.top;
*width = (int)((widthInUnits*1440.0)/theHeader->inch);
*height = (int)((heightInUnits*1440.0)/theHeader->inch);
return TRUE;
}
bool OutputMetafileHeader(FILE *handle, bool isWinHelp, int userWidth, int userHeight)
{
int Width, Height;
if (!GetMetafileHeader(handle, &Width, &Height))
return FALSE;
scanLineWidth = 64;
int goalW = Width;
int goalH = Height;
// Scale to user's dimensions if we have the information
if (userWidth > 0 && userHeight == 0)
{
double scaleFactor = ((double)userWidth/(double)goalW);
goalW = userWidth;
goalH = (int)((goalH * scaleFactor) + 0.5);
}
else if (userWidth == 0 && userHeight > 0)
{
double scaleFactor = ((double)userHeight/(double)goalH);
goalH = userHeight;
goalW = (int)((goalW * scaleFactor) + 0.5);
}
else if (userWidth > 0 && userHeight > 0)
{
goalW = userWidth;
goalH = userHeight;
}
TexOutput("{\\pict");
TexOutput("\\wmetafile8");
char buf[50];
TexOutput("\\picw"); sprintf(buf, "%d", Width); TexOutput(buf);
TexOutput("\\pich"); sprintf(buf, "%d", Height); TexOutput(buf);
TexOutput("\\picwgoal"); sprintf(buf, "%d", goalW); TexOutput(buf);
TexOutput("\\pichgoal"); sprintf(buf, "%d", goalH); TexOutput(buf);
TexOutput("\n");
return TRUE;
}
bool OutputMetafileData(FILE *handle)
{
int bytesSoFar = 0;
char hexBuf[3];
int ch;
do
{
ch = getc(handle);
if (bytesSoFar == scanLineWidth)
{
bytesSoFar = 0;
TexOutput("\n");
}
if (ch != EOF)
{
DecToHex(ch, hexBuf);
TexOutput(hexBuf);
bytesSoFar ++;
}
} while (ch != EOF);
TexOutput("\n}\n");
return TRUE;
}
#endif

BIN
utils/tex2rtf/src/books.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

10
utils/tex2rtf/src/dos.def Normal file
View File

@ -0,0 +1,10 @@
NAME TEX2RTF
DESCRIPTION 'Tex2Rtf'
;
EXETYPE DOS
;
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
;
HEAPSIZE 1024
STACKSIZE 8192

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright:
#
# "%W% %G%"
#
# Makefile : Builds tex2rtf
# WXWIN and BCCDIR are set by parent make
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makeb32.env
WXLIBDIR = $(WXDIR)\lib
WXINC = $(WXDIR)\include\msw
WXLIB = $(WXLIBDIR)\wx32.lib
LIBS=$(WXLIB) cw32 import32 ole2w32
TARGET=tex2rtf
!if "$(FINAL)" == "0"
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS= -v
!else
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
OPT = -Od
DEBUG_FLAGS =
!endif
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
OBJECTS = tex2rtf.obj tex2any.obj texutils.obj rtfutils.obj xlputils.obj htmlutil.obj readshg.obj table.obj
$(TARGET).exe: $(OBJECTS) $(TARGET).res
tlink32 $(LINKFLAGS) @&&!
c0w32.obj $(OBJECTS)
$(TARGET)
nul
$(LIBS)
$(TARGET).def
$(TARGET).res
!
.$(SRCSUFF).obj:
bcc32 $(CPPFLAGS) -c {$< }
.c.obj:
bcc32 $(CPPFLAGS) -P- -c {$< }
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@ -0,0 +1,19 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1998
# Updated:
#
# Builds a BC++ 16-bit sample
!if "$(WXWIN)" == ""
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
!endif
WXDIR = $(WXWIN)
TARGET=tex2rtf
OBJECTS = tex2rtf.obj tex2any.obj texutils.obj rtfutils.obj xlputils.obj htmlutil.obj readshg.obj table.obj
!include $(WXDIR)\src\makeprog.bcc

View File

@ -0,0 +1,17 @@
#
# File: makefile.dos
# Author: Julian Smart
# Created: 1998
# Updated:
#
# Makefile : Builds 16-bit sample, VC++ 1.5
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
WXDIR = $(WXWIN)
TARGET=tex2rtf
OBJECTS = tex2rtf.obj tex2any.obj texutils.obj rtfutils.obj xlputils.obj htmlutil.obj readshg.obj table.obj
!include $(WXDIR)\src\makeprog.msc

View File

@ -0,0 +1,61 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 1996
# Updated:
#
# "%W% %G%"
#
# Makefile for Tex2RTF (GNU-WIN32)
WXDIR = ../../..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/makeg95.env
OBJECTS = $(OBJDIR)/tex2rtf.$(OBJSUFF) $(OBJDIR)/texutils.$(OBJSUFF) $(OBJDIR)/tex2any.$(OBJSUFF)\
$(OBJDIR)/htmlutil.$(OBJSUFF) $(OBJDIR)/rtfutils.$(OBJSUFF) $(OBJDIR)/xlputils.$(OBJSUFF)\
$(OBJDIR)/table.$(OBJSUFF) $(OBJDIR)/readshg.$(OBJSUFF)\
$(OBJDIR)/tex2rtf_resources.$(OBJSUFF)
all: $(OBJDIR) tex2rtf$(GUISUFFIX)$(EXESUFF)
INC = $(COMPPATHS) -I$(WXDIR)/include/msw -I$(WXDIR)/include/base -I../../wxhelp/src
CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) -DDEBUG='$(DEBUG)' $(DEBUGFLAGS) $(WARN) $(OPT)
$(OBJDIR):
mkdir $(OBJDIR)
tex2rtf$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
$(CC) $(LDFLAGS) -o tex2rtf$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
$(OBJDIR)/tex2rtf.$(OBJSUFF): tex2rtf.$(SRCSUFF) tex2rtf.h tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ tex2rtf.$(SRCSUFF)
$(OBJDIR)/texutils.$(OBJSUFF): texutils.$(SRCSUFF) tex2rtf.h tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ texutils.$(SRCSUFF)
$(OBJDIR)/tex2any.$(OBJSUFF): tex2any.$(SRCSUFF) tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ tex2any.$(SRCSUFF)
$(OBJDIR)/htmlutil.$(OBJSUFF): htmlutil.$(SRCSUFF) tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ htmlutil.$(SRCSUFF)
$(OBJDIR)/rtfutils.$(OBJSUFF): rtfutils.$(SRCSUFF) tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ rtfutils.$(SRCSUFF)
$(OBJDIR)/xlputils.$(OBJSUFF): xlputils.$(SRCSUFF) tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ xlputils.$(SRCSUFF)
$(OBJDIR)/table.$(OBJSUFF): table.$(SRCSUFF) tex2any.h
$(CC) -c $(CPPFLAGS) -o $@ table.$(SRCSUFF)
$(OBJDIR)/readshg.$(OBJSUFF): readshg.$(SRCSUFF) readshg.h
$(CC) -c $(CPPFLAGS) -o $@ readshg.$(SRCSUFF)
$(OBJDIR)/tex2rtf_resources.o: tex2rtf.rc
$(RESCOMP) -i tex2rtf.rc -o $(OBJDIR)/tex2rtf_resources.o $(RESFLAGS)
clean:
rm -f $(OBJECTS) tex2rtf$(GUISUFFIX).exe core *.rsc *.res

View File

@ -0,0 +1,141 @@
#
# File: makefile.nt
# Author: Julian Smart
# Created: 1993
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds Tex2RTF on Windows Windows 95/NT
#
!include <..\..\..\src\ntwxwin.mak>
TEX2RTFDIR = $(WXDIR)\utils\tex2rtf
TEX2RTFINC = $(TEX2RTFDIR)\src
PROGRAM=tex2rtf
DOCDIR=$(WXDIR)\docs
LOCALDOCDIR=$(WXDIR)\utils\tex2rtf\docs
THISDIR=$(TEX2RTFDIR)\src
OBJECTS = tex2rtf.obj tex2any.obj texutils.obj rtfutils.obj xlputils.obj htmlutil.obj readshg.obj table.obj
all: tex2rtf.exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.nt
cd $(TEX2RTFDIR)\src
$(PROGRAM).exe: $(WXLIB) $(OBJECTS) $(PROGRAM).res
$(link) @<<
-out:$(PROGRAM).exe
$(LINKFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
$(LIBS)
<<
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
tex2any.obj: tex2any.$(SRCSUFF) tex2any.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
texutils.obj: texutils.$(SRCSUFF) tex2any.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
tex2rtf.obj: tex2rtf.$(SRCSUFF) bmputils.h tex2rtf.h tex2any.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
rtfutils.obj: rtfutils.$(SRCSUFF) tex2rtf.h bmputils.h tex2any.h readshg.h table.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
table.obj: table.$(SRCSUFF) table.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
readshg.obj: readshg.$(SRCSUFF) readshg.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
xlputils.obj: xlputils.$(SRCSUFF) tex2rtf.h rtfutils.h tex2any.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
htmlutil.obj: htmlutil.$(SRCSUFF) tex2rtf.h tex2any.h table.h
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
clean:
-erase *.obj
-erase *.sbr
-erase *.exe
-erase *.res
-erase *.map
-erase *.pdb
cleanall:
erase *.exe *.obj *.pch *.res
DOCSOURCES=$(LOCALDOCDIR)\tex2rtf.tex
html: $(DOCDIR)\html\tex2rtf\t2rtf.htm
hlp: $(DOCDIR)\winhelp\tex2rtf.hlp
pdfrtf: $(DOCDIR)\pdf\tex2rtf.rtf
ps: $(WXDIR)\docs\ps\tex2rtf.ps
$(DOCDIR)\winhelp\tex2rtf.hlp: $(LOCALDOCDIR)\tex2rtf.rtf $(LOCALDOCDIR)\tex2rtf.hpj
cd $(LOCALDOCDIR)
-erase tex2rtf.ph
hc tex2rtf
copy tex2rtf.hlp $(DOCDIR)\winhelp\tex2rtf.hlp
copy tex2rtf.cnt $(DOCDIR)\winhelp\tex2rtf.cnt
cd $(THISDIR)
$(LOCALDOCDIR)\tex2rtf.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-start /w tex2rtf $(LOCALDOCDIR)\tex2rtf.tex $(LOCALDOCDIR)\tex2rtf.rtf -twice -winhelp
cd $(THISDIR)
$(DOCDIR)\pdf\tex2rtf.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-copy *.bmp *.wmf $(DOCDIR)\pdf
-start /w tex2rtf $(LOCALDOCDIR)\tex2rtf.tex $(DOCDIR)\pdf\tex2rtf.rtf -twice -rtf
cd $(THISDIR)
$(DOCDIR)\html\tex2rtf\t2rtf.htm: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-mkdir $(DOCDIR)\html\tex2rtf
-start /w tex2rtf $(LOCALDOCDIR)\tex2rtf.tex $(DOCDIR)\html\tex2rtf\t2rtf.htm -twice -html
-erase $(DOCDIR)\html\tex2rtf\*.con
-erase $(DOCDIR)\html\tex2rtf\*.ref
cd $(THISDIR)
$(LOCALDOCDIR)\tex2rtf.dvi: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-latex tex2rtf
-latex tex2rtf
-makeindx tex2rtf
-bibtex tex2rtf
-latex tex2rtf
-latex tex2rtf
cd $(THISDIR)
$(WXDIR)\docs\ps\tex2rtf.ps: $(LOCALDOCDIR)\tex2rtf.dvi
cd $(LOCALDOCDIR)
-dvips32 -o tex2rtf.ps tex2rtf
copy tex2rtf.ps $(WXDIR)\docs\ps\tex2rtf.ps
cd $(THISDIR)

View File

@ -0,0 +1,17 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1998
# Updated:
# Copyright: (c) 1998 Julian Smart
#
# "%W% %G%"
#
# Makefile for Tex2RTF (Unix)
PROGRAM=tex2rtf
OBJECTS = tex2rtf.o tex2any.o texutils.o rtfutils.o xlputils.o htmlutil.o readshg.o table.o
include ../../../src/makeprog.env

View File

@ -0,0 +1,14 @@
#
# Makefile for WATCOM
#
# 8 Nov 1994
#
WXDIR = $(%WXWIN)
PROGRAM = tex2rtf
OBJECTS = tex2rtf.obj tex2any.obj texutils.obj rtfutils.obj xlputils.obj htmlutil.obj readshg.obj table.obj
!include $(WXDIR)\src\makeprog.wat

View File

@ -0,0 +1,98 @@
# From: Juan Altmayer Pizzorno[SMTP:juan@vms.gmd.de]
# Sent: 31 May 1996 10:11
# To: J.Smart@ed.ac.uk
# Subject: Changes to Tex2RTF
#
# Hello,
#
# Recently I've been looking for a way to create and maintain documentation on
# multiple platforms out of a single source -- specifically, something that
# prints nicely and can be converted to WinHelp and HTML. I liked the approach
# of Tex2RTF, so I set off to give it a try... I found out it would crash
# when submitted to a certain LaTeX file I created. I wanted to find out why,
# so I went on and worked on compiling on my PC: Windows NT 4.0 beta, Visual
# C++ 4.1a. Since all I was interested on was the convertion utility, I tried
# to make it work without a GUI. It didn't compile immediately, but after a
# few small changes it now works like a charm. Unfortunately it doesn't crash
# anymore, so I can't tell why it used to... Anyway, I wanted to contribute
# the changes back: I'm appending two files to this message, the first a
# description of the changes, and the second a quick-and-dirty makefile that
# doesn't require wxWindows to run. Please do write to me if you have any
# questions or anything.
#
# Last but not least, it's great that you took the time and wrote Tex2RTF!!
#
# Quick-and-dirty makefile for building Tex2RTF without the wx
# libraries on a Windows NT machine. If you want to use it for
# "real", please update the dependancies between object and include
# files. Created for Windows NT 4.0 and Visual C++ 4.1.
#
# Juan Altmayer Pizzorno, May 1996
#
syslibs=kernel32.lib advapi32.lib
cxxflags=/nologo /MD /W0 /O2 /Zi /D "WIN32" /D "_WIN32" /D "_DEBUG" /c
linkflags=$(syslibs) /out:$@ /nologo /debug
!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
cxxflags=$(cxxflags) /G5 # optimize for pentium
!endif
cxx=cl
link=link
remove=del
cxxflags=$(cxxflags) /I wxwin /D wx_msw /D WINVER=0x0400 /D WIN95=0
cxxflags=$(cxxflags) /D "NO_GUI"
objects=tex2any.obj texutils.obj tex2rtf.obj rtfutils.obj table.obj readshg.obj xlputils.obj htmlutil.obj
objects=$(objects) wb_hash.obj wb_list.obj wb_obj.obj wb_utils.obj
all : tex2rtf.exe
clean :
-$(remove) *.obj
cleanall : clean
-$(remove) *.exe *.pdb *.ilk
tex2rtf.exe : $(objects)
$(link) $(linkflags) $(objects)
tex2any.obj : tex2any.cpp tex2any.h
$(cxx) $(cxxflags) tex2any.cpp
texutils.obj : texutils.cpp tex2any.h
$(cxx) $(cxxflags) texutils.cpp
tex2rtf.obj : tex2rtf.cpp bmputils.h tex2rtf.h tex2any.h
$(cxx) $(cxxflags) tex2rtf.cpp
rtfutils.obj : rtfutils.cpp tex2rtf.h bmputils.h tex2any.h readshg.h table.h
$(cxx) $(cxxflags) rtfutils.cpp
table.obj : table.cpp table.h
$(cxx) $(cxxflags) table.cpp
readshg.obj : readshg.cpp readshg.h
$(cxx) $(cxxflags) readshg.cpp
xlputils.obj : xlputils.cpp tex2rtf.h rtfutils.h tex2any.h
$(cxx) $(cxxflags) xlputils.cpp
htmlutil.obj : htmlutil.cpp tex2rtf.h tex2any.h table.h
$(cxx) $(cxxflags) htmlutil.cpp
wb_hash.obj : wxwin\wb_hash.cpp
$(cxx) $(cxxflags) wxwin\wb_hash.cpp
wb_list.obj : wxwin\wb_list.cpp
$(cxx) $(cxxflags) wxwin\wb_list.cpp
wb_obj.obj : wxwin\wb_obj.cpp
$(cxx) $(cxxflags) wxwin\wb_obj.cpp
wb_utils.obj : wxwin\wb_utils.cpp
$(cxx) $(cxxflags) wxwin\wb_utils.cpp

View File

@ -0,0 +1,23 @@
/*
* File: maths.cc
* Purpose: Beginnings of a maths parser for LaTeX.
* NOT IMPLEMENTED. I'm still thinking how best to do this...
*
*/
// For compilers that support precompilation, includes "wx.h".
#include "wx_prec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx.h>
#endif
#include <ctype.h>
#include "tex2any.h"
#include <stdlib.h>
#include <time.h>

View File

@ -0,0 +1,163 @@
/////////////////////////////////////////////////////////////////////////////
// Name: readshg.cpp
// Purpose: Petr Smilauer's .SHG (Segmented Hypergraphics file) reading
// code.
// Note: .SHG is undocumented (anywhere!) so this is
// reverse-engineering
// and guesswork at its best.
// Author: Petr Smilauer
// Modified by:
// Created: 01/01/99
// RCS-ID: $Id$
// Copyright: (c) Petr Smilauer
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "readshg.h"
#include "tex2any.h"
// Returns the number of hotspots, and the array of hotspots.
// E.g.
// HotSpots *array;
// int n = ParseSHG("thing.shg", &array);
int ParseSHG( const char* fileName, HotSpot **hotspots)
{ FILE* fSHG = fopen( fileName, "rb");
long offset;
int nHotspots = 0;
if(fSHG == 0)
return 0;
nHotspots = 0;
//first, look at offset OFF_OFFSET to get another offset :-)
fseek( fSHG, OFF_OFFSET, SEEK_SET);
offset = 0L; // init whole 4-byte variable
fread( &offset, 2, 1, fSHG); // get the offset in first two bytes..
if(offset == 0) // if zero, used next DWORD field
fread( &offset, 4, 1, fSHG);// this is our offset for very long DIB
offset += 9; // don't know hot this delta comes-about
if(fseek( fSHG, offset, SEEK_SET) != 0)
{
fclose( fSHG);
return -1; // this is probably because incorrect offset calculation.
}
fread( &nHotspots, 2, 1, fSHG);
*hotspots = new HotSpot[nHotspots];
int nMacroStrings = 0;
fread( &nMacroStrings, 2, 1, fSHG); // we can ignore the macros, as this is
// repeated later, but we need to know how much to skip
fseek( fSHG, 2, SEEK_CUR); // skip another 2 bytes I do not understand ;-)
ShgInfoBlock sib;
int i;
int sizeOf = sizeof( ShgInfoBlock);
for( i = 0 ; i < nHotspots ; ++i)
{
fread( &sib, sizeOf, 1, fSHG); // read one hotspot' info
// analyse it:
(*hotspots)[i].type = (HotspotType)(sib.hotspotType & 0xFB);
(*hotspots)[i].left = sib.left;
(*hotspots)[i].top = sib.top;
(*hotspots)[i].right = sib.left + sib.width;
(*hotspots)[i].bottom = sib.top + sib.height;
(*hotspots)[i].IsVisible = ((sib.hotspotType & 4) == 0);
(*hotspots)[i].szHlpTopic_Macro[0] = '\0';
}
// we have it...now read-off the macro-string block
if(nMacroStrings > 0)
fseek( fSHG, nMacroStrings, SEEK_CUR); //nMacroStrings is byte offset...
// and, at the last, read through the strings: hotspot-id[ignored], then topic/macro
int c;
for( i = 0 ; i < nHotspots ; ++i)
{
while( (c = fgetc( fSHG)) != 0)
;
// now read it:
int j = 0;
while( (c = fgetc( fSHG)) != 0)
{
(*hotspots)[i].szHlpTopic_Macro[j] = c;
++j;
}
(*hotspots)[i].szHlpTopic_Macro[j] = 0;
}
fclose( fSHG);
return nHotspots;
}
// Convert Windows .SHG file to HTML map file
bool SHGToMap(char *filename, char *defaultFile)
{
// Test the SHG parser
HotSpot *hotspots = NULL;
int n = ParseSHG(filename, &hotspots);
if (n == 0)
return FALSE;
char buf[100];
sprintf(buf, "Converting .SHG file to HTML map file: there are %d hotspots in %s.", n, filename);
OnInform(buf);
char outBuf[256];
strcpy(outBuf, filename);
StripExtension(outBuf);
strcat(outBuf, ".map");
FILE *fd = fopen(outBuf, "w");
if (!fd)
{
OnError("Could not open .map file for writing.");
delete[] hotspots;
return FALSE;
}
fprintf(fd, "default %s\n", defaultFile);
for (int i = 0; i < n; i++)
{
char *refFilename = "??";
TexRef *texRef = FindReference(hotspots[i].szHlpTopic_Macro);
if (texRef)
refFilename = texRef->refFile;
else
{
char buf[300];
sprintf(buf, "Warning: could not find hotspot reference %s", hotspots[i].szHlpTopic_Macro);
OnInform(buf);
}
fprintf(fd, "rect %s %d %d %d %d\n", refFilename, (int)hotspots[i].left, (int)hotspots[i].top,
(int)hotspots[i].right, (int)hotspots[i].bottom);
}
fprintf(fd, "\n");
fclose(fd);
delete[] hotspots;
return TRUE;
}

View File

@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Name: readshg.h
// Purpose: Petr Smilauer's .SHG (Segmented Hypergraphics file) reading
// code.
// Note: .SHG is undocumented (anywhere!) so this is
// reverse-engineering
// and guesswork at its best.
// Author: Petr Smilauer
// Modified by:
// Created: 01/01/99
// RCS-ID: $Id$
// Copyright: (c) Petr Smilauer
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef readshgh
#define readshgh
#include <stdio.h>
#include <stdlib.h>
typedef enum { TypePopup = 0xE2, TypeJump = 0xE3, TypeMacro = 0xC8} HotspotType;
#define NOT_VISIBLE 0x04
typedef struct
{
unsigned char hotspotType;// combines HotspotType /w NOT_VISIBLE if appropriate
unsigned char flag; // NOT_VISIBLE or 0 ??
unsigned char skip; // 0, always??
unsigned short left,
top,
width, // left+width/top+height give right/bottom,
height; // =>right and bottom edge are not 'included'
unsigned char magic[4]; // wonderful numbers: for macros, this seems
// (at least first 2 bytes) to represent offset into macro-strings block.
} ShgInfoBlock; // whole block is just 15 bytes long. How weird!
#define OFF_OFFSET 0x20 // this is offset, where WORD (?) lies
#define OFFSET_DELTA 9 // we must add this to get real offset from file beginning
struct HotSpot
{
HotspotType type;
unsigned int left,
top,
right,
bottom;
char szHlpTopic_Macro[65];
bool IsVisible;
};
// Returns the number of hotspots, and the array of hotspots.
// E.g.
// HotSpots *array;
// int n = ParseSHG("thing.shg", &array);
extern int ParseSHG( const char* fileName, HotSpot **hotspots);
// Converts Windows .SHG file to HTML map file
extern bool SHGToMap(char *filename, char *defaultFile);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Name: rtfutils.h
// Purpose: RTF-specific code
// Author: Julian Smart
// Modified by:
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
* Write a suitable RTF header.
*
*/
void WriteRTFHeader(FILE *fd);
/*
* Given a TexChunk with a string value, scans through the string
* converting Latex-isms into RTF-isms, such as 2 newlines -> \par,
* and inserting spaces at the start of lines since in Latex, a newline
* implies a space, but not in RTF.
*
*/
void ProcessText2RTF(TexChunk *chunk);
/*
* Scan through all chunks starting from the given one,
* calling ProcessText2RTF to convert Latex-isms to RTF-isms.
* This should be called after Tex2Any has parsed the file,
* and before TraverseDocument is called.
*
*/
void Text2RTF(TexChunk *chunk);
/*
* Keeping track of environments to restore the styles after \pard.
* Push strings like "\qc" onto stack.
*
*/
void PushEnvironmentStyle(char *style);
void PopEnvironmentStyle(void);
// Write out the styles, most recent first.
void WriteEnvironmentStyles(void);
// Called on start/end of macro examination
void DefaultRtfOnMacro(char *name, int no_args, bool start);
// Called on start/end of argument examination
bool DefaultRtfOnArgument(char *macro_name, int arg_no, bool start);
// Reset memory of which levels have 'books' (for WinHelp 4 contents file)
void ResetContentsLevels(int level);

156
utils/tex2rtf/src/table.cpp Normal file
View File

@ -0,0 +1,156 @@
/////////////////////////////////////////////////////////////////////////////
// Name: table.cpp
// Purpose: Utilities for manipulating tables
// Author: Julian Smart
// Modified by:
// Created: 01/01/99
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/hash.h>
#if wxUSE_IOSTREAMH
#include <iostream.h>
#include <fstream.h>
#else
#include <iostream>
#include <fstream>
#endif
#include <ctype.h>
#include "tex2any.h"
#include "table.h"
ColumnData TableData[40];
bool inTabular = FALSE;
bool startRows = FALSE;
bool tableVerticalLineLeft = FALSE;
bool tableVerticalLineRight = FALSE;
int noColumns = 0; // Current number of columns in table
int ruleTop = 0;
int ruleBottom = 0;
int currentRowNumber = 0;
/*
* Parse table argument
*
*/
bool ParseTableArgument(char *value)
{
noColumns = 0;
int i = 0;
int len = strlen(value);
bool isBorder = FALSE;
while (i < len)
{
int ch = value[i];
if (ch == '|')
{
i ++;
isBorder = TRUE;
}
else if (ch == 'l')
{
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].justification = 'l';
TableData[noColumns].width = 2000; // Estimate
TableData[noColumns].absWidth = FALSE;
// TableData[noColumns].spacing = ??
noColumns ++;
i ++;
isBorder = FALSE;
}
else if (ch == 'c')
{
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].justification = 'c';
TableData[noColumns].width = defaultTableColumnWidth; // Estimate
TableData[noColumns].absWidth = FALSE;
// TableData[noColumns].spacing = ??
noColumns ++;
i ++;
isBorder = FALSE;
}
else if (ch == 'r')
{
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].justification = 'r';
TableData[noColumns].width = 2000; // Estimate
TableData[noColumns].absWidth = FALSE;
// TableData[noColumns].spacing = ??
noColumns ++;
i ++;
isBorder = FALSE;
}
else if (ch == 'p')
{
i ++;
int j = 0;
char numberBuf[50];
ch = value[i];
if (ch == '{')
{
i++;
ch = value[i];
}
while ((i < len) && (isdigit(ch) || ch == '.'))
{
numberBuf[j] = ch;
j ++;
i ++;
ch = value[i];
}
// Assume we have 2 characters for units
numberBuf[j] = value[i];
j ++; i++;
numberBuf[j] = value[i];
j ++; i++;
numberBuf[j] = 0;
if (value[i] == '}') i++;
TableData[noColumns].leftBorder = isBorder;
TableData[noColumns].rightBorder = FALSE;
TableData[noColumns].justification = 'l';
TableData[noColumns].width = 20*ParseUnitArgument(numberBuf);
TableData[noColumns].absWidth = TRUE;
// TableData[noColumns].spacing = ??
noColumns ++;
isBorder = FALSE;
}
else
{
char *buf = new char[strlen(value) + 80];
sprintf(buf, "Tabular first argument \"%s\" too complex!", value);
OnError(buf);
delete[] buf;
return FALSE;
}
}
if (isBorder)
TableData[noColumns-1].rightBorder = TRUE;
return TRUE;
}

36
utils/tex2rtf/src/table.h Normal file
View File

@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////
// Name: table.h
// Purpose: Table utilities
// Author: Julian Smart
// Modified by:
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
* Table dimensions
*
*/
struct ColumnData
{
char justification; // l, r, c
int width; // -1 or a width in twips
int spacing; // Space between columns in twips
bool leftBorder;
bool rightBorder;
bool absWidth; // If FALSE (the default), don't use an absolute width if you can help it.
};
extern ColumnData TableData[];
extern bool inTabular;
extern bool startRows;
extern bool tableVerticalLineLeft;
extern bool tableVerticalLineRight;
extern int noColumns; // Current number of columns in table
extern int ruleTop;
extern int ruleBottom;
extern int currentRowNumber;
extern bool ParseTableArgument(char *value);

File diff suppressed because it is too large Load Diff

1067
utils/tex2rtf/src/tex2any.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
NAME TEX2RTF
DESCRIPTION 'Tex2Rtf'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 3000
STACKSIZE 20000

157
utils/tex2rtf/src/tex2rtf.h Normal file
View File

@ -0,0 +1,157 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tex2any.h
// Purpose: tex2RTF conversion header
// Author: Julian Smart
// Modified by:
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef NO_GUI
// Define a new application type
class MyApp: public wxApp
{ public:
bool OnInit();
int OnExit();
};
// Define a new frame type
class MyFrame: public wxFrame
{ public:
wxTextCtrl *textWindow;
MyFrame(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size);
void OnMenuCommand(int id);
void OnCloseWindow(wxCloseEvent& event);
void OnExit(wxCommandEvent& event);
void OnGo(wxCommandEvent& event);
void OnSetInput(wxCommandEvent& event);
void OnSetOutput(wxCommandEvent& event);
void OnSaveFile(wxCommandEvent& event);
void OnViewOutput(wxCommandEvent& event);
void OnViewLatex(wxCommandEvent& event);
void OnLoadMacros(wxCommandEvent& event);
void OnShowMacros(wxCommandEvent& event);
void OnModeRTF(wxCommandEvent& event);
void OnModeWinHelp(wxCommandEvent& event);
void OnModeHTML(wxCommandEvent& event);
void OnModeXLP(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
#ifdef __WXMSW__
#include "wx/dde.h"
class Tex2RTFConnection: public wxDDEConnection
{
public:
Tex2RTFConnection(char *buf, int size);
~Tex2RTFConnection(void);
bool OnExecute(const wxString& topic, char *data, int size, int format);
char *OnRequest(const wxString& topic, const wxString& item, int *size, int format);
};
class Tex2RTFServer: public wxDDEServer
{
public:
wxConnectionBase *OnAcceptConnection(const wxString& topic);
};
#endif // __WXMSW__
#endif // NO_GUI
/*
* Itemize/enumerate structure: put on a stack for
* getting the indentation right
*
*/
#define LATEX_ENUMERATE 1
#define LATEX_ITEMIZE 2
#define LATEX_DESCRIPTION 3
#define LATEX_TWOCOL 5
#define LATEX_INDENT 6
class ItemizeStruc: public wxObject
{
public:
int listType;
int currentItem;
int indentation;
int labelIndentation;
inline ItemizeStruc(int lType, int indent = 0, int labIndent = 0)
{ listType = lType; currentItem = 0;
indentation = indent; labelIndentation = labIndent; }
};
// ID for the menu quit command
#define TEX_QUIT 1
#define TEX_GO 2
#define TEX_SET_INPUT 3
#define TEX_SET_OUTPUT 4
#define TEX_VIEW_LATEX 5
#define TEX_VIEW_OUTPUT 6
#define TEX_VIEW_CUSTOM_MACROS 7
#define TEX_LOAD_CUSTOM_MACROS 8
#define TEX_MODE_RTF 9
#define TEX_MODE_WINHELP 10
#define TEX_MODE_HTML 11
#define TEX_MODE_XLP 12
#define TEX_HELP 13
#define TEX_ABOUT 14
#define TEX_SAVE_FILE 15
extern TexChunk *currentMember;
extern bool startedSections;
extern char *contentsString;
extern bool suppressNameDecoration;
extern wxList itemizeStack;
extern FILE *Contents;
extern FILE *Chapters;
extern FILE *Sections;
extern FILE *Subsections;
extern FILE *Subsubsections;
extern char *InputFile;
extern char *OutputFile;
extern char *MacroFile;
extern char *FileRoot;
extern char *ContentsName; // Contents page from last time around
extern char *TmpContentsName; // Current contents page
extern char *TmpFrameContentsName; // Current frame contents page
extern char *WinHelpContentsFileName; // WinHelp .cnt file
extern char *RefName; // Reference file name
extern char *bulletFile;
#ifndef NO_GUI
void ChooseOutputFile(bool force = FALSE);
void ChooseInputFile(bool force = FALSE);
#endif
void RTFOnMacro(int macroId, int no_args, bool start);
bool RTFOnArgument(int macroId, int arg_no, bool start);
void HTMLOnMacro(int macroId, int no_args, bool start);
bool HTMLOnArgument(int macroId, int arg_no, bool start);
void XLPOnMacro(int macroId, int no_args, bool start);
bool XLPOnArgument(int macroId, int arg_no, bool start);
bool RTFGo(void);
bool HTMLGo(void);
bool XLPGo(void);
#define ltHARDY 10000

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,17 @@
runTwice = yes
titleFontSize = 12
authorFontSize = 10
chapterFontSize = 12
sectionFontSize = 12
subsectionFontSize = 12
; RTF only
headerRule = yes
footerRule = yes
useHeadingStyles = yes
listItemIndent=40
truncateFilenames = FALSE
winHelpContents = yes
winHelpVersion = 4 ; 3 for Windows 3.x, 4 for Windows 95
generateHPJ = true
\overview [2] { \image{}{books.bmp}\helpref{#1}{#2}}
; Some stuff

View File

@ -0,0 +1,4 @@
aaa ICON "tex2rtf.ico"
tex2rtf ICON "tex2rtf.ico"
#include "wx/msw/wx.rc"

View File

@ -0,0 +1,42 @@
/* XPM */
static char *tex2rtf_xpm[] = {
/* width height num_colors chars_per_pixel */
" 32 32 3 1",
/* colors */
". c #000000",
"# c #c0c0c0",
"a c #ffffff",
/* pixels */
"aaaaaaaaaaaaaaaaaaaaa.aaaaaaa..a",
"aaaaaaaaaaaaaaaaaaaaa..aaaaa.aa.",
"aaaaaaaaaaaaaaaaaaaa#.a.aaaa.aa.",
"aaaaaaaaaaaaaaaaaaaa#..a.aaaaa.a",
"aaaaaaaaaaaaaaaaaaaa#...a.aaaa.a",
"aaaaaaaaaaaaaaaaa........a.aaaaa",
"aaaaaaaaaaaaa....aaaa.....a.aa.a",
"aaaaaaaaaaa..aaaa..........a.aaa",
"aaaaaaaaa..aa...............a.aa",
"aaaaaaaa.aa..................a.a",
"aaaaaaa.a.....................#a",
"aaaaaa.a.....................###",
"aaaaa.a.....................###a",
"aaaa.......................###aa",
"aaaa..............###.....###aaa",
"aaa...........#######....###aaaa",
"aaa.........#####aaa#...###aaaaa",
"aa........###aaaaaaaa..a##aaaaaa",
"aa.......##aaaaaaaaaa.aa#aaaaaaa",
"aa......##aaaaaaaaaaaaaaaaaaaaaa",
"a......##aaaaaaaaaaaaaaaaaaaaaaa",
"a.....##aaaaaaaaaaaaaaaaaaaaaaaa",
"a.....#aaaaaaaaaaaaaaaaaaaaaaaaa",
"a....#aaaaaaaaaaaaaaaaaaaaaaaaaa",
"a....aaaa.aaaaaaaaaaaaaaaaaaaaaa",
"a......a.a.a...aaa..a..aaaaaaaaa",
"a...a.aa...aa.aaaaa.a.aaaaaaaaaa",
"a...a.a.aaa.a.....aa.aaaaaaaaaaa",
"aa.aa.aa.aaaa.a.aaa.a.aaaaaaaaaa",
"aa.a.....aaaa.a..a..a..aaaaaaaaa",
"aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaa....aaaaaaaaaaaaaa"
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
/*
* File: wxhlpblk.h
* Purpose: Text blocks used in wxHelp
* Author: Julian Smart
* Created: 1993
* Updated:
* Copyright: (c) 1993, AIAI, University of Edinburgh
*/
/* sccsid[] = "%W% %G%" */
#ifndef wxhlpblkh
#define wxhlpblkh
#define hyBLOCK_NORMAL 1
#define hyBLOCK_RED 2
#define hyBLOCK_BLUE 3
#define hyBLOCK_GREEN 4
#define hyBLOCK_LARGE_HEADING 5
#define hyBLOCK_SMALL_HEADING 6
#define hyBLOCK_ITALIC 7
#define hyBLOCK_BOLD 8
#define hyBLOCK_INVISIBLE_SECTION 9
#define hyBLOCK_LARGE_VISIBLE_SECTION 10
#define hyBLOCK_SMALL_VISIBLE_SECTION 11
#define hyBLOCK_SMALL_TEXT 12
#define hyBLOCK_RED_ITALIC 13
#define hyBLOCK_TELETYPE 14
#endif // wxhlpblkh

File diff suppressed because it is too large Load Diff