Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Alexander Skobelev Newsgroups: comp.lang.forth Subject: Re: FORTH on the Advanced Placement Computer Science ! Date: Mon, 12 Jan 2015 09:09:26 +0300 Organization: A noiseless patient Spider Lines: 54 Message-ID: References: <7xd277yybp.fsf@ruckus.brouhaha.com> <7xbnmquimp.fsf@ruckus.brouhaha.com> <3d03e403-7181-4ab3-8a2f-a23d0c4843f7@googlegroups.com> <87y4pt4qkl.fsf@jester.gateway.sonic.net> <2014Dec27.111715@mips.complang.tuwien.ac.at> <878uhs4zxk.fsf@jester.gateway.sonic.net> <871tnd9dg0.fsf@jester.gateway.pace.com> <87387q5hi8.fsf@jester.gateway.sonic.net> <43c6114f-8d41-4005-9131-fe93ec3d3696@googlegroups.com> <1e8rr8252gv4h$.1pe3q7wc2oxj5$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="b120e5c8b4f216b4cd7561d02d477618"; logging-data="1020"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/YyZ2sgLM5PebuasGgHh3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) Cancel-Lock: sha1:ms5YPIOnQFmKbOe7SfSsn60U2jc= sha1:QsQ2o4uu2x5lmbEmK6nrV9FKCk0= Xref: csiph.com comp.lang.forth:35739 Coos Haak writes: > Op Sat, 10 Jan 2015 14:43:03 +0300 schreef Alexander Skobelev: > >> Coos Haak writes: >> >>> Op Fri, 09 Jan 2015 16:25:57 +0300 schreef Alexander Skobelev: >>> >>>> "Elizabeth D. Rather" writes: >>>> >>>>> On 1/8/15 7:04 PM, Alexander Skobelev wrote: >>>>>> hughaguilar96@gmail.com writes: >>>>>> >>>>>>> The ANS-Forth standard doesn't support the use of C" and S" in >>>>>>> interpretive mode, and SwiftForth and Gforth both fail at this. I >>>>>>> fixed the problem in my novice package --- this is really necessary to >>>>>>> interactively debug functions that take strings as arguments. >>>>>>> >>>>>> >>>>>> Perhaps you have meant C" only, as S" in interpretive mode seems to be >>>>>> Gforth as well as ANS-Forth in FILE word set (see 11.6.1.2165). >>>>> >>>>> C" is actually not used very much nowadays, AFAIK. It was retained in >>>>> Forth94 because at the time some people used it, but I think counted >>>>> strings are used much less nowadays. >>>> >>>> I think they still can be useful for storing short strings in structure >>>> fields with a fixed width. >>>> >>>> Something like in this: >>>> 0 >>>> 22 CHARS +FIELD person.name >>>> ... >>>> CONSTANT Person >>>> >>>> , – where the person.name field is supposed to store a counted string of >>>> no more than 21 characters length. >>> >>> You can also store uncounted strings (left aligned) in the field >>>: PUT ( c-addr u addr -- ) >>> dup len blank \ Erase storage >>> swap len min cmove ; \ Store string >>>: GET ( addr -- c-addr u ) >>> len -trailing ; >>> Where addr is the address of the field and len is the size of the field, in >>> this case 22. >>> >> >> Yes, this is a possible solution. But I still prefer the counted strings >> more here as they don't require -trailing in the getter. > > So, leave it away ;-) Seems this is the only option – to live with a trail of spaces. :)