mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:03:03 +01:00
Use SIMILAR TO regexp (with sed syntax for replacements) for trace config
This commit is contained in:
parent
de052e3f3c
commit
38ac4ab183
@ -1,65 +0,0 @@
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
# You may obtain a copy of the Licence at
|
||||
# http://www.gnu.org/licences/lgpl.html
|
||||
#
|
||||
# As a special exception this file can also be included in modules
|
||||
# with other source code as long as that source code has been
|
||||
# released under an Open Source Initiative certificed licence.
|
||||
# More information about OSI certification can be found at:
|
||||
# http://www.opensource.org
|
||||
#
|
||||
# This module is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public Licence for more details.
|
||||
#
|
||||
# This module was created by members of the firebird development
|
||||
# team. All individual contributions remain the Copyright (C) of
|
||||
# those individuals and all rights are reserved. Contributors to
|
||||
# this file are either listed below or can be obtained from a CVS
|
||||
# history command.
|
||||
#
|
||||
# Created by: Erik Kunze <Erik.Kunze@philosys.de>
|
||||
#
|
||||
# Contributor(s):
|
||||
# Alex Peshkov
|
||||
#
|
||||
#
|
||||
ROOT=..
|
||||
#ObjModuleType=std
|
||||
|
||||
## Set your options:
|
||||
## -DANSI_ARROWS ANSI arrows keys work like emacs.
|
||||
## -DHIDE Make static functions static (non debug).
|
||||
## -DHIST_SIZE=n History size.
|
||||
## -DUNIQUE_HISTORY Don't save command if same as last one.
|
||||
## -DDO_SIGTSTP Send SIGTSTP on "suspend" key
|
||||
#CFLAGS:= -DANSI_ARROWS -DHIDE -DHIST_SIZE=100 -DUNIQUE_HISTORY -DSYS_UNIX
|
||||
|
||||
include $(ROOT)/gen/make.defaults
|
||||
include $(ROOT)/gen/make.platform
|
||||
include $(ROOT)/gen/make.rules
|
||||
include $(ROOT)/gen/make.shared.variables
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
.PHONY: librxspencer
|
||||
|
||||
|
||||
librxspencer : $(LIB)/librxspencer.a
|
||||
|
||||
LIBS_TO_COPY = librxspencer.*
|
||||
|
||||
$(LIB)/librxspencer.a:
|
||||
$(MAKE) -C $(ROOT)/extern/regex
|
||||
(cd $(ROOT)/extern/regex/.libs/; tar cf - $(LIBS_TO_COPY) ) | (cd $(LIB); tar xf -)
|
||||
# cp $(ROOT)/extern/regex/.libs/librxspencer.a $(LIB)/librxspencer.a
|
||||
|
||||
|
||||
include $(ROOT)/gen/make.shared.targets
|
||||
|
||||
#-include $(Dependencies)
|
@ -49,8 +49,8 @@ FBTRACE_UTIL_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(FBTRACE
|
||||
|
||||
|
||||
FBTRACE_OTHER_Sources = $(OS_SPECIFIC_Sources) $(TRACE_OS_Sources) \
|
||||
jrd/isc.cpp jrd/isc_sync.cpp jrd/isc_ipc.cpp \
|
||||
common/classes/ClumpletReader.cpp common/utils.cpp
|
||||
jrd/isc.cpp jrd/isc_sync.cpp jrd/isc_ipc.cpp jrd/CharSet.cpp jrd/TextType.cpp jrd/IntlUtil.cpp \
|
||||
jrd/unicode_util.cpp common/classes/ClumpletReader.cpp common/utils.cpp
|
||||
|
||||
FBTRACE_OTHER_Objects = $(addprefix $(OBJ)/, $(addsuffix .o, $(basename $(FBTRACE_OTHER_Sources))))
|
||||
|
||||
|
@ -181,7 +181,7 @@ $(GEN_ROOT)/Make.Version : $(SRC_ROOT)/misc/writeBuildNum.sh
|
||||
|
||||
#
|
||||
# Libraries that come from outside the project but are built
|
||||
# as part of the project are included here. Currently IBM ICU, Henry Spencer's regex and
|
||||
# as part of the project are included here. Currently IBM ICU and
|
||||
# editline are the only externals libraries we have included.
|
||||
#
|
||||
|
||||
@ -194,7 +194,6 @@ ifeq ($(EDITLINE_FLG),Y)
|
||||
$(MAKE) CFLAGS="@CFLAGS@" -f $(GEN_ROOT)/Makefile.extern.editline
|
||||
endif
|
||||
endif
|
||||
$(MAKE) CFLAGS="@CFLAGS@" -f $(GEN_ROOT)/Makefile.extern.regex
|
||||
|
||||
btyacc_binary: $(BTYACC)
|
||||
|
||||
|
@ -279,7 +279,7 @@ LINK_INTL_LIBS = -L$(LIB) $(ICU_LIBS) $(SO_LINK_LIBS)
|
||||
|
||||
LINK_TRACE = $(LIB_LINK) $(LINK_TRACE_SYMBOLS) $(LIB_LINK_OPTIONS)\
|
||||
$(call LIB_LINK_SONAME,$(LIB_PREFIX)fbtrace.$(SHRLIB_EXT).0) $(call LIB_LINK_RPATH,lib)
|
||||
LINK_TRACE_LIBS = -L$(LIB) $(SO_LINK_LIBS) -lrxspencer
|
||||
LINK_TRACE_LIBS = -L$(LIB) $(SO_LINK_LIBS)
|
||||
|
||||
LINK_CLIENT = $(CLIENTLIB_LINK) $(LINK_FIREBIRD_CLIENT_SYMBOLS) $(LIB_LINK_OPTIONS)\
|
||||
$(LIB_LINK_IMPLIB) $(call LIB_LINK_SONAME,$(ClientLibrarySoName)) $(call LIB_LINK_RPATH,lib)
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
# Please don't use compiler/platform specific flags here - nmcc 02-Nov-2002
|
||||
CFLAGS:= $(CFLAGS) -I$(SRC_ROOT)/include/gen -I$(SRC_ROOT)/include -I$(SRC_ROOT)/vulcan \
|
||||
-I$(ROOT)/extern/regex -DNAMESPACE=Vulcan $(THR_FLAGS)
|
||||
-DNAMESPACE=Vulcan $(THR_FLAGS)
|
||||
|
||||
ifeq ($(STD_ICU),false)
|
||||
CFLAGS:= $(CFLAGS) -I$(ROOT)/extern/icu/source/common -I$(ROOT)/extern/icu/source/i18n
|
||||
|
@ -78,7 +78,7 @@ LINK_UDF = $(LIB_LINK) $(LIB_LINK_OPTIONS) $(call LIB_LINK_SONAME,$(1).$(SHRLIB_
|
||||
LINK_UDF_LIBS =
|
||||
|
||||
# Special options for trace plugin link
|
||||
LINK_TRACE_LIBS = -L$(LIB) $(SO_LINK_LIBS) $(LIB)/librxspencer.a
|
||||
LINK_TRACE_LIBS = -L$(LIB) $(SO_LINK_LIBS)
|
||||
|
||||
# This is ugly HACK!!! Must be removed as soon as somebody find
|
||||
# a way to use routines from server
|
||||
|
@ -203,13 +203,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbsvcmgr", "fbsvcmgr.vcproj
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fbtrace", "fbtrace.vcproj", "{53F75437-15B8-4A5C-86BF-E238CC68FCBC}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D} = {34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}
|
||||
{E83187C1-AAC2-445D-B8B2-883EFC10C39A} = {E83187C1-AAC2-445D-B8B2-883EFC10C39A}
|
||||
{15605F44-BFFD-444F-AD4C-55DC9D704465} = {15605F44-BFFD-444F-AD4C-55DC9D704465}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "regex", "regex.vcproj", "{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -560,14 +557,6 @@ Global
|
||||
{53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|Win32.Build.0 = Release|Win32
|
||||
{53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|x64.ActiveCfg = Release|x64
|
||||
{53F75437-15B8-4A5C-86BF-E238CC68FCBC}.Release|x64.Build.0 = Release|x64
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Debug|x64.Build.0 = Debug|x64
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Release|Win32.Build.0 = Release|Win32
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Release|x64.ActiveCfg = Release|x64
|
||||
{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="fbtrace"
|
||||
ProjectGUID="{53F75437-15B8-4A5C-86BF-E238CC68FCBC}"
|
||||
>
|
||||
@ -40,7 +40,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include;..\..\..\extern\regex;..\..\..\src\include\gen;..\..\..\include;..\..\..\src\common\classes"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include;..\..\..\src\include\gen;..\..\..\include;..\..\..\src\common\classes;../../../extern/icu/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;DEV_BUILD;_WINDOWS;_USRDLL;SUPERCLIENT;FBTRACE_EXPORTS;NAMESPACE=Vulcan"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
@ -55,8 +55,10 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="icuuc.lib"
|
||||
OutputFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\firebird\plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../extern/icu/$(PlatformName)/release/lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
@ -106,11 +108,11 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include\gen;..\..\..\extern\regex;..\..\..\src\include;..\..\..\src\common\classes"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include\gen;..\..\..\src\include;..\..\..\src\common\classes;../../../extern/icu/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FBTRACE_EXPORTS;SUPERCLIENT;NAMESPACE=Vulcan"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
@ -125,8 +127,10 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="icuuc.lib"
|
||||
OutputFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\firebird\plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../extern/icu/$(PlatformName)/release/lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
@ -178,7 +182,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include;..\..\..\extern\regex;..\..\..\src\include\gen;..\..\..\include;..\..\..\src\common\classes"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include;..\..\..\src\include\gen;..\..\..\include;..\..\..\src\common\classes;../../../extern/icu/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;DEV_BUILD;_WINDOWS;_USRDLL;SUPERCLIENT;FBTRACE_EXPORTS;NAMESPACE=Vulcan"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
/>
|
||||
@ -193,8 +197,10 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="icuuc.lib"
|
||||
OutputFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\firebird\plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../extern/icu/$(PlatformName)/release/lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
@ -246,7 +252,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include\gen;..\..\..\extern\regex;..\..\..\src\include;..\..\..\src\common\classes"
|
||||
AdditionalIncludeDirectories="..\..\..\src\include\gen;..\..\..\src\include;..\..\..\src\common\classes;../../../extern/icu/include"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
@ -265,8 +271,10 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="icuuc.lib"
|
||||
OutputFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\firebird\plugins\$(ProjectName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../extern/icu/$(PlatformName)/release/lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
@ -371,6 +379,10 @@
|
||||
<Filter
|
||||
Name="JRD files"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\src\jrd\CharSet.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\jrd\os\win32\fbsyslog.cpp"
|
||||
>
|
||||
@ -379,6 +391,10 @@
|
||||
RelativePath="..\..\..\src\jrd\gds.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\jrd\IntlUtil.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\jrd\isc.cpp"
|
||||
>
|
||||
@ -395,6 +411,14 @@
|
||||
RelativePath="..\..\..\src\jrd\os\win32\path_utils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\jrd\TextType.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\jrd\unicode_util.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
@ -1,366 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="regex"
|
||||
ProjectGUID="{34FDEFC1-F14D-4ADD-ADC1-25134C28A73D}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\firebird2.vsprops;.\firebird2debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\extern\regex"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
ProgramDataBaseFileName="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(IntDir)\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\..\..\extern\regex"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
AssemblerListingLocation=""
|
||||
ObjectFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
ProgramDataBaseFileName="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(IntDir)\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\firebird2.vsprops;.\firebird2release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\..\..\extern\regex"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
UsePrecompiledHeader="0"
|
||||
ObjectFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
ProgramDataBaseFileName="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(IntDir)\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\..\..\extern\regex"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
ObjectFile="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
ProgramDataBaseFileName="..\..\..\temp\$(PlatformName)\$(ConfigurationName)\$(ProjectName)/"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(IntDir)\$(ProjectName).lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\regcomp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\regerror.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\regexec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\regfree.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\cclass.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\cname.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\regex2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\extern\regex\utils.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1282,7 +1282,6 @@ gen/Makefile.embed.isql:${MAKE_SRC_DIR}/Makefile.in.embed.isql
|
||||
gen/Makefile.embed.gdef:${MAKE_SRC_DIR}/Makefile.in.embed.gdef
|
||||
gen/Makefile.embed.qli:${MAKE_SRC_DIR}/Makefile.in.embed.qli
|
||||
gen/Makefile.embed.gpre:${MAKE_SRC_DIR}/Makefile.in.embed.gpre
|
||||
gen/Makefile.extern.regex:${MAKE_SRC_DIR}/Makefile.in.extern.regex
|
||||
gen/Makefile.fbtrace:${MAKE_SRC_DIR}/Makefile.in.fbtrace
|
||||
gen/Makefile.install:builds/install/arch-specific/${INSTALL_PREFIX}/Makefile.in
|
||||
Makefile:Makefile.in
|
||||
@ -1316,8 +1315,6 @@ chmod +x runConfigureICU configure install-sh
|
||||
./runConfigureICU "$ICU_PLATFORM" "$DEBUG_ICU" --prefix=`pwd`/..)
|
||||
fi
|
||||
|
||||
(cd extern/regex; sh configure)
|
||||
|
||||
dnl Print out the build configuration (the most interesting thing)
|
||||
echo
|
||||
echo
|
||||
|
@ -101,10 +101,10 @@
|
||||
#include "../jrd/intl_classes.h"
|
||||
#include "../jrd/TextType.h"
|
||||
|
||||
using namespace Jrd;
|
||||
|
||||
#include "../jrd/SimilarToMatcher.h"
|
||||
|
||||
using namespace Jrd;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
@ -137,74 +137,6 @@ static const UCHAR SLEUTH_SPECIAL[128] =
|
||||
|
||||
// Below are templates for functions used in Collation implementation
|
||||
|
||||
class NullStrConverter
|
||||
{
|
||||
public:
|
||||
NullStrConverter(MemoryPool& pool, const TextType* obj, const UCHAR* str, SLONG len)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PrevConverter>
|
||||
class UpcaseConverter : public PrevConverter
|
||||
{
|
||||
public:
|
||||
UpcaseConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len)
|
||||
: PrevConverter(pool, obj, str, len)
|
||||
{
|
||||
if (len > (int) sizeof(tempBuffer))
|
||||
out_str = FB_NEW(pool) UCHAR[len];
|
||||
else
|
||||
out_str = tempBuffer;
|
||||
obj->str_to_upper(len, str, len, out_str);
|
||||
str = out_str;
|
||||
}
|
||||
|
||||
~UpcaseConverter()
|
||||
{
|
||||
if (out_str != tempBuffer)
|
||||
delete[] out_str;
|
||||
}
|
||||
|
||||
private:
|
||||
UCHAR tempBuffer[100];
|
||||
UCHAR* out_str;
|
||||
};
|
||||
|
||||
template <typename PrevConverter>
|
||||
class CanonicalConverter : public PrevConverter
|
||||
{
|
||||
public:
|
||||
CanonicalConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len)
|
||||
: PrevConverter(pool, obj, str, len)
|
||||
{
|
||||
const SLONG out_len = len / obj->getCharSet()->minBytesPerChar() * obj->getCanonicalWidth();
|
||||
|
||||
if (out_len > (int) sizeof(tempBuffer))
|
||||
out_str = FB_NEW(pool) UCHAR[out_len];
|
||||
else
|
||||
out_str = tempBuffer;
|
||||
|
||||
if (str)
|
||||
{
|
||||
len = obj->canonical(len, str, out_len, out_str) * obj->getCanonicalWidth();
|
||||
str = out_str;
|
||||
}
|
||||
else
|
||||
len = 0;
|
||||
}
|
||||
|
||||
~CanonicalConverter()
|
||||
{
|
||||
if (out_str != tempBuffer)
|
||||
delete[] out_str;
|
||||
}
|
||||
|
||||
private:
|
||||
UCHAR tempBuffer[100];
|
||||
UCHAR* out_str;
|
||||
};
|
||||
|
||||
template <typename StrConverter, typename CharType>
|
||||
class LikeMatcher : public PatternMatcher
|
||||
{
|
||||
|
@ -388,6 +388,8 @@ void IntlUtil::initNarrowCharset(charset* cs, const ASCII* name)
|
||||
bool IntlUtil::initUnicodeCollation(texttype* tt, charset* cs, const ASCII* name,
|
||||
USHORT attributes, const UCharBuffer& specificAttributes, const string& configInfo)
|
||||
{
|
||||
memset(tt, 0, sizeof(*tt));
|
||||
|
||||
// name comes from stack. Copy it.
|
||||
ASCII* nameCopy = new ASCII[strlen(name) + 1];
|
||||
strcpy(nameCopy, name);
|
||||
|
@ -38,9 +38,12 @@ namespace Firebird
|
||||
{
|
||||
|
||||
template <typename StrConverter, typename CharType>
|
||||
class SimilarToMatcher : public PatternMatcher
|
||||
class SimilarToMatcher : public Jrd::PatternMatcher
|
||||
{
|
||||
private:
|
||||
typedef Jrd::CharSet CharSet;
|
||||
typedef Jrd::TextType TextType;
|
||||
|
||||
// This class is based on work of Zafir Anjum
|
||||
// http://www.codeguru.com/Cpp/Cpp/string/regex/article.php/c2791
|
||||
// which has been derived from work by Henry Spencer.
|
||||
@ -103,7 +106,8 @@ private:
|
||||
len3(aLen),
|
||||
str4(NULL),
|
||||
len4(0),
|
||||
ref(0)
|
||||
ref(0),
|
||||
branchNum(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -117,7 +121,8 @@ private:
|
||||
len3(0),
|
||||
str4(NULL),
|
||||
len4(0),
|
||||
ref(aRef)
|
||||
ref(aRef),
|
||||
branchNum(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -131,7 +136,8 @@ private:
|
||||
len3(0),
|
||||
str4(NULL),
|
||||
len4(0),
|
||||
ref(aRef)
|
||||
ref(aRef),
|
||||
branchNum(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -145,7 +151,8 @@ private:
|
||||
len3(node.len3),
|
||||
str4(node.str4),
|
||||
len4(node.len4),
|
||||
ref(node.ref)
|
||||
ref(node.ref),
|
||||
branchNum(node.branchNum)
|
||||
{
|
||||
}
|
||||
|
||||
@ -159,6 +166,7 @@ private:
|
||||
const UCHAR* str4;
|
||||
SLONG len4;
|
||||
int ref;
|
||||
int branchNum;
|
||||
};
|
||||
|
||||
// Struct used to evaluate expressions without recursion.
|
||||
@ -213,6 +221,12 @@ private:
|
||||
const CharType* set, SLONG setLen);
|
||||
|
||||
private:
|
||||
struct Range
|
||||
{
|
||||
unsigned start;
|
||||
unsigned length;
|
||||
};
|
||||
|
||||
TextType* textType;
|
||||
CharType escapeChar;
|
||||
bool useEscape;
|
||||
@ -230,6 +244,10 @@ private:
|
||||
const CharType* bufferEnd;
|
||||
const CharType* bufferPos;
|
||||
CharType metaCharacters[15];
|
||||
|
||||
public:
|
||||
unsigned branchNum;
|
||||
Range* branches;
|
||||
};
|
||||
|
||||
public:
|
||||
@ -255,6 +273,18 @@ public:
|
||||
return evaluator.processNextChunk(str, length);
|
||||
}
|
||||
|
||||
unsigned getNumBranches()
|
||||
{
|
||||
return evaluator.branchNum;
|
||||
}
|
||||
|
||||
void getBranchInfo(unsigned n, unsigned* start, unsigned* length)
|
||||
{
|
||||
fb_assert(n <= evaluator.branchNum);
|
||||
*start = evaluator.branches[n].start;
|
||||
*length = evaluator.branches[n].length;
|
||||
}
|
||||
|
||||
static SimilarToMatcher* create(MemoryPool& pool, TextType* ttype,
|
||||
const UCHAR* str, SLONG length, const UCHAR* escape, SLONG escape_length)
|
||||
{
|
||||
@ -295,7 +325,8 @@ SimilarToMatcher<StrConverter, CharType>::Evaluator::Evaluator(
|
||||
patternCvt(pool, textType, patternStr, patternLen),
|
||||
charSet(textType->getCharSet()),
|
||||
nodes(pool),
|
||||
scopes(pool)
|
||||
scopes(pool),
|
||||
branchNum(0)
|
||||
{
|
||||
fb_assert(patternLen % sizeof(CharType) == 0);
|
||||
patternLen /= sizeof(CharType);
|
||||
@ -339,6 +370,8 @@ SimilarToMatcher<StrConverter, CharType>::Evaluator::Evaluator(
|
||||
if (patternPos < patternEnd)
|
||||
status_exception::raise(Arg::Gds(isc_invalid_similar_pattern));
|
||||
|
||||
branches = FB_NEW(pool) Range[branchNum + 1];
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
@ -356,11 +389,29 @@ bool SimilarToMatcher<StrConverter, CharType>::Evaluator::getResult()
|
||||
bufferStart = bufferPos = (const CharType*) str;
|
||||
bufferEnd = bufferStart + len / sizeof(CharType);
|
||||
|
||||
bool matched =
|
||||
#ifdef RECURSIVE_SIMILAR
|
||||
return match(nodes.getCount(), 0);
|
||||
match(nodes.getCount(), 0);
|
||||
#else
|
||||
return match();
|
||||
match();
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SIMILAR
|
||||
if (matched)
|
||||
{
|
||||
string s;
|
||||
for (unsigned i = 0; i <= branchNum; ++i)
|
||||
{
|
||||
string x;
|
||||
x.printf("%d: %d, %d\n\t", i, branches[i].start, branches[i].length);
|
||||
s += x;
|
||||
}
|
||||
|
||||
gds__log("%s", s.c_str());
|
||||
}
|
||||
#endif // DEBUG_SIMILAR
|
||||
|
||||
return matched;
|
||||
}
|
||||
|
||||
|
||||
@ -378,6 +429,8 @@ void SimilarToMatcher<StrConverter, CharType>::Evaluator::reset()
|
||||
{
|
||||
buffer.shrink(0);
|
||||
scopes.shrink(0);
|
||||
|
||||
memset(branches, 0, sizeof(Range) * (branchNum + 1));
|
||||
}
|
||||
|
||||
|
||||
@ -397,8 +450,10 @@ void SimilarToMatcher<StrConverter, CharType>::Evaluator::parseExpr(int* flagp)
|
||||
else
|
||||
++patternPos;
|
||||
|
||||
int thisBranchNum = branchNum;
|
||||
start = nodes.getCount();
|
||||
nodes.push(Node(opBranch));
|
||||
nodes.back().branchNum = thisBranchNum;
|
||||
|
||||
int flags;
|
||||
parseTerm(&flags);
|
||||
@ -407,8 +462,8 @@ void SimilarToMatcher<StrConverter, CharType>::Evaluator::parseExpr(int* flagp)
|
||||
|
||||
refs.push(nodes.getCount());
|
||||
nodes.push(Node(opRef));
|
||||
nodes.back().branchNum = thisBranchNum;
|
||||
|
||||
nodes[start].ref = nodes.getCount() - start;
|
||||
}
|
||||
|
||||
nodes[start].ref = 0;
|
||||
@ -832,6 +887,8 @@ void SimilarToMatcher<StrConverter, CharType>::Evaluator::parsePrimary(int* flag
|
||||
}
|
||||
else if (op == canonicalChar(TextType::CHAR_OPEN_PAREN))
|
||||
{
|
||||
++branchNum;
|
||||
|
||||
int flags;
|
||||
parseExpr(&flags);
|
||||
|
||||
@ -899,7 +956,10 @@ void SimilarToMatcher<StrConverter, CharType>::Evaluator::dump() const
|
||||
break;
|
||||
|
||||
case opBranch:
|
||||
type.printf("opBranch(%d)", i + nodes[i].ref);
|
||||
if (nodes[i].branchNum == -1)
|
||||
type.printf("opBranch(%d)", i + nodes[i].ref);
|
||||
else
|
||||
type.printf("opBranch(%d, %d)", i + nodes[i].ref, nodes[i].branchNum);
|
||||
break;
|
||||
|
||||
case opStart:
|
||||
@ -911,7 +971,10 @@ void SimilarToMatcher<StrConverter, CharType>::Evaluator::dump() const
|
||||
break;
|
||||
|
||||
case opRef:
|
||||
type.printf("opRef(%d)", i + nodes[i].ref);
|
||||
if (nodes[i].branchNum == -1)
|
||||
type.printf("opRef(%d)", i + nodes[i].ref);
|
||||
else
|
||||
type.printf("opRef(%d, %d)", i + nodes[i].ref, nodes[i].branchNum);
|
||||
break;
|
||||
|
||||
case opNothing:
|
||||
@ -993,6 +1056,9 @@ bool SimilarToMatcher<StrConverter, CharType>::Evaluator::match(int limit, int s
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (node->branchNum != -1)
|
||||
branches[node->branchNum].start = save - bufferStart;
|
||||
|
||||
if (match(limit, i + 1))
|
||||
return true;
|
||||
|
||||
@ -1022,6 +1088,12 @@ bool SimilarToMatcher<StrConverter, CharType>::Evaluator::match(int limit, int s
|
||||
break;
|
||||
|
||||
case opRef:
|
||||
if (node->branchNum != -1)
|
||||
{
|
||||
branches[node->branchNum].length =
|
||||
bufferPos - bufferStart - branches[node->branchNum].start;
|
||||
}
|
||||
|
||||
if (node->ref == 1) // avoid recursion
|
||||
break;
|
||||
return match(limit, i + node->ref);
|
||||
@ -1202,6 +1274,9 @@ bool SimilarToMatcher<StrConverter, CharType>::Evaluator::match()
|
||||
case opBranch:
|
||||
if (state == msIterating)
|
||||
{
|
||||
if (node->branchNum != -1)
|
||||
branches[node->branchNum].start = bufferPos - bufferStart;
|
||||
|
||||
scope->save = bufferPos;
|
||||
start = scope->i + 1;
|
||||
limit = scope->limit;
|
||||
@ -1258,6 +1333,12 @@ bool SimilarToMatcher<StrConverter, CharType>::Evaluator::match()
|
||||
fb_assert(state == msIterating || state == msReturning);
|
||||
if (state == msIterating)
|
||||
{
|
||||
if (node->branchNum != -1)
|
||||
{
|
||||
branches[node->branchNum].length =
|
||||
bufferPos - bufferStart - branches[node->branchNum].start;
|
||||
}
|
||||
|
||||
if (node->ref != 1)
|
||||
{
|
||||
state = msRecursing;
|
||||
|
@ -33,6 +33,9 @@
|
||||
#include "../jrd/intlobj_new.h"
|
||||
#include "../jrd/constants.h"
|
||||
#include "../jrd/unicode_util.h"
|
||||
#include "../jrd/CsConvert.h"
|
||||
#include "../jrd/CharSet.h"
|
||||
#include "../jrd/TextType.h"
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
@ -58,12 +61,77 @@ protected:
|
||||
TextType* textType;
|
||||
};
|
||||
|
||||
class NullStrConverter
|
||||
{
|
||||
public:
|
||||
NullStrConverter(MemoryPool& pool, const TextType* obj, const UCHAR* str, SLONG len)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PrevConverter>
|
||||
class UpcaseConverter : public PrevConverter
|
||||
{
|
||||
public:
|
||||
UpcaseConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len)
|
||||
: PrevConverter(pool, obj, str, len)
|
||||
{
|
||||
if (len > (int) sizeof(tempBuffer))
|
||||
out_str = FB_NEW(pool) UCHAR[len];
|
||||
else
|
||||
out_str = tempBuffer;
|
||||
obj->str_to_upper(len, str, len, out_str);
|
||||
str = out_str;
|
||||
}
|
||||
|
||||
~UpcaseConverter()
|
||||
{
|
||||
if (out_str != tempBuffer)
|
||||
delete[] out_str;
|
||||
}
|
||||
|
||||
private:
|
||||
UCHAR tempBuffer[100];
|
||||
UCHAR* out_str;
|
||||
};
|
||||
|
||||
template <typename PrevConverter>
|
||||
class CanonicalConverter : public PrevConverter
|
||||
{
|
||||
public:
|
||||
CanonicalConverter(MemoryPool& pool, TextType* obj, const UCHAR*& str, SLONG& len)
|
||||
: PrevConverter(pool, obj, str, len)
|
||||
{
|
||||
const SLONG out_len = len / obj->getCharSet()->minBytesPerChar() * obj->getCanonicalWidth();
|
||||
|
||||
if (out_len > (int) sizeof(tempBuffer))
|
||||
out_str = FB_NEW(pool) UCHAR[out_len];
|
||||
else
|
||||
out_str = tempBuffer;
|
||||
|
||||
if (str)
|
||||
{
|
||||
len = obj->canonical(len, str, out_len, out_str) * obj->getCanonicalWidth();
|
||||
str = out_str;
|
||||
}
|
||||
else
|
||||
len = 0;
|
||||
}
|
||||
|
||||
~CanonicalConverter()
|
||||
{
|
||||
if (out_str != tempBuffer)
|
||||
delete[] out_str;
|
||||
}
|
||||
|
||||
private:
|
||||
UCHAR tempBuffer[100];
|
||||
UCHAR* out_str;
|
||||
};
|
||||
|
||||
} // namespace Jrd
|
||||
|
||||
|
||||
#include "../jrd/CsConvert.h"
|
||||
#include "../jrd/CharSet.h"
|
||||
#include "../jrd/TextType.h"
|
||||
#include "../jrd/Collation.h"
|
||||
|
||||
|
||||
|
@ -26,9 +26,14 @@
|
||||
*/
|
||||
|
||||
#include "TraceConfiguration.h"
|
||||
#include "../../jrd/intl_classes.h"
|
||||
#include "../../jrd/evl_string.h"
|
||||
#include "../../jrd/TextType.h"
|
||||
#include "../../jrd/SimilarToMatcher.h"
|
||||
|
||||
using namespace Firebird;
|
||||
|
||||
|
||||
void TraceCfgReader::readTraceConfiguration(const char* text,
|
||||
const PathName& databaseName,
|
||||
TracePluginConfig& config)
|
||||
@ -67,14 +72,21 @@ void TraceCfgReader::readConfig()
|
||||
cfgFile->addText(m_text);
|
||||
cfgFile->parse();
|
||||
|
||||
m_subpatterns[0].rm_so = 0;
|
||||
m_subpatterns[0].rm_eo = m_databaseName.length();
|
||||
m_subpatterns[0].start = 0;
|
||||
m_subpatterns[0].end = m_databaseName.length();
|
||||
for (size_t i = 1; i < FB_NELEM(m_subpatterns); i++)
|
||||
{
|
||||
m_subpatterns[i].rm_so = -1;
|
||||
m_subpatterns[i].rm_eo = -1;
|
||||
m_subpatterns[i].start = -1;
|
||||
m_subpatterns[i].end = -1;
|
||||
}
|
||||
|
||||
charset cs;
|
||||
IntlUtil::initAsciiCharset(&cs);
|
||||
texttype tt;
|
||||
IntlUtil::initUnicodeCollation(&tt, &cs, "UNICODE", 0, UCharBuffer(), string());
|
||||
AutoPtr<Jrd::CharSet> charSet(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, &cs));
|
||||
Jrd::TextType textType(0, &tt, charSet);
|
||||
|
||||
bool defDB = false, defSvc = false, exactMatch = false;
|
||||
const Element* section = cfgFile->getObjects()->children;
|
||||
for (; section && !exactMatch; section = section->sibling)
|
||||
@ -115,34 +127,38 @@ void TraceCfgReader::readConfig()
|
||||
match = exactMatch = true;
|
||||
else
|
||||
{
|
||||
regex_t matcher;
|
||||
int flags = REG_EXTENDED;
|
||||
if (!CASE_SENSITIVITY)
|
||||
flags |= REG_ICASE;
|
||||
int errorCode = regcomp(&matcher, pattern.c_str(), flags);
|
||||
|
||||
if (errorCode)
|
||||
try
|
||||
{
|
||||
char errBuf[256];
|
||||
regerror(errorCode, NULL, errBuf, sizeof(errBuf));
|
||||
fatal_exception::raiseFmt(
|
||||
"line %d: error \"%s\" while compiling regular expression \"%s\"",
|
||||
section->lineNumber + 1, errBuf, pattern.c_str());
|
||||
#ifdef WIN_NT // !CASE_SENSITIVITY
|
||||
typedef Jrd::UpcaseConverter<Jrd::NullStrConverter> SimilarConverter;
|
||||
#else
|
||||
typedef Jrd::NullStrConverter SimilarConverter;
|
||||
#endif
|
||||
SimilarToMatcher<SimilarConverter, UCHAR> matcher(*getDefaultMemoryPool(),
|
||||
&textType, (const UCHAR*) pattern.c_str(), pattern.length(), '\\', true);
|
||||
|
||||
matcher.process((const UCHAR*) m_databaseName.c_str(), m_databaseName.length());
|
||||
if (matcher.result())
|
||||
{
|
||||
for (unsigned i = 0;
|
||||
i <= matcher.getNumBranches() && i < FB_NELEM(m_subpatterns); ++i)
|
||||
{
|
||||
unsigned start, length;
|
||||
matcher.getBranchInfo(i, &start, &length);
|
||||
|
||||
m_subpatterns[i].start = start;
|
||||
m_subpatterns[i].end = start + length;
|
||||
}
|
||||
|
||||
match = exactMatch = true;
|
||||
}
|
||||
}
|
||||
|
||||
errorCode = regexec(&matcher, m_databaseName.c_str(), FB_NELEM(m_subpatterns), m_subpatterns, 0);
|
||||
|
||||
if (errorCode && errorCode != REG_NOMATCH)
|
||||
catch (const Exception&)
|
||||
{
|
||||
char errBuf[256];
|
||||
regerror(errorCode, NULL, errBuf, sizeof(errBuf));
|
||||
fatal_exception::raiseFmt(
|
||||
"line %d: error \"%s\" while applying regular expression \"%s\" to database \"%s\"",
|
||||
section->lineNumber + 1, errBuf, pattern.c_str(), m_databaseName.c_str());
|
||||
"line %d: error while compiling regular expression \"%s\"",
|
||||
section->lineNumber + 1, pattern.c_str());
|
||||
}
|
||||
|
||||
if (errorCode == 0)
|
||||
match = exactMatch = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,45 +230,35 @@ void TraceCfgReader::expandPattern(string& valueToExpand)
|
||||
while (pos < valueToExpand.length())
|
||||
{
|
||||
string::char_type c = valueToExpand[pos];
|
||||
if (c == '$')
|
||||
if (c == '\\')
|
||||
{
|
||||
if (pos + 1 >= valueToExpand.length())
|
||||
fatal_exception::raiseFmt("pattern is invalid");
|
||||
|
||||
c = valueToExpand[pos + 1];
|
||||
if (c == '$')
|
||||
if (c == '\\')
|
||||
{
|
||||
// Kill one of the dollar signs and loop again
|
||||
// Kill one of the backslash signs and loop again
|
||||
valueToExpand.erase(pos, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
regmatch_t* subpattern = m_subpatterns + (c - '0');
|
||||
MatchPos* subpattern = m_subpatterns + (c - '0');
|
||||
// Replace value with piece of database name
|
||||
valueToExpand.erase(pos, 2);
|
||||
if (subpattern->rm_eo != -1 && subpattern->rm_so != -1)
|
||||
if (subpattern->end != -1 && subpattern->start != -1)
|
||||
{
|
||||
off_t subpattern_len = subpattern->rm_eo - subpattern->rm_so;
|
||||
off_t subpattern_len = subpattern->end - subpattern->start;
|
||||
valueToExpand.insert(pos,
|
||||
m_databaseName.substr(subpattern->rm_so, subpattern_len).c_str(),
|
||||
m_databaseName.substr(subpattern->start, subpattern_len).c_str(),
|
||||
subpattern_len);
|
||||
pos += subpattern_len;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '&')
|
||||
{
|
||||
// Replace value with whole database file name
|
||||
valueToExpand.erase(pos, 2);
|
||||
const Firebird::PathName& filename = m_databaseName;
|
||||
valueToExpand.insert(pos, filename.c_str(), filename.length());
|
||||
pos += filename.length();
|
||||
continue;
|
||||
}
|
||||
|
||||
fatal_exception::raiseFmt("pattern is invalid");
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "TracePluginConfig.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "regex.h"
|
||||
|
||||
|
||||
class TraceCfgReader
|
||||
@ -47,6 +46,13 @@ class TraceCfgReader
|
||||
public:
|
||||
static void readTraceConfiguration(const char* text, const Firebird::PathName& databaseName, TracePluginConfig& config);
|
||||
|
||||
private:
|
||||
struct MatchPos
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
};
|
||||
|
||||
private:
|
||||
TraceCfgReader(const char* text, const Firebird::PathName& databaseName, TracePluginConfig& config) :
|
||||
m_text(text),
|
||||
@ -62,7 +68,7 @@ private:
|
||||
|
||||
const char* const m_text;
|
||||
const Firebird::PathName& m_databaseName;
|
||||
regmatch_t m_subpatterns[10];
|
||||
MatchPos m_subpatterns[10];
|
||||
TracePluginConfig& m_config;
|
||||
};
|
||||
|
||||
|
@ -137,30 +137,41 @@ TracePluginImpl::TracePluginImpl(const TracePluginConfig &configuration, TraceIn
|
||||
PluginLogWriter(logname.c_str(), config.max_log_size * 1024 * 1024);
|
||||
}
|
||||
|
||||
IntlUtil::initAsciiCharset(&cs);
|
||||
IntlUtil::initUnicodeCollation(&tt, &cs, "UNICODE", 0, UCharBuffer(), string());
|
||||
charSet = Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, &cs);
|
||||
textType = FB_NEW(*getDefaultMemoryPool()) Jrd::TextType(0, &tt, charSet);
|
||||
|
||||
// Compile filtering regular expressions
|
||||
if (config.include_filter.hasData())
|
||||
{
|
||||
int errorCode = regcomp(&include_matcher, config.include_filter.c_str(), REG_EXTENDED | REG_ICASE);
|
||||
if (errorCode)
|
||||
try
|
||||
{
|
||||
char errBuf[256];
|
||||
regerror(errorCode, NULL, errBuf, sizeof(errBuf));
|
||||
Firebird::fatal_exception::raiseFmt(
|
||||
"error \"%s\" while compiling regular expression \"%s\" for database \"%s\"",
|
||||
errBuf, config.include_filter.c_str(), config.db_filename.c_str());
|
||||
include_matcher = new SimilarToMatcher<UpcaseConverter<NullStrConverter>, UCHAR>(
|
||||
*getDefaultMemoryPool(), textType, (const UCHAR*) config.include_filter.c_str(),
|
||||
config.include_filter.length(), '\\', true);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
fatal_exception::raiseFmt(
|
||||
"error while compiling regular expression \"%s\" for database \"%s\"",
|
||||
config.include_filter.c_str(), config.db_filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (config.exclude_filter.hasData())
|
||||
{
|
||||
int errorCode = regcomp(&exclude_matcher, config.exclude_filter.c_str(), REG_EXTENDED | REG_ICASE);
|
||||
if (errorCode)
|
||||
try
|
||||
{
|
||||
char errBuf[256];
|
||||
regerror(errorCode, NULL, errBuf, sizeof(errBuf));
|
||||
Firebird::fatal_exception::raiseFmt(
|
||||
"error \"%s\" while compiling regular expression \"%s\" for database \"%s\"",
|
||||
errBuf, config.exclude_filter.c_str(), config.db_filename.c_str());
|
||||
exclude_matcher = new SimilarToMatcher<UpcaseConverter<NullStrConverter>, UCHAR>(
|
||||
*getDefaultMemoryPool(), textType, (const UCHAR*) config.exclude_filter.c_str(),
|
||||
config.exclude_filter.length(), '\\', true);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
fatal_exception::raiseFmt(
|
||||
"error while compiling regular expression \"%s\" for database \"%s\"",
|
||||
config.exclude_filter.c_str(), config.db_filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1229,32 +1240,16 @@ void TracePluginImpl::register_sql_statement(TraceSQLStatement* statement)
|
||||
{
|
||||
if (config.include_filter.hasData())
|
||||
{
|
||||
const int errorCode = regexec(&include_matcher, sql, 0, NULL, 0);
|
||||
if (errorCode && errorCode != REG_NOMATCH)
|
||||
{
|
||||
char errBuf[256];
|
||||
regerror(errorCode, NULL, errBuf, sizeof(errBuf));
|
||||
Firebird::fatal_exception::raiseFmt(
|
||||
"error \"%s\" while applying regular expression \"%s\" for database \"%s\"",
|
||||
errBuf, config.include_filter.c_str(), config.db_filename.c_str());
|
||||
}
|
||||
need_statement = !errorCode;
|
||||
include_matcher->reset();
|
||||
include_matcher->process((const UCHAR*) sql, sql_length);
|
||||
need_statement = include_matcher->result();
|
||||
}
|
||||
|
||||
if (need_statement && config.exclude_filter.hasData())
|
||||
{
|
||||
const int errorCode = regexec(&exclude_matcher, sql, 0, NULL, 0);
|
||||
if (errorCode && errorCode != REG_NOMATCH)
|
||||
{
|
||||
char errBuf[256];
|
||||
regerror(errorCode, NULL, errBuf, sizeof(errBuf));
|
||||
Firebird::fatal_exception::raiseFmt(
|
||||
"error \"%s\" while applying regular expression \"%s\" for database \"%s\"",
|
||||
errBuf, config.exclude_filter.c_str(), config.db_filename.c_str());
|
||||
}
|
||||
|
||||
if (!errorCode)
|
||||
need_statement = false;
|
||||
exclude_matcher->reset();
|
||||
exclude_matcher->process((const UCHAR*) sql, sql_length);
|
||||
need_statement = !exclude_matcher->result();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,14 +31,17 @@
|
||||
|
||||
#include "../../jrd/ntrace.h"
|
||||
#include "TracePluginConfig.h"
|
||||
#include "../../jrd/intl_classes.h"
|
||||
#include "../../jrd/evl_string.h"
|
||||
#include "../../jrd/TextType.h"
|
||||
#include "../../jrd/SimilarToMatcher.h"
|
||||
#include "../../common/classes/rwlock.h"
|
||||
#include "../../common/classes/GenericMap.h"
|
||||
#include "../../common/classes/locks.h"
|
||||
|
||||
|
||||
// Bring in off_t
|
||||
#include <sys/types.h>
|
||||
#include "regex.h"
|
||||
|
||||
|
||||
class TracePluginImpl
|
||||
{
|
||||
@ -161,8 +164,13 @@ private:
|
||||
// Lock for log rotation
|
||||
Firebird::RWLock renameLock;
|
||||
|
||||
regex_t include_matcher;
|
||||
regex_t exclude_matcher;
|
||||
charset cs;
|
||||
texttype tt;
|
||||
Firebird::AutoPtr<Jrd::CharSet> charSet;
|
||||
Firebird::AutoPtr<Jrd::TextType> textType;
|
||||
|
||||
Firebird::AutoPtr<Firebird::SimilarToMatcher<Jrd::UpcaseConverter<Jrd::NullStrConverter>, UCHAR> >
|
||||
include_matcher, exclude_matcher;
|
||||
|
||||
void appendGlobalCounts(const PerformanceInfo* info);
|
||||
void appendTableCounts(const PerformanceInfo* info);
|
||||
|
@ -7,13 +7,12 @@
|
||||
# - if database name matches pattern, options are immediately applied and
|
||||
# search does not continue
|
||||
#
|
||||
# Pattern is either database name without path or POSIX 1002.3 extended regular
|
||||
# expression in square braces which is matched against fully qualified database
|
||||
# path name.
|
||||
# Pattern is either database name without path or "SIMILAR TO"-based regular
|
||||
# expression which is matched against fully qualified database path name.
|
||||
#
|
||||
# For log file name Apache/Perl syntax for substitutions is supported.
|
||||
# I.e. $& - whole matched string, $1 ... $9 - braced subexpressions.
|
||||
# $$ is dollar sign.
|
||||
# For log file name Sed syntax for substitutions is supported.
|
||||
# I.e. \0 - whole matched string, \1 ... \9 - parenthesis subexpressions.
|
||||
# \\ is backslash.
|
||||
|
||||
|
||||
# default database section
|
||||
@ -155,7 +154,7 @@
|
||||
# into log file name matching database name - test.log, azk2.log and
|
||||
# rulez.log appropriately
|
||||
#
|
||||
<database ^.*[\/](test|azk2|rulez)\.fdb$>
|
||||
<database %[\\/](test|azk2|rulez).fdb>
|
||||
enabled true
|
||||
log_filename $1.log
|
||||
log_filename \1.log
|
||||
</database>
|
||||
|
Loading…
Reference in New Issue
Block a user