Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . Technical Reference - <b>_itemgetnl()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _itemGetNL()
 Retrieve a numeric long value from an Item
------------------------------------------------------------------------------
 C Prototype

     #include "item.api"
     long _itemGetNL(
                      ITEM itemNumber
                    )

 Arguments

     itemNumber is the Item from which to retrieve a long value.

 Returns

     The numeric contained within the Item passed as a C-style long.

 Description

     The _itemGetNL() function is used to retrieve a numeric long from an
     Item.  If the value contained within itemNumber is not a numeric, or is
     a numeric with the DOUBLE flag set (see _itemType()), then the results
     of calling this function will be unpredictable.

 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: _itemGetND() _itemPutNL() _itemType()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson