Cleaned up a few things in regex extension and updated project files to build on both engines. Linux makefiles probably still won't work.
--HG-- branch : sourcemod-1.1.0 extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.1.0%401925
This commit is contained in:
parent
62b08e923c
commit
50760d853f
@ -13,7 +13,7 @@ RegEx::RegEx()
|
|||||||
mSubStrings = 0;
|
mSubStrings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegEx::Clear()
|
void RegEx::Clear ()
|
||||||
{
|
{
|
||||||
mErrorOffset = 0;
|
mErrorOffset = 0;
|
||||||
mError = NULL;
|
mError = NULL;
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
|
|
||||||
#include <sh_string.h>
|
#include <sh_string.h>
|
||||||
#include <sh_vector.h>
|
|
||||||
#include "pcre.h"
|
#include "pcre.h"
|
||||||
#include "CRegEx.h"
|
#include "CRegEx.h"
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
@ -50,21 +49,6 @@ RegexHandler g_RegexHandler;
|
|||||||
HandleType_t g_RegexHandle=0;
|
HandleType_t g_RegexHandle=0;
|
||||||
|
|
||||||
|
|
||||||
SourceHook::CVector<RegEx *> PEL;
|
|
||||||
|
|
||||||
int GetPEL()
|
|
||||||
{
|
|
||||||
for (int i=0; i<(int)PEL.size(); i++)
|
|
||||||
{
|
|
||||||
if (PEL[i]->isFree())
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegEx *x = new RegEx();
|
|
||||||
PEL.push_back(x);
|
|
||||||
|
|
||||||
return (int)PEL.size() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RegexExtension::SDK_OnLoad(char *error, size_t err_max, bool late)
|
bool RegexExtension::SDK_OnLoad(char *error, size_t err_max, bool late)
|
||||||
{
|
{
|
||||||
@ -76,15 +60,7 @@ bool RegexExtension::SDK_OnLoad(char *error, size_t err_max, bool late)
|
|||||||
void RegexExtension::SDK_OnUnload()
|
void RegexExtension::SDK_OnUnload()
|
||||||
{
|
{
|
||||||
g_pHandleSys->RemoveType(g_RegexHandle, myself->GetIdentity());
|
g_pHandleSys->RemoveType(g_RegexHandle, myself->GetIdentity());
|
||||||
for(int i=0; i<(int)PEL.size(); i++)
|
|
||||||
{
|
|
||||||
if(PEL[i])
|
|
||||||
{
|
|
||||||
delete PEL[i];
|
|
||||||
PEL[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PEL.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t CompileRegex(IPluginContext *pCtx, const cell_t *params)
|
static cell_t CompileRegex(IPluginContext *pCtx, const cell_t *params)
|
||||||
@ -92,8 +68,7 @@ static cell_t CompileRegex(IPluginContext *pCtx, const cell_t *params)
|
|||||||
char *regex;
|
char *regex;
|
||||||
pCtx->LocalToString(params[1], ®ex);
|
pCtx->LocalToString(params[1], ®ex);
|
||||||
|
|
||||||
int id = GetPEL();
|
RegEx *x = new RegEx();
|
||||||
RegEx *x = PEL[id];
|
|
||||||
|
|
||||||
if (x->Compile(regex, params[2]) == 0)
|
if (x->Compile(regex, params[2]) == 0)
|
||||||
{
|
{
|
||||||
@ -201,6 +176,7 @@ void RegexHandler::OnHandleDestroy(HandleType_t type, void *object)
|
|||||||
RegEx *x = (RegEx *)object;
|
RegEx *x = (RegEx *)object;
|
||||||
|
|
||||||
x->Clear();
|
x->Clear();
|
||||||
|
delete x;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sp_nativeinfo_t regex_natives[] =
|
const sp_nativeinfo_t regex_natives[] =
|
||||||
|
@ -1,18 +1,24 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
# Visual Studio 2005
|
# Visual C++ Express 2005
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdk", "sdk.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "regex", "sdk.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||||
Release|Win32 = Release|Win32
|
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||||
|
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||||
|
Release - Orange Box|Win32 = Release - Orange Box|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Episode 1|Win32.ActiveCfg = Debug|Win32
|
||||||
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Episode 1|Win32.Build.0 = Debug|Win32
|
||||||
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
|
||||||
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
|
||||||
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Episode 1|Win32.ActiveCfg = Release|Win32
|
||||||
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Episode 1|Win32.Build.0 = Release|Win32
|
||||||
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
|
||||||
|
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn"
|
AdditionalIncludeDirectories="..\;..\sdk;..\..;..\systems;..\..\..\public;..\..\..\public\sourcepawn;"$(SOURCEMM142)";"$(SOURCEMM142)\sourcemm";"$(SOURCEMM142)\sourcehook";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\game\server";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(HL2SDK)\tier1";"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@ -64,7 +64,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
IgnoreImportLibrary="false"
|
IgnoreImportLibrary="false"
|
||||||
AdditionalDependencies="..\lib_win\pcre.lib tier0.lib mathlib.lib"
|
AdditionalDependencies="..\lib_win\pcre.lib "$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
||||||
OutputFile="$(OutDir)\regex.ext.dll"
|
OutputFile="$(OutDir)\regex.ext.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBCMTD"
|
IgnoreDefaultLibraryNames="LIBCMTD"
|
||||||
@ -126,7 +126,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn"
|
AdditionalIncludeDirectories="..\;..\sdk;..\..;..\systems;..\..\..\public;..\..\..\public\sourcepawn;"$(SOURCEMM142)";"$(SOURCEMM142)\sourcemm";"$(SOURCEMM142)\sourcehook";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\game\server";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(HL2SDK)\tier1";"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
@ -147,7 +147,175 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)\sample.ext.dll"
|
AdditionalDependencies="..\lib_win\pcre.lib "$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\regex.ext.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Orange Box|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\;..\sdk;..\..;..\systems;..\..\..\public;..\..\..\public\sourcepawn;"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(HL2SDKOB)\tier1";"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="1"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
IgnoreImportLibrary="false"
|
||||||
|
AdditionalDependencies="..\lib_win\pcre.lib "$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\regex.ext.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="0"
|
||||||
|
EnableCOMDATFolding="0"
|
||||||
|
ImportLibrary="$(OutDir)/sdk.lib"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Orange Box|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
AdditionalIncludeDirectories="..\;..\sdk;..\..;..\systems;..\..\..\public;..\..\..\public\sourcepawn;"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(HL2SDKOB)\tier1";"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableEnhancedInstructionSet="1"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="..\lib_win\pcre.lib "$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\regex.ext.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreDefaultLibraryNames="LIBCMT"
|
IgnoreDefaultLibraryNames="LIBCMT"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
|
Loading…
Reference in New Issue
Block a user