home *** CD-ROM | disk | FTP | other *** search
- /* i4eval.c (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Evaluates the key expression of an index file.
-
- Returns
- 0 - SUCCESS
- -1 - ERROR
- */
-
- #include "d4all.h"
- #include "u4error.h"
-
- extern INDEX *v4index ;
-
-
- char *i4eval( int index_ref )
- {
- INDEX *index_ptr ;
- char *result ;
-
- index_ptr = v4index + index_ref ;
-
- result = (char *) e4exec ( index_ptr->compile ) ;
-
- if ( result == (char *)0) return( (char *) 0 ) ;
-
- #ifdef CLIPPER
- if ( e4type() == 'N' || e4type() == 'F' )
- {
- result= c4dtoa( *((double *)result), index_ptr->key_len, index_ptr->key_dec ) ;
- c4clip( result, index_ptr->key_len ) ;
- }
- #else
- /* Do conversions depending on returned type */
- if ( e4type() == 'D' )
- {
- /* Date - Convert from CCYYMMDD format to Julian Double format */
- if ( c4dt_julian( (char *)result, (double *)result) == -1 )
- {
- u4error( E_DATE, result, (char *) 0 ) ;
- return( (char *) 0) ;
- }
- }
- #endif
- return( result) ;
- }
-
-