extensions/bintools/CallMaker.cpp
changeset 739 d22243bb5864
child 740 04a39f9db33c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/bintools/CallMaker.cpp	Fri May 04 21:39:05 2007 +0000
     1.3 @@ -0,0 +1,52 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ===============================================================
     1.7 + * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC. 
     1.8 + * All rights reserved.
     1.9 + * ===============================================================
    1.10 + *
    1.11 + *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be 
    1.12 + * used or modified under the Terms and Conditions of its License Agreement, 
    1.13 + * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative 
    1.14 + * works must be licensed under the GNU General Public License (version 2 or 
    1.15 + * greater).  A copy of the GPL is included under public/licenses/GPL.txt.
    1.16 + * 
    1.17 + * To view the latest information, see: http://www.sourcemod.net/license.php
    1.18 + *
    1.19 + * Version: $Id$
    1.20 + */
    1.21 +
    1.22 +#include "CallMaker.h"
    1.23 +#include "CallWrapper.h"
    1.24 +#include "jit_call.h"
    1.25 +
    1.26 +ICallWrapper *CallMaker::CreateCall(void *address,
    1.27 +						 CallConvention cv,
    1.28 +						 const PassInfo *retInfo,
    1.29 +						 const PassInfo paramInfo[],
    1.30 +						 unsigned int numParams)
    1.31 +{
    1.32 +	CallWrapper *pWrapper = new CallWrapper(cv, paramInfo, retInfo, numParams);
    1.33 +	pWrapper->m_Addrs[ADDR_CALLEE] = address;
    1.34 +
    1.35 +	JIT_Compile(pWrapper, FuncAddr_Direct);
    1.36 +
    1.37 +	return pWrapper;
    1.38 +}
    1.39 +
    1.40 +ICallWrapper *CallMaker::CreateVCall(unsigned int vtblIdx, 
    1.41 +									 unsigned int vtblOffs, 
    1.42 +									 unsigned int thisOffs, 
    1.43 +									 const PassInfo *retInfo, 
    1.44 +									 const PassInfo paramInfo[], 
    1.45 +									 unsigned int numParams)
    1.46 +{
    1.47 +	CallWrapper *pWrapper = new CallWrapper(CallConv_ThisCall, paramInfo, retInfo, numParams);
    1.48 +	pWrapper->m_VtInfo.thisOffs = thisOffs;
    1.49 +	pWrapper->m_VtInfo.vtblIdx = vtblIdx;
    1.50 +	pWrapper->m_VtInfo.vtblOffs = vtblOffs;
    1.51 +
    1.52 +	JIT_Compile(pWrapper, FuncAddr_VTable);
    1.53 +
    1.54 +	return pWrapper;
    1.55 +}
    1.56 \ No newline at end of file