The Lambda Lab
/
projects
/
forth.jl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added CMOVE>
[forth.jl.git]
/
src
/
lib_5_strings.4th
diff --git
a/src/lib_5_strings.4th
b/src/lib_5_strings.4th
index
99d1d39
..
9fef145
100644
(file)
--- a/
src/lib_5_strings.4th
+++ b/
src/lib_5_strings.4th
@@
-3,6
+3,7
@@
: CMOVE ( src dest length -- )
DUP 0<= IF
: CMOVE ( src dest length -- )
DUP 0<= IF
+ DROP DROP DROP
EXIT
THEN
EXIT
THEN
@@
-18,6
+19,24
@@
DROP
;
DROP
;
+: CMOVE> ( src dest length -- )
+ DUP 0<= IF
+ DROP DROP DROP
+ EXIT
+ THEN
+
+ -ROT OVER - ( length src (dest-src) )
+ -ROT DUP ROT + 1- ( (dest-src) src (src+length-1) )
+
+ DO
+ I @
+ OVER I +
+ !
+ -1 +LOOP
+
+ DROP
+;
+
: S" IMMEDIATE ( -- addr len )
STATE @ IF ( compiling? )
['] LITSTRING , ( compile LITSTRING )
: S" IMMEDIATE ( -- addr len )
STATE @ IF ( compiling? )
['] LITSTRING , ( compile LITSTRING )