SDK Overview of Level 1

From Lianjapedia
Jump to: navigation, search

Level 1 Functions

Function Level 1 Description
_parc() Pass a pointer to a character string
_parclen() Length of a character string
_parcsiz() Size of a character string passed by reference
_pards() Pass a character pointer to a date
_parinfa() Parameter checking of arrays
_parinfo() Parameter checking
_parl() Pass a logical as an integer
_parnd() Pass a numeric as a double
_parni() Pass a numeric as an integer
_parnl() Pass a numeric as a long
_paro() Pass an object pointer to an object
_parts() Pass a character pointer to a datetime
_parys() Pass a character pointer to a currency
_ret() Return
_retc() Return a character string
_retclen() Return a character string and its length
_retds() Return a date string
_retl() Return an integer to a logical
_retnd() Return a double to a numeric
_retni() Return an integer to a numeric
_retnl() Return a long to a numeric
_reto() Return an object
_retts() Return a datetime string
_retys() Return a currency string
ALENGTH() Number of array elements
ISARRAY() Is parameter an array
ISCHAR() Is parameter a character string
ISCURRENCY() Is parameter a currency
ISDATE() Is parameter a date
ISDATETIME() Is parameter a datetime
ISLOG() Is parameter a logical
ISMEMO() Is parameter a memo
ISNUM() Is parameter a numeric
ISOBJECT() Is parameter an object
PCOUNT() Number of parameters passed


Level 1 functions are used for passing parameters between the 'C' functions and Lianja. When creating a 'C' function with the API the parameters being passed should not be defined in the function name like a normal 'C' function. Instead the parameters passed are referenced with the API _par functions. Each parameter passed is referenced by specifying a number representing the ordinal position in the parameter list with the API _par function call.

For example, the following 'C' function is passed 2 parameters. The data type of each parameter is checked first with the _parinfo() function, then the value of the parameters are passed to a char with the _parc() function. Lastly the char value is then returned.

#include "lianja_api.h"
 
lianjaapi_test_function()
{
    char string1[9];
    char string2[9];
 
    if (_parinfo(1) == API_CTYPE) {
       strcpy( string1, _parc(1));
    }
    if (_parinfo(2) == API_CTYPE) {
       strcpy( string2, _parc(2));
    }
 
    _retc( string1 );
}

Values are returned using the API _ret functions. Memory variables and array elements can also be updated from within the 'C' function to store the results, see level 3.