Gcode.Model.Program (gcode v1.0.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
Summary
Functions
Initialise a new, empty G-code program.
Push a program element onto the end of the program.
Types
Link to this type
element()
@type element() :: Gcode.Model.Block.t() | Gcode.Model.Comment.t() | Gcode.Model.Tape.t()
Link to this type
error()
@type error() :: {:program_error, String.t()}
@type t() :: %Gcode.Model.Program{elements: [element()]}
A G-code program
Functions
Link to this function
init()
@spec 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)
@spec 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{}]}}