2000-09-18 09:30 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/harbour.slx
* source/compiler/harbour.sly
* source/compiler/harbour.y
* source/compiler/simplex.c
* source/macro/macro.slx
! Corrected compiler warnings.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2000-09-18 09:30 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* source/compiler/harbour.slx
|
||||
* source/compiler/harbour.sly
|
||||
* source/compiler/harbour.y
|
||||
* source/compiler/simplex.c
|
||||
* source/macro/macro.slx
|
||||
! Corrected compiler warnings.
|
||||
|
||||
2000-09-17 23:45 UTC+0800 Ron Pinkas <ron@profit-master.com>
|
||||
* source/compiler/harbour.l
|
||||
! Corrected definition of _PROCREQ_()
|
||||
@@ -16,7 +24,7 @@
|
||||
+ Added support for predefind match pattern, {WS} (White Space), in KEYWORDS and WORDS.
|
||||
|
||||
+ source/compiler/harbour.sly
|
||||
* Same as harbour.y, exclusing un-needed support for reserved words used as identifiers.
|
||||
* Same as harbour.y, excluding un-needed support for reserved words used as identifiers.
|
||||
/* Harbour.slx works with either harbour.y or harbour.sly, but harbour.sly creates smaller harbour.exe. */
|
||||
|
||||
* hb_slex.bc
|
||||
|
||||
@@ -54,8 +54,7 @@ static unsigned char iIdentifier = 0;
|
||||
static char* sIdOnHold;
|
||||
|
||||
long hb_comp_SLX_Hex2L( char* sHex );
|
||||
static void hb_comp_SLX_ConvertNumber(void);
|
||||
static void hb_comp_SLX_EelemntToken(void);
|
||||
static int hb_compElementToken( char* szToken, unsigned int iTokenLen );
|
||||
|
||||
/* ----------------------------------------------------- Language Definitions. ---------------------------------------------------- */
|
||||
|
||||
@@ -431,7 +430,7 @@ LANGUAGE_RULES_ARE {
|
||||
#define INTERCEPT_ACTION(x) hb_comp_SLX_InterceptAction()
|
||||
|
||||
#undef ELEMENT_TOKEN
|
||||
#define ELEMENT_TOKEN(x,y) hb_compElementToken()
|
||||
#define ELEMENT_TOKEN(x,y) hb_compElementToken(x,y)
|
||||
|
||||
#undef YY_INPUT /* to implement our own YY_INPUT function to manage PRGs without \n at the end */
|
||||
extern FILE * yyin; /* currently yacc parsed file */
|
||||
@@ -545,14 +544,16 @@ void hb_comp_SLX_InterceptAction(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hb_compElementToken( void )
|
||||
static int hb_compElementToken( char* szToken, unsigned int iTokenLen )
|
||||
{
|
||||
extern char *tmpPtr, *yytext, sToken[TOKEN_SIZE];
|
||||
extern int yyleng, iRet;
|
||||
extern unsigned int iLen;
|
||||
extern char *yytext;
|
||||
extern int yyleng;
|
||||
|
||||
yytext = (char*) sToken;
|
||||
yyleng = iLen;
|
||||
char* tmpPtr;
|
||||
int iRet;
|
||||
|
||||
yytext = szToken;
|
||||
yyleng = (int) iTokenLen;
|
||||
|
||||
if( ( *yytext > 64 && *yytext < 91 ) || *yytext == '&' || *yytext == '_' )
|
||||
{
|
||||
@@ -632,93 +633,84 @@ static void hb_compElementToken( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_INFO( printf( "Passing Element \"%s\" to CONVERT_NUMBER()\n", sToken ) );
|
||||
/* ConverNumber */
|
||||
|
||||
/* "Returns" Token in iRet. (yylval.string already allocated). */
|
||||
yylval.string = (char*) hb_xgrab( TOKEN_SIZE );
|
||||
yylval.string[0] = 0;
|
||||
aTexts[iTexts++] = yylval.string;
|
||||
|
||||
/* "Paramters" yytext & yyleng, "returns" result in iRet. */
|
||||
hb_comp_SLX_ConvertNumber();
|
||||
|
||||
DEBUG_INFO( printf( "Element \"%s\" is %i\n", sToken, iRet ) );
|
||||
}
|
||||
}
|
||||
|
||||
static void hb_comp_SLX_ConvertNumber(void)
|
||||
{
|
||||
extern int iRet, yyleng;
|
||||
extern char *tmpPtr, *yytext;
|
||||
|
||||
/* Hex Number */
|
||||
if( yytext[0] == '0' && yytext[1] == 'X' )
|
||||
{
|
||||
long lNumber = hb_comp_SLX_Hex2L( yytext + 2 );
|
||||
|
||||
if( ( double ) SHRT_MIN <= lNumber && lNumber <= ( double ) SHRT_MAX )
|
||||
/* Hex Number */
|
||||
if( yytext[0] == '0' && yytext[1] == 'X' )
|
||||
{
|
||||
yylval.valInteger.iNumber = lNumber;
|
||||
yylval.valInteger.szValue = yytext;
|
||||
iRet = NUM_INTEGER;
|
||||
}
|
||||
else if( ( double ) LONG_MIN <= lNumber && lNumber <= ( double ) LONG_MAX )
|
||||
{
|
||||
yylval.valLong.lNumber = lNumber;
|
||||
yylval.valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NOTE: This will never happen */
|
||||
yylval.valDouble.dNumber = lNumber;
|
||||
yylval.valDouble.bWidth = HB_DEFAULT_WIDTH;
|
||||
yylval.valDouble.bDec = 0;
|
||||
yylval.valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval.valDouble.dNumber = atof( yytext );
|
||||
tmpPtr = strchr( yytext, '.' );
|
||||
long lNumber = hb_comp_SLX_Hex2L( yytext + 2 );
|
||||
|
||||
if( tmpPtr )
|
||||
{
|
||||
yylval.valDouble.bDec = strlen( tmpPtr + 1 );
|
||||
yylval.valDouble.bWidth = yyleng - yylval.valDouble.bDec;
|
||||
if( yylval.valDouble.bDec )
|
||||
{
|
||||
yylval.valDouble.bWidth--;
|
||||
}
|
||||
yylval.valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( double )SHRT_MIN <= yylval.valDouble.dNumber && yylval.valDouble.dNumber <= ( double )SHRT_MAX )
|
||||
if( ( double ) SHRT_MIN <= lNumber && lNumber <= ( double ) SHRT_MAX )
|
||||
{
|
||||
yylval.valInteger.iNumber = ( int ) yylval.valDouble.dNumber;
|
||||
yylval.valInteger.szValue = yytext;
|
||||
iRet = NUM_INTEGER;
|
||||
yylval.valInteger.iNumber = lNumber;
|
||||
yylval.valInteger.szValue = yytext;
|
||||
iRet = NUM_INTEGER;
|
||||
}
|
||||
else if( ( double )LONG_MIN <= yylval.valDouble.dNumber && yylval.valDouble.dNumber <= ( double )LONG_MAX )
|
||||
else if( ( double ) LONG_MIN <= lNumber && lNumber <= ( double ) LONG_MAX )
|
||||
{
|
||||
yylval.valLong.lNumber = ( long ) yylval.valDouble.dNumber;
|
||||
yylval.valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
yylval.valLong.lNumber = lNumber;
|
||||
yylval.valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval.valDouble.bWidth = yyleng + 1;
|
||||
yylval.valDouble.bDec = 0;
|
||||
yylval.valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
/* NOTE: This will never happen */
|
||||
yylval.valDouble.dNumber = lNumber;
|
||||
yylval.valDouble.bWidth = HB_DEFAULT_WIDTH;
|
||||
yylval.valDouble.bDec = 0;
|
||||
yylval.valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval.valDouble.dNumber = atof( yytext );
|
||||
tmpPtr = strchr( yytext, '.' );
|
||||
|
||||
if( tmpPtr )
|
||||
{
|
||||
yylval.valDouble.bDec = strlen( tmpPtr + 1 );
|
||||
yylval.valDouble.bWidth = yyleng - yylval.valDouble.bDec;
|
||||
if( yylval.valDouble.bDec )
|
||||
{
|
||||
yylval.valDouble.bWidth--;
|
||||
}
|
||||
yylval.valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( double )SHRT_MIN <= yylval.valDouble.dNumber && yylval.valDouble.dNumber <= ( double )SHRT_MAX )
|
||||
{
|
||||
yylval.valInteger.iNumber = ( int ) yylval.valDouble.dNumber;
|
||||
yylval.valInteger.szValue = yytext;
|
||||
iRet = NUM_INTEGER;
|
||||
}
|
||||
else if( ( double )LONG_MIN <= yylval.valDouble.dNumber && yylval.valDouble.dNumber <= ( double )LONG_MAX )
|
||||
{
|
||||
yylval.valLong.lNumber = ( long ) yylval.valDouble.dNumber;
|
||||
yylval.valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
yylval.valDouble.bWidth = yyleng + 1;
|
||||
yylval.valDouble.bDec = 0;
|
||||
yylval.valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iRet += DONT_REDUCE;
|
||||
}
|
||||
|
||||
iRet += DONT_REDUCE;
|
||||
DEBUG_INFO( printf( "Element \"%s\" is %i\n", sToken, iRet ) );
|
||||
return iRet;
|
||||
}
|
||||
|
||||
long hb_comp_SLX_Hex2L( char* sHex )
|
||||
|
||||
@@ -1187,7 +1187,7 @@ Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( $2 ); hb_comp_szDeclare
|
||||
| DECLARE IdentName { hb_comp_pLastClass = hb_compClassAdd( $2 ); } ClassInfo Crlf { hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_CLASS IdentName Crlf { hb_comp_pLastClass = hb_compClassAdd( $2 ); hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_MEMBER DecMethod Crlf { hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_MEMBER '{' AsType { hb_comp_cDataListType = hb_comp_cVarType; } DecDataList '}' Crlf { hb_comp_cDataListType = NULL; hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_MEMBER '{' AsType { hb_comp_cDataListType = hb_comp_cVarType; } DecDataList '}' Crlf { hb_comp_cDataListType = 0; hb_comp_iVarScope = VS_NONE; }
|
||||
;
|
||||
|
||||
DecDataList: DecData
|
||||
|
||||
@@ -1202,7 +1202,7 @@ Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( $2 ); hb_comp_szDeclare
|
||||
| DECLARE IdentName { hb_comp_pLastClass = hb_compClassAdd( $2 ); } ClassInfo Crlf { hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_CLASS IdentName Crlf { hb_comp_pLastClass = hb_compClassAdd( $2 ); hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_MEMBER DecMethod Crlf { hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_MEMBER '{' AsType { hb_comp_cDataListType = hb_comp_cVarType; } DecDataList '}' Crlf { hb_comp_cDataListType = NULL; hb_comp_iVarScope = VS_NONE; }
|
||||
| DECLARE_MEMBER '{' AsType { hb_comp_cDataListType = hb_comp_cVarType; } DecDataList '}' Crlf { hb_comp_cDataListType = 0; hb_comp_iVarScope = VS_NONE; }
|
||||
;
|
||||
|
||||
DecDataList: DecData
|
||||
|
||||
@@ -250,13 +250,13 @@ static int rulecmp( const void * pLeft, const void * pRight );
|
||||
#define HOLD_TOKEN(x) PUSH_TOKEN(x)
|
||||
|
||||
#define IF_BEGIN_PAIR(chr) \
|
||||
if( aPairNodes[chr].iMin == -1 ) \
|
||||
if( aPairNodes[(int)chr].iMin == -1 ) \
|
||||
{ \
|
||||
bTmp = FALSE; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
register unsigned int i = aPairNodes[chr].iMin, iMax = aPairNodes[chr].iMax + 1, iStartLen; \
|
||||
register unsigned int i = aPairNodes[(int)chr].iMin, iMax = aPairNodes[(int)chr].iMax + 1, iStartLen; \
|
||||
register unsigned char chrStart; \
|
||||
unsigned int iLastPair = 0, iLastLen = 0; \
|
||||
\
|
||||
@@ -321,9 +321,9 @@ static int rulecmp( const void * pLeft, const void * pRight );
|
||||
if( bTmp )
|
||||
|
||||
#define CHECK_SELF_CONTAINED(chr) \
|
||||
if( aSelfNodes[chr].iMin != -1 ) \
|
||||
if( aSelfNodes[(int)chr].iMin != -1 ) \
|
||||
{ \
|
||||
register unsigned int i = aSelfNodes[chr].iMin, iMax = aSelfNodes[chr].iMax + 1, iSelfLen; \
|
||||
register unsigned int i = aSelfNodes[(int)chr].iMin, iMax = aSelfNodes[(int)chr].iMax + 1, iSelfLen; \
|
||||
register unsigned char chrSelf; \
|
||||
\
|
||||
DEBUG_INFO( printf( "Checking %i Selfs for %c At: >%s<\n", iSelfs, chr, szBuffer - 1 ) ); \
|
||||
@@ -557,9 +557,9 @@ int SimpLex_GetNextToken( void )
|
||||
|
||||
/* Not using LEX_CASE() yet (white space)!!! */
|
||||
|
||||
if( acOmmit[chr] )
|
||||
if( acOmmit[(int)chr] )
|
||||
{
|
||||
while( acOmmit[*szBuffer] )
|
||||
while( acOmmit[(int)(*szBuffer)] )
|
||||
{
|
||||
iSize--; szBuffer++;
|
||||
}
|
||||
@@ -714,9 +714,9 @@ int SimpLex_GetNextToken( void )
|
||||
/* End Pairs. */
|
||||
|
||||
/* NewLine ? */
|
||||
if( acNewLine[chr] )
|
||||
if( acNewLine[(int)chr] )
|
||||
{
|
||||
while( acNewLine[*szBuffer] )
|
||||
while( acNewLine[(int)(*szBuffer)] )
|
||||
{
|
||||
iSize--; szBuffer++;
|
||||
}
|
||||
@@ -756,7 +756,7 @@ int SimpLex_GetNextToken( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
if( acReturn[chr] )
|
||||
if( acReturn[(int)chr] )
|
||||
{
|
||||
s_szBuffer = szBuffer;
|
||||
|
||||
@@ -764,7 +764,7 @@ int SimpLex_GetNextToken( void )
|
||||
{
|
||||
/* Will be returned on next cycle. */
|
||||
|
||||
HOLD_TOKEN( acReturn[chr] );
|
||||
HOLD_TOKEN( acReturn[(int)chr] );
|
||||
|
||||
/* Terminate current token and check it. */
|
||||
sToken[ iLen ] = '\0';
|
||||
@@ -783,7 +783,7 @@ int SimpLex_GetNextToken( void )
|
||||
}
|
||||
|
||||
DEBUG_INFO( printf( "Reducing Delimiter: '%c' As: %i\n", chr, iRet ) );
|
||||
return acReturn[chr];
|
||||
return acReturn[(int)chr];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -873,8 +873,7 @@ int SimpLex_CheckToken( void )
|
||||
|
||||
DEBUG_INFO( printf( "Reducing Element: \"%s\"\n", (char*) sToken ) );
|
||||
|
||||
/* "Returns" result in iRet. */
|
||||
ELEMENT_TOKEN( sToken, iLen );
|
||||
iRet = ELEMENT_TOKEN( (char*)sToken, iLen );
|
||||
|
||||
bRecursive = FALSE;
|
||||
return iRet;
|
||||
@@ -1077,8 +1076,8 @@ void SimpLex_CheckWords( void )
|
||||
#ifdef USE_KEYWORDS
|
||||
if( bNewLine )
|
||||
{
|
||||
i = aKeyNodes[ sToken[0] ].iMin;
|
||||
iMax = aKeyNodes[ sToken[0] ].iMax + 1;
|
||||
i = aKeyNodes[ (int)(sToken[0]) ].iMin;
|
||||
iMax = aKeyNodes[ (int)(sToken[0]) ].iMax + 1;
|
||||
aCheck = (LEX_WORD*) ( &(aKeys[0]) );
|
||||
#ifdef DEBUG_LEX
|
||||
sDesc = (char*) sKeyDesc;
|
||||
@@ -1087,8 +1086,8 @@ void SimpLex_CheckWords( void )
|
||||
else
|
||||
#endif
|
||||
{
|
||||
i = aWordNodes[ sToken[0] ].iMin;
|
||||
iMax = aWordNodes[ sToken[0] ].iMax + 1;
|
||||
i = aWordNodes[ (int)(sToken[0]) ].iMin;
|
||||
iMax = aWordNodes[ (int)(sToken[0]) ].iMax + 1;
|
||||
aCheck = (LEX_WORD*) ( &( aWords[0] ) );
|
||||
#ifdef DEBUG_LEX
|
||||
sDesc = (char*) sWordDesc;
|
||||
@@ -1166,7 +1165,7 @@ void SimpLex_CheckWords( void )
|
||||
if( pNextSpacer )
|
||||
{
|
||||
/* Token not followed by white space - can't match this [or any latter] pattern! */
|
||||
if( ! acOmmit[cSpacer] )
|
||||
if( ! acOmmit[(int)cSpacer] )
|
||||
{
|
||||
DEBUG_INFO( printf( "Skip... Pattern [%s] requires {WS}, cSpacer: %c\n", sKeys2Match, cSpacer ) );
|
||||
|
||||
@@ -1453,21 +1452,21 @@ static void GenTrees( void )
|
||||
i = 0;
|
||||
while ( szOmmit[i] )
|
||||
{
|
||||
acOmmit[ szOmmit[i] ] = 1;
|
||||
acOmmit[ (int)(szOmmit[i]) ] = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while ( szNewLine[i] )
|
||||
{
|
||||
acNewLine[ szNewLine[i] ] = 1;
|
||||
acNewLine[ (int)(szNewLine[i]) ] = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while ( i < iDelimiters )
|
||||
{
|
||||
acReturn[ aDelimiters[i].cDelimiter ] = aDelimiters[i].iToken;
|
||||
acReturn[ (int)(aDelimiters[i].cDelimiter) ] = aDelimiters[i].iToken;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,7 @@ static HB_MACRO_PTR pMacro;
|
||||
static YYSTYPE *pYYLVAL;
|
||||
|
||||
static int hb_macro_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, char *sToken );
|
||||
static void hb_macro_SLX_EelemntToken(void);
|
||||
static void hb_macro_SLX_ConvertNumber(void);
|
||||
static int hb_macro_SLX_ElementToken( char* szToken, unsigned int iTokenLen );
|
||||
long hb_macro_SLX_Hex2L( char* sHex );
|
||||
|
||||
void * yy_bytes_buffer( char * pBuffer, int iBufSize );
|
||||
@@ -212,7 +211,7 @@ LANGUAGE_RULES_ARE {
|
||||
#endif
|
||||
|
||||
#undef ELEMENT_TOKEN
|
||||
#define ELEMENT_TOKEN(x,y) hb_macro_SLX_ElementToken()
|
||||
#define ELEMENT_TOKEN(x,y) hb_macro_SLX_ElementToken(x,y)
|
||||
|
||||
#undef CUSTOM_ACTION
|
||||
#define CUSTOM_ACTION(x) x = hb_macro_SLX_CustomAction( x, aiHold, &iHold, (char*) sToken )
|
||||
@@ -220,14 +219,16 @@ LANGUAGE_RULES_ARE {
|
||||
#undef LEX_USER_SETUP
|
||||
#define LEX_USER_SETUP() if( pYYLVAL == NULL ) pYYLVAL = yylval_ptr;
|
||||
|
||||
void hb_macro_SLX_ElementToken(void)
|
||||
static int hb_macro_SLX_ElementToken( char* szToken, unsigned int iTokenLen )
|
||||
{
|
||||
extern char *tmpPtr, *yytext, sToken[TOKEN_SIZE];
|
||||
extern int yyleng, iRet;
|
||||
extern unsigned int iLen;
|
||||
extern char *yytext;
|
||||
extern int yyleng;
|
||||
|
||||
yytext = (char*) sToken;
|
||||
yyleng = iLen;
|
||||
char *tmpPtr;
|
||||
int iRet;
|
||||
|
||||
yytext = szToken;
|
||||
yyleng = iTokenLen;
|
||||
|
||||
if( ( *yytext > 64 && *yytext < 91 ) || *yytext == '&' || *yytext == '_' )
|
||||
{
|
||||
@@ -287,76 +288,68 @@ void hb_macro_SLX_ElementToken(void)
|
||||
}
|
||||
|
||||
pYYLVAL->string = hb_strdup( yytext );
|
||||
iRet = IDENTIFIER + DONT_REDUCE;
|
||||
iRet = IDENTIFIER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* "Paramters" yytext & yyleng, "returns" result in iRet. */
|
||||
hb_macro_SLX_ConvertNumber();
|
||||
|
||||
DEBUG_INFO( printf( "Element \"%s\" is %i\n", sToken, iRet ) );
|
||||
}
|
||||
}
|
||||
|
||||
static void hb_macro_SLX_ConvertNumber(void)
|
||||
{
|
||||
extern int iRet, yyleng;
|
||||
extern char *tmpPtr, *yytext;
|
||||
|
||||
if( yytext[0] == '0' && yytext[1] == 'X' )
|
||||
{
|
||||
long lNumber = hb_macro_SLX_Hex2L( yytext + 2 );
|
||||
|
||||
if( ( double ) LONG_MIN <= lNumber && lNumber <= ( double ) LONG_MAX )
|
||||
if( yytext[0] == '0' && yytext[1] == 'X' )
|
||||
{
|
||||
pYYLVAL->valLong.lNumber = lNumber;
|
||||
pYYLVAL->valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
pYYLVAL->valDouble.dNumber = lNumber;
|
||||
pYYLVAL->valDouble.bWidth = HB_DEFAULT_WIDTH;
|
||||
pYYLVAL->valDouble.bDec = 0;
|
||||
pYYLVAL->valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pYYLVAL->valDouble.dNumber = atof( yytext );
|
||||
tmpPtr = strchr( yytext, '.' );
|
||||
long lNumber = hb_macro_SLX_Hex2L( yytext + 2 );
|
||||
|
||||
if( tmpPtr )
|
||||
{
|
||||
pYYLVAL->valDouble.bDec = strlen( tmpPtr + 1 );
|
||||
pYYLVAL->valDouble.bWidth = yyleng - pYYLVAL->valDouble.bDec;
|
||||
if( pYYLVAL->valDouble.bDec )
|
||||
{
|
||||
pYYLVAL->valDouble.bWidth--;
|
||||
}
|
||||
pYYLVAL->valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( double )LONG_MIN <= pYYLVAL->valDouble.dNumber && pYYLVAL->valDouble.dNumber <= ( double )LONG_MAX )
|
||||
{
|
||||
pYYLVAL->valLong.lNumber = ( long ) pYYLVAL->valDouble.dNumber;
|
||||
if( ( double ) LONG_MIN <= lNumber && lNumber <= ( double ) LONG_MAX )
|
||||
{
|
||||
pYYLVAL->valLong.lNumber = lNumber;
|
||||
pYYLVAL->valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
pYYLVAL->valDouble.bWidth = yyleng + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pYYLVAL->valDouble.dNumber = lNumber;
|
||||
pYYLVAL->valDouble.bWidth = HB_DEFAULT_WIDTH;
|
||||
pYYLVAL->valDouble.bDec = 0;
|
||||
pYYLVAL->valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pYYLVAL->valDouble.dNumber = atof( yytext );
|
||||
tmpPtr = strchr( yytext, '.' );
|
||||
|
||||
if( tmpPtr )
|
||||
{
|
||||
pYYLVAL->valDouble.bDec = strlen( tmpPtr + 1 );
|
||||
pYYLVAL->valDouble.bWidth = yyleng - pYYLVAL->valDouble.bDec;
|
||||
if( pYYLVAL->valDouble.bDec )
|
||||
{
|
||||
pYYLVAL->valDouble.bWidth--;
|
||||
}
|
||||
pYYLVAL->valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ( double )LONG_MIN <= pYYLVAL->valDouble.dNumber && pYYLVAL->valDouble.dNumber <= ( double )LONG_MAX )
|
||||
{
|
||||
pYYLVAL->valLong.lNumber = ( long ) pYYLVAL->valDouble.dNumber;
|
||||
pYYLVAL->valLong.szValue = yytext;
|
||||
iRet = NUM_LONG;
|
||||
}
|
||||
else
|
||||
{
|
||||
pYYLVAL->valDouble.bWidth = yyleng + 1;
|
||||
pYYLVAL->valDouble.bDec = 0;
|
||||
pYYLVAL->valDouble.szValue = yytext;
|
||||
iRet = NUM_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
iRet += DONT_REDUCE;
|
||||
|
||||
DEBUG_INFO( printf( "Element \"%s\" is %i\n", sToken, iRet ) );
|
||||
return iRet + DONT_REDUCE;
|
||||
}
|
||||
|
||||
long hb_macro_SLX_Hex2L( char* sHex )
|
||||
|
||||
Reference in New Issue
Block a user