]> git.saurik.com Git - wxWidgets.git/commitdiff
HelpGen is a prototype of the tool for automatic generation of the .tex files
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 8 Jan 1999 17:46:08 +0000 (17:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 8 Jan 1999 17:46:08 +0000 (17:46 +0000)
for wxWindows documentation from C++ headers

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

21 files changed:
utils/HelpGen/Makefile [new file with mode: 0644]
utils/HelpGen/include/cjparser.h [new file with mode: 0644]
utils/HelpGen/include/docripper.h [new file with mode: 0644]
utils/HelpGen/include/ifcontext.h [new file with mode: 0644]
utils/HelpGen/include/markup.h [new file with mode: 0644]
utils/HelpGen/include/scriptbinder.h [new file with mode: 0644]
utils/HelpGen/include/sourcepainter.h [new file with mode: 0644]
utils/HelpGen/include/srcparser.h [new file with mode: 0644]
utils/HelpGen/include/wxstlac.h [new file with mode: 0644]
utils/HelpGen/include/wxstllst.h [new file with mode: 0644]
utils/HelpGen/include/wxstlvec.h [new file with mode: 0644]
utils/HelpGen/src/HelpGen.cpp [new file with mode: 0644]
utils/HelpGen/src/cjparser.cpp [new file with mode: 0644]
utils/HelpGen/src/docripper.cpp [new file with mode: 0644]
utils/HelpGen/src/ifcontext.cpp [new file with mode: 0644]
utils/HelpGen/src/markup.cpp [new file with mode: 0644]
utils/HelpGen/src/ripper_main.cpp [new file with mode: 0644]
utils/HelpGen/src/scriptbinder.cpp [new file with mode: 0644]
utils/HelpGen/src/sourcepainter.cpp [new file with mode: 0644]
utils/HelpGen/src/srcparser.cpp [new file with mode: 0644]
utils/HelpGen/src/wx_extra_imps.cpp [new file with mode: 0644]

diff --git a/utils/HelpGen/Makefile b/utils/HelpGen/Makefile
new file mode 100644 (file)
index 0000000..44562e2
--- /dev/null
@@ -0,0 +1,737 @@
+##############################################################################
+# Name:        Makefile
+# Purpose:     Unix makefile for helpgen project
+# Author:      Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+# Modified by:
+# Created:     06/01/99
+# RCS-ID:      $Id$
+# Copyright:   (c) 1999 VZ
+# Licence:     GPL
+##############################################################################
+
+# vi: set tw=0 noet ts=8 sw=8:
+
+.SUFFIXES: .cpp
+
+##############################################################################
+# variables
+##############################################################################
+PROG = HelpGen
+SRCS = src/cjparser.cpp\
+       src/markup.cpp\
+       src/scriptbinder.cpp\
+       src/srcparser.cpp\
+       src/ifcontext.cpp\
+       src/HelpGen.cpp\
+       src/sourcepainter.cpp\
+       src/wx/string.cpp\
+       src/wx_extra_imps.cpp\
+       src/wx/object.cpp\
+       src/wx/hash.cpp\
+       src/wx/log.cpp\
+       src/wx/file.cpp\
+       src/wx/list.cpp
+
+OBJS = obj/cjparser.o\
+       obj/markup.o\
+       obj/scriptbinder.o\
+       obj/srcparser.o\
+       obj/ifcontext.o\
+       obj/HelpGen.o\
+       obj/sourcepainter.o\
+       obj/wx/string.o\
+       obj/wx_extra_imps.o\
+       obj/wx/object.o\
+       obj/wx/hash.o\
+       obj/wx/log.o\
+       obj/wx/file.o\
+       obj/wx/list.o
+
+# tested with egcs 1.1.1 (add more compilers here)
+CC = g++
+
+DEFINES = -DwxUSE_NOGUI=1 -D__UNIX__ -D__WXGTK__ -DHAVE_VSNPRINTF
+# this might not work with some versions of gcc - try just -g then
+DEBUG = -ggdb
+INCLUDE = -I./include
+CPPFLAGS  = $(INCLUDE) $(DEFINES) $(DEBUG) -c -Wall
+
+##############################################################################
+# rules
+##############################################################################
+
+# building the program
+obj/%.o: src/%.cpp
+       $(CC) $(CPPFLAGS) -o $@ $<
+       
+all: links $(PROG)
+
+$(PROG) : $(OBJS)
+       $(CC) -o $(PROG) $(DEBUG) -Wall $(OBJS)
+       
+# create the links
+links: include/wx src/wx
+       ln -sf ../../include/wx include/wx
+       ln -sf ../../src/common src/wx
+
+# this requires exuberant ctags version 2.x or later
+ctags: tags
+       ctags -i mCF --lang=c++ include/*.h src/*.cpp
+
+depend:
+       makedepend $(INCLUDE) $(DEFINES) -I/usr/include/g++ -I/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include $(SRCS)
+
+clean:
+       rm -f $(OBJS) $(PROG) core
+
+# DO NOT DELETE
+
+src/cjparser.o: ./include/wx/wxprec.h ./include/wx/wx.h
+src/cjparser.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/cjparser.o: ./include/wx/wx/defs.h
+src/cjparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/cjparser.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/cjparser.o: /usr/include/string.h /usr/include/features.h
+src/cjparser.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/cjparser.o: /usr/include/stdio.h /usr/include/libio.h
+src/cjparser.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/cjparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/cjparser.o: /usr/include/stdio_lim.h
+src/cjparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/cjparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/cjparser.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/cjparser.o: /usr/include/time.h /usr/include/endian.h
+src/cjparser.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/cjparser.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/cjparser.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/cjparser.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/cjparser.o: ./include/wx/wx/log.h ./include/wx/wx/window.h
+src/cjparser.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/object.h
+src/cjparser.o: ./include/wx/wx/memory.h ./include/wx/list.h
+src/cjparser.o: ./include/wx/event.h ./include/wx/wx/gdicmn.h
+src/cjparser.o: ./include/wx/wx/wx/hash.h ./include/wx/wx/wx/colour.h
+src/cjparser.o: ./include/wx/wx/wx/wx/gtk/colour.h ./include/wx/gdiobj.h
+src/cjparser.o: ./include/wx/wx/gtk/gdiobj.h ./include/wx/palette.h
+src/cjparser.o: ./include/wx/wx/gtk/palette.h ./include/wx/validate.h
+src/cjparser.o: ./include/wx/cursor.h ./include/wx/wx/gtk/cursor.h
+src/cjparser.o: ./include/wx/font.h ./include/wx/wx/gtk/font.h
+src/cjparser.o: ./include/wx/region.h ./include/wx/wx/gtk/region.h
+src/cjparser.o: ./include/wx/accel.h ./include/wx/wx/gtk/accel.h
+src/cjparser.o: ./include/wx/wx/panel.h ./include/wx/wx/wx/generic/panelg.h
+src/cjparser.o: ./include/wx/wx/frame.h ./include/wx/wx/wx/gtk/frame.h
+src/cjparser.o: ./include/wx/icon.h ./include/wx/wx/dc.h
+src/cjparser.o: ./include/wx/wx/wx/gtk/dc.h ./include/wx/pen.h
+src/cjparser.o: ./include/wx/wx/gtk/pen.h ./include/wx/brush.h
+src/cjparser.o: ./include/wx/wx/gtk/brush.h ./include/wx/bitmap.h
+src/cjparser.o: ./include/wx/wx/gtk/bitmap.h ./include/wx/wx/dcclient.h
+src/cjparser.o: ./include/wx/wx/wx/gtk/dcclient.h ./include/wx/wx/dcmemory.h
+src/cjparser.o: ./include/wx/wx/wx/gtk/dcmemory.h ./include/wx/wx/dcprint.h
+src/cjparser.o: ./include/wx/wx/dcscreen.h ./include/wx/wx/wx/gtk/dcscreen.h
+src/cjparser.o: ./include/wx/wx/button.h ./include/wx/wx/wx/gtk/button.h
+src/cjparser.o: ./include/wx/control.h ./include/wx/wx/gtk/control.h
+src/cjparser.o: ./include/wx/wx/bmpbuttn.h ./include/wx/wx/wx/gtk/bmpbuttn.h
+src/cjparser.o: ./include/wx/wx/checkbox.h ./include/wx/wx/wx/gtk/checkbox.h
+src/cjparser.o: ./include/wx/wx/choice.h ./include/wx/wx/wx/gtk/choice.h
+src/cjparser.o: ./include/wx/wx/scrolbar.h ./include/wx/wx/wx/gtk/scrolbar.h
+src/cjparser.o: ./include/wx/wx/stattext.h ./include/wx/wx/wx/gtk/stattext.h
+src/cjparser.o: ./include/wx/wx/statbmp.h ./include/wx/wx/wx/gtk/statbmp.h
+src/cjparser.o: ./include/wx/wx/statbox.h ./include/wx/wx/wx/gtk/statbox.h
+src/cjparser.o: ./include/wx/wx/listbox.h ./include/wx/wx/wx/gtk/listbox.h
+src/cjparser.o: ./include/wx/wx/radiobox.h ./include/wx/wx/wx/gtk/radiobox.h
+src/cjparser.o: ./include/wx/wx/radiobut.h ./include/wx/wx/wx/gtk/radiobut.h
+src/cjparser.o: ./include/wx/wx/textctrl.h ./include/wx/wx/wx/gtk/textctrl.h
+src/cjparser.o: ./include/wx/wx/slider.h ./include/wx/wx/wx/gtk/slider.h
+src/cjparser.o: ./include/wx/wx/gauge.h ./include/wx/wx/wx/gtk/gauge.h
+src/cjparser.o: ./include/wx/wx/combobox.h ./include/wx/wx/wx/gtk/combobox.h
+src/cjparser.o: ./include/wx/wx/menu.h ./include/wx/wx/wx/gtk/menu.h
+src/cjparser.o: ./include/wx/menuitem.h ./include/wx/wx/gtk/menuitem.h
+src/cjparser.o: ./include/wx/wx/app.h ./include/wx/wx/wx/gtk/app.h
+src/cjparser.o: ./include/wx/wx/dialog.h ./include/wx/wx/wx/gtk/dialog.h
+src/cjparser.o: ./include/wx/wx/timer.h ./include/wx/wx/wx/gtk/timer.h
+src/cjparser.o: ./include/wx/wx/utils.h ./include/wx/wx/wx/filefn.h
+src/cjparser.o: ./include/wx/wx/wx/process.h ./include/wx/wx/settings.h
+src/cjparser.o: ./include/wx/wx/wx/gtk/settings.h ./include/wx/wx/layout.h
+src/cjparser.o: ./include/wx/wx/mdi.h ./include/wx/wx/wx/gtk/mdi.h
+src/cjparser.o: ./include/wx/toolbar.h ./include/wx/wx/gtk/tbargtk.h
+src/cjparser.o: ./include/wx/wx/scrolwin.h
+src/cjparser.o: ./include/wx/wx/wx/generic/scrolwin.h
+src/cjparser.o: ./include/wx/wx/statusbr.h
+src/cjparser.o: ./include/wx/wx/wx/generic/statusbr.h
+src/cjparser.o: ./include/wx/wx/msgdlg.h ./include/wx/wx/wx/generic/msgdlgg.h
+src/cjparser.o: ./include/wx/wx/choicdlg.h
+src/cjparser.o: ./include/wx/wx/wx/generic/choicdgg.h
+src/cjparser.o: ./include/wx/wx/textdlg.h
+src/cjparser.o: ./include/wx/wx/wx/generic/textdlgg.h
+src/cjparser.o: ./include/wx/wx/filedlg.h ./include/wx/wx/wx/gtk/filedlg.h
+src/cjparser.o: ./include/wx/wx/dirdlg.h ./include/wx/wx/wx/generic/dirdlgg.h
+src/cjparser.o: ./include/wx/treectrl.h ./include/wx/wx/generic/treectrl.h
+src/cjparser.o: ./include/wx/wx/cmndata.h ./include/wx/wx/intl.h
+src/cjparser.o: ./include/wx/wx/valtext.h ./include/cjparser.h
+src/cjparser.o: ./include/srcparser.h ./include/markup.h
+src/cjparser.o: /usr/include/memory.h
+src/markup.o: ./include/wx/wxprec.h ./include/wx/wx.h ./include/wx/wx/setup.h
+src/markup.o: ./include/wx/wx/wx/gtk/setup.h ./include/wx/wx/defs.h
+src/markup.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/markup.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/markup.o: /usr/include/string.h /usr/include/features.h
+src/markup.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/markup.o: /usr/include/stdio.h /usr/include/libio.h
+src/markup.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/markup.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/markup.o: /usr/include/stdio_lim.h
+src/markup.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/markup.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/markup.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/markup.o: /usr/include/time.h /usr/include/endian.h
+src/markup.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/markup.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/markup.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/markup.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/markup.o: ./include/wx/wx/log.h ./include/wx/wx/window.h
+src/markup.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/object.h
+src/markup.o: ./include/wx/wx/memory.h ./include/wx/list.h
+src/markup.o: ./include/wx/event.h ./include/wx/wx/gdicmn.h
+src/markup.o: ./include/wx/wx/wx/hash.h ./include/wx/wx/wx/colour.h
+src/markup.o: ./include/wx/wx/wx/wx/gtk/colour.h ./include/wx/gdiobj.h
+src/markup.o: ./include/wx/wx/gtk/gdiobj.h ./include/wx/palette.h
+src/markup.o: ./include/wx/wx/gtk/palette.h ./include/wx/validate.h
+src/markup.o: ./include/wx/cursor.h ./include/wx/wx/gtk/cursor.h
+src/markup.o: ./include/wx/font.h ./include/wx/wx/gtk/font.h
+src/markup.o: ./include/wx/region.h ./include/wx/wx/gtk/region.h
+src/markup.o: ./include/wx/accel.h ./include/wx/wx/gtk/accel.h
+src/markup.o: ./include/wx/wx/panel.h ./include/wx/wx/wx/generic/panelg.h
+src/markup.o: ./include/wx/wx/frame.h ./include/wx/wx/wx/gtk/frame.h
+src/markup.o: ./include/wx/icon.h ./include/wx/wx/dc.h
+src/markup.o: ./include/wx/wx/wx/gtk/dc.h ./include/wx/pen.h
+src/markup.o: ./include/wx/wx/gtk/pen.h ./include/wx/brush.h
+src/markup.o: ./include/wx/wx/gtk/brush.h ./include/wx/bitmap.h
+src/markup.o: ./include/wx/wx/gtk/bitmap.h ./include/wx/wx/dcclient.h
+src/markup.o: ./include/wx/wx/wx/gtk/dcclient.h ./include/wx/wx/dcmemory.h
+src/markup.o: ./include/wx/wx/wx/gtk/dcmemory.h ./include/wx/wx/dcprint.h
+src/markup.o: ./include/wx/wx/dcscreen.h ./include/wx/wx/wx/gtk/dcscreen.h
+src/markup.o: ./include/wx/wx/button.h ./include/wx/wx/wx/gtk/button.h
+src/markup.o: ./include/wx/control.h ./include/wx/wx/gtk/control.h
+src/markup.o: ./include/wx/wx/bmpbuttn.h ./include/wx/wx/wx/gtk/bmpbuttn.h
+src/markup.o: ./include/wx/wx/checkbox.h ./include/wx/wx/wx/gtk/checkbox.h
+src/markup.o: ./include/wx/wx/choice.h ./include/wx/wx/wx/gtk/choice.h
+src/markup.o: ./include/wx/wx/scrolbar.h ./include/wx/wx/wx/gtk/scrolbar.h
+src/markup.o: ./include/wx/wx/stattext.h ./include/wx/wx/wx/gtk/stattext.h
+src/markup.o: ./include/wx/wx/statbmp.h ./include/wx/wx/wx/gtk/statbmp.h
+src/markup.o: ./include/wx/wx/statbox.h ./include/wx/wx/wx/gtk/statbox.h
+src/markup.o: ./include/wx/wx/listbox.h ./include/wx/wx/wx/gtk/listbox.h
+src/markup.o: ./include/wx/wx/radiobox.h ./include/wx/wx/wx/gtk/radiobox.h
+src/markup.o: ./include/wx/wx/radiobut.h ./include/wx/wx/wx/gtk/radiobut.h
+src/markup.o: ./include/wx/wx/textctrl.h ./include/wx/wx/wx/gtk/textctrl.h
+src/markup.o: ./include/wx/wx/slider.h ./include/wx/wx/wx/gtk/slider.h
+src/markup.o: ./include/wx/wx/gauge.h ./include/wx/wx/wx/gtk/gauge.h
+src/markup.o: ./include/wx/wx/combobox.h ./include/wx/wx/wx/gtk/combobox.h
+src/markup.o: ./include/wx/wx/menu.h ./include/wx/wx/wx/gtk/menu.h
+src/markup.o: ./include/wx/menuitem.h ./include/wx/wx/gtk/menuitem.h
+src/markup.o: ./include/wx/wx/app.h ./include/wx/wx/wx/gtk/app.h
+src/markup.o: ./include/wx/wx/dialog.h ./include/wx/wx/wx/gtk/dialog.h
+src/markup.o: ./include/wx/wx/timer.h ./include/wx/wx/wx/gtk/timer.h
+src/markup.o: ./include/wx/wx/utils.h ./include/wx/wx/wx/filefn.h
+src/markup.o: ./include/wx/wx/wx/process.h ./include/wx/wx/settings.h
+src/markup.o: ./include/wx/wx/wx/gtk/settings.h ./include/wx/wx/layout.h
+src/markup.o: ./include/wx/wx/mdi.h ./include/wx/wx/wx/gtk/mdi.h
+src/markup.o: ./include/wx/toolbar.h ./include/wx/wx/gtk/tbargtk.h
+src/markup.o: ./include/wx/wx/scrolwin.h
+src/markup.o: ./include/wx/wx/wx/generic/scrolwin.h
+src/markup.o: ./include/wx/wx/statusbr.h
+src/markup.o: ./include/wx/wx/wx/generic/statusbr.h ./include/wx/wx/msgdlg.h
+src/markup.o: ./include/wx/wx/wx/generic/msgdlgg.h ./include/wx/wx/choicdlg.h
+src/markup.o: ./include/wx/wx/wx/generic/choicdgg.h ./include/wx/wx/textdlg.h
+src/markup.o: ./include/wx/wx/wx/generic/textdlgg.h ./include/wx/wx/filedlg.h
+src/markup.o: ./include/wx/wx/wx/gtk/filedlg.h ./include/wx/wx/dirdlg.h
+src/markup.o: ./include/wx/wx/wx/generic/dirdlgg.h ./include/wx/treectrl.h
+src/markup.o: ./include/wx/wx/generic/treectrl.h ./include/wx/wx/cmndata.h
+src/markup.o: ./include/wx/wx/intl.h ./include/wx/wx/valtext.h
+src/markup.o: ./include/markup.h
+src/scriptbinder.o: ./include/wx/wxprec.h ./include/wx/wx.h
+src/scriptbinder.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/scriptbinder.o: ./include/wx/wx/defs.h
+src/scriptbinder.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/scriptbinder.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/scriptbinder.o: /usr/include/string.h /usr/include/features.h
+src/scriptbinder.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/scriptbinder.o: /usr/include/stdio.h /usr/include/libio.h
+src/scriptbinder.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/scriptbinder.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/scriptbinder.o: /usr/include/stdio_lim.h
+src/scriptbinder.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/scriptbinder.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/scriptbinder.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/scriptbinder.o: /usr/include/time.h /usr/include/endian.h
+src/scriptbinder.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/scriptbinder.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/scriptbinder.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/scriptbinder.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/scriptbinder.o: ./include/wx/wx/log.h ./include/wx/wx/window.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/object.h
+src/scriptbinder.o: ./include/wx/wx/memory.h ./include/wx/list.h
+src/scriptbinder.o: ./include/wx/event.h ./include/wx/wx/gdicmn.h
+src/scriptbinder.o: ./include/wx/wx/wx/hash.h ./include/wx/wx/wx/colour.h
+src/scriptbinder.o: ./include/wx/wx/wx/wx/gtk/colour.h ./include/wx/gdiobj.h
+src/scriptbinder.o: ./include/wx/wx/gtk/gdiobj.h ./include/wx/palette.h
+src/scriptbinder.o: ./include/wx/wx/gtk/palette.h ./include/wx/validate.h
+src/scriptbinder.o: ./include/wx/cursor.h ./include/wx/wx/gtk/cursor.h
+src/scriptbinder.o: ./include/wx/font.h ./include/wx/wx/gtk/font.h
+src/scriptbinder.o: ./include/wx/region.h ./include/wx/wx/gtk/region.h
+src/scriptbinder.o: ./include/wx/accel.h ./include/wx/wx/gtk/accel.h
+src/scriptbinder.o: ./include/wx/wx/panel.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/panelg.h
+src/scriptbinder.o: ./include/wx/wx/frame.h ./include/wx/wx/wx/gtk/frame.h
+src/scriptbinder.o: ./include/wx/icon.h ./include/wx/wx/dc.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/dc.h ./include/wx/pen.h
+src/scriptbinder.o: ./include/wx/wx/gtk/pen.h ./include/wx/brush.h
+src/scriptbinder.o: ./include/wx/wx/gtk/brush.h ./include/wx/bitmap.h
+src/scriptbinder.o: ./include/wx/wx/gtk/bitmap.h ./include/wx/wx/dcclient.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/dcclient.h
+src/scriptbinder.o: ./include/wx/wx/dcmemory.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/dcmemory.h
+src/scriptbinder.o: ./include/wx/wx/dcprint.h ./include/wx/wx/dcscreen.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/dcscreen.h
+src/scriptbinder.o: ./include/wx/wx/button.h ./include/wx/wx/wx/gtk/button.h
+src/scriptbinder.o: ./include/wx/control.h ./include/wx/wx/gtk/control.h
+src/scriptbinder.o: ./include/wx/wx/bmpbuttn.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/bmpbuttn.h
+src/scriptbinder.o: ./include/wx/wx/checkbox.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/checkbox.h
+src/scriptbinder.o: ./include/wx/wx/choice.h ./include/wx/wx/wx/gtk/choice.h
+src/scriptbinder.o: ./include/wx/wx/scrolbar.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/scrolbar.h
+src/scriptbinder.o: ./include/wx/wx/stattext.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/stattext.h
+src/scriptbinder.o: ./include/wx/wx/statbmp.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/statbmp.h
+src/scriptbinder.o: ./include/wx/wx/statbox.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/statbox.h
+src/scriptbinder.o: ./include/wx/wx/listbox.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/listbox.h
+src/scriptbinder.o: ./include/wx/wx/radiobox.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/radiobox.h
+src/scriptbinder.o: ./include/wx/wx/radiobut.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/radiobut.h
+src/scriptbinder.o: ./include/wx/wx/textctrl.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/textctrl.h
+src/scriptbinder.o: ./include/wx/wx/slider.h ./include/wx/wx/wx/gtk/slider.h
+src/scriptbinder.o: ./include/wx/wx/gauge.h ./include/wx/wx/wx/gtk/gauge.h
+src/scriptbinder.o: ./include/wx/wx/combobox.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/combobox.h ./include/wx/wx/menu.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/menu.h ./include/wx/menuitem.h
+src/scriptbinder.o: ./include/wx/wx/gtk/menuitem.h ./include/wx/wx/app.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/app.h ./include/wx/wx/dialog.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/dialog.h ./include/wx/wx/timer.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/timer.h ./include/wx/wx/utils.h
+src/scriptbinder.o: ./include/wx/wx/wx/filefn.h ./include/wx/wx/wx/process.h
+src/scriptbinder.o: ./include/wx/wx/settings.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/settings.h
+src/scriptbinder.o: ./include/wx/wx/layout.h ./include/wx/wx/mdi.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/mdi.h ./include/wx/toolbar.h
+src/scriptbinder.o: ./include/wx/wx/gtk/tbargtk.h ./include/wx/wx/scrolwin.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/scrolwin.h
+src/scriptbinder.o: ./include/wx/wx/statusbr.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/statusbr.h
+src/scriptbinder.o: ./include/wx/wx/msgdlg.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/msgdlgg.h
+src/scriptbinder.o: ./include/wx/wx/choicdlg.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/choicdgg.h
+src/scriptbinder.o: ./include/wx/wx/textdlg.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/textdlgg.h
+src/scriptbinder.o: ./include/wx/wx/filedlg.h
+src/scriptbinder.o: ./include/wx/wx/wx/gtk/filedlg.h ./include/wx/wx/dirdlg.h
+src/scriptbinder.o: ./include/wx/wx/wx/generic/dirdlgg.h
+src/scriptbinder.o: ./include/wx/treectrl.h
+src/scriptbinder.o: ./include/wx/wx/generic/treectrl.h
+src/scriptbinder.o: ./include/wx/wx/cmndata.h ./include/wx/wx/intl.h
+src/scriptbinder.o: ./include/wx/wx/valtext.h /usr/include/malloc.h
+src/scriptbinder.o: /usr/include/memory.h ./include/scriptbinder.h
+src/scriptbinder.o: ./include/markup.h
+src/srcparser.o: ./include/wx/wxprec.h ./include/wx/wx.h
+src/srcparser.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/srcparser.o: ./include/wx/wx/defs.h
+src/srcparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/srcparser.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/srcparser.o: /usr/include/string.h /usr/include/features.h
+src/srcparser.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/srcparser.o: /usr/include/stdio.h /usr/include/libio.h
+src/srcparser.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/srcparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/srcparser.o: /usr/include/stdio_lim.h
+src/srcparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/srcparser.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/srcparser.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/srcparser.o: /usr/include/time.h /usr/include/endian.h
+src/srcparser.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/srcparser.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/srcparser.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/srcparser.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/srcparser.o: ./include/wx/wx/log.h ./include/wx/wx/window.h
+src/srcparser.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/object.h
+src/srcparser.o: ./include/wx/wx/memory.h ./include/wx/list.h
+src/srcparser.o: ./include/wx/event.h ./include/wx/wx/gdicmn.h
+src/srcparser.o: ./include/wx/wx/wx/hash.h ./include/wx/wx/wx/colour.h
+src/srcparser.o: ./include/wx/wx/wx/wx/gtk/colour.h ./include/wx/gdiobj.h
+src/srcparser.o: ./include/wx/wx/gtk/gdiobj.h ./include/wx/palette.h
+src/srcparser.o: ./include/wx/wx/gtk/palette.h ./include/wx/validate.h
+src/srcparser.o: ./include/wx/cursor.h ./include/wx/wx/gtk/cursor.h
+src/srcparser.o: ./include/wx/font.h ./include/wx/wx/gtk/font.h
+src/srcparser.o: ./include/wx/region.h ./include/wx/wx/gtk/region.h
+src/srcparser.o: ./include/wx/accel.h ./include/wx/wx/gtk/accel.h
+src/srcparser.o: ./include/wx/wx/panel.h ./include/wx/wx/wx/generic/panelg.h
+src/srcparser.o: ./include/wx/wx/frame.h ./include/wx/wx/wx/gtk/frame.h
+src/srcparser.o: ./include/wx/icon.h ./include/wx/wx/dc.h
+src/srcparser.o: ./include/wx/wx/wx/gtk/dc.h ./include/wx/pen.h
+src/srcparser.o: ./include/wx/wx/gtk/pen.h ./include/wx/brush.h
+src/srcparser.o: ./include/wx/wx/gtk/brush.h ./include/wx/bitmap.h
+src/srcparser.o: ./include/wx/wx/gtk/bitmap.h ./include/wx/wx/dcclient.h
+src/srcparser.o: ./include/wx/wx/wx/gtk/dcclient.h ./include/wx/wx/dcmemory.h
+src/srcparser.o: ./include/wx/wx/wx/gtk/dcmemory.h ./include/wx/wx/dcprint.h
+src/srcparser.o: ./include/wx/wx/dcscreen.h ./include/wx/wx/wx/gtk/dcscreen.h
+src/srcparser.o: ./include/wx/wx/button.h ./include/wx/wx/wx/gtk/button.h
+src/srcparser.o: ./include/wx/control.h ./include/wx/wx/gtk/control.h
+src/srcparser.o: ./include/wx/wx/bmpbuttn.h ./include/wx/wx/wx/gtk/bmpbuttn.h
+src/srcparser.o: ./include/wx/wx/checkbox.h ./include/wx/wx/wx/gtk/checkbox.h
+src/srcparser.o: ./include/wx/wx/choice.h ./include/wx/wx/wx/gtk/choice.h
+src/srcparser.o: ./include/wx/wx/scrolbar.h ./include/wx/wx/wx/gtk/scrolbar.h
+src/srcparser.o: ./include/wx/wx/stattext.h ./include/wx/wx/wx/gtk/stattext.h
+src/srcparser.o: ./include/wx/wx/statbmp.h ./include/wx/wx/wx/gtk/statbmp.h
+src/srcparser.o: ./include/wx/wx/statbox.h ./include/wx/wx/wx/gtk/statbox.h
+src/srcparser.o: ./include/wx/wx/listbox.h ./include/wx/wx/wx/gtk/listbox.h
+src/srcparser.o: ./include/wx/wx/radiobox.h ./include/wx/wx/wx/gtk/radiobox.h
+src/srcparser.o: ./include/wx/wx/radiobut.h ./include/wx/wx/wx/gtk/radiobut.h
+src/srcparser.o: ./include/wx/wx/textctrl.h ./include/wx/wx/wx/gtk/textctrl.h
+src/srcparser.o: ./include/wx/wx/slider.h ./include/wx/wx/wx/gtk/slider.h
+src/srcparser.o: ./include/wx/wx/gauge.h ./include/wx/wx/wx/gtk/gauge.h
+src/srcparser.o: ./include/wx/wx/combobox.h ./include/wx/wx/wx/gtk/combobox.h
+src/srcparser.o: ./include/wx/wx/menu.h ./include/wx/wx/wx/gtk/menu.h
+src/srcparser.o: ./include/wx/menuitem.h ./include/wx/wx/gtk/menuitem.h
+src/srcparser.o: ./include/wx/wx/app.h ./include/wx/wx/wx/gtk/app.h
+src/srcparser.o: ./include/wx/wx/dialog.h ./include/wx/wx/wx/gtk/dialog.h
+src/srcparser.o: ./include/wx/wx/timer.h ./include/wx/wx/wx/gtk/timer.h
+src/srcparser.o: ./include/wx/wx/utils.h ./include/wx/wx/wx/filefn.h
+src/srcparser.o: ./include/wx/wx/wx/process.h ./include/wx/wx/settings.h
+src/srcparser.o: ./include/wx/wx/wx/gtk/settings.h ./include/wx/wx/layout.h
+src/srcparser.o: ./include/wx/wx/mdi.h ./include/wx/wx/wx/gtk/mdi.h
+src/srcparser.o: ./include/wx/toolbar.h ./include/wx/wx/gtk/tbargtk.h
+src/srcparser.o: ./include/wx/wx/scrolwin.h
+src/srcparser.o: ./include/wx/wx/wx/generic/scrolwin.h
+src/srcparser.o: ./include/wx/wx/statusbr.h
+src/srcparser.o: ./include/wx/wx/wx/generic/statusbr.h
+src/srcparser.o: ./include/wx/wx/msgdlg.h
+src/srcparser.o: ./include/wx/wx/wx/generic/msgdlgg.h
+src/srcparser.o: ./include/wx/wx/choicdlg.h
+src/srcparser.o: ./include/wx/wx/wx/generic/choicdgg.h
+src/srcparser.o: ./include/wx/wx/textdlg.h
+src/srcparser.o: ./include/wx/wx/wx/generic/textdlgg.h
+src/srcparser.o: ./include/wx/wx/filedlg.h ./include/wx/wx/wx/gtk/filedlg.h
+src/srcparser.o: ./include/wx/wx/dirdlg.h
+src/srcparser.o: ./include/wx/wx/wx/generic/dirdlgg.h ./include/wx/treectrl.h
+src/srcparser.o: ./include/wx/wx/generic/treectrl.h ./include/wx/wx/cmndata.h
+src/srcparser.o: ./include/wx/wx/intl.h ./include/wx/wx/valtext.h
+src/srcparser.o: /usr/include/malloc.h ./include/srcparser.h
+src/srcparser.o: ./include/markup.h
+src/ifcontext.o: ./include/wx/wxprec.h ./include/wx/wx.h
+src/ifcontext.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/ifcontext.o: ./include/wx/wx/defs.h
+src/ifcontext.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/ifcontext.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/ifcontext.o: /usr/include/string.h /usr/include/features.h
+src/ifcontext.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/ifcontext.o: /usr/include/stdio.h /usr/include/libio.h
+src/ifcontext.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/ifcontext.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/ifcontext.o: /usr/include/stdio_lim.h
+src/ifcontext.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/ifcontext.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/ifcontext.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/ifcontext.o: /usr/include/time.h /usr/include/endian.h
+src/ifcontext.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/ifcontext.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/ifcontext.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/ifcontext.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/ifcontext.o: ./include/wx/wx/log.h ./include/wx/wx/window.h
+src/ifcontext.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/object.h
+src/ifcontext.o: ./include/wx/wx/memory.h ./include/wx/list.h
+src/ifcontext.o: ./include/wx/event.h ./include/wx/wx/gdicmn.h
+src/ifcontext.o: ./include/wx/wx/wx/hash.h ./include/wx/wx/wx/colour.h
+src/ifcontext.o: ./include/wx/wx/wx/wx/gtk/colour.h ./include/wx/gdiobj.h
+src/ifcontext.o: ./include/wx/wx/gtk/gdiobj.h ./include/wx/palette.h
+src/ifcontext.o: ./include/wx/wx/gtk/palette.h ./include/wx/validate.h
+src/ifcontext.o: ./include/wx/cursor.h ./include/wx/wx/gtk/cursor.h
+src/ifcontext.o: ./include/wx/font.h ./include/wx/wx/gtk/font.h
+src/ifcontext.o: ./include/wx/region.h ./include/wx/wx/gtk/region.h
+src/ifcontext.o: ./include/wx/accel.h ./include/wx/wx/gtk/accel.h
+src/ifcontext.o: ./include/wx/wx/panel.h ./include/wx/wx/wx/generic/panelg.h
+src/ifcontext.o: ./include/wx/wx/frame.h ./include/wx/wx/wx/gtk/frame.h
+src/ifcontext.o: ./include/wx/icon.h ./include/wx/wx/dc.h
+src/ifcontext.o: ./include/wx/wx/wx/gtk/dc.h ./include/wx/pen.h
+src/ifcontext.o: ./include/wx/wx/gtk/pen.h ./include/wx/brush.h
+src/ifcontext.o: ./include/wx/wx/gtk/brush.h ./include/wx/bitmap.h
+src/ifcontext.o: ./include/wx/wx/gtk/bitmap.h ./include/wx/wx/dcclient.h
+src/ifcontext.o: ./include/wx/wx/wx/gtk/dcclient.h ./include/wx/wx/dcmemory.h
+src/ifcontext.o: ./include/wx/wx/wx/gtk/dcmemory.h ./include/wx/wx/dcprint.h
+src/ifcontext.o: ./include/wx/wx/dcscreen.h ./include/wx/wx/wx/gtk/dcscreen.h
+src/ifcontext.o: ./include/wx/wx/button.h ./include/wx/wx/wx/gtk/button.h
+src/ifcontext.o: ./include/wx/control.h ./include/wx/wx/gtk/control.h
+src/ifcontext.o: ./include/wx/wx/bmpbuttn.h ./include/wx/wx/wx/gtk/bmpbuttn.h
+src/ifcontext.o: ./include/wx/wx/checkbox.h ./include/wx/wx/wx/gtk/checkbox.h
+src/ifcontext.o: ./include/wx/wx/choice.h ./include/wx/wx/wx/gtk/choice.h
+src/ifcontext.o: ./include/wx/wx/scrolbar.h ./include/wx/wx/wx/gtk/scrolbar.h
+src/ifcontext.o: ./include/wx/wx/stattext.h ./include/wx/wx/wx/gtk/stattext.h
+src/ifcontext.o: ./include/wx/wx/statbmp.h ./include/wx/wx/wx/gtk/statbmp.h
+src/ifcontext.o: ./include/wx/wx/statbox.h ./include/wx/wx/wx/gtk/statbox.h
+src/ifcontext.o: ./include/wx/wx/listbox.h ./include/wx/wx/wx/gtk/listbox.h
+src/ifcontext.o: ./include/wx/wx/radiobox.h ./include/wx/wx/wx/gtk/radiobox.h
+src/ifcontext.o: ./include/wx/wx/radiobut.h ./include/wx/wx/wx/gtk/radiobut.h
+src/ifcontext.o: ./include/wx/wx/textctrl.h ./include/wx/wx/wx/gtk/textctrl.h
+src/ifcontext.o: ./include/wx/wx/slider.h ./include/wx/wx/wx/gtk/slider.h
+src/ifcontext.o: ./include/wx/wx/gauge.h ./include/wx/wx/wx/gtk/gauge.h
+src/ifcontext.o: ./include/wx/wx/combobox.h ./include/wx/wx/wx/gtk/combobox.h
+src/ifcontext.o: ./include/wx/wx/menu.h ./include/wx/wx/wx/gtk/menu.h
+src/ifcontext.o: ./include/wx/menuitem.h ./include/wx/wx/gtk/menuitem.h
+src/ifcontext.o: ./include/wx/wx/app.h ./include/wx/wx/wx/gtk/app.h
+src/ifcontext.o: ./include/wx/wx/dialog.h ./include/wx/wx/wx/gtk/dialog.h
+src/ifcontext.o: ./include/wx/wx/timer.h ./include/wx/wx/wx/gtk/timer.h
+src/ifcontext.o: ./include/wx/wx/utils.h ./include/wx/wx/wx/filefn.h
+src/ifcontext.o: ./include/wx/wx/wx/process.h ./include/wx/wx/settings.h
+src/ifcontext.o: ./include/wx/wx/wx/gtk/settings.h ./include/wx/wx/layout.h
+src/ifcontext.o: ./include/wx/wx/mdi.h ./include/wx/wx/wx/gtk/mdi.h
+src/ifcontext.o: ./include/wx/toolbar.h ./include/wx/wx/gtk/tbargtk.h
+src/ifcontext.o: ./include/wx/wx/scrolwin.h
+src/ifcontext.o: ./include/wx/wx/wx/generic/scrolwin.h
+src/ifcontext.o: ./include/wx/wx/statusbr.h
+src/ifcontext.o: ./include/wx/wx/wx/generic/statusbr.h
+src/ifcontext.o: ./include/wx/wx/msgdlg.h
+src/ifcontext.o: ./include/wx/wx/wx/generic/msgdlgg.h
+src/ifcontext.o: ./include/wx/wx/choicdlg.h
+src/ifcontext.o: ./include/wx/wx/wx/generic/choicdgg.h
+src/ifcontext.o: ./include/wx/wx/textdlg.h
+src/ifcontext.o: ./include/wx/wx/wx/generic/textdlgg.h
+src/ifcontext.o: ./include/wx/wx/filedlg.h ./include/wx/wx/wx/gtk/filedlg.h
+src/ifcontext.o: ./include/wx/wx/dirdlg.h
+src/ifcontext.o: ./include/wx/wx/wx/generic/dirdlgg.h ./include/wx/treectrl.h
+src/ifcontext.o: ./include/wx/wx/generic/treectrl.h ./include/wx/wx/cmndata.h
+src/ifcontext.o: ./include/wx/wx/intl.h ./include/wx/wx/valtext.h
+src/ifcontext.o: /usr/include/malloc.h ./include/ifcontext.h
+src/ifcontext.o: ./include/srcparser.h ./include/markup.h
+src/ifcontext.o: ./include/cjparser.h /usr/include/memory.h
+src/HelpGen.o: ./include/wx/wxprec.h ./include/cjparser.h
+src/HelpGen.o: ./include/srcparser.h ./include/markup.h
+src/HelpGen.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/HelpGen.o: /usr/include/libio.h /usr/include/features.h
+src/HelpGen.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/HelpGen.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/HelpGen.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/HelpGen.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/HelpGen.o: /usr/include/memory.h /usr/include/stdlib.h
+src/HelpGen.o: /usr/include/sys/types.h /usr/include/time.h
+src/HelpGen.o: /usr/include/endian.h /usr/include/bytesex.h
+src/HelpGen.o: /usr/include/sys/select.h /usr/include/selectbits.h
+src/HelpGen.o: /usr/include/alloca.h /usr/include/stdio.h
+src/HelpGen.o: /usr/include/stdio_lim.h
+src/sourcepainter.o: ./include/wx/wxprec.h ./include/wx/wx.h
+src/sourcepainter.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/sourcepainter.o: ./include/wx/wx/defs.h
+src/sourcepainter.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/sourcepainter.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/sourcepainter.o: /usr/include/string.h /usr/include/features.h
+src/sourcepainter.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/sourcepainter.o: /usr/include/stdio.h /usr/include/libio.h
+src/sourcepainter.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/sourcepainter.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/sourcepainter.o: /usr/include/stdio_lim.h
+src/sourcepainter.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/sourcepainter.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/sourcepainter.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/sourcepainter.o: /usr/include/time.h /usr/include/endian.h
+src/sourcepainter.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/sourcepainter.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/sourcepainter.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/sourcepainter.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/sourcepainter.o: ./include/wx/wx/log.h ./include/wx/wx/window.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/object.h
+src/sourcepainter.o: ./include/wx/wx/memory.h ./include/wx/list.h
+src/sourcepainter.o: ./include/wx/event.h ./include/wx/wx/gdicmn.h
+src/sourcepainter.o: ./include/wx/wx/wx/hash.h ./include/wx/wx/wx/colour.h
+src/sourcepainter.o: ./include/wx/wx/wx/wx/gtk/colour.h ./include/wx/gdiobj.h
+src/sourcepainter.o: ./include/wx/wx/gtk/gdiobj.h ./include/wx/palette.h
+src/sourcepainter.o: ./include/wx/wx/gtk/palette.h ./include/wx/validate.h
+src/sourcepainter.o: ./include/wx/cursor.h ./include/wx/wx/gtk/cursor.h
+src/sourcepainter.o: ./include/wx/font.h ./include/wx/wx/gtk/font.h
+src/sourcepainter.o: ./include/wx/region.h ./include/wx/wx/gtk/region.h
+src/sourcepainter.o: ./include/wx/accel.h ./include/wx/wx/gtk/accel.h
+src/sourcepainter.o: ./include/wx/wx/panel.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/panelg.h
+src/sourcepainter.o: ./include/wx/wx/frame.h ./include/wx/wx/wx/gtk/frame.h
+src/sourcepainter.o: ./include/wx/icon.h ./include/wx/wx/dc.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/dc.h ./include/wx/pen.h
+src/sourcepainter.o: ./include/wx/wx/gtk/pen.h ./include/wx/brush.h
+src/sourcepainter.o: ./include/wx/wx/gtk/brush.h ./include/wx/bitmap.h
+src/sourcepainter.o: ./include/wx/wx/gtk/bitmap.h ./include/wx/wx/dcclient.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/dcclient.h
+src/sourcepainter.o: ./include/wx/wx/dcmemory.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/dcmemory.h
+src/sourcepainter.o: ./include/wx/wx/dcprint.h ./include/wx/wx/dcscreen.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/dcscreen.h
+src/sourcepainter.o: ./include/wx/wx/button.h ./include/wx/wx/wx/gtk/button.h
+src/sourcepainter.o: ./include/wx/control.h ./include/wx/wx/gtk/control.h
+src/sourcepainter.o: ./include/wx/wx/bmpbuttn.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/bmpbuttn.h
+src/sourcepainter.o: ./include/wx/wx/checkbox.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/checkbox.h
+src/sourcepainter.o: ./include/wx/wx/choice.h ./include/wx/wx/wx/gtk/choice.h
+src/sourcepainter.o: ./include/wx/wx/scrolbar.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/scrolbar.h
+src/sourcepainter.o: ./include/wx/wx/stattext.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/stattext.h
+src/sourcepainter.o: ./include/wx/wx/statbmp.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/statbmp.h
+src/sourcepainter.o: ./include/wx/wx/statbox.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/statbox.h
+src/sourcepainter.o: ./include/wx/wx/listbox.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/listbox.h
+src/sourcepainter.o: ./include/wx/wx/radiobox.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/radiobox.h
+src/sourcepainter.o: ./include/wx/wx/radiobut.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/radiobut.h
+src/sourcepainter.o: ./include/wx/wx/textctrl.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/textctrl.h
+src/sourcepainter.o: ./include/wx/wx/slider.h ./include/wx/wx/wx/gtk/slider.h
+src/sourcepainter.o: ./include/wx/wx/gauge.h ./include/wx/wx/wx/gtk/gauge.h
+src/sourcepainter.o: ./include/wx/wx/combobox.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/combobox.h ./include/wx/wx/menu.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/menu.h ./include/wx/menuitem.h
+src/sourcepainter.o: ./include/wx/wx/gtk/menuitem.h ./include/wx/wx/app.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/app.h ./include/wx/wx/dialog.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/dialog.h ./include/wx/wx/timer.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/timer.h ./include/wx/wx/utils.h
+src/sourcepainter.o: ./include/wx/wx/wx/filefn.h ./include/wx/wx/wx/process.h
+src/sourcepainter.o: ./include/wx/wx/settings.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/settings.h
+src/sourcepainter.o: ./include/wx/wx/layout.h ./include/wx/wx/mdi.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/mdi.h ./include/wx/toolbar.h
+src/sourcepainter.o: ./include/wx/wx/gtk/tbargtk.h ./include/wx/wx/scrolwin.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/scrolwin.h
+src/sourcepainter.o: ./include/wx/wx/statusbr.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/statusbr.h
+src/sourcepainter.o: ./include/wx/wx/msgdlg.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/msgdlgg.h
+src/sourcepainter.o: ./include/wx/wx/choicdlg.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/choicdgg.h
+src/sourcepainter.o: ./include/wx/wx/textdlg.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/textdlgg.h
+src/sourcepainter.o: ./include/wx/wx/filedlg.h
+src/sourcepainter.o: ./include/wx/wx/wx/gtk/filedlg.h
+src/sourcepainter.o: ./include/wx/wx/dirdlg.h
+src/sourcepainter.o: ./include/wx/wx/wx/generic/dirdlgg.h
+src/sourcepainter.o: ./include/wx/treectrl.h
+src/sourcepainter.o: ./include/wx/wx/generic/treectrl.h
+src/sourcepainter.o: ./include/wx/wx/cmndata.h ./include/wx/wx/intl.h
+src/sourcepainter.o: ./include/wx/wx/valtext.h ./include/sourcepainter.h
+src/sourcepainter.o: ./include/markup.h
+src/wx/string.o: ./include/wx/wxprec.h /usr/include/ctype.h
+src/wx/string.o: /usr/include/features.h /usr/include/sys/cdefs.h
+src/wx/string.o: /usr/include/gnu/stubs.h /usr/include/endian.h
+src/wx/string.o: /usr/include/bytesex.h /usr/include/string.h
+src/wx/string.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/wx/string.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/wx/string.o: /usr/include/gnu/types.h /usr/include/time.h
+src/wx/string.o: /usr/include/sys/select.h /usr/include/selectbits.h
+src/wx/string.o: /usr/include/alloca.h
+src/wx_extra_imps.o: ./include/wx/wxprec.h /usr/include/memory.h
+src/wx_extra_imps.o: /usr/include/features.h /usr/include/sys/cdefs.h
+src/wx_extra_imps.o: /usr/include/gnu/stubs.h
+src/wx/object.o: ./include/wx/wxprec.h /usr/include/string.h
+src/wx/object.o: /usr/include/features.h /usr/include/sys/cdefs.h
+src/wx/object.o: /usr/include/gnu/stubs.h
+src/wx/object.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/wx/object.o: /usr/include/assert.h
+src/wx/hash.o: ./include/wx/wxprec.h ./include/wx/list.h
+src/wx/hash.o: ./include/wx/wx/defs.h
+src/wx/hash.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/wx/hash.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/wx/hash.o: ./include/wx/wx/wx/version.h ./include/wx/wx/wx/debug.h
+src/wx/hash.o: /usr/include/assert.h /usr/include/features.h
+src/wx/hash.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/wx/hash.o: ./include/wx/object.h ./include/wx/wx/memory.h
+src/wx/hash.o: ./include/wx/wx/string.h /usr/include/string.h
+src/wx/hash.o: /usr/include/stdio.h /usr/include/libio.h
+src/wx/hash.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/wx/hash.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/wx/hash.o: /usr/include/stdio_lim.h
+src/wx/hash.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/wx/hash.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/wx/hash.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/wx/hash.o: /usr/include/time.h /usr/include/endian.h
+src/wx/hash.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/wx/hash.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/wx/hash.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/wx/hash.o: ./include/wx/wx/wx/hash.h
+src/wx/log.o: ./include/wx/wxprec.h ./include/wx/file.h
+src/wx/log.o: ./include/wx/textfile.h ./include/wx/wx/defs.h
+src/wx/log.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/wx/log.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/wx/log.o: ./include/wx/wx/wx/version.h ./include/wx/wx/string.h
+src/wx/log.o: /usr/include/string.h /usr/include/features.h
+src/wx/log.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/wx/log.o: /usr/include/stdio.h /usr/include/libio.h
+src/wx/log.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/wx/log.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/wx/log.o: /usr/include/stdio_lim.h
+src/wx/log.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/wx/log.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/wx/log.o: /usr/include/stdlib.h /usr/include/sys/types.h
+src/wx/log.o: /usr/include/time.h /usr/include/endian.h
+src/wx/log.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/wx/log.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/wx/log.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/wx/log.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/wx/log.o: ./include/wx/wx/dynarray.h ./include/wx/wx/utils.h
+src/wx/log.o: ./include/wx/object.h ./include/wx/wx/memory.h
+src/wx/log.o: ./include/wx/list.h ./include/wx/wx/window.h
+src/wx/log.o: ./include/wx/wx/wx/gtk/window.h ./include/wx/event.h
+src/wx/log.o: ./include/wx/wx/gdicmn.h ./include/wx/wx/wx/hash.h
+src/wx/log.o: ./include/wx/wx/wx/colour.h ./include/wx/wx/wx/wx/gtk/colour.h
+src/wx/log.o: ./include/wx/gdiobj.h ./include/wx/wx/gtk/gdiobj.h
+src/wx/log.o: ./include/wx/palette.h ./include/wx/wx/gtk/palette.h
+src/wx/log.o: ./include/wx/validate.h ./include/wx/cursor.h
+src/wx/log.o: ./include/wx/wx/gtk/cursor.h ./include/wx/font.h
+src/wx/log.o: ./include/wx/wx/gtk/font.h ./include/wx/region.h
+src/wx/log.o: ./include/wx/wx/gtk/region.h ./include/wx/accel.h
+src/wx/log.o: ./include/wx/wx/gtk/accel.h ./include/wx/wx/wx/filefn.h
+src/wx/log.o: ./include/wx/wx/wx/process.h ./include/wx/wx/log.h
+src/wx/log.o: /usr/include/errno.h /usr/include/errnos.h
+src/wx/log.o: /usr/include/linux/errno.h /usr/include/asm/errno.h
+src/wx/file.o: ./include/wx/wxprec.h ./include/wx/wx/defs.h
+src/wx/file.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/wx/file.o: ./include/wx/wx/setup.h ./include/wx/wx/wx/gtk/setup.h
+src/wx/file.o: ./include/wx/wx/wx/version.h /usr/include/stdio.h
+src/wx/file.o: /usr/include/libio.h /usr/include/features.h
+src/wx/file.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/wx/file.o: /usr/include/_G_config.h /usr/include/gnu/types.h
+src/wx/file.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/wx/file.o: /usr/include/stdio_lim.h /usr/include/fcntl.h
+src/wx/file.o: /usr/include/fcntlbits.h /usr/include/sys/types.h
+src/wx/file.o: /usr/include/time.h /usr/include/endian.h
+src/wx/file.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/wx/file.o: /usr/include/selectbits.h /usr/include/sys/stat.h
+src/wx/file.o: /usr/include/statbuf.h ./include/wx/wx/string.h
+src/wx/file.o: /usr/include/string.h
+src/wx/file.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/limits.h
+src/wx/file.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/syslimits.h
+src/wx/file.o: /usr/include/stdlib.h /usr/include/alloca.h
+src/wx/file.o: ./include/wx/wx/wx/debug.h /usr/include/assert.h
+src/wx/file.o: /usr/include/g++/iostream.h /usr/include/g++/streambuf.h
+src/wx/file.o: ./include/wx/wx/intl.h ./include/wx/file.h
+src/wx/file.o: ./include/wx/wx/log.h
+src/wx/list.o: ./include/wx/wxprec.h
+src/wx/list.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stdarg.h
+src/wx/list.o: /usr/include/stdlib.h /usr/include/features.h
+src/wx/list.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+src/wx/list.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.60/include/stddef.h
+src/wx/list.o: /usr/include/sys/types.h /usr/include/gnu/types.h
+src/wx/list.o: /usr/include/time.h /usr/include/endian.h
+src/wx/list.o: /usr/include/bytesex.h /usr/include/sys/select.h
+src/wx/list.o: /usr/include/selectbits.h /usr/include/alloca.h
+src/wx/list.o: /usr/include/string.h
diff --git a/utils/HelpGen/include/cjparser.h b/utils/HelpGen/include/cjparser.h
new file mode 100644 (file)
index 0000000..47c955e
--- /dev/null
@@ -0,0 +1,125 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Implementation of C++/Java parser
+//              compatible with SourceParserBase interface
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __CJPARSESR_G__
+#define __CJPARSESR_G__
+
+#include "srcparser.h"
+
+#include <iostream.h>
+#include <memory.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+// class parses given "memory-resident" Java or C++ source code
+// and captures information about classes/attrubutes/methods/
+// arguments/etc into structures. Conforms with SourceParserBase 
+// interface requirements.
+
+class CJSourceParser : public SourceParserBase
+{
+protected:
+       // begining of the full-text area of the source file
+       char* mpStart;
+
+       // points to first character after the end
+       // of teh full-text area
+       char* mpEnd;
+
+       // current "privacy level"
+       int   mCurVis;
+
+       // current parsing position int full-text area
+       char*  cur;
+
+       // about the current class
+       bool   mIsVirtaul;
+       bool   mIsTemplate;
+       size_t mNestingLevel;
+
+       // context data for which is currently being collected
+       spContext* mpCurCtx;
+
+       int mCurCtxType; // type of the current context
+
+       bool mCommentsOn;
+       bool mMacrosOn;
+
+protected:
+
+       void AttachComments( spContext& ctx, char* cur );
+       void ParseKeyword( char*& cur );
+       bool ParseNameAndRetVal( char*& cur, bool& isAMacro );
+       bool ParseArguments( char*& cur );
+       void ParseMemberVar( char*& cur );
+       void SkipFunction( char*& cur );
+       void SkipFunctionBody( char*& cur );
+       bool CheckVisibilty( char*& cur );
+
+       void AddClassNode( char*& cur );
+       void AddMacroNode( char*& cur );
+       void AddEnumNode( char*& cur );
+       void AddTypeDefNode( char*& cur );
+
+       void DumpOperationInfo( spOperation& info, const string& tab, ostream& os );
+       void DumpClassHeader( spClass& info, ostream& os );
+       void DumpClassBody( spClass& info, ostream& os );
+
+public:
+
+       // NOTE:: discarding of macros or comments improves performance and 
+       //                decreases memory usage
+
+       CJSourceParser(bool collectCommnets = 1,
+                                  bool collectMacros   = 1);
+
+       // returns the root-node of the created context tree
+       // (user is responsible for releasing it from the heep)
+       // "end" should point to the last (character + 1) of the 
+       // source text
+
+       virtual spFile* Parse( char* start, char* end );
+};
+
+// inline'ed helpers used (just info):
+/*
+static inline void skip_to_eol( char*& cur );
+static inline void skip_eol( char*& cur );
+static inline bool skip_to_next_comment_in_the_line( char*& cur );
+static void skip_to_prev_line( char*& cur );
+static inline void skip_comments( char*& cur );
+static inline void clear_commets_queue();
+static inline void skip_quoted_string( char*& cur );
+static inline bool get_next_token( char*& cur );
+static inline void skip_preprocessor_dir( char*& cur );
+static void skip_token( char*& cur );
+static inline size_t get_token_len( char* tok );
+static inline bool cmp_tokens( char* tok1, char* tok2 );
+static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len );
+static inline void skip_tempalate_statement( char*& cur );
+static inline void skip_statement( char*& cur );
+static inline void skip_token_back( char*& cur );
+static inline void skip_next_token_back( char*& cur );
+static string get_token_str( char* cur );
+static size_t skip_block( char*& cur );
+static inline bool skip_imp_block( char*& cur );
+static bool is_class_token( char*& cur );
+inline static bool is_forward_decl( char* cur );
+inline static bool is_function( char* cur, bool& isAMacro );
+static inline void skip_scope_block( char*& cur );
+static void arrange_indirection_tokens_between( string& type, string& identifier );
+static bool is_keyword( char* cur );
+static inline void get_string_between( char* start, char* end, string* pStr );
+static char* set_comment_text( string& text, char* start );
+*/
+
+#endif
diff --git a/utils/HelpGen/include/docripper.h b/utils/HelpGen/include/docripper.h
new file mode 100644 (file)
index 0000000..23ae9ac
--- /dev/null
@@ -0,0 +1,157 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __DOCRIPPER_G__
+#define __DOCRIPPER_G__
+
+#include "scriptbinder.h"
+#include "srcparser.h"
+#include "sourcepainter.h"
+
+#if defined( wxUSE_TEMPLATE_STL )
+               
+       #include <vector>
+
+       typedef vector<ScriptTemplate*> STemplateListT;
+
+#else
+
+       #include "wxstlvec.h"
+
+       typedef ScriptTemplate* ScriptTemplatePtrT; 
+       typedef WXSTL_VECTOR_SHALLOW_COPY(ScriptTemplatePtrT) STemplateListT;
+
+#endif
+
+
+// specific DocGenerator class for "Ripper", 
+// also acts as source code visitor
+
+class RipperDocGen : public DocGeneratorBase, public spVisitor
+{
+protected:
+       // templates for various sections
+       ScriptTemplate mTopTempl;
+       ScriptTemplate mContentIdxTempl;
+       ScriptTemplate mSuperContentTempl;
+       ScriptTemplate mSubContentTempl;
+       ScriptTemplate mOutLineTempl;
+       ScriptTemplate mOutLine1Templ;
+
+       // template used for corss-references
+       ScriptTemplate mRefTempl;
+
+       // template used to show not-existing sections
+       ScriptTemplate mDeadRefTempl;
+
+       // template collection for generation of class-tree
+       STemplateListT mTreeTemplates;
+
+       // pointers to all major index sections
+       ScriptSection* mpTopIdx;
+       ScriptSection* mpClassIdx;
+       ScriptSection* mpEnumIdx;
+       ScriptSection* mpTypeDefIdx;
+       ScriptSection* mpMacroIdx;
+       ScriptSection* mpGlobalVarsIdx;
+       ScriptSection* mpGlobalFuncIdx;
+       ScriptSection* mpConstIdx;
+
+       // parser set up from user-code for sepcific language
+       SourceParserBase* mpParser;
+
+       // class section, which is currently being
+       // assembled
+       ScriptSection*    mpCurClassSect;
+       
+       // source syntax heighlighter object
+       SourcePainter  mSrcPainter;
+
+       // context, to which all file contexts
+       // are assembled
+       spContext*     mpFileBinderCtx;
+
+       // script tags set up from usesr code
+       MarkupTagsT    mTags;
+
+protected:
+       // helpers
+       void AppendComments( spContext& fromContext, string& str );
+
+       void AppendMulitilineStr( string& st, string& mlStr );
+
+       void AppendHighlightedSource( string& st, string source );
+
+       // returns TRUE, if no comments found in the context,
+       // plus, creates dummy(empty) section, and puts a 
+       // reference woth "dead-link" template to it in the 
+       // given index-section "toSect"
+
+       bool CheckIfUncommented( spContext& ctx, ScriptSection& toSect );
+
+       // checks if context has any comments, then returns
+       // template of normal reference, otherwise of dead reference
+
+       ScriptTemplate* GetRefTemplFor( spContext& ctx );
+
+       // adds "someClass::" perfix to the context name,
+       // if it's not in the file scope (i.e. if it's not global)
+
+       string GetScopedName( spContext& ofCtx );
+
+       // adds section to currently assembled class section
+       // and places references to it from "public", "protected"
+       // or "private" indexing-subsections of the class, depending
+       // on the visibility of the context
+
+       void AddToCurrentClass( ScriptSection* pSection, spContext& ctx, 
+                                                       const char* subSectionName );
+
+       // called, after all files are processed, to
+       // resolve possible super/derived class relations,
+       // and put cross references to them - where resolution was
+       // successful
+       void LinkSuperClassRefs();
+
+       // implementations of "visiting procedures", declared in spVisitor
+
+       virtual void VisitClass( spClass& cl );
+       virtual void VisitEnumeration( spEnumeration& en );
+       virtual void VisitTypeDef( spTypeDef& td );
+       virtual void VisitPreprocessorLine( spPreprocessorLine& pd );
+       virtual void VisitAttribute( spAttribute& attr );
+       virtual void VisitOperation( spOperation& op );
+
+       // overriden member of DocGernatorBase
+
+       virtual bool OnSaveDocument( ScriptStream& stm );
+
+       virtual ScriptSection* GetTopSection() 
+               { return mpTopIdx; }
+
+public:
+       RipperDocGen();
+       ~RipperDocGen();
+
+       // should be called onece to set user-code provided,
+       // parser for specific source code language
+       // (NOTE:: it's the user-code's responsibility to
+       //  relseas memory of pParser)
+
+       void Init( SourceParserBase* pParser );
+       
+       // should be called on each file
+       
+       void ProcessFile( const char* sourceFile );
+};
+
+
+#endif
\ No newline at end of file
diff --git a/utils/HelpGen/include/ifcontext.h b/utils/HelpGen/include/ifcontext.h
new file mode 100644 (file)
index 0000000..80014c8
--- /dev/null
@@ -0,0 +1,100 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/12/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __IFCONTEXT_G__
+#define __IFCONTEXT_G__
+
+#include "srcparser.h"
+#include "cjparser.h"
+
+class spBookmark
+{
+public:
+       size_t mFrom;
+       size_t mLen;
+       size_t mFileNo;
+
+       inline spBookmark() {}
+
+       inline spBookmark( int from, int len, int fileNo )
+               : mFrom( from ), mLen( len ), mFileNo( fileNo )
+       {}
+};
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef vector<spBookmark) BookmarkListT
+
+#else
+
+       typedef WXSTL_VECTOR_SHALLOW_COPY(spBookmark) BookmarkListT;
+
+#endif
+
+
+class spInterFileContext : public spContext
+{
+protected:
+
+       BookmarkListT  mDeletionMarks;
+
+       BookmarkListT  mFiltered;
+
+       size_t         mCurFileNo;
+
+       CJSourceParser mParser;
+
+protected:
+
+       size_t GetFileNoOfContext( spContext& ctx );
+       size_t GetFileNo( const string& fname );
+
+       void InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark );
+
+       void DoAppendSourceFragment( string& source, 
+                                                                string& result, 
+                                                        size_t  pos, size_t len );
+
+       void GenerateContextBody( spContext& ctx, 
+                                                         string&    source,
+                                                         string&    result, 
+                                                         size_t& lastSavedPos,
+                                                         size_t& lastKnownPos );
+
+public:
+
+       StrListT       mFiles;
+       StrListT       mContents;
+
+public:
+
+       spInterFileContext();
+       ~spInterFileContext();
+
+       void AddFile( const string& fname, const string& content );
+
+       void RemoveContext( spContext& ctx );
+
+       void GenrateContents();
+
+       void ParseContents( SourceParserPlugin* pPlugin = NULL );
+
+       void WriteToFiles();
+
+       // overriden method of the base class (finds out the source fragment)
+
+       virtual string GetBody( spContext* pCtx = NULL );
+
+       virtual string GetHeader( spContext* pCtx = NULL );
+};
+
+
+#endif
\ No newline at end of file
diff --git a/utils/HelpGen/include/markup.h b/utils/HelpGen/include/markup.h
new file mode 100644 (file)
index 0000000..13e43a0
--- /dev/null
@@ -0,0 +1,51 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __MARKUP_G__
+#define __MARKUP_G__
+
+// indicies for the MarkupTagsT array
+
+#define TAG_BOLD        0
+#define TAG_ITALIC             1
+
+#define TAG_FIXED_FONT  2
+#define TAG_BLACK_FONT 3
+#define TAG_RED_FONT   4
+#define TAG_GREEN_FONT 5
+#define TAG_BLUE_FONT  6
+
+#define TAG_PARAGRAPH  7
+#define TAG_NEW_LINE   8
+#define TAG_HEADING_1  9
+#define TAG_HEADING_2  10
+#define TAG_HEADING_3   11
+
+#define TAG_ITEM_LIST   12
+#define TAG_LIST_ITEM   13 
+
+struct TagStructT
+{
+       char* start; // tag that starts style
+       char* end;   // tag that finishes style
+};
+
+// tag array
+typedef TagStructT* MarkupTagsT;
+
+// returns array of TagStructT with tag strings for HTML
+
+MarkupTagsT get_HTML_markup_tags();
+
+// MarkupTagsT get_PostScript_markup_tags();
+// MarkupTagsT get_Latex_markup_tags();
+
+#endif
\ No newline at end of file
diff --git a/utils/HelpGen/include/scriptbinder.h b/utils/HelpGen/include/scriptbinder.h
new file mode 100644 (file)
index 0000000..17c52ff
--- /dev/null
@@ -0,0 +1,377 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SCRIPTBINDER_G__
+#define __SCRIPTBINDER_G__
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <vector>
+
+       #ifdef WIN32
+               #include <bstring.h>
+       #else
+               #include <strclass.h>
+               #include <string.h>
+       #endif
+
+#else
+
+       #include "wxstlvec.h"
+       #include "wx/string.h"
+       
+       // FIXME:: dirty!
+       typedef wxString string;
+
+#endif
+
+#ifndef ASSERT
+// assert yourself
+#define ASSERT(x) if (!(x) ) throw;
+#endif
+
+#include "markup.h"
+
+// just another portable stream class...
+
+class ScriptStream
+{
+protected:
+       char*  mpBuf;
+       size_t mSize;
+       size_t mCapacity;
+public:
+       ScriptStream();
+       ~ScriptStream();
+
+       void WriteBytes( const void* srcBuf, size_t count );
+
+       ScriptStream& operator<<( const char* str );
+       ScriptStream& operator<<( const string& str );
+       ScriptStream& operator<<( char ch );
+
+       void endl();
+
+       inline char*  GetBuf() { return mpBuf; }
+       inline size_t GetBufSize() { return mSize; }
+
+       // clears current contents of the stream
+       void Reset() { mSize = 0; }
+};
+
+
+class ScriptTemplate;
+
+// used internally by ScriptTemplate
+
+enum TEMPLATE_VARIABLE_TYPES
+{
+       TVAR_INTEGER,
+       TVAR_STRING,
+       TVAR_DOUBLE,
+       TVAR_REF_ARRAY
+};
+
+// helper structures used only by ScriptTemplate
+
+struct TVarInfo
+{
+public:
+       const char*             mName;
+       int                     mType;
+       int                     mOfs;
+
+       TVarInfo( const char* name, int ofs, int varType )
+               : mName(name),
+                 mType( varType ),
+                 mOfs( ofs )
+       {}
+};
+
+struct TArrayInfo : public TVarInfo
+{
+public:
+       int mRefOfs;
+       int mSizeIntOfs;
+       int mObjRefTemplOfs;
+
+       TArrayInfo( const char* name )
+               : TVarInfo( name, 0, TVAR_REF_ARRAY )
+       {}
+};
+
+// stores offset of the given member (of the given class)
+// to (*pOfs), though the use of template classes would have 
+// solved this problem in much clearer fashion
+
+// FOR NOW:: obtaining physical offset of class member
+//           does not appeare to be protable across compilers?
+// FIXME::   +/- 1 problem
+
+#ifdef __UNIX__
+       #define WEIRD_OFFSET 1
+#else
+       #define WEIRD_OFFSET 0
+
+#endif
+
+#define GET_VAR_OFS( className, varName, pOfs )          \
+       {                                                                                                        \
+               int* className::* varPtr;                                                \
+               varPtr = (int* className::*)&className::varName; \
+                                                                                                                \
+               (*pOfs) = int(*(int*)&varPtr)-WEIRD_OFFSET;                                      \
+       }
+
+class ScriptSection;
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef vector<TVarInfo*> TVarListT;
+
+       // container class for sections
+       typedef vector<ScriptSection*> SectListT;
+
+#else
+
+       typedef TVarInfo*      TVarInfoPtrT;
+       typedef ScriptSection* ScriptSectionPtrT;
+
+       typedef WXSTL_VECTOR_SHALLOW_COPY(TVarInfoPtrT) TVarListT;
+
+       // container class for sections
+       typedef WXSTL_VECTOR_SHALLOW_COPY(ScriptSectionPtrT) SectListT;
+
+#endif
+
+// class performs preprocessing of arbitrary scripts,
+// replaces identifiers enclosed in $(..) tag, whith
+// values of the corresponding class member variables
+
+class ScriptTemplate
+{
+protected:
+       // do not use string object here - parsing of
+       // C string can be much faster (in debug v.)
+       char*     mTText; 
+                                     
+
+       TVarListT mVars;
+
+       inline void PrintVar( TVarInfo*  pInfo, 
+                                                 void*       dataObj, 
+                                                 ScriptStream& stm );
+       
+public:
+       ScriptTemplate( const string& templateText );
+       virtual ~ScriptTemplate();
+       
+       bool HasVar( const char* name );
+
+       // Member variables registration methods.
+
+       // NOTE:: GET_VAR_OFS() macro should be used
+       // to get offset of the class member (see #define above)
+       void AddStringVar ( const char* name, int ofs );
+       void AddIntegerVar( const char* name, int ofs );
+       void AddDoubleVar ( const char* name, int ofs );
+
+       void AddObjectRefArray( const char*     name,
+                                                       int                         ofsRefToFirstObj,
+                                   int                     ofsObjSizeInt,
+                                                       int                         ofsObjRefTempl
+                                                 );
+
+       // reads the script, replaces $(..) tags with values
+       // of registered members of dataObj object, and outputs
+       // the result to given text stream
+
+       void PrintScript( void* dataObj, ScriptStream& stm );
+};
+
+class ScriptSection;
+
+// class manages section and aggregated sections of
+// inter-linked documents
+
+class ScriptSection
+{
+protected:
+
+       // NOTE:: "$(NAME)", $(ID), "$(BODY)" and "$(REFLIST)" aree 
+       //        reseved template variables of ScriptSection 
+
+       // the below there members are registered to ScriptTemplate,
+       // GUID within the section tree (numeric)
+
+       ScriptSection*  mpParent;
+       string          mId;   // $(ID)      
+       string          mName; // $(NAME)      
+       string          mBody; // $(BODY)
+
+       // NULL, if this section is not aggregated anywhere
+
+       SectListT       mSubsections; // aggregated sectons
+       SectListT       mReferences;  // registered as $(REFLIST)
+
+       bool            mAutoHide;  // see autoHide arg, in constructor
+       bool            mSortOn;    // TRUE, if sort subsectons by naem
+
+       // tempalte for this section
+       ScriptTemplate* mpSectTempl;
+
+       // template used for links (or references) to this section
+       ScriptTemplate* mpRefTempl;
+       
+       // do not call destructor of this object,
+       // call RemoveRef() instead
+       int             mRefCount;
+
+       static int      mIdCounter;  // generator of GUIDs
+
+       // fields registered and used by ScriptTemplate object
+       void*           mRefFirst;
+       int             mArrSize;
+
+protected:
+       virtual void AddRef();
+       virtual void RemoveRef();
+       void DoRemoveEmptySections(int& nRemoved, SectListT& removedLst);
+       void DoRemoveDeadLinks( SectListT& removedLst);
+
+public:
+
+       // NOTE:: pass NULL to certain template, if your sure
+       //        this kind of template will never be used,
+       //        e.g. if section is contained but never referrenced,
+       //        then pReferenceTemplate can be NULL
+
+       // if autoHide option is TRUE, the section will be automatically
+       // collapsed (not shown) if it doesn't contain any references
+       // to other sections (e.g. could be usefull for autoamically 
+       // hiding empty index-sections). 
+
+       ScriptSection( const string&   name = "",
+                                  const string&   body = "",
+                                  ScriptTemplate* pSectionTemplate   = NULL,
+                                  ScriptTemplate* pReferenceTemplate = NULL,                      
+                                  bool            autoHide           = FALSE,
+                                  bool            sorted             = FALSE
+                                );
+
+       // calls RemoveRef() to all aggreagated sections first,
+       // then to all referenced section - this way all
+       // sections (even not aggregated ones) become "garbage-collected"
+
+       // NOTE:: do not call destructor directlly, call RemoveRef()
+       //        instead
+       virtual ~ScriptSection();
+
+
+       // if addToReferencesToo is TRUE, section is aggregated and
+       // also added to reference list of this section
+
+       void AddSection( ScriptSection* pSection, bool addToReferencesToo = FALSE );
+
+       // add cross-reference to this given section
+       void AddReference( ScriptSection* pReferredSection );
+
+       // subsection may be given of variable depth level,
+       // e.g. "publications/reviews/software"
+
+       ScriptSection* GetSubsection( const char* name );
+
+       // returns list aggregated sections
+       SectListT& GetSubsections();
+
+       // binds reserved template names ( $(..) ) to member 
+       // vairalbes in the ScriptSection class, should be called 
+       // to initialize each user-code provided script template
+
+       static void RegisterTemplate( ScriptTemplate& sectionTempalte );
+
+       // prints out section tree to the stream, starting from
+       // this section as a root node
+       virtual void Print( ScriptStream& stm );        
+
+       // searches empty sections which has autoHide == TRUE,
+       // and colapses them (this method should be called )
+       // on the root-section of the sections tree
+
+       // NOTE:: does not work properly, yet!
+       void RemoveEmptySections();
+};
+
+// base class for documnetation generators
+// (allows user code set up target script type,
+//  independently of documentation type)
+
+class DocGeneratorBase
+{
+protected:
+       MarkupTagsT    mTags;
+
+       // override this method to do some post processing
+       // after generation of document, or even write some
+       // data into output stream, before the section tree
+       // is flushed into it.
+
+       // return FALSE, if something has gone wrong and
+       // document cannot be saved now
+
+       virtual bool OnSaveDocument( ScriptStream& stm ) 
+               { return 1; }
+
+       // override this method to provide reference to
+       // the top section of the document (used as default
+       // starting section when saving a document)
+
+       virtual ScriptSection* GetTopSection() 
+               { return 0; }
+
+public:
+
+       DocGeneratorBase() 
+               : mTags(0) // no defaul script
+       {}
+
+       // dectrouctors of polymorphic classes SHOULD be virtual
+       virtual ~DocGeneratorBase() {}
+
+       // returns tags, being used for specific target script
+       MarkupTagsT GetScriptMarkupTags() { return mTags; }
+
+       // sets tag array for specific script
+
+       // NOTE:: Why virtual? since approach with MarkupTagsT is 
+       //        "flowless" only in theory. Overriding this method
+       //        allows document generators to check the type of the
+       //        target script, and perhaps make some modifications
+       //        to generator's tamplates, to match the specific script
+
+       virtual void SetScriptMarkupTags( MarkupTagsT tags )
+               { mTags = tags; }
+
+       // seves document to file starting from the root-node of
+       // the document (provided by GetTopSection() method),
+       // or from "pFromSection" if it's not NULL.
+
+       // fopenOptions arg. is string passed to fopen() method,
+       // returns TRUE, if saving was successfull
+
+       virtual bool SaveDocument( const char*    fname, 
+                                                          const char*    fopenOptions = "w",
+                                                          ScriptSection* pFromSection = NULL
+                                                          );
+                    
+};
+
+#endif
diff --git a/utils/HelpGen/include/sourcepainter.h b/utils/HelpGen/include/sourcepainter.h
new file mode 100644 (file)
index 0000000..333059a
--- /dev/null
@@ -0,0 +1,104 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SOURCEPAINTER_G__
+#define __SOURCEPAINTER_G__
+
+#ifndef ASSERT
+#define ASSERT(x) if (!(x)) throw
+#endif
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <vector.h>
+       typedef vector<int> SPBlockListT;
+
+       #ifdef WIN32
+               #include <bstring.h>
+       #else
+               #include <strclass.h>
+               #include <string.h>
+       #endif
+#else
+
+       #include "wxstlvec.h"
+       #include "wx/string.h"
+       
+       // FIXME:: dirty!
+       #define  string wxString
+
+       typedef WXSTL_VECTOR_SHALLOW_COPY(int) SPBlockListT;
+
+#endif
+
+#include "markup.h" // import MarkupTagsT definition
+
+// "colored" codes for highlighted blocks
+
+#define RANK_BLACK  0 // common source fragments
+#define RANK_BLUE   1 // basic types
+#define RANK_RED    2 // reserved words
+#define RANK_GREEN  3 // comments
+
+// colored block description format :
+// int( ( rank << 16 ) | ( source_range_len ) )
+
+
+// FOR NOW:: no lagnguage-map selection
+
+// source code syntax heighlighter (CPP+JAVA+VB+PASCAL)
+
+class SourcePainter
+{
+protected:
+       string            mResultStr;
+       SPBlockListT  mBlocks;
+       bool          mCollectResultsOn;
+
+       // state variables
+       bool        mIsInComment;
+       bool        mCommentIsMultiline;
+public:
+
+       // assembleResultString == TRUE - instructs painter
+       // to collect each chunk of srouce passed to ProcessSource(),
+       // so that results cann be futher obtained in a single string 
+       // instead of vector of block descriptions
+
+       SourcePainter( bool assembleResultString = TRUE );
+       virtual ~SourcePainter() {}
+
+       // can be called multiple times (e.g. on each source line)
+       void ProcessSource( char* src, int srcLen );
+
+       // method, for manually adjusting state of source painter
+       void SetState( bool isInComment,
+                          bool commentIsMultiline );
+
+       // reinitializes object - clears results of previouse processing
+       void Init( bool assembleResultString = TRUE );
+
+       // generates string of highlighted source for the scipting
+       // language given by "tags" argument
+       
+       virtual void GetResultString(string& result, MarkupTagsT tags);
+
+       // returns vector of block descriptors, see SPBlockListT definition
+       // (block descriptors can be used for fast custom hightlighted text generation)
+
+       SPBlockListT& GetBlocks();
+
+       // NOTE:: static method
+       // returns if the given word is a reserved word or basic type identifier
+       static bool IsKeyword( char* word, int wordLen );
+};
+
+#endif
diff --git a/utils/HelpGen/include/srcparser.h b/utils/HelpGen/include/srcparser.h
new file mode 100644 (file)
index 0000000..39ad1c3
--- /dev/null
@@ -0,0 +1,736 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     To provide a simple _framework_
+//              for series of source code parsers with
+//              compatible interfaces
+// Author:      Aleksandras Gluchovas
+// Modified by: AG on 28/12/98
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SRCPARSER_G__
+#define __SRCPARSER_G__
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <vector>
+
+       #ifdef WIN32
+       #include <bstring.h>
+       #else
+
+       #include <strclass.h>
+       #include <string.h>
+
+       #endif
+
+#else
+
+       #include "wx/string.h"
+       #include "wxstlvec.h"
+
+       // FOR NOW:: quick n' dirty:
+
+       #define  string wxString
+
+#endif
+
+#include "markup.h" // markup tags used in spOperator::GetFullName()
+
+// context class list in "inside-out" order :
+
+class spContext;
+
+class spParameter;
+class spAttribute;
+class spOperation;
+class spEnumeration;
+class spTypeDef;
+class spPreprocessorLine;
+class spClass;
+class spNameSpace;
+class spFile;
+
+// source context visibilities
+enum SRC_VISIBLITY_TYPES
+{
+       SP_VIS_PUBLIC,
+       SP_VIS_PROTECTED,
+       SP_VIS_PRIVATE
+};
+
+// class types
+enum SP_CLASS_TYPES
+{
+       SP_CLTYPE_CLASS,
+       SP_CLTYPE_TEMPLATE_CLASS,
+       SP_CLTYPE_STRUCTURE,
+       SP_CLTYPE_UNION,
+       SP_CLTYPE_INTERFACE
+};
+
+// inheritance types
+enum SP_INHERITANCE_TYPES
+{
+       SP_INHERIT_VIRTUAL,
+       SP_INHERIT_PUBLIC,
+       SP_INHERIT_PRIVATE
+};
+
+// proprocessor definitions types (specific to C++ code)
+
+enum SP_PREP_DEFINITION_TYPES
+{
+       SP_PREP_DEF_DEFINE_SYMBOL,
+       SP_PREP_DEF_REDEFINE_SYMBOL,
+       SP_PREP_DEF_INCLUDE_FILE,
+       SP_PREP_DEF_OTHER
+};
+
+// common context types
+
+#define SP_CTX_UNKNOWN       0x000
+#define        SP_CTX_FILE          0x001
+#define        SP_CTX_NAMESPACE     0x002
+#define        SP_CTX_CLASS         0x004
+#define SP_CTX_TYPEDEF       0x008
+#define SP_CTX_PREPROCESSOR  0x010
+#define SP_CTX_ENUMERATION   0x020
+#define        SP_CTX_ATTRIBUTE     0x040
+#define        SP_CTX_OPERATION     0x080
+#define        SP_CTX_PARAMETER     0x100
+
+// other (custom) context codes may be defined elsewere, however they should
+// not clash with above codes for common type and also should not
+// exceed 16-bits of in value 
+
+// masks all context types (up to 16 custom context can be defined)
+
+#define SP_CTX_ANY           0xFFFF
+
+class spComment;
+
+
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       // context members
+       typedef vector<spContext*> MMemberListT;
+       // comments list
+       typedef vector<spComment*> MCommentListT;
+       // list of parameters
+       typedef vector<spParameter*> MParamListT;
+       // string list
+       typedef vector<string>     StrListT;
+
+#else
+
+       typedef spContext*   spContextPtrT;
+       typedef spComment*   spCommentPtrT;
+       typedef spParameter* spParameterPtrT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY(spContextPtrT)   MMemberListT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY(spCommentPtrT)   MCommentListT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY(spParameterPtrT) MParamListT;
+       typedef WXSTL_VECTOR_SHALLOW_COPY(string)          StrListT;
+
+#endif;
+// base class for all visitors of source code contents
+
+class spVisitor 
+{
+protected:
+       bool mSiblingSkipped;
+       bool mChildSkipped;
+       int  mContextMask;
+
+       spContext* mpCurCxt;
+
+public:
+       // methods invoked by context
+
+       // method invoked from user's controling code
+       // to visit all nodes staring at the given context.
+       // Content is sorted if requrired, see comments 
+       // spClass on sorting the class members
+
+       void VisitAll( spContext& atContext,
+                                  bool sortContent = TRUE
+                                );
+
+       // methods invoked by visitor
+
+       // goes to the next context in the outter scope
+       // NOTE:: should not be invoked more than once while
+       //        visiting certain context
+
+       void SkipSiblings();
+
+       // prevents going down into the contexts contained by
+       // the current context
+       // NOTE:: the same as above
+
+       void SkipChildren();
+
+       // can be called only in from visiting procedure
+       void RemoveCurrentContext();
+
+       // method enables fast filtered traversal
+       // of source content, e.g. collecting only classes,
+       // or only global functions
+
+       // arg. context - can contain combination of contexts concatinated
+       //           with bitwise OR, e.g. SP_CTX_CLASS | SP_CTX_NAMESPACE
+       //
+       // method can be invoked from the user's controling as well as
+       // from within the visting procedure
+
+       void SetFilter( int contextMask );
+
+       // methods should be implemneted by specific visitor:
+
+       // NOTE:: Do not confuse visiting with parsing, first
+       //        the source is parsed, and than can be visited
+       //        multiple times by variouse visitors (there can
+       //        be more the one visitor visiting content at a time)
+
+       virtual void VisitFile( spFile& fl ) {}
+
+       virtual void VisitNameSpace( spNameSpace& ns ) {}   
+
+       virtual void VisitClass( spClass& cl ) {}
+
+       virtual void VisitEnumeration( spEnumeration& en ) {}
+
+       virtual void VisitTypeDef( spTypeDef& td ) {}
+
+       virtual void VisitPreprocessorLine( spPreprocessorLine& pd ) {}
+
+       virtual void VisitAttribute( spAttribute& attr ) {}
+
+       virtual void VisitOperation( spOperation& op ) {}
+
+       virtual void VisitParameter( spParameter& param ) {}
+
+       virtual void VisitCustomContext( spContext& ctx ) {}
+};
+
+// stores one section of comments,
+// multiple sections can be put to geather
+// and attached to some context
+
+class spComment
+{
+public:
+       string mText;
+       bool   mIsMultiline; // multiline comments ar those with /**/'s
+
+       // TRUE, if these was an empty empty
+       // line above single line comment
+
+       bool   mStartsPar;   
+                            
+public:
+
+       bool    IsMultiline() const;
+       bool    StartsParagraph() const;
+
+       string& GetText();
+
+       // contstant version of GetText()
+       string  GetText() const;
+};
+
+// abstract base class for common (to most languages) code 
+// contexts (constructs), e.g file, namespace, class, operation, 
+// etc
+
+class spContext
+{
+protected:
+       // "linked" list of comments belonging to this context
+       MCommentListT mComments;
+       
+       // NULL, if this is file context
+       MMemberListT   mMembers;
+
+       // NULL, if this is top-most context
+       spContext*    mpParent; 
+
+       // points to context object, where the this context
+       // was originally declared, meaning that this object
+       // is redeclaration (or if in the case of operation
+       // this context object most probably referres to the
+       // implemnetation in .cpp file for example)
+
+       // is NULL, if this object referres to the first occurence
+       // of the context
+
+       spContext*    mpFirstOccurence;
+
+       // used, to avoid excessive sorting of context's agreggates
+       bool          mAlreadySorted;
+
+public:
+
+       // source line number, (-1) if unknown
+       int           mSrcLineNo;
+
+       // offset of context in the source file, (-1) if unknown
+       int           mSrcOffset;
+
+       // lentgh of the context in characters, (-1) if unknown
+       int           mContextLength;
+
+       // source line number, in which this cotext ends, (-1) if unknown
+       int           mLastScrLineNo;
+
+       // fields are valid, if the may contain other contexts nested inside
+       int           mHeaderLength;
+       int           mFooterLength;
+
+       // zero-based index of the first character of
+       // this context in the source line, (-1) if unknown
+       int           mFirstCharPos;
+       
+       // zero-based index of the first character of
+       // this context in the last source line of this context, (-1) if unknown
+       int           mLastCharPos;
+
+       // see SRC_VISIBLITY_TYPES enumeration
+       int           mVisibility;
+
+       // TRUE, if context does not really exist in the source
+       //       but was created by external tools (e.g. forward engineering)
+
+       bool         mIsVirtualContext;
+       bool         mVirtualContextHasChildren;
+       
+       // body of the context in case (mIsVirtual == TRUE)
+       string       mVirtualContextBody;
+       string       mVittualContextFooter;
+
+       // e.g. can be used by documentation generator to store
+       // reference to section object
+       void*         mpUserData;
+
+public:
+       // universal identifier of the context (e.g. class name)
+       string        mName;    
+
+public:
+       // default constructor
+       spContext();
+
+       // automatically destorys all aggregated contexts
+       // (thus, it's enought to call destructor of root-context)
+       virtual ~spContext();
+
+       // see mUererData member;
+       void* GetUserData() { return mpUserData; }
+
+       // sets untyped pointer to user data
+       void SetUserData( void* pUserData )
+               { mpUserData = pUserData; }
+
+       // searches the whole context tree for the cotnexts
+       // which match given masks, pust results into lst array
+       void GetContextList( MMemberListT& lst, int contextMask );
+
+       // used by default visitor's implementation
+       bool IsSorted();
+
+       /*** forward/reverse ingineering fecilities ***/
+
+       bool PositionIsKnown();
+
+       bool IsVirtualContext();
+       
+       bool VitualContextHasChildren();
+
+       void SetVirtualContextBody( const string& body, 
+                                                           bool  hasChildren = FALSE,
+                                                       const string& footer = "" );
+
+       string GetVirtualContextBody();
+       string GetFooterOfVirtualContextBody();
+
+       // can be overriden by top-level context classes
+       // to find-out ot the source-fragment of this
+       // context using it's position information 
+       virtual string GetBody( spContext* pCtx = NULL );
+
+       virtual string GetHeader( spContext* pCtx = NULL );
+
+       // TRUE, if there is at least one entry
+       // in the comment list of this context
+       bool HasComments();
+       inline MCommentListT& GetCommentList()
+               { return mComments; }
+
+       // should be overriden, if the context supports sorting
+       // of it's members
+       virtual void SortMembers() {}
+
+       // returns identifier of this context
+       inline string& GetName() { return mName; }
+
+       // returns -1, if souce line # is unknow
+       inline int GetSourceLineNo() { return mSrcLineNo; }
+
+       // see comments on mpFirstOccurence member variable
+       bool IsFirstOccurence();
+       spContext* GetFirstOccurence();
+
+       // returns not-NULL value if this context
+       // is aggregated by another cotnext
+       spContext* GetOutterContext();
+
+       // perhaps more intuitive alias for `GetOutterContext()'
+       inline spContext* GetParent() { return mpParent; }
+
+       bool HasOutterContext();
+
+       // add one aggregate (or child) into this context
+       void AddMember ( spContext* pMember );
+       MMemberListT& GetMembers();
+
+       // append comment to the comment list decribing
+       // this context
+       void AddComment( spComment* pComment );
+
+       // returns NULL, if the context with the given
+       // name and type is not contained by this context
+       // and it's children. Children's children are not
+       // searched recursivelly if searchSubMembers is FALSE
+
+       spContext* FindContext( const string& identifier,
+                                   int   contextType      = SP_CTX_ANY,
+                                                       bool  searchSubMembers = TRUE
+                                 );
+
+       // removes this context from it's parent
+       // (NOTE:: context should have an outter cotnext
+       //  to when this method is called, otherwise removal
+       //  will result assertion failure)
+       void RemoveThisContext();
+
+       // returns TRUE, if this object is aggregated in the file
+       bool IsInFile();
+
+       // TRUE, if outter context is a namespace
+       bool IsInNameSpace();
+
+       // TRUE, if outter context is a class
+       bool IsInClass();
+
+       // TRUE, if outter cotext is an operation (TRUE for "spParameter"s)
+       bool IsInOperation();
+
+    // TRUE if the context is public
+    bool IsPublic() const { return mVisibility == SP_VIS_PUBLIC; }
+
+       // NOTE:: method returns not the type of this object
+       //                but the file/namespace/class/operation or file in which this
+       //                attribute is contained. First, check for the type of
+       //        context using the above method. 
+       
+       //                Requiering container which does not exist, will result
+       //        in assertion failure
+
+       spClass&     GetClass(); 
+       spFile&      GetFile();
+       spNameSpace& GetNameSpace();
+       spOperation& GetOperation();
+
+       // each new context should override this method
+       // to return it's specific type 
+       virtual int GetContextType() { return SP_CTX_UNKNOWN; }
+
+       // perhaps more intuitive short-cut
+       inline int GetType() { return GetContextType(); }
+
+       // derived classes override this to invoke VisitXXX method
+       // which corresponds to the class of specific context,
+       // - this is what the "Visitor" pattern told us ^)
+
+       // if method is not overriden, then it's probably user-defined
+       // custom context
+
+       virtual void AcceptVisitor( spVisitor& visitor )
+       
+               { visitor.VisitCustomContext( *this );  };
+
+       // called by visitors, to remove given subcontext 
+       // of this context object
+       void RemoveChild( spContext* pChild );
+
+       void RemoveChildren();
+
+       spContext* GetEnclosingContext( int mask = SP_CTX_ANY );
+};
+
+// stores information about single argument of operation
+
+class spParameter : public spContext
+{
+public:
+       // type of argument (parameter)
+       string mType;
+
+       // "stringified" initial value
+       string mInitVal;
+
+public:
+       virtual int GetContextType() { return SP_CTX_PARAMETER; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitParameter( *this ); }
+};
+
+
+// stores information about member(or global) variable
+
+class spAttribute : public spContext
+{
+public:
+       // type of the attribute
+       string mType;
+
+       // it's initial value
+       string mInitVal;
+
+       // constantness
+       bool   mIsConstant;
+public:
+
+       virtual int GetContextType() { return SP_CTX_ATTRIBUTE; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitAttribute( *this ); }
+};
+
+class spOperation : public spContext
+{
+public:
+       // type of return value
+       string      mRetType;
+
+       // argument list
+       //MParamListT mParams;
+
+       // TRUE, if operation does not modify
+       // the content of the object
+       bool        mIsConstant;
+
+       // flag, specific to C++
+       bool        mIsVirtual;
+
+       // TRUE, if definition follows the declaration immediatelly
+       bool        mHasDefinition;
+
+       // scope if any (e.g. MyClass::MyFunction(), scope stirng is "MyClass" )
+       // usually found along with implementation of the method, which is now skipped
+
+       string      mScope;
+
+public:
+       spOperation();
+
+       // returns full declaration of the operations
+       // (ret val., identifier, arg. list),
+
+       // arguments are marked up with italic,
+       // default values marked up with bold-italic,
+       // all the rest is marked as bold
+
+       // NOTE:: this method may be overriden by class
+       //        specific to concrete parser, to provide
+       //        language-dependent reperesnetation of
+       //        operation and it's argumetn list
+       //
+       // the default implementation outputs name in
+       // C++/Java syntax
+
+       virtual string GetFullName(MarkupTagsT tags);
+
+       virtual int GetContextType() { return SP_CTX_OPERATION; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitOperation( *this ); }
+
+};
+
+// stores infromation about preprocessor directive
+
+class spPreprocessorLine : public spContext 
+{
+
+public:
+
+       // prepocessor statement including '#' and
+       // attached multiple lines with '\' character
+       string mLine;               
+
+       int    mDefType; // see SP_PREP_DEFINITION_TYPES enumeration 
+
+public:
+
+       virtual int GetContextType() { return SP_CTX_PREPROCESSOR; }
+
+       virtual int GetStatementType() { return mDefType; }
+
+       string CPP_GetIncludedFileNeme();
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitPreprocessorLine( *this ); }
+};
+
+// stores information about the class 
+
+class spClass : public spContext
+{
+public:
+       // list of superclasses/interfaces
+       StrListT     mSuperClassNames;
+
+       // see SP_CLASS_TYPES enumeration
+       int          mClassSubType;    
+
+       // see SP_INHERITANCE_TYPES enumeration
+       int          mInheritanceType;
+
+       // valid if mClassSubType is SP_CLTYPE_TEMPLATE_CLASS
+       string       mTemplateTypes;
+
+       // TRUE, if it's and interface of abstract base class
+       bool         mIsAbstract;
+
+public:
+
+       // sorts class members in the following order:
+       // 
+       // (by "privacy level" - first private, than protected, public)
+       //
+       //     within above set
+       //
+       //       (by member type - attributes first, than methods, nested classes)
+       //
+       //          within above set
+       //
+       //             (by identifier of the member)
+       
+       virtual void SortMembers();
+
+       virtual int GetContextType() { return SP_CTX_CLASS; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitClass( *this ); }
+};
+
+// stores information about enum statement
+
+class spEnumeration  : public spContext
+{
+public:
+       string mEnumContent; // full-text content of enumeration
+
+public:
+       virtual int GetContextType() { return SP_CTX_ENUMERATION; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitEnumeration( *this ); }
+};
+
+class spTypeDef  : public spContext
+{
+public:
+       // the original type which is redefined
+       // by this type definition
+       string mOriginalType;
+
+public:
+       virtual int GetContextType() { return SP_CTX_TYPEDEF; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitTypeDef( *this ); }
+};
+
+// NOTE:: files context may be put to other
+//        file context, resulting in a collection
+//        of parsed file contexts, with a virtual "superfile"
+
+class spFile : public spContext
+{
+public:
+       // since file name cannot be determined from
+       // source code, filling in this field is optional
+       string mFileName; 
+
+public:
+       virtual int GetContextType() { return SP_CTX_FILE; }
+
+       virtual void AcceptVisitor( spVisitor& visitor ) 
+               { visitor.VisitFile( *this ); }
+};
+
+//TODO:: comments.
+
+class SourceParserPlugin
+{
+public:
+       virtual bool CanUnderstandContext( char* cur, char* end, spContext* pOuttterCtx ) = 0;
+       virtual void ParseContext( char* start, char*& cur, char* end, spContext* pOuttterCtx ) = 0;
+};
+
+// abstract interface for source parsers
+// which can output parsing results in the
+// form of context-tree, where each node
+// should be derivative of spContext, (see
+// above classes)
+
+class SourceParserBase 
+{
+private:
+       // auto-resizing file buffer, created in ParseFile()
+       // to reuse large heap block for multiple parsings
+       
+       char* mpFileBuf; 
+       int   mFileBufSz;
+
+protected:
+       SourceParserPlugin* mpPlugin;
+                
+protected:
+       // value is set in the derived parser classes
+       int mParserStatus;
+
+public:
+       SourceParserBase();
+       virtual ~SourceParserBase();
+
+       // loads entier source file(as text) into memory,
+       // and passes it's contents to ParseAll() method,
+       // memory occupied by source text is released after
+       // parsing is done
+       //
+       // (NOTE:: this is the default implementation),
+
+       virtual spFile* ParseFile( const char* fname );
+
+       // should returns the root-node of the created context tree
+       // (user is responsible for releasing it from the heep)
+       // "end" should point to the (last character + 1) of the 
+       // source text area
+
+       virtual spFile* Parse( char* start, char* end ) = 0;
+
+       // returns parser "status word" (specific to concrete parser)
+       int GetParserStatus() { return mParserStatus; }
+
+       void SetPlugin( SourceParserPlugin* pPlugin );
+};
+
+#endif
diff --git a/utils/HelpGen/include/wxstlac.h b/utils/HelpGen/include/wxstlac.h
new file mode 100644 (file)
index 0000000..62b4ba4
--- /dev/null
@@ -0,0 +1,664 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSTLAC_G__
+#define __WXSTLAC_G__
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <memory.h>
+#include <limits.h>
+#include <new.h>
+
+
+// the below macro used internally (see actual interface after this macro)
+
+// arguments:
+//
+//         ARG_IS_UNIQUE
+//             ASSOC_CONT_CLASS_NAME
+//
+//         ARG_VALUE_TYPE
+//      ARG_KEY_TYPE
+//      ARG_ACTUAL_VALUE_TYPE
+//      
+//      _KEY_NAME
+//      _VALUE_NAME
+//
+//             _X_KEY_NAME
+//             _X_VALUE_NAME
+//
+//      _INSERT_METHOD_DEFINITION
+
+#define __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE, \
+FUNCTOR,\
+ASSOC_CONT_CLASS_NAME, \
+ARG_VALUE_TYPE, \
+ARG_KEY_TYPE, \
+ARG_ACTUAL_VALUE_TYPE, \
+_KEY_NAME, \
+_VALUE_NAME, \
+_X_KEY_NAME, \
+_X_VALUE_NAME, \
+_INSERT_METHOD_DEFINITION \
+) class \
+ASSOC_CONT_CLASS_NAME\
+{\
+protected:\
+\
+public:\
+       typedef ARG_VALUE_TYPE        value_type;\
+       typedef ARG_KEY_TYPE          key_type;\
+       typedef ARG_ACTUAL_VALUE_TYPE actual_value_type;\
+\
+       typedef value_type*                       pointer;\
+       typedef value_type&                       reference;\
+\
+       typedef const value_type&         const_reference;\
+\
+       typedef FUNCTOR                           key_compare;\
+       typedef key_compare           Compare;\
+\
+protected:\
+\
+       struct tree_node \
+       {\
+               tree_node*  mpParent;\
+               tree_node*  mpLeft;\
+               tree_node*  mpRight;\
+\
+               value_type  mData;\
+       };\
+\
+       typedef tree_node* node_ref_type;\
+\
+       node_ref_type   mpRoot;\
+       node_ref_type   mpLeftMost;\
+       node_ref_type   mpRightMost;\
+\
+       node_ref_type   mpFreeListHead;\
+       int             mKeyIsUnique;\
+\
+       key_compare     mCmpFunctorObj;\
+\
+public:\
+\
+       static inline node_ref_type next( node_ref_type pNode )\
+       {\
+               if ( pNode->mpRight ) \
+               {\
+                       pNode = pNode->mpRight;\
+\
+                       while ( pNode->mpLeft ) pNode = pNode->mpLeft;\
+\
+                       return pNode;\
+               }\
+               else\
+               if ( pNode->mpParent )\
+               {\
+                       if ( pNode == pNode->mpParent->mpLeft )\
+\
+                               return pNode->mpParent;\
+\
+                       pNode = pNode->mpParent;\
+\
+                       node_ref_type prevNode = pNode;\
+                       pNode = pNode->mpParent;\
+\
+                       while(pNode)\
+                       {\
+                               if ( pNode->mpRight &&\
+                                        pNode->mpRight != prevNode\
+                                  ) return pNode;\
+\
+                               prevNode = pNode;\
+                               pNode= pNode->mpParent;\
+                       }\
+\
+                       return 0;\
+               }\
+               else\
+                       return 0;\
+       }\
+\
+       static inline node_ref_type prev( node_ref_type pNode )\
+       {\
+               if ( pNode->mpLeft ) \
+               {\
+                       pNode = pNode->mpLeft;\
+\
+                       while ( pNode->mpRight ) pNode = pNode->mpRight;\
+\
+                       return pNode;\
+               }\
+               else\
+               if ( pNode->mpParent )\
+               {\
+                       if ( pNode == pNode->mpParent->mpRight )\
+                               return pNode->mpParent;\
+\
+                       pNode = pNode->mpParent;\
+\
+                       node_ref_type prevNode = pNode;\
+                       pNode = pNode->mpParent;\
+\
+                       while(pNode)\
+                       {\
+                               if ( pNode->mpLeft &&\
+                                        pNode->mpLeft != prevNode\
+                                  ) return pNode;\
+\
+                               prevNode = pNode;\
+                               pNode= pNode->mpParent;\
+                       }\
+\
+                       return 0;\
+               }\
+               else \
+                       return 0;\
+       }\
+\
+protected:\
+\
+       inline int are_equel( const key_type& x, const key_type& y )\
+       {\
+               return ( !mCmpFunctorObj(x,y) && !mCmpFunctorObj(y,x) );\
+       }\
+\
+       inline int is_less( const key_type& x, const key_type& y )\
+       {\
+               return mCmpFunctorObj(x,y);\
+       }\
+\
+       static inline const actual_value_type& value( node_ref_type pNode )\
+       {\
+               return pNode->_VALUE_NAME;\
+       }\
+\
+       static inline const key_type& key( node_ref_type pNode )\
+       {\
+               return pNode->_KEY_NAME;\
+       }\
+\
+       inline node_ref_type AllocNode() \
+       { \
+               if ( mpFreeListHead ) \
+               {\
+                       node_ref_type pFreeNode = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpLeft;\
+\
+                       return pFreeNode;\
+               }\
+               else\
+               {\
+                       char* pHeapBlock = new char[sizeof(tree_node)];\
+\
+                       return (node_ref_type)pHeapBlock;\
+               }\
+       }\
+\
+       inline void DestroyFreeList()\
+       {\
+               while ( mpFreeListHead )\
+               {\
+                       node_ref_type tmp = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpLeft;\
+\
+                       delete [](char*)tmp;\
+               }\
+       }\
+\
+       inline void RecycleNode( node_ref_type pNode ) \
+       {\
+               pNode->mpLeft = mpFreeListHead;\
+               mpFreeListHead = pNode;\
+       }\
+\
+       inline node_ref_type do_insert(const value_type& x = value_type() )\
+       {\
+               node_ref_type pNewNode = AllocNode();\
+\
+               pNewNode->mpParent = \
+                       pNewNode->mpLeft =\
+                               pNewNode->mpRight = 0;\
+\
+           node_ref_type pCurrent = mpRoot;\
+               node_ref_type pParent = 0;\
+    \
+               while (pCurrent) \
+               {\
+                       if ( mKeyIsUnique && are_equel( _X_KEY_NAME, value(pCurrent) ) )\
+                       {\
+                               RecycleNode(pNewNode);\
+                               return 0;\
+                       }\
+\
+                       pParent = pCurrent;\
+\
+                       pCurrent = is_less( _X_KEY_NAME, value(pCurrent) ) \
+                               ? pCurrent->mpLeft \
+                               : pCurrent->mpRight;\
+               }\
+    \
+               pNewNode->mpParent = pParent;\
+\
+           if(pParent)\
+\
+                       if( is_less(_X_KEY_NAME, value(pParent) ) )\
+            \
+                               pParent->mpLeft = pNewNode;\
+                       else\
+                               pParent->mpRight = pNewNode;\
+                       else\
+                               mpRoot = pNewNode;\
+\
+               new ( &pNewNode->_KEY_NAME   ) key_type(_X_KEY_NAME);\
+               new ( &pNewNode->_VALUE_NAME ) actual_value_type(_X_VALUE_NAME);\
+\
+               if ( prev(pNewNode) == 0 ) mpLeftMost = pNewNode;\
+               if ( next(pNewNode) == 0 ) mpRightMost = pNewNode;\
+\
+               return pNewNode;\
+       }\
+\
+       friend class iterator;\
+\
+public:\
+\
+       class iterator;\
+       class const_iterator;\
+\
+       class iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class CONT_CLASS_NAME;\
+               friend class const_iterator;\
+               friend class const_reverse_iterator;\
+\
+               inline iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               inline iterator() {}\
+               inline int operator==( const iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               inline int operator!=( const iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const iterator& operator=( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+                       return *this;\
+               }\
+\
+               inline const iterator& operator--() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return *this;\
+               }\
+\
+               inline iterator operator--(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline const iterator& operator++() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return *this;\
+               }\
+\
+               inline iterator operator++(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline reference operator*() const { return mpNode->mData; }\
+       };\
+\
+\
+       class const_iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class CONT_CLASS_NAME;\
+               friend class const_reverse_iterator;\
+\
+               inline const_iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               inline const_iterator() {}\
+\
+               inline int operator==( const const_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               inline int operator!=( const const_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline const_iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const_iterator( const const_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const const_iterator& operator=( const const_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+                       return *this;\
+               }\
+\
+               inline const const_iterator& operator--() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator--(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::prev(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline const const_iterator& operator++() \
+               {\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator++(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = ASSOC_CONT_CLASS_NAME::next(mpNode);\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+public:\
+\
+       inline ASSOC_CONT_CLASS_NAME( key_compare cmpFunctorObj = key_compare(),\
+                                                                 int keyIsUnique = ARG_IS_UNIQUE )\
+                       : mpFreeListHead( 0 ),\
+                         mKeyIsUnique( keyIsUnique ),\
+                         mCmpFunctorObj( cmpFunctorObj )\
+       {\
+               mpLeftMost = 0;\
+               mpRightMost = 0;\
+               mpRoot = 0;\
+       }\
+\
+       inline ~ASSOC_CONT_CLASS_NAME() \
+       { \
+               erase( begin(), end() ); \
+\
+               DestroyFreeList();\
+       }\
+\
+       inline iterator begin() { return mpLeftMost; }\
+       inline iterator end()   { return 0; }\
+\
+       inline const_iterator begin() const { return mpLeftMost; }\
+       inline const_iterator end()   const { return 0; }\
+\
+       inline iterator lower_bound( const key_type& x )\
+       { \
+               node_ref_type pCurrent = mpRoot;\
+    \
+               while( pCurrent )\
+               {\
+                       node_ref_type pParent = pCurrent;\
+\
+                       if( are_equel( x, key(pCurrent) ) )\
+                               \
+                               return (pCurrent);\
+                       else\
+                               pCurrent = is_less( x, key(pCurrent) ) \
+                                       ? pCurrent->mpLeft \
+                                       : pCurrent->mpRight;\
+\
+                       if ( !pCurrent ) return (pParent);\
+               }\
+\
+               return begin();\
+       }\
+\
+       inline const_iterator lower_bound( const key_type& x ) const\
+\
+               { return const_iterator( lower_bound(x).mpNode ); }\
+\
+       inline iterator upper_bound( const key_type& x )\
+       {\
+               node_ref_type pCurrent = mpRoot;\
+    \
+               while( pCurrent )\
+               {\
+                       node_ref_type pParent = pCurrent;\
+\
+                       if( are_equel( x, key(pCurrent) ) )\
+                               \
+                               return (pCurrent);\
+                       else\
+                               pCurrent = is_less( x, key(pCurrent) ) \
+                                       ? pCurrent->mpLeft \
+                                       : pCurrent->mpRight;\
+\
+                       if ( !pCurrent ) return next(pParent);\
+               }\
+\
+               return end();\
+       }\
+\
+       inline const_iterator upper_bound( const key_type& x ) const\
+\
+               { return const_iterator( upper_bound(x).mpNode ); }\
+\
+       inline iterator find( const key_type& x )\
+       {\
+               node_ref_type pCurrent = mpRoot;\
+    \
+               while( pCurrent )\
+               {\
+                       if( are_equel( x, key(pCurrent) ) )\
+                               \
+                               return (pCurrent);\
+                       else\
+                               pCurrent = is_less( x, key(pCurrent) ) \
+                                       ? pCurrent->mpLeft \
+                                       : pCurrent->mpRight;\
+               }\
+\
+               return end();\
+       }\
+\
+       inline const_iterator find( const key_type& x ) const\
+\
+               { return const_iterator( find(x).mpNode ); }\
+\
+       inline void erase(iterator first, iterator last)\
+       {\
+               if ( first.mpNode == 0 ) return;\
+\
+               while( first != last ) \
+               {\
+                       iterator next = first;\
+                       ++next;\
+                       erase( first );\
+                       first = next;\
+               }\
+       }\
+\
+       inline void erase(iterator position)\
+       {\
+               if ( position.mpNode == 0 ) return;\
+\
+               node_ref_type pZ = position.mpNode;\
+               node_ref_type pX, pY;\
+\
+               if ( pZ == mpLeftMost ) mpLeftMost   = next(pZ);\
+               if ( pZ == mpRightMost ) mpRightMost = prev( pZ );\
+\
+        if ( !pZ->mpLeft || !pZ->mpRight )\
+           \
+            pY = pZ;\
+        else \
+               {\
+            pY = pZ->mpRight;\
+           \
+            while (pY->mpLeft) \
+                               \
+                               pY = pY->mpLeft;\
+        }\
+           \
+        if ( pY->mpLeft)\
+           \
+            pX = pY->mpLeft;\
+        else\
+            pX = pY->mpRight;\
+           \
+        if ( pX ) pX->mpParent = pY->mpParent;\
+           \
+        if (pY->mpParent)\
+           \
+            if (pY == pY->mpParent->mpLeft )\
+           \
+                pY->mpParent->mpLeft = pX;\
+                   else\
+                pY->mpParent->mpRight = pX;\
+        else\
+            mpRoot = pX;\
+           \
+               node_ref_type toRemove = 0;\
+               \
+        if (pY != pZ) {\
+           \
+            pY->mpLeft = pZ->mpLeft;\
+           \
+            if (pY->mpLeft) pY->mpLeft->mpParent = pY;\
+           \
+            pY->mpRight = pZ->mpRight;\
+           \
+            if ( pY->mpRight ) \
+                               \
+                               pY->mpRight->mpParent = pY;\
+           \
+            pY->mpParent = pZ->mpParent;\
+           \
+            if (pZ->mpParent)\
+           \
+                if (pZ == pZ->mpParent->mpLeft)\
+           \
+                    pZ->mpParent->mpLeft = pY;\
+                else\
+                    pZ->mpParent->mpRight = pY;\
+            else\
+                mpRoot = pY;\
+           \
+            toRemove = pZ;\
+        } \
+               else \
+            toRemove = pY;\
+           \
+               value(toRemove).~actual_value_type();\
+               key(toRemove).~actual_value_type();\
+\
+               RecycleNode( toRemove );\
+       }\
+\
+       _INSERT_METHOD_DEFINITION\
+}
+
+// do not undefine ___WXSTL_COMMA, where associated containers are defined!
+// (it is used as workaround for constraints of C-Preprocessor's nested macros)
+
+#define ___WXSTL_COMMA ,
+
+#define __DEFINE_MAP(ARG_IS_UNIQUE, KEY_TYPE, VAL_TYPE, FUNCTOR ) __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE,\
+FUNCTOR,\
+__WXSTLMAP_##KEY_TYPE##VAL_TYPE##ARG_IS_UNIQUE, \
+struct key_value_pair   { KEY_TYPE first ; \
+                                                 VAL_TYPE second;\
+                                                 key_value_pair() {}\
+                                                 key_value_pair( const KEY_TYPE& key ___WXSTL_COMMA const VAL_TYPE& value ) \
+                                                       : first(key) ___WXSTL_COMMA second( value ) {} \
+                                               } , \
+KEY_TYPE,\
+VAL_TYPE,\
+mData.first, mData.second, x.first, x.second, \
+struct insert_result_iterator\
+{\
+       iterator first;\
+       int      second;\
+};\
+inline insert_result_iterator insert( const value_type& x )\
+{\
+       insert_result_iterator result;\
+\
+       result.first = do_insert(x);\
+       result.second  = ( result.first == end() ) ? 0 : 1;\
+\
+       return result;\
+} )
+
+#define __DEFINE_SET(ARG_IS_UNIQUE, KEY_TYPE, FUNCTOR ) __DEFINE_ASOC_CLASS( ARG_IS_UNIQUE,\
+FUNCTOR,\
+__WXSTLSET_##TYPE##ARG_IS_UNIQUE, \
+KEY_TYPE,\
+KEY_TYPE,\
+KEY_TYPE,\
+mData, mData, x, x, \
+struct insert_result_iterator\
+{\
+       iterator first;\
+       int      second;\
+};\
+inline insert_result_iterator insert( const value_type& x )\
+{\
+       insert_result_iterator result;\
+\
+       result.first = do_insert(x);\
+       result.second  = ( result.first == end() ) ? 0 : 1;\
+\
+       return result;\
+} )
+
+// helper macros to create functor objects for associative containers of the given type
+
+#define LESS_THEN_FUNCTOR(TYPE) struct \
+{ inline int operator()(const TYPE& x, const TYPE& y ) const { return x < y; } }
+
+#define GREATER_THEN_FUNCTOR(TYPE) struct \
+{ inline int operator()(const TYPE& x, const TYPE& y ) const { return x > y; } }
+
+// functor argument should be created using the two above macros 
+// or passing own class with method "operator()(const TYPE&,cosnt TYPE&)" defined in it
+
+#define WXSTL_MAP( KEY_TYPE, VALUE_TYPE, FUNCTOR )      __DEFINE_MAP( 1 ,KEY_TYPE, VALUE_TYPE, FUNCTOR)
+#define WXSTL_MULTIMAP( KEY_TYPE, VALUE_TYPE, FUNCTOR ) __DEFINE_MAP( 0 ,KEY_TYPE, VALUE_TYPE, FUNCTOR)
+#define WXSTL_SET( KEY_TYPE, FUNCTOR )                  __DEFINE_SET( 1 ,KEY_TYPE, FUNCTOR )
+#define WXSTL_MULTISET( KEY_TYPE, FUNCTOR )             __DEFINE_SET( 0 ,KEY_TYPE, FUNCTOR )
+
+#endif
diff --git a/utils/HelpGen/include/wxstllst.h b/utils/HelpGen/include/wxstllst.h
new file mode 100644 (file)
index 0000000..76fd010
--- /dev/null
@@ -0,0 +1,555 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSTLLST_G__
+#define __WXSTLLST_G__
+
+#include <stddef.h>
+#include <sys/types.h>
+#include <memory.h>
+#include <limits.h>
+#include <new.h>
+
+// VERSION:: 0.2 (copy-constructor/adign-op added)
+
+// FOR NOW:: class-member operators "new" and "delete"
+//           are ignored by list class, memory allocated 
+//           and freed using global operators
+
+typedef int Type;
+
+
+// the below macro used internally (see actual interface after this macro)
+
+#define __DEFINE_STL_LIST(listClass,Type) class \
+ listClass \
+{\
+public:\
+\
+       typedef Type                      value_type;\
+       typedef value_type*           pointer;\
+       typedef const value_type* const_pointer;\
+       typedef value_type&       reference;\
+       typedef const value_type& const_reference;\
+       typedef size_t                    size_type;\
+       typedef ptrdiff_t                 difference_type;\
+\
+protected:\
+       struct list_node\
+       {\
+               list_node* mpNext;\
+               list_node* mpPrev;\
+               value_type mData;\
+       };\
+\
+       typedef list_node* node_ref_type;\
+\
+       node_ref_type mpFreeListHead;\
+       node_ref_type mpTerminator;\
+       size_type     mSize;\
+\
+       inline node_ref_type AllocNode() \
+       { \
+               if ( mpFreeListHead ) \
+               {\
+                       node_ref_type pFreeNode = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpPrev;\
+\
+                       return pFreeNode;\
+               }\
+               else\
+               {\
+                       char* pHeapBlock = new char[sizeof(list_node)];\
+\
+                       return (node_ref_type)pHeapBlock;\
+               }\
+       }\
+\
+       inline void DestroyFreeList()\
+       {\
+               while ( mpFreeListHead )\
+               {\
+                       node_ref_type tmp = mpFreeListHead;\
+                       mpFreeListHead = mpFreeListHead->mpPrev;\
+\
+                       delete [](char*)tmp;\
+               }\
+       }\
+\
+       inline void RecycleNode( node_ref_type pNode ) \
+       {\
+               pNode->mpPrev = mpFreeListHead;\
+               mpFreeListHead = pNode;\
+       }\
+\
+public:\
+\
+       class iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+               friend class const_iterator;\
+               friend class const_reverse_iterator;\
+\
+       protected:\
+               iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               iterator() {}\
+               int operator==( const iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpPrev;\
+                       return *this;\
+               }\
+\
+               inline iterator operator--(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const iterator& operator++() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline iterator operator++(int)\
+               {\
+                       iterator tmp = *this;\
+                       mpNode = mpNode->mpNext;\
+                       return tmp;\
+               }\
+\
+               inline reference operator*()       const { return mpNode->mData; }\
+       };\
+\
+\
+       class const_iterator \
+       {\
+       protected:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+\
+       protected:\
+               const_iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+               \
+               const_iterator() {}\
+               int operator==( const const_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const const_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+\
+               inline const_iterator( const iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const const_iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpPrev;\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator--(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const const_iterator& operator++() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline const_iterator operator++(int)\
+               {\
+                       const_iterator tmp = *this;\
+                       mpNode = mpNode->mpNext;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+       typedef iterator       OutputIterator;\
+       typedef const_iterator InputIterator;\
+\
+       class reverse_iterator \
+       {\
+       public:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+               friend class const_reverse_iterator;\
+\
+       protected:\
+               reverse_iterator ( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+\
+               reverse_iterator() {}\
+               int operator==( const reverse_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const reverse_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const reverse_iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator operator--(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const reverse_iterator & operator++() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator  operator++(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+\
+       class const_reverse_iterator \
+       {\
+       protected:\
+               node_ref_type mpNode;\
+               friend class listClass;\
+\
+       protected:\
+               const_reverse_iterator( node_ref_type pNode )\
+               {\
+                       mpNode = pNode;\
+               }\
+       \
+       public:\
+\
+               const_reverse_iterator() {}\
+               int operator==( const const_reverse_iterator& rhs ) const { return (mpNode == rhs.mpNode); }\
+               int operator!=( const const_reverse_iterator& rhs ) const { return (mpNode != rhs.mpNode); }\
+\
+               inline const_reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpNode = other.mpNode;\
+               }\
+\
+               inline const const_reverse_iterator& operator--() \
+               {\
+                       mpNode = mpNode->mpNext;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator--(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpNext;\
+                       return tmp;\
+               }\
+\
+               inline const const_reverse_iterator& operator++() \
+               {\
+                       mpNode = mpNode->mpPrev;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator++(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       mpNode = mpNode->mpPrev;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return mpNode->mData; }\
+       };\
+\
+public:\
+\
+    inline listClass()\
+                       : mpFreeListHead( 0 ),\
+                         mSize(0)\
+       {\
+               mpTerminator = AllocNode();\
+               mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\
+       }\
+\
+       listClass( const listClass& other )\
+       {\
+               mpTerminator = AllocNode();\
+               mpTerminator->mpPrev = mpTerminator->mpNext = mpTerminator;\
+\
+               for( listClass::const_iterator i = other.begin(); i != other.end(); ++i )\
+\
+                       push_back( (*i) );\
+       }\
+\
+       inline const listClass& operator=( const listClass& rhs ) \
+       {\
+               erase( begin(), end() );\
+\
+               for( listClass::const_iterator i = rhs.begin(); i != rhs.end(); ++i )\
+\
+                       push_back( (*i) );\
+\
+               return *this;\
+       }\
+\
+       inline listClass(const_iterator first, const_iterator last)\
+                       : mpFreeListHead( 0 ),\
+                         mSize(0)\
+       \
+               { while( first != last ) push_back( *first++ ); }\
+\
+       inline listClass( size_type n, const value_type& value = value_type() )\
+       \
+               { for( size_t i = 0; i != n; ++n ) push_back( value ); }\
+\
+       inline ~listClass() \
+       { \
+               erase( begin(), end() ); \
+\
+               RecycleNode( mpTerminator );\
+               DestroyFreeList();\
+       }\
+\
+       inline iterator begin() { return iterator(mpTerminator->mpNext); }\
+       \
+       inline const_iterator begin() const \
+               { return const_iterator(mpTerminator->mpNext); }\
+       \
+       inline iterator end() { return iterator(mpTerminator); }\
+\
+       inline const_iterator end() const { return const_iterator(mpTerminator); }\
+\
+       inline reverse_iterator rbegin() \
+               { return reverse_iterator(mpTerminator->mpPrev); }\
+\
+       inline reverse_iterator rend() \
+               { return reverse_iterator(mpTerminator); }\
+\
+       inline const_reverse_iterator rbegin() const\
+               { return const_reverse_iterator(mpTerminator->mpPrev); }\
+\
+       inline const_reverse_iterator  rend() const\
+               { return const_reverse_iterator(mpTerminator); }\
+\
+       inline int empty() const { return (mSize == 0); }\
+\
+       inline size_type size() const { return mSize; }\
+\
+       inline size_type max_size() const { return UINT_MAX/sizeof(list_node); }\
+\
+       inline reference front() { return mpTerminator->mData; }\
+\
+       inline const_reference front() const { return mpTerminator->mData; }\
+\
+       inline reference back() { return mpTerminator->mpPrev->mData; }\
+\
+       inline const_reference back() const { return mpTerminator->mpPrev->mData; }\
+\
+       inline void push_front(const value_type& x) { insert( begin(), x ); }\
+\
+       inline void push_back(const value_type& x) { insert( end(), x ); }\
+\
+       iterator insert(iterator position, const value_type& x = value_type())\
+       {\
+               node_ref_type pNew = AllocNode();\
+\
+               node_ref_type pos = *((node_ref_type*)&position);\
+\
+               pNew->mpNext = pos;\
+               pNew->mpPrev = pos->mpPrev;\
+               pos->mpPrev->mpNext = pNew;\
+               pos->mpPrev  = pNew;\
+\
+               new (&pNew->mData) value_type(x);\
+\
+               ++mSize;\
+\
+               return iterator(pNew);\
+       }\
+\
+       inline void insert(iterator position, const_iterator first, const_iterator last )\
+       {\
+               while( first != last ) insert( position, *first++ );\
+       }\
+\
+       inline void splice( iterator position, listClass& other )\
+       {\
+               if ( other.begin() == other.end() ) return;\
+\
+               node_ref_type pTill = other.mpTerminator->mpPrev;\
+               node_ref_type pFrom = other.begin().mpNode;\
+\
+               mpTerminator->mpPrev->mpNext = pFrom;\
+               pFrom->mpPrev = mpTerminator->mpPrev->mpNext;\
+\
+               pTill->mpNext = mpTerminator;\
+               mpTerminator->mpPrev = pTill;\
+\
+               other.mpTerminator->mpNext = \
+                       other.mpTerminator->mpPrev = other.mpTerminator;\
+\
+               mSize += other.mSize;\
+               other.mSize = 0;\
+       }\
+\
+       inline void splice( iterator position, listClass& other, iterator first, iterator last )\
+       {\
+               if ( first == last ) return;\
+\
+               size_type sz = 0;\
+               iterator tmp = first;\
+               while( tmp != last ) \
+               {\
+                       ++tmp;\
+                       ++sz;\
+               }\
+\
+               mSize += sz;\
+               other.mSize -= sz;\
+\
+               node_ref_type pPos   = position.mpNode;\
+               node_ref_type pFirst = first.mpNode;\
+               node_ref_type pLast  = last.mpNode;\
+               node_ref_type pTill  = last.mpNode->mpPrev;\
+\
+               pPos->mpPrev->mpNext = pFirst;\
+               pPos->mpPrev = pTill;\
+\
+               pFirst->mpPrev->mpNext = last.mpNode;\
+               pLast->mpPrev = pTill;\
+\
+               pFirst->mpPrev = pPos->mpPrev;\
+               pTill->mpNext = pPos;\
+       }\
+\
+       inline void pop_front() { erase( begin() ); }\
+       inline void pop_back()  { erase( --end() );   }\
+       \
+       inline void erase(iterator position)\
+       {\
+               erase( position, ++position );\
+       }\
+       \
+       inline void erase(iterator first, iterator last)\
+       {\
+               node_ref_type firstNode = *((node_ref_type*)&first);\
+               node_ref_type lastNode = *((node_ref_type*)&last);\
+\
+               firstNode->mpPrev->mpNext = lastNode;\
+               lastNode->mpPrev = firstNode->mpPrev;\
+\
+               while( firstNode != lastNode )\
+               {\
+                       node_ref_type next = firstNode->mpNext;\
+\
+                       typedef value_type value_type_local;\
+                       firstNode->mData.value_type_local::~value_type_local();\
+\
+                       RecycleNode( firstNode );\
+\
+                       firstNode = next;\
+\
+                       --mSize;\
+               }\
+       }\
+\
+       inline void remove(const value_type& value)\
+       {\
+               for( iterator i = begin(); i != end(); ++i )\
+               \
+                       if ( (*i) == value ) \
+                       {\
+                               erase( i ); break;\
+                       }\
+       }\
+\
+       void sort()\
+       {\
+               if ( mSize < 2 ) return;\
+\
+               iterator from = begin();\
+               iterator other_end = end();\
+               --other_end;\
+\
+               for( size_type i = 0; i != mSize; ++i )\
+               {\
+                       size_type nSwaps = 0;\
+\
+                       iterator next = begin();\
+                       ++next;\
+\
+                       for( iterator j = begin(); j != other_end;  ++j )\
+                       {\
+\
+                               if ( (*next) < (*j) )\
+                               {\
+                                       value_type tmp = (*j);\
+                                       (*j) = (*next);\
+                                       (*next) = tmp;\
+\
+                                       ++nSwaps;\
+                               }\
+\
+                               ++next;\
+                       }\
+\
+                       if ( !nSwaps) break;\
+\
+                       --other_end;\
+               }\
+       }\
+}
+
+// defines list class with the given element type
+#define WXSTL_LIST(ELEMENT_CLASS)  __DEFINE_STL_LIST(\
+\
+_WXSTL_LIST_##ELEMENT_CLASS, ELEMENT_CLASS )
+
+#endif
\ No newline at end of file
diff --git a/utils/HelpGen/include/wxstlvec.h b/utils/HelpGen/include/wxstlvec.h
new file mode 100644 (file)
index 0000000..ddfbead
--- /dev/null
@@ -0,0 +1,777 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef __WXSTLVEC_G__
+#define __WXSTLVEC_G__
+
+#include <memory.h>
+#include <string.h>  // imports memmove()
+#include <stddef.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <new>
+
+// the below macro used internally (see actual interface after this macro)
+
+#define __DEFINE_STL_VECTOR_DEEP( vectorClass, Type ) class vectorClass {\
+\
+public:\
+       typedef Type              value_type;\
+       typedef value_type*           iterator;\
+       typedef const value_type* const_iterator;\
+       typedef iterator                  pointer;\
+       typedef const iterator    const_pointer;\
+       typedef value_type&       reference;\
+       typedef const value_type& const_reference;\
+       typedef size_t            size_type;\
+       typedef ptrdiff_t         difference_type;\
+\
+       typedef iterator       OutputIterator;\
+       typedef const_iterator InputIterator;\
+\
+protected:\
+\
+       inline void PlacementCopy( const_iterator first, const_iterator last, iterator result )\
+       {\
+               while ( first != last ) \
+                       new (result++) value_type(*first++);\
+       }\
+\
+       inline void ConstructObjects( iterator first, iterator last, const value_type& pattern )\
+       {\
+               while( first != last ) \
+                       new (first++) value_type(pattern);\
+       }\
+\
+       inline void CopyObjects( iterator first, iterator last, iterator result )\
+       {\
+               while( first != last ) \
+                       *result++ = *first++;\
+       }\
+\
+       inline void CopyObjectsBack( iterator first, iterator last, iterator result )\
+       {\
+               result += difference_type(last,first);\
+\
+               while( first != last ) \
+                       *(--result) = *(--last);\
+       }\
+\
+public:\
+\
+       class reverse_iterator \
+       {\
+               friend class vectorClass;\
+               friend class const_reverse_iterator;\
+\
+       public:\
+               iterator mpPos;\
+\
+       public:\
+\
+               reverse_iterator() {}\
+\
+               reverse_iterator ( iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator operator--(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator  operator++(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+\
+       class const_reverse_iterator \
+       {\
+       protected:\
+               iterator mpPos;\
+       public:\
+\
+               const_reverse_iterator() {}\
+\
+               const_reverse_iterator( const iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const const_reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const const_reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline const_reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const const_reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator--(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const const_reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator++(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+protected:\
+       \
+       pointer mpStart;\
+       pointer mpEnd;\
+       pointer mpEndOfBuf;\
+\
+protected:\
+\
+       inline void quick_sort(int low, int hi) \
+       {\
+       }\
+\
+       inline void DestructRange( iterator first, iterator last )\
+       {\
+               typedef value_type value_type_local;\
+\
+               while ( first != last ) \
+               {\
+                       first->value_type_local::~value_type_local();\
+                       ++first;\
+               }\
+       }\
+\
+       inline iterator DoInsert(iterator position, const value_type& x)\
+       {\
+               if ( mpEnd < mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(*(mpEnd-1) );\
+           \
+                       CopyObjectsBack( position, mpEnd, position + 1 );\
+           \
+                       *position = x;\
+           \
+                       ++mpEnd;\
+           \
+                       return position;\
+               }\
+           \
+               size_type minBufLen = WXSTL_VECTOR_MIN_BUF_SIZE/sizeof(value_type);\
+           \
+               size_type doubledSize = size()*2;\
+           \
+               size_type newLen = ( doubledSize < minBufLen ) ? minBufLen : doubledSize;\
+           \
+               iterator pNewStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+           \
+               PlacementCopy( mpStart, position, pNewStart );\
+           \
+               iterator atPosition = pNewStart + difference_type( position - mpStart );\
+           \
+               new (atPosition) value_type(x);\
+           \
+               iterator newPos = atPosition;\
+           \
+               ++atPosition;\
+           \
+               if ( mpStart ) \
+               {\
+                       PlacementCopy( position, mpEnd, atPosition );\
+                       DestructRange( mpStart, mpEnd );\
+                       delete [](char*)mpStart;\
+               }\
+           \
+               mpEnd = atPosition + difference_type( mpEnd - position );\
+           \
+               mpStart    = pNewStart;\
+               mpEndOfBuf = pNewStart + newLen;\
+           \
+               return newPos;\
+       }\
+\
+public:\
+\
+       inline vectorClass() : mpStart(0), \
+                                                  mpEnd(0),\
+                                                  mpEndOfBuf(0)\
+       {}\
+\
+       inline vectorClass( const_iterator first, const_iterator last )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { while( first != last ) push_back( *first++ ); }\
+\
+       inline vectorClass( size_type n, const value_type& value = value_type() )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { for( size_type i = 0; i != n; ++i ) push_back( value ); }\
+\
+       inline const vectorClass& operator=( const vectorClass& other )\
+       {\
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+\
+               size_t newLen = difference_type( other.mpEndOfBuf - other.mpStart );\
+\
+               mpStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+\
+               PlacementCopy( other.begin(), other.end(), mpStart );\
+\
+               mpEnd = mpStart + other.size();\
+\
+               mpEndOfBuf = mpStart + newLen;\
+\
+               return *this;\
+       }\
+\
+       inline vectorClass( const vectorClass& other )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+       {\
+               this->operator=( other );\
+       }\
+\
+       inline ~vectorClass() \
+       { \
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+       }\
+\
+       inline iterator begin() { return mpStart; }\
+\
+       inline const_iterator begin() const { return mpStart; }\
+\
+       inline iterator end() { return mpEnd; }\
+\
+       inline const_iterator end() const { return mpEnd; }\
+\
+       inline size_type size() const { return (size_type)difference_type(mpEnd-mpStart); }\
+\
+       inline size_type max_size() const { return UINT_MAX/sizeof(value_type); }\
+\
+       inline size_type capacity() const \
+                       { return difference_type(mpEndOfBuf-mpStart)/sizeof(value_type); }\
+\
+       inline int empty() const { return mpStart == mpEnd; }\
+\
+       inline reference operator[](size_type n) { return *(mpStart+n); }\
+\
+       inline const_reference operator[](size_type n) const { return *(mpStart+n); }\
+\
+       inline reference front() { return (*mpStart); }\
+       \
+       inline const_reference front() const { return (*mpStart); }\
+\
+       inline reference back() { return (*(mpEnd-1)); }\
+\
+       inline const_reference back() const { return (*(mpEnd-1)); }\
+\
+       inline void reserve(size_type n) {}\
+\
+       inline void push_back(const value_type& x)\
+       {\
+               if ( mpEnd != mpEndOfBuf ) \
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+               }\
+               else\
+                       DoInsert( mpEnd, x );\
+       }\
+\
+       inline iterator insert(iterator position, const value_type& x = value_type())\
+       {\
+               if ( position == mpEnd && mpEnd != mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+                       return (mpEnd-1);\
+               }\
+               else return DoInsert( position, x );\
+       }\
+\
+       inline void pop_back()\
+       {\
+               DestructRange( mpEnd-1, mpEnd );\
+\
+               --mpEnd;\
+       }\
+\
+       inline void erase(iterator first, iterator last)\
+       {\
+               if ( last == mpEnd )\
+               {\
+                       DestructRange( first, last );\
+                       mpEnd = first;\
+                       return;\
+               }\
+           \
+               CopyObjects( last, last + difference_type( mpEnd - last ), first );\
+           \
+               iterator newEnd = mpEnd - difference_type( last - first );\
+               DestructRange( newEnd, mpEnd );\
+           \
+               mpEnd = newEnd;\
+       }\
+\
+       inline void erase( iterator position )\
+       {\
+               erase( position, position + 1 );\
+       }\
+\
+       inline void sort()\
+       {\
+               if ( size() < 2 ) return;\
+               quick_sort( 0, size()-1 );\
+       }\
+}
+
+/////////////////////////////// shallow-copy container ///////////////////////
+
+#define __DEFINE_STL_VECTOR_SHALLOW( vectorClass, Type ) class vectorClass {\
+\
+public:\
+       typedef Type              value_type;\
+       typedef value_type*           iterator;\
+       typedef const value_type* const_iterator;\
+       typedef iterator                  pointer;\
+       typedef const iterator    const_pointer;\
+       typedef value_type&       reference;\
+       typedef const value_type& const_reference;\
+       typedef size_t            size_type;\
+       typedef ptrdiff_t         difference_type;\
+\
+       typedef iterator       OutputIterator;\
+       typedef const_iterator InputIterator;\
+\
+protected:\
+\
+       inline void PlacementCopy( const_iterator first, const_iterator last, iterator result )\
+       {\
+               memcpy(result, first, int(difference_type(last-first)*sizeof(value_type)) );\
+       }\
+\
+       inline void ConstructObjects( iterator first, iterator last, const value_type& pattern )\
+       {\
+                       if ( sizeof(pattern) == 1 )\
+                       \
+                               memset( first, int(difference_type(last-first)/sizeof(value_type)), \
+                                       int(*((char*)&pattern)) );\
+                       else\
+                               while( first != last ) \
+                                       *first++ = pattern;\
+       }\
+\
+       inline void CopyObjects( iterator first, iterator last, iterator result )\
+       {\
+               memcpy(result, first, int(difference_type(last-first)*sizeof(value_type)) );\
+       }\
+\
+       inline void CopyObjectsBack( iterator first, iterator last, iterator result )\
+       {\
+               memmove(result, first, int(difference_type(last-first)*sizeof(value_type)) );\
+       }\
+\
+public:\
+\
+       class reverse_iterator \
+       {\
+               friend class vectorClass;\
+               friend class const_reverse_iterator;\
+\
+       public:\
+               iterator mpPos;\
+\
+       public:\
+\
+               reverse_iterator() {}\
+\
+               reverse_iterator ( iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator operator--(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline reverse_iterator  operator++(int)\
+               {\
+                       reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+\
+       class const_reverse_iterator \
+       {\
+       protected:\
+               iterator mpPos;\
+       public:\
+\
+               const_reverse_iterator() {}\
+\
+               const_reverse_iterator( const iterator pPos )\
+               {\
+                       mpPos = pPos;\
+               }\
+       \
+               int operator==( const const_reverse_iterator& rhs ) const { return (mpPos == rhs.mpPos); }\
+               int operator!=( const const_reverse_iterator& rhs ) const { return (mpPos != rhs.mpPos); }\
+\
+               inline const_reverse_iterator( const reverse_iterator& other )\
+               {\
+                       mpPos = other.mpPos;\
+               }\
+\
+               inline const const_reverse_iterator& operator--() \
+               {\
+                       --mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator--(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       --mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const const_reverse_iterator & operator++() \
+               {\
+                       ++mpPos;\
+                       return *this;\
+               }\
+\
+               inline const_reverse_iterator operator++(int)\
+               {\
+                       const_reverse_iterator tmp = *this;\
+                       ++mpPos;\
+                       return tmp;\
+               }\
+\
+               inline const_reference operator*() const { return *mpPos; }\
+       };\
+\
+protected:\
+       \
+       pointer mpStart;\
+       pointer mpEnd;\
+       pointer mpEndOfBuf;\
+\
+protected:\
+\
+       inline void quick_sort(int low, int hi) \
+       {\
+       }\
+\
+       inline void DestructRange( iterator first, iterator last )\
+       {\
+       }\
+\
+       inline iterator DoInsert(iterator position, const value_type& x)\
+       {\
+               if ( mpEnd < mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(*(mpEnd-1) );\
+           \
+                       CopyObjectsBack( position, mpEnd, position + 1 );\
+           \
+                       *position = x;\
+           \
+                       ++mpEnd;\
+           \
+                       return position;\
+               }\
+           \
+               size_type minBufLen = WXSTL_VECTOR_MIN_BUF_SIZE/sizeof(value_type);\
+           \
+               size_type doubledSize = size()*2;\
+           \
+               size_type newLen = ( doubledSize < minBufLen ) ? minBufLen : doubledSize;\
+           \
+               iterator pNewStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+           \
+               PlacementCopy( mpStart, position, pNewStart );\
+           \
+               iterator atPosition = pNewStart + difference_type( position - mpStart );\
+           \
+               new (atPosition) value_type(x);\
+           \
+               iterator newPos = atPosition;\
+           \
+               ++atPosition;\
+           \
+               if ( mpStart ) \
+               {\
+                       PlacementCopy( position, mpEnd, atPosition );\
+                       DestructRange( mpStart, mpEnd );\
+                       delete [](char*)mpStart;\
+               }\
+           \
+               mpEnd = atPosition + difference_type( mpEnd - position );\
+           \
+               mpStart    = pNewStart;\
+               mpEndOfBuf = pNewStart + newLen;\
+           \
+               return newPos;\
+       }\
+\
+public:\
+\
+       inline vectorClass() : mpStart(0), \
+                                                  mpEnd(0),\
+                                                  mpEndOfBuf(0)\
+       {}\
+\
+       inline vectorClass( const_iterator first, const_iterator last )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { while( first != last ) push_back( *first++ ); }\
+\
+       inline vectorClass( size_type n, const value_type& value = value_type() )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+               \
+               { for( size_type i = 0; i != n; ++i ) push_back( value ); }\
+\
+       inline const vectorClass& operator=( const vectorClass& other )\
+       {\
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+\
+               size_t newLen = difference_type( other.mpEndOfBuf - other.mpStart );\
+\
+               mpStart = (iterator)( new char[newLen*sizeof(value_type)] );\
+\
+               PlacementCopy( other.begin(), other.end(), mpStart );\
+\
+               mpEnd = mpStart + other.size();\
+\
+               mpEndOfBuf = mpStart + newLen;\
+\
+               return *this;\
+       }\
+\
+       inline vectorClass( const vectorClass& other )\
+               : mpStart(0),\
+                 mpEnd(0),\
+                 mpEndOfBuf(0)\
+       {\
+               this->operator=( other );\
+       }\
+\
+       inline ~vectorClass() \
+       { \
+               if (mpStart) \
+               {\
+                       DestructRange( begin(), end() );\
+                       delete [](char*)mpStart; \
+               }\
+       }\
+\
+       inline iterator begin() { return mpStart; }\
+\
+       inline const_iterator begin() const { return mpStart; }\
+\
+       inline iterator end() { return mpEnd; }\
+\
+       inline const_iterator end() const { return mpEnd; }\
+\
+       inline size_type size() const { return (size_type)difference_type(mpEnd-mpStart); }\
+\
+       inline size_type max_size() const { return UINT_MAX/sizeof(value_type); }\
+\
+       inline size_type capacity() const \
+                       { return difference_type(mpEndOfBuf-mpStart)/sizeof(value_type); }\
+\
+       inline int empty() const { return mpStart == mpEnd; }\
+\
+       inline reference operator[](size_type n) { return *(mpStart+n); }\
+\
+       inline const_reference operator[](size_type n) const { return *(mpStart+n); }\
+\
+       inline reference front() { return (*mpStart); }\
+       \
+       inline const_reference front() const { return (*mpStart); }\
+\
+       inline reference back() { return (*(mpEnd-1)); }\
+\
+       inline const_reference back() const { return (*(mpEnd-1)); }\
+\
+       inline void reserve(size_type n) {}\
+\
+       inline void push_back(const value_type& x)\
+       {\
+               if ( mpEnd != mpEndOfBuf ) \
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+               }\
+               else\
+                       DoInsert( mpEnd, x );\
+       }\
+\
+       inline iterator insert(iterator position, const value_type& x = value_type())\
+       {\
+               if ( position == mpEnd && mpEnd != mpEndOfBuf )\
+               {\
+                       new (mpEnd) value_type(x);\
+                       ++mpEnd;\
+                       return (mpEnd-1);\
+               }\
+               else return DoInsert( position, x );\
+       }\
+\
+       inline void pop_back()\
+       {\
+               DestructRange( mpEnd-1, mpEnd );\
+\
+               --mpEnd;\
+       }\
+\
+       inline void erase(iterator first, iterator last)\
+       {\
+               if ( last == mpEnd )\
+               {\
+                       DestructRange( first, last );\
+                       mpEnd = first;\
+                       return;\
+               }\
+           \
+               CopyObjects( last, last + difference_type( mpEnd - last ), first );\
+           \
+               iterator newEnd = mpEnd - difference_type( last - first );\
+               DestructRange( newEnd, mpEnd );\
+           \
+               mpEnd = newEnd;\
+       }\
+\
+       inline void erase( iterator position )\
+       {\
+               erase( position, position + 1 );\
+       }\
+\
+       inline void sort()\
+       {\
+               if ( size() < 2 ) return;\
+               quick_sort( 0, size()-1 );\
+       }\
+}
+
+
+
+// redefine below symbol to change the default allocation unit of vector content buffer
+#define WXSTL_VECTOR_MIN_BUF_SIZE 64
+
+// defines vector class, where objects are copied
+// using "deep-copy" sematics (i.e. by calling their copy constructors)
+
+#define WXSTL_VECTOR(ELEMENT_CLASS) \
+__DEFINE_STL_VECTOR_DEEP(_WXSTL_VECTOR_##ELEMENT_CLASS, ELEMENT_CLASS)
+
+// defines vector class, where objects are copied
+// using "shallow-copy" sematics (i.e. instead of calling
+// their constructors, memcpy() and memmove() are used to copy their raw data)
+
+
+#define WXSTL_VECTOR_SHALLOW_COPY(ELEMENT_CLASS) __DEFINE_STL_VECTOR_SHALLOW(_WXSTL_VECTORSC_##ELEMENT_CLASS, ELEMENT_CLASS)
+
+#endif
diff --git a/utils/HelpGen/src/HelpGen.cpp b/utils/HelpGen/src/HelpGen.cpp
new file mode 100644 (file)
index 0000000..af3023e
--- /dev/null
@@ -0,0 +1,515 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        HelpGen.cpp
+// Purpose:     Main program file for HelpGen
+// Author:      Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Modified by:
+// Created:     06/01/99
+// RCS-ID:      $Id$
+// Copyright:   (c) 1999 VZ
+// Licence:     GPL
+/////////////////////////////////////////////////////////////////////////////
+
+/*
+   TODO (+ means fixed)
+
+   (i) small fixes in the current version
+   
+   +1. Quote special TeX characters like '&' and '_' (=> derive from wxFile)
+    2. Document typedefs
+    3. Document global variables
+    4. Document #defines
+
+   (ii) plans for version 2
+    1. Use wxTextFile for direct file access to avoid one scan method problems
+   
+*/
+
+// =============================================================================
+// declarations
+// =============================================================================
+
+// -----------------------------------------------------------------------------
+// headers
+// -----------------------------------------------------------------------------
+
+// wxWindows
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+    #include <wx/string.h>
+    #include <wx/log.h>
+    #include <wx/file.h>
+#endif // WX_PRECOMP
+
+// C++ parsing classes
+#include "cjparser.h"
+
+// standard headers
+#include <stdio.h>
+#include <time.h>
+
+// -----------------------------------------------------------------------------
+// private functions
+// -----------------------------------------------------------------------------
+
+// return the label for the given function name
+static wxString MakeLabel(const char *classname, const char *funcname);
+    
+// quotes special TeX characters in place
+static void TeXFilter(wxString* str);
+
+// -----------------------------------------------------------------------------
+// private classes
+// -----------------------------------------------------------------------------
+
+// add a function which sanitazes the string before writing it to the file
+class wxTeXFile : public wxFile
+{
+public:
+    wxTeXFile() : wxFile() { }
+
+    bool WriteTeX(const wxString& s)
+    {
+        wxString t(s);
+        TeXFilter(&t);
+
+        return wxFile::Write(t);
+    }
+};
+
+class HelpGenVisitor : public spVisitor
+{
+public:
+    // ctor
+    HelpGenVisitor();
+
+    virtual void VisitFile( spFile& fl );
+    virtual void VisitClass( spClass& cl );
+    virtual void VisitEnumeration( spEnumeration& en );
+    virtual void VisitTypeDef( spTypeDef& td );
+    virtual void VisitAttribute( spAttribute& attr );
+    virtual void VisitOperation( spOperation& op );
+    virtual void VisitParameter( spParameter& param );
+
+    void EndVisit();
+
+    // shut up g++ warning (ain't it stupid?)
+    virtual ~HelpGenVisitor() { }
+
+protected:
+    // (re)initialize the state
+    void Reset();
+
+    // insert documentation for enums/typedefs coming immediately before the
+    // class declaration into the class documentation
+    void InsertTypedefDocs();
+    void InsertEnumDocs();
+
+    // write the headers for corresponding sections (only once)
+    void InsertDataStructuresHeader();
+    void InsertMethodsHeader();
+    
+    // terminate the function documentation if it was started
+    void CloseFunction();
+
+    wxTeXFile m_file;  // file we're writing to now
+
+    // state variables
+    bool m_inClass,         // TRUE after file successfully opened
+         m_inTypesSection,  // enums & typedefs go there
+         m_inMethodSection, // functions go here
+         m_isFirstParam,    // first parameter of current function?
+         m_inFunction;      // we're parsing a function declaration
+
+    // holders for "saved" documentation
+    wxString m_textStoredEnums,
+             m_textStoredTypedefs,
+             m_textStoredFunctionComment;
+};
+
+// -----------------------------------------------------------------------------
+// private functions
+// -----------------------------------------------------------------------------
+
+// =============================================================================
+// implementation
+// =============================================================================
+
+int main(int argc, char **argv)
+{
+    if ( argc < 2 ) {
+        wxLogError("usage: %s <header files...>\n", argv[0]);
+
+        return 1;
+    }
+
+    // be verbose
+    wxLog::GetActiveTarget()->SetVerbose();
+
+    // create a parser object and a visitor derivation
+    CJSourceParser parser;
+    HelpGenVisitor visitor;
+
+    // parse all files
+    for ( int i = 1; i < argc; i++ ) {
+        spContext *ctxTop = parser.ParseFile(argv[i]);
+        if ( !ctxTop ) {
+            wxLogWarning("File '%s' couldn't be processed.", argv[i]);
+        }
+        else {
+            ((spFile *)ctxTop)->mFileName = argv[i];
+            visitor.VisitAll(*ctxTop);
+            visitor.EndVisit();
+        }
+    }
+
+    return 0;
+}
+
+// -----------------------------------------------------------------------------
+// HelpGenVisitor implementation
+// -----------------------------------------------------------------------------
+
+HelpGenVisitor::HelpGenVisitor()
+{
+    Reset();
+}
+
+void HelpGenVisitor::Reset()
+{
+    m_inClass =
+    m_inFunction =
+    m_inTypesSection =
+    m_inMethodSection = false;
+}
+
+void HelpGenVisitor::InsertTypedefDocs()
+{
+    m_file.WriteTeX(m_textStoredTypedefs);
+    m_textStoredTypedefs.Empty();
+}
+
+void HelpGenVisitor::InsertEnumDocs()
+{
+    m_file.WriteTeX(m_textStoredEnums);
+    m_textStoredEnums.Empty();
+}
+
+void HelpGenVisitor::InsertDataStructuresHeader()
+{
+    if ( !m_inTypesSection ) {
+        m_inTypesSection = true;
+
+        m_file.WriteTeX("\\wxheading{Data structures}\n\n");
+    }
+}
+
+void HelpGenVisitor::InsertMethodsHeader()
+{
+    if ( !m_inMethodSection ) {
+        m_inMethodSection = true;
+
+        m_file.WriteTeX( "\\latexignore{\\rtfignore{\\wxheading{Members}}}\n\n");
+    }
+}
+
+void HelpGenVisitor::CloseFunction()
+{
+    if ( m_inFunction ) {
+        m_inFunction = false;
+
+        wxString totalText;
+        if ( m_isFirstParam ) {
+            // no params found
+            totalText << "\\void";
+        }
+
+        totalText << "}\n\n";
+
+        if ( !m_textStoredFunctionComment.IsEmpty() )
+            totalText << m_textStoredFunctionComment << '\n';
+
+        m_file.WriteTeX(totalText);
+    }
+}
+
+void HelpGenVisitor::EndVisit()
+{
+    CloseFunction();
+}
+
+void HelpGenVisitor::VisitFile( spFile& file )
+{
+    wxLogInfo("Parsing classes from file '%s'...", file.mFileName.c_str());
+}
+
+void HelpGenVisitor::VisitClass( spClass& cl )
+{
+    wxString name = cl.GetName();
+
+    // the file name is built from the class name by removing the leading "wx"
+    // if any and converting it to the lower case
+    wxString filename = name;
+    if ( filename(0, 2) == "wx" ) {
+        filename.erase(0, 2);
+    }
+
+    filename.MakeLower();
+    filename += ".tex";
+
+    m_inClass = m_file.Open(filename, wxFile::write);
+    if ( !m_inClass ) {
+        wxLogError("Can't generate documentation for the class '%s'.",
+                   name.c_str());
+
+        return;
+    }
+
+    m_inMethodSection =
+    m_inTypesSection = false;
+
+    wxLogInfo("Created new file '%s' for class '%s'.",
+              filename.c_str(), name.c_str());
+
+    // the entire text we're writing to file
+    wxString totalText;
+
+    // write out the header
+    {
+        time_t timeNow = time(NULL);
+        wxString header;
+        header.Printf("% automatically generated by HelpGen from %s at "
+                      "%s" // no '\n' here because ctime() inserts one
+                      "\\section{\\class{%s}}\\label{%s}\n",
+                      filename.c_str(), ctime(&timeNow),
+                      name.c_str(), wxString(name).MakeLower().c_str());
+
+        totalText << header << '\n';
+    }
+
+    // the comment before the class generally explains what is it for so put it
+    // in place of the class description
+    if ( cl.HasComments() ) {
+        wxString comment;
+        const MCommentListT& comments = cl.GetCommentList();
+        for ( MCommentListT::const_iterator i = comments.begin();
+              i != comments.end();
+              i++ ) {
+            comment << (*i)->GetText();
+        }
+
+        totalText << '\n' << comment << '\n';
+    }
+
+    // derived from section
+    wxString derived = "\\wxheading{Derived from}\n\n";
+
+    const StrListT& baseClasses = cl.mSuperClassNames;
+    if ( baseClasses.size() == 0 ) {
+        derived << "No base class";
+    }
+    else {
+        bool first = true;
+        for ( StrListT::const_iterator i = baseClasses.begin();
+              i != baseClasses.end();
+              i++ ) {
+            if ( !first ) {
+                // separate from the previous one
+                derived << "\\\\\n";
+            }
+            else {
+                first = false;
+            }
+
+            wxString baseclass = *i;
+            derived << "\\helpref{" << baseclass << "}"
+                       "{ " << baseclass.MakeLower()  << "}";
+        }
+    }
+    totalText << derived << "\n\n";
+
+    // write all this to file
+    m_file.WriteTeX(totalText);
+
+    // if there were any enums/typedefs before, insert their documentation now
+    InsertDataStructuresHeader();
+    InsertTypedefDocs();
+    InsertEnumDocs();
+}
+
+void HelpGenVisitor::VisitEnumeration( spEnumeration& en )
+{
+    CloseFunction();
+
+    if ( m_inMethodSection ) {
+        // FIXME that's a bug, but tell the user aboit it nevertheless... we
+        // should be smart enough to process even the enums which come after the
+        // functions
+        wxLogWarning("enum '%s' ignored, please put it before the class "
+                     "methods.", en.GetName().c_str());
+        return;
+    }
+
+    // simply copy the enum text in the docs
+    wxString enumeration;
+    enumeration << "{\\small \\begin{verbatim}\n"
+                << en.mEnumContent
+                << "\n\\end{verbatim}}\n";
+
+    // remember for later use if we're not inside a class yet
+    if ( !m_inClass ) {
+        if ( !m_textStoredEnums.IsEmpty() ) {
+            m_textStoredEnums << '\n';
+        }
+
+        m_textStoredEnums << enumeration;
+    }
+    else {
+        // write the header for this section if not done yet
+        InsertDataStructuresHeader();
+
+        enumeration << '\n';
+        m_file.WriteTeX(enumeration);
+    }
+}
+
+void HelpGenVisitor::VisitTypeDef( spTypeDef& td )
+{
+    CloseFunction();
+
+    wxFAIL_MSG("don't know how to document typedefs yet");
+}
+
+void HelpGenVisitor::VisitAttribute( spAttribute& attr )
+{
+    CloseFunction();
+
+    // only document the public member variables
+    if ( !m_inClass || !attr.IsPublic() )
+        return;
+
+    wxFAIL_MSG("don't know how to document member vars yet");
+}
+
+void HelpGenVisitor::VisitOperation( spOperation& op )
+{
+    CloseFunction();
+
+    if ( !m_inClass || !op.IsInClass() ) {
+        // FIXME that's a bug too
+        wxLogWarning("skipped global function '%s'.", op.GetName().c_str());
+
+        return;
+    }
+
+    if ( op.mVisibility == SP_VIS_PRIVATE ) {
+        // FIXME should we document protected functions?
+        return;
+    }
+
+    InsertMethodsHeader();
+
+    // save state info
+    m_inFunction =
+    m_isFirstParam = true;
+
+    m_textStoredFunctionComment.Empty();
+    const MCommentListT& comments = op.GetCommentList();
+    for ( MCommentListT::const_iterator i = comments.begin();
+          i != comments.end();
+          i++ ) {
+        m_textStoredFunctionComment << (*i)->GetText();
+    }
+
+    // start function documentation
+    wxString totalText;
+    const char *funcname = op.GetName().c_str();
+    const char *classname = op.GetClass().GetName().c_str();
+               
+    // check for the special case of dtor
+    wxString dtor;
+    if ( (funcname[0] == '~') && (strcmp(funcname + 1, classname) == 0) ) {
+        dtor.Printf("\\destruct{%s}", classname);
+        funcname = dtor;
+    }
+
+    totalText.Printf("\\membersection{%s::%s}\\label{%s}\n"
+                     "\\%sfunc{%s}{%s}{",
+                     classname, funcname,
+                     MakeLabel(classname, funcname).c_str(),
+                     op.mIsConstant ? "const" : "",
+                     op.mRetType.c_str(),
+                     funcname);
+
+    m_file.WriteTeX(totalText);
+}
+
+void HelpGenVisitor::VisitParameter( spParameter& param )
+{
+    if ( !m_inFunction )
+        return;
+
+    wxString totalText;
+    if ( m_isFirstParam ) {
+        m_isFirstParam = false;
+    }
+    else {
+        totalText << ", ";
+    }
+    
+    totalText << "\\param{" << param.mType << " }{" << param.GetName();
+    wxString defvalue = param.mInitVal;
+    if ( !defvalue.IsEmpty() ) {
+        totalText << " = " << defvalue;
+    }
+    
+    totalText << '}';
+
+    m_file.WriteTeX(totalText);
+}
+
+// -----------------------------------------------------------------------------
+// global function implementation
+// -----------------------------------------------------------------------------
+
+static wxString MakeLabel(const char *classname, const char *funcname)
+{
+    wxString label(classname);
+    if ( funcname[0] == '\\' ) {
+        // we may have some special TeX macro - so far only \destruct exists,
+        // but may be later others will be added
+        static const char *macros[] = { "destruct" };
+        static const char *replacement[] = { "dtor" };
+        
+        size_t n;
+        for ( n = 0; n < WXSIZEOF(macros); n++ ) {
+            if ( strncmp(funcname + 1, macros[n], strlen(macros[n])) == 0 ) {
+                // found
+                break;
+            }
+        }
+
+        if ( n == WXSIZEOF(macros) ) {
+            wxLogWarning("unknown function name '%s' - leaving as is.",
+                         funcname);
+        }
+        else {
+            funcname = replacement[n];
+        }
+    }
+
+    label << funcname;
+
+    label.MakeLower();
+
+    return label;
+}
+
+static void TeXFilter(wxString* str)
+{
+    // FIXME may be done much more quickly
+    str->Replace("&", "\\&");
+    str->Replace("_", "\\_");
+}
+
+/* vi: set tw=80 et ts=4 sw=4: */
diff --git a/utils/HelpGen/src/cjparser.cpp b/utils/HelpGen/src/cjparser.cpp
new file mode 100644 (file)
index 0000000..9c90e37
--- /dev/null
@@ -0,0 +1,2173 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "acell.h"
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "cjparser.h"
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <map>
+
+#else
+
+       #include "wxstlac.h"
+
+#endif
+
+
+/***** Implementation for class SJParser *****/
+
+// statics used by inline'ed C helper-functions
+static char* _gSrcStart = 0;
+static char* _gSrcEnd   = 0;
+static char* _gLastSuppresedComment = 0;
+static int   _gLineNo      = 0;
+
+// FOR NOW:: comments queue is static
+#define MAX_CQ_ENTRIES 128
+static char* _gCommentsQueue[MAX_CQ_ENTRIES];
+static int    _gCQSize = 0;
+
+/***** keyword map related structures *****/
+
+struct less_c_str 
+{
+    inline bool operator()( char* x, char* y) const 
+       {       return ( strcmp( x,y ) < 0 );
+       }
+};
+
+//WXSTL_MAP(CharPtrT,CharPtrT, LESS_THEN_FUNCTOR(CharPtrT));
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef map< char*, char*, less_c_str > KeywordMapT;
+
+#else
+
+       typedef char* CharPtrT;
+       typedef WXSTL_MAP( CharPtrT, CharPtrT ,less_c_str) KeywordMapT;
+
+#endif
+
+static KeywordMapT __gMultiLangMap;
+static int         __gMapReady = 0;
+
+static char* __gKeyWords[] =
+{
+       "public",
+       "protected",
+       "private",
+
+       "class",
+       "struct",
+       "union",
+       "enum",
+       "interface",
+
+       "package",
+       "import",
+
+       "typedef",
+       "template",
+       "friend",
+       "const",
+       "volatile",
+       "mutable",
+       "virtual",
+       "inline",
+       "static",
+       "register",
+
+       "final",
+       "abstract",
+       "native",
+
+       "__stdcall",
+       "extern",
+
+       0
+};
+
+static void check_keyword_map()
+{
+       if ( !__gMapReady )
+       {
+               __gMapReady = 1;
+
+               // "make sure" the address of the first member of non-polimorphic class
+               // coinsides with the address of the instance
+
+               char** keyword = __gKeyWords;
+
+               while ( (*keyword) != 0 )
+               {
+                       __gMultiLangMap.insert( 
+                               KeywordMapT::value_type( *keyword, *keyword ) 
+                       );
+
+                       ++keyword;
+               }
+       }
+}
+
+/***** helper functions *****/
+
+static inline void skip_to_eol( char*& cur )
+{
+       while( *(cur) != 10 && *cur != 13 && cur < _gSrcEnd) ++cur;
+}
+
+static inline void skip_eol( char*& cur )
+{
+       if ( *cur == 13 )
+
+               cur += 2;
+       else
+               cur += 1;
+
+       ++_gLineNo;
+}
+
+static inline bool skip_to_next_comment_in_the_line( char*& cur )
+{
+       do
+       {
+               while( cur < _gSrcEnd  &&
+                          *cur != 10 &&
+                          *cur != 13 &&
+                          *cur != '/'
+                    ) ++cur;
+
+               if ( cur == _gSrcEnd ) return FALSE;
+
+               if ( *cur == '/' )
+               {
+                       if ( (*(cur+1) == '*') ||
+                                (*(cur+1) == '/') ) return TRUE;
+                       else
+                       {
+                               ++cur;
+                               continue;
+                       }
+               }
+
+               return FALSE;
+
+       } while(1);
+}
+
+inline static void store_line_no( int& toVar )
+{
+       toVar = _gLineNo;
+}
+
+inline static void restore_line_no( int storedLineNo )
+{
+       _gLineNo = storedLineNo;
+}
+
+inline static int get_line_no()
+{
+       return _gLineNo;
+}
+
+static void skip_to_prev_line( char*& cur )
+{
+       while( cur >= _gSrcStart  &&
+                  *cur != 10 &&
+                  *cur != 13 
+                  ) --cur;
+
+       // NOTE:: '\n' is 13,10 for DOS
+       //        '\n' is 10 for UNIX
+
+       // NOTE1: '\n' symbol is not used here,
+       //        to provide possibility of loading
+       //        file as binary
+
+       --cur;
+       if ( *cur == 10 ) 
+       {
+               ++cur;
+               return;
+       }
+
+       if ( *cur == 13 ) --cur;
+
+       while( cur >= _gSrcStart  &&
+                  *cur != 10 &&
+                  *cur != 13 
+                  ) --cur;
+
+       ++cur; // move to the first character in the line
+}
+
+static inline void skip_comments( char*& cur )
+{
+       ++cur; // skip '/' token
+
+       if ( *cur != '/' && *cur != '*' ) return;
+
+       // first, store position of the comment into the queue
+       // (which further will be attached to the next context
+       //  found)
+
+       if ( cur-1 != _gLastSuppresedComment )
+       {
+               if ( _gCQSize == MAX_CQ_ENTRIES )
+               {
+                       size_t i = MAX_CQ_ENTRIES-1;
+
+                       while( i != 0 )
+                       {
+                               _gCommentsQueue[i-1] = _gCommentsQueue[i];
+                               --i;
+                       }
+
+                       --_gCQSize ;
+               }
+
+               _gCommentsQueue[_gCQSize++] = cur-1;
+       }
+
+       // if signle-line comment, skip it now
+       if ( *cur == '/' )
+       {
+               skip_to_eol( cur );
+               skip_eol( cur );
+               return;
+       }
+
+       size_t level = 1;
+
+       // check for multiline comment (handle nested multiline comments!)
+
+       int line_len = 0;
+
+       ++cur;
+       ++cur;
+       do
+       {
+               // TBD:: check eof cond.
+
+               // detect and remove vertical columns of '*''s
+
+               while ( *cur != '/' && cur < _gSrcEnd )
+               {
+                       switch (*cur)
+                       {
+                               case '*' : 
+                                       {
+                                               if ( *(cur+1) != '/' )
+                                               {
+                                                       if ( line_len == 1 )
+
+                                                               *cur = ' ';
+                                               }
+
+                                               break;
+                                       }
+
+                               case 13 : line_len = 0; break;
+                               case 10 : { line_len = 0; ++_gLineNo; } break;
+
+                               default : ++line_len;
+                       }
+
+                       ++cur;
+               }
+
+               if ( cur >= _gSrcEnd  ) return;
+
+               ++cur;
+
+               if ( *(cur-2) == '*' )
+               {
+                       --level;
+                       if ( level == 0 )
+                               break;
+               }
+               else
+               if ( *cur == '*' )
+               {
+                       ++cur;
+                       ++cur;
+
+                       ++level;
+               }
+
+       } while(1);
+}
+
+static inline void clear_commets_queue()
+{
+       _gCQSize = 0;
+}
+
+static inline void skip_quoted_string( char*& cur )
+{
+       ++cur; // skip first quote '"'
+
+       // check if quote wasn't prefixed
+       if ( *(cur-2) == '\\' )
+               return;
+
+       do
+       {
+               while ( *cur != '"' && cur < _gSrcEnd )
+               {
+                       if ( *cur == 10 ) ++_gLineNo;
+                       ++cur;
+               }
+
+               if ( cur >= _gSrcEnd ) return;
+
+               ++cur; // skip the last quote
+
+               // check if it wasn't prefixed
+
+               if ( *(cur-2) != '\\' )
+                       break;
+
+       } while (1);
+}
+
+// skips subsequent white space and comments
+// (return false if the end of source code reached)
+
+static inline bool get_next_token( char*& cur )
+{
+       for( ; cur < _gSrcEnd; ++cur )
+       {
+               switch( *(cur) ) 
+               {
+                       case ' ' : continue;
+                       case '\t': continue;
+                       case 13  : continue;
+
+                       case 10  : { ++_gLineNo;continue; }
+
+                       case '/' : skip_comments( cur );
+                                          --cur;
+                                      continue;
+                       
+                       default : break;
+               };
+
+               break;
+       }
+
+       if ( cur >= _gSrcEnd )
+
+               return FALSE;
+       else
+               return TRUE;
+}
+
+static inline void skip_preprocessor_dir( char*& cur )
+{
+       do
+       {
+               skip_to_eol(cur);
+
+               if ( *(cur-1) != '\\' ) 
+                       break;
+
+               if ( cur < _gSrcEnd )
+                       skip_eol( cur );
+               else
+                       break;
+
+       } while(1);
+}
+
+static void skip_token( char*& cur )
+{
+       if ( *cur == '"' )
+       {
+               skip_quoted_string( cur );
+               return;
+       }
+
+       if ( *cur == ',' || 
+                *cur == ';' ||
+                *cur == '<' ||
+                *cur == '>' ||
+                *cur == '=' ||
+                *cur == ')' ||
+                *cur == '(' 
+          )
+       {
+               ++cur;
+               return;
+       }
+
+       ++cur; // leading character is always skipped
+
+       for( ; cur < _gSrcEnd ; ++cur )
+       {
+               switch ( *cur )
+               {
+                       case ' ' : break;
+                       case '\t': break;
+                       case 13  : break;
+                       case 10  : break;
+                       case ',' : break;
+                       case ';' : break;
+                       case '<' : break;
+                       case '>' : break;
+
+                       // FIXME:: QUICK-HACK:: to treat scope resolution
+                       //         tokens are a part of the string - e.g. SomeSpace::SubName would
+                   //         become one token
+
+                       case ':' : if ( *(cur+1) == ':' ) 
+                                          {
+                                                  ++cur;
+                                                  continue;
+                                          }
+
+                                          break;
+                       case '=' : break;
+                       case '(' : break;
+                       case ')' : break;
+                       case '{' : break;
+                       case '}' : break;
+
+                       default : continue;
+               };
+               break;
+       }
+}
+
+static inline size_t get_token_len( char* tok )
+{
+       char* start = tok;
+
+       skip_token( tok );
+
+       return size_t( tok - start );
+}
+
+// returns true, if given tokens are equel
+
+static inline bool cmp_tokens( char* tok1, char* tok2 )
+{
+       // NOTE:: the case one token includes 
+       //        other in it's entirely is not handled
+
+       size_t len = get_token_len( tok1 );
+
+       // assuming that tokens are non-zero length
+
+       do
+       {
+               if ( *(tok1++) != *(tok2++) )
+                       return FALSE;
+
+               --len;
+
+       } while ( --len );
+
+       return TRUE;
+}
+
+static inline bool cmp_tokens_fast( char* tok1, char* tok2, size_t len )
+{
+       do
+       {
+               if ( *(tok1++) != *(tok2++) )
+                       return FALSE;
+
+       } while ( --len );
+
+       return TRUE;
+}
+
+static inline void skip_tempalate_statement( char*& cur )
+{
+       size_t level = 0;
+
+       // go one level deeper
+       while( *cur != '<' && cur < _gSrcEnd )
+       {
+               if (*cur == 10 ) ++_gLineNo;
+               ++cur;
+       }
+
+       // FIXME:: template should be checked statement for 
+       //         comments inside of it
+
+       do
+       {
+               if ( *cur == '<' )
+                       ++level;
+               else
+                       --level;
+
+               ++cur; // skip '<' or '>' token
+
+               if ( level == 0 )
+                       return;
+
+               while( *cur != '<' && *cur != '>' && cur < _gSrcEnd )
+               {
+                       if (*cur == 10 ) ++_gLineNo;
+                       ++cur;
+               }
+
+       } while (1);
+}
+
+static inline void skip_statement( char*& cur )
+{
+       for( ; cur < _gSrcEnd; ++cur )
+
+               switch (*cur)
+               {
+                       case  ';' : ++cur; // skip statement-terminator token
+                                       return;
+
+                       case  '"' : skip_quoted_string(cur);
+                                               --cur;
+                                               continue;
+
+                       case  10  : ++_gLineNo;
+
+                                               continue;
+                       case  '/' : skip_comments( cur );
+                                               --cur;
+                                               continue;
+                       default : continue;
+               }
+}
+
+// "reversed" versions of skip_token() and get_next_token()
+
+static inline void skip_token_back( char*& cur )
+{
+       // FIXME:: now, when moving backwards, neither strings nor
+       //         comment blocks are checked
+
+       --cur; // skip to the trailing character
+
+       if ( *cur == ',' ||
+                *cur == ')' ||
+                *cur == '(' 
+          )
+          return;
+
+
+       for( ; cur < _gSrcEnd ; --cur )
+       {
+               switch ( *cur )
+               {
+                       case ' ' : break;
+                       case '\t': break;
+                       case 13  : break;
+                       case 10  : break;
+                       case ',' : break;
+                       case '(' : break;
+
+                       default : continue;
+               };
+
+               break;
+       }
+
+       ++cur; // get to the leading character of the token
+}
+
+static inline void skip_next_token_back( char*& cur )
+{
+       --cur; // skip leading character of the current token
+
+       if ( *cur == ',' ||
+                *cur == ')' ||
+                *cur == '(' 
+          )
+       {
+          ++cur;
+          return;
+       }
+
+       for( ; cur < _gSrcEnd; --cur )
+       {
+               switch ( *cur )
+               {
+                       case ' ' : continue;
+                       case '\t': continue;
+                       case 13  : continue;
+                       case 10  : continue;
+                       case ',' : continue;
+                       case '(' : continue;
+
+                       default : break;
+               };
+
+               break;
+       }
+
+       ++cur; // position after the trailing charcter of the prev token
+}
+
+static string get_token_str( char* cur )
+{
+       return string( cur, get_token_len( cur ) );
+}
+
+// skips token or whole expression which may have
+// nested  expressions between '(' ')' brackets.
+//
+// Upon return, the cursor points to the terminating bracket ')',
+//
+// Return value is the size of the block
+
+static size_t skip_block( char*& cur )
+{
+       size_t level = 0; // nesting level
+
+       char* start = cur;
+
+       // NOTE:: assumed that block not necessarely starts 
+       //        with bracket rightaway 
+
+       if ( *cur == '(' )
+       {
+               ++level;
+       }
+
+       do
+       {
+               skip_token( cur );
+
+               char* savedPos = cur;
+               int tmpLnNo;
+               store_line_no( tmpLnNo );
+
+               get_next_token( cur );
+
+               if ( cur >= _gSrcEnd ) return 0;
+
+               if ( *cur == '(' )
+               {
+                       ++level;
+               }
+               else
+               if ( *cur == ')' )
+               {
+                       if ( level == 0 )
+                       {
+                               cur = savedPos;
+                               restore_line_no( tmpLnNo );
+
+                               return size_t(cur-start);
+                       }
+
+                       --level;
+
+                       if ( level == 0 )
+                       { 
+                               ++cur;
+
+                               // QUICK-HACK::to easily handle function prototypes ,
+                               // it works, besause theoretically there should
+                               // be no cast-expressions in non-implementation 
+                               // scope (e.g. "time( (long*)(ptr+1) )" should not
+                               // appear in the declarations, thus it is most likelly 
+                               // for the ")(" fragment to be within a function 
+                               // prototype in the declarations scope
+
+                               if ( *cur == '(' )
+                               {
+                                       ++level;
+                                       continue;
+                               }
+
+                               else return size_t(cur-start);
+                       }
+               }
+               else
+               {
+                       if ( level == 0 )
+                       {
+                               cur = savedPos;
+                               restore_line_no( tmpLnNo );
+
+                               return size_t(cur-start);
+                       }
+               }
+
+       } while(1);
+}
+
+// returns 0, if end of source reached
+static inline bool skip_imp_block( char*& cur )
+{
+       while( *cur != '{' && cur < _gSrcEnd ) 
+       {
+               skip_token( cur );
+               if ( !get_next_token( cur ) ) return FALSE;
+       }
+
+       while( *cur != '}' && cur < _gSrcEnd ) 
+       {
+               skip_token( cur );
+               if ( !get_next_token( cur ) ) return FALSE;
+       }
+
+       ++cur;
+
+       return TRUE;
+}
+
+static bool is_class_token( char*& cur )
+{
+       // FIXME:: the below mess should be cleaned in it's entirely
+
+       if ( *cur == 'i' )
+               if ( *(cur+1) == 'n' )
+
+                       return cmp_tokens_fast( cur, "interface", 9 );
+
+       if ( *cur == 'c' )
+               if ( *(cur+1) == 'l' )
+
+                       return cmp_tokens_fast( cur, "class", 5 );
+
+       if ( *cur == 's' )
+               if ( *(cur+1) == 't' )
+
+                       return cmp_tokens_fast( cur, "struct", 6 );
+
+       if ( *cur == 'u' )
+               if ( *(cur+1) == 'n' )
+
+                       return cmp_tokens_fast( cur, "union", 5 );
+
+       return FALSE;
+}
+
+inline static bool is_forward_decl( char* cur )
+{
+       do
+       {
+               switch( *cur )
+               {
+                       case ':' : return FALSE;
+                       case '{' : return FALSE;
+                       case '(' : return FALSE;
+
+                       case ';' : return TRUE; 
+
+                       default : break;
+               };
+
+               ++cur;
+
+       } while (cur < _gSrcEnd); // prevent running out of bounds
+
+       return FALSE;
+}
+
+inline static bool is_function( char* cur, bool& isAMacro )
+{
+       isAMacro = FALSE;
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+       // NOTE:: comments and quoted strings are not checked here
+
+       // first,check for "single-line hanginging macros" like:
+       // ___UNICODE
+       //
+
+       char* eol = cur;
+       skip_to_eol( eol );
+
+       skip_token( cur );
+       get_next_token( cur );
+
+       if ( cur > eol )
+       {
+               isAMacro = TRUE;
+               restore_line_no( tmpLnNo );
+
+               return TRUE;
+       }
+
+       // it's not a macro, go to the begining of arg. list
+       
+       do
+       {
+               // if bracket found, it's a function or a begining
+               // of some macro 
+               if ( *cur == '(' )
+               {
+                       restore_line_no( tmpLnNo );
+                       return TRUE;
+               }
+
+               // end of statement found without any brackets in it
+               // - it cannot be a function 
+
+               if ( *cur == ';' ) 
+               {
+                       restore_line_no( tmpLnNo );
+                       return FALSE;
+               }
+
+               ++cur;
+
+       } while( cur < _gSrcEnd);
+
+       isAMacro = 1;
+       restore_line_no( tmpLnNo );
+
+       return FALSE;
+}
+
+// upon return the cursor is positioned after the
+// terminating curly brace 
+
+static inline void skip_scope_block( char*& cur )
+{
+       size_t level = 0;
+
+       for( ; cur < _gSrcEnd ; ++cur )
+
+               switch( *cur )
+               {
+                       case '/' : skip_comments( cur );
+                                          --cur;
+                                          continue;
+                       case '"' : skip_quoted_string( cur );
+                                          --cur;
+                                          continue;
+
+                       case '{' : ++level;
+                                          continue;
+
+                       case '}'  :--level;
+                                          if ( level == 0 ) 
+                                          {
+                                                  ++cur; // skip final closing curly brace
+                                                  return;
+                                          }
+
+                       case 10 : ++_gLineNo; continue;
+
+                       default : continue;
+               };
+}
+
+// moves tokens like '*' '**', '***', '&' from the name
+// to the type
+
+static void arrange_indirection_tokens_between( string& type,
+                                                                                           string& identifier )
+{
+       // TBD:: FIXME:: return value of operators !
+
+       while ( identifier[0] == '*' ||
+                   identifier[0] == '&' 
+                 ) 
+       {
+               type += identifier[0];
+               identifier.erase(0,1);
+
+               if ( !identifier.length() ) return;
+       }
+}
+
+
+// the only function where multi-lang keyword map is accessed
+
+static bool is_keyword( char* cur )
+{
+       size_t len = get_token_len( cur );
+
+       // put a terminating zero after the given token 
+       char tmp = *(cur + len);
+       *(cur+len) = '\0';
+
+       KeywordMapT::iterator i; 
+
+       i = __gMultiLangMap.find( cur );
+       
+       // restore original character suppresed by terminating zero
+       *(cur + len) = tmp;
+       
+       return ( i != __gMultiLangMap.end() );
+}
+
+static inline void get_string_between( char* start, char* end, 
+                                                                          string* pStr )
+{
+       char saved = *end;
+
+       *end  = '\0';
+       *pStr = start;
+       *end  = saved;
+}
+
+static char* set_comment_text( string& text, char* start )
+{
+       char* end = start;
+
+       // to avoid poluting the queue with this comment
+       _gLastSuppresedComment = start;
+
+       skip_comments( end );
+
+       if ( *(end-1) == '/' ) 
+               end -= 2;
+
+       start += 2;
+
+       // skip multiple leading '/''s or '*''s 
+       while( *start == '/' && start < end ) ++start;
+       while( *start == '*' && start < end ) ++start;
+
+       get_string_between( start, end, &text );
+
+       return end;
+}
+
+/***** Implementation for class CJSourceParser *****/
+
+CJSourceParser::CJSourceParser( bool collectCommnets, bool collectMacros )
+       : mpStart(0),
+         mpEnd(0),
+         mpCurCtx( 0 ),
+         mCommentsOn( collectCommnets ),
+         mMacrosOn  ( collectMacros )
+{
+       check_keyword_map();
+}
+
+spFile* CJSourceParser::Parse( char* start, char* end )
+{
+       // set up state variables
+       mCurVis       = SP_VIS_PRIVATE;
+
+       spFile* pTopCtx = new spFile();
+       mpCurCtx        = pTopCtx;
+
+       mIsVirtaul    = 0;
+       mIsTemplate   = 0;
+       mNestingLevel = 0;
+
+       cur = start;
+
+       mpStart = start;
+       mpEnd   = end;
+
+       _gSrcEnd   = mpEnd; // let all the C-functions "smell" the end of file
+       _gSrcStart = start;
+
+       _gLineNo   = 0;
+
+       clear_commets_queue();
+
+       // main parsing loop
+
+       do
+       {
+               if ( !get_next_token( cur ) ) 
+                       // end of source reached
+                       return pTopCtx;
+
+               if ( memcmp( cur, "ScriptSection( const string&", 
+                                strlen( "ScriptSection( const string&" ) 
+                                  ) == 0 
+                       )
+               {
+                       int o;
+                       ++o;
+               }
+
+               switch (*cur)
+               {
+                       case '#' :
+                               {
+                                       AddMacroNode( cur );            
+                                       continue;
+                               }
+                       
+                       case ':' :
+                               {
+                                       skip_token( cur );
+                                       continue;
+                               }
+
+                       case ';' :
+                               {
+                                       skip_token( cur );
+                                       continue;
+                               }
+
+                       case ')' :
+                               {
+                                       skip_token( cur );
+                                       continue;
+                               }
+
+                       case '=' : 
+                               {
+                                       skip_token( cur );
+                                       continue;
+                               }
+
+                       default: break;
+               }
+
+               if ( is_keyword( cur ) )
+               {
+                       // parses, token, if token identifies
+                       // the container context (e.g. class/namespace)
+                       // the corresponding context object is created
+                       // and set as current context
+
+                       ParseKeyword( cur );
+                       continue;
+               }
+
+               if ( *cur >= '0' && *cur <= '9' ) 
+               {
+                       skip_token( cur );
+                       continue;
+               }
+
+               if ( *cur == '}' )
+               {
+                       if ( mCurCtxType != SP_CTX_CLASS )
+                       {
+                               // FOR NOW:: disable the below assertion 
+
+                               // DBG:: unexpected closing-bracket found
+                               //ASSERT(0);
+
+                               skip_token( cur ); // just skip it
+                               continue;
+                       }
+
+                       if ( mpCurCtx->GetType() == SP_CTX_CLASS )
+                       {
+                               int curOfs = ( (cur+1) - _gSrcStart );
+
+                               mpCurCtx->mContextLength = ( curOfs - mpCurCtx->mSrcOffset );
+                       }
+
+                       --mNestingLevel;
+
+                       // terminate operation/class/namespace context 
+                       // TBD:: check if it's really this type of context
+
+                       wxASSERT( mpCurCtx );
+                       mpCurCtx = mpCurCtx->GetOutterContext();
+                       wxASSERT( mpCurCtx );
+
+                       if ( mNestingLevel == 0 )
+                       {
+
+                               mCurCtxType = SP_CTX_FILE;
+
+                               // not-nested class delclaration finished,
+                               // rest template flag in any case
+                               mIsTemplate = 0;
+                       }
+
+                       skip_token( cur );
+                       continue;
+               }
+
+               bool isAMacro = 0;
+
+               if ( is_function( cur, isAMacro ) )
+               {
+                       if ( isAMacro )
+                       {
+                               skip_token( cur );
+                               continue;
+                       }
+
+                       char* savedPos = cur;
+
+                       int tmpLnNo;
+                       store_line_no( tmpLnNo );
+
+                       isAMacro = FALSE;
+
+                       if ( !ParseNameAndRetVal( cur, isAMacro ) )
+                       {
+                               if ( !isAMacro )
+                               {
+                                       cur = savedPos;
+                                       SkipFunction( cur );
+                               }
+                               continue;
+                       }
+
+                       if ( !ParseArguments( cur ) )
+                       {
+                               // failure while parsing arguments,
+                               // remove enclosing operation context
+
+                               spContext* pFailed = mpCurCtx;
+                               mpCurCtx = mpCurCtx->GetOutterContext();
+                               mpCurCtx->RemoveChild( pFailed );
+
+                               skip_to_eol( cur );
+                               //cur = savedPos;
+                       }
+                       else
+                       {
+                               // otherwise, successfully close operation context:
+
+                               clear_commets_queue();
+
+                               SkipFunctionBody( cur );
+
+                               mpCurCtx = mpCurCtx->GetOutterContext();
+
+                               // DBG::
+                               wxASSERT( mpCurCtx );
+
+                       }
+               }
+               else // otherwise it's declaration of a variable;
+               {
+                       // now, the cursor point to the end of statement (';' token)
+
+                       if ( mCurCtxType != SP_CTX_CLASS )
+                       {
+                               // non-class members are ignored
+
+                               skip_token( cur ); // skip the end of statement
+                               continue;
+                       }
+
+                       ParseMemberVar( cur );
+               }
+
+       } while( 1 );
+}
+
+void CJSourceParser::AttachComments( spContext& ctx, char* cur )
+{
+       if ( !mCommentsOn ) return;
+
+       MCommentListT& lst = ctx.GetCommentList();
+
+       char* prevComEnd = 0;
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+       // attach comments which were found before the given context
+
+       for( int i = 0; i != _gCQSize; ++i )
+       {
+               spComment* pComment = new spComment();
+               lst.push_back( pComment );
+
+               // find the end of comment
+               char* start = _gCommentsQueue[i];
+
+               pComment->mIsMultiline = ( *(start+1) == '*' );
+
+               // first comment in the queue and multiline 
+               // comments are always treated as a begining 
+               // of the new paragraph in the comment text
+
+               if ( i == 0 )
+
+                       pComment->mStartsPar = TRUE;
+               else
+               if ( pComment->mIsMultiline )
+
+                       pComment->mStartsPar = TRUE;
+               else
+               {
+                       // find out wheather there is a new-line
+                       // between to adjecent comments
+
+
+                       char* prevLine = start;
+                       skip_to_prev_line(prevLine);
+
+                       if ( prevLine >= prevComEnd )
+                       
+                               pComment->mStartsPar = TRUE;
+                       else
+                               pComment->mStartsPar = FALSE;
+               }
+
+               prevComEnd = set_comment_text( pComment->mText, start );
+       }
+
+
+       // attach comments which are at the end of the line
+       // of the given context (if any)
+
+       if ( skip_to_next_comment_in_the_line( cur ) )
+       {
+               spComment* pComment = new spComment();
+               lst.push_back( pComment );
+       
+               set_comment_text( pComment->mText, cur );
+
+               pComment->mStartsPar = 1;
+               pComment->mIsMultiline = ( *(cur+1) == '*' );
+
+               // mark this comment, so that it would not
+               // get in the comments list of the next context
+               _gLastSuppresedComment = cur;
+       }
+
+       restore_line_no( tmpLnNo );
+
+       clear_commets_queue();
+}
+
+void CJSourceParser::AddMacroNode( char*& cur )
+{
+       char* start = cur;
+
+       int lineNo = get_line_no();
+
+       skip_preprocessor_dir( cur );
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+       if ( !mMacrosOn ) return;
+
+       spPreprocessorLine* pPL = new spPreprocessorLine();
+       pPL->mSrcLineNo = lineNo;
+
+       AttachComments( *pPL, cur );
+
+       get_string_between( start, cur, &pPL->mLine );
+
+       ++start; // skip '#'
+       get_next_token( start );
+       
+       pPL->mDefType = SP_PREP_DEF_OTHER;
+
+       // if we found a definition or redefinition,
+       // determine the type exactly and assign
+       // a name to the context
+
+       if ( *start == 'd' )
+       {
+               if ( cmp_tokens_fast( start, "define", 6 ) )
+               {
+                       char* tok = start+6;
+
+                       get_next_token( tok );
+
+                       pPL->mName = get_token_str( tok );
+
+                       skip_token( tok );
+                       get_next_token( tok);
+
+
+                       if ( tok > cur )
+                               pPL->mDefType = SP_PREP_DEF_DEFINE_SYMBOL;
+                       else
+                               pPL->mDefType = SP_PREP_DEF_REDEFINE_SYMBOL;
+               }
+       }
+       else
+       if ( *start == 'i' )
+
+               if ( cmp_tokens_fast( start, "include", 7 ) )
+               {
+                       pPL->mDefType = SP_PREP_DEF_INCLUDE_FILE;
+               }
+
+       mpCurCtx->AddMember( pPL );
+
+       restore_line_no( tmpLnNo );
+
+       clear_commets_queue();
+}
+
+void CJSourceParser::ParseKeyword( char*& cur )
+{
+       // analyze token, which identifies the begining of a new context
+
+       if ( CheckVisibilty( cur ) )
+       {
+               skip_token( cur );
+               return;
+       }
+
+       if ( is_class_token( cur ) )
+       {
+               if ( is_forward_decl( cur ) )
+               {
+                       // forward declarations are ignored;
+                       skip_token( cur );
+                       return;
+               }
+
+               if ( mNestingLevel == 0 )
+               {
+                       // change context form global class context
+                       mCurCtxType = SP_CTX_CLASS;
+               }
+
+               ++mNestingLevel;
+
+               // add information about new class (name, inheritance, etc)
+               AddClassNode( cur );
+
+               // the default visiblity for class members is 'private'
+               mCurVis = SP_VIS_PRIVATE;
+
+               return;
+       }
+
+       size_t len = get_token_len( cur );
+
+       if ( cmp_tokens_fast( cur, "typedef", len  ) )
+       {
+               skip_token(cur);
+               get_next_token(cur);
+
+               if ( cmp_tokens_fast( cur, "struct", len ) ||
+                        cmp_tokens_fast( cur, "union",  len ) ||
+                        cmp_tokens_fast( cur, "class",  len )
+                  )            
+               {
+                       if ( mNestingLevel == 0 )
+                       {
+                               // change context form global class context
+                               mCurCtxType = SP_CTX_CLASS;
+                       }
+
+                       ++mNestingLevel;
+
+                       // add information about new class (name, inheritance, etc)
+                       AddClassNode( cur );
+
+                       // the default visiblity for class members is 'private'
+                       mCurVis = SP_VIS_PRIVATE;
+
+                       return;
+
+                       // FOR NOW:: typedef struct, etc are also ignored 
+                       //skip_scope_block( cur );
+               }
+
+               if ( cmp_tokens_fast( cur, "enum", len  ) )
+               {
+                       AddEnumNode( cur );
+                       return;
+               }
+
+               AddTypeDefNode( cur );
+
+               return;
+       }
+
+       if ( cmp_tokens_fast( cur, "enum", len ) )
+       {
+               AddEnumNode( cur );
+               return;
+       }
+
+       if ( cmp_tokens_fast( cur, "extern", len ) )
+       {
+               // extern's are ignored (both extern "C" and extern vars)
+               while ( *cur != '{' &&
+                           *cur != ';' )
+               {
+                       skip_token( cur );
+                       get_next_token( cur );
+               }
+               return;
+                                   
+       }
+       if ( cmp_tokens_fast( cur, "enum", len ) )
+       {
+               // enumeration blocks are ignored
+
+               skip_scope_block( cur );
+
+               get_next_token( cur );
+               skip_token( cur ); // skip ';' token;
+               return;
+       }
+
+       if ( cmp_tokens_fast( cur, "package", len  ) )
+       {
+               // packages are ignored
+               skip_statement( cur );
+               return;
+       };
+
+       if ( cmp_tokens_fast( cur, "import", len  ) )
+       {
+               // import statements are ignored
+               skip_statement( cur );
+               return;
+       }
+
+       if ( cmp_tokens_fast( cur, "virtual", len  ) )
+       {
+               // probably the virtual method is in front of us;
+               mIsVirtaul = 1;
+               skip_token( cur );
+               return;
+       }
+
+       if ( cmp_tokens_fast( cur, "template", len  ) )
+       {
+               mIsTemplate = 1;
+               skip_tempalate_statement( cur );
+               return;
+       }
+
+       if ( cmp_tokens_fast( cur, "friend", len  ) )
+       {
+               skip_statement( cur );
+               return;
+       }
+
+       // ingnore "unsigificant" tokens (i.e. which do not
+       // affect the current parsing context)
+
+       skip_token( cur );
+}
+
+bool CJSourceParser::ParseNameAndRetVal( char*& cur, bool& isAMacro )
+{
+       isAMacro = FALSE;
+
+       // FOR NOW:: all functions in the global
+       //           scope are ignored
+
+       int lineNo = get_line_no();
+
+       char* start = cur;
+
+       while( *cur != '(' )
+       {
+               skip_token( cur );
+               if ( !get_next_token( cur ) ) return FALSE;
+       }
+
+       char* bracketPos = cur;
+       char* savedPos   = cur + 1;
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+       // skip gap between function name and start of paramters list
+       while ( *(cur-1) == ' ' )
+               --cur;
+
+       // check if it's not a macro, and let plugin handle it, if so
+
+       if ( mpPlugin )
+       {
+               skip_token_back( cur );
+
+               char* tmp = cur;
+
+               if ( mpPlugin->CanUnderstandContext( tmp, _gSrcEnd, mpCurCtx ) )
+               {
+                       cur = tmp;
+
+                       mpPlugin->ParseContext( _gSrcStart, cur, _gSrcEnd, mpCurCtx );
+
+                       isAMacro = TRUE;
+
+                       return FALSE;
+               }
+       }
+
+       spOperation* pOp = new spOperation();
+
+       pOp->mSrcLineNo    = lineNo;
+       pOp->mSrcOffset    = int( start - _gSrcStart );
+       pOp->mHeaderLength = int( bracketPos - start );
+
+       mpCurCtx->AddMember( pOp );
+       pOp->mVisibility = mCurVis;
+
+       // add comments about operation
+       AttachComments( *pOp, cur );
+
+       // go backwards to method name
+       skip_token_back( cur );
+
+       pOp->mName = get_token_str( cur );
+
+       // go backwards to method return type
+       skip_next_token_back( cur );
+
+       if ( cur >= start )
+
+               pOp->mRetType = string( start, size_t( cur-start ) );
+
+       arrange_indirection_tokens_between( pOp->mRetType, pOp->mName );
+
+       cur = savedPos;
+       restore_line_no( tmpLnNo );
+
+       // now, enter operation context
+       mpCurCtx = pOp;
+
+       return TRUE;
+}
+
+bool CJSourceParser::ParseArguments( char*& cur )
+{
+       // DANGER-MACROS::
+
+       // now cursor position is right after the first opening bracket
+       // of the function declaration
+
+       char* blocks    [16]; // used exclusivelly for iterative "lean out"
+                                                 // of macros and misc. not-obviouse grammar
+                                                 // (dirty,, but we cannot do it very nice,
+                                                 //  we're not preprocessor-free C/C++ code)
+       int   blockSizes[16];
+
+       do
+       {
+               size_t blocksSkipped = 0;
+
+               get_next_token( cur );
+
+               bool first_blk = 1;
+
+               while( *cur != ')' && *cur != ',' )
+               {
+                       blocks[blocksSkipped] = cur;
+
+                       if ( first_blk )
+                       {
+                               char* prev = cur;
+                               skip_token( cur );
+
+                               blockSizes[blocksSkipped] = size_t(cur-prev);
+
+                               first_blk = 0;
+                       }
+                       else
+                               blockSizes[blocksSkipped] = skip_block( cur );
+
+                       get_next_token( cur );
+                       ++blocksSkipped;
+               }
+
+
+               if ( blocksSkipped == 1 ) 
+               {
+                       // check if the empty arg. list stressed with "void" inside
+                       if ( cmp_tokens_fast( blocks[0] , "void", 4 ) )
+                               return TRUE;
+
+                       // FIXME:: TBD:: K&R-style function declarations!
+
+                       // if only one block enclosed, than it's probably
+                       // some macro, there should be at least two blocks,
+                       // one for argument type and another for it's identifier
+                       return FALSE;
+               }
+
+               if ( blocksSkipped == 0 )
+               {
+                       if ( *cur == 10 ) ++_gLineNo;
+                       ++cur;
+                       break; // function without paramters
+               }
+
+               // we should be in the operation context now
+               spOperation* pOp = (spOperation*)mpCurCtx;
+
+               spParameter* pPar = new spParameter();
+
+               pOp->AddMember( pPar );
+               // FOR NOW:: line number is not exact if argument list is mutiline
+               pPar->mSrcLineNo = get_line_no();
+
+               size_t nameBlock = blocksSkipped - 1;
+               size_t typeBlock = nameBlock - 1;
+
+               // check if default values present
+               if ( *blocks[typeBlock] == '=' )
+               {
+                       // expressions like "int = 5" are ignored,
+                       // since name for paramters is required
+                       if ( blocksSkipped == 3 )
+                       {
+                               if ( *cur == ')' )
+                               {
+                                       ++cur;
+                                       break;
+                               }
+                       else
+                               continue;
+                       }
+
+                       pPar->mInitVal = string( blocks[nameBlock], blockSizes[nameBlock] );
+
+                       nameBlock = nameBlock - 2; // skip '=' token and default value block
+                       typeBlock = nameBlock - 1;
+               }
+
+               // attach comments about the parameter
+               AttachComments( *pPar, blocks[nameBlock] );
+
+               // retrieve argument name
+               pPar->mName = string( blocks[nameBlock], blockSizes[nameBlock] );
+
+               // retreive argument type
+
+               size_t len = blockSizes[ typeBlock ];
+               len = size_t ( (blocks[ typeBlock ] + len) - blocks[ 0 ] );
+
+               pPar->mType = string( blocks[0], len );
+               
+               arrange_indirection_tokens_between( pPar->mType, pOp->mName );
+
+               if ( *cur == ')' )
+               {
+                       ++cur;
+                       break;
+               }
+
+               ++cur; // skip comma
+               get_next_token(cur);
+
+       } while(1);
+
+       // check if it was really a function not a macro,
+       // if so, than it should be terminated with semicolon ';'
+       // or opening implemenetaton bracket '{'
+
+       char* tok = cur;
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+       do
+       {
+               if ( *tok == '{' || *tok == ';' ) 
+               {
+                       restore_line_no(tmpLnNo);
+                       return TRUE;
+               }
+
+               // check for unexpected tokens
+               if ( *tok == '=' || *tok == '0' ) 
+               {
+                       skip_token(tok);
+                       if ( !get_next_token(tok) ) return FALSE;
+                       continue;
+               }
+
+               if ( *tok == '}' ) return FALSE;
+
+               // if initialization list found
+               if ( *tok == ':' ) 
+               {
+                       restore_line_no(tmpLnNo);
+                       return TRUE;
+               }
+
+               if ( cmp_tokens_fast( tok, "const", 5 ) )
+               {
+                       skip_token(tok);
+                       if ( !get_next_token(tok) ) return FALSE;
+                       continue;
+               }
+
+               if ( CheckVisibilty( tok ) ) return FALSE;
+
+               // if next context found
+               if ( is_keyword( tok ) ) return FALSE;
+
+               skip_token(tok);
+               if ( !get_next_token(tok) ) return FALSE;
+
+       } while(1);
+       
+       return TRUE;
+}
+
+void CJSourceParser::ParseMemberVar( char*& cur )
+{
+       MMemberListT& members = mpCurCtx->GetMembers();
+
+       bool firstMember = 1;
+
+       size_t first = 0;
+
+       string type;
+
+       // jump to the end of statement
+       // and start collecting same-type varibles
+       // back-to-front towards the type identifier
+
+       skip_statement( cur );
+       char* savedPos = cur;
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+    --cur; // rewind back to ';'
+
+       do
+       {
+               spAttribute* pAttr = new spAttribute();
+               // FOR NOW:: line not is not exact, if member declaration is multiline
+               pAttr->mSrcLineNo = get_line_no();
+
+               mpCurCtx->AddMember( pAttr );
+               pAttr->mVisibility = mCurVis;
+
+               pAttr->mIsConstant = 0;
+
+               if ( firstMember )
+               {
+                       firstMember = 0;
+                       first = members.size() - 1;;
+               }
+
+               skip_token_back( cur );
+
+               // attach comments about the attribute
+               AttachComments( *pAttr, cur );
+
+               pAttr->mName = get_token_str( cur );
+
+               // guessing that this going to be variable type
+               skip_next_token_back( cur );
+               skip_token_back( cur );
+
+               pAttr->mType = get_token_str( cur );
+
+               // if comma, than variable list continues
+               // otherwise the variable type reached - stop
+
+               if ( *cur == '=' )
+               {
+                       // yes, we've mistaken, it was not a identifier,
+                       // but it's default value
+                       pAttr->mInitVal = 
+                               pAttr->mName;
+                       
+                       // skip default value and '=' symbol
+                       skip_next_token_back( cur );
+                       skip_token_back( cur );
+
+                       pAttr->mName = get_token_str( cur );
+
+                       skip_next_token_back( cur );
+                       skip_token_back( cur );
+               }
+
+               if ( *cur != ',' )
+               {
+                       type = get_token_str( cur );
+                       break;
+               }
+
+       } while(1);
+
+       // set up types for all collected (same-type) attributes;
+       while ( first != members.size() - 1 )
+       {
+               spAttribute* pAttr = (spAttribute*)members[first];
+
+               pAttr->mType       = type;
+               pAttr->mVisibility = mCurVis;
+
+               arrange_indirection_tokens_between( pAttr->mType, pAttr->mName );
+
+               ++first;
+       }
+
+       cur = savedPos;
+       restore_line_no( tmpLnNo );
+
+       clear_commets_queue();
+
+
+}
+
+void CJSourceParser::SkipFunction( char*& cur )
+{
+       while ( *cur != '(' && cur < _gSrcEnd ) 
+       {
+               if (*cur == 10 ) ++_gLineNo;
+               ++cur;
+       }
+
+       skip_next_token_back( cur ); // go back and skip function identifier
+       skip_token_back( cur );      // go back and skip return type
+
+       skip_block( cur );           // now, go ahead and skip whole declaration
+
+       SkipFunctionBody( cur );
+
+}
+
+void CJSourceParser::SkipFunctionBody( char*& cur )
+{
+       // FIXME:: check for comments and quoted stirngs here
+
+       bool hasDefinition = FALSE;
+
+       while( *cur != '{' && *cur != ';' )
+       {
+               if (*cur == 10 ) ++_gLineNo;
+               ++cur;
+       }
+
+       if ( *cur == ';' )
+       {
+               ++cur; 
+       }
+       else
+       {
+               hasDefinition = TRUE;
+
+               skip_scope_block( cur ); // skip the whole imp.
+       }
+
+       if ( mpCurCtx->GetType() == SP_CTX_OPERATION )
+       {
+               spOperation& op = *((spOperation*)mpCurCtx);
+
+               int curOfs = int ( cur - _gSrcStart );
+
+               op.mContextLength = curOfs - mpCurCtx->mSrcOffset;
+
+               op.mHasDefinition = hasDefinition;
+
+               // separate scope resolution token from the name of operation
+
+               for( size_t i = 0; i != op.mName.length(); ++i )
+               {
+                       if ( op.mName[i] == ':' && op.mName[i+1] == ':' )
+                       {
+                               string unscoped( op.mName, i+2, op.mName.length() - ( i + 2 ) );
+
+                               op.mScope = string( op.mName, 0, i );
+
+                               op.mName = unscoped;
+
+                               break;
+                       }
+               }
+       }
+}
+
+bool CJSourceParser::CheckVisibilty( char*& cur )
+{
+       size_t len = get_token_len( cur );
+
+       if ( cmp_tokens_fast( cur, "public:", len ) )
+       {
+               mCurVis = SP_VIS_PUBLIC;
+               return TRUE;
+       }
+
+       if ( cmp_tokens_fast( cur, "protected:", len ) )
+       {
+               mCurVis = SP_VIS_PROTECTED;
+               return TRUE;
+       }
+
+       if ( cmp_tokens_fast( cur, "private:", len ) )
+       {
+               mCurVis = SP_VIS_PRIVATE;
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+void CJSourceParser::AddClassNode( char*& cur )
+{
+       char* ctxStart = cur;
+
+       skip_token( cur ); // skip 'class' keyword
+       if ( !get_next_token( cur ) ) return;
+
+       // in C++
+       if ( *cur == ':' )
+       {
+               skip_token( cur );
+               get_next_token( cur );
+       }
+
+       spClass* pClass = new spClass();
+
+
+       mpCurCtx->AddMember( pClass );
+
+       // by default all class members are private
+       mCurVis       = SP_VIS_PRIVATE;
+
+       // attach comments about the class
+       AttachComments( *pClass, cur );
+
+       pClass->mSrcLineNo = get_line_no();
+
+       pClass->mSrcOffset = int( ctxStart - _gSrcStart );
+
+       char* nameTok = cur;
+       pClass->mName = get_token_str( cur );
+
+       bool isDerived = 0;
+
+       // DANGER-MACROS::
+
+       do
+       {
+               skip_token( cur );
+               if ( !get_next_token( cur ) ) return;
+
+               if ( *cur == ':' )
+               {
+                       isDerived = 1;
+
+                       char* tok = cur;
+
+                       int tmpLn;
+                       store_line_no( tmpLn );
+
+                       skip_next_token_back( tok );
+                       skip_token_back( tok );
+
+                       restore_line_no( tmpLn );
+
+                       // class name should precend ':' colon, thus
+                       // the one which was captured before was
+                       // proablty something else (like __dllexport MyClass : ... )
+
+                       if ( nameTok != tok )
+                       {
+                               pClass->mName = get_token_str( tok );
+                       }
+
+               }
+
+               if ( *cur == '{' )
+                       break;
+
+               if ( *cur == ',' ) 
+                       continue;
+
+               size_t len = get_token_len( cur );
+
+               // skip neglectable C++ modifieres
+               if ( cmp_tokens_fast( cur, "public", len ) )
+                       continue;
+
+               if ( cmp_tokens_fast( cur, "protected", len ) )
+                       continue;
+
+               if ( cmp_tokens_fast( cur, "private", len ) )
+                       continue;
+
+               if ( cmp_tokens_fast( cur, "virtual", len ) )
+                       continue;
+
+               // skip neglectable JAVA modifieres
+
+               if ( cmp_tokens_fast( cur, "extends", len ) )
+               {
+                       isDerived = 1;
+                       continue;
+               }
+
+               if ( cmp_tokens_fast( cur, "implements", len ) )
+               {
+                       isDerived = 1;
+                       continue;
+               }
+
+               // all we need to know is superclass or interface
+
+               char* tok = cur;
+               int tmpLn;
+               store_line_no( tmpLn );
+
+               skip_token(tok);
+               get_next_token(tok);
+
+               restore_line_no( tmpLn );
+               
+               if ( *tok != ':' && *cur != ':' )
+               
+                       pClass->mSuperClassNames.push_back( string( cur, len ) );
+
+       } while(1);
+
+       if ( !isDerived )
+       {
+               int tmpLn;
+               store_line_no( tmpLn );
+
+               while ( pClass->mSuperClassNames.size() )
+
+                       pClass->mSuperClassNames.erase( &pClass->mSuperClassNames[0] );
+
+               char* tok = cur;
+
+               // some non-obviouse token was following "class" keyword -
+               // we've confused it with class name - thus now we're reverting this mistake
+
+               skip_next_token_back( tok );
+               skip_token_back( tok );
+
+               pClass->mName = get_token_str( tok );
+
+               restore_line_no( tmpLn );
+       }
+
+
+       ++cur; // skip opening curly brace
+
+       pClass->mHeaderLength = ( cur - ctxStart );
+
+       // now, enter the class context
+       mpCurCtx = pClass;
+
+       clear_commets_queue();
+}
+
+void CJSourceParser::AddEnumNode( char*& cur )
+{
+       // now the cursor is at "enum" keyword
+       char* start = cur;
+
+       spEnumeration* pEnum = new spEnumeration();
+       mpCurCtx->AddMember( pEnum );
+
+       pEnum->mSrcLineNo = get_line_no();
+
+
+       AttachComments( *pEnum, cur );
+
+       skip_token( cur );
+       if ( !get_next_token( cur ) ) return;
+
+       // check if enumeration has got it's identifier
+       if ( *cur != '{' )
+       {
+               pEnum->mName = get_token_str( cur );
+       }
+
+       if ( !skip_imp_block( cur ) ) return;
+
+       get_string_between( start, cur, &pEnum->mEnumContent );
+
+       if ( get_next_token(cur) )
+       {
+               // check if the identifier if after the {...} block
+               if ( *cur != ';' )
+                       
+                       pEnum->mName = get_token_str( cur );
+       }
+
+       clear_commets_queue();
+}
+
+void CJSourceParser::AddTypeDefNode( char*& cur )
+{
+       // now the cursor at the token next to "typedef" keyword
+
+       if ( !get_next_token(cur) ) return;
+
+       char* start = cur;
+
+       spTypeDef* pTDef = new spTypeDef();
+       mpCurCtx->AddMember( pTDef );
+
+       pTDef->mSrcLineNo = get_line_no();
+
+       AttachComments( *pTDef, cur );
+
+       skip_statement( cur );
+
+       int tmpLnNo;
+       store_line_no( tmpLnNo );
+
+       char* tok = cur-1;
+       skip_next_token_back( tok );
+
+       char* nameEnd = tok;
+
+       skip_token_back( tok );
+
+       char* nameStart = tok;
+
+       skip_next_token_back( tok );
+
+       char* typeEnd = tok;
+
+       // check if it's function prototype
+       if ( *nameStart == ')' )
+       {
+               typeEnd = nameStart+1;
+
+               // skip argument list
+               while ( *nameStart != '(' ) --nameStart;
+
+               // skip to function type definition
+               while ( *nameStart != ')' ) --nameStart;
+               
+               skip_next_token_back( nameStart );
+
+               nameEnd = nameStart;
+
+               skip_token_back( nameStart );
+
+               if ( *nameStart == '*' ) ++nameStart;
+       }
+
+       get_string_between( start, typeEnd, &pTDef->mOriginalType );
+
+       get_string_between( nameStart, nameEnd, &pTDef->mName );
+
+       clear_commets_queue();
+
+       restore_line_no( tmpLnNo );
+}
diff --git a/utils/HelpGen/src/docripper.cpp b/utils/HelpGen/src/docripper.cpp
new file mode 100644 (file)
index 0000000..cdaff81
--- /dev/null
@@ -0,0 +1,568 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "docripper.h"
+
+#include <iostream.h>
+
+// script templates
+
+// ***** currently only HTML versions of variouse templates available ***** //
+
+static const char* HTM_TopTempl = 
+
+"<html><body bgcolor=#FFFFFF>\n\
+\n\n<!------ Automatically Generated by \"wxDocRipper\"------->\n\n\n\
+<p><h2>$(NAME)</h2><p>\n\
+<ul>\n\
+$(REFLIST)\
+</ul><p>\n\n\
+";
+
+static const char* HTM_ContentIdxTempl = 
+
+"\
+<a name=\"r$(ID)_$(NAME)\">\n\
+<p><hr>\n\
+<h2><p>$(NAME)<p></h2>\
+<ul>\n\
+$(REFLIST)\
+</ul><p>\n\n\
+";
+
+static const char* HTM_SuperContentTempl = 
+
+"\
+<a name=\"r$(ID)_$(NAME)\">\n\
+<p><hr>\n\
+<p><h2>$(NAME)<p></h2>\
+$(BODY)\n\
+";
+
+static const char* HTM_SubContentTempl = 
+
+"\
+<a name=\"r$(ID)_$(NAME)\">\n\
+<p><hr>\n\
+<p><h3>$(NAME)<p></h3>\
+$(BODY)\n\
+";
+
+static const char* HTM_OutLineTempl =
+
+"\
+<p>\n\
+<b><font color=\"#FF0000\">$(NAME)</font></b><p>\n\
+";
+
+static const char* HTM_OutLine1Templ =
+
+"\
+<p>\n\
+<b><i><font color=\"#101010\">$(NAME)</font></i></b>\n\
+<ul>\n\
+$(REFLIST)\
+</ul>\n\n\
+";
+
+static const char* HTM_RefTempl =
+
+"\
+<li><a href=\"#r$(ID)_$(NAME)\">$(NAME)</A>\n\
+";
+
+static const char* HTM_DeadRefTempl =
+
+"\
+<li></b>$(NAME)\n\
+";
+
+/***** Implementation for class RipperDocGen *****/
+
+RipperDocGen::RipperDocGen()
+
+       : mTopTempl         ( HTM_TopTempl ),
+         mContentIdxTempl  ( HTM_ContentIdxTempl ),
+         mSuperContentTempl( HTM_SuperContentTempl ),
+         mSubContentTempl  ( HTM_SubContentTempl ),
+         mOutLineTempl     ( HTM_OutLineTempl ),
+         mOutLine1Templ    ( HTM_OutLine1Templ ),
+
+         mRefTempl         ( HTM_RefTempl ),
+         mDeadRefTempl     ( HTM_DeadRefTempl ),
+
+         mpCurClassSect(0)
+{                                                                                                                                                                                         // topIndex is not referenced
+       mpTopIdx        = new ScriptSection( "Source Code Contents"       , "", &mTopTempl       , 0          );
+       mpClassIdx      = new ScriptSection( "Classes Reference"          , "", &mContentIdxTempl, &mRefTempl );
+       mpEnumIdx       = new ScriptSection( "Enumerations  Reference"    , "", &mContentIdxTempl,  &mRefTempl );
+       mpTypeDefIdx    = new ScriptSection( "Type Definitions Reference" , "", &mContentIdxTempl, &mRefTempl );
+       mpMacroIdx      = new ScriptSection( "Macros Reference"           , "", &mContentIdxTempl, &mRefTempl );
+       mpGlobalVarsIdx = new ScriptSection( "Global Variables Reference" , "", &mContentIdxTempl, &mRefTempl );
+       mpGlobalFuncIdx = new ScriptSection( "Global Functions  Reference", "", &mContentIdxTempl, &mRefTempl );
+       mpConstIdx      = new ScriptSection( "Constants  Reference"       , "", &mContentIdxTempl, &mRefTempl );
+
+       // assemble top index
+       mpTopIdx->AddSection( mpClassIdx     , 1 );
+       mpTopIdx->AddSection( mpEnumIdx      , 1 );
+       mpTopIdx->AddSection( mpTypeDefIdx   , 1 );
+       mpTopIdx->AddSection( mpMacroIdx     , 1 );
+       mpTopIdx->AddSection( mpGlobalVarsIdx, 1 );
+       mpTopIdx->AddSection( mpGlobalFuncIdx, 1 );
+       mpTopIdx->AddSection( mpConstIdx     , 1 );
+
+       // register reserved variables for index and description templates
+       ScriptSection::RegisterTemplate( mTopTempl );
+       ScriptSection::RegisterTemplate( mContentIdxTempl );
+       ScriptSection::RegisterTemplate( mSuperContentTempl );
+       ScriptSection::RegisterTemplate( mSubContentTempl );
+       ScriptSection::RegisterTemplate( mOutLineTempl );
+       ScriptSection::RegisterTemplate( mOutLine1Templ );
+       ScriptSection::RegisterTemplate( mRefTempl );
+       ScriptSection::RegisterTemplate( mDeadRefTempl );
+
+       // create the top-most (interfile) context
+       mpFileBinderCtx = new spFile();
+
+       // the default script is HTML
+       mTags = get_HTML_markup_tags();
+
+       mpParser = 0; // no default parser!
+}
+
+void RipperDocGen::Init( SourceParserBase* pParser )
+{
+       mpParser = pParser;
+}
+
+RipperDocGen::~RipperDocGen()
+{
+       delete mpFileBinderCtx;
+}
+
+void RipperDocGen::AppendComments( spContext& fromContext, string& str )
+{
+       if ( !fromContext.HasComments() ) return;
+
+       size_t start = str.length();
+
+       str += mTags[TAG_BOLD].end;
+       str += mTags[TAG_PARAGRAPH].start;
+
+       MCommentListT& lst = fromContext.GetCommentList();
+
+       for( size_t i = 0; i != lst.size(); ++i )
+       {
+       
+               if ( i != 0 )
+                       
+                       if ( lst[i]->StartsParagraph() )
+                       {
+                               str += mTags[TAG_PARAGRAPH].start;
+                       }
+       
+               str += lst[i]->mText;
+       }
+
+       // remove new lines, and insert paragraph breaks
+       // if empty lines found
+
+       size_t len = str.length();
+
+       for( size_t n = start; n != len; ++n )
+       
+               if ( str[n] == 10 || 
+                    str[n] == 13  ) 
+               {
+                       if ( n + 2 < len )
+                       {
+                               if ( ( str[n] == 13 && str[n+1] == 10 &&  // FIXME:: quick-hack
+                                          str[n+2] == 13 ) ||
+                                        ( str[n] == 10 && str[n+1] == 10 )
+                           )
+                               {
+                                       str.insert( n + 1, "<p>" ); // FIXME:: quick-hack
+                                       len += 3;
+                               }
+                       }
+
+                       str[n] = ' ';
+               }
+
+       str += mTags[TAG_PARAGRAPH].end;
+}
+
+void RipperDocGen::AppendMulitilineStr( string& st, string& mlStr )
+{
+       st = mTags[TAG_FIXED_FONT].start;
+       st += mlStr;
+       st += mTags[TAG_FIXED_FONT].end;
+}
+
+void RipperDocGen::AppendHighlightedSource( string& st, string source )
+{
+       // FIXME:: below should not be fixed :)
+       char buf[1024*32];
+
+       // DBG:::
+       ASSERT( source.length() + 1 < sizeof(buf) );
+
+       strcpy( buf, source.c_str() );
+                                               
+       // highlight things
+       mSrcPainter.Init();
+       mSrcPainter.ProcessSource( buf, strlen(buf) );
+       mSrcPainter.GetResultString( st, mTags );
+}
+
+bool RipperDocGen::CheckIfUncommented( spContext& ctx, ScriptSection& toSect )
+{
+       if ( ctx.HasComments() ) return 0;
+
+       toSect.AddReference( 
+               new ScriptSection( GetScopedName( ctx ), "", 0, &mDeadRefTempl )
+       );
+
+       return 1;
+}
+
+ScriptTemplate* RipperDocGen::GetRefTemplFor( spContext& ctx )
+{
+       if ( ctx.HasComments() )
+
+               return &mRefTempl;
+       else
+               return &mDeadRefTempl;
+}
+
+string RipperDocGen::GetScopedName( spContext& ofCtx )
+{
+       if ( ofCtx.IsInFile() ) return ofCtx.GetName();
+       else
+               return ofCtx.GetOutterContext()->GetName() + 
+                          "::" + ofCtx.GetName();
+}
+
+void RipperDocGen::AddToCurrentClass( ScriptSection* pSection, spContext& ctx, 
+                                                                         const char* subSectionName )
+{
+       string sName;
+
+       if ( ctx.mVisibility == SP_VIS_PROTECTED )
+
+               sName = "Protected members/";
+       else
+       if ( ctx.mVisibility == SP_VIS_PRIVATE )
+
+               sName = "Private members/";
+       else
+               sName = "Public members/";
+
+       sName += subSectionName;
+
+       ScriptSection* pSect = mpCurClassSect->GetSubsection( sName.c_str() );
+
+       if ( CheckIfUncommented( ctx, *pSect ) )
+       {
+               delete pSection;
+               return;
+       }
+
+       pSect->AddReference( pSection );
+
+       mpCurClassSect->AddSection( pSection );
+}
+
+void RipperDocGen::LinkSuperClassRefs()
+{
+       MMemberListT clLst;
+
+       // collect all classes in the context tree
+       mpFileBinderCtx->GetContextList( clLst, SP_CTX_CLASS );
+
+       for( size_t i = 0; i != clLst.size(); ++i )
+       {
+               spClass& cl = *((spClass*)clLst[i]);
+
+               // FIXME:: why sometimes GetUserData() returns NULL?
+               if ( !cl.GetUserData() )
+                       continue;
+
+               ScriptSection* pClSect = (ScriptSection*)cl.GetUserData();
+               ScriptSection* pSuperSect = pClSect->GetSubsection("Derived from");
+
+               for( size_t n = 0; n != cl.mSuperClassNames.size(); ++n )
+               {
+                       string& superClName = cl.mSuperClassNames[n];
+
+                       spClass* pFound = NULL;
+
+                       string* name;
+
+                       for( size_t k = 0; k != clLst.size(); ++k )
+                       {
+                               name = &clLst[k]->GetName();
+
+                               if ( clLst[k]->GetName() == superClName )
+                               {
+                                       pFound = (spClass*)clLst[k];
+                                       break;
+                               }
+                       }
+
+                       if ( !pFound )
+                       {
+                               ScriptSection* pNotFound = 
+                                       new ScriptSection( superClName, "", 0, &mDeadRefTempl );
+
+                               pSuperSect->AddReference( pNotFound );
+                       }
+                       else
+                               if ( pFound->GetUserData() )
+                               
+                                       pSuperSect->AddReference( 
+                                               (ScriptSection*)pFound->GetUserData() );
+               }
+       }
+}
+
+void RipperDocGen::ProcessFile( const char* sourceFile )
+{
+       cout << "Processing file " << sourceFile << "..." << endl;
+
+       spFile* pCtx = mpParser->ParseFile( sourceFile );
+
+       if ( pCtx == NULL )
+       {
+               cout << "Cannot open file " << sourceFile << ", skipped..." << endl;
+
+               return;
+       }
+
+       VisitAll( *pCtx, TRUE );
+
+       mpFileBinderCtx->AddMember( pCtx );
+}
+
+// implementations of "visiting procedures"
+
+void RipperDocGen::VisitEnumeration( spEnumeration& en )
+{
+       // FOR NOW:: do not reference "nameless" enums
+       if ( en.GetName() == "" ) return;
+
+       if ( CheckIfUncommented( en, *mpEnumIdx ) )
+               return;
+
+       string body;
+       body += mTags[TAG_BOLD].start;
+
+       AppendMulitilineStr( body, en.mEnumContent );
+
+       body += mTags[TAG_BOLD].end;
+
+       string line;
+       AppendHighlightedSource( line, body );
+       AppendComments( en, line );
+
+       mpEnumIdx->AddSection( 
+               new ScriptSection( en.GetName(), line, 
+                                                  &mSubContentTempl,
+                                                  GetRefTemplFor( en ) ), 1
+       );
+}
+
+void RipperDocGen::VisitTypeDef( spTypeDef& td )
+{
+       if ( CheckIfUncommented( td, *mpTypeDefIdx ) )
+               return;
+
+       string body;
+       body += mTags[TAG_BOLD].start;
+       body += "typdef ";
+       body += mTags[TAG_BOLD].end;
+
+       AppendMulitilineStr( body, td.mOriginalType );
+       body += td.mOriginalType;
+       body += ' ';
+
+       body += mTags[TAG_BOLD].start;
+       body += td.GetName();
+       body += mTags[TAG_BOLD].end;
+
+       string line;
+       AppendHighlightedSource( line, body );
+       AppendComments( td, line );
+
+       mpTypeDefIdx->AddSection( 
+               new ScriptSection( td.GetName(), line, 
+                                                  &mSubContentTempl,
+                                                  GetRefTemplFor( td ) ), TRUE
+       );
+}
+
+void RipperDocGen::VisitPreprocessorLine( spPreprocessorLine& pd )
+{
+       if ( pd.mDefType != SP_PREP_DEF_REDEFINE_SYMBOL )
+       
+               return;
+
+       if ( CheckIfUncommented( pd, *mpMacroIdx ) )
+               return;
+
+       string body;
+       body += mTags[TAG_FIXED_FONT].start;
+
+       string coloredLine = pd.mLine;
+       AppendHighlightedSource( coloredLine, pd.mLine );
+
+       AppendMulitilineStr( body, coloredLine );
+
+       body += mTags[TAG_FIXED_FONT].end;
+
+       AppendComments( pd, body );
+
+       mpMacroIdx->AddSection( 
+               new ScriptSection( pd.GetName(), body, 
+                                                  &mSubContentTempl,
+                                                  GetRefTemplFor( pd ) ), TRUE
+       );
+}
+
+void RipperDocGen::VisitClass( spClass& cl )
+{
+       // FOR NOW:: do not document nested classes -
+       //           nicier visiting method yet needed
+
+       if ( cl.IsInClass() )
+       {
+               SkipChildren(); // spVisitor's method
+               return;
+       }
+
+       string body;
+       AppendComments( cl, body );
+
+       mpCurClassSect =                
+               new ScriptSection( cl.GetName(), body, &mSuperContentTempl, &mRefTempl );
+
+       // set up reference in the class context, pointing back
+       // to the section where this class is represented
+       cl.SetUserData( mpCurClassSect );
+
+       ScriptSection* pSuper    = new ScriptSection( "Derived from"    ,"", &mOutLine1Templ,0, 1 );
+
+       ScriptSection* pPublic    = new ScriptSection( "Public members"    ,"", &mOutLineTempl,0, 1 );
+       ScriptSection* pProtected = new ScriptSection( "Protected members" ,"", &mOutLineTempl,0, 1 );
+       ScriptSection* pPrivate   = new ScriptSection( "Private members"   ,"", &mOutLineTempl,0, 1 );
+
+       pPublic->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) );
+       pPublic->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) );
+
+
+       pProtected->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) );
+       pProtected->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) );
+
+
+       pPrivate->AddSection( new ScriptSection( "Operations", "", &mOutLine1Templ, 0, 1 ) );
+       pPrivate->AddSection( new ScriptSection( "Attributes", "", &mOutLine1Templ, 0, 1 ) );
+
+       mpCurClassSect->AddSection( pSuper    );
+       mpCurClassSect->AddSection( pPublic    );
+       mpCurClassSect->AddSection( pProtected );
+       mpCurClassSect->AddSection( pPrivate   );
+
+       mpClassIdx->AddSection( mpCurClassSect, TRUE );
+}
+
+void RipperDocGen::VisitAttribute( spAttribute& attr )
+{
+       string body;
+       body += mTags[TAG_BOLD].start;
+       body += attr.mType;
+       body += mTags[TAG_BOLD].end;
+
+       body += mTags[TAG_ITALIC].start;
+       body += ' ';
+       body += attr.GetName();
+       body += mTags[TAG_ITALIC].end;
+
+       string line;
+       AppendHighlightedSource( line, body );
+       AppendComments( attr, line );
+
+       ScriptSection* pSection = 
+               new ScriptSection( GetScopedName( attr ), line, 
+                                                  &mSubContentTempl,
+                                                  GetRefTemplFor( attr ) );
+
+       if ( attr.mIsConstant )
+       
+               mpConstIdx->AddSection( pSection, TRUE );
+       
+       else
+       if ( !attr.IsInClass() )
+       {
+               if ( CheckIfUncommented( attr, *mpGlobalVarsIdx ) )
+                       return;
+
+               mpGlobalVarsIdx->AddSection( pSection, TRUE );
+       }
+       else
+
+               AddToCurrentClass( pSection, attr, "Attributes" );
+}
+
+void RipperDocGen::VisitOperation( spOperation& op )
+{
+       string body;
+
+       AppendHighlightedSource( body, op.GetFullName(mTags) );
+
+       AppendComments( op, body );
+
+       ScriptSection* pSection = 
+               new ScriptSection( GetScopedName( op ), body, 
+                                                  &mSubContentTempl,
+                                                  GetRefTemplFor( op ) );
+
+       if ( !op.IsInClass() )
+       {
+               if ( CheckIfUncommented( op, *mpGlobalFuncIdx ) )
+                       return;
+
+               mpGlobalFuncIdx->AddSection( pSection, 1 );
+       }
+       else
+               AddToCurrentClass( pSection, op, "Operations" );
+}
+
+bool RipperDocGen::OnSaveDocument( ScriptStream& stm )
+{
+       LinkSuperClassRefs();
+
+       // FOR NOW:: doesn't work yet
+       //mpTopIdx->RemoveEmptySections();
+
+       return 1; // saving can proceed now 
+}
+
diff --git a/utils/HelpGen/src/ifcontext.cpp b/utils/HelpGen/src/ifcontext.cpp
new file mode 100644 (file)
index 0000000..3b2698a
--- /dev/null
@@ -0,0 +1,295 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     27/12/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "ifcontext.h"
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <malloc.h>
+#include <stdio.h>
+
+#include "ifcontext.h"
+
+/***** Implementation for class spInterFileContext *****/
+
+size_t spInterFileContext::GetFileNo( const string& fname )
+{
+       for( size_t i = 0; i != mFiles.size(); ++i )
+
+               if ( fname == mFiles[i] ) return i;
+
+       wxASSERT(0); // DBG::
+       return 0;
+}
+
+size_t spInterFileContext::GetFileNoOfContext( spContext& ctx )
+{
+       spContext* pCtx = ctx.GetEnclosingContext( SP_CTX_FILE );
+
+       // DBG:: outer-file context should be present
+       wxASSERT( pCtx && pCtx->GetType() == SP_CTX_FILE ); 
+
+       return GetFileNo( ((spFile*)pCtx)->mFileName );
+}
+
+/*** public interface ***/
+
+spInterFileContext::spInterFileContext()
+{}
+
+spInterFileContext::~spInterFileContext()
+{}
+
+void spInterFileContext::AddFile( const string& fname, const string& content )
+{
+       mFiles.push_back( fname );
+       mContents.push_back( content );
+}
+
+void spInterFileContext::RemoveContext( spContext& ctx )
+{
+       wxASSERT( ctx.PositionIsKnown() ); // DBG:: should be checked by-user code
+
+       size_t fNo = GetFileNoOfContext( ctx );
+
+       mDeletionMarks.push_back( spBookmark( ctx.mSrcOffset, ctx.mContextLength, fNo ) );
+}
+
+void spInterFileContext::InsertBookmarkSorted( BookmarkListT& lst, spBookmark& mark )
+{
+       for( size_t i = 0; i != lst.size(); ++i )
+       
+               if ( lst[i].mFrom > mark.mFrom )
+               {
+                       lst.insert( &lst[i], mark );
+                       return;
+               }
+
+       lst.push_back( mark );
+}              
+
+void spInterFileContext::DoAppendSourceFragment( string& source, 
+                                                                                                string& result, 
+                                                                                                size_t  pos, size_t len )
+{
+       mFiltered.erase( mFiltered.begin(), mFiltered.end() );
+
+       size_t i;
+
+       for( i = 0; i != mDeletionMarks.size(); ++i )
+       {
+               spBookmark& mark = mDeletionMarks[i];
+
+               if ( mark.mFileNo == mCurFileNo && 
+                        mark.mFrom >= pos && mark.mFrom < pos + len )
+               
+                        InsertBookmarkSorted( mFiltered, mark );
+       }
+
+       size_t cur = pos;
+       
+       for( i = 0; i != mFiltered.size(); ++ i )
+       {
+               spBookmark& mark = mFiltered[i];
+
+               result.append( source, cur, ( (size_t)mark.mFrom - cur ) );
+
+               cur = size_t( mark.mFrom + mark.mLen );
+
+               if ( cur >= pos + len ) // check if we've overstepped the current source-fragment
+               {
+                       wxASSERT(0); // DBG:: with current imp. this should not happen
+                       
+                       cur = pos + len; break;
+               }
+       }
+
+       result.append( source, cur, ( pos + len ) - cur );
+}
+
+void spInterFileContext::GenerateContextBody( spContext& ctx, 
+                                                                                         string&    source,
+                                                                                         string&    result, 
+                                                                                         size_t&    lastSavedPos,
+                                                                                         size_t&    lastKnownPos )
+{
+       if ( ctx.PositionIsKnown() )
+
+               lastKnownPos = ctx.mSrcOffset;
+
+       if ( ctx.IsVirtualContext() )
+       {
+               // add fragment accumulated before this context
+
+               DoAppendSourceFragment( source, result,
+                                                           size_t(lastSavedPos), 
+                                                           size_t(lastKnownPos - lastSavedPos) );
+
+               // add context body
+
+               result += ctx.GetVirtualContextBody();
+
+               lastSavedPos = lastKnownPos;
+
+               if ( ctx.PositionIsKnown() )
+               {
+                       if ( ctx.VitualContextHasChildren() )
+                       {
+                               lastKnownPos = ctx.mSrcOffset + ctx.mHeaderLength;
+
+                               lastSavedPos = lastKnownPos;
+                       }
+                       else
+                       {
+                               lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
+
+                               lastSavedPos = lastKnownPos;
+
+                               return; // have not children
+                       }
+               }
+       }
+
+       MMemberListT& lst = ctx.GetMembers();
+
+       for( size_t i = 0; i != lst.size(); ++i )
+       
+               GenerateContextBody( *lst[i], source, result, lastSavedPos, lastKnownPos );
+       
+       if ( ctx.IsVirtualContext() )
+       {
+               if ( ctx.VitualContextHasChildren() && 
+
+                        ctx.GetFooterOfVirtualContextBody() != "" )
+               {
+                       // append the reminder space after children of the context
+
+                       DoAppendSourceFragment( result, source,
+                                                                       size_t(lastSavedPos), 
+                                                                       size_t(lastKnownPos - lastSavedPos) );
+
+                       // add footer 
+                       result += ctx.GetFooterOfVirtualContextBody();
+
+                       lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
+
+                       lastSavedPos = lastKnownPos;
+               }
+       }
+
+       if ( ctx.PositionIsKnown() )
+
+               lastKnownPos = ctx.mSrcOffset + ctx.mContextLength;
+}
+
+void spInterFileContext::GenrateContents()
+{
+       MMemberListT& lst = GetMembers();
+
+       for( size_t f = 0; f != lst.size(); ++f )
+       {
+               string& fname = ((spFile*)lst[f])->mFileName;
+
+               size_t fileNo = GetFileNo( fname );
+
+               string& source = mContents[ fileNo ];
+
+               string result;
+
+               size_t lastKnownPos = 0, // the begining of the file is always "known"
+                          lastSavedPos = 0;
+
+               mCurFileNo = fileNo;
+
+               GenerateContextBody( *lst[f], source, result, lastSavedPos, lastKnownPos );
+
+               // the end of file is always known
+
+               lastKnownPos = mContents[ fileNo ].length();
+
+               // append the reminder 
+
+               DoAppendSourceFragment( source, result,
+                                                           size_t(lastSavedPos), 
+                                                           size_t(lastKnownPos - lastSavedPos) );
+
+               // replace original contnet with newly generated one
+
+               mContents[ fileNo ] = result;
+       }
+}
+
+void spInterFileContext::ParseContents( SourceParserPlugin* pPlugin )
+{
+       mDeletionMarks.erase( mDeletionMarks.begin(), mDeletionMarks.end() );
+
+       RemoveChildren(); // clean up top-level context
+
+       mParser.SetPlugin( pPlugin );
+
+       for( size_t i = 0; i != mFiles.size(); ++i )
+       {
+               char* s = (char*)(mContents[i].c_str());
+
+               spFile* pFCtx = mParser.Parse( s, s + mContents[i].length() );
+
+               pFCtx->mFileName = mFiles[i];
+
+               AddMember( pFCtx );
+       }
+}
+
+void spInterFileContext::WriteToFiles()
+{
+       for( size_t i = 0; i != mFiles.size(); ++i )
+       {
+               FILE* fp = fopen( mFiles[i].c_str(), "w+t" );
+
+               if ( int(fp) > 0 )
+               {
+                       fwrite( mContents[i].c_str(), sizeof(char), mContents[i].length(), fp );
+
+                       fclose( fp );
+               }
+       }
+}
+
+string spInterFileContext::GetBody( spContext* pCtx )
+{
+       wxASSERT( pCtx->PositionIsKnown() ); // DBG:: should be checked by-user code
+
+       string& source = mContents[ GetFileNoOfContext( *pCtx ) ];
+
+       return string( source.c_str() + pCtx->mSrcOffset, pCtx->mContextLength );
+}
+
+string spInterFileContext::GetHeader( spContext* pCtx )
+{
+       wxASSERT( pCtx->PositionIsKnown() );   // DBG:: should be checked by-user code
+
+       wxASSERT( pCtx->mHeaderLength != -1 ); // DBG:: -/-
+
+       string& source = mContents[ GetFileNoOfContext( *pCtx ) ];
+
+       return string( source.c_str() + pCtx->mSrcOffset, pCtx->mHeaderLength );
+}
diff --git a/utils/HelpGen/src/markup.cpp b/utils/HelpGen/src/markup.cpp
new file mode 100644 (file)
index 0000000..9c0ad1d
--- /dev/null
@@ -0,0 +1,46 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "markup.h"
+
+static TagStructT htmlTags[] =
+{
+       { "<b>","</b>" }, // 0
+       { "<i>","</i>" }, // 1
+       { "<pre>","</pre>" }, // 2
+       { "<font color=\"#000000\">","</font>" }, // 3
+       { "<font color=\"#8F0000\">","</font>" }, // 4
+       { "<font color=\"#008F00\">","</font>" }, // 5
+       { "<font color=\"#0000CF\">","</font>" }, // 6
+       { "<p>","</p>" }, // 7
+       { "<br>","" }, // 8
+       { "<h1>","</h1>" }, // 9
+       { "<h2>","</h2>" }, // 10
+       { "<h3>","</h3>" }, // 11
+       { "<ul>","</ul>" }, // 12
+       { "<li>","</li>" }, // 13
+};
+
+MarkupTagsT get_HTML_markup_tags()
+{
+       return htmlTags;
+}
\ No newline at end of file
diff --git a/utils/HelpGen/src/ripper_main.cpp b/utils/HelpGen/src/ripper_main.cpp
new file mode 100644 (file)
index 0000000..d5a3ce7
--- /dev/null
@@ -0,0 +1,157 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#ifdef WIN32
+#include <io.h>
+#endif
+
+#include <stdio.h>
+
+#include "markup.h"    // get_HTML_markup_tags() will be used
+
+#include "docripper.h"
+#include "cjparser.h"  // C++/Java will be parsed here
+
+/***** Main funciton *****/
+
+#ifdef WIN32
+
+// NOTE:: under Windows this generator parses all .h files
+//        int the current directory
+
+#include "direct.h"
+
+
+void main(int argc, char** argv)
+{
+       cout << "C++/JAVA Source Documentation Generator (\"wxDocRipper\")" << endl
+                << "(C) 1998, Aleksandras Gluchovas (mailto:alex@soften.ktu.lt)" 
+                << endl << endl;
+
+
+       RipperDocGen gen;
+
+       // set up target script
+       gen.SetScriptMarkupTags( get_HTML_markup_tags() );
+
+       // setup source langauge 
+       CJSourceParser* pParser = new CJSourceParser();
+
+       gen.Init( pParser );
+
+       // read process all files in the current directory
+
+       struct _finddata_t c_file; // NT-specific?
+    long hFile;
+
+       hFile = _findfirst( "*.h", &c_file );
+       int total = 0;
+
+       while( hFile != -1L )
+       {
+               gen.ProcessFile( c_file.name );
+               ++total;
+
+               if ( _findnext( hFile,  &c_file ) == -1L )
+                       break;
+       }
+  
+       if ( total )
+       {
+               cout << endl
+                        << "*** storing source documenation into ./srcref.html ***" 
+                        << endl << endl;
+
+               if ( !gen.SaveDocument( "srcref.html" ) )
+
+                       cout << "\nERROR: document cannot be saved" << endl;
+       }
+       else
+       {
+                cout << "\nno .h files found in this directory - You must be running Windows now :-)"
+                         << endl;
+                return;
+       }
+
+
+       printf( "\nTotal %d file(s) processed, done.\n", total );
+}
+
+
+#else
+
+// NOTE:: on platfroms other then Windows this generator parses all files
+//        given from the command line
+
+int main(int argc, char** argv)
+{
+       cout << "C++/JAVA Source Documentation Generator (\"wxDocRipper\")" << endl
+                << "(C) 1998, Aleksandras Gluchovas (mailto:alex@soften.ktu.lt)" 
+                << endl << endl;
+
+       if ( argc < 2 )
+       {
+               cout << "Usage: list of files with .h, .hpp, .cpp or .java extentions" 
+                        << endl;
+               return 1;
+       }
+
+       int from = 1, no_dump = 0;
+
+       if ( strcmp( argv[1], "-x" ) == 0 )
+       {
+               from = 2;
+               no_dump = 1;
+       }
+
+       RipperDocGen gen;
+
+       // set up target script
+       gen.SetScriptMarkupTags( get_HTML_markup_tags() );
+
+       // setup source langauge 
+       CJSourceParser* pParser = new CJSourceParser();
+
+       gen.Init( pParser );
+
+       for( int i = from; i != argc; ++i )
+       
+               gen.ProcessFile( argv[i] );
+
+       if ( !no_dump )
+       {
+               cout << endl
+                        << "*** storing source documenation into ./srcref.html ***" 
+                        << endl << endl;
+
+               if ( !gen.SaveDocument( "srcref.html" ) )
+
+                       cout << "\nERROR: document cannot be saved" << endl;
+       }
+
+       printf( "\nTotal %d file(s) processed, done.\n", argc-from );
+
+       return 0;
+}
+
+#endif
diff --git a/utils/HelpGen/src/scriptbinder.cpp b/utils/HelpGen/src/scriptbinder.cpp
new file mode 100644 (file)
index 0000000..6d08955
--- /dev/null
@@ -0,0 +1,618 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <malloc.h>
+#include <string.h>
+#include <memory.h>
+
+#include <stdio.h>   // import sprintf() (for doubles)
+#include <stdlib.h>  // import atoi()    (for integers)
+
+#include "scriptbinder.h"
+
+// helper functions
+
+static size_t log2(size_t nr)
+{
+       size_t tmp = 0;
+       while (nr >= 2 ) 
+       {
+               nr /= 2;
+               ++tmp;
+       }
+
+       return tmp;
+}
+
+/***** Implementation for class ScriptStream *****/
+
+ScriptStream::ScriptStream()
+       : mpBuf(0),
+         mSize(0),
+         mCapacity(0)
+{}
+
+ScriptStream::~ScriptStream()
+{
+       if ( mpBuf ) delete mpBuf;
+}
+
+void ScriptStream::WriteBytes( const void* srcBuf, size_t count )
+{
+       if ( !count ) return;
+
+       // increase the capacity if necessary
+       if ( mSize + count > mCapacity )
+       {
+                       mCapacity = 
+                               (  0x2 << (log2( mSize + count ) + 1 ) );
+
+                       if ( mCapacity < 128 ) mCapacity = 128;
+
+                       char* oldBuf = mpBuf;
+
+                       mpBuf = new char[mCapacity];
+
+                       if ( oldBuf )
+                       {
+                               memcpy( mpBuf, oldBuf, mSize );
+                               delete oldBuf;
+                       }
+       }
+
+       // append new data
+       memcpy( &mpBuf[mSize], srcBuf, count );
+
+       mSize += count;
+}
+
+ScriptStream& ScriptStream::operator<<( const char* str )
+{
+       WriteBytes( str, strlen( str ) );
+
+       return *this;
+}
+
+ScriptStream& ScriptStream::operator<<( const string& str )
+{
+       if ( str.length() < 512 )
+       {
+               char buf[512];
+               size_t len = str.length();
+
+               for( size_t i = 0; i != len; ++i )
+                       buf[i] = str[i];
+
+               WriteBytes( buf, len );
+       }
+       else
+               WriteBytes( str.c_str(), str.length() );
+
+       return *this;
+}
+
+ScriptStream& ScriptStream::operator<<( char ch )
+{
+       WriteBytes( &ch, 1 );
+
+       return *this;
+}
+
+void ScriptStream::endl()
+{
+       char ch = '\n';
+       WriteBytes( &ch, 1 );
+}
+
+/***** Implementation for class ScriptTemplate *****/
+
+ScriptTemplate::ScriptTemplate( const string& templateText )
+{
+       string tmp = templateText;
+
+       mTText = (char*)malloc( tmp.length() + 1 );
+
+       strcpy( mTText, tmp.c_str() );
+}
+
+ScriptTemplate::~ScriptTemplate()
+{
+       for( size_t i = 0; i != mVars.size(); ++i )
+
+               delete mVars[i];
+
+       free( mTText );
+}
+
+bool ScriptTemplate::HasVar( const char* name )
+{
+       for( size_t i = 0; i != mVars.size(); ++i ) 
+
+               if ( strcmp( mVars[i]->mName, name ) == 0 )
+
+                       return 1;
+
+       return 0;
+}
+
+void ScriptTemplate::AddStringVar ( const char* name, int ofs )
+{
+       mVars.push_back( new TVarInfo( name, ofs, TVAR_STRING ) );
+}
+
+void ScriptTemplate::AddIntegerVar( const char* name, int ofs )
+{
+       mVars.push_back( new TVarInfo( name, ofs, TVAR_INTEGER ) );
+}
+
+void ScriptTemplate::AddDoubleVar ( const char* name, int ofs )
+{
+       mVars.push_back( new TVarInfo( name, ofs, TVAR_DOUBLE ) );
+}
+
+void ScriptTemplate::AddObjectRefArray( const char*     name,
+                                                                               int                         ofsRefToFirstObj,
+                                                                               int                         ofsObjSizeInt,
+                                                                               int                         ofsObjRefTempl
+                                                                         )
+{
+       TArrayInfo* pInfo = new TArrayInfo( name );
+
+       mVars.push_back( pInfo );
+
+       pInfo->mRefOfs         = ofsRefToFirstObj;
+       pInfo->mSizeIntOfs     = ofsObjSizeInt;
+       pInfo->mObjRefTemplOfs = ofsObjRefTempl;
+}
+
+inline void ScriptTemplate::PrintVar( TVarInfo*   pInfo, 
+                                                                   void*       dataObj, 
+                                                                       ScriptStream& stm )
+{
+       char buf[128];
+
+       switch ( pInfo->mType )
+       {
+               case TVAR_INTEGER :
+                       {
+                               sprintf(buf, "%d",*( (int*) ((char*)dataObj + pInfo->mOfs) ) );
+                               
+                               stm.WriteBytes( buf, strlen(buf ) );
+                               break;
+                       }
+
+               case TVAR_STRING :
+                       {
+                               string& str = *( (string*) ((char*)dataObj+pInfo->mOfs) );
+
+                               const char* cs = str.c_str();
+#ifdef DEBUG_WEIRED_OFFSETS
+                               cout << "DBG:: cs address is " << (int)cs << endl;
+                               cout << "DBG:: str address is " << (int)(&str) << endl;
+                               cout << "DBG:: dataObj points to " << (int)dataObj << endl;
+                               cout << "DBG:: pInfo->mOfs value is " << (int)pInfo->mOfs << endl;
+                               cout << "DBG:: d+pInfo->mOfs is " << (int)((char*)dataObj + pInfo->mOfs) << endl;
+                               cout << "DBG:: pInfo->mName is " << pInfo->mName << endl;
+                               cout << "DBG:: pInfo->mType is " << pInfo->mType << endl;
+                               cout << "DBG:: end of dump. " << endl;
+
+                               cout << "DBG:: cs value is " << endl << cs << endl;
+#endif
+                               stm.WriteBytes( cs, strlen(cs) );
+                               break;
+                       }
+
+               case TVAR_DOUBLE :
+                       {
+                               sprintf( buf, "%f", 
+                                            *( (double*)( (char*)dataObj+pInfo->mOfs)  ) );
+
+                               stm.WriteBytes( buf, strlen(buf ) );
+                               break;
+                       }
+
+               case TVAR_REF_ARRAY :
+                       {
+                               TArrayInfo& info = *((TArrayInfo*)pInfo);
+
+                               int sz = *((int*) ( (char*)dataObj+info.mSizeIntOfs ));
+                               if ( !sz ) 
+                               {
+                                       // DBG::
+                                       int u;
+                                       ++u;
+                                       break;
+                               }
+
+                               int*   array = *((int**)( (char*)dataObj+info.mRefOfs ));
+       
+                               ScriptTemplate* pRefTempl;
+
+                               for( int i = 0; i != sz; ++i )
+                               {
+                                       pRefTempl = 
+                                               *((ScriptTemplate**)((char*)(array[i])+info.mObjRefTemplOfs));
+
+                                       pRefTempl->PrintScript( (void*)array[i], stm );
+                               }
+
+                               break;
+                       }
+
+               default : break;
+       }
+}
+
+void ScriptTemplate::PrintScript( void* dataObj, ScriptStream& stm )
+{
+       char* cur   = mTText;
+
+       // template parsing loop
+       do
+       {
+               char* start = cur;
+
+               while( *cur != '\0' && *cur != '$' ) ++cur;
+
+               // flush text collected between variables
+               stm.WriteBytes( start, cur - start );
+
+               if ( *cur == '\0' ) break;
+
+               cur += 2; // skip to the name of the var
+
+               start = cur;
+
+               while( *cur != ')' ) ++cur;
+
+               // put terminating zero temorarely
+
+               *cur = '\0';
+
+               // look up variable
+
+               size_t sz = mVars.size();
+               bool found = 0;
+
+               for( size_t i = 0; i != sz; ++i ) 
+               {
+                       if ( strcmp( mVars[i]->mName, start ) == 0 )
+                       {
+                               PrintVar( mVars[i], dataObj, stm );
+
+                               *cur = ')';     // remove terminating zero
+                               ++cur;
+                               found = 1;
+                               break;
+                       }
+               }
+
+               // variable referred by template script is not
+               // registered to this tempalte object
+               ASSERT( found ); 
+
+       } while(1);
+}
+
+/***** implementation for class ScriptSection *****/
+
+int ScriptSection::mIdCounter = 0;
+
+ScriptSection::ScriptSection( const string&   name,
+                                                     const string&   body,
+                                                         ScriptTemplate* pSectionTemplate,
+                                                         ScriptTemplate* pReferenceTemplate,
+                                                         bool            autoHide,
+                                                         bool            sorted
+                                                       )
+       : mpParent ( NULL ),
+
+         mName    ( name ),
+         mBody    ( body ),
+
+         mAutoHide( autoHide ),
+         mSortOn  ( sorted ),
+
+         mpSectTempl( pSectionTemplate ),
+         mpRefTempl ( pReferenceTemplate ),
+
+         mRefCount( 0 ),
+         mArrSize( 0 )
+{
+       // generate GUID
+
+       char buf[32];
+       sprintf( buf, "%d", ++mIdCounter );
+       mId = buf;
+}
+
+ScriptSection::~ScriptSection()
+{
+       SectListT lst = mSubsections;
+
+       while( mSubsections.size() )
+
+               mSubsections[0]->RemoveRef();
+
+       for( size_t i = 0; i != mReferences.size(); ++i )
+
+               mReferences[i]->RemoveRef();
+}
+
+void ScriptSection::AddRef()
+{
+       ++mRefCount;
+}
+
+void ScriptSection::RemoveRef()
+{
+       if ( !mRefCount || !(--mRefCount) )
+       {
+               if (mpParent)
+               {
+                       // remove ourselves from parent's list
+
+                       SectListT& lst = mpParent->mSubsections;
+                       for( size_t i = 0; i != lst.size(); ++i )
+
+                               if ( lst[i] == this )
+                               {
+                                       lst.erase( &lst[i] );
+                                       break;
+                               }
+               }
+
+               delete this;
+       }
+}
+
+ScriptSection* ScriptSection::GetSubsection( const char* name )
+{
+       // FOR NOW:: fixed section name length
+       char buf[128];
+
+       size_t cur = 0;
+
+       while( name[cur] && name[cur] != '/' )
+       {
+               buf[cur] = name[cur];
+               ++cur;
+       }
+
+       ASSERT( cur < sizeof(buf) );
+
+       buf[cur] = '\0';
+
+       size_t sz = mSubsections.size();
+
+       for( size_t i = 0; i != sz; ++i )
+       {
+               // DBG::
+               //ScriptSection& sect = *mSubsections[i];
+
+               if ( mSubsections[i]->mName == buf )
+               {
+                       if ( name[cur] == '/' )
+
+                               // search recursivelly
+                               return mSubsections[i]->GetSubsection( &name[cur+1] );
+                       else
+                               return mSubsections[i];
+               }
+       }
+
+       return 0;
+}
+
+void ScriptSection::AddSection( ScriptSection* pSection,
+                                                           bool addToReferencesToo
+                                                         )
+{
+       mSubsections.push_back( pSection );
+
+       pSection->AddRef();
+
+       // can add section to multiple containers
+       ASSERT( pSection->mpParent == 0 );
+
+       pSection->mpParent = this;
+
+       if ( addToReferencesToo )
+
+               AddReference( pSection );
+}
+
+void ScriptSection::AddReference( ScriptSection* pReferredSection )
+{
+       mReferences.push_back( pReferredSection );
+
+       pReferredSection->AddRef();
+
+       // set up mandatory fields used by ScriptTemplate
+       mArrSize  = mReferences.size();
+       if ( mArrSize )
+               mRefFirst = (void*)&mReferences[0];
+}
+
+SectListT& ScriptSection::GetSubsections()
+{
+       return mSubsections;
+}
+
+// static method:
+void ScriptSection::RegisterTemplate( ScriptTemplate& sectionTempalte )
+{
+       int nameOfs, bodyOfs, idOfs,
+               arrRefOfs, arrSizeOfs, refTemplOfs;
+
+       // obtaining offsets of member vars
+       
+       GET_VAR_OFS( ScriptSection, mName,     &nameOfs    )
+       GET_VAR_OFS( ScriptSection, mBody,     &bodyOfs    )
+       GET_VAR_OFS( ScriptSection, mId,       &idOfs      )
+       GET_VAR_OFS( ScriptSection, mRefFirst, &arrRefOfs  )
+       GET_VAR_OFS( ScriptSection, mArrSize,  &arrSizeOfs )
+
+       GET_VAR_OFS( ScriptSection, mpRefTempl, &refTemplOfs )
+
+       // registering member variables with given script template
+
+       sectionTempalte.AddStringVar( "NAME", nameOfs );
+       sectionTempalte.AddStringVar( "BODY", bodyOfs );
+       sectionTempalte.AddStringVar( "ID",   idOfs   );
+
+       sectionTempalte.AddObjectRefArray( "REFLIST",
+                                                                          arrRefOfs, arrSizeOfs, refTemplOfs );
+}
+
+void ScriptSection::Print( ScriptStream& stm )
+{
+       // TBD:: sorting
+
+       // print out this content first
+       if ( mpSectTempl )
+
+               mpSectTempl->PrintScript( this, stm );
+
+       // attach contents subsections at the end of this content
+
+       for( size_t i = 0; i != mSubsections.size(); ++i )
+
+               mSubsections[i]->Print( stm );
+}
+
+void ScriptSection::DoRemoveEmptySections(int& nRemoved, SectListT& removedLst)
+{
+       for( size_t i = 0; i != mSubsections.size(); ++i )
+       {
+               ScriptSection& sect = *mSubsections[i];
+
+               sect.DoRemoveEmptySections( nRemoved, removedLst );
+
+               if (sect.mAutoHide )
+                       
+                       if ( sect.mReferences.size() == 0 )
+                       {
+                               bool found = 0;
+                               for( size_t k = 0; k != removedLst.size(); ++k )
+
+                                       if ( removedLst[k] == &sect )
+                                       {
+                                               found = 1;
+                                               break;
+                                       }
+                               
+                               if ( !found )
+                               {
+                                       removedLst.push_back( &sect );
+                                       ++nRemoved;
+
+                                       delete &sect;
+                                       --i;
+                               }
+                       }
+       }
+}
+
+void ScriptSection::DoRemoveDeadLinks( SectListT& removedLst)
+{
+       size_t dsz = removedLst.size();
+
+       for( size_t i = 0; i != mSubsections.size(); ++i )
+       {
+               mSubsections[i]->DoRemoveDeadLinks( removedLst );
+       }
+
+       for( size_t n = 0; n != mReferences.size(); ++n )
+       {
+               for( size_t k = 0; k != dsz; ++k )
+
+                       if ( removedLst[k] == mReferences[n] )
+                       {
+                               mReferences.erase( &mReferences[n] );
+                               --n;
+
+                               // set up mandatory fields used by ScriptTemplate
+                               mArrSize  = mReferences.size();
+                               if ( mArrSize )
+                                       mRefFirst = (void*)&mReferences[0];
+
+                               break;
+                       }
+       }
+}
+
+
+void ScriptSection::RemoveEmptySections()
+{
+       // FIXME:: this is very_very_very slow alg.! +"doesn't work"
+
+       int nRemoved = 0;
+
+       do
+       {
+               SectListT removedLst;
+               nRemoved = 0;
+
+               DoRemoveEmptySections( nRemoved, removedLst );
+
+               DoRemoveDeadLinks( removedLst );
+       }
+       while( nRemoved );
+}
+
+/***** Iimplementation for class DocGeneratorBase *****/
+
+bool DocGeneratorBase::SaveDocument( const char*    fname, 
+                                                                    const char*    fopenOptions,
+                                                                    ScriptSection* pFromSection
+                                                                  )
+{
+       FILE* fp = fopen( fname, fopenOptions );
+
+       if ( (int)fp == -1 ) return 0;
+
+       ScriptStream stm;
+
+       // check if derived class agrees about saving it
+       if ( !OnSaveDocument( stm ) ) return 0;
+
+       if ( pFromSection )
+
+               pFromSection->Print( stm );
+       else
+       {
+               ScriptSection* pTopSect = GetTopSection();
+               ASSERT( pTopSect );
+               pTopSect->Print( stm );
+       }
+
+       size_t nWrite = fwrite( stm.GetBuf(), 1, stm.GetBufSize(), fp );
+
+       if ( nWrite != stm.GetBufSize() ) return 0;
+
+       fclose( fp );
+
+       return 1;
+
+       // that^s it
+}
diff --git a/utils/HelpGen/src/sourcepainter.cpp b/utils/HelpGen/src/sourcepainter.cpp
new file mode 100644 (file)
index 0000000..9e24ea9
--- /dev/null
@@ -0,0 +1,676 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       #include <map>
+#else
+
+       #include <wxstlac.h>
+
+#endif
+
+#include "sourcepainter.h"
+
+const int MAX_KEYWORD_LEN = 16;
+
+struct KeywordT
+{
+       char  keyWord[MAX_KEYWORD_LEN];
+       int   rank;
+};
+
+// source fragment ranks :
+
+// 0 - nomral text
+// 1 - basic types
+// 2 - reserved words
+
+// multil-language keywords map
+
+static KeywordT __gKeyWords[] =
+{
+       { "for", 1 },
+       { "FOR", 1 },
+       { "For", 1 },
+       
+       { "next", 1 },
+       { "Next", 1 },
+       { "NEXT", 1 },
+
+       { "if", 1 },
+       { "If", 1 },
+       { "IF", 1 },
+
+       { "then", 1 },
+       { "Then", 1 },
+       { "THEN", 1 },
+
+       { "else", 1 },
+       { "Else", 1 },
+       { "ELSE", 1 },
+                
+       { "do", 1 },
+       { "Do", 1 },
+       { "DO", 1 },
+
+
+       { "break", 1 },
+       { "Break", 1 },
+       { "BREAK", 1 },
+
+       { "continue", 1 },
+
+       { "goto", 1 },
+       { "Goto", 1 },
+       { "GOTO", 1 },
+
+       { "switch",  1 },
+       { "default", 1 },
+       { "case",    1 },
+
+       { "repeat", 1 },
+       { "Repeat", 1 },
+       { "REPEAT", 1 },
+
+       { "until", 1 },
+       { "Until", 1 },
+       { "UNTIL", 1 },
+
+       { "return", 1 },
+       { "Return", 1 },
+       { "RETURN", 1 },
+
+       { "unit",      1 },
+       { "Unit",      1 },
+       { "UNIT",      1 },
+
+       { "procedure", 1 },
+       { "Procedure", 1 },
+       { "PROCEDURE", 1 },
+
+       { "function", 1 },
+       { "Function", 1 },
+       { "FUNCTION", 1 },
+
+       { "begin", 1 },
+       { "Begin", 1 },
+       { "BEGIN", 1 },
+
+       { "End", 1 },
+       { "END", 1 },
+
+       ////////////////////////////////////////////////////
+
+       { "enum",     1 },
+       { "static",   1 },
+       { "const",    1 },
+       { "mutable",  1 },
+       { "volatile", 1 },
+       { "__asm",    1 },
+       { "asm",      1 },
+
+       { "typeid",   1 },
+       { "sizeof",   1 },
+       { "typeof",   1 },
+
+
+       { "native",   1 },
+
+       { "#include", 1 },
+       { "#define",  1 },
+       { "#def",     1 },
+       { "#undef",   1 },
+    { "#ifdef",   1 },
+       { "#ifndef",  1 },
+       { "#if",      1 },
+       { "#endif",   1 },
+       { "#elif",    1 },
+       { "#else",    1 },
+       { "#pragma",  1 },
+       { "#line",    1 },
+
+       { "package",  1 },
+       { "import",   1 },
+       { "export",   1 },
+
+       ////////////////////////////////////////////////////
+
+       { "dynamic_cast",     1 },
+       { "const_cast",       1 },
+
+       //////// some hacks for VB /////////
+
+       { "sub", 1 },
+       { "Sub", 1 },
+       { "SUB", 1 },
+       { "as",  1 },
+       { "As",  1 },
+       { "AS",  1 },
+
+       /////// data types ///////
+
+       { "int" ,    1 },
+       { "integer", 1 },
+       { "Integer", 1 },
+       { "INTEGER", 1 },
+
+       { "real", 1 },
+       { "Real", 1 },
+       { "REAL", 1 },
+
+       { "float", 1 },
+       { "Float", 1 },
+       { "FLOAT", 1 },
+
+       { "char",  1 },
+       { "Char",  1 },
+       { "CHAR",  1 },
+
+       { "register",   1 },
+
+       { "string", 1 },
+       { "String", 1 },
+       { "STRING", 1 },
+
+       { "array", 1 },
+       { "Array", 1 },
+       { "ARRAY", 1 },
+
+       { "packed", 1 },
+       { "Packed", 1 },
+       { "PACKED", 1 },
+
+       { "property", 1 },
+       { "Property", 1 },
+       { "PROPERTY", 1 },
+
+       { "unsigned", 1 },
+
+       { "long",   1 },
+       { "double", 1 },
+       { "short",  1 },
+       { "bool",   1 },
+
+       { "longint", 1 },
+       { "Longint", 1 },
+       { "LONGINT", 1 },
+
+       { "extended", 1 },
+       { "Extended", 1 },
+       { "EXTENTED", 1 },
+
+       { "pointer", 1 },
+       { "Pointer", 1 },
+       { "POINTER", 1 },
+
+       { "and",     1 },
+       { "And",     1 },
+       { "AND",     1 },
+       { "or",      1 },
+       { "Or",      1 },
+       { "OR",      1 },
+       { "xor",     1 },
+       { "Xor",     1 },
+       { "XOR",     1 },
+
+       { "void",       1 },
+       { "__stdcall",  1 },
+       { "__declspec", 1 },
+       { "extern",     1 },
+       { "stdcall",    1 },
+       { "dllimport",  1 },
+       { "dllexport",  1 },
+       { "__cdecl",    1 },
+       { "cdecl",      1 },
+       { "template",   1 },
+       { "typedef",    1 },
+       { "naked",      1 },
+
+       { "try",        1 },
+       { "catch",      1 },
+       { "throw",      2 }, // C++
+       { "throws",     1 }, // Java
+
+
+       { "finalize",   1 },
+
+       // "STL-suport"
+
+       { "size_t",     1 },
+       { "NPOS",       1 },
+       { "vector",     1 },
+       { "list",       1 },
+       { "map",        1 },
+       { "multimap",   1 },
+
+       { "external", 1 },
+       { "External", 1 },
+       { "EXTERNAL", 1 },
+
+       //////////// meta-information //////////////
+
+       { "virtual", 2 },
+       { "Virtual", 2 },
+
+       { "override", 2 },
+       { "Override", 2 },
+
+       { "class", 2 },
+       { "Class", 2 },
+       { "CLASS", 2 },
+
+       { "struct", 2 }, 
+       { "union",  2 },
+
+       { "record", 2 },
+       { "Record", 2 },
+       { "RECORD", 2 },
+
+       { "form",     1 },
+       { "Form",     1 },
+       { "FORM",     1 },
+
+       { "namespace", 2 },
+
+       { "interface" , 2 },
+       { "abstract",   2 },
+
+       { "Interface" , 2 },
+       { "INTERFACE" , 2 },
+
+       { "implementation", 2 },
+       { "Implementation", 2 },
+       { "IMPLEMENTATION", 2 },
+
+       { "label", 2 },
+       { "Label", 2 },
+       { "LABEL", 2 },
+
+       { "implements", 2 },
+
+       { "public",    2 },
+       { "private",   2 },
+       { "protected", 2 },
+
+       { "this", 2 },
+       { "This", 2 },
+       { "THIS", 2 },
+
+       { "new", 2 },
+       { "New", 2 },
+       { "NEW", 2 },
+       
+       { "delete", 2 },
+       { "inline", 2 },
+
+       { "operator",  2 },
+
+       { "Inherited", 2 },
+       { "Inherited", 2 },
+       
+       { "final", 2 },
+       { "implements", 2 },
+       { "super", 2 },
+
+       // even more...
+       { "java",      2 },
+       { "Java",      2 },
+       { "JAVA",      2 },
+       { "delphi",    2 },
+       { "Delphi",    2 },
+       { "SmallTalk", 2 },
+       { "Smalltalk", 2 },
+       { "smalltalk", 2 },
+       { "assembler", 2 },
+       { "Assembler", 2 },
+       { "Basic",     2 },
+       { "BASIC",     2 },
+       { "basic",     2 },
+       { "CORBA",     2 },
+       { "COBOL",     2 },
+       { "ADA",       2 },
+       { "LISP",      2 },
+       
+       // just for fun...
+       { "life",        2 },
+       { "sucks",       2 },
+       { "rules",       2 },
+       { "Quake",       2 },
+       { "QuakeWorld",  2 },
+       { "[ag_slammer]",2 },
+       { "Aleksandras", 2 },
+       { "Gluchovas"  , 2 },
+       { "Alex",        2 },
+       { "alex",        2 },
+       { "aleks",       2 },
+       { "aleksas",     3 },
+       { "AlexSoft",    2 },
+       { "Alexsoft",    2 },
+       { "SpringSky",   2 },
+       { "SK_Team",     2 },
+       { "soften",      2 },
+       { "UB40",        2 },
+       { "U96",         2 }
+};
+
+struct less_c_str 
+{
+    inline bool operator()( char* x, char* y) const 
+       {       return ( strcmp( x,y ) < 0 );
+       }
+};
+
+#if defined( wxUSE_TEMPLATE_STL )
+
+       typedef map< char*, char*, less_c_str > KeywordMapT;
+
+#else
+
+       typedef char* CharPtrT;
+       typedef WXSTL_MAP( CharPtrT, CharPtrT ,less_c_str) KeywordMapT;
+
+#endif
+
+static KeywordMapT __gMultiLangMap;
+static int         __gMapReady = 0;
+
+void check_keyword_map( int keywordMapNr )
+{
+       if ( !__gMapReady )
+       {
+               __gMapReady = 1;
+
+               // "make sure" the address of the first member of non-polimorphic class
+               // coinsides with the address of the instance
+
+               KeywordT dummy;
+
+               if ( (char*)& dummy != &dummy.keyWord[0] )
+                       throw;
+
+               int size = sizeof(__gKeyWords) / sizeof( KeywordT );
+
+               for( int i = 0; i != size; ++i )
+
+                       __gMultiLangMap.insert( 
+                                       KeywordMapT::value_type( (char*)&__gKeyWords[i],
+                                                                                        (char*)&__gKeyWords[i]
+                                                                                  )
+                                                                 );    
+       }
+}
+
+int get_rank( char* start, char* end )
+{
+       // FIXME:: what if end is no longer leagal adress?
+
+       char tmp = *end;
+       *end = '\0'; // put temporary terminator
+
+       KeywordMapT::iterator i; 
+
+       if (  (i = __gMultiLangMap.find( start ) ) != __gMultiLangMap.end() )
+       {
+               KeywordT* pKey = (KeywordT*)(*i).second;
+
+               *end = tmp;
+
+               return pKey->rank;
+       }
+       else
+       {
+               *end = tmp;
+               return 0;
+       }
+}
+
+static inline void store_range( SPBlockListT& results, int rank, int range_len )
+{
+       if ( !range_len ) return;
+
+       results.push_back ( ( rank << 16 ) | ( range_len ) );
+}
+
+
+#define STORE_RANGE  store_range( results, cur_rank, cur_range_len );\
+                        cur_rank = cur_range_len = 0;
+
+#define NEXT_CHAR cur_range_len++; \
+                     ++cur;           \
+                                 continue;
+
+static inline int is_alpha( char ch )
+{
+       return ( (( ch >= '_' ) && ( ch <= 'z' )) ||
+                    (( ch >= 'A' ) && ( ch <= 'Z' ))
+                  );
+}
+
+  // _       .       .
+  // Ziema atEjo netikEtai
+
+static void heighlight_syntax( char* str,   int strLen, 
+                                                          SPBlockListT& results, bool& isComment )
+{
+       bool isMultiline = 0;
+       char* cur = str;
+       char* end = str + strLen;
+
+       int cur_rank      = ( isComment == 1 ) ? RANK_GREEN : RANK_BLACK;
+       int cur_range_len = 0;
+
+       while ( cur != end )
+       {
+               int has_next = ( cur+1 != end );
+
+               if ( isComment )
+               {
+                       if ( *cur == '*' )
+                               if ( has_next && *(cur+1) == '/' )
+                               {
+                                        // turn off multiline comment mode
+                                        cur           += 2;
+                                        cur_range_len += 2;
+                                        isComment      = 0;
+                                        isMultiline    = 0;
+                                        STORE_RANGE;
+
+                                        continue;
+                               }
+
+                       ++cur_range_len;
+                       ++cur;
+                       continue;
+               }
+
+               /*
+               if ( *cur == 10 )
+                       if ( isComment )
+                          if ( isMultiline )
+               {
+                        cur_rank      = RANK_GREEN;
+                        cur_range_len = end - cur;
+                        STORE_RANGE;
+                        isComment = 0;
+                        isMultiline = 0;
+                        continue;
+               }*/
+
+               if ( *cur == '/' )
+               {
+                       if ( has_next )
+                       {
+                                if ( *(cur+1) == '/' )
+                                {
+                                        STORE_RANGE;
+
+                                        char* eol = cur;
+                                        while ( eol < end && *eol != 10 )
+                                                ++eol;
+
+                                        cur_rank      = RANK_GREEN;
+                                        cur_range_len = eol - cur;
+                                        cur = eol;
+                                        STORE_RANGE;
+
+                                        continue;
+                                }
+
+                                if ( *(cur+1) == '*' )
+                                {
+                                        STORE_RANGE;
+                                        cur_rank      = RANK_GREEN;
+                                        cur_range_len = 2;
+                                        isComment     = 1;
+                                        cur          += 2;
+                                        isMultiline   = 1;
+                                        continue;
+                                }
+                       }
+                       
+                       NEXT_CHAR;
+               }
+
+           if (  ( is_alpha( *cur ) || *(cur) == '#' ) 
+                         && has_next 
+                  )
+               {
+                       if ( is_alpha( *(cur+1) ) )
+                       {
+                               char* start = cur;
+                               cur += 2;
+
+                               while ( cur != end && is_alpha(*cur) ) ++cur;
+
+                               int wordRank;
+                               
+                               if ( (wordRank = get_rank( start, cur )) > 0 )
+                               {
+                                       STORE_RANGE;
+
+                                       store_range( results, wordRank, int(cur-start) );
+                       cur_rank = cur_range_len = 0;
+                                       continue;
+                               }
+
+                               cur_range_len += ( cur-start );
+                               continue;
+                       }
+                       else
+                               NEXT_CHAR;
+               }
+
+               NEXT_CHAR;
+       }
+
+       if ( cur_range_len > 0 )  STORE_RANGE;
+}
+
+/***** Implementation for class SourcePainter ******/
+
+SourcePainter::SourcePainter( bool assembleResultString )
+       : mCollectResultsOn( assembleResultString ),
+         mIsInComment( FALSE ),
+         mCommentIsMultiline( FALSE )
+{
+       check_keyword_map(0);
+}
+
+void SourcePainter::ProcessSource( char* src, int srcLen )
+{
+       // TBD:: multilne state...
+
+       heighlight_syntax( src, srcLen, mBlocks, mIsInComment );
+
+       if ( mCollectResultsOn )
+       
+               mResultStr += string( src, srcLen );
+}
+
+void SourcePainter::SetState( bool isInComment,
+                                                         bool commentIsMultiline )
+{
+       mIsInComment        = isInComment;
+       mCommentIsMultiline = commentIsMultiline;
+}
+
+void SourcePainter::Init(bool assembleResultString)
+{
+       mIsInComment        = 0;
+       mCommentIsMultiline = 0;
+       mCollectResultsOn   = assembleResultString;
+
+       mResultStr = "";
+
+       mBlocks.erase( mBlocks.begin(), mBlocks.end() );
+}
+
+static int rank_tags_map[] = 
+{ 
+       TAG_BLACK_FONT, 
+       TAG_BLUE_FONT,
+       TAG_RED_FONT,
+       TAG_GREEN_FONT
+};
+
+void SourcePainter::GetResultString(string& result, MarkupTagsT tags)
+{
+       // this method works, only if results of processing 
+       // are collected
+       ASSERT( mCollectResultsOn ); 
+       result = "";
+
+       int pos = 0;
+
+       for( size_t i = 0; i != mBlocks.size(); ++i )
+       {
+               int desc = mBlocks[i];
+
+               int len  = desc & 0xFFFF;
+               int rank = (desc >> 16) & 0xFFFF;
+
+               result += tags[ rank_tags_map[rank] ].start;
+
+               for( int n = 0; n != len; ++n )
+               
+                       result += mResultStr[pos+n];
+
+               pos += len;
+
+               result += tags[ rank_tags_map[rank] ].end;
+       }
+}
+
+SPBlockListT& SourcePainter::GetBlocks()
+{
+       return mBlocks;
+}
+
+bool SourcePainter::IsKeyword( char* word, int wordLen )
+{
+       check_keyword_map(0);
+
+       int rank = get_rank( word, word + wordLen );
+
+       return (  rank == RANK_BLUE || rank == RANK_RED );
+}
diff --git a/utils/HelpGen/src/srcparser.cpp b/utils/HelpGen/src/srcparser.cpp
new file mode 100644 (file)
index 0000000..abe2cd9
--- /dev/null
@@ -0,0 +1,543 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        No names yet.
+// Purpose:     Contrib. demo
+// Author:      Aleksandras Gluchovas
+// Modified by:
+// Created:     22/09/98
+// RCS-ID:      $Id$
+// Copyright:   (c) Aleskandars Gluchovas
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "srcparser.h"
+#pragma interface
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include <malloc.h>
+#include <stdio.h>
+
+#include "srcparser.h"
+
+/***** Implementation for class spVisitor *****/
+
+void spVisitor::VisitAll( spContext& atContext,
+                                                 bool sortContent
+                                               )
+{
+       mSiblingSkipped = FALSE;
+       mChildSkipped   = FALSE;
+       mContextMask    = SP_CTX_ANY; // FIXME:: should be an arg.
+
+       if ( sortContent && !atContext.IsSorted() )
+
+               atContext.SortMembers();
+
+       mpCurCxt = &atContext; // FIXME:: this is dirty, restoring it each time
+
+       if ( atContext.GetContextType() & mContextMask )
+
+               atContext.AcceptVisitor( *this );
+
+       MMemberListT& members = atContext.GetMembers();
+
+       for( size_t i = 0; i != members.size(); ++i )
+       {
+               if ( mSiblingSkipped )
+               
+                       return;
+
+               if ( !mChildSkipped )
+               {
+                       size_t prevSz = members.size();
+
+                       // visit members of the context recursivelly
+                       VisitAll( *members[i], sortContent );
+
+                       if ( members.size() != prevSz )
+
+                               --i; // current member was removed!
+
+                       mChildSkipped = 0;
+               }
+       }
+}
+
+void spVisitor::RemoveCurrentContext()
+{
+       if ( mpCurCxt->GetParent() )
+
+               mpCurCxt->GetParent()->RemoveChild( mpCurCxt );
+}
+
+void spVisitor::SkipSiblings()
+{
+       mSiblingSkipped = TRUE;
+}
+
+void spVisitor::SkipChildren()
+{
+       mChildSkipped = TRUE;
+}
+
+void spVisitor::SetFilter( int contextMask )
+{
+       mContextMask = contextMask;
+}
+
+/***** Implementation for class spComment *****/
+
+bool spComment::IsMultiline()  const
+{
+       return mIsMultiline;
+}
+
+bool spComment::StartsParagraph() const
+{
+       return mStartsPar;
+}
+
+string& spComment::GetText()
+{
+       return mText;
+}
+
+string spComment::GetText() const
+{
+       return mText;
+}
+
+/***** Implementation for class spContext *****/
+
+spContext::spContext()
+
+       : mpParent        ( NULL ),
+         mpFirstOccurence( NULL ),
+         mAlreadySorted  ( FALSE ),
+
+         mSrcLineNo    (-1),
+         mSrcOffset    (-1),
+         mContextLength(-1),
+         mLastScrLineNo(-1),
+
+         mHeaderLength (-1),
+         mFooterLength (-1),
+
+         mFirstCharPos (-1),
+         mLastCharPos  (-1),
+
+         mVisibility( SP_VIS_PRIVATE ),
+
+         mIsVirtualContext         ( FALSE ),
+         mVirtualContextHasChildren( FALSE ),
+
+         mpUserData( NULL )
+{}
+
+void spContext::RemoveChildren()
+{
+       for( size_t i = 0; i != mMembers.size(); ++i )
+       
+               delete mMembers[i];
+
+       mMembers.erase( mMembers.begin(), mMembers.end() );
+}
+
+spContext::~spContext()
+{
+       RemoveChildren();
+
+       for( size_t i = 0; i != mComments.size(); ++i )
+       
+               delete mComments[i];
+}
+
+bool spContext::IsSorted()
+{
+       return mAlreadySorted;
+}
+
+void spContext::GetContextList( MMemberListT& lst, int contextMask )
+{
+       for( size_t i = 0; i != mMembers.size(); ++i )
+       {
+               spContext& member = *mMembers[i];
+
+               if ( member.GetContextType() & contextMask )
+
+                       lst.push_back( &member );
+
+               // collect required contexts recursively
+               member.GetContextList( lst, contextMask );
+       }
+}
+
+bool spContext::HasComments()
+{
+       return ( mComments.size() != 0 );
+}
+
+void spContext::RemoveChild( spContext* pChild )
+{
+       for( size_t i = 0; i != mMembers.size(); ++i )
+
+               if ( mMembers[i] == pChild )
+               {
+                       mMembers.erase( &mMembers[i] );
+
+                       delete pChild;
+                       return;
+               }
+
+       // the given child should exist on the parent's list 
+       wxASSERT( 0 );
+}
+
+spContext* spContext::GetEnclosingContext( int mask )
+{
+       spContext* cur = this->GetParent();
+
+       while ( cur && !(cur->GetContextType() & mask) ) 
+               
+               cur = cur->GetParent();
+
+       return cur;
+}
+
+bool spContext::PositionIsKnown()
+{
+       return ( mSrcOffset != (-1) && mContextLength != (-1) );
+}
+
+bool spContext::IsVirtualContext()
+{
+       return mIsVirtualContext;
+}
+
+bool spContext::VitualContextHasChildren()
+{
+       return mVirtualContextHasChildren;
+}
+
+string spContext::GetVirtualContextBody()
+{
+       wxASSERT( mIsVirtualContext );
+
+       return mVirtualContextBody;
+}
+
+string spContext::GetFooterOfVirtualContextBody()
+{
+       wxASSERT( mIsVirtualContext );
+
+       return mVittualContextFooter;
+}
+
+
+void spContext::SetVirtualContextBody( const string& body, 
+                                                                          bool          hasChildren,
+                                                                          const string& footer )
+{
+       mVirtualContextHasChildren = hasChildren;
+
+       mVirtualContextBody   = body;
+       mVittualContextFooter = footer;
+
+       // atuomaticllay becomes virtual context
+
+       mIsVirtualContext   = TRUE;
+}
+
+string spContext::GetBody( spContext* pCtx )
+{
+       if ( ( pCtx == NULL || pCtx == this ) && mIsVirtualContext ) 
+               
+               return mVirtualContextBody;
+
+       if ( GetParent() )
+
+               return GetParent()->GetBody( ( pCtx != NULL ) ? pCtx : this );
+       else
+               return ""; // source-fragment cannot be found
+}
+
+string spContext::GetHeader( spContext* pCtx )
+{
+       if ( GetParent() )
+
+               return GetParent()->GetHeader( ( pCtx != NULL ) ? pCtx : this );
+       else
+               return ""; // source-fragment cannot be found
+}
+
+bool spContext::IsFirstOccurence()
+{
+       return ( mpFirstOccurence != 0 );
+}
+
+spContext* spContext::GetFirstOccurence()
+{
+       // this object should not itself be 
+       // the first occurence of the context
+       wxASSERT( mpFirstOccurence != 0 );
+
+       return mpFirstOccurence;
+}
+
+void spContext::AddMember( spContext* pMember )
+{
+       mMembers.push_back( pMember );
+
+       pMember->mpParent = this;
+}
+
+void spContext::AddComment( spComment* pComment )
+{
+       mComments.push_back( pComment );
+}
+
+MMemberListT& spContext::GetMembers()
+{
+       return mMembers;
+}
+
+spContext* spContext::FindContext( const string& identifier,
+                                                              int   contextType,
+                                                                  bool  searchSubMembers
+                                                                )
+{
+       for( size_t i = 0; i != mMembers.size(); ++i )
+       {
+               spContext& member = *mMembers[i];
+
+               if ( member.GetName() == identifier && 
+                        ( contextType & member.GetContextType() )
+                  )
+
+                  return &member;
+
+               if ( searchSubMembers )
+               {
+                       spContext* result = 
+                               member.FindContext( identifier, contextType, 1 );
+
+                       if ( result ) return result;
+               }
+       }
+
+       return 0;
+}
+
+void spContext::RemoveThisContext()
+{
+       if ( mpParent )
+               mpParent->RemoveChild( this );
+       else
+               // context should have a parent
+               wxASSERT(0);
+}
+
+spContext* spContext::GetOutterContext()
+{
+       return mpParent;
+}
+
+bool spContext::HasOutterContext()
+{
+       return ( mpParent != 0 );
+}
+
+bool spContext::IsInFile()
+{
+       return ( GetOutterContext()->GetContextType() == SP_CTX_FILE );
+}
+
+bool spContext::IsInNameSpace()
+{
+       return ( GetOutterContext()->GetContextType() == SP_CTX_NAMESPACE );
+}
+
+bool spContext::IsInClass()
+{
+       return ( GetOutterContext()->GetContextType() == SP_CTX_CLASS );
+}
+
+bool spContext::IsInOperation()
+{
+       return ( GetOutterContext()->GetContextType() == SP_CTX_OPERATION );
+}
+
+spClass& spContext::GetClass()
+{
+       wxASSERT( GetOutterContext()->GetType() == SP_CTX_CLASS );
+       return *((spClass*)mpParent );
+}
+
+spFile& spContext::GetFile()
+{
+       wxASSERT( GetOutterContext()->GetType() == SP_CTX_FILE );
+       return *((spFile*)mpParent );
+}
+
+spNameSpace& spContext::GetNameSpace()
+{
+       wxASSERT( GetOutterContext()->GetType() == SP_CTX_NAMESPACE );
+       return *((spNameSpace*)mpParent );
+}
+
+spOperation& spContext::GetOperation()
+{
+       wxASSERT( GetOutterContext()->GetType() == SP_CTX_OPERATION );
+       return *((spOperation*)mpParent );
+}
+
+/***** Implementation for class spClass *****/
+
+void spClass::SortMembers()
+{
+       // TBD::
+}
+
+/***** Implementation for class spOperation *****/
+
+spOperation::spOperation()
+
+       : mHasDefinition( FALSE )
+{}
+
+string spOperation::GetFullName(MarkupTagsT tags)
+{
+       string txt = tags[TAG_BOLD].start + mRetType;
+       txt += " ";
+       txt += mName;
+       txt += "( ";
+       txt += tags[TAG_BOLD].end;
+       
+       for( size_t i = 0; i != mMembers.size(); ++i )
+       {
+               // DBG::
+               wxASSERT( mMembers[i]->GetContextType() == SP_CTX_PARAMETER );
+
+               spParameter& param = *((spParameter*)mMembers[i]);
+
+               if ( i != 0 )
+                       txt += ", ";
+               
+               txt += tags[TAG_BOLD].start;
+               
+               txt += param.mType;
+
+               txt += tags[TAG_BOLD].end;
+               txt += tags[TAG_ITALIC].start;
+
+               txt += " ";
+               txt += param.mName;
+
+               if ( param.mInitVal != "" )
+               {
+                       txt += " = ";
+                       txt += tags[TAG_BOLD].start;
+
+                       txt += param.mInitVal;
+
+                       txt += tags[TAG_BOLD].end;
+               }
+
+               txt += tags[TAG_ITALIC].end;;
+       }
+
+       txt += tags[TAG_BOLD].start;
+       txt += " )";
+       txt += tags[TAG_BOLD].end;
+
+       // TBD:: constantness of method
+
+       return txt;
+}
+
+/***** Implemenentation for class spPreprocessorLine *****/
+
+string spPreprocessorLine::CPP_GetIncludedFileNeme()
+{
+       wxASSERT( GetStatementType() == SP_PREP_DEF_INCLUDE_FILE );
+
+       size_t i = 0;
+
+       while( i < mLine.length() && mLine[i] != '"' && mLine[i] != '<' ) 
+               
+               ++i;
+
+       ++i;
+
+       size_t start = i;
+
+       while( i < mLine.length() && mLine[i] != '"' && mLine[i] != '>' ) 
+
+               ++i;
+
+       if ( start < mLine.length() )
+       {
+               string fname;
+               fname.append( mLine, start, ( i - start ) );
+
+               return fname;
+       }
+       else
+               return ""; // syntax error probably
+}
+
+
+
+/***** Implemenentation for class SourceParserBase *****/
+
+SourceParserBase::SourceParserBase()
+
+       : mpFileBuf( NULL ),
+         mFileBufSz( 0 ),
+
+         mpPlugin( NULL )
+{}
+
+SourceParserBase::~SourceParserBase()
+{
+       if ( mpFileBuf ) free( mpFileBuf );
+
+       if ( mpPlugin ) delete mpPlugin;
+}
+
+spFile* SourceParserBase::ParseFile( const char* fname )
+{
+       // FIXME:: the below should not be fixed!
+
+       const size_t MAX_BUF_SIZE = 1024*256;
+
+       if ( !mpFileBuf ) mpFileBuf = (char*)malloc( MAX_BUF_SIZE );
+
+       mFileBufSz = MAX_BUF_SIZE;
+
+       FILE* fp = fopen( fname, "rt" );
+
+       if ( (int)fp == -1 || !fp ) return NULL;
+
+       int sz = fread( mpFileBuf, 1, mFileBufSz, fp );
+
+       return Parse( mpFileBuf, mpFileBuf + sz );
+}
+
+void SourceParserBase::SetPlugin( SourceParserPlugin* pPlugin )
+{
+       if ( mpPlugin ) delete mpPlugin;
+
+       mpPlugin = pPlugin;
+}
diff --git a/utils/HelpGen/src/wx_extra_imps.cpp b/utils/HelpGen/src/wx_extra_imps.cpp
new file mode 100644 (file)
index 0000000..6cdc260
--- /dev/null
@@ -0,0 +1,31 @@
+////////////////////
+//
+// craeted by Alex
+//
+////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#include <memory.h>
+
+#ifndef WX_PRECOMP
+    #include "wx/defs.h"
+#endif
+
+char *
+copystring (const char *s)
+{
+  if (s == NULL) s = "";
+  size_t len = strlen (s) + 1;
+
+  char *news = new char[len];
+  memcpy (news, s, len);    // Should be the fastest
+
+  return news;
+}
+
+const char *wxGetTranslation(const char *str)
+{
+    return str;
+}