User Tools

Site Tools


en:pfw:string_handling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:pfw:string_handling [2024-04-17 15:59] – [Generic Forth] willemen:pfw:string_handling [2025-12-27 14:12] (current) – [The idea] willem
Line 10: Line 10:
  
 (We define) A few words that make string manipulation in forth a little smoother.\\ (We define) A few words that make string manipulation in forth a little smoother.\\
-Original idea Albert Nijhof & [[https://home.hccnet.nl/a.w.m.van.der.horst/index.html|Albert van der Horst]]. Examples are:+Original idea [[https://home.hccnet.nl/anij/|Albert Nijhof]] & [[https://home.hccnet.nl/a.w.m.van.der.horst/index.html|Albert van der Horst]]. Examples are:
  
   * Manipulate files   * Manipulate files
Line 80: Line 80:
 : C+!   ( n a -- )      >r  r@ c@ +  r> c! ;    \ Incr. byte with n at a : C+!   ( n a -- )      >r  r@ c@ +  r> c! ;    \ Incr. byte with n at a
 : $@    ( s -- c )      count ;                 \ Fetch string : $@    ( s -- c )      count ;                 \ Fetch string
-: $+!   ( c s -- )      >r  tuck  r@ $@ +  swap cmove  r> c+! ; \ Extend string +: $+!   ( c s -- )      >r  tuck  r@ $@ +  swap move  r> c+! ; \ Extend string 
 : $!    ( c s -- )      0 over c!  $+! ;        \ Store string : $!    ( c s -- )      0 over c!  $+! ;        \ Store string
 : $.    ( c -- )        type ;                  \ Print string : $.    ( c -- )        type ;                  \ Print string
Line 97: Line 97:
  
 : $@    ( s -- c )      @+  ;                  \ Fetch string : $@    ( s -- c )      @+  ;                  \ Fetch string
-: $+!   ( c s -- )      >r  tuck  r@ $@ +  swap cmove  r> +! ; \ Extend string +: $+!   ( c s -- )      >r  tuck  r@ $@ +  swap move  r> +! ; \ Extend string 
 : $!    ( c s -- )      0 over !  $+! ;        \ Store string : $!    ( c s -- )      0 over !  $+! ;        \ Store string
 : $.    ( c -- )        type ;                 \ Print string : $.    ( c -- )        type ;                 \ Print string
en/pfw/string_handling.1713362392.txt.gz · Last modified: 2024-04-17 15:59 by willem