@ -345,141 +345,3 @@ INPgetUTok(char **line, char **token, int gobble)
return ( OK ) ;
}
/*-------------------------------------------------------------------
* INPgetUTok plus points < > ? : , called from INPevaluate called
* from INPevaluate with gobble = = 2
* fcn added to avoid unforeseeable side effects during other calls
* to INPevaluate .
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
int
INPgetU2Tok ( char * * line , char * * token , int gobble )
/* gobble: eat non-whitespace trash AFTER token? */
{
char * point , separator ;
int signstate ;
/* scan along throwing away garbage characters */
for ( point = * line ; * point ! = ' \0 ' ; point + + ) {
if ( * point = = ' ' )
continue ;
if ( * point = = ' \t ' )
continue ;
if ( * point = = ' = ' )
continue ;
if ( * point = = ' ( ' )
continue ;
if ( * point = = ' ) ' )
continue ;
if ( * point = = ' , ' )
continue ;
break ;
}
if ( * point = = ' " ' ) {
separator = ' " ' ;
point + + ;
} else if ( * point = = ' \' ' ) {
separator = ' \' ' ;
point + + ;
} else
separator = 0 ;
/* mark beginning of token */
* line = point ;
/* now find all good characters */
signstate = 0 ;
for ( point = * line ; * point ! = ' \0 ' ; point + + ) {
if ( separator ) {
if ( * point = = separator )
break ;
else
continue ;
}
if ( * point = = ' ' )
break ;
if ( * point = = ' \t ' )
break ;
if ( * point = = ' = ' )
break ;
if ( * point = = ' ( ' )
break ;
if ( * point = = ' ) ' )
break ;
if ( * point = = ' , ' )
break ;
/* This is not complex enough to catch all errors, but it will
get the " good " parses */
if ( * point = = ' + ' & & ( signstate = = 1 | | signstate = = 3 ) )
break ;
if ( * point = = ' - ' ) {
if ( signstate = = 1 | | signstate = = 3 )
break ;
signstate + = 1 ;
continue ;
}
if ( * point = = ' * ' )
break ;
if ( * point = = ' / ' )
break ;
if ( * point = = ' ^ ' )
break ;
if ( * point = = ' < ' )
break ;
if ( * point = = ' > ' )
break ;
if ( * point = = ' ? ' )
break ;
if ( * point = = ' : ' )
break ;
if ( isdigit ( * point ) | | * point = = ' . ' ) {
if ( signstate > 1 )
signstate = 3 ;
else
signstate = 1 ;
} else if ( tolower ( * point ) = = ' e ' & & signstate = = 1 )
signstate = 2 ;
else
signstate = 3 ;
}
if ( separator & & * point = = separator )
point - - ;
if ( point = = * line & & * point ) /* Weird items, 1 char */
point + + ;
* token = copy_substring ( * line , point ) ;
if ( ! * token )
return ( E_NOMEM ) ;
/* gobble garbage to next token */
for ( ; * point ! = ' \0 ' ; point + + ) {
if ( * point = = separator )
continue ;
if ( * point = = ' ' )
continue ;
if ( * point = = ' \t ' )
continue ;
if ( ( * point = = ' = ' ) & & gobble )
continue ;
if ( ( * point = = ' , ' ) & & gobble )
continue ;
break ;
}
* line = point ;
# ifdef TRACE
/* SDB debug statement */
/* printf("found refdes token (%s) and rest of line (%s)\n",*token,*line); */
# endif
return ( OK ) ;
}