added wxString benchmark using 2.8's HTML parser

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-08-13 15:48:09 +00:00
parent 4c25eaccc9
commit c21faa0a3e
16 changed files with 2532 additions and 489 deletions

View File

@@ -44,6 +44,8 @@ BENCH_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(CXXFLAGS)
BENCH_OBJECTS = \
bench_bench.o \
bench_htmlpars.o \
bench_htmltag.o \
bench_strings.o \
bench_tls.o
@@ -84,7 +86,7 @@ COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p = \
### Targets: ###
all: bench$(EXEEXT)
all: bench$(EXEEXT) data
install: all
@@ -106,9 +108,27 @@ bench$(EXEEXT): $(BENCH_OBJECTS)
$(__bench___mac_setfilecmd)
$(SAMPLES_RPATH_POSTLINK)
data:
@mkdir -p .
@for f in htmltest.html; do \
if test ! -f ./$$f -a ! -d ./$$f ; \
then x=yep ; \
else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
fi; \
case "$$x" in ?*) \
cp -pRf $(srcdir)/$$f . ;; \
esac; \
done
bench_bench.o: $(srcdir)/bench.cpp
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/bench.cpp
bench_htmlpars.o: $(srcdir)/htmlparser/htmlpars.cpp
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/htmlparser/htmlpars.cpp
bench_htmltag.o: $(srcdir)/htmlparser/htmltag.cpp
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/htmlparser/htmltag.cpp
bench_strings.o: $(srcdir)/strings.cpp
$(CXXC) -c -o $@ $(BENCH_CXXFLAGS) $(srcdir)/strings.cpp
@@ -128,4 +148,4 @@ $(srcdir)/include/wx/stc/stc.h
# Include dependency info, if present:
@IF_GNU_MAKE@-include .deps/*.d
.PHONY: all install uninstall clean distclean
.PHONY: all install uninstall clean distclean data

View File

@@ -11,12 +11,18 @@
template_append="wx_append_base">
<sources>
bench.cpp
htmlparser/htmlpars.cpp
htmlparser/htmltag.cpp
strings.cpp
tls.cpp
</sources>
<wx-lib>base</wx-lib>
</exe>
<wx-data id="data">
<files>htmltest.html</files>
</wx-data>
<!-- this is unused yet
<exe id="bench_gui" template="wx_sample,wx_bench"
template_append="wx_append"

View File

@@ -38,185 +38,185 @@ RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswunivudll"
# PROP BASE Intermediate_Dir "vc_mswunivudll\bench"
# PROP BASE Output_Dir "vc6_mswunivudll"
# PROP BASE Intermediate_Dir "vc6_mswunivudll\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswunivudll"
# PROP Intermediate_Dir "vc_mswunivudll\bench"
# PROP Output_Dir "vc6_mswunivudll"
# PROP Intermediate_Dir "vc6_mswunivudll\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc_mswunivudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc_mswunivudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc6_mswunivudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc6_mswunivudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\bench.exe" /debug /pdb:"vc_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\bench.exe" /debug /pdb:"vc_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivudll\bench.exe" /debug /pdb:"vc6_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivudll\bench.exe" /debug /pdb:"vc6_mswunivudll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 DLL Universal Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswunivuddll"
# PROP BASE Intermediate_Dir "vc_mswunivuddll\bench"
# PROP BASE Output_Dir "vc6_mswunivuddll"
# PROP BASE Intermediate_Dir "vc6_mswunivuddll\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswunivuddll"
# PROP Intermediate_Dir "vc_mswunivuddll\bench"
# PROP Output_Dir "vc6_mswunivuddll"
# PROP Intermediate_Dir "vc6_mswunivuddll\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc_mswunivuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc_mswunivuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc6_mswunivuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc6_mswunivuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\bench.exe" /debug /pdb:"vc_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\bench.exe" /debug /pdb:"vc_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivuddll\bench.exe" /debug /pdb:"vc6_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivuddll\bench.exe" /debug /pdb:"vc6_mswunivuddll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 DLL Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswudll"
# PROP BASE Intermediate_Dir "vc_mswudll\bench"
# PROP BASE Output_Dir "vc6_mswudll"
# PROP BASE Intermediate_Dir "vc6_mswudll\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswudll"
# PROP Intermediate_Dir "vc_mswudll\bench"
# PROP Output_Dir "vc6_mswudll"
# PROP Intermediate_Dir "vc6_mswudll\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc_mswudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc_mswudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc6_mswudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc6_mswudll\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\bench.exe" /debug /pdb:"vc_mswudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\bench.exe" /debug /pdb:"vc_mswudll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswudll\bench.exe" /debug /pdb:"vc6_mswudll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswudll\bench.exe" /debug /pdb:"vc6_mswudll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 DLL Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswuddll"
# PROP BASE Intermediate_Dir "vc_mswuddll\bench"
# PROP BASE Output_Dir "vc6_mswuddll"
# PROP BASE Intermediate_Dir "vc6_mswuddll\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswuddll"
# PROP Intermediate_Dir "vc_mswuddll\bench"
# PROP Output_Dir "vc6_mswuddll"
# PROP Intermediate_Dir "vc6_mswuddll\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc_mswuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc_mswuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc6_mswuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc6_mswuddll\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\bench.exe" /debug /pdb:"vc_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\bench.exe" /debug /pdb:"vc_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:console
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswuddll\bench.exe" /debug /pdb:"vc6_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswuddll\bench.exe" /debug /pdb:"vc6_mswuddll\bench.pdb" /libpath:".\..\..\lib\vc6_dll" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 Universal Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswunivu"
# PROP BASE Intermediate_Dir "vc_mswunivu\bench"
# PROP BASE Output_Dir "vc6_mswunivu"
# PROP BASE Intermediate_Dir "vc6_mswunivu\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswunivu"
# PROP Intermediate_Dir "vc_mswunivu\bench"
# PROP Output_Dir "vc6_mswunivu"
# PROP Intermediate_Dir "vc6_mswunivu\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc_mswunivu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc_mswunivu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc6_mswunivu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc6_mswunivu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\bench.exe" /debug /pdb:"vc_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\bench.exe" /debug /pdb:"vc_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivu\bench.exe" /debug /pdb:"vc6_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivu\bench.exe" /debug /pdb:"vc6_mswunivu\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 Universal Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswunivud"
# PROP BASE Intermediate_Dir "vc_mswunivud\bench"
# PROP BASE Output_Dir "vc6_mswunivud"
# PROP BASE Intermediate_Dir "vc6_mswunivud\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswunivud"
# PROP Intermediate_Dir "vc_mswunivud\bench"
# PROP Output_Dir "vc6_mswunivud"
# PROP Intermediate_Dir "vc6_mswunivud\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc_mswunivud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc_mswunivud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc6_mswunivud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc6_mswunivud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\bench.exe" /debug /pdb:"vc_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\bench.exe" /debug /pdb:"vc_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivud\bench.exe" /debug /pdb:"vc6_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswunivud\bench.exe" /debug /pdb:"vc6_mswunivud\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswu"
# PROP BASE Intermediate_Dir "vc_mswu\bench"
# PROP BASE Output_Dir "vc6_mswu"
# PROP BASE Intermediate_Dir "vc6_mswu\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswu"
# PROP Intermediate_Dir "vc_mswu\bench"
# PROP Output_Dir "vc6_mswu"
# PROP Intermediate_Dir "vc6_mswu\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc_mswu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc_mswu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc6_mswu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc6_mswu\bench.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc6_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\bench.exe" /debug /pdb:"vc_mswu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\bench.exe" /debug /pdb:"vc_mswu\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD BASE LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswu\bench.exe" /debug /pdb:"vc6_mswu\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
# ADD LINK32 wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswu\bench.exe" /debug /pdb:"vc6_mswu\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
!ELSEIF "$(CFG)" == "bench - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswud"
# PROP BASE Intermediate_Dir "vc_mswud\bench"
# PROP BASE Output_Dir "vc6_mswud"
# PROP BASE Intermediate_Dir "vc6_mswud\bench"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswud"
# PROP Intermediate_Dir "vc_mswud\bench"
# PROP Output_Dir "vc6_mswud"
# PROP Intermediate_Dir "vc6_mswud\bench"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc_mswud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc_mswud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc6_mswud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc6_mswud\bench.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc6_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc6_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\bench.exe" /debug /pdb:"vc_mswud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\bench.exe" /debug /pdb:"vc_mswud\bench.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:console
# ADD BASE LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswud\bench.exe" /debug /pdb:"vc6_mswud\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
# ADD LINK32 wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc6_mswud\bench.exe" /debug /pdb:"vc6_mswud\bench.pdb" /libpath:".\..\..\lib\vc6_lib" /subsystem:console
!ENDIF
@@ -239,6 +239,14 @@ SOURCE=.\bench.cpp
# End Source File
# Begin Source File
SOURCE=.\htmlparser\htmlpars.cpp
# End Source File
# Begin Source File
SOURCE=.\htmlparser\htmltag.cpp
# End Source File
# Begin Source File
SOURCE=.\strings.cpp
# End Source File
# Begin Source File

View File

@@ -1,5 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench", "bench.vcproj", "{205F8D16-BA71-560B-A3DF-7A2A93B16CF6}"
EndProject
Global

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
This is a copy of wxWidgets 2.8's wxHTML parser. Unlike the 2.9+ version, it
uses wxString::operator[] during parsing and so is perfect for testing
real-life perfomance of the new wxString class' operator[] caching.

View File

@@ -0,0 +1,954 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/html/htmlpars.cpp
// Purpose: wx28HtmlParser class (generic parser)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "htmlpars.h"
#ifndef WXPRECOMP
#include "wx/dynarray.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/app.h"
#endif
#include "wx/tokenzr.h"
#include "wx/wfstream.h"
#include "wx/url.h"
#include "wx/fontmap.h"
#include "wx/html/htmldefs.h"
#include "wx/arrimpl.cpp"
#ifdef __WXWINCE__
#include "wx/msw/wince/missing.h" // for bsearch()
#endif
// DLL options compatibility check:
WX_CHECK_BUILD_OPTIONS("wxHTML")
const wxChar *wxTRACE_HTML_DEBUG = _T("htmldebug");
//-----------------------------------------------------------------------------
// wx28HtmlParser helpers
//-----------------------------------------------------------------------------
class wx28HtmlTextPiece
{
public:
wx28HtmlTextPiece(int pos, int lng) : m_pos(pos), m_lng(lng) {}
int m_pos, m_lng;
};
WX_DECLARE_OBJARRAY(wx28HtmlTextPiece, wx28HtmlTextPieces);
WX_DEFINE_OBJARRAY(wx28HtmlTextPieces)
class wx28HtmlParserState
{
public:
wx28HtmlTag *m_curTag;
wx28HtmlTag *m_tags;
wx28HtmlTextPieces *m_textPieces;
int m_curTextPiece;
wxString m_source;
wx28HtmlParserState *m_nextState;
};
//-----------------------------------------------------------------------------
// wx28HtmlParser
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wx28HtmlParser,wxObject)
wx28HtmlParser::wx28HtmlParser()
: wxObject(), m_HandlersHash(wxKEY_STRING),
m_FS(NULL), m_HandlersStack(NULL)
{
m_entitiesParser = new wx28HtmlEntitiesParser;
m_Tags = NULL;
m_CurTag = NULL;
m_TextPieces = NULL;
m_CurTextPiece = 0;
m_SavedStates = NULL;
}
wx28HtmlParser::~wx28HtmlParser()
{
while (RestoreState()) {}
DestroyDOMTree();
if (m_HandlersStack)
{
wxList& tmp = *m_HandlersStack;
wxList::iterator it, en;
for( it = tmp.begin(), en = tmp.end(); it != en; ++it )
delete (wxHashTable*)*it;
tmp.clear();
}
delete m_HandlersStack;
m_HandlersHash.Clear();
WX_CLEAR_LIST(wxList, m_HandlersList);
delete m_entitiesParser;
}
wxObject* wx28HtmlParser::Parse(const wxString& source)
{
InitParser(source);
DoParsing();
wxObject *result = GetProduct();
DoneParser();
return result;
}
void wx28HtmlParser::InitParser(const wxString& source)
{
SetSource(source);
m_stopParsing = false;
}
void wx28HtmlParser::DoneParser()
{
DestroyDOMTree();
}
void wx28HtmlParser::SetSource(const wxString& src)
{
DestroyDOMTree();
m_Source = src;
CreateDOMTree();
m_CurTag = NULL;
m_CurTextPiece = 0;
}
void wx28HtmlParser::CreateDOMTree()
{
wx28HtmlTagsCache cache(m_Source);
m_TextPieces = new wx28HtmlTextPieces;
CreateDOMSubTree(NULL, 0, m_Source.length(), &cache);
m_CurTextPiece = 0;
}
extern bool wxIsCDATAElement(const wxChar *tag);
void wx28HtmlParser::CreateDOMSubTree(wx28HtmlTag *cur,
int begin_pos, int end_pos,
wx28HtmlTagsCache *cache)
{
if (end_pos <= begin_pos) return;
wxChar c;
int i = begin_pos;
int textBeginning = begin_pos;
// If the tag contains CDATA text, we include the text between beginning
// and ending tag verbosely. Setting i=end_pos will skip to the very
// end of this function where text piece is added, bypassing any child
// tags parsing (CDATA element can't have child elements by definition):
if (cur != NULL && wxIsCDATAElement(cur->GetName().c_str()))
{
i = end_pos;
}
while (i < end_pos)
{
c = m_Source.GetChar(i);
if (c == wxT('<'))
{
// add text to m_TextPieces:
if (i - textBeginning > 0)
m_TextPieces->Add(
wx28HtmlTextPiece(textBeginning, i - textBeginning));
// if it is a comment, skip it:
if (i < end_pos-6 && m_Source.GetChar(i+1) == wxT('!') &&
m_Source.GetChar(i+2) == wxT('-') &&
m_Source.GetChar(i+3) == wxT('-'))
{
// Comments begin with "<!--" and end with "--[ \t\r\n]*>"
// according to HTML 4.0
int dashes = 0;
i += 4;
while (i < end_pos)
{
c = m_Source.GetChar(i++);
if ((c == wxT(' ') || c == wxT('\n') ||
c == wxT('\r') || c == wxT('\t')) && dashes >= 2) {}
else if (c == wxT('>') && dashes >= 2)
{
textBeginning = i;
break;
}
else if (c == wxT('-'))
dashes++;
else
dashes = 0;
}
}
// add another tag to the tree:
else if (i < end_pos-1 && m_Source.GetChar(i+1) != wxT('/'))
{
wx28HtmlTag *chd;
if (cur)
chd = new wx28HtmlTag(cur, m_Source,
i, end_pos, cache, m_entitiesParser);
else
{
chd = new wx28HtmlTag(NULL, m_Source,
i, end_pos, cache, m_entitiesParser);
if (!m_Tags)
{
// if this is the first tag to be created make the root
// m_Tags point to it:
m_Tags = chd;
}
else
{
// if there is already a root tag add this tag as
// the last sibling:
chd->m_Prev = m_Tags->GetLastSibling();
chd->m_Prev->m_Next = chd;
}
}
if (chd->HasEnding())
{
CreateDOMSubTree(chd,
chd->GetBeginPos(), chd->GetEndPos1(),
cache);
i = chd->GetEndPos2();
}
else
i = chd->GetBeginPos();
textBeginning = i;
}
// ... or skip ending tag:
else
{
while (i < end_pos && m_Source.GetChar(i) != wxT('>')) i++;
textBeginning = i+1;
}
}
else i++;
}
// add remaining text to m_TextPieces:
if (end_pos - textBeginning > 0)
m_TextPieces->Add(
wx28HtmlTextPiece(textBeginning, end_pos - textBeginning));
}
void wx28HtmlParser::DestroyDOMTree()
{
wx28HtmlTag *t1, *t2;
t1 = m_Tags;
while (t1)
{
t2 = t1->GetNextSibling();
delete t1;
t1 = t2;
}
m_Tags = m_CurTag = NULL;
delete m_TextPieces;
m_TextPieces = NULL;
}
void wx28HtmlParser::DoParsing()
{
m_CurTag = m_Tags;
m_CurTextPiece = 0;
DoParsing(0, m_Source.length());
}
void wx28HtmlParser::DoParsing(int begin_pos, int end_pos)
{
if (end_pos <= begin_pos) return;
wx28HtmlTextPieces& pieces = *m_TextPieces;
size_t piecesCnt = pieces.GetCount();
while (begin_pos < end_pos)
{
while (m_CurTag && m_CurTag->GetBeginPos() < begin_pos)
m_CurTag = m_CurTag->GetNextTag();
while (m_CurTextPiece < piecesCnt &&
pieces[m_CurTextPiece].m_pos < begin_pos)
m_CurTextPiece++;
if (m_CurTextPiece < piecesCnt &&
(!m_CurTag ||
pieces[m_CurTextPiece].m_pos < m_CurTag->GetBeginPos()))
{
// Add text:
AddText(GetEntitiesParser()->Parse(
m_Source.Mid(pieces[m_CurTextPiece].m_pos,
pieces[m_CurTextPiece].m_lng)));
begin_pos = pieces[m_CurTextPiece].m_pos +
pieces[m_CurTextPiece].m_lng;
m_CurTextPiece++;
}
else if (m_CurTag)
{
if (m_CurTag->HasEnding())
begin_pos = m_CurTag->GetEndPos2();
else
begin_pos = m_CurTag->GetBeginPos();
wx28HtmlTag *t = m_CurTag;
m_CurTag = m_CurTag->GetNextTag();
AddTag(*t);
if (m_stopParsing)
return;
}
else break;
}
}
void wx28HtmlParser::AddTag(const wx28HtmlTag& tag)
{
wx28HtmlTagHandler *h;
bool inner = false;
h = (wx28HtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
if (h)
{
inner = h->HandleTag(tag);
if (m_stopParsing)
return;
}
if (!inner)
{
if (tag.HasEnding())
DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
}
}
void wx28HtmlParser::AddTagHandler(wx28HtmlTagHandler *handler)
{
wxString s(handler->GetSupportedTags());
wxStringTokenizer tokenizer(s, wxT(", "));
while (tokenizer.HasMoreTokens())
m_HandlersHash.Put(tokenizer.GetNextToken(), handler);
if (m_HandlersList.IndexOf(handler) == wxNOT_FOUND)
m_HandlersList.Append(handler);
handler->SetParser(this);
}
void wx28HtmlParser::PushTagHandler(wx28HtmlTagHandler *handler, const wxString& tags)
{
wxStringTokenizer tokenizer(tags, wxT(", "));
wxString key;
if (m_HandlersStack == NULL)
{
m_HandlersStack = new wxList;
}
m_HandlersStack->Insert((wxObject*)new wxHashTable(m_HandlersHash));
while (tokenizer.HasMoreTokens())
{
key = tokenizer.GetNextToken();
m_HandlersHash.Delete(key);
m_HandlersHash.Put(key, handler);
}
}
void wx28HtmlParser::PopTagHandler()
{
wxList::compatibility_iterator first;
if ( !m_HandlersStack ||
#if wxUSE_STL
!(first = m_HandlersStack->GetFirst())
#else // !wxUSE_STL
((first = m_HandlersStack->GetFirst()) == NULL)
#endif // wxUSE_STL/!wxUSE_STL
)
{
wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
return;
}
m_HandlersHash = *((wxHashTable*) first->GetData());
delete (wxHashTable*) first->GetData();
m_HandlersStack->Erase(first);
}
void wx28HtmlParser::SetSourceAndSaveState(const wxString& src)
{
wx28HtmlParserState *s = new wx28HtmlParserState;
s->m_curTag = m_CurTag;
s->m_tags = m_Tags;
s->m_textPieces = m_TextPieces;
s->m_curTextPiece = m_CurTextPiece;
s->m_source = m_Source;
s->m_nextState = m_SavedStates;
m_SavedStates = s;
m_CurTag = NULL;
m_Tags = NULL;
m_TextPieces = NULL;
m_CurTextPiece = 0;
m_Source = wxEmptyString;
SetSource(src);
}
bool wx28HtmlParser::RestoreState()
{
if (!m_SavedStates) return false;
DestroyDOMTree();
wx28HtmlParserState *s = m_SavedStates;
m_SavedStates = s->m_nextState;
m_CurTag = s->m_curTag;
m_Tags = s->m_tags;
m_TextPieces = s->m_textPieces;
m_CurTextPiece = s->m_curTextPiece;
m_Source = s->m_source;
delete s;
return true;
}
wxString wx28HtmlParser::GetInnerSource(const wx28HtmlTag& tag)
{
return GetSource()->Mid(tag.GetBeginPos(),
tag.GetEndPos1() - tag.GetBeginPos());
}
//-----------------------------------------------------------------------------
// wx28HtmlTagHandler
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wx28HtmlTagHandler,wxObject)
void wx28HtmlTagHandler::ParseInnerSource(const wxString& source)
{
// It is safe to temporarily change the source being parsed,
// provided we restore the state back after parsing
m_Parser->SetSourceAndSaveState(source);
m_Parser->DoParsing();
m_Parser->RestoreState();
}
//-----------------------------------------------------------------------------
// wx28HtmlEntitiesParser
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wx28HtmlEntitiesParser,wxObject)
wx28HtmlEntitiesParser::wx28HtmlEntitiesParser()
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
: m_conv(NULL), m_encoding(wxFONTENCODING_SYSTEM)
#endif
{
}
wx28HtmlEntitiesParser::~wx28HtmlEntitiesParser()
{
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
delete m_conv;
#endif
}
void wx28HtmlEntitiesParser::SetEncoding(wxFontEncoding encoding)
{
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
if (encoding == m_encoding)
return;
delete m_conv;
m_encoding = encoding;
if (m_encoding == wxFONTENCODING_SYSTEM)
m_conv = NULL;
else
m_conv = new wxCSConv(wxFontMapper::GetEncodingName(m_encoding));
#else
(void) encoding;
#endif
}
wxString wx28HtmlEntitiesParser::Parse(const wxString& input)
{
const wxChar *c, *last;
const wxChar *in_str = input.c_str();
wxString output;
for (c = in_str, last = in_str; *c != wxT('\0'); c++)
{
if (*c == wxT('&'))
{
if ( output.empty() )
output.reserve(input.length());
if (c - last > 0)
output.append(last, c - last);
if ( *++c == wxT('\0') )
break;
wxString entity;
const wxChar *ent_s = c;
wxChar entity_char;
for (; (*c >= wxT('a') && *c <= wxT('z')) ||
(*c >= wxT('A') && *c <= wxT('Z')) ||
(*c >= wxT('0') && *c <= wxT('9')) ||
*c == wxT('_') || *c == wxT('#'); c++) {}
entity.append(ent_s, c - ent_s);
if (*c != wxT(';')) c--;
last = c+1;
entity_char = GetEntityChar(entity);
if (entity_char)
output << entity_char;
else
{
output.append(ent_s-1, c-ent_s+2);
wxLogTrace(wxTRACE_HTML_DEBUG,
wxT("Unrecognized HTML entity: '%s'"),
entity.c_str());
}
}
}
if (last == in_str) // common case: no entity
return input;
if (*last != wxT('\0'))
output.append(last);
return output;
}
struct wx28HtmlEntityInfo
{
const wxChar *name;
unsigned code;
};
extern "C" int LINKAGEMODE wx28HtmlEntityCompare(const void *key, const void *item)
{
return wxStrcmp((wxChar*)key, ((wx28HtmlEntityInfo*)item)->name);
}
#if !wxUSE_UNICODE
wxChar wx28HtmlEntitiesParser::GetCharForCode(unsigned code)
{
#if wxUSE_WCHAR_T
char buf[2];
wchar_t wbuf[2];
wbuf[0] = (wchar_t)code;
wbuf[1] = 0;
wxMBConv *conv = m_conv ? m_conv : &wxConvLocal;
if (conv->WC2MB(buf, wbuf, 2) == (size_t)-1)
return '?';
return buf[0];
#else
return (code < 256) ? (wxChar)code : '?';
#endif
}
#endif
wxChar wx28HtmlEntitiesParser::GetEntityChar(const wxString& entity)
{
unsigned code = 0;
if (entity[0] == wxT('#'))
{
const wxChar *ent_s = entity.c_str();
const wxChar *format;
if (ent_s[1] == wxT('x') || ent_s[1] == wxT('X'))
{
format = wxT("%x");
ent_s++;
}
else
format = wxT("%u");
ent_s++;
if (wxSscanf(ent_s, format, &code) != 1)
code = 0;
}
else
{
static wx28HtmlEntityInfo substitutions[] = {
{ wxT("AElig"),198 },
{ wxT("Aacute"),193 },
{ wxT("Acirc"),194 },
{ wxT("Agrave"),192 },
{ wxT("Alpha"),913 },
{ wxT("Aring"),197 },
{ wxT("Atilde"),195 },
{ wxT("Auml"),196 },
{ wxT("Beta"),914 },
{ wxT("Ccedil"),199 },
{ wxT("Chi"),935 },
{ wxT("Dagger"),8225 },
{ wxT("Delta"),916 },
{ wxT("ETH"),208 },
{ wxT("Eacute"),201 },
{ wxT("Ecirc"),202 },
{ wxT("Egrave"),200 },
{ wxT("Epsilon"),917 },
{ wxT("Eta"),919 },
{ wxT("Euml"),203 },
{ wxT("Gamma"),915 },
{ wxT("Iacute"),205 },
{ wxT("Icirc"),206 },
{ wxT("Igrave"),204 },
{ wxT("Iota"),921 },
{ wxT("Iuml"),207 },
{ wxT("Kappa"),922 },
{ wxT("Lambda"),923 },
{ wxT("Mu"),924 },
{ wxT("Ntilde"),209 },
{ wxT("Nu"),925 },
{ wxT("OElig"),338 },
{ wxT("Oacute"),211 },
{ wxT("Ocirc"),212 },
{ wxT("Ograve"),210 },
{ wxT("Omega"),937 },
{ wxT("Omicron"),927 },
{ wxT("Oslash"),216 },
{ wxT("Otilde"),213 },
{ wxT("Ouml"),214 },
{ wxT("Phi"),934 },
{ wxT("Pi"),928 },
{ wxT("Prime"),8243 },
{ wxT("Psi"),936 },
{ wxT("Rho"),929 },
{ wxT("Scaron"),352 },
{ wxT("Sigma"),931 },
{ wxT("THORN"),222 },
{ wxT("Tau"),932 },
{ wxT("Theta"),920 },
{ wxT("Uacute"),218 },
{ wxT("Ucirc"),219 },
{ wxT("Ugrave"),217 },
{ wxT("Upsilon"),933 },
{ wxT("Uuml"),220 },
{ wxT("Xi"),926 },
{ wxT("Yacute"),221 },
{ wxT("Yuml"),376 },
{ wxT("Zeta"),918 },
{ wxT("aacute"),225 },
{ wxT("acirc"),226 },
{ wxT("acute"),180 },
{ wxT("aelig"),230 },
{ wxT("agrave"),224 },
{ wxT("alefsym"),8501 },
{ wxT("alpha"),945 },
{ wxT("amp"),38 },
{ wxT("and"),8743 },
{ wxT("ang"),8736 },
{ wxT("aring"),229 },
{ wxT("asymp"),8776 },
{ wxT("atilde"),227 },
{ wxT("auml"),228 },
{ wxT("bdquo"),8222 },
{ wxT("beta"),946 },
{ wxT("brvbar"),166 },
{ wxT("bull"),8226 },
{ wxT("cap"),8745 },
{ wxT("ccedil"),231 },
{ wxT("cedil"),184 },
{ wxT("cent"),162 },
{ wxT("chi"),967 },
{ wxT("circ"),710 },
{ wxT("clubs"),9827 },
{ wxT("cong"),8773 },
{ wxT("copy"),169 },
{ wxT("crarr"),8629 },
{ wxT("cup"),8746 },
{ wxT("curren"),164 },
{ wxT("dArr"),8659 },
{ wxT("dagger"),8224 },
{ wxT("darr"),8595 },
{ wxT("deg"),176 },
{ wxT("delta"),948 },
{ wxT("diams"),9830 },
{ wxT("divide"),247 },
{ wxT("eacute"),233 },
{ wxT("ecirc"),234 },
{ wxT("egrave"),232 },
{ wxT("empty"),8709 },
{ wxT("emsp"),8195 },
{ wxT("ensp"),8194 },
{ wxT("epsilon"),949 },
{ wxT("equiv"),8801 },
{ wxT("eta"),951 },
{ wxT("eth"),240 },
{ wxT("euml"),235 },
{ wxT("euro"),8364 },
{ wxT("exist"),8707 },
{ wxT("fnof"),402 },
{ wxT("forall"),8704 },
{ wxT("frac12"),189 },
{ wxT("frac14"),188 },
{ wxT("frac34"),190 },
{ wxT("frasl"),8260 },
{ wxT("gamma"),947 },
{ wxT("ge"),8805 },
{ wxT("gt"),62 },
{ wxT("hArr"),8660 },
{ wxT("harr"),8596 },
{ wxT("hearts"),9829 },
{ wxT("hellip"),8230 },
{ wxT("iacute"),237 },
{ wxT("icirc"),238 },
{ wxT("iexcl"),161 },
{ wxT("igrave"),236 },
{ wxT("image"),8465 },
{ wxT("infin"),8734 },
{ wxT("int"),8747 },
{ wxT("iota"),953 },
{ wxT("iquest"),191 },
{ wxT("isin"),8712 },
{ wxT("iuml"),239 },
{ wxT("kappa"),954 },
{ wxT("lArr"),8656 },
{ wxT("lambda"),955 },
{ wxT("lang"),9001 },
{ wxT("laquo"),171 },
{ wxT("larr"),8592 },
{ wxT("lceil"),8968 },
{ wxT("ldquo"),8220 },
{ wxT("le"),8804 },
{ wxT("lfloor"),8970 },
{ wxT("lowast"),8727 },
{ wxT("loz"),9674 },
{ wxT("lrm"),8206 },
{ wxT("lsaquo"),8249 },
{ wxT("lsquo"),8216 },
{ wxT("lt"),60 },
{ wxT("macr"),175 },
{ wxT("mdash"),8212 },
{ wxT("micro"),181 },
{ wxT("middot"),183 },
{ wxT("minus"),8722 },
{ wxT("mu"),956 },
{ wxT("nabla"),8711 },
{ wxT("nbsp"),160 },
{ wxT("ndash"),8211 },
{ wxT("ne"),8800 },
{ wxT("ni"),8715 },
{ wxT("not"),172 },
{ wxT("notin"),8713 },
{ wxT("nsub"),8836 },
{ wxT("ntilde"),241 },
{ wxT("nu"),957 },
{ wxT("oacute"),243 },
{ wxT("ocirc"),244 },
{ wxT("oelig"),339 },
{ wxT("ograve"),242 },
{ wxT("oline"),8254 },
{ wxT("omega"),969 },
{ wxT("omicron"),959 },
{ wxT("oplus"),8853 },
{ wxT("or"),8744 },
{ wxT("ordf"),170 },
{ wxT("ordm"),186 },
{ wxT("oslash"),248 },
{ wxT("otilde"),245 },
{ wxT("otimes"),8855 },
{ wxT("ouml"),246 },
{ wxT("para"),182 },
{ wxT("part"),8706 },
{ wxT("permil"),8240 },
{ wxT("perp"),8869 },
{ wxT("phi"),966 },
{ wxT("pi"),960 },
{ wxT("piv"),982 },
{ wxT("plusmn"),177 },
{ wxT("pound"),163 },
{ wxT("prime"),8242 },
{ wxT("prod"),8719 },
{ wxT("prop"),8733 },
{ wxT("psi"),968 },
{ wxT("quot"),34 },
{ wxT("rArr"),8658 },
{ wxT("radic"),8730 },
{ wxT("rang"),9002 },
{ wxT("raquo"),187 },
{ wxT("rarr"),8594 },
{ wxT("rceil"),8969 },
{ wxT("rdquo"),8221 },
{ wxT("real"),8476 },
{ wxT("reg"),174 },
{ wxT("rfloor"),8971 },
{ wxT("rho"),961 },
{ wxT("rlm"),8207 },
{ wxT("rsaquo"),8250 },
{ wxT("rsquo"),8217 },
{ wxT("sbquo"),8218 },
{ wxT("scaron"),353 },
{ wxT("sdot"),8901 },
{ wxT("sect"),167 },
{ wxT("shy"),173 },
{ wxT("sigma"),963 },
{ wxT("sigmaf"),962 },
{ wxT("sim"),8764 },
{ wxT("spades"),9824 },
{ wxT("sub"),8834 },
{ wxT("sube"),8838 },
{ wxT("sum"),8721 },
{ wxT("sup"),8835 },
{ wxT("sup1"),185 },
{ wxT("sup2"),178 },
{ wxT("sup3"),179 },
{ wxT("supe"),8839 },
{ wxT("szlig"),223 },
{ wxT("tau"),964 },
{ wxT("there4"),8756 },
{ wxT("theta"),952 },
{ wxT("thetasym"),977 },
{ wxT("thinsp"),8201 },
{ wxT("thorn"),254 },
{ wxT("tilde"),732 },
{ wxT("times"),215 },
{ wxT("trade"),8482 },
{ wxT("uArr"),8657 },
{ wxT("uacute"),250 },
{ wxT("uarr"),8593 },
{ wxT("ucirc"),251 },
{ wxT("ugrave"),249 },
{ wxT("uml"),168 },
{ wxT("upsih"),978 },
{ wxT("upsilon"),965 },
{ wxT("uuml"),252 },
{ wxT("weierp"),8472 },
{ wxT("xi"),958 },
{ wxT("yacute"),253 },
{ wxT("yen"),165 },
{ wxT("yuml"),255 },
{ wxT("zeta"),950 },
{ wxT("zwj"),8205 },
{ wxT("zwnj"),8204 },
{NULL, 0}};
static size_t substitutions_cnt = 0;
if (substitutions_cnt == 0)
while (substitutions[substitutions_cnt].code != 0)
substitutions_cnt++;
wx28HtmlEntityInfo *info = NULL;
#ifdef __WXWINCE__
// bsearch crashes under WinCE for some reason
size_t i;
for (i = 0; i < substitutions_cnt; i++)
{
if (entity == substitutions[i].name)
{
info = & substitutions[i];
break;
}
}
#else
info = (wx28HtmlEntityInfo*) bsearch(entity.c_str(), substitutions,
substitutions_cnt,
sizeof(wx28HtmlEntityInfo),
wx28HtmlEntityCompare);
#endif
if (info)
code = info->code;
}
if (code == 0)
return 0;
else
return GetCharForCode(code);
}
wxFSFile *wx28HtmlParser::OpenURL(wx28HtmlURLType WXUNUSED(type),
const wxString& url) const
{
return m_FS ? m_FS->OpenFile(url) : NULL;
}
//-----------------------------------------------------------------------------
// wx28HtmlParser::ExtractCharsetInformation
//-----------------------------------------------------------------------------
class wxMetaTagParser : public wx28HtmlParser
{
public:
wxMetaTagParser() { }
wxObject* GetProduct() { return NULL; }
protected:
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
DECLARE_NO_COPY_CLASS(wxMetaTagParser)
};
class wxMetaTagHandler : public wx28HtmlTagHandler
{
public:
wxMetaTagHandler(wxString *retval) : wx28HtmlTagHandler(), m_retval(retval) {}
wxString GetSupportedTags() { return wxT("META,BODY"); }
bool HandleTag(const wx28HtmlTag& tag);
private:
wxString *m_retval;
DECLARE_NO_COPY_CLASS(wxMetaTagHandler)
};
bool wxMetaTagHandler::HandleTag(const wx28HtmlTag& tag)
{
if (tag.GetName() == _T("BODY"))
{
m_Parser->StopParsing();
return false;
}
if (tag.HasParam(_T("HTTP-EQUIV")) &&
tag.GetParam(_T("HTTP-EQUIV")).IsSameAs(_T("Content-Type"), false) &&
tag.HasParam(_T("CONTENT")))
{
wxString content = tag.GetParam(_T("CONTENT")).Lower();
if (content.Left(19) == _T("text/html; charset="))
{
*m_retval = content.Mid(19);
m_Parser->StopParsing();
}
}
return false;
}
/*static*/
wxString wx28HtmlParser::ExtractCharsetInformation(const wxString& markup)
{
wxString charset;
wxMetaTagParser *parser = new wxMetaTagParser();
if(parser)
{
parser->AddTagHandler(new wxMetaTagHandler(&charset));
parser->Parse(markup);
delete parser;
}
return charset;
}

View File

@@ -0,0 +1,280 @@
/////////////////////////////////////////////////////////////////////////////
// Name: htmlpars.h
// Purpose: wx28HtmlParser class (generic parser)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HTMLPARS_H_
#define _WX_HTMLPARS_H_
#include "wx/defs.h"
#include "wx/filesys.h"
#include "wx/hash.h"
#include "wx/fontenc.h"
#include "htmltag.h"
class wxMBConv;
class wx28HtmlParser;
class wx28HtmlTagHandler;
class wx28HtmlEntitiesParser;
class wx28HtmlTextPieces;
class wx28HtmlParserState;
enum wx28HtmlURLType
{
wxHTML_URL_PAGE,
wxHTML_URL_IMAGE,
wxHTML_URL_OTHER
};
// This class handles generic parsing of HTML document : it scans
// the document and divides it into blocks of tags (where one block
// consists of starting and ending tag and of text between these
// 2 tags.
class wx28HtmlParser : public wxObject
{
DECLARE_ABSTRACT_CLASS(wx28HtmlParser)
public:
wx28HtmlParser();
virtual ~wx28HtmlParser();
// Sets the class which will be used for opening files
void SetFS(wxFileSystem *fs) { m_FS = fs; }
wxFileSystem* GetFS() const { return m_FS; }
// Opens file if the parser is allowed to open given URL (may be forbidden
// for security reasons)
virtual wxFSFile *OpenURL(wx28HtmlURLType type, const wxString& url) const;
// You can simply call this method when you need parsed output.
// This method does these things:
// 1. call InitParser(source);
// 2. call DoParsing();
// 3. call GetProduct(); (its return value is then returned)
// 4. call DoneParser();
wxObject* Parse(const wxString& source);
// Sets the source. This must be called before running Parse() method.
virtual void InitParser(const wxString& source);
// This must be called after Parse().
virtual void DoneParser();
// May be called during parsing to immediately return from Parse().
virtual void StopParsing() { m_stopParsing = true; }
// Parses the m_Source from begin_pos to end_pos-1.
// (in noparams version it parses whole m_Source)
void DoParsing(int begin_pos, int end_pos);
void DoParsing();
// Returns pointer to the tag at parser's current position
wx28HtmlTag *GetCurrentTag() const { return m_CurTag; }
// Returns product of parsing
// Returned value is result of parsing of the part. The type of this result
// depends on internal representation in derived parser
// (see wx28HtmlWinParser for details).
virtual wxObject* GetProduct() = 0;
// adds handler to the list & hash table of handlers.
virtual void AddTagHandler(wx28HtmlTagHandler *handler);
// Forces the handler to handle additional tags (not returned by GetSupportedTags).
// The handler should already be in use by this parser.
// Example: you want to parse following pseudo-html structure:
// <myitems>
// <it name="one" value="1">
// <it name="two" value="2">
// </myitems>
// <it> This last it has different meaning, we don't want it to be parsed by myitems handler!
// handler can handle only 'myitems' (e.g. its GetSupportedTags returns "MYITEMS")
// you can call PushTagHandler(handler, "IT") when you find <myitems>
// and call PopTagHandler() when you find </myitems>
void PushTagHandler(wx28HtmlTagHandler *handler, const wxString& tags);
// Restores state before last call to PushTagHandler
void PopTagHandler();
wxString* GetSource() {return &m_Source;}
void SetSource(const wxString& src);
// Sets HTML source and remembers current parser's state so that it can
// later be restored. This is useful for on-line modifications of
// HTML source (for example, <pre> handler replaces spaces with &nbsp;
// and newlines with <br>)
virtual void SetSourceAndSaveState(const wxString& src);
// Restores parser's state from stack or returns false if the stack is
// empty
virtual bool RestoreState();
// Returns HTML source inside the element (i.e. between the starting
// and ending tag)
wxString GetInnerSource(const wx28HtmlTag& tag);
// Parses HTML string 'markup' and extracts charset info from <meta> tag
// if present. Returns empty string if the tag is missing.
// For wxHTML's internal use.
static wxString ExtractCharsetInformation(const wxString& markup);
// Returns entity parser object, used to substitute HTML &entities;
wx28HtmlEntitiesParser *GetEntitiesParser() const { return m_entitiesParser; }
protected:
// DOM structure
void CreateDOMTree();
void DestroyDOMTree();
void CreateDOMSubTree(wx28HtmlTag *cur,
int begin_pos, int end_pos,
wx28HtmlTagsCache *cache);
// Adds text to the output.
// This is called from Parse() and must be overriden in derived classes.
// txt is not guaranteed to be only one word. It is largest continuous part of text
// (= not broken by tags)
// NOTE : using char* because of speed improvements
virtual void AddText(const wxChar* txt) = 0;
// Adds tag and proceeds it. Parse() may (and usually is) called from this method.
// This is called from Parse() and may be overriden.
// Default behavior is that it looks for proper handler in m_Handlers. The tag is
// ignored if no hander is found.
// Derived class is *responsible* for filling in m_Handlers table.
virtual void AddTag(const wx28HtmlTag& tag);
protected:
// DOM tree:
wx28HtmlTag *m_CurTag;
wx28HtmlTag *m_Tags;
wx28HtmlTextPieces *m_TextPieces;
size_t m_CurTextPiece;
wxString m_Source;
wx28HtmlParserState *m_SavedStates;
// handlers that handle particular tags. The table is accessed by
// key = tag's name.
// This attribute MUST be filled by derived class otherwise it would
// be empty and no tags would be recognized
// (see wx28HtmlWinParser for details about filling it)
// m_HandlersHash is for random access based on knowledge of tag name (BR, P, etc.)
// it may (and often does) contain more references to one object
// m_HandlersList is list of all handlers and it is guaranteed to contain
// only one reference to each handler instance.
wxList m_HandlersList;
wxHashTable m_HandlersHash;
DECLARE_NO_COPY_CLASS(wx28HtmlParser)
// class for opening files (file system)
wxFileSystem *m_FS;
// handlers stack used by PushTagHandler and PopTagHandler
wxList *m_HandlersStack;
// entity parse
wx28HtmlEntitiesParser *m_entitiesParser;
// flag indicating that the parser should stop
bool m_stopParsing;
};
// This class (and derived classes) cooperates with wx28HtmlParser.
// Each recognized tag is passed to handler which is capable
// of handling it. Each tag is handled in 3 steps:
// 1. Handler will modifies state of parser
// (using its public methods)
// 2. Parser parses source between starting and ending tag
// 3. Handler restores original state of the parser
class wx28HtmlTagHandler : public wxObject
{
DECLARE_ABSTRACT_CLASS(wx28HtmlTagHandler)
public:
wx28HtmlTagHandler() : wxObject () { m_Parser = NULL; }
// Sets the parser.
// NOTE : each _instance_ of handler is guaranteed to be called
// only by one parser. This means you don't have to care about
// reentrancy.
virtual void SetParser(wx28HtmlParser *parser)
{ m_Parser = parser; }
// Returns list of supported tags. The list is in uppercase and
// tags are delimited by ','.
// Example : "I,B,FONT,P"
// is capable of handling italic, bold, font and paragraph tags
virtual wxString GetSupportedTags() = 0;
// This is hadling core method. It does all the Steps 1-3.
// To process step 2, you can call ParseInner()
// returned value : true if it called ParseInner(),
// false etherwise
virtual bool HandleTag(const wx28HtmlTag& tag) = 0;
protected:
// parses input between beginning and ending tag.
// m_Parser must be set.
void ParseInner(const wx28HtmlTag& tag)
{ m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); }
// Parses given source as if it was tag's inner code (see
// wx28HtmlParser::GetInnerSource). Unlike ParseInner(), this method lets
// you specify the source code to parse. This is useful when you need to
// modify the inner text before parsing.
void ParseInnerSource(const wxString& source);
wx28HtmlParser *m_Parser;
DECLARE_NO_COPY_CLASS(wx28HtmlTagHandler)
};
// This class is used to parse HTML entities in strings. It can handle
// both named entities and &#xxxx entries where xxxx is Unicode code.
class wx28HtmlEntitiesParser : public wxObject
{
DECLARE_DYNAMIC_CLASS(wx28HtmlEntitiesParser)
public:
wx28HtmlEntitiesParser();
virtual ~wx28HtmlEntitiesParser();
// Sets encoding of output string.
// Has no effect if wxUSE_WCHAR_T==0 or wxUSE_UNICODE==1
void SetEncoding(wxFontEncoding encoding);
// Parses entities in input and replaces them with respective characters
// (with respect to output encoding)
wxString Parse(const wxString& input);
// Returns character for given entity or 0 if the enity is unknown
wxChar GetEntityChar(const wxString& entity);
// Returns character that represents given Unicode code
#if wxUSE_UNICODE
wxChar GetCharForCode(unsigned code) { return (wxChar)code; }
#else
wxChar GetCharForCode(unsigned code);
#endif
protected:
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
wxMBConv *m_conv;
wxFontEncoding m_encoding;
#endif
DECLARE_NO_COPY_CLASS(wx28HtmlEntitiesParser)
};
#endif // _WX_HTMLPARS_H_

View File

@@ -0,0 +1,517 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/html/htmltag.cpp
// Purpose: wx28HtmlTag class (represents single tag)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "htmltag.h"
#ifndef WXPRECOMP
#include "wx/colour.h"
#endif
#include "htmlpars.h"
#include <stdio.h> // for vsscanf
#include <stdarg.h>
//-----------------------------------------------------------------------------
// wx28HtmlTagsCache
//-----------------------------------------------------------------------------
struct wx28HtmlCacheItem
{
// this is "pos" value passed to wx28HtmlTag's constructor.
// it is position of '<' character of the tag
int Key;
// end positions for the tag:
// end1 is '<' of ending tag,
// end2 is '>' or both are
// -1 if there is no ending tag for this one...
// or -2 if this is ending tag </...>
int End1, End2;
// name of this tag
wxChar *Name;
};
IMPLEMENT_CLASS(wx28HtmlTagsCache,wxObject)
#define CACHE_INCREMENT 64
bool wxIsCDATAElement(const wxChar *tag)
{
return (wxStrcmp(tag, _T("SCRIPT")) == 0) ||
(wxStrcmp(tag, _T("STYLE")) == 0);
}
wx28HtmlTagsCache::wx28HtmlTagsCache(const wxString& source)
{
const wxChar *src = source.c_str();
int lng = source.length();
wxChar tagBuffer[256];
m_Cache = NULL;
m_CacheSize = 0;
m_CachePos = 0;
int pos = 0;
while (pos < lng)
{
if (src[pos] == wxT('<')) // tag found:
{
if (m_CacheSize % CACHE_INCREMENT == 0)
m_Cache = (wx28HtmlCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(wx28HtmlCacheItem));
int tg = m_CacheSize++;
int stpos = pos++;
m_Cache[tg].Key = stpos;
int i;
for ( i = 0;
pos < lng && i < (int)WXSIZEOF(tagBuffer) - 1 &&
src[pos] != wxT('>') && !wxIsspace(src[pos]);
i++, pos++ )
{
tagBuffer[i] = (wxChar)wxToupper(src[pos]);
}
tagBuffer[i] = _T('\0');
m_Cache[tg].Name = new wxChar[i+1];
memcpy(m_Cache[tg].Name, tagBuffer, (i+1)*sizeof(wxChar));
while (pos < lng && src[pos] != wxT('>')) pos++;
if (src[stpos+1] == wxT('/')) // ending tag:
{
m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
// find matching begin tag:
for (i = tg; i >= 0; i--)
if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, tagBuffer+1) == 0))
{
m_Cache[i].End1 = stpos;
m_Cache[i].End2 = pos + 1;
break;
}
}
else
{
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
if (wxIsCDATAElement(tagBuffer))
{
// store the orig pos in case we are missing the closing
// tag (see below)
wxInt32 old_pos = pos;
bool foundCloseTag = false;
// find next matching tag
int tag_len = wxStrlen(tagBuffer);
while (pos < lng)
{
// find the ending tag
while (pos + 1 < lng &&
(src[pos] != '<' || src[pos+1] != '/'))
++pos;
if (src[pos] == '<')
++pos;
// see if it matches
int match_pos = 0;
while (pos < lng && match_pos < tag_len && src[pos] != '>' && src[pos] != '<') {
// cast to wxChar needed to suppress warning in
// Unicode build
if ((wxChar)wxToupper(src[pos]) == tagBuffer[match_pos]) {
++match_pos;
}
else if (src[pos] == wxT(' ') || src[pos] == wxT('\n') ||
src[pos] == wxT('\r') || src[pos] == wxT('\t')) {
// need to skip over these
}
else {
match_pos = 0;
}
++pos;
}
// found a match
if (match_pos == tag_len)
{
pos = pos - tag_len - 3;
foundCloseTag = true;
break;
}
else // keep looking for the closing tag
{
++pos;
}
}
if (!foundCloseTag)
{
// we didn't find closing tag; this means the markup
// is incorrect and the best thing we can do is to
// ignore the unclosed tag and continue parsing as if
// it didn't exist:
pos = old_pos;
}
}
}
}
pos++;
}
// ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
for (int i = 0; i < m_CacheSize; i++)
{
delete[] m_Cache[i].Name;
m_Cache[i].Name = NULL;
}
}
void wx28HtmlTagsCache::QueryTag(int at, int* end1, int* end2)
{
if (m_Cache == NULL) return;
if (m_Cache[m_CachePos].Key != at)
{
int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
do
{
if ( m_CachePos < 0 || m_CachePos == m_CacheSize )
{
// something is very wrong with HTML, give up by returning an
// impossibly large value which is going to be ignored by the
// caller
*end1 =
*end2 = INT_MAX;
return;
}
m_CachePos += delta;
}
while (m_Cache[m_CachePos].Key != at);
}
*end1 = m_Cache[m_CachePos].End1;
*end2 = m_Cache[m_CachePos].End2;
}
//-----------------------------------------------------------------------------
// wx28HtmlTag
//-----------------------------------------------------------------------------
IMPLEMENT_CLASS(wx28HtmlTag,wxObject)
wx28HtmlTag::wx28HtmlTag(wx28HtmlTag *parent,
const wxString& source, int pos, int end_pos,
wx28HtmlTagsCache *cache,
wx28HtmlEntitiesParser *entParser) : wxObject()
{
/* Setup DOM relations */
m_Next = NULL;
m_FirstChild = m_LastChild = NULL;
m_Parent = parent;
if (parent)
{
m_Prev = m_Parent->m_LastChild;
if (m_Prev == NULL)
m_Parent->m_FirstChild = this;
else
m_Prev->m_Next = this;
m_Parent->m_LastChild = this;
}
else
m_Prev = NULL;
/* Find parameters and their values: */
int i;
wxChar c;
// fill-in name, params and begin pos:
i = pos+1;
// find tag's name and convert it to uppercase:
while ((i < end_pos) &&
((c = source[i++]) != wxT(' ') && c != wxT('\r') &&
c != wxT('\n') && c != wxT('\t') &&
c != wxT('>')))
{
if ((c >= wxT('a')) && (c <= wxT('z')))
c -= (wxT('a') - wxT('A'));
m_Name << c;
}
// if the tag has parameters, read them and "normalize" them,
// i.e. convert to uppercase, replace whitespaces by spaces and
// remove whitespaces around '=':
if (source[i-1] != wxT('>'))
{
#define IS_WHITE(c) (c == wxT(' ') || c == wxT('\r') || \
c == wxT('\n') || c == wxT('\t'))
wxString pname, pvalue;
wxChar quote;
enum
{
ST_BEFORE_NAME = 1,
ST_NAME,
ST_BEFORE_EQ,
ST_BEFORE_VALUE,
ST_VALUE
} state;
quote = 0;
state = ST_BEFORE_NAME;
while (i < end_pos)
{
c = source[i++];
if (c == wxT('>') && !(state == ST_VALUE && quote != 0))
{
if (state == ST_BEFORE_EQ || state == ST_NAME)
{
m_ParamNames.Add(pname);
m_ParamValues.Add(wxEmptyString);
}
else if (state == ST_VALUE && quote == 0)
{
m_ParamNames.Add(pname);
if (entParser)
m_ParamValues.Add(entParser->Parse(pvalue));
else
m_ParamValues.Add(pvalue);
}
break;
}
switch (state)
{
case ST_BEFORE_NAME:
if (!IS_WHITE(c))
{
pname = c;
state = ST_NAME;
}
break;
case ST_NAME:
if (IS_WHITE(c))
state = ST_BEFORE_EQ;
else if (c == wxT('='))
state = ST_BEFORE_VALUE;
else
pname << c;
break;
case ST_BEFORE_EQ:
if (c == wxT('='))
state = ST_BEFORE_VALUE;
else if (!IS_WHITE(c))
{
m_ParamNames.Add(pname);
m_ParamValues.Add(wxEmptyString);
pname = c;
state = ST_NAME;
}
break;
case ST_BEFORE_VALUE:
if (!IS_WHITE(c))
{
if (c == wxT('"') || c == wxT('\''))
quote = c, pvalue = wxEmptyString;
else
quote = 0, pvalue = c;
state = ST_VALUE;
}
break;
case ST_VALUE:
if ((quote != 0 && c == quote) ||
(quote == 0 && IS_WHITE(c)))
{
m_ParamNames.Add(pname);
if (quote == 0)
{
// VS: backward compatibility, no real reason,
// but wxHTML code relies on this... :(
pvalue.MakeUpper();
}
if (entParser)
m_ParamValues.Add(entParser->Parse(pvalue));
else
m_ParamValues.Add(pvalue);
state = ST_BEFORE_NAME;
}
else
pvalue << c;
break;
}
}
#undef IS_WHITE
}
m_Begin = i;
cache->QueryTag(pos, &m_End1, &m_End2);
if (m_End1 > end_pos) m_End1 = end_pos;
if (m_End2 > end_pos) m_End2 = end_pos;
}
wx28HtmlTag::~wx28HtmlTag()
{
wx28HtmlTag *t1, *t2;
t1 = m_FirstChild;
while (t1)
{
t2 = t1->GetNextSibling();
delete t1;
t1 = t2;
}
}
bool wx28HtmlTag::HasParam(const wxString& par) const
{
return (m_ParamNames.Index(par, false) != wxNOT_FOUND);
}
wxString wx28HtmlTag::GetParam(const wxString& par, bool with_commas) const
{
int index = m_ParamNames.Index(par, false);
if (index == wxNOT_FOUND)
return wxEmptyString;
if (with_commas)
{
// VS: backward compatibility, seems to be never used by wxHTML...
wxString s;
s << wxT('"') << m_ParamValues[index] << wxT('"');
return s;
}
else
return m_ParamValues[index];
}
int wx28HtmlTag::ScanParam(const wxString& par,
const wxChar *format,
void *param) const
{
wxString parval = GetParam(par);
return wxSscanf(parval, format, param);
}
bool wx28HtmlTag::GetParamAsColour(const wxString& par, wxColour *clr) const
{
wxCHECK_MSG( clr, false, _T("invalid colour argument") );
wxString str = GetParam(par);
// handle colours defined in HTML 4.0 first:
if (str.length() > 1 && str[0] != _T('#'))
{
#define HTML_COLOUR(name, r, g, b) \
if (str.IsSameAs(wxT(name), false)) \
{ clr->Set(r, g, b); return true; }
HTML_COLOUR("black", 0x00,0x00,0x00)
HTML_COLOUR("silver", 0xC0,0xC0,0xC0)
HTML_COLOUR("gray", 0x80,0x80,0x80)
HTML_COLOUR("white", 0xFF,0xFF,0xFF)
HTML_COLOUR("maroon", 0x80,0x00,0x00)
HTML_COLOUR("red", 0xFF,0x00,0x00)
HTML_COLOUR("purple", 0x80,0x00,0x80)
HTML_COLOUR("fuchsia", 0xFF,0x00,0xFF)
HTML_COLOUR("green", 0x00,0x80,0x00)
HTML_COLOUR("lime", 0x00,0xFF,0x00)
HTML_COLOUR("olive", 0x80,0x80,0x00)
HTML_COLOUR("yellow", 0xFF,0xFF,0x00)
HTML_COLOUR("navy", 0x00,0x00,0x80)
HTML_COLOUR("blue", 0x00,0x00,0xFF)
HTML_COLOUR("teal", 0x00,0x80,0x80)
HTML_COLOUR("aqua", 0x00,0xFF,0xFF)
#undef HTML_COLOUR
}
// then try to parse #rrggbb representations or set from other well
// known names (note that this doesn't strictly conform to HTML spec,
// but it doesn't do real harm -- but it *must* be done after the standard
// colors are handled above):
if (clr->Set(str))
return true;
return false;
}
bool wx28HtmlTag::GetParamAsInt(const wxString& par, int *clr) const
{
if ( !HasParam(par) )
return false;
long i;
if ( !GetParam(par).ToLong(&i) )
return false;
*clr = (int)i;
return true;
}
wxString wx28HtmlTag::GetAllParams() const
{
// VS: this function is for backward compatibility only,
// never used by wxHTML
wxString s;
size_t cnt = m_ParamNames.GetCount();
for (size_t i = 0; i < cnt; i++)
{
s << m_ParamNames[i];
s << wxT('=');
if (m_ParamValues[i].Find(wxT('"')) != wxNOT_FOUND)
s << wxT('\'') << m_ParamValues[i] << wxT('\'');
else
s << wxT('"') << m_ParamValues[i] << wxT('"');
}
return s;
}
wx28HtmlTag *wx28HtmlTag::GetFirstSibling() const
{
if (m_Parent)
return m_Parent->m_FirstChild;
else
{
wx28HtmlTag *cur = (wx28HtmlTag*)this;
while (cur->m_Prev)
cur = cur->m_Prev;
return cur;
}
}
wx28HtmlTag *wx28HtmlTag::GetLastSibling() const
{
if (m_Parent)
return m_Parent->m_LastChild;
else
{
wx28HtmlTag *cur = (wx28HtmlTag*)this;
while (cur->m_Next)
cur = cur->m_Next;
return cur;
}
}
wx28HtmlTag *wx28HtmlTag::GetNextTag() const
{
if (m_FirstChild) return m_FirstChild;
if (m_Next) return m_Next;
wx28HtmlTag *cur = m_Parent;
if (!cur) return NULL;
while (cur->m_Parent && !cur->m_Next)
cur = cur->m_Parent;
return cur->m_Next;
}

View File

@@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////
// Name: htmltag.h
// Purpose: wx28HtmlTag class (represents single tag)
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HTMLTAG_H_
#define _WX_HTMLTAG_H_
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/arrstr.h"
class wxColour;
class wx28HtmlEntitiesParser;
//-----------------------------------------------------------------------------
// wx28HtmlTagsCache
// - internal wxHTML class, do not use!
//-----------------------------------------------------------------------------
struct wx28HtmlCacheItem;
class wx28HtmlTagsCache : public wxObject
{
DECLARE_DYNAMIC_CLASS(wx28HtmlTagsCache)
private:
wx28HtmlCacheItem *m_Cache;
int m_CacheSize;
int m_CachePos;
public:
wx28HtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;}
wx28HtmlTagsCache(const wxString& source);
virtual ~wx28HtmlTagsCache() {free(m_Cache);}
// Finds parameters for tag starting at at and fills the variables
void QueryTag(int at, int* end1, int* end2);
DECLARE_NO_COPY_CLASS(wx28HtmlTagsCache)
};
//--------------------------------------------------------------------------------
// wx28HtmlTag
// This represents single tag. It is used as internal structure
// by wx28HtmlParser.
//--------------------------------------------------------------------------------
class wx28HtmlTag : public wxObject
{
DECLARE_CLASS(wx28HtmlTag)
protected:
// constructs wx28HtmlTag object based on HTML tag.
// The tag begins (with '<' character) at position pos in source
// end_pos is position where parsing ends (usually end of document)
wx28HtmlTag(wx28HtmlTag *parent,
const wxString& source, int pos, int end_pos,
wx28HtmlTagsCache *cache,
wx28HtmlEntitiesParser *entParser);
friend class wx28HtmlParser;
public:
virtual ~wx28HtmlTag();
wx28HtmlTag *GetParent() const {return m_Parent;}
wx28HtmlTag *GetFirstSibling() const;
wx28HtmlTag *GetLastSibling() const;
wx28HtmlTag *GetChildren() const { return m_FirstChild; }
wx28HtmlTag *GetPreviousSibling() const { return m_Prev; }
wx28HtmlTag *GetNextSibling() const {return m_Next; }
// Return next tag, as if tree had been flattened
wx28HtmlTag *GetNextTag() const;
// Returns tag's name in uppercase.
inline wxString GetName() const {return m_Name;}
// Returns true if the tag has given parameter. Parameter
// should always be in uppercase.
// Example : <IMG SRC="test.jpg"> HasParam("SRC") returns true
bool HasParam(const wxString& par) const;
// Returns value of the param. Value is in uppercase unless it is
// enclosed with "
// Example : <P align=right> GetParam("ALIGN") returns (RIGHT)
// <P IMG SRC="WhaT.jpg"> GetParam("SRC") returns (WhaT.jpg)
// (or ("WhaT.jpg") if with_commas == true)
wxString GetParam(const wxString& par, bool with_commas = false) const;
// Convenience functions:
bool GetParamAsColour(const wxString& par, wxColour *clr) const;
bool GetParamAsInt(const wxString& par, int *clr) const;
// Scans param like scanf() functions family does.
// Example : ScanParam("COLOR", "\"#%X\"", &clr);
// This is always with with_commas=false
// Returns number of scanned values
// (like sscanf() does)
// NOTE: unlike scanf family, this function only accepts
// *one* parameter !
int ScanParam(const wxString& par, const wxChar *format, void *param) const;
// Returns string containing all params.
wxString GetAllParams() const;
// return true if this there is matching ending tag
inline bool HasEnding() const {return m_End1 >= 0;}
// returns beginning position of _internal_ block of text
// See explanation (returned value is marked with *):
// bla bla bla <MYTAG>* bla bla intenal text</MYTAG> bla bla
inline int GetBeginPos() const {return m_Begin;}
// returns ending position of _internal_ block of text.
// bla bla bla <MYTAG> bla bla intenal text*</MYTAG> bla bla
inline int GetEndPos1() const {return m_End1;}
// returns end position 2 :
// bla bla bla <MYTAG> bla bla internal text</MYTAG>* bla bla
inline int GetEndPos2() const {return m_End2;}
private:
wxString m_Name;
int m_Begin, m_End1, m_End2;
wxArrayString m_ParamNames, m_ParamValues;
// DOM tree relations:
wx28HtmlTag *m_Next;
wx28HtmlTag *m_Prev;
wx28HtmlTag *m_FirstChild, *m_LastChild;
wx28HtmlTag *m_Parent;
DECLARE_NO_COPY_CLASS(wx28HtmlTag)
};
#endif // _WX_HTMLTAG_H_

View File

@@ -0,0 +1,192 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.0.35 i686) [Netscape]">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
<H3>
This is TABLES
tests page...</H3>
(yes, really, see below:)
<BR>Click <a href="test.htm">here</a> to go to original testing page...
<BR>Click <a href="../../docs/html/man.htm">here</a> to go to manuals...
<BR>&nbsp;
<CENTER><TABLE CELLSPACING=5 BORDER COLS=2 WIDTH="40%" NOSAVE >
<TR ALIGN=CENTER NOSAVE>
<TD WIDTH="40%" NOSAVE>Top left
<BR>(two lines expression)
<P>paragraph done</TD>
<TD NOSAVE>Top right</TD>
</TR>
<TR>
<TD>Bottom left</TD>
<TD>Bottom right</TD>
</TR>
</TABLE></CENTER>
<P>Subsampling is shown there:
<BR>&nbsp;
<TABLE BORDER COLS=2 WIDTH="100%" NOSAVE >
<TR NOSAVE>
<TD VALIGN=BOTTOM NOSAVE>
<TABLE BORDER COLS=2 WIDTH="50%" NOSAVE >
<TR ALIGN=CENTER BGCOLOR="#3366FF" NOSAVE>
<TD>a</TD>
<TD WIDTH="10%" NOSAVE>b</TD>
</TR>
<TR NOSAVE>
<TD>c</TD>
<TD NOSAVE>d</TD>
</TR>
</TABLE>
</TD>
<TD VALIGN=BOTTOM NOSAVE>2</TD>
</TR>
<TR NOSAVE>
<TD>3 dflkj lkjfl dkjldkfjl flk jflkf lkjflkj ljlf ajlfj alff h khg hgj
gjg jg gjhfg fg gjh gjf jgf jgj f gjfgj kfajg&nbsp;</TD>
<TD ALIGN=CENTER VALIGN=BOTTOM BGCOLOR="#FFFF99" NOSAVE>4
<BR>gh
<BR>gfh
<BR>gh
<BR>hg
<BR>5</TD>
</TR>
</TABLE>
<P>This is "default" table - with no sizes givev:
<BR>&nbsp;
<TABLE BORDER COLS=4 WIDTH="100%" NOSAVE >
<TR NOSAVE>
<TD>Hello</TD>
<TD NOSAVE>lkfdsjlk fj dlfj lkfj lkjflk jlfk lk fjlk elwkf lkejflek f jlekjflkj
ljlk lk jlkf lefjl j flkj ljl lf lfj lfjl lj lwe lekf;eh kfejh lkh kjh
kjhkj hkj hkj lkh kjh kjlh kj</TD>
<TD>shortebn formo lr lk</TD>
<TD>djsf lkjlf poer oi pjr po kpk&nbsp;</TD>
</TR>
<TR>
<TD>a</TD>
<TD>b</TD>
<TD>c</TD>
<TD>d</TD>
</TR>
<TR NOSAVE>
<TD>1</TD>
<TD>2</TD>
<TD COLSPAN="2" ROWSPAN="2" NOSAVE>3</TD>
</TR>
<TR>
<TD>A</TD>
<TD>B</Td>
</TR>
</TABLE>
<p>
</p>
<hr size="8"/>
<table cellspacing='0' cellpadding='0'>
<tr align='left'>
<td width="30%" valign='top'>Error:</td>
<td width='5'></td>
<td>Sex sells better than <b>truth and honour</b></td><td align='right'>X For President is my agenda!</td>
</tr>
<tr align='left'>
<td valign='top'>Command:</td>
<td width='5'></td>
<td>Go out and spread the word, <b>we shall prevail!</b></td><td>X</td>
</tr>
</table>
<br><br>
<table cellspacing='0' cellpadding='0'>
<tr align='left'>
<td valign='top'>Error:</td>
<td width='5'></td>
<td>Sex sells better than <b>truth and honour</b></td><td align='right'>X For President is my agenda!</td>
</tr>
<tr align='left'>
<td valign='top'>Command:</td>
<td width='5'></td>
<td>Go out and spread the word, <b>we shall prevail!</b></td><td>X</td>
</tr>
</table>
<br><br>
<table width="200" cellspacing='0' cellpadding='0'>
<tr align='left'>
<td valign='top'>Error:</td>
<td width='5'></td>
<td nowrap>Sex sells better than <b>truth and honour</b></td><td align='right'>X For President is my agenda!</td>
</tr>
<tr align='left'>
<td valign='top'>Command:</td>
<td width='5'></td>
<td>Go out and spread the word, <b>we shall prevail!</b></td><td>X</td>
</tr>
</table>
<br><br>
<table cellspacing='0' cellpadding='0'>
<tr align='left'>
<td valign='top'>Error:</td>
<td width='5'></td>
<td>
<table cellspacing='0' cellpadding='0'>
<tr align='left'>
<td valign='top'>Error:</td>
<td width='5'></td>
<td>Sex sells better than <b>truth and honour</b></td><td align='right'>X For President is my agenda!</td>
</tr>
<tr align='left'>
<td valign='top'>Command:</td>
<td width='5'></td>
<td>Go out and spread the word, <b>we shall prevail!</b></td>
<td>X</td>
</tr>
</table>
</td>
<td align='right'>X For President is my agenda!</td>
</tr>
<tr align='left'>
<td valign='top'>Command:</td>
<td width='5'></td>
<td>Go out and spread the word, <b>we shall prevail!</b></td>
<td>X</td>
</tr>
</table>
<br><br>
<table cellspacing='0' cellpadding='0'>
<tr>
<td><ul><li>Just a small test</li></ul></td>
<td>Really, a test!</td>
</tr>
</table>

View File

@@ -36,6 +36,8 @@ BENCH_CXXFLAGS = $(__RUNTIME_LIBS_7) -I$(BCCDIR)\include $(__DEBUGINFO) \
-DwxUSE_GUI=0 $(CPPFLAGS) $(CXXFLAGS)
BENCH_OBJECTS = \
$(OBJS)\bench_bench.obj \
$(OBJS)\bench_htmlpars.obj \
$(OBJS)\bench_htmltag.obj \
$(OBJS)\bench_strings.obj \
$(OBJS)\bench_tls.obj
@@ -171,7 +173,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\bench.exe
all: $(OBJS)\bench.exe data
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@@ -189,9 +191,19 @@ $(OBJS)\bench.exe: $(BENCH_OBJECTS)
c0x32.obj $(BENCH_OBJECTS),$@,, $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,,
|
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (htmltest.html) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\bench_bench.obj: .\bench.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\bench.cpp
$(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\htmlparser\htmlpars.cpp
$(OBJS)\bench_htmltag.obj: .\htmlparser\htmltag.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\htmlparser\htmltag.cpp
$(OBJS)\bench_strings.obj: .\strings.cpp
$(CXX) -q -c -P -o$@ $(BENCH_CXXFLAGS) .\strings.cpp

View File

@@ -29,6 +29,8 @@ BENCH_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
-Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
BENCH_OBJECTS = \
$(OBJS)\bench_bench.o \
$(OBJS)\bench_htmlpars.o \
$(OBJS)\bench_htmltag.o \
$(OBJS)\bench_strings.o \
$(OBJS)\bench_tls.o
@@ -169,7 +171,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\bench.exe
all: $(OBJS)\bench.exe data
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
@@ -179,16 +181,26 @@ clean:
$(OBJS)\bench.exe: $(BENCH_OBJECTS)
$(CXX) -o $@ $(BENCH_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
data:
if not exist $(OBJS) mkdir $(OBJS)
for %%f in (htmltest.html) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
$(OBJS)\bench_bench.o: ./bench.cpp
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bench_htmlpars.o: ./htmlparser/htmlpars.cpp
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bench_htmltag.o: ./htmlparser/htmltag.cpp
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bench_strings.o: ./strings.cpp
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bench_tls.o: ./tls.cpp
$(CXX) -c -o $@ $(BENCH_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all clean
.PHONY: all clean data
SHELL := $(COMSPEC)

View File

@@ -30,6 +30,8 @@ BENCH_CXXFLAGS = /M$(__RUNTIME_LIBS_8)$(__DEBUGRUNTIME_3) /DWIN32 \
$(CXXFLAGS)
BENCH_OBJECTS = \
$(OBJS)\bench_bench.obj \
$(OBJS)\bench_htmlpars.obj \
$(OBJS)\bench_htmltag.obj \
$(OBJS)\bench_strings.obj \
$(OBJS)\bench_tls.obj
@@ -231,7 +233,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\bench.exe
all: $(OBJS)\bench.exe data
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@@ -246,9 +248,19 @@ $(OBJS)\bench.exe: $(BENCH_OBJECTS)
$(BENCH_OBJECTS) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib
<<
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (htmltest.html) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\bench_bench.obj: .\bench.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\bench.cpp
$(OBJS)\bench_htmlpars.obj: .\htmlparser\htmlpars.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\htmlparser\htmlpars.cpp
$(OBJS)\bench_htmltag.obj: .\htmlparser\htmltag.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\htmlparser\htmltag.cpp
$(OBJS)\bench_strings.obj: .\strings.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BENCH_CXXFLAGS) .\strings.cpp

View File

@@ -210,6 +210,8 @@ BENCH_CXXFLAGS = $(__DEBUGINFO_0) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG_5) &
-dwxUSE_GUI=0 $(__RTTIFLAG_7) $(__EXCEPTIONSFLAG_8) $(CPPFLAGS) $(CXXFLAGS)
BENCH_OBJECTS = &
$(OBJS)\bench_bench.obj &
$(OBJS)\bench_htmlpars.obj &
$(OBJS)\bench_htmltag.obj &
$(OBJS)\bench_strings.obj &
$(OBJS)\bench_tls.obj
@@ -220,7 +222,7 @@ $(OBJS) :
### Targets: ###
all : .SYMBOLIC $(OBJS)\bench.exe
all : .SYMBOLIC $(OBJS)\bench.exe data
clean : .SYMBOLIC
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@@ -242,9 +244,19 @@ $(OBJS)\bench.exe : $(BENCH_OBJECTS)
@for %i in () do @%append $(OBJS)\bench.lbc option stack=%i
wlink @$(OBJS)\bench.lbc
data : .SYMBOLIC
if not exist $(OBJS) mkdir $(OBJS)
for %f in (htmltest.html) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\bench_bench.obj : .AUTODEPEND .\bench.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<
$(OBJS)\bench_htmlpars.obj : .AUTODEPEND .\htmlparser\htmlpars.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<
$(OBJS)\bench_htmltag.obj : .AUTODEPEND .\htmlparser\htmltag.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<
$(OBJS)\bench_strings.obj : .AUTODEPEND .\strings.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BENCH_CXXFLAGS) $<

View File

@@ -9,8 +9,10 @@
/////////////////////////////////////////////////////////////////////////////
#include "wx/string.h"
#include "wx/ffile.h"
#include "bench.h"
#include "htmlparser/htmlpars.h"
static const char asciistr[] =
"This is just the first line of a very long 7 bit ASCII string"
@@ -273,3 +275,31 @@ BENCHMARK_FUNC(CharBuffer)
return wxStrlen(str.mb_str()) == ASCIISTR_LEN &&
wxStrlen(str.wc_str()) == ASCIISTR_LEN;
}
// ----------------------------------------------------------------------------
// wxString::operator[] - parse large HTML page
// ----------------------------------------------------------------------------
class DummyParser : public wx28HtmlParser
{
public:
virtual wxObject* GetProduct() { return NULL; }
virtual void AddText(const wxChar*) {}
};
BENCHMARK_FUNC(ParseHTML)
{
// static so that construction time is not counted
static DummyParser parser;
static wxString html;
if ( html.empty() )
{
wxFFile("htmltest.html").ReadAll(&html, wxConvUTF8);
}
parser.Parse(html);
return true;
}