#include "creatdct.h" #define ISDIGIT(c) ((c)>='0' && (c)<='9') #define ISSIGN(c) ((c)=='+' || (c)=='-') #define ISDPT(c) ((c)=='.') #define ISEFMT(c) ((c)=='d' || (c)=='D' || (c)=='e' || (c)=='E') /* rc = chkifdbl(s) Checks if s can be interpreted as a Double using the atof() function. Returns: 0 it can be converted 1 it could be converted, but there would be extra chars 2 it can not be converted. An Double is defined as [blanks][sign][digits][.digits][{d|D|e|E}][sign]digits] */ int chkifdbl(s) register char *s ; { int hasdigits ; s = skipblnk(s) ; if (ISSIGN(*s)) s++ ; hasdigits=0 ; if (ISDIGIT(*s)) { hasdigits=1 ; for(s++;ISDIGIT(*s);s++) ; } if (ISDPT(*s)) { s++ ; if (ISDIGIT(*s)) { hasdigits=1 ; for(s++;ISDIGIT(*s);s++) ; } } if (hasdigits==0) return(2) ; if (ISEFMT(*s)) { s++ ; if (ISSIGN(*s)) s++ ; if (!ISDIGIT(*s)) return(1) ; for(s++;ISDIGIT(*s);s++) ; } return(*s ? 1 : 0) ; }