Parl()

From Lianjapedia
Jump to: navigation, search

PURPOSE

Convert a logical to an integer

SYNONYM

api_par_l()

SYNOPSIS

#include "lianja_api.h"
 
int	_parl(order [,index]) )
 
<input parameters>
int	order;		/* Placement in actual parameter list	*/
int	index;		/* Array element index			*/
 
<output parameters>
none

DESCRIPTION

The function converts a logical parameter to an integer, where .T. = 1 and .F. = 0. The order specifies the actual placement in the parameter list. If the parameter passed is an array, then the optional index value is used to specify the required element number.

EXAMPLE

The following example returns the logical passed in the first parameter in English.

Example Lianja script:

m_condition=.t.
m_word =ltow(m_condition)
return

Example 'C' function:

#include "lianja_api.h"
 
lianjaapi_ltow()
{
    char		strbuff[6];
 
    if ( _parinfo(1) == API_LTYPE ) {
       if ( _parl(1) == 0 ) {
       strcpy( strbuff, "False");
       }else {
       strcpy( strbuff, "True");
       }
    } else {
       strcby( strbuff, "");
    }
 
    _retc( strbuff );
}

SEE ALSO

_parni(), _retl(), _retni(), ISLOG(), PCOUNT