Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

VXIjsiInterface Struct Reference
[ECMAScript Interface]

#include <VXIjsi.h>

List of all members.


Detailed Description

Abstract interface for interacting with a ECMAScript (JavaScript) engine.

This provides functionality for creating ECMAScript execution contexts, manipulating ECMAScript scopes, manipulating variables within those scopes, and evaluating ECMAScript expressions/scripts.

There is one ECMAScript interface per thread/line.


Public Attributes

VXIint32(* GetVersion )(void)
 Get the VXI interface version implemented.
const VXIchar *(* GetImplementationName )(void)
 Get the name of the implementation.
VXIjsiResult(* CreateContext )(struct VXIjsiInterface *pThis, VXIjsiContext **context)
 Create and initialize a new script context.
VXIjsiResult(* DestroyContext )(struct VXIjsiInterface *pThis, VXIjsiContext **context)
 Destroy a script context, clean up storage if required.
VXIjsiResult(* CreateVarExpr )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIchar *expr)
 Create a script variable relative to the current scope, initialized to an expression.
VXIjsiResult(* CreateVarValue )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIValue *value)
 Create a script variable relative to the current scope, initialized to a VXIValue based value.
VXIjsiResult(* SetVarExpr )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIchar *expr)
 Set a script variable to an expression relative to the current scope.
VXIjsiResult(* SetVarDOM )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, VXIPtr *doc)
 Set a script variable to a DOMDocument relative to the current scope.
VXIjsiResult(* SetReadOnly )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name)
 set a script variable read-only to the current scope
VXIjsiResult(* SetVarValue )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIValue *value)
 Set a script variable to a value relative to the current scope.
VXIjsiResult(* GetVar )(struct VXIjsiInterface *pThis, const VXIjsiContext *context, const VXIchar *name, VXIValue **value)
 Get the value of a variable.
VXIjsiResult(* CheckVar )(struct VXIjsiInterface *pThis, const VXIjsiContext *context, const VXIchar *name)
 Check whether a variable is defined (not ECMAScript Undefined).
VXIjsiResult(* Eval )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *expr, VXIValue **result)
 Execute a script, optionally returning any execution result.
VXIjsiResult(* PushScope )(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIjsiScopeAttr attr)
 Push a new context onto the scope chain (add a nested scope).
VXIjsiResult(* PopScope )(struct VXIjsiInterface *pThis, VXIjsiContext *context)
 Pop a context from the scope chain (remove a nested scope).
VXIjsiResult(* ClearScopes )(struct VXIjsiInterface *pThis, VXIjsiContext *context)
 Reset the scope chain to the global scope (pop all nested scopes).
const VXIMap *(* GetLastError )(struct VXIjsiInterface *pThis, VXIjsiContext *context)
 Returns a VXIMap containing info on the last error.


Member Data Documentation

VXIjsiResult(* VXIjsiInterface::CheckVar)(struct VXIjsiInterface *pThis, const VXIjsiContext *context, const VXIchar *name)
 

Check whether a variable is defined (not ECMAScript Undefined).

NOTE: A variable with a ECMAScript Null value is considered defined

Parameters:
context [IN] ECMAScript context to check the variable in
name [IN] Name of the variable to check
Returns:
VXIjsi_RESULT_SUCCESS on success (variable is defined), VXIjsi_RESULT_FAILURE if the variable has value undefined, VXIjsi_RESULT_NON_FATAL_ERROR if the variable does not exist, or another error code for severe errors

VXIjsiResult(* VXIjsiInterface::ClearScopes)(struct VXIjsiInterface *pThis, VXIjsiContext *context)
 

Reset the scope chain to the global scope (pop all nested scopes).

Parameters:
context [IN] ECMAScript context to pop the scopes from
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::CreateContext)(struct VXIjsiInterface *pThis, VXIjsiContext **context)
 

Create and initialize a new script context.

This creates a new context. Currently one context is created per thread, but the implementation must support the ability to have multiple contexts per thread.

Parameters:
context [OUT] Newly created context
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::CreateVarExpr)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIchar *expr)
 

Create a script variable relative to the current scope, initialized to an expression.

NOTE: When there is an expression, the expression is evaluated, then the value of the evaluated expression (the final sub-expression) assigned. Thus an expression of "1; 2;" actually assigns 2 to the variable.

Parameters:
context [IN] ECMAScript context to create the variable within
name [IN] Name of the variable to create
expr [IN] Expression to set the initial value of the variable (if NULL or empty the variable is set to ECMAScript Undefined as required for VoiceXML 1.0 <var>)
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::CreateVarValue)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIValue *value)
 

Create a script variable relative to the current scope, initialized to a VXIValue based value.

Parameters:
context [IN] ECMAScript context to create the variable within
name [IN] Name of the variable to create
value [IN] VXIValue based value to set the initial value of the variable (if NULL the variable is set to ECMAScript Undefined as required for VoiceXML 1.0 <var>). VXIMap is used to pass ECMAScript objects.
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::DestroyContext)(struct VXIjsiInterface *pThis, VXIjsiContext **context)
 

Destroy a script context, clean up storage if required.

Parameters:
context [IN] Context to destroy
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::Eval)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *expr, VXIValue **result)
 

Execute a script, optionally returning any execution result.

Parameters:
context [IN] ECMAScript context to execute within
expr [IN] Buffer containing the script text
value [OUT] Result of the script execution, returned as the VXI type that most closely matches the variable's ECMAScript 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 ECMAScript objects.
Returns:
VXIjsi_RESULT_SUCCESS on success

const VXIchar*(* VXIjsiInterface::GetImplementationName)(void)
 

Get the name of the implementation.

Returns:
Implementation defined string that must be different from all other implementations. The recommended name is one where the interface name is prefixed by the implementator's Internet address in reverse order, such as com.xyz.rec for VXIrec from xyz.com. This is similar to how VoiceXML 1.0 recommends defining application specific error types.

const VXIMap*(* VXIjsiInterface::GetLastError)(struct VXIjsiInterface *pThis, VXIjsiContext *context)
 

Returns a VXIMap containing info on the last error.

The returned map is only valid if a previous call resulted in an error. Additionally, the map may be destroyed when the the next call happens, so shoul not be retained.

Keys:
lineNumber
message

Returns:
VXIMap containing error information, or NULL.

VXIjsiResult(* VXIjsiInterface::GetVar)(struct VXIjsiInterface *pThis, const VXIjsiContext *context, const VXIchar *name, VXIValue **value)
 

Get the value of a variable.

Parameters:
context [IN] ECMAScript context to get the variable from
name [IN] Name of the variable to get
value [OUT] Value of the variable, returned as the VXI type that most closely matches the variable's ECMAScript 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 ECMAScript objects.
Returns:
VXIjsi_RESULT_SUCCESS on success, VXIjsi_RESULT_FAILURE if the variable has a ECMAScript value of Null, VXIjsi_RESULT_NON_FATAL_ERROR if the variable is not defined (ECMAScript Undefined), or another error code for severe errors

VXIint32(* VXIjsiInterface::GetVersion)(void)
 

Get the VXI interface version implemented.

Returns:
VXIint32 for the version number. The high high word is the major version number, the low word is the minor version number, using the native CPU/OS byte order. The current version is VXI_CURRENT_VERSION as defined in VXItypes.h.

VXIjsiResult(* VXIjsiInterface::PopScope)(struct VXIjsiInterface *pThis, VXIjsiContext *context)
 

Pop a context from the scope chain (remove a nested scope).

Parameters:
context [IN] ECMAScript context to pop the scope from
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::PushScope)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIjsiScopeAttr attr)
 

Push a new context onto the scope chain (add a nested scope).

Parameters:
context [IN] ECMAScript context to push the scope onto
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"
attr [IN] Attribute that defines how the scope will be pushed. The possible values are: VXIjsi_NATIVE_SCOPE: create a real scope and link to the scope chain VXIjsi_ALIAS_SCOPE: create an alias for the currently active scope. If PopScope() is called later it will be an NO-OP
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::SetReadOnly)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name)
 

set a script variable read-only to the current scope

Parameters:
context [IN] ECMAScript context in which the variable has been created
name [IN] Name of the variable to set as read only.
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::SetVarDOM)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, VXIPtr *doc)
 

Set a script variable to a DOMDocument relative to the current scope.

NOTE: Implementors must be aware of the exact contents of the VXIPtr passed by the interpreter. i.e., If the interpreter uses a Xerces DOMDocument, so must the implementation of this interface.

Parameters:
context [IN] ECMAScript context to set the variable within
name [IN] Name of the variable to set
doc [IN] DOMDocument to be assigned. The implementation must not delete the contained pointer, as it is owned by the interpreter.
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::SetVarExpr)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIchar *expr)
 

Set a script variable to an expression relative to the current scope.

NOTE: The expression is evaluated, then the value of the evaluated expression (the final sub-expression) assigned. Thus an expression of "1; 2;" actually assigns 2 to the variable.

Parameters:
context [IN] ECMAScript context to set the variable within
name [IN] Name of the variable to set
expr [IN] Expression to be assigned
Returns:
VXIjsi_RESULT_SUCCESS on success

VXIjsiResult(* VXIjsiInterface::SetVarValue)(struct VXIjsiInterface *pThis, VXIjsiContext *context, const VXIchar *name, const VXIValue *value)
 

Set a script variable to a value relative to the current scope.

Parameters:
context [IN] ECMAScript context to set the variable within
name [IN] Name of the variable to set
value [IN] VXIValue based value to be assigned. VXIMap is used to pass ECMAScript objects.
Returns:
VXIjsi_RESULT_SUCCESS on success


The documentation for this struct was generated from the following file:
Generated on Wed Jun 1 12:50:19 2005 for OpenVXI by  doxygen 1.4.2