30 lines
759 B
Plaintext
30 lines
759 B
Plaintext
void local fn StackPush( stack as CFMutableArrayRef, obj as CFTypeRef )
|
|
MutableArrayAddObject( stack, obj )
|
|
end fn
|
|
|
|
CFTypeRef local fn StackPop( stack as CFMutableArrayRef )
|
|
CFTypeRef obj = fn ArrayLastObject( stack )
|
|
MutableArrayRemoveLastObject( stack )
|
|
end fn = obj
|
|
|
|
BOOL def fn StackIsEmpty( stack as CFMutableArrayRef ) = len(stack) == 0
|
|
|
|
void local fn DoIt
|
|
CFMutableArrayRef stack = fn MutableArrayNew
|
|
|
|
print @"Stack is empty: ";fn StackIsEmpty( stack )
|
|
|
|
print : print @"Stack push \"String\""
|
|
fn StackPush( stack, @"String" )
|
|
print @"Stack is empty: ";fn StackIsEmpty( stack )
|
|
|
|
CFTyperef obj = fn StackPop( stack )
|
|
print : print @"Stack pop: ";obj
|
|
|
|
print @"Stack is empty: ";fn StackIsEmpty( stack )
|
|
end fn
|
|
|
|
fn DoIt
|
|
|
|
HandleEvents
|