MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / rig_ext_func_foreach

Function rig_ext_func_foreach

src/ext.c:81–117  ·  view source on GitHub ↗

* \param rig The rig handle * \param cfunc callback function of each extfunc * \param data cookie to be passed to \a cfunc callback * \brief Executes cfunc on all the elements stored in the extfuncs table * * The callback \a cfunc is called until it returns a value which is not * strictly positive. A zero value means a normal end of iteration, and a * negative value an abnormal end, which

Source from the content-addressed store, hash-verified

79 * rig_ext_func_foreach.
80 */
81int HAMLIB_API rig_ext_func_foreach(RIG *rig,
82 int (*cfunc)(RIG *,
83 const struct confparams *,
84 rig_ptr_t),
85 rig_ptr_t data)
86{
87 const struct confparams *cfp;
88
89 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
90
91 if (!rig || !rig->caps || !cfunc)
92 {
93 return -RIG_EINVAL;
94 }
95
96 for (cfp = rig->caps->extfuncs; cfp && cfp->name; cfp++)
97 {
98 if (!rig_has_ext_token(rig, cfp->token))
99 {
100 continue;
101 }
102
103 int ret = (*cfunc)(rig, cfp, data);
104
105 if (ret == 0)
106 {
107 return RIG_OK;
108 }
109
110 if (ret < 0)
111 {
112 return ret;
113 }
114 }
115
116 return RIG_OK;
117}
118
119
120/**

Callers 2

dumpcapsFunction · 0.85
dumpstateFunction · 0.85

Calls 2

rig_debugFunction · 0.85
rig_has_ext_tokenFunction · 0.85

Tested by

no test coverage detected