NAME

isint, isflt, isname - determine if string fits integer or real format, or is legal identifier

SYNOPSIS

int isint( char *str )

int isflt( char *str )

int isname( char *str )

DESCRIPTION

The isint function checks to see if the passed string str matches a decimal integer format (positive or negative), and returns 1 or 0 based on whether it does or does not.

The isflt function checks to see if the passed string str matches a floating point format (positive or negative with optional exponent), and returns 1 or 0 based on whether it does or does not.

The isname function checks to see if the passed string str is a legal identifier name. In MGF, a legal identifier must begin with a letter and contain only visible ASCII characters (those between decimal 33 and 127 inclusive). The one caveat to this is that names may begin with one or more underscores ('_'), but this is a trick employed by the parser to maintain a separate name space from the user, and is not legal usage otherwise.

Note that a string that matches an integer format is also a valid floating point value. Conversely, a string that is not a floating point number cannot be a valid integer.

These routines are useful for checking arguments passed to entity handlers that certain types in certain positions. If an invalid argument is passed, the handler should return an MG_ETYPE error.

SEE ALSO

mg_init, mg_load