extflat: integrate cb_extflat_visitresists_t for EFVisitResists()

Additionally the HierName's hierName1 and hierName2 arguments have been
made 'const' to help convey the receiver can not modify the referenced
data passed.
This commit is contained in:
Darryl L. Miles
2025-08-06 22:58:30 +01:00
parent 0bb29ae5f8
commit 0141a99af5
5 changed files with 26 additions and 22 deletions
+13 -11
View File
@@ -456,12 +456,14 @@ skip:
* Must be called after EFFlatBuild().
* For each resistor in the circuit, call the user-supplied procedure
* (*resProc)(), which should be of the following form, where hn1 and
* hn2 are the HierNames of the two nodes connected by the resistor.
* hn2 are the HierNames of the two nodes connected by the resistor
* see also typedef cb_extflat_visitresists_t:
*
* (*resProc)(hn1, hn2, resistance, cdata)
* HierName *hn1, *hn2;
* int resistance;
* ClientData cdata;
* int (*resProc)(
* const HierName *hn1,
* const HierName *hn2,
* float resistance,
* ClientData cdata)
* {
* }
*
@@ -482,15 +484,15 @@ skip:
*/
int
EFVisitResists(resProc, cdata)
int (*resProc)();
ClientData cdata;
EFVisitResists(
const cb_extflat_visitresists_t resProc,
ClientData cdata)
{
CallArg ca;
ca.ca_proc = resProc;
ca.ca_proc = (int (*)()) resProc;
ca.ca_cdata = cdata;
return efVisitResists(&efFlatContext, (ClientData) &ca);
return efVisitResists(&efFlatContext, &ca);
}
/*
@@ -585,7 +587,7 @@ efVisitSingleResist(hc, name1, name2, res, ca)
return (*ca->ca_proc)(n1->efnode_name->efnn_hier,
n2->efnode_name->efnn_hier,
res->conn_res, ca->ca_cdata);
res->conn_res, ca->ca_cdata); /* @invoke cb_extflat_visitresists_t */
}
/*
+3 -2
View File
@@ -118,8 +118,9 @@ typedef int (*cb_extflat_visitdevs_t)(Dev *dev, HierContext *hc, float scale, Tr
extern int EFVisitDevs(const cb_extflat_visitdevs_t devProc, ClientData cdata);
extern int efVisitDevs(HierContext *hc, CallArg *ca);
extern bool efSymLook();
extern int efVisitResists();
extern int EFVisitResists();
extern int efVisitResists(HierContext *hc, CallArg *ca);
typedef int (*cb_extflat_visitresists_t)(const HierName *hn1, const HierName *hn2, float resistance, ClientData cdata);
extern int EFVisitResists(const cb_extflat_visitresists_t resProc, ClientData cdata);
extern int EFVisitNodes();
extern int EFVisitCaps();
extern void EFGetLengthAndWidth();