In article <03d13185898a1ee00bea4f420aa1a3721b0585f2@i2pn2.org>,   
   dxf wrote:   
   >On 27/04/2025 8:28 pm, Hans Bezemer wrote:   
   >> ...   
   >> Another handy word is >STRING that converts a "raw" string to a fully   
   qualified string ( a1 n1 -- a2) that can handle a COUNT (you have the carnal   
   knowledge - you take care   
   >of the "how"). E.g. for counted strings it might be:   
   >>   
   >> : >STRING swap over over dup char+ rot cmove c! ;   
   >   
   >For forths that have PACK ( a u a2 -- a2 )   
   >   
   >: >STRING ( a u -- a ) over pack ;   
   >   
   Store a string in allocated memory.   
   sc (string constant: a u)   
   : $!A DUP ALLOCATE THROW >R   
    R@ SWAP CMOVE   
    R> ;   
      
   It helps to have SIZE in the memory wordset:   
   sva (string variable stored ALLOCATE d)   
   : $@A DUP SIZE ;   
      
   The proper mindset is that there are string variables,   
   (string areas where a string could be stored and changed)   
   and string constants, sc n where you are no supposed   
   to change the content of the string.   
      
   Groetjes Albert   
   --   
   Temu exploits Christians: (Disclaimer, only 10 apostles)   
   Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall   
   Art For Home, Office And Garden Decor - Perfect For Windows, Bars,   
   And Gifts For Friends Family And Colleagues.   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|