367 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			367 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| compile insert rti_AXSH_Equates
 | |
| /*
 | |
|    ** Copyright (C) 1992-2019 Revelation Software Inc. All Rights Reserved **
 | |
|    
 | |
|    Author   : Captain C
 | |
|    Date     : March 2017
 | |
|    Purpose  : Constants for use with the ActiveX Scripting Host function in
 | |
|             : RevAXSH.dll
 | |
|    
 | |
|    Comments
 | |
|    ========
 | |
|    
 | |
|    Amended  Date        Reason
 | |
|    =======  ====        ======
 | |
|    Mr C     14 Mar 19   Documentation update
 | |
|    Mr C     30 Mar 17   Documentation update
 | |
|    Mr C     29 Mar 17   Added RevEx and AddObject methods
 | |
| 
 | |
| */
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| #ifndef _RTI_AXSH_EQUATES_
 | |
| #define _RTI_AXSH_EQUATES_
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
|    declare function rti_AXSH
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
|    // Return error codes
 | |
|    
 | |
|    equ REVAXSH_SUCCESS$                      to 0
 | |
|    equ REVAXSH_ERR_BAD_METHOD$               to -1;
 | |
|    equ REVJSON_ERR_NULL_RET_AXSH$            to -2;
 | |
|    equ REVAXSH_ERR_NO_LANG$                  to -3;
 | |
|    equ REVAXSH_ERR_SCRIPT_INIT$              to -4;
 | |
|    equ REVAXSH_ERR_SET_SITE$                 to -5;
 | |
|    equ REVAXSH_ERR_GET_PARSER$               to -6;
 | |
|    equ REVAXSH_ERR_PARSER_INIT$              to -7;
 | |
|    equ REVAXSH_ERR_NULL_HANDLE$              to -8;
 | |
|    equ REVAXSH_ERR_BAD_HANDLE$               to -9;
 | |
|    equ REVAXSH_ERR_NULL_SIZE$                to -10;
 | |
|    equ REVAXSH_ERR_NULL_BUFFER$              to -11;
 | |
|    equ REVAXSH_ERR_BUFFER_SIZE$              to -12;
 | |
|    equ REVAXSH_ERR_BUFFER_TOO_SMALL$         to -13;
 | |
|    equ REVAXSH_ERR_BAD_PROP_NAME$            to -14;
 | |
|    equ REVAXSH_ERR_NULL_RET_SIZE$            to -15;
 | |
|    equ REVAXSH_ERR_NULL_STATEMENT$           to -16;
 | |
|    equ REVAXSH_ERR_EVAL$                     to -17;
 | |
|    equ REVAXSH_ERR_CATINFO$                  to -18;
 | |
|    equ REVAXSH_ERR_IDISPATCH$                to -19;
 | |
|    equ REVAXSH_ERR_BAD_SCRIPT_MTD$           to -20;
 | |
|    equ REVAXSH_ERR_OUT_OF_MEM$               to -21;
 | |
|    equ REVAXSH_ERR_NULL_OBJ_NAME$            to -22;
 | |
|    equ REVAXSH_ERR_NULL_OBJ_IDISP$           to -23;
 | |
|    equ REVAXSH_ERR_STDEXCEPTION$             to -99;
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
|    // Method IDs
 | |
|    
 | |
|    equ REVAXSH_MTD_CREATE$                   to 1;
 | |
|    equ REVAXSH_MTD_DESTROY$                  to 2;
 | |
|    equ REVAXSH_MTD_GETPROP$                  to 3;
 | |
|    equ REVAXSH_MTD_SETPROP$                  to 4;
 | |
|    equ REVAXSH_MTD_ADDCODE$                  to 5;
 | |
|    equ REVAXSH_MTD_EVAL$                     to 6;
 | |
|    equ REVAXSH_MTD_EXECUTE$                  to 7;
 | |
|    equ REVAXSH_MTD_RUN$                      to 8;
 | |
|    equ REVAXSH_MTD_GETENGINES$               to 9;
 | |
|    equ REVAXSH_MTD_ADDOBJECT$                to 10;
 | |
|    equ REVAXSH_MTD_RUNEX$                    to 11;
 | |
|    equ REVAXSH_MTD_GETRETVAL$                to 99;
 | |
|    
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_CREATE$
 | |
| //
 | |
| // Creates an ActiveX scripting host instance and returns it's handle.
 | |
| //
 | |
| // The instance is initialised with the following information:
 | |
| //
 | |
| //    <1> Script Language (required)
 | |
| //    <2> AllowUI (1/0)
 | |
| //    <3> hwndSite
 | |
| //    <4> Timeout in milliseconds (-1 == no Timeout, otherwise > 0)
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    createParam = "jScript" : @fm : TRUE$ : @fm : @@window->handle
 | |
| //    hAXSH = rti_AXSH( REVAXSH_MTD_CREATE$, createParam )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   createParam : an @fm delimited dynamic array as specified   [required]
 | |
| //                   : above.
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] The handle of the new AXSH instance of successful, otherwise "0".
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status()
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
|    // CreateParam constants
 | |
|    equ REVAXSH_CREATE_POS_LANGUAGE$          to 1
 | |
|    equ REVAXSH_CREATE_POS_ALLOWUI$           to 2
 | |
|    equ REVAXSH_CREATE_POS_HWNDSITE$          to 3
 | |
|    equ REVAXSH_CREATE_POS_TIMEOUT$           to 4
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_DESTROY$
 | |
| // 
 | |
| // Destroys a script host instance.
 | |
| //
 | |
| //    call rti_AXSH( REVAXSH_MTD_DESTROY$, hAXSH )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH : Handle of the scripting host to destroy             [required]
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status()
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_GETPROP$
 | |
| //
 | |
| // Returns the value of a specified property
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    propName = REVAXSH_PROP_LANGAUGE$
 | |
| //    language = rti_AXSH( REVAXSH_MTD_GETPROP$, hAXSH, propName  )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH    : Handle of the scripting host to access           [required]
 | |
| // [i]   propName : Name of the property to access                   [required]
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] The property value
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status()
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
|    // Supported properties:
 | |
|    equ REVAXSH_PROP_LANGAUGE$                to "Language"  // Get
 | |
|    equ REXAXSH_PROP_ALLOWUI$                 to "AllowUI"   // Get/Set
 | |
|    equ REXAXSH_PROP_SITEHWND$                to "SiteHwnd"  // Get/Set
 | |
|    equ REXAXSH_PROP_TIMEOUT$                 to "Timeout"   // Get/Set
 | |
|    
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_SETPROP$
 | |
| //
 | |
| // Sets the value of a specified property
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    propName  = REVAXSH_PROP_ALLOWUI$
 | |
| //    propValue = FALSE$ 
 | |
| //    call rti_AXSH( REVAXSH_MTD_SETPROP$, hAXSH, propName, propValue )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH     : Handle of the scripting host to access          [required]
 | |
| // [i]   propName  : Name of the property to access                  [required]
 | |
| // [i]   propValue : New property value to set. 
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] N/a
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status()
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_ADDOBJECT$
 | |
| //
 | |
| // Adds a global named object to the scripting host
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    objName = "MyXmlDoc"
 | |
| //    objDoc  = OleCreateInstance( "Msxml2.DOMDocument" )
 | |
| //    call rti_AXSH( REVAXSH_MTD_ADDOBJECT$, hAXSH, objName, objDoc )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH   : Handle of the scripting host to access            [required]
 | |
| // [i]   objName : "Script name" of the object being added           [required]
 | |
| // [i]   oleVar  : OLE object being added                            [required]
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] N/a
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
|    
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_ADDCODE$
 | |
| //
 | |
| // Adds a block of code to the scripting host (Any immediate code will be 
 | |
| // executed as normal)
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    scriptCode = "function add( a, b ) { return a + b; }"
 | |
| //    call rti_AXSH( REVAXSH_MTD_ADDCODE$, hAXSH, scriptCode )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH      : Handle of the scripting host to access         [required]
 | |
| // [i]   scriptCode : Code to add.                                   [required]
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] N/a
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_EVAL$
 | |
| //
 | |
| // Evaluates a statement and returns the result.
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    statement = "3+10;"
 | |
| //    retVal = rti_AXSH( REVAXSH_MTD_EVAL$, hAXSH, statement )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH     : Handle of the scripting host to access          [required]
 | |
| // [i]   statement : Code to evaluate.                               [required]
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] The result of the evaluation.
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_EXECUTE$
 | |
| //
 | |
| // Executes one or more statements (no result is returned)
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    scriptCode = "function add10( a, b ) { return a + 10; }; add10( 3 );"
 | |
| //    call rti_AXSH( REVAXSH_MTD_EXECUTE$, hAXSH, scriptCode )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH     : Handle of the scripting host to access          [required]
 | |
| // [i]   statement : Code to execute.                                [required]
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] N/a
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_RUN$
 | |
| //
 | |
| // Executes a specific script function and returns the result (if any).
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    scriptCode = "function add( a, b ) { return a + b; }"
 | |
| //    call rti_AXSH( REVAXSH_MTD_ADDCODE$, hAXSH, scriptCode )
 | |
| //
 | |
| //    method = "add"
 | |
| //    args   = 3 : @rm : 4
 | |
| //    retVal = rti_AXSH( REVAXSH_MTD_RUN$, hAXSH, method, args )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH  : Handle of the scripting host to access              [required]
 | |
| // [i]   method : name of the function to execute                     [required]
 | |
| // [i]   args   : @rm'd list of arguments to pass to the function.
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] Return value from the function (if any)
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_RUNEX$
 | |
| //
 | |
| // Executes a specific script function and returns the result (if any), allowing
 | |
| // the script function parameters to be passed as separate arguments (This 
 | |
| // method is the only method that can pass OLE objects to a script function)
 | |
| //
 | |
| // The maximum number of parameters that can be passed is 10.  Note that this
 | |
| // method  stops looking for script function arguments when it encounters the 
 | |
| // first unassigned one.
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //    scriptCode = "function add( a, b ) { return a + b; }"
 | |
| //    call rti_AXSH( REVAXSH_MTD_ADDCODE$, hAXSH, scriptCode )
 | |
| //
 | |
| //    method = "add"
 | |
| //    arg1   = 3
 | |
| //    arg2   = 4
 | |
| //    retVal = rti_AXSH( REVAXSH_MTD_RUN$, hAXSH, method, arg1, arg2 )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [i]   hAXSH  : Handle of the scripting host to access             [required]
 | |
| // [i]   method : name of the function to execute                    [required]
 | |
| // [i]   arg1   : First parameter to pass to the function
 | |
| // [i]   arg2   : Second parameter to pass to the function
 | |
| //         |                              |
 | |
| //         v                              v
 | |
| // [i]   arg10   : Tenth parameter to pass to the function
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] Return value from the function (if any)
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // REVAXSH_MTD_GETENGINES$
 | |
| //
 | |
| // Returns a list of ActiveX script engines installed on the workstation. 
 | |
| //
 | |
| // e.g.
 | |
| // 
 | |
| //   engineList = rti_AXSH( REVAXSH_MTD_GETENGINES$ )
 | |
| //
 | |
| // ----------------------------------------------------------------------------
 | |
| // [r] An @fm delimited list of installed engines.
 | |
| // ----------------------------------------------------------------------------
 | |
| // [e] All errors are returned via Set_Status(). See below for notes on 
 | |
| //     scripting errors
 | |
| // ----------------------------------------------------------------------------
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| // Scripting errors
 | |
| //
 | |
| // The Execute, AddCode, Eval and Run methods can all return parsing and 
 | |
| // execution errors from the scripting engine. In this case an @svm delimited
 | |
| // list of error information is returned with the following structure:
 | |
| //
 | |
| //    <0,0,1> Error Source
 | |
| //    <0,0,2> Error Description
 | |
| //    <0,0,3> LineText
 | |
| //    <0,0,4> LineNumber
 | |
| //    <0,0,5> CharPos
 | |
| //    <0,0,6> ContextID
 | |
| 
 | |
|    equ REVAXSH_SERR_POS_SOURCE$           to 1
 | |
|    equ REVAXSH_SERR_POS_DESC$             to 2
 | |
|    equ REVAXSH_SERR_POS_LINETEXT$         to 3
 | |
|    equ REVAXSH_SERR_POS_LINENUM$          to 4
 | |
|    equ REVAXSH_SERR_POS_CHARPOS$          to 5
 | |
|    equ REVAXSH_SERR_POS_CONTEXTID$        to 6
 | |
| 
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| #endif
 | |
| ///////////////////////////////////////////////////////////////////////////////
 | |
| ///////////////////////////////////////////////////////////////////////////////
 |