* \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
| 79 | * rig_ext_func_foreach. |
| 80 | */ |
| 81 | int 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 | /** |
no test coverage detected