kacim ovde fajl uz poruku ako vam zatreba za nesto, a evo kako se koristi:
Code:
#Include "stack.bas"
DefineStackType(Integer, 0) '' define IntegerStack type
Dim As IntegerStack s, cloned
Dim ip As Integer Pointer
s.Push 12
s.Push 1456
s.Dup 3
s.PushBottom 67
s.Push 34
s.DupBottom 2
s.Item(3) = 1111
s.CloneTo cloned
ip = s.PeekTop
*ip = 45
ip = cloned.PeekBottom
*ip = 300
While s.ItemCount
Print s.Pop
Wend
Print
While cloned.ItemCount
Print cloned.Pop
Wend
Sleep
#Include "stack.bas"
DefineStackType(Integer, 0) '' define IntegerStack type
Dim As IntegerStack s, cloned
Dim ip As Integer Pointer
s.Push 12
s.Push 1456
s.Dup 3
s.PushBottom 67
s.Push 34
s.DupBottom 2
s.Item(3) = 1111
s.CloneTo cloned
ip = s.PeekTop
*ip = 45
ip = cloned.PeekBottom
*ip = 300
While s.ItemCount
Print s.Pop
Wend
While cloned.ItemCount
Print cloned.Pop
Wend
Sleep
ovo ce kao rezultat dati:
Code:
45
1456
1456
1111
1456
12
67
67
67
34
1456
1456
1111
1456
12
67
67
300
45
1456
1456
1111
1456
12
67
67
67
34
1456
1456
1111
1456
12
67
67
300
znaci stack.bas implementira DefineStackType makro kojim se kreira novi tip podatka (stek za odredjeni tip podataka)
znaci DefineStackType(Integer, 0) ce da definise IntegerStack tip, DefineStackType(String, "") ce da definise StringStack tip i td... (drugi parametar je difolt vrednost za taj tip)
sto se tice metoda i svojstava novokreiranih tipova mozete pogledati u stack.bas, al evo i ovde izdvojena lista:
Code:
Declare Function Push(Value As _TYPE_ = 0) As _TYPE_
Declare Function PushBottom(Value As _TYPE_ = _DEFAULT_VALUE_) As _TYPE_
Declare Function Pop As _TYPE_
Declare Function PopBottom As _TYPE_
Declare Property Item(ByVal Index As UInteger) As _TYPE_
Declare Property Item(ByVal Index As UInteger, Value As _TYPE_)
Declare Function PeekTop As _TYPE_ Pointer
Declare Function PeekBottom As _TYPE_ Pointer
Declare Sub Dup(ByVal Copies As UInteger = 1)
Declare Sub DupBottom(ByVal Copies As UInteger = 1)
Declare Sub PadTop(ByVal Items As UInteger = 1, Value As _TYPE_ = _DEFAULT_VALUE_)
Declare Sub PadBottom(ByVal Items As UInteger = 1, Value As _TYPE_ = _DEFAULT_VALUE_)
Declare Sub Roll(ByVal Items As UInteger = 1)
Declare Sub RollBottom(ByVal Items As UInteger = 1)
Declare Sub Erase()
Declare Property IsEmpty As Integer
Declare Property ItemCount As UInteger
Declare Function Clone As _TYPE_##Stack Pointer
Declare Sub CloneTo(ByRef Cloned As _TYPE_##Stack)
Declare Function Push(Value As _TYPE_ = 0) As _TYPE_
Declare Function PushBottom(Value As _TYPE_ = _DEFAULT_VALUE_) As _TYPE_
Declare Function Pop As _TYPE_
Declare Function PopBottom As _TYPE_
Declare Property Item(ByVal Index As UInteger) As _TYPE_
Declare Property Item(ByVal Index As UInteger, Value As _TYPE_)
Declare Function PeekTop As _TYPE_ Pointer
Declare Function PeekBottom As _TYPE_ Pointer
Declare Sub Dup(ByVal Copies As UInteger = 1)
Declare Sub DupBottom(ByVal Copies As UInteger = 1)
Declare Sub PadTop(ByVal Items As UInteger = 1, Value As _TYPE_ = _DEFAULT_VALUE_)
Declare Sub PadBottom(ByVal Items As UInteger = 1, Value As _TYPE_ = _DEFAULT_VALUE_)
Declare Sub Roll(ByVal Items As UInteger = 1)
Declare Sub RollBottom(ByVal Items As UInteger = 1)
Declare Sub Erase()
Declare Property IsEmpty As Integer
Declare Property ItemCount As UInteger
Declare Function Clone As _TYPE_##Stack Pointer
Declare Sub CloneTo(ByRef Cloned As _TYPE_##Stack)
u implementaciji imate komentar pre svake metode/svojstva koji opisuje sta metoda/svojstvo radi