Modernize sp_vm_basecontext.
This commit is contained in:
parent
1b47aa10ca
commit
45c43f4aee
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,15 @@
|
|||||||
/**
|
// vim: set sts=2 ts=8 sw=2 tw=99 et:
|
||||||
* vim: set ts=4 :
|
//
|
||||||
* =============================================================================
|
// Copyright (C) 2006-2015 AlliedModders LLC
|
||||||
* SourcePawn
|
//
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
// This file is part of SourcePawn. SourcePawn is free software: you can
|
||||||
* =============================================================================
|
// redistribute it and/or modify it under the terms of the GNU General Public
|
||||||
*
|
// License as published by the Free Software Foundation, either version 3 of
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
// the License, or (at your option) any later version.
|
||||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
//
|
||||||
* Free Software Foundation.
|
// You should have received a copy of the GNU General Public License along with
|
||||||
*
|
// SourcePawn. If not, see http://www.gnu.org/licenses/.
|
||||||
* 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_SOURCEPAWN_BASECONTEXT_H_
|
#ifndef _INCLUDE_SOURCEPAWN_BASECONTEXT_H_
|
||||||
#define _INCLUDE_SOURCEPAWN_BASECONTEXT_H_
|
#define _INCLUDE_SOURCEPAWN_BASECONTEXT_H_
|
||||||
|
|
||||||
@ -43,72 +24,76 @@
|
|||||||
|
|
||||||
class BaseContext : public IPluginContext
|
class BaseContext : public IPluginContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BaseContext(BaseRuntime *pRuntime);
|
BaseContext(BaseRuntime *pRuntime);
|
||||||
~BaseContext();
|
~BaseContext();
|
||||||
public: //IPluginContext
|
|
||||||
IVirtualMachine *GetVirtualMachine();
|
public: //IPluginContext
|
||||||
sp_context_t *GetContext();
|
IVirtualMachine *GetVirtualMachine();
|
||||||
sp_context_t *GetCtx();
|
sp_context_t *GetContext();
|
||||||
bool IsDebugging();
|
sp_context_t *GetCtx();
|
||||||
int SetDebugBreak(void *newpfn, void *oldpfn);
|
bool IsDebugging();
|
||||||
IPluginDebugInfo *GetDebugInfo();
|
int SetDebugBreak(void *newpfn, void *oldpfn);
|
||||||
int HeapAlloc(unsigned int cells, cell_t *local_addr, cell_t **phys_addr);
|
IPluginDebugInfo *GetDebugInfo();
|
||||||
int HeapPop(cell_t local_addr);
|
int HeapAlloc(unsigned int cells, cell_t *local_addr, cell_t **phys_addr);
|
||||||
int HeapRelease(cell_t local_addr);
|
int HeapPop(cell_t local_addr);
|
||||||
int FindNativeByName(const char *name, uint32_t *index);
|
int HeapRelease(cell_t local_addr);
|
||||||
int GetNativeByIndex(uint32_t index, sp_native_t **native);
|
int FindNativeByName(const char *name, uint32_t *index);
|
||||||
uint32_t GetNativesNum();
|
int GetNativeByIndex(uint32_t index, sp_native_t **native);
|
||||||
int FindPublicByName(const char *name, uint32_t *index);
|
uint32_t GetNativesNum();
|
||||||
int GetPublicByIndex(uint32_t index, sp_public_t **publicptr);
|
int FindPublicByName(const char *name, uint32_t *index);
|
||||||
uint32_t GetPublicsNum();
|
int GetPublicByIndex(uint32_t index, sp_public_t **publicptr);
|
||||||
int GetPubvarByIndex(uint32_t index, sp_pubvar_t **pubvar);
|
uint32_t GetPublicsNum();
|
||||||
int FindPubvarByName(const char *name, uint32_t *index);
|
int GetPubvarByIndex(uint32_t index, sp_pubvar_t **pubvar);
|
||||||
int GetPubvarAddrs(uint32_t index, cell_t *local_addr, cell_t **phys_addr);
|
int FindPubvarByName(const char *name, uint32_t *index);
|
||||||
uint32_t GetPubVarsNum();
|
int GetPubvarAddrs(uint32_t index, cell_t *local_addr, cell_t **phys_addr);
|
||||||
int LocalToPhysAddr(cell_t local_addr, cell_t **phys_addr);
|
uint32_t GetPubVarsNum();
|
||||||
int LocalToString(cell_t local_addr, char **addr);
|
int LocalToPhysAddr(cell_t local_addr, cell_t **phys_addr);
|
||||||
int StringToLocal(cell_t local_addr, size_t chars, const char *source);
|
int LocalToString(cell_t local_addr, char **addr);
|
||||||
int StringToLocalUTF8(cell_t local_addr, size_t maxbytes, const char *source, size_t *wrtnbytes);
|
int StringToLocal(cell_t local_addr, size_t chars, const char *source);
|
||||||
int PushCell(cell_t value);
|
int StringToLocalUTF8(cell_t local_addr, size_t maxbytes, const char *source, size_t *wrtnbytes);
|
||||||
int PushCellArray(cell_t *local_addr, cell_t **phys_addr, cell_t array[], unsigned int numcells);
|
int PushCell(cell_t value);
|
||||||
int PushString(cell_t *local_addr, char **phys_addr, const char *string);
|
int PushCellArray(cell_t *local_addr, cell_t **phys_addr, cell_t array[], unsigned int numcells);
|
||||||
int PushCellsFromArray(cell_t array[], unsigned int numcells);
|
int PushString(cell_t *local_addr, char **phys_addr, const char *string);
|
||||||
int BindNatives(const sp_nativeinfo_t *natives, unsigned int num, int overwrite);
|
int PushCellsFromArray(cell_t array[], unsigned int numcells);
|
||||||
int BindNative(const sp_nativeinfo_t *native);
|
int BindNatives(const sp_nativeinfo_t *natives, unsigned int num, int overwrite);
|
||||||
int BindNativeToAny(SPVM_NATIVE_FUNC native);
|
int BindNative(const sp_nativeinfo_t *native);
|
||||||
int Execute(uint32_t code_addr, cell_t *result);
|
int BindNativeToAny(SPVM_NATIVE_FUNC native);
|
||||||
cell_t ThrowNativeErrorEx(int error, const char *msg, ...);
|
int Execute(uint32_t code_addr, cell_t *result);
|
||||||
cell_t ThrowNativeError(const char *msg, ...);
|
cell_t ThrowNativeErrorEx(int error, const char *msg, ...);
|
||||||
IPluginFunction *GetFunctionByName(const char *public_name);
|
cell_t ThrowNativeError(const char *msg, ...);
|
||||||
IPluginFunction *GetFunctionById(funcid_t func_id);
|
IPluginFunction *GetFunctionByName(const char *public_name);
|
||||||
SourceMod::IdentityToken_t *GetIdentity();
|
IPluginFunction *GetFunctionById(funcid_t func_id);
|
||||||
cell_t *GetNullRef(SP_NULL_TYPE type);
|
SourceMod::IdentityToken_t *GetIdentity();
|
||||||
int LocalToStringNULL(cell_t local_addr, char **addr);
|
cell_t *GetNullRef(SP_NULL_TYPE type);
|
||||||
int BindNativeToIndex(uint32_t index, SPVM_NATIVE_FUNC native);
|
int LocalToStringNULL(cell_t local_addr, char **addr);
|
||||||
int Execute2(IPluginFunction *function, const cell_t *params, unsigned int num_params, cell_t *result);
|
int BindNativeToIndex(uint32_t index, SPVM_NATIVE_FUNC native);
|
||||||
IPluginRuntime *GetRuntime();
|
int Execute2(IPluginFunction *function, const cell_t *params, unsigned int num_params, cell_t *result);
|
||||||
int GetLastNativeError();
|
IPluginRuntime *GetRuntime();
|
||||||
cell_t *GetLocalParams();
|
int GetLastNativeError();
|
||||||
void SetKey(int k, void *value);
|
cell_t *GetLocalParams();
|
||||||
bool GetKey(int k, void **value);
|
void SetKey(int k, void *value);
|
||||||
void Refresh();
|
bool GetKey(int k, void **value);
|
||||||
void ClearLastNativeError();
|
void Refresh();
|
||||||
public:
|
void ClearLastNativeError();
|
||||||
bool IsInExec();
|
|
||||||
private:
|
public:
|
||||||
void SetErrorMessage(const char *msg, va_list ap);
|
bool IsInExec();
|
||||||
void _SetErrorMessage(const char *msg, ...);
|
|
||||||
private:
|
private:
|
||||||
cell_t *m_pNullVec;
|
void SetErrorMessage(const char *msg, va_list ap);
|
||||||
cell_t *m_pNullString;
|
void _SetErrorMessage(const char *msg, ...);
|
||||||
char m_MsgCache[1024];
|
|
||||||
bool m_CustomMsg;
|
private:
|
||||||
bool m_InExec;
|
cell_t *m_pNullVec;
|
||||||
BaseRuntime *m_pRuntime;
|
cell_t *m_pNullString;
|
||||||
sp_context_t m_ctx;
|
char m_MsgCache[1024];
|
||||||
void *m_keys[4];
|
bool m_CustomMsg;
|
||||||
bool m_keys_set[4];
|
bool m_InExec;
|
||||||
|
BaseRuntime *m_pRuntime;
|
||||||
|
sp_context_t m_ctx;
|
||||||
|
void *m_keys[4];
|
||||||
|
bool m_keys_set[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEPAWN_BASECONTEXT_H_
|
#endif //_INCLUDE_SOURCEPAWN_BASECONTEXT_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user