home *** CD-ROM | disk | FTP | other *** search
- /*********
- *
- * DEC.C
- *
- * by Ralph Davis
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: DEC( <expC> )
- * Return: Decimal equivalent of hexadecimal string <expC>
- *********/
-
- #include "trlib.h"
-
- TRTYPE dec()
- {
- char *s;
-
- if ( PCOUNT == 1 && ISCHAR(1) )
- {
- s = _parc(1);
- if (_tr_strlen(s) <= 4) /* If four characters in string,
- convert to integer */
- _retnd((double) _tr_htoi(s));
-
- else /* Otherwise, convert to long */
- _retnd((double) _tr_htol(s));
- }
- else
- _retnd( (double)ERROR );
- }
-