diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /pkg/utilities/nttools/tjoin/isnumber.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/utilities/nttools/tjoin/isnumber.x')
-rw-r--r-- | pkg/utilities/nttools/tjoin/isnumber.x | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/tjoin/isnumber.x b/pkg/utilities/nttools/tjoin/isnumber.x new file mode 100644 index 00000000..3efb0dba --- /dev/null +++ b/pkg/utilities/nttools/tjoin/isnumber.x @@ -0,0 +1,35 @@ +include <ctype.h> +include <lexnum.h> + +# B.Simon 16-Apr-99 first code + +# IS_NUMBER -- Test string to see if it represents a number + +bool procedure is_number (str) + +char str[ARB] # i: String to be tested +#-- +int ic, nc, type +int lexnum() + +begin + # Use lexnum to determine string type + + ic = 1 + type = lexnum (str, ic, nc) + + # Any non-white characters after the number + # indicate this is not a number + + ic = ic + nc + while (str[ic] != EOS) { + if (! IS_WHITE(str[ic])) + return (false) + + ic = ic + 1 + } + + # Test for numeric types and return result of test + + return (type == LEX_OCTAL || type == LEX_DECIMAL || type == LEX_REAL) +end |