From 56d349220fcb31e4fd8f43278c2ef169d1eb2ece Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 7 Aug 2002 09:56:23 +0000 Subject: [PATCH] Added files for creating independent Tex2RTF distributions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/tex2rtf/distrib/distrib.rsp | 25 + utils/tex2rtf/distrib/innobott.txt | 38 + utils/tex2rtf/distrib/innotop.txt | 47 ++ utils/tex2rtf/distrib/makeinno.bat | 70 ++ utils/tex2rtf/distrib/src.rsp | 48 ++ utils/tex2rtf/distrib/tex2rtf.exe.manifest | 23 + utils/tex2rtf/distrib/tex2rtfversion.txt | 1 + utils/tex2rtf/distrib/zipdistinno.bat | 120 +++ utils/tex2rtf/distrib/zipsrc.bat | 28 + utils/tex2rtf/distrib/zipsrc.sh | 27 + utils/tex2rtf/docs/makefile.vc | 44 ++ utils/tex2rtf/docs/readme.txt | 43 +- utils/tex2rtf/docs/tex2rtf.ini | 8 +- utils/tex2rtf/src/Tex2RTFVC.dsp | 4 + utils/tex2rtf/src/symbols.h | 22 + utils/tex2rtf/src/tex2rtf.cpp | 7 +- utils/tex2rtf/tools/lacheck.1 | 86 +++ utils/tex2rtf/tools/lacheck.exe | Bin 0 -> 27231 bytes utils/tex2rtf/tools/lacheck.lex | 812 +++++++++++++++++++++ utils/tex2rtf/tools/lacheck.rea | 9 + utils/tex2rtf/tools/lacheck.txt | 136 ++++ 21 files changed, 1570 insertions(+), 28 deletions(-) create mode 100644 utils/tex2rtf/distrib/distrib.rsp create mode 100644 utils/tex2rtf/distrib/innobott.txt create mode 100644 utils/tex2rtf/distrib/innotop.txt create mode 100755 utils/tex2rtf/distrib/makeinno.bat create mode 100644 utils/tex2rtf/distrib/src.rsp create mode 100644 utils/tex2rtf/distrib/tex2rtf.exe.manifest create mode 100644 utils/tex2rtf/distrib/tex2rtfversion.txt create mode 100755 utils/tex2rtf/distrib/zipdistinno.bat create mode 100755 utils/tex2rtf/distrib/zipsrc.bat create mode 100644 utils/tex2rtf/distrib/zipsrc.sh create mode 100644 utils/tex2rtf/docs/makefile.vc create mode 100644 utils/tex2rtf/src/symbols.h create mode 100644 utils/tex2rtf/tools/lacheck.1 create mode 100755 utils/tex2rtf/tools/lacheck.exe create mode 100644 utils/tex2rtf/tools/lacheck.lex create mode 100644 utils/tex2rtf/tools/lacheck.rea create mode 100644 utils/tex2rtf/tools/lacheck.txt diff --git a/utils/tex2rtf/distrib/distrib.rsp b/utils/tex2rtf/distrib/distrib.rsp new file mode 100644 index 0000000000..2d3c53e813 --- /dev/null +++ b/utils/tex2rtf/distrib/distrib.rsp @@ -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 index 0000000000..e33a761ca3 --- /dev/null +++ b/utils/tex2rtf/distrib/innobott.txt @@ -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 index 0000000000..1a26b5fa19 --- /dev/null +++ b/utils/tex2rtf/distrib/innotop.txt @@ -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 index 0000000000..0f79892e8a --- /dev/null +++ b/utils/tex2rtf/distrib/makeinno.bat @@ -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 index 0000000000..56eab56a5d --- /dev/null +++ b/utils/tex2rtf/distrib/src.rsp @@ -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 index 0000000000..2c990612bb --- /dev/null +++ b/utils/tex2rtf/distrib/tex2rtf.exe.manifest @@ -0,0 +1,23 @@ + + + + Foo program + + + + + + + diff --git a/utils/tex2rtf/distrib/tex2rtfversion.txt b/utils/tex2rtf/distrib/tex2rtfversion.txt new file mode 100644 index 0000000000..509b24471b --- /dev/null +++ b/utils/tex2rtf/distrib/tex2rtfversion.txt @@ -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 index 0000000000..1643306ce7 --- /dev/null +++ b/utils/tex2rtf/distrib/zipdistinno.bat @@ -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 ` > 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 index 0000000000..ffab2d97ed --- /dev/null +++ b/utils/tex2rtf/distrib/zipsrc.bat @@ -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 index 0000000000..742421734a --- /dev/null +++ b/utils/tex2rtf/distrib/zipsrc.sh @@ -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 index 0000000000..55c0d1aa63 --- /dev/null +++ b/utils/tex2rtf/docs/makefile.vc @@ -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 + diff --git a/utils/tex2rtf/docs/readme.txt b/utils/tex2rtf/docs/readme.txt index 6709d2eafc..d5c2afeacb 100644 --- a/utils/tex2rtf/docs/readme.txt +++ b/utils/tex2rtf/docs/readme.txt @@ -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 diff --git a/utils/tex2rtf/docs/tex2rtf.ini b/utils/tex2rtf/docs/tex2rtf.ini index f907369d52..f17be8f2fe 100644 --- a/utils/tex2rtf/docs/tex2rtf.ini +++ b/utils/tex2rtf/docs/tex2rtf.ini @@ -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 diff --git a/utils/tex2rtf/src/Tex2RTFVC.dsp b/utils/tex2rtf/src/Tex2RTFVC.dsp index 5084b99a1d..18b448e46b 100644 --- a/utils/tex2rtf/src/Tex2RTFVC.dsp +++ b/utils/tex2rtf/src/Tex2RTFVC.dsp @@ -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 index 0000000000..8200137288 --- /dev/null +++ b/utils/tex2rtf/src/symbols.h @@ -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_ + diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index a1d0838110..ba4c550700 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -44,12 +44,13 @@ #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 index 0000000000..1d4b1c8ea5 --- /dev/null +++ b/utils/tex2rtf/tools/lacheck.1 @@ -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 " +, 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 diff --git a/utils/tex2rtf/tools/lacheck.exe b/utils/tex2rtf/tools/lacheck.exe new file mode 100755 index 0000000000000000000000000000000000000000..ba08d0a54b4464bc321beb514556db37979d1943 GIT binary patch literal 27231 zcmeHv3wRVo)^=5Q&rCA85N-h#!T^~-2p|#+gj|deCZGsWAOS@nK)5I*Y|;}zF$s<< zBn=pKKNWY^m5tx(h`6llr=zYA1QXp|)S$b9cm>oR#|sN=5<-~%-%~vk5=7nopYOjs z|MTZO-BVqcQ>RXys(R~G!3{SrWNA!c4)$$?VVsU-5l0?>tS@5;j4{ssl-MqN@s%3S zSiZAeM&$qh`+r&kbF{C0u}nYMudu+Ao#tTbTu=4{2XkAStP>oZd9o!%d`QZloStmO z{7{qw_^>B4HO@$r6eG=^te=bV98dy1eJm%R;`G*NeAgqPF}leL#!Sl|=Xg9Wd9$Ua zGN`3Za5P!_d;2773H`kugru7BwU$S;!?l}kiU{=47M#*vOpM+bT+cVywFPHtHyw)D z>}siXwLDVeI-@l0 z!FAld-7^}sQM5K*WZtyEQXiY_$&O8CZrT4RqsSex$?2OGS*m1zEz^k8CaY58YHM}1 zu^hL}lRXxSn!IDIBi+^J&Tq2flT|M}yH|4s>sRd3no{ul)~;I1Z{w01EvyC&*IaF* zILn&EDrCQGl^Y%$Z9Ms!t&SKv)V@fqKJiKYSVwhisw2m+#wPnqjGAngyraLjUP*>D z^%2Q|9W(ut3?uD~oYIi*o5cK|@w$`-e~eT|UDcEMe;uqdtW5F$2YzFjqRM_PX!fH2 z?x2>?F8@J(_qd#}c&C=v4)tXzOpVC0Fyu3sPhtKq_-$h(h0ntL z2N~Y^`mUay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3hGF~<^COD~ literal 0 HcmV?d00001 diff --git a/utils/tex2rtf/tools/lacheck.lex b/utils/tex2rtf/tools/lacheck.lex new file mode 100644 index 0000000000..e2ca8f42dc --- /dev/null +++ b/utils/tex2rtf/tools/lacheck.lex @@ -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 ... + * + * 26-May-1991 Kresten Krab Thorup + * Initial distribution version. + */ +%{ +#include +#include +#include + +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") + +%% + +"\\\\" { ; } + +"\\\%" { ; } + +"%"[^\n]* { ; } + +\n { line_count++; } + +"\\\{" { ; } + +"\\\}" { ; } + +"\\\$" { ; } + +{b_group} { push( "{", 0, line_count);} + +{e_group} { g_checkend(0); } + +"\\"[exg]?def[^\{] BEGIN(DEF); + +{b_group} { ++def_count; } + +{e_group} { --def_count; + if(def_count == 0) + BEGIN(INITIAL); } + +. { ; } + +{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);} + +{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); } + +. { BEGIN(INITIAL); } + +\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; + }} + +[^\}\n]+ { + { + if (strcmp( yytext, "verbatim" ) == 0 ) + { + input(); + BEGIN(VERBATIM); + } + else + { + push(yytext, 2, line_count); + input(); + BEGIN(INITIAL); + } + }} + +\\end[ \t]*\{verbatim\} { BEGIN(INITIAL); } + +. { ; } + +\n { ++line_count; } + + +\\verb. { + sscanf (yytext, "\\verb%c", &verb_char ); + BEGIN(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; + }} + + +[^\}\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); } + +\n { BEGIN(INITIAL); ++line_count; } + +. { ; } + + +\\(input|include)([ \t]|"{") { BEGIN(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); + }} + +<> { + 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] \n\n\n"); + + printf("\tFrom within Emacs:\n\n\t"); + printf("M-x compile \n\tlacheck filename[.tex] "); + 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 index 0000000000..8970e87746 --- /dev/null +++ b/utils/tex2rtf/tools/lacheck.rea @@ -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 index 0000000000..c844bc993f --- /dev/null +++ b/utils/tex2rtf/tools/lacheck.txt @@ -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 , 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 + + + + +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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + May 23, 1991 2 + + -- 2.45.2