pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

VisualBasic pastebin - collaborative debugging tool View Help


Posted by ascagnel on Sat 7 Nov 18:50
report abuse | download | new post

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Stack"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = False
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. Option Explicit
  11. Private StackValues()
  12. Private StackHead As Integer
  13. Public Sub Push(InputVariant)
  14.     StackHead = StackHead + 1
  15.     ReDim Preserve StackValues(1 To StackHead)
  16.     StackValues(StackHead) = InputVariant
  17. End Sub
  18. Public Function Pop()
  19.     If StackHead = 0 Then
  20.         Pop = Null
  21.     ElseIf StackHead = 1 Then
  22.         StackHead = 0
  23.         ReDim StackValues(1 To 1)
  24.     Else
  25.         Pop = StackValues(StackHead)
  26.         StackHead = StackHead - 1
  27.         ReDim Preserve StackValues(1 To StackHead)
  28.     End If
  29. End Function
  30. Public Function Peek(Optional TargetAddress)
  31.     If IsMissing(TargetAddress) Then
  32.         Peek = StackValues(StackHead)
  33.     Else
  34.         If (TargetAddress <= 0) Or (TargetAddress > StackHead) Then
  35.             Peek = -1
  36.         Else
  37.             Peek = StackValues(TargetAddress)
  38.         End If
  39.     End If
  40. End Function
  41. Public Sub Init(InputVariant)
  42.     ReDim StackValues(1 To 1)
  43.     StackHead = 1
  44.     StackValues(1) = InputVariant
  45. End Sub
  46. Public Sub DumpToDebug()
  47.     Dim Counter As Integer
  48.     For Counter = 1 To StackHead
  49.         Debug.Print Counter & ": " & StackValues(Counter)
  50.     Next
  51. End Sub
  52. Public Function Depth() As Integer
  53.     Depth = StackHead
  54. End Function
  55. Public Function InStack(ValueToCheck) As Boolean
  56.     Dim Counter As Integer
  57.     InStack = False
  58.     For Counter = 1 To StackHead
  59.         If StackValues(Counter) = ValueToCheck Then
  60.             InStack = True
  61.         End If
  62.     Next
  63. End Function

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post