Back to index

radiance  4R0+20100331
Functions | Variables
words.c File Reference
#include "copyright.h"
#include <ctype.h>
#include <string.h>
#include "rtio.h"

Go to the source code of this file.

Functions

char * atos (char *rs, int nb, char *s)
char * nextword (char *cp, int nb, char *s)
char * sskip (char *s)
char * sskip2 (char *s, int n)
char * iskip (char *s)
char * fskip (char *s)
int isint (char *s)
int isintd (char *s, char *ds)
int isflt (char *s)
int isfltd (char *s, char *ds)

Variables

static const char RCSid [] = "$Id: words.c,v 2.9 2004/09/28 17:54:18 greg Exp $"

Function Documentation

char* atos ( char *  rs,
int  nb,
char *  s 
)

Definition at line 18 of file words.c.

{
       register char  *cp = rs;

       while (isspace(*s))
              s++;
       while (--nb > 0 && *s && !isspace(*s))
              *cp++ = *s++;
       *cp = '\0';
       return(rs);
}

Here is the caller graph for this function:

char* fskip ( char *  s)

Definition at line 108 of file words.c.

{
       register char  *cp;

       while (isspace(*s))
              s++;
       if (*s == '-' || *s == '+')
              s++;
       cp = s;
       while (isdigit(*cp))
              cp++;
       if (*cp == '.') {
              cp++; s++;
              while (isdigit(*cp))
                     cp++;
       }
       if (cp == s)
              return(NULL);
       if (*cp == 'e' || *cp == 'E')
              return(iskip(cp+1));
       return(cp);
}

Here is the call graph for this function:

int isflt ( char *  s)

Definition at line 156 of file words.c.

{
       register char  *cp;

       cp = fskip(s);
       return(cp != NULL && *cp == '\0');
}
int isfltd ( char *  s,
char *  ds 
)

Definition at line 167 of file words.c.

{
       register char  *cp;

       cp = fskip(s);
       return(cp != NULL && strchr(ds, *cp) != NULL);
}
int isint ( char *  s)

Definition at line 134 of file words.c.

{
       register char  *cp;

       cp = iskip(s);
       return(cp != NULL && *cp == '\0');
}
int isintd ( char *  s,
char *  ds 
)

Definition at line 145 of file words.c.

{
       register char  *cp;

       cp = iskip(s);
       return(cp != NULL && strchr(ds, *cp) != NULL);
}
char* iskip ( char *  s)

Definition at line 91 of file words.c.

{
       while (isspace(*s))
              s++;
       if (*s == '-' || *s == '+')
              s++;
       if (!isdigit(*s))
              return(NULL);
       do
              s++;
       while (isdigit(*s));
       return(s);
}
char* nextword ( char *  cp,
int  nb,
char *  s 
)

Definition at line 35 of file words.c.

{
       int    quote = 0;

       if (s == NULL) return(NULL);
       while (isspace(*s))
              s++;
       switch (*s) {
       case '\0':
              return(NULL);
       case '"':
       case '\'':
              quote = *s++;
       }
       while (--nb > 0 && *s && (quote ? *s!=quote : !isspace(*s)))
              *cp++ = *s++;
       *cp = '\0';
       if (quote && *s==quote)
              s++;
       return(s);
}

Here is the caller graph for this function:

char* sskip ( char *  s)

Definition at line 62 of file words.c.

{
       while (isspace(*s))
              s++;
       while (*s && !isspace(*s))
              s++;
       return(s);
}

Here is the caller graph for this function:

char* sskip2 ( char *  s,
int  n 
)

Definition at line 74 of file words.c.

{
       while (isspace(*s))
              s++;
       while (n-- > 0) {
              while (*s && !isspace(*s))
                     s++;
              while (isspace(*s))
                     s++;
       }
       return(s);
}

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: words.c,v 2.9 2004/09/28 17:54:18 greg Exp $" [static]

Definition at line 2 of file words.c.