Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #19143
| From | stephenXXX@mpeforth.com (Stephen Pelc) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Definition of 'DIGIT' |
| Message-ID | <5102b684.7243968@192.168.0.50> (permalink) |
| References | <1538d130-3c98-4e9d-bf09-d88c41dfa623@googlegroups.com> |
| Date | 2013-01-25 16:47 +0000 |
On Thu, 24 Jan 2013 22:49:10 -0800 (PST), jzakiya@gmail.com wrote:
>Can someone provide me the high-level definition of the word DIGIT.
>I need to create this for a forth that doesn't have it.
>
>: DIGIT ( c b -- n ? | ?) ;
This should do what you want. The actual VFX Forth version is ugly
because it makes assumptions about the x86 code generator.
: DIGIT \ char base -- 0 | n true
swap upc [char] 0 - dup 0< \ base val -- ; SFP045
if 2drop 0 exit then
dup 9 > if \ if > 9
7 - dup #10 < \ check gap
if 2drop 0 exit then
then
dup rot < \ -- val flag
dup 0= if nip then
;
Stephen
--
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
Definition of 'DIGIT' jzakiya@gmail.com - 2013-01-24 22:49 -0800
Re: Definition of 'DIGIT' Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-25 03:39 -0600
Re: Definition of 'DIGIT' Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-01-26 14:53 +0000
Re: Definition of 'DIGIT' Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-26 13:18 -0600
Re: Definition of 'DIGIT' Paul Rubin <no.email@nospam.invalid> - 2013-01-25 01:47 -0800
Re: Definition of 'DIGIT' jzakiya@gmail.com - 2013-01-25 06:39 -0800
Re: Definition of 'DIGIT' Bernd Paysan <bernd.paysan@gmx.de> - 2013-01-25 17:05 +0100
Re: Definition of 'DIGIT' jzakiya@gmail.com - 2013-01-25 10:43 -0800
Re: Definition of 'DIGIT' jzakiya@gmail.com - 2013-01-25 11:01 -0800
Re: Definition of 'DIGIT' jzakiya@gmail.com - 2013-01-26 08:09 -0800
Re: Definition of 'DIGIT' "A. K." <akk@nospam.org> - 2013-01-26 17:55 +0100
Re: Definition of 'DIGIT' Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-26 13:21 -0600
Re: Definition of 'DIGIT' Mark Wills <markrobertwills@yahoo.co.uk> - 2013-01-27 01:00 -0800
Re: Definition of 'DIGIT' Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-27 03:39 -0600
Re: Definition of 'DIGIT' Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-01-25 09:05 -0600
Re: Definition of 'DIGIT' albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-01-25 15:39 +0000
Re: Definition of 'DIGIT' Coos Haak <chforth@hccnet.nl> - 2013-01-26 16:43 +0100
Re: Definition of 'DIGIT' stephenXXX@mpeforth.com (Stephen Pelc) - 2013-01-25 16:47 +0000
csiph-web