[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
_itemParam()
Retrieve a parameter passed to an Extend routine from CA-Clipper
------------------------------------------------------------------------------
C Prototype
#include "item.api"
ITEM _itemParam(
USHORT uiParamNo
)
Arguments
uiParamNo is the parameter number to retrieve.
Returns
The requested parameter number or an empty (NIL) item if the parameter
number does not exist.
Description
The _itemParam() function is used to retrieve parameters passed from
CA-Clipper to your Extend routine. _itemParam() creates a new item and
returns that item with the parameter number requested.
Note: CA-Clipper parameter numbers begin at one, not zero.
Note: _itemParam() creates a new item reference. Remember to
release the item reference with _itemRelease() after returning it to
CA-Clipper or when it is no longer needed.
Examples
#include "clipdefs.h"
#include "extend.api"
#include "item.api"
#include "fm.api"
HIDE ITEM near _xMakeSub( USHORTP apSize, USHORT dims );
/*
*
* MYARRAY()
*
* Just like ARRAY()!
*/
CLIPPER MYARRAY(void)
{
ITEM arrayP, elementsP;
SHORT i;
BOOL check;
USHORT pcount = PCOUNT;
USHORTP apSize;
/* Check parameters - must be at least one and all */
/* NUMERIC */
if ( pcount )
{
/* CAUTION: _xgrab() will cause VM IE if there isn't */
/* enough memory */
apSize = (USHORTP)_xgrab( pcount * sizeof( USHORT ) );
/* store the parameters into apSize[] in */
/* reverse order. */
for (i = 0; i < pcount; i++)
{
elementsP = _itemParam( pcount-i );
check = _itemType( elementsP ) == NUMERIC &&
( apSize[i] =
(USHORT)_itemGetNL( elementsP ) ) <= 4096;
_itemRelease( elementsP );
if (!check)
break;
}
/* If all of the parameters check out ...*/
if( check )
{
arrayP = _xMakeSub( apSize, pcount );
_itemReturn ( arrayP );
_itemRelease( arrayP );
}
else
{
_itemRelease( _itemReturn( _itemNew( NULL ) ) ); }
_xfree( apSize );
}
}
HIDE ITEM near _xMakeSub( USHORTP apSize, USHORT dims )
{
ITEM arrayP;
ITEM tempP;
USHORT i;
arrayP = _itemArrayNew( apSize[ --dims ] );
if ( dims )
{
for (i = 1; i <= apSize[ dims ]; i++)
{
tempP = _xMakeSub( apSize, dims );
_itemArrayPut( arrayP, i, tempP );
_itemRelease( tempP );
}
}
return (arrayP);
}
Files Library is CLIPPER.LIB, header file is Item.api.
See Also:
_itemRelease()
_itemReturn()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson