added amb260

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40756
This commit is contained in:
David Anderson 2007-05-07 00:02:33 +00:00
parent 67a0cdf1c3
commit e69edf05eb
2 changed files with 31 additions and 0 deletions

View File

@ -637,6 +637,25 @@ static cell_t smn_KvSetEscapeSequences(IPluginContext *pCtx, const cell_t *param
return 1;
}
static cell_t smn_KvNodesInStack(IPluginContext *pCtx, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError herr;
HandleSecurity sec;
KeyValueStack *pStk;
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
}
return pStk->pCurRoot.size();
}
static cell_t smn_KvDeleteThis(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
@ -731,5 +750,6 @@ REGISTER_NATIVES(keyvaluenatives)
{"KvSetEscapeSequences", smn_KvSetEscapeSequences},
{"KvDeleteThis", smn_KvDeleteThis},
{"KvDeleteKey", smn_KvDeleteKey},
{"KvNodesInStack", smn_KvNodesInStack},
{NULL, NULL}
};

View File

@ -298,3 +298,14 @@ native bool:FileToKeyValues(Handle:kv, const String:file[]);
* @error Invalid Handle.
*/
native KvSetEscapeSequences(Handle:kv, bool:useEscapes);
/**
* Returns the position in the jump stack; I.e. the number of calls
* required for KvGoBack to return to the root node. If at the root node,
* 0 is returned.
*
* @param kv KeyValues Handle.
* @return Number of non-root nodes in the jump stack.
* @error Invalid Handle.
*/
native KvNodesInStack(Handle:kv);