⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sbjsifuncs.cpp

📁 sloedgy open sip stack source code
💻 CPP
📖 第 1 页 / 共 2 页
字号:
  *
  * @result VXIjsiResult 0 on success 
  */
 extern "C"
 VXIjsiResult SBjsiSetVarExpr(VXIjsiInterface        *pThis,
 			     VXIjsiContext          *context, 
 			     const VXIchar          *name, 
 			     const VXIchar          *expr)
 {
   static const wchar_t func[] = L"SBjsiSetVarExpr";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, 
 			     L"entering: 0x%p, '%s', '%s'", 
 			     context, name, expr);
 
   rc = context->jsiContext->SetVar (name, expr);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }
 
   
 /**
  * Set a script variable to a value relative to the current scope
  *
  * @param context  [IN] JavaScript context to set the variable within
  * @param name     [IN] Name of the variable to set
  * @param value    [IN] VXIValue based value to be assigned. VXIMap is 
  *                      used to pass JavaScript objects.
  *
  * @result VXIjsiResult 0 on success 
  */
 extern "C"
 VXIjsiResult SBjsiSetVarValue(VXIjsiInterface        *pThis,
 			      VXIjsiContext          *context, 
 			      const VXIchar          *name, 
 			      const VXIValue         *value)
 {
   static const wchar_t func[] = L"SBjsiSetVarValue";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, 
 			     L"entering: 0x%p, '%s', 0x%p", 
 			     context, name, value);
 
   rc = context->jsiContext->SetVar (name, value);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }
 
 
 /**
  * Get the value of a variable
  *
  * @param context  [IN]  JavaScript context to get the variable from
  * @param name     [IN]  Name of the variable to get
  * @param value    [OUT] Value of the variable, returned as the VXI
  *                       type that most closely matches the variable's
  *                       JavaScript type. This function allocates this
  *                       for return on success (returns a NULL pointer
  *                       otherwise), the caller is responsible for
  *                       destroying it via VXIValueDestroy( ). VXIMap
  *                       is used to return JavaScript objects.
  *
  * @result VXIjsiResult 0 on success, VXIjsi_RESULT_FAILURE if the
  *         variable has a JavaScript value of Null,
  *         VXIjsi_RESULT_NON_FATAL_ERROR if the variable is not
  *         defined (JavaScript Undefined), or another error code for
  *         severe errors 
  */
 extern "C"
 VXIjsiResult SBjsiGetVar(VXIjsiInterface         *pThis,
 			 const VXIjsiContext     *context, 
 			 const VXIchar           *name,
 			 VXIValue               **value)
 {
   static const wchar_t func[] = L"SBjsiGetVar";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, 
 			     L"entering: 0x%p, '%s', 0x%p", 
 			     context, name, value);
 
   rc = context->jsiContext->GetVar (name, value);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, 
 			     L"exiting: returned %d, 0x%p (0x%p)",
 			     rc, value, (value ? *value : NULL));
   return rc;
 }
 
 
 /**
  * Check whether a variable is defined (not JavaScript Undefined)
  *
  * NOTE: A variable with a JavaScript Null value is considered defined
  *
  * @param context  [IN]  JavaScript context to check the variable in
  * @param name     [IN]  Name of the variable to check
  *
  * @result VXIjsiResult 0 on success (variable is defined),
  *         VXIjsi_RESULT_FAILURE if the variable is not defined,
  *         or another error code for severe errors
  */
 extern "C"
 VXIjsiResult SBjsiCheckVar(VXIjsiInterface        *pThis,
 			   const VXIjsiContext    *context, 
 			   const VXIchar          *name)
 {
   static const wchar_t func[] = L"SBjsiCheckVar";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"entering: 0x%p, '%s'",
 			     context, name);
 
   rc = context->jsiContext->CheckVar (name);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }
 
 
 /**
   * set a script variable read-only to the current scope
   *  
   * @param context  [IN] ECMAScript context in which the variable
   *                      has been created
   * @param name     [IN] Name of the variable to set as read only.
   *
   * @return VXIjsi_RESULT_SUCCESS on success
   */
 extern "C"
 VXIjsiResult SBjsiSetReadOnly(struct VXIjsiInterface *pThis,
                              VXIjsiContext    *context,
                              const VXIchar          *name)
 {
 
   static const wchar_t func[] = L"SBjsiSetReadOnly";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"entering: 0x%p, '%s'",
 			     context, name);
 
   rc = context->jsiContext->SetReadOnly(name);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }                          
 
 /**
  * Execute a script, optionally returning any execution result
  *
  * @param context  [IN]  JavaScript context to execute within
  * @param expr     [IN]  Buffer containing the script text
  * @param value    [OUT] Result of the script execution, returned 
  *                       as the VXI type that most closely matches 
  *                       the variable's JavaScript type. Pass NULL
  *                       if the result is not desired. Otherwise
  *                       this function allocates this for return on 
  *                       success when there is a return value (returns 
  *                       a NULL pointer otherwise), the caller is 
  *                       responsible for destroying it via 
  *                       VXIValueDestroy( ). VXIMap is used to return 
  *                       JavaScript objects.
  *
  * @result VXIjsiResult 0 on success
  */
 extern "C"
 VXIjsiResult SBjsiEval(VXIjsiInterface         *pThis,
 		       VXIjsiContext           *context,
 		       const VXIchar           *expr,
 		       VXIValue               **result)
 {
   static const wchar_t func[] = L"SBjsiEval";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, 
 			     L"entering: 0x%p, '%s', 0x%p", 
 			     context, expr, result);
 
   rc = context->jsiContext->Eval (expr, result);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, 
 			     L"exiting: returned %d, 0x%p (0x%p)", 
 			     rc, result, (result ? *result : NULL));
   return rc;
 }
 
 
 /**
  * Push a new context onto the scope chain (add a nested scope)
  * @param context  [IN] JavaScript context to push the scope onto
  * @param name     [IN] Name of the scope, used to permit referencing
  *                      variables from an explicit scope within the
  *                      scope chain, such as "myscope.myvar" to access
  *                      "myvar" within a scope named "myscope"
  *
  * @result VXIjsiResult 0 on success
  */
 extern "C"
 VXIjsiResult SBjsiPushScope(VXIjsiInterface        *pThis,
 			    VXIjsiContext          *context,
 			    const VXIchar          *name,
 			    const VXIjsiScopeAttr  attr)
 {
   static const wchar_t func[] = L"SBjsiPushScope";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"entering: 0x%p, '%s'",
 			     context, name);
 
   rc = context->jsiContext->PushScope (name, attr);
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }
 
 /**
  * Pop a context from the scope chain (remove a nested scope)
  *
  * @param context  [IN] JavaScript context to pop the scope from
  *
  * @result VXIjsiResult 0 on success
  */
 extern "C"
 VXIjsiResult SBjsiPopScope(VXIjsiInterface        *pThis,
 			   VXIjsiContext          *context)
 {
   static const wchar_t func[] = L"SBjsiPopScope";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"entering: 0x%p", context);
 
   rc = context->jsiContext->PopScope( );
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }
 
 
 /**
  * Reset the scope chain to the global scope (pop all nested scopes)
  *
  * @param context  [IN] JavaScript context to pop the scopes from
  *
  * @result VXIjsiResult 0 on success
  */
 extern "C"
 VXIjsiResult SBjsiClearScopes(VXIjsiInterface        *pThis,
 			      VXIjsiContext          *context)
 {
   static const wchar_t func[] = L"SBjsiClearScopes";
   GET_SBJSI (pThis, context, rc);
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"entering: 0x%p", context);
 
   rc = context->jsiContext->ClearScopes( );
 
   context->jsiContext->Diag (SBJSI_LOG_API, func, L"exiting: returned %d", rc);
   return rc;
 }

#endif


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -