-- | Stacks
module CsoundExpr.Opcodes.Control.Stacks
    (stack,
     pop,
     push)
where



import CsoundExpr.Base.Types
import CsoundExpr.Base.MultiOut
import CsoundExpr.Base.SideEffect
import CsoundExpr.Base.UserDefined



-- | * opcode : stack
--  
--  
-- * syntax : 
--  
--  >   stack iStackSize
--  
--  
-- * description : 
--  
--  Initializes and sets the size of the global stack.
--  
--  
-- * url : <http://www.csounds.com/manual/html/stack.html>
 
stack :: Irate -> SignalOut
stack i0StackSize = outOpcode "stack" args
  where args = [to i0StackSize]


-- | * opcode : pop
--  
--  
-- * syntax : 
--  
--  >   xval1, [xval2,..., xval31] pop
--  >   ival1, [ival2,..., ival31] pop
--  
--  
-- * description : 
--  
--  Pops values from the global stack.
--  
--  
-- * url : <http://www.csounds.com/manual/html/pop.html>
 
pop :: MultiOut
pop = opcode "pop" args
  where args = []


-- | * opcode : push
--  
--  
-- * syntax : 
--  
--  >   push xval1, [xval2,..., xval31]
--  >   push ival1, [ival2,..., ival31]
--  
--  
-- * description : 
--  
--  Pushes a value into the global stack.
--  
--  
-- * url : <http://www.csounds.com/manual/html/push.html>
 
push :: (X x0) => [x0] -> SignalOut
push x0valN = outOpcode "push" args
  where args = map to x0valN