Added more missing svn:keywords properties to some files (this should be the last of them before I never have to do this again)
Moved sm_memtable files in sqlite extension to sdk directory (to be consistent with topmenus) Some extension source files had an incorrect extension name in their headers --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402037
This commit is contained in:
+155
-155
@@ -1,155 +1,155 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SQLite Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "pcre.h"
|
||||
#include "CRegEx.h"
|
||||
#include <sh_string.h>
|
||||
#include "extension.h"
|
||||
|
||||
RegEx::RegEx()
|
||||
{
|
||||
mErrorOffset = 0;
|
||||
mError = NULL;
|
||||
re = NULL;
|
||||
mFree = true;
|
||||
subject = NULL;
|
||||
mSubStrings = 0;
|
||||
}
|
||||
|
||||
void RegEx::Clear ()
|
||||
{
|
||||
mErrorOffset = 0;
|
||||
mError = NULL;
|
||||
if (re)
|
||||
pcre_free(re);
|
||||
re = NULL;
|
||||
mFree = true;
|
||||
if (subject)
|
||||
delete [] subject;
|
||||
subject = NULL;
|
||||
mSubStrings = 0;
|
||||
}
|
||||
|
||||
RegEx::~RegEx()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool RegEx::isFree(bool set, bool val)
|
||||
{
|
||||
if (set)
|
||||
{
|
||||
mFree = val;
|
||||
return true;
|
||||
} else {
|
||||
return mFree;
|
||||
}
|
||||
}
|
||||
|
||||
int RegEx::Compile(const char *pattern, int iFlags)
|
||||
{
|
||||
if (!mFree)
|
||||
Clear();
|
||||
|
||||
re = pcre_compile(pattern, iFlags, &mError, &mErrorOffset, NULL);
|
||||
|
||||
if (re == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mFree = false;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RegEx::Match(const char *str)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (mFree || re == NULL)
|
||||
return -1;
|
||||
|
||||
this->ClearMatch();
|
||||
|
||||
//save str
|
||||
subject = new char[strlen(str)+1];
|
||||
strcpy(subject, str);
|
||||
|
||||
rc = pcre_exec(re, NULL, subject, (int)strlen(subject), 0, 0, ovector, 30);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
if (rc == PCRE_ERROR_NOMATCH)
|
||||
{
|
||||
return 0;
|
||||
} else {
|
||||
mErrorOffset = rc;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
mSubStrings = rc;
|
||||
|
||||
return 1;
|
||||
}
|
||||
void RegEx::ClearMatch()
|
||||
{
|
||||
// Clears match results
|
||||
mErrorOffset = 0;
|
||||
mError = NULL;
|
||||
if (subject)
|
||||
delete [] subject;
|
||||
subject = NULL;
|
||||
mSubStrings = 0;
|
||||
}
|
||||
|
||||
const char *RegEx::GetSubstring(int s, char buffer[], int max)
|
||||
{
|
||||
int i = 0;
|
||||
if (s >= mSubStrings || s < 0)
|
||||
return NULL;
|
||||
|
||||
char *substr_a = subject + ovector[2*s];
|
||||
int substr_l = ovector[2*s+1] - ovector[2*s];
|
||||
|
||||
for (i = 0; i<substr_l; i++)
|
||||
{
|
||||
if (i >= max)
|
||||
break;
|
||||
buffer[i] = substr_a[i];
|
||||
}
|
||||
|
||||
buffer[i] = '\0';
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "pcre.h"
|
||||
#include "CRegEx.h"
|
||||
#include <sh_string.h>
|
||||
#include "extension.h"
|
||||
|
||||
RegEx::RegEx()
|
||||
{
|
||||
mErrorOffset = 0;
|
||||
mError = NULL;
|
||||
re = NULL;
|
||||
mFree = true;
|
||||
subject = NULL;
|
||||
mSubStrings = 0;
|
||||
}
|
||||
|
||||
void RegEx::Clear ()
|
||||
{
|
||||
mErrorOffset = 0;
|
||||
mError = NULL;
|
||||
if (re)
|
||||
pcre_free(re);
|
||||
re = NULL;
|
||||
mFree = true;
|
||||
if (subject)
|
||||
delete [] subject;
|
||||
subject = NULL;
|
||||
mSubStrings = 0;
|
||||
}
|
||||
|
||||
RegEx::~RegEx()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool RegEx::isFree(bool set, bool val)
|
||||
{
|
||||
if (set)
|
||||
{
|
||||
mFree = val;
|
||||
return true;
|
||||
} else {
|
||||
return mFree;
|
||||
}
|
||||
}
|
||||
|
||||
int RegEx::Compile(const char *pattern, int iFlags)
|
||||
{
|
||||
if (!mFree)
|
||||
Clear();
|
||||
|
||||
re = pcre_compile(pattern, iFlags, &mError, &mErrorOffset, NULL);
|
||||
|
||||
if (re == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mFree = false;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RegEx::Match(const char *str)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (mFree || re == NULL)
|
||||
return -1;
|
||||
|
||||
this->ClearMatch();
|
||||
|
||||
//save str
|
||||
subject = new char[strlen(str)+1];
|
||||
strcpy(subject, str);
|
||||
|
||||
rc = pcre_exec(re, NULL, subject, (int)strlen(subject), 0, 0, ovector, 30);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
if (rc == PCRE_ERROR_NOMATCH)
|
||||
{
|
||||
return 0;
|
||||
} else {
|
||||
mErrorOffset = rc;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
mSubStrings = rc;
|
||||
|
||||
return 1;
|
||||
}
|
||||
void RegEx::ClearMatch()
|
||||
{
|
||||
// Clears match results
|
||||
mErrorOffset = 0;
|
||||
mError = NULL;
|
||||
if (subject)
|
||||
delete [] subject;
|
||||
subject = NULL;
|
||||
mSubStrings = 0;
|
||||
}
|
||||
|
||||
const char *RegEx::GetSubstring(int s, char buffer[], int max)
|
||||
{
|
||||
int i = 0;
|
||||
if (s >= mSubStrings || s < 0)
|
||||
return NULL;
|
||||
|
||||
char *substr_a = subject + ovector[2*s];
|
||||
int substr_l = ovector[2*s+1] - ovector[2*s];
|
||||
|
||||
for (i = 0; i<substr_l; i++)
|
||||
{
|
||||
if (i >= max)
|
||||
break;
|
||||
buffer[i] = substr_a[i];
|
||||
}
|
||||
|
||||
buffer[i] = '\0';
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
+59
-59
@@ -1,59 +1,59 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SQLite Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_CREGEX_H
|
||||
#define _INCLUDE_CREGEX_H
|
||||
|
||||
class RegEx
|
||||
{
|
||||
public:
|
||||
RegEx();
|
||||
~RegEx();
|
||||
bool isFree(bool set=false, bool val=false);
|
||||
void Clear();
|
||||
|
||||
int Compile(const char *pattern, int iFlags);
|
||||
int Match(const char *str);
|
||||
void ClearMatch();
|
||||
const char *GetSubstring(int s, char buffer[], int max);
|
||||
public:
|
||||
int mErrorOffset;
|
||||
const char *mError;
|
||||
int mSubStrings;
|
||||
private:
|
||||
pcre *re;
|
||||
bool mFree;
|
||||
int ovector[30];
|
||||
char *subject;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CREGEX_H
|
||||
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program 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 General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_CREGEX_H
|
||||
#define _INCLUDE_CREGEX_H
|
||||
|
||||
class RegEx
|
||||
{
|
||||
public:
|
||||
RegEx();
|
||||
~RegEx();
|
||||
bool isFree(bool set=false, bool val=false);
|
||||
void Clear();
|
||||
|
||||
int Compile(const char *pattern, int iFlags);
|
||||
int Match(const char *str);
|
||||
void ClearMatch();
|
||||
const char *GetSubstring(int s, char buffer[], int max);
|
||||
public:
|
||||
int mErrorOffset;
|
||||
const char *mError;
|
||||
int mSubStrings;
|
||||
private:
|
||||
pcre *re;
|
||||
bool mFree;
|
||||
int ovector[30];
|
||||
char *subject;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CREGEX_H
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod Sample Extension
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
@@ -38,7 +38,7 @@ using namespace SourceHook;
|
||||
|
||||
/**
|
||||
* @file extension.cpp
|
||||
* @brief Implement extension code here.
|
||||
* @brief Implement Regex extension code here.
|
||||
*/
|
||||
|
||||
RegexExtension g_RegexExtension; /**< Global singleton for extension's main interface */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod Sample Extension
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
/**
|
||||
* @file extension.h
|
||||
* @brief Sample extension code header.
|
||||
* @brief Regex extension code header.
|
||||
*/
|
||||
|
||||
#include "smsdk_ext.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod Sample Extension
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SQLite Extension
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SQLite Extension
|
||||
* SourceMod Regular Expressions Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user