]> git.saurik.com Git - wxWidgets.git/commitdiff
Added files for creating independent Tex2RTF distributions
authorJulian Smart <julian@anthemion.co.uk>
Wed, 7 Aug 2002 09:56:23 +0000 (09:56 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 7 Aug 2002 09:56:23 +0000 (09:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

21 files changed:
utils/tex2rtf/distrib/distrib.rsp [new file with mode: 0644]
utils/tex2rtf/distrib/innobott.txt [new file with mode: 0644]
utils/tex2rtf/distrib/innotop.txt [new file with mode: 0644]
utils/tex2rtf/distrib/makeinno.bat [new file with mode: 0755]
utils/tex2rtf/distrib/src.rsp [new file with mode: 0644]
utils/tex2rtf/distrib/tex2rtf.exe.manifest [new file with mode: 0644]
utils/tex2rtf/distrib/tex2rtfversion.txt [new file with mode: 0644]
utils/tex2rtf/distrib/zipdistinno.bat [new file with mode: 0755]
utils/tex2rtf/distrib/zipsrc.bat [new file with mode: 0755]
utils/tex2rtf/distrib/zipsrc.sh [new file with mode: 0644]
utils/tex2rtf/docs/makefile.vc [new file with mode: 0644]
utils/tex2rtf/docs/readme.txt
utils/tex2rtf/docs/tex2rtf.ini
utils/tex2rtf/src/Tex2RTFVC.dsp
utils/tex2rtf/src/symbols.h [new file with mode: 0644]
utils/tex2rtf/src/tex2rtf.cpp
utils/tex2rtf/tools/lacheck.1 [new file with mode: 0644]
utils/tex2rtf/tools/lacheck.exe [new file with mode: 0755]
utils/tex2rtf/tools/lacheck.lex [new file with mode: 0644]
utils/tex2rtf/tools/lacheck.rea [new file with mode: 0644]
utils/tex2rtf/tools/lacheck.txt [new file with mode: 0644]

diff --git a/utils/tex2rtf/distrib/distrib.rsp b/utils/tex2rtf/distrib/distrib.rsp
new file mode 100644 (file)
index 0000000..2d3c53e
--- /dev/null
@@ -0,0 +1,25 @@
+docs/*.tex
+docs/*.sty
+docs/*.bib
+docs/*.hpj
+docs/*.ini
+docs/*.txt
+docs/*.cnt
+docs/*.eps
+docs/*.bmp
+docs/*.gif
+docs/*.wmf
+docs/*.shg
+docs/makefile.vc
+
+tex2rtf.exe
+tex2rtf.chm
+lacheck.exe
+lacheck.txt
+readme.txt
+licence.txt
+lgpl.txt
+gpl.txt
+tex2rtf.exe.manifest
+tex2rtf_src.zip
+
diff --git a/utils/tex2rtf/distrib/innobott.txt b/utils/tex2rtf/distrib/innobott.txt
new file mode 100644 (file)
index 0000000..e33a761
--- /dev/null
@@ -0,0 +1,38 @@
+; For debug beta only
+;    Source: c:\winnt\system32\msvcrtd.dll; DestDir: {sys}\; DestName: msvcrtd.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall
+
+[Tasks]
+
+       Name: desktopicon; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"
+
+[Icons]
+    Name: {group}\Tex2RTF TEX2RTFVERSION; Filename: {app}\tex2rtf.exe; WorkingDir: {app}; IconFilename: {app}\tex2rtf.exe; IconIndex: 0
+    Name: {group}\Tex2RTF Help; Filename: {app}\tex2rtf.chm; WorkingDir: {app}; IconIndex: 0; Flags: useapppaths
+    Name: {group}\Tex2RTF Licence; Filename: {app}\licence.txt; WorkingDir: {app}; IconIndex: 0; Flags: useapppaths
+    Name: {userdesktop}\Tex2RTF TEX2RTFVERSION; Filename: {app}\tex2rtf.exe; WorkingDir: {app}; IconFilename: {app}\tex2rtf.exe; IconIndex: 0; Tasks: desktopicon
+
+[Registry]
+
+[UninstallDelete]
+
+[InstallDelete]
+
+[Run] 
+       Filename: "{app}\tex2rtf.exe"; Description: "Launch Tex2RTF"; Flags: postinstall nowait skipifsilent
+
+[UninstallRun]
+
+
+; ==============================================
+; The lines below are used by ScriptMaker
+; They are not required by Inno Setup
+; DO NOT DELETE THEM or you may be unable to reload the script
+
+;[ScriptSetup]
+;VerNum=TEX2RTFVERSION
+;InnoVer=1.3
+;AddVerTo=AppVerName
+;SetupFilename=setup.exe
+;OutputFolder=C:\wx2dev\wxWindows\deliver
+;CopyrightText=Copyright © Julian Smart, 2002
+
diff --git a/utils/tex2rtf/distrib/innotop.txt b/utils/tex2rtf/distrib/innotop.txt
new file mode 100644 (file)
index 0000000..1a26b5f
--- /dev/null
@@ -0,0 +1,47 @@
+; Inno Setup Script
+; Created with ScriptMaker Version 1.3.22
+; 14 February 2001 at 10:38
+
+[Setup]
+    MinVersion=4.0,4.0
+    AppName=Tex2RTF TEX2RTFVERSION
+    AppId=Tex2RTF
+    CreateUninstallRegKey=1
+    UsePreviousAppDir=1
+    UsePreviousGroup=1
+    AppVersion=TEX2RTFVERSION
+    AppVerName=Tex2RTF TEX2RTFVERSION
+    AppCopyright=Copyright © Julian Smart and others, 2002
+;    BackColor=$FF0000
+;    BackColor2=$000000
+    BackColor=$800000
+    BackColor2=$C71F1F
+    BackColorDirection=toptobottom
+    WindowShowCaption=1
+    WindowStartMaximized=1
+    WindowVisible=1
+    WindowResizable=1
+    UninstallLogMode=Append
+    DirExistsWarning=auto
+    UninstallFilesDir={app}
+    DisableDirPage=0
+    DisableStartupPrompt=1
+    CreateAppDir=1
+    DisableProgramGroupPage=0
+    AlwaysCreateUninstallIcon=1
+    Uninstallable=1
+    UninstallIconName=Uninstall Tex2RTF TEX2RTFVERSION
+    UninstallDisplayName=Tex2RTF TEX2RTFVERSION
+    DefaultDirName={pf}\Tex2RTF
+    DefaultGroupName=Tex2RTF TEX2RTFVERSION
+    MessagesFile=compiler:default.isl
+    DiskSpanning=0
+    DiskSize=1457664
+    DiskClusterSize=512
+    ReserveBytes=0
+    UseSetupLdr=1
+    LicenseFile=c:\wx2dev\wxWindows\utils\tex2rtf\docs\licence.txt
+    InfoAfterFile=c:\wx2dev\wxWindows\utils\tex2rtf\docs\readme.txt
+    SourceDir=c:\wx2dev\wxWindows\deliver\tex2rtf
+    OutputDir=c:\wx2dev\wxWindows\deliver
+
diff --git a/utils/tex2rtf/distrib/makeinno.bat b/utils/tex2rtf/distrib/makeinno.bat
new file mode 100755 (executable)
index 0000000..0f79892
--- /dev/null
@@ -0,0 +1,70 @@
+@echo off
+Rem Make an Inno Setup distribution list, where files and dirs are represented by
+Rem sections like this:
+Rem [Dirs]
+Rem     Name: {app}\backgrounds
+Rem 
+Rem [Files]
+Rem     Source: C:\dir\file.htm; DestDir: {app}\; DestName: file.htm
+
+set tex2rtf=%WXWIN%\utils\tex2rtf
+
+Rem Generate a list of all files in the distribution.
+Rem We have to be in the right directory already.
+dir /BS >& %TEMP%\files1.tmp
+
+Rem Now we iterate through the list of files, writing out the middle section of
+Rem the file.
+Rem We have to remove the first part of the path,
+Rem by truncating the start by the size of the current directory.
+
+set sz=%@EVAL[%@LEN[%_CWD]+1]
+set len=%@LINES[%TEMP\files1.tmp]
+
+erase /Y %TEMP\files2.tmp
+
+Rem Add directories
+echo. >> %temp\files2.tmp
+echo [Dirs] >> %temp\files2.tmp
+
+do i = 0 to %len by 1
+    set line=%@LINE[%TEMP\files1.tmp,%i]
+    Rem Skip files.
+    if not isdir %line enddo
+    set sz2=%@LEN[%line]
+    set n=%@EVAL[%sz2-%sz]
+    set line2=%@SUBSTR[%line,%sz,%n]
+    if "%line2%" == "" enddo
+
+    echo   Name: {app}\%line2 >> %TEMP\files2.tmp
+enddo
+
+echo. >>%TEMP\files2.tmp
+
+Rem Add files
+
+echo. >> %temp\files2.tmp
+echo [Files] >> %temp\files2.tmp
+
+do i = 0 to %len by 1
+    set line=%@LINE[%TEMP\files1.tmp,%i]
+    Rem Skip directories.
+    if isdir %line enddo
+    set sz2=%@LEN[%line]
+    set n=%@EVAL[%sz2-%sz]
+    set line2=%@SUBSTR[%line,%sz,%n]
+    set filename=%@FILENAME[%line2]
+    set dirname=%@PATH[%line2]
+
+    echo   Source: %line; DestDir: {app}\%dirname; DestName: %filename >> %TEMP\files2.tmp
+enddo
+
+Rem Concatenate the 3 sections
+cat %tex2rtf%\distrib\innotop.txt %TEMP%\files2.tmp %tex2rtf%\distrib\innobott.txt > %tex2rtf%\distrib\tex2rtf.iss
+
+erase /Y %TEMP\files1.tmp
+rem erase /Y %TEMP\files2.tmp
+
+goto end
+
+:end
diff --git a/utils/tex2rtf/distrib/src.rsp b/utils/tex2rtf/distrib/src.rsp
new file mode 100644 (file)
index 0000000..56eab56
--- /dev/null
@@ -0,0 +1,48 @@
+Makefile.in
+
+src/*.cpp
+src/*.h
+src/makefile.vc
+src/makefile.bcc
+src/makefile.dos
+src/makefile.b32
+src/makefile.wat
+src/makefile.unx
+src/makefile.vms
+src/makefile.g95
+src/makengui.nt
+src/Makefile.in
+src/*.dsp
+src/*.dsw
+src/*.xbm
+src/*.xpm
+src/*.sty
+src/*.ini
+lib/dummy
+src/*.bmp
+src/*.ico
+src/*.def
+src/*.rc
+
+tools/*.*
+
+distrib/*.sh
+distrib/*.bat
+distrib/*.txt
+distrib/*.rsp
+distrib/tex2rtf.exe.manifest
+
+docs/*.tex
+docs/*.sty
+docs/*.bib
+docs/*.hpj
+docs/*.ini
+docs/*.txt
+docs/*.cnt
+docs/*.eps
+docs/*.bmp
+docs/*.gif
+docs/*.wmf
+docs/*.shg
+docs/makefile.vc
+
diff --git a/utils/tex2rtf/distrib/tex2rtf.exe.manifest b/utils/tex2rtf/distrib/tex2rtf.exe.manifest
new file mode 100644 (file)
index 0000000..2c99061
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly
+   xmlns="urn:schemas-microsoft-com:asm.v1"
+   manifestVersion="1.0">
+<assemblyIdentity
+    processorArchitecture="x86"
+    version="5.1.0.0"
+    type="win32"
+    name="tex2rtf.exe"/>
+    <description>Foo program</description>
+    <dependency>
+    <dependentAssembly>
+    <assemblyIdentity
+         type="win32"
+         name="Microsoft.Windows.Common-Controls"
+         version="6.0.0.0"
+         publicKeyToken="6595b64144ccf1df"
+         language="*"
+         processorArchitecture="x86"/>
+    </dependentAssembly>
+    </dependency>
+</assembly>
+
diff --git a/utils/tex2rtf/distrib/tex2rtfversion.txt b/utils/tex2rtf/distrib/tex2rtfversion.txt
new file mode 100644 (file)
index 0000000..509b244
--- /dev/null
@@ -0,0 +1 @@
+2.01
\ No newline at end of file
diff --git a/utils/tex2rtf/distrib/zipdistinno.bat b/utils/tex2rtf/distrib/zipdistinno.bat
new file mode 100755 (executable)
index 0000000..1643306
--- /dev/null
@@ -0,0 +1,120 @@
+@echo off
+rem Zip up a distribution of Tex2RTF using Inno Setup.
+Rem This batch file requires the 4DOS/4NT command processor.
+set src=%WXWIN%\utils\tex2rtf
+set dest=%WXWIN%\deliver
+set inno=1
+set ReleaseDir=Release
+
+if "%src%" == "" goto usage
+if "%dest%" == "" goto usage
+
+if "%1" == "innoonly" set inno=1
+if "%1" == "innoonly" goto dounzip
+if "%1" == "inno" set inno=1
+
+echo About to archive Tex2RTF
+echo   From   %src%
+echo   To     %dest%
+echo CTRL-C if this is not correct.
+pause
+
+erase /E %dest%\tex2rtf.zip
+erase /E %dest%\tex2rtf_setup.exe
+erase /E %dest\tex2rtf_src.zip
+
+if direxist %dest%\tex2rtf erase /sxzy %dest%\tex2rtf\
+
+Rem *** First, determine version from symbols.h
+call ming2952
+echo `#include <stdio.h>` > tex2rtfver.c
+echo `#include "symbols.h"` >> tex2rtfver.c
+echo `int main() { printf("%.2f", TEX2RTF_VERSION_NUMBER); }` >> tex2rtfver.c
+gcc tex2rtfver.c -I%src%\src -o tex2rtfver.exe
+tex2rtfver.exe > tex2rtfversion.txt
+set ver=%@LINE[tex2rtfversion.txt,0]
+echo %ver%
+erase tex2rtfver.exe tex2rtfver.c
+set ver_filename=%ver%
+
+echo Updating docs...
+call msvc6
+
+pushd %src%\docs
+erase /Y tex2rtf_contents.html
+nmake -f makefile.vc htmlhelp htb
+popd
+
+cd %src%
+echo Zipping source...
+
+zip32 -@ %src%\tex2rtf_src.zip < %src%\distrib\src.rsp
+
+echo Adding files...
+
+copy %src%\src\%ReleaseDir%\tex2rtf.exe %src%
+copy %src%\docs\licence.txt %src%
+copy %src%\docs\lgpl.txt %src%
+copy %src%\docs\gpl.txt %src%
+copy %src%\docs\readme.txt %src%
+copy %src%\docs\tex2rtf.chm %src%
+copy %src%\distrib\tex2rtf.exe.manifest %src%
+copy %src%\tools\lacheck.exe %src%
+copy %src%\tools\lacheck.txt %src%
+Rem goto end
+
+upx %src%\tex2rtf.exe
+
+zip -@ %dest%\tex2rtf.zip < %src%\distrib\distrib.rsp
+zip -j -u %dest%\tex2rtf.zip %src%\tex2rtf.exe
+
+:dounzip
+
+cd %dest%
+
+mkdir tex2rtf
+cd tex2rtf
+unzip32 -o ..\tex2rtf.zip
+
+cd %dest%
+
+echo inno = %inno%
+
+Rem Skip Inno Setup setup if inno is 0.
+if "%inno%" == "0" goto end
+
+set tex2rtfver=%ver%
+
+echo ver is %ver%
+echo tex2rtfver is %tex2rtfver%
+
+echo Calling 'makeinno' to generate tex2rtf.iss...
+cd %dest%\tex2rtf
+call %src%\distrib\makeinno.bat
+
+sed -e "s/TEX2RTFVERSION/%tex2rtfver%/g" %src%\distrib\tex2rtf.iss > %TEMP%\tex2rtf.iss
+
+move %TEMP%\tex2rtf.iss %src%\distrib\tex2rtf.iss
+
+rem Now invoke Inno Setup install on the new tex2rtf.iss
+set innocmd="C:\Program Files\Inno Setup 2\compil32.exe" /cc %src%\distrib\tex2rtf.iss
+echo Invoking %innocmd%...
+cd %dest%
+start "Inno Setup" /w %innocmd%
+
+Rem Rename to give it a version
+move setup.exe tex2rtf_%ver_filename%_setup.exe
+
+Rem clean up files
+cd %src%
+erase /EFY *.bmp *.htm *.exe *.hlp *.cnt *.txt *.rtf *.doc *.gif *.jpg *.manifest *.chm
+
+cd %dest%
+
+echo Tex2RTF archived.
+goto end
+
+:usage
+echo Tex2RTF distribution.
+
+:end
diff --git a/utils/tex2rtf/distrib/zipsrc.bat b/utils/tex2rtf/distrib/zipsrc.bat
new file mode 100755 (executable)
index 0000000..ffab2d9
--- /dev/null
@@ -0,0 +1,28 @@
+@echo off
+rem Zip up a source distribution of Tex2RTF and associated apps.
+set src=c:\wx2dev\wxWindows\utils\tex2rtf
+set dest=%src\deliver
+if "%src" == "" goto usage
+if "%dest" == "" goto usage
+echo About to archive Tex2RTF
+echo   From   %src
+echo   To     %dest
+echo CTRL-C if this is not correct.
+pause
+
+erase %dest\tex2rtf_src.zip
+
+cd %src
+echo Zipping...
+
+zip32 -@ %dest\tex2rtf_src.zip < %src\tex2rtf\distrib\src.rsp
+
+cd %dest
+
+echo Tex2RTF source archived.
+goto end
+
+:usage
+echo Tex2RTF source distribution.
+
+:end
diff --git a/utils/tex2rtf/distrib/zipsrc.sh b/utils/tex2rtf/distrib/zipsrc.sh
new file mode 100644 (file)
index 0000000..7424217
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Zip up StoryLines source
+
+expandlines()
+{
+    toexpand=$1
+    outputfile=$2
+
+    rm -f $outputfile
+    touch $outputfile
+    for line in `cat $toexpand` ; do
+      if [ $line != "" ]; then
+        ls $line >> $outputfile
+      fi
+    done
+}
+
+CAFEDIR=$CAFE
+STDIR=$CAFE/storylines
+COMMONDIR=$CAFE/common
+
+cd $CAFE
+expandlines $STDIR/distrib/src.rsp temp.txt
+zip -@ $CAFEDIR/deliver/storylines_src.zip < temp.txt
+expandlines $CAFEDIR/distrib/src.rsp temp.txt
+zip -u -@ $CAFEDIR/deliver/storylines_src.zip < temp.txt
+rm temp.txt
diff --git a/utils/tex2rtf/docs/makefile.vc b/utils/tex2rtf/docs/makefile.vc
new file mode 100644 (file)
index 0000000..55c0d1a
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# File:                Makefile
+# Author:      Julian Smart
+# Created:     1999
+#
+# Makefile : Builds Tex2RTF manual
+#
+
+DOCDIR=..
+LOCALDOCDIR=.
+
+DOCSOURCES=tex2rtf.tex
+
+all: tex2rtf.chm tex2rtf.htb
+
+hlp: tex2rtf.hlp
+htb: tex2rtf.htb
+html: tex2rtf.html
+htmlhelp: tex2rtf.chm
+pdfrtf: tex2rtf_rtf.rtf
+
+tex2rtf.hlp:         tex2rtf.rtf tex2rtf.hpj
+        -erase tex2rtf.ph
+        hcw /E /C tex2rtf.hpj
+
+tex2rtf.chm : tex2rtf.html tex2rtf.hhp
+       -hhc tex2rtf.hhp
+
+tex2rtf_rtf.rtf: $(DOCSOURCES) tex2rtf.ini
+        -start /w tex2rtf tex2rtf.tex tex2rtf_rtf.rtf -twice -rtf
+
+tex2rtf.rtf: $(DOCSOURCES) tex2rtf.ini
+        -start /w tex2rtf tex2rtf.tex tex2rtf.rtf -twice -winhelp
+
+tex2rtf.html:         $(DOCSOURCES) tex2rtf.ini
+        -start /w tex2rtf tex2rtf.tex tex2rtf.html -twice -html
+        -erase *.con
+        -erase *.ref
+        -erase *.con
+        -erase *.ref
+
+tex2rtf.htb:         tex2rtf_contents.html
+        -zip32 tex2rtf.htb tex2rtf*.html *.hhp *.hhk *.hhc *.gif
+
index 6709d2eafc04d1bf941ec08271849b186138868c..d5c2afeacb2861c160491ad7c0fd95ce299bb484 100644 (file)
@@ -1,6 +1,6 @@
 
-+++++                      Announcing Tex2RTF                         +++++
-+++++  A Free LaTeX to RTF, Windows Help RTF, HTML & wxHelp converter +++++
++++++                    Announcing Tex2RTF                      +++++
++++++  A Free LaTeX to RTF, Windows Help RTF, and HTML converter +++++
 
 Purpose
 =======
@@ -32,7 +32,7 @@ Output
 
   *  HTML (the World Wide Web hypertext format)
 
-  *  wxHelp (the wxWindows GUI library help file format)
+  *  wxHTML Help (the wxWindows GUI library help file format)
 
 Installation
 ============
@@ -45,37 +45,34 @@ own documents. See the online manual for further details.
 Platforms supported
 ===================
 
-  *  SPARC Open Look
+  *  Windows (all 32-bit desktop versions)
 
-  *  SPARC Motif
+  *  Any Unix supporting wxWindows
 
-  *  Windows 3.1
+  *  Mac OS X
 
 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.
+The latest version of Tex2RTF can be accessed by anonymous ftp
+from:
 
-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.
+    ftp://biolpc22.york.ac.uk/pub/tex2rtf
 
+The WWW pages are at:
 
-------------------------------------------------------------------
-Julian Smart, November 1995
+    http://www.wxwindows.org/tex2rtf
 
-Artificial Intelligence Applications Institute
-University of Edinburgh
-80 South Bridge
-Edinburgh
-Scotland
-EH1 1HN
+Tex2RTF was developed using the free, cross-platform GUI toolkit
+wxWindows, at http://www.wxwindows.org. To compile Tex2RTF
+for platforms for which there are no Tex2RTF binaries,
+you need to download an appropriate version of wxWindows,
+configure and compile the library, then compile Tex2RTF
+in utils/tex2rtf/src.
 
-EMAIL: J.Smart@ed.ac.uk
-TEL:   0131 650 2746
+------------------------------------------------------------------
+Julian Smart, August 2002
+julian.smart@btopenworld.com
 
 
 
index f907369d52ca92553c4349c34d60e3fc0faf4de4..f17be8f2fe169d751c4824eef9c8a9bed40fb4db 100644 (file)
@@ -18,9 +18,13 @@ generateHPJ = yes
 ;;
 htmlWorkshopFiles = true
 htmlIndex = true
+
+; Finally, a way to specify face names
+htmlFaceName = "Arial, Lucida, Helvetica"
+
 htmlBrowseButtons = bitmap
-winHelpTitle = "Tex2RTF Manual"
-truncateFilenames = yes
+winHelpTitle = "Tex2RTF"
+truncateFilenames = no
 combineSubSections = yes
 htmlIndex = yes
 htmlFrameContents = no
index 5084b99a1d994717b7f5e564981b54708d6a9b07..18b448e46b88222f6b0d6aad586122e4ba2e8b1c 100644 (file)
@@ -219,6 +219,10 @@ SOURCE=.\rtfutils.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\symbols.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\table.cpp
 
 !IF  "$(CFG)" == "Tex2RTFVC - Win32 Release"
diff --git a/utils/tex2rtf/src/symbols.h b/utils/tex2rtf/src/symbols.h
new file mode 100644 (file)
index 0000000..8200137
--- /dev/null
@@ -0,0 +1,22 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        symbols.h
+// Purpose:     Tex2RTF symbols file
+// Author:      Julian Smart
+// Modified by:
+// Created:     2002-03-26
+// RCS-ID:      $Id$
+// Copyright:   (c) Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _TEX2RTF_SYMBOLS_H_
+#define _TEX2RTF_SYMBOLS_H_
+
+//// Build settings
+
+// ScriptTracks version
+#define TEX2RTF_VERSION_NUMBER            2.01
+
+#endif
+    // _TEX2RTF_SYMBOLS_H_
+
index a1d083811072c26b3c7b2d451af7129acced91f0..ba4c5507006465027c28e110f90418144c72aefd 100644 (file)
 #include "tex2any.h"
 #include "tex2rtf.h"
 #include "rtfutils.h"
+#include "symbols.h"
 
 #if (defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__)) && !defined(NO_GUI)
 #include "tex2rtf.xpm"
 #endif
 
-const float versionNo = 2.0;
+const float versionNo = TEX2RTF_VERSION_NUMBER;
 
 TexChunk *currentMember = NULL;
 bool startedSections = FALSE;
@@ -380,7 +381,7 @@ bool MyApp::OnInit()
     frame->SetMenuBar(menuBar);
     frame->textWindow = new wxTextCtrl(frame, -1, "", wxPoint(-1, -1), wxSize(-1, -1), wxTE_READONLY|wxTE_MULTILINE);
 
-    (*frame->textWindow) << "Welcome to Julian Smart's LaTeX to RTF converter.\n";
+    (*frame->textWindow) << "Welcome to Tex2RTF.\n";
 //    ShowOptions();
 
 #if wxUSE_HELP
@@ -829,7 +830,7 @@ void MyFrame::OnAbout(wxCommandEvent& event)
       char *platform = "";
 #endif
 #endif
-      sprintf(buf, "Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, HTML and wxHelp Conversion\n\n(c) Julian Smart 1999", versionNo, platform);
+      sprintf(buf, "Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2002", versionNo, platform);
       wxMessageBox(buf, "About Tex2RTF");
 }
 
diff --git a/utils/tex2rtf/tools/lacheck.1 b/utils/tex2rtf/tools/lacheck.1
new file mode 100644 (file)
index 0000000..1d4b1c8
--- /dev/null
@@ -0,0 +1,86 @@
+.TH "LaCheck" "1" "May 23, 1991"
+.SH NAME
+lacheck - A consistency checker for LaTeX documents.
+.SH SYNOPSIS
+.B "lacheck "
+.I "filename"
+[
+.I .tex
+]
+.SH DESCRIPTION
+lacheck is a general purpose consistency checker for LaTeX documents.
+It reads a LaTeX document and displays warning messages, if it finds
+bad sequences. It should be noted, that the badness is 
+.I "very "
+subjective.
+.LP
+The things checked are:
+.LP
+Mismatched groups (braces), environments and math mode
+delimiters.  When a mismatch is found, line numbers for
+.I "both" 
+start and end of the mismatch is given. The error messages comes in
+pairs, one for the end match and one for the beginning, marked with
+\`<-\' and \`->\' respectively.
+.LP
+Bad spacing. This is: missing a \`\\ \' after an abbreviation, missing
+an \`\\@\' before a punctuation mark in a paragraph that is ended by an
+capital letter, double spaces like \` \~\', bad usage of ellipsis
+(like using ... instead of \\ldots, or using \\ldots where \\cdots
+should be used)
+.LP
+lacheck will read files that are input using \\input or \\include.
+Files with suffix \`.sty\' are omitted, as they probably will cause
+errors.
+.LP 
+lacheck may be invoked from within Emacs(1) using compile:
+
+To run:  
+.B "M-x compile <ret>"
+, and then 
+.B "C-x `"
+to parse the messages
+
+.SH OUTPUT
+The output is UNIX-error like, and may be parsed using Emacs(1)
+compile mode. Here is a sample:
+
+.PD 0
+lacheck compiler
+.TP
+"/usr/mef/compiler.tex", line 34: missing \`\\\\\\\\ \' after "etc."
+.TP
+"/usr/mef/compiler.tex", line 179: double space at " ~"
+.TP
+"/usr/mef/compiler.tex", line 186: <- unmatched "}"
+.TP
+"/usr/mef/compiler.tex", line 181: -> unmatched "$$"
+.PD 1
+.LP
+A control space \`\\ \' should be inserted at line 34, to prevent an
+end-of-sentence space. 
+Also, at line 179, the first space of the sequence " ~" should
+probably be deleted.
+The last two lines is an example, where the user mistyped, and
+probably inserted an extra "}" somewhere.
+
+.SH DIAGNOSTICS
+Some special cases should be explained. In cases where a sentence ends
+with something that lacheck thinks is an abbreviation an missing \`\\
+\' error may also occur, if the following sentence begins with a
+capital letter.
+.LP
+A mismatch error may cause more to follow, due to the chosen
+algorithm. In such cases just correct the
+.I "first"
+error and run lacheck again
+.LP
+Braces, environments and math mode must be balanced within a file.
+.SH SEE ALSO
+tex(1), Emacs(1), latex(1)
+.SH BUGS
+Lots... Ideas for improvements and bug reports are very welcome. 
+Such should be
+directed to the author.
+.SH AUTHOR
+Kresten Krab Thorup,  Email <krab@iesd.auc.dk>
diff --git a/utils/tex2rtf/tools/lacheck.exe b/utils/tex2rtf/tools/lacheck.exe
new file mode 100755 (executable)
index 0000000..ba08d0a
Binary files /dev/null and b/utils/tex2rtf/tools/lacheck.exe differ
diff --git a/utils/tex2rtf/tools/lacheck.lex b/utils/tex2rtf/tools/lacheck.lex
new file mode 100644 (file)
index 0000000..e2ca8f4
--- /dev/null
@@ -0,0 +1,812 @@
+/*                    -*- Mode: C -*- 
+ * 
+ * lacheck.lex - A consistency checker checker for LaTeX documents
+ * 
+ * Copyright (C) 1991 Kresten Krab Thorup (krab@iesd.auc.dk).
+ * 
+ * $Locker$
+ * $Revision$
+ * Author          : Kresten Krab Thorup
+ * Created On      : Sun May 26 18:11:58 1991
+ * Last Modified By: Kresten Krab Thorup
+ * Last Modified On: Thu May 30 02:29:57 1991
+ * Update Count    : 16
+ * 
+ * HISTORY
+ * 30-May-1991  (Last Mod: Thu May 30 02:22:33 1991 #15)  Kresten Krab Thorup
+ *    Added check for `$${punct}' and `{punct}$' constructions
+ * 30-May-1991  (Last Mod: Wed May 29 10:31:35 1991 #6)  Kresten Krab Thorup
+ *    Improved (dynamical) stack management from Andreas Stolcke ...
+ *                                       <stolcke@ICSI.Berkeley.EDU> 
+ * 26-May-1991  Kresten Krab Thorup
+ *    Initial distribution version.
+ */
+%{
+#include <stdio.h>
+#include <string.h>
+#include <sys/param.h>
+
+extern char *realloc();
+
+#ifdef NEED_STRSTR
+char *strstr();
+#endif
+
+#define GROUP_STACK_SIZE 10
+#define INPUT_STACK_SIZE 10
+
+#define PROGNAME "LaCheck"
+
+  /* macros */
+
+#define CG_NAME gstack[gstackp-1].s_name
+#define CG_TYPE gstack[gstackp-1].s_type
+#define CG_LINE gstack[gstackp-1].s_line
+#define CG_FILE gstack[gstackp-1].s_file
+
+char *bg_command();
+void pop();
+void push();
+void g_checkend();
+void e_checkend();
+void f_checkend();
+void input_file();
+void print_bad_match();
+int check_top_level_end();
+
+  /* global variables */
+
+char returnval[100];
+int line_count = 1;
+int warn_count = 0;
+char *file_name;
+char verb_char;
+
+  /* the group stack */
+
+typedef struct tex_group 
+ {
+    unsigned char *s_name;
+    int s_type;
+    int s_line;
+    char *s_file; 
+ } tex_group;
+
+tex_group *gstack;
+int gstack_size = GROUP_STACK_SIZE;
+int gstackp = 0;
+
+typedef struct input_ 
+ {
+    YY_BUFFER_STATE stream;
+    char *name;
+    int linenum;
+ } input_;
+
+input_ *istack;
+int istack_size = INPUT_STACK_SIZE;
+int istackp = 0;
+
+int def_count = 0;
+
+%}
+
+%x B_ENVIRONMENT E_ENVIRONMENT VERBATIM INCLUDE MATH COMMENT VERB DEF
+%x AFTER_DISPLAY
+
+b_group ("{"|\\bgroup)
+e_group ("}"|\\egroup)
+
+b_math \\\(
+e_math \\\)
+math \$
+
+b_display \\\[
+e_display \\\]
+display \$\$
+
+non_par_ws ([ \t]+\n?[ \t]*|[ \t]*\n[ \t]*|[ \t]*\n?[ \t]+)
+
+ws [ \n\t]
+space ({ws}|\~|\\space)
+hard_space (\~|\\space)
+
+u_letter [A-ZFXE] 
+l_letter [a-zfxe] 
+punct [\!\.\?]
+atoz [a-zA-Z]
+letter (u_letter|l_letter)
+
+c_bin ("-"|"+"|"\\cdot"|"\\oplus"|"\\otimes"|"\\times")
+l_bin (",")
+
+general_abbrev {letter}+{punct}
+
+non_abbrev {u_letter}{u_letter}+{punct}
+
+font_spec (rm|bf|sl|it|tt|em|mediumseries|normalshape)
+
+primitive \\(above|advance|catcode|chardef|closein|closeout|copy|count|countdef|cr|crcr|csname|delcode|dimendef|dimen|divide|expandafter|font|hskp|vskip|openout)
+
+symbol ("$"("\\"{atoz}+|.)"$"|"\\#"|"\\$"|"\\%"|"\\ref")
+
+%%
+
+"\\\\" { ; }
+
+<DEF,INITIAL>"\\\%" { ; }
+
+<DEF,INITIAL>"%"[^\n]* { ; }
+
+<DEF,INITIAL>\n        { line_count++; }
+
+<DEF,INITIAL>"\\\{" { ; }
+
+<DEF,INITIAL>"\\\}" { ; }
+
+"\\\$" { ; }
+
+{b_group} {  push( "{", 0, line_count);}
+
+{e_group} {  g_checkend(0); }
+
+"\\"[exg]?def[^\{]     BEGIN(DEF);
+
+<DEF>{b_group} { ++def_count; }
+
+<DEF>{e_group} { --def_count;
+                if(def_count == 0)
+                    BEGIN(INITIAL); }
+
+<DEF>. { ; }
+
+{b_math} {
+    if(CG_TYPE == 4 || CG_TYPE == 5)
+       print_bad_match(yytext,4);
+    else
+    {
+       push( yytext, 4, line_count);
+    }}
+
+{e_math} {  g_checkend(4); }
+
+{b_display} {
+    if(CG_TYPE == 4 || CG_TYPE == 5)
+       print_bad_match(yytext,5);
+    else 
+    {
+       push( yytext, 5, line_count);
+    }}
+
+
+{e_display} {  g_checkend(5);
+              BEGIN(AFTER_DISPLAY);}
+
+<AFTER_DISPLAY>{punct} { 
+
+    printf( "\"%s\", line %d: puctation mark \"%s\" should be placed before end of displaymath\n", 
+          file_name, line_count, yytext); 
+    ++warn_count ; 
+
+  BEGIN(INITIAL); }
+
+<AFTER_DISPLAY>. {  BEGIN(INITIAL); }
+
+<AFTER_DISPLAY>\n {    ++line_count; 
+                       BEGIN(INITIAL); }
+
+{punct}/("\$"|"\\)") { if (CG_TYPE == 4)
+       {
+        printf( "\"%s\", line %d: puctation mark \"%s\" should be placed after end of math mode\n", 
+               file_name, line_count, yytext); 
+        ++warn_count ;
+       }}
+
+{math} {
+
+    if(CG_TYPE == 5)
+       print_bad_match(yytext, 4);
+    else 
+
+    if(CG_TYPE == 4)
+    {
+       e_checkend(4, yytext);
+    }
+    else
+    {
+       push( yytext, 4, line_count); 
+    }}
+
+
+{display}  {
+
+    if(CG_TYPE == 4)
+       print_bad_match(yytext,5);
+    else 
+
+    if(CG_TYPE == 5)
+    {
+       e_checkend(5, yytext);
+        BEGIN(AFTER_DISPLAY);
+    }
+    else
+    {
+       push( yytext, 5, line_count);
+    }}
+
+\\begingroup/[^a-zA-Z]  {
+ {
+    push((unsigned char *)"\\begingroup", 1, line_count); 
+ }}
+
+
+\\endgroup/[^a-zA-Z]  {
+ {
+    g_checkend(1);
+ }}
+
+
+\\begin[ \t]*"{" { BEGIN(B_ENVIRONMENT); }
+
+\\begin[ \t]*/\n { 
+ {
+    
+    printf("\"%s\", line %i: {argument} missing for \\begin\n",
+          file_name, line_count) ;
+    ++warn_count;
+ }}
+
+<B_ENVIRONMENT>[^\}\n]+ { 
+ {
+    if (strcmp( yytext, "verbatim" ) == 0 )
+       {
+        input();
+        BEGIN(VERBATIM);
+       }
+    else
+       {
+        push(yytext, 2, line_count);
+        input();
+        BEGIN(INITIAL);
+       }
+ }}
+
+<VERBATIM>\\end[ \t]*\{verbatim\} { BEGIN(INITIAL); }
+
+<VERBATIM>. { ; }
+
+<VERBATIM>\n { ++line_count; }
+
+
+\\verb.        { 
+         sscanf (yytext, "\\verb%c", &verb_char  ); 
+         BEGIN(VERB); 
+       }
+
+<VERB>. {
+               if ( *yytext == verb_char )
+                 BEGIN(INITIAL); 
+               if ( *yytext == '\n' )
+                 ++line_count;
+       } 
+
+
+\\end[ \t]*"{" { BEGIN(E_ENVIRONMENT); }
+
+\\end[ \t]*/\n { 
+ {
+    printf("\"%s\", line %i: {argument} missing for \\end\n",
+          file_name, line_count) ;
+    ++warn_count;
+ }}
+
+
+<E_ENVIRONMENT>[^\}\n]+ { 
+ {
+    e_checkend(2, yytext);
+    input();
+    
+    BEGIN(INITIAL);
+ }}
+
+
+{ws}([a-zfxe]".")*[a-zA-ZfxeFXE]*[a-zfxe]"."/{non_par_ws}+[a-zfxe]    { 
+ {
+    if ( *yytext == '\n' )
+               ++line_count; 
+
+    printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", 
+          file_name, line_count, ++yytext); 
+    ++warn_count ; 
+ }}
+
+([a-zfxe]".")*[a-zA-ZfxeFXE]*[a-zfxe]"."/{non_par_ws}+[a-zfxe]    { 
+ {
+    printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", 
+          file_name, line_count, yytext); 
+    ++warn_count ; 
+ }}
+
+{ws}{non_abbrev}/{non_par_ws}{u_letter}   { 
+ {
+    if ( *yytext == '\n' )
+       ++line_count;
+    printf("\"%s\", line %d: missing `\\\@' before punctation mark in \"%s\"\n", 
+          file_name, line_count, ++yytext); 
+    ++warn_count ; 
+ }}
+
+{non_abbrev}/{non_par_ws}{u_letter}   { 
+ {
+    printf("\"%s\", line %d: missing `\\\@' before `.' in \"%s\"\n", 
+          file_name, line_count, yytext); 
+    ++warn_count ; 
+ }}
+
+({hard_space}{space}|{space}{hard_space})  { 
+
+    printf("\"%s\", line %d: double space at \"%s\"\n",
+          file_name, line_count, yytext); 
+    ++warn_count;
+  }
+
+{c_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?\\ldots{ws}?(\\(\.|\,|\;|\:))*{ws}?{c_bin} {
+       printf("\"%s\", line %d: \\ldots should be \\cdots in \"%s\"\n",
+          file_name, line_count, yytext); 
+       ++warn_count;
+  }
+
+[^\\]{l_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?\\cdots{ws}?(\\(\.|\,|\;|\:))*{ws}?[^\\]{l_bin} {
+       printf("\"%s\", line %d: \\cdots should be \\ldots in \"%s\"\n",
+          file_name, line_count, yytext); 
+       ++warn_count;
+  }
+
+{c_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?"."+{ws}?(\\(\.|\,|\;|\:))*{ws}?{c_bin} {
+       printf("\"%s\", line %d: Dots should be \\cdots in \"%s\"\n",
+          file_name, line_count, yytext); 
+       ++warn_count;
+  }
+
+[^\\]{l_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?"."+{ws}?(\\(\.|\,|\;|\:))*{ws}?[^\\]{l_bin} {
+       printf("\"%s\", line %d: Dots should be \\ldots in \"%s\"\n",
+          file_name, line_count, yytext); 
+       ++warn_count;
+  }
+
+
+\.\.\. { 
+    printf("\"%s\", line %d: Dots should be ellipsis \"%s\"\n",
+          file_name, line_count, yytext); 
+    ++warn_count;
+  }
+
+ /*
+ *
+ *  The `~' one is not too good, perhaps it shoud be an option.
+ *
+ */
+ /*
+ {l_letter}" "{symbol}  {
+
+    printf("\"%s\", line %d: perhaps you should insert a `~' before%s\n",
+          file_name, line_count, ++yytext); 
+  }
+ */
+ /*
+ {primitive}/[^a-zA-Z] {
+ {
+    printf("\"%s\", line %d: Don't use \"%s\" in LaTeX documents\n", 
+          file_name, line_count, yytext); 
+    ++warn_count ; 
+ }}    
+ */
+
+\\{font_spec}/[ \t]*"{" { 
+ {
+    printf("\"%s\", line %d: Fontspecifiers don't take arguments. \"%s\"\n", 
+          file_name, line_count, yytext); 
+    ++warn_count; 
+  /*    (void) input(); */
+ }}
+
+
+\\([a-zA-Z\@]+\@[a-zA-Z\@]*|[a-zA-Z\@]*\@[a-zA-Z\@]+) { 
+ {
+    printf("\"%s\", line %d: Do not use @ in LaTeX macro names. \"%s\"\n", 
+          file_name, line_count, yytext); 
+    ++warn_count; 
+ }}
+
+
+"%"  { BEGIN(COMMENT); }
+
+<COMMENT>\n    { BEGIN(INITIAL); ++line_count; }
+
+<COMMENT>.     { ; }
+
+
+\\(input|include)([ \t]|"{")   { BEGIN(INCLUDE); }
+
+<INCLUDE>[^\}\n]+      {
+ {
+       if ( strstr(yytext,"\.sty") == NULL )
+       {
+               input_file(yytext);
+       }
+       else
+       {
+               printf("\"%s\", line %d: Style file \`%s\' omitted.\n",
+                       file_name,
+                       line_count,
+                       yytext);
+               input();
+       }
+       BEGIN(INITIAL);
+ }}
+
+<<EOF>> { 
+         if (--istackp < 0)
+                 yyterminate(); 
+
+         else
+               { 
+                 fclose(yyin);
+                 f_checkend(file_name);
+                 yy_switch_to_buffer(istack[istackp].stream);
+                 free(file_name);
+                 line_count = istack[istackp].linenum;
+                 file_name = istack[istackp].name;
+                 input();
+                 BEGIN(INITIAL);
+               }       
+        
+       }
+
+
+. { ; }
+%%
+int main( argc, argv )
+int argc;
+char *argv[];
+{
+    /* allocate initial stacks */
+    gstack = (tex_group *)malloc(gstack_size * sizeof(tex_group));
+    istack = (input_ *)malloc(istack_size * sizeof(input_));
+    if ( gstack == NULL || istack == NULL ) {
+       fprintf(stderr, "%s: not enough memory for stacks\n", PROGNAME);
+       exit(3);
+    }
+       
+    if(argc > 1)
+    {
+        if ( (file_name = malloc(strlen(argv[1]) + 5)) == NULL ) {
+               fprintf(stderr, "%s: out of memory\n", PROGNAME);
+               exit(3);
+       }
+       
+       strcpy(file_name, argv[1]);
+       
+       if ((yyin = fopen( file_name, "r")) != NULL )
+       {
+           push(file_name, 3, 1);
+           yylex();
+           f_checkend(file_name);
+       }
+       else {   
+                strcat(file_name, ".tex" );
+                if ((yyin = fopen( file_name, "r")) != NULL )
+                {
+                    push(file_name, 3, 1);
+                    yylex();
+                    f_checkend(file_name);
+                }
+                else
+                    fprintf(stderr,
+                               "%s: Could not open : %s\n",PROGNAME, argv[1]);
+            }
+    }
+    else
+    {
+       printf("\n* %s *\n\n",PROGNAME);
+       printf("\t...a consistency checker for LaTeX documents.\n\n");
+
+       printf("Usage:\n\tlacheck filename[.tex] <return>\n\n\n");
+
+       printf("\tFrom within Emacs:\n\n\t");
+       printf("M-x compile <return>\n\tlacheck filename[.tex] <return>");
+       printf("\n\n\tUse C-x ` to step through the messages.\n\n");
+       printf("\n\tThe found context is displayed in \"double quotes\"\n\n");
+       printf("Remark:\n\tAll messages are only warnings!\n\n");
+       printf("\tYour document may be right though LaCheck tells\n");
+       printf("\tsomthing else.\n\n");
+    }
+    return(0);
+}
+
+#ifdef NEED_STRSTR
+char *
+strstr(string, substring)
+    register char *string;     /* String to search. */
+    char *substring;           /* Substring to try to find in string. */
+{
+    register char *a, *b;
+
+    /* First scan quickly through the two strings looking for a
+     * single-character match.  When it's found, then compare the
+     * rest of the substring.
+     */
+
+    b = substring;
+    if (*b == 0) {
+       return string;
+    }
+    for ( ; *string != 0; string += 1) {
+       if (*string != *b) {
+           continue;
+       }
+       a = string;
+       while (1) {
+           if (*b == 0) {
+               return string;
+           }
+           if (*a++ != *b++) {
+               break;
+           }
+       }
+       b = substring;
+    }
+    return (char *) 0;
+}
+#endif /* NEED_STRSTR */
+
+void push(p_name, p_type, p_line)
+unsigned char *p_name;
+int p_type;
+int p_line;
+{
+    if ( gstackp == gstack_size ) {    /* extend stack */
+       gstack_size *= 2;
+       gstack = (tex_group *)realloc(gstack, gstack_size * sizeof(tex_group));
+       if ( gstack == NULL ) {
+               fprintf(stderr, "%s: stack out of memory", PROGNAME);
+       exit(3);
+    }
+    }
+    
+    if ( (gstack[gstackp].s_name =
+               (unsigned char *)malloc(strlen(p_name) + 1)) == NULL ||
+         (gstack[gstackp].s_file =
+               (char *)malloc(strlen(file_name) + 1)) == NULL ) {
+       fprintf(stderr, "%s: out of memory\n", PROGNAME);
+       exit(3);
+    }
+
+    strcpy(gstack[gstackp].s_name,p_name);
+    gstack[gstackp].s_type = p_type;
+    gstack[gstackp].s_line = p_line;   
+    strcpy(gstack[gstackp].s_file,file_name);
+    ++gstackp; 
+
+}
+
+void input_file(file_nam)
+char *file_nam;
+{
+    char *tmp_file_name;
+    FILE *tmp_yyin;
+
+    if ( (tmp_file_name = malloc(strlen(file_nam) + 5)) == NULL ) {
+       fprintf(stderr, "%s: out of memory\n", PROGNAME);
+       exit(3);
+    }
+    strcpy(tmp_file_name,file_nam);
+
+    if (istackp == istack_size) {      /* extend stack */
+       istack_size *= 2;
+       istack = (input_ *)realloc(istack, istack_size * sizeof(input_));
+       if ( istack == NULL ) {
+               fprintf(stderr, "%s: \\input stack out of memory\n", PROGNAME);
+       exit(3);
+        } 
+    } 
+       
+    istack[istackp].stream = YY_CURRENT_BUFFER;
+    istack[istackp].linenum = line_count;
+    istack[istackp].name = file_name;
+    ++istackp;    
+
+    if ((tmp_yyin = fopen( file_nam, "r")) != NULL )
+       {
+         yyin = tmp_yyin;
+         yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
+         file_name = tmp_file_name;
+         push(file_name, 3, 1);
+          line_count = 1;
+       }
+    else {
+         (void) strcat(tmp_file_name, ".tex");
+         if ((tmp_yyin = fopen( tmp_file_name , "r")) != NULL )
+           {
+               yyin = tmp_yyin;
+               yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
+               file_name = tmp_file_name;
+               push(file_name, 3, 1);
+               line_count = 1;
+           }
+          else
+         {
+              --istackp;
+              fclose(tmp_yyin);
+              free(tmp_file_name);
+              printf("\"%s\", line %d: Could not open \"%s\"\n", 
+                       file_name,
+                       line_count,
+                       file_nam);
+              input();
+         }
+        }
+}
+
+void pop()
+{
+    if ( gstackp == 0 )
+    {
+               fprintf(stderr, "%s: Stack underflow\n", PROGNAME);
+       exit(4);
+    }
+    --gstackp;
+
+    free(gstack[gstackp].s_name);
+    free(gstack[gstackp].s_file);
+}
+
+char *bg_command(name)
+char *name;
+{
+    
+    switch (CG_TYPE) {
+       
+    case 2:
+       (void) strcpy( returnval, "\\begin\{" );
+       (void) strcat( returnval, (char *) name);
+       (void) strcat( returnval, "}" );
+       break;
+       
+    case 3:
+       (void) strcpy( returnval, "beginning of file " );
+       (void) strcat( returnval, (char *) name);
+       break;
+    
+    case 4:
+       (void) strcpy( returnval, "math begin " );
+       (void) strcat( returnval, (char *) name);
+       break;
+    
+    case 5:
+       (void) strcpy( returnval, "display math begin " );
+       (void) strcat( returnval, (char *) name);
+       break;
+    
+    default:
+       (void) strcpy( returnval, name );
+       
+    }
+    
+    return ((char *)returnval);
+}
+
+char *eg_command(name,type)
+int type;
+char *name;
+{
+    
+    switch (type) {
+       
+    case 2:
+       (void) strcpy( returnval, "\\end{" );
+       (void) strcat( returnval, (char *) name);
+       (void) strcat( returnval, "}" );
+       break;
+       
+    case 3:
+       (void) strcpy( returnval, "end of file " );
+       (void) strcat( returnval, (char *) name);
+       break;
+    
+    case 4:
+       (void) strcpy( returnval, "math end " );
+       (void) strcat( returnval, (char *) name);
+       break;
+    
+    case 5:
+       (void) strcpy( returnval, "display math end " );
+       (void) strcat( returnval, (char *) name);
+       break;
+    
+    default:
+       (void) strcpy( returnval, name );
+       break;
+    }
+    
+    return ((char *)returnval);
+}
+
+
+void g_checkend(n)
+int n;
+{
+    if ( check_top_level_end(yytext,n) == 1 ) 
+       if (  CG_TYPE != n  )
+        print_bad_match(yytext,n);
+       else
+       pop();
+}
+
+void e_checkend(n, name)
+int n;
+char *name;
+{
+   if ( check_top_level_end(name,n) == 1 )
+    {
+     if (  CG_TYPE != n  ||  strcmp( CG_NAME, name ) != 0 )
+       print_bad_match(name,n);
+
+     pop();
+
+    }
+}
+
+void f_checkend(name)
+char *name;
+{
+    if ( check_top_level_end(name,3) == 1 )
+     {
+       if (  CG_TYPE != 3  ||  strcmp( CG_NAME, name ) != 0 )
+
+       while( CG_TYPE != 3  )
+       {
+         print_bad_match(name,3);
+          pop();
+        }
+
+         pop();  
+     }
+}
+
+void print_bad_match(end_command,type)
+char *end_command;           
+int type;
+{
+         printf("\"%s\", line %i: <- unmatched \"%s\"\n",
+                file_name, 
+                line_count, 
+                eg_command( end_command , type) ) ;
+
+         printf("\"%s\", line %i: -> unmatched \"%s\"\n",
+                CG_FILE, 
+                CG_LINE, 
+                bg_command( CG_NAME ) ) ;
+         warn_count += 2;
+}
+
+int check_top_level_end(end_command,type)
+char *end_command;           
+int type;
+{
+    if ( gstackp == 0 )
+       {
+        printf("\"%s\", line %i: \"%s\" found at top level\n",
+              file_name, 
+              line_count, 
+              eg_command( end_command, type )) ;
+        ++warn_count;
+         return(0);
+       }
+    else
+       return(1);
+}
+
+
+
diff --git a/utils/tex2rtf/tools/lacheck.rea b/utils/tex2rtf/tools/lacheck.rea
new file mode 100644 (file)
index 0000000..8970e87
--- /dev/null
@@ -0,0 +1,9 @@
+To compile, do as folows:
+
+       flex -8 lacheck.lex
+       cc lex.yy.c -ll -O -o lacheck
+
+This should make a executable file called lacheck.
+Further documentation is in the manualpage.
+
+/Kresten
diff --git a/utils/tex2rtf/tools/lacheck.txt b/utils/tex2rtf/tools/lacheck.txt
new file mode 100644 (file)
index 0000000..c844bc9
--- /dev/null
@@ -0,0 +1,136 @@
+
+
+LaCheck(1)                 Unix Programmer's Manual                 LaCheck(1)
+
+
+NAME
+     lacheck - A consistency checker for LaTeX documents.
+
+SYNOPSIS
+     lacheck filename [ .tex ]
+             --------    ---
+
+DESCRIPTION
+     lacheck is a general purpose consistency checker for LaTeX documents.  It
+     reads  a  LaTeX  document  and displays warning messages, if it finds bad
+     sequences. It should be noted, that the badness is very subjective.
+                                                        ----
+
+     The things checked are:
+
+     Mismatched groups (braces), environments and math mode delimiters.   When
+     a  mismatch is found, line numbers for both start and end of the mismatch
+                                            ----
+     is given. The error messages comes in pairs, one for the  end  match  and
+     one for the beginning, marked with `<-' and `->' respectively.
+
+     Bad spacing. This is: missing a `\ ' after an  abbreviation,  missing  an
+     `\@' before a punctuation mark in a paragraph that is ended by an capital
+     letter, double spaces like ` \~', bad usage of ellipsis (like  using  ...
+     instead of \ldots, or using \ldots where \cdots should be used)
+
+     lacheck will read files that are input using \input or  \include.   Files
+     with suffix `.sty' are omitted, as they probably will cause errors.
+
+     lacheck may be invoked from within Emacs(1) using compile:
+
+     To run: M-x compile <ret> , and then C-x ` to parse the messages
+
+
+OUTPUT
+     The output is UNIX-error like, and may be parsed using  Emacs(1)  compile
+     mode. Here is a sample:
+
+     lacheck compiler
+     "/usr/mef/compiler.tex", line 34: missing `\\\\ ' after "etc."
+     "/usr/mef/compiler.tex", line 179: double space at " ~"
+     "/usr/mef/compiler.tex", line 186: <- unmatched "}"
+     "/usr/mef/compiler.tex", line 181: -> unmatched "$$"
+
+     A control space `\ ' should be inserted at line 34, to prevent an end-of-
+     sentence  space.  Also, at line 179, the first space of the sequence " ~"
+     should probably be deleted.  The last two lines is an example, where  the
+     user mistyped, and probably inserted an extra "}" somewhere.
+
+
+DIAGNOSTICS
+     Some special cases should be explained. In cases where  a  sentence  ends
+     with  something  that  lacheck  thinks is an abbreviation an missing `\ '
+     error may also occur, if the following sentence  begins  with  a  capital
+     letter.
+
+     A mismatch error may cause more to follow, due to the  chosen  algorithm.
+     In such cases just correct the first error and run lacheck again
+                                    -----
+
+
+
+                                May 23, 1991                                 1
+
+
+\f
+
+LaCheck(1)                 Unix Programmer's Manual                 LaCheck(1)
+
+
+     Braces, environments and math mode must be balanced within a file.
+
+SEE ALSO
+     tex(1), Emacs(1), latex(1)
+
+BUGS
+     Lots... Ideas for improvements and bug reports  are  very  welcome.  Such
+     should be directed to the author.
+
+AUTHOR
+     Kresten Krab Thorup,  Email <krab@iesd.auc.dk>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                                May 23, 1991                                 2
+
+