diff options
author | fcolin | 2008-12-10 11:57:07 +0000 |
---|---|---|
committer | fcolin | 2008-12-10 11:57:07 +0000 |
commit | bab8b091f69679c373e4f8ccfa794cd52419db8f (patch) | |
tree | a6fc7fc11b58ebd8ca819bbd208aa44c79e9e468 | |
parent | cccb229e246f7331ff703d4817b414c66991e55e (diff) | |
download | ivy-cplusplus-bab8b091f69679c373e4f8ccfa794cd52419db8f.zip ivy-cplusplus-bab8b091f69679c373e4f8ccfa794cd52419db8f.tar.gz ivy-cplusplus-bab8b091f69679c373e4f8ccfa794cd52419db8f.tar.bz2 ivy-cplusplus-bab8b091f69679c373e4f8ccfa794cd52419db8f.tar.xz |
mise en conformite avec Regexp.cxx et Regexp.h pour compilation sans USE_PCRE
-rw-r--r-- | Ivy/Ivy.vcproj | 42 | ||||
-rw-r--r-- | Ivy/IvyBinding.cxx | 46 | ||||
-rw-r--r-- | Ivy/IvyBinding.h | 9 | ||||
-rw-r--r-- | Ivy/IvyLib/IvyLib.vdproj | 10 | ||||
-rw-r--r-- | Ivy/Regexp.cxx | 2 |
5 files changed, 46 insertions, 63 deletions
diff --git a/Ivy/Ivy.vcproj b/Ivy/Ivy.vcproj index f9e983a..2da9ffb 100644 --- a/Ivy/Ivy.vcproj +++ b/Ivy/Ivy.vcproj @@ -1,13 +1,14 @@ <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="9,00"
Name="Ivy"
ProjectGUID="{9818D652-CC05-463E-880D-AFCA2C7BFABE}"
RootNamespace="Ivy"
SccProjectName=""$/Bus/Ivy", QPEAAAAA"
SccLocalPath="."
SccProvider="MSSCCI:Microsoft Visual SourceSafe"
+ TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
@@ -25,7 +26,7 @@ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\PcreDir.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -53,7 +54,7 @@ Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="0"
- AdditionalIncludeDirectories=""..\..\..\pcre-6.4""
+ AdditionalIncludeDirectories="$(PcreDir)"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;IVY_EXPORTS;NO_IVY_DEBUG"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -63,7 +64,6 @@ BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
@@ -83,7 +83,10 @@ LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
+ GenerateManifest="false"
GenerateDebugInformation="true"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
@@ -104,9 +107,6 @@ Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
Description="Copying libraries, headers & dll's..."
CommandLine="rem copy "$(TargetDir)$(TargetName).dll" "C:\users\fcolin\Program Files\$(OutDir)"
rem copy "$(TargetDir)$(TargetName).lib" "C:\users\fcolin\Program Files\lib\$(OutDir)"
rem copy Ivy.h "C:\users\fcolin\Program Files\Include\"
rem copy IvyApplication.h "C:\users\fcolin\Program Files\Include\"
rem copy IvyCallback.h "C:\users\fcolin\Program Files\Include\"
rem copy BufferedSocket.h "C:\users\fcolin\Program Files\Include\"
rem copy ThreadedSocket.h "C:\users\fcolin\Program Files\Include\"
rem copy DataTypes.h "C:\users\fcolin\Program Files\Include\"
"
@@ -117,7 +117,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\PcreDir.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
@@ -145,7 +145,7 @@ Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="0"
- AdditionalIncludeDirectories=""..\..\..\pcre-6.4""
+ AdditionalIncludeDirectories="$(PcreDir)"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;IVY_EXPORTS;NO_IVY_DEBUG"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -155,7 +155,6 @@ BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
- Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
@@ -175,6 +174,8 @@ SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
@@ -196,9 +197,6 @@ Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
@@ -208,7 +206,7 @@ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\PcreDir.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="0"
@@ -237,7 +235,7 @@ Name="VCCLCompilerTool"
AdditionalOptions=""
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories=""..\..\..\pcre-6.4""
+ AdditionalIncludeDirectories="$(PcreDir)"
PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;IVY_EXPORTS"
StringPooling="true"
RuntimeLibrary="2"
@@ -264,6 +262,8 @@ LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
@@ -284,9 +284,6 @@ Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
@@ -296,7 +293,7 @@ OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\PcreDir.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="0"
@@ -325,7 +322,7 @@ Name="VCCLCompilerTool"
AdditionalOptions=""
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories=""..\..\..\pcre-6.4""
+ AdditionalIncludeDirectories="$(PcreDir)"
PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;IVY_EXPORTS"
StringPooling="true"
RuntimeLibrary="2"
@@ -353,6 +350,8 @@ LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
@@ -374,9 +373,6 @@ Name="VCAppVerifierTool"
/>
<Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
Name="VCPostBuildEventTool"
CommandLine=""
/>
diff --git a/Ivy/IvyBinding.cxx b/Ivy/IvyBinding.cxx index 9013cad..c365b71 100644 --- a/Ivy/IvyBinding.cxx +++ b/Ivy/IvyBinding.cxx @@ -24,7 +24,7 @@ static int err_offset; #ifdef USE_PCRE static const char *err_buf; #else /* we don't USE_PCRE */ - static char err_buf[4096]; +static ivy::string err_buf; #endif /* USE_PCRE */ /* classes de messages emis par l'application utilise pour le filtrage */ @@ -35,13 +35,15 @@ static IvyBinding token_extract; IvyBinding::IvyBinding() { + nb_match = 0; #ifdef USE_PCRE regexp = NULL; inspect = NULL; + #else /* we don't USE_PCRE */ - free( regexp ); + regexp = NULL; #endif /* USE_PCRE */ - nb_match = 0; + } IvyBinding::~IvyBinding() { @@ -51,7 +53,7 @@ IvyBinding::~IvyBinding() if (regexp!=NULL) pcre_free(regexp); #else /* we don't USE_PCRE */ - free( regexp ); + delete regexp; #endif /* USE_PCRE */ } bool IvyBinding::Compile( const char * expression, int *erroffset, const char **errmessage ) @@ -75,18 +77,16 @@ bool IvyBinding::Compile( const char * expression, int *erroffset, const char * printf("Error compiling '%s', %s\n", expression, err_buf); } #else /* we don't USE_PCRE */ - regex_t regexp; - int reg; - reg = regcomp(®exp, expression, REGCOMP_OPT|REG_EXTENDED); - if ( reg == 0 ) + regexp = new Regexp( expression, false ); + if ( regexp->CompiledOK() ) { - this->next = NULL; + compile = true; } else { - regerror (reg, ®exp, err_buf, sizeof(err_buf) ); + err_buf = regexp->GetErrorString(); *erroffset = err_offset; - *errmessage = err_buf; + *errmessage = err_buf.c_str(); printf("Error compiling '%s', %s\n", expression, err_buf); } #endif /* USE_PCRE */ @@ -109,15 +109,9 @@ int IvyBinding::Exec( const char * message ) OVECSIZE); if (nb_match<1) return 0; /* no match */ #else /* we don't USE_PCRE */ - memset( match, -1, sizeof(match )); /* work around bug !!!*/ - nb_match = regexec (®exp, message, MAX_MSG_FIELDS, match, 0) - if (nb_match == REG_NOMATCH) + if ( !regexp->Match( message ) ) return 0; - for ( index = 1; index < MAX_MSG_FIELDS; index++ ) - { - if ( match[i].rm_so != -1 ) - nb_match++; - } + nb_match = regexp->SubStrings()+1; // +1 first arg is wall string #endif /* USE_PCRE */ return nb_match; } @@ -130,16 +124,10 @@ void IvyBinding::Match( const char *message, int argnum, int *arglen, const char *arg = message + ovector[2*argnum]; #else /* we don't USE_PCRE */ - regmatch_t* p; - - p = &match[argnum+1]; - if ( p->rm_so != -1 ) { - *arglen = p->rm_eo - p->rm_so; - *arg = message + p->rm_so; - } else { // ARG VIDE - *arglen = 0; - *arg = NULL; - } + + *arglen = regexp->SubLength(argnum); + *arg = message + regexp->SubStart(argnum); + #endif /* USE_PCRE */ } diff --git a/Ivy/IvyBinding.h b/Ivy/IvyBinding.h index 44a87ee..58f6d42 100644 --- a/Ivy/IvyBinding.h +++ b/Ivy/IvyBinding.h @@ -24,7 +24,7 @@ #include <pcre.h>
#else /* we don't USE_PCRE */
#define MAX_MSG_FIELDS 200
-#include "Regex.h"
+#include "Regexp.h"
#endif /* USE_PCRE */
class IvyBinding
@@ -48,11 +48,10 @@ private: #ifdef USE_PCRE
pcre *regexp;
pcre_extra *inspect;
- int nb_match;
int ovector[OVECSIZE];
#else /* we don't USE_PCRE */
- regex_t regexp; /* la regexp sous forme machine */
- regmatch_t match[MAX_MSG_FIELDS+1]; /* resultat du match */
+ Regexp *regexp; /* la regexp sous forme machine */
+ //regmatch_t match[MAX_MSG_FIELDS+1]; /* resultat du match */
#endif /* USE_PCRE */
-
+ int nb_match;
};
\ No newline at end of file diff --git a/Ivy/IvyLib/IvyLib.vdproj b/Ivy/IvyLib/IvyLib.vdproj index e8a78e1..e08321f 100644 --- a/Ivy/IvyLib/IvyLib.vdproj +++ b/Ivy/IvyLib/IvyLib.vdproj @@ -15,14 +15,14 @@ {
"Entry"
{
- "MsmKey" = "8:_66D910CBB02B47569794CF954A72E057"
+ "MsmKey" = "8:_800E481F824E4563B3647395936B79A9"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_DE30DB02DD7494AFFBB32B50F67B491E"
- "OwnerKey" = "8:_66D910CBB02B47569794CF954A72E057"
+ "OwnerKey" = "8:_800E481F824E4563B3647395936B79A9"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -118,7 +118,7 @@ "SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
- "Exclude" = "11:TRUE"
+ "Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
@@ -167,7 +167,7 @@ }
"ProjectOutput"
{
- "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_66D910CBB02B47569794CF954A72E057"
+ "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_800E481F824E4563B3647395936B79A9"
{
"SourcePath" = "8:..\\..\\release\\Ivy.dll"
"TargetName" = "8:"
@@ -189,7 +189,7 @@ "ProjectOutputGroupRegister" = "3:1"
"OutputConfiguration" = "8:"
"OutputGroupCanonicalName" = "8:Built"
- "OutputProjectGuid" = "8:{9BD87B7A-517E-4900-B3EA-A358885CD876}"
+ "OutputProjectGuid" = "8:{9818D652-CC05-463E-880D-AFCA2C7BFABE}"
"ShowKeyOutput" = "11:FALSE"
"ExcludeFilters"
{
diff --git a/Ivy/Regexp.cxx b/Ivy/Regexp.cxx index 4dc1823..f04da7b 100644 --- a/Ivy/Regexp.cxx +++ b/Ivy/Regexp.cxx @@ -68,7 +68,7 @@ // regular-expression syntax might require a total rethink.
#include "IvyStdAfx.h"
-#include "regexp.h"
+#include "Regexp.h"
// The first byte of the regexp internal "program" is actually this magic
// number; the start node begins in the second byte.
|