Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #10127
| From | "Peter Knaggs" <pjk@bcs.org.uk> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Question on CHAR and [CHAR] |
| Date | 2012-03-15 10:24 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <op.wa7i6kjasu5d0p@david> (permalink) |
| References | <jjhtn6$b3r$1@speranza.aioe.org> <jjpagn$ff6$1@news-01.bur.connect.com.au> <71159a8f-832e-4701-9740-29357e7b024e@eb6g2000vbb.googlegroups.com> <jjrggf$jp7$2@news-01.bur.connect.com.au> <jjs87p$pf4$1@speranza.aioe.org> |
Rod Pemberton wrote:
> "Ed" <nospam@invalid.com> wrote in message
> news:jjrggf$jp7$2@news-01.bur.connect.com.au...
>> [...]
>> Rod's mention of quoted characters ('A') in other languages
>> and his examples involving CHAR [CHAR] suggests to me
>> he probably intended to write:
>>
>> : T [CHAR] 'A' . ;
>>
>> rather than
>>
>> : T CHAR 'A' . ;
>>
>
> In this case, what I wrote was what I intended. I didn't know that 'n'
> style syntax was entirely separate from CHAR for Forth. Single quotes
> are
> usually required to delimit a character in other languages. In fact, I
> couldn't find mention of it in the spec's. In other languages, you can't
> have a A or Z etc by itself and it be a character. It must be 'A' or 'Z'
> etc delimited by single-quotes. So, I took CHAR 'A' in a definition to
> place a character value for A on the stack. However, as others replied,
> CHAR gets a character from the input stream to the stack and 'A' by
> itself
> places a character value on the stack.
This is correct. The 200x document introduced 'A' as a character literal
that will leave the ordinal value of A on the stack. Thus,
'A' is equivalent to [CHAR] A'
So,
: T CHAR 'A' . ;
T X . gives 65 88
The CHAR works on the next character from the input stream (X).
While the 2x document requires both an open and close quote, I have
implemented it as an abbreviation for [CHAR], so the closing quote is
optional.
With the introduction of the character literal, [CHAR] is no longer
required, it is retained for backward compatibility.
--
Peter Knaggs
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 06:10 -0400
Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-11 06:03 -0500
Re: Question on CHAR and [CHAR] Coos Haak <chforth@hccnet.nl> - 2012-03-11 13:09 +0100
Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-12 19:43 -0400
Re: Question on CHAR and [CHAR] "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 16:22 -1000
Re: Question on CHAR and [CHAR] Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-13 03:23 -0700
Re: Question on CHAR and [CHAR] Josh Grams <josh@qualdan.com> - 2012-03-13 12:51 +0000
Re: Question on CHAR and [CHAR] Josh Grams <josh@qualdan.com> - 2012-03-11 17:11 +0000
Re: Question on CHAR and [CHAR] Jean-Bernard Faucon <jb@nospam.com> - 2012-03-11 21:34 +0100
Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 10:45 +0000
Re: Question on CHAR and [CHAR] BruceMcF <agila61@netscape.net> - 2012-03-11 13:57 -0700
Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 17:06 -0400
Re: Question on CHAR and [CHAR] Josh Grams <josh@qualdan.com> - 2012-03-11 21:38 +0000
Re: Question on CHAR and [CHAR] "Elizabeth D. Rather" <erather@forth.com> - 2012-03-11 14:12 -1000
Re: Question on CHAR and [CHAR] BruceMcF <agila61@netscape.net> - 2012-03-11 18:42 -0700
Re: Question on CHAR and [CHAR] Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-12 11:13 +0000
Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-12 19:46 -0400
Re: Question on CHAR and [CHAR] "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 16:56 -1000
Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-14 16:35 +1100
Re: Question on CHAR and [CHAR] Alex McDonald <blog@rivadpm.com> - 2012-03-14 08:49 -0700
Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-15 12:29 +1100
Re: Question on CHAR and [CHAR] "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-15 04:11 -0400
Re: Question on CHAR and [CHAR] "Peter Knaggs" <pjk@bcs.org.uk> - 2012-03-15 10:24 +0000
Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-15 06:23 -0500
Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-15 12:05 +0000
Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-15 08:19 -0500
Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-17 13:17 +1100
Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-17 15:13 +0000
Re: Question on CHAR and [CHAR] Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-18 06:07 -0500
Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-18 23:01 +1100
Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-18 15:21 +0000
Re: Question on CHAR and [CHAR] Bernd Paysan <bernd.paysan@gmx.de> - 2012-03-18 23:15 +0100
Re: Question on CHAR and [CHAR] anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-15 11:59 +0000
Re: Question on CHAR and [CHAR] "Ed" <nospam@invalid.com> - 2012-03-15 12:29 +1100
csiph-web