* \brief Lookup an extension levels or parameters token by its name and return * a pointer to the containing #confparams structure member. * * \param amp The #AMP handle. * \param name The extension levels or parameters token name. * * Searches the amp_caps::extlevels table and then the amp_caps::extparms * table for the token by its name. * * \note As this function is called by amp_ext_t
| 170 | * \todo Should use Lex to speed it up, strcmp() hurts! |
| 171 | */ |
| 172 | const struct confparams *HAMLIB_API amp_ext_lookup(AMP *amp, const char *name) |
| 173 | { |
| 174 | const struct confparams *cfp; |
| 175 | |
| 176 | rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); |
| 177 | |
| 178 | if (!amp || !amp->caps) |
| 179 | { |
| 180 | return NULL; |
| 181 | } |
| 182 | |
| 183 | for (cfp = amp->caps->extlevels; cfp && cfp->name; cfp++) |
| 184 | { |
| 185 | if (!strcmp(cfp->name, name)) |
| 186 | { |
| 187 | return cfp; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | for (cfp = amp->caps->extparms; cfp && cfp->name; cfp++) |
| 192 | { |
| 193 | if (!strcmp(cfp->name, name)) |
| 194 | { |
| 195 | return cfp; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | return NULL; |
| 200 | } |
| 201 | |
| 202 | |
| 203 | /** |
no test coverage detected