Pal, Peter's AutoIt Library Pal Wiki
Library for window, GUI, controls, string, math, data lists, dialogues
Brought to you by:
peverbeek
AutoIt file: Lists.au3
A shift register is a first-in-first-out (FIFO) type of data list. A value is placed at the first position by pushing it into it. And by popping the last value is returned and removed.
Local $aMyShift = _ShiftCreate() _ShiftPush( $aMyShift, "qwerty" ) ; into first position _ShiftPush( $aMyShift, "abcde" ) ; into first position .... If Not _ShiftIsEmpty( $aMyShift ) Then $Value = _ShiftPop( $aMyShift ) ; $Value = "qwerty" (last value)
Function | Description |
---|---|
_ShiftCreate | Creates a shift register (FIFO) for pushing and popping values |
_ShiftIsShift | Tests if given array is a shift register |
_ShiftIsEmpty | Tests if shift register is empty |
_ShiftClear | Clears a shift |
_ShiftPush | Pushes (adds) a value into the given shift register on first position |
_ShiftPop | Pops (removes) a value from the given shift register at last position |
_ShiftPeek | Gets the value to pop without actual popping (removing) |
_ShiftGet | Gets a value of a given position, zero-based |
_ShiftValueInShift | Tests if a value is in the shift register |
_ShiftSize | Gets shift register size |
_ShiftToArray | Creates an array from the given shift register |
_ArrayToShift | Creates a shift register from the given array |
For last-in-first-out (LIFO) lists you can use [stacks].