~cypheon/kicad2spice

92c8156c1a874a8210631fdf9e15dceeac19cdcc — Johann Rudloff 3 years ago d18aa33
Move write_* functions closer together.
1 files changed, 9 insertions(+), 9 deletions(-)

M lib/export_spice.ml
M lib/export_spice.ml => lib/export_spice.ml +9 -9
@@ 7,15 7,6 @@ let comp_ignored comp =
  comp.Comp.ref.[0] = '#'
  || Fields.get comp.Comp.fields Fields.Keys.spice_netlist_enabled "Y" <> "Y"

let write_comp outch pin_cache comp name =
  let pin_nets = map (fun pin ->
    Hashtbl.find pin_cache (comp.Comp.ref, pin.Pin.number)
    ) comp.Comp.part.CompDef.pins in
  output_string outch name;
  output_string outch (" " ^ (String.concat " " pin_nets));
  output_string outch (" " ^ (comp.Comp.value));
  output_string outch "\n"

let make_cache kf vf xs =
  let tbl = Hashtbl.create (Enum.count xs) in
  Enum.iter (fun x ->


@@ 41,6 32,15 @@ let make_unique used name =
    in helper 2
  end

let write_comp outch pin_cache comp name =
  let pin_nets = map (fun pin ->
    Hashtbl.find pin_cache (comp.Comp.ref, pin.Pin.number)
    ) comp.Comp.part.CompDef.pins in
  output_string outch name;
  output_string outch (" " ^ (String.concat " " pin_nets));
  output_string outch (" " ^ (comp.Comp.value));
  output_string outch "\n"

let write_netlist outch schematic netlist =
  let net_names = make_cache id ( fun net_name ->
    Netlist.driver_net_name netlist net_name