From: dxforth@gmail.com   
      
   On 29/04/2025 7:32 pm, albert@spenarnc.xs4all.nl wrote:   
   > In article ,   
   > dxf wrote:   
   >> On 28/04/2025 8:39 pm, Hans Bezemer wrote:   
   >>> On 28-04-2025 11:22, dxf wrote:   
   >>>> On 27/04/2025 8:28 pm, Hans Bezemer wrote:   
   >>>>> ...   
   >>>>> Just a shame the very basics are missing. The only thing holding   
   >> Forth back is the refusal to abstract strings. Wanna make it a counted   
   >> string with a cell count? Do it. Wanna keep on doing counted strings? Do   
   >> it. Wanna do ASCIIZ strings? No problem.   
   >>>>   
   >>>> But aren't string primitives a la ANS-Forth the key to flexibility?    
   >> I've used   
   >>>> the concatenation primitive +STRING ( a u a2 u2 -- a2 u+u2 )    
   >> countless times.   
   >>>>   
   >>>> : ZPLACE ( c-addr u c-addr2 -- ) zcount +string + 0 swap c! ;   
   >>>>   
   >>>> : ZAPPEND ( c-addr u c-addr2 -- ) zcount + zplace ;   
   >>>   
   >>>   
   >>> The problem is: it's defined nowhere. Not in Wil Baden Toolbelt, not   
   >> in ANS Forth, Forth 2012 -   
   >>   
   >> +STRING was defined in the Open Terminal Architecture spec - a joint project   
   >> by Forth Inc and MPE circa 2000.   
   >>   
   >> +STRING plus-string   
   >>   
   >> ( c-addr1 len1 c-addr2 len2 - c-addr2 len3 )   
   >>   
   >> Append the string at c-addr1, for len1 bytes, to the end of the string   
   >> at c-addr2, for len2 bytes. Return the beginning of the destination   
   >> string (c-addr2) and the sum of the two lengths (len3). It is the   
   >> programmer's responsibility to ensure that there is room at the end of   
   >> the destination string to hold both strings.   
   >>   
   >> Why it never made it into their forth offerings I don't know - perhaps   
   >> because the project was moth-balled?   
   >   
   > It is inferior to a $! $@ $+! scheme.   
   > A stored string must remember its length.   
      
   Not if it's a basic move ...   
      
   : >PAD ( a u -- a2 u ) pad 0 +string ;   
      
   : +EXT ( a1 u1 a2 u2 -- a3 u3 )   
    2over /ext if 2drop end 3 min s" ." 2rot -trailing   
    (pfsiz-5) min zbuf @ 1+ 0 +string +string +string ;   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|