Item

ItemType

Return the type of a value

Syntax

Signature
unsigned int ItemType( const ITEM *item );

Arguments

item Value to inspect. NULL is treated as NIL.

Return value

IT_NIL, IT_POINTER, IT_INTEGER, IT_DOUBLE, IT_DATE, IT_LOGICAL, IT_STRING, IT_BLOCK or IT_ARRAY; IT_NIL for NULL.

Description

The groups IT_INTEGRAL and IT_NUMERIC are tested with a mask: ( ItemType( item ) & IT_NUMERIC ) != 0.

Example

itemtype.c
#include "xdev-wtui.h"

#include <stdio.h>

int main( void )
{
   ITEM *item = ItemNew( NULL );

   if( !item )
      return 1;

   ItemPutND( item, 12.5 );
   printf( "Numeric value: %s\n", ( ItemType( item ) & IT_NUMERIC ) ? "yes" : "no" );
   ItemRelease( item );

   return 0;
}