~cypheon/kicad2spice

7db081118314ae160e012dfd1cb30de4373f7b16 — Johann Rudloff 5 years ago 482cfdc
Provide convenience accessor for component extra fields.
1 files changed, 7 insertions(+), 0 deletions(-)

M lib/schematic.ml
M lib/schematic.ml => lib/schematic.ml +7 -0
@@ 3,6 3,10 @@ include Geometry
module Fields = struct
  include Map.Make(String)

  module Keys = struct
    let spice_netlist_enabled = "Spice_Netlist_Enabled"
  end

  let pp pval fmt m = let open Format in
    pp_print_string fmt "{Fields.t";
    pp_open_hbox fmt ();


@@ 15,6 19,9 @@ module Fields = struct
    (to_seq m);
    pp_close_box fmt ();
    pp_print_string fmt "}"

  let get fields k default_value =
    Stdlib.Option.value (find_opt k fields) ~default:default_value
end

module Wire = struct