; Block stack macros
; ==================
;
; These macros provide a LIFO stack for cutting and pasteing onto.
; (c) J.Harper 04-Sep-92

; Setup stack counter -- set to unit 1 so 0 can be used for normal copying.
(global `_stkct' 1)

; Copies text to stack buffer.
; (stkcopy `sectionType')
(macro `stkcopy'
{
    (local `sect' (arg 1 `s' `section> '))
    (copy (sect) (_stkct))
    (= `_stkct' (+ (_stkct) 1))
    (return 1)
})

; Cuts text to stack buffer.
; (stkcut `sectionType')
(macro `stkcut'
{
    (local `sect' (arg 1 `s' `section> '))
    (cut (sect) (_stkct))
    (= `_stkct' (+ (_stkct) 1))
    (return 1)
})
	      
; Inserts text from stack buffer.
; (stkins)
(macro `stkins'
{
    (if (> (_stkct) 1)                  ; Is anything on the stack?
    {
	(= `_stkct' (- (_stkct) 1))     ; Decrement counter
	(insert `cb' (_stkct))          ; Insert from clipboard
	(return 1)
    }
    {
	(settitle `Nothing on block stack.')
	(return 0)
    })
})

