Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/String-prepend/Action-/string-prepend.action
Normal file
39
Task/String-prepend/Action-/string-prepend.action
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
PROC Append(CHAR ARRAY text,suffix)
|
||||
BYTE POINTER srcPtr,dstPtr
|
||||
BYTE len
|
||||
|
||||
len=suffix(0)
|
||||
IF text(0)+len>255 THEN
|
||||
len=255-text(0)
|
||||
FI
|
||||
IF len THEN
|
||||
srcPtr=suffix+1
|
||||
dstPtr=text+text(0)+1
|
||||
MoveBlock(dstPtr,srcPtr,len)
|
||||
text(0)==+suffix(0)
|
||||
FI
|
||||
RETURN
|
||||
|
||||
PROC Prepend(CHAR ARRAY text,prefix)
|
||||
CHAR ARRAY tmp(256)
|
||||
|
||||
SCopy(tmp,text)
|
||||
SCopy(text,prefix)
|
||||
Append(text,tmp)
|
||||
RETURN
|
||||
|
||||
PROC TestPrepend(CHAR ARRAY text,preffix)
|
||||
PrintF("Source ""%S"" at address %H%E",text,text)
|
||||
PrintF("Prepend ""%S""%E",preffix)
|
||||
Prepend(text,preffix)
|
||||
PrintF("Result ""%S"" at address %H%E",text,text)
|
||||
PutE()
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
CHAR ARRAY text(256)
|
||||
|
||||
text(0)=0
|
||||
TestPrepend(text,"World!")
|
||||
TestPrepend(text,"Hello ")
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue