Files
essim/src/system/pins.cpp
François 280526304d Signal-type popup, NC pin tagging, interactive viewer hygiene.
- Enter on a signal entry (net / explore) opens a modal popup to pick
  power / gnd / other. Recording is deduped: a sequence of toggles on
  the same signal collapses to a single `set-signal-type` line; no-op
  selections record nothing.
- Bare interactive commands (the ones that open a full-screen mode)
  are no longer recorded by `script-save`. Their inline forms still
  are. Mutating actions inside a screen record their own canonical
  line.
- Mentor importer treats signals whose name starts with `unconnected`
  as no-connect — the pin is kept on the part without a signal and
  tagged `ImportedUnconnected`.
- `drop_singleton_signals` runs at the end of `load`: any signal with
  exactly one pin is detached (singletons are NC by definition); the
  pin is tagged `DroppedSingleton`. Count is reported inline.
- `verify` gains a one-line orphan summary (imported NC / dropped
  singleton totals). Pins materialised by `FillIdentityNCs` are
  excluded via a `pin_map` filter — they are bridged to a real signal
  on the peer module and are not real NCs at system level.
- NcOrigin tag is serialized in save snapshots as an optional 4th
  field on N records (backward-compatible).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 07:56:46 +02:00

36 lines
921 B
C++

#include "pins.hpp"
#include "parts.hpp"
#include "signals.hpp"
Pin::Pin(std::string name)
: SystemElement(name), sig(nullptr), prnt(nullptr),
expected_signal_type(SignalType::Other) {};
const char *nc_origin_tag(NcOrigin o) {
switch (o) {
case NcOrigin::ImportedUnconnected: return "U";
case NcOrigin::DroppedSingleton: return "D";
case NcOrigin::None: return "";
}
return "";
}
bool nc_origin_from_tag(const std::string &tag, NcOrigin &out) {
if (tag == "U") { out = NcOrigin::ImportedUnconnected; return true; }
if (tag == "D") { out = NcOrigin::DroppedSingleton; return true; }
return false;
}
bool Pin::connected()
{
return sig != nullptr;
}
void Pin::connect(Signal *signal)
{
sig = signal;
}
Pins::Pins(void) : SystemElementContainer<Pin>("pins") {}
Pins::Pins(std::vector<Pin *> pins) : SystemElementContainer<Pin>("pins", pins) {}