Jump to content

History variables: Difference between revisions

m
Line 1,277:
\\ for strings
Module CheckStringHistoryVariables {
Class History$ {
Private:
myvalue=stack
Public:
Group Count {
Value {
link parent myvalue to m
=Len(m)
}
}
Function CopyMe {
m=This
.myvalue<=stack(.myvalue)
=Group(m)
}
Group CopyValues {}
Function ValueCopyMe {
link parent myvalue to m=This
.myvalue<=Stackstack(m.myvalue)
}=Group(m)
}
Group Function Values$ (x as long)CopyValues {
if x>=0 and x<=len(.myvalue) then =StackItem$(.myvalue, x)
Else Error "Fault index"
}
Module Back {
if len(.myvalue)<2 then exit
Stack .myvalue {Drop}
}
Operator "+=" (x$) {
Stack .myvalue {
Push stackitem$()+x$
} }
Value {
=StackItem$(.link parent myvalue) to m
} =Stack(m)
Set {
Read x$ : Stack .myvalue { Push x$}
}
Class:
Module History {
If Match("S") then Read x$ : Stack .myvalue { Push x$}
}
}
N$=HistoryFunction Values$ ("First"x as long) {
if x>=0 and x<=len(.myvalue) then =StackItem$(.myvalue, x)
N$="Second"
N$= Else Error "ThirdFault index"
Print N.Count=3}
M=N.CopyValuesModule Back {
K=Each(M, -1, 1 if len(.myvalue)<2 then exit
While K Stack .myvalue {Drop}
Print StackItem$(K)}
Operator "+=" (x$) {
FunctionStack CopyMe.myvalue {
m=ThisPush stackitem$()+x$
} }
SetValue {
.myvalue<=stackStackItem$(.myvalue)
}
Set }{
Read x$ : Stack .myvalue =Group(m){ Push x$}
}
Class:
Module BackHistory {
If Match("S") then Read x$ : ifStack len(.myvalue)<2 then{ Push exitx$}
}
N$+=" and this"}
N$=History$("First")
Print N.Count=4
Print N.CopyValues$="Second"
N.Back$="Third"
Print N.Count=3
Print M=N.CopyValues
K=Each(M, -1, 1)
Print N.Values$(2)="Second"
While K {
Print }StackItem$(K)
}
N$+=" and this"
Print N.Count=4
Print N.CopyValues
N.Back
Print N.Count=3
Print N.CopyValues
Print N.Values$(2)="Second"
}
CheckStringHistoryVariables
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.