Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.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: Sat, 10 Jan 2015 14:43:03 +0300 Organization: A noiseless patient Spider Lines: 46 Message-ID: References: <7x1tnngqt9.fsf@ruckus.brouhaha.com> <20141226022222.6f32fe7f@maxa-pc> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="9c0b930d8ac4a57f81167d1a74f8f538"; logging-data="4240"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jRSn5ddH8qz8ijJsP/ruD" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) Cancel-Lock: sha1:KpSMMfki8jAofdIuxVFFjtBCoqg= sha1:bR7GNuThnE2l1M9U9O+lnnrkVys= Xref: csiph.com comp.lang.forth:35695 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.