]> git.saurik.com Git - wxWidgets.git/commitdiff
More updates to the Debian packaging for wxPython, unicode and
authorRon Lee <ron@debian.org>
Fri, 5 Mar 2004 17:40:38 +0000 (17:40 +0000)
committerRon Lee <ron@debian.org>
Fri, 5 Mar 2004 17:40:38 +0000 (17:40 +0000)
the project name change.

Applied patch from ABX to make tex2rtf unicode compatible, then
removed wxSprintf lameness from it so it might actually work.
Also modified it to return true from tex2rtf OnInit in console
builds so the app will exit with a successful return code rather
than always returning failure even when it succeeds.

Implemented unicode capable wxCtime for glibc systems also needed
by tex2rtf.

Wrapped dde include in tex2rtf in a guard and assert that dde is
MSW only in its forwarding header.

Lowered the limit of maxlen in wxSprintf so it actually has a
chance to segfault on people instead of failing silently and
mysteriously with glibc.

Silenced some other 'potentially uninitialised variable' warnings
from gcc3, most of which were bogus, one potentially not so.

Added missing newline at the end of fontdlg.cpp.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

50 files changed:
Makefile.in
build/bakefiles/make_dist.mk
build/msw/config.bcc
build/msw/makefile.bcc
build/msw/makefile.gcc
build/msw/makefile.vc
build/msw/makefile.wat
debian/README.examples [new file with mode: 0644]
debian/changelog
debian/libwxgtk-dbg.links
debian/libwxgtk-dbg.postinst
debian/libwxgtk-dbg.prerm
debian/libwxgtk-dev.links
debian/libwxgtk-dev.postinst
debian/libwxgtk-dev.prerm
debian/libwxgtk-python.docs
debian/libwxgtk-python.menu
debian/rules
debian/wx-config.1
debian/wx-doc.doc-base [new file with mode: 0644]
debian/wx-doc.docs [new file with mode: 0644]
debian/wx-examples.examples [new file with mode: 0644]
debian/wx-headers-msw.dirs [new file with mode: 0644]
debian/wxPython-tools.1
debian/wxwin-doc.doc-base [deleted file]
debian/wxwin-doc.docs [deleted file]
debian/wxwin-examples.examples [deleted file]
debian/wxwin-headers-msw.dirs [deleted file]
include/wx/dde.h
include/wx/wxchar.h
src/common/filefn.cpp
src/common/wxchar.cpp
src/gtk/bitmap.cpp
src/gtk/fontdlg.cpp
src/gtk/msgdlg.cpp
src/gtk1/bitmap.cpp
src/gtk1/fontdlg.cpp
src/gtk1/msgdlg.cpp
utils/tex2rtf/src/bmputils.h
utils/tex2rtf/src/htmlutil.cpp
utils/tex2rtf/src/readshg.cpp
utils/tex2rtf/src/rtfutils.cpp
utils/tex2rtf/src/table.cpp
utils/tex2rtf/src/tex2any.cpp
utils/tex2rtf/src/tex2any.h
utils/tex2rtf/src/tex2rtf.cpp
utils/tex2rtf/src/tex2rtf.h
utils/tex2rtf/src/texutils.cpp
utils/tex2rtf/src/xlputils.cpp
wx-config.in

index dc46090b117374feeefb2171e967d7c6e83a6fea..1b00619ac286a43313c6037447baf93e874db590 100644 (file)
@@ -18732,9 +18732,22 @@ debian-dist: debian-native-dist debian-msw-dirs MSW_DIST
        @# in other dist targets.  Ugly and hardly portable but it
        @# will run on any Debian box and that's enough for now.
 
-       find $(DISTDIR) \( -name "CVS" -o -name ".cvsignore" -o -name "*.dsp" -o -name "*.dsw" -o -name "*.hh*" -o \
-                       \( -name "makefile.*" -a ! -name "makefile.unx" \) \) \
-                       -print0 | xargs -0 rm -rf
+       rm -rf $(DISTDIR)/contrib/build
+       find $(DISTDIR) \( -name "CVS" -o -name ".cvsignore" -o -name "*.dsp"    \
+                          -o -name "*.dsw" -o -name "*.hh*" -o -name "*.mms"    \
+                          -o -name "*.mcp" -o -name "*M*.xml" -o -name "*.r"    \
+                          -o -name "*.bkl" -o -name "*.pro" -o -name "*.def"    \
+                          -o -name "*.vpj" -o -name "*.sc"                      \
+                          -o \( -name "makefile.*" -a ! -name "makefile.unx" \) \
+                       \) -print0 | xargs -0 rm -rf
+
+       rm -rf $(DISTDIR)/wxPython/SWIG
+       rm -rf $(DISTDIR)/wxPython/distrib
+       rm -rf $(DISTDIR)/wxPython/distutils
+       rm -rf $(DISTDIR)/wxPython/samples
+       rm -rf $(DISTDIR)/wxPython/contrib/iewin
+       find $(DISTDIR)/wxPython \( -name "mac" -o -name "msw" \) -print0 | xargs -0 rm -rf
+
 
        @# We can't get at the individual components of the version here
        @# anymore, so strip the major and minor version out of the blob.
index 2bf49cdc1db5724325ca13b2581233453cc4034e..62b8935a1feef30696ec35de9859ad6bd59576e0 100644 (file)
@@ -1072,9 +1072,22 @@ debian-dist: debian-native-dist debian-msw-dirs MSW_DIST
        @# in other dist targets.  Ugly and hardly portable but it
        @# will run on any Debian box and that's enough for now.
 
-       find $(DISTDIR) \( -name "CVS" -o -name ".cvsignore" -o -name "*.dsp" -o -name "*.dsw" -o -name "*.hh*" -o \
-                       \( -name "makefile.*" -a ! -name "makefile.unx" \) \) \
-                       -print0 | xargs -0 rm -rf
+       rm -rf $(DISTDIR)/contrib/build
+       find $(DISTDIR) \( -name "CVS" -o -name ".cvsignore" -o -name "*.dsp"    \
+                          -o -name "*.dsw" -o -name "*.hh*" -o -name "*.mms"    \
+                          -o -name "*.mcp" -o -name "*M*.xml" -o -name "*.r"    \
+                          -o -name "*.bkl" -o -name "*.pro" -o -name "*.def"    \
+                          -o -name "*.vpj" -o -name "*.sc"                      \
+                          -o \( -name "makefile.*" -a ! -name "makefile.unx" \) \
+                       \) -print0 | xargs -0 rm -rf
+
+       rm -rf $(DISTDIR)/wxPython/SWIG
+       rm -rf $(DISTDIR)/wxPython/distrib
+       rm -rf $(DISTDIR)/wxPython/distutils
+       rm -rf $(DISTDIR)/wxPython/samples
+       rm -rf $(DISTDIR)/wxPython/contrib/iewin
+       find $(DISTDIR)/wxPython \( -name "mac" -o -name "msw" \) -print0 | xargs -0 rm -rf
+
 
        @# We can't get at the individual components of the version here
        @# anymore, so strip the major and minor version out of the blob.
index eefbbbbf24d6cfdc6074c18b989cf3025e7bee9e..aefa3f3cddfbe514bb3df50925772e6715d695b8 100644 (file)
@@ -124,6 +124,18 @@ VENDOR = custom
 CFG = 
 !endif
 
+# Compiler flags needed to compile test suite in tests directory. If you want
+# to run the tests, set it so that the compiler can find CppUnit headers. 
+!ifndef CPPUNIT_CFLAGS
+CPPUNIT_CFLAGS = 
+!endif
+
+# Linker flags needed to link test suite in tests directory. If you want
+# to run the tests, include CppUnit library here. 
+!ifndef CPPUNIT_LIBS
+CPPUNIT_LIBS = 
+!endif
+
 # Version of C runtime library to use. You can change this to
 # static if SHARED=0, but it is highly recommended to not do
 # it if SHARED=1 unless you know what you are doing. [dynamic,static]
index 516c478f9b21882effdd94eb23f36985ee254f61..1bbf8f73cbc024ec916d58353f74fa24f4375c8e 100644 (file)
@@ -29,7 +29,8 @@ MAKEARGS = -DCC="$(CC)" -DCXX="$(CXX)" -DCFLAGS="$(CFLAGS)" \
        -DUSE_GUI="$(USE_GUI)" -DUSE_HTML="$(USE_HTML)" \
        -DUSE_OPENGL="$(USE_OPENGL)" -DUSE_ODBC="$(USE_ODBC)" \
        -DUSE_EXCEPTIONS="$(USE_EXCEPTIONS)" -DOFFICIAL_BUILD="$(OFFICIAL_BUILD)" \
-       -DVENDOR="$(VENDOR)" -DCFG="$(CFG)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)"
+       -DVENDOR="$(VENDOR)" -DCFG="$(CFG)" -DCPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \
+       -DCPPUNIT_LIBS="$(CPPUNIT_LIBS)" -DRUNTIME_LIBS="$(RUNTIME_LIBS)"
 OBJS = \
        bcc_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
 SETUPHDIR = \
index a9ac23e6f243853d2912625c9235a9745ba3b5ac..2599e811ebd17fb5707e7d20c7fc9055cd1d664a 100644 (file)
@@ -19,7 +19,8 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
        MONOLITHIC="$(MONOLITHIC)" USE_GUI="$(USE_GUI)" USE_HTML="$(USE_HTML)" \
        USE_OPENGL="$(USE_OPENGL)" USE_ODBC="$(USE_ODBC)" \
        USE_EXCEPTIONS="$(USE_EXCEPTIONS)" OFFICIAL_BUILD="$(OFFICIAL_BUILD)" \
-       VENDOR="$(VENDOR)" CFG="$(CFG)" RUNTIME_LIBS="$(RUNTIME_LIBS)" \
+       VENDOR="$(VENDOR)" CFG="$(CFG)" CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" \
+       CPPUNIT_LIBS="$(CPPUNIT_LIBS)" RUNTIME_LIBS="$(RUNTIME_LIBS)" \
        GCC_VERSION="$(GCC_VERSION)"
 OBJS = \
        gcc_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
index aa9469d09fe9836e283033d01d5188508cce3beb..991a056e82fb36f14d971841f9af5619d49763b6 100644 (file)
@@ -20,6 +20,7 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
        USE_GUI="$(USE_GUI)" USE_HTML="$(USE_HTML)" USE_OPENGL="$(USE_OPENGL)" \
        USE_ODBC="$(USE_ODBC)" USE_EXCEPTIONS="$(USE_EXCEPTIONS)" \
        OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" CFG="$(CFG)" \
+       CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" CPPUNIT_LIBS="$(CPPUNIT_LIBS)" \
        RUNTIME_LIBS="$(RUNTIME_LIBS)"
 OBJS = \
        vc_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
index e6f19de5fe41d2c3dcfa629ad8573c14f0525cc0..ad7058ae56105a27b28b9a6646271998b245e162 100644 (file)
@@ -2039,7 +2039,8 @@ MAKEARGS = CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" &
        MONOLITHIC="$(MONOLITHIC)" USE_GUI="$(USE_GUI)" USE_HTML="$(USE_HTML)" &
        USE_OPENGL="$(USE_OPENGL)" USE_ODBC="$(USE_ODBC)" &
        USE_EXCEPTIONS="$(USE_EXCEPTIONS)" OFFICIAL_BUILD="$(OFFICIAL_BUILD)" &
-       VENDOR="$(VENDOR)" CFG="$(CFG)" RUNTIME_LIBS="$(RUNTIME_LIBS)"
+       VENDOR="$(VENDOR)" CFG="$(CFG)" CPPUNIT_CFLAGS="$(CPPUNIT_CFLAGS)" &
+       CPPUNIT_LIBS="$(CPPUNIT_LIBS)" RUNTIME_LIBS="$(RUNTIME_LIBS)"
 OBJS = &
        wat_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
 SETUPHDIR = &
diff --git a/debian/README.examples b/debian/README.examples
new file mode 100644 (file)
index 0000000..207ab4d
--- /dev/null
@@ -0,0 +1,14 @@
+
+These examples are provided as extended documentation for the wxWidgets
+package.  If you wish to actually run them rather than just browse them
+as documents you should copy them into a working directory elsewhere
+first.  Note that some of them will attempt to write to the current
+working directory, or to the home directory of the user they are run as.
+
+Some of the files have been compressed in accordance with Debian policy
+regarding documentation, you will need to uncompress such files before
+building or executing them.
+
+  Ron
+
+
index 94ab46e97ca8da376758f64fb331707d42ea603e..1fbffa7da6109752e06e4906e4ec20d71b077781 100644 (file)
@@ -7,7 +7,7 @@ wxwidgets2.5 (2.5.1) experimental; urgency=low
     in court.  Eleven or so years of unbroken, unquestioned usage
     was not nearly so interesting to these people as the fact we
     were a soft target and easy to deprive of due process.
-  * wxGTK is now built with gtk2.
+  * wxGTK is now built with gtk2 and unicode support.
   * wxBase is no longer a separate package, it is built with the
     GUI libs which now depend on it.  We might split it out again
     one day if there is a need for that.
@@ -19,6 +19,8 @@ wxwidgets2.5 (2.5.1) experimental; urgency=low
     improve either, but the logical separation may be beneficial.
   * Removed many elements of the build scripts that are no longer
     required due to improvements and changes elsewhere.
+  * Added README.examples for people who think these are packaged
+    as demos instead of as extended documentation.
 
  -- Ron Lee <ron@debian.org>  Fri, 27 Feb 2004 17:00:29 +1030
 
index ccbf32a06eb3795c3c5de52c82541d18b618ecde..07a19eafd7fbcc1dbee3ccc2db80c031f03e887d 100644 (file)
@@ -1,2 +1,2 @@
-usr/share/man/man1/wx-config.1.gz usr/share/man/man1/wxgtk2d-=V-config.1.gz
+usr/share/man/man1/wx-config.1.gz usr/share/man/man1/wxgtk2ud-=V-config.1.gz
 
index 2f4dbac6f82f866633980d9839caefc212e19c51..a0702b90ead29b057933db84ea8e9519415a4efe 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 set -e
 
-update-alternatives --install /usr/bin/wx-config wx-config /usr/bin/wxgtk2d-=V-config 50
+update-alternatives --install /usr/bin/wx-config wx-config /usr/bin/wxgtk2ud-=V-config 50
 
 #DEBHELPER#
 
index 816d7a7269bc111ca969c3b57b2328f552fb5c23..983e1991a3e627548fadc3960dafd61e9750d476 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 set -e
 
-update-alternatives --remove wx-config /usr/bin/wxgtk2d-=V-config
+update-alternatives --remove wx-config /usr/bin/wxgtk2ud-=V-config
 
 #DEBHELPER#
 
index 29c1b8a3f6e52ca80d60a87116c631fb36be13d6..8521384efe690110ddae62987138aa45e599bb6b 100644 (file)
@@ -1,2 +1,2 @@
-usr/share/man/man1/wx-config.1.gz usr/share/man/man1/wxgtk2-=V-config.1.gz
+usr/share/man/man1/wx-config.1.gz usr/share/man/man1/wxgtk2u-=V-config.1.gz
 
index 6e6ed60cb7e65a0996f71192b37dd26d34addde4..455e45a4db350ec011fa6961eef459b6878363e9 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 set -e
 
-update-alternatives --install /usr/bin/wx-config wx-config /usr/bin/wxgtk2-=V-config 70
+update-alternatives --install /usr/bin/wx-config wx-config /usr/bin/wxgtk2u-=V-config 70
 
 #DEBHELPER#
 
index 1e6b6815d60dffa3b2448ea2a1279e57fd949053..0f7b32803b4e145af80d3d1dbc38fd48bd7625f1 100644 (file)
@@ -1,7 +1,7 @@
 #! /bin/sh
 set -e
 
-update-alternatives --remove wx-config /usr/bin/wxgtk2-=V-config
+update-alternatives --remove wx-config /usr/bin/wxgtk2u-=V-config
 
 #DEBHELPER#
 
index 846f206bff14d9381b860102bd3970ddeefd5143..aae3f0a529ba0dc868a941347beb5a799c02a1cc 100644 (file)
@@ -1,3 +1,4 @@
-wxPython/README.txt
-wxPython/CHANGES.txt
+wxPython/docs/README.txt
+wxPython/docs/CHANGES.txt
+wxPython/docs/MigrationGuide.txt
 
index a5f8285fbce99edb6eeab7ef61417584e7a3b276..2d967defb21d511879e628256b9ff512e3cd386b 100644 (file)
@@ -1,7 +1,7 @@
-?package(libwxgtk=V-python):needs=X11 section=Apps/Programming\
+?package(libwxgtk=V-python):needs="X11" section="Apps/Programming"\
   title="pycrust" command="/usr/bin/pycrust"
-?package(libwxgtk=V-python):needs=X11 section=Apps/Programming\
+?package(libwxgtk=V-python):needs="X11" section="Apps/Programming"\
   title="pyshell" command="/usr/bin/pyshell"
-?package(libwxgtk=V-python):needs=X11 section=Apps/Programming\
+?package(libwxgtk=V-python):needs="X11" section="Apps/Programming"\
   title="xrced" command="/usr/bin/xrced"
 
index ad5446fc9b6e786f95b3734b123177c2b2776690..314c07d7edda91ff86870a604e9fb99eccdfacc1 100755 (executable)
@@ -93,6 +93,8 @@ wxconfig := $(shell pwd)/$(objdir_gtk_shared)/wx-config          \
                 --prefix=$(shell pwd)                            \
                 --exec-prefix=$(shell pwd)/$(objdir_gtk_shared)
 
+contrib_libs := $(subst CVS,,$(notdir $(wildcard contrib/include/wx/*)))
+
 
 # The Rules:
 
@@ -119,12 +121,12 @@ control-files-stamp: debian/control
        done;
        @for f in docs doc-base; do                                          \
                echo "generating control file $(package_doc).$$f";           \
-               sed -e 's/=V/$(release)/g' < debian/wxwin-doc.$$f            \
+               sed -e 's/=V/$(release)/g' < debian/wx-doc.$$f               \
                        > debian/$(package_doc).$$f;                         \
        done;
        @for f in examples; do                                               \
                echo "generating control file $(package_examples).$$f";      \
-               cp debian/wxwin-examples.$$f debian/$(package_examples).$$f; \
+               cp debian/wx-examples.$$f debian/$(package_examples).$$f;    \
        done;
        @for f in dirs links postinst prerm; do                              \
                echo "generating control file $(package_msw_dev).$$f";       \
@@ -138,7 +140,7 @@ control-files-stamp: debian/control
        done;
        @for f in dirs; do                                                   \
                echo "generating control file $(package_headers_msw).$$f";   \
-               sed -e 's/=H/$(cross_host)/g' < debian/wxwin-headers-msw.$$f \
+               sed -e 's/=H/$(cross_host)/g' < debian/wx-headers-msw.$$f    \
                        > debian/$(package_headers_msw).$$f;                 \
        done;
        touch $@
@@ -163,6 +165,7 @@ configure-gtk-shared-stamp:
                                --cache-file=$(config_cache)    \
                                --with-gtk                      \
                                --enable-gtk2                   \
+                               --enable-unicode                \
                                --with-opengl                   \
                                --enable-soname                 \
                                --with-zlib=sys                 \
@@ -186,6 +189,7 @@ configure-gtk-static-stamp:
                                --cache-file=$(config_cache)    \
                                --with-gtk                      \
                                --enable-gtk2                   \
+                               --enable-unicode                \
                                --with-opengl                   \
                                --disable-shared                \
                                --with-zlib=sys                 \
@@ -209,6 +213,7 @@ configure-gtk-debug-stamp:
                                --cache-file=$(config_cache)    \
                                --with-gtk                      \
                                --enable-gtk2                   \
+                               --enable-unicode                \
                                --with-opengl                   \
                                --enable-debug                  \
                                --enable-soname                 \
@@ -228,21 +233,30 @@ build-gtk-debug-stamp: configure-gtk-debug-stamp
 
 build-contrib-shared-stamp: build-gtk-shared-stamp
        dh_testdir
-       cd $(objdir_gtk_shared)/contrib/src \
-               && $(MAKE)
+       cd $(objdir_gtk_shared)/contrib/src && $(MAKE)
        touch $@
 
 build-contrib-static-stamp: build-gtk-static-stamp
        dh_testdir
-       cd $(objdir_gtk_static)/contrib/src \
-               && $(MAKE)
+       cd $(objdir_gtk_static)/contrib/src && $(MAKE)
        touch $@
 
 build-gtk-py-stamp: build-gtk-shared-stamp
        dh_testdir
        touch docs/lgpl.txt
+       cd wxPython/include/wx                                          \
+               && for f in $(contrib_libs); do                         \
+                       $(RM) $$f;                                      \
+                       ln -s ../../../contrib/include/wx/$$f .;        \
+               done
        cd wxPython \
-               && $(python_ver) ./setup.py build WX_CONFIG='$(wxconfig)'
+               && $(python_ver) ./setup.py     build                   \
+                                               WX_CONFIG='$(wxconfig)' \
+                                               WXPORT=gtk2             \
+                                               UNICODE=1
+       cd wxPython/include/wx                                          \
+               && for f in $(contrib_libs); do $(RM) $$f; done
+
        touch $@
 
 build-doc-stamp: build-gtk-shared-stamp
@@ -250,6 +264,7 @@ build-doc-stamp: build-gtk-shared-stamp
        cd $(objdir_gtk_shared)/utils/tex2rtf/src \
                && $(MAKE)
        rm -rf $(objdir_doc)
+       rm -rf $(objdir_doc_cruft)
        mkdir $(objdir_doc)
        mkdir $(objdir_doc_cruft)
        cd $(objdir_doc_cruft) \
@@ -409,9 +424,9 @@ install-gtk-dev: build-gtk-static-stamp install-gtk-shared-stamp
        dh_testroot
        dh_clean -k
        dh_installdirs
-       dh_install $(objdir_gtk_install)/bin/wxgtk2-$(release)-config   usr/bin
+       dh_install $(objdir_gtk_install)/bin/wxgtk2u-$(release)-config  usr/bin
        dh_install $(objdir_gtk_install)/lib/{wx,*.so}                  usr/lib
-       dh_install $(objdir_gtk_static)/lib/libwx_gtk2{-,_gl}*.a        usr/lib
+       dh_install $(objdir_gtk_static)/lib/libwx_gtk2u{-,_gl}*.a       usr/lib
 
 install-gtk-dbg: DH_OPTIONS=-p$(package_gtk_dbg)
 install-gtk-dbg: build-gtk-debug-stamp
@@ -419,7 +434,7 @@ install-gtk-dbg: build-gtk-debug-stamp
        dh_testroot
        dh_clean -k
        dh_installdirs usr/share/lintian/overrides
-       dh_install $(objdir_gtk_debug)/wxgtk2d-$(release)-config        usr/bin
+       dh_install $(objdir_gtk_debug)/wxgtk2ud-$(release)-config       usr/bin
        dh_install $(objdir_gtk_debug)/lib                              usr
        cp debian/lintian-override debian/$(package_gtk_dbg)/usr/share/lintian/overrides/$(package_gtk_dbg)
 
@@ -447,7 +462,7 @@ install-gtk-contrib-dev: build-contrib-static-stamp install-gtk-contrib-stamp
        dh_installdirs
        dh_install $(objdir_gtk_contrib_install)/include        usr
        dh_install $(objdir_gtk_contrib_install)/lib/*.so       usr/lib
-       dh_install -Xlibwx_gtk2- -Xlibwx_gtk2_gl- \
+       dh_install -Xlibwx_gtk2u- -Xlibwx_gtk2u_gl- \
                   $(objdir_gtk_static)/lib/*.a                 usr/lib
 
 install-gtk-py: DH_OPTIONS=-p$(package_gtk_py)
@@ -459,7 +474,9 @@ install-gtk-py: build-gtk-py-stamp
        cd wxPython                                                             \
                && $(python_ver) ./setup.py install                             \
                              --prefix=`pwd`/../debian/$(package_gtk_py)/usr    \
-                             WX_CONFIG='$(wxconfig)'
+                             WX_CONFIG='$(wxconfig)'                           \
+                             WXPORT=gtk2                                       \
+                             UNICODE=1
 
        find debian/$(package_gtk_py)/usr/lib/$(python_ver)/site-packages/wxPython \
                -name '*.py?' -exec rm '{}' ';'
@@ -477,7 +494,7 @@ install-gtk-py: build-gtk-py-stamp
                usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/pywrap.1
 
        # This is rather bogus, its included in the main copyright file now though.
-       rm -f debian/$(package_gtk_py)/usr/lib/$(python_ver)/site-packages/wxPython/tools/XRCed/license.txt
+       rm -f debian/$(package_gtk_py)/usr/lib/$(python_ver)/site-packages/wx/tools/XRCed/license.txt
 
 install-headers: DH_OPTIONS=-p$(package_headers)
 install-headers: install-gtk-shared-stamp
@@ -580,7 +597,7 @@ binary-common:
        dh_fixperms
        dh_makeshlibs -N$(package_gtk_py) -V
        dh_installdeb
-       dh_shlibdeps -ldebian/$(package_gtk_lib)/usr/lib:debian/$(package_gtk_dbg)/usr/lib
+       dh_shlibdeps -ldebian/$(package_gtk_lib)/usr/lib:debian/$(package_gtk_dbg)/usr/lib:debian/$(package_gtk_contrib)/usr/lib
        dh_gencontrol
        dh_md5sums
        dh_builddeb
index fd9f478c195d1044e2082938b3acdfa3f144fdbb..fa3e332c74299aa3fd04f99b459b3250fea1ff29 100644 (file)
@@ -1,6 +1,6 @@
-.TH wx\-config 1 "15 Feb 2000" "Debian GNU/Linux" "wxWindows"
+.TH wx\-config 1 "15 Feb 2000" "Debian GNU/Linux" "wxWidgets"
 .SH NAME
-wx-config \- generate compile time info for wxWindows
+wx-config \- generate compile time requirements for wxWidgets applications
 .SH SYNOPSIS
 .nh
 .B wxbase\-config
@@ -8,11 +8,11 @@ wx-config \- generate compile time info for wxWindows
 .B wxgtk\-config
 .HP
 .B wx\-config
-[\-\-version] [\-\-libs] [\-\-cflags] [\-\-cc] [\-\-cxx] [\-\-ld]
-[\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP]
+[\-\-version] [\-\-libs\fI[=LIBS]\fP] [\-\-cflags] [\-\-cc] [\-\-cxx] [\-\-ld]
+[\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-release] [\-\-basename]
 .SH DESCRIPTION
 \fIwx\-config\fP is a tool to determine the compiler and linker
-flags required for applications using the \fIwxWindows\fP toolkit(s).
+flags required for applications using the \fIwxWidgets\fP toolkit(s).
 .PP
 \fIwx\-config\fP is normally a symlink to one of the port\-specific
 versions like \fIwxbase\-config\fP or \fIwxgtk\-config\fP which
@@ -26,31 +26,32 @@ mechanism.
 .SH OPTIONS
 .l
 \fIwx\-config\fP accepts the following options:
-.TP 8
+.TP 15
 .B  \-\-version
 What to
 .B ALWAYS
 include in a bug report.
-.br
-( But of course you already knew that ... )
-.TP 8
-.B  \-\-libs
-Generate linker flags for a \fIwxWindows\fP program.
-.TP 8
+.TP 15
+.B  \-\-libs[=LIBS]
+Generate linker flags for a \fIwxWidgets\fP program.
+The optional argument is a comma separated list of the wxWidgets libraries
+to link with.  You may include contrib libs here too.  If no argument is
+given it will assume you wish to link all 'core' libraries.
+.TP 15
 .B  \-\-cflags
 Generate compiler flags for the same.
-.TP 8
+.TP 15
 .B  \-\-cc
 Output the name of the C compiler \fB$(CC)\fP.
-.TP 8
+.TP 15
 .B  \-\-cxx
 Output the name of the C++ compiler \fB$(CXX)\fP.
-.TP 8
+.TP 15
 .B  \-\-ld
 Output the Linker command \fB$(LD)\fP.
-.TP 8
+.TP 15
 .B  \-\-prefix=PREFIX
-If specified, use PREFIX instead of the installation prefix that \fIwxWindows\fP
+If specified, use PREFIX instead of the installation prefix that \fIwxWidgets\fP
 was built with when computing the output for the \-\-cflags and
 \-\-libs options. This option is also used for the exec prefix
 if \-\-exec\-prefix was not specified. This option must be specified
@@ -58,27 +59,33 @@ before any \-\-libs or \-\-cflags options.
 .br
 .nh
 .HP
-(Translation:  this is the root path to the \fIwxWindows\fP headers \-\- [Ron])
+(Translation:  this is the root path to the \fIwxWidgets\fP headers \-\- [Ron])
 .hy
-.TP 8
+.TP 15
 .B  \-\-exec\-prefix=PREFIX
 If specified, use PREFIX instead of the installation exec prefix that
-\fIwxWindows\fP was built with when computing the output for the \-\-cflags
+\fIwxWidgets\fP was built with when computing the output for the \-\-cflags
 and \-\-libs options.  This option must be specified before any
 \-\-libs or \-\-cflags options.
 .br
 .nh
 .HP
-(Translation:  this is the root path to the \fIwxWindows\fP library \-\- [Ron])
+(Translation:  this is the root path to the \fIwxWidgets\fP library \-\- [Ron])
 .hy
+.TP 15
+.B  \-\-release
+Output the wxWidgets release number.
+.TP 15
+.B  \-\-basename
+Output the base name of the wxWidgets libraries.
 .SH SEE ALSO
 .BR gtk\-config (1),
 .BR update\-alternatives (8)
 .SH COPYRIGHT
 This manpage was copied whole\-heartedly from the \fBgtk\-config\fP(1) manpage
 by Brian Bassett <brianb@debian.org> for the Debian GNU/Linux distribution of
-wxGTK.  It was then updated to include new options and otherwise bastardised
-generally by Ron Lee <ron@debian.org>
+wxGTK.  It was subsequently updated to include new options and otherwise
+bastardised generally by Ron Lee <ron@debian.org>
 
 The original gtk\-config manpage copyright:
 
diff --git a/debian/wx-doc.doc-base b/debian/wx-doc.doc-base
new file mode 100644 (file)
index 0000000..775bf3c
--- /dev/null
@@ -0,0 +1,10 @@
+Document: wx-manual
+Title: wxWidgets Programming Manual
+Author: The wxWidgets Cabal
+Abstract: This manual describes the wxWidgets cross-platform GUI toolkit.
+Section: Apps/Programming
+
+Format: HTML
+Index: /usr/share/doc/wx=V-doc/wx-manual.html/wxwin.htm
+Files: /usr/share/doc/wx=V-doc/wx-manual.html/*
+
diff --git a/debian/wx-doc.docs b/debian/wx-doc.docs
new file mode 100644 (file)
index 0000000..94c8d18
--- /dev/null
@@ -0,0 +1,2 @@
+docs/wx-manual.html
+
diff --git a/debian/wx-examples.examples b/debian/wx-examples.examples
new file mode 100644 (file)
index 0000000..ba50fa6
--- /dev/null
@@ -0,0 +1,5 @@
+debian/README.examples
+docs/examples/demos
+docs/examples/samples
+docs/examples/wxPython
+
diff --git a/debian/wx-headers-msw.dirs b/debian/wx-headers-msw.dirs
new file mode 100644 (file)
index 0000000..ebfde3d
--- /dev/null
@@ -0,0 +1,2 @@
+usr/=H/include/wx
+
index 1f800ea42a7e8caf4c66921d290f0c0f648f93e5..ee4b1f3334c88b199f9d129bd317be8499f09fa8 100644 (file)
@@ -1,4 +1,4 @@
-.TH wxPython\-tools 1 "3 Jan 2003" "Debian GNU/Linux" "wxWindows"
+.TH wxPython\-tools 1 "3 Jan 2003" "Debian GNU/Linux" "wxWidgets"
 .SH NAME
 img2py \- wxPython tools.
 .br
@@ -22,6 +22,6 @@ The real documentation for these tools is available in pydoc format.
 
 .SH COPYRIGHT
 This manpage was written by Ron Lee <ron@debian.org> for the Debian GNU/Linux
-distribution of wxWindows.  It may be freely distributed by anyone insane enough
+distribution of wxWidgets.  It may be freely distributed by anyone insane enough
 to find it useful.
 
diff --git a/debian/wxwin-doc.doc-base b/debian/wxwin-doc.doc-base
deleted file mode 100644 (file)
index 775bf3c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Document: wx-manual
-Title: wxWidgets Programming Manual
-Author: The wxWidgets Cabal
-Abstract: This manual describes the wxWidgets cross-platform GUI toolkit.
-Section: Apps/Programming
-
-Format: HTML
-Index: /usr/share/doc/wx=V-doc/wx-manual.html/wxwin.htm
-Files: /usr/share/doc/wx=V-doc/wx-manual.html/*
-
diff --git a/debian/wxwin-doc.docs b/debian/wxwin-doc.docs
deleted file mode 100644 (file)
index 94c8d18..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-docs/wx-manual.html
-
diff --git a/debian/wxwin-examples.examples b/debian/wxwin-examples.examples
deleted file mode 100644 (file)
index 76daa91..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-docs/examples/demos
-docs/examples/samples
-docs/examples/wxPython
diff --git a/debian/wxwin-headers-msw.dirs b/debian/wxwin-headers-msw.dirs
deleted file mode 100644 (file)
index ebfde3d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/=H/include/wx
-
index e7373533112bad88590d860bccf63a7a96bd2783..0fb35acc07db1130265f5c6318c77bc3448bd224 100644 (file)
@@ -13,14 +13,8 @@ WX_DECLARE_USER_EXPORTED_LIST(wxDDEConnection, wxDDEConnectionList, WXDLLIMPEXP_
 
 #if defined(__WXMSW__)
     #include "wx/msw/dde.h"
-#elif defined(__WXMOTIF__)
-    #include "wx/motif/dde.h"
-#elif defined(__WXGTK__)
-    #include "wx/gtk/dde.h"
-#elif defined(__WXMAC__)
-    #include "wx/mac/dde.h"
-#elif defined(__WXPM__)
-    #include "wx/os2/dde.h"
+#else
+    #error DDE is only supported on MSW
 #endif
 
 #endif
index 5a6263ac63e4b72de93e652bfa87c0965d7ade99..6a047fe88acc8bec9502e4ad2d9c6c29e0082f1a 100644 (file)
@@ -2,7 +2,7 @@
  * Name:        wx/wxchar.h
  * Purpose:     Declarations common to wx char/wchar_t usage (wide chars)
  * Author:      Joel Farley, Ove KÃ¥ven
- * Modified by: Vadim Zeitlin, Robert Roebling
+ * Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
  * Created:     1998/06/12
  * RCS-ID:      $Id$
  * Copyright:   (c) 1998-2002 wxWindows dev team
@@ -923,6 +923,12 @@ WXDLLIMPEXP_BASE int      wxSystem(const wxChar *psz);
                                   const wxChar *fmt, const struct tm *tm);
 #endif /* wxNEED_WX_TIME_H */
 
+#ifndef wxCtime
+#include <time.h>
+WXDLLIMPEXP_BASE wxChar *wxCtime(const time_t *timep);
+#endif
+
+
 /* missing functions in some WinCE versions */
 #ifdef _WIN32_WCE
 #if (_WIN32_WCE < 300)
index 1f80781a6a72ad1ce6eb4d1cecc1714a5a831ae4..0bec2e03fe026cfddf23544d5e0504db24d54a70 100644 (file)
@@ -751,7 +751,7 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin
 #endif
 
   // Handle User's home (ignore root homes!)
-  size_t len;
+  size_t len = 0;
   if ((val = wxGetUserHome (user)) != NULL &&
       (len = wxStrlen(val)) > 2 &&
       wxStrncmp(dest, val, len) == 0)
index aa6fb1ec6d1b6f95fd45045f45d09a10a9bd66ea..655a9b58b216ec415e985194ee413274a4f517d7 100644 (file)
@@ -2,7 +2,7 @@
 // Name:        wxchar.cpp
 // Purpose:     wxChar implementation
 // Author:      Ove KÃ¥ven
-// Modified by:
+// Modified by: Ron Lee
 // Created:     09/04/99
 // RCS-ID:      $Id$
 // Copyright:   (c) wxWindows copyright
@@ -920,7 +920,18 @@ int wxSprintf( wxChar *str, const wxChar *format, ... )
     va_start(argptr, format);
 
     // callers of wxSprintf() deserve what they get
-    int ret = vswprintf( str, UINT_MAX, wxFormatConverter(format), argptr );
+    //int ret = vswprintf( str, UINT_MAX, wxFormatConverter(format), argptr );
+
+    // ... true, but if we are going to implement it, they probably still
+    // deserve something a little better than absolutely guaranteed silent
+    // failure.  For some (very mysterious) reason, this call fails under glibc
+    // 2.3.2 if str was allocated on the heap and maxsize is larger than this.
+    // Even more mysterious is that it does still succeed if str was allocated
+    // on the stack.  This should still be plenty large enough for people who
+    // want to overflow a buffer.  The bug was first noticed in unicode builds
+    // of tex2rtf, but I'm going to fix that to not use this unsafe function
+    // instead of wasting time diagnosing this further right now.
+    int ret = vswprintf( str, INT_MAX / 4, wxFormatConverter(format), argptr );
 
     va_end(argptr);
 
@@ -964,7 +975,7 @@ int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list argptr
 int wxVsprintf( wxChar *str, const wxChar *format, va_list argptr )
 {
     // same as for wxSprintf()
-    return vswprintf(str, UINT_MAX, wxFormatConverter(format), argptr);
+    return vswprintf(str, INT_MAX / 4, wxFormatConverter(format), argptr);
 }
 
 #endif // wxNEED_PRINTF_CONVERSION
@@ -1345,6 +1356,18 @@ WXDLLEXPORT size_t   wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const
 }
 #endif // wxNEED_WX_TIME_H
 
+#ifndef wxCtime
+WXDLLEXPORT wxChar *wxCtime(const time_t *timep)
+{
+    static wxChar   buf[128];
+
+    wxStrncpy( buf, wxConvertMB2WX( ctime( timep ) ), sizeof( buf ) );
+    buf[ sizeof( buf ) - 1 ] = _T('\0');
+
+    return buf;
+}
+#endif // wxCtime
+
 #endif // wxUSE_WCHAR_T
 
 // ----------------------------------------------------------------------------
index e708aaec54f3d57c65c1ab7e86bd122d882b37fc..de3d7c1f67d9cabe7d2a61c6206deb7d8a305442 100644 (file)
@@ -415,7 +415,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
     {
         char outbyte = 0;
         int old_x = -1;
-        guint32 old_pixval;
+        guint32 old_pixval = 0;
 
         for (int w = 0; w < width; w++)
         {
@@ -480,7 +480,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
         {
             char outbyte = 0;
             int old_x = -1;
-            guint32 old_pixval;
+            guint32 old_pixval = 0;
     
             for (int w = 0; w < width; w++)
             {
index b6d2f48adf254e8740f1fa2670dff88316be69e5..df4b0eae8aaeaf1de1c61989b60876353179256f 100644 (file)
@@ -191,4 +191,5 @@ void wxFontDialog::SetChosenFont(const char *fontname)
 
 #endif // wxUSE_FONTDLG
 
-#endif // GPE
\ No newline at end of file
+#endif // GPE
+
index 1d6878753570ce074e0f951c29cd7dd5eef5b4cb..2dd5336e657193c47d39cb5e4d2af271a1bdd2d5 100644 (file)
@@ -45,9 +45,9 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
 int wxMessageDialog::ShowModal()
 {
     GtkWidget *dlg;
-    GtkMessageType type;
+    GtkMessageType type = GTK_MESSAGE_ERROR;
     GtkButtonsType buttons = GTK_BUTTONS_OK;
-    
+
     if (m_dialogStyle & wxYES_NO)
     {
         buttons = GTK_BUTTONS_YES_NO;
@@ -60,7 +60,7 @@ int wxMessageDialog::ShowModal()
         else
             buttons = GTK_BUTTONS_OK;
     }
-    
+
     if (m_dialogStyle & wxICON_EXCLAMATION)
         type = GTK_MESSAGE_WARNING;
     else if (m_dialogStyle & wxICON_ERROR)
@@ -69,6 +69,8 @@ int wxMessageDialog::ShowModal()
         type = GTK_MESSAGE_INFO;
     else if (m_dialogStyle & wxICON_QUESTION)
         type = GTK_MESSAGE_QUESTION;
+    else
+        wxFAIL_MSG( _T("Unknown wxMessageDialog type") );
 
     dlg = gtk_message_dialog_new(m_parent ?
                                     GTK_WINDOW(m_parent->m_widget) : NULL,
@@ -88,7 +90,7 @@ int wxMessageDialog::ShowModal()
         else
             gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_YES);
     }
-    
+
     gint result = gtk_dialog_run(GTK_DIALOG(dlg));
     gtk_widget_destroy(dlg);
 
@@ -98,7 +100,7 @@ int wxMessageDialog::ShowModal()
             wxFAIL_MSG(_T("unexpected GtkMessageDialog return code"));
             // fall through
 
-        case GTK_RESPONSE_CANCEL: 
+        case GTK_RESPONSE_CANCEL:
             return wxID_CANCEL;
         case GTK_RESPONSE_OK:
             return wxID_OK;
index e708aaec54f3d57c65c1ab7e86bd122d882b37fc..de3d7c1f67d9cabe7d2a61c6206deb7d8a305442 100644 (file)
@@ -415,7 +415,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
     {
         char outbyte = 0;
         int old_x = -1;
-        guint32 old_pixval;
+        guint32 old_pixval = 0;
 
         for (int w = 0; w < width; w++)
         {
@@ -480,7 +480,7 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
         {
             char outbyte = 0;
             int old_x = -1;
-            guint32 old_pixval;
+            guint32 old_pixval = 0;
     
             for (int w = 0; w < width; w++)
             {
index b6d2f48adf254e8740f1fa2670dff88316be69e5..df4b0eae8aaeaf1de1c61989b60876353179256f 100644 (file)
@@ -191,4 +191,5 @@ void wxFontDialog::SetChosenFont(const char *fontname)
 
 #endif // wxUSE_FONTDLG
 
-#endif // GPE
\ No newline at end of file
+#endif // GPE
+
index 1d6878753570ce074e0f951c29cd7dd5eef5b4cb..2dd5336e657193c47d39cb5e4d2af271a1bdd2d5 100644 (file)
@@ -45,9 +45,9 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
 int wxMessageDialog::ShowModal()
 {
     GtkWidget *dlg;
-    GtkMessageType type;
+    GtkMessageType type = GTK_MESSAGE_ERROR;
     GtkButtonsType buttons = GTK_BUTTONS_OK;
-    
+
     if (m_dialogStyle & wxYES_NO)
     {
         buttons = GTK_BUTTONS_YES_NO;
@@ -60,7 +60,7 @@ int wxMessageDialog::ShowModal()
         else
             buttons = GTK_BUTTONS_OK;
     }
-    
+
     if (m_dialogStyle & wxICON_EXCLAMATION)
         type = GTK_MESSAGE_WARNING;
     else if (m_dialogStyle & wxICON_ERROR)
@@ -69,6 +69,8 @@ int wxMessageDialog::ShowModal()
         type = GTK_MESSAGE_INFO;
     else if (m_dialogStyle & wxICON_QUESTION)
         type = GTK_MESSAGE_QUESTION;
+    else
+        wxFAIL_MSG( _T("Unknown wxMessageDialog type") );
 
     dlg = gtk_message_dialog_new(m_parent ?
                                     GTK_WINDOW(m_parent->m_widget) : NULL,
@@ -88,7 +90,7 @@ int wxMessageDialog::ShowModal()
         else
             gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_YES);
     }
-    
+
     gint result = gtk_dialog_run(GTK_DIALOG(dlg));
     gtk_widget_destroy(dlg);
 
@@ -98,7 +100,7 @@ int wxMessageDialog::ShowModal()
             wxFAIL_MSG(_T("unexpected GtkMessageDialog return code"));
             // fall through
 
-        case GTK_RESPONSE_CANCEL: 
+        case GTK_RESPONSE_CANCEL:
             return wxID_CANCEL;
         case GTK_RESPONSE_OK:
             return wxID_OK;
index a8d685423e92e7bcf7dd33b41b662508dba216a4..11d30eacaaa5c6a02ab2366cd2ca334aaec668cb 100644 (file)
@@ -3,7 +3,8 @@
 // Purpose:     Utilities for manipulating bitmap and metafile images for
 //              the purposes of conversion to RTF
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -63,7 +64,7 @@ bool GetBMPHeader(FILE *fp, int *Width, int *Height, int *Planes, int *BitsPerPi
 
   /* read the file type (first two bytes) */
   int c = getc(fp); int c1 = getc(fp);
-  if (c!='B' || c1!='M') { return FALSE; }
+  if (c!='B' || c1!='M') { return false; }
 
   /* bfSize = */          getint(fp);
   getshort(fp);         /* reserved and ignored */
@@ -88,22 +89,22 @@ bool GetBMPHeader(FILE *fp, int *Width, int *Height, int *Planes, int *BitsPerPi
   *BitsPerPixel = (int)biBitCount;
 
 //  fseek(fp, bfOffBits, SEEK_SET);
-  
-  return TRUE;
+
+  return true;
 }
 
 static int scanLineWidth = 0;
 
-bool OutputBitmapHeader(FILE *fd, bool isWinHelp = FALSE)
+bool OutputBitmapHeader(FILE *fd, bool isWinHelp = false)
 {
   int Width, Height, Planes, BitsPerPixel;
   if (!GetBMPHeader(fd, &Width, &Height, &Planes, &BitsPerPixel))
-    return FALSE;
+    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;
 
@@ -112,15 +113,15 @@ bool OutputBitmapHeader(FILE *fd, bool isWinHelp = FALSE)
   else TexOutput(_T("\\dibitmap)"));
 
   wxChar buf[50];
-  TexOutput(_T("\\picw")); wxSprintf(buf, _T("%d"), Width); TexOutput(buf);
-  TexOutput(_T("\\pich")); wxSprintf(buf, _T("%d"), Height); TexOutput(buf);
-  TexOutput(_T("\\wbmbitspixel")); wxSprintf(buf, _T("%d"), BitsPerPixel); TexOutput(buf);
-  TexOutput(_T("\\wbmplanes")); wxSprintf(buf, _T("%d"), Planes); TexOutput(buf);
-  TexOutput(_T("\\wbmwidthbytes")); wxSprintf(buf, _T("%d"), scanLineWidth); TexOutput(buf);
-  TexOutput(_T("\\picwgoal")); wxSprintf(buf, _T("%d"), goalW); TexOutput(buf);
-  TexOutput(_T("\\pichgoal")); wxSprintf(buf, _T("%d"), goalH); TexOutput(buf);
+  TexOutput(_T("\\picw")); wxSnprintf(buf, sizeof(buf), _T("%d"), Width); TexOutput(buf);
+  TexOutput(_T("\\pich")); wxSnprintf(buf, sizeof(buf), _T("%d"), Height); TexOutput(buf);
+  TexOutput(_T("\\wbmbitspixel")); wxSnprintf(buf, sizeof(buf), _T("%d"), BitsPerPixel); TexOutput(buf);
+  TexOutput(_T("\\wbmplanes")); wxSnprintf(buf, sizeof(buf), _T("%d"), Planes); TexOutput(buf);
+  TexOutput(_T("\\wbmwidthbytes")); wxSnprintf(buf, sizeof(buf), _T("%d"), scanLineWidth); TexOutput(buf);
+  TexOutput(_T("\\picwgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalW); TexOutput(buf);
+  TexOutput(_T("\\pichgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalH); TexOutput(buf);
   TexOutput(_T("\n"));
-  return TRUE;
+  return true;
 }
 
 
@@ -143,7 +144,7 @@ bool OutputBitmapData(FILE *fd)
     ch = getc(fd);
   }
   TexOutput(_T("\n}\n"));
-  return TRUE;
+  return true;
 }
 
 #ifdef __WXMSW__
@@ -164,21 +165,21 @@ bool GetMetafileHeader(FILE *handle, int *width, int *height)
   fread((void *)theHeader, sizeof(char), sizeof(mfPLACEABLEHEADER), handle);
   if (theHeader->key != 0x9AC6CDD7)
   {
-    return FALSE;
+    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;
+  return true;
 }
 
 bool OutputMetafileHeader(FILE *handle, bool WXUNUSED(isWinHelp), int userWidth, int userHeight)
 {
   int Width, Height;
   if (!GetMetafileHeader(handle, &Width, &Height))
-    return FALSE;
+    return false;
 
   scanLineWidth = 64;
   int goalW = Width;
@@ -207,12 +208,12 @@ bool OutputMetafileHeader(FILE *handle, bool WXUNUSED(isWinHelp), int userWidth,
   TexOutput(_T("\\wmetafile8"));
 
   wxChar buf[50];
-  TexOutput(_T("\\picw")); wxSprintf(buf, _T("%d"), Width); TexOutput(buf);
-  TexOutput(_T("\\pich")); wxSprintf(buf, _T("%d"), Height); TexOutput(buf);
-  TexOutput(_T("\\picwgoal")); wxSprintf(buf, _T("%d"), goalW); TexOutput(buf);
-  TexOutput(_T("\\pichgoal")); wxSprintf(buf, _T("%d"), goalH); TexOutput(buf);
+  TexOutput(_T("\\picw")); wxSnprintf(buf, sizeof(buf), _T("%d"), Width); TexOutput(buf);
+  TexOutput(_T("\\pich")); wxSnprintf(buf, sizeof(buf), _T("%d"), Height); TexOutput(buf);
+  TexOutput(_T("\\picwgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalW); TexOutput(buf);
+  TexOutput(_T("\\pichgoal")); wxSnprintf(buf, sizeof(buf), _T("%d"), goalH); TexOutput(buf);
   TexOutput(_T("\n"));
-  return TRUE;
+  return true;
 }
 
 bool OutputMetafileData(FILE *handle)
@@ -236,7 +237,7 @@ bool OutputMetafileData(FILE *handle)
     }
   } while (ch != EOF);
   TexOutput(_T("\n}\n"));
-  return TRUE;
+  return true;
 }
 
 #endif
index 365de6219e2409c307e4d03cbeb130e4a785fe0b..cc8187395f09bf4d45649477ebb025b76ad8495a 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        htmlutil.cpp
 // Purpose:     Converts Latex to HTML
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -69,18 +70,18 @@ FILE *FrameContents = NULL;
 FILE *Titlepage = NULL;
 // FILE *FrameTitlepage = NULL;
 int fileId = 0;
-bool subsectionStarted = FALSE;
+bool subsectionStarted = false;
 
 // Which column of a row are we in? (Assumes no nested tables, of course)
 int currentColumn = 0;
 
 // Are we in verbatim mode? If so, format differently.
-static bool inVerbatim = FALSE;
+static bool inVerbatim = false;
 
 // Need to know whether we're in a table or figure for benefit
 // of listoffigures/listoftables
-static bool inFigure = FALSE;
-static bool inTable = FALSE;
+static bool inFigure = false;
+static bool inTable = false;
 
 // This is defined in the Tex2Any library.
 extern wxChar *BigBuffer;
@@ -198,13 +199,13 @@ void ReopenFile(FILE **fd, wxChar **fileName, const wxChar *label)
   wxChar buf[400];
   if (truncateFilenames)
   {
-    wxSprintf(buf, _T("%s%d.htm"), FileRoot, fileId);
+    wxSnprintf(buf, sizeof(buf), _T("%s%d.htm"), FileRoot, fileId);
   }
   else
   {
     if (fileId == 1)
       gs_filenames.Add(wxEmptyString);
-    wxSprintf(buf, _T("%s_%s.html"), FileRoot, label);
+    wxSnprintf(buf, sizeof(buf), _T("%s_%s.html"), FileRoot, label);
     gs_filenames.Add(buf);
   }
   if (*fileName) delete[] *fileName;
@@ -254,7 +255,7 @@ void ReopenSectionContentsFile(void)
 
 void ProcessText2HTML(TexChunk *chunk)
 {
-  bool changed = FALSE;
+  bool changed = false;
   int ptr = 0;
   int i = 0;
   char ch = 1;
@@ -270,19 +271,19 @@ void ProcessText2HTML(TexChunk *chunk)
     {
       BigBuffer[ptr] = 0; wxStrcat(BigBuffer, _T("<P>\n\n")); ptr += 5;
       i += 2;
-      changed = TRUE;
+      changed = true;
     }
     else if (!inVerbatim && ch == '`' && (len >= i+1 && chunk->value[i+1] == '`'))
     {
       BigBuffer[ptr] = '"'; ptr ++;
       i += 2;
-      changed = TRUE;
+      changed = true;
     }
     else if (!inVerbatim && ch == '`') // Change ` to '
     {
       BigBuffer[ptr] = 39; ptr ++;
       i += 1;
-      changed = TRUE;
+      changed = true;
     }
     else if (ch == '<') // Change < to &lt
     {
@@ -290,7 +291,7 @@ void ProcessText2HTML(TexChunk *chunk)
       wxStrcat(BigBuffer, _T("&lt;"));
       ptr += 4;
       i += 1;
-      changed = TRUE;
+      changed = true;
     }
     else if (ch == '>') // Change > to &gt
     {
@@ -298,7 +299,7 @@ void ProcessText2HTML(TexChunk *chunk)
       wxStrcat(BigBuffer, _T("&gt;"));
       ptr += 4;
       i += 1;
-      changed = TRUE;
+      changed = true;
     }
     else
     {
@@ -339,7 +340,7 @@ void Text2HTML(TexChunk *chunk)
         return;
 
       if (def && (def->macroId == ltVERBATIM || def->macroId == ltVERB || def->macroId == ltSPECIAL))
-        inVerbatim = TRUE;
+        inVerbatim = true;
 
       wxNode *node = chunk->children.GetFirst();
       while (node)
@@ -350,7 +351,7 @@ void Text2HTML(TexChunk *chunk)
       }
 
       if (def && (def->macroId == ltVERBATIM || def->macroId == ltVERB || def->macroId == ltSPECIAL))
-        inVerbatim = FALSE;
+        inVerbatim = false;
 
       break;
     }
@@ -398,7 +399,9 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   {
 //    contentsReference = "<img align=center src=\"contents.gif\" BORDER=0 ALT=\"Contents\">";
     contentsReference = contentsReferenceBuf;
-    wxSprintf(contentsReference, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Contents\">"), ConvertCase(_T("contents.gif")));
+    wxSnprintf(contentsReference, sizeof(contentsReferenceBuf),
+               _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Contents\">"),
+               ConvertCase(_T("contents.gif")));
   }
 
   wxChar *upReference; // no need to initialize because always assigned below
@@ -408,7 +411,9 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   {
 //    upReference = "<img align=center src=\"up.gif\" ALT=\"Up\">";
     upReference = upReferenceBuf;
-    wxSprintf(upReference, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Up\">"), ConvertCase(_T("up.gif")));
+    wxSnprintf(upReference, sizeof(upReferenceBuf),
+               _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Up\">"),
+               ConvertCase(_T("up.gif")));
   }
 
   wxChar *backReference; // no need to initialize because always assigned below
@@ -418,7 +423,9 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   {
 //    backReference = "<img align=center src=\"back.gif\" ALT=\"Previous\">";
     backReference = backReferenceBuf;
-    wxSprintf(backReference, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Previous\">"), ConvertCase(_T("back.gif")));
+    wxSnprintf(backReference, sizeof(backReferenceBuf),
+               _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Previous\">"),
+               ConvertCase(_T("back.gif")));
   }
 
   wxChar *forwardReference; // no need to initialize because always assigned below
@@ -428,7 +435,9 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   {
 //    forwardReference = "<img align=center src=\"forward.gif\" ALT=\"Next\">";
     forwardReference = forwardReferenceBuf;
-    wxSprintf(forwardReference, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Next\">"), ConvertCase(_T("forward.gif")));
+    wxSnprintf(forwardReference, sizeof(forwardReferenceBuf),
+               _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Next\">"),
+               ConvertCase(_T("forward.gif")));
   }
 
   TexOutput(_T("<CENTER>"));
@@ -444,13 +453,17 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   {
     wxChar buf1[80];
     wxStrcpy(buf1, ConvertCase(wxFileNameFromPath(FileRoot)));
-    wxSprintf(buf, _T("\n<A HREF=\"%s.%s\">%s</A> "), buf1, ConvertCase(_T("htm")), contentsReference);
+    wxSnprintf(buf, sizeof(buf),
+               _T("\n<A HREF=\"%s.%s\">%s</A> "),
+               buf1, ConvertCase(_T("htm")), contentsReference);
   }
   else
   {
     wxChar buf1[80];
     wxStrcpy(buf1, ConvertCase(wxFileNameFromPath(FileRoot)));
-    wxSprintf(buf, _T("\n<A HREF=\"%s%s\">%s</A> "), buf1, ConvertCase(_T("_contents.html")), contentsReference);
+    wxSnprintf(buf, sizeof(buf),
+               _T("\n<A HREF=\"%s%s\">%s</A> "),
+               buf1, ConvertCase(_T("_contents.html")), contentsReference);
   }
 //  TexOutput(_T("<NOFRAMES>"));
   TexOutput(buf);
@@ -464,9 +477,13 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   if (upLabel && upFilename)
   {
     if (wxStrlen(upLabel) > 0)
-      wxSprintf(buf, _T("<A HREF=\"%s#%s\">%s</A> "), ConvertCase(upFilename), upLabel, upReference);
+      wxSnprintf(buf, sizeof(buf),
+                 _T("<A HREF=\"%s#%s\">%s</A> "),
+                 ConvertCase(upFilename), upLabel, upReference);
     else
-      wxSprintf(buf, _T("<A HREF=\"%s\">%s</A> "), ConvertCase(upFilename), upReference);
+      wxSnprintf(buf, sizeof(buf),
+                 _T("<A HREF=\"%s\">%s</A> "),
+                 ConvertCase(upFilename), upReference);
     if (wxStrcmp(upLabel, _T("contents")) == 0)
     {
 //      TexOutput(_T("<NOFRAMES>"));
@@ -484,7 +501,9 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
 
   if (previousLabel && previousFilename)
   {
-    wxSprintf(buf, _T("<A HREF=\"%s#%s\">%s</A> "), ConvertCase(previousFilename), previousLabel, backReference);
+    wxSnprintf(buf, sizeof(buf),
+               _T("<A HREF=\"%s#%s\">%s</A> "),
+               ConvertCase(previousFilename), previousLabel, backReference);
     if (wxStrcmp(previousLabel, _T("contents")) == 0)
     {
 //      TexOutput(_T("<NOFRAMES>"));
@@ -497,7 +516,7 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
   else
   {
     // A placeholder so the buttons don't keep moving position
-    wxSprintf(buf, _T("%s "), backReference);
+    wxSnprintf(buf, sizeof(buf), _T("%s "), backReference);
     TexOutput(buf);
   }
 
@@ -531,13 +550,15 @@ void AddBrowseButtons(wxChar *upLabel, wxChar *upFilename,
 
   if (nextLabel && nextFilename)
   {
-    wxSprintf(buf, _T("<A HREF=\"%s#%s\">%s</A> "), ConvertCase(nextFilename), nextLabel, forwardReference);
+    wxSnprintf(buf, sizeof(buf),
+               _T("<A HREF=\"%s#%s\">%s</A> "),
+               ConvertCase(nextFilename), nextLabel, forwardReference);
     TexOutput(buf);
   }
   else
   {
     // A placeholder so the buttons don't keep moving position
-    wxSprintf(buf, _T("%s "), forwardReference);
+    wxSnprintf(buf, sizeof(buf), _T("%s "), forwardReference);
     TexOutput(buf);
   }
 
@@ -569,13 +590,13 @@ wxChar *ParseColourString(wxChar *bkStr, bool *isPicture)
     wxString token1 = tok.GetNextToken();
     if (!tok.HasMoreTokens())
     {
-      *isPicture = TRUE;
+      *isPicture = true;
       return resStr;
     }
     else
     {
       wxString token2 = tok.GetNextToken();
-      *isPicture = FALSE;
+      *isPicture = false;
       if (tok.HasMoreTokens())
       {
         wxString token3 = tok.GetNextToken();
@@ -622,7 +643,7 @@ void OutputBodyStart(void)
   TexOutput(_T("\n<BODY"));
   if (backgroundImageString)
   {
-    bool isPicture = FALSE;
+    bool isPicture = false;
     wxChar *s = ParseColourString(backgroundImageString, &isPicture);
     if (s)
     {
@@ -633,7 +654,7 @@ void OutputBodyStart(void)
   }
   if (backgroundColourString)
   {
-    bool isPicture = FALSE;
+    bool isPicture = false;
     wxChar *s = ParseColourString(backgroundColourString, &isPicture);
     if (s)
     {
@@ -645,7 +666,7 @@ void OutputBodyStart(void)
   // Set foreground text colour, if one is specified
   if (textColourString)
   {
-    bool isPicture = FALSE;
+    bool isPicture = false;
     wxChar *s = ParseColourString(textColourString, &isPicture);
     if (s)
     {
@@ -655,7 +676,7 @@ void OutputBodyStart(void)
   // Set link text colour, if one is specified
   if (linkColourString)
   {
-    bool isPicture = FALSE;
+    bool isPicture = false;
     wxChar *s = ParseColourString(linkColourString, &isPicture);
     if (s)
     {
@@ -665,7 +686,7 @@ void OutputBodyStart(void)
   // Set followed link text colour, if one is specified
   if (followedLinkColourString)
   {
-    bool isPicture = FALSE;
+    bool isPicture = false;
     wxChar *s = ParseColourString(followedLinkColourString, &isPicture);
     if (s)
     {
@@ -714,7 +735,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
         chapterNo ++;
 
       SetCurrentOutput(NULL);
-      startedSections = TRUE;
+      startedSections = true;
 
       wxChar *topicName = FindTopicName(GetNextChunk());
       ReopenFile(&Chapters, &ChaptersName, topicName);
@@ -733,9 +754,9 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
 
       wxChar titleBuf[200];
       if (truncateFilenames)
-        wxSprintf(titleBuf, _T("%s.htm"), wxFileNameFromPath(FileRoot));
+        wxSnprintf(titleBuf, sizeof(titleBuf), _T("%s.htm"), wxFileNameFromPath(FileRoot));
       else
-        wxSprintf(titleBuf, _T("%s_contents.html"), wxFileNameFromPath(FileRoot));
+        wxSnprintf(titleBuf, sizeof(titleBuf), _T("%s_contents.html"), wxFileNameFromPath(FileRoot));
 
       wxFprintf(Chapters, _T("<A NAME=\"%s\"></A>"), topicName);
 
@@ -779,13 +800,13 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
     {
       subsectionNo = 0;
       subsubsectionNo = 0;
-      subsectionStarted = FALSE;
+      subsectionStarted = false;
 
       if (macroId != ltSECTIONSTAR)
         sectionNo ++;
 
       SetCurrentOutput(NULL);
-      startedSections = TRUE;
+      startedSections = true;
 
       wxChar *topicName = FindTopicName(GetNextChunk());
       ReopenFile(&Sections, &SectionsName, topicName);
@@ -875,8 +896,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             ReopenSectionContentsFile();
           }
 
-          startedSections = TRUE;
-          subsectionStarted = TRUE;
+          startedSections = true;
+          subsectionStarted = true;
 
           wxChar *topicName = FindTopicName(GetNextChunk());
 
@@ -957,7 +978,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
         if (macroId != ltSUBSUBSECTIONSTAR)
           subsubsectionNo ++;
 
-        startedSections = TRUE;
+        startedSections = true;
 
         wxChar *topicName = FindTopicName(GetNextChunk());
 
@@ -1096,9 +1117,9 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
 
         wxChar buf[100];
         if (TableData[currentColumn].justification == 'c')
-          wxSprintf(buf, _T("\n<TD ALIGN=CENTER>"));
+          wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=CENTER>"));
         else if (TableData[currentColumn].justification == 'r')
-          wxSprintf(buf, _T("\n<TD ALIGN=RIGHT>"));
+          wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=RIGHT>"));
         else if (TableData[currentColumn].absWidth)
         {
           // Convert from points * 20 into pixels.
@@ -1107,10 +1128,10 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
           // Say the display is 100 DPI (dots/pixels per inch).
           // There are 72 pts to the inch. So 1pt = 1/72 inch, or 100 * 1/72 dots.
           int pixels = (int)(points * 100.0 / 72.0);
-          wxSprintf(buf, _T("<TD ALIGN=CENTER WIDTH=%d>"), pixels);
+          wxSnprintf(buf, sizeof(buf), _T("<TD ALIGN=CENTER WIDTH=%d>"), pixels);
         }
         else
-          wxSprintf(buf, _T("\n<TD ALIGN=LEFT>"));
+          wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=LEFT>"));
         TexOutput(buf);
                OutputFont();
       }
@@ -1145,9 +1166,9 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
       // Start new row and cell, setting alignment for the first cell.
       wxChar buf[100];
       if (TableData[currentColumn].justification == 'c')
-        wxSprintf(buf, _T("<TR>\n<TD ALIGN=CENTER>"));
+        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=CENTER>"));
       else if (TableData[currentColumn].justification == 'r')
-        wxSprintf(buf, _T("<TR>\n<TD ALIGN=RIGHT>"));
+        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=RIGHT>"));
       else if (TableData[currentColumn].absWidth)
       {
         // Convert from points * 20 into pixels.
@@ -1156,10 +1177,10 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
         // Say the display is 100 DPI (dots/pixels per inch).
         // There are 72 pts to the inch. So 1pt = 1/72 inch, or 100 * 1/72 dots.
         int pixels = (int)(points * 100.0 / 72.0);
-        wxSprintf(buf, _T("<TR>\n<TD ALIGN=CENTER WIDTH=%d>"), pixels);
+        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=CENTER WIDTH=%d>"), pixels);
       }
       else
-        wxSprintf(buf, _T("<TR>\n<TD ALIGN=LEFT>"));
+        wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=LEFT>"));
       TexOutput(buf);
          OutputFont();
     }
@@ -1184,10 +1205,11 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      if (TRUE) // (inVerbatim)
+      #if (1) // if(inVerbatim)
         TexOutput(_T("~"));
-      else
+      #else
         TexOutput(_T(" "));
+      #endif
     }
     break;
   }
@@ -1300,7 +1322,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
     if (start)
     {
       wxChar buf[100];
-      wxSprintf(buf, _T("<PRE>\n"));
+      wxSnprintf(buf, sizeof(buf), _T("<PRE>\n"));
       TexOutput(buf);
     }
     else TexOutput(_T("</PRE>\n"));
@@ -1453,13 +1475,13 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
   case ltCOPYRIGHT:
   {
     if (start)
-      TexOutput(_T("&copy;"), TRUE);
+      TexOutput(_T("&copy;"), true);
     break;
   }
   case ltREGISTERED:
   {
     if (start)
-      TexOutput(_T("&reg;"), TRUE);
+      TexOutput(_T("&reg;"), true);
     break;
   }
   // Arrows
@@ -1682,18 +1704,18 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
           figureNo ++;
 
           if (DocumentStyle != LATEX_ARTICLE)
-            wxSprintf(figBuf, _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);
           else
-            wxSprintf(figBuf, _T("%s %d: "), FigureNameString, figureNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), FigureNameString, figureNo);
       }
       else
       {
           tableNo ++;
 
           if (DocumentStyle != LATEX_ARTICLE)
-            wxSprintf(figBuf, _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);
           else
-            wxSprintf(figBuf, _T("%s %d: "), TableNameString, tableNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), TableNameString, tableNo);
       }
 
       TexOutput(figBuf);
@@ -1720,14 +1742,14 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
   }
   case ltFIGURE:
   {
-    if (start) inFigure = TRUE;
-    else inFigure = FALSE;
+    if (start) inFigure = true;
+    else inFigure = false;
     break;
   }
   case ltTABLE:
   {
-    if (start) inTable = TRUE;
-    else inTable = FALSE;
+    if (start) inTable = true;
+    else inTable = false;
     break;
   }
   default:
@@ -1757,7 +1779,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
   {
     if (!start && (arg_no == 1))
       currentSection = GetArgChunk();
-    return FALSE;
+    return false;
   }
   case ltFUNC:
   {
@@ -1882,19 +1904,19 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       {
         TexOutput(sec);
       }
-      return FALSE;
+      return false;
     }
     break;
   }
   case ltURLREF:
   {
     if (IsArgOptional())
-      return FALSE;
+      return false;
     else if ((GetNoArgs() - arg_no) == 1)
     {
       if (start)
         helpRefText = GetArgChunk();
-      return FALSE;
+      return false;
     }
     else if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional
     {
@@ -1902,15 +1924,15 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       {
         TexChunk *ref = GetArgChunk();
         TexOutput(_T("<A HREF=\""));
-        inVerbatim = TRUE;
+        inVerbatim = true;
         TraverseChildrenFromChunk(ref);
-        inVerbatim = FALSE;
+        inVerbatim = false;
         TexOutput(_T("\">"));
         if (helpRefText)
           TraverseChildrenFromChunk(helpRefText);
         TexOutput(_T("</A>"));
       }
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -1922,13 +1944,13 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
     {
       if (start)
         helpRefFilename = GetArgChunk();
-      return FALSE;
+      return false;
     }
     if ((GetNoArgs() - arg_no) == 1)
     {
       if (start)
         helpRefText = GetArgChunk();
-      return FALSE;
+      return false;
     }
     else if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional
     {
@@ -1977,7 +1999,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
         else TexOutput(_T("??"));
       }
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -2064,12 +2086,12 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           TexOutput(_T("<A HREF=\""));
           TexOutput(ConvertCase(wxFileNameFromPath(filename)));
           TexOutput(_T("\">Picture</A>\n"));
-          wxSprintf(buf, _T("Warning: could not find an inline XBM/GIF for %s."), filename);
+          wxSnprintf(buf, sizeof(buf), _T("Warning: could not find an inline XBM/GIF for %s."), filename);
           OnInform(buf);
         }
       }
     }
-    return FALSE;
+    return false;
   }
   // First arg is PSBOX spec (ignored), second is image file, third is map name.
   case ltIMAGEMAP:
@@ -2096,7 +2118,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       if (f == _T(""))
       {
         wxChar buf[300];
-        wxSprintf(buf, _T("Warning: could not find an inline XBM/GIF for %s."), filename);
+        wxSnprintf(buf, sizeof(buf), _T("Warning: could not find an inline XBM/GIF for %s."), filename);
         OnInform(buf);
       }
       delete[] filename;
@@ -2140,15 +2162,15 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         imageFile = NULL;
       }
     }
-    return FALSE;
+    return false;
   }
   case ltINDENTED :
   {
     if ( arg_no == 1 )
-        return FALSE;
+        return false;
     else
     {
-        return TRUE;
+        return true;
     }
   }
   case ltITEM:
@@ -2156,9 +2178,9 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
     if (start)
     {
       descriptionItemArg = GetArgChunk();
-      return FALSE;
+      return false;
     }
-    return TRUE;
+    return true;
   }
   case ltTWOCOLITEM:
   case ltTWOCOLITEMRULED:
@@ -2175,7 +2197,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         // DHS
        if (TwoColWidthA > -1) {
           wxChar buf[100];
-          wxSprintf(buf,_T("\n<TR><TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthA);
+          wxSnprintf(buf, sizeof(buf), _T("\n<TR><TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthA);
           TexOutput(buf);
         } else
           TexOutput(_T("\n<TR><TD VALIGN=TOP>\n"));
@@ -2189,7 +2211,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       if ( start ) {
        if (TwoColWidthB > -1) {
           wxChar buf[100];
-          wxSprintf(buf,_T("\n<TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthB);
+          wxSnprintf(buf, sizeof(buf), _T("\n<TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthB);
           TexOutput(buf);
         } else 
            TexOutput(_T("\n<TD VALIGN=TOP>\n"));
@@ -2197,7 +2219,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       }  else
            TexOutput(_T("\n</FONT></TD></TR>\n"));
     }
-    return TRUE;
+    return true;
   }
   case ltNUMBEREDBIBITEM:
   {
@@ -2219,18 +2241,18 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       if (ref)
       {
         if (ref->sectionNumber) delete[] ref->sectionNumber;
-        wxSprintf(buf, _T("[%d]"), citeCount);
+        wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
         ref->sectionNumber = copystring(buf);
       }
 
-      wxSprintf(buf, _T("\n<DT> [%d] "), citeCount);
+      wxSnprintf(buf, sizeof(buf), _T("\n<DT> [%d] "), citeCount);
       TexOutput(buf);
       citeCount ++;
-      return FALSE;
+      return false;
     }
     if (arg_no == 2 && !start)
       TexOutput(_T("<P>\n"));
-    return TRUE;
+    return true;
   }
   case ltMARGINPAR:
   case ltMARGINPARODD:
@@ -2241,7 +2263,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
     if (start)
     {
       TexOutput(_T("<HR>\n"));
-      return TRUE;
+      return true;
     }
     else
       TexOutput(_T("<HR><P>\n"));
@@ -2256,7 +2278,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       float points = ParseUnitArgument(val);
       TwoColWidthA = (int)((points * 100.0) / 72.0);
     }
-    return FALSE;
+    return false;
   }
   // DHS
   case ltTWOCOLWIDTHB:
@@ -2267,7 +2289,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       float points = ParseUnitArgument(val);
       TwoColWidthB = (int)((points * 100.0) / 72.0);
     }
-    return FALSE;
+    return false;
   }
   /*
    * Accents
@@ -2317,7 +2339,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_ACUTE:
   {
@@ -2369,7 +2391,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_CARET:
   {
@@ -2415,7 +2437,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_TILDE:
   {
@@ -2452,7 +2474,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_UMLAUT:
   {
@@ -2504,7 +2526,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_DOT:
   {
@@ -2526,7 +2548,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltBACKGROUND:
   {
@@ -2535,7 +2557,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       wxChar *val = GetArgData();
       if (val)
       {
-        bool isPicture = FALSE;
+        bool isPicture = false;
         ParseColourString(val, &isPicture);
         if (isPicture)
         {
@@ -2551,7 +2573,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltBACKGROUNDIMAGE:
   {
@@ -2565,7 +2587,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         backgroundImageString = copystring(val);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltBACKGROUNDCOLOUR:
   {
@@ -2579,7 +2601,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         backgroundColourString = copystring(val);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltTEXTCOLOUR:
   {
@@ -2593,7 +2615,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         textColourString = copystring(val);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltLINKCOLOUR:
   {
@@ -2607,7 +2629,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         linkColourString = copystring(val);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltFOLLOWEDLINKCOLOUR:
   {
@@ -2621,7 +2643,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         followedLinkColourString = copystring(val);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_CADILLA:
   {
@@ -2643,16 +2665,16 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
 /*
   case ltFOOTNOTE:
   case ltFOOTNOTEPOPUP:
   {
     if (arg_no == 1)
-      return TRUE;
+      return true;
     else
-      return FALSE;
+      return false;
     break;
   }
 */
@@ -2664,10 +2686,10 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       if (start)
       {
         currentRowNumber = 0;
-        inTabular = TRUE;
-        startRows = TRUE;
-        tableVerticalLineLeft = FALSE;
-        tableVerticalLineRight = FALSE;
+        inTabular = true;
+        startRows = true;
+        tableVerticalLineLeft = false;
+        tableVerticalLineRight = false;
 
         wxChar *alignString = copystring(GetArgData());
         ParseTableArgument(alignString);
@@ -2684,7 +2706,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           for (int i = 0; i < noColumns; i++)
           {
             currentWidth += TableData[i].width;
-            wxSprintf(buf, _T("\\cellx%d"), currentWidth);
+            wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
             TexOutput(buf);
           }
           TexOutput(_T("\\pard\\intbl\n"));
@@ -2692,13 +2714,13 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
         delete[] alignString;
 
-        return FALSE;
+        return false;
       }
     }
     else if (arg_no == 2 && !start)
     {
       TexOutput(_T("</TABLE>\n"));
-      inTabular = FALSE;
+      inTabular = false;
     }
     break;
   }
@@ -2716,9 +2738,9 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
 
       wxChar titleBuf[150];
       if (truncateFilenames)
-        wxSprintf(titleBuf, _T("%s.htm"), wxFileNameFromPath(FileRoot));
+        wxSnprintf(titleBuf, sizeof(titleBuf), _T("%s.htm"), wxFileNameFromPath(FileRoot));
       else
-        wxSprintf(titleBuf, _T("%s_contents.html"), wxFileNameFromPath(FileRoot));
+        wxSnprintf(titleBuf, sizeof(titleBuf), _T("%s_contents.html"), wxFileNameFromPath(FileRoot));
 
       HTMLHead();
       TexOutput(_T("<title>"));
@@ -2738,12 +2760,12 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       wxFprintf(Chapters, _T("</H2>\n</A>\n"));
 
       SetCurrentOutput(Chapters);
-      return FALSE;
+      return false;
     }
     if (!start && (arg_no == 2))
     {
     }
-    return TRUE;
+    return true;
   }
   case ltINDEX:
   {
@@ -2758,7 +2780,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         AddKeyWordForTopic(CurrentTopic, buf, currentFileName);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltFCOL:
 //  case ltBCOL:
@@ -2775,7 +2797,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           {
             wxStrcpy(buf2, _T("#000000"));
             wxChar buf[100];
-                       wxSprintf(buf, _T("Could not find colour name %s"), name);
+                       wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
             OnError(buf);
           }
           TexOutput(_T("<FONT COLOR=\""));
@@ -2785,7 +2807,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         }
         case 2:
         {
-          return TRUE;
+          return true;
         }
         default:
           break;
@@ -2795,14 +2817,14 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
     {
       if (arg_no == 2) TexOutput(_T("</FONT>"));
     }
-    return FALSE;
+    return false;
   }
   case ltINSERTATLEVEL:
   {
     // This macro allows you to insert text at a different level
     // from the current level, e.g. into the Sections from within a subsubsection.
     if (useWord)
-        return FALSE;
+        return false;
     static int currentLevelNo = 1;
     static FILE* oldLevelFile = Chapters;
     if (start)
@@ -2847,16 +2869,16 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           }
           if (outputFile)
             CurrentOutput1 = outputFile;
-          return FALSE;
+          return false;
         }
         case 2:
         {
-          return TRUE;
+          return true;
         }
         default:
           break;
       }
-      return TRUE;
+      return true;
     }
     else
     {
@@ -2864,24 +2886,24 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         {
             CurrentOutput1 = oldLevelFile;
         }
-        return TRUE;
+        return true;
     }
   }
   default:
     return DefaultOnArgument(macroId, arg_no, start);
   }
-  return TRUE;
+  return true;
 }
 
 bool HTMLGo(void)
 {
   fileId = 0;
-  inVerbatim = FALSE;
+  inVerbatim = false;
   indentLevel = 0;
-  inTabular = FALSE;
-  startRows = FALSE;
-  tableVerticalLineLeft = FALSE;
-  tableVerticalLineRight = FALSE;
+  inTabular = false;
+  startRows = false;
+  tableVerticalLineLeft = false;
+  tableVerticalLineRight = false;
   noColumns = 0;
 
   if (InputFile && OutputFile)
@@ -2892,17 +2914,17 @@ bool HTMLGo(void)
 
     wxChar buf[300];
     if (truncateFilenames)
-      wxSprintf(buf, _T("%s.htm"), FileRoot);
+      wxSnprintf(buf, sizeof(buf), _T("%s.htm"), FileRoot);
     else
-      wxSprintf(buf, _T("%s_contents.html"), FileRoot);
+      wxSnprintf(buf, sizeof(buf), _T("%s_contents.html"), FileRoot);
     if (TitlepageName) delete[] TitlepageName;
     TitlepageName = copystring(buf);
     Titlepage = wxFopen(buf, _T("w"));
 
     if (truncateFilenames)
-      wxSprintf(buf, _T("%s_fc.htm"), FileRoot);
+      wxSnprintf(buf, sizeof(buf), _T("%s_fc.htm"), FileRoot);
     else
-      wxSprintf(buf, _T("%s_fcontents.html"), FileRoot);
+      wxSnprintf(buf, sizeof(buf), _T("%s_fcontents.html"), FileRoot);
 
     contentsFrameName = copystring(buf);
 
@@ -2918,7 +2940,7 @@ bool HTMLGo(void)
     if (!Titlepage || !Contents)
     {
       OnError(_T("Cannot open output file!"));
-      return FALSE;
+      return false;
     }
     AddTexRef(_T("contents"), wxFileNameFromPath(TitlepageName), ContentsNameString);
 
@@ -3012,7 +3034,7 @@ bool HTMLGo(void)
       {
         wxChar firstFileName[300];
         if (truncateFilenames)
-          wxSprintf(firstFileName, _T("%s1.htm"), FileRoot);
+          wxSnprintf(firstFileName, sizeof(firstFileName), _T("%s1.htm"), FileRoot);
         else
           wxStrcpy(firstFileName, gs_filenames[1].c_str());
 
@@ -3075,7 +3097,7 @@ bool HTMLGo(void)
     if (htmlIndex)
     {
       wxChar htmlIndexName[300];
-      wxSprintf(htmlIndexName, _T("%s.htx"), FileRoot);
+      wxSnprintf(htmlIndexName, sizeof(htmlIndexName), _T("%s.htx"), FileRoot);
       GenerateHTMLIndexFile(htmlIndexName);
     }
 
@@ -3087,10 +3109,10 @@ bool HTMLGo(void)
     }
 
 
-    return TRUE;
+    return true;
   }
 
-  return FALSE;
+  return false;
 }
 
 // Output .htx index file
@@ -3137,7 +3159,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
 
   /* Generate project file : */
 
-  wxSprintf(buf, _T("%s.hhp"), fname);
+  wxSnprintf(buf, sizeof(buf), _T("%s.hhp"), fname);
   f = wxFopen(buf, _T("wt"));
   wxFprintf(f,
       _T("[OPTIONS]\n")
@@ -3174,7 +3196,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
   wxFprintf(f, _T("%s\n"), wxFileNameFromPath(TitlepageName));
   for (int i = 1; i <= fileId; i++) {
     if (truncateFilenames)
-      wxSprintf(buf, _T("%s%d.htm"), wxFileNameFromPath(FileRoot), i);
+      wxSnprintf(buf, sizeof(buf), _T("%s%d.htm"), wxFileNameFromPath(FileRoot), i);
     else
       wxStrcpy(buf, wxFileNameFromPath(gs_filenames[i].c_str()));
     wxFprintf(f, _T("%s\n"), buf);
@@ -3183,7 +3205,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
 
   /* Generate index file : */
 
-  wxSprintf(buf, _T("%s.hhk"), fname);
+  wxSnprintf(buf, sizeof(buf), _T("%s.hhk"), fname);
   f = wxFopen(buf, _T("wt"));
 
   wxFprintf(f,
@@ -3261,7 +3283,7 @@ void HTMLWorkshopAddToContents(int level, wxChar *s, wxChar *file)
 void HTMLWorkshopStartContents()
 {
   wxChar buf[300];
-  wxSprintf(buf, _T("%s.hhc"), FileRoot);
+  wxSnprintf(buf, sizeof(buf), _T("%s.hhc"), FileRoot);
   HTMLWorkshopContents = wxFopen(buf, _T("wt"));
   HTMLWorkshopLastLevel = 0;
 
index a7454b736c544639c5cd6dad2157f62a8d270e9b..6d3ffaff2bb8ba3850da51c996e04e6e901b3e94 100644 (file)
@@ -6,7 +6,8 @@
 //              reverse-engineering
 //              and guesswork at its best.
 // Author:      Petr Smilauer
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     01/01/99
 // RCS-ID:      $Id$
 // Copyright:   (c) Petr Smilauer
@@ -116,10 +117,10 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
   HotSpot *hotspots = NULL;
   int n = ParseSHG(filename, &hotspots);
   if (n == 0)
-    return FALSE;
+    return false;
 
   wxChar buf[100];
-  wxSprintf(buf, _T("Converting .SHG file to HTML map file: there are %d hotspots in %s."), n, filename);
+  wxSnprintf(buf, sizeof(buf), _T("Converting .SHG file to HTML map file: there are %d hotspots in %s."), n, filename);
   OnInform(buf);
 
   wxChar outBuf[256];
@@ -132,7 +133,7 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
   {
     OnError(_T("Could not open .map file for writing."));
     delete[] hotspots;
-    return FALSE;
+    return false;
   }
 
   wxFprintf(fd, _T("default %s\n"), defaultFile);
@@ -146,7 +147,7 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
     else
     {
       wxChar buf[300];
-      wxSprintf(buf, _T("Warning: could not find hotspot reference %s"), hotspots[i].szHlpTopic_Macro);
+      wxSnprintf(buf, sizeof(buf), _T("Warning: could not find hotspot reference %s"), hotspots[i].szHlpTopic_Macro);
       OnInform(buf);
     }
     wxFprintf(fd, _T("rect %s %d %d %d %d\n"), refFilename, (int)hotspots[i].left, (int)hotspots[i].top,
@@ -157,6 +158,6 @@ bool SHGToMap(wxChar *filename, wxChar *defaultFile)
   fclose(fd);
 
   delete[] hotspots;
-  return TRUE;
+  return true;
 }
 
index 0cb5eeecdf47e305412306874228bed8447556d0..20bd6e35f023d68ae2a9358411c13a837020fcf0 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        rtfutils.cpp
 // Purpose:     Converts Latex to Word RTF/WinHelp RTF
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -65,17 +66,17 @@ extern wxChar *BigBuffer;
 extern wxHashTable TexReferences;
 
 // Are we in verbatim mode? If so, format differently.
-static bool inVerbatim = FALSE;
+static bool inVerbatim = false;
 
 // We're in a series of PopRef topics, so don't output section headings
-bool inPopRefSection = FALSE;
+bool inPopRefSection = false;
 
 // Green colour?
-static bool hotSpotColour = TRUE;
-static bool hotSpotUnderline = TRUE;
+static bool hotSpotColour = true;
+static bool hotSpotUnderline = true;
 
 // Transparency (WHITE = transparent)
-static bool bitmapTransparency = TRUE;
+static bool bitmapTransparency = true;
 
 // Linear RTF requires us to set the style per section.
 static wxChar *currentNumberStyle = NULL;
@@ -109,8 +110,8 @@ int issuedNewParagraph = 0;
 
 // Need to know whether we're in a table or figure for benefit
 // of listoffigures/listoftables
-static bool inFigure = FALSE;
-static bool inTable = FALSE;
+static bool inFigure = false;
+static bool inTable = false;
 
 /*
  * Current topics
@@ -124,10 +125,10 @@ static wxChar *CurrentTopic = NULL;
 static bool InPopups()
 {
   if (CurrentChapterName && (wxStrcmp(CurrentChapterName, _T("popups")) == 0))
-    return TRUE;
+    return true;
   if (CurrentSectionName && (wxStrcmp(CurrentSectionName, _T("popups")) == 0))
-    return TRUE;
-  return FALSE;
+    return true;
+  return false;
 }
 
 static void SetCurrentTopic(wxChar *s)
@@ -190,7 +191,7 @@ void NotifyParentHasChildren(int parentLevel)
       texTopic = new TexTopic;
       TopicTable.Put(parentTopic, texTopic);
     }
-    texTopic->hasChildren = TRUE;
+    texTopic->hasChildren = true;
   }
 }
 
@@ -206,10 +207,10 @@ void ResetContentsLevels(int l)
 {
   int i;
   for (i = l; i < 5; i++)
-    ContentsLevels[i] = FALSE;
+    ContentsLevels[i] = false;
     
   // There are always books on the top level
-  ContentsLevels[0] = TRUE;
+  ContentsLevels[0] = true;
 }
 
 // Output a WinHelp section as a keyword, substituting
@@ -292,7 +293,7 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level)
 
         // Remember that at this level, we had a book and *must* for the
         // remainder of sections at this level.
-        ContentsLevels[level-1] = TRUE;
+        ContentsLevels[level-1] = true;
       }
       else
       {
@@ -306,7 +307,7 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level)
         // Always have a book at level 1
         wxFprintf(WinHelpContentsFile, _T("%d %s\n"), level, title);
         wxFprintf(WinHelpContentsFile, _T("%d %s=%s\n"), level+1, title, topicName);
-        ContentsLevels[level-1] = TRUE;
+        ContentsLevels[level-1] = true;
       }
       else
         // Probably doesn't have children if it hasn't been added to the topic table
@@ -539,7 +540,7 @@ bool WriteHPJ(wxChar *filename)
   
   FILE *fd = wxFopen(hpjFilename, _T("w"));
   if (!fd)
-    return FALSE;
+    return false;
 
   wxChar *helpTitle = winHelpTitle;
   if (!helpTitle)
@@ -580,7 +581,7 @@ bool WriteHPJ(wxChar *filename)
   wxFprintf(fd, _T("BrowseButtons()\n\n"));
   wxFprintf(fd, _T("[MAP]\n\n[BITMAPS]\n\n"));
   fclose(fd);
-  return TRUE;
+  return true;
 }
 
 
@@ -594,7 +595,7 @@ bool WriteHPJ(wxChar *filename)
 
 void ProcessText2RTF(TexChunk *chunk)
 {
-  bool changed = FALSE;
+  bool changed = false;
   int ptr = 0;
   int i = 0;
   wxChar ch = 1;
@@ -610,7 +611,7 @@ void ProcessText2RTF(TexChunk *chunk)
         BigBuffer[ptr] = 0; wxStrcat(BigBuffer, _T("\\par\n")); ptr += 5;
 //        BigBuffer[ptr] = 0; wxStrcat(BigBuffer, _T("\\par{\\v this was verbatim}\n")); ptr += 5;
         i ++;
-        changed = TRUE;
+        changed = true;
       }
       else
       {
@@ -626,7 +627,7 @@ void ProcessText2RTF(TexChunk *chunk)
             ((len > i+1 && chunk->value[i+1] == 13) &&
              (len > i+2 && isascii(chunk->value[i+2]) &&
               !isspace(chunk->value[i+2]))))
-//        if (TRUE)
+//        if (true)
         {
           // DOS files have a 13 after the 10
           BigBuffer[ptr] = 10;
@@ -644,7 +645,7 @@ void ProcessText2RTF(TexChunk *chunk)
 
           // Note that the actual ASCII character seen is dealt with in the next
           // iteration
-          changed = TRUE;
+          changed = true;
         }
         else
         {
@@ -657,27 +658,27 @@ void ProcessText2RTF(TexChunk *chunk)
     {
       BigBuffer[ptr] = '"'; ptr ++;
       i += 2;
-      changed = TRUE;
+      changed = true;
     }
     else if (!inVerbatim && ch == '`') // Change ` to '
     {
       BigBuffer[ptr] = 39; ptr ++;
       i += 1;
-      changed = TRUE;
+      changed = true;
     }
     else if (inVerbatim && ch == '\\') // Change backslash to two backslashes
     {
       BigBuffer[ptr] = '\\'; ptr ++;
       BigBuffer[ptr] = '\\'; ptr ++;
       i += 1;
-      changed = TRUE;
+      changed = true;
     }
     else if (inVerbatim && (ch == '{' || ch == '}')) // Escape the curley bracket
     {
       BigBuffer[ptr] = '\\'; ptr ++;
       BigBuffer[ptr] = ch; ptr ++;
       i += 1;
-      changed = TRUE;
+      changed = true;
     }
     else
     {
@@ -717,7 +718,7 @@ void Text2RTF(TexChunk *chunk)
         return;
 
       if (def && (def->macroId == ltVERBATIM || def->macroId == ltVERB))
-        inVerbatim = TRUE;
+        inVerbatim = true;
 
       wxNode *node = chunk->children.GetFirst();
       while (node)
@@ -728,7 +729,7 @@ void Text2RTF(TexChunk *chunk)
       }
 
       if (def && (def->macroId == ltVERBATIM || def->macroId == ltVERB))
-        inVerbatim = FALSE;
+        inVerbatim = false;
 
       break;
     }
@@ -764,7 +765,7 @@ wxChar *GetBrowseString(void)
 {
   wxChar buf[10];
   browseId ++;
-  wxSprintf(buf, _T("%ld"), browseId);
+  wxSnprintf(buf, sizeof(buf), _T("%ld"), browseId);
   int noZeroes = 5-wxStrlen(buf);
   wxStrcpy(browseBuf, _T("browse"));
   for (int i = 0; i < noZeroes; i++)
@@ -808,7 +809,7 @@ void WriteEnvironmentStyles(void)
   if (!inTabular && (ParIndent > 0) && (forbidParindent == 0))
   {
     wxChar buf[15];
-    wxSprintf(buf, _T("\\fi%d"), ParIndent*20); // Convert points to TWIPS
+    wxSnprintf(buf, sizeof(buf), _T("\\fi%d"), ParIndent*20); // Convert points to TWIPS
     TexOutput(buf);
   }
   if (environmentStack.GetCount() > 0 || (ParIndent > 0))
@@ -843,12 +844,12 @@ void OutputRTFHeaderCommands(void)
     TexOutput(_T("{\\i \\qr "));
     if (DocumentStyle == LATEX_ARTICLE)
     {
-      wxSprintf(buf, _T("SECTION %d"), sectionNo);
+      wxSnprintf(buf, sizeof(buf), _T("SECTION %d"), sectionNo);
       TexOutput(buf);
     }
     else
     {
-      wxSprintf(buf, _T("CHAPTER %d: "), chapterNo);
+      wxSnprintf(buf, sizeof(buf), _T("CHAPTER %d: "), chapterNo);
       TexOutput(buf);
     }
     TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
@@ -863,12 +864,12 @@ void OutputRTFHeaderCommands(void)
     TexOutput(_T("{\\i \\qc "));
     if (DocumentStyle == LATEX_ARTICLE)
     {
-      wxSprintf(buf, _T("SECTION %d"), sectionNo);
+      wxSnprintf(buf, sizeof(buf), _T("SECTION %d"), sectionNo);
       TexOutput(buf);
     }
     else
     {
-      wxSprintf(buf, _T("CHAPTER %d"), chapterNo);
+      wxSnprintf(buf, sizeof(buf), _T("CHAPTER %d"), chapterNo);
       TexOutput(buf);
     }
     TexOutput(_T("{\\field{\\*\\fldinst PAGE \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
@@ -1075,7 +1076,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
 {
 /*
   wxChar tmpBuf[40];
-  wxSprintf(tmpBuf, _T("%d (%d)"), macroId, (int)start);
+  wxSnprintf(tmpBuf, sizeof(tmpBuf), _T("%d (%d)"), macroId, (int)start);
   OutputDebugString("RTFOnMacro Start "); OutputDebugString(tmpBuf);
   OutputDebugString("\n"); wxYield();
 */
@@ -1168,7 +1169,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         }
       }
   
-      startedSections = TRUE;
+      startedSections = true;
 
       // Output heading to contents page
       if (!InPopups())
@@ -1324,7 +1325,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         if (winHelp)
           wxFprintf(Sections, _T("\\page\n"));
       }
-      startedSections = TRUE;
+      startedSections = true;
 
       if (winHelp)
         wxFprintf(Sections, _T("\n${\\footnote "));
@@ -1491,7 +1492,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
           wxFprintf(Chapters, _T("\\par\n"));
 #endif        
       }
-      startedSections = TRUE;
+      startedSections = true;
 
       if (winHelp)
         wxFprintf(Subsections, _T("\n${\\footnote "));
@@ -1652,7 +1653,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
 #endif        
       }
 
-      startedSections = TRUE;
+      startedSections = true;
 
       if (winHelp)
         wxFprintf(Subsubsections, _T("\n${\\footnote "));
@@ -1764,13 +1765,13 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         if (winHelp || !useWord)
         {
           if (DocumentStyle != LATEX_ARTICLE)
-            wxSprintf(figBuf, _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);
           else
-            wxSprintf(figBuf, _T("%s %d: "), FigureNameString, figureNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), FigureNameString, figureNo);
         }
         else
         {
-          wxSprintf(figBuf, _T("%s {\\field\\flddirty{\\*\\fldinst  SEQ Figure \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: "),
+          wxSnprintf(figBuf, sizeof(figBuf), _T("%s {\\field\\flddirty{\\*\\fldinst  SEQ Figure \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: "),
                FigureNameString, topicName, topicName);
         }
       }
@@ -1781,13 +1782,13 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         if (winHelp || !useWord)
         {
           if (DocumentStyle != LATEX_ARTICLE)
-            wxSprintf(figBuf, _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);
           else
-            wxSprintf(figBuf, _T("%s %d: "), TableNameString, tableNo);
+            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), TableNameString, tableNo);
         }
         else
         {
-          wxSprintf(figBuf, _T("%s {\\field\\flddirty{\\*\\fldinst  SEQ Table \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: "),
+          wxSnprintf(figBuf, sizeof(figBuf), _T("%s {\\field\\flddirty{\\*\\fldinst  SEQ Table \\\\* ARABIC }{\\fldrslt {\\bkmkstart %s}??{\\bkmkend %s}}}: "),
                TableNameString, topicName, topicName);
         }
       }
@@ -1824,18 +1825,18 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       if (winHelp)
       {
         TexOutput(_T("K{\\footnote {K} "));
-        suppressNameDecoration = TRUE;
+        suppressNameDecoration = true;
         TraverseChildrenFromChunk(currentMember);
-        suppressNameDecoration = FALSE;
+        suppressNameDecoration = false;
         TexOutput(_T("}\n"));
       }
       if (!winHelp && useWord)
       {
         // Insert index entry for this function
         TexOutput(_T("{\\xe\\v {"));
-        suppressNameDecoration = TRUE;  // Necessary so don't print "(\\bf" etc.
+        suppressNameDecoration = true;  // Necessary so don't print "(\\bf" etc.
         TraverseChildrenFromChunk(currentMember);
-        suppressNameDecoration = FALSE;
+        suppressNameDecoration = false;
         TexOutput(_T("}}"));
       }
     }
@@ -1854,18 +1855,18 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       if (winHelp)
       {
         TexOutput(_T("K{\\footnote {K} "));
-        suppressNameDecoration = TRUE;  // Necessary so don't print "(\\bf" etc.
+        suppressNameDecoration = true;  // Necessary so don't print "(\\bf" etc.
         TraverseChildrenFromChunk(currentMember);
-        suppressNameDecoration = FALSE;
+        suppressNameDecoration = false;
         TexOutput(_T("}\n"));
       }
       if (!winHelp && useWord)
       {
         // Insert index entry for this function
         TexOutput(_T("{\\xe\\v {"));
-        suppressNameDecoration = TRUE;  // Necessary so don't print "(\\bf" etc.
+        suppressNameDecoration = true;  // Necessary so don't print "(\\bf" etc.
         TraverseChildrenFromChunk(currentMember);
-        suppressNameDecoration = FALSE;
+        suppressNameDecoration = false;
         TexOutput(_T("}}"));
       }
     }
@@ -1891,9 +1892,9 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       {
         // Insert index entry for this function
         TexOutput(_T("{\\xe\\v {"));
-        suppressNameDecoration = TRUE;  // Necessary so don't print "(\\bf" etc.
+        suppressNameDecoration = true;  // Necessary so don't print "(\\bf" etc.
         TraverseChildrenFromChunk(currentMember);
-        suppressNameDecoration = FALSE;
+        suppressNameDecoration = false;
         TexOutput(_T("}}"));
       }
     }
@@ -1915,10 +1916,10 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         TexOutput(_T("\\par\\pard\\pgnrestart\\sect\\titlepg"));
 
        // In linear RTF, same as chapter headings.
-        wxSprintf(buf, _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"), chapterFont*2, ContentsNameString);
+        wxSnprintf(buf, sizeof(buf), _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"), chapterFont*2, ContentsNameString);
 
         TexOutput(buf);
-        wxSprintf(buf, _T("{\\field{\\*\\fldinst TOC \\\\o \"1-%d\" }{\\fldrslt PRESS F9 TO REFORMAT CONTENTS}}\n"), contentsDepth);
+        wxSnprintf(buf, sizeof(buf), _T("{\\field{\\*\\fldinst TOC \\\\o \"1-%d\" }{\\fldrslt PRESS F9 TO REFORMAT CONTENTS}}\n"), contentsDepth);
         TexOutput(buf);
 //        TexOutput(_T("\\sect\\sectd"));
       }
@@ -1977,10 +1978,11 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      if (TRUE) // (inVerbatim)
+      #if 1 // if(inVerbatim)
         TexOutput(_T("~"));
-      else
+      #else
         TexOutput(_T(" "));
+      #endif
     }
     break;
   }
@@ -2002,7 +2004,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
           if (TableData[i].leftBorder)
             TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
           
-          wxSprintf(buf, _T("\\cellx%d"), currentWidth);
+          wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
           TexOutput(buf);
         }
         TexOutput(_T("\\pard\\intbl\n"));
@@ -2071,7 +2073,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       ItemizeStruc *struc = new ItemizeStruc(listType, indentSize2, indentSize1);
       itemizeStack.Insert(struc);
       
-      wxSprintf(buf, _T("\\tx%d\\tx%d\\li%d\\sa200"), indentSize1, indentSize2, indentSize2);
+      wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\tx%d\\li%d\\sa200"), indentSize1, indentSize2, indentSize2);
       PushEnvironmentStyle(buf);
     }
     else
@@ -2089,8 +2091,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
 /* Change 18/7/97 - don't know why we wish to do this
       if (itemizeStack.Number() == 0)
       {
-        OnMacro(ltPAR, 0, TRUE);
-        OnMacro(ltPAR, 0, FALSE);
+        OnMacro(ltPAR, 0, true);
+        OnMacro(ltPAR, 0, false);
         issuedNewParagraph = 2;
       }
 */
@@ -2112,8 +2114,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       ItemizeStruc *struc = new ItemizeStruc(LATEX_TWOCOL, indentSize);
       itemizeStack.Insert(struc);
       
-//      wxSprintf(buf, _T("\\tx%d\\li%d\\ri%d"), indentSize, indentSize, TwoColWidthA+TwoColWidthB+oldIndent);
-      wxSprintf(buf, _T("\\tx%d\\li%d\\sa200"), indentSize, indentSize);
+//      wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\ri%d"), indentSize, indentSize, TwoColWidthA+TwoColWidthB+oldIndent);
+      wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200"), indentSize, indentSize);
       PushEnvironmentStyle(buf);
     }
     else
@@ -2138,8 +2140,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       if (itemizeStack.GetCount() == 0)
       {
         issuedNewParagraph = 0;
-        OnMacro(ltPAR, 0, TRUE);
-        OnMacro(ltPAR, 0, FALSE);
+        OnMacro(ltPAR, 0, true);
+        OnMacro(ltPAR, 0, false);
       }
 #endif      
     }
@@ -2171,7 +2173,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
 //          WriteEnvironmentStyles();
         }
 
-        wxSprintf(buf, _T("\\tx%d\\tx%d\\li%d\\fi-%d\n"), indentSize1, indentSize2,
+        wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\tx%d\\li%d\\fi-%d\n"), indentSize1, indentSize2,
                   indentSize2, 20*itemIndentTab);
         TexOutput(buf);
 
@@ -2188,7 +2190,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
            }
            else
            {
-              wxSprintf(indentBuf, _T("\\tab{\\b %d.}\\tab"), struc->currentItem);
+              wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab{\\b %d.}\\tab"), struc->currentItem);
               TexOutput(indentBuf);
             }
             break;
@@ -2207,14 +2209,14 @@ void RTFOnMacro(int macroId, int no_args, bool start)
               if (bulletFile && winHelp)
               {
                 if (winHelpVersion > 3) // Transparent bitmap
-                  wxSprintf(indentBuf, _T("\\tab\\{bmct %s\\}\\tab"), bulletFile);
+                  wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab\\{bmct %s\\}\\tab"), bulletFile);
                 else
-                  wxSprintf(indentBuf, _T("\\tab\\{bmc %s\\}\\tab"), bulletFile);
+                  wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab\\{bmc %s\\}\\tab"), bulletFile);
               }
               else if (winHelp)
-                wxSprintf(indentBuf, _T("\\tab{\\b o}\\tab"));
+                wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab{\\b o}\\tab"));
               else
-                wxSprintf(indentBuf, _T("\\tab{\\f1\\'b7}\\tab"));
+                wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\tab{\\f1\\'b7}\\tab"));
               TexOutput(indentBuf);
             }
             break;
@@ -2266,13 +2268,13 @@ void RTFOnMacro(int macroId, int no_args, bool start)
         }
 #endif        
 
-//        wxSprintf(buf, _T("\\tx%d\\li%d\\fi-%d\\ri%d\n"), TwoColWidthA,
+//        wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\\ri%d\n"), TwoColWidthA,
 //             TwoColWidthA, TwoColWidthA, TwoColWidthA+TwoColWidthB+oldIndent);
 /*
-        wxSprintf(buf, _T("\\tx%d\\li%d\\fi-%d\n"), TwoColWidthA,
+        wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\n"), TwoColWidthA,
              TwoColWidthA, TwoColWidthA);
 */
-        wxSprintf(buf, _T("\\tx%d\\li%d\\fi-%d\n"), TwoColWidthA + oldIndent,
+        wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\n"), TwoColWidthA + oldIndent,
              TwoColWidthA + oldIndent, TwoColWidthA);
         TexOutput(buf);
       }
@@ -2299,9 +2301,9 @@ void RTFOnMacro(int macroId, int no_args, bool start)
 #endif
       
       if (macroId == ltVERBATIM)
-        wxSprintf(buf, _T("{\\f3\\s10\\fs20\\li720\\sa0 "));
+        wxSnprintf(buf, sizeof(buf), _T("{\\f3\\s10\\fs20\\li720\\sa0 "));
       else
-        wxSprintf(buf, _T("{\\f3\\fs20 "));
+        wxSnprintf(buf, sizeof(buf), _T("{\\f3\\fs20 "));
       TexOutput(buf);
     }
     else
@@ -2380,7 +2382,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), smallFont*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), smallFont*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2391,7 +2393,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), tinyFont*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), tinyFont*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2401,7 +2403,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), normalFont*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), normalFont*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2411,7 +2413,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), largeFont1*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), largeFont1*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2421,7 +2423,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), LargeFont2*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), LargeFont2*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2431,7 +2433,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), LARGEFont3*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), LARGEFont3*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2441,7 +2443,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), hugeFont1*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), hugeFont1*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2451,7 +2453,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), HugeFont2*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), HugeFont2*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2461,7 +2463,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("{\\fs%d\n"), HUGEFont3*2);
+      wxSnprintf(buf, sizeof(buf), _T("{\\fs%d\n"), HUGEFont3*2);
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -2602,7 +2604,6 @@ void RTFOnMacro(int macroId, int no_args, bool start)
                {
                  // Don't need a par at all if we've already had one,
                  // and ParSkip == 0.
-
 #if 0
           // Extra par if parskip is more than zero (usually looks best.)
           if (winHelp && !inTabular && (ParSkip > 0))
@@ -2644,7 +2645,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       TexOutput(_T("\\par\\pard"));
       if (!winHelp)
         TexOutput(_T("\\par"));
-      wxSprintf(buf, _T("\\qc{\\fs%d\\b "), titleFont*2);
+      wxSnprintf(buf, sizeof(buf), _T("\\qc{\\fs%d\\b "), titleFont*2);
       TexOutput(buf);
       TraverseChildrenFromChunk(DocumentTitle);
       TexOutput(_T("}\\par\\pard\n"));
@@ -2653,7 +2654,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       {
         if (!winHelp)
           TexOutput(_T("\\par"));
-        wxSprintf(buf, _T("\\par\\qc{\\fs%d "), authorFont*2);
+        wxSnprintf(buf, sizeof(buf), _T("\\par\\qc{\\fs%d "), authorFont*2);
         TexOutput(buf);
         TraverseChildrenFromChunk(DocumentAuthor);
         TexOutput(_T("}"));
@@ -2662,7 +2663,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
       if (DocumentDate)
       {
         TexOutput(_T("\\par"));
-        wxSprintf(buf, _T("\\qc{\\fs%d "), authorFont*2);
+        wxSnprintf(buf, sizeof(buf), _T("\\qc{\\fs%d "), authorFont*2);
         TexOutput(buf);
         TraverseChildrenFromChunk(DocumentDate);
         TexOutput(_T("}\\par\\pard\n"));
@@ -2746,7 +2747,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
     if (start)
     {
 //      TexOutput(_T("{\\field{\\*\\fldinst SECTION \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
-      wxSprintf(buf, _T("%d"), chapterNo);
+      wxSnprintf(buf, sizeof(buf), _T("%d"), chapterNo);
       TexOutput(buf);
     }
     break;
@@ -2756,7 +2757,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
     if (start)
     {
 //      TexOutput(_T("{\\field{\\*\\fldinst SECTION \\\\* MERGEFORMAT }{\\fldrslt 1}}"));
-      wxSprintf(buf, _T("%d"), sectionNo);
+      wxSnprintf(buf, sizeof(buf), _T("%d"), sectionNo);
       TexOutput(buf);
     }
     break;
@@ -2782,8 +2783,8 @@ void RTFOnMacro(int macroId, int no_args, bool start)
     if (start && useWord && !winHelp)
     {
       FakeCurrentSection(_T("Index"));
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
       TexOutput(_T("\\par{\\field{\\*\\fldinst INDEX \\\\h \"\\emdash A\\emdash \"\\\\c \"2\"}{\\fldrslt PRESS F9 TO REFORMAT INDEX}}\n"));
     }
     break;
@@ -2792,13 +2793,13 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start && useWord && !winHelp)
     {
-      FakeCurrentSection(FiguresNameString, FALSE);
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
+      FakeCurrentSection(FiguresNameString, false);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
       wxChar buf[200];
-      wxSprintf(buf, _T("{\\field\\fldedit{\\*\\fldinst  TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF FIGURES}}\n"),
+      wxSnprintf(buf, sizeof(buf), _T("{\\field\\fldedit{\\*\\fldinst  TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF FIGURES}}\n"),
                FigureNameString);
       TexOutput(buf);
     }
@@ -2808,13 +2809,13 @@ void RTFOnMacro(int macroId, int no_args, bool start)
   {
     if (start && useWord && !winHelp)
     {
-      FakeCurrentSection(TablesNameString, FALSE);
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
+      FakeCurrentSection(TablesNameString, false);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
       wxChar buf[200];
-      wxSprintf(buf, _T("{\\field\\fldedit{\\*\\fldinst  TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF TABLES}}\n"),
+      wxSnprintf(buf, sizeof(buf), _T("{\\field\\fldedit{\\*\\fldinst  TOC \\\\c \"%s\" }{\\fldrslt PRESS F9 TO REFORMAT LIST OF TABLES}}\n"),
                 TablesNameString);
       TexOutput(buf);
     }
@@ -3169,14 +3170,14 @@ void RTFOnMacro(int macroId, int no_args, bool start)
     break;
   case ltFIGURE:
   {
-    if (start) inFigure = TRUE;
-    else inFigure = FALSE;
+    if (start) inFigure = true;
+    else inFigure = false;
     break;
   }
   case ltTABLE:
   {
-    if (start) inTable = TRUE;
-    else inTable = FALSE;
+    if (start) inTable = true;
+    else inTable = false;
     break;
   }
   default:
@@ -3211,7 +3212,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
   {
     if (!start && (arg_no == 1))
       currentSection = GetArgChunk();
-    return FALSE;
+    return false;
   }
   case ltFUNC:
   {
@@ -3360,7 +3361,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         wxFprintf(Chapters, _T("{\\field{\\*\\fldinst  REF %s \\\\* MERGEFORMAT }{\\fldrslt ??}}"),
                 refName);
       }
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3405,7 +3406,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         if (start)
           helpRefText = GetArgChunk();
 
-        return TRUE;
+        return true;
       }
       else if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional
       {
@@ -3444,7 +3445,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
                     {
                       if (!ignoreBadRefs)
                         TexOutput(_T("??"));
-                      wxSprintf(buf, _T("Warning: unresolved reference '%s'"), refName);
+                      wxSnprintf(buf, sizeof(buf), _T("Warning: unresolved reference '%s'"), refName);
                       OnInform(buf);
                     }
                   }
@@ -3458,7 +3459,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
               TexOutput(_T(")"));
           }
         }
-        return FALSE;
+        return false;
       }
     }
     break;
@@ -3467,21 +3468,21 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
   {
     if (arg_no == 1)
     {
-      return TRUE;
+      return true;
     }
     else if (arg_no == 2)
     {
       if (start)
       {
-        inVerbatim = TRUE;
+        inVerbatim = true;
         TexOutput(_T(" ({\\f3 "));
       }
       else
       {
         TexOutput(_T("})"));
-        inVerbatim = FALSE;
+        inVerbatim = false;
       }
-      return TRUE;
+      return true;
     }
     break;
   }
@@ -3520,9 +3521,9 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           TexOutput(_T("{\\i "));
         else
           TexOutput(_T("}"));
-        return TRUE;
+        return true;
       }
-      else return FALSE;
+      else return false;
     }
     break;
   }
@@ -3534,9 +3535,9 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         contentsLineSection = copystring(GetArgData());
       else if (arg_no == 3)
         contentsLineValue = copystring(GetArgData());
-      return FALSE;
+      return false;
     }
-    else return FALSE;
+    else return false;
   }
   case ltIMAGE:
   case ltIMAGEL:
@@ -3545,7 +3546,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
   case ltPSBOXTO:
   {
     if (arg_no == 3)
-      return FALSE;
+      return false;
       
     static int imageWidth = 0;
     static int imageHeight = 0;
@@ -3579,7 +3580,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
 
       if (imageDimensions)  // glt
           delete [] imageDimensions;
-      return FALSE;
+      return false;
     }  
     else if (start && (arg_no == 2 ))
     {
@@ -3650,7 +3651,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           TexOutput(_T("[No BMP or WMF for image file "));
           TexOutput(filename);
           TexOutput(_T("]"));
-          wxSprintf(buf, _T("Warning: could not find a BMP or WMF equivalent for %s."), filename);
+          wxSnprintf(buf, sizeof(buf), _T("Warning: could not find a BMP or WMF equivalent for %s."), filename);
           OnInform(buf);
         }
         if (filename)  // glt
@@ -3672,7 +3673,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
               OutputBitmapData(fd);
             else
             {
-              wxSprintf(buf, _T("Could not read bitmap %s.\nMay be in wrong format (needs RGB-encoded Windows BMP)."), f.c_str());
+              wxSnprintf(buf, sizeof(buf), _T("Could not read bitmap %s.\nMay be in wrong format (needs RGB-encoded Windows BMP)."), f.c_str());
               OnError(buf);
             }
             fclose(fd);
@@ -3694,7 +3695,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
               }
               else
               {
-                wxSprintf(buf, _T("Could not read metafile %s. Perhaps it's not a placeable metafile?"), f.c_str());
+                wxSnprintf(buf, sizeof(buf), _T("Could not read metafile %s. Perhaps it's not a placeable metafile?"), f.c_str());
                 OnError(buf);
               }
               fclose(fd);
@@ -3705,17 +3706,17 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
               TexOutput(_T("[No BMP or WMF for image file "));
               TexOutput(filename);
               TexOutput(_T("]"));
-              wxSprintf(buf, _T("Warning: could not find a BMP or WMF equivalent for %s."), filename);
+              wxSnprintf(buf, sizeof(buf), _T("Warning: could not find a BMP or WMF equivalent for %s."), filename);
               OnInform(buf);
 #ifdef __WXMSW__
             }
 #endif
         }
       }
-      return FALSE;
+      return false;
     }
     else
-      return FALSE;
+      return false;
   }
   case ltTABULAR:
   case ltSUPERTABULAR:
@@ -3725,10 +3726,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       if (start)
       {
         currentRowNumber = 0;
-        inTabular = TRUE;
-        startRows = TRUE;
-        tableVerticalLineLeft = FALSE;
-        tableVerticalLineRight = FALSE;
+        inTabular = true;
+        startRows = true;
+        tableVerticalLineLeft = false;
+        tableVerticalLineRight = false;
         int currentWidth = 0;
 
         wxChar *alignString = copystring(GetArgData());
@@ -3744,21 +3745,21 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           for (int i = 0; i < noColumns; i++)
           {
             currentWidth += TableData[i].width;
-            wxSprintf(buf, _T("\\cellx%d"), currentWidth);
+            wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
             TexOutput(buf);
           }
           TexOutput(_T("\\pard\\intbl\n"));
         }
         delete[] alignString;
 
-        return FALSE;
+        return false;
       }
     }
     else if (arg_no == 2 && !start)
     {
       TexOutput(_T("\\pard\n"));
       WriteEnvironmentStyles();
-      inTabular = FALSE;
+      inTabular = false;
     }
     break;
   }
@@ -3776,8 +3777,8 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     {
       forbidParindent --;
       PopEnvironmentStyle();
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
     }
     break;
   }
@@ -3791,8 +3792,8 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     else
     {
       PopEnvironmentStyle();
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
     }
     break;
   }
@@ -3804,15 +3805,15 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\sa200\\box\\trgaph108%s\n"), ((macroId == ltNORMALBOXD) ? _T("\\brdrdb") : _T("\\brdrs")));
+      wxSnprintf(buf, sizeof(buf), _T("\\sa200\\box\\trgaph108%s\n"), ((macroId == ltNORMALBOXD) ? _T("\\brdrdb") : _T("\\brdrs")));
       TexOutput(buf);
       PushEnvironmentStyle(buf);
     }
     else
     {
       PopEnvironmentStyle();
-      OnMacro(ltPAR, 0, TRUE);
-      OnMacro(ltPAR, 0, FALSE);
+      OnMacro(ltPAR, 0, true);
+      OnMacro(ltPAR, 0, false);
     }
     break;
   }
@@ -3827,10 +3828,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         SetFontSizes(11);
       else if (wxStrcmp(data, _T("12")) == 0)
         SetFontSizes(12);
-      wxSprintf(buf, _T("\\fs%d\n"), normalFont*2);
+      wxSnprintf(buf, sizeof(buf), _T("\\fs%d\n"), normalFont*2);
       TexOutput(buf);
       TexOutput(buf);
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3846,7 +3847,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       else if (wxStrcmp(data, _T("Times")) == 0)
         TexOutput(_T("\\f0\n"));
 
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3858,10 +3859,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       ParIndent = ParseUnitArgument(data);
       if (ParIndent == 0 || forbidParindent == 0)
       {
-        wxSprintf(buf, _T("\\fi%d\n"), ParIndent*20);
+        wxSnprintf(buf, sizeof(buf), _T("\\fi%d\n"), ParIndent*20);
         TexOutput(buf);
       }
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3870,7 +3871,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     if (start && IsArgOptional())
     {
       descriptionItemArg = GetArgChunk();
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3898,7 +3899,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         break;
       }
     }
-    return TRUE;
+    return true;
   }
   /*
    * Accents
@@ -3948,7 +3949,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_ACUTE:
   {
@@ -4000,7 +4001,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_CARET:
   {
@@ -4046,7 +4047,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_TILDE:
   {
@@ -4083,7 +4084,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_UMLAUT:
   {
@@ -4138,7 +4139,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_DOT:
   {
@@ -4160,7 +4161,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_CADILLA:
   {
@@ -4182,7 +4183,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltFOOTNOTE:
   {
@@ -4197,7 +4198,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           OnInform(_T("Consider using \\footnotepopup instead of \\footnote."));
           footnoteCount ++;
           wxChar footBuf[20];
-          wxSprintf(footBuf, _T("(%d)"), footnoteCount);
+          wxSnprintf(footBuf, sizeof(footBuf), _T("(%d)"), footnoteCount);
 
           TexOutput(_T(" {\\ul "));
           TexOutput(footBuf);
@@ -4225,21 +4226,21 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
        {
           SetCurrentOutput(savedOutput);
        }
-       return TRUE;
+        return true;
       }
-      return TRUE;
+      return true;
     }
     else
     {
       if (start)
       {
-        TexOutput(_T(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}"), TRUE);
+        TexOutput(_T(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}"), true);
       }
       else
       {
-        TexOutput(_T("}}"), TRUE);
+        TexOutput(_T("}}"), true);
       }
-      return TRUE;
+      return true;
     }
   }
   case ltFOOTNOTEPOPUP:
@@ -4254,8 +4255,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         {
           TexOutput(_T("{\\ul "));
        }
-       else TexOutput(_T("}"));
-       return TRUE;
+        else
+        {
+          TexOutput(_T("}"));
+        }
+        return true;
       }
       else if (arg_no == 2)
       {
@@ -4284,31 +4288,31 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         {
           SetCurrentOutput(savedOutput);
         }
-        return TRUE;
+        return true;
       }
     }
     else
     {
       if (arg_no == 1)
-        return TRUE;
+        return true;
       if (start)
       {
-        TexOutput(_T(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}"), TRUE);
+        TexOutput(_T(" {\\super \\chftn{\\footnote \\fs20 {\\super \\chftn}"), true);
       }
       else
       {
-        TexOutput(_T("}}"), TRUE);
+        TexOutput(_T("}}"), true);
       }
-      return TRUE;
+      return true;
     }
     break;
   }
   case ltFANCYPLAIN:
   {
     if (start && (arg_no == 1))
-      return FALSE;
+      return false;
     else
-      return TRUE;
+      return true;
   }
   case ltSETHEADER:
   {
@@ -4317,7 +4321,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     else
       forbidResetPar --;
 
-    if (winHelp) return FALSE;
+    if (winHelp) return false;
     if (start)
     {
       switch (arg_no)
@@ -4357,7 +4361,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           break;
       }
     }
-    return FALSE;
+    return false;
   }
   case ltSETFOOTER:
   {
@@ -4366,7 +4370,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     else
       forbidResetPar --;
 
-    if (winHelp) return FALSE;
+    if (winHelp) return false;
     if (start)
     {
       switch (arg_no)
@@ -4406,11 +4410,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           break;
       }
     }
-    return FALSE;
+    return false;
   }
   case ltMARKRIGHT:
   {
-    if (winHelp) return FALSE;
+    if (winHelp) return false;
     // Fake a SetHeader command
     if (start)
     {
@@ -4425,11 +4429,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     RTFOnArgument(ltSETHEADER, 4, start);
     if (!start)
       OutputRTFHeaderCommands();
-    return FALSE;
+    return false;
   }
   case ltMARKBOTH:
   {
-    if (winHelp) return FALSE;
+    if (winHelp) return false;
     // Fake a SetHeader command
     switch (arg_no)
     {
@@ -4452,7 +4456,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         RTFOnArgument(ltSETHEADER, 4, start);
         if (!start)
           OutputRTFHeaderCommands();
-        return FALSE;
+        return false;
       }
     }
     break;
@@ -4464,7 +4468,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     else
       forbidResetPar --;
 
-    if (winHelp) return FALSE;
+    if (winHelp) return false;
     if (start)
     {
       TexOutput(_T("\\pgnrestart"));
@@ -4475,13 +4479,13 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       
       TexOutput(_T("\n"));
     }
-    return FALSE;
+    return false;
   }
   case ltTWOCOLUMN:
   {
-    if (winHelp) return FALSE;
+    if (winHelp) return false;
     if (start)
-      return TRUE;
+      return true;
     break;
   }
   case ltITEMSEP:
@@ -4490,13 +4494,13 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *val = GetArgData();
       currentItemSep = ParseUnitArgument(val);
-      return FALSE;
+      return false;
     }
     break;
   }
   case ltEVENSIDEMARGIN:
   {
-    return FALSE;
+    return false;
   }
   case ltODDSIDEMARGIN:
   {
@@ -4507,12 +4511,12 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       // Add an inch since in LaTeX it's specified minus an inch
       twips += 1440;
       CurrentLeftMarginOdd = twips;
-      wxSprintf(buf, _T("\\margl%d\n"), twips);
+      wxSnprintf(buf, sizeof(buf), _T("\\margl%d\n"), twips);
       TexOutput(buf);
 
       CurrentMarginParX = CurrentLeftMarginOdd + CurrentTextWidth + CurrentMarginParSep;
     }
-    return FALSE;
+    return false;
   }
   case ltMARGINPARWIDTH:
   {
@@ -4522,7 +4526,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       int twips = (int)(20*ParseUnitArgument(val));
       CurrentMarginParWidth = twips;
     }
-    return FALSE;
+    return false;
   }
   case ltMARGINPARSEP:
   {
@@ -4533,7 +4537,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       CurrentMarginParSep = twips;
       CurrentMarginParX = CurrentLeftMarginOdd + CurrentTextWidth + CurrentMarginParSep;
     }
-    return FALSE;
+    return false;
   }
   case ltTEXTWIDTH:
   {
@@ -4547,10 +4551,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       CurrentRightMarginOdd = PageWidth - CurrentTextWidth - CurrentLeftMarginOdd;
       CurrentRightMarginEven = PageWidth - CurrentTextWidth - CurrentLeftMarginEven;
       CurrentMarginParX = CurrentLeftMarginOdd + CurrentTextWidth + CurrentMarginParSep;
-      wxSprintf(buf, _T("\\margr%d\n"), CurrentRightMarginOdd);
+      wxSnprintf(buf, sizeof(buf), _T("\\margr%d\n"), CurrentRightMarginOdd);
       TexOutput(buf);
     }
-    return FALSE;
+    return false;
   }
   case ltMARGINPAR:
   case ltMARGINPARODD:
@@ -4564,10 +4568,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       }
       else
       {
-        wxSprintf(buf, _T("\\phpg\\posx%d\\absw%d\n"), CurrentMarginParX, CurrentMarginParWidth);
+        wxSnprintf(buf, sizeof(buf), _T("\\phpg\\posx%d\\absw%d\n"), CurrentMarginParX, CurrentMarginParWidth);
         TexOutput(buf);
       }
-      return TRUE;
+      return true;
     }
     else
     {
@@ -4581,7 +4585,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         TexOutput(_T("\\par\\pard\n"));
       issuedNewParagraph = 1;
     }
-    return FALSE;
+    return false;
   }
   case ltMARGINPAREVEN:
   {
@@ -4600,16 +4604,16 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           // mirror mode, on an even (left-hand) page.
           int x = PageWidth - CurrentRightMarginOdd - CurrentMarginParWidth - CurrentMarginParSep
                     - CurrentTextWidth + GutterWidth;
-          wxSprintf(buf, _T("\\phpg\\posx%d\\absw%d\n"), x, CurrentMarginParWidth);
+          wxSnprintf(buf, sizeof(buf), _T("\\phpg\\posx%d\\absw%d\n"), x, CurrentMarginParWidth);
           TexOutput(buf);
         }
         else
         {
-          wxSprintf(buf, _T("\\phpg\\posx%d\\absw%d\n"), CurrentMarginParX, CurrentMarginParWidth);
+          wxSnprintf(buf, sizeof(buf), _T("\\phpg\\posx%d\\absw%d\n"), CurrentMarginParX, CurrentMarginParWidth);
           TexOutput(buf);
         }
       }
-      return TRUE;
+      return true;
     }
     else
     {
@@ -4623,7 +4627,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         issuedNewParagraph = 1;
       TexOutput(_T("\\par\\pard\n"));
     }
-    return FALSE;
+    return false;
   }
   case ltTWOCOLWIDTHA:
   {
@@ -4633,7 +4637,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       int twips = (int)(20*ParseUnitArgument(val));
       TwoColWidthA = twips;
     }
-    return FALSE;
+    return false;
   }
   case ltTWOCOLWIDTHB:
   {
@@ -4643,7 +4647,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       int twips = (int)(20*ParseUnitArgument(val));
       TwoColWidthB = twips;
     }
-    return FALSE;
+    return false;
   }
   case ltROW:
   case ltRULEDROW:
@@ -4684,7 +4688,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         if (TableData[i].leftBorder)
           TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
           
-        wxSprintf(buf, _T("\\cellx%d"), currentWidth);
+        wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
         TexOutput(buf);
       }
       TexOutput(_T("\\pard\\intbl\n"));
@@ -4692,7 +4696,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       ruleTop = 0;
       ruleBottom = 0;
       currentRowNumber ++;
-      return TRUE;
+      return true;
     }
     else
     {
@@ -4711,15 +4715,15 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         case 1:
         {
           noMultiColumns = wxAtoi(GetArgData());
-          return FALSE;
+          return false;
         }
         case 2:
         {
-          return FALSE;
+          return false;
         }
         case 3:
         {
-          return TRUE;
+          return true;
         }
       }
     }
@@ -4750,10 +4754,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
       itemizeStack.Insert(struc);
       
-      wxSprintf(buf, _T("\\tx%d\\li%d\\sa200 "), indentSize, indentSize);
+      wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200 "), indentSize, indentSize);
       PushEnvironmentStyle(buf);
       TexOutput(buf);
-      return FALSE;
+      return false;
     }
     if (!start && (arg_no == 2))
     {
@@ -4771,7 +4775,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         WriteEnvironmentStyles();
       }
     }
-    return TRUE;
+    return true;
   }
 /*
   case ltSIZEDBOX:
@@ -4793,11 +4797,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
       itemizeStack.Insert(struc);
       
-      wxSprintf(buf, _T("\\tx%d\\li%d\\lr%d\\sa200\\box%s "), indentSize, indentSize, indentSizeRight,
+      wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\lr%d\\sa200\\box%s "), indentSize, indentSize, indentSizeRight,
         ((macroId == ltCENTEREDBOX) ? _T("\\brdrs") : _T("\\brdrdb")));
       PushEnvironmentStyle(buf);
       TexOutput(buf);
-      return FALSE;
+      return false;
     }
     if (!start && (arg_no == 2))
     {
@@ -4815,7 +4819,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         WriteEnvironmentStyles();
       }
     }
-    return TRUE;
+    return true;
     break;
   }
 */
@@ -4834,7 +4838,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       }
       TexOutput(_T("\n"));
     }
-    return FALSE;
+    return false;
   }
   case ltSETHOTSPOTCOLOUR:
   case ltSETHOTSPOTCOLOR:
@@ -4843,11 +4847,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *text = GetArgData();
       if (wxStrcmp(text, _T("yes")) == 0 || wxStrcmp(text, _T("on")) == 0 || wxStrcmp(text, _T("ok")) == 0)
-        hotSpotColour = TRUE;
+        hotSpotColour = true;
       else
-        hotSpotColour = FALSE;
+        hotSpotColour = false;
     }
-    return FALSE;
+    return false;
   }
   case ltSETTRANSPARENCY:
   {
@@ -4855,11 +4859,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *text = GetArgData();
       if (wxStrcmp(text, _T("yes")) == 0 || wxStrcmp(text, _T("on")) == 0 || wxStrcmp(text, _T("ok")) == 0)
-        bitmapTransparency = TRUE;
+        bitmapTransparency = true;
       else
-        bitmapTransparency = FALSE;
+        bitmapTransparency = false;
     }
-    return FALSE;
+    return false;
   }
   case ltSETHOTSPOTUNDERLINE:
   {
@@ -4867,11 +4871,11 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *text = GetArgData();
       if (wxStrcmp(text, _T("yes")) == 0 || wxStrcmp(text, _T("on")) == 0 || wxStrcmp(text, _T("ok")) == 0)
-        hotSpotUnderline = TRUE;
+        hotSpotUnderline = true;
       else
-        hotSpotUnderline = FALSE;
+        hotSpotUnderline = false;
     }
-    return FALSE;
+    return false;
   }
   case ltBIBITEM:
   {
@@ -4882,19 +4886,19 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       if (ref)
       {
         if (ref->sectionNumber) delete[] ref->sectionNumber;
-        wxSprintf(buf, _T("[%d]"), citeCount);
+        wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
         ref->sectionNumber = copystring(buf);
       }
 
       TexOutput(_T("\\li260\\fi-260 ")); // Indent from 2nd line
-      wxSprintf(buf, _T("{\\b [%d]} "), citeCount);
+      wxSnprintf(buf, sizeof(buf), _T("{\\b [%d]} "), citeCount);
       TexOutput(buf);
       citeCount ++;
-      return FALSE;
+      return false;
     }
     if (arg_no == 2 && !start)
       TexOutput(_T("\\par\\pard\\par\n\n"));
-    return TRUE;
+    return true;
   }
   case ltTHEBIBLIOGRAPHY:
   {
@@ -4929,7 +4933,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       else
         wxFprintf(Contents, _T("\\par\n\\pard{\\b %s}"), ReferencesNameString);
 
-      startedSections = TRUE;
+      startedSections = true;
 
       if (winHelp)
         wxFprintf(Chapters, _T("\n${\\footnote %s}"), ReferencesNameString);
@@ -4964,9 +4968,9 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       wxFprintf(Chapters, _T("\\pard{%s"), (winHelp ? _T("\\keepn\\sa140\\sb140") : styleCommand));
       WriteHeadingStyle(Chapters, 1);  wxFprintf(Chapters, _T(" References\\par\\pard}\n"));
 
-      return FALSE;
+      return false;
     }
-    return TRUE;
+    return true;
   }
   case ltINDEX:
   {
@@ -4993,7 +4997,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       }
       else GenerateIndexEntry(buf);
     }
-    return FALSE;
+    return false;
   }
   case ltFCOL:
   case ltBCOL:
@@ -5008,19 +5012,19 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           int pos = FindColourPosition(name);
           if (pos > -1)
           {
-            wxSprintf(buf, _T("{%s%d "), ((macroId == ltFCOL) ? _T("\\cf") : _T("\\cb")), pos);
+            wxSnprintf(buf, sizeof(buf), _T("{%s%d "), ((macroId == ltFCOL) ? _T("\\cf") : _T("\\cb")), pos);
             TexOutput(buf);
           }
                  else
                  {
-                       wxSprintf(buf, _T("Could not find colour name %s"), name);
+                       wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
             OnError(buf);
                  }
           break;
         }
         case 2:
         {
-          return TRUE;
+          return true;
         }
         default:
           break;
@@ -5030,7 +5034,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     {
       if (arg_no == 2) TexOutput(_T("}"));
     }
-    return FALSE;
+    return false;
   }
   case ltLABEL:
   {
@@ -5050,7 +5054,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           wxFprintf(Chapters, _T("{\\bkmkstart %s}{\\bkmkend %s}"), s,s);
       }
     }
-    return FALSE;
+    return false;
   }
   case ltPAGEREF:
   {
@@ -5060,14 +5064,14 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
       wxFprintf(Chapters, _T("{\\field{\\*\\fldinst  PAGEREF %s \\\\* MERGEFORMAT }{\\fldrslt ??}}"),
               s);
     }
-    return FALSE;
+    return false;
   }
   case ltPOPREFONLY:
   {
     if (start)
-      inPopRefSection = TRUE;
+      inPopRefSection = true;
     else
-      inPopRefSection = FALSE;
+      inPopRefSection = false;
     break;
   }
   case ltINSERTATLEVEL:
@@ -5075,7 +5079,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
     // This macro allows you to insert text at a different level
     // from the current level, e.g. into the Sections from within a subsubsection.
     if (!winHelp & useWord)
-        return FALSE;
+        return false;
     static int currentLevelNo = 1;
     static FILE* oldLevelFile = Chapters;
     if (start)
@@ -5120,16 +5124,16 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
           }
           if (outputFile)
             CurrentOutput1 = outputFile;
-          return FALSE;
+          return false;
         }
         case 2:
         {
-          return TRUE;
+          return true;
         }
         default:
           break;
       }
-      return TRUE;
+      return true;
     }
     else
     {
@@ -5137,19 +5141,19 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
         {
             CurrentOutput1 = oldLevelFile;
         }
-        return TRUE;
+        return true;
     }
   }
   default:
     return DefaultOnArgument(macroId, arg_no, start);
   }
-  return TRUE;
+  return true;
 }
 
 bool RTFGo(void)
 {
   if (stopRunning)
-      return FALSE;
+      return false;
 
   // Reset variables
   indentLevel = 0;
@@ -5157,15 +5161,15 @@ bool RTFGo(void)
   contentsLineSection = NULL;
   contentsLineValue = NULL;
   descriptionItemArg = NULL;
-  inTabular = FALSE;
-  inTable = FALSE;
-  inFigure = FALSE;
-  startRows = FALSE;
-  tableVerticalLineLeft = FALSE;
-  tableVerticalLineRight = FALSE;
+  inTabular = false;
+  inTable = false;
+  inFigure = false;
+  startRows = false;
+  tableVerticalLineLeft = false;
+  tableVerticalLineRight = false;
   noColumns = 0;
-  startedSections = FALSE;
-  inVerbatim = FALSE;
+  startedSections = false;
+  inVerbatim = false;
   browseId = 0;
   
   if (InputFile && OutputFile)
@@ -5192,13 +5196,13 @@ bool RTFGo(void)
       if (!Sections || !Subsections || !Subsubsections || !Popups || (winHelpContents && !WinHelpContentsFile))
       {
         OnError(_T("Ouch! Could not open temporary file(s) for writing."));
-        return FALSE;
+        return false;
       }
     }
     if (!Contents || !Chapters)
     {
       OnError(_T("Ouch! Could not open temporary file(s) for writing."));
-      return FALSE;
+      return false;
     }
 
     if (winHelp)
@@ -5228,7 +5232,7 @@ bool RTFGo(void)
     SetCurrentOutput(Chapters);
 
     if (stopRunning)
-        return FALSE;
+        return false;
 
     OnInform(_T("Converting..."));
 
@@ -5238,14 +5242,14 @@ bool RTFGo(void)
     if (!Header)
     {
       OnError(_T("Ouch! Could not open temporary file header.rtf for writing."));
-      return FALSE;
+      return false;
     }
     WriteRTFHeader(Header);
     fclose(Header);
 
     PopEnvironmentStyle();
     
-    Tex2RTFYield(TRUE);
+    Tex2RTFYield(true);
     if (winHelp)
     {
 //      wxFprintf(Contents, _T("\\page\n"));
@@ -5276,15 +5280,15 @@ bool RTFGo(void)
     if (winHelp)
     {
       wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       wxConcatFiles(_T("tmp1.rtf"), _T("sections.rtf"), _T("tmp2.rtf"));
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       wxConcatFiles(_T("tmp2.rtf"), _T("subsections.rtf"), _T("tmp3.rtf"));
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       wxConcatFiles(_T("tmp3.rtf"), _T("subsubsections.rtf"), _T("tmp4.rtf"));
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       wxConcatFiles(_T("tmp4.rtf"), _T("popups.rtf"), OutputFile);
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
 
       wxRemoveFile(_T("tmp1.rtf"));
       wxRemoveFile(_T("tmp2.rtf"));
@@ -5294,7 +5298,7 @@ bool RTFGo(void)
     else
     {
       wxConcatFiles(_T("header.rtf"), _T("chapters.rtf"), _T("tmp1.rtf"));
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       if (wxFileExists(OutputFile))
           wxRemoveFile(OutputFile);
 
@@ -5317,7 +5321,7 @@ bool RTFGo(void)
         wxCopyFile(_T("tmp1.rtf"), OutputFile);
       }
       delete [] cwdStr;
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       wxRemoveFile(_T("tmp1.rtf"));
     }
     
@@ -5341,7 +5345,7 @@ bool RTFGo(void)
     }
     if (winHelp && generateHPJ)
       WriteHPJ(OutputFile);
-    return TRUE;
+    return true;
   }
-  return FALSE;
+  return false;
 }
index 113d5d4701e2ff9e24ed5b4906018e4d60d08c54..b289cdbe2d05b8a170e4b83ec32e7f00a1505beb 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        table.cpp
 // Purpose:     Utilities for manipulating tables
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     01/01/99
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 #include "table.h"
 
 ColumnData TableData[40];
-bool inTabular = FALSE;
+bool inTabular = false;
 
-bool startRows = FALSE;
-bool tableVerticalLineLeft = FALSE;
-bool tableVerticalLineRight = 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;
@@ -62,50 +63,50 @@ bool ParseTableArgument(wxChar *value)
   noColumns = 0;
   int i = 0;
   int len = wxStrlen(value);
-  bool isBorder = FALSE;
+  bool isBorder = false;
   while (i < len)
   {
     int ch = value[i];
     if (ch == '|')
     {
       i ++;
-      isBorder = TRUE;
+      isBorder = true;
     }
     else if (ch == 'l')
     {
       TableData[noColumns].leftBorder = isBorder;
-      TableData[noColumns].rightBorder = FALSE;
+      TableData[noColumns].rightBorder = false;
       TableData[noColumns].justification = 'l';
       TableData[noColumns].width = 2000; // Estimate
-      TableData[noColumns].absWidth = FALSE;
+      TableData[noColumns].absWidth = false;
 //      TableData[noColumns].spacing = ??
       noColumns ++;
       i ++;
-      isBorder = FALSE;
+      isBorder = false;
     }
     else if (ch == 'c')
     {
       TableData[noColumns].leftBorder = isBorder;
-      TableData[noColumns].rightBorder = FALSE;
+      TableData[noColumns].rightBorder = false;
       TableData[noColumns].justification = 'c';
       TableData[noColumns].width = defaultTableColumnWidth; // Estimate
-      TableData[noColumns].absWidth = FALSE;
+      TableData[noColumns].absWidth = false;
 //      TableData[noColumns].spacing = ??
       noColumns ++;
       i ++;
-      isBorder = FALSE;
+      isBorder = false;
     }
     else if (ch == 'r')
     {
       TableData[noColumns].leftBorder = isBorder;
-      TableData[noColumns].rightBorder = FALSE;
+      TableData[noColumns].rightBorder = false;
       TableData[noColumns].justification = 'r';
       TableData[noColumns].width = 2000; // Estimate
-      TableData[noColumns].absWidth = FALSE;
+      TableData[noColumns].absWidth = false;
 //      TableData[noColumns].spacing = ??
       noColumns ++;
       i ++;
-      isBorder = FALSE;
+      isBorder = false;
     }
     else if (ch == 'p')
     {
@@ -118,7 +119,7 @@ bool ParseTableArgument(wxChar *value)
         i++;
         ch = value[i];
       }
-        
+
       while ((i < len) && (isdigit(ch) || ch == '.'))
       {
         numberBuf[j] = ch;
@@ -133,26 +134,26 @@ bool ParseTableArgument(wxChar *value)
       j ++; i++;
       numberBuf[j] = 0;
       if (value[i] == '}') i++;
-      
+
       TableData[noColumns].leftBorder = isBorder;
-      TableData[noColumns].rightBorder = FALSE;
+      TableData[noColumns].rightBorder = false;
       TableData[noColumns].justification = 'l';
       TableData[noColumns].width = 20*ParseUnitArgument(numberBuf);
-      TableData[noColumns].absWidth = TRUE;
+      TableData[noColumns].absWidth = true;
 //      TableData[noColumns].spacing = ??
       noColumns ++;
-      isBorder = FALSE;
+      isBorder = false;
     }
     else
     {
       wxChar *buf = new wxChar[wxStrlen(value) + 80];
-      wxSprintf(buf, _T("Tabular first argument \"%s\" too complex!"), value);
+      wxSnprintf(buf, wxStrlen(value) + 80, _T("Tabular first argument \"%s\" too complex!"), value);
       OnError(buf);
       delete[] buf;
-      return FALSE;
+      return false;
     }
   }
   if (isBorder)
-    TableData[noColumns-1].rightBorder = TRUE;
-  return TRUE;
+    TableData[noColumns-1].rightBorder = true;
+  return true;
 }
index 8d595fdecbf4da15c49838c7526d02cd53dc8162..b7e06231a7fbe651097ac2a969dd4d181948f787 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        tex2any.cpp
 // Purpose:     Utilities for Latex conversion.
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     01/01/99
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -107,16 +108,16 @@ int             sectionFont =    12; // LargeFont2;
 int             subsectionFont = 12; // largeFont1;
 int             titleFont = LARGEFont3;
 int             authorFont = LargeFont2;
-int             mirrorMargins = TRUE;
-bool            winHelp = FALSE;  // Output in Windows Help format if TRUE, linear otherwise
-bool            isInteractive = FALSE;
-bool            runTwice = FALSE;
+int             mirrorMargins = true;
+bool            winHelp = false;  // Output in Windows Help format if TRUE, linear otherwise
+bool            isInteractive = false;
+bool            runTwice = false;
 int             convertMode = TEX_RTF;
-bool            checkCurleyBraces = FALSE;
-bool            checkSyntax = FALSE;
-bool            headerRule = FALSE;
-bool            footerRule = FALSE;
-bool            compatibilityMode = FALSE; // If TRUE, maximum Latex compatibility
+bool            checkCurleyBraces = false;
+bool            checkSyntax = false;
+bool            headerRule = false;
+bool            footerRule = false;
+bool            compatibilityMode = false; // If TRUE, maximum Latex compatibility
                                 // (Quality of RTF generation deteriorate)
 bool            generateHPJ; // Generate WinHelp Help Project file
 wxChar         *winHelpTitle = NULL; // Windows Help title
@@ -125,31 +126,31 @@ int             defaultTableColumnWidth = 2000;
 int             labelIndentTab = 18;  // From left indent to item label (points)
 int             itemIndentTab = 40;   // From left indent to item (points)
 
-bool            useUpButton = TRUE;
+bool            useUpButton = true;
 int             htmlBrowseButtons = HTML_BUTTONS_TEXT;
 
-bool            truncateFilenames = FALSE; // Truncate for DOS
+bool            truncateFilenames = false; // Truncate for DOS
 int             winHelpVersion = 3; // WinHelp Version (3 for Windows 3.1, 4 for Win95)
-bool            winHelpContents = FALSE; // Generate .cnt file for WinHelp 4
-bool            htmlIndex = FALSE; // Generate .htx file for HTML
-bool            htmlFrameContents = FALSE; // Use frames for HTML contents page
+bool            winHelpContents = false; // Generate .cnt file for WinHelp 4
+bool            htmlIndex = false; // Generate .htx file for HTML
+bool            htmlFrameContents = false; // Use frames for HTML contents page
 wxChar         *htmlStylesheet = NULL; // Use this CSS stylesheet for HTML pages
-bool            useHeadingStyles = TRUE; // Insert \s1, s2 etc.
-bool            useWord = TRUE; // Insert proper Word table of contents, etc etc
+bool            useHeadingStyles = true; // Insert \s1, s2 etc.
+bool            useWord = true; // Insert proper Word table of contents, etc etc
 int             contentsDepth = 4; // Depth of Word table of contents
-bool            indexSubsections = TRUE; // Index subsections in linear RTF
+bool            indexSubsections = true; // Index subsections in linear RTF
 // Linear RTF method of including bitmaps. Can be "includepicture", "hex"
 wxChar         *bitmapMethod = copystring(_T("includepicture"));
-bool            upperCaseNames = FALSE;
+bool            upperCaseNames = false;
 // HTML background and text colours
 wxChar         *backgroundImageString = NULL;
 wxChar         *backgroundColourString = copystring(_T("255;255;255"));
 wxChar         *textColourString = NULL;
 wxChar         *linkColourString = NULL;
 wxChar         *followedLinkColourString = NULL;
-bool            combineSubSections = FALSE;
-bool            htmlWorkshopFiles = FALSE;
-bool            ignoreBadRefs = FALSE;
+bool            combineSubSections = false;
+bool            htmlWorkshopFiles = false;
+bool            ignoreBadRefs = false;
 wxChar                 *htmlFaceName = NULL;
 
 extern int passNumber;
@@ -203,15 +204,15 @@ int CurrentInputIndex = 0;
 wxChar *TexFileRoot = NULL;
 wxChar *TexBibName = NULL;         // Bibliography output file name
 wxChar *TexTmpBibName = NULL;      // Temporary bibliography output file name
-bool isSync = FALSE;             // If TRUE, should not yield to other processes.
-bool stopRunning = FALSE;        // If TRUE, should abort.
+bool isSync = false;             // If TRUE, should not yield to other processes.
+bool stopRunning = false;        // If TRUE, should abort.
 
 static int currentColumn = 0;
 wxChar *currentArgData = NULL;
-bool haveArgData = FALSE; // If TRUE, we're simulating the data.
+bool haveArgData = false; // If TRUE, we're simulating the data.
 TexChunk *currentArgument = NULL;
 TexChunk *nextChunk = NULL;
-bool isArgOptional = FALSE;
+bool isArgOptional = false;
 int noArgs = 0;
 
 TexChunk *TopLevel = NULL;
@@ -304,7 +305,7 @@ void ForbidWarning(TexMacroDef *def)
  
 TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace)
 {
-  *parseToBrace = TRUE;
+  *parseToBrace = true;
   int i = (*pos);
   TexMacroDef *def = NULL;
   wxChar macroBuf[40];
@@ -372,7 +373,7 @@ TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBra
       if ((buffer[i] == 32) || (buffer[i] == '='))
         i ++;
 
-      *parseToBrace = FALSE;
+      *parseToBrace = false;
     }
     *pos = i;
     ForbidWarning(def);
@@ -385,8 +386,8 @@ void EatWhiteSpace(wxChar *buffer, int *pos)
 {
   int len = wxStrlen(buffer);
   int j = *pos;
-  bool keepGoing = TRUE;
-  bool moreLines = TRUE;
+  bool keepGoing = true;
+  bool moreLines = true;
   while ((j < len) && keepGoing &&
          (buffer[j] == 10 || buffer[j] == 13 || buffer[j] == ' ' || buffer[j] == 9))
   {
@@ -400,7 +401,7 @@ void EatWhiteSpace(wxChar *buffer, int *pos)
         j = 0;
       }
       else
-        keepGoing = FALSE;
+        keepGoing = false;
     }
   }
   *pos = j;
@@ -415,13 +416,13 @@ bool FindEndEnvironment(wxChar *buffer, int *pos, wxChar *env)
       (wxStrncmp(buffer+i+4, env, wxStrlen(env)) == 0))
   {
     *pos = i + 5 + wxStrlen(env);
-    return TRUE;
+    return true;
   }
-  else return FALSE;
+  else return false;
 }
 
-bool readingVerbatim = FALSE;
-bool readInVerbatim = FALSE;  // Within a verbatim, but not nec. verbatiminput
+bool readingVerbatim = false;
+bool readInVerbatim = false;  // Within a verbatim, but not nec. verbatiminput
 
 // Switched this off because e.g. \verb${$ causes it to fail. There is no
 // detection of \verb yet.
@@ -436,7 +437,7 @@ bool read_a_line(wxChar *buf)
   if (CurrentInputIndex < 0)
   {
     buf[0] = 0;
-    return FALSE;
+    return false;
   }
 
   int ch = -2;
@@ -451,12 +452,12 @@ bool read_a_line(wxChar *buf)
        errBuf.Printf(_T("Line %lu of file %s is too long.  Lines can be no longer than %lu characters.  Truncated."),
            LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(), MAX_LINE_BUFFER_SIZE);
        OnError((wxChar *)errBuf.c_str());
-       return FALSE;
+       return false;
     }
 
     if (((bufIndex == 14) && (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0)) ||
          ((bufIndex == 16) && (wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0)))
-      readInVerbatim = FALSE;
+      readInVerbatim = false;
 
     ch = getc(Inputs[CurrentInputIndex]);
 
@@ -501,7 +502,7 @@ bool read_a_line(wxChar *buf)
              errBuf.Printf(_T("Line %lu of file %s is too long.  Lines can be no longer than %lu characters.  Truncated."),
                  LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
              OnError((wxChar *)errBuf.c_str());
-             return FALSE;
+             return false;
           }
           wxStrcat(buf, _T("\\par"));
           bufIndex += 5;
@@ -516,7 +517,7 @@ bool read_a_line(wxChar *buf)
              errBuf.Printf(_T("Line %lu of file %s is too long.  Lines can be no longer than %lu characters.  Truncated."),
                  LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
              OnError((wxChar *)errBuf.c_str());
-             return FALSE;
+             return false;
           }
 
           buf[bufIndex] = ch;
@@ -541,7 +542,7 @@ bool read_a_line(wxChar *buf)
                    errBuf.Printf(_T("Line %lu of file %s is too long.  Lines can be no longer than %lu characters.  Truncated."),
                        LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
                    OnError((wxChar *)errBuf.c_str());
-                   return FALSE;
+                   return false;
                 }
                 buf[bufIndex++]='\\';
                 buf[bufIndex++]='"';
@@ -564,7 +565,7 @@ bool read_a_line(wxChar *buf)
               errBuf.Printf(_T("Line %lu of file %s is too long.  Lines can be no longer than %lu characters.  Truncated."),
                   LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
               OnError((wxChar *)errBuf.c_str());
-              return FALSE;
+              return false;
             }
             buf[bufIndex++]='\\';
             buf[bufIndex++]='s';
@@ -579,7 +580,7 @@ bool read_a_line(wxChar *buf)
               errBuf.Printf(_T("Line %lu of file %s is too long.  Lines can be no longer than %lu characters.  Truncated."),
                   LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
               OnError((wxChar *)errBuf.c_str());
-              return FALSE;
+              return false;
             }
             // If the current character read in is a '_', we need to check 
             // whether there should be a '\' before it or not
@@ -651,10 +652,10 @@ bool read_a_line(wxChar *buf)
 
       if (readingVerbatim)
       {
-        readingVerbatim = FALSE;
-        readInVerbatim = FALSE;
+        readingVerbatim = false;
+        readInVerbatim = false;
         wxStrcat(buf, _T("\\end{verbatim}\n"));
-        return FALSE;
+        return false;
       }
     }
     if (ch == 10)
@@ -716,13 +717,13 @@ bool read_a_line(wxChar *buf)
       }
       else
       {
-        readingVerbatim = TRUE;
-        readInVerbatim = TRUE;
+        readingVerbatim = true;
+        readInVerbatim = true;
         wxStrcpy(buf, _T("\\begin{verbatim}\n"));
-        return FALSE;
+        return false;
       }
     }
-    return FALSE;
+    return false;
   }
   else if (wxStrncmp(buf, _T("\\input"), 6) == 0 || wxStrncmp(buf, _T("\\helpinput"), 10) == 0 ||
       wxStrncmp(buf, _T("\\include"), 8) == 0)
@@ -767,7 +768,7 @@ bool read_a_line(wxChar *buf)
     if (actualFile == _T(""))
     {
       wxChar buf2[400];
-      wxSprintf(buf2, _T("%s.tex"), fileNameStr.c_str());
+      wxSnprintf(buf2, sizeof(buf2), _T("%s.tex"), fileNameStr.c_str());
       actualFile = TexPathList.FindValidPath(buf2);
     }
     currentFileName = actualFile;
@@ -841,10 +842,10 @@ bool read_a_line(wxChar *buf)
 
   if (wxStrncmp(buf, _T("\\begin{verbatim}"), 16) == 0 ||
       wxStrncmp(buf, _T("\\begin{toocomplex}"), 18) == 0)
-    readInVerbatim = TRUE;
+    readInVerbatim = true;
   else if (wxStrncmp(buf, _T("\\end{verbatim}"), 14) == 0 ||
            wxStrncmp(buf, _T("\\end{toocomplex}"), 16) == 0)
-    readInVerbatim = FALSE;
+    readInVerbatim = false;
 
   if (checkCurleyBraces)
   {
@@ -894,7 +895,7 @@ bool ParseNewCommand(wxChar *buffer, int *pos)
       noArgs = (int)(buffer[*pos]) - 48;
       *pos += 2; // read past argument and '['
     }
-    bool end = FALSE;
+    bool end = false;
     int braceCount = 0;
     while (!end)
     {
@@ -905,7 +906,7 @@ bool ParseNewCommand(wxChar *buffer, int *pos)
       {
         braceCount --;
         if (braceCount == 0)
-          end = TRUE;
+          end = true;
       }
       else if (ch == 0)
       {
@@ -928,9 +929,9 @@ bool ParseNewCommand(wxChar *buffer, int *pos)
       CustomMacroList.Append(commandName, macro);
       AddMacroDef(ltCUSTOM_MACRO, commandName, noArgs);
     }
-    return TRUE;
+    return true;
   }
-  else return FALSE;
+  else return false;
 }
 
 void MacroError(wxChar *buffer)
@@ -956,7 +957,7 @@ void MacroError(wxChar *buffer)
   if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0)
   {
       OnInform( _T("Halted build due to unrecoverable error.") );
-      stopRunning = TRUE;
+      stopRunning = true;
   }
 }
 
@@ -973,7 +974,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
   Tex2RTFYield();
   if (stopRunning) return pos;
   
-  bool eof = FALSE;
+  bool eof = false;
   BigBuffer[0] = 0;
   int buf_ptr = 0;
   int len;
@@ -992,12 +993,12 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
 
     if ((pos > 0) && (buffer[pos-1] != ' ') && (buffer[pos] == '[' || buffer[pos] == '('))
     {
-      isOptional = TRUE;
+      isOptional = true;
       pos ++;
     }
     else if ((pos > 1) && (buffer[pos-1] != ' ') && (buffer[pos+1] == '[' || buffer[pos+1] == '('))
     {
-      isOptional = TRUE;
+      isOptional = true;
       pos += 2;
     }
   }
@@ -1148,7 +1149,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
 
           wxTex2RTFBuffer[0] = 0;
           int i = 0;
-          bool end = FALSE;
+          bool end = false;
           while (!end)
           {
             int ch = buffer[pos];
@@ -1158,7 +1159,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
               if (noBraces == 0)
               {
                 wxTex2RTFBuffer[i] = 0;
-                end = TRUE;
+                end = true;
               }
               else
               {
@@ -1191,7 +1192,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
               pos ++;
               i ++;
               if (ch == 0)
-                end = TRUE;
+                end = true;
             }
           }
           TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO);
@@ -1256,7 +1257,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
     else
     {
           wxChar *env = NULL;
-          bool tmpParseToBrace = TRUE;
+          bool tmpParseToBrace = true;
           TexMacroDef *def = MatchMacro(buffer, &pos, &env, &tmpParseToBrace);
           if (def)
           {
@@ -1292,7 +1293,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
 //              wxStrcpy(macroBuf, _T("{"));
               wxStrcpy(macroBuf, customMacro->macroBody);
               wxStrcat(macroBuf, _T("}"));
-              ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk);
+              ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk);
             }
             
 //            delete chunk; // Might delete children
@@ -1337,7 +1338,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
               children.Append((wxObject *)chunk);
 
             pos = ParseMacroBody(def->name, chunk, chunk->no_args,
-                       buffer, pos, NULL, TRUE, customMacroArgs);
+                       buffer, pos, NULL, true, customMacroArgs);
 
             // If custom macro, parse the body substituting the above found args.
             if (customMacro)
@@ -1348,7 +1349,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
 //                wxStrcpy(macroBuf, _T("{"));
                 wxStrcpy(macroBuf, customMacro->macroBody);
                 wxStrcat(macroBuf, _T("}"));
-                ParseArg(thisArg, children, macroBuf, 0, NULL, TRUE, chunk);
+                ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk);
               }
             
 //            delete chunk; // Might delete children
@@ -1368,7 +1369,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
           */
           if (!SoloBlockDef)
           {
-            SoloBlockDef = new TexMacroDef(ltSOLO_BLOCK, _T("solo block"), 1, FALSE);
+            SoloBlockDef = new TexMacroDef(ltSOLO_BLOCK, _T("solo block"), 1, false);
           }
           // Save text so far
           if (buf_ptr > 0)
@@ -1392,7 +1393,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
           arg->argn = 1;
           arg->macroId = chunk->macroId;
 
-          pos = ParseArg(arg, arg->children, buffer, pos, NULL, TRUE, customMacroArgs);
+          pos = ParseArg(arg, arg->children, buffer, pos, NULL, true, customMacroArgs);
     }
         break;
       }
@@ -1598,7 +1599,7 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
     else
       actualEnv = environment;
 
-    bool isOptional = FALSE;
+    bool isOptional = false;
 
     // Remove the first { of the argument so it doesn't get recognized as { ... }
 //    EatWhiteSpace(buffer, &pos);
@@ -1612,12 +1613,12 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
       else
       if ((pos > 0) && (buffer[pos-1] != ' ') && (buffer[pos] == '['))
       {
-        isOptional = TRUE;
+        isOptional = true;
         pos ++;
       }
       else if ((pos > 1) && (buffer[pos-1] != ' ') && (buffer[pos+1] == '['))
       {
-        isOptional = TRUE;
+        isOptional = true;
         pos += 2;
       }
       else if (i > 0)
@@ -1663,11 +1664,11 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
 bool TexLoadFile(wxChar *filename)
 {
   static wxChar *line_buffer;
-  stopRunning = FALSE;
+  stopRunning = false;
   wxStrcpy(TexFileRoot, filename);
   StripExtension(TexFileRoot);
-  wxSprintf(TexBibName, _T("%s.bb"), TexFileRoot);
-  wxSprintf(TexTmpBibName, _T("%s.bb1"), TexFileRoot);
+  wxSnprintf(TexBibName, 300, _T("%s.bb"), TexFileRoot);
+  wxSnprintf(TexTmpBibName, 300, _T("%s.bb1"), TexFileRoot);
 
   TexPathList.EnsureFileAccessible(filename);
 
@@ -1682,12 +1683,12 @@ bool TexLoadFile(wxChar *filename)
   if (Inputs[0])
   {
     read_a_line(line_buffer);
-    ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, TRUE);
+    ParseMacroBody(_T("toplevel"), TopLevel, 1, line_buffer, 0, NULL, true);
     if (Inputs[0]) fclose(Inputs[0]);
-    return TRUE;
+    return true;
   }
 
-  return FALSE;
+  return false;
 }
 
 TexMacroDef::TexMacroDef(int the_id, const wxChar *the_name, int n, bool ig, bool forbidLevel)
@@ -1713,7 +1714,7 @@ TexChunk::TexChunk(int the_type, TexMacroDef *the_def)
   def = the_def;
   macroId = 0;
   value = NULL;
-  optional = FALSE;
+  optional = false;
 }
 
 TexChunk::TexChunk(TexChunk& toCopy)
@@ -1825,7 +1826,7 @@ wxChar *GetArgData(TexChunk *WXUNUSED(chunk))
 {
   currentArgData[0] = 0;
   GetArgData1(currentArgument);
-  haveArgData = FALSE;
+  haveArgData = false;
   return currentArgData;
 }
 
@@ -1879,7 +1880,7 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly)
         return;
 
       if (!childrenOnly)
-        OnMacro(chunk->macroId, chunk->no_args, TRUE);
+        OnMacro(chunk->macroId, chunk->no_args, true);
 
       wxNode *node = chunk->children.GetFirst();
       while (node)
@@ -1893,7 +1894,7 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly)
           nextChunk = (TexChunk *)thisNode->GetNext()->GetData();
 
       if (!childrenOnly)
-        OnMacro(chunk->macroId, chunk->no_args, FALSE);
+        OnMacro(chunk->macroId, chunk->no_args, false);
       break;
     }
     case CHUNK_TYPE_ARG:
@@ -1903,9 +1904,9 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly)
       isArgOptional = chunk->optional;
       noArgs = chunk->no_args;
 
-      // If OnArgument returns FALSE, don't output.
+      // If OnArgument returns false, don't output.
 
-      if (childrenOnly || OnArgument(chunk->macroId, chunk->argn, TRUE))
+      if (childrenOnly || OnArgument(chunk->macroId, chunk->argn, true))
       {
         wxNode *node = chunk->children.GetFirst();
         while (node)
@@ -1925,7 +1926,7 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly)
       noArgs = chunk->no_args;
 
       if (!childrenOnly)
-        (void)OnArgument(chunk->macroId, chunk->argn, FALSE);
+        (void)OnArgument(chunk->macroId, chunk->argn, false);
       break;
     }
     case CHUNK_TYPE_STRING:
@@ -1938,9 +1939,9 @@ void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode, bool childrenOnly)
         if (issuedNewParagraph && !((chunk->value[0] == 10 || chunk->value[0] == 13 || chunk->value[0] == 32)
                                     && chunk->value[1] == 0))
         {
-          issuedNewParagraph = FALSE;
+          issuedNewParagraph = false;
         }
-        TexOutput(chunk->value, TRUE);
+        TexOutput(chunk->value, true);
       }
       break;
     }
@@ -2015,7 +2016,7 @@ void TexCleanUp(void)
   CurrentOutput1 = NULL;
   CurrentOutput2 = NULL;
   CurrentInputIndex = 0;
-  haveArgData = FALSE;
+  haveArgData = false;
   noArgs = 0;
 
   if (TopLevel)
@@ -2153,7 +2154,7 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltCLIPSFUNC,           _T("clipsfunc"), 3);
   AddMacroDef(ltCLUBSUIT,            _T("clubsuit"), 0);
   AddMacroDef(ltCOLUMNSEP,           _T("columnsep"), 1);
-  AddMacroDef(ltCOMMENT,             _T("comment"), 1, TRUE);
+  AddMacroDef(ltCOMMENT,             _T("comment"), 1, true);
   AddMacroDef(ltCONG,                _T("cong"), 0);
   AddMacroDef(ltCOPYRIGHT,           _T("copyright"), 0);
   AddMacroDef(ltCPARAM,              _T("cparam"), 2);
@@ -2221,7 +2222,7 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltHEADHEIGHT,          _T("headheight"), 1);
   AddMacroDef(ltHEARTSUIT,           _T("heartsuit"), 0);
   AddMacroDef(ltHELPGLOSSARY,        _T("helpglossary"), 1);
-  AddMacroDef(ltHELPIGNORE,          _T("helpignore"), 1, TRUE);
+  AddMacroDef(ltHELPIGNORE,          _T("helpignore"), 1, true);
   AddMacroDef(ltHELPONLY,            _T("helponly"), 1);
   AddMacroDef(ltHELPINPUT,           _T("helpinput"), 1);
   AddMacroDef(ltHELPFONTFAMILY,      _T("helpfontfamily"), 1);
@@ -2246,7 +2247,7 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltINCLUDE,             _T("include"), 1);
   AddMacroDef(ltINDENTED,            _T("indented"), 2);
   AddMacroDef(ltINDEX,               _T("index"), 1);
-  AddMacroDef(ltINPUT,               _T("input"), 1, TRUE);
+  AddMacroDef(ltINPUT,               _T("input"), 1, true);
   AddMacroDef(ltIOTA,                _T("iota"), 0);
   AddMacroDef(ltITEMIZE,             _T("itemize"), 1);
   AddMacroDef(ltITEM,                _T("item"), 0);
@@ -2314,7 +2315,7 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltNABLA,               _T("nabla"), 0);
   AddMacroDef(ltNEG,                 _T("neg"), 0);
   AddMacroDef(ltNEQ,                 _T("neq"), 0);
-  AddMacroDef(ltNEWCOUNTER,          _T("newcounter"), 1, FALSE, (bool)FORBID_ABSOLUTELY);
+  AddMacroDef(ltNEWCOUNTER,          _T("newcounter"), 1, false, (bool)FORBID_ABSOLUTELY);
   AddMacroDef(ltNEWLINE,             _T("newline"), 0);
   AddMacroDef(ltNEWPAGE,             _T("newpage"), 0);
   AddMacroDef(ltNI,                  _T("ni"), 0);
@@ -2367,8 +2368,8 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltPRECEQ,              _T("preceq"), 0);
   AddMacroDef(ltPRINTINDEX,          _T("printindex"), 0);
   AddMacroDef(ltPROPTO,              _T("propto"), 0);
-  AddMacroDef(ltPSBOXTO,             _T("psboxto"), 1, FALSE, (bool)FORBID_ABSOLUTELY);
-  AddMacroDef(ltPSBOX,               _T("psbox"), 1, FALSE, (bool)FORBID_ABSOLUTELY);
+  AddMacroDef(ltPSBOXTO,             _T("psboxto"), 1, false, (bool)FORBID_ABSOLUTELY);
+  AddMacroDef(ltPSBOX,               _T("psbox"), 1, false, (bool)FORBID_ABSOLUTELY);
   AddMacroDef(ltPSI,                 _T("psi"), 0);
   AddMacroDef(ltCAP_PSI,             _T("Psi"), 0);
 
@@ -2439,7 +2440,7 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltSUPSET,              _T("supset"), 0);
   AddMacroDef(ltSUBSUBSECTIONSTAR,   _T("subsubsection*"), 1);
   AddMacroDef(ltSUBSUBSECTION,       _T("subsubsection"), 1);
-  AddMacroDef(ltSUPERTABULAR,        _T("supertabular"), 2, FALSE);
+  AddMacroDef(ltSUPERTABULAR,        _T("supertabular"), 2, false);
   AddMacroDef(ltSURD,                _T("surd"), 0);
   AddMacroDef(ltSCRIPTSIZE,          _T("scriptsize"), 1);
   AddMacroDef(ltSETHEADER,           _T("setheader"), 6);
@@ -2453,7 +2454,7 @@ void DefineDefaultMacros(void)
   AddMacroDef(ltTABBING,             _T("tabbing"), 2);
   AddMacroDef(ltTABLEOFCONTENTS,     _T("tableofcontents"), 0);
   AddMacroDef(ltTABLE,               _T("table"), 1);
-  AddMacroDef(ltTABULAR,             _T("tabular"), 2, FALSE);
+  AddMacroDef(ltTABULAR,             _T("tabular"), 2, false);
   AddMacroDef(ltTAB,                 _T("tab"), 0);
   AddMacroDef(ltTAU,                 _T("tau"), 0);
   AddMacroDef(ltTEXTRM,              _T("textrm"), 1);
@@ -2580,8 +2581,8 @@ void DefaultOnMacro(int macroId, int no_args, bool start)
       {
         // Write the heading
         FakeCurrentSection(AbstractNameString);
-        OnMacro(ltPAR, 0, TRUE);
-        OnMacro(ltPAR, 0, FALSE);
+        OnMacro(ltPAR, 0, true);
+        OnMacro(ltPAR, 0, false);
       }
       else
       {
@@ -2600,12 +2601,12 @@ void DefaultOnMacro(int macroId, int no_args, bool start)
       {
         // Write the heading
         FakeCurrentSection(GlossaryNameString);
-        OnMacro(ltPAR, 0, TRUE);
-        OnMacro(ltPAR, 0, FALSE);
+        OnMacro(ltPAR, 0, true);
+        OnMacro(ltPAR, 0, false);
         if ((convertMode == TEX_RTF) && !winHelp)
         {
-          OnMacro(ltPAR, 0, TRUE);
-          OnMacro(ltPAR, 0, FALSE);
+          OnMacro(ltPAR, 0, true);
+          OnMacro(ltPAR, 0, false);
         }
       }
       break;
@@ -2617,100 +2618,100 @@ void DefaultOnMacro(int macroId, int no_args, bool start)
 
     case ltCINSERT:
       if (start)
-        TexOutput(_T("<<"), TRUE);
+        TexOutput(_T("<<"), true);
       break;
     case ltCEXTRACT:
       if (start)
-        TexOutput(_T(">>"), TRUE);
+        TexOutput(_T(">>"), true);
       break;
     case ltDESTRUCT:
       if (start)
-        TexOutput(_T("~"), TRUE);
+        TexOutput(_T("~"), true);
       break;
     case ltTILDE:
       if (start)
-        TexOutput(_T("~"), TRUE);
+        TexOutput(_T("~"), true);
       break;
     case ltSPECIALTILDE:
       if (start)
-        TexOutput(_T(" "), TRUE);
+        TexOutput(_T(" "), true);
       break;
     case ltUNDERSCORE:
       if (start)
-        TexOutput(_T("_"), TRUE);
+        TexOutput(_T("_"), true);
       break;
     case ltHASH:
       if (start)
-        TexOutput(_T("#"), TRUE);
+        TexOutput(_T("#"), true);
       break;
     case ltAMPERSAND:
       if (start)
-        TexOutput(_T("&"), TRUE);
+        TexOutput(_T("&"), true);
       break;
     case ltSPACE:
       if (start)
-        TexOutput(_T(" "), TRUE);
+        TexOutput(_T(" "), true);
       break;
     case ltPIPE:
       if (start)
-        TexOutput(_T("|"), TRUE);
+        TexOutput(_T("|"), true);
       break;
     case ltPERCENT:
       if (start)
-        TexOutput(_T("%"), TRUE);
+        TexOutput(_T("%"), true);
       break;
     case ltDOLLAR:
       if (start)
-        TexOutput(_T("$"), TRUE);
+        TexOutput(_T("$"), true);
       break;
     case ltLPARENTH:
       if (start)
-        TexOutput(_T(""), TRUE);
+        TexOutput(_T(""), true);
       break;
     case ltRPARENTH:
       if (start)
-        TexOutput(_T(""), TRUE);
+        TexOutput(_T(""), true);
       break;
     case ltLBRACE:
       if (start)
-        TexOutput(_T("{"), TRUE);
+        TexOutput(_T("{"), true);
       break;
     case ltRBRACE:
       if (start)
-        TexOutput(_T("}"), TRUE);
+        TexOutput(_T("}"), true);
       break;
     case ltCOPYRIGHT:
       if (start)
-        TexOutput(_T("(c)"), TRUE);
+        TexOutput(_T("(c)"), true);
       break;
     case ltREGISTERED:
       if (start)
-        TexOutput(_T("(r)"), TRUE);
+        TexOutput(_T("(r)"), true);
       break;
     case ltBACKSLASH:
       if (start)    
-        TexOutput(_T("\\"), TRUE);
+        TexOutput(_T("\\"), true);
       break;
     case ltLDOTS:
     case ltCDOTS:
       if (start)
-        TexOutput(_T("..."), TRUE);
+        TexOutput(_T("..."), true);
       break;
     case ltVDOTS:
       if (start)
-        TexOutput(_T("|"), TRUE);
+        TexOutput(_T("|"), true);
       break;
     case ltLATEX:
       if (start)
-        TexOutput(_T("LaTeX"), TRUE);
+        TexOutput(_T("LaTeX"), true);
       break;
     case ltTEX:
       if (start)
-        TexOutput(_T("TeX"), TRUE);
+        TexOutput(_T("TeX"), true);
       break;
     case ltPOUNDS:
       if (start)
-        TexOutput(_T("£"), TRUE);
+        TexOutput(_T("£"), true);
       break;
     case ltSPECIALDOUBLEDOLLAR:  // Interpret as center
       OnMacro(ltCENTER, no_args, start);
@@ -2733,7 +2734,7 @@ void DefaultOnMacro(int macroId, int no_args, bool start)
       {
         time_t when;
         (void) time(&when);
-        TexOutput(wxCtime(&when), TRUE);
+        TexOutput(wxCtime(&when), true);
       }
       break;
     }
@@ -3166,7 +3167,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
               else i ++;
             }
           }
-          TexOutput(texRef->sectionNumber + i, TRUE);
+          TexOutput(texRef->sectionNumber + i, true);
         }
         else
         {
@@ -3175,32 +3176,32 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
            OnInform((wxChar *)informBuf.c_str());
         }
       }
-      else TexOutput(_T("??"), TRUE);
-      return FALSE;
+      else TexOutput(_T("??"), true);
+      return false;
     }
     break;
     }
     case ltLABEL:
     {
-      return FALSE;
+      return false;
     }
     case ltAUTHOR:
     {
       if (start && (arg_no == 1))
         DocumentAuthor = GetArgChunk();
-      return FALSE;
+      return false;
     }
     case ltDATE:
     {
       if (start && (arg_no == 1))
         DocumentDate = GetArgChunk();
-      return FALSE;
+      return false;
     }
     case ltTITLE:
     {
       if (start && (arg_no == 1))
         DocumentTitle = GetArgChunk();
-      return FALSE;
+      return false;
     }
   case ltDOCUMENTCLASS:
   case ltDOCUMENTSTYLE:
@@ -3227,13 +3228,13 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
       else if (StringMatch(_T("12"), DocumentStyleString))
         SetFontSizes(12);
 
-      OnMacro(ltHELPFONTSIZE, 1, TRUE);
-      wxSprintf(currentArgData, _T("%d"), normalFont);
-      haveArgData = TRUE;
-      OnArgument(ltHELPFONTSIZE, 1, TRUE);
-      OnArgument(ltHELPFONTSIZE, 1, FALSE);
-      haveArgData = FALSE;
-      OnMacro(ltHELPFONTSIZE, 1, FALSE);
+      OnMacro(ltHELPFONTSIZE, 1, true);
+      wxSnprintf(currentArgData, 2000, _T("%d"), normalFont);
+      haveArgData = true;
+      OnArgument(ltHELPFONTSIZE, 1, true);
+      OnArgument(ltHELPFONTSIZE, 1, false);
+      haveArgData = false;
+      OnMacro(ltHELPFONTSIZE, 1, false);
     }
     else if (start && IsArgOptional())
     {
@@ -3246,13 +3247,13 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
       else if (StringMatch(_T("12"), MinorDocumentStyleString))
         SetFontSizes(12);
     }
-    return FALSE;
+    return false;
   }
   case ltBIBLIOGRAPHYSTYLE:
   {
     if (start && !IsArgOptional())
       BibliographyStyleString = copystring(GetArgData());
-    return FALSE;
+    return false;
   }
   case ltPAGESTYLE:
   {
@@ -3261,49 +3262,49 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
       if (PageStyle) delete[] PageStyle;
       PageStyle = copystring(GetArgData());
     }
-    return FALSE;
+    return false;
   }
 /*
   case ltLHEAD:
   {
     if (start && !IsArgOptional())
       LeftHeader = GetArgChunk();
-    return FALSE;
+    return false;
     break;
   }
   case ltLFOOT:
   {
     if (start && !IsArgOptional())
       LeftFooter = GetArgChunk();
-    return FALSE;
+    return false;
     break;
   }
   case ltCHEAD:
   {
     if (start && !IsArgOptional())
       CentreHeader = GetArgChunk();
-    return FALSE;
+    return false;
     break;
   }
   case ltCFOOT:
   {
     if (start && !IsArgOptional())
       CentreFooter = GetArgChunk();
-    return FALSE;
+    return false;
     break;
   }
   case ltRHEAD:
   {
     if (start && !IsArgOptional())
       RightHeader = GetArgChunk();
-    return FALSE;
+    return false;
     break;
   }
   case ltRFOOT:
   {
     if (start && !IsArgOptional())
       RightFooter = GetArgChunk();
-    return FALSE;
+    return false;
     break;
   }
 */
@@ -3321,7 +3322,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
         TexRef *ref = FindReference(citeKey);
         if (ref)
         {
-          TexOutput(ref->sectionNumber, TRUE);
+          TexOutput(ref->sectionNumber, true);
           if (wxStrcmp(ref->sectionNumber, _T("??")) == 0)
           {
             wxString informBuf;
@@ -3332,10 +3333,10 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
         citeKey = ParseMultifieldString(citeKeys, &pos);
         if (citeKey)
         {
-          TexOutput(_T(", "), TRUE);
+          TexOutput(_T(", "), true);
         }
       }
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3345,7 +3346,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *citeKey = GetArgData();
       AddCitation(citeKey);
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3360,7 +3361,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
         SetFontSizes(11);
       else if (wxStrcmp(data, _T("12")) == 0)
         SetFontSizes(12);
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3368,8 +3369,8 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
   {
     if (start)
     {
-      TexOutput(_T(" ??"), TRUE);
-      return FALSE;
+      TexOutput(_T(" ??"), true);
+      return false;
     }
     break;
   }
@@ -3379,7 +3380,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *data = GetArgData();
       ParSkip = ParseUnitArgument(data);
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3389,7 +3390,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
     {
       wxChar *data = GetArgData();
       ParIndent = ParseUnitArgument(data);
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3417,9 +3418,9 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
   case ltFOOTNOTE:
   {
     if (start)
-      TexOutput(_T(" ("), TRUE);
+      TexOutput(_T(" ("), true);
     else
-      TexOutput(_T(")"), TRUE);
+      TexOutput(_T(")"), true);
     break;
   }
   case ltBIBLIOGRAPHY:
@@ -3494,7 +3495,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
         wxRenameFile(TexTmpBibName, TexBibName);
       }
       SetCurrentOutputs(save1, save2);
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -3515,12 +3516,12 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
           s1[i] = wxToupper(s[i]);
         TexOutput(s1);
         delete[] s1;
-        return FALSE;
+        return false;
       }
-      else return TRUE;
+      else return true;
 
     }
-    return TRUE;
+    return true;
   }
   case ltLOWERCASE:
   {
@@ -3535,12 +3536,12 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
           s1[i] = wxTolower(s[i]);
         TexOutput(s1);
         delete[] s1;
-        return FALSE;
+        return false;
       }
-      else return TRUE;
+      else return true;
 
     }
-    return TRUE;
+    return true;
   }
   case ltUPPERCASE:
   {
@@ -3555,37 +3556,37 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
           s1[i] = wxToupper(s[i]);
         TexOutput(s1);
         delete[] s1;
-        return FALSE;
+        return false;
       }
-      else return TRUE;
+      else return true;
 
     }
-    return TRUE;
+    return true;
   }
   case ltPOPREF:  // Ignore second argument by default
     return (start && (arg_no == 1));
   case ltTWOCOLUMN:
-    return TRUE;
+    return true;
   case ltXLPIGNORE:
-    return ((convertMode == TEX_XLP) ? FALSE : TRUE);
+    return ((convertMode == TEX_XLP) ? false : true);
   case ltXLPONLY:
-    return ((convertMode != TEX_XLP) ? FALSE : TRUE);
+    return ((convertMode != TEX_XLP) ? false : true);
   case ltHTMLIGNORE:
-    return ((convertMode == TEX_HTML) ? FALSE : TRUE);
+    return ((convertMode == TEX_HTML) ? false : true);
   case ltHTMLONLY:
-    return ((convertMode != TEX_HTML) ? FALSE : TRUE);
+    return ((convertMode != TEX_HTML) ? false : true);
   case ltRTFIGNORE:
-    return (((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE);
+    return (((convertMode == TEX_RTF) && !winHelp) ? false : true);
   case ltRTFONLY:
-    return (!((convertMode == TEX_RTF) && !winHelp) ? FALSE : TRUE);
+    return (!((convertMode == TEX_RTF) && !winHelp) ? false : true);
   case ltWINHELPIGNORE:
-    return (winHelp ? FALSE : TRUE);
+    return (winHelp ? false : true);
   case ltWINHELPONLY:
-    return (!winHelp ? FALSE : TRUE);
+    return (!winHelp ? false : true);
   case ltLATEXIGNORE:
-    return TRUE;
+    return true;
   case ltLATEXONLY:
-    return FALSE;
+    return false;
   case ltCLINE:
   case ltARABIC:
   case ltALPH1:
@@ -3655,7 +3656,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
   case ltIMAGER:
   case ltPOPREFONLY:
   case ltINSERTATLEVEL:
-    return FALSE;
+    return false;
   case ltTABULAR:
   case ltSUPERTABULAR:
   case ltINDENTED:
@@ -3699,7 +3700,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
           break;
       }
     }
-    return FALSE;
+    return false;
   }
   case ltFIGURE:
   case ltFIGURESTAR:
@@ -3708,6 +3709,6 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
   default:
     return (!IsArgOptional());
   }
-  return TRUE;
+  return true;
 }
 
index cd29772fc4de57e6ff2c0da700434c0b4949e61b..97c6d0d123dab44e60c3f44799f70229de914644 100644 (file)
@@ -147,20 +147,20 @@ extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.t
 bool read_a_line(wxChar *buf);
 bool TexLoadFile(wxChar *filename);
 int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos,
-           wxChar *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL);
+           wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
 int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args,
-           wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = TRUE, TexChunk *customMacroArgs = NULL);
+           wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
 void TraverseDocument(void);
-void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = FALSE);
-#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, TRUE)
+void TraverseFromChunk(TexChunk *chunk, wxNode *thisNode = NULL, bool childrenOnly = false);
+#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true)
 void SetCurrentOutput(FILE *fd);
 void SetCurrentOutputs(FILE *fd1, FILE *fd2);
 extern FILE *CurrentOutput1;
 extern FILE *CurrentOutput2;
-void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = FALSE, bool forbidden = FALSE);
+void AddMacroDef(int the_id, const wxChar *name, int n, bool ignore = false, bool forbidden = false);
 void TexInitialize(int bufSize);
 void TexCleanUp(void);
-void TexOutput(const wxChar *s, bool ordinaryText = FALSE);
+void TexOutput(const wxChar *s, bool ordinaryText = false);
 wxChar *GetArgData(TexChunk *chunk);
 wxChar *GetArgData(void);             // Get the string for the current argument
 int GetNoArgs(void);                // Get the number of arguments for the current macro
@@ -174,11 +174,11 @@ wxChar *ConvertCase(wxChar *s);         // Convert case, according to upperCaseN
 extern wxPathList TexPathList;      // Path list, can be used for file searching.
 
 #if !WXWIN_COMPATIBILITY_2
-extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = TRUE, bool exact = FALSE);
+extern bool StringMatch(const wxChar *one, const wxChar *two, bool subString = true, bool exact = false);
 #endif
 
 // Define a variable value from the .ini file
-wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = TRUE);
+wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interactive = true);
 
 // Major document styles
 #define LATEX_REPORT    1
@@ -324,7 +324,7 @@ extern void OutputCurrentSectionToString(wxChar *buf);
 extern void OutputChunkToString(TexChunk *chunk, wxChar *buf);
 
 // Called by Tex2Any to simulate a section
-extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = TRUE);
+extern void FakeCurrentSection(wxChar *fakeSection, bool addToContents = true);
 
 /*
  * Local to Tex2Any library
@@ -362,7 +362,7 @@ void OnError(const wxChar *msg);
 void OnInform(const wxChar *msg);
 
 // Special yield wrapper
-void Tex2RTFYield(bool force = FALSE);
+void Tex2RTFYield(bool force = false);
 
 /*
  * Useful utilities
index f3f655fb19b7260ca7216705c4a978385ece63a4..14a8974018c3d6e69dbfbfa89caae86a7cdfaa24 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        tex2rtf.cpp
 // Purpose:     Converts Latex to linear/WinHelp RTF, HTML, wxHelp.
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -34,7 +35,6 @@
 #include "wx/timer.h"
 #endif
 
-#if defined(NO_GUI) || defined(__UNIX__)
 #if wxUSE_IOSTREAMH
 #include <iostream.h>
 #include <fstream.h>
@@ -42,7 +42,6 @@
 #include <iostream>
 #include <fstream>
 #endif
-#endif
 
 #include <ctype.h>
 #include <stdlib.h>
@@ -63,10 +62,10 @@ static inline wxChar* copystring(const wxChar* s)
 const float versionNo = TEX2RTF_VERSION_NUMBER;
 
 TexChunk *currentMember = NULL;
-bool startedSections = FALSE;
+bool startedSections = false;
 wxChar *contentsString = NULL;
-bool suppressNameDecoration = FALSE;
-bool OkToClose = TRUE;
+bool suppressNameDecoration = false;
+bool OkToClose = true;
 int passNumber = 1;
 unsigned long errorCount = 0;
 
@@ -127,18 +126,16 @@ void ShowOptions(void);
 wxChar wxTex2RTFBuffer[1500];
 
 #ifdef NO_GUI
-
-int main(int argc, char **argv)
+    IMPLEMENT_APP_CONSOLE(MyApp)
 #else
-wxMenuBar *menuBar = NULL;
-MyFrame *frame = NULL;
-
-// DECLARE_APP(MyApp)
-IMPLEMENT_APP(MyApp)
+    wxMenuBar *menuBar = NULL;
+    MyFrame *frame = NULL;
+    // DECLARE_APP(MyApp)
+    IMPLEMENT_APP(MyApp)
+#endif
 
 // `Main program' equivalent, creating windows and returning main app frame
 bool MyApp::OnInit()
-#endif
 {
   // Use default list of macros defined in tex2any.cc
   DefineDefaultMacros();
@@ -151,7 +148,7 @@ bool MyApp::OnInit()
   WinHelpContentsFileName = new wxChar[300];
   RefFileName = new wxChar[300];
 
-  ColourTable.DeleteContents(TRUE);
+  ColourTable.DeleteContents(true);
 
   int n = 1;
 
@@ -181,14 +178,14 @@ bool MyApp::OnInit()
     ShowOptions();
     exit(1);
   }
-
 #endif
+
   if (InputFile)
   {
     TexPathList.EnsureFileAccessible(InputFile);
   }
   if (!InputFile || !OutputFile)
-    isInteractive = TRUE;
+    isInteractive = true;
 
   int i;
   for (i = n; i < argc;)
@@ -197,19 +194,19 @@ bool MyApp::OnInit()
     {
       i ++;
       convertMode = TEX_RTF;
-      winHelp = TRUE;
+      winHelp = true;
     }
 #ifndef NO_GUI
     else if (wxStrcmp(argv[i], _T("-interactive")) == 0)
     {
       i ++;
-      isInteractive = TRUE;
+      isInteractive = true;
     }
 #endif
     else if (wxStrcmp(argv[i], _T("-sync")) == 0)  // Don't yield
     {
       i ++;
-      isSync = TRUE;
+      isSync = true;
     }
     else if (wxStrcmp(argv[i], _T("-rtf")) == 0)
     {
@@ -229,7 +226,7 @@ bool MyApp::OnInit()
     else if (wxStrcmp(argv[i], _T("-twice")) == 0)
     {
       i ++;
-      runTwice = TRUE;
+      runTwice = true;
     }
     else if (wxStrcmp(argv[i], _T("-macros")) == 0)
     {
@@ -262,19 +259,19 @@ bool MyApp::OnInit()
         else
         {
           OnError(_T("Incorrect argument for -charset"));
-          return FALSE;
+          return false;
         }
       }
     }
     else if (wxStrcmp(argv[i], _T("-checkcurleybraces")) == 0)
     {
       i ++;
-      checkCurleyBraces = TRUE;
+      checkCurleyBraces = true;
     }
     else if (wxStrcmp(argv[i], _T("-checksyntax")) == 0)
     {
       i ++;
-      checkSyntax = TRUE;
+      checkSyntax = true;
     }
     else
     {
@@ -285,7 +282,7 @@ bool MyApp::OnInit()
       ShowOptions();
       exit(1);
 #endif
-      return FALSE;
+      return false;
     }
   }
 
@@ -311,7 +308,7 @@ bool MyApp::OnInit()
     wxChar buf[100];
 
     // Create the main frame window
-    frame = new MyFrame(NULL, -1, _T("Tex2RTF"), wxPoint(-1, -1), wxSize(400, 300));
+    frame = new MyFrame(NULL, wxID_ANY, _T("Tex2RTF"), wxDefaultPosition, wxSize(400, 300));
     frame->CreateStatusBar(2);
 
     // Give it an icon
@@ -320,7 +317,7 @@ bool MyApp::OnInit()
 
     if (InputFile)
     {
-      wxSprintf(buf, _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile));
+      wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile));
       frame->SetTitle(buf);
     }
 
@@ -350,8 +347,8 @@ bool MyApp::OnInit()
 
     wxMenu *options_menu = new wxMenu;
 
-    options_menu->Append(TEX_OPTIONS_CURELY_BRACE, _T("Curley brace matching"), _T("Checks for mismatched curley braces"),TRUE);
-    options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),TRUE);
+    options_menu->Append(TEX_OPTIONS_CURELY_BRACE, _T("Curley brace matching"), _T("Checks for mismatched curley braces"),true);
+    options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),true);
 
     options_menu->Check(TEX_OPTIONS_CURELY_BRACE, checkCurleyBraces);
     options_menu->Check(TEX_OPTIONS_SYNTAX_CHECKING, checkSyntax);
@@ -369,7 +366,7 @@ bool MyApp::OnInit()
     menuBar->Append(help_menu, _T("&Help"));
 
     frame->SetMenuBar(menuBar);
-    frame->textWindow = new wxTextCtrl(frame, -1, _T(""), wxPoint(-1, -1), wxSize(-1, -1), wxTE_READONLY|wxTE_MULTILINE);
+    frame->textWindow = new wxTextCtrl(frame, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE);
 
     (*frame->textWindow) << _T("Welcome to Tex2RTF.\n");
 //    ShowOptions();
@@ -399,8 +396,8 @@ bool MyApp::OnInit()
       wxStrcat(buf, _T(" mode."));
     frame->SetStatusText(buf, 1);
 
-    frame->Show(TRUE);
-    return TRUE;
+    frame->Show(true);
+    return true;
   }
   else
 #endif // NO_GUI
@@ -420,21 +417,11 @@ bool MyApp::OnInit()
         Go();
     }
 #ifdef NO_GUI
-    return 0;
+    return true;
 #else
-    return FALSE;
+    return false;
 #endif
   }
-
-#if 0
-  // it already returned something, no need to cause warning
-#ifndef NO_GUI
-  // Return the main frame window
-  return TRUE;
-#else
-  return 0;
-#endif
-#endif
 }
 
 #ifndef NO_GUI
@@ -573,7 +560,7 @@ int MyApp::OnExit()
 void ShowOptions(void)
 {
     wxChar buf[100];
-    wxSprintf(buf, _T("Tex2RTF version %.2f"), versionNo);
+    wxSnprintf(buf, sizeof(buf), _T("Tex2RTF version %.2f"), versionNo);
     OnInform(buf);
     OnInform(_T("Usage: tex2rtf [input] [output] [switches]\n"));
     OnInform(_T("where valid switches are"));
@@ -625,8 +612,8 @@ void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
 {
   if (!stopRunning && !OkToClose)
   {
-    stopRunning = TRUE;
-    runTwice = FALSE;
+    stopRunning = true;
+    runTwice = false;
     return;
   }
   else if (OkToClose)
@@ -645,12 +632,12 @@ void MyFrame::OnGo(wxCommandEvent& WXUNUSED(event))
 {
       passNumber = 1;
       errorCount = 0;
-      menuBar->EnableTop(0, FALSE);
-      menuBar->EnableTop(1, FALSE);
-      menuBar->EnableTop(2, FALSE);
-      menuBar->EnableTop(3, FALSE);
+      menuBar->EnableTop(0, false);
+      menuBar->EnableTop(1, false);
+      menuBar->EnableTop(2, false);
+      menuBar->EnableTop(3, false);
       textWindow->Clear();
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       Go();
 
       if (stopRunning)
@@ -664,23 +651,23 @@ void MyFrame::OnGo(wxCommandEvent& WXUNUSED(event))
 
       if (runTwice && !stopRunning)
       {
-        Tex2RTFYield(TRUE);
+        Tex2RTFYield(true);
         Go();
       }
-      menuBar->EnableTop(0, TRUE);
-      menuBar->EnableTop(1, TRUE);
-      menuBar->EnableTop(2, TRUE);
-      menuBar->EnableTop(3, TRUE);
+      menuBar->EnableTop(0, true);
+      menuBar->EnableTop(1, true);
+      menuBar->EnableTop(2, true);
+      menuBar->EnableTop(3, true);
 }
 
 void MyFrame::OnSetInput(wxCommandEvent& WXUNUSED(event))
 {
-      ChooseInputFile(TRUE);
+      ChooseInputFile(true);
 }
 
 void MyFrame::OnSetOutput(wxCommandEvent& WXUNUSED(event))
 {
-      ChooseOutputFile(TRUE);
+      ChooseOutputFile(true);
 }
 
 void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
@@ -690,7 +677,7 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
       {
         textWindow->SaveFile(s);
         wxChar buf[350];
-        wxSprintf(buf, _T("Saved text to %s"), (const wxChar*) s.c_str());
+        wxSnprintf(buf, sizeof(buf), _T("Saved text to %s"), (const wxChar*) s.c_str());
         frame->SetStatusText(buf, 0);
       }
 }
@@ -703,7 +690,7 @@ void MyFrame::OnViewOutput(wxCommandEvent& WXUNUSED(event))
         textWindow->LoadFile(OutputFile);
         wxChar buf[300];
         wxString str(wxFileNameFromPath(OutputFile));
-        wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
+        wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
         frame->SetTitle(buf);
       }
 }
@@ -716,7 +703,7 @@ void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
         textWindow->LoadFile(InputFile);
         wxChar buf[300];
         wxString str(wxFileNameFromPath(OutputFile));
-        wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
+        wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
         frame->SetTitle(buf);
       }
 }
@@ -736,14 +723,14 @@ void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnShowMacros(wxCommandEvent& WXUNUSED(event))
 {
       textWindow->Clear();
-      Tex2RTFYield(TRUE);
+      Tex2RTFYield(true);
       ShowCustomMacros();
 }
 
 void MyFrame::OnModeRTF(wxCommandEvent& WXUNUSED(event))
 {
       convertMode = TEX_RTF;
-      winHelp = FALSE;
+      winHelp = false;
       InputFile = NULL;
       OutputFile = NULL;
       SetStatusText(_T("In linear RTF mode."), 1);
@@ -752,7 +739,7 @@ void MyFrame::OnModeRTF(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
 {
       convertMode = TEX_RTF;
-      winHelp = TRUE;
+      winHelp = true;
       InputFile = NULL;
       OutputFile = NULL;
       SetStatusText(_T("In WinHelp RTF mode."), 1);
@@ -761,7 +748,7 @@ void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
 void MyFrame::OnModeHTML(wxCommandEvent& WXUNUSED(event))
 {
       convertMode = TEX_HTML;
-      winHelp = FALSE;
+      winHelp = false;
       InputFile = NULL;
       OutputFile = NULL;
       SetStatusText(_T("In HTML mode."), 1);
@@ -823,7 +810,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
       wxChar *platform = _T("");
 #endif
 #endif
-      wxSprintf(buf, _T("Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2002"), versionNo, platform);
+      wxSnprintf(buf, sizeof(buf), _T("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, _T("About Tex2RTF"));
 }
 
@@ -905,7 +892,7 @@ bool Go(void)
 #endif
 
   if (!InputFile || !OutputFile || stopRunning)
-    return FALSE;
+    return false;
 
 #ifndef NO_GUI
   if (isInteractive)
@@ -913,7 +900,7 @@ bool Go(void)
     wxChar buf[300];
     wxString str = wxFileNameFromPath(InputFile);
 
-    wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str);
+    wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str);
     frame->SetTitle(buf);
   }
 
@@ -936,11 +923,11 @@ bool Go(void)
         sName[5] = '\0';  // that should do!
   }
 
-  wxSprintf(ContentsName, _T("%s.con"), FileRoot);
-  wxSprintf(TmpContentsName, _T("%s.cn1"), FileRoot);
-  wxSprintf(TmpFrameContentsName, _T("%s.frc"), FileRoot);
-  wxSprintf(WinHelpContentsFileName, _T("%s.cnt"), FileRoot);
-  wxSprintf(RefFileName, _T("%s.ref"), FileRoot);
+  wxSnprintf(ContentsName, 300, _T("%s.con"), FileRoot);
+  wxSnprintf(TmpContentsName, 300, _T("%s.cn1"), FileRoot);
+  wxSnprintf(TmpFrameContentsName, 300, _T("%s.frc"), FileRoot);
+  wxSnprintf(WinHelpContentsFileName, 300, _T("%s.cnt"), FileRoot);
+  wxSnprintf(RefFileName, 300, _T("%s.ref"), FileRoot);
 
   TexPathList.EnsureFileAccessible(InputFile);
   if (!bulletFile)
@@ -956,7 +943,7 @@ bool Go(void)
   if (wxFileExists(RefFileName))
     ReadTexReferences(RefFileName);
 
-  bool success = FALSE;
+  bool success = false;
 
   if (InputFile && OutputFile)
   {
@@ -964,7 +951,7 @@ bool Go(void)
     {
       OnError(_T("Cannot open input file!"));
       TexCleanUp();
-      return FALSE;
+      return false;
     }
 #ifndef NO_GUI
     if (isInteractive)
@@ -974,14 +961,14 @@ bool Go(void)
       frame->SetStatusText((wxChar *)buf.c_str());
     }
 #endif
-    OkToClose = FALSE;
+    OkToClose = false;
     OnInform(_T("Reading LaTeX file..."));
     TexLoadFile(InputFile);
 
     if (stopRunning)
     {
-        OkToClose = TRUE;
-        return FALSE;
+        OkToClose = true;
+        return false;
     }
 
     switch (convertMode)
@@ -1006,16 +993,16 @@ bool Go(void)
   if (stopRunning)
   {
     OnInform(_T("*** Aborted by user."));
-    success = FALSE;
-    stopRunning = FALSE;
-    OkToClose = TRUE;
+    success = false;
+    stopRunning = false;
+    OkToClose = true;
   }
 
   if (success)
   {
     WriteTexReferences(RefFileName);
     TexCleanUp();
-    startedSections = FALSE;
+    startedSections = false;
 
     wxString buf;
 #ifndef NO_GUI
@@ -1045,28 +1032,29 @@ bool Go(void)
 #endif
     passNumber ++;
     errorCount = 0;
-    OkToClose = TRUE;
-    return TRUE;
+    OkToClose = true;
+    return true;
   }
 
   TexCleanUp();
-  startedSections = FALSE;
+  startedSections = false;
 
 #ifndef NO_GUI
   frame->SetStatusText(_T("Aborted by user."));
 #endif // GUI
 
   OnInform(_T("Sorry, unsuccessful."));
-  OkToClose = TRUE;
-  return FALSE;
+  OkToClose = true;
+  return false;
 }
 
 void OnError(const wxChar *msg)
 {
+  wxString msg_string = msg;
   errorCount++;
 
 #ifdef NO_GUI
-  wxSTD cerr << "Error: " << msg << "\n";
+  wxSTD cerr << "Error: " << msg_string.mb_str() << "\n";
   wxSTD cerr.flush();
 #else
   if (isInteractive && frame)
@@ -1074,7 +1062,7 @@ void OnError(const wxChar *msg)
   else
 #ifdef __UNIX__
   {
-    wxSTD cerr << "Error: " << msg << "\n";
+    wxSTD cerr << "Error: " << msg_string.mb_str() << "\n";
     wxSTD cerr.flush();
   }
 #endif
@@ -1082,14 +1070,15 @@ void OnError(const wxChar *msg)
 #ifdef __WXMSW__
     wxLogError(msg);
 #endif
-  Tex2RTFYield(TRUE);
+  Tex2RTFYield(true);
 #endif // NO_GUI
 }
 
 void OnInform(const wxChar *msg)
 {
+  wxString msg_string = msg;
 #ifdef NO_GUI
-  wxSTD cout << msg << "\n";
+  wxSTD cout << msg_string.mb_str() << "\n";
   wxSTD cout.flush();
 #else
   if (isInteractive && frame)
@@ -1102,7 +1091,7 @@ void OnInform(const wxChar *msg)
   else
 #ifdef __WXMSW__
   {
-    wxSTD cout << msg << "\n";
+    wxSTD cout << msg_string.mb_str() << "\n";
     wxSTD cout.flush();
   }
 #endif
@@ -1112,7 +1101,7 @@ void OnInform(const wxChar *msg)
 */
   if (isInteractive)
   {
-    Tex2RTFYield(TRUE);
+    Tex2RTFYield(true);
   }
 #endif // NO_GUI
 }
@@ -1159,7 +1148,7 @@ bool OnArgument(int macroId, int arg_no, bool start)
       // break;
     }
   }
-  return TRUE;
+  return true;
 }
 
 /*
@@ -1201,12 +1190,12 @@ bool SplitCommand(wxChar *data, wxChar *firstArg, wxChar *secondArg)
   firstArg[0] = 0;
   secondArg[0] = 0;
   int i = 0;
-  bool stop = FALSE;
+  bool stop = false;
   // Find first argument (command name)
   while (!stop)
   {
     if (data[i] == ' ' || data[i] == 0)
-      stop = TRUE;
+      stop = true;
     else
     {
       firstArg[i] = data[i];
@@ -1227,7 +1216,7 @@ bool SplitCommand(wxChar *data, wxChar *firstArg, wxChar *secondArg)
     }
     secondArg[j] = 0;
   }
-  return TRUE;
+  return true;
 }
 
 bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data, int WXUNUSED(size), wxIPCFormat WXUNUSED(format))
@@ -1247,7 +1236,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
       {
         wxChar buf[100];
         wxString str = wxFileNameFromPath(InputFile);
-        wxSprintf(buf, _T("Tex2RTF [%s]"), (const wxChar*) str);
+        wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str);
         frame->SetTitle(buf);
       }
     }
@@ -1271,20 +1260,20 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
     else if (wxStrcmp(firstArg, _T("MINIMIZE")) == 0 || wxStrcmp(firstArg, _T("ICONIZE")) == 0)
     {
       if (frame)
-        frame->Iconize(TRUE);
+        frame->Iconize(true);
     }
     else if (wxStrcmp(firstArg, _T("SHOW")) == 0 || wxStrcmp(firstArg, _T("RESTORE")) == 0)
     {
       if (frame)
       {
-        frame->Iconize(FALSE);
-        frame->Show(TRUE);
+        frame->Iconize(false);
+        frame->Show(true);
       }
     }
     else
     {
       // Try for a setting
-      wxStrcpy(Tex2RTFLastStatus, RegisterSetting(firstArg, secondArg, FALSE));
+      wxStrcpy(Tex2RTFLastStatus, RegisterSetting(firstArg, secondArg, false));
 #ifndef NO_GUI
       if (frame && wxStrcmp(firstArg, _T("conversionMode")) == 0)
       {
@@ -1303,7 +1292,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
 #endif
     }
   }
-  return TRUE;
+  return true;
 }
 
 wxChar *Tex2RTFConnection::OnRequest(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), int *WXUNUSED(size), wxIPCFormat WXUNUSED(format))
index 84f361cc029b40e90b1485ce98797b9a316dcdcd..d28bf91e0396f5b6bf602a9a51081e7a2eb49aff 100644 (file)
@@ -2,26 +2,43 @@
 // Name:        tex2any.h
 // Purpose:     tex2RTF conversion header
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifndef NO_GUI
 #include "wx/app.h"
-#include "wx/frame.h"
 
-class WXDLLEXPORT wxTextCtrl;
+#ifndef NO_GUI
+    #include "wx/frame.h"
+    #include "wx/textctrl.h"
+
+#ifdef __WXMSW__
+    #include "wx/dde.h"
+#endif
+
+#endif
 
 // Define a new application type
-class MyApp: public wxApp
+class MyApp: public 
+                    #ifndef NO_GUI
+                        wxApp
+                    #else
+                        wxAppConsole
+                    #endif
 { public:
     bool OnInit();
+#ifdef NO_GUI
+    int OnRun() { return EXIT_SUCCESS; }
+#else
     int OnExit();
+#endif
 };
 
+#ifndef NO_GUI
+
 // Define a new frame type
 class MyFrame: public wxFrame
 { public:
@@ -52,7 +69,6 @@ DECLARE_EVENT_TABLE()
 };
 
 #ifdef __WXMSW__
-#include "wx/dde.h"
 
 class Tex2RTFConnection: public wxDDEConnection
 {
@@ -147,8 +163,8 @@ extern wxChar *RefName;         // Reference file name
 extern wxChar *bulletFile;
 
 #ifndef NO_GUI
-void ChooseOutputFile(bool force = FALSE);
-void ChooseInputFile(bool force = FALSE);
+void ChooseOutputFile(bool force = false);
+void ChooseInputFile(bool force = false);
 #endif
 
 void RTFOnMacro(int macroId, int no_args, bool start);
index 3812ba7e40182f41b8d332acafcb7d1da9c0ad9a..80a35b8ae258a09325aba1f084dea8229b8ed800 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        texutils.cpp
 // Purpose:     Miscellaneous utilities
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -136,16 +137,16 @@ void FakeCurrentSection(wxChar *fakeSection, bool addToContents)
     int mac = ltSECTIONHEADING;
     if (!addToContents)
       mac = ltSECTIONHEADINGSTAR;
-    OnMacro(mac, 0, TRUE);
-    OnMacro(mac, 0, FALSE);
+    OnMacro(mac, 0, true);
+    OnMacro(mac, 0, false);
   }
   else
   {
     int mac = ltCHAPTERHEADING;
     if (!addToContents)
       mac = ltCHAPTERHEADINGSTAR;
-    OnMacro(mac, 0, TRUE);
-    OnMacro(mac, 0, FALSE);
+    OnMacro(mac, 0, true);
+    OnMacro(mac, 0, false);
   }
   if (fakeCurrentSection) delete[] fakeCurrentSection;
   fakeCurrentSection = NULL;
@@ -203,7 +204,7 @@ wxChar *FindTopicName(TexChunk *chunk)
     return topicName;
   else
   {
-    wxSprintf(topicBuf, _T("topic%ld"), topicCounter);
+    wxSnprintf(topicBuf, sizeof(topicBuf), _T("topic%ld"), topicCounter);
     topicCounter ++;
     return topicBuf;
   }
@@ -219,12 +220,12 @@ wxChar *FindTopicName(TexChunk *chunk)
 void StartSimulateArgument(wxChar *data)
 {
   wxStrcpy(currentArgData, data);
-  haveArgData = TRUE;
+  haveArgData = true;
 }
 
 void EndSimulateArgument(void)
 {
-  haveArgData = FALSE;
+  haveArgData = false;
 }
 
 /*
@@ -362,7 +363,7 @@ void AddTexRef(wxChar *name, wxChar *file, wxChar *sectionName,
   if (chapter)
   {
     wxChar buf2[10];
-    wxSprintf(buf2, _T("%d"), chapter);
+    wxSnprintf(buf2, sizeof(buf2), _T("%d"), chapter);
     wxStrcat(buf, buf2);
   }
   if (section)
@@ -371,21 +372,21 @@ void AddTexRef(wxChar *name, wxChar *file, wxChar *sectionName,
     if (chapter)
       wxStrcat(buf, _T("."));
 
-    wxSprintf(buf2, _T("%d"), section);
+    wxSnprintf(buf2, sizeof(buf2), _T("%d"), section);
     wxStrcat(buf, buf2);
   }
   if (subsection)
   {
     wxChar buf2[10];
     wxStrcat(buf, _T("."));
-    wxSprintf(buf2, _T("%d"), subsection);
+    wxSnprintf(buf2, sizeof(buf2), _T("%d"), subsection);
     wxStrcat(buf, buf2);
   }
   if (subsubsection)
   {
     wxChar buf2[10];
     wxStrcat(buf, _T("."));
-    wxSprintf(buf2, _T("%d"), subsubsection);
+    wxSnprintf(buf2, sizeof(buf2), _T("%d"), subsubsection);
     wxStrcat(buf, buf2);
   }
   wxChar *tmp = ((wxStrlen(buf) > 0) ? buf : (wxChar *)NULL);
@@ -394,9 +395,10 @@ void AddTexRef(wxChar *name, wxChar *file, wxChar *sectionName,
 
 void WriteTexReferences(wxChar *filename)
 {
-  wxSTD ofstream ostr(filename);
+  wxString converter;
+  wxString name = filename;
+  wxSTD ofstream ostr((char const *)name.fn_str());
   if (ostr.bad()) return;
-  wxChar buf[200];
   
   TexReferences.BeginFind();
   wxNode *node = TexReferences.Next();
@@ -404,12 +406,22 @@ void WriteTexReferences(wxChar *filename)
   {
     Tex2RTFYield();
     TexRef *ref = (TexRef *)node->GetData();
-    ostr << ref->refLabel << _T(" ") << (ref->refFile ? ref->refFile : _T("??")) << _T(" ");
-    ostr << (ref->sectionName ? ref->sectionName : _T("??")) << _T(" ");
-    ostr << (ref->sectionNumber ? ref->sectionNumber : _T("??")) << _T("\n");
+    converter = ref->refLabel;
+    ostr << converter.mb_str();
+    ostr << " ";
+    converter = (ref->refFile ? ref->refFile : _T("??"));
+    ostr << converter.mb_str();
+    ostr << " ";
+    converter = (ref->sectionName ? ref->sectionName : _T("??")) ;
+    ostr << converter.mb_str();
+    ostr << " ";
+    converter = (ref->sectionNumber ? ref->sectionNumber : _T("??")) ;
+    ostr << converter.mb_str();
+    ostr << "\n";
     if (!ref->sectionNumber || (wxStrcmp(ref->sectionNumber, _T("??")) == 0 && wxStrcmp(ref->sectionName, _T("??")) == 0))
     {
-      wxSprintf(buf, _T("Warning: reference %s not resolved."), ref->refLabel);
+      wxChar buf[200];
+      wxSnprintf(buf, sizeof(buf), _T("Warning: reference %s not resolved."), ref->refLabel);
       OnInform(buf);
     }
     node = TexReferences.Next();
@@ -421,14 +433,15 @@ void ReadTexReferences(wxChar *filename)
   if (!wxFileExists(filename))
       return;
 
-  wxSTD ifstream istr(filename, wxSTD ios::in);
+  wxString name = filename;
+  wxSTD ifstream istr((char const *)name.fn_str(), wxSTD ios::in);
 
   if (istr.bad()) return;
 
-  wxChar label[100];
-  wxChar file[400];
-  wxChar section[100];
-  wxChar sectionName[100];
+  char label[100];
+  char file[400];
+  char section[100];
+  char sectionName[100];
 
   while (!istr.eof())
   {
@@ -449,13 +462,26 @@ void ReadTexReferences(wxChar *filename)
       }
       section[i] = 0;
 
+      wxString label_string       = wxString::FromAscii(label);
+      wxString file_string        = wxString::FromAscii(file);
+      wxString sectionName_string = wxString::FromAscii(sectionName);
+      wxString section_string     = wxString::FromAscii(section);
+
       // gt - needed to trick the hash table "TexReferences" into deleting the key 
       // strings it creates in the Put() function, but not the item that is
       // created here, as that is destroyed elsewhere.  Without doing this, there
       // were massive memory leaks
-      TexReferences.DeleteContents(TRUE);
-      TexReferences.Put(label, new TexRef(label, file, section, sectionName));
-      TexReferences.DeleteContents(FALSE);
+      TexReferences.DeleteContents(true);
+      TexReferences.Put(
+        label_string.c_str(), 
+        new TexRef(
+              label_string.c_str(), 
+              file_string.c_str(), 
+              section_string.c_str(), 
+              sectionName_string.c_str()
+        )
+      );
+      TexReferences.DeleteContents(false);
     }
   }
 }
@@ -515,13 +541,13 @@ void BibReadToEOL(wxSTD istream& istr, wxChar *buffer)
 {
   int i = 0;
   buffer[i] = 0;
-  wxChar ch = istr.peek();
-  bool inQuotes = FALSE;
-  if (ch == _T('"'))
+  char ch = istr.peek();
+  bool inQuotes = false;
+  if (ch == '"')
   {
     istr.get(ch);
     ch = istr.peek();
-    inQuotes = TRUE;
+    inQuotes = true;
   }
   // If in quotes, read white space too. If not,
   // stop at white space or comment.
@@ -540,21 +566,21 @@ void BibReadToEOL(wxSTD istream& istr, wxChar *buffer)
 }
 
 // Read }-terminated value, taking nested braces into account.
-void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = TRUE,
-                  bool quotesMayTerminate = TRUE)
+void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = true,
+                  bool quotesMayTerminate = true)
 {
   int braceCount = 1;
   int i = 0;
   buffer[i] = 0;
   char ch = istr.peek();
-  bool stopping = FALSE;
+  bool stopping = false;
   while (!istr.eof() && !stopping)
   {
 //    i ++;
     if (i >= 4000)
     {
       wxChar buf[100];
-      wxSprintf(buf, _T("Sorry, value > 4000 chars in bib file at line %ld."), BibLine);
+      wxSnprintf(buf, sizeof(buf), _T("Sorry, value > 4000 chars in bib file at line %ld."), BibLine);
       wxLogError(buf, "Tex2RTF Fatal Error");
       return;
     }
@@ -568,13 +594,13 @@ void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = TRUE,
       braceCount --;
       if (braceCount == 0)
       {
-        stopping = TRUE;
+        stopping = true;
         break;
       }
     }
     else if (quotesMayTerminate && ch == '"')
     {
-      stopping = TRUE;
+      stopping = true;
       break;
     }
     if (!stopping)
@@ -595,11 +621,12 @@ void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = TRUE,
 bool ReadBib(wxChar *filename)
 {
   if (!wxFileExists(filename))
-      return FALSE;
+      return false;
 
+  wxString name = filename;
   wxChar buf[300];
-  wxSTD ifstream istr(filename, wxSTD ios::in);
-  if (istr.bad()) return FALSE;
+  wxSTD ifstream istr((char const *)name.fn_str(), wxSTD ios::in);
+  if (istr.bad()) return false;
 
   BibLine = 1;
 
@@ -618,38 +645,38 @@ bool ReadBib(wxChar *filename)
     istr.get(ch);
     if (ch != '@')
     {
-      wxSprintf(buf, _T("Expected @: malformed bib file at line %ld (%s)"), BibLine, filename);
+      wxSnprintf(buf, sizeof(buf), _T("Expected @: malformed bib file at line %ld (%s)"), BibLine, filename);
       OnError(buf);
-      return FALSE;
+      return false;
     }
     BibReadWord(istr, recordType);
     BibEatWhiteSpace(istr);
     istr.get(ch);
     if (ch != '{' && ch != '(')
     {
-      wxSprintf(buf, _T("Expected { or ( after record type: malformed .bib file at line %ld (%s)"), BibLine, filename);
+      wxSnprintf(buf, sizeof(buf), _T("Expected { or ( after record type: malformed .bib file at line %ld (%s)"), BibLine, filename);
       OnError(buf);
-      return FALSE;
+      return false;
     }
     BibEatWhiteSpace(istr);
-    if (StringMatch(recordType, _T("string"), FALSE, TRUE))
+    if (StringMatch(recordType, _T("string"), false, true))
     {
       BibReadWord(istr, recordType);
       BibEatWhiteSpace(istr);
       istr.get(ch);
       if (ch != '=')
       {
-        wxSprintf(buf, _T("Expected = after string key: malformed .bib file at line %ld (%s)"), BibLine, filename);
+        wxSnprintf(buf, sizeof(buf), _T("Expected = after string key: malformed .bib file at line %ld (%s)"), BibLine, filename);
         OnError(buf);
-        return FALSE;
+        return false;
       }
       BibEatWhiteSpace(istr);
       istr.get(ch);
       if (ch != '"' && ch != '{')
       {
-        wxSprintf(buf, _T("Expected = after string key: malformed .bib file at line %ld (%s)"), BibLine, filename);
+        wxSnprintf(buf, sizeof(buf), _T("Expected = after string key: malformed .bib file at line %ld (%s)"), BibLine, filename);
         OnError(buf);
-        return FALSE;
+        return false;
       }
       BibReadValue(istr, fieldValue);
 
@@ -670,14 +697,14 @@ bool ReadBib(wxChar *filename)
       bibEntry->key = copystring(recordKey);
       bibEntry->type = copystring(recordType);
 
-      bool moreRecords = TRUE;
+      bool moreRecords = true;
       while (moreRecords && !istr.eof())
       {
         BibEatWhiteSpace(istr);
         istr.get(ch);
         if (ch == '}' || ch == ')')
         {
-          moreRecords = FALSE;
+          moreRecords = false;
         }
         else if (ch == ',')
         {
@@ -687,9 +714,9 @@ bool ReadBib(wxChar *filename)
           istr.get(ch);
           if (ch != '=')
           {
-            wxSprintf(buf, _T("Expected = after field type: malformed .bib file at line %ld (%s)"), BibLine, filename);
+            wxSnprintf(buf, sizeof(buf), _T("Expected = after field type: malformed .bib file at line %ld (%s)"), BibLine, filename);
             OnError(buf);
-            return FALSE;
+            return false;
           }
           BibEatWhiteSpace(istr);
           istr.get(ch);
@@ -706,64 +733,64 @@ bool ReadBib(wxChar *filename)
             }
           }
           else
-            BibReadValue(istr, fieldValue, TRUE, (ch == _T('"') ? TRUE : FALSE));
+            BibReadValue(istr, fieldValue, true, (ch == _T('"') ? true : false));
 
           // Now we can add a field
-          if (StringMatch(recordField, _T("author"), FALSE, TRUE))
+          if (StringMatch(recordField, _T("author"), false, true))
             bibEntry->author = copystring(fieldValue);
-          else if (StringMatch(recordField, _T("key"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("key"), false, true))
             {}
-          else if (StringMatch(recordField, _T("annotate"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("annotate"), false, true))
             {}
-          else if (StringMatch(recordField, _T("abstract"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("abstract"), false, true))
             {}
-          else if (StringMatch(recordField, _T("edition"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("edition"), false, true))
             {}
-          else if (StringMatch(recordField, _T("howpublished"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("howpublished"), false, true))
             {}
-          else if (StringMatch(recordField, _T("note"), FALSE, TRUE) || StringMatch(recordField, _T("notes"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("note"), false, true) || StringMatch(recordField, _T("notes"), false, true))
             {}
-          else if (StringMatch(recordField, _T("series"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("series"), false, true))
             {}
-          else if (StringMatch(recordField, _T("type"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("type"), false, true))
             {}
-          else if (StringMatch(recordField, _T("keywords"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("keywords"), false, true))
             {}
-          else if (StringMatch(recordField, _T("editor"), FALSE, TRUE) || StringMatch(recordField, _T("editors"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("editor"), false, true) || StringMatch(recordField, _T("editors"), false, true))
             bibEntry->editor= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("title"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("title"), false, true))
             bibEntry->title= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("booktitle"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("booktitle"), false, true))
             bibEntry->booktitle= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("journal"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("journal"), false, true))
             bibEntry->journal= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("volume"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("volume"), false, true))
             bibEntry->volume= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("number"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("number"), false, true))
             bibEntry->number= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("year"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("year"), false, true))
             bibEntry->year= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("month"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("month"), false, true))
             bibEntry->month= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("pages"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("pages"), false, true))
             bibEntry->pages= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("publisher"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("publisher"), false, true))
             bibEntry->publisher= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("address"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("address"), false, true))
             bibEntry->address= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("institution"), FALSE, TRUE) || StringMatch(recordField, _T("school"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("institution"), false, true) || StringMatch(recordField, _T("school"), false, true))
             bibEntry->institution= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("organization"), FALSE, TRUE) || StringMatch(recordField, _T("organisation"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("organization"), false, true) || StringMatch(recordField, _T("organisation"), false, true))
             bibEntry->organization= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("comment"), FALSE, TRUE) || StringMatch(recordField, _T("comments"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("comment"), false, true) || StringMatch(recordField, _T("comments"), false, true))
             bibEntry->comment= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("annote"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("annote"), false, true))
             bibEntry->comment= copystring(fieldValue);
-          else if (StringMatch(recordField, _T("chapter"), FALSE, TRUE))
+          else if (StringMatch(recordField, _T("chapter"), false, true))
             bibEntry->chapter= copystring(fieldValue);
           else
           {
-            wxSprintf(buf, _T("Unrecognised bib field type %s at line %ld (%s)"), recordField, BibLine, filename);
+            wxSnprintf(buf, sizeof(buf), _T("Unrecognised bib field type %s at line %ld (%s)"), recordField, BibLine, filename);
             OnError(buf);
           }
         }
@@ -772,26 +799,26 @@ bool ReadBib(wxChar *filename)
       BibEatWhiteSpace(istr);
     }
   }
-  return TRUE;
+  return true;
 }
 
 void OutputBibItem(TexRef *ref, BibEntry *bib)
 {
   Tex2RTFYield();
 
-  OnMacro(ltNUMBEREDBIBITEM, 2, TRUE);
-  OnArgument(ltNUMBEREDBIBITEM, 1, TRUE);
+  OnMacro(ltNUMBEREDBIBITEM, 2, true);
+  OnArgument(ltNUMBEREDBIBITEM, 1, true);
   TexOutput(ref->sectionNumber);
-  OnArgument(ltNUMBEREDBIBITEM, 1, FALSE);
-  OnArgument(ltNUMBEREDBIBITEM, 2, TRUE);
+  OnArgument(ltNUMBEREDBIBITEM, 1, false);
+  OnArgument(ltNUMBEREDBIBITEM, 2, true);
 
   TexOutput(_T(" "));
-  OnMacro(ltBF, 1, TRUE);
-  OnArgument(ltBF, 1, TRUE);
+  OnMacro(ltBF, 1, true);
+  OnArgument(ltBF, 1, true);
   if (bib->author)
     TexOutput(bib->author);
-  OnArgument(ltBF, 1, FALSE);
-  OnMacro(ltBF, 1, FALSE);
+  OnArgument(ltBF, 1, false);
+  OnMacro(ltBF, 1, false);
   if (bib->author && (wxStrlen(bib->author) > 0) && (bib->author[wxStrlen(bib->author) - 1] != '.'))
     TexOutput(_T(". "));
   else
@@ -810,7 +837,7 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
   if (bib->year || bib->month)
     TexOutput(_T(". "));
 
-  if (StringMatch(bib->type, _T("article"), FALSE, TRUE))
+  if (StringMatch(bib->type, _T("article"), false, true))
   {
     if (bib->title)
     {
@@ -819,20 +846,20 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
     }
     if (bib->journal)
     {
-      OnMacro(ltIT, 1, TRUE);
-      OnArgument(ltIT, 1, TRUE);
+      OnMacro(ltIT, 1, true);
+      OnArgument(ltIT, 1, true);
       TexOutput(bib->journal);
-      OnArgument(ltIT, 1, FALSE);
-      OnMacro(ltIT, 1, FALSE);
+      OnArgument(ltIT, 1, false);
+      OnMacro(ltIT, 1, false);
     }
     if (bib->volume)
     {
       TexOutput(_T(", "));
-      OnMacro(ltBF, 1, TRUE);
-      OnArgument(ltBF, 1, TRUE);
+      OnMacro(ltBF, 1, true);
+      OnArgument(ltBF, 1, true);
       TexOutput(bib->volume);
-      OnArgument(ltBF, 1, FALSE);
-      OnMacro(ltBF, 1, FALSE);
+      OnArgument(ltBF, 1, false);
+      OnMacro(ltBF, 1, false);
     }
     if (bib->number)
     {
@@ -847,27 +874,27 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
     }
     TexOutput(_T("."));
   }
-  else if (StringMatch(bib->type, _T("book"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("unpublished"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("manual"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("phdthesis"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("mastersthesis"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("misc"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("techreport"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("booklet"), FALSE, TRUE))
+  else if (StringMatch(bib->type, _T("book"), false, true) ||
+           StringMatch(bib->type, _T("unpublished"), false, true) ||
+           StringMatch(bib->type, _T("manual"), false, true) ||
+           StringMatch(bib->type, _T("phdthesis"), false, true) ||
+           StringMatch(bib->type, _T("mastersthesis"), false, true) ||
+           StringMatch(bib->type, _T("misc"), false, true) ||
+           StringMatch(bib->type, _T("techreport"), false, true) ||
+           StringMatch(bib->type, _T("booklet"), false, true))
   {
     if (bib->title || bib->booktitle)
     {
-      OnMacro(ltIT, 1, TRUE);
-      OnArgument(ltIT, 1, TRUE);
+      OnMacro(ltIT, 1, true);
+      OnArgument(ltIT, 1, true);
       TexOutput(bib->title ? bib->title : bib->booktitle);
       TexOutput(_T(". "));
-      OnArgument(ltIT, 1, FALSE);
-      OnMacro(ltIT, 1, FALSE);
+      OnArgument(ltIT, 1, false);
+      OnMacro(ltIT, 1, false);
     }
-    if (StringMatch(bib->type, _T("phdthesis"), FALSE, TRUE))
+    if (StringMatch(bib->type, _T("phdthesis"), false, true))
       TexOutput(_T("PhD thesis. "));
-    if (StringMatch(bib->type, _T("techreport"), FALSE, TRUE))
+    if (StringMatch(bib->type, _T("techreport"), false, true))
       TexOutput(_T("Technical report. "));
     if (bib->editor)
     {
@@ -896,10 +923,10 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
       TexOutput(_T(". "));
     }
   }
-  else if (StringMatch(bib->type, _T("inbook"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("inproceedings"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("incollection"), FALSE, TRUE) ||
-           StringMatch(bib->type, _T("conference"), FALSE, TRUE))
+  else if (StringMatch(bib->type, _T("inbook"), false, true) ||
+           StringMatch(bib->type, _T("inproceedings"), false, true) ||
+           StringMatch(bib->type, _T("incollection"), false, true) ||
+           StringMatch(bib->type, _T("conference"), false, true))
   {
     if (bib->title)
     {
@@ -908,12 +935,12 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
     if (bib->booktitle)
     {
       TexOutput(_T(", from "));
-      OnMacro(ltIT, 1, TRUE);
-      OnArgument(ltIT, 1, TRUE);
+      OnMacro(ltIT, 1, true);
+      OnArgument(ltIT, 1, true);
       TexOutput(bib->booktitle);
       TexOutput(_T("."));
-      OnArgument(ltIT, 1, FALSE);
-      OnMacro(ltIT, 1, FALSE);
+      OnArgument(ltIT, 1, false);
+      OnMacro(ltIT, 1, false);
     }
     if (bib->editor)
     {
@@ -937,11 +964,11 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
     if (bib->volume)
     {
       TexOutput(_T(" "));
-      OnMacro(ltBF, 1, TRUE);
-      OnArgument(ltBF, 1, TRUE);
+      OnMacro(ltBF, 1, true);
+      OnArgument(ltBF, 1, true);
       TexOutput(bib->volume);
-      OnArgument(ltBF, 1, FALSE);
-      OnMacro(ltBF, 1, FALSE);
+      OnArgument(ltBF, 1, false);
+      OnMacro(ltBF, 1, false);
     }
     if (bib->number)
     {
@@ -971,8 +998,8 @@ void OutputBibItem(TexRef *ref, BibEntry *bib)
       TexOutput(_T("."));
     }
   }
-  OnArgument(ltNUMBEREDBIBITEM, 2, FALSE);
-  OnMacro(ltNUMBEREDBIBITEM, 2, FALSE);
+  OnArgument(ltNUMBEREDBIBITEM, 2, false);
+  OnMacro(ltNUMBEREDBIBITEM, 2, false);
 }
 
 void OutputBib(void)
@@ -982,13 +1009,13 @@ void OutputBib(void)
   FakeCurrentSection(ReferencesNameString);
   ForceTopicName(NULL);
 
-  OnMacro(ltPAR, 0, TRUE);
-  OnMacro(ltPAR, 0, FALSE);
+  OnMacro(ltPAR, 0, true);
+  OnMacro(ltPAR, 0, false);
 
   if ((convertMode == TEX_RTF) && !winHelp)
   {
-    OnMacro(ltPAR, 0, TRUE);
-    OnMacro(ltPAR, 0, FALSE);
+    OnMacro(ltPAR, 0, true);
+    OnMacro(ltPAR, 0, false);
   }
 
   wxStringListNode *node = CitationList.GetFirst();
@@ -1029,13 +1056,13 @@ void ResolveBibReferences(void)
       // Unused Variable
       //BibEntry *entry = (BibEntry *)bibNode->GetData();
       if (ref->sectionNumber) delete[] ref->sectionNumber;
-      wxSprintf(buf, _T("[%d]"), citeCount);
+      wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
       ref->sectionNumber = copystring(buf);
       citeCount ++;
     }
     else
     {
-      wxSprintf(buf, _T("Warning: bib ref %s not resolved."), citeKey);
+      wxSnprintf(buf, sizeof(buf), _T("Warning: bib ref %s not resolved."), citeKey);
       OnInform(buf);
     }
     node = node->GetNext();
@@ -1068,12 +1095,12 @@ bool StringTobool(wxChar *val)
 {
   if (wxStrncmp(val, _T("yes"), 3) == 0 || wxStrncmp(val, _T("YES"), 3) == 0 ||
       wxStrncmp(val, _T("on"), 2) == 0 || wxStrncmp(val, _T("ON"), 2) == 0 ||
-      wxStrncmp(val, _T("true"), 4) == 0 || wxStrncmp(val, _T("TRUE"), 4) == 0 ||
+      wxStrncmp(val, _T("true"), 4) == 0 || wxStrncmp(val, _T("true"), 4) == 0 ||
       wxStrncmp(val, _T("ok"), 2) == 0 || wxStrncmp(val, _T("OK"), 2) == 0 ||
       wxStrncmp(val, _T("1"), 1) == 0)
-    return TRUE;
+    return true;
   else
-    return FALSE;
+    return false;
 }
 
 // Define a variable value from the .ini file
@@ -1081,151 +1108,151 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
 {
   static wxChar errorCode[100];
   wxStrcpy(errorCode, _T("OK"));
-  if (StringMatch(settingName, _T("chapterName"), FALSE, TRUE))
+  if (StringMatch(settingName, _T("chapterName"), false, true))
   {
     delete[] ChapterNameString;
     ChapterNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("sectionName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("sectionName"), false, true))
   {
     delete[] SectionNameString;
     SectionNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("subsectionName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("subsectionName"), false, true))
   {
     delete[] SubsectionNameString;
     SubsectionNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("subsubsectionName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("subsubsectionName"), false, true))
   {
     delete[] SubsubsectionNameString;
     SubsubsectionNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("indexName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("indexName"), false, true))
   {
     delete[] IndexNameString;
     IndexNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("contentsName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("contentsName"), false, true))
   {
     delete[] ContentsNameString;
     ContentsNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("glossaryName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("glossaryName"), false, true))
   {
     delete[] GlossaryNameString;
     GlossaryNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("referencesName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("referencesName"), false, true))
   {
     delete[] ReferencesNameString;
     ReferencesNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("tablesName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("tablesName"), false, true))
   {
     delete[] TablesNameString;
     TablesNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("figuresName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("figuresName"), false, true))
   {
     delete[] FiguresNameString;
     FiguresNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("tableName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("tableName"), false, true))
   {
     delete[] TableNameString;
     TableNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("figureName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("figureName"), false, true))
   {
     delete[] FigureNameString;
     FigureNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("abstractName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("abstractName"), false, true))
   {
     delete[] AbstractNameString;
     AbstractNameString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("chapterFontSize"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("chapterFontSize"), false, true))
     StringToInt(settingValue, &chapterFont);
-  else if (StringMatch(settingName, _T("sectionFontSize"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("sectionFontSize"), false, true))
     StringToInt(settingValue, &sectionFont);
-  else if (StringMatch(settingName, _T("subsectionFontSize"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("subsectionFontSize"), false, true))
     StringToInt(settingValue, &subsectionFont);
-  else if (StringMatch(settingName, _T("titleFontSize"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("titleFontSize"), false, true))
     StringToInt(settingValue, &titleFont);
-  else if (StringMatch(settingName, _T("authorFontSize"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("authorFontSize"), false, true))
     StringToInt(settingValue, &authorFont);
-  else if (StringMatch(settingName, _T("ignoreInput"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("ignoreInput"), false, true))
     IgnorableInputFiles.Add(wxFileNameFromPath(settingValue));
-  else if (StringMatch(settingName, _T("mirrorMargins"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("mirrorMargins"), false, true))
     mirrorMargins = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("runTwice"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("runTwice"), false, true))
     runTwice = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("isInteractive"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("isInteractive"), false, true))
     isInteractive = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("headerRule"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("headerRule"), false, true))
     headerRule = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("footerRule"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("footerRule"), false, true))
     footerRule = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("combineSubSections"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("combineSubSections"), false, true))
     combineSubSections = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("listLabelIndent"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("listLabelIndent"), false, true))
     StringToInt(settingValue, &labelIndentTab);
-  else if (StringMatch(settingName, _T("listItemIndent"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("listItemIndent"), false, true))
     StringToInt(settingValue, &itemIndentTab);
-  else if (StringMatch(settingName, _T("useUpButton"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("useUpButton"), false, true))
     useUpButton = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("useHeadingStyles"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("useHeadingStyles"), false, true))
     useHeadingStyles = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("useWord"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("useWord"), false, true))
     useWord = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("contentsDepth"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("contentsDepth"), false, true))
     StringToInt(settingValue, &contentsDepth);
-  else if (StringMatch(settingName, _T("generateHPJ"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("generateHPJ"), false, true))
     generateHPJ = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("truncateFilenames"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("truncateFilenames"), false, true))
     truncateFilenames = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("winHelpVersion"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("winHelpVersion"), false, true))
     StringToInt(settingValue, &winHelpVersion);
-  else if (StringMatch(settingName, _T("winHelpContents"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("winHelpContents"), false, true))
     winHelpContents = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("htmlIndex"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("htmlIndex"), false, true))
     htmlIndex = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("htmlWorkshopFiles"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("htmlWorkshopFiles"), false, true))
     htmlWorkshopFiles = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("htmlFrameContents"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("htmlFrameContents"), false, true))
     htmlFrameContents = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("htmlStylesheet"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("htmlStylesheet"), false, true))
     {
       if (htmlStylesheet) delete[] htmlStylesheet;
       htmlStylesheet = copystring(settingValue);
     }
-  else if (StringMatch(settingName, _T("upperCaseNames"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("upperCaseNames"), false, true))
     upperCaseNames = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("ignoreBadRefs"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("ignoreBadRefs"), false, true))
     ignoreBadRefs = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("htmlFaceName"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("htmlFaceName"), false, true))
   {
     delete[] htmlFaceName;
     htmlFaceName = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("winHelpTitle"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("winHelpTitle"), false, true))
   {
     if (winHelpTitle)
       delete[] winHelpTitle;
     winHelpTitle = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("indexSubsections"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("indexSubsections"), false, true))
     indexSubsections = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("compatibility"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("compatibility"), false, true))
     compatibilityMode = StringTobool(settingValue);
-  else if (StringMatch(settingName, _T("defaultColumnWidth"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("defaultColumnWidth"), false, true))
   {
     StringToInt(settingValue, &defaultTableColumnWidth);
     defaultTableColumnWidth = 20*defaultTableColumnWidth;
   }
-  else if (StringMatch(settingName, _T("bitmapMethod"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("bitmapMethod"), false, true))
   {
     if ((wxStrcmp(settingValue, _T("includepicture")) != 0) && (wxStrcmp(settingValue, _T("hex")) != 0) &&
         (wxStrcmp(settingValue, _T("import")) != 0))
@@ -1240,7 +1267,7 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
       bitmapMethod = copystring(settingValue);
     }
   }
-  else if (StringMatch(settingName, _T("htmlBrowseButtons"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("htmlBrowseButtons"), false, true))
   {
     if (wxStrcmp(settingValue, _T("none")) == 0)
       htmlBrowseButtons = HTML_BUTTONS_NONE;
@@ -1255,43 +1282,43 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
       wxStrcpy(errorCode, _T("Initialisation file error: htmlBrowseButtons must be one of none, bitmap, or text."));
     }
   }
-  else if (StringMatch(settingName, _T("backgroundImage"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("backgroundImage"), false, true))
   {
     backgroundImageString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("backgroundColour"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("backgroundColour"), false, true))
   {
     delete[] backgroundColourString;
     backgroundColourString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("textColour"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("textColour"), false, true))
   {
     textColourString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("linkColour"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("linkColour"), false, true))
   {
     linkColourString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("followedLinkColour"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("followedLinkColour"), false, true))
   {
     followedLinkColourString = copystring(settingValue);
   }
-  else if (StringMatch(settingName, _T("conversionMode"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("conversionMode"), false, true))
   {
-    if (StringMatch(settingValue, _T("RTF"), FALSE, TRUE))
+    if (StringMatch(settingValue, _T("RTF"), false, true))
     {
-      winHelp = FALSE; convertMode = TEX_RTF;
+      winHelp = false; convertMode = TEX_RTF;
     }
-    else if (StringMatch(settingValue, _T("WinHelp"), FALSE, TRUE))
+    else if (StringMatch(settingValue, _T("WinHelp"), false, true))
     {
-      winHelp = TRUE; convertMode = TEX_RTF;
+      winHelp = true; convertMode = TEX_RTF;
     }
-    else if (StringMatch(settingValue, _T("XLP"), FALSE, TRUE) ||
-             StringMatch(settingValue, _T("wxHelp"), FALSE, TRUE))
+    else if (StringMatch(settingValue, _T("XLP"), false, true) ||
+             StringMatch(settingValue, _T("wxHelp"), false, true))
     {
       convertMode = TEX_XLP;
     }
-    else if (StringMatch(settingValue, _T("HTML"), FALSE, TRUE))
+    else if (StringMatch(settingValue, _T("HTML"), false, true))
     {
       convertMode = TEX_HTML;
     }
@@ -1302,7 +1329,7 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
       wxStrcpy(errorCode, _T("Initialisation file error: conversionMode must be one of\nRTF, WinHelp, XLP (or wxHelp), HTML."));
     }
   }
-  else if (StringMatch(settingName, _T("documentFontSize"), FALSE, TRUE))
+  else if (StringMatch(settingName, _T("documentFontSize"), false, true))
   {
     int n;
     StringToInt(settingValue, &n);
@@ -1311,7 +1338,7 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
     else
     {
       wxChar buf[200];
-      wxSprintf(buf, _T("Initialisation file error: nonstandard document font size %d."), n);
+      wxSnprintf(buf, sizeof(buf), _T("Initialisation file error: nonstandard document font size %d."), n);
       if (interactive)
         OnInform(buf);
       wxStrcpy(errorCode, buf);
@@ -1320,7 +1347,7 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
   else
   {
     wxChar buf[200];
-    wxSprintf(buf, _T("Initialisation file error: unrecognised setting %s."), settingName);
+    wxSnprintf(buf, sizeof(buf), _T("Initialisation file error: unrecognised setting %s."), settingName);
     if (interactive)
       OnInform(buf);
     wxStrcpy(errorCode, buf);
@@ -1331,11 +1358,12 @@ wxChar *RegisterSetting(wxChar *settingName, wxChar *settingValue, bool interact
 bool ReadCustomMacros(wxChar *filename)
 {
   if (!wxFileExists(filename))
-      return FALSE;
+      return false;
 
-  wxSTD ifstream istr(filename, wxSTD ios::in);
+  wxString name = filename;
+  wxSTD ifstream istr((char const *)name.fn_str(), wxSTD ios::in);
 
-  if (istr.bad()) return FALSE;
+  if (istr.bad()) return false;
 
   CustomMacroList.Clear();
   char ch;
@@ -1360,7 +1388,7 @@ bool ReadCustomMacros(wxChar *filename)
       if (ch != '=')
       {
         OnError(_T("Expected = following name: malformed tex2rtf.ini file."));
-        return FALSE;
+        return false;
       }
       else
       {
@@ -1378,24 +1406,24 @@ bool ReadCustomMacros(wxChar *filename)
       if (ch != '[')
       {
         OnError(_T("Expected [ followed by number of arguments: malformed tex2rtf.ini file."));
-        return FALSE;
+        return false;
       }
       istr >> noArgs;
       istr.get(ch);
       if (ch != ']')
       {
         OnError(_T("Expected ] following number of arguments: malformed tex2rtf.ini file."));
-        return FALSE;
+        return false;
       }
       BibEatWhiteSpace(istr);
       istr.get(ch);
       if (ch != '{')
       {
         OnError(_T("Expected { followed by macro body: malformed tex2rtf.ini file."));
-        return FALSE;
+        return false;
       }
       CustomMacro *macro = new CustomMacro(macroName, noArgs, NULL);
-      BibReadValue(istr, macroBody, FALSE, FALSE); // Don't ignore extra braces
+      BibReadValue(istr, macroBody, false, false); // Don't ignore extra braces
       if (wxStrlen(macroBody) > 0)
         macro->macroBody = copystring(macroBody);
     
@@ -1405,9 +1433,9 @@ bool ReadCustomMacros(wxChar *filename)
     }
   }
   wxChar mbuf[200];
-  wxSprintf(mbuf, _T("Read initialization file %s."), filename);
+  wxSnprintf(mbuf, sizeof(mbuf), _T("Read initialization file %s."), filename);
   OnInform(mbuf);
-  return TRUE;
+  return true;
 }
  
 CustomMacro *FindCustomMacro(wxChar *name)
@@ -1435,7 +1463,7 @@ void ShowCustomMacros(void)
   while (node)
   {
     CustomMacro *macro = (CustomMacro *)node->GetData();
-    wxSprintf(buf, _T("\\%s[%d]\n    {%s}"), macro->macroName, macro->noArgs,
+    wxSnprintf(buf, sizeof(buf), _T("\\%s[%d]\n    {%s}"), macro->macroName, macro->noArgs,
      macro->macroBody ? macro->macroBody : _T(""));
     OnInform(buf);
     node = node->GetNext();
@@ -1450,7 +1478,7 @@ wxChar *ParseMultifieldString(wxChar *allFields, int *pos)
   int fieldIndex = *pos;
   int len = wxStrlen(allFields);
   int oldPos = *pos;
-  bool keepGoing = TRUE;
+  bool keepGoing = true;
   while ((fieldIndex <= len) && keepGoing)
   {
     if (allFields[fieldIndex] == _T(' '))
@@ -1461,12 +1489,12 @@ wxChar *ParseMultifieldString(wxChar *allFields, int *pos)
     else if (allFields[fieldIndex] == _T(','))
     {
       *pos = fieldIndex + 1;
-      keepGoing = FALSE;
+      keepGoing = false;
     }
     else if (allFields[fieldIndex] == 0)
     {
       *pos = fieldIndex + 1;
-      keepGoing = FALSE;
+      keepGoing = false;
     }
     else
     {
@@ -1556,11 +1584,11 @@ bool FindColourHTMLString(wxChar *theName, wxChar *buf)
         DecToHex(entry->blue, buf2);
         wxStrcat(buf, buf2);
 
-        return TRUE;
+        return true;
     }
     node = node->GetNext();
   }
-  return FALSE;
+  return false;
 }
 
   
@@ -1656,7 +1684,7 @@ TexTopic::TexTopic(wxChar *f)
     filename = copystring(f);
   else
     filename = NULL;
-  hasChildren = FALSE;
+  hasChildren = false;
   keywords = NULL;
 }
 
index 527bac8b5ee9719281196ab9a3973ae0ec767c15..375e0a86c60950c0b4d92c2b9690be2f7b24c854 100644 (file)
@@ -2,7 +2,8 @@
 // Name:        xlputils.cpp
 // Purpose:     Converts Latex to obsolete XLP format
 // Author:      Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+//              Ron Lee
 // Created:     7.9.93
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
@@ -37,9 +38,9 @@ static TexChunk *descriptionItemArg = NULL;
 static int indentLevel = 0;
 static int noColumns = 0;
 static int currentTab = 0;
-static bool tableVerticalLineLeft = FALSE;
-static bool tableVerticalLineRight = FALSE;
-static bool inTable = FALSE;
+static bool tableVerticalLineLeft = false;
+static bool tableVerticalLineRight = false;
+static bool inTable = false;
 static int citeCount = 1;
 wxList hyperLinks(wxKEY_INTEGER);
 wxList hyperLabels(wxKEY_STRING);
@@ -53,7 +54,7 @@ void PadToTab(int tabPos)
 {
   int currentCol = GetCurrentColumn();
   for (int i = currentCol; i < tabPos; i++)
-    TexOutput(_T(" "), TRUE);
+    TexOutput(_T(" "), true);
 }
 
 static long xlpBlockId = 0;
@@ -85,7 +86,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
       long id1 = NewBlockId();
       currentBlockId = NewBlockId();
 
-      startedSections = TRUE;
+      startedSections = true;
       wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, id1);
       wxFprintf(Chapters, _T("\n\\hy-%d{%ld}{"), hyBLOCK_LARGE_VISIBLE_SECTION, currentBlockId);
       wxFprintf(Index, _T("%ld %ld\n"), id1, currentBlockId);
@@ -117,7 +118,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
       long id1 = NewBlockId();
       currentBlockId = NewBlockId();
 
-      startedSections = TRUE;
+      startedSections = true;
 
       if (DocumentStyle == LATEX_ARTICLE)
         wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, id1);
@@ -209,19 +210,19 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   }
   case ltVOID:
 //    if (start)
-//      TexOutput(_T("void"), TRUE);
+//      TexOutput(_T("void"), true);
     break;
   case ltBACKSLASHCHAR:
     if (start)
-      TexOutput(_T("\n"), TRUE);
+      TexOutput(_T("\n"), true);
     break;
   case ltPAR:
   {
     if (start)
     {
       if (ParSkip > 0)
-        TexOutput(_T("\n"), TRUE);
-      TexOutput(_T("\n"), TRUE);
+        TexOutput(_T("\n"), true);
+      TexOutput(_T("\n"), true);
     }
     break;
   }
@@ -239,7 +240,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
     {
       wxChar buf[100];
       long id = NewBlockId();
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -253,7 +254,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
     {
       wxChar buf[100];
       long id = NewBlockId();
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -266,7 +267,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
     if (start)
     {
       long id = NewBlockId();
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -276,7 +277,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -286,7 +287,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -296,7 +297,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -306,7 +307,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -316,7 +317,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
       TexOutput(buf);
     }
     else TexOutput(_T("}\n"));
@@ -372,14 +373,14 @@ void XLPOnMacro(int macroId, int no_args, bool start)
         {
           case LATEX_ENUMERATE:
           {
-            wxSprintf(indentBuf, _T("\\hy-%d{%ld}{%d.} "),
+            wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{%d.} "),
               hyBLOCK_BOLD, NewBlockId(), struc->currentItem);
             TexOutput(indentBuf);
             break;
           }
           case LATEX_ITEMIZE:
           {
-            wxSprintf(indentBuf, _T("\\hy-%d{%ld}{o} "),
+            wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{o} "),
               hyBLOCK_BOLD, NewBlockId());
             TexOutput(indentBuf);
             break;
@@ -389,7 +390,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
           {
             if (descriptionItemArg)
             {
-              wxSprintf(indentBuf, _T("\\hy-%d{%ld}{"),
+              wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{"),
                  hyBLOCK_BOLD, NewBlockId());
               TexOutput(indentBuf);
               TraverseChildrenFromChunk(descriptionItemArg);
@@ -407,11 +408,11 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start && DocumentTitle && DocumentAuthor)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
       TexOutput(buf);
       TraverseChildrenFromChunk(DocumentTitle);
       TexOutput(_T("}\n\n"));
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
       TexOutput(buf);
       TraverseChildrenFromChunk(DocumentAuthor);
       TexOutput(_T("}\n\n"));
@@ -449,13 +450,13 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   case ltHARDY:
   {
     if (start)
-      TexOutput(_T("HARDY"), TRUE);
+      TexOutput(_T("HARDY"), true);
     break;
   }
   case ltWXCLIPS:
   {
     if (start)
-      TexOutput(_T("wxCLIPS"), TRUE);
+      TexOutput(_T("wxCLIPS"), true);
     break;
   }
   case ltVERBATIM:
@@ -464,7 +465,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
     {
       wxChar buf[100];
       long id = NewBlockId();
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
       TexOutput(buf);
     }
     else TexOutput(_T("}"));
@@ -474,7 +475,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      TexOutput(_T("\n------------------------------------------------------------------"), TRUE);
+      TexOutput(_T("\n------------------------------------------------------------------"), true);
     }
     break;
   }
@@ -482,7 +483,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      TexOutput(_T("--------------------------------------------------------------------------------"), TRUE);
+      TexOutput(_T("--------------------------------------------------------------------------------"), true);
     }
     break;
   }
@@ -501,7 +502,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
       TexOutput(buf);
     }
     else
@@ -511,7 +512,7 @@ void XLPOnMacro(int macroId, int no_args, bool start)
   case ltNUMBEREDBIBITEM:
   {
     if (!start)
-      TexOutput(_T("\n\n"), TRUE);
+      TexOutput(_T("\n\n"), true);
     break;
   }
   case ltCAPTION:
@@ -523,9 +524,9 @@ void XLPOnMacro(int macroId, int no_args, bool start)
 
       wxChar figBuf[40];
       if (DocumentStyle != LATEX_ARTICLE)
-        wxSprintf(figBuf, _T("Figure %d.%d: "), chapterNo, figureNo);
+        wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d.%d: "), chapterNo, figureNo);
       else
-        wxSprintf(figBuf, _T("Figure %d: "), figureNo);
+        wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d: "), figureNo);
 
       TexOutput(figBuf);
     }
@@ -568,43 +569,43 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
   {
     if (!start && (arg_no == 1))
       currentSection = GetArgChunk();
-    return FALSE;
+    return false;
   }
   case ltFUNC:
   {
     if (!start && (arg_no == 1))
-      TexOutput(_T(" "), TRUE);
+      TexOutput(_T(" "), true);
     if (start && (arg_no == 3))
-      TexOutput(_T("("), TRUE);
+      TexOutput(_T("("), true);
     if (!start && (arg_no == 3))
-     TexOutput(_T(")"), TRUE);
+     TexOutput(_T(")"), true);
     break;
   }
   case ltPFUNC:
   {
     if (!start && (arg_no == 1))
-      TexOutput(_T(" "), TRUE);
+      TexOutput(_T(" "), true);
 
     if (start && (arg_no == 2))
-      TexOutput(_T("(*"), TRUE);
+      TexOutput(_T("(*"), true);
     if (!start && (arg_no == 2))
-      TexOutput(_T(")"), TRUE);
+      TexOutput(_T(")"), true);
 
     if (start && (arg_no == 3))
-      TexOutput(_T("("), TRUE);
+      TexOutput(_T("("), true);
     if (!start && (arg_no == 3))
-      TexOutput(_T(")"), TRUE);
+      TexOutput(_T(")"), true);
     break;
   }
   case ltCLIPSFUNC:
   {
     if (!start && (arg_no == 1))
-      TexOutput(_T(" "), TRUE);
+      TexOutput(_T(" "), true);
     if (start && (arg_no == 2))
     {
-      TexOutput(_T("("), TRUE);
+      TexOutput(_T("("), true);
       long id = NewBlockId();
-      wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
       TexOutput(buf);
     }
     if (!start && (arg_no == 2))
@@ -612,7 +613,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
       TexOutput(_T("}"));
     }
     if (!start && (arg_no == 3))
-     TexOutput(_T(")"), TRUE);
+     TexOutput(_T(")"), true);
     break;
   }
   case ltPARAM:
@@ -620,7 +621,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
     if (start && (arg_no == 2))
     {
       long id = NewBlockId();
-      wxSprintf(buf, _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+      wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
       TexOutput(buf);
     }
     if (!start && (arg_no == 2))
@@ -634,7 +635,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
     if (start && (arg_no == 2))
     {
       long id = NewBlockId();
-      wxSprintf(buf, _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+      wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
       TexOutput(buf);
     }
     if (!start && (arg_no == 2))
@@ -646,12 +647,12 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
   case ltMEMBER:
   {
     if (!start && (arg_no == 1))
-      TexOutput(_T(" "), TRUE);
+      TexOutput(_T(" "), true);
     break;
   }
   case ltLABEL:
   {
-    return FALSE;
+    return false;
   }
   case ltREF:
   {
@@ -672,7 +673,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
       {
         TexOutput(sec);
       }
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -685,7 +686,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
       if (start)
       {
         currentBlockId = NewBlockId();
-        wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
+        wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
         TexOutput(buf);
       }
       else TexOutput(_T("}"));
@@ -698,7 +699,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         hyperLinks.Append(currentBlockId, (wxObject *)copystring(label));
       }
       
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -706,7 +707,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
   {
     if (arg_no == 1)
     {
-      return TRUE;
+      return true;
     }
     else if (arg_no == 2)
     {
@@ -714,7 +715,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         TexOutput(_T(" ("));
       else
         TexOutput(_T(")"));
-      return TRUE;
+      return true;
     }
     break;
   }
@@ -723,7 +724,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
     if (start && IsArgOptional())
     {
       descriptionItemArg = GetArgChunk();
-      return FALSE;
+      return false;
     }
     break;
   }
@@ -734,9 +735,9 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
     {
       if (start)
       {
-        inTable = TRUE;
-        tableVerticalLineLeft = FALSE;
-        tableVerticalLineRight = FALSE;
+        inTable = true;
+        tableVerticalLineLeft = false;
+        tableVerticalLineRight = false;
 
         wxChar *alignString = copystring(GetArgData());
 
@@ -746,9 +747,9 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         if (len > 0)
         {
           if (alignString[0] == '|')
-            tableVerticalLineLeft = TRUE;
+            tableVerticalLineLeft = true;
           if (alignString[len-1] == '|')
-            tableVerticalLineRight = TRUE;
+            tableVerticalLineRight = true;
         }
 
         for (int i = 0; i < len; i++)
@@ -768,15 +769,15 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
 //        int tabPos = 80/noColumns;
         currentTab = 0;
 
-        return FALSE;
+        return false;
       }
     }
     else if (arg_no == 2 && !start)
     {
-      inTable = FALSE;
+      inTable = false;
     }
     else if (arg_no == 2 && start)
-      return TRUE;
+      return true;
     break;
   }
   case ltMARGINPAR:
@@ -787,11 +788,11 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
   {
     if (start)
     {
-      TexOutput(_T("----------------------------------------------------------------------\n"), TRUE);
-      return TRUE;
+      TexOutput(_T("----------------------------------------------------------------------\n"), true);
+      return true;
     }
     else
-      TexOutput(_T("\n----------------------------------------------------------------------\n"), TRUE);
+      TexOutput(_T("\n----------------------------------------------------------------------\n"), true);
     break;
   }
   case ltBIBITEM:
@@ -804,16 +805,16 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
       if (ref)
       {
         if (ref->sectionNumber) delete[] ref->sectionNumber;
-        wxSprintf(buf, _T("[%d]"), citeCount);
+        wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
         ref->sectionNumber = copystring(buf);
       }
 
-      wxSprintf(buf, _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
+      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
       TexOutput(buf);
       citeCount ++;
-      return FALSE;
+      return false;
     }
-    return TRUE;
+    return true;
   }
   case ltTHEBIBLIOGRAPHY:
   {
@@ -831,12 +832,12 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
       wxFprintf(Index, _T("%ld %ld\n"), id1, id2);
 
       SetCurrentOutput(Chapters);
-      return FALSE;
+      return false;
     }
     if (!start && (arg_no == 2))
     {
     }
-    return TRUE;
+    return true;
   }
   case ltTWOCOLITEM:
   case ltTWOCOLITEMRULED:
@@ -846,7 +847,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
 
     if (!start && (arg_no == 2))
       TexOutput(_T("\n"));
-    return TRUE;
+    return true;
   }
   /*
    * Accents
@@ -896,7 +897,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_ACUTE:
   {
@@ -948,7 +949,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_CARET:
   {
@@ -994,7 +995,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_TILDE:
   {
@@ -1031,7 +1032,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_UMLAUT:
   {
@@ -1083,7 +1084,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_DOT:
   {
@@ -1105,7 +1106,7 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   case ltACCENT_CADILLA:
   {
@@ -1127,14 +1128,14 @@ bool XLPOnArgument(int macroId, int arg_no, bool start)
         }
       }
     }
-    return FALSE;
+    return false;
   }
   default:
   {
     return DefaultOnArgument(macroId, arg_no, start);
   }
   }
-  return TRUE;
+  return true;
 }
 
 bool XLPGo(void)
@@ -1208,8 +1209,8 @@ bool XLPGo(void)
     wxRemoveFile(_T("subsections.xlp"));
     wxRemoveFile(_T("subsubsections.xlp"));
     wxRemoveFile(_T("index.xlp"));
-    return TRUE;
+    return true;
   }
-  return FALSE;
+  return false;
 }
 
index 04b677a1937777802dd67c655b85bc88ad88095c..cbe025c4212a8cc67163599f0999babf28769d1a 100755 (executable)
@@ -169,14 +169,14 @@ Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--release]
                  [--cc] [--cxx] [--ld]
 
 wx-config returns configuration information about the installed
-version of wxWindows. It may be used to query its version and
+version of wxWidgets. It may be used to query its version and
 installation directories and also retrieve the C and C++ compilers
 and linker which were used for its building and the corresponding
 flags.
 
 Ordinarily it should be installed to the appropriate system location
 along with the headers and library files, but it is also possible to
-use it to enable builds with an uninstalled wxWindows version for
+use it to enable builds with an uninstalled wxWidgets version for
 package building and bleeding edge developers.  To do so, use it like
 this:
 
@@ -188,7 +188,7 @@ specification for it to take effect.
 --static must come before --libs and --gl-libs.
 
 --libs can take optional argument that contains comma-separated list of
-wxWindows libraries to link against. This list can include both core
+wxWidgets libraries to link against. This list can include both core
 and contrib libraries.
 
 --gl-libs option is deprecated, used --libs=gl instead.