extflat: integrate cb_extflat_hiervisitresists_t for EFHierVisitResists()

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-07-20 16:29:20 +01:00
parent 0141a99af5
commit 420a24ef33
3 changed files with 24 additions and 17 deletions

View File

@ -1325,12 +1325,16 @@ spccapHierVisit(
*
* ----------------------------------------------------------------------------
*/
/*ARGUSED*/
/* @typedef cb_extflat_hiervisitresists_t (UNUSED) */
int
spcresistHierVisit(
HierContext *hc,
HierName *hierName1,
HierName *hierName2,
float res)
const HierName *hierName1,
const HierName *hierName2,
float res,
ClientData cdata) // UNUSED
{
HashEntry *he;
EFNodeName *nn;
@ -2213,7 +2217,7 @@ esHierVisit(
EFHierVisitDevs(hcf, spcdevHierVisit, PTR2CD(NULL));
/* Output lumped parasitic resistors */
EFHierVisitResists(hcf, spcresistHierVisit, (ClientData)NULL);
EFHierVisitResists(hcf, spcresistHierVisit, PTR2CD(NULL));
/* Output coupling capacitances */
EFHierVisitCaps(hcf, spccapHierVisit, (ClientData)NULL);

View File

@ -559,13 +559,15 @@ efHierVisitSingleResist(hc, name1, name2, res, ca)
* Visit all the resistors in the circuit.
* 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_hiervisitresists_t:
*
* (*resProc)(hc, hn1, hn2, resistance, cdata)
* HierContext *hc;
* HierName *hn1, *hn2;
* int resistance;
* ClientData cdata;
* int (*resProc)(
* HierContext *hc,
* const HierName *hierName1,
* const HierName *hierName2,
* float resistance,
* ClientData cdata)
* {
* }
*
@ -586,15 +588,15 @@ efHierVisitSingleResist(hc, name1, name2, res, ca)
*/
int
EFHierVisitResists(hc, resProc, cdata)
HierContext *hc;
int (*resProc)();
ClientData cdata;
EFHierVisitResists(
HierContext *hc,
const cb_extflat_hiervisitresists_t resProc,
ClientData cdata)
{
CallArg ca;
int efHierVisitResists(); /* Forward reference */
ca.ca_proc = resProc;
ca.ca_proc = (int (*)()) resProc;
ca.ca_cdata = cdata;
return efHierVisitResists(hc, (ClientData) &ca);
}
@ -630,7 +632,7 @@ efHierVisitResists(hc, ca)
res, ca))
return 1;
}
else if (efHierSrArray(hc, res, efHierVisitSingleResist, (ClientData) ca))
else if (efHierSrArray(hc, res, efHierVisitSingleResist, PTR2CD(ca)))
return 1;
}
return 0;

View File

@ -130,7 +130,8 @@ extern int EFVisitSubcircuits();
extern int EFHierVisitSubcircuits();
typedef int (*cb_extflat_hiervisitdevs_t)(HierContext *hc, Dev *dev, float scale, ClientData cdata);
extern int EFHierVisitDevs(HierContext *hc, const cb_extflat_hiervisitdevs_t devProc, ClientData cdata);
extern int EFHierVisitResists();
typedef int (*cb_extflat_hiervisitresists_t)(HierContext *hc, const HierName *hierName1, const HierName *hierName2, float resistance, ClientData cdata);
extern int EFHierVisitResists(HierContext *hc, const cb_extflat_hiervisitresists_t resProc, ClientData cdata);
extern int EFHierVisitCaps();
extern int EFHierVisitNodes();