Gcode.Model.Program (gcode v0.4.1)
A G-code program is the high level object which contains each of the G-code blocks, comments, etc.
Example
iex> Program.init()
...> |> Result.unwrap!()
...> |> Enum.count()
0
Link to this section Summary
Functions
Initialise a new, empty G-code program.
Push a program element onto the end of the program.
Link to this section Types
Link to this type
element()
Specs
element() :: Gcode.Model.Block.t() | Gcode.Model.Comment.t() | Gcode.Model.Tape.t()
Link to this type
error()
Specs
error() :: {:program_error, String.t()}
Specs
t() :: %Gcode.Model.Program{elements: [element()]}
A G-code program
Link to this section Functions
Link to this function
init()
Specs
init() :: Gcode.Result.t(t())
Initialise a new, empty G-code program.
iex> Program.init()
{:ok, %Program{elements: []}}
Link to this function
push(program, element)
Specs
push(t(), element()) :: Gcode.Result.t(t(), error())
Push a program element onto the end of the program.
iex> {:ok, program} = Program.init()
...> {:ok, tape} = Tape.init()
...> Program.push(program, tape)
{:ok, %Program{elements: [%Tape{}]}}